* [PATCH v5 0/9] Raspberry Pi miniuart support
@ 2018-12-18 10:47 Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 1/9] ARM: rpi: fix typo in rpi-common.c Rouven Czerwinski
` (9 more replies)
0 siblings, 10 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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.
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 | 75 ++++++++++++++++--------
6 files changed, 86 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] 17+ messages in thread
* [PATCH v5 1/9] ARM: rpi: fix typo in rpi-common.c
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
@ 2018-12-18 10:47 ` Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 2/9] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
` (8 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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] 17+ messages in thread
* [PATCH v5 2/9] ARM: rpi: move clks into board specific rpi-common
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 1/9] ARM: rpi: fix typo in rpi-common.c Rouven Czerwinski
@ 2018-12-18 10:47 ` Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 3/9] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
` (7 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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] 17+ messages in thread
* [PATCH v5 3/9] ARM: rpi: retrieve miniuart clock from firmware
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 1/9] ARM: rpi: fix typo in rpi-common.c Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 2/9] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
@ 2018-12-18 10:47 ` Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 4/9] serial_ns16550: handle default reg-io-width Rouven Czerwinski
` (6 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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] 17+ messages in thread
* [PATCH v5 4/9] serial_ns16550: handle default reg-io-width
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (2 preceding siblings ...)
2018-12-18 10:47 ` [PATCH v5 3/9] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
@ 2018-12-18 10:47 ` Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 5/9] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
` (5 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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] 17+ messages in thread
* [PATCH v5 5/9] serial_ns16550: add raspberry pi compatible and init
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (3 preceding siblings ...)
2018-12-18 10:47 ` [PATCH v5 4/9] serial_ns16550: handle default reg-io-width Rouven Czerwinski
@ 2018-12-18 10:47 ` Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 6/9] ARM: rpi: add NS16550 support Rouven Czerwinski
` (4 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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 | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 8ddcfdb..256063a 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -253,6 +253,20 @@ static void ns16550_jz_init_port(struct console_device *cdev)
ns16550_serial_init_port(cdev);
}
+static void rpi_init_port(struct console_device *cdev)
+{
+ struct ns16550_priv *priv = to_ns16550_priv(cdev);
+
+ writeb(0x01, 0x3f215004);
+ 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 +367,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 +547,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] 17+ messages in thread
* [PATCH v5 6/9] ARM: rpi: add NS16550 support
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (4 preceding siblings ...)
2018-12-18 10:47 ` [PATCH v5 5/9] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
@ 2018-12-18 10:47 ` Rouven Czerwinski
2018-12-19 11:26 ` Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 7/9] ARM: rpi: choose miniuart as stdout Rouven Czerwinski
` (3 subsequent siblings)
9 siblings, 1 reply; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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 +
drivers/serial/serial_ns16550.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
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
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 256063a..5e5b671 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -253,11 +253,15 @@ 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)
{
+ uint8_t val;
struct ns16550_priv *priv = to_ns16550_priv(cdev);
- writeb(0x01, 0x3f215004);
+ writeb(BCM2835_AUX_CLOCK_EN_UART, BCM2835_AUX_CLOCK_ENB);
priv->plat.shift = 2;
/*
* We double the clock rate since the 16550 will divide by 16
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v5 7/9] ARM: rpi: choose miniuart as stdout
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (5 preceding siblings ...)
2018-12-18 10:47 ` [PATCH v5 6/9] ARM: rpi: add NS16550 support Rouven Czerwinski
@ 2018-12-18 10:47 ` Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 8/9] doc: bcm283x: remove miniuart overlay instruction Rouven Czerwinski
` (2 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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] 17+ messages in thread
* [PATCH v5 8/9] doc: bcm283x: remove miniuart overlay instruction
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (6 preceding siblings ...)
2018-12-18 10:47 ` [PATCH v5 7/9] ARM: rpi: choose miniuart as stdout Rouven Czerwinski
@ 2018-12-18 10:47 ` Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 9/9] ARM: rpi: use defines for uart bases Rouven Czerwinski
2018-12-18 14:06 ` [PATCH v5 0/9] Raspberry Pi miniuart support Sascha Hauer
9 siblings, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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] 17+ messages in thread
* [PATCH v5 9/9] ARM: rpi: use defines for uart bases
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (7 preceding siblings ...)
2018-12-18 10:47 ` [PATCH v5 8/9] doc: bcm283x: remove miniuart overlay instruction Rouven Czerwinski
@ 2018-12-18 10:47 ` Rouven Czerwinski
2018-12-18 14:06 ` [PATCH v5 0/9] Raspberry Pi miniuart support Sascha Hauer
9 siblings, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 10:47 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] 17+ messages in thread
* Re: [PATCH v5 0/9] Raspberry Pi miniuart support
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
` (8 preceding siblings ...)
2018-12-18 10:47 ` [PATCH v5 9/9] ARM: rpi: use defines for uart bases Rouven Czerwinski
@ 2018-12-18 14:06 ` Sascha Hauer
2018-12-18 14:26 ` Peter Korsgaard
9 siblings, 1 reply; 17+ messages in thread
From: Sascha Hauer @ 2018-12-18 14:06 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
On Tue, Dec 18, 2018 at 11:47:35AM +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.
>
> v5:
> - Add defines for register and base values
> from Sascha Hauer and Roland Hieber
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] 17+ messages in thread
* Re: [PATCH v5 0/9] Raspberry Pi miniuart support
2018-12-18 14:06 ` [PATCH v5 0/9] Raspberry Pi miniuart support Sascha Hauer
@ 2018-12-18 14:26 ` Peter Korsgaard
2018-12-19 5:21 ` Rouven Czerwinski
0 siblings, 1 reply; 17+ messages in thread
From: Peter Korsgaard @ 2018-12-18 14:26 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox, Rouven Czerwinski
>>>>> "Sascha" == Sascha Hauer <s.hauer@pengutronix.de> writes:
> On Tue, Dec 18, 2018 at 11:47:35AM +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.
>>
>> v5:
>> - Add defines for register and base values
>> from Sascha Hauer and Roland Hieber
> Applied, thanks
Where did those defines actually go? I still see a bunch of magic
values.
--
Bye, Peter Korsgaard
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 0/9] Raspberry Pi miniuart support
2018-12-18 14:26 ` Peter Korsgaard
@ 2018-12-19 5:21 ` Rouven Czerwinski
2018-12-19 8:29 ` Peter Korsgaard
0 siblings, 1 reply; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-19 5:21 UTC (permalink / raw)
To: Peter Korsgaard, Sascha Hauer; +Cc: barebox
On Tue, 2018-12-18 at 15:26 +0100, Peter Korsgaard wrote:
> > > > > > "Sascha" == Sascha Hauer <s.hauer@pengutronix.de> writes:
>
> > On Tue, Dec 18, 2018 at 11:47:35AM +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.
> >>
> >> v5:
> >> - Add defines for register and base values
> >> from Sascha Hauer and Roland Hieber
>
> > Applied, thanks
>
> Where did those defines actually go? I still see a bunch of magic
> values.
>
They are either contained directly in the original patch (for 5/9) or
in the new 9/9 patch.
- Rouven
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 0/9] Raspberry Pi miniuart support
2018-12-19 5:21 ` Rouven Czerwinski
@ 2018-12-19 8:29 ` Peter Korsgaard
2018-12-19 8:37 ` Rouven Czerwinski
2018-12-19 11:28 ` Rouven Czerwinski
0 siblings, 2 replies; 17+ messages in thread
From: Peter Korsgaard @ 2018-12-19 8:29 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
>>>>> "Rouven" == Rouven Czerwinski <r.czerwinski@pengutronix.de> writes:
Hi,
>> >> v5:
>> >> - Add defines for register and base values
>> >> from Sascha Hauer and Roland Hieber
>>
>> > Applied, thanks
>>
>> Where did those defines actually go? I still see a bunch of magic
>> values.
>>
> They are either contained directly in the original patch (for 5/9) or
> in the new 9/9 patch.
Sorry, I don't follow. I still see magic values in E.G.:
97818de1a3d serial_ns16550: add raspberry pi compatible and init
776de843636 ARM: rpi: retrieve miniuart clock from firmware
Wasn't this comment about replacing them with sensible defines?
--
Bye, Peter Korsgaard
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 0/9] Raspberry Pi miniuart support
2018-12-19 8:29 ` Peter Korsgaard
@ 2018-12-19 8:37 ` Rouven Czerwinski
2018-12-19 11:28 ` Rouven Czerwinski
1 sibling, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-19 8:37 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: barebox, Rouven Czerwinski
Peter Korsgaard <peter@korsgaard.com> writes:
>>>>>> "Rouven" == Rouven Czerwinski <r.czerwinski@pengutronix.de> writes:
>
> Hi,
>
> >> >> v5:
> >> >> - Add defines for register and base values
> >> >> from Sascha Hauer and Roland Hieber
> >>
> >> > Applied, thanks
> >>
> >> Where did those defines actually go? I still see a bunch of magic
> >> values.
> >>
> > They are either contained directly in the original patch (for 5/9) or
> > in the new 9/9 patch.
>
> Sorry, I don't follow. I still see magic values in E.G.:
>
> 97818de1a3d serial_ns16550: add raspberry pi compatible and init
> 776de843636 ARM: rpi: retrieve miniuart clock from firmware
>
> Wasn't this comment about replacing them with sensible defines?
Yes, looking into the next branch, it still contains the old patchset
without the defines. Maybe Sascha has not pushed yet?
- Rouven
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 6/9] ARM: rpi: add NS16550 support
2018-12-18 10:47 ` [PATCH v5 6/9] ARM: rpi: add NS16550 support Rouven Czerwinski
@ 2018-12-19 11:26 ` Rouven Czerwinski
0 siblings, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-19 11:26 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
Rouven Czerwinski <r.czerwinski@pengutronix.de> writes:
> 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 +
> drivers/serial/serial_ns16550.c | 6 +++++-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> 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
> diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
> index 256063a..5e5b671 100644
> --- a/drivers/serial/serial_ns16550.c
> +++ b/drivers/serial/serial_ns16550.c
> @@ -253,11 +253,15 @@ 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)
> {
> + uint8_t val;
^ This leftover should be removed
> struct ns16550_priv *priv = to_ns16550_priv(cdev);
>
> - writeb(0x01, 0x3f215004);
> + writeb(BCM2835_AUX_CLOCK_EN_UART, BCM2835_AUX_CLOCK_ENB);
^ this is broken, the Define uses 6 not 5 (since
for rpi2 and 3 the address is different)
I'll resend the series with these changes squashed into the previous
commit which touches this file.
> priv->plat.shift = 2;
> /*
> * We double the clock rate since the 16550 will divide by 16
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 0/9] Raspberry Pi miniuart support
2018-12-19 8:29 ` Peter Korsgaard
2018-12-19 8:37 ` Rouven Czerwinski
@ 2018-12-19 11:28 ` Rouven Czerwinski
1 sibling, 0 replies; 17+ messages in thread
From: Rouven Czerwinski @ 2018-12-19 11:28 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: barebox, Rouven Czerwinski
Peter Korsgaard <peter@korsgaard.com> writes:
>>>>>> "Rouven" == Rouven Czerwinski <r.czerwinski@pengutronix.de> writes:
>
> Hi,
>
> >> >> v5:
> >> >> - Add defines for register and base values
> >> >> from Sascha Hauer and Roland Hieber
> >>
> >> > Applied, thanks
> >>
> >> Where did those defines actually go? I still see a bunch of magic
> >> values.
> >>
> > They are either contained directly in the original patch (for 5/9) or
> > in the new 9/9 patch.
>
> Sorry, I don't follow. I still see magic values in E.G.:
>
> 97818de1a3d serial_ns16550: add raspberry pi compatible and init
> 776de843636 ARM: rpi: retrieve miniuart clock from firmware
>
> Wasn't this comment about replacing them with sensible defines?
Looking at the patches again the change to defines for the AUX Clock
domain was squashed into the wrong commit.
I'll resend the corrected version.
Thanks for noticing.
- Rouven
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2018-12-19 11:28 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 10:47 [PATCH v5 0/9] Raspberry Pi miniuart support Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 1/9] ARM: rpi: fix typo in rpi-common.c Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 2/9] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 3/9] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 4/9] serial_ns16550: handle default reg-io-width Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 5/9] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 6/9] ARM: rpi: add NS16550 support Rouven Czerwinski
2018-12-19 11:26 ` Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 7/9] ARM: rpi: choose miniuart as stdout Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 8/9] doc: bcm283x: remove miniuart overlay instruction Rouven Czerwinski
2018-12-18 10:47 ` [PATCH v5 9/9] ARM: rpi: use defines for uart bases Rouven Czerwinski
2018-12-18 14:06 ` [PATCH v5 0/9] Raspberry Pi miniuart support Sascha Hauer
2018-12-18 14:26 ` Peter Korsgaard
2018-12-19 5:21 ` Rouven Czerwinski
2018-12-19 8:29 ` Peter Korsgaard
2018-12-19 8:37 ` Rouven Czerwinski
2018-12-19 11:28 ` Rouven Czerwinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox