]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-epos/sitara-epos-kernel.git/blobdiff - arch/arm/mach-omap2/board-am335xevm.c
arm: omap: am335x: corrected mmc1 pin mux naming
[sitara-epos/sitara-epos-kernel.git] / arch / arm / mach-omap2 / board-am335xevm.c
index 81d9b84afde2aac2eecc16d04940b16b85f06fcd..4c09cc97d13e2da1e598ffdbeb335b67f773f2be 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/wl12xx.h>
 #include <linux/ethtool.h>
 #include <linux/mfd/tps65910.h>
+#include <linux/mfd/tps65217.h>
 #include <linux/pwm_backlight.h>
 
 /* LCD controller is similar to DA850 */
@@ -52,6 +53,7 @@
 #include <plat/lcdc.h>
 #include <plat/usb.h>
 #include <plat/mmc.h>
+#include <plat/emif.h>
 
 #include "board-flash.h"
 #include "cpuidle33xx.h"
@@ -128,7 +130,7 @@ static const struct display_panel disp_panel = {
 /* LCD backlight platform Data */
 #define AM335X_BACKLIGHT_MAX_BRIGHTNESS        100
 #define AM335X_BACKLIGHT_DEFAULT_BRIGHTNESS    100
-#define AM335X_PWM_PERIOD_NANO_SECONDS        (10000 * 10)
+#define AM335X_PWM_PERIOD_NANO_SECONDS        (1000000 * 10)
 
 #define PWM_DEVICE_ID   "ecap.0"
 
@@ -347,6 +349,12 @@ static u32 am335x_get_profile_selection(void)
                return val & 0x7;
 }
 
