aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2014-08-13 18:32:56 -0500
committerDavid Barksdale <amatus@amatus.name>2014-08-13 18:32:56 -0500
commitcddfc3baae08e24185c7716434452ebbd404cd39 (patch)
tree01e1f933fd8724bf2ad34db47730c98feefc0a7c
parent3918522a523adc3f001cf9c5da327d8fb383c26e (diff)
-rwxr-xr-xarch/powerpc/boot/dts/apollo3g.dts24
-rw-r--r--arch/powerpc/configs/44x/apollo_3G_nas_defconfig129
-rw-r--r--arch/powerpc/platforms/44x/Makefile1
-rw-r--r--arch/powerpc/platforms/44x/apollo3g-usb.c110
-rwxr-xr-xdrivers/ata/sata_dwc_pmp.c2
-rw-r--r--drivers/leds/led-class-3g.c445
-rw-r--r--drivers/leds/leds-apollo3g.c51
-rw-r--r--drivers/net/ibm_newemac/core.c263
-rw-r--r--drivers/net/ibm_newemac/emac.h1
-rw-r--r--drivers/net/ibm_newemac/tah.c79
-rw-r--r--drivers/net/ibm_newemac/tah.h22
-rw-r--r--drivers/scsi/scsi_sysfs.c8
-rw-r--r--drivers/usb/core/message.c14
-rw-r--r--drivers/usb/core/usb.c2
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_cil.c14
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_cil.c.org3237
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_hcd.c138
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_hcd.c.org2900
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_hcd.h31
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_hcd.h.org660
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_hcd_intr.c48
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_hcd_intr.c.org1746
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_hcd_queue.c233
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_hcd_queue.c.org696
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c13
-rw-r--r--drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c.org1408
-rw-r--r--drivers/usb/gadget/dwc_otg/linux/dwc_otg_plat.h4
-rw-r--r--drivers/usb/gadget/dwc_otg/linux/dwc_otg_plat.h.org304
-rw-r--r--drivers/usb/gadget/dwc_otg/ppc4xx_dma.h2
-rw-r--r--drivers/usb/gadget/dwc_otg/ppc4xx_dma.h.org620
-rw-r--r--drivers/usb/gadget/dwc_otg/sdiff/dwc_otg_hcd.c.sdiff2944
-rw-r--r--drivers/usb/gadget/dwc_otg/sdiff/dwc_otg_hcd.h.sdiff675
-rw-r--r--drivers/usb/gadget/dwc_otg/sdiff/dwc_otg_hcd_intr.c.sdiff1763
-rw-r--r--drivers/usb/gadget/dwc_otg/sdiff/dwc_otg_hcd_queue.c.sdiff821
-rw-r--r--fs/splice.c6
-rwxr-xr-ximages/apollo3g.dtbbin0 -> 8373 bytes
-rwxr-xr-ximages/uImagebin0 -> 3466961 bytes
-rw-r--r--net/ipv4/tcp.c3
38 files changed, 19047 insertions, 370 deletions
diff --git a/arch/powerpc/boot/dts/apollo3g.dts b/arch/powerpc/boot/dts/apollo3g.dts
index ffe03c281e6..2bd481d55a6 100755
--- a/arch/powerpc/boot/dts/apollo3g.dts
+++ b/arch/powerpc/boot/dts/apollo3g.dts
@@ -179,6 +179,30 @@
/*RX1 COAL 0xd 0x2*/>;
};
+ USBOTG0: usbotg@bff80000 {
+ compatible = "amcc,usb-otg-405ex";
+ reg = <4 0xbff80000 0x10000>;
+ interrupt-parent = <&USBOTG0>;
+ interrupts = <0 1 2>;
+ #interrupt-cells = <1>;
+ #address-cells = <0>;
+ #size-cells = <0>;
+ interrupt-map = </* USB-OTG */ 0 &UIC2 0x1c 4
+ /* HIGH-POWER */ 1 &UIC1 0x1a 8
+ /* DMA */ 2 &UIC0 0xc 4>;
+ };
+
+
+ /* SATA DWC devices */
+ SATA0: sata@bffd1000 {
+ compatible = "amcc,sata-460ex";
+ reg = <4 0xbffd1000 0x800 /* SATA0 */
+ 4 0xbffd0800 0x400>; /* AHBDMA */
+ dma-channel=<0>;
+ interrupt-parent = <&UIC0>;
+ interrupts = <26 4 /* SATA0 */
+ 25 4>; /* AHBDMA */
+ };
SATA1: sata@bffd1800 {
compatible = "amcc,sata-460ex";
reg = <4 0xbffd1800 0x800 /* SATA1 */
diff --git a/arch/powerpc/configs/44x/apollo_3G_nas_defconfig b/arch/powerpc/configs/44x/apollo_3G_nas_defconfig
index d3308fff26e..6690df57a2c 100644
--- a/arch/powerpc/configs/44x/apollo_3G_nas_defconfig
+++ b/arch/powerpc/configs/44x/apollo_3G_nas_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32.11
-# Fri Aug 6 10:01:35 2010
+# Thu Sep 15 14:29:56 2011
#
# CONFIG_PPC64 is not set
@@ -97,8 +97,7 @@ CONFIG_RCU_FANOUT=32
CONFIG_LOG_BUF_SHIFT=14
# CONFIG_GROUP_SCHED is not set
# CONFIG_CGROUPS is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
# CONFIG_RELAY is not set
# CONFIG_NAMESPACES is not set
CONFIG_BLK_DEV_INITRD=y
@@ -163,10 +162,10 @@ CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
-# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_FORCE_LOAD=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
-# CONFIG_MODVERSIONS is not set
+CONFIG_MODVERSIONS=y
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_BLOCK=y
CONFIG_LBDAF=y
@@ -206,6 +205,7 @@ CONFIG_DCU_ENABLE=y
# CONFIG_ARCHES is not set
# CONFIG_BEECH is not set
CONFIG_APOLLO3G=y
+# CONFIG_BLUESTONE is not set
# CONFIG_CANYONLANDS is not set
# CONFIG_ACER is not set
# CONFIG_GLACIER is not set
@@ -812,7 +812,7 @@ CONFIG_SATA_DWC_PMP=y
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_AUTODETECT=y
-# CONFIG_MD_LINEAR is not set
+CONFIG_MD_LINEAR=y
CONFIG_MD_RAID0=y
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
@@ -1263,7 +1263,7 @@ CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_ARCH_HAS_EHCI=y
-CONFIG_USB=y
+CONFIG_USB=m
# CONFIG_USB_DEBUG is not set
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
@@ -1286,7 +1286,10 @@ CONFIG_USB_DEVICE_CLASS=y
#
# CONFIG_USB_C67X00_HCD is not set
# CONFIG_USB_XHCI_HCD is not set
-# CONFIG_USB_EHCI_HCD is not set
+CONFIG_USB_EHCI_HCD=m
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+CONFIG_USB_EHCI_TT_NEWSCHED=y
+CONFIG_USB_EHCI_HCD_PPC_OF=y
# CONFIG_USB_OXU210HP_HCD is not set
# CONFIG_USB_ISP116X_HCD is not set
# CONFIG_USB_ISP1760_HCD is not set
@@ -1313,7 +1316,7 @@ CONFIG_USB_DEVICE_CLASS=y
#
# also be needed; see USB_STORAGE Help for more info
#
-CONFIG_USB_STORAGE=y
+CONFIG_USB_STORAGE=m
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_FREECOM is not set
@@ -1356,13 +1359,14 @@ CONFIG_USB_LIBUSUAL=y
# CONFIG_USB_IDMOUSE is not set
# CONFIG_USB_FTDI_ELAN is not set
# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
# CONFIG_USB_LD is not set
# CONFIG_USB_TRANCEVIBRATOR is not set
# CONFIG_USB_IOWARRIOR is not set
# CONFIG_USB_TEST is not set
# CONFIG_USB_ISIGHTFW is not set
# CONFIG_USB_VST is not set
-CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET=m
# CONFIG_USB_GADGET_DEBUG is not set
# CONFIG_USB_GADGET_DEBUG_FILES is not set
# CONFIG_USB_GADGET_DEBUG_FS is not set
@@ -1377,7 +1381,7 @@ CONFIG_USB_PERIPHERAL_CONTROLLER=y
# CONFIG_USB_GADGET_GOKU is not set
# CONFIG_USB_GADGET_LANGWELL is not set
CONFIG_USB_GADGET_DWC_OTG=y
-CONFIG_USB_DWC_OTG=y
+CONFIG_USB_DWC_OTG=m
CONFIG_DWC_OTG_MODE=y
# CONFIG_DWC_HOST_ONLY is not set
# CONFIG_DWC_DEVICE_ONLY is not set
@@ -1389,8 +1393,7 @@ CONFIG_USB_GADGET_DUALSPEED=y
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_ETH is not set
# CONFIG_USB_GADGETFS is not set
-CONFIG_USB_FILE_STORAGE=m
-# CONFIG_USB_FILE_STORAGE_TEST is not set
+# CONFIG_USB_FILE_STORAGE is not set
# CONFIG_USB_G_SERIAL is not set
# CONFIG_USB_MIDI_GADGET is not set
# CONFIG_USB_G_PRINTER is not set
@@ -1548,7 +1551,8 @@ CONFIG_INOTIFY_USER=y
# CONFIG_QUOTA is not set
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
-# CONFIG_FUSE_FS is not set
+CONFIG_FUSE_FS=y
+CONFIG_CUSE=y
#
# Caches
@@ -1564,9 +1568,14 @@ CONFIG_INOTIFY_USER=y
#
# DOS/FAT/NT Filesystems
#
-# CONFIG_MSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
-# CONFIG_NTFS_FS is not set
+CONFIG_FAT_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+CONFIG_NTFS_FS=y
+# CONFIG_NTFS_DEBUG is not set
+# CONFIG_NTFS_RW is not set
#
# Pseudo filesystems
@@ -1583,8 +1592,8 @@ CONFIG_TMPFS=y
CONFIG_MISC_FILESYSTEMS=y
# CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
+CONFIG_HFS_FS=y
+CONFIG_HFSPLUS_FS=y
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
@@ -1653,13 +1662,14 @@ CONFIG_PARTITION_ADVANCED=y
# CONFIG_OSF_PARTITION is not set
# CONFIG_AMIGA_PARTITION is not set
# CONFIG_ATARI_PARTITION is not set
-# CONFIG_MAC_PARTITION is not set
+CONFIG_MAC_PARTITION=y
CONFIG_MSDOS_PARTITION=y
# CONFIG_BSD_DISKLABEL is not set
# CONFIG_MINIX_SUBPARTITION is not set
# CONFIG_SOLARIS_X86_PARTITION is not set
# CONFIG_UNIXWARE_DISKLABEL is not set
-# CONFIG_LDM_PARTITION is not set
+CONFIG_LDM_PARTITION=y
+# CONFIG_LDM_DEBUG is not set
# CONFIG_SGI_PARTITION is not set
# CONFIG_ULTRIX_PARTITION is not set
# CONFIG_SUN_PARTITION is not set
@@ -1668,44 +1678,44 @@ CONFIG_EFI_PARTITION=y
# CONFIG_SYSV68_PARTITION is not set
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
-# CONFIG_NLS_CODEPAGE_737 is not set
-# CONFIG_NLS_CODEPAGE_775 is not set
-# CONFIG_NLS_CODEPAGE_850 is not set
-# CONFIG_NLS_CODEPAGE_852 is not set
-# CONFIG_NLS_CODEPAGE_855 is not set
-# CONFIG_NLS_CODEPAGE_857 is not set
-# CONFIG_NLS_CODEPAGE_860 is not set
-# CONFIG_NLS_CODEPAGE_861 is not set
-# CONFIG_NLS_CODEPAGE_862 is not set
-# CONFIG_NLS_CODEPAGE_863 is not set
-# CONFIG_NLS_CODEPAGE_864 is not set
-# CONFIG_NLS_CODEPAGE_865 is not set
-# CONFIG_NLS_CODEPAGE_866 is not set
-# CONFIG_NLS_CODEPAGE_869 is not set
-# CONFIG_NLS_CODEPAGE_936 is not set
-# CONFIG_NLS_CODEPAGE_950 is not set
-# CONFIG_NLS_CODEPAGE_932 is not set
-# CONFIG_NLS_CODEPAGE_949 is not set
-# CONFIG_NLS_CODEPAGE_874 is not set
-# CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_CODEPAGE_1250 is not set
-# CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_ISO8859_1 is not set
-# CONFIG_NLS_ISO8859_2 is not set
-# CONFIG_NLS_ISO8859_3 is not set
-# CONFIG_NLS_ISO8859_4 is not set
-# CONFIG_NLS_ISO8859_5 is not set
-# CONFIG_NLS_ISO8859_6 is not set
-# CONFIG_NLS_ISO8859_7 is not set
-# CONFIG_NLS_ISO8859_9 is not set
-# CONFIG_NLS_ISO8859_13 is not set
-# CONFIG_NLS_ISO8859_14 is not set
-# CONFIG_NLS_ISO8859_15 is not set
-# CONFIG_NLS_KOI8_R is not set
-# CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_CODEPAGE_737=y
+CONFIG_NLS_CODEPAGE_775=y
+CONFIG_NLS_CODEPAGE_850=y
+CONFIG_NLS_CODEPAGE_852=y
+CONFIG_NLS_CODEPAGE_855=y
+CONFIG_NLS_CODEPAGE_857=y
+CONFIG_NLS_CODEPAGE_860=y
+CONFIG_NLS_CODEPAGE_861=y
+CONFIG_NLS_CODEPAGE_862=y
+CONFIG_NLS_CODEPAGE_863=y
+CONFIG_NLS_CODEPAGE_864=y
+CONFIG_NLS_CODEPAGE_865=y
+CONFIG_NLS_CODEPAGE_866=y
+CONFIG_NLS_CODEPAGE_869=y
+CONFIG_NLS_CODEPAGE_936=y
+CONFIG_NLS_CODEPAGE_950=y
+CONFIG_NLS_CODEPAGE_932=y
+CONFIG_NLS_CODEPAGE_949=y
+CONFIG_NLS_CODEPAGE_874=y
+CONFIG_NLS_ISO8859_8=y
+CONFIG_NLS_CODEPAGE_1250=y
+CONFIG_NLS_CODEPAGE_1251=y
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
+CONFIG_NLS_ISO8859_2=y
+CONFIG_NLS_ISO8859_3=y
+CONFIG_NLS_ISO8859_4=y
+CONFIG_NLS_ISO8859_5=y
+CONFIG_NLS_ISO8859_6=y
+CONFIG_NLS_ISO8859_7=y
+CONFIG_NLS_ISO8859_9=y
+CONFIG_NLS_ISO8859_13=y
+CONFIG_NLS_ISO8859_14=y
+CONFIG_NLS_ISO8859_15=y
+CONFIG_NLS_KOI8_R=y
+CONFIG_NLS_KOI8_U=y
+CONFIG_NLS_UTF8=y
# CONFIG_DLM is not set
# CONFIG_BINARY_PRINTF is not set
@@ -1834,7 +1844,6 @@ CONFIG_SECURITYFS=y
# CONFIG_SECURITY_NETWORK is not set
# CONFIG_SECURITY_PATH is not set
# CONFIG_SECURITY_FILE_CAPABILITIES is not set
-# CONFIG_SECURITY_ROOTPLUG is not set
CONFIG_SECURITY_TRUSTEES=y
# CONFIG_SECURITY_TRUSTEES_DEBUG is not set
# CONFIG_SECURITY_TOMOYO is not set
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index 084f9b0561a..416e85f1d40 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -6,5 +6,6 @@ obj-$(CONFIG_WARP) += warp.o
obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o
obj-$(CONFIG_XILINX_ML510) += virtex_ml510.o
obj-$(CONFIG_BEECH) += beech-usb.o
+obj-$(CONFIG_APOLLO3G) += apollo3g-usb.o
obj-$(CONFIG_APOLLO3G) += apollo3g-gpio.o
obj-$(CONFIG_BLUESTONE) += bluestone-usb.o
diff --git a/arch/powerpc/platforms/44x/apollo3g-usb.c b/arch/powerpc/platforms/44x/apollo3g-usb.c
new file mode 100644
index 00000000000..f3fa2613737
--- /dev/null
+++ b/arch/powerpc/platforms/44x/apollo3g-usb.c
@@ -0,0 +1,110 @@
+/*
+ * AMCC Kilauea USB-OTG wrapper
+ *
+ * Copyright 2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
+ *
+ * Extract the resources (MEM & IRQ) from the dts file and put them
+ * into the platform-device struct for usage in the platform-device
+ * USB-OTG driver.
+ *
+ */
+
+#include <linux/platform_device.h>
+#include <linux/of_platform.h>
+#define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL))
+#define U64_TO_U32_HIGH(val) ((u32)((val) >> 32))
+
+
+/*
+ * Resource template will be filled dynamically with the values
+ * extracted from the dts file
+ */
+static struct resource usb_otg_resources[] = {
+ [0] = {
+ /* 405EX USB-OTG registers */
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ /* 405EX OTG IRQ */
+ .flags = IORESOURCE_IRQ,
+ },
+ [2] = {
+ /* High-Power workaround IRQ */
+ .flags = IORESOURCE_IRQ,
+ },
+ [3] = {
+ /* 405EX DMA IRQ */
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 dma_mask = 0xffffffffULL;
+
+static struct platform_device usb_otg_device = {
+ .name = "dwc_otg",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(usb_otg_resources),
+ .resource = usb_otg_resources,
+ .dev = {
+ .dma_mask = &dma_mask,
+ .coherent_dma_mask = 0xffffffffULL,
+ }
+};
+
+static struct platform_device *ppc405ex_devs[] __initdata = {
+ &usb_otg_device,
+};
+
+static int __devinit ppc405ex_usb_otg_probe(struct of_device *ofdev,
+ const struct of_device_id *match)
+{
+ struct device_node *np = ofdev->node;
+ struct resource res;
+
+ /*
+ * Extract register address reange from device tree and put it into
+ * the platform device structure
+ */
+ if (of_address_to_resource(np, 0, &res)) {
+ printk(KERN_ERR "%s: Can't get USB-OTG register address\n", __func__);
+ return -ENOMEM;
+ }
+ usb_otg_resources[0].start = res.start;
+ usb_otg_resources[0].end = res.end;
+
+ /*
+ * Extract IRQ number(s) from device tree and put them into
+ * the platform device structure
+ */
+ usb_otg_resources[1].start = usb_otg_resources[1].end =
+ irq_of_parse_and_map(np, 0);
+ usb_otg_resources[2].start = usb_otg_resources[2].end =
+ irq_of_parse_and_map(np, 1);
+ usb_otg_resources[3].start = usb_otg_resources[3].end =
+ irq_of_parse_and_map(np, 2);
+ return platform_add_devices(ppc405ex_devs, ARRAY_SIZE(ppc405ex_devs));
+}
+
+static int __devexit ppc405ex_usb_otg_remove(struct of_device *ofdev)
+{
+ /* Nothing to do here */
+ return 0;
+}
+
+static const struct of_device_id ppc405ex_usb_otg_match[] = {
+ { .compatible = "amcc,usb-otg-405ex", },
+ {}
+};
+
+static struct of_platform_driver ppc405ex_usb_otg_driver = {
+ .name = "ppc405ex-usb-otg",
+ .match_table = ppc405ex_usb_otg_match,
+ .probe = ppc405ex_usb_otg_probe,
+ .remove = ppc405ex_usb_otg_remove,
+};
+
+static int __init ppc405ex_usb_otg_init(void)
+{
+ return of_register_platform_driver(&ppc405ex_usb_otg_driver);
+}
+device_initcall(ppc405ex_usb_otg_init);
diff --git a/drivers/ata/sata_dwc_pmp.c b/drivers/ata/sata_dwc_pmp.c
index df3b490f86e..54b69d67e35 100755
--- a/drivers/ata/sata_dwc_pmp.c
+++ b/drivers/ata/sata_dwc_pmp.c
@@ -1110,7 +1110,7 @@ static int dma_dwc_xfer_setup(struct ata_queued_cmd *qc,
#if defined(CONFIG_APM82181)
if (dma_ch == 0) {
/* Buffer mode enabled, FIFO_MODE=0 */
- out_le32(&(sata_dma_regs->chan_regs[dma_ch].cfg.high), 0x000000d);
+ out_le32(&(sata_dma_regs->chan_regs[dma_ch].cfg.high), 0x0000009);
/* Channel 0 bit[7:5] */
out_le32(&(sata_dma_regs->chan_regs[dma_ch].cfg.low), 0x00000020);
} else if (dma_ch == 1) {
diff --git a/drivers/leds/led-class-3g.c b/drivers/leds/led-class-3g.c
index c0c1c11cbdb..7b8e0fa45ed 100644
--- a/drivers/leds/led-class-3g.c
+++ b/drivers/leds/led-class-3g.c
@@ -20,59 +20,296 @@
#include <linux/err.h>
#include <linux/ctype.h>
#include <linux/leds.h>
+#include <linux/errno.h>
#include "leds.h"
+#define MAX_USERS 32
+#define N_COLORS 4
+#define N_EVENTS 3
+#define USR_LEN 81
+#define EVENT_LEN 81
+#define INDEX_LEN 8
+
+
+/* LED users */
+#define EV_NAS_SYSTEM 0 /* Overall system: NAS ready, booting, shutdown... */
+#define EV_DISK_SMART 1 /* Disk SMART including temp., error lba, ...*/
+#define EV_DISK_IO 2 /* Disk read/write error */
+#define EV_RAID_CFG 3 /* RAID setup failure: assembling, formatting, rebuild ...*/
+#define EV_FW_UPDATE 4 /* NAS firmware update */
+#define EV_NETWORK 5 /* Network connectivity error */
+#define EV_VM 6 /* Volume manager */
+
+char Led_user_arr[MAX_USERS][USR_LEN] = { "EV_NAS_SYSTEM", \
+ "EV_DISK_SMART", \
+ "EV_DISK_IO" , \
+ "EV_RAID_CFG" , \
+ "EV_FW_UPDATE" , \
+ "EV_NETWORK" , \
+ "EV_VM", \
+ };
+/* LED event types */
+#define LED_STAT_OK 0 /* Happy user, normal operation */
+#define LED_STAT_ERR 1 /* User error, needs led indication */
+#define LED_STAT_IN_PROG 2 /* User doing something important, needs led indication */
+
+char *Led_ev_arr[] = { "LED_STAT_OK", "LED_STAT_ERR", "LED_STAT_IN_PROG" };
+
+char Color_map[MAX_USERS][N_EVENTS] = { {'g','r','w'}, /* EV_NAS_SYSTEM */ \
+ {'g','y','w'}, /* EV_DISK_SMART */ \
+ {'g','r','w'}, /* EV_DISK_IO */ \
+ {'g','r','w'}, /* EV_RAID_CFG */ \
+ {'g','r','w'}, /* EV_FW_UPDATE */ \
+ {'g','y','w'}, /* EV_NETWORK */ \
+ {'g','r','w'}, /* EV_VM */ \
+ };
+
+char Blink_map[MAX_USERS][N_EVENTS] = { {'n','n','n'}, /* EV_NAS_SYSTEM */ \
+ {'n','y','n'}, /* EV_DISK_SMART */ \
+ {'n','n','n'}, /* EV_DISK_IO */ \
+ {'n','n','n'}, /* EV_RAID_CFG */ \
+ {'n','n','n'}, /* EV_FW_UPDATE */ \
+ {'n','y','n'}, /* EV_NETWORK */ \
+ {'n','n','n'}, /* EV_VM */ \
+ };
+
+u32 Led_error_bits = 0;
+int N_USERS = 7; /* default number of users */
+
static struct class *leds_class;
static void led_update_color(struct led_classdev *led_cdev)
{
- if (led_cdev->color_get)
- led_cdev->color = led_cdev->color_get(led_cdev);
+ if (led_cdev->color_get)
+ led_cdev->color = led_cdev->color_get(led_cdev);
}
static ssize_t led_color_store(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t size)
+ struct device_attribute *attr, const char *buf, size_t size)
{
- struct led_classdev *led_cdev = dev_get_drvdata(dev);
- unsigned long state = 9;
-
- switch (buf[0]) {
- case 'r': /* red */
- state = 1;
- break;
- case 'g': /* green */
- state = 2;
- break;
- case 'b': /* blue */
- state = 3;
- break;
- case 'y': /* yellow */
- state = 4;
- break;
- case 'w': /* white */
- state = 5;
- break;
- case 'o': /* off */
- state = 0;
- break;
- default:
- break;
+ struct led_classdev *led_cdev = dev_get_drvdata(dev);
+ unsigned long state = 9;
+ char user[USR_LEN], event[EVENT_LEN], index_str[INDEX_LEN], color;
+ int i = 0, j = 0, found = 0, tmp = 0, edit_policy = 0;
+ int reg_user = -1, reg_event = -1, reg_color = -1;
+ const char * cptr = NULL;
+ long int index = -1;
+ char blink;
+ int reg_blink = 'n';
+
+ cptr = &buf[0];
+
+ /* check for 'register' event */
+ // NB: Format of register event is
+ // register:event,status,color
+ if( cptr[8] == ':' ) {
+ if( !memcmp("register", cptr, 8) ) {
+ edit_policy = 1;
+ cptr = &buf[9];
+ }
+ }
+
+ /* parse user name */
+ for( i = 0; i < (USR_LEN -1) && cptr[i]; i++ ) {
+ if( cptr[i] == ',' ) {
+ break;
+ }
+ user[i] = cptr[i];
+ }
+
+ /* null terminate user buf */
+ user[i] = '\0';
+ i++; /* skips the ',' delimiter */
+
+
+ for( j = 0; (j < EVENT_LEN -1) && cptr[i] ; j++,i++ ) {
+ if( (cptr[i] == ',') || (cptr[i] == '\0') || (cptr[i] == '\n') ) {
+ if( cptr[i] == ',' ) {
+ cptr = &cptr[i+1];
+ }
+ break;
+ }
+ event[j] = cptr[i];
+ }
+ /* null terminate event buf */
+ event[j] = '\0';
+
+ /* if editing policy, parse the color */
+ if( edit_policy ) {
+ if( cptr != NULL ) {
+ reg_color = cptr[0]; /* r,g,b,y,w */
+ if( reg_color != 'r' && reg_color != 'g' &&
+ reg_color != 'b' && reg_color != 'y' && reg_color != 'w' ) {
+ reg_color = -1; /* invalid color */
+ }
+
+ /** TBD: Get the value of reg_blink from cptr */
+ }
+ }
+ else {
+ /* scan index for some users */
+ if( !strcmp(user, Led_user_arr[EV_DISK_SMART]) ||
+ !strcmp(user, Led_user_arr[EV_DISK_IO]) ) {
+ if( cptr != NULL ) {
+ for( i = 0; (i < INDEX_LEN -1) && cptr[i] ; i++ ) {
+ if( (cptr[i] == ',') || (cptr[i] == '\0') || (cptr[i] == '\n') ) {
+ break;
+ }
+ index_str[i] = cptr[i];
+ }
+ }
+ }
+
+ /* null terminate index_str */
+ index_str[i] = '\0';
+ if( i ) {
+ tmp = strict_strtol(index_str, 10, &index);
+ if( !tmp && (index >= 0) ) {
+ /*
+ * TODO: insert code to fulfill req's. Currently not required.
+ */
+ /*printk(KERN_INFO "\nindex %ld\n", index);*/
+ }
+ }
+ } /* if( !edit_policy ) */
+
+ /* Validate user and event */
+ found = 0;
+ for( i = 0; i < N_USERS; i++ ) {
+ if( !strcmp( Led_user_arr[i], user ) ) {
+ found = 1;
+ break;
}
+ }
- led_set_color(led_cdev, state);
+ if( found || edit_policy) {
+ reg_user = i;
+ /* new user registration */
+ if( ! found ) {
+ if( N_USERS == MAX_USERS ) {
+ /* only support up to 32 users */
+ return (ssize_t)size;
+ }
+ reg_user = N_USERS++;
+
+ strcpy(Led_user_arr[reg_user], user);
+ }
+ found = 0;
+ for( j = 0; j < N_EVENTS; j++ ) {
+ if( ! strcmp(Led_ev_arr[j], event) ) {
+ if( j == LED_STAT_ERR ) {
+ Led_error_bits |= (1 << i); /* register error for this user */
+ }
+ else if( j == LED_STAT_OK ) {
+ Led_error_bits &= ~(1 << i); /* clear error for this user */
+ }
+ found = 1;
+ reg_event = j;
+ break;
+ }
+ }
+ }
+
+ /* if this is a register event, do just that */
+ if( edit_policy ) {
+ /* valid event above and color */
+ if( (reg_event != -1) && (reg_color != -1) ) {
+ Color_map[reg_user][reg_event] = reg_color;
+
+ /** TBD: Add support for registering blink with register: interface*/
+ reg_blink = 'n';
+ Blink_map[reg_user][reg_event] = reg_blink;
+ }
+ /*printk( KERN_INFO "reg_user = %d, reg_event= %d, reg_color = %c\n", reg_user, reg_event, reg_color, reg_blink);*/
+ return (ssize_t)size;
+ }
+
+ /* Be nice ! support older led mechanism */
+ color = buf[0];
+ blink = 'x';
+
+ /* If valid user and event, retrieve color & blink map */
+ if( found ) {
+ /* if a canceling event and other error(s) existing, don't do anything */
+ if( (j == LED_STAT_OK) && (Led_error_bits != 0) ) {
+ }
+ else {
+ color = Color_map[i][j];
+ blink = Blink_map[i][j];
+ }
+ /*printk(KERN_INFO "\nUser= %s, event= %s, color %c, %08x\n", user, event, color, blink, Led_error_bits);*/
+ }
+
+ switch (color) {
+ case 'r': /* red */
+ state = 1;
+ break;
+ case 'g': /* green */
+ state = 2;
+ break;
+ case 'b': /* blue */
+ state = 3;
+ break;
+ case 'y': /* yellow */
+ state = 4;
+ break;
+ case 'w': /* white */
+ state = 5;
+ break;
+ case 'o': /* off */
+ state = 0;
+ break;
+ default:
+ state = -1;
+ break;
+ }
+
+ /** do nothing if no color change is required */
+ if( state == -1 ) {
+ return (ssize_t)size;
+ }
+
+ // printk(KERN_DEBUG "Calling led_set_color with value %c, blink is %c\n", color, blink);
+ led_set_color( led_cdev, state );
+
+ /** blink the led */
+ {
+ int val = -1;
+
+ printk(KERN_DEBUG "Calling led_set_blink with value %c\n", blink);
+
+ switch( blink ) {
+ case 'y': /** yes */
+ val = 1;
+ break;
+ case 'n': /** no */
+ val = 0;
+ break;
+ case 'f': /** forced */
+ val = 2;
+ break;
+ default:
+ break;
+ }
+
+ if( val >= 0 )
+ {
+ led_set_blink( led_cdev, val );
+ }
+ }
- return (ssize_t)size;
+ return (ssize_t)size;
}
static ssize_t led_color_show(struct device *dev,
- struct device_attribute *attr, char *buf) {
+ struct device_attribute *attr, char *buf) {
- struct led_classdev *led_cdev = dev_get_drvdata(dev);
+ struct led_classdev *led_cdev = dev_get_drvdata(dev);
char * readbuf[] = {"off", "red", "green", "blue", "yellow", "white"} ;
- /* no lock needed for this */
- led_update_color(led_cdev);
+ /* no lock needed for this */
+ led_update_color(led_cdev);
- return sprintf(buf, "%s\n", readbuf[led_cdev->color]