8devices / carambola

Carambola - RT305x/SoC based PCB
http://openwrt.org/
GNU General Public License v2.0
26 stars 12 forks source link

not possible to confgure the ethernet switch #15

Closed e9hack closed 10 years ago

e9hack commented 11 years ago

It isn't possible to configure the switch.

An old patch is missing: https://dev.openwrt.org/ticket/9071

With this patch applied, the switch is usable for a router with one WAN and one LAN port.

valinskas commented 11 years ago

Hi,

which software version are you running ?

e9hack commented 11 years ago

I did check this with v2.0 and v2.1. Currently I'm using v2.3-rc4, but all the time with this patch. This is my configuration:

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.1' option type 'bridge' option proto 'static' option netmask '255.255.255.0' option ipaddr '192.168.101.1'

config interface 'wan' option ifname 'eth0.2' option proto 'dhcp' option macaddr 'xx:xx:xx:xx:xx:xx'

config switch option name 'rt305x' option reset '1' option enable_vlan '1'

config switch_vlan option device 'rt305x' option vlan '1' option ports '1 2 3 4 6t'

config switch_vlan option device 'rt305x' option vlan '2' option ports '0 6t'

Both ethernet ports are accesable as lan ports without the patch. With the patch, eth0.2 is the wan port.

valinskas commented 11 years ago

It is very interesting. I am using v2.3-rc4, this pre-built firmware image:

http://pkg.8devices.com/v2.3/carambola/openwrt-ramips-rt305x-carambola-squashfs-sysupgrade.bin

I don't see the problem. It works for me as router and as bridge correctly. In your case I have a suspect that maybe swconfig is missing ? Otherwise I am still puzzled.

valinskas commented 11 years ago

Can you please post a full boot log (boot loader output, kernel & etc) ?

e9hack commented 11 years ago

I build v2.1 and v2.3-rc4 without any modifications like the description from [url=http://8devices.com/wiki_carambola/doku.php/carambola_where_to_start]wiki[/url]. The switch does work with v2.3-rc4, but it doesn't work with v2.1. I check both configurations. v2.3-rc4 sets CONFIG_PACKEG_SWCONFIG=y in the main configuration and CONFIG_SWCONFIG=y for the kernel. I did change this two settings for v2.1. It doesn't help. From v2.1, I got the following boot log:[code]

U-Boot 1.1.3 (Nov  3 2009 - 15:19:34)

Board: Ralink APSoC DRAM:  32 MB
relocate_code Pointer at: 81fb0000
flash_protect ON: from 0xBF000000 to 0xBF01D4A3
flash_protect ON: from 0xBF030000 to 0xBF030FFF
============================================
Ralink UBoot Version: 3.3
--------------------------------------------
ASIC 3052_MP2 (Port5<->None)
DRAM component: 256 Mbits SDR
DRAM bus: 16 bit
Total memory: 32 MBytes
Flash component: 8 MBytes NOR Flash
Date:Nov  3 2009  Time:15:19:34
============================================
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:128, ways:4, linesz:32 ,total:16384

 ##### The CPU freq = 320 MHZ ####

SDRAM bus set to 16 bit
 SDRAM size =32 Mbytes

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   9: Load Boot Loader code then write to Flash via TFTP.
 0

3: System Boot system code via Flash.
## Booting image at bf050000 ...
   Image Name:   MIPS OpenWrt Linux-3.3.8
   Created:      2013-05-08  14:09:19 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    848534 Bytes = 828.6 kB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 32

Starting kernel ...

[    0.000000] Linux version 3.3.8 (hb@VBox-Linux) (gcc version 4.7.1 20120402 (prerelease) (Linaro GCC 4.7-2012.04) ) #1 Wed May 8 16:09:14 CEST 2013
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 0001964c (MIPS 24KEc)
[    0.000000] Ralink RT3350 id:1 rev:2 running at 320.00 MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 02000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00002000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00002000
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line:  board=CARAMBOLA console=ttyS1,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 32 bytes
[    0.000000] Writing ErrCtl register=0005f6c8
[    0.000000] Readback ErrCtl register=0005f6c8
[    0.000000] Memory: 29940k/32768k available (1931k kernel code, 2828k reserved, 323k data, 172k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:48
[    0.000000] console [ttyS1] enabled, bootconsole disabled
[    0.000000] console [ttyS1] enabled, bootconsole disabled
[    0.010000] Calibrating delay loop... 212.58 BogoMIPS (lpj=1062912)
[    0.090000] pid_max: default: 32768 minimum: 301
[    0.090000] Mount-cache hash table entries: 512
[    0.100000] NET: Registered protocol family 16
[    0.110000] MIPS: machine is CARAMBOLA
[    0.110000] gpiochip_add: registered GPIOs 0 to 23 on device: RT305X-GPIO0
[    0.120000] gpiochip_add: registered GPIOs 24 to 39 on device: RT305X-GPIO1
[    0.120000] gpiochip_add: registered GPIOs 40 to 51 on device: RT305X-GPIO2
[    0.150000] bio: create slab <bio-0> at 0
[    0.160000] Switching to clocksource MIPS
[    0.170000] NET: Registered protocol family 2
[    0.170000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.180000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.180000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.190000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.200000] TCP reno registered
[    0.200000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.210000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.210000] NET: Registered protocol family 1
[    0.260000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.270000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.280000] msgmni has been set to 58
[    0.290000] io scheduler noop registered
[    0.290000] io scheduler deadline registered (default)
[    0.300000] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.300000] serial8250: ttyS0 at MMIO 0x10000500 (irq = 13) is a 16550A
[    0.310000] serial8250: ttyS1 at MMIO 0x10000c00 (irq = 20) is a 16550A
[    0.320000] physmap platform flash device: 00800000 at bf000000
[    0.330000] physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x0000c2 Chip ID 0x0022c9
[    0.340000] Amd/Fujitsu Extended Query Table at 0x0040
[    0.350000]   Amd/Fujitsu Extended Query version 1.1.
[    0.350000] physmap-flash.0: Swapping erase regions for top-boot CFI table.
[    0.360000] number of CFI chips: 1
[    0.360000] Creating 6 MTD partitions on "physmap-flash.0":
[    0.370000] 0x000000000000-0x000000030000 : "u-boot"
[    0.380000] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.390000] 0x000000040000-0x000000050000 : "factory"
[    0.400000] 0x000000050000-0x000000170000 : "kernel"
[    0.410000] 0x000000170000-0x000000800000 : "rootfs"
[    0.420000] mtd: partition "rootfs" set to be root filesystem
[    0.420000] mtd: partition "rootfs_data" created automatically, ofs=320000, len=4E0000
[    0.430000] 0x000000320000-0x000000800000 : "rootfs_data"
[    0.440000] 0x000000050000-0x000000800000 : "firmware"
[    0.460000] TCP westwood registered
[    0.470000] NET: Registered protocol family 17
[    0.470000] 8021q: 802.1Q VLAN Support v1.8
[    0.480000] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[    0.490000] Freeing unused kernel memory: 172k freed
- preinit -
Press the [f] key and hit [enter] to enter failsafe mode
- regular preinit -
[    6.410000] JFFS2 notice: (356) jffs2_build_xattr_subsystem: complete building xattr subsystem, 18 of xdatum (0 unchecked, 17 orphan) and 20 of xref (0 dead, 17 orphan) found.
switching to jffs2
- init -

