0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/init.h>
0011 #include <linux/interrupt.h>
0012 #include <linux/moduleparam.h>
0013 #include <linux/kernel.h>
0014 #include <linux/mtd/mtd.h>
0015 #include <linux/mtd/partitions.h>
0016 #include <linux/mtd/physmap.h>
0017 #include <linux/platform_device.h>
0018 #include <linux/regulator/machine.h>
0019 #include <linux/ucb1400.h>
0020
0021 #include <asm/mach/arch.h>
0022 #include <asm/mach/flash.h>
0023 #include <asm/mach-types.h>
0024 #include <linux/sizes.h>
0025
0026 #include <linux/platform_data/asoc-pxa.h>
0027 #include "colibri.h"
0028 #include "pxa27x.h"
0029
0030 #include "devices.h"
0031 #include "generic.h"
0032
0033
0034
0035
0036 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
0037 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
0038
0039 GPIO32_MMC_CLK,
0040 GPIO92_MMC_DAT_0,
0041 GPIO109_MMC_DAT_1,
0042 GPIO110_MMC_DAT_2,
0043 GPIO111_MMC_DAT_3,
0044 GPIO112_MMC_CMD,
0045 GPIO0_GPIO,
0046
0047
0048 GPIO39_FFUART_TXD,
0049 GPIO34_FFUART_RXD,
0050
0051
0052 GPIO88_USBH1_PWR,
0053 GPIO89_USBH1_PEN,
0054 GPIO119_USBH2_PWR,
0055 GPIO120_USBH2_PEN,
0056
0057
0058 GPIO85_nPCE_1,
0059 GPIO54_nPCE_2,
0060 GPIO55_nPREG,
0061 GPIO50_nPIOR,
0062 GPIO51_nPIOW,
0063 GPIO49_nPWE,
0064 GPIO48_nPOE,
0065 GPIO57_nIOIS16,
0066 GPIO56_nPWAIT,
0067 GPIO104_PSKTSEL,
0068 GPIO53_GPIO,
0069 GPIO83_GPIO,
0070 GPIO82_GPIO,
0071 GPIO1_GPIO,
0072 GPIO84_GPIO,
0073 GPIO107_GPIO,
0074
0075
0076 GPIO117_I2C_SCL,
0077 GPIO118_I2C_SDA,
0078 };
0079 #else
0080 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {};
0081 #endif
0082
0083 #ifdef CONFIG_MACH_COLIBRI_PXA270_INCOME
0084 static mfp_cfg_t income_pin_config[] __initdata = {
0085
0086 GPIO32_MMC_CLK,
0087 GPIO92_MMC_DAT_0,
0088 GPIO109_MMC_DAT_1,
0089 GPIO110_MMC_DAT_2,
0090 GPIO111_MMC_DAT_3,
0091 GPIO112_MMC_CMD,
0092 GPIO0_GPIO,
0093 GPIO1_GPIO,
0094
0095
0096 GPIO39_FFUART_TXD,
0097 GPIO34_FFUART_RXD,
0098
0099
0100 GPIO42_BTUART_RXD,
0101 GPIO43_BTUART_TXD,
0102 GPIO45_BTUART_RTS,
0103
0104
0105 GPIO46_STUART_RXD,
0106 GPIO47_STUART_TXD,
0107
0108
0109 GPIO88_USBH1_PWR,
0110 GPIO89_USBH1_PEN,
0111
0112
0113 GPIOxx_LCD_TFT_16BPP,
0114
0115
0116 GPIO16_PWM0_OUT,
0117
0118
0119 GPIO117_I2C_SCL,
0120 GPIO118_I2C_SDA,
0121
0122
0123 GPIO54_GPIO,
0124 GPIO55_GPIO,
0125 };
0126 #else
0127 static mfp_cfg_t income_pin_config[] __initdata = {};
0128 #endif
0129
0130
0131
0132
0133 static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
0134
0135 GPIO78_nCS_2,
0136 GPIO114_GPIO,
0137
0138
0139 GPIO28_AC97_BITCLK,
0140 GPIO29_AC97_SDATA_IN_0,
0141 GPIO30_AC97_SDATA_OUT,
0142 GPIO31_AC97_SYNC,
0143 GPIO95_AC97_nRESET,
0144 GPIO98_AC97_SYSCLK,
0145 GPIO113_GPIO,
0146 };
0147
0148
0149
0150
0151 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
0152 static struct mtd_partition colibri_partitions[] = {
0153 {
0154 .name = "Bootloader",
0155 .offset = 0x00000000,
0156 .size = 0x00040000,
0157 .mask_flags = MTD_WRITEABLE
0158 }, {
0159 .name = "Kernel",
0160 .offset = 0x00040000,
0161 .size = 0x00400000,
0162 .mask_flags = 0
0163 }, {
0164 .name = "Rootfs",
0165 .offset = 0x00440000,
0166 .size = MTDPART_SIZ_FULL,
0167 .mask_flags = 0
0168 }
0169 };
0170
0171 static struct physmap_flash_data colibri_flash_data[] = {
0172 {
0173 .width = 4,
0174 .parts = colibri_partitions,
0175 .nr_parts = ARRAY_SIZE(colibri_partitions)
0176 }
0177 };
0178
0179 static struct resource colibri_pxa270_flash_resource = {
0180 .start = PXA_CS0_PHYS,
0181 .end = PXA_CS0_PHYS + SZ_32M - 1,
0182 .flags = IORESOURCE_MEM,
0183 };
0184
0185 static struct platform_device colibri_pxa270_flash_device = {
0186 .name = "physmap-flash",
0187 .id = 0,
0188 .dev = {
0189 .platform_data = colibri_flash_data,
0190 },
0191 .resource = &colibri_pxa270_flash_resource,
0192 .num_resources = 1,
0193 };
0194
0195 static void __init colibri_pxa270_nor_init(void)
0196 {
0197 platform_device_register(&colibri_pxa270_flash_device);
0198 }
0199 #else
0200 static inline void colibri_pxa270_nor_init(void) {}
0201 #endif
0202
0203
0204
0205
0206 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
0207 static struct resource colibri_pxa270_dm9000_resources[] = {
0208 {
0209 .start = PXA_CS2_PHYS,
0210 .end = PXA_CS2_PHYS + 3,
0211 .flags = IORESOURCE_MEM,
0212 },
0213 {
0214 .start = PXA_CS2_PHYS + 4,
0215 .end = PXA_CS2_PHYS + 4 + 500,
0216 .flags = IORESOURCE_MEM,
0217 },
0218 {
0219 .start = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
0220 .end = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
0221 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
0222 },
0223 };
0224
0225 static struct platform_device colibri_pxa270_dm9000_device = {
0226 .name = "dm9000",
0227 .id = -1,
0228 .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources),
0229 .resource = colibri_pxa270_dm9000_resources,
0230 };
0231
0232 static void __init colibri_pxa270_eth_init(void)
0233 {
0234 platform_device_register(&colibri_pxa270_dm9000_device);
0235 }
0236 #else
0237 static inline void colibri_pxa270_eth_init(void) {}
0238 #endif
0239
0240
0241
0242
0243 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
0244 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
0245 static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = {
0246 .reset_gpio = 95,
0247 };
0248
0249 static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = {
0250 .irq = PXA_GPIO_TO_IRQ(GPIO113_COLIBRI_PXA270_TS_IRQ),
0251 };
0252
0253 static struct platform_device colibri_pxa270_ucb1400_device = {
0254 .name = "ucb1400_core",
0255 .id = -1,
0256 .dev = {
0257 .platform_data = &colibri_pxa270_ucb1400_pdata,
0258 },
0259 };
0260
0261 static void __init colibri_pxa270_tsc_init(void)
0262 {
0263 pxa_set_ac97_info(&colibri_pxa270_ac97_pdata);
0264 platform_device_register(&colibri_pxa270_ucb1400_device);
0265 }
0266 #else
0267 static inline void colibri_pxa270_tsc_init(void) {}
0268 #endif
0269
0270 static int colibri_pxa270_baseboard;
0271 core_param(colibri_pxa270_baseboard, colibri_pxa270_baseboard, int, 0444);
0272
0273 static void __init colibri_pxa270_init(void)
0274 {
0275 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
0276
0277 colibri_pxa270_nor_init();
0278 colibri_pxa270_eth_init();
0279 colibri_pxa270_tsc_init();
0280
0281 switch (colibri_pxa270_baseboard) {
0282 case COLIBRI_EVALBOARD:
0283 pxa2xx_mfp_config(ARRAY_AND_SIZE(
0284 colibri_pxa270_evalboard_pin_config));
0285 colibri_evalboard_init();
0286 break;
0287 case COLIBRI_PXA270_INCOME:
0288 pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
0289 colibri_pxa270_income_boardinit();
0290 break;
0291 default:
0292 printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n",
0293 colibri_pxa270_baseboard);
0294 }
0295
0296 regulator_has_full_constraints();
0297 }
0298
0299
0300
0301
0302
0303 static void __init colibri_pxa270_income_init(void)
0304 {
0305 colibri_pxa270_baseboard = COLIBRI_PXA270_INCOME;
0306 colibri_pxa270_init();
0307 }
0308
0309 MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
0310 .atag_offset = 0x100,
0311 .init_machine = colibri_pxa270_init,
0312 .map_io = pxa27x_map_io,
0313 .nr_irqs = PXA_NR_IRQS,
0314 .init_irq = pxa27x_init_irq,
0315 .handle_irq = pxa27x_handle_irq,
0316 .init_time = pxa_timer_init,
0317 .restart = pxa_restart,
0318 MACHINE_END
0319
0320 MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC")
0321 .atag_offset = 0x100,
0322 .init_machine = colibri_pxa270_income_init,
0323 .map_io = pxa27x_map_io,
0324 .nr_irqs = PXA_NR_IRQS,
0325 .init_irq = pxa27x_init_irq,
0326 .handle_irq = pxa27x_handle_irq,
0327 .init_time = pxa_timer_init,
0328 .restart = pxa_restart,
0329 MACHINE_END
0330