aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-15 21:46:25 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-15 21:46:25 -0400
commit0e402c6ec4f32a9192a30c4a5b5ba6867c0be7bc (patch)
tree2edb86443cc241585aab2c789e2c1c2d711363b5
parent28aa483f80d146a8f117eb65a4fddf31d58230d7 (diff)
parent4e19b5c193454ade8d86468077078f680d121979 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: ucc_geth: eliminate max-speed, change interface-type to phy-connection-type smc911x: fix compilation breakage pasemi_mac: Fix local-mac-address parsing pasemi_mac: Terminate PCI ID list pasemi_mac: Interrupt ack fixes pasemi_mac: Fix register defines
-rw-r--r--drivers/net/pasemi_mac.c45
-rw-r--r--drivers/net/pasemi_mac.h4
-rw-r--r--drivers/net/smc911x.c6
-rw-r--r--drivers/net/ucc_geth.c40
-rw-r--r--drivers/net/ucc_geth_mii.c9
-rw-r--r--drivers/net/ucc_geth_mii.h10
6 files changed, 58 insertions, 56 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index bc7f3dee6e5b..8d38425e46c3 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -85,6 +85,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
85{ 85{
86 struct pci_dev *pdev = mac->pdev; 86 struct pci_dev *pdev = mac->pdev;
87 struct device_node *dn = pci_device_to_OF_node(pdev); 87 struct device_node *dn = pci_device_to_OF_node(pdev);
88 int len;
88 const u8 *maddr; 89 const u8 *maddr;
89 u8 addr[6]; 90 u8 addr[6];
90 91
@@ -94,9 +95,17 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
94 return -ENOENT; 95 return -ENOENT;
95 } 96 }
96 97
97 maddr = of_get_property(dn, "local-mac-address", NULL); 98 maddr = of_get_property(dn, "local-mac-address", &len);
99
100 if (maddr && len == 6) {
101 memcpy(mac->mac_addr, maddr, 6);
102 return 0;
103 }
104
105 /* Some old versions of firmware mistakenly uses mac-address
106 * (and as a string) instead of a byte array in local-mac-address.
107 */
98 108
99 /* Fall back to mac-address for older firmware */
100 if (maddr == NULL) 109 if (maddr == NULL)
101 maddr = of_get_property(dn, "mac-address", NULL); 110 maddr = of_get_property(dn, "mac-address", NULL);
102 111
@@ -106,6 +115,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
106 return -ENOENT; 115 return -ENOENT;
107 } 116 }
108 117
118
109 if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0], 119 if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0],
110 &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6) { 120 &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6) {
111 dev_warn(&pdev->dev, 121 dev_warn(&pdev->dev,
@@ -113,7 +123,8 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
113 return -EINVAL; 123 return -EINVAL;
114 } 124 }
115 125
116 memcpy(mac->mac_addr, addr, sizeof(addr)); 126 memcpy(mac->mac_addr, addr, 6);
127
117 return 0; 128 return 0;
118} 129}
119 130
@@ -384,17 +395,14 @@ static void pasemi_mac_replenish_rx_ring(struct net_device *dev)
384 395
385static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac) 396static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
386{ 397{
387 unsigned int reg, stat; 398 unsigned int reg, pcnt;
388 /* Re-enable packet count interrupts: finally 399 /* Re-enable packet count interrupts: finally
389 * ack the packet count interrupt we got in rx_intr. 400 * ack the packet count interrupt we got in rx_intr.
390 */ 401 */
391 402
392 pci_read_config_dword(mac->iob_pdev, 403 pcnt = *mac->rx_status & PAS_STATUS_PCNT_M;
393 PAS_IOB_DMA_RXCH_STAT(mac->dma_rxch),
394 &stat);
395 404
396 reg = PAS_IOB_DMA_RXCH_RESET_PCNT(stat & PAS_IOB_DMA_RXCH_STAT_CNTDEL_M) 405 reg = PAS_IOB_DMA_RXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_RXCH_RESET_PINTC;
397 | PAS_IOB_DMA_RXCH_RESET_PINTC;
398 406
399 pci_write_config_dword(mac->iob_pdev, 407 pci_write_config_dword(mac->iob_pdev,
400 PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), 408 PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch),
@@ -403,14 +411,12 @@ static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
403 411
404static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac) 412static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac)
405{ 413{
406 unsigned int reg, stat; 414 unsigned int reg, pcnt;
407 415
408 /* Re-enable packet count interrupts */ 416 /* Re-enable packet count interrupts */
409 pci_read_config_dword(mac->iob_pdev, 417 pcnt = *mac->tx_status & PAS_STATUS_PCNT_M;
410 PAS_IOB_DMA_TXCH_STAT(mac->dma_txch), &stat);
411 418
412 reg = PAS_IOB_DMA_TXCH_RESET_PCNT(stat & PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) 419 reg = PAS_IOB_DMA_TXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_TXCH_RESET_PINTC;
413 | PAS_IOB_DMA_TXCH_RESET_PINTC;
414 420
415 pci_write_config_dword(mac->iob_pdev, 421 pci_write_config_dword(mac->iob_pdev,
416 PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg); 422 PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg);
@@ -591,21 +597,24 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
591{ 597{
592 struct net_device *dev = data; 598 struct net_device *dev = data;
593 struct pasemi_mac *mac = netdev_priv(dev); 599 struct pasemi_mac *mac = netdev_priv(dev);
594 unsigned int reg; 600 unsigned int reg, pcnt;
595 601
596 if (!(*mac->tx_status & PAS_STATUS_CAUSE_M)) 602 if (!(*mac->tx_status & PAS_STATUS_CAUSE_M))
597 return IRQ_NONE; 603 return IRQ_NONE;
598 604
599 pasemi_mac_clean_tx(mac); 605 pasemi_mac_clean_tx(mac);
600 606
601 reg = PAS_IOB_DMA_TXCH_RESET_PINTC; 607 pcnt = *mac->tx_status & PAS_STATUS_PCNT_M;
608
609 reg = PAS_IOB_DMA_TXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_TXCH_RESET_PINTC;
602 610
603 if (*mac->tx_status & PAS_STATUS_SOFT) 611 if (*mac->tx_status & PAS_STATUS_SOFT)
604 reg |= PAS_IOB_DMA_TXCH_RESET_SINTC; 612 reg |= PAS_IOB_DMA_TXCH_RESET_SINTC;
605 if (*mac->tx_status & PAS_STATUS_ERROR) 613 if (*mac->tx_status & PAS_STATUS_ERROR)
606 reg |= PAS_IOB_DMA_TXCH_RESET_DINTC; 614 reg |= PAS_IOB_DMA_TXCH_RESET_DINTC;
607 615
608 pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), 616 pci_write_config_dword(mac->iob_pdev,
617 PAS_IOB_DMA_TXCH_RESET(mac->dma_txch),
609 reg); 618 reg);
610 619
611 return IRQ_HANDLED; 620 return IRQ_HANDLED;
@@ -974,6 +983,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
974 if (txring->next_to_clean - txring->next_to_use == TX_RING_SIZE) { 983 if (txring->next_to_clean - txring->next_to_use == TX_RING_SIZE) {
975 spin_unlock_irqrestore(&txring->lock, flags); 984 spin_unlock_irqrestore(&txring->lock, flags);
976 pasemi_mac_clean_tx(mac); 985 pasemi_mac_clean_tx(mac);
986 pasemi_mac_restart_tx_intr(mac);
977 spin_lock_irqsave(&txring->lock, flags); 987 spin_lock_irqsave(&txring->lock, flags);
978 988
979 if (txring->next_to_clean - txring->next_to_use == 989 if (txring->next_to_clean - txring->next_to_use ==
@@ -1210,6 +1220,7 @@ static void __devexit pasemi_mac_remove(struct pci_dev *pdev)
1210static struct pci_device_id pasemi_mac_pci_tbl[] = { 1220static struct pci_device_id pasemi_mac_pci_tbl[] = {
1211 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa005) }, 1221 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa005) },
1212 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa006) }, 1222 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa006) },
1223 { },
1213}; 1224};
1214 1225
1215MODULE_DEVICE_TABLE(pci, pasemi_mac_pci_tbl); 1226MODULE_DEVICE_TABLE(pci, pasemi_mac_pci_tbl);
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h
index 8bc0cea8b145..c29ee159c33d 100644
--- a/drivers/net/pasemi_mac.h
+++ b/drivers/net/pasemi_mac.h
@@ -341,7 +341,7 @@ enum {
341 PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) 341 PAS_IOB_DMA_TXCH_STAT_CNTDEL_M)
342#define PAS_IOB_DMA_RXCH_RESET(i) (0x1500 + (i)*4) 342#define PAS_IOB_DMA_RXCH_RESET(i) (0x1500 + (i)*4)
343#define PAS_IOB_DMA_RXCH_RESET_PCNT_M 0xffff0000 343#define PAS_IOB_DMA_RXCH_RESET_PCNT_M 0xffff0000
344#define PAS_IOB_DMA_RXCH_RESET_PCNT_S 0 344#define PAS_IOB_DMA_RXCH_RESET_PCNT_S 16
345#define PAS_IOB_DMA_RXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_RXCH_RESET_PCNT_S) & \ 345#define PAS_IOB_DMA_RXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_RXCH_RESET_PCNT_S) & \
346 PAS_IOB_DMA_RXCH_RESET_PCNT_M) 346 PAS_IOB_DMA_RXCH_RESET_PCNT_M)
347#define PAS_IOB_DMA_RXCH_RESET_PCNTRST 0x00000020 347#define PAS_IOB_DMA_RXCH_RESET_PCNTRST 0x00000020
@@ -352,7 +352,7 @@ enum {
352#define PAS_IOB_DMA_RXCH_RESET_PINTC 0x00000001 352#define PAS_IOB_DMA_RXCH_RESET_PINTC 0x00000001
353#define PAS_IOB_DMA_TXCH_RESET(i) (0x1600 + (i)*4) 353#define PAS_IOB_DMA_TXCH_RESET(i) (0x1600 + (i)*4)
354#define PAS_IOB_DMA_TXCH_RESET_PCNT_M 0xffff0000 354#define PAS_IOB_DMA_TXCH_RESET_PCNT_M 0xffff0000
355#define PAS_IOB_DMA_TXCH_RESET_PCNT_S 0 355#define PAS_IOB_DMA_TXCH_RESET_PCNT_S 16
356#define PAS_IOB_DMA_TXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_TXCH_RESET_PCNT_S) & \ 356#define PAS_IOB_DMA_TXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_TXCH_RESET_PCNT_S) & \
357 PAS_IOB_DMA_TXCH_RESET_PCNT_M) 357 PAS_IOB_DMA_TXCH_RESET_PCNT_M)
358#define PAS_IOB_DMA_TXCH_RESET_PCNTRST 0x00000020 358#define PAS_IOB_DMA_TXCH_RESET_PCNTRST 0x00000020
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 81f24847c963..db43e42bee35 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -77,7 +77,6 @@ static const char version[] =
77#include <linux/skbuff.h> 77#include <linux/skbuff.h>
78 78
79#include <asm/io.h> 79#include <asm/io.h>
80#include <asm/irq.h>
81 80
82#include "smc911x.h" 81#include "smc911x.h"
83 82
@@ -2084,12 +2083,11 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr)
2084 lp->ctl_rspeed = 100; 2083 lp->ctl_rspeed = 100;
2085 2084
2086 /* Grab the IRQ */ 2085 /* Grab the IRQ */
2087 retval = request_irq(dev->irq, &smc911x_interrupt, IRQF_SHARED, dev->name, dev); 2086 retval = request_irq(dev->irq, &smc911x_interrupt,
2087 IRQF_SHARED | IRQF_TRIGGER_FALLING, dev->name, dev);
2088 if (retval) 2088 if (retval)
2089 goto err_out; 2089 goto err_out;
2090 2090
2091 set_irq_type(dev->irq, IRQT_FALLING);
2092
2093#ifdef SMC_USE_DMA 2091#ifdef SMC_USE_DMA
2094 lp->rxdma = SMC_DMA_REQUEST(dev, smc911x_rx_dma_irq); 2092 lp->rxdma = SMC_DMA_REQUEST(dev, smc911x_rx_dma_irq);
2095 lp->txdma = SMC_DMA_REQUEST(dev, smc911x_tx_dma_irq); 2093 lp->txdma = SMC_DMA_REQUEST(dev, smc911x_tx_dma_irq);
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 0f667652fda9..c2ccbd098f53 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. 2 * Copyright (C) 2006-2007 Freescale Semicondutor, Inc. All rights reserved.
3 * 3 *
4 * Author: Shlomi Gridish <gridish@freescale.com> 4 * Author: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com> 5 * Li Yang <leoli@freescale.com>
@@ -3737,21 +3737,21 @@ static int ucc_geth_close(struct net_device *dev)
3737 3737
3738const struct ethtool_ops ucc_geth_ethtool_ops = { }; 3738const struct ethtool_ops ucc_geth_ethtool_ops = { };
3739 3739
3740static phy_interface_t to_phy_interface(const char *interface_type) 3740static phy_interface_t to_phy_interface(const char *phy_connection_type)
3741{ 3741{
3742 if (strcasecmp(interface_type, "mii") == 0) 3742 if (strcasecmp(phy_connection_type, "mii") == 0)
3743 return PHY_INTERFACE_MODE_MII; 3743 return PHY_INTERFACE_MODE_MII;
3744 if (strcasecmp(interface_type, "gmii") == 0) 3744 if (strcasecmp(phy_connection_type, "gmii") == 0)
3745 return PHY_INTERFACE_MODE_GMII; 3745 return PHY_INTERFACE_MODE_GMII;
3746 if (strcasecmp(interface_type, "tbi") == 0) 3746 if (strcasecmp(phy_connection_type, "tbi") == 0)
3747 return PHY_INTERFACE_MODE_TBI; 3747 return PHY_INTERFACE_MODE_TBI;
3748 if (strcasecmp(interface_type, "rmii") == 0) 3748 if (strcasecmp(phy_connection_type, "rmii") == 0)
3749 return PHY_INTERFACE_MODE_RMII; 3749 return PHY_INTERFACE_MODE_RMII;
3750 if (strcasecmp(interface_type, "rgmii") == 0) 3750 if (strcasecmp(phy_connection_type, "rgmii") == 0)
3751 return PHY_INTERFACE_MODE_RGMII; 3751 return PHY_INTERFACE_MODE_RGMII;
3752 if (strcasecmp(interface_type, "rgmii-id") == 0) 3752 if (strcasecmp(phy_connection_type, "rgmii-id") == 0)
3753 return PHY_INTERFACE_MODE_RGMII_ID; 3753 return PHY_INTERFACE_MODE_RGMII_ID;
3754 if (strcasecmp(interface_type, "rtbi") == 0) 3754 if (strcasecmp(phy_connection_type, "rtbi") == 0)
3755 return PHY_INTERFACE_MODE_RTBI; 3755 return PHY_INTERFACE_MODE_RTBI;
3756 3756
3757 return PHY_INTERFACE_MODE_MII; 3757 return PHY_INTERFACE_MODE_MII;
@@ -3819,29 +3819,21 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3819 ug_info->phy_address = *prop; 3819 ug_info->phy_address = *prop;
3820 3820
3821 /* get the phy interface type, or default to MII */ 3821 /* get the phy interface type, or default to MII */
3822 prop = of_get_property(np, "interface-type", NULL); 3822 prop = of_get_property(np, "phy-connection-type", NULL);
3823 if (!prop) { 3823 if (!prop) {
3824 /* handle interface property present in old trees */ 3824 /* handle interface property present in old trees */
3825 prop = of_get_property(phy, "interface", NULL); 3825 prop = of_get_property(phy, "interface", NULL);
3826 if (prop != NULL) 3826 if (prop != NULL) {
3827 phy_interface = enet_to_phy_interface[*prop]; 3827 phy_interface = enet_to_phy_interface[*prop];
3828 else 3828 max_speed = enet_to_speed[*prop];
3829 } else
3829 phy_interface = PHY_INTERFACE_MODE_MII; 3830 phy_interface = PHY_INTERFACE_MODE_MII;
3830 } else { 3831 } else {
3831 phy_interface = to_phy_interface((const char *)prop); 3832 phy_interface = to_phy_interface((const char *)prop);
3832 } 3833 }
3833 3834
3834 /* get speed, or derive from interface */ 3835 /* get speed, or derive from PHY interface */
3835 prop = of_get_property(np, "max-speed", NULL); 3836 if (max_speed == 0)
3836 if (!prop) {
3837 /* handle interface property present in old trees */
3838 prop = of_get_property(phy, "interface", NULL);
3839 if (prop != NULL)
3840 max_speed = enet_to_speed[*prop];
3841 } else {
3842 max_speed = *prop;
3843 }
3844 if (!max_speed) {
3845 switch (phy_interface) { 3837 switch (phy_interface) {
3846 case PHY_INTERFACE_MODE_GMII: 3838 case PHY_INTERFACE_MODE_GMII:
3847 case PHY_INTERFACE_MODE_RGMII: 3839 case PHY_INTERFACE_MODE_RGMII:
@@ -3854,9 +3846,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3854 max_speed = SPEED_100; 3846 max_speed = SPEED_100;
3855 break; 3847 break;
3856 } 3848 }
3857 }
3858 3849
3859 if (max_speed == SPEED_1000) { 3850 if (max_speed == SPEED_1000) {
3851 /* configure muram FIFOs for gigabit operation */
3860 ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT; 3852 ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT;
3861 ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT; 3853 ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT;
3862 ug_info->uf_info.urfset = UCC_GETH_URFSET_GIGA_INIT; 3854 ug_info->uf_info.urfset = UCC_GETH_URFSET_GIGA_INIT;
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 27a1ef3b7b06..f96966d4bcc2 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -1,12 +1,13 @@
1/* 1/*
2 * drivers/net/ucc_geth_mii.c 2 * drivers/net/ucc_geth_mii.c
3 * 3 *
4 * Gianfar Ethernet Driver -- MIIM bus implementation 4 * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation
5 * Provides Bus interface for MIIM regs 5 * Provides Bus interface for MII Management regs in the UCC register space
6 * 6 *
7 * Author: Li Yang 7 * Copyright (C) 2007 Freescale Semiconductor, Inc.
8 * 8 *
9 * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. 9 * Authors: Li Yang <leoli@freescale.com>
10 * Kim Phillips <kim.phillips@freescale.com>
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the
diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h
index 98430fe0bfc6..d83437039919 100644
--- a/drivers/net/ucc_geth_mii.h
+++ b/drivers/net/ucc_geth_mii.h
@@ -1,13 +1,13 @@
1/* 1/*
2 * drivers/net/ucc_geth_mii.h 2 * drivers/net/ucc_geth_mii.h
3 * 3 *
4 * Gianfar Ethernet Driver -- MII Management Bus Implementation 4 * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation
5 * Driver for the MDIO bus controller in the Gianfar register space 5 * Provides Bus interface for MII Management regs in the UCC register space
6 * 6 *
7 * Author: Andy Fleming 7 * Copyright (C) 2007 Freescale Semiconductor, Inc.
8 * Maintainer: Kumar Gala
9 * 8 *
10 * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. 9 * Authors: Li Yang <leoli@freescale.com>
10 * Kim Phillips <kim.phillips@freescale.com>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the