* [PATCH 0/3] OMAP2+: powerdomain: add fn to determine whether pwrdm is always on
@ 2011-03-08 2:15 Paul Walmsley
2011-03-08 2:15 ` [PATCH 1/3] OMAP2/3: WKUP powerdomain: mark as being " Paul Walmsley
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Paul Walmsley @ 2011-03-08 2:15 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
this series adds an OMAP powerdomain API function that allows its
callers to determine whether a particular powerdomain can ever lose
register or memory bank context while the SoC is powered. This is
intended for use by driver-subarch integration code (i.e.,
arch/arm/*omap*) to pass a flag to the driver to determine whether it
is necessary to save and restore driver context.
As part of this series, fix some long-standing bugs in the powerdomain
data. These fixes are necessary for this function to work, and also
for OSWR support.
Tested on OMAP35xx BeagleBoard and OMAP44xx Pandaboard.
- Paul
pwrdm_add_can_lose_context_fns_2.6.39
text data bss dec hex filename
5795912 501512 5598936 11896360 b58628 vmlinux.omap2plus_defconfig.orig
5796064 501512 5598936 11896512 b586c0 vmlinux.omap2plus_defconfig
Paul Walmsley (3):
OMAP2/3: WKUP powerdomain: mark as being always on
OMAP2+: powerdomain: fix bank power state bitfields
OMAP2+: powerdomain: add pwrdm_can_ever_lose_context()
arch/arm/mach-omap2/powerdomain.c | 43 +++++++++++
arch/arm/mach-omap2/powerdomain.h | 18 ++---
arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c | 9 +-
arch/arm/mach-omap2/powerdomains2xxx_data.c | 18 ++---
arch/arm/mach-omap2/powerdomains3xxx_data.c | 38 +++++-----
arch/arm/mach-omap2/powerdomains44xx_data.c | 84 +++++++++++-----------
6 files changed, 125 insertions(+), 85 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/3] OMAP2/3: WKUP powerdomain: mark as being always on 2011-03-08 2:15 [PATCH 0/3] OMAP2+: powerdomain: add fn to determine whether pwrdm is always on Paul Walmsley @ 2011-03-08 2:15 ` Paul Walmsley 2011-03-08 2:15 ` [PATCH 2/3] OMAP2+: powerdomain: fix bank power state bitfields Paul Walmsley 2011-03-08 2:15 ` [PATCH 3/3] OMAP2+: powerdomain: add pwrdm_can_ever_lose_context() Paul Walmsley 2 siblings, 0 replies; 7+ messages in thread From: Paul Walmsley @ 2011-03-08 2:15 UTC (permalink / raw) To: linux-arm-kernel Mark the WKUP powerdomain as being always on -- at least, as long as the chip has power. This will be used to enable the powerdomain code to determine whether a given powerdomain is ever able to power off. While here, update the file copyright. Signed-off-by: Paul Walmsley <paul@pwsan.com> --- arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c b/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c index 5b4dd97..96cda13 100644 --- a/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c +++ b/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c @@ -2,7 +2,7 @@ * OMAP2/3 common powerdomain definitions * * Copyright (C) 2007-2008 Texas Instruments, Inc. - * Copyright (C) 2007-2010 Nokia Corporation + * Copyright (C) 2007-2011 Nokia Corporation * * Paul Walmsley, Jouni H?gander * @@ -76,4 +76,5 @@ struct powerdomain wkup_omap2_pwrdm = { .name = "wkup_pwrdm", .prcm_offs = WKUP_MOD, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430), + .pwrsts = PWRSTS_ON, }; ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] OMAP2+: powerdomain: fix bank power state bitfields 2011-03-08 2:15 [PATCH 0/3] OMAP2+: powerdomain: add fn to determine whether pwrdm is always on Paul Walmsley 2011-03-08 2:15 ` [PATCH 1/3] OMAP2/3: WKUP powerdomain: mark as being " Paul Walmsley @ 2011-03-08 2:15 ` Paul Walmsley 2011-03-08 2:15 ` [PATCH 3/3] OMAP2+: powerdomain: add pwrdm_can_ever_lose_context() Paul Walmsley 2 siblings, 0 replies; 7+ messages in thread From: Paul Walmsley @ 2011-03-08 2:15 UTC (permalink / raw) To: linux-arm-kernel The bank power state bitfields in the powerdomain data are encoded incorrectly. These fields are intended to be bitfields, representing a set of power states that the memory banks support. However, when only one power state was supported by a given bank, the field was incorrectly set to the bit shift -- not the mask. While here, update some file copyrights. The OMAP4 autogeneration scripts have been updated accordingly. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Beno?t Cousson <b-cousson@ti.com> Cc: Rajendra Nayak <rnayak@ti.com> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com> --- arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c | 6 +- arch/arm/mach-omap2/powerdomains2xxx_data.c | 18 ++--- arch/arm/mach-omap2/powerdomains3xxx_data.c | 38 +++++----- arch/arm/mach-omap2/powerdomains44xx_data.c | 84 +++++++++++----------- 4 files changed, 73 insertions(+), 73 deletions(-) diff --git a/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c b/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c index 96cda13..4210c33 100644 --- a/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c +++ b/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c @@ -62,13 +62,13 @@ struct powerdomain gfx_omap2_pwrdm = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430ES1), .pwrsts = PWRSTS_OFF_RET_ON, - .pwrsts_logic_ret = PWRDM_POWER_RET, + .pwrsts_logic_ret = PWRSTS_RET, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ + [0] = PWRSTS_RET, /* MEMRETSTATE */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* MEMONSTATE */ + [0] = PWRSTS_ON, /* MEMONSTATE */ }, }; diff --git a/arch/arm/mach-omap2/powerdomains2xxx_data.c b/arch/arm/mach-omap2/powerdomains2xxx_data.c index 78739e1..cc389fb 100644 --- a/arch/arm/mach-omap2/powerdomains2xxx_data.c +++ b/arch/arm/mach-omap2/powerdomains2xxx_data.c @@ -2,7 +2,7 @@ * OMAP2XXX powerdomain definitions * * Copyright (C) 2007-2008 Texas Instruments, Inc. - * Copyright (C) 2007-2010 Nokia Corporation + * Copyright (C) 2007-2011 Nokia Corporation * * Paul Walmsley, Jouni H?gander * @@ -30,13 +30,13 @@ static struct powerdomain dsp_pwrdm = { .prcm_offs = OMAP24XX_DSP_MOD, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX), .pwrsts = PWRSTS_OFF_RET_ON, - .pwrsts_logic_ret = PWRDM_POWER_RET, + .pwrsts_logic_ret = PWRSTS_RET, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, + [0] = PWRSTS_RET, }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, + [0] = PWRSTS_ON, }, }; @@ -48,10 +48,10 @@ static struct powerdomain mpu_24xx_pwrdm = { .pwrsts_logic_ret = PWRSTS_OFF_RET, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, + [0] = PWRSTS_RET, }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, + [0] = PWRSTS_ON, }, }; @@ -87,13 +87,13 @@ static struct powerdomain mdm_pwrdm = { .prcm_offs = OMAP2430_MDM_MOD, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), .pwrsts = PWRSTS_OFF_RET_ON, - .pwrsts_logic_ret = PWRDM_POWER_RET, + .pwrsts_logic_ret = PWRSTS_RET, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ + [0] = PWRSTS_RET, /* MEMRETSTATE */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* MEMONSTATE */ + [0] = PWRSTS_ON, /* MEMONSTATE */ }, }; diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c b/arch/arm/mach-omap2/powerdomains3xxx_data.c index e1bec56..9c9c113 100644 --- a/arch/arm/mach-omap2/powerdomains3xxx_data.c +++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c @@ -2,7 +2,7 @@ * OMAP3 powerdomain definitions * * Copyright (C) 2007-2008 Texas Instruments, Inc. - * Copyright (C) 2007-2010 Nokia Corporation + * Copyright (C) 2007-2011 Nokia Corporation * * Paul Walmsley, Jouni H?gander * @@ -47,10 +47,10 @@ static struct powerdomain iva2_pwrdm = { [3] = PWRSTS_OFF_RET, }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, - [1] = PWRDM_POWER_ON, + [0] = PWRSTS_ON, + [1] = PWRSTS_ON, [2] = PWRSTS_OFF_ON, - [3] = PWRDM_POWER_ON, + [3] = PWRSTS_ON, }, }; @@ -128,13 +128,13 @@ static struct powerdomain dss_pwrdm = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), .prcm_offs = OMAP3430_DSS_MOD, .pwrsts = PWRSTS_OFF_RET_ON, - .pwrsts_logic_ret = PWRDM_POWER_RET, + .pwrsts_logic_ret = PWRSTS_RET, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ + [0] = PWRSTS_RET, /* MEMRETSTATE */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* MEMONSTATE */ + [0] = PWRSTS_ON, /* MEMONSTATE */ }, }; @@ -149,13 +149,13 @@ static struct powerdomain sgx_pwrdm = { .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2), /* XXX This is accurate for 3430 SGX, but what about GFX? */ .pwrsts = PWRSTS_OFF_ON, - .pwrsts_logic_ret = PWRDM_POWER_RET, + .pwrsts_logic_ret = PWRSTS_RET, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ + [0] = PWRSTS_RET, /* MEMRETSTATE */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* MEMONSTATE */ + [0] = PWRSTS_ON, /* MEMONSTATE */ }, }; @@ -164,13 +164,13 @@ static struct powerdomain cam_pwrdm = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), .prcm_offs = OMAP3430_CAM_MOD, .pwrsts = PWRSTS_OFF_RET_ON, - .pwrsts_logic_ret = PWRDM_POWER_RET, + .pwrsts_logic_ret = PWRSTS_RET, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ + [0] = PWRSTS_RET, /* MEMRETSTATE */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* MEMONSTATE */ + [0] = PWRSTS_ON, /* MEMONSTATE */ }, }; @@ -182,10 +182,10 @@ static struct powerdomain per_pwrdm = { .pwrsts_logic_ret = PWRSTS_OFF_RET, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ + [0] = PWRSTS_RET, /* MEMRETSTATE */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* MEMONSTATE */ + [0] = PWRSTS_ON, /* MEMONSTATE */ }, }; @@ -200,7 +200,7 @@ static struct powerdomain neon_pwrdm = { .prcm_offs = OMAP3430_NEON_MOD, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), .pwrsts = PWRSTS_OFF_RET_ON, - .pwrsts_logic_ret = PWRDM_POWER_RET, + .pwrsts_logic_ret = PWRSTS_RET, }; static struct powerdomain usbhost_pwrdm = { @@ -208,7 +208,7 @@ static struct powerdomain usbhost_pwrdm = { .prcm_offs = OMAP3430ES2_USBHOST_MOD, .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2), .pwrsts = PWRSTS_OFF_RET_ON, - .pwrsts_logic_ret = PWRDM_POWER_RET, + .pwrsts_logic_ret = PWRSTS_RET, /* * REVISIT: Enabling usb host save and restore mechanism seems to * leave the usb host domain permanently in ACTIVE mode after @@ -218,10 +218,10 @@ static struct powerdomain usbhost_pwrdm = { /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */ .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ + [0] = PWRSTS_RET, /* MEMRETSTATE */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* MEMONSTATE */ + [0] = PWRSTS_ON, /* MEMONSTATE */ }, }; diff --git a/arch/arm/mach-omap2/powerdomains44xx_data.c b/arch/arm/mach-omap2/powerdomains44xx_data.c index 226e01a..c4222c7 100644 --- a/arch/arm/mach-omap2/powerdomains44xx_data.c +++ b/arch/arm/mach-omap2/powerdomains44xx_data.c @@ -2,7 +2,7 @@ * OMAP4 Power domains framework * * Copyright (C) 2009-2010 Texas Instruments, Inc. - * Copyright (C) 2009-2010 Nokia Corporation + * Copyright (C) 2009-2011 Nokia Corporation * * Abhijit Pagare (abhijitpagare at ti.com) * Benoit Cousson (b-cousson at ti.com) @@ -40,18 +40,18 @@ static struct powerdomain core_44xx_pwrdm = { .pwrsts_logic_ret = PWRSTS_OFF_RET, .banks = 5, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_OFF, /* core_nret_bank */ + [0] = PWRSTS_OFF, /* core_nret_bank */ [1] = PWRSTS_OFF_RET, /* core_ocmram */ - [2] = PWRDM_POWER_RET, /* core_other_bank */ + [2] = PWRSTS_RET, /* core_other_bank */ [3] = PWRSTS_OFF_RET, /* ducati_l2ram */ [4] = PWRSTS_OFF_RET, /* ducati_unicache */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* core_nret_bank */ + [0] = PWRSTS_ON, /* core_nret_bank */ [1] = PWRSTS_OFF_RET, /* core_ocmram */ - [2] = PWRDM_POWER_ON, /* core_other_bank */ - [3] = PWRDM_POWER_ON, /* ducati_l2ram */ - [4] = PWRDM_POWER_ON, /* ducati_unicache */ + [2] = PWRSTS_ON, /* core_other_bank */ + [3] = PWRSTS_ON, /* ducati_l2ram */ + [4] = PWRSTS_ON, /* ducati_unicache */ }, .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, }; @@ -65,10 +65,10 @@ static struct powerdomain gfx_44xx_pwrdm = { .pwrsts = PWRSTS_OFF_ON, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_OFF, /* gfx_mem */ + [0] = PWRSTS_OFF, /* gfx_mem */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* gfx_mem */ + [0] = PWRSTS_ON, /* gfx_mem */ }, .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, }; @@ -83,12 +83,12 @@ static struct powerdomain abe_44xx_pwrdm = { .pwrsts_logic_ret = PWRSTS_OFF, .banks = 2, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, /* aessmem */ - [1] = PWRDM_POWER_OFF, /* periphmem */ + [0] = PWRSTS_RET, /* aessmem */ + [1] = PWRSTS_OFF, /* periphmem */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* aessmem */ - [1] = PWRDM_POWER_ON, /* periphmem */ + [0] = PWRSTS_ON, /* aessmem */ + [1] = PWRSTS_ON, /* periphmem */ }, .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, }; @@ -103,10 +103,10 @@ static struct powerdomain dss_44xx_pwrdm = { .pwrsts_logic_ret = PWRSTS_OFF, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_OFF, /* dss_mem */ + [0] = PWRSTS_OFF, /* dss_mem */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* dss_mem */ + [0] = PWRSTS_ON, /* dss_mem */ }, .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, }; @@ -121,14 +121,14 @@ static struct powerdomain tesla_44xx_pwrdm = { .pwrsts_logic_ret = PWRSTS_OFF_RET, .banks = 3, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_RET, /* tesla_edma */ + [0] = PWRSTS_RET, /* tesla_edma */ [1] = PWRSTS_OFF_RET, /* tesla_l1 */ [2] = PWRSTS_OFF_RET, /* tesla_l2 */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* tesla_edma */ - [1] = PWRDM_POWER_ON, /* tesla_l1 */ - [2] = PWRDM_POWER_ON, /* tesla_l2 */ + [0] = PWRSTS_ON, /* tesla_edma */ + [1] = PWRSTS_ON, /* tesla_l1 */ + [2] = PWRSTS_ON, /* tesla_l2 */ }, .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, }; @@ -142,10 +142,10 @@ static struct powerdomain wkup_44xx_pwrdm = { .pwrsts = PWRSTS_ON, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_OFF, /* wkup_bank */ + [0] = PWRSTS_OFF, /* wkup_bank */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* wkup_bank */ + [0] = PWRSTS_ON, /* wkup_bank */ }, }; @@ -162,7 +162,7 @@ static struct powerdomain cpu0_44xx_pwrdm = { [0] = PWRSTS_OFF_RET, /* cpu0_l1 */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* cpu0_l1 */ + [0] = PWRSTS_ON, /* cpu0_l1 */ }, }; @@ -179,7 +179,7 @@ static struct powerdomain cpu1_44xx_pwrdm = { [0] = PWRSTS_OFF_RET, /* cpu1_l1 */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* cpu1_l1 */ + [0] = PWRSTS_ON, /* cpu1_l1 */ }, }; @@ -192,10 +192,10 @@ static struct powerdomain emu_44xx_pwrdm = { .pwrsts = PWRSTS_OFF_ON, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_OFF, /* emu_bank */ + [0] = PWRSTS_OFF, /* emu_bank */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* emu_bank */ + [0] = PWRSTS_ON, /* emu_bank */ }, }; @@ -211,12 +211,12 @@ static struct powerdomain mpu_44xx_pwrdm = { .pwrsts_mem_ret = { [0] = PWRSTS_OFF_RET, /* mpu_l1 */ [1] = PWRSTS_OFF_RET, /* mpu_l2 */ - [2] = PWRDM_POWER_RET, /* mpu_ram */ + [2] = PWRSTS_RET, /* mpu_ram */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* mpu_l1 */ - [1] = PWRDM_POWER_ON, /* mpu_l2 */ - [2] = PWRDM_POWER_ON, /* mpu_ram */ + [0] = PWRSTS_ON, /* mpu_l1 */ + [1] = PWRSTS_ON, /* mpu_l2 */ + [2] = PWRSTS_ON, /* mpu_ram */ }, }; @@ -230,16 +230,16 @@ static struct powerdomain ivahd_44xx_pwrdm = { .pwrsts_logic_ret = PWRSTS_OFF, .banks = 4, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_OFF, /* hwa_mem */ + [0] = PWRSTS_OFF, /* hwa_mem */ [1] = PWRSTS_OFF_RET, /* sl2_mem */ [2] = PWRSTS_OFF_RET, /* tcm1_mem */ [3] = PWRSTS_OFF_RET, /* tcm2_mem */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* hwa_mem */ - [1] = PWRDM_POWER_ON, /* sl2_mem */ - [2] = PWRDM_POWER_ON, /* tcm1_mem */ - [3] = PWRDM_POWER_ON, /* tcm2_mem */ + [0] = PWRSTS_ON, /* hwa_mem */ + [1] = PWRSTS_ON, /* sl2_mem */ + [2] = PWRSTS_ON, /* tcm1_mem */ + [3] = PWRSTS_ON, /* tcm2_mem */ }, .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, }; @@ -253,10 +253,10 @@ static struct powerdomain cam_44xx_pwrdm = { .pwrsts = PWRSTS_OFF_ON, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_OFF, /* cam_mem */ + [0] = PWRSTS_OFF, /* cam_mem */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* cam_mem */ + [0] = PWRSTS_ON, /* cam_mem */ }, .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, }; @@ -271,10 +271,10 @@ static struct powerdomain l3init_44xx_pwrdm = { .pwrsts_logic_ret = PWRSTS_OFF_RET, .banks = 1, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_OFF, /* l3init_bank1 */ + [0] = PWRSTS_OFF, /* l3init_bank1 */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* l3init_bank1 */ + [0] = PWRSTS_ON, /* l3init_bank1 */ }, .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, }; @@ -289,12 +289,12 @@ static struct powerdomain l4per_44xx_pwrdm = { .pwrsts_logic_ret = PWRSTS_OFF_RET, .banks = 2, .pwrsts_mem_ret = { - [0] = PWRDM_POWER_OFF, /* nonretained_bank */ - [1] = PWRDM_POWER_RET, /* retained_bank */ + [0] = PWRSTS_OFF, /* nonretained_bank */ + [1] = PWRSTS_RET, /* retained_bank */ }, .pwrsts_mem_on = { - [0] = PWRDM_POWER_ON, /* nonretained_bank */ - [1] = PWRDM_POWER_ON, /* retained_bank */ + [0] = PWRSTS_ON, /* nonretained_bank */ + [1] = PWRSTS_ON, /* retained_bank */ }, .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, }; ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] OMAP2+: powerdomain: add pwrdm_can_ever_lose_context() 2011-03-08 2:15 [PATCH 0/3] OMAP2+: powerdomain: add fn to determine whether pwrdm is always on Paul Walmsley 2011-03-08 2:15 ` [PATCH 1/3] OMAP2/3: WKUP powerdomain: mark as being " Paul Walmsley 2011-03-08 2:15 ` [PATCH 2/3] OMAP2+: powerdomain: fix bank power state bitfields Paul Walmsley @ 2011-03-08 2:15 ` Paul Walmsley 2011-03-08 9:16 ` Varadarajan, Charulatha 2 siblings, 1 reply; 7+ messages in thread From: Paul Walmsley @ 2011-03-08 2:15 UTC (permalink / raw) To: linux-arm-kernel Some drivers wish to know whether the device that they control can ever lose context, for example, when the device's enclosing powerdomain loses power. They can use this information to determine whether it is necessary to save and restore device context, or whether it can be skipped. Implement the powerdomain portion of this by adding the function pwrdm_can_ever_lose_context(). This is not for use directly from driver code, but instead is intended to be called from driver-subarch integration code (i.e., arch/arm/*omap* code). Currently, the result from this function should be passed into the driver code via struct platform_data, but at some point this should be part of some common or OMAP-specific device code. While here, update file copyrights. Signed-off-by: Paul Walmsley <paul@pwsan.com> --- arch/arm/mach-omap2/powerdomain.c | 43 ++++++++++++++++++++++++++++++++++++- arch/arm/mach-omap2/powerdomain.h | 18 +++++++-------- 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index eaed0df..a11be81 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c @@ -2,7 +2,7 @@ * OMAP powerdomain control * * Copyright (C) 2007-2008 Texas Instruments, Inc. - * Copyright (C) 2007-2009 Nokia Corporation + * Copyright (C) 2007-2011 Nokia Corporation * * Written by Paul Walmsley * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> @@ -938,3 +938,44 @@ u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm) return count; } + +/** + * pwrdm_can_ever_lose_context - can this powerdomain ever lose context? + * @pwrdm: struct powerdomain * + * + * Given a struct powerdomain * @pwrdm, returns 1 if the powerdomain + * can lose either memory or logic context or if @pwrdm is invalid, or + * returns 0 otherwise. This function is not concerned with how the + * powerdomain registers are programmed (i.e., to go off or not); it's + * concerned with whether it's ever possible for this powerdomain to + * go off while some other part of the chip is active. This function + * assumes that every powerdomain can go to either ON or INACTIVE. + */ +bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm) +{ + int i; + + if (IS_ERR_OR_NULL(pwrdm)) { + pr_debug("powerdomain: %s: invalid powerdomain pointer\n", + __func__); + return 1; + } + + if (pwrdm->pwrsts & PWRSTS_OFF) + return 1; + + if (pwrdm->pwrsts & PWRSTS_RET) { + if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF) + return 1; + + for (i = 0; i < pwrdm->banks; i++) + if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF) + return 1; + } + + for (i = 0; i < pwrdm->banks; i++) + if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF) + return 1; + + return 0; +} diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h index 0b7a357..027f40b 100644 --- a/arch/arm/mach-omap2/powerdomain.h +++ b/arch/arm/mach-omap2/powerdomain.h @@ -2,7 +2,7 @@ * OMAP2/3/4 powerdomain control * * Copyright (C) 2007-2008, 2010 Texas Instruments, Inc. - * Copyright (C) 2007-2010 Nokia Corporation + * Copyright (C) 2007-2011 Nokia Corporation * * Paul Walmsley * @@ -34,17 +34,14 @@ /* Powerdomain allowable state bitfields */ #define PWRSTS_ON (1 << PWRDM_POWER_ON) +#define PWRSTS_INACTIVE (1 << PWRDM_POWER_INACTIVE) +#define PWRSTS_RET (1 << PWRDM_POWER_RET) #define PWRSTS_OFF (1 << PWRDM_POWER_OFF) -#define PWRSTS_OFF_ON ((1 << PWRDM_POWER_OFF) | \ - (1 << PWRDM_POWER_ON)) -#define PWRSTS_OFF_RET ((1 << PWRDM_POWER_OFF) | \ - (1 << PWRDM_POWER_RET)) - -#define PWRSTS_RET_ON ((1 << PWRDM_POWER_RET) | \ - (1 << PWRDM_POWER_ON)) - -#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | (1 << PWRDM_POWER_ON)) +#define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON) +#define PWRSTS_OFF_RET (PWRSTS_OFF | PWRSTS_RET) +#define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) +#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON) /* Powerdomain flags */ @@ -211,6 +208,7 @@ int pwrdm_pre_transition(void); int pwrdm_post_transition(void); int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm); u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm); +bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm); extern void omap2xxx_powerdomains_init(void); extern void omap3xxx_powerdomains_init(void); ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] OMAP2+: powerdomain: add pwrdm_can_ever_lose_context() 2011-03-08 2:15 ` [PATCH 3/3] OMAP2+: powerdomain: add pwrdm_can_ever_lose_context() Paul Walmsley @ 2011-03-08 9:16 ` Varadarajan, Charulatha 2011-03-08 18:10 ` Paul Walmsley 0 siblings, 1 reply; 7+ messages in thread From: Varadarajan, Charulatha @ 2011-03-08 9:16 UTC (permalink / raw) To: linux-arm-kernel On Tue, Mar 8, 2011 at 07:45, Paul Walmsley <paul@pwsan.com> wrote: > Some drivers wish to know whether the device that they control can > ever lose context, for example, when the device's enclosing > powerdomain loses power. ?They can use this information to determine > whether it is necessary to save and restore device context, or whether > it can be skipped. ?Implement the powerdomain portion of this by > adding the function pwrdm_can_ever_lose_context(). ?This is not for > use directly from driver code, but instead is intended to be called > from driver-subarch integration code (i.e., arch/arm/*omap* code). > > Currently, the result from this function should be passed into the > driver code via struct platform_data, but at some point this should > be part of some common or OMAP-specific device code. > > While here, update file copyrights. > > Signed-off-by: Paul Walmsley <paul@pwsan.com> > --- > ?arch/arm/mach-omap2/powerdomain.c | ? 43 ++++++++++++++++++++++++++++++++++++- > ?arch/arm/mach-omap2/powerdomain.h | ? 18 +++++++-------- > ?2 files changed, 50 insertions(+), 11 deletions(-) > > diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c > index eaed0df..a11be81 100644 > --- a/arch/arm/mach-omap2/powerdomain.c > +++ b/arch/arm/mach-omap2/powerdomain.c > @@ -2,7 +2,7 @@ > ?* OMAP powerdomain control > ?* > ?* Copyright (C) 2007-2008 Texas Instruments, Inc. > - * Copyright (C) 2007-2009 Nokia Corporation > + * Copyright (C) 2007-2011 Nokia Corporation > ?* > ?* Written by Paul Walmsley > ?* Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> > @@ -938,3 +938,44 @@ u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm) > > ? ? ? ?return count; > ?} > + > +/** > + * pwrdm_can_ever_lose_context - can this powerdomain ever lose context? > + * @pwrdm: struct powerdomain * > + * > + * Given a struct powerdomain * @pwrdm, returns 1 if the powerdomain > + * can lose either memory or logic context or if @pwrdm is invalid, or > + * returns 0 otherwise. ?This function is not concerned with how the > + * powerdomain registers are programmed (i.e., to go off or not); it's > + * concerned with whether it's ever possible for this powerdomain to > + * go off while some other part of the chip is active. ?This function > + * assumes that every powerdomain can go to either ON or INACTIVE. > + */ > +bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm) > +{ > + ? ? ? int i; > + > + ? ? ? if (IS_ERR_OR_NULL(pwrdm)) { > + ? ? ? ? ? ? ? pr_debug("powerdomain: %s: invalid powerdomain pointer\n", > + ? ? ? ? ? ? ? ? ? ? ? ?__func__); > + ? ? ? ? ? ? ? return 1; Do you really want to return 1 in case of invalid powerdomain pointer? -V Charulatha > + ? ? ? } > + > + ? ? ? if (pwrdm->pwrsts & PWRSTS_OFF) > + ? ? ? ? ? ? ? return 1; > + > + ? ? ? if (pwrdm->pwrsts & PWRSTS_RET) { > + ? ? ? ? ? ? ? if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF) > + ? ? ? ? ? ? ? ? ? ? ? return 1; > + > + ? ? ? ? ? ? ? for (i = 0; i < pwrdm->banks; i++) > + ? ? ? ? ? ? ? ? ? ? ? if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return 1; > + ? ? ? } > + > + ? ? ? for (i = 0; i < pwrdm->banks; i++) > + ? ? ? ? ? ? ? if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF) > + ? ? ? ? ? ? ? ? ? ? ? return 1; > + > + ? ? ? return 0; > +} <<snip>> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] OMAP2+: powerdomain: add pwrdm_can_ever_lose_context() 2011-03-08 9:16 ` Varadarajan, Charulatha @ 2011-03-08 18:10 ` Paul Walmsley 2011-03-09 1:41 ` Varadarajan, Charulatha 0 siblings, 1 reply; 7+ messages in thread From: Paul Walmsley @ 2011-03-08 18:10 UTC (permalink / raw) To: linux-arm-kernel On Tue, 8 Mar 2011, Varadarajan, Charulatha wrote: > Do you really want to return 1 in case of invalid powerdomain pointer? Sure, that's why I wrote it that way. It seems less risky than returning 0. Do you have a proposal that makes more sense, given that this is going to be called immediately after a omap_{device,hwmod}_get_pwrdm() ? - Paul ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] OMAP2+: powerdomain: add pwrdm_can_ever_lose_context() 2011-03-08 18:10 ` Paul Walmsley @ 2011-03-09 1:41 ` Varadarajan, Charulatha 0 siblings, 0 replies; 7+ messages in thread From: Varadarajan, Charulatha @ 2011-03-09 1:41 UTC (permalink / raw) To: linux-arm-kernel On Tue, Mar 8, 2011 at 13:10, Paul Walmsley <paul@pwsan.com> wrote: > On Tue, 8 Mar 2011, Varadarajan, Charulatha wrote: > >> Do you really want to return 1 in case of invalid powerdomain pointer? > > Sure, that's why I wrote it that way. ?It seems less risky than returning > 0. ?Do you have a proposal that makes more sense, given that this is going > to be called immediately after a omap_{device,hwmod}_get_pwrdm() ? Well. This means that it is the caller's responsibility to verify the powerdomain pointer before calling this function. Otherwise, this function assumes that the powerdomain looses context. I thought that it would be appropriate to return an int value, with which, the func would return an error in case of pwrdm ptr error, return a zero if the powerdomain can ever loose context and a non-zero value otherwise. What do you think? -V Charulatha > > > - Paul > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-03-09 1:41 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-03-08 2:15 [PATCH 0/3] OMAP2+: powerdomain: add fn to determine whether pwrdm is always on Paul Walmsley 2011-03-08 2:15 ` [PATCH 1/3] OMAP2/3: WKUP powerdomain: mark as being " Paul Walmsley 2011-03-08 2:15 ` [PATCH 2/3] OMAP2+: powerdomain: fix bank power state bitfields Paul Walmsley 2011-03-08 2:15 ` [PATCH 3/3] OMAP2+: powerdomain: add pwrdm_can_ever_lose_context() Paul Walmsley 2011-03-08 9:16 ` Varadarajan, Charulatha 2011-03-08 18:10 ` Paul Walmsley 2011-03-09 1:41 ` Varadarajan, Charulatha
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox