[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240501.152252.1283306844636725107.fujita.tomonori@gmail.com>
Date: Wed, 01 May 2024 15:22:52 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: andrew@...n.ch
Cc: fujita.tomonori@...il.com, netdev@...r.kernel.org, jiri@...nulli.us,
horms@...nel.org
Subject: Re: [PATCH net-next v3 5/6] net: tn40xx: add mdio bus support
Hi,
On Tue, 30 Apr 2024 22:51:52 +0200
Andrew Lunn <andrew@...n.ch> wrote:
>> diff --git a/drivers/net/ethernet/tehuti/tn40.h b/drivers/net/ethernet/tehuti/tn40.h
>> index a93b83e343d3..2719a31fe86c 100644
>> --- a/drivers/net/ethernet/tehuti/tn40.h
>> +++ b/drivers/net/ethernet/tehuti/tn40.h
>> @@ -11,6 +11,7 @@
>> #include <linux/if_vlan.h>
>> #include <linux/in.h>
>> #include <linux/interrupt.h>
>> +#include <linux/iopoll.h>
>> #include <linux/ip.h>
>> #include <linux/module.h>
>> #include <linux/netdevice.h>
>
>> +++ b/drivers/net/ethernet/tehuti/tn40_mdio.c
>> @@ -0,0 +1,132 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/* Copyright (c) Tehuti Networks Ltd. */
>> +
>> +#include "tn40.h"
>> +
>
> Part of the reason we want to see includes here, and not in a .h file
> is that you are including lots of things which an MDIO driver does not
> need. That slows down the build.
Understood, fixed.
>> +static void tn40_mdio_set_speed(struct tn40_priv *priv, u32 speed)
>> +{
>> + void __iomem *regs = priv->regs;
>> + int mdio_cfg;
>> +
>> + mdio_cfg = readl(regs + TN40_REG_MDIO_CMD_STAT);
>> + if (speed == 1)
>> + mdio_cfg = (0x7d << 7) | 0x08; /* 1MHz */
>> + else
>> + mdio_cfg = 0xA08; /* 6MHz */
>> + mdio_cfg |= (1 << 6);
>
> Is there any documentation about these bits?
No information in the original code.
>> +static int tn40_mdio_get(struct tn40_priv *priv, u32 *val)
>> +{
>> + u32 stat;
>> + int ret;
>> +
>> + ret = readx_poll_timeout_atomic(tn40_mdio_stat, priv, stat,
>> + TN40_GET_MDIO_BUSY(stat) == 0, 10,
>> + 10000);
>> + return ret;
>
> You don't need the ret variable. Just:
>
> return readx_poll_timeout_atomic(...);
Oops, fixed.
Powered by blists - more mailing lists