devicetree: add vendor prefix for Aurora VLSI
Subsystems (3)
PATCH 1/3 devicetree: add vendor prefix for Aurora VLSI
This adds the vendor prefix "aurora" for Aurora VLSI, Inc.
--- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -30,6 +30,7 @@ artesyn Artesyn Embedded Technologies Inc. asahi-kasei Asahi Kasei Corp. atmel Atmel Corporation auo AU Optronics Corporation +aurora Aurora VLSI, Inc. avago Avago Technologies avic Shanghai AVIC Optoelectronics Co., Ltd. axis Axis Communications AB
Signature · 6 lines
2.5.3 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
--- .../devicetree/bindings/net/aurora,nb8800.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/aurora,nb8800.txt
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +26 -0
@@ -0,0 +1,26 @@ +* Aurora VLSI AU-NB8800 Ethernet controller + +Required properties: +- compatible: Should be "aurora,nb8800", "sigma,smp8640-ethernet" + The latter indicates presence of extra features added by Sigma Designs. +- reg: Should be MMIO address space of the device +- interrupts: Should contain the interrupt specifier for the device +- interrupt-parent: Should be a phandle for the interrupt controller +- clocks: Should be a phandle for the clock for the device + +Common properties described in ethernet.txt: +- local-mac-address +- mac-address +- max-speed +- phy-mode + +Example: + +ethernet@26000 { + compatible = "aurora,nb8800"; + reg = <0x10000 0x800>; + interrupts = <42>; + clocks = <&sys_clk>; + max-speed = <1000>; + phy-connection-type = "rgmii"; +};
Signature · 1 line
2.5.3
PATCH 3/3 net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
In reply to Mans RullgardThis adds a driver for the Aurora VLSI NB8800 Ethernet controller. It is an almost complete rewrite of a driver originally found in a Sigma Designs 2.6.22 tree.
--- drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/Makefile | 1 + drivers/net/ethernet/aurora/Kconfig | 20 + drivers/net/ethernet/aurora/Makefile | 1 + drivers/net/ethernet/aurora/nb8800.c | 1173 ++++++++++++++++++++++++++++++++++ drivers/net/ethernet/aurora/nb8800.h | 257 ++++++++ 6 files changed, 1453 insertions(+) create mode 100644 drivers/net/ethernet/aurora/Kconfig create mode 100644 drivers/net/ethernet/aurora/Makefile create mode 100644 drivers/net/ethernet/aurora/nb8800.c create mode 100644 drivers/net/ethernet/aurora/nb8800.h
drivers/net/ethernet/Kconfig +1 -0
@@ -29,6 +29,7 @@ source "drivers/net/ethernet/apm/Kconfig" source "drivers/net/ethernet/apple/Kconfig" source "drivers/net/ethernet/arc/Kconfig" source "drivers/net/ethernet/atheros/Kconfig" +source "drivers/net/ethernet/aurora/Kconfig" source "drivers/net/ethernet/cadence/Kconfig" source "drivers/net/ethernet/adi/Kconfig" source "drivers/net/ethernet/broadcom/Kconfig"
drivers/net/ethernet/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_NET_XGENE) += apm/ obj-$(CONFIG_NET_VENDOR_APPLE) += apple/ obj-$(CONFIG_NET_VENDOR_ARC) += arc/ obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/ +obj-$(CONFIG_NET_VENDOR_AURORA) += aurora/ obj-$(CONFIG_NET_CADENCE) += cadence/ obj-$(CONFIG_NET_BFIN) += adi/ obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/
drivers/net/ethernet/aurora/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +config NET_VENDOR_AURORA + bool "Aurora VLSI devices" + help + If you have a network (Ethernet) device belonging to this class, + say Y. + + Note that the answer to this question doesn't directly affect the + kernel: saying N will just cause the configurator to skip all + questions about Aurora devices. If you say Y, you will be asked + for your specific device in the following questions. + +if NET_VENDOR_AURORA + +config AURORA_NB8800 + tristate "Aurora AU-NB8800 support" + select PHYLIB + help + Support for the AU-NB8800 gigabit Ethernet controller. + +endif
drivers/net/ethernet/aurora/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_AURORA_NB8800) += nb8800.o
drivers/net/ethernet/aurora/nb8800.c new file +1173 -0
1,173 lines not on this page · raw message
drivers/net/ethernet/aurora/nb8800.h new file +257 -0
257 lines not on this page · raw message
Signature · 1 line
2.5.3
David Miller
maintainerRe: [PATCH 3/3] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
From: Mans Rullgard <[email protected]>
Date: Thu, 22 Oct 2015 15:02:38 +0100
Quoted 5 lines
This adds a driver for the Aurora VLSI NB8800 Ethernet controller. It is an almost complete rewrite of a driver originally found in a Sigma Designs 2.6.22 tree.
Signed-off-by Mans Rullgard <[email protected]>
The netdev list is going to have to see patches #1 and #2 as well as your cover letter in order to review and integrate this driver properly.
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
In reply to Mans RullgardQuoted 18 lines · Mans Rullgard
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
Signed-off-by Mans Rullgard <[email protected]>--- .../devicetree/bindings/net/aurora,nb8800.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/aurora,nb8800.txtDocumentation/devicetree/bindings/net/aurora,nb8800.txt new file +0
-0
Documentation/devicetree/bindings/net/aurora,nb8800.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +5
-0@@ -0,0 +1,26 @@ +* Aurora VLSI AU-NB8800 Ethernet controller + +Required properties: +- compatible: Should be "aurora,nb8800", "sigma,smp8640-ethernet" + The latter indicates presence of extra features added by Sigma Designs.
These should be in opposite order. Most specific comes first.
Quoted 22 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +21
-1+- reg: Should be MMIO address space of the device +- interrupts: Should contain the interrupt specifier for the device +- interrupt-parent: Should be a phandle for the interrupt controller +- clocks: Should be a phandle for the clock for the device + +Common properties described in ethernet.txt: +- local-mac-address +- mac-address +- max-speed +- phy-mode + +Example: + +ethernet@26000 { + compatible = "aurora,nb8800"; + reg = <0x10000 0x800>; + interrupts = <42>; + clocks = <&sys_clk>; + max-speed = <1000>; + phy-connection-type = "rgmii"; +}; --
Quoted 2 lines
2.5.3
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Mans Rullgard
This adds the vendor prefix "aurora" for Aurora VLSI, Inc.
Signed-off-by Mans Rullgard <[email protected]>
Quoted 19 lines
--- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/vendor-prefixes.txt +1
-1@@ -30,6 +30,7 @@ artesyn Artesyn Embedded Technologies Inc. asahi-kasei Asahi Kasei Corp. atmel Atmel Corporation auo AU Optronics Corporation +aurora Aurora VLSI, Inc. avago Avago Technologies avic Shanghai AVIC Optoelectronics Co., Ltd. axis Axis Communications AB --2.5.3
kbuild test robot
build botRe: [PATCH 3/3] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
In reply to Mans Rullgardreproduce:
Hi Mans,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Mans-Rullgard/devicetree-add-vendor-prefix-for-Aurora-VLSI/20151022-220753 config: x86_64-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All warnings (new ones prefixed by >>):
drivers/net/ethernet/aurora/nb8800.c: In function 'nb8800_xmit':
>> drivers/net/ethernet/aurora/nb8800.c:381:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
cpsz = (8 - (u32)skb->data) & 7;
^
In file included from include/linux/dma-mapping.h:5:0,
from include/linux/skbuff.h:34,
from include/linux/if_ether.h:23,
from include/linux/etherdevice.h:25,
from drivers/net/ethernet/aurora/nb8800.c:24:
drivers/net/ethernet/aurora/nb8800.c: In function 'nb8800_probe':
>> drivers/net/ethernet/aurora/nb8800.c:1006:23: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=]
dev_info(&pdev->dev, "AU-NB8800 Ethernet at 0x%x\n", res->start);
^
include/linux/device.h:1166:51: note: in definition of macro 'dev_info'
#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
^vim +381 drivers/net/ethernet/aurora/nb8800.c
365
366 static int nb8800_xmit(struct sk_buff *skb, struct net_device *dev)
367 {
368 struct nb8800_priv *priv = netdev_priv(dev);
369 struct tx_skb_data *skb_data;
370 struct tx_buf *tx_buf;
371 dma_addr_t dma_addr;
372 unsigned int dma_len;
373 int cpsz, next;
374 int frags;
375
376 if (atomic_read(&priv->tx_free) <= NB8800_DESC_LOW) {
377 netif_stop_queue(dev);
378 return NETDEV_TX_BUSY;
379 }
380
> 381 cpsz = (8 - (u32)skb->data) & 7;
382
383 frags = cpsz ? 2 : 1;
384 atomic_sub(frags, &priv->tx_free);
385
386 dma_len = skb->len - cpsz;
387 dma_addr = dma_map_single(&dev->dev, skb->data + cpsz,
388 dma_len, DMA_TO_DEVICE);
389
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 3/3] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
In reply to David MillerQuoted 7 lines · David Miller
From: Mans Rullgard <[email protected]>
Date: Thu, 22 Oct 2015 15:02:38 +0100Quoted 4 lines
This adds a driver for the Aurora VLSI NB8800 Ethernet controller. It is an almost complete rewrite of a driver originally found in a Sigma Designs 2.6.22 tree.
Quoted 5 lines
Quoted 1 line
Signed-off-by Mans Rullgard <[email protected]>The netdev list is going to have to see patches #1 and #2 as well as your cover letter in order to review and integrate this driver properly.
Patch 1 only added the "aurora" DT vendor prefix. Patch 2 was the DT binding for this device. I'll include netdev when I send an updated version.
Signature · 2 lines
Måns Rullgård [email protected]
kbuild test robot
build botRe: [PATCH 3/3] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
In reply to Mans Rullgardreproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…
Hi Mans,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Mans-Rullgard/devicetree-add-vendor-prefix-for-Aurora-VLSI/20151022-220753 config: sparc64-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
All warnings (new ones prefixed by >>):
drivers/net/ethernet/aurora/nb8800.c: In function 'nb8800_xmit':
drivers/net/ethernet/aurora/nb8800.c:381:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
cpsz = (8 - (u32)skb->data) & 7;
^
drivers/net/ethernet/aurora/nb8800.c: In function 'nb8800_probe':
>> drivers/net/ethernet/aurora/nb8800.c:1006:2: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t' [-Wformat=]
dev_info(&pdev->dev, "AU-NB8800 Ethernet at 0x%x\n", res->start);
^vim +1006 drivers/net/ethernet/aurora/nb8800.c
990 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
991 if (!res) {
992 dev_err(&pdev->dev, "No MMIO base\n");
993 return -EINVAL;
994 }
995
996 irq = platform_get_irq(pdev, 0);
997 if (irq <= 0) {
998 dev_err(&pdev->dev, "No IRQ\n");
999 return -EINVAL;
1000 }
1001
1002 base = devm_ioremap_resource(&pdev->dev, res);
1003 if (IS_ERR(base))
1004 return PTR_ERR(base);
1005
> 1006 dev_info(&pdev->dev, "AU-NB8800 Ethernet at 0x%x\n", res->start);
1007
1008 dev = alloc_etherdev(sizeof(*priv));
1009 if (!dev)
1010 return -ENOMEM;
1011
1012 platform_set_drvdata(pdev, dev);
1013 SET_NETDEV_DEV(dev, &pdev->dev);
1014
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 3/3] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
In reply to Mans RullgardQuoted 3 lines · Mans Rullgard
This adds a driver for the Aurora VLSI NB8800 Ethernet controller. It is an almost complete rewrite of a driver originally found in a Sigma Designs 2.6.22 tree.
Some reviews here and there, mostly related to how you use the PHY library.
[snip]
drivers/net/ethernet/aurora/nb8800.c line 206
Quoted 5 lines
drivers/net/ethernet/aurora/nb8800.c new file +5
-0+ buf->page =virt_to_head_page (data); + buf->offset = data -page_address (buf->page); + + rx->s_addr =dma_map_page (&dev->dev, buf->page, buf->offset, +RX_BUF_SIZE ,DMA_FROM_DEVICE );
Missing dma_mapping_error() check here?
[snip]
drivers/net/ethernet/aurora/nb8800.c line 388
Quoted 3 lines
drivers/net/ethernet/aurora/nb8800.c new file +3
-0+ dma_len = skb->len - cpsz; + dma_addr =dma_map_single (&dev->dev, skb->data + cpsz, + dma_len,DMA_TO_DEVICE );
Ditto, missing dma_mapping_error() check.
[snip]
drivers/net/ethernet/aurora/nb8800.c line 413
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+nb8800_tx_dma_start (dev, next); + +if (!skb->xmit_more && !timer_pending (&priv->tx_reclaim_timer)) +mod_timer (&priv->tx_reclaim_timer, jiffies +HZ /20 );
You do not have a TX completion interrupt? Using a timer to reclaim TX buffers is really not great for latency.
Quoted 42 lines
drivers/net/ethernet/aurora/nb8800.c new file +42
-0+ +if (atomic_read (&priv->tx_free) <=NB8800_DESC_LOW ) +netif_stop_queue (dev); + +return NETDEV_TX_OK ; +} + +static void nb8800_tx_reclaim (unsigned long data) +{ +struct net_device *dev = (struct net_device *)data; +struct nb8800_priv *priv =netdev_priv (dev); +int packets =0 , bytes =0 ; +int reclaimed =0 ; +int dirty, limit; + + dirty =xchg (&priv->tx_dirty,-1 ); +if (dirty <0 ) +return ; + + limit = priv->tx_reclaim_limit; +if (dirty == limit) + goto end; + +while (dirty != limit) { +struct nb8800_dma_desc *tx = &priv->tx_descs[dirty]; +struct tx_buf *tx_buf = &priv->tx_bufs[dirty]; +struct sk_buff *skb = tx_buf->skb; +struct tx_skb_data *skb_data = (struct tx_skb_data *)skb->cb; +int frags = tx_buf->frags; + + packets++; + bytes += skb->len; + +dma_unmap_single (&dev->dev, skb_data->dma_addr, + skb_data->dma_len,DMA_TO_DEVICE ); +dev_kfree_skb (skb); + + tx->report =0 ; + tx_buf->skb =NULL ; + tx_buf->frags =0 ; + + dirty = (dirty + frags) & (TX_DESC_COUNT -1 );
drivers/net/ethernet/aurora/nb8800.c line 465
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+ reclaimed += frags; + } + + priv->stats.tx_packets += packets; + priv->stats.tx_bytes += bytes; + +smp_mb__before_atomic (); +atomic_add (reclaimed, &priv->tx_free); + +netif_wake_queue (dev);
You can only wake up your queue if you have successfully reclaimed transmitted buffers, otherwise this is giving false information to the stack that there is room to push more packets.
[snip]
drivers/net/ethernet/aurora/nb8800.c line 504
Quoted 13 lines
drivers/net/ethernet/aurora/nb8800.c new file +13
-0+static irqreturn_t nb8800_isr (int irq,void *dev_id) +{ +struct net_device *dev = dev_id; +struct nb8800_priv *priv =netdev_priv (dev); +u32 val; + +/* tx interrupt */ + val =nb8800_readl (priv,NB8800_TXC_SR ); +if (val) { +nb8800_writel (priv,NB8800_TXC_SR , val); + +if (likely (val &TSR_TI )) +nb8800_tx_done (dev);
Ok, so there is a TX interrupt, so what is the timer used for?
Quoted 24 lines
drivers/net/ethernet/aurora/nb8800.c new file +24
-0+ +if (unlikely (val &TSR_DE )) +netdev_err (dev,"TX DMA error\n" ); + +if (unlikely (val &TSR_TO )) +netdev_err (dev,"TX Status FIFO overflow\n" ); + } + +/* rx interrupt */ + val =nb8800_readl (priv,NB8800_RXC_SR ); +if (val) { +nb8800_writel (priv,NB8800_RXC_SR , val); + +if (likely (val &RSR_RI )) +napi_schedule_irqoff (&priv->napi); + +if (unlikely (val &RSR_DE )) +netdev_err (dev,"RX DMA error\n" ); + +if (unlikely (val &RSR_RO )) { +int i; + +netdev_err (dev,"RX Status FIFO overflow\n" ); +
drivers/net/ethernet/aurora/nb8800.c line 538
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+for (i =0 ; i <4 ; i++) +nb8800_readl (priv,NB8800_RX_FIFO_SR ); + } + } + +/* wake on lan */ + val =nb8800_readb (priv,NB8800_WAKEUP ); +if (val ==1 ) { +nb8800_writeb (priv,NB8800_SLEEP_MODE ,0 ); +nb8800_writeb (priv,NB8800_WAKEUP ,0 );
It is nice to account for such wake-up events by calling pm_wakeup_event(). Since you do not support configuring Wake-on-LAN yet, you might as well drop this, unless such interrupt needs to be cleared?
Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c new file +8
-0+ } + +return IRQ_HANDLED ; +} + +static void nb8800_mac_config (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev);
drivers/net/ethernet/aurora/nb8800.c line 556
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+ +if (priv->duplex) +nb8800_clear_bits (b, priv,NB8800_MAC_MODE ,HALF_DUPLEX ); +else +nb8800_set_bits (b, priv,NB8800_MAC_MODE ,HALF_DUPLEX ); + +if (priv->speed ==SPEED_1000 ) { +nb8800_set_bits (b, priv,NB8800_MAC_MODE , +RGMII_MODE |GMAC_MODE ); +nb8800_writeb (priv,NB8800_IC_THRESHOLD ,3 );
What is the IC_THRESHOLD value for? Is this some form of interrupt coalescing? If so, there is a proper ethtool interface to configure that.
drivers/net/ethernet/aurora/nb8800.c line 562
Quoted 6 lines
drivers/net/ethernet/aurora/nb8800.c new file +6
-0+nb8800_writeb (priv,NB8800_SLOT_TIME ,255 ); + }else { +nb8800_clear_bits (b, priv,NB8800_MAC_MODE , +RGMII_MODE |GMAC_MODE ); +nb8800_writeb (priv,NB8800_IC_THRESHOLD ,1 ); +nb8800_writeb (priv,NB8800_SLOT_TIME ,127 );
What about if you link at 10Mbits/sec, would the slot time value still make sense here?
Quoted 23 lines
drivers/net/ethernet/aurora/nb8800.c new file +23
-0+ } +} + +static void nb8800_link_reconfigure (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); +struct phy_device *phydev = priv->phydev; + +if (phydev->speed == priv->speed && phydev->duplex == priv->duplex && + phydev->link == priv->link) +return ; + +if (phydev->link != priv->link || phydev->link) +phy_print_status (priv->phydev); + + priv->speed = phydev->speed; + priv->duplex = phydev->duplex; + priv->link = phydev->link; + +if (priv->link) +nb8800_mac_config (dev); +} +
drivers/net/ethernet/aurora/nb8800.c line 595
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+static void nb8800_update_mac_addr (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); + +nb8800_writeb (priv,NB8800_MAC_ADDR1 , dev->dev_addr[0 ]); +nb8800_writeb (priv,NB8800_MAC_ADDR2 , dev->dev_addr[1 ]); +nb8800_writeb (priv,NB8800_MAC_ADDR3 , dev->dev_addr[2 ]); +nb8800_writeb (priv,NB8800_MAC_ADDR4 , dev->dev_addr[3 ]); +nb8800_writeb (priv,NB8800_MAC_ADDR5 , dev->dev_addr[4 ]); +nb8800_writeb (priv,NB8800_MAC_ADDR6 , dev->dev_addr[5 ]);
How about a for loop and make the NB8800_MAC_ADDR take an optional offset argument?
drivers/net/ethernet/aurora/nb8800.c line 602
Quoted 7 lines
drivers/net/ethernet/aurora/nb8800.c new file +7
-0+ +nb8800_writeb (priv,NB8800_UC_ADDR1 , dev->dev_addr[0 ]); +nb8800_writeb (priv,NB8800_UC_ADDR2 , dev->dev_addr[1 ]); +nb8800_writeb (priv,NB8800_UC_ADDR3 , dev->dev_addr[2 ]); +nb8800_writeb (priv,NB8800_UC_ADDR4 , dev->dev_addr[3 ]); +nb8800_writeb (priv,NB8800_UC_ADDR5 , dev->dev_addr[4 ]); +nb8800_writeb (priv,NB8800_UC_ADDR6 , dev->dev_addr[5 ]);
Same here.
[snip]
drivers/net/ethernet/aurora/nb8800.c line 634
Quoted 9 lines
drivers/net/ethernet/aurora/nb8800.c new file +9
-0+ +static void nb8800_set_rx_mode (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); +struct netdev_hw_addr *ha; +int af_en; + +if ((dev->flags & (IFF_PROMISC |IFF_ALLMULTI )) || +netdev_mc_count (dev) >64 )
64, that's pretty generous for a perfect match filter, nice.
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+ af_en =0 ; + else + af_en =1 ; + +nb8800_mac_af (dev, af_en); + +if (!af_en) +return ; + +nb8800_mc_init (dev,0 );
drivers/net/ethernet/aurora/nb8800.c line 654
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+ +netdev_for_each_mc_addr (ha, dev) { +char *addr = ha->addr; + +nb8800_writeb (priv,NB8800_MC_ADDR1 , addr[0 ]); +nb8800_writeb (priv,NB8800_MC_ADDR2 , addr[1 ]); +nb8800_writeb (priv,NB8800_MC_ADDR3 , addr[2 ]); +nb8800_writeb (priv,NB8800_MC_ADDR4 , addr[3 ]); +nb8800_writeb (priv,NB8800_MC_ADDR5 , addr[4 ]); +nb8800_writeb (priv,NB8800_MC_ADDR6 , addr[5 ]);
And here.
Quoted 29 lines
drivers/net/ethernet/aurora/nb8800.c new file +29
-0+ +nb8800_mc_init (dev,0xff ); + } +} + +static void nb8800_dma_reinit (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); +struct nb8800_dma_desc *rx; +int i; + + priv->tx_pending =-1 ; + priv->tx_reclaim_limit =0 ; + priv->tx_dirty =0 ; + priv->tx_next =0 ; + priv->tx_done =0 ; +atomic_set (&priv->tx_free,TX_DESC_COUNT ); + + priv->rx_eoc =RX_DESC_COUNT -1 ; + +for (i =0 ; i <RX_DESC_COUNT -1 ; i++) { + rx = &priv->rx_descs[i]; + rx->report =0 ; + rx->config &= ~DESC_EOC ; + } + + rx = &priv->rx_descs[i]; + rx->report =0 ; + rx->config |=DESC_EOC ;
drivers/net/ethernet/aurora/nb8800.c line 693
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+ +nb8800_writel (priv,NB8800_TX_DESC_ADDR , priv->tx_desc_dma); +nb8800_writel (priv,NB8800_RX_DESC_ADDR , priv->rx_desc_dma); +} + +static int nb8800_open (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); + +phy_resume (priv->phydev);
Unnecessary, phy_start() would take care of that if you PHY was already suspended.
drivers/net/ethernet/aurora/nb8800.c line 694
Quoted 1 line
drivers/net/ethernet/aurora/nb8800.c new file +1
-0+phy_start (priv->phydev);
Usually, this is one of the last things you do.
Quoted 20 lines
drivers/net/ethernet/aurora/nb8800.c new file +20
-0+ +nb8800_writel (priv,NB8800_RXC_SR ,0xf ); +nb8800_writel (priv,NB8800_TXC_SR ,0xf ); + +nb8800_dma_reinit (dev); +wmb ();/* ensure all setup is written before starting */ +nb8800_start_rx (dev); + +nb8800_mac_rx (dev,1 ); +nb8800_mac_tx (dev,1 ); + +napi_enable (&priv->napi); +netif_start_queue (dev); + +return 0 ; +} + +static int nb8800_stop (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev);
drivers/net/ethernet/aurora/nb8800.c line 724
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+ +netif_stop_queue (dev); +napi_disable (&priv->napi); + +nb8800_stop_rx (dev); + +nb8800_mac_rx (dev,0 ); +nb8800_mac_tx (dev,0 ); + +phy_stop (priv->phydev);
Since you seem to support clock reference, phy_stop() is not synchronous, only phy_disconnect() is, so there could still be work pending after nb8800_stop() which triggers a deferred MDIO read/write operation.
drivers/net/ethernet/aurora/nb8800.c line 734
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+phy_suspend (priv->phydev); + +return 0 ; +} + +static struct net_device_stats *nb8800_get_stats (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); + +return &priv->stats;
Cannot you return dev->stats directly?
[snip]
drivers/net/ethernet/aurora/nb8800.c line 783
Quoted 7 lines
drivers/net/ethernet/aurora/nb8800.c new file +7
-0+static u32 nb8800_get_link (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); + +phy_read_status (priv->phydev); + +return priv->phydev->link;
return ethtool_op_get_link(dev);
drivers/net/ethernet/aurora/nb8800.c line 790
Quoted 7 lines
drivers/net/ethernet/aurora/nb8800.c new file +7
-0+} + +static struct ethtool_ops nb8800_ethtool_ops = { + .get_settings = nb8800_get_settings, + .set_settings = nb8800_set_settings, + .nway_reset = nb8800_nway_reset, + .get_link = nb8800_get_link,
ethtool_op_get_link() here actually.
[snip]
drivers/net/ethernet/aurora/nb8800.c line 879
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+ +static void nb8800_tangox_init (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); +u32 val; + + val =nb8800_readb (priv,NB8800_TANGOX_PAD_MODE ) &0x78 ; +if (priv->phydev->supported &PHY_1000BT_FEATURES ) + val |=1 ; +nb8800_writeb (priv,NB8800_TANGOX_PAD_MODE , val);
Is this possibly a RGMII delay setting? If so, you need to look at phydev->interface, not whether Gigabit is supported or not.
[snip]
drivers/net/ethernet/aurora/nb8800.c line 1057
Quoted 5 lines
drivers/net/ethernet/aurora/nb8800.c new file +5
-0+ ret =mdiobus_register (bus); +if (ret) { +dev_err (&pdev->dev,"failed to register MII bus\n" ); + goto err_disable_clk; + }
How about of_mdiobus_register() here instead such that if you have Ethernet PHY nodes in your Device Tree, they get registered as PHY devices?
drivers/net/ethernet/aurora/nb8800.c line 1060
Quoted 3 lines
drivers/net/ethernet/aurora/nb8800.c new file +3
-0+ + phydev =phy_find_first (bus); +if (!phydev ||phy_read (phydev,MII_BMSR ) <=0 ) {
What is this additional MII_MBSR read used for?
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+dev_err (&pdev->dev,"no PHY detected\n" ); + ret = -ENODEV ; + goto err_free_bus; + }
drivers/net/ethernet/aurora/nb8800.c line 1074
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+ + priv->mii_bus = bus; + priv->phydev = phydev; + + phydev->irq =PHY_POLL ; + + ret =phy_connect_direct (dev, phydev, nb8800_link_reconfigure, + phy_mode); +if (ret) + goto err_free_bus;
phy_connect_direct() starts the PHY state machine (unlike phy_attach_direct), so you should rather move this to the ndo_open() function to avoid having the PHY being polled before your network device is ready. In case your network interface is not brought up, you might end-up polling the PHY for nothing.
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+ +dev_info (&pdev->dev,"PHY: found %s at 0x%x\n" , + phydev->drv->name, phydev->addr); +
drivers/net/ethernet/aurora/nb8800.c line 1088
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+if (ops && ops->init) + ops->init (dev); + + ret =nb8800_hw_init (dev); +if (ret) + goto err_detach_phy; + + ret =nb8800_dma_init (dev); +if (ret) + goto err_detach_phy;
This allocates buffer, so same thing, if your interface is never brough up, you are potentially wasting some memory which is there sitting for the network interface to be there.
drivers/net/ethernet/aurora/nb8800.c line 1092
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+ + ret =request_irq (irq, nb8800_isr,0 ,dev_name (&pdev->dev), dev); +if (ret) + goto err_free_dma;
Most drivers do request_irq() in their ndo_open() function, for the same reason as above.
drivers/net/ethernet/aurora/nb8800.c line 1096
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+ + dev->netdev_ops = &nb8800_netdev_ops; + dev->ethtool_ops = &nb8800_ethtool_ops; + dev->tx_queue_len =TX_DESC_COUNT ;
Why do you need to override this? Is not 1000 good enough?
[snip]
Quoted 6 lines
drivers/net/ethernet/aurora/nb8800.c new file +6
-0+ +static int nb8800_remove (struct platform_device *pdev) +{ +struct net_device *ndev =platform_get_drvdata (pdev); +struct nb8800_priv *priv =netdev_priv (ndev); +
drivers/net/ethernet/aurora/nb8800.c line 1156
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+unregister_netdev (ndev); +free_irq (ndev->irq, ndev); + +phy_detach (priv->phydev); +mdiobus_unregister (priv->mii_bus); + +clk_disable_unprepare (priv->clk); + +nb8800_dma_free (ndev); +free_netdev (ndev);
Should not there be a tangox specific callback here to de-initialize the HW?
Signature · 1 line
Florian
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
In reply to Mans RullgardQuoted 18 lines · Mans Rullgard
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
Signed-off-by Mans Rullgard <[email protected]>--- .../devicetree/bindings/net/aurora,nb8800.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/aurora,nb8800.txtDocumentation/devicetree/bindings/net/aurora,nb8800.txt new file +0
-0
Documentation/devicetree/bindings/net/aurora,nb8800.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +5
-0@@ -0,0 +1,26 @@ +* Aurora VLSI AU-NB8800 Ethernet controller + +Required properties: +- compatible: Should be "aurora,nb8800", "sigma,smp8640-ethernet" + The latter indicates presence of extra features added by Sigma Designs.
I've been meaning to ask a noob question to the devicetree group about how names for compatible strings are chosen.
Sigma Designs has two active SoC families, Tango3 (which consists of about a dozen MIPS-based SoCs, typically named SMP86xx) and Tango4 (a few ARM-based SoCs, typically named SMP87xx). I should note that there is no SMP8640 SoC AFAIK, rather SMP864x is a Tango3 sub-family (I could locate 42,43,44,45,46).
AFAIK, all our SoCs are using the same Aurora NB8800 Ethernet MAC, along with the extra features. I find it odd to use a specific SoC model to refer to this device, instead of a more generic name. (It's weird having to mention smp8640 in the tango4 DT.)
Would it be possible to have a compatible string which makes it clear that it is an Aurora MAC with vendor-specific tweaks? Something like "sigma,aurora-nb8800-mac" ?
Quoted 7 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +7
-0+- reg: Should be MMIO address space of the device +- interrupts: Should contain the interrupt specifier for the device +- interrupt-parent: Should be a phandle for the interrupt controller +- clocks: Should be a phandle for the clock for the device + +Common properties described in ethernet.txt: +- local-mac-address
Documentation/devicetree/bindings/net/aurora,nb8800.txt line 22
Quoted 10 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +10
-0+- mac-address +- max-speed +- phy-mode + +Example: + +ethernet@26000 { + compatible = "aurora,nb8800"; + reg = <0x10000 0x800>; + interrupts = <42>;
I thought one had to specify also whether the device sent "edge" or "level" IRQs?
Documentation/devicetree/bindings/net/aurora,nb8800.txt line 26
Quoted 4 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +4
-0+ clocks = <&sys_clk>; + max-speed = <1000>; + phy-connection-type = "rgmii"; +};
Regards.
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
Quoted 35 lines · Marc Gonzalez
Quoted 18 lines · Mans Rullgard
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
Signed-off-by Mans Rullgard <[email protected]>--- .../devicetree/bindings/net/aurora,nb8800.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/aurora,nb8800.txtDocumentation/devicetree/bindings/net/aurora,nb8800.txt new file +0
-0Documentation/devicetree/bindings/net/aurora,nb8800.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +5
-0@@ -0,0 +1,26 @@ +* Aurora VLSI AU-NB8800 Ethernet controller + +Required properties: +- compatible: Should be "aurora,nb8800", "sigma,smp8640-ethernet" + The latter indicates presence of extra features added by Sigma Designs.I've been meaning to ask a noob question to the devicetree group about how names for compatible strings are chosen.
Sigma Designs has two active SoC families, Tango3 (which consists of about a dozen MIPS-based SoCs, typically named SMP86xx) and Tango4 (a few ARM-based SoCs, typically named SMP87xx). I should note that there is no SMP8640 SoC AFAIK, rather SMP864x is a Tango3 sub-family (I could locate 42,43,44,45,46).
Quoted 4 lines
AFAIK, all our SoCs are using the same Aurora NB8800 Ethernet MAC, along with the extra features. I find it odd to use a specific SoC model to refer to this device, instead of a more generic name. (It's weird having to mention smp8640 in the tango4 DT.)
The block may seem the same, but do you really know? Same block can have different operating frequencies depending on the physical design. A specific string is insurance in case you do find some difference as that should not require you do update your DTB (the traditional model is DTB is part of firmware and independent of OS versions).
Having a generic string for matching is fine, but you also need a specific one. Often the first chip with a block is the generic string. New SOCs can then claim compatibility with old versions and existing drivers.
Quoted 3 lines
Would it be possible to have a compatible string which makes it clear that it is an Aurora MAC with vendor-specific tweaks? Something like "sigma,aurora-nb8800-mac" ?
That is what is done here essentially. You can debate on the exact name if you like.
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +12
-0+- reg: Should be MMIO address space of the device +- interrupts: Should contain the interrupt specifier for the device +- interrupt-parent: Should be a phandle for the interrupt controller +- clocks: Should be a phandle for the clock for the device + +Common properties described in ethernet.txt: +- local-mac-address +- mac-address +- max-speed +- phy-mode + +Example:
Quoted 8 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt line 22
Quoted 5 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +5
-0+ +ethernet@26000 { + compatible = "aurora,nb8800"; + reg = <0x10000 0x800>; + interrupts = <42>;I thought one had to specify also whether the device sent "edge" or "level" IRQs?
That is entirely dependent on the interrupt controller you are attached to. Often that is not a configurable property for hard wired IRQs.
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
In reply to Marc GonzalezQuoted 35 lines · Marc Gonzalez
Quoted 18 lines · Mans Rullgard
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
Signed-off-by Mans Rullgard <[email protected]>--- .../devicetree/bindings/net/aurora,nb8800.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/aurora,nb8800.txtDocumentation/devicetree/bindings/net/aurora,nb8800.txt new file +0
-0Documentation/devicetree/bindings/net/aurora,nb8800.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +5
-0@@ -0,0 +1,26 @@ +* Aurora VLSI AU-NB8800 Ethernet controller + +Required properties: +- compatible: Should be "aurora,nb8800", "sigma,smp8640-ethernet" + The latter indicates presence of extra features added by Sigma Designs.I've been meaning to ask a noob question to the devicetree group about how names for compatible strings are chosen.
Sigma Designs has two active SoC families, Tango3 (which consists of about a dozen MIPS-based SoCs, typically named SMP86xx) and Tango4 (a few ARM-based SoCs, typically named SMP87xx). I should note that there is no SMP8640 SoC AFAIK, rather SMP864x is a Tango3 sub-family (I could locate 42,43,44,45,46).
Quoted 4 lines
AFAIK, all our SoCs are using the same Aurora NB8800 Ethernet MAC, along with the extra features. I find it odd to use a specific SoC model to refer to this device, instead of a more generic name. (It's weird having to mention smp8640 in the tango4 DT.)
I picked 8640 since all 8640 or higher chips are compatible (863x chips (tango2) are not). Some of the later versions have additional extra features, but they all work with the basic driver.
There also appear to be some differences (bug fixes?) between 8643 and 8759 (the ones I have) not documented anywhere.
Quoted 3 lines
Would it be possible to have a compatible string which makes it clear that it is an Aurora MAC with vendor-specific tweaks? Something like "sigma,aurora-nb8800-mac" ?
This doesn't indicate which Sigma modifications are present. If the driver is at some point modified to take advantage of features/fixes in newer chips, it's good to have a naming scheme that can accommodate that.
For the SMP8759 devicetree, one could set the compatible list to "sigma,smp8759-ethernet", "sigma,smp8640-ethernet", "aurora,nb8800" indicating the exact device even if the driver currently doesn't care, that it is compatible with the 8640 baseline, and finally the plain aurora as a last fallback.
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +12
-0+- reg: Should be MMIO address space of the device +- interrupts: Should contain the interrupt specifier for the device +- interrupt-parent: Should be a phandle for the interrupt controller +- clocks: Should be a phandle for the clock for the device + +Common properties described in ethernet.txt: +- local-mac-address +- mac-address +- max-speed +- phy-mode + +Example:
Quoted 8 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt line 22
Quoted 5 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +5
-0+ +ethernet@26000 { + compatible = "aurora,nb8800"; + reg = <0x10000 0x800>; + interrupts = <42>;I thought one had to specify also whether the device sent "edge" or "level" IRQs?
Depends on the interrupt controller. This is just an example.
Signature · 6 lines
Måns Rullgård [email protected] -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
Quoted 42 lines · Måns Rullgård
Quoted 35 lines · Marc Gonzalez
Quoted 18 lines · Mans Rullgard
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
Signed-off-by Mans Rullgard <[email protected]>--- .../devicetree/bindings/net/aurora,nb8800.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/aurora,nb8800.txtDocumentation/devicetree/bindings/net/aurora,nb8800.txt new file +0
-0Documentation/devicetree/bindings/net/aurora,nb8800.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +5
-0@@ -0,0 +1,26 @@ +* Aurora VLSI AU-NB8800 Ethernet controller + +Required properties: +- compatible: Should be "aurora,nb8800", "sigma,smp8640-ethernet" + The latter indicates presence of extra features added by Sigma Designs.I've been meaning to ask a noob question to the devicetree group about how names for compatible strings are chosen.
Sigma Designs has two active SoC families, Tango3 (which consists of about a dozen MIPS-based SoCs, typically named SMP86xx) and Tango4 (a few ARM-based SoCs, typically named SMP87xx). I should note that there is no SMP8640 SoC AFAIK, rather SMP864x is a Tango3 sub-family (I could locate 42,43,44,45,46).
Quoted 4 lines
AFAIK, all our SoCs are using the same Aurora NB8800 Ethernet MAC, along with the extra features. I find it odd to use a specific SoC model to refer to this device, instead of a more generic name. (It's weird having to mention smp8640 in the tango4 DT.)
Quoted 6 lines
I picked 8640 since all 8640 or higher chips are compatible (863x chips (tango2) are not). Some of the later versions have additional extra features, but they all work with the basic driver.
There also appear to be some differences (bug fixes?) between 8643 and 8759 (the ones I have) not documented anywhere.
I'm trying to locate someone who would know these kinds of details.
Quoted 9 lines
Quoted 3 lines
Would it be possible to have a compatible string which makes it clear that it is an Aurora MAC with vendor-specific tweaks? Something like "sigma,aurora-nb8800-mac" ?
This doesn't indicate which Sigma modifications are present. If the driver is at some point modified to take advantage of features/fixes in newer chips, it's good to have a naming scheme that can accommodate that.
Quoted 5 lines
For the SMP8759 devicetree, one could set the compatible list to "sigma,smp8759-ethernet", "sigma,smp8640-ethernet", "aurora,nb8800" indicating the exact device even if the driver currently doesn't care, that it is compatible with the 8640 baseline, and finally the plain aurora as a last fallback.
I will update my vantage-1172 DT accordingly.
Quoted 4 lines
Quoted 2 lines
I thought one had to specify also whether the device sent "edge" or "level" IRQs?
Depends on the interrupt controller. This is just an example.
Sorry for the noise. (I thought edge/level was a device property, as in "I'll just pulse that IRQ, or I'll hold it until someone asks me to shut up.")
Regards.
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
Quoted 44 lines · Marc Gonzalez
Quoted 42 lines · Måns Rullgård
Quoted 39 lines · Marc Gonzalez
Quoted 18 lines · Mans Rullgard
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
Signed-off-by Mans Rullgard <[email protected]>--- .../devicetree/bindings/net/aurora,nb8800.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/aurora,nb8800.txtDocumentation/devicetree/bindings/net/aurora,nb8800.txt new file +0
-0Documentation/devicetree/bindings/net/aurora,nb8800.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/net/aurora,nb8800.txt new file +5
-0@@ -0,0 +1,26 @@ +* Aurora VLSI AU-NB8800 Ethernet controller + +Required properties: +- compatible: Should be "aurora,nb8800", "sigma,smp8640-ethernet" + The latter indicates presence of extra features added by Sigma Designs.I've been meaning to ask a noob question to the devicetree group about how names for compatible strings are chosen.
Sigma Designs has two active SoC families, Tango3 (which consists of about a dozen MIPS-based SoCs, typically named SMP86xx) and Tango4 (a few ARM-based SoCs, typically named SMP87xx). I should note that there is no SMP8640 SoC AFAIK, rather SMP864x is a Tango3 sub-family (I could locate 42,43,44,45,46).
AFAIK, all our SoCs are using the same Aurora NB8800 Ethernet MAC, along with the extra features. I find it odd to use a specific SoC model to refer to this device, instead of a more generic name. (It's weird having to mention smp8640 in the tango4 DT.)
Quoted 8 lines
Quoted 6 lines
I picked 8640 since all 8640 or higher chips are compatible (863x chips (tango2) are not). Some of the later versions have additional extra features, but they all work with the basic driver.
There also appear to be some differences (bug fixes?) between 8643 and 8759 (the ones I have) not documented anywhere.
I'm trying to locate someone who would know these kinds of details.
More specifically, the DMA completion interrupts seem to behave differently.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I thought one had to specify also whether the device sent "edge" or "level" IRQs?
Depends on the interrupt controller. This is just an example.
Sorry for the noise. (I thought edge/level was a device property, as in "I'll just pulse that IRQ, or I'll hold it until someone asks me to shut up.")
Most devices keep the interrupt request line high until explicitly cleared by a driver. Whether you want edge or level triggering depends on the driver design and if the interrupt is shared with other devices.
Signature · 6 lines
Måns Rullgård [email protected] -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
In reply to Florian FainelliQuoted 6 lines · Florian Fainelli
Quoted 3 lines · Mans Rullgard
This adds a driver for the Aurora VLSI NB8800 Ethernet controller. It is an almost complete rewrite of a driver originally found in a Sigma Designs 2.6.22 tree.
Some reviews here and there, mostly related to how you use the PHY library.
Thanks.
Quoted 7 lines
drivers/net/ethernet/aurora/nb8800.c line 413
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+nb8800_tx_dma_start (dev, next); + +if (!skb->xmit_more && !timer_pending (&priv->tx_reclaim_timer)) +mod_timer (&priv->tx_reclaim_timer, jiffies +HZ /20 );You do not have a TX completion interrupt? Using a timer to reclaim TX buffers is really not great for latency.
There is an interrupt, but dev_kfree_skb() can't be called from interrupt context, and running a tasklet for each packet has too much overhead. Someone suggested I use this approach. If there's a better way, I'm all ears.
Quoted 48 lines
Quoted 48 lines
drivers/net/ethernet/aurora/nb8800.c new file +48
-0+ +if (atomic_read (&priv->tx_free) <=NB8800_DESC_LOW ) +netif_stop_queue (dev); + +return NETDEV_TX_OK ; +} + +static void nb8800_tx_reclaim (unsigned long data) +{ +struct net_device *dev = (struct net_device *)data; +struct nb8800_priv *priv =netdev_priv (dev); +int packets =0 , bytes =0 ; +int reclaimed =0 ; +int dirty, limit; + + dirty =xchg (&priv->tx_dirty,-1 ); +if (dirty <0 ) +return ; + + limit = priv->tx_reclaim_limit; +if (dirty == limit) + goto end; + +while (dirty != limit) { +struct nb8800_dma_desc *tx = &priv->tx_descs[dirty]; +struct tx_buf *tx_buf = &priv->tx_bufs[dirty]; +struct sk_buff *skb = tx_buf->skb; +struct tx_skb_data *skb_data = (struct tx_skb_data *)skb->cb; +int frags = tx_buf->frags; + + packets++; + bytes += skb->len; + +dma_unmap_single (&dev->dev, skb_data->dma_addr, + skb_data->dma_len,DMA_TO_DEVICE ); +dev_kfree_skb (skb); + + tx->report =0 ; + tx_buf->skb =NULL ; + tx_buf->frags =0 ; + + dirty = (dirty + frags) & (TX_DESC_COUNT -1 ); + reclaimed += frags; + } + + priv->stats.tx_packets += packets; + priv->stats.tx_bytes += bytes; +
Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c line 465
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+smp_mb__before_atomic (); +atomic_add (reclaimed, &priv->tx_free); + +netif_wake_queue (dev);You can only wake up your queue if you have successfully reclaimed transmitted buffers, otherwise this is giving false information to the stack that there is room to push more packets.
The code is correct, if a bit unclear. I'll clean it up so it's obvious.
Quoted 8 lines
Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c new file +8
-0+static void nb8800_mac_config (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); + +if (priv->duplex) +nb8800_clear_bits (b, priv,NB8800_MAC_MODE ,HALF_DUPLEX ); +else +nb8800_set_bits (b, priv,NB8800_MAC_MODE ,HALF_DUPLEX );
Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c line 556
Quoted 5 lines
drivers/net/ethernet/aurora/nb8800.c new file +5
-0+ +if (priv->speed ==SPEED_1000 ) { +nb8800_set_bits (b, priv,NB8800_MAC_MODE , +RGMII_MODE |GMAC_MODE ); +nb8800_writeb (priv,NB8800_IC_THRESHOLD ,3 );What is the
IC_THRESHOLDvalue for? Is this some form of interrupt coalescing? If so, there is a proper ethtool interface to configure that.
It has something to do with some clocks, and this value is quite possibly wrong; it's what the original driver did. I'll do some tests.
Quoted 9 lines
drivers/net/ethernet/aurora/nb8800.c line 562
Quoted 6 lines
drivers/net/ethernet/aurora/nb8800.c new file +6
-0+nb8800_writeb (priv,NB8800_SLOT_TIME ,255 ); + }else { +nb8800_clear_bits (b, priv,NB8800_MAC_MODE , +RGMII_MODE |GMAC_MODE ); +nb8800_writeb (priv,NB8800_IC_THRESHOLD ,1 ); +nb8800_writeb (priv,NB8800_SLOT_TIME ,127 );What about if you link at 10Mbits/sec, would the slot time value still make sense here?
The documentation says the exact meaning on this register is different between gigabit and 10/100, so using the same value for 10 and 100 makes sense. Again, the values used here are from the original driver.
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c line 634
Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c new file +8
-0+static void nb8800_set_rx_mode (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); +struct netdev_hw_addr *ha; +int af_en; + +if ((dev->flags & (IFF_PROMISC |IFF_ALLMULTI )) || +netdev_mc_count (dev) >64 )64, that's pretty generous for a perfect match filter, nice.
That's bogus; I forgot to delete it. The hardware uses a 64-entry hash table, and whoever wrote the old driver apparently didn't understand how it works.
Quoted 4 lines
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+static void nb8800_tangox_init (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); +u32 val;
Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c line 879
Quoted 5 lines
drivers/net/ethernet/aurora/nb8800.c new file +5
-0+ + val =nb8800_readb (priv,NB8800_TANGOX_PAD_MODE ) &0x78 ; +if (priv->phydev->supported &PHY_1000BT_FEATURES ) + val |=1 ; +nb8800_writeb (priv,NB8800_TANGOX_PAD_MODE , val);Is this possibly a RGMII delay setting? If so, you need to look at
phydev->interface, not whether Gigabit is supported or not.
This does something to the configuration of the external pins, the documentation is vague about what.
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c line 1060
Quoted 2 lines
drivers/net/ethernet/aurora/nb8800.c new file +2
-0+ phydev =phy_find_first (bus); +if (!phydev ||phy_read (phydev,MII_BMSR ) <=0 ) {What is this additional
MII_MBSRread used for?
On one of my boards, phylib misdetects a phy on the second ethernet port even though there is none. Perhaps I should revisit that problem and look for a better solution.
Quoted 9 lines
Quoted 9 lines
drivers/net/ethernet/aurora/nb8800.c new file +9
-0+static int nb8800_remove (struct platform_device *pdev) +{ +struct net_device *ndev =platform_get_drvdata (pdev); +struct nb8800_priv *priv =netdev_priv (ndev); + +unregister_netdev (ndev); +free_irq (ndev->irq, ndev); + +phy_detach (priv->phydev);
Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c line 1156
Quoted 6 lines
drivers/net/ethernet/aurora/nb8800.c new file +6
-0+mdiobus_unregister (priv->mii_bus); + +clk_disable_unprepare (priv->clk); + +nb8800_dma_free (ndev); +free_netdev (ndev);Should not there be a tangox specific callback here to de-initialize the HW?
There's nothing specific to do for this hardware. It's easy enough to add a callback should any future hardware require it.
Signature · 2 lines
Måns Rullgård [email protected]
Re: [PATCH 3/3] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
Quoted 19 lines · Måns Rullgård
Quoted 6 lines · Florian Fainelli
Quoted 3 lines · Mans Rullgard
This adds a driver for the Aurora VLSI NB8800 Ethernet controller. It is an almost complete rewrite of a driver originally found in a Sigma Designs 2.6.22 tree.
Some reviews here and there, mostly related to how you use the PHY library.
Thanks.
Quoted 7 lines
drivers/net/ethernet/aurora/nb8800.c line 413
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+nb8800_tx_dma_start (dev, next); + +if (!skb->xmit_more && !timer_pending (&priv->tx_reclaim_timer)) +mod_timer (&priv->tx_reclaim_timer, jiffies +HZ /20 );You do not have a TX completion interrupt? Using a timer to reclaim TX buffers is really not great for latency.
Quoted 4 lines
There is an interrupt, but
dev_kfree_skb()can't be called from interrupt context, and running a tasklet for each packet has too much overhead. Someone suggested I use this approach. If there's a better way, I'm all ears.
But dev_kfree_skb_irq() works in interrupt context. Typically, what you would do, depending on your number or RX/TX queue is reclaim transmitted buffers in NAPI (softirq) context.
In your case, what you could do is use the RX or TX interrupt as an indication to schedule your napi poll routine and you would cleanup TX buffers first (cheap, and makes room for RX packets) and if there are RX packets to process, process them. No need for the tasklet then.
Quoted 58 lines
Quoted 49 lines
Quoted 49 lines
drivers/net/ethernet/aurora/nb8800.c new file +48
-0+ +if (atomic_read (&priv->tx_free) <=NB8800_DESC_LOW ) +netif_stop_queue (dev); + +return NETDEV_TX_OK ; +} + +static void nb8800_tx_reclaim (unsigned long data) +{ +struct net_device *dev = (struct net_device *)data; +struct nb8800_priv *priv =netdev_priv (dev); +int packets =0 , bytes =0 ; +int reclaimed =0 ; +int dirty, limit; + + dirty =xchg (&priv->tx_dirty,-1 ); +if (dirty <0 ) +return ; + + limit = priv->tx_reclaim_limit; +if (dirty == limit) + goto end; + +while (dirty != limit) { +struct nb8800_dma_desc *tx = &priv->tx_descs[dirty]; +struct tx_buf *tx_buf = &priv->tx_bufs[dirty]; +struct sk_buff *skb = tx_buf->skb; +struct tx_skb_data *skb_data = (struct tx_skb_data *)skb->cb; +int frags = tx_buf->frags; + + packets++; + bytes += skb->len; + +dma_unmap_single (&dev->dev, skb_data->dma_addr, + skb_data->dma_len,DMA_TO_DEVICE ); +dev_kfree_skb (skb); + + tx->report =0 ; + tx_buf->skb =NULL ; + tx_buf->frags =0 ; + + dirty = (dirty + frags) & (TX_DESC_COUNT -1 ); + reclaimed += frags; + } + + priv->stats.tx_packets += packets; + priv->stats.tx_bytes += bytes; +Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c line 465
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +4
-0+smp_mb__before_atomic (); +atomic_add (reclaimed, &priv->tx_free); + +netif_wake_queue (dev);You can only wake up your queue if you have successfully reclaimed transmitted buffers, otherwise this is giving false information to the stack that there is room to push more packets.
Quoted 1 line
The code is correct, if a bit unclear. I'll clean it up so it's obvious.
That's fine as-is, I missed the goto end at the beginning.
Quoted 31 lines
Quoted 17 lines
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c new file +3
-0+static void nb8800_mac_config (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev);drivers/net/ethernet/aurora/nb8800.c line 556
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c new file +10
-0+ +if (priv->duplex) +nb8800_clear_bits (b, priv,NB8800_MAC_MODE ,HALF_DUPLEX ); +else +nb8800_set_bits (b, priv,NB8800_MAC_MODE ,HALF_DUPLEX ); + +if (priv->speed ==SPEED_1000 ) { +nb8800_set_bits (b, priv,NB8800_MAC_MODE , +RGMII_MODE |GMAC_MODE ); +nb8800_writeb (priv,NB8800_IC_THRESHOLD ,3 );What is the
IC_THRESHOLDvalue for? Is this some form of interrupt coalescing? If so, there is a proper ethtool interface to configure that.It has something to do with some clocks, and this value is quite possibly wrong; it's what the original driver did. I'll do some tests.
Quoted 9 lines
drivers/net/ethernet/aurora/nb8800.c line 562
Quoted 6 lines
drivers/net/ethernet/aurora/nb8800.c new file +6
-0+nb8800_writeb (priv,NB8800_SLOT_TIME ,255 ); + }else { +nb8800_clear_bits (b, priv,NB8800_MAC_MODE , +RGMII_MODE |GMAC_MODE ); +nb8800_writeb (priv,NB8800_IC_THRESHOLD ,1 ); +nb8800_writeb (priv,NB8800_SLOT_TIME ,127 );What about if you link at 10Mbits/sec, would the slot time value still make sense here?
Quoted 3 lines
The documentation says the exact meaning on this register is different between gigabit and 10/100, so using the same value for 10 and 100 makes sense. Again, the values used here are from the original driver.
Fair enough.
Quoted 12 lines
Quoted 11 lines
drivers/net/ethernet/aurora/nb8800.c line 634
Quoted 9 lines
drivers/net/ethernet/aurora/nb8800.c new file +8
-0+static void nb8800_set_rx_mode (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); +struct netdev_hw_addr *ha; +int af_en; + +if ((dev->flags & (IFF_PROMISC |IFF_ALLMULTI )) || +netdev_mc_count (dev) >64 )64, that's pretty generous for a perfect match filter, nice.
Quoted 3 lines
That's bogus; I forgot to delete it. The hardware uses a 64-entry hash table, and whoever wrote the old driver apparently didn't understand how it works.
Might be best to put the interface in promiscuous mode until you have proper multicast support. Since this is for a Set-Top box chip, having proper multicast support still seems like something highly desirable.
Quoted 9 lines
Quoted 5 lines
drivers/net/ethernet/aurora/nb8800.c line 1060
Quoted 3 lines
drivers/net/ethernet/aurora/nb8800.c new file +2
-0+ phydev =phy_find_first (bus); +if (!phydev ||phy_read (phydev,MII_BMSR ) <=0 ) {What is this additional
MII_MBSRread used for?On one of my boards, phylib misdetects a phy on the second ethernet port even though there is none. Perhaps I should revisit that problem and look for a better solution.
I think that would be best, if you are currently using the Generic PHY driver, consider writing a specific driver which would take care of quirky behavior.
Signature · 1 line
Florian
Re: [PATCH 3/3] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
Quoted 11 lines · Florian Fainelli
Quoted 11 lines
Quoted 10 lines
drivers/net/ethernet/aurora/nb8800.c line 634
Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c new file +8
-0+static void nb8800_set_rx_mode (struct net_device *dev) +{ +struct nb8800_priv *priv =netdev_priv (dev); +struct netdev_hw_addr *ha; +int af_en; + +if ((dev->flags & (IFF_PROMISC |IFF_ALLMULTI )) || +netdev_mc_count (dev) >64 )64, that's pretty generous for a perfect match filter, nice.
Quoted 7 lines
Quoted 3 lines
That's bogus; I forgot to delete it. The hardware uses a 64-entry hash table, and whoever wrote the old driver apparently didn't understand how it works.
Might be best to put the interface in promiscuous mode until you have proper multicast support. Since this is for a Set-Top box chip, having proper multicast support still seems like something highly desirable.
The code below should work correctly with any number of multicast addresses.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
drivers/net/ethernet/aurora/nb8800.c line 1060
Quoted 2 lines
drivers/net/ethernet/aurora/nb8800.c new file +2
-0+ phydev =phy_find_first (bus); +if (!phydev ||phy_read (phydev,MII_BMSR ) <=0 ) {What is this additional
MII_MBSRread used for?
Quoted 7 lines
Quoted 3 lines
On one of my boards, phylib misdetects a phy on the second ethernet port even though there is none. Perhaps I should revisit that problem and look for a better solution.
I think that would be best, if you are currently using the Generic PHY driver, consider writing a specific driver which would take care of quirky behavior.
The problem is that there is no PHY, yet for some reason reading the ID registers appears to succeed.
Signature · 2 lines
Måns Rullgård [email protected]
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
In reply to Måns RullgårdQuoted 10 lines · Måns Rullgård
Quoted 8 lines · Marc Gonzalez
Quoted 5 lines · Mans Rullgard
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
Quoted 8 lines
Quoted 8 lines
I've been meaning to ask a noob question to the devicetree group about how names for compatible strings are chosen.
Sigma Designs has two active SoC families, Tango3 (which consists of about a dozen MIPS-based SoCs, typically named SMP86xx) and Tango4 (a few ARM-based SoCs, typically named SMP87xx). I should note that there is no SMP8640 SoC AFAIK, rather SMP864x is a Tango3 sub-family (I could locate 42,43,44,45,46).
Just to make things a bit more confusing, I learned that Sigma made one MIPS-based Tango4 SoC...
Quoted 8 lines
Quoted 4 lines
AFAIK, all our SoCs are using the same Aurora NB8800 Ethernet MAC, along with the extra features. I find it odd to use a specific SoC model to refer to this device, instead of a more generic name. (It's weird having to mention smp8640 in the tango4 DT.)
I picked 8640 since all 8640 or higher chips are compatible (863x chips (tango2) are not). Some of the later versions have additional extra features, but they all work with the basic driver.
According to my branch's FAEs, the first Tango3 was SMP8644. I showed the DT to a colleague, and his reaction was: "Don't use smp8640, it will confuse other engineers, Sigma didn't make a 8640 SoC."
http://www.qobuz.com/info/IMG/pdf/SMP8643.pdf
Would you be willing to change the compatible string to "sigma,smp8644-foo" or "sigma,smp864x-foo" ?
If it's not possible, I suppose I can add comments in the DT, to clear the potential confusion for Sigma engineers.
Quoted 2 lines
There also appear to be some differences (bug fixes?) between 8643 and 8759 (the ones I have) not documented anywhere.
Suppose you identify these differences, and you make the appropriate changes to the driver. What compatible string would you use to refer to the new features? I used "sigma,tango4-ethernet" but IIUC it must be more specific, such as the first Tango4 chip to implement these changes (I guess that would be the SMP8734).
So I should write something like this in my DT?
eth0: ethernet@26000 {
compatible = "sigma,smp8734-ethernet", "sigma,smp8640-ethernet", "aurora,nb8800";Hmmm, you mention this below, but you used "sigma,smp8759-ethernet". What about earlier chips?
Quoted 9 lines
Quoted 3 lines
Would it be possible to have a compatible string which makes it clear that it is an Aurora MAC with vendor-specific tweaks? Something like "sigma,aurora-nb8800-mac" ?
This doesn't indicate which Sigma modifications are present. If the driver is at some point modified to take advantage of features/fixes in newer chips, it's good to have a naming scheme that can accommodate that.
Quoted 5 lines
For the SMP8759 devicetree, one could set the compatible list to "sigma,smp8759-ethernet", "sigma,smp8640-ethernet", "aurora,nb8800" indicating the exact device even if the driver currently doesn't care, that it is compatible with the 8640 baseline, and finally the plain aurora as a last fallback.
[Preserved for context]
Regards.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
Quoted 15 lines · Marc Gonzalez
Quoted 13 lines · Måns Rullgård
Quoted 11 lines · Marc Gonzalez
Quoted 5 lines · Mans Rullgard
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
I've been meaning to ask a noob question to the devicetree group about how names for compatible strings are chosen.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Sigma Designs has two active SoC families, Tango3 (which consists of about a dozen MIPS-based SoCs, typically named SMP86xx) and Tango4 (a few ARM-based SoCs, typically named SMP87xx). I should note that there is no SMP8640 SoC AFAIK, rather SMP864x is a Tango3 sub-family (I could locate 42,43,44,45,46).
Just to make things a bit more confusing, I learned that Sigma made one MIPS-based Tango4 SoC...
That explains the presence of tango4 mentions in a Sigma MIPS kernel tree I found. Do you know what it was called?
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
AFAIK, all our SoCs are using the same Aurora NB8800 Ethernet MAC, along with the extra features. I find it odd to use a specific SoC model to refer to this device, instead of a more generic name. (It's weird having to mention smp8640 in the tango4 DT.)
I picked 8640 since all 8640 or higher chips are compatible (863x chips (tango2) are not). Some of the later versions have additional extra features, but they all work with the basic driver.
According to my branch's FAEs, the first Tango3 was SMP8644.
I don't know which was first out the door, but judging by marketing materials, 8642, 8644, and 8646 were available around the same time. All of these also have an odd-numbered variant (8643 etc) without Macrovision features.
Quoted 11 lines
I showed the DT to a colleague, and his reaction was: "Don't use smp8640, it will confuse other engineers, Sigma didn't make a 8640 SoC."
http://www.qobuz.com/info/IMG/pdf/SMP8643.pdf
Would you be willing to change the compatible string to "sigma,smp8644-foo" or "sigma,smp864x-foo" ?
If it's not possible, I suppose I can add comments in the DT, to clear the potential confusion for Sigma engineers.
My intent was certainly not to confuse. Sigma product brochures talk about the "SMP8640 series," so I figured that would be a good way of referring to them as a group. See e.g. this PDF, now gone from the main sigmadesigns.com site:
http://wayback.archive.org/web/20150101024010/http://www.sigmadesigns.com/uploads/documents/selection_guide.pdf
Quoted 8 lines
Quoted 2 lines
There also appear to be some differences (bug fixes?) between 8643 and 8759 (the ones I have) not documented anywhere.
Suppose you identify these differences, and you make the appropriate changes to the driver. What compatible string would you use to refer to the new features? I used "sigma,tango4-ethernet" but IIUC it must be more specific, such as the first Tango4 chip to implement these changes (I guess that would be the SMP8734).
There are differences even within the tango3 family. The SMP867x chips have features not present on the earlier ones. The tango3 and tango4 codenames are too unspecific to be of use here. It's better to use exact chip designations.
Quoted 7 lines
So I should write something like this in my DT?
eth0: ethernet@26000 { compatible = "sigma,smp8734-ethernet", "sigma,smp8640-ethernet", "aurora,nb8800";Hmmm, you mention this below, but you used "sigma,smp8759-ethernet". What about earlier chips?
OK, how about this scheme then:
- Device trees list the exact chip, the chip family, the oldest compatible family, and finally the basic "aurora,nb8800". For the SMP8759 that would look like this:
"sigma,smp8759-ethernet", "sigma,smp87xx-ethernet", "sigma,smp864x-ethernet",
"aurora,nb8800"
- Drivers match against whatever they need to in order to safely identify features. If the driver finds a match for e.g. "sigma,smp864x-ethernet" it is allowed to make use of any features present in all chips of that family (even if the actual chip is a later one, the DT says it's compatible). If a specific chip is found to need a bug workaround or whatever, the driver can enable that by matching on the exact string.
This approach means that if the driver is updated to support newer features, no change is needed to the devicetree, and if a new chip shows up, say a hypothetical smp8764, a driver with support for the smp87xx family will automatically recognise it without changes. Unfortunately the 863x (tango2) chips are not compatible with 864x and later, so it's not safe to use a catch-all smp86xx.
Speaking more generally about device trees, for chip families like this, it can be a good solution to have all the common parts in, say, smp87xx.dtsi which is included by chip-specific files, i.e. smp8734.dtsi and smp8759.dtsi, with overrides and additions as necessary. These files can then be included by the actual board files such as smp8759-vantage.dts which can apply further tweaks and add nodes for off-chip peripherals.
Signature · 6 lines
Måns Rullgård [email protected] -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
Quoted 23 lines · Måns Rullgård
Quoted 21 lines · Marc Gonzalez
Quoted 18 lines · Måns Rullgård
Quoted 16 lines · Marc Gonzalez
Quoted 5 lines · Mans Rullgard
This adds a binding for the Aurora VLSI NB8800 Ethernet controller using the "aurora,nb8800" compatible string. When used in Sigma Designs chips a few additional control registers are available. This variant is indicated by the "sigma,smp8640-ethernet" compatible string.
I've been meaning to ask a noob question to the devicetree group about how names for compatible strings are chosen.
Sigma Designs has two active SoC families, Tango3 (which consists of about a dozen MIPS-based SoCs, typically named SMP86xx) and Tango4 (a few ARM-based SoCs, typically named SMP87xx). I should note that there is no SMP8640 SoC AFAIK, rather SMP864x is a Tango3 sub-family (I could locate 42,43,44,45,46).
Quoted 5 lines
Quoted 2 lines
Just to make things a bit more confusing, I learned that Sigma made one MIPS-based Tango4 SoC...
That explains the presence of tango4 mentions in a Sigma MIPS kernel tree I found. Do you know what it was called?
It was called smp8910. (They broke the naming convention, but at least it's clearly set apart from other "normal" chips.)
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
AFAIK, all our SoCs are using the same Aurora NB8800 Ethernet MAC, along with the extra features. I find it odd to use a specific SoC model to refer to this device, instead of a more generic name. (It's weird having to mention smp8640 in the tango4 DT.)
I picked 8640 since all 8640 or higher chips are compatible (863x chips (tango2) are not). Some of the later versions have additional extra features, but they all work with the basic driver.
Quoted 6 lines
Quoted 1 line
According to my branch's FAEs, the first Tango3 was SMP8644.
I don't know which was first out the door, but judging by marketing materials, 8642, 8644, and 8646 were available around the same time. All of these also have an odd-numbered variant (8643 etc) without Macrovision features.
The only difference between chips '2N' and '2N+1' used to be Macrovision support... But the rule was broken for smp8759, which has more features than smp8758 (e.g. HDMI-in and PCIe)
Quoted 27 lines
Quoted 11 lines
I showed the DT to a colleague, and his reaction was: "Don't use smp8640, it will confuse other engineers, Sigma didn't make a 8640 SoC."
http://www.qobuz.com/info/IMG/pdf/SMP8643.pdf
Would you be willing to change the compatible string to "sigma,smp8644-foo" or "sigma,smp864x-foo" ?
If it's not possible, I suppose I can add comments in the DT, to clear the potential confusion for Sigma engineers.
My intent was certainly not to confuse. Sigma product brochures talk about the "SMP8640 series," so I figured that would be a good way of referring to them as a group. See e.g. this PDF, now gone from the main sigmadesigns.com site:
http://wayback.archive.org/web/20150101024010/http://www.sigmadesigns.com/uploads/documents/selection_guide.pdfQuoted 8 lines
Quoted 2 lines
There also appear to be some differences (bug fixes?) between 8643 and 8759 (the ones I have) not documented anywhere.
Suppose you identify these differences, and you make the appropriate changes to the driver. What compatible string would you use to refer to the new features? I used "sigma,tango4-ethernet" but IIUC it must be more specific, such as the first Tango4 chip to implement these changes (I guess that would be the SMP8734).
Quoted 4 lines
There are differences even within the tango3 family. The SMP867x chips have features not present on the earlier ones. The tango3 and tango4 codenames are too unspecific to be of use here. It's better to use exact chip designations.
OK.
Quoted 8 lines
Quoted 7 lines
So I should write something like this in my DT?
eth0: ethernet@26000 { compatible = "sigma,smp8734-ethernet", "sigma,smp8640-ethernet", "aurora,nb8800";Hmmm, you mention this below, but you used "sigma,smp8759-ethernet". What about earlier chips?
Quoted 7 lines
OK, how about this scheme then:
- Device trees list the exact chip, the chip family, the oldest compatible family, and finally the basic "aurora,nb8800". For the SMP8759 that would look like this:
"sigma,smp8759-ethernet", "sigma,smp87xx-ethernet", "sigma,smp864x-ethernet","aurora,nb8800"
AFAICT, the list of tango4 chips is (in chronological order)
8910, 8734, 8756, 8758, 8759
The problem I see is that Sigma already has plans for non-tango4 87xx SoCs (two in fact: 8760 and 8762, as far as I've heard). (What a mess.)
I would think the "chip family" needs to use the code-name like tango3 or tango4 (for lack of a better discriminant).
Also, (purely hypothetical) suppose something changed in 8756 and up. How would the 8758 pick up the improvement, but not the 8734?
I'm also confused, because I thought I read somewhere not to use wildcards in compatible strings... <Looking> It was there:
http://devicetree.org/Device_Tree_Usage#Understanding_the_compatible_Property
(Sorry, some of this stuff is a bit hard for me to grok.)
Finally, I think what you decide to do can also be done for the interrupt controller, right?
Quoted 15 lines
- Drivers match against whatever they need to in order to safely identify features. If the driver finds a match for e.g. "sigma,smp864x-ethernet" it is allowed to make use of any features present in all chips of that family (even if the actual chip is a later one, the DT says it's compatible). If a specific chip is found to need a bug workaround or whatever, the driver can enable that by matching on the exact string.
This approach means that if the driver is updated to support newer features, no change is needed to the devicetree, and if a new chip shows up, say a hypothetical smp8764, a driver with support for the smp87xx family will automatically recognise it without changes. Unfortunately the 863x (tango2) chips are not compatible with 864x and later, so it's not safe to use a catch-all smp86xx.
Quoted 7 lines
Speaking more generally about device trees, for chip families like this, it can be a good solution to have all the common parts in, say,
smp87xx.dtsiwhich is included by chip-specific files, i.e.smp8734.dtsiandsmp8759.dtsi, with overrides and additions as necessary. These files can then be included by the actual board files such assmp8759-vantage.dtswhich can apply further tweaks and add nodes for off-chip peripherals.
I think my brain is having a device tree indigestion :-( Maybe things will clear up in a few hours.
Regards.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
Quoted 27 lines · Marc Gonzalez
Quoted 8 lines
Quoted 7 lines
So I should write something like this in my DT?
eth0: ethernet@26000 { compatible = "sigma,smp8734-ethernet", "sigma,smp8640-ethernet", "aurora,nb8800";Hmmm, you mention this below, but you used "sigma,smp8759-ethernet". What about earlier chips?
Quoted 7 lines
OK, how about this scheme then:
- Device trees list the exact chip, the chip family, the oldest compatible family, and finally the basic "aurora,nb8800". For the SMP8759 that would look like this:
"sigma,smp8759-ethernet", "sigma,smp87xx-ethernet", "sigma,smp864x-ethernet","aurora,nb8800"AFAICT, the list of tango4 chips is (in chronological order)
8910, 8734, 8756, 8758, 8759
The problem I see is that Sigma already has plans for non-tango4 87xx SoCs (two in fact: 8760 and 8762, as far as I've heard). (What a mess.)
I would think the "chip family" needs to use the code-name like tango3 or tango4 (for lack of a better discriminant).
Quoted 7 lines
Also, (purely hypothetical) suppose something changed in 8756 and up. How would the 8758 pick up the improvement, but not the 8734?
I'm also confused, because I thought I read somewhere not to use wildcards in compatible strings... <Looking> It was there:
http://devicetree.org/Device_Tree_Usage#Understanding_the_compatible_Property
(Sorry, some of this stuff is a bit hard for me to grok.)
Right, and you just illustrated why wildcards are bad. Sorry for the confusion. I should have known better than to look at existing bindings. Let's drop that idea.
Let's try something else:
Device trees list the exact chip, the oldest chip with the same features, and the oldest compatible chip. From the sound of things, that means the smp8759 should use "sigma,smp8759-ethernet", "sigma,smp8910-ethernet", "sigma,smp8642-ethernet", "aurora,nb8800".
Quoted 2 lines
Finally, I think what you decide to do can also be done for the interrupt controller, right?
Sure, the same scheme should be used for all on-chip devices.
Signature · 2 lines
Måns Rullgård [email protected]
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
Quoted 6 lines · Måns Rullgård
Let's try something else:
Device trees list the exact chip, the oldest chip with the same features, and the oldest compatible chip. From the sound of things, that means the smp8759 should use "sigma,smp8759-ethernet", "sigma,smp8910-ethernet", "sigma,smp8642-ethernet", "aurora,nb8800".
(I want to make sure I didn't misunderstand.) In my hypothetical example where something changed in 8756 and up...
for a 8734 DT, I would specify: smp8734, smp8910, smp8642, nb8800 for a 8758 DT, I would specify: smp8758, smp8756, smp8642, nb8800
Is that correct? If yes, that works for me.
Regards.
Re: [PATCH 2/3] devicetree: add binding for Aurora VLSI NB8800 Ethernet controller
Quoted 9 lines · Marc Gonzalez
Quoted 6 lines · Måns Rullgård
Let's try something else:
Device trees list the exact chip, the oldest chip with the same features, and the oldest compatible chip. From the sound of things, that means the smp8759 should use "sigma,smp8759-ethernet", "sigma,smp8910-ethernet", "sigma,smp8642-ethernet", "aurora,nb8800".
Quoted 5 lines
(I want to make sure I didn't misunderstand.) In my hypothetical example where something changed in 8756 and up...
for a 8734 DT, I would specify: smp8734, smp8910, smp8642, nb8800 for a 8758 DT, I would specify: smp8758, smp8756, smp8642, nb8800
If the 8756 were still compatible with 8910 (which has features not in 8642), it should include both. The list gets long, but it's probably the least maintenance in the end.
Signature · 2 lines
Måns Rullgård [email protected]