Support for the Broadcom BCM56340 iProc based switch.

This commit is contained in:
matt 2013-10-28 22:35:07 +00:00
parent 3380861373
commit 9eea19add8
6 changed files with 359 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bcm53xx_start.S,v 1.7 2013/08/04 01:02:01 matt Exp $ */
/* $NetBSD: bcm53xx_start.S,v 1.8 2013/10/28 22:35:07 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@ -45,7 +45,7 @@
#define CONADDR 0x18000300
#endif
RCSID("$NetBSD: bcm53xx_start.S,v 1.7 2013/08/04 01:02:01 matt Exp $")
RCSID("$NetBSD: bcm53xx_start.S,v 1.8 2013/10/28 22:35:07 matt Exp $")
#undef VERBOSE_INIT_ARM
#define VERBOSE_INIT_ARM
@ -74,8 +74,11 @@ _C_LABEL(bcm53xx_start):
/*
* Save any arguments u-boot passed us.
*/
ldr r4, .Luboot_args
movw r4, #:lower16:(uboot_args-.LPIC0)
movt r4, #:upper16:(uboot_args-.LPIC0)
add r4, r4, pc
stmia r4, {r0-r3}
.LPIC0:
/*
* Let's turn on the CCA watchdog in case something goes horribly wrong.
@ -98,6 +101,7 @@ _C_LABEL(bcm53xx_start):
bl arm_boot_l1pt_init
XPUTC(#68)
/*
* Before we turn on the MMU, let's the other process out of the
* SKU ROM but setting the magic LUT address to our own mp_start
@ -116,9 +120,20 @@ _C_LABEL(bcm53xx_start):
ldr r0, .Ltemp_l1_table /* The page table address */
bl arm_cpuinit
XPUTC(#33)
XPUTC(#10)
XPUTC(#13)
XPUTC(#89)
movw r0, #:lower16:uboot_args
movt r0, #:upper16:uboot_args
ldr r2, [r0]
movw r1, #:lower16:(uboot_args-.LPIC1)
movt r1, #:upper16:(uboot_args-.LPIC1)
add r1, r1, pc
ldr r1, [r1]
.LPIC1:
cmp r1, r2
1: bne 1b
XPUTC(#90)
/*
* Let's turn off the CCA watchdog since nothing went horribly wrong.
@ -127,10 +142,15 @@ _C_LABEL(bcm53xx_start):
mov r1, #0
str r1, [r0]
XPUTC(#33)
XPUTC(#10)
XPUTC(#13)
/*
* Jump to start in locore.S, which in turn will call initarm and main.
*/
b start
movw ip, #:lower16:start
movt ip, #:upper16:start
bx ip
nop
nop
nop
@ -138,9 +158,6 @@ _C_LABEL(bcm53xx_start):
/* NOTREACHED */
.Luboot_args:
.word uboot_args
.Lsku_rom_lut:
.word 0xffff0400
@ -150,19 +167,23 @@ _C_LABEL(bcm53xx_start):
.Ltemp_l1_table:
/* Put the temporary L1 translation table far enough away. */
.word KERNEL_BASE_phys + 31 * 0x100000 - L1_TABLE_SIZE
.word 31 * 0x100000 - L1_TABLE_SIZE
#include <arm/cortex/a9_mpsubr.S>
mmu_init_table:
/* Add 32MB of VA==PA at 0x80000000 so we can keep the kernel going */
MMU_INIT(KERNEL_BASE, 0x80000000,
(128 * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C)
/* Add 128MB of VA==PA at 0x80000000 so we can keep the kernel going */
#ifdef BCM5301X
MMU_INIT(KERNEL_BASE, 0x80000000, 128,
L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C | L1_S_V6_S)
#elif defined(BCM56340)
MMU_INIT(KERNEL_BASE, 0x60000000, 128,
L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C | L1_S_V6_S)
#endif
MMU_INIT(0, 0x00000000,
(16 * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C)
(32 * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C | L1_S_V6_S)
/* Map the 2MB of primary peripherals */
MMU_INIT(KERNEL_IO_IOREG_VBASE, BCM53XX_IOREG_PBASE,

View File

@ -1,5 +1,5 @@
#
# $NetBSD: BCM5301X,v 1.15 2013/06/30 21:38:56 rmind Exp $
# $NetBSD: BCM5301X,v 1.16 2013/10/28 22:35:07 matt Exp $
#
# BCM5301X -- Broadcom BCM5301X Eval Board Kernel
#
@ -25,7 +25,7 @@ options BCMETH_COUNTERS
#options MULTIPROCESSOR
options CPU_CORTEXA9
#options MEMSIZE=256
options BCM5301
options BCM5301X
options PMAPCOUNTERS
options BUSDMA_COUNTERS
@ -122,6 +122,7 @@ options DKWEDGE_AUTODISCOVER
options DKWEDGE_METHOD_GPT
# Miscellaneous kernel options
options MODULAR # support dynamically loaded kernel modules
options KTRACE # system call tracing, a la ktrace(1)
#options KMEMSTATS # kernel memory statistics
options PCIVERBOSE # Verbose PCI autoconfiguration messages
@ -142,7 +143,7 @@ options DEBUG
#options LOCKDEBUG # Enable lock debugging
#options PMAP_DEBUG # Enable pmap_debug_level code
#options IPKDB # remote kernel debugging
#options VERBOSE_INIT_ARM # verbose bootstraping messages
options VERBOSE_INIT_ARM # verbose bootstraping messages
options DDB # in-kernel debugger
options DDB_ONPANIC=1
options DDB_HISTORY_SIZE=100 # Enable history editing in DDB
@ -150,7 +151,7 @@ options DDB_COMMANDONENTER="show event"
options DB_MAX_LINE=INT_MAX
#options KGDB
makeoptions DEBUG="-g" # compile full symbol table
options SYMTAB_SPACE=575000
options SYMTAB_SPACE=600000
## USB Debugging options
options USB_DEBUG
@ -188,6 +189,7 @@ a9wdt0 at armperiph? flags 1 # A9 Watchdog Timer
# ChipCommonA Peripherals
bcmcca0 at mainbus? # ChipCommonA
#options CONADDR=0x18000300, CONSPEED=115200
options CONSPEED=9600
com0 at bcmcca? channel 0
com* at bcmcca? channel 1
@ -237,6 +239,11 @@ bcmrng0 at bcmccb0
bcmi2c0 at bcmccb0
iic* at bcmi2c?
# NAND Controller
bcmnand0 at bcmccb0
nand* at nandbus?
flash* at nand?
# Watchdog timers
#bcmwdt* at bcmccb0

View File

@ -0,0 +1,288 @@
#
# $NetBSD: BCM56340,v 1.1 2013/10/28 22:35:07 matt Exp $
#
# BCM5301X -- Broadcom BCM5301X Eval Board Kernel
#
include "arch/evbarm/conf/std.bcm53xx"
# estimated number of users
maxusers 32
# Standard system options
options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
#options NTP # NTP phase/frequency locked loop
# CPU options
#makeoptions DEFCOPTS="-O0"
options UVMHIST
#options UVMHIST_PRINT,A9WDT_PERIOD_DEFAULT=30
options BCM53XX_CONSOLE_EARLY
options BCMETH_COUNTERS
#options MULTIPROCESSOR
options CPU_CORTEXA9
#options MEMSIZE=256
options BCM563XX
options PMAPCOUNTERS
options BUSDMA_COUNTERS
# Architecture options
# File systems
file-system FFS # UFS
#file-system LFS # log-structured file system
file-system MFS # memory file system
file-system NFS # Network file system
#file-system ADOSFS # AmigaDOS-compatible file system
#file-system EXT2FS # second extended file system (linux)
file-system CD9660 # ISO 9660 + Rock Ridge file system
file-system MSDOSFS # MS-DOS file system
#file-system FDESC # /dev/fd
file-system KERNFS # /kern
#file-system NULLFS # loopback file system
#file-system PROCFS # /proc
#file-system PUFFS # Userspace file systems (e.g. ntfs-3g & sshfs)
#file-system UMAPFS # NULLFS + uid and gid remapping
#file-system UNION # union file system
file-system TMPFS # memory file system
file-system PTYFS # /dev/pts/N support
# File system options
#options QUOTA # legacy UFS quotas
#options QUOTA2 # new, in-filesystem UFS quotas
#options FFS_EI # FFS Endian Independent support
#options NFSSERVER
options WAPBL # File system journaling support
#options FFS_NO_SNAPSHOT # No FFS snapshot support
# Networking options
#options GATEWAY # packet forwarding
options INET # IP + ICMP + TCP + UDP
options INET6 # IPV6
#options IPSEC # IP security
#options IPSEC_DEBUG # debug for IP security
#options MROUTING # IP multicast routing
#options PIM # Protocol Independent Multicast
#options NETATALK # AppleTalk networking
#options PPP_BSDCOMP # BSD-Compress compression support for PPP
#options PPP_DEFLATE # Deflate compression support for PPP
#options PPP_FILTER # Active filter support for PPP (requires bpf)
#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
options NFS_BOOT_BOOTP
options NFS_BOOT_DHCP
#options NFS_BOOT_BOOTSTATIC
#options NFS_BOOTSTATIC_MYIP="\"192.168.1.4\""
#options NFS_BOOTSTATIC_GWIP="\"192.168.1.1\""
#options NFS_BOOTSTATIC_MASK="\"255.255.255.0\""
#options NFS_BOOTSTATIC_SERVADDR="\"192.168.1.1\""
#options NFS_BOOTSTATIC_SERVER="\"192.168.1.1:/nfs/sdp2430\""
options NFS_BOOT_RWSIZE=1024
# Compatibility options
#options COMPAT_43 # 4.3BSD compatibility.
options COMPAT_60 # NetBSD 6.0 compatibility.
options COMPAT_50 # NetBSD 5.0 compatibility.
options COMPAT_40 # NetBSD 4.0 compatibility.
options COMPAT_30 # NetBSD 3.0 compatibility.
#options COMPAT_20 # NetBSD 2.0 compatibility.
#options COMPAT_16 # NetBSD 1.6 compatibility.
#options COMPAT_15 # NetBSD 1.5 compatibility.
#options COMPAT_14 # NetBSD 1.4 compatibility.
#options COMPAT_13 # NetBSD 1.3 compatibility.
#options COMPAT_12 # NetBSD 1.2 compatibility.
#options COMPAT_11 # NetBSD 1.1 compatibility.
#options COMPAT_10 # NetBSD 1.0 compatibility.
#options COMPAT_09 # NetBSD 0.9 compatibility.
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
#options COMPAT_BSDPTY # /dev/[pt]ty?? ptys.
# Shared memory options
options SYSVMSG # System V-like message queues
options SYSVSEM # System V-like semaphores
options SYSVSHM # System V-like memory sharing
# Device options
#options MEMORY_DISK_HOOKS # boottime setup of ramdisk
#options MEMORY_DISK_ROOT_SIZE=8192 # Size in blocks
#options MEMORY_DISK_DYNAMIC
#options MINIROOTSIZE=1000 # Size in blocks
#options MEMORY_DISK_IS_ROOT # use memory disk as root
options DKWEDGE_AUTODISCOVER
options DKWEDGE_METHOD_GPT
# Miscellaneous kernel options
options MODULAR # support dynamically loaded kernel modules
options KTRACE # system call tracing, a la ktrace(1)
#options KMEMSTATS # kernel memory statistics
options PCIVERBOSE # Verbose PCI autoconfiguration messages
#options PCI_CONFIG_DUMP # Verbose PCI autoconfiguration messages
options PCI_NETBSD_CONFIGURE # perform PCI configuration
options RNDVERBOSE # Verbose rnd messages
#options SCSIVERBOSE # Verbose SCSI errors
#options MIIVERBOSE # Verbose MII autoconfiguration messages
#options DDB_KEYCODE=0x40
#options USERCONF # userconf(4) support
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
# Development and Debugging options
#options PERFCTRS # performance counters
options DIAGNOSTIC # internally consistency checks
options DEBUG
#options LOCKDEBUG # Enable lock debugging
#options PMAP_DEBUG # Enable pmap_debug_level code
#options IPKDB # remote kernel debugging
options VERBOSE_INIT_ARM # verbose bootstraping messages
options DDB # in-kernel debugger
options DDB_ONPANIC=1
options DDB_HISTORY_SIZE=100 # Enable history editing in DDB
options DDB_COMMANDONENTER="show event"
options DB_MAX_LINE=INT_MAX
#options KGDB
makeoptions DEBUG="-g" # compile full symbol table
options SYMTAB_SPACE=575000
## USB Debugging options
options USB_DEBUG
options EHCI_DEBUG
options OHCI_DEBUG
options UHUB_DEBUG
# Valid options for BOOT_ARGS:
# single Boot to single user only
# kdb Give control to kernel debugger
# ask Ask for file name to reboot from
# pmapdebug=<n> If PMAP_DEBUG, set pmap_debug_level to <n>
# memorydisk=<n> Set memorydisk size to <n> KB
# quiet Show aprint_naive output
# verbose Show aprint_normal and aprint_verbose output
options BOOT_ARGS="\"\""
config netbsd root on ? type ?
# The main bus device
mainbus0 at root
# The boot cpu
cpu0 at mainbus?
#cpu* at mainbus?
# The MPCore interrupt controller and global timer
armperiph0 at mainbus? # A9 On-Chip Peripherals
armgic0 at armperiph? # ARM Generic Interrupt Controller
arml2cc0 at armperiph? flags 0 # ARM PL310 L2CC
a9tmr0 at armperiph? # A9 Global Timer
a9wdt0 at armperiph? flags 1 # A9 Watchdog Timer
# ChipCommonA Peripherals
bcmcca0 at mainbus? # ChipCommonA
#options CONADDR=0x18000300, CONSPEED=115200
options CONSPEED=9600
com0 at bcmcca? channel 0
com* at bcmcca? channel 1
# ChipCommonB Peripherals
bcmccb0 at mainbus? # ChipCommonB
bcmpax* at bcmccb? port ? flags 2 # use bounce buffers
pci* at bcmpax?
ppb* at pci? dev ? function ?
pci* at ppb?
ahcisata* at pci? dev ? function ?
atabus* at ahcisata? channel ?
#options ATADEBUG
wd* at atabus? drive ?
wm* at pci? dev ? function ?
makphy* at mii?
ukphy* at mii?
bcmmdio0 at bcmccb0
bcmeth* at bcmccb? port ?
# SDHC controllers
sdhc0 at bcmccb0
sdmmc* at sdhc? # SD/MMC bus
ld* at sdmmc?
# Random Number Generator
bcmrng0 at bcmccb0
# NAND controller
#bcmnand0 at bcmccb0
# NAND layer
#nand0 at nandbus?
# use the bad block table
#options NAND_BBT
# Define flash partitions for board
#flash0 at nand0 offset 0x000000 size 0x080000 readonly 1 # X-Loader
#flash1 at nand0 offset 0x080000 size 0x1e0000 readonly 1 # U-Boot
#flash2 at nand0 offset 0x260000 size 0x020000 readonly 1 # UB Env
#flash3 at nand0 offset 0x280000 size 0x400000 # kernel
#flash4 at nand0 offset 0x680000 size 0 # filesystem
# I2C Controller
bcmi2c0 at bcmccb0
iic* at bcmi2c?
# NAND Controller
bcmnand0 at bcmccb0
nand* at nandbus?
flash* at nand?
# Watchdog timers
#bcmwdt* at bcmccb0
# On-board USB
bcmusb* at bcmccb0
ohci* at bcmusb0
usb* at ohci?
ehci* at bcmusb0
usb* at ehci?
uhub* at usb?
uhub* at uhub? port ?
umass* at uhub? port ? configuration ? interface ?
scsibus* at scsi?
sd* at scsibus? target ? lun ?
#wd* at umass?
axe* at uhub? port ? configuration ? interface ?
# Hardware clocking and power management
# Pseudo-Devices
# disk/mass storage pseudo-devices
#pseudo-device md # memory disk device (ramdisk)
#pseudo-device vnd # disk-like interface to files
#pseudo-device fss # file system snapshot device
#pseudo-device putter # for puffs and pud
# network pseudo-devices
pseudo-device bpfilter # Berkeley packet filter
pseudo-device loop # network loopback
#pseudo-device kttcp # network loopback
pseudo-device vlan
pseudo-device bridge
# miscellaneous pseudo-devices
pseudo-device pty # pseudo-terminals
#options RND_COM
#pseudo-device clockctl # user control of clock subsystem
pseudo-device ksyms # /dev/ksyms
pseudo-device drvctl # device control
pseudo-device lockstat # lock profiling

View File

@ -0,0 +1,10 @@
# $NetBSD: BCM56340_INSTALL,v 1.1 2013/10/28 22:35:07 matt Exp $
#
# BCM56340_INSTALL -- BCM56340 kernel with installation-sized
# ramdisk
#
include "arch/evbarm/conf/BCM56340"
include "arch/evbarm/conf/INSTALL"
options BOOTHOWTO=RB_SINGLE

View File

@ -1,6 +1,6 @@
# $NetBSD: mk.bcm53xx,v 1.3 2013/08/04 00:58:47 matt Exp $
# $NetBSD: mk.bcm53xx,v 1.4 2013/10/28 22:35:07 matt Exp $
CPPFLAGS+= -mcpu=cortex-a9 -mfpu=neon
#CPPFLAGS+= -mabi=aapcs-linux -Wa,-meabi=4
#CPPFLAGS+= -mabi=aapcs-linux -Wa,-meabi=5
.if !empty(MACHINE_ARCH:M*eb)
EXTRA_LINKFLAGS+= --be8
@ -19,8 +19,13 @@ MKUBOOTIMAGEARGS+= -n "NetBSD/$(BOARDTYPE) ${_OSRELEASE}"
MKUBOOTIMAGEARGS_NONE= ${MKUBOOTIMAGEARGS} -C none
MKUBOOTIMAGEARGS_GZ= ${MKUBOOTIMAGEARGS} -C gz
.if !defined(KERNEL_BASE_PHYS)
KERNEL_BASE_PHYS=$(LOADADDRESS)
.endif
.if !defined(KERNEL_BASE_VIRT)
KERNEL_BASE_VIRT=$(LOADADDRESS)
.endif
SYSTEM_LD_TAIL_EXTRA+=; \
echo ${OBJCOPY} -S -O binary $@ $@.bin; \

View File

@ -1,4 +1,4 @@
# $NetBSD: std.bcm53xx,v 1.11 2013/02/13 23:25:28 matt Exp $
# $NetBSD: std.bcm53xx,v 1.12 2013/10/28 22:35:07 matt Exp $
#
# standard NetBSD/evbarm for BCM5301X options
@ -25,7 +25,10 @@ options TPIDRPRW_IS_CURCPU
options KERNEL_BASE_EXT=0x80000000
options EVBARM_BOARDTYPE="bcm53xx"
makeoptions LOADADDRESS="0x80100000"
makeoptions BOARDTYPE="bcm53xx"
makeoptions KERNEL_BASE_PHYS="0x60100000"
makeoptions KERNEL_BASE_VIRT="0x80100000"
makeoptions LOADADDRESS="0x00100000"
makeoptions BOARDMKFRAG="${THISARM}/conf/mk.bcm53xx"
makeoptions CPPFLAGS+="-I$S/../../../include"