]> xenbits.xensource.com Git - xen.git/commitdiff
drivers: char: omap-uart: provide a default clock frequency
authorAmneesh Singh <a-singh21@ti.com>
Tue, 20 Aug 2024 08:22:03 +0000 (13:52 +0530)
committerJulien Grall <jgrall@amazon.com>
Thu, 22 Aug 2024 09:59:52 +0000 (10:59 +0100)
Quite a few TI K3 devices do not have clock-frequency specified in their
respective UART nodes. However hard-coding the frequency is not a
solution as the function clock input can differ between SoCs. So, use a
default frequency of 48MHz, which is the same as the linux default (see
8250_omap.c), if the device tree does not specify it.

Signed-off-by: Amneesh Singh <a-singh21@ti.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
xen/drivers/char/omap-uart.c

index 1079198a8d12ac9d305aad3298dea55cdacbde15..9f73d822adf11f5c5214a566acd86ee1ebab7451 100644 (file)
@@ -48,6 +48,9 @@
 /* System configuration register */
 #define UART_OMAP_SYSC_DEF_CONF   0x0d   /* autoidle mode, wakeup is enabled */
 
+/* default clock frequency in hz */
+#define UART_OMAP_DEFAULT_CLK_SPEED 48000000
+
 #define omap_read(uart, off)       readl((uart)->regs + ((off) << REG_SHIFT))
 #define omap_write(uart, off, val) writel(val, \
                                           (uart)->regs + ((off) << REG_SHIFT))
@@ -322,8 +325,9 @@ static int __init omap_uart_init(struct dt_device_node *dev,
     res = dt_property_read_u32(dev, "clock-frequency", &clkspec);
     if ( !res )
     {
-        printk("omap-uart: Unable to retrieve the clock frequency\n");
-        return -EINVAL;
+        printk("omap-uart: Unable to retrieve the clock frequency, defaulting to %uHz\n",
+               UART_OMAP_DEFAULT_CLK_SPEED);
+        clkspec = UART_OMAP_DEFAULT_CLK_SPEED;
     }
 
     uart->clock_hz = clkspec;