mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] net: designware-imx: i.MX93: set TX_CLK in RMII mode
Date: Mon, 22 Apr 2024 14:12:00 +0200	[thread overview]
Message-ID: <ZiZUECGk10cVsnXn@pengutronix.de> (raw)
In-Reply-To: <20240417-v2024-03-0-topic-imx93-designware-imx-v1-2-c532c18f9ba5@pengutronix.de>

On Wed, Apr 17, 2024 at 11:11:26AM +0200, Steffen Trumtrar wrote:
> According to NXP AT14149 the TX_CLK direction must be set to output
> when the ENET is used in RMII mode.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
>  drivers/net/designware_imx.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/designware_imx.c b/drivers/net/designware_imx.c
> index ab60d98298..2cc707ecac 100644
> --- a/drivers/net/designware_imx.c
> +++ b/drivers/net/designware_imx.c
> @@ -26,6 +26,10 @@
>  
>  #define RMII_RESET_SPEED			(0x3 << 14)
>  
> +#define MX93_GPR_ENET_CLK_SEL_OFFSET		0x4
> +#define MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL_MASK	GENMASK(0, 0)
> +#define MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL	(0x1 << 0)

No need to define an extra _MASK for single bit fields. Just use
MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL instead.

> +
>  struct eqos_imx_soc_data {
>  	int (*set_interface_mode)(struct eqos *eqos);
>  	void (*fix_soc_reset)(struct eqos *eqos, u32 *mac_regs);
> @@ -155,6 +159,14 @@ static int eqos_imx93_set_interface_mode(struct eqos *eqos)
>  		break;
>  	case PHY_INTERFACE_MODE_RMII:
>  		val = MX93_GPR_ENET_QOS_INTF_SEL_RMII;
> +
> +		/* According to NXP AN14149, the direction of the
> +		 * TX_CLK must be set to output in RMII mode.
> +		 */
> +		regmap_update_bits(priv->intf_regmap,
> +				   priv->intf_reg_off + MX93_GPR_ENET_CLK_SEL_OFFSET,
> +				   MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL_MASK,
> +				   MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL);

I think this is ok for now as all in tree boards need this set, but what
about this comment to the corresponding kernel patch?

https://lore.kernel.org/all/f01d49cf-5955-405c-9c2b-05b0c7bb982c@armadeus.com/

Also according to the reference manual this bit is default 1 already,
how comes you have to adjust it?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2024-04-22 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17  9:11 [PATCH 0/2] net: designware-imx: fix eqos in RMII on i.MX93 Steffen Trumtrar
2024-04-17  9:11 ` [PATCH 1/2] net: designware-imx: add fix_reset callback Steffen Trumtrar
2024-04-17  9:11 ` [PATCH 2/2] net: designware-imx: i.MX93: set TX_CLK in RMII mode Steffen Trumtrar
2024-04-22 12:12   ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZiZUECGk10cVsnXn@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.trumtrar@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox