net: add Xilinx emac lite device driver
Subsystems (3)
PATCH v3 1/1 net: add Xilinx emac lite device driver
This patch adds support for the Xilinx Ethernet Lite device. The soft logic core from Xilinx is typically used on Virtex and Spartan designs attached to either a PowerPC or a Microblaze processor.
---
V2 - cleanup based on review, added depends for ppc and mb in Kconfig V3 - fixed bug, spin lock was not initialized
--- drivers/net/Kconfig | 6 + drivers/net/Makefile | 1 + drivers/net/xilinx_emaclite.c | 1041 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1048 insertions(+), 0 deletions(-) create mode 100755 drivers/net/xilinx_emaclite.c
drivers/net/Kconfig +6 -0
@@ -1926,6 +1926,12 @@ config ATL2 To compile this driver as a module, choose M here. The module will be called atl2. +config XILINX_EMACLITE + tristate "Xilinx 10/100 Ethernet Lite support" + depends on PPC32 || MICROBLAZE + help + This driver supports the 10/100 Ethernet Lite from Xilinx. + source "drivers/net/fs_enet/Kconfig" endif # NET_ETHERNET
drivers/net/Makefile +1 -0
@@ -142,6 +142,7 @@ obj-$(CONFIG_TSI108_ETH) += tsi108_eth.o obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o ll_temac-objs := ll_temac_main.o ll_temac_mdio.o obj-$(CONFIG_XILINX_LL_TEMAC) += ll_temac.o +obj-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o obj-$(CONFIG_QLA3XXX) += qla3xxx.o obj-$(CONFIG_QLGE) += qlge/
drivers/net/xilinx_emaclite.c new file +1041 -0
1,041 lines not on this page · raw message
Signature · 5 lines
1.6.2.1 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
From: John Linn <[email protected]>
Date: Thu, 20 Aug 2009 03:49:51 -0600
Quoted 6 lines
This patch adds support for the Xilinx Ethernet Lite device. The soft logic core from Xilinx is typically used on Virtex and Spartan designs attached to either a PowerPC or a Microblaze processor.
Signed-off-by Sadanand M <[email protected]>Signed-off-by John Linn <[email protected]>
Applied, thanks.
Hi David,
I see that John's patch has wrong file permission
-rwxr-xr-x xilinx_emaclite.c
<http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=blob;f=drivers/net/xilinx_emaclite.c;h=7e05b40ae36b50b6eb66d9512ae3a49ba2d36a47;hb=a9a8cb1d6594037fbb23f1ce45964ec6a3b38215>
blob
<http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=blob;f=drivers/net/xilinx_emaclite.c;h=7e05b40ae36b50b6eb66d9512ae3a49ba2d36a47;hb=a9a8cb1d6594037fbb23f1ce45964ec6a3b38215>
| history
<http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=history;f=drivers/net/xilinx_emaclite.c;h=7e05b40ae36b50b6eb66d9512ae3a49ba2d36a47;hb=a9a8cb1d6594037fbb23f1ce45964ec6a3b38215>
| raw
<http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=blob_plain;f=drivers/net/xilinx_emaclite.c;hb=a9a8cb1d6594037fbb23f1ce45964ec6a3b38215>
should be 644.
Please fix it in your repo.
Thanks,
Michal
Quoted 14 lines
From: John Linn <[email protected]>
Date: Thu, 20 Aug 2009 03:49:51 -0600Quoted 7 lines
This patch adds support for the Xilinx Ethernet Lite device. The soft logic core from Xilinx is typically used on Virtex and Spartan designs attached to either a PowerPC or a Microblaze processor.
Signed-off-by Sadanand M <[email protected]>Signed-off-by John Linn <[email protected]>Applied, thanks.
Signature · 3 lines
Michal Simek, Ing. (M.Eng) PetaLogix - Linux Solutions for a Reconfigurable World w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663
David Miller
maintainerFrom: Michal Simek <[email protected]>
Date: Mon, 31 Aug 2009 15:18:44 +0200
Quoted 2 lines
I see that John's patch has wrong file permission
-rwxr-xr-xxilinx_emaclite.c
...
Quoted 3 lines
should be 644.
Please fix it in your repo.
Done, thanks!
John,
I just got a chance to browse this... Do you want to put in the stripped device names?
.compatible = "xlnx,xps-ethernetlite-2", etc...
Steve
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Quoted 7 lines · Stephen Neuendorffer
John,
I just got a chance to browse this... Do you want to put in the stripped device names?
.compatible = "xlnx,xps-ethernetlite-2", etc...
We've covered this territory before. Compatible values need to be exact for the IP cores. No wildcards. No abbreviations or stripping. Newer cores can claim compatibility with older when appropriate.
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
Sorry... you're right... brain fart on my part.. :)
Steve
Quoted 22 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Grant Likely
Sent: Thursday, August 20, 2009 10:45 AM
To: Stephen Neuendorffer
Cc: John Linn; [email protected]; [email protected]; [email protected]; [email protected]; John Linn; Sadanand Mutyala; John Williams; Michal Simek
Subject: Re: [PATCH] [V3] net: add Xilinx emac lite device driverQuoted 7 lines · Stephen Neuendorffer
John,
I just got a chance to browse this... Do you want to put in the stripped device names?
.compatible = "xlnx,xps-ethernetlite-2", etc...
We've covered this territory before. Compatible values need to be exact for the IP cores. No wildcards. No abbreviations or stripping. Newer cores can claim compatibility with older when appropriate.
Quoted 5 lines
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Quoted 25 lines · On Thu, 20 Aug 2009 03:49:51 -0600 John Linn <[email protected]> wrote:
drivers/net/xilinx_emaclite.c new file +25
-0+/** +* xemaclite_ioctl - Perform IO Control operations on the network device +* @dev: Pointer to the network device +* @rq: Pointer to the interface request structure +* @cmd: IOCTL command +* +* The only IOCTL operation supported by this function is setting the MAC +* address. An error is reported if any other operations are requested. +* +* Return: 0 to indicate success, or a negative error for failure. +*/ +static int xemaclite_ioctl (struct net_device *dev,struct ifreq *rq,int cmd) +{ +struct net_local *lp = (struct net_local *)netdev_priv (dev); +struct hw_addr_data *hw_addr = (struct hw_addr_data *) &rq->ifr_hwaddr; + +switch (cmd) { +case SIOCETHTOOL : +return -EIO ; + +case SIOCSIFHWADDR : +dev_err (&lp->ndev->dev,"SIOCSIFHWADDR\n" ); + +/* Copy MAC address in from user space */ + copy_from_user((void __force *) dev->dev_addr,
drivers/net/xilinx_emaclite.c line 794
Quoted 10 lines
drivers/net/xilinx_emaclite.c new file +10
-0+ (void __user __force *) hw_addr, + IFHWADDRLEN); +xemaclite_set_mac_address (lp, dev->dev_addr); +break ; +default : +return -EOPNOTSUPP ; + } + +return 0 ; +}
Do you really need this? I doubt the SIOCSIFHWADDR even reaches driver!
The normal call path for setting hardware address is:
dev_ifsioc
dev_set_mac_address
ops->ndo_set_mac_address --> The driver should be:
1. defining new code to do ndo_set_mac_address
2. remove existing xmaclite_ioctl - all ioctl's handled by upper layers
FYI - the only ioctl's that make it to network device ndo_ioctl
are listed in dev_ifsioc
SIOCDEVPRIVATE ... SIOCDEVPRIVATE + 15
SIOCBOND*
SIOCMII*
SIOCBR*
SIOCHWTSTAMP
SIOCWANDEV
Quoted 5 lines
-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, August 20, 2009 5:49 PM
To: John Linn
Cc: [email protected]; [email protected];
[email protected]; [email protected]; John
Quoted 1 line
Linn; [email protected]; Josh Boyer; John Williams; Michal
Simek; Sadanand Mutyala
Quoted 7 lines
Subject: Re: [PATCH] [V3] net: add Xilinx emac lite device driver
Quoted 2 lines · On Thu, 20 Aug 2009 03:49:51 -0600 John Linn <[email protected]> wrote:
+/**
+ *xemaclite_ioctl- Perform IO Control operations on the network
device
Quoted 5 lines
Quoted 5 lines
+ * @dev: Pointer to the network device
+ * @rq: Pointer to the interface request structure
+ * @cmd: IOCTL command
+ *
+ * The only IOCTL operation supported by this function is setting
the MAC
Quoted 1 line
Quoted 1 line
+ * address. An error is reported if any other operations are
requested.
Quoted 4 lines
Quoted 4 lines
+ *
+ * Return: 0 to indicate success, or a negative error for failure.
+ */
+static int xemaclite_ioctl(structnet_device*dev, struct ifreq
*rq, int cmd)
Quoted 3 lines
drivers/net/xilinx_emaclite.c
Quoted 3 lines
drivers/net/xilinx_emaclite.c new file +3
-0+{ +struct net_local *lp = (struct net_local *)netdev_priv (dev); + struct hw_addr_data *hw_addr = (struct hw_addr_data *)
&rq->ifr_hwaddr;
Quoted 14 lines
Quoted 14 lines
drivers/net/xilinx_emaclite.c new file +14
-0+ +switch (cmd) { +case SIOCETHTOOL : +return -EIO ; + +case SIOCSIFHWADDR : +dev_err (&lp->ndev->dev,"SIOCSIFHWADDR\n" ); + +/* Copy MAC address in from user space */ +copy_from_user ((void __force *) dev->dev_addr, + (void __user __force *) hw_addr, +IFHWADDRLEN ); +xemaclite_set_mac_address (lp, dev->dev_addr); +break ;
Quoted 8 lines
drivers/net/xilinx_emaclite.c line 794
Quoted 6 lines
drivers/net/xilinx_emaclite.c new file +6
-0+default : +return -EOPNOTSUPP ; + } + +return 0 ; +}Do you really need this? I doubt the SIOCSIFHWADDR even reaches
driver!
Quoted 9 lines
The normal call path for setting hardware address is:
dev_ifsiocdev_set_mac_address ops->ndo_set_mac_address -->The driver should be:
1. defining new code to dondo_set_mac_address
2. remove existingxmaclite_ioctl- all ioctl's handled by upper
layers
Quoted 11 lines
FYI - the only ioctl's that make it to network device
ndo_ioctl
are listed indev_ifsioc
SIOCDEVPRIVATE ... SIOCDEVPRIVATE + 15
SIOCBOND*
SIOCMII*
SIOCBR*
SIOCHWTSTAMP
SIOCWANDEV
We agree and will be updating the driver for this change. Sorry about the delay as I was on vacation.
Thanks,
John
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.