* [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device
@ 2023-01-17 14:16 Pavithra Sathyanarayanan
2023-01-17 14:16 ` [PATCH net-next 1/3] net: lan743x: remove unwanted interface select settings Pavithra Sathyanarayanan
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Pavithra Sathyanarayanan @ 2023-01-17 14:16 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: bryan.whitehead, UNGLinuxDriver, davem, edumazet, kuba, pabeni
This patch series includes the following changes:
- Remove the unwanted interface settings in the LAN743x driver as
it is preset in EEPROM configurations.
- Handle generic implementation for the phy interfaces for different
devices LAN7430/31 and pci11x1x.
- Add new feature for fixed_phy support at 1Gbps full duplex for the
LAN7431 device if a phy not found over MDIO. Includes support for
communication between a MAC in a LAN7431 device and custom phys
without an MDIO interface.
Pavithra Sathyanarayanan (3):
net: lan743x: remove unwanted interface select settings
net: lan743x: add generic implementation for phy interface selection
net: lan743x: add fixed phy support for LAN7431 device
drivers/net/ethernet/microchip/lan743x_main.c | 59 +++++++++++++------
drivers/net/ethernet/microchip/lan743x_main.h | 1 +
2 files changed, 42 insertions(+), 18 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 1/3] net: lan743x: remove unwanted interface select settings
2023-01-17 14:16 [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device Pavithra Sathyanarayanan
@ 2023-01-17 14:16 ` Pavithra Sathyanarayanan
2023-01-17 14:16 ` [PATCH net-next 2/3] net: lan743x: add generic implementation for phy interface selection Pavithra Sathyanarayanan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Pavithra Sathyanarayanan @ 2023-01-17 14:16 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: bryan.whitehead, UNGLinuxDriver, davem, edumazet, kuba, pabeni
Remove the MII/RGMII Selection settings in driver as it is preset
by the EEPROM and has the required configurations before the driver
loads for LAN743x.
Signed-off-by: Pavithra Sathyanarayanan <Pavithra.Sathyanarayanan@microchip.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index e205edf477de..c4d16f4654b5 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1418,14 +1418,6 @@ static void lan743x_phy_link_status_change(struct net_device *netdev)
data = lan743x_csr_read(adapter, MAC_CR);
- /* set interface mode */
- if (phy_interface_is_rgmii(phydev))
- /* RGMII */
- data &= ~MAC_CR_MII_EN_;
- else
- /* GMII */
- data |= MAC_CR_MII_EN_;
-
/* set duplex mode */
if (phydev->duplex)
data |= MAC_CR_DPX_;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/3] net: lan743x: add generic implementation for phy interface selection
2023-01-17 14:16 [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device Pavithra Sathyanarayanan
2023-01-17 14:16 ` [PATCH net-next 1/3] net: lan743x: remove unwanted interface select settings Pavithra Sathyanarayanan
@ 2023-01-17 14:16 ` Pavithra Sathyanarayanan
2023-01-17 14:16 ` [PATCH net-next 3/3] net: lan743x: add fixed phy support for LAN7431 device Pavithra Sathyanarayanan
2023-01-19 13:00 ` [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Pavithra Sathyanarayanan @ 2023-01-17 14:16 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: bryan.whitehead, UNGLinuxDriver, davem, edumazet, kuba, pabeni
Add logic to read the Phy interface from MAC_CR register for LAN743x
driver.
Checks for the LAN7430/31 or pci11x1x devices and the adapter
interface is updated accordingly. For LAN7431, adapter interface is set
based on Bit 19 of MAC_CR register as MII or RGMII which removes the
forced RGMII/GMII configurations in lan743x_phy_open().
Signed-off-by: Pavithra Sathyanarayanan <Pavithra.Sathyanarayanan@microchip.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 31 ++++++++++++++-----
drivers/net/ethernet/microchip/lan743x_main.h | 1 +
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index c4d16f4654b5..fe3026ed6f03 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1469,6 +1469,24 @@ static void lan743x_phy_close(struct lan743x_adapter *adapter)
netdev->phydev = NULL;
}
+static void lan743x_phy_interface_select(struct lan743x_adapter *adapter)
+{
+ u32 id_rev;
+ u32 data;
+
+ data = lan743x_csr_read(adapter, MAC_CR);
+ id_rev = adapter->csr.id_rev & ID_REV_ID_MASK_;
+
+ if (adapter->is_pci11x1x && adapter->is_sgmii_en)
+ adapter->phy_interface = PHY_INTERFACE_MODE_SGMII;
+ else if (id_rev == ID_REV_ID_LAN7430_)
+ adapter->phy_interface = PHY_INTERFACE_MODE_GMII;
+ else if ((id_rev == ID_REV_ID_LAN7431_) && (data & MAC_CR_MII_EN_))
+ adapter->phy_interface = PHY_INTERFACE_MODE_MII;
+ else
+ adapter->phy_interface = PHY_INTERFACE_MODE_RGMII;
+}
+
static int lan743x_phy_open(struct lan743x_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
@@ -1486,14 +1504,11 @@ static int lan743x_phy_open(struct lan743x_adapter *adapter)
if (!phydev)
goto return_error;
- if (adapter->is_pci11x1x)
- ret = phy_connect_direct(netdev, phydev,
- lan743x_phy_link_status_change,
- PHY_INTERFACE_MODE_RGMII);
- else
- ret = phy_connect_direct(netdev, phydev,
- lan743x_phy_link_status_change,
- PHY_INTERFACE_MODE_GMII);
+ lan743x_phy_interface_select(adapter);
+
+ ret = phy_connect_direct(netdev, phydev,
+ lan743x_phy_link_status_change,
+ adapter->phy_interface);
if (ret)
goto return_error;
}
diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
index 8438c3dbcf36..52609fc13ad9 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.h
+++ b/drivers/net/ethernet/microchip/lan743x_main.h
@@ -1042,6 +1042,7 @@ struct lan743x_adapter {
#define LAN743X_ADAPTER_FLAG_OTP BIT(0)
u32 flags;
u32 hw_cfg;
+ phy_interface_t phy_interface;
};
#define LAN743X_COMPONENT_FLAG_RX(channel) BIT(20 + (channel))
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 3/3] net: lan743x: add fixed phy support for LAN7431 device
2023-01-17 14:16 [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device Pavithra Sathyanarayanan
2023-01-17 14:16 ` [PATCH net-next 1/3] net: lan743x: remove unwanted interface select settings Pavithra Sathyanarayanan
2023-01-17 14:16 ` [PATCH net-next 2/3] net: lan743x: add generic implementation for phy interface selection Pavithra Sathyanarayanan
@ 2023-01-17 14:16 ` Pavithra Sathyanarayanan
2023-01-19 13:00 ` [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Pavithra Sathyanarayanan @ 2023-01-17 14:16 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: bryan.whitehead, UNGLinuxDriver, davem, edumazet, kuba, pabeni
Add fixed_phy support at 1Gbps full duplex for the lan7431 device
if a phy not found over MDIO. Tested with a MAC to MAC connection
from LAN7431 to a KSZ9893 switch. This avoids the Driver open error
in LAN743x. TX delay and internal CLK125 generation is already
enabled in EEPROM.
Signed-off-by: Pavithra Sathyanarayanan <Pavithra.Sathyanarayanan@microchip.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index fe3026ed6f03..b5add1c5fa06 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1491,6 +1491,11 @@ static int lan743x_phy_open(struct lan743x_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
struct lan743x_phy *phy = &adapter->phy;
+ struct fixed_phy_status fphy_status = {
+ .link = 1,
+ .speed = SPEED_1000,
+ .duplex = DUPLEX_FULL,
+ };
struct phy_device *phydev;
int ret = -EIO;
@@ -1501,8 +1506,19 @@ static int lan743x_phy_open(struct lan743x_adapter *adapter)
if (!phydev) {
/* try internal phy */
phydev = phy_find_first(adapter->mdiobus);
- if (!phydev)
- goto return_error;
+ if (!phydev) {
+ if ((adapter->csr.id_rev & ID_REV_ID_MASK_) ==
+ ID_REV_ID_LAN7431_) {
+ phydev = fixed_phy_register(PHY_POLL,
+ &fphy_status, NULL);
+ if (IS_ERR(phydev)) {
+ netdev_err(netdev, "No PHY/fixed_PHY found\n");
+ return -EIO;
+ }
+ } else {
+ goto return_error;
+ }
+ }
lan743x_phy_interface_select(adapter);
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device
2023-01-17 14:16 [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device Pavithra Sathyanarayanan
` (2 preceding siblings ...)
2023-01-17 14:16 ` [PATCH net-next 3/3] net: lan743x: add fixed phy support for LAN7431 device Pavithra Sathyanarayanan
@ 2023-01-19 13:00 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-19 13:00 UTC (permalink / raw)
To: Pavithra Sathyanarayanan
Cc: netdev, linux-kernel, bryan.whitehead, UNGLinuxDriver, davem,
edumazet, kuba, pabeni
Hello:
This series was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 17 Jan 2023 19:46:11 +0530 you wrote:
> This patch series includes the following changes:
>
> - Remove the unwanted interface settings in the LAN743x driver as
> it is preset in EEPROM configurations.
>
> - Handle generic implementation for the phy interfaces for different
> devices LAN7430/31 and pci11x1x.
>
> [...]
Here is the summary with links:
- [net-next,1/3] net: lan743x: remove unwanted interface select settings
https://git.kernel.org/netdev/net-next/c/1c9bb4429009
- [net-next,2/3] net: lan743x: add generic implementation for phy interface selection
https://git.kernel.org/netdev/net-next/c/e86c721090e3
- [net-next,3/3] net: lan743x: add fixed phy support for LAN7431 device
https://git.kernel.org/netdev/net-next/c/624864fbff92
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-19 13:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-17 14:16 [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device Pavithra Sathyanarayanan
2023-01-17 14:16 ` [PATCH net-next 1/3] net: lan743x: remove unwanted interface select settings Pavithra Sathyanarayanan
2023-01-17 14:16 ` [PATCH net-next 2/3] net: lan743x: add generic implementation for phy interface selection Pavithra Sathyanarayanan
2023-01-17 14:16 ` [PATCH net-next 3/3] net: lan743x: add fixed phy support for LAN7431 device Pavithra Sathyanarayanan
2023-01-19 13:00 ` [PATCH net-next 0/3] generic implementation of phy interface and fixed_phy support for the LAN743x device patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox