Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 1 | /* |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 2 | * linux/arch/arm/mach-pxa/colibri-evalboard.c |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 3 | * |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 4 | * Support for Toradex Colibri Evaluation Carrier Board |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 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> |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/gpio.h> |
| 18 | #include <asm/mach-types.h> |
| 19 | #include <mach/hardware.h> |
| 20 | #include <asm/mach/arch.h> |
Marek Vasut | 072e1ae | 2010-08-12 01:30:39 +0200 | [diff] [blame] | 21 | #include <linux/i2c.h> |
Sebastian Andrzej Siewior | b459396 | 2011-02-23 12:38:16 +0100 | [diff] [blame] | 22 | #include <linux/i2c/pxa-i2c.h> |
Arnd Bergmann | 847e349 | 2014-03-16 20:36:28 +0100 | [diff] [blame] | 23 | #include <asm/io.h> |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 24 | |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 25 | #include "pxa27x.h" |
| 26 | #include "colibri.h" |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 27 | #include <linux/platform_data/mmc-pxamci.h> |
| 28 | #include <linux/platform_data/usb-ohci-pxa27x.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 29 | #include "pxa27x-udc.h" |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 30 | |
| 31 | #include "generic.h" |
| 32 | #include "devices.h" |
| 33 | |
| 34 | /****************************************************************************** |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 35 | * SD/MMC card controller |
| 36 | ******************************************************************************/ |
| 37 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 38 | static struct pxamci_platform_data colibri_mci_platform_data = { |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 39 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 40 | .gpio_power = -1, |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 41 | .gpio_card_ro = -1, |
| 42 | .detect_delay_ms = 200, |
| 43 | }; |
| 44 | |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 45 | static void __init colibri_mmc_init(void) |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 46 | { |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 47 | if (machine_is_colibri()) /* PXA270 Colibri */ |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 48 | colibri_mci_platform_data.gpio_card_detect = |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 49 | GPIO0_COLIBRI_PXA270_SD_DETECT; |
| 50 | if (machine_is_colibri300()) /* PXA300 Colibri */ |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 51 | colibri_mci_platform_data.gpio_card_detect = |
Bjørn Forsman | 57834a7 | 2010-12-23 16:01:02 +0100 | [diff] [blame] | 52 | GPIO13_COLIBRI_PXA300_SD_DETECT; |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 53 | else /* PXA320 Colibri */ |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 54 | colibri_mci_platform_data.gpio_card_detect = |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 55 | GPIO28_COLIBRI_PXA320_SD_DETECT; |
| 56 | |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 57 | pxa_set_mci_info(&colibri_mci_platform_data); |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 58 | } |
| 59 | #else |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 60 | static inline void colibri_mmc_init(void) {} |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 61 | #endif |
| 62 | |
| 63 | /****************************************************************************** |
| 64 | * USB Host |
| 65 | ******************************************************************************/ |
| 66 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 67 | static int colibri_ohci_init(struct device *dev) |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 68 | { |
| 69 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; |
| 70 | return 0; |
| 71 | } |
| 72 | |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 73 | static struct pxaohci_platform_data colibri_ohci_info = { |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 74 | .port_mode = PMM_PERPORT_MODE, |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 75 | .flags = ENABLE_PORT1 | |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 76 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 77 | .init = colibri_ohci_init, |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 78 | }; |
| 79 | |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 80 | static void __init colibri_uhc_init(void) |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 81 | { |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 82 | /* Colibri PXA270 has two usb ports, TBA for 320 */ |
| 83 | if (machine_is_colibri()) |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 84 | colibri_ohci_info.flags |= ENABLE_PORT2; |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 85 | |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 86 | pxa_set_ohci_info(&colibri_ohci_info); |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 87 | } |
| 88 | #else |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 89 | static inline void colibri_uhc_init(void) {} |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 90 | #endif |
| 91 | |
Marek Vasut | 072e1ae | 2010-08-12 01:30:39 +0200 | [diff] [blame] | 92 | /****************************************************************************** |
| 93 | * I2C RTC |
| 94 | ******************************************************************************/ |
| 95 | #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE) |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 96 | static struct i2c_board_info __initdata colibri_i2c_devs[] = { |
Marek Vasut | 072e1ae | 2010-08-12 01:30:39 +0200 | [diff] [blame] | 97 | { |
| 98 | I2C_BOARD_INFO("m41t00", 0x68), |
| 99 | }, |
| 100 | }; |
| 101 | |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 102 | static void __init colibri_rtc_init(void) |
Marek Vasut | 072e1ae | 2010-08-12 01:30:39 +0200 | [diff] [blame] | 103 | { |
| 104 | pxa_set_i2c_info(NULL); |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 105 | i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs)); |
Marek Vasut | 072e1ae | 2010-08-12 01:30:39 +0200 | [diff] [blame] | 106 | } |
| 107 | #else |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 108 | static inline void colibri_rtc_init(void) {} |
Marek Vasut | 072e1ae | 2010-08-12 01:30:39 +0200 | [diff] [blame] | 109 | #endif |
| 110 | |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 111 | void __init colibri_evalboard_init(void) |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 112 | { |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 113 | pxa_set_ffuart_info(NULL); |
| 114 | pxa_set_btuart_info(NULL); |
| 115 | pxa_set_stuart_info(NULL); |
| 116 | |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 117 | colibri_mmc_init(); |
| 118 | colibri_uhc_init(); |
| 119 | colibri_rtc_init(); |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 120 | } |