From: eLinux.org

Flameman/routerboard-rb532

\< Flameman

For more interesting projects done by Flameman, be sure to check out his
project index

Contents

RouterBoard-rb532-Flameman

Note

i’m developing for this board, the wiki page will be improved soon

feel free to contact me (see the contact below)

Introduction

The Target-goal of this page is

  • install gentoo-mipsel into microdrive
  • make the board able to boot from it
  • describe how to build a jtag cable (to debug and recover from
    “Brickage”)
  • describe something useful with you can do with the board
  • describe other Operating Systems avalaible for the board

logical steps about installing gentoo

  • add the JTAG connector at J10 (you could skip it, it is suggested)
  • build the JTAG cable (you could skip it, it is suggested))
  • study the bootloader
  • make partitions on the microdrive
  • populate them
  • set the bootloader environment to boot from the microdrive

People you could contact if you need help

  • flameman, i’m currently use this board for a project, email
  • you … if you want ;-)

About the board

rb532 is a shortened name for the routerboard

you could get your board from
http://routerboard.com/rb500.html

see the nearest reseller of the area where you live mind a brand new
boards costs 140Euro + shipping and VAT cheaper way requires (fortune
and) ebay searched for

features

  1. * MIPS 32 4Kc based 266MHz (BIOS adjustable from 200 to 333 MHz; 400MHz processor factory option) embedded processor
  2. * 32MB DDR onboard memory
  3. * Boot loader, RouterBOOT, 1Mbit Flash chip
  4. * Data storage, 128MB onboard
  5. * CompactFlash type I/II slot (also supports IBM/Hitachi Microdrive)
  6. * Two VIA VT6105, One IDT Korina, 10/100 Mbit/s Fast Ethernet
  7. * Two MiniPCI Type IIIA/IIIB slots
  8. * Daughterboard connector Present
  9. * One DB9 RS232C asynchronous serial port
  10. * LEDs. Power, 2 LED pairs for MiniPCI slots, 1 user LED
  11. * Watchdog IDT internal SoC hardware watchdog timer
  12. * IEEE802.3af Power over Ethernet: 12V or 48V DC Power jack: 11..60V DC
  13. * Power jack/header 6..22V or 25..56V DC jumper selectable.
  14. * Dimensions. 14.0 cm x 14.0 cm (5.51 in x 5.51 in)
  15. * Temperature. Operational: -20°C to +70°C (-4°F to 158°F)
  16. * Humidity. Operational: 70% relative humidity (non-condensing)
  17. * Currently supported OS. RouterOS 2.9, Linux 2.4, Linux 2.6

Overview

The board consists of:

  • CPU IDT MIPS 79RC32434, a solid & smart implementation of the
    mipsel little endian MIPS 32 4Kcore CPU architecture, running at
    400mhz (adjustable from 200 to 400MHz; 400MHz default and
    recommended)
  • RAM soldered 64MB DDR onboard memory chip
  • LAN On-chip 3 ethernet: One IDT Korina 10/100 Mbit/s Fast
    Ethernet port supporting Auto-MDI/X, Two VIA VT6105 10/100 Mbit/s
    Fast Ethernet ports supporting Auto-MDI/X.
  • UART One DB9 RS232C asynchronous serial port, speeds up to 230k,
    tested up to 115200bps
  • miniPCI Two MiniPCI Type IIIA/IIIB slots
  • CF support for IBM/Hitachi Microdrive (http://eLinux.org/dev/cfa)
  • ROM 1Mbit NAND flash where it is stored the bootloader
  • POWER IEEE802.3af Power over Ethernet: 12V or 48V DC, Power
    jack/header 6..22V or 25..56V DC jumper selectable. PoE does not
    support power over datalines
  • System PCB 14.0 cm x 14.0 cm
  • RTC the real time clock chip is missing
  • LED Power, 2 LED pairs for MiniPCI slots, 1 user LED
  • Watchdog IDT internal SoC hardware watchdog timer

NOTE: from the base configuration of 3 Ethernet ports and 2 MiniPCI
slots (for wireless cards) it can be extended by using daughterboards
for four more MiniPCI slots, or even up to a total of 15 interfaces (9
Ethernet ports and 6 MiniPCI slots). A wide range of accepted input
power means that you can connect to almost any direct current power
source you already have on site. It also can be powered through an
Ethernet port using Power-over-Ethernet technology (802.3af) or passive
non-standard PoE.

NOTE2: there is a daughterboard for the RB532. It is called RouterBOARD
564, and It attaches to the RB532 by means of special daughterboard
connector and adds four more MiniPCI slots and six ethernet ports. You
can not use more than two AR5414 chipset (e.g. R52) cards in RB/564. If
you want to use three or four miniPCI cards in RB/564, you should use
other chipset based ones for those extra slots, like CM9. For example,
two R52 + two CM9 is OK, four CM9 is also OK, but not three or four R52.

Memory Locations

memory map of the board will be added as soon as possible





















addr beginaddr endarea
??ram, userspace
400000 ??ram, userspace

Open questions


1) how/where is ram mapped ?

