Changeset 29677


Ignore:
Timestamp:
2012-01-07T20:36:30+01:00 (6 years ago)
Author:
juhosg
Message:

generic: rtl8366: preparing for RTL8367 support

  • make clock delay configurable
  • make read,write commands configurable
  • use u16 for member and untag fields
Location:
trunk/target/linux/generic/files/drivers/net/phy
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c

    r29676 r29677  
    2525 
    2626#define RTL8366_SMI_ACK_RETRY_COUNT         5 
    27 #define RTL8366_SMI_CLK_DELAY               10 /* nsec */ 
    2827 
    2928static inline void rtl8366_smi_clk_delay(struct rtl8366_smi *smi) 
    3029{ 
    31         ndelay(RTL8366_SMI_CLK_DELAY); 
     30        ndelay(smi->clk_delay); 
    3231} 
    3332 
     
    199198 
    200199        /* send READ command */ 
    201         ret = rtl8366_smi_write_byte(smi, 0x0a << 4 | 0x04 << 1 | 0x01); 
     200        ret = rtl8366_smi_write_byte(smi, smi->cmd_read); 
    202201        if (ret) 
    203202                goto out; 
     
    240239 
    241240        /* send WRITE command */ 
    242         ret = rtl8366_smi_write_byte(smi, 0x0a << 4 | 0x04 << 1 | 0x00); 
     241        ret = rtl8366_smi_write_byte(smi, smi->cmd_write); 
    243242        if (ret) 
    244243                goto out; 
  • trunk/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h

    r24939 r29677  
    3333        unsigned int            gpio_sda; 
    3434        unsigned int            gpio_sck; 
     35        unsigned int            clk_delay;      /* ns */ 
     36        u8                      cmd_read; 
     37        u8                      cmd_write; 
    3538        spinlock_t              lock; 
    3639        struct mii_bus          *mii_bus; 
     
    5962struct rtl8366_vlan_mc { 
    6063        u16     vid; 
     64        u16     untag; 
     65        u16     member; 
     66        u8      fid; 
    6167        u8      priority; 
    62         u8      untag; 
    63         u8      member; 
    64         u8      fid; 
    6568}; 
    6669 
    6770struct rtl8366_vlan_4k { 
    6871        u16     vid; 
    69         u8      untag; 
    70         u8      member; 
     72        u16     untag; 
     73        u16     member; 
    7174        u8      fid; 
    7275}; 
  • trunk/target/linux/generic/files/drivers/net/phy/rtl8366rb.c

    r27800 r29677  
    12481248        smi->gpio_sda = pdata->gpio_sda; 
    12491249        smi->gpio_sck = pdata->gpio_sck; 
     1250        smi->clk_delay = 10; 
     1251        smi->cmd_read = 0xa9; 
     1252        smi->cmd_write = 0xa8; 
    12501253        smi->ops = &rtl8366rb_smi_ops; 
    12511254        smi->cpu_port = RTL8366RB_PORT_NUM_CPU; 
  • trunk/target/linux/generic/files/drivers/net/phy/rtl8366s.c

    r28267 r29677  
    11281128        smi->gpio_sda = pdata->gpio_sda; 
    11291129        smi->gpio_sck = pdata->gpio_sck; 
     1130        smi->clk_delay = 10; 
     1131        smi->cmd_read = 0xa9; 
     1132        smi->cmd_write = 0xa8; 
    11301133        smi->ops = &rtl8366s_smi_ops; 
    11311134        smi->cpu_port = RTL8366S_PORT_NUM_CPU; 
Note: See TracChangeset for help on using the changeset viewer.