OpenWrt Forum Archive

Topic: RB450 - using Five Ethernet Ports

The content of this topic has been archived between 6 Feb 2018 and 6 May 2018. Unfortunately there are posts – most likely complete pages – missing.

I used patch https://dev.openwrt.org/attachment/tick … _phy.patch . I have tried to configure switch /etc/config/network . I used latest revision openwrt and RB450.

swconfig dev eth1 help .. Failed to connect to the switch

I disabled iptables /etc/init.d/firewall stop. I have tried ping on 1-4 ports and nothing response (eth1.2 - eth1.5). Eth0 is ok.

I check patch https://dev.openwrt.org/attachment/tick … _phy.patch  and there are:
1. Link speed and link status corrections build_dir/linux-ar71xx/linux-2.6.28.10/drivers/net/ag71xx/ag71xx_phy.c

2. Drivers remove/install
- remove Intel(R) PRO/1000 Gigabit Ethernet support
- remove Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support
- remove IBM EMAC Ethernet support    (CONFIG_IBM_NEW_EMAC)
- insert ICL EtherTeam 16i/32 support
- insert Zorro Ethernet cards using an NS8390-compatible


I think that this patch does not effect on switch and ip175c.

I have read datasheet of ip175c and i think that first port is enabled alone. Other ports has only one interface. Ports are tagged(VLAN) and switch is configured to port = tag.

Jirka

robrob wrote:

jirka,

Without the patch phorn linked to above none of the switch ethernet ports will work. eth0 is the WAN port, eth1 is the switch. Apply the patch, run the above clean command, compile and it should work.

jirka,

I was having a similar problem and it was caused by not running the clean command--the patch wasn't being installed. Did you run phorn's clean command?

hi,
I removed my copy of trunk. I download svn trunk again and I used patch. I only add +CONFIG_SWCONFIG=y by hand, it does not patch sucessfully.

Dmesg shows that PHY is detected.

dmesg
...
eth0: Atheros AG71xx at 0xba000000, irq 5
eth0: connected to PHY at 0:04 [uid=02430d80, driver=Generic PHY]
eth1: Atheros AG71xx at 0xb9000000, irq 4
eth1: connected to 4 PHYs
eth1: connected to 4 PHYs
...

There area a lot of messages
Trying 10/HALF
Trying 10/HALF
Trying 10/HALF
Trying 10/HALF
...

I does not matter if there is ethernet cable connected. Messages stop when i run "ifcconfig eth1 down".

Swconfig returns info ...

root@OpenWrt:/# swconfig dev eth1 help
Switch 1: eth1(eth1), ports: 6, vlans: 16
     --switch
        Attribute 1 (int): enable_vlan (Flag to enable or disable VLANs and tagg
ing)
        Attribute 2 (string): name (Returns the type of IC+ chip.)
        Attribute 3 (int): phy (Direct register access: set phy (0-4, or 29,30,3
1))
        Attribute 4 (int): reg (Direct register access: set mii number (0-31))
        Attribute 5 (int): val (Direct register access: read/write to register (
0-65535))
        Attribute 6 (none): apply (Activate changes in the hardware)
        Attribute 7 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (string): status (Returns Detailed port status)
        Attribute 2 (int): link (Link speed. Can write 0 for auto-negotiate, or
10 or 100)
        Attribute 3 (int): tagged (0 = untag, 1 = add tags, 2 = do not alter (Th
is value is reset if vlans are altered))
        Attribute 4 (int): pvid (Primary VLAN ID)
root@OpenWrt:/#

I have tried set up switch vlans, but it does not run.

vi /etc/config/network

config 'switch' 'eth1'          
        option 'vlan2' '3 4t 5t'
        option 'vlan3' '2 4t 5t'
        option 'vlan4' '1 4t 5t'   
        option 'vlan5' '0 4t 5t'    
                                    
config 'interface' 'loopback'       
        option 'ifname' 'lo'        
        option 'proto' 'static'     
        option 'ipaddr' '127.0.0.1'   
        option 'netmask' '255.0.0.0'    
                                        
config 'interface' 'vlan1'               
        option 'ifname' 'eth0'          
        option 'proto' 'static'         
        option 'ipaddr' '172.16.16.99'  
        option 'netmask' '255.255.240.0'
                                        
config 'interface' 'vlan2'               
        option 'ifname' 'eth1.2'        
        option 'proto' 'static'         
        option 'ipaddr' '192.168.102.62'
        option 'netmask' '255.255.255.0'
                                        
config 'interface' 'vlan3'               
        option 'ifname' 'eth1.3'        
        option 'proto' 'static'         
        option 'ipaddr' '192.168.103.63'
        option 'netmask' '255.255.255.0'

config 'interface' 'vlan4'               
        option 'ifname' 'eth1.4'        
        option 'proto' 'static'         
        option 'ipaddr' '192.168.104.63'
        option 'netmask' '255.255.255.0'

config 'interface' 'vlan5'               
        option 'ifname' 'eth1.5'        
        option 'proto' 'static'         
        option 'ipaddr' '192.168.105.63'
        option 'netmask' '255.255.255.0'

Eth1 receives some bytes ... "RX bytes:5916", but not send. I tried ping from and to this intreface ... . I will try tcpdump ... .


       ifconfig

... 

eth1      Link encap:Ethernet  HWaddr 00:0C:42:2E:A1:71
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:40 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5916 (5.7 KiB)  TX bytes:0 (0.0 B)
          Interrupt:4

eth1.2    Link encap:Ethernet  HWaddr 00:0C:42:2E:A1:71
          inet addr:192.168.99.62  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

...

Jirka


robrob wrote:

jirka,

I was having a similar problem and it was caused by not running the clean command--the patch wasn't being installed. Did you run phorn's clean command?

swconfig does not use the same configuration as the old system.
Your configuration needs to look more like this (Note the separate "config switch_vlan" section for each vlan)

config switch eth1
option reset 1
option enable_vlan 1

config switch_vlan
option device eth1
option vlan 1
option ports "0 1 2 5t"

config switch_vlan
option device eth1
option vlan 2
option ports "3 4 5t"

config interface lan1
option ifname "eth1.1"
option proto static
option type bridge
option ipaddr 192.168.1.7
option netmask 255.255.255.0

config interface lan2
option ifname "eth1.2"
option proto static
option ipaddr 192.168.2.7
option netmask 255.255.255.0

config interface wan
option ifname "eth0"
option proto dhcp

About the TRYING 10/HALF, does the message go away if you plug a cable into port 0 or port 4?

I have no idea which device is causing the kernel messages.

One thing you can do is to go to build_dir/linux-ar71xx/linux-2.6.28.10/drivers/net/phy/phy.c
Search for both places that print "Trying %d/%s", and add the following statement after each one:

        printk(KERN_DEBUG "PHY is %s "
            "[uid=%08x, driver=%s]\n",
            dev_name(&phydev->dev),
            phydev->phy_id, phydev->drv?phydev->drv->name:"NONE");

That should print extra information out, but it will include the driver that is responsible.

One thing you could try is going to drivers/net/phy/ip175c.c:
static int ip175c_read_status(struct phy_device *pdev)
{
    pdev->speed = SPEED_100;
    pdev->duplex = DUPLEX_FULL;
    pdev->pause = pdev->asym_pause = 0;
    return 0;
}
Before the "return 0", add this:

pdev->irq = PHY_IGNORE_INTERRUPT;

That might make it stop trying to poll for status changes.

Hi,
KERN_DEBUG did not shown any information. I tried echo "8 8 8 8" > /proc/sys/kernel/printk .
Is there any compilation flag to include debug  ?

I changed code to:

    pr_info("pr_info PHY is %s %s %xd (phy_force_reduction)"
               "[uid=%08x, driver=%s]\n",
               dev_name(&phydev->dev),
               phydev->bus->name,phydev->addr,phydev->phy_id,phydev->drv?phydev->drv->name:"NONE");
    printk(KERN_DEBUG, "PHY is %s %s %xd (phy_force_reduction)"
               "[uid=%08x, driver=%s]\n",
               dev_name(&phydev->dev),
               phydev->bus->name,phydev->addr,phydev->phy_id,phydev->drv?phydev->drv->name:"NONE");

Cable was in eth0:

root@OpenWrt:/# Trying 100/FULL
pr_info PHY is 0:00 ag71xx_mdio 0d (phy_state_machine)[uid=02430d80, driver=IC+
IP175C]
pr_info PHY is 0:00 ag71xx_mdio 0d (phy_force_reduction)[uid=02430d80, driver=IC
+ IP175C]

Cable was in eth1:

root@OpenWrt:/# br-lan: port 1(eth0) entering disabled state
Trying 10/FULL
pr_info PHY is 0:00 ag71xx_mdio 0d (phy_force_reduction)[uid=02430d80, driver=IC
+ IP175C]
pr_info PHY is 0:00 ag71xx_mdio 0d (phy_force_reduction)[uid=02430d80, driver=IC
+ IP175C]

Cable was in eth2:

root@OpenWrt:/# pr_info PHY is 0:00 ag71xx_mdio 0d (phy_force_reduction)[uid=024
30d80, driver=IC+ IP175C]
pr_info PHY is 0:00 ag71xx_mdio 0d (phy_force_reduction)[uid=02430d80, driver=IC
+ IP175C]

Cable was in eth3:

root@OpenWrt:/# pr_info PHY is 0:00 ag71xx_mdio 0d (phy_force_reduction)[uid=024
30d80, driver=IC+ IP175C]
pr_info PHY is 0:00 ag71xx_mdio 0d (phy_force_reduction)[uid=02430d80, driver=IC
+ IP175C]

Cable was in eth4:

root@OpenWrt:/# eth1: link up (10Mbps/Half duplex)
root@OpenWrt:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr 00:0C:42:2E:A1:70
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:712 (712.0 B)  TX bytes:814 (814.0 B)

eth0      Link encap:Ethernet  HWaddr 00:0C:42:2E:A1:70
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:740 (740.0 B)  TX bytes:814 (814.0 B)
          Interrupt:5

