X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fnet%2Fsunhme.c;h=b4e7f30ea4e8c1d9d186ee91b55c41925136bb9d;hb=983e23041b28abb113862b2935a85cfb9aab4f5a;hp=8b35f13318ea4b9e02b87644ed955a897985219d;hpb=39fe5434cb9de5da40510028b17b96bc4eb312b3;p=linux-2.6-omap-h63xx.git diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index 8b35f13318e..b4e7f30ea4e 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c @@ -194,21 +194,21 @@ static u32 sbus_hme_read32(void __iomem *reg) static void sbus_hme_write_rxd(struct happy_meal_rxd *rxd, u32 flags, u32 addr) { - rxd->rx_addr = addr; + rxd->rx_addr = (__force hme32)addr; wmb(); - rxd->rx_flags = flags; + rxd->rx_flags = (__force hme32)flags; } static void sbus_hme_write_txd(struct happy_meal_txd *txd, u32 flags, u32 addr) { - txd->tx_addr = addr; + txd->tx_addr = (__force hme32)addr; wmb(); - txd->tx_flags = flags; + txd->tx_flags = (__force hme32)flags; } -static u32 sbus_hme_read_desc32(u32 *p) +static u32 sbus_hme_read_desc32(hme32 *p) { - return *p; + return (__force u32)*p; } static void pci_hme_write32(void __iomem *reg, u32 val) @@ -223,21 +223,21 @@ static u32 pci_hme_read32(void __iomem *reg) static void pci_hme_write_rxd(struct happy_meal_rxd *rxd, u32 flags, u32 addr) { - rxd->rx_addr = cpu_to_le32(addr); + rxd->rx_addr = (__force hme32)cpu_to_le32(addr); wmb(); - rxd->rx_flags = cpu_to_le32(flags); + rxd->rx_flags = (__force hme32)cpu_to_le32(flags); } static void pci_hme_write_txd(struct happy_meal_txd *txd, u32 flags, u32 addr) { - txd->tx_addr = cpu_to_le32(addr); + txd->tx_addr = (__force hme32)cpu_to_le32(addr); wmb(); - txd->tx_flags = cpu_to_le32(flags); + txd->tx_flags = (__force hme32)cpu_to_le32(flags); } -static u32 pci_hme_read_desc32(u32 *p) +static u32 pci_hme_read_desc32(hme32 *p) { - return cpu_to_le32p(p); + return le32_to_cpup((__le32 *)p); } #define hme_write32(__hp, __reg, __val) \ @@ -266,16 +266,16 @@ static u32 pci_hme_read_desc32(u32 *p) #define hme_read32(__hp, __reg) \ sbus_readl(__reg) #define hme_write_rxd(__hp, __rxd, __flags, __addr) \ -do { (__rxd)->rx_addr = (__addr); \ +do { (__rxd)->rx_addr = (__force hme32)(u32)(__addr); \ wmb(); \ - (__rxd)->rx_flags = (__flags); \ + (__rxd)->rx_flags = (__force hme32)(u32)(__flags); \ } while(0) #define hme_write_txd(__hp, __txd, __flags, __addr) \ -do { (__txd)->tx_addr = (__addr); \ +do { (__txd)->tx_addr = (__force hme32)(u32)(__addr); \ wmb(); \ - (__txd)->tx_flags = (__flags); \ + (__txd)->tx_flags = (__force hme32)(u32)(__flags); \ } while(0) -#define hme_read_desc32(__hp, __p) (*(__p)) +#define hme_read_desc32(__hp, __p) ((__force u32)(hme32)*(__p)) #define hme_dma_map(__hp, __ptr, __size, __dir) \ sbus_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) #define hme_dma_unmap(__hp, __addr, __size, __dir) \ @@ -291,16 +291,19 @@ do { (__txd)->tx_addr = (__addr); \ #define hme_read32(__hp, __reg) \ readl(__reg) #define hme_write_rxd(__hp, __rxd, __flags, __addr) \ -do { (__rxd)->rx_addr = cpu_to_le32(__addr); \ +do { (__rxd)->rx_addr = (__force hme32)cpu_to_le32(__addr); \ wmb(); \ - (__rxd)->rx_flags = cpu_to_le32(__flags); \ + (__rxd)->rx_flags = (__force hme32)cpu_to_le32(__flags); \ } while(0) #define hme_write_txd(__hp, __txd, __flags, __addr) \ -do { (__txd)->tx_addr = cpu_to_le32(__addr); \ +do { (__txd)->tx_addr = (__force hme32)cpu_to_le32(__addr); \ wmb(); \ - (__txd)->tx_flags = cpu_to_le32(__flags); \ + (__txd)->tx_flags = (__force hme32)cpu_to_le32(__flags); \ } while(0) -#define hme_read_desc32(__hp, __p) cpu_to_le32p(__p) +static inline u32 hme_read_desc32(struct happy_meal *hp, hme32 *p) +{ + return le32_to_cpup((__le32 *)p); +} #define hme_dma_map(__hp, __ptr, __size, __dir) \ pci_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) #define hme_dma_unmap(__hp, __addr, __size, __dir) \ @@ -1281,7 +1284,7 @@ static void happy_meal_init_rings(struct happy_meal *hp) skb->dev = dev; /* Because we reserve afterwards. */ - skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET)); + skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); hme_write_rxd(hp, &hb->happy_meal_rxd[i], (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)), hme_dma_map(hp, skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE)); @@ -1700,6 +1703,11 @@ static int happy_meal_init(struct happy_meal *hp) HMD(("tx old[%08x] and rx [%08x] ON!\n", hme_read32(hp, bregs + BMAC_TXCFG), hme_read32(hp, bregs + BMAC_RXCFG))); + + /* Set larger TX/RX size to allow for 802.1q */ + hme_write32(hp, bregs + BMAC_TXMAX, ETH_FRAME_LEN + 8); + hme_write32(hp, bregs + BMAC_RXMAX, ETH_FRAME_LEN + 8); + hme_write32(hp, bregs + BMAC_TXCFG, hme_read32(hp, bregs + BMAC_TXCFG) | BIGMAC_TXCFG_ENABLE); hme_write32(hp, bregs + BMAC_RXCFG, @@ -2039,7 +2047,7 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) hme_dma_unmap(hp, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE); hp->rx_skbs[elem] = new_skb; new_skb->dev = dev; - skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET)); + skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); hme_write_rxd(hp, this, (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), hme_dma_map(hp, new_skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE)); @@ -2070,7 +2078,7 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) } /* This card is _fucking_ hot... */ - skb->csum = ntohs(csum ^ 0xffff); + skb->csum = csum_unfold(~(__force __sum16)htons(csum)); skb->ip_summed = CHECKSUM_COMPLETE; RXD(("len=%d csum=%4x]", len, csum)); @@ -2664,6 +2672,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe struct net_device *dev; int i, qfe_slot = -1; int err = -ENODEV; + DECLARE_MAC_BUF(mac); if (is_qfe) { qp = quattro_sbus_find(sdev); @@ -2680,7 +2689,6 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe dev = alloc_etherdev(sizeof(struct happy_meal)); if (!dev) goto err_out; - SET_MODULE_OWNER(dev); SET_NETDEV_DEV(dev, &sdev->ofdev.dev); if (hme_version_printed++ == 0) @@ -2809,8 +2817,8 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe dev->watchdog_timeo = 5*HZ; dev->ethtool_ops = &hme_ethtool_ops; - /* Happy Meal can do it all... except VLAN. */ - dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_VLAN_CHALLENGED; + /* Happy Meal can do it all... */ + dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; dev->irq = sdev->irqs[0]; @@ -2851,10 +2859,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe printk(KERN_INFO "%s: HAPPY MEAL (SBUS) 10/100baseT Ethernet ", dev->name); - for (i = 0; i < 6; i++) - printk("%2.2x%c", - dev->dev_addr[i], i == 5 ? ' ' : ':'); - printk("\n"); + printk("%s\n", print_mac(mac, dev->dev_addr)); return 0; @@ -2989,6 +2994,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev, int i, qfe_slot = -1; char prom_name[64]; int err; + DECLARE_MAC_BUF(mac); /* Now make sure pci_dev cookie is there. */ #ifdef CONFIG_SPARC @@ -3022,7 +3028,6 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev, err = -ENOMEM; if (!dev) goto err_out; - SET_MODULE_OWNER(dev); SET_NETDEV_DEV(dev, &pdev->dev); if (hme_version_printed++ == 0) @@ -3055,7 +3060,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev, goto err_out_clear_quattro; } - if ((hpreg_base = ioremap(hpreg_res, 0x8000)) == 0) { + if ((hpreg_base = ioremap(hpreg_res, 0x8000)) == NULL) { printk(KERN_ERR "happymeal(PCI): Unable to remap card memory.\n"); goto err_out_free_res; } @@ -3203,10 +3208,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev, printk(KERN_INFO "%s: HAPPY MEAL (PCI/CheerIO) 10/100BaseT Ethernet ", dev->name); - for (i = 0; i < 6; i++) - printk("%2.2x%c", dev->dev_addr[i], i == 5 ? ' ' : ':'); - - printk("\n"); + printk("%s\n", print_mac(mac, dev->dev_addr)); return 0;