diff options
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/cadence/at91_ether.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/cadence/at91_ether.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/cadence/macb.c | 153 |
3 files changed, 67 insertions, 93 deletions
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index 56624d303487..dfeb46cb3f74 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/skbuff.h> | 26 | #include <linux/skbuff.h> |
27 | #include <linux/dma-mapping.h> | 27 | #include <linux/dma-mapping.h> |
28 | #include <linux/ethtool.h> | 28 | #include <linux/ethtool.h> |
29 | #include <linux/platform_data/macb.h> | ||
29 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
30 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
31 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
@@ -984,7 +985,7 @@ static const struct net_device_ops at91ether_netdev_ops = { | |||
984 | static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address, | 985 | static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address, |
985 | struct platform_device *pdev, struct clk *ether_clk) | 986 | struct platform_device *pdev, struct clk *ether_clk) |
986 | { | 987 | { |
987 | struct at91_eth_data *board_data = pdev->dev.platform_data; | 988 | struct macb_platform_data *board_data = pdev->dev.platform_data; |
988 | struct net_device *dev; | 989 | struct net_device *dev; |
989 | struct at91_private *lp; | 990 | struct at91_private *lp; |
990 | unsigned int val; | 991 | unsigned int val; |
diff --git a/drivers/net/ethernet/cadence/at91_ether.h b/drivers/net/ethernet/cadence/at91_ether.h index 353f4dab62be..3725fbb0defe 100644 --- a/drivers/net/ethernet/cadence/at91_ether.h +++ b/drivers/net/ethernet/cadence/at91_ether.h | |||
@@ -85,7 +85,9 @@ struct recv_desc_bufs | |||
85 | struct at91_private | 85 | struct at91_private |
86 | { | 86 | { |
87 | struct mii_if_info mii; /* ethtool support */ | 87 | struct mii_if_info mii; /* ethtool support */ |
88 | struct at91_eth_data board_data; /* board-specific configuration */ | 88 | struct macb_platform_data board_data; /* board-specific |
89 | * configuration (shared with | ||
90 | * macb for common data */ | ||
89 | struct clk *ether_clk; /* clock */ | 91 | struct clk *ether_clk; /* clock */ |
90 | 92 | ||
91 | /* PHY */ | 93 | /* PHY */ |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index a437b46e5490..aa1d597091a8 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | #include <linux/clk.h> | 12 | #include <linux/clk.h> |
12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
13 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
@@ -19,12 +20,10 @@ | |||
19 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
20 | #include <linux/etherdevice.h> | 21 | #include <linux/etherdevice.h> |
21 | #include <linux/dma-mapping.h> | 22 | #include <linux/dma-mapping.h> |
23 | #include <linux/platform_data/macb.h> | ||
22 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
23 | #include <linux/phy.h> | 25 | #include <linux/phy.h> |
24 | 26 | ||
25 | #include <mach/board.h> | ||
26 | #include <mach/cpu.h> | ||
27 | |||
28 | #include "macb.h" | 27 | #include "macb.h" |
29 | 28 | ||
30 | #define RX_BUFFER_SIZE 128 | 29 | #define RX_BUFFER_SIZE 128 |
@@ -84,7 +83,7 @@ static void __init macb_get_hwaddr(struct macb *bp) | |||
84 | if (is_valid_ether_addr(addr)) { | 83 | if (is_valid_ether_addr(addr)) { |
85 | memcpy(bp->dev->dev_addr, addr, sizeof(addr)); | 84 | memcpy(bp->dev->dev_addr, addr, sizeof(addr)); |
86 | } else { | 85 | } else { |
87 | dev_info(&bp->pdev->dev, "invalid hw address, using random\n"); | 86 | netdev_info(bp->dev, "invalid hw address, using random\n"); |
88 | random_ether_addr(bp->dev->dev_addr); | 87 | random_ether_addr(bp->dev->dev_addr); |
89 | } | 88 | } |
90 | } | 89 | } |
@@ -178,11 +177,12 @@ static void macb_handle_link_change(struct net_device *dev) | |||
178 | 177 | ||
179 | if (status_change) { | 178 | if (status_change) { |
180 | if (phydev->link) | 179 | if (phydev->link) |
181 | printk(KERN_INFO "%s: link up (%d/%s)\n", | 180 | netdev_info(dev, "link up (%d/%s)\n", |
182 | dev->name, phydev->speed, | 181 | phydev->speed, |
183 | DUPLEX_FULL == phydev->duplex ? "Full":"Half"); | 182 | phydev->duplex == DUPLEX_FULL ? |
183 | "Full" : "Half"); | ||
184 | else | 184 | else |
185 | printk(KERN_INFO "%s: link down\n", dev->name); | 185 | netdev_info(dev, "link down\n"); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
@@ -191,12 +191,12 @@ static int macb_mii_probe(struct net_device *dev) | |||
191 | { | 191 | { |
192 | struct macb *bp = netdev_priv(dev); | 192 | struct macb *bp = netdev_priv(dev); |
193 | struct phy_device *phydev; | 193 | struct phy_device *phydev; |
194 | struct eth_platform_data *pdata; | 194 | struct macb_platform_data *pdata; |
195 | int ret; | 195 | int ret; |
196 | 196 | ||
197 | phydev = phy_find_first(bp->mii_bus); | 197 | phydev = phy_find_first(bp->mii_bus); |
198 | if (!phydev) { | 198 | if (!phydev) { |
199 | printk (KERN_ERR "%s: no PHY found\n", dev->name); | 199 | netdev_err(dev, "no PHY found\n"); |
200 | return -1; | 200 | return -1; |
201 | } | 201 | } |
202 | 202 | ||
@@ -209,7 +209,7 @@ static int macb_mii_probe(struct net_device *dev) | |||
209 | PHY_INTERFACE_MODE_RMII : | 209 | PHY_INTERFACE_MODE_RMII : |
210 | PHY_INTERFACE_MODE_MII); | 210 | PHY_INTERFACE_MODE_MII); |
211 | if (ret) { | 211 | if (ret) { |
212 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 212 | netdev_err(dev, "Could not attach to PHY\n"); |
213 | return ret; | 213 | return ret; |
214 | } | 214 | } |
215 | 215 | ||
@@ -228,7 +228,7 @@ static int macb_mii_probe(struct net_device *dev) | |||
228 | 228 | ||
229 | static int macb_mii_init(struct macb *bp) | 229 | static int macb_mii_init(struct macb *bp) |
230 | { | 230 | { |
231 | struct eth_platform_data *pdata; | 231 | struct macb_platform_data *pdata; |
232 | int err = -ENXIO, i; | 232 | int err = -ENXIO, i; |
233 | 233 | ||
234 | /* Enable management port */ | 234 | /* Enable management port */ |
@@ -303,14 +303,13 @@ static void macb_tx(struct macb *bp) | |||
303 | status = macb_readl(bp, TSR); | 303 | status = macb_readl(bp, TSR); |
304 | macb_writel(bp, TSR, status); | 304 | macb_writel(bp, TSR, status); |
305 | 305 | ||
306 | dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", | 306 | netdev_dbg(bp->dev, "macb_tx status = %02lx\n", (unsigned long)status); |
307 | (unsigned long)status); | ||
308 | 307 | ||
309 | if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { | 308 | if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { |
310 | int i; | 309 | int i; |
311 | printk(KERN_ERR "%s: TX %s, resetting buffers\n", | 310 | netdev_err(bp->dev, "TX %s, resetting buffers\n", |
312 | bp->dev->name, status & MACB_BIT(UND) ? | 311 | status & MACB_BIT(UND) ? |
313 | "underrun" : "retry limit exceeded"); | 312 | "underrun" : "retry limit exceeded"); |
314 | 313 | ||
315 | /* Transfer ongoing, disable transmitter, to avoid confusion */ | 314 | /* Transfer ongoing, disable transmitter, to avoid confusion */ |
316 | if (status & MACB_BIT(TGO)) | 315 | if (status & MACB_BIT(TGO)) |
@@ -369,8 +368,8 @@ static void macb_tx(struct macb *bp) | |||
369 | if (!(bufstat & MACB_BIT(TX_USED))) | 368 | if (!(bufstat & MACB_BIT(TX_USED))) |
370 | break; | 369 | break; |
371 | 370 | ||
372 | dev_dbg(&bp->pdev->dev, "skb %u (data %p) TX complete\n", | 371 | netdev_dbg(bp->dev, "skb %u (data %p) TX complete\n", |
373 | tail, skb->data); | 372 | tail, skb->data); |
374 | dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len, | 373 | dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len, |
375 | DMA_TO_DEVICE); | 374 | DMA_TO_DEVICE); |
376 | bp->stats.tx_packets++; | 375 | bp->stats.tx_packets++; |
@@ -395,8 +394,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
395 | 394 | ||
396 | len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl); | 395 | len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl); |
397 | 396 | ||
398 | dev_dbg(&bp->pdev->dev, "macb_rx_frame frags %u - %u (len %u)\n", | 397 | netdev_dbg(bp->dev, "macb_rx_frame frags %u - %u (len %u)\n", |
399 | first_frag, last_frag, len); | 398 | first_frag, last_frag, len); |
400 | 399 | ||
401 | skb = dev_alloc_skb(len + RX_OFFSET); | 400 | skb = dev_alloc_skb(len + RX_OFFSET); |
402 | if (!skb) { | 401 | if (!skb) { |
@@ -437,8 +436,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
437 | 436 | ||
438 | bp->stats.rx_packets++; | 437 | bp->stats.rx_packets++; |
439 | bp->stats.rx_bytes += len; | 438 | bp->stats.rx_bytes += len; |
440 | dev_dbg(&bp->pdev->dev, "received skb of length %u, csum: %08x\n", | 439 | netdev_dbg(bp->dev, "received skb of length %u, csum: %08x\n", |
441 | skb->len, skb->csum); | 440 | skb->len, skb->csum); |
442 | netif_receive_skb(skb); | 441 | netif_receive_skb(skb); |
443 | 442 | ||
444 | return 0; | 443 | return 0; |
@@ -515,8 +514,8 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
515 | 514 | ||
516 | work_done = 0; | 515 | work_done = 0; |
517 | 516 | ||
518 | dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", | 517 | netdev_dbg(bp->dev, "poll: status = %08lx, budget = %d\n", |
519 | (unsigned long)status, budget); | 518 | (unsigned long)status, budget); |
520 | 519 | ||
521 | work_done = macb_rx(bp, budget); | 520 | work_done = macb_rx(bp, budget); |
522 | if (work_done < budget) { | 521 | if (work_done < budget) { |
@@ -565,8 +564,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
565 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); | 564 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); |
566 | 565 | ||
567 | if (napi_schedule_prep(&bp->napi)) { | 566 | if (napi_schedule_prep(&bp->napi)) { |
568 | dev_dbg(&bp->pdev->dev, | 567 | netdev_dbg(bp->dev, "scheduling RX softirq\n"); |
569 | "scheduling RX softirq\n"); | ||
570 | __napi_schedule(&bp->napi); | 568 | __napi_schedule(&bp->napi); |
571 | } | 569 | } |
572 | } | 570 | } |
@@ -587,11 +585,11 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
587 | 585 | ||
588 | if (status & MACB_BIT(HRESP)) { | 586 | if (status & MACB_BIT(HRESP)) { |
589 | /* | 587 | /* |
590 | * TODO: Reset the hardware, and maybe move the printk | 588 | * TODO: Reset the hardware, and maybe move the |
591 | * to a lower-priority context as well (work queue?) | 589 | * netdev_err to a lower-priority context as well |
590 | * (work queue?) | ||
592 | */ | 591 | */ |
593 | printk(KERN_ERR "%s: DMA bus error: HRESP not OK\n", | 592 | netdev_err(dev, "DMA bus error: HRESP not OK\n"); |
594 | dev->name); | ||
595 | } | 593 | } |
596 | 594 | ||
597 | status = macb_readl(bp, ISR); | 595 | status = macb_readl(bp, ISR); |
@@ -626,16 +624,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
626 | unsigned long flags; | 624 | unsigned long flags; |
627 | 625 | ||
628 | #ifdef DEBUG | 626 | #ifdef DEBUG |
629 | int i; | 627 | netdev_dbg(bp->dev, |
630 | dev_dbg(&bp->pdev->dev, | 628 | "start_xmit: len %u head %p data %p tail %p end %p\n", |
631 | "start_xmit: len %u head %p data %p tail %p end %p\n", | 629 | skb->len, skb->head, skb->data, |
632 | skb->len, skb->head, skb->data, | 630 | skb_tail_pointer(skb), skb_end_pointer(skb)); |
633 | skb_tail_pointer(skb), skb_end_pointer(skb)); | 631 | print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_OFFSET, 16, 1, |
634 | dev_dbg(&bp->pdev->dev, | 632 | skb->data, 16, true); |
635 | "data:"); | ||
636 | for (i = 0; i < 16; i++) | ||
637 | printk(" %02x", (unsigned int)skb->data[i]); | ||
638 | printk("\n"); | ||
639 | #endif | 633 | #endif |
640 | 634 | ||
641 | len = skb->len; | 635 | len = skb->len; |
@@ -645,21 +639,20 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
645 | if (TX_BUFFS_AVAIL(bp) < 1) { | 639 | if (TX_BUFFS_AVAIL(bp) < 1) { |
646 | netif_stop_queue(dev); | 640 | netif_stop_queue(dev); |
647 | spin_unlock_irqrestore(&bp->lock, flags); | 641 | spin_unlock_irqrestore(&bp->lock, flags); |
648 | dev_err(&bp->pdev->dev, | 642 | netdev_err(bp->dev, "BUG! Tx Ring full when queue awake!\n"); |
649 | "BUG! Tx Ring full when queue awake!\n"); | 643 | netdev_dbg(bp->dev, "tx_head = %u, tx_tail = %u\n", |
650 | dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n", | 644 | bp->tx_head, bp->tx_tail); |
651 | bp->tx_head, bp->tx_tail); | ||
652 | return NETDEV_TX_BUSY; | 645 | return NETDEV_TX_BUSY; |
653 | } | 646 | } |
654 | 647 | ||
655 | entry = bp->tx_head; | 648 | entry = bp->tx_head; |
656 | dev_dbg(&bp->pdev->dev, "Allocated ring entry %u\n", entry); | 649 | netdev_dbg(bp->dev, "Allocated ring entry %u\n", entry); |
657 | mapping = dma_map_single(&bp->pdev->dev, skb->data, | 650 | mapping = dma_map_single(&bp->pdev->dev, skb->data, |
658 | len, DMA_TO_DEVICE); | 651 | len, DMA_TO_DEVICE); |
659 | bp->tx_skb[entry].skb = skb; | 652 | bp->tx_skb[entry].skb = skb; |
660 | bp->tx_skb[entry].mapping = mapping; | 653 | bp->tx_skb[entry].mapping = mapping; |
661 | dev_dbg(&bp->pdev->dev, "Mapped skb data %p to DMA addr %08lx\n", | 654 | netdev_dbg(bp->dev, "Mapped skb data %p to DMA addr %08lx\n", |
662 | skb->data, (unsigned long)mapping); | 655 | skb->data, (unsigned long)mapping); |
663 | 656 | ||
664 | ctrl = MACB_BF(TX_FRMLEN, len); | 657 | ctrl = MACB_BF(TX_FRMLEN, len); |
665 | ctrl |= MACB_BIT(TX_LAST); | 658 | ctrl |= MACB_BIT(TX_LAST); |
@@ -723,27 +716,27 @@ static int macb_alloc_consistent(struct macb *bp) | |||
723 | &bp->rx_ring_dma, GFP_KERNEL); | 716 | &bp->rx_ring_dma, GFP_KERNEL); |
724 | if (!bp->rx_ring) | 717 | if (!bp->rx_ring) |
725 | goto out_err; | 718 | goto out_err; |
726 | dev_dbg(&bp->pdev->dev, | 719 | netdev_dbg(bp->dev, |
727 | "Allocated RX ring of %d bytes at %08lx (mapped %p)\n", | 720 | "Allocated RX ring of %d bytes at %08lx (mapped %p)\n", |
728 | size, (unsigned long)bp->rx_ring_dma, bp->rx_ring); | 721 | size, (unsigned long)bp->rx_ring_dma, bp->rx_ring); |
729 | 722 | ||
730 | size = TX_RING_BYTES; | 723 | size = TX_RING_BYTES; |
731 | bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size, | 724 | bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size, |
732 | &bp->tx_ring_dma, GFP_KERNEL); | 725 | &bp->tx_ring_dma, GFP_KERNEL); |
733 | if (!bp->tx_ring) | 726 | if (!bp->tx_ring) |
734 | goto out_err; | 727 | goto out_err; |
735 | dev_dbg(&bp->pdev->dev, | 728 | netdev_dbg(bp->dev, |
736 | "Allocated TX ring of %d bytes at %08lx (mapped %p)\n", | 729 | "Allocated TX ring of %d bytes at %08lx (mapped %p)\n", |
737 | size, (unsigned long)bp->tx_ring_dma, bp->tx_ring); | 730 | size, (unsigned long)bp->tx_ring_dma, bp->tx_ring); |
738 | 731 | ||
739 | size = RX_RING_SIZE * RX_BUFFER_SIZE; | 732 | size = RX_RING_SIZE * RX_BUFFER_SIZE; |
740 | bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size, | 733 | bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size, |
741 | &bp->rx_buffers_dma, GFP_KERNEL); | 734 | &bp->rx_buffers_dma, GFP_KERNEL); |
742 | if (!bp->rx_buffers) | 735 | if (!bp->rx_buffers) |
743 | goto out_err; | 736 | goto out_err; |
744 | dev_dbg(&bp->pdev->dev, | 737 | netdev_dbg(bp->dev, |
745 | "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n", | 738 | "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n", |
746 | size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers); | 739 | size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers); |
747 | 740 | ||
748 | return 0; | 741 | return 0; |
749 | 742 | ||
@@ -954,7 +947,7 @@ static int macb_open(struct net_device *dev) | |||
954 | struct macb *bp = netdev_priv(dev); | 947 | struct macb *bp = netdev_priv(dev); |
955 | int err; | 948 | int err; |
956 | 949 | ||
957 | dev_dbg(&bp->pdev->dev, "open\n"); | 950 | netdev_dbg(bp->dev, "open\n"); |
958 | 951 | ||
959 | /* if the phy is not yet register, retry later*/ | 952 | /* if the phy is not yet register, retry later*/ |
960 | if (!bp->phy_dev) | 953 | if (!bp->phy_dev) |
@@ -965,9 +958,8 @@ static int macb_open(struct net_device *dev) | |||
965 | 958 | ||
966 | err = macb_alloc_consistent(bp); | 959 | err = macb_alloc_consistent(bp); |
967 | if (err) { | 960 | if (err) { |
968 | printk(KERN_ERR | 961 | netdev_err(dev, "Unable to allocate DMA memory (error %d)\n", |
969 | "%s: Unable to allocate DMA memory (error %d)\n", | 962 | err); |
970 | dev->name, err); | ||
971 | return err; | 963 | return err; |
972 | } | 964 | } |
973 | 965 | ||
@@ -1119,7 +1111,7 @@ static const struct net_device_ops macb_netdev_ops = { | |||
1119 | 1111 | ||
1120 | static int __init macb_probe(struct platform_device *pdev) | 1112 | static int __init macb_probe(struct platform_device *pdev) |
1121 | { | 1113 | { |
1122 | struct eth_platform_data *pdata; | 1114 | struct macb_platform_data *pdata; |
1123 | struct resource *regs; | 1115 | struct resource *regs; |
1124 | struct net_device *dev; | 1116 | struct net_device *dev; |
1125 | struct macb *bp; | 1117 | struct macb *bp; |
@@ -1152,28 +1144,19 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1152 | 1144 | ||
1153 | spin_lock_init(&bp->lock); | 1145 | spin_lock_init(&bp->lock); |
1154 | 1146 | ||
1155 | #if defined(CONFIG_ARCH_AT91) | 1147 | bp->pclk = clk_get(&pdev->dev, "pclk"); |
1156 | bp->pclk = clk_get(&pdev->dev, "macb_clk"); | ||
1157 | if (IS_ERR(bp->pclk)) { | 1148 | if (IS_ERR(bp->pclk)) { |
1158 | dev_err(&pdev->dev, "failed to get macb_clk\n"); | 1149 | dev_err(&pdev->dev, "failed to get macb_clk\n"); |
1159 | goto err_out_free_dev; | 1150 | goto err_out_free_dev; |
1160 | } | 1151 | } |
1161 | clk_enable(bp->pclk); | 1152 | clk_enable(bp->pclk); |
1162 | #else | 1153 | |
1163 | bp->pclk = clk_get(&pdev->dev, "pclk"); | ||
1164 | if (IS_ERR(bp->pclk)) { | ||
1165 | dev_err(&pdev->dev, "failed to get pclk\n"); | ||
1166 | goto err_out_free_dev; | ||
1167 | } | ||
1168 | bp->hclk = clk_get(&pdev->dev, "hclk"); | 1154 | bp->hclk = clk_get(&pdev->dev, "hclk"); |
1169 | if (IS_ERR(bp->hclk)) { | 1155 | if (IS_ERR(bp->hclk)) { |
1170 | dev_err(&pdev->dev, "failed to get hclk\n"); | 1156 | dev_err(&pdev->dev, "failed to get hclk\n"); |
1171 | goto err_out_put_pclk; | 1157 | goto err_out_put_pclk; |
1172 | } | 1158 | } |
1173 | |||
1174 | clk_enable(bp->pclk); | ||
1175 | clk_enable(bp->hclk); | 1159 | clk_enable(bp->hclk); |
1176 | #endif | ||
1177 | 1160 | ||
1178 | bp->regs = ioremap(regs->start, resource_size(regs)); | 1161 | bp->regs = ioremap(regs->start, resource_size(regs)); |
1179 | if (!bp->regs) { | 1162 | if (!bp->regs) { |
@@ -1185,9 +1168,8 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1185 | dev->irq = platform_get_irq(pdev, 0); | 1168 | dev->irq = platform_get_irq(pdev, 0); |
1186 | err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev); | 1169 | err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev); |
1187 | if (err) { | 1170 | if (err) { |
1188 | printk(KERN_ERR | 1171 | dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n", |
1189 | "%s: Unable to request IRQ %d (error %d)\n", | 1172 | dev->irq, err); |
1190 | dev->name, dev->irq, err); | ||
1191 | goto err_out_iounmap; | 1173 | goto err_out_iounmap; |
1192 | } | 1174 | } |
1193 | 1175 | ||
@@ -1239,13 +1221,12 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1239 | 1221 | ||
1240 | platform_set_drvdata(pdev, dev); | 1222 | platform_set_drvdata(pdev, dev); |
1241 | 1223 | ||
1242 | printk(KERN_INFO "%s: Atmel MACB at 0x%08lx irq %d (%pM)\n", | 1224 | netdev_info(dev, "Atmel MACB at 0x%08lx irq %d (%pM)\n", |
1243 | dev->name, dev->base_addr, dev->irq, dev->dev_addr); | 1225 | dev->base_addr, dev->irq, dev->dev_addr); |
1244 | 1226 | ||
1245 | phydev = bp->phy_dev; | 1227 | phydev = bp->phy_dev; |
1246 | printk(KERN_INFO "%s: attached PHY driver [%s] " | 1228 | netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", |
1247 | "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name, | 1229 | phydev->drv->name, dev_name(&phydev->dev), phydev->irq); |
1248 | phydev->drv->name, dev_name(&phydev->dev), phydev->irq); | ||
1249 | 1230 | ||
1250 | return 0; | 1231 | return 0; |
1251 | 1232 | ||
@@ -1256,14 +1237,10 @@ err_out_free_irq: | |||
1256 | err_out_iounmap: | 1237 | err_out_iounmap: |
1257 | iounmap(bp->regs); | 1238 | iounmap(bp->regs); |
1258 | err_out_disable_clocks: | 1239 | err_out_disable_clocks: |
1259 | #ifndef CONFIG_ARCH_AT91 | ||
1260 | clk_disable(bp->hclk); | 1240 | clk_disable(bp->hclk); |
1261 | clk_put(bp->hclk); | 1241 | clk_put(bp->hclk); |
1262 | #endif | ||
1263 | clk_disable(bp->pclk); | 1242 | clk_disable(bp->pclk); |
1264 | #ifndef CONFIG_ARCH_AT91 | ||
1265 | err_out_put_pclk: | 1243 | err_out_put_pclk: |
1266 | #endif | ||
1267 | clk_put(bp->pclk); | 1244 | clk_put(bp->pclk); |
1268 | err_out_free_dev: | 1245 | err_out_free_dev: |
1269 | free_netdev(dev); | 1246 | free_netdev(dev); |
@@ -1289,10 +1266,8 @@ static int __exit macb_remove(struct platform_device *pdev) | |||
1289 | unregister_netdev(dev); | 1266 | unregister_netdev(dev); |
1290 | free_irq(dev->irq, dev); | 1267 | free_irq(dev->irq, dev); |
1291 | iounmap(bp->regs); | 1268 | iounmap(bp->regs); |
1292 | #ifndef CONFIG_ARCH_AT91 | ||
1293 | clk_disable(bp->hclk); | 1269 | clk_disable(bp->hclk); |
1294 | clk_put(bp->hclk); | 1270 | clk_put(bp->hclk); |
1295 | #endif | ||
1296 | clk_disable(bp->pclk); | 1271 | clk_disable(bp->pclk); |
1297 | clk_put(bp->pclk); | 1272 | clk_put(bp->pclk); |
1298 | free_netdev(dev); | 1273 | free_netdev(dev); |
@@ -1310,9 +1285,7 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state) | |||
1310 | 1285 | ||
1311 | netif_device_detach(netdev); | 1286 | netif_device_detach(netdev); |
1312 | 1287 | ||
1313 | #ifndef CONFIG_ARCH_AT91 | ||
1314 | clk_disable(bp->hclk); | 1288 | clk_disable(bp->hclk); |
1315 | #endif | ||
1316 | clk_disable(bp->pclk); | 1289 | clk_disable(bp->pclk); |
1317 | 1290 | ||
1318 | return 0; | 1291 | return 0; |
@@ -1324,9 +1297,7 @@ static int macb_resume(struct platform_device *pdev) | |||
1324 | struct macb *bp = netdev_priv(netdev); | 1297 | struct macb *bp = netdev_priv(netdev); |
1325 | 1298 | ||
1326 | clk_enable(bp->pclk); | 1299 | clk_enable(bp->pclk); |
1327 | #ifndef CONFIG_ARCH_AT91 | ||
1328 | clk_enable(bp->hclk); | 1300 | clk_enable(bp->hclk); |
1329 | #endif | ||
1330 | 1301 | ||
1331 | netif_device_attach(netdev); | 1302 | netif_device_attach(netdev); |
1332 | 1303 | ||