public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: michael@walle.cc
Cc: UNGLinuxDriver@microchip.com, andrew@lunn.ch,
	davem@davemloft.net, edumazet@google.com, hkallweit1@gmail.com,
	horatiu.vultur@microchip.com, kuba@kernel.org,
	linux-kernel@vger.kernel.org, linux@armlinux.org.uk,
	netdev@vger.kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net-next] net: phy: micrel: Add interrupts support for LAN8804 PHY
Date: Tue, 13 Sep 2022 11:45:08 +0200	[thread overview]
Message-ID: <20220913094508.222812-1-michael@walle.cc> (raw)
In-Reply-To: <20220913081814.212548-1-michael@walle.cc>

>> Add support for interrupts for LAN8804 PHY.
>> 
>> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
>> ---
>>  drivers/net/phy/micrel.c | 55 ++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 55 insertions(+)
>> 
>> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
>> index 7b8c5c8d013e..98e9bc101d96 100644
>> --- a/drivers/net/phy/micrel.c
>> +++ b/drivers/net/phy/micrel.c
>> @@ -2676,6 +2676,59 @@ static int lan8804_config_init(struct phy_device *phydev)
>>  	return 0;
>>  }
>>  
>> +static irqreturn_t lan8804_handle_interrupt(struct phy_device *phydev)
>> +{
>> +	int status;
>> +
>> +	status = phy_read(phydev, LAN8814_INTS);
>> +	if (status < 0) {
>> +		phy_error(phydev);
>> +		return IRQ_NONE;
>> +	}
>> +
>> +	if (status > 0)
>> +		phy_trigger_machine(phydev);
>> +
>> +	return IRQ_HANDLED;
>> +}
>> +
>> +#define LAN8804_OUTPUT_CONTROL			25
>> +#define LAN8804_OUTPUT_CONTROL_INTR_BUFFER	BIT(14)
>> +#define LAN8804_CONTROL				31
>> +#define LAN8804_CONTROL_INTR_POLARITY		BIT(14)
>> +
>> +static int lan8804_config_intr(struct phy_device *phydev)
>> +{
>> +	int err;
>> +
>> +	/* Change interrupt polarity */
>> +	phy_write(phydev, LAN8804_CONTROL, LAN8804_CONTROL_INTR_POLARITY);
>
> I assume you change the polarity to high active? Could you add a note?
> The LAN966x nor the LAN8804 datasheet describe this bit. You might also add
> a note, that this is an internal PHY and you cannot change the polarity on
> the GIC. Which begs the question, is this really only an internal PHY or
> can you actually buy it as a dedicated one. Then you'd change the polarity
> in a really unusual way.
> 
> 
> > +
> > +	/* Change interrupt buffer type */
> 
> To what? Push-pull?

Regardless of my remarks, the code itself is working fine:

Tested-by: Michael Walle <michael@walle.cc> # on kontron-kswitch-d10

-michael

> +	phy_write(phydev, LAN8804_OUTPUT_CONTROL,
> +		  LAN8804_OUTPUT_CONTROL_INTR_BUFFER);
> +


  reply	other threads:[~2022-09-13  9:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 19:56 [PATCH net-next] net: phy: micrel: Add interrupts support for LAN8804 PHY Horatiu Vultur
2022-09-12 21:13 ` Andrew Lunn
2022-09-13  8:18 ` Michael Walle
2022-09-13  9:45   ` Michael Walle [this message]
2022-09-13 12:23   ` Horatiu Vultur

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=20220913094508.222812-1-michael@walle.cc \
    --to=michael@walle.cc \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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