diff mbox series

[v2,3/5] net: sun8i-emac: Add a flag for the internal PHY switch

Message ID 20230122225107.62464-4-samuel@sholland.org
State Accepted
Commit 0e148342f764dad64bbb6ce40d92262e5f436c64
Delegated to: Andre Przywara
Headers show
Series net: sun8i-emac: Allwinner D1 Support | expand

Commit Message

Samuel Holland Jan. 22, 2023, 10:51 p.m. UTC
Describe this feature instead of using the SoC ID.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

Changes in v2:
 - New patch for v2

 drivers/net/sun8i_emac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Andre Przywara Jan. 23, 2023, 5:23 p.m. UTC | #1
On 22/01/2023 22:51, Samuel Holland wrote:
> Describe this feature instead of using the SoC ID.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>
> Changes in v2:
>   - New patch for v2
>
>   drivers/net/sun8i_emac.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
> index f232b8f087..36cc2498b5 100644
> --- a/drivers/net/sun8i_emac.c
> +++ b/drivers/net/sun8i_emac.c
> @@ -137,6 +137,7 @@ enum emac_variant_id {
>
>   struct emac_variant {
>       enum emac_variant_id    variant;
> +     bool                    soc_has_internal_phy;
>       bool                    support_rmii;
>   };
>
> @@ -860,7 +861,7 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev)
>       if (pdata->phy_interface == PHY_INTERFACE_MODE_NA)
>               return -EINVAL;
>
> -     if (priv->variant->variant == H3_EMAC) {
> +     if (priv->variant->soc_has_internal_phy) {
>               ret = sun8i_handle_internal_phy(dev, priv);
>               if (ret)
>                       return ret;
> @@ -906,6 +907,7 @@ static const struct emac_variant emac_variant_a83t = {
>
>   static const struct emac_variant emac_variant_h3 = {
>       .variant                = H3_EMAC,
> +     .soc_has_internal_phy   = true,
>       .support_rmii           = true,
>   };
>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Ramon Fried Feb. 4, 2023, 12:37 a.m. UTC | #2
On Mon, Jan 23, 2023 at 7:24 PM Andre Przywara <andre.przywara@arm.com> wrote:
>
> On 22/01/2023 22:51, Samuel Holland wrote:
> > Describe this feature instead of using the SoC ID.
> >
> > Signed-off-by: Samuel Holland <samuel@sholland.org>
>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
>
> Cheers,
> Andre
>
> > ---
> >
> > Changes in v2:
> >   - New patch for v2
> >
> >   drivers/net/sun8i_emac.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
> > index f232b8f087..36cc2498b5 100644
> > --- a/drivers/net/sun8i_emac.c
> > +++ b/drivers/net/sun8i_emac.c
> > @@ -137,6 +137,7 @@ enum emac_variant_id {
> >
> >   struct emac_variant {
> >       enum emac_variant_id    variant;
> > +     bool                    soc_has_internal_phy;
> >       bool                    support_rmii;
> >   };
> >
> > @@ -860,7 +861,7 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev)
> >       if (pdata->phy_interface == PHY_INTERFACE_MODE_NA)
> >               return -EINVAL;
> >
> > -     if (priv->variant->variant == H3_EMAC) {
> > +     if (priv->variant->soc_has_internal_phy) {
> >               ret = sun8i_handle_internal_phy(dev, priv);
> >               if (ret)
> >                       return ret;
> > @@ -906,6 +907,7 @@ static const struct emac_variant emac_variant_a83t = {
> >
> >   static const struct emac_variant emac_variant_h3 = {
> >       .variant                = H3_EMAC,
> > +     .soc_has_internal_phy   = true,
> >       .support_rmii           = true,
> >   };
> >
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index f232b8f087..36cc2498b5 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -137,6 +137,7 @@  enum emac_variant_id {
 
 struct emac_variant {
 	enum emac_variant_id	variant;
+	bool			soc_has_internal_phy;
 	bool			support_rmii;
 };
 
@@ -860,7 +861,7 @@  static int sun8i_emac_eth_of_to_plat(struct udevice *dev)
 	if (pdata->phy_interface == PHY_INTERFACE_MODE_NA)
 		return -EINVAL;
 
-	if (priv->variant->variant == H3_EMAC) {
+	if (priv->variant->soc_has_internal_phy) {
 		ret = sun8i_handle_internal_phy(dev, priv);
 		if (ret)
 			return ret;
@@ -906,6 +907,7 @@  static const struct emac_variant emac_variant_a83t = {
 
 static const struct emac_variant emac_variant_h3 = {
 	.variant		= H3_EMAC,
+	.soc_has_internal_phy	= true,
 	.support_rmii		= true,
 };