From: khilman@deeprootsystems.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/35] davinci: cpuidle: move mapping of DDR2 controller registers out of driver
Date: Wed, 6 Jan 2010 10:31:48 -0800 [thread overview]
Message-ID: <1262802737-6601-7-git-send-email-khilman@deeprootsystems.com> (raw)
In-Reply-To: <1262802737-6601-6-git-send-email-khilman@deeprootsystems.com>
From: Sekhar Nori <nsekhar@ti.com>
When suspend is supported, both cpuidle and suspend code
need to work on DDR2 registers. Instead of mapping the
DDR2 registers twice, do it once outside of cpuidle
driver and let cpuidle driver get the virtual base address
of DDR2 registers.
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
arch/arm/mach-davinci/cpuidle.c | 33 +++----------------------
arch/arm/mach-davinci/devices-da8xx.c | 16 +++++++++++-
arch/arm/mach-davinci/include/mach/cpuidle.h | 1 +
arch/arm/mach-davinci/include/mach/da8xx.h | 1 +
4 files changed, 21 insertions(+), 30 deletions(-)
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c
index beda3b5..bd59f31 100644
--- a/arch/arm/mach-davinci/cpuidle.c
+++ b/arch/arm/mach-davinci/cpuidle.c
@@ -106,8 +106,6 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
int ret;
struct cpuidle_device *device;
struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
- struct resource *ddr2_regs;
- resource_size_t len;
device = &per_cpu(davinci_cpuidle_device, smp_processor_id());
@@ -116,28 +114,12 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
return -ENOENT;
}
- ddr2_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!ddr2_regs) {
- dev_err(&pdev->dev, "cannot get DDR2 controller register base");
- return -ENODEV;
- }
-
- len = resource_size(ddr2_regs);
-
- ddr2_regs = request_mem_region(ddr2_regs->start, len, ddr2_regs->name);
- if (!ddr2_regs)
- return -EBUSY;
-
- ddr2_reg_base = ioremap(ddr2_regs->start, len);
- if (!ddr2_reg_base) {
- ret = -ENOMEM;
- goto ioremap_fail;
- }
+ ddr2_reg_base = pdata->ddr2_ctlr_base;
ret = cpuidle_register_driver(&davinci_idle_driver);
if (ret) {
dev_err(&pdev->dev, "failed to register driver\n");
- goto driver_register_fail;
+ return ret;
}
/* Wait for interrupt state */
@@ -164,18 +146,11 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
ret = cpuidle_register_device(device);
if (ret) {
dev_err(&pdev->dev, "failed to register device\n");
- goto device_register_fail;
+ cpuidle_unregister_driver(&davinci_idle_driver);
+ return ret;
}
return 0;
-
-device_register_fail:
- cpuidle_unregister_driver(&davinci_idle_driver);
-driver_register_fail:
- iounmap(ddr2_reg_base);
-ioremap_fail:
- release_mem_region(ddr2_regs->start, len);
- return ret;
}
static struct platform_driver davinci_cpuidle_driver = {
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 8de5f9f..5df27f7 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -489,6 +489,19 @@ int da8xx_register_rtc(void)
return platform_device_register(&da8xx_rtc_device);
}
+static void __iomem *da8xx_ddr2_ctlr_base;
+void __iomem * __init da8xx_get_mem_ctlr(void)
+{
+ if (da8xx_ddr2_ctlr_base)
+ return da8xx_ddr2_ctlr_base;
+
+ da8xx_ddr2_ctlr_base = ioremap(DA8XX_DDR2_CTL_BASE, SZ_32K);
+ if (!da8xx_ddr2_ctlr_base)
+ pr_warning("%s: Unable to map DDR2 controller", __func__);
+
+ return da8xx_ddr2_ctlr_base;
+}
+
static struct resource da8xx_cpuidle_resources[] = {
{
.start = DA8XX_DDR2_CTL_BASE,
@@ -514,6 +527,7 @@ static struct platform_device da8xx_cpuidle_device = {
int __init da8xx_register_cpuidle(void)
{
+ da8xx_cpuidle_pdata.ddr2_ctlr_base = da8xx_get_mem_ctlr();
+
return platform_device_register(&da8xx_cpuidle_device);
}
-
diff --git a/arch/arm/mach-davinci/include/mach/cpuidle.h b/arch/arm/mach-davinci/include/mach/cpuidle.h
index cbfc6a9..74f088b 100644
--- a/arch/arm/mach-davinci/include/mach/cpuidle.h
+++ b/arch/arm/mach-davinci/include/mach/cpuidle.h
@@ -12,6 +12,7 @@
struct davinci_cpuidle_config {
u32 ddr2_pdown;
+ void __iomem *ddr2_ctlr_base;
};
#endif
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index bddc4d4..cab4a25 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -94,6 +94,7 @@ void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
int da8xx_register_rtc(void);
int da850_register_cpufreq(void);
int da8xx_register_cpuidle(void);
+void __iomem * __init da8xx_get_mem_ctlr(void);
extern struct platform_device da8xx_serial_device;
extern struct emac_platform_data da8xx_emac_pdata;
--
1.6.6.rc2.1.g42108
next prev parent reply other threads:[~2010-01-06 18:31 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-06 18:31 [PATCH 00/35] davinci updates queued for 2.6.34 Kevin Hilman
2010-01-06 18:31 ` [PATCH 01/35] davinci: da8xx/omapl1: add support for the second sysconfig module Kevin Hilman
2010-01-06 18:31 ` [PATCH 02/35] davinci: move PLL wait time values to clock.h Kevin Hilman
2010-01-06 18:31 ` [PATCH 03/35] davinci: move DDR2 controller defines to memory.h Kevin Hilman
2010-01-06 18:31 ` [PATCH 04/35] davinci: move PSC register definitions from psc.c to psc.h Kevin Hilman
2010-01-06 18:31 ` [PATCH 05/35] davinci: make it possible to include clock.h and psc.h in assembly code Kevin Hilman
2010-01-06 18:31 ` Kevin Hilman [this message]
2010-01-06 18:31 ` [PATCH 07/35] davinci: da850/omap-l138: unlock PLL registers during init Kevin Hilman
2010-01-06 18:31 ` [PATCH 08/35] davinci: da850/omap-l138: create static map for SRAM Kevin Hilman
2010-01-06 18:31 ` [PATCH 09/35] davinci: explain CLOCK_TICK_RATE of 27MHz in include/mach/timex.h Kevin Hilman
2010-01-06 18:31 ` [PATCH 10/35] davinci: board-dm646x-evm.c: arrange related code together Kevin Hilman
2010-01-06 18:31 ` [PATCH 11/35] davinci: add support for DM6467T EVM Kevin Hilman
2010-01-06 18:31 ` [PATCH 12/35] davinci: clock framework: remove spinlock usage Kevin Hilman
2010-01-06 18:31 ` [PATCH 13/35] davinci: make /proc/davinci_clocks display multi-rooted clock tree Kevin Hilman
2010-01-06 18:31 ` [PATCH 14/35] davinci: move /proc/davinci_clocks to debugfs Kevin Hilman
2010-01-06 18:31 ` [PATCH 15/35] davinci: da850/omap-l138: Modify NOR partition info Kevin Hilman
2010-01-06 18:31 ` [PATCH 16/35] davinci: da850/omap-l138: Enable 4-bit ecc Kevin Hilman
2010-01-06 18:31 ` [PATCH 17/35] TI Davinci EMAC : Re-use driver for other platforms Kevin Hilman
2010-01-06 18:32 ` [PATCH 18/35] TI Davinci EMAC : add platform specific interrupt enable/disable logic Kevin Hilman
2010-01-06 18:32 ` [PATCH 19/35] TI Davinci EMAC : Abstract Buffer address translation logic Kevin Hilman
2010-01-06 18:32 ` [PATCH 20/35] davinci: clock: Check CLK_PSC flag before disabling PSC Kevin Hilman
2010-01-06 18:32 ` [PATCH 21/35] DaVinci: DM365: Changing default queue for DM365 Kevin Hilman
2010-01-06 18:32 ` [PATCH 22/35] davinci: add power management support Kevin Hilman
2010-01-06 18:32 ` [PATCH 23/35] davinci: da850/omap-l138: add support for SoC suspend Kevin Hilman
2010-01-06 18:32 ` [PATCH 24/35] davinci: da850/omap-l138 EVM: register for suspend support Kevin Hilman
2010-01-06 18:32 ` [PATCH 25/35] davinci: add support for CDCE949 clock synthesizer Kevin Hilman
2010-01-06 18:32 ` [PATCH 26/35] davinci: add CDCE949 support on DM6467 EVM Kevin Hilman
2010-01-06 18:32 ` [PATCH 27/35] davinci: Correct return value of edma_alloc_channel api Kevin Hilman
2010-01-06 18:32 ` [PATCH 28/35] davinci: Keep count of channel controllers on a platform Kevin Hilman
2010-01-06 18:32 ` [PATCH 29/35] davinci: Fix edma_alloc_channel api for EDMA_CHANNEL_ANY case Kevin Hilman
2010-01-06 18:32 ` [PATCH 30/35] davinci: build list of unused EDMA events dynamically Kevin Hilman
2010-01-06 18:32 ` [PATCH 31/35] davinci: support for EDMA resource sharing Kevin Hilman
2010-01-06 18:32 ` [PATCH 32/35] davinci: da8xx/omap-l1xx: Add EDMA platform data for da850/omap-l138 Kevin Hilman
2010-01-06 18:32 ` [PATCH 33/35] davinci: da830/omapl137: Specify reserved channels/slots Kevin Hilman
2010-01-06 18:32 ` [PATCH 34/35] davinci: da850/omapl138: " Kevin Hilman
2010-01-06 18:32 ` [PATCH 35/35] davinci: dm646x: Specify reserved EDMA channel/slots for DM646x Kevin Hilman
2010-01-08 17:06 ` [PATCH 12/35] davinci: clock framework: remove spinlock usage Russell King - ARM Linux
2010-01-11 15:27 ` Kevin Hilman
2010-01-10 13:59 ` [PATCH 00/35] davinci updates queued for 2.6.34 Russell King - ARM Linux
2010-01-11 15:31 ` Kevin Hilman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1262802737-6601-7-git-send-email-khilman@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).