Changeset 12398

Show
Ignore:
Timestamp:
06/29/09 18:16:46 (5 months ago)
Author:
BrainSlayer
Message:

ar8216 switch support

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/linux/ar531x/linux-2.6.23/drivers/net/ar2313/ar2313.c

    r11907 r12398  
    5252#include <asm/bootinfo.h> 
    5353 
    54 #define AR2313_MTU                     1518 
     54#define AR2313_MTU                     1692 
    5555#define AR2313_PRIOS                   1 
    5656#define AR2313_QUEUES                  (2*AR2313_PRIOS) 
     
    959959 
    960960                                skb = sp->rx_skb[idx]; 
     961#if 0//CONFIG_AR8216_PHY 
     962#define HEADER_LEN 2 
     963                    /* check and remove the header for s26*/ 
     964                    if ((skb->data[0] & 0xf) == 5) { /* wan port */ 
     965                        skb->data[14 + HEADER_LEN] &= 0xf0; /* change VLAN ID for the wan port */ 
     966                        skb->data[15 + HEADER_LEN] = 2;     /* to VLAN ID 2 */ 
     967                    } 
     968#endif                           
    961969                                /* set skb */ 
    962                                 skb_put(skb, 
    963                                                 ((status >> DMA_RX_LEN_SHIFT) & 0x3fff) - CRC_LEN); 
     970                    skb_put(skb,((status >> DMA_RX_LEN_SHIFT) & 0x3fff) - CRC_LEN); 
     971#if 0//CONFIG_AR8216_PHY 
     972                    skb_pull(skb, HEADER_LEN); /* remove the header */ 
     973#endif 
    964974 
    965975                                dev->stats.rx_bytes += skb->len; 
     
    12481258        } 
    12491259 
     1260#if 0///CONFIG_AR8216_PHY 
     1261    /* add a header for s26*/ 
     1262    skb_push(skb, HEADER_LEN); 
     1263    skb->data[0] = 0x10; /* broadcast = 0; from_cpu = 0; reserved = 1; port_num = 0 */ 
     1264    skb->data[1] = 0x80; /* reserved = 0b10; priority = 0; type = 0 (normal) */  
     1265#endif 
     1266 
    12501267        /* Setup the transmit descriptor. */ 
    12511268        td->devcs = ((skb->len << DMA_TX1_BSIZE_SHIFT) | 
  • src/linux/ar531x/linux-2.6.23/drivers/net/phy/Kconfig

    r9459 r12398  
    6666          Currently supports the ADM6996F switch 
    6767 
     68config AR8216_PHY 
     69        tristate "Driver for AR8216 switches" 
     70        ---help--- 
     71          Currently supports the AR8216 switch 
     72 
    6873config MVSWITCH_PHY 
    6974        tristate "Driver for Marvell switches" 
  • src/linux/ar531x/linux-2.6.23/drivers/net/phy/Makefile

    r9459 r12398  
    1616obj-$(CONFIG_MVSWITCH_PHY)      += mvswitch.o 
    1717obj-$(CONFIG_FIXED_PHY)         += fixed.o 
     18obj-$(CONFIG_AR8216_PHY)        += swconfig.o ar8216.o 
  • src/linux/ar531x/linux-2.6.23/drivers/net/phy/mvswitch.c

    r11888 r12398  
    274274                return i; 
    275275        } 
     276        msleep(10); /* wait for the status change to settle in */ 
    276277 
    277278        /* set the ATU flags */ 
     
    360361} 
    361362 
     363#define MV_AUTONEG_DONE(mv_phy_specific_status)                   \ 
     364    (((mv_phy_specific_status) &                                  \ 
     365        (MV_STATUS_RESOLVED | MV_STATUS_REAL_TIME_LINK_UP)) ==    \ 
     366        (MV_STATUS_RESOLVED | MV_STATUS_REAL_TIME_LINK_UP)) 
     367 
    362368static int 
    363369mvswitch_read_status(struct phy_device *pdev) 
     
    366372        pdev->duplex = DUPLEX_FULL; 
    367373        pdev->state = PHY_UP; 
    368  
    369         /* XXX ugly workaround: we can't force the switch 
    370          * to gracefully handle hosts moving from one port to another, 
    371          * so we have to regularly clear the ATU database */ 
    372  
    373         /* wait for the ATU to become available */ 
    374         mvswitch_wait_mask(pdev, MV_SWITCHREG(ATU_OP), MV_ATUOP_INPROGRESS, 0); 
    375  
    376         /* flush the ATU */ 
    377         w16(pdev, MV_SWITCHREG(ATU_OP), 
    378                 MV_ATUOP_INPROGRESS | 
    379                 MV_ATUOP_FLUSH_ALL 
    380         ); 
    381  
    382         /* wait for operation to complete */ 
    383         mvswitch_wait_mask(pdev, MV_SWITCHREG(ATU_OP), MV_ATUOP_INPROGRESS, 0); 
    384  
     374        static int linkstatus[5]={0,0,0,0,0}; 
     375 
     376        int i; 
     377        for (i=0;i<MV_PORTS;i++) 
     378            { 
     379            int status = r16(pdev,MV_PHYPORT(i),MV_PHY_STATUS1); 
     380            if (linkstatus[i]) 
     381            { 
     382            if (!(status & MV_STATUS_REAL_TIME_LINK_UP)) 
     383                { 
     384                printk(KERN_INFO "port %d, link down\n",i); 
     385                /* XXX ugly workaround: we can't force the switch 
     386                * to gracefully handle hosts moving from one port to another, 
     387                * so we have to regularly clear the ATU database */ 
     388 
     389                /* wait for the ATU to become available */ 
     390                mvswitch_wait_mask(pdev, MV_SWITCHREG(ATU_OP), MV_ATUOP_INPROGRESS, 0); 
     391 
     392                /* flush the ATU */ 
     393                w16(pdev, MV_SWITCHREG(ATU_OP), 
     394                        MV_ATUOP_INPROGRESS | 
     395                        MV_ATUOP_FLUSH_ALL 
     396                ); 
     397 
     398                /* wait for operation to complete */ 
     399                mvswitch_wait_mask(pdev, MV_SWITCHREG(ATU_OP), MV_ATUOP_INPROGRESS, 0); 
     400                linkstatus[i]=0; 
     401                } 
     402            }else 
     403            { 
     404                if (MV_AUTONEG_DONE(status)) 
     405                    { 
     406                    printk(KERN_INFO "port %d, link up\n",i); 
     407                    linkstatus[i]=1; 
     408                    } 
     409            } 
     410        }     
    385411        return 0; 
    386412} 
  • src/linux/ar531x/linux-2.6.23/drivers/net/phy/mvswitch.h

    r11888 r12398  
    2222#define MV_TRAILER_FLAGS_S      24 
    2323#define MV_TRAILER_OVERRIDE     0x80 
     24 
     25#define MV_STATUS_REAL_TIME_LINK_UP               0x0400 
     26#define MV_STATUS_RESOLVED                        0x0800 
    2427 
    2528