Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/colibri-pxa270-evalboard.c |
| 3 | * |
| 4 | * Support for Toradex PXA270 based Colibri Evaluation Carrier Board |
| 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> |
| 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> |
| 22 | |
| 23 | #include <mach/pxa27x.h> |
| 24 | #include <mach/colibri.h> |
| 25 | #include <mach/mmc.h> |
| 26 | #include <mach/ohci.h> |
| 27 | #include <mach/pxa27x-udc.h> |
| 28 | |
| 29 | #include "generic.h" |
| 30 | #include "devices.h" |
| 31 | |
| 32 | /****************************************************************************** |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 33 | * SD/MMC card controller |
| 34 | ******************************************************************************/ |
| 35 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
| 36 | static struct pxamci_platform_data colibri_pxa270_mci_platform_data = { |
| 37 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 38 | .gpio_power = -1, |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 39 | .gpio_card_ro = -1, |
| 40 | .detect_delay_ms = 200, |
| 41 | }; |
| 42 | |
| 43 | static void __init colibri_pxa270_mmc_init(void) |
| 44 | { |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame^] | 45 | if (machine_is_colibri()) /* PXA270 Colibri */ |
| 46 | colibri_pxa270_mci_platform_data.gpio_card_detect = |
| 47 | GPIO0_COLIBRI_PXA270_SD_DETECT; |
| 48 | if (machine_is_colibri300()) /* PXA300 Colibri */ |
| 49 | colibri_pxa270_mci_platform_data.gpio_card_detect = |
| 50 | GPIO39_COLIBRI_PXA300_SD_DETECT; |
| 51 | else /* PXA320 Colibri */ |
| 52 | colibri_pxa270_mci_platform_data.gpio_card_detect = |
| 53 | GPIO28_COLIBRI_PXA320_SD_DETECT; |
| 54 | |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 55 | pxa_set_mci_info(&colibri_pxa270_mci_platform_data); |
| 56 | } |
| 57 | #else |
| 58 | static inline void colibri_pxa270_mmc_init(void) {} |
| 59 | #endif |
| 60 | |
| 61 | /****************************************************************************** |
| 62 | * USB Host |
| 63 | ******************************************************************************/ |
| 64 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
| 65 | static int colibri_pxa270_ohci_init(struct device *dev) |
| 66 | { |
| 67 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | static struct pxaohci_platform_data colibri_pxa270_ohci_info = { |
| 72 | .port_mode = PMM_PERPORT_MODE, |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame^] | 73 | .flags = ENABLE_PORT1 | |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 74 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
| 75 | .init = colibri_pxa270_ohci_init, |
| 76 | }; |
| 77 | |
| 78 | static void __init colibri_pxa270_uhc_init(void) |
| 79 | { |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame^] | 80 | /* Colibri PXA270 has two usb ports, TBA for 320 */ |
| 81 | if (machine_is_colibri()) |
| 82 | colibri_pxa270_ohci_info.flags |= ENABLE_PORT2; |
| 83 | |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 84 | pxa_set_ohci_info(&colibri_pxa270_ohci_info); |
| 85 | } |
| 86 | #else |
| 87 | static inline void colibri_pxa270_uhc_init(void) {} |
| 88 | #endif |
| 89 | |
| 90 | void __init colibri_pxa270_evalboard_init(void) |
| 91 | { |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 92 | pxa_set_ffuart_info(NULL); |
| 93 | pxa_set_btuart_info(NULL); |
| 94 | pxa_set_stuart_info(NULL); |
| 95 | |
| 96 | colibri_pxa270_mmc_init(); |
| 97 | colibri_pxa270_uhc_init(); |
| 98 | } |