[ARM] 5464/1: Freescale STMP platform support [7/10]
[linux-2.6.git] / arch / arm / mach-stmp378x / stmp378x_devb.c
1 /*
2  * Freescale STMP378X development board support
3  *
4  * Embedded Alley Solutions, Inc <source@embeddedalley.com>
5  *
6  * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
7  * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
8  */
9
10 /*
11  * The code contained herein is licensed under the GNU General Public
12  * License. You may obtain a copy of the GNU General Public License
13  * Version 2 or later at the following locations:
14  *
15  * http://www.opensource.org/licenses/gpl-license.html
16  * http://www.gnu.org/copyleft/gpl.html
17  */
18 #include <linux/kernel.h>
19 #include <linux/init.h>
20 #include <linux/platform_device.h>
21
22 #include <asm/setup.h>
23 #include <asm/mach-types.h>
24 #include <asm/mach/arch.h>
25
26 #include <mach/pins.h>
27 #include <mach/pinmux.h>
28 #include <mach/stmp3xxx.h>
29
30 #include "stmp378x.h"
31
32 static struct platform_device *devices[] = {
33         &stmp3xxx_dbguart,
34 };
35
36 static struct pin_desc dbguart_pins_0[] = {
37         { PINID_PWM0, PIN_FUN3, },
38         { PINID_PWM1, PIN_FUN3, },
39 };
40
41 static struct pin_group dbguart_pins[] = {
42         [0] = {
43                 .pins           = dbguart_pins_0,
44                 .nr_pins        = ARRAY_SIZE(dbguart_pins_0),
45         },
46 };
47
48 static int dbguart_pins_control(int id, int request)
49 {
50         int r = 0;
51
52         if (request)
53                 r = stmp3xxx_request_pin_group(&dbguart_pins[id], "debug uart");
54         else
55                 stmp3xxx_release_pin_group(&dbguart_pins[id], "debug uart");
56         return r;
57 }
58
59 static void __init stmp378x_devb_init(void)
60 {
61         stmp3xxx_pinmux_init(NR_REAL_IRQS);
62
63         /* init stmp3xxx platform */
64         stmp3xxx_init();
65
66         stmp3xxx_dbguart.dev.platform_data = dbguart_pins_control;
67
68         /* add board's devices */
69         platform_add_devices(devices, ARRAY_SIZE(devices));
70 }
71
72 MACHINE_START(STMP378X, "STMP378X")
73         .phys_io        = 0x80000000,
74         .io_pg_offst    = ((0xf0000000) >> 18) & 0xfffc,
75         .boot_params    = 0x40000100,
76         .map_io         = stmp378x_map_io,
77         .init_irq       = stmp378x_init_irq,
78         .timer          = &stmp3xxx_timer,
79         .init_machine   = stmp378x_devb_init,
80 MACHINE_END