0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/gpio.h>
0009 #include <linux/gpio-pxa.h>
0010 #include <linux/init.h>
0011 #include <linux/kernel.h>
0012 #include <linux/platform_device.h>
0013 #include <linux/smc91x.h>
0014 #include <linux/mtd/mtd.h>
0015 #include <linux/mtd/partitions.h>
0016 #include <linux/mtd/rawnand.h>
0017 #include <linux/interrupt.h>
0018 #include <linux/platform_data/mv_usb.h>
0019
0020 #include <asm/mach-types.h>
0021 #include <asm/mach/arch.h>
0022 #include <video/pxa168fb.h>
0023 #include <linux/input.h>
0024 #include <linux/platform_data/keypad-pxa27x.h>
0025
0026 #include "addr-map.h"
0027 #include "mfp-pxa168.h"
0028 #include "pxa168.h"
0029 #include "pxa910.h"
0030 #include "irqs.h"
0031 #include "common.h"
0032
0033 static unsigned long common_pin_config[] __initdata = {
0034
0035 GPIO0_DFI_D15,
0036 GPIO1_DFI_D14,
0037 GPIO2_DFI_D13,
0038 GPIO3_DFI_D12,
0039 GPIO4_DFI_D11,
0040 GPIO5_DFI_D10,
0041 GPIO6_DFI_D9,
0042 GPIO7_DFI_D8,
0043 GPIO8_DFI_D7,
0044 GPIO9_DFI_D6,
0045 GPIO10_DFI_D5,
0046 GPIO11_DFI_D4,
0047 GPIO12_DFI_D3,
0048 GPIO13_DFI_D2,
0049 GPIO14_DFI_D1,
0050 GPIO15_DFI_D0,
0051
0052
0053 GPIO18_SMC_nCS0,
0054 GPIO34_SMC_nCS1,
0055 GPIO23_SMC_nLUA,
0056 GPIO25_SMC_nLLA,
0057 GPIO28_SMC_RDY,
0058 GPIO29_SMC_SCLK,
0059 GPIO35_SMC_BE1,
0060 GPIO36_SMC_BE2,
0061 GPIO27_GPIO,
0062
0063
0064 GPIO107_UART1_RXD,
0065 GPIO108_UART1_TXD,
0066
0067
0068 GPIO113_I2S_MCLK,
0069 GPIO114_I2S_FRM,
0070 GPIO115_I2S_BCLK,
0071 GPIO116_I2S_RXD,
0072 GPIO117_I2S_TXD,
0073
0074
0075 GPIO56_LCD_FCLK_RD,
0076 GPIO57_LCD_LCLK_A0,
0077 GPIO58_LCD_PCLK_WR,
0078 GPIO59_LCD_DENA_BIAS,
0079 GPIO60_LCD_DD0,
0080 GPIO61_LCD_DD1,
0081 GPIO62_LCD_DD2,
0082 GPIO63_LCD_DD3,
0083 GPIO64_LCD_DD4,
0084 GPIO65_LCD_DD5,
0085 GPIO66_LCD_DD6,
0086 GPIO67_LCD_DD7,
0087 GPIO68_LCD_DD8,
0088 GPIO69_LCD_DD9,
0089 GPIO70_LCD_DD10,
0090 GPIO71_LCD_DD11,
0091 GPIO72_LCD_DD12,
0092 GPIO73_LCD_DD13,
0093 GPIO74_LCD_DD14,
0094 GPIO75_LCD_DD15,
0095 GPIO76_LCD_DD16,
0096 GPIO77_LCD_DD17,
0097 GPIO78_LCD_DD18,
0098 GPIO79_LCD_DD19,
0099 GPIO80_LCD_DD20,
0100 GPIO81_LCD_DD21,
0101 GPIO82_LCD_DD22,
0102 GPIO83_LCD_DD23,
0103
0104
0105 GPIO109_KP_MKIN1,
0106 GPIO110_KP_MKIN0,
0107 GPIO111_KP_MKOUT7,
0108 GPIO112_KP_MKOUT6,
0109 GPIO121_KP_MKIN4,
0110 };
0111
0112 static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
0113 .irq_base = MMP_GPIO_TO_IRQ(0),
0114 };
0115
0116 static struct smc91x_platdata smc91x_info = {
0117 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
0118 };
0119
0120 static struct resource smc91x_resources[] = {
0121 [0] = {
0122 .start = SMC_CS1_PHYS_BASE + 0x300,
0123 .end = SMC_CS1_PHYS_BASE + 0xfffff,
0124 .flags = IORESOURCE_MEM,
0125 },
0126 [1] = {
0127 .start = MMP_GPIO_TO_IRQ(27),
0128 .end = MMP_GPIO_TO_IRQ(27),
0129 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
0130 }
0131 };
0132
0133 static struct platform_device smc91x_device = {
0134 .name = "smc91x",
0135 .id = 0,
0136 .dev = {
0137 .platform_data = &smc91x_info,
0138 },
0139 .num_resources = ARRAY_SIZE(smc91x_resources),
0140 .resource = smc91x_resources,
0141 };
0142
0143 static struct mtd_partition aspenite_nand_partitions[] = {
0144 {
0145 .name = "bootloader",
0146 .offset = 0,
0147 .size = SZ_1M,
0148 .mask_flags = MTD_WRITEABLE,
0149 }, {
0150 .name = "reserved",
0151 .offset = MTDPART_OFS_APPEND,
0152 .size = SZ_128K,
0153 .mask_flags = MTD_WRITEABLE,
0154 }, {
0155 .name = "reserved",
0156 .offset = MTDPART_OFS_APPEND,
0157 .size = SZ_8M,
0158 .mask_flags = MTD_WRITEABLE,
0159 }, {
0160 .name = "kernel",
0161 .offset = MTDPART_OFS_APPEND,
0162 .size = (SZ_2M + SZ_1M),
0163 .mask_flags = 0,
0164 }, {
0165 .name = "filesystem",
0166 .offset = MTDPART_OFS_APPEND,
0167 .size = SZ_32M + SZ_16M,
0168 .mask_flags = 0,
0169 }
0170 };
0171
0172 static struct pxa3xx_nand_platform_data aspenite_nand_info = {
0173 .parts = aspenite_nand_partitions,
0174 .nr_parts = ARRAY_SIZE(aspenite_nand_partitions),
0175 };
0176
0177 static struct i2c_board_info aspenite_i2c_info[] __initdata = {
0178 { I2C_BOARD_INFO("wm8753", 0x1b), },
0179 };
0180
0181 static struct fb_videomode video_modes[] = {
0182 [0] = {
0183 .pixclock = 30120,
0184 .refresh = 60,
0185 .xres = 800,
0186 .yres = 480,
0187 .hsync_len = 1,
0188 .left_margin = 215,
0189 .right_margin = 40,
0190 .vsync_len = 1,
0191 .upper_margin = 34,
0192 .lower_margin = 10,
0193 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
0194 },
0195 };
0196
0197 struct pxa168fb_mach_info aspenite_lcd_info = {
0198 .id = "Graphic Frame",
0199 .modes = video_modes,
0200 .num_modes = ARRAY_SIZE(video_modes),
0201 .pix_fmt = PIX_FMT_RGB565,
0202 .io_pin_allocation_mode = PIN_MODE_DUMB_24,
0203 .dumb_mode = DUMB_MODE_RGB888,
0204 .active = 1,
0205 .panel_rbswap = 0,
0206 .invert_pixclock = 0,
0207 };
0208
0209 static const unsigned int aspenite_matrix_key_map[] = {
0210 KEY(0, 6, KEY_UP),
0211 KEY(0, 7, KEY_DOWN),
0212 KEY(1, 6, KEY_LEFT),
0213 KEY(1, 7, KEY_RIGHT),
0214 KEY(4, 6, KEY_ENTER),
0215 KEY(4, 7, KEY_ESC),
0216 };
0217
0218 static struct matrix_keymap_data aspenite_matrix_keymap_data = {
0219 .keymap = aspenite_matrix_key_map,
0220 .keymap_size = ARRAY_SIZE(aspenite_matrix_key_map),
0221 };
0222
0223 static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
0224 .matrix_key_rows = 5,
0225 .matrix_key_cols = 8,
0226 .matrix_keymap_data = &aspenite_matrix_keymap_data,
0227 .debounce_interval = 30,
0228 };
0229
0230 #if IS_ENABLED(CONFIG_USB_EHCI_MV)
0231 static struct mv_usb_platform_data pxa168_sph_pdata = {
0232 .mode = MV_USB_MODE_HOST,
0233 .phy_init = pxa_usb_phy_init,
0234 .phy_deinit = pxa_usb_phy_deinit,
0235 .set_vbus = NULL,
0236 };
0237 #endif
0238
0239 static void __init common_init(void)
0240 {
0241 mfp_config(ARRAY_AND_SIZE(common_pin_config));
0242
0243
0244 pxa168_add_uart(1);
0245 pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
0246 pxa168_add_ssp(1);
0247 pxa168_add_nand(&aspenite_nand_info);
0248 pxa168_add_fb(&aspenite_lcd_info);
0249 pxa168_add_keypad(&aspenite_keypad_info);
0250 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
0251 sizeof(struct pxa_gpio_platform_data));
0252 platform_device_register(&pxa168_device_gpio);
0253
0254
0255 platform_device_register(&smc91x_device);
0256
0257 #if IS_ENABLED(CONFIG_USB_SUPPORT)
0258 #if IS_ENABLED(CONFIG_PHY_PXA_USB)
0259 platform_device_register(&pxa168_device_usb_phy);
0260 #endif
0261
0262 #if IS_ENABLED(CONFIG_USB_EHCI_MV)
0263 pxa168_add_usb_host(&pxa168_sph_pdata);
0264 #endif
0265 #endif
0266 }
0267
0268 MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform")
0269 .map_io = mmp_map_io,
0270 .nr_irqs = MMP_NR_IRQS,
0271 .init_irq = pxa168_init_irq,
0272 .init_time = pxa168_timer_init,
0273 .init_machine = common_init,
0274 .restart = pxa168_restart,
0275 MACHINE_END
0276
0277 MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform")
0278 .map_io = mmp_map_io,
0279 .nr_irqs = MMP_NR_IRQS,
0280 .init_irq = pxa168_init_irq,
0281 .init_time = pxa168_timer_init,
0282 .init_machine = common_init,
0283 .restart = pxa168_restart,
0284 MACHINE_END