aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sunhme.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 21:37:58 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:13:12 -0400
commit7a715f46012f3552294154978aed59cba9804928 (patch)
tree9e7079ae4ad370b63ac6c8a4face573d6cf60533 /drivers/net/sunhme.c
parent5778002874de0fb7e3d8c4a0a4afb6b1a6297069 (diff)
sparc: Make SBUS DMA interfaces take struct device.
This is the first step in converting all the SBUS drivers over to generic dma_*(). Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sunhme.c')
-rw-r--r--drivers/net/sunhme.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index b79d5f018f79..cd93fc5e826a 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -251,13 +251,13 @@ static u32 pci_hme_read_desc32(hme32 *p)
251#define hme_read_desc32(__hp, __p) \ 251#define hme_read_desc32(__hp, __p) \
252 ((__hp)->read_desc32(__p)) 252 ((__hp)->read_desc32(__p))
253#define hme_dma_map(__hp, __ptr, __size, __dir) \ 253#define hme_dma_map(__hp, __ptr, __size, __dir) \
254 ((__hp)->dma_map((__hp)->happy_dev, (__ptr), (__size), (__dir))) 254 ((__hp)->dma_map((__hp)->dma_dev, (__ptr), (__size), (__dir)))
255#define hme_dma_unmap(__hp, __addr, __size, __dir) \ 255#define hme_dma_unmap(__hp, __addr, __size, __dir) \
256 ((__hp)->dma_unmap((__hp)->happy_dev, (__addr), (__size), (__dir))) 256 ((__hp)->dma_unmap((__hp)->dma_dev, (__addr), (__size), (__dir)))
257#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ 257#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \
258 ((__hp)->dma_sync_for_cpu((__hp)->happy_dev, (__addr), (__size), (__dir))) 258 ((__hp)->dma_sync_for_cpu((__hp)->dma_dev, (__addr), (__size), (__dir)))
259#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ 259#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \
260 ((__hp)->dma_sync_for_device((__hp)->happy_dev, (__addr), (__size), (__dir))) 260 ((__hp)->dma_sync_for_device((__hp)->dma_dev, (__addr), (__size), (__dir)))
261#else 261#else
262#ifdef CONFIG_SBUS 262#ifdef CONFIG_SBUS
263/* SBUS only compilation */ 263/* SBUS only compilation */
@@ -277,13 +277,13 @@ do { (__txd)->tx_addr = (__force hme32)(u32)(__addr); \
277} while(0) 277} while(0)
278#define hme_read_desc32(__hp, __p) ((__force u32)(hme32)*(__p)) 278#define hme_read_desc32(__hp, __p) ((__force u32)(hme32)*(__p))
279#define hme_dma_map(__hp, __ptr, __size, __dir) \ 279#define hme_dma_map(__hp, __ptr, __size, __dir) \
280 sbus_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) 280 sbus_map_single((__hp)->dma_dev, (__ptr), (__size), (__dir))
281#define hme_dma_unmap(__hp, __addr, __size, __dir) \ 281#define hme_dma_unmap(__hp, __addr, __size, __dir) \
282 sbus_unmap_single((__hp)->happy_dev, (__addr), (__size), (__dir)) 282 sbus_unmap_single((__hp)->dma_dev, (__addr), (__size), (__dir))
283#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ 283#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \
284 sbus_dma_sync_single_for_cpu((__hp)->happy_dev, (__addr), (__size), (__dir)) 284 sbus_dma_sync_single_for_cpu((__hp)->dma_dev, (__addr), (__size), (__dir))
285#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ 285#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \
286 sbus_dma_sync_single_for_device((__hp)->happy_dev, (__addr), (__size), (__dir)) 286 sbus_dma_sync_single_for_device((__hp)->dma_dev, (__addr), (__size), (__dir))
287#else 287#else
288/* PCI only compilation */ 288/* PCI only compilation */
289#define hme_write32(__hp, __reg, __val) \ 289#define hme_write32(__hp, __reg, __val) \
@@ -305,13 +305,13 @@ static inline u32 hme_read_desc32(struct happy_meal *hp, hme32 *p)
305 return le32_to_cpup((__le32 *)p); 305 return le32_to_cpup((__le32 *)p);
306} 306}
307#define hme_dma_map(__hp, __ptr, __size, __dir) \ 307#define hme_dma_map(__hp, __ptr, __size, __dir) \
308 pci_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) 308 pci_map_single((__hp)->dma_dev, (__ptr), (__size), (__dir))
309#define hme_dma_unmap(__hp, __addr, __size, __dir) \ 309#define hme_dma_unmap(__hp, __addr, __size, __dir) \
310 pci_unmap_single((__hp)->happy_dev, (__addr), (__size), (__dir)) 310 pci_unmap_single((__hp)->dma_dev, (__addr), (__size), (__dir))
311#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ 311#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \
312 pci_dma_sync_single_for_cpu((__hp)->happy_dev, (__addr), (__size), (__dir)) 312 pci_dma_sync_single_for_cpu((__hp)->dma_dev, (__addr), (__size), (__dir))
313#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ 313#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \
314 pci_dma_sync_single_for_device((__hp)->happy_dev, (__addr), (__size), (__dir)) 314 pci_dma_sync_single_for_device((__hp)->dma_dev, (__addr), (__size), (__dir))
315#endif 315#endif
316#endif 316#endif
317 317
@@ -2716,6 +2716,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe
2716 hp = dev->priv; 2716 hp = dev->priv;
2717 2717
2718 hp->happy_dev = sdev; 2718 hp->happy_dev = sdev;
2719 hp->dma_dev = &sdev->ofdev.dev;
2719 2720
2720 spin_lock_init(&hp->happy_lock); 2721 spin_lock_init(&hp->happy_lock);
2721 2722
@@ -2785,7 +2786,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe
2785 hp->happy_bursts = of_getintprop_default(sdev->bus->ofdev.node, 2786 hp->happy_bursts = of_getintprop_default(sdev->bus->ofdev.node,
2786 "burst-sizes", 0x00); 2787 "burst-sizes", 0x00);
2787 2788
2788 hp->happy_block = sbus_alloc_consistent(hp->happy_dev, 2789 hp->happy_block = sbus_alloc_consistent(hp->dma_dev,
2789 PAGE_SIZE, 2790 PAGE_SIZE,
2790 &hp->hblock_dvma); 2791 &hp->hblock_dvma);
2791 err = -ENOMEM; 2792 err = -ENOMEM;
@@ -2860,7 +2861,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe
2860 return 0; 2861 return 0;
2861 2862
2862err_out_free_consistent: 2863err_out_free_consistent:
2863 sbus_free_consistent(hp->happy_dev, 2864 sbus_free_consistent(hp->dma_dev,
2864 PAGE_SIZE, 2865 PAGE_SIZE,
2865 hp->happy_block, 2866 hp->happy_block,
2866 hp->hblock_dvma); 2867 hp->hblock_dvma);
@@ -3035,6 +3036,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
3035 memset(hp, 0, sizeof(*hp)); 3036 memset(hp, 0, sizeof(*hp));
3036 3037
3037 hp->happy_dev = pdev; 3038 hp->happy_dev = pdev;
3039 hp->dma_dev = pdev;
3038 3040
3039 spin_lock_init(&hp->happy_lock); 3041 spin_lock_init(&hp->happy_lock);
3040 3042
@@ -3231,12 +3233,12 @@ static void __devexit happy_meal_pci_remove(struct pci_dev *pdev)
3231 3233
3232 unregister_netdev(net_dev); 3234 unregister_netdev(net_dev);
3233 3235
3234 pci_free_consistent(hp->happy_dev, 3236 pci_free_consistent(hp->dma_dev,
3235 PAGE_SIZE, 3237 PAGE_SIZE,
3236 hp->happy_block, 3238 hp->happy_block,
3237 hp->hblock_dvma); 3239 hp->hblock_dvma);
3238 iounmap(hp->gregs); 3240 iounmap(hp->gregs);
3239 pci_release_regions(hp->happy_dev); 3241 pci_release_regions(hp->dma_dev);
3240 3242
3241 free_netdev(net_dev); 3243 free_netdev(net_dev);
3242 3244
@@ -3306,7 +3308,7 @@ static int __devexit hme_sbus_remove(struct of_device *dev)
3306 sbus_iounmap(hp->erxregs, ERX_REG_SIZE); 3308 sbus_iounmap(hp->erxregs, ERX_REG_SIZE);
3307 sbus_iounmap(hp->bigmacregs, BMAC_REG_SIZE); 3309 sbus_iounmap(hp->bigmacregs, BMAC_REG_SIZE);
3308 sbus_iounmap(hp->tcvregs, TCVR_REG_SIZE); 3310 sbus_iounmap(hp->tcvregs, TCVR_REG_SIZE);
3309 sbus_free_consistent(hp->happy_dev, 3311 sbus_free_consistent(hp->dma_dev,
3310 PAGE_SIZE, 3312 PAGE_SIZE,
3311 hp->happy_block, 3313 hp->happy_block,
3312 hp->hblock_dvma); 3314 hp->hblock_dvma);