Skip to content

Atheros ReferenceDB120

RussianE39 edited this page Jan 4, 2015 · 9 revisions

Flashing FreeBSD-HEAD on the Qualcomm Atheros DB120 reference platform.

(This is a work in progress!)

Introduction

The Qualcomm Atheros DB120 is the AR9344 (Wasp) reference platform.

Hardware

The Qualcomm Atheros DB120 reference platform consists of:

  • AR9344 SoC - mips74k core, USB, ethernet, 10/100 ethernet switch, 2x2 2/5GHz 802.11n wireless
  • 128MiB DDR RAM
  • 16MiB NOR flash
  • 128MiB NAND flash
  • AR9380 3x3 5GHz 802.11n wireless, connected via PCIe
  • AR8327 10/100/1000 ethernet switch

It also includes a variety of external ports, including:

  • I2S digital audio
  • mini-PCIe (which requires a board modification to disable the AR9380 3x3 chip)
  • External MAC connection (the mini-PCI connector) to speak to slave devices over the MAC/PHY bridge

The board has a bunch of different modifications that allow it to do a variety of things, including enabling i2s audio, enabling the mini-pcie slot for an external NIC and booting off of NAND flash directly. No, the board modifications aren't public.

Flash layout

The default flash layout is:

  • 256KiB (uboot)
  • 64KiB (uboot environment)
  • 6336KiB (rootfs)
  • 1408KiB (kernel image)
  • 64KiB (mib0)
  • 64KiB (ART)

Configuration

The ART partition holds the configuration for both wireless devices and the on-board ethernet MACs. Check DB120.hints for the locations of these.

Flashing

Userland:

ar7240> erase 0x9f050000 +0x630000
Erase Flash from 0x9f050000 to 0x9f67ffff in Bank # 1 
First 0x5 last 0x67 sector size 0x10000                                                                                                                                                      103
Erased 99 sectors
ar7240> tftpboot 0x80050000 mfsroot-db120.img.ulzma
Trying eth0
dup 1 speed 1000
Using eth0 device
TFTP from server 192.168.1.10; our IP address is 192.168.1.1
Filename 'mfsroot-db120.img.ulzma'.
Load address: 0x80050000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################
done
Bytes transferred = 4491776 (448a00 hex)
ar7240> cp.b 0x80050000 0x9f050000 $filesize
Copy to Flash... write addr: 9f050000
done

Kernel:

ar7240> erase 0x9f680000 +0x150000
Erase Flash from 0x9f680000 to 0x9f7cffff in Bank # 1 
First 0x68 last 0x7c sector size 0x10000                                                                                                                                                     124
Erased 21 sectors
ar7240> tftpboot 0x80050000 kernel.DB120.lzma.uImage
Trying eth0
Using eth0 device
TFTP from server 192.168.1.10; our IP address is 192.168.1.1
Filename 'kernel.DB120.lzma.uImage'.
Load address: 0x80050000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###
done
Bytes transferred = 1341586 (147892 hex)
ar7240> cp.b 0x80050000 0x9f680000 $filesize
Copy to Flash... write addr: 9f680000
done

Boot messages

U-Boot 1.1.4 (Mar 17 2011 - 11:19:18)

U-boot DB120
DRAM:  
sri
Wasp 1.1
wasp_ddr_initial_config(255): (32bit) ddr2 init
128 MB
Top of RAM usable for U-Boot at: 88000000
Reserving 261k for U-Boot at: 87fbc000
Reserving 192k for malloc() at: 87f8c000
Reserving 44 Bytes for Board Info at: 87f8bfd4
Reserving 36 Bytes for Global Data at: 87f8bfb0
Reserving 128k for boot params() at: 87f6bfb0
Stack Pointer at: 87f6bf98
Now running in RAM - U-Boot at: 87fbc000
id read 0x100000ff
flash size 8MB, sector count = 128
Flash:  8 MB
pci_init_board: PCIe PLL not set for 40MHz refclk
BOARD IS NOT CALIBRATED!!!
In:    serial
Out:   serial
Err:   serial
Net:   ag934x_enet_initialize...
Fetching MAC Address from 0x87fe9ef8
 wasp  reset mask:c03300 
WASP  ----> S17 PHY *
: cfg1 0x7 cfg2 0x7114
eth0: 00:03:7f:11:3c:2b
athrs17_reg_init: complete
eth0 up
eth0
Hit any key to stop autoboot:  0 
## Booting image at 9f680000 ...
   Image Name:   FreeBSD
   Created:      2014-03-16   8:07:59 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1341522 Bytes =  1.3 MB
   Load Address: 80050000
   Entry Point:  80050100
   Verifying Checksum at 0x9f680040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80050100) ...
## Giving linux memsize in bytes, 134217728

Starting kernel ...

CPU platform: Atheros AR9344 rev 1
CPU Frequency=560 MHz
CPU DDR Frequency=480 MHz
CPU AHB Frequency=240 MHz
platform frequency: 560 MHz
CPU reference clock: 40 MHz
CPU MDIO clock: 100 MHz
arguments: 
  a0 = 00000007
  a1 = a7f6bfb0
  a2 = a7f6c460
  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 v76.151
  MMU: Standard TLB, 32 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=0xbee3519e<PerfCount,WatchRegs,MIPS16,EJTAG>
  Config3=0x2c20
ar934x_chip_init_gmac: gmac_cfg=0x00000041
ar934x_configure_gmac: ETH_CFG=0x00000001
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2014 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 11.0-CURRENT #0 r263220:263224M: Sun Mar 16 01:06:36 PDT 2014
    adrian@lucy-11i386:/usr/home/adrian/work/freebsd/head-embedded/obj/mips/mips.mips/usr/home/adrian/work/freebsd/head-embedded/src/sys/DB120 mips