2) how/where is microdrive mapped ?

3) how/where is pci mapped ?

3) what is the bootstrap addr of the flash ?

Problems

Images of the board

Rb532r5 s.jpg

also see a detailed imate @ www routerboard.com/img/rb500_l.jpg

Kernel

status

Korina ethernet VIA Rhine

Rhine-I-VT86C100A x Rhine-II-VT6102 Rhine-III-VT6105









































versionhosttargettoolchainnote
2.6.22 vanilla+patchcompiled on ppc-7410, minervaarc=mips-el, target=mips-1gcc-4.1.2-glibc binutils-2.19rocks, 6 days uptime hardly compiling, korina sometime stalls, VIA works
2.6.24 vanilla+patchcompiled on ppc-7410, minervaarc=mips-el, target=mips-1gcc-4.1.2-glibc binutils-2.19korina is now working, VIA works (korina and VIA statically compiled)
2.6.30.6 vanilla+patch —- REMOVED from kernel tree line —-compiled on ppc-7410, minervaarc=mips-el, target=mips-1gcc-4.1.2-glibc binutils-2.19korina is working, VIA is not working, name eth0 inversion, korina is not eth0, korina and VIA statically compiled, the suggestion looks like compiling the via-rhine driver as module and load it after the korina, this may works for 2.6.30.6,2.6.30.5,2.6.30.1 also with rc6
2.6.37 vanilla+patchcompiled on ppc-7550, vittoriaarc=mips-el, target=mips-1gcc-4.1.2-glibc binutils-2.19korina is working, VIA is working, intel-ipw2200(wifi minipci) is working (with an hack), cmdline patched, kernel-panik() has been patched

download

kernel 2.6.22 full tested and working
kernel-gentoo-rb532-2.6.22.gz
(suggested for production)

rootfs

dev

cfa

mknod /dev/cfa b 13 0 mknod /dev/cfa1 b 13 1 mknod /dev/cfa2 b 13 2
mknod /dev/cfa3 b 13 3

gpio

sources

http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/arch/mips/rb532/gpio.c

gpio.c

  1. arch.mips.rb532.gpio
  2. 001 /*
  3. 002 * Miscellaneous functions for IDT EB434 board
  4. 003 *
  5. 004 * 2004 IDT Inc. (rischelp@idt.com)
  6. 005 * 2006 Phil Sutter <n0-1@freewrt.org>
  7. 006 * 2007 Florian Fainelli <florian@openwrt.org>
  8. 007 *
  9. 027 */
  10. 028
  11. 029 #include <linux/kernel.h>
  12. 030 #include <linux/gpio.h>
  13. 031 #include <linux/init.h>
  14. 032 #include <linux/types.h>
  15. 033 #include <linux/pci.h>
  16. 034 #include <linux/spinlock.h>
  17. 035 #include <linux/io.h>
  18. 036 #include <linux/platform_device.h>
  19. 037
  20. 038 #include <asm/addrspace.h>
  21. 039
  22. 040 #include <asm/mach-rc32434/rb.h>
  23. 041
  24. 042 struct rb532_gpio_reg __iomem *rb532_gpio_reg0;
  25. 043 EXPORT_SYMBOL(rb532_gpio_reg0);
  26. 044
  27. 045 struct mpmc_device dev3;
  28. 046
  29. 047 static struct resource rb532_gpio_reg0_res[] = {
  30. 048 {
  31. 049 .name = "gpio_reg0",
  32. 050 .start = (u32)(IDT434_REG_BASE + GPIOBASE),
  33. 051 .end = (u32)(IDT434_REG_BASE + GPIOBASE + sizeof(struct rb532_gpio_reg)),
  34. 052 .flags = IORESOURCE_MEM,
  35. 053 }
  36. 054 };
  37. 055
  38. 056 static struct resource rb532_dev3_ctl_res[] = {
  39. 057 {
  40. 058 .name = "dev3_ctl",
  41. 059 .start = (u32)(IDT434_REG_BASE + DEV3BASE),
  42. 060 .end = (u32)(IDT434_REG_BASE + DEV3BASE + sizeof(struct dev_reg)),
  43. 061 .flags = IORESOURCE_MEM,
  44. 062 }
  45. 063 };
  46. 064
  47. 065 void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val)
  48. 066 {
  49. 067 unsigned long flags;
  50. 068 unsigned data;
  51. 069 unsigned i = 0;
  52. 070
  53. 071 spin_lock_irqsave(&dev3.lock, flags);
  54. 072
  55. 073 data = *(volatile unsigned *) (IDT434_REG_BASE + reg_offs);
  56. 074 for (i = 0; i != len; ++i) {
  57. 075 if (val & (1 << i))
  58. 076 data |= (1 << (i + bit));
  59. 077 else
  60. 078 data &= ~(1 << (i + bit));
  61. 079 }
  62. 080 writel(data, (IDT434_REG_BASE + reg_offs));
  63. 081
  64. 082 spin_unlock_irqrestore(&dev3.lock, flags);
  65. 083 }
  66. 084 EXPORT_SYMBOL(set_434_reg);
  67. 085
  68. 086 unsigned get_434_reg(unsigned reg_offs)
  69. 087 {
  70. 088 return readl(IDT434_REG_BASE + reg_offs);
  71. 089 }
  72. 090 EXPORT_SYMBOL(get_434_reg);
  73. 091
  74. 092 void set_latch_u5(unsigned char or_mask, unsigned char nand_mask)
  75. 093 {
  76. 094 unsigned long flags;
  77. 095
  78. 096 spin_lock_irqsave(&dev3.lock, flags);
  79. 097
  80. 098 dev3.state = (dev3.state | or_mask) & ~nand_mask;
  81. 099 writel(dev3.state, &dev3.base);
  82. 100
  83. 101 spin_unlock_irqrestore(&dev3.lock, flags);
  84. 102 }
  85. 103 EXPORT_SYMBOL(set_latch_u5);
  86. 104
  87. 105 unsigned char get_latch_u5(void)
  88. 106 {
  89. 107 return dev3.state;
  90. 108 }
  91. 109 EXPORT_SYMBOL(get_latch_u5);
  92. 110
  93. 111 int rb532_gpio_get_value(unsigned gpio)
  94. 112 {
  95. 113 return readl(&rb532_gpio_reg0->gpiod) & (1 << gpio);
  96. 114 }
  97. 115 EXPORT_SYMBOL(rb532_gpio_get_value);
  98. 116
  99. 117 void rb532_gpio_set_value(unsigned gpio, int value)
  100. 118 {
  101. 119 unsigned tmp;
  102. 120
  103. 121 tmp = readl(&rb532_gpio_reg0->gpiod) & ~(1 << gpio);
  104. 122 if (value)
  105. 123 tmp |= 1 << gpio;
  106. 124
  107. 125 writel(tmp, (void *)&rb532_gpio_reg0->gpiod);
  108. 126 }
  109. 127 EXPORT_SYMBOL(rb532_gpio_set_value);
  110. 128
  111. 129 int rb532_gpio_direction_input(unsigned gpio)
  112. 130 {
  113. 131 writel(readl(&rb532_gpio_reg0->gpiocfg) & ~(1 << gpio),
  114. 132 (void *)&rb532_gpio_reg0->gpiocfg);
  115. 133
  116. 134 return 0;
  117. 135 }
  118. 136 EXPORT_SYMBOL(rb532_gpio_direction_input);
  119. 137
  120. 138 int rb532_gpio_direction_output(unsigned gpio, int value)
  121. 139 {
  122. 140 gpio_set_value(gpio, value);
  123. 141 writel(readl(&rb532_gpio_reg0->gpiocfg) | (1 << gpio),
  124. 142 (void *)&rb532_gpio_reg0->gpiocfg);
  125. 143
  126. 144 return 0;
  127. 145 }
  128. 146 EXPORT_SYMBOL(rb532_gpio_direction_output);
  129. 147
  130. 148 void rb532_gpio_set_int_level(unsigned gpio, int value)
  131. 149 {
  132. 150 unsigned tmp;
  133. 151
  134. 152 tmp = readl(&rb532_gpio_reg0->gpioilevel) & ~(1 << gpio);
  135. 153 if (value)
  136. 154 tmp |= 1 << gpio;
  137. 155 writel(tmp, (void *)&rb532_gpio_reg0->gpioilevel);
  138. 156 }
  139. 157 EXPORT_SYMBOL(rb532_gpio_set_int_level);
  140. 158
  141. 159 int rb532_gpio_get_int_level(unsigned gpio)
  142. 160 {
  143. 161 return readl(&rb532_gpio_reg0->gpioilevel) & (1 << gpio);
  144. 162 }
  145. 163 EXPORT_SYMBOL(rb532_gpio_get_int_level);
  146. 164
  147. 165 void rb532_gpio_set_int_status(unsigned gpio, int value)
  148. 166 {
  149. 167 unsigned tmp;
  150. 168
  151. 169 tmp = readl(&rb532_gpio_reg0->gpioistat);
  152. 170 if (value)
  153. 171 tmp |= 1 << gpio;
  154. 172 writel(tmp, (void *)&rb532_gpio_reg0->gpioistat);
  155. 173 }
  156. 174 EXPORT_SYMBOL(rb532_gpio_set_int_status);
  157. 175
  158. 176 int rb532_gpio_get_int_status(unsigned gpio)
  159. 177 {
  160. 178 return readl(&rb532_gpio_reg0->gpioistat) & (1 << gpio);
  161. 179 }
  162. 180 EXPORT_SYMBOL(rb532_gpio_get_int_status);
  163. 181
  164. 182 void rb532_gpio_set_func(unsigned gpio, int value)
  165. 183 {
  166. 184 unsigned tmp;
  167. 185
  168. 186 tmp = readl(&rb532_gpio_reg0->gpiofunc);
  169. 187 if (value)
  170. 188 tmp |= 1 << gpio;
  171. 189 writel(tmp, (void *)&rb532_gpio_reg0->gpiofunc);
  172. 190 }
  173. 191 EXPORT_SYMBOL(rb532_gpio_set_func);
  174. 192
  175. 193 int rb532_gpio_get_func(unsigned gpio)
  176. 194 {
  177. 195 return readl(&rb532_gpio_reg0->gpiofunc) & (1 << gpio);
  178. 196 }
  179. 197 EXPORT_SYMBOL(rb532_gpio_get_func);
  180. 198
  181. 199 int __init rb532_gpio_init(void)
  182. 200 {
  183. 201 rb532_gpio_reg0 = ioremap_nocache(rb532_gpio_reg0_res[0].start,
  184. 202 rb532_gpio_reg0_res[0].end -
  185. 203 rb532_gpio_reg0_res[0].start);
  186. 204
  187. 205 if (!rb532_gpio_reg0) {
  188. 206 printk(KERN_ERR "rb532: cannot remap GPIO register 0\n");
  189. 207 return -ENXIO;
  190. 208 }
  191. 209
  192. 210 dev3.base = ioremap_nocache(rb532_dev3_ctl_res[0].start,
  193. 211 rb532_dev3_ctl_res[0].end -
  194. 212 rb532_dev3_ctl_res[0].start);
  195. 213
  196. 214 if (!dev3.base) {
  197. 215 printk(KERN_ERR "rb532: cannot remap device controller 3\n");
  198. 216 return -ENXIO;
  199. 217 }
  200. 218
  201. 219 return 0;
  202. 220 }
  203. 221 arch_initcall(rb532_gpio_init);

About Gentoo

the kernel bootstrap from the micro drive

Rb532 md.jpg

what/where

dmesg

on 04-12-2007 i was able to compile a perfectly working kernel 2.6.22,
here the dmesg

  1. Version 2.6.22-manatnees-batman-mipsel-rb532 (root@queen-vittoria)
  2. (gcc version 4.1.2 (Gentoo 4.1.2 p1.0.2)) #6 Tue Dec 4 17:12:23 CET 2007
  3. CPU revision is: 0001800a
  4. Determined physical RAM map:
  5. memory: 03fffa00 @ 00000400 (usable)
  6. Wasting 32 bytes for tracking 1 unused pages
  7. Initrd not found or empty - disabling initrd
  8. On node 0 totalpages: 16383
  9. Normal zone: 127 pages used for memmap
  10. Normal zone: 0 pages reserved
  11. Normal zone: 16256 pages, LIFO batch:3
  12. Built 1 zonelists. Total pages: 16256
  13. Kernel command line: root=/dev/cfa3 console=ttyS0,9600
  14. gpio=8191 kmac=00:0C:42:0E:8F:01 board=500r5 boot=1
  15. korina mac = 00:0C:42:0E:8F:01
  16. Primary instruction cache 8kB, physically tagged, 4-way, linesize 16 bytes.
  17. Primary data cache 8kB, 4-way, linesize 16 bytes.
  18. Synthesized TLB refill handler (20 instructions).
  19. Synthesized TLB load handler fastpath (32 instructions).
  20. Synthesized TLB store handler fastpath (32 instructions).
  21. Synthesized TLB modify handler fastpath (31 instructions).
  22. Initializing IRQ's: 168 out of 256
  23. PID hash table entries: 256 (order: 8, 1024 bytes)
  24. calculating r4koff... 001e846c(1999980)
  25. CPU frequency 400.00 MHz
  26. Using 199.998 MHz high precision timer.
  27. Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
  28. Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
  29. Memory: 61120k/65528k available
  30. (2187k kernel code, 4348k reserved, 352k data, 120k init, 0k highmem)
  31. Calibrating delay loop... 398.95 BogoMIPS (lpj=1994752)
  32. Mount-cache hash table entries: 512
  33. NET: Registered protocol family 16
  34. PCI: Initializing PCI
  35. registering PCI controller with io_map_base unset
  36. NET: Registered protocol family 2
  37. Time: MIPS clocksource has been installed.
  38. IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
  39. TCP established hash table entries: 2048 (order: 2, 16384 bytes)
  40. TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
  41. TCP: Hash tables configured (established 2048 bind 2048)
  42. TCP reno registered
  43. Registering mini_fo version $Id$
  44. JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
  45. yaffs Dec 4 2007 17:07:52 Installing.
  46. io scheduler noop registered
  47. io scheduler deadline registered (default)
  48. Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
  49. serial8250: ttyS0 at MMIO 0x0 (irq = 104) is a 16550A
  50. cf-mips module loaded
  51. cf-mips: resetting..
  52. cf-mips: identify drive..
  53. cf-mips: CF card detected, C/H/S=3968/16/63 sectors=3999744 (1953MB)
  54. cf-mips: detecting block size
  55. cf-mips: multiple sectors = 32
  56. init done: cfa: cfa1 cfa2 cfa3
  57. Using NAPI with weight 64
  58. eth0: Rx IRQ 40, Tx IRQ 41, 00:0c:42:0e:8f:01
  59. via-rhine.c:v1.10-LK1.4.3 2007-03-06 Written by Donald Becker
  60. PCI: Enabling device 0000:00:02.0 (0080 -> 0083)
  61. PCI: Setting latency timer of device 0000:00:02.0 to 64
  62. io_map_base of root PCI bus 0000:00 unset. Trying to continue but you better
  63. fix this issue or report it to linux-mips@linux-mips.org or your vendor.
  64. eth1: VIA Rhine III at 0xb8800000, 00:0c:42:0e:8f:02, IRQ 142.
  65. eth1: MII PHY found at address 1, status 0x7849 advertising 05e1 Link 0000.
  66. PCI: Enabling device 0000:00:03.0 (0080 -> 0083)
  67. PCI: Setting latency timer of device 0000:00:03.0 to 64
  68. eth2: VIA Rhine III at 0xb8800100, 00:0c:42:0e:8f:03, IRQ 143.
  69. eth2: MII PHY found at address 1, status 0x7849 advertising 05e1 Link 0000.
  70. block2mtd: version $Revision: 1.30 $
  71. NAND device: Manufacturer ID: 0xad, Chip ID: 0xf1 (Hynix NAND 128MiB 3,3V 8-bit)
  72. Scanning device for bad blocks
  73. Bad eraseblock 92 at 0x00b80000
  74. Creating 2 MTD partitions on "NAND 128MiB 3,3V 8-bit":
  75. 0x00000000-0x00400000 : "Routerboard NAND boot"
  76. 0x00400000-0x08000000 : "rootfs"
  77. mtd: partition "rootfs" set to be root filesystem
  78. split_squasfs: no squashfs found in "NAND 128MiB 3,3V 8-bit"
  79. Registered led device: rb500led:amber
  80. nf_conntrack version 0.5.0 (511 buckets, 4088 max)
  81. ip_tables: (C) 2000-2006 Netfilter Core Team
  82. TCP vegas registered
  83. NET: Registered protocol family 1
  84. NET: Registered protocol family 17
  85. 802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
  86. All bugs added by David S. Miller <davem@redhat.com>
  87. EXT3-fs: INFO: recovery required on readonly filesystem.
  88. EXT3-fs: write access will be enabled during recovery.
  89. kjournald starting. Commit interval 5 seconds
  90. EXT3-fs: recovery complete.
  91. EXT3-fs: mounted filesystem with ordered data mode.
  92. VFS: Mounted root (ext3 filesystem) readonly.
  93. Freeing unused kernel memory: 120k freed
  94. Algorithmics/MIPS FPU Emulator v1.5
  95. EXT3 FS on cfa3, internal journal

@15-02-2009 i have to update the kernel to 2.6.26/2.6.28 (still under
proof status in my repositories) and i am looking for {miniPCI-sATA,
miniPCI-netwifi}

About devtools

@16-02-2009

you can ask me a working kernel tarball of the sources

Project

Router 3 port ethernet

coming soon

Category: