Commit 9b8fd2c9 authored by David S. Miller's avatar David S. Miller

Merge branch 'tja1103-driver'

Radu Pirea says:

====================
TJA1103 driver

This small series adds the TJA1103 PHY driver.

Changes in v3:
 - use phy_read_mmd_poll_timeout instead of spin_until_cond
 - changed the phy name from a generic one to something specific
 - minor indentation change

Changes in v2:
 - implemented genphy_c45_pma_suspend/genphy_c45_pma_suspend
 - set default internal delays set to 2ns(90 degrees)
 - added "VEND1_" prefix to the register definitions
 - disable rxid in case of txid
 - disable txid in case of rxid
 - disable internal delays in rgmii mode
 - reduced max line length to 80 characters
 - rebased on top of net-next/master
 - use genphy_c45_loopback as .set_loopback callback
 - renamed the driver from nxp-c45 to nxp-c45-tja11xx
 - used phy phy_set_bits_mmd/phy_clear_bits_mmd instead on phy_write_mmd where
 I had to set/clear one bit.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ced97eea b050f2f1
......@@ -12840,6 +12840,12 @@ F: drivers/nvmem/
F: include/linux/nvmem-consumer.h
F: include/linux/nvmem-provider.h
NXP C45 TJA11XX PHY DRIVER
M: Radu Pirea <radu-nicolae.pirea@oss.nxp.com>
L: netdev@vger.kernel.org
S: Maintained
F: drivers/net/phy/nxp-c45-tja11xx.c
NXP FSPI DRIVER
M: Ashish Kumar <ashish.kumar@nxp.com>
R: Yogesh Gaur <yogeshgaur.83@gmail.com>
......
......@@ -234,6 +234,12 @@ config NATIONAL_PHY
help
Currently supports the DP83865 PHY.
config NXP_C45_TJA11XX_PHY
tristate "NXP C45 TJA11XX PHYs"
help
Enable support for NXP C45 TJA11XX PHYs.
Currently supports only the TJA1103 PHY.
config NXP_TJA11XX_PHY
tristate "NXP TJA11xx PHYs support"
depends on HWMON
......
......@@ -71,6 +71,7 @@ obj-$(CONFIG_MICROCHIP_PHY) += microchip.o
obj-$(CONFIG_MICROCHIP_T1_PHY) += microchip_t1.o
obj-$(CONFIG_MICROSEMI_PHY) += mscc/
obj-$(CONFIG_NATIONAL_PHY) += national.o
obj-$(CONFIG_NXP_C45_TJA11XX_PHY) += nxp-c45-tja11xx.o
obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja11xx.o
obj-$(CONFIG_QSEMI_PHY) += qsemi.o
obj-$(CONFIG_REALTEK_PHY) += realtek.o
......
This diff is collapsed.
......@@ -8,6 +8,49 @@
#include <linux/mii.h>
#include <linux/phy.h>
/**
* genphy_c45_pma_can_sleep - checks if the PMA have sleep support
* @phydev: target phy_device struct
*/
static bool genphy_c45_pma_can_sleep(struct phy_device *phydev)
{
int stat1;
stat1 = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_STAT1);
if (stat1 < 0)
return false;
return !!(stat1 & MDIO_STAT1_LPOWERABLE);
}
/**
* genphy_c45_pma_resume - wakes up the PMA module
* @phydev: target phy_device struct
*/
int genphy_c45_pma_resume(struct phy_device *phydev)
{
if (!genphy_c45_pma_can_sleep(phydev))
return -EOPNOTSUPP;
return phy_clear_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1,
MDIO_CTRL1_LPOWER);
}
EXPORT_SYMBOL_GPL(genphy_c45_pma_resume);
/**
* genphy_c45_pma_suspend - suspends the PMA module
* @phydev: target phy_device struct
*/
int genphy_c45_pma_suspend(struct phy_device *phydev)
{
if (!genphy_c45_pma_can_sleep(phydev))
return -EOPNOTSUPP;
return phy_set_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1,
MDIO_CTRL1_LPOWER);
}
EXPORT_SYMBOL_GPL(genphy_c45_pma_suspend);
/**
* genphy_c45_pma_setup_forced - configures a forced speed
* @phydev: target phy_device struct
......
......@@ -1535,6 +1535,8 @@ int genphy_c45_pma_read_abilities(struct phy_device *phydev);
int genphy_c45_read_status(struct phy_device *phydev);
int genphy_c45_config_aneg(struct phy_device *phydev);
int genphy_c45_loopback(struct phy_device *phydev, bool enable);
int genphy_c45_pma_resume(struct phy_device *phydev);
int genphy_c45_pma_suspend(struct phy_device *phydev);
/* Generic C45 PHY driver */
extern struct phy_driver genphy_c45_driver;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment