Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
[linux/fpc-iii.git] / arch / arm / mach-nomadik / board-nhk8815.c
blob79bdea943eb4bcc1299f2fd68a887c1d01f111fd
1 /*
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>
23 #include "clock.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 = {
41 &uart0_device,
42 &uart1_device,
45 /* We have a fixed clock alone, by now */
46 static struct clk nhk8815_clk_48 = {
47 .rate = 48*1000*1000,
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,
56 }, {
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 = {
64 .name = "smc91x",
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 */
72 int err;
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);
77 if (err)
78 pr_err("Error %i in %s\n", err, __func__);
79 return err;
81 device_initcall(nhk8815_eth_init);
83 static struct platform_device *nhk8815_platform_devices[] __initdata = {
84 &nhk8815_eth_device,
85 /* will add more devices */
88 static void __init nhk8815_platform_init(void)
90 int i;
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,
111 MACHINE_END