[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <78ecc7a9-bb33-4c2d-a797-87f782b6a382@gmx.net>
Date: Sun, 9 Jun 2024 13:41:20 +0200
From: Hans-Frieder Vogt <hfdevel@....net>
To: FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: andrew@...n.ch, horms@...nel.org, kuba@...nel.org, jiri@...nulli.us,
pabeni@...hat.com, linux@...linux.org.uk, naveenm@...vell.com,
jdamato@...tly.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v9 3/6] net: tn40xx: add basic Tx handling
On 06.06.2024 01.26, FUJITA Tomonori wrote:
(deleted quite a few lines, because the relevant topic is nearly at the
end).
> +
> +static int tn40_priv_init(struct tn40_priv *priv)
> +{
> + int ret;
> +
> + tn40_set_link_speed(priv, 0);
> +
> + ret = tn40_hw_reset(priv);
> + if (ret)
> + return ret;
> +
> + /* Set GPIO[9:0] to output 0 */
> + tn40_write_reg(priv, 0x51E0, 0x30010006); /* GPIO_OE_ WR CMD */
> + tn40_write_reg(priv, 0x51F0, 0x0); /* GPIO_OE_ DATA */
> + tn40_write_reg(priv, TN40_REG_MDIO_CMD_STAT, 0x3ec8);
the last tn40_write_reg (to TN40_REG_MDIO_CMD_STAT) is in fact the same as:
tn40_mdio_set_speed(priv, TN40_MDIO_SPEED_1MHZ);
Use of this function would IMHO enhance readability of the code
(obviously will need making tn40_mdio_set_speed non-static in
tn40_mdio.c and adding the function to tn40.h).
> +
> + // we use tx descriptors to load a firmware.
> + ret = tn40_create_tx_ring(priv);
> + if (ret)
> + return ret;
> + ret = tn40_fw_load(priv);
> + tn40_destroy_tx_ring(priv);
> + return ret;
> +}
> +
Powered by blists - more mailing lists