diff options
Diffstat (limited to 'drivers/net')
56 files changed, 283 insertions, 259 deletions
diff --git a/drivers/net/4xx_enet.c b/drivers/net/4xx_enet.c index 73700dd0df..7c6e362f0e 100644 --- a/drivers/net/4xx_enet.c +++ b/drivers/net/4xx_enet.c @@ -1557,8 +1557,7 @@ get_speed: } -static int ppc_4xx_eth_send (struct eth_device *dev, volatile void *ptr, - int len) +static int ppc_4xx_eth_send(struct eth_device *dev, void *ptr, int len) { struct enet_frame *ef_ptr; ulong time_start, time_now; diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 0e6aac7173..de517f8dab 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -257,8 +257,7 @@ static int tse_adjust_link(struct altera_tse_priv *priv) return 0; } -static int tse_eth_send(struct eth_device *dev, - volatile void *packet, int length) +static int tse_eth_send(struct eth_device *dev, void *packet, int length) { struct altera_tse_priv *priv = dev->priv; volatile struct alt_sgdma_registers *tx_sgdma = priv->sgdma_tx; diff --git a/drivers/net/armada100_fec.c b/drivers/net/armada100_fec.c index 52be3a7195..d318a36398 100644 --- a/drivers/net/armada100_fec.c +++ b/drivers/net/armada100_fec.c @@ -558,8 +558,7 @@ static void armdfec_halt(struct eth_device *dev) clrbits_le32(®s->pconf, PCR_EN); } -static int armdfec_send(struct eth_device *dev, volatile void *dataptr, - int datasize) +static int armdfec_send(struct eth_device *dev, void *dataptr, int datasize) { struct armdfec_device *darmdfec = to_darmdfec(dev); struct armdfec_reg *regs = darmdfec->regs; diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c index 483c831c05..2fa6b686da 100644 --- a/drivers/net/at91_emac.c +++ b/drivers/net/at91_emac.c @@ -415,8 +415,7 @@ static void at91emac_halt(struct eth_device *netdev) debug_cond(DEBUG_AT91EMAC, "halt MAC\n"); } -static int at91emac_send(struct eth_device *netdev, volatile void *packet, - int length) +static int at91emac_send(struct eth_device *netdev, void *packet, int length) { at91_emac_t *emac; diff --git a/drivers/net/ax88180.c b/drivers/net/ax88180.c index bc3e6ad58a..f5017682d4 100644 --- a/drivers/net/ax88180.c +++ b/drivers/net/ax88180.c @@ -604,8 +604,7 @@ static int ax88180_recv (struct eth_device *dev) } /* Send a data block via Ethernet. */ -static int -ax88180_send (struct eth_device *dev, volatile void *packet, int length) +static int ax88180_send(struct eth_device *dev, void *packet, int length) { struct ax88180_private *priv = (struct ax88180_private *)dev->priv; unsigned short TXDES_addr; diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index dcc781a46a..e24ac4a174 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c @@ -118,8 +118,7 @@ int bfin_EMAC_initialize(bd_t *bis) return 0; } -static int bfin_EMAC_send(struct eth_device *dev, volatile void *packet, - int length) +static int bfin_EMAC_send(struct eth_device *dev, void *packet, int length) { int i; int result = 0; @@ -471,7 +470,7 @@ int ether_post_test(int flags) for (i = 0; i < 42; i++) buf[i + 22] = i; printf("--------Send 64 bytes......\n"); - bfin_EMAC_send(NULL, (volatile void *)buf, 64); + bfin_EMAC_send(NULL, buf, 64); for (i = 0; i < 100; i++) { udelay(10000); if ((rxbuf[rxIdx]->StatusWord & RX_COMP) != 0) { diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h index c731c179b5..54ffb3830e 100644 --- a/drivers/net/bfin_mac.h +++ b/drivers/net/bfin_mac.h @@ -58,7 +58,7 @@ static ADI_ETHER_BUFFER *SetupTxBuffer(int no); static int bfin_EMAC_init(struct eth_device *dev, bd_t *bd); static void bfin_EMAC_halt(struct eth_device *dev); -static int bfin_EMAC_send(struct eth_device *dev, volatile void *packet, int length); +static int bfin_EMAC_send(struct eth_device *dev, void *packet, int length); static int bfin_EMAC_recv(struct eth_device *dev); static int bfin_EMAC_setup_addr(struct eth_device *dev); diff --git a/drivers/net/calxedaxgmac.c b/drivers/net/calxedaxgmac.c index 00e26c2adc..e3553d68d8 100644 --- a/drivers/net/calxedaxgmac.c +++ b/drivers/net/calxedaxgmac.c @@ -434,7 +434,7 @@ static int xgmac_init(struct eth_device *dev, bd_t * bis) return 0; } -static int xgmac_tx(struct eth_device *dev, volatile void *packet, int length) +static int xgmac_tx(struct eth_device *dev, void *packet, int length) { struct xgmac_regs *regs = (struct xgmac_regs *)dev->iobase; struct calxeda_eth_dev *priv = dev->priv; @@ -442,7 +442,7 @@ static int xgmac_tx(struct eth_device *dev, volatile void *packet, int length) struct xgmac_dma_desc *txdesc = &priv->tx_chain[currdesc]; int timeout; - desc_set_buf_addr_and_size(txdesc, (void *)packet, length); + desc_set_buf_addr_and_size(txdesc, packet, length); desc_set_tx_owner(txdesc, TXDESC_FIRST_SEG | TXDESC_LAST_SEG | TXDESC_CRC_EN_APPEND); @@ -476,7 +476,7 @@ static int xgmac_rx(struct eth_device *dev) length = desc_get_rx_frame_len(rxdesc); - NetReceive((volatile unsigned char *)desc_get_buf_addr(rxdesc), length); + NetReceive(desc_get_buf_addr(rxdesc), length); /* set descriptor back to owned by XGMAC */ desc_set_rx_owner(rxdesc); diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c index e04a784a4b..6aaa0cf49f 100644 --- a/drivers/net/cs8900.c +++ b/drivers/net/cs8900.c @@ -215,8 +215,7 @@ static int cs8900_recv(struct eth_device *dev) } /* Send a data block via Ethernet. */ -static int cs8900_send(struct eth_device *dev, - volatile void *packet, int length) +static int cs8900_send(struct eth_device *dev, void *packet, int length) { volatile u16 *addr; int tmo; diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index fbd0f1b7b5..e471d2ce33 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -637,7 +637,7 @@ static int tx_send_loop = 0; * positive number (number of bytes transmitted) or negative for error */ static int davinci_eth_send_packet (struct eth_device *dev, - volatile void *packet, int length) + void *packet, int length) { int ret_status = -1; int index; diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c index 0fb616ac20..d9fcb5a13e 100644 --- a/drivers/net/dc2114x.c +++ b/drivers/net/dc2114x.c @@ -175,7 +175,7 @@ static void read_hw_addr(struct eth_device* dev, bd_t * bis); static void send_setup_frame(struct eth_device* dev, bd_t * bis); static int dc21x4x_init(struct eth_device* dev, bd_t* bis); -static int dc21x4x_send(struct eth_device* dev, volatile void *packet, int length); +static int dc21x4x_send(struct eth_device *dev, void *packet, int length); static int dc21x4x_recv(struct eth_device* dev); static void dc21x4x_halt(struct eth_device* dev); #ifdef CONFIG_TULIP_SELECT_MEDIA @@ -390,7 +390,7 @@ static int dc21x4x_init(struct eth_device* dev, bd_t* bis) return 0; } -static int dc21x4x_send(struct eth_device* dev, volatile void *packet, int length) +static int dc21x4x_send(struct eth_device *dev, void *packet, int length) { int status = -1; int i; diff --git a/drivers/net/designware.c b/drivers/net/designware.c index e8e669bd90..9b17db41f6 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -189,8 +189,7 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis) return 0; } -static int dw_eth_send(struct eth_device *dev, volatile void *packet, - int length) +static int dw_eth_send(struct eth_device *dev, void *packet, int length) { struct dw_eth_dev *priv = dev->priv; struct eth_dma_regs *dma_p = priv->dma_regs_p; @@ -203,7 +202,7 @@ static int dw_eth_send(struct eth_device *dev, volatile void *packet, return -1; } - memcpy((void *)desc_p->dmamac_addr, (void *)packet, length); + memcpy((void *)desc_p->dmamac_addr, packet, length); #if defined(CONFIG_DW_ALTDESCRIPTOR) desc_p->txrx_status |= DESC_TXSTS_TXFIRST | DESC_TXSTS_TXLAST; diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index 04241109cc..f0c4499edb 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -406,8 +406,7 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd) Hardware start transmission. Send a packet to media from the upper layer. */ -static int dm9000_send(struct eth_device *netdev, volatile void *packet, - int length) +static int dm9000_send(struct eth_device *netdev, void *packet, int length) { int tmo; struct board_info *db = &dm9000_info; diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c index 15d0a6e741..944a0c046f 100644 --- a/drivers/net/dnet.c +++ b/drivers/net/dnet.c @@ -130,8 +130,7 @@ static u16 dnet_mdio_read(struct dnet_device *dnet, u8 reg) return value; } -static int dnet_send(struct eth_device *netdev, volatile void *packet, - int length) +static int dnet_send(struct eth_device *netdev, void *packet, int length) { struct dnet_device *dnet = to_dnet(netdev); int i, wrsz; diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index e726f398d4..94b2a41e14 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -5031,10 +5031,9 @@ e1000_poll(struct eth_device *nic) /************************************************************************** TRANSMIT - Transmit a frame ***************************************************************************/ -static int -e1000_transmit(struct eth_device *nic, volatile void *packet, int length) +static int e1000_transmit(struct eth_device *nic, void *packet, int length) { - void * nv_packet = (void *)packet; + void *nv_packet = (void *)packet; struct e1000_hw *hw = nic->priv; struct e1000_tx_desc *txp; int i = 0; diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 07ec34cbba..d2c8277de9 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -242,8 +242,7 @@ static void purge_tx_ring (struct eth_device *dev); static void read_hw_addr (struct eth_device *dev, bd_t * bis); static int eepro100_init (struct eth_device *dev, bd_t * bis); -static int eepro100_send (struct eth_device *dev, volatile void *packet, - int length); +static int eepro100_send(struct eth_device *dev, void *packet, int length); static int eepro100_recv (struct eth_device *dev); static void eepro100_halt (struct eth_device *dev); @@ -608,7 +607,7 @@ static int eepro100_init (struct eth_device *dev, bd_t * bis) return status; } -static int eepro100_send (struct eth_device *dev, volatile void *packet, int length) +static int eepro100_send(struct eth_device *dev, void *packet, int length) { int i, status = -1; int tx_cur; @@ -691,7 +690,7 @@ static int eepro100_recv (struct eth_device *dev) /* Pass the packet up to the protocol * layers. */ - NetReceive (rx_ring[rx_next].data, length); + NetReceive((u8 *)rx_ring[rx_next].data, length); } else { /* There was an error. */ diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index e2011aef4a..c55667c931 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -875,7 +875,7 @@ static int enc_recv(struct eth_device *dev) */ static int enc_send( struct eth_device *dev, - volatile void *packet, + void *packet, int length) { enc_dev_t *enc = dev->priv; diff --git a/drivers/net/ep93xx_eth.c b/drivers/net/ep93xx_eth.c index c09384c632..245ad1c25d 100644 --- a/drivers/net/ep93xx_eth.c +++ b/drivers/net/ep93xx_eth.c @@ -380,7 +380,7 @@ static int ep93xx_eth_rcv_packet(struct eth_device *dev) * Send a block of data via ethernet. */ static int ep93xx_eth_send_packet(struct eth_device *dev, - volatile void * const packet, int const length) + void * const packet, int const length) { struct mac_regs *mac = GET_REGS(dev); struct ep93xx_priv *priv = GET_PRIV(dev); diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index 5824fd6827..af06d4fb82 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c @@ -414,7 +414,7 @@ static void ethoc_tx(struct eth_device *dev) (void)ethoc_update_tx_stats(&bd); } -static int ethoc_send(struct eth_device *dev, volatile void *packet, int length) +static int ethoc_send(struct eth_device *dev, void *packet, int length) { struct ethoc *priv = (struct ethoc *)dev->priv; struct ethoc_bd bd; diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index d8db9f0c6e..eee41d7c8b 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -187,9 +187,10 @@ int fec_phy_write(struct mii_dev *bus, int phyAddr, int dev_addr, int regAddr, #ifndef CONFIG_PHYLIB static int miiphy_restart_aneg(struct eth_device *dev) { + int ret = 0; +#if !defined(CONFIG_FEC_MXC_NO_ANEG) struct fec_priv *fec = (struct fec_priv *)dev->priv; struct ethernet_regs *eth = fec->bus->priv; - int ret = 0; /* * Wake up from sleep if necessary @@ -213,6 +214,7 @@ static int miiphy_restart_aneg(struct eth_device *dev) if (fec->mii_postcall) ret = fec->mii_postcall(fec->phy_id); +#endif return ret; } @@ -398,6 +400,42 @@ static void fec_eth_phy_config(struct eth_device *dev) #endif } +/* + * Do initial configuration of the FEC registers + */ +static void fec_reg_setup(struct fec_priv *fec) +{ + uint32_t rcntrl; + + /* + * Set interrupt mask register + */ + writel(0x00000000, &fec->eth->imask); + + /* + * Clear FEC-Lite interrupt event register(IEVENT) + */ + writel(0xffffffff, &fec->eth->ievent); + + + /* + * Set FEC-Lite receive control register(R_CNTRL): + */ + + /* Start with frame length = 1518, common for all modes. */ + rcntrl = PKTSIZE << FEC_RCNTRL_MAX_FL_SHIFT; + if (fec->xcv_type == SEVENWIRE) + rcntrl |= FEC_RCNTRL_FCE; + else if (fec->xcv_type == RGMII) + rcntrl |= FEC_RCNTRL_RGMII; + else if (fec->xcv_type == RMII) + rcntrl |= FEC_RCNTRL_RMII; + else /* MII mode */ + rcntrl |= FEC_RCNTRL_FCE | FEC_RCNTRL_MII_MODE; + + writel(rcntrl, &fec->eth->r_cntrl); +} + /** * Start the FEC engine * @param[in] dev Our device to handle @@ -512,7 +550,6 @@ static int fec_init(struct eth_device *dev, bd_t* bd) { struct fec_priv *fec = (struct fec_priv *)dev->priv; uint32_t mib_ptr = (uint32_t)&fec->eth->rmon_t_drop; - uint32_t rcntrl; uint32_t size; int i, ret; @@ -560,33 +597,7 @@ static int fec_init(struct eth_device *dev, bd_t* bd) (unsigned)fec->rbd_base + size); } - /* - * Set interrupt mask register - */ - writel(0x00000000, &fec->eth->imask); - - /* - * Clear FEC-Lite interrupt event register(IEVENT) - */ - writel(0xffffffff, &fec->eth->ievent); - - - /* - * Set FEC-Lite receive control register(R_CNTRL): - */ - - /* Start with frame length = 1518, common for all modes. */ - rcntrl = PKTSIZE << FEC_RCNTRL_MAX_FL_SHIFT; - if (fec->xcv_type == SEVENWIRE) - rcntrl |= FEC_RCNTRL_FCE; - else if (fec->xcv_type == RGMII) - rcntrl |= FEC_RCNTRL_RGMII; - else if (fec->xcv_type == RMII) - rcntrl |= FEC_RCNTRL_RMII; - else /* MII mode */ - rcntrl |= FEC_RCNTRL_FCE | FEC_RCNTRL_MII_MODE; - - writel(rcntrl, &fec->eth->r_cntrl); + fec_reg_setup(fec); if (fec->xcv_type == MII10 || fec->xcv_type == MII100) fec_mii_setspeed(fec); @@ -676,7 +687,7 @@ static void fec_halt(struct eth_device *dev) * @param[in] length Data count in bytes * @return 0 on success */ -static int fec_send(struct eth_device *dev, volatile void *packet, int length) +static int fec_send(struct eth_device *dev, void *packet, int length) { unsigned int status; uint32_t size; @@ -933,24 +944,7 @@ static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr) udelay(10); } - /* - * Set interrupt mask register - */ - writel(0x00000000, &fec->eth->imask); - - /* - * Clear FEC-Lite interrupt event register(IEVENT) - */ - writel(0xffffffff, &fec->eth->ievent); - - /* - * Set FEC-Lite receive control register(R_CNTRL): - */ - /* - * Frame length=1518; MII mode; - */ - writel((PKTSIZE << FEC_RCNTRL_MAX_FL_SHIFT) | FEC_RCNTRL_FCE | - FEC_RCNTRL_MII_MODE, &fec->eth->r_cntrl); + fec_reg_setup(fec); fec_mii_setspeed(fec); if (dev_id == -1) { diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c index f7ed850c91..f34f4db6b6 100644 --- a/drivers/net/fm/eth.c +++ b/drivers/net/fm/eth.c @@ -420,7 +420,7 @@ static void fm_eth_halt(struct eth_device *dev) phy_shutdown(fm_eth->phydev); } -static int fm_eth_send(struct eth_device *dev, volatile void *buf, int len) +static int fm_eth_send(struct eth_device *dev, void *buf, int len) { struct fm_eth *fm_eth; struct fm_port_global_pram *pram; diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c index 0b8c33fb7a..49c74c278a 100644 --- a/drivers/net/fm/fm.c +++ b/drivers/net/fm/fm.c @@ -408,6 +408,8 @@ int fm_init_common(int index, struct ccsr_fman *reg) /* flush cache after read */ flush_cache((ulong)addr, cnt * 512); } +#elif defined(CONFIG_SYS_QE_FMAN_FW_IN_REMOTE) + void *addr = (void *)CONFIG_SYS_QE_FMAN_FW_ADDR; #endif /* Upload the Fman microcode if it's present */ diff --git a/drivers/net/fsl_mcdmafec.c b/drivers/net/fsl_mcdmafec.c index 5330dbc79f..63842cd466 100644 --- a/drivers/net/fsl_mcdmafec.c +++ b/drivers/net/fsl_mcdmafec.c @@ -116,7 +116,7 @@ struct fec_info_dma fec_info[] = { #endif }; -static int fec_send(struct eth_device *dev, volatile void *packet, int length); +static int fec_send(struct eth_device *dev, void *packet, int length); static int fec_recv(struct eth_device *dev); static int fec_init(struct eth_device *dev, bd_t * bd); static void fec_halt(struct eth_device *dev); @@ -194,7 +194,7 @@ static void set_fec_duplex_speed(volatile fecdma_t * fecp, bd_t * bd, } } -static int fec_send(struct eth_device *dev, volatile void *packet, int length) +static int fec_send(struct eth_device *dev, void *packet, int length) { struct fec_info_dma *info = dev->priv; cbd_t *pTbd, *pUsedTbd; @@ -301,8 +301,7 @@ static int fec_recv(struct eth_device *dev) frame_length = pRbd->cbd_datlen - 4; /* Fill the buffer and pass it to upper layers */ - NetReceive((volatile uchar *)pRbd->cbd_bufaddr, - frame_length); + NetReceive((uchar *)pRbd->cbd_bufaddr, frame_length); len = frame_length; } diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c index 0af0c3450f..69ba57d3d0 100644 --- a/drivers/net/ftgmac100.c +++ b/drivers/net/ftgmac100.c @@ -480,8 +480,7 @@ static int ftgmac100_recv(struct eth_device *dev) /* * Send a data block via Ethernet */ -static int -ftgmac100_send(struct eth_device *dev, void *packet, int length) +static int ftgmac100_send(struct eth_device *dev, void *packet, int length) { struct ftgmac100 *ftgmac100 = (struct ftgmac100 *)dev->iobase; struct ftgmac100_data *priv = dev->priv; diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index 94dc6d99ba..fdd3ec0ac2 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -190,8 +190,7 @@ static int ftmac100_recv (struct eth_device *dev) /* * Send a data block via Ethernet */ -static int -ftmac100_send (struct eth_device *dev, volatile void *packet, int length) +static int ftmac100_send(struct eth_device *dev, void *packet, int length) { struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase; struct ftmac100_data *priv = dev->priv; diff --git a/drivers/net/greth.c b/drivers/net/greth.c index 2aab52f378..08206c8711 100644 --- a/drivers/net/greth.c +++ b/drivers/net/greth.c @@ -403,7 +403,7 @@ void greth_halt(struct eth_device *dev) } } -int greth_send(struct eth_device *dev, volatile void *eth_data, int data_length) +int greth_send(struct eth_device *dev, void *eth_data, int data_length) { greth_priv *greth = dev->priv; greth_regs *regs = greth->regs; diff --git a/drivers/net/inca-ip_sw.c b/drivers/net/inca-ip_sw.c index c45389e0cd..f0f62deaf8 100644 --- a/drivers/net/inca-ip_sw.c +++ b/drivers/net/inca-ip_sw.c @@ -158,7 +158,7 @@ static int initialized = 0; static int inca_switch_init(struct eth_device *dev, bd_t * bis); -static int inca_switch_send(struct eth_device *dev, volatile void *packet, int length); +static int inca_switch_send(struct eth_device *dev, void *packet, int length); static int inca_switch_recv(struct eth_device *dev); static void inca_switch_halt(struct eth_device *dev); static void inca_init_switch_chip(void); @@ -334,7 +334,7 @@ static int inca_switch_init(struct eth_device *dev, bd_t * bis) } -static int inca_switch_send(struct eth_device *dev, volatile void *packet, int length) +static int inca_switch_send(struct eth_device *dev, void *packet, int length) { int i; int res = -1; diff --git a/drivers/net/ks8695eth.c b/drivers/net/ks8695eth.c index 8e988d1423..b4904b68e5 100644 --- a/drivers/net/ks8695eth.c +++ b/drivers/net/ks8695eth.c @@ -190,8 +190,7 @@ static int ks8695_eth_recv(struct eth_device *dev) /****************************************************************************/ -static int ks8695_eth_send(struct eth_device *dev, volatile void *packet, - int len) +static int ks8695_eth_send(struct eth_device *dev, void *packet, int len) { volatile struct ks8695_txdesc *dp; static int next = 0; diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c index 24b28da249..11d350eb8d 100644 --- a/drivers/net/lan91c96.c +++ b/drivers/net/lan91c96.c @@ -314,7 +314,7 @@ static void smc_shutdown(struct eth_device *dev) * Enable the transmit interrupt, so I know if it failed * Free the kernel data if I actually sent it. */ -static int smc_send_packet(struct eth_device *dev, volatile void *packet, +static int smc_send_packet(struct eth_device *dev, void *packet, int packet_length) { byte packet_no; @@ -700,7 +700,7 @@ static int lan91c96_recv(struct eth_device *dev) return smc_rcv(dev); } -static int lan91c96_send(struct eth_device *dev, volatile void *packet, +static int lan91c96_send(struct eth_device *dev, void *packet, int length) { return smc_send_packet(dev, packet, length); diff --git a/drivers/net/macb.c b/drivers/net/macb.c index c63eea966a..45784678ba 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -197,8 +197,7 @@ int macb_miiphy_write(const char *devname, u8 phy_adr, u8 reg, u16 value) #if defined(CONFIG_CMD_NET) -static int macb_send(struct eth_device *netdev, volatile void *packet, - int length) +static int macb_send(struct eth_device *netdev, void *packet, int length) { struct macb_device *macb = to_macb(netdev); unsigned long paddr, ctrl; diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c index a08ff278bf..ed7459c647 100644 --- a/drivers/net/mcffec.c +++ b/drivers/net/mcffec.c @@ -95,7 +95,6 @@ struct fec_info_s fec_info[] = { #endif }; -int fec_send(struct eth_device *dev, volatile void *packet, int length); int fec_recv(struct eth_device *dev); int fec_init(struct eth_device *dev, bd_t * bd); void fec_halt(struct eth_device *dev); @@ -134,7 +133,7 @@ void setFecDuplexSpeed(volatile fec_t * fecp, bd_t * bd, int dup_spd) } } -int fec_send(struct eth_device *dev, volatile void *packet, int length) +static int fec_send(struct eth_device *dev, void *packet, int length) { struct fec_info_s *info = dev->priv; volatile fec_t *fecp = (fec_t *) (info->iobase); diff --git a/drivers/net/mpc512x_fec.c b/drivers/net/mpc512x_fec.c index 0d5efd56ea..ad57d566be 100644 --- a/drivers/net/mpc512x_fec.c +++ b/drivers/net/mpc512x_fec.c @@ -452,8 +452,8 @@ static void mpc512x_fec_halt (struct eth_device *dev) /********************************************************************/ -static int mpc512x_fec_send (struct eth_device *dev, volatile void *eth_data, - int data_length) +static int mpc512x_fec_send(struct eth_device *dev, void *eth_data, + int data_length) { /* * This routine transmits one frame. This routine only accepts diff --git a/drivers/net/mpc5xxx_fec.c b/drivers/net/mpc5xxx_fec.c index bc8c9222dc..3d180db749 100644 --- a/drivers/net/mpc5xxx_fec.c +++ b/drivers/net/mpc5xxx_fec.c @@ -707,7 +707,7 @@ static void rfifo_print(char *devname, mpc5xxx_fec_priv *fec) /********************************************************************/ -static int mpc5xxx_fec_send(struct eth_device *dev, volatile void *eth_data, +static int mpc5xxx_fec_send(struct eth_device *dev, void *eth_data, int data_length) { /* diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c index dcc1547c1c..47bf27c8ba 100644 --- a/drivers/net/mvgbe.c +++ b/drivers/net/mvgbe.c @@ -525,8 +525,7 @@ static int mvgbe_write_hwaddr(struct eth_device *dev) return 0; } -static int mvgbe_send(struct eth_device *dev, void *dataptr, - int datasize) +static int mvgbe_send(struct eth_device *dev, void *dataptr, int datasize) { struct mvgbe_device *dmvgbe = to_mvgbe(dev); struct mvgbe_registers *regs = dmvgbe->regs; diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 9386adf87f..04743bd2b3 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c @@ -237,8 +237,7 @@ static void natsemi_init_txd(struct eth_device *dev); static void natsemi_init_rxd(struct eth_device *dev); static void natsemi_set_rx_mode(struct eth_device *dev); static void natsemi_check_duplex(struct eth_device *dev); -static int natsemi_send(struct eth_device *dev, volatile void *packet, - int length); +static int natsemi_send(struct eth_device *dev, void *packet, int length); static int natsemi_poll(struct eth_device *dev); static void natsemi_disable(struct eth_device *dev); @@ -754,8 +753,7 @@ natsemi_check_duplex(struct eth_device *dev) * Description: transmits a packet and waits for completion or timeout. * * Returns: void. */ -static int -natsemi_send(struct eth_device *dev, volatile void *packet, int length) +static int natsemi_send(struct eth_device *dev, void *packet, int length) { u32 i, status = 0; u32 tx_status = 0; diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c index 8275091871..ef35922042 100644 --- a/drivers/net/ne2000_base.c +++ b/drivers/net/ne2000_base.c @@ -749,7 +749,7 @@ static int ne2k_recv(struct eth_device *dev) return 1; } -static int ne2k_send(struct eth_device *dev, volatile void *packet, int length) +static int ne2k_send(struct eth_device *dev, void *packet, int length) { int tmo; diff --git a/drivers/net/netarm_eth.c b/drivers/net/netarm_eth.c index f54817e58d..325f16c3a8 100644 --- a/drivers/net/netarm_eth.c +++ b/drivers/net/netarm_eth.c @@ -300,7 +300,7 @@ extern int eth_rx (void) } /* Send a data block via Ethernet. */ -extern int eth_send (volatile void *packet, int length) +extern int eth_send(void *packet, int length) { int i, length32; char *pa; diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 56ba64fbb0..14243b8a92 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -29,81 +29,84 @@ DECLARE_GLOBAL_DATA_PTR; static char input_buffer[512]; -static int input_size = 0; /* char count in input buffer */ -static int input_offset = 0; /* offset to valid chars in input buffer */ -static int input_recursion = 0; -static int output_recursion = 0; +static int input_size; /* char count in input buffer */ +static int input_offset; /* offset to valid chars in input buffer */ +static int input_recursion; +static int output_recursion; static int net_timeout; -static uchar nc_ether[6]; /* server enet address */ -static IPaddr_t nc_ip; /* server ip */ -static short nc_port; /* source/target port */ -static const char *output_packet; /* used by first send udp */ -static int output_packet_len = 0; +static uchar nc_ether[6]; /* server enet address */ +static IPaddr_t nc_ip; /* server ip */ +static short nc_port; /* source/target port */ +static const char *output_packet; /* used by first send udp */ +static int output_packet_len; static void nc_wait_arp_handler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, unsigned len) { - NetState = NETLOOP_SUCCESS; /* got arp reply - quit net loop */ + net_set_state(NETLOOP_SUCCESS); /* got arp reply - quit net loop */ } static void nc_handler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, unsigned len) { if (input_size) - NetState = NETLOOP_SUCCESS; /* got input - quit net loop */ + net_set_state(NETLOOP_SUCCESS); /* got input - quit net loop */ } -static void nc_timeout (void) +static void nc_timeout(void) { - NetState = NETLOOP_SUCCESS; + net_set_state(NETLOOP_SUCCESS); } -void NcStart (void) +void NcStart(void) { - if (!output_packet_len || memcmp (nc_ether, NetEtherNullAddr, 6)) { + if (!output_packet_len || memcmp(nc_ether, NetEtherNullAddr, 6)) { /* going to check for input packet */ - NetSetHandler (nc_handler); - NetSetTimeout (net_timeout, nc_timeout); + net_set_udp_handler(nc_handler); + NetSetTimeout(net_timeout, nc_timeout); } else { /* send arp request */ uchar *pkt; - NetSetHandler (nc_wait_arp_handler); - pkt = (uchar *) NetTxPacket + NetEthHdrSize () + IP_HDR_SIZE; - memcpy (pkt, output_packet, output_packet_len); - NetSendUDPPacket (nc_ether, nc_ip, nc_port, nc_port, output_packet_len); + net_set_arp_handler(nc_wait_arp_handler); + pkt = (uchar *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE; + memcpy(pkt, output_packet, output_packet_len); + NetSendUDPPacket(nc_ether, nc_ip, nc_port, nc_port, + output_packet_len); } } -int nc_input_packet (uchar * pkt, unsigned dest, unsigned src, unsigned len) +int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len) { int end, chunk; if (dest != nc_port || !len) - return 0; /* not for us */ + return 0; /* not for us */ - if (input_size == sizeof input_buffer) - return 1; /* no space */ - if (len > sizeof input_buffer - input_size) - len = sizeof input_buffer - input_size; + debug_cond(DEBUG_DEV_PKT, "input: \"%*.*s\"\n", len, len, pkt); + + if (input_size == sizeof(input_buffer)) + return 1; /* no space */ + if (len > sizeof(input_buffer) - input_size) + len = sizeof(input_buffer) - input_size; end = input_offset + input_size; - if (end > sizeof input_buffer) - end -= sizeof input_buffer; + if (end > sizeof(input_buffer)) + end -= sizeof(input_buffer); chunk = len; - if (end + len > sizeof input_buffer) { - chunk = sizeof input_buffer - end; + if (end + len > sizeof(input_buffer)) { + chunk = sizeof(input_buffer) - end; memcpy(input_buffer, pkt + chunk, len - chunk); } - memcpy (input_buffer + end, pkt, chunk); + memcpy(input_buffer + end, pkt, chunk); input_size += len; return 1; } -static void nc_send_packet (const char *buf, int len) +static void nc_send_packet(const char *buf, int len) { struct eth_device *eth; int inited = 0; @@ -111,33 +114,35 @@ static void nc_send_packet (const char *buf, int len) uchar *ether; IPaddr_t ip; - if ((eth = eth_get_dev ()) == NULL) { + debug_cond(DEBUG_DEV_PKT, "output: \"%*.*s\"\n", len, len, buf); + + eth = eth_get_dev(); + if (eth == NULL) return; - } - if (!memcmp (nc_ether, NetEtherNullAddr, 6)) { + if (!memcmp(nc_ether, NetEtherNullAddr, 6)) { if (eth->state == ETH_STATE_ACTIVE) return; /* inside net loop */ output_packet = buf; output_packet_len = len; - NetLoop (NETCONS); /* wait for arp reply and send packet */ + NetLoop(NETCONS); /* wait for arp reply and send packet */ output_packet_len = 0; return; } if (eth->state != ETH_STATE_ACTIVE) { - if (eth_init (gd->bd) < 0) + if (eth_init(gd->bd) < 0) return; inited = 1; } - pkt = (uchar *) NetTxPacket + NetEthHdrSize () + IP_HDR_SIZE; - memcpy (pkt, buf, len); + pkt = (uchar *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE; + memcpy(pkt, buf, len); ether = nc_ether; ip = nc_ip; - NetSendUDPPacket (ether, ip, nc_port, nc_port, len); + NetSendUDPPacket(ether, ip, nc_port, nc_port, len); if (inited) - eth_halt (); + eth_halt(); } static int nc_start(void) @@ -146,26 +151,33 @@ static int nc_start(void) nc_port = 6666; /* default port */ - if (getenv ("ncip")) { + if (getenv("ncip")) { char *p; - nc_ip = getenv_IPaddr ("ncip"); + nc_ip = getenv_IPaddr("ncip"); if (!nc_ip) return -1; /* ncip is 0.0.0.0 */ - if ((p = strchr (getenv ("ncip"), ':')) != NULL) - nc_port = simple_strtoul (p + 1, NULL, 10); + p = strchr(getenv("ncip"), ':'); + if (p != NULL) + nc_port = simple_strtoul(p + 1, NULL, 10); } else nc_ip = ~0; /* ncip is not set */ - our_ip = getenv_IPaddr ("ipaddr"); - netmask = getenv_IPaddr ("netmask"); + our_ip = getenv_IPaddr("ipaddr"); + netmask = getenv_IPaddr("netmask"); if (nc_ip == ~0 || /* 255.255.255.255 */ ((netmask & our_ip) == (netmask & nc_ip) && /* on the same net */ - (netmask | nc_ip) == ~0)) /* broadcast to our net */ - memset (nc_ether, 0xff, sizeof nc_ether); + (netmask | nc_ip) == ~0)) /* broadcast to our net */ + memset(nc_ether, 0xff, sizeof(nc_ether)); else - memset (nc_ether, 0, sizeof nc_ether); /* force arp request */ + memset(nc_ether, 0, sizeof(nc_ether)); /* force arp request */ + + /* + * Initialize the static IP settings and buffer pointers + * incase we call NetSendUDPPacket before NetLoop + */ + net_init(); return 0; } @@ -176,7 +188,7 @@ static void nc_putc(char c) return; output_recursion = 1; - nc_send_packet (&c, 1); + nc_send_packet(&c, 1); output_recursion = 0; } @@ -208,14 +220,14 @@ static int nc_getc(void) net_timeout = 0; /* no timeout */ while (!input_size) - NetLoop (NETCONS); + NetLoop(NETCONS); input_recursion = 0; c = input_buffer[input_offset++]; - if (input_offset >= sizeof input_buffer) - input_offset -= sizeof input_buffer; + if (input_offset >= sizeof(input_buffer)) + input_offset -= sizeof(input_buffer); input_size--; return c; @@ -231,28 +243,28 @@ static int nc_tstc(void) if (input_size) return 1; - eth = eth_get_dev (); + eth = eth_get_dev(); if (eth && eth->state == ETH_STATE_ACTIVE) return 0; /* inside net loop */ input_recursion = 1; net_timeout = 1; - NetLoop (NETCONS); /* kind of poll */ + NetLoop(NETCONS); /* kind of poll */ input_recursion = 0; return input_size != 0; } -int drv_nc_init (void) +int drv_nc_init(void) { struct stdio_dev dev; int rc; - memset (&dev, 0, sizeof (dev)); + memset(&dev, 0, sizeof(dev)); - strcpy (dev.name, "nc"); + strcpy(dev.name, "nc"); dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; dev.start = nc_start; dev.putc = nc_putc; @@ -260,7 +272,7 @@ int drv_nc_init (void) dev.getc = nc_getc; dev.tstc = nc_tstc; - rc = stdio_register (&dev); + rc = stdio_register(&dev); return (rc == 0) ? 1 : rc; } diff --git a/drivers/net/ns8382x.c b/drivers/net/ns8382x.c index 11863feba3..cfe1f349db 100644 --- a/drivers/net/ns8382x.c +++ b/drivers/net/ns8382x.c @@ -258,8 +258,7 @@ static void ns8382x_init_txd(struct eth_device *dev); static void ns8382x_init_rxd(struct eth_device *dev); static void ns8382x_set_rx_mode(struct eth_device *dev); static void ns8382x_check_duplex(struct eth_device *dev); -static int ns8382x_send(struct eth_device *dev, volatile void *packet, - int length); +static int ns8382x_send(struct eth_device *dev, void *packet, int length); static int ns8382x_poll(struct eth_device *dev); static void ns8382x_disable(struct eth_device *dev); @@ -735,8 +734,7 @@ ns8382x_check_duplex(struct eth_device *dev) /* Function: ns8382x_send * Description: transmits a packet and waits for completion or timeout. * Returns: void. */ -static int -ns8382x_send(struct eth_device *dev, volatile void *packet, int length) +static int ns8382x_send(struct eth_device *dev, void *packet, int length) { u32 i, status = 0; vu_long tx_stat = 0; diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index 45066c8fea..c028a44a9e 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -141,8 +141,7 @@ static int pcnet_check (struct eth_device *dev) } static int pcnet_init (struct eth_device *dev, bd_t * bis); -static int pcnet_send (struct eth_device *dev, volatile void *packet, - int length); +static int pcnet_send(struct eth_device *dev, void *packet, int length); static int pcnet_recv (struct eth_device *dev); static void pcnet_halt (struct eth_device *dev); static int pcnet_probe (struct eth_device *dev, bd_t * bis, int dev_num); @@ -415,8 +414,7 @@ static int pcnet_init (struct eth_device *dev, bd_t * bis) return 0; } -static int pcnet_send (struct eth_device *dev, volatile void *packet, - int pkt_len) +static int pcnet_send(struct eth_device *dev, void *packet, int pkt_len) { int i, status; struct pcnet_tx_head *entry = &lp->tx_ring[lp->cur_tx]; diff --git a/drivers/net/plb2800_eth.c b/drivers/net/plb2800_eth.c index d799c73823..93782c23ff 100644 --- a/drivers/net/plb2800_eth.c +++ b/drivers/net/plb2800_eth.c @@ -82,8 +82,7 @@ typedef volatile struct { static int plb2800_eth_init(struct eth_device *dev, bd_t * bis); -static int plb2800_eth_send(struct eth_device *dev, volatile void *packet, - int length); +static int plb2800_eth_send(struct eth_device *dev, void *packet, int length); static int plb2800_eth_recv(struct eth_device *dev); static void plb2800_eth_halt(struct eth_device *dev); @@ -162,8 +161,7 @@ static int plb2800_eth_init(struct eth_device *dev, bd_t * bis) } -static int plb2800_eth_send(struct eth_device *dev, volatile void *packet, - int length) +static int plb2800_eth_send(struct eth_device *dev, void *packet, int length) { int i; int res = -1; diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index e3feef849c..4186699ff9 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -184,7 +184,7 @@ static unsigned char rx_ring[RX_BUF_LEN+16] __attribute__((aligned(4))); static int rtl8139_probe(struct eth_device *dev, bd_t *bis); static int read_eeprom(int location, int addr_len); static void rtl_reset(struct eth_device *dev); -static int rtl_transmit(struct eth_device *dev, volatile void *packet, int length); +static int rtl_transmit(struct eth_device *dev, void *packet, int length); static int rtl_poll(struct eth_device *dev); static void rtl_disable(struct eth_device *dev); #ifdef CONFIG_MCAST_TFTP/* This driver already accepts all b/mcast */ @@ -407,7 +407,7 @@ static void rtl_reset(struct eth_device *dev) outw(0, ioaddr + IntrMask); } -static int rtl_transmit(struct eth_device *dev, volatile void *packet, int length) +static int rtl_transmit(struct eth_device *dev, void *packet, int length) { unsigned int status; unsigned long txstatus; diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 1ad13bddd5..9864fd7b5c 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -464,7 +464,7 @@ static int rtl_recv(struct eth_device *dev) /************************************************************************** SEND - Transmit a frame ***************************************************************************/ -static int rtl_send(struct eth_device *dev, volatile void *packet, int length) +static int rtl_send(struct eth_device *dev, void *packet, int length) { /* send the packet to destination */ diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 8d3dac20af..bb57e4d53a 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -46,7 +46,7 @@ #define TIMEOUT_CNT 1000 -int sh_eth_send(struct eth_device *dev, volatile void *packet, int len) +int sh_eth_send(struct eth_device *dev, void *packet, int len) { struct sh_eth_dev *eth = dev->priv; int port = eth->port, ret = 0, timeout; @@ -59,7 +59,7 @@ int sh_eth_send(struct eth_device *dev, volatile void *packet, int len) } /* packet must be a 4 byte boundary */ - if ((int)packet & (4 - 1)) { + if ((int)packet & 3) { printf(SHETHER_NAME ": %s: packet not 4 byte alligned\n", __func__); ret = -EFAULT; goto err; @@ -103,15 +103,15 @@ int sh_eth_recv(struct eth_device *dev) struct sh_eth_dev *eth = dev->priv; int port = eth->port, len = 0; struct sh_eth_info *port_info = ð->port_info[port]; - volatile u8 *packet; + uchar *packet; /* Check if the rx descriptor is ready */ if (!(port_info->rx_desc_cur->rd0 & RD_RACT)) { /* Check for errors */ if (!(port_info->rx_desc_cur->rd0 & RD_RFE)) { len = port_info->rx_desc_cur->rd1 & 0xffff; - packet = (volatile u8 *) - ADDR_TO_P2(port_info->rx_desc_cur->rd2); + packet = (uchar *) + ADDR_TO_P2(port_info->rx_desc_cur->rd2); NetReceive(packet, len); } @@ -138,7 +138,7 @@ int sh_eth_recv(struct eth_device *dev) static int sh_eth_reset(struct sh_eth_dev *eth) { int port = eth->port; -#if defined(CONFIG_CPU_SH7763) +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) int ret = 0, i; /* Start e-dmac transmitter and receiver */ @@ -208,7 +208,7 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth) /* Point the controller to the tx descriptor list. Must use physical addresses */ outl(ADDR_TO_PHY(port_info->tx_desc_base), TDLAR(port)); -#if defined(CONFIG_CPU_SH7763) +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) outl(ADDR_TO_PHY(port_info->tx_desc_base), TDFAR(port)); outl(ADDR_TO_PHY(cur_tx_desc), TDFXR(port)); outl(0x01, TDFFR(port));/* Last discriptor bit */ @@ -276,7 +276,7 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth) /* Point the controller to the rx descriptor list */ outl(ADDR_TO_PHY(port_info->rx_desc_base), RDLAR(port)); -#if defined(CONFIG_CPU_SH7763) +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) outl(ADDR_TO_PHY(port_info->rx_desc_base), RDFAR(port)); outl(ADDR_TO_PHY(cur_rx_desc), RDFXR(port)); outl(RDFFR_RDLF, RDFFR(port)); @@ -346,8 +346,9 @@ static int sh_eth_phy_config(struct sh_eth_dev *eth) struct eth_device *dev = port_info->dev; struct phy_device *phydev; - phydev = phy_connect(miiphy_get_dev_by_name(dev->name), - port_info->phy_addr, dev, PHY_INTERFACE_MODE_MII); + phydev = phy_connect( + miiphy_get_dev_by_name(dev->name), + port_info->phy_addr, dev, CONFIG_SH_ETHER_PHY_MODE); port_info->phydev = phydev; phy_config(phydev); @@ -398,12 +399,15 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd) outl(APR_AP, APR(port)); outl(MPR_MP, MPR(port)); #endif -#if defined(CONFIG_CPU_SH7763) +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) outl(TPAUSER_TPAUSE, TPAUSER(port)); #elif defined(CONFIG_CPU_SH7757) outl(TPAUSER_UNLIMITED, TPAUSER(port)); #endif +#if defined(CONFIG_CPU_SH7734) + outl(CONFIG_SH_ETHER_SH7734_MII, RMII_MII(port)); +#endif /* Configure phy */ ret = sh_eth_phy_config(eth); if (ret) { @@ -418,7 +422,7 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd) /* Set the transfer speed */ if (phy->speed == 100) { printf(SHETHER_NAME ": 100Base/"); -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) outl(GECMR_100B, GECMR(port)); #elif defined(CONFIG_CPU_SH7757) outl(1, RTRATE(port)); @@ -427,12 +431,18 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd) #endif } else if (phy->speed == 10) { printf(SHETHER_NAME ": 10Base/"); -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) outl(GECMR_10B, GECMR(port)); #elif defined(CONFIG_CPU_SH7757) outl(0, RTRATE(port)); #endif } +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) + else if (phy->speed == 1000) { + printf(SHETHER_NAME ": 1000Base/"); + outl(GECMR_1000B, GECMR(port)); + } +#endif /* Check if full duplex mode is supported by the phy */ if (phy->duplex) { diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h index 27fde05bd6..a1ba68b1b4 100644 --- a/drivers/net/sh_eth.h +++ b/drivers/net/sh_eth.h @@ -188,13 +188,52 @@ struct sh_eth_dev { #define TPAUSER(port) (BASE_IO_ADDR + 0x0164) #define MAHR(port) (BASE_IO_ADDR + 0x01c0) #define MALR(port) (BASE_IO_ADDR + 0x01c8) + +#elif defined(CONFIG_CPU_SH7734) +#define BASE_IO_ADDR 0xFEE00000 + +#define EDSR(port) (BASE_IO_ADDR) + +#define TDLAR(port) (BASE_IO_ADDR + 0x0010) +#define TDFAR(port) (BASE_IO_ADDR + 0x0014) +#define TDFXR(port) (BASE_IO_ADDR + 0x0018) +#define TDFFR(port) (BASE_IO_ADDR + 0x001c) +#define RDLAR(port) (BASE_IO_ADDR + 0x0030) +#define RDFAR(port) (BASE_IO_ADDR + 0x0034) +#define RDFXR(port) (BASE_IO_ADDR + 0x0038) +#define RDFFR(port) (BASE_IO_ADDR + 0x003c) + +#define EDMR(port) (BASE_IO_ADDR + 0x0400) +#define EDTRR(port) (BASE_IO_ADDR + 0x0408) +#define EDRRR(port) (BASE_IO_ADDR + 0x0410) +#define EESR(port) (BASE_IO_ADDR + 0x0428) +#define EESIPR(port) (BASE_IO_ADDR + 0x0430) +#define TRSCER(port) (BASE_IO_ADDR + 0x0438) +#define TFTR(port) (BASE_IO_ADDR + 0x0448) +#define FDR(port) (BASE_IO_ADDR + 0x0450) +#define RMCR(port) (BASE_IO_ADDR + 0x0458) +#define RPADIR(port) (BASE_IO_ADDR + 0x0460) +#define FCFTR(port) (BASE_IO_ADDR + 0x0468) +#define ECMR(port) (BASE_IO_ADDR + 0x0500) +#define RFLR(port) (BASE_IO_ADDR + 0x0508) +#define ECSIPR(port) (BASE_IO_ADDR + 0x0518) +#define PIR(port) (BASE_IO_ADDR + 0x0520) +#define PIPR(port) (BASE_IO_ADDR + 0x052c) +#define APR(port) (BASE_IO_ADDR + 0x0554) +#define MPR(port) (BASE_IO_ADDR + 0x0558) +#define TPAUSER(port) (BASE_IO_ADDR + 0x0564) +#define GECMR(port) (BASE_IO_ADDR + 0x05b0) +#define MAHR(port) (BASE_IO_ADDR + 0x05C0) +#define MALR(port) (BASE_IO_ADDR + 0x05C8) +#define RMII_MII(port) (BASE_IO_ADDR + 0x0790) + #endif /* * Register's bits * Copy from Linux driver source code */ -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) /* EDSR */ enum EDSR_BIT { EDSR_ENT = 0x01, EDSR_ENR = 0x02, @@ -205,11 +244,11 @@ enum EDSR_BIT { /* EDMR */ enum DMAC_M_BIT { EDMR_DL1 = 0x20, EDMR_DL0 = 0x10, -#ifdef CONFIG_CPU_SH7763 - EDMR_SRST = 0x03, +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) + EDMR_SRST = 0x03, /* Receive/Send reset */ EMDR_DESC_R = 0x30, /* Descriptor reserve size */ EDMR_EL = 0x40, /* Litte endian */ -#elif defined(CONFIG_CPU_SH7757) ||defined (CONFIG_CPU_SH7724) +#elif defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7724) EDMR_SRST = 0x01, EMDR_DESC_R = 0x30, /* Descriptor reserve size */ EDMR_EL = 0x40, /* Litte endian */ @@ -223,7 +262,7 @@ enum DMAC_M_BIT { /* EDTRR */ enum DMAC_T_BIT { -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) EDTRR_TRNS = 0x03, #else EDTRR_TRNS = 0x01, @@ -262,7 +301,8 @@ enum PHY_STATUS_BIT { PHY_ST_LINK = 0x01, }; /* EESR */ enum EESR_BIT { -#ifndef CONFIG_CPU_SH7763 + +#if defined(CONFIG_CPU_SH7724) || defined(CONFIG_CPU_SH7757) EESR_TWB = 0x40000000, #else EESR_TWB = 0xC0000000, @@ -272,14 +312,14 @@ enum EESR_BIT { #endif EESR_TABT = 0x04000000, EESR_RABT = 0x02000000, EESR_RFRMER = 0x01000000, -#ifndef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7724) || defined(CONFIG_CPU_SH7757) EESR_ADE = 0x00800000, #endif EESR_ECI = 0x00400000, EESR_FTC = 0x00200000, EESR_TDE = 0x00100000, EESR_TFE = 0x00080000, EESR_FRC = 0x00040000, EESR_RDE = 0x00020000, EESR_RFE = 0x00010000, -#ifndef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7724) && !defined(CONFIG_CPU_SH7757) EESR_CND = 0x00000800, #endif EESR_DLC = 0x00000400, @@ -291,7 +331,7 @@ enum EESR_BIT { }; -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) # define TX_CHECK (EESR_TC1 | EESR_FTC) # define EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE \ | EESR_RFRMER | EESR_TFE | EESR_TDE | EESR_ECI) @@ -352,7 +392,7 @@ enum FCFTR_BIT { /* Transfer descriptor bit */ enum TD_STS_BIT { #if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7757) \ - || defined(CONFIG_CPU_SH7724) + || defined(CONFIG_CPU_SH7724) || defined(CONFIG_CPU_SH7734) TD_TACT = 0x80000000, #else TD_TACT = 0x7fffffff, @@ -368,7 +408,7 @@ enum TD_STS_BIT { enum RECV_RST_BIT { RMCR_RST = 0x01, }; /* ECMR */ enum FELIC_MODE_BIT { -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) ECMR_TRCCM=0x04000000, ECMR_RCSC= 0x00800000, ECMR_DPAD= 0x00200000, ECMR_RZPF = 0x00100000, #endif @@ -383,7 +423,7 @@ enum FELIC_MODE_BIT { }; -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) #define ECMR_CHG_DM (ECMR_TRCCM | ECMR_RZPF | ECMR_ZPF | ECMR_PFR | ECMR_RXF | \ ECMR_TXF | ECMR_MCT) #elif CONFIG_CPU_SH7757 @@ -396,14 +436,14 @@ enum FELIC_MODE_BIT { /* ECSR */ enum ECSR_STATUS_BIT { -#ifndef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7724) || defined(CONFIG_CPU_SH7757) ECSR_BRCRX = 0x20, ECSR_PSRTO = 0x10, #endif ECSR_LCHNG = 0x04, ECSR_MPD = 0x02, ECSR_ICD = 0x01, }; -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) # define ECSR_INIT (ECSR_ICD | ECSIPR_MPDIP) #else # define ECSR_INIT (ECSR_BRCRX | ECSR_PSRTO | \ @@ -412,14 +452,20 @@ enum ECSR_STATUS_BIT { /* ECSIPR */ enum ECSIPR_STATUS_MASK_BIT { -#ifndef CONFIG_CPU_SH7763 - ECSIPR_BRCRXIP = 0x20, ECSIPR_PSRTOIP = 0x10, -#endif +#if defined(CONFIG_CPU_SH7724) + ECSIPR_PSRTOIP = 0x10, + ECSIPR_LCHNGIP = 0x04, + ECSIPR_ICDIP = 0x01, +#elif defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) + ECSIPR_PSRTOIP = 0x10, + ECSIPR_PHYIP = 0x08, ECSIPR_LCHNGIP = 0x04, - ECSIPR_MPDIP = 0x02, ECSIPR_ICDIP = 0x01, + ECSIPR_MPDIP = 0x02, + ECSIPR_ICDIP = 0x01, +#endif }; -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) # define ECSIPR_INIT (ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP) #else # define ECSIPR_INIT (ECSIPR_BRCRXIP | ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | \ @@ -458,7 +504,7 @@ enum RPADIR_BIT { RPADIR_PADR = 0x0003f, }; -#ifdef CONFIG_CPU_SH7763 +#if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734) # define RPADIR_INIT (0x00) #else # define RPADIR_INIT (RPADIR_PADS1) diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c index 5cfef4dd7b..6dc7ad52e4 100644 --- a/drivers/net/smc91111.c +++ b/drivers/net/smc91111.c @@ -426,8 +426,7 @@ static void smc_halt(struct eth_device *dev) . Enable the transmit interrupt, so I know if it failed . Free the kernel data if I actually sent it. */ -static int smc_send(struct eth_device *dev, volatile void *packet, - int packet_length) +static int smc_send(struct eth_device *dev, void *packet, int packet_length) { byte packet_no; byte *buf; diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index e34b4879d0..b2aed7e14a 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -161,8 +161,7 @@ static int smc911x_init(struct eth_device *dev, bd_t * bd) return 0; } -static int smc911x_send(struct eth_device *dev, - volatile void *packet, int length) +static int smc911x_send(struct eth_device *dev, void *packet, int length) { u32 *data = (u32*)packet; u32 tmplen; diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 160bc0597d..3c1c8f0799 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -44,8 +44,7 @@ static RTXBD rtx __attribute__ ((aligned(8))); #error "rtx must be 64-bit aligned" #endif -static int tsec_send(struct eth_device *dev, - volatile void *packet, int length); +static int tsec_send(struct eth_device *dev, void *packet, int length); /* Default initializations for TSEC controllers. */ @@ -377,7 +376,7 @@ static void startup_tsec(struct eth_device *dev) * do the same. Presumably, this would be zero if there were no * errors */ -static int tsec_send(struct eth_device *dev, volatile void *packet, int length) +static int tsec_send(struct eth_device *dev, void *packet, int length) { int i; int result = 0; diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index f100ec1a50..b2c1be54fe 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c @@ -433,8 +433,7 @@ static struct dma_descriptor rx_descr_array[NUM_RX_DESC] static struct dma_descriptor *rx_descr_current; static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis); -static int tsi108_eth_send (struct eth_device *dev, - volatile void *packet, int length); +static int tsi108_eth_send(struct eth_device *dev, void *packet, int length); static int tsi108_eth_recv (struct eth_device *dev); static void tsi108_eth_halt (struct eth_device *dev); static unsigned int read_phy (unsigned int base, @@ -872,8 +871,7 @@ static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis) /* * send a packet */ -static int tsi108_eth_send (struct eth_device *dev, - volatile void *packet, int length) +static int tsi108_eth_send(struct eth_device *dev, void *packet, int length) { unsigned long base; int timeout; @@ -948,7 +946,7 @@ static int tsi108_eth_recv (struct eth_device *dev) unsigned long base; int length = 0; unsigned long status; - volatile uchar *buffer; + uchar *buffer; base = dev->iobase; @@ -983,10 +981,8 @@ static int tsi108_eth_recv (struct eth_device *dev) le32_to_cpu(rx_descr->vlan_byte_count) & 0xFFFF; /*** process packet ***/ - buffer = - (volatile uchar - *)(le32_to_cpu (rx_descr->start_addr0)); - NetReceive (buffer, length); + buffer = (uchar *)(le32_to_cpu(rx_descr->start_addr0)); + NetReceive(buffer, length); invalidate_dcache_range ((unsigned long)buffer, (unsigned long)buffer + diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c index 5933bddce5..9648901925 100644 --- a/drivers/net/uli526x.c +++ b/drivers/net/uli526x.c @@ -168,8 +168,7 @@ static char buf_pool[TX_BUF_ALLOC * TX_DESC_CNT + 4]; static int mode = 8; /* function declaration -- */ -static int uli526x_start_xmit(struct eth_device *dev, - volatile void *packet, int length); +static int uli526x_start_xmit(struct eth_device *dev, void *packet, int length); static const struct ethtool_ops netdev_ethtool_ops; static u16 read_srom_word(long, int); static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long); @@ -443,8 +442,7 @@ static void uli526x_init(struct eth_device *dev) * Send a packet to media from the upper layer. */ -static int uli526x_start_xmit(struct eth_device *dev, - volatile void *packet, int length) +static int uli526x_start_xmit(struct eth_device *dev, void *packet, int length) { struct uli526x_board_info *db = dev->priv; struct tx_desc *txptr; diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c index 82e254b529..7854a04cae 100644 --- a/drivers/net/xilinx_axi_emac.c +++ b/drivers/net/xilinx_axi_emac.c @@ -468,7 +468,7 @@ static int axiemac_init(struct eth_device *dev, bd_t * bis) return 0; } -static int axiemac_send(struct eth_device *dev, volatile void *ptr, int len) +static int axiemac_send(struct eth_device *dev, void *ptr, int len) { struct axidma_priv *priv = dev->priv; u32 timeout; diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 9791b9a534..d5bd737827 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -199,7 +199,7 @@ static int xemaclite_txbufferavailable(struct eth_device *dev) return !(txpingbusy && txpongbusy); } -static int emaclite_send(struct eth_device *dev, volatile void *ptr, int len) +static int emaclite_send(struct eth_device *dev, void *ptr, int len) { u32 reg; u32 baseaddress; @@ -240,7 +240,7 @@ static int emaclite_send(struct eth_device *dev, volatile void *ptr, int len) debug("Send packet from 0x%x\n", baseaddress); /* Write the frame to the buffer */ - xemaclite_alignedwrite((void *) ptr, baseaddress, len); + xemaclite_alignedwrite(ptr, baseaddress, len); out_be32 (baseaddress + XEL_TPLR_OFFSET,(len & (XEL_TPLR_LENGTH_MASK_HI | XEL_TPLR_LENGTH_MASK_LO))); reg = in_be32 (baseaddress + XEL_TSR_OFFSET); @@ -261,7 +261,7 @@ static int emaclite_send(struct eth_device *dev, volatile void *ptr, int len) & XEL_TSR_XMIT_ACTIVE_MASK) == 0)) { debug("Send packet from 0x%x\n", baseaddress); /* Write the frame to the buffer */ - xemaclite_alignedwrite((void *) ptr, baseaddress, len); + xemaclite_alignedwrite(ptr, baseaddress, len); out_be32 (baseaddress + XEL_TPLR_OFFSET, (len & (XEL_TPLR_LENGTH_MASK_HI | XEL_TPLR_LENGTH_MASK_LO))); diff --git a/drivers/net/xilinx_ll_temac_fifo.c b/drivers/net/xilinx_ll_temac_fifo.c index 3ff0f347ed..d7fd989cd4 100644 --- a/drivers/net/xilinx_ll_temac_fifo.c +++ b/drivers/net/xilinx_ll_temac_fifo.c @@ -102,8 +102,7 @@ int ll_temac_recv_fifo(struct eth_device *dev) return 0; } -int ll_temac_send_fifo(struct eth_device *dev, volatile void *packet, - int length) +int ll_temac_send_fifo(struct eth_device *dev, void *packet, int length) { int i; u32 *buf = (u32 *)packet; diff --git a/drivers/net/xilinx_ll_temac_fifo.h b/drivers/net/xilinx_ll_temac_fifo.h index f0d6e6823c..e5b4be9e6c 100644 --- a/drivers/net/xilinx_ll_temac_fifo.h +++ b/drivers/net/xilinx_ll_temac_fifo.h @@ -116,7 +116,6 @@ int ll_temac_reset_fifo(struct eth_device *dev); int ll_temac_recv_fifo(struct eth_device *dev); /* send buffered data to FIFO */ -int ll_temac_send_fifo(struct eth_device *dev, volatile void *packet, - int length); +int ll_temac_send_fifo(struct eth_device *dev, void *packet, int length); #endif /* _XILINX_LL_TEMAC_FIFO_ */ diff --git a/drivers/net/xilinx_ll_temac_sdma.c b/drivers/net/xilinx_ll_temac_sdma.c index 621d100f29..8637a6b1fc 100644 --- a/drivers/net/xilinx_ll_temac_sdma.c +++ b/drivers/net/xilinx_ll_temac_sdma.c @@ -324,8 +324,7 @@ int ll_temac_recv_sdma(struct eth_device *dev) return 0; } -int ll_temac_send_sdma(struct eth_device *dev, volatile void *packet, - int length) +int ll_temac_send_sdma(struct eth_device *dev, void *packet, int length) { unsigned timeout = 50; /* 1usec * 50 = 50usec */ struct cdmac_bd *tx_dp = &cdmac_bd.tx[tx_idx]; diff --git a/drivers/net/xilinx_ll_temac_sdma.h b/drivers/net/xilinx_ll_temac_sdma.h index 51e258d7f5..db00a57a16 100644 --- a/drivers/net/xilinx_ll_temac_sdma.h +++ b/drivers/net/xilinx_ll_temac_sdma.h @@ -275,7 +275,6 @@ int ll_temac_reset_sdma(struct eth_device *dev); int ll_temac_recv_sdma(struct eth_device *dev); /* send buffered data to SDMA */ -int ll_temac_send_sdma(struct eth_device *dev, volatile void *packet, - int length); +int ll_temac_send_sdma(struct eth_device *dev, void *packet, int length); #endif /* _XILINX_LL_TEMAC_SDMA_ */ |