* [PATCH v4 0/7] Raspberry Pi miniuart support
@ 2018-12-17 8:10 Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 1/7] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
` (7 more replies)
0 siblings, 8 replies; 15+ messages in thread
From: Rouven Czerwinski @ 2018-12-17 8:10 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.
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 (7):
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
Documentation/boards/bcm2835.rst | 1 +-
arch/arm/boards/raspberry-pi/rpi-common.c | 26 +++++++++-
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 | 71 ++++++++++++++++--------
6 files changed, 76 insertions(+), 49 deletions(-)
base-commit: 4d94b3c0208fedf9c9c2eed0053e9dffb9d52506
--
git-series 0.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 1/7] ARM: rpi: move clks into board specific rpi-common
2018-12-17 8:10 [PATCH v4 0/7] Raspberry Pi miniuart support Rouven Czerwinski
@ 2018-12-17 8:10 ` Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
` (6 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Rouven Czerwinski @ 2018-12-17 8:10 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] 15+ messages in thread
* [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware
2018-12-17 8:10 [PATCH v4 0/7] Raspberry Pi miniuart support Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 1/7] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
@ 2018-12-17 8:10 ` Rouven Czerwinski
2018-12-18 3:26 ` Roland Hieber
2018-12-18 7:21 ` Sascha Hauer
2018-12-17 8:10 ` [PATCH v4 3/7] serial_ns16550: handle default reg-io-width Rouven Czerwinski
` (5 subsequent siblings)
7 siblings, 2 replies; 15+ messages in thread
From: Rouven Czerwinski @ 2018-12-17 8:10 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] 15+ messages in thread
* [PATCH v4 3/7] serial_ns16550: handle default reg-io-width
2018-12-17 8:10 [PATCH v4 0/7] Raspberry Pi miniuart support Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 1/7] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
@ 2018-12-17 8:10 ` Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 4/7] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
` (4 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Rouven Czerwinski @ 2018-12-17 8:10 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] 15+ messages in thread
* [PATCH v4 4/7] serial_ns16550: add raspberry pi compatible and init
2018-12-17 8:10 [PATCH v4 0/7] Raspberry Pi miniuart support Rouven Czerwinski
` (2 preceding siblings ...)
2018-12-17 8:10 ` [PATCH v4 3/7] serial_ns16550: handle default reg-io-width Rouven Czerwinski
@ 2018-12-17 8:10 ` Rouven Czerwinski
2018-12-18 3:29 ` Roland Hieber
2018-12-17 8:10 ` [PATCH v4 5/7] ARM: rpi: add NS16550 support Rouven Czerwinski
` (3 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Rouven Czerwinski @ 2018-12-17 8:10 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] 15+ messages in thread
* [PATCH v4 5/7] ARM: rpi: add NS16550 support
2018-12-17 8:10 [PATCH v4 0/7] Raspberry Pi miniuart support Rouven Czerwinski
` (3 preceding siblings ...)
2018-12-17 8:10 ` [PATCH v4 4/7] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
@ 2018-12-17 8:10 ` Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 6/7] ARM: rpi: choose miniuart as stdout Rouven Czerwinski
` (2 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Rouven Czerwinski @ 2018-12-17 8:10 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] 15+ messages in thread
* [PATCH v4 6/7] ARM: rpi: choose miniuart as stdout
2018-12-17 8:10 [PATCH v4 0/7] Raspberry Pi miniuart support Rouven Czerwinski
` (4 preceding siblings ...)
2018-12-17 8:10 ` [PATCH v4 5/7] ARM: rpi: add NS16550 support Rouven Czerwinski
@ 2018-12-17 8:10 ` Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 7/7] doc: bcm283x: remove miniuart overlay instruction Rouven Czerwinski
2018-12-17 10:13 ` [PATCH v4 0/7] Raspberry Pi miniuart support Sascha Hauer
7 siblings, 0 replies; 15+ messages in thread
From: Rouven Czerwinski @ 2018-12-17 8:10 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] 15+ messages in thread
* [PATCH v4 7/7] doc: bcm283x: remove miniuart overlay instruction
2018-12-17 8:10 [PATCH v4 0/7] Raspberry Pi miniuart support Rouven Czerwinski
` (5 preceding siblings ...)
2018-12-17 8:10 ` [PATCH v4 6/7] ARM: rpi: choose miniuart as stdout Rouven Czerwinski
@ 2018-12-17 8:10 ` Rouven Czerwinski
2018-12-17 10:13 ` [PATCH v4 0/7] Raspberry Pi miniuart support Sascha Hauer
7 siblings, 0 replies; 15+ messages in thread
From: Rouven Czerwinski @ 2018-12-17 8:10 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] 15+ messages in thread
* Re: [PATCH v4 0/7] Raspberry Pi miniuart support
2018-12-17 8:10 [PATCH v4 0/7] Raspberry Pi miniuart support Rouven Czerwinski
` (6 preceding siblings ...)
2018-12-17 8:10 ` [PATCH v4 7/7] doc: bcm283x: remove miniuart overlay instruction Rouven Czerwinski
@ 2018-12-17 10:13 ` Sascha Hauer
7 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2018-12-17 10:13 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
On Mon, Dec 17, 2018 at 09:10:38AM +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.
>
> v4:
> - Fix indentation for compatible
> - Fix __maybe_unused annnotation for rpi_drvdata missed in v3
> from Sascha Hauer
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] 15+ messages in thread
* Re: [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware
2018-12-17 8:10 ` [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
@ 2018-12-18 3:26 ` Roland Hieber
2018-12-18 7:17 ` Sascha Hauer
2018-12-18 7:21 ` Sascha Hauer
1 sibling, 1 reply; 15+ messages in thread
From: Roland Hieber @ 2018-12-18 3:26 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
On Mon, Dec 17, 2018 at 09:10:40AM +0100, Rouven Czerwinski wrote:
> 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);
This magic value could probably have an explaining comment somewhere
next to it.
- Roland
> +
> 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
>
--
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] 15+ messages in thread
* Re: [PATCH v4 4/7] serial_ns16550: add raspberry pi compatible and init
2018-12-17 8:10 ` [PATCH v4 4/7] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
@ 2018-12-18 3:29 ` Roland Hieber
0 siblings, 0 replies; 15+ messages in thread
From: Roland Hieber @ 2018-12-18 3:29 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
On Mon, Dec 17, 2018 at 09:10:42AM +0100, Rouven Czerwinski wrote:
> 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);
Same here. I guess it is some register that has to do with the ns16550?
But what happens when we write 1 to it?
- Roland
> + 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
>
--
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] 15+ messages in thread
* Re: [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware
2018-12-18 3:26 ` Roland Hieber
@ 2018-12-18 7:17 ` Sascha Hauer
0 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2018-12-18 7:17 UTC (permalink / raw)
To: Roland Hieber; +Cc: barebox, Rouven Czerwinski
On Tue, Dec 18, 2018 at 04:26:10AM +0100, Roland Hieber wrote:
> On Mon, Dec 17, 2018 at 09:10:40AM +0100, Rouven Czerwinski wrote:
> > 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);
>
> This magic value could probably have an explaining comment somewhere
> next to it.
Or better a #define BCM2835_xxx_BASE 0x3f215040.
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] 15+ messages in thread
* Re: [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware
2018-12-17 8:10 ` [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
2018-12-18 3:26 ` Roland Hieber
@ 2018-12-18 7:21 ` Sascha Hauer
2018-12-18 8:39 ` Rouven Czerwinski
1 sibling, 1 reply; 15+ messages in thread
From: Sascha Hauer @ 2018-12-18 7:21 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
On Mon, Dec 17, 2018 at 09:10:40AM +0100, Rouven Czerwinski wrote:
> 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");
We don't have this function anywhere in the tree, this breaks
compilation.
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] 15+ messages in thread
* Re: [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware
2018-12-18 7:21 ` Sascha Hauer
@ 2018-12-18 8:39 ` Rouven Czerwinski
2018-12-18 8:45 ` Sascha Hauer
0 siblings, 1 reply; 15+ messages in thread
From: Rouven Czerwinski @ 2018-12-18 8:39 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On Tue, 2018-12-18 at 08:21 +0100, Sascha Hauer wrote:
> On Mon, Dec 17, 2018 at 09:10:40AM +0100, Rouven Czerwinski wrote:
> > 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");
>
> We don't have this function anywhere in the tree, this breaks
> compilation.
Yes the base on my series was wrong, its missing a cleanup patch.
Do you want a single patch or shall I post a new series which
incorporates the suggestions from Roland and you?
- Rouven
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware
2018-12-18 8:39 ` Rouven Czerwinski
@ 2018-12-18 8:45 ` Sascha Hauer
0 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2018-12-18 8:45 UTC (permalink / raw)
To: Rouven Czerwinski; +Cc: barebox
On Tue, Dec 18, 2018 at 09:39:19AM +0100, Rouven Czerwinski wrote:
> On Tue, 2018-12-18 at 08:21 +0100, Sascha Hauer wrote:
> > On Mon, Dec 17, 2018 at 09:10:40AM +0100, Rouven Czerwinski wrote:
> > > 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");
> >
> > We don't have this function anywhere in the tree, this breaks
> > compilation.
> Yes the base on my series was wrong, its missing a cleanup patch.
>
> Do you want a single patch or shall I post a new series which
> incorporates the suggestions from Roland and you?
Please resend the whole series.
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] 15+ messages in thread
end of thread, other threads:[~2018-12-18 8:45 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-17 8:10 [PATCH v4 0/7] Raspberry Pi miniuart support Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 1/7] ARM: rpi: move clks into board specific rpi-common Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 2/7] ARM: rpi: retrieve miniuart clock from firmware Rouven Czerwinski
2018-12-18 3:26 ` Roland Hieber
2018-12-18 7:17 ` Sascha Hauer
2018-12-18 7:21 ` Sascha Hauer
2018-12-18 8:39 ` Rouven Czerwinski
2018-12-18 8:45 ` Sascha Hauer
2018-12-17 8:10 ` [PATCH v4 3/7] serial_ns16550: handle default reg-io-width Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 4/7] serial_ns16550: add raspberry pi compatible and init Rouven Czerwinski
2018-12-18 3:29 ` Roland Hieber
2018-12-17 8:10 ` [PATCH v4 5/7] ARM: rpi: add NS16550 support Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 6/7] ARM: rpi: choose miniuart as stdout Rouven Czerwinski
2018-12-17 8:10 ` [PATCH v4 7/7] doc: bcm283x: remove miniuart overlay instruction Rouven Czerwinski
2018-12-17 10:13 ` [PATCH v4 0/7] Raspberry Pi miniuart support Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox