diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-09-15 17:43:52 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2009-11-11 22:43:13 -0500 |
commit | 0c7b87b0857f0e17be982fd840046444a83c3996 (patch) | |
tree | 4a03a62678cd4725d5216dbf1fb550bed366908b /arch/powerpc/sysdev | |
parent | dc2e673dbcbaebdf84c09956b85c3be3a8b7bd02 (diff) |
powerpc/qe: Make qe_reset() code path safe for repeated invocation
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>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/cpm_common.c | 5 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe.c | 12 |
2 files changed, 11 insertions, 6 deletions
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c index e4b6d66d93de..9de72c96e6d1 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; | |||
72 | /* Max address size we deal with */ | 72 | /* Max address size we deal with */ |
73 | #define OF_MAX_ADDR_CELLS 4 | 73 | #define OF_MAX_ADDR_CELLS 4 |
74 | 74 | ||
75 | int __init cpm_muram_init(void) | 75 | int cpm_muram_init(void) |
76 | { | 76 | { |
77 | struct device_node *np; | 77 | struct device_node *np; |
78 | struct resource r; | 78 | struct resource r; |
@@ -81,6 +81,9 @@ int __init cpm_muram_init(void) | |||
81 | int i = 0; | 81 | int i = 0; |
82 | int ret = 0; | 82 | int ret = 0; |
83 | 83 | ||
84 | if (muram_pbase) | ||
85 | return 0; | ||
86 | |||
84 | spin_lock_init(&cpm_muram_lock); | 87 | spin_lock_init(&cpm_muram_lock); |
85 | /* initialize the info header */ | 88 | /* initialize the info header */ |
86 | rh_init(&cpm_muram_info, 1, | 89 | 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 fff2701b90df..1ed1a9fd9bcf 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) | |||
104 | 104 | ||
105 | EXPORT_SYMBOL(get_qe_base); | 105 | EXPORT_SYMBOL(get_qe_base); |
106 | 106 | ||
107 | void __init qe_reset(void) | 107 | void qe_reset(void) |
108 | { | 108 | { |
109 | if (qe_immr == NULL) | 109 | if (qe_immr == NULL) |
110 | qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE); | 110 | qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE); |
@@ -330,16 +330,18 @@ EXPORT_SYMBOL(qe_put_snum); | |||
330 | static int qe_sdma_init(void) | 330 | static int qe_sdma_init(void) |
331 | { | 331 | { |
332 | struct sdma __iomem *sdma = &qe_immr->sdma; | 332 | struct sdma __iomem *sdma = &qe_immr->sdma; |
333 | unsigned long sdma_buf_offset; | 333 | static unsigned long sdma_buf_offset = (unsigned long)-ENOMEM; |
334 | 334 | ||
335 | if (!sdma) | 335 | if (!sdma) |
336 | return -ENODEV; | 336 | return -ENODEV; |
337 | 337 | ||
338 | /* allocate 2 internal temporary buffers (512 bytes size each) for | 338 | /* allocate 2 internal temporary buffers (512 bytes size each) for |
339 | * the SDMA */ | 339 | * the SDMA */ |
340 | sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); | 340 | if (IS_ERR_VALUE(sdma_buf_offset)) { |
341 | if (IS_ERR_VALUE(sdma_buf_offset)) | 341 | sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); |
342 | return -ENOMEM; | 342 | if (IS_ERR_VALUE(sdma_buf_offset)) |
343 | return -ENOMEM; | ||
344 | } | ||
343 | 345 | ||
344 | out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK); | 346 | out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK); |
345 | out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | | 347 | out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | |