blob: 28f667e52ef9265dd44c4de7bac2e6cb5072c2d1 [file] [log] [blame]
Daniel Mack4c243c82010-05-22 00:29:38 +02001/*
Marek Vasuta3172e52010-08-12 01:45:05 +02002 * linux/arch/arm/mach-pxa/colibri-evalboard.c
Daniel Mack4c243c82010-05-22 00:29:38 +02003 *
Marek Vasuta3172e52010-08-12 01:45:05 +02004 * Support for Toradex Colibri Evaluation Carrier Board
Daniel Mack4c243c82010-05-22 00:29:38 +02005 * 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>
Marek Vasut072e1ae2010-08-12 01:30:39 +020022#include <linux/i2c.h>
Daniel Mack4c243c82010-05-22 00:29:38 +020023
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
Marek Vasut072e1ae2010-08-12 01:30:39 +020030#include <plat/i2c.h>
31
Daniel Mack4c243c82010-05-22 00:29:38 +020032#include "generic.h"
33#include "devices.h"
34
35/******************************************************************************
Daniel Mack4c243c82010-05-22 00:29:38 +020036 * SD/MMC card controller
37 ******************************************************************************/
38#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
Marek Vasuta3172e52010-08-12 01:45:05 +020039static struct pxamci_platform_data colibri_mci_platform_data = {
Daniel Mack4c243c82010-05-22 00:29:38 +020040 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
41 .gpio_power = -1,
Daniel Mack4c243c82010-05-22 00:29:38 +020042 .gpio_card_ro = -1,
43 .detect_delay_ms = 200,
44};
45
Marek Vasuta3172e52010-08-12 01:45:05 +020046static void __init colibri_mmc_init(void)
Daniel Mack4c243c82010-05-22 00:29:38 +020047{
Marek Vasut9b6956f2010-08-12 01:18:38 +020048 if (machine_is_colibri()) /* PXA270 Colibri */
Marek Vasuta3172e52010-08-12 01:45:05 +020049 colibri_mci_platform_data.gpio_card_detect =
Marek Vasut9b6956f2010-08-12 01:18:38 +020050 GPIO0_COLIBRI_PXA270_SD_DETECT;
51 if (machine_is_colibri300()) /* PXA300 Colibri */
Marek Vasuta3172e52010-08-12 01:45:05 +020052 colibri_mci_platform_data.gpio_card_detect =
Bjørn Forsman57834a72010-12-23 16:01:02 +010053 GPIO13_COLIBRI_PXA300_SD_DETECT;
Marek Vasut9b6956f2010-08-12 01:18:38 +020054 else /* PXA320 Colibri */
Marek Vasuta3172e52010-08-12 01:45:05 +020055 colibri_mci_platform_data.gpio_card_detect =
Marek Vasut9b6956f2010-08-12 01:18:38 +020056 GPIO28_COLIBRI_PXA320_SD_DETECT;
57
Marek Vasuta3172e52010-08-12 01:45:05 +020058 pxa_set_mci_info(&colibri_mci_platform_data);
Daniel Mack4c243c82010-05-22 00:29:38 +020059}
60#else
Marek Vasuta3172e52010-08-12 01:45:05 +020061static inline void colibri_mmc_init(void) {}
Daniel Mack4c243c82010-05-22 00:29:38 +020062#endif
63
64/******************************************************************************
65 * USB Host
66 ******************************************************************************/
67#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
Marek Vasuta3172e52010-08-12 01:45:05 +020068static int colibri_ohci_init(struct device *dev)
Daniel Mack4c243c82010-05-22 00:29:38 +020069{
70 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
71 return 0;
72}
73
Marek Vasuta3172e52010-08-12 01:45:05 +020074static struct pxaohci_platform_data colibri_ohci_info = {
Daniel Mack4c243c82010-05-22 00:29:38 +020075 .port_mode = PMM_PERPORT_MODE,
Marek Vasut9b6956f2010-08-12 01:18:38 +020076 .flags = ENABLE_PORT1 |
Daniel Mack4c243c82010-05-22 00:29:38 +020077 POWER_CONTROL_LOW | POWER_SENSE_LOW,
Marek Vasuta3172e52010-08-12 01:45:05 +020078 .init = colibri_ohci_init,
Daniel Mack4c243c82010-05-22 00:29:38 +020079};
80
Marek Vasuta3172e52010-08-12 01:45:05 +020081static void __init colibri_uhc_init(void)
Daniel Mack4c243c82010-05-22 00:29:38 +020082{
Marek Vasut9b6956f2010-08-12 01:18:38 +020083 /* Colibri PXA270 has two usb ports, TBA for 320 */
84 if (machine_is_colibri())
Marek Vasuta3172e52010-08-12 01:45:05 +020085 colibri_ohci_info.flags |= ENABLE_PORT2;
Marek Vasut9b6956f2010-08-12 01:18:38 +020086
Marek Vasuta3172e52010-08-12 01:45:05 +020087 pxa_set_ohci_info(&colibri_ohci_info);
Daniel Mack4c243c82010-05-22 00:29:38 +020088}
89#else
Marek Vasuta3172e52010-08-12 01:45:05 +020090static inline void colibri_uhc_init(void) {}
Daniel Mack4c243c82010-05-22 00:29:38 +020091#endif
92
Marek Vasut072e1ae2010-08-12 01:30:39 +020093/******************************************************************************
94 * I2C RTC
95 ******************************************************************************/
96#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
Marek Vasuta3172e52010-08-12 01:45:05 +020097static struct i2c_board_info __initdata colibri_i2c_devs[] = {
Marek Vasut072e1ae2010-08-12 01:30:39 +020098 {
99 I2C_BOARD_INFO("m41t00", 0x68),
100 },
101};
102
Marek Vasuta3172e52010-08-12 01:45:05 +0200103static void __init colibri_rtc_init(void)
Marek Vasut072e1ae2010-08-12 01:30:39 +0200104{
105 pxa_set_i2c_info(NULL);
Marek Vasuta3172e52010-08-12 01:45:05 +0200106 i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
Marek Vasut072e1ae2010-08-12 01:30:39 +0200107}
108#else
Marek Vasuta3172e52010-08-12 01:45:05 +0200109static inline void colibri_rtc_init(void) {}
Marek Vasut072e1ae2010-08-12 01:30:39 +0200110#endif
111
Marek Vasuta3172e52010-08-12 01:45:05 +0200112void __init colibri_evalboard_init(void)
Daniel Mack4c243c82010-05-22 00:29:38 +0200113{
Daniel Mack4c243c82010-05-22 00:29:38 +0200114 pxa_set_ffuart_info(NULL);
115 pxa_set_btuart_info(NULL);
116 pxa_set_stuart_info(NULL);
117
Marek Vasuta3172e52010-08-12 01:45:05 +0200118 colibri_mmc_init();
119 colibri_uhc_init();
120 colibri_rtc_init();
Daniel Mack4c243c82010-05-22 00:29:38 +0200121}