source: trunk/target/linux/pxa/patches/004-smsc911x_verdex_pro_support.patch @ 19562

Last change on this file since 19562 was 19562, checked in by kaloz, 7 years ago

[pxa]: upgrade to 2.6.32.7, switch to squashfs, remove broken flag

File size: 3.5 KB
  • drivers/net/smsc911x.c

    From 7645a459feb02f7aae4c3a5724b7800495d1b659 Mon Sep 17 00:00:00 2001
    From: Bobby Powers <bobbypowers@gmail.com>
    Date: Wed, 28 Oct 2009 22:41:31 -0400
    Subject: [PATCH] [ARM] smsc911x: Verdex Pro support
    
    Basically Joseph Kortje's patch, cleaned up to apply to Linus's
    tree.  Some of the smsc911x.c had been applied already
    
    Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
    ---
     drivers/net/smsc911x.c   |   50 +++++++++++++++++++++++++++++++++++++--------
     drivers/net/smsc911x.h   |    2 +-
     include/linux/smsc911x.h |   11 ++++++++++
     3 files changed, 53 insertions(+), 10 deletions(-)
    
    a b static int smsc911x_open(struct net_devi 
    11811181                SMSC_WARNING(IFUP, 
    11821182                        "Timed out waiting for EEPROM busy bit to clear"); 
    11831183 
    1184         smsc911x_reg_write(pdata, GPIO_CFG, 0x70070000); 
     1184        smsc911x_reg_write(pdata, GPIO_CFG, GPIO_CFG_LED1_EN_ | GPIO_CFG_LED2_EN_ | (1 << 20)); 
    11851185 
    11861186        /* The soft reset above cleared the device's MAC address, 
    11871187         * restore it from local copy (set in probe) */ 
    static int smsc911x_open(struct net_devi 
    11931193        smsc911x_reg_write(pdata, INT_EN, 0); 
    11941194        smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF); 
    11951195 
    1196         /* Set interrupt deassertion to 100uS */ 
    1197         intcfg = ((10 << 24) | INT_CFG_IRQ_EN_); 
     1196        /* Set interrupt deassertion to 22*10uS */ 
     1197        intcfg = ((22 << 24) | INT_CFG_IRQ_EN_); 
    11981198 
    11991199        if (pdata->config.irq_polarity) { 
    12001200                SMSC_TRACE(IFUP, "irq polarity: active high"); 
    static int smsc911x_open(struct net_devi 
    12201220        temp |= INT_EN_SW_INT_EN_; 
    12211221        smsc911x_reg_write(pdata, INT_EN, temp); 
    12221222 
    1223         timeout = 1000; 
     1223        timeout = 2000; 
    12241224        while (timeout--) { 
    12251225                if (pdata->software_irq_signal) 
    12261226                        break; 
    static int __devexit smsc911x_drv_remove 
    19481948        return 0; 
    19491949} 
    19501950 
     1951static inline unsigned int is_gumstix_oui(u8 *addr) 
     1952{ 
     1953        return (addr[0] == 0x00 && addr[1] == 0x15 && addr[2] == 0xC9); 
     1954} 
     1955 
     1956/** 
     1957 * gen_serial_ether_addr - Generate software assigned Ethernet address 
     1958 * based on the system_serial number 
     1959 * @addr: Pointer to a six-byte array containing the Ethernet address 
     1960 * 
     1961 * Generate an Ethernet address (MAC) that is not multicast 
     1962 * and has the local assigned bit set, keyed on the system_serial 
     1963 */ 
     1964static inline void gen_serial_ether_addr(u8 *addr) 
     1965{ 
     1966        static u8 ether_serial_digit = 0; 
     1967        addr [0] = system_serial_high >> 8; 
     1968        addr [1] = system_serial_high; 
     1969        addr [2] = system_serial_low >> 24; 
     1970        addr [3] = system_serial_low >> 16; 
     1971        addr [4] = system_serial_low >> 8; 
     1972        addr [5] = (system_serial_low & 0xc0) | /* top bits are from system serial */ 
     1973                (1 << 4) |                      /* 2 bits identify interface type 1=ether, 2=usb, 3&4 undef */ 
     1974                ((ether_serial_digit++) & 0x0f);        /* 15 possible interfaces of each type */ 
     1975 
     1976        if(!is_gumstix_oui(addr)) 
     1977        { 
     1978                addr [0] &= 0xfe;               /* clear multicast bit */ 
     1979                addr [0] |= 0x02;               /* set local assignment bit (IEEE802) */ 
     1980        } 
     1981} 
     1982 
    19511983static int __devinit smsc911x_drv_probe(struct platform_device *pdev) 
    19521984{ 
    19531985        struct net_device *dev; 
    static int __devinit smsc911x_drv_probe( 
    20812113                        SMSC_TRACE(PROBE, 
    20822114                                "Mac Address is read from LAN911x EEPROM"); 
    20832115                } else { 
    2084                         /* eeprom values are invalid, generate random MAC */ 
    2085                         random_ether_addr(dev->dev_addr); 
    2086                         smsc911x_set_hw_mac_address(pdata, dev->dev_addr); 
    2087                         SMSC_TRACE(PROBE, 
    2088                                 "MAC Address is set to random_ether_addr"); 
     2116                        /* eeprom values are invalid, generate MAC from serial number */ 
     2117                        gen_serial_ether_addr(dev->dev_addr); 
     2118                        smsc911x_set_hw_mac_address(pdata, dev->dev_addr); 
     2119                        SMSC_TRACE(PROBE, 
     2120                                "MAC Address is derived from system serial number"); 
    20892121                } 
    20902122        } 
    20912123 
Note: See TracBrowser for help on using the repository browser.