Patchwork [U-Boot] Add support for KSZ8895 switch

login
register
mail settings
Submitter Christian Gmeiner
Date Aug. 12, 2013, 2:48 p.m.
Message ID <1376318914-11798-1-git-send-email-christian.gmeiner@gmail.com>
Download mbox | patch
Permalink /patch/266558/
State Superseded
Delegated to: Joe Hershberger
Headers show

Comments

Christian Gmeiner - Aug. 12, 2013, 2:48 p.m.
This patch adds a dump phy driver for the KSZ8895 switch from
Micrel. As the SoC MAC is directly connected to switch no
autonegotiation is needed as the link is always up.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 drivers/net/phy/micrel.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
Christian Gmeiner - Aug. 19, 2013, 6:35 p.m.
Am 12.08.2013 16:48 schrieb "Christian Gmeiner" <christian.gmeiner@gmail.com
>:
>
> This patch adds a dump phy driver for the KSZ8895 switch from
> Micrel. As the SoC MAC is directly connected to switch no
> autonegotiation is needed as the link is always up.
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>  drivers/net/phy/micrel.c |   31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index aa9cbcf..76d6846 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -36,6 +36,36 @@ static struct phy_driver KSZ804_driver = {
>         .shutdown = &genphy_shutdown,
>  };
>
> +/**
> + * KSZ8895
> + */
> +
> +int ksz8895_config(struct phy_device *phydev)
> +{
> +       /* we are connected directly to the switch without
> +        * dedicated PHY. SCONF1 == 001 */
> +       phydev->link = 1;
> +       phydev->duplex = DUPLEX_FULL;
> +       phydev->speed = SPEED_100;
> +
> +       return 0;
> +}
> +
> +static int ksz8895_startup(struct phy_device *phydev)
> +{
> +       return 0;
> +}
> +
> +static struct phy_driver ksz8895_driver = {
> +       .name = "Micrel KSZ8895/KSZ8864",
> +       .uid  = 0x221450,
> +       .mask = 0xffffe1,
> +       .features = PHY_BASIC_FEATURES,
> +       .config   = &ksz8895_config,
> +       .startup  = &ksz8895_startup,
> +       .shutdown = &genphy_shutdown,
> +};
> +
>  #ifndef CONFIG_PHY_MICREL_KSZ9021
>  /*
>   * I can't believe Micrel used the exact same part number
> @@ -204,5 +234,6 @@ int phy_micrel_init(void)
>         phy_register(&KS8721_driver);
>  #endif
>         phy_register(&ksz9031_driver);
> +       phy_register(&ksz8895_driver);
>         return 0;
>  }
> --
> 1.7.10.4
>

Any comments?
Christian Gmeiner - Aug. 21, 2013, 10:26 a.m.
>>
>> This patch adds a dump phy driver for the KSZ8895 switch from
>> Micrel. As the SoC MAC is directly connected to switch no
>> autonegotiation is needed as the link is always up.
>>
>> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
>> ---
>>  drivers/net/phy/micrel.c |   31 +++++++++++++++++++++++++++++++
>>  1 file changed, 31 insertions(+)
>>
>> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
>> index aa9cbcf..76d6846 100644
>> --- a/drivers/net/phy/micrel.c
>> +++ b/drivers/net/phy/micrel.c
>> @@ -36,6 +36,36 @@ static struct phy_driver KSZ804_driver = {
>>         .shutdown = &genphy_shutdown,
>>  };
>>
>> +/**
>> + * KSZ8895
>> + */
>> +
>> +int ksz8895_config(struct phy_device *phydev)
>> +{
>> +       /* we are connected directly to the switch without
>> +        * dedicated PHY. SCONF1 == 001 */
>> +       phydev->link = 1;
>> +       phydev->duplex = DUPLEX_FULL;
>> +       phydev->speed = SPEED_100;
>> +
>> +       return 0;
>> +}
>> +
>> +static int ksz8895_startup(struct phy_device *phydev)
>> +{
>> +       return 0;
>> +}
>> +
>> +static struct phy_driver ksz8895_driver = {
>> +       .name = "Micrel KSZ8895/KSZ8864",
>> +       .uid  = 0x221450,
>> +       .mask = 0xffffe1,
>> +       .features = PHY_BASIC_FEATURES,
>> +       .config   = &ksz8895_config,
>> +       .startup  = &ksz8895_startup,
>> +       .shutdown = &genphy_shutdown,
>> +};
>> +
>>  #ifndef CONFIG_PHY_MICREL_KSZ9021
>>  /*
>>   * I can't believe Micrel used the exact same part number
>> @@ -204,5 +234,6 @@ int phy_micrel_init(void)
>>         phy_register(&KS8721_driver);
>>  #endif
>>         phy_register(&ksz9031_driver);
>> +       phy_register(&ksz8895_driver);
>>         return 0;
>>  }
>> --
>> 1.7.10.4
>>
>
> Any comments?

Maybe it would be better to add a generic fixed-link phy driver to u-boot.

--
Christian Gmeiner, MSc

Patch

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index aa9cbcf..76d6846 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -36,6 +36,36 @@  static struct phy_driver KSZ804_driver = {
 	.shutdown = &genphy_shutdown,
 };
 
+/**
+ * KSZ8895
+ */
+
+int ksz8895_config(struct phy_device *phydev)
+{
+	/* we are connected directly to the switch without
+	 * dedicated PHY. SCONF1 == 001 */
+	phydev->link = 1;
+	phydev->duplex = DUPLEX_FULL;
+	phydev->speed = SPEED_100;
+
+	return 0;
+}
+
+static int ksz8895_startup(struct phy_device *phydev)
+{
+	return 0;
+}
+
+static struct phy_driver ksz8895_driver = {
+	.name = "Micrel KSZ8895/KSZ8864",
+	.uid  = 0x221450,
+	.mask = 0xffffe1,
+	.features = PHY_BASIC_FEATURES,
+	.config   = &ksz8895_config,
+	.startup  = &ksz8895_startup,
+	.shutdown = &genphy_shutdown,
+};
+
 #ifndef CONFIG_PHY_MICREL_KSZ9021
 /*
  * I can't believe Micrel used the exact same part number
@@ -204,5 +234,6 @@  int phy_micrel_init(void)
 	phy_register(&KS8721_driver);
 #endif
 	phy_register(&ksz9031_driver);
+	phy_register(&ksz8895_driver);
 	return 0;
 }