Please press Enter to activate this console. [    7.940000] Compat-wireless backport release: compat-wireless-2012-05-16-3-gde86a47
[    7.950000] Backport based on wireless-testing.git master-2012-05-29
[    7.950000] compat.git: wireless-testing.git
[    8.000000] cfg80211: Calling CRDA to update world regulatory domain
[    8.010000] cfg80211: World regulatory domain updated:
[    8.020000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    8.020000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.030000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    8.040000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    8.050000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.060000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.590000] cfg80211: World regulatory domain updated:
[    8.600000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    8.610000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.610000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    8.620000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    8.630000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.640000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.980000] SCSI subsystem initialized
[    9.200000] usbcore: registered new interface driver usbfs
[    9.200000] usbcore: registered new interface driver hub
[    9.210000] usbcore: registered new device driver usb
[    9.350000] lib80211: common routines for IEEE802.11 drivers
[    9.910000] usbcore: registered new interface driver rt2500usb
[   10.080000] phy0 -> rt2x00lib_request_eeprom_file: Info - Loading EEPROM data from 'RT305X.eeprom'.
[   10.260000] phy0 -> rt2x00_set_chip: Info - Chipset detected - rt: 2872, rf: 0005, rev: 0200.
[   10.320000] usbcore: registered new interface driver rt2800usb
[   10.630000] PPP generic driver version 2.4.2
[   10.780000] gpiodev: gpio device registered with major 254
[   10.950000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   11.150000] NET: Registered protocol family 24
[   11.490000] nf_conntrack version 0.5.0 (470 buckets, 1880 max)
[   12.070000] i2c /dev entries driver
[   12.100000] dwc_otg: version 2.72a 24-JUN-2008
[   12.110000] dwc_otg: Core Release: 2.66a
[   12.310000] dwc_otg: Periodic Transfer Interrupt Enhancement - disabled
[   12.320000] dwc_otg: Multiprocessor Interrupt Enhancement - disabled
[   12.330000] dwc_otg: Using DMA mode
[   12.330000] dwc_otg: Device using Buffer DMA mode
[   12.330000] dwc_otg dwc_otg.0: DWC OTG Controller
[   12.340000] dwc_otg dwc_otg.0: new USB bus registered, assigned bus number 1
[   12.350000] dwc_otg dwc_otg.0: irq 26, io mem 0x101c0000
[   12.350000] dwc_otg: Init: Port Power? op_state=1
[   12.360000] dwc_otg: Init: Power Port (0)
[   12.360000] hub 1-0:1.0: USB hub found
[   12.360000] hub 1-0:1.0: 1 port detected
[   12.410000] i2c-gpio i2c-gpio.0: using pins 1 (SDA) and 2 (SCL)
[   12.610000] Initializing USB Mass Storage driver...
[   12.620000] usbcore: registered new interface driver usb-storage
[   12.620000] USB Mass Storage support registered.
[   15.590000] device eth0.1 entered promiscuous mode
[   15.600000] device eth0 entered promiscuous mode
[   15.610000] br-lan: port 1(eth0.1) entered forwarding state
[   15.610000] br-lan: port 1(eth0.1) entered forwarding state
[   17.610000] br-lan: port 1(eth0.1) entered forwarding state
[   17.910000] cfg80211: Calling CRDA for country: DE
[   17.910000] cfg80211: Regulatory domain changed to country: DE
[   17.920000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[   17.930000] cfg80211:   (2400000 KHz - 2483000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[   17.940000] cfg80211:   (5150000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[   17.940000] cfg80211:   (5250000 KHz - 5350000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[   17.950000] cfg80211:   (5470000 KHz - 5725000 KHz @ 40000 KHz), (N/A, 2700 mBm)
[   19.150000] ramips-wdt: timeout value 60 must be 0 < timeout < 40
[   20.810000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 5, CWmax: 10, Aifs: 2, TXop: 0.
[   20.820000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 5, CWmax: 10, Aifs: 2, TXop: 0.
[   20.830000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5, CWmax: 10, Aifs: 2, TXop: 0.
[   20.840000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5, CWmax: 10, Aifs: 2, TXop: 0.
[   20.920000] device wlan0 entered promiscuous mode
[   20.980000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 3, CWmax: 4, Aifs: 2, TXop: 102.
[   20.990000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 4, CWmax: 5, Aifs: 2, TXop: 188.
[   21.000000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5, CWmax: 10, Aifs: 3, TXop: 0.
[   21.010000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5, CWmax: 10, Aifs: 7, TXop: 0.
[   21.950000] br-lan: port 2(wlan0) entered forwarding state
[   21.950000] br-lan: port 2(wlan0) entered forwarding state
[   21.970000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 2, CWmax: 3, Aifs: 1, TXop: 47.
[   21.990000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 3, CWmax: 4, Aifs: 1, TXop: 94.
[   22.010000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 4, CWmax: 6, Aifs: 3, TXop: 0.
[   22.030000] phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 4, CWmax: 10, Aifs: 7, TXop: 0.
[   23.950000] br-lan: port 2(wlan0) entered forwarding state

BusyBox v1.19.4 (2013-05-07 23:10:05 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 ATTITUDE ADJUSTMENT (Bleeding Edge, r32074)
 -----------------------------------------------------
  * 1/4 oz Vodka      Pour all ingredients into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
 -----------------------------------------------------
root@WLAN-DSL6b:/#

[/code]

valinskas commented 11 years ago

Hi,

U-Boot 1.1.3 (Nov  3 2009 - 15:19:34)
Ralink UBoot Version: 3.3

It should have been like

U-Boot 1.1.3 (Feb 20 2012 - 16:20:22)                                                                                          

Board: Ralink APSoC DRAM:  32 MB                                                                                               
relocate_code Pointer at: 81fb0000                                                                                             
config usb..                                                                                                                   
flash_protect ON: from 0xBF000000 to 0xBF01E757                                                                                
flash_protect ON: from 0xBF030000 to 0xBF030FFF                                                                                
============================================                                                                                   
Ralink UBoot Version: 3.5.0.0

My guess is that newer bootloader leaves SYSC_REG_GPIO_MODE in correct state ? Whereas an older v3.3 boot-loader eaves SYSC_REG_GPIO_MODE incorrectly setup and breaks things ?

What do you think about my theory ?

valinskas commented 11 years ago

BTW,

why do you want to use older carambola/v2.1 instead of carambola/v2.3-rc4 (the latest greatest stable) ?

e9hack commented 11 years ago

Currently I'm using trunk. I did never remove this patch because the kernel didn't change between 2.1 and 2.3. The more interesting part is, what did change from 2.1 to 2.3 that the patch isn't necessary anymore.

valinskas commented 11 years ago

Hi,

204 line build_dir/linux-ramips_rt305x/linux-3.3.8/arch/mips/ralink/rt305x/rt305x.c ?

200 void __init rt305x_gpio_init(u32 mode)
201 {
202         u32 t;
203 
204         rt305x_sysc_wr(mode, SYSC_REG_GPIO_MODE);
205 
206         ramips_gpio_init(&rt305x_gpio_data);
207         if ((mode & RT305X_GPIO_MODE_I2C) == 0)