From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: Scott Wood <scottwood@freescale.com>,
linuxppc-dev@ozlabs.org, Timur Tabi <timur@freescale.com>
Subject: [PATCH 1/7] powerpc/qe: Make qe_reset() code path safe for repeated invocation
Date: Wed, 16 Sep 2009 01:43:52 +0400 [thread overview]
Message-ID: <20090915214352.GA24821@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20090915214321.GA19377@oksana.dev.rtsoft.ru>
For MPC8569 CPUs we'll need to reset QE after each suspend, so make
qe_reset() code path suitable for repeated invocation, that is:
- Don't initialize rheap structures if already initialized;
- Don't allocate muram for SDMA if already allocated, just reinitialize
registers with previously allocated muram offset;
- Remove __init attributes from qe_reset() and cpm_muram_init();
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/include/asm/qe.h | 2 +-
arch/powerpc/sysdev/cpm_common.c | 5 ++++-
arch/powerpc/sysdev/qe_lib/qe.c | 12 +++++++-----
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 20c0b07..fe507ff 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -87,7 +87,7 @@ extern spinlock_t cmxgcr_lock;
/* Export QE common operations */
#ifdef CONFIG_QUICC_ENGINE
-extern void __init qe_reset(void);
+extern void qe_reset(void);
#else
static inline void qe_reset(void) {}
#endif
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index e4b6d66..9de72c9 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -72,7 +72,7 @@ static phys_addr_t muram_pbase;
/* Max address size we deal with */
#define OF_MAX_ADDR_CELLS 4
-int __init cpm_muram_init(void)
+int cpm_muram_init(void)
{
struct device_node *np;
struct resource r;
@@ -81,6 +81,9 @@ int __init cpm_muram_init(void)
int i = 0;
int ret = 0;
+ if (muram_pbase)
+ return 0;
+
spin_lock_init(&cpm_muram_lock);
/* initialize the info header */
rh_init(&cpm_muram_info, 1,
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index fff2701..1ed1a9f 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -104,7 +104,7 @@ phys_addr_t get_qe_base(void)
EXPORT_SYMBOL(get_qe_base);
-void __init qe_reset(void)
+void qe_reset(void)
{
if (qe_immr == NULL)
qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE);
@@ -330,16 +330,18 @@ EXPORT_SYMBOL(qe_put_snum);
static int qe_sdma_init(void)
{
struct sdma __iomem *sdma = &qe_immr->sdma;
- unsigned long sdma_buf_offset;
+ static unsigned long sdma_buf_offset = (unsigned long)-ENOMEM;
if (!sdma)
return -ENODEV;
/* allocate 2 internal temporary buffers (512 bytes size each) for
* the SDMA */
- sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
- if (IS_ERR_VALUE(sdma_buf_offset))
- return -ENOMEM;
+ if (IS_ERR_VALUE(sdma_buf_offset)) {
+ sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
+ if (IS_ERR_VALUE(sdma_buf_offset))
+ return -ENOMEM;
+ }
out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK);
out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK |
--
1.6.3.3
next prev parent reply other threads:[~2009-09-15 21:43 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-15 21:43 [PATCH v4 0/7] Suspend/resume support for some 83xx/85xx/86xx boards Anton Vorontsov
2009-09-15 21:43 ` Anton Vorontsov [this message]
2009-11-05 13:15 ` [PATCH 1/7] powerpc/qe: Make qe_reset() code path safe for repeated invocation Kumar Gala
2009-09-15 21:43 ` [PATCH 2/7] powerpc/qe: QE also shuts down on MPC8568 Anton Vorontsov
2009-11-05 13:15 ` Kumar Gala
2009-09-15 21:43 ` [PATCH 3/7] powerpc/qe: Implement QE driver for handling resume on MPC85xx Anton Vorontsov
2009-11-05 14:11 ` Kumar Gala
2009-09-15 21:43 ` [PATCH 4/7] powerpc/85xx/86xx: Add suspend/resume support Anton Vorontsov
2009-11-05 14:11 ` Kumar Gala
2009-09-15 21:43 ` [PATCH 5/7] powerpc/85xx: Add power management support for MPC85xxMDS boards Anton Vorontsov
2009-11-05 13:58 ` Kumar Gala
2009-11-05 14:02 ` Kumar Gala
2009-11-05 14:08 ` Anton Vorontsov
2009-11-05 14:04 ` Anton Vorontsov
2009-11-05 14:06 ` Kumar Gala
2009-11-05 16:53 ` Scott Wood
2009-11-05 14:11 ` Kumar Gala
2009-09-15 21:44 ` [PATCH 6/7] powerpc/86xx: Add power management support for MPC8610HPCD boards Anton Vorontsov
2009-11-05 14:11 ` Kumar Gala
2009-09-15 21:44 ` [PATCH 7/7] powerpc/83xx: Add power management support for MPC83xx QE boards Anton Vorontsov
2009-11-05 14:11 ` Kumar Gala
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=20090915214352.GA24821@oksana.dev.rtsoft.ru \
--to=avorontsov@ru.mvista.com \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=scottwood@freescale.com \
--cc=timur@freescale.com \
/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).