0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/init.h>
0011 #include <linux/kernel.h>
0012 #include <linux/platform_device.h>
0013 #include <linux/interrupt.h>
0014 #include <linux/gpio/machine.h>
0015 #include <asm/mach-types.h>
0016 #include <asm/mach/arch.h>
0017 #include <linux/i2c.h>
0018 #include <linux/platform_data/i2c-pxa.h>
0019 #include <asm/io.h>
0020
0021 #include "pxa27x.h"
0022 #include "colibri.h"
0023 #include <linux/platform_data/mmc-pxamci.h>
0024 #include <linux/platform_data/usb-ohci-pxa27x.h>
0025 #include "pxa27x-udc.h"
0026
0027 #include "generic.h"
0028 #include "devices.h"
0029
0030
0031
0032
0033 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
0034 static struct pxamci_platform_data colibri_mci_platform_data = {
0035 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
0036 .detect_delay_ms = 200,
0037 };
0038
0039 static struct gpiod_lookup_table colibri_pxa270_mci_gpio_table = {
0040 .dev_id = "pxa2xx-mci.0",
0041 .table = {
0042 GPIO_LOOKUP("gpio-pxa", GPIO0_COLIBRI_PXA270_SD_DETECT,
0043 "cd", GPIO_ACTIVE_LOW),
0044 { },
0045 },
0046 };
0047
0048 static struct gpiod_lookup_table colibri_pxa300_mci_gpio_table = {
0049 .dev_id = "pxa2xx-mci.0",
0050 .table = {
0051 GPIO_LOOKUP("gpio-pxa", GPIO13_COLIBRI_PXA300_SD_DETECT,
0052 "cd", GPIO_ACTIVE_LOW),
0053 { },
0054 },
0055 };
0056
0057 static struct gpiod_lookup_table colibri_pxa320_mci_gpio_table = {
0058 .dev_id = "pxa2xx-mci.0",
0059 .table = {
0060 GPIO_LOOKUP("gpio-pxa", GPIO28_COLIBRI_PXA320_SD_DETECT,
0061 "cd", GPIO_ACTIVE_LOW),
0062 { },
0063 },
0064 };
0065
0066 static void __init colibri_mmc_init(void)
0067 {
0068 if (machine_is_colibri())
0069 gpiod_add_lookup_table(&colibri_pxa270_mci_gpio_table);
0070 if (machine_is_colibri300())
0071 gpiod_add_lookup_table(&colibri_pxa300_mci_gpio_table);
0072 else
0073 gpiod_add_lookup_table(&colibri_pxa320_mci_gpio_table);
0074
0075 pxa_set_mci_info(&colibri_mci_platform_data);
0076 }
0077 #else
0078 static inline void colibri_mmc_init(void) {}
0079 #endif
0080
0081
0082
0083
0084 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
0085 static int colibri_ohci_init(struct device *dev)
0086 {
0087 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
0088 return 0;
0089 }
0090
0091 static struct pxaohci_platform_data colibri_ohci_info = {
0092 .port_mode = PMM_PERPORT_MODE,
0093 .flags = ENABLE_PORT1 |
0094 POWER_CONTROL_LOW | POWER_SENSE_LOW,
0095 .init = colibri_ohci_init,
0096 };
0097
0098 static void __init colibri_uhc_init(void)
0099 {
0100
0101 if (machine_is_colibri())
0102 colibri_ohci_info.flags |= ENABLE_PORT2;
0103
0104 pxa_set_ohci_info(&colibri_ohci_info);
0105 }
0106 #else
0107 static inline void colibri_uhc_init(void) {}
0108 #endif
0109
0110
0111
0112
0113 #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
0114 static struct i2c_board_info __initdata colibri_i2c_devs[] = {
0115 {
0116 I2C_BOARD_INFO("m41t00", 0x68),
0117 },
0118 };
0119
0120 static void __init colibri_rtc_init(void)
0121 {
0122 pxa_set_i2c_info(NULL);
0123 i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
0124 }
0125 #else
0126 static inline void colibri_rtc_init(void) {}
0127 #endif
0128
0129 void __init colibri_evalboard_init(void)
0130 {
0131 pxa_set_ffuart_info(NULL);
0132 pxa_set_btuart_info(NULL);
0133 pxa_set_stuart_info(NULL);
0134
0135 colibri_mmc_init();
0136 colibri_uhc_init();
0137 colibri_rtc_init();
0138 }