diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-02-28 23:39:14 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2015-02-28 23:39:14 +0000 |
commit | 780d6939b2ae13603734b815b8dd9772842f4c70 (patch) | |
tree | 89edc4c1ba07c54a882029bab8d3aa3e96f54683 /target/linux/adm5120/patches-3.18 | |
parent | 0e7e585752b3a73d7cb0c368f3a850447e9f79a0 (diff) | |
download | upstream-780d6939b2ae13603734b815b8dd9772842f4c70.tar.gz upstream-780d6939b2ae13603734b815b8dd9772842f4c70.tar.bz2 upstream-780d6939b2ae13603734b815b8dd9772842f4c70.zip |
adm5120: add 3.18 support
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
SVN-Revision: 44580
Diffstat (limited to 'target/linux/adm5120/patches-3.18')
15 files changed, 1450 insertions, 0 deletions
diff --git a/target/linux/adm5120/patches-3.18/001-adm5120.patch b/target/linux/adm5120/patches-3.18/001-adm5120.patch new file mode 100644 index 0000000000..3e0e3ff8aa --- /dev/null +++ b/target/linux/adm5120/patches-3.18/001-adm5120.patch @@ -0,0 +1,44 @@ +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -60,6 +60,24 @@ choice + prompt "System type" + default SGI_IP22 + ++config ADM5120 ++ bool "Infineon/ADMtek ADM5120 SoC based machines" ++ select BOOT_RAW ++ select NO_EXCEPT_FILL ++ select CEVT_R4K ++ select CSRC_R4K ++ select SYS_HAS_CPU_MIPS32_R1 ++ select SYS_HAS_EARLY_PRINTK ++ select DMA_NONCOHERENT ++ select IRQ_CPU ++ select SYS_SUPPORTS_LITTLE_ENDIAN ++ select SYS_SUPPORTS_BIG_ENDIAN ++ select SYS_SUPPORTS_32BIT_KERNEL ++ select ARCH_REQUIRE_GPIOLIB ++ select SWAP_IO_SPACE if CPU_BIG_ENDIAN ++ select MIPS_MACHINE ++ select HAVE_CLK ++ + config MIPS_ALCHEMY + bool "Alchemy processor based machines" + select 64BIT_PHYS_ADDR +@@ -834,6 +852,7 @@ config MIPS_PARAVIRT + + endchoice + ++source "arch/mips/adm5120/Kconfig" + source "arch/mips/alchemy/Kconfig" + source "arch/mips/ath79/Kconfig" + source "arch/mips/bcm47xx/Kconfig" +--- a/arch/mips/Kbuild.platforms ++++ b/arch/mips/Kbuild.platforms +@@ -1,5 +1,6 @@ + # All platforms listed in alphabetic order + ++platforms += adm5120 + platforms += alchemy + platforms += ar7 + platforms += ath79 diff --git a/target/linux/adm5120/patches-3.18/002-adm5120_flash.patch b/target/linux/adm5120/patches-3.18/002-adm5120_flash.patch new file mode 100644 index 0000000000..8936af13e2 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/002-adm5120_flash.patch @@ -0,0 +1,21 @@ +--- a/drivers/mtd/maps/Kconfig ++++ b/drivers/mtd/maps/Kconfig +@@ -399,4 +399,8 @@ config MTD_LATCH_ADDR + + If compiled as a module, it will be called latch-addr-flash. + ++config MTD_ADM5120 ++ tristate "Map driver for ADM5120 based boards" ++ depends on ADM5120 ++ + endmenu +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -30,6 +30,7 @@ obj-$(CONFIG_MTD_SUN_UFLASH) += sun_ufla + obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o + obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o + obj-$(CONFIG_MTD_PCI) += pci.o ++obj-$(CONFIG_MTD_ADM5120) += adm5120-flash.o + obj-$(CONFIG_MTD_IMPA7) += impa7.o + obj-$(CONFIG_MTD_UCLINUX) += uclinux.o + obj-$(CONFIG_MTD_NETtel) += nettel.o diff --git a/target/linux/adm5120/patches-3.18/003-adm5120_switch.patch b/target/linux/adm5120/patches-3.18/003-adm5120_switch.patch new file mode 100644 index 0000000000..416488c0e0 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/003-adm5120_switch.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/Kconfig ++++ b/drivers/net/Kconfig +@@ -263,6 +263,10 @@ source "drivers/net/dsa/Kconfig" + + source "drivers/net/ethernet/Kconfig" + ++config ADM5120_ENET ++ tristate "ADM5120 Ethernet switch support" ++ depends on ADM5120 ++ + source "drivers/net/fddi/Kconfig" + + source "drivers/net/hippi/Kconfig" +--- a/drivers/net/Makefile ++++ b/drivers/net/Makefile +@@ -34,6 +34,7 @@ obj-$(CONFIG_CAN) += can/ + obj-$(CONFIG_ETRAX_ETHERNET) += cris/ + obj-$(CONFIG_NET_DSA) += dsa/ + obj-$(CONFIG_ETHERNET) += ethernet/ ++obj-$(CONFIG_ADM5120_ENET) += adm5120sw.o + obj-$(CONFIG_FDDI) += fddi/ + obj-$(CONFIG_HIPPI) += hippi/ + obj-$(CONFIG_HAMRADIO) += hamradio/ diff --git a/target/linux/adm5120/patches-3.18/005-adm5120_usb.patch b/target/linux/adm5120/patches-3.18/005-adm5120_usb.patch new file mode 100644 index 0000000000..139e223c00 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/005-adm5120_usb.patch @@ -0,0 +1,33 @@ +--- a/drivers/usb/Makefile ++++ b/drivers/usb/Makefile +@@ -12,6 +12,7 @@ obj-$(CONFIG_USB_DWC2) += dwc2/ + obj-$(CONFIG_USB_MON) += mon/ + + obj-$(CONFIG_PCI) += host/ ++obj-$(CONFIG_USB_ADM5120_HCD) += host/ + obj-$(CONFIG_USB_EHCI_HCD) += host/ + obj-$(CONFIG_USB_ISP116X_HCD) += host/ + obj-$(CONFIG_USB_OHCI_HCD) += host/ +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -3,6 +3,10 @@ + # + comment "USB Host Controller Drivers" + ++config USB_ADM5120_HCD ++ tristate "ADM5120 HCD support (EXPERIMENTAL)" ++ depends on USB && ADM5120 && EXPERIMENTAL ++ + config USB_C67X00_HCD + tristate "Cypress C67x00 HCD support" + help +--- a/drivers/usb/host/Makefile ++++ b/drivers/usb/host/Makefile +@@ -31,6 +31,7 @@ obj-$(CONFIG_PCI) += pci-quirks.o + obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o + obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o + ++obj-$(CONFIG_USB_ADM5120_HCD) += adm5120-hcd.o + obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o + obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o + obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o diff --git a/target/linux/adm5120/patches-3.18/007-adm5120_pci.patch b/target/linux/adm5120/patches-3.18/007-adm5120_pci.patch new file mode 100644 index 0000000000..a5a0abf43b --- /dev/null +++ b/target/linux/adm5120/patches-3.18/007-adm5120_pci.patch @@ -0,0 +1,22 @@ +--- a/arch/mips/pci/Makefile ++++ b/arch/mips/pci/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o + obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o + obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \ + ops-bcm63xx.o ++obj-$(CONFIG_ADM5120) += pci-adm5120.o + obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o + obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o + obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o +--- a/include/linux/pci_ids.h ++++ b/include/linux/pci_ids.h +@@ -1820,6 +1820,9 @@ + + #define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */ + ++#define PCI_VENDOR_ID_ADMTEK 0x1317 ++#define PCI_DEVICE_ID_ADMTEK_ADM5120 0x5120 ++ + #define PCI_VENDOR_ID_SIIG 0x131f + #define PCI_SUBVENDOR_ID_SIIG 0x131f + #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 diff --git a/target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch b/target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch new file mode 100644 index 0000000000..627afc1cf8 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch @@ -0,0 +1,22 @@ +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -508,4 +508,12 @@ config LEDS_VERSATILE + comment "LED Triggers" + source "drivers/leds/trigger/Kconfig" + ++config LEDS_TRIGGER_ADM5120_SWITCH ++ tristate "LED ADM5120 Switch Port Status Trigger" ++ depends on LEDS_TRIGGERS && ADM5120 ++ help ++ This allows LEDs to be controlled by the port states of ++ the ADM5120 built-in Ethernet Switch ++ If unsure, say N. ++ + endif # NEW_LEDS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -65,3 +65,4 @@ obj-$(CONFIG_LEDS_TRIGGERS) += trigger/ + obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o + obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o + obj-$(CONFIG_LEDS_TRIGGER_USBDEV) += ledtrig-usbdev.o ++obj-$(CONFIG_LEDS_TRIGGER_ADM5120_SWITCH) += ledtrig-adm5120-switch.o diff --git a/target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch b/target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch new file mode 100644 index 0000000000..8b1191a022 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch @@ -0,0 +1,354 @@ +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -29,11 +29,9 @@ + #include <linux/kmod.h> + #include <linux/mtd/mtd.h> + #include <linux/mtd/partitions.h> +-#include <linux/magic.h> + #include <linux/err.h> + + #include "mtdcore.h" +-#include "mtdsplit/mtdsplit.h" + + #define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */ + +@@ -49,14 +47,13 @@ struct mtd_part { + struct list_head list; + }; + +-static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); +- + /* + * Given a pointer to the MTD object in the mtd_part structure, we can retrieve + * the pointer to that structure with this macro. + */ + #define PART(x) ((struct mtd_part *)(x)) + ++ + /* + * MTD methods which simply translate the effective address and pass through + * to the _real_ device. +@@ -520,12 +517,14 @@ static struct mtd_part *allocate_partiti + if (slave->offset == MTDPART_OFS_APPEND) + slave->offset = cur_offset; + if (slave->offset == MTDPART_OFS_NXTBLK) { +- /* Round up to next erasesize */ +- slave->offset = mtd_roundup_to_eb(cur_offset, master); +- if (slave->offset != cur_offset) ++ slave->offset = cur_offset; ++ if (mtd_mod_by_eb(cur_offset, master) != 0) { ++ /* Round up to next erasesize */ ++ slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize; + printk(KERN_NOTICE "Moving partition %d: " + "0x%012llx -> 0x%012llx\n", partno, + (unsigned long long)cur_offset, (unsigned long long)slave->offset); ++ } + } + if (slave->offset == MTDPART_OFS_RETAIN) { + slave->offset = cur_offset; +@@ -629,10 +628,8 @@ out_register: + return slave; + } + +- +-static int +-__mtd_add_partition(struct mtd_info *master, const char *name, +- long long offset, long long length, bool dup_check) ++int mtd_add_partition(struct mtd_info *master, const char *name, ++ long long offset, long long length) + { + struct mtd_partition part; + struct mtd_part *p, *new; +@@ -664,24 +661,21 @@ __mtd_add_partition(struct mtd_info *mas + end = offset + length; + + mutex_lock(&mtd_partitions_mutex); +- if (dup_check) { +- list_for_each_entry(p, &mtd_partitions, list) +- if (p->master == master) { +- if ((start >= p->offset) && +- (start < (p->offset + p->mtd.size))) +- goto err_inv; +- +- if ((end >= p->offset) && +- (end < (p->offset + p->mtd.size))) +- goto err_inv; +- } +- } ++ list_for_each_entry(p, &mtd_partitions, list) ++ if (p->master == master) { ++ if ((start >= p->offset) && ++ (start < (p->offset + p->mtd.size))) ++ goto err_inv; ++ ++ if ((end >= p->offset) && ++ (end < (p->offset + p->mtd.size))) ++ goto err_inv; ++ } + + list_add(&new->list, &mtd_partitions); + mutex_unlock(&mtd_partitions_mutex); + + add_mtd_device(&new->mtd); +- mtd_partition_split(master, new); + + return ret; + err_inv: +@@ -691,12 +685,6 @@ err_inv: + } + EXPORT_SYMBOL_GPL(mtd_add_partition); + +-int mtd_add_partition(struct mtd_info *master, const char *name, +- long long offset, long long length) +-{ +- return __mtd_add_partition(master, name, offset, length, true); +-} +- + int mtd_del_partition(struct mtd_info *master, int partno) + { + struct mtd_part *slave, *next; +@@ -720,166 +708,6 @@ int mtd_del_partition(struct mtd_info *m + } + EXPORT_SYMBOL_GPL(mtd_del_partition); + +-static int +-run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) +-{ +- struct mtd_partition *parts; +- int nr_parts; +- int i; +- +- nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, &parts, +- NULL); +- if (nr_parts <= 0) +- return nr_parts; +- +- if (WARN_ON(!parts)) +- return 0; +- +- for (i = 0; i < nr_parts; i++) { +- /* adjust partition offsets */ +- parts[i].offset += slave->offset; +- +- __mtd_add_partition(slave->master, +- parts[i].name, +- parts[i].offset, +- parts[i].size, +- false); +- } +- +- kfree(parts); +- +- return nr_parts; +-} +- +-static inline unsigned long +-mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) +-{ +- unsigned long mask = mtd->erasesize - 1; +- +- len += offset & mask; +- len = (len + mask) & ~mask; +- len -= offset & mask; +- return len; +-} +- +-static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) +-{ +- size_t squashfs_len; +- int len, ret; +- +- ret = mtd_get_squashfs_len(master, offset, &squashfs_len); +- if (ret) +- return ret; +- +- len = mtd_pad_erasesize(master, offset, squashfs_len); +- *split_offset = offset + len; +- +- return 0; +-} +- +-static void split_rootfs_data(struct mtd_info *master, struct mtd_part *part) +-{ +- unsigned int split_offset = 0; +- unsigned int split_size; +- int ret; +- +- ret = split_squashfs(master, part->offset, &split_offset); +- if (ret) +- return; +- +- if (split_offset <= 0) +- return; +- +- if (config_enabled(CONFIG_MTD_SPLIT_SQUASHFS_ROOT)) +- pr_err("Dedicated partitioner didn't create \"rootfs_data\" partition, please fill a bug report!\n"); +- else +- pr_warn("Support for built-in \"rootfs_data\" splitter will be removed, please use CONFIG_MTD_SPLIT_SQUASHFS_ROOT\n"); +- +- split_size = part->mtd.size - (split_offset - part->offset); +- printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=0x%x, len=0x%x\n", +- ROOTFS_SPLIT_NAME, split_offset, split_size); +- +- __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset, +- split_size, false); +-} +- +-#define UBOOT_MAGIC 0x27051956 +- +-static void split_uimage(struct mtd_info *master, struct mtd_part *part) +-{ +- struct { +- __be32 magic; +- __be32 pad[2]; +- __be32 size; +- } hdr; +- size_t len; +- +- if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr)) +- return; +- +- if (len != sizeof(hdr) || hdr.magic != cpu_to_be32(UBOOT_MAGIC)) +- return; +- +- len = be32_to_cpu(hdr.size) + 0x40; +- len = mtd_pad_erasesize(master, part->offset, len); +- if (len + master->erasesize > part->mtd.size) +- return; +- +- if (config_enabled(CONFIG_MTD_SPLIT_UIMAGE_FW)) +- pr_err("Dedicated partitioner didn't split firmware partition, please fill a bug report!\n"); +- else +- pr_warn("Support for built-in firmware splitter will be removed, please use CONFIG_MTD_SPLIT_UIMAGE_FW\n"); +- +- __mtd_add_partition(master, "rootfs", part->offset + len, +- part->mtd.size - len, false); +-} +- +-#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME +-#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME +-#else +-#define SPLIT_FIRMWARE_NAME "unused" +-#endif +- +-static void split_firmware(struct mtd_info *master, struct mtd_part *part) +-{ +- int ret; +- +- ret = run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); +- if (ret > 0) +- return; +- +- if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT)) +- split_uimage(master, part); +-} +- +-void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, +- int offset, int size) +-{ +-} +- +-static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) +-{ +- static int rootfs_found = 0; +- +- if (rootfs_found) +- return; +- +- if (!strcmp(part->mtd.name, "rootfs")) { +- int num = run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); +- +- if (num <= 0 && config_enabled(CONFIG_MTD_ROOTFS_SPLIT)) +- split_rootfs_data(master, part); +- +- rootfs_found = 1; +- } +- +- if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && +- config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) +- split_firmware(master, part); +- +- arch_split_mtd_part(master, part->mtd.name, part->offset, +- part->mtd.size); +-} + /* + * This function, given a master MTD object and a partition table, creates + * and registers slave MTD objects which are bound to the master according to +@@ -909,7 +737,6 @@ int add_mtd_partitions(struct mtd_info * + mutex_unlock(&mtd_partitions_mutex); + + add_mtd_device(&slave->mtd); +- mtd_partition_split(master, slave); + + cur_offset = slave->offset + slave->mtd.size; + } +@@ -939,30 +766,6 @@ static struct mtd_part_parser *get_parti + + #define put_partition_parser(p) do { module_put((p)->owner); } while (0) + +-static struct mtd_part_parser * +-get_partition_parser_by_type(enum mtd_parser_type type, +- struct mtd_part_parser *start) +-{ +- struct mtd_part_parser *p, *ret = NULL; +- +- spin_lock(&part_parser_lock); +- +- p = list_prepare_entry(start, &part_parsers, list); +- if (start) +- put_partition_parser(start); +- +- list_for_each_entry_continue(p, &part_parsers, list) { +- if (p->type == type && try_module_get(p->owner)) { +- ret = p; +- break; +- } +- } +- +- spin_unlock(&part_parser_lock); +- +- return ret; +-} +- + void register_mtd_parser(struct mtd_part_parser *p) + { + spin_lock(&part_parser_lock); +@@ -1036,38 +839,6 @@ int parse_mtd_partitions(struct mtd_info + return ret; + } + +-int parse_mtd_partitions_by_type(struct mtd_info *master, +- enum mtd_parser_type type, +- struct mtd_partition **pparts, +- struct mtd_part_parser_data *data) +-{ +- struct mtd_part_parser *prev = NULL; +- int ret = 0; +- +- while (1) { +- struct mtd_part_parser *parser; +- +- parser = get_partition_parser_by_type(type, prev); +- if (!parser) +- break; +- +- ret = (*parser->parse_fn)(master, pparts, data); +- +- if (ret > 0) { +- put_partition_parser(parser); +- printk(KERN_NOTICE +- "%d %s partitions found on MTD device %s\n", +- ret, parser->name, master->name); +- break; +- } +- +- prev = parser; +- } +- +- return ret; +-} +-EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); +- + int mtd_is_partition(const struct mtd_info *mtd) + { + struct mtd_part *part; diff --git a/target/linux/adm5120/patches-3.18/100-rootfs_split.patch b/target/linux/adm5120/patches-3.18/100-rootfs_split.patch new file mode 100644 index 0000000000..22241e4fdf --- /dev/null +++ b/target/linux/adm5120/patches-3.18/100-rootfs_split.patch @@ -0,0 +1,316 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -52,6 +52,14 @@ config MTD_TESTS + WARNING: some of the tests will ERASE entire MTD device which they + test. Do not use these tests unless you really know what you do. + ++config MTD_ROOTFS_ROOT_DEV ++ bool "Automatically set 'rootfs' partition to be root filesystem" ++ default y ++ ++config MTD_ROOTFS_SPLIT ++ bool "Automatically split 'rootfs' partition for squashfs" ++ default y ++ + config MTD_REDBOOT_PARTS + tristate "RedBoot partition table parsing" + ---help--- +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -29,6 +29,8 @@ + #include <linux/kmod.h> + #include <linux/mtd/mtd.h> + #include <linux/mtd/partitions.h> ++#include <linux/root_dev.h> ++#include <linux/magic.h> + #include <linux/err.h> + + #include "mtdcore.h" +@@ -52,7 +54,7 @@ struct mtd_part { + * the pointer to that structure with this macro. + */ + #define PART(x) ((struct mtd_part *)(x)) +- ++#define IS_PART(mtd) (mtd->_read == part_read) + + /* + * MTD methods which simply translate the effective address and pass through +@@ -708,6 +710,144 @@ int mtd_del_partition(struct mtd_info *m + } + EXPORT_SYMBOL_GPL(mtd_del_partition); + ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++#define ROOTFS_SPLIT_NAME "rootfs_data" ++#define ROOTFS_REMOVED_NAME "<removed>" ++ ++struct squashfs_super_block { ++ __le32 s_magic; ++ __le32 pad0[9]; ++ __le64 bytes_used; ++}; ++ ++ ++static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) ++{ ++ struct squashfs_super_block sb; ++ int len, ret; ++ ++ ret = mtd_read(master, offset, sizeof(sb), &len, (void *) &sb); ++ if (ret || (len != sizeof(sb))) { ++ printk(KERN_ALERT "split_squashfs: error occured while reading " ++ "from \"%s\"\n", master->name); ++ return -EINVAL; ++ } ++ ++ if (SQUASHFS_MAGIC != le32_to_cpu(sb.s_magic) ) { ++ printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n", ++ master->name); ++ *split_offset = 0; ++ return 0; ++ } ++ ++ if (le64_to_cpu((sb.bytes_used)) <= 0) { ++ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n", ++ master->name); ++ *split_offset = 0; ++ return 0; ++ } ++ ++ len = (u32) le64_to_cpu(sb.bytes_used); ++ len += (offset & 0x000fffff); ++ len += (master->erasesize - 1); ++ len &= ~(master->erasesize - 1); ++ len -= (offset & 0x000fffff); ++ *split_offset = offset + len; ++ ++ return 0; ++} ++ ++static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, const struct mtd_partition *part) ++{ ++ struct mtd_partition dpart; ++ struct mtd_part *slave = NULL; ++ struct mtd_part *spart; ++ int ret, split_offset = 0; ++ ++ spart = PART(rpart); ++ ret = split_squashfs(master, spart->offset, &split_offset); ++ if (ret) ++ return ret; ++ ++ if (split_offset <= 0) ++ return 0; ++ ++ memcpy(&dpart, part, sizeof(dpart)); ++ dpart.name = ROOTFS_SPLIT_NAME; ++ ++ dpart.size = rpart->size - (split_offset - spart->offset); ++ dpart.offset = split_offset; ++ ++ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%llX, len=%llX \n", ++ ROOTFS_SPLIT_NAME, dpart.offset, dpart.size); ++ ++ slave = allocate_partition(master, &dpart, 0, split_offset); ++ if (IS_ERR(slave)) ++ return PTR_ERR(slave); ++ mutex_lock(&mtd_partitions_mutex); ++ list_add(&slave->list, &mtd_partitions); ++ mutex_unlock(&mtd_partitions_mutex); ++ ++ add_mtd_device(&slave->mtd); ++ ++ rpart->split = &slave->mtd; ++ ++ return 0; ++} ++ ++static int refresh_rootfs_split(struct mtd_info *mtd) ++{ ++ struct mtd_partition tpart; ++ struct mtd_part *part; ++ char *name; ++ //int index = 0; ++ int offset, size; ++ int ret; ++ ++ part = PART(mtd); ++ ++ /* check for the new squashfs offset first */ ++ ret = split_squashfs(part->master, part->offset, &offset); ++ if (ret) ++ return ret; ++ ++ if ((offset > 0) && !mtd->split) { ++ printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name); ++ /* if we don't have a rootfs split partition, create a new one */ ++ tpart.name = (char *) mtd->name; ++ tpart.size = mtd->size; ++ tpart.offset = part->offset; ++ ++ return split_rootfs_data(part->master, &part->mtd, &tpart); ++ } else if ((offset > 0) && mtd->split) { ++ /* update the offsets of the existing partition */ ++ size = mtd->size + part->offset - offset; ++ ++ part = PART(mtd->split); ++ part->offset = offset; ++ part->mtd.size = size; ++ printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n", ++ __func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"), ++ (u32) part->offset, (u32) part->mtd.size); ++ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); ++ strcpy(name, ROOTFS_SPLIT_NAME); ++ part->mtd.name = name; ++ } else if ((offset <= 0) && mtd->split) { ++ printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name); ++ ++ /* mark existing partition as removed */ ++ part = PART(mtd->split); ++ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); ++ strcpy(name, ROOTFS_REMOVED_NAME); ++ part->mtd.name = name; ++ part->offset = 0; ++ part->mtd.size = 0; ++ } ++ ++ return 0; ++} ++#endif /* CONFIG_MTD_ROOTFS_SPLIT */ ++ + /* + * This function, given a master MTD object and a partition table, creates + * and registers slave MTD objects which are bound to the master according to +@@ -724,6 +864,9 @@ int add_mtd_partitions(struct mtd_info * + struct mtd_part *slave; + uint64_t cur_offset = 0; + int i; ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++ int ret; ++#endif + + printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); + +@@ -738,12 +881,53 @@ int add_mtd_partitions(struct mtd_info * + + add_mtd_device(&slave->mtd); + ++ if (!strcmp(parts[i].name, "rootfs")) { ++#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++ if (ROOT_DEV == 0) { ++ printk(KERN_NOTICE "mtd: partition \"rootfs\" " ++ "set to be root filesystem\n"); ++ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index); ++ } ++#endif ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++ ret = split_rootfs_data(master, &slave->mtd, &parts[i]); ++ /* if (ret == 0) ++ * j++; */ ++#endif ++ } ++ + cur_offset = slave->offset + slave->mtd.size; + } + + return 0; + } + ++int mtd_device_refresh(struct mtd_info *mtd) ++{ ++ int ret = 0; ++ ++ if (IS_PART(mtd)) { ++ struct mtd_part *part; ++ struct mtd_info *master; ++ ++ part = PART(mtd); ++ master = part->master; ++ if (master->refresh_device) ++ ret = master->refresh_device(master); ++ } ++ ++ if (!ret && mtd->refresh_device) ++ ret = mtd->refresh_device(mtd); ++ ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++ if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs")) ++ refresh_rootfs_split(mtd); ++#endif ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(mtd_device_refresh); ++ + static DEFINE_SPINLOCK(part_parser_lock); + static LIST_HEAD(part_parsers); + +--- a/drivers/mtd/mtdchar.c ++++ b/drivers/mtd/mtdchar.c +@@ -1008,6 +1008,12 @@ static int mtdchar_ioctl(struct file *fi + break; + } + ++ case MTDREFRESH: ++ { ++ ret = mtd_device_refresh(mtd); ++ break; ++ } ++ + default: + ret = -ENOTTY; + } +--- a/include/linux/mtd/mtd.h ++++ b/include/linux/mtd/mtd.h +@@ -115,6 +115,7 @@ struct nand_ecclayout { + + struct module; /* only needed for owner field in mtd_info */ + ++struct mtd_info; + struct mtd_info { + u_char type; + uint32_t flags; +@@ -231,6 +232,9 @@ struct mtd_info { + int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); + int (*_suspend) (struct mtd_info *mtd); + void (*_resume) (struct mtd_info *mtd); ++ int (*refresh_device)(struct mtd_info *mtd); ++ struct mtd_info *split; ++ + /* + * If the driver is something smart, like UBI, it may need to maintain + * its own reference counting. The below functions are only for driver. +@@ -397,6 +401,7 @@ extern int mtd_device_parse_register(str + int defnr_parts); + #define mtd_device_register(master, parts, nr_parts) \ + mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) ++extern int mtd_device_refresh(struct mtd_info *master); + extern int mtd_device_unregister(struct mtd_info *master); + extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); + extern int __get_mtd_device(struct mtd_info *mtd); +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h +@@ -37,12 +37,14 @@ + */ + struct mtd_info; + ++struct mtd_partition; + struct mtd_partition { + const char *name; /* identifier string */ + uint64_t size; /* partition size */ + uint64_t offset; /* offset within the master MTD space */ + uint32_t mask_flags; /* master MTD flags to mask out for this partition */ + struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */ ++ int (*refresh_partition)(struct mtd_info *); + }; + + #define MTDPART_OFS_RETAIN (-3) +--- a/include/uapi/mtd/mtd-abi.h ++++ b/include/uapi/mtd/mtd-abi.h +@@ -203,6 +203,7 @@ struct otp_info { + * without OOB, e.g., NOR flash. + */ + #define MEMWRITE _IOWR('M', 24, struct mtd_write_req) ++#define MTDREFRESH _IO('M', 50) + + /* + * Obsolete legacy interface. Keep it in order not to break userspace diff --git a/target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch b/target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch new file mode 100644 index 0000000000..a0caa680bc --- /dev/null +++ b/target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch @@ -0,0 +1,84 @@ +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -49,6 +49,12 @@ + #define SST49LF008A 0x005a + #define AT49BV6416 0x00d6 + ++/* Macronix */ ++#define MX29LV160B 0x2249 /* MX29LV160 Bottom-boot chip */ ++#define MX29LV160T 0x22C4 /* MX29LV160 Top-boot chip */ ++#define MX29LV320B 0x22A8 /* MX29LV320 Bottom-boot chip */ ++#define MX29LV320T 0x22A7 /* MX29LV320 Top-boot chip */ ++ + static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); + static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); + static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); +@@ -374,6 +380,41 @@ static struct cfi_fixup cfi_nopri_fixup_ + { 0, 0, NULL } + }; + ++#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC ++/* ++ * Some Macronix chips has no/bad bootblock information in the CFI table ++ */ ++static void fixup_macronix_bootloc(struct mtd_info *mtd) ++{ ++ struct map_info *map = mtd->priv; ++ struct cfi_private *cfi = map->fldrv_priv; ++ struct cfi_pri_amdstd *extp = cfi->cmdset_priv; ++ __u8 t; ++ ++ switch (cfi->id) { ++ /* TODO: put affected chip ids here */ ++ case MX29LV160B: ++ case MX29LV320B: ++ t = 2; /* Bottom boot */ ++ break; ++ case MX29LV160T: ++ case MX29LV320T: ++ t = 3; /* Top boot */ ++ break; ++ default: ++ return; ++ } ++ ++ if (extp->TopBottom == t) ++ /* boot location detected by the CFI layer is correct */ ++ return; ++ ++ extp->TopBottom = t; ++ printk("%s: Macronix chip detected, id:0x%04X, boot location forced " ++ "to %s\n", map->name, cfi->id, (t == 2) ? "bottom" : "top"); ++} ++#endif /* CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC */ ++ + static struct cfi_fixup cfi_fixup_table[] = { + { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri }, + #ifdef AMD_BOOTLOC_BUG +@@ -416,6 +457,9 @@ static struct cfi_fixup fixup_table[] = + */ + { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_erase_chip }, + { CFI_MFR_ATMEL, AT49BV6416, fixup_use_atmel_lock }, ++#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC ++ { CFI_MFR_MACRONIX, CFI_ID_ANY, fixup_macronix_bootloc }, ++#endif + { 0, 0, NULL } + }; + +--- a/drivers/mtd/chips/Kconfig ++++ b/drivers/mtd/chips/Kconfig +@@ -188,6 +188,14 @@ config MTD_CFI_AMDSTD + provides support for command set 0002, used on chips including + the AMD Am29LV320. + ++config MTD_CFI_FIXUP_MACRONIX_BOOTLOC ++ bool "Fix boot-block location for Macronix flash chips" ++ depends on MTD_CFI_AMDSTD ++ help ++ Some Macronix flash chips have no/wrong boot-block location in the ++ CFI table, and the driver may detect the type incorrectly. Select ++ this if your board has such chip. ++ + config MTD_CFI_STAA + tristate "Support for CFI command set 0020 (ST (Advanced Architecture) chips)" + depends on MTD_GEN_PROBE diff --git a/target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch b/target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch new file mode 100644 index 0000000000..00148fa602 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch @@ -0,0 +1,68 @@ +--- a/drivers/mtd/chips/jedec_probe.c ++++ b/drivers/mtd/chips/jedec_probe.c +@@ -115,6 +115,10 @@ + #define UPD29F064115 0x221C + + /* PMC */ ++#define PM39LV512 0x001B ++#define PM39LV010 0x001C ++#define PM39LV020 0x003D ++#define PM39LV040 0x003E + #define PM49FL002 0x006D + #define PM49FL004 0x006E + #define PM49FL008 0x006A +@@ -1259,6 +1263,54 @@ static const struct amd_flash_info jedec + ERASEINFO(0x02000,2), + ERASEINFO(0x04000,1), + } ++ }, { ++ .mfr_id = CFI_MFR_PMC, ++ .dev_id = PM39LV512, ++ .name = "PMC Pm39LV512", ++ .devtypes = CFI_DEVICETYPE_X8, ++ .uaddr = MTD_UADDR_0x0555_0x02AA, ++ .dev_size = SIZE_64KiB, ++ .cmd_set = P_ID_AMD_STD, ++ .nr_regions = 1, ++ .regions = { ++ ERASEINFO(0x01000,16), ++ } ++ }, { ++ .mfr_id = CFI_MFR_PMC, ++ .dev_id = PM39LV010, ++ .name = "PMC Pm39LV010", ++ .devtypes = CFI_DEVICETYPE_X8, ++ .uaddr = MTD_UADDR_0x0555_0x02AA, ++ .dev_size = SIZE_128KiB, ++ .cmd_set = P_ID_AMD_STD, ++ .nr_regions = 1, ++ .regions = { ++ ERASEINFO(0x01000,32), ++ } ++ }, { ++ .mfr_id = CFI_MFR_PMC, ++ .dev_id = PM39LV020, ++ .name = "PMC Pm39LV020", ++ .devtypes = CFI_DEVICETYPE_X8, ++ .uaddr = MTD_UADDR_0x0555_0x02AA, ++ .dev_size = SIZE_256KiB, ++ .cmd_set = P_ID_AMD_STD, ++ .nr_regions = 1, ++ .regions = { ++ ERASEINFO(0x01000,64), ++ } ++ }, { ++ .mfr_id = CFI_MFR_PMC, ++ .dev_id = PM39LV040, ++ .name = "PMC Pm39LV040", ++ .devtypes = CFI_DEVICETYPE_X8, ++ .uaddr = MTD_UADDR_0x0555_0x02AA, ++ .dev_size = SIZE_512KiB, ++ .cmd_set = P_ID_AMD_STD, ++ .nr_regions = 1, ++ .regions = { ++ ERASEINFO(0x01000,128), ++ } + }, { + .mfr_id = CFI_MFR_PMC, + .dev_id = PM49FL002, diff --git a/target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch b/target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch new file mode 100644 index 0000000000..62667769cd --- /dev/null +++ b/target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch @@ -0,0 +1,23 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -60,6 +60,10 @@ config MTD_ROOTFS_SPLIT + bool "Automatically split 'rootfs' partition for squashfs" + default y + ++config MTD_TRXSPLIT ++ bool "Automatically find and split TRX partitions" ++ default n ++ + config MTD_REDBOOT_PARTS + tristate "RedBoot partition table parsing" + ---help--- +--- a/drivers/mtd/Makefile ++++ b/drivers/mtd/Makefile +@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o + obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o + obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o + obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o ++obj-$(CONFIG_MTD_TRXSPLIT) += trxsplit.o + + # 'Users' - code which presents functionality to userspace. + obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o diff --git a/target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch b/target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch new file mode 100644 index 0000000000..c5d4d3a57e --- /dev/null +++ b/target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch @@ -0,0 +1,28 @@ +--- a/drivers/ata/Makefile ++++ b/drivers/ata/Makefile +@@ -98,6 +98,7 @@ obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia + obj-$(CONFIG_PATA_PALMLD) += pata_palmld.o + obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o + obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o ++obj-$(CONFIG_PATA_RB153_CF) += pata_rb153_cf.o + obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o + obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o + obj-$(CONFIG_PATA_SAMSUNG_CF) += pata_samsung_cf.o +--- a/drivers/ata/Kconfig ++++ b/drivers/ata/Kconfig +@@ -955,6 +955,15 @@ config PATA_QDI + help + Support for QDI 6500 and 6580 PATA controllers on VESA local bus. + ++config PATA_RB153_CF ++ tristate "RouterBOARD 153 Compact Flash support" ++ depends on ADM5120_MACH_RB_153 ++ help ++ This option enables support for a Compact Flash connected on ++ the RouterBOARD 153. ++ ++ If unsure, say N. ++ + config PATA_RB532 + tristate "RouterBoard 532 PATA CompactFlash support" + depends on MIKROTIK_RB532 diff --git a/target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch b/target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch new file mode 100644 index 0000000000..8eee7a10ff --- /dev/null +++ b/target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch @@ -0,0 +1,354 @@ +--- a/drivers/tty/serial/amba-pl010.c ++++ b/drivers/tty/serial/amba-pl010.c +@@ -48,11 +48,9 @@ + #include <linux/slab.h> + #include <linux/io.h> + +-#define UART_NR 8 +- + #define SERIAL_AMBA_MAJOR 204 + #define SERIAL_AMBA_MINOR 16 +-#define SERIAL_AMBA_NR UART_NR ++#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS + + #define AMBA_ISR_PASS_LIMIT 256 + +@@ -78,9 +76,9 @@ static void pl010_stop_tx(struct uart_po + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr &= ~UART010_CR_TIE; +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_start_tx(struct uart_port *port) +@@ -88,9 +86,9 @@ static void pl010_start_tx(struct uart_p + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr |= UART010_CR_TIE; +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_stop_rx(struct uart_port *port) +@@ -98,9 +96,9 @@ static void pl010_stop_rx(struct uart_po + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr &= ~(UART010_CR_RIE | UART010_CR_RTIE); +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_enable_ms(struct uart_port *port) +@@ -108,18 +106,18 @@ static void pl010_enable_ms(struct uart_ + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr |= UART010_CR_MSIE; +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_rx_chars(struct uart_amba_port *uap) + { + unsigned int status, ch, flag, rsr, max_count = 256; + +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + while (UART_RX_DATA(status) && max_count--) { +- ch = readb(uap->port.membase + UART01x_DR); ++ ch = __raw_readl(uap->port.membase + UART01x_DR); + flag = TTY_NORMAL; + + uap->port.icount.rx++; +@@ -128,9 +126,9 @@ static void pl010_rx_chars(struct uart_a + * Note that the error handling code is + * out of the main execution path + */ +- rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; ++ rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; + if (unlikely(rsr & UART01x_RSR_ANY)) { +- writel(0, uap->port.membase + UART01x_ECR); ++ __raw_writel(0, uap->port.membase + UART01x_ECR); + + if (rsr & UART01x_RSR_BE) { + rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); +@@ -160,7 +158,7 @@ static void pl010_rx_chars(struct uart_a + uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); + + ignore_char: +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + } + spin_unlock(&uap->port.lock); + tty_flip_buffer_push(&uap->port.state->port); +@@ -173,7 +171,7 @@ static void pl010_tx_chars(struct uart_a + int count; + + if (uap->port.x_char) { +- writel(uap->port.x_char, uap->port.membase + UART01x_DR); ++ __raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR); + uap->port.icount.tx++; + uap->port.x_char = 0; + return; +@@ -185,7 +183,7 @@ static void pl010_tx_chars(struct uart_a + + count = uap->port.fifosize >> 1; + do { +- writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); ++ __raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); + uap->port.icount.tx++; + if (uart_circ_empty(xmit)) +@@ -203,9 +201,9 @@ static void pl010_modem_status(struct ua + { + unsigned int status, delta; + +- writel(0, uap->port.membase + UART010_ICR); ++ __raw_writel(0, uap->port.membase + UART010_ICR); + +- status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; ++ status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; + + delta = status ^ uap->old_status; + uap->old_status = status; +@@ -233,7 +231,7 @@ static irqreturn_t pl010_int(int irq, vo + + spin_lock(&uap->port.lock); + +- status = readb(uap->port.membase + UART010_IIR); ++ status = __raw_readl(uap->port.membase + UART010_IIR); + if (status) { + do { + if (status & (UART010_IIR_RTIS | UART010_IIR_RIS)) +@@ -246,7 +244,7 @@ static irqreturn_t pl010_int(int irq, vo + if (pass_counter-- == 0) + break; + +- status = readb(uap->port.membase + UART010_IIR); ++ status = __raw_readl(uap->port.membase + UART010_IIR); + } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS | + UART010_IIR_TIS)); + handled = 1; +@@ -260,7 +258,7 @@ static irqreturn_t pl010_int(int irq, vo + static unsigned int pl010_tx_empty(struct uart_port *port) + { + struct uart_amba_port *uap = (struct uart_amba_port *)port; +- unsigned int status = readb(uap->port.membase + UART01x_FR); ++ unsigned int status = __raw_readl(uap->port.membase + UART01x_FR); + return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT; + } + +@@ -270,7 +268,7 @@ static unsigned int pl010_get_mctrl(stru + unsigned int result = 0; + unsigned int status; + +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + if (status & UART01x_FR_DCD) + result |= TIOCM_CAR; + if (status & UART01x_FR_DSR) +@@ -296,12 +294,12 @@ static void pl010_break_ctl(struct uart_ + unsigned int lcr_h; + + spin_lock_irqsave(&uap->port.lock, flags); +- lcr_h = readb(uap->port.membase + UART010_LCRH); ++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); + if (break_state == -1) + lcr_h |= UART01x_LCRH_BRK; + else + lcr_h &= ~UART01x_LCRH_BRK; +- writel(lcr_h, uap->port.membase + UART010_LCRH); ++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); + spin_unlock_irqrestore(&uap->port.lock, flags); + } + +@@ -329,12 +327,12 @@ static int pl010_startup(struct uart_por + /* + * initialise the old status of the modem signals + */ +- uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; ++ uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; + + /* + * Finally, enable interrupts + */ +- writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, ++ __raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, + uap->port.membase + UART010_CR); + + return 0; +@@ -357,10 +355,10 @@ static void pl010_shutdown(struct uart_p + /* + * disable all interrupts, disable the port + */ +- writel(0, uap->port.membase + UART010_CR); ++ __raw_writel(0, uap->port.membase + UART010_CR); + + /* disable break condition and fifos */ +- writel(readb(uap->port.membase + UART010_LCRH) & ++ __raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) & + ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN), + uap->port.membase + UART010_LCRH); + +@@ -382,7 +380,7 @@ pl010_set_termios(struct uart_port *port + /* + * Ask the core to calculate the divisor for us. + */ +- baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); ++ baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); + quot = uart_get_divisor(port, baud); + + switch (termios->c_cflag & CSIZE) { +@@ -445,25 +443,25 @@ pl010_set_termios(struct uart_port *port + uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; + + /* first, disable everything */ +- old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; ++ old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; + + if (UART_ENABLE_MS(port, termios->c_cflag)) + old_cr |= UART010_CR_MSIE; + +- writel(0, uap->port.membase + UART010_CR); ++ __raw_writel(0, uap->port.membase + UART010_CR); + + /* Set baud rate */ + quot -= 1; +- writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); +- writel(quot & 0xff, uap->port.membase + UART010_LCRL); ++ __raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); ++ __raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL); + + /* + * ----------v----------v----------v----------v----- + * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L + * ----------^----------^----------^----------^----- + */ +- writel(lcr_h, uap->port.membase + UART010_LCRH); +- writel(old_cr, uap->port.membase + UART010_CR); ++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); ++ __raw_writel(old_cr, uap->port.membase + UART010_CR); + + spin_unlock_irqrestore(&uap->port.lock, flags); + } +@@ -545,7 +543,7 @@ static struct uart_ops amba_pl010_pops = + .verify_port = pl010_verify_port, + }; + +-static struct uart_amba_port *amba_ports[UART_NR]; ++static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR]; + + #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE + +@@ -555,10 +553,10 @@ static void pl010_console_putchar(struct + unsigned int status; + + do { +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + barrier(); + } while (!UART_TX_READY(status)); +- writel(ch, uap->port.membase + UART01x_DR); ++ __raw_writel(ch, uap->port.membase + UART01x_DR); + } + + static void +@@ -572,8 +570,8 @@ pl010_console_write(struct console *co, + /* + * First save the CR then disable the interrupts + */ +- old_cr = readb(uap->port.membase + UART010_CR); +- writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); ++ old_cr = __raw_readl(uap->port.membase + UART010_CR); ++ __raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); + + uart_console_write(&uap->port, s, count, pl010_console_putchar); + +@@ -582,10 +580,10 @@ pl010_console_write(struct console *co, + * and restore the TCR + */ + do { +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + barrier(); + } while (status & UART01x_FR_BUSY); +- writel(old_cr, uap->port.membase + UART010_CR); ++ __raw_writel(old_cr, uap->port.membase + UART010_CR); + + clk_disable(uap->clk); + } +@@ -594,9 +592,9 @@ static void __init + pl010_console_get_options(struct uart_amba_port *uap, int *baud, + int *parity, int *bits) + { +- if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { ++ if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { + unsigned int lcr_h, quot; +- lcr_h = readb(uap->port.membase + UART010_LCRH); ++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); + + *parity = 'n'; + if (lcr_h & UART01x_LCRH_PEN) { +@@ -611,8 +609,8 @@ pl010_console_get_options(struct uart_am + else + *bits = 8; + +- quot = readb(uap->port.membase + UART010_LCRL) | +- readb(uap->port.membase + UART010_LCRM) << 8; ++ quot = __raw_readl(uap->port.membase + UART010_LCRL) | ++ __raw_readl(uap->port.membase + UART010_LCRM) << 8; + *baud = uap->port.uartclk / (16 * (quot + 1)); + } + } +@@ -631,7 +629,7 @@ static int __init pl010_console_setup(st + * if so, search for the first available port that does have + * console support. + */ +- if (co->index >= UART_NR) ++ if (co->index >= SERIAL_AMBA_NR) + co->index = 0; + uap = amba_ports[co->index]; + if (!uap) +@@ -673,7 +671,7 @@ static struct uart_driver amba_reg = { + .dev_name = "ttyAM", + .major = SERIAL_AMBA_MAJOR, + .minor = SERIAL_AMBA_MINOR, +- .nr = UART_NR, ++ .nr = SERIAL_AMBA_NR, + .cons = AMBA_CONSOLE, + }; + +--- a/drivers/tty/serial/Kconfig ++++ b/drivers/tty/serial/Kconfig +@@ -25,10 +25,18 @@ config SERIAL_AMBA_PL010 + help + This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have + an Integrator/AP or Integrator/PP2 platform, or if you have a +- Cirrus Logic EP93xx CPU, say Y or M here. ++ Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here. + + If unsure, say N. + ++config SERIAL_AMBA_PL010_NUMPORTS ++ int "Maximum number of AMBA PL010 serial ports" ++ depends on SERIAL_AMBA_PL010 ++ default "8" ++ ---help--- ++ Set this to the number of serial ports you want the AMBA PL010 driver ++ to support. ++ + config SERIAL_AMBA_PL010_CONSOLE + bool "Support for console on AMBA serial port" + depends on SERIAL_AMBA_PL010=y diff --git a/target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch b/target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch new file mode 100644 index 0000000000..5345022da4 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch @@ -0,0 +1,27 @@ +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -55,13 +55,17 @@ static void gpio_led_set(struct led_clas + container_of(led_cdev, struct gpio_led_data, cdev); + int level; + +- if (value == LED_OFF) +- level = 0; +- else +- level = 1; +- +- if (led_dat->active_low) +- level = !level; ++ switch (value) { ++ case LED_OFF: ++ level = led_dat->active_low ? 1 : 0; ++ break; ++ case LED_FULL: ++ level = led_dat->active_low ? 0 : 1; ++ break; ++ default: ++ level = value; ++ break; ++ } + + /* Setting GPIOs with I2C/etc requires a task context, and we don't + * seem to have a reliable way to know if we're already in one; so diff --git a/target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch b/target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch new file mode 100644 index 0000000000..4b6db8b8db --- /dev/null +++ b/target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch @@ -0,0 +1,31 @@ +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -1116,6 +1116,18 @@ config RC32434_WDT + To compile this driver as a module, choose M here: the + module will be called rc32434_wdt. + ++config ADM5120_WDT ++ tristate "Infineon ADM5120 SoC hardware watchdog" ++ depends on WATCHDOG && ADM5120 ++ help ++ This is a driver for hardware watchdog integrated in Infineon ++ ADM5120 SoC. This watchdog simply watches your kernel to make sure ++ it doesn't freeze, and if it does, it reboots your computer after a ++ certain amount of time. ++ ++ To compile this driver as a module, choose M here: the module will be ++ called adm5120_wdt. ++ + config INDYDOG + tristate "Indy/I2 Hardware Watchdog" + depends on SGI_HAS_INDYDOG +--- a/drivers/watchdog/Makefile ++++ b/drivers/watchdog/Makefile +@@ -131,6 +131,7 @@ obj-$(CONFIG_ATH79_WDT) += ath79_wdt.o + obj-$(CONFIG_BCM47XX_WDT) += bcm47xx_wdt.o + obj-$(CONFIG_BCM63XX_WDT) += bcm63xx_wdt.o + obj-$(CONFIG_RC32434_WDT) += rc32434_wdt.o ++obj-$(CONFIG_ADM5120_WDT) += adm5120_wdt.o + obj-$(CONFIG_INDYDOG) += indydog.o + obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o + obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o |