net: sgi: ioc3-eth: two changes for the IOC3 on SGI IP35 machines
Subsystems (4)
v2 cover net: sgi: ioc3-eth: two changes for the IOC3 on SGI IP35 machines
These two changes let ioc3-eth drive the IOC3 of the SGI Fuel, which sits behind an XBridge and has no MAC PROM. They were part of the IP35 support series, which supplies the window addresses; its next version attaches the MAC property. Neither side has a build dependency on the other.
Tested on an SGI Fuel.
---
Changes in v2:
- Patch 2 takes the address from a device property instead of the platform hook, and drops the random address fallback.
- Patch 1's message no longer reads as a fix for existing systems.
v1: https://lore.kernel.org/all/[email protected]/
Imre Kaloz (2):
net: sgi: ioc3-eth: apply the DMA attributes only to 64-bit addresses
net: sgi: ioc3-eth: take the MAC address from a device property
drivers/net/ethernet/sgi/ioc3-eth.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
base-commit: 7ccc5e05043b1bb84326b19a2b05938d8f7a2ae6
Signature · 1 line
2.47.3
PATCH v2 1/2 net: sgi: ioc3-eth: apply the DMA attributes only to 64-bit addresses
A Bridge 32-bit direct window address carries no target widget, so DMA attributes OR-ed onto it aim it at widget 0. IP27 and IP30 only hand the IOC3 64-bit direct addresses; IP35 support will hand it window addresses.
--- drivers/net/ethernet/sgi/ioc3-eth.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/net/ethernet/sgi/ioc3-eth.c +21 -3
@@ -152,19 +152,37 @@ static inline int ioc3_alloc_skb(struct ioc3_private *ip, struct sk_buff **skb, }#ifdef CONFIG_PCI_XTALK_BRIDGE +/* A Bridge 64-bit direct-mapped DMA address carries the target widget in +* bits 63:60 and the DMA attributes below it. An address in the 32-bit +* direct window carries neither, so attributes OR-ed onto one form a +* 64-bit address aimed at widget 0. +*/ static inline unsigned long ioc3_map (dma_addr_t addr,unsigned long attr) { +if (!(addr &PCI64_ATTR_TARG_MASK )) +return addr; +return (addr & ~PCI64_ATTR_BAR ) | attr; } -#define ERBAR_VAL (ERBAR_BARRIER_BIT << ERBAR_RXBARR_SHIFT) +/* The RX barrier's upper address bits follow the same form. */ +static inline u32 ioc3_erbar (dma_addr_t addr) +{ +if (!(addr &PCI64_ATTR_TARG_MASK )) +return 0 ; + +return ERBAR_BARRIER_BIT <<ERBAR_RXBARR_SHIFT ; +}#else static inline unsigned long ioc3_map (dma_addr_t addr,unsigned long attr) {return addr; } -#define ERBAR_VAL 0 +static inline u32 ioc3_erbar (dma_addr_t addr) +{ +return 0 ; +}#endif static int ioc3eth_nvmem_match (struct device *dev,const void *data)
@@ -727,7 +745,7 @@ static void ioc3_init(struct net_device *dev)readl (®s->emcr);/* Misc registers */ -writel (ERBAR_VAL , ®s->erbar); +writel (ioc3_erbar (ip->rxr_dma), ®s->erbar);readl (®s->etcdc);/* Clear on read */ writel (15 , ®s->ercsr);/* RX low watermark */ writel (0 , ®s->ertr);/* Interrupt immediately */
Signature · 1 line
2.47.3
PATCH v2 2/2 net: sgi: ioc3-eth: take the MAC address from a device property
In reply to Imre KalozSome boards have no MAC PROM on the IOC3's 1-wire bus, and the probe defers forever there. Let the platform supply the address as a device property for such a board.
--- drivers/net/ethernet/sgi/ioc3-eth.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/sgi/ioc3-eth.c +3 -2
@@ -857,8 +857,9 @@ static int ioc3eth_probe(struct platform_device *pdev)dev_err (&pdev->dev,"Invalid resource\n" );return -EINVAL ; } -/* get mac addr from one wire prom */ -if (ioc3eth_get_mac_addr (regs, mac_addr)) +/* get mac addr from one wire prom, or from a device property */ +if (ioc3eth_get_mac_addr (regs, mac_addr) && +device_get_mac_address (&pdev->dev, mac_addr))return -EPROBE_DEFER ;/* not available yet */ dev =alloc_etherdev (sizeof (struct ioc3_private ));
Signature · 1 line
2.47.3