[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] drivers: char: omap-uart: provide a default clock frequency


  • To: Amneesh Singh <a-singh21@xxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 20 Aug 2024 11:00:45 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ti.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hq7eMJacCeYJc2bLXgAFyeAFQUs91jOB/O9Z75cf2I4=; b=wWyJZfjZa0BvsC3CutSBtZhtMk34Zi7xRfANCZ5hNJPKrtsE7cvZ7YJa0yQIUYFpiVjyHYG4JM+vI0qVFwdbEC69fn++3OWzPBMZeK5GWSpG7FIxpNkfbb4Fx+78wDhfGxKuVHMkcFd9dExTHEFOv3g2MM86t79PVholK0A1RCA777zxTzR2S2WF79EDoqmYHV/QIG5sVhtBuUfxy3QLl1cV7pRxbmJ01CQg/1j0iVW0vFY4dGu4xWnnDUC9PR5Eql8Bs3tJl5viQqRf5lKffor0eybMqOWy3Qn/ZYaZfRpTV/9zWCci5PqQ1uaU6waqSkArA0wMmKqnd50ggG/b5A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BfDqjrU8tf1waTNY6BGRZ2d8N22ML8xm2X312as5MkodEnyQLsCtrZUvgv/Y2VHxDq+I3BVYc6mBTn8Rbd8Jhbpod2RQniz9KJo/aPRGLJKGtEh+GWL62M7VDyvl98LX2NWhZgs5xRD6u3f2SRrTmIkqTslNUwCK8bvR3Fzlpmj+HBGrHltrLcfJuoXZHqxOCHoXKqZYB6fFUPbiZ1SvxdVEfAx6T2qhClS+/eUdCrIiJOTwBMD3hvm2kDcZJX3as0Wq5bq7dj7lI2c11q7TSpjF36poWQ5YXLeiA1h7AkwjUPVKScBfesuAShQFnLdEiasyHo/QlkV+eiqgeaV8xg==
  • Cc: <julien@xxxxxxx>, <sstabellini@xxxxxxxxxx>
  • Delivery-date: Tue, 20 Aug 2024 09:01:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 20/08/2024 10:22, Amneesh Singh wrote:
> 
> 
> 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 if the device tree does not specify one.
I'd mention that this is same as Linux

> 
> Signed-off-by: Amneesh Singh <a-singh21@xxxxxx>
> ---
>  xen/drivers/char/omap-uart.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> ---
> v1: https://lore.kernel.org/all/20240719113313.145587-1-a-singh21@xxxxxx/T/
> 
> v1 -> v2
> - Ditch adding a dtuart option
> - Use a default value instead
> 
> This default is the same one as found in the 8250_omap driver of the
> linux tree. Already tested with Xen.
> 
> diff --git a/xen/drivers/char/omap-uart.c b/xen/drivers/char/omap-uart.c
> index 1079198..9d3d39c 100644
> --- a/xen/drivers/char/omap-uart.c
> +++ b/xen/drivers/char/omap-uart.c
> @@ -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
I think this should have U suffix to please MISRA 7.2

> +
>  #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);
Even though there is a comma, printk messages should not really be split. In 
such cases it's fine
to exceed 80 chars limit. Or do:
        printk("omap-uart: Clock frequency not specified, defaulting to %uHz\n",
               UART_OMAP_DEFAULT_CLK_SPEED);

Other than that:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.