Path: blob/master/arch/arm/mach-mx5/board-mx53_evk.c
10817 views
/*1* Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved.2* Copyright (C) 2010 Yong Shen. <[email protected]>3*/45/*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License as published by8* the Free Software Foundation; either version 2 of the License, or9* (at your option) any later version.1011* 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.1516* You should have received a copy of the GNU General Public License along17* with this program; if not, write to the Free Software Foundation, Inc.,18* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.19*/2021#include <linux/init.h>22#include <linux/clk.h>23#include <linux/delay.h>24#include <linux/gpio.h>25#include <linux/spi/flash.h>26#include <linux/spi/spi.h>27#include <mach/common.h>28#include <mach/hardware.h>29#include <asm/mach-types.h>30#include <asm/mach/arch.h>31#include <asm/mach/time.h>32#include <mach/iomux-mx53.h>3334#define MX53_EVK_FEC_PHY_RST IMX_GPIO_NR(7, 6)35#define EVK_ECSPI1_CS0 IMX_GPIO_NR(2, 30)36#define EVK_ECSPI1_CS1 IMX_GPIO_NR(3, 19)3738#include "crm_regs.h"39#include "devices-imx53.h"4041static iomux_v3_cfg_t mx53_evk_pads[] = {42MX53_PAD_CSI0_DAT10__UART1_TXD_MUX,43MX53_PAD_CSI0_DAT11__UART1_RXD_MUX,4445MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX,46MX53_PAD_PATA_DMARQ__UART2_TXD_MUX,47MX53_PAD_PATA_DIOR__UART2_RTS,48MX53_PAD_PATA_INTRQ__UART2_CTS,4950MX53_PAD_PATA_CS_0__UART3_TXD_MUX,51MX53_PAD_PATA_CS_1__UART3_RXD_MUX,5253MX53_PAD_EIM_D16__ECSPI1_SCLK,54MX53_PAD_EIM_D17__ECSPI1_MISO,55MX53_PAD_EIM_D18__ECSPI1_MOSI,5657/* ecspi chip select lines */58MX53_PAD_EIM_EB2__GPIO2_30,59MX53_PAD_EIM_D19__GPIO3_19,60};6162static const struct imxuart_platform_data mx53_evk_uart_pdata __initconst = {63.flags = IMXUART_HAVE_RTSCTS,64};6566static inline void mx53_evk_init_uart(void)67{68imx53_add_imx_uart(0, NULL);69imx53_add_imx_uart(1, &mx53_evk_uart_pdata);70imx53_add_imx_uart(2, NULL);71}7273static const struct imxi2c_platform_data mx53_evk_i2c_data __initconst = {74.bitrate = 100000,75};7677static inline void mx53_evk_fec_reset(void)78{79int ret;8081/* reset FEC PHY */82ret = gpio_request_one(MX53_EVK_FEC_PHY_RST, GPIOF_OUT_INIT_LOW,83"fec-phy-reset");84if (ret) {85printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);86return;87}88msleep(1);89gpio_set_value(MX53_EVK_FEC_PHY_RST, 1);90}9192static struct fec_platform_data mx53_evk_fec_pdata = {93.phy = PHY_INTERFACE_MODE_RMII,94};9596static struct spi_board_info mx53_evk_spi_board_info[] __initdata = {97{98.modalias = "mtd_dataflash",99.max_speed_hz = 25000000,100.bus_num = 0,101.chip_select = 1,102.mode = SPI_MODE_0,103.platform_data = NULL,104},105};106107static int mx53_evk_spi_cs[] = {108EVK_ECSPI1_CS0,109EVK_ECSPI1_CS1,110};111112static const struct spi_imx_master mx53_evk_spi_data __initconst = {113.chipselect = mx53_evk_spi_cs,114.num_chipselect = ARRAY_SIZE(mx53_evk_spi_cs),115};116117static void __init mx53_evk_board_init(void)118{119mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads,120ARRAY_SIZE(mx53_evk_pads));121mx53_evk_init_uart();122mx53_evk_fec_reset();123imx53_add_fec(&mx53_evk_fec_pdata);124125imx53_add_imx_i2c(0, &mx53_evk_i2c_data);126imx53_add_imx_i2c(1, &mx53_evk_i2c_data);127128imx53_add_sdhci_esdhc_imx(0, NULL);129imx53_add_sdhci_esdhc_imx(1, NULL);130131spi_register_board_info(mx53_evk_spi_board_info,132ARRAY_SIZE(mx53_evk_spi_board_info));133imx53_add_ecspi(0, &mx53_evk_spi_data);134imx53_add_imx2_wdt(0, NULL);135}136137static void __init mx53_evk_timer_init(void)138{139mx53_clocks_init(32768, 24000000, 22579200, 0);140}141142static struct sys_timer mx53_evk_timer = {143.init = mx53_evk_timer_init,144};145146MACHINE_START(MX53_EVK, "Freescale MX53 EVK Board")147.map_io = mx53_map_io,148.init_early = imx53_init_early,149.init_irq = mx53_init_irq,150.timer = &mx53_evk_timer,151.init_machine = mx53_evk_board_init,152MACHINE_END153154155