yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/colibri-evalboard.c |
| 3 | * |
| 4 | * Support for Toradex 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/interrupt.h> |
| 17 | #include <linux/gpio.h> |
| 18 | #include <asm/mach-types.h> |
| 19 | #include <mach/hardware.h> |
| 20 | #include <asm/mach/arch.h> |
| 21 | #include <linux/i2c.h> |
| 22 | #include <linux/i2c/pxa-i2c.h> |
| 23 | |
| 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 | /****************************************************************************** |
| 34 | * SD/MMC card controller |
| 35 | ******************************************************************************/ |
| 36 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
| 37 | static struct pxamci_platform_data colibri_mci_platform_data = { |
| 38 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 39 | .gpio_power = -1, |
| 40 | .gpio_card_ro = -1, |
| 41 | .detect_delay_ms = 200, |
| 42 | }; |
| 43 | |
| 44 | static void __init colibri_mmc_init(void) |
| 45 | { |
| 46 | if (machine_is_colibri()) /* PXA270 Colibri */ |
| 47 | colibri_mci_platform_data.gpio_card_detect = |
| 48 | GPIO0_COLIBRI_PXA270_SD_DETECT; |
| 49 | if (machine_is_colibri300()) /* PXA300 Colibri */ |
| 50 | colibri_mci_platform_data.gpio_card_detect = |
| 51 | GPIO13_COLIBRI_PXA300_SD_DETECT; |
| 52 | else /* PXA320 Colibri */ |
| 53 | colibri_mci_platform_data.gpio_card_detect = |
| 54 | GPIO28_COLIBRI_PXA320_SD_DETECT; |
| 55 | |
| 56 | pxa_set_mci_info(&colibri_mci_platform_data); |
| 57 | } |
| 58 | #else |
| 59 | static inline void colibri_mmc_init(void) {} |
| 60 | #endif |
| 61 | |
| 62 | /****************************************************************************** |
| 63 | * USB Host |
| 64 | ******************************************************************************/ |
| 65 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
| 66 | static int colibri_ohci_init(struct device *dev) |
| 67 | { |
| 68 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | static struct pxaohci_platform_data colibri_ohci_info = { |
| 73 | .port_mode = PMM_PERPORT_MODE, |
| 74 | .flags = ENABLE_PORT1 | |
| 75 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
| 76 | .init = colibri_ohci_init, |
| 77 | }; |
| 78 | |
| 79 | static void __init colibri_uhc_init(void) |
| 80 | { |
| 81 | /* Colibri PXA270 has two usb ports, TBA for 320 */ |
| 82 | if (machine_is_colibri()) |
| 83 | colibri_ohci_info.flags |= ENABLE_PORT2; |
| 84 | |
| 85 | pxa_set_ohci_info(&colibri_ohci_info); |
| 86 | } |
| 87 | #else |
| 88 | static inline void colibri_uhc_init(void) {} |
| 89 | #endif |
| 90 | |
| 91 | /****************************************************************************** |
| 92 | * I2C RTC |
| 93 | ******************************************************************************/ |
| 94 | #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE) |
| 95 | static struct i2c_board_info __initdata colibri_i2c_devs[] = { |
| 96 | { |
| 97 | I2C_BOARD_INFO("m41t00", 0x68), |
| 98 | }, |
| 99 | }; |
| 100 | |
| 101 | static void __init colibri_rtc_init(void) |
| 102 | { |
| 103 | pxa_set_i2c_info(NULL); |
| 104 | i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs)); |
| 105 | } |
| 106 | #else |
| 107 | static inline void colibri_rtc_init(void) {} |
| 108 | #endif |
| 109 | |
| 110 | void __init colibri_evalboard_init(void) |
| 111 | { |
| 112 | pxa_set_ffuart_info(NULL); |
| 113 | pxa_set_btuart_info(NULL); |
| 114 | pxa_set_stuart_info(NULL); |
| 115 | |
| 116 | colibri_mmc_init(); |
| 117 | colibri_uhc_init(); |
| 118 | colibri_rtc_init(); |
| 119 | } |