linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support
@ 2019-07-17 19:50 Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 01/18] ARM: bcm283x: Reduce register ranges for UART, SPI and I2C Stefan Wahren
                   ` (13 more replies)
  0 siblings, 14 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

This series adds minimal support for the new Raspberry Pi 4, so we are able
to login via debug UART.

Patch 1-5:   Prepare platform and DTS for the new SoC BMC2838
Patch 6-9:   Enable support for emmc2 on BCM2838
Patch 10-14: Enable pinctrl for BCM2838
Patch 15:    Enable SPI support for BCM2838
Patch 16-18: Add Raspberry Pi 4 DTS support

Unfortunately the Raspberry Pi Foundation didn't released a
peripheral documentation for the new SoC yet. So we only have a preliminary
datasheet [1] and reduced schematics [2].

This series is marked as RFC because some parts (e.g. pinctrl) are still
work in progress.

[1] - https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711/rpi_DATA_2711_1p0_preliminary.pdf
[2] - https://www.raspberrypi.org/documentation/hardware/raspberrypi/schematics/rpi_SCH_4b_4p0_reduced.pdf

Discussible things:
- SoC compatible BCM2711 (as on the SoC label) vs BCM2838 (existing naming scheme)
- ARCH membership ARCH_BCM2835 vs ARCH_BCMSTB
...


Al Cooper (1):
  pinctrl: bcm2835: bcm7211: Add support for 7211 pull-up functionality

Martin Sperl (1):
  spi: bcm2835: enable shared interrupt support

Phil Elwell (2):
  ARM: bcm2835: DMA can only address 1GB
  ARM: bcm2835: Add bcm2838 compatible string

Stefan Wahren (14):
  ARM: bcm283x: Reduce register ranges for UART, SPI and I2C
  ARM: dts: bcm283x: Move BCM2835/6/7 specific to bcm2835-common.dtsi
  ARM: dts: bcm283x: Define MMC interfaces at board level
  ARM: dts: bcm283x: Define memory at board level
  dt-bindings: bcm2835-cprman: Add bcm2838 support
  clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support
  dt-bindings: sdhci-iproc: Add brcm,bcm2838-emmc2
  mmc: sdhci-iproc: Add support for emmc2 of the BCM2838
  pinctrl: bcm2835: Fix BCM7211 pinconf handling
  dt-bindings: pinctrl: bcm2835: Add brcm,bcm2838 compatible
  pinctrl: bcm2835: Add BCM2838 support
  HACK: pinctrl: bcm2835: Implement legacy pull for BCM7211
  dt-bindings: bcm: Add Raspberry Pi 4 B
  ARM: dts: Add minimal Raspberry Pi 4 support

 .../devicetree/bindings/arm/bcm/brcm,bcm2835.txt   |   4 +
 .../bindings/clock/brcm,bcm2835-cprman.txt         |   4 +-
 .../devicetree/bindings/mmc/brcm,sdhci-iproc.txt   |   4 +-
 .../bindings/pinctrl/brcm,bcm2835-gpio.txt         |   1 +
 arch/arm/boot/dts/Makefile                         |   1 +
 arch/arm/boot/dts/bcm2835-common.dtsi              | 173 ++++++
 arch/arm/boot/dts/bcm2835-rpi-a-plus.dts           |  12 +
 arch/arm/boot/dts/bcm2835-rpi-a.dts                |  12 +
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts           |  12 +
 arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts           |  12 +
 arch/arm/boot/dts/bcm2835-rpi-b.dts                |  12 +
 arch/arm/boot/dts/bcm2835-rpi-cm1-io1.dts          |   7 +
 arch/arm/boot/dts/bcm2835-rpi-cm1.dtsi             |   5 +
 arch/arm/boot/dts/bcm2835-rpi-zero-w.dts           |  12 +
 arch/arm/boot/dts/bcm2835-rpi-zero.dts             |  12 +
 arch/arm/boot/dts/bcm2835-rpi.dtsi                 |  18 -
 arch/arm/boot/dts/bcm2835.dtsi                     |   1 +
 arch/arm/boot/dts/bcm2836-rpi-2-b.dts              |   8 +
 arch/arm/boot/dts/bcm2836.dtsi                     |   1 +
 arch/arm/boot/dts/bcm2837-rpi-3-a-plus.dts         |   1 +
 arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts         |   1 +
 arch/arm/boot/dts/bcm2837-rpi-3-b.dts              |   1 +
 arch/arm/boot/dts/bcm2837-rpi-cm3-io3.dts          |   7 +
 arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi             |   1 +
 arch/arm/boot/dts/bcm2837.dtsi                     |   1 +
 arch/arm/boot/dts/bcm2838-rpi-4-b.dts              | 120 ++++
 arch/arm/boot/dts/bcm2838.dtsi                     | 657 +++++++++++++++++++++
 arch/arm/boot/dts/bcm283x.dtsi                     | 166 +-----
 arch/arm/mach-bcm/board_bcm2835.c                  |   2 +
 drivers/clk/bcm/clk-bcm2835.c                      |  33 +-
 drivers/mmc/host/sdhci-iproc.c                     |   9 +
 drivers/pinctrl/bcm/pinctrl-bcm2835.c              |  97 ++-
 drivers/spi/spi-bcm2835.c                          |   8 +-
 include/dt-bindings/clock/bcm2835.h                |   2 +
 34 files changed, 1232 insertions(+), 185 deletions(-)
 create mode 100644 arch/arm/boot/dts/bcm2835-common.dtsi
 create mode 100644 arch/arm/boot/dts/bcm2838-rpi-4-b.dts
 create mode 100644 arch/arm/boot/dts/bcm2838.dtsi

--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH RFC 01/18] ARM: bcm283x: Reduce register ranges for UART, SPI and I2C
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 02/18] ARM: bcm2835: DMA can only address 1GB Stefan Wahren
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

The assigned register ranges for UART, SPI and I2C were too wasteful.
In order to avoid overlapping with the new functions on BCM2838
reduce the ranges.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 arch/arm/boot/dts/bcm283x.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index 4b21ddb..2d191fc 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -397,7 +397,7 @@

 		uart0: serial@7e201000 {
 			compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell";
-			reg = <0x7e201000 0x1000>;
+			reg = <0x7e201000 0x200>;
 			interrupts = <2 25>;
 			clocks = <&clocks BCM2835_CLOCK_UART>,
 				 <&clocks BCM2835_CLOCK_VPU>;
@@ -428,7 +428,7 @@

 		spi: spi@7e204000 {
 			compatible = "brcm,bcm2835-spi";
-			reg = <0x7e204000 0x1000>;
+			reg = <0x7e204000 0x200>;
 			interrupts = <2 22>;
 			clocks = <&clocks BCM2835_CLOCK_VPU>;
 			dmas = <&dma 6>, <&dma 7>;
@@ -440,7 +440,7 @@

 		i2c0: i2c@7e205000 {
 			compatible = "brcm,bcm2835-i2c";
-			reg = <0x7e205000 0x1000>;
+			reg = <0x7e205000 0x200>;
 			interrupts = <2 21>;
 			clocks = <&clocks BCM2835_CLOCK_VPU>;
 			#address-cells = <1>;
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 02/18] ARM: bcm2835: DMA can only address 1GB
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 01/18] ARM: bcm283x: Reduce register ranges for UART, SPI and I2C Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 03/18] ARM: dts: bcm283x: Move BCM2835/6/7 specific to bcm2835-common.dtsi Stefan Wahren
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: Phil Elwell, bcm-kernel-feedback-list, linux-rpi-kernel,
	linux-arm-kernel, Stefan Wahren

From: Phil Elwell <phil@raspberrypi.org>

The legacy peripherals can only address the first gigabyte of RAM, so
ensure that DMA allocations are restricted to that region.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 arch/arm/mach-bcm/board_bcm2835.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c
index bfc556f..d2b31a9 100644
--- a/arch/arm/mach-bcm/board_bcm2835.c
+++ b/arch/arm/mach-bcm/board_bcm2835.c
@@ -24,6 +24,7 @@ static const char * const bcm2835_compat[] = {
 };

 DT_MACHINE_START(BCM2835, "BCM2835")
+	.dma_zone_size	= SZ_1G,
 	.dt_compat = bcm2835_compat,
 	.smp = smp_ops(bcm2836_smp_ops),
 MACHINE_END
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 03/18] ARM: dts: bcm283x: Move BCM2835/6/7 specific to bcm2835-common.dtsi
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 01/18] ARM: bcm283x: Reduce register ranges for UART, SPI and I2C Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 02/18] ARM: bcm2835: DMA can only address 1GB Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 04/18] ARM: dts: bcm283x: Define MMC interfaces at board level Stefan Wahren
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

As preparation we want all common BCM2835/6/7/8 functions in bcm283x.dtsi
and all BCM2835/6/7 specific in the new bcm2835-common.dtsi.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 arch/arm/boot/dts/bcm2835-common.dtsi | 173 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/bcm2835.dtsi        |   1 +
 arch/arm/boot/dts/bcm2836.dtsi        |   1 +
 arch/arm/boot/dts/bcm2837.dtsi        |   1 +
 arch/arm/boot/dts/bcm283x.dtsi        | 158 ++-----------------------------
 5 files changed, 182 insertions(+), 152 deletions(-)
 create mode 100644 arch/arm/boot/dts/bcm2835-common.dtsi

diff --git a/arch/arm/boot/dts/bcm2835-common.dtsi b/arch/arm/boot/dts/bcm2835-common.dtsi
new file mode 100644
index 0000000..2791ff7
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2835-common.dtsi
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/* This include file covers the common peripherals and configuration between
+ * bcm2835, bcm2836 and bcm2837 implementations.
+ */
+
+/ {
+	interrupt-parent = <&intc>;
+
+	soc {
+		timer@7e003000 {
+			compatible = "brcm,bcm2835-system-timer";
+			reg = <0x7e003000 0x1000>;
+			interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
+			/* This could be a reference to BCM2835_CLOCK_TIMER,
+			 * but we don't have the driver using the common clock
+			 * support yet.
+			 */
+			clock-frequency = <1000000>;
+		};
+
+		dma: dma@7e007000 {
+			compatible = "brcm,bcm2835-dma";
+			reg = <0x7e007000 0xf00>;
+			interrupts = <1 16>,
+				     <1 17>,
+				     <1 18>,
+				     <1 19>,
+				     <1 20>,
+				     <1 21>,
+				     <1 22>,
+				     <1 23>,
+				     <1 24>,
+				     <1 25>,
+				     <1 26>,
+				     /* dma channel 11-14 share one irq */
+				     <1 27>,
+				     <1 27>,
+				     <1 27>,
+				     <1 27>,
+				     /* unused shared irq for all channels */
+				     <1 28>;
+			interrupt-names = "dma0",
+					  "dma1",
+					  "dma2",
+					  "dma3",
+					  "dma4",
+					  "dma5",
+					  "dma6",
+					  "dma7",
+					  "dma8",
+					  "dma9",
+					  "dma10",
+					  "dma11",
+					  "dma12",
+					  "dma13",
+					  "dma14",
+					  "dma-shared-all";
+			#dma-cells = <1>;
+			brcm,dma-channel-mask = <0x7f35>;
+		};
+
+		intc: interrupt-controller@7e00b200 {
+			compatible = "brcm,bcm2835-armctrl-ic";
+			reg = <0x7e00b200 0x200>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+		};
+
+		pm: watchdog@7e100000 {
+			compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";
+			#power-domain-cells = <1>;
+			#reset-cells = <1>;
+			reg = <0x7e100000 0x114>,
+			      <0x7e00a000 0x24>;
+			clocks = <&clocks BCM2835_CLOCK_V3D>,
+				 <&clocks BCM2835_CLOCK_PERI_IMAGE>,
+				 <&clocks BCM2835_CLOCK_H264>,
+				 <&clocks BCM2835_CLOCK_ISP>;
+			clock-names = "v3d", "peri_image", "h264", "isp";
+			system-power-controller;
+		};
+
+		thermal: thermal@7e212000 {
+			compatible = "brcm,bcm2835-thermal";
+			reg = <0x7e212000 0x8>;
+			clocks = <&clocks BCM2835_CLOCK_TSENS>;
+			#thermal-sensor-cells = <0>;
+			status = "disabled";
+		};
+
+		v3d: v3d@7ec00000 {
+			compatible = "brcm,bcm2835-v3d";
+			reg = <0x7ec00000 0x1000>;
+			interrupts = <1 10>;
+		};
+	};
+
+	usbphy: phy {
+		compatible = "usb-nop-xceiv";
+		#phy-cells = <0>;
+	};
+};
+
+&cpu_thermal {
+	thermal-sensors = <&thermal>;
+};
+
+&gpio {
+	i2c_slave_gpio18: i2c_slave_gpio18 {
+		brcm,pins = <18 19 20 21>;
+		brcm,function = <BCM2835_FSEL_ALT3>;
+	};
+
+	jtag_gpio4: jtag_gpio4 {
+		brcm,pins = <4 5 6 12 13>;
+		brcm,function = <BCM2835_FSEL_ALT5>;
+	};
+
+	pwm0_gpio12: pwm0_gpio12 {
+		brcm,pins = <12>;
+		brcm,function = <BCM2835_FSEL_ALT0>;
+	};
+	pwm0_gpio18: pwm0_gpio18 {
+		brcm,pins = <18>;
+		brcm,function = <BCM2835_FSEL_ALT5>;
+	};
+	pwm0_gpio40: pwm0_gpio40 {
+		brcm,pins = <40>;
+		brcm,function = <BCM2835_FSEL_ALT0>;
+	};
+	pwm1_gpio13: pwm1_gpio13 {
+		brcm,pins = <13>;
+		brcm,function = <BCM2835_FSEL_ALT0>;
+	};
+	pwm1_gpio19: pwm1_gpio19 {
+		brcm,pins = <19>;
+		brcm,function = <BCM2835_FSEL_ALT5>;
+	};
+	pwm1_gpio41: pwm1_gpio41 {
+		brcm,pins = <41>;
+		brcm,function = <BCM2835_FSEL_ALT0>;
+	};
+	pwm1_gpio45: pwm1_gpio45 {
+		brcm,pins = <45>;
+		brcm,function = <BCM2835_FSEL_ALT0>;
+	};
+};
+
+&hdmi {
+	dmas = <&dma 17>;
+	dma-names = "audio-rx";
+};
+
+&i2s {
+	dmas = <&dma 2>, <&dma 3>;
+	dma-names = "tx", "rx";
+};
+
+&sdhost {
+	dmas = <&dma 13>;
+	dma-names = "rx-tx";
+};
+
+&spi {
+	dmas = <&dma 6>, <&dma 7>;
+	dma-names = "tx", "rx";
+};
+
+&usb {
+	phys = <&usbphy>;
+	phy-names = "usb2-phy";
+};
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index a5c3824..53bf457 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "bcm283x.dtsi"
+#include "bcm2835-common.dtsi"

 / {
 	compatible = "brcm,bcm2835";
diff --git a/arch/arm/boot/dts/bcm2836.dtsi b/arch/arm/boot/dts/bcm2836.dtsi
index c933e84..82d6c46 100644
--- a/arch/arm/boot/dts/bcm2836.dtsi
+++ b/arch/arm/boot/dts/bcm2836.dtsi
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "bcm283x.dtsi"
+#include "bcm2835-common.dtsi"

 / {
 	compatible = "brcm,bcm2836";
diff --git a/arch/arm/boot/dts/bcm2837.dtsi b/arch/arm/boot/dts/bcm2837.dtsi
index beb6c50..9e95fee 100644
--- a/arch/arm/boot/dts/bcm2837.dtsi
+++ b/arch/arm/boot/dts/bcm2837.dtsi
@@ -1,4 +1,5 @@
 #include "bcm283x.dtsi"
+#include "bcm2835-common.dtsi"

 / {
 	compatible = "brcm,bcm2837";
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index 2d191fc..1104e4c 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -18,7 +18,6 @@
 / {
 	compatible = "brcm,bcm2835";
 	model = "BCM2835";
-	interrupt-parent = <&intc>;
 	#address-cells = <1>;
 	#size-cells = <1>;

@@ -36,8 +35,6 @@
 			polling-delay-passive = <0>;
 			polling-delay = <1000>;

-			thermal-sensors = <&thermal>;
-
 			trips {
 				cpu-crit {
 					temperature	= <80000>;
@@ -56,83 +53,17 @@
 		#address-cells = <1>;
 		#size-cells = <1>;

-		timer@7e003000 {
-			compatible = "brcm,bcm2835-system-timer";
-			reg = <0x7e003000 0x1000>;
-			interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
-			/* This could be a reference to BCM2835_CLOCK_TIMER,
-			 * but we don't have the driver using the common clock
-			 * support yet.
-			 */
-			clock-frequency = <1000000>;
-		};
-
 		txp@7e004000 {
 			compatible = "brcm,bcm2835-txp";
 			reg = <0x7e004000 0x20>;
 			interrupts = <1 11>;
 		};

-		dma: dma@7e007000 {
-			compatible = "brcm,bcm2835-dma";
-			reg = <0x7e007000 0xf00>;
-			interrupts = <1 16>,
-				     <1 17>,
-				     <1 18>,
-				     <1 19>,
-				     <1 20>,
-				     <1 21>,
-				     <1 22>,
-				     <1 23>,
-				     <1 24>,
-				     <1 25>,
-				     <1 26>,
-				     /* dma channel 11-14 share one irq */
-				     <1 27>,
-				     <1 27>,
-				     <1 27>,
-				     <1 27>,
-				     /* unused shared irq for all channels */
-				     <1 28>;
-			interrupt-names = "dma0",
-					  "dma1",
-					  "dma2",
-					  "dma3",
-					  "dma4",
-					  "dma5",
-					  "dma6",
-					  "dma7",
-					  "dma8",
-					  "dma9",
-					  "dma10",
-					  "dma11",
-					  "dma12",
-					  "dma13",
-					  "dma14",
-					  "dma-shared-all";
-			#dma-cells = <1>;
-			brcm,dma-channel-mask = <0x7f35>;
-		};
-
-		intc: interrupt-controller@7e00b200 {
-			compatible = "brcm,bcm2835-armctrl-ic";
-			reg = <0x7e00b200 0x200>;
-			interrupt-controller;
-			#interrupt-cells = <2>;
-		};
-
-		pm: watchdog@7e100000 {
-			compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";
-			#power-domain-cells = <1>;
-			#reset-cells = <1>;
-			reg = <0x7e100000 0x114>,
-			      <0x7e00a000 0x24>;
-			clocks = <&clocks BCM2835_CLOCK_V3D>,
-				 <&clocks BCM2835_CLOCK_PERI_IMAGE>,
-				 <&clocks BCM2835_CLOCK_H264>,
-				 <&clocks BCM2835_CLOCK_ISP>;
-			clock-names = "v3d", "peri_image", "h264", "isp";
-			system-power-controller;
+		mailbox: mailbox@7e00b880 {
+			compatible = "brcm,bcm2835-mbox";
+			reg = <0x7e00b880 0x40>;
+			interrupts = <0 1>;
+			#mbox-cells = <0>;
 		};

 		clocks: cprman@7e101000 {
@@ -155,13 +86,6 @@
 			interrupts = <2 29>;
 		};

-		mailbox: mailbox@7e00b880 {
-			compatible = "brcm,bcm2835-mbox";
-			reg = <0x7e00b880 0x40>;
-			interrupts = <0 1>;
-			#mbox-cells = <0>;
-		};
-
 		gpio: gpio@7e200000 {
 			compatible = "brcm,bcm2835-gpio";
 			reg = <0x7e200000 0xb4>;
@@ -184,8 +108,7 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;

-			/* Defines pin muxing groups according to
-			 * BCM2835-ARM-Peripherals.pdf page 102.
+			/* Defines common pin muxing groups
 			 *
 			 * While each pin can have its mux selected
 			 * for various functions individually, some
@@ -263,15 +186,7 @@
 				brcm,pins = <44 45>;
 				brcm,function = <BCM2835_FSEL_ALT2>;
 			};
-			i2c_slave_gpio18: i2c_slave_gpio18 {
-				brcm,pins = <18 19 20 21>;
-				brcm,function = <BCM2835_FSEL_ALT3>;
-			};

-			jtag_gpio4: jtag_gpio4 {
-				brcm,pins = <4 5 6 12 13>;
-				brcm,function = <BCM2835_FSEL_ALT5>;
-			};
 			jtag_gpio22: jtag_gpio22 {
 				brcm,pins = <22 23 24 25 26 27>;
 				brcm,function = <BCM2835_FSEL_ALT4>;
@@ -286,35 +201,6 @@
 				brcm,function = <BCM2835_FSEL_ALT2>;
 			};

-			pwm0_gpio12: pwm0_gpio12 {
-				brcm,pins = <12>;
-				brcm,function = <BCM2835_FSEL_ALT0>;
-			};
-			pwm0_gpio18: pwm0_gpio18 {
-				brcm,pins = <18>;
-				brcm,function = <BCM2835_FSEL_ALT5>;
-			};
-			pwm0_gpio40: pwm0_gpio40 {
-				brcm,pins = <40>;
-				brcm,function = <BCM2835_FSEL_ALT0>;
-			};
-			pwm1_gpio13: pwm1_gpio13 {
-				brcm,pins = <13>;
-				brcm,function = <BCM2835_FSEL_ALT0>;
-			};
-			pwm1_gpio19: pwm1_gpio19 {
-				brcm,pins = <19>;
-				brcm,function = <BCM2835_FSEL_ALT5>;
-			};
-			pwm1_gpio41: pwm1_gpio41 {
-				brcm,pins = <41>;
-				brcm,function = <BCM2835_FSEL_ALT0>;
-			};
-			pwm1_gpio45: pwm1_gpio45 {
-				brcm,pins = <45>;
-				brcm,function = <BCM2835_FSEL_ALT0>;
-			};
-
 			sdhost_gpio48: sdhost_gpio48 {
 				brcm,pins = <48 49 50 51 52 53>;
 				brcm,function = <BCM2835_FSEL_ALT0>;
@@ -410,8 +296,6 @@
 			reg = <0x7e202000 0x100>;
 			interrupts = <2 24>;
 			clocks = <&clocks BCM2835_CLOCK_VPU>;
-			dmas = <&dma 13>;
-			dma-names = "rx-tx";
 			status = "disabled";
 		};

@@ -419,10 +303,6 @@
 			compatible = "brcm,bcm2835-i2s";
 			reg = <0x7e203000 0x24>;
 			clocks = <&clocks BCM2835_CLOCK_PCM>;
-
-			dmas = <&dma 2>,
-			       <&dma 3>;
-			dma-names = "tx", "rx";
 			status = "disabled";
 		};

@@ -431,8 +311,6 @@
 			reg = <0x7e204000 0x200>;
 			interrupts = <2 22>;
 			clocks = <&clocks BCM2835_CLOCK_VPU>;
-			dmas = <&dma 6>, <&dma 7>;
-			dma-names = "tx", "rx";
 			#address-cells = <1>;
 			#size-cells = <0>;
 			status = "disabled";
@@ -490,14 +368,6 @@

 		};

-		thermal: thermal@7e212000 {
-			compatible = "brcm,bcm2835-thermal";
-			reg = <0x7e212000 0x8>;
-			clocks = <&clocks BCM2835_CLOCK_TSENS>;
-			#thermal-sensor-cells = <0>;
-			status = "disabled";
-		};
-
 		aux: aux@7e215000 {
 			compatible = "brcm,bcm2835-aux";
 			#clock-cells = <1>;
@@ -620,8 +490,6 @@
 			clocks = <&clocks BCM2835_PLLH_PIX>,
 				 <&clocks BCM2835_CLOCK_HSM>;
 			clock-names = "pixel", "hdmi";
-			dmas = <&dma 17>;
-			dma-names = "audio-rx";
 			status = "disabled";
 		};

@@ -633,15 +501,6 @@
 			#size-cells = <0>;
 			clocks = <&clk_usb>;
 			clock-names = "otg";
-			phys = <&usbphy>;
-			phy-names = "usb2-phy";
-		};
-
-		v3d: v3d@7ec00000 {
-			compatible = "brcm,bcm2835-v3d";
-			reg = <0x7ec00000 0x1000>;
-			interrupts = <1 10>;
-			power-domains = <&pm BCM2835_POWER_DOMAIN_GRAFX_V3D>;
 		};

 		vc4: gpu {
@@ -671,9 +530,4 @@
 			clock-frequency = <480000000>;
 		};
 	};
-
-	usbphy: phy {
-		compatible = "usb-nop-xceiv";
-		#phy-cells = <0>;
-	};
 };
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 04/18] ARM: dts: bcm283x: Define MMC interfaces at board level
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (2 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 03/18] ARM: dts: bcm283x: Move BCM2835/6/7 specific to bcm2835-common.dtsi Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 05/18] ARM: dts: bcm283x: Define memory " Stefan Wahren
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

Starting with RPi 4 this is the first board, which doesn't use sdhost
as default SD interface. So the MMC interfaces should be defined finally at
board level. Since all boards using sdhci already does this, we can drop the
pinctrl part from bcm2835-rpi.dtsi.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 arch/arm/boot/dts/bcm2835-rpi-a-plus.dts  |  7 +++++++
 arch/arm/boot/dts/bcm2835-rpi-a.dts       |  7 +++++++
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts  |  7 +++++++
 arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts  |  7 +++++++
 arch/arm/boot/dts/bcm2835-rpi-b.dts       |  7 +++++++
 arch/arm/boot/dts/bcm2835-rpi-cm1-io1.dts |  7 +++++++
 arch/arm/boot/dts/bcm2835-rpi-zero-w.dts  |  7 +++++++
 arch/arm/boot/dts/bcm2835-rpi-zero.dts    |  7 +++++++
 arch/arm/boot/dts/bcm2835-rpi.dtsi        | 13 -------------
 arch/arm/boot/dts/bcm2836-rpi-2-b.dts     |  7 +++++++
 arch/arm/boot/dts/bcm2837-rpi-cm3-io3.dts |  7 +++++++
 11 files changed, 70 insertions(+), 13 deletions(-)

diff --git a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
index db8a601..cb3f08d 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
@@ -107,6 +107,13 @@
 	status = "okay";
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio14>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-a.dts b/arch/arm/boot/dts/bcm2835-rpi-a.dts
index 067d1f0..2d167d9 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-a.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-a.dts
@@ -102,6 +102,13 @@
 	status = "okay";
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio14>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
index 1e40d67..83a3a60 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -109,6 +109,13 @@
 	status = "okay";
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio14>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
index 28e7513..b6b4fea 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
@@ -102,6 +102,13 @@
 	status = "okay";
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio14>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index 31ff602..b5782fa 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -97,6 +97,13 @@
 	status = "okay";
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio14>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm1-io1.dts b/arch/arm/boot/dts/bcm2835-rpi-cm1-io1.dts
index 4764a25..41afea4 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-cm1-io1.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-cm1-io1.dts
@@ -81,6 +81,13 @@
 	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio14>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
index ba0167d..5ecc403 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
@@ -116,6 +116,13 @@
 	};
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero.dts b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
index 3b35a8a..84c7035 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-zero.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
@@ -98,6 +98,13 @@
 	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio14>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
index 715d50c..40bac52e 100644
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
@@ -68,19 +68,6 @@
 	status = "okay";
 };

-&sdhci {
-	pinctrl-names = "default";
-	pinctrl-0 = <&emmc_gpio48>;
-	bus-width = <4>;
-};
-
-&sdhost {
-	pinctrl-names = "default";
-	pinctrl-0 = <&sdhost_gpio48>;
-	status = "okay";
-	bus-width = <4>;
-};
-
 &usb {
 	power-domains = <&power RPI_POWER_DOMAIN_USB>;
 };
diff --git a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
index 7b4e651..f97ec95 100644
--- a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
+++ b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
@@ -113,6 +113,13 @@
 	status = "okay";
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio14>;
diff --git a/arch/arm/boot/dts/bcm2837-rpi-cm3-io3.dts b/arch/arm/boot/dts/bcm2837-rpi-cm3-io3.dts
index 6c8233a..433e306 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-cm3-io3.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-cm3-io3.dts
@@ -80,6 +80,13 @@
 	hpd-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>;
 };

+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_gpio14>;
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 05/18] ARM: dts: bcm283x: Define memory at board level
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (3 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 04/18] ARM: dts: bcm283x: Define MMC interfaces at board level Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 06/18] dt-bindings: bcm2835-cprman: Add bcm2838 support Stefan Wahren
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

Now with the varity of several RPi boards, the memory should be defined
at board level. This step gives us the chance to fix the memory size
of the RPi 1 B+, Zero (incl. W) and Compute Module 1.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 arch/arm/boot/dts/bcm2835-rpi-a-plus.dts   | 5 +++++
 arch/arm/boot/dts/bcm2835-rpi-a.dts        | 5 +++++
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts   | 5 +++++
 arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts   | 5 +++++
 arch/arm/boot/dts/bcm2835-rpi-b.dts        | 5 +++++
 arch/arm/boot/dts/bcm2835-rpi-cm1.dtsi     | 5 +++++
 arch/arm/boot/dts/bcm2835-rpi-zero-w.dts   | 5 +++++
 arch/arm/boot/dts/bcm2835-rpi-zero.dts     | 5 +++++
 arch/arm/boot/dts/bcm2835-rpi.dtsi         | 5 -----
 arch/arm/boot/dts/bcm2836-rpi-2-b.dts      | 1 +
 arch/arm/boot/dts/bcm2837-rpi-3-a-plus.dts | 1 +
 arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts | 1 +
 arch/arm/boot/dts/bcm2837-rpi-3-b.dts      | 1 +
 arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi     | 1 +
 14 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
index cb3f08d..5b42e9a 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
@@ -8,6 +8,11 @@
 	compatible = "raspberrypi,model-a-plus", "brcm,bcm2835";
 	model = "Raspberry Pi Model A+";

+	memory@0 {
+		device_type = "memory";
+		reg = <0 0x10000000>;
+	};
+
 	leds {
 		act {
 			gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-a.dts b/arch/arm/boot/dts/bcm2835-rpi-a.dts
index 2d167d9..b716214 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-a.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-a.dts
@@ -8,6 +8,11 @@
 	compatible = "raspberrypi,model-a", "brcm,bcm2835";
 	model = "Raspberry Pi Model A";

+	memory@0 {
+		device_type = "memory";
+		reg = <0 0x10000000>;
+	};
+
 	leds {
 		act {
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
index 83a3a60..3318082 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -9,6 +9,11 @@
 	compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
 	model = "Raspberry Pi Model B+";

+	memory@0 {
+		device_type = "memory";
+		reg = <0 0x20000000>;
+	};
+
 	leds {
 		act {
 			gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
index b6b4fea..97d7eb5 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
@@ -9,6 +9,11 @@
 	compatible = "raspberrypi,model-b-rev2", "brcm,bcm2835";
 	model = "Raspberry Pi Model B rev2";

+	memory@0 {
+		device_type = "memory";
+		reg = <0 0x10000000>;
+	};
+
 	leds {
 		act {
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index b5782fa..37e02a1 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -9,6 +9,11 @@
 	compatible = "raspberrypi,model-b", "brcm,bcm2835";
 	model = "Raspberry Pi Model B";

+	memory@0 {
+		device_type = "memory";
+		reg = <0 0x10000000>;
+	};
+
 	leds {
 		act {
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm1.dtsi b/arch/arm/boot/dts/bcm2835-rpi-cm1.dtsi
index ef22c2d..58059c2 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-cm1.dtsi
+++ b/arch/arm/boot/dts/bcm2835-rpi-cm1.dtsi
@@ -10,6 +10,11 @@
 		};
 	};

+	memory@0 {
+		device_type = "memory";
+		reg = <0 0x20000000>;
+	};
+
 	reg_3v3: fixed-regulator {
 		compatible = "regulator-fixed";
 		regulator-name = "3V3";
diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
index 5ecc403..f38f388 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
@@ -12,6 +12,11 @@
 	compatible = "raspberrypi,model-zero-w", "brcm,bcm2835";
 	model = "Raspberry Pi Zero W";

+	memory@0 {
+		device_type = "memory";
+		reg = <0 0x20000000>;
+	};
+
 	chosen {
 		/* 8250 auxiliary UART instead of pl011 */
 		stdout-path = "serial1:115200n8";
diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero.dts b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
index 84c7035..5fd0686 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-zero.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
@@ -12,6 +12,11 @@
 	compatible = "raspberrypi,model-zero", "brcm,bcm2835";
 	model = "Raspberry Pi Zero";

+	memory@0 {
+		device_type = "memory";
+		reg = <0 0x20000000>;
+	};
+
 	leds {
 		act {
 			gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
index 40bac52e..f5125b7 100644
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
@@ -1,11 +1,6 @@
 #include <dt-bindings/power/raspberrypi-power.h>

 / {
-	memory@0 {
-		device_type = "memory";
-		reg = <0 0x10000000>;
-	};
-
 	leds {
 		compatible = "gpio-leds";

diff --git a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
index f97ec95..6a89999 100644
--- a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
+++ b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
@@ -10,6 +10,7 @@
 	model = "Raspberry Pi 2 Model B";

 	memory@0 {
+		device_type = "memory";
 		reg = <0 0x40000000>;
 	};

diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-a-plus.dts b/arch/arm/boot/dts/bcm2837-rpi-3-a-plus.dts
index 7f4437a..0e29aaa 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-3-a-plus.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-a-plus.dts
@@ -14,6 +14,7 @@
 	};

 	memory@0 {
+		device_type = "memory";
 		reg = <0 0x20000000>;
 	};

diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
index c6fa34c..a1487ae 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
@@ -15,6 +15,7 @@
 	};

 	memory@0 {
+		device_type = "memory";
 		reg = <0 0x40000000>;
 	};

diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
index ce71f57..a36bfdb 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
@@ -15,6 +15,7 @@
 	};

 	memory@0 {
+		device_type = "memory";
 		reg = <0 0x40000000>;
 	};

diff --git a/arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi b/arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi
index 81399b2..7c3cb7e 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi
+++ b/arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi
@@ -5,6 +5,7 @@

 / {
 	memory@0 {
+		device_type = "memory";
 		reg = <0 0x40000000>;
 	};

--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 06/18] dt-bindings: bcm2835-cprman: Add bcm2838 support
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (4 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 05/18] ARM: dts: bcm283x: Define memory " Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support Stefan Wahren
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

The new BCM2838 supports an additional clock for the emmc2 block.
So we need an additional compatible.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt | 4 +++-
 include/dt-bindings/clock/bcm2835.h                             | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt b/Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt
index dd906db..e395795 100644
--- a/Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt
+++ b/Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt
@@ -12,7 +12,9 @@ clock generators, but a few (like the ARM or HDMI) will source from
 the PLL dividers directly.

 Required properties:
-- compatible:	Should be "brcm,bcm2835-cprman"
+- compatible:	should be one of the following,
+	"brcm,bcm2835-cprman"
+	"brcm,bcm2838-cprman"
 - #clock-cells:	Should be <1>. The permitted clock-specifier values can be
 		  found in include/dt-bindings/clock/bcm2835.h
 - reg:		Specifies base physical address and size of the registers
diff --git a/include/dt-bindings/clock/bcm2835.h b/include/dt-bindings/clock/bcm2835.h
index 2cec01f..d73acd8 100644
--- a/include/dt-bindings/clock/bcm2835.h
+++ b/include/dt-bindings/clock/bcm2835.h
@@ -58,3 +58,5 @@
 #define BCM2835_CLOCK_DSI1E		48
 #define BCM2835_CLOCK_DSI0P		49
 #define BCM2835_CLOCK_DSI1P		50
+
+#define BCM2838_CLOCK_EMMC2		51
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (5 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 06/18] dt-bindings: bcm2835-cprman: Add bcm2838 support Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-18  8:47   ` Matthias Brugger
  2019-07-17 19:50 ` [PATCH RFC 08/18] dt-bindings: sdhci-iproc: Add brcm,bcm2838-emmc2 Stefan Wahren
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

The new BCM2838 supports an additional clock for the emmc2 block.
So add a new compatible to register this clock only for BCM2838.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/clk/bcm/clk-bcm2835.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 867ae3c..5fe4695 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -31,7 +31,8 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/of_device.h>
+
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <dt-bindings/clock/bcm2835.h>
@@ -114,6 +115,8 @@
 #define CM_AVEODIV		0x1bc
 #define CM_EMMCCTL		0x1c0
 #define CM_EMMCDIV		0x1c4
+#define CM_EMMC2CTL		0x1d0
+#define CM_EMMC2DIV		0x1d4

 /* General bits for the CM_*CTL regs */
 # define CM_ENABLE			BIT(4)
@@ -1950,6 +1953,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
 		.frac_bits = 8,
 		.tcnt_mux = 39),

+	/* EMMC2 clock (only available for BCM2838) */
+	[BCM2838_CLOCK_EMMC2]	= REGISTER_PER_CLK(
+		.name = "emmc2",
+		.ctl_reg = CM_EMMC2CTL,
+		.div_reg = CM_EMMC2DIV,
+		.int_bits = 4,
+		.frac_bits = 8,
+		.tcnt_mux = 42),
+
 	/* General purpose (GPIO) clocks */
 	[BCM2835_CLOCK_GP0]	= REGISTER_PER_CLK(
 		.name = "gp0",
@@ -2101,6 +2113,14 @@ static int bcm2835_mark_sdc_parent_critical(struct clk *sdc)
 	return clk_prepare_enable(parent);
 }

+bool bcm2835_has_clk(size_t index) {
+	return index != BCM2838_CLOCK_EMMC2;
+}
+
+bool bcm2838_has_clk(size_t index) {
+	return true;
+}
+
 static int bcm2835_clk_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -2109,9 +2129,14 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
 	struct resource *res;
 	const struct bcm2835_clk_desc *desc;
 	const size_t asize = ARRAY_SIZE(clk_desc_array);
+	bool (*has_clk_func)(size_t);
 	size_t i;
 	int ret;

+	has_clk_func = of_device_get_match_data(&pdev->dev);
+	if (!has_clk_func)
+		return -ENODEV;
+
 	cprman = devm_kzalloc(dev,
 			      struct_size(cprman, onecell.hws, asize),
 			      GFP_KERNEL);
@@ -2146,6 +2171,9 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
 	hws = cprman->onecell.hws;

 	for (i = 0; i < asize; i++) {
+		if (!has_clk_func(i))
+			continue;
+
 		desc = &clk_desc_array[i];
 		if (desc->clk_register && desc->data)
 			hws[i] = desc->clk_register(cprman, desc->data);
@@ -2160,7 +2188,8 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
 }

 static const struct of_device_id bcm2835_clk_of_match[] = {
-	{ .compatible = "brcm,bcm2835-cprman", },
+	{ .compatible = "brcm,bcm2835-cprman", .data = bcm2835_has_clk },
+	{ .compatible = "brcm,bcm2838-cprman", .data = bcm2838_has_clk },
 	{}
 };
 MODULE_DEVICE_TABLE(of, bcm2835_clk_of_match);
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 08/18] dt-bindings: sdhci-iproc: Add brcm,bcm2838-emmc2
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (6 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838 Stefan Wahren
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

Add a new compatible for the additional emmc2 controller
on BCM2838 and clearify usage.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt b/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt
index fa90d25..18bf610 100644
--- a/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt
+++ b/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt
@@ -6,10 +6,12 @@ by mmc.txt and the properties that represent the IPROC SDHCI controller.
 Required properties:
 - compatible : Should be one of the following
 	       "brcm,bcm2835-sdhci"
+	       "brcm,bcm2838-emmc2"
 	       "brcm,sdhci-iproc-cygnus"
 	       "brcm,sdhci-iproc"

-Use brcm2835-sdhci for Rasperry PI.
+Use brcm2835-sdhci for the eMMC controller on the BCM2835 (Raspberry Pi) and
+bcm2838-emmc2 for the additional eMMC2 controller on BCM2838.

 Use sdhci-iproc-cygnus for Broadcom SDHCI Controllers
 restricted to 32bit host accesses to SDHCI registers.
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (7 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 08/18] dt-bindings: sdhci-iproc: Add brcm,bcm2838-emmc2 Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-18  8:34   ` Matthias Brugger
  2019-07-17 19:50 ` [PATCH RFC 10/18] pinctrl: bcm2835: bcm7211: Add support for 7211 pull-up functionality Stefan Wahren
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

The additional emmc2 interface of the BCM2838 is an improved version
of the old emmc controller, which is able to provide DDR50 mode on the
Raspberry Pi 4. Except 32 bit only register access no other quirks are
known yet.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/mmc/host/sdhci-iproc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index 2feb4ef..353cf997 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -261,8 +261,17 @@ static const struct sdhci_iproc_data bcm2835_data = {
 	.mmc_caps = 0x00000000,
 };

+static const struct sdhci_pltfm_data sdhci_bcm2838_pltfm_data = {
+	.ops = &sdhci_iproc_32only_ops,
+};
+
+static const struct sdhci_iproc_data bcm2838_data = {
+	.pdata = &sdhci_bcm2838_pltfm_data,
+};
+
 static const struct of_device_id sdhci_iproc_of_match[] = {
 	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
+	{ .compatible = "brcm,bcm2838-emmc2", .data = &bcm2838_data },
 	{ .compatible = "brcm,sdhci-iproc-cygnus", .data = &iproc_cygnus_data},
 	{ .compatible = "brcm,sdhci-iproc", .data = &iproc_data },
 	{ }
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 10/18] pinctrl: bcm2835: bcm7211: Add support for 7211 pull-up functionality
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (8 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838 Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-08-02 22:05   ` Linus Walleij
  2019-07-17 19:50 ` [PATCH RFC 11/18] pinctrl: bcm2835: Fix BCM7211 pinconf handling Stefan Wahren
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: Al Cooper, bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel

From: Al Cooper <alcooperx@gmail.com>

The 7211 has a new way of selecting the pull-up/pull-down setting
for a GPIO pin. The registers used for the bcm2837, GP_PUD and
GP_PUDCLKn0, are no longer connected. A new set of registers,
GP_GPIO_PUP_PDN_CNTRL_REGx must be used. This commit will add
a new compatible string "brcm,bcm7211-gpio" and the kernel
driver will use it to select which method is used to select
pull-up/pull-down.

Signed-off-by: Al Cooper <alcooperx@gmail.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 85 ++++++++++++++++++++++++++++++++---
 1 file changed, 80 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 183d1ff..35d9f95 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -57,15 +57,26 @@
 #define GPAFEN0		0x88	/* Pin Async Falling Edge Detect */
 #define GPPUD		0x94	/* Pin Pull-up/down Enable */
 #define GPPUDCLK0	0x98	/* Pin Pull-up/down Enable Clock */
+#define GP_GPIO_PUP_PDN_CNTRL_REG0 0xe4 /* 7211 Pin Pull-up/down select */

 #define FSEL_REG(p)		(GPFSEL0 + (((p) / 10) * 4))
 #define FSEL_SHIFT(p)		(((p) % 10) * 3)
 #define GPIO_REG_OFFSET(p)	((p) / 32)
 #define GPIO_REG_SHIFT(p)	((p) % 32)

+#define PUD_7211_MASK		0x3
+#define PUD_7211_REG_OFFSET(p)	((p) / 16)
+#define PUD_7211_REG_SHIFT(p)	(((p) % 16) * 2)
+
 /* argument: bcm2835_pinconf_pull */
 #define BCM2835_PINCONF_PARAM_PULL	(PIN_CONFIG_END + 1)

+enum bcm7211_pinconf_pull {
+	BCM7211_PINCONFIG_PULL_NONE,
+	BCM7211_PINCONFIG_PULL_UP,
+	BCM7211_PINCONFIG_PULL_DOWN,
+};
+
 struct bcm2835_pinctrl {
 	struct device *dev;
 	void __iomem *base;
@@ -975,6 +986,55 @@ static const struct pinconf_ops bcm2835_pinconf_ops = {
 	.pin_config_set = bcm2835_pinconf_set,
 };

+static int bcm7211_pinconf_set(struct pinctrl_dev *pctldev,
+			       unsigned int pin, unsigned long *configs,
+			       unsigned int num_configs)
+{
+	struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
+	u32 param, arg;
+	u32 shifter;
+	u32 value;
+	u32 off;
+	int i;
+
+	for (i = 0; i < num_configs; i++) {
+		param = pinconf_to_config_param(configs[i]);
+		if (param != BCM2835_PINCONF_PARAM_PULL)
+			return -EINVAL;
+		arg = pinconf_to_config_argument(configs[i]);
+
+		/* convert to 7211 value */
+		switch (arg) {
+		case PIN_CONFIG_BIAS_DISABLE:
+			arg = BCM7211_PINCONFIG_PULL_NONE;
+			break;
+		case PIN_CONFIG_BIAS_PULL_DOWN:
+			arg = BCM7211_PINCONFIG_PULL_DOWN;
+			break;
+		case PIN_CONFIG_BIAS_PULL_UP:
+			arg = BCM7211_PINCONFIG_PULL_UP;
+			break;
+		}
+
+		off = PUD_7211_REG_OFFSET(pin);
+		shifter = PUD_7211_REG_SHIFT(pin);
+
+		value = bcm2835_gpio_rd(pc, GP_GPIO_PUP_PDN_CNTRL_REG0 +
+					(off * 4));
+		value &= ~(PUD_7211_MASK << shifter);
+		value |= (arg << shifter);
+		bcm2835_gpio_wr(pc, GP_GPIO_PUP_PDN_CNTRL_REG0 + (off * 4),
+				value);
+	} /* for each config */
+
+	return 0;
+}
+
+static const struct pinconf_ops bcm7211_pinconf_ops = {
+	.pin_config_get = bcm2835_pinconf_get,
+	.pin_config_set = bcm7211_pinconf_set,
+};
+
 static struct pinctrl_desc bcm2835_pinctrl_desc = {
 	.name = MODULE_NAME,
 	.pins = bcm2835_gpio_pins,
@@ -990,6 +1050,18 @@ static struct pinctrl_gpio_range bcm2835_pinctrl_gpio_range = {
 	.npins = BCM2835_NUM_GPIOS,
 };

+static const struct of_device_id bcm2835_pinctrl_match[] = {
+	{
+		.compatible = "brcm,bcm2835-gpio",
+		.data = &bcm2835_pinconf_ops,
+	},
+	{
+		.compatible = "brcm,bcm7211-gpio",
+		.data = &bcm7211_pinconf_ops,
+	},
+	{}
+};
+
 static int bcm2835_pinctrl_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -997,6 +1069,8 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
 	struct bcm2835_pinctrl *pc;
 	struct resource iomem;
 	int err, i;
+	const struct of_device_id *match;
+
 	BUILD_BUG_ON(ARRAY_SIZE(bcm2835_gpio_pins) != BCM2835_NUM_GPIOS);
 	BUILD_BUG_ON(ARRAY_SIZE(bcm2835_gpio_groups) != BCM2835_NUM_GPIOS);

@@ -1073,6 +1147,12 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
 					     bcm2835_gpio_irq_handler);
 	}

+	match = of_match_node(bcm2835_pinctrl_match, pdev->dev.of_node);
+	if (match) {
+		bcm2835_pinctrl_desc.confops =
+			(const struct pinconf_ops *)match->data;
+	}
+
 	pc->pctl_dev = devm_pinctrl_register(dev, &bcm2835_pinctrl_desc, pc);
 	if (IS_ERR(pc->pctl_dev)) {
 		gpiochip_remove(&pc->gpio_chip);
@@ -1087,11 +1167,6 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 }

-static const struct of_device_id bcm2835_pinctrl_match[] = {
-	{ .compatible = "brcm,bcm2835-gpio" },
-	{}
-};
-
 static struct platform_driver bcm2835_pinctrl_driver = {
 	.probe = bcm2835_pinctrl_probe,
 	.driver = {
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 11/18] pinctrl: bcm2835: Fix BCM7211 pinconf handling
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (9 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 10/18] pinctrl: bcm2835: bcm7211: Add support for 7211 pull-up functionality Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-08-02 22:06   ` Linus Walleij
  2019-07-17 19:50 ` [PATCH RFC 12/18] dt-bindings: pinctrl: bcm2835: Add brcm, bcm2838 compatible Stefan Wahren
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

The BCM7211 pinconf doesn't look correct and behaves differently
to BCM2835. So fix this accordingly.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 35d9f95..029adad 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -999,12 +999,10 @@ static int bcm7211_pinconf_set(struct pinctrl_dev *pctldev,

 	for (i = 0; i < num_configs; i++) {
 		param = pinconf_to_config_param(configs[i]);
-		if (param != BCM2835_PINCONF_PARAM_PULL)
-			return -EINVAL;
 		arg = pinconf_to_config_argument(configs[i]);

 		/* convert to 7211 value */
-		switch (arg) {
+		switch (param) {
 		case PIN_CONFIG_BIAS_DISABLE:
 			arg = BCM7211_PINCONFIG_PULL_NONE;
 			break;
@@ -1014,6 +1012,8 @@ static int bcm7211_pinconf_set(struct pinctrl_dev *pctldev,
 		case PIN_CONFIG_BIAS_PULL_UP:
 			arg = BCM7211_PINCONFIG_PULL_UP;
 			break;
+		default:
+			return -ENOTSUPP;
 		}

 		off = PUD_7211_REG_OFFSET(pin);
@@ -1031,6 +1031,7 @@ static int bcm7211_pinconf_set(struct pinctrl_dev *pctldev,
 }

 static const struct pinconf_ops bcm7211_pinconf_ops = {
+	.is_generic = true,
 	.pin_config_get = bcm2835_pinconf_get,
 	.pin_config_set = bcm7211_pinconf_set,
 };
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 12/18] dt-bindings: pinctrl: bcm2835: Add brcm, bcm2838 compatible
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (10 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 11/18] pinctrl: bcm2835: Fix BCM7211 pinconf handling Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-07-17 19:50 ` [PATCH RFC 13/18] pinctrl: bcm2835: Add BCM2838 support Stefan Wahren
  2019-07-18 18:45 ` [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Eric Anholt
  13 siblings, 0 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

Add a new compatible for the BCM2838.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt b/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt
index ac6d614..f7835a6 100644
--- a/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt
+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt
@@ -7,6 +7,7 @@ Required properties:
 - compatible: "brcm,bcm2835-gpio"
 - compatible: should be one of:
   "brcm,bcm2835-gpio" - BCM2835 compatible pinctrl
+  "brcm,bcm2838-gpio" - BCM2838 compatible pinctrl
   "brcm,bcm7211-gpio" - BCM7211 compatible pinctrl
 - reg: Should contain the physical address of the GPIO module's registers.
 - gpio-controller: Marks the device node as a GPIO controller.
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH RFC 13/18] pinctrl: bcm2835: Add BCM2838 support
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (11 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 12/18] dt-bindings: pinctrl: bcm2835: Add brcm, bcm2838 compatible Stefan Wahren
@ 2019-07-17 19:50 ` Stefan Wahren
  2019-08-02 22:08   ` Linus Walleij
  2019-07-18 18:45 ` [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Eric Anholt
  13 siblings, 1 reply; 32+ messages in thread
From: Stefan Wahren @ 2019-07-17 19:50 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren

The pinctrl on the BCM2711 is not backward compatible to the BCM2835.
So use the compatible ops of the BCM7211.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 029adad..7f7cc5c 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -1057,6 +1057,10 @@ static const struct of_device_id bcm2835_pinctrl_match[] = {
 		.data = &bcm2835_pinconf_ops,
 	},
 	{
+		.compatible = "brcm,bcm2838-gpio",
+		.data = &bcm7211_pinconf_ops,
+	},
+	{
 		.compatible = "brcm,bcm7211-gpio",
 		.data = &bcm7211_pinconf_ops,
 	},
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838
  2019-07-17 19:50 ` [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838 Stefan Wahren
@ 2019-07-18  8:34   ` Matthias Brugger
  2019-07-18 16:40     ` Florian Fainelli
  0 siblings, 1 reply; 32+ messages in thread
From: Matthias Brugger @ 2019-07-18  8:34 UTC (permalink / raw)
  To: Stefan Wahren, Eric Anholt, Florian Fainelli, Ray Jui,
	Scott Branden, Nicolas Saenz Julienne, Rob Herring, Mark Rutland,
	Linus Walleij, Michael Turquette, Stephen Boyd, Ulf Hansson,
	Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel



On 17/07/2019 21:50, Stefan Wahren wrote:
> The additional emmc2 interface of the BCM2838 is an improved version
> of the old emmc controller, which is able to provide DDR50 mode on the
> Raspberry Pi 4. Except 32 bit only register access no other quirks are
> known yet.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  drivers/mmc/host/sdhci-iproc.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 2feb4ef..353cf997 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -261,8 +261,17 @@ static const struct sdhci_iproc_data bcm2835_data = {
>  	.mmc_caps = 0x00000000,
>  };
> 
> +static const struct sdhci_pltfm_data sdhci_bcm2838_pltfm_data = {
> +	.ops = &sdhci_iproc_32only_ops,
> +};
> +
> +static const struct sdhci_iproc_data bcm2838_data = {
> +	.pdata = &sdhci_bcm2838_pltfm_data,
> +};
> +
>  static const struct of_device_id sdhci_iproc_of_match[] = {
>  	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
> +	{ .compatible = "brcm,bcm2838-emmc2", .data = &bcm2838_data },

As far as I'm aware of, the RPi4 FW provides a device-tree with compatible:
brcm,bcm2711-emmc2. Shouldn't we add this as well so that we can use the DT
passed by the FW?

Regards,
Matthias

>  	{ .compatible = "brcm,sdhci-iproc-cygnus", .data = &iproc_cygnus_data},
>  	{ .compatible = "brcm,sdhci-iproc", .data = &iproc_data },
>  	{ }
> --
> 2.7.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support
  2019-07-17 19:50 ` [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support Stefan Wahren
@ 2019-07-18  8:47   ` Matthias Brugger
  2019-07-18 16:51     ` Florian Fainelli
  0 siblings, 1 reply; 32+ messages in thread
From: Matthias Brugger @ 2019-07-18  8:47 UTC (permalink / raw)
  To: Stefan Wahren, Eric Anholt, Florian Fainelli, Ray Jui,
	Scott Branden, Nicolas Saenz Julienne, Rob Herring, Mark Rutland,
	Linus Walleij, Michael Turquette, Stephen Boyd, Ulf Hansson,
	Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel



On 17/07/2019 21:50, Stefan Wahren wrote:
> The new BCM2838 supports an additional clock for the emmc2 block.
> So add a new compatible to register this clock only for BCM2838.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  drivers/clk/bcm/clk-bcm2835.c | 33 +++++++++++++++++++++++++++++++--
>  1 file changed, 31 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
> index 867ae3c..5fe4695 100644
> --- a/drivers/clk/bcm/clk-bcm2835.c
> +++ b/drivers/clk/bcm/clk-bcm2835.c
> @@ -31,7 +31,8 @@
>  #include <linux/delay.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> -#include <linux/of.h>
> +#include <linux/of_device.h>
> +
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
>  #include <dt-bindings/clock/bcm2835.h>
> @@ -114,6 +115,8 @@
>  #define CM_AVEODIV		0x1bc
>  #define CM_EMMCCTL		0x1c0
>  #define CM_EMMCDIV		0x1c4
> +#define CM_EMMC2CTL		0x1d0
> +#define CM_EMMC2DIV		0x1d4
> 
>  /* General bits for the CM_*CTL regs */
>  # define CM_ENABLE			BIT(4)
> @@ -1950,6 +1953,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
>  		.frac_bits = 8,
>  		.tcnt_mux = 39),
> 
> +	/* EMMC2 clock (only available for BCM2838) */
> +	[BCM2838_CLOCK_EMMC2]	= REGISTER_PER_CLK(
> +		.name = "emmc2",
> +		.ctl_reg = CM_EMMC2CTL,
> +		.div_reg = CM_EMMC2DIV,
> +		.int_bits = 4,
> +		.frac_bits = 8,
> +		.tcnt_mux = 42),
> +
>  	/* General purpose (GPIO) clocks */
>  	[BCM2835_CLOCK_GP0]	= REGISTER_PER_CLK(
>  		.name = "gp0",
> @@ -2101,6 +2113,14 @@ static int bcm2835_mark_sdc_parent_critical(struct clk *sdc)
>  	return clk_prepare_enable(parent);
>  }
> 
> +bool bcm2835_has_clk(size_t index) {
> +	return index != BCM2838_CLOCK_EMMC2;
> +}
> +
> +bool bcm2838_has_clk(size_t index) {
> +	return true;
> +}
> +
>  static int bcm2835_clk_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> @@ -2109,9 +2129,14 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>  	struct resource *res;
>  	const struct bcm2835_clk_desc *desc;
>  	const size_t asize = ARRAY_SIZE(clk_desc_array);
> +	bool (*has_clk_func)(size_t);
>  	size_t i;
>  	int ret;
> 
> +	has_clk_func = of_device_get_match_data(&pdev->dev);
> +	if (!has_clk_func)
> +		return -ENODEV;
> +
>  	cprman = devm_kzalloc(dev,
>  			      struct_size(cprman, onecell.hws, asize),
>  			      GFP_KERNEL);
> @@ -2146,6 +2171,9 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>  	hws = cprman->onecell.hws;
> 
>  	for (i = 0; i < asize; i++) {
> +		if (!has_clk_func(i))
> +			continue;
> +

I think that's very hacky. Can't we just create a per SoC list which get's
passed via .data and in probe we iterate through that list and enable the
clocks? That would make clear which clocks are just for bcm2838, basically emmc2.

Regards,
Matthias

>  		desc = &clk_desc_array[i];
>  		if (desc->clk_register && desc->data)
>  			hws[i] = desc->clk_register(cprman, desc->data);
> @@ -2160,7 +2188,8 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>  }
> 
>  static const struct of_device_id bcm2835_clk_of_match[] = {
> -	{ .compatible = "brcm,bcm2835-cprman", },
> +	{ .compatible = "brcm,bcm2835-cprman", .data = bcm2835_has_clk },
> +	{ .compatible = "brcm,bcm2838-cprman", .data = bcm2838_has_clk },
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, bcm2835_clk_of_match);
> --
> 2.7.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838
  2019-07-18  8:34   ` Matthias Brugger
@ 2019-07-18 16:40     ` Florian Fainelli
  2019-07-18 16:48       ` Matthias Brugger
  0 siblings, 1 reply; 32+ messages in thread
From: Florian Fainelli @ 2019-07-18 16:40 UTC (permalink / raw)
  To: Matthias Brugger, Stefan Wahren, Eric Anholt, Florian Fainelli,
	Ray Jui, Scott Branden, Nicolas Saenz Julienne, Rob Herring,
	Mark Rutland, Linus Walleij, Michael Turquette, Stephen Boyd,
	Ulf Hansson, Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel



On 7/18/2019 1:34 AM, Matthias Brugger wrote:

[snip]

>>  static const struct of_device_id sdhci_iproc_of_match[] = {
>>  	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
>> +	{ .compatible = "brcm,bcm2838-emmc2", .data = &bcm2838_data },
> 
> As far as I'm aware of, the RPi4 FW provides a device-tree with compatible:
> brcm,bcm2711-emmc2. Shouldn't we add this as well so that we can use the DT
> passed by the FW?

Downstream typically used 2708, 2709, 2710 because those are the
Broadcom internal part numbers, and upstream has been using what's on
the package: 2835, 2836, 2837, 2838. At the end of the day, it does not
make much functional difference, but if if we have to be consistent,
then Stefan's approach here follows the consistency here.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838
  2019-07-18 16:40     ` Florian Fainelli
@ 2019-07-18 16:48       ` Matthias Brugger
  2019-07-18 16:52         ` Florian Fainelli
                           ` (2 more replies)
  0 siblings, 3 replies; 32+ messages in thread
From: Matthias Brugger @ 2019-07-18 16:48 UTC (permalink / raw)
  To: Florian Fainelli, Stefan Wahren, Eric Anholt, Ray Jui,
	Scott Branden, Nicolas Saenz Julienne, Rob Herring, Mark Rutland,
	Linus Walleij, Michael Turquette, Stephen Boyd, Ulf Hansson,
	Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel



On 18/07/2019 18:40, Florian Fainelli wrote:
> 
> 
> On 7/18/2019 1:34 AM, Matthias Brugger wrote:
> 
> [snip]
> 
>>>  static const struct of_device_id sdhci_iproc_of_match[] = {
>>>  	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
>>> +	{ .compatible = "brcm,bcm2838-emmc2", .data = &bcm2838_data },
>>
>> As far as I'm aware of, the RPi4 FW provides a device-tree with compatible:
>> brcm,bcm2711-emmc2. Shouldn't we add this as well so that we can use the DT
>> passed by the FW?
> 
> Downstream typically used 2708, 2709, 2710 because those are the
> Broadcom internal part numbers, and upstream has been using what's on
> the package: 2835, 2836, 2837, 2838. At the end of the day, it does not
> make much functional difference, but if if we have to be consistent,
> then Stefan's approach here follows the consistency here.
> 

So I propose to add both, so that we can use the upstream kernel with downstream
devcie-tree. I'm thinking of the device-tree provided at run-time by the FW.

Regards,
Matthias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support
  2019-07-18  8:47   ` Matthias Brugger
@ 2019-07-18 16:51     ` Florian Fainelli
  2019-07-18 18:37       ` Eric Anholt
  0 siblings, 1 reply; 32+ messages in thread
From: Florian Fainelli @ 2019-07-18 16:51 UTC (permalink / raw)
  To: Matthias Brugger, Stefan Wahren, Eric Anholt, Florian Fainelli,
	Ray Jui, Scott Branden, Nicolas Saenz Julienne, Rob Herring,
	Mark Rutland, Linus Walleij, Michael Turquette, Stephen Boyd,
	Ulf Hansson, Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel



On 7/18/2019 1:47 AM, Matthias Brugger wrote:
> 
> 
> On 17/07/2019 21:50, Stefan Wahren wrote:
>> The new BCM2838 supports an additional clock for the emmc2 block.
>> So add a new compatible to register this clock only for BCM2838.
>>
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>> ---
>>  drivers/clk/bcm/clk-bcm2835.c | 33 +++++++++++++++++++++++++++++++--
>>  1 file changed, 31 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
>> index 867ae3c..5fe4695 100644
>> --- a/drivers/clk/bcm/clk-bcm2835.c
>> +++ b/drivers/clk/bcm/clk-bcm2835.c
>> @@ -31,7 +31,8 @@
>>  #include <linux/delay.h>
>>  #include <linux/io.h>
>>  #include <linux/module.h>
>> -#include <linux/of.h>
>> +#include <linux/of_device.h>
>> +
>>  #include <linux/platform_device.h>
>>  #include <linux/slab.h>
>>  #include <dt-bindings/clock/bcm2835.h>
>> @@ -114,6 +115,8 @@
>>  #define CM_AVEODIV		0x1bc
>>  #define CM_EMMCCTL		0x1c0
>>  #define CM_EMMCDIV		0x1c4
>> +#define CM_EMMC2CTL		0x1d0
>> +#define CM_EMMC2DIV		0x1d4
>>
>>  /* General bits for the CM_*CTL regs */
>>  # define CM_ENABLE			BIT(4)
>> @@ -1950,6 +1953,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
>>  		.frac_bits = 8,
>>  		.tcnt_mux = 39),
>>
>> +	/* EMMC2 clock (only available for BCM2838) */
>> +	[BCM2838_CLOCK_EMMC2]	= REGISTER_PER_CLK(
>> +		.name = "emmc2",
>> +		.ctl_reg = CM_EMMC2CTL,
>> +		.div_reg = CM_EMMC2DIV,
>> +		.int_bits = 4,
>> +		.frac_bits = 8,
>> +		.tcnt_mux = 42),
>> +
>>  	/* General purpose (GPIO) clocks */
>>  	[BCM2835_CLOCK_GP0]	= REGISTER_PER_CLK(
>>  		.name = "gp0",
>> @@ -2101,6 +2113,14 @@ static int bcm2835_mark_sdc_parent_critical(struct clk *sdc)
>>  	return clk_prepare_enable(parent);
>>  }
>>
>> +bool bcm2835_has_clk(size_t index) {
>> +	return index != BCM2838_CLOCK_EMMC2;
>> +}
>> +
>> +bool bcm2838_has_clk(size_t index) {
>> +	return true;
>> +}
>> +
>>  static int bcm2835_clk_probe(struct platform_device *pdev)
>>  {
>>  	struct device *dev = &pdev->dev;
>> @@ -2109,9 +2129,14 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>>  	struct resource *res;
>>  	const struct bcm2835_clk_desc *desc;
>>  	const size_t asize = ARRAY_SIZE(clk_desc_array);
>> +	bool (*has_clk_func)(size_t);
>>  	size_t i;
>>  	int ret;
>>
>> +	has_clk_func = of_device_get_match_data(&pdev->dev);
>> +	if (!has_clk_func)
>> +		return -ENODEV;
>> +
>>  	cprman = devm_kzalloc(dev,
>>  			      struct_size(cprman, onecell.hws, asize),
>>  			      GFP_KERNEL);
>> @@ -2146,6 +2171,9 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>>  	hws = cprman->onecell.hws;
>>
>>  	for (i = 0; i < asize; i++) {
>> +		if (!has_clk_func(i))
>> +			continue;
>> +
> 
> I think that's very hacky. Can't we just create a per SoC list which get's
> passed via .data and in probe we iterate through that list and enable the
> clocks? That would make clear which clocks are just for bcm2838, basically emmc2.

Or within the structure, add a flag that indicates whether the clock is
available or not for a given chip? That would avoid having to introduce
bcm283x_has_clk() functions that needs to maintain a possibly growing
list of clocks. You would still have to check the flag though.

The trade-off here is a large table (larger than necessary) versus more
run time checks.

We could consider having a base table that gets copied into a bcm2838
specific table, and overlay that base structure with what's specific
with bcm2838, is that you have in mind?
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838
  2019-07-18 16:48       ` Matthias Brugger
@ 2019-07-18 16:52         ` Florian Fainelli
  2019-07-18 17:46         ` Stefan Wahren
  2019-07-18 18:09         ` Stefan Wahren
  2 siblings, 0 replies; 32+ messages in thread
From: Florian Fainelli @ 2019-07-18 16:52 UTC (permalink / raw)
  To: Matthias Brugger, Florian Fainelli, Stefan Wahren, Eric Anholt,
	Ray Jui, Scott Branden, Nicolas Saenz Julienne, Rob Herring,
	Mark Rutland, Linus Walleij, Michael Turquette, Stephen Boyd,
	Ulf Hansson, Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel



On 7/18/2019 9:48 AM, Matthias Brugger wrote:
> 
> 
> On 18/07/2019 18:40, Florian Fainelli wrote:
>>
>>
>> On 7/18/2019 1:34 AM, Matthias Brugger wrote:
>>
>> [snip]
>>
>>>>  static const struct of_device_id sdhci_iproc_of_match[] = {
>>>>  	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
>>>> +	{ .compatible = "brcm,bcm2838-emmc2", .data = &bcm2838_data },
>>>
>>> As far as I'm aware of, the RPi4 FW provides a device-tree with compatible:
>>> brcm,bcm2711-emmc2. Shouldn't we add this as well so that we can use the DT
>>> passed by the FW?
>>
>> Downstream typically used 2708, 2709, 2710 because those are the
>> Broadcom internal part numbers, and upstream has been using what's on
>> the package: 2835, 2836, 2837, 2838. At the end of the day, it does not
>> make much functional difference, but if if we have to be consistent,
>> then Stefan's approach here follows the consistency here.
>>
> 
> So I propose to add both, so that we can use the upstream kernel with downstream
> devcie-tree. I'm thinking of the device-tree provided at run-time by the FW.

Adding both for the Pi4 (2711) specifically, or should we go back and
also add bcm2708/9/10?

The Device Tree on the Pi can be updated (AFAICT), so the ABI concerns,
and the requirement for upstream to maintain backwards compatibility
with a binding that has not been submitted/reviewed is not going to be a
compelling argument IMHO.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838
  2019-07-18 16:48       ` Matthias Brugger
  2019-07-18 16:52         ` Florian Fainelli
@ 2019-07-18 17:46         ` Stefan Wahren
  2019-07-18 18:09         ` Stefan Wahren
  2 siblings, 0 replies; 32+ messages in thread
From: Stefan Wahren @ 2019-07-18 17:46 UTC (permalink / raw)
  To: Matthias Brugger, Florian Fainelli, Eric Anholt, Ray Jui,
	Scott Branden, Nicolas Saenz Julienne, Rob Herring, Mark Rutland,
	Linus Walleij, Michael Turquette, Stephen Boyd, Ulf Hansson,
	Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel

Am 18.07.19 um 18:48 schrieb Matthias Brugger:
>
> On 18/07/2019 18:40, Florian Fainelli wrote:
>>
>> On 7/18/2019 1:34 AM, Matthias Brugger wrote:
>>
>> [snip]
>>
>>>>  static const struct of_device_id sdhci_iproc_of_match[] = {
>>>>  	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
>>>> +	{ .compatible = "brcm,bcm2838-emmc2", .data = &bcm2838_data },
>>> As far as I'm aware of, the RPi4 FW provides a device-tree with compatible:
>>> brcm,bcm2711-emmc2. Shouldn't we add this as well so that we can use the DT
>>> passed by the FW?
>> Downstream typically used 2708, 2709, 2710 because those are the
>> Broadcom internal part numbers, and upstream has been using what's on
>> the package: 2835, 2836, 2837, 2838. At the end of the day, it does not
>> make much functional difference, but if if we have to be consistent,
>> then Stefan's approach here follows the consistency here.
>>
> So I propose to add both, so that we can use the upstream kernel with downstream
> devcie-tree. I'm thinking of the device-tree provided at run-time by the FW.

AFAIK the FW doesn't know anything about the devicetree part of the
emmc2. So i suggest to add the upstream compatible in the downstream
tree. This way we keep out all the downstream stuff (as before) and
avoid confusion in the devicetree bindings.

Stefan

>
> Regards,
> Matthias
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838
  2019-07-18 16:48       ` Matthias Brugger
  2019-07-18 16:52         ` Florian Fainelli
  2019-07-18 17:46         ` Stefan Wahren
@ 2019-07-18 18:09         ` Stefan Wahren
  2019-07-18 18:19           ` Andrei Gherzan
  2 siblings, 1 reply; 32+ messages in thread
From: Stefan Wahren @ 2019-07-18 18:09 UTC (permalink / raw)
  To: Matthias Brugger, Florian Fainelli, Eric Anholt, Ray Jui,
	Scott Branden, Nicolas Saenz Julienne, Rob Herring, Mark Rutland,
	Linus Walleij, Michael Turquette, Stephen Boyd, Ulf Hansson,
	Adrian Hunter, Mark Brown
  Cc: Andrei Gherzan, bcm-kernel-feedback-list, linux-rpi-kernel,
	linux-arm-kernel

Hi Matthias,

Am 18.07.19 um 18:48 schrieb Matthias Brugger:
>
> On 18/07/2019 18:40, Florian Fainelli wrote:
>>
>> On 7/18/2019 1:34 AM, Matthias Brugger wrote:
>>
>> [snip]
>>
>>>>  static const struct of_device_id sdhci_iproc_of_match[] = {
>>>>  	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
>>>> +	{ .compatible = "brcm,bcm2838-emmc2", .data = &bcm2838_data },
>>> As far as I'm aware of, the RPi4 FW provides a device-tree with compatible:
>>> brcm,bcm2711-emmc2. Shouldn't we add this as well so that we can use the DT
>>> passed by the FW?
>> Downstream typically used 2708, 2709, 2710 because those are the
>> Broadcom internal part numbers, and upstream has been using what's on
>> the package: 2835, 2836, 2837, 2838. At the end of the day, it does not
>> make much functional difference, but if if we have to be consistent,
>> then Stefan's approach here follows the consistency here.
>>
> So I propose to add both, so that we can use the upstream kernel with downstream
> devcie-tree. I'm thinking of the device-tree provided at run-time by the FW.

sorry for the second mail, but this is a slightly different topic. I've
seen that Andrei already submitted a patch series for u-boot with a
different DTS file.

In the past, we had the following workflow for DTS submission to u-boot:

Downstream --> Mainline Kernel --> Mainline U-Boot

So we have at least one review by the devicetree maintainers and avoid
inconsistence. It would be nice to keep this.

Stefan

>
> Regards,
> Matthias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838
  2019-07-18 18:09         ` Stefan Wahren
@ 2019-07-18 18:19           ` Andrei Gherzan
  0 siblings, 0 replies; 32+ messages in thread
From: Andrei Gherzan @ 2019-07-18 18:19 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Florian Fainelli, Eric Anholt,
	Ray Jui, Scott Branden, Nicolas Saenz Julienne, Rob Herring,
	Mark Rutland, Linus Walleij, Michael Turquette, Stephen Boyd,
	Ulf Hansson, Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel

Hi Stefan, 

On 18 July 2019 19:09:09 BST, Stefan Wahren <wahrenst@gmx.net> wrote:
>Hi Matthias,
>
>Am 18.07.19 um 18:48 schrieb Matthias Brugger:
>>
>> On 18/07/2019 18:40, Florian Fainelli wrote:
>>>
>>> On 7/18/2019 1:34 AM, Matthias Brugger wrote:
>>>
>>> [snip]
>>>
>>>>>  static const struct of_device_id sdhci_iproc_of_match[] = {
>>>>>  	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
>>>>> +	{ .compatible = "brcm,bcm2838-emmc2", .data = &bcm2838_data },
>>>> As far as I'm aware of, the RPi4 FW provides a device-tree with
>compatible:
>>>> brcm,bcm2711-emmc2. Shouldn't we add this as well so that we can
>use the DT
>>>> passed by the FW?
>>> Downstream typically used 2708, 2709, 2710 because those are the
>>> Broadcom internal part numbers, and upstream has been using what's
>on
>>> the package: 2835, 2836, 2837, 2838. At the end of the day, it does
>not
>>> make much functional difference, but if if we have to be consistent,
>>> then Stefan's approach here follows the consistency here.
>>>
>> So I propose to add both, so that we can use the upstream kernel with
>downstream
>> devcie-tree. I'm thinking of the device-tree provided at run-time by
>the FW.
>
>sorry for the second mail, but this is a slightly different topic. I've
>seen that Andrei already submitted a patch series for u-boot with a
>different DTS file.
>
>In the past, we had the following workflow for DTS submission to
>u-boot:
>
>Downstream --> Mainline Kernel --> Mainline U-Boot
>
>So we have at least one review by the devicetree maintainers and avoid
>inconsistence. It would be nice to keep this.
>

I had a private discussion with Matthias and we dropped the dts files completely relying only on the one provided by the firmware. I'll post a v2 tomorrow. 

--
Andrei Gherzan
gpg: rsa4096/D4D94F67AD0E9640 | t: @agherzan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support
  2019-07-18 16:51     ` Florian Fainelli
@ 2019-07-18 18:37       ` Eric Anholt
  2019-07-19 16:40         ` Stefan Wahren
  0 siblings, 1 reply; 32+ messages in thread
From: Eric Anholt @ 2019-07-18 18:37 UTC (permalink / raw)
  To: Florian Fainelli, Matthias Brugger, Stefan Wahren,
	Florian Fainelli, Ray Jui, Scott Branden, Nicolas Saenz Julienne,
	Rob Herring, Mark Rutland, Linus Walleij, Michael Turquette,
	Stephen Boyd, Ulf Hansson, Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 3549 bytes --]

Florian Fainelli <f.fainelli@gmail.com> writes:

> On 7/18/2019 1:47 AM, Matthias Brugger wrote:
>> 
>> 
>> On 17/07/2019 21:50, Stefan Wahren wrote:
>>> The new BCM2838 supports an additional clock for the emmc2 block.
>>> So add a new compatible to register this clock only for BCM2838.
>>>
>>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>>> ---
>>>  drivers/clk/bcm/clk-bcm2835.c | 33 +++++++++++++++++++++++++++++++--
>>>  1 file changed, 31 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
>>> index 867ae3c..5fe4695 100644
>>> --- a/drivers/clk/bcm/clk-bcm2835.c
>>> +++ b/drivers/clk/bcm/clk-bcm2835.c
>>> @@ -31,7 +31,8 @@
>>>  #include <linux/delay.h>
>>>  #include <linux/io.h>
>>>  #include <linux/module.h>
>>> -#include <linux/of.h>
>>> +#include <linux/of_device.h>
>>> +
>>>  #include <linux/platform_device.h>
>>>  #include <linux/slab.h>
>>>  #include <dt-bindings/clock/bcm2835.h>
>>> @@ -114,6 +115,8 @@
>>>  #define CM_AVEODIV		0x1bc
>>>  #define CM_EMMCCTL		0x1c0
>>>  #define CM_EMMCDIV		0x1c4
>>> +#define CM_EMMC2CTL		0x1d0
>>> +#define CM_EMMC2DIV		0x1d4
>>>
>>>  /* General bits for the CM_*CTL regs */
>>>  # define CM_ENABLE			BIT(4)
>>> @@ -1950,6 +1953,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
>>>  		.frac_bits = 8,
>>>  		.tcnt_mux = 39),
>>>
>>> +	/* EMMC2 clock (only available for BCM2838) */
>>> +	[BCM2838_CLOCK_EMMC2]	= REGISTER_PER_CLK(
>>> +		.name = "emmc2",
>>> +		.ctl_reg = CM_EMMC2CTL,
>>> +		.div_reg = CM_EMMC2DIV,
>>> +		.int_bits = 4,
>>> +		.frac_bits = 8,
>>> +		.tcnt_mux = 42),
>>> +
>>>  	/* General purpose (GPIO) clocks */
>>>  	[BCM2835_CLOCK_GP0]	= REGISTER_PER_CLK(
>>>  		.name = "gp0",
>>> @@ -2101,6 +2113,14 @@ static int bcm2835_mark_sdc_parent_critical(struct clk *sdc)
>>>  	return clk_prepare_enable(parent);
>>>  }
>>>
>>> +bool bcm2835_has_clk(size_t index) {
>>> +	return index != BCM2838_CLOCK_EMMC2;
>>> +}
>>> +
>>> +bool bcm2838_has_clk(size_t index) {
>>> +	return true;
>>> +}
>>> +
>>>  static int bcm2835_clk_probe(struct platform_device *pdev)
>>>  {
>>>  	struct device *dev = &pdev->dev;
>>> @@ -2109,9 +2129,14 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>>>  	struct resource *res;
>>>  	const struct bcm2835_clk_desc *desc;
>>>  	const size_t asize = ARRAY_SIZE(clk_desc_array);
>>> +	bool (*has_clk_func)(size_t);
>>>  	size_t i;
>>>  	int ret;
>>>
>>> +	has_clk_func = of_device_get_match_data(&pdev->dev);
>>> +	if (!has_clk_func)
>>> +		return -ENODEV;
>>> +
>>>  	cprman = devm_kzalloc(dev,
>>>  			      struct_size(cprman, onecell.hws, asize),
>>>  			      GFP_KERNEL);
>>> @@ -2146,6 +2171,9 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>>>  	hws = cprman->onecell.hws;
>>>
>>>  	for (i = 0; i < asize; i++) {
>>> +		if (!has_clk_func(i))
>>> +			continue;
>>> +
>> 
>> I think that's very hacky. Can't we just create a per SoC list which get's
>> passed via .data and in probe we iterate through that list and enable the
>> clocks? That would make clear which clocks are just for bcm2838, basically emmc2.
>
> Or within the structure, add a flag that indicates whether the clock is
> available or not for a given chip? That would avoid having to introduce
> bcm283x_has_clk() functions that needs to maintain a possibly growing
> list of clocks. You would still have to check the flag though.

I think this is a good solution.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support
  2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
                   ` (12 preceding siblings ...)
  2019-07-17 19:50 ` [PATCH RFC 13/18] pinctrl: bcm2835: Add BCM2838 support Stefan Wahren
@ 2019-07-18 18:45 ` Eric Anholt
  2019-07-18 18:58   ` Florian Fainelli
  2019-07-19 13:18   ` Nicolas Saenz Julienne
  13 siblings, 2 replies; 32+ messages in thread
From: Eric Anholt @ 2019-07-18 18:45 UTC (permalink / raw)
  To: Stefan Wahren, Florian Fainelli, Ray Jui, Scott Branden,
	Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren


[-- Attachment #1.1: Type: text/plain, Size: 1523 bytes --]

Stefan Wahren <wahrenst@gmx.net> writes:

> This series adds minimal support for the new Raspberry Pi 4, so we are able
> to login via debug UART.
>
> Patch 1-5:   Prepare platform and DTS for the new SoC BMC2838
> Patch 6-9:   Enable support for emmc2 on BCM2838
> Patch 10-14: Enable pinctrl for BCM2838
> Patch 15:    Enable SPI support for BCM2838
> Patch 16-18: Add Raspberry Pi 4 DTS support
>
> Unfortunately the Raspberry Pi Foundation didn't released a
> peripheral documentation for the new SoC yet. So we only have a preliminary
> datasheet [1] and reduced schematics [2].
>
> This series is marked as RFC because some parts (e.g. pinctrl) are still
> work in progress.
>
> [1] - https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711/rpi_DATA_2711_1p0_preliminary.pdf
> [2] - https://www.raspberrypi.org/documentation/hardware/raspberrypi/schematics/rpi_SCH_4b_4p0_reduced.pdf
>
> Discussible things:
> - SoC compatible BCM2711 (as on the SoC label) vs BCM2838 (existing naming scheme)
> - ARCH membership ARCH_BCM2835 vs ARCH_BCMSTB

Thanks for taking this on!

I would love to see us drop this silly upstream/downstream compatible
string naming scheme and just use 2711 (or 7211 for modules shared with
7211 that were enabled there first).  However, I don't feel that
strongly about it when I'm not the one doing the work.

Other than the SPI shared interrupt change that looks dodgy, and a
preference for the clock change being data-driven instead, I would be
willing to ack the whole thing.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support
  2019-07-18 18:45 ` [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Eric Anholt
@ 2019-07-18 18:58   ` Florian Fainelli
  2019-07-19 13:18   ` Nicolas Saenz Julienne
  1 sibling, 0 replies; 32+ messages in thread
From: Florian Fainelli @ 2019-07-18 18:58 UTC (permalink / raw)
  To: Eric Anholt, Stefan Wahren, Florian Fainelli, Ray Jui,
	Scott Branden, Nicolas Saenz Julienne, Rob Herring, Mark Rutland,
	Linus Walleij, Michael Turquette, Stephen Boyd, Ulf Hansson,
	Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel

On 7/18/19 11:45 AM, Eric Anholt wrote:
> Stefan Wahren <wahrenst@gmx.net> writes:
> 
>> This series adds minimal support for the new Raspberry Pi 4, so we are able
>> to login via debug UART.
>>
>> Patch 1-5:   Prepare platform and DTS for the new SoC BMC2838
>> Patch 6-9:   Enable support for emmc2 on BCM2838
>> Patch 10-14: Enable pinctrl for BCM2838
>> Patch 15:    Enable SPI support for BCM2838
>> Patch 16-18: Add Raspberry Pi 4 DTS support
>>
>> Unfortunately the Raspberry Pi Foundation didn't released a
>> peripheral documentation for the new SoC yet. So we only have a preliminary
>> datasheet [1] and reduced schematics [2].
>>
>> This series is marked as RFC because some parts (e.g. pinctrl) are still
>> work in progress.
>>
>> [1] - https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711/rpi_DATA_2711_1p0_preliminary.pdf
>> [2] - https://www.raspberrypi.org/documentation/hardware/raspberrypi/schematics/rpi_SCH_4b_4p0_reduced.pdf
>>
>> Discussible things:
>> - SoC compatible BCM2711 (as on the SoC label) vs BCM2838 (existing naming scheme)
>> - ARCH membership ARCH_BCM2835 vs ARCH_BCMSTB
> 
> Thanks for taking this on!
> 
> I would love to see us drop this silly upstream/downstream compatible
> string naming scheme and just use 2711 (or 7211 for modules shared with
> 7211 that were enabled there first).  However, I don't feel that
> strongly about it when I'm not the one doing the work.

2711 and 7211 are really different chips so we would need to keep
differentiating the two form a hardware description perspective, even if
the driver behavior is strictly the same (that's a software
implementation detail).

> 
> Other than the SPI shared interrupt change that looks dodgy, and a
> preference for the clock change being data-driven instead, I would be
> willing to ack the whole thing.
> 

It does look good to me as well, will do a more thorough pass again.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support
  2019-07-18 18:45 ` [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Eric Anholt
  2019-07-18 18:58   ` Florian Fainelli
@ 2019-07-19 13:18   ` Nicolas Saenz Julienne
  1 sibling, 0 replies; 32+ messages in thread
From: Nicolas Saenz Julienne @ 2019-07-19 13:18 UTC (permalink / raw)
  To: Eric Anholt, Stefan Wahren, Florian Fainelli, Ray Jui,
	Scott Branden, Rob Herring, Mark Rutland, Linus Walleij,
	Michael Turquette, Stephen Boyd, Ulf Hansson, Adrian Hunter,
	Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1689 bytes --]

On Thu, 2019-07-18 at 11:45 -0700, Eric Anholt wrote:
> Stefan Wahren <wahrenst@gmx.net> writes:
> 
> > This series adds minimal support for the new Raspberry Pi 4, so we are able
> > to login via debug UART.
> > 
> > Patch 1-5:   Prepare platform and DTS for the new SoC BMC2838
> > Patch 6-9:   Enable support for emmc2 on BCM2838
> > Patch 10-14: Enable pinctrl for BCM2838
> > Patch 15:    Enable SPI support for BCM2838
> > Patch 16-18: Add Raspberry Pi 4 DTS support
> > 
> > Unfortunately the Raspberry Pi Foundation didn't released a
> > peripheral documentation for the new SoC yet. So we only have a preliminary
> > datasheet [1] and reduced schematics [2].
> > 
> > This series is marked as RFC because some parts (e.g. pinctrl) are still
> > work in progress.
> > 
> > [1] - 
> > 
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711/rpi_DATA_2711_1p0_preliminary.pdf
> > [2] - 
> > 
https://www.raspberrypi.org/documentation/hardware/raspberrypi/schematics/rpi_SCH_4b_4p0_reduced.pdf
> > 
> > Discussible things:
> > - SoC compatible BCM2711 (as on the SoC label) vs BCM2838 (existing naming
> > scheme)
> > - ARCH membership ARCH_BCM2835 vs ARCH_BCMSTB
> 
> Thanks for taking this on!
> 
> I would love to see us drop this silly upstream/downstream compatible
> string naming scheme and just use 2711 (or 7211 for modules shared with
> 7211 that were enabled there first).  However, I don't feel that
> strongly about it when I'm not the one doing the work.

In the long run it would have the added benefit of being able to use all the
overlays the RPi Foundation supports. That said I agree with Eric's sentiment.


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support
  2019-07-18 18:37       ` Eric Anholt
@ 2019-07-19 16:40         ` Stefan Wahren
  2019-07-19 19:49           ` Eric Anholt
  0 siblings, 1 reply; 32+ messages in thread
From: Stefan Wahren @ 2019-07-19 16:40 UTC (permalink / raw)
  To: Eric Anholt, Florian Fainelli, Matthias Brugger, Ray Jui,
	Scott Branden, Nicolas Saenz Julienne, Rob Herring, Mark Rutland,
	Linus Walleij, Michael Turquette, Stephen Boyd, Ulf Hansson,
	Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel

Hi,

Am 18.07.19 um 20:37 schrieb Eric Anholt:
> Florian Fainelli <f.fainelli@gmail.com> writes:
>
>> On 7/18/2019 1:47 AM, Matthias Brugger wrote:
>>>
>>> On 17/07/2019 21:50, Stefan Wahren wrote:
>>>> The new BCM2838 supports an additional clock for the emmc2 block.
>>>> So add a new compatible to register this clock only for BCM2838.
>>>>
>>>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>>>> ---
>>>>  drivers/clk/bcm/clk-bcm2835.c | 33 +++++++++++++++++++++++++++++++--
>>>>  1 file changed, 31 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
>>>> index 867ae3c..5fe4695 100644
>>>> --- a/drivers/clk/bcm/clk-bcm2835.c
>>>> +++ b/drivers/clk/bcm/clk-bcm2835.c
>>>> @@ -31,7 +31,8 @@
>>>>  #include <linux/delay.h>
>>>>  #include <linux/io.h>
>>>>  #include <linux/module.h>
>>>> -#include <linux/of.h>
>>>> +#include <linux/of_device.h>
>>>> +
>>>>  #include <linux/platform_device.h>
>>>>  #include <linux/slab.h>
>>>>  #include <dt-bindings/clock/bcm2835.h>
>>>> @@ -114,6 +115,8 @@
>>>>  #define CM_AVEODIV		0x1bc
>>>>  #define CM_EMMCCTL		0x1c0
>>>>  #define CM_EMMCDIV		0x1c4
>>>> +#define CM_EMMC2CTL		0x1d0
>>>> +#define CM_EMMC2DIV		0x1d4
>>>>
>>>>  /* General bits for the CM_*CTL regs */
>>>>  # define CM_ENABLE			BIT(4)
>>>> @@ -1950,6 +1953,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
>>>>  		.frac_bits = 8,
>>>>  		.tcnt_mux = 39),
>>>>
>>>> +	/* EMMC2 clock (only available for BCM2838) */
>>>> +	[BCM2838_CLOCK_EMMC2]	= REGISTER_PER_CLK(
>>>> +		.name = "emmc2",
>>>> +		.ctl_reg = CM_EMMC2CTL,
>>>> +		.div_reg = CM_EMMC2DIV,
>>>> +		.int_bits = 4,
>>>> +		.frac_bits = 8,
>>>> +		.tcnt_mux = 42),
>>>> +
>>>>  	/* General purpose (GPIO) clocks */
>>>>  	[BCM2835_CLOCK_GP0]	= REGISTER_PER_CLK(
>>>>  		.name = "gp0",
>>>> @@ -2101,6 +2113,14 @@ static int bcm2835_mark_sdc_parent_critical(struct clk *sdc)
>>>>  	return clk_prepare_enable(parent);
>>>>  }
>>>>
>>>> +bool bcm2835_has_clk(size_t index) {
>>>> +	return index != BCM2838_CLOCK_EMMC2;
>>>> +}
>>>> +
>>>> +bool bcm2838_has_clk(size_t index) {
>>>> +	return true;
>>>> +}
>>>> +
>>>>  static int bcm2835_clk_probe(struct platform_device *pdev)
>>>>  {
>>>>  	struct device *dev = &pdev->dev;
>>>> @@ -2109,9 +2129,14 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>>>>  	struct resource *res;
>>>>  	const struct bcm2835_clk_desc *desc;
>>>>  	const size_t asize = ARRAY_SIZE(clk_desc_array);
>>>> +	bool (*has_clk_func)(size_t);
>>>>  	size_t i;
>>>>  	int ret;
>>>>
>>>> +	has_clk_func = of_device_get_match_data(&pdev->dev);
>>>> +	if (!has_clk_func)
>>>> +		return -ENODEV;
>>>> +
>>>>  	cprman = devm_kzalloc(dev,
>>>>  			      struct_size(cprman, onecell.hws, asize),
>>>>  			      GFP_KERNEL);
>>>> @@ -2146,6 +2171,9 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>>>>  	hws = cprman->onecell.hws;
>>>>
>>>>  	for (i = 0; i < asize; i++) {
>>>> +		if (!has_clk_func(i))
>>>> +			continue;
>>>> +
>>> I think that's very hacky. Can't we just create a per SoC list which get's
>>> passed via .data and in probe we iterate through that list and enable the
>>> clocks? That would make clear which clocks are just for bcm2838, basically emmc2.
>> Or within the structure, add a flag that indicates whether the clock is
>> available or not for a given chip? That would avoid having to introduce
>> bcm283x_has_clk() functions that needs to maintain a possibly growing
>> list of clocks. You would still have to check the flag though.
> I think this is a good solution.

i only want to make sure that i get it right:

- add a new member supported (e.g. unsigned int) into struct
bcm2835_clk_desc
- bit 1 should be BCM2835 and 2 should be BCM2711 (so BCM7211 could use
3 and so ...)
- during probing we should check the bit against the SoC bit before
registration

Stefan


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support
  2019-07-19 16:40         ` Stefan Wahren
@ 2019-07-19 19:49           ` Eric Anholt
  0 siblings, 0 replies; 32+ messages in thread
From: Eric Anholt @ 2019-07-19 19:49 UTC (permalink / raw)
  To: Stefan Wahren, Florian Fainelli, Matthias Brugger, Ray Jui,
	Scott Branden, Nicolas Saenz Julienne, Rob Herring, Mark Rutland,
	Linus Walleij, Michael Turquette, Stephen Boyd, Ulf Hansson,
	Adrian Hunter, Mark Brown
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 4055 bytes --]

Stefan Wahren <wahrenst@gmx.net> writes:

> Hi,
>
> Am 18.07.19 um 20:37 schrieb Eric Anholt:
>> Florian Fainelli <f.fainelli@gmail.com> writes:
>>
>>> On 7/18/2019 1:47 AM, Matthias Brugger wrote:
>>>>
>>>> On 17/07/2019 21:50, Stefan Wahren wrote:
>>>>> The new BCM2838 supports an additional clock for the emmc2 block.
>>>>> So add a new compatible to register this clock only for BCM2838.
>>>>>
>>>>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>>>>> ---
>>>>>  drivers/clk/bcm/clk-bcm2835.c | 33 +++++++++++++++++++++++++++++++--
>>>>>  1 file changed, 31 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
>>>>> index 867ae3c..5fe4695 100644
>>>>> --- a/drivers/clk/bcm/clk-bcm2835.c
>>>>> +++ b/drivers/clk/bcm/clk-bcm2835.c
>>>>> @@ -31,7 +31,8 @@
>>>>>  #include <linux/delay.h>
>>>>>  #include <linux/io.h>
>>>>>  #include <linux/module.h>
>>>>> -#include <linux/of.h>
>>>>> +#include <linux/of_device.h>
>>>>> +
>>>>>  #include <linux/platform_device.h>
>>>>>  #include <linux/slab.h>
>>>>>  #include <dt-bindings/clock/bcm2835.h>
>>>>> @@ -114,6 +115,8 @@
>>>>>  #define CM_AVEODIV		0x1bc
>>>>>  #define CM_EMMCCTL		0x1c0
>>>>>  #define CM_EMMCDIV		0x1c4
>>>>> +#define CM_EMMC2CTL		0x1d0
>>>>> +#define CM_EMMC2DIV		0x1d4
>>>>>
>>>>>  /* General bits for the CM_*CTL regs */
>>>>>  # define CM_ENABLE			BIT(4)
>>>>> @@ -1950,6 +1953,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
>>>>>  		.frac_bits = 8,
>>>>>  		.tcnt_mux = 39),
>>>>>
>>>>> +	/* EMMC2 clock (only available for BCM2838) */
>>>>> +	[BCM2838_CLOCK_EMMC2]	= REGISTER_PER_CLK(
>>>>> +		.name = "emmc2",
>>>>> +		.ctl_reg = CM_EMMC2CTL,
>>>>> +		.div_reg = CM_EMMC2DIV,
>>>>> +		.int_bits = 4,
>>>>> +		.frac_bits = 8,
>>>>> +		.tcnt_mux = 42),
>>>>> +
>>>>>  	/* General purpose (GPIO) clocks */
>>>>>  	[BCM2835_CLOCK_GP0]	= REGISTER_PER_CLK(
>>>>>  		.name = "gp0",
>>>>> @@ -2101,6 +2113,14 @@ static int bcm2835_mark_sdc_parent_critical(struct clk *sdc)
>>>>>  	return clk_prepare_enable(parent);
>>>>>  }
>>>>>
>>>>> +bool bcm2835_has_clk(size_t index) {
>>>>> +	return index != BCM2838_CLOCK_EMMC2;
>>>>> +}
>>>>> +
>>>>> +bool bcm2838_has_clk(size_t index) {
>>>>> +	return true;
>>>>> +}
>>>>> +
>>>>>  static int bcm2835_clk_probe(struct platform_device *pdev)
>>>>>  {
>>>>>  	struct device *dev = &pdev->dev;
>>>>> @@ -2109,9 +2129,14 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>>>>>  	struct resource *res;
>>>>>  	const struct bcm2835_clk_desc *desc;
>>>>>  	const size_t asize = ARRAY_SIZE(clk_desc_array);
>>>>> +	bool (*has_clk_func)(size_t);
>>>>>  	size_t i;
>>>>>  	int ret;
>>>>>
>>>>> +	has_clk_func = of_device_get_match_data(&pdev->dev);
>>>>> +	if (!has_clk_func)
>>>>> +		return -ENODEV;
>>>>> +
>>>>>  	cprman = devm_kzalloc(dev,
>>>>>  			      struct_size(cprman, onecell.hws, asize),
>>>>>  			      GFP_KERNEL);
>>>>> @@ -2146,6 +2171,9 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
>>>>>  	hws = cprman->onecell.hws;
>>>>>
>>>>>  	for (i = 0; i < asize; i++) {
>>>>> +		if (!has_clk_func(i))
>>>>> +			continue;
>>>>> +
>>>> I think that's very hacky. Can't we just create a per SoC list which get's
>>>> passed via .data and in probe we iterate through that list and enable the
>>>> clocks? That would make clear which clocks are just for bcm2838, basically emmc2.
>>> Or within the structure, add a flag that indicates whether the clock is
>>> available or not for a given chip? That would avoid having to introduce
>>> bcm283x_has_clk() functions that needs to maintain a possibly growing
>>> list of clocks. You would still have to check the flag though.
>> I think this is a good solution.
>
> i only want to make sure that i get it right:
>
> - add a new member supported (e.g. unsigned int) into struct
> bcm2835_clk_desc
> - bit 1 should be BCM2835 and 2 should be BCM2711 (so BCM7211 could use
> 3 and so ...)
> - during probing we should check the bit against the SoC bit before
> registration

Sounds good to me.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 10/18] pinctrl: bcm2835: bcm7211: Add support for 7211 pull-up functionality
  2019-07-17 19:50 ` [PATCH RFC 10/18] pinctrl: bcm2835: bcm7211: Add support for 7211 pull-up functionality Stefan Wahren
@ 2019-08-02 22:05   ` Linus Walleij
  0 siblings, 0 replies; 32+ messages in thread
From: Linus Walleij @ 2019-08-02 22:05 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Mark Rutland, Ulf Hansson, Florian Fainelli, Scott Branden,
	Stephen Boyd, Ray Jui, Michael Turquette, Al Cooper,
	Adrian Hunter, Eric Anholt, Rob Herring,
	bcm-kernel-feedback-list, Mark Brown, linux-rpi-kernel,
	Nicolas Saenz Julienne, Linux ARM

Hi Stefan!

Thanks for your patch!

On Wed, Jul 17, 2019 at 9:50 PM Stefan Wahren <wahrenst@gmx.net> wrote:

> From: Al Cooper <alcooperx@gmail.com>
>
> The 7211 has a new way of selecting the pull-up/pull-down setting
> for a GPIO pin. The registers used for the bcm2837, GP_PUD and
> GP_PUDCLKn0, are no longer connected. A new set of registers,
> GP_GPIO_PUP_PDN_CNTRL_REGx must be used. This commit will add
> a new compatible string "brcm,bcm7211-gpio" and the kernel
> driver will use it to select which method is used to select
> pull-up/pull-down.
>
> Signed-off-by: Al Cooper <alcooperx@gmail.com>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

(...)
>  /* argument: bcm2835_pinconf_pull */
>  #define BCM2835_PINCONF_PARAM_PULL     (PIN_CONFIG_END + 1)

Why this derivative of PULL?

What do you need that these standard configs and their parameters
doesn't already cover:

 * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high
 *      impedance to GROUND). If the argument is != 0 pull-down is enabled,
 *      if it is 0, pull-down is total, i.e. the pin is connected to GROUND.
(...)
 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high
 *      impedance to VDD). If the argument is != 0 pull-up is enabled,
 *      if it is 0, pull-up is total, i.e. the pin is connected to VDD.

The argument isn't really defined but at one time I thought it should be
in ohms, but proprietary values are possible I guess.

 +static int bcm7211_pinconf_set(struct pinctrl_dev *pctldev,
> +                              unsigned int pin, unsigned long *configs,
> +                              unsigned int num_configs)
> +{
(...)
> +       for (i = 0; i < num_configs; i++) {
> +               param = pinconf_to_config_param(configs[i]);
> +               if (param != BCM2835_PINCONF_PARAM_PULL)
> +                       return -EINVAL;

This seems unnecessary, like some "hello I am here with magic value" instead
of just using the standard pull up/down configs and some ohm or custom
value.

> +               arg = pinconf_to_config_argument(configs[i]);
> +
> +               /* convert to 7211 value */
> +               switch (arg) {
> +               case PIN_CONFIG_BIAS_DISABLE:
> +                       arg = BCM7211_PINCONFIG_PULL_NONE;
> +                       break;
> +               case PIN_CONFIG_BIAS_PULL_DOWN:
> +                       arg = BCM7211_PINCONFIG_PULL_DOWN;
> +                       break;
> +               case PIN_CONFIG_BIAS_PULL_UP:
> +                       arg = BCM7211_PINCONFIG_PULL_UP;
> +                       break;
> +               }

This switch is fine, but lose the arg translation and just use the arg
as-is, I don't see the point.

The interpretation is anyway clear from:

> +               .compatible = "brcm,bcm7211-gpio",
> +               .data = &bcm7211_pinconf_ops,

This compatible string, and the variant of SoC is what you should
store in your state container instead of custom arguments, like

> +       match = of_match_node(bcm2835_pinctrl_match, pdev->dev.of_node);
> +       if (match) {
> +               bcm2835_pinctrl_desc.confops =
> +                       (const struct pinconf_ops *)match->data;
> +       }

Instead of storing the confops in the .data store just an enum for the SoC
and make the code adapt to which SoC it is. Storing different ops may make
sense but it seems to just be adding kludges here in the argument to
work around that later on the driver doesn't know which SoC it is
running on.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 11/18] pinctrl: bcm2835: Fix BCM7211 pinconf handling
  2019-07-17 19:50 ` [PATCH RFC 11/18] pinctrl: bcm2835: Fix BCM7211 pinconf handling Stefan Wahren
@ 2019-08-02 22:06   ` Linus Walleij
  0 siblings, 0 replies; 32+ messages in thread
From: Linus Walleij @ 2019-08-02 22:06 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Mark Rutland, Ulf Hansson, Florian Fainelli, Scott Branden,
	Stephen Boyd, Ray Jui, Michael Turquette, Adrian Hunter,
	Eric Anholt, Rob Herring, bcm-kernel-feedback-list, Mark Brown,
	linux-rpi-kernel, Nicolas Saenz Julienne, Linux ARM

On Wed, Jul 17, 2019 at 9:50 PM Stefan Wahren <wahrenst@gmx.net> wrote:

> The BCM7211 pinconf doesn't look correct and behaves differently
> to BCM2835. So fix this accordingly.
>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

If this is fixing code in earlier patches just squash them?

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH RFC 13/18] pinctrl: bcm2835: Add BCM2838 support
  2019-07-17 19:50 ` [PATCH RFC 13/18] pinctrl: bcm2835: Add BCM2838 support Stefan Wahren
@ 2019-08-02 22:08   ` Linus Walleij
  0 siblings, 0 replies; 32+ messages in thread
From: Linus Walleij @ 2019-08-02 22:08 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Mark Rutland, Ulf Hansson, Florian Fainelli, Linux ARM,
	Scott Branden, Stephen Boyd, Ray Jui, Michael Turquette,
	Adrian Hunter, Eric Anholt, Rob Herring,
	bcm-kernel-feedback-list, Mark Brown, Nicolas Saenz Julienne,
	linux-rpi-kernel

On Wed, Jul 17, 2019 at 9:52 PM Stefan Wahren <wahrenst@gmx.net> wrote:

> The pinctrl on the BCM2711 is not backward compatible to the BCM2835.
> So use the compatible ops of the BCM7211.
>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

I suspect the data should contain an enum or something for the SoC instead
so the code can adapt.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2019-08-02 22:09 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 19:50 [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
2019-07-17 19:50 ` [PATCH RFC 01/18] ARM: bcm283x: Reduce register ranges for UART, SPI and I2C Stefan Wahren
2019-07-17 19:50 ` [PATCH RFC 02/18] ARM: bcm2835: DMA can only address 1GB Stefan Wahren
2019-07-17 19:50 ` [PATCH RFC 03/18] ARM: dts: bcm283x: Move BCM2835/6/7 specific to bcm2835-common.dtsi Stefan Wahren
2019-07-17 19:50 ` [PATCH RFC 04/18] ARM: dts: bcm283x: Define MMC interfaces at board level Stefan Wahren
2019-07-17 19:50 ` [PATCH RFC 05/18] ARM: dts: bcm283x: Define memory " Stefan Wahren
2019-07-17 19:50 ` [PATCH RFC 06/18] dt-bindings: bcm2835-cprman: Add bcm2838 support Stefan Wahren
2019-07-17 19:50 ` [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support Stefan Wahren
2019-07-18  8:47   ` Matthias Brugger
2019-07-18 16:51     ` Florian Fainelli
2019-07-18 18:37       ` Eric Anholt
2019-07-19 16:40         ` Stefan Wahren
2019-07-19 19:49           ` Eric Anholt
2019-07-17 19:50 ` [PATCH RFC 08/18] dt-bindings: sdhci-iproc: Add brcm,bcm2838-emmc2 Stefan Wahren
2019-07-17 19:50 ` [PATCH RFC 09/18] mmc: sdhci-iproc: Add support for emmc2 of the BCM2838 Stefan Wahren
2019-07-18  8:34   ` Matthias Brugger
2019-07-18 16:40     ` Florian Fainelli
2019-07-18 16:48       ` Matthias Brugger
2019-07-18 16:52         ` Florian Fainelli
2019-07-18 17:46         ` Stefan Wahren
2019-07-18 18:09         ` Stefan Wahren
2019-07-18 18:19           ` Andrei Gherzan
2019-07-17 19:50 ` [PATCH RFC 10/18] pinctrl: bcm2835: bcm7211: Add support for 7211 pull-up functionality Stefan Wahren
2019-08-02 22:05   ` Linus Walleij
2019-07-17 19:50 ` [PATCH RFC 11/18] pinctrl: bcm2835: Fix BCM7211 pinconf handling Stefan Wahren
2019-08-02 22:06   ` Linus Walleij
2019-07-17 19:50 ` [PATCH RFC 12/18] dt-bindings: pinctrl: bcm2835: Add brcm, bcm2838 compatible Stefan Wahren
2019-07-17 19:50 ` [PATCH RFC 13/18] pinctrl: bcm2835: Add BCM2838 support Stefan Wahren
2019-08-02 22:08   ` Linus Walleij
2019-07-18 18:45 ` [PATCH RFC 00/18] ARM: Add minimal Raspberry Pi 4 support Eric Anholt
2019-07-18 18:58   ` Florian Fainelli
2019-07-19 13:18   ` Nicolas Saenz Julienne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).