From 43d3ef91f14ea2353cbc7b6d7271a496017c6bc2 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Fri, 3 Apr 2020 17:48:43 +0200 Subject: [PATCH] bcm63xx: prevent fall-through in kernel patches for 5.4 In kernel 5.4 -Werror=implicit-fallthrough is treated as error: arch/mips/bcm63xx/cpu.c: In function 'detect_cpu_clock': arch/mips/bcm63xx/cpu.c:158:2: error: this statement may fall through [-Werror=implicit-fallthrough=] { ^ arch/mips/bcm63xx/cpu.c:179:2: note: here case BCM6328_CPU_ID: ^~~~ cc1: all warnings being treated as errors This can be fixed by adding "Fall through" as a comment where intended, and has to be fixed by returning a proper default otherwise. In case of the default clock frequency for BCM6318 we fixed this by returning the default value taken from BCM6328 and BCM6362. Signed-off-by: Adrian Schmutzler --- .../341-MIPS-BCM63XX-add-support-for-BCM6318.patch | 12 +++++++----- .../416-BCM63XX-add-a-fixup-for-ath9k-devices.patch | 3 ++- .../420-BCM63XX-add-endian-check-for-ath9k.patch | 2 +- .../421-BCM63XX-add-led-pin-for-ath9k.patch | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/target/linux/bcm63xx/patches-5.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch b/target/linux/bcm63xx/patches-5.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch index 5f4c900813..5b05fa6bd5 100644 --- a/target/linux/bcm63xx/patches-5.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch +++ b/target/linux/bcm63xx/patches-5.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch @@ -124,7 +124,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 static unsigned int detect_cpu_clock(void) { u32 cpu_id = bcm63xx_get_cpu_id(); -@@ -142,6 +154,28 @@ static unsigned int detect_cpu_clock(voi +@@ -142,6 +154,30 @@ static unsigned int detect_cpu_clock(voi case BCM3368_CPU_ID: return 300000000; @@ -148,12 +148,14 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 + return 250000000; + case 3: + return 333000000; -+ }; ++ default: ++ return 320000000; ++ } + } case BCM6328_CPU_ID: { unsigned int tmp, mips_pll_fcvo; -@@ -297,6 +331,13 @@ static unsigned int detect_memory_size(v +@@ -297,6 +333,13 @@ static unsigned int detect_memory_size(v unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; u32 val; @@ -167,7 +169,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) return bcm_ddr_readl(DDR_CSEND_REG) << 24; -@@ -343,6 +384,12 @@ void __init bcm63xx_cpu_init(void) +@@ -343,6 +386,12 @@ void __init bcm63xx_cpu_init(void) switch (current_cpu_type()) { case CPU_BMIPS3300: @@ -180,7 +182,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 if ((read_c0_prid() & PRID_IMP_MASK) != PRID_IMP_BMIPS3300_ALT) __cpu_name[cpu] = "Broadcom BCM6338"; /* fall-through */ -@@ -390,6 +437,10 @@ void __init bcm63xx_cpu_init(void) +@@ -390,6 +439,10 @@ void __init bcm63xx_cpu_init(void) bcm63xx_cpu_variant = bcm63xx_cpu_id; switch (bcm63xx_cpu_id) { diff --git a/target/linux/bcm63xx/patches-5.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch b/target/linux/bcm63xx/patches-5.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch index c9d2ee1791..d83d2cec7b 100644 --- a/target/linux/bcm63xx/patches-5.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch +++ b/target/linux/bcm63xx/patches-5.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch @@ -24,7 +24,7 @@ Subject: [PATCH 61/72] BCM63XX: add a fixup for ath9k devices obj-y += boards/ --- /dev/null +++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c -@@ -0,0 +1,200 @@ +@@ -0,0 +1,201 @@ +/* + * Broadcom BCM63XX Ath9k EEPROM fixup helper. + * @@ -108,6 +108,7 @@ Subject: [PATCH 61/72] BCM63XX: add a fixup for ath9k devices + return eeprom; + } + /* can't do anything here without talking to the SPI controller. */ ++ /* Fall through */ + case BCM63XX_FLASH_TYPE_NAND: + default: + return NULL; diff --git a/target/linux/bcm63xx/patches-5.4/420-BCM63XX-add-endian-check-for-ath9k.patch b/target/linux/bcm63xx/patches-5.4/420-BCM63XX-add-endian-check-for-ath9k.patch index 2076879ed6..332b2394e1 100644 --- a/target/linux/bcm63xx/patches-5.4/420-BCM63XX-add-endian-check-for-ath9k.patch +++ b/target/linux/bcm63xx/patches-5.4/420-BCM63XX-add-endian-check-for-ath9k.patch @@ -21,7 +21,7 @@ /* --- a/arch/mips/bcm63xx/pci-ath9k-fixup.c +++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c -@@ -182,12 +182,14 @@ static void ath9k_pci_fixup(struct pci_d +@@ -183,12 +183,14 @@ static void ath9k_pci_fixup(struct pci_d } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); diff --git a/target/linux/bcm63xx/patches-5.4/421-BCM63XX-add-led-pin-for-ath9k.patch b/target/linux/bcm63xx/patches-5.4/421-BCM63XX-add-led-pin-for-ath9k.patch index bb111dc9de..1f28198c4a 100644 --- a/target/linux/bcm63xx/patches-5.4/421-BCM63XX-add-led-pin-for-ath9k.patch +++ b/target/linux/bcm63xx/patches-5.4/421-BCM63XX-add-led-pin-for-ath9k.patch @@ -11,7 +11,7 @@ } --- a/arch/mips/bcm63xx/pci-ath9k-fixup.c +++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c -@@ -183,13 +183,15 @@ static void ath9k_pci_fixup(struct pci_d +@@ -184,13 +184,15 @@ static void ath9k_pci_fixup(struct pci_d DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset, -- 2.30.2