eth1      Link encap:Ethernet  HWaddr 00:0C:42:2E:A1:71
          inet addr:192.168.99.223  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:28 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4864 (4.7 KiB)  TX bytes:960 (960.0 B)
          Interrupt:4

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
root@OpenWrt:/# swconfig dev eth1 help
Switch 1: eth1(eth1), ports: 6, vlans: 16
     --switch
        Attribute 1 (int): enable_vlan (Flag to enable or disable VLANs and tagg
ing)
        Attribute 2 (string): name (Returns the type of IC+ chip.)
        Attribute 3 (int): phy (Direct register access: set phy (0-4, or 29,30,3
1))
        Attribute 4 (int): reg (Direct register access: set mii number (0-31))
        Attribute 5 (int): val (Direct register access: read/write to register (
0-65535))
        Attribute 6 (none): apply (Activate changes in the hardware)
        Attribute 7 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (string): status (Returns Detailed port status)
        Attribute 2 (int): link (Link speed. Can write 0 for auto-negotiate, or
10 or 100)
        Attribute 3 (int): tagged (0 = untag, 1 = add tags, 2 = do not alter (Th
is value is reset if vlans are altered))
        Attribute 4 (int): pvid (Primary VLAN ID)
root@OpenWrt:/# ifconfig eth1 192.168.99.19/24
root@OpenWrt:/# ifconfig eth0 down
br-lan: port 1(eth0) entering disabled state
root@OpenWrt:/# ping 192.168.99.99
PING 192.168.99.99 (192.168.99.99): 56 data bytes
64 bytes from 192.168.99.99: seq=0 ttl=64 time=4.151 ms
64 bytes from 192.168.99.99: seq=1 ttl=64 time=172.498 ms
64 bytes from 192.168.99.99: seq=2 ttl=64 time=0.450 ms
64 bytes from 192.168.99.99: seq=3 ttl=64 time=0.428 ms
^C
--- 192.168.99.99 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.428/44.381/172.498 ms
root@OpenWrt:/#
root@OpenWrt:/# uci export
package 'dhcp'

config 'dnsmasq'
        option 'domainneeded' '1'
        option 'boguspriv' '1'
        option 'filterwin2k' '0'
        option 'localise_queries' '1'
        option 'local' '/lan/'
        option 'domain' 'lan'
        option 'expandhosts' '1'
        option 'nonegcache' '0'
        option 'authoritative' '1'
        option 'readethers' '1'
        option 'leasefile' '/tmp/dhcp.leases'
        option 'resolvfile' '/tmp/resolv.conf.auto'

config 'dhcp' 'lan'
        option 'interface' 'lan'
        option 'start' '100'
        option 'limit' '150'
        option 'leasetime' '12h'

config 'dhcp' 'wan'
        option 'interface' 'wan'
        option 'ignore' '1'

package 'dropbear'

config 'dropbear'
        option 'PasswordAuth' 'on'
        option 'Port' '22'

package 'firewall'

config 'defaults'
        option 'syn_flood' '1'
        option 'input' 'ACCEPT'
        option 'output' 'ACCEPT'
        option 'forward' 'REJECT'

config 'zone'
        option 'name' 'lan'
        option 'input' 'ACCEPT'
        option 'output' 'ACCEPT'
        option 'forward' 'REJECT'

config 'zone'
        option 'name' 'wan'
        option 'input' 'REJECT'
        option 'output' 'ACCEPT'
        option 'forward' 'REJECT'
        option 'masq' '1'

config 'forwarding'
        option 'src' 'lan'
        option 'dest' 'wan'
        option 'mtu_fix' '1'

config 'include'
        option 'path' '/etc/firewall.user'

package 'fstab'

config 'mount'
        option 'target' '/home'
        option 'device' '/dev/sda1'
        option 'fstype' 'ext3'
        option 'options' 'rw,sync'
        option 'enabled' '0'

config 'swap'
        option 'device' '/dev/sda2'
        option 'enabled' '0'

package 'httpd'

config 'httpd'
        option 'port' '80'
        option 'home' '/www'

package 'network'

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'ifname' 'eth0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.1.1'
        option 'netmask' '255.255.255.0'

config 'interface' 'wan'
        option 'ifname' 'eth1'
        option 'proto' 'dhcp'

package 'system'

config 'system'
        option 'hostname' 'OpenWrt'
        option 'timezone' 'UTC'

package 'wireless'

Eth0 is ok .
Eth1 is running in 4 x ports on RB450. i can ping from any of 4s port. Only last port(right corner port) changes status of cable connection. I think that switch is not set up. I will try set up vlan.

Jirka

(Last edited by jirka on 16 Jun 2009, 14:56)

phorn wrote:

One thing you could try is going to drivers/net/phy/ip175c.c:
static int ip175c_read_status(struct phy_device *pdev)
{
    pdev->speed = SPEED_100;
    pdev->duplex = DUPLEX_FULL;
    pdev->pause = pdev->asym_pause = 0;
    return 0;
}
Before the "return 0", add this:

pdev->irq = PHY_IGNORE_INTERRUPT;

That might make it stop trying to poll for status changes.

This does not help.

Why do drivers ic175 and icplus have same id 02430d80 ?

Jirka

(Last edited by jirka on 16 Jun 2009, 16:09)

I correct changes line every 10 secods .. Messages ... Trying 10/100/HALF ... .

ip175c.c does not implement config_aneg. There is empy metod. ip175 and icplus share same driver id, better last number could by different. Message passing from mdio goes into both drivers. Driver could inform about line status or some times kernel asks driver. This is messages about Trying, kernel asks driver. There are some bugs.


In phy.c:

static void phy_force_reduction(struct phy_device *phydev)
{

    // add this line
    if( phydev->addr == 0 && strcmp(phydev->bus->name,"0:00")) return;

Jirka

When use /etc/config/network

config switch eth1
option reset 1
option enable_vlan 1

config switch_vlan
option device eth1
option vlan 2
option ports "3 5t"

config switch_vlan
option device eth1
option vlan 3
option ports "2 5t"

config switch_vlan
option device eth1
option vlan 4
option ports "1 5t"

config switch_vlan
option device eth1
option vlan 5
option ports "0 5t"

I can configure and isolate interfaces eth1.2, eth1.3, eth1.4, eth1.5. These names corresponds to labels in the box: interface Eth2 to Eth5 (CA150)
But, these interfaces only work if port 0 (eth1.5) have PHY UP (Cable connect - mii UP).
Once port 0 is UP one time, the other interfaces work well, and I can disconnect port 0, until next boot.

(Last edited by mtadeu on 17 Jun 2009, 03:13)

It is the same on my RB450.
Your VLAN configuration does not run on my RB450.

I have to add CPU port 4, i think.
From
  option ports "3 5t"
To
  option ports "3 4 5t"

Jirka

mtadeu wrote:

When use /etc/config/network

config switch eth1
option reset 1
option enable_vlan 1

config switch_vlan
option device eth1
option vlan 2
option ports "3 5t"

config switch_vlan
option device eth1
option vlan 3
option ports "2 5t"

config switch_vlan
option device eth1
option vlan 4
option ports "1 5t"

config switch_vlan
option device eth1
option vlan 5
option ports "0 5t"

I can configure and isolate interfaces eth1.2, eth1.3, eth1.4, eth1.5. These names corresponds to labels in the box: interface Eth2 to Eth5 (CA150)
But, these interfaces only work if port 0 (eth1.5) have PHY UP (Cable connect - mii UP).
Once port 0 is UP one time, the other interfaces work well, and I can disconnect port 0, until next boot.

jirka wrote:

It is the same on my RB450.
Your VLAN configuration does not run on my RB450.

I have to add CPU port 4, i think.
From
  option ports "3 5t"
To
  option ports "3 4 5t"

Jirka

I try
  option ports "3 4 5t"
and
  option ports "3 4t 5t"
Both make same result. Need to connect port 0
I not use bridge.
The (real) eth1 link is up, only when port 0 is UP. See that, when connect port 0:

# logread -f
eth1: link up (100Mbps/Full duplex)
Jan  1 00:01:04 OpenWrt user.debug kernel: ar71xx: pll_reg 0xb8050010: 0x1099
Jan  1 00:01:04 OpenWrt user.info kernel: eth1: link up (100Mbps/Full duplex)

Hmm, it seems like something is monitoring Phy 0, since that is the address that the switch is attached to.

There should be a way to force the port to always be in the "up" state, since it was clearly doing that before I added the code to attach to the phy.

Hi, all... I get this on my RB493

ip175c_init called.
ag71xx_mdio: probed
eth0: Atheros AG71xx at 0xb9000000, irq 4
eth1: Atheros AG71xx at 0xba000000, irq 5
eth1: connected to PHY at 0:00 [uid=02430d80, driver=IC+ IP175C]
...
root@OpenWrt:/# swconfig dev eth1 get enable_vlan
0
root@OpenWrt:/# swconfig dev eth1 get name
IP178C

take note of the driver=IC+ IP175C on the eth1 PHY, while it should maybe be IP178C?? Or are they using the same driver?

The main problem beeing that "swconfig dev eth1 set enable_vlan 1" doesn't enable the vlan

(Last edited by gdamjan on 6 Aug 2009, 01:54)

Hello Group,

Just an FYI for other RB450 users.  We recently purchased a batch of RB450 boards and most of them had the ip175D switch device instead of the ip175C.  These two devices are not software compatible, so neither the current ip175c.c nor the current icplus.c driver will work.  Below is the modification I made to icplus.c to add support for the ip175d.  This simply configures the device to be a basic 4 port switch.

static int ip175c_config_init(struct phy_device *phydev)
{
    int err, i;
    static int full_reset_performed = 0;

    if (full_reset_performed == 0) {

        /* Determine if the device is really a IP175D */
        if(phydev->bus->read(phydev->bus, 20, 0) == 0x175d){
            printk(KERN_INFO "IP175D detected\n");
            
            /* master reset */
            err = phydev->bus->write(phydev->bus, 20, 2, 0x175d);
            if (err < 0)
                return err;

            /* ensure no bus delays overlap reset period */
            err = phydev->bus->read(phydev->bus, 20, 2);

            /* data sheet specifies reset period is 2 msec -
             * This part seems to take longer - wait for master
             * reset register to self-clear
             */
            for(i=0; i<20; i++){
                mdelay(2);
                if(phydev->bus->read(phydev->bus, 20, 2) == 0)
                    break;
            }

            /* Enable learning and forwarding for all ports */
            phydev->bus->write(phydev->bus, 20, 6, phydev->bus->read(phydev->bus, 20, 6) | 0x3f3f);

            /* Disable Special tagging for Tx and Rx */
            phydev->bus->write(phydev->bus, 21, 22, phydev->bus->read(phydev->bus, 21, 22) & 0xfffC);
            
            /* Disable all ingress rules */
            phydev->bus->write(phydev->bus, 22, 1, 0x0400);
            
            /* Keep vlan tags */
            phydev->bus->write(phydev->bus, 22, 2, 0x003F);

            /* All port are in pvid 1 - not sure if this is necessary */
            for(i=4; i<=9; i++)
                phydev->bus->write(phydev->bus, 22, i, 0x0001);

            /* All ports, except 4, are members of the same 
             * vlan group.
             */
            phydev->bus->write(phydev->bus, 23, 0, 0x2f2f);
            phydev->bus->write(phydev->bus, 23, 1, 0x2f2f);
            phydev->bus->write(phydev->bus, 23, 2, 0x2f00);
            for(i=3; i<=7; i++)
                phydev->bus->write(phydev->bus, 23, i, 0x0000);

            /* Don't add or remove tags.
             */
            for(i=8; i<=23; i++)
                phydev->bus->write(phydev->bus, 23, i, 0);
        }
        else{
            printk(KERN_INFO "IP175C detected\n");

            /* master reset */
            err = phydev->bus->write(phydev->bus, 30, 0, 0x175c);
            if (err < 0)
                return err;
            
            /* ensure no bus delays overlap reset period */
            err = phydev->bus->read(phydev->bus, 30, 0);
            
            /* data sheet specifies reset period is 2 msec */
            mdelay(2);

            /* enable IP175C mode */
            err = phydev->bus->write(phydev->bus, 29, 31, 0x175c);
            if (err < 0)
                return err;

            /* Set MII0 speed and duplex (in PHY mode) */
            err = phydev->bus->write(phydev->bus, 29, 22, 0x420);
            if (err < 0)
                return err;

            /* Configure ports 5, 0, 1, 2, 3 to be
             * members of the same vlan.  Exclude port 4
             * Disable tagging
             */
            phydev->bus->write(phydev->bus, 29, 19, phydev->bus->read(phydev->bus, 29, 19) | 0x8f8f);
            phydev->bus->write(phydev->bus, 29, 20, phydev->bus->read(phydev->bus, 29, 20) | 0x8f8f);
            phydev->bus->write(phydev->bus, 29, 21, phydev->bus->read(phydev->bus, 29, 21) & 0x70ff);
            phydev->bus->write(phydev->bus, 29, 23, phydev->bus->read(phydev->bus, 29, 23) & 0x007c);
        }

        /* reset switch ports */
        for (i = 0; i < 5; i++) {
            err = phydev->bus->write(phydev->bus, i,
                         MII_BMCR, BMCR_RESET);
            if (err < 0)
                return err;
        }

        for (i = 0; i < 5; i++)
            err = phydev->bus->read(phydev->bus, i, MII_BMCR);

        mdelay(2);

        full_reset_performed = 1;
    }

    if (phydev->addr != 4) {
        phydev->state = PHY_RUNNING;
        phydev->speed = SPEED_100;
        phydev->duplex = DUPLEX_FULL;
        phydev->link = 1;
        netif_carrier_on(phydev->attached_dev);
    }

    return 0;
}
mschank wrote:

Hello Group,

Just an FYI for other RB450 users.  We recently purchased a batch of RB450 boards and most of them had the ip175D switch device instead of the ip175C.  These two devices are not software compatible, so neither the current ip175c.c nor the current icplus.c driver will work.  Below is the modification I made to icplus.c to add support for the ip175d.  This simply configures the device to be a basic 4 port switch.

static int ip175c_config_init(struct phy_device *phydev)
{
    int err, i;
    static int full_reset_performed = 0;

    if (full_reset_performed == 0) {

        /* Determine if the device is really a IP175D */
        if(phydev->bus->read(phydev->bus, 20, 0) == 0x175d){
            printk(KERN_INFO "IP175D detected\n");
            
            /* master reset */
            err = phydev->bus->write(phydev->bus, 20, 2, 0x175d);
            if (err < 0)
                return err;

            /* ensure no bus delays overlap reset period */
            err = phydev->bus->read(phydev->bus, 20, 2);

            /* data sheet specifies reset period is 2 msec -
             * This part seems to take longer - wait for master
             * reset register to self-clear
             */
            for(i=0; i<20; i++){
                mdelay(2);
                if(phydev->bus->read(phydev->bus, 20, 2) == 0)
                    break;
            }

            /* Enable learning and forwarding for all ports */
            phydev->bus->write(phydev->bus, 20, 6, phydev->bus->read(phydev->bus, 20, 6) | 0x3f3f);

            /* Disable Special tagging for Tx and Rx */
            phydev->bus->write(phydev->bus, 21, 22, phydev->bus->read(phydev->bus, 21, 22) & 0xfffC);
            
            /* Disable all ingress rules */
            phydev->bus->write(phydev->bus, 22, 1, 0x0400);
            
            /* Keep vlan tags */
            phydev->bus->write(phydev->bus, 22, 2, 0x003F);

            /* All port are in pvid 1 - not sure if this is necessary */
            for(i=4; i<=9; i++)
                phydev->bus->write(phydev->bus, 22, i, 0x0001);

            /* All ports, except 4, are members of the same 
             * vlan group.
             */
            phydev->bus->write(phydev->bus, 23, 0, 0x2f2f);
            phydev->bus->write(phydev->bus, 23, 1, 0x2f2f);
            phydev->bus->write(phydev->bus, 23, 2, 0x2f00);
            for(i=3; i<=7; i++)
                phydev->bus->write(phydev->bus, 23, i, 0x0000);

            /* Don't add or remove tags.
             */
            for(i=8; i<=23; i++)
                phydev->bus->write(phydev->bus, 23, i, 0);
        }
        else{
            printk(KERN_INFO "IP175C detected\n");

            /* master reset */
            err = phydev->bus->write(phydev->bus, 30, 0, 0x175c);
            if (err < 0)
                return err;
            
            /* ensure no bus delays overlap reset period */
            err = phydev->bus->read(phydev->bus, 30, 0);
            
            /* data sheet specifies reset period is 2 msec */
            mdelay(2);

            /* enable IP175C mode */
            err = phydev->bus->write(phydev->bus, 29, 31, 0x175c);
            if (err < 0)
                return err;

            /* Set MII0 speed and duplex (in PHY mode) */
            err = phydev->bus->write(phydev->bus, 29, 22, 0x420);
            if (err < 0)
                return err;

            /* Configure ports 5, 0, 1, 2, 3 to be
             * members of the same vlan.  Exclude port 4
             * Disable tagging
             */
            phydev->bus->write(phydev->bus, 29, 19, phydev->bus->read(phydev->bus, 29, 19) | 0x8f8f);
            phydev->bus->write(phydev->bus, 29, 20, phydev->bus->read(phydev->bus, 29, 20) | 0x8f8f);
            phydev->bus->write(phydev->bus, 29, 21, phydev->bus->read(phydev->bus, 29, 21) & 0x70ff);
            phydev->bus->write(phydev->bus, 29, 23, phydev->bus->read(phydev->bus, 29, 23) & 0x007c);
        }

        /* reset switch ports */
        for (i = 0; i < 5; i++) {
            err = phydev->bus->write(phydev->bus, i,
                         MII_BMCR, BMCR_RESET);
            if (err < 0)
                return err;
        }

        for (i = 0; i < 5; i++)
            err = phydev->bus->read(phydev->bus, i, MII_BMCR);

        mdelay(2);

        full_reset_performed = 1;
    }

    if (phydev->addr != 4) {
        phydev->state = PHY_RUNNING;
        phydev->speed = SPEED_100;
        phydev->duplex = DUPLEX_FULL;
        phydev->link = 1;
        netif_carrier_on(phydev->attached_dev);
    }

    return 0;
}

Hello,

I can't get it working. On 175C chip I use the ip175.c driver but change for icplus.c with your mod doesn't work on my 450 with 175D.
In dmesg I see:

IP175D detected
eth0: connected to PHY at ag71xx-mdio:04 [uid=02430d80, driver=ICPlus IP175C]
eth1: connected to 4 PHYs

Neither swconfig nor IP address directly on eth1 works.

Can you please post your config and rev. number or some more details to get it working?

phorn wrote:

Look at the first post of this thread for info on the RB450.  By following those directions you will end up with a router that has all 5 ports combined.

The rest of the thread is about the IP175C switch (i.e. separating the 5 ports to not be part of the same network). If you are going to try to follow it, you can look at the third page.
My webpage at http://inst.eecs.berkeley.edu/~pathorn/ip175c/ describes how to patch openwrt 8.09 RC1 to support the switch driver.  Try to follow them and if you get stuck, post in the forum.

Would also be nice to get this info up on the wiki so users don't have to hunt through the forum (although Google does a pretty good job at searching the openwrt forum)

@robrob, I haven't updated the patches yet for 2.6.27 or later.  I'll try and put those up once I upgrade my router (have been busy lately). Sadly, I do not know how to get them formally into openwrt, aside from pestering the main developers... and considering how quickly the supposedly 2008 release has been going, they are probably overworked.

I did follow those directions, but at the end of those discussions, the author said "vi /etc/config/network", unfortunately, he didn't specify what to write on the /etc/config/network so that
that eth0 is wan port and all other ports (eth1 1 - 4 ) are lan ports. Can someone please provide an example of /etc/config/network on how to configure port 0 wan port and port 1-4 combined port as lan port.
I'd really appreciate it. I searched every where, but all I can't find such standard example.
thanks.
Jerry H.

@OpenWRT_Forum: The first 6 pages of this discussion are largely out of date--and most everything has been included in openwrt itself. If you have eth0 and eth1 already and you just want to configure a wan and a lan connection, those instructions are not correct. What you want to do is make one of your interfaces "eth0" and the other "eth1", and delete everything to do with the switch.

@lijan: The problems with eth1 may be explained by https://dev.openwrt.org/ticket/5193   Basically--if a single switch attaches to more than one PHY, then it will not initialze any of the PHYs instead of always initializing the first one. That's why eth0 printed out the driver, and eth1 printed out nothing. Depending on your needs, this extra step may or may not be necessary--clearly most systems work without it, so that's why it hasn't been included in openwrt yet.

Also, mschank edited the old <b>icplus.c</b> driver, not the confusingly named <b>ip175.c</b> one. To change this, you need to edit the kernel configuration (something like target/linux/atheros/config-2.6) and comment out CONFIG_IP175C and uncomment CONFIG_ICPLUS=y. Basically, the difference is that the generic icplus driver does the bare minimum to enable the switch and does not support VLANs.

If you want to be able to customize the switch beyond the apparent 4/1 port default, writing "ip175c.c" VLAN support for IP175D would probably take a fair amount of work.  The only thing I can suggest is to spend the time to understand the datasheet and how to map the standard vlan features into the excessively large featureset of this switch.

Since r19014, I can't use 4 ports connected to eth1 by IP175C. The error in detect RB450 as RB450G has corrected in r19047.
I update and apply patch from ticket #5193, and the switch respond well (r19047):

ag71xx_mdio: probed
eth0: Atheros AG71xx at 0xba000000, irq 5
eth0: connected to PHY at ag71xx-mdio:04 [uid=02430d80, driver=Generic PHY]
eth1: Atheros AG71xx at 0xb9000000, irq 4
eth1: connected to 4 PHYs
eth1: connected to PHY at ag71xx-mdio:00 [uid=02430d80, driver=IC+ IP175C]

The eth0 works, but the ports connected to eth1 do not work.
I use the same confi/network that run well in r18782 (last trunk version that I had success in same board).

I have already extended the ip175c driver by Patrick Horn to handle the IP175D as well. I hope it will get merged to OpenWRT soon, as soon as it gets some testing other than on my RB450. If you are interested, feel free to ask me for a patch by e-mail to mj@ucw.cz.

I've managed to get an RB450 working with the IP175C driver with a recent trunk version and the first mod in phorn's post 107 on this thread ( replacing the switch statement in the driver ) and the config in post 110. I've set up a basic configuration so that eth1.2 maps to port 3, eth1.3 to port 2, eth1.4 to port 1 and ( predictably ) eth1.5 to port 0. The numbering is to match the labels on the case.

However, I'm having the same problem as was mentioned a few posts ago - namely that the driver ( or something ) seems to use the status of port 0 ( at least initially ) to determine the hardware state of all of the ports connected to the switch. Ports 1, 2 and 3 do not send any data ( though tcpdump shows data being sent, the counts on the interfaces for TX bytes are  0 ) UNTIL something is plugged in to port 0. When that happens, the other ports start working ( and, oddly, continue to work when the cable in port 0 is removed again. )

I can probably fix this myself using trial and error and blind hacking, but it would be a bodge... so before I try I wondered if anyone had found a fix?

(Last edited by sidepipe on 26 Mar 2010, 12:35)

Ok, to follow up my own post, and in case people are having this issue still, I've had a quick look this morning and come up with a ( as opposed to the ) fix.

The behavior above is actually logical when you consider how things are connected. In reality, the "eth1" that appears in the rb450 is connected internally to the switch, and so it doesn't really have its own phy. However. Linux assumes that it does, and so the driver just uses the first phy it finds for the switch... so, when that port is not connected, eth1 is down, and so all VLANs connected to eth1 are also, by definition, down.

It seems to me that there are a few ways to go:

1) Create a dummy phy device which is always up. Technically, this is probably the correct way.

