[PATCH v3] mach-at91: Support for gms board added

Ryan Mallon ryan at bluewatersys.com
Wed Dec 8 15:13:32 EST 2010


On 12/09/2010 08:45 AM, Igor Plyatov wrote:
> Code for the Stamp9G20 SoM separated into the board-stamp9g20.c, and following
> files correspond to carrier boards for Stamp9G20:
> * carrier-board-gms.c - "GMS", Seismograph from GeoSIG.
> * carrier-board-panelcardevb.c - "Panel Card EVB", Taskit's eval. board.
> * carrier-board-portuxg20.c - "Portux G20", derivative from Stamp9G20.
> * carrier-board-pcontrol_g20.c - "Pcontrol G20", PORTNER-Elektronik.
> .
> All stuff specific to carrier board encapsulated into functions:
> * carrier_board_map_io()
> * carrier_board_init()
> which used in the board-stamp9g20.c
> .
> There is only one choice for Stamp9G20 carrier board from:
> * CONFIG_CARRIERBOARD_GMS
> * CONFIG_CARRIERBOARD_PANELCARDEVB
> * CONFIG_CARRIERBOARD_PCONTROL_G20
> * CONFIG_CARRIERBOARD_PORTUXG20

It is useful to be able to build multiple boards into a single kernel.

> --- /dev/null
> +++ b/arch/arm/mach-at91/carrier-board-gms.c
> @@ -0,0 +1,556 @@
> +/*
> + *  Copyright (C) 2010 Christian Glindkamp <christian.glindkamp at taskit.de>
> + *			taskit GmbH
> + *                2010 Igor Plyatov <plyatov at gmail.com>
> + *			GeoSIG Ltd
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + */
> +
> +#include <linux/platform_device.h>
> +#include <linux/gpio.h>
> +#include <linux/gpio_keys.h>
> +#include <linux/input.h>
> +#include <linux/i2c/pcf857x.h>
> +
> +#include <mach/board.h>
> +#include <mach/gms.h>
> +
> +void __init carrier_board_map_io(void)
> +{

This approach won't work. If you have more than one carrier board
compiled into your kernel then you will get multiple definition errors.
The name carrier_board_map_io is also way too generic.

The better approach would be to do this the other way so that the
carrier board calls the SoM map_io function.

> +	/*
> +	 * USART0 on ttyS1 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI).
> +	 * Used for Internal Analog Modem.
> +	 */
> +	at91_register_uart(AT91SAM9260_ID_US0, 1,
> +			     ATMEL_UART_CTS | ATMEL_UART_RTS
> +			   | ATMEL_UART_DTR | ATMEL_UART_DSR
> +			   | ATMEL_UART_DCD | ATMEL_UART_RI);
> +	/*
> +	 * USART1 on ttyS2 (Rx, Tx, CTS, RTS).
> +	 * Used for GPS or WiFi or Data stream.
> +	 */
> +	at91_register_uart(AT91SAM9260_ID_US1, 2,
> +			   ATMEL_UART_CTS | ATMEL_UART_RTS);
> +	/*
> +	 * USART2 on ttyS3 (Rx, Tx, CTS, RTS).
> +	 * Used for External Modem.
> +	 */
> +	at91_register_uart(AT91SAM9260_ID_US2, 3,
> +			   ATMEL_UART_CTS | ATMEL_UART_RTS);
> +	/*
> +	 * USART3 on ttyS4 (Rx, Tx, RTS).
> +	 * Used for RS-485.
> +	 */
> +	at91_register_uart(AT91SAM9260_ID_US3, 4, ATMEL_UART_RTS);
> +
> +	/*
> +	 * USART4 on ttyS5 (Rx, Tx).
> +	 * Used for TRX433 Radio Module.
> +	 */
> +	at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
> +}

~Ryan

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934



More information about the linux-arm-kernel mailing list