Re: [U-Boot] [PATCH v2] Add support for Microchip LAN78xx

2017-04-07 Thread Marek Vasut
On 04/07/2017 05:43 PM, yuiko.osh...@microchip.com wrote:
> From: Yuiko Oshino 
>> -Original Message-
>> From: Marek Vasut [mailto:ma...@denx.de]
>> Sent: Monday, March 27, 2017 9:30 AM
>> To: Yuiko Oshino - C18177; u-boot@lists.denx.de
>> Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>>
>> On 03/27/2017 01:59 PM, yuiko.osh...@microchip.com wrote:
>>> From: Yuiko Oshino 
 -Original Message-
 From: Marek Vasut [mailto:ma...@denx.de]
 Sent: Friday, March 24, 2017 2:29 PM
 To: Yuiko Oshino - C18177; u-boot@lists.denx.de
 Subject: Re: [PATCH v2] Add support for Microchip LAN78xx

 On 03/24/2017 07:25 PM, yuiko.osh...@microchip.com wrote:
> From: Yuiko Oshino 
>> -Original Message-
>> From: Marek Vasut [mailto:ma...@denx.de]
>> Sent: Friday, March 10, 2017 2:19 PM
>> To: Yuiko Oshino - C18177; u-boot@lists.denx.de
>> Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>>
>> On 03/10/2017 07:38 PM, yuiko.osh...@microchip.com wrote:
>>> From: Yuiko Oshino 
>>>
>>> Add support for Microchip LAN7800 and 7850, USB to 10/100/1000
>>> Ethernet Controllers
>>>
>>> Signed-off-by: Yuiko Oshino 
>>> Cc: Marek Vasut 
>>> ---
>>> Changes for v2:
>>>- lan78xx.c header comment cleanup
>>>
>
> [...]
>
>>
>> Why does a lot of this stuff look like the SMSC95xx driver ?
>> Do we even need a separate driver or can the SMSC95xx driver be
>> updated to support the LAN78xx ?
>>
>
> Marek,
> Thank you so much for your review.
> The LAN78xx's register addresses and bit definitions are not
> compatible to
 our old part LAN95xx (==SMSC95xx).
> The new devices LAN78xx and LAN75xx device have similarities. I plan
> to
 support these two devices in this driver.
> I will take care of all your comments and will submit a new PATCH
> with a file
 name change to lan7x.c.
>

 Is the rename really mandatory ?

>>> Yes, if we are going to make one file that supports both LAN78xx and
>> LAN75xx, it's very important for us to make the driver file name to support
>> both devices.
>>
>> The filename has nothing to do with which chips are supported though ?
>>
 Then again, I looked into Linux and that one has two separate drivers .
 So I wonder if it's really a good idea. Maybe we can share some
 common code and have the rest separate ?
>>>
>>> Marek,
>>> 1. we can submit LAN78xx and LA75xx drivers separately like in Linux. We do
>> prefer this option.
>>> 2. we can submit one LAN7x.c that supports both LAN78xx and LAN75xx in
>> one file.
>>> Could you pick one?
>>
>> Can we have option 3 -- pull common code into some file and make both
>> drivers use the common code ?
> 
> Hi Marek,

Hi Yuiko,

> Sure, we will do the option 3 with lan75xx.c, lan78xx.c, lan7xc, and lan7x.h 
> as you like.

Well don't you think this makes sense from the code reuse perspective ?

> Should I keep this thread and make [PATCH v3] Add support for Microchip 
> LAN78xx to submit?
> Even though the new patch will also include LAN75xx as well?

That's fine

> Or new thread and include the LAN75xx in the title?

New thread please. I think it'll be more patches and there'll be some
refactoring first anyway.

> Please let me know.
> 
> Thank you again!

Thanks for keeping up the good work !

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] Add support for Microchip LAN78xx

2017-04-07 Thread Yuiko.Oshino
From: Yuiko Oshino 
>-Original Message-
>From: Marek Vasut [mailto:ma...@denx.de]
>Sent: Monday, March 27, 2017 9:30 AM
>To: Yuiko Oshino - C18177; u-boot@lists.denx.de
>Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>
>On 03/27/2017 01:59 PM, yuiko.osh...@microchip.com wrote:
>> From: Yuiko Oshino 
>>> -Original Message-
>>> From: Marek Vasut [mailto:ma...@denx.de]
>>> Sent: Friday, March 24, 2017 2:29 PM
>>> To: Yuiko Oshino - C18177; u-boot@lists.denx.de
>>> Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>>>
>>> On 03/24/2017 07:25 PM, yuiko.osh...@microchip.com wrote:
 From: Yuiko Oshino 
> -Original Message-
> From: Marek Vasut [mailto:ma...@denx.de]
> Sent: Friday, March 10, 2017 2:19 PM
> To: Yuiko Oshino - C18177; u-boot@lists.denx.de
> Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>
> On 03/10/2017 07:38 PM, yuiko.osh...@microchip.com wrote:
>> From: Yuiko Oshino 
>>
>> Add support for Microchip LAN7800 and 7850, USB to 10/100/1000
>> Ethernet Controllers
>>
>> Signed-off-by: Yuiko Oshino 
>> Cc: Marek Vasut 
>> ---
>> Changes for v2:
>>- lan78xx.c header comment cleanup
>>

 [...]

>
> Why does a lot of this stuff look like the SMSC95xx driver ?
> Do we even need a separate driver or can the SMSC95xx driver be
> updated to support the LAN78xx ?
>

 Marek,
 Thank you so much for your review.
 The LAN78xx's register addresses and bit definitions are not
 compatible to
>>> our old part LAN95xx (==SMSC95xx).
 The new devices LAN78xx and LAN75xx device have similarities. I plan
 to
>>> support these two devices in this driver.
 I will take care of all your comments and will submit a new PATCH
 with a file
>>> name change to lan7x.c.

>>>
>>> Is the rename really mandatory ?
>>>
>> Yes, if we are going to make one file that supports both LAN78xx and
>LAN75xx, it's very important for us to make the driver file name to support
>both devices.
>
>The filename has nothing to do with which chips are supported though ?
>
>>> Then again, I looked into Linux and that one has two separate drivers .
>>> So I wonder if it's really a good idea. Maybe we can share some
>>> common code and have the rest separate ?
>>
>> Marek,
>> 1. we can submit LAN78xx and LA75xx drivers separately like in Linux. We do
>prefer this option.
>> 2. we can submit one LAN7x.c that supports both LAN78xx and LAN75xx in
>one file.
>> Could you pick one?
>
>Can we have option 3 -- pull common code into some file and make both
>drivers use the common code ?

Hi Marek,
Sure, we will do the option 3 with lan75xx.c, lan78xx.c, lan7xc, and lan7x.h as 
you like.

Should I keep this thread and make [PATCH v3] Add support for Microchip LAN78xx 
to submit?
Even though the new patch will also include LAN75xx as well?
Or new thread and include the LAN75xx in the title?
Please let me know.

Thank you again!
>
>> Thank you.
>> Yuiko
>>
>>>
>>> --
>>> Best regards,
>>> Marek Vasut
>
>
>--
>Best regards,
>Marek Vasut

Best regards,
Yuiko Oshino
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] Add support for Microchip LAN78xx

2017-03-27 Thread Marek Vasut
On 03/27/2017 01:59 PM, yuiko.osh...@microchip.com wrote:
> From: Yuiko Oshino 
>> -Original Message-
>> From: Marek Vasut [mailto:ma...@denx.de]
>> Sent: Friday, March 24, 2017 2:29 PM
>> To: Yuiko Oshino - C18177; u-boot@lists.denx.de
>> Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>>
>> On 03/24/2017 07:25 PM, yuiko.osh...@microchip.com wrote:
>>> From: Yuiko Oshino 
 -Original Message-
 From: Marek Vasut [mailto:ma...@denx.de]
 Sent: Friday, March 10, 2017 2:19 PM
 To: Yuiko Oshino - C18177; u-boot@lists.denx.de
 Subject: Re: [PATCH v2] Add support for Microchip LAN78xx

 On 03/10/2017 07:38 PM, yuiko.osh...@microchip.com wrote:
> From: Yuiko Oshino 
>
> Add support for Microchip LAN7800 and 7850, USB to 10/100/1000
> Ethernet Controllers
>
> Signed-off-by: Yuiko Oshino 
> Cc: Marek Vasut 
> ---
> Changes for v2:
>- lan78xx.c header comment cleanup
>
>>>
>>> [...]
>>>

 Why does a lot of this stuff look like the SMSC95xx driver ?
 Do we even need a separate driver or can the SMSC95xx driver be
 updated to support the LAN78xx ?

>>>
>>> Marek,
>>> Thank you so much for your review.
>>> The LAN78xx's register addresses and bit definitions are not compatible to
>> our old part LAN95xx (==SMSC95xx).
>>> The new devices LAN78xx and LAN75xx device have similarities. I plan to
>> support these two devices in this driver.
>>> I will take care of all your comments and will submit a new PATCH with a 
>>> file
>> name change to lan7x.c.
>>>
>>
>> Is the rename really mandatory ?
>>
> Yes, if we are going to make one file that supports both LAN78xx and LAN75xx, 
> it's very important for us to make the driver file name to support both 
> devices.

The filename has nothing to do with which chips are supported though ?

>> Then again, I looked into Linux and that one has two separate drivers .
>> So I wonder if it's really a good idea. Maybe we can share some common code
>> and have the rest separate ?
> 
> Marek,
> 1. we can submit LAN78xx and LA75xx drivers separately like in Linux. We do 
> prefer this option.
> 2. we can submit one LAN7x.c that supports both LAN78xx and LAN75xx in one 
> file.
> Could you pick one?

Can we have option 3 -- pull common code into some file and make both
drivers use the common code ?

> Thank you.
> Yuiko
> 
>>
>> --
>> Best regards,
>> Marek Vasut


-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] Add support for Microchip LAN78xx

2017-03-27 Thread Yuiko.Oshino
From: Yuiko Oshino 
>-Original Message-
>From: Marek Vasut [mailto:ma...@denx.de]
>Sent: Friday, March 24, 2017 2:29 PM
>To: Yuiko Oshino - C18177; u-boot@lists.denx.de
>Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>
>On 03/24/2017 07:25 PM, yuiko.osh...@microchip.com wrote:
>> From: Yuiko Oshino 
>>> -Original Message-
>>> From: Marek Vasut [mailto:ma...@denx.de]
>>> Sent: Friday, March 10, 2017 2:19 PM
>>> To: Yuiko Oshino - C18177; u-boot@lists.denx.de
>>> Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>>>
>>> On 03/10/2017 07:38 PM, yuiko.osh...@microchip.com wrote:
 From: Yuiko Oshino 

 Add support for Microchip LAN7800 and 7850, USB to 10/100/1000
 Ethernet Controllers

 Signed-off-by: Yuiko Oshino 
 Cc: Marek Vasut 
 ---
 Changes for v2:
- lan78xx.c header comment cleanup

>>
>> [...]
>>
>>>
>>> Why does a lot of this stuff look like the SMSC95xx driver ?
>>> Do we even need a separate driver or can the SMSC95xx driver be
>>> updated to support the LAN78xx ?
>>>
>>
>> Marek,
>> Thank you so much for your review.
>> The LAN78xx's register addresses and bit definitions are not compatible to
>our old part LAN95xx (==SMSC95xx).
>> The new devices LAN78xx and LAN75xx device have similarities. I plan to
>support these two devices in this driver.
>> I will take care of all your comments and will submit a new PATCH with a file
>name change to lan7x.c.
>>
>
>Is the rename really mandatory ?
>
Yes, if we are going to make one file that supports both LAN78xx and LAN75xx, 
it's very important for us to make the driver file name to support both devices.

>Then again, I looked into Linux and that one has two separate drivers .
>So I wonder if it's really a good idea. Maybe we can share some common code
>and have the rest separate ?

Marek,
1. we can submit LAN78xx and LA75xx drivers separately like in Linux. We do 
prefer this option.
2. we can submit one LAN7x.c that supports both LAN78xx and LAN75xx in one file.
Could you pick one?
Thank you.
Yuiko

>
>--
>Best regards,
>Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] Add support for Microchip LAN78xx

2017-03-24 Thread Marek Vasut
On 03/24/2017 07:25 PM, yuiko.osh...@microchip.com wrote:
> From: Yuiko Oshino 
>> -Original Message-
>> From: Marek Vasut [mailto:ma...@denx.de]
>> Sent: Friday, March 10, 2017 2:19 PM
>> To: Yuiko Oshino - C18177; u-boot@lists.denx.de
>> Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>>
>> On 03/10/2017 07:38 PM, yuiko.osh...@microchip.com wrote:
>>> From: Yuiko Oshino 
>>>
>>> Add support for Microchip LAN7800 and 7850, USB to 10/100/1000
>>> Ethernet Controllers
>>>
>>> Signed-off-by: Yuiko Oshino 
>>> Cc: Marek Vasut 
>>> ---
>>> Changes for v2:
>>>- lan78xx.c header comment cleanup
>>>
> 
> [...]
> 
>>
>> Why does a lot of this stuff look like the SMSC95xx driver ?
>> Do we even need a separate driver or can the SMSC95xx driver be updated to
>> support the LAN78xx ?
>>
> 
> Marek,
> Thank you so much for your review.
> The LAN78xx's register addresses and bit definitions are not compatible to 
> our old part LAN95xx (==SMSC95xx).
> The new devices LAN78xx and LAN75xx device have similarities. I plan to 
> support these two devices in this driver.
> I will take care of all your comments and will submit a new PATCH with a file 
> name change to lan7x.c.
> 

Is the rename really mandatory ?

Then again, I looked into Linux and that one has two separate drivers .
So I wonder if it's really a good idea. Maybe we can share some common
code and have the rest separate ?

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] Add support for Microchip LAN78xx

2017-03-24 Thread Yuiko.Oshino
From: Yuiko Oshino 
>-Original Message-
>From: Marek Vasut [mailto:ma...@denx.de]
>Sent: Friday, March 10, 2017 2:19 PM
>To: Yuiko Oshino - C18177; u-boot@lists.denx.de
>Subject: Re: [PATCH v2] Add support for Microchip LAN78xx
>
>On 03/10/2017 07:38 PM, yuiko.osh...@microchip.com wrote:
>> From: Yuiko Oshino 
>>
>> Add support for Microchip LAN7800 and 7850, USB to 10/100/1000
>> Ethernet Controllers
>>
>> Signed-off-by: Yuiko Oshino 
>> Cc: Marek Vasut 
>> ---
>> Changes for v2:
>>- lan78xx.c header comment cleanup
>>

[...]

>
>Why does a lot of this stuff look like the SMSC95xx driver ?
>Do we even need a separate driver or can the SMSC95xx driver be updated to
>support the LAN78xx ?
>

Marek,
Thank you so much for your review.
The LAN78xx's register addresses and bit definitions are not compatible to our 
old part LAN95xx (==SMSC95xx).
The new devices LAN78xx and LAN75xx device have similarities. I plan to support 
these two devices in this driver.
I will take care of all your comments and will submit a new PATCH with a file 
name change to lan7x.c.

Best Regards,
Yuiko

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2] Add support for Microchip LAN78xx

2017-03-10 Thread Yuiko.Oshino
From: Yuiko Oshino 

Add support for Microchip LAN7800 and 7850, USB to 10/100/1000 Ethernet 
Controllers

Signed-off-by: Yuiko Oshino 
Cc: Marek Vasut 
---
Changes for v2:
   - lan78xx.c header comment cleanup

 drivers/usb/eth/Makefile |1 +
 drivers/usb/eth/lan78xx.c| 1319 ++
 drivers/usb/eth/usb_ether.c  |7 +
 include/usb_ether.h  |6 +
 scripts/config_whitelist.txt |1 +
 5 files changed, 1334 insertions(+)
 create mode 100644 drivers/usb/eth/lan78xx.c

diff --git a/drivers/usb/eth/Makefile b/drivers/usb/eth/Makefile
index 4c44efc..aa8a6cf 100644
--- a/drivers/usb/eth/Makefile
+++ b/drivers/usb/eth/Makefile
@@ -9,4 +9,5 @@ obj-$(CONFIG_USB_ETHER_ASIX) += asix.o
 obj-$(CONFIG_USB_ETHER_ASIX88179) += asix88179.o
 obj-$(CONFIG_USB_ETHER_MCS7830) += mcs7830.o
 obj-$(CONFIG_USB_ETHER_SMSC95XX) += smsc95xx.o
+obj-$(CONFIG_USB_ETHER_LAN78XX) += lan78xx.o
 obj-$(CONFIG_USB_ETHER_RTL8152) += r8152.o r8152_fw.o
diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
new file mode 100644
index 000..bc25c16
--- /dev/null
+++ b/drivers/usb/eth/lan78xx.c
@@ -0,0 +1,1319 @@
+/*
+ * Copyright (c) 2017 Microchip Technology Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "usb_ether.h"
+
+/* USB Vendor Requests */
+#define USB_VENDOR_REQUEST_WRITE_REGISTER  0xA0
+#define USB_VENDOR_REQUEST_READ_REGISTER   0xA1
+#define USB_VENDOR_REQUEST_GET_STATS   0xA2
+
+/* Tx Command A */
+#define TX_CMD_A_FCS_  (0x0040)
+#define TX_CMD_A_LEN_MASK_ (0x000F)
+
+/* Rx Command A */
+#define RX_CMD_A_RX_ERRS_MASK_ (0xC03F)
+#define RX_CMD_A_RXE_  (0x0004)
+#define RX_CMD_A_LEN_MASK_ (0x3FFF)
+
+/* SCSRs */
+#define ID_REV (0x00)
+#define ID_REV_CHIP_ID_MASK_   (0x)
+#define ID_REV_CHIP_REV_MASK_  (0x)
+#define ID_REV_CHIP_ID_7800_   (0x7800)
+#define ID_REV_CHIP_ID_7850_   (0x7850)
+
+#define INT_STS(0x0C)
+
+#define HW_CFG (0x010)
+#define HW_CFG_LED1_EN_(0x0020)
+#define HW_CFG_LED0_EN_(0x0010) /* Muxed with EEDO 
*/
+#define HW_CFG_LRST_   (0x0002) /* Mused with EECLK */
+#define HW_CFG_SRST_   (0x0001)
+
+#define PMT_CTL(0x014)
+#define PMT_CTL_READY_ (0x0080)
+#define PMT_CTL_PHY_RST_   (0x0010)
+
+#define E2P_CMD(0x040)
+#define E2P_CMD_EPC_BUSY_  (0x8000)
+#define E2P_CMD_EPC_CMD_MASK_  (0x7000)
+#define E2P_CMD_EPC_CMD_READ_  (0x)
+#define E2P_CMD_EPC_TIMEOUT_   (0x0400)
+#define E2P_CMD_EPC_ADDR_MASK_ (0x01FF)
+
+#define E2P_DATA   (0x044)
+#define E2P_DATA_EEPROM_DATA_MASK_ (0x00FF)
+
+#define USB_CFG0   (0x080)
+#define USB_CFG_BIR_   (0x0040)
+
+#define BURST_CAP  (0x090)
+#define BURST_CAP_SIZE_MASK_   (0x00FF)
+
+#define BULK_IN_DLY(0x094)
+#define BULK_IN_DLY_MASK_  (0x)
+
+#define RFE_CTL(0x0B0)
+#define RFE_CTL_BCAST_EN_  (0x0400)
+#define RFE_CTL_MCAST_EN_  (0x0200)
+#define RFE_CTL_UCAST_EN_  (0x0100)
+#define RFE_CTL_DA_PERFECT_(0x0002)
+
+#define FCT_RX_CTL (0x0C0)
+#define FCT_RX_CTL_EN_ (0x8000)
+
+#define FCT_TX_CTL (0x0C4)
+#define FCT_TX_CTL_EN_ (0x8000)
+
+#define FCT_RX_FIFO_END(0x0C8)
+#define FCT_RX_FIFO_END_MASK_  (0x007F)
+
+#define FCT_TX_FIFO_END(0x0CC)
+#define FCT_TX_FIFO_END_MASK_  (0x003F)
+
+#define FCT_FLOW   (0x0D0)
+
+#define MAC_CR (0x100)
+#define MAC_CR_ADP_(0x2000)
+#define MAC_CR_AUTO_DUPLEX_(0x1000)
+#define MAC_CR_AUTO_SPEED_ (0x0800)
+
+#define MAC_RX (0x104)
+#define MAC_RX_MAX_SIZE_SHIFT_ (16)
+#define MAC_RX_MAX_SIZE_MASK_  (0x3FFF)
+#define MAC_RX_FCS_STRIP_  (0x0010)
+#define MAC_RX_RXD_(0x0002)
+#define MAC_RX_RXEN_   (0x0001)
+
+#define MAC_TX (0x108)
+#define MAC_TX_BAD_FCS_(0x0004)
+#define MAC_TX_TXD_(0x0002)
+#define MAC_TX_TXEN_   (0x0001)
+
+#define FLOW

Re: [U-Boot] [PATCH v2] Add support for Microchip LAN78xx

2017-03-10 Thread Marek Vasut
On 03/10/2017 07:38 PM, yuiko.osh...@microchip.com wrote:
> From: Yuiko Oshino 
> 
> Add support for Microchip LAN7800 and 7850, USB to 10/100/1000 Ethernet 
> Controllers
> 
> Signed-off-by: Yuiko Oshino 
> Cc: Marek Vasut 
> ---
> Changes for v2:
>- lan78xx.c header comment cleanup
> 
>  drivers/usb/eth/Makefile |1 +
>  drivers/usb/eth/lan78xx.c| 1319 
> ++
>  drivers/usb/eth/usb_ether.c  |7 +
>  include/usb_ether.h  |6 +
>  scripts/config_whitelist.txt |1 +
>  5 files changed, 1334 insertions(+)
>  create mode 100644 drivers/usb/eth/lan78xx.c
> 
> diff --git a/drivers/usb/eth/Makefile b/drivers/usb/eth/Makefile
> index 4c44efc..aa8a6cf 100644
> --- a/drivers/usb/eth/Makefile
> +++ b/drivers/usb/eth/Makefile
> @@ -9,4 +9,5 @@ obj-$(CONFIG_USB_ETHER_ASIX) += asix.o
>  obj-$(CONFIG_USB_ETHER_ASIX88179) += asix88179.o
>  obj-$(CONFIG_USB_ETHER_MCS7830) += mcs7830.o
>  obj-$(CONFIG_USB_ETHER_SMSC95XX) += smsc95xx.o
> +obj-$(CONFIG_USB_ETHER_LAN78XX) += lan78xx.o
>  obj-$(CONFIG_USB_ETHER_RTL8152) += r8152.o r8152_fw.o
> diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
> new file mode 100644
> index 000..bc25c16
> --- /dev/null
> +++ b/drivers/usb/eth/lan78xx.c
> @@ -0,0 +1,1319 @@
> +/*
> + * Copyright (c) 2017 Microchip Technology Inc. All rights reserved.
> + *
> + * SPDX-License-Identifier:  GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "usb_ether.h"
> +
> +/* USB Vendor Requests */
> +#define USB_VENDOR_REQUEST_WRITE_REGISTER0xA0
> +#define USB_VENDOR_REQUEST_READ_REGISTER 0xA1
> +#define USB_VENDOR_REQUEST_GET_STATS 0xA2
> +
> +/* Tx Command A */
> +#define TX_CMD_A_FCS_(0x0040)
> +#define TX_CMD_A_LEN_MASK_   (0x000F)

Drop all those extra parenthesis around constants ...

> +/* Rx Command A */
> +#define RX_CMD_A_RX_ERRS_MASK_   (0xC03F)
> +#define RX_CMD_A_RXE_(0x0004)
> +#define RX_CMD_A_LEN_MASK_   (0x3FFF)
> +
> +/* SCSRs */
> +#define ID_REV   (0x00)
> +#define ID_REV_CHIP_ID_MASK_ (0x)
> +#define ID_REV_CHIP_REV_MASK_(0x)
> +#define ID_REV_CHIP_ID_7800_ (0x7800)
> +#define ID_REV_CHIP_ID_7850_ (0x7850)
> +
> +#define INT_STS  (0x0C)
> +
> +#define HW_CFG   (0x010)
> +#define HW_CFG_LED1_EN_  (0x0020)
> +#define HW_CFG_LED0_EN_  (0x0010) /* Muxed with EEDO 
> */
> +#define HW_CFG_LRST_ (0x0002) /* Mused with EECLK */
> +#define HW_CFG_SRST_ (0x0001)
> +
> +#define PMT_CTL  (0x014)
> +#define PMT_CTL_READY_   (0x0080)
> +#define PMT_CTL_PHY_RST_ (0x0010)
> +
> +#define E2P_CMD  (0x040)
> +#define E2P_CMD_EPC_BUSY_(0x8000)
> +#define E2P_CMD_EPC_CMD_MASK_(0x7000)
> +#define E2P_CMD_EPC_CMD_READ_(0x)
> +#define E2P_CMD_EPC_TIMEOUT_ (0x0400)
> +#define E2P_CMD_EPC_ADDR_MASK_   (0x01FF)

Drop the extra trailing underscore ...

> +#define E2P_DATA (0x044)
> +#define E2P_DATA_EEPROM_DATA_MASK_   (0x00FF)

Why does a lot of this stuff look like the SMSC95xx driver ?
Do we even need a separate driver or can the SMSC95xx driver be updated
to support the LAN78xx ?

> +#define USB_CFG0 (0x080)
> +#define USB_CFG_BIR_ (0x0040)

Looks like a BIT() macro can be used a lot in here ...

> +#define BURST_CAP(0x090)
> +#define BURST_CAP_SIZE_MASK_ (0x00FF)


[...]

> +/* local defines */
> +#define LAN78XX_BASE_NAME "78xx"
> +#define USB_CTRL_SET_TIMEOUT 5000
> +#define USB_CTRL_GET_TIMEOUT 5000
> +#define USB_BULK_SEND_TIMEOUT 5000
> +#define USB_BULK_RECV_TIMEOUT 5000

the macro should have a unit in it, like _MS or such ...

> +#define RX_URB_SIZE 2048
> +#define PHY_CONNECT_TIMEOUT 5000
> +
> +#ifndef CONFIG_DM_ETH
> +/* local vars */
> +static int curr_eth_dev; /* index for name of next device detected */
> +#endif
> +
> +/* driver private */
> +struct lan78xx_private {
> +#ifdef CONFIG_DM_ETH
> + struct ueth_data ueth;
> +#endif
> + size_t rx_urb_size; /* maximum USB URB size */
> + u32 mac_cr; /* MAC control register value */
> + int have_hwaddr;/* 1 if we have a hardware MAC address */
> +};
> +
> +/*
> + * Lan78xx infrastructure commands
> + */
> +static int lan78xx_write_reg(struct usb_device *udev, u32 index, u32 data)
> +{
> + int len;
> + ALLOC_CACHE_ALIGN_BUFFER(u32, tmpbuf, 1);
> +
> + cpu_to_le32s();
> +