ARM: at91/clock: fix PLLA overclock warning
[sfrench/cifs-2.6.git] / arch / arm / mach-at91 / board-cpuat91.c
1 /*
2  * linux/arch/arm/mach-at91/board-cpuat91.c
3  *
4  *  Copyright (C) 2009 Eric Benard - eric@eukrea.com
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <linux/types.h>
22 #include <linux/gpio.h>
23 #include <linux/init.h>
24 #include <linux/mm.h>
25 #include <linux/module.h>
26 #include <linux/platform_device.h>
27 #include <linux/mtd/physmap.h>
28 #include <linux/mtd/plat-ram.h>
29
30 #include <mach/hardware.h>
31 #include <asm/setup.h>
32 #include <asm/mach-types.h>
33 #include <asm/irq.h>
34
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
37 #include <asm/mach/irq.h>
38
39 #include <mach/board.h>
40 #include <mach/at91_aic.h>
41 #include <mach/at91rm9200_mc.h>
42 #include <mach/at91_ramc.h>
43 #include <mach/cpu.h>
44
45 #include "generic.h"
46
47 static struct gpio_led cpuat91_leds[] = {
48         {
49                 .name                   = "led1",
50                 .default_trigger        = "heartbeat",
51                 .active_low             = 1,
52                 .gpio                   = AT91_PIN_PC0,
53         },
54 };
55
56 static void __init cpuat91_init_early(void)
57 {
58         /* Set cpu type: PQFP */
59         at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
60
61         /* Initialize processor: 18.432 MHz crystal */
62         at91_initialize(18432000);
63 }
64
65 static struct macb_platform_data __initdata cpuat91_eth_data = {
66         .phy_irq_pin    = -EINVAL,
67         .is_rmii        = 1,
68 };
69
70 static struct at91_usbh_data __initdata cpuat91_usbh_data = {
71         .ports          = 1,
72         .vbus_pin       = {-EINVAL, -EINVAL},
73         .overcurrent_pin= {-EINVAL, -EINVAL},
74 };
75
76 static struct at91_udc_data __initdata cpuat91_udc_data = {
77         .vbus_pin       = AT91_PIN_PC15,
78         .pullup_pin     = AT91_PIN_PC14,
79 };
80
81 static struct at91_mmc_data __initdata cpuat91_mmc_data = {
82         .det_pin        = AT91_PIN_PC2,
83         .wire4          = 1,
84         .wp_pin         = -EINVAL,
85         .vcc_pin        = -EINVAL,
86 };
87
88 static struct physmap_flash_data cpuat91_flash_data = {
89         .width          = 2,
90 };
91
92 static struct resource cpuat91_flash_resource = {
93         .start          = AT91_CHIPSELECT_0,
94         .end            = AT91_CHIPSELECT_0 + SZ_16M - 1,
95         .flags          = IORESOURCE_MEM,
96 };
97
98 static struct platform_device cpuat91_norflash = {
99         .name           = "physmap-flash",
100         .id             = 0,
101         .dev    = {
102                 .platform_data  = &cpuat91_flash_data,
103         },
104         .resource       = &cpuat91_flash_resource,
105         .num_resources  = 1,
106 };
107
108 #ifdef CONFIG_MTD_PLATRAM
109 struct platdata_mtd_ram at91_sram_pdata = {
110         .mapname        = "SRAM",
111         .bankwidth      = 2,
112 };
113
114 static struct resource at91_sram_resource[] = {
115         [0] = {
116                 .start = AT91RM9200_SRAM_BASE,
117                 .end   = AT91RM9200_SRAM_BASE + AT91RM9200_SRAM_SIZE - 1,
118                 .flags = IORESOURCE_MEM,
119         },
120 };
121
122 static struct platform_device at91_sram = {
123         .name           = "mtd-ram",
124         .id             = 0,
125         .resource       = at91_sram_resource,
126         .num_resources  = ARRAY_SIZE(at91_sram_resource),
127         .dev    = {
128                 .platform_data = &at91_sram_pdata,
129         },
130 };
131 #endif /* MTD_PLATRAM */
132
133 static struct platform_device *platform_devices[] __initdata = {
134         &cpuat91_norflash,
135 #ifdef CONFIG_MTD_PLATRAM
136         &at91_sram,
137 #endif /* CONFIG_MTD_PLATRAM */
138 };
139
140 static void __init cpuat91_board_init(void)
141 {
142         /* Serial */
143         /* DBGU on ttyS0. (Rx & Tx only) */
144         at91_register_uart(0, 0, 0);
145
146         /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
147         at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS |
148                 ATMEL_UART_RTS);
149
150         /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
151         at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS |
152                 ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
153                 ATMEL_UART_DCD | ATMEL_UART_RI);
154
155         /* USART2 on ttyS3 (Rx, Tx) */
156         at91_register_uart(AT91RM9200_ID_US2, 3, 0);
157
158         /* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */
159         at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS |
160                 ATMEL_UART_RTS);
161         at91_add_device_serial();
162         /* LEDs. */
163         at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds));
164         /* Ethernet */
165         at91_add_device_eth(&cpuat91_eth_data);
166         /* USB Host */
167         at91_add_device_usbh(&cpuat91_usbh_data);
168         /* USB Device */
169         at91_add_device_udc(&cpuat91_udc_data);
170         /* MMC */
171         at91_add_device_mmc(0, &cpuat91_mmc_data);
172         /* I2C */
173         at91_add_device_i2c(NULL, 0);
174         /* Platform devices */
175         platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
176 }
177
178 MACHINE_START(CPUAT91, "Eukrea")
179         /* Maintainer: Eric Benard - EUKREA Electromatique */
180         .timer          = &at91rm9200_timer,
181         .map_io         = at91_map_io,
182         .handle_irq     = at91_aic_handle_irq,
183         .init_early     = cpuat91_init_early,
184         .init_irq       = at91_init_irq_default,
185         .init_machine   = cpuat91_board_init,
186 MACHINE_END