mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: mani@kernel.org, thomas.kopp@microchip.com, mailhol@kernel.org,
	robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	andersson@kernel.org, konradybcio@kernel.org,
	linux-can@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	mukesh.savaliya@oss.qualcomm.com, anup.kulkarni@oss.qualcomm.com
Subject: Re: [PATCH v2 2/3] can: mcp251xfd: add support for XSTBYEN transceiver standby control
Date: Fri, 20 Mar 2026 16:36:59 +0530	[thread overview]
Message-ID: <aaeda234-3f14-4007-b0af-e876c064796e@oss.qualcomm.com> (raw)
In-Reply-To: <20260316-fossa-of-extreme-cookies-9c5c40-mkl@pengutronix.de>



On 3/16/2026 7:21 PM, Marc Kleine-Budde wrote:
> On 16.03.2026 18:49:49, Viken Dadhaniya wrote:
>> The MCP251xFD has a dedicated transceiver standby control function on
>> the INT0/GPIO0/XSTBY pin, controlled by the XSTBYEN bit in IOCON.
> 
> Please add a check to mcp251xfd_gpio_request() that GPIO0 cannot be used
> with xstbyen.

Sure, Will update in next patch.

> 
>> When enabled, the hardware automatically manages the transceiver
>> standby state: the pin is driven low when the controller is active
>> and high when it enters Sleep mode.
>>
>> Enable this feature when the 'microchip,xstbyen' device tree property
>> is present.
>>
>> Signed-off-by: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
>> ---
>>  .../net/can/spi/mcp251xfd/mcp251xfd-core.c    | 30 +++++++++++++++++++
>>  drivers/net/can/spi/mcp251xfd/mcp251xfd.h     |  1 +
>>  2 files changed, 31 insertions(+)
>>
>> diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
>> index 9c86df08c2c5..7a152acf4931 100644
>> --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
>> +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
>> @@ -764,6 +764,29 @@ static void mcp251xfd_chip_stop(struct mcp251xfd_priv *priv,
>>  	mcp251xfd_chip_set_mode(priv, MCP251XFD_REG_CON_MODE_CONFIG);
>>  }
>>
>> +static int mcp251xfd_chip_xstbyen_enable(const struct mcp251xfd_priv *priv)
>> +{
>> +	/* Configure the INT0/GPIO0/XSTBY pin as transceiver standby control:
>> +	 *
>> +	 * - XSTBYEN=1: route the pin to the transceiver standby function
>> +	 * - TRIS0=0:   set output direction; the reset default is 1 (input),
>> +	 *              which leaves the pin floating HIGH and keeps the
>> +	 *              transceiver in standby regardless of XSTBYEN
>> +	 * - LAT0=0:    drive pin LOW => transceiver active (not in standby)
>> +	 *
>> +	 * All three bits are included in the mask; only XSTBYEN is set in
>> +	 * val, so TRIS0 and LAT0 are cleared to 0 atomically.
>> +	 *
>> +	 * Once configured, the hardware automatically drives the pin HIGH
>> +	 * on Sleep mode entry and LOW on Sleep mode exit.
>> +	 */
> 
> What does the pin do in Config mode?

In Config mode, the pin is controlled by LAT0. Since we set LAT0=0,
the pin is LOW (transceiver active), ensuring the transceiver is
ready before entering Normal mode.

> 
>> +	return regmap_update_bits(priv->map_reg, MCP251XFD_REG_IOCON,
>> +				  MCP251XFD_REG_IOCON_XSTBYEN |
>> +				  MCP251XFD_REG_IOCON_TRIS0 |
>> +				  MCP251XFD_REG_IOCON_LAT0,
>> +				  MCP251XFD_REG_IOCON_XSTBYEN);
>> +}
>> +
>>  static int mcp251xfd_chip_start(struct mcp251xfd_priv *priv)
>>  {
>>  	int err;
>> @@ -800,6 +823,12 @@ static int mcp251xfd_chip_start(struct mcp251xfd_priv *priv)
>>  	if (err)
>>  		goto out_chip_stop;
>>
>> +	if (priv->xstbyen) {
>> +		err = mcp251xfd_chip_xstbyen_enable(priv);
>> +		if (err)
>> +			goto out_chip_stop;
>> +	}
>> +
> 
> You should configure the pin before bringing the controller into normale mode.

Sure, Will update in next patch.

> 
> regards,
> Marc
> 

  reply	other threads:[~2026-03-20 11:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 13:19 [PATCH v2 0/3] can: mcp251xfd: add " Viken Dadhaniya
2026-03-16 13:19 ` [PATCH v2 1/3] dt-bindings: can: mcp251xfd: add microchip,xstbyen property Viken Dadhaniya
2026-03-16 13:19 ` [PATCH v2 2/3] can: mcp251xfd: add support for XSTBYEN transceiver standby control Viken Dadhaniya
2026-03-16 13:51   ` Marc Kleine-Budde
2026-03-20 11:06     ` Viken Dadhaniya [this message]
2026-03-16 13:19 ` [PATCH v2 3/3] arm64: dts: qcom: qcs6490-rb3gen2: Enable CAN bus controller Viken Dadhaniya
2026-03-16 13:29   ` Marc Kleine-Budde
2026-03-20 13:18     ` Viken Dadhaniya
2026-03-18 12:13   ` Konrad Dybcio

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=aaeda234-3f14-4007-b0af-e876c064796e@oss.qualcomm.com \
    --to=viken.dadhaniya@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=anup.kulkarni@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mani@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=mukesh.savaliya@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=thomas.kopp@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®