From 729a995971b16881ce84094346831442fe210c83 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 22 May 2013 17:44:48 +0000 Subject: Add am335x as an omap device. ok patrick@ --- sys/arch/beagle/beagle/beagle_machdep.c | 8 +- sys/arch/beagle/conf/files.beagle | 3 +- sys/arch/beagle/dev/am335x.c | 157 ++++++++++++++++++++++++++++++++ sys/arch/beagle/dev/omap.c | 18 +++- sys/arch/beagle/dev/omapvar.h | 3 +- 5 files changed, 185 insertions(+), 4 deletions(-) create mode 100644 sys/arch/beagle/dev/am335x.c (limited to 'sys') diff --git a/sys/arch/beagle/beagle/beagle_machdep.c b/sys/arch/beagle/beagle/beagle_machdep.c index 9ad0bccf417..f8cd608025c 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.18 2013/05/10 10:17:27 patrick Exp $ */ +/* $OpenBSD: beagle_machdep.c,v 1.19 2013/05/22 17:44:46 rapha Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -891,6 +891,9 @@ initarm(void *arg0, void *arg1, void *arg2) case BOARD_ID_OMAP3_BEAGLE: printf("board type: beagle\n"); break; + case BOARD_ID_AM335X_BEAGLEBONE: + printf("board type: beaglebone\n"); + break; case BOARD_ID_OMAP3_OVERO: printf("board type: overo\n"); break; @@ -989,6 +992,9 @@ consinit(void) case BOARD_ID_OMAP3_OVERO: paddr = 0x49020000; break; + case BOARD_ID_AM335X_BEAGLEBONE: + paddr = 0x44E09000; /* UART0 */ + break; case BOARD_ID_OMAP4_PANDA: paddr = 0x48020000; break; diff --git a/sys/arch/beagle/conf/files.beagle b/sys/arch/beagle/conf/files.beagle index 86c58cac65f..87ac2a3e929 100644 --- a/sys/arch/beagle/conf/files.beagle +++ b/sys/arch/beagle/conf/files.beagle @@ -1,4 +1,4 @@ -# $OpenBSD: files.beagle,v 1.15 2013/05/21 14:41:05 rapha Exp $ +# $OpenBSD: files.beagle,v 1.16 2013/05/22 17:44:47 rapha Exp $ # # First try for arm-specific configuration info # @@ -31,6 +31,7 @@ attach omap at mainbus file arch/beagle/dev/omap.c omap file arch/beagle/dev/omap3.c omap file arch/beagle/dev/omap4.c omap +file arch/beagle/dev/am335x.c omap include "dev/sdmmc/files.sdmmc" diff --git a/sys/arch/beagle/dev/am335x.c b/sys/arch/beagle/dev/am335x.c new file mode 100644 index 00000000000..eb5261706a3 --- /dev/null +++ b/sys/arch/beagle/dev/am335x.c @@ -0,0 +1,157 @@ +/* $OpenBSD: am335x.c,v 1.1 2013/05/22 17:44:47 rapha Exp $ */ + +/* + * Copyright (c) 2011 Uwe Stuehler + * Copyright (c) 2013 Raphael Graf + * + * 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 +#include +#include + +#include + +#define PRCM_SIZE 0x2000 +#define PRCM_ADDR 0x44E00000 + +#define INTC_SIZE 0x300 +#define INTC_ADDR 0x48200000 + +#define DMTIMERx_SIZE 0x80 +#define DMTIMER0_ADDR 0x44E05000 +#define DMTIMER1_ADDR 0x44E31000 /* 1MS */ +#define DMTIMER2_ADDR 0x48040000 +#define DMTIMER3_ADDR 0x48042000 +#define DMTIMER4_ADDR 0x48044000 +#define DMTIMER5_ADDR 0x48046000 +#define DMTIMER6_ADDR 0x48048000 +#define DMTIMER7_ADDR 0x4804A000 +#define DMTIMER0_IRQ 66 +#define DMTIMER1_IRQ 67 +#define DMTIMER2_IRQ 68 +#define DMTIMER3_IRQ 69 +#define DMTIMER4_IRQ 92 +#define DMTIMER5_IRQ 93 +#define DMTIMER6_IRQ 94 +#define DMTIMER7_IRQ 95 + +#define WD_SIZE 0x80 +#define WD_ADDR 0x44E35000 +#define WD_IRQ 91 + +#define GPIOx_SIZE 0x200 +#define GPIO0_ADDR 0x44E07000 +#define GPIO1_ADDR 0x4804C000 +#define GPIO2_ADDR 0x481AC000 +#define GPIO3_ADDR 0x481AE000 +#define GPIO0_IRQ 96 +#define GPIO1_IRQ 98 +#define GPIO2_IRQ 32 +#define GPIO3_IRQ 62 + +#define UARTx_SIZE 0x90 +#define UART0_ADDR 0x44E09000 +#define UART1_ADDR 0x48022000 +#define UART2_ADDR 0x48024000 +#define UART3_ADDR 0x481A6000 +#define UART4_ADDR 0x481A8000 +#define UART5_ADDR 0x481AA000 +#define UART0_IRQ 72 +#define UART1_IRQ 73 +#define UART2_IRQ 74 +#define UART3_IRQ 44 +#define UART4_IRQ 45 +#define UART5_IRQ 46 + +#define HSMMCx_SIZE 0x300 +#define HSMMC0_ADDR 0x48060000 +#define HSMMC0_IRQ 64 + +struct omap_dev am335x_devs[] = { + + /* + * Power, Reset and Clock Manager + */ + + { .name = "prcm", + .unit = 0, + .mem = { { PRCM_ADDR, PRCM_SIZE } }, + }, + + /* + * Interrupt Controller + */ + + { .name = "intc", + .unit = 0, + .mem = { { INTC_ADDR, INTC_SIZE } }, + }, + + /* + * General Purpose Timers + */ + + { .name = "dmtimer", + .unit = 0, + .mem = { { DMTIMER2_ADDR, DMTIMERx_SIZE } }, + .irq = { DMTIMER2_IRQ } + }, + + { .name = "dmtimer", + .unit = 1, + .mem = { { DMTIMER3_ADDR, DMTIMERx_SIZE } }, + .irq = { DMTIMER3_IRQ } + }, + + /* + * Watchdog Timer + */ + + { .name = "omdog", + .unit = 0, + .mem = { { WD_ADDR, WD_SIZE } } + }, + + /* + * UART + */ + + { .name = "com", + .unit = 0, + .mem = { { UART0_ADDR, UARTx_SIZE } }, + .irq = { UART0_IRQ } + }, + + /* + * MMC + */ + + { .name = "ommmc", + .unit = 0, + .mem = { { HSMMC0_ADDR, HSMMCx_SIZE } }, + .irq = { HSMMC0_IRQ } + }, + + /* Terminator */ + { .name = NULL, + .unit = 0 + } +}; + +void +am335x_init(void) +{ + omap_set_devs(am335x_devs); +} diff --git a/sys/arch/beagle/dev/omap.c b/sys/arch/beagle/dev/omap.c index 25e90bd77ca..5ed108c7e5a 100644 --- a/sys/arch/beagle/dev/omap.c +++ b/sys/arch/beagle/dev/omap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omap.c,v 1.6 2013/05/09 15:16:53 patrick Exp $ */ +/* $OpenBSD: omap.c,v 1.7 2013/05/22 17:44:47 rapha Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn * @@ -66,6 +66,17 @@ struct board_dev beagleboard_devs[] = { { NULL, 0 } }; +struct board_dev beaglebone_devs[] = { + { "prcm", 0 }, + { "intc", 0 }, + { "dmtimer", 0 }, + { "dmtimer", 1 }, + { "omdog", 0 }, + { "ommmc", 0 }, /* HSMMC0 */ + { "com", 0 }, /* UART0 */ + { NULL, 0 } +}; + struct board_dev overo_devs[] = { { "prcm", 0 }, { "intc", 0 }, @@ -134,6 +145,11 @@ omap_attach(struct device *parent, struct device *self, void *aux) omap3_init(); board_devs = beagleboard_devs; break; + case BOARD_ID_AM335X_BEAGLEBONE: + printf(": BeagleBone\n"); + am335x_init(); + board_devs = beaglebone_devs; + break; case BOARD_ID_OMAP3_OVERO: printf(": Gumstix Overo\n"); omap3_init(); diff --git a/sys/arch/beagle/dev/omapvar.h b/sys/arch/beagle/dev/omapvar.h index 0375c4833fb..bfebf786b0b 100644 --- a/sys/arch/beagle/dev/omapvar.h +++ b/sys/arch/beagle/dev/omapvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: omapvar.h,v 1.2 2013/05/14 11:05:57 rapha Exp $ */ +/* $OpenBSD: omapvar.h,v 1.3 2013/05/22 17:44:47 rapha Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn * @@ -44,6 +44,7 @@ struct omap_dev *omap_find_dev(const char *, int); void omap3_init(void); void omap4_init(void); +void am335x_init(void); /* XXX */ void *avic_intr_establish(int irqno, int level, int (*func)(void *), -- cgit v1.2.3