blob: dc44fbbe50731765d634f7e11e7f77f846225ec5 [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>
Arnd Bergmann847e3492014-03-16 20:36:28 +010023#include <asm/io.h>
Daniel Mack4c243c82010-05-22 00:29:38 +020024
Arnd Bergmann4c25c5d2015-01-30 10:45:33 +010025#include "pxa27x.h"
26#include "colibri.h"
Arnd Bergmann293b2da2012-08-24 15:16:48 +020027#include <linux/platform_data/mmc-pxamci.h>
28#include <linux/platform_data/usb-ohci-pxa27x.h>
Arnd Bergmann4c25c5d2015-01-30 10:45:33 +010029#include "pxa27x-udc.h"
Daniel Mack4c243c82010-05-22 00:29:38 +020030
31#include "generic.h"
32#include "devices.h"
33
34/******************************************************************************
Daniel Mack4c243c82010-05-22 00:29:38 +020035 * SD/MMC card controller
36 ******************************************************************************/
37#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
Marek Vasuta3172e52010-08-12 01:45:05 +020038static struct pxamci_platform_data colibri_mci_platform_data = {
Daniel Mack4c243c82010-05-22 00:29:38 +020039 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
40 .gpio_power = -1,
Daniel Mack4c243c82010-05-22 00:29:38 +020041 .gpio_card_ro = -1,
42 .detect_delay_ms = 200,
43};
44
Marek Vasuta3172e52010-08-12 01:45:05 +020045static void __init colibri_mmc_init(void)
Daniel Mack4c243c82010-05-22 00:29:38 +020046{
Marek Vasut9b6956f2010-08-12 01:18:38 +020047 if (machine_is_colibri()) /* PXA270 Colibri */
Marek Vasuta3172e52010-08-12 01:45:05 +020048 colibri_mci_platform_data.gpio_card_detect =
Marek Vasut9b6956f2010-08-12 01:18:38 +020049 GPIO0_COLIBRI_PXA270_SD_DETECT;
50 if (machine_is_colibri300()) /* PXA300 Colibri */
Marek Vasuta3172e52010-08-12 01:45:05 +020051 colibri_mci_platform_data.gpio_card_detect =
Bjørn Forsman57834a72010-12-23 16:01:02 +010052 GPIO13_COLIBRI_PXA300_SD_DETECT;
Marek Vasut9b6956f2010-08-12 01:18:38 +020053 else /* PXA320 Colibri */
Marek Vasuta3172e52010-08-12 01:45:05 +020054 colibri_mci_platform_data.gpio_card_detect =
Marek Vasut9b6956f2010-08-12 01:18:38 +020055 GPIO28_COLIBRI_PXA320_SD_DETECT;
56
Marek Vasuta3172e52010-08-12 01:45:05 +020057 pxa_set_mci_info(&colibri_mci_platform_data);
Daniel Mack4c243c82010-05-22 00:29:38 +020058}
59#else
Marek Vasuta3172e52010-08-12 01:45:05 +020060static inline void colibri_mmc_init(void) {}
Daniel Mack4c243c82010-05-22 00:29:38 +020061#endif
62
63/******************************************************************************
64 * USB Host
65 ******************************************************************************/
66#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
Marek Vasuta3172e52010-08-12 01:45:05 +020067static int colibri_ohci_init(struct device *dev)
Daniel Mack4c243c82010-05-22 00:29:38 +020068{
69 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
70 return 0;
71}
72
Marek Vasuta3172e52010-08-12 01:45:05 +020073static struct pxaohci_platform_data colibri_ohci_info = {
Daniel Mack4c243c82010-05-22 00:29:38 +020074 .port_mode = PMM_PERPORT_MODE,
Marek Vasut9b6956f2010-08-12 01:18:38 +020075 .flags = ENABLE_PORT1 |
Daniel Mack4c243c82010-05-22 00:29:38 +020076 POWER_CONTROL_LOW | POWER_SENSE_LOW,
Marek Vasuta3172e52010-08-12 01:45:05 +020077 .init = colibri_ohci_init,
Daniel Mack4c243c82010-05-22 00:29:38 +020078};
79
Marek Vasuta3172e52010-08-12 01:45:05 +020080static void __init colibri_uhc_init(void)
Daniel Mack4c243c82010-05-22 00:29:38 +020081{
Marek Vasut9b6956f2010-08-12 01:18:38 +020082 /* Colibri PXA270 has two usb ports, TBA for 320 */
83 if (machine_is_colibri())
Marek Vasuta3172e52010-08-12 01:45:05 +020084 colibri_ohci_info.flags |= ENABLE_PORT2;
Marek Vasut9b6956f2010-08-12 01:18:38 +020085
Marek Vasuta3172e52010-08-12 01:45:05 +020086 pxa_set_ohci_info(&colibri_ohci_info);
Daniel Mack4c243c82010-05-22 00:29:38 +020087}
88#else
Marek Vasuta3172e52010-08-12 01:45:05 +020089static inline void colibri_uhc_init(void) {}
Daniel Mack4c243c82010-05-22 00:29:38 +020090#endif
91
Marek Vasut072e1ae2010-08-12 01:30:39 +020092/******************************************************************************
93 * I2C RTC
94 ******************************************************************************/
95#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
Marek Vasuta3172e52010-08-12 01:45:05 +020096static struct i2c_board_info __initdata colibri_i2c_devs[] = {
Marek Vasut072e1ae2010-08-12 01:30:39 +020097 {
98 I2C_BOARD_INFO("m41t00", 0x68),
99 },
100};
101
Marek Vasuta3172e52010-08-12 01:45:05 +0200102static void __init colibri_rtc_init(void)
Marek Vasut072e1ae2010-08-12 01:30:39 +0200103{
104 pxa_set_i2c_info(NULL);
Marek Vasuta3172e52010-08-12 01:45:05 +0200105 i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
Marek Vasut072e1ae2010-08-12 01:30:39 +0200106}
107#else
Marek Vasuta3172e52010-08-12 01:45:05 +0200108static inline void colibri_rtc_init(void) {}
Marek Vasut072e1ae2010-08-12 01:30:39 +0200109#endif
110
Marek Vasuta3172e52010-08-12 01:45:05 +0200111void __init colibri_evalboard_init(void)
Daniel Mack4c243c82010-05-22 00:29:38 +0200112{
Daniel Mack4c243c82010-05-22 00:29:38 +0200113 pxa_set_ffuart_info(NULL);
114 pxa_set_btuart_info(NULL);
115 pxa_set_stuart_info(NULL);
116
Marek Vasuta3172e52010-08-12 01:45:05 +0200117 colibri_mmc_init();
118 colibri_uhc_init();
119 colibri_rtc_init();
Daniel Mack4c243c82010-05-22 00:29:38 +0200120}