changeset 183:0b8aef9f486e

DIR-632(Atheros AR7242) support
author ray@terran.dlink.ua
date Thu, 07 Jul 2011 17:54:55 +0300
parents 0e2536a0af73
children c4bf2a4a8768
files RUN_DIR-632.k.sh RUN_DIR-632.sh boards/D-Link/DIR-632/GPIO boards/D-Link/DIR-632/README boards/D-Link/DIR-632/board.hints boards/D-Link/DIR-632/board.mk boards/D-Link/DIR-632/board_firmware.sig boards/D-Link/DIR-632/files/etc/rc.d/ADAPTATION socs/Atheros/AR7242/soc.mk
diffstat 8 files changed, 485 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RUN_DIR-632.k.sh	Thu Jul 07 17:54:55 2011 +0300
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+HOST=`hostname`
+echo "'${HOST}'"
+if [ "x${HOST}" = "xrnote.ddteam.net" ] ; then
+FREEBSD_SRC_TREE=/usr/home/ray/work/@HG/http_my_ddteam_net_hg_BASE_/head/
+else
+FREEBSD_SRC_TREE=/usr/1/MIPS_FreeBSD/HEAD/head
+fi
+DATE=`date +%Y-%m-%d_%H:%M`
+
+
+__MAKE_CONF=/dev/null
+SRCCONF=/dev/null
+
+export __MAKE_CONF
+export SRCCONF
+
+echo "build started, enter \`tail -f $0.${DATE}.log\` to view build details"
+make TARGET_PAIR=D-Link/DIR-632 FREEBSD_SRC_TREE=${FREEBSD_SRC_TREE} kernel.oldlzma.uboot 2>&1 | tee $0.${DATE}.log > /dev/null
+
+echo ${TARGET_PAIR} firmware build done at `date`
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RUN_DIR-632.sh	Thu Jul 07 17:54:55 2011 +0300
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+HOST=`hostname`
+echo "'${HOST}'"
+if [ "x${HOST}" = "xrnote.ddteam.net" ] ; then
+FREEBSD_SRC_TREE=/usr/home/ray/work/@HG/http_my_ddteam_net_hg_BASE_/head/
+else
+FREEBSD_SRC_TREE=/usr/1/MIPS_FreeBSD/HEAD/head
+fi
+DATE=`date +%Y-%m-%d_%H:%M`
+
+
+__MAKE_CONF=/dev/null
+SRCCONF=/dev/null
+
+export __MAKE_CONF
+export SRCCONF
+
+echo "build started, enter \`tail -f $0.${DATE}.log\` to view build details"
+make TARGET_PAIR=D-Link/DIR-632 FREEBSD_SRC_TREE=${FREEBSD_SRC_TREE} zimage 2>&1 | tee $0.${DATE}.log > /dev/null
+#make TARGET_PAIR=D-Link/DIR-632 FREEBSD_SRC_TREE=${FREEBSD_SRC_TREE} kernel.oldlzma.uboot rootfs.iso.ulzma 2>&1 | tee $0.${DATE}.log > /dev/null
+#cp /usr/obj/usr/home/ray/work/DDTeam.net/ZRouter/zrouter/D-Link_DIR-632_kernel.oldlzma.uboot /tftpboot/DIR-632/
+#cp /usr/obj/usr/home/ray/work/DDTeam.net/ZRouter/zrouter/D-Link_DIR-632_rootfs_clean.iso.ulzma /tftpboot/DIR-632/
+
+
+echo ${TARGET_PAIR} firmware build done at `date`
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/boards/D-Link/DIR-632/GPIO	Thu Jul 07 17:54:55 2011 +0300
@@ -0,0 +1,8 @@
+
+
+1	LED	STATUS Yellow
+11	LED	USB
+12 	BUTTON	WPS
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/boards/D-Link/DIR-632/board.hints	Thu Jul 07 17:54:55 2011 +0300
@@ -0,0 +1,138 @@
+# $FreeBSD$
+hint.apb.0.at="nexus0"
+hint.apb.0.irq=4
+
+#hint.ath.0.at="apb0"
+
+# uart0
+hint.uart.0.at="apb0"
+# see atheros/uart_cpu_ar71xx.c why +3
+hint.uart.0.maddr=0x18020003
+hint.uart.0.msize=0x20
+#hint.uart.0.baud=115200
+hint.uart.0.irq=3
+hint.uart.0.flags="0x30"
+
+# ohci
+hint.ohci.0.at="nexus0"
+hint.ohci.0.maddr=0x1b000000
+hint.ohci.0.msize=0x01000000
+hint.ohci.0.irq=1
+
+# ehci
+hint.ehci.0.at="nexus0"
+hint.ehci.0.maddr=0x1b000100
+hint.ehci.0.msize=0x00ffff00
+hint.ehci.0.irq=1
+
+# pci
+hint.pcib.0.at="nexus0"
+hint.pcib.0.irq=0
+# XXX: check it
+hint.pcib.0.eepromdata=0x1fff1000
+
+hint.arge.0.at="nexus0"
+hint.arge.0.maddr=0x19000000
+hint.arge.0.msize=0x1000
+hint.arge.0.irq=2
+hint.arge.0.media=100
+hint.arge.0.fduplex=1
+hint.arge.0.phymask=0xff
+
+hint.arge.1.at="nexus0"
+hint.arge.1.maddr=0x1a000000
+hint.arge.1.msize=0x1000
+hint.arge.1.irq=3
+#hint.arge.1.media=100
+#hint.arge.1.fduplex=1
+hint.arge.1.phymask=0xff
+
+
+# GPIO
+hint.gpio.0.at="apb0"
+hint.gpio.0.maddr=0x18040000
+hint.gpio.0.msize=0x1000
+hint.gpio.0.irq=2
+
+
+
+# 1	LED	STATUS Yellow
+hint.gpioled.0.at="gpiobus0"
+hint.gpioled.0.name="status"
+hint.gpioled.0.pins=0x0002
+hint.gpioled.0.flags="0x0102"
+
+# 11	LED	USB
+hint.gpioled.1.at="gpiobus0"
+hint.gpioled.1.name="usb"
+hint.gpioled.1.pins=0x0800
+hint.gpioled.1.flags="0x0102"
+
+# ? 	BUTTON	RESET
+#hint.gpioreset.0.at="gpiobus0"
+#hint.gpioreset.0.pins="0x0400"
+#hint.gpioreset.0.name="reset"
+#hint.gpioreset.0.flags="0x04a1"
+
+# 12 	BUTTON	WPS
+hint.gpiobutton.0.at="gpiobus0"
+hint.gpiobutton.0.pins="0x1000"
+hint.gpiobutton.0.name="wps"
+hint.gpiobutton.0.flags="0x04a1"
+
+
+# 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
+
+# shares the same bus with mx25l. 
+# CE low for flash, CE high for RTC
+# at the moment it's just stub until SPI bus is ready for such hacks
+# hint.rtc.0.at="spibus0"
+# hint.rtc.0.cs=0
+
+# Watchdog
+hint.ar71xx_wdog.0.at="nexus0"
+
+hint.map.0.at="flash/spi0"
+hint.map.0.start=0x00000000
+hint.map.0.end=0x00040000
+hint.map.0.name="bootloader"
+hint.map.0.readonly=1
+
+
+hint.map.1.at="flash/spi0"
+hint.map.1.start=0x00040000
+hint.map.1.end=0x00050000
+hint.map.1.name="config_wu"
+
+
+hint.map.2.at="flash/spi0"
+hint.map.2.start=0x00050000
+hint.map.2.end=0x007e0000
+hint.map.2.name="upgrade"
+
+hint.map.3.at="flash/spi0"
+hint.map.3.start=0x00050000
+hint.map.3.end="search:0x00100000:0x10000:.!/bin/sh"
+hint.map.3.name="kernel"
+
+hint.map.4.at="flash/spi0"
+hint.map.4.start="search:0x00100000:0x10000:.!/bin/sh"
+hint.map.4.end=0x007e0000
+hint.map.4.name="rootfs"
+
+hint.map.5.at="flash/spi0"
+hint.map.5.start=0x007e0000
+hint.map.5.end=0x00800000
+hint.map.5.name="config"
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/boards/D-Link/DIR-632/board.mk	Thu Jul 07 17:54:55 2011 +0300
@@ -0,0 +1,96 @@
+
+###################################################
+#
+# Board used hardware/chip`s
+#
+###################################################
+
+
+SOC_VENDOR=Atheros
+SOC_CHIP=AR7242
+# Maybe used for kernel config and maybe multiple e.g. "cfi nand"
+BOARD_FLASH_TYPE=spi
+# TODO: size suffixes
+BOARD_FLASH_SIZE=8388608
+
+
+###################################################
+#
+# Vars for kernel config 
+#
+###################################################
+
+# ident 
+KERNCONF_IDENT=${TARGET_VENDOR}_${TARGET_DEVICE}
+# Include usb and SoC usb controller drivers
+WITH_USB=yes
+WITH_IPSEC=yes
+WITH_WIRELESS=yes
+# Builded modules
+KERNCONF_MODULES_OVERRIDE+=usb/uplcom usb/u3g usb/umodem usb/umass usb/ucom cam zlib
+
+# Additional utilities
+WORLD_SUBDIRS_ZROUTER+=target/sbin/upgrade
+
+KERNCONF_OPTIONS+=	ALT_BREAK_TO_DEBUGGER
+KERNCONF_OPTIONS+=	BREAK_TO_DEBUGGER
+
+.if !defined(WITHOUT_WIRELESS)
+KERNCONF_OPTIONS+=	IEEE80211_DEBUG
+KERNCONF_OPTIONS+=	IEEE80211_SUPPORT_MESH
+KERNCONF_OPTIONS+=	IEEE80211_SUPPORT_TDMA
+KERNCONF_DEVICES+=	wlan
+KERNCONF_DEVICES+=	wlan_wep
+KERNCONF_DEVICES+=	wlan_ccmp
+KERNCONF_DEVICES+=	wlan_tkip
+
+KERNCONF_OPTIONS+=	AH_DEBUG
+KERNCONF_OPTIONS+=	ATH_DEBUG
+KERNCONF_OPTIONS+=	AH_SUPPORT_AR5416
+KERNCONF_OPTIONS+=	AH_RXCFG_SDMAMW_4BYTES
+KERNCONF_DEVICES+=	ath
+KERNCONF_DEVICES+=	ath_hal
+KERNCONF_DEVICES+=	ath_rate_sample
+.endif
+
+
+
+###################################################
+#
+#       Limits
+#
+###################################################
+
+
+
+# Image must not be biggest than GEOM_MAP_P2 (upgrade part.)
+FIRMWARE_IMAGE_SIZE_MAX=0x007a0000
+
+
+###################################################
+#
+#       Firmware Image Options
+#
+###################################################
+
+TARGET_PROFILES+=SMALL_ mpd ssh dlink.ua.web dhcp mroute ntpdate dnsmasq racoon openvpn ppp
+# hostap
+# nfs_client
+# racoon
+
+KERNEL_COMPRESSION=oldlzma
+KERNEL_COMPRESSION_TYPE=oldlzma
+UBOOT_KERNEL_COMPRESSION_TYPE=lzma
+
+MKULZMA_BLOCKSIZE=65536
+
+PACKING_KERNEL_IMAGE?=kernel.oldlzma.uboot
+PACKING_ROOTFS_IMAGE?=rootfs.iso.ulzma
+
+# 64k
+PACKING_KERNEL_ROUND?=0x10000
+
+PACKING_ROOTFS_METHOD?=	tar.gz
+
+IMAGE_SUFFIX=zimage
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/boards/D-Link/DIR-632/board_firmware.sig	Thu Jul 07 17:54:55 2011 +0300
@@ -0,0 +1,1 @@
+A101-AR7242-RT-100324-03
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/boards/D-Link/DIR-632/files/etc/rc.d/ADAPTATION	Thu Jul 07 17:54:55 2011 +0300
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+# PROVIDE: ADAPTATION
+
+. /etc/rc.subr
+. /etc/network.subr
+
+name="ADAPTATION"
+start_cmd="adapt_start"
+start_precmd="adapt_prestart"
+start_postcmd="adapt_poststart"
+stop_cmd="adapt_stop"
+
+adapt_prestart()
+{
+#	switchctl /dev/switch0 set vlan 0 vid 1
+#	switchctl /dev/switch0 set vlan 0 add 0 u
+#	switchctl /dev/switch0 set vlan 0 add 1 u
+#	switchctl /dev/switch0 set vlan 0 add 2 u
+#	switchctl /dev/switch0 set vlan 0 add 3 u
+#	switchctl /dev/switch0 set vlan 0 del 4
+#	switchctl /dev/switch0 set vlan 0 add 5 t
+#	switchctl /dev/switch0 set vlan 0 add 6 t
+#
+#	switchctl /dev/switch0 set vlan 1 vid 2
+#	switchctl /dev/switch0 set vlan 1 del 0
+#	switchctl /dev/switch0 set vlan 1 del 1
+#	switchctl /dev/switch0 set vlan 1 del 2
+#	switchctl /dev/switch0 set vlan 1 del 3
+#	switchctl /dev/switch0 set vlan 1 add 4 u
+#	switchctl /dev/switch0 set vlan 1 add 5 t
+#	switchctl /dev/switch0 set vlan 1 add 6 t
+#
+#	switchctl /dev/switch0 set port 0 pvid 1 flags Untag
+#	switchctl /dev/switch0 set port 1 pvid 1 flags Untag
+#	switchctl /dev/switch0 set port 2 pvid 1 flags Untag
+#	switchctl /dev/switch0 set port 3 pvid 1 flags Untag
+#	switchctl /dev/switch0 set port 4 pvid 2 flags Untag
+#
+#	switchctl /dev/switch0 set port 5 pvid 1 flags Tag
+#	switchctl /dev/switch0 set port 6 pvid 1 flags Tag
+
+	gpioctl -f /dev/gpioc0 -c 10 IN II PU INT
+
+	# Import MAC addresses with known names
+#	kenv LAN_MAC_ADDR=`kenv ethaddr`
+#	kenv WAN_MAC_ADDR=`kenv wanmac`
+
+	ifconfig arge0 name lan0
+	ifconfig arge1 name wan0
+
+	ifconfig lan0 ether `kenv LAN_MAC_ADDR`
+	ifconfig wan0 ether `kenv WAN_MAC_ADDR`
+
+	hostname `kenv HostName`
+
+}
+
+adapt_start()
+{
+}
+
+adapt_poststart()
+{
+}
+
+adapt_stop()
+{
+}
+
+load_rc_config $name
+
+run_rc_command $*
\ No newline at end of file
--- a/socs/Atheros/AR7242/soc.mk	Thu Jul 07 17:52:18 2011 +0300
+++ b/socs/Atheros/AR7242/soc.mk	Thu Jul 07 17:54:55 2011 +0300
@@ -0,0 +1,119 @@
+
+#XXX testing
+LZMA=lzma
+KERNEL_PATH=/usr/obj/kernel
+
+
+#SOC_KERNCONF=BCM5354
+#SOC_KERNHINTS=BCM5354.hints
+
+TARGET=			mips
+TARGET_ARCH=		mipseb
+
+KERNCONF_MACHINE=	${TARGET} ${TARGET_ARCH}
+KERNCONF_IDENT?=	AR7242
+KERNCONF_CPU=		CPU_MIPS4KC
+KERNCONF_OPTIONS+=	ISA_MIPS32
+
+KERNCONF_FILES+=	"../atheros/files.ar71xx"
+KERNCONF_HINTS=		"AR7242.hints"
+
+
+KERNCONF_MAKEOPTIONS+=	"MIPS_BIG_ENDIAN=defined"
+
+
+KERNCONF_MAKEOPTIONS+=	"KERNLOADADDR=0x80001000"
+KERNCONF_OPTIONS+=		MAXUSERS=3
+KERNCONF_OPTIONS+=		MAXFILES=512
+KERNCONF_OPTIONS+=		NSFBUFS=1024
+KERNCONF_OPTIONS+=		SHMALL=128
+KERNCONF_OPTIONS+=		MSGBUF_SIZE=65536
+
+# Options for making kernel smallest 
+KERNCONF_OPTIONS+=		NO_SYSCTL_DESCR
+KERNCONF_OPTIONS+=		NO_FFS_SNAPSHOT
+KERNCONF_OPTIONS+=		SCSI_NO_SENSE_STRINGS
+KERNCONF_OPTIONS+=		SCSI_NO_OP_STRINGS
+
+# Debug definitions
+##KERNCONF_MAKEOPTIONS+=	"DEBUG=-g"
+KERNCONF_OPTIONS+=		DDB
+KERNCONF_OPTIONS+=		KDB
+##KERNCONF_OPTIONS+=		PREEMPTION
+##KERNCONF_OPTIONS+=		KTRACE
+#KERNCONF_OPTIONS+=		LOCK_PROFILING
+#KERNCONF_OPTIONS+=		KTR
+
+# Board definitions
+KERNCONF_OPTIONS+=	INET
+KERNCONF_OPTIONS+= 	IPSTEALTH
+KERNCONF_OPTIONS+= 	CD9660
+#KERNCONF_OPTIONS+= 	GEOM_LABEL
+KERNCONF_OPTIONS+= 	SCHED_ULE
+#KERNCONF_OPTIONS+= 	SCHED_4BSD
+#KERNCONF_OPTIONS+= 	NFSCLIENT
+#KERNCONF_OPTIONS+= 	NFS_ROOT
+KERNCONF_OPTIONS+= 	PSEUDOFS
+KERNCONF_OPTIONS+=	IPFIREWALL_DEFAULT_TO_ACCEPT
+KERNCONF_OPTIONS+= 	ZERO_COPY_SOCKETS
+KERNCONF_OPTIONS+=	_KPOSIX_PRIORITY_SCHEDULING
+KERNCONF_OPTIONS+=		ROOTDEVNAME=\\\"cd9660:/dev/map/rootfs.uncompress\\\"
+
+KERNCONF_DEVICES+=	uart
+KERNCONF_DEVICES+=	random
+KERNCONF_DEVICES+=	loop
+KERNCONF_DEVICES+=	pty
+KERNCONF_DEVICES+=	ether
+KERNCONF_DEVICES+=	bpf
+KERNCONF_DEVICES+=	vlan
+KERNCONF_DEVICES+=	uart
+KERNCONF_DEVICES+=	tun
+
+KERNCONF_DEVICES+=	ar724x_pci
+KERNCONF_DEVICES+=	pci
+KERNCONF_DEVICES+=	ar71xx_wdog
+KERNCONF_DEVICES+=	spibus
+KERNCONF_DEVICES+=	ar71xx_spi
+KERNCONF_DEVICES+=	mx25l
+KERNCONF_DEVICES+=	mii
+KERNCONF_DEVICES+=	arge
+
+
+KERNCONF_DEVICES+=	gpio
+KERNCONF_DEVICES+=	gpioled
+
+KERNCONF_DEVICES+=	nvram2env
+KERNCONF_DEVICES+=	geom_map
+KERNCONF_DEVICES+=	geom_uncompress
+
+
+KERNCONF_OPTIONS+=	SCSI_DELAY=1000
+
+.if defined(WITH_IPSEC)
+KERNCONF_OPTIONS+=         IPSEC
+KERNCONF_OPTIONS+=         IPSEC_NAT_T
+
+KERNCONF_DEVICES+=		random
+KERNCONF_DEVICES+=		enc
+#KERNCONF_DEVICES+=		gif
+KERNCONF_DEVICES+=		ipsec
+KERNCONF_DEVICES+=		crypto
+#KERNCONF_DEVICES+=		cryptodev	# /dev/crypto for access to h/w
+
+##KERNCONF_DEVICES+=		rndtest		# FIPS 140-2 entropy tester
+.endif
+
+
+.if defined(WITH_USB)
+KERNCONF_DEVICES+=	usb
+#KERNCONF_OPTIONS+=	USB_EHCI_BIG_ENDIAN_DESC
+#KERNCONF_OPTIONS+=	USB_DEBUG
+KERNCONF_DEVICES+=	ehci
+#KERNCONF_DEVICES+=	ohci
+.endif
+
+
+
+
+
+