Commit | Line | Data |
---|---|---|
4c243c85 | 1 | /* |
a3172e54 | 2 | * linux/arch/arm/mach-pxa/colibri-evalboard.c |
4c243c85 | 3 | * |
a3172e54 | 4 | * Support for Toradex Colibri Evaluation Carrier Board |
4c243c85 DM |
5 | * Daniel Mack <daniel@caiaq.de> |
6 | * Marek Vasut <marek.vasut@gmail.com> | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License version 2 as | |
10 | * published by the Free Software Foundation. | |
11 | */ | |
12 | ||
13 | #include <linux/init.h> | |
14 | #include <linux/kernel.h> | |
15 | #include <linux/platform_device.h> | |
16 | #include <linux/sysdev.h> | |
17 | #include <linux/interrupt.h> | |
18 | #include <linux/gpio.h> | |
19 | #include <asm/mach-types.h> | |
20 | #include <mach/hardware.h> | |
21 | #include <asm/mach/arch.h> | |
072e1ae7 | 22 | #include <linux/i2c.h> |
4c243c85 DM |
23 | |
24 | #include <mach/pxa27x.h> | |
25 | #include <mach/colibri.h> | |
26 | #include <mach/mmc.h> | |
27 | #include <mach/ohci.h> | |
28 | #include <mach/pxa27x-udc.h> | |
29 | ||
072e1ae7 MV |
30 | #include <plat/i2c.h> |
31 | ||
4c243c85 DM |
32 | #include "generic.h" |
33 | #include "devices.h" | |
34 | ||
4c243c85 DM |
35 | /****************************************************************************** |
36 | * SD/MMC card controller | |
37 | ******************************************************************************/ | |
38 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | |
a3172e54 | 39 | static struct pxamci_platform_data colibri_mci_platform_data = { |
4c243c85 DM |
40 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
41 | .gpio_power = -1, | |
4c243c85 DM |
42 | .gpio_card_ro = -1, |
43 | .detect_delay_ms = 200, | |
44 | }; | |
45 | ||
a3172e54 | 46 | static void __init colibri_mmc_init(void) |
4c243c85 | 47 | { |
9b6956f4 | 48 | if (machine_is_colibri()) /* PXA270 Colibri */ |
a3172e54 | 49 | colibri_mci_platform_data.gpio_card_detect = |
9b6956f4 MV |
50 | GPIO0_COLIBRI_PXA270_SD_DETECT; |
51 | if (machine_is_colibri300()) /* PXA300 Colibri */ | |
a3172e54 | 52 | colibri_mci_platform_data.gpio_card_detect = |
57834a72 | 53 | GPIO13_COLIBRI_PXA300_SD_DETECT; |
9b6956f4 | 54 | else /* PXA320 Colibri */ |
a3172e54 | 55 | colibri_mci_platform_data.gpio_card_detect = |
9b6956f4 MV |
56 | GPIO28_COLIBRI_PXA320_SD_DETECT; |
57 | ||
a3172e54 | 58 | pxa_set_mci_info(&colibri_mci_platform_data); |
4c243c85 DM |
59 | } |
60 | #else | |
a3172e54 | 61 | static inline void colibri_mmc_init(void) {} |
4c243c85 DM |
62 | #endif |
63 | ||
64 | /****************************************************************************** | |
65 | * USB Host | |
66 | ******************************************************************************/ | |
67 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | |
a3172e54 | 68 | static int colibri_ohci_init(struct device *dev) |
4c243c85 DM |
69 | { |
70 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; | |
71 | return 0; | |
72 | } | |
73 | ||
a3172e54 | 74 | static struct pxaohci_platform_data colibri_ohci_info = { |
4c243c85 | 75 | .port_mode = PMM_PERPORT_MODE, |
9b6956f4 | 76 | .flags = ENABLE_PORT1 | |
4c243c85 | 77 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
a3172e54 | 78 | .init = colibri_ohci_init, |
4c243c85 DM |
79 | }; |
80 | ||
a3172e54 | 81 | static void __init colibri_uhc_init(void) |
4c243c85 | 82 | { |
9b6956f4 MV |
83 | /* Colibri PXA270 has two usb ports, TBA for 320 */ |
84 | if (machine_is_colibri()) | |
a3172e54 | 85 | colibri_ohci_info.flags |= ENABLE_PORT2; |
9b6956f4 | 86 | |
a3172e54 | 87 | pxa_set_ohci_info(&colibri_ohci_info); |
4c243c85 DM |
88 | } |
89 | #else | |
a3172e54 | 90 | static inline void colibri_uhc_init(void) {} |
4c243c85 DM |
91 | #endif |
92 | ||
072e1ae7 MV |
93 | /****************************************************************************** |
94 | * I2C RTC | |
95 | ******************************************************************************/ | |
96 | #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE) | |
a3172e54 | 97 | static struct i2c_board_info __initdata colibri_i2c_devs[] = { |
072e1ae7 MV |
98 | { |
99 | I2C_BOARD_INFO("m41t00", 0x68), | |
100 | }, | |
101 | }; | |
102 | ||
a3172e54 | 103 | static void __init colibri_rtc_init(void) |
072e1ae7 MV |
104 | { |
105 | pxa_set_i2c_info(NULL); | |
a3172e54 | 106 | i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs)); |
072e1ae7 MV |
107 | } |
108 | #else | |
a3172e54 | 109 | static inline void colibri_rtc_init(void) {} |
072e1ae7 MV |
110 | #endif |
111 | ||
a3172e54 | 112 | void __init colibri_evalboard_init(void) |
4c243c85 | 113 | { |
4c243c85 DM |
114 | pxa_set_ffuart_info(NULL); |
115 | pxa_set_btuart_info(NULL); | |
116 | pxa_set_stuart_info(NULL); | |
117 | ||
a3172e54 MV |
118 | colibri_mmc_init(); |
119 | colibri_uhc_init(); | |
120 | colibri_rtc_init(); | |
4c243c85 | 121 | } |