diff options
Diffstat (limited to 'drivers/net/sungem.c')
-rw-r--r-- | drivers/net/sungem.c | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 08ea61db46fe..5da73212ac91 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -64,11 +64,9 @@ | |||
64 | #include <asm/uaccess.h> | 64 | #include <asm/uaccess.h> |
65 | #include <asm/irq.h> | 65 | #include <asm/irq.h> |
66 | 66 | ||
67 | #ifdef __sparc__ | 67 | #ifdef CONFIG_SPARC |
68 | #include <asm/idprom.h> | 68 | #include <asm/idprom.h> |
69 | #include <asm/openprom.h> | 69 | #include <asm/prom.h> |
70 | #include <asm/oplib.h> | ||
71 | #include <asm/pbm.h> | ||
72 | #endif | 70 | #endif |
73 | 71 | ||
74 | #ifdef CONFIG_PPC_PMAC | 72 | #ifdef CONFIG_PPC_PMAC |
@@ -845,11 +843,10 @@ static int gem_rx(struct gem *gp, int work_to_do) | |||
845 | goto drop_it; | 843 | goto drop_it; |
846 | } | 844 | } |
847 | 845 | ||
848 | copy_skb->dev = gp->dev; | ||
849 | skb_reserve(copy_skb, 2); | 846 | skb_reserve(copy_skb, 2); |
850 | skb_put(copy_skb, len); | 847 | skb_put(copy_skb, len); |
851 | pci_dma_sync_single_for_cpu(gp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); | 848 | pci_dma_sync_single_for_cpu(gp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); |
852 | memcpy(copy_skb->data, skb->data, len); | 849 | skb_copy_from_linear_data(skb, copy_skb->data, len); |
853 | pci_dma_sync_single_for_device(gp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); | 850 | pci_dma_sync_single_for_device(gp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); |
854 | 851 | ||
855 | /* We'll reuse the original ring buffer. */ | 852 | /* We'll reuse the original ring buffer. */ |
@@ -1029,10 +1026,8 @@ static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1029 | 1026 | ||
1030 | ctrl = 0; | 1027 | ctrl = 0; |
1031 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1028 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1032 | u64 csum_start_off, csum_stuff_off; | 1029 | const u64 csum_start_off = skb_transport_offset(skb); |
1033 | 1030 | const u64 csum_stuff_off = csum_start_off + skb->csum_offset; | |
1034 | csum_start_off = (u64) (skb->h.raw - skb->data); | ||
1035 | csum_stuff_off = csum_start_off + skb->csum_offset; | ||
1036 | 1031 | ||
1037 | ctrl = (TXDCTRL_CENAB | | 1032 | ctrl = (TXDCTRL_CENAB | |
1038 | (csum_start_off << 15) | | 1033 | (csum_start_off << 15) | |
@@ -2849,7 +2844,7 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2849 | return rc; | 2844 | return rc; |
2850 | } | 2845 | } |
2851 | 2846 | ||
2852 | #if (!defined(__sparc__) && !defined(CONFIG_PPC_PMAC)) | 2847 | #if (!defined(CONFIG_SPARC) && !defined(CONFIG_PPC_PMAC)) |
2853 | /* Fetch MAC address from vital product data of PCI ROM. */ | 2848 | /* Fetch MAC address from vital product data of PCI ROM. */ |
2854 | static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr) | 2849 | static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr) |
2855 | { | 2850 | { |
@@ -2904,36 +2899,19 @@ static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr) | |||
2904 | 2899 | ||
2905 | static int __devinit gem_get_device_address(struct gem *gp) | 2900 | static int __devinit gem_get_device_address(struct gem *gp) |
2906 | { | 2901 | { |
2907 | #if defined(__sparc__) || defined(CONFIG_PPC_PMAC) | 2902 | #if defined(CONFIG_SPARC) || defined(CONFIG_PPC_PMAC) |
2908 | struct net_device *dev = gp->dev; | 2903 | struct net_device *dev = gp->dev; |
2909 | #endif | ||
2910 | |||
2911 | #if defined(__sparc__) | ||
2912 | struct pci_dev *pdev = gp->pdev; | ||
2913 | struct pcidev_cookie *pcp = pdev->sysdata; | ||
2914 | int use_idprom = 1; | ||
2915 | |||
2916 | if (pcp != NULL) { | ||
2917 | unsigned char *addr; | ||
2918 | int len; | ||
2919 | |||
2920 | addr = of_get_property(pcp->prom_node, "local-mac-address", | ||
2921 | &len); | ||
2922 | if (addr && len == 6) { | ||
2923 | use_idprom = 0; | ||
2924 | memcpy(dev->dev_addr, addr, 6); | ||
2925 | } | ||
2926 | } | ||
2927 | if (use_idprom) | ||
2928 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); | ||
2929 | #elif defined(CONFIG_PPC_PMAC) | ||
2930 | const unsigned char *addr; | 2904 | const unsigned char *addr; |
2931 | 2905 | ||
2932 | addr = get_property(gp->of_node, "local-mac-address", NULL); | 2906 | addr = get_property(gp->of_node, "local-mac-address", NULL); |
2933 | if (addr == NULL) { | 2907 | if (addr == NULL) { |
2908 | #ifdef CONFIG_SPARC | ||
2909 | addr = idprom->id_ethaddr; | ||
2910 | #else | ||
2934 | printk("\n"); | 2911 | printk("\n"); |
2935 | printk(KERN_ERR "%s: can't get mac-address\n", dev->name); | 2912 | printk(KERN_ERR "%s: can't get mac-address\n", dev->name); |
2936 | return -1; | 2913 | return -1; |
2914 | #endif | ||
2937 | } | 2915 | } |
2938 | memcpy(dev->dev_addr, addr, 6); | 2916 | memcpy(dev->dev_addr, addr, 6); |
2939 | #else | 2917 | #else |
@@ -3091,7 +3069,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev, | |||
3091 | /* On Apple, we want a reference to the Open Firmware device-tree | 3069 | /* On Apple, we want a reference to the Open Firmware device-tree |
3092 | * node. We use it for clock control. | 3070 | * node. We use it for clock control. |
3093 | */ | 3071 | */ |
3094 | #ifdef CONFIG_PPC_PMAC | 3072 | #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC) |
3095 | gp->of_node = pci_device_to_OF_node(pdev); | 3073 | gp->of_node = pci_device_to_OF_node(pdev); |
3096 | #endif | 3074 | #endif |
3097 | 3075 | ||