AR934x initial support is now in the tree - partial success on RB2011

Milan Obuch freebsd-mips at dino.sk
Sun Dec 8 22:08:26 UTC 2013


On Tue, 15 Oct 2013 21:29:40 -0700
Adrian Chadd <adrian at freebsd.org> wrote:

> Hi all,
> 
> The initial AR934x support is now in the tree.
> 
> The basics:
> 
> * the basic hacks needed to bring up mips74k support is now in the
> tree;
> * I've added MIPS bus space barriers to things;
> * on-board wifi works;
> * slow UART works (ie, rs232 console);
> * on-chip switch support works (but no VLAN support - see below);
> * on-chip USB probes/attaches fine;
> * ethernet seems to work fine.
> 
> It passes packets and such!
> 
> What I haven't yet done (and I'll accept patches!)
> 
> * the fast UART code from the AR933x should work for the fast UART
> port but I haven't yet tested it!
> 
> * I haven't tried USB yet!
> 
> * taught the arswitch code about the VLAN registers for the AR934x
> on-chip switch.
> 
> * taught the ath(4) driver to use the bus space barrier stuff. So the
> wifi is likely going to be angry at us for a while.
> 
> * There's no support for the newer switch chips (AR8327 in
> particular.)
> 
> * NAND, I2S support, etc.
> 
> Thanks!
> 
> 
> -adrian
>

Hi,

I was able to build kernel for ethernet boot on RouterBoard 2011L. My
configs are based on DB120, but some parts are left out (there is no
wifi on my device). See attachments. However, it does not fully boot -
kernel seems to be up and running, but neither USB nor ethernet works
for me, this means no way to mount rootfs. Also there is a dmesg
(actually serial console log) attached.

It seems there is OpenWrt working on this device, see dmesg I found at
https://dev.openwrt.org/attachment/ticket/13585/log, but I was not able
to verify this. I need openwrt-ar71xx-nand-vmlinux-initramfs.elf file
as I do not want to erase MikroTik's RouterOS from the device, yet, but
every one I found was just too old to support correctly RB2011L.

I found also a page describing a way to build OpenWrt on FreeBSD at
http://caia.swin.edu.au/urp/diffuse/openwrt/buildunderfreebsd.html, but
it did not work for me, tested on both 9.2-STABLE and 10.0-BETA4
systems. I have no Linux setup available, so I could not try to build
OpenWrt this way either.

