mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3
@ 2019-02-18 11:32 Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 1/8] ARM: rpi: switch emmc from sdhost to sdhci Tomaz Solc
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Tomaz Solc @ 2019-02-18 11:32 UTC (permalink / raw)
  To: barebox

Changes from the first patch series:

 - Base Compute Module 3 device tree off upstream device tree for CM3 + IO3
   dev board, instead of R. Pi 3B.
 - Keep Makefile.bcm283x without a newline at the end of file.
 - Make mci init before pinctrl by moving mci-bcm2835 to device_initcall()
   instead of changing link order.
 - Add CONFIG_PINCTRL to rpi_defconfig.

Best regards
Tomaz

Tomaz Solc (8):
  ARM: rpi: switch emmc from sdhost to sdhci
  Kconfig: add pin controllers submenu.
  pinctrl: bcm2835: move existing code from gpio.
  pinctrl: bcm2835: register the pin controller.
  mci: bcm2835: use device_initcall(), not coredev.
  mci: bcm2835: parse other device tree properties.
  ARM: rpi: Add device tree for Compute Module 3.
  ARM: rpi: add CONFIG_PINCTRL to rpi_defconfig.

 arch/arm/boards/raspberry-pi/lowlevel.c            | 10 +++++
 arch/arm/configs/rpi_defconfig                     |  4 +-
 arch/arm/dts/Makefile                              |  1 +
 arch/arm/dts/bcm2837-rpi-3.dts                     |  9 ++++
 arch/arm/dts/bcm2837-rpi-cm3.dts                   | 18 ++++++++
 arch/arm/mach-bcm283x/Kconfig                      |  6 +++
 drivers/gpio/Kconfig                               |  4 --
 drivers/gpio/Makefile                              |  1 -
 drivers/mci/mci-bcm2835.c                          |  5 ++-
 drivers/pinctrl/Kconfig                            | 10 +++++
 drivers/pinctrl/Makefile                           |  1 +
 .../gpio-bcm2835.c => pinctrl/pinctrl-bcm2835.c}   | 52 +++++++++++++++++++++-
 images/Makefile.bcm283x                            |  6 ++-
 13 files changed, 117 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/dts/bcm2837-rpi-cm3.dts
 rename drivers/{gpio/gpio-bcm2835.c => pinctrl/pinctrl-bcm2835.c} (77%)

-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH v2 1/8] ARM: rpi: switch emmc from sdhost to sdhci
  2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
@ 2019-02-18 11:32 ` Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 2/8] Kconfig: add pin controllers submenu Tomaz Solc
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tomaz Solc @ 2019-02-18 11:32 UTC (permalink / raw)
  To: barebox

BCM2837 has two mmc interfaces: sdhost and sdhci. On Raspberry Pi 3, sdhost is
normally used for SD card/MMC flash and sdhci for the wireless interface.
Barebox currently only has a driver for sdhci, so we disable the sdhost
interface and remap the pins so that the sdhci has access to the SD card/MMC
flash.
---
 arch/arm/dts/bcm2837-rpi-3.dts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/dts/bcm2837-rpi-3.dts b/arch/arm/dts/bcm2837-rpi-3.dts
index 194b41c23..51883613c 100644
--- a/arch/arm/dts/bcm2837-rpi-3.dts
+++ b/arch/arm/dts/bcm2837-rpi-3.dts
@@ -9,3 +9,12 @@
 		reg = <0x0 0x0>;
 	};
 };
+
+&sdhci {
+	pinctrl-0 = <&emmc_gpio48>;
+	/delete-node/ wifi@1;
+};
+
+&sdhost {
+	status = "disabled";
+};
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH v2 2/8] Kconfig: add pin controllers submenu.
  2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 1/8] ARM: rpi: switch emmc from sdhost to sdhci Tomaz Solc
@ 2019-02-18 11:32 ` Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 3/8] pinctrl: bcm2835: move existing code from gpio Tomaz Solc
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tomaz Solc @ 2019-02-18 11:32 UTC (permalink / raw)
  To: barebox

---
 drivers/pinctrl/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 12fff4f01..de83c124a 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -1,3 +1,5 @@
+menu "Pin controllers"
+
 config PINCTRL
 	bool "Pin controller core support"
 	default y if OFDEVICE
@@ -83,3 +85,5 @@ config PINCTRL_VF610
 	help
 	  Pinmux controller found on Vybrid VF610 family of SoCs
 endif
+
+endmenu
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH v2 3/8] pinctrl: bcm2835: move existing code from gpio.
  2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 1/8] ARM: rpi: switch emmc from sdhost to sdhci Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 2/8] Kconfig: add pin controllers submenu Tomaz Solc
@ 2019-02-18 11:32 ` Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 4/8] pinctrl: bcm2835: register the pin controller Tomaz Solc
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tomaz Solc @ 2019-02-18 11:32 UTC (permalink / raw)
  To: barebox

---
 arch/arm/configs/rpi_defconfig                             | 2 +-
 drivers/gpio/Kconfig                                       | 4 ----
 drivers/gpio/Makefile                                      | 1 -
 drivers/pinctrl/Kconfig                                    | 6 ++++++
 drivers/pinctrl/Makefile                                   | 1 +
 drivers/{gpio/gpio-bcm2835.c => pinctrl/pinctrl-bcm2835.c} | 0
 6 files changed, 8 insertions(+), 6 deletions(-)
 rename drivers/{gpio/gpio-bcm2835.c => pinctrl/pinctrl-bcm2835.c} (100%)

diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index dc5ab1fe1..35943e025 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -71,7 +71,7 @@ CONFIG_LED_GPIO=y
 CONFIG_LED_TRIGGERS=y
 CONFIG_WATCHDOG=y
 CONFIG_WATCHDOG_BCM2835=y
-CONFIG_GPIO_BCM283X=y
+CONFIG_PINCTRL_BCM283X=y
 # CONFIG_PINCTRL is not set
 CONFIG_REGULATOR=y
 CONFIG_FS_EXT4=y
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index ed93e868a..c535904ed 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -21,10 +21,6 @@ config GPIO_74164
 	  shift registers. This driver can be used to provide access
 	  to more gpio outputs.
 
-config GPIO_BCM283X
-	bool "GPIO support for BCM283X"
-	depends on ARCH_BCM283X
-
 config GPIO_CLPS711X
 	bool "GPIO support for CLPS711X"
 	depends on ARCH_CLPS711X
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index f5ed876d5..52280f0bb 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -2,7 +2,6 @@ obj-$(CONFIG_GPIOLIB)		+= gpiolib.o
 
 obj-$(CONFIG_GPIO_74164)	+= gpio-74164.o
 obj-$(CONFIG_MACH_MIPS_ATH79)	+= gpio-ath79.o
-obj-$(CONFIG_GPIO_BCM283X)	+= gpio-bcm2835.o
 obj-$(CONFIG_GPIO_DAVINCI)	+= gpio-davinci.o
 obj-$(CONFIG_GPIO_CLPS711X)	+= gpio-clps711x.o
 obj-$(CONFIG_GPIO_DIGIC)	+= gpio-digic.o
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index de83c124a..45c3b351d 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -17,6 +17,12 @@ config PINCTRL_AT91
 	help
 	    The pinmux controller found on AT91 SoCs.
 
+config PINCTRL_BCM283X
+	bool "GPIO and pinmux support for BCM283X"
+	depends on ARCH_BCM283X
+	help
+	    The pinmux controller on BCM2835
+
 config PINCTRL_IMX_IOMUX_V1
 	bool
 	help
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index 9450dbbdf..35b2d4707 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_PINCTRL)	+= pinctrl.o
 obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o
+obj-$(CONFIG_PINCTRL_BCM283X)	+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_IMX_IOMUX_V1) += imx-iomux-v1.o
 obj-$(CONFIG_PINCTRL_IMX_IOMUX_V2) += imx-iomux-v2.o
 obj-$(CONFIG_PINCTRL_IMX_IOMUX_V3) += imx-iomux-v3.o
diff --git a/drivers/gpio/gpio-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
similarity index 100%
rename from drivers/gpio/gpio-bcm2835.c
rename to drivers/pinctrl/pinctrl-bcm2835.c
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH v2 4/8] pinctrl: bcm2835: register the pin controller.
  2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
                   ` (2 preceding siblings ...)
  2019-02-18 11:32 ` [PATCH v2 3/8] pinctrl: bcm2835: move existing code from gpio Tomaz Solc
@ 2019-02-18 11:32 ` Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 5/8] mci: bcm2835: use device_initcall(), not coredev Tomaz Solc
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tomaz Solc @ 2019-02-18 11:32 UTC (permalink / raw)
  To: barebox

This adds hooks for the pin controller driver to the existing
bcm2835_set_function().
---
 drivers/pinctrl/pinctrl-bcm2835.c | 52 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
index 1802ab7cc..5fd5740e8 100644
--- a/drivers/pinctrl/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/pinctrl-bcm2835.c
@@ -1,7 +1,9 @@
 /*
  * Author: Carlo Caione <carlo@carlocaione.org>
  *
- * Based on linux/arch/arm/mach-bcm2708/bcm2708_gpio.c
+ * GPIO code based on linux/arch/arm/mach-bcm2708/bcm2708_gpio.c
+ *
+ * pinctrl part added by Tomaz Solc <tomaz.solc@tablix.org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -21,6 +23,7 @@
 #include <io.h>
 #include <gpio.h>
 #include <init.h>
+#include <pinctrl.h>
 
 #define GPIOFSEL(x)  (0x00+(x)*4)
 #define GPIOSET(x)   (0x1c+(x)*4)
@@ -46,6 +49,7 @@ enum {
 struct bcm2835_gpio_chip {
 	void __iomem *base;
 	struct gpio_chip chip;
+	struct pinctrl_device pctl;
 };
 
 static int bcm2835_set_function(struct gpio_chip *chip, unsigned gpio, int function)
@@ -110,6 +114,39 @@ static struct gpio_ops bcm2835_gpio_ops = {
 	.set = bcm2835_gpio_set_value,
 };
 
+static int bcm2835_pinctrl_set_state(struct pinctrl_device *pdev, struct device_node *np)
+{
+	const __be32 *list;
+	u32 function;
+	int i, size;
+
+	list = of_get_property(np, "brcm,pins", &size);
+	if (!list) {
+		return -EINVAL;
+	}
+
+	size /= sizeof(*list);
+
+	if (of_property_read_u32(np, "brcm,function", &function)) {
+		return -EINVAL;
+	}
+
+	for (i = 0; i < size; i++) {
+		int pin = be32_to_cpu(list[i]);
+		struct bcm2835_gpio_chip *bcmgpio = container_of(pdev, struct bcm2835_gpio_chip, pctl);
+
+		dev_dbg(pdev->dev, "set_state pin %d to function %d\n", pin, function);
+
+		bcm2835_set_function(&bcmgpio->chip, pin, function);
+	}
+
+	return 0;
+}
+
+static struct pinctrl_ops bcm2835_pinctrl_ops = {
+	.set_state = bcm2835_pinctrl_set_state,
+};
+
 static int bcm2835_gpio_probe(struct device_d *dev)
 {
 	struct resource *iores;
@@ -125,14 +162,27 @@ static int bcm2835_gpio_probe(struct device_d *dev)
 	bcmgpio->chip.base = 0;
 	bcmgpio->chip.ngpio = 54;
 	bcmgpio->chip.dev = dev;
+	bcmgpio->pctl.ops = &bcm2835_pinctrl_ops;
+	bcmgpio->pctl.dev = dev;
 
 	ret = gpiochip_add(&bcmgpio->chip);
 	if (ret) {
 		dev_err(dev, "couldn't add gpiochip, ret = %d\n", ret);
 		goto err;
 	}
+
 	dev_info(dev, "probed gpiochip%d with base %d\n", dev->id, bcmgpio->chip.base);
 
+	if (IS_ENABLED(CONFIG_PINCTRL)) {
+		ret = pinctrl_register(&bcmgpio->pctl);
+		if (ret) {
+			dev_err(dev, "couldn't add pinctrl, ret = %d\n", ret);
+			// don't free bcmgpio, since it's already used by gpiochip.
+		} else {
+			dev_dbg(dev, "bcm283x pinctrl registered\n");
+		}
+	}
+
 	return 0;
 
 err:
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH v2 5/8] mci: bcm2835: use device_initcall(), not coredev.
  2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
                   ` (3 preceding siblings ...)
  2019-02-18 11:32 ` [PATCH v2 4/8] pinctrl: bcm2835: register the pin controller Tomaz Solc
@ 2019-02-18 11:32 ` Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 6/8] mci: bcm2835: parse other device tree properties Tomaz Solc
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tomaz Solc @ 2019-02-18 11:32 UTC (permalink / raw)
  To: barebox

pinctrl driver needs to be initialized before mci driver on Raspberry Pi.
Otherwise the pinctrl device tree properties in the mci node are ignored.
pinctrl is initialized by coredevice_initcall(), so moving mci-bcm2835 to
device_initcall() ensures that it is initialized later.

There is no reason for mci-bcm2835 to use coredevice_initcall(). Other mci
drivers already use device_initcall().
---
 drivers/mci/mci-bcm2835.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mci/mci-bcm2835.c b/drivers/mci/mci-bcm2835.c
index 9438e66af..e7dbb4f1d 100644
--- a/drivers/mci/mci-bcm2835.c
+++ b/drivers/mci/mci-bcm2835.c
@@ -561,4 +561,4 @@ static int bcm2835_mci_add(void)
 {
 	return platform_driver_register(&bcm2835_mci_driver);
 }
-coredevice_initcall(bcm2835_mci_add);
+device_initcall(bcm2835_mci_add);
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH v2 6/8] mci: bcm2835: parse other device tree properties.
  2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
                   ` (4 preceding siblings ...)
  2019-02-18 11:32 ` [PATCH v2 5/8] mci: bcm2835: use device_initcall(), not coredev Tomaz Solc
@ 2019-02-18 11:32 ` Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 7/8] ARM: rpi: Add device tree for Compute Module 3 Tomaz Solc
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tomaz Solc @ 2019-02-18 11:32 UTC (permalink / raw)
  To: barebox

The driver was missing a call to mci_of_parse() which fills in properties such
as "bus-width", "no-sd" into the mci_host struct.
---
 drivers/mci/mci-bcm2835.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mci/mci-bcm2835.c b/drivers/mci/mci-bcm2835.c
index e7dbb4f1d..2ed125167 100644
--- a/drivers/mci/mci-bcm2835.c
+++ b/drivers/mci/mci-bcm2835.c
@@ -506,6 +506,9 @@ static int bcm2835_mci_probe(struct device_d *hw_dev)
 	host->mci.hw_dev = hw_dev;
 	host->hw_dev = hw_dev;
 	host->max_clock = clk_get_rate(clk);
+
+	mci_of_parse(&host->mci);
+
 	iores = dev_request_mem_resource(hw_dev, 0);
 	if (IS_ERR(iores)) {
 		dev_err(host->hw_dev, "Failed request mem region, aborting...\n");
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH v2 7/8] ARM: rpi: Add device tree for Compute Module 3.
  2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
                   ` (5 preceding siblings ...)
  2019-02-18 11:32 ` [PATCH v2 6/8] mci: bcm2835: parse other device tree properties Tomaz Solc
@ 2019-02-18 11:32 ` Tomaz Solc
  2019-02-18 11:32 ` [PATCH v2 8/8] ARM: rpi: add CONFIG_PINCTRL to rpi_defconfig Tomaz Solc
  2019-02-19  9:08 ` [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Tomaz Solc @ 2019-02-18 11:32 UTC (permalink / raw)
  To: barebox

Compute Module needs "no-sd" property on the MMC interface otherwise
mci-bcm2835 hangs on SD card probe.
---
 arch/arm/boards/raspberry-pi/lowlevel.c | 10 ++++++++++
 arch/arm/dts/Makefile                   |  1 +
 arch/arm/dts/bcm2837-rpi-cm3.dts        | 18 ++++++++++++++++++
 arch/arm/mach-bcm283x/Kconfig           |  6 ++++++
 images/Makefile.bcm283x                 |  6 +++++-
 5 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/bcm2837-rpi-cm3.dts

diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
index 34c935092..1a3d39421 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.c
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -33,3 +33,13 @@ ENTRY_FUNCTION(start_raspberry_pi3, r0, r1, r2)
 
 	barebox_arm_entry(BCM2835_SDRAM_BASE, SZ_512M, fdt);
 }
+
+extern char __dtb_bcm2837_rpi_cm3_start[];
+ENTRY_FUNCTION(start_raspberry_pi_cm3, r0, r1, r2)
+{
+	void *fdt = __dtb_bcm2837_rpi_cm3_start + get_runtime_offset();
+
+	arm_cpu_lowlevel_init();
+
+	barebox_arm_entry(BCM2835_SDRAM_BASE, SZ_512M, fdt);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3cdee1ffb..82595f9b7 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -75,6 +75,7 @@ pbl-dtb-$(CONFIG_MACH_REALQ7) += imx6q-dmo-edmqmx6.dtb.o
 pbl-dtb-$(CONFIG_MACH_RPI) += bcm2835-rpi.dtb.o
 pbl-dtb-$(CONFIG_MACH_RPI2) += bcm2836-rpi-2.dtb.o
 pbl-dtb-$(CONFIG_MACH_RPI3) += bcm2837-rpi-3.dtb.o
+pbl-dtb-$(CONFIG_MACH_RPI_CM3) += bcm2837-rpi-cm3.dtb.o
 pbl-dtb-$(CONFIG_MACH_SABRELITE) += imx6q-sabrelite.dtb.o imx6dl-sabrelite.dtb.o
 pbl-dtb-$(CONFIG_MACH_SABRESD) += imx6q-sabresd.dtb.o
 pbl-dtb-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB) += imx6sx-sdb.dtb.o
diff --git a/arch/arm/dts/bcm2837-rpi-cm3.dts b/arch/arm/dts/bcm2837-rpi-cm3.dts
new file mode 100644
index 000000000..cfbffe175
--- /dev/null
+++ b/arch/arm/dts/bcm2837-rpi-cm3.dts
@@ -0,0 +1,18 @@
+#include <arm/bcm2837-rpi-cm3-io3.dts>
+
+/ {
+	chosen {
+		stdout-path = &uart0;
+	};
+
+	memory {
+		reg = <0x0 0x0>;
+	};
+};
+
+&sdhci {
+	pinctrl-0 = <&emmc_gpio48>;
+	no-sd;
+	non-removable;
+	status = "okay";
+};
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index af2f88c47..bb5f75dc9 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -25,6 +25,12 @@ config MACH_RPI3
 	select MACH_RPI_COMMON
 	select ARM_SECURE_MONITOR
 
+config MACH_RPI_CM3
+	bool "RaspberryPi Compute Module 3 (BCM2837/CORTEX-A53)"
+	select CPU_V7
+	select MACH_RPI_COMMON
+	select ARM_SECURE_MONITOR
+
 endmenu
 
 config MACH_RPI_DEBUG_UART_BASE
diff --git a/images/Makefile.bcm283x b/images/Makefile.bcm283x
index 9199f153d..3fd2c3d06 100644
--- a/images/Makefile.bcm283x
+++ b/images/Makefile.bcm283x
@@ -12,4 +12,8 @@ image-$(CONFIG_MACH_RPI2) += barebox-raspberry-pi-2.img
 
 pblb-$(CONFIG_MACH_RPI3) += start_raspberry_pi3
 FILE_barebox-raspberry-pi-3.img = start_raspberry_pi3.pblb
-image-$(CONFIG_MACH_RPI3) += barebox-raspberry-pi-3.img
\ No newline at end of file
+image-$(CONFIG_MACH_RPI3) += barebox-raspberry-pi-3.img
+
+pblb-$(CONFIG_MACH_RPI_CM3) += start_raspberry_pi_cm3
+FILE_barebox-raspberry-pi-cm3.img = start_raspberry_pi_cm3.pblb
+image-$(CONFIG_MACH_RPI_CM3) += barebox-raspberry-pi-cm3.img
\ No newline at end of file
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH v2 8/8] ARM: rpi: add CONFIG_PINCTRL to rpi_defconfig.
  2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
                   ` (6 preceding siblings ...)
  2019-02-18 11:32 ` [PATCH v2 7/8] ARM: rpi: Add device tree for Compute Module 3 Tomaz Solc
@ 2019-02-18 11:32 ` Tomaz Solc
  2019-02-19  9:08 ` [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Tomaz Solc @ 2019-02-18 11:32 UTC (permalink / raw)
  To: barebox

Required for emmc pin function switching on Raspberry Pi 3.
---
 arch/arm/configs/rpi_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index 35943e025..f167625c9 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -71,8 +71,8 @@ CONFIG_LED_GPIO=y
 CONFIG_LED_TRIGGERS=y
 CONFIG_WATCHDOG=y
 CONFIG_WATCHDOG_BCM2835=y
+CONFIG_PINCTRL=y
 CONFIG_PINCTRL_BCM283X=y
-# CONFIG_PINCTRL is not set
 CONFIG_REGULATOR=y
 CONFIG_FS_EXT4=y
 CONFIG_FS_FAT=y
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3
  2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
                   ` (7 preceding siblings ...)
  2019-02-18 11:32 ` [PATCH v2 8/8] ARM: rpi: add CONFIG_PINCTRL to rpi_defconfig Tomaz Solc
@ 2019-02-19  9:08 ` Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2019-02-19  9:08 UTC (permalink / raw)
  To: Tomaz Solc; +Cc: barebox

On Mon, Feb 18, 2019 at 12:32:12PM +0100, Tomaz Solc wrote:
> Changes from the first patch series:
> 
>  - Base Compute Module 3 device tree off upstream device tree for CM3 + IO3
>    dev board, instead of R. Pi 3B.
>  - Keep Makefile.bcm283x without a newline at the end of file.
>  - Make mci init before pinctrl by moving mci-bcm2835 to device_initcall()
>    instead of changing link order.
>  - Add CONFIG_PINCTRL to rpi_defconfig.
> 
> Best regards
> Tomaz
> 
> Tomaz Solc (8):
>   ARM: rpi: switch emmc from sdhost to sdhci
>   Kconfig: add pin controllers submenu.
>   pinctrl: bcm2835: move existing code from gpio.
>   pinctrl: bcm2835: register the pin controller.
>   mci: bcm2835: use device_initcall(), not coredev.
>   mci: bcm2835: parse other device tree properties.
>   ARM: rpi: Add device tree for Compute Module 3.
>   ARM: rpi: add CONFIG_PINCTRL to rpi_defconfig.

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18 11:32 [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Tomaz Solc
2019-02-18 11:32 ` [PATCH v2 1/8] ARM: rpi: switch emmc from sdhost to sdhci Tomaz Solc
2019-02-18 11:32 ` [PATCH v2 2/8] Kconfig: add pin controllers submenu Tomaz Solc
2019-02-18 11:32 ` [PATCH v2 3/8] pinctrl: bcm2835: move existing code from gpio Tomaz Solc
2019-02-18 11:32 ` [PATCH v2 4/8] pinctrl: bcm2835: register the pin controller Tomaz Solc
2019-02-18 11:32 ` [PATCH v2 5/8] mci: bcm2835: use device_initcall(), not coredev Tomaz Solc
2019-02-18 11:32 ` [PATCH v2 6/8] mci: bcm2835: parse other device tree properties Tomaz Solc
2019-02-18 11:32 ` [PATCH v2 7/8] ARM: rpi: Add device tree for Compute Module 3 Tomaz Solc
2019-02-18 11:32 ` [PATCH v2 8/8] ARM: rpi: add CONFIG_PINCTRL to rpi_defconfig Tomaz Solc
2019-02-19  9:08 ` [PATCH v2 0/8] Fixing MMC access on Raspberry Pi CM3 Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox