Skip to content

Atheros ReferencePB47

Sean Bruno edited this page May 22, 2014 · 1 revision

Atheros PB47 Reference board

Introduction

The Atheros PB47 is an AR7161 based, single Mini-PCI+ slot reference board.

Hardware

  • AR7161, 680MHz
  • 64MB RAM
  • 8MB SPI flash
  • 1 x AR8021 10/100/1000BaseT ethernet PHY (attached to arge1)
  • 1 x Akros Silicon AS1834
  • 2 x USB ports
  • 1 x Mini-PCI+ slot (see blow)
  • 1 x xMII slot

Mini-PCI+

The Mini-PCI+ slot is designed for a specific development NIC which featured two AR9220 chips on one Mini-PCI slot. The slot works fine for normal Atheros Mini-PCI NICs.

Software

  • uboot bootloader

Flash layout

The default flash layout is:

  • uboot: 192k
  • env: 64k
  • rootfs: 6144k
  • uimage (kernel): 1728k
  • ART: 64k

To store the configuration, the PB47.hints file defines rootfs as 6080k and a 64k "cfg" partition:

  • uboot: 192k
  • env: 64k
  • rootfs: 6080k
  • cfg: 64k
  • uimage (kernel): 1728k
  • ART: 64k

Booting

U-Boot 1.1.4 (Mar 12 2010 - 12:33:34)

PB47 (ar7100) U-boot 
Frequency: CPU 680 MHz, DDR 340 MHz, AHB 170MHz 
DRAM:  b8050000: 0xc0140180
64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 219k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
id read 0x100000ff
flash size 8MB, sector count = 128
Flash:  8 MB
In:    serial
Out:   serial
Err:   serial
Net:   ag7100_enet_initialize...
ATHRF1E: 
No phy found for unit 0
eth0: 00:03:7f:11:02:bf
eth0 up
ATHRF1E: Port 1, Auto-Negotiation timeout
eth1: 00:03:7f:11:02:c0
eth1 up
eth0, eth1
Hit any key to stop autoboot:  0 
ar7100> 

Default environment:

ar7100> printenv
bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mem=64M mtdparts=ar7100-nor0:192k(u-boot),64k(env),6144k(rootfs),1728k(uImage),64k(caldata)
bootcmd=bootm 0xbf640000
bootdelay=4
baudrate=115200
loadAll=run loadUboot;run loadLinux;run loadFiles
serverip=192.168.1.1
ipaddr=192.168.1.2
loadUboot=tftp 0x80010000 pb47/u-boot.bin;erase 0xbf000000 +0x30000;cp.b 0x80010000 0xbf000000 0x30000
loadFiles=tftp 0x80010000 pb47/pb47-jffs2;erase 0xbf040000 +0x600000;cp.b 0x80010000 0xbf040000 0x600000
ethact=eth0
loadLinux=tftp 0x80010000 pb47/vmlinux.gz.uImage;erase 0xbf640000 +0x120000;cp.b 0x80010000 0xbf640000 0x120000
stdin=serial
stdout=serial
stderr=serial

Environment size: 682/65532 bytes

Please note that the "loadLinux" command stored in the above has an incorrect length (~ 1.1MB.) Thus the kernel stored in flash can be quite a bit larger.

Also, the length of the filesystem is 64K shorter than above, ie 0x5ff000 rather than 0x600000.

Building

FreeBSD-HEAD has the required code and kernel configuration file (sys/mips/conf/PB47.) The build system scripts are just used to build a copy of the software.

Note: Unless you're running a FreeBSD-HEAD snapshot, you'll need to compile/install mkulzma from FreeBSD-HEAD. Just "cd /path/to/head/src/usr.bin/mkulzma/ && make && make install && make clean" as root.

/path/to/build pb47 buildworld buildkernel installworld installkernel distribution mfsroot fsimage uboot

Please note that the fsimage build will generate a ulzma filesystem image and this can take quite a long time!

This will generate:

  • /tftpboot/kernel.PB47 : netbootable kernel, root from flash
  • /tftpboot/kernel.PB47.lzma.uImage : uImage version of the kernel, suitable for booting
  • /tftpboot/mfsroot-pb47.img.ulzma : filesystem image

Flashing

Flashing kernel:

ar7100> setenv ipaddr 192.168.1.10
ar7100> setenv serverip 192.168.1.16
ar7100> tftp 0x80010000 kernel.PB47.lzma.uImage
Trying eth0
eth0 link down
FAIL
Trying eth1
Using eth1 device
TFTP from server 192.168.1.16; our IP address is 192.168.1.10
Filename 'kernel.PB47.lzma.uImage'.
Load address: 0x80010000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         ##############
done
Bytes transferred = 1400707 (155f83 hex)
ar7100> erase 0xbf640000 +0x1b0000
Erase Flash from 0xbf640000 to 0xbf7effff in Bank # 1 
First 0x64 last 0x7e sector size 0x10000                                                                               126
Erased 27 sectors
ar7100> cp.b 0x80010000 0xbf640000 0x1b0000
Copy to Flash... write addr: bf640000
done
ar7100> 

Flashing rootfs:

ar7100> tftp 0x80010000 mfsroot-pb47.img.ulzma
Trying eth0
eth0 link down
FAIL
Trying eth1
Using eth1 device
TFTP from server 192.168.1.16; our IP address is 192.168.1.10Filename 'mfsroot-pb47.img.ulzma'.Load address: 0x80010000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #######################################
done
Bytes transferred = 3858944 (3ae200 hex)
ar7100> erase 0xbf040000 +0x5ff000
Erase Flash from 0xbf040000 to 0xbf63ffff in Bank # 1
First 0x4 last 0x62 sector size 0x10000                                                                                 98
Erased 95 sectors                                                                                                         
ar7100> cp.b 0x80010000 0xbf040000 0x5ff000
Copy to Flash... write addr: bf040000
done

Configuring

(todo)

Issues/TODO

  • For some reason, booting a kernel with AH_DEBUG enabled (and thus turning HAL register operations into functions) ends up crashing the kernel at first boot. A reset fixes this. There's no clear reason why this is (yet) occuring.
  • The system MAC needs to be read from the uboot environment and used at system boot.

FreeBSD boot example

U-Boot 1.1.4 (Mar 12 2010 - 12:33:34)
  
PB47 (ar7100) U-boot
Frequency: CPU 680 MHz, DDR 340 MHz, AHB 170MHz
DRAM:  b8050000: 0xc0140180
64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 219k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
id read 0x100000ff
flash size 8MB, sector count = 128
Flash:  8 MB
In:    serial
Out:   serial
Err:   serial
Net:   ag7100_enet_initialize...
ATHRF1E:
No phy found for unit 0
eth0: 00:03:7f:11:02:bf
eth0 up
ATHRF1E: Port 1, Auto-Negotiation timeout
eth1: 00:03:7f:11:02:c0
eth1 up
eth0, eth1
Hit any key to stop autoboot:  0
## Booting image at bf640000 ...
   Image Name:   FreeBSD
   Created:      2012-01-05   5:47:13 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1400643 Bytes =  1.3 MB
   Load Address: 80050000
   Entry Point:  80050100
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80050100) ...
## Giving linux memsize in bytes, 67108864
  
Starting kernel ...

CPU platform: Atheros AR7161 rev 2
CPU Frequency=680 MHz
CPU DDR Frequency=340 MHz
CPU AHB Frequency=170 MHz
platform frequency: 680000000
arguments:
  a0 = 00000007
  a1 = a3f77fb0
  a2 = a3f78450
  a3 = 00000008
Cmd line:argv is invalid
Environment:
envp is invalid
Cache info:
  picache_stride    = 4096
  picache_loopcount = 16
  pdcache_stride    = 4096
  pdcache_loopcount = 8
cpu0: MIPS Technologies processor v116.147
  MMU: Standard TLB, 16 entries
  L1 i-cache: 4 ways of 512 sets, 32 bytes per line
  L1 d-cache: 4 ways of 256 sets, 32 bytes per line
  Config1=0x9ee3519e<PerfCount,WatchRegs,MIPS16,EJTAG>
  Config3=0x20
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2012 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.0-CURRENT #6 r229544:229560M: Thu Jan  1 08:00:00 WST 1970
    adrian@dummy:/home/adrian/work/freebsd/head/obj/mipseb/mips.mipseb/home/adrian/work/freebsd/head/src/sys/PB47 mips
WARNING: WITNESS option enabled, expect reduced performance.
MEMGUARD DEBUGGING ALLOCATOR INITIALIZED:
        MEMGUARD map base: 0xc0400000
        MEMGUARD map limit: 0xc1800000
        MEMGUARD map size: 20480 KBytes
real memory  = 67108864 (65536K bytes)
avail memory = 57749504 (55MB)
nexus0: <MIPS32 root nexus>
clock0: <Generic MIPS32 ticker> on nexus0
Timecounter "MIPS32" frequency 340000000 Hz quality 800
Event timer "MIPS32" frequency 340000000 Hz quality 800
apb0 at irq 4 on nexus0
uart0: <16550 or compatible> on apb0
uart0: console (115200,n,8,1)
gpio0: <Atheros AR71XX GPIO driver> on apb0
gpio0: [GIANT-LOCKED]
gpio0: function_set: 0x0
gpio0: function_clear: 0x0
gpio0: gpio pinmask=0xc
gpioc0: <GPIO controller> on gpio0
gpiobus0: <GPIO bus> on gpio0
gpioled0: <GPIO led> at pin(s) 2 on gpiobus0
gpioled1: <GPIO led> at pin(s) 3 on gpiobus0
ehci0: <AR71XX Integrated USB 2.0 controller> at mem 0x1b000000-0x1bffffff irq 1 on nexus0
usbus0: set host controller mode
usbus0: EHCI version 1.0
usbus0: set host controller mode
usbus0: <AR71XX Integrated USB 2.0 controller> on ehci0
pcib0 at irq 0 on nexus0
pci0: <PCI bus> on pcib0
pci0: <old, non-VGA display device> at device 0.0 (no driver attached)
ath0: <Atheros 9220> irq 0 at device 17.0 on pci0
ath0: [HT] enabling HT modes
ath0: [HT] 2 RX streams; 2 TX streams
ath0: AR9220 mac 128.2 RF5133 phy 13.0
ath0: 2GHz radio: 0x0000; 5GHz radio: 0x00c0
ath1: <Atheros 9220> irq 1 at device 18.0 on pci0
[ath] enabling AN_TOP2_FIXUP
ath1: [HT] enabling HT modes
ath1: [HT] 2 RX streams; 2 TX streams
ath1: AR9220 mac 128.2 RF5133 phy 13.0
ath1: 2GHz radio: 0x0000; 5GHz radio: 0x00c0
arge0: <Atheros AR71xx built-in ethernet interface> at mem 0x19000000-0x19000fff irq 2 on nexus0
arge0: No PHY specified, using mask 16
arge0: attaching PHYs failed
device_attach: arge0 attach returned 6
arge1: <Atheros AR71xx built-in ethernet interface> at mem 0x1a000000-0x1a000fff irq 3 on nexus0
miibus0: <MII bus> on arge1
ukphy0: <Generic IEEE 802.3u media interface> PHY 0 on miibus0
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
arge1: Ethernet address: 62:73:64:a2:24:f3
spi0: <AR71XX SPI> at mem 0x1f000000-0x1f00000f on nexus0
spibus0: <spibus bus> on spi0
mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0
mx25l0: s25sl064a, sector 65536 bytes, 128 sectors
ar71xx_wdog0: <Atheros AR71XX watchdog timer> on nexus0
Timecounters tick every 1.000 msec
usbus0: 480Mbps High Speed USB v2.0
ugen0.1: <Atheros> at usbus0
uhub0: <Atheros EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
map/rootfs.uncompress: GEOM_ULZMA image found
map/rootfs.uncompress: 320 x 65536 blocks
WARNING: WITNESS option enabled, expect reduced performance.
Root mount waiting for: usbus0
uhub0: 2 ports with 2 removable, self powered
Trying to mount root from ufs:map/rootfs.uncompress []...
warning: no time-of-day clock registered, system time will not be set accurately
Jan  5 05:41:14 init: login_getclass: unknown class 'daemon'
*** Populating /var ..
*** Loading configuration files ..
*** Restoring from /dev/map/cfg .. 
gunzip: unknown compression format
0 blocks
1+0 records in
1+0 records out
65536 bytes transferred in 0.318679 secs (205649 bytes/sec)
*** Completed.
*** setting up hostname
*** Load kernel modules
kldload: can't load bridgestp: File exists
kldload: can't load if_bridge: No such file or directory
*** bringing up loopback ..
*** Starting networking via /etc/rc.d/base/net
*** Interface: arge0: start
ifconfig: interface arge0 does not exist
*** Interface: arge0: done
*** Interface: bridge0: start
bridge0: Ethernet address: 42:1c:e3:28:8b:d0
ifconfig: BRDGADD arge0: No such file or directory
*** Interface: bridge0: done
*** Default password/login databases ..
*** inetd
*** Done!

FreeBSD/mips (freebsd-wifi-build) (ttyu0)