* Re: [PATCH] qe: add function qe_clock_source
From: Timur Tabi @ 2007-10-09 18:17 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <91CB543F-A0F2-42A4-AA5C-6F8FC99F9EC3@kernel.crashing.org>
Kumar Gala wrote:
> But that's a function of linux' use. Remember decouple the device tree
> from how linux does things.
Ok, I just understand what your point is. I'm proposing that we just put the
name of the clock source in the device tree, and have a function which
converts that into an internal representation. The clock is called "BRG3".
It's not called BRG, #3 or something like that. Same thing with the CLK sources.
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply
* Re: Build failure on treeboot-walnut.cg
From: Josh Boyer @ 2007-10-09 18:52 UTC (permalink / raw)
To: Timur Tabi; +Cc: Paul Mackerras, linuxppc-dev, David Gibson
In-Reply-To: <470BA6ED.3020504@freescale.com>
On Tue, 09 Oct 2007 11:06:05 -0500
Timur Tabi <timur@freescale.com> wrote:
> David Gibson wrote:
>
> > Policy. Compiling everything means build bugs - like this one - can
> > be found by everybody, not just those building for the specific
> > obscure platform.
>
> Is this a new policy? Modules in the kernel are not built unless you want
> them. Even in arch/powerpc/platforms, only the specific platform file I'm
> targeting is built. So I don't really understand why you claim it's normal
> for platform-specific files to be built, regardless of the actual platform.
>
> And frankly, I don't like this "policy". Build bugs for 4xx should not
> interfere in my 83xx development. I can't build any kernels now because of
> this bug!
I fixed this bug. It should be in Paul's latest tree. You seem to be
having a different issue with your binutils though.
josh
^ permalink raw reply
* Re: Build failure on treeboot-walnut.cg
From: Kumar Gala @ 2007-10-09 19:14 UTC (permalink / raw)
To: Josh Boyer; +Cc: PowerPC dev list, Paul Mackerras, Timur Tabi, David Gibson
In-Reply-To: <20071009135235.1026bb23@vader.jdub.homelinux.org>
On Oct 9, 2007, at 1:52 PM, Josh Boyer wrote:
> On Tue, 09 Oct 2007 11:06:05 -0500
> Timur Tabi <timur@freescale.com> wrote:
>
>> David Gibson wrote:
>>
>>> Policy. Compiling everything means build bugs - like this one - can
>>> be found by everybody, not just those building for the specific
>>> obscure platform.
>>
>> Is this a new policy? Modules in the kernel are not built unless
>> you want
>> them. Even in arch/powerpc/platforms, only the specific platform
>> file I'm
>> targeting is built. So I don't really understand why you claim
>> it's normal
>> for platform-specific files to be built, regardless of the actual
>> platform.
>>
>> And frankly, I don't like this "policy". Build bugs for 4xx
>> should not
>> interfere in my 83xx development. I can't build any kernels now
>> because of
>> this bug!
>
> I fixed this bug. It should be in Paul's latest tree. You seem to be
> having a different issue with your binutils though.
Just to clarify this is an issue with the particular patched binutils
Timur is using.
I'll leave it to you guys to fight over if we should be building
everything or not.
- k
^ permalink raw reply
* Re: [PATCH] qe: add function qe_clock_source
From: Kumar Gala @ 2007-10-09 19:15 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
In-Reply-To: <470BC5CA.1010105@freescale.com>
On Oct 9, 2007, at 1:17 PM, Timur Tabi wrote:
> Kumar Gala wrote:
>
>> But that's a function of linux' use. Remember decouple the device
>> tree from how linux does things.
>
> Ok, I just understand what your point is. I'm proposing that we
> just put the name of the clock source in the device tree, and have
> a function which converts that into an internal representation.
> The clock is called "BRG3". It's not called BRG, #3 or something
> like that. Same thing with the CLK sources.
Ok. I guess I'm not in favor of changing the device tree to address
this issue. I think it would be solved if "dtc" had #define support.
- k
^ permalink raw reply
* Re: [PATCH] qe: add function qe_clock_source
From: Timur Tabi @ 2007-10-09 19:18 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <B2FD32B4-241E-4FCF-A18D-1E619034EC3A@kernel.crashing.org>
Kumar Gala wrote:
> Ok. I guess I'm not in favor of changing the device tree to address
> this issue. I think it would be solved if "dtc" had #define support.
Not really. The #defines would then need to match the enum, and that's dual
maintenance. This method is better because you can use the real name of the
clock source in the DTS. That keeps the DTS from having to know the internal
representation of clock sources.
(BTW, when I said "I just understand", I meant "I just don't understand".)
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply
* Re: [PATCH] qe: add function qe_clock_source
From: Kumar Gala @ 2007-10-09 19:50 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
In-Reply-To: <470BD3F8.6000006@freescale.com>
On Oct 9, 2007, at 2:18 PM, Timur Tabi wrote:
> Kumar Gala wrote:
>
>> Ok. I guess I'm not in favor of changing the device tree to
>> address this issue. I think it would be solved if "dtc" had
>> #define support.
>
> Not really. The #defines would then need to match the enum, and
> that's dual maintenance. This method is better because you can use
> the real name of the clock source in the DTS. That keeps the DTS
> from having to know the internal representation of clock sources.
>
> (BTW, when I said "I just understand", I meant "I just don't
> understand".)
I misread the idea. I'm ok with using a string, just use a new prop
name and deprecate the old names in booting-without-of.txt
Also, I think Scott suggested this but I'd say parse the string for
"BRG" & "CLK" and the decimal number and use some enum + math rather
than a big lookup table.
- k
^ permalink raw reply
* Hard hang in hypervisor!?
From: Linas Vepstas @ 2007-10-09 20:37 UTC (permalink / raw)
To: linuxppc-dev
I was futzing with linux-2.6.23-rc8-mm1 in a power6 lpar when,
for whatever reason, a spinlock locked up. The bizarre thing
was that the rest of system locked up as well: an ssh terminal,
and also an hvc console.
Breaking into the debugger showed 4 cpus, 1 of which was
deadlocked in the spinlock, and the other 3 in
.pseries_dedicated_idle_sleep
This was, ahhh, unexpected. What's up with that? Can
anyone provide any insight?
I should mention:
-- prior to the complete hard lockp, I did see
BUG: soft lockup - CPU#0 stuck for 11s! [ip:4473]
go off, and I did manage to sneak in a few commands
into the console and the ssh session. Then it locked
up hard -- but still not completely -- exactly
360 seconds later, a kernel thread ran for a while,
producing some console output, even though the
keyboard and console were locked up.
--linas
^ permalink raw reply
* Re: [Linux-fbdev-devel] [PATCH 0/6] Patch series to add of_platform binding to xilinxfb
From: Antonino A. Daplas @ 2007-10-09 21:06 UTC (permalink / raw)
To: Grant Likely
Cc: linuxppc, akonovalov, linux-fbdev-devel, linux-kernel,
Paul Mackerras
In-Reply-To: <fa686aa40710091039hd945eb4n7dfdba3df37a08f2@mail.gmail.com>
On Tue, 2007-10-09 at 11:39 -0600, Grant Likely wrote:
> On 10/8/07, Antonino A. Daplas <adaplas@gmail.com> wrote:
> > On Mon, 2007-10-08 at 22:43 -0600, Grant Likely wrote:
> > > BTW, what path do framebuffer patches take to get into Linus' tree?
> > > Does he pull your tree directly, or do they go through someone else's
> > > tree?
> >
> > They all go to -mm tree, unless it's a needed fix, then to Linus's.
> >
> > Tony
>
> Ah, okay.
>
> Since the XilinxFB is a powerpc-only device, is it okay with you if I
> get Paul Mackerras to merge them into his tree instead (that way the
> changes go in with the platform code which requires these changes)
Fine with me.
Tony
^ permalink raw reply
* Re: Hard hang in hypervisor!?
From: Nathan Lynch @ 2007-10-09 21:18 UTC (permalink / raw)
To: Linas Vepstas; +Cc: linuxppc-dev
In-Reply-To: <20071009203724.GM4350@austin.ibm.com>
Linas Vepstas wrote:
>
> I was futzing with linux-2.6.23-rc8-mm1 in a power6 lpar when,
> for whatever reason, a spinlock locked up. The bizarre thing
> was that the rest of system locked up as well: an ssh terminal,
> and also an hvc console.
>
> Breaking into the debugger showed 4 cpus, 1 of which was
> deadlocked in the spinlock, and the other 3 in
> .pseries_dedicated_idle_sleep
>
> This was, ahhh, unexpected. What's up with that? Can
> anyone provide any insight?
Sounds consistent with a task trying to double-acquire the lock, or an
interrupt handler attempting to acquire a lock that the current task
holds. Or maybe even an uninitialized spinlock. Do you know which
lock it was?
^ permalink raw reply
* Re: Hard hang in hypervisor!?
From: Linas Vepstas @ 2007-10-09 21:28 UTC (permalink / raw)
To: Nathan Lynch; +Cc: linuxppc-dev
In-Reply-To: <20071009211819.GR29559@localdomain>
On Tue, Oct 09, 2007 at 04:18:19PM -0500, Nathan Lynch wrote:
> Linas Vepstas wrote:
> >
> > I was futzing with linux-2.6.23-rc8-mm1 in a power6 lpar when,
> > for whatever reason, a spinlock locked up. The bizarre thing
> > was that the rest of system locked up as well: an ssh terminal,
> > and also an hvc console.
> >
> > Breaking into the debugger showed 4 cpus, 1 of which was
> > deadlocked in the spinlock, and the other 3 in
> > .pseries_dedicated_idle_sleep
> >
> > This was, ahhh, unexpected. What's up with that? Can
> > anyone provide any insight?
>
> Sounds consistent with a task trying to double-acquire the lock, or an
> interrupt handler attempting to acquire a lock that the current task
> holds. Or maybe even an uninitialized spinlock. Do you know which
> lock it was?
Not sure .. trying to find out now. But why would that kill the
ssh session, and the console? Sure, so maybe one cpu is spinning,
but the other three can still take interrupts, right? The ssh session
should have been generating ethernet card interrupts, and the console
should have been generating hvc interrupts.
Err .. it was cpu 0 that was spinlocked. Are interrupts not
distributed?
Perhaps I should IRC this ...
--linas
^ permalink raw reply
* [PATCH] [PPC] Disable vDSO support for ARCH=ppc where it's not implemented.
From: Wolfgang Denk @ 2007-10-09 22:36 UTC (permalink / raw)
To: linuxppc-dev
Signed-off-by: Wolfgang Denk <wd@denx.de>
---
arch/powerpc/kernel/vdso.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 213fa31..2322ba5 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -766,7 +766,9 @@ static int __init vdso_init(void)
return 0;
}
+#ifdef CONFIG_PPC_MERGE
arch_initcall(vdso_init);
+#endif
int in_gate_area_no_task(unsigned long addr)
{
--
1.5.2.2
^ permalink raw reply related
* never mind .. [was Re: Hard hang in hypervisor!?
From: Linas Vepstas @ 2007-10-09 23:22 UTC (permalink / raw)
To: Nathan Lynch; +Cc: linuxppc-dev
In-Reply-To: <20071009212810.GN4350@austin.ibm.com>
On Tue, Oct 09, 2007 at 04:28:10PM -0500, Linas Vepstas wrote:
>
> Perhaps I should IRC this ...
yeah. I guess I'd forgotten how funky things can get. So never mind ...
--linas
^ permalink raw reply
* Re: [stable] [patch 09/12] Fix SMP poweroff hangs
From: Olof Johansson @ 2007-10-10 0:03 UTC (permalink / raw)
To: Linus Torvalds
Cc: Mark Lord, Theodore Ts'o, Zwane Mwaikambo, linuxppc-dev,
Greg KH, Greg KH, Justin Forbes, linux-kernel, Chris Wedgwood,
Domenico Andreoli, Rafael J. Wysocki, stable, Randy Dunlap,
Michael Krufky, Chuck Ebbert, Dave Jones, Thomas Gleixner,
Chuck Wolber, akpm, alan
In-Reply-To: <alpine.LFD.0.999.0710091625520.3838@woody.linux-foundation.org>
On Tue, Oct 09, 2007 at 04:27:06PM -0700, Linus Torvalds wrote:
>
>
> On Wed, 10 Oct 2007, Thomas Gleixner wrote:
> >
> > Wrapping it into a #ifdef CONFIG_X86 would be sufficient.
>
> Well, the ppc oops seems to be a ppc bug regardless.
>
> If CPU_HOTPLUG isn't defined, the thing does nothing. And if it is
> defined, I don't see why/how ppc can validly oops. So I think the first
> thing to do is to try to figure out why it oopses, not to disable it for
> ppc.
The machine Paul tried on most likely has MPIC interrupt controller, and
the oops was when the pseries_cpu_disable tried calling XICS code instead.
It's not surprising that it failed, I don't think IBM has (traditionally)
cared about cpu hotplug on those machines.
So the PPC-side fix is to not enable cpu hotplug on mpic-based
systems. I'll follow up with a patch, but I have no way to test it since
I only have one POWER5 machine, no other IBM hardware. I'd appreciate
it if someone with hardware could verify it.
-Olof
^ permalink raw reply
* [PATCH] powerpc: don't enable cpu hotplug on mpic-based pseries
From: Olof Johansson @ 2007-10-10 0:08 UTC (permalink / raw)
To: Linus Torvalds
Cc: Greg KH, Greg KH, linux-kernel, Chris Wedgwood, linuxppc-dev,
paulus, tgall.foo, Thomas Gleixner, stable
In-Reply-To: <alpine.LFD.0.999.0710091625520.3838@woody.linux-foundation.org>
Don't allow cpu hotplug on systems lacking XICS interrupt controller,
since current platform code is hardcoded for it.
Signed-off-by: Olof Johansson <olof@lixom.net>
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 9711eb0..e29b890 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -252,6 +252,19 @@ static struct notifier_block pseries_smp_nb = {
static int __init pseries_cpu_hotplug_init(void)
{
+ struct device_node *np;
+ const char *typep;
+
+ for (np = NULL; (np = of_find_node_by_name(np,
+ "interrupt-controller"));) {
+ typep = of_get_property(np, "compatible", NULL);
+ if (strstr(typep, "open-pic")) {
+ printk(KERN_INFO "CPU Hotplug not supported on "
+ "systems using MPIC\n");
+ return 0;
+ }
+ }
+
rtas_stop_self_args.token = rtas_token("stop-self");
qcss_tok = rtas_token("query-cpu-stopped-state");
^ permalink raw reply related
* Re: [PATCH] powerpc: don't enable cpu hotplug on mpic-based pseries
From: Stephen Rothwell @ 2007-10-10 0:18 UTC (permalink / raw)
To: Olof Johansson
Cc: Greg KH, Greg KH, linux-kernel, Chris Wedgwood, linuxppc-dev,
paulus, tgall.foo, Thomas Gleixner, Linus Torvalds, stable
In-Reply-To: <20071010000815.GB7875@lixom.net>
[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]
Hi Olof,
On Tue, 9 Oct 2007 19:08:15 -0500 Olof Johansson <olof@lixom.net> wrote:
>
> Don't allow cpu hotplug on systems lacking XICS interrupt controller,
> since current platform code is hardcoded for it.
>
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
>
>
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> index 9711eb0..e29b890 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -252,6 +252,19 @@ static struct notifier_block pseries_smp_nb = {
>
> static int __init pseries_cpu_hotplug_init(void)
> {
> + struct device_node *np;
> + const char *typep;
> +
> + for (np = NULL; (np = of_find_node_by_name(np,
> + "interrupt-controller"));) {
> + typep = of_get_property(np, "compatible", NULL);
> + if (strstr(typep, "open-pic")) {
> + printk(KERN_INFO "CPU Hotplug not supported on "
> + "systems using MPIC\n");
You need an of_node_put(np) here.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [PATCH v2] powerpc: don't enable cpu hotplug on mpic-based pseries
From: Olof Johansson @ 2007-10-10 0:38 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Greg KH, Greg KH, linux-kernel, Chris Wedgwood, linuxppc-dev,
paulus, tgall.foo, Thomas Gleixner, Linus Torvalds, stable
In-Reply-To: <20071010101826.186f1f24.sfr@canb.auug.org.au>
Don't allow cpu hotplug on systems lacking XICS interrupt controller,
since current code is hardcoded for it.
Signed-off-by: Olof Johansson <olof@lixom.net>
---
On Wed, Oct 10, 2007 at 10:18:26AM +1000, Stephen Rothwell wrote:
> > + struct device_node *np;
> > + const char *typep;
> > +
> > + for (np = NULL; (np = of_find_node_by_name(np,
> > + "interrupt-controller"));) {
> > + typep = of_get_property(np, "compatible", NULL);
> > + if (strstr(typep, "open-pic")) {
> > + printk(KERN_INFO "CPU Hotplug not supported on "
> > + "systems using MPIC\n");
>
> You need an of_node_put(np) here.
Grmbl, you're right.
pseries_discover_pic() doesn't have one, that's where I took the above
logic from. So we're obviously already leaking device node references.
Still, no reason to make it worse.
-Olof
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 9711eb0..ae85fc0 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -252,6 +252,21 @@ static struct notifier_block pseries_smp_nb = {
static int __init pseries_cpu_hotplug_init(void)
{
+ struct device_node *np;
+ const char *typep;
+
+ for (np = NULL; (np = of_find_node_by_name(np,
+ "interrupt-controller"));) {
+ typep = of_get_property(np, "compatible", NULL);
+ if (strstr(typep, "open-pic")) {
+ of_node_put(np);
+
+ printk(KERN_INFO "CPU Hotplug not supported on "
+ "systems using MPIC\n");
+ return 0;
+ }
+ }
+
rtas_stop_self_args.token = rtas_token("stop-self");
qcss_tok = rtas_token("query-cpu-stopped-state");
^ permalink raw reply related
* Re: [PATCH] ehea: use kernel event queue
From: Jeff Garzik @ 2007-10-10 0:39 UTC (permalink / raw)
To: Jan-Bernd Themann
Cc: Thomas Klein, Jan-Bernd Themann, netdev, linux-kernel, linux-ppc,
Christoph Raisch, Marcus Eder, Stefan Roscher, Anton Blanchard
In-Reply-To: <200710081601.34067.ossthema@de.ibm.com>
Jan-Bernd Themann wrote:
> eHEA recovery and DLPAR functions are called seldomly. The eHEA workqueues
> are replaced by the kernel event queue.
>
> Signed-off-by: Jan-Bernd Themann <themann@de.ibm.com>
>
> ---
> The patch has been built against upstream git
>
> drivers/net/ehea/ehea.h | 3 +--
> drivers/net/ehea/ehea_main.c | 28 ++++++++--------------------
> drivers/net/ehea/ehea_qmr.c | 3 +--
> 3 files changed, 10 insertions(+), 24 deletions(-)
applied
^ permalink raw reply
* Re: Build failure on treeboot-walnut.cg
From: David Gibson @ 2007-10-10 2:35 UTC (permalink / raw)
To: Timur Tabi; +Cc: Paul Mackerras, linuxppc-dev
In-Reply-To: <470BA6ED.3020504@freescale.com>
On Tue, Oct 09, 2007 at 11:06:05AM -0500, Timur Tabi wrote:
> David Gibson wrote:
>
> > Policy. Compiling everything means build bugs - like this one - can
> > be found by everybody, not just those building for the specific
> > obscure platform.
>
> Is this a new policy? Modules in the kernel are not built unless you want
> them. Even in arch/powerpc/platforms, only the specific platform file I'm
> targeting is built. So I don't really understand why you claim it's normal
> for platform-specific files to be built, regardless of the actual
> platform.
It has been policy as long as we've had the platform+library structure
in arch/powerpc/boot.
> And frankly, I don't like this "policy". Build bugs for 4xx should not
> interfere in my 83xx development. I can't build any kernels now because of
> this bug!
Argue with Paulus.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: Build failure on treeboot-walnut.cg
From: David Gibson @ 2007-10-10 2:35 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, Paul Mackerras, Timur Tabi
In-Reply-To: <20071009160645.GA4304@loki.buserror.net>
On Tue, Oct 09, 2007 at 11:06:45AM -0500, Scott Wood wrote:
> On Tue, Oct 09, 2007 at 01:07:29PM +1000, David Gibson wrote:
> > On Mon, Oct 08, 2007 at 04:33:24PM -0500, Timur Tabi wrote:
> > > Question: I'm building a kernel for the 8610. Why is treeboot-walnut.c
> > > being compiled at all?
> >
> > Policy. Compiling everything means build bugs - like this one - can
> > be found by everybody, not just those building for the specific
> > obscure platform.
>
> Of course, it also introduces bugs that wouldn't have been an issue if we
> didn't try to build everything with the same toolchain. :-P
>
> I'm also somewhat worried what it'll do to build time as platforms
> accumulate.
It also provides incentive to keep the bootwrapper small...
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: include/asm/cpm2.h:14:21: error: asm/cpm.h: No such file or directory
From: Misbah khan @ 2007-10-10 4:03 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <13090379.post@talk.nabble.com>
Please Let me know the Status
Misbah
Misbah khan wrote:
>
>
>
>
> Timur Tabi-3 wrote:
>>
>> Kumar, this is what I get when I compile your 2.6.24 branch for the 8610:
>>
>> CC arch/powerpc/sysdev/fsl_soc.o
>> In file included from arch/powerpc/sysdev/fsl_soc.c:40:
>> include/asm/cpm2.h:14:21: error: asm/cpm.h: No such file or directory
>> make[1]: *** [arch/powerpc/sysdev/fsl_soc.o] Error 1
>> make: *** [arch/powerpc/sysdev] Error 2
>>
>> I guess the file /asm/cpm2.h is not present in the kernel source , You
>> need to go through the source and see what asm file is being provided for
>> you to access the communication processor specific register (i assume you
>> are accessing/assigning to processor register)
>>
>> Commenting out the "#include <asm/cpm.h>" in cpm2.h makes the compilation
>> failure go away, but I don't know if that's the proper fix, since the
>> 8610
>> doesn't have a CPM.
>>
>> Are u including #include <asm/cpm.h> or <asm/cpm2.h> ???????
>>
>> Processor registers are memory mapped and you can access it directly by
>> including proper asm file ,and writing to the structure element of the
>> file by using Pointer to comm processor
>>
>> If you could let me know what is the operation that you need to perform
>> on comm process register and which register you need to access then i
>> could be in better position to help you
>>
>> Misbah
>> --
>> Timur Tabi
>> Linux Kernel Developer @ Freescale
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@ozlabs.org
>> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>>
>>
>
>
--
View this message in context: http://www.nabble.com/include-asm-cpm2.h%3A14%3A21%3A-error%3A-asm-cpm.h%3A-No-such-file-or-directory-tf4571911.html#a13129025
Sent from the linuxppc-dev mailing list archive at Nabble.com.
^ permalink raw reply
* concern related to Functions For executing Longer delay in driver
From: Misbah khan @ 2007-10-10 4:55 UTC (permalink / raw)
To: linuxppc-embedded
Hi all....
I am working on a driver which is Pooling for a bit in hardware. And here is
my concern :-
1. The worst case time delay could be 400 ms for which i am pooling every 50
ms eg :-
while((test_bit(PIC_BUSY,(volatile UINT32*)((void
*)mmap_reg_ptr+FR_FPGA_STATUS_REG))==1)&& (delay < MAX_DELAY_PIC)){
KDEBUG1(" In PIC busy state \n");
msleep_interruptible(PIC_DELAY);
delay +=PIC_DELAY;
}/* End of if() */
2. This function will be called after every 1 min and i do have to poll for
400 ms (worst case) after every 1 min.
3. i have a wait queue Implimented in the driver which will be schedule to
be executed every time interrupt occurs (worst case 1ms).
3. The delay function which will make the driver to poll for the bit in the
hardware which you could see in the above example is
msleep_interruptible(PIC_DELAY);
4. As far as my knowledge we could use either mdelay() ,msleep(),
msleep_interruptible(), or schedule_timeout() for such long delays. I have
used msleep_interruptible() but still i feel as per the senario if i could
get a better option which will make my driver more effecient.
5. Please let me know which could be the best and reliable fn() for this
approach and please let me know the reason also .
Thank you
Misbah
--
View this message in context: http://www.nabble.com/concern-related-to-Functions-For-executing-Longer-delay-in-driver-tf4598583.html#a13129401
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply
* Re: bootwrapper: relative finddevice()
From: David Gibson @ 2007-10-10 5:47 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev@ozlabs.org list
In-Reply-To: <470AA012.9080401@freescale.com>
On Mon, Oct 08, 2007 at 04:24:34PM -0500, Scott Wood wrote:
> I'd like to expose flatdevtree's ability to do relative path lookups in
> ops, and I'd prefer to extend the existing finddevice method rather than
> add a new finddevice_rel. However, I'm not very familiar with real OF
> -- how would one go about fixing its implementation?
Well, it should be possible to do package-to-path on the start node,
join the paths then finddevice on the result. I'm not sure if there's
an easier way.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* [RFC][POWERPC] Add arch/powerpc 4xx NDFC (NAND) support
From: Stefan Roese @ 2007-10-10 6:32 UTC (permalink / raw)
To: linuxppc-dev
This patch makes the PPC4xx NAND flash controller (NDFC) device-tree
friendly using OF glue code to create and insert necessary platform
devices. Such "constructor" approach makes NAND usable under
arch/powerpc yet keeping full compatibility with arch/ppc.
This patch also introduces a "common" (not NOR only)
of_parse_flash_partitions() routine in mtdpart.c that can/should be
used by all drivers parsing device-tree partition informations. The
current implementation is not compatible with the current physmap_of
version and needs some additional work to make it really usable from
both "drivers", physmap_of and ndfc_of. I'm just posting it right now
to get some feedback, since this stuff is already sitting here too
long on my disk and waiting for upstream merge.
Any feedback welcome. Thanks.
Signed-off-by: Stefan Roese <sr@denx.de>
---
commit 721a340398e66872b9cc7e8b630fc92a7681ca04
tree ffbe1194146cb4fc324755f35c9062025b7ec0f6
parent 26f571d7c968dbd30656fc1421eeb0d9088aaad9
author Stefan Roese <sr@denx.de> Mon, 08 Oct 2007 16:00:49 +0200
committer Stefan Roese <sr@denx.de> Mon, 08 Oct 2007 16:00:49 +0200
arch/powerpc/boot/dts/sequoia.dts | 32 +++++++
arch/powerpc/platforms/44x/Makefile | 6 +
arch/powerpc/platforms/44x/ndfc_of.c | 158 ++++++++++++++++++++++++++++++++++
drivers/mtd/mtdpart.c | 61 +++++++++++++
drivers/mtd/nand/ndfc.c | 6 +
include/linux/mtd/partitions.h | 2
6 files changed, 264 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts
index 36be75b..9b15482 100644
--- a/arch/powerpc/boot/dts/sequoia.dts
+++ b/arch/powerpc/boot/dts/sequoia.dts
@@ -122,6 +122,38 @@
interrupt-map-mask = <ffffffff>;
};
+ ndfc@1d0000000, {
+ device_type = "nand";
+ compatible = "ibm,ndfc";
+ reg = <1 d0000000 2000>;
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+ /* ndfc stuff, composed off ndfc_settings. */
+ /* select bank on CE[3], 4 Addr, 1 Col 3 Row 512b page */
+ ccr-settings = <3001000>;
+
+ chip@0 {
+ device_type = "nand-chip";
+ reg = <0 1>;
+ chip-nr = <1>;
+ chip-offset = <3>;
+ chip-delay = <50>;
+ chip-bank-settings = <80002222>;
+
+ /* normal NAND ECC stuff */
+ ecc-bytes = <6>;
+ ecc-pos = <0 1 2 3 6 7>;
+ /* list of tuples assumed here */
+ ecc-oobfree = <8 8>;
+
+ partition@0 {
+ label = "content";
+ reg = <0 0>;
+ };
+ };
+ };
+
POB0: opb {
compatible = "ibm,opb-440epx", "ibm,opb";
#address-cells = <1>;
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index 10ce674..d6195ee 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -1,4 +1,8 @@
obj-$(CONFIG_44x) := misc_44x.o
obj-$(CONFIG_EBONY) += ebony.o
-obj-$(CONFIG_BAMBOO) += bamboo.o
+obj-$(CONFIG_BAMBOO) += bamboo.o
obj-$(CONFIG_SEQUOIA) += sequoia.o
+
+ifeq ($(CONFIG_MTD_NAND_NDFC),y)
+obj-y += ndfc_of.o
+endif
diff --git a/arch/powerpc/platforms/44x/ndfc_of.c b/arch/powerpc/platforms/44x/ndfc_of.c
new file mode 100644
index 0000000..e5b41cf
--- /dev/null
+++ b/arch/powerpc/platforms/44x/ndfc_of.c
@@ -0,0 +1,158 @@
+/*
+ * PPC4xx NAND wrapper from device tree to platform device
+ *
+ * Stefan Roese <sr@denx.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/io.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/ndfc.h>
+#include <linux/of.h>
+
+static struct ndfc_controller_settings ndfc_settings;
+static struct platform_nand_ctrl nand_ctrl = {
+ .priv = &ndfc_settings,
+};
+
+static struct ndfc_chip_settings chip_settings;
+static struct nand_ecclayout ecclayout;
+static struct mtd_partition *nand_parts;
+
+static struct platform_nand_chip nand_chip = {
+ .ecclayout = &ecclayout,
+ .priv = &chip_settings,
+};
+
+static struct resource r;
+
+static struct platform_device ndfc_dev = {
+ .name = "ndfc-nand",
+ .id = 0,
+ .num_resources = 1,
+ .resource = &r,
+ .dev = {
+ .platform_data = &nand_ctrl,
+ }
+};
+
+static struct platform_device nand_dev = {
+ .name = "ndfc-chip",
+ .id = 0,
+ .num_resources = 1,
+ .resource = &r,
+ .dev = {
+ .platform_data = &nand_chip,
+ .parent = &ndfc_dev.dev,
+ }
+};
+
+/* Until this will be settled */
+static inline u32 of_get_int(struct device_node *np, const char *name)
+{
+ unsigned int size;
+ const u32 *prop = of_get_property(np, name, &size);
+
+ if ((prop == NULL) || (size != sizeof(int))) {
+ printk(KERN_WARNING "%s property missing!\n", __FUNCTION__);
+ return 0;
+ }
+
+ return *prop;
+}
+
+static int ppc4xx_setup_nand_chip_node(struct device_node *dev)
+{
+ unsigned int what = -ENODEV;
+ unsigned int size, amnt;
+ const u32 *prop;
+ int i;
+
+ /* process necessary properties */
+ what = of_get_int(dev, "chip-nr");
+ nand_chip.nr_chips = what;
+
+ what = of_get_int(dev, "chip-offset");
+ nand_chip.chip_offset = what;
+
+ what = of_get_int(dev, "chip-delay");
+ nand_chip.chip_delay = what;
+
+ what = of_get_int(dev, "ecc-bytes");
+ ecclayout.eccbytes = what;
+
+ what = of_get_int(dev, "chip-bank-settings");
+ chip_settings.bank_settings = what;
+
+ prop = of_get_property(dev, "ecc-pos", &size);
+ for (i = 0; i < (size/sizeof(unsigned int)); i++)
+ ecclayout.eccpos[i] = prop[i];
+
+ prop = of_get_property(dev, "ecc-oobfree", &size);
+ amnt = size/sizeof(unsigned int);
+
+ for (i = 0; i < amnt; i += 2) {
+ nand_chip.ecclayout->oobfree[i].offset = prop[i];
+ nand_chip.ecclayout->oobfree[i].length = prop[i+1];
+ }
+
+ nand_chip.nr_partitions = of_parse_flash_partitions(dev, &nand_parts);
+ nand_chip.partitions = nand_parts;
+
+ return 0;
+}
+
+static int __init ppc4xx_setup_nand_node(struct device_node *dev)
+{
+ struct device_node *child = NULL;
+ int ret = 0;
+
+ memset(&r, 0, sizeof(r));
+
+ /* generic NDFC register */
+ ret = of_address_to_resource(dev, 0, &r);
+ if (ret)
+ goto err;
+
+ /* Now let's create platform_data stuff based on dts entries */
+ ret = of_get_int(dev, "ccr-settings");
+
+ ndfc_settings.ccr_settings = ret;
+ ndfc_settings.ndfc_erpn = r.start & 0xf00000000ULL;
+
+ child = of_get_next_child(dev, NULL);
+ /* NAND platform device is sole, so assuming one child of ndfc node */
+ if (child != NULL)
+ ppc4xx_setup_nand_chip_node(child);
+
+ ndfc_dev.resource = &r;
+ nand_dev.resource = &r;
+
+ platform_device_register(&ndfc_dev);
+ platform_device_register(&nand_dev);
+
+err:
+ return ret;
+}
+
+static int ppc4xx_init_nand(void)
+{
+ struct device_node *np =
+ of_find_compatible_node(NULL, "nand", "ibm,ndfc");
+
+ if (np != NULL)
+ ppc4xx_setup_nand_node(np);
+
+ return 0;
+}
+arch_initcall(ppc4xx_init_nand);
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 6174a97..cc620ee 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -21,6 +21,10 @@
#include <linux/mtd/partitions.h>
#include <linux/mtd/compatmac.h>
+#ifdef CONFIG_PPC_MERGE
+#include <linux/of.h>
+#endif
+
/* Our partition linked list */
static LIST_HEAD(mtd_partitions);
@@ -557,6 +561,63 @@ int parse_mtd_partitions(struct mtd_info *master, const char **types,
return ret;
}
+#ifdef CONFIG_PPC_MERGE
+int of_parse_flash_partitions(struct device_node *dp,
+ struct mtd_partition **mparts)
+{
+ int nr_parts = 0;
+ int i;
+ struct device_node *pp;
+ const char *partname;
+ struct mtd_partition *parts;
+
+ /* First count the subnodes */
+ for (pp = dp->child; pp; pp = pp->sibling)
+ nr_parts++;
+
+ if (nr_parts) {
+ parts = kzalloc(nr_parts * sizeof(struct mtd_partition),
+ GFP_KERNEL);
+ if (!parts) {
+ printk(KERN_ERR
+ "Can't allocate the flash partition data!\n");
+ return -ENOMEM;
+ }
+
+ for (pp = dp->child, i = 0 ; pp; pp = pp->sibling, i++) {
+ const u32 *reg;
+ int len;
+
+ reg = of_get_property(pp, "reg", &len);
+ if (!reg || (len != 2*sizeof(u32))) {
+ printk(KERN_ERR "Invalid 'reg' on %s\n",
+ dp->full_name);
+ kfree(parts);
+ parts = NULL;
+ return -EINVAL;
+ }
+ parts[i].offset = reg[0];
+ parts[i].size = reg[1];
+
+ partname = of_get_property(pp, "label", &len);
+ if (!partname)
+ partname = of_get_property(pp, "name", &len);
+ parts[i].name = (char *)partname;
+ if (of_get_property(pp, "read-only", &len))
+ parts[i].mask_flags = MTD_WRITEABLE;
+ (*mparts) = parts;
+ }
+ } else {
+ printk(KERN_ERR
+ "Node %s does not seem to contain partitions definition!\n",
+ dp->full_name);
+ return -EINVAL;
+ }
+
+ return nr_parts;
+}
+#endif
+
EXPORT_SYMBOL_GPL(parse_mtd_partitions);
EXPORT_SYMBOL_GPL(register_mtd_parser);
EXPORT_SYMBOL_GPL(deregister_mtd_parser);
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index fd7a8d5..7901019 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -24,7 +24,9 @@
#include <linux/platform_device.h>
#include <asm/io.h>
+#ifndef CONFIG_PPC_MERGE
#include <asm/ibm44x.h>
+#endif
struct ndfc_nand_mtd {
struct mtd_info mtd;
@@ -230,7 +232,11 @@ static int ndfc_nand_probe(struct platform_device *pdev)
struct ndfc_controller *ndfc = &ndfc_ctrl;
unsigned long long phys = settings->ndfc_erpn | res->start;
+#if !defined(CONFIG_PHYS_64BIT) || defined(CONFIG_PPC_MERGE)
+ ndfc->ndfcbase = ioremap((phys_addr_t)phys, res->end - res->start + 1);
+#else
ndfc->ndfcbase = ioremap64(phys, res->end - res->start + 1);
+#endif
if (!ndfc->ndfcbase) {
printk(KERN_ERR "NDFC: ioremap failed\n");
return -EIO;
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index da6b3d6..546a098 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -68,6 +68,8 @@ extern int register_mtd_parser(struct mtd_part_parser *parser);
extern int deregister_mtd_parser(struct mtd_part_parser *parser);
extern int parse_mtd_partitions(struct mtd_info *master, const char **types,
struct mtd_partition **pparts, unsigned long origin);
+extern int of_parse_flash_partitions(struct device_node *node,
+ struct mtd_partition **parts);
#define put_partition_parser(p) do { module_put((p)->owner); } while(0)
^ permalink raw reply related
* Re: [linux-usb-devel] [PATCH 0/3] usb: ehci ppc device-tree-aware driver
From: David Brownell @ 2007-10-10 6:27 UTC (permalink / raw)
To: linux-usb-devel; +Cc: linuxppc-dev
In-Reply-To: <20070924192519.GA4192@ru.mvista.com>
On Monday 24 September 2007, Valentine Barshak wrote:
> Some PowerPC systems have a built-in EHCI controller.
> This is a device tree aware version of the EHCI controller driver.
> Currently it's been tested on the PowerPC 440EPx Sequoia board.
> Other platforms can be added later.
> The code is based on the ehci-ppc-soc driver by Stefan Roese <sr@denx.de>.
Do PPC folk sign off on how this is done?
I don't follow all the ins/outs of the OF devtree stuff...
^ permalink raw reply
* Re: [RFC][POWERPC] Add arch/powerpc 4xx NDFC (NAND) support
From: David Gibson @ 2007-10-10 6:38 UTC (permalink / raw)
To: Stefan Roese; +Cc: linuxppc-dev
In-Reply-To: <200710100832.13105.sr@denx.de>
On Wed, Oct 10, 2007 at 08:32:12AM +0200, Stefan Roese wrote:
> This patch makes the PPC4xx NAND flash controller (NDFC) device-tree
> friendly using OF glue code to create and insert necessary platform
> devices. Such "constructor" approach makes NAND usable under
> arch/powerpc yet keeping full compatibility with arch/ppc.
>
> This patch also introduces a "common" (not NOR only)
> of_parse_flash_partitions() routine in mtdpart.c that can/should be
> used by all drivers parsing device-tree partition informations. The
> current implementation is not compatible with the current physmap_of
> version and needs some additional work to make it really usable from
> both "drivers", physmap_of and ndfc_of. I'm just posting it right now
> to get some feedback, since this stuff is already sitting here too
> long on my disk and waiting for upstream merge.
>
> Any feedback welcome. Thanks.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
>
> ---
> commit 721a340398e66872b9cc7e8b630fc92a7681ca04
> tree ffbe1194146cb4fc324755f35c9062025b7ec0f6
> parent 26f571d7c968dbd30656fc1421eeb0d9088aaad9
> author Stefan Roese <sr@denx.de> Mon, 08 Oct 2007 16:00:49 +0200
> committer Stefan Roese <sr@denx.de> Mon, 08 Oct 2007 16:00:49 +0200
>
> arch/powerpc/boot/dts/sequoia.dts | 32 +++++++
> arch/powerpc/platforms/44x/Makefile | 6 +
> arch/powerpc/platforms/44x/ndfc_of.c | 158 ++++++++++++++++++++++++++++++++++
> drivers/mtd/mtdpart.c | 61 +++++++++++++
> drivers/mtd/nand/ndfc.c | 6 +
> include/linux/mtd/partitions.h | 2
> 6 files changed, 264 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts
> index 36be75b..9b15482 100644
> --- a/arch/powerpc/boot/dts/sequoia.dts
> +++ b/arch/powerpc/boot/dts/sequoia.dts
> @@ -122,6 +122,38 @@
> interrupt-map-mask = <ffffffff>;
> };
>
> + ndfc@1d0000000, {
> + device_type = "nand";
Ditch the device_type. There's no call for it here.
> + compatible = "ibm,ndfc";
This should probably have a more specific value for the revision in
addition to ibm,ndfc.
> + reg = <1 d0000000 2000>;
> +
> + #address-cells = <1>;
> + #size-cells = <1>;
> + /* ndfc stuff, composed off ndfc_settings. */
> + /* select bank on CE[3], 4 Addr, 1 Col 3 Row 512b page */
> + ccr-settings = <3001000>;
> +
> + chip@0 {
> + device_type = "nand-chip";
Ditch this device_type too, it makes absolutely no sense here. You
probably should have a compatible, though.
> + reg = <0 1>;
I don't really know how the ndfc works. Can the reg size here ever be
anything other than 1 sensibly? If not, then you should set
#size-cells=0 instead.
> + chip-nr = <1>;
> + chip-offset = <3>;
> + chip-delay = <50>;
> + chip-bank-settings = <80002222>;
> +
> + /* normal NAND ECC stuff */
> + ecc-bytes = <6>;
> + ecc-pos = <0 1 2 3 6 7>;
> + /* list of tuples assumed here */
> + ecc-oobfree = <8 8>;
> +
> + partition@0 {
Ok, the partitions really are per-chip, not across the controller's
domain as a whole? Oh and if this is here, then the chip needs
#address-cells and #size-cells.
> + label = "content";
> + reg = <0 0>;
> + };
> + };
> + };
> +
> POB0: opb {
> compatible = "ibm,opb-440epx", "ibm,opb";
> #address-cells = <1>;
> diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
> index 10ce674..d6195ee 100644
> --- a/arch/powerpc/platforms/44x/Makefile
> +++ b/arch/powerpc/platforms/44x/Makefile
> @@ -1,4 +1,8 @@
> obj-$(CONFIG_44x) := misc_44x.o
> obj-$(CONFIG_EBONY) += ebony.o
> -obj-$(CONFIG_BAMBOO) += bamboo.o
> +obj-$(CONFIG_BAMBOO) += bamboo.o
> obj-$(CONFIG_SEQUOIA) += sequoia.o
> +
> +ifeq ($(CONFIG_MTD_NAND_NDFC),y)
> +obj-y += ndfc_of.o
> +endif
> diff --git a/arch/powerpc/platforms/44x/ndfc_of.c b/arch/powerpc/platforms/44x/ndfc_of.c
> new file mode 100644
> index 0000000..e5b41cf
> --- /dev/null
> +++ b/arch/powerpc/platforms/44x/ndfc_of.c
> @@ -0,0 +1,158 @@
> +/*
> + * PPC4xx NAND wrapper from device tree to platform device
> + *
> + * Stefan Roese <sr@denx.de>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + */
> +
> +#include <linux/stddef.h>
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/errno.h>
> +#include <linux/io.h>
> +#include <linux/mtd/mtd.h>
> +#include <linux/mtd/partitions.h>
> +#include <linux/mtd/nand.h>
> +#include <linux/mtd/ndfc.h>
> +#include <linux/of.h>
> +
> +static struct ndfc_controller_settings ndfc_settings;
> +static struct platform_nand_ctrl nand_ctrl = {
> + .priv = &ndfc_settings,
> +};
> +
> +static struct ndfc_chip_settings chip_settings;
> +static struct nand_ecclayout ecclayout;
> +static struct mtd_partition *nand_parts;
> +
> +static struct platform_nand_chip nand_chip = {
> + .ecclayout = &ecclayout,
> + .priv = &chip_settings,
> +};
> +
> +static struct resource r;
> +
> +static struct platform_device ndfc_dev = {
> + .name = "ndfc-nand",
> + .id = 0,
> + .num_resources = 1,
> + .resource = &r,
> + .dev = {
> + .platform_data = &nand_ctrl,
> + }
> +};
> +
> +static struct platform_device nand_dev = {
> + .name = "ndfc-chip",
> + .id = 0,
> + .num_resources = 1,
> + .resource = &r,
> + .dev = {
> + .platform_data = &nand_chip,
> + .parent = &ndfc_dev.dev,
> + }
> +};
> +
> +/* Until this will be settled */
> +static inline u32 of_get_int(struct device_node *np, const char *name)
> +{
> + unsigned int size;
> + const u32 *prop = of_get_property(np, name, &size);
> +
> + if ((prop == NULL) || (size != sizeof(int))) {
> + printk(KERN_WARNING "%s property missing!\n", __FUNCTION__);
> + return 0;
> + }
> +
> + return *prop;
> +}
> +
> +static int ppc4xx_setup_nand_chip_node(struct device_node *dev)
> +{
> + unsigned int what = -ENODEV;
> + unsigned int size, amnt;
> + const u32 *prop;
> + int i;
> +
> + /* process necessary properties */
> + what = of_get_int(dev, "chip-nr");
> + nand_chip.nr_chips = what;
> +
> + what = of_get_int(dev, "chip-offset");
> + nand_chip.chip_offset = what;
> +
> + what = of_get_int(dev, "chip-delay");
> + nand_chip.chip_delay = what;
> +
> + what = of_get_int(dev, "ecc-bytes");
> + ecclayout.eccbytes = what;
> +
> + what = of_get_int(dev, "chip-bank-settings");
> + chip_settings.bank_settings = what;
> +
> + prop = of_get_property(dev, "ecc-pos", &size);
> + for (i = 0; i < (size/sizeof(unsigned int)); i++)
> + ecclayout.eccpos[i] = prop[i];
> +
> + prop = of_get_property(dev, "ecc-oobfree", &size);
> + amnt = size/sizeof(unsigned int);
> +
> + for (i = 0; i < amnt; i += 2) {
> + nand_chip.ecclayout->oobfree[i].offset = prop[i];
> + nand_chip.ecclayout->oobfree[i].length = prop[i+1];
> + }
> +
> + nand_chip.nr_partitions = of_parse_flash_partitions(dev, &nand_parts);
> + nand_chip.partitions = nand_parts;
> +
> + return 0;
> +}
> +
> +static int __init ppc4xx_setup_nand_node(struct device_node *dev)
> +{
> + struct device_node *child = NULL;
> + int ret = 0;
> +
> + memset(&r, 0, sizeof(r));
> +
> + /* generic NDFC register */
> + ret = of_address_to_resource(dev, 0, &r);
> + if (ret)
> + goto err;
> +
> + /* Now let's create platform_data stuff based on dts entries */
> + ret = of_get_int(dev, "ccr-settings");
> +
> + ndfc_settings.ccr_settings = ret;
> + ndfc_settings.ndfc_erpn = r.start & 0xf00000000ULL;
> +
> + child = of_get_next_child(dev, NULL);
> + /* NAND platform device is sole, so assuming one child of ndfc node */
> + if (child != NULL)
> + ppc4xx_setup_nand_chip_node(child);
> +
> + ndfc_dev.resource = &r;
> + nand_dev.resource = &r;
> +
> + platform_device_register(&ndfc_dev);
> + platform_device_register(&nand_dev);
> +
> +err:
> + return ret;
> +}
> +
> +static int ppc4xx_init_nand(void)
> +{
> + struct device_node *np =
> + of_find_compatible_node(NULL, "nand", "ibm,ndfc");
> +
> + if (np != NULL)
> + ppc4xx_setup_nand_node(np);
> +
> + return 0;
> +}
> +arch_initcall(ppc4xx_init_nand);
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 6174a97..cc620ee 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -21,6 +21,10 @@
> #include <linux/mtd/partitions.h>
> #include <linux/mtd/compatmac.h>
>
> +#ifdef CONFIG_PPC_MERGE
> +#include <linux/of.h>
> +#endif
> +
> /* Our partition linked list */
> static LIST_HEAD(mtd_partitions);
>
> @@ -557,6 +561,63 @@ int parse_mtd_partitions(struct mtd_info *master, const char **types,
> return ret;
> }
>
> +#ifdef CONFIG_PPC_MERGE
> +int of_parse_flash_partitions(struct device_node *dp,
> + struct mtd_partition **mparts)
> +{
> + int nr_parts = 0;
> + int i;
> + struct device_node *pp;
> + const char *partname;
> + struct mtd_partition *parts;
> +
> + /* First count the subnodes */
> + for (pp = dp->child; pp; pp = pp->sibling)
> + nr_parts++;
> +
> + if (nr_parts) {
> + parts = kzalloc(nr_parts * sizeof(struct mtd_partition),
> + GFP_KERNEL);
> + if (!parts) {
> + printk(KERN_ERR
> + "Can't allocate the flash partition data!\n");
> + return -ENOMEM;
> + }
> +
> + for (pp = dp->child, i = 0 ; pp; pp = pp->sibling, i++) {
> + const u32 *reg;
> + int len;
> +
> + reg = of_get_property(pp, "reg", &len);
> + if (!reg || (len != 2*sizeof(u32))) {
> + printk(KERN_ERR "Invalid 'reg' on %s\n",
> + dp->full_name);
> + kfree(parts);
> + parts = NULL;
> + return -EINVAL;
> + }
> + parts[i].offset = reg[0];
> + parts[i].size = reg[1];
> +
> + partname = of_get_property(pp, "label", &len);
> + if (!partname)
> + partname = of_get_property(pp, "name", &len);
> + parts[i].name = (char *)partname;
> + if (of_get_property(pp, "read-only", &len))
> + parts[i].mask_flags = MTD_WRITEABLE;
> + (*mparts) = parts;
> + }
> + } else {
> + printk(KERN_ERR
> + "Node %s does not seem to contain partitions definition!\n",
> + dp->full_name);
> + return -EINVAL;
> + }
> +
> + return nr_parts;
> +}
> +#endif
> +
> EXPORT_SYMBOL_GPL(parse_mtd_partitions);
> EXPORT_SYMBOL_GPL(register_mtd_parser);
> EXPORT_SYMBOL_GPL(deregister_mtd_parser);
> diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
> index fd7a8d5..7901019 100644
> --- a/drivers/mtd/nand/ndfc.c
> +++ b/drivers/mtd/nand/ndfc.c
> @@ -24,7 +24,9 @@
> #include <linux/platform_device.h>
>
> #include <asm/io.h>
> +#ifndef CONFIG_PPC_MERGE
> #include <asm/ibm44x.h>
> +#endif
>
> struct ndfc_nand_mtd {
> struct mtd_info mtd;
> @@ -230,7 +232,11 @@ static int ndfc_nand_probe(struct platform_device *pdev)
> struct ndfc_controller *ndfc = &ndfc_ctrl;
> unsigned long long phys = settings->ndfc_erpn | res->start;
>
> +#if !defined(CONFIG_PHYS_64BIT) || defined(CONFIG_PPC_MERGE)
> + ndfc->ndfcbase = ioremap((phys_addr_t)phys, res->end - res->start + 1);
> +#else
> ndfc->ndfcbase = ioremap64(phys, res->end - res->start + 1);
> +#endif
> if (!ndfc->ndfcbase) {
> printk(KERN_ERR "NDFC: ioremap failed\n");
> return -EIO;
> diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
> index da6b3d6..546a098 100644
> --- a/include/linux/mtd/partitions.h
> +++ b/include/linux/mtd/partitions.h
> @@ -68,6 +68,8 @@ extern int register_mtd_parser(struct mtd_part_parser *parser);
> extern int deregister_mtd_parser(struct mtd_part_parser *parser);
> extern int parse_mtd_partitions(struct mtd_info *master, const char **types,
> struct mtd_partition **pparts, unsigned long origin);
> +extern int of_parse_flash_partitions(struct device_node *node,
> + struct mtd_partition **parts);
>
> #define put_partition_parser(p) do { module_put((p)->owner); } while(0)
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox