2 * linux/arch/arm/mach-nomadik/board-8815nhk.c
4 * Copyright (C) STMicroelectronics
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
10 * NHK15 board specifc driver definition
12 #include <linux/types.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/amba/bus.h>
17 #include <linux/interrupt.h>
18 #include <linux/gpio.h>
19 #include <asm/mach-types.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach/irq.h>
22 #include <mach/setup.h>
25 #define __MEM_4K_RESOURCE(x) \
26 .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
28 static struct amba_device uart0_device
= {
29 .dev
= { .init_name
= "uart0" },
30 __MEM_4K_RESOURCE(NOMADIK_UART0_BASE
),
31 .irq
= {IRQ_UART0
, NO_IRQ
},
34 static struct amba_device uart1_device
= {
35 .dev
= { .init_name
= "uart1" },
36 __MEM_4K_RESOURCE(NOMADIK_UART1_BASE
),
37 .irq
= {IRQ_UART1
, NO_IRQ
},
40 static struct amba_device
*amba_devs
[] __initdata
= {
45 /* We have a fixed clock alone, by now */
46 static struct clk nhk8815_clk_48
= {
50 static struct resource nhk8815_eth_resources
[] = {
52 .name
= "smc91x-regs",
53 .start
= 0x34000000 + 0x300,
54 .end
= 0x34000000 + SZ_64K
- 1,
55 .flags
= IORESOURCE_MEM
,
57 .start
= NOMADIK_GPIO_TO_IRQ(115),
58 .end
= NOMADIK_GPIO_TO_IRQ(115),
59 .flags
= IORESOURCE_IRQ
| IRQF_TRIGGER_RISING
,
63 static struct platform_device nhk8815_eth_device
= {
65 .resource
= nhk8815_eth_resources
,
66 .num_resources
= ARRAY_SIZE(nhk8815_eth_resources
),
69 static int __init
nhk8815_eth_init(void)
71 int gpio_nr
= 115; /* hardwired in the board */
74 err
= gpio_request(gpio_nr
, "eth_irq");
75 if (!err
) err
= nmk_gpio_set_mode(gpio_nr
, NMK_GPIO_ALT_GPIO
);
76 if (!err
) err
= gpio_direction_input(gpio_nr
);
78 pr_err("Error %i in %s\n", err
, __func__
);
81 device_initcall(nhk8815_eth_init
);
83 static struct platform_device
*nhk8815_platform_devices
[] __initdata
= {
85 /* will add more devices */
88 static void __init
nhk8815_platform_init(void)
92 cpu8815_platform_init();
93 platform_add_devices(nhk8815_platform_devices
,
94 ARRAY_SIZE(nhk8815_platform_devices
));
96 for (i
= 0; i
< ARRAY_SIZE(amba_devs
); i
++) {
97 nmdk_clk_create(&nhk8815_clk_48
, amba_devs
[i
]->dev
.init_name
);
98 amba_device_register(amba_devs
[i
], &iomem_resource
);
102 MACHINE_START(NOMADIK
, "NHK8815")
103 /* Maintainer: ST MicroElectronics */
104 .phys_io
= NOMADIK_UART0_BASE
,
105 .io_pg_offst
= (IO_ADDRESS(NOMADIK_UART0_BASE
) >> 18) & 0xfffc,
106 .boot_params
= 0x100,
107 .map_io
= cpu8815_map_io
,
108 .init_irq
= cpu8815_init_irq
,
109 .timer
= &nomadik_timer
,
110 .init_machine
= nhk8815_platform_init
,