Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-omap1/devices.c |
| 3 | * |
| 4 | * OMAP1 platform device setup/initialization |
| 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 | |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 12 | #include <linux/module.h> |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 15 | #include <linux/platform_device.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 16 | #include <linux/io.h> |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 17 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 18 | #include <mach/hardware.h> |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 19 | #include <asm/mach/map.h> |
| 20 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 21 | #include <mach/tc.h> |
| 22 | #include <mach/board.h> |
| 23 | #include <mach/mux.h> |
| 24 | #include <mach/gpio.h> |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 25 | |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 26 | /*-------------------------------------------------------------------------*/ |
| 27 | |
David Brownell | db68b18 | 2006-12-06 20:38:36 -0800 | [diff] [blame] | 28 | #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE) |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 29 | |
| 30 | #define OMAP_RTC_BASE 0xfffb4800 |
| 31 | |
| 32 | static struct resource rtc_resources[] = { |
| 33 | { |
| 34 | .start = OMAP_RTC_BASE, |
| 35 | .end = OMAP_RTC_BASE + 0x5f, |
| 36 | .flags = IORESOURCE_MEM, |
| 37 | }, |
| 38 | { |
| 39 | .start = INT_RTC_TIMER, |
| 40 | .flags = IORESOURCE_IRQ, |
| 41 | }, |
| 42 | { |
| 43 | .start = INT_RTC_ALARM, |
| 44 | .flags = IORESOURCE_IRQ, |
| 45 | }, |
| 46 | }; |
| 47 | |
| 48 | static struct platform_device omap_rtc_device = { |
| 49 | .name = "omap_rtc", |
| 50 | .id = -1, |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 51 | .num_resources = ARRAY_SIZE(rtc_resources), |
| 52 | .resource = rtc_resources, |
| 53 | }; |
| 54 | |
| 55 | static void omap_init_rtc(void) |
| 56 | { |
| 57 | (void) platform_device_register(&omap_rtc_device); |
| 58 | } |
| 59 | #else |
| 60 | static inline void omap_init_rtc(void) {} |
| 61 | #endif |
| 62 | |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 63 | #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) |
| 64 | |
| 65 | #if defined(CONFIG_ARCH_OMAP15XX) |
| 66 | # define OMAP1_MBOX_SIZE 0x23 |
| 67 | # define INT_DSP_MAILBOX1 INT_1510_DSP_MAILBOX1 |
| 68 | #elif defined(CONFIG_ARCH_OMAP16XX) |
| 69 | # define OMAP1_MBOX_SIZE 0x2f |
| 70 | # define INT_DSP_MAILBOX1 INT_1610_DSP_MAILBOX1 |
| 71 | #endif |
| 72 | |
| 73 | #define OMAP1_MBOX_BASE IO_ADDRESS(OMAP16XX_MAILBOX_BASE) |
| 74 | |
| 75 | static struct resource mbox_resources[] = { |
| 76 | { |
| 77 | .start = OMAP1_MBOX_BASE, |
| 78 | .end = OMAP1_MBOX_BASE + OMAP1_MBOX_SIZE, |
| 79 | .flags = IORESOURCE_MEM, |
| 80 | }, |
| 81 | { |
| 82 | .start = INT_DSP_MAILBOX1, |
| 83 | .flags = IORESOURCE_IRQ, |
| 84 | }, |
| 85 | }; |
| 86 | |
| 87 | static struct platform_device mbox_device = { |
| 88 | .name = "mailbox", |
| 89 | .id = -1, |
| 90 | .num_resources = ARRAY_SIZE(mbox_resources), |
| 91 | .resource = mbox_resources, |
| 92 | }; |
| 93 | |
| 94 | static inline void omap_init_mbox(void) |
| 95 | { |
| 96 | platform_device_register(&mbox_device); |
| 97 | } |
| 98 | #else |
| 99 | static inline void omap_init_mbox(void) { } |
| 100 | #endif |
| 101 | |
Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 102 | #if defined(CONFIG_OMAP_STI) |
| 103 | |
| 104 | #define OMAP1_STI_BASE IO_ADDRESS(0xfffea000) |
| 105 | #define OMAP1_STI_CHANNEL_BASE (OMAP1_STI_BASE + 0x400) |
| 106 | |
| 107 | static struct resource sti_resources[] = { |
| 108 | { |
| 109 | .start = OMAP1_STI_BASE, |
| 110 | .end = OMAP1_STI_BASE + SZ_1K - 1, |
| 111 | .flags = IORESOURCE_MEM, |
| 112 | }, |
| 113 | { |
| 114 | .start = OMAP1_STI_CHANNEL_BASE, |
| 115 | .end = OMAP1_STI_CHANNEL_BASE + SZ_1K - 1, |
| 116 | .flags = IORESOURCE_MEM, |
| 117 | }, |
| 118 | { |
| 119 | .start = INT_1610_STI, |
| 120 | .flags = IORESOURCE_IRQ, |
| 121 | } |
| 122 | }; |
| 123 | |
| 124 | static struct platform_device sti_device = { |
| 125 | .name = "sti", |
| 126 | .id = -1, |
Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 127 | .num_resources = ARRAY_SIZE(sti_resources), |
| 128 | .resource = sti_resources, |
| 129 | }; |
| 130 | |
| 131 | static inline void omap_init_sti(void) |
| 132 | { |
| 133 | platform_device_register(&sti_device); |
| 134 | } |
| 135 | #else |
| 136 | static inline void omap_init_sti(void) {} |
| 137 | #endif |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 138 | |
| 139 | /*-------------------------------------------------------------------------*/ |
| 140 | |
| 141 | /* |
| 142 | * This gets called after board-specific INIT_MACHINE, and initializes most |
| 143 | * on-chip peripherals accessible on this board (except for few like USB): |
| 144 | * |
| 145 | * (a) Does any "standard config" pin muxing needed. Board-specific |
| 146 | * code will have muxed GPIO pins and done "nonstandard" setup; |
| 147 | * that code could live in the boot loader. |
| 148 | * (b) Populating board-specific platform_data with the data drivers |
| 149 | * rely on to handle wiring variations. |
| 150 | * (c) Creating platform devices as meaningful on this board and |
| 151 | * with this kernel configuration. |
| 152 | * |
| 153 | * Claiming GPIOs, and setting their direction and initial values, is the |
| 154 | * responsibility of the device drivers. So is responding to probe(). |
| 155 | * |
| 156 | * Board-specific knowlege like creating devices or pin setup is to be |
| 157 | * kept out of drivers as much as possible. In particular, pin setup |
| 158 | * may be handled by the boot loader, and drivers should expect it will |
| 159 | * normally have been done by the time they're probed. |
| 160 | */ |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 161 | static int __init omap1_init_devices(void) |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 162 | { |
| 163 | /* please keep these calls, and their implementations above, |
| 164 | * in alphabetical order so they're easier to sort through. |
| 165 | */ |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 166 | |
| 167 | omap_init_mbox(); |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 168 | omap_init_rtc(); |
Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 169 | omap_init_sti(); |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 170 | |
| 171 | return 0; |
| 172 | } |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 173 | arch_initcall(omap1_init_devices); |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 174 | |