Skip to content

Commit

Permalink
[AM335X][MODULE] Support for show pwst command
Browse files Browse the repository at this point in the history
Update AM335X modules with the appropriate powerdm and clkdm. Add
additional modules to print. Update AM335X clocks for new GFX module.
Update common module status show function to adjust for the AM335X.
Move a line due to remove a printed line to console for VDD_RTC. Add
skip for CEFUSE clkdm. Update AM335X main to call the module status
show function. Update logic to print standby status.

Signed-off-by: Gilberto Rodriguez <gilrod@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
  • Loading branch information
gilbert-r3 authored and nmenon committed Aug 13, 2014
1 parent 7e33801 commit 9c7f242
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 20 deletions.
7 changes: 7 additions & 0 deletions arch/arm/mach-omap/am335x/help_am335x.c
Expand Up @@ -105,4 +105,11 @@ void help_am335x(help_category cat, char *context)
"(voltage, frequency for MPU/CORE voltage domains), "
"including main modules frequencies.\n");
}

if ((cat == HELP_ALL) || (cat == HELP_SOC_PWST)) {
printf("\n\tomapconf show pwst\n");
printf("\t Print AM335X power status (OPP, voltage/power/"
"clock domains states, modules frequency and "
"status).\n");
}
}
6 changes: 6 additions & 0 deletions arch/arm/mach-omap/am335x/main_am335x.c
Expand Up @@ -50,6 +50,7 @@
#include <help.h>
#include <lib.h>
#include <main_am335x.h>
#include <module.h>
#include <opp.h>
#include <prcm_am335x.h>
#include <stdio.h>
Expand Down Expand Up @@ -220,6 +221,11 @@ int main_am335x_show(int argc, char *argv[])
return opp_show(stdout);
else
return err_arg_too_many_msg_show(HELP_SOC_OPP);
} else if (strcmp(argv[0], "pwst") == 0) {
if (argc == 1)
return module_status_show(stdout);
else
return err_arg_too_many_msg_show(HELP_SOC_PWST);
} else {
return err_unknown_argument_msg_show(argv[0]);
}
Expand Down
38 changes: 38 additions & 0 deletions arch/arm/mach-omap/am335x/prcm/clock_am335x.c
Expand Up @@ -114,6 +114,10 @@ static const char
/* DPLL DDR OUTPUT CLKS */
[CLK_AM335X_DDR_CLKOUTM2] = "DDR_CLKOUTM2",
[CLK_AM335X_EMIF_M_CLK] = "EMIF_M_CLK",
/* GFX CLKS */
[CLK_AM335X_GFX_SYSCLK] = "GFX_SYSCLK",
[CLK_AM335X_GFX_MEMCLK] = "GFX_MEMCLK",
[CLK_AM335X_GFX_CORECLK] = "GFX_CORECLK",
[CLK_AM335X_ID_MAX] = "FIXME" };

typedef enum {
Expand Down Expand Up @@ -570,6 +574,40 @@ double clk_am335x_rate_get(clk_am335x_id clk_id,
out_clk_speed);
return out_clk_speed;

case CLK_AM335X_GFX_SYSCLK:
src_clk_id = CLK_AM335X_CORE_CLKOUTM4;
src_clk_speed = clk_am335x_rate_get(src_clk_id, ignore);
out_clk_speed = src_clk_speed / 2;
DPRINT_CLK_SPEED2(clk_id, src_clk_id, src_clk_speed,
out_clk_speed);
return out_clk_speed;

case CLK_AM335X_GFX_MEMCLK:
src_clk_id = CLK_AM335X_CORE_CLKOUTM4;
src_clk_speed = clk_am335x_rate_get(src_clk_id, ignore);
out_clk_speed = src_clk_speed / 2;
DPRINT_CLK_SPEED2(clk_id, src_clk_id, src_clk_speed,
out_clk_speed);
return out_clk_speed;

case CLK_AM335X_GFX_CORECLK:
reg_val = reg_read(&am335x_clksel_gfx_fclk);
if (extract_bit(reg_val, 1))
src_clk_id = CLK_AM335X_PER_CLKOUTM2;
else
src_clk_id = CLK_AM335X_CORE_CLKOUTM4;

src_clk_speed = clk_am335x_rate_get(src_clk_id, ignore);
if (extract_bit(reg_val, 0))
div = 2;
else
div = 1;

out_clk_speed = src_clk_speed / div;
DPRINT_CLK_SPEED3(clk_id, src_clk_id, src_clk_speed, div,
out_clk_speed);
return out_clk_speed;

case CLK_AM335X_ID_MAX:
out_clk_speed = 0;
DPRINT_CLK_SPEED1(clk_id, out_clk_speed);
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-omap/am335x/prcm/clock_am335x.h
Expand Up @@ -91,6 +91,10 @@ typedef enum {
/* DPLL DDR OUTPUT CLKS */
CLK_AM335X_DDR_CLKOUTM2,
CLK_AM335X_EMIF_M_CLK,
/* GFX CLKS */
CLK_AM335X_GFX_SYSCLK,
CLK_AM335X_GFX_MEMCLK,
CLK_AM335X_GFX_CORECLK,
/* OTHER */
CLK_AM335X_ID_MAX
} clk_am335x_id;
Expand Down
135 changes: 120 additions & 15 deletions arch/arm/mach-omap/am335x/prcm/module_am335x.c
Expand Up @@ -69,7 +69,7 @@ genlist mod_am335x_list;


/* ------------------------------------------------------------------------*//**
* @FUNCTION mod_dra7xx_init
* @FUNCTION mod_am335x_init
* @BRIEF initialize internal data
* @DESCRIPTION initialize internal data (architecture dependent)
*//*------------------------------------------------------------------------ */
Expand All @@ -86,8 +86,8 @@ void mod_am335x_init(void)
/* Voltage dom.: CORE, Power dom.: PD_PER, Clock domain = PER_L3S */
mod.name = MOD_L3_MAIN1_INTERCONNECT;
mod.id = (int) AM335X_L3S;
mod.clkdm = NULL; /* TBD */
mod.pwrdm = NULL; /* TBD */
mod.clkdm = CLKDM_PER_L3S;
mod.pwrdm = PWRDM_PER;
mod.voltdm = VDD_CORE;
mod.clk = (int) CLK_AM335X_L3S_CLK;
mod.sysconfig = NULL;
Expand Down Expand Up @@ -121,8 +121,8 @@ void mod_am335x_init(void)
/* Voltage dom.: CORE, Power dom.: PD_PER, Clock domain = PER_L3 */
mod.name = MOD_L3_MAIN2_INTERCONNECT;
mod.id = (int) AM335X_L3F;
mod.clkdm = NULL; /* TBD */
mod.pwrdm = NULL; /* TBD */
mod.clkdm = CLKDM_PER_L3;
mod.pwrdm = PWRDM_PER;
mod.voltdm = VDD_CORE;
mod.clk = (int) CLK_AM335X_L3F_CLK;
mod.sysconfig = NULL;
Expand Down Expand Up @@ -155,8 +155,8 @@ void mod_am335x_init(void)

mod.name = MOD_EMIF4;
mod.id = (int) AM335X_EMIF4;
mod.clkdm = NULL; /* TBD */
mod.pwrdm = NULL; /* TBD */
mod.clkdm = CLKDM_PER_L3;
mod.pwrdm = PWRDM_PER;
mod.voltdm = VDD_CORE;
mod.clk = (int) CLK_AM335X_EMIF_M_CLK;
mod.sysconfig = NULL;
Expand Down Expand Up @@ -189,8 +189,8 @@ void mod_am335x_init(void)

mod.name = MOD_PHY_EMIF;
mod.id = (int) AM335X_DDR_PHY;
mod.clkdm = NULL; /* TBD */
mod.pwrdm = NULL; /* TBD */
mod.clkdm = CLKDM_PER_L3;
mod.pwrdm = PWRDM_PER;
mod.voltdm = VDD_CORE;
mod.clk = (int) CLK_AM335X_DDR_CLKOUTM2;
mod.sysconfig = NULL;
Expand Down Expand Up @@ -224,8 +224,8 @@ void mod_am335x_init(void)
/* Voltage dom.: CORE, Power dom.: PD_PER, Clock domain = PER_L4LS */
mod.name = MOD_L4_PER_INTERCONNECT;
mod.id = (int) AM335X_L4_PER;
mod.clkdm = NULL; /* TBD */
mod.pwrdm = NULL; /* TBD */
mod.clkdm = CLKDM_PER_L4LS;
mod.pwrdm = PWRDM_PER;
mod.voltdm = VDD_CORE;
mod.clk = (int) CLK_AM335X_L4_PER_CLK;
mod.sysconfig = NULL;
Expand Down Expand Up @@ -259,8 +259,8 @@ void mod_am335x_init(void)
/* Voltage dom.: CORE, Power dom.: PD_PER, Clock domain = PER_L4HS */
mod.name = MOD_L4_FAST_INTERCONNECT;
mod.id = (int) AM335X_L4_FAST;
mod.clkdm = NULL; /* TBD */
mod.pwrdm = NULL; /* TBD */
mod.clkdm = CLKDM_PER_L4HS;
mod.pwrdm = PWRDM_PER;
mod.voltdm = VDD_CORE;
mod.clk = (int) CLK_AM335X_L4F_CLK;
mod.sysconfig = NULL;
Expand Down Expand Up @@ -291,11 +291,116 @@ void mod_am335x_init(void)
mod.properties = 0; /* TBD */
genlist_addtail(&mod_am335x_list, (void *) & mod, sizeof(mod_info));

/* Voltage dom.: CORE, Power dom.: PD_WKUP, Clock domain = WKUP */
mod.name = MOD_L4_WKUP_INTERCONNECT;
mod.id = (int) AM335X_L4_WKUP;
mod.clkdm = CLKDM_WKUP;
mod.pwrdm = PWRDM_WKUP;
mod.voltdm = VDD_CORE;
mod.clk = (int) CLK_AM335X_L4_WKUPCLK;
mod.sysconfig = NULL;
mod.clkctrl = &am335x_cm_wkup_l4wkup_clkctrl;
mod.context = NULL;
genlist_init(&(mod.mod_opp_list));
opp.name = OPP_50;
opp.rate = 50000;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_100;
opp.rate = 100000;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_100_LOW;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_100_HIGH;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_120;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_TURBO;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_NITRO;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
mod.properties = 0;
genlist_addtail(&mod_am335x_list, (void *) & mod, sizeof(mod_info));

/* Voltage dom.: CORE, Power dom.: PD_WKUP, Clock domain = WKUP_L3_AON */
mod.name = MOD_DEBUGSS;
mod.id = (int) AM335X_DEBUGSS;
mod.clkdm = CLKDM_WKUP_L3_AON;
mod.pwrdm = PWRDM_WKUP;
mod.voltdm = VDD_CORE;
mod.clk = (int) CLK_AM335X_DEBUGSS_CLKA;
mod.sysconfig = NULL;
mod.clkctrl = &am335x_cm_wkup_debugss_clkctrl;
mod.context = NULL;
genlist_init(&(mod.mod_opp_list));
opp.name = OPP_50;
opp.rate = 100000;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_100;
opp.rate = 200000;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_100_LOW;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_100_HIGH;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_120;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_TURBO;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_NITRO;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
mod.properties = MOD_HAS_STANDBY_STATUS;
genlist_addtail(&mod_am335x_list, (void *) & mod, sizeof(mod_info));

/* Voltage dom.: CORE, Power dom.: PD_GFX, Clock domain = GFX_L3 */
mod.name = MOD_GFX;
mod.id = (int) AM335X_SGX530;
mod.clkdm = CLKDM_GFX_L3;
mod.pwrdm = PWRDM_GFX;
mod.voltdm = VDD_CORE;
mod.clk = (int) CLK_AM335X_GFX_SYSCLK;
mod.sysconfig = NULL;
mod.clkctrl = &am335x_cm_gfx_gfx_clkctrl;
mod.context = NULL;
genlist_init(&(mod.mod_opp_list));
opp.name = OPP_50;
opp.rate = 100000;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_100;
opp.rate = 200000;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_100_LOW;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_100_HIGH;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_120;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_TURBO;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
opp.name = OPP_NITRO;
opp.rate = -1;
genlist_addtail(&(mod.mod_opp_list), (void *) &opp, sizeof(mod_opp));
mod.properties = MOD_HAS_STANDBY_STATUS;
genlist_addtail(&mod_am335x_list, (void *) & mod, sizeof(mod_info));

/* Voltage dom.: MPU, Power dom.: PD_MPU, Clock domain = MPU */
mod.name = MOD_MPU;
mod.id = (int) AM335X_MPU;
mod.clkdm = NULL; /* TBD */
mod.pwrdm = NULL; /* TBD */
mod.clkdm = CLKDM_MPU;
mod.pwrdm = PWRDM_MPU;
mod.voltdm = VDD_MPU;
mod.clk = (int) CLK_AM335X_MPU_CLK;
mod.sysconfig = NULL;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap/am335x/prcm/module_am335x.h
Expand Up @@ -63,7 +63,7 @@ typedef enum {
AM335X_SMARTREFLEX_C2_1,
AM335X_WDT1,
/* Voltage dom.: CORE, Power dom.: PD_WKUP, Clock domain = WKUP_L3_AON */
AM335X_DEBUGS,
AM335X_DEBUGSS,
/* Voltage dom.: CORE, Power dom.: PD_WKUP, Clock domain = UNKNOWN */
AM335X_WKUP_M3,
AM335X_PRCM,
Expand Down
14 changes: 10 additions & 4 deletions arch/arm/mach-omap/common/module.c
Expand Up @@ -1322,11 +1322,14 @@ int module_status_show(FILE *stream)
"| Name | OPP | Name | Curr. | Target | Name | Status | Name | Rate (MHz) | Idle | Standby |\n");
/* For each domain, retrieve the clock & power domain status */
for (v = 0; v < voltdm_count; v++) {
fprintf(stream,
"|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n");
genlist_get((genlist *) voltdm_list, v, (void *) &voltdm);

opp = opp_get(voltdm.name, 1);

if (strcmp(voltdm.name, "VDD_RTC") == 0)
continue;
fprintf(stream,
"|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n");
if (opp != NULL)
strncpy(s_current_opp, opp, OPP_MAX_NAME_LENGTH);
else
Expand All @@ -1352,6 +1355,8 @@ int module_status_show(FILE *stream)
continue;
else if (strcmp(pwrdm.name, "CUSTEFUSE") == 0)
continue;
else if (strcmp(pwrdm.name, "CEFUSE") == 0)
continue;

*s_pwst = '\0';
pwst = powerdm_state_get(pwrdm.name,
Expand Down Expand Up @@ -1403,9 +1408,10 @@ int module_status_show(FILE *stream)

idlest = module_idle_status_get(
mod.name);
if (idlest != MOD_IDLE_STATUS_MAX) {
if (idlest != MOD_IDLE_STATUS_MAX)
strcpy(s_idlest, mod_idle_status_name_get(idlest));
} else if (idlest != MOD_DISABLED) {

if (idlest < MOD_DISABLED) {
stbyst = module_standby_status_get(mod.name);
if (stbyst != MOD_STANDBY_STATUS_MAX)
strcpy(s_stbyst, mod_standby_status_name_get(stbyst));
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-omap/common/module.h
Expand Up @@ -58,6 +58,7 @@
#define MOD_DSP_WUGEN ((const char *) "DSP_WUGEN")
#define MOD_GPU ((const char *) "GPU")
#define MOD_SGX ((const char *) "SGX")
#define MOD_GFX ((const char *) "GFX")
#define MOD_IVA ((const char *) "IVA")
#define MOD_SL2 ((const char *) "SL2")
#define MOD_MPU ((const char *) "MPU")
Expand Down

0 comments on commit 9c7f242

Please sign in to comment.