]>
Commit | Line | Data |
---|---|---|
d2912cb1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
4c243c85 | 2 | /* |
a3172e54 | 3 | * linux/arch/arm/mach-pxa/colibri-evalboard.c |
4c243c85 | 4 | * |
a3172e54 | 5 | * Support for Toradex Colibri Evaluation Carrier Board |
4c243c85 DM |
6 | * Daniel Mack <daniel@caiaq.de> |
7 | * Marek Vasut <marek.vasut@gmail.com> | |
4c243c85 DM |
8 | */ |
9 | ||
10 | #include <linux/init.h> | |
11 | #include <linux/kernel.h> | |
12 | #include <linux/platform_device.h> | |
4c243c85 | 13 | #include <linux/interrupt.h> |
32d15448 | 14 | #include <linux/gpio/machine.h> |
4c243c85 DM |
15 | #include <asm/mach-types.h> |
16 | #include <mach/hardware.h> | |
17 | #include <asm/mach/arch.h> | |
072e1ae7 | 18 | #include <linux/i2c.h> |
f15fc9b1 | 19 | #include <linux/platform_data/i2c-pxa.h> |
847e3496 | 20 | #include <asm/io.h> |
4c243c85 | 21 | |
4c25c5d2 AB |
22 | #include "pxa27x.h" |
23 | #include "colibri.h" | |
293b2da1 AB |
24 | #include <linux/platform_data/mmc-pxamci.h> |
25 | #include <linux/platform_data/usb-ohci-pxa27x.h> | |
4c25c5d2 | 26 | #include "pxa27x-udc.h" |
4c243c85 DM |
27 | |
28 | #include "generic.h" | |
29 | #include "devices.h" | |
30 | ||
4c243c85 DM |
31 | /****************************************************************************** |
32 | * SD/MMC card controller | |
33 | ******************************************************************************/ | |
34 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | |
a3172e54 | 35 | static struct pxamci_platform_data colibri_mci_platform_data = { |
4c243c85 | 36 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
4c243c85 DM |
37 | .detect_delay_ms = 200, |
38 | }; | |
39 | ||
32d15448 LW |
40 | static struct gpiod_lookup_table colibri_pxa270_mci_gpio_table = { |
41 | .dev_id = "pxa2xx-mci.0", | |
42 | .table = { | |
43 | GPIO_LOOKUP("gpio-pxa", GPIO0_COLIBRI_PXA270_SD_DETECT, | |
44 | "cd", GPIO_ACTIVE_LOW), | |
45 | { }, | |
46 | }, | |
47 | }; | |
48 | ||
49 | static struct gpiod_lookup_table colibri_pxa300_mci_gpio_table = { | |
50 | .dev_id = "pxa2xx-mci.0", | |
51 | .table = { | |
52 | GPIO_LOOKUP("gpio-pxa", GPIO13_COLIBRI_PXA300_SD_DETECT, | |
53 | "cd", GPIO_ACTIVE_LOW), | |
54 | { }, | |
55 | }, | |
56 | }; | |
57 | ||
58 | static struct gpiod_lookup_table colibri_pxa320_mci_gpio_table = { | |
59 | .dev_id = "pxa2xx-mci.0", | |
60 | .table = { | |
61 | GPIO_LOOKUP("gpio-pxa", GPIO28_COLIBRI_PXA320_SD_DETECT, | |
62 | "cd", GPIO_ACTIVE_LOW), | |
63 | { }, | |
64 | }, | |
65 | }; | |
66 | ||
a3172e54 | 67 | static void __init colibri_mmc_init(void) |
4c243c85 | 68 | { |
e114cd33 | 69 | if (machine_is_colibri()) /* PXA270 Colibri */ |
32d15448 | 70 | gpiod_add_lookup_table(&colibri_pxa270_mci_gpio_table); |
e114cd33 | 71 | if (machine_is_colibri300()) /* PXA300 Colibri */ |
32d15448 | 72 | gpiod_add_lookup_table(&colibri_pxa300_mci_gpio_table); |
e114cd33 | 73 | else /* PXA320 Colibri */ |
32d15448 | 74 | gpiod_add_lookup_table(&colibri_pxa320_mci_gpio_table); |
9b6956f4 | 75 | |
a3172e54 | 76 | pxa_set_mci_info(&colibri_mci_platform_data); |
4c243c85 DM |
77 | } |
78 | #else | |
a3172e54 | 79 | static inline void colibri_mmc_init(void) {} |
4c243c85 DM |
80 | #endif |
81 | ||
82 | /****************************************************************************** | |
83 | * USB Host | |
84 | ******************************************************************************/ | |
85 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | |
a3172e54 | 86 | static int colibri_ohci_init(struct device *dev) |
4c243c85 DM |
87 | { |
88 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; | |
89 | return 0; | |
90 | } | |
91 | ||
a3172e54 | 92 | static struct pxaohci_platform_data colibri_ohci_info = { |
4c243c85 | 93 | .port_mode = PMM_PERPORT_MODE, |
9b6956f4 | 94 | .flags = ENABLE_PORT1 | |
4c243c85 | 95 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
a3172e54 | 96 | .init = colibri_ohci_init, |
4c243c85 DM |
97 | }; |
98 | ||
a3172e54 | 99 | static void __init colibri_uhc_init(void) |
4c243c85 | 100 | { |
9b6956f4 MV |
101 | /* Colibri PXA270 has two usb ports, TBA for 320 */ |
102 | if (machine_is_colibri()) | |
a3172e54 | 103 | colibri_ohci_info.flags |= ENABLE_PORT2; |
9b6956f4 | 104 | |
a3172e54 | 105 | pxa_set_ohci_info(&colibri_ohci_info); |
4c243c85 DM |
106 | } |
107 | #else | |
a3172e54 | 108 | static inline void colibri_uhc_init(void) {} |
4c243c85 DM |
109 | #endif |
110 | ||
072e1ae7 MV |
111 | /****************************************************************************** |
112 | * I2C RTC | |
113 | ******************************************************************************/ | |
114 | #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE) | |
a3172e54 | 115 | static struct i2c_board_info __initdata colibri_i2c_devs[] = { |
072e1ae7 MV |
116 | { |
117 | I2C_BOARD_INFO("m41t00", 0x68), | |
118 | }, | |
119 | }; | |
120 | ||
a3172e54 | 121 | static void __init colibri_rtc_init(void) |
072e1ae7 MV |
122 | { |
123 | pxa_set_i2c_info(NULL); | |
a3172e54 | 124 | i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs)); |
072e1ae7 MV |
125 | } |
126 | #else | |
a3172e54 | 127 | static inline void colibri_rtc_init(void) {} |
072e1ae7 MV |
128 | #endif |
129 | ||
a3172e54 | 130 | void __init colibri_evalboard_init(void) |
4c243c85 | 131 | { |
4c243c85 DM |
132 | pxa_set_ffuart_info(NULL); |
133 | pxa_set_btuart_info(NULL); | |
134 | pxa_set_stuart_info(NULL); | |
135 | ||
a3172e54 MV |
136 | colibri_mmc_init(); |
137 | colibri_uhc_init(); | |
138 | colibri_rtc_init(); | |
4c243c85 | 139 | } |