+static struct pinmux_config haptics_pin_mux[] = {
+       {"gpmc_ad9.ehrpwm2B",           OMAP_MUX_MODE4 |
+               AM33XX_PIN_OUTPUT},
+       {NULL, 0},
+};
+
 /* Module pin mux for LCDC */
 static struct pinmux_config lcdc_pin_mux[] = {
        {"lcd_data0.lcd_data0",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
@@ -580,7 +588,7 @@ static struct pinmux_config mmc1_pin_mux[] = {
        {"gpmc_ad0.mmc1_dat0",  OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
        {"gpmc_csn1.mmc1_clk",  OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
        {"gpmc_csn2.mmc1_cmd",  OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
-       {"gpmc_csn0.mmc1_sdwp", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
+       {"gpmc_csn0.gpio1_29",  OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
        {"gpmc_advn_ale.mmc1_sdcd", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
        {NULL, 0},
 };
@@ -983,6 +991,16 @@ static void uart2_init(int evm_id, int profile)
        return;
 }
 
+/* setup haptics */
+#define HAPTICS_MAX_FREQ (250)
+
+static void haptics_init(int evm_id, int profile)
+{
+       setup_pin_mux(haptics_pin_mux);
+       register_ehrpwm(HAPTICS_MAX_FREQ);
+       return;
+}
+
 /* NAND partition information */
 static struct mtd_partition am335x_nand_partitions[] = {
 /* All the partition sizes are listed in terms of NAND block size */
@@ -1099,6 +1117,194 @@ static void evm_nand_init(int evm_id, int profile)
                ARRAY_SIZE(am335x_nand_partitions), 0, 0);
 }
 
+/* TPS65217 voltage regulator support */
+
+/* 1.8V */
+static struct regulator_consumer_supply tps65217_dcdc1_consumers[] = {
+       {
+               .supply = "vdds_osc",
+       },
+       {
+               .supply = "vdds_pll_ddr",
+       },
+       {
+               .supply = "vdds_pll_mpu",
+       },
+       {
+               .supply = "vdds_pll_core_lcd",
+       },
+       {
+               .supply = "vdds_sram_mpu_bb",
+       },
+       {
+               .supply = "vdds_sram_core_bg",
+       },
+       {
+               .supply = "vdda_usb0_1p8v",
+       },
+       {
+               .supply = "vdds_ddr",
+       },
+       {
+               .supply = "vdds",
+       },
+       {
+               .supply = "vdds_hvx_1p8v",
+       },
+       {
+               .supply = "vdda_adc",
+       },
+       {
+               .supply = "ddr2",
+       },
+};
+
+/* 1.1V */
+static struct regulator_consumer_supply tps65217_dcdc2_consumers[] = {
+       {
+               .supply = "vdd_mpu",
+       },
+};
+
+/* 1.1V */
+static struct regulator_consumer_supply tps65217_dcdc3_consumers[] = {
+       {
+               .supply = "vdd_core",
+       },
+};
+
+/* 1.8V LDO */
+static struct regulator_consumer_supply tps65217_ldo1_consumers[] = {
+       {
+               .supply = "vdds_rtc",
+       },
+};
+
+/* 3.3V LDO */
+static struct regulator_consumer_supply tps65217_ldo2_consumers[] = {
+       {
+               .supply = "vdds_any_pn",
+       },
+};
+
+/* 3.3V LDO */
+static struct regulator_consumer_supply tps65217_ldo3_consumers[] = {
+       {
+               .supply = "vdds_hvx_ldo3_3p3v",
+       },
+       {
+               .supply = "vdda_usb0_3p3v",
+       },
+};
+
+/* 3.3V LDO */
+static struct regulator_consumer_supply tps65217_ldo4_consumers[] = {
+       {
+               .supply = "vdds_hvx_ldo4_3p3v",
+       },
+};
+
+static struct regulator_init_data tps65217_regulator_data[] = {
+       /* dcdc1 */
+       {
+               .constraints = {
+                       .min_uV = 900000,
+                       .max_uV = 1800000,
+                       .boot_on = 1,
+                       .always_on = 1,
+               },
+               .num_consumer_supplies = ARRAY_SIZE(tps65217_dcdc1_consumers),
+               .consumer_supplies = tps65217_dcdc1_consumers,
+       },
+
+       /* dcdc2 */
+       {
+               .constraints = {
+                       .min_uV = 900000,
+                       .max_uV = 3300000,
+                       .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+                               REGULATOR_CHANGE_STATUS),
+                       .boot_on = 1,
+                       .always_on = 1,
+               },
+               .num_consumer_supplies = ARRAY_SIZE(tps65217_dcdc2_consumers),
+               .consumer_supplies = tps65217_dcdc2_consumers,
+       },
+
+       /* dcdc3 */
+       {
+               .constraints = {
+                       .min_uV = 900000,
+                       .max_uV = 1500000,
+                       .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+                               REGULATOR_CHANGE_STATUS),
+                       .boot_on = 1,
+                       .always_on = 1,
+               },
+               .num_consumer_supplies = ARRAY_SIZE(tps65217_dcdc3_consumers),
+               .consumer_supplies = tps65217_dcdc3_consumers,
+       },
+
+       /* ldo1 */
+       {
+               .constraints = {
+                       .min_uV = 1000000,
+                       .max_uV = 3300000,
+                       .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+                       .boot_on = 1,
+                       .always_on = 1,
+               },
+               .num_consumer_supplies = ARRAY_SIZE(tps65217_ldo1_consumers),
+               .consumer_supplies = tps65217_ldo1_consumers,
+       },
+
+       /* ldo2 */
+       {
+               .constraints = {
+                       .min_uV = 900000,
+                       .max_uV = 3300000,
+                       .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+                               REGULATOR_CHANGE_STATUS),
+                       .boot_on = 1,
+                       .always_on = 1,
+               },
+               .num_consumer_supplies = ARRAY_SIZE(tps65217_ldo2_consumers),
+               .consumer_supplies = tps65217_ldo2_consumers,
+       },
+
+       /* ldo3 */
+       {
+               .constraints = {
+                       .min_uV = 1800000,
+                       .max_uV = 3300000,
+                       .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+                               REGULATOR_CHANGE_STATUS),
+                       .boot_on = 1,
+                       .always_on = 1,
+               },
+               .num_consumer_supplies = ARRAY_SIZE(tps65217_ldo3_consumers),
+               .consumer_supplies = tps65217_ldo3_consumers,
+       },
+
+       /* ldo4 */
+       {
+               .constraints = {
+                       .min_uV = 1800000,
+                       .max_uV = 3300000,
+                       .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+                               REGULATOR_CHANGE_STATUS),
+                       .boot_on = 1,
+                       .always_on = 1,
+               },
+               .num_consumer_supplies = ARRAY_SIZE(tps65217_ldo4_consumers),
+               .consumer_supplies = tps65217_ldo4_consumers,
+       },
+};
+
+static struct tps65217_board beaglebone_tps65217_info = {
+       .tps65217_init_data = &tps65217_regulator_data[0],
+};
+
 static struct lis3lv02d_platform_data lis331dlh_pdata = {
        .click_flags = LIS3_CLICK_SINGLE_X |
                        LIS3_CLICK_SINGLE_Y |
@@ -1292,6 +1498,32 @@ static void mmc0_init(int evm_id, int profile)
        return;
 }
 
+static struct i2c_board_info tps65217_i2c_boardinfo[] = {
+       {
+               I2C_BOARD_INFO("tps65217", TPS65217_I2C_ID),
+               .platform_data  = &beaglebone_tps65217_info,
+       },
+};
+
+static void tps65217_init(int evm_id, int profile)
+{
+       struct i2c_adapter *adapter;
+       struct i2c_client *client;
+
+       /* I2C1 adapter request */
+       adapter = i2c_get_adapter(1);
+       if (!adapter) {
+               pr_err("failed to get adapter i2c1\n");
+               return;
+       }
+
+       client = i2c_new_device(adapter, tps65217_i2c_boardinfo);
+       if (!client)
+               pr_err("failed to register tps65217 to i2c1\n");
+
+       i2c_put_adapter(adapter);
+}
+
 static void mmc0_no_cd_init(int evm_id, int profile)
 {
        setup_pin_mux(mmc0_no_cd_pin_mux);
@@ -1432,6 +1664,7 @@ static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
        {matrix_keypad_init, DEV_ON_DGHTR_BRD, PROFILE_0},
        {volume_keys_init,  DEV_ON_DGHTR_BRD, PROFILE_0},
        {uart2_init,    DEV_ON_DGHTR_BRD, PROFILE_3},
+       {haptics_init,  DEV_ON_DGHTR_BRD, (PROFILE_4)},
        {NULL, 0, 0},
 };
 
@@ -1476,6 +1709,7 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
 
 /* Beaglebone Rev A3 and after */
 static struct evm_dev_cfg beaglebone_dev_cfg[] = {
+       {tps65217_init, DEV_ON_BASEBOARD, PROFILE_NONE},
        {mii1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
        {usb0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
        {usb1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
@@ -1572,6 +1806,9 @@ static void setup_beaglebone(void)
 
        _configure_device(LOW_COST_EVM, beaglebone_dev_cfg, PROFILE_NONE);
 
+       /* TPS65217 regulator has full constraints */
+       regulator_has_full_constraints();
+
        /* Fill up global evmid */
        am33xx_evmid_fillup(BEAGLE_BONE_A3);
 }
@@ -1771,7 +2008,6 @@ static struct i2c_board_info __initdata am335x_i2c_boardinfo[] = {
                I2C_BOARD_INFO("tps65910", TPS65910_I2C_ID1),
                .platform_data  = &am335x_tps65910_info,
        },
-
 };
 
 static struct omap_musb_board_data musb_board_data = {
@@ -1913,9 +2149,10 @@ static void __init clkout2_enable(void)
        setup_pin_mux(clkout2_pin_mux);
 }
 
+void __iomem *am33xx_emif_base;
+
 void __iomem * __init am33xx_get_mem_ctlr(void)
 {
-       void __iomem *am33xx_emif_base;
 
        am33xx_emif_base = ioremap(AM33XX_EMIF0_BASE, SZ_32K);
 
@@ -1925,6 +2162,11 @@ void __iomem * __init am33xx_get_mem_ctlr(void)
        return am33xx_emif_base;
 }
 
+void __iomem *am33xx_get_ram_base(void)
+{
+       return am33xx_emif_base;
+}
+
 static struct resource am33xx_cpuidle_resources[] = {
        {
                .start          = AM33XX_EMIF0_BASE,
@@ -1974,10 +2216,12 @@ static void __init am335x_evm_init(void)
        omap_board_config_size = ARRAY_SIZE(am335x_evm_config);
        /* Create an alias for icss clock */
        if (clk_add_alias("pruss", NULL, "icss_uart_gclk", NULL))
-               pr_err("failed to create an alias: icss_uart_gclk --> pruss\n");
+               pr_warn("failed to create an alias: icss_uart_gclk --> pruss\n");
+       if (clk_add_alias("pruss", NULL, "icss_fck", NULL))
+               pr_warn("failed to create an alias: icss_fck --> pruss\n");
        /* Create an alias for gfx/sgx clock */
        if (clk_add_alias("sgx_ck", NULL, "gfx_fclk", NULL))
-               pr_err("failed to create an alias: gfx_fclk --> sgx_ck\n");
+               pr_warn("failed to create an alias: gfx_fclk --> sgx_ck\n");
 }
 
 static void __init am335x_evm_map_io(void)