gcc version 4.2.1 20070831 patched [FreeBSD]
real memory  = 134217728 (131072K bytes)
avail memory = 125587456 (119MB)
random device not loaded; using insecure entropy
random: <Software, Yarrow> initialized
nexus0: <MIPS32 root nexus>
clock0: <Generic MIPS32 ticker> on nexus0
Timecounter "MIPS32" frequency 280000000 Hz quality 800
Event timer "MIPS32" frequency 280000000 Hz quality 800
argemdio0: <Atheros AR71xx built-in ethernet interface, MDIO controller> at mem 0x19000000-0x19000fff on nexus0
mdio0: <MDIO> on argemdio0
mdioproxy0: <MII/MDIO proxy, MDIO side> on mdio0
arswitch0: <Atheros AR8327 Ethernet Switch> on mdio0
miibus0: <MII bus> on arswitch0
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
miibus1: <MII bus> on arswitch0
ukphy1: <Generic IEEE 802.3u media interface> PHY 1 on miibus1
ukphy1:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus2: <MII bus> on arswitch0
ukphy2: <Generic IEEE 802.3u media interface> PHY 2 on miibus2
ukphy2:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus3: <MII bus> on arswitch0
ukphy3: <Generic IEEE 802.3u media interface> PHY 3 on miibus3
ukphy3:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus4: <MII bus> on arswitch0
ukphy4: <Generic IEEE 802.3u media interface> PHY 4 on miibus4
ukphy4:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
etherswitch0: <Switch controller> on arswitch0
mdio1: <MDIO> on arswitch0
mdioproxy1: <MII/MDIO proxy, MDIO side> on mdio1
argemdio1: <Atheros AR71xx built-in ethernet interface, MDIO controller> at mem 0x1a000000-0x1a000fff on nexus0
mdio2: <MDIO> on argemdio1
mdioproxy2: <MII/MDIO proxy, MDIO side> on mdio2
arswitch1: <Atheros AR9340 Ethernet Switch> on mdio2
arswitch1: ar9340_hw_global_setup: GMII
arswitch1: ar9340_hw_global_setup: PHY4 - Local
miibus5: <MII bus> on arswitch1
ukphy5: <Generic IEEE 802.3u media interface> PHY 0 on miibus5
ukphy5:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus6: <MII bus> on arswitch1
ukphy6: <Generic IEEE 802.3u media interface> PHY 1 on miibus6
ukphy6:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus7: <MII bus> on arswitch1
ukphy7: <Generic IEEE 802.3u media interface> PHY 2 on miibus7
ukphy7:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus8: <MII bus> on arswitch1
ukphy8: <Generic IEEE 802.3u media interface> PHY 3 on miibus8
ukphy8:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus9: <MII bus> on arswitch1
ukphy9: <Generic IEEE 802.3u media interface> PHY 4 on miibus9
ukphy9:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
etherswitch1: <Switch controller> on arswitch1
mdio3: <MDIO> on arswitch1
mdioproxy3: <MII/MDIO proxy, MDIO side> on mdio3
apb0 at irq 4 on nexus0
uart0: <16550 or compatible> on apb0
uart0: console (115200,n,8,1)
apb: unmask irq 3; reg was 0x00000000 
ar934x_nfc0: <AR934x NAND controller> on apb0
apb: unmask irq 5; reg was 0x00000008 
ehci0: <AR71XX Integrated USB 2.0 controller> at mem 0x1b000100-0x1b0010ff irq 1 on nexus0
usbus0: set host controller mode
usbus0: EHCI version 1.0
usbus0: set host controller mode
usbus0 on ehci0
pcib0 at irq 0 on nexus0
pcib0: found EEPROM at 0x1fff4000 on 0.0.0
pcib0: EEPROM firmware: 0x1fff4000 @ 16384 bytes
pcib0: device EEPROM 'pcib.0.bus.0.0.0.eeprom_firmware' registered
pci0: <PCI bus> on pcib0
ath1: <Atheros AR938x> at device 0.0 on pci0
ath1: ath_pci_attach: EEPROM firmware @ 0xc085b000
ar9300_set_stub_functions: setting stub functions
ar9300_set_stub_functions: setting stub functions
ar9300_attach: calling ar9300_hw_attach
ar9300_hw_attach: calling ar9300_eeprom_attach
ar9300_flash_map: unimplemented for now
Restoring Cal data from DRAM
ar9300_hw_attach: ar9300_eeprom_attach returned 0
ath1: RX status length: 48
ath1: RX buffer size: 4096
ath1: TX descriptor length: 128
ath1: TX status length: 36
ath1: TX buffers per descriptor: 4
ar9300_freebsd_setup_x_tx_desc: called, 0x0/0, 0x0/0, 0x0/0
ath1: ath_edma_setup_rxfifo: type=0, FIFO depth = 16 entries
ath1: ath_edma_setup_rxfifo: type=1, FIFO depth = 128 entries
ath1: [HT] enabling HT modes
ath1: [HT] enabling short-GI in 20MHz mode
ath1: [HT] 1 stream STBC receive enabled
ath1: [HT] 1 stream STBC transmit enabled
ath1: [HT] 3 RX streams; 3 TX streams
ath1: AR9380 mac 448.3 RF5110 phy 0.0
ath1: 2GHz radio: 0x0000; 5GHz radio: 0x0000
arge0: <Atheros AR71xx built-in ethernet interface> at mem 0x19000000-0x19000fff irq 2 on nexus0
arge0: Overriding MAC from EEPROM
arge0: arge_fetch_pll_config: pll_1000 = 0x6000000
arge0: arge_attach: overriding MII mode to 'RGMII'
arge0: finishing attachment, phymask 0000, proxy null 
arge0: Ethernet address: 00:03:7f:11:3c:2b
arge1: <Atheros AR71xx built-in ethernet interface> at mem 0x1a000000-0x1a000fff irq 3 on nexus0
arge1: Overriding MAC from EEPROM
arge1: arge_attach: overriding MII mode to 'GMII'
arge1: finishing attachment, phymask 0000, proxy null 
arge1: Ethernet address: 00:03:7f:11:3c:2c
ath0: Vendor=0x168c, Device=0x0031
ath0: Vendor=0x168c, Device=0x0031
ath0: <Atheros AR934x> at mem 0x18100000-0x1811ffff irq 0 on nexus0
ath0: eeprom @ 0x1fff0000 (16384 bytes)
ath0: eeprom data @ 0xbfff0000
ar9300_set_stub_functions: setting stub functions
ar9300_set_stub_functions: setting stub functions
Bootstrap clock 40MHz
Enterprise mode: 0x00000000
ar9300_attach: calling ar9300_hw_attach
ar9300_hw_attach: calling ar9300_eeprom_attach
ar9300_flash_map: unimplemented for now
Restoring Cal data from DRAM
ar9300_hw_attach: ar9300_eeprom_attach returned 0
ath0: RX status length: 48
ath0: RX buffer size: 4096
ath0: TX descriptor length: 128
ath0: TX status length: 36
ath0: TX buffers per descriptor: 4
ar9300_freebsd_setup_x_tx_desc: called, 0x0/0, 0x0/0, 0x0/0
ath0: ath_edma_setup_rxfifo: type=0, FIFO depth = 16 entries
ath0: ath_edma_setup_rxfifo: type=1, FIFO depth = 128 entries
ath0: [HT] enabling HT modes
ath0: [HT] enabling short-GI in 20MHz mode
ath0: [HT] 1 stream STBC receive enabled
ath0: [HT] 1 stream STBC transmit enabled
ath0: [HT] 2 RX streams; 2 TX streams
ath0: AR9340 mac 768.1 RF5110 phy 0.0
ath0: 2GHz radio: 0x0000; 5GHz radio: 0x0000
spi0: <AR71XX SPI> at mem 0x1f000000-0x1f00000f on nexus0
spibus0: <spibus bus> on spi0
mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0
mx25l0: s25fl064, sector 65536 bytes, 128 sectors
ar71xx_wdog0: <Atheros AR71XX watchdog timer> on nexus0
Timecounters tick every 1.000 msec
arswitch0port1: link state changed to DOWN
arswitch0port2: link state changed to DOWN
arswitch0port3: link state changed to DOWN
arswitch0port4: link state changed to DOWN
arswitch0port5: link state changed to DOWN
arswitch1port1: link state changed to DOWN
arswitch1port2: link state changed to DOWN
arswitch1port3: link state changed to DOWN
arswitch1port4: link state changed to DOWN
arswitch1port5: link state changed to DOWN
random: unblocking device.
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: 298 x 65536 blocks
Root mount waiting for: usbus0
uhub0: 1 port with 1 removable, self powered
arswitch0: arswitch_miipollstat: port 1: port -> UP
arswitch0: arswitch_miipollstat: port 3: port -> UP
arswitch0port2: link state changed to UP
arswitch0port4: link state changed to UP
Trying to mount root from ufs:map/rootfs.uncompress []...
warning: no time-of-day clock registered, system time will not be set accurately
Mar 16 08:33:25 init: login_getclass: unknown class 'daemon'
*** Populating /var ..
*** Loading configuration files ..
*** Restoring from /dev/map/cfg .. 
1+0 records in
1+0 records out
65536 bytes transferred in 4.275488 secs (15328 bytes/sec)
gunzip: (stdin): trailing garbage ignored
etc/cfg/manifest
etc/master.passwd
etc/group
etc/cfg/rc.conf
etc/cfg/hostapd.wlan0.conf
etc/cfg/hostapd.wlan1.conf
10 blocks
*** Completed.
*** setting up hostname
*** Load kernel modules
kldload: can't load bridgestp: module already loaded or in kernel
kldload: can't load if_bridge: No such file or directory
kldload: can't load random: module already loaded or in kernel
*** bringing up loopback ..
*** Starting networking via /etc/rc.d/base/net
dev.ath.0.txq_mcastq_maxdepth: 512 -> 32
dev.ath.1.txq_mcastq_maxdepth: 512 -> 32
*** Interface: arge0: start
*** Interface: arge0: done
*** Interface: arge1: start
*** Interface: arge1: done
*** Interface: wlan0: start
wlan0: Ethernet address: 00:03:7f:42:1c:29
*** Starting hostapd..
Configuration file: /etc/cfg/hostapd.wlan0.conf
Using interface wlan0 with hwaddr 00:03:7f:42:1c:29 and ssid "CACHEBOY_DB120_11NG"
*** Interface: wlan0: done
*** Interface: wlan1: start
wlan1: Ethernet address: 00:03:7f:42:1c:2a
*** Starting hostapd..
Configuration file: /etc/cfg/hostapd.wlan1.conf
Using interface wlan1 with hwaddr 00:03:7f:42:1c:2a and ssid "CACHEBOY_DB120_11NA"
*** Interface: wlan1: done
*** Interface: bridge0: start
bridge0: Ethernet address: 92:d5:80:ab:2a:a4
wlan0: promiscuous mode enabled
bridge0: link state changed to UP
wlan1: promiscuous mode enabled
arge0: promiscuous mode enabled
arge1: promiscuous mode enabled
*** Interface: bridge0: done
*** Default password/login databases ..
*** inetd
*** Done!

FreeBSD/mips (freebsd-db120) (ttyu0)

login: root
Password:
No home directory.
Logging in with home = "/".
#

Building FreeBSD/MIPS for db120:

cd /data/freebsd/mips/head/src

/data/freebsd/build/bin/build db120 buildworld buildkernel installworld installkernel distribution mfsroot fsimage uboot

then you will have ready images in /tftpboot (don't forget to follow wiki page for build enviroinment setup)