Skip to contentSkip to conversation

arm64: Add platform selection for BCM2835.

PATCH In review Gerd Hoffmann 12 participants 70 messages Jun 1, 2016 – Jul 22, 2016 1 message not in the archive

Subsystems (11)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/32 arm64: Add platform selection for BCM2835.

From: Eric Anholt <[email protected]>

[ kraxel: copy some selects from arm to arm64 ]
[ kraxel: add CONFIG_ARCH_BCM, needed for some "depends on ARCH_BCM" ]

---
 arch/arm/mach-bcm/Kconfig    |  2 +-
 arch/arm64/Kconfig.platforms | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
arch/arm/mach-bcm/Kconfig +1 -1
index 68ab641..21f0e43 100644
@@ -136,7 +136,7 @@ comment "Other Architectures"
 
 config ARCH_BCM2835
 	bool "Broadcom BCM2835 family"
-	depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
+	depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 || ARM64
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_AMBA
 	select ARM_ERRATA_411920 if ARCH_MULTI_V6
arch/arm64/Kconfig.platforms +20 -0
index 7ef1d05..32aba6b 100644
@@ -13,8 +13,28 @@ config ARCH_ALPINE
 	  This enables support for the Annapurna Labs Alpine
 	  Soc family.
 
+config ARCH_BCM
+	bool "Broadcom SoC Support"
+	help
+	  This enables support for Broadcom ARM based SoC chips
+
+config ARCH_BCM2835
+	bool "Broadcom BCM2835 family"
+	depends on ARCH_BCM
+	select ARCH_REQUIRE_GPIOLIB
+	select CLKSRC_OF
+	select PINCTRL
+	select PINCTRL_BCM2835
+	select ARM_AMBA
+	select ARM_TIMER_SP804
+	select HAVE_ARM_ARCH_TIMER
+	help
+	  This enables support for the Broadcom BCM2837 SoC.
+	  This SoC is used in the Raspberry Pi 3 device.
+
 config ARCH_BCM_IPROC
 	bool "Broadcom iProc SoC Family"
+	depends on ARCH_BCM
 	select COMMON_CLK_IPROC
 	select PINCTRL
 	select ARCH_REQUIRE_GPIOLIB
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 18 lines · Gerd Hoffmann

From: Eric Anholt <[email protected]>

[ kraxel: copy some selects from arm to arm64 ]
[ kraxel: add CONFIG_ARCH_BCM, needed for some "depends on ARCH_BCM" ]

---
 arch/arm/mach-bcm/Kconfig    |  2 +-
 arch/arm64/Kconfig.platforms | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
arch/arm/mach-bcm/Kconfig +0 -0
index 68ab641..21f0e43 100644

arch/arm/mach-bcm/Kconfig comment "Other Architectures" · line 139

Quoted 5 lines
arch/arm/mach-bcm/Kconfig +1 -1
@@ -136,7 +136,7 @@ comment "Other Architectures"
 
 config ARCH_BCM2835
 	bool "Broadcom BCM2835 family"
-	depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
+	depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 || ARM64

Humm, what does that achieve?

Quoted 8 lines
arch/arm/mach-bcm/Kconfig +0 -0
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_AMBA
 	select ARM_ERRATA_411920 if ARCH_MULTI_V6
arch/arm64/Kconfig.platforms +0 -0
index 7ef1d05..32aba6b 100644

arch/arm64/Kconfig.platforms config ARCH_ALPINE · line 19

Quoted 7 lines
arch/arm64/Kconfig.platforms +4 -0
@@ -13,8 +13,28 @@ config ARCH_ALPINE
 	  This enables support for the Annapurna Labs Alpine
 	  Soc family.
 
+config ARCH_BCM
+	bool "Broadcom SoC Support"
+	help
+	  This enables support for Broadcom ARM based SoC chips

menuconfig maybe?

Quoted 8 lines
arch/arm64/Kconfig.platforms +8 -0
+
+config ARCH_BCM2835
+	bool "Broadcom BCM2835 family"
+	depends on ARCH_BCM
+	select ARCH_REQUIRE_GPIOLIB
+	select CLKSRC_OF
+	select PINCTRL
+	select PINCTRL_BCM2835

arch/arm64/Kconfig.platforms config ARCH_ALPINE · line 37

Quoted 10 lines
arch/arm64/Kconfig.platforms +8 -0
+	select ARM_AMBA
+	select ARM_TIMER_SP804
+	select HAVE_ARM_ARCH_TIMER
+	help
+	  This enables support for the Broadcom BCM2837 SoC.
+	  This SoC is used in the Raspberry Pi 3 device.
+
 config ARCH_BCM_IPROC
 	bool "Broadcom iProc SoC Family"
+	depends on ARCH_BCM

Does not seem necessary nor adding anything here.

Signature · 1 line
Florian
#3 lore raw
Quoted 6 lines

arch/arm/mach-bcm/Kconfig comment "Other Architectures" · line 139

Quoted 4 lines

config ARCH_BCM2835

arch/arm/mach-bcm/Kconfig +1 -1
 	bool "Broadcom BCM2835 family"
-	depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
+	depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 || ARM64

Humm, what does that achieve?

Nothing ;)

Slipped through unnoticed, I'll drop it.

Quoted 6 lines

arch/arm64/Kconfig.platforms config ARCH_ALPINE · line 19

Quoted 4 lines
arch/arm64/Kconfig.platforms +4 -0
+config ARCH_BCM
+	bool "Broadcom SoC Support"
+	help
+	  This enables support for Broadcom ARM based SoC chips

menuconfig maybe?

There isn't any in arch/arm64/Kconfig.platforms right now, so I didn't feel like introducing one. Also the dependency should have pretty much the same effect ...

Quoted 11 lines
Quoted 11 lines
arch/arm64/Kconfig.platforms +11 -0
+config ARCH_BCM2835
+	bool "Broadcom BCM2835 family"
+	depends on ARCH_BCM
+	select ARCH_REQUIRE_GPIOLIB
+	select CLKSRC_OF
+	select PINCTRL
+	select PINCTRL_BCM2835
+	select ARM_AMBA
+	select ARM_TIMER_SP804
+	select HAVE_ARM_ARCH_TIMER
+	help
Quoted 8 lines

arch/arm64/Kconfig.platforms config ARCH_ALPINE · line 37

Quoted 6 lines
arch/arm64/Kconfig.platforms +4 -0
+	  This enables support for the Broadcom BCM2837 SoC.
+	  This SoC is used in the Raspberry Pi 3 device.
+
 config ARCH_BCM_IPROC
 	bool "Broadcom iProc SoC Family"
+	depends on ARCH_BCM

Does not seem necessary nor adding anything here.

Added for consistency. When we add ARCH_BCM all ARCH_BCM_* should depend on it ...

We could also do it the other way around: make ARCH_BCM a hidden bool and have ARCH_BCM_* select it.

cheers,
Gerd

#4 lore raw
Quoted 42 lines · Gerd Hoffmann
Quoted 6 lines

arch/arm/mach-bcm/Kconfig comment "Other Architectures" · line 139

Quoted 4 lines

config ARCH_BCM2835

arch/arm/mach-bcm/Kconfig +1 -1
 	bool "Broadcom BCM2835 family"
-	depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
+	depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 || ARM64

Humm, what does that achieve?

Nothing ;)

Slipped through unnoticed, I'll drop it.

Quoted 6 lines

arch/arm64/Kconfig.platforms config ARCH_ALPINE · line 19

Quoted 4 lines
arch/arm64/Kconfig.platforms +4 -0
+config ARCH_BCM
+	bool "Broadcom SoC Support"
+	help
+	  This enables support for Broadcom ARM based SoC chips

menuconfig maybe?

There isn't any in arch/arm64/Kconfig.platforms right now, so I didn't feel like introducing one. Also the dependency should have pretty much the same effect ...

Quoted 11 lines
Quoted 11 lines
arch/arm64/Kconfig.platforms +11 -0
+config ARCH_BCM2835
+	bool "Broadcom BCM2835 family"
+	depends on ARCH_BCM
+	select ARCH_REQUIRE_GPIOLIB
+	select CLKSRC_OF
+	select PINCTRL
+	select PINCTRL_BCM2835
+	select ARM_AMBA
+	select ARM_TIMER_SP804
+	select HAVE_ARM_ARCH_TIMER
+	help
Quoted 8 lines

arch/arm64/Kconfig.platforms config ARCH_ALPINE · line 37

Quoted 6 lines
arch/arm64/Kconfig.platforms +4 -0
+	  This enables support for the Broadcom BCM2837 SoC.
+	  This SoC is used in the Raspberry Pi 3 device.
+
 config ARCH_BCM_IPROC
 	bool "Broadcom iProc SoC Family"
+	depends on ARCH_BCM

Does not seem necessary nor adding anything here.

Quoted 5 lines

Added for consistency. When we add ARCH_BCM all ARCH_BCM_* should depend on it ...

We could also do it the other way around: make ARCH_BCM a hidden bool and have ARCH_BCM_* select it.

Yes, this is probably better.

ARCH_BCM_IPROC is currently enabled in arch/arm64/configs/defconfig. By adding a dependency here without enabling ARCH_BCM in arm64 defconfig, this effectively disables ARCH_BCM_IPROC from arm64 defconfig.

Quoted 4 lines

cheers,
Gerd

#5 lore raw

Reply inline.

Quoted 19 lines · Ray Jui
Quoted 16 lines · Gerd Hoffmann
Quoted 6 lines

arch/arm/mach-bcm/Kconfig comment "Other Architectures" · line 139

Quoted 4 lines

config ARCH_BCM2835
bool "Broadcom BCM2835 family"

arch/arm/mach-bcm/Kconfig +1 -1
-    depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
+    depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 || ARM64

Humm, what does that achieve?

Nothing ;)

Slipped through unnoticed, I'll drop it.

Quoted 5 lines
Quoted 4 lines
arch/arm64/Kconfig.platforms +4 -0
+config ARCH_BCM
+    bool "Broadcom SoC Support"
+    help
+      This enables support for Broadcom ARM based SoC chips
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

menuconfig maybe?

There isn't any in arch/arm64/Kconfig.platforms right now, so I didn't feel like introducing one. Also the dependency should have pretty much the same effect .

No need to add ARCH_BCM
.

Quoted 24 lines
Quoted 24 lines
Quoted 12 lines
Quoted 12 lines
arch/arm64/Kconfig.platforms +11 -0
+config ARCH_BCM2835
+    bool "Broadcom BCM2835 family"
+    depends on ARCH_BCM
+    select ARCH_REQUIRE_GPIOLIB
+    select CLKSRC_OF
+    select PINCTRL
+    select PINCTRL_BCM2835
+    select ARM_AMBA
+    select ARM_TIMER_SP804
+    select HAVE_ARM_ARCH_TIMER
+    help
Quoted 8 lines

arch/arm64/Kconfig.platforms config ARCH_ALPINE · line 37

Quoted 6 lines
arch/arm64/Kconfig.platforms +4 -0
+      This enables support for the Broadcom BCM2837 SoC.
+      This SoC is used in the Raspberry Pi 3 device.
+
 config ARCH_BCM_IPROC
     bool "Broadcom iProc SoC Family"
+    depends on ARCH_BCM

Does not seem necessary nor adding anything here.

Added for consistency. When we add ARCH_BCM all ARCH_BCM_* should depend on it ...

Quoted 8 lines
Quoted 2 lines

We could also do it the other way around: make ARCH_BCM a hidden bool and have ARCH_BCM_* select it.

Yes, this is probably better.

ARCH_BCM_IPROC is currently enabled in arch/arm64/configs/defconfig. By adding a dependency here without enabling ARCH_BCM in arm64 defconfig, this effectively disables ARCH_BCM_IPROC from arm64 defconfig.

There is no need to add ARCH_BCM though?

Quoted 5 lines
Quoted 5 lines

cheers,
Gerd

#6 lore raw
Quoted 1 line

There is no need to add ARCH_BCM though?

There are Makefile(s) with

obj-$(CONFIG_ARCH_BCM) += bcm/

in drivers/pinctrl for example, maybe more, didn't check the whole tree.

So without ARCH_BCM some drivers are dropped from the build ...

cheers,
Gerd

#7 lore raw
Quoted 9 lines · Gerd Hoffmann
Quoted 1 line

There is no need to add ARCH_BCM though?

There are Makefile(s) with

obj-$(CONFIG_ARCH_BCM) += bcm/

in drivers/pinctrl for example, maybe more, didn't check the whole tree.

So without ARCH_BCM some drivers are dropped from the build ...

I see that now. Quite bizarre how the NS2 pinctl driver (used on a arm64 SoC) gets built right now....

Yes, adding the select with hidden option seems like what needs to be done. The ARM Maintainers did not like multi-level ARCH_BCM being added in the arm64 Kconfig previously so we dropped it.

Quoted 4 lines

cheers,
Gerd

Thanks,
Scott

#8 lore raw
Quoted 11 lines · Scott Branden
Quoted 8 lines · Gerd Hoffmann
Quoted 1 line

There is no need to add ARCH_BCM though?

There are Makefile(s) with

obj-$(CONFIG_ARCH_BCM) += bcm/

in drivers/pinctrl for example, maybe more, didn't check the whole tree.

Quoted 8 lines
Quoted 1 line

So without ARCH_BCM some drivers are dropped from the build ...

I see that now. Quite bizarre how the NS2 pinctl driver (used on a arm64 SoC) gets built right now....

Yes, adding the select with hidden option seems like what needs to be done. The ARM Maintainers did not like multi-level ARCH_BCM being added in the arm64 Kconfig previously so we dropped it.

We should always recusrse into that directory and build the respective pinctrl drivers within drivers/pinctrl/bcm, only for the enabled platforms, it makes no sense to have this kind of config symbol gating that.

I can submit a patch doing just that unless somebody wants to do it as part of this patch series.

Signature · 1 line
Florian
maintainer
#9 lore raw
In reply to Gerd Hoffmann
Quoted 20 lines · Gerd Hoffmann
Quoted 11 lines
Quoted 11 lines
arch/arm64/Kconfig.platforms +11 -0
+config ARCH_BCM2835
+	bool "Broadcom BCM2835 family"
+	depends on ARCH_BCM
+	select ARCH_REQUIRE_GPIOLIB
+	select CLKSRC_OF
+	select PINCTRL
+	select PINCTRL_BCM2835
+	select ARM_AMBA
+	select ARM_TIMER_SP804
+	select HAVE_ARM_ARCH_TIMER
+	help
Quoted 8 lines

