ramips: fix cd-poll sd card remove randomly
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-4.4 / 180-Revert-bcma-init-serial-console-directly-from-ChipCo.patch
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
2 Subject: [PATCH] Revert "bcma: init serial console directly from ChipCommon
3 code"
4 MIME-Version: 1.0
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
7
8 This reverts commit 4c81acab3816 ("bcma: init serial console directly
9 from ChipCommon code") as it broke IRQ assignment. Getting IRQ with
10 bcma_core_irq helper on SoC requires MIPS core to be set. It happens
11 *after* ChipCommon initialization so we can't do this so early.
12
13 This fixes a user reported regression. It wasn't critical as serial was
14 still somehow working but lack of IRQs was making in unreliable.
15
16 Fixes: 4c81acab3816 ("bcma: init serial console directly from ChipCommon code")
17 Reported-by: Felix Fietkau <nbd@nbd.name>
18 Cc: stable@vger.kernel.org # 4.6+
19 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
20 ---
21 drivers/bcma/bcma_private.h | 3 +++
22 drivers/bcma/driver_chipcommon.c | 11 +++--------
23 drivers/bcma/driver_mips.c | 3 +++
24 3 files changed, 9 insertions(+), 8 deletions(-)
25
26 --- a/drivers/bcma/bcma_private.h
27 +++ b/drivers/bcma/bcma_private.h
28 @@ -45,6 +45,9 @@ int bcma_sprom_get(struct bcma_bus *bus)
29 void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
30 void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
31 void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
32 +#ifdef CONFIG_BCMA_DRIVER_MIPS
33 +void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
34 +#endif /* CONFIG_BCMA_DRIVER_MIPS */
35
36 /* driver_chipcommon_b.c */
37 int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb);
38 --- a/drivers/bcma/driver_chipcommon.c
39 +++ b/drivers/bcma/driver_chipcommon.c
40 @@ -15,8 +15,6 @@
41 #include <linux/platform_device.h>
42 #include <linux/bcma/bcma.h>
43
44 -static void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
45 -
46 static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
47 u32 mask, u32 value)
48 {
49 @@ -186,9 +184,6 @@ void bcma_core_chipcommon_early_init(str
50 if (cc->capabilities & BCMA_CC_CAP_PMU)
51 bcma_pmu_early_init(cc);
52
53 - if (IS_BUILTIN(CONFIG_BCM47XX) && bus->hosttype == BCMA_HOSTTYPE_SOC)
54 - bcma_chipco_serial_init(cc);
55 -
56 if (bus->hosttype == BCMA_HOSTTYPE_SOC)
57 bcma_core_chipcommon_flash_detect(cc);
58
59 @@ -378,9 +373,9 @@ u32 bcma_chipco_gpio_pulldown(struct bcm
60 return res;
61 }
62
63 -static void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
64 +#ifdef CONFIG_BCMA_DRIVER_MIPS
65 +void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
66 {
67 -#if IS_BUILTIN(CONFIG_BCM47XX)
68 unsigned int irq;
69 u32 baud_base;
70 u32 i;
71 @@ -422,5 +417,5 @@ static void bcma_chipco_serial_init(stru
72 ports[i].baud_base = baud_base;
73 ports[i].reg_shift = 0;
74 }
75 -#endif /* CONFIG_BCM47XX */
76 }
77 +#endif /* CONFIG_BCMA_DRIVER_MIPS */
78 --- a/drivers/bcma/driver_mips.c
79 +++ b/drivers/bcma/driver_mips.c
80 @@ -278,9 +278,12 @@ static void bcma_core_mips_nvram_init(st
81
82 void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
83 {
84 + struct bcma_bus *bus = mcore->core->bus;
85 +
86 if (mcore->early_setup_done)
87 return;
88
89 + bcma_chipco_serial_init(&bus->drv_cc);
90 bcma_core_mips_nvram_init(mcore);
91
92 mcore->early_setup_done = true;