All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Markus Schneider-Pargmann" <msp@baylibre.com>
To: "Parvathi Pudi" <parvathi@couthit.com>, <u-boot@lists.denx.de>,
	<trini@konsulko.com>, <Maarten.Brock@sttls.nl>,
	<kory.maincent@bootlin.com>, <msp@baylibre.com>,
	<sbellary@baylibre.com>, <romain.gantois@bootlin.com>
Cc: <pratheesh@ti.com>, <j-rameshbabu@ti.com>, <praneeth@ti.com>,
	<vigneshr@ti.com>, <srk@ti.com>, <rogerq@ti.com>,
	<danishanwar@ti.com>, <m-malladi@ti.com>, <krishna@couthit.com>,
	<mohan@couthit.com>, <pmohan@couthit.com>,
	<basharath@couthit.com>
Subject: Re: [PATCH] board: ti: am335x: Conditional MDIO PAD configuration instead of static for AM335_ICE
Date: Thu, 16 Apr 2026 09:53:37 +0200	[thread overview]
Message-ID: <DHUF0R06L66I.OSJLU3XXXRAJ@baylibre.com> (raw)
In-Reply-To: <20260407082402.2311644-1-parvathi@couthit.com>

[-- Attachment #1: Type: text/plain, Size: 3063 bytes --]

Hi Parvathi,

On Tue Apr 7, 2026 at 10:22 AM CEST, Parvathi Pudi wrote:
> This patch removes the static MDIO pinmux configuration from
> rmii1_pin_mux[] and instead configures the MDIO pins conditionally
> during board_init(). Previously, the MDIO_CLK and MDIO_DATA pins
> were always configured for CPSW in mux.c, which could lead to
> unnecessary pin ownership and conflicts in scenarios where CPSW
> is not used.
>
> With this change, the MDIO pins are configured only when required,
> ensuring that CPSW Ethernet functionality in U-Boot remains unaffected.
> This approach keeps Ethernet boot behavior intact and provides cleaner
> separation between CPSW and other Ethernet use cases.

Do you have a specific use case here?

>
> Signed-off-by: Parvathi Pudi <parvathi@couthit.com>
> ---
>  board/ti/am335x/board.c | 22 ++++++++++++++++++++++
>  board/ti/am335x/mux.c   |  2 --
>  2 files changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
> index 90e37a8d913..abeab809387 100644
> --- a/board/ti/am335x/board.c
> +++ b/board/ti/am335x/board.c
> @@ -61,6 +61,18 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define GPIO_ETH0_MODE		GPIO_TO_PIN(0, 11)
>  #define GPIO_ETH1_MODE		GPIO_TO_PIN(1, 26)
>  
> +#define AM335X_PIN_MDIO	0x948
> +#define AM335X_PIN_MDC		0x94c

These two are not aligned when applied.

> +
> +#define GPIO_MDIO_DATA		CTRL_BASE + AM335X_PIN_MDIO
> +#define GPIO_MDIO_CLK		CTRL_BASE + AM335X_PIN_MDC
> +
> +/* Enabling MDIO_DATA by setting MUX_MODE to 0, RXACTIVE, PULLUP_EN bits */
> +#define PAD_CONFIG_MDIO_DATA	0x30
> +
> +/* Enabling MDIO_CLK by setting MUX_MODE to 0, PULLUP_EN bit */
> +#define PAD_CONFIG_MDIO_CLK	0x10
> +
>  static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
>  
>  #define GPIO0_RISINGDETECT	(AM33XX_GPIO0_BASE + OMAP_GPIO_RISINGDETECT)
> @@ -779,6 +791,16 @@ int board_init(void)
>  			hang();
>  		}
>  
> +		if (!eth0_is_mii || !eth1_is_mii) {

eth0_is_mii and eth1_is_mii is the same, as it was checked in the
if condition above this one. You could make this an else if as well if
you like.

> +			/* Set the Mux Mode to MDIO_DATA */
> +			reg = readl(GPIO_MDIO_DATA);
> +			writel(reg & PAD_CONFIG_MDIO_DATA, GPIO_MDIO_DATA);
> +
> +			/* Set the Mux Mode to MDIO_CLK */

Please remove comments for code that shows the same thing.

> +			reg = readl(GPIO_MDIO_CLK);
> +			writel(reg & PAD_CONFIG_MDIO_CLK, GPIO_MDIO_CLK);

Could you do the same thing in enable_board_pin_mux()? Or would it be
possible to reuse mux.h here to avoid redefining values etc.?

Why do you use reg & PAD_CONFIG_MDIO_CLK instead of writing
PAD_CONFIG_MDIO_CLK directly and skip the read?

> +		}
> +

This snippet is in the section guarded by these:

  #if defined(CONFIG_CLOCK_SYNTHESIZER) && (!defined(CONFIG_XPL_BUILD) || \
    (defined(CONFIG_SPL_ETH) && defined(CONFIG_XPL_BUILD)))
    if (board_is_icev2()) {

Is this the same as for the original pinmux setup?

Best
Markus

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]

  reply	other threads:[~2026-04-16  7:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07  8:22 [PATCH] board: ti: am335x: Conditional MDIO PAD configuration instead of static for AM335_ICE Parvathi Pudi
2026-04-16  7:53 ` Markus Schneider-Pargmann [this message]
2026-04-17 12:06   ` Parvathi Pudi
2026-04-19 15:35     ` Markus Schneider-Pargmann
2026-04-20 13:27       ` Parvathi Pudi

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=DHUF0R06L66I.OSJLU3XXXRAJ@baylibre.com \
    --to=msp@baylibre.com \
    --cc=Maarten.Brock@sttls.nl \
    --cc=basharath@couthit.com \
    --cc=danishanwar@ti.com \
    --cc=j-rameshbabu@ti.com \
    --cc=kory.maincent@bootlin.com \
    --cc=krishna@couthit.com \
    --cc=m-malladi@ti.com \
    --cc=mohan@couthit.com \
    --cc=parvathi@couthit.com \
    --cc=pmohan@couthit.com \
    --cc=praneeth@ti.com \
    --cc=pratheesh@ti.com \
    --cc=rogerq@ti.com \
    --cc=romain.gantois@bootlin.com \
    --cc=sbellary@baylibre.com \
    --cc=srk@ti.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.