All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] net: ftmac100: change driver name from nds32_mac to ftmac100
@ 2023-01-19 19:51 Sergei Antonov
  2023-01-19 19:51 ` [PATCH v2 2/3] net: ftmac100: simplify priv->iobase casting Sergei Antonov
  2023-01-19 19:51 ` [PATCH v2 3/3] net: ftmac100: add mii read and write callbacks Sergei Antonov
  0 siblings, 2 replies; 6+ messages in thread
From: Sergei Antonov @ 2023-01-19 19:51 UTC (permalink / raw)
  To: u-boot, joe.hershberger, rfried.dev; +Cc: bmeng.cn, Sergei Antonov

So it will be named similarly to the related ftgmac100 driver.
The old name 'nds32_mac' is not referred to anywhere in U-Boot.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
---

v1 -> v2:
no change

 drivers/net/ftmac100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index c30ace96bb13..b3da9479ea5e 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -434,7 +434,7 @@ static const struct udevice_id ftmac100_ids[] = {
 };
 
 U_BOOT_DRIVER(ftmac100) = {
-	.name	= "nds32_mac",
+	.name	= "ftmac100",
 	.id	= UCLASS_ETH,
 	.of_match = ftmac100_ids,
 	.bind	= ftmac100_bind,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] net: ftmac100: simplify priv->iobase casting
  2023-01-19 19:51 [PATCH v2 1/3] net: ftmac100: change driver name from nds32_mac to ftmac100 Sergei Antonov
@ 2023-01-19 19:51 ` Sergei Antonov
  2023-02-02 22:05   ` Tom Rini
  2023-01-19 19:51 ` [PATCH v2 3/3] net: ftmac100: add mii read and write callbacks Sergei Antonov
  1 sibling, 1 reply; 6+ messages in thread
From: Sergei Antonov @ 2023-01-19 19:51 UTC (permalink / raw)
  To: u-boot, joe.hershberger, rfried.dev; +Cc: bmeng.cn, Sergei Antonov

Replace 'phys_addr_t iobase' with 'struct ftmac100 *ftmac100'
in order to cast once on assignment and remove casting in a
number of other places.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
---

v1 -> v2:
no change

 drivers/net/ftmac100.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index b3da9479ea5e..bb39e837bbe7 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -28,7 +28,7 @@ struct ftmac100_data {
 	struct ftmac100_rxdes rxdes[PKTBUFSRX];
 	int rx_index;
 	const char *name;
-	phys_addr_t iobase;
+	struct ftmac100 *ftmac100;
 };
 
 /*
@@ -36,7 +36,7 @@ struct ftmac100_data {
  */
 static void ftmac100_reset(struct ftmac100_data *priv)
 {
-	struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
+	struct ftmac100 *ftmac100 = priv->ftmac100;
 
 	debug ("%s()\n", __func__);
 
@@ -57,7 +57,7 @@ static void ftmac100_reset(struct ftmac100_data *priv)
 static void ftmac100_set_mac(struct ftmac100_data *priv ,
 	const unsigned char *mac)
 {
-	struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
+	struct ftmac100 *ftmac100 = priv->ftmac100;
 	unsigned int maddr = mac[0] << 8 | mac[1];
 	unsigned int laddr = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5];
 
@@ -72,7 +72,7 @@ static void ftmac100_set_mac(struct ftmac100_data *priv ,
  */
 static void _ftmac100_halt(struct ftmac100_data *priv)
 {
-	struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
+	struct ftmac100 *ftmac100 = priv->ftmac100;
 	debug ("%s()\n", __func__);
 	writel (0, &ftmac100->maccr);
 }
@@ -82,7 +82,7 @@ static void _ftmac100_halt(struct ftmac100_data *priv)
  */
 static int _ftmac100_init(struct ftmac100_data *priv, unsigned char enetaddr[6])
 {
-	struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
+	struct ftmac100 *ftmac100 = priv->ftmac100;
 	struct ftmac100_txdes *txdes = priv->txdes;
 	struct ftmac100_rxdes *rxdes = priv->rxdes;
 	unsigned int maccr;
@@ -187,7 +187,7 @@ static int __ftmac100_recv(struct ftmac100_data *priv)
  */
 static int _ftmac100_send(struct ftmac100_data *priv, void *packet, int length)
 {
-	struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
+	struct ftmac100 *ftmac100 = priv->ftmac100;
 	struct ftmac100_txdes *curr_des = priv->txdes;
 	ulong start;
 
@@ -400,7 +400,7 @@ static int ftmac100_of_to_plat(struct udevice *dev)
 	struct eth_pdata *pdata = dev_get_plat(dev);
 	const char *mac;
 	pdata->iobase = dev_read_addr(dev);
-	priv->iobase = pdata->iobase;
+	priv->ftmac100 = (struct ftmac100 *)pdata->iobase;
 	mac = dtbmacaddr(0);
 	if (mac)
 		memcpy(pdata->enetaddr , mac , 6);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] net: ftmac100: add mii read and write callbacks
  2023-01-19 19:51 [PATCH v2 1/3] net: ftmac100: change driver name from nds32_mac to ftmac100 Sergei Antonov
  2023-01-19 19:51 ` [PATCH v2 2/3] net: ftmac100: simplify priv->iobase casting Sergei Antonov
