diff options
-rw-r--r-- | arch/powerpc/sysdev/cpm1.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm2.c | 4 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm_common.c | 15 | ||||
-rw-r--r-- | drivers/soc/fsl/qe/qe_common.c | 8 |
4 files changed, 23 insertions, 6 deletions
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c index 3c0eb9b25535..986cd111d4df 100644 --- a/arch/powerpc/sysdev/cpm1.c +++ b/arch/powerpc/sysdev/cpm1.c | |||
@@ -233,8 +233,6 @@ void __init cpm_reset(void) | |||
233 | else | 233 | else |
234 | out_be32(&siu_conf->sc_sdcr, 1); | 234 | out_be32(&siu_conf->sc_sdcr, 1); |
235 | immr_unmap(siu_conf); | 235 | immr_unmap(siu_conf); |
236 | |||
237 | cpm_muram_init(); | ||
238 | } | 236 | } |
239 | 237 | ||
240 | static DEFINE_SPINLOCK(cmd_lock); | 238 | static DEFINE_SPINLOCK(cmd_lock); |
diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c index 8dc1e24f3c23..f78ff841652c 100644 --- a/arch/powerpc/sysdev/cpm2.c +++ b/arch/powerpc/sysdev/cpm2.c | |||
@@ -66,10 +66,6 @@ void __init cpm2_reset(void) | |||
66 | cpm2_immr = ioremap(get_immrbase(), CPM_MAP_SIZE); | 66 | cpm2_immr = ioremap(get_immrbase(), CPM_MAP_SIZE); |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | /* Reclaim the DP memory for our use. | ||
70 | */ | ||
71 | cpm_muram_init(); | ||
72 | |||
73 | /* Tell everyone where the comm processor resides. | 69 | /* Tell everyone where the comm processor resides. |
74 | */ | 70 | */ |
75 | cpmp = &cpm2_immr->im_cpm; | 71 | cpmp = &cpm2_immr->im_cpm; |
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c index 947f42007734..51bf749a4f3a 100644 --- a/arch/powerpc/sysdev/cpm_common.c +++ b/arch/powerpc/sysdev/cpm_common.c | |||
@@ -37,6 +37,21 @@ | |||
37 | #include <linux/of_gpio.h> | 37 | #include <linux/of_gpio.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | static int __init cpm_init(void) | ||
41 | { | ||
42 | struct device_node *np; | ||
43 | |||
44 | np = of_find_compatible_node(NULL, NULL, "fsl,cpm1"); | ||
45 | if (!np) | ||
46 | np = of_find_compatible_node(NULL, NULL, "fsl,cpm2"); | ||
47 | if (!np) | ||
48 | return -ENODEV; | ||
49 | cpm_muram_init(); | ||
50 | of_node_put(np); | ||
51 | return 0; | ||
52 | } | ||
53 | subsys_initcall(cpm_init); | ||
54 | |||
40 | #ifdef CONFIG_PPC_EARLY_DEBUG_CPM | 55 | #ifdef CONFIG_PPC_EARLY_DEBUG_CPM |
41 | static u32 __iomem *cpm_udbg_txdesc; | 56 | static u32 __iomem *cpm_udbg_txdesc; |
42 | static u8 __iomem *cpm_udbg_txbuf; | 57 | static u8 __iomem *cpm_udbg_txbuf; |
diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 41eff805a904..104e68d9b84f 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/fsl/qe/qe_common.c | |||
@@ -70,6 +70,11 @@ int cpm_muram_init(void) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | muram_pool = gen_pool_create(0, -1); | 72 | muram_pool = gen_pool_create(0, -1); |
73 | if (!muram_pool) { | ||
74 | pr_err("Cannot allocate memory pool for CPM/QE muram"); | ||
75 | ret = -ENOMEM; | ||
76 | goto out_muram; | ||
77 | } | ||
73 | muram_pbase = of_translate_address(np, zero); | 78 | muram_pbase = of_translate_address(np, zero); |
74 | if (muram_pbase == (phys_addr_t)OF_BAD_ADDR) { | 79 | if (muram_pbase == (phys_addr_t)OF_BAD_ADDR) { |
75 | pr_err("Cannot translate zero through CPM muram node"); | 80 | pr_err("Cannot translate zero through CPM muram node"); |
@@ -116,6 +121,9 @@ static unsigned long cpm_muram_alloc_common(unsigned long size, | |||
116 | struct muram_block *entry; | 121 | struct muram_block *entry; |
117 | unsigned long start; | 122 | unsigned long start; |
118 | 123 | ||
124 | if (!muram_pool && cpm_muram_init()) | ||
125 | goto out2; | ||
126 | |||
119 | start = gen_pool_alloc_algo(muram_pool, size, algo, data); | 127 | start = gen_pool_alloc_algo(muram_pool, size, algo, data); |
120 | if (!start) | 128 | if (!start) |
121 | goto out2; | 129 | goto out2; |