arch/arm64/Kconfig.platforms config ARCH_ALPINE · line 37

Quoted 6 lines
arch/arm64/Kconfig.platforms +4 -0
+	  This enables support for the Broadcom BCM2837 SoC.
+	  This SoC is used in the Raspberry Pi 3 device.
+
 config ARCH_BCM_IPROC
 	bool "Broadcom iProc SoC Family"
+	depends on ARCH_BCM

Does not seem necessary nor adding anything here.

Quoted 2 lines

Added for consistency. When we add ARCH_BCM all ARCH_BCM_* should depend on it ...

For arm64, I prefer to keep Kconfig.platforms to SoC families only. I don't think we have any single-SoC Kconfig entry left now.

Signature · 1 line
Catalin
#10 lore raw

PATCH 2/32 arm64: Add BCM2835 support to the defconfig.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

Made with make defconfig; make menuconfig (only saying Y to new entries); make savedefconfig.

[ kraxel: quick+dirty rebase to 4.7 ]

---
 arch/arm64/configs/defconfig | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
arch/arm64/configs/defconfig +20 -3
index fd2d74d..03f246a 100644
@@ -31,6 +31,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_IOSCHED_DEADLINE is not set
 CONFIG_ARCH_SUNXI=y
 CONFIG_ARCH_ALPINE=y
+CONFIG_ARCH_BCM2835=y
 CONFIG_ARCH_BCM_IPROC=y
 CONFIG_ARCH_BERLIN=y
 CONFIG_ARCH_EXYNOS=y
@@ -140,6 +141,9 @@ CONFIG_USB_NET_PLUSB=m
 CONFIG_USB_NET_MCS7830=m
 CONFIG_WL18XX=m
 CONFIG_WLCORE_SDIO=m
+CONFIG_USB_USBNET=y
+CONFIG_USB_NET_SMSC95XX=y
+# CONFIG_WLAN is not set
 CONFIG_INPUT_EVDEV=y
 CONFIG_KEYBOARD_GPIO=y
 # CONFIG_SERIO_SERPORT is not set
@@ -147,6 +151,9 @@ CONFIG_SERIO_AMBAKMI=y
 CONFIG_LEGACY_PTY_COUNT=16
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_EXTENDED=y
+CONFIG_SERIAL_8250_SHARE_IRQ=y
+CONFIG_SERIAL_8250_BCM2835AUX=y
 CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_8250_MT6577=y
 CONFIG_SERIAL_8250_UNIPHIER=y
@@ -173,6 +180,7 @@ CONFIG_I2C_MUX=y
 CONFIG_I2C_MUX_PCA954x=y
 CONFIG_I2C_DESIGNWARE_PLATFORM=y
 CONFIG_I2C_IMX=y
+CONFIG_I2C_BCM2835=y
 CONFIG_I2C_MV64XXX=y
 CONFIG_I2C_QUP=y
 CONFIG_I2C_TEGRA=y
@@ -180,6 +188,8 @@ CONFIG_I2C_UNIPHIER_F=y
 CONFIG_I2C_RCAR=y
 CONFIG_SPI=y
 CONFIG_SPI_ORION=y
+CONFIG_SPI_BCM2835=y
+CONFIG_SPI_BCM2835AUX=y
 CONFIG_SPI_PL022=y
 CONFIG_SPI_QUP=y
 CONFIG_SPI_SPIDEV=m
@@ -206,20 +216,24 @@ CONFIG_MFD_SPMI_PMIC=y
 CONFIG_MFD_SEC_CORE=y
 CONFIG_MFD_HI655X_PMIC=y
 CONFIG_REGULATOR=y
+CONFIG_BCM2835_WDT=y
+CONFIG_MFD_SPMI_PMIC=y
+CONFIG_MFD_SEC_CORE=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_HI655X=y
 CONFIG_REGULATOR_QCOM_SMD_RPM=y
 CONFIG_REGULATOR_QCOM_SPMI=y
 CONFIG_REGULATOR_S2MPS11=y
-CONFIG_FB=y
+CONFIG_DRM=y
+CONFIG_DRM_VC4=y
 CONFIG_FB_ARMCLCD=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_MONO is not set
 # CONFIG_LOGO_LINUX_VGA16 is not set
 CONFIG_SOUND=y
 CONFIG_SND=y
 CONFIG_SND_SOC=y
+CONFIG_SND_BCM2835_SOC_I2S=y
 CONFIG_SND_SOC_RCAR=y
 CONFIG_SND_SOC_AK4613=y
 CONFIG_USB=y
@@ -270,6 +284,7 @@ CONFIG_RTC_DRV_SUN6I=y
 CONFIG_RTC_DRV_XGENE=y
 CONFIG_DMADEVICES=y
 CONFIG_PL330_DMA=y
+CONFIG_DMA_BCM2835=y
 CONFIG_TEGRA20_APB_DMA=y
 CONFIG_QCOM_BAM_DMA=y
 CONFIG_RCAR_DMAC=y
@@ -289,7 +304,9 @@ CONFIG_HWSPINLOCK_QCOM=y
 CONFIG_MAILBOX=y
 CONFIG_ARM_MHU=y
 CONFIG_HI6220_MBOX=y
+CONFIG_BCM2835_MBOX=y
 CONFIG_ARM_SMMU=y
+CONFIG_RASPBERRYPI_POWER=y
 CONFIG_QCOM_SMEM=y
 CONFIG_QCOM_SMD=y
 CONFIG_QCOM_SMD_RPM=y
@@ -302,6 +319,7 @@ CONFIG_PHY_HI6220_USB=y
 CONFIG_PHY_XGENE=y
 CONFIG_ARM_SCPI_PROTOCOL=y
 CONFIG_ACPI=y
+CONFIG_RASPBERRYPI_FIRMWARE=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 CONFIG_FANOTIFY=y
@@ -311,7 +329,6 @@ CONFIG_AUTOFS4_FS=y
 CONFIG_FUSE_FS=y
 CONFIG_CUSE=y
 CONFIG_VFAT_FS=y
-CONFIG_TMPFS=y
 CONFIG_HUGETLBFS=y
 CONFIG_CONFIGFS_FS=y
 CONFIG_EFIVAR_FS=y
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH 3/32 irqchip: bcm2835: Avoid arch/arm-specific handle_IRQ.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

This is equivalent and works for arm64 as well.

---
 drivers/irqchip/irq-bcm2835.c | 3 +--
 drivers/irqchip/irq-bcm2836.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/irqchip/irq-bcm2835.c +1 -2
index bf9cc5f..44d7c38 100644
@@ -52,7 +52,6 @@
 #include <linux/irqdomain.h>
 
 #include <asm/exception.h>
-#include <asm/mach/irq.h>
 
 /* Put the bank and irq (32 bits) into the hwirq */
 #define MAKE_HWIRQ(b, n)	((b << 5) | (n))
@@ -242,7 +241,7 @@ static void __exception_irq_entry bcm2835_handle_irq(
 	u32 hwirq;
 
 	while ((hwirq = get_next_armctrl_hwirq()) != ~0)
-		handle_IRQ(irq_linear_revmap(intc.domain, hwirq), regs);
+		handle_domain_irq(intc.domain, hwirq, regs);
 }
 
 static void bcm2836_chained_handle_irq(struct irq_desc *desc)
drivers/irqchip/irq-bcm2836.c +1 -1
index 72ff1d5..2787598 100644
@@ -180,7 +180,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs)
 	} else if (stat) {
 		u32 hwirq = ffs(stat) - 1;
 
-		handle_IRQ(irq_linear_revmap(intc.domain, hwirq), regs);
+		handle_domain_irq(intc.domain, hwirq, regs);
 	}
 }
 
Signature · 1 line
1.8.3.1
#12 lore raw

Re: [PATCH 03/32] irqchip: bcm2835: Avoid arch/arm-specific handle_IRQ.

Hey Gerd,

Quoted 6 lines · Gerd Hoffmann

From: Eric Anholt <[email protected]>

This is equivalent and works for arm64 as well.

---

I don't mind taking this, or Eric's V2 resend. However, the commit message needs a rewrite.

thx,

Jason.

#13 lore raw

Re: [PATCH 03/32] irqchip: bcm2835: Avoid arch/arm-specific handle_IRQ.

Quoted 5 lines · Jason Cooper

Hey Gerd,

Quoted 2 lines · Gerd Hoffmann

From: Eric Anholt <[email protected]>

Quoted 7 lines
Quoted 4 lines

This is equivalent and works for arm64 as well.

---

I don't mind taking this, or Eric's V2 resend. However, the commit message needs a rewrite.

Can you clarify what you don't like about it or suggest replacement
wording? This is the first concern I've seen.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160602/2ba94f16/attachment.sig>

#14 lore raw

PATCH 4/32 dt-bindings: Add root properties for Raspberry Pi 3

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

---
 Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt +4 -0
index 11d3056..6ffe087 100644
@@ -30,6 +30,10 @@ Raspberry Pi 2 Model B
 Required root node properties:
 compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
 
+Raspberry Pi 3 Model B
+Required root node properties:
+compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
+
 Raspberry Pi Compute Module
 Required root node properties:
 compatible = "raspberrypi,compute-module", "brcm,bcm2835";
Signature · 1 line
1.8.3.1
#15 lore raw

PATCH 5/32 ARM: bcm2835: Add devicetree for the Raspberry Pi 3.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

While this devicetree also works for booting in 32-bit mode, it's placed in arm64 since it's a 64-bit CPU (as suggested by Arnd).

v2: Move to arm64/ instead of arm/

[ kraxel: drop bcm2837-rpi-3-b.dtb from arm(32) Makefile ]

---
 arch/arm64/boot/dts/broadcom/Makefile            |  1 +
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 29 ++++++++++
 arch/arm64/boot/dts/broadcom/bcm2837.dtsi        | 74 ++++++++++++++++++++++++
 3 files changed, 104 insertions(+)
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm2837.dtsi
arch/arm64/boot/dts/broadcom/Makefile +1 -0
index bec1f8b..05faf2a 100644
@@ -1,3 +1,4 @@
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb
 dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb
 dtb-$(CONFIG_ARCH_VULCAN) += vulcan-eval.dtb
 
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts new file +29 -0
new file mode 100644
index 0000000..223793d
@@ -0,0 +1,29 @@
+/dts-v1/;
+#include "bcm2837.dtsi"
+#include "../../../../arm/boot/dts/bcm2835-rpi.dtsi"
+
+/ {
+	compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
+	model = "Raspberry Pi 3 Model B";
+
+	memory {
+		reg = <0 0x40000000>;
+	};
+
+	leds {
+		act {
+			gpios = <&gpio 47 0>;
+		};
+
+		pwr {
+			label = "PWR";
+			gpios = <&gpio 35 0>;
+			default-state = "keep";
+			linux,default-trigger = "default-on";
+		};
+	};
+};
+
+&uart1 {
+	status = "okay";
+};
arch/arm64/boot/dts/broadcom/bcm2837.dtsi new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#16 lore raw

PATCH 6/32 arm64: Fix physical to DMA mappings.

In reply to a message not in the archive

From: mzoran <[email protected]>

Gets USB and networking to work on Raspberry Pi 3 in 64 bit.

created by mzoran at crowfest.net

[ kraxel: some cleanups ]

---
 arch/arm64/include/asm/dma-mapping.h | 73 ++++++++++++++++++++++++++++++++++--
 arch/arm64/include/asm/memory.h      |  8 ++++
 2 files changed, 77 insertions(+), 4 deletions(-)
arch/arm64/include/asm/dma-mapping.h +69 -4
index 7dbea6c..48e8856 100644
@@ -19,7 +19,11 @@
 #ifdef __KERNEL__
 
 #include <linux/types.h>
-#include <linux/vmalloc.h>
+#include <linux/scatterlist.h>
+#include <linux/dma-attrs.h>
+#include <linux/dma-debug.h>
+
+#include <asm/memory.h>
 
 #include <xen/xen.h>
 #include <asm/xen/hypervisor.h>
@@ -56,6 +60,54 @@ void arch_teardown_dma_ops(struct device *dev);
 #define arch_teardown_dma_ops	arch_teardown_dma_ops
 #endif
 
