Commit 067bbada authored by Andrew Victor's avatar Andrew Victor Committed by Russell King

[ARM] 3589/1: AT91RM9200 DK/EK board update

Patch from Andrew Victor

This patch updates the support for the Atmel DK and EK boards.

The changes include:
1. Use the new at91_uart_config structure and device registration
functions for the UARTs.
2. Registration of I2C and SPI platform devices.
3. The USB Device pullup line is connected to reset, so multidrive needs
to be enabled on the line.  [Patch from David Brownell].
Signed-off-by: default avatarAndrew Victor <andrew@sanpeople.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 466e6227
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/setup.h> #include <asm/setup.h>
...@@ -38,8 +39,8 @@ ...@@ -38,8 +39,8 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#include <asm/mach/serial_at91rm9200.h>
#include <asm/arch/board.h> #include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h" #include "generic.h"
...@@ -57,14 +58,14 @@ static void __init dk_init_irq(void) ...@@ -57,14 +58,14 @@ static void __init dk_init_irq(void)
* 0 .. 3 = USART0 .. USART3 * 0 .. 3 = USART0 .. USART3
* 4 = DBGU * 4 = DBGU
*/ */
#define DK_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ static struct at91_uart_config __initdata dk_uart_config = {
#define DK_SERIAL_CONSOLE 0 /* ttyS0 */ .console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init dk_map_io(void) static void __init dk_map_io(void)
{ {
int serial[AT91_NR_UART] = DK_UART_MAP;
int i;
at91rm9200_map_io(); at91rm9200_map_io();
/* Initialize clocks: 18.432 MHz crystal */ /* Initialize clocks: 18.432 MHz crystal */
...@@ -73,16 +74,8 @@ static void __init dk_map_io(void) ...@@ -73,16 +74,8 @@ static void __init dk_map_io(void)
/* Setup the LEDs */ /* Setup the LEDs */
at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
#ifdef CONFIG_SERIAL_AT91 /* Setup the serial ports and console */
at91_console_port = DK_SERIAL_CONSOLE; at91_init_serial(&dk_uart_config);
memcpy(at91_serial_map, serial, sizeof(serial));
/* Register UARTs */
for (i = 0; i < AT91_NR_UART; i++) {
if (at91_serial_map[i] >= 0)
at91_register_uart(i, at91_serial_map[i]);
}
#endif
} }
static struct at91_eth_data __initdata dk_eth_data = { static struct at91_eth_data __initdata dk_eth_data = {
...@@ -111,16 +104,48 @@ static struct at91_mmc_data __initdata dk_mmc_data = { ...@@ -111,16 +104,48 @@ static struct at91_mmc_data __initdata dk_mmc_data = {
.wire4 = 1, .wire4 = 1,
}; };
static struct spi_board_info dk_spi_devices[] = {
{ /* DataFlash chip */
.modalias = "mtd_dataflash",
.chip_select = 0,
.max_speed_hz = 15 * 1000 * 1000,
},
{ /* UR6HCPS2-SP40 PS2-to-SPI adapter */
.modalias = "ur6hcps2",
.chip_select = 1,
.max_speed_hz = 250 * 1000,
},
{ /* TLV1504 ADC, 4 channels, 10 bits; one is a temp sensor */
.modalias = "tlv1504",
.chip_select = 2,
.max_speed_hz = 20 * 1000 * 1000,
},
#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
{ /* DataFlash card */
.modalias = "mtd_dataflash",
.chip_select = 3,
.max_speed_hz = 15 * 1000 * 1000,
}
#endif
};
static void __init dk_board_init(void) static void __init dk_board_init(void)
{ {
/* Serial */
at91_add_device_serial();
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&dk_eth_data); at91_add_device_eth(&dk_eth_data);
/* USB Host */ /* USB Host */
at91_add_device_usbh(&dk_usbh_data); at91_add_device_usbh(&dk_usbh_data);
/* USB Device */ /* USB Device */
at91_add_device_udc(&dk_udc_data); at91_add_device_udc(&dk_udc_data);
at91_set_multi_drive(dk_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
/* Compact Flash */ /* Compact Flash */
at91_add_device_cf(&dk_cf_data); at91_add_device_cf(&dk_cf_data);
/* I2C */
at91_add_device_i2c();
/* SPI */
at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices));
#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD #ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
/* DataFlash card */ /* DataFlash card */
at91_set_gpio_output(AT91_PIN_PB7, 0); at91_set_gpio_output(AT91_PIN_PB7, 0);
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/setup.h> #include <asm/setup.h>
...@@ -38,8 +39,8 @@ ...@@ -38,8 +39,8 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#include <asm/mach/serial_at91rm9200.h>
#include <asm/arch/board.h> #include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h" #include "generic.h"
...@@ -57,14 +58,14 @@ static void __init ek_init_irq(void) ...@@ -57,14 +58,14 @@ static void __init ek_init_irq(void)
* 0 .. 3 = USART0 .. USART3 * 0 .. 3 = USART0 .. USART3
* 4 = DBGU * 4 = DBGU
*/ */
#define EK_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ static struct at91_uart_config __initdata ek_uart_config = {
#define EK_SERIAL_CONSOLE 0 /* ttyS0 */ .console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init ek_map_io(void) static void __init ek_map_io(void)
{ {
int serial[AT91_NR_UART] = EK_UART_MAP;
int i;
at91rm9200_map_io(); at91rm9200_map_io();
/* Initialize clocks: 18.432 MHz crystal */ /* Initialize clocks: 18.432 MHz crystal */
...@@ -73,16 +74,8 @@ static void __init ek_map_io(void) ...@@ -73,16 +74,8 @@ static void __init ek_map_io(void)
/* Setup the LEDs */ /* Setup the LEDs */
at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2); at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
#ifdef CONFIG_SERIAL_AT91 /* Setup the serial ports and console */
at91_console_port = EK_SERIAL_CONSOLE; at91_init_serial(&ek_uart_config);
memcpy(at91_serial_map, serial, sizeof(serial));
/* Register UARTs */
for (i = 0; i < AT91_NR_UART; i++) {
if (serial[i] >= 0)
at91_register_uart(i, serial[i]);
}
#endif
} }
static struct at91_eth_data __initdata ek_eth_data = { static struct at91_eth_data __initdata ek_eth_data = {
...@@ -106,14 +99,36 @@ static struct at91_mmc_data __initdata ek_mmc_data = { ...@@ -106,14 +99,36 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
.wp_pin = AT91_PIN_PA17, .wp_pin = AT91_PIN_PA17,
}; };
static struct spi_board_info ek_spi_devices[] = {
{ /* DataFlash chip */
.modalias = "mtd_dataflash",
.chip_select = 0,
.max_speed_hz = 15 * 1000 * 1000,
},
#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
{ /* DataFlash card */
.modalias = "mtd_dataflash",
.chip_select = 3,
.max_speed_hz = 15 * 1000 * 1000,
},
#endif
};
static void __init ek_board_init(void) static void __init ek_board_init(void)
{ {
/* Serial */
at91_add_device_serial();
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&ek_eth_data); at91_add_device_eth(&ek_eth_data);
/* USB Host */ /* USB Host */
at91_add_device_usbh(&ek_usbh_data); at91_add_device_usbh(&ek_usbh_data);
/* USB Device */ /* USB Device */
at91_add_device_udc(&ek_udc_data); at91_add_device_udc(&ek_udc_data);
at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
/* I2C */
at91_add_device_i2c();
/* SPI */
at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD #ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
/* DataFlash card */ /* DataFlash card */
at91_set_gpio_output(AT91_PIN_PB22, 0); at91_set_gpio_output(AT91_PIN_PB22, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment