From: Hauke Mehrtens Date: Mon, 8 Sep 2014 19:50:11 +0000 (+0000) Subject: kernel: update bcma to the version from wireless-testing master-2014-09-04 tag X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e030c505029f7662eecb8fa0608379fb5e72a423;p=openwrt%2Fstaging%2Frobimarko.git kernel: update bcma to the version from wireless-testing master-2014-09-04 tag Signed-off-by: Rafał Miłecki SVN-Revision: 42447 --- diff --git a/target/linux/bcm53xx/patches-3.14/140-bcma-only-map-wrap-if-it-is-not-null.patch b/target/linux/bcm53xx/patches-3.14/140-bcma-only-map-wrap-if-it-is-not-null.patch deleted file mode 100644 index 719b161f36..0000000000 --- a/target/linux/bcm53xx/patches-3.14/140-bcma-only-map-wrap-if-it-is-not-null.patch +++ /dev/null @@ -1,56 +0,0 @@ -From c6516d2c672450fb27783866397a487511d90bba Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Fri, 22 Aug 2014 08:44:52 +0200 -Subject: [PATCH 08/17] bcma: only map wrapper if its address is available -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The Chipcommon B core does not have a wrap address and it would fail here. - -Signed-off-by: Hauke Mehrtens -Signed-off-by: Rafał Miłecki ---- - drivers/bcma/host_soc.c | 4 ++++ - drivers/bcma/scan.c | 11 +++++++---- - 2 files changed, 11 insertions(+), 4 deletions(-) - ---- a/drivers/bcma/host_soc.c -+++ b/drivers/bcma/host_soc.c -@@ -137,12 +137,16 @@ static void bcma_host_soc_block_write(st - - static u32 bcma_host_soc_aread32(struct bcma_device *core, u16 offset) - { -+ if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n")) -+ return ~0; - return readl(core->io_wrap + offset); - } - - static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset, - u32 value) - { -+ if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n")) -+ return; - writel(value, core->io_wrap + offset); - } - ---- a/drivers/bcma/scan.c -+++ b/drivers/bcma/scan.c -@@ -421,10 +421,13 @@ static int bcma_get_next_core(struct bcm - core->io_addr = ioremap_nocache(core->addr, BCMA_CORE_SIZE); - if (!core->io_addr) - return -ENOMEM; -- core->io_wrap = ioremap_nocache(core->wrap, BCMA_CORE_SIZE); -- if (!core->io_wrap) { -- iounmap(core->io_addr); -- return -ENOMEM; -+ if (core->wrap) { -+ core->io_wrap = ioremap_nocache(core->wrap, -+ BCMA_CORE_SIZE); -+ if (!core->io_wrap) { -+ iounmap(core->io_addr); -+ return -ENOMEM; -+ } - } - } - return 0; diff --git a/target/linux/generic/patches-3.10/025-bcma_backport.patch b/target/linux/generic/patches-3.10/025-bcma_backport.patch index 0d41ed03c0..ab4b2ceb85 100644 --- a/target/linux/generic/patches-3.10/025-bcma_backport.patch +++ b/target/linux/generic/patches-3.10/025-bcma_backport.patch @@ -1085,6 +1085,24 @@ /* no more entries for port _i_ */ /* pr_debug("erom: master wrapper %d " * has %d descriptors\n", i, j); */ +@@ -407,10 +421,13 @@ static int bcma_get_next_core(struct bcm + core->io_addr = ioremap_nocache(core->addr, BCMA_CORE_SIZE); + if (!core->io_addr) + return -ENOMEM; +- core->io_wrap = ioremap_nocache(core->wrap, BCMA_CORE_SIZE); +- if (!core->io_wrap) { +- iounmap(core->io_addr); +- return -ENOMEM; ++ if (core->wrap) { ++ core->io_wrap = ioremap_nocache(core->wrap, ++ BCMA_CORE_SIZE); ++ if (!core->io_wrap) { ++ iounmap(core->io_addr); ++ return -ENOMEM; ++ } + } + } + return 0; --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c @@ -72,12 +72,12 @@ fail: @@ -1766,3 +1784,126 @@ brcms_b_xtal(wlc_hw, OFF); } } +--- a/drivers/bcma/driver_mips.c ++++ b/drivers/bcma/driver_mips.c +@@ -21,6 +21,14 @@ + #include + #include + ++enum bcma_boot_dev { ++ BCMA_BOOT_DEV_UNK = 0, ++ BCMA_BOOT_DEV_ROM, ++ BCMA_BOOT_DEV_PARALLEL, ++ BCMA_BOOT_DEV_SERIAL, ++ BCMA_BOOT_DEV_NAND, ++}; ++ + static const char * const part_probes[] = { "bcm47xxpart", NULL }; + + static struct physmap_flash_data bcma_pflash_data = { +@@ -229,11 +237,51 @@ u32 bcma_cpu_clock(struct bcma_drv_mips + } + EXPORT_SYMBOL(bcma_cpu_clock); + ++static enum bcma_boot_dev bcma_boot_dev(struct bcma_bus *bus) ++{ ++ struct bcma_drv_cc *cc = &bus->drv_cc; ++ u8 cc_rev = cc->core->id.rev; ++ ++ if (cc_rev == 42) { ++ struct bcma_device *core; ++ ++ core = bcma_find_core(bus, BCMA_CORE_NS_ROM); ++ if (core) { ++ switch (bcma_aread32(core, BCMA_IOST) & ++ BCMA_NS_ROM_IOST_BOOT_DEV_MASK) { ++ case BCMA_NS_ROM_IOST_BOOT_DEV_NOR: ++ return BCMA_BOOT_DEV_SERIAL; ++ case BCMA_NS_ROM_IOST_BOOT_DEV_NAND: ++ return BCMA_BOOT_DEV_NAND; ++ case BCMA_NS_ROM_IOST_BOOT_DEV_ROM: ++ default: ++ return BCMA_BOOT_DEV_ROM; ++ } ++ } ++ } else { ++ if (cc_rev == 38) { ++ if (cc->status & BCMA_CC_CHIPST_5357_NAND_BOOT) ++ return BCMA_BOOT_DEV_NAND; ++ else if (cc->status & BIT(5)) ++ return BCMA_BOOT_DEV_ROM; ++ } ++ ++ if ((cc->capabilities & BCMA_CC_CAP_FLASHT) == ++ BCMA_CC_FLASHT_PARA) ++ return BCMA_BOOT_DEV_PARALLEL; ++ else ++ return BCMA_BOOT_DEV_SERIAL; ++ } ++ ++ return BCMA_BOOT_DEV_SERIAL; ++} ++ + static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) + { + struct bcma_bus *bus = mcore->core->bus; + struct bcma_drv_cc *cc = &bus->drv_cc; + struct bcma_pflash *pflash = &cc->pflash; ++ enum bcma_boot_dev boot_dev; + + switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { + case BCMA_CC_FLASHT_STSER: +@@ -269,6 +317,20 @@ static void bcma_core_mips_flash_detect( + bcma_nflash_init(cc); + } + } ++ ++ /* Determine flash type this SoC boots from */ ++ boot_dev = bcma_boot_dev(bus); ++ switch (boot_dev) { ++ case BCMA_BOOT_DEV_PARALLEL: ++ case BCMA_BOOT_DEV_SERIAL: ++ /* TODO: Init NVRAM using BCMA_SOC_FLASH2 window */ ++ break; ++ case BCMA_BOOT_DEV_NAND: ++ /* TODO: Init NVRAM using BCMA_SOC_FLASH1 window */ ++ break; ++ default: ++ break; ++ } + } + + void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) +--- a/drivers/bcma/host_soc.c ++++ b/drivers/bcma/host_soc.c +@@ -134,12 +134,16 @@ static void bcma_host_soc_block_write(st + + static u32 bcma_host_soc_aread32(struct bcma_device *core, u16 offset) + { ++ if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n")) ++ return ~0; + return readl(core->io_wrap + offset); + } + + static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset, + u32 value) + { ++ if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n")) ++ return; + writel(value, core->io_wrap + offset); + } + +--- a/include/linux/bcma/bcma_regs.h ++++ b/include/linux/bcma/bcma_regs.h +@@ -39,6 +39,11 @@ + #define BCMA_RESET_CTL_RESET 0x0001 + #define BCMA_RESET_ST 0x0804 + ++#define BCMA_NS_ROM_IOST_BOOT_DEV_MASK 0x0003 ++#define BCMA_NS_ROM_IOST_BOOT_DEV_NOR 0x0000 ++#define BCMA_NS_ROM_IOST_BOOT_DEV_NAND 0x0001 ++#define BCMA_NS_ROM_IOST_BOOT_DEV_ROM 0x0002 ++ + /* BCMA PCI config space registers. */ + #define BCMA_PCI_PMCSR 0x44 + #define BCMA_PCI_PE 0x100 diff --git a/target/linux/generic/patches-3.14/025-bcma_backport.patch b/target/linux/generic/patches-3.14/025-bcma_backport.patch index 62a5aed7ee..a9a8059a4b 100644 --- a/target/linux/generic/patches-3.14/025-bcma_backport.patch +++ b/target/linux/generic/patches-3.14/025-bcma_backport.patch @@ -566,3 +566,144 @@ { BCMA_CORE_ARMCA9, "ARM Cortex A9 core (ihost)" }, { BCMA_CORE_AMEMC, "AMEMC (DDR)" }, { BCMA_CORE_ALTA, "ALTA (I2S)" }, +@@ -421,10 +421,13 @@ static int bcma_get_next_core(struct bcm + core->io_addr = ioremap_nocache(core->addr, BCMA_CORE_SIZE); + if (!core->io_addr) + return -ENOMEM; +- core->io_wrap = ioremap_nocache(core->wrap, BCMA_CORE_SIZE); +- if (!core->io_wrap) { +- iounmap(core->io_addr); +- return -ENOMEM; ++ if (core->wrap) { ++ core->io_wrap = ioremap_nocache(core->wrap, ++ BCMA_CORE_SIZE); ++ if (!core->io_wrap) { ++ iounmap(core->io_addr); ++ return -ENOMEM; ++ } + } + } + return 0; +--- a/drivers/bcma/host_soc.c ++++ b/drivers/bcma/host_soc.c +@@ -134,12 +134,16 @@ static void bcma_host_soc_block_write(st + + static u32 bcma_host_soc_aread32(struct bcma_device *core, u16 offset) + { ++ if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n")) ++ return ~0; + return readl(core->io_wrap + offset); + } + + static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset, + u32 value) + { ++ if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n")) ++ return; + writel(value, core->io_wrap + offset); + } + +--- a/drivers/bcma/driver_mips.c ++++ b/drivers/bcma/driver_mips.c +@@ -21,6 +21,14 @@ + #include + #include + ++enum bcma_boot_dev { ++ BCMA_BOOT_DEV_UNK = 0, ++ BCMA_BOOT_DEV_ROM, ++ BCMA_BOOT_DEV_PARALLEL, ++ BCMA_BOOT_DEV_SERIAL, ++ BCMA_BOOT_DEV_NAND, ++}; ++ + static const char * const part_probes[] = { "bcm47xxpart", NULL }; + + static struct physmap_flash_data bcma_pflash_data = { +@@ -229,11 +237,51 @@ u32 bcma_cpu_clock(struct bcma_drv_mips + } + EXPORT_SYMBOL(bcma_cpu_clock); + ++static enum bcma_boot_dev bcma_boot_dev(struct bcma_bus *bus) ++{ ++ struct bcma_drv_cc *cc = &bus->drv_cc; ++ u8 cc_rev = cc->core->id.rev; ++ ++ if (cc_rev == 42) { ++ struct bcma_device *core; ++ ++ core = bcma_find_core(bus, BCMA_CORE_NS_ROM); ++ if (core) { ++ switch (bcma_aread32(core, BCMA_IOST) & ++ BCMA_NS_ROM_IOST_BOOT_DEV_MASK) { ++ case BCMA_NS_ROM_IOST_BOOT_DEV_NOR: ++ return BCMA_BOOT_DEV_SERIAL; ++ case BCMA_NS_ROM_IOST_BOOT_DEV_NAND: ++ return BCMA_BOOT_DEV_NAND; ++ case BCMA_NS_ROM_IOST_BOOT_DEV_ROM: ++ default: ++ return BCMA_BOOT_DEV_ROM; ++ } ++ } ++ } else { ++ if (cc_rev == 38) { ++ if (cc->status & BCMA_CC_CHIPST_5357_NAND_BOOT) ++ return BCMA_BOOT_DEV_NAND; ++ else if (cc->status & BIT(5)) ++ return BCMA_BOOT_DEV_ROM; ++ } ++ ++ if ((cc->capabilities & BCMA_CC_CAP_FLASHT) == ++ BCMA_CC_FLASHT_PARA) ++ return BCMA_BOOT_DEV_PARALLEL; ++ else ++ return BCMA_BOOT_DEV_SERIAL; ++ } ++ ++ return BCMA_BOOT_DEV_SERIAL; ++} ++ + static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) + { + struct bcma_bus *bus = mcore->core->bus; + struct bcma_drv_cc *cc = &bus->drv_cc; + struct bcma_pflash *pflash = &cc->pflash; ++ enum bcma_boot_dev boot_dev; + + switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { + case BCMA_CC_FLASHT_STSER: +@@ -269,6 +317,20 @@ static void bcma_core_mips_flash_detect( + bcma_nflash_init(cc); + } + } ++ ++ /* Determine flash type this SoC boots from */ ++ boot_dev = bcma_boot_dev(bus); ++ switch (boot_dev) { ++ case BCMA_BOOT_DEV_PARALLEL: ++ case BCMA_BOOT_DEV_SERIAL: ++ /* TODO: Init NVRAM using BCMA_SOC_FLASH2 window */ ++ break; ++ case BCMA_BOOT_DEV_NAND: ++ /* TODO: Init NVRAM using BCMA_SOC_FLASH1 window */ ++ break; ++ default: ++ break; ++ } + } + + void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) +--- a/include/linux/bcma/bcma_regs.h ++++ b/include/linux/bcma/bcma_regs.h +@@ -39,6 +39,11 @@ + #define BCMA_RESET_CTL_RESET 0x0001 + #define BCMA_RESET_ST 0x0804 + ++#define BCMA_NS_ROM_IOST_BOOT_DEV_MASK 0x0003 ++#define BCMA_NS_ROM_IOST_BOOT_DEV_NOR 0x0000 ++#define BCMA_NS_ROM_IOST_BOOT_DEV_NAND 0x0001 ++#define BCMA_NS_ROM_IOST_BOOT_DEV_ROM 0x0002 ++ + /* BCMA PCI config space registers. */ + #define BCMA_PCI_PMCSR 0x44 + #define BCMA_PCI_PE 0x100