0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include <linux/kernel.h>
0024 #include <linux/init.h>
0025 #include <linux/platform_device.h>
0026 #include <linux/i2c.h>
0027 #include <linux/spi/spi.h>
0028 #include <linux/gpio/machine.h>
0029
0030 #include <sound/cs4271.h>
0031
0032 #include "hardware.h"
0033 #include <linux/platform_data/video-ep93xx.h>
0034 #include <linux/platform_data/spi-ep93xx.h>
0035 #include "gpio-ep93xx.h"
0036
0037 #include <asm/mach-types.h>
0038 #include <asm/mach/arch.h>
0039
0040 #include "soc.h"
0041
0042 static void __init edb93xx_register_flash(void)
0043 {
0044 if (machine_is_edb9307() || machine_is_edb9312() ||
0045 machine_is_edb9315()) {
0046 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
0047 } else {
0048 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
0049 }
0050 }
0051
0052 static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
0053 .phy_id = 1,
0054 };
0055
0056
0057
0058
0059
0060
0061 static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
0062 {
0063 I2C_BOARD_INFO("isl1208", 0x6f),
0064 },
0065 };
0066
0067 static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
0068 {
0069 I2C_BOARD_INFO("ds1337", 0x68),
0070 },
0071 };
0072
0073 static void __init edb93xx_register_i2c(void)
0074 {
0075 if (machine_is_edb9302a() || machine_is_edb9307a() ||
0076 machine_is_edb9315a()) {
0077 ep93xx_register_i2c(edb93xxa_i2c_board_info,
0078 ARRAY_SIZE(edb93xxa_i2c_board_info));
0079 } else if (machine_is_edb9302() || machine_is_edb9307()
0080 || machine_is_edb9312() || machine_is_edb9315()) {
0081 ep93xx_register_i2c(edb93xx_i2c_board_info,
0082 ARRAY_SIZE(edb93xx_i2c_board_info));
0083 }
0084 }
0085
0086
0087
0088
0089
0090 static struct cs4271_platform_data edb93xx_cs4271_data = {
0091 .gpio_nreset = -EINVAL,
0092 };
0093
0094 static struct spi_board_info edb93xx_spi_board_info[] __initdata = {
0095 {
0096 .modalias = "cs4271",
0097 .platform_data = &edb93xx_cs4271_data,
0098 .max_speed_hz = 6000000,
0099 .bus_num = 0,
0100 .chip_select = 0,
0101 .mode = SPI_MODE_3,
0102 },
0103 };
0104
0105 static struct gpiod_lookup_table edb93xx_spi_cs_gpio_table = {
0106 .dev_id = "spi0",
0107 .table = {
0108 GPIO_LOOKUP("A", 6, "cs", GPIO_ACTIVE_LOW),
0109 { },
0110 },
0111 };
0112
0113 static struct ep93xx_spi_info edb93xx_spi_info __initdata = {
0114
0115 };
0116
0117 static void __init edb93xx_register_spi(void)
0118 {
0119 if (machine_is_edb9301() || machine_is_edb9302())
0120 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO1;
0121 else if (machine_is_edb9302a() || machine_is_edb9307a())
0122 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_H(2);
0123 else if (machine_is_edb9315a())
0124 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO14;
0125
0126 gpiod_add_lookup_table(&edb93xx_spi_cs_gpio_table);
0127 ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info,
0128 ARRAY_SIZE(edb93xx_spi_board_info));
0129 }
0130
0131
0132
0133
0134
0135 static struct platform_device edb93xx_audio_device = {
0136 .name = "edb93xx-audio",
0137 .id = -1,
0138 };
0139
0140 static int __init edb93xx_has_audio(void)
0141 {
0142 return (machine_is_edb9301() || machine_is_edb9302() ||
0143 machine_is_edb9302a() || machine_is_edb9307a() ||
0144 machine_is_edb9315a());
0145 }
0146
0147 static void __init edb93xx_register_i2s(void)
0148 {
0149 if (edb93xx_has_audio()) {
0150 ep93xx_register_i2s();
0151 platform_device_register(&edb93xx_audio_device);
0152 }
0153 }
0154
0155
0156
0157
0158
0159 static void __init edb93xx_register_pwm(void)
0160 {
0161 if (machine_is_edb9301() ||
0162 machine_is_edb9302() || machine_is_edb9302a()) {
0163
0164 ep93xx_register_pwm(0, 1);
0165 } else if (machine_is_edb9307() || machine_is_edb9307a()) {
0166
0167 ep93xx_register_pwm(1, 0);
0168 } else {
0169
0170 ep93xx_register_pwm(1, 1);
0171 }
0172 }
0173
0174
0175
0176
0177
0178 static struct ep93xxfb_mach_info __initdata edb93xxfb_info = {
0179 .flags = 0,
0180 };
0181
0182 static int __init edb93xx_has_fb(void)
0183 {
0184
0185 return machine_is_edb9307() || machine_is_edb9307a() ||
0186 machine_is_edb9312() || machine_is_edb9315() ||
0187 machine_is_edb9315a();
0188 }
0189
0190 static void __init edb93xx_register_fb(void)
0191 {
0192 if (!edb93xx_has_fb())
0193 return;
0194
0195 if (machine_is_edb9307a() || machine_is_edb9315a())
0196 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0;
0197 else
0198 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3;
0199
0200 ep93xx_register_fb(&edb93xxfb_info);
0201 }
0202
0203
0204
0205
0206
0207 static int __init edb93xx_has_ide(void)
0208 {
0209
0210
0211
0212
0213
0214 return machine_is_edb9312() || machine_is_edb9315() ||
0215 machine_is_edb9315a();
0216 }
0217
0218 static void __init edb93xx_register_ide(void)
0219 {
0220 if (!edb93xx_has_ide())
0221 return;
0222
0223 ep93xx_register_ide();
0224 }
0225
0226
0227 static void __init edb93xx_init_machine(void)
0228 {
0229 ep93xx_init_devices();
0230 edb93xx_register_flash();
0231 ep93xx_register_eth(&edb93xx_eth_data, 1);
0232 edb93xx_register_i2c();
0233 edb93xx_register_spi();
0234 edb93xx_register_i2s();
0235 edb93xx_register_pwm();
0236 edb93xx_register_fb();
0237 edb93xx_register_ide();
0238 ep93xx_register_adc();
0239 }
0240
0241
0242 #ifdef CONFIG_MACH_EDB9301
0243 MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
0244
0245 .atag_offset = 0x100,
0246 .nr_irqs = NR_EP93XX_IRQS,
0247 .map_io = ep93xx_map_io,
0248 .init_irq = ep93xx_init_irq,
0249 .init_time = ep93xx_timer_init,
0250 .init_machine = edb93xx_init_machine,
0251 .restart = ep93xx_restart,
0252 MACHINE_END
0253 #endif
0254
0255 #ifdef CONFIG_MACH_EDB9302
0256 MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
0257
0258 .atag_offset = 0x100,
0259 .nr_irqs = NR_EP93XX_IRQS,
0260 .map_io = ep93xx_map_io,
0261 .init_irq = ep93xx_init_irq,
0262 .init_time = ep93xx_timer_init,
0263 .init_machine = edb93xx_init_machine,
0264 .restart = ep93xx_restart,
0265 MACHINE_END
0266 #endif
0267
0268 #ifdef CONFIG_MACH_EDB9302A
0269 MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
0270
0271 .atag_offset = 0x100,
0272 .nr_irqs = NR_EP93XX_IRQS,
0273 .map_io = ep93xx_map_io,
0274 .init_irq = ep93xx_init_irq,
0275 .init_time = ep93xx_timer_init,
0276 .init_machine = edb93xx_init_machine,
0277 .restart = ep93xx_restart,
0278 MACHINE_END
0279 #endif
0280
0281 #ifdef CONFIG_MACH_EDB9307
0282 MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
0283
0284 .atag_offset = 0x100,
0285 .nr_irqs = NR_EP93XX_IRQS,
0286 .map_io = ep93xx_map_io,
0287 .init_irq = ep93xx_init_irq,
0288 .init_time = ep93xx_timer_init,
0289 .init_machine = edb93xx_init_machine,
0290 .restart = ep93xx_restart,
0291 MACHINE_END
0292 #endif
0293
0294 #ifdef CONFIG_MACH_EDB9307A
0295 MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
0296
0297 .atag_offset = 0x100,
0298 .nr_irqs = NR_EP93XX_IRQS,
0299 .map_io = ep93xx_map_io,
0300 .init_irq = ep93xx_init_irq,
0301 .init_time = ep93xx_timer_init,
0302 .init_machine = edb93xx_init_machine,
0303 .restart = ep93xx_restart,
0304 MACHINE_END
0305 #endif
0306
0307 #ifdef CONFIG_MACH_EDB9312
0308 MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
0309
0310 .atag_offset = 0x100,
0311 .nr_irqs = NR_EP93XX_IRQS,
0312 .map_io = ep93xx_map_io,
0313 .init_irq = ep93xx_init_irq,
0314 .init_time = ep93xx_timer_init,
0315 .init_machine = edb93xx_init_machine,
0316 .restart = ep93xx_restart,
0317 MACHINE_END
0318 #endif
0319
0320 #ifdef CONFIG_MACH_EDB9315
0321 MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
0322
0323 .atag_offset = 0x100,
0324 .nr_irqs = NR_EP93XX_IRQS,
0325 .map_io = ep93xx_map_io,
0326 .init_irq = ep93xx_init_irq,
0327 .init_time = ep93xx_timer_init,
0328 .init_machine = edb93xx_init_machine,
0329 .restart = ep93xx_restart,
0330 MACHINE_END
0331 #endif
0332
0333 #ifdef CONFIG_MACH_EDB9315A
0334 MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
0335
0336 .atag_offset = 0x100,
0337 .nr_irqs = NR_EP93XX_IRQS,
0338 .map_io = ep93xx_map_io,
0339 .init_irq = ep93xx_init_irq,
0340 .init_time = ep93xx_timer_init,
0341 .init_machine = edb93xx_init_machine,
0342 .restart = ep93xx_restart,
0343 MACHINE_END
0344 #endif