[U-Boot] [PATCH 1/2] PHY: micrel: helper function for KSZ9031

Stefano Babic sbabic at denx.de
Thu Jun 20 16:44:57 CEST 2013


Hi Joe,

On 20/06/2013 13:26, SARTRE Leo wrote:
> micrel.c: Add function ksz9031_phy_extended_write, helper to MDD
> 		  register write
> micrel.h: Prototype and define MDD registers
> 
> Signed-off-by: Leo Sartre <lsartre at adeneo-embedded.com>
> ---
>  drivers/net/phy/micrel.c |   29 +++++++++++++++++++++++++++--
>  include/micrel.h         |    7 +++++++
>  2 files changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 2a8b6cb..5b5c11b 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -85,7 +85,7 @@ static int ksz90xx_startup(struct phy_device *phydev)
>  }
>  #ifdef CONFIG_PHY_MICREL_KSZ9021
>  
> -/*
> +/**
>   * KSZ9021
>   */
>  
> @@ -148,9 +148,34 @@ static struct phy_driver ksz9021_driver = {
>  };
>  #endif
>  
> -/*
> +/**
>   * KSZ9031
>   */
> +
> +/* PHY Registers */
> +#define MII_KSZ9031_MMD_ACCES_CTRL 0x0d
> +#define MII_KSZ9031_MMD_REG_DATA   0x0e
> +
> +/* Accessors to extended registers*/
> +int ksz9031_phy_extended_write(struct phy_device *phydev,
> +							   int devaddr,
> +							   int regnum,
> +							   u16 val)
> +{
> +	/*select register addr for mmd*/
> +	phy_write(phydev, MDIO_DEVAD_NONE,
> +			 MII_KSZ9031_MMD_ACCES_CTRL, devaddr);
> +	/*select register for mmd*/
> +	phy_write(phydev, MDIO_DEVAD_NONE,
> +			 MII_KSZ9031_MMD_REG_DATA, regnum);
> +	/*setup mode*/
> +	phy_write(phydev, MDIO_DEVAD_NONE,
> +			 MII_KSZ9031_MMD_ACCES_CTRL, (devaddr | 0xC000));
> +	/*write the value*/
> +	return phy_write(phydev, MDIO_DEVAD_NONE,
> +					 MII_KSZ9031_MMD_REG_DATA, val);
> +}
> +
>  static struct phy_driver ksz9031_driver = {
>  	.name = "Micrel ksz9031",
>  	.uid  = 0x221620,
> diff --git a/include/micrel.h b/include/micrel.h
> index 25e8a46..d63ff45 100644
> --- a/include/micrel.h
> +++ b/include/micrel.h
> @@ -9,8 +9,15 @@
>  #define MII_KSZ9021_EXT_RGMII_TX_DATA_SKEW	0x106
>  #define MII_KSZ9021_EXT_ANALOG_TEST		0x107
>  
> +#define MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW	0x4
> +#define MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW	0x5
> +#define MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW	0x6
> +#define MII_KSZ9031_EXT_RGMII_CLOCK_SKEW	0x8
> +
>  struct phy_device;
>  int ksz9021_phy_extended_write(struct phy_device *phydev, int regnum, u16 val);
>  int ksz9021_phy_extended_read(struct phy_device *phydev, int regnum);
>  
> +int ksz9031_phy_extended_write(struct phy_device *phydev, int devaddr,
> +							   int regnum, u16 val);
>  #endif
> 

This patchset belongs to two are, mainly i.MX (for Congatec) and to
Network (this patch). Can you ACK/NACK this ? I will enqueue the other
two patches in the meantime. To proceed, I propose I can merge then
whole patchset into u-boot-imx to avoid to have inconsistent trees.

Thanks,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list