+/*
+ * dma_to_pfn/pfn_to_dma/dma_to_virt/virt_to_dma are architecture private
+ * functions used internally by the DMA-mapping API to provide DMA
+ * addresses. They must not be used by drivers.
+ */
+static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn)
+{
+	if (dev)
+		pfn -= dev->dma_pfn_offset;
+	return (dma_addr_t)__pfn_to_bus(pfn);
+}
+
+static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr)
+{
+	unsigned long pfn = __bus_to_pfn(addr);
+
+	if (dev)
+		pfn += dev->dma_pfn_offset;
+
+	return pfn;
+}
+
+static inline void *dma_to_virt(struct device *dev, dma_addr_t addr)
+{
+	if (dev) {
+		unsigned long pfn = dma_to_pfn(dev, addr);
+
+		return phys_to_virt(__pfn_to_phys(pfn));
+	}
+
+	return (void *)__bus_to_virt((unsigned long)addr);
+}
+
+static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
+{
+	if (dev)
+		return pfn_to_dma(dev, virt_to_pfn(addr));
+
+	return (dma_addr_t)__virt_to_bus((unsigned long)(addr));
+}
+
+/* The ARM override for dma_max_pfn() */
+static inline unsigned long dma_max_pfn(struct device *dev)
+{
+	return PHYS_PFN_OFFSET + dma_to_pfn(dev, *dev->dma_mask);
+}
+#define dma_max_pfn(dev) dma_max_pfn(dev)
+
 /* do not use this function in a driver */
 static inline bool is_device_dma_coherent(struct device *dev)
 {
@@ -66,20 +118,33 @@ static inline bool is_device_dma_coherent(struct device *dev)
 
 static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
 {
-	return (dma_addr_t)paddr;
+	unsigned int offset = paddr & ~PAGE_MASK;
+	return pfn_to_dma(dev, __phys_to_pfn(paddr)) + offset;
 }
 
 static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
 {
-	return (phys_addr_t)dev_addr;
+	unsigned int offset = dev_addr & ~PAGE_MASK;
+	return __pfn_to_phys(dma_to_pfn(dev, dev_addr)) + offset;
 }
 
 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
 {
+	u64 limit, mask;
+
 	if (!dev->dma_mask)
 		return false;
 
-	return addr + size - 1 <= *dev->dma_mask;
+	mask = *dev->dma_mask;
+
+	limit = (mask + 1) & ~mask;
+	if (limit && size > limit)
+		return false;
+
+	if ((addr | (addr + size - 1)) & ~mask)
+		return false;
+
+	return true;
 }
 
 static inline void dma_mark_clean(void *addr, size_t size)
arch/arm64/include/asm/memory.h +8 -0
index 72a3025..ab4c65e 100644
@@ -226,6 +226,14 @@ static inline void *phys_to_virt(phys_addr_t x)
 #endif
 #endif
 
+#ifndef __virt_to_bus
+#define __virt_to_bus	__virt_to_phys
+#define __bus_to_virt	__phys_to_virt
+#define __pfn_to_bus(x)	__pfn_to_phys(x)
+#define __bus_to_pfn(x)	__phys_to_pfn(x)
+#endif
+
+
 #include <asm-generic/memory_model.h>
 
 #endif
Signature · 1 line
1.8.3.1
maintainer
#17 lore raw

Re: [PATCH 06/32] arm64: Fix physical to DMA mappings.

Quoted 4 lines · Gerd Hoffmann

From: mzoran <[email protected]>

Gets USB and networking to work on Raspberry Pi 3 in 64 bit.

Quoted 8 lines

created by mzoran at crowfest.net

[ kraxel: some cleanups ]

---
 arch/arm64/include/asm/dma-mapping.h | 73 ++++++++++++++++++++++++++++++++++--
 arch/arm64/include/asm/memory.h      |  8 ++++

We had a similar patch already here:

http://article.gmane.org/gmane.linux.ports.arm.kernel/500565

Maybe you need some alignment with other contributing RPi3 patches.

Quoted 5 lines
arch/arm64/include/asm/memory.h +0 -0
index 72a3025..ab4c65e 100644

arch/arm64/include/asm/memory.h static inline void *phys_to_virt(phys_addr_t x) · line 234

Quoted 9 lines
arch/arm64/include/asm/memory.h +6 -0
@@ -226,6 +226,14 @@ static inline void *phys_to_virt(phys_addr_t x)
 #endif
 #endif
 
+#ifndef __virt_to_bus
+#define __virt_to_bus	__virt_to_phys
+#define __bus_to_virt	__phys_to_virt
+#define __pfn_to_bus(x)	__pfn_to_phys(x)
+#define __bus_to_pfn(x)	__phys_to_pfn(x)
+#endif

Do you really need these macros? What's with the #ifndef, anything going to override them?

Signature · 1 line
Catalin
#18 lore raw

PATCH 7/32 ARM: bcm2835: dt: Add the ethernet to the device trees

In reply to a message not in the archive

From: Lubomir Rintel <[email protected]>

The hub and the ethernet in its port 1 are hardwired on the board.

Compared to the adapters that can be plugged into the USB ports, this one has no serial EEPROM to store its MAC. Nevertheless, the Raspberry Pi has the MAC address for this adapter in its ROM, accessible from its firmware.

U-Boot can read out the address and set the local-mac-address property of the node with "ethernet" alias. Let's add the node so that U-Boot can do its business.

Model B rev2 and Model B+ entries were verified by me, the hierarchy and pid/vid pair for the Version 2 was provided by Peter Chen. Original Model B is a blind shot, though very likely correct.

---
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts    |  1 +
 arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts    |  1 +
 arch/arm/boot/dts/bcm2835-rpi-b.dts         |  1 +
 arch/arm/boot/dts/bcm2836-rpi-2-b.dts       |  1 +
 arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi | 19 +++++++++++++++++++
 arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi | 19 +++++++++++++++++++
 arch/arm/boot/dts/bcm283x.dtsi              |  2 ++
 7 files changed, 44 insertions(+)
 create mode 100644 arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi
 create mode 100644 arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +1 -0
index 57d313b..d5fdb8e 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 #include "bcm2835.dtsi"
 #include "bcm2835-rpi.dtsi"
+#include "bcm283x-rpi-smsc9514.dtsi"
 
 / {
 	compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts +1 -0
index cf2774e..bfc4bd9 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 #include "bcm2835.dtsi"
 #include "bcm2835-rpi.dtsi"
+#include "bcm283x-rpi-smsc9512.dtsi"
 
 / {
 	compatible = "raspberrypi,model-b-rev2", "brcm,bcm2835";
arch/arm/boot/dts/bcm2835-rpi-b.dts +1 -0
index 8b15f9c..0371bb7 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 #include "bcm2835.dtsi"
 #include "bcm2835-rpi.dtsi"
+#include "bcm283x-rpi-smsc9512.dtsi"
 
 / {
 	compatible = "raspberrypi,model-b", "brcm,bcm2835";
arch/arm/boot/dts/bcm2836-rpi-2-b.dts +1 -0
index c4743f4..29e1cfe 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 #include "bcm2836.dtsi"
 #include "bcm2835-rpi.dtsi"
+#include "bcm283x-rpi-smsc9514.dtsi"
 
 / {
 	compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi new file +19 -0
new file mode 100644
index 0000000..12c981e
@@ -0,0 +1,19 @@
+/ {
+	aliases {
+		ethernet = &ethernet;
+	};
+};
+
+&usb {
+	usb1 at 1 {
+		compatible = "usb424,9512";
+		reg = <1>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		ethernet: usbether at 1 {
+			compatible = "usb424,ec00";
+			reg = <1>;
+		};
+	};
+};
arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi new file +19 -0
new file mode 100644
index 0000000..3f0a56e
@@ -0,0 +1,19 @@
+/ {
+	aliases {
+		ethernet = &ethernet;
+	};
+};
+
+&usb {
+	usb1 at 1 {
+		compatible = "usb424,9514";
+		reg = <1>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		ethernet: usbether at 1 {
+			compatible = "usb424,ec00";
+			reg = <1>;
+		};
+	};
+};
arch/arm/boot/dts/bcm283x.dtsi +2 -0
index 10b27b9..b982522 100644
@@ -287,6 +287,8 @@
 			compatible = "brcm,bcm2835-usb";
 			reg = <0x7e980000 0x10000>;
 			interrupts = <1 9>;
+			#address-cells = <1>;
+			#size-cells = <0>;
 		};
 
 		v3d: v3d at 7ec00000 {
Signature · 1 line
1.8.3.1
#19 lore raw

PATCH 8/32 ARM: bcm2837: dt: Add the ethernet to the device trees

In reply to a message not in the archive
---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +1 -0
index 223793d..6f47dd2 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 #include "bcm2837.dtsi"
 #include "../../../../arm/boot/dts/bcm2835-rpi.dtsi"
+#include "../../../../arm/boot/dts/bcm283x-rpi-smsc9514.dtsi"
 
 / {
 	compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
Signature · 1 line
1.8.3.1
#20 lore raw

PATCH 9/32 bcm2837-rpi-3-b.dts for 32bit arm

In reply to a message not in the archive
---
 arch/arm/boot/dts/Makefile            | 3 ++-
 arch/arm/boot/dts/bcm2837-rpi-3-b.dts | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/bcm2837-rpi-3-b.dts
arch/arm/boot/dts/Makefile +2 -1
index 06b6c2d..16de98f 100644
@@ -66,7 +66,8 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
 	bcm2835-rpi-b-rev2.dtb \
 	bcm2835-rpi-b-plus.dtb \
 	bcm2835-rpi-a-plus.dtb \
-	bcm2836-rpi-2-b.dtb
+	bcm2836-rpi-2-b.dtb \
+	bcm2837-rpi-3-b.dtb
 dtb-$(CONFIG_ARCH_BCM_5301X) += \
 	bcm4708-asus-rt-ac56u.dtb \
 	bcm4708-asus-rt-ac68u.dtb \
arch/arm/boot/dts/bcm2837-rpi-3-b.dts new file +1 -0
new file mode 100644
index 0000000..36178a6
@@ -0,0 +1 @@
+#include "../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts"
Signature · 1 line
1.8.3.1
maintainer
#21 lore raw

Re: [PATCH 09/32] bcm2837-rpi-3-b.dts for 32bit arm

Quoted 10 lines · CEST Gerd Hoffmann
arch/arm/boot/dts/bcm2837-rpi-3-b.dts new file +1 -0
new file mode 100644
index 0000000..36178a6
@@ -0,0 +1 @@
+#include "../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts"
Signature · 1 line
1.8.3.1

What does this gain you?

Arnd

#22 lore raw

Re: [PATCH 09/32] bcm2837-rpi-3-b.dts for 32bit arm

Quoted 13 lines · Arnd Bergmann
Quoted 10 lines · CEST Gerd Hoffmann
arch/arm/boot/dts/bcm2837-rpi-3-b.dts new file +1 -0
new file mode 100644
index 0000000..36178a6
@@ -0,0 +1 @@
+#include "../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts"
Signature · 1 line
1.8.3.1

What does this gain you?

Many Raspberry Pi users use a small set of SD cards that they swap
between various versions of the hardware. It would be good to have
their 32-bit OS images work on the Pi3 as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160601/d63d9ec8/attachment.sig>

maintainer
#23 lore raw

Re: [PATCH 09/32] bcm2837-rpi-3-b.dts for 32bit arm

Quoted 16 lines · CEST Eric Anholt
Quoted 13 lines · Arnd Bergmann
Quoted 10 lines · CEST Gerd Hoffmann
arch/arm/boot/dts/bcm2837-rpi-3-b.dts new file +1 -0
new file mode 100644
index 0000000..36178a6
@@ -0,0 +1 @@
+#include "../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts"
Signature · 1 line
1.8.3.1

What does this gain you?

Quoted 3 lines

Many Raspberry Pi users use a small set of SD cards that they swap between various versions of the hardware. It would be good to have their 32-bit OS images work on the Pi3 as well.

Sure, but you already have the dts file in the other directory, and the dtb is the same.

According to the comment in the other patch, the idea was to have the file in the arm64 directory because it's a 64-bit platform, but now you have it here as well.

Arnd

#24 lore raw

Re: [PATCH 09/32] bcm2837-rpi-3-b.dts for 32bit arm

Quoted 21 lines · Arnd Bergmann
Quoted 16 lines · CEST Eric Anholt
Quoted 13 lines · Arnd Bergmann
Quoted 10 lines · CEST Gerd Hoffmann
arch/arm/boot/dts/bcm2837-rpi-3-b.dts new file +1 -0
new file mode 100644
index 0000000..36178a6
@@ -0,0 +1 @@
+#include "../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts"
Signature · 1 line
1.8.3.1

What does this gain you?

Quoted 3 lines

Many Raspberry Pi users use a small set of SD cards that they swap between various versions of the hardware. It would be good to have their 32-bit OS images work on the Pi3 as well.

Quoted 6 lines

Sure, but you already have the dts file in the other directory, and the dtb is the same.

According to the comment in the other patch, the idea was to have the file in the arm64 directory because it's a 64-bit platform, but now you have it here as well.

Well, it just includes the arm64 version as-is, so we don't have duplication. I'm open to suggestions to how handle this better.

Symbolic link?

Reference to ../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts directly in the Makefile?

I've seen arch/arm/boot/dts/Makefile uses globs on *.dts, so I suspect the later wouldn't be that straight forward.

cheers,
Gerd

maintainer
#25 lore raw

Re: [PATCH 09/32] bcm2837-rpi-3-b.dts for 32bit arm

Quoted 32 lines · CEST Gerd Hoffmann
Quoted 21 lines · Arnd Bergmann
Quoted 16 lines · CEST Eric Anholt
Quoted 13 lines · Arnd Bergmann
Quoted 10 lines · CEST Gerd Hoffmann
arch/arm/boot/dts/bcm2837-rpi-3-b.dts new file +1 -0
new file mode 100644
index 0000000..36178a6
@@ -0,0 +1 @@
+#include "../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts"
Signature · 1 line
1.8.3.1

What does this gain you?

Quoted 3 lines

Many Raspberry Pi users use a small set of SD cards that they swap between various versions of the hardware. It would be good to have their 32-bit OS images work on the Pi3 as well.

Quoted 6 lines

Sure, but you already have the dts file in the other directory, and the dtb is the same.

According to the comment in the other patch, the idea was to have the file in the arm64 directory because it's a 64-bit platform, but now you have it here as well.

Well, it just includes the arm64 version as-is, so we don't have duplication. I'm open to suggestions to how handle this better.

Quoted 7 lines

Symbolic link?

Reference to ../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts directly in the Makefile?

I've seen arch/arm/boot/dts/Makefile uses globs on *.dts, so I suspect the later wouldn't be that straight forward.

It's just weird that the arm64 file includes the .dtsi files from arch/arm/ and is then again included back from another file there.

I can see two possible ways to handle this better:

- leave the complete set of bcm2837 files in arch/arm and then have one reference from arch/arm64 per .dts that refers to just that file.

- come up with a rule to also build the .dtb files in arch/arm64 when we run 'make dtbs' for arch/arm and leave this file there. The argument that one could use the same dtb with a 32-bit kernel should basically hold true for any arm64 system, it's not specific to rpi-3 really. We don't normally test 32-bit kernels on 64-bit SoCs because 64-bit kernels are more efficient in a number of ways, and I'm sure there are bugs that prevent some systems from working (aside from how some machines cannot work because they don't have RAM below 4GB), but if this is now something that users are interested in, making it just work seems nicer than having a couple of board specific hacks.

Arnd

#26 lore raw

Re: [PATCH 09/32] bcm2837-rpi-3-b.dts for 32bit arm

Hi,

Quoted 11 lines
Quoted 10 lines

Well, it just includes the arm64 version as-is, so we don't have duplication. I'm open to suggestions to how handle this better.

Symbolic link?

Reference to ../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts directly in the Makefile?

I've seen arch/arm/boot/dts/Makefile uses globs on *.dts, so I suspect the later wouldn't be that straight forward.

Quoted 7 lines

It's just weird that the arm64 file includes the .dtsi files from arch/arm/ and is then again included back from another file there.

I can see two possible ways to handle this better:

- leave the complete set of bcm2837 files in arch/arm and then have one reference from arch/arm64 per .dts that refers to just that file.

So basically do it the other way around. Would be a bit less messy indeed.

Quoted 4 lines

- come up with a rule to also build the .dtb files in arch/arm64 when we run 'make dtbs' for arch/arm and leave this file there. The argument that one could use the same dtb with a 32-bit kernel should basically hold true for any arm64 system, it's not specific to rpi-3 really.

Yes, in theory. No, in practice. As far I know the rpi3 is the only 64bit soc where a almost identical 32bit version exists, so running 32bit kernels on a 64bit processor actually happens in practice and I expect this to continue. If you want create sdcard images which run on any rpi variant this is pretty much the only reasonable way to do it.

Quoted 6 lines

We don't normally test 32-bit kernels on 64-bit SoCs because 64-bit kernels are more efficient in a number of ways, and I'm sure there are bugs that prevent some systems from working (aside from how some machines cannot work because they don't have RAM below 4GB), but if this is now something that users are interested in, making it just work seems nicer than having a couple of board specific hacks.

See above, I have my doubts that the user interest in this expands to other boards. So I'd tend to pick the first option.

cheers,
Gerd

maintainer
#27 lore raw

Re: [PATCH 09/32] bcm2837-rpi-3-b.dts for 32bit arm

Quoted 29 lines · CEST Gerd Hoffmann

Hi,

Quoted 11 lines
Quoted 10 lines

Well, it just includes the arm64 version as-is, so we don't have duplication. I'm open to suggestions to how handle this better.

Symbolic link?

Reference to ../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts directly in the Makefile?

I've seen arch/arm/boot/dts/Makefile uses globs on *.dts, so I suspect the later wouldn't be that straight forward.

Quoted 7 lines

It's just weird that the arm64 file includes the .dtsi files from arch/arm/ and is then again included back from another file there.

I can see two possible ways to handle this better:

- leave the complete set of bcm2837 files in arch/arm and then have one reference from arch/arm64 per .dts that refers to just that file.

So basically do it the other way around. Would be a bit less messy indeed.

Quoted 4 lines

- come up with a rule to also build the .dtb files in arch/arm64 when we run 'make dtbs' for arch/arm and leave this file there. The argument that one could use the same dtb with a 32-bit kernel should basically hold true for any arm64 system, it's not specific to rpi-3 really.

Quoted 5 lines

Yes, in theory. No, in practice. As far I know the rpi3 is the only 64bit soc where a almost identical 32bit version exists, so running 32bit kernels on a 64bit processor actually happens in practice and I expect this to continue. If you want create sdcard images which run on any rpi variant this is pretty much the only reasonable way to do it.

I think the Allwinner A64 and the Samsung s5p6818 are other examples for this, where the initial run of boards all run 32-bit kernels for much of the same reasons. If users want to run a 32-bit distro on rpi-3 and on e.g. orange-pi, I don't see why they wouldn't also run the same binary on A64.

Arnd

#28 lore raw

Re: [PATCH 09/32] bcm2837-rpi-3-b.dts for 32bit arm

Hi,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Reference to ../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts directly in the Makefile?

Actually tried that, and to my surprise this worked fine for both "make dtbs" and "make dtbs_install".

So we should just do that I guess ...

Quoted 11 lines
Quoted 5 lines

Yes, in theory. No, in practice. As far I know the rpi3 is the only 64bit soc where a almost identical 32bit version exists, so running 32bit kernels on a 64bit processor actually happens in practice and I expect this to continue. If you want create sdcard images which run on any rpi variant this is pretty much the only reasonable way to do it.

I think the Allwinner A64 and the Samsung s5p6818 are other examples for this, where the initial run of boards all run 32-bit kernels for much of the same reasons. If users want to run a 32-bit distro on rpi-3 and on e.g. orange-pi, I don't see why they wouldn't also run the same binary on A64.

... and others can join the party on a case-by-case basis.

I still expect for the majority of arm64 boards it is not very useful, so I don't think we should build all of them unconditionally.

cheers,
Gerd

maintainer
#29 lore raw

Re: [PATCH 09/32] bcm2837-rpi-3-b.dts for 32bit arm

Quoted 8 lines · CEST Gerd Hoffmann
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Reference to ../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts directly in the Makefile?

Actually tried that, and to my surprise this worked fine for both "make dtbs" and "make dtbs_install".

So we should just do that I guess ...

Right.

Quoted 12 lines
Quoted 11 lines
Quoted 5 lines

Yes, in theory. No, in practice. As far I know the rpi3 is the only 64bit soc where a almost identical 32bit version exists, so running 32bit kernels on a 64bit processor actually happens in practice and I expect this to continue. If you want create sdcard images which run on any rpi variant this is pretty much the only reasonable way to do it.

I think the Allwinner A64 and the Samsung s5p6818 are other examples for this, where the initial run of boards all run 32-bit kernels for much of the same reasons. If users want to run a 32-bit distro on rpi-3 and on e.g. orange-pi, I don't see why they wouldn't also run the same binary on A64.

Quoted 4 lines

... and others can join the party on a case-by-case basis.

I still expect for the majority of arm64 boards it is not very useful, so I don't think we should build all of them unconditionally.

Well, they are still controlled by Kconfig symbols. Some of them are shared between arm and arm64 and you would just get all dtbs in that case, while other symbols are specific to one of the two.

Just for fun, which machines do we actually get if we decide to just enter the arch/arm64/boot/dts/ directory in an allmodconfig build?

Arnd

#30 lore raw

PATCH 10/32 don't force serial pins to uart0

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

---
 arch/arm/boot/dts/bcm2835-rpi.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi.dtsi +1 -1
index caf2707..88bcd0c 100644
@@ -38,7 +38,7 @@
 	};
 
 	alt0: alt0 {
-		brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
+		brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 40 45>;
 		brcm,function = <BCM2835_FSEL_ALT0>;
 	};
 
Signature · 1 line
1.8.3.1
maintainer
#31 lore raw

Re: [PATCH 10/32] don't force serial pins to uart0

Quoted 4 lines · CEST Gerd Hoffmann

From: Eric Anholt <[email protected]>

---

No signoff or description?

Arnd

#32 lore raw

Re: [PATCH 10/32] don't force serial pins to uart0

Quoted 7 lines · Arnd Bergmann
Quoted 4 lines · CEST Gerd Hoffmann

From: Eric Anholt <[email protected]>

---

No signoff or description?

This commit should not have been sent out as is. Gerd took a bunch of messy commits from my trees that were intended to be squashed (or never sent out at all!) and picked them and sent them out.

It's nice though that people are paying attention to this series now.
Several of these patches had been sent before and got basically silence.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160602/523cab72/attachment.sig>

#33 lore raw

PATCH 11/32 ARM: bcm2835: Define standard pinctrl groups in the gpio node.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

The BCM2835-ARM-Peripherals.pdf documentation specifies what the function selects do for the pins, and there are a bunch of obvious groupings to be made. With these created, we'll be able to replace bcm2835-rpi.dtsi's main "set all of these pins to alt0" with references to specific groups we want enabled.

---
 arch/arm/boot/dts/bcm283x.dtsi | 170 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 170 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +170 -0
index b982522..9aefb65 100644
@@ -131,6 +131,176 @@
 
 			interrupt-controller;
 			#interrupt-cells = <2>;
+
+			/* Defines pin muxing groups according to
+			 * BCM2835-ARM-Peripherals.pdf page 102.
+			 *
+			 * While each pin can have its mux selected
+			 * for various functions individually, some
+			 * groups only make sense to switch to a
+			 * particular function together.
+			 */
+			i2c0_gpio0: i2c0_gpio0 {
+				brcm,pins = <0 1>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			i2c1_gpio2: i2c1_gpio2 {
+				brcm,pins = <2 3>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			gpclk0_gpio4: gpclk0_gpio4 {
+				brcm,pins = <4>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			gpclk1_gpio5: gpclk1_gpio5 {
+				brcm,pins = <5>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			gpclk2_gpio6: gpclk2_gpio6 {
+				brcm,pins = <6>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			spi0_gpio7: spi0_gpio7 {
+				brcm,pins = <7 8 9 10 11>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			pwm0_gpio12: pwm0_gpio12 {
+				brcm,pins = <12>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			pwm1_gpio13: pwm1_gpio13 {
+				brcm,pins = <13>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			uart0_gpio14: uart0_gpio14 {
+				brcm,pins = <14 15>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			pcm_gpio18: pcm_gpio18 {
+				brcm,pins = <18 19 20 21>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			i2c0_gpio32: i2c0_gpio32 {
+				brcm,pins = <32 34>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			spio0_gpio35: spio0_gpio35 {
+				brcm,pins = <35 36 37 38 39>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			pwm0_gpio40: pwm0_gpio40 {
+				brcm,pins = <40>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			pwm1_gpio41: pwm1_gpio41 {
+				brcm,pins = <41>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			gpclk1_gpio42: gpclk1_gpio42 {
+				brcm,pins = <42>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			gpclk2_gpio43: gpclk2_gpio43 {
+				brcm,pins = <43>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			gpclk1_gpio44: gpclk1_gpio44 {
+				brcm,pins = <44>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			pwm1_gpio45: pwm1_gpio45 {
+				brcm,pins = <45>;
+				brcm,function = <BCM2835_FSEL_ALT0>;
+			};
+			i2c0_gpio44: i2c0_gpio44 {
+				brcm,pins = <44 45>;
+				brcm,function = <BCM2835_FSEL_ALT1>;
+			};
+			pcm_gpio28: pcm_gpio28 {
+				brcm,pins = <28 29 30 31>;
+				brcm,function = <BCM2835_FSEL_ALT2>;
+			};
+			uart1_gpio36: uart1_gpio36 {
+				brcm,pins = <36 37 38 39>;
+				brcm,function = <BCM2835_FSEL_ALT2>;
+			};
+			i2c1_gpio44: i2c1_gpio44 {
+				brcm,pins = <44 45>;
+				brcm,function = <BCM2835_FSEL_ALT2>;
+			};
+			/* Separate from the uart0_gpio14 group
+			 * because it conflicts with spi1_gpio16, and
+			 * people often run uart0 on the two pins
+			 * without flow contrl.
+			 */
+			uart0_ctsrts_gpio16: uart0_ctsrts_gpio16 {
+				brcm,pins = <16 17>;
+				brcm,function = <BCM2835_FSEL_ALT3>;
+			};
+			i2c_slave_gpio18: i2c_slave_gpio18 {
+				brcm,pins = <18 19 20 21>;
+				brcm,function = <BCM2835_FSEL_ALT3>;
+			};
+			emmc_gpio22: emmc_gpio22 {
+				brcm,pins = <22 23 24 25 26 27>;
+				brcm,function = <BCM2835_FSEL_ALT3>;
+			};
+			uart0_gpio30: uart0_gpio30 {
+				brcm,pins = <30 31>;
+				brcm,function = <BCM2835_FSEL_ALT3>;
+			};
+			uart0_ctsrts_gpio32: uart0_ctsrts_gpio32 {
+				brcm,pins = <32 33>;
+				brcm,function = <BCM2835_FSEL_ALT3>;
+			};
+			spi1_gpio16: spi1_gpio16 {
+				brcm,pins = <16 17 18 19 20 21>;
+				brcm,function = <BCM2835_FSEL_ALT4>;
+			};
+			jtag_gpio22: jtag_gpio22 {
+				brcm,pins = <22 23 24 25 26 27>;
+				brcm,function = <BCM2835_FSEL_ALT4>;
+			};
+			spi2_gpio40: spi2_gpio40 {
+				brcm,pins = <40 41 42 43 44 45>;
+				brcm,function = <BCM2835_FSEL_ALT4>;
+			};
+			jtag_gpio4: jtag_gpio4 {
+				brcm,pins = <4 5 6 12 13>;
+				brcm,function = <BCM2835_FSEL_ALT4>;
+			};
+			uart1_gpio14: uart1_gpio14 {
+				brcm,pins = <14 15>;
+				brcm,function = <BCM2835_FSEL_ALT5>;
+			};
+			uart1_ctsrts_gpio16: uart1_ctsrts_gpio16 {
+				brcm,pins = <16 17>;
+				brcm,function = <BCM2835_FSEL_ALT5>;
+			};
+			pwm0_gpio18: pwm0_gpio18 {
+				brcm,pins = <18>;
+				brcm,function = <BCM2835_FSEL_ALT5>;
+			};
+			pwm1_gpio19: pwm1_gpio19 {
+				brcm,pins = <19>;
+				brcm,function = <BCM2835_FSEL_ALT5>;
+			};
+			uart1_gpio30: uart1_gpio30 {
+				brcm,pins = <30 31>;
+				brcm,function = <BCM2835_FSEL_ALT5>;
+			};
+			uart1_ctsrts_gpio32: uart1_ctsrts_gpio32 {
+				brcm,pins = <32 33>;
+				brcm,function = <BCM2835_FSEL_ALT5>;
+			};
+			uart1_gpio40: uart1_gpio40 {
+				brcm,pins = <40 41>;
+				brcm,function = <BCM2835_FSEL_ALT5>;
+			};
+			uart1_ctsrts_gpio42: uart1_ctsrts_gpio42 {
+				brcm,pins = <42 43>;
+				brcm,function = <BCM2835_FSEL_ALT5>;
+			};
 		};
 
 		uart0: serial at 7e201000 {
Signature · 1 line
1.8.3.1
#34 lore raw

PATCH 12/32 ARM: bcm2835: Replace alt0/i2s_alt[02] with standard groups.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

Since all of these pins were documented, we can use their names to explain what's going on.

---
 arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 17 ++++++++++-------
 arch/arm/boot/dts/bcm2835-rpi-a.dts      | 17 ++++++++++-------
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 17 ++++++++++-------
 arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 17 ++++++++++-------
 arch/arm/boot/dts/bcm2835-rpi-b.dts      | 10 +++++++++-
 arch/arm/boot/dts/bcm2835-rpi.dtsi       |  5 -----
 arch/arm/boot/dts/bcm2836-rpi-2-b.dts    | 17 ++++++++++-------
 7 files changed, 59 insertions(+), 41 deletions(-)
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts +10 -7
index 35ff4e7a..e90f870 100644
@@ -21,13 +21,16 @@
 };
 
 &gpio {
-	pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>;
-
-	/* I2S interface */
-	i2s_alt0: i2s_alt0 {
-		brcm,pins = <18 19 20 21>;
-		brcm,function = <BCM2835_FSEL_ALT0>;
-	};
+	pinctrl-0 = <&i2c0_gpio0
+		     &i2c1_gpio2
+		     &gpclk0_gpio4
+		     &gpclk1_gpio5
+		     &spi0_gpio7
+		     &pcm_gpio18
+		     &pwm0_gpio40
+		     &pwm1_gpio45
+		     &gpioout
+		     &alt3>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-a.dts +10 -7
index 306a84e..2de38c3 100644
@@ -14,13 +14,16 @@
 };
 
 &gpio {
-	pinctrl-0 = <&gpioout &alt0 &i2s_alt2 &alt3>;
-
-	/* I2S interface */
-	i2s_alt2: i2s_alt2 {
-		brcm,pins = <28 29 30 31>;
-		brcm,function = <BCM2835_FSEL_ALT2>;
-	};
+	pinctrl-0 = <&i2c0_gpio0
+		     &i2c1_gpio2
+		     &gpclk0_gpio4
+		     &gpclk1_gpio5
+		     &spi0_gpio7
+		     &pcm_gpio28
+		     &pwm0_gpio40
+		     &pwm1_gpio45
+		     &gpioout
+		     &alt3>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +10 -7
index d5fdb8e..9ad3125 100644
@@ -22,13 +22,16 @@
 };
 
 &gpio {
-	pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>;
-
-	/* I2S interface */
-	i2s_alt0: i2s_alt0 {
-		brcm,pins = <18 19 20 21>;
-		brcm,function = <BCM2835_FSEL_ALT0>;
-	};
+	pinctrl-0 = <&i2c0_gpio0
+		     &i2c1_gpio2
+		     &gpclk0_gpio4
+		     &gpclk1_gpio5
+		     &spi0_gpio7
+		     &pcm_gpio18
+		     &pwm0_gpio40
+		     &pwm1_gpio45
+		     &gpioout
+		     &alt3>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts +10 -7
index bfc4bd9..1bec67f 100644
@@ -15,13 +15,16 @@
 };
 
 &gpio {
-	pinctrl-0 = <&gpioout &alt0 &i2s_alt2 &alt3>;
-
-	/* I2S interface */
-	i2s_alt2: i2s_alt2 {
-		brcm,pins = <28 29 30 31>;
-		brcm,function = <BCM2835_FSEL_ALT2>;
-	};
+	pinctrl-0 = <&i2c0_gpio0
+		     &i2c1_gpio2
+		     &gpclk0_gpio4
+		     &gpclk1_gpio5
+		     &spi0_gpio7
+		     &pcm_gpio28
+		     &pwm0_gpio40
+		     &pwm1_gpio45
+		     &gpioout
+		     &alt3>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-b.dts +9 -1
index 0371bb7..0e9f566 100644
@@ -15,7 +15,15 @@
 };
 
 &gpio {
-	pinctrl-0 = <&gpioout &alt0 &alt3>;
+	pinctrl-0 = <&i2c0_gpio0
+		     &i2c1_gpio2
+		     &gpclk0_gpio4
+		     &gpclk1_gpio5
+		     &spi0_gpio7
+		     &pwm0_gpio40
+		     &pwm1_gpio45
+		     &gpioout
+		     &alt3>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi.dtsi +0 -5
index 88bcd0c..e9ab80a 100644
@@ -37,11 +37,6 @@
 		brcm,function = <BCM2835_FSEL_GPIO_OUT>;
 	};
 
-	alt0: alt0 {
-		brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 40 45>;
-		brcm,function = <BCM2835_FSEL_ALT0>;
-	};
-
 	alt3: alt3 {
 		brcm,pins = <48 49 50 51 52 53>;
 		brcm,function = <BCM2835_FSEL_ALT3>;
arch/arm/boot/dts/bcm2836-rpi-2-b.dts +10 -7
index 29e1cfe..348e3e1 100644
@@ -26,13 +26,16 @@
 };
 
 &gpio {
-	pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>;
-
-	/* I2S interface */
-	i2s_alt0: i2s_alt0 {
-		brcm,pins = <18 19 20 21>;
-		brcm,function = <BCM2835_FSEL_ALT0>;
-	};
+	pinctrl-0 = <&i2c0_gpio0
+		     &i2c1_gpio2
+		     &gpclk0_gpio4
+		     &gpclk1_gpio5
+		     &spi0_gpio7
+		     &pcm_gpio18
+		     &pwm0_gpio40
+		     &pwm1_gpio45
+		     &gpioout
+		     &alt3>;
 };
 
 &hdmi {
Signature · 1 line
1.8.3.1
#35 lore raw

PATCH 13/32 bcm2837-rpi-3-b.dts: add gpio

In reply to a message not in the archive
---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +13 -0
index 6f47dd2..e0f429b 100644
@@ -25,6 +25,19 @@
 	};
 };
 
+&gpio {
+	pinctrl-0 = <&i2c0_gpio0
+		     &i2c1_gpio2
+		     &gpclk0_gpio4
+		     &gpclk1_gpio5
+		     &spi0_gpio7
+		     &pcm_gpio18
+		     &pwm0_gpio40
+		     &pwm1_gpio45
+		     &gpioout
+		     &alt3>;
+};
+
 &uart1 {
 	status = "okay";
 };
Signature · 1 line
1.8.3.1
#36 lore raw

PATCH 14/32 bcm2837-rpi-3-b.dts: vc4 hdmi fixup

In reply to a message not in the archive
---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +4 -0
index e0f429b..a523bd7 100644
@@ -41,3 +41,7 @@
 &uart1 {
 	status = "okay";
 };
+
+&hdmi {
+	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
+};
Signature · 1 line
1.8.3.1
#37 lore raw

PATCH 15/32 ARM: bcm2835: Move the emmc pin group to bcm283x.dtsi.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

While it's not documented in the public PDF, it is internally. This is a standard pin group for the 283x, not rpi-specific.

---
 arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 4 ++--
 arch/arm/boot/dts/bcm2835-rpi-a.dts      | 4 ++--
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 4 ++--
 arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 4 ++--
 arch/arm/boot/dts/bcm2835-rpi-b.dts      | 4 ++--
 arch/arm/boot/dts/bcm2835-rpi.dtsi       | 5 -----
 arch/arm/boot/dts/bcm2836-rpi-2-b.dts    | 4 ++--
 arch/arm/boot/dts/bcm283x.dtsi           | 4 ++++
 8 files changed, 16 insertions(+), 17 deletions(-)
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts +2 -2
index e90f870..5bd0bfe 100644
@@ -29,8 +29,8 @@
 		     &pcm_gpio18
 		     &pwm0_gpio40
 		     &pwm1_gpio45
-		     &gpioout
-		     &alt3>;
+		     &emmc_gpio48
+		     &gpioout>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-a.dts +2 -2
index 2de38c3..ba1b0ac 100644
@@ -22,8 +22,8 @@
 		     &pcm_gpio28
 		     &pwm0_gpio40
 		     &pwm1_gpio45
-		     &gpioout
-		     &alt3>;
+		     &emmc_gpio48
+		     &gpioout>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +2 -2
index 9ad3125..609a5e8 100644
@@ -30,8 +30,8 @@
 		     &pcm_gpio18
 		     &pwm0_gpio40
 		     &pwm1_gpio45
-		     &gpioout
-		     &alt3>;
+		     &emmc_gpio48
+		     &gpioout>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts +2 -2
index 1bec67f..97de2d5 100644
@@ -23,8 +23,8 @@
 		     &pcm_gpio28
 		     &pwm0_gpio40
 		     &pwm1_gpio45
-		     &gpioout
-		     &alt3>;
+		     &emmc_gpio48
+		     &gpioout>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-b.dts +2 -2
index 0e9f566..bc59f7e 100644
@@ -22,8 +22,8 @@
 		     &spi0_gpio7
 		     &pwm0_gpio40
 		     &pwm1_gpio45
-		     &gpioout
-		     &alt3>;
+		     &emmc_gpio48
+		     &gpioout>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi.dtsi +0 -5
index e9ab80a..7e65d16 100644
@@ -36,11 +36,6 @@
 		brcm,pins = <6>;
 		brcm,function = <BCM2835_FSEL_GPIO_OUT>;
 	};
-
-	alt3: alt3 {
-		brcm,pins = <48 49 50 51 52 53>;
-		brcm,function = <BCM2835_FSEL_ALT3>;
-	};
 };
 
 &i2c0 {
arch/arm/boot/dts/bcm2836-rpi-2-b.dts +2 -2
index 348e3e1..b4cbffe 100644
@@ -34,8 +34,8 @@
 		     &pcm_gpio18
 		     &pwm0_gpio40
 		     &pwm1_gpio45
-		     &gpioout
-		     &alt3>;
+		     &emmc_gpio48
+		     &gpioout>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm283x.dtsi +4 -0
index 9aefb65..28ed77f 100644
@@ -253,6 +253,10 @@
 				brcm,pins = <32 33>;
 				brcm,function = <BCM2835_FSEL_ALT3>;
 			};
+			emmc_gpio48: emmc_gpio48 {
+				brcm,pins = <48 49 50 51 52 53>;
+				brcm,function = <BCM2835_FSEL_ALT3>;
+			};
 			spi1_gpio16: spi1_gpio16 {
 				brcm,pins = <16 17 18 19 20 21>;
 				brcm,function = <BCM2835_FSEL_ALT4>;
Signature · 1 line
1.8.3.1
#38 lore raw

PATCH 16/32 bcm2837-rpi-3-b.dts: move the emmc pin group

In reply to a message not in the archive
---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +2 -2
index a523bd7..8579df3 100644
@@ -34,8 +34,8 @@
 		     &pcm_gpio18
 		     &pwm0_gpio40
 		     &pwm1_gpio45
-		     &gpioout
-		     &alt3>;
+		     &emmc_gpio48
+		     &gpioout>;
 };
 
 &uart1 {
Signature · 1 line
1.8.3.1
#39 lore raw

PATCH 17/32 ARM: bcm2835: Add a group for mapping pins 48-53 to sdhost.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

This pin group definition comes from downstream. We don't have a driver for sdhost integrated yet, but they've been experimenting with it and it sounds useful to bring over.

---
 arch/arm/boot/dts/bcm283x.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +4 -0
index 28ed77f..3866fc7a 100644
@@ -212,6 +212,10 @@
 				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>;
+			};
 			i2c0_gpio44: i2c0_gpio44 {
 				brcm,pins = <44 45>;
 				brcm,function = <BCM2835_FSEL_ALT1>;
Signature · 1 line
1.8.3.1
#40 lore raw

PATCH 18/32 ARM: bcm2835: Move most RPi default pin groups to their devices.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

This way we can get the duplicated pin group definitions out of each RPi board file, and just leave the i2s variations in them.

Conflicts:

	arch/arm/boot/dts/bcm2835-rpi-b.dts
	arch/arm/boot/dts/bcm2835-rpi.dtsi
---
 arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 14 +++-----------
 arch/arm/boot/dts/bcm2835-rpi-a.dts      | 14 +++-----------
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 14 +++-----------
 arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 14 +++-----------
 arch/arm/boot/dts/bcm2835-rpi-b.dts      | 12 ------------
 arch/arm/boot/dts/bcm2835-rpi.dtsi       | 20 ++++++++++++++++++++
 arch/arm/boot/dts/bcm2836-rpi-2-b.dts    | 14 +++-----------
 7 files changed, 35 insertions(+), 67 deletions(-)
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts +3 -11
index 5bd0bfe..670ae70 100644
@@ -20,17 +20,9 @@
 	};
 };
 
-&gpio {
-	pinctrl-0 = <&i2c0_gpio0
-		     &i2c1_gpio2
-		     &gpclk0_gpio4
-		     &gpclk1_gpio5
-		     &spi0_gpio7
-		     &pcm_gpio18
-		     &pwm0_gpio40
-		     &pwm1_gpio45
-		     &emmc_gpio48
-		     &gpioout>;
+&i2s {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcm_gpio18>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-a.dts +3 -11
index ba1b0ac..e980637 100644
@@ -13,17 +13,9 @@
 	};
 };
 
-&gpio {
-	pinctrl-0 = <&i2c0_gpio0
-		     &i2c1_gpio2
-		     &gpclk0_gpio4
-		     &gpclk1_gpio5
-		     &spi0_gpio7
-		     &pcm_gpio28
-		     &pwm0_gpio40
-		     &pwm1_gpio45
-		     &emmc_gpio48
-		     &gpioout>;
+&i2s {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcm_gpio28>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +3 -11
index 609a5e8..312d977 100644
@@ -21,17 +21,9 @@
 	};
 };
 
-&gpio {
-	pinctrl-0 = <&i2c0_gpio0
-		     &i2c1_gpio2
-		     &gpclk0_gpio4
-		     &gpclk1_gpio5
-		     &spi0_gpio7
-		     &pcm_gpio18
-		     &pwm0_gpio40
-		     &pwm1_gpio45
-		     &emmc_gpio48
-		     &gpioout>;
+&i2s {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcm_gpio18>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts +3 -11
index 97de2d5..3d1d061 100644
@@ -14,17 +14,9 @@
 	};
 };
 
-&gpio {
-	pinctrl-0 = <&i2c0_gpio0
-		     &i2c1_gpio2
-		     &gpclk0_gpio4
-		     &gpclk1_gpio5
-		     &spi0_gpio7
-		     &pcm_gpio28
-		     &pwm0_gpio40
-		     &pwm1_gpio45
-		     &emmc_gpio48
-		     &gpioout>;
+&i2s {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcm_gpio28>;
 };
 
 &hdmi {
arch/arm/boot/dts/bcm2835-rpi-b.dts +0 -12
index bc59f7e..0f96582 100644
@@ -14,18 +14,6 @@
 	};
 };
 
-&gpio {
-	pinctrl-0 = <&i2c0_gpio0
-		     &i2c1_gpio2
-		     &gpclk0_gpio4
-		     &gpclk1_gpio5
-		     &spi0_gpio7
-		     &pwm0_gpio40
-		     &pwm1_gpio45
-		     &emmc_gpio48
-		     &gpioout>;
-};
-
 &hdmi {
 	hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>;
 };
arch/arm/boot/dts/bcm2835-rpi.dtsi +20 -0
index 7e65d16..a207693 100644
@@ -31,6 +31,9 @@
 
 &gpio {
 	pinctrl-names = "default";
+	pinctrl-0 = <&gpclk0_gpio4
+		     &gpclk1_gpio5
+		     &gpioout>;
 
 	gpioout: gpioout {
 		brcm,pins = <6>;
@@ -39,11 +42,17 @@
 };
 
 &i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c0_gpio0>;
+
 	status = "okay";
 	clock-frequency = <100000>;
 };
 
 &i2c1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c1_gpio2>;
+
 	status = "okay";
 	clock-frequency = <100000>;
 };
@@ -53,11 +62,17 @@
 };
 
 &sdhci {
+	pinctrl-names = "default";
+	pinctrl-0 = <&emmc_gpio48>;
+
 	status = "okay";
 	bus-width = <4>;
 };
 
 &pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
+
 	status = "okay";
 };
 
@@ -73,3 +88,8 @@
 	power-domains = <&power RPI_POWER_DOMAIN_HDMI>;
 	status = "okay";
 };
+
+&spi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi0_gpio7>;
+};
arch/arm/boot/dts/bcm2836-rpi-2-b.dts +3 -11
index b4cbffe..e6e1791 100644
@@ -25,17 +25,9 @@
 	};
 };
 
-&gpio {
-	pinctrl-0 = <&i2c0_gpio0
-		     &i2c1_gpio2
-		     &gpclk0_gpio4
-		     &gpclk1_gpio5
-		     &spi0_gpio7
-		     &pcm_gpio18
-		     &pwm0_gpio40
-		     &pwm1_gpio45
-		     &emmc_gpio48
-		     &gpioout>;
+&i2s {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcm_gpio18>;
 };
 
 &hdmi {
Signature · 1 line
1.8.3.1
#41 lore raw

PATCH 19/32 bcm2837-rpi-3-b.dts: move most RPi default pin groups to their devices

In reply to a message not in the archive
---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +3 -11
index 8579df3..4636c16 100644
@@ -25,17 +25,9 @@
 	};
 };
 
-&gpio {
-	pinctrl-0 = <&i2c0_gpio0
-		     &i2c1_gpio2
-		     &gpclk0_gpio4
-		     &gpclk1_gpio5
-		     &spi0_gpio7
-		     &pcm_gpio18
-		     &pwm0_gpio40
-		     &pwm1_gpio45
-		     &emmc_gpio48
-		     &gpioout>;
+&i2s {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcm_gpio18>;
 };
 
 &uart1 {
Signature · 1 line
1.8.3.1
#42 lore raw

PATCH 20/32 dt-bindings: Add binding for brcm,bcm2835-sdhost.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

This is the other SD controller on the platform, which can be swapped to the role of SD card host using pin muxing.

---
 .../devicetree/bindings/mmc/brcm,bcm2835-sdhci.txt |  3 +++
 .../bindings/mmc/brcm,bcm2835-sdhost.txt           | 24 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhci.txt +3 -0
index 59476fb..3cc74e2 100644
@@ -15,4 +15,7 @@ sdhci: sdhci {
 	interrupts = <2 30>;
 	clocks = <&clk_mmc>;
 	bus-width = <4>;
+	dmas = <&dma 13>,
+	       <&dma 13>;
+	dma-names = "tx", "rx";
 };
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt new file +24 -0
new file mode 100644
index 0000000..074992c
@@ -0,0 +1,24 @@
+Broadcom BCM2835 SDHOST controller
+
+This file documents differences between the core properties described
+by mmc.txt and the properties that represent the BCM2835 controller.
+
+Required properties:
+- compatible: Should be "brcm,bcm2835-sdhci".
+- clocks: The clock feeding the SDHOST controller.
+
+Optional properties:
+- dmas: DMA channels for read and write.
+          See Documentation/devicetree/bindings/dma/dma.txt for details
+
+Example:
+
+sdhost: sdhost at 7e202000 {
+	compatible = "brcm,bcm2835-sdhost";
+	reg = <0x7e202000 0x100>;
+	interrupts = <2 24>;
+	clocks = <&clocks BCM2835_CLOCK_VPU>;
+	dmas = <&dma 13>,
+	       <&dma 13>;
+	dma-names = "tx", "rx";
+};
Signature · 1 line
1.8.3.1
maintainer
#43 lore raw

Re: [PATCH 20/32] dt-bindings: Add binding for brcm,bcm2835-sdhost.

Quoted 17 lines · Gerd Hoffmann

From: Eric Anholt <[email protected]>

This is the other SD controller on the platform, which can be swapped to the role of SD card host using pin muxing.

---
 .../devicetree/bindings/mmc/brcm,bcm2835-sdhci.txt |  3 +++
 .../bindings/mmc/brcm,bcm2835-sdhost.txt           | 24 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhci.txt +0 -0
index 59476fb..3cc74e2 100644

Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhci.txt sdhci: sdhci { · line 20

Quoted 6 lines
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhci.txt +3 -0
@@ -15,4 +15,7 @@ sdhci: sdhci {
 	interrupts = <2 30>;
 	clocks = <&clk_mmc>;
 	bus-width = <4>;
+	dmas = <&dma 13>,
+	       <&dma 13>;
+	dma-names = "tx", "rx";

This looks unrelated. Plus SDHCI implies internal DMA master generally, so is external DMA really supported?

Quoted 7 lines
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhci.txt +0 -0
 };
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt new file +0 -0
new file mode 100644
index 0000000..074992c

Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt new file +7 -0
@@ -0,0 +1,24 @@
+Broadcom BCM2835 SDHOST controller
+
+This file documents differences between the core properties described
+by mmc.txt and the properties that represent the BCM2835 controller.
+
+Required properties:
+- compatible: Should be "brcm,bcm2835-sdhci".

sdhost?

Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt new file +1 -0
+- clocks: The clock feeding the SDHOST controller.

reg, interrupts missing.

Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt line 12

Quoted 4 lines
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt new file +4 -0
+
+Optional properties:
+- dmas: DMA channels for read and write.
+          See Documentation/devicetree/bindings/dma/dma.txt for details

dma-names?

Quoted 15 lines
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt new file +12 -0
+
+Example:
+
+sdhost: sdhost at 7e202000 {
+	compatible = "brcm,bcm2835-sdhost";
+	reg = <0x7e202000 0x100>;
+	interrupts = <2 24>;
+	clocks = <&clocks BCM2835_CLOCK_VPU>;
+	dmas = <&dma 13>,
+	       <&dma 13>;
+	dma-names = "tx", "rx";
+};
Signature · 1 line
1.8.3.1
#44 lore raw

PATCH 21/32 mmc: bcm2835-sdhost: Add new driver for the internal SD controller.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

The 2835 has two SD controllers: The Arasan SDHCI controller that we currently use, and a custom SD controller. The custom one runs faster

The code was originally written by Phil Elwell in the downstream Rasbperry Pi tree, and I did a major cleanup on it (+319, -707 lines out of the original 2055) for inclusion.

---
 drivers/mmc/host/Kconfig          |    9 +
 drivers/mmc/host/Makefile         |    1 +
 drivers/mmc/host/bcm2835-sdhost.c | 1666 +++++++++++++++++++++++++++++++++++++
 3 files changed, 1676 insertions(+)
 create mode 100644 drivers/mmc/host/bcm2835-sdhost.c
drivers/mmc/host/Kconfig +9 -0
index 0aa484c..67efe28 100644
@@ -779,6 +779,15 @@ config MMC_TOSHIBA_PCI
 	depends on PCI
 	help
 
+config MMC_BCM2835_SDHOST
+	tristate "platform support for the BCM2835 SDHOST MMC Controller"
+	depends on ARCH_BCM2835 || COMPILE_TEST
+	help
+	  This selects the BCM2835 SDHOST MMC controller. If you have a BCM2835
+	  platform with SD or MMC devices, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_MTK
 	tristate "MediaTek SD/MMC Card Interface support"
 	depends on HAS_DMA
drivers/mmc/host/Makefile +1 -0
index af918d2..1e1b42b 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_MMC_MOXART)	+= moxart-mmc.o
 obj-$(CONFIG_MMC_SUNXI)		+= sunxi-mmc.o
 obj-$(CONFIG_MMC_USDHI6ROL0)	+= usdhi6rol0.o
 obj-$(CONFIG_MMC_TOSHIBA_PCI)	+= toshsd.o
+obj-$(CONFIG_MMC_BCM2835_SDHOST)	+= bcm2835-sdhost.o
 
 obj-$(CONFIG_MMC_REALTEK_PCI)	+= rtsx_pci_sdmmc.o
 obj-$(CONFIG_MMC_REALTEK_USB)	+= rtsx_usb_sdmmc.o
drivers/mmc/host/bcm2835-sdhost.c new file +1666 -0

1,666 lines not on this page · raw message

Signature · 1 line
1.8.3.1
maintainer
#45 lore raw

Re: [PATCH 21/32] mmc: bcm2835-sdhost: Add new driver for the internal SD controller.

Quoted 15 lines · CEST Gerd Hoffmann
drivers/mmc/host/bcm2835-sdhost.c new file +15 -0
+static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host)
+{
+	u32 temp;
+
+	bcm2835_sdhost_set_power(host, false);
+
+	bcm2835_sdhost_write(host, 0, SDCMD);
+	bcm2835_sdhost_write(host, 0, SDARG);
+	bcm2835_sdhost_write(host, 0xf00000, SDTOUT);
+	bcm2835_sdhost_write(host, 0, SDCDIV);
+	bcm2835_sdhost_write(host, 0x7f8, SDHSTS); /* Write 1s to clear */
+	bcm2835_sdhost_write(host, 0, SDHCFG);
+	bcm2835_sdhost_write(host, 0, SDHBCT);
+	bcm2835_sdhost_write(host, 0, SDHBLC);
+

drivers/mmc/host/bcm2835-sdhost.c line 326

Quoted 10 lines
drivers/mmc/host/bcm2835-sdhost.c new file +10 -0
+	/* Limit fifo usage due to silicon bug */
+	temp = bcm2835_sdhost_read(host, SDEDM);
+	temp &= ~((SDEDM_THRESHOLD_MASK << SDEDM_READ_THRESHOLD_SHIFT) |
+		  (SDEDM_THRESHOLD_MASK << SDEDM_WRITE_THRESHOLD_SHIFT));
+	temp |= (FIFO_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) |
+		(FIFO_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT);
+	bcm2835_sdhost_write(host, temp, SDEDM);
+	mdelay(10);
+	bcm2835_sdhost_set_power(host, true);
+	mdelay(10);

Are you sure you cannot use msleep() here?

drivers/mmc/host/bcm2835-sdhost.c line 331

Quoted 5 lines
drivers/mmc/host/bcm2835-sdhost.c new file +5 -0
+	host->clock = 0;
+	bcm2835_sdhost_write(host, host->hcfg, SDHCFG);
+	bcm2835_sdhost_write(host, host->cdiv, SDCDIV);
+	mmiowb();
+}

What is the barrier for? Same question for all the other instances

drivers/mmc/host/bcm2835-sdhost.c line 341

Quoted 10 lines
drivers/mmc/host/bcm2835-sdhost.c new file +10 -0
+
+static void bcm2835_sdhost_reset(struct mmc_host *mmc)
+{
+	struct bcm2835_host *host = mmc_priv(mmc);
+	unsigned long flags;
+
+	spin_lock_irqsave(&host->lock, flags);
+	bcm2835_sdhost_reset_internal(host);
+	spin_unlock_irqrestore(&host->lock, flags);
+}

The spinlock seems to only protect the reset from happening concurrently with bcm2835_sdhost_dma_complete() here. So if you ensure that this function is no longer pending, you can probably use msleep() above.

Quoted 1 line

+static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);

Maybe rearrange the order of the functions to avoid forward declarations?

drivers/mmc/host/bcm2835-sdhost.c line 1467

Quoted 6 lines
drivers/mmc/host/bcm2835-sdhost.c new file +6 -0
+	spin_lock_init(&host->lock);
+
+	if (IS_ERR_OR_NULL(host->dma_chan_tx) ||
+	    IS_ERR_OR_NULL(host->dma_chan_rx)) {
+		pr_err("%s: unable to initialise DMA channels. Falling back to PIO\n",
+		       mmc_hostname(mmc));

When are these ever NULL?

drivers/mmc/host/bcm2835-sdhost.c line 1571

Quoted 5 lines
drivers/mmc/host/bcm2835-sdhost.c new file +5 -0
+	/* Parse OF address directly to get the physical address for
+	 * DMA to our registers.
+	 */
+	host->phys_addr = be32_to_cpup(of_get_address(pdev->dev.of_node, 0,
+						      NULL, NULL));

This looks broken on 64-bit systems when #address-cells=<2>, or if there is an intermediate bus with a non-empty ranges property.

What's wrong with platform_get_resource(pdev, IORESOURCE_MEM, 0)?

Arnd

#46 lore raw

Re: [PATCH 21/32] mmc: bcm2835-sdhost: Add new driver for the internal SD controller.

Quoted 11 lines · Arnd Bergmann

drivers/mmc/host/bcm2835-sdhost.c line 1571

Quoted 5 lines · CEST Gerd Hoffmann
drivers/mmc/host/bcm2835-sdhost.c new file +5 -0
+	/* Parse OF address directly to get the physical address for
+	 * DMA to our registers.
+	 */
+	host->phys_addr = be32_to_cpup(of_get_address(pdev->dev.of_node, 0,
+						      NULL, NULL));

This looks broken on 64-bit systems when #address-cells=<2>, or if there is an intermediate bus with a non-empty ranges property.

What's wrong with platform_get_resource(pdev, IORESOURCE_MEM, 0)?

I'll get to the rest of the review later, but this is a weird pattern that we have in several bcm2835-related drivers.

We need the address as seen by the DMA controller, not the address from
the ARM's perspective (which is offset by the dma-ranges DT property).
This is the way that people have figured out to get that address.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160602/a60abe4d/attachment.sig>

maintainer
#47 lore raw

Re: [PATCH 21/32] mmc: bcm2835-sdhost: Add new driver for the internal SD controller.

Quoted 12 lines · CEST Eric Anholt
Quoted 10 lines · Arnd Bergmann

drivers/mmc/host/bcm2835-sdhost.c line 1571

Quoted 5 lines · CEST Gerd Hoffmann
drivers/mmc/host/bcm2835-sdhost.c new file +5 -0
+    /* Parse OF address directly to get the physical address for
+     * DMA to our registers.
+     */
+    host->phys_addr = be32_to_cpup(of_get_address(pdev->dev.of_node, 0,
+                                                  NULL, NULL));

This looks broken on 64-bit systems when #address-cells=<2>, or if there is an intermediate bus with a non-empty ranges property.

Quoted 8 lines
Quoted 1 line

What's wrong with platform_get_resource(pdev, IORESOURCE_MEM, 0)?

I'll get to the rest of the review later, but this is a weird pattern that we have in several bcm2835-related drivers.

We need the address as seen by the DMA controller, not the address from the ARM's perspective (which is offset by the dma-ranges DT property). This is the way that people have figured out to get that address.

I see. This is indeed a bit tricky, as there is no easy way to know how the dmaengine is wired up to the slave. A correct solution is probably to follow the 'dma-ranges' up from the master to the common parent and then follow the 'ranges' back to the slave, but that requires coming up with a new exported function.

It's perhaps good enough in the meantime to read out the address from the slave directly, but you should not assume that the first cell has the complete information and instead should at least evaluate #address-cells.

Arnd

#48 lore raw

Re: [PATCH 21/32] mmc: bcm2835-sdhost: Add new driver for the internal SD controller.

In reply to Arnd Bergmann

Hi,

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	mmiowb();
+}

What is the barrier for? Same question for all the other instances

No idea. Removed them all, seems to work fine still. Guess writel() & friends have the needed barriers on arm?

Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/bcm2835-sdhost.c new file +6 -0
+
+static void bcm2835_sdhost_reset(struct mmc_host *mmc)
+{
+	struct bcm2835_host *host = mmc_priv(mmc);
+	unsigned long flags;
+
Quoted 8 lines

drivers/mmc/host/bcm2835-sdhost.c line 341

Quoted 4 lines
drivers/mmc/host/bcm2835-sdhost.c new file +4 -0
+	spin_lock_irqsave(&host->lock, flags);
+	bcm2835_sdhost_reset_internal(host);
+	spin_unlock_irqrestore(&host->lock, flags);
+}

The spinlock seems to only protect the reset from happening concurrently with bcm2835_sdhost_dma_complete() here. So if you ensure that this function is no longer pending, you can probably use msleep() above.

There is also a tasklet. And IRQs. But bcm2835_sdhost_reset_internal clears hcfg (temporately), so IRQs shouldn't be a problem I think. So how about this?

@@ -334,9 +334,10 @@ static void bcm2835_sdhost_reset(struct mmc_host *mmc)

        struct bcm2835_host *host = mmc_priv(mmc);
        unsigned long flags;

- spin_lock_irqsave(&host->lock, flags);
+ if (host->dma_chan)
+ dmaengine_terminate_sync(host->dma_chan);

+       tasklet_kill(&host->finish_tasklet);
        bcm2835_sdhost_reset_internal(host);

- spin_unlock_irqrestore(&host->lock, flags);
}

Quoted 6 lines

drivers/mmc/host/bcm2835-sdhost.c line 1467

Quoted 4 lines
drivers/mmc/host/bcm2835-sdhost.c new file +4 -0
+	if (IS_ERR_OR_NULL(host->dma_chan_tx) ||
+	    IS_ERR_OR_NULL(host->dma_chan_rx)) {
+		pr_err("%s: unable to initialise DMA channels. Falling back to PIO\n",
+		       mmc_hostname(mmc));

When are these ever NULL?

When there are no dma channels configured in the device tree.

cheers,
Gerd

#49 lore raw

PATCH 22/32 ARM: bcm2835: Include SDHOST in the device tree.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

It's disabled by default, and will be enabled by a particular board's DT. The DMA channels are also currently left out, because our DMA engine support doesn't yet include slave SG, and there doesn't appear to be a clean way to include "does slave SG" in the channel request/config process.

---
 arch/arm/boot/dts/bcm283x.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +8 -0
index 3866fc7a..170d620 100644
@@ -399,6 +399,14 @@
 			status = "disabled";
 		};
 
+		sdhost: sdhost at 7e202000 {
+			compatible = "brcm,bcm2835-sdhost";
+			reg = <0x7e202000 0x100>;
+			interrupts = <2 24>;
+			clocks = <&clocks BCM2835_CLOCK_VPU>;
+			status = "disabled";
+		};
+
 		pwm: pwm at 7e20c000 {
 			compatible = "brcm,bcm2835-pwm";
 			reg = <0x7e20c000 0x28>;
Signature · 1 line
1.8.3.1
#50 lore raw

PATCH 23/32 ARM: bcm2835: Enable SDHOST by default.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

This improves read speed on my SD card (as reported by hdparm -t) from 10.15MB/sec to 16.70MB/sec. Once we add slave DMA, we can get to 18.45MB/sec.

---
 arch/arm/boot/dts/bcm2835-rpi.dtsi | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi.dtsi +9 -1
index a207693..97496cd 100644
@@ -65,8 +65,16 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&emmc_gpio48>;
 
+	bus-width = <4>;
+};
+
+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+
+	bus-width = <4>;
+
 	status = "okay";
-	bus-width = <4>;
 };
 
 &pwm {
Signature · 1 line
1.8.3.1
#51 lore raw

PATCH 24/32 i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clock

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

Fixes dmesg spam when we just need to wait a moment for the clock driver to probe.

---
 drivers/i2c/busses/i2c-bcm2835.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-bcm2835.c +2 -1
index 818b051..d4f3239 100644
@@ -253,7 +253,8 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
 
 	i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(i2c_dev->clk)) {
-		dev_err(&pdev->dev, "Could not get clock\n");
+		if (PTR_ERR(i2c_dev->clk) != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Could not get clock\n");
 		return PTR_ERR(i2c_dev->clk);
 	}
 
Signature · 1 line
1.8.3.1
#52 lore raw

Re: [PATCH 24/32] i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clock

Quoted 6 lines · Gerd Hoffmann

From: Eric Anholt <[email protected]>

Fixes dmesg spam when we just need to wait a moment for the clock driver to probe.

I applied Eric's original patch now.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160722/805c5c05/attachment-0001.sig>

#53 lore raw

PATCH 25/32 dt-gpio-fix

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

---
 arch/arm/boot/dts/bcm283x.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/bcm283x.dtsi +4 -4
index 170d620..30e6f46 100644
@@ -293,12 +293,12 @@
 				brcm,pins = <19>;
 				brcm,function = <BCM2835_FSEL_ALT5>;
 			};
-			uart1_gpio30: uart1_gpio30 {
-				brcm,pins = <30 31>;
+			uart1_gpio32: uart1_gpio32 {
+				brcm,pins = <32 33>;
 				brcm,function = <BCM2835_FSEL_ALT5>;
 			};
-			uart1_ctsrts_gpio32: uart1_ctsrts_gpio32 {
-				brcm,pins = <32 33>;
+			uart1_ctsrts_gpio30: uart1_ctsrts_gpio30 {
+				brcm,pins = <30 31>;
 				brcm,function = <BCM2835_FSEL_ALT5>;
 			};
 			uart1_gpio40: uart1_gpio40 {
Signature · 1 line
1.8.3.1
#54 lore raw

PATCH 26/32 enable uart1 on the BT pins

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +2 -0
index 4636c16..099dd48d 100644
@@ -31,6 +31,8 @@
 };
 
 &uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_gpio32>;
 	status = "okay";
 };
 
Signature · 1 line
1.8.3.1
#55 lore raw

PATCH 27/32 gpio: Add support for the FXL6408 GPIO expander.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

This commit needs to be split up and cleaned up. Also we should add interrupt support before pushing upstream.

Conflicts:

	arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts |  16 ++
 drivers/gpio/Kconfig                             |   6 +
 drivers/gpio/Makefile                            |   1 +
 drivers/gpio/gpio-fxl6408.c                      | 244 +++++++++++++++++++++++
 4 files changed, 267 insertions(+)
 create mode 100644 drivers/gpio/gpio-fxl6408.c
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +16 -0
index 099dd48d..4bc191e 100644
@@ -39,3 +39,19 @@
 &hdmi {
 	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
 };
+
+/* Connect the GPIO expander to I2C1 */
+&i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c0_gpio44>;
+
+	gpio_expander: gpio at 43 {
+		gpio-controller;
+		#gpio-cells = <2>;
+		reg = <0x43>;
+		compatible = "fcs,fxl6408";
+	};
+};
+
+bt {
+};
drivers/gpio/Kconfig +6 -0
index 48da857..34056cd 100644
@@ -665,6 +665,12 @@ config GPIO_ADNP
 	  enough to represent all pins, but the driver will assume a
 	  register layout for 64 pins (8 registers).
 
+config GPIO_FXL6408
+	tristate "FXL6408 I2C GPIO expander"
+	help
+	  This option enables support for 8 GPIOs found
+	  on the Fairchild Semiconductor FXL6408.
+
 config GPIO_MAX7300
 	tristate "Maxim MAX7300 GPIO expander"
 	select GPIO_MAX730X
drivers/gpio/Makefile +1 -0
index 991598e..59a25ef 100644
@@ -43,6 +43,7 @@ obj-$(CONFIG_GPIO_EM)		+= gpio-em.o
 obj-$(CONFIG_GPIO_EP93XX)	+= gpio-ep93xx.o
 obj-$(CONFIG_GPIO_ETRAXFS)	+= gpio-etraxfs.o
 obj-$(CONFIG_GPIO_F7188X)	+= gpio-f7188x.o
+obj-$(CONFIG_GPIO_FXL6408)	+= gpio-fxl6408.o
 obj-$(CONFIG_GPIO_GE_FPGA)	+= gpio-ge.o
 obj-$(CONFIG_GPIO_GRGPIO)	+= gpio-grgpio.o
 obj-$(CONFIG_GPIO_ICH)		+= gpio-ich.o
drivers/gpio/gpio-fxl6408.c new file +244 -0

244 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#56 lore raw

Re: [PATCH 27/32] gpio: Add support for the FXL6408 GPIO expander.

Quoted 6 lines · Gerd Hoffmann

From: Eric Anholt <[email protected]>

This commit needs to be split up and cleaned up. Also we should add interrupt support before pushing upstream.

OK, I've confirmed with the firmware maintainers: We really can't drive
this natively from Linux. The firmware is polling one of the fxl6408's
pins 10 times a second for detecting under-voltage, so if we also try to
drive it we'll end up smashing each others' I2C transactions. We'll
need to do a GPIO driver using the GET/SET_GPIO_STATE firmware calls,
instead. Unfortunately, we don't have a direction-setting API for that
at the moment, but it'll at least let us read the HDMI HPD signal.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160606/2ef19dc7/attachment.sig>

#57 lore raw

Re: [PATCH 27/32] gpio: Add support for the FXL6408 GPIO expander.

In reply to Gerd Hoffmann
Quoted 76 lines · Gerd Hoffmann

From: Eric Anholt <[email protected]>

This commit needs to be split up and cleaned up. Also we should add interrupt support before pushing upstream.

Conflicts:

	arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts |  16 ++
 drivers/gpio/Kconfig                             |   6 +
 drivers/gpio/Makefile                            |   1 +
 drivers/gpio/gpio-fxl6408.c                      | 244 +++++++++++++++++++++++
 4 files changed, 267 insertions(+)
 create mode 100644 drivers/gpio/gpio-fxl6408.c
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +16 -0
index 099dd48d..4bc191e 100644
@@ -39,3 +39,19 @@
 &hdmi {
 	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
 };
+
+/* Connect the GPIO expander to I2C1 */
+&i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c0_gpio44>;
+
+	gpio_expander: gpio at 43 {
+		gpio-controller;
+		#gpio-cells = <2>;
+		reg = <0x43>;
+		compatible = "fcs,fxl6408";
+	};
+};
+
+bt {
+};
drivers/gpio/Kconfig +6 -0
index 48da857..34056cd 100644
@@ -665,6 +665,12 @@ config GPIO_ADNP
 	  enough to represent all pins, but the driver will assume a
 	  register layout for 64 pins (8 registers).
 
+config GPIO_FXL6408
+	tristate "FXL6408 I2C GPIO expander"
+	help
+	  This option enables support for 8 GPIOs found
+	  on the Fairchild Semiconductor FXL6408.
+
 config GPIO_MAX7300
 	tristate "Maxim MAX7300 GPIO expander"
 	select GPIO_MAX730X
drivers/gpio/Makefile +1 -0
index 991598e..59a25ef 100644
@@ -43,6 +43,7 @@ obj-$(CONFIG_GPIO_EM)		+= gpio-em.o
 obj-$(CONFIG_GPIO_EP93XX)	+= gpio-ep93xx.o
 obj-$(CONFIG_GPIO_ETRAXFS)	+= gpio-etraxfs.o
 obj-$(CONFIG_GPIO_F7188X)	+= gpio-f7188x.o
+obj-$(CONFIG_GPIO_FXL6408)	+= gpio-fxl6408.o
 obj-$(CONFIG_GPIO_GE_FPGA)	+= gpio-ge.o
 obj-$(CONFIG_GPIO_GRGPIO)	+= gpio-grgpio.o
 obj-$(CONFIG_GPIO_ICH)		+= gpio-ich.o
drivers/gpio/gpio-fxl6408.c new file +0 -0
new file mode 100644
index 0000000..02b2816

drivers/gpio/gpio-fxl6408.c line 2

Quoted 2 lines
drivers/gpio/gpio-fxl6408.c new file +2 -0
@@ -0,0 +1,244 @@
+/*
+ *  Copyright (C) 2016 Broadcom Limited.

BTW, since you need to resubmit that, the new Copyright should be without the "Limited", just Broadcom, which covers all entities.

Signature · 1 line
Florian
#58 lore raw

Re: [PATCH 27/32] gpio: Add support for the FXL6408 GPIO expander.

In reply to Gerd Hoffmann
Quoted 3 lines · Gerd Hoffmann
drivers/gpio/gpio-fxl6408.c new file +3 -0
+#define FXL6408_OUTPUT                 0x05
+/* Bits here make the output High-Z, instead of the OUTPUT value. */
+#define FXL6408_OUTPUT_HIGH_Z          0x07

(...)

drivers/gpio/gpio-fxl6408.c line 174

Quoted 4 lines
drivers/gpio/gpio-fxl6408.c new file +4 -0
+       /* Disable High-Z of outputs, so that our OUTPUT updates
+        * actually take effect.
+        */
+       i2c_smbus_write_byte_data(client, FXL6408_OUTPUT_HIGH_Z, 0);

High-Z is probably the same as open drain right? And if not open drain, it is push-pull.

So you want to implement .set_single_ended() for configuring the lines in "high-z", i.e. open drain output mode.

Yours,
Linus Walleij

#59 lore raw

Re: [PATCH 27/32] gpio: Add support for the FXL6408 GPIO expander.

Quoted 11 lines · Linus Walleij
Quoted 3 lines · Gerd Hoffmann
drivers/gpio/gpio-fxl6408.c new file +3 -0
+#define FXL6408_OUTPUT                 0x05
+/* Bits here make the output High-Z, instead of the OUTPUT value. */
+#define FXL6408_OUTPUT_HIGH_Z          0x07

(...)

drivers/gpio/gpio-fxl6408.c line 174

Quoted 4 lines
drivers/gpio/gpio-fxl6408.c new file +4 -0
+       /* Disable High-Z of outputs, so that our OUTPUT updates
+        * actually take effect.
+        */
+       i2c_smbus_write_byte_data(client, FXL6408_OUTPUT_HIGH_Z, 0);
Quoted 5 lines

High-Z is probably the same as open drain right? And if not open drain, it is push-pull.

So you want to implement .set_single_ended() for configuring the lines in "high-z", i.e. open drain output mode.

I'll keep this in mind for whenever I end up writing my next GPIO
driver, but this one is dead for now (not actually usable because of the
closed firmware).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160609/e492d675/attachment-0001.sig>

#60 lore raw

PATCH 28/32 i2c: bcm2835: Set up the rising/falling edge delays.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

We were leaving them in the power on state (or the state the firmware had set up for some client, if we were taking over from them). The boot state was 30 core clocks, when we actually want to sample some time after (to make sure that the new input bit has actually arrived).

---
 drivers/i2c/busses/i2c-bcm2835.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-bcm2835.c +18 -1
index d4f3239..d1d17e4 100644
@@ -50,6 +50,9 @@
 #define BCM2835_I2C_S_CLKT	BIT(9)
 #define BCM2835_I2C_S_LEN	BIT(10) /* Fake bit for SW error reporting */
 
+#define BCM2835_I2C_FEDL_SHIFT	16
+#define BCM2835_I2C_REDL_SHIFT	0
+
 #define BCM2835_I2C_BITMSK_S	0x03FF
 
 #define BCM2835_I2C_CDIV_MIN	0x0002
@@ -235,7 +238,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
 {
 	struct bcm2835_i2c_dev *i2c_dev;
 	struct resource *mem, *irq;
-	u32 bus_clk_rate, divider;
+	u32 bus_clk_rate, divider, redl, fedl;
 	int ret;
 	struct i2c_adapter *adap;
 
@@ -281,6 +284,20 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
 	}
 	bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider);
 
+	/* Number of core clocks to wait after falling edge before
+	 * outputting the next data bit.  Note that both FEDL and REDL
+	 * can't be greater than CDIV/2.
+	 */
+	fedl = max(divider / 16, 1u);
+	/* Number of core clocks to wait after rising edge before
+	 * sampling the next incoming data bit.
+	 */
+	redl = max(divider / 4, 1u);
+
+	bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DEL,
+			   (fedl << BCM2835_I2C_FEDL_SHIFT) |
+			   (redl << BCM2835_I2C_REDL_SHIFT));
+
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!irq) {
 		dev_err(&pdev->dev, "No IRQ resource\n");
Signature · 1 line
1.8.3.1
#61 lore raw

Re: [PATCH 28/32] i2c: bcm2835: Set up the rising/falling edge delays.

Quoted 8 lines · Gerd Hoffmann

From: Eric Anholt <[email protected]>

We were leaving them in the power on state (or the state the firmware had set up for some client, if we were taking over from them). The boot state was 30 core clocks, when we actually want to sample some time after (to make sure that the new input bit has actually arrived).

Gerd, your Signed-off is missing here.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160722/13315344/attachment.sig>

#62 lore raw

PATCH 29/32 ARM: bcm2835: Use i2c-gpio for the expander, instead.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

I'm seeing a ton of CLKT errors from i2c-bcm2835.c, and haven't figured out a cause.

Conflicts:

	arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 32 ++++++++++++------------
 1 file changed, 16 insertions(+), 16 deletions(-)
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +16 -16
index 4bc191e..202e8c3 100644
@@ -23,6 +23,22 @@
 			linux,default-trigger = "default-on";
 		};
 	};
+
+	i2c_gpio {
+		compatible = "i2c-gpio";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		gpios = <&gpio 44 0
+			 &gpio 45 0>;
+
+		gpio_expander: gpio at 43 {
+			gpio-controller;
+			#gpio-cells = <2>;
+			reg = <0x43>;
+			compatible = "fcs,fxl6408";
+		};
+	};
 };
 
 &i2s {
@@ -39,19 +55,3 @@
 &hdmi {
 	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
 };
-
-/* Connect the GPIO expander to I2C1 */
-&i2c0 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&i2c0_gpio44>;
-
-	gpio_expander: gpio at 43 {
-		gpio-controller;
-		#gpio-cells = <2>;
-		reg = <0x43>;
-		compatible = "fcs,fxl6408";
-	};
-};
-
-bt {
-};
Signature · 1 line
1.8.3.1
#63 lore raw

PATCH 30/32 ARM: bcm2835: Add a new EMMC pin group from the downstream tree.

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

This will be used for having EMMC (sdhci-bcm2835.c) drive the wireless.

---
 arch/arm/boot/dts/bcm283x.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +5 -0
index 30e6f46..f186ef9 100644
@@ -257,6 +257,11 @@
 				brcm,pins = <32 33>;
 				brcm,function = <BCM2835_FSEL_ALT3>;
 			};
+			emmc_gpio34: emmc_gpio34 {
+				brcm,pins = <34 35 36 37 38 39>;
+				brcm,function = <BCM2835_FSEL_ALT3>;
+				brcm,pull = <0 2 2 2 2 2>;
+			};
 			emmc_gpio48: emmc_gpio48 {
 				brcm,pins = <48 49 50 51 52 53>;
 				brcm,function = <BCM2835_FSEL_ALT3>;
Signature · 1 line
1.8.3.1
#64 lore raw

PATCH 31/32 enable wireless

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

Conflicts:

	arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
---
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +15 -0
index 202e8c3..8d24a39 100644
@@ -55,3 +55,18 @@
 &hdmi {
 	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
 };
+
+/* SDHOST is used to drive the SD card */
+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	status = "okay";
+};
+
+/* SDHCI is used to control the SDIO for wireless */
+&sdhci {
+	pinctrl-names = "default";
+	pinctrl-0 = <&emmc_gpio34>;
+	status = "okay";
+	non-removable;
+};
Signature · 1 line
1.8.3.1
#65 lore raw

PATCH 32/32 mmc: bcm2835: Import bcm2835-mmc and switch to it

In reply to a message not in the archive

From: Eric Anholt <[email protected]>

With this we can get wifi (brcmfmac) to probe. Without it we're stuck with timeouts from sdio.c when it tries to set the bus width to 4.

---
 arch/arm/boot/dts/bcm283x.dtsi |    2 +-
 drivers/mmc/host/Makefile      |    1 +
 drivers/mmc/host/bcm2835-mmc.c | 1559 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1561 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mmc/host/bcm2835-mmc.c
arch/arm/boot/dts/bcm283x.dtsi +1 -1
index f186ef9..2d8ca87 100644
@@ -423,7 +423,7 @@
 		};
 
 		sdhci: sdhci at 7e300000 {
-			compatible = "brcm,bcm2835-sdhci";
+			compatible = "brcm,bcm2835-mmc";
 			reg = <0x7e300000 0x100>;
 			interrupts = <2 30>;
 			clocks = <&clocks BCM2835_CLOCK_EMMC>;
drivers/mmc/host/Makefile +1 -0
index 1e1b42b..3e666d0 100644
@@ -58,6 +58,7 @@ obj-$(CONFIG_MMC_SUNXI)		+= sunxi-mmc.o
 obj-$(CONFIG_MMC_USDHI6ROL0)	+= usdhi6rol0.o
 obj-$(CONFIG_MMC_TOSHIBA_PCI)	+= toshsd.o
 obj-$(CONFIG_MMC_BCM2835_SDHOST)	+= bcm2835-sdhost.o
+obj-$(CONFIG_MMC_BCM2835_SDHOST)	+= bcm2835-mmc.o
 
 obj-$(CONFIG_MMC_REALTEK_PCI)	+= rtsx_pci_sdmmc.o
 obj-$(CONFIG_MMC_REALTEK_USB)	+= rtsx_usb_sdmmc.o
drivers/mmc/host/bcm2835-mmc.c new file +1559 -0

1,559 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#66 lore raw

Re: [PATCH 32/32] mmc: bcm2835: Import bcm2835-mmc and switch to it

Hi Gerd,

Am 01.06.2016 um 23:43 schrieb Gerd Hoffmann:

Quoted 4 lines

From: Eric Anholt <[email protected]>

With this we can get wifi (brcmfmac) to probe. Without it we're stuck with timeouts from sdio.c when it tries to set the bus width to 4.

adding a new MMC driver to fix a wifi issue is really weird.

Beside that there are already two MMC drivers (sdhci-bcm2835.c and sdhci-iproc.c) in the Kernel which are compatible to BCM2835. Why should we add two new ones?

Stefan

#67 lore raw

Re: [PATCH 32/32] mmc: bcm2835: Import bcm2835-mmc and switch to it

Quoted 5 lines · Stefan Wahren

Hi Gerd,

Am 01.06.2016 um 23:43 schrieb Gerd Hoffmann:

Quoted 2 lines

From: Eric Anholt <[email protected]>

Quoted 8 lines
Quoted 2 lines

With this we can get wifi (brcmfmac) to probe. Without it we're stuck with timeouts from sdio.c when it tries to set the bus width to 4.

adding a new MMC driver to fix a wifi issue is really weird.

Beside that there are already two MMC drivers (sdhci-bcm2835.c and sdhci-iproc.c) in the Kernel which are compatible to BCM2835. Why should we add two new ones?

Despite the fact that this is my commit, I don't think it should be
merged. We should figure out why sdhci-iproc.c isn't working, instead.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160602/2d337722/attachment.sig>

#68 lore raw

Re: [PATCH 32/32] mmc: bcm2835: Import bcm2835-mmc and switch to it

Hi Eric,

Quoted 13 lines

Eric Anholt <[email protected]> hat am 2. Juni 2016 um 20:18 geschrieben:

Quoted 8 lines · Stefan Wahren

Hi Gerd,

Am 01.06.2016 um 23:43 schrieb Gerd Hoffmann:

Quoted 4 lines

From: Eric Anholt <[email protected]>

With this we can get wifi (brcmfmac) to probe. Without it we're stuck with timeouts from sdio.c when it tries to set the bus width to 4.

Quoted 8 lines
Quoted 5 lines

adding a new MMC driver to fix a wifi issue is really weird.

Beside that there are already two MMC drivers (sdhci-bcm2835.c and sdhci-iproc.c) in the Kernel which are compatible to BCM2835. Why should we add two new ones?

Despite the fact that this is my commit, I don't think it should be merged. We should figure out why sdhci-iproc.c isn't working, instead.

so it doesn't work with sdhci-bcm2835 on RPi 3, too?

I plan to send a patch series to remove sdhci-bcm2835.

Stefan

#69 lore raw

Re: [PATCH 32/32] mmc: bcm2835: Import bcm2835-mmc and switch to it

Hi,

Quoted 4 lines
Quoted 2 lines

Despite the fact that this is my commit, I don't think it should be merged. We should figure out why sdhci-iproc.c isn't working, instead.

so it doesn't work with sdhci-bcm2835 on RPi 3, too?

With sdhci-bcm2835 rpi3 wifi doesn't work for me.
I didn't try sdhci-iproc yet.

cheers,
Gerd

#70 lore raw

Re: [PATCH 32/32] mmc: bcm2835: Import bcm2835-mmc and switch to it

In reply to Stefan Wahren
Quoted 17 lines · Stefan Wahren

Hi Eric,

Quoted 15 lines

Eric Anholt <[email protected]> hat am 2. Juni 2016 um 20:18 geschrieben:

Quoted 10 lines · Stefan Wahren

Hi Gerd,

Am 01.06.2016 um 23:43 schrieb Gerd Hoffmann:

Quoted 4 lines

From: Eric Anholt <[email protected]>

With this we can get wifi (brcmfmac) to probe. Without it we're stuck with timeouts from sdio.c when it tries to set the bus width to 4.

adding a new MMC driver to fix a wifi issue is really weird.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Beside that there are already two MMC drivers (sdhci-bcm2835.c and sdhci-iproc.c) in the Kernel which are compatible to BCM2835. Why should we add two new ones?

Despite the fact that this is my commit, I don't think it should be merged. We should figure out why sdhci-iproc.c isn't working, instead.

so it doesn't work with sdhci-bcm2835 on RPi 3, too?

Correct.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160602/8c7a5e39/attachment.sig>