diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-10-08 20:32:59 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-10-13 12:48:24 -0400 |
commit | c0da99d5f7b0349cb11f970b3283c0d57beb5ec9 (patch) | |
tree | 43c6bf5406b4f93ccb6fd7e1d47b3c1bafd6ebbe /arch/powerpc/sysdev | |
parent | 1fb25be1e74498d389e4de819a6d1b174d6ccb7c (diff) |
powerpc: fix fsl_upm nand driver modular build
The fsl_upm nand driver fails to build because fsl_lbc_lock isn't
exported, the lock is needed by the inlined fsl_upm_run_pattern()
function:
ERROR: "fsl_lbc_lock" [drivers/mtd/nand/fsl_upm.ko] undefined!
Dave Jones purposed to export the lock, but it is better to just uninline
the fsl_upm_run_pattern().
When uninlined we also no longer need the exported fsl_lbc_regs, and
both fsl_lbc_lock and fsl_lbc_regs could be marked static.
While at it, also add some missing includes that we should have included
explicitly.
Reported-by: Dave Jones <davej@redhat.com>
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/fsl_lbc.c | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index 422c8faef593..0494ee55920f 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c | |||
@@ -11,14 +11,19 @@ | |||
11 | * (at your option) any later version. | 11 | * (at your option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/compiler.h> | ||
18 | #include <linux/spinlock.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/io.h> | ||
15 | #include <linux/of.h> | 21 | #include <linux/of.h> |
22 | #include <asm/prom.h> | ||
16 | #include <asm/fsl_lbc.h> | 23 | #include <asm/fsl_lbc.h> |
17 | 24 | ||
18 | spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock); | 25 | static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock); |
19 | 26 | static struct fsl_lbc_regs __iomem *fsl_lbc_regs; | |
20 | struct fsl_lbc_regs __iomem *fsl_lbc_regs; | ||
21 | EXPORT_SYMBOL(fsl_lbc_regs); | ||
22 | 27 | ||
23 | static char __initdata *compat_lbc[] = { | 28 | static char __initdata *compat_lbc[] = { |
24 | "fsl,pq2-localbus", | 29 | "fsl,pq2-localbus", |
@@ -127,3 +132,43 @@ int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm) | |||
127 | return 0; | 132 | return 0; |
128 | } | 133 | } |
129 | EXPORT_SYMBOL(fsl_upm_find); | 134 | EXPORT_SYMBOL(fsl_upm_find); |
135 | |||
136 | /** | ||
137 | * fsl_upm_run_pattern - actually run an UPM pattern | ||
138 | * @upm: pointer to the fsl_upm structure obtained via fsl_upm_find | ||
139 | * @io_base: remapped pointer to where memory access should happen | ||
140 | * @mar: MAR register content during pattern execution | ||
141 | * | ||
142 | * This function triggers dummy write to the memory specified by the io_base, | ||
143 | * thus UPM pattern actually executed. Note that mar usage depends on the | ||
144 | * pre-programmed AMX bits in the UPM RAM. | ||
145 | */ | ||
146 | int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar) | ||
147 | { | ||
148 | int ret = 0; | ||
149 | unsigned long flags; | ||
150 | |||
151 | spin_lock_irqsave(&fsl_lbc_lock, flags); | ||
152 | |||
153 | out_be32(&fsl_lbc_regs->mar, mar << (32 - upm->width)); | ||
154 | |||
155 | switch (upm->width) { | ||
156 | case 8: | ||
157 | out_8(io_base, 0x0); | ||
158 | break; | ||
159 | case 16: | ||
160 | out_be16(io_base, 0x0); | ||
161 | break; | ||
162 | case 32: | ||
163 | out_be32(io_base, 0x0); | ||
164 | break; | ||
165 | default: | ||
166 | ret = -EINVAL; | ||
167 | break; | ||
168 | } | ||
169 | |||
170 | spin_unlock_irqrestore(&fsl_lbc_lock, flags); | ||
171 | |||
172 | return ret; | ||
173 | } | ||
174 | EXPORT_SYMBOL(fsl_upm_run_pattern); | ||