From c86606453316d9d2593557781f238b6d46b59190 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 27 Jun 2011 20:20:11 +0000 Subject: [PATCH] brcm47xx: fix Linux-3.0 and fix clock rate detection. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@27294 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../brcm47xx/patches-3.0/220-bcm5354.patch | 2 +- .../patches-3.0/230-flash_linux_3_0.patch | 68 +++++++++++++++++++ .../patches-3.0/240-ssb_no_sprom_on_pci.patch | 28 ++++++++ .../250-ssb_fix_ssb_clock_rate.patch | 25 +++++++ .../976-ssb_increase_pci_delay.patch | 2 +- 5 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 target/linux/brcm47xx/patches-3.0/230-flash_linux_3_0.patch create mode 100644 target/linux/brcm47xx/patches-3.0/240-ssb_no_sprom_on_pci.patch create mode 100644 target/linux/brcm47xx/patches-3.0/250-ssb_fix_ssb_clock_rate.patch diff --git a/target/linux/brcm47xx/patches-3.0/220-bcm5354.patch b/target/linux/brcm47xx/patches-3.0/220-bcm5354.patch index f7bc920d0e..d68534fb65 100644 --- a/target/linux/brcm47xx/patches-3.0/220-bcm5354.patch +++ b/target/linux/brcm47xx/patches-3.0/220-bcm5354.patch @@ -31,7 +31,7 @@ } --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c -@@ -1103,6 +1103,8 @@ u32 ssb_clockspeed(struct ssb_bus *bus) +@@ -1104,6 +1104,8 @@ u32 ssb_clockspeed(struct ssb_bus *bus) if (bus->chip_id == 0x5365) { rate = 100000000; diff --git a/target/linux/brcm47xx/patches-3.0/230-flash_linux_3_0.patch b/target/linux/brcm47xx/patches-3.0/230-flash_linux_3_0.patch new file mode 100644 index 0000000000..c6328139c7 --- /dev/null +++ b/target/linux/brcm47xx/patches-3.0/230-flash_linux_3_0.patch @@ -0,0 +1,68 @@ +--- a/drivers/mtd/maps/bcm47xx-flash.c ++++ b/drivers/mtd/maps/bcm47xx-flash.c +@@ -44,9 +44,7 @@ + #include + #include + #include +-#ifdef CONFIG_MTD_PARTITIONS + #include +-#endif + #include + #ifdef CONFIG_SSB + #include +@@ -120,7 +118,6 @@ static struct map_info bcm47xx_map = { + phys: WINDOW_ADDR, + }; + +-#ifdef CONFIG_MTD_PARTITIONS + + static struct mtd_partition bcm47xx_parts[] = { + { name: "cfe", offset: 0, size: 0, mask_flags: MTD_WRITEABLE, }, +@@ -552,7 +549,6 @@ init_mtd_partitions(struct mtd_info *mtd + + return bcm47xx_parts; + } +-#endif + + int __init init_bcm47xx_map(void) + { +@@ -561,10 +557,8 @@ int __init init_bcm47xx_map(void) + #endif + size_t size; + int ret = 0; +-#ifdef CONFIG_MTD_PARTITIONS + struct mtd_partition *parts; + int i; +-#endif + + #ifdef CONFIG_SSB + u32 window = mcore->flash_window; +@@ -602,15 +596,13 @@ int __init init_bcm47xx_map(void) + + printk(KERN_NOTICE "Flash device: 0x%x at 0x%x\n", size, WINDOW_ADDR); + +-#ifdef CONFIG_MTD_PARTITIONS + parts = init_mtd_partitions(bcm47xx_mtd, size); + for (i = 0; parts[i].name; i++); +- ret = add_mtd_partitions(bcm47xx_mtd, parts, i); ++ ret = mtd_device_register(bcm47xx_mtd, parts, i); + if (ret) { +- printk(KERN_ERR "Flash: add_mtd_partitions failed\n"); ++ printk(KERN_ERR "Flash: mtd_device_register failed\n"); + goto fail; + } +-#endif + return 0; + + fail: +@@ -624,9 +616,7 @@ int __init init_bcm47xx_map(void) + + void __exit cleanup_bcm47xx_map(void) + { +-#ifdef CONFIG_MTD_PARTITIONS +- del_mtd_partitions(bcm47xx_mtd); +-#endif ++ mtd_device_unregister(bcm47xx_mtd); + map_destroy(bcm47xx_mtd); + iounmap((void *)bcm47xx_map.virt); + } diff --git a/target/linux/brcm47xx/patches-3.0/240-ssb_no_sprom_on_pci.patch b/target/linux/brcm47xx/patches-3.0/240-ssb_no_sprom_on_pci.patch new file mode 100644 index 0000000000..52c8fe95f3 --- /dev/null +++ b/target/linux/brcm47xx/patches-3.0/240-ssb_no_sprom_on_pci.patch @@ -0,0 +1,28 @@ +--- a/drivers/ssb/driver_pcicore.c ++++ b/drivers/ssb/driver_pcicore.c +@@ -412,16 +412,6 @@ static int __devinit pcicore_is_in_hostm + * Workarounds. + **************************************************/ + +-static void __devinit ssb_pcicore_fix_sprom_core_index(struct ssb_pcicore *pc) +-{ +- u16 tmp = pcicore_read16(pc, SSB_PCICORE_SPROM(0)); +- if (((tmp & 0xF000) >> 12) != pc->dev->core_index) { +- tmp &= ~0xF000; +- tmp |= (pc->dev->core_index << 12); +- pcicore_write16(pc, SSB_PCICORE_SPROM(0), tmp); +- } +-} +- + static u8 ssb_pcicore_polarity_workaround(struct ssb_pcicore *pc) + { + return (ssb_pcie_read(pc, 0x204) & 0x10) ? 0xC0 : 0x80; +@@ -529,8 +519,6 @@ void __devinit ssb_pcicore_init(struct s + if (!ssb_device_is_enabled(dev)) + ssb_device_enable(dev, 0); + +- ssb_pcicore_fix_sprom_core_index(pc); +- + #ifdef CONFIG_SSB_PCICORE_HOSTMODE + pc->hostmode = pcicore_is_in_hostmode(pc); + if (pc->hostmode) diff --git a/target/linux/brcm47xx/patches-3.0/250-ssb_fix_ssb_clock_rate.patch b/target/linux/brcm47xx/patches-3.0/250-ssb_fix_ssb_clock_rate.patch new file mode 100644 index 0000000000..fe6507b8de --- /dev/null +++ b/target/linux/brcm47xx/patches-3.0/250-ssb_fix_ssb_clock_rate.patch @@ -0,0 +1,25 @@ +From 974353557959d8ec1c022511cd1b3eeaa7ed482a Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sat, 4 Jun 2011 15:55:24 +0200 +Subject: [PATCH 15/15] ssb: fix ssb clock rate according to broadcom source + +This fix was done according to si_clock_rate function in broadcom siutils.c + +Signed-off-by: Hauke Mehrtens +--- + drivers/ssb/main.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/ssb/main.c ++++ b/drivers/ssb/main.c +@@ -1002,8 +1002,8 @@ u32 ssb_calc_clock_rate(u32 plltype, u32 + switch (plltype) { + case SSB_PLLTYPE_6: /* 100/200 or 120/240 only */ + if (m & SSB_CHIPCO_CLK_T6_MMASK) +- return SSB_CHIPCO_CLK_T6_M0; +- return SSB_CHIPCO_CLK_T6_M1; ++ return SSB_CHIPCO_CLK_T6_M1; ++ return SSB_CHIPCO_CLK_T6_M0; + case SSB_PLLTYPE_1: /* 48Mhz base, 3 dividers */ + case SSB_PLLTYPE_3: /* 25Mhz, 2 dividers */ + case SSB_PLLTYPE_4: /* 48Mhz, 4 dividers */ diff --git a/target/linux/brcm47xx/patches-3.0/976-ssb_increase_pci_delay.patch b/target/linux/brcm47xx/patches-3.0/976-ssb_increase_pci_delay.patch index b56f1d5be3..0650c25683 100644 --- a/target/linux/brcm47xx/patches-3.0/976-ssb_increase_pci_delay.patch +++ b/target/linux/brcm47xx/patches-3.0/976-ssb_increase_pci_delay.patch @@ -1,6 +1,6 @@ --- a/drivers/ssb/driver_pcicore.c +++ b/drivers/ssb/driver_pcicore.c -@@ -375,7 +375,7 @@ static void ssb_pcicore_init_hostmode(st +@@ -375,7 +375,7 @@ static void __devinit ssb_pcicore_init_h set_io_port_base(ssb_pcicore_controller.io_map_base); /* Give some time to the PCI controller to configure itself with the new * values. Not waiting at this point causes crashes of the machine. */