#include <linux/init.h>
#include <asm/arch/board.h>
+#include <asm/arch/init.h>
struct eth_platform_data __initdata eth0_data = {
.valid = 1,
extern struct lcdc_platform_data atstk1000_fb0_data;
+void __init setup_board(void)
+{
+ at32_map_usart(1, 0); /* /dev/ttyS0 */
+ at32_map_usart(2, 1); /* /dev/ttyS1 */
+ at32_map_usart(3, 2); /* /dev/ttyS2 */
+
+ at32_setup_serial_console(0);
+}
+
static int __init atstk1002_init(void)
{
at32_add_system_devices();
- at32_add_device_usart(1); /* /dev/ttyS0 */
- at32_add_device_usart(2); /* /dev/ttyS1 */
- at32_add_device_usart(3); /* /dev/ttyS2 */
+ at32_add_device_usart(0);
+ at32_add_device_usart(1);
+ at32_add_device_usart(2);
at32_add_device_eth(0, ð0_data);
at32_add_device_spi(0);
setup_processor();
setup_platform();
+ setup_board();
cpu_clk = clk_get(NULL, "cpu");
if (IS_ERR(cpu_clk)) {
at32_sm_init();
at32_clock_init();
at32_portmux_init();
-
- /* FIXME: This doesn't belong here */
- at32_setup_serial_console(1);
}
static int __init pdc_probe(struct platform_device *pdev)
portmux_set_func(PIOB, 17, FUNC_B); /* TXD */
}
-static struct platform_device *setup_usart(unsigned int id)
+static struct platform_device *at32_usarts[4];
+
+void __init at32_map_usart(unsigned int hw_id, unsigned int line)
{
struct platform_device *pdev;
- switch (id) {
+ switch (hw_id) {
case 0:
pdev = &atmel_usart0_device;
configure_usart0_pins();
configure_usart3_pins();
break;
default:
- return NULL;
+ return;
}
if (PXSEG(pdev->resource[0].start) == P4SEG) {
data->regs = (void __iomem *)pdev->resource[0].start;
}
- return pdev;
+ pdev->id = line;
+ at32_usarts[line] = pdev;
}
struct platform_device *__init at32_add_device_usart(unsigned int id)
{
- struct platform_device *pdev;
-
- pdev = setup_usart(id);
- if (pdev)
- platform_device_register(pdev);
-
- return pdev;
+ platform_device_register(at32_usarts[id]);
+ return at32_usarts[id];
}
struct platform_device *atmel_default_console_device;
void __init at32_setup_serial_console(unsigned int usart_id)
{
- atmel_default_console_device = setup_usart(usart_id);
+ atmel_default_console_device = at32_usarts[usart_id];
}
/* --------------------------------------------------------------------
short use_dma_rx; /* use receive DMA? */
void __iomem *regs; /* virtual base address, if any */
};
+void at32_map_usart(unsigned int hw_id, unsigned int line);
struct platform_device *at32_add_device_usart(unsigned int id);
struct eth_platform_data {
#define __ASM_AVR32_AT32AP_INIT_H__
void setup_platform(void);
+void setup_board(void);
/* Called by setup_platform */
void at32_clock_init(void);