Path: blob/master/arch/arm/mach-imx/mach-cpuimx27.c
10817 views
/*1* Copyright (C) 2009 Eric Benard - [email protected]2*3* Based on pcm038.c which is :4* Copyright 2007 Robert Schwebel <[email protected]>, Pengutronix5* Copyright (C) 2008 Juergen Beisert ([email protected])6*7* This program is free software; you can redistribute it and/or8* modify it under the terms of the GNU General Public License9* as published by the Free Software Foundation; either version 210* of the License, or (at your option) any later version.11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with this program; if not, write to the Free Software18* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,19* MA 02110-1301, USA.20*/2122#include <linux/i2c.h>23#include <linux/io.h>24#include <linux/mtd/plat-ram.h>25#include <linux/mtd/physmap.h>26#include <linux/platform_device.h>27#include <linux/serial_8250.h>28#include <linux/usb/otg.h>29#include <linux/usb/ulpi.h>3031#include <asm/mach-types.h>32#include <asm/mach/arch.h>33#include <asm/mach/time.h>34#include <asm/mach/map.h>3536#include <mach/eukrea-baseboards.h>37#include <mach/common.h>38#include <mach/hardware.h>39#include <mach/iomux-mx27.h>40#include <mach/ulpi.h>4142#include "devices-imx27.h"4344static const int eukrea_cpuimx27_pins[] __initconst = {45/* UART1 */46PE12_PF_UART1_TXD,47PE13_PF_UART1_RXD,48PE14_PF_UART1_CTS,49PE15_PF_UART1_RTS,50/* UART4 */51#if defined(MACH_EUKREA_CPUIMX27_USEUART4)52PB26_AF_UART4_RTS,53PB28_AF_UART4_TXD,54PB29_AF_UART4_CTS,55PB31_AF_UART4_RXD,56#endif57/* FEC */58PD0_AIN_FEC_TXD0,59PD1_AIN_FEC_TXD1,60PD2_AIN_FEC_TXD2,61PD3_AIN_FEC_TXD3,62PD4_AOUT_FEC_RX_ER,63PD5_AOUT_FEC_RXD1,64PD6_AOUT_FEC_RXD2,65PD7_AOUT_FEC_RXD3,66PD8_AF_FEC_MDIO,67PD9_AIN_FEC_MDC,68PD10_AOUT_FEC_CRS,69PD11_AOUT_FEC_TX_CLK,70PD12_AOUT_FEC_RXD0,71PD13_AOUT_FEC_RX_DV,72PD14_AOUT_FEC_RX_CLK,73PD15_AOUT_FEC_COL,74PD16_AIN_FEC_TX_ER,75PF23_AIN_FEC_TX_EN,76/* I2C1 */77PD17_PF_I2C_DATA,78PD18_PF_I2C_CLK,79/* SDHC2 */80#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)81PB4_PF_SD2_D0,82PB5_PF_SD2_D1,83PB6_PF_SD2_D2,84PB7_PF_SD2_D3,85PB8_PF_SD2_CMD,86PB9_PF_SD2_CLK,87#endif88#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)89/* Quad UART's IRQ */90GPIO_PORTB | 22 | GPIO_GPIO | GPIO_IN,91GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN,92GPIO_PORTB | 27 | GPIO_GPIO | GPIO_IN,93GPIO_PORTB | 30 | GPIO_GPIO | GPIO_IN,94#endif95/* OTG */96PC7_PF_USBOTG_DATA5,97PC8_PF_USBOTG_DATA6,98PC9_PF_USBOTG_DATA0,99PC10_PF_USBOTG_DATA2,100PC11_PF_USBOTG_DATA1,101PC12_PF_USBOTG_DATA4,102PC13_PF_USBOTG_DATA3,103PE0_PF_USBOTG_NXT,104PE1_PF_USBOTG_STP,105PE2_PF_USBOTG_DIR,106PE24_PF_USBOTG_CLK,107PE25_PF_USBOTG_DATA7,108/* USBH2 */109PA0_PF_USBH2_CLK,110PA1_PF_USBH2_DIR,111PA2_PF_USBH2_DATA7,112PA3_PF_USBH2_NXT,113PA4_PF_USBH2_STP,114PD19_AF_USBH2_DATA4,115PD20_AF_USBH2_DATA3,116PD21_AF_USBH2_DATA6,117PD22_AF_USBH2_DATA0,118PD23_AF_USBH2_DATA2,119PD24_AF_USBH2_DATA1,120PD26_AF_USBH2_DATA5,121};122123static struct physmap_flash_data eukrea_cpuimx27_flash_data = {124.width = 2,125};126127static struct resource eukrea_cpuimx27_flash_resource = {128.start = 0xc0000000,129.end = 0xc3ffffff,130.flags = IORESOURCE_MEM,131};132133static struct platform_device eukrea_cpuimx27_nor_mtd_device = {134.name = "physmap-flash",135.id = 0,136.dev = {137.platform_data = &eukrea_cpuimx27_flash_data,138},139.num_resources = 1,140.resource = &eukrea_cpuimx27_flash_resource,141};142143static const struct imxuart_platform_data uart_pdata __initconst = {144.flags = IMXUART_HAVE_RTSCTS,145};146147static const struct mxc_nand_platform_data148cpuimx27_nand_board_info __initconst = {149.width = 1,150.hw_ecc = 1,151};152153static struct platform_device *platform_devices[] __initdata = {154&eukrea_cpuimx27_nor_mtd_device,155};156157static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {158.bitrate = 100000,159};160161static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = {162{163I2C_BOARD_INFO("pcf8563", 0x51),164},165};166167#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)168static struct plat_serial8250_port serial_platform_data[] = {169{170.mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x200000),171.irq = IRQ_GPIOB(23),172.uartclk = 14745600,173.regshift = 1,174.iotype = UPIO_MEM,175.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,176}, {177.mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x400000),178.irq = IRQ_GPIOB(22),179.uartclk = 14745600,180.regshift = 1,181.iotype = UPIO_MEM,182.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,183}, {184.mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x800000),185.irq = IRQ_GPIOB(27),186.uartclk = 14745600,187.regshift = 1,188.iotype = UPIO_MEM,189.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,190}, {191.mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x1000000),192.irq = IRQ_GPIOB(30),193.uartclk = 14745600,194.regshift = 1,195.iotype = UPIO_MEM,196.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,197}, {198}199};200201static struct platform_device serial_device = {202.name = "serial8250",203.id = 0,204.dev = {205.platform_data = serial_platform_data,206},207};208#endif209210static int eukrea_cpuimx27_otg_init(struct platform_device *pdev)211{212return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);213}214215static struct mxc_usbh_platform_data otg_pdata __initdata = {216.init = eukrea_cpuimx27_otg_init,217.portsc = MXC_EHCI_MODE_ULPI,218};219220static int eukrea_cpuimx27_usbh2_init(struct platform_device *pdev)221{222return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);223}224225static struct mxc_usbh_platform_data usbh2_pdata __initdata = {226.init = eukrea_cpuimx27_usbh2_init,227.portsc = MXC_EHCI_MODE_ULPI,228};229230static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {231.operating_mode = FSL_USB2_DR_DEVICE,232.phy_mode = FSL_USB2_PHY_ULPI,233};234235static int otg_mode_host;236237static int __init eukrea_cpuimx27_otg_mode(char *options)238{239if (!strcmp(options, "host"))240otg_mode_host = 1;241else if (!strcmp(options, "device"))242otg_mode_host = 0;243else244pr_info("otg_mode neither \"host\" nor \"device\". "245"Defaulting to device\n");246return 0;247}248__setup("otg_mode=", eukrea_cpuimx27_otg_mode);249250static void __init eukrea_cpuimx27_init(void)251{252mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,253ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27");254255imx27_add_imx_uart0(&uart_pdata);256257imx27_add_mxc_nand(&cpuimx27_nand_board_info);258259i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,260ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));261262imx27_add_imx_i2c(0, &cpuimx27_i2c1_data);263264imx27_add_fec(NULL);265platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));266imx27_add_imx2_wdt(NULL);267imx27_add_mxc_w1(NULL);268269#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)270/* SDHC2 can be used for Wifi */271imx27_add_mxc_mmc(1, NULL);272#endif273#if defined(MACH_EUKREA_CPUIMX27_USEUART4)274/* in which case UART4 is also used for Bluetooth */275imx27_add_imx_uart3(&uart_pdata);276#endif277278#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)279platform_device_register(&serial_device);280#endif281282if (otg_mode_host) {283otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |284ULPI_OTG_DRVVBUS_EXT);285if (otg_pdata.otg)286imx27_add_mxc_ehci_otg(&otg_pdata);287} else {288imx27_add_fsl_usb2_udc(&otg_device_pdata);289}290291usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |292ULPI_OTG_DRVVBUS_EXT);293if (usbh2_pdata.otg)294imx27_add_mxc_ehci_hs(2, &usbh2_pdata);295296#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD297eukrea_mbimx27_baseboard_init();298#endif299}300301static void __init eukrea_cpuimx27_timer_init(void)302{303mx27_clocks_init(26000000);304}305306static struct sys_timer eukrea_cpuimx27_timer = {307.init = eukrea_cpuimx27_timer_init,308};309310MACHINE_START(CPUIMX27, "EUKREA CPUIMX27")311.boot_params = MX27_PHYS_OFFSET + 0x100,312.map_io = mx27_map_io,313.init_early = imx27_init_early,314.init_irq = mx27_init_irq,315.timer = &eukrea_cpuimx27_timer,316.init_machine = eukrea_cpuimx27_init,317MACHINE_END318319320