Re: [PATCH 9/16] CRIS architecture: Correct compile errors
On Tue, Oct 30, 2007 at 04:32:35PM +0100, Roel Kluin wrote: > Jesper Nilsson wrote: > > + if (np->mii_if.phy_id == 32) > > return -ENODEV; > You need to unlock before this return. Thanks for spotting this! /^JN - Jesper Nilsson -- Jesper Nilsson -- [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 9/16] CRIS architecture: Correct compile errors
On Tue, Oct 30, 2007 at 04:32:35PM +0100, Roel Kluin wrote: Jesper Nilsson wrote: + if (np-mii_if.phy_id == 32) return -ENODEV; You need to unlock before this return. Thanks for spotting this! /^JN - Jesper Nilsson -- Jesper Nilsson -- [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 9/16] CRIS architecture: Correct compile errors
On Tue, 30 Oct 2007 10:32:31 +0100 Jesper Nilsson <[EMAIL PROTECTED]> wrote: > New (updated) version of ethernet driver for cris v10. This driver (and this patch) contain a large number of trivial coding-style glitches. Please always pass the diffs through scripts/checkpatch.pl and review the output, thanks. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 9/16] CRIS architecture: Correct compile errors
Jesper Nilsson wrote: > static int > e100_probe_transceiver(struct net_device* dev) > { > +#if !defined(CONFIG_ETRAX_NO_PHY) > unsigned int phyid_high; > unsigned int phyid_low; > unsigned int oui; > struct transceiver_ops* ops = NULL; > + struct net_local *np = netdev_priv(dev); > + > + spin_lock(>transceiver_lock); > > /* Probe MDIO physical address */ > - for (mdio_phy_addr = 0; mdio_phy_addr <= 31; mdio_phy_addr++) { > - if (e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMSR) != 0x) > + for (np->mii_if.phy_id = 0; np->mii_if.phy_id <= 31; > + np->mii_if.phy_id++) { > + if (e100_get_mdio_reg(dev, > + np->mii_if.phy_id, MII_BMSR) != 0x) > break; > } > - if (mdio_phy_addr == 32) > + if (np->mii_if.phy_id == 32) >return -ENODEV; You need to unlock before this return. > > /* Get manufacturer */ > - phyid_high = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID1); > - phyid_low = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID2); > + phyid_high = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID1); > + phyid_low = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID2); > oui = (phyid_high << 6) | (phyid_low >> 10); > > for (ops = [0]; ops->oui; ops++) { > @@ -998,6 +912,8 @@ > } > transceiver = ops; > > + spin_unlock(>transceiver_lock); > +#endif > return 0; > } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 9/16] CRIS architecture: Correct compile errors
New (updated) version of ethernet driver for cris v10. - First steps to simplify and make the MII code more similar between the etrax100 and etraxfs ports. - Start the transmit queue before enabling tx interrupts to avoid race with the first frame. - Flip the comparition statement to stick to physical addresses to avoid phys_to_virt mapping a potential null pointer. This was not an error but the change simplifies debugging of address-space mappings. - Made myPrevRxDesc local to e100_rx since it was only used there. Fixed out of memory handling in e100_rx. If dev_alloc_skb() fails persistently the system is hosed anyway but at least it won't loop in an interrupt handler. - Correct some code formatting issues. - Add defines SET_ETH_ENABLE_LEDS, SET_ETH_DISABLE_LEDS and SET_ETH_AUTONEG used in new cris v10 ethernet driver. Signed-off-by: Jesper Nilsson <[EMAIL PROTECTED]> --- drivers/net/cris/eth_v10.c | 430 include/asm-cris/ethernet.h |3 2 files changed, 280 insertions(+), 153 deletions(-) diff -urBb -X /h/jespern/.exclude_files clean_linux-2.6.23/drivers/net/cris/eth_v10.c linux-2.6.23/drivers/net/cris/eth_v10.c --- clean_linux-2.6.23/drivers/net/cris/eth_v10.c 2007-10-09 22:31:38.0 +0200 +++ linux-2.6.23/drivers/net/cris/eth_v10.c 2007-10-23 10:44:11.0 +0200 @@ -250,6 +39,7 @@ #include #include #include +#include //#define ETHDEBUG #define D(x) @@ -279,6 +69,9 @@ * by this lock as well. */ spinlock_t lock; + + spinlock_t led_lock; /* Protect LED state */ + spinlock_t transceiver_lock; /* Protect transceiver state. */ }; typedef struct etrax_eth_descr @@ -295,8 +88,6 @@ void (*check_duplex)(struct net_device* dev); }; -struct transceiver_ops* transceiver; - /* Duplex settings */ enum duplex { @@ -307,7 +98,7 @@ /* Dma descriptors etc. */ -#define MAX_MEDIA_DATA_SIZE 1518 +#define MAX_MEDIA_DATA_SIZE 1522 #define MIN_PACKET_LEN 46 #define ETHER_HEAD_LEN 14 @@ -332,8 +123,8 @@ /*Intel LXT972A specific*/ #define MDIO_INT_STATUS_REG_2 0x0011 -#define MDIO_INT_FULL_DUPLEX_IND ( 1 << 9 ) -#define MDIO_INT_SPEED ( 1 << 14 ) +#define MDIO_INT_FULL_DUPLEX_IND (1 << 9) +#define MDIO_INT_SPEED(1 << 14) /* Network flash constants */ #define NET_FLASH_TIME (HZ/50) /* 20 ms */ @@ -344,8 +135,8 @@ #define NO_NETWORK_ACTIVITY 0 #define NETWORK_ACTIVITY1 -#define NBR_OF_RX_DESC 64 -#define NBR_OF_TX_DESC 256 +#define NBR_OF_RX_DESC 32 +#define NBR_OF_TX_DESC 16 /* Large packets are sent directly to upper layers while small packets are */ /* copied (to reduce memory waste). The following constant decides the breakpoint */ @@ -367,7 +158,6 @@ static etrax_eth_descr *myNextRxDesc; /* Points to the next descriptor to to be processed */ static etrax_eth_descr *myLastRxDesc; /* The last processed descriptor */ -static etrax_eth_descr *myPrevRxDesc; /* The descriptor right before myNextRxDesc */ static etrax_eth_descr RxDescList[NBR_OF_RX_DESC] __attribute__ ((aligned(32))); @@ -377,7 +167,6 @@ static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32))); static unsigned int network_rec_config_shadow = 0; -static unsigned int mdio_phy_addr; /* Transciever address */ static unsigned int network_tr_ctrl_shadow = 0; @@ -411,7 +200,7 @@ static void e100_tx_timeout(struct net_device *dev); static struct net_device_stats *e100_get_stats(struct net_device *dev); static void set_multicast_list(struct net_device *dev); -static void e100_hardware_send_packet(char *buf, int length); +static void e100_hardware_send_packet(struct net_local* np, char *buf, int length); static void update_rx_stats(struct net_device_stats *); static void update_tx_stats(struct net_device_stats *); static int e100_probe_transceiver(struct net_device* dev); @@ -434,7 +223,10 @@ static void e100_set_network_leds(int active); static const struct ethtool_ops e100_ethtool_ops; - +#if defined(CONFIG_ETRAX_NO_PHY) +static void dummy_check_speed(struct net_device* dev); +static void dummy_check_duplex(struct net_device* dev); +#else static void broadcom_check_speed(struct net_device* dev); static void broadcom_check_duplex(struct net_device* dev); static void tdk_check_speed(struct net_device* dev); @@ -443,16 +235,28 @@ static void intel_check_duplex(struct net_device* dev); static void generic_check_speed(struct net_device* dev); static void generic_check_duplex(struct net_device* dev); +#endif +#ifdef CONFIG_NET_POLL_CONTROLLER +static void e100_netpoll(struct net_device* dev); +#endif + +static int autoneg_normal = 1; struct transceiver_ops transceivers[] = { +#if defined(CONFIG_ETRAX_NO_PHY) + {0x, dummy_check_speed,
[PATCH 9/16] CRIS architecture: Correct compile errors
New (updated) version of ethernet driver for cris v10. - First steps to simplify and make the MII code more similar between the etrax100 and etraxfs ports. - Start the transmit queue before enabling tx interrupts to avoid race with the first frame. - Flip the comparition statement to stick to physical addresses to avoid phys_to_virt mapping a potential null pointer. This was not an error but the change simplifies debugging of address-space mappings. - Made myPrevRxDesc local to e100_rx since it was only used there. Fixed out of memory handling in e100_rx. If dev_alloc_skb() fails persistently the system is hosed anyway but at least it won't loop in an interrupt handler. - Correct some code formatting issues. - Add defines SET_ETH_ENABLE_LEDS, SET_ETH_DISABLE_LEDS and SET_ETH_AUTONEG used in new cris v10 ethernet driver. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- drivers/net/cris/eth_v10.c | 430 include/asm-cris/ethernet.h |3 2 files changed, 280 insertions(+), 153 deletions(-) diff -urBb -X /h/jespern/.exclude_files clean_linux-2.6.23/drivers/net/cris/eth_v10.c linux-2.6.23/drivers/net/cris/eth_v10.c --- clean_linux-2.6.23/drivers/net/cris/eth_v10.c 2007-10-09 22:31:38.0 +0200 +++ linux-2.6.23/drivers/net/cris/eth_v10.c 2007-10-23 10:44:11.0 +0200 @@ -250,6 +39,7 @@ #include asm/bitops.h #include asm/ethernet.h #include asm/cache.h +#include asm/arch/io_interface_mux.h //#define ETHDEBUG #define D(x) @@ -279,6 +69,9 @@ * by this lock as well. */ spinlock_t lock; + + spinlock_t led_lock; /* Protect LED state */ + spinlock_t transceiver_lock; /* Protect transceiver state. */ }; typedef struct etrax_eth_descr @@ -295,8 +88,6 @@ void (*check_duplex)(struct net_device* dev); }; -struct transceiver_ops* transceiver; - /* Duplex settings */ enum duplex { @@ -307,7 +98,7 @@ /* Dma descriptors etc. */ -#define MAX_MEDIA_DATA_SIZE 1518 +#define MAX_MEDIA_DATA_SIZE 1522 #define MIN_PACKET_LEN 46 #define ETHER_HEAD_LEN 14 @@ -332,8 +123,8 @@ /*Intel LXT972A specific*/ #define MDIO_INT_STATUS_REG_2 0x0011 -#define MDIO_INT_FULL_DUPLEX_IND ( 1 9 ) -#define MDIO_INT_SPEED ( 1 14 ) +#define MDIO_INT_FULL_DUPLEX_IND (1 9) +#define MDIO_INT_SPEED(1 14) /* Network flash constants */ #define NET_FLASH_TIME (HZ/50) /* 20 ms */ @@ -344,8 +135,8 @@ #define NO_NETWORK_ACTIVITY 0 #define NETWORK_ACTIVITY1 -#define NBR_OF_RX_DESC 64 -#define NBR_OF_TX_DESC 256 +#define NBR_OF_RX_DESC 32 +#define NBR_OF_TX_DESC 16 /* Large packets are sent directly to upper layers while small packets are */ /* copied (to reduce memory waste). The following constant decides the breakpoint */ @@ -367,7 +158,6 @@ static etrax_eth_descr *myNextRxDesc; /* Points to the next descriptor to to be processed */ static etrax_eth_descr *myLastRxDesc; /* The last processed descriptor */ -static etrax_eth_descr *myPrevRxDesc; /* The descriptor right before myNextRxDesc */ static etrax_eth_descr RxDescList[NBR_OF_RX_DESC] __attribute__ ((aligned(32))); @@ -377,7 +167,6 @@ static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32))); static unsigned int network_rec_config_shadow = 0; -static unsigned int mdio_phy_addr; /* Transciever address */ static unsigned int network_tr_ctrl_shadow = 0; @@ -411,7 +200,7 @@ static void e100_tx_timeout(struct net_device *dev); static struct net_device_stats *e100_get_stats(struct net_device *dev); static void set_multicast_list(struct net_device *dev); -static void e100_hardware_send_packet(char *buf, int length); +static void e100_hardware_send_packet(struct net_local* np, char *buf, int length); static void update_rx_stats(struct net_device_stats *); static void update_tx_stats(struct net_device_stats *); static int e100_probe_transceiver(struct net_device* dev); @@ -434,7 +223,10 @@ static void e100_set_network_leds(int active); static const struct ethtool_ops e100_ethtool_ops; - +#if defined(CONFIG_ETRAX_NO_PHY) +static void dummy_check_speed(struct net_device* dev); +static void dummy_check_duplex(struct net_device* dev); +#else static void broadcom_check_speed(struct net_device* dev); static void broadcom_check_duplex(struct net_device* dev); static void tdk_check_speed(struct net_device* dev); @@ -443,16 +235,28 @@ static void intel_check_duplex(struct net_device* dev); static void generic_check_speed(struct net_device* dev); static void generic_check_duplex(struct net_device* dev); +#endif +#ifdef CONFIG_NET_POLL_CONTROLLER +static void e100_netpoll(struct net_device* dev); +#endif + +static int autoneg_normal = 1; struct transceiver_ops transceivers[] = { +#if
Re: [PATCH 9/16] CRIS architecture: Correct compile errors
Jesper Nilsson wrote: static int e100_probe_transceiver(struct net_device* dev) { +#if !defined(CONFIG_ETRAX_NO_PHY) unsigned int phyid_high; unsigned int phyid_low; unsigned int oui; struct transceiver_ops* ops = NULL; + struct net_local *np = netdev_priv(dev); + + spin_lock(np-transceiver_lock); /* Probe MDIO physical address */ - for (mdio_phy_addr = 0; mdio_phy_addr = 31; mdio_phy_addr++) { - if (e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMSR) != 0x) + for (np-mii_if.phy_id = 0; np-mii_if.phy_id = 31; + np-mii_if.phy_id++) { + if (e100_get_mdio_reg(dev, + np-mii_if.phy_id, MII_BMSR) != 0x) break; } - if (mdio_phy_addr == 32) + if (np-mii_if.phy_id == 32) return -ENODEV; You need to unlock before this return. /* Get manufacturer */ - phyid_high = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID1); - phyid_low = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID2); + phyid_high = e100_get_mdio_reg(dev, np-mii_if.phy_id, MII_PHYSID1); + phyid_low = e100_get_mdio_reg(dev, np-mii_if.phy_id, MII_PHYSID2); oui = (phyid_high 6) | (phyid_low 10); for (ops = transceivers[0]; ops-oui; ops++) { @@ -998,6 +912,8 @@ } transceiver = ops; + spin_unlock(np-transceiver_lock); +#endif return 0; } - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 9/16] CRIS architecture: Correct compile errors
On Tue, 30 Oct 2007 10:32:31 +0100 Jesper Nilsson [EMAIL PROTECTED] wrote: New (updated) version of ethernet driver for cris v10. This driver (and this patch) contain a large number of trivial coding-style glitches. Please always pass the diffs through scripts/checkpatch.pl and review the output, thanks. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/