| 1 | --- a/arch/arm/mach-omap2/board-n8x0.c |
| 2 | +++ b/arch/arm/mach-omap2/board-n8x0.c |
| 3 | @@ -15,8 +15,10 @@ |
| 4 | #include <linux/delay.h> |
| 5 | #include <linux/gpio.h> |
| 6 | #include <linux/init.h> |
| 7 | +#include <linux/irq.h> |
| 8 | #include <linux/io.h> |
| 9 | #include <linux/stddef.h> |
| 10 | +#include <linux/platform_device.h> |
| 11 | #include <linux/i2c.h> |
| 12 | #include <linux/spi/spi.h> |
| 13 | #include <linux/usb/musb.h> |
| 14 | @@ -33,6 +35,7 @@ |
| 15 | #include <plat/onenand.h> |
| 16 | #include <plat/mmc.h> |
| 17 | #include <plat/serial.h> |
| 18 | +#include <plat/cbus.h> |
| 19 | |
| 20 | #include "mux.h" |
| 21 | |
| 22 | @@ -194,6 +197,114 @@ static struct omap_onenand_platform_data |
| 23 | }; |
| 24 | #endif |
| 25 | |
| 26 | +#if defined(CONFIG_CBUS) || defined(CONFIG_CBUS_MODULE) |
| 27 | + |
| 28 | +static struct cbus_host_platform_data n8x0_cbus_data = { |
| 29 | + .clk_gpio = 66, |
| 30 | + .dat_gpio = 65, |
| 31 | + .sel_gpio = 64, |
| 32 | +}; |
| 33 | + |
| 34 | +static struct platform_device n8x0_cbus_device = { |
| 35 | + .name = "cbus", |
| 36 | + .id = -1, |
| 37 | + .dev = { |
| 38 | + .platform_data = &n8x0_cbus_data, |
| 39 | + }, |
| 40 | +}; |
| 41 | + |
| 42 | +static struct resource retu_resource[] = { |
| 43 | + { |
| 44 | + .start = -EINVAL, /* set later */ |
| 45 | + .flags = IORESOURCE_IRQ, |
| 46 | + }, |
| 47 | +}; |
| 48 | + |
| 49 | +static struct cbus_retu_platform_data n8x0_retu_data = { |
| 50 | + .irq_base = CBUS_RETU_IRQ_BASE, |
| 51 | + .irq_end = CBUS_RETU_IRQ_END, |
| 52 | + .devid = CBUS_RETU_DEVICE_ID, |
| 53 | +}; |
| 54 | + |
| 55 | +static struct platform_device retu_device = { |
| 56 | + .name = "retu", |
| 57 | + .id = -1, |
| 58 | + .resource = retu_resource, |
| 59 | + .num_resources = ARRAY_SIZE(retu_resource), |
| 60 | + .dev = { |
| 61 | + .platform_data = &n8x0_retu_data, |
| 62 | + }, |
| 63 | +}; |
| 64 | + |
| 65 | +static struct resource tahvo_resource[] = { |
| 66 | + { |
| 67 | + .start = -EINVAL, /* set later */ |
| 68 | + .flags = IORESOURCE_IRQ, |
| 69 | + } |
| 70 | +}; |
| 71 | + |
| 72 | +static struct platform_device tahvo_device = { |
| 73 | + .name = "tahvo", |
| 74 | + .id = -1, |
| 75 | + .resource = tahvo_resource, |
| 76 | + .num_resources = ARRAY_SIZE(tahvo_resource), |
| 77 | +}; |
| 78 | + |
| 79 | +static struct platform_device tahvo_usb_device = { |
| 80 | + .name = "tahvo-usb", |
| 81 | + .id = -1, |
| 82 | +}; |
| 83 | + |
| 84 | +static void __init n8x0_cbus_init(void) |
| 85 | +{ |
| 86 | + int ret; |
| 87 | + |
| 88 | + platform_device_register(&n8x0_cbus_device); |
| 89 | + |
| 90 | + ret = gpio_request(108, "RETU irq"); |
| 91 | + if (ret < 0) { |
| 92 | + pr_err("retu: Unable to reserve IRQ GPIO\n"); |
| 93 | + return; |
| 94 | + } |
| 95 | + |
| 96 | + ret = gpio_direction_input(108); |
| 97 | + if (ret < 0) { |
| 98 | + pr_err("retu: Unable to change gpio direction\n"); |
| 99 | + gpio_free(108); |
| 100 | + return; |
| 101 | + } |
| 102 | + |
| 103 | + set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING); |
| 104 | + retu_resource[0].start = gpio_to_irq(108); |
| 105 | + platform_device_register(&retu_device); |
| 106 | + |
| 107 | + ret = gpio_request(111, "TAHVO irq"); |
| 108 | + if (ret) { |
| 109 | + pr_err("tahvo: Unable to reserve IRQ GPIO\n"); |
| 110 | + gpio_free(108); |
| 111 | + return; |
| 112 | + } |
| 113 | + |
| 114 | + /* Set the pin as input */ |
| 115 | + ret = gpio_direction_input(111); |
| 116 | + if (ret) { |
| 117 | + pr_err("tahvo: Unable to change direction\n"); |
| 118 | + gpio_free(108); |
| 119 | + gpio_free(111); |
| 120 | + return; |
| 121 | + } |
| 122 | + |
| 123 | + tahvo_resource[0].start = gpio_to_irq(111); |
| 124 | + platform_device_register(&tahvo_device); |
| 125 | + platform_device_register(&tahvo_usb_device); |
| 126 | +} |
| 127 | + |
| 128 | +#else |
| 129 | +static inline void __init n8x0_cbus_init(void) |
| 130 | +{ |
| 131 | +} |
| 132 | +#endif |
| 133 | + |
| 134 | #if defined(CONFIG_MENELAUS) && \ |
| 135 | (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)) |
| 136 | |
| 137 | @@ -628,11 +739,10 @@ static void __init n8x0_map_io(void) |
| 138 | omap242x_map_common_io(); |
| 139 | } |
| 140 | |
| 141 | -static void __init n8x0_init_irq(void) |
| 142 | +static void __init n8x0_init_early(void) |
| 143 | { |
| 144 | omap2_init_common_infrastructure(); |
| 145 | omap2_init_common_devices(NULL, NULL); |
| 146 | - omap_init_irq(); |
| 147 | } |
| 148 | |
| 149 | #ifdef CONFIG_OMAP_MUX |
| 150 | @@ -686,6 +796,8 @@ static inline void board_serial_init(voi |
| 151 | static void __init n8x0_init_machine(void) |
| 152 | { |
| 153 | omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC); |
| 154 | + n8x0_cbus_init(); |
| 155 | + |
| 156 | /* FIXME: add n810 spi devices */ |
| 157 | spi_register_board_info(n800_spi_board_info, |
| 158 | ARRAY_SIZE(n800_spi_board_info)); |
| 159 | @@ -703,27 +815,30 @@ static void __init n8x0_init_machine(voi |
| 160 | |
| 161 | MACHINE_START(NOKIA_N800, "Nokia N800") |
| 162 | .boot_params = 0x80000100, |
| 163 | - .map_io = n8x0_map_io, |
| 164 | .reserve = omap_reserve, |
| 165 | - .init_irq = n8x0_init_irq, |
| 166 | + .map_io = n8x0_map_io, |
| 167 | + .init_early = n8x0_init_early, |
| 168 | + .init_irq = omap_init_irq, |
| 169 | .init_machine = n8x0_init_machine, |
| 170 | .timer = &omap_timer, |
| 171 | MACHINE_END |
| 172 | |
| 173 | MACHINE_START(NOKIA_N810, "Nokia N810") |
| 174 | .boot_params = 0x80000100, |
| 175 | - .map_io = n8x0_map_io, |
| 176 | .reserve = omap_reserve, |
| 177 | - .init_irq = n8x0_init_irq, |
| 178 | + .map_io = n8x0_map_io, |
| 179 | + .init_early = n8x0_init_early, |
| 180 | + .init_irq = omap_init_irq, |
| 181 | .init_machine = n8x0_init_machine, |
| 182 | .timer = &omap_timer, |
| 183 | MACHINE_END |
| 184 | |
| 185 | MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") |
| 186 | .boot_params = 0x80000100, |
| 187 | - .map_io = n8x0_map_io, |
| 188 | .reserve = omap_reserve, |
| 189 | - .init_irq = n8x0_init_irq, |
| 190 | + .map_io = n8x0_map_io, |
| 191 | + .init_early = n8x0_init_early, |
| 192 | + .init_irq = omap_init_irq, |
| 193 | .init_machine = n8x0_init_machine, |
| 194 | .timer = &omap_timer, |
| 195 | MACHINE_END |
| 196 | |