summaryrefslogtreecommitdiff
path: root/sys/arch/beagle
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/beagle')
-rw-r--r--sys/arch/beagle/beagle/ahb.h7
-rw-r--r--sys/arch/beagle/beagle/beagle_machdep.c124
-rw-r--r--sys/arch/beagle/beagle/beagle_start.S86
-rw-r--r--sys/arch/beagle/beagle/uboot_tags.c125
-rw-r--r--sys/arch/beagle/conf/GENERIC6
-rw-r--r--sys/arch/beagle/conf/files.beagle5
-rw-r--r--sys/arch/beagle/dev/gptimer.c10
-rw-r--r--sys/arch/beagle/dev/intc.c10
-rw-r--r--sys/arch/beagle/dev/omap_com.c62
-rw-r--r--sys/arch/beagle/dev/omdog.c10
-rw-r--r--sys/arch/beagle/dev/omehci.c10
-rw-r--r--sys/arch/beagle/dev/omgpio.c10
-rw-r--r--sys/arch/beagle/dev/ommmc.c25
-rw-r--r--sys/arch/beagle/dev/omusbtll.c10
-rw-r--r--sys/arch/beagle/dev/prcm.c10
15 files changed, 351 insertions, 159 deletions
diff --git a/sys/arch/beagle/beagle/ahb.h b/sys/arch/beagle/beagle/ahb.h
index 960420f4cf2..ddcbe9a936c 100644
--- a/sys/arch/beagle/beagle/ahb.h
+++ b/sys/arch/beagle/beagle/ahb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahb.h,v 1.1 2009/05/08 03:13:26 drahn Exp $ */
+/* $OpenBSD: ahb.h,v 1.2 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@drahn.com>
*
@@ -27,3 +27,8 @@ struct ahb_attach_args {
/* XXX */
void *avic_intr_establish(int irqno, int level, int (*func)(void *),
void *arg, char *name);
+
+/* board identification - from uboot */
+#define BOARD_ID_OMAP3_BEAGLE 1546
+#define BOARD_ID_OMAP4_PANDA 2791
+extern uint32_t board_id;
diff --git a/sys/arch/beagle/beagle/beagle_machdep.c b/sys/arch/beagle/beagle/beagle_machdep.c
index 3a429d2f31d..65d099cf2e7 100644
--- a/sys/arch/beagle/beagle/beagle_machdep.c
+++ b/sys/arch/beagle/beagle/beagle_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: beagle_machdep.c,v 1.8 2011/10/19 20:18:31 drahn Exp $ */
+/* $OpenBSD: beagle_machdep.c,v 1.9 2011/10/21 22:55:01 drahn Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@@ -145,6 +145,7 @@
#include <arm/armv7/armv7var.h>
#include <machine/machine_reg.h>
+#include "ahb.h"
#include "wsdisplay.h"
@@ -215,6 +216,8 @@ extern u_int undefined_handler_address;
extern int pmap_debug_level;
#endif
+uint32_t board_id;
+
#define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */
#define KERNEL_PT_KERNEL 1 /* Page table for mapping kernel */
#define KERNEL_PT_KERNEL_NUM 32
@@ -266,7 +269,6 @@ bs_protos(bs_notimpl);
int comcnspeed = CONSPEED;
int comcnmode = CONMODE;
-
/*
*
*/
@@ -428,6 +430,8 @@ copy_io_area_map(pd_entry_t *new_pd)
}
}
+void parse_uboot_tags(void *);
+
/*
* u_int initarm(...)
*
@@ -451,6 +455,8 @@ initarm(void *arg0, void *arg1, void *arg2)
paddr_t memstart;
psize_t memsize;
+ board_id = (uint32_t)arg1;
+
#if 0
int led_data = 0;
#endif
@@ -465,7 +471,8 @@ initarm(void *arg0, void *arg1, void *arg2)
if (set_cpufuncs())
panic("cpu not recognized!");
- intc_intr_bootstrap(0x48200000); /* XXX - constant */
+ if (board_id == BOARD_ID_OMAP3_BEAGLE)
+ intc_intr_bootstrap(0x48200000); /* XXX - constant */
#if 0
/* Calibrate the delay loop. */
@@ -493,6 +500,9 @@ initarm(void *arg0, void *arg1, void *arg2)
/* Talk to the user */
printf("\nOpenBSD/beagle booting ...\n");
+ printf("arg0 %p arg1 %p arg2 %p\n", arg0, arg1, arg2);
+ parse_uboot_tags(arg2);
+
/*
* Examine the boot args string for options we need to know about
* now.
@@ -502,14 +512,9 @@ initarm(void *arg0, void *arg1, void *arg2)
boothowto |= RB_DFLTROOT;
#endif /* RAMDISK_HOOKS */
-#define DEBUG
-#ifdef DEBUG
- printf("probing memory\n");
- printf("sdrc_mcfg_0 %08x\n", *(uint32_t *)0x6d000080);
- printf("sdrc_mcfg_1 %08x\n", *(uint32_t *)0x6d0000b0);
-#endif /* DEBUG */
- {
+ /* normally u-boot will set up bootconfig.dramblocks */
+ if (bootconfig.dramblocks == 0) {
uint32_t sdrc_mcfg_0, sdrc_mcfg_1, memsize0, memsize1;
sdrc_mcfg_0 = *(uint32_t *)0x6d000080;
sdrc_mcfg_1 = *(uint32_t *)0x6d0000b0;
@@ -517,7 +522,6 @@ initarm(void *arg0, void *arg1, void *arg2)
memsize1 = (((sdrc_mcfg_1 >> 8))&0x3ff) * (2 * 1024 * 1024);
memsize = memsize0 + memsize1;
- /* XXX - scma11 for now, fix memory sizing */
memstart = SDRAM_START;
memsize = 0x02000000; /* 32MB */
/* Fake bootconfig structure for the benefit of pmap.c */
@@ -531,55 +535,19 @@ initarm(void *arg0, void *arg1, void *arg2)
bootconfig.dram[1].pages = memsize1 / PAGE_SIZE;
bootconfig.dramblocks++; /* both banks populated */
}
+ } else {
+ /* doesn't deal with multiple segments, hopefully u-boot collaped them into one */
+ memstart = bootconfig.dram[0].address;
+ memsize = bootconfig.dram[0].pages * PAGE_SIZE;
+ memsize = 0x02000000; /* 32MB */ /* WTF? */
+ printf("memory size derived from u-boot\n");
+ for (loop = 0; loop < bootconfig.dramblocks; loop++) {
+ printf("bootconf.mem[%d].address = %08x pages %d/0x%08x\n",
+ loop, bootconfig.dram[0].address, bootconfig.dram[0].pages,
+ bootconfig.dram[0].pages * PAGE_SIZE);
+ }
}
-
-#ifdef DEBUG
- printf("initarm: Configuring system ...\n");
- {
- uint32_t reg;
- asm volatile ("MRC p15, 0, %0, c0, c1, 0\n": "=r" (reg));
- printf("ID_PFR0 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c1, 1\n": "=r" (reg));
- printf("ID_PFR1 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c1, 2\n": "=r" (reg));
- printf("ID_DFR0 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c1, 3\n": "=r" (reg));
- printf("ID_AFR0 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c1, 4\n": "=r" (reg));
- printf("ID_MMFR0 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c1, 5\n": "=r" (reg));
- printf("ID_MMFR1 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c1, 6\n": "=r" (reg));
- printf("ID_MMFR2 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c1, 7\n": "=r" (reg));
- printf("ID_MMFR3 0x%08x\n", reg);
-
- asm volatile ("MRC p15, 0, %0, c0, c2, 0\n": "=r" (reg));
- printf("ID_ISAR0 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c2, 1\n": "=r" (reg));
- printf("ID_ISAR1 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c2, 2\n": "=r" (reg));
- printf("ID_ISAR2 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c2, 3\n": "=r" (reg));
- printf("ID_ISAR3 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c2, 4\n": "=r" (reg));
- printf("ID_ISAR4 0x%08x\n", reg);
- asm volatile ("MRC p15, 0, %0, c0, c2, 5\n": "=r" (reg));
- printf("ID_ISAR5 0x%08x\n", reg);
-
-
- }
-#endif
- {
- static int foo = 0;
- int tmp=1;
- printf("about to SWP 0x1234 -> 0 \n");
- asm volatile (" SWP %0, %2, [%1]": "=&r"(tmp): "r"(&foo), "r"(0x1234));
- printf("mem %x reg %x\n", foo, tmp);
- }
-
-
/*
* Set up the variables that define the availablilty of
* physical memory. For now, we're going to set
@@ -925,12 +893,21 @@ initarm(void *arg0, void *arg1, void *arg2)
Debugger();
#endif
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ printf("board type: beagle\n");
+ break;
+ case BOARD_ID_OMAP4_PANDA:
+ printf("board type: panda\n");
+ break;
+ default:
+ printf("board type %x unknown", board_id);
+ }
+
/* We return the new stack pointer address */
return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
}
-const char *console = "ffuart";
-
void
process_kernel_args(char *args)
@@ -991,19 +968,6 @@ process_kernel_args(char *args)
case 's':
fl |= RB_SINGLE;
break;
- /* XXX undocumented console switching flags */
- case '0':
- console = "ffuart";
- break;
- case '1':
- console = "btuart";
- break;
- case '2':
- console = "stuart";
- break;
- case 'g':
- console = "glass";
- break;
default:
printf("unknown option `%c'\n", *cp);
break;
@@ -1027,14 +991,24 @@ consinit(void)
consinit_called = 1;
#if NCOM > 0
- paddr = 0x49020000; /* XXX - addr */
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ paddr = 0x49020000;
+ break;
+ case BOARD_ID_OMAP4_PANDA:
+ paddr = 0x48020000;
+ break;
+ default:
+ printf("board type %x unknown", board_id);
+ /* XXX - HELP */
+ }
comcnattach(&armv7_a4x_bs_tag, paddr, comcnspeed, 48000000, comcnmode);
comdefaultrate = comcnspeed;
#endif /* NCOM */
}
-int glass_console = 0;
+//int glass_console = 0;
void
board_startup(void)
diff --git a/sys/arch/beagle/beagle/beagle_start.S b/sys/arch/beagle/beagle/beagle_start.S
index 1fc872c8fcf..7286e452460 100644
--- a/sys/arch/beagle/beagle/beagle_start.S
+++ b/sys/arch/beagle/beagle/beagle_start.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: beagle_start.S,v 1.2 2011/10/17 03:06:05 drahn Exp $ */
+/* $OpenBSD: beagle_start.S,v 1.3 2011/10/21 22:55:01 drahn Exp $ */
/* $NetBSD: lubbock_start.S,v 1.1 2003/06/18 10:51:15 bsh Exp $ */
/*
@@ -62,6 +62,11 @@
.global _C_LABEL(bootstrap_start)
_C_LABEL(bootstrap_start):
+ /* Save U-Boot arguments */
+ mov r6, r0
+ mov r7, r1
+ mov r8, r2
+
/* Are we running on ROM ? */
cmp pc, #0x06000000
bhi bootstrap_start_ram
@@ -69,32 +74,32 @@ _C_LABEL(bootstrap_start):
/* move me to RAM
* XXX: we can use memcpy if it is PIC
*/
- ldr r9, Lcopy_size
- adr r8, _C_LABEL(bootstrap_start)
- add r9, r9, #3
- mov r9, r9, LSR #2
- mov r10, #SDRAM_START
- add r10, r10, #0x00200000
- mov r4, r10
-
-5: ldr r3,[r8],#4
- str r3,[r10],#4
- subs r9,r9,#1
+ ldr r1, Lcopy_size
+ adr r0, _C_LABEL(bootstrap_start)
+ add r1, r1, #3
+ mov r1, r1, LSR #2
+ mov r2, #SDRAM_START
+ add r2, r2, #0x00200000
+ mov r4, r2
+
+5: ldr r3,[r0],#4
+ str r3,[r2],#4
+ subs r1,r1,#1
bhi 5b
cmp pc, r5
/* Jump to RAM */
- ldr r8, Lstart_off
+ ldr r0, Lstart_off
blo 1f
/* if we were running out of virtual mapped space, disable mmu */
- mov r10, #0
- mov r9, #(CPU_CONTROL_32BP_ENABLE | CPU_CONTROL_32BD_ENABLE)
- mcr 15, 0, r9, c1, c0, 0
- mcrne 15, 0, r10, c8, c7, 0 /* nail I+D TLB on ARMv4 and greater */
+ mov r2, #0
+ mov r1, #(CPU_CONTROL_32BP_ENABLE | CPU_CONTROL_32BD_ENABLE)
+ mcr 15, 0, r1, c1, c0, 0
+ mcrne 15, 0, r2, c8, c7, 0 /* nail I+D TLB on ARMv4 and greater */
1:
- add pc, r4, r8
+ add pc, r4, r0
Lcopy_size: .word _edata-_C_LABEL(bootstrap_start)
Lstart_off: .word bootstrap_start_ram-_C_LABEL(bootstrap_start)
@@ -105,51 +110,56 @@ bootstrap_start_ram:
* in VA 0xc0200000..
*/
- mrc p15, 0, r8, c2, c0, 0 /* get ttb prepared by redboot */
+ mrc p15, 0, r0, c2, c0, 0 /* get ttb prepared by redboot */
adr r4, mmu_init_table2
/*
#define BUILD_STARTUP_PAGETABLE
*/
#ifdef BUILD_STARTUP_PAGETABLE
- mrc p15, 0, r10, c1, c0, 0
- mov r10, #0
- tst r10, #CPU_CONTROL_MMU_ENABLE /* we already have a page table? */
+ mrc p15, 0, r2, c1, c0, 0
+ mov r2, #0
+ tst r2, #CPU_CONTROL_MMU_ENABLE /* we already have a page table? */
bne 3f
/* build page table from scratch */
- ldr r8, Lstartup_pagetable
+ ldr r0, Lstartup_pagetable
adr r4, mmu_init_table
b 3f
2:
- str r3, [r8, r10]
- add r10, r10, #4
+ str r3, [r0, r2]
+ add r2, r2, #4
add r3, r3, #(L1_S_SIZE)
- adds r9, r9, #-1
+ adds r1, r1, #-1
bhi 2b
3:
- ldmia r4!, {r9,r10,r3} /* # of sections, PA|attr, VA */
- cmp r9, #0
+ ldmia r4!, {r1,r2,r3} /* # of sections, PA|attr, VA */
+ cmp r1, #0
bne 2b
#endif
- mcr p15, 0, r8, c2, c0, 0 /* Set TTB */
- mcr p15, 0, r8, c8, c7, 0 /* Flush TLB */
+ mcr p15, 0, r0, c2, c0, 0 /* Set TTB */
+ mcr p15, 0, r0, c8, c7, 0 /* Flush TLB */
/* Set the Domain Access register. Very important! */
- mov r8, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
- mcr p15, 0, r8, c3, c0, 0
+ mov r0, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
+ mcr p15, 0, r0, c3, c0, 0
/* Enable MMU */
- mrc p15, 0, r8, c1, c0, 0
- orr r8, r8, #CPU_CONTROL_MMU_ENABLE
- mcr p15, 0, r8, c1, c0, 0
- CPWAIT(r8)
+ mrc p15, 0, r0, c1, c0, 0
+ orr r0, r0, #CPU_CONTROL_MMU_ENABLE
+ mcr p15, 0, r0, c1, c0, 0
+ CPWAIT(r0)
+
+ /* Restore U-Boot arguments */
+ mov r0, r6
+ mov r1, r7
+ mov r2, r8
/* Jump to kernel code in TRUE VA */
- adr r8, Lstart
- ldr pc, [r8]
+ adr r6, Lstart
+ ldr pc, [r6]
Lstart:
.word start
diff --git a/sys/arch/beagle/beagle/uboot_tags.c b/sys/arch/beagle/beagle/uboot_tags.c
new file mode 100644
index 00000000000..e9f0d666711
--- /dev/null
+++ b/sys/arch/beagle/beagle/uboot_tags.c
@@ -0,0 +1,125 @@
+/* $OpenBSD: uboot_tags.c,v 1.1 2011/10/21 22:55:01 drahn Exp $ */
+/*
+ * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <machine/bootconfig.h>
+
+struct uboot_tag_header {
+ uint32_t size;
+ uint32_t tag;
+};
+struct uboot_tag_core {
+ uint32_t flags;
+ uint32_t pagesize;
+ uint32_t rootdev;
+};
+struct uboot_tag_serialnr {
+ uint32_t low;
+ uint32_t high;
+};
+struct uboot_tag_revision {
+ uint32_t rev;
+};
+struct uboot_tag_mem32 {
+ uint32_t size;
+ uint32_t start;
+};
+struct uboot_tag_cmdline {
+ char cmdline[1];
+};
+
+#define ATAG_CORE 0x54410001
+#define ATAG_MEM 0x54410002
+#define ATAG_CMDLINE 0x54410009
+#define ATAG_SERIAL 0x54410006
+#define ATAG_REVISION 0x54410007
+#define ATAG_NONE 0x00000000
+struct uboot_tag {
+ struct uboot_tag_header hdr;
+ union {
+ struct uboot_tag_core core;
+ struct uboot_tag_mem32 mem;
+ struct uboot_tag_revision rev;
+ struct uboot_tag_serialnr serialnr;
+ struct uboot_tag_cmdline cmdline;
+ } u;
+};
+
+int parse_uboot_tags(void *handle);
+int
+parse_uboot_tags(void *handle)
+{
+ uint32_t *p;
+ struct uboot_tag *tag;
+ int i;
+
+ p = handle;
+ tag = (struct uboot_tag *)p;
+
+ while(tag != NULL && tag->hdr.size < 4096 &&
+ tag->hdr.tag != ATAG_NONE) {
+ switch (tag->hdr.tag) {
+ case ATAG_CORE:
+ printf("atag core flags %x pagesize %x rootdev %x\n",
+ tag->u.core.flags,
+ tag->u.core.pagesize,
+ tag->u.core.rootdev);
+ break;
+ case ATAG_MEM:
+ printf("atag mem start 0x%08x size 0x%x\n",
+ tag->u.mem.start,
+ tag->u.mem.size);
+
+ i = bootconfig.dramblocks -1;
+ if (bootconfig.dramblocks != 0 && (tag->u.mem.start == bootconfig.dram[i].address +
+ (bootconfig.dram[i].pages * PAGE_SIZE))) {
+ bootconfig.dram[i].pages = bootconfig.dram[i].pages + tag->u.mem.size / PAGE_SIZE;
+ } else {
+ i = bootconfig.dramblocks;
+ bootconfig.dram[i].address = tag->u.mem.start;
+ bootconfig.dram[i].pages = tag->u.mem.size / PAGE_SIZE;
+ bootconfig.dramblocks = i + 1;
+ }
+
+ break;
+ case ATAG_CMDLINE:
+ printf("atag cmdline [%s]\n",
+ tag->u.cmdline.cmdline);
+ break;
+ case ATAG_SERIAL:
+ printf("atag serial 0x%08x:%08x\n",
+ tag->u.serialnr.high,
+ tag->u.serialnr.low);
+ break;
+ case ATAG_REVISION:
+ printf("atag revision %08x\n",
+ tag->u.rev.rev);
+ break;
+ default:
+ printf("uboot tag unknown 0x%08x size %d\n",
+ tag->hdr.tag,
+ tag->hdr.size);
+ }
+ p = p + tag->hdr.size;
+ tag = (struct uboot_tag *)p;
+ }
+
+ return 0;
+}
diff --git a/sys/arch/beagle/conf/GENERIC b/sys/arch/beagle/conf/GENERIC
index ace9744335f..cb4f1812c96 100644
--- a/sys/arch/beagle/conf/GENERIC
+++ b/sys/arch/beagle/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.8 2011/10/17 03:03:59 drahn Exp $
+# $OpenBSD: GENERIC,v 1.9 2011/10/21 22:55:01 drahn Exp $
#
# GENERIC machine description file
#
@@ -89,9 +89,6 @@ usb* at ehci?
#mcspi0 at ahb? addr 0x48098000 intr 65
#mcspi1 at ahb? addr 0x4809A000 intr 66
-#atlas0 at ahb? intr 85 # really a spi device, not ahb
-#wskbd* at atlas? mux 1
-
#usbotg0 at ahb? addr 0x4c000000 size 0x70 intr 3
#usb* at ohci?
@@ -156,6 +153,7 @@ ch* at scsibus?
uk* at scsibus?
# onboard uarts
+com0 at ahb? addr 0x48020000 size 0x400 intr 74 # UART3
com0 at ahb? addr 0x49020000 size 0x400 intr 74 # UART3
#com1 at ahb? addr 0xXXXXXX00 size 0x400 intr 73
diff --git a/sys/arch/beagle/conf/files.beagle b/sys/arch/beagle/conf/files.beagle
index 4d2d1f9f035..2539b08347f 100644
--- a/sys/arch/beagle/conf/files.beagle
+++ b/sys/arch/beagle/conf/files.beagle
@@ -1,4 +1,4 @@
-# $OpenBSD: files.beagle,v 1.7 2011/05/15 08:52:48 matthieu Exp $
+# $OpenBSD: files.beagle,v 1.8 2011/10/21 22:55:01 drahn Exp $
#
# First try for arm-specific configuration info
#
@@ -25,6 +25,9 @@ file arch/arm/armv7/armv7_a4x_space.c ahb # XXX
file arch/arm/armv7/armv7_a4x_io.S ahb # XXX
file arch/arm/armv7/armv7_mutex.c
+# u-boot argument support
+file arch/beagle/beagle/uboot_tags.c
+
# note that the order of the devices in _this_ file
# affects the order that the devices will configure.
diff --git a/sys/arch/beagle/dev/gptimer.c b/sys/arch/beagle/dev/gptimer.c
index 8e5ae8c26e1..6c97cb593dd 100644
--- a/sys/arch/beagle/dev/gptimer.c
+++ b/sys/arch/beagle/dev/gptimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gptimer.c,v 1.5 2011/04/07 15:30:15 miod Exp $ */
+/* $OpenBSD: gptimer.c,v 1.6 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -141,6 +141,14 @@ struct cfdriver gptimer_cd = {
int
gptimer_match(struct device *parent, void *v, void *aux)
{
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ break; /* continue trying */
+ case BOARD_ID_OMAP4_PANDA:
+ return 0; /* not ported yet ??? - different */
+ default:
+ return 0; /* unknown */
+ }
return (1);
}
diff --git a/sys/arch/beagle/dev/intc.c b/sys/arch/beagle/dev/intc.c
index 8506f3853fb..09786443695 100644
--- a/sys/arch/beagle/dev/intc.c
+++ b/sys/arch/beagle/dev/intc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intc.c,v 1.6 2011/09/21 10:09:07 miod Exp $ */
+/* $OpenBSD: intc.c,v 1.7 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -140,6 +140,14 @@ int intc_attached = 0;
int
intc_match(struct device *parent, void *v, void *aux)
{
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ break; /* continue trying */
+ case BOARD_ID_OMAP4_PANDA:
+ return 0; /* not ported yet ??? - different */
+ default:
+ return 0; /* unknown */
+ }
if (intc_attached != 0)
return 0;
diff --git a/sys/arch/beagle/dev/omap_com.c b/sys/arch/beagle/dev/omap_com.c
index d6c53e6df54..28309abdec2 100644
--- a/sys/arch/beagle/dev/omap_com.c
+++ b/sys/arch/beagle/dev/omap_com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omap_com.c,v 1.5 2011/03/22 17:46:02 deraadt Exp $ */
+/* $OpenBSD: omap_com.c,v 1.6 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
* All rights reserved.
@@ -68,33 +68,47 @@ int
omapuart_match(struct device *parent, void *cf, void *aux)
{
struct ahb_attach_args *aa = aux;
- bus_space_tag_t bt = &armv7_a4x_bs_tag; /* XXX: This sucks */
- bus_space_handle_t bh;
- int rv;
+ extern uint32_t board_id;
+ int rv = 0;
/* XXX */
- if (aa->aa_addr == 0x4806A000 && aa->aa_intr == 72)
- return 1;
- if (aa->aa_addr == 0x4806C000 && aa->aa_intr == 73)
- return 1;
- if (aa->aa_addr == 0x4806E000 && aa->aa_intr == 74)
- return 1;
- {
- extern bus_addr_t comconsaddr;
-
- if (comconsaddr == aa->aa_addr)
- return (1);
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ if (aa->aa_addr == 0x4806A000 && aa->aa_intr == 72) {
+ rv = 1;
+ break;
+ }
+ if (aa->aa_addr == 0x4806C000 && aa->aa_intr == 73) {
+ rv = 1;
+ break;
+ }
+ if (aa->aa_addr == 0x49020000 && aa->aa_intr == 74) {
+ rv = 1;
+ break;
+ }
+ break;
+ case BOARD_ID_OMAP4_PANDA:
+ if (aa->aa_addr == 0x4806A000 && aa->aa_intr == 72) {
+ rv = 1;
+ break;
+ }
+ if (aa->aa_addr == 0x4806C000 && aa->aa_intr == 73) {
+ rv = 1;
+ break;
+ }
+ if (aa->aa_addr == 0x48020000 && aa->aa_intr == 74) {
+ rv = 1;
+ break;
+ }
+ if (aa->aa_addr == 0x4806E000 && aa->aa_intr == 70) {
+ rv = 1;
+ break;
+ }
+ break;
+ default:
+ printf("unknown boardid %d", board_id);
}
- if (bus_space_map(bt, aa->aa_addr, aa->aa_size, 0, &bh))
- return (0);
-
- /* Make sure the UART is enabled - XXX */
- bus_space_write_1(bt, bh, com_ier, IER_EUART);
-
- rv = comprobe1(bt, bh);
- bus_space_unmap(bt, bh, aa->aa_size);
-
return (rv);
}
diff --git a/sys/arch/beagle/dev/omdog.c b/sys/arch/beagle/dev/omdog.c
index 283829eb4f2..ddeb98a1802 100644
--- a/sys/arch/beagle/dev/omdog.c
+++ b/sys/arch/beagle/dev/omdog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omdog.c,v 1.1 2009/05/08 03:13:26 drahn Exp $ */
+/* $OpenBSD: omdog.c,v 1.2 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -73,6 +73,14 @@ struct cfdriver omdog_cd = {
int
omdog_match(struct device *parent, void *v, void *aux)
{
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ break; /* continue trying */
+ case BOARD_ID_OMAP4_PANDA:
+ return 0; /* not ported yet */
+ default:
+ return 0; /* unknown */
+ }
return (1);
}
diff --git a/sys/arch/beagle/dev/omehci.c b/sys/arch/beagle/dev/omehci.c
index 37396d367f2..ed602089a22 100644
--- a/sys/arch/beagle/dev/omehci.c
+++ b/sys/arch/beagle/dev/omehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omehci.c,v 1.5 2011/03/14 14:20:58 jasper Exp $ */
+/* $OpenBSD: omehci.c,v 1.6 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -62,6 +62,14 @@ omehci_match(struct device *parent, void *match, void *aux)
{
struct ahb_attach_args *aa = aux;
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ break; /* continue trying */
+ case BOARD_ID_OMAP4_PANDA:
+ return 0; /* not ported yet ??? - different */
+ default:
+ return 0; /* unknown */
+ }
if (aa->aa_addr != EHCI_HCPCAPBASE)
return 0;
diff --git a/sys/arch/beagle/dev/omgpio.c b/sys/arch/beagle/dev/omgpio.c
index cd396333b9c..14623fcb09a 100644
--- a/sys/arch/beagle/dev/omgpio.c
+++ b/sys/arch/beagle/dev/omgpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omgpio.c,v 1.4 2010/09/20 06:33:48 matthew Exp $ */
+/* $OpenBSD: omgpio.c,v 1.5 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -102,6 +102,14 @@ struct cfdriver omgpio_cd = {
int
omgpio_match(struct device *parent, void *v, void *aux)
{
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ break; /* continue trying */
+ case BOARD_ID_OMAP4_PANDA:
+ return 0; /* not ported yet ??? - different */
+ default:
+ return 0; /* unknown */
+ }
return (1);
}
diff --git a/sys/arch/beagle/dev/ommmc.c b/sys/arch/beagle/dev/ommmc.c
index b4f9bfcf8e0..3b1a8696b8e 100644
--- a/sys/arch/beagle/dev/ommmc.c
+++ b/sys/arch/beagle/dev/ommmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ommmc.c,v 1.8 2010/09/06 19:20:19 deraadt Exp $ */
+/* $OpenBSD: ommmc.c,v 1.9 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright (c) 2009 Dale Rahn <drahn@openbsd.org>
@@ -353,14 +353,21 @@ ommmc_match(struct device *parent, void *v, void *aux)
{
struct ahb_attach_args *aa = aux;
/* XXX */
- if (aa->aa_addr == MMCHS1_ADDR && aa->aa_intr == 83)
- return 1;
- else if (aa->aa_addr == MMCHS2_ADDR && aa->aa_intr == 86)
- return 1;
- else if (aa->aa_addr == MMCHS3_ADDR && aa->aa_intr == 94)
- return 1;
- else
- return (0);
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ if (aa->aa_addr == MMCHS1_ADDR && aa->aa_intr == 83)
+ return 1;
+ else if (aa->aa_addr == MMCHS2_ADDR && aa->aa_intr == 86)
+ return 1;
+ else if (aa->aa_addr == MMCHS3_ADDR && aa->aa_intr == 94)
+ return 1;
+ break;
+ case BOARD_ID_OMAP4_PANDA:
+ return 0; /* not ported yet ??? - different */
+ default:
+ return 0; /* unknown */
+ }
+ return (0);
}
void
diff --git a/sys/arch/beagle/dev/omusbtll.c b/sys/arch/beagle/dev/omusbtll.c
index 2110fded662..40f6e515ddd 100644
--- a/sys/arch/beagle/dev/omusbtll.c
+++ b/sys/arch/beagle/dev/omusbtll.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omusbtll.c,v 1.1 2011/03/14 15:09:28 drahn Exp $ */
+/* $OpenBSD: omusbtll.c,v 1.2 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright (c) 2010 Dale Rahn <drahn@openbsd.org>
*
@@ -110,6 +110,14 @@ struct cfdriver omusbtll_cd = {
int
omusbtll_match(struct device *parent, void *v, void *aux)
{
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ break; /* continue trying */
+ case BOARD_ID_OMAP4_PANDA:
+ return 0; /* not ported yet ??? - different */
+ default:
+ return 0; /* unknown */
+ }
return (1);
}
diff --git a/sys/arch/beagle/dev/prcm.c b/sys/arch/beagle/dev/prcm.c
index 622aad93dd1..02ab214aaa9 100644
--- a/sys/arch/beagle/dev/prcm.c
+++ b/sys/arch/beagle/dev/prcm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: prcm.c,v 1.6 2011/09/18 20:02:25 miod Exp $ */
+/* $OpenBSD: prcm.c,v 1.7 2011/10/21 22:55:01 drahn Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -178,6 +178,14 @@ int
prcm_match(struct device *parent, void *v, void *aux)
{
/* only attach once */
+ switch (board_id) {
+ case BOARD_ID_OMAP3_BEAGLE:
+ break; /* continue trying */
+ case BOARD_ID_OMAP4_PANDA:
+ return 0; /* not ported yet */
+ default:
+ return 0; /* unknown */
+ }
if (prcm_attached != 0)
return (0);
return (1);