Skip to contentSkip to conversation

Generic BMIPS kernel

PATCH Superseded Kevin Cernekee 4 participants 30 messages Dec 12, 2014 – Dec 21, 2014

Subsystems (8)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover Generic BMIPS kernel

V4->V5:

- Rebase on top of Linus' head of tree, converting BCM3384 platform code to Generic BMIPS platform code.

- Fix a couple of #include's

- Remove a couple of bogus entries from bmips_be_defconfig

Compile-tested only. Some BMIPS platforms may require acked-but-unmerged changes in other subsystems (like the native-endian serial8250/DT patches).

For 3.19 you'll want the first patch at the minimum (because the build is currently broken).

Brian Norris (1):
irqchip: brcmstb-l2: don't clear wakeable interrupts at init time

Kevin Cernekee (22):
MIPS: bcm3384: Fix outdated use of mips_cpu_intc_init()
MIPS: Create a common <asm/mach-generic/war.h>
MIPS: bcm3384: Rename "bcm3384" target to "bmips"
irqchip: Update docs regarding irq_domain_add_tree()
irqchip: bcm7120-l2: Refactor driver for arbitrary IRQEN/IRQSTAT
offsets
irqchip: bcm7120-l2: Split STB-specific logic into its own function
irqchip: bcm7120-l2: Add support for BCM3380-style controllers
irqchip: Add new driver for BCM7038-style level 1 interrupt
controllers
MIPS: Let __dt_register_buses accept a single bus type
MIPS: Fall back to the generic restart notifier
MIPS: Reorder MIPS_L1_CACHE_SHIFT priorities
MIPS: BMIPS: Flush the readahead cache after DMA
MIPS: BMIPS: Document the firmware->kernel DTB interface
MIPS: BMIPS: Rewrite DMA code to use "dma-ranges" property
MIPS: BMIPS: Remove bogus bus name
MIPS: BMIPS: Add quirks for several Broadcom platforms
MIPS: BMIPS: Delete the irqchip driver from irq.c
MIPS: BMIPS: Use a non-default FIXADDR_TOP setting
MIPS: BMIPS: Enable additional peripheral and CPU support in defconfig
MIPS: BMIPS: Refresh BCM3384 DTS files
MIPS: BMIPS: Update DT bindings to reflect new SoC support
MIPS: BMIPS: Add DTS files for several platforms

 Documentation/IRQ-domain.txt                       |   3 +-
 .../interrupt-controller/brcm,bcm3380-l2-intc.txt  |  41 +++
 .../interrupt-controller/brcm,bcm7038-l1-intc.txt  |  52 ++++
 .../interrupt-controller/brcm,bcm7120-l2-intc.txt  |  12 +-
 .../devicetree/bindings/mips/brcm/bcm3384-intc.txt |  37 ---
 .../devicetree/bindings/mips/brcm/cm-dsl.txt       |  11 -
 .../devicetree/bindings/mips/brcm/soc.txt          |  12 +
 Documentation/devicetree/booting-without-of.txt    |  28 ++
 arch/mips/Kbuild.platforms                         |   2 +-
 arch/mips/Kconfig                                  |  37 ++-
 arch/mips/bcm3384/Platform                         |   7 -
 arch/mips/bcm3384/dma.c                            |  81 -----
 arch/mips/bcm3384/irq.c                            | 193 ------------
 arch/mips/bcm3384/setup.c                          |  97 ------
 arch/mips/bmips/Kconfig                            |  50 +++
 arch/mips/{bcm3384 => bmips}/Makefile              |   0
 arch/mips/bmips/Platform                           |   7 +
 arch/mips/bmips/dma.c                              | 117 +++++++
 arch/mips/bmips/irq.c                              |  38 +++
 arch/mips/bmips/setup.c                            | 194 ++++++++++++
 arch/mips/boot/dts/Makefile                        |  10 +-
 arch/mips/boot/dts/bcm3384.dtsi                    | 109 -------
 arch/mips/boot/dts/bcm3384_viper.dtsi              | 108 +++++++
 arch/mips/boot/dts/bcm3384_zephyr.dtsi             | 126 ++++++++
 arch/mips/boot/dts/bcm6328.dtsi                    |  86 ++++++
 arch/mips/boot/dts/bcm6368.dtsi                    |  93 ++++++
 arch/mips/boot/dts/bcm7125.dtsi                    | 139 +++++++++
 arch/mips/boot/dts/bcm7346.dtsi                    | 224 ++++++++++++++
 arch/mips/boot/dts/bcm7360.dtsi                    | 161 ++++++++++
 arch/mips/boot/dts/bcm7420.dtsi                    | 184 +++++++++++
 arch/mips/boot/dts/bcm7425.dtsi                    | 225 ++++++++++++++
 arch/mips/boot/dts/bcm93384wvg.dts                 |   9 +-
 arch/mips/boot/dts/bcm93384wvg_viper.dts           |  25 ++
 arch/mips/boot/dts/bcm96368mvwg.dts                |  31 ++
 arch/mips/boot/dts/bcm97125cbmb.dts                |  31 ++
 arch/mips/boot/dts/bcm97346dbsmb.dts               |  58 ++++
 arch/mips/boot/dts/bcm97360svmb.dts                |  34 +++
 arch/mips/boot/dts/bcm97420c.dts                   |  45 +++
 arch/mips/boot/dts/bcm97425svmb.dts                |  60 ++++
 arch/mips/boot/dts/bcm9ejtagprb.dts                |  22 ++
 .../{bcm3384_defconfig => bmips_be_defconfig}      |  11 +-
 arch/mips/configs/bmips_stb_defconfig              |  88 ++++++
 arch/mips/include/asm/mach-ar7/war.h               |  24 --
 arch/mips/include/asm/mach-ath25/war.h             |  25 --
 arch/mips/include/asm/mach-ath79/war.h             |  24 --
 arch/mips/include/asm/mach-au1x00/war.h            |  24 --
 arch/mips/include/asm/mach-bcm3384/war.h           |  24 --
 arch/mips/include/asm/mach-bcm47xx/war.h           |  24 --
 arch/mips/include/asm/mach-bcm63xx/war.h           |  24 --
 .../{mach-bcm3384 => mach-bmips}/dma-coherence.h   |   6 +-
 arch/mips/include/asm/mach-bmips/spaces.h          |  18 ++
 arch/mips/include/asm/mach-cavium-octeon/war.h     |  25 --
 arch/mips/include/asm/mach-cobalt/war.h            |  24 --
 arch/mips/include/asm/mach-dec/war.h               |  24 --
 arch/mips/include/asm/mach-emma2rh/war.h           |  24 --
 .../asm/{mach-ralink => mach-generic}/war.h        |   6 +-
 arch/mips/include/asm/mach-jazz/war.h              |  24 --
 arch/mips/include/asm/mach-jz4740/war.h            |  24 --
 arch/mips/include/asm/mach-lantiq/war.h            |  23 --
 arch/mips/include/asm/mach-lasat/war.h             |  24 --
 arch/mips/include/asm/mach-loongson/war.h          |  24 --
 arch/mips/include/asm/mach-loongson1/war.h         |  24 --
 arch/mips/include/asm/mach-netlogic/war.h          |  25 --
 arch/mips/include/asm/mach-paravirt/war.h          |  25 --
 arch/mips/include/asm/mach-pnx833x/war.h           |  24 --
 arch/mips/include/asm/mach-tx39xx/war.h            |  24 --
 arch/mips/include/asm/mach-vr41xx/war.h            |  24 --
 arch/mips/kernel/prom.c                            |   5 +-
 arch/mips/kernel/reset.c                           |   2 +
 arch/mips/mm/dma-default.c                         |  13 +
 drivers/irqchip/Kconfig                            |   5 +
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-bcm7038-l1.c                   | 335 +++++++++++++++++++++
 drivers/irqchip/irq-bcm7120-l2.c                   | 193 ++++++++----
 drivers/irqchip/irq-brcmstb-l2.c                   |   9 +-
 75 files changed, 2850 insertions(+), 1172 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm3380-l2-intc.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
 delete mode 100644 Documentation/devicetree/bindings/mips/brcm/bcm3384-intc.txt
 delete mode 100644 Documentation/devicetree/bindings/mips/brcm/cm-dsl.txt
 create mode 100644 Documentation/devicetree/bindings/mips/brcm/soc.txt
 delete mode 100644 arch/mips/bcm3384/Platform
 delete mode 100644 arch/mips/bcm3384/dma.c
 delete mode 100644 arch/mips/bcm3384/irq.c
 delete mode 100644 arch/mips/bcm3384/setup.c
 create mode 100644 arch/mips/bmips/Kconfig
 rename arch/mips/{bcm3384 => bmips}/Makefile (100%)
 create mode 100644 arch/mips/bmips/Platform
 create mode 100644 arch/mips/bmips/dma.c
 create mode 100644 arch/mips/bmips/irq.c
 create mode 100644 arch/mips/bmips/setup.c
 delete mode 100644 arch/mips/boot/dts/bcm3384.dtsi
 create mode 100644 arch/mips/boot/dts/bcm3384_viper.dtsi
 create mode 100644 arch/mips/boot/dts/bcm3384_zephyr.dtsi
 create mode 100644 arch/mips/boot/dts/bcm6328.dtsi
 create mode 100644 arch/mips/boot/dts/bcm6368.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7125.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7346.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7360.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7420.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7425.dtsi
 create mode 100644 arch/mips/boot/dts/bcm93384wvg_viper.dts
 create mode 100644 arch/mips/boot/dts/bcm96368mvwg.dts
 create mode 100644 arch/mips/boot/dts/bcm97125cbmb.dts
 create mode 100644 arch/mips/boot/dts/bcm97346dbsmb.dts
 create mode 100644 arch/mips/boot/dts/bcm97360svmb.dts
 create mode 100644 arch/mips/boot/dts/bcm97420c.dts
 create mode 100644 arch/mips/boot/dts/bcm97425svmb.dts
 create mode 100644 arch/mips/boot/dts/bcm9ejtagprb.dts
 rename arch/mips/configs/{bcm3384_defconfig => bmips_be_defconfig} (89%)
 create mode 100644 arch/mips/configs/bmips_stb_defconfig
 delete mode 100644 arch/mips/include/asm/mach-ar7/war.h
 delete mode 100644 arch/mips/include/asm/mach-ath25/war.h
 delete mode 100644 arch/mips/include/asm/mach-ath79/war.h
 delete mode 100644 arch/mips/include/asm/mach-au1x00/war.h
 delete mode 100644 arch/mips/include/asm/mach-bcm3384/war.h
 delete mode 100644 arch/mips/include/asm/mach-bcm47xx/war.h
 delete mode 100644 arch/mips/include/asm/mach-bcm63xx/war.h
 rename arch/mips/include/asm/{mach-bcm3384 => mach-bmips}/dma-coherence.h (90%)
 create mode 100644 arch/mips/include/asm/mach-bmips/spaces.h
 delete mode 100644 arch/mips/include/asm/mach-cavium-octeon/war.h
 delete mode 100644 arch/mips/include/asm/mach-cobalt/war.h
 delete mode 100644 arch/mips/include/asm/mach-dec/war.h
 delete mode 100644 arch/mips/include/asm/mach-emma2rh/war.h
 rename arch/mips/include/asm/{mach-ralink => mach-generic}/war.h (86%)
 delete mode 100644 arch/mips/include/asm/mach-jazz/war.h
 delete mode 100644 arch/mips/include/asm/mach-jz4740/war.h
 delete mode 100644 arch/mips/include/asm/mach-lantiq/war.h
 delete mode 100644 arch/mips/include/asm/mach-lasat/war.h
 delete mode 100644 arch/mips/include/asm/mach-loongson/war.h
 delete mode 100644 arch/mips/include/asm/mach-loongson1/war.h
 delete mode 100644 arch/mips/include/asm/mach-netlogic/war.h
 delete mode 100644 arch/mips/include/asm/mach-paravirt/war.h
 delete mode 100644 arch/mips/include/asm/mach-pnx833x/war.h
 delete mode 100644 arch/mips/include/asm/mach-tx39xx/war.h
 delete mode 100644 arch/mips/include/asm/mach-vr41xx/war.h
 create mode 100644 drivers/irqchip/irq-bcm7038-l1.c
Signature · 1 line
2.1.1
#1 lore raw

PATCH v5 1/23 MIPS: bcm3384: Fix outdated use of mips_cpu_intc_init()

This function was renamed to mips_cpu_irq_of_init(), so fix it to avoid a compile error.

---
 arch/mips/bcm3384/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/bcm3384/irq.c +1 -1
