0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/init.h>
0012 #include <linux/kernel.h>
0013 #include <linux/platform_device.h>
0014 #include <linux/gpio.h>
0015 #include <linux/interrupt.h>
0016 #include <linux/soc/pxa/cpu.h>
0017
0018 #include <asm/mach-types.h>
0019 #include <linux/sizes.h>
0020 #include <asm/mach/arch.h>
0021 #include <asm/mach/irq.h>
0022
0023 #include "pxa300.h"
0024 #include "colibri.h"
0025 #include <linux/platform_data/usb-ohci-pxa27x.h>
0026 #include <linux/platform_data/video-pxafb.h>
0027 #include <linux/platform_data/asoc-pxa.h>
0028
0029 #include "generic.h"
0030 #include "devices.h"
0031
0032
0033 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
0034 static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
0035
0036 GPIO7_MMC1_CLK,
0037 GPIO14_MMC1_CMD,
0038 GPIO3_MMC1_DAT0,
0039 GPIO4_MMC1_DAT1,
0040 GPIO5_MMC1_DAT2,
0041 GPIO6_MMC1_DAT3,
0042 GPIO13_GPIO,
0043
0044
0045 GPIO0_2_USBH_PEN,
0046 GPIO1_2_USBH_PWR,
0047 GPIO77_USB_P3_1,
0048 GPIO78_USB_P3_2,
0049 GPIO79_USB_P3_3,
0050 GPIO80_USB_P3_4,
0051 GPIO81_USB_P3_5,
0052 GPIO82_USB_P3_6,
0053
0054
0055 GPIO21_I2C_SCL,
0056 GPIO22_I2C_SDA,
0057 };
0058 #else
0059 static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
0060 #endif
0061
0062 #if defined(CONFIG_AX88796)
0063 #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
0064
0065
0066
0067 static struct ax_plat_data colibri_asix_platdata = {
0068 .flags = 0,
0069 .wordlength = 2,
0070 };
0071
0072 static struct resource colibri_asix_resource[] = {
0073 [0] = {
0074 .start = PXA3xx_CS2_PHYS,
0075 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
0076 .flags = IORESOURCE_MEM,
0077 },
0078 [1] = {
0079 .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
0080 .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
0081 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
0082 }
0083 };
0084
0085 static struct platform_device asix_device = {
0086 .name = "ax88796",
0087 .id = 0,
0088 .num_resources = ARRAY_SIZE(colibri_asix_resource),
0089 .resource = colibri_asix_resource,
0090 .dev = {
0091 .platform_data = &colibri_asix_platdata
0092 }
0093 };
0094
0095 static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
0096 GPIO1_nCS2,
0097 GPIO26_GPIO | MFP_PULL_HIGH
0098 };
0099
0100 static void __init colibri_pxa300_init_eth(void)
0101 {
0102 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
0103 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
0104 platform_device_register(&asix_device);
0105 }
0106 #else
0107 static inline void __init colibri_pxa300_init_eth(void) {}
0108 #endif
0109
0110 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
0111 static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
0112 GPIO54_LCD_LDD_0,
0113 GPIO55_LCD_LDD_1,
0114 GPIO56_LCD_LDD_2,
0115 GPIO57_LCD_LDD_3,
0116 GPIO58_LCD_LDD_4,
0117 GPIO59_LCD_LDD_5,
0118 GPIO60_LCD_LDD_6,
0119 GPIO61_LCD_LDD_7,
0120 GPIO62_LCD_LDD_8,
0121 GPIO63_LCD_LDD_9,
0122 GPIO64_LCD_LDD_10,
0123 GPIO65_LCD_LDD_11,
0124 GPIO66_LCD_LDD_12,
0125 GPIO67_LCD_LDD_13,
0126 GPIO68_LCD_LDD_14,
0127 GPIO69_LCD_LDD_15,
0128 GPIO70_LCD_LDD_16,
0129 GPIO71_LCD_LDD_17,
0130 GPIO62_LCD_CS_N,
0131 GPIO72_LCD_FCLK,
0132 GPIO73_LCD_LCLK,
0133 GPIO74_LCD_PCLK,
0134 GPIO75_LCD_BIAS,
0135 GPIO76_LCD_VSYNC,
0136 };
0137
0138 static void __init colibri_pxa300_init_lcd(void)
0139 {
0140 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
0141 }
0142
0143 #else
0144 static inline void colibri_pxa300_init_lcd(void) {}
0145 #endif
0146
0147 #if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
0148 static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
0149 GPIO24_AC97_SYSCLK,
0150 GPIO23_AC97_nACRESET,
0151 GPIO25_AC97_SDATA_IN_0,
0152 GPIO27_AC97_SDATA_OUT,
0153 GPIO28_AC97_SYNC,
0154 GPIO29_AC97_BITCLK
0155 };
0156
0157 static inline void __init colibri_pxa310_init_ac97(void)
0158 {
0159
0160 if (!cpu_is_pxa310())
0161 return;
0162
0163 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
0164 pxa_set_ac97_info(NULL);
0165 }
0166 #else
0167 static inline void colibri_pxa310_init_ac97(void) {}
0168 #endif
0169
0170 void __init colibri_pxa300_init(void)
0171 {
0172 colibri_pxa300_init_eth();
0173 colibri_pxa3xx_init_nand();
0174 colibri_pxa300_init_lcd();
0175 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
0176 colibri_pxa310_init_ac97();
0177
0178
0179 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
0180 colibri_evalboard_init();
0181 }
0182
0183 MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
0184 .atag_offset = 0x100,
0185 .init_machine = colibri_pxa300_init,
0186 .map_io = pxa3xx_map_io,
0187 .nr_irqs = PXA_NR_IRQS,
0188 .init_irq = pxa3xx_init_irq,
0189 .handle_irq = pxa3xx_handle_irq,
0190 .init_time = pxa_timer_init,
0191 .restart = pxa_restart,
0192 MACHINE_END
0193