From 28a7eca4eb47f6b8e9d9603ad2c9afdc4c11b44d Mon Sep 17 00:00:00 2001 From: imp Date: Fri, 13 Jul 2012 04:22:08 +0000 Subject: For our at91rm9200 boards, register which subtype of SoC is on the board. We'll use this later to control the differences between these two variants' pins. --- sys/arm/at91/at91rm9200_devices.c | 62 +++++++++++++++++++++++++++++++++++++++ sys/arm/at91/at91rm9200var.h | 33 +++++++++++++++++++++ sys/arm/at91/board_bwct.c | 7 ++++- sys/arm/at91/board_hl200.c | 7 ++++- sys/arm/at91/board_kb920x.c | 8 +++-- sys/arm/at91/board_tsc4370.c | 7 ++++- sys/arm/at91/files.at91 | 1 + 7 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 sys/arm/at91/at91rm9200_devices.c create mode 100644 sys/arm/at91/at91rm9200var.h diff --git a/sys/arm/at91/at91rm9200_devices.c b/sys/arm/at91/at91rm9200_devices.c new file mode 100644 index 0000000..7957fd0 --- /dev/null +++ b/sys/arm/at91/at91rm9200_devices.c @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2012 M. Warner Losh. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#define _ARM32_BUS_DMA_PRIVATE +#include + +#include +#include + +/* + * The AT91RM9200 uses the same silicon for both the BGA and PQFP + * packages. There's no documented way to detect this at runtime, + * so we require the board code to register what type of SoC is on the + * board in question. The pinouts are not quite compatible, and we + * use this information to cope with the slight differences. + */ +void +at91rm9200_set_subtype(enum at91_soc_subtype st) +{ + + switch (st) { + case AT91_ST_RM9200_BGA: + case AT91_ST_RM9200_PQFP: + soc_info.subtype = st; + break; + default: + panic("Bad SoC subtype %d for at91rm9200_set_subtype.", st); + break; + } +} diff --git a/sys/arm/at91/at91rm9200var.h b/sys/arm/at91/at91rm9200var.h new file mode 100644 index 0000000..b766dc5 --- /dev/null +++ b/sys/arm/at91/at91rm9200var.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2012 M. Warner Losh. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $FreeBSD$ */ + +#ifndef ARM_AT91_AT91RM9200VAR_H +#define ARM_AT91_AT91RM9200VAR_H + +void at91rm9200_set_subtype(enum at91_soc_subtype st); + +#endif /* ARM_AT91_AT91RM9200VAR_H */ diff --git a/sys/arm/at91/board_bwct.c b/sys/arm/at91/board_bwct.c index 63f3910..ee017c2 100644 --- a/sys/arm/at91/board_bwct.c +++ b/sys/arm/at91/board_bwct.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2005-2008 Olivier Houchard. All rights reserved. - * Copyright (c) 2005-2008 Warner Losh. All rights reserved. + * Copyright (c) 2005-2012 Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,13 +31,18 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include BOARD_INIT long board_init(void) { + + at91rm9200_set_subtype(AT91_ST_RM9200_BGA); + /* * Since the USART supports RS-485 multidrop mode, it allows the * TX pins to float. However, for RS-232 operations, we don't want diff --git a/sys/arm/at91/board_hl200.c b/sys/arm/at91/board_hl200.c index 07db749..4936814 100644 --- a/sys/arm/at91/board_hl200.c +++ b/sys/arm/at91/board_hl200.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2005-2008 Olivier Houchard. All rights reserved. - * Copyright (c) 2005-2008 Warner Losh. All rights reserved. + * Copyright (c) 2005-2012 Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,13 +31,18 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include BOARD_INIT long board_init(void) { + + at91rm9200_set_subtype(AT91_ST_RM9200_BGA); + /* * Since the USART supports RS-485 multidrop mode, it allows the * TX pins to float. However, for RS-232 operations, we don't want diff --git a/sys/arm/at91/board_kb920x.c b/sys/arm/at91/board_kb920x.c index a577f87..bb8e011 100644 --- a/sys/arm/at91/board_kb920x.c +++ b/sys/arm/at91/board_kb920x.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2005-2008 Olivier Houchard. All rights reserved. - * Copyright (c) 2005-2008 Warner Losh. All rights reserved. + * Copyright (c) 2005-2012 Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,15 +30,19 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include +#include #include #include BOARD_INIT long board_init(void) { + + at91rm9200_set_subtype(AT91_ST_RM9200_PQFP); + /* * Since the USART supports RS-485 multidrop mode, it allows the * TX pins to float. However, for RS-232 operations, we don't want diff --git a/sys/arm/at91/board_tsc4370.c b/sys/arm/at91/board_tsc4370.c index 8139a4a..cadc22b 100644 --- a/sys/arm/at91/board_tsc4370.c +++ b/sys/arm/at91/board_tsc4370.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2005-2008 Olivier Houchard. All rights reserved. - * Copyright (c) 2005-2008 Warner Losh. All rights reserved. + * Copyright (c) 2005-2012 Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,13 +31,18 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include BOARD_INIT long board_init(void) { + + at91rm9200_set_subtype(AT91_ST_RM9200_PQFP); + /* * Since the USART supports RS-485 multidrop mode, it allows the * TX pins to float. However, for RS-232 operations, we don't want diff --git a/sys/arm/at91/files.at91 b/sys/arm/at91/files.at91 index a60c471..f03137f 100644 --- a/sys/arm/at91/files.at91 +++ b/sys/arm/at91/files.at91 @@ -29,6 +29,7 @@ arm/at91/uart_dev_at91usart.c optional uart # arm/at91/at91soc.c standard arm/at91/at91rm9200.c optional at91rm9200 +arm/at91/at91rm9200_devices.c optional at91rm9200 arm/at91/at91sam9260.c optional at91sam9260 arm/at91/at91sam9g20.c optional at91sam9g20 arm/at91/at91sam9x25.c optional at91sam9x25 -- cgit v1.1