* [PATCH v6 0/9] Raspberry Pi miniuart support
@ 2019-01-15 5:44 Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 1/9] ARM: rpi: fix typo in rpi-common.c Rouven Czerwinski
` (11 more replies)
0 siblings, 12 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
This patch series adds support for the raspberry pi miniuart (also called
aux-uart) to barebox.
With this series the miniuart overlay is no longer necessary to start barebox on
Raspberry Pi 3.
v6:
- Remove leftover val and missing fixup of the AUX Clock defines
v5:
- Add defines for register and base values
from Sascha Hauer and Roland Hieber
v4:
- Fix indentation for compatible
- Fix __maybe_unused annnotation for rpi_drvdata missed in v3
from Sascha Hauer
v3:
- Fix Indentation
from Oleksij Rempel and Sascha Hauer
v2:
- Move console clock initialization into board core
- Retrieve the core clock frequency for the miniuart from the firmware
- Double the clock frequency in the ns16550 rpi init function instead of
during initialization
from Lucas Stach
Rouven Czerwinski (9):
ARM: rpi: fix typo in rpi-common.c
ARM: rpi: move clks into board specific rpi-common
ARM: rpi: retrieve miniuart clock from firmware
serial_ns16550: handle default reg-io-width
serial_ns16550: add raspberry pi compatible and init
ARM: rpi: add NS16550 support
ARM: rpi: choose miniuart as stdout
doc: bcm283x: remove miniuart overlay instruction
ARM: rpi: use defines for uart bases
Documentation/boards/bcm2835.rst | 1 +-
arch/arm/boards/raspberry-pi/rpi-common.c | 34 ++++++++++-
arch/arm/configs/rpi_defconfig | 1 +-
arch/arm/dts/bcm2837-rpi-3.dts | 7 +--
arch/arm/mach-bcm283x/core.c | 19 +------
drivers/serial/serial_ns16550.c | 74 ++++++++++++++++--------
6 files changed, 85 insertions(+), 51 deletions(-)
base-commit: 0b5361a328632e64c14a54306119093a0c7fecdf
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 1/9] ARM: rpi: fix typo in rpi-common.c
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
@ 2019-01-15 5:44 ` Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 2/9] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
` (10 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
arch/arm/boards/raspberry-pi/rpi-common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index b7ce0ad..9f0531f 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -73,7 +73,7 @@ static int rpi_get_arm_mem(u32 *size)
return 0;
}
-static struct clk *rpi_register_firmare_clock(u32 clock_id, const char *name)
+static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name)
{
BCM2835_MBOX_STACK_ALIGN(struct msg_get_clock_rate, msg);
int ret;
@@ -285,7 +285,7 @@ static int rpi_clock_init(void)
{
struct clk *clk;
- clk = rpi_register_firmare_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
+ clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
"bcm2835_mci0");
if (IS_ERR(clk))
return PTR_ERR(clk);
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 2/9] ARM: rpi: move clks into board specific rpi-common
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 1/9] ARM: rpi: fix typo in rpi-common.c Rouven Czerwinski
@ 2019-01-15 5:44 ` Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 3/9] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
` (9 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
We don't know if the firmware running on the raspberry pi is the same firmware
which is running on all bcm283x devices.
Therefore move the console clock initialization into the rpi-common.c board file.
A future commit will use this function to retrieve the miniuart clock from the
raspberry pi firmware.
No functional changes.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
arch/arm/boards/raspberry-pi/rpi-common.c | 19 +++++++++++++++++++
arch/arm/mach-bcm283x/core.c | 19 -------------------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 9f0531f..490aeef 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -297,6 +297,25 @@ static int rpi_clock_init(void)
}
postconsole_initcall(rpi_clock_init);
+static int rpi_console_clock_init(void)
+{
+ struct clk *clk;
+
+ clk = clk_fixed("apb_pclk", 0);
+ clk_register_clkdev(clk, "apb_pclk", NULL);
+
+ clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000);
+ clk_register_clkdev(clk, NULL, "uart0-pl0110");
+ clkdev_add_physbase(clk, 0x20201000, NULL);
+ clkdev_add_physbase(clk, 0x3f201000, NULL);
+
+ clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
+ clk_register_clkdev(clk, NULL, "bcm2835-cs");
+
+ return 0;
+}
+postcore_initcall(rpi_console_clock_init);
+
static int rpi_env_init(void)
{
struct stat s;
diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c
index f1dcda8..f2528cf 100644
--- a/arch/arm/mach-bcm283x/core.c
+++ b/arch/arm/mach-bcm283x/core.c
@@ -31,25 +31,6 @@
#include <mach/core.h>
#include <linux/amba/bus.h>
-static int bcm2835_clk_init(void)
-{
- struct clk *clk;
-
- clk = clk_fixed("apb_pclk", 0);
- clk_register_clkdev(clk, "apb_pclk", NULL);
-
- clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000);
- clk_register_clkdev(clk, NULL, "uart0-pl0110");
- clkdev_add_physbase(clk, 0x20201000, NULL);
- clkdev_add_physbase(clk, 0x3f201000, NULL);
-
- clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
- clk_register_clkdev(clk, NULL, "bcm2835-cs");
-
- return 0;
-}
-postcore_initcall(bcm2835_clk_init);
-
void bcm2835_add_device_sdram(u32 size)
{
if (!size)
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 3/9] ARM: rpi: retrieve miniuart clock from firmware
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 1/9] ARM: rpi: fix typo in rpi-common.c Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 2/9] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
@ 2019-01-15 5:44 ` Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 4/9] serial_ns16550: handle default reg-io-width Rouven Czerwinski
` (8 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
The miniuart uses the core clock as the clock source. This clock is fixed by the
firmware to 250Mhz if enable_uart=1 is set in the config.txt file.
However a user could still choose to overclock the core frequency,
which would result in wrong baudrates computed by barebox.
Retrieve the core clock frequency from the firmware to allow all potential
firmware configurations to work with barebox.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
arch/arm/boards/raspberry-pi/rpi-common.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 490aeef..e29177d 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -309,6 +309,13 @@ static int rpi_console_clock_init(void)
clkdev_add_physbase(clk, 0x20201000, NULL);
clkdev_add_physbase(clk, 0x3f201000, NULL);
+ clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_CORE,
+ "uart1-8250");
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+
+ clkdev_add_physbase(clk, 0x3f215040, NULL);
+
clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
clk_register_clkdev(clk, NULL, "bcm2835-cs");
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 4/9] serial_ns16550: handle default reg-io-width
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (2 preceding siblings ...)
2019-01-15 5:44 ` [PATCH v6 3/9] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
@ 2019-01-15 5:44 ` Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 5/9] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
` (7 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
According to the device tree bindings for 8250, width is an optional property.
Default to 1 which is the same default value as used by the kernel.
Before this change the driver would not work for device trees which do not
include the optional binding.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
drivers/serial/serial_ns16550.c | 46 +++++++++++++++++-----------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 4d73ea8..8ddcfdb 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -297,36 +297,36 @@ static int ns16550_tstc(struct console_device *cdev)
static void ns16550_probe_dt(struct device_d *dev, struct ns16550_priv *priv)
{
struct device_node *np = dev->device_node;
- u32 width;
+ u32 width = 1;
if (!IS_ENABLED(CONFIG_OFDEVICE))
return;
of_property_read_u32(np, "clock-frequency", &priv->plat.clock);
of_property_read_u32(np, "reg-shift", &priv->plat.shift);
- if (!of_property_read_u32(np, "reg-io-width", &width))
- switch (width) {
- case 1:
- priv->read_reg = ns16550_read_reg_mmio_8;
- priv->write_reg = ns16550_write_reg_mmio_8;
- break;
- case 2:
- priv->read_reg = ns16550_read_reg_mmio_16;
- priv->write_reg = ns16550_write_reg_mmio_16;
- break;
- case 4:
- if (of_device_is_big_endian(np)) {
- priv->read_reg = ns16550_read_reg_mmio_32be;
- priv->write_reg = ns16550_write_reg_mmio_32be;
- } else {
- priv->read_reg = ns16550_read_reg_mmio_32;
- priv->write_reg = ns16550_write_reg_mmio_32;
- }
- break;
- default:
- dev_err(dev, "unsupported reg-io-width (%d)\n",
- width);
+ of_property_read_u32(np, "reg-io-width", &width);
+ switch (width) {
+ case 1:
+ priv->read_reg = ns16550_read_reg_mmio_8;
+ priv->write_reg = ns16550_write_reg_mmio_8;
+ break;
+ case 2:
+ priv->read_reg = ns16550_read_reg_mmio_16;
+ priv->write_reg = ns16550_write_reg_mmio_16;
+ break;
+ case 4:
+ if (of_device_is_big_endian(np)) {
+ priv->read_reg = ns16550_read_reg_mmio_32be;
+ priv->write_reg = ns16550_write_reg_mmio_32be;
+ } else {
+ priv->read_reg = ns16550_read_reg_mmio_32;
+ priv->write_reg = ns16550_write_reg_mmio_32;
}
+ break;
+ default:
+ dev_err(dev, "unsupported reg-io-width (%d)\n",
+ width);
+ }
}
static struct ns16550_drvdata ns16450_drvdata = {
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 5/9] serial_ns16550: add raspberry pi compatible and init
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (3 preceding siblings ...)
2019-01-15 5:44 ` [PATCH v6 4/9] serial_ns16550: handle default reg-io-width Rouven Czerwinski
@ 2019-01-15 5:44 ` Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 6/9] ARM: rpi: add NS16550 support Rouven Czerwinski
` (6 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Add the compatible for the Raspberry Pi AUX UART and an init function which
enables it via the aux register and configures the correct shift value.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
drivers/serial/serial_ns16550.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 8ddcfdb..ccd082e 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -253,6 +253,23 @@ static void ns16550_jz_init_port(struct console_device *cdev)
ns16550_serial_init_port(cdev);
}
+#define BCM2836_AUX_CLOCK_ENB 0x3f215004 /* BCM2835 AUX Clock enable register */
+#define BCM2836_AUX_CLOCK_EN_UART BIT(0) /* Bit 0 enables the Miniuart */
+
+static void rpi_init_port(struct console_device *cdev)
+{
+ struct ns16550_priv *priv = to_ns16550_priv(cdev);
+
+ writeb(BCM2836_AUX_CLOCK_EN_UART, BCM2836_AUX_CLOCK_ENB);
+ priv->plat.shift = 2;
+ /*
+ * We double the clock rate since the 16550 will divide by 16
+ * (instead of 8 required by the BCM2835 peripheral manual)
+ */
+ priv->plat.clock = priv->plat.clock*2;
+ ns16550_serial_init_port(cdev);
+}
+
/*********** Exposed Functions **********************************/
/**
@@ -353,6 +370,11 @@ static __maybe_unused struct ns16550_drvdata tegra_drvdata = {
.linux_console_name = "ttyS",
};
+static __maybe_unused struct ns16550_drvdata rpi_drvdata = {
+ .init_port = rpi_init_port,
+ .linux_console_name = "ttyS",
+};
+
static int ns16550_init_iomem(struct device_d *dev, struct ns16550_priv *priv)
{
struct resource *iores;
@@ -528,6 +550,12 @@ static struct of_device_id ns16550_serial_dt_ids[] = {
.data = &jz_drvdata,
},
#endif
+#if IS_ENABLED(CONFIG_MACH_RPI_COMMON)
+ {
+ .compatible = "brcm,bcm2835-aux-uart",
+ .data = &rpi_drvdata,
+ },
+#endif
{
/* sentinel */
},
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 6/9] ARM: rpi: add NS16550 support
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (4 preceding siblings ...)
2019-01-15 5:44 ` [PATCH v6 5/9] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
@ 2019-01-15 5:44 ` Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 7/9] ARM: rpi: choose miniuart as stdout Rouven Czerwinski
` (5 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Since the 16550 driver now supports the RPI3 miniuart, enable it in the default
config.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
arch/arm/configs/rpi_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index 2bb6158..dc5ab1f 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -63,6 +63,7 @@ CONFIG_CMD_OF_PROPERTY=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_MCI=y
CONFIG_MCI_BCM283X=y
CONFIG_LED=y
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 7/9] ARM: rpi: choose miniuart as stdout
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (5 preceding siblings ...)
2019-01-15 5:44 ` [PATCH v6 6/9] ARM: rpi: add NS16550 support Rouven Czerwinski
@ 2019-01-15 5:44 ` Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 8/9] doc: bcm283x: remove miniuart overlay instruction Rouven Czerwinski
` (4 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Since we now support the miniuart, enable it as the default stdout port.
With this change the device tree overlay to switch the miniuart to bluetooth is
no longer necessary.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
arch/arm/dts/bcm2837-rpi-3.dts | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/arm/dts/bcm2837-rpi-3.dts b/arch/arm/dts/bcm2837-rpi-3.dts
index d6ffc36..194b41c 100644
--- a/arch/arm/dts/bcm2837-rpi-3.dts
+++ b/arch/arm/dts/bcm2837-rpi-3.dts
@@ -2,15 +2,10 @@
/ {
chosen {
- stdout-path = &uart0;
+ stdout-path = &uart1;
};
memory {
reg = <0x0 0x0>;
};
};
-
-&uart0 {
- status = "okay";
- /delete-node/ bluetooth;
-};
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 8/9] doc: bcm283x: remove miniuart overlay instruction
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (6 preceding siblings ...)
2019-01-15 5:44 ` [PATCH v6 7/9] ARM: rpi: choose miniuart as stdout Rouven Czerwinski
@ 2019-01-15 5:44 ` Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 9/9] ARM: rpi: use defines for uart bases Rouven Czerwinski
` (3 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Since we now use the miniuart on the raspberry pi 3, the miniuart overlay is no
longer needed.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
Documentation/boards/bcm2835.rst | 1 -
1 file changed, 1 deletion(-)
diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
index 79ea0ff..ea80d58 100644
--- a/Documentation/boards/bcm2835.rst
+++ b/Documentation/boards/bcm2835.rst
@@ -22,7 +22,6 @@ Raspberry Pi
kernel=barebox.img
enable_uart=1
- dtoverlay=pi3-miniuart-bt
(For more information, refer to the `documentation for config.txt`_.)
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 9/9] ARM: rpi: use defines for uart bases
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (7 preceding siblings ...)
2019-01-15 5:44 ` [PATCH v6 8/9] doc: bcm283x: remove miniuart overlay instruction Rouven Czerwinski
@ 2019-01-15 5:44 ` Rouven Czerwinski
2019-01-15 11:01 ` [PATCH v6 0/9] Raspberry Pi miniuart support Roland Hieber
` (2 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 5:44 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Previously the clkdev_add_phybase was called on magic register values,
add defines which clarify the device for which the phybase clkdev is created.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
arch/arm/boards/raspberry-pi/rpi-common.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index e29177d..b8a41b2 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -297,6 +297,10 @@ static int rpi_clock_init(void)
}
postconsole_initcall(rpi_clock_init);
+#define BCM2835_PL011_BASE 0x20201000
+#define BCM2836_PL011_BASE 0x3f201000
+#define BCM2836_MINIUART_BASE 0x3f215040
+
static int rpi_console_clock_init(void)
{
struct clk *clk;
@@ -306,15 +310,15 @@ static int rpi_console_clock_init(void)
clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000);
clk_register_clkdev(clk, NULL, "uart0-pl0110");
- clkdev_add_physbase(clk, 0x20201000, NULL);
- clkdev_add_physbase(clk, 0x3f201000, NULL);
+ clkdev_add_physbase(clk, BCM2835_PL011_BASE, NULL);
+ clkdev_add_physbase(clk, BCM2836_PL011_BASE, NULL);
clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_CORE,
"uart1-8250");
if (IS_ERR(clk))
return PTR_ERR(clk);
- clkdev_add_physbase(clk, 0x3f215040, NULL);
+ clkdev_add_physbase(clk, BCM2836_MINIUART_BASE, NULL);
clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
clk_register_clkdev(clk, NULL, "bcm2835-cs");
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v6 0/9] Raspberry Pi miniuart support
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (8 preceding siblings ...)
2019-01-15 5:44 ` [PATCH v6 9/9] ARM: rpi: use defines for uart bases Rouven Czerwinski
@ 2019-01-15 11:01 ` Roland Hieber
2019-01-15 12:51 ` Rouven Czerwinski
2019-01-15 23:48 ` Roland Hieber
2019-01-16 7:46 ` Sascha Hauer
11 siblings, 1 reply; 16+ messages in thread
From: Roland Hieber @ 2019-01-15 11:01 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
Hi,
just a short notice, I tested in on my small board farm, RPi 1 and RPi 3
boot okay, but RPi Zero W doesn't show a barebox prompt. When enabling
uart_2ndstage=1 in config.txt, the firmware hangs after
MESS:00:00:02.864061:0: uart: Baud rate change done...
MESS:00:00:02.867490:0: uart: Baud rate
The docs don't claim that we officially to support that board though... :P
- Roland
On Tue, Jan 15, 2019 at 06:44:00AM +0100, Rouven Czerwinski wrote:
> This patch series adds support for the raspberry pi miniuart (also called
> aux-uart) to barebox.
> With this series the miniuart overlay is no longer necessary to start barebox on
> Raspberry Pi 3.
>
> v6:
> - Remove leftover val and missing fixup of the AUX Clock defines
>
> v5:
> - Add defines for register and base values
> from Sascha Hauer and Roland Hieber
>
> v4:
> - Fix indentation for compatible
> - Fix __maybe_unused annnotation for rpi_drvdata missed in v3
> from Sascha Hauer
>
> v3:
> - Fix Indentation
> from Oleksij Rempel and Sascha Hauer
>
> v2:
> - Move console clock initialization into board core
> - Retrieve the core clock frequency for the miniuart from the firmware
> - Double the clock frequency in the ns16550 rpi init function instead of
> during initialization
> from Lucas Stach
>
> Rouven Czerwinski (9):
> ARM: rpi: fix typo in rpi-common.c
> ARM: rpi: move clks into board specific rpi-common
> ARM: rpi: retrieve miniuart clock from firmware
> serial_ns16550: handle default reg-io-width
> serial_ns16550: add raspberry pi compatible and init
> ARM: rpi: add NS16550 support
> ARM: rpi: choose miniuart as stdout
> doc: bcm283x: remove miniuart overlay instruction
> ARM: rpi: use defines for uart bases
>
> Documentation/boards/bcm2835.rst | 1 +-
> arch/arm/boards/raspberry-pi/rpi-common.c | 34 ++++++++++-
> arch/arm/configs/rpi_defconfig | 1 +-
> arch/arm/dts/bcm2837-rpi-3.dts | 7 +--
> arch/arm/mach-bcm283x/core.c | 19 +------
> drivers/serial/serial_ns16550.c | 74 ++++++++++++++++--------
> 6 files changed, 85 insertions(+), 51 deletions(-)
>
> base-commit: 0b5361a328632e64c14a54306119093a0c7fecdf
> --
> git-series 0.9.1
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Roland Hieber | r.hieber@pengutronix.de |
Pengutronix e.K. | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
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] 16+ messages in thread
* Re: [PATCH v6 0/9] Raspberry Pi miniuart support
2019-01-15 11:01 ` [PATCH v6 0/9] Raspberry Pi miniuart support Roland Hieber
@ 2019-01-15 12:51 ` Rouven Czerwinski
2019-01-15 13:19 ` Roland Hieber
2019-01-15 23:47 ` Roland Hieber
0 siblings, 2 replies; 16+ messages in thread
From: Rouven Czerwinski @ 2019-01-15 12:51 UTC (permalink / raw)
To: Roland Hieber; +Cc: barebox
Looks like RPI W is wired the same way as RPI3.
I think for the RPI Zero W you'll need two additional lines:
#define BCM2835_MINIUART_BASE 0x20215040
and
clkdev_add_physbase(clk, BCM2835_MINIUART_BASE, NULL);
in rpi_console_clock_init.
These should enable the clkdev for the uart and should barebox allow to
probe the miniuart on RPI Zero W.
Don't forget to remove the uart_2ndstage=1, this line also switches
PL011 and the miniuart.
- Emantor
On Tue, 2019-01-15 at 12:01 +0100, Roland Hieber wrote:
> Hi,
>
> just a short notice, I tested in on my small board farm, RPi 1 and
> RPi 3
> boot okay, but RPi Zero W doesn't show a barebox prompt. When
> enabling
> uart_2ndstage=1 in config.txt, the firmware hangs after
>
> MESS:00:00:02.864061:0: uart: Baud rate change done...
> MESS:00:00:02.867490:0: uart: Baud rate
>
> The docs don't claim that we officially to support that board
> though... :P
>
> - Roland
>
> On Tue, Jan 15, 2019 at 06:44:00AM +0100, Rouven Czerwinski wrote:
> > This patch series adds support for the raspberry pi miniuart (also
> > called
> > aux-uart) to barebox.
> > With this series the miniuart overlay is no longer necessary to
> > start barebox on
> > Raspberry Pi 3.
> >
> > v6:
> > - Remove leftover val and missing fixup of the AUX Clock defines
> >
> > v5:
> > - Add defines for register and base values
> > from Sascha Hauer and Roland Hieber
> >
> > v4:
> > - Fix indentation for compatible
> > - Fix __maybe_unused annnotation for rpi_drvdata missed in v3
> > from Sascha Hauer
> >
> > v3:
> > - Fix Indentation
> > from Oleksij Rempel and Sascha Hauer
> >
> > v2:
> > - Move console clock initialization into board core
> > - Retrieve the core clock frequency for the miniuart from the
> > firmware
> > - Double the clock frequency in the ns16550 rpi init function
> > instead of
> > during initialization
> > from Lucas Stach
> >
> > Rouven Czerwinski (9):
> > ARM: rpi: fix typo in rpi-common.c
> > ARM: rpi: move clks into board specific rpi-common
> > ARM: rpi: retrieve miniuart clock from firmware
> > serial_ns16550: handle default reg-io-width
> > serial_ns16550: add raspberry pi compatible and init
> > ARM: rpi: add NS16550 support
> > ARM: rpi: choose miniuart as stdout
> > doc: bcm283x: remove miniuart overlay instruction
> > ARM: rpi: use defines for uart bases
> >
> > Documentation/boards/bcm2835.rst | 1 +-
> > arch/arm/boards/raspberry-pi/rpi-common.c | 34 ++++++++++-
> > arch/arm/configs/rpi_defconfig | 1 +-
> > arch/arm/dts/bcm2837-rpi-3.dts | 7 +--
> > arch/arm/mach-bcm283x/core.c | 19 +------
> > drivers/serial/serial_ns16550.c | 74 ++++++++++++++++---
> > -----
> > 6 files changed, 85 insertions(+), 51 deletions(-)
> >
> > base-commit: 0b5361a328632e64c14a54306119093a0c7fecdf
> > --
> > git-series 0.9.1
> >
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> >
>
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v6 0/9] Raspberry Pi miniuart support
2019-01-15 12:51 ` Rouven Czerwinski
@ 2019-01-15 13:19 ` Roland Hieber
2019-01-15 23:47 ` Roland Hieber
1 sibling, 0 replies; 16+ messages in thread
From: Roland Hieber @ 2019-01-15 13:19 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
On Tue, Jan 15, 2019 at 01:51:32PM +0100, Rouven Czerwinski wrote:
> Looks like RPI W is wired the same way as RPI3.
> I think for the RPI Zero W you'll need two additional lines:
>
> #define BCM2835_MINIUART_BASE 0x20215040
>
> and
> clkdev_add_physbase(clk, BCM2835_MINIUART_BASE, NULL);
> in rpi_console_clock_init.
>
> These should enable the clkdev for the uart and should barebox allow to
> probe the miniuart on RPI Zero W.
Thanks, I'll try that!
> Don't forget to remove the uart_2ndstage=1, this line also switches
> PL011 and the miniuart.
Ahh, you're right, I hadn't thought about that! I tested the RPi 1 too
with that line in config.txt.
- Roland
--
Roland Hieber | r.hieber@pengutronix.de |
Pengutronix e.K. | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
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] 16+ messages in thread
* Re: [PATCH v6 0/9] Raspberry Pi miniuart support
2019-01-15 12:51 ` Rouven Czerwinski
2019-01-15 13:19 ` Roland Hieber
@ 2019-01-15 23:47 ` Roland Hieber
1 sibling, 0 replies; 16+ messages in thread
From: Roland Hieber @ 2019-01-15 23:47 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
On Tue, Jan 15, 2019 at 01:51:32PM +0100, Rouven Czerwinski wrote:
> Looks like RPI W is wired the same way as RPI3.
> I think for the RPI Zero W you'll need two additional lines:
>
> #define BCM2835_MINIUART_BASE 0x20215040
>
> and
> clkdev_add_physbase(clk, BCM2835_MINIUART_BASE, NULL);
> in rpi_console_clock_init.
>
> These should enable the clkdev for the uart and should barebox allow to
> probe the miniuart on RPI Zero W.
Apparently this is not enough, same behaviour. I also tried adding a
separate device tree and image for RPi Zero and have the chosen node
point to uart1, like on the RPi 3, but that didn't help either.
Additionally it turned out that RPi Zero is not even booting with
previous releases - DistroKit had a patch recently to enable the debug
uart for the RPi Zero in config.txt, based on barebox 2018.03.0, but I
couldn't even get this constellation to boot to barebox. So I think
further investigation is needed, and my complaints are out of focus for
this patch series :)
- Roland
>
> Don't forget to remove the uart_2ndstage=1, this line also switches
> PL011 and the miniuart.
>
> - Emantor
>
> On Tue, 2019-01-15 at 12:01 +0100, Roland Hieber wrote:
> > Hi,
> >
> > just a short notice, I tested in on my small board farm, RPi 1 and
> > RPi 3
> > boot okay, but RPi Zero W doesn't show a barebox prompt. When
> > enabling
> > uart_2ndstage=1 in config.txt, the firmware hangs after
> >
> > MESS:00:00:02.864061:0: uart: Baud rate change done...
> > MESS:00:00:02.867490:0: uart: Baud rate
> >
> > The docs don't claim that we officially to support that board
> > though... :P
> >
> > - Roland
> >
> > On Tue, Jan 15, 2019 at 06:44:00AM +0100, Rouven Czerwinski wrote:
> > > This patch series adds support for the raspberry pi miniuart (also
> > > called
> > > aux-uart) to barebox.
> > > With this series the miniuart overlay is no longer necessary to
> > > start barebox on
> > > Raspberry Pi 3.
> > >
> > > v6:
> > > - Remove leftover val and missing fixup of the AUX Clock defines
> > >
> > > v5:
> > > - Add defines for register and base values
> > > from Sascha Hauer and Roland Hieber
> > >
> > > v4:
> > > - Fix indentation for compatible
> > > - Fix __maybe_unused annnotation for rpi_drvdata missed in v3
> > > from Sascha Hauer
> > >
> > > v3:
> > > - Fix Indentation
> > > from Oleksij Rempel and Sascha Hauer
> > >
> > > v2:
> > > - Move console clock initialization into board core
> > > - Retrieve the core clock frequency for the miniuart from the
> > > firmware
> > > - Double the clock frequency in the ns16550 rpi init function
> > > instead of
> > > during initialization
> > > from Lucas Stach
> > >
> > > Rouven Czerwinski (9):
> > > ARM: rpi: fix typo in rpi-common.c
> > > ARM: rpi: move clks into board specific rpi-common
> > > ARM: rpi: retrieve miniuart clock from firmware
> > > serial_ns16550: handle default reg-io-width
> > > serial_ns16550: add raspberry pi compatible and init
> > > ARM: rpi: add NS16550 support
> > > ARM: rpi: choose miniuart as stdout
> > > doc: bcm283x: remove miniuart overlay instruction
> > > ARM: rpi: use defines for uart bases
> > >
> > > Documentation/boards/bcm2835.rst | 1 +-
> > > arch/arm/boards/raspberry-pi/rpi-common.c | 34 ++++++++++-
> > > arch/arm/configs/rpi_defconfig | 1 +-
> > > arch/arm/dts/bcm2837-rpi-3.dts | 7 +--
> > > arch/arm/mach-bcm283x/core.c | 19 +------
> > > drivers/serial/serial_ns16550.c | 74 ++++++++++++++++---
> > > -----
> > > 6 files changed, 85 insertions(+), 51 deletions(-)
> > >
> > > base-commit: 0b5361a328632e64c14a54306119093a0c7fecdf
> > > --
> > > git-series 0.9.1
> > >
> > > _______________________________________________
> > > barebox mailing list
> > > barebox@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/barebox
> > >
> >
> >
>
--
Roland Hieber | r.hieber@pengutronix.de |
Pengutronix e.K. | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
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] 16+ messages in thread
* Re: [PATCH v6 0/9] Raspberry Pi miniuart support
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (9 preceding siblings ...)
2019-01-15 11:01 ` [PATCH v6 0/9] Raspberry Pi miniuart support Roland Hieber
@ 2019-01-15 23:48 ` Roland Hieber
2019-01-16 7:46 ` Sascha Hauer
11 siblings, 0 replies; 16+ messages in thread
From: Roland Hieber @ 2019-01-15 23:48 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
For this series:
Tested-by: Roland Hieber <rhi@pengutronix.de>
On Tue, Jan 15, 2019 at 06:44:00AM +0100, Rouven Czerwinski wrote:
> This patch series adds support for the raspberry pi miniuart (also called
> aux-uart) to barebox.
> With this series the miniuart overlay is no longer necessary to start barebox on
> Raspberry Pi 3.
>
> v6:
> - Remove leftover val and missing fixup of the AUX Clock defines
>
> v5:
> - Add defines for register and base values
> from Sascha Hauer and Roland Hieber
>
> v4:
> - Fix indentation for compatible
> - Fix __maybe_unused annnotation for rpi_drvdata missed in v3
> from Sascha Hauer
>
> v3:
> - Fix Indentation
> from Oleksij Rempel and Sascha Hauer
>
> v2:
> - Move console clock initialization into board core
> - Retrieve the core clock frequency for the miniuart from the firmware
> - Double the clock frequency in the ns16550 rpi init function instead of
> during initialization
> from Lucas Stach
>
> Rouven Czerwinski (9):
> ARM: rpi: fix typo in rpi-common.c
> ARM: rpi: move clks into board specific rpi-common
> ARM: rpi: retrieve miniuart clock from firmware
> serial_ns16550: handle default reg-io-width
> serial_ns16550: add raspberry pi compatible and init
> ARM: rpi: add NS16550 support
> ARM: rpi: choose miniuart as stdout
> doc: bcm283x: remove miniuart overlay instruction
> ARM: rpi: use defines for uart bases
>
> Documentation/boards/bcm2835.rst | 1 +-
> arch/arm/boards/raspberry-pi/rpi-common.c | 34 ++++++++++-
> arch/arm/configs/rpi_defconfig | 1 +-
> arch/arm/dts/bcm2837-rpi-3.dts | 7 +--
> arch/arm/mach-bcm283x/core.c | 19 +------
> drivers/serial/serial_ns16550.c | 74 ++++++++++++++++--------
> 6 files changed, 85 insertions(+), 51 deletions(-)
>
> base-commit: 0b5361a328632e64c14a54306119093a0c7fecdf
> --
> git-series 0.9.1
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Roland Hieber | r.hieber@pengutronix.de |
Pengutronix e.K. | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
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] 16+ messages in thread
* Re: [PATCH v6 0/9] Raspberry Pi miniuart support
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (10 preceding siblings ...)
2019-01-15 23:48 ` Roland Hieber
@ 2019-01-16 7:46 ` Sascha Hauer
11 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2019-01-16 7:46 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
On Tue, Jan 15, 2019 at 06:44:00AM +0100, Rouven Czerwinski wrote:
> This patch series adds support for the raspberry pi miniuart (also called
> aux-uart) to barebox.
> With this series the miniuart overlay is no longer necessary to start barebox on
> Raspberry Pi 3.
>
> v6:
> - Remove leftover val and missing fixup of the AUX Clock defines
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] 16+ messages in thread
end of thread, other threads:[~2019-01-16 7:46 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15 5:44 [PATCH v6 0/9] Raspberry Pi miniuart support Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 1/9] ARM: rpi: fix typo in rpi-common.c Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 2/9] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 3/9] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 4/9] serial_ns16550: handle default reg-io-width Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 5/9] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 6/9] ARM: rpi: add NS16550 support Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 7/9] ARM: rpi: choose miniuart as stdout Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 8/9] doc: bcm283x: remove miniuart overlay instruction Rouven Czerwinski
2019-01-15 5:44 ` [PATCH v6 9/9] ARM: rpi: use defines for uart bases Rouven Czerwinski
2019-01-15 11:01 ` [PATCH v6 0/9] Raspberry Pi miniuart support Roland Hieber
2019-01-15 12:51 ` Rouven Czerwinski
2019-01-15 13:19 ` Roland Hieber
2019-01-15 23:47 ` Roland Hieber
2019-01-15 23:48 ` Roland Hieber
2019-01-16 7:46 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox