Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / arm / mach-pxa / colibri-evalboard.c
blobb9c173ede891eb88fc4d68f76f4c1daec154e49d
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * linux/arch/arm/mach-pxa/colibri-evalboard.c
5 * Support for Toradex Colibri Evaluation Carrier Board
6 * Daniel Mack <daniel@caiaq.de>
7 * Marek Vasut <marek.vasut@gmail.com>
8 */
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/platform_device.h>
13 #include <linux/interrupt.h>
14 #include <linux/gpio/machine.h>
15 #include <asm/mach-types.h>
16 #include <mach/hardware.h>
17 #include <asm/mach/arch.h>
18 #include <linux/i2c.h>
19 #include <linux/platform_data/i2c-pxa.h>
20 #include <asm/io.h>
22 #include "pxa27x.h"
23 #include "colibri.h"
24 #include <linux/platform_data/mmc-pxamci.h>
25 #include <linux/platform_data/usb-ohci-pxa27x.h>
26 #include "pxa27x-udc.h"
28 #include "generic.h"
29 #include "devices.h"
31 /******************************************************************************
32 * SD/MMC card controller
33 ******************************************************************************/
34 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
35 static struct pxamci_platform_data colibri_mci_platform_data = {
36 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
37 .detect_delay_ms = 200,
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 { },
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 { },
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 { },
67 static void __init colibri_mmc_init(void)
69 if (machine_is_colibri()) /* PXA270 Colibri */
70 gpiod_add_lookup_table(&colibri_pxa270_mci_gpio_table);
71 if (machine_is_colibri300()) /* PXA300 Colibri */
72 gpiod_add_lookup_table(&colibri_pxa300_mci_gpio_table);
73 else /* PXA320 Colibri */
74 gpiod_add_lookup_table(&colibri_pxa320_mci_gpio_table);
76 pxa_set_mci_info(&colibri_mci_platform_data);
78 #else
79 static inline void colibri_mmc_init(void) {}
80 #endif
82 /******************************************************************************
83 * USB Host
84 ******************************************************************************/
85 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
86 static int colibri_ohci_init(struct device *dev)
88 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
89 return 0;
92 static struct pxaohci_platform_data colibri_ohci_info = {
93 .port_mode = PMM_PERPORT_MODE,
94 .flags = ENABLE_PORT1 |
95 POWER_CONTROL_LOW | POWER_SENSE_LOW,
96 .init = colibri_ohci_init,
99 static void __init colibri_uhc_init(void)
101 /* Colibri PXA270 has two usb ports, TBA for 320 */
102 if (machine_is_colibri())
103 colibri_ohci_info.flags |= ENABLE_PORT2;
105 pxa_set_ohci_info(&colibri_ohci_info);
107 #else
108 static inline void colibri_uhc_init(void) {}
109 #endif
111 /******************************************************************************
112 * I2C RTC
113 ******************************************************************************/
114 #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
115 static struct i2c_board_info __initdata colibri_i2c_devs[] = {
117 I2C_BOARD_INFO("m41t00", 0x68),
121 static void __init colibri_rtc_init(void)
123 pxa_set_i2c_info(NULL);
124 i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
126 #else
127 static inline void colibri_rtc_init(void) {}
128 #endif
130 void __init colibri_evalboard_init(void)
132 pxa_set_ffuart_info(NULL);
133 pxa_set_btuart_info(NULL);
134 pxa_set_stuart_info(NULL);
136 colibri_mmc_init();
137 colibri_uhc_init();
138 colibri_rtc_init();