blob: d28e802e2448b9a4c210c778a0faea4f650182fd [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>
Daniel Mack4c243c82010-05-22 00:29:38 +020016#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 Vasut072e1ae2010-08-12 01:30:39 +020021#include <linux/i2c.h>
Sebastian Andrzej Siewiorb4593962011-02-23 12:38:16 +010022#include <linux/i2c/pxa-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
30#include "generic.h"
31#include "devices.h"
32
33/******************************************************************************
Daniel Mack4c243c82010-05-22 00:29:38 +020034 * SD/MMC card controller
35 ******************************************************************************/
36#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
Marek Vasuta3172e52010-08-12 01:45:05 +020037static struct pxamci_platform_data colibri_mci_platform_data = {
Daniel Mack4c243c82010-05-22 00:29:38 +020038 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
39 .gpio_power = -1,
Daniel Mack4c243c82010-05-22 00:29:38 +020040 .gpio_card_ro = -1,
41 .detect_delay_ms = 200,
42};
43
Marek Vasuta3172e52010-08-12 01:45:05 +020044static void __init colibri_mmc_init(void)
Daniel Mack4c243c82010-05-22 00:29:38 +020045{
Marek Vasut9b6956f2010-08-12 01:18:38 +020046 if (machine_is_colibri()) /* PXA270 Colibri */
Marek Vasuta3172e52010-08-12 01:45:05 +020047 colibri_mci_platform_data.gpio_card_detect =
Marek Vasut9b6956f2010-08-12 01:18:38 +020048 GPIO0_COLIBRI_PXA270_SD_DETECT;
49 if (machine_is_colibri300()) /* PXA300 Colibri */
Marek Vasuta3172e52010-08-12 01:45:05 +020050 colibri_mci_platform_data.gpio_card_detect =
Bjørn Forsman57834a72010-12-23 16:01:02 +010051 GPIO13_COLIBRI_PXA300_SD_DETECT;
Marek Vasut9b6956f2010-08-12 01:18:38 +020052 else /* PXA320 Colibri */
Marek Vasuta3172e52010-08-12 01:45:05 +020053 colibri_mci_platform_data.gpio_card_detect =
Marek Vasut9b6956f2010-08-12 01:18:38 +020054 GPIO28_COLIBRI_PXA320_SD_DETECT;
55
Marek Vasuta3172e52010-08-12 01:45:05 +020056 pxa_set_mci_info(&colibri_mci_platform_data);
Daniel Mack4c243c82010-05-22 00:29:38 +020057}
58#else
Marek Vasuta3172e52010-08-12 01:45:05 +020059static inline void colibri_mmc_init(void) {}
Daniel Mack4c243c82010-05-22 00:29:38 +020060#endif
61
62/******************************************************************************
63 * USB Host
64 ******************************************************************************/
65#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
Marek Vasuta3172e52010-08-12 01:45:05 +020066static int colibri_ohci_init(struct device *dev)
Daniel Mack4c243c82010-05-22 00:29:38 +020067{
68 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
69 return 0;
70}
71
Marek Vasuta3172e52010-08-12 01:45:05 +020072static struct pxaohci_platform_data colibri_ohci_info = {
Daniel Mack4c243c82010-05-22 00:29:38 +020073 .port_mode = PMM_PERPORT_MODE,
Marek Vasut9b6956f2010-08-12 01:18:38 +020074 .flags = ENABLE_PORT1 |
Daniel Mack4c243c82010-05-22 00:29:38 +020075 POWER_CONTROL_LOW | POWER_SENSE_LOW,
Marek Vasuta3172e52010-08-12 01:45:05 +020076 .init = colibri_ohci_init,
Daniel Mack4c243c82010-05-22 00:29:38 +020077};
78
Marek Vasuta3172e52010-08-12 01:45:05 +020079static void __init colibri_uhc_init(void)
Daniel Mack4c243c82010-05-22 00:29:38 +020080{
Marek Vasut9b6956f2010-08-12 01:18:38 +020081 /* Colibri PXA270 has two usb ports, TBA for 320 */
82 if (machine_is_colibri())
Marek Vasuta3172e52010-08-12 01:45:05 +020083 colibri_ohci_info.flags |= ENABLE_PORT2;
Marek Vasut9b6956f2010-08-12 01:18:38 +020084
Marek Vasuta3172e52010-08-12 01:45:05 +020085 pxa_set_ohci_info(&colibri_ohci_info);
Daniel Mack4c243c82010-05-22 00:29:38 +020086}
87#else
Marek Vasuta3172e52010-08-12 01:45:05 +020088static inline void colibri_uhc_init(void) {}
Daniel Mack4c243c82010-05-22 00:29:38 +020089#endif
90
Marek Vasut072e1ae2010-08-12 01:30:39 +020091/******************************************************************************
92 * I2C RTC
93 ******************************************************************************/
94#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
Marek Vasuta3172e52010-08-12 01:45:05 +020095static struct i2c_board_info __initdata colibri_i2c_devs[] = {
Marek Vasut072e1ae2010-08-12 01:30:39 +020096 {
97 I2C_BOARD_INFO("m41t00", 0x68),
98 },
99};
100
Marek Vasuta3172e52010-08-12 01:45:05 +0200101static void __init colibri_rtc_init(void)
Marek Vasut072e1ae2010-08-12 01:30:39 +0200102{
103 pxa_set_i2c_info(NULL);
Marek Vasuta3172e52010-08-12 01:45:05 +0200104 i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
Marek Vasut072e1ae2010-08-12 01:30:39 +0200105}
106#else
Marek Vasuta3172e52010-08-12 01:45:05 +0200107static inline void colibri_rtc_init(void) {}
Marek Vasut072e1ae2010-08-12 01:30:39 +0200108#endif
109
Marek Vasuta3172e52010-08-12 01:45:05 +0200110void __init colibri_evalboard_init(void)
Daniel Mack4c243c82010-05-22 00:29:38 +0200111{
Daniel Mack4c243c82010-05-22 00:29:38 +0200112 pxa_set_ffuart_info(NULL);
113 pxa_set_btuart_info(NULL);
114 pxa_set_stuart_info(NULL);
115
Marek Vasuta3172e52010-08-12 01:45:05 +0200116 colibri_mmc_init();
117 colibri_uhc_init();
118 colibri_rtc_init();
Daniel Mack4c243c82010-05-22 00:29:38 +0200119}