index 0fb5134..fd94fe8 100644
@@ -180,7 +180,7 @@ static int __init intc_of_init(struct device_node *node,
 
 static struct of_device_id of_irq_ids[] __initdata = {
 	{ .compatible = "mti,cpu-interrupt-controller",
-	  .data = mips_cpu_intc_init },
+	  .data = mips_cpu_irq_of_init },
 	{ .compatible = "brcm,bcm3384-intc",
 	  .data = intc_of_init },
 	{},
Signature · 1 line
2.1.1
#2 lore raw

PATCH v5 2/23 MIPS: Create a common <asm/mach-generic/war.h>

In reply to Kevin Cernekee

11 platforms require at least one of these workarounds to be enabled; 22 platforms do not. In the latter case we can fall back to a generic version.

Note that this also deletes an orphaned reference to RM9000_CDEX_SMP_WAR.

---
 arch/mips/include/asm/mach-ar7/war.h               | 24 ---------------------
 arch/mips/include/asm/mach-ath25/war.h             | 25 ----------------------
 arch/mips/include/asm/mach-ath79/war.h             | 24 ---------------------
 arch/mips/include/asm/mach-au1x00/war.h            | 24 ---------------------
 arch/mips/include/asm/mach-bcm3384/war.h           | 24 ---------------------
 arch/mips/include/asm/mach-bcm47xx/war.h           | 24 ---------------------
 arch/mips/include/asm/mach-bcm63xx/war.h           | 24 ---------------------
 arch/mips/include/asm/mach-cavium-octeon/war.h     | 25 ----------------------
 arch/mips/include/asm/mach-cobalt/war.h            | 24 ---------------------
 arch/mips/include/asm/mach-dec/war.h               | 24 ---------------------
 arch/mips/include/asm/mach-emma2rh/war.h           | 24 ---------------------
 .../asm/{mach-ralink => mach-generic}/war.h        |  6 +++---
 arch/mips/include/asm/mach-jazz/war.h              | 24 ---------------------
 arch/mips/include/asm/mach-jz4740/war.h            | 24 ---------------------
 arch/mips/include/asm/mach-lantiq/war.h            | 23 --------------------
 arch/mips/include/asm/mach-lasat/war.h             | 24 ---------------------
 arch/mips/include/asm/mach-loongson/war.h          | 24 ---------------------
 arch/mips/include/asm/mach-loongson1/war.h         | 24 ---------------------
 arch/mips/include/asm/mach-netlogic/war.h          | 25 ----------------------
 arch/mips/include/asm/mach-paravirt/war.h          | 25 ----------------------
 arch/mips/include/asm/mach-pnx833x/war.h           | 24 ---------------------
 arch/mips/include/asm/mach-tx39xx/war.h            | 24 ---------------------
 arch/mips/include/asm/mach-vr41xx/war.h            | 24 ---------------------
 23 files changed, 3 insertions(+), 534 deletions(-)
 delete mode 100644 arch/mips/include/asm/mach-ar7/war.h
 delete mode 100644 arch/mips/include/asm/mach-ath25/war.h
 delete mode 100644 arch/mips/include/asm/mach-ath79/war.h
 delete mode 100644 arch/mips/include/asm/mach-au1x00/war.h
 delete mode 100644 arch/mips/include/asm/mach-bcm3384/war.h
 delete mode 100644 arch/mips/include/asm/mach-bcm47xx/war.h
 delete mode 100644 arch/mips/include/asm/mach-bcm63xx/war.h
 delete mode 100644 arch/mips/include/asm/mach-cavium-octeon/war.h
 delete mode 100644 arch/mips/include/asm/mach-cobalt/war.h
 delete mode 100644 arch/mips/include/asm/mach-dec/war.h
 delete mode 100644 arch/mips/include/asm/mach-emma2rh/war.h
 rename arch/mips/include/asm/{mach-ralink => mach-generic}/war.h (86%)
 delete mode 100644 arch/mips/include/asm/mach-jazz/war.h
 delete mode 100644 arch/mips/include/asm/mach-jz4740/war.h
 delete mode 100644 arch/mips/include/asm/mach-lantiq/war.h
 delete mode 100644 arch/mips/include/asm/mach-lasat/war.h
 delete mode 100644 arch/mips/include/asm/mach-loongson/war.h
 delete mode 100644 arch/mips/include/asm/mach-loongson1/war.h
 delete mode 100644 arch/mips/include/asm/mach-netlogic/war.h
 delete mode 100644 arch/mips/include/asm/mach-paravirt/war.h
 delete mode 100644 arch/mips/include/asm/mach-pnx833x/war.h
 delete mode 100644 arch/mips/include/asm/mach-tx39xx/war.h
 delete mode 100644 arch/mips/include/asm/mach-vr41xx/war.h
arch/mips/include/asm/mach-ar7/war.h deleted +0 -0
deleted file mode 100644
index 99071e5..0000000
arch/mips/include/asm/mach-ath25/war.h deleted +0 -0
deleted file mode 100644
index e3a5250..0000000
arch/mips/include/asm/mach-ath79/war.h deleted +0 -0
deleted file mode 100644
index 0bb3090..0000000
arch/mips/include/asm/mach-au1x00/war.h deleted +0 -0
deleted file mode 100644
index 72e260d..0000000
arch/mips/include/asm/mach-bcm3384/war.h deleted +0 -0
deleted file mode 100644
index 59d7599..0000000
arch/mips/include/asm/mach-bcm47xx/war.h deleted +0 -0
deleted file mode 100644
index a3d2f44..0000000
arch/mips/include/asm/mach-bcm63xx/war.h deleted +0 -0
deleted file mode 100644
index 05ee867..0000000
arch/mips/include/asm/mach-cavium-octeon/war.h deleted +0 -0
deleted file mode 100644
index eb72b35..0000000
arch/mips/include/asm/mach-cobalt/war.h deleted +0 -0
deleted file mode 100644
index 34ae404..0000000
arch/mips/include/asm/mach-dec/war.h deleted +0 -0
deleted file mode 100644
index d29996f..0000000
arch/mips/include/asm/mach-emma2rh/war.h deleted +0 -0
deleted file mode 100644
index 79ae82d..0000000
arch/mips/include/asm/mach-generic/war.h renamed from arch/mips/include/asm/mach-ralink/war.h +3 -3
similarity index 86%
rename from arch/mips/include/asm/mach-ralink/war.h
rename to arch/mips/include/asm/mach-generic/war.h
index c074b5d..a1bc2e7 100644
@@ -5,8 +5,8 @@
  *
  * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <[email protected]>
  */
-#ifndef __ASM_MACH_RALINK_WAR_H
-#define __ASM_MACH_RALINK_WAR_H
+#ifndef __ASM_MACH_GENERIC_WAR_H
+#define __ASM_MACH_GENERIC_WAR_H
 
 #define R4600_V1_INDEX_ICACHEOP_WAR	0
 #define R4600_V1_HIT_CACHEOP_WAR	0
@@ -21,4 +21,4 @@
 #define R10000_LLSC_WAR			0
 #define MIPS34K_MISSED_ITLB_WAR		0
 
-#endif /* __ASM_MACH_RALINK_WAR_H */
+#endif /* __ASM_MACH_GENERIC_WAR_H */
arch/mips/include/asm/mach-jazz/war.h deleted +0 -0
deleted file mode 100644
index 5b18b9a..0000000
arch/mips/include/asm/mach-jz4740/war.h deleted +0 -0
deleted file mode 100644
index 9b511d3..0000000
arch/mips/include/asm/mach-lantiq/war.h deleted +0 -0
deleted file mode 100644
index 358ca97..0000000
arch/mips/include/asm/mach-lasat/war.h deleted +0 -0
deleted file mode 100644
index 741ae72..0000000
arch/mips/include/asm/mach-loongson/war.h deleted +0 -0
deleted file mode 100644
index f2570df..0000000
arch/mips/include/asm/mach-loongson1/war.h deleted +0 -0
deleted file mode 100644
index 8fb50d0..0000000
arch/mips/include/asm/mach-netlogic/war.h deleted +0 -0
deleted file mode 100644
index 2c72168..0000000
arch/mips/include/asm/mach-paravirt/war.h deleted +0 -0
deleted file mode 100644
index 36d3afb..0000000
arch/mips/include/asm/mach-pnx833x/war.h deleted +0 -0
deleted file mode 100644
index e410df4..0000000
arch/mips/include/asm/mach-tx39xx/war.h deleted +0 -0
deleted file mode 100644
index 6a52e65..0000000
arch/mips/include/asm/mach-vr41xx/war.h deleted +0 -0
deleted file mode 100644
index ffe31e7..0000000
Signature · 1 line
2.1.1
#3 lore raw

PATCH v5 3/23 MIPS: bcm3384: Rename "bcm3384" target to "bmips"

In reply to Kevin Cernekee

This platform is configured primarily through device tree, and we can reuse the same code to support a bunch of other chips. Change the name to reflect this.

---
 arch/mips/Kbuild.platforms                                   |  2 +-
 arch/mips/Kconfig                                            | 12 ++++++------
 arch/mips/bcm3384/Platform                                   |  7 -------
 arch/mips/{bcm3384 => bmips}/Makefile                        |  0
 arch/mips/bmips/Platform                                     |  7 +++++++
 arch/mips/{bcm3384 => bmips}/dma.c                           |  0
 arch/mips/{bcm3384 => bmips}/irq.c                           |  0
 arch/mips/{bcm3384 => bmips}/setup.c                         |  2 +-
 arch/mips/boot/dts/Makefile                                  |  2 +-
 arch/mips/configs/{bcm3384_defconfig => bmips_be_defconfig}  |  2 +-
 .../include/asm/{mach-bcm3384 => mach-bmips}/dma-coherence.h |  6 +++---
 11 files changed, 20 insertions(+), 20 deletions(-)
 delete mode 100644 arch/mips/bcm3384/Platform
 rename arch/mips/{bcm3384 => bmips}/Makefile (100%)
 create mode 100644 arch/mips/bmips/Platform
 rename arch/mips/{bcm3384 => bmips}/dma.c (100%)
 rename arch/mips/{bcm3384 => bmips}/irq.c (100%)
 rename arch/mips/{bcm3384 => bmips}/setup.c (98%)
 rename arch/mips/configs/{bcm3384_defconfig => bmips_be_defconfig} (98%)
 rename arch/mips/include/asm/{mach-bcm3384 => mach-bmips}/dma-coherence.h (90%)
arch/mips/Kbuild.platforms +1 -1
index e5fc463..a4d1e4f 100644
@@ -4,9 +4,9 @@ platforms += alchemy
 platforms += ar7
 platforms += ath25
 platforms += ath79
-platforms += bcm3384
 platforms += bcm47xx
 platforms += bcm63xx
+platforms += bmips
 platforms += cavium-octeon
 platforms += cobalt
 platforms += dec
arch/mips/Kconfig +6 -6
index 3289969..31bbec0 100644
@@ -130,8 +130,8 @@ config ATH79
 	help
 	  Support for the Atheros AR71XX/AR724X/AR913X SoCs.
 
-config BCM3384
-	bool "Broadcom BCM3384 based boards"
+config BMIPS_GENERIC
+	bool "Broadcom Generic BMIPS kernel"
 	select BOOT_RAW
 	select NO_EXCEPT_FILL
 	select USE_OF
@@ -151,10 +151,10 @@ config BCM3384
 	select USB_OHCI_BIG_ENDIAN_DESC
 	select USB_OHCI_BIG_ENDIAN_MMIO
 	help
-	  Support for BCM3384 based boards.  BCM3384/BCM33843 is a cable modem
-	  chipset with a Linux application processor that is often used to
-	  provide Samba services, a CUPS print server, and/or advanced routing
-	  features.
+	  Build a generic DT-based kernel image that boots on select
+	  BCM33xx cable modem chips, BCM63xx DSL chips, and BCM7xxx set-top
+	  box chips.  Note that CONFIG_CPU_BIG_ENDIAN/CONFIG_CPU_LITTLE_ENDIAN
+	  must be set appropriately for your board.
 
 config BCM47XX
 	bool "Broadcom BCM47XX based boards"
arch/mips/bcm3384/Platform deleted +0 -0
deleted file mode 100644
index 8e1ca08..0000000
arch/mips/bmips/Makefile renamed from arch/mips/bcm3384/Makefile +0 -0
similarity index 100%
rename from arch/mips/bcm3384/Makefile
rename to arch/mips/bmips/Makefile
arch/mips/bmips/Platform new file +7 -0
new file mode 100644
index 0000000..5f127fd
@@ -0,0 +1,7 @@
+#
+# Broadcom Generic BMIPS kernel
+#
+platform-$(CONFIG_BMIPS_GENERIC)	+= bmips/
+cflags-$(CONFIG_BMIPS_GENERIC)		+=				\
+		-I$(srctree)/arch/mips/include/asm/mach-bmips/
+load-$(CONFIG_BMIPS_GENERIC)		:= 0xffffffff80010000
arch/mips/bmips/dma.c renamed from arch/mips/bcm3384/dma.c +0 -0
similarity index 100%
rename from arch/mips/bcm3384/dma.c
rename to arch/mips/bmips/dma.c
arch/mips/bmips/irq.c renamed from arch/mips/bcm3384/irq.c +0 -0
similarity index 100%
rename from arch/mips/bcm3384/irq.c
rename to arch/mips/bmips/irq.c
arch/mips/bmips/setup.c renamed from arch/mips/bcm3384/setup.c +1 -1
similarity index 98%
rename from arch/mips/bcm3384/setup.c
rename to arch/mips/bmips/setup.c
index d84b840..5099109 100644
@@ -33,7 +33,7 @@ void __init prom_free_prom_memory(void)
 
 const char *get_system_type(void)
 {
-	return "BCM3384";
+	return "Generic BMIPS kernel";
 }
 
 void __init plat_time_init(void)
arch/mips/boot/dts/Makefile +1 -1
index 4f49fa4..18d9999 100644
@@ -1,4 +1,4 @@
-dtb-$(CONFIG_BCM3384)			+= bcm93384wvg.dtb
+dtb-$(CONFIG_BMIPS_GENERIC)		+= bcm93384wvg.dtb
 dtb-$(CONFIG_CAVIUM_OCTEON_SOC)		+= octeon_3xxx.dtb octeon_68xx.dtb
 dtb-$(CONFIG_DT_EASY50712)		+= easy50712.dtb
 dtb-$(CONFIG_DT_XLP_EVP)		+= xlp_evp.dtb
arch/mips/configs/bmips_be_defconfig renamed from arch/mips/configs/bcm3384_defconfig +1 -1
similarity index 98%
rename from arch/mips/configs/bcm3384_defconfig
rename to arch/mips/configs/bmips_be_defconfig
index 88711c2..36af5af 100644
@@ -1,4 +1,4 @@
-CONFIG_BCM3384=y
+CONFIG_BMIPS_GENERIC=y
 CONFIG_HIGHMEM=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=4
arch/mips/include/asm/mach-bmips/dma-coherence.h renamed from arch/mips/include/asm/mach-bcm3384/dma-coherence.h +3 -3
similarity index 90%
rename from arch/mips/include/asm/mach-bcm3384/dma-coherence.h
rename to arch/mips/include/asm/mach-bmips/dma-coherence.h
index a3be8e5..65e95b0 100644
@@ -12,8 +12,8 @@
  * GNU General Public License for more details.
  */
 
-#ifndef __ASM_MACH_BCM3384_DMA_COHERENCE_H
-#define __ASM_MACH_BCM3384_DMA_COHERENCE_H
+#ifndef __ASM_MACH_BMIPS_DMA_COHERENCE_H
+#define __ASM_MACH_BMIPS_DMA_COHERENCE_H
 
 struct device;
 
@@ -45,4 +45,4 @@ static inline int plat_device_is_coherent(struct device *dev)
 	return 0;
 }
 
