mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 10:08:59 +00:00
c6ddf8d502
Many changes were done in drivers/pinctrl/bcm/pinctrl-bcm2835.c between 5.4.171 and 5.4.179. The following 3 patches do not apply any more: * target/linux/bcm27xx/patches-5.4/950-0316-pinctrl-bcm2835-Add-support-for-BCM2711-pull-up-func.patch This was already integrated in kernel v5.4-rc1, it was never needed. * target/linux/bcm27xx/patches-5.4/950-0328-Revert-pinctrl-bcm2835-Pass-irqchip-when-adding-gpio.patch * target/linux/bcm27xx/patches-5.4/950-0362-pinctrl-bcm2835-Change-init-order-for-gpio-hogs.patch I think these were done to fix the problem which was really fixed in commit 75278f1aff5e ("pinctrl: bcm2835: Change init order for gpio hogs") from v5.4.175 target/linux/generic/backport-5.4/716-v5.5-net-sfp-move-fwnode-parsing-into-sfp-bus-layer.patch Move fwnode_device_is_available to the same position as in kernel 5.10. target/linux/layerscape/patches-5.4/302-dts-0083-arm64-ls1028a-qds-correct-bus-of-rtc.patch Applied in commit 65816c1034769e714edb70f59a33bc5472d9e55f ("arm64: dts: ls1028a-qds: move rtc node to the correct i2c bus") Compile-tested: lantiq/xrx200, bcm27xx/bcm2710 Run-tested: lantiq/xrx200 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
87 lines
2.5 KiB
Diff
87 lines
2.5 KiB
Diff
From 409f4b56de7611d703790c54a70fad9a6e2bb161 Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.org>
|
|
Date: Wed, 1 Mar 2017 16:07:39 +0000
|
|
Subject: [PATCH] amba_pl011: Round input clock up
|
|
|
|
The UART clock is initialised to be as close to the requested
|
|
frequency as possible without exceeding it. Now that there is a
|
|
clock manager that returns the actual frequencies, an expected
|
|
48MHz clock is reported as 47999625. If the requested baudrate
|
|
== requested clock/16, there is no headroom and the slight
|
|
reduction in actual clock rate results in failure.
|
|
|
|
Detect cases where it looks like a "round" clock was chosen and
|
|
adjust the reported clock to match that "round" value. As the
|
|
code comment says:
|
|
|
|
/*
|
|
* If increasing a clock by less than 0.1% changes it
|
|
* from ..999.. to ..000.., round up.
|
|
*/
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
|
---
|
|
drivers/tty/serial/amba-pl011.c | 23 +++++++++++++++++++++--
|
|
1 file changed, 21 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/tty/serial/amba-pl011.c
|
|
+++ b/drivers/tty/serial/amba-pl011.c
|
|
@@ -1653,6 +1653,23 @@ static void pl011_put_poll_char(struct u
|
|
|
|
#endif /* CONFIG_CONSOLE_POLL */
|
|
|
|
+unsigned long pl011_clk_round(unsigned long clk)
|
|
+{
|
|
+ unsigned long scaler;
|
|
+
|
|
+ /*
|
|
+ * If increasing a clock by less than 0.1% changes it
|
|
+ * from ..999.. to ..000.., round up.
|
|
+ */
|
|
+ scaler = 1;
|
|
+ while (scaler * 100000 < clk)
|
|
+ scaler *= 10;
|
|
+ if ((clk + scaler - 1)/scaler % 1000 == 0)
|
|
+ clk = (clk/scaler + 1) * scaler;
|
|
+
|
|
+ return clk;
|
|
+}
|
|
+
|
|
static int pl011_hwinit(struct uart_port *port)
|
|
{
|
|
struct uart_amba_port *uap =
|
|
@@ -1669,7 +1686,7 @@ static int pl011_hwinit(struct uart_port
|
|
if (retval)
|
|
return retval;
|
|
|
|
- uap->port.uartclk = clk_get_rate(uap->clk);
|
|
+ uap->port.uartclk = pl011_clk_round(clk_get_rate(uap->clk));
|
|
|
|
/* Clear pending error and receive interrupts */
|
|
pl011_write(UART011_OEIS | UART011_BEIS | UART011_PEIS |
|
|
@@ -2303,7 +2320,7 @@ static int pl011_console_setup(struct co
|
|
plat->init();
|
|
}
|
|
|
|
- uap->port.uartclk = clk_get_rate(uap->clk);
|
|
+ uap->port.uartclk = pl011_clk_round(clk_get_rate(uap->clk));
|
|
|
|
if (uap->vendor->fixed_options) {
|
|
baud = uap->fixed_baud;
|
|
@@ -2488,6 +2505,7 @@ static struct uart_driver amba_reg = {
|
|
.cons = AMBA_CONSOLE,
|
|
};
|
|
|
|
+#if 0
|
|
static int pl011_probe_dt_alias(int index, struct device *dev)
|
|
{
|
|
struct device_node *np;
|
|
@@ -2519,6 +2537,7 @@ static int pl011_probe_dt_alias(int inde
|
|
|
|
return ret;
|
|
}
|
|
+#endif
|
|
|
|
/* unregisters the driver also if no more ports are left */
|
|
static void pl011_unregister_port(struct uart_amba_port *uap)
|