@ 2023-01-19 19:51 ` Sergei Antonov
  2023-02-04  0:30   ` Ramon Fried
  1 sibling, 1 reply; 6+ messages in thread
From: Sergei Antonov @ 2023-01-19 19:51 UTC (permalink / raw)
  To: u-boot, joe.hershberger, rfried.dev; +Cc: bmeng.cn, Sergei Antonov

Register mii_bus with read and write callbacks to allow the 'mii'
command to work. Use a timeout of 10 ms to wait for the R/W
operations to complete.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
---

v1 -> v2:
* fix a typo in the description
* add a dependency from MII to Kconfig
* rebase to the current master

 drivers/net/Kconfig    |   1 +
 drivers/net/ftmac100.c | 103 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/ftmac100.h |   9 ++++
 3 files changed, 113 insertions(+)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 7873538cc2df..017931956990 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -406,6 +406,7 @@ config FSL_FM_10GEC_REGULAR_NOTATION
 
 config FTMAC100
 	bool "Ftmac100 Ethernet Support"
+	select MII
 	help
 	  This MAC is present in Andestech SoCs.
 
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index cc88ea17ffe7..1cf109b278cc 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -12,9 +12,13 @@
 #include <env.h>
 #include <malloc.h>
 #include <net.h>
+#include <phy.h>
+#include <miiphy.h>
+#include <dm/device_compat.h>
 #include <asm/global_data.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/iopoll.h>
 
 #include "ftmac100.h"
 #include <dm.h>
@@ -23,12 +27,16 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define ETH_ZLEN	60
 