-#endif /* __ASM_MACH_BCM3384_DMA_COHERENCE_H */
+#endif /* __ASM_MACH_BMIPS_DMA_COHERENCE_H */
Signature · 1 line
2.1.1
#4 lore raw

PATCH v5 4/23 irqchip: Update docs regarding irq_domain_add_tree()

In reply to Kevin Cernekee

Several drivers now use this API, including the ARM GIC driver, so remove the outdated comment.

---
 Documentation/IRQ-domain.txt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Documentation/IRQ-domain.txt +1 -2
index 39cfa72..3a8e15c 100644
@@ -95,8 +95,7 @@ since it doesn't need to allocate a table as large as the largest
 hwirq number.  The disadvantage is that hwirq to IRQ number lookup is
 dependent on how many entries are in the table.
 
-Very few drivers should need this mapping.  At the moment, powerpc
-iseries is the only user.
+Very few drivers should need this mapping.
 
 ==== No Map ===-
 irq_domain_add_nomap()
Signature · 1 line
2.1.1
#5 lore raw

PATCH v5 5/23 irqchip: brcmstb-l2: don't clear wakeable interrupts at init time

In reply to Kevin Cernekee

From: Brian Norris <[email protected]>

Wakeable interrupts might be pending at boot/init time, because wakeup interrupts might have triggered a resume from S5. So don't clear such wakeups.

This means that any driver which requests a wakeable interrupt bit should be prepared to handle an interrupt as soon as they call request_irq(). (This is technically already the correct development practice, but some drivers probably expect not to receive interrupts until they have performed some I/O.)

---
 drivers/irqchip/irq-brcmstb-l2.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/irqchip/irq-brcmstb-l2.c +6 -3
