]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-h4.c
[PATCH] ARM: OMAP: Fix problem UART index != UART line, clean up serial init
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-h4.c
1 /*
2  * linux/arch/arm/mach-omap/omap2/board-h4.c
3  *
4  * Copyright (C) 2005 Nokia Corporation
5  * Author: Paul Mundt <paul.mundt@nokia.com>
6  *
7  * Modified from mach-omap/omap1/board-generic.c
8  *
9  * Code for generic OMAP2 board. Should work on many OMAP2 systems where
10  * the bootloader passes the board-specific data to the kernel.
11  * Do not put any board specific code to this file; create a new machine
12  * type if you need custom low-level initializations.
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License version 2 as
16  * published by the Free Software Foundation.
17  */
18
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/device.h>
22
23 #include <asm/hardware.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27
28 #include <asm/arch/gpio.h>
29 #include <asm/arch/mux.h>
30 #include <asm/arch/usb.h>
31 #include <asm/arch/board.h>
32 #include <asm/arch/common.h>
33
34 #include <asm/io.h>
35 #include <asm/delay.h>
36
37 static struct resource h4_smc91x_resources[] = {
38         [0] = {
39                 .start  = OMAP24XX_ETHR_START,          /* Physical */
40                 .end    = OMAP24XX_ETHR_START + 0xf,
41                 .flags  = IORESOURCE_MEM,
42         },
43         [1] = {
44                 .start  = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
45                 .end    = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
46                 .flags  = IORESOURCE_IRQ,
47         },
48 };
49
50 static struct platform_device h4_smc91x_device = {
51         .name           = "smc91x",
52         .id             = -1,
53         .num_resources  = ARRAY_SIZE(h4_smc91x_resources),
54         .resource       = h4_smc91x_resources,
55 };
56
57 static struct platform_device *h4_devices[] __initdata = {
58         &h4_smc91x_device,
59 };
60
61 static inline void __init h4_init_smc91x(void)
62 {
63         u32 l;
64
65         if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) {
66                 printk(KERN_ERR "Failed to request GPIO#%d for smc91x IRQ\n",
67                         OMAP24XX_ETHR_GPIO_IRQ);
68                 return;
69         }
70         set_irq_type(OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
71                                  IRQT_FALLING);
72         /* Set pin M15 to mux mode 3 -> GPIO#92, disable PU/PD */
73         /* FIXME: change this using omap2 mux api when it's ready */
74         l = __raw_readl(0xd8000000 + 0x108);
75         l &= ~(((1 << 5) - 1) << 16);
76         l |= 3 << 16;
77         __raw_writel(l, 0xd8000000 + 0x108);
78 }
79
80 static void __init omap_h4_init_irq(void)
81 {
82         omap_init_irq();
83         omap_gpio_init();
84         h4_init_smc91x();
85 }
86
87 static struct omap_uart_config h4_uart_config __initdata = {
88         .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
89 };
90
91 static struct omap_board_config_kernel h4_config[] = {
92         { OMAP_TAG_UART,        &h4_uart_config },
93 };
94
95 static void __init omap_h4_init(void)
96 {
97         /*
98          * Make sure the serial ports are muxed on at this point.
99          * You have to mux them off in device drivers later on
100          * if not needed.
101          */
102         platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
103         omap_board_config = h4_config;
104         omap_board_config_size = ARRAY_SIZE(h4_config);
105         omap_serial_init();
106 }
107
108 static void __init omap_h4_map_io(void)
109 {
110         omap_map_common_io();
111 }
112
113 MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
114         /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
115         .phys_ram       = 0x80000000,
116         .phys_io        = 0x48000000,
117         .io_pg_offst    = ((0xd8000000) >> 18) & 0xfffc,
118         .boot_params    = 0x80000100,
119         .map_io         = omap_h4_map_io,
120         .init_irq       = omap_h4_init_irq,
121         .init_machine   = omap_h4_init,
122         .timer          = &omap_timer,
123 MACHINE_END