Path: blob/master/arch/arm/mach-omap2/board-omap3logic.c
10817 views
/*1* linux/arch/arm/mach-omap2/board-omap3logic.c2*3* Copyright (C) 2010 Li-Pro.Net4* Stephan Linz <[email protected]>5*6* Copyright (C) 2010 Logic Product Development, Inc.7* Peter Barada <[email protected]>8*9* Modified from Beagle, EVM, and RX5110*11* This program is free software; you can redistribute it and/or modify12* it under the terms of the GNU General Public License version 2 as13* published by the Free Software Foundation.14*/1516#include <linux/kernel.h>17#include <linux/init.h>18#include <linux/platform_device.h>19#include <linux/delay.h>20#include <linux/err.h>21#include <linux/clk.h>22#include <linux/io.h>23#include <linux/gpio.h>2425#include <linux/regulator/machine.h>2627#include <linux/i2c/twl.h>28#include <linux/mmc/host.h>2930#include <mach/hardware.h>31#include <asm/mach-types.h>32#include <asm/mach/arch.h>33#include <asm/mach/map.h>3435#include "mux.h"36#include "hsmmc.h"37#include "timer-gp.h"38#include "control.h"39#include "common-board-devices.h"4041#include <plat/mux.h>42#include <plat/board.h>43#include <plat/common.h>44#include <plat/gpmc-smsc911x.h>45#include <plat/gpmc.h>46#include <plat/sdrc.h>4748#define OMAP3LOGIC_SMSC911X_CS 14950#define OMAP3530_LV_SOM_MMC_GPIO_CD 11051#define OMAP3530_LV_SOM_MMC_GPIO_WP 12652#define OMAP3530_LV_SOM_SMSC911X_GPIO_IRQ 1525354#define OMAP3_TORPEDO_MMC_GPIO_CD 12755#define OMAP3_TORPEDO_SMSC911X_GPIO_IRQ 1295657static struct regulator_consumer_supply omap3logic_vmmc1_supply = {58.supply = "vmmc",59};6061/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */62static struct regulator_init_data omap3logic_vmmc1 = {63.constraints = {64.name = "VMMC1",65.min_uV = 1850000,66.max_uV = 3150000,67.valid_modes_mask = REGULATOR_MODE_NORMAL68| REGULATOR_MODE_STANDBY,69.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE70| REGULATOR_CHANGE_MODE71| REGULATOR_CHANGE_STATUS,72},73.num_consumer_supplies = 1,74.consumer_supplies = &omap3logic_vmmc1_supply,75};7677static struct twl4030_gpio_platform_data omap3logic_gpio_data = {78.gpio_base = OMAP_MAX_GPIO_LINES,79.irq_base = TWL4030_GPIO_IRQ_BASE,80.irq_end = TWL4030_GPIO_IRQ_END,81.use_leds = true,82.pullups = BIT(1),83.pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8)84| BIT(13) | BIT(15) | BIT(16) | BIT(17),85};8687static struct twl4030_platform_data omap3logic_twldata = {88.irq_base = TWL4030_IRQ_BASE,89.irq_end = TWL4030_IRQ_END,9091/* platform_data for children goes here */92.gpio = &omap3logic_gpio_data,93.vmmc1 = &omap3logic_vmmc1,94};9596static int __init omap3logic_i2c_init(void)97{98omap3_pmic_init("twl4030", &omap3logic_twldata);99return 0;100}101102static struct omap2_hsmmc_info __initdata board_mmc_info[] = {103{104.name = "external",105.mmc = 1,106.caps = MMC_CAP_4_BIT_DATA,107.gpio_cd = -EINVAL,108.gpio_wp = -EINVAL,109},110{} /* Terminator */111};112113static void __init board_mmc_init(void)114{115if (machine_is_omap3530_lv_som()) {116/* OMAP3530 LV SOM board */117board_mmc_info[0].gpio_cd = OMAP3530_LV_SOM_MMC_GPIO_CD;118board_mmc_info[0].gpio_wp = OMAP3530_LV_SOM_MMC_GPIO_WP;119omap_mux_init_signal("gpio_110", OMAP_PIN_OUTPUT);120omap_mux_init_signal("gpio_126", OMAP_PIN_OUTPUT);121} else if (machine_is_omap3_torpedo()) {122/* OMAP3 Torpedo board */123board_mmc_info[0].gpio_cd = OMAP3_TORPEDO_MMC_GPIO_CD;124omap_mux_init_signal("gpio_127", OMAP_PIN_OUTPUT);125} else {126/* unsupported board */127printk(KERN_ERR "%s(): unknown machine type\n", __func__);128return;129}130131omap2_hsmmc_init(board_mmc_info);132/* link regulators to MMC adapters */133omap3logic_vmmc1_supply.dev = board_mmc_info[0].dev;134}135136static struct omap_smsc911x_platform_data __initdata board_smsc911x_data = {137.cs = OMAP3LOGIC_SMSC911X_CS,138.gpio_irq = -EINVAL,139.gpio_reset = -EINVAL,140};141142/* TODO/FIXME (comment by Peter Barada, LogicPD):143* Fix the PBIAS voltage for Torpedo MMC1 pins that144* are used for other needs (IRQs, etc). */145static void omap3torpedo_fix_pbias_voltage(void)146{147u16 control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;148u32 reg;149150if (machine_is_omap3_torpedo())151{152/* Set the bias for the pin */153reg = omap_ctrl_readl(control_pbias_offset);154155reg &= ~OMAP343X_PBIASLITEPWRDNZ1;156omap_ctrl_writel(reg, control_pbias_offset);157158/* 100ms delay required for PBIAS configuration */159msleep(100);160161reg |= OMAP343X_PBIASLITEVMODE1;162reg |= OMAP343X_PBIASLITEPWRDNZ1;163omap_ctrl_writel(reg | 0x300, control_pbias_offset);164}165}166167static inline void __init board_smsc911x_init(void)168{169if (machine_is_omap3530_lv_som()) {170/* OMAP3530 LV SOM board */171board_smsc911x_data.gpio_irq =172OMAP3530_LV_SOM_SMSC911X_GPIO_IRQ;173omap_mux_init_signal("gpio_152", OMAP_PIN_INPUT);174} else if (machine_is_omap3_torpedo()) {175/* OMAP3 Torpedo board */176board_smsc911x_data.gpio_irq = OMAP3_TORPEDO_SMSC911X_GPIO_IRQ;177omap_mux_init_signal("gpio_129", OMAP_PIN_INPUT);178} else {179/* unsupported board */180printk(KERN_ERR "%s(): unknown machine type\n", __func__);181return;182}183184gpmc_smsc911x_init(&board_smsc911x_data);185}186187static void __init omap3logic_init_early(void)188{189omap2_init_common_infrastructure();190omap2_init_common_devices(NULL, NULL);191}192193#ifdef CONFIG_OMAP_MUX194static struct omap_board_mux board_mux[] __initdata = {195{ .reg_offset = OMAP_MUX_TERMINATOR },196};197#endif198199static void __init omap3logic_init(void)200{201omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);202omap3torpedo_fix_pbias_voltage();203omap3logic_i2c_init();204omap_serial_init();205board_mmc_init();206board_smsc911x_init();207208/* Ensure SDRC pins are mux'd for self-refresh */209omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);210omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);211}212213MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")214.boot_params = 0x80000100,215.map_io = omap3_map_io,216.init_early = omap3logic_init_early,217.init_irq = omap_init_irq,218.init_machine = omap3logic_init,219.timer = &omap_timer,220MACHINE_END221222MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")223.boot_params = 0x80000100,224.map_io = omap3_map_io,225.init_early = omap3logic_init_early,226.init_irq = omap_init_irq,227.init_machine = omap3logic_init,228.timer = &omap_timer,229MACHINE_END230231232