| /* |
| * OMAP4 OPP table definitions. |
| * |
| * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/ |
| * Nishanth Menon |
| * Kevin Hilman |
| * Thara Gopinath |
| * Copyright (C) 2010-2011 Nokia Corporation. |
| * Eduardo Valentin |
| * Paul Walmsley |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License version 2 as |
| * published by the Free Software Foundation. |
| * |
| * This program is distributed "as is" WITHOUT ANY WARRANTY of any |
| * kind, whether express or implied; without even the implied warranty |
| * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| */ |
| #include <linux/module.h> |
| #include <linux/opp.h> |
| |
| #include <plat/cpu.h> |
| #include <plat/omap_device.h> |
| |
| #include "control.h" |
| #include "omap_opp_data.h" |
| #include "pm.h" |
| |
| /* |
| * Structures containing OMAP4430 voltage supported and various |
| * voltage dependent data for each VDD. |
| */ |
| |
| #define OMAP4430_VDD_MPU_OPP50_UV 1025000 |
| #define OMAP4430_VDD_MPU_OPP100_UV 1200000 |
| #define OMAP4430_VDD_MPU_OPPTURBO_UV 1313000 |
| #define OMAP4430_VDD_MPU_OPPNITRO_UV 1375000 |
| |
| struct omap_volt_data omap443x_vdd_mpu_volt_data[] = { |
| VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c), |
| VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16), |
| VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23), |
| VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27), |
| VOLT_DATA_DEFINE(0, 0, 0, 0), |
| }; |
| |
| #define OMAP4430_VDD_IVA_OPP50_UV 1013000 |
| #define OMAP4430_VDD_IVA_OPP100_UV 1188000 |
| #define OMAP4430_VDD_IVA_OPPTURBO_UV 1300000 |
| |
| struct omap_volt_data omap443x_vdd_iva_volt_data[] = { |
| VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16), |
| VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23), |
| VOLT_DATA_DEFINE(0, 0, 0, 0), |
| }; |
| |
| #define OMAP4430_VDD_CORE_OPP50_UV 1025000 |
| #define OMAP4430_VDD_CORE_OPP100_UV 1200000 |
| |
| struct omap_volt_data omap443x_vdd_core_volt_data[] = { |
| VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16), |
| VOLT_DATA_DEFINE(0, 0, 0, 0), |
| }; |
| |
| /* Dependency of domains are as follows for OMAP4430 (OPP based): |
| * |
| * MPU IVA CORE |
| * 50 50 50+ |
| * 50 100+ 100 |
| * 100+ 50 100 |
| * 100+ 100+ 100 |
| */ |
| |
| /* OMAP 4430 MPU Core VDD dependency table */ |
| static struct omap_vdd_dep_volt omap443x_vdd_mpu_core_dep_data[] = { |
| {.main_vdd_volt = OMAP4430_VDD_MPU_OPP50_UV, .dep_vdd_volt = OMAP4430_VDD_CORE_OPP100_UV}, |
| {.main_vdd_volt = OMAP4430_VDD_MPU_OPP100_UV, .dep_vdd_volt = OMAP4430_VDD_CORE_OPP100_UV}, |
| {.main_vdd_volt = OMAP4430_VDD_MPU_OPPTURBO_UV, .dep_vdd_volt = OMAP4430_VDD_CORE_OPP100_UV}, |
| {.main_vdd_volt = OMAP4430_VDD_MPU_OPPNITRO_UV, .dep_vdd_volt = OMAP4430_VDD_CORE_OPP100_UV}, |
| }; |
| |
| struct omap_vdd_dep_info omap443x_vddmpu_dep_info[] = { |
| { |
| .name = "core", |
| .dep_table = omap443x_vdd_mpu_core_dep_data, |
| .nr_dep_entries = ARRAY_SIZE(omap443x_vdd_mpu_core_dep_data), |
| }, |
| {.name = NULL, .dep_table = NULL, .nr_dep_entries = 0}, |
| }; |
| |
| /* OMAP 4430 MPU IVA VDD dependency table */ |
| static struct omap_vdd_dep_volt omap443x_vdd_iva_core_dep_data[] = { |
| {.main_vdd_volt = OMAP4430_VDD_IVA_OPP100_UV, .dep_vdd_volt = OMAP4430_VDD_CORE_OPP100_UV}, |
| {.main_vdd_volt = OMAP4430_VDD_IVA_OPPTURBO_UV, .dep_vdd_volt = OMAP4430_VDD_CORE_OPP100_UV}, |
| }; |
| |
| struct omap_vdd_dep_info omap443x_vddiva_dep_info[] = { |
| { |
| .name = "core", |
| .dep_table = omap443x_vdd_iva_core_dep_data, |
| .nr_dep_entries = ARRAY_SIZE(omap443x_vdd_iva_core_dep_data), |
| }, |
| {.name = NULL, .dep_table = NULL, .nr_dep_entries = 0}, |
| }; |
| |
| static struct omap_opp_def __initdata omap443x_opp_def_list[] = { |
| /* MPU OPP1 - OPP50 */ |
| OPP_INITIALIZER("mpu", "dpll_mpu_ck", "mpu", true, 300000000, OMAP4430_VDD_MPU_OPP50_UV), |
| /* MPU OPP2 - OPP100 */ |
| OPP_INITIALIZER("mpu", "dpll_mpu_ck", "mpu", true, 600000000, OMAP4430_VDD_MPU_OPP100_UV), |
| /* MPU OPP3 - OPP-Turbo */ |
| OPP_INITIALIZER("mpu", "dpll_mpu_ck", "mpu", true, 800000000, OMAP4430_VDD_MPU_OPPTURBO_UV), |
| /* MPU OPP4 - OPP-SB */ |
| OPP_INITIALIZER("mpu", "dpll_mpu_ck", "mpu", true, 1008000000, OMAP4430_VDD_MPU_OPPNITRO_UV), |
| /* L3 OPP2 - OPP100, OPP-Turbo, OPP-SB */ |
| OPP_INITIALIZER("l3_main_1", "dpll_core_m5x2_ck", "core", true, 400000000, OMAP4430_VDD_CORE_OPP100_UV), |
| /* IVA OPP2 - OPP100 */ |
| OPP_INITIALIZER("iva", "dpll_iva_m5x2_ck", "iva", true, 266100000, OMAP4430_VDD_IVA_OPP100_UV), |
| /* IVA OPP3 - OPP-Turbo */ |
| OPP_INITIALIZER("iva", "dpll_iva_m5x2_ck", "iva", false, 332000000, OMAP4430_VDD_IVA_OPPTURBO_UV), |
| /* SGX OPP1 - OPP50 */ |
| OPP_INITIALIZER("gpu", "dpll_per_m7x2_ck", "core", true, 153600000, OMAP4430_VDD_CORE_OPP50_UV), |
| /* SGX OPP2 - OPP100 */ |
| OPP_INITIALIZER("gpu", "dpll_per_m7x2_ck", "core", true, 307200000, OMAP4430_VDD_CORE_OPP100_UV), |
| /* ABE OPP1 - OPP50 */ |
| OPP_INITIALIZER("aess", "dpll_abe_x2_ck", "iva", true, 98304000, OMAP4430_VDD_IVA_OPP50_UV), |
| /* ABE OPP2 - OPP100 */ |
| OPP_INITIALIZER("aess", "dpll_abe_x2_ck", "iva", true, 196608000, OMAP4430_VDD_IVA_OPP100_UV), |
| /* TODO: add DSP, fdif, gpu */ |
| }; |
| |
| #define OMAP4460_VDD_MPU_OPP50_UV 1025000 |
| #define OMAP4460_VDD_MPU_OPP100_UV 1200000 |
| #define OMAP4460_VDD_MPU_OPPTURBO_UV 1313000 |
| #define OMAP4460_VDD_MPU_OPPNITRO_UV 1375000 |
| |
| struct omap_volt_data omap446x_vdd_mpu_volt_data[] = { |
| VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c), |
| VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16), |
| VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23), |
| VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27), |
| VOLT_DATA_DEFINE(0, 0, 0, 0), |
| }; |
| |
| #define OMAP4460_VDD_IVA_OPP50_UV 1025000 |
| #define OMAP4460_VDD_IVA_OPP100_UV 1200000 |
| #define OMAP4460_VDD_IVA_OPPTURBO_UV 1313000 |
| #define OMAP4460_VDD_IVA_OPPNITRO_UV 1375000 |
| |
| struct omap_volt_data omap446x_vdd_iva_volt_data[] = { |
| VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16), |
| VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23), |
| VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPNITRO, 0xfa, 0x23), |
| VOLT_DATA_DEFINE(0, 0, 0, 0), |
| }; |
| |
| #define OMAP4460_VDD_CORE_OPP50_UV 1025000 |
| #define OMAP4460_VDD_CORE_OPP100_UV 1200000 |
| #define OMAP4460_VDD_CORE_OPP100_OV_UV 1250000 |
| |
| struct omap_volt_data omap446x_vdd_core_volt_data[] = { |
| VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16), |
| VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_OV_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100OV, 0xf9, 0x16), |
| VOLT_DATA_DEFINE(0, 0, 0, 0), |
| }; |
| |
| /* OMAP 4460 MPU Core VDD dependency table */ |
| static struct omap_vdd_dep_volt omap446x_vdd_mpu_core_dep_data[] = { |
| {.main_vdd_volt = OMAP4460_VDD_MPU_OPP50_UV, .dep_vdd_volt = OMAP4460_VDD_CORE_OPP100_UV}, |
| {.main_vdd_volt = OMAP4460_VDD_MPU_OPP100_UV, .dep_vdd_volt = OMAP4460_VDD_CORE_OPP100_UV}, |
| {.main_vdd_volt = OMAP4460_VDD_MPU_OPPTURBO_UV, .dep_vdd_volt = OMAP4460_VDD_CORE_OPP100_UV}, |
| {.main_vdd_volt = OMAP4460_VDD_MPU_OPPNITRO_UV, .dep_vdd_volt = OMAP4460_VDD_CORE_OPP100_UV}, |
| }; |
| |
| struct omap_vdd_dep_info omap446x_vddmpu_dep_info[] = { |
| { |
| .name = "core", |
| .dep_table = omap446x_vdd_mpu_core_dep_data, |
| .nr_dep_entries = ARRAY_SIZE(omap446x_vdd_mpu_core_dep_data), |
| }, |
| {.name = NULL, .dep_table = NULL, .nr_dep_entries = 0}, |
| }; |
| |
| /* OMAP 4460 MPU IVA VDD dependency table */ |
| static struct omap_vdd_dep_volt omap446x_vdd_iva_core_dep_data[] = { |
| {.main_vdd_volt = OMAP4460_VDD_IVA_OPP100_UV, .dep_vdd_volt = OMAP4460_VDD_CORE_OPP100_UV}, |
| {.main_vdd_volt = OMAP4460_VDD_IVA_OPPTURBO_UV, .dep_vdd_volt = OMAP4460_VDD_CORE_OPP100_UV}, |
| }; |
| |
| struct omap_vdd_dep_info omap446x_vddiva_dep_info[] = { |
| { |
| .name = "core", |
| .dep_table = omap446x_vdd_iva_core_dep_data, |
| .nr_dep_entries = ARRAY_SIZE(omap446x_vdd_iva_core_dep_data), |
| }, |
| {.name = NULL, .dep_table = NULL, .nr_dep_entries = 0}, |
| }; |
| |
| static struct omap_opp_def __initdata omap446x_opp_def_list[] = { |
| /* MPU OPP1 - OPP50 */ |
| OPP_INITIALIZER("mpu", "virt_dpll_mpu_ck", "mpu", true, 350000000, OMAP4460_VDD_MPU_OPP50_UV), |
| /* MPU OPP2 - OPP100 */ |
| OPP_INITIALIZER("mpu", "virt_dpll_mpu_ck", "mpu", true, 700000000, OMAP4460_VDD_MPU_OPP100_UV), |
| /* MPU OPP3 - OPP-Turbo */ |
| OPP_INITIALIZER("mpu", "virt_dpll_mpu_ck", "mpu", true, 920000000, OMAP4460_VDD_MPU_OPPTURBO_UV), |
| /* |
| * MPU OPP4 - OPP-Nitro + Disabled as the reference schematics |
| * recommends TPS623631 - confirm and enable the opp in board file |
| * XXX: May be we should enable these based on mpu capability and |
| * Exception board files disable it... |
| */ |
| OPP_INITIALIZER("mpu", "virt_dpll_mpu_ck", "mpu", false, 1200000000, OMAP4460_VDD_MPU_OPPNITRO_UV), |
| /* MPU OPP4 - OPP-Nitro SpeedBin */ |
| OPP_INITIALIZER("mpu", "virt_dpll_mpu_ck", "mpu", false, 1500000000, OMAP4460_VDD_MPU_OPPNITRO_UV), |
| /* L3 OPP2 - OPP100 */ |
| OPP_INITIALIZER("l3_main_1", "dpll_core_m5x2_ck", "core", true, 400000000, OMAP4460_VDD_CORE_OPP100_UV), |
| /* IVA OPP1 - OPP50 */ |
| OPP_INITIALIZER("iva", "dpll_iva_m5x2_ck", "iva", true, 266100000, OMAP4460_VDD_IVA_OPP100_UV), |
| /* |
| * IVA OPP3 - OPP-Turbo + Disabled as the reference schematics |
| * recommends Phoenix VCORE2 which can supply only 600mA - so the ones |
| * above this OPP frequency, even though OMAP is capable, should be |
| * enabled by board file which is sure of the chip power capability |
| */ |
| OPP_INITIALIZER("iva", "dpll_iva_m5x2_ck", "iva", false, 332000000, OMAP4460_VDD_IVA_OPPTURBO_UV), |
| /* IVA OPP4 - OPP-Nitro */ |
| OPP_INITIALIZER("iva", "dpll_iva_m5x2_ck", "iva", false, 430000000, OMAP4460_VDD_IVA_OPPNITRO_UV), |
| /* IVA OPP5 - OPP-Nitro SpeedBin*/ |
| OPP_INITIALIZER("iva", "dpll_iva_m5x2_ck", "iva", false, 500000000, OMAP4460_VDD_IVA_OPPNITRO_UV), |
| |
| /* ABE OPP1 - OPP50 */ |
| OPP_INITIALIZER("aess", "dpll_abe_x2_ck", "iva", true, 98304000, OMAP4460_VDD_IVA_OPP50_UV), |
| /* ABE OPP2 - OPP100 */ |
| // OPP_INITIALIZER("aess", "dpll_abe_x2_ck", "iva", true, 196608000, OMAP4460_VDD_IVA_OPP100_UV), |
| /* SGX OPP1 - OPP50 */ |
| OPP_INITIALIZER("gpu", "dpll_per_m7x2_ck", "core", true, 153600000, OMAP4460_VDD_CORE_OPP50_UV), |
| /* SGX OPP2 - OPP100 */ |
| OPP_INITIALIZER("gpu", "dpll_per_m7x2_ck", "core", true, 307200000, OMAP4460_VDD_CORE_OPP100_UV), |
| /* SGX OPP3 - OPPOV */ |
| OPP_INITIALIZER("gpu", "dpll_per_m7x2_ck", "core", false, 384000000, OMAP4460_VDD_CORE_OPP100_OV_UV), |
| |
| /* TODO: add DSP, aess, fdif */ |
| }; |
| |
| |
| /** |
| * omap4_opp_enable() - Enable the OPP corresponding to freq |
| * |
| */ |
| static int __init omap4_opp_enable(unsigned long freq) |
| { |
| int r = -ENODEV; |
| struct omap_hwmod *oh_mpu = omap_hwmod_lookup("mpu"); |
| struct platform_device *pdev; |
| |
| if (!oh_mpu || !oh_mpu->od) { |
| goto err; |
| } else { |
| pdev = oh_mpu->od->pdev; |
| |
| if (!pdev) { |
| pr_err("omap4_opp_enable: mpu pdev is null\n"); |
| return -EINVAL; |
| } |
| |
| r = opp_enable(&pdev->dev, freq); |
| if (r < 0) { |
| pr_err("opp_enable failed for mpu@%ld\n", freq); |
| goto err; |
| } |
| } |
| err: |
| return r; |
| } |
| |
| /** |
| * omap4_opp_init() - initialize omap4 opp table |
| */ |
| int __init omap4_opp_init(void) |
| { |
| int r = -ENODEV; |
| |
| if (!cpu_is_omap44xx()) |
| return r; |
| if (cpu_is_omap443x()){ |
| r = omap_init_opp_table(omap443x_opp_def_list, |
| ARRAY_SIZE(omap443x_opp_def_list)); |
| } else if (cpu_is_omap446x()) { |
| r = omap_init_opp_table(omap446x_opp_def_list, |
| ARRAY_SIZE(omap446x_opp_def_list)); |
| if (omap4_has_mpu_1_5ghz()) |
| omap4_opp_enable(1500000000); |
| if (omap4_has_mpu_1_2ghz()) |
| omap4_opp_enable(1200000000); |
| } |
| return r; |
| } |
| device_initcall(omap4_opp_init); |