memory: omap-gpmc: Add Kconfig option for debug

We support decoding the bootloader values if DEBUG is defined.
But we also need to change the struct omap_hwmod flags to have
HWMOD_INIT_NO_RESET to avoid the GPMC being reset during the
boot. Otherwise just the default timings will be displayed
instead of the bootloader configured timings.

This also allows us to clean up the various GPMC related
hwmod flags. For debugging, we only need HWMOD_INIT_NO_RESET,
and HWMOD_INIT_NO_IDLE is not needed.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Roger Quadros <rogerq@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
This commit is contained in:
Tony Lindgren 2015-06-01 19:22:10 -06:00 committed by Paul Walmsley
parent e26081808e
commit 63aa945b10
9 changed files with 29 additions and 35 deletions

View File

@ -109,6 +109,12 @@ extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type3;
#define DEBUG_OMAPUART_FLAGS (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET) #define DEBUG_OMAPUART_FLAGS (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET)
#ifdef CONFIG_OMAP_GPMC_DEBUG
#define DEBUG_OMAP_GPMC_HWMOD_FLAGS HWMOD_INIT_NO_RESET
#else
#define DEBUG_OMAP_GPMC_HWMOD_FLAGS 0
#endif
#if defined(CONFIG_DEBUG_OMAP2UART1) #if defined(CONFIG_DEBUG_OMAP2UART1)
#undef DEBUG_OMAP2UART1_FLAGS #undef DEBUG_OMAP2UART1_FLAGS
#define DEBUG_OMAP2UART1_FLAGS DEBUG_OMAPUART_FLAGS #define DEBUG_OMAP2UART1_FLAGS DEBUG_OMAPUART_FLAGS

View File

@ -762,16 +762,8 @@ struct omap_hwmod omap2xxx_gpmc_hwmod = {
.name = "gpmc", .name = "gpmc",
.class = &omap2xxx_gpmc_hwmod_class, .class = &omap2xxx_gpmc_hwmod_class,
.main_clk = "gpmc_fck", .main_clk = "gpmc_fck",
/* /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */
* XXX HWMOD_INIT_NO_RESET should not be needed for this IP .flags = HWMOD_NO_IDLEST | DEBUG_OMAP_GPMC_HWMOD_FLAGS,
* block. It is not being added due to any known bugs with
* resetting the GPMC IP block, but rather because any timings
* set by the bootloader are not being correctly programmed by
* the kernel from the board file or DT data.
* HWMOD_INIT_NO_RESET should be removed ASAP.
*/
.flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET |
HWMOD_NO_IDLEST),
.prcm = { .prcm = {
.omap2 = { .omap2 = {
.prcm_reg_id = 3, .prcm_reg_id = 3,

View File

@ -668,7 +668,8 @@ struct omap_hwmod am33xx_gpmc_hwmod = {
.name = "gpmc", .name = "gpmc",
.class = &am33xx_gpmc_hwmod_class, .class = &am33xx_gpmc_hwmod_class,
.clkdm_name = "l3s_clkdm", .clkdm_name = "l3s_clkdm",
.flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET), /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */
.flags = DEBUG_OMAP_GPMC_HWMOD_FLAGS,
.main_clk = "l3s_gclk", .main_clk = "l3s_gclk",
.prcm = { .prcm = {
.omap4 = { .omap4 = {

View File

@ -2169,16 +2169,8 @@ static struct omap_hwmod omap3xxx_gpmc_hwmod = {
.clkdm_name = "core_l3_clkdm", .clkdm_name = "core_l3_clkdm",
.mpu_irqs = omap3xxx_gpmc_irqs, .mpu_irqs = omap3xxx_gpmc_irqs,
.main_clk = "gpmc_fck", .main_clk = "gpmc_fck",
/* /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */
* XXX HWMOD_INIT_NO_RESET should not be needed for this IP .flags = HWMOD_NO_IDLEST | DEBUG_OMAP_GPMC_HWMOD_FLAGS,
* block. It is not being added due to any known bugs with
* resetting the GPMC IP block, but rather because any timings
* set by the bootloader are not being correctly programmed by
* the kernel from the board file or DT data.
* HWMOD_INIT_NO_RESET should be removed ASAP.
*/
.flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET |
HWMOD_NO_IDLEST),
}; };
/* /*

View File

@ -1188,15 +1188,8 @@ static struct omap_hwmod omap44xx_gpmc_hwmod = {
.name = "gpmc", .name = "gpmc",
.class = &omap44xx_gpmc_hwmod_class, .class = &omap44xx_gpmc_hwmod_class,
.clkdm_name = "l3_2_clkdm", .clkdm_name = "l3_2_clkdm",
/* /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */
* XXX HWMOD_INIT_NO_RESET should not be needed for this IP .flags = DEBUG_OMAP_GPMC_HWMOD_FLAGS,
* block. It is not being added due to any known bugs with
* resetting the GPMC IP block, but rather because any timings
* set by the bootloader are not being correctly programmed by
* the kernel from the board file or DT data.
* HWMOD_INIT_NO_RESET should be removed ASAP.
*/
.flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
.prcm = { .prcm = {
.omap4 = { .omap4 = {
.clkctrl_offs = OMAP4_CM_L3_2_GPMC_CLKCTRL_OFFSET, .clkctrl_offs = OMAP4_CM_L3_2_GPMC_CLKCTRL_OFFSET,

View File

@ -819,8 +819,8 @@ static struct omap_hwmod dra7xx_gpmc_hwmod = {
.name = "gpmc", .name = "gpmc",
.class = &dra7xx_gpmc_hwmod_class, .class = &dra7xx_gpmc_hwmod_class,
.clkdm_name = "l3main1_clkdm", .clkdm_name = "l3main1_clkdm",
.flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET | /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */
HWMOD_SWSUP_SIDLE), .flags = HWMOD_SWSUP_SIDLE | DEBUG_OMAP_GPMC_HWMOD_FLAGS,
.main_clk = "l3_iclk_div", .main_clk = "l3_iclk_div",
.prcm = { .prcm = {
.omap4 = { .omap4 = {

View File

@ -478,6 +478,8 @@ static struct omap_hwmod dm81xx_gpmc_hwmod = {
.clkdm_name = "alwon_l3s_clkdm", .clkdm_name = "alwon_l3s_clkdm",
.class = &dm81xx_gpmc_hwmod_class, .class = &dm81xx_gpmc_hwmod_class,
.main_clk = "sysclk6_ck", .main_clk = "sysclk6_ck",
/* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */
.flags = DEBUG_OMAP_GPMC_HWMOD_FLAGS,
.prcm = { .prcm = {
.omap4 = { .omap4 = {
.clkctrl_offs = DM816X_CM_ALWON_GPMC_CLKCTRL, .clkctrl_offs = DM816X_CM_ALWON_GPMC_CLKCTRL,

View File

@ -49,6 +49,14 @@ config OMAP_GPMC
interfacing to a variety of asynchronous as well as synchronous interfacing to a variety of asynchronous as well as synchronous
memory drives like NOR, NAND, OneNAND, SRAM. memory drives like NOR, NAND, OneNAND, SRAM.
config OMAP_GPMC_DEBUG
bool
depends on OMAP_GPMC
help
Enables verbose debugging mostly to decode the bootloader provided
timings. Enable this during development to configure devices
connected to the GPMC bus.
config MVEBU_DEVBUS config MVEBU_DEVBUS
bool "Marvell EBU Device Bus Controller" bool "Marvell EBU Device Bus Controller"
default y default y

View File

@ -403,7 +403,7 @@ static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p)
p->cycle2cyclediffcsen); p->cycle2cyclediffcsen);
} }
#ifdef DEBUG #ifdef CONFIG_OMAP_GPMC_DEBUG
/** /**
* get_gpmc_timing_reg - read a timing parameter and print DTS settings for it. * get_gpmc_timing_reg - read a timing parameter and print DTS settings for it.
* @cs: Chip Select Region * @cs: Chip Select Region
@ -612,7 +612,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, int max
} }
l = gpmc_cs_read_reg(cs, reg); l = gpmc_cs_read_reg(cs, reg);
#ifdef DEBUG #ifdef CONFIG_OMAP_GPMC_DEBUG
pr_info( pr_info(
"GPMC CS%d: %-17s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n", "GPMC CS%d: %-17s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n",
cs, name, ticks, gpmc_get_clk_period(cs, cd) * ticks / 1000, cs, name, ticks, gpmc_get_clk_period(cs, cd) * ticks / 1000,
@ -767,7 +767,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
GPMC_CONFIG1_CLKACTIVATIONTIME_MAX, GPMC_CONFIG1_CLKACTIVATIONTIME_MAX,
clk_activation, GPMC_CD_FCLK); clk_activation, GPMC_CD_FCLK);
#ifdef DEBUG #ifdef CONFIG_OMAP_GPMC_DEBUG
pr_info("GPMC CS%d CLK period is %lu ns (div %d)\n", pr_info("GPMC CS%d CLK period is %lu ns (div %d)\n",
cs, (div * gpmc_get_fclk_period()) / 1000, div); cs, (div * gpmc_get_fclk_period()) / 1000, div);
#endif #endif