I am now out of ideas, so would appreciate anything I could test to
troubleshoot the issues I see. Oh, I have both ports 1 (gigabit, so on
Ar8327 switch, necessary to do a ethernet boot on the device) and 6
(100 Mbit, on Ar8227 according to manufacturer's page found at
http://wiki.mikrotik.com/wiki/Manual:Switch_Chip_Features).

Also, if someone could build for me OpenWrt for this device suitable
for netbooting, that would be also great - at least I could verify it
really works so we could try to find relevant bits from OpenWrt's
sources, for ethernet support it could be seen at
https://dev.openwrt.org/browser/trunk/target/linux/generic/files/drivers/net/phy/ar8216.c,
but finding the relevant bits in this 2584 lines of code intended for
various Atheros switches is not (yet) easy for me :(

There was a time when rootfs could be embedded easily in kernel, but I
found no method to do id on current sources. If there is any method to
do this, it will be possible to mount rootfs from md based ram disk and
do some debugging on the RB2011 itself, thus overcoming the troubles
with not (yet) working ethernet and USB on this device.

Regards,
Milan
-------------- next part --------------
#
# Routerboard 2011
#
# $FreeBSD$
#

machine         mips mips
ident		"RB2011"
cpu		CPU_MIPS74KC
makeoptions	KERNLOADADDR=0x80050000
options 	HZ=1000

files		"../atheros/files.ar71xx"
hints		"RB2011.hints"

makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
makeoptions	MODULES_OVERRIDE=""

options 	DDB
options 	KDB
options 	ALQ

options 	SCHED_4BSD		#4BSD scheduler
options 	INET			#InterNETworking
options 	PSEUDOFS		#Pseudo-filesystem framework
options 	_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions

options 	FFS                     #Berkeley Fast Filesystem
options 	NO_FFS_SNAPSHOT		# We don't require snapshot support

options 	AR71XX_REALMEM=128*1024*1024

# Don't include the SCSI/CAM strings in the default build
options 	SCSI_NO_SENSE_STRINGS
options 	SCSI_NO_OP_STRINGS

# .. And no sysctl strings
options 	NO_SYSCTL_DESCR

# Limit IO size
options 	NBUF=128

device		mii
device		arge

# For etherswitch support
options 	ARGE_MDIO
device		miiproxy
device		etherswitch
device		arswitch

device		usb
options 	USB_EHCI_BIG_ENDIAN_DESC        # handle big-endian byte order
options 	USB_DEBUG
options 	USB_HOST_ALIGN=32		# AR71XX (MIPS in general?) requires this
device		ehci

device		scbus
device		umass
device		da

device		spibus
device		ar71xx_spi
device		mx25l
device		ar71xx_wdog

device		uart
device		uart_ar71xx

device		loop
device		ether
device		md
device		bpf
device		random
device		if_bridge
device		gpio
device		gpioled

options 	NFSCL		# Network Filesystem Client
options 	NFS_ROOT	# NFS usable as /, requires NFSCL

options 	BOOTP
options 	BOOTP_NFSROOT
options 	BOOTP_NFSV3
options 	BOOTP_WIRED_TO=arge1
options 	BOOTP_COMPAT

options 	ROOTDEVNAME=\"nfs:192.168.16.11:/data/mips/nfsroot\"

# GEOM modules
#device		geom_uzip	# compressed in-memory filesystem hackery!
#options 	GEOM_UZIP

# Boot from the first MFS uzip
#options 	ROOTDEVNAME=\"ufs:md0.uzip\"

#options 	MD_ROOT
#options 	MD_ROOT_SIZE="6144"
-------------- next part --------------
hint.apb.0.at="nexus0"
hint.apb.0.irq=4

# uart0
hint.uart.0.at="apb0"
# NB: This isn't an ns8250 UART
hint.uart.0.maddr=0x18020003
hint.uart.0.msize=0x18
hint.uart.0.irq=3

#ehci - note the 0x100 offset for the AR913x/AR724x
hint.ehci.0.at="nexus0"
hint.ehci.0.maddr=0x1b000100
hint.ehci.0.msize=0x00001000
hint.ehci.0.irq=1

# SPI flash
hint.spi.0.at="nexus0"
hint.spi.0.maddr=0x1f000000
hint.spi.0.msize=0x10

hint.mx25l.0.at="spibus0"
hint.mx25l.0.cs=0

# Watchdog
hint.ar71xx_wdog.0.at="nexus0"

# The GPIO function and pin mask is configured per-board
hint.gpio.0.at="apb0"
hint.gpio.0.maddr=0x18040000
hint.gpio.0.msize=0x1000
hint.gpio.0.irq=2

hint.arge.0.at="nexus0"
hint.arge.0.maddr=0x19000000
hint.arge.0.msize=0x1000
hint.arge.0.irq=2

# XXX OpenWRT DB120 BSP doesn't have media/duplex set?
hint.arge.0.phymask=0x0
hint.arge.0.media=1000
hint.arge.0.fduplex=1
hint.arge.0.miimode=3           # RGMII
hint.arge.0.pll_1000=0x06000000

# arge0 - MII, autoneg, phy(4)
#hint.arge.0.phymask=0x10	# PHY4
#hint.arge.0.mdio=mdioproxy1	# .. off of the switch mdiobus

hint.arge.1.at="nexus0"
hint.arge.1.maddr=0x1a000000
hint.arge.1.msize=0x1000
hint.arge.1.irq=3

# arge1 - lock up to 1000/full
hint.arge.1.phymask=0x0		# Nothing attached here (XXX?)
hint.arge.1.media=1000
hint.arge.1.fduplex=1
hint.arge.1.miimode=1		# GMII

# mdiobus0 on arge0
hint.argemdio.0.at="nexus0"
hint.argemdio.0.maddr=0x19000000
hint.argemdio.0.msize=0x1000
hint.argemdio.0.order=0

# mdiobus1 on arge1
hint.argemdio.1.at="nexus0"
hint.argemdio.1.maddr=0x1a000000
hint.argemdio.1.msize=0x1000
hint.argemdio.1.order=0

# DB120 GMAC configuration
# + AR934X_ETH_CFG_RGMII_GMAC0              (1 << 0)
# + AR934X_ETH_CFG_SW_ONLY_MODE             (1 << 6)
hint.ar934x_gmac.0.gmac_cfg=0x41

# GMAC0 here - connected to an AR8327
hint.arswitch.0.at="mdio0"
hint.arswitch.0.is_7240=0
hint.arswitch.0.is_9340=0	# not the internal switch!
hint.arswitch.0.numphys=6
hint.arswitch.0.phy4cpu=0
hint.arswitch.0.is_rgmii=1
hint.arswitch.0.is_gmii=0

# Embedded switch on the AR9344
hint.arswitch.1.at="mdio1"
hint.arswitch.1.is_7240=0
hint.arswitch.1.is_9340=1
hint.arswitch.1.numphys=5
hint.arswitch.1.phy4cpu=0       # phy 4 is not a "CPU port" PHY here
hint.arswitch.1.is_rgmii=0
hint.arswitch.1.is_gmii=1       # arge1 <-> switch PHY is GMII
-------------- next part --------------
jumping to kernel code
CPU platform: Atheros AR9344 rev 2
CPU Frequency=600 MHz
CPU DDR Frequency=450 MHz
CPU AHB Frequency=200 MHz
platform frequency: 600 MHz
CPU reference clock: 25 MHz
CPU MDIO clock: 25 MHz
arguments: 
  a0 = 0000000b
  a1 = a15e2a00
  a2 = 00000000
  a3 = 00000000
Cmd line: console=ttyS0,115200 parts=1 boot_part_size=4194304 gpio=249403 HZ=300000000 mem=128M kmac=D4:CA:6D:6F:47:63 board=2011US ver=3.07 boot=1 mlc=5
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-2013 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: Sun Dec  8 14:50:56 CET 2013
    root at zeta.dino.sk:/data/mips/obj/mips.mips/data/src.11/sys/RB2011 mips
gcc version 4.2.1 20070831 patched [FreeBSD]
real memory  = 134217728 (131072K bytes)
avail memory = 126369792 (120MB)
random device not loaded; using insecure entropy
random: <Software, Yarrow> initialized
nexus0: <MIPS32 root nexus>
clock0: <Generic MIPS32 ticker> on nexus0
Timecounter "MIPS32" frequency 300000000 Hz quality 800
Event timer "MIPS32" frequency 300000000 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
argemdio1: <Atheros AR71xx built-in ethernet interface, MDIO controller> at mem 0x1a000000-0x1a000fff on nexus0
mdio1: <MDIO> on argemdio1
mdioproxy1: <MII/MDIO proxy, MDIO side> on mdio1
arswitch1: <Atheros AR9340 Ethernet Switch> on mdio1
arswitch1: ar9340_hw_global_setup: GMII
arswitch1: ar9340_hw_global_setup: PHY4 - Local
arswitch1: attaching PHY 0 failed
arswitch1: attaching PHY 1 failed
arswitch1: attaching PHY 2 failed
arswitch1: attaching PHY 3 failed
arswitch1: attaching PHY 4 failed
device_attach: arswitch1 attach returned 6
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: gpio pinmask=0x0
gpioc0: <GPIO controller> on gpio0
gpiobus0: <GPIO bus> on gpio0
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
spi0: <AR71XX SPI> at mem 0x1f000000-0x1f00000f on nexus0
spibus0: <spibus bus> on spi0
mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0
mx25l0: w25x10, sector 65536 bytes, 2 sectors
ar71xx_wdog0: <Atheros AR71XX watchdog timer> on nexus0
arge0: <Atheros AR71xx built-in ethernet interface> at mem 0x19000000-0x19000fff irq 2 on nexus0
arge0: arge_attach: overriding MII mode to 'RGMII'
arge0: finishing attachment, phymask 0000, proxy null 
arge0: Ethernet address: d4:ca:6d:6f:47:63
arge1: <Atheros AR71xx built-in ethernet interface> at mem 0x1a000000-0x1a000fff irq 3 on nexus0
arge1: arge_attach: overriding MII mode to 'GMII'
arge1: finishing attachment, phymask 0000, proxy null 
arge1: Ethernet address: d4:ca:6d:6f:47:64
Timecounters tick every 1.000 msec
usbus0: 480Mbps High Speed USB v2.0
bootpc_init: wired to interface 'arge0'
Sending DHCP Discover packet from interface arge0 (d4:ca:6d:6f:47:63)
ugen0.1: <Atheros> at usbus0
uhub0: <Atheros EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
uhub0: 1 port with 1 removable, self powered
usb_alloc_device: set address 2 failed (USB_ERR_STALLED, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_STALLED
usbd_req_re_enumerate: addr=2, set address failed! (USB_ERR_STALLED, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_STALLED
usbd_req_re_enumerate: addr=2, set address failed! (USB_ERR_STALLED, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_STALLED
usbd_req_re_enumerate: addr=2, set address failed! (USB_ERR_STALLED, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_STALLED
usbd_req_re_enumerate: addr=2, set address failed! (USB_ERR_STALLED, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_STALLED
ugen0.2: <Unknown> at usbus0 (disconnected)
uhub_reattach_port: could not allocate new device
DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
random: unblocking device.
DHCP/BOOTP timeout for server 255.255.255.255


More information about the freebsd-mips mailing list