From a54c545134ea77609ed9eb5df50524c097112327 Mon Sep 17 00:00:00 2001 From: "olof@lixom.net" Date: Sat, 12 May 2007 14:57:27 -0500 Subject: pasemi_mac: Fix register defines Some shift values were obviously wrong. Fix them to correspond with the masks. Signed-off-by: Olof Johansson Signed-off-by: Jeff Garzik --- drivers/net/pasemi_mac.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 { PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) #define PAS_IOB_DMA_RXCH_RESET(i) (0x1500 + (i)*4) #define PAS_IOB_DMA_RXCH_RESET_PCNT_M 0xffff0000 -#define PAS_IOB_DMA_RXCH_RESET_PCNT_S 0 +#define PAS_IOB_DMA_RXCH_RESET_PCNT_S 16 #define PAS_IOB_DMA_RXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_RXCH_RESET_PCNT_S) & \ PAS_IOB_DMA_RXCH_RESET_PCNT_M) #define PAS_IOB_DMA_RXCH_RESET_PCNTRST 0x00000020 @@ -352,7 +352,7 @@ enum { #define PAS_IOB_DMA_RXCH_RESET_PINTC 0x00000001 #define PAS_IOB_DMA_TXCH_RESET(i) (0x1600 + (i)*4) #define PAS_IOB_DMA_TXCH_RESET_PCNT_M 0xffff0000 -#define PAS_IOB_DMA_TXCH_RESET_PCNT_S 0 +#define PAS_IOB_DMA_TXCH_RESET_PCNT_S 16 #define PAS_IOB_DMA_TXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_TXCH_RESET_PCNT_S) & \ PAS_IOB_DMA_TXCH_RESET_PCNT_M) #define PAS_IOB_DMA_TXCH_RESET_PCNTRST 0x00000020 -- cgit v1.2.3 From 52a9435183f961e1bb3c146a62bfbecf93d15d58 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Sat, 12 May 2007 18:01:09 -0500 Subject: pasemi_mac: Interrupt ack fixes Interrupt ack fixes Fix the packet count resets at interrupt time, using the cacheable packet count status to set number of processed/received packets, since the ack count is the cumulative number of packets processed, and not incremental. Signed-off-by: Olof Johansson Signed-off-by: Jeff Garzik --- drivers/net/pasemi_mac.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index bc7f3dee6e5b..39e33aeca11a 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c @@ -384,17 +384,14 @@ static void pasemi_mac_replenish_rx_ring(struct net_device *dev) static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac) { - unsigned int reg, stat; + unsigned int reg, pcnt; /* Re-enable packet count interrupts: finally * ack the packet count interrupt we got in rx_intr. */ - pci_read_config_dword(mac->iob_pdev, - PAS_IOB_DMA_RXCH_STAT(mac->dma_rxch), - &stat); + pcnt = *mac->rx_status & PAS_STATUS_PCNT_M; - reg = PAS_IOB_DMA_RXCH_RESET_PCNT(stat & PAS_IOB_DMA_RXCH_STAT_CNTDEL_M) - | PAS_IOB_DMA_RXCH_RESET_PINTC; + reg = PAS_IOB_DMA_RXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_RXCH_RESET_PINTC; pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), @@ -403,14 +400,12 @@ static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac) static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac) { - unsigned int reg, stat; + unsigned int reg, pcnt; /* Re-enable packet count interrupts */ - pci_read_config_dword(mac->iob_pdev, - PAS_IOB_DMA_TXCH_STAT(mac->dma_txch), &stat); + pcnt = *mac->tx_status & PAS_STATUS_PCNT_M; - reg = PAS_IOB_DMA_TXCH_RESET_PCNT(stat & PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) - | PAS_IOB_DMA_TXCH_RESET_PINTC; + reg = PAS_IOB_DMA_TXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_TXCH_RESET_PINTC; pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg); @@ -591,21 +586,24 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data) { struct net_device *dev = data; struct pasemi_mac *mac = netdev_priv(dev); - unsigned int reg; + unsigned int reg, pcnt; if (!(*mac->tx_status & PAS_STATUS_CAUSE_M)) return IRQ_NONE; pasemi_mac_clean_tx(mac); - reg = PAS_IOB_DMA_TXCH_RESET_PINTC; + pcnt = *mac->tx_status & PAS_STATUS_PCNT_M; + + reg = PAS_IOB_DMA_TXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_TXCH_RESET_PINTC; if (*mac->tx_status & PAS_STATUS_SOFT) reg |= PAS_IOB_DMA_TXCH_RESET_SINTC; if (*mac->tx_status & PAS_STATUS_ERROR) reg |= PAS_IOB_DMA_TXCH_RESET_DINTC; - pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), + pci_write_config_dword(mac->iob_pdev, + PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg); return IRQ_HANDLED; @@ -974,6 +972,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev) if (txring->next_to_clean - txring->next_to_use == TX_RING_SIZE) { spin_unlock_irqrestore(&txring->lock, flags); pasemi_mac_clean_tx(mac); + pasemi_mac_restart_tx_intr(mac); spin_lock_irqsave(&txring->lock, flags); if (txring->next_to_clean - txring->next_to_use == -- cgit v1.2.3 From fd17825480b2de3076727c677f8e257623705963 Mon Sep 17 00:00:00 2001 From: "olof@lixom.net" Date: Sat, 12 May 2007 14:57:36 -0500 Subject: pasemi_mac: Terminate PCI ID list This caused some very interesting behaviour depending on what happened to be built at the same time. Add terminating empty entry to the list of IDs. Signed-off-by: Olof Johansson Signed-off-by: Jeff Garzik --- drivers/net/pasemi_mac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 39e33aeca11a..933d56476894 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c @@ -1209,6 +1209,7 @@ static void __devexit pasemi_mac_remove(struct pci_dev *pdev) static struct pci_device_id pasemi_mac_pci_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa005) }, { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa006) }, + { }, }; MODULE_DEVICE_TABLE(pci, pasemi_mac_pci_tbl); -- cgit v1.2.3 From 1af7f05628fab81fdf4412d757676412ba5db660 Mon Sep 17 00:00:00 2001 From: "olof@lixom.net" Date: Sat, 12 May 2007 14:57:46 -0500 Subject: pasemi_mac: Fix local-mac-address parsing Turns out we have an old version of firmware that stores the mac address in 'mac-address' as a string instead of a byte array. All versions that use local-mac-address should have it as byte array, so no need to do string parsing for that case. Signed-off-by: Olof Johansson Signed-off-by: Jeff Garzik --- drivers/net/pasemi_mac.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 933d56476894..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) { struct pci_dev *pdev = mac->pdev; struct device_node *dn = pci_device_to_OF_node(pdev); + int len; const u8 *maddr; u8 addr[6]; @@ -94,9 +95,17 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac) return -ENOENT; } - maddr = of_get_property(dn, "local-mac-address", NULL); + maddr = of_get_property(dn, "local-mac-address", &len); + + if (maddr && len == 6) { + memcpy(mac->mac_addr, maddr, 6); + return 0; + } + + /* Some old versions of firmware mistakenly uses mac-address + * (and as a string) instead of a byte array in local-mac-address. + */ - /* Fall back to mac-address for older firmware */ if (maddr == NULL) maddr = of_get_property(dn, "mac-address", NULL); @@ -106,6 +115,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac) return -ENOENT; } + if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6) { dev_warn(&pdev->dev, @@ -113,7 +123,8 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac) return -EINVAL; } - memcpy(mac->mac_addr, addr, sizeof(addr)); + memcpy(mac->mac_addr, addr, 6); + return 0; } -- cgit v1.2.3 From f2773a29596d835d2b00137ba925c186699ea117 Mon Sep 17 00:00:00 2001 From: Vitaly Wool Date: Sun, 13 May 2007 18:42:08 +0400 Subject: smc911x: fix compilation breakage Looks like the new version of this patch has been overlooked, so I'm resending it. It just adapts the driver to the new IRQ API according to what Russell has pointed out. drivers/net/smc911x.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Signed-off-by: Vitaly Wool Signed-off-by: Jeff Garzik --- drivers/net/smc911x.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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[] = #include #include -#include #include "smc911x.h" @@ -2084,12 +2083,11 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr) lp->ctl_rspeed = 100; /* Grab the IRQ */ - retval = request_irq(dev->irq, &smc911x_interrupt, IRQF_SHARED, dev->name, dev); + retval = request_irq(dev->irq, &smc911x_interrupt, + IRQF_SHARED | IRQF_TRIGGER_FALLING, dev->name, dev); if (retval) goto err_out; - set_irq_type(dev->irq, IRQT_FALLING); - #ifdef SMC_USE_DMA lp->rxdma = SMC_DMA_REQUEST(dev, smc911x_rx_dma_irq); lp->txdma = SMC_DMA_REQUEST(dev, smc911x_tx_dma_irq); -- cgit v1.2.3 From 4e19b5c193454ade8d86468077078f680d121979 Mon Sep 17 00:00:00 2001 From: Kim Phillips Date: Fri, 11 May 2007 18:25:07 -0500 Subject: ucc_geth: eliminate max-speed, change interface-type to phy-connection-type It was agreed that phy-connection-type was a better name for the interface-type property, so this patch renames it. Also, the max-speed property name was determined too generic, and is therefore eliminated in favour of phy-connection-type derivation logic. includes corrections to copyright text. Signed-off-by: Kim Phillips Signed-off-by: Jeff Garzik --- drivers/net/ucc_geth.c | 40 ++++++++++++++++------------------------ drivers/net/ucc_geth_mii.c | 9 +++++---- drivers/net/ucc_geth_mii.h | 10 +++++----- 3 files changed, 26 insertions(+), 33 deletions(-) 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 @@ /* - * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. + * Copyright (C) 2006-2007 Freescale Semicondutor, Inc. All rights reserved. * * Author: Shlomi Gridish * Li Yang @@ -3737,21 +3737,21 @@ static int ucc_geth_close(struct net_device *dev) const struct ethtool_ops ucc_geth_ethtool_ops = { }; -static phy_interface_t to_phy_interface(const char *interface_type) +static phy_interface_t to_phy_interface(const char *phy_connection_type) { - if (strcasecmp(interface_type, "mii") == 0) + if (strcasecmp(phy_connection_type, "mii") == 0) return PHY_INTERFACE_MODE_MII; - if (strcasecmp(interface_type, "gmii") == 0) + if (strcasecmp(phy_connection_type, "gmii") == 0) return PHY_INTERFACE_MODE_GMII; - if (strcasecmp(interface_type, "tbi") == 0) + if (strcasecmp(phy_connection_type, "tbi") == 0) return PHY_INTERFACE_MODE_TBI; - if (strcasecmp(interface_type, "rmii") == 0) + if (strcasecmp(phy_connection_type, "rmii") == 0) return PHY_INTERFACE_MODE_RMII; - if (strcasecmp(interface_type, "rgmii") == 0) + if (strcasecmp(phy_connection_type, "rgmii") == 0) return PHY_INTERFACE_MODE_RGMII; - if (strcasecmp(interface_type, "rgmii-id") == 0) + if (strcasecmp(phy_connection_type, "rgmii-id") == 0) return PHY_INTERFACE_MODE_RGMII_ID; - if (strcasecmp(interface_type, "rtbi") == 0) + if (strcasecmp(phy_connection_type, "rtbi") == 0) return PHY_INTERFACE_MODE_RTBI; return PHY_INTERFACE_MODE_MII; @@ -3819,29 +3819,21 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ug_info->phy_address = *prop; /* get the phy interface type, or default to MII */ - prop = of_get_property(np, "interface-type", NULL); + prop = of_get_property(np, "phy-connection-type", NULL); if (!prop) { /* handle interface property present in old trees */ prop = of_get_property(phy, "interface", NULL); - if (prop != NULL) + if (prop != NULL) { phy_interface = enet_to_phy_interface[*prop]; - else + max_speed = enet_to_speed[*prop]; + } else phy_interface = PHY_INTERFACE_MODE_MII; } else { phy_interface = to_phy_interface((const char *)prop); } - /* get speed, or derive from interface */ - prop = of_get_property(np, "max-speed", NULL); - if (!prop) { - /* handle interface property present in old trees */ - prop = of_get_property(phy, "interface", NULL); - if (prop != NULL) - max_speed = enet_to_speed[*prop]; - } else { - max_speed = *prop; - } - if (!max_speed) { + /* get speed, or derive from PHY interface */ + if (max_speed == 0) switch (phy_interface) { case PHY_INTERFACE_MODE_GMII: case PHY_INTERFACE_MODE_RGMII: @@ -3854,9 +3846,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma max_speed = SPEED_100; break; } - } if (max_speed == SPEED_1000) { + /* configure muram FIFOs for gigabit operation */ ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT; ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT; 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 @@ /* * drivers/net/ucc_geth_mii.c * - * Gianfar Ethernet Driver -- MIIM bus implementation - * Provides Bus interface for MIIM regs + * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation + * Provides Bus interface for MII Management regs in the UCC register space * - * Author: Li Yang + * Copyright (C) 2007 Freescale Semiconductor, Inc. * - * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. + * Authors: Li Yang + * Kim Phillips * * This program is free software; you can redistribute it and/or modify it * 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 @@ /* * drivers/net/ucc_geth_mii.h * - * Gianfar Ethernet Driver -- MII Management Bus Implementation - * Driver for the MDIO bus controller in the Gianfar register space + * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation + * Provides Bus interface for MII Management regs in the UCC register space * - * Author: Andy Fleming - * Maintainer: Kumar Gala + * Copyright (C) 2007 Freescale Semiconductor, Inc. * - * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. + * Authors: Li Yang + * Kim Phillips * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the -- cgit v1.2.3