index 313c2c6..d6bcc6b 100644
@@ -136,7 +136,11 @@ int __init brcmstb_l2_intc_of_init(struct device_node *np,
 
 	/* Disable all interrupts by default */
 	writel(0xffffffff, data->base + CPU_MASK_SET);
-	writel(0xffffffff, data->base + CPU_CLEAR);
+
+	/* Wakeup interrupts may be retained from S5 (cold boot) */
+	data->can_wake = of_property_read_bool(np, "brcm,irq-can-wake");
+	if (!data->can_wake)
+		writel(0xffffffff, data->base + CPU_CLEAR);
 
 	data->parent_irq = irq_of_parse_and_map(np, 0);
 	if (!data->parent_irq) {
@@ -188,8 +192,7 @@ int __init brcmstb_l2_intc_of_init(struct device_node *np,
 	ct->chip.irq_suspend = brcmstb_l2_intc_suspend;
 	ct->chip.irq_resume = brcmstb_l2_intc_resume;
 
-	if (of_property_read_bool(np, "brcm,irq-can-wake")) {
-		data->can_wake = true;
+	if (data->can_wake) {
 		/* This IRQ chip can wake the system, set all child interrupts
 		 * in wake_enabled mask
 		 */
Signature · 1 line
2.1.1
#6 lore raw

PATCH v5 6/23 irqchip: bcm7120-l2: Refactor driver for arbitrary IRQEN/IRQSTAT offsets

In reply to Kevin Cernekee

Currently the driver assumes that REG_BASE+0x00 is the IRQ enable mask, and REG_BASE+0x04 is the IRQ status mask. This is true on BCM3384 and BCM7xxx, but it is not true for some of the controllers found on BCM63xx chips. So we will change a couple of key assumptions:

- Don't assume that both the IRQEN and IRQSTAT registers will be covered by a single ioremap() operation.

- Don't assume any particular ordering (IRQSTAT might show up before IRQEN on some chips).

- For an L2 controller with >=64 IRQs, don't assume that every IRQEN/IRQSTAT pair will use the same register spacing.

This patch changes the "plumbing" but doesn't yet provide a way for users to instantiate a controller with arbitrary IRQEN/IRQSTAT offsets.

---
 drivers/irqchip/irq-bcm7120-l2.c | 41 +++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)
drivers/irqchip/irq-bcm7120-l2.c +28 -13
index 8eec8e1..e8441ee 100644
@@ -34,11 +34,15 @@
 #define IRQSTAT		0x04
 
 #define MAX_WORDS	4
+#define MAX_MAPPINGS	MAX_WORDS
 #define IRQS_PER_WORD	32
 
 struct bcm7120_l2_intc_data {
 	unsigned int n_words;
-	void __iomem *base[MAX_WORDS];
+	void __iomem *map_base[MAX_MAPPINGS];
+	void __iomem *pair_base[MAX_WORDS];
+	int en_offset[MAX_WORDS];
+	int stat_offset[MAX_WORDS];
 	struct irq_domain *domain;
 	bool can_wake;
 	u32 irq_fwd_mask[MAX_WORDS];
@@ -61,7 +65,8 @@ static void bcm7120_l2_intc_irq_handle(unsigned int irq, struct irq_desc *desc)
 		int hwirq;
 
 		irq_gc_lock(gc);
-		pending = irq_reg_readl(gc, IRQSTAT) & gc->mask_cache;
+		pending = irq_reg_readl(gc, b->stat_offset[idx]) &
+					    gc->mask_cache;
 		irq_gc_unlock(gc);
 
 		for_each_set_bit(hwirq, &pending, IRQS_PER_WORD) {
@@ -76,21 +81,24 @@ static void bcm7120_l2_intc_irq_handle(unsigned int irq, struct irq_desc *desc)
 static void bcm7120_l2_intc_suspend(struct irq_data *d)
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct irq_chip_type *ct = irq_data_get_chip_type(d);
 	struct bcm7120_l2_intc_data *b = gc->private;
 
 	irq_gc_lock(gc);
 	if (b->can_wake)
-		irq_reg_writel(gc, gc->mask_cache | gc->wake_active, IRQEN);
+		irq_reg_writel(gc, gc->mask_cache | gc->wake_active,
+			       ct->regs.mask);
 	irq_gc_unlock(gc);
 }
 
 static void bcm7120_l2_intc_resume(struct irq_data *d)
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct irq_chip_type *ct = irq_data_get_chip_type(d);
 
 	/* Restore the saved mask */
 	irq_gc_lock(gc);
-	irq_reg_writel(gc, gc->mask_cache, IRQEN);
+	irq_reg_writel(gc, gc->mask_cache, ct->regs.mask);
 	irq_gc_unlock(gc);
 }
 
@@ -137,9 +145,14 @@ int __init bcm7120_l2_intc_of_init(struct device_node *dn,
 		return -ENOMEM;
 
 	for (idx = 0; idx < MAX_WORDS; idx++) {
-		data->base[idx] = of_iomap(dn, idx);
-		if (!data->base[idx])
+		data->map_base[idx] = of_iomap(dn, idx);
+		if (!data->map_base[idx])
 			break;
+
+		data->pair_base[idx] = data->map_base[idx];
+		data->en_offset[idx] = IRQEN;
+		data->stat_offset[idx] = IRQSTAT;
+
 		data->n_words = idx + 1;
 	}
 	if (!data->n_words) {
@@ -157,7 +170,8 @@ int __init bcm7120_l2_intc_of_init(struct device_node *dn,
 	if (ret == 0 || ret == -EINVAL) {
 		for (idx = 0; idx < data->n_words; idx++)
 			__raw_writel(data->irq_fwd_mask[idx],
-				     data->base[idx] + IRQEN);
+				     data->pair_base[idx] +
+				     data->en_offset[idx]);
 	} else {
 		/* property exists but has the wrong number of words */
 		pr_err("invalid int-fwd-mask property\n");
@@ -215,11 +229,12 @@ int __init bcm7120_l2_intc_of_init(struct device_node *dn,
 		gc = irq_get_domain_generic_chip(data->domain, irq);
 
 		gc->unused = 0xffffffff & ~data->irq_map_mask[idx];
-		gc->reg_base = data->base[idx];
 		gc->private = data;
 		ct = gc->chip_types;
 
-		ct->regs.mask = IRQEN;
+		gc->reg_base = data->pair_base[idx];
+		ct->regs.mask = data->en_offset[idx];
+
 		ct->chip.irq_mask = irq_gc_mask_clr_bit;
 		ct->chip.irq_unmask = irq_gc_mask_set_bit;
 		ct->chip.irq_ack = irq_gc_noop;
@@ -237,16 +252,16 @@ int __init bcm7120_l2_intc_of_init(struct device_node *dn,
 	}
 
 	pr_info("registered BCM7120 L2 intc (mem: 0x%p, parent IRQ(s): %d)\n",
-			data->base[0], num_parent_irqs);
+			data->map_base[0], num_parent_irqs);
 
 	return 0;
 
 out_free_domain:
 	irq_domain_remove(data->domain);
 out_unmap:
-	for (idx = 0; idx < MAX_WORDS; idx++) {
-		if (data->base[idx])
-			iounmap(data->base[idx]);
+	for (idx = 0; idx < MAX_MAPPINGS; idx++) {
+		if (data->map_base[idx])
+			iounmap(data->map_base[idx]);
 	}
 	kfree(data);
 	return ret;
Signature · 1 line
2.1.1
#7 lore raw

PATCH v5 7/23 irqchip: bcm7120-l2: Split STB-specific logic into its own function

In reply to Kevin Cernekee

The BCM7xxx instances of this block (listed in the register manual as simply "IRQ0") all have the following items in common:

- brcm,int-map-mask: for routing different bits in the L2 to different parent IRQs

- brcm,int-fwd-mask: for hardwiring certain IRQs to bypass the L2 and use dedicated L1 lines

- one enable/status pair (32 bits only)

Much of the driver code can be shared with BCM3380-style controllers, but in order to do this cleanly, let's split out the BCM7xxx-specific logic first.

---
 .../interrupt-controller/brcm,bcm7120-l2-intc.txt  |  12 +-
 drivers/irqchip/irq-bcm7120-l2.c                   | 123 ++++++++++++---------
 2 files changed, 71 insertions(+), 64 deletions(-)
Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7120-l2-intc.txt +3 -9
index bae1f21..44a9bb1 100644
@@ -13,8 +13,7 @@ Such an interrupt controller has the following hardware design:
   or if they will output an interrupt signal at this 2nd level interrupt
   controller, in particular for UARTs
 
-- typically has one 32-bit enable word and one 32-bit status word, but on
-  some hardware may have more than one enable/status pair
+- has one 32-bit enable word and one 32-bit status word
 
 - no atomic set/clear operations
 
@@ -53,9 +52,7 @@ The typical hardware layout for this controller is represented below:
 Required properties:
 
 - compatible: should be "brcm,bcm7120-l2-intc"
-- reg: specifies the base physical address and size of the registers;
-  multiple pairs may be specified, with the first pair handling IRQ offsets
-  0..31 and the second pair handling 32..63
+- reg: specifies the base physical address and size of the registers
 - interrupt-controller: identifies the node as an interrupt controller
 - #interrupt-cells: specifies the number of cells needed to encode an interrupt
   source, should be 1.
@@ -66,10 +63,7 @@ Required properties:
 - brcm,int-map-mask: 32-bits bit mask describing how many and which interrupts
   are wired to this 2nd level interrupt controller, and how they match their
   respective interrupt parents. Should match exactly the number of interrupts
-  specified in the 'interrupts' property, multiplied by the number of
-  enable/status register pairs implemented by this controller.  For
-  multiple parent IRQs with multiple enable/status words, this looks like:
-  <irq0_w0 irq0_w1 irq1_w0 irq1_w1 ...>
+  specified in the 'interrupts' property.
 
 Optional properties:
 
drivers/irqchip/irq-bcm7120-l2.c +68 -55

182 lines not on this page · raw message

Signature · 1 line
2.1.1
#8 lore raw

PATCH v5 8/23 irqchip: bcm7120-l2: Add support for BCM3380-style controllers

In reply to Kevin Cernekee

These controllers support multiple enable/status pairs (64+ IRQs), can put the enable/status words at different offsets, and do not support multiple parent IRQs.

---
 .../interrupt-controller/brcm,bcm3380-l2-intc.txt  | 41 ++++++++++++++++
 drivers/irqchip/irq-bcm7120-l2.c                   | 55 ++++++++++++++++++++--
 2 files changed, 92 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm3380-l2-intc.txt
Documentation/devicetree/bindings/interrupt-controller/brcm,bcm3380-l2-intc.txt new file +41 -0
new file mode 100644
index 0000000..8f48aad
@@ -0,0 +1,41 @@
+Broadcom BCM3380-style Level 1 / Level 2 interrupt controller
+
+This interrupt controller shows up in various forms on many BCM338x/BCM63xx
+chipsets.  It has the following properties:
+
+- outputs a single interrupt signal to its interrupt controller parent
+
+- contains one or more enable/status word pairs, which often appear at
+  different offsets in different blocks
+
+- no atomic set/clear operations
+
+Required properties:
+
+- compatible: should be "brcm,bcm3380-l2-intc"
+- reg: specifies one or more enable/status pairs, in the following format:
+  <enable_reg 0x4 status_reg 0x4>...
+- interrupt-controller: identifies the node as an interrupt controller
+- #interrupt-cells: specifies the number of cells needed to encode an interrupt
+  source, should be 1.
+- interrupt-parent: specifies the phandle to the parent interrupt controller
+  this one is cascaded from
+- interrupts: specifies the interrupt line in the interrupt-parent controller
+  node, valid values depend on the type of parent interrupt controller
+
+Optional properties:
+
+- brcm,irq-can-wake: if present, this means the L2 controller can be used as a
+  wakeup source for system suspend/resume.
+
+Example:
+
+irq0_intc: interrupt-controller@10000020 {
+	compatible = "brcm,bcm3380-l2-intc";
+	reg = <0x10000024 0x4 0x1000002c 0x4>,
+	      <0x10000020 0x4 0x10000028 0x4>;
+	interrupt-controller;
+	#interrupt-cells = <1>;
+	interrupt-parent = <&cpu_intc>;
+	interrupts = <2>;
+};
drivers/irqchip/irq-bcm7120-l2.c +51 -4

78 lines not on this page · raw message

Signature · 1 line
2.1.1
#9 lore raw

PATCH v5 9/23 irqchip: Add new driver for BCM7038-style level 1 interrupt controllers

In reply to Kevin Cernekee

This is the main peripheral IRQ controller on the BCM7xxx MIPS chips; it has the following characteristics:

- 64 to 160+ level IRQs
- Atomic set/clear registers
- Reasonably predictable register layout (N status words, then N mask status words, then N mask set words, then N mask clear words)
- SMP affinity supported on most systems
- Typically connected to MIPS IRQ 2,3,2,3 on CPUs 0,1,2,3

This driver registers one IRQ domain and one IRQ chip to cover all instances of the block. Up to 4 instances of the block may appear, as it supports 4-way IRQ affinity on BCM7435.

The same block exists on the ARM BCM7xxx chips, but typically the ARM GIC is used instead. So this driver is primarily intended for MIPS STB chips.

---
 .../interrupt-controller/brcm,bcm7038-l1-intc.txt  |  52 ++++
 drivers/irqchip/Kconfig                            |   5 +
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-bcm7038-l1.c                   | 335 +++++++++++++++++++++
 4 files changed, 393 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
 create mode 100644 drivers/irqchip/irq-bcm7038-l1.c
Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt new file +52 -0
new file mode 100644
index 0000000..cc217b2
@@ -0,0 +1,52 @@
+Broadcom BCM7038-style Level 1 interrupt controller
+
+This block is a first level interrupt controller that is typically connected
+directly to one of the HW INT lines on each CPU.  Every BCM7xxx set-top chip
+since BCM7038 has contained this hardware.
+
+Key elements of the hardware design include:
+
+- 64, 96, 128, or 160 incoming level IRQ lines
+
+- Most onchip peripherals are wired directly to an L1 input
+
+- A separate instance of the register set for each CPU, allowing individual
+  peripheral IRQs to be routed to any CPU
+
+- Atomic mask/unmask operations
+
+- No polarity/level/edge settings
+
+- No FIFO or priority encoder logic; software is expected to read all
+  2-5 status words to determine which IRQs are pending
+
+Required properties:
+
+- compatible: should be "brcm,bcm7038-l1-intc"
+- reg: specifies the base physical address and size of the registers;
+  the number of supported IRQs is inferred from the size argument
+- interrupt-controller: identifies the node as an interrupt controller
+- #interrupt-cells: specifies the number of cells needed to encode an interrupt
+  source, should be 1.
+- interrupt-parent: specifies the phandle to the parent interrupt controller(s)
+  this one is cascaded from
+- interrupts: specifies the interrupt line(s) in the interrupt-parent controller
+  node; valid values depend on the type of parent interrupt controller
+
+If multiple reg ranges and interrupt-parent entries are present on an SMP
+system, the driver will allow IRQ SMP affinity to be set up through the
+/proc/irq/ interface.  In the simplest possible configuration, only one
+reg range and one interrupt-parent is needed.
+
+Example:
+
+periph_intc: periph_intc@1041a400 {
+        compatible = "brcm,bcm7038-l1-intc";
+        reg = <0x1041a400 0x30 0x1041a600 0x30>;
+
+        interrupt-controller;
+        #interrupt-cells = <1>;
+
+        interrupt-parent = <&cpu_intc>;
+        interrupts = <2>, <3>;
+};
drivers/irqchip/Kconfig +5 -0
index e12cb23..2ffa66a 100644
@@ -48,6 +48,11 @@ config ATMEL_AIC5_IRQ
 	select MULTI_IRQ_HANDLER
 	select SPARSE_IRQ
 
+config BCM7038_L1_IRQ
+	bool
+	select GENERIC_IRQ_CHIP
+	select IRQ_DOMAIN
+
 config BCM7120_L2_IRQ
 	bool
 	select GENERIC_IRQ_CHIP
drivers/irqchip/Makefile +1 -0
index 4954a31..446ae7a 100644
@@ -35,6 +35,7 @@ obj-$(CONFIG_TB10X_IRQC)		+= irq-tb10x.o
 obj-$(CONFIG_XTENSA)			+= irq-xtensa-pic.o
 obj-$(CONFIG_XTENSA_MX)			+= irq-xtensa-mx.o
 obj-$(CONFIG_IRQ_CROSSBAR)		+= irq-crossbar.o
+obj-$(CONFIG_BCM7038_L1_IRQ)		+= irq-bcm7038-l1.o
 obj-$(CONFIG_BCM7120_L2_IRQ)		+= irq-bcm7120-l2.o
 obj-$(CONFIG_BRCMSTB_L2_IRQ)		+= irq-brcmstb-l2.o
 obj-$(CONFIG_KEYSTONE_IRQ)		+= irq-keystone.o
drivers/irqchip/irq-bcm7038-l1.c new file +335 -0

335 lines not on this page · raw message

Signature · 1 line
2.1.1
#10 lore raw

PATCH v5 10/23 MIPS: Let __dt_register_buses accept a single bus type

In reply to Kevin Cernekee

Some machines only have one bus type to register (e.g. "simple-bus").

---
 arch/mips/kernel/prom.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/mips/kernel/prom.c +4 -1
index 452d435..e303cb1 100644
@@ -64,7 +64,10 @@ int __init __dt_register_buses(const char *bus0, const char *bus1)
 		panic("device tree not present");
 
 	strlcpy(of_ids[0].compatible, bus0, sizeof(of_ids[0].compatible));
-	strlcpy(of_ids[1].compatible, bus1, sizeof(of_ids[1].compatible));
+	if (bus1) {
+		strlcpy(of_ids[1].compatible, bus1,
+			sizeof(of_ids[1].compatible));
+	}
 
 	if (of_platform_populate(NULL, of_ids, NULL, NULL))
 		panic("failed to populate DT");
Signature · 1 line
2.1.1
#11 lore raw

PATCH v5 11/23 MIPS: Fall back to the generic restart notifier

In reply to Kevin Cernekee

If the machine doesn't set its own _machine_restart callback, call the common do_kernel_restart() instead. This allows arch-independent reset drivers from drivers/power/reset/ to be used to reboot the machine.

---
 arch/mips/kernel/reset.c | 2 ++
 1 file changed, 2 insertions(+)
arch/mips/kernel/reset.c +2 -0
index 07fc524..cf23ab5 100644
@@ -29,6 +29,8 @@ void machine_restart(char *command)
 {
 	if (_machine_restart)
 		_machine_restart(command);
+	else
+		do_kernel_restart(command);
 }
 
 void machine_halt(void)
Signature · 1 line
2.1.1
#12 lore raw

PATCH v5 12/23 MIPS: Reorder MIPS_L1_CACHE_SHIFT priorities

In reply to Kevin Cernekee

Enabling support for more than one BMIPS CPU in the same build may result in different L1_CACHE_SHIFT values, e.g.

    CPU_BMIPS5000 selects MIPS_L1_CACHE_SHIFT_7
    CPU_BMIPS4380 selects MIPS_L1_CACHE_SHIFT_6
    anything else defaults to MIPS_L1_CACHE_SHIFT_5

Ensure that if more than one MIPS_L1_CACHE_SHIFT_x option is selected, Kconfig sets CONFIG_MIPS_L1_CACHE_SHIFT to the highest value.

---
 arch/mips/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/Kconfig +3 -3
index 31bbec0..d28c29e 100644
@@ -1193,10 +1193,10 @@ config MIPS_L1_CACHE_SHIFT_7
 
 config MIPS_L1_CACHE_SHIFT
 	int
-	default "4" if MIPS_L1_CACHE_SHIFT_4
-	default "5" if MIPS_L1_CACHE_SHIFT_5
-	default "6" if MIPS_L1_CACHE_SHIFT_6
 	default "7" if MIPS_L1_CACHE_SHIFT_7
+	default "6" if MIPS_L1_CACHE_SHIFT_6
+	default "5" if MIPS_L1_CACHE_SHIFT_5
+	default "4" if MIPS_L1_CACHE_SHIFT_4
 	default "5"
 
 config HAVE_STD_PC_SERIAL_PORT
Signature · 1 line
2.1.1
#13 lore raw

PATCH v5 13/23 MIPS: BMIPS: Flush the readahead cache after DMA

In reply to Kevin Cernekee

BMIPS 3300/435x/438x CPUs have a readahead cache that is separate from the L1/L2. During a DMA operation, accesses adjacent to a DMA buffer may cause parts of the DMA buffer to be prefetched into the RAC. To avoid possible coherency problems, flush the RAC upon DMA completion.

---
 arch/mips/mm/dma-default.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/mips/mm/dma-default.c +13 -0
index af5f046..ee6d12c 100644
@@ -18,6 +18,7 @@
 #include <linux/highmem.h>
 #include <linux/dma-contiguous.h>
 
+#include <asm/bmips.h>
 #include <asm/cache.h>
 #include <asm/cpu-type.h>
 #include <asm/io.h>
@@ -69,6 +70,18 @@ static inline struct page *dma_addr_to_page(struct device *dev,
  */
 static inline int cpu_needs_post_dma_flush(struct device *dev)
 {
+	if (boot_cpu_type() == CPU_BMIPS3300 ||
+	    boot_cpu_type() == CPU_BMIPS4350 ||
+	    boot_cpu_type() == CPU_BMIPS4380) {
+		void __iomem *cbr = BMIPS_GET_CBR();
+
+		/* Flush stale data out of the readahead cache */
+		__raw_writel(0x100, cbr + BMIPS_RAC_CONFIG);
+		__raw_readl(cbr + BMIPS_RAC_CONFIG);
+
+		return 0;
+	}
+
 	return !plat_device_is_coherent(dev) &&
 	       (boot_cpu_type() == CPU_R10000 ||
 		boot_cpu_type() == CPU_R12000 ||
Signature · 1 line
2.1.1
#19 lore raw

PATCH v5 14/23 MIPS: BMIPS: Document the firmware->kernel DTB interface

In reply to Kevin Cernekee

Add a new section covering the Generic BMIPS machine type.

---
 Documentation/devicetree/booting-without-of.txt | 28 +++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
Documentation/devicetree/booting-without-of.txt +28 -0
index 7768518..e49e423 100644
@@ -15,6 +15,7 @@ Table of Contents
     1) Entry point for arch/arm
     2) Entry point for arch/powerpc
     3) Entry point for arch/x86
+    4) Entry point for arch/mips/bmips
 
   II - The DT block format
     1) Header
@@ -288,6 +289,33 @@ it with special cases.
   or initrd address. It simply holds information which can not be retrieved
   otherwise like interrupt routing or a list of devices behind an I2C bus.
 
+4) Entry point for arch/mips/bmips
+----------------------------------
+
+  Some bootloaders only support a single entry point, at the start of the
+  kernel image.  Other bootloaders will jump to the ELF start address.
+  Both schemes are supported; CONFIG_BOOT_RAW=y and CONFIG_NO_EXCEPT_FILL=y,
+  so the first instruction immediately jumps to kernel_entry().
+
+  Similar to the arch/arm case (b), a DT-aware bootloader is expected to
+  set up the following registers:
+
+         a0 : 0
+
+         a1 : 0xffffffff
+
+         a2 : Physical pointer to the device tree block (defined in chapter
+         II) in RAM.  The device tree can be located anywhere in the first
+         512MB of the physical address space (0x00000000 - 0x1fffffff),
+         aligned on a 64 bit boundary.
+
+  Legacy bootloaders do not use this convention, and they do not pass in a
+  DT block.  In this case, Linux will look for a builtin DTB, selected via
+  CONFIG_DT_*.
+
+  This convention is defined for 32-bit systems only, as there are not
+  currently any 64-bit BMIPS implementations.
+
 II - The DT block format
 ========================
 
Signature · 1 line
2.1.1
#20 lore raw

PATCH v5 15/23 MIPS: BMIPS: Rewrite DMA code to use "dma-ranges" property

In reply to Kevin Cernekee

This is a more standardized way of handling DMA remapping, and it is suitable for the memory map found on BCM3384.

---
 arch/mips/bmips/dma.c | 100 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 68 insertions(+), 32 deletions(-)
arch/mips/bmips/dma.c +68 -32
index ea42012..04790f4 100644
@@ -6,76 +6,112 @@
  * Copyright (C) 2014 Kevin Cernekee <[email protected]>
  */
 
+#define pr_fmt(fmt)		"bmips-dma: " fmt
+
 #include <linux/device.h>
 #include <linux/dma-direction.h>
 #include <linux/dma-mapping.h>
 #include <linux/init.h>
-#include <linux/mm.h>
+#include <linux/io.h>
 #include <linux/of.h>
-#include <linux/pci.h>
+#include <linux/printk.h>
+#include <linux/slab.h>
 #include <linux/types.h>
 #include <dma-coherence.h>
 
 /*
- * BCM3384 has configurable address translation windows which allow the
+ * BCM338x has configurable address translation windows which allow the
  * peripherals' DMA addresses to be different from the Zephyr-visible
  * physical addresses.  e.g. usb_dma_addr = zephyr_pa ^ 0x08000000
  *
- * If our DT "memory" node has a "dma-xor-mask" property we will enable this
- * translation using the provided offset.
+ * If the "brcm,ubus" node has a "dma-ranges" property we will enable this
+ * translation globally using the provided information.  This implements a
+ * very limited subset of "dma-ranges" support and it will probably be
+ * replaced by a more generic version later.
  */
-static u32 bcm3384_dma_xor_mask;
-static u32 bcm3384_dma_xor_limit = 0xffffffff;
 
-/*
- * PCI collapses the memory hole at 0x10000000 - 0x1fffffff.
- * On systems with a dma-xor-mask, this range is guaranteed to live above
- * the dma-xor-limit.
- */
-#define BCM3384_MEM_HOLE_PA	0x10000000
-#define BCM3384_MEM_HOLE_SIZE	0x10000000
+struct bmips_dma_range {
+	u32			child_addr;
+	u32			parent_addr;
+	u32			size;
+};
 
-static dma_addr_t bcm3384_phys_to_dma(struct device *dev, phys_addr_t pa)
+static struct bmips_dma_range *bmips_dma_ranges;
+
+#define FLUSH_RAC		0x100
+
+static dma_addr_t bmips_phys_to_dma(struct device *dev, phys_addr_t pa)
 {
-	if (dev && dev_is_pci(dev) &&
-	    pa >= (BCM3384_MEM_HOLE_PA + BCM3384_MEM_HOLE_SIZE))
-		return pa - BCM3384_MEM_HOLE_SIZE;
-	if (pa <= bcm3384_dma_xor_limit)
-		return pa ^ bcm3384_dma_xor_mask;
+	struct bmips_dma_range *r;
+
+	for (r = bmips_dma_ranges; r && r->size; r++) {
+		if (pa >= r->child_addr &&
+		    pa < (r->child_addr + r->size))
+			return pa - r->child_addr + r->parent_addr;
+	}
 	return pa;
 }
 
 dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size)
 {
-	return bcm3384_phys_to_dma(dev, virt_to_phys(addr));
+	return bmips_phys_to_dma(dev, virt_to_phys(addr));
 }
 
 dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
 {
-	return bcm3384_phys_to_dma(dev, page_to_phys(page));
+	return bmips_phys_to_dma(dev, page_to_phys(page));
 }
 
 unsigned long plat_dma_addr_to_phys(struct device *dev, dma_addr_t dma_addr)
 {
-	if (dev && dev_is_pci(dev) &&
-	    dma_addr >= BCM3384_MEM_HOLE_PA)
-		return dma_addr + BCM3384_MEM_HOLE_SIZE;
-	if ((dma_addr ^ bcm3384_dma_xor_mask) <= bcm3384_dma_xor_limit)
-		return dma_addr ^ bcm3384_dma_xor_mask;
+	struct bmips_dma_range *r;
+
+	for (r = bmips_dma_ranges; r && r->size; r++) {
+		if (dma_addr >= r->parent_addr &&
+		    dma_addr < (r->parent_addr + r->size))
+			return dma_addr - r->parent_addr + r->child_addr;
+	}
 	return dma_addr;
 }
 
-static int __init bcm3384_init_dma_xor(void)
+static int __init bmips_init_dma_ranges(void)
 {
-	struct device_node *np = of_find_node_by_type(NULL, "memory");
+	struct device_node *np =
+		of_find_compatible_node(NULL, NULL, "brcm,ubus");
+	const __be32 *data;
+	struct bmips_dma_range *r;
+	int len;
 
 	if (!np)
 		return 0;
 
-	of_property_read_u32(np, "dma-xor-mask", &bcm3384_dma_xor_mask);
-	of_property_read_u32(np, "dma-xor-limit", &bcm3384_dma_xor_limit);
+	data = of_get_property(np, "dma-ranges", &len);
+	if (!data)
+		goto out_good;
+
+	len /= sizeof(*data) * 3;
+	if (!len)
+		goto out_bad;
+
+	/* add a dummy (zero) entry at the end as a sentinel */
+	bmips_dma_ranges = kzalloc(sizeof(struct bmips_dma_range) * (len + 1),
+				   GFP_KERNEL);
+	if (!bmips_dma_ranges)
+		goto out_bad;
 
+	for (r = bmips_dma_ranges; len; len--, r++) {
+		r->child_addr = be32_to_cpup(data++);
+		r->parent_addr = be32_to_cpup(data++);
+		r->size = be32_to_cpup(data++);
+	}
+
+out_good:
 	of_node_put(np);
 	return 0;
+
+out_bad:
+	pr_err("error parsing dma-ranges property\n");
+	of_node_put(np);
+	return -EINVAL;
 }
-arch_initcall(bcm3384_init_dma_xor);
+arch_initcall(bmips_init_dma_ranges);
Signature · 1 line
2.1.1
#21 lore raw

PATCH v5 16/23 MIPS: BMIPS: Remove bogus bus name

In reply to Kevin Cernekee

There is no "bcm3384" bus so let's just remove it to avoid confusion.

---
 arch/mips/bmips/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/bmips/setup.c +1 -1
index 5099109..ac402ed 100644
@@ -83,7 +83,7 @@ void __init device_tree_init(void)
 
 int __init plat_of_setup(void)
 {
-	return __dt_register_buses("brcm,bcm3384", "simple-bus");
+	return __dt_register_buses("simple-bus", NULL);
 }
 
 arch_initcall(plat_of_setup);
Signature · 1 line
2.1.1
#22 lore raw

PATCH v5 17/23 MIPS: BMIPS: Add quirks for several Broadcom platforms

In reply to Kevin Cernekee

A couple of chips require special handling in order to make SMP secondary boot and/or exception vectors work correctly. Take care of these in setup.c.

---
 arch/mips/bmips/setup.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 99 insertions(+), 2 deletions(-)
arch/mips/bmips/setup.c +99 -2
index ac402ed..fae800e 100644
@@ -8,9 +8,12 @@
  */
 
 #include <linux/init.h>
+#include <linux/bitops.h>
 #include <linux/bootmem.h>
 #include <linux/clk-provider.h>
 #include <linux/ioport.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 #include <linux/of_platform.h>
@@ -18,9 +21,92 @@
 #include <asm/addrspace.h>
 #include <asm/bmips.h>
 #include <asm/bootinfo.h>
+#include <asm/cpu-type.h>
+#include <asm/mipsregs.h>
 #include <asm/prom.h>
 #include <asm/smp-ops.h>
 #include <asm/time.h>
+#include <asm/traps.h>
+
+#define RELO_NORMAL_VEC		BIT(18)
+
+#define REG_BCM6328_OTP		((void __iomem *)CKSEG1ADDR(0x1000062c))
+#define BCM6328_TP1_DISABLED	BIT(9)
+
+static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000;
+
+struct bmips_quirk {
+	const char		*compatible;
+	void			(*quirk_fn)(void);
+};
+
+static void kbase_setup(void)
+{
+	__raw_writel(kbase | RELO_NORMAL_VEC,
+		     BMIPS_GET_CBR() + BMIPS_RELO_VECTOR_CONTROL_1);
+	ebase = kbase;
+}
+
+static void bcm3384_viper_quirks(void)
+{
+	/*
+	 * Some experimental CM boxes are set up to let CM own the Viper TP0
+	 * and let Linux own TP1.  This requires moving the kernel
+	 * load address to a non-conflicting region (e.g. via
+	 * CONFIG_PHYSICAL_START) and supplying an alternate DTB.
+	 * If we detect this condition, we need to move the MIPS exception
+	 * vectors up to an area that we own.
+	 *
+	 * This is distinct from the OTHER special case mentioned in
+	 * smp-bmips.c (boot on TP1, but enable SMP, then TP0 becomes our
+	 * logical CPU#1).  For the Viper TP1 case, SMP is off limits.
+	 *
+	 * Also note that many BMIPS435x CPUs do not have a
+	 * BMIPS_RELO_VECTOR_CONTROL_1 register, so it isn't safe to just
+	 * write VMLINUX_LOAD_ADDRESS into that register on every SoC.
+	 */
+	board_ebase_setup = &kbase_setup;
+	bmips_smp_enabled = 0;
+}
+
+static void bcm63xx_fixup_cpu1(void)
+{
+	/*
+	 * The bootloader has set up the CPU1 reset vector at
+	 * 0xa000_0200.
+	 * This conflicts with the special interrupt vector (IV).
+	 * The bootloader has also set up CPU1 to respond to the wrong
+	 * IPI interrupt.
+	 * Here we will start up CPU1 in the background and ask it to
+	 * reconfigure itself then go back to sleep.
+	 */
+	memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
+	__sync();
+	set_c0_cause(C_SW0);
+	cpumask_set_cpu(1, &bmips_booted_mask);
+}
+
+static void bcm6328_quirks(void)
+{
+	/* Check CPU1 status in OTP (it is usually disabled) */
+	if (__raw_readl(REG_BCM6328_OTP) & BCM6328_TP1_DISABLED)
+		bmips_smp_enabled = 0;
+	else
+		bcm63xx_fixup_cpu1();
+}
+
+static void bcm6368_quirks(void)
+{
+	bcm63xx_fixup_cpu1();
+}
+
+static const struct bmips_quirk bmips_quirk_list[] = {
+	{ "brcm,bcm3384-viper",		&bcm3384_viper_quirks		},
+	{ "brcm,bcm33843-viper",	&bcm3384_viper_quirks		},
+	{ "brcm,bcm6328",		&bcm6328_quirks			},
+	{ "brcm,bcm6368",		&bcm6368_quirks			},
+	{ },
+};
 
 void __init prom_init(void)
 {
@@ -53,7 +139,8 @@ void __init plat_time_init(void)
 
 void __init plat_mem_setup(void)
 {
-	void *dtb = __dtb_start;
+	void *dtb;
+	const struct bmips_quirk *q;
 
 	set_io_port_base(0);
 	ioport_resource.start = 0;
@@ -62,10 +149,20 @@ void __init plat_mem_setup(void)
 	/* intended to somewhat resemble ARM; see Documentation/arm/Booting */
 	if (fw_arg0 == 0 && fw_arg1 == 0xffffffff)
 		dtb = phys_to_virt(fw_arg2);
+	else if (__dtb_start != __dtb_end)
+		dtb = (void *)__dtb_start;
+	else
+		panic("no dtb found");
 
 	__dt_setup_arch(dtb);
-
 	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
+
+	for (q = bmips_quirk_list; q->quirk_fn; q++) {
+		if (of_flat_dt_is_compatible(of_get_flat_dt_root(),
+					     q->compatible)) {
+			q->quirk_fn();
+		}
+	}
 }
 
 void __init device_tree_init(void)
Signature · 1 line
2.1.1
#23 lore raw

PATCH v5 18/23 MIPS: BMIPS: Delete the irqchip driver from irq.c

In reply to Kevin Cernekee

BCM3384/BCM63xx can use the common drivers/irqchip/irq-bcm7120-l2.c for this purpose; BCM7xxx will use drivers/irqchip/irq-bcm7038-l1.c. We no longer need this code under arch/mips.

---
 .../devicetree/bindings/mips/brcm/bcm3384-intc.txt |  37 ----
 arch/mips/bmips/irq.c                              | 189 ++-------------------
 2 files changed, 17 insertions(+), 209 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mips/brcm/bcm3384-intc.txt
Documentation/devicetree/bindings/mips/brcm/bcm3384-intc.txt deleted +0 -0
deleted file mode 100644
index d4e0141..0000000
arch/mips/bmips/irq.c +17 -172

208 lines not on this page · raw message

Signature · 1 line
2.1.1
#24 lore raw

PATCH v5 19/23 MIPS: BMIPS: Use a non-default FIXADDR_TOP setting

In reply to Kevin Cernekee

This will be required to support BMIPS3300 platforms.

---
 arch/mips/include/asm/mach-bmips/spaces.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 arch/mips/include/asm/mach-bmips/spaces.h
arch/mips/include/asm/mach-bmips/spaces.h new file +18 -0
new file mode 100644
index 0000000..1b05bdd
@@ -0,0 +1,18 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
+ * Copyright (C) 2000, 2002  Maciej W. Rozycki
+ * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
+ */
+#ifndef _ASM_BMIPS_SPACES_H
+#define _ASM_BMIPS_SPACES_H
+
+/* Avoid collisions with system base register (SBR) region on BMIPS3300 */
+#define FIXADDR_TOP		((unsigned long)(long)(int)0xff000000)
+
+#include <asm/mach-generic/spaces.h>
+
+#endif /* __ASM_BMIPS_SPACES_H */
Signature · 1 line
2.1.1
#25 lore raw

PATCH v5 20/23 MIPS: BMIPS: Enable additional peripheral and CPU support in defconfig

In reply to Kevin Cernekee

Also, add an LE defconfig for set-top box (BCM7xxx). This will allow the BMIPS kernel to run on several non-BCM3384 platforms.

---
 arch/mips/Kconfig                     | 18 +++++--
 arch/mips/configs/bmips_be_defconfig  |  9 +++-
 arch/mips/configs/bmips_stb_defconfig | 88 +++++++++++++++++++++++++++++++++++
 3 files changed, 109 insertions(+), 6 deletions(-)
 create mode 100644 arch/mips/configs/bmips_stb_defconfig
arch/mips/Kconfig +13 -5
index d28c29e..d277863 100644
@@ -139,17 +139,25 @@ config BMIPS_GENERIC
 	select CSRC_R4K
 	select SYNC_R4K
 	select COMMON_CLK
-	select DMA_NONCOHERENT
+	select BCM7038_L1_IRQ
+	select BCM7120_L2_IRQ
+	select BRCMSTB_L2_IRQ
 	select IRQ_CPU
+	select RAW_IRQ_ACCESSORS
+	select DMA_NONCOHERENT
 	select SYS_SUPPORTS_32BIT_KERNEL
+	select SYS_SUPPORTS_LITTLE_ENDIAN
 	select SYS_SUPPORTS_BIG_ENDIAN
 	select SYS_SUPPORTS_HIGHMEM
+	select SYS_HAS_CPU_BMIPS3300
+	select SYS_HAS_CPU_BMIPS4350
+	select SYS_HAS_CPU_BMIPS4380
 	select SYS_HAS_CPU_BMIPS5000
 	select SWAP_IO_SPACE
-	select USB_EHCI_BIG_ENDIAN_DESC
-	select USB_EHCI_BIG_ENDIAN_MMIO
-	select USB_OHCI_BIG_ENDIAN_DESC
-	select USB_OHCI_BIG_ENDIAN_MMIO
+	select USB_EHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
+	select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
+	select USB_OHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
+	select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
 	help
 	  Build a generic DT-based kernel image that boots on select
 	  BCM33xx cable modem chips, BCM63xx DSL chips, and BCM7xxx set-top
arch/mips/configs/bmips_be_defconfig +8 -1
index 36af5af..f5585c8 100644
@@ -33,6 +33,7 @@ CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
+CONFIG_BRCMSTB_GISB_ARB=y
 CONFIG_MTD=y
 CONFIG_MTD_CFI=y
 CONFIG_MTD_CFI_INTELEXT=y
@@ -43,15 +44,19 @@ CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
 # CONFIG_SCSI_LOWLEVEL is not set
 CONFIG_NETDEVICES=y
+CONFIG_BCMGENET=y
 CONFIG_USB_USBNET=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-CONFIG_SERIAL_EARLYCON_FORCE=y
 CONFIG_SERIAL_BCM63XX=y
 CONFIG_SERIAL_BCM63XX_CONSOLE=y
 # CONFIG_HW_RANDOM is not set
+CONFIG_POWER_SUPPLY=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_BRCMSTB=y
+CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
@@ -75,4 +80,6 @@ CONFIG_NLS_ASCII=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_DEBUG_FS=y
 CONFIG_MAGIC_SYSRQ=y
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="earlycon"
 # CONFIG_CRYPTO_HW is not set
arch/mips/configs/bmips_stb_defconfig new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
2.1.1
#26 lore raw

PATCH v5 21/23 MIPS: BMIPS: Refresh BCM3384 DTS files

In reply to Kevin Cernekee

The DT bindings for this platform have changed as the bootloader and product requirements evolved. In particular, there are both Linux-on-Zephyr and Linux-on-Viper configurations.

---
 arch/mips/boot/dts/bcm3384.dtsi        | 109 ----------------------------
 arch/mips/boot/dts/bcm3384_zephyr.dtsi | 126 +++++++++++++++++++++++++++++++++
 arch/mips/boot/dts/bcm93384wvg.dts     |   9 +--
 3 files changed, 127 insertions(+), 117 deletions(-)
 delete mode 100644 arch/mips/boot/dts/bcm3384.dtsi
 create mode 100644 arch/mips/boot/dts/bcm3384_zephyr.dtsi
arch/mips/boot/dts/bcm3384.dtsi deleted +0 -0
deleted file mode 100644
index 21b074a..0000000
arch/mips/boot/dts/bcm3384_zephyr.dtsi new file +126 -0

126 lines not on this page · raw message

arch/mips/boot/dts/bcm93384wvg.dts +1 -8
index 8317411..d1e44a1 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "bcm3384.dtsi"
+/include/ "bcm3384_zephyr.dtsi"
 
 / {
 	compatible = "brcm,bcm93384wvg", "brcm,bcm3384";
@@ -10,13 +10,6 @@
 		bootargs = "console=ttyS0,115200";
 		stdout-path = &uart0;
 	};
-
-	memory@0 {
-		device_type = "memory";
-		reg = <0x0 0x04000000>;
-		dma-xor-mask = <0x08000000>;
-		dma-xor-limit = <0x0fffffff>;
-	};
 };
 
 &uart0 {
Signature · 1 line
2.1.1
#27 lore raw

PATCH v5 22/23 MIPS: BMIPS: Update DT bindings to reflect new SoC support

In reply to Kevin Cernekee

Add an entry for each supported Broadcom SoC.

---
 Documentation/devicetree/bindings/mips/brcm/cm-dsl.txt | 11 -----------
 Documentation/devicetree/bindings/mips/brcm/soc.txt    | 12 ++++++++++++
 2 files changed, 12 insertions(+), 11 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mips/brcm/cm-dsl.txt
 create mode 100644 Documentation/devicetree/bindings/mips/brcm/soc.txt
Documentation/devicetree/bindings/mips/brcm/cm-dsl.txt deleted +0 -0
deleted file mode 100644
index 8a139cb..0000000
Documentation/devicetree/bindings/mips/brcm/soc.txt new file +12 -0
new file mode 100644
index 0000000..f011443
@@ -0,0 +1,12 @@
+* Broadcom cable/DSL/settop platforms
+
+Required properties:
+
+- compatible: "brcm,bcm3384", "brcm,bcm33843"
+              "brcm,bcm3384-viper", "brcm,bcm33843-viper"
+              "brcm,bcm6328", "brcm,bcm6368",
+              "brcm,bcm7125", "brcm,bcm7346", "brcm,bcm7360",
+              "brcm,bcm7420", "brcm,bcm7425"
+
+The experimental -viper variants are for running Linux on the 3384's
+BMIPS4355 cable modem CPU instead of the BMIPS5000 application processor.
Signature · 1 line
2.1.1
#28 lore raw

PATCH v5 23/23 MIPS: BMIPS: Add DTS files for several platforms

In reply to Kevin Cernekee

Most of the supported chips use legacy (non-DT) bootloaders, so they will need to select an appropriate builtin DTB at compile time until the bootloader is updated. Provide suitable DTS files, and a means to compile one of them into the kernel image.

---
 arch/mips/Kconfig                        |   1 +
 arch/mips/bmips/Kconfig                  |  50 +++++++
 arch/mips/boot/dts/Makefile              |  10 +-
 arch/mips/boot/dts/bcm3384_viper.dtsi    | 108 +++++++++++++++
 arch/mips/boot/dts/bcm6328.dtsi          |  86 ++++++++++++
 arch/mips/boot/dts/bcm6368.dtsi          |  93 +++++++++++++
 arch/mips/boot/dts/bcm7125.dtsi          | 139 +++++++++++++++++++
 arch/mips/boot/dts/bcm7346.dtsi          | 224 ++++++++++++++++++++++++++++++
 arch/mips/boot/dts/bcm7360.dtsi          | 161 ++++++++++++++++++++++
 arch/mips/boot/dts/bcm7420.dtsi          | 184 +++++++++++++++++++++++++
 arch/mips/boot/dts/bcm7425.dtsi          | 225 +++++++++++++++++++++++++++++++
 arch/mips/boot/dts/bcm93384wvg_viper.dts |  25 ++++
 arch/mips/boot/dts/bcm96368mvwg.dts      |  31 +++++
 arch/mips/boot/dts/bcm97125cbmb.dts      |  31 +++++
 arch/mips/boot/dts/bcm97346dbsmb.dts     |  58 ++++++++
 arch/mips/boot/dts/bcm97360svmb.dts      |  34 +++++
 arch/mips/boot/dts/bcm97420c.dts         |  45 +++++++
 arch/mips/boot/dts/bcm97425svmb.dts      |  60 +++++++++
 arch/mips/boot/dts/bcm9ejtagprb.dts      |  22 +++
 19 files changed, 1586 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/bmips/Kconfig
 create mode 100644 arch/mips/boot/dts/bcm3384_viper.dtsi
 create mode 100644 arch/mips/boot/dts/bcm6328.dtsi
 create mode 100644 arch/mips/boot/dts/bcm6368.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7125.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7346.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7360.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7420.dtsi
 create mode 100644 arch/mips/boot/dts/bcm7425.dtsi
 create mode 100644 arch/mips/boot/dts/bcm93384wvg_viper.dts
 create mode 100644 arch/mips/boot/dts/bcm96368mvwg.dts
 create mode 100644 arch/mips/boot/dts/bcm97125cbmb.dts
 create mode 100644 arch/mips/boot/dts/bcm97346dbsmb.dts
 create mode 100644 arch/mips/boot/dts/bcm97360svmb.dts
 create mode 100644 arch/mips/boot/dts/bcm97420c.dts
 create mode 100644 arch/mips/boot/dts/bcm97425svmb.dts
 create mode 100644 arch/mips/boot/dts/bcm9ejtagprb.dts
arch/mips/Kconfig +1 -0
index d277863..830812b 100644
@@ -892,6 +892,7 @@ source "arch/mips/ath25/Kconfig"
 source "arch/mips/ath79/Kconfig"
 source "arch/mips/bcm47xx/Kconfig"
 source "arch/mips/bcm63xx/Kconfig"
+source "arch/mips/bmips/Kconfig"
 source "arch/mips/jazz/Kconfig"
 source "arch/mips/jz4740/Kconfig"
 source "arch/mips/lantiq/Kconfig"
arch/mips/bmips/Kconfig new file +50 -0

50 lines not on this page · raw message

arch/mips/boot/dts/Makefile +9 -1
index 18d9999..153d044 100644
@@ -1,5 +1,13 @@
-dtb-$(CONFIG_BMIPS_GENERIC)		+= bcm93384wvg.dtb
 dtb-$(CONFIG_CAVIUM_OCTEON_SOC)		+= octeon_3xxx.dtb octeon_68xx.dtb
+dtb-$(CONFIG_DT_BCM93384WVG)		+= bcm93384wvg.dtb
+dtb-$(CONFIG_DT_BCM93384WVG_VIPER)	+= bcm93384wvg_viper.dtb
+dtb-$(CONFIG_DT_BCM96368MVWG)		+= bcm96368mvwg.dtb
+dtb-$(CONFIG_DT_BCM9EJTAGPRB)		+= bcm9ejtagprb.dtb
+dtb-$(CONFIG_DT_BCM97125CBMB)		+= bcm97125cbmb.dtb
+dtb-$(CONFIG_DT_BCM97346DBSMB)		+= bcm97346dbsmb.dtb
+dtb-$(CONFIG_DT_BCM97360SVMB)		+= bcm97360svmb.dtb
+dtb-$(CONFIG_DT_BCM97420C)		+= bcm97420c.dtb
+dtb-$(CONFIG_DT_BCM97425SVMB)		+= bcm97425svmb.dtb
 dtb-$(CONFIG_DT_EASY50712)		+= easy50712.dtb
 dtb-$(CONFIG_DT_XLP_EVP)		+= xlp_evp.dtb
 dtb-$(CONFIG_DT_XLP_SVP)		+= xlp_svp.dtb
arch/mips/boot/dts/bcm3384_viper.dtsi new file +108 -0

108 lines not on this page · raw message

arch/mips/boot/dts/bcm6328.dtsi new file +86 -0

86 lines not on this page · raw message

arch/mips/boot/dts/bcm6368.dtsi new file +93 -0

93 lines not on this page · raw message

arch/mips/boot/dts/bcm7125.dtsi new file +139 -0

139 lines not on this page · raw message

arch/mips/boot/dts/bcm7346.dtsi new file +224 -0

224 lines not on this page · raw message

arch/mips/boot/dts/bcm7360.dtsi new file +161 -0

161 lines not on this page · raw message

arch/mips/boot/dts/bcm7420.dtsi new file +184 -0

184 lines not on this page · raw message

arch/mips/boot/dts/bcm7425.dtsi new file +225 -0

225 lines not on this page · raw message

arch/mips/boot/dts/bcm93384wvg_viper.dts new file +25 -0
new file mode 100644
index 0000000..1ecb269
@@ -0,0 +1,25 @@
+/dts-v1/;
+
+/include/ "bcm3384_viper.dtsi"
+
+/ {
+	compatible = "brcm,bcm93384wvg-viper", "brcm,bcm3384-viper";
+	model = "Broadcom BCM93384WVG-viper";
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+		stdout-path = &uart0;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&ehci0 {
+	status = "okay";
+};
+
+&ohci0 {
+	status = "okay";
+};
arch/mips/boot/dts/bcm96368mvwg.dts new file +31 -0
new file mode 100644
index 0000000..0e890c2
@@ -0,0 +1,31 @@
+/dts-v1/;
+
+/include/ "bcm6368.dtsi"
+
+/ {
+	compatible = "brcm,bcm96368mvwg", "brcm,bcm6368";
+	model = "Broadcom BCM96368MVWG";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x00000000 0x04000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+		stdout-path = &uart0;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+/* FIXME: need to set up USB_CTRL registers first */
+&ehci0 {
+	status = "disabled";
+};
+
+&ohci0 {
+	status = "disabled";
+};
arch/mips/boot/dts/bcm97125cbmb.dts new file +31 -0
new file mode 100644
index 0000000..e046b11
@@ -0,0 +1,31 @@
+/dts-v1/;
+
+/include/ "bcm7125.dtsi"
+
+/ {
+	compatible = "brcm,bcm97125cbmb", "brcm,bcm7125";
+	model = "Broadcom BCM97125CBMB";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+		stdout-path = &uart0;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+/* FIXME: USB is wonky; disable it for now */
+&ehci0 {
+	status = "disabled";
+};
+
+&ohci0 {
+	status = "disabled";
+};
arch/mips/boot/dts/bcm97346dbsmb.dts new file +58 -0

58 lines not on this page · raw message

arch/mips/boot/dts/bcm97360svmb.dts new file +34 -0
new file mode 100644
index 0000000..4fe5155
@@ -0,0 +1,34 @@
+/dts-v1/;
+
+/include/ "bcm7360.dtsi"
+
+/ {
+	compatible = "brcm,bcm97360svmb", "brcm,bcm7360";
+	model = "Broadcom BCM97360SVMB";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+		stdout-path = &uart0;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&enet0 {
+	status = "okay";
+};
+
+&ehci0 {
+	status = "okay";
+};
+
+&ohci0 {
+	status = "okay";
+};
arch/mips/boot/dts/bcm97420c.dts new file +45 -0

45 lines not on this page · raw message

arch/mips/boot/dts/bcm97425svmb.dts new file +60 -0

60 lines not on this page · raw message

arch/mips/boot/dts/bcm9ejtagprb.dts new file +22 -0
new file mode 100644
index 0000000..1da4608
@@ -0,0 +1,22 @@
+/dts-v1/;
+
+/include/ "bcm6328.dtsi"
+
+/ {
+	compatible = "brcm,bcm9ejtagprb", "brcm,bcm6328";
+	model = "Broadcom BCM9EJTAGPRB";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x00000000 0x08000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+		stdout-path = &uart0;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.1.1
#14 lore raw

Re: [PATCH V5 13/23] MIPS: BMIPS: Flush the readahead cache after DMA

In reply to Kevin Cernekee
Quoted 4 lines · Kevin Cernekee

BMIPS 3300/435x/438x CPUs have a readahead cache that is separate from the L1/L2. During a DMA operation, accesses adjacent to a DMA buffer may cause parts of the DMA buffer to be prefetched into the RAC. To avoid possible coherency problems, flush the RAC upon DMA completion.

According to what I have, any cpu [d-]cache invalidate operation should already flush the full RAC unless explicitly disabled in the RAC configuration - is this intended as an optimization/shortcut?

Quoted 18 lines
---
 arch/mips/mm/dma-default.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/mips/mm/dma-default.c +1 -0
index af5f046..ee6d12c 100644
@@ -18,6 +18,7 @@
 #include <linux/highmem.h>
 #include <linux/dma-contiguous.h>
 
+#include <asm/bmips.h>
 #include <asm/cache.h>
 #include <asm/cpu-type.h>
 #include <asm/io.h>

arch/mips/mm/dma-default.c static inline struct page *dma_addr_to_page(struct device *dev, · line 72

Quoted 3 lines
arch/mips/mm/dma-default.c +0 -0
@@ -69,6 +70,18 @@ static inline struct page *dma_addr_to_page(struct device *dev,
  */
 static inline int cpu_needs_post_dma_flush(struct device *dev)
 {

The place for it seems a bit misplaced; I would not expect cpu_needs_post_dma_flush() to have any side effects.

arch/mips/mm/dma-default.c static inline struct page *dma_addr_to_page(struct device *dev, · line 79

Quoted 7 lines
arch/mips/mm/dma-default.c +7 -0
+       if (boot_cpu_type() == CPU_BMIPS3300 ||
+           boot_cpu_type() == CPU_BMIPS4350 ||
+           boot_cpu_type() == CPU_BMIPS4380) {
+               void __iomem *cbr = BMIPS_GET_CBR();
+
+               /* Flush stale data out of the readahead cache */
+               __raw_writel(0x100, cbr + BMIPS_RAC_CONFIG);

Hm, according to what I have, bits [6:0] of RAC_CONFIG are R/W configuration bits, and this will overwrite them:

CFE> dm 0xff400000 4
ff400000: 02a07015 ..p.
CFE> sm 0xff400000 0x100 4
ff400000: 02a00000 ....

(As far as I can tell, RAC was previously enabled for instruction cache misses , and now isn't any more for anything, so effectively disabled?)

Also for BMIPS4350 (and I guess 4380) there seems to be a second RAC_CONFIG register at 0x8, I guess for the second thread? Does it need flushing, too?

Quoted 10 lines
arch/mips/mm/dma-default.c +5 -1
+               __raw_readl(cbr + BMIPS_RAC_CONFIG);
+
+               return 0;
+       }
+
        return !plat_device_is_coherent(dev) &&
               (boot_cpu_type() == CPU_R10000 ||
                boot_cpu_type() == CPU_R12000 ||
--

2.1.1

Jonas
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by on the v5 series
#29 lore raw
In reply to Kevin Cernekee
Quoted 7 lines · On Friday 12 December 2014 14:06:51 Kevin Cernekee wrote:

V4->V5:

- Rebase on top of Linus' head of tree, converting BCM3384 platform code to Generic BMIPS platform code.

- Fix a couple of #include's

Quoted 8 lines

- Remove a couple of bogus entries from bmips_be_defconfig

Compile-tested only. Some BMIPS platforms may require acked-but-unmerged changes in other subsystems (like the native-endian serial8250/DT patches).

For 3.19 you'll want the first patch at the minimum (because the build is currently broken).

Since I commented on some of these patches before, I now took another (not very thorough) look at all of them. Looks very nice overall, I have no further comments.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw

Re: [PATCH V5 13/23] MIPS: BMIPS: Flush the readahead cache after DMA

In reply to Jonas Gorski
Quoted 9 lines · Jonas Gorski
Quoted 4 lines · Kevin Cernekee

BMIPS 3300/435x/438x CPUs have a readahead cache that is separate from the L1/L2. During a DMA operation, accesses adjacent to a DMA buffer may cause parts of the DMA buffer to be prefetched into the RAC. To avoid possible coherency problems, flush the RAC upon DMA completion.

According to what I have, any cpu [d-]cache invalidate operation should already flush the full RAC unless explicitly disabled in the RAC configuration - is this intended as an optimization/shortcut?

Correct - performing a RAC flush instead of blasting the entire range again via CACHE instructions should be considerably faster in most cases. CACHE instructions are not pipelined on BMIPS3300/43xx.

There may be a couple of old CPU versions (possibly 130nm) that don't automatically perform the RAC flush on each CACHE instruction. Also, a fun bit of trivia: MVA based cache flushes on B15 do flush the RAC, but index based instructions do not.

Quoted 5 lines
Quoted 2 lines

static inline int cpu_needs_post_dma_flush(struct device *dev) {

The place for it seems a bit misplaced; I would not expect cpu_needs_post_dma_flush() to have any side effects.

Maybe we should rename the function? To just cpu_post_dma_flush()?

(Or call a separate function from each site - but that seems unnecessary.)

Quoted 16 lines

arch/mips/mm/dma-default.c static inline struct page *dma_addr_to_page(struct device *dev, · line 79

Quoted 7 lines
arch/mips/mm/dma-default.c +7 -0
+       if (boot_cpu_type() == CPU_BMIPS3300 ||
+           boot_cpu_type() == CPU_BMIPS4350 ||
+           boot_cpu_type() == CPU_BMIPS4380) {
+               void __iomem *cbr = BMIPS_GET_CBR();
+
+               /* Flush stale data out of the readahead cache */
+               __raw_writel(0x100, cbr + BMIPS_RAC_CONFIG);

Hm, according to what I have, bits [6:0] of RAC_CONFIG are R/W configuration bits, and this will overwrite them:

CFE> dm 0xff400000 4
ff400000: 02a07015 ..p.
CFE> sm 0xff400000 0x100 4
ff400000: 02a00000 ....

Quoted 7 lines

(As far as I can tell, RAC was previously enabled for instruction cache misses , and now isn't any more for anything, so effectively disabled?)

Also for BMIPS4350 (and I guess 4380) there seems to be a second RAC_CONFIG register at 0x8, I guess for the second thread? Does it need flushing, too?

I'll defer to Florian for the final word since he has access to the documentation, but going from memory:

RAC_CONFIG should probably be a read/modify/write. I'm pretty sure there are important RW configuration bits in there. I may have incorrectly translated the "set bit 8" code from here:

https://github.com/Broadcom/stblinux-3.3/blob/master/linux/arch/mips/mm/c-brcmstb.c#L374

There is only one RAC for all CPUs, and we've never had to flush anything via CBR+0x08.

BCM7038 had a different flush register, located out in the regular system bus (GISB) space, and it didn't require a R/M/W. That might have been what I was thinking of.

Thanks for catching that.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

Re: [PATCH V5 13/23] MIPS: BMIPS: Flush the readahead cache after DMA

Quoted 11 lines · Kevin Cernekee
Quoted 9 lines · Jonas Gorski
Quoted 4 lines · Kevin Cernekee

BMIPS 3300/435x/438x CPUs have a readahead cache that is separate from the L1/L2. During a DMA operation, accesses adjacent to a DMA buffer may cause parts of the DMA buffer to be prefetched into the RAC. To avoid possible coherency problems, flush the RAC upon DMA completion.

According to what I have, any cpu [d-]cache invalidate operation should already flush the full RAC unless explicitly disabled in the RAC configuration - is this intended as an optimization/shortcut?

Quoted 8 lines

Correct - performing a RAC flush instead of blasting the entire range again via CACHE instructions should be considerably faster in most cases. CACHE instructions are not pipelined on BMIPS3300/43xx.

There may be a couple of old CPU versions (possibly 130nm) that don't automatically perform the RAC flush on each CACHE instruction. Also, a fun bit of trivia: MVA based cache flushes on B15 do flush the RAC, but index based instructions do not.

Because I'm laz^W^Wstill need to do some christmas shopping, I'll ask a few dumb questions:

Since a RAC flush won't flush the I/D-caches themselves, I assume there is no cache invalidate needed for BMIPS? Also is it still needed if the RAC is setup to only prefetch instructions (which it seems to be on bcm963xx)?

I also fail to find any RAC flushing on either bcm963xx or bcm947xx SDK kernels, that's why I'm a bit wondering whether they really need it. But maybe they always do explicit syncs, haven't checked that.

Furthermore, I see code to enable data prefetching in setup on bcm963xx, so I wonder if it wouldn't make sense to add the RAC as an extra node in DT / register/enable/configure it from bmips setup code (because then we can also properly setup the address range in case the bootloader didn't).

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

static inline int cpu_needs_post_dma_flush(struct device *dev) {

The place for it seems a bit misplaced; I would not expect cpu_needs_post_dma_flush() to have any side effects.

Maybe we should rename the function? To just cpu_post_dma_flush()?

Hm, not sure. Add a feature flag for that, or a callback. It is essentially a second level cache I guess.

Also while reading dma-default.c, I wonder why dma_unmap_page checks if cpu needs to flush, but dma_unmap_sg doesn't (disclamer: I don't know anything about sg).

Quoted 30 lines

(Or call a separate function from each site - but that seems unnecessary.)

Quoted 16 lines

arch/mips/mm/dma-default.c static inline struct page *dma_addr_to_page(struct device *dev, · line 79

Quoted 7 lines
arch/mips/mm/dma-default.c +7 -0
+       if (boot_cpu_type() == CPU_BMIPS3300 ||
+           boot_cpu_type() == CPU_BMIPS4350 ||
+           boot_cpu_type() == CPU_BMIPS4380) {
+               void __iomem *cbr = BMIPS_GET_CBR();
+
+               /* Flush stale data out of the readahead cache */
+               __raw_writel(0x100, cbr + BMIPS_RAC_CONFIG);

Hm, according to what I have, bits [6:0] of RAC_CONFIG are R/W configuration bits, and this will overwrite them:

CFE> dm 0xff400000 4
ff400000: 02a07015 ..p.
CFE> sm 0xff400000 0x100 4
ff400000: 02a00000 ....

Quoted 7 lines

(As far as I can tell, RAC was previously enabled for instruction cache misses , and now isn't any more for anything, so effectively disabled?)

Also for BMIPS4350 (and I guess 4380) there seems to be a second RAC_CONFIG register at 0x8, I guess for the second thread? Does it need flushing, too?

I'll defer to Florian for the final word since he has access to the documentation, but going from memory:

Quoted 8 lines

RAC_CONFIG should probably be a read/modify/write. I'm pretty sure there are important RW configuration bits in there. I may have incorrectly translated the "set bit 8" code from here:

https://github.com/Broadcom/stblinux-3.3/blob/master/linux/arch/mips/mm/c-brcmstb.c#L374

There is only one RAC for all CPUs, and we've never had to flush anything via CBR+0x08.

What I see in recent bcm963xx SDKs is this:

void __init plat_mem_setup(void)
{
...

        volatile unsigned long *cr;
        uint32 mipsBaseAddr = MIPS_BASE;

        cr = (void *)(mipsBaseAddr + MIPS_RAC_CR0);
        *cr = *cr | RAC_D | RAC_PF_D;
#if defined(MIPS_RAC_CR1)
        cr = (void *)(mipsBaseAddr + MIPS_RAC_CR1);
        *cr = *cr | RAC_D | RAC_PF_D;

#endif
}

RAC_CR1 seems to be defined for BMIPS4350 based SoCs, while BMIPS3300 ones don't (well, 6318 doesn't. The older SDKs named the address range register RAC_CR1, so for them this check is quite wrong :P)

But no references to RAC_FLH anywhere.

Jonas
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw

Re: [PATCH V5 13/23] MIPS: BMIPS: Flush the readahead cache after DMA

Quoted 8 lines · Jonas Gorski
Quoted 7 lines · Kevin Cernekee
Quoted 6 lines · Jonas Gorski
Quoted 4 lines · Kevin Cernekee

BMIPS 3300/435x/438x CPUs have a readahead cache that is separate from the L1/L2. During a DMA operation, accesses adjacent to a DMA buffer may cause parts of the DMA buffer to be prefetched into the RAC. To avoid possible coherency problems, flush the RAC upon DMA completion.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

According to what I have, any cpu [d-]cache invalidate operation should already flush the full RAC unless explicitly disabled in the RAC configuration - is this intended as an optimization/shortcut?

Correct - performing a RAC flush instead of blasting the entire range again via CACHE instructions should be considerably faster in most cases. CACHE instructions are not pipelined on BMIPS3300/43xx.

BTW, I forgot to mention earlier that the RAC is different from an L2/L3 in two important ways:

- In terms of prefetching you only need to worry about RAC blocks
(lines) on the "edges" on the DMA buffer. It won't randomly fill blocks in the middle, unlike the BMIPS5000 prefetching logic.

- It typically isn't possible to invalidate just part of the RAC.
The hardware flushes the whole thing at once.

Quoted 10 lines
Quoted 4 lines

There may be a couple of old CPU versions (possibly 130nm) that don't automatically perform the RAC flush on each CACHE instruction. Also, a fun bit of trivia: MVA based cache flushes on B15 do flush the RAC, but index based instructions do not.

Because I'm laz^W^Wstill need to do some christmas shopping, I'll ask a few dumb questions:

Since a RAC flush won't flush the I/D-caches themselves, I assume there is no cache invalidate needed for BMIPS?

On unmap this is true. The L1/L2 flush happens on map, pre-DMA.

Quoted 3 lines

Also is it still needed
if the RAC is setup to only prefetch instructions (which it seems to be on bcm963xx)?

Not sure. Do we ever execute directly from memory that has been freshly populated via DMA? If so, anything executed in the vicinity of that buffer could have prefetched stale data. Keeping in mind that the RAC won't prefetch across 4KB boundaries.

The most common RAC D$ coherency problems we've seen have involved DMA buffers adjacent to other structs in kernel memory, e.g. a DMA buffer that sits next to the wait_queue head used to sleep during the transfer. If the wait_queue struct is accessed at an unfortunate time, the RAC could start prefetching from the DMA buffer.

RAC I$ problems are probably much more rare, and subtle.

Quoted 9 lines

I also fail to find any RAC flushing on either bcm963xx or bcm947xx SDK kernels, that's why I'm a bit wondering whether they really need it. But maybe they always do explicit syncs, haven't checked that.

Furthermore, I see code to enable data prefetching in setup on bcm963xx, so I wonder if it wouldn't make sense to add the RAC as an extra node in DT / register/enable/configure it from bmips setup code (because then we can also properly setup the address range in case the bootloader didn't).

Historically there has been a great deal of debate as to whether the RAC should be set up in the bootloader or in the kernel:

- If it is set up in the bootloader, it can be part of the library
that handles general cache/CPU initialization for the platform. But the RAC does require extra flushing, so non-RAC-aware OSes can be caught off guard (especially if you're thinking about running a fairly stock image, like the ARMv7 multiplatform kernel from upstream).

- If it is set up in the kernel, the kernel will be able to decide
whether it can handle the extra flushes. If problems are seen later, it is easy to just change the kernel to leave RAC disabled, at the expense of memcpy() performance.

On BCM7xxx MIPS, the RAC is always set up from the bootloader. On BCM7xxx ARM, it is currently left up to the kernel (last I heard). On BCM3384 Viper it is controlled by the CM firmware on TP0. Not sure about the other SoCs.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#18 lore raw

Re: [PATCH V5 13/23] MIPS: BMIPS: Flush the readahead cache after DMA

In reply to Jonas Gorski

2014-12-20 4:44 GMT-08:00 Jonas Gorski <[email protected]>:

Quoted 108 lines · Kevin Cernekee
Quoted 11 lines · Jonas Gorski
Quoted 9 lines · Kevin Cernekee
Quoted 4 lines

BMIPS 3300/435x/438x CPUs have a readahead cache that is separate from the L1/L2. During a DMA operation, accesses adjacent to a DMA buffer may cause parts of the DMA buffer to be prefetched into the RAC. To avoid possible coherency problems, flush the RAC upon DMA completion.

According to what I have, any cpu [d-]cache invalidate operation should already flush the full RAC unless explicitly disabled in the RAC configuration - is this intended as an optimization/shortcut?

Quoted 8 lines

Correct - performing a RAC flush instead of blasting the entire range again via CACHE instructions should be considerably faster in most cases. CACHE instructions are not pipelined on BMIPS3300/43xx.

There may be a couple of old CPU versions (possibly 130nm) that don't automatically perform the RAC flush on each CACHE instruction. Also, a fun bit of trivia: MVA based cache flushes on B15 do flush the RAC, but index based instructions do not.

Because I'm laz^W^Wstill need to do some christmas shopping, I'll ask a few dumb questions:

Since a RAC flush won't flush the I/D-caches themselves, I assume there is no cache invalidate needed for BMIPS? Also is it still needed if the RAC is setup to only prefetch instructions (which it seems to be on bcm963xx)?

I also fail to find any RAC flushing on either bcm963xx or bcm947xx SDK kernels, that's why I'm a bit wondering whether they really need it. But maybe they always do explicit syncs, haven't checked that.

Furthermore, I see code to enable data prefetching in setup on bcm963xx, so I wonder if it wouldn't make sense to add the RAC as an extra node in DT / register/enable/configure it from bmips setup code (because then we can also properly setup the address range in case the bootloader didn't).

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

static inline int cpu_needs_post_dma_flush(struct device *dev) {

The place for it seems a bit misplaced; I would not expect cpu_needs_post_dma_flush() to have any side effects.

Maybe we should rename the function? To just cpu_post_dma_flush()?

Hm, not sure. Add a feature flag for that, or a callback. It is essentially a second level cache I guess.

Also while reading dma-default.c, I wonder why dma_unmap_page checks if cpu needs to flush, but dma_unmap_sg doesn't (disclamer: I don't know anything about sg).

Quoted 30 lines

(Or call a separate function from each site - but that seems unnecessary.)

Quoted 16 lines

arch/mips/mm/dma-default.c static inline struct page *dma_addr_to_page(struct device *dev, · line 79

Quoted 7 lines
arch/mips/mm/dma-default.c +7 -0
+       if (boot_cpu_type() == CPU_BMIPS3300 ||
+           boot_cpu_type() == CPU_BMIPS4350 ||
+           boot_cpu_type() == CPU_BMIPS4380) {
+               void __iomem *cbr = BMIPS_GET_CBR();
+
+               /* Flush stale data out of the readahead cache */
+               __raw_writel(0x100, cbr + BMIPS_RAC_CONFIG);

Hm, according to what I have, bits [6:0] of RAC_CONFIG are R/W configuration bits, and this will overwrite them:

CFE> dm 0xff400000 4
ff400000: 02a07015 ..p.
CFE> sm 0xff400000 0x100 4
ff400000: 02a00000 ....

Quoted 7 lines

(As far as I can tell, RAC was previously enabled for instruction cache misses , and now isn't any more for anything, so effectively disabled?)

Also for BMIPS4350 (and I guess 4380) there seems to be a second RAC_CONFIG register at 0x8, I guess for the second thread? Does it need flushing, too?

I'll defer to Florian for the final word since he has access to the documentation, but going from memory:

Quoted 8 lines

RAC_CONFIG should probably be a read/modify/write. I'm pretty sure there are important RW configuration bits in there. I may have incorrectly translated the "set bit 8" code from here:

https://github.com/Broadcom/stblinux-3.3/blob/master/linux/arch/mips/mm/c-brcmstb.c#L374

There is only one RAC for all CPUs, and we've never had to flush anything via CBR+0x08.

What I see in recent bcm963xx SDKs is this:

void __init plat_mem_setup(void)
{
...

        volatile unsigned long *cr;
        uint32 mipsBaseAddr = MIPS_BASE;

        cr = (void *)(mipsBaseAddr + MIPS_RAC_CR0);
        *cr = *cr | RAC_D | RAC_PF_D;
#if defined(MIPS_RAC_CR1)
        cr = (void *)(mipsBaseAddr + MIPS_RAC_CR1);
        *cr = *cr | RAC_D | RAC_PF_D;
Quoted 8 lines

#endif
}

RAC_CR1 seems to be defined for BMIPS4350 based SoCs, while BMIPS3300 ones don't (well, 6318 doesn't. The older SDKs named the address range register RAC_CR1, so for them this check is quite wrong :P)

But no references to RAC_FLH anywhere.

RAC_CR (0x1FA0_0000) controls the RAC settings for TP0, while RAC_CR1 (0x1FA0_0008) controls the RAC settings for TP1, hence the reason why BMIPS3300 does not have it.

Surprisingly (or not), FLH only exists in RAC_CR, because the RAC is shared between TPs just like the L2.

In your previous dump, bit 4 is set, aka C_INV, which means that the RAC will flush its I-cache blocks when we issue "cache" instructions, effectively making the RAC transparent as far as I understand it, and D-cache prefetching is indeed disabled.

Signature · 5 lines
Florian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html