+/* Timeout for a mdio read/write operation */
+#define FTMAC100_MDIO_TIMEOUT_USEC     10000
+
 struct ftmac100_data {
 	struct ftmac100_txdes txdes[1];
 	struct ftmac100_rxdes rxdes[PKTBUFSRX];
 	int rx_index;
 	const char *name;
 	struct ftmac100 *ftmac100;
+	struct mii_dev *bus;
 };
 
 /*
@@ -322,10 +330,104 @@ static int ftmac100_of_to_plat(struct udevice *dev)
 	return 0;
 }
 
+/*
+ * struct mii_bus functions
+ */
+static int ftmac100_mdio_read(struct mii_dev *bus, int addr, int devad,
+			      int reg)
+{
+	struct ftmac100_data *priv = bus->priv;
+	struct ftmac100 *ftmac100 = priv->ftmac100;
+	int phycr = FTMAC100_PHYCR_PHYAD(addr) |
+		    FTMAC100_PHYCR_REGAD(reg) |
+		    FTMAC100_PHYCR_MIIRD;
+	int ret;
+
+	writel(phycr, &ftmac100->phycr);
+
+	ret = readl_poll_timeout(&ftmac100->phycr, phycr,
+				 !(phycr & FTMAC100_PHYCR_MIIRD),
+				 FTMAC100_MDIO_TIMEOUT_USEC);
+	if (ret)
+		pr_err("%s: mdio read failed (addr=0x%x reg=0x%x)\n",
+		       bus->name, addr, reg);
+	else
+		ret = phycr & FTMAC100_PHYCR_MIIRDATA;
+
+	return ret;
+}
+
+static int ftmac100_mdio_write(struct mii_dev *bus, int addr, int devad,
+			       int reg, u16 value)
+{
+	struct ftmac100_data *priv = bus->priv;
+	struct ftmac100 *ftmac100 = priv->ftmac100;
+	int phycr = FTMAC100_PHYCR_PHYAD(addr) |
+		    FTMAC100_PHYCR_REGAD(reg) |
+		    FTMAC100_PHYCR_MIIWR;
+	int ret;
+
+	writel(value, &ftmac100->phywdata);
+	writel(phycr, &ftmac100->phycr);
+
+	ret = readl_poll_timeout(&ftmac100->phycr, phycr,
+				 !(phycr & FTMAC100_PHYCR_MIIWR),
+				 FTMAC100_MDIO_TIMEOUT_USEC);
+	if (ret)
+		pr_err("%s: mdio write failed (addr=0x%x reg=0x%x)\n",
+		       bus->name, addr, reg);
+
+	return ret;
+}
+
+static int ftmac100_mdio_init(struct udevice *dev)
+{
+	struct ftmac100_data *priv = dev_get_priv(dev);
+	struct mii_dev *bus;
+	int ret;
+
+	bus = mdio_alloc();
+	if (!bus)
+		return -ENOMEM;
+
+	bus->read  = ftmac100_mdio_read;
+	bus->write = ftmac100_mdio_write;
+	bus->priv  = priv;
+
+	ret = mdio_register_seq(bus, dev_seq(dev));
+	if (ret) {
+		mdio_free(bus);
+		return ret;
+	}
+
+	priv->bus = bus;
+
+	return 0;
+}
+
 static int ftmac100_probe(struct udevice *dev)
 {
 	struct ftmac100_data *priv = dev_get_priv(dev);
 	priv->name = dev->name;
+	int ret = 0;
+
+	ret = ftmac100_mdio_init(dev);
+	if (ret) {
+		dev_err(dev, "Failed to initialize mdiobus: %d\n", ret);
+		goto out;
+	}
+
+out:
+	return ret;
+}
+
+static int ftmac100_remove(struct udevice *dev)
+{
+	struct ftmac100_data *priv = dev_get_priv(dev);
+
+	mdio_unregister(priv->bus);
+	mdio_free(priv->bus);
+
 	return 0;
 }
 
@@ -354,6 +456,7 @@ U_BOOT_DRIVER(ftmac100) = {
 	.bind	= ftmac100_bind,
 	.of_to_plat = ftmac100_of_to_plat,
 	.probe	= ftmac100_probe,
+	.remove = ftmac100_remove,
 	.ops	= &ftmac100_ops,
 	.priv_auto	= sizeof(struct ftmac100_data),
 	.plat_auto	= sizeof(struct eth_pdata),
diff --git a/drivers/net/ftmac100.h b/drivers/net/ftmac100.h
index 75a49f628a69..21d339f835bf 100644
--- a/drivers/net/ftmac100.h
+++ b/drivers/net/ftmac100.h
@@ -92,6 +92,15 @@ struct ftmac100 {
 #define FTMAC100_MACCR_RX_MULTIPKT	(1 << 16)
 #define FTMAC100_MACCR_RX_BROADPKT	(1 << 17)
 
+/*
+ * PHY control register
+ */
+#define FTMAC100_PHYCR_MIIRDATA		0xffff
+#define FTMAC100_PHYCR_PHYAD(x)		(((x) & 0x1f) << 16)
+#define FTMAC100_PHYCR_REGAD(x)		(((x) & 0x1f) << 21)
+#define FTMAC100_PHYCR_MIIWR		BIT(27)
+#define FTMAC100_PHYCR_MIIRD		BIT(26)
+
 /*
  * Transmit descriptor, aligned to 16 bytes
  */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/3] net: ftmac100: simplify priv->iobase casting
  2023-01-19 19:51 ` [PATCH v2 2/3] net: ftmac100: simplify priv->iobase casting Sergei Antonov
@ 2023-02-02 22:05   ` Tom Rini
  2023-02-03 19:09     ` Sergei Antonov
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Rini @ 2023-02-02 22:05 UTC (permalink / raw)
  To: Sergei Antonov; +Cc: u-boot, joe.hershberger, rfried.dev, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

On Thu, Jan 19, 2023 at 10:51:15PM +0300, Sergei Antonov wrote:

> Replace 'phys_addr_t iobase' with 'struct ftmac100 *ftmac100'
> in order to cast once on assignment and remove casting in a
> number of other places.
> 
> Signed-off-by: Sergei Antonov <saproj@gmail.com>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

This introduces:
   riscv32:  +   ae350_rv32
+(ae350_rv32) drivers/net/ftmac100.c: In function 'ftmac100_of_to_plat':
+(ae350_rv32) drivers/net/ftmac100.c:317:26: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
+(ae350_rv32)   317 |         priv->ftmac100 = (struct ftmac100 *)pdata->iobase;
+(ae350_rv32)       |                          ^
+(ae350_rv32) cc1: all warnings being treated as errors
+(ae350_rv32) make[3]: *** [scripts/Makefile.build:257: drivers/net/ftmac100.o] Error 1
+(ae350_rv32) make[2]: *** [scripts/Makefile.build:397: drivers/net] Error 2
+(ae350_rv32) make[1]: *** [Makefile:1857: drivers] Error 2
+(ae350_rv32) make: *** [Makefile:177: sub-make] Error 2

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/3] net: ftmac100: simplify priv->iobase casting
  2023-02-02 22:05   ` Tom Rini
@ 2023-02-03 19:09     ` Sergei Antonov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Antonov @ 2023-02-03 19:09 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, joe.hershberger, rfried.dev, bmeng.cn

On Fri, 3 Feb 2023 at 01:05, Tom Rini <trini@konsulko.com> wrote:
>
> On Thu, Jan 19, 2023 at 10:51:15PM +0300, Sergei Antonov wrote:
>
> > Replace 'phys_addr_t iobase' with 'struct ftmac100 *ftmac100'
> > in order to cast once on assignment and remove casting in a
> > number of other places.
> >
> > Signed-off-by: Sergei Antonov <saproj@gmail.com>
> > Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
>
> This introduces:
>    riscv32:  +   ae350_rv32
> +(ae350_rv32) drivers/net/ftmac100.c: In function 'ftmac100_of_to_plat':
> +(ae350_rv32) drivers/net/ftmac100.c:317:26: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> +(ae350_rv32)   317 |         priv->ftmac100 = (struct ftmac100 *)pdata->iobase;

Thanks! I have just sent a v3 of the patch in which cast is replaced
with phys_to_virt().

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 3/3] net: ftmac100: add mii read and write callbacks
  2023-01-19 19:51 ` [PATCH v2 3/3] net: ftmac100: add mii read and write callbacks Sergei Antonov
@ 2023-02-04  0:30   ` Ramon Fried
  0 siblings, 0 replies; 6+ messages in thread
From: Ramon Fried @ 2023-02-04  0:30 UTC (permalink / raw)
  To: Sergei Antonov; +Cc: u-boot, joe.hershberger, bmeng.cn

On Thu, Jan 19, 2023 at 9:51 PM Sergei Antonov <saproj@gmail.com> wrote:
>
> Register mii_bus with read and write callbacks to allow the 'mii'
> command to work. Use a timeout of 10 ms to wait for the R/W
> operations to complete.
>
> Signed-off-by: Sergei Antonov <saproj@gmail.com>
> ---
>
> v1 -> v2:
> * fix a typo in the description
> * add a dependency from MII to Kconfig
> * rebase to the current master
>
>  drivers/net/Kconfig    |   1 +
>  drivers/net/ftmac100.c | 103 +++++++++++++++++++++++++++++++++++++++++
>  drivers/net/ftmac100.h |   9 ++++
>  3 files changed, 113 insertions(+)
>
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index 7873538cc2df..017931956990 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -406,6 +406,7 @@ config FSL_FM_10GEC_REGULAR_NOTATION
>
>  config FTMAC100
>         bool "Ftmac100 Ethernet Support"
> +       select MII
>         help
>           This MAC is present in Andestech SoCs.
>
> diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
> index cc88ea17ffe7..1cf109b278cc 100644
> --- a/drivers/net/ftmac100.c
> +++ b/drivers/net/ftmac100.c
> @@ -12,9 +12,13 @@
>  #include <env.h>
>  #include <malloc.h>
>  #include <net.h>
> +#include <phy.h>
> +#include <miiphy.h>
> +#include <dm/device_compat.h>
>  #include <asm/global_data.h>
>  #include <linux/delay.h>
>  #include <linux/io.h>
> +#include <linux/iopoll.h>
>
>  #include "ftmac100.h"
>  #include <dm.h>
> @@ -23,12 +27,16 @@ DECLARE_GLOBAL_DATA_PTR;
>
>  #define ETH_ZLEN       60
>
> +/* Timeout for a mdio read/write operation */
> +#define FTMAC100_MDIO_TIMEOUT_USEC     10000
> +
>  struct ftmac100_data {
>         struct ftmac100_txdes txdes[1];
>         struct ftmac100_rxdes rxdes[PKTBUFSRX];
>         int rx_index;
>         const char *name;
>         struct ftmac100 *ftmac100;
> +       struct mii_dev *bus;
>  };
>
>  /*
> @@ -322,10 +330,104 @@ static int ftmac100_of_to_plat(struct udevice *dev)
>         return 0;
>  }
>
> +/*
> + * struct mii_bus functions
> + */
> +static int ftmac100_mdio_read(struct mii_dev *bus, int addr, int devad,
> +                             int reg)
> +{
> +       struct ftmac100_data *priv = bus->priv;
> +       struct ftmac100 *ftmac100 = priv->ftmac100;
> +       int phycr = FTMAC100_PHYCR_PHYAD(addr) |
> +                   FTMAC100_PHYCR_REGAD(reg) |
> +                   FTMAC100_PHYCR_MIIRD;
> +       int ret;
> +
> +       writel(phycr, &ftmac100->phycr);
> +
> +       ret = readl_poll_timeout(&ftmac100->phycr, phycr,
> +                                !(phycr & FTMAC100_PHYCR_MIIRD),
> +                                FTMAC100_MDIO_TIMEOUT_USEC);
> +       if (ret)
> +               pr_err("%s: mdio read failed (addr=0x%x reg=0x%x)\n",
> +                      bus->name, addr, reg);
> +       else
> +               ret = phycr & FTMAC100_PHYCR_MIIRDATA;
> +
> +       return ret;
> +}
> +
> +static int ftmac100_mdio_write(struct mii_dev *bus, int addr, int devad,
> +                              int reg, u16 value)
> +{
> +       struct ftmac100_data *priv = bus->priv;
> +       struct ftmac100 *ftmac100 = priv->ftmac100;
> +       int phycr = FTMAC100_PHYCR_PHYAD(addr) |
> +                   FTMAC100_PHYCR_REGAD(reg) |
> +                   FTMAC100_PHYCR_MIIWR;
> +       int ret;
> +
> +       writel(value, &ftmac100->phywdata);
> +       writel(phycr, &ftmac100->phycr);
> +
> +       ret = readl_poll_timeout(&ftmac100->phycr, phycr,
> +                                !(phycr & FTMAC100_PHYCR_MIIWR),
> +                                FTMAC100_MDIO_TIMEOUT_USEC);
> +       if (ret)
> +               pr_err("%s: mdio write failed (addr=0x%x reg=0x%x)\n",
> +                      bus->name, addr, reg);
> +
> +       return ret;
> +}
> +
> +static int ftmac100_mdio_init(struct udevice *dev)
> +{
> +       struct ftmac100_data *priv = dev_get_priv(dev);
> +       struct mii_dev *bus;
> +       int ret;
> +
> +       bus = mdio_alloc();
> +       if (!bus)
> +               return -ENOMEM;
> +
> +       bus->read  = ftmac100_mdio_read;
> +       bus->write = ftmac100_mdio_write;
> +       bus->priv  = priv;
> +
> +       ret = mdio_register_seq(bus, dev_seq(dev));
> +       if (ret) {
> +               mdio_free(bus);
> +               return ret;
> +       }
> +
> +       priv->bus = bus;
> +
> +       return 0;
> +}
> +
>  static int ftmac100_probe(struct udevice *dev)
>  {
>         struct ftmac100_data *priv = dev_get_priv(dev);
>         priv->name = dev->name;
> +       int ret = 0;
> +
> +       ret = ftmac100_mdio_init(dev);
> +       if (ret) {
> +               dev_err(dev, "Failed to initialize mdiobus: %d\n", ret);
> +               goto out;
> +       }
> +
> +out:
> +       return ret;
> +}
> +
> +static int ftmac100_remove(struct udevice *dev)
> +{
> +       struct ftmac100_data *priv = dev_get_priv(dev);
> +
> +       mdio_unregister(priv->bus);
> +       mdio_free(priv->bus);
> +
>         return 0;
>  }
>
> @@ -354,6 +456,7 @@ U_BOOT_DRIVER(ftmac100) = {
>         .bind   = ftmac100_bind,
>         .of_to_plat = ftmac100_of_to_plat,
>         .probe  = ftmac100_probe,
> +       .remove = ftmac100_remove,
>         .ops    = &ftmac100_ops,
>         .priv_auto      = sizeof(struct ftmac100_data),
>         .plat_auto      = sizeof(struct eth_pdata),
> diff --git a/drivers/net/ftmac100.h b/drivers/net/ftmac100.h
> index 75a49f628a69..21d339f835bf 100644
> --- a/drivers/net/ftmac100.h
> +++ b/drivers/net/ftmac100.h
> @@ -92,6 +92,15 @@ struct ftmac100 {
>  #define FTMAC100_MACCR_RX_MULTIPKT     (1 << 16)
>  #define FTMAC100_MACCR_RX_BROADPKT     (1 << 17)
>
> +/*
> + * PHY control register
> + */
> +#define FTMAC100_PHYCR_MIIRDATA                0xffff
> +#define FTMAC100_PHYCR_PHYAD(x)                (((x) & 0x1f) << 16)
> +#define FTMAC100_PHYCR_REGAD(x)                (((x) & 0x1f) << 21)
> +#define FTMAC100_PHYCR_MIIWR           BIT(27)
> +#define FTMAC100_PHYCR_MIIRD           BIT(26)
> +
>  /*
>   * Transmit descriptor, aligned to 16 bytes
>   */
> --
> 2.34.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-04  0:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 19:51 [PATCH v2 1/3] net: ftmac100: change driver name from nds32_mac to ftmac100 Sergei Antonov
2023-01-19 19:51 ` [PATCH v2 2/3] net: ftmac100: simplify priv->iobase casting Sergei Antonov
2023-02-02 22:05   ` Tom Rini
2023-02-03 19:09     ` Sergei Antonov
2023-01-19 19:51 ` [PATCH v2 3/3] net: ftmac100: add mii read and write callbacks Sergei Antonov
2023-02-04  0:30   ` Ramon Fried

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.