2) On each status change of ANY of the switch ports, make the phy status for eth1 ( or whatever is connected internally ) be the logical or of all of the link states.

3) My quick hack simple approach, which simply forces the state of the existing phy to up.

To do this, modify the code as specified by phorn in post 107 of this thread, and make sure that you have the config lines mentioned in post 110. Then, add the following to target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h:

#define AG71XX_FLAG_FORCE_LINK_UP    1

Now, edit the ( already modified ) target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c as follows:

Around line 38 is if (!ag->link) {, modify this to read:

if ((!ag->link) && ((!ag->phy_dev) || (!(ag->phy_dev->dev_flags & AG71XX_FLAG_FORCE_LINK_UP)))) {

Around line 251 is an if statement which begins if (phy_count > 1) {. Replace this entire if clause with:

               if (phy_count > 1) {
                       printk(KERN_DEBUG "%s: Internally connected, Link always up\n",
                               dev->name);
               ag->phy_dev->dev_flags |= AG71XX_FLAG_FORCE_LINK_UP;
               ag->link = ag->phy_dev->link = 1;
                       ret = ag71xx_phy_connect_fixed(ag);
               }

During boot you will get a message that the port is internally connected and so always up, followed by another message that the link is up.

Note that the above files only get copied to the real kernel build tree when needed, so if you have already built an image before making these mode, you will also need to:

cp target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx* build_dir/linux-ar71xx/linux-2.6.32.8/drivers/net/ag71xx/

( If the kernel version is different to mine, then obviously the linux-2.6.32.8 will reflect this in the above cp line.

(Last edited by sidepipe on 27 Mar 2010, 10:15)

Has anyone made progress on getting the "D" version of the ip175 running on OpenWRT? so far I have had no luck getting this up and running.

Thanks,
Aaron

ceraldi wrote:

Has anyone made progress on getting the "D" version of the ip175 running on OpenWRT? so far I have had no luck getting this up and running.

Thanks,
Aaron

I asked UrsusArctos for his patch and it works with the "D" version. Now I'll test it on "C" version for a backward compatibility. You can ask him too.

UrsusArctos wrote:

I have already extended the ip175c driver by Patrick Horn to handle the IP175D as well. I hope it will get merged to OpenWRT soon, as soon as it gets some testing other than on my RB450. If you are interested, feel free to ask me for a patch by e-mail to mj@ucw.cz.

UrsusArctos wrote:

I have already extended the ip175c driver by Patrick Horn to handle the IP175D as well. I hope it will get merged to OpenWRT soon, as soon as it gets some testing other than on my RB450. If you are interested, feel free to ask me for a patch by e-mail to mj@ucw.cz.

Got this patch and just wanted to say THANKS! it works perfectly with the ip175d chip and also seams to work great on a ip178c please include this patch in the trunk or backfire releases.

-A

ceraldi wrote:
UrsusArctos wrote:

I have already extended the ip175c driver by Patrick Horn to handle the IP175D as well. I hope it will get merged to OpenWRT soon, as soon as it gets some testing other than on my RB450. If you are interested, feel free to ask me for a patch by e-mail to mj@ucw.cz.

Got this patch and just wanted to say THANKS! it works perfectly with the ip175d chip and also seams to work great on a ip178c please include this patch in the trunk or backfire releases.

-A

Hi, I can't find a way to configure my RB450 with separate ports

dmesg:
IP17xx: Found IP175D at ag71xx-mdio:00
ag71xx_mdio: probed
eth0: Atheros AG71xx at 0xba000000, irq 5
eth0: connected to PHY at ag71xx-mdio:04 [uid=02430d80, driver=Generic PHY]
eth1: Atheros AG71xx at 0xb9000000, irq 4
eth1: connected to PHY at ag71xx-mdio:00 [uid=02430d80, driver=IC+ IP17xx]

root@OpenWrt:~# swconfig dev eth1 show
Global attributes:
        enable_vlan: 1
        name: IP175D
        phy: 0
        reg: 0
        val: 12544
Port 0:
        status: up, 100 Mbps, full duplex, auto-negotiate
        link: 100
        tagged: 0
        pvid: 5
Port 1:
        status: down, auto-negotiate (in progress)
        link: 0
        tagged: 0
        pvid: 4
Port 2:
        status: down, auto-negotiate (in progress)
        link: 0
        tagged: 0
        pvid: 3
Port 3:
        status: down, auto-negotiate (in progress)
        link: 0
        tagged: 0
        pvid: 2
Port 4:
        status: down, auto-negotiate (in progress)
        link: 0
        tagged: 0
        pvid: 0
Port 5:
        status: up, 100 Mbps, cpu port
        link: 100
        tagged: 0
        pvid: 5
VLAN 0:
        tag: 1
        ports:
VLAN 1:
        tag: 2
        ports:
VLAN 2:
        tag: 3
        ports: 3 5
VLAN 3:
        tag: 4
        ports: 2 5
VLAN 4:
        tag: 5
        ports: 1 5
VLAN 5:
        tag: 6
        ports: 0 5
VLAN 6:
        tag: 7
        ports:
VLAN 7:
        tag: 8
        ports:
VLAN 8:
        tag: 9
        ports:
VLAN 9:
        tag: 10
        ports:
VLAN 10:
        tag: 11
        ports:
VLAN 11:
        tag: 12
        ports:
VLAN 12:
        tag: 13
        ports:
VLAN 13:
        tag: 14
        ports:
VLAN 14:
        tag: 15
        ports:
VLAN 15:
        tag: 16
        ports:

root@OpenWrt:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:42:5B:87:DD
          inet addr:192.168.250.250  Bcast:192.168.250.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:42ff:fe5b:87dd/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3156 (3.0 KiB)  TX bytes:468 (468.0 B)
          Interrupt:5

eth1      Link encap:Ethernet  HWaddr 00:0C:42:5B:87:DE
          inet addr:192.168.1.254  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:42ff:fe5b:87de/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:30 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4264 (4.1 KiB)  TX bytes:3036 (2.9 KiB)
          Interrupt:4

eth1.2    Link encap:Ethernet  HWaddr 00:0C:42:5B:87:DE
          inet addr:192.168.2.254  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:42ff:fe5b:87de/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:398 (398.0 B)

eth1.3    Link encap:Ethernet  HWaddr 00:0C:42:5B:87:DE
          inet addr:192.168.3.254  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:42ff:fe5b:87de/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:492 (492.0 B)

eth1.4    Link encap:Ethernet  HWaddr 00:0C:42:5B:87:DE
          inet addr:192.168.4.254  Bcast:192.168.4.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:42ff:fe5b:87de/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:492 (492.0 B)

eth1.5    Link encap:Ethernet  HWaddr 00:0C:42:5B:87:DE
          inet addr:192.168.5.254  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:42ff:fe5b:87de/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:906 (906.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1008 (1008.0 B)  TX bytes:1008 (1008.0 B)


root@OpenWrt:~# cat /etc/config/network
config interface loopback
        option ifname   lo
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0

config interface wan
        option ifname   eth0
        option proto    static
        option ipaddr   192.168.250.250
        option netmask  255.255.255.0

config interface port3
        option ifname   "eth1.2"
        option proto    static
        option ipaddr   192.168.2.254
        option netmask  255.255.255.0

config interface port2
        option ifname   "eth1.3"
        option proto    static
        option ipaddr   192.168.3.254
        option netmask  255.255.255.0

config interface port1
        option ifname   "eth1.4"
        option proto    static
        option ipaddr   192.168.4.254
        option netmask  255.255.255.0

config interface port0
        option ifname   "eth1.5"
        option proto    static
        option ipaddr   192.168.5.254
        option netmask  255.255.255.0

config switch eth1
        option name     eth1
        option reset    1
        option enable_vlan 1

config switch_vlan
        option device   eth1
        option vlan     2
        option ports    "5 3"

config switch_vlan
        option device   eth1
        option vlan     3
        option ports    "5 2"

config switch_vlan
        option device   eth1
        option vlan     4
        option ports    "5 1"

config switch_vlan
        option device   eth1
        option vlan     5
        option ports    "5 0"

I can't ping any eth1.X, just eth1 and eth0

Am I missing something?

ceraldi, can you please port your configuration?
Thank you.