net: dm9000: Make accessor names lowercase
Subsystems (2)
PATCH v2 1/17 net: dm9000: Make accessor names lowercase
Make accessor names lowercase to be consistent with coding style. No functional change.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 214 +++++++++++++++++++++--------------------- 1 file changed, 107 insertions(+), 107 deletions(-)
drivers/net/dm9000x.c +107 -107
@@ -104,24 +104,24 @@ static board_info_t dm9000_info;static int dm9000_probe (void );static u16 dm9000_phy_read (int );static void dm9000_phy_write (int ,u16 ); -static u8 DM9000_ior (int ); -static void DM9000_iow (int reg,u8 value); +static u8 dm9000_ior (int ); +static void dm9000_iow (int reg,u8 value);/* DM9000 network board routine ---------------------------- */ #ifndef CONFIG_DM9000_BYTE_SWAPPED -#define DM9000_outb (d,r) writeb(d, (volatile u8 *)(r)) -#define DM9000_outw (d,r) writew(d, (volatile u16 *)(r)) -#define DM9000_outl (d,r) writel(d, (volatile u32 *)(r)) -#define DM9000_inb (r) readb((volatile u8 *)(r)) -#define DM9000_inw (r) readw((volatile u16 *)(r)) -#define DM9000_inl (r) readl((volatile u32 *)(r)) +#define dm9000_outb (d,r) writeb(d, (volatile u8 *)(r)) +#define dm9000_outw (d,r) writew(d, (volatile u16 *)(r)) +#define dm9000_outl (d,r) writel(d, (volatile u32 *)(r)) +#define dm9000_inb (r) readb((volatile u8 *)(r)) +#define dm9000_inw (r) readw((volatile u16 *)(r)) +#define dm9000_inl (r) readl((volatile u32 *)(r))#else -#define DM9000_outb (d, r) __raw_writeb(d, r) -#define DM9000_outw (d, r) __raw_writew(d, r) -#define DM9000_outl (d, r) __raw_writel(d, r) -#define DM9000_inb (r) __raw_readb(r) -#define DM9000_inw (r) __raw_readw(r) -#define DM9000_inl (r) __raw_readl(r) +#define dm9000_outb (d, r) __raw_writeb(d, r) +#define dm9000_outw (d, r) __raw_writew(d, r) +#define dm9000_outl (d, r) __raw_writel(d, r) +#define dm9000_inb (r) __raw_readb(r) +#define dm9000_inw (r) __raw_readw(r) +#define dm9000_inl (r) __raw_readl(r)#endif #ifdef CONFIG_DM9000_DEBUG
@@ -129,14 +129,14 @@ static voiddump_regs (void) {DM9000_DBG ("\n" ); -DM9000_DBG ("NCR (0x00): %02x\n" ,DM9000_ior (0 )); -DM9000_DBG ("NSR (0x01): %02x\n" ,DM9000_ior (1 )); -DM9000_DBG ("TCR (0x02): %02x\n" ,DM9000_ior (2 )); -DM9000_DBG ("TSRI (0x03): %02x\n" ,DM9000_ior (3 )); -DM9000_DBG ("TSRII (0x04): %02x\n" ,DM9000_ior (4 )); -DM9000_DBG ("RCR (0x05): %02x\n" ,DM9000_ior (5 )); -DM9000_DBG ("RSR (0x06): %02x\n" ,DM9000_ior (6 )); -DM9000_DBG ("ISR (0xFE): %02x\n" ,DM9000_ior (DM9000_ISR )); +DM9000_DBG ("NCR (0x00): %02x\n" ,dm9000_ior (0 )); +DM9000_DBG ("NSR (0x01): %02x\n" ,dm9000_ior (1 )); +DM9000_DBG ("TCR (0x02): %02x\n" ,dm9000_ior (2 )); +DM9000_DBG ("TSRI (0x03): %02x\n" ,dm9000_ior (3 )); +DM9000_DBG ("TSRII (0x04): %02x\n" ,dm9000_ior (4 )); +DM9000_DBG ("RCR (0x05): %02x\n" ,dm9000_ior (5 )); +DM9000_DBG ("RSR (0x06): %02x\n" ,dm9000_ior (6 )); +DM9000_DBG ("ISR (0xFE): %02x\n" ,dm9000_ior (DM9000_ISR ));DM9000_DBG ("\n" ); }#endif
@@ -145,7 +145,7 @@ static void dm9000_outblk_8bit(volatile void *data_ptr, int count) {int i;for (i =0 ; i < count; i++) -DM9000_outb ((((u8 *) data_ptr)[i] &0xff ),DM9000_DATA ); +dm9000_outb ((((u8 *) data_ptr)[i] &0xff ),DM9000_DATA ); }static void dm9000_outblk_16bit (volatile void *data_ptr,int count)
@@ -154,7 +154,7 @@ static void dm9000_outblk_16bit(volatile void *data_ptr, int count)u32 tmplen = (count +1 ) /2 ;for (i =0 ; i < tmplen; i++) -DM9000_outw (((u16 *) data_ptr)[i],DM9000_DATA ); +dm9000_outw (((u16 *) data_ptr)[i],DM9000_DATA ); }static void dm9000_outblk_32bit (volatile void *data_ptr,int count) {
@@ -162,14 +162,14 @@ static void dm9000_outblk_32bit(volatile void *data_ptr, int count)u32 tmplen = (count +3 ) /4 ;for (i =0 ; i < tmplen; i++) -DM9000_outl (((u32 *) data_ptr)[i],DM9000_DATA ); +dm9000_outl (((u32 *) data_ptr)[i],DM9000_DATA ); }static void dm9000_inblk_8bit (void *data_ptr,int count) {int i;for (i =0 ; i < count; i++) - ((u8 *) data_ptr)[i] =DM9000_inb (DM9000_DATA ); + ((u8 *) data_ptr)[i] =dm9000_inb (DM9000_DATA ); }static void dm9000_inblk_16bit (void *data_ptr,int count)
@@ -178,7 +178,7 @@ static void dm9000_inblk_16bit(void *data_ptr, int count)u32 tmplen = (count +1 ) /2 ;for (i =0 ; i < tmplen; i++) - ((u16 *) data_ptr)[i] =DM9000_inw (DM9000_DATA ); + ((u16 *) data_ptr)[i] =dm9000_inw (DM9000_DATA ); }static void dm9000_inblk_32bit (void *data_ptr,int count) {
@@ -186,38 +186,38 @@ static void dm9000_inblk_32bit(void *data_ptr, int count)u32 tmplen = (count +3 ) /4 ;for (i =0 ; i < tmplen; i++) - ((u32 *) data_ptr)[i] =DM9000_inl (DM9000_DATA ); + ((u32 *) data_ptr)[i] =dm9000_inl (DM9000_DATA ); }static void dm9000_rx_status_32bit (u16 *RxStatus,u16 *RxLen) {u32 tmpdata; -DM9000_outb (DM9000_MRCMD ,DM9000_IO ); +dm9000_outb (DM9000_MRCMD ,DM9000_IO ); - tmpdata =DM9000_inl (DM9000_DATA ); + tmpdata =dm9000_inl (DM9000_DATA ); *RxStatus =__le16_to_cpu (tmpdata); *RxLen =__le16_to_cpu (tmpdata >>16 ); }static void dm9000_rx_status_16bit (u16 *RxStatus,u16 *RxLen) { -DM9000_outb (DM9000_MRCMD ,DM9000_IO ); +dm9000_outb (DM9000_MRCMD ,DM9000_IO ); - *RxStatus =__le16_to_cpu (DM9000_inw (DM9000_DATA )); - *RxLen =__le16_to_cpu (DM9000_inw (DM9000_DATA )); + *RxStatus =__le16_to_cpu (dm9000_inw (DM9000_DATA )); + *RxLen =__le16_to_cpu (dm9000_inw (DM9000_DATA )); }static void dm9000_rx_status_8bit (u16 *RxStatus,u16 *RxLen) { -DM9000_outb (DM9000_MRCMD ,DM9000_IO ); +dm9000_outb (DM9000_MRCMD ,DM9000_IO ); *RxStatus = -__le16_to_cpu (DM9000_inb (DM9000_DATA ) + - (DM9000_inb (DM9000_DATA ) <<8 )); +__le16_to_cpu (dm9000_inb (DM9000_DATA ) + + (dm9000_inb (DM9000_DATA ) <<8 )); *RxLen = -__le16_to_cpu (DM9000_inb (DM9000_DATA ) + - (DM9000_inb (DM9000_DATA ) <<8 )); +__le16_to_cpu (dm9000_inb (DM9000_DATA ) + + (dm9000_inb (DM9000_DATA ) <<8 )); }/*
@@ -227,10 +227,10 @@ intdm9000_probe (void) {u32 id_val; - id_val =DM9000_ior (DM9000_VIDL ); - id_val |=DM9000_ior (DM9000_VIDH ) <<8 ; - id_val |=DM9000_ior (DM9000_PIDL ) <<16 ; - id_val |=DM9000_ior (DM9000_PIDH ) <<24 ; + id_val =dm9000_ior (DM9000_VIDL ); + id_val |=dm9000_ior (DM9000_VIDH ) <<8 ; + id_val |=dm9000_ior (DM9000_PIDL ) <<16 ; + id_val |=dm9000_ior (DM9000_PIDH ) <<24 ;if (id_val ==DM9000_ID ) {printf ("dm9000 i/o: 0x%x, id: 0x%x \n" ,CONFIG_DM9000_BASE , id_val);
@@ -252,28 +252,28 @@ dm9000_reset(void)see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 */ /* DEBUG: Make all GPIO0 outputs, all others inputs */ -DM9000_iow (DM9000_GPCR ,GPCR_GPIO0_OUT ); +dm9000_iow (DM9000_GPCR ,GPCR_GPIO0_OUT );/* Step 1: Power internal PHY by writing 0 to GPIO0 pin */ -DM9000_iow (DM9000_GPR ,0 ); +dm9000_iow (DM9000_GPR ,0 );/* Step 2: Software reset */ -DM9000_iow (DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST )); +dm9000_iow (DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST ));do {DM9000_DBG ("resetting the DM9000, 1st reset\n" );udelay (25 );/* Wait at least 20 us */ - }while (DM9000_ior (DM9000_NCR ) &1 ); + }while (dm9000_ior (DM9000_NCR ) &1 ); -DM9000_iow (DM9000_NCR ,0 ); -DM9000_iow (DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST ));/* Issue a second reset */ +dm9000_iow (DM9000_NCR ,0 ); +dm9000_iow (DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST ));/* Issue a second reset */ do {DM9000_DBG ("resetting the DM9000, 2nd reset\n" );udelay (25 );/* Wait at least 20 us */ - }while (DM9000_ior (DM9000_NCR ) &1 ); + }while (dm9000_ior (DM9000_NCR ) &1 );/* Check whether the ethernet controller is present */ -if ((DM9000_ior (DM9000_PIDL ) !=0x0 ) || - (DM9000_ior (DM9000_PIDH ) !=0x90 )) +if ((dm9000_ior (DM9000_PIDL ) !=0x0 ) || + (dm9000_ior (DM9000_PIDH ) !=0x90 ))printf ("ERROR: resetting DM9000 -> not responding\n" ); }
@@ -294,7 +294,7 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)return -1 ;/* Auto-detect 8/16/32 bit mode, ISR Bit 6+7 indicate bus width */ - io_mode =DM9000_ior (DM9000_ISR ) >>6 ; + io_mode =dm9000_ior (DM9000_ISR ) >>6 ;switch (io_mode) {case 0x0 :/* 16-bit mode */
@@ -325,21 +325,21 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd) }/* Program operating register, only internal phy supported */ -DM9000_iow (DM9000_NCR ,0x0 ); +dm9000_iow (DM9000_NCR ,0x0 );/* TX Polling clear */ -DM9000_iow (DM9000_TCR ,0 ); +dm9000_iow (DM9000_TCR ,0 );/* Less 3Kb, 200us */ -DM9000_iow (DM9000_BPTR ,BPTR_BPHW (3 ) |BPTR_JPT_600US ); +dm9000_iow (DM9000_BPTR ,BPTR_BPHW (3 ) |BPTR_JPT_600US );/* Flow Control : High/Low Water */ -DM9000_iow (DM9000_FCTR ,FCTR_HWOT (3 ) |FCTR_LWOT (8 )); +dm9000_iow (DM9000_FCTR ,FCTR_HWOT (3 ) |FCTR_LWOT (8 ));/* SH FIXME: This looks strange! Flow Control */ -DM9000_iow (DM9000_FCR ,0x0 ); +dm9000_iow (DM9000_FCR ,0x0 );/* Special Mode */ -DM9000_iow (DM9000_SMCR ,0 ); +dm9000_iow (DM9000_SMCR ,0 );/* clear TX status */ -DM9000_iow (DM9000_NSR ,NSR_WAKEST |NSR_TX2END |NSR_TX1END ); +dm9000_iow (DM9000_NSR ,NSR_WAKEST |NSR_TX2END |NSR_TX1END );/* Clear interrupt status */ -DM9000_iow (DM9000_ISR ,ISR_ROOS |ISR_ROS |ISR_PTS |ISR_PRS ); +dm9000_iow (DM9000_ISR ,ISR_ROOS |ISR_ROS |ISR_PTS |ISR_PRS );printf ("MAC: %pM\n" , dev->enetaddr);if (!is_valid_ethaddr (dev->enetaddr)) {
@@ -348,20 +348,20 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)/* fill device MAC address registers */ for (i =0 , oft =DM9000_PAR ; i <6 ; i++, oft++) -DM9000_iow (oft, dev->enetaddr[i]); +dm9000_iow (oft, dev->enetaddr[i]);for (i =0 , oft =0x16 ; i <8 ; i++, oft++) -DM9000_iow (oft,0xff ); +dm9000_iow (oft,0xff );/* read back mac, just to be sure */ for (i =0 , oft =0x10 ; i <6 ; i++, oft++) -DM9000_DBG ("%02x:" ,DM9000_ior (oft)); +DM9000_DBG ("%02x:" ,dm9000_ior (oft));DM9000_DBG ("\n" );/* Activate DM9000 */ /* RX enable */ -DM9000_iow (DM9000_RCR ,RCR_DIS_LONG |RCR_DIS_CRC |RCR_RXEN ); +dm9000_iow (DM9000_RCR ,RCR_DIS_LONG |RCR_DIS_CRC |RCR_RXEN );/* Enable TX/RX interrupt mask */ -DM9000_iow (DM9000_IMR ,IMR_PAR ); +dm9000_iow (DM9000_IMR ,IMR_PAR ); i =0 ;while (!(dm9000_phy_read (1 ) &0x20 )) {/* autonegation complete bit */
@@ -408,31 +408,31 @@ static int dm9000_send(struct eth_device *netdev, void *packet, int length)DM9000_DMP_PACKET (__func__ , packet, length); -DM9000_iow (DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */ +dm9000_iow (DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */ /* Move data to DM9000 TX RAM */ -DM9000_outb (DM9000_MWCMD ,DM9000_IO );/* Prepare for TX-data */ +dm9000_outb (DM9000_MWCMD ,DM9000_IO );/* Prepare for TX-data */ /* push the data to the TX-fifo */ (db->outblk)(packet, length);/* Set TX length to DM9000 */ -DM9000_iow (DM9000_TXPLL , length &0xff ); -DM9000_iow (DM9000_TXPLH , (length >>8 ) &0xff ); +dm9000_iow (DM9000_TXPLL , length &0xff ); +dm9000_iow (DM9000_TXPLH , (length >>8 ) &0xff );/* Issue TX polling command */ -DM9000_iow (DM9000_TCR ,TCR_TXREQ );/* Cleared after TX complete */ +dm9000_iow (DM9000_TCR ,TCR_TXREQ );/* Cleared after TX complete */ /* wait for end of transmission */ tmo =get_timer (0 ) +5 *CONFIG_SYS_HZ ; -while ( !(DM9000_ior (DM9000_NSR ) & (NSR_TX1END |NSR_TX2END )) || - !(DM9000_ior (DM9000_ISR ) &IMR_PTM ) ) { +while ( !(dm9000_ior (DM9000_NSR ) & (NSR_TX1END |NSR_TX2END )) || + !(dm9000_ior (DM9000_ISR ) &IMR_PTM ) ) {if (get_timer (0 ) >= tmo) {printf ("transmission timeout\n" );break ; } } -DM9000_iow (DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */ +dm9000_iow (DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */ DM9000_DBG ("transmit done\n\n" );return 0 ;
@@ -448,9 +448,9 @@ static void dm9000_halt(struct eth_device *netdev)/* RESET devie */ dm9000_phy_write (0 ,0x8000 );/* PHY RESET */ -DM9000_iow (DM9000_GPR ,0x01 );/* Power-Down PHY */ -DM9000_iow (DM9000_IMR ,0x80 );/* Disable all interrupt */ -DM9000_iow (DM9000_RCR ,0x00 );/* Disable RX */ +dm9000_iow (DM9000_GPR ,0x01 );/* Power-Down PHY */ +dm9000_iow (DM9000_IMR ,0x80 );/* Disable all interrupt */ +dm9000_iow (DM9000_RCR ,0x00 );/* Disable RX */ }/*
@@ -465,23 +465,23 @@ static int dm9000_rx(struct eth_device *netdev)/* Check packet ready or not, we must check the ISR status first for DM9000A */ -if (!(DM9000_ior (DM9000_ISR ) &0x01 ))/* Rx-ISR bit must be set. */ +if (!(dm9000_ior (DM9000_ISR ) &0x01 ))/* Rx-ISR bit must be set. */ return 0 ; -DM9000_iow (DM9000_ISR ,0x01 );/* clear PR status latched in bit 0 */ +dm9000_iow (DM9000_ISR ,0x01 );/* clear PR status latched in bit 0 */ /* There is _at least_ 1 package in the fifo, read them all */ for (;;) { -DM9000_ior (DM9000_MRCMDX );/* Dummy read */ +dm9000_ior (DM9000_MRCMDX );/* Dummy read */ /* Get most updated data, only look at bits 0:1, See application notes DM9000 */ - rxbyte =DM9000_inb (DM9000_DATA ) &0x03 ; + rxbyte =dm9000_inb (DM9000_DATA ) &0x03 ;/* Status check: this byte must be 0 or 1 */ if (rxbyte >DM9000_PKT_RDY ) { -DM9000_iow (DM9000_RCR ,0x00 );/* Stop Device */ -DM9000_iow (DM9000_ISR ,0x80 );/* Stop INT request */ +dm9000_iow (DM9000_RCR ,0x00 );/* Stop Device */ +dm9000_iow (DM9000_ISR ,0x80 );/* Stop INT request */ printf ("DM9000 error: status check fail: 0x%x\n" , rxbyte);return 0 ;
@@ -532,22 +532,22 @@ static int dm9000_rx(struct eth_device *netdev)#if !defined(CONFIG_DM9000_NO_SROM )void dm9000_read_srom_word (int offset,u8 *to) { -DM9000_iow (DM9000_EPAR , offset); -DM9000_iow (DM9000_EPCR ,0x4 ); +dm9000_iow (DM9000_EPAR , offset); +dm9000_iow (DM9000_EPCR ,0x4 );udelay (8000 ); -DM9000_iow (DM9000_EPCR ,0x0 ); - to[0 ] =DM9000_ior (DM9000_EPDRL ); - to[1 ] =DM9000_ior (DM9000_EPDRH ); +dm9000_iow (DM9000_EPCR ,0x0 ); + to[0 ] =dm9000_ior (DM9000_EPDRL ); + to[1 ] =dm9000_ior (DM9000_EPDRH ); }void dm9000_write_srom_word (int offset,u16 val) { -DM9000_iow (DM9000_EPAR , offset); -DM9000_iow (DM9000_EPDRH , ((val >>8 ) &0xff )); -DM9000_iow (DM9000_EPDRL , (val &0xff )); -DM9000_iow (DM9000_EPCR ,0x12 ); +dm9000_iow (DM9000_EPAR , offset); +dm9000_iow (DM9000_EPDRH , ((val >>8 ) &0xff )); +dm9000_iow (DM9000_EPDRL , (val &0xff )); +dm9000_iow (DM9000_EPCR ,0x12 );udelay (8000 ); -DM9000_iow (DM9000_EPCR ,0 ); +dm9000_iow (DM9000_EPCR ,0 ); }#endif
@@ -564,20 +564,20 @@ static void dm9000_get_enetaddr(struct eth_device *dev)Read a byte from I/O port */ static u8 -DM9000_ior (int reg) +dm9000_ior (int reg) { -DM9000_outb (reg,DM9000_IO ); -return DM9000_inb (DM9000_DATA ); +dm9000_outb (reg,DM9000_IO ); +return dm9000_inb (DM9000_DATA ); }/* Write a byte to I/O port */ static void -DM9000_iow (int reg,u8 value) +dm9000_iow (int reg,u8 value) { -DM9000_outb (reg,DM9000_IO ); -DM9000_outb (value,DM9000_DATA ); +dm9000_outb (reg,DM9000_IO ); +dm9000_outb (value,DM9000_DATA ); }/*
@@ -589,11 +589,11 @@ dm9000_phy_read(int reg)u16 val;/* Fill the phyxcer register into REG_0C */ -DM9000_iow (DM9000_EPAR ,DM9000_PHY | reg); -DM9000_iow (DM9000_EPCR ,0xc );/* Issue phyxcer read command */ +dm9000_iow (DM9000_EPAR ,DM9000_PHY | reg); +dm9000_iow (DM9000_EPCR ,0xc );/* Issue phyxcer read command */ udelay (100 );/* Wait read complete */ -DM9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer read command */ - val = (DM9000_ior (DM9000_EPDRH ) <<8 ) |DM9000_ior (DM9000_EPDRL ); +dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer read command */ + val = (dm9000_ior (DM9000_EPDRH ) <<8 ) |dm9000_ior (DM9000_EPDRL );/* The read data keeps on REG_0D & REG_0E */ DM9000_DBG ("dm9000_phy_read(0x%x): 0x%x\n" , reg, val);
@@ -608,14 +608,14 @@ dm9000_phy_write(int reg, u16 value) {/* Fill the phyxcer register into REG_0C */ -DM9000_iow (DM9000_EPAR ,DM9000_PHY | reg); +dm9000_iow (DM9000_EPAR ,DM9000_PHY | reg);/* Fill the written data into REG_0D & REG_0E */ -DM9000_iow (DM9000_EPDRL , (value &0xff )); -DM9000_iow (DM9000_EPDRH , ((value >>8 ) &0xff )); -DM9000_iow (DM9000_EPCR ,0xa );/* Issue phyxcer write command */ +dm9000_iow (DM9000_EPDRL , (value &0xff )); +dm9000_iow (DM9000_EPDRH , ((value >>8 ) &0xff )); +dm9000_iow (DM9000_EPCR ,0xa );/* Issue phyxcer write command */ udelay (500 );/* Wait write complete */ -DM9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer write command */ +dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer write command */ DM9000_DBG ("dm9000_phy_write(reg:0x%x, value:0x%x)\n" , reg, value); }
Signature · 1 line
2.35.1
PATCH v2 2/17 net: dm9000: Replace DM9000_DBG() with debug()
Use standard debug() macro to print debug messages instead of reinventing driver-specific macro again. No functional change.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 48 +++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 25 deletions(-)
drivers/net/dm9000x.c +23 -25
@@ -63,7 +63,6 @@ TODO: external MII is not functional, only internal at the moment./* #define CONFIG_DM9000_DEBUG */ #ifdef CONFIG_DM9000_DEBUG -#define DM9000_DBG(fmt,args...) printf(fmt, ##args)#define DM9000_DMP_PACKET (func,packet,length) \ do { \ int i; \
@@ -75,7 +74,6 @@ TODO: external MII is not functional, only internal at the moment. } printf("\n"); \ } while(0)#else -#define DM9000_DBG(fmt,args...)#define DM9000_DMP_PACKET (func,packet,length)#endif
@@ -128,16 +126,16 @@ static void dm9000_iow(int reg, u8 value);static void dump_regs (void ) { -DM9000_DBG ("\n" ); -DM9000_DBG ("NCR (0x00): %02x\n" ,dm9000_ior (0 )); -DM9000_DBG ("NSR (0x01): %02x\n" ,dm9000_ior (1 )); -DM9000_DBG ("TCR (0x02): %02x\n" ,dm9000_ior (2 )); -DM9000_DBG ("TSRI (0x03): %02x\n" ,dm9000_ior (3 )); -DM9000_DBG ("TSRII (0x04): %02x\n" ,dm9000_ior (4 )); -DM9000_DBG ("RCR (0x05): %02x\n" ,dm9000_ior (5 )); -DM9000_DBG ("RSR (0x06): %02x\n" ,dm9000_ior (6 )); -DM9000_DBG ("ISR (0xFE): %02x\n" ,dm9000_ior (DM9000_ISR )); -DM9000_DBG ("\n" ); +debug ("\n" ); +debug ("NCR (0x00): %02x\n" ,dm9000_ior (0 )); +debug ("NSR (0x01): %02x\n" ,dm9000_ior (1 )); +debug ("TCR (0x02): %02x\n" ,dm9000_ior (2 )); +debug ("TSRI (0x03): %02x\n" ,dm9000_ior (3 )); +debug ("TSRII (0x04): %02x\n" ,dm9000_ior (4 )); +debug ("RCR (0x05): %02x\n" ,dm9000_ior (5 )); +debug ("RSR (0x06): %02x\n" ,dm9000_ior (6 )); +debug ("ISR (0xFE): %02x\n" ,dm9000_ior (DM9000_ISR )); +debug ("\n" ); }#endif
@@ -246,7 +244,7 @@ dm9000_probe(void)static void dm9000_reset (void ) { -DM9000_DBG ("resetting DM9000\n" ); +debug ("resetting DM9000\n" );/* Reset DM9000, see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 */
@@ -259,7 +257,7 @@ dm9000_reset(void)dm9000_iow (DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST ));do { -DM9000_DBG ("resetting the DM9000, 1st reset\n" ); +debug ("resetting the DM9000, 1st reset\n" );udelay (25 );/* Wait at least 20 us */ }while (dm9000_ior (DM9000_NCR ) &1 );
@@ -267,7 +265,7 @@ dm9000_reset(void)dm9000_iow (DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST ));/* Issue a second reset */ do { -DM9000_DBG ("resetting the DM9000, 2nd reset\n" ); +debug ("resetting the DM9000, 2nd reset\n" );udelay (25 );/* Wait at least 20 us */ }while (dm9000_ior (DM9000_NCR ) &1 );
@@ -285,7 +283,7 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)u8 io_mode;struct board_info *db = &dm9000_info; -DM9000_DBG ("%s\n" , __func__); +debug ("%s\n" , __func__);/* RESET device */ dm9000_reset ();
@@ -354,8 +352,8 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)/* read back mac, just to be sure */ for (i =0 , oft =0x10 ; i <6 ; i++, oft++) -DM9000_DBG ("%02x:" ,dm9000_ior (oft)); -DM9000_DBG ("\n" ); +debug ("%02x:" ,dm9000_ior (oft)); +debug ("\n" );/* Activate DM9000 */ /* RX enable */
@@ -434,7 +432,7 @@ static int dm9000_send(struct eth_device *netdev, void *packet, int length) }dm9000_iow (DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */ -DM9000_DBG ("transmit done\n\n" ); +debug ("transmit done\n\n" );return 0 ; }
@@ -444,7 +442,7 @@ static int dm9000_send(struct eth_device *netdev, void *packet, int length)*/ static void dm9000_halt (struct eth_device *netdev) { -DM9000_DBG ("%s\n" , __func__); +debug ("%s\n" , __func__);/* RESET devie */ dm9000_phy_write (0 ,0x8000 );/* PHY RESET */
@@ -490,12 +488,12 @@ static int dm9000_rx(struct eth_device *netdev)if (rxbyte !=DM9000_PKT_RDY )return 0 ;/* No packet received, ignore */ -DM9000_DBG ("receiving packet\n" ); +debug ("receiving packet\n" );/* A packet ready now & Get status/length */ (db->rx_status)(&RxStatus, &RxLen); -DM9000_DBG ("rx status: 0x%04x rx len: %d\n" , RxStatus, RxLen); +debug ("rx status: 0x%04x rx len: %d\n" , RxStatus, RxLen);/* Move data from DM9000 */ /* Read received packet from RX SRAM */
@@ -519,7 +517,7 @@ static int dm9000_rx(struct eth_device *netdev) }else {DM9000_DMP_PACKET (__func__ , rdptr, RxLen); -DM9000_DBG ("passing packet to upper layer\n" ); +debug ("passing packet to upper layer\n" );net_process_received_packet (net_rx_packets[0 ], RxLen); } }
@@ -596,7 +594,7 @@ dm9000_phy_read(int reg) val = (dm9000_ior (DM9000_EPDRH ) <<8 ) |dm9000_ior (DM9000_EPDRL );/* The read data keeps on REG_0D & REG_0E */ -DM9000_DBG ("dm9000_phy_read(0x%x): 0x%x\n" , reg, val); +debug ("dm9000_phy_read(0x%x): 0x%x\n" , reg, val);return val; }
@@ -616,7 +614,7 @@ dm9000_phy_write(int reg, u16 value)dm9000_iow (DM9000_EPCR ,0xa );/* Issue phyxcer write command */ udelay (500 );/* Wait write complete */ dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer write command */ -DM9000_DBG ("dm9000_phy_write(reg:0x%x, value:0x%x)\n" , reg, value); +debug ("dm9000_phy_write(reg:0x%x, value:0x%x)\n" , reg, value); }int dm9000_initialize (struct bd_info *bis)
Signature · 1 line
2.35.1
PATCH v2 3/17 net: dm9000: Make RxLen and RxStatus lowercase
In reply to Marek VasutRename variables to lowercase to be consistent with coding style. No functional change.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/net/dm9000x.c +22 -22
@@ -92,7 +92,7 @@ typedef struct board_info {unsigned char srom[128 ];void (*outblk)(volatile void *data_ptr,int count);void (*inblk)(void *data_ptr,int count); -void (*rx_status)(u16 *RxStatus,u16 *RxLen); +void (*rx_status)(u16 *rxstatus,u16 *rxlen);struct eth_device netdev; } board_info_t;static board_info_t dm9000_info;
@@ -187,33 +187,33 @@ static void dm9000_inblk_32bit(void *data_ptr, int count) ((u32 *) data_ptr)[i] =dm9000_inl (DM9000_DATA ); } -static void dm9000_rx_status_32bit (u16 *RxStatus,u16 *RxLen) +static void dm9000_rx_status_32bit (u16 *rxstatus,u16 *rxlen) {u32 tmpdata;dm9000_outb (DM9000_MRCMD ,DM9000_IO ); tmpdata =dm9000_inl (DM9000_DATA ); - *RxStatus =__le16_to_cpu (tmpdata); - *RxLen =__le16_to_cpu (tmpdata >>16 ); + *rxstatus =__le16_to_cpu (tmpdata); + *rxlen =__le16_to_cpu (tmpdata >>16 ); } -static void dm9000_rx_status_16bit (u16 *RxStatus,u16 *RxLen) +static void dm9000_rx_status_16bit (u16 *rxstatus,u16 *rxlen) {dm9000_outb (DM9000_MRCMD ,DM9000_IO ); - *RxStatus =__le16_to_cpu (dm9000_inw (DM9000_DATA )); - *RxLen =__le16_to_cpu (dm9000_inw (DM9000_DATA )); + *rxstatus =__le16_to_cpu (dm9000_inw (DM9000_DATA )); + *rxlen =__le16_to_cpu (dm9000_inw (DM9000_DATA )); } -static void dm9000_rx_status_8bit (u16 *RxStatus,u16 *RxLen) +static void dm9000_rx_status_8bit (u16 *rxstatus,u16 *rxlen) {dm9000_outb (DM9000_MRCMD ,DM9000_IO ); - *RxStatus = + *rxstatus =__le16_to_cpu (dm9000_inb (DM9000_DATA ) + (dm9000_inb (DM9000_DATA ) <<8 )); - *RxLen = + *rxlen =__le16_to_cpu (dm9000_inb (DM9000_DATA ) + (dm9000_inb (DM9000_DATA ) <<8 )); }
@@ -458,7 +458,7 @@ static int dm9000_rx(struct eth_device *netdev) {u8 rxbyte;u8 *rdptr = (u8 *)net_rx_packets[0 ]; -u16 RxStatus, RxLen =0 ; +u16 rxstatus, rxlen =0 ;struct board_info *db = &dm9000_info;/* Check packet ready or not, we must check
@@ -491,34 +491,34 @@ static int dm9000_rx(struct eth_device *netdev)debug ("receiving packet\n" );/* A packet ready now & Get status/length */ - (db->rx_status)(&RxStatus, &RxLen); + (db->rx_status)(&rxstatus, &rxlen); -debug ("rx status: 0x%04x rx len: %d\n" , RxStatus, RxLen); +debug ("rx status: 0x%04x rx len: %d\n" , rxstatus, rxlen);/* Move data from DM9000 */ /* Read received packet from RX SRAM */ - (db->inblk)(rdptr, RxLen); + (db->inblk)(rdptr, rxlen); -if ((RxStatus &0xbf00 ) || (RxLen <0x40 ) - || (RxLen >DM9000_PKT_MAX )) { -if (RxStatus &0x100 ) { +if ((rxstatus &0xbf00 ) || (rxlen <0x40 ) + || (rxlen >DM9000_PKT_MAX )) { +if (rxstatus &0x100 ) {printf ("rx fifo error\n" ); } -if (RxStatus &0x200 ) { +if (rxstatus &0x200 ) {printf ("rx crc error\n" ); } -if (RxStatus &0x8000 ) { +if (rxstatus &0x8000 ) {printf ("rx length error\n" ); } -if (RxLen >DM9000_PKT_MAX ) { +if (rxlen >DM9000_PKT_MAX ) {printf ("rx length too big\n" );dm9000_reset (); } }else { -DM9000_DMP_PACKET (__func__ , rdptr, RxLen); +DM9000_DMP_PACKET (__func__ , rdptr, rxlen);debug ("passing packet to upper layer\n" ); -net_process_received_packet (net_rx_packets[0 ], RxLen); +net_process_received_packet (net_rx_packets[0 ], rxlen); } }return 0 ;
Signature · 1 line
2.35.1
PATCH v2 4/17 net: dm9000: Drop unused dump_regs()
In reply to Marek VasutDrop unused function dump_regs() because it is unused. No functional change.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 17 ----------------- 1 file changed, 17 deletions(-)
drivers/net/dm9000x.c +0 -17
@@ -122,23 +122,6 @@ static void dm9000_iow(int reg, u8 value);#define dm9000_inl (r) __raw_readl(r)#endif -#ifdef CONFIG_DM9000_DEBUG -static void -dump_regs (void ) -{ -debug ("\n" ); -debug ("NCR (0x00): %02x\n" ,dm9000_ior (0 )); -debug ("NSR (0x01): %02x\n" ,dm9000_ior (1 )); -debug ("TCR (0x02): %02x\n" ,dm9000_ior (2 )); -debug ("TSRI (0x03): %02x\n" ,dm9000_ior (3 )); -debug ("TSRII (0x04): %02x\n" ,dm9000_ior (4 )); -debug ("RCR (0x05): %02x\n" ,dm9000_ior (5 )); -debug ("RSR (0x06): %02x\n" ,dm9000_ior (6 )); -debug ("ISR (0xFE): %02x\n" ,dm9000_ior (DM9000_ISR )); -debug ("\n" ); -} -#endif -static void dm9000_outblk_8bit (volatile void *data_ptr,int count) {int i;
Signature · 1 line
2.35.1
PATCH v2 5/17 net: dm9000: Turn DM9000_DMP_PACKET() into a function
In reply to Marek VasutRework DM9000_DMP_PACKET() into dm9000_dump_packet() function, this brings better type checking. No functional change.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/net/dm9000x.c +21 -21
@@ -58,25 +58,6 @@ TODO: external MII is not functional, only internal at the moment.#include "dm9000x.h" -/* Board/System/Debug information/definition ---------------- */ - -/* #define CONFIG_DM9000_DEBUG */ - -#ifdef CONFIG_DM9000_DEBUG -#define DM9000_DMP_PACKET (func,packet,length) \ - do { \ - int i; \ - printf("%s: length: %d\n", func, length); \ - for (i = 0; i < length; i++) { \ - if (i % 8 == 0) \ - printf("\n%s: %02x: ", func, i); \ - printf("%02x ", ((unsigned char *) packet)[i]); \ - } printf("\n"); \ - } while(0) -#else -#define DM9000_DMP_PACKET (func,packet,length) -#endif -/* Structure/enum declaration ------------------------------- */ typedef struct board_info { u32 runt_length_counter; /* counter: RX length < 64byte */
@@ -122,6 +103,25 @@ static void dm9000_iow(int reg, u8 value);#define dm9000_inl (r) __raw_readl(r)#endif +#ifdef DEBUG +static void dm9000_dump_packet (const char *func,u8 *packet,int length) +{ +int i; + +printf ("%s: length: %d\n" , func, length); + +for (i =0 ; i < length; i++) { +if (i %8 ==0 ) +printf ("\n%s: %02x: " , func, i); +printf ("%02x " , packet[i]); + } + +printf ("\n" ); +} +#else +static void dm9000_dump_packet (const char *func,u8 *packet,int length) {} +#endif +static void dm9000_outblk_8bit (volatile void *data_ptr,int count) {int i;
@@ -387,7 +387,7 @@ static int dm9000_send(struct eth_device *netdev, void *packet, int length)int tmo;struct board_info *db = &dm9000_info; -DM9000_DMP_PACKET (__func__ , packet, length); +dm9000_dump_packet (__func__ , packet, length);dm9000_iow (DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */
@@ -498,7 +498,7 @@ static int dm9000_rx(struct eth_device *netdev)dm9000_reset (); } }else { -DM9000_DMP_PACKET (__func__ , rdptr, rxlen); +dm9000_dump_packet (__func__ , rdptr, rxlen);debug ("passing packet to upper layer\n" );net_process_received_packet (net_rx_packets[0 ], rxlen);
Signature · 1 line
2.35.1
PATCH v2 6/17 net: dm9000: Drop volatiles
In reply to Marek VasutRemove volatile keyword usage from arrays, they are not really volatile in any way, so this keyword is misused here. No functional change.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/dm9000x.c +10 -10
@@ -71,7 +71,7 @@ typedef struct board_info {u8 phy_addr;u8 device_wait_reset;/* device state */ unsigned char srom[128 ]; -void (*outblk)(volatile void *data_ptr,int count); +void (*outblk)(void *data_ptr,int count);void (*inblk)(void *data_ptr,int count);void (*rx_status)(u16 *rxstatus,u16 *rxlen);struct eth_device netdev;
@@ -88,12 +88,12 @@ static void dm9000_iow(int reg, u8 value);/* DM9000 network board routine ---------------------------- */ #ifndef CONFIG_DM9000_BYTE_SWAPPED -#define dm9000_outb (d,r) writeb(d, (volatile u8 *)(r)) -#define dm9000_outw (d,r) writew(d, (volatile u16 *)(r)) -#define dm9000_outl (d,r) writel(d, (volatile u32 *)(r)) -#define dm9000_inb (r) readb((volatile u8 *)(r)) -#define dm9000_inw (r) readw((volatile u16 *)(r)) -#define dm9000_inl (r) readl((volatile u32 *)(r)) +#define dm9000_outb (d,r) writeb((d), (r)) +#define dm9000_outw (d,r) writew((d), (r)) +#define dm9000_outl (d,r) writel((d), (r)) +#define dm9000_inb (r) readb(r) +#define dm9000_inw (r) readw(r) +#define dm9000_inl (r) readl(r)#else #define dm9000_outb (d, r) __raw_writeb(d, r)#define dm9000_outw (d, r) __raw_writew(d, r)
@@ -122,14 +122,14 @@ static void dm9000_dump_packet(const char *func, u8 *packet, int length)static void dm9000_dump_packet (const char *func,u8 *packet,int length) {}#endif -static void dm9000_outblk_8bit (volatile void *data_ptr,int count) +static void dm9000_outblk_8bit (void *data_ptr,int count) {int i;for (i =0 ; i < count; i++)dm9000_outb ((((u8 *) data_ptr)[i] &0xff ),DM9000_DATA ); } -static void dm9000_outblk_16bit (volatile void *data_ptr,int count) +static void dm9000_outblk_16bit (void *data_ptr,int count) {int i;u32 tmplen = (count +1 ) /2 ;
@@ -137,7 +137,7 @@ static void dm9000_outblk_16bit(volatile void *data_ptr, int count)for (i =0 ; i < tmplen; i++)dm9000_outw (((u16 *) data_ptr)[i],DM9000_DATA ); } -static void dm9000_outblk_32bit (volatile void *data_ptr,int count) +static void dm9000_outblk_32bit (void *data_ptr,int count) {int i;u32 tmplen = (count +3 ) /4 ;
Signature · 1 line
2.35.1
PATCH v2 7/17 net: dm9000: Checkpatch cleanup
In reply to Marek VasutFix checkpatch errors and warnings. No functional change.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 251 +++++++++++++++++++++--------------------- 1 file changed, 126 insertions(+), 125 deletions(-)
drivers/net/dm9000x.c +126 -125
@@ -1,53 +1,53 @@// SPDX-License-Identifier: GPL-2.0+ /* -dm9000.c: Version 1.2 12/15/2003 - -A Davicom DM9000 ISA NIC fast Ethernet driver for Linux. -Copyright (C) 1997 Sten Wang - -(C)Copyright 1997-1998 DAVICOM Semiconductor,Inc. All Rights Reserved. - -V0.11 06/20/2001 REG_0A bit3=1, default enable BP with DA match -06/22/2001 Support DM9801 progrmming -E3: R25 = ((R24 + NF) & 0x00ff) | 0xf000 -E4: R25 = ((R24 + NF) & 0x00ff) | 0xc200 -R17 = (R17 & 0xfff0) | NF + 3 -E5: R25 = ((R24 + NF - 3) & 0x00ff) | 0xc200 -R17 = (R17 & 0xfff0) | NF - -v1.00 modify by simon 2001.9.5 -change for kernel 2.4.x - -v1.1 11/09/2001 fix force mode bug - -v1.2 03/18/2003 Weilun Huang <[email protected]>: -Fixed phy reset. -Added tx/rx 32 bit mode. -Cleaned up for kernel merge. - --------------------------------------- - -12/15/2003 Initial port to u-boot by -Sascha Hauer <[email protected]> - -06/03/2008 Remy Bohmer <[email protected]> -- Fixed the driver to work with DM9000A. -(check on ISR receive status bit before reading the -FIFO as described in DM9000 programming guide and -application notes) -- Added autodetect of databus width. -- Made debug code compile again. -- Adapt eth_send such that it matches the DM9000* -application notes. Needed to make it work properly -for DM9000A. -- Adapted reset procedure to match DM9000 application -notes (i.e. double reset) -- some minor code cleanups -These changes are tested with DM9000{A,EP,E} together -with a 200MHz Atmel AT91SAM9261 core - -TODO: external MII is not functional, only internal at the moment. -*/ +* dm9000.c: Version 1.2 12/15/2003 +* +* A Davicom DM9000 ISA NIC fast Ethernet driver for Linux. +* Copyright (C) 1997 Sten Wang +* +* (C)Copyright 1997-1998 DAVICOM Semiconductor,Inc. All Rights Reserved. +* +* V0.11 06/20/2001 REG_0A bit3=1, default enable BP with DA match +* 06/22/2001 Support DM9801 progrmming +* E3: R25 = ((R24 + NF) & 0x00ff) | 0xf000 +* E4: R25 = ((R24 + NF) & 0x00ff) | 0xc200 +* R17 = (R17 & 0xfff0) | NF + 3 +* E5: R25 = ((R24 + NF - 3) & 0x00ff) | 0xc200 +* R17 = (R17 & 0xfff0) | NF +* +* v1.00 modify by simon 2001.9.5 +* change for kernel 2.4.x +* +* v1.1 11/09/2001 fix force mode bug +* +* v1.2 03/18/2003 Weilun Huang <[email protected]>: +* Fixed phy reset. +* Added tx/rx 32 bit mode. +* Cleaned up for kernel merge. +* +* -------------------------------------- +* +* 12/15/2003 Initial port to u-boot by +* Sascha Hauer <[email protected]> +* +* 06/03/2008 Remy Bohmer <[email protected]> +* - Fixed the driver to work with DM9000A. +* (check on ISR receive status bit before reading the +* FIFO as described in DM9000 programming guide and +* application notes) +* - Added autodetect of databus width. +* - Made debug code compile again. +* - Adapt eth_send such that it matches the DM9000* +* application notes. Needed to make it work properly +* for DM9000A. +* - Adapted reset procedure to match DM9000 application +* notes (i.e. double reset) +* - some minor code cleanups +* These changes are tested with DM9000{A,EP,E} together +* with a 200MHz Atmel AT91SAM9261 core +* +* TODO: external MII is not functional, only internal at the moment. +*/ #include <common.h> #include <command.h>
@@ -59,7 +59,7 @@ TODO: external MII is not functional, only internal at the moment.#include "dm9000x.h" /* Structure/enum declaration ------------------------------- */ -typedef struct board_info { +struct board_info {u32 runt_length_counter;/* counter: RX length < 64byte */ u32 long_length_counter;/* counter: RX length > 1514byte */ u32 reset_counter;/* counter: RESET */
@@ -75,9 +75,9 @@ typedef struct board_info {void (*inblk)(void *data_ptr,int count);void (*rx_status)(u16 *rxstatus,u16 *rxlen);struct eth_device netdev; -} board_info_t; -static board_info_t dm9000_info; +}; +static struct board_info dm9000_info;/* function declaration ------------------------------------- */ static int dm9000_probe (void );
@@ -88,9 +88,9 @@ static void dm9000_iow(int reg, u8 value);/* DM9000 network board routine ---------------------------- */ #ifndef CONFIG_DM9000_BYTE_SWAPPED -#define dm9000_outb (d,r) writeb((d), (r)) -#define dm9000_outw (d,r) writew((d), (r)) -#define dm9000_outl (d,r) writel((d), (r)) +#define dm9000_outb (d, r) writeb((d), (r)) +#define dm9000_outw (d, r) writew((d), (r)) +#define dm9000_outl (d, r) writel((d), (r))#define dm9000_inb (r) readb(r)#define dm9000_inw (r) readw(r)#define dm9000_inl (r) readl(r)
@@ -125,8 +125,9 @@ static void dm9000_dump_packet(const char *func, u8 *packet, int length) {}static void dm9000_outblk_8bit (void *data_ptr,int count) {int i; +for (i =0 ; i < count; i++) -dm9000_outb ((((u8 *) data_ptr)[i] &0xff ),DM9000_DATA ); +dm9000_outb ((((u8 *)data_ptr)[i] &0xff ),DM9000_DATA ); }static void dm9000_outblk_16bit (void *data_ptr,int count)
@@ -135,22 +136,24 @@ static void dm9000_outblk_16bit(void *data_ptr, int count)u32 tmplen = (count +1 ) /2 ;for (i =0 ; i < tmplen; i++) -dm9000_outw (((u16 *) data_ptr)[i],DM9000_DATA ); +dm9000_outw (((u16 *)data_ptr)[i],DM9000_DATA ); } +static void dm9000_outblk_32bit (void *data_ptr,int count) {int i;u32 tmplen = (count +3 ) /4 ;for (i =0 ; i < tmplen; i++) -dm9000_outl (((u32 *) data_ptr)[i],DM9000_DATA ); +dm9000_outl (((u32 *)data_ptr)[i],DM9000_DATA ); }static void dm9000_inblk_8bit (void *data_ptr,int count) {int i; +for (i =0 ; i < count; i++) - ((u8 *) data_ptr)[i] =dm9000_inb (DM9000_DATA ); + ((u8 *)data_ptr)[i] =dm9000_inb (DM9000_DATA ); }static void dm9000_inblk_16bit (void *data_ptr,int count)
@@ -159,15 +162,16 @@ static void dm9000_inblk_16bit(void *data_ptr, int count)u32 tmplen = (count +1 ) /2 ;for (i =0 ; i < tmplen; i++) - ((u16 *) data_ptr)[i] =dm9000_inw (DM9000_DATA ); + ((u16 *)data_ptr)[i] =dm9000_inw (DM9000_DATA ); } +static void dm9000_inblk_32bit (void *data_ptr,int count) {int i;u32 tmplen = (count +3 ) /4 ;for (i =0 ; i < tmplen; i++) - ((u32 *) data_ptr)[i] =dm9000_inl (DM9000_DATA ); + ((u32 *)data_ptr)[i] =dm9000_inl (DM9000_DATA ); }static void dm9000_rx_status_32bit (u16 *rxstatus,u16 *rxlen)
@@ -202,25 +206,25 @@ static void dm9000_rx_status_8bit(u16 *rxstatus, u16 *rxlen) }/* -Search DM9000 board, allocate space and register it -*/ +* Search DM9000 board, allocate space and register it +*/ int dm9000_probe (void ) {u32 id_val; + id_val =dm9000_ior (DM9000_VIDL ); id_val |=dm9000_ior (DM9000_VIDH ) <<8 ; id_val |=dm9000_ior (DM9000_PIDL ) <<16 ; id_val |=dm9000_ior (DM9000_PIDH ) <<24 ; -if (id_val ==DM9000_ID ) { -printf ("dm9000 i/o: 0x%x, id: 0x%x \n" ,CONFIG_DM9000_BASE , - id_val); -return 0 ; - }else { +if (id_val !=DM9000_ID ) {printf ("dm9000 not found at 0x%08x id: 0x%08x\n" ,CONFIG_DM9000_BASE , id_val);return -1 ; } + +printf ("dm9000 i/o: 0x%x, id: 0x%x\n" ,CONFIG_DM9000_BASE , id_val); +return 0 ; }/* General Purpose dm9000 reset routine */
@@ -229,8 +233,10 @@ dm9000_reset(void) {debug ("resetting DM9000\n" ); -/* Reset DM9000, -see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 */ +/* +* Reset DM9000, +* see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 +*/ /* DEBUG: Make all GPIO0 outputs, all others inputs */ dm9000_iow (DM9000_GPCR ,GPCR_GPIO0_OUT );
@@ -258,16 +264,13 @@ dm9000_reset(void)printf ("ERROR: resetting DM9000 -> not responding\n" ); } -/* Initialize dm9000 board -*/ +/* Initialize dm9000 board */ static int dm9000_init (struct eth_device *dev,struct bd_info *bd) {int i, oft, lnk;u8 io_mode;struct board_info *db = &dm9000_info; -debug ("%s\n" , __func__); -/* RESET device */ dm9000_reset ();
@@ -323,9 +326,8 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)dm9000_iow (DM9000_ISR ,ISR_ROOS |ISR_ROS |ISR_PTS |ISR_PRS );printf ("MAC: %pM\n" , dev->enetaddr); -if (!is_valid_ethaddr (dev->enetaddr)) { +if (!is_valid_ethaddr (dev->enetaddr))printf ("WARNING: Bad MAC address (uninitialized EEPROM?)\n" ); - }/* fill device MAC address registers */ for (i =0 , oft =DM9000_PAR ; i <6 ; i++, oft++)
@@ -379,15 +381,15 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd) }/* -Hardware start transmission. -Send a packet to media from the upper layer. -*/ +* Hardware start transmission. +* Send a packet to media from the upper layer. +*/ static int dm9000_send (struct eth_device *netdev,void *packet,int length) {int tmo;struct board_info *db = &dm9000_info; -dm9000_dump_packet (__func__ , packet, length); +dm9000_dump_packet (__func__, packet, length);dm9000_iow (DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */
@@ -395,7 +397,7 @@ static int dm9000_send(struct eth_device *netdev, void *packet, int length)dm9000_outb (DM9000_MWCMD ,DM9000_IO );/* Prepare for TX-data */ /* push the data to the TX-fifo */ - (db->outblk)(packet, length); + db->outblk (packet, length);/* Set TX length to DM9000 */ dm9000_iow (DM9000_TXPLL , length &0xff );
@@ -406,8 +408,8 @@ static int dm9000_send(struct eth_device *netdev, void *packet, int length)/* wait for end of transmission */ tmo =get_timer (0 ) +5 *CONFIG_SYS_HZ ; -while ( !(dm9000_ior (DM9000_NSR ) & (NSR_TX1END |NSR_TX2END )) || - !(dm9000_ior (DM9000_ISR ) &IMR_PTM ) ) { +while (!(dm9000_ior (DM9000_NSR ) & (NSR_TX1END |NSR_TX2END )) || + !(dm9000_ior (DM9000_ISR ) &IMR_PTM )) {if (get_timer (0 ) >= tmo) {printf ("transmission timeout\n" );break ;
@@ -420,14 +422,12 @@ static int dm9000_send(struct eth_device *netdev, void *packet, int length) }/* -Stop the interface. -The interface is stopped when it is brought. -*/ +* Stop the interface. +* The interface is stopped when it is brought. +*/ static void dm9000_halt (struct eth_device *netdev) { -debug ("%s\n" , __func__); - -/* RESET devie */ +/* RESET device */ dm9000_phy_write (0 ,0x8000 );/* PHY RESET */ dm9000_iow (DM9000_GPR ,0x01 );/* Power-Down PHY */ dm9000_iow (DM9000_IMR ,0x80 );/* Disable all interrupt */
@@ -435,8 +435,8 @@ static void dm9000_halt(struct eth_device *netdev) }/* -Received a packet and pass to upper layer -*/ +* Received a packet and pass to upper layer +*/ static int dm9000_rx (struct eth_device *netdev) {u8 rxbyte;
@@ -444,8 +444,10 @@ static int dm9000_rx(struct eth_device *netdev)u16 rxstatus, rxlen =0 ;struct board_info *db = &dm9000_info; -/* Check packet ready or not, we must check -the ISR status first for DM9000A */ +/* +* Check packet ready or not, we must check +* the ISR status first for DM9000A +*/ if (!(dm9000_ior (DM9000_ISR ) &0x01 ))/* Rx-ISR bit must be set. */ return 0 ;
@@ -455,8 +457,10 @@ static int dm9000_rx(struct eth_device *netdev)for (;;) {dm9000_ior (DM9000_MRCMDX );/* Dummy read */ -/* Get most updated data, -only look at bits 0:1, See application notes DM9000 */ +/* +* Get most updated data, +* only look at bits 0:1, See application notes DM9000 +*/ rxbyte =dm9000_inb (DM9000_DATA ) &0x03 ;/* Status check: this byte must be 0 or 1 */
@@ -464,7 +468,7 @@ static int dm9000_rx(struct eth_device *netdev)dm9000_iow (DM9000_RCR ,0x00 );/* Stop Device */ dm9000_iow (DM9000_ISR ,0x80 );/* Stop INT request */ printf ("DM9000 error: status check fail: 0x%x\n" , - rxbyte); + rxbyte);return 0 ; }
@@ -474,31 +478,28 @@ static int dm9000_rx(struct eth_device *netdev)debug ("receiving packet\n" );/* A packet ready now & Get status/length */ - (db->rx_status)(&rxstatus, &rxlen); + db->rx_status (&rxstatus, &rxlen);debug ("rx status: 0x%04x rx len: %d\n" , rxstatus, rxlen);/* Move data from DM9000 */ /* Read received packet from RX SRAM */ - (db->inblk)(rdptr, rxlen); + db->inblk (rdptr, rxlen); -if ((rxstatus &0xbf00 ) || (rxlen <0x40 ) - || (rxlen >DM9000_PKT_MAX )) { -if (rxstatus &0x100 ) { +if (rxstatus &0xbf00 || rxlen <0x40 || + rxlen >DM9000_PKT_MAX ) { +if (rxstatus &0x100 )printf ("rx fifo error\n" ); - } -if (rxstatus &0x200 ) { +if (rxstatus &0x200 )printf ("rx crc error\n" ); - } -if (rxstatus &0x8000 ) { +if (rxstatus &0x8000 )printf ("rx length error\n" ); - }if (rxlen >DM9000_PKT_MAX ) {printf ("rx length too big\n" );dm9000_reset (); } }else { -dm9000_dump_packet (__func__ , rdptr, rxlen); +dm9000_dump_packet (__func__, rdptr, rxlen);debug ("passing packet to upper layer\n" );net_process_received_packet (net_rx_packets[0 ], rxlen);
@@ -508,14 +509,14 @@ static int dm9000_rx(struct eth_device *netdev) }/* -Read a word data from SROM -*/ +* Read a word data from SROM +*/ #if !defined(CONFIG_DM9000_NO_SROM )void dm9000_read_srom_word (int offset,u8 *to) {dm9000_iow (DM9000_EPAR , offset);dm9000_iow (DM9000_EPCR ,0x4 ); -udelay (8000 ); +mdelay (8 );dm9000_iow (DM9000_EPCR ,0x0 ); to[0 ] =dm9000_ior (DM9000_EPDRL ); to[1 ] =dm9000_ior (DM9000_EPDRH );
@@ -527,23 +528,24 @@ void dm9000_write_srom_word(int offset, u16 val)dm9000_iow (DM9000_EPDRH , ((val >>8 ) &0xff ));dm9000_iow (DM9000_EPDRL , (val &0xff ));dm9000_iow (DM9000_EPCR ,0x12 ); -udelay (8000 ); +mdelay (8 ); dm9000_iow(DM9000_EPCR, 0); } -#endif static void dm9000_get_enetaddr (struct eth_device *dev) { -#if !defined(CONFIG_DM9000_NO_SROM )int i; +for (i =0 ; i <3 ; i++)dm9000_read_srom_word (i, dev->enetaddr + (2 * i)); -#endif } +#else +static void dm9000_get_enetaddr (struct eth_device *dev) {} +#endif /* -Read a byte from I/O port -*/ +* Read a byte from I/O port +*/ static u8 dm9000_ior (int reg) {
@@ -552,8 +554,8 @@ dm9000_ior(int reg) }/* -Write a byte to I/O port -*/ +* Write a byte to I/O port +*/ static void dm9000_iow (int reg,u8 value) {
@@ -562,8 +564,8 @@ dm9000_iow(int reg, u8 value) }/* -Read a word from phyxcer -*/ +* Read a word from phyxcer +*/ static u16 dm9000_phy_read (int reg) {
@@ -577,17 +579,16 @@ dm9000_phy_read(int reg) val = (dm9000_ior (DM9000_EPDRH ) <<8 ) |dm9000_ior (DM9000_EPDRL );/* The read data keeps on REG_0D & REG_0E */ -debug ("dm9000_phy_read(0x%x): 0x%x\n" , reg, val); +debug ("%s(0x%x): 0x%x\n" , __func__, reg, val);return val; }/* -Write a word to phyxcer -*/ +* Write a word to phyxcer +*/ static void dm9000_phy_write (int reg,u16 value) { -/* Fill the phyxcer register into REG_0C */ dm9000_iow (DM9000_EPAR ,DM9000_PHY | reg);
@@ -597,12 +598,12 @@ dm9000_phy_write(int reg, u16 value)dm9000_iow (DM9000_EPCR ,0xa );/* Issue phyxcer write command */ udelay (500 );/* Wait write complete */ dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer write command */ -debug ("dm9000_phy_write(reg:0x%x, value:0x%x)\n" , reg, value); +debug ("%s(reg:0x%x, value:0x%x)\n" , __func__, reg, value); }int dm9000_initialize (struct bd_info *bis) { -struct eth_device *dev = &(dm9000_info.netdev); +struct eth_device *dev = &dm9000_info.netdev;/* Load MAC address from EEPROM */ dm9000_get_enetaddr (dev);
Signature · 1 line
2.35.1
PATCH v2 8/17 net: dm9000: Reorder and staticize
In reply to Marek VasutReorder the driver functions to get rid of forward declarations. Staticize whatever is possible. No functional change.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 122 +++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 67 deletions(-)
drivers/net/dm9000x.c +55 -67
@@ -79,13 +79,6 @@ struct board_info {static struct board_info dm9000_info; -/* function declaration ------------------------------------- */ -static int dm9000_probe (void ); -static u16 dm9000_phy_read (int ); -static void dm9000_phy_write (int ,u16 ); -static u8 dm9000_ior (int ); -static void dm9000_iow (int reg,u8 value); -/* DM9000 network board routine ---------------------------- */ #ifndef CONFIG_DM9000_BYTE_SWAPPED #define dm9000_outb (d, r) writeb((d), (r))
@@ -205,11 +198,64 @@ static void dm9000_rx_status_8bit(u16 *rxstatus, u16 *rxlen) (dm9000_inb(DM9000_DATA) << 8)); } +/* +* Read a byte from I/O port +*/ +static u8 dm9000_ior (int reg) +{ +dm9000_outb (reg,DM9000_IO ); +return dm9000_inb (DM9000_DATA ); +} + +/* +* Write a byte to I/O port +*/ +static void dm9000_iow (int reg,u8 value) +{ +dm9000_outb (reg,DM9000_IO ); +dm9000_outb (value,DM9000_DATA ); +} + +/* +* Read a word from phyxcer +*/ +static u16 dm9000_phy_read (int reg) +{ +u16 val; + +/* Fill the phyxcer register into REG_0C */ +dm9000_iow (DM9000_EPAR ,DM9000_PHY | reg); +dm9000_iow (DM9000_EPCR ,0xc );/* Issue phyxcer read command */ +udelay (100 );/* Wait read complete */ +dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer read command */ + val = (dm9000_ior (DM9000_EPDRH ) <<8 ) |dm9000_ior (DM9000_EPDRL ); + +/* The read data keeps on REG_0D & REG_0E */ +debug ("%s(0x%x): 0x%x\n" , __func__, reg, val); +return val; +} + +/* +* Write a word to phyxcer +*/ +static void dm9000_phy_write (int reg,u16 value) +{ +/* Fill the phyxcer register into REG_0C */ +dm9000_iow (DM9000_EPAR ,DM9000_PHY | reg); + +/* Fill the written data into REG_0D & REG_0E */ +dm9000_iow (DM9000_EPDRL , (value &0xff )); +dm9000_iow (DM9000_EPDRH , ((value >>8 ) &0xff )); +dm9000_iow (DM9000_EPCR ,0xa );/* Issue phyxcer write command */ +udelay (500 );/* Wait write complete */ +dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer write command */ +debug ("%s(reg:0x%x, value:0x%x)\n" , __func__, reg, value); +} +/* * Search DM9000 board, allocate space and register it */ -int -dm9000_probe (void ) +static int dm9000_probe (void ) {u32 id_val;
@@ -543,64 +589,6 @@ static void dm9000_get_enetaddr(struct eth_device *dev)static void dm9000_get_enetaddr (struct eth_device *dev) {}#endif -/* -* Read a byte from I/O port -*/ -static u8 -dm9000_ior (int reg) -{ -dm9000_outb (reg,DM9000_IO ); -return dm9000_inb (DM9000_DATA ); -} - -/* -* Write a byte to I/O port -*/ -static void -dm9000_iow (int reg,u8 value) -{ -dm9000_outb (reg,DM9000_IO ); -dm9000_outb (value,DM9000_DATA ); -} - -/* -* Read a word from phyxcer -*/ -static u16 -dm9000_phy_read (int reg) -{ -u16 val; - -/* Fill the phyxcer register into REG_0C */ -dm9000_iow (DM9000_EPAR ,DM9000_PHY | reg); -dm9000_iow (DM9000_EPCR ,0xc );/* Issue phyxcer read command */ -udelay (100 );/* Wait read complete */ -dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer read command */ - val = (dm9000_ior (DM9000_EPDRH ) <<8 ) |dm9000_ior (DM9000_EPDRL ); - -/* The read data keeps on REG_0D & REG_0E */ -debug ("%s(0x%x): 0x%x\n" , __func__, reg, val); -return val; -} - -/* -* Write a word to phyxcer -*/ -static void -dm9000_phy_write (int reg,u16 value) -{ -/* Fill the phyxcer register into REG_0C */ -dm9000_iow (DM9000_EPAR ,DM9000_PHY | reg); - -/* Fill the written data into REG_0D & REG_0E */ -dm9000_iow (DM9000_EPDRL , (value &0xff )); -dm9000_iow (DM9000_EPDRH , ((value >>8 ) &0xff )); -dm9000_iow (DM9000_EPCR ,0xa );/* Issue phyxcer write command */ -udelay (500 );/* Wait write complete */ -dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer write command */ -debug ("%s(reg:0x%x, value:0x%x)\n" , __func__, reg, value); -} -int dm9000_initialize (struct bd_info *bis) {struct eth_device *dev = &dm9000_info.netdev;
Signature · 1 line
2.35.1
PATCH v2 9/17 net: dm9000: Rename board_info to dm9000_priv
In reply to Marek VasutRename board_info structure to dm9000_priv to make it clear what this structure really contains, the driver private data. No functional change.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/dm9000x.c +5 -5
@@ -59,7 +59,7 @@#include "dm9000x.h" /* Structure/enum declaration ------------------------------- */ -struct board_info { +struct dm9000_priv {u32 runt_length_counter;/* counter: RX length < 64byte */ u32 long_length_counter;/* counter: RX length > 1514byte */ u32 reset_counter;/* counter: RESET */
@@ -77,7 +77,7 @@ struct board_info {struct eth_device netdev; }; -static struct board_info dm9000_info; +static struct dm9000_priv dm9000_info;/* DM9000 network board routine ---------------------------- */ #ifndef CONFIG_DM9000_BYTE_SWAPPED
@@ -315,7 +315,7 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd) {int i, oft, lnk;u8 io_mode; -struct board_info *db = &dm9000_info; +struct dm9000_priv *db = &dm9000_info;/* RESET device */ dm9000_reset ();
@@ -433,7 +433,7 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)static int dm9000_send (struct eth_device *netdev,void *packet,int length) {int tmo; -struct board_info *db = &dm9000_info; +struct dm9000_priv *db = &dm9000_info;dm9000_dump_packet (__func__, packet, length);
@@ -488,7 +488,7 @@ static int dm9000_rx(struct eth_device *netdev)u8 rxbyte;u8 *rdptr = (u8 *)net_rx_packets[0 ];u16 rxstatus, rxlen =0 ; -struct board_info *db = &dm9000_info; +struct dm9000_priv *db = &dm9000_info;/* * Check packet ready or not, we must check
Signature · 1 line
2.35.1
PATCH v2 10/17 net: dm9000: Drop static device private data
In reply to Marek VasutAllocate driver private data dynamically in its init function and drop the static driver private data variable. Pass the dynamic private data throughout the driver. This is done in preparation for DM conversion.
---
V2: - Add RB from Ramon
- Rename struct eth_device netdev to struct eth_device dev in struct dm9000_priv{}, so that it actually matches the use of container_of(). Also, dev is shorter than netdev and that makes those container_of() calls fit on one line.
- Add local struct eth_device *dev; and dev = &priv->dev; to dm9000_initialize() to fix the missing variable in non-DM case
- Replace kcalloc() with calloc() and include malloc.h
--- drivers/net/dm9000x.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
drivers/net/dm9000x.c +17 -11
@@ -51,6 +51,7 @@#include <common.h> #include <command.h> +#include <malloc.h> #include <net.h> #include <asm/io.h> #include <dm9000.h>
@@ -74,11 +75,9 @@ struct dm9000_priv {void (*outblk)(void *data_ptr,int count);void (*inblk)(void *data_ptr,int count);void (*rx_status)(u16 *rxstatus,u16 *rxlen); -struct eth_device netdev; +struct eth_device dev; }; -static struct dm9000_priv dm9000_info; -/* DM9000 network board routine ---------------------------- */ #ifndef CONFIG_DM9000_BYTE_SWAPPED #define dm9000_outb (d, r) writeb((d), (r))
@@ -313,9 +312,9 @@ dm9000_reset(void)/* Initialize dm9000 board */ static int dm9000_init (struct eth_device *dev,struct bd_info *bd) { + struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev);int i, oft, lnk;u8 io_mode; -struct dm9000_priv *db = &dm9000_info;/* RESET device */ dm9000_reset ();
@@ -430,10 +429,10 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)* Hardware start transmission. * Send a packet to media from the upper layer. */ -static int dm9000_send (struct eth_device *netdev,void *packet,int length) +static int dm9000_send (struct eth_device *dev,void *packet,int length) { + struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev);int tmo; -struct dm9000_priv *db = &dm9000_info;dm9000_dump_packet (__func__, packet, length);
@@ -483,12 +482,12 @@ static void dm9000_halt(struct eth_device *netdev)/* * Received a packet and pass to upper layer */ -static int dm9000_rx (struct eth_device *netdev) +static int dm9000_rx (struct eth_device *dev) { + struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev);u8 rxbyte;u8 *rdptr = (u8 *)net_rx_packets[0 ];u16 rxstatus, rxlen =0 ; -struct dm9000_priv *db = &dm9000_info;/* * Check packet ready or not, we must check
@@ -591,10 +590,17 @@ static void dm9000_get_enetaddr(struct eth_device *dev) {}int dm9000_initialize (struct bd_info *bis) { -struct eth_device *dev = &dm9000_info.netdev; +struct dm9000_priv *priv; +struct eth_device *dev; + + priv =calloc (1 ,sizeof (*priv)); +if (!priv) +return -ENOMEM ; + + dev = &priv->dev;/* Load MAC address from EEPROM */ -dm9000_get_enetaddr (dev); +dm9000_get_enetaddr (&priv->dev); dev->init = dm9000_init; dev->halt = dm9000_halt;
@@ -602,7 +608,7 @@ int dm9000_initialize(struct bd_info *bis) dev->recv = dm9000_rx;strcpy (dev->name,"dm9000" ); -eth_register (dev); +eth_register (&priv->dev);return 0 ; }
Signature · 1 line
2.35.1
PATCH v2 11/17 net: dm9000: Drop dm9000.h and staticize SROM access
In reply to Marek VasutDispose of dm9000.h because none of the function prototypes declared in it are called anywhere in the codebase. Staticize dm9000_read_srom_word() because it is now called only from within the dm9000 driver. Drop dm9000_write_srom_word() because it is no longer used.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 13 +------------ include/dm9000.h | 16 ---------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 include/dm9000.h
drivers/net/dm9000x.c +1 -12
@@ -54,7 +54,6 @@#include <malloc.h> #include <net.h> #include <asm/io.h> -#include <dm9000.h> #include <linux/delay.h> #include "dm9000x.h"
@@ -557,7 +556,7 @@ static int dm9000_rx(struct eth_device *dev)* Read a word data from SROM */ #if !defined(CONFIG_DM9000_NO_SROM ) -void dm9000_read_srom_word (int offset,u8 *to) +static void dm9000_read_srom_word (int offset,u8 *to) {dm9000_iow (DM9000_EPAR , offset);dm9000_iow (DM9000_EPCR ,0x4 );
@@ -567,16 +566,6 @@ void dm9000_read_srom_word(int offset, u8 *to) to[1 ] =dm9000_ior (DM9000_EPDRH ); } -void dm9000_write_srom_word (int offset,u16 val) -{ -dm9000_iow (DM9000_EPAR , offset); -dm9000_iow (DM9000_EPDRH , ((val >>8 ) &0xff )); -dm9000_iow (DM9000_EPDRL , (val &0xff )); -dm9000_iow (DM9000_EPCR ,0x12 ); -mdelay (8 ); -dm9000_iow (DM9000_EPCR ,0 ); -} -static void dm9000_get_enetaddr (struct eth_device *dev) {int i;
include/dm9000.h deleted +0 -16
@@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* -* NOTE: DAVICOM DM9000 ethernet driver interface -* -* Authors: Remy Bohmer <[email protected]> -*/ -#ifndef __DM9000_H__ -#define __DM9000_H__ - -/****************** function prototypes **********************/ -#if !defined(CONFIG_DM9000_NO_SROM ) -void dm9000_write_srom_word (int offset,u16 val); -void dm9000_read_srom_word (int offset,u8 *to); -#endif - -#endif /* __DM9000_H__ */
Signature · 1 line
2.35.1
PATCH v2 12/17 net: dm9000: Pass private data around for IO
In reply to Marek VasutPass private data into IO accessors and use the base addresses of IO and DATA window from the private data instead of using the hard coded macros DM9000_IO/DM9000_DATA. Currently both the DM9000_IO and DM9000_DATA are assigned to the respecive private data fields for the non-DM case backward compatibility.
---
V2: - Add RB from Ramon
- Replace phys_addr_t usage with void __iomem * to fix build warning on mips
--- drivers/net/dm9000x.c | 230 ++++++++++++++++++++++-------------------- 1 file changed, 119 insertions(+), 111 deletions(-)
drivers/net/dm9000x.c +119 -111
@@ -71,10 +71,12 @@ struct dm9000_priv {u8 phy_addr;u8 device_wait_reset;/* device state */ unsigned char srom[128 ]; -void (*outblk)(void *data_ptr,int count); -void (*inblk)(void *data_ptr,int count); -void (*rx_status)(u16 *rxstatus,u16 *rxlen); +void (*outblk)(struct dm9000_priv *db,void *data_ptr,int count); +void (*inblk)(struct dm9000_priv *db,void *data_ptr,int count); +void (*rx_status)(struct dm9000_priv *db,u16 *rxstatus,u16 *rxlen);struct eth_device dev; +void __iomem *base_io; +void __iomem *base_data; };/* DM9000 network board routine ---------------------------- */
@@ -113,120 +115,121 @@ static void dm9000_dump_packet(const char *func, u8 *packet, int length)static void dm9000_dump_packet (const char *func,u8 *packet,int length) {}#endif -static void dm9000_outblk_8bit (void *data_ptr,int count) +static void dm9000_outblk_8bit (struct dm9000_priv *db,void *data_ptr,int count) {int i;for (i =0 ; i < count; i++) -dm9000_outb ((((u8 *)data_ptr)[i] &0xff ),DM9000_DATA ); +dm9000_outb ((((u8 *)data_ptr)[i] &0xff ), db->base_data); } -static void dm9000_outblk_16bit (void *data_ptr,int count) +static void dm9000_outblk_16bit (struct dm9000_priv *db,void *data_ptr,int count) {int i;u32 tmplen = (count +1 ) /2 ;for (i =0 ; i < tmplen; i++) -dm9000_outw (((u16 *)data_ptr)[i],DM9000_DATA ); +dm9000_outw (((u16 *)data_ptr)[i], db->base_data); } -static void dm9000_outblk_32bit (void *data_ptr,int count) +static void dm9000_outblk_32bit (struct dm9000_priv *db,void *data_ptr,int count) {int i;u32 tmplen = (count +3 ) /4 ;for (i =0 ; i < tmplen; i++) -dm9000_outl (((u32 *)data_ptr)[i],DM9000_DATA ); +dm9000_outl (((u32 *)data_ptr)[i], db->base_data); } -static void dm9000_inblk_8bit (void *data_ptr,int count) +static void dm9000_inblk_8bit (struct dm9000_priv *db,void *data_ptr,int count) {int i;for (i =0 ; i < count; i++) - ((u8 *)data_ptr)[i] =dm9000_inb (DM9000_DATA ); + ((u8 *)data_ptr)[i] =dm9000_inb (db->base_data); } -static void dm9000_inblk_16bit (void *data_ptr,int count) +static void dm9000_inblk_16bit (struct dm9000_priv *db,void *data_ptr,int count) {int i;u32 tmplen = (count +1 ) /2 ;for (i =0 ; i < tmplen; i++) - ((u16 *)data_ptr)[i] =dm9000_inw (DM9000_DATA ); + ((u16 *)data_ptr)[i] =dm9000_inw (db->base_data); } -static void dm9000_inblk_32bit (void *data_ptr,int count) +static void dm9000_inblk_32bit (struct dm9000_priv *db,void *data_ptr,int count) {int i;u32 tmplen = (count +3 ) /4 ;for (i =0 ; i < tmplen; i++) - ((u32 *)data_ptr)[i] =dm9000_inl (DM9000_DATA ); + ((u32 *)data_ptr)[i] =dm9000_inl (db->base_data); } -static void dm9000_rx_status_32bit (u16 *rxstatus,u16 *rxlen) +static void dm9000_rx_status_32bit (struct dm9000_priv *db,u16 *rxstatus,u16 *rxlen) {u32 tmpdata; -dm9000_outb (DM9000_MRCMD ,DM9000_IO ); +dm9000_outb (DM9000_MRCMD , db->base_io); - tmpdata =dm9000_inl (DM9000_DATA ); + tmpdata =dm9000_inl (db->base_data); *rxstatus =__le16_to_cpu (tmpdata); *rxlen =__le16_to_cpu (tmpdata >>16 ); } -static void dm9000_rx_status_16bit (u16 *rxstatus,u16 *rxlen) +static void dm9000_rx_status_16bit (struct dm9000_priv *db,u16 *rxstatus,u16 *rxlen) { -dm9000_outb (DM9000_MRCMD ,DM9000_IO ); +dm9000_outb (DM9000_MRCMD , db->base_io); - *rxstatus =__le16_to_cpu (dm9000_inw (DM9000_DATA )); - *rxlen =__le16_to_cpu (dm9000_inw (DM9000_DATA )); + *rxstatus =__le16_to_cpu (dm9000_inw (db->base_data)); + *rxlen =__le16_to_cpu (dm9000_inw (db->base_data)); } -static void dm9000_rx_status_8bit (u16 *rxstatus,u16 *rxlen) +static void dm9000_rx_status_8bit (struct dm9000_priv *db,u16 *rxstatus,u16 *rxlen) { -dm9000_outb (DM9000_MRCMD ,DM9000_IO ); +dm9000_outb (DM9000_MRCMD , db->base_io); *rxstatus = -__le16_to_cpu (dm9000_inb (DM9000_DATA ) + - (dm9000_inb (DM9000_DATA ) <<8 )); +__le16_to_cpu (dm9000_inb (db->base_data) + + (dm9000_inb (db->base_data) <<8 )); *rxlen = -__le16_to_cpu (dm9000_inb (DM9000_DATA ) + - (dm9000_inb (DM9000_DATA ) <<8 )); +__le16_to_cpu (dm9000_inb (db->base_data) + + (dm9000_inb (db->base_data) <<8 )); }/* * Read a byte from I/O port */ -static u8 dm9000_ior (int reg) +static u8 dm9000_ior (struct dm9000_priv *db,int reg) { -dm9000_outb (reg,DM9000_IO ); -return dm9000_inb (DM9000_DATA ); +dm9000_outb (reg, db->base_io); +return dm9000_inb (db->base_data); }/* * Write a byte to I/O port */ -static void dm9000_iow (int reg,u8 value) +static void dm9000_iow (struct dm9000_priv *db,int reg,u8 value) { -dm9000_outb (reg,DM9000_IO ); -dm9000_outb (value,DM9000_DATA ); +dm9000_outb (reg, db->base_io); +dm9000_outb (value, db->base_data); }/* * Read a word from phyxcer */ -static u16 dm9000_phy_read (int reg) +static u16 dm9000_phy_read (struct dm9000_priv *db,int reg) {u16 val;/* Fill the phyxcer register into REG_0C */ -dm9000_iow (DM9000_EPAR ,DM9000_PHY | reg); -dm9000_iow (DM9000_EPCR ,0xc );/* Issue phyxcer read command */ +dm9000_iow (db,DM9000_EPAR ,DM9000_PHY | reg); +dm9000_iow (db,DM9000_EPCR ,0xc );/* Issue phyxcer read command */ udelay (100 );/* Wait read complete */ -dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer read command */ - val = (dm9000_ior (DM9000_EPDRH ) <<8 ) |dm9000_ior (DM9000_EPDRL ); +dm9000_iow (db,DM9000_EPCR ,0x0 );/* Clear phyxcer read command */ + val = (dm9000_ior (db,DM9000_EPDRH ) <<8 ) | +dm9000_ior (db,DM9000_EPDRL );/* The read data keeps on REG_0D & REG_0E */ debug ("%s(0x%x): 0x%x\n" , __func__, reg, val);
@@ -236,44 +239,43 @@ static u16 dm9000_phy_read(int reg)/* * Write a word to phyxcer */ -static void dm9000_phy_write (int reg,u16 value) +static void dm9000_phy_write (struct dm9000_priv *db,int reg,u16 value) {/* Fill the phyxcer register into REG_0C */ -dm9000_iow (DM9000_EPAR ,DM9000_PHY | reg); +dm9000_iow (db,DM9000_EPAR ,DM9000_PHY | reg);/* Fill the written data into REG_0D & REG_0E */ -dm9000_iow (DM9000_EPDRL , (value &0xff )); -dm9000_iow (DM9000_EPDRH , ((value >>8 ) &0xff )); -dm9000_iow (DM9000_EPCR ,0xa );/* Issue phyxcer write command */ +dm9000_iow (db,DM9000_EPDRL , (value &0xff )); +dm9000_iow (db,DM9000_EPDRH , ((value >>8 ) &0xff )); +dm9000_iow (db,DM9000_EPCR ,0xa );/* Issue phyxcer write command */ udelay (500 );/* Wait write complete */ -dm9000_iow (DM9000_EPCR ,0x0 );/* Clear phyxcer write command */ +dm9000_iow (db,DM9000_EPCR ,0x0 );/* Clear phyxcer write command */ debug ("%s(reg:0x%x, value:0x%x)\n" , __func__, reg, value); }/* * Search DM9000 board, allocate space and register it */ -static int dm9000_probe (void ) +static int dm9000_probe (struct dm9000_priv *db) {u32 id_val; - id_val =dm9000_ior (DM9000_VIDL ); - id_val |=dm9000_ior (DM9000_VIDH ) <<8 ; - id_val |=dm9000_ior (DM9000_PIDL ) <<16 ; - id_val |=dm9000_ior (DM9000_PIDH ) <<24 ; + id_val =dm9000_ior (db,DM9000_VIDL ); + id_val |=dm9000_ior (db,DM9000_VIDH ) <<8 ; + id_val |=dm9000_ior (db,DM9000_PIDL ) <<16 ; + id_val |=dm9000_ior (db,DM9000_PIDH ) <<24 ;if (id_val !=DM9000_ID ) { -printf ("dm9000 not found at 0x%08x id: 0x%08x\n" , -CONFIG_DM9000_BASE , id_val); +printf ("dm9000 not found at 0x%p id: 0x%08x\n" , + db->base_io, id_val);return -1 ; } -printf ("dm9000 i/o: 0x%x, id: 0x%x\n" ,CONFIG_DM9000_BASE , id_val); +printf ("dm9000 i/o: 0x%p, id: 0x%x\n" , db->base_io, id_val);return 0 ; }/* General Purpose dm9000 reset routine */ -static void -dm9000_reset (void ) +static void dm9000_reset (struct dm9000_priv *db) {debug ("resetting DM9000\n" );
@@ -283,28 +285,28 @@ dm9000_reset(void)*/ /* DEBUG: Make all GPIO0 outputs, all others inputs */ -dm9000_iow (DM9000_GPCR ,GPCR_GPIO0_OUT ); +dm9000_iow (db,DM9000_GPCR ,GPCR_GPIO0_OUT );/* Step 1: Power internal PHY by writing 0 to GPIO0 pin */ -dm9000_iow (DM9000_GPR ,0 ); +dm9000_iow (db,DM9000_GPR ,0 );/* Step 2: Software reset */ -dm9000_iow (DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST )); +dm9000_iow (db,DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST ));do {debug ("resetting the DM9000, 1st reset\n" );udelay (25 );/* Wait at least 20 us */ - }while (dm9000_ior (DM9000_NCR ) &1 ); + }while (dm9000_ior (db,DM9000_NCR ) &1 ); -dm9000_iow (DM9000_NCR ,0 ); -dm9000_iow (DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST ));/* Issue a second reset */ +dm9000_iow (db,DM9000_NCR ,0 ); +dm9000_iow (db,DM9000_NCR , (NCR_LBK_INT_MAC |NCR_RST ));/* Issue a second reset */ do {debug ("resetting the DM9000, 2nd reset\n" );udelay (25 );/* Wait at least 20 us */ - }while (dm9000_ior (DM9000_NCR ) &1 ); + }while (dm9000_ior (db,DM9000_NCR ) &1 );/* Check whether the ethernet controller is present */ -if ((dm9000_ior (DM9000_PIDL ) !=0x0 ) || - (dm9000_ior (DM9000_PIDH ) !=0x90 )) +if ((dm9000_ior (db,DM9000_PIDL ) !=0x0 ) || + (dm9000_ior (db,DM9000_PIDH ) !=0x90 ))printf ("ERROR: resetting DM9000 -> not responding\n" ); }
@@ -316,13 +318,13 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)u8 io_mode;/* RESET device */ -dm9000_reset (); +dm9000_reset (db); -if (dm9000_probe () <0 ) +if (dm9000_probe (db) <0 )return -1 ;/* Auto-detect 8/16/32 bit mode, ISR Bit 6+7 indicate bus width */ - io_mode =dm9000_ior (DM9000_ISR ) >>6 ; + io_mode =dm9000_ior (db,DM9000_ISR ) >>6 ;switch (io_mode) {case 0x0 :/* 16-bit mode */
@@ -353,21 +355,21 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd) }/* Program operating register, only internal phy supported */ -dm9000_iow (DM9000_NCR ,0x0 ); +dm9000_iow (db,DM9000_NCR ,0x0 );/* TX Polling clear */ -dm9000_iow (DM9000_TCR ,0 ); +dm9000_iow (db,DM9000_TCR ,0 );/* Less 3Kb, 200us */ -dm9000_iow (DM9000_BPTR ,BPTR_BPHW (3 ) |BPTR_JPT_600US ); +dm9000_iow (db,DM9000_BPTR ,BPTR_BPHW (3 ) |BPTR_JPT_600US );/* Flow Control : High/Low Water */ -dm9000_iow (DM9000_FCTR ,FCTR_HWOT (3 ) |FCTR_LWOT (8 )); +dm9000_iow (db,DM9000_FCTR ,FCTR_HWOT (3 ) |FCTR_LWOT (8 ));/* SH FIXME: This looks strange! Flow Control */ -dm9000_iow (DM9000_FCR ,0x0 ); +dm9000_iow (db,DM9000_FCR ,0x0 );/* Special Mode */ -dm9000_iow (DM9000_SMCR ,0 ); +dm9000_iow (db,DM9000_SMCR ,0 );/* clear TX status */ -dm9000_iow (DM9000_NSR ,NSR_WAKEST |NSR_TX2END |NSR_TX1END ); +dm9000_iow (db,DM9000_NSR ,NSR_WAKEST |NSR_TX2END |NSR_TX1END );/* Clear interrupt status */ -dm9000_iow (DM9000_ISR ,ISR_ROOS |ISR_ROS |ISR_PTS |ISR_PRS ); +dm9000_iow (db,DM9000_ISR ,ISR_ROOS |ISR_ROS |ISR_PTS |ISR_PRS );printf ("MAC: %pM\n" , dev->enetaddr);if (!is_valid_ethaddr (dev->enetaddr))
@@ -375,23 +377,23 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)/* fill device MAC address registers */ for (i =0 , oft =DM9000_PAR ; i <6 ; i++, oft++) -dm9000_iow (oft, dev->enetaddr[i]); +dm9000_iow (db, oft, dev->enetaddr[i]);for (i =0 , oft =0x16 ; i <8 ; i++, oft++) -dm9000_iow (oft,0xff ); +dm9000_iow (db, oft,0xff );/* read back mac, just to be sure */ for (i =0 , oft =0x10 ; i <6 ; i++, oft++) -debug ("%02x:" ,dm9000_ior (oft)); +debug ("%02x:" ,dm9000_ior (db, oft));debug ("\n" );/* Activate DM9000 */ /* RX enable */ -dm9000_iow (DM9000_RCR ,RCR_DIS_LONG |RCR_DIS_CRC |RCR_RXEN ); +dm9000_iow (db,DM9000_RCR ,RCR_DIS_LONG |RCR_DIS_CRC |RCR_RXEN );/* Enable TX/RX interrupt mask */ -dm9000_iow (DM9000_IMR ,IMR_PAR ); +dm9000_iow (db,DM9000_IMR ,IMR_PAR ); i =0 ; -while (!(dm9000_phy_read (1 ) &0x20 )) {/* autonegation complete bit */ +while (!(dm9000_phy_read (db,1 ) &0x20 )) {/* autonegation complete bit */ udelay (1000 ); i++;if (i ==10000 ) {
@@ -401,7 +403,7 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd) }/* see what we've got */ - lnk =dm9000_phy_read (17 ) >>12 ; + lnk =dm9000_phy_read (db,17 ) >>12 ;printf ("operating at " );switch (lnk) {case 1 :
@@ -435,31 +437,31 @@ static int dm9000_send(struct eth_device *dev, void *packet, int length)dm9000_dump_packet (__func__, packet, length); -dm9000_iow (DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */ +dm9000_iow (db,DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */ /* Move data to DM9000 TX RAM */ -dm9000_outb (DM9000_MWCMD ,DM9000_IO );/* Prepare for TX-data */ +dm9000_outb (DM9000_MWCMD , db->base_io);/* Prepare for TX-data */ /* push the data to the TX-fifo */ - db->outblk (packet, length); + db->outblk (db, packet, length);/* Set TX length to DM9000 */ -dm9000_iow (DM9000_TXPLL , length &0xff ); -dm9000_iow (DM9000_TXPLH , (length >>8 ) &0xff ); +dm9000_iow (db,DM9000_TXPLL , length &0xff ); +dm9000_iow (db,DM9000_TXPLH , (length >>8 ) &0xff );/* Issue TX polling command */ -dm9000_iow (DM9000_TCR ,TCR_TXREQ );/* Cleared after TX complete */ +dm9000_iow (db,DM9000_TCR ,TCR_TXREQ );/* Cleared after TX complete */ /* wait for end of transmission */ tmo =get_timer (0 ) +5 *CONFIG_SYS_HZ ; -while (!(dm9000_ior (DM9000_NSR ) & (NSR_TX1END |NSR_TX2END )) || - !(dm9000_ior (DM9000_ISR ) &IMR_PTM )) { +while (!(dm9000_ior (db,DM9000_NSR ) & (NSR_TX1END |NSR_TX2END )) || + !(dm9000_ior (db,DM9000_ISR ) &IMR_PTM )) {if (get_timer (0 ) >= tmo) {printf ("transmission timeout\n" );break ; } } -dm9000_iow (DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */ +dm9000_iow (db,DM9000_ISR ,IMR_PTM );/* Clear Tx bit in ISR */ debug ("transmit done\n\n" );return 0 ;
@@ -471,11 +473,13 @@ static int dm9000_send(struct eth_device *dev, void *packet, int length)*/ static void dm9000_halt (struct eth_device *netdev) { + struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev); +/* RESET device */ -dm9000_phy_write (0 ,0x8000 );/* PHY RESET */ -dm9000_iow (DM9000_GPR ,0x01 );/* Power-Down PHY */ -dm9000_iow (DM9000_IMR ,0x80 );/* Disable all interrupt */ -dm9000_iow (DM9000_RCR ,0x00 );/* Disable RX */ +dm9000_phy_write (db,0 ,0x8000 );/* PHY RESET */ +dm9000_iow (db,DM9000_GPR ,0x01 );/* Power-Down PHY */ +dm9000_iow (db,DM9000_IMR ,0x80 );/* Disable all interrupt */ +dm9000_iow (db,DM9000_RCR ,0x00 );/* Disable RX */ }/*
@@ -492,25 +496,25 @@ static int dm9000_rx(struct eth_device *dev)* Check packet ready or not, we must check * the ISR status first for DM9000A */ -if (!(dm9000_ior (DM9000_ISR ) &0x01 ))/* Rx-ISR bit must be set. */ +if (!(dm9000_ior (db,DM9000_ISR ) &0x01 ))/* Rx-ISR bit must be set. */ return 0 ; -dm9000_iow (DM9000_ISR ,0x01 );/* clear PR status latched in bit 0 */ +dm9000_iow (db,DM9000_ISR ,0x01 );/* clear PR status latched in bit 0 */ /* There is _at least_ 1 package in the fifo, read them all */ for (;;) { -dm9000_ior (DM9000_MRCMDX );/* Dummy read */ +dm9000_ior (db,DM9000_MRCMDX );/* Dummy read */ /* * Get most updated data, * only look at bits 0:1, See application notes DM9000 */ - rxbyte =dm9000_inb (DM9000_DATA ) &0x03 ; + rxbyte =dm9000_inb (db->base_data) &0x03 ;/* Status check: this byte must be 0 or 1 */ if (rxbyte >DM9000_PKT_RDY ) { -dm9000_iow (DM9000_RCR ,0x00 );/* Stop Device */ -dm9000_iow (DM9000_ISR ,0x80 );/* Stop INT request */ +dm9000_iow (db,DM9000_RCR ,0x00 );/* Stop Device */ +dm9000_iow (db,DM9000_ISR ,0x80 );/* Stop INT request */ printf ("DM9000 error: status check fail: 0x%x\n" , rxbyte);return 0 ;
@@ -522,13 +526,13 @@ static int dm9000_rx(struct eth_device *dev)debug ("receiving packet\n" );/* A packet ready now & Get status/length */ - db->rx_status (&rxstatus, &rxlen); + db->rx_status (db, &rxstatus, &rxlen);debug ("rx status: 0x%04x rx len: %d\n" , rxstatus, rxlen);/* Move data from DM9000 */ /* Read received packet from RX SRAM */ - db->inblk (rdptr, rxlen); + db->inblk (db, rdptr, rxlen);if (rxstatus &0xbf00 || rxlen <0x40 || rxlen >DM9000_PKT_MAX ) {
@@ -540,7 +544,7 @@ static int dm9000_rx(struct eth_device *dev)printf ("rx length error\n" );if (rxlen >DM9000_PKT_MAX ) {printf ("rx length too big\n" ); -dm9000_reset (); +dm9000_reset (db); } }else {dm9000_dump_packet (__func__, rdptr, rxlen);
@@ -556,22 +560,23 @@ static int dm9000_rx(struct eth_device *dev)* Read a word data from SROM */ #if !defined(CONFIG_DM9000_NO_SROM ) -static void dm9000_read_srom_word (int offset,u8 *to) +static void dm9000_read_srom_word (struct dm9000_priv *db,int offset,u8 *to) { -dm9000_iow (DM9000_EPAR , offset); -dm9000_iow (DM9000_EPCR ,0x4 ); +dm9000_iow (db,DM9000_EPAR , offset); +dm9000_iow (db,DM9000_EPCR ,0x4 );mdelay (8 ); -dm9000_iow (DM9000_EPCR ,0x0 ); - to[0 ] =dm9000_ior (DM9000_EPDRL ); - to[1 ] =dm9000_ior (DM9000_EPDRH ); +dm9000_iow (db,DM9000_EPCR ,0x0 ); + to[0 ] =dm9000_ior (db,DM9000_EPDRL ); + to[1 ] =dm9000_ior (db,DM9000_EPDRH ); }static void dm9000_get_enetaddr (struct eth_device *dev) { + struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev);int i;for (i =0 ; i <3 ; i++) -dm9000_read_srom_word (i, dev->enetaddr + (2 * i)); +dm9000_read_srom_word (db, i, dev->enetaddr + (2 * i)); }#else static void dm9000_get_enetaddr (struct eth_device *dev) {}
@@ -588,6 +593,9 @@ int dm9000_initialize(struct bd_info *bis) dev = &priv->dev; + priv->base_io = (void __iomem *)DM9000_IO ; + priv->base_data = (void __iomem *)DM9000_DATA ; +/* Load MAC address from EEPROM */ dm9000_get_enetaddr (&priv->dev);
Signature · 1 line
2.35.1
PATCH v2 13/17 net: dm9000: Split non-DM specific bits from common code
In reply to Marek VasutSplit network handling functions into non-DM specific parts and common code in preparation for conversion to DM.
---
V2: - Add RB from Ramon
- Ignore return value of dm9000_halt_common(), the function is static void dm9000_halt_common(struct dm9000_priv *db) so it returns nothing. Fix dm9000_halt() function prototype.
--- drivers/net/dm9000x.c | 58 +++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 18 deletions(-)
drivers/net/dm9000x.c +40 -18
@@ -311,9 +311,8 @@ static void dm9000_reset(struct dm9000_priv *db) }/* Initialize dm9000 board */ -static int dm9000_init (struct eth_device *dev,struct bd_info *bd) +static int dm9000_init_common (struct dm9000_priv *db,u8 enetaddr[6 ]) { - struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev);int i, oft, lnk;u8 io_mode;
@@ -371,13 +370,13 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)/* Clear interrupt status */ dm9000_iow (db,DM9000_ISR ,ISR_ROOS |ISR_ROS |ISR_PTS |ISR_PRS ); -printf ("MAC: %pM\n" , dev->enetaddr); -if (!is_valid_ethaddr (dev->enetaddr)) +printf ("MAC: %pM\n" , enetaddr); +if (!is_valid_ethaddr (enetaddr))printf ("WARNING: Bad MAC address (uninitialized EEPROM?)\n" );/* fill device MAC address registers */ for (i =0 , oft =DM9000_PAR ; i <6 ; i++, oft++) -dm9000_iow (db, oft, dev->enetaddr[i]); +dm9000_iow (db, oft, enetaddr[i]);for (i =0 , oft =0x16 ; i <8 ; i++, oft++)dm9000_iow (db, oft,0xff );
@@ -430,9 +429,8 @@ static int dm9000_init(struct eth_device *dev, struct bd_info *bd)* Hardware start transmission. * Send a packet to media from the upper layer. */ -static int dm9000_send (struct eth_device *dev,void *packet,int length) +static int dm9000_send_common (struct dm9000_priv *db,void *packet,int length) { - struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev);int tmo;dm9000_dump_packet (__func__, packet, length);
@@ -471,10 +469,8 @@ static int dm9000_send(struct eth_device *dev, void *packet, int length)* Stop the interface. * The interface is stopped when it is brought. */ -static void dm9000_halt (struct eth_device *netdev) +static void dm9000_halt_common (struct dm9000_priv *db) { - struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev); -/* RESET device */ dm9000_phy_write (db,0 ,0x8000 );/* PHY RESET */ dm9000_iow (db,DM9000_GPR ,0x01 );/* Power-Down PHY */
@@ -485,9 +481,8 @@ static void dm9000_halt(struct eth_device *netdev)/* * Received a packet and pass to upper layer */ -static int dm9000_rx (struct eth_device *dev) +static int dm9000_recv_common (struct dm9000_priv *db) { - struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev);u8 rxbyte;u8 *rdptr = (u8 *)net_rx_packets[0 ];u16 rxstatus, rxlen =0 ;
@@ -570,18 +565,45 @@ static void dm9000_read_srom_word(struct dm9000_priv *db, int offset, u8 *to) to[1 ] =dm9000_ior (db,DM9000_EPDRH ); } -static void dm9000_get_enetaddr (struct eth_device *dev) +static void dm9000_get_enetaddr (struct dm9000_priv *db,u8 *enetaddr) { - struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev);int i;for (i =0 ; i <3 ; i++) -dm9000_read_srom_word (db, i, dev->enetaddr + (2 * i)); +dm9000_read_srom_word (db, i, enetaddr + (2 * i)); }#else -static void dm9000_get_enetaddr (struct eth_device *dev) {} +static void dm9000_get_enetaddr (struct dm9000_priv *db,u8 *enetaddr) {}#endif +static int dm9000_init (struct eth_device *dev,struct bd_info *bd) +{ + struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev); + +return dm9000_init_common (db, dev->enetaddr); +} + +static void dm9000_halt (struct eth_device *dev) +{ + struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev); + +dm9000_halt_common (db); +} + +static int dm9000_send (struct eth_device *dev,void *packet,int length) +{ + struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev); + +return dm9000_send_common (db, packet, length); +} + +static int dm9000_recv (struct eth_device *dev) +{ + struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev); + +return dm9000_recv_common (db); +} +int dm9000_initialize (struct bd_info *bis) {struct dm9000_priv *priv;
@@ -597,12 +619,12 @@ int dm9000_initialize(struct bd_info *bis) priv->base_data = (void __iomem *)DM9000_DATA ;/* Load MAC address from EEPROM */ -dm9000_get_enetaddr (&priv->dev); +dm9000_get_enetaddr (priv, dev->enetaddr); dev->init = dm9000_init; dev->halt = dm9000_halt; dev->send = dm9000_send; - dev->recv = dm9000_rx; + dev->recv = dm9000_recv;strcpy (dev->name,"dm9000" );eth_register (&priv->dev);
Signature · 1 line
2.35.1
PATCH v2 14/17 net: dm9000: Receive one packet per recv call
In reply to Marek VasutInstead of reading out the entire FIFO and possibly overwriting U-Boot memory, read out one packet per recv call, pass it to U-Boot network stack, and repeat.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 102 +++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 52 deletions(-)
drivers/net/dm9000x.c +50 -52
@@ -481,10 +481,9 @@ static void dm9000_halt_common(struct dm9000_priv *db)/* * Received a packet and pass to upper layer */ -static int dm9000_recv_common (struct dm9000_priv *db) +static int dm9000_recv_common (struct dm9000_priv *db,uchar *rdptr) {u8 rxbyte; -u8 *rdptr = (u8 *)net_rx_packets[0 ];u16 rxstatus, rxlen =0 ;/*
@@ -497,58 +496,52 @@ static int dm9000_recv_common(struct dm9000_priv *db)dm9000_iow (db,DM9000_ISR ,0x01 );/* clear PR status latched in bit 0 */ /* There is _at least_ 1 package in the fifo, read them all */ -for (;;) { -dm9000_ior (db,DM9000_MRCMDX );/* Dummy read */ - -/* -* Get most updated data, -* only look at bits 0:1, See application notes DM9000 -*/ - rxbyte =dm9000_inb (db->base_data) &0x03 ; - -/* Status check: this byte must be 0 or 1 */ -if (rxbyte >DM9000_PKT_RDY ) { -dm9000_iow (db,DM9000_RCR ,0x00 );/* Stop Device */ -dm9000_iow (db,DM9000_ISR ,0x80 );/* Stop INT request */ -printf ("DM9000 error: status check fail: 0x%x\n" , - rxbyte); -return 0 ; - } +dm9000_ior (db,DM9000_MRCMDX );/* Dummy read */ + +/* +* Get most updated data, +* only look at bits 0:1, See application notes DM9000 +*/ + rxbyte =dm9000_inb (db->base_data) &0x03 ; + +/* Status check: this byte must be 0 or 1 */ +if (rxbyte >DM9000_PKT_RDY ) { +dm9000_iow (db,DM9000_RCR ,0x00 );/* Stop Device */ +dm9000_iow (db,DM9000_ISR ,0x80 );/* Stop INT request */ +printf ("DM9000 error: status check fail: 0x%x\n" , + rxbyte); +return -EINVAL ; + } + +if (rxbyte !=DM9000_PKT_RDY ) +return 0 ;/* No packet received, ignore */ -if (rxbyte !=DM9000_PKT_RDY ) -return 0 ;/* No packet received, ignore */ - -debug ("receiving packet\n" ); - -/* A packet ready now & Get status/length */ - db->rx_status (db, &rxstatus, &rxlen); - -debug ("rx status: 0x%04x rx len: %d\n" , rxstatus, rxlen); - -/* Move data from DM9000 */ -/* Read received packet from RX SRAM */ - db->inblk (db, rdptr, rxlen); - -if (rxstatus &0xbf00 || rxlen <0x40 || - rxlen >DM9000_PKT_MAX ) { -if (rxstatus &0x100 ) -printf ("rx fifo error\n" ); -if (rxstatus &0x200 ) -printf ("rx crc error\n" ); -if (rxstatus &0x8000 ) -printf ("rx length error\n" ); -if (rxlen >DM9000_PKT_MAX ) { -printf ("rx length too big\n" ); -dm9000_reset (db); - } - }else { -dm9000_dump_packet (__func__, rdptr, rxlen); - -debug ("passing packet to upper layer\n" ); -net_process_received_packet (net_rx_packets[0 ], rxlen); +debug ("receiving packet\n" ); + +/* A packet ready now & Get status/length */ + db->rx_status (db, &rxstatus, &rxlen); + +debug ("rx status: 0x%04x rx len: %d\n" , rxstatus, rxlen); + +/* Move data from DM9000 */ +/* Read received packet from RX SRAM */ + db->inblk (db, rdptr, rxlen); + +if (rxstatus &0xbf00 || rxlen <0x40 || rxlen >DM9000_PKT_MAX ) { +if (rxstatus &0x100 ) +printf ("rx fifo error\n" ); +if (rxstatus &0x200 ) +printf ("rx crc error\n" ); +if (rxstatus &0x8000 ) +printf ("rx length error\n" ); +if (rxlen >DM9000_PKT_MAX ) { +printf ("rx length too big\n" ); +dm9000_reset (db); } +return -EINVAL ; } -return 0 ; + +return rxlen; }/*
@@ -600,8 +593,13 @@ static int dm9000_send(struct eth_device *dev, void *packet, int length)static int dm9000_recv (struct eth_device *dev) { struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev); +int ret; + + ret =dm9000_recv_common (db, net_rx_packets[0 ]); +if (ret >0 ) +net_process_received_packet (net_rx_packets[0 ], ret); -return dm9000_recv_common (db); +return ret; }int dm9000_initialize (struct bd_info *bis)
Signature · 1 line
2.35.1
PATCH v2 15/17 net: dm9000: Add DM support
In reply to Marek VasutAdd support for U-Boot DM and DT probing.
---
V2: Add RB from Ramon
--- drivers/net/dm9000x.c | 118 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)
drivers/net/dm9000x.c +118 -0
@@ -51,6 +51,7 @@#include <common.h> #include <command.h> +#include <dm.h> #include <malloc.h> #include <net.h> #include <asm/io.h>
@@ -74,7 +75,9 @@ struct dm9000_priv {void (*outblk)(struct dm9000_priv *db,void *data_ptr,int count);void (*inblk)(struct dm9000_priv *db,void *data_ptr,int count);void (*rx_status)(struct dm9000_priv *db,u16 *rxstatus,u16 *rxlen); +#ifndef CONFIG_DM_ETH struct eth_device dev; +#endif void __iomem *base_io;void __iomem *base_data; };
@@ -569,6 +572,7 @@ static void dm9000_get_enetaddr(struct dm9000_priv *db, u8 *enetaddr)static void dm9000_get_enetaddr (struct dm9000_priv *db,u8 *enetaddr) {}#endif +#ifndef CONFIG_DM_ETH static int dm9000_init (struct eth_device *dev,struct bd_info *bd) { struct dm9000_priv *db = container_of(dev, struct dm9000_priv, dev);
@@ -629,3 +633,117 @@ int dm9000_initialize(struct bd_info *bis)return 0 ; } +#else /* ifdef CONFIG_DM_ETH */ +static int dm9000_start (struct udevice *dev) +{ +struct dm9000_priv *db =dev_get_priv (dev); +struct eth_pdata *pdata =dev_get_plat (dev); + +return dm9000_init_common (db, pdata->enetaddr); +} + +static void dm9000_stop (struct udevice *dev) +{ +struct dm9000_priv *db =dev_get_priv (dev); + +dm9000_halt_common (db); +} + +static int dm9000_send (struct udevice *dev,void *packet,int length) +{ +struct dm9000_priv *db =dev_get_priv (dev); +int ret; + + ret =dm9000_send_common (db, packet, length); + +return ret ?0 : -ETIMEDOUT ; +} + +static int dm9000_recv (struct udevice *dev,int flags,uchar **packetp) +{ +struct dm9000_priv *db =dev_get_priv (dev); +uchar *data = net_rx_packets[0 ]; +int ret; + + ret =dm9000_recv_common (db, data); +if (ret) + *packetp = (void *)data; + +return ret ? ret : -EAGAIN ; +} + +static int dm9000_write_hwaddr (struct udevice *dev) +{ +struct dm9000_priv *db =dev_get_priv (dev); +struct eth_pdata *pdata =dev_get_plat (dev); +int i, oft; + +/* fill device MAC address registers */ +for (i =0 , oft =DM9000_PAR ; i <6 ; i++, oft++) +dm9000_iow (db, oft, pdata->enetaddr[i]); + +for (i =0 , oft =0x16 ; i <8 ; i++, oft++) +dm9000_iow (db, oft,0xff ); + +/* read back mac, just to be sure */ +for (i =0 , oft =0x10 ; i <6 ; i++, oft++) +debug ("%02x:" ,dm9000_ior (db, oft)); + +debug ("\n" ); + +return 0 ; +} + +static int dm9000_read_rom_hwaddr (struct udevice *dev) +{ +struct dm9000_priv *db =dev_get_priv (dev); +struct eth_pdata *pdata =dev_get_plat (dev); + +dm9000_get_enetaddr (db, pdata->enetaddr); + +return !is_valid_ethaddr (pdata->enetaddr); +} + +static int dm9000_bind (struct udevice *dev) +{ +return device_set_name (dev, dev->name); +} + +static int dm9000_of_to_plat (struct udevice *dev) +{ +struct dm9000_priv *db =dev_get_priv (dev); +struct eth_pdata *pdata =dev_get_plat (dev); + + pdata->iobase =dev_read_addr_index (dev,0 ); + db->base_io = (void __iomem *)pdata->iobase; + db->base_data = (void __iomem *)dev_read_addr_index (dev,1 ); + +return 0 ; +} + +static const struct eth_ops dm9000_ops = { + .start = dm9000_start, + .stop = dm9000_stop, + .send = dm9000_send, + .recv = dm9000_recv, + .write_hwaddr = dm9000_write_hwaddr, + .read_rom_hwaddr = dm9000_read_rom_hwaddr, +}; + +static const struct udevice_id dm9000_ids[] = { + { .compatible ="davicom,dm9000" }, + { } +}; + +U_BOOT_DRIVER (dm9000) = { + .name ="eth_dm9000" , + .id =UCLASS_ETH , + .of_match = dm9000_ids, + .bind = dm9000_bind, + .of_to_plat = dm9000_of_to_plat, + .ops = &dm9000_ops, + .priv_auto =sizeof (struct dm9000_priv ), + .plat_auto =sizeof (struct eth_pdata ), + .flags =DM_FLAG_ALLOC_PRIV_DMA , +}; +#endif
Signature · 1 line
2.35.1
PATCH v2 16/17 net: dm9000: Add Kconfig entry
In reply to Marek VasutAdd Kconfig entry for the DM9000 MAC.
---
V2: Add RB from Ramon
--- drivers/net/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/Kconfig +5 -0
@@ -191,6 +191,11 @@ config CALXEDA_XGMAC This driver supports the XGMAC in Calxeda Highbank and Midway machines. +config DRIVER_DM9000 + bool "Davicom DM9000 controller driver" + help + The Davicom DM9000 parallel bus external ethernet interface chip. + config DWC_ETH_QOS bool "Synopsys DWC Ethernet QOS device support" depends on DM_ETH
Signature · 1 line
2.35.1
PATCH v2 17/17 configs: net: dm9000: Move new Kconfig option to board configs
In reply to Marek VasutDrop legacy #define CONFIG_DRIVER_DM9000 from board include/configs/ and enable the same in Kconfig configs/ .
---
V2: New patch
--- configs/M5253DEMO_defconfig | 1 + configs/at91sam9261ek_dataflash_cs0_defconfig | 1 + configs/at91sam9261ek_dataflash_cs3_defconfig | 1 + configs/at91sam9261ek_nandflash_defconfig | 1 + configs/ci20_mmc_defconfig | 1 + configs/colibri_pxa270_defconfig | 1 + configs/devkit8000_defconfig | 1 + include/configs/M5253DEMO.h | 1 - include/configs/at91sam9261ek.h | 1 - include/configs/ci20.h | 1 - include/configs/colibri_pxa270.h | 1 - include/configs/devkit8000.h | 1 - scripts/config_whitelist.txt | 1 - 13 files changed, 7 insertions(+), 6 deletions(-)
configs/M5253DEMO_defconfig +1 -0
@@ -37,4 +37,5 @@ CONFIG_SYS_I2C_SLAVE=0x7F CONFIG_SYS_I2C_SPEED=80000 CONFIG_MTD_NOR_FLASH=y CONFIG_USE_SYS_MAX_FLASH_BANKS=y +CONFIG_DRIVER_DM9000=y CONFIG_MCFUART=y
configs/at91sam9261ek_dataflash_cs0_defconfig +1 -0
@@ -53,6 +53,7 @@ CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_DRIVER_DM9000=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y
configs/at91sam9261ek_dataflash_cs3_defconfig +1 -0
@@ -53,6 +53,7 @@ CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_DRIVER_DM9000=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y
configs/at91sam9261ek_nandflash_defconfig +1 -0
@@ -51,6 +51,7 @@ CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_DRIVER_DM9000=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y
configs/ci20_mmc_defconfig +1 -0
@@ -49,6 +49,7 @@ CONFIG_MMC_UHS_SUPPORT=y CONFIG_MMC_HS400_SUPPORT=y # CONFIG_MMC_VERBOSE is not set CONFIG_JZ47XX_MMC=y +CONFIG_DRIVER_DM9000=y CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y CONFIG_SPL_TINY_MEMSET=y
configs/colibri_pxa270_defconfig +1 -0
@@ -50,6 +50,7 @@ CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y CONFIG_SYS_FLASH_PROTECTION=y CONFIG_SYS_FLASH_CFI=y +CONFIG_DRIVER_DM9000=y CONFIG_DM_SERIAL=y CONFIG_PXA_SERIAL=y CONFIG_USB=y
configs/devkit8000_defconfig +1 -0
@@ -57,6 +57,7 @@ CONFIG_SYS_NAND_OOBSIZE=0x40 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000 +CONFIG_DRIVER_DM9000=y CONFIG_CONS_INDEX=3 CONFIG_JFFS2_NAND=y CONFIG_OF_LIBFDT=y
include/configs/M5253DEMO.h +0 -1
@@ -25,7 +25,6 @@# undef CONFIG_LBA48#endif -#define CONFIG_DRIVER_DM9000 #ifdef CONFIG_DRIVER_DM9000 # define CONFIG_DM9000_BASE (CONFIG_SYS_CS1_BASE | 0x300)# define DM9000_IO CONFIG_DM9000_BASE
include/configs/at91sam9261ek.h +0 -1
@@ -44,7 +44,6 @@#endif /* Ethernet */ -#define CONFIG_DRIVER_DM9000 #define CONFIG_DM9000_BASE 0x30000000#define DM9000_IO CONFIG_DM9000_BASE#define DM9000_DATA (CONFIG_DM9000_BASE + 4)
include/configs/ci20.h +0 -1
@@ -24,7 +24,6 @@#define CONFIG_SYS_NS16550_CLK 48000000/* Ethernet: davicom DM9000 */ -#define CONFIG_DRIVER_DM9000 1#define CONFIG_DM9000_BASE 0xb6000000#define DM9000_IO CONFIG_DM9000_BASE#define DM9000_DATA (CONFIG_DM9000_BASE + 2)
include/configs/colibri_pxa270.h +0 -1
@@ -43,7 +43,6 @@*/ #ifdef CONFIG_CMD_NET -#define CONFIG_DRIVER_DM9000 1#define CONFIG_DM9000_BASE 0x08000000#define DM9000_IO (CONFIG_DM9000_BASE)#define DM9000_DATA (CONFIG_DM9000_BASE + 4)
include/configs/devkit8000.h +0 -1
@@ -35,7 +35,6 @@/* Hardware drivers */ /* DM9000 */ -#define CONFIG_DRIVER_DM9000 1#define CONFIG_DM9000_BASE 0x2c000000#define DM9000_IO CONFIG_DM9000_BASE#define DM9000_DATA (CONFIG_DM9000_BASE + 0x400)
scripts/config_whitelist.txt +0 -1
@@ -25,7 +25,6 @@ CONFIG_DM9000_DEBUG CONFIG_DM9000_NO_SROM CONFIG_DM9000_USE_16BIT CONFIG_DP_DDR_DIMM_SLOTS_PER_CTLR -CONFIG_DRIVER_DM9000 CONFIG_DSP_CLUSTER_START CONFIG_DWC_AHSATA_BASE_ADDR CONFIG_DWC_AHSATA_PORT_ID
Signature · 1 line
2.35.1
Re: [PATCH v2 17/17] configs: net: dm9000: Move new Kconfig option to board configs
Quoted 180 lines · Marek Vasut
Drop legacy #define
CONFIG_DRIVER_DM9000from boardinclude/configs/and enable the same inKconfigconfigs/ .Signed-off-by Marek Vasut <[email protected]>Cc Joe Hershberger <[email protected]>Cc Ramon Fried <[email protected]>---
V2: New patch--- configs/M5253DEMO_defconfig | 1 + configs/at91sam9261ek_dataflash_cs0_defconfig | 1 + configs/at91sam9261ek_dataflash_cs3_defconfig | 1 + configs/at91sam9261ek_nandflash_defconfig | 1 + configs/ci20_mmc_defconfig | 1 + configs/colibri_pxa270_defconfig | 1 + configs/devkit8000_defconfig | 1 + include/configs/M5253DEMO.h | 1 - include/configs/at91sam9261ek.h | 1 - include/configs/ci20.h | 1 - include/configs/colibri_pxa270.h | 1 - include/configs/devkit8000.h | 1 - scripts/config_whitelist.txt | 1 - 13 files changed, 7 insertions(+), 6 deletions(-)configs/M5253DEMO_defconfig +1
-0@@ -37,4 +37,5 @@ CONFIG_SYS_I2C_SLAVE=0x7F CONFIG_SYS_I2C_SPEED=80000 CONFIG_MTD_NOR_FLASH=y CONFIG_USE_SYS_MAX_FLASH_BANKS=y +CONFIG_DRIVER_DM9000=y CONFIG_MCFUART=yconfigs/at91sam9261ek_dataflash_cs0_defconfig +1
-0@@ -53,6 +53,7 @@ CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_DRIVER_DM9000=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=yconfigs/at91sam9261ek_dataflash_cs3_defconfig +1
-0@@ -53,6 +53,7 @@ CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_DRIVER_DM9000=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=yconfigs/at91sam9261ek_nandflash_defconfig +1
-0@@ -51,6 +51,7 @@ CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_DRIVER_DM9000=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=yconfigs/ci20_mmc_defconfig +1
-0@@ -49,6 +49,7 @@ CONFIG_MMC_UHS_SUPPORT=y CONFIG_MMC_HS400_SUPPORT=y # CONFIG_MMC_VERBOSE is not set CONFIG_JZ47XX_MMC=y +CONFIG_DRIVER_DM9000=y CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y CONFIG_SPL_TINY_MEMSET=yconfigs/colibri_pxa270_defconfig +1
-0@@ -50,6 +50,7 @@ CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y CONFIG_SYS_FLASH_PROTECTION=y CONFIG_SYS_FLASH_CFI=y +CONFIG_DRIVER_DM9000=y CONFIG_DM_SERIAL=y CONFIG_PXA_SERIAL=y CONFIG_USB=yconfigs/devkit8000_defconfig +1
-0@@ -57,6 +57,7 @@ CONFIG_SYS_NAND_OOBSIZE=0x40 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000 +CONFIG_DRIVER_DM9000=y CONFIG_CONS_INDEX=3 CONFIG_JFFS2_NAND=y CONFIG_OF_LIBFDT=yinclude/configs/M5253DEMO.h +0
-1@@ -25,7 +25,6 @@# undef CONFIG_LBA48#endif -#define CONFIG_DRIVER_DM9000 #ifdef CONFIG_DRIVER_DM9000 # define CONFIG_DM9000_BASE (CONFIG_SYS_CS1_BASE | 0x300)# define DM9000_IO CONFIG_DM9000_BASEinclude/configs/at91sam9261ek.h +0
-1@@ -44,7 +44,6 @@#endif /* Ethernet */ -#define CONFIG_DRIVER_DM9000 #define CONFIG_DM9000_BASE 0x30000000#define DM9000_IO CONFIG_DM9000_BASE#define DM9000_DATA (CONFIG_DM9000_BASE + 4)include/configs/ci20.h +0
-1@@ -24,7 +24,6 @@#define CONFIG_SYS_NS16550_CLK 48000000/* Ethernet: davicom DM9000 */ -#define CONFIG_DRIVER_DM9000 1#define CONFIG_DM9000_BASE 0xb6000000#define DM9000_IO CONFIG_DM9000_BASE#define DM9000_DATA (CONFIG_DM9000_BASE + 2)include/configs/colibri_pxa270.h +0
-1@@ -43,7 +43,6 @@*/ #ifdef CONFIG_CMD_NET -#define CONFIG_DRIVER_DM9000 1#define CONFIG_DM9000_BASE 0x08000000#define DM9000_IO (CONFIG_DM9000_BASE)#define DM9000_DATA (CONFIG_DM9000_BASE + 4)include/configs/devkit8000.h +0
-1@@ -35,7 +35,6 @@/* Hardware drivers */ /* DM9000 */ -#define CONFIG_DRIVER_DM9000 1#define CONFIG_DM9000_BASE 0x2c000000#define DM9000_IO CONFIG_DM9000_BASE#define DM9000_DATA (CONFIG_DM9000_BASE + 0x400)scripts/config_whitelist.txt +0
-2@@ -25,7 +25,6 @@ CONFIG_DM9000_DEBUG CONFIG_DM9000_NO_SROM CONFIG_DM9000_USE_16BIT CONFIG_DP_DDR_DIMM_SLOTS_PER_CTLR -CONFIG_DRIVER_DM9000 CONFIG_DSP_CLUSTER_START CONFIG_DWC_AHSATA_BASE_ADDR CONFIG_DWC_AHSATA_PORT_ID --
Quoted 2 lines
2.35.1