* Re: [PATCH] powerpc: Xilinx: add 440 platform support
From: Josh Boyer @ 2008-07-03 13:14 UTC (permalink / raw)
To: John Linn; +Cc: linuxppc-dev, John Linn
In-Reply-To: <20080701224829.EC51111E8013@mail35-sin.bigfish.com>
On Tue, 1 Jul 2008 15:48:26 -0700
John Linn <john.linn@xilinx.com> wrote:
> Support for the Xilinx Virtex5 FXT 440 is being
> added.
>
> Signed-off-by: John Linn <john.linn@xilinx.com>
> ---
> arch/powerpc/platforms/44x/Kconfig | 25 ++++++++++++++
> arch/powerpc/platforms/44x/Makefile | 1 +
> arch/powerpc/platforms/44x/virtex.c | 60 +++++++++++++++++++++++++++++++++++
> 3 files changed, 86 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/platforms/44x/virtex.c
>
> diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
> index 6abe913..84eb847 100644
> --- a/arch/powerpc/platforms/44x/Kconfig
> +++ b/arch/powerpc/platforms/44x/Kconfig
> @@ -102,6 +102,22 @@ config YOSEMITE
> # help
> # This option enables support for the IBM PPC440GX evaluation board.
>
> +config XILINX_VIRTEX440_GENERIC_BOARD
> + bool "Generic Xilinx Virtex 440 board"
> + depends on 44x
> + default n
> + select XILINX_VIRTEX_5_FXT
If this is for generic Virtex 440 board support, why is it selecting a
specific Virtex 5 board? Or am I confused as to what
XILINX_VIRTEX_5_FXT is?
josh
^ permalink raw reply
* Re: linux-next: manual merge of the powerpc tree
From: Jon Smirl @ 2008-07-03 12:22 UTC (permalink / raw)
To: Grant Likely
Cc: Stephen Rothwell, linuxppc-dev, linux-next, Paul Mackerras,
Jean Delvare, Timur Tabi
In-Reply-To: <20080703054739.GA643@secretlab.ca>
On 7/3/08, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Thu, Jul 03, 2008 at 01:39:05PM +1000, Stephen Rothwell wrote:
> > Hi Paul,
> >
> > Today's linux-next merge of the powerpc tree got a conflict in
> > arch/powerpc/sysdev/fsl_soc.c between commit
> > 4eac6a8b17ce5ebe66eb94b6a0b43aa3a2bf7ea6 ("i2c-mpc: Convert to an
> > of_platform driver") from the i2c tree and commits
>
>
> It probably would have been better for this patch to go in via the
> PowerPC tree. It only touches powerpc-specific i2c code, not any i2c
> core code. There are quite a few MPCxxxx ports which use this driver,
> I'd be happier to see it dropped from the i2c tree and merged in via
> either Kumar or myself.
>
> I'd also like to see some acks from people who have tested this patch
> before it goes in. (I'm just as guilty here; I'll apply it and test it
> to my tree tomorrow).
I'm using it in my system. It doesn't change the function of the i2c
controller, only how drivers get loaded. So if you boot and your
devices are there it is working.
Testing was good when the patch was initially posted in January. In
the last six months the initial patch set has been sliced and diced
into a bunch of different pieces but the contents of this patch are
essentially unchanged.
I don't care which tree it uses to get to mainline, I'd just like to
see it get merged.
>
>
> g.
>
>
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Linux on ML403 serial console problem
From: Anand Kumar S @ 2008-07-03 10:12 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 4849 bytes --]
Hi,
I am using MVL 4.0.1 to boot on ML403 board. I have created the
xparameters.h file using EDK 10.1 and I was able to boot the kernel with
32 MB of memory and UART set as std 16550 uart.
Since this board came without sysace flash card I am using ramdisk
technique to boot linux. I created a small ramdisk with my test program
which sleeps for 10 seconds and prints a hello
world using printf. I modified kernel init/main.c to execute /bin/test
(my test program) from the RAMDISK. I created the ramdisk and appended
with zImage using make zImage.initrd command
I used dow method from xmd to download the zImage.initrd.elf on the
board and I was able to boot the board till the point of executing my
/bin/test. However I see that the print statements
from my test program are not coming on the serial port. I see that the
printf calls tty_io write and it goes to uart_write routine in
serial_core.c, however I am not able to see my prints on
the hyperterminal. I can see all the kernel printks except for this
printf statement from my user program. Also all the kernel printks seem
to call serial_8250_console write routine but the
user application seems to call the uart_write routine. Does someone have
any idea about what might be going wrong here? Is it something to do
with serial console settings ?
Any help is greatly appreciated as I am really struggling with this
problem for the past 3 days. Given below is the output from serial port.
I do not have FB support or VT or VT console
Support enabled. Only SERIAL console support is enabled i.e
SERIAL_CORE_CONSOLE/SERIAL_8250_CONSOLE support is enabled
......
......
Serial: 8250/16550 driver $Revision: 1.90 $ 5 ports, IRQ sharing
disabled
Registering platform device 'serial8250'. Parent at platform
ttyS0 at MMIO 0x0 (irq = 9) is a 16550A
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
loop: loaded (max 8 devices)
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
NET: Registered protocol family 24
xemac 0: using fifo mode.
eth0: Xilinx EMAC #0 at 81000000 mapped to 0xC30C0000, irq=0
i2c /dev entries driver
xilinx_iic.0 #0 at 0x81600000 mapped to 0xC30E0000, irq=6
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 2048 bind 4096)
NET: Registered protocol family 1
NET: Registered protocol family 17
interrupts enabled
TX interrupts enabled. register baseaddr c30c0000 offset 7fc is 8
TX interrupts enabled. register baseaddr c30c0000 offset ffc is 0
RX interrupts enabled. register baseaddr c30c0000 offset 17fc is 9
RX interrupts enabled. register baseaddr c30c0000 offset 1ffc is 0
GIER interrupts enabled. register baseaddr c30c0000 offset 7f8 is
80000000
Sending DHCP requests .,... OK
IP-Config: Got DHCP answer from 0.0.0.0, my address is 10.100.12.132
IP-Config: Complete:
device=eth0, addr=10.100.12.132, mask=255.255.255.0,
gw=10.100.12.1,
host=10.100.12.132, domain=hclt.corp.hcl.in, nis-domain=(none),
bootserver=0.0.0.0, rootserver=0.0.0.0, rootpath=
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 124k init
done freeing memory. creating console
console created
running process /bin/test
in tty_write
before calling write. buf contents h e l
core write
core write
core write
Kernel panic - not syncing: Attempted to kill init!
<0>Rebooting in 180 seconds..<NULL>
DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------
[-- Attachment #2: Type: text/html, Size: 15235 bytes --]
^ permalink raw reply
* More commits added to powerpc.git master and powerpc-next branches
From: Paul Mackerras @ 2008-07-03 9:47 UTC (permalink / raw)
To: linuxppc-dev
The following patches have been added to the master and powerpc-next
branches of powerpc.git.
Paul.
Kumar Gala (2):
powerpc: Fix building of feature-fixup tests on ppc32
powerpc: Fixup lwsync at runtime
Michael Neuling (3):
powerpc: Fix compile warning in init_thread
powerpc: Clean up copy_to/from_user for vsx and fpr
powerpc: Remove old dump_task_* functions
Nathan Fontenot (5):
powerpc/pseries: Allow phandle to be specified in formats other than decimal
powerpc/pseries: Use base address to derive starting page frame number
powerpc/pseries: Update the device tree correctly for drconf memory add/remove
powerpc/pseries: Split code into helper routines for drconf memory
powerpc/pseries: Update numa association of hotplug memory add for drconf memory
Tony Breeds (1):
powerpc: Fix building of arch/powerpc/mm/mem.o when MEMORY_HOTPLUG=y and SPARSEMEM=n
^ permalink raw reply
* where can i find a kdb patch for my MPC8313 platform
From: 旭 罗 @ 2008-07-03 8:40 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Wood Scoott
[-- Attachment #1: Type: text/plain, Size: 431 bytes --]
Hello all:
I hope add the KDB function for my mpc8313 platform. I find some informations from the ftp://oss.sgi.com/projects/kdb/download . But i only find the comman patch and a patch for X86 system. Hi Scoott i think you have ever used the KDB to debug the MPC8313. Could you tell me where can i find the patch for the MPC8313.
Thanks
Best wishs
Steven
---------------------------------
雅虎邮箱,您的终生邮箱!
[-- Attachment #2: Type: text/html, Size: 497 bytes --]
^ permalink raw reply
* Re: linux-next: generic-ipi tree build failure
From: Ingo Molnar @ 2008-07-03 7:26 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev, linux-next, Paul Mackerras, Jens Axboe
In-Reply-To: <20080703171007.5a17ea25.sfr@canb.auug.org.au>
* Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Hi Ingo, Jens,
>
> Today's linux-next build (powerpc ppc64_defconfig) failed like this:
>
> arch/powerpc/mm/tlb_64.c: In function 'pgtable_free_now':
> arch/powerpc/mm/tlb_64.c:66: error: too many arguments to function 'smp_call_function'
> arch/powerpc/mm/slice.c: In function 'slice_get_unmapped_area':
> arch/powerpc/mm/slice.c:559: error: too many arguments to function 'on_each_cpu'
> arch/powerpc/kernel/machine_kexec_64.c: In function 'kexec_prepare_cpus':
> arch/powerpc/kernel/machine_kexec_64.c:175: error: too many arguments to function 'smp_call_function'
>
> I applied the patch below.
thanks, applied the tlb_64.c and machine_kexec_64.c bits to
tip/generic-ipi [see the commit below]. (Please carry the slice.c bits
in linux-next separately as that's due to new code in linux-next.)
Ingo
---------------->
commit 392096e98fd55e54035978fe03796fca8d26a574
Author: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu Jul 3 17:10:07 2008 +1000
generic-ipi: fix linux-next tree build failure
Today's linux-next build (powerpc ppc64_defconfig) failed like this:
arch/powerpc/mm/tlb_64.c: In function 'pgtable_free_now':
arch/powerpc/mm/tlb_64.c:66: error: too many arguments to function 'smp_call_function'
arch/powerpc/kernel/machine_kexec_64.c: In function 'kexec_prepare_cpus':
arch/powerpc/kernel/machine_kexec_64.c:175: error: too many arguments to function 'smp_call_function'
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: <linuxppc-dev@ozlabs.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 704375b..b732b5f 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -172,7 +172,7 @@ static void kexec_prepare_cpus(void)
{
int my_cpu, i, notified=-1;
- smp_call_function(kexec_smp_down, NULL, 0, /* wait */0);
+ smp_call_function(kexec_smp_down, NULL, /* wait */0);
my_cpu = get_cpu();
/* check the others cpus are now down (via paca hw cpu id == -1) */
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index e2d867c..69ad829 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -66,7 +66,7 @@ static void pgtable_free_now(pgtable_free_t pgf)
{
pte_freelist_forced_free++;
- smp_call_function(pte_free_smp_sync, NULL, 0, 1);
+ smp_call_function(pte_free_smp_sync, NULL, 1);
pgtable_free(pgf);
}
^ permalink raw reply related
* Re: linux-next: generic-ipi tree build failure
From: Jens Axboe @ 2008-07-03 7:22 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev, Ingo Molnar, linux-next, Paul Mackerras
In-Reply-To: <20080703171007.5a17ea25.sfr@canb.auug.org.au>
On Thu, Jul 03 2008, Stephen Rothwell wrote:
> Hi Ingo, Jens,
>
> Today's linux-next build (powerpc ppc64_defconfig) failed like this:
>
> arch/powerpc/mm/tlb_64.c: In function 'pgtable_free_now':
> arch/powerpc/mm/tlb_64.c:66: error: too many arguments to function 'smp_call_function'
> arch/powerpc/mm/slice.c: In function 'slice_get_unmapped_area':
> arch/powerpc/mm/slice.c:559: error: too many arguments to function 'on_each_cpu'
> arch/powerpc/kernel/machine_kexec_64.c: In function 'kexec_prepare_cpus':
> arch/powerpc/kernel/machine_kexec_64.c:175: error: too many arguments to function 'smp_call_function'
>
> I applied the patch below.
Thanks Stephen, I've verified that the patch is correct!
--
Jens Axboe
^ permalink raw reply
* linux-next: generic-ipi tree build failure
From: Stephen Rothwell @ 2008-07-03 7:10 UTC (permalink / raw)
To: Ingo Molnar, Jens Axboe; +Cc: linuxppc-dev, linux-next, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 2610 bytes --]
Hi Ingo, Jens,
Today's linux-next build (powerpc ppc64_defconfig) failed like this:
arch/powerpc/mm/tlb_64.c: In function 'pgtable_free_now':
arch/powerpc/mm/tlb_64.c:66: error: too many arguments to function 'smp_call_function'
arch/powerpc/mm/slice.c: In function 'slice_get_unmapped_area':
arch/powerpc/mm/slice.c:559: error: too many arguments to function 'on_each_cpu'
arch/powerpc/kernel/machine_kexec_64.c: In function 'kexec_prepare_cpus':
arch/powerpc/kernel/machine_kexec_64.c:175: error: too many arguments to function 'smp_call_function'
I applied the patch below.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
>From 8bfda9c27bed42020ad1a9058766c4586eeffd58 Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 3 Jul 2008 17:06:46 +1000
Subject: [PATCH] generic-ipi: powerpc fallout fixes
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/machine_kexec_64.c | 2 +-
arch/powerpc/mm/slice.c | 2 +-
arch/powerpc/mm/tlb_64.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 631dfd6..a168514 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -172,7 +172,7 @@ static void kexec_prepare_cpus(void)
{
int my_cpu, i, notified=-1;
- smp_call_function(kexec_smp_down, NULL, 0, /* wait */0);
+ smp_call_function(kexec_smp_down, NULL, /* wait */0);
my_cpu = get_cpu();
/* check the others cpus are now down (via paca hw cpu id == -1) */
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 583be67..db44e02 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -556,7 +556,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
if (mask.low_slices || mask.high_slices) {
slice_convert(mm, mask, psize);
if (psize > MMU_PAGE_BASE)
- on_each_cpu(slice_flush_segments, mm, 0, 1);
+ on_each_cpu(slice_flush_segments, mm, 1);
}
return addr;
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index 509bc56..a01b5c6 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -63,7 +63,7 @@ static void pgtable_free_now(pgtable_free_t pgf)
{
pte_freelist_forced_free++;
- smp_call_function(pte_free_smp_sync, NULL, 0, 1);
+ smp_call_function(pte_free_smp_sync, NULL, 1);
pgtable_free(pgf);
}
--
1.5.6
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply related
* Re: [PATCH] powerpc: Fix /dev/oldmem for kdump
From: Michael Ellerman @ 2008-07-03 6:36 UTC (permalink / raw)
To: Sachin P. Sant; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <486C726A.9080606@in.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]
On Thu, 2008-07-03 at 12:02 +0530, Sachin P. Sant wrote:
> Michael Ellerman wrote:
> > Even though I wrote this, it was so long ago I can't really vouch for
> > it. If you've tested it and it works Sachin then we should merge it. Is
> > this fix in distros or does it not apply?
> >
> Yes, i have tested this on couple of power boxes and the patch
> works fine. [ i can copy dump using both /proc/vmcore and /dev/oldmem
> interface ]
OK great, thanks for that.
> No this fix is not part of distro ATM. But yes it applies to distros
> also. Once it is merged upstream, distros will eventually pick this up.
Crud, OK well I guess we should hurry up and merge it then :D
Paul, this has been broken for quite a while, but it would still be nice
if the fix was in 26 - sorry!
Acked-by: Michael Ellerman <michael@ellerman.id.au>
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH] powerpc: Fix /dev/oldmem for kdump
From: Sachin P. Sant @ 2008-07-03 6:32 UTC (permalink / raw)
To: michael; +Cc: linuxppc-dev
In-Reply-To: <1215065710.17950.12.camel@localhost>
Michael Ellerman wrote:
> Even though I wrote this, it was so long ago I can't really vouch for
> it. If you've tested it and it works Sachin then we should merge it. Is
> this fix in distros or does it not apply?
>
Yes, i have tested this on couple of power boxes and the patch
works fine. [ i can copy dump using both /proc/vmcore and /dev/oldmem
interface ]
No this fix is not part of distro ATM. But yes it applies to distros
also. Once it is merged upstream, distros will eventually pick this up.
Thanks
-Sachin
^ permalink raw reply
* Re: [PATCH] powerpc: Fix /dev/oldmem for kdump
From: Michael Ellerman @ 2008-07-03 6:15 UTC (permalink / raw)
To: Sachin P. Sant; +Cc: linuxppc-dev
In-Reply-To: <48637594.5040709@in.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 899 bytes --]
On Thu, 2008-06-26 at 16:25 +0530, Sachin P. Sant wrote:
> This one has been pending for a long time. Somehow never
> made it upstream.
>
> Resending the patch which fixes /dev/oldmem interface for kdump.
>
> Tested with 2.6.26-rc8.
>
> Signed-off-by : Michael Ellerman <michael@ellerman.id.au>
Even though I wrote this, it was so long ago I can't really vouch for
it. If you've tested it and it works Sachin then we should merge it. Is
this fix in distros or does it not apply?
> Also make sure we're only reading one page or less at a time.
It looks like the generic code ensures that I think, but it can't hurt.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: Need stable 2.6 kernel for TQM823L
From: Grant Likely @ 2008-07-03 5:58 UTC (permalink / raw)
To: Thomas Maenner; +Cc: linuxppc-embedded
In-Reply-To: <200807021418.13596.tmaenner@aehr.com>
On Wed, Jul 02, 2008 at 02:18:13PM -0700, Thomas Maenner wrote:
> Hi Guys,
>
> I have used the 2.4 kernel successfully on the TQM823L and 855s, and wanted to
> try out a 2.6 version. So I downloaded the latest from Wolfgang @ git.denx.de
> but I'm getting all sorts of compile errors....
>
> Before I continue to dive in, I wanted to ask the group some questions:
> - Is 2.6 ported to the TQM8xx modules?
$ ls arch/powerpc/boot/dts/tqm*
arch/powerpc/boot/dts/tqm5200.dts arch/powerpc/boot/dts/tqm8555.dts
arch/powerpc/boot/dts/tqm8540.dts arch/powerpc/boot/dts/tqm8560.dts
arch/powerpc/boot/dts/tqm8541.dts
Unfortunately, it doesn't look like any of the tqm8xx boards have been
added to the device tree directory, so the answer is probably, 'no'.
> - If so, is it stable?
I believe 8xx support is stable in arch/powerpc, but you'll need to
write a device tree file for the board. Look for a similar board in
arch/powerpc/boot/dts/ to use as a starting point.
You'll probably also need to add a platform file to arch/powerpc/platforms/8xx
that matches against your new device tree file.
g.
^ permalink raw reply
* Re: [PATCH] powerpc: fixup lwsync at runtime
From: Michael Ellerman @ 2008-07-03 5:55 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <46F3C08B-4F8E-42A2-BDE8-6849D33CA4A0@kernel.crashing.org>
[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]
On Wed, 2008-07-02 at 10:57 -0500, Kumar Gala wrote:
> On Jul 2, 2008, at 4:34 AM, Michael Ellerman wrote:
>
> > On Tue, 2008-07-01 at 09:48 -0500, Kumar Gala wrote:
> >> On Jul 1, 2008, at 1:29 AM, Michael Ellerman wrote:
> >
> >>>> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/
> >>>> setup_32.c
> >>>> index 9e83add..0109e7f 100644
> >>>> --- a/arch/powerpc/kernel/setup_32.c
> >>>> +++ b/arch/powerpc/kernel/setup_32.c
> >>>> @@ -101,6 +101,10 @@ unsigned long __init early_init(unsigned long
> >>>> dt_ptr)
> >>>> PTRRELOC(&__start___ftr_fixup),
> >>>> PTRRELOC(&__stop___ftr_fixup));
> >>>>
> >>>> + do_lwsync_fixups(spec->cpu_features,
> >>>> + PTRRELOC(&__start___lwsync_fixup),
> >>>> + PTRRELOC(&__stop___lwsync_fixup));
> >>>> +
> >>>
> >>> This could be changed to use cur_cpu_spec->cpu_features, and then
> >>> all
> >>> the call sites would be passing that, which would mean
> >>> do_lwsync_fixups() could just check cur_cpu_spec->cpu_features
> >>> directly.
> >>
> >> cur_cpu_spec and spec at this point arent the same thing.
> >
> > Aren't they? I must be missing something:
>
> There is an issue with how ppc32 classic gets here and relocation. If
> I change the call to:
>
> do_lwsync_fixups(cur_cpu_spec->cpu_features,
> PTRRELOC(&__start___lwsync_fixup),
> PTRRELOC(&__stop___lwsync_fixup));
>
> I can't boot on a 6xx based machine anymore.
OK, I guess it needs a PTRRELOC(), but it's not that important, don't
worry about it.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: linux-next: manual merge of the powerpc tree
From: Grant Likely @ 2008-07-03 5:47 UTC (permalink / raw)
To: Stephen Rothwell, jonsmirl, galak
Cc: Jean Delvare, linuxppc-dev, linux-next, Paul Mackerras,
Timur Tabi
In-Reply-To: <20080703133905.7b6f058f.sfr@canb.auug.org.au>
On Thu, Jul 03, 2008 at 01:39:05PM +1000, Stephen Rothwell wrote:
> Hi Paul,
>
> Today's linux-next merge of the powerpc tree got a conflict in
> arch/powerpc/sysdev/fsl_soc.c between commit
> 4eac6a8b17ce5ebe66eb94b6a0b43aa3a2bf7ea6 ("i2c-mpc: Convert to an
> of_platform driver") from the i2c tree and commits
It probably would have been better for this patch to go in via the
PowerPC tree. It only touches powerpc-specific i2c code, not any i2c
core code. There are quite a few MPCxxxx ports which use this driver,
I'd be happier to see it dropped from the i2c tree and merged in via
either Kumar or myself.
I'd also like to see some acks from people who have tested this patch
before it goes in. (I'm just as guilty here; I'll apply it and test it
to my tree tomorrow).
g.
^ permalink raw reply
* linux-next: manual merge of the powerpc tree
From: Stephen Rothwell @ 2008-07-03 3:39 UTC (permalink / raw)
To: Paul Mackerras, linuxppc-dev; +Cc: Jean Delvare, linux-next, Timur Tabi
[-- Attachment #1: Type: text/plain, Size: 855 bytes --]
Hi Paul,
Today's linux-next merge of the powerpc tree got a conflict in
arch/powerpc/sysdev/fsl_soc.c between commit
4eac6a8b17ce5ebe66eb94b6a0b43aa3a2bf7ea6 ("i2c-mpc: Convert to an
of_platform driver") from the i2c tree and commits
22fb7d9be593181e2f779cf7a8421703a6be713b ("[POWERPC] fsl: Add warning for
unrecognized I2C nodes in the device tree"),
64f9b5ee17ee7974d7cc58d75221432d86960ba3 ("[POWERPC] fsl: Add CS4270 i2c
data to fsl_soc.c") and e026892c85571e12f11abffde5a90bcc704d663e
("[POWERPC] fsl: Update fsl_soc to use cell-index property of I2C nodes")
from the powerpc tree.
The changes from the powerpc tree modify code that the i2c tree removes.
I used the i2c tree's version, but someone should check the result.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH 4/5 v2] Split code into helper routines for drconf memory
From: Nathan Fontenot @ 2008-07-03 3:35 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <486C463F.5080702@austin.ibm.com>
Oops, some silliness in one of the comments. New patch below.
This patch splits off several pieces of code that parse the
ibm,dynamic-reconfiguration-memory node of the device tree into separate
helper routines. This is in preparation for the followon patch that will
use these helper routines. There are no functional changes in this patch.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
arch/powerpc/mm/numa.c | 209 +++++++++++++++++++++++++++++++++++++++----------
1 file changed, 170 insertions(+), 39 deletions(-)
Index: linux-2.6.git/arch/powerpc/mm/numa.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/mm/numa.c 2008-07-01 18:40:55.000000000 -0500
+++ linux-2.6.git/arch/powerpc/mm/numa.c 2008-07-02 22:29:58.000000000 -0500
@@ -268,6 +268,144 @@
return result;
}
+struct of_drconf_cell {
+ u64 base_addr;
+ u32 drc_index;
+ u32 reserved;
+ u32 aa_index;
+ u32 flags;
+};
+
+#define DRCONF_MEM_ASSIGNED 0x00000008
+#define DRCONF_MEM_AI_INVALID 0x00000040
+#define DRCONF_MEM_RESERVED 0x00000080
+
+/*
+ * Read the next lmb list entry from the ibm,dynamic-memory property
+ * and return the information in the provided of_drconf_cell structure.
+ */
+static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp)
+{
+ const u32 *cp;
+
+ drmem->base_addr = read_n_cells(n_mem_addr_cells, cellp);
+
+ cp = *cellp;
+ drmem->drc_index = cp[0];
+ drmem->reserved = cp[1];
+ drmem->aa_index = cp[2];
+ drmem->flags = cp[3];
+
+ *cellp = cp + 4;
+}
+
+/*
+ * Retreive and validate the ibm,dynamic-memory property of the device tree.
+ *
+ * The layout of the ibm,dynamic-memory property is a number N of lmb
+ * list entries followed by N lmb list entries. Each lmb list entry
+ * contains information as layed out in the of_drconf_cell struct above.
+ */
+static int of_get_drconf_memory(struct device_node *memory, const u32 **dm)
+{
+ const u32 *prop;
+ u32 len, entries;
+
+ prop = of_get_property(memory, "ibm,dynamic-memory", &len);
+ if (!prop || len < sizeof(unsigned int))
+ return 0;
+
+ entries = *prop++;
+
+ /* Now that we know the number of entries, revalidate the size
+ * of the property read in to ensure we have everything
+ */
+ if (len < (entries * (n_mem_addr_cells + 4) + 1) * sizeof(unsigned int))
+ return 0;
+
+ *dm = prop;
+ return entries;
+}
+
+/*
+ * Retreive and validate the ibm,lmb-size property for drconf memory
+ * from the device tree.
+ */
+static u64 of_get_lmb_size(struct device_node *memory)
+{
+ const u32 *prop;
+ u32 len;
+
+ prop = of_get_property(memory, "ibm,lmb-size", &len);
+ if (!prop || len < sizeof(unsigned int))
+ return 0;
+
+ return read_n_cells(n_mem_size_cells, &prop);
+}
+
+struct assoc_arrays {
+ u32 n_arrays;
+ u32 array_sz;
+ const u32 *arrays;
+};
+
+/*
+ * Retreive and validate the list of associativity arrays for drconf
+ * memory from the ibm,associativity-lookup-arrays property of the
+ * device tree..
+ *
+ * The layout of the ibm,associativity-lookup-arrays property is a number N
+ * indicating the number of associativity arrays, followed by a number M
+ * indicating the size of each associativity array, followed by a list
+ * of N associativity arrays.
+ */
+static int of_get_assoc_arrays(struct device_node *memory,
+ struct assoc_arrays *aa)
+{
+ const u32 *prop;
+ u32 len;
+
+ prop = of_get_property(memory, "ibm,associativity-lookup-arrays", &len);
+ if (!prop || len < 2 * sizeof(unsigned int))
+ return -1;
+
+ aa->n_arrays = *prop++;
+ aa->array_sz = *prop++;
+
+ /* Now that we know the number of arrrays and size of each array,
+ * revalidate the size of the property read in.
+ */
+ if (len < (aa->n_arrays * aa->array_sz + 2) * sizeof(unsigned int))
+ return -1;
+
+ aa->arrays = prop;
+ return 0;
+}
+
+/*
+ * This is like of_node_to_nid_single() for memory represented in the
+ * ibm,dynamic-reconfiguration-memory node.
+ */
+static int of_drconf_to_nid_single(struct of_drconf_cell *drmem,
+ struct assoc_arrays *aa)
+{
+ int default_nid = 0;
+ int nid = default_nid;
+ int index;
+
+ if (min_common_depth > 0 && min_common_depth <= aa->array_sz &&
+ !(drmem->flags & DRCONF_MEM_AI_INVALID) &&
+ drmem->aa_index < aa->n_arrays) {
+ index = drmem->aa_index * aa->array_sz + min_common_depth - 1;
+ nid = aa->arrays[index];
+
+ if (nid == 0xffff || nid >= MAX_NUMNODES)
+ nid = default_nid;
+ }
+
+ return nid;
+}
+
/*
* Figure out to which domain a cpu belongs and stick it there.
* Return the id of the domain used.
@@ -355,57 +493,50 @@
*/
static void __init parse_drconf_memory(struct device_node *memory)
{
- const unsigned int *lm, *dm, *aa;
- unsigned int ls, ld, la;
- unsigned int n, aam, aalen;
- unsigned long lmb_size, size, start;
- int nid, default_nid = 0;
- unsigned int ai, flags;
-
- lm = of_get_property(memory, "ibm,lmb-size", &ls);
- dm = of_get_property(memory, "ibm,dynamic-memory", &ld);
- aa = of_get_property(memory, "ibm,associativity-lookup-arrays", &la);
- if (!lm || !dm || !aa ||
- ls < sizeof(unsigned int) || ld < sizeof(unsigned int) ||
- la < 2 * sizeof(unsigned int))
+ const u32 *dm;
+ unsigned int n, rc;
+ unsigned long lmb_size, size;
+ int nid;
+ struct assoc_arrays aa;
+
+ n = of_get_drconf_memory(memory, &dm);
+ if (!n)
return;
- lmb_size = read_n_cells(n_mem_size_cells, &lm);
- n = *dm++; /* number of LMBs */
- aam = *aa++; /* number of associativity lists */
- aalen = *aa++; /* length of each associativity list */
- if (ld < (n * (n_mem_addr_cells + 4) + 1) * sizeof(unsigned int) ||
- la < (aam * aalen + 2) * sizeof(unsigned int))
+ lmb_size = of_get_lmb_size(memory);
+ if (!lmb_size)
+ return;
+
+ rc = of_get_assoc_arrays(memory, &aa);
+ if (rc)
return;
for (; n != 0; --n) {
- start = read_n_cells(n_mem_addr_cells, &dm);
- ai = dm[2];
- flags = dm[3];
- dm += 4;
- /* 0x80 == reserved, 0x8 = assigned to us */
- if ((flags & 0x80) || !(flags & 0x8))
+ struct of_drconf_cell drmem;
+
+ read_drconf_cell(&drmem, &dm);
+
+ /* skip this block if the reserved bit is set in flags (0x80)
+ or if the block is not assigned to this partition (0x8) */
+ if ((drmem.flags & DRCONF_MEM_RESERVED)
+ || !(drmem.flags & DRCONF_MEM_ASSIGNED))
continue;
- nid = default_nid;
- /* flags & 0x40 means associativity index is invalid */
- if (min_common_depth > 0 && min_common_depth <= aalen &&
- (flags & 0x40) == 0 && ai < aam) {
- /* this is like of_node_to_nid_single */
- nid = aa[ai * aalen + min_common_depth - 1];
- if (nid == 0xffff || nid >= MAX_NUMNODES)
- nid = default_nid;
- }
- fake_numa_create_new_node(((start + lmb_size) >> PAGE_SHIFT),
- &nid);
+ nid = of_drconf_to_nid_single(&drmem, &aa);
+
+ fake_numa_create_new_node(
+ ((drmem.base_addr + lmb_size) >> PAGE_SHIFT),
+ &nid);
+
node_set_online(nid);
- size = numa_enforce_memory_limit(start, lmb_size);
+ size = numa_enforce_memory_limit(drmem.base_addr, lmb_size);
if (!size)
continue;
- add_active_range(nid, start >> PAGE_SHIFT,
- (start >> PAGE_SHIFT) + (size >> PAGE_SHIFT));
+ add_active_range(nid, drmem.base_addr >> PAGE_SHIFT,
+ (drmem.base_addr >> PAGE_SHIFT)
+ + (size >> PAGE_SHIFT));
}
}
^ permalink raw reply
* Re: [PATCH] [RFC v3] OF: OpenFirmware bindings for the mmc_spi driver
From: Jon Smirl @ 2008-07-03 3:26 UTC (permalink / raw)
To: Anton Vorontsov
Cc: David Brownell, Gary Jennejohn, linux-kernel, linuxppc-dev,
Guennadi Liakhovetski, Pierre Ossman
In-Reply-To: <20080605161624.GA517@polina.dev.rtsoft.ru>
On 6/5/08, Anton Vorontsov <avorontsov@ru.mvista.com> wrote:
> Here is v3. I'm out of ideas if you won't like it. :-)
>
> v3:
> - Now these bindings are using bus notifiers chain, thus we adhere to the
> spi bus.
>
> By the way, this scheme (IMO) looks good for I2C devices which needs
> platform_data extracted from the device tree too (Cc'ing Jochen).
>
> - Plus changed the OF bindings themselves, implemented voltage-range
> property. (Pierre, please take a look at vddrange_to_ocrmask(). I
> wonder if you would like this in the MMC core instead, with a kernel
> doc, of course.)
>
> v2:
> - Bindings were adhered to the MMC_SPI driver. Withdrawn by Pierre Ossman.
>
> v1:
> - Bindings were adhered to the OF SPI core. Withdrawn by OF people.
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> Documentation/powerpc/booting-without-of.txt | 21 +++
> drivers/of/Kconfig | 8 +
> drivers/of/Makefile | 1 +
> drivers/of/of_mmc_spi.c | 210 ++++++++++++++++++++++++++
> 4 files changed, 240 insertions(+), 0 deletions(-)
> create mode 100644 drivers/of/of_mmc_spi.c
>
> diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
> index 6e1711c..6c55f3f 100644
> --- a/Documentation/powerpc/booting-without-of.txt
> +++ b/Documentation/powerpc/booting-without-of.txt
> @@ -3143,7 +3143,28 @@ platforms are moved over to use the flattened-device-tree model.
> };
> };
>
> + ...) MMC-over-SPI
>
> + Required properties:
> + - compatible : should be "mmc-spi".
> + - reg : should specify SPI address (chip-select number).
> + - max-speed : (optional) maximum frequency for this device (Hz).
> + - voltage-range : two cells are required, first cell specifies minimum
> + slot voltage (mV), second cell specifies maximum slot voltage (mV).
> + - gpios : (optional) may specify GPIOs in this order: Write-Protect GPIO,
> + Card-Detect GPIO.
> +
> + Example:
> +
> + mmc-slot@0 {
> + compatible = "mmc-spi";
> + reg = <0>;
> + max-speed = <50000000>;
> + /* Unregulated slot. */
> + voltage-range = <3300 3300>;
> + gpios = <&sdcsr_pio 1 0 /* WP */
> + &sdcsr_pio 0 1>; /* nCD */
> + };
>
> VII - Marvell Discovery mv64[345]6x System Controller chips
> ===========================================================
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index 3a7a11a..aadbfb3 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -13,3 +13,11 @@ config OF_I2C
> depends on PPC_OF && I2C
> help
> OpenFirmware I2C accessors
> +
> +config OF_MMC_SPI
> + bool "OpenFirmware bindings for MMC/SD over SPI"
> + depends on PPC_OF && SPI
> + default y if MMC_SPI
> + help
> + Say Y here to enable OpenFirmware bindings for the MMC/SD over SPI
> + driver.
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index 548772e..a7c44fc 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -2,3 +2,4 @@ obj-y = base.o
> obj-$(CONFIG_OF_DEVICE) += device.o platform.o
> obj-$(CONFIG_OF_GPIO) += gpio.o
> obj-$(CONFIG_OF_I2C) += of_i2c.o
> +obj-$(CONFIG_OF_MMC_SPI) += of_mmc_spi.o
> diff --git a/drivers/of/of_mmc_spi.c b/drivers/of/of_mmc_spi.c
> new file mode 100644
> index 0000000..aa4e017
> --- /dev/null
> +++ b/drivers/of/of_mmc_spi.c
> @@ -0,0 +1,210 @@
> +/*
> + * OpenFirmware bindings for the MMC-over-SPI driver
> + *
> + * Copyright (c) MontaVista Software, Inc. 2008.
> + *
> + * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
> + *
> + * 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/init.h>
> +#include <linux/device.h>
> +#include <linux/notifier.h>
> +#include <linux/gpio.h>
> +#include <linux/of.h>
> +#include <linux/of_gpio.h>
> +#include <linux/of_platform.h>
> +#include <linux/spi/spi.h>
> +#include <linux/spi/mmc_spi.h>
> +#include <linux/mmc/host.h>
> +
> +/*
> + * XXX: Place it somewhere in the generic MMC code?
> + */
> +static int vdd_to_bitnum(int vdd)
> +{
> + int bit;
> + const int max_bit = ilog2(MMC_VDD_35_36);
> +
> + if (vdd < 1650 || vdd > 3600)
> + return -EINVAL;
> +
> + if (vdd >= 1650 && vdd <= 1950)
> + return ilog2(MMC_VDD_165_195);
> +
> + /* base 2000 mV, step 100 mV, bit's base 8 */
> + bit = (vdd - 2000) / 100 + 8;
> + if (bit > max_bit)
> + return max_bit;
> + return bit;
> +}
> +
> +static int vddrange_to_ocrmask(int vdd_min, int vdd_max, unsigned int *mask)
> +{
> + if (vdd_max < vdd_min)
> + return -EINVAL;
> +
> + vdd_max = vdd_to_bitnum(vdd_max);
> + if (vdd_max < 0)
> + return -EINVAL;
> +
> + vdd_min = vdd_to_bitnum(vdd_min);
> + if (vdd_min < 0)
> + return -EINVAL;
> +
> + /* fill the mask, from max bit to min bit */
> + while (vdd_max >= vdd_min)
> + *mask |= 1 << vdd_max--;
> + return 0;
> +}
> +
> +struct of_mmc_spi {
> + int wp_gpio;
> + int cd_gpio;
> + struct mmc_spi_platform_data mmc_pdata;
> +};
> +
> +static struct of_mmc_spi *to_of_mmc_spi(struct device *dev)
> +{
> + return container_of(dev->platform_data, struct of_mmc_spi, mmc_pdata);
> +}
> +
> +static int mmc_get_ro(struct device *dev)
> +{
> + struct of_mmc_spi *oms = to_of_mmc_spi(dev);
> +
> + return gpio_get_value(oms->wp_gpio);
> +}
> +
> +static int mmc_get_cd(struct device *dev)
> +{
> + struct of_mmc_spi *oms = to_of_mmc_spi(dev);
> +
> + return gpio_get_value(oms->cd_gpio);
> +}
> +
> +static int of_mmc_spi_add(struct device *dev)
> +{
> + int ret = -EINVAL;
> + struct device_node *np = dev->archdata.of_node;
> + struct of_mmc_spi *oms;
> + const u32 *voltage_range;
> + int size;
> +
> + if (!np || !of_device_is_compatible(np, "mmc-spi"))
> + return NOTIFY_DONE;
> +
> + oms = kzalloc(sizeof(*oms), GFP_KERNEL);
> + if (!oms)
> + return notifier_to_errno(-ENOMEM);
> +
> + /* We don't support interrupts yet, let's poll. */
> + oms->mmc_pdata.caps |= MMC_CAP_NEEDS_POLL;
> +
> + voltage_range = of_get_property(np, "voltage-range", &size);
> + if (!voltage_range || size < sizeof(*voltage_range) * 2) {
> + dev_err(dev, "OF: voltage-range unspecified\n");
> + goto err_ocr;
> + }
> +
> + ret = vddrange_to_ocrmask(voltage_range[0], voltage_range[1],
> + &oms->mmc_pdata.ocr_mask);
> + if (ret) {
> + dev_err(dev, "OF: specified voltage-range is invalid\n");
> + goto err_ocr;
> + }
> +
> + oms->wp_gpio = of_get_gpio(np, 0);
> + if (gpio_is_valid(oms->wp_gpio)) {
> + ret = gpio_request(oms->wp_gpio, dev->bus_id);
> + if (ret < 0)
> + goto err_wp_gpio;
> + oms->mmc_pdata.get_ro = &mmc_get_ro;
> + }
> +
> + oms->cd_gpio = of_get_gpio(np, 1);
> + if (gpio_is_valid(oms->cd_gpio)) {
> + ret = gpio_request(oms->cd_gpio, dev->bus_id);
> + if (ret < 0)
> + goto err_cd_gpio;
> + oms->mmc_pdata.get_cd = &mmc_get_cd;
> + }
> +
> + dev->platform_data = &oms->mmc_pdata;
> +
> + return NOTIFY_STOP;
> +
> +err_cd_gpio:
> + if (gpio_is_valid(oms->wp_gpio))
> + gpio_free(oms->wp_gpio);
> +err_wp_gpio:
> +err_ocr:
> + kfree(oms);
> + return notifier_to_errno(ret);
> +}
> +
> +static int of_mmc_spi_del(struct device *dev)
> +{
> + struct device_node *np = dev->archdata.of_node;
> + struct of_mmc_spi *oms;
> +
> + if (!np || !of_device_is_compatible(np, "mmc-spi") ||
> + !dev->platform_data)
> + return NOTIFY_DONE;
> +
> + oms = to_of_mmc_spi(dev);
> +
> + if (gpio_is_valid(oms->cd_gpio))
> + gpio_free(oms->cd_gpio);
> + if (gpio_is_valid(oms->wp_gpio))
> + gpio_free(oms->wp_gpio);
> +
> + kfree(oms);
> + return NOTIFY_STOP;
> +}
> +
> +static int of_mmc_spi_notify(struct notifier_block *nb, unsigned long action,
> + void *_dev)
> +{
> + struct device *dev = _dev;
> +
> + switch (action) {
> + case BUS_NOTIFY_ADD_DEVICE:
> + return of_mmc_spi_add(dev);
> + case BUS_NOTIFY_DEL_DEVICE:
> + return of_mmc_spi_del(dev);
> + };
> + return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block of_mmc_spi_notifier = {
> + .notifier_call = of_mmc_spi_notify,
> +};
> +
> +/*
> + * Should be called early enough, but after SPI core initializes. So, we
> + * use subsys_initcall (as in the SPI core), and link order guaranties
> + * that we'll be called at the right time.
> + */
Why does this need to be loaded at subsys_initcall time? We have the
equivalent code on i2c loading as a normal module.
When the spi bus driver code is processing the child SPI device nodes,
it should request_module() this driver as a module. I made a note to
fix that on Grant's SPI bus driver.
spi@f00 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";
Triggers loading of Grant's SPI module via normal OF module mechanism
reg = <0xf00 0x20>;
interrupts = <0x2 0xd 0x0 0x2 0xe 0x0>;
interrupt-parent = <&mpc5200_pic>;
Grant's code loops through the child nodes
mmc-slot@0 {
compatible = "mmc-spi";
Finds this and does request_module("mmc-spi");
Then it registers the device
reg = <0>;
max-speed = <50000000>;
/* Unregulated slot. */
voltage-range = <3300 3300>;
/*gpios = <&sdcsr_pio 1 0 /* WP */
/* &sdcsr_pio 0 1>; /* nCD */
};
};
As part of this module's initialization it may need to request_module
generic mmc core module, but I haven't traced things out that far yet.
None of these parts should need to be compiled in, they should all be
capable of being loaded as a modules.
> +static int __init of_mmc_spi_init(void)
> +{
> + int ret;
> +
> + ret = bus_register_notifier(&spi_bus_type, &of_mmc_spi_notifier);
> + if (ret) {
> + pr_err("%s: unable to register notifier on the spi bus\n",
> + __func__);
> + return ret;
> + }
> +
> + return 0;
> +}
> +subsys_initcall(of_mmc_spi_init);
> +
> +MODULE_DESCRIPTION("OpenFirmware bindings for the MMC-over-SPI driver");
> +MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
> +MODULE_LICENSE("GPL");
> --
> 1.5.5.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* [PATCH 5/5 v2] Update numa association of hotplug memory add for drconf memory
From: Nathan Fontenot @ 2008-07-03 3:25 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <486C4462.4010004@austin.ibm.com>
Update the association of a memory section with a numa node that occurs during
hotplug add of a memory section. This adds a check in the
hot_add_scn_to_nid() routine for the ibm,dyamic-reconfiguration-memory node
in the device tree. If present the new hot_add_drconf_scn_to_nid() routine
is invoked, which can properly parse the ibm,dynamic-reconfiguration-memory
node of the device tree and make the proper numa node associations.
This also introduces the valid_hot_add_scn() routine as a helper
function for code that is common to the hot_add_scn_to_nid() and
hot_add_drconf_scn_to_nid() routines.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
arch/powerpc/mm/numa.c | 101 ++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 83 insertions(+), 18 deletions(-)
Index: linux-2.6.git/arch/powerpc/mm/numa.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/mm/numa.c 2008-07-01 18:43:44.000000000 -0500
+++ linux-2.6.git/arch/powerpc/mm/numa.c 2008-07-01 18:43:50.000000000 -0500
@@ -901,6 +901,79 @@
#ifdef CONFIG_MEMORY_HOTPLUG
/*
+ * Validate the node associated with the memory section we are
+ * trying to add.
+ */
+int valid_hot_add_scn(int *nid, unsigned long start, u32 lmb_size,
+ unsigned long scn_addr)
+{
+ nodemask_t nodes;
+
+ if (*nid < 0 || !node_online(*nid))
+ *nid = any_online_node(NODE_MASK_ALL);
+
+ if ((scn_addr >= start) && (scn_addr < (start + lmb_size))) {
+ nodes_setall(nodes);
+ while (NODE_DATA(*nid)->node_spanned_pages == 0) {
+ node_clear(*nid, nodes);
+ *nid = any_online_node(nodes);
+ }
+
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
+ * Find the node associated with a hot added memory section represented
+ * by the ibm,dynamic-reconfiguration-memory node.
+ */
+static int hot_add_drconf_scn_to_nid(struct device_node *memory,
+ unsigned long scn_addr)
+{
+ const u32 *dm;
+ unsigned int n, rc;
+ unsigned long lmb_size;
+ int default_nid = any_online_node(NODE_MASK_ALL);
+ int nid;
+ struct assoc_arrays aa;
+
+ n = of_get_drconf_memory(memory, &dm);
+ if (!n)
+ return default_nid;;
+
+ lmb_size = of_get_lmb_size(memory);
+ if (!lmb_size)
+ return default_nid;
+
+ rc = of_get_assoc_arrays(memory, &aa);
+ if (rc)
+ return default_nid;
+
+ for (; n != 0; --n) {
+ struct of_drconf_cell drmem;
+
+ read_drconf_cell(&drmem, &dm);
+
+ /* skip this block if it is reserved or not assigned to
+ * this partition */
+ if ((drmem.flags & DRCONF_MEM_RESERVED)
+ || !(drmem.flags & DRCONF_MEM_ASSIGNED))
+ continue;
+
+ nid = of_drconf_to_nid_single(&drmem, &aa);
+
+ if (valid_hot_add_scn(&nid, drmem.base_addr, lmb_size,
+ scn_addr))
+ return nid;
+ }
+
+ BUG(); /* section address should be found above */
+ return 0;
+}
+
+/*
* Find the node associated with a hot added memory section. Section
* corresponds to a SPARSEMEM section, not an LMB. It is assumed that
* sections are fully contained within a single LMB.
@@ -908,12 +981,17 @@
int hot_add_scn_to_nid(unsigned long scn_addr)
{
struct device_node *memory = NULL;
- nodemask_t nodes;
- int default_nid = any_online_node(NODE_MASK_ALL);
int nid;
if (!numa_enabled || (min_common_depth < 0))
- return default_nid;
+ return any_online_node(NODE_MASK_ALL);
+
+ memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
+ if (memory) {
+ nid = hot_add_drconf_scn_to_nid(memory, scn_addr);
+ of_node_put(memory);
+ return nid;
+ }
while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
unsigned long start, size;
@@ -932,13 +1010,9 @@
size = read_n_cells(n_mem_size_cells, &memcell_buf);
nid = of_node_to_nid_single(memory);
- /* Domains not present at boot default to 0 */
- if (nid < 0 || !node_online(nid))
- nid = default_nid;
-
- if ((scn_addr >= start) && (scn_addr < (start + size))) {
+ if (valid_hot_add_scn(&nid, start, size, scn_addr)) {
of_node_put(memory);
- goto got_nid;
+ return nid;
}
if (--ranges) /* process all ranges in cell */
@@ -946,14 +1020,5 @@
}
BUG(); /* section address should be found above */
return 0;
-
- /* Temporary code to ensure that returned node is not empty */
-got_nid:
- nodes_setall(nodes);
- while (NODE_DATA(nid)->node_spanned_pages == 0) {
- node_clear(nid, nodes);
- nid = any_online_node(nodes);
- }
- return nid;
}
#endif /* CONFIG_MEMORY_HOTPLUG */
^ permalink raw reply
* [PATCH 4/5 v2] Split code into helper routines for drconf memory
From: Nathan Fontenot @ 2008-07-03 3:23 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <486C4462.4010004@austin.ibm.com>
This patch splits off several pieces of code that parse the
ibm,dynamic-reconfiguration-memory node of the device tree into separate
helper routines. This is in preparation for the followon patch that will
use these helper routines. There are no functional changes in this patch.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
arch/powerpc/mm/numa.c | 209 +++++++++++++++++++++++++++++++++++++++----------
1 file changed, 170 insertions(+), 39 deletions(-)
Index: linux-2.6.git/arch/powerpc/mm/numa.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/mm/numa.c 2008-07-01 18:40:55.000000000 -0500
+++ linux-2.6.git/arch/powerpc/mm/numa.c 2008-07-01 18:43:44.000000000 -0500
@@ -268,6 +268,144 @@
return result;
}
+struct of_drconf_cell {
+ u64 base_addr;
+ u32 drc_index;
+ u32 reserved;
+ u32 aa_index;
+ u32 flags;
+};
+
+#define DRCONF_MEM_ASSIGNED 0x00000008
+#define DRCONF_MEM_AI_INVALID 0x00000040
+#define DRCONF_MEM_RESERVED 0x00000080
+
+/*
+ * Read the next lmb list entry from the ibm,dynamic-memory property
+ * and return the information in the provided of_drconf_cell structure.
+ */
+static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp)
+{
+ const u32 *cp;
+
+ drmem->base_addr = read_n_cells(n_mem_addr_cells, cellp);
+
+ cp = *cellp;
+ drmem->drc_index = cp[0];
+ drmem->reserved = cp[1];
+ drmem->aa_index = cp[2];
+ drmem->flags = cp[3];
+
+ *cellp = cp + 4;
+}
+
+/*
+ * Retreive and validate the ibm,dynamic-memory property of the device tree.
+ *
+ * The layout of the ibm,dynamic-memory property is a number N of lmb
+ * list entries followed by N lmb list entries. Each lmb list entry
+ * contains information as layed out in the of_drconf_cell struct above.
+ */
+static int of_get_drconf_memory(struct device_node *memory, const u32 **dm)
+{
+ const u32 *prop;
+ u32 len, entries;
+
+ prop = of_get_property(memory, "ibm,dynamic-memory", &len);
+ if (!prop || len < sizeof(unsigned int))
+ return 0;
+
+ entries = *prop++;
+
+ /* Now that we know the number of entries, revalidate the size
+ * of the property read in to ensure we have everything
+ */
+ if (len < (entries * (n_mem_addr_cells + 4) + 1) * sizeof(unsigned int))
+ return 0;
+
+ *dm = prop;
+ return entries;
+}
+
+/*
+ * Retreive and validate the ibm,lmb-size property for drconf memory
+ * from the device tree.
+ */
+static u64 of_get_lmb_size(struct device_node *memory)
+{
+ const u32 *prop;
+ u32 len;
+
+ prop = of_get_property(memory, "ibm,lmb-size", &len);
+ if (!prop || len < sizeof(unsigned int))
+ return 0;
+
+ return read_n_cells(n_mem_size_cells, &prop);
+}
+
+struct assoc_arrays {
+ u32 n_arrays;
+ u32 array_sz;
+ const u32 *arrays;
+};
+
+/*
+ * Retreive and validate the list of associativity arrays for drconf
+ * memory from the ibm,associativity-lookup-arrays property of the
+ * device tree..
+ *
+ * The layout of the ibm,associativity-lookup-arrays property is a number N
+ * indicating the number of associativity arrays, followed by a number M
+ * indicating the size of each associativity array, followed by a list
+ * of N associativity arrays.
+ */
+static int of_get_assoc_arrays(struct device_node *memory,
+ struct assoc_arrays *aa)
+{
+ const u32 *prop;
+ u32 len;
+
+ prop = of_get_property(memory, "ibm,associativity-lookup-arrays", &len);
+ if (!prop || len < 2 * sizeof(unsigned int))
+ return -1;
+
+ aa->n_arrays = *prop++;
+ aa->array_sz = *prop++;
+
+ /* Now that we know the number of arrrays and size of each array,
+ * revalidate the size of the property read in.
+ */
+ if (len < (aa->n_arrays * aa->array_sz + 2) * sizeof(unsigned int))
+ return -1;
+
+ aa->arrays = prop;
+ return 0;
+}
+
+/*
+ * This is like of_node_to_nid_single() for memory represented in the
+ * ibm,dynami arch/powerpc/mm/numa.c.rejc-reconfiguration-memory node.
+ */
+static int of_drconf_to_nid_single(struct of_drconf_cell *drmem,
+ struct assoc_arrays *aa)
+{
+ int default_nid = 0;
+ int nid = default_nid;
+ int index;
+
+ if (min_common_depth > 0 && min_common_depth <= aa->array_sz &&
+ !(drmem->flags & DRCONF_MEM_AI_INVALID) &&
+ drmem->aa_index < aa->n_arrays) {
+ index = drmem->aa_index * aa->array_sz + min_common_depth - 1;
+ nid = aa->arrays[index];
+
+ if (nid == 0xffff || nid >= MAX_NUMNODES)
+ nid = default_nid;
+ }
+
+ return nid;
+}
+
/*
* Figure out to which domain a cpu belongs and stick it there.
* Return the id of the domain used.
@@ -355,57 +493,50 @@
*/
static void __init parse_drconf_memory(struct device_node *memory)
{
- const unsigned int *lm, *dm, *aa;
- unsigned int ls, ld, la;
- unsigned int n, aam, aalen;
- unsigned long lmb_size, size, start;
- int nid, default_nid = 0;
- unsigned int ai, flags;
-
- lm = of_get_property(memory, "ibm,lmb-size", &ls);
- dm = of_get_property(memory, "ibm,dynamic-memory", &ld);
- aa = of_get_property(memory, "ibm,associativity-lookup-arrays", &la);
- if (!lm || !dm || !aa ||
- ls < sizeof(unsigned int) || ld < sizeof(unsigned int) ||
- la < 2 * sizeof(unsigned int))
+ const u32 *dm;
+ unsigned int n, rc;
+ unsigned long lmb_size, size;
+ int nid;
+ struct assoc_arrays aa;
+
+ n = of_get_drconf_memory(memory, &dm);
+ if (!n)
return;
- lmb_size = read_n_cells(n_mem_size_cells, &lm);
- n = *dm++; /* number of LMBs */
- aam = *aa++; /* number of associativity lists */
- aalen = *aa++; /* length of each associativity list */
- if (ld < (n * (n_mem_addr_cells + 4) + 1) * sizeof(unsigned int) ||
- la < (aam * aalen + 2) * sizeof(unsigned int))
+ lmb_size = of_get_lmb_size(memory);
+ if (!lmb_size)
+ return;
+
+ rc = of_get_assoc_arrays(memory, &aa);
+ if (rc)
return;
for (; n != 0; --n) {
- start = read_n_cells(n_mem_addr_cells, &dm);
- ai = dm[2];
- flags = dm[3];
- dm += 4;
- /* 0x80 == reserved, 0x8 = assigned to us */
- if ((flags & 0x80) || !(flags & 0x8))
+ struct of_drconf_cell drmem;
+
+ read_drconf_cell(&drmem, &dm);
+
+ /* skip this block if the reserved bit is set in flags (0x80)
+ or if the block is not assigned to this partition (0x8) */
+ if ((drmem.flags & DRCONF_MEM_RESERVED)
+ || !(drmem.flags & DRCONF_MEM_ASSIGNED))
continue;
- nid = default_nid;
- /* flags & 0x40 means associativity index is invalid */
- if (min_common_depth > 0 && min_common_depth <= aalen &&
- (flags & 0x40) == 0 && ai < aam) {
- /* this is like of_node_to_nid_single */
- nid = aa[ai * aalen + min_common_depth - 1];
- if (nid == 0xffff || nid >= MAX_NUMNODES)
- nid = default_nid;
- }
- fake_numa_create_new_node(((start + lmb_size) >> PAGE_SHIFT),
- &nid);
+ nid = of_drconf_to_nid_single(&drmem, &aa);
+
+ fake_numa_create_new_node(
+ ((drmem.base_addr + lmb_size) >> PAGE_SHIFT),
+ &nid);
+
node_set_online(nid);
- size = numa_enforce_memory_limit(start, lmb_size);
+ size = numa_enforce_memory_limit(drmem.base_addr, lmb_size);
if (!size)
continue;
- add_active_range(nid, start >> PAGE_SHIFT,
- (start >> PAGE_SHIFT) + (size >> PAGE_SHIFT));
+ add_active_range(nid, drmem.base_addr >> PAGE_SHIFT,
+ (drmem.base_addr >> PAGE_SHIFT)
+ + (size >> PAGE_SHIFT));
}
}
^ permalink raw reply
* [PATCH 3/5 v2] Update the device tree correctly for drconf memory add/remove
From: Nathan Fontenot @ 2008-07-03 3:22 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <486C4462.4010004@austin.ibm.com>
This patch updates the device tree manipulation routines so that memory
add/remove of lmbs represented under the
ibm,dynamic-reconfiguration-memory node of the device tree invokes the
hotplug notifier chain.
This change is needed because of the change in the way memory is
represented under the ibm,dynamic-reconfiguration-memory node. All lmbs
are described in the ibm,dynamic-memory property instead of having a
separate node for each lmb as in previous device tree layouts. This
requires the update_node() routine to check for updates to the
ibm,dynamic-memory property and invoke the hotplug notifier chain.
This also updates the pseries hotplug notifier to be able to gather information
for lmbs represented under the ibm,dynamic-reconfiguration-memory node and
have the lmbs added/removed.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
arch/powerpc/platforms/pseries/hotplug-memory.c | 95 +++++++++++++++++-------
arch/powerpc/platforms/pseries/reconfig.c | 36 ++++++++-
include/asm-powerpc/pSeries_reconfig.h | 6 +
3 files changed, 104 insertions(+), 33 deletions(-)
Index: linux-2.6.git/include/asm-powerpc/pSeries_reconfig.h
===================================================================
--- linux-2.6.git.orig/include/asm-powerpc/pSeries_reconfig.h 2008-07-01 09:38:19.000000000 -0500
+++ linux-2.6.git/include/asm-powerpc/pSeries_reconfig.h 2008-07-01 09:38:54.000000000 -0500
@@ -9,8 +9,10 @@
* added or removed on pSeries systems.
*/
-#define PSERIES_RECONFIG_ADD 0x0001
-#define PSERIES_RECONFIG_REMOVE 0x0002
+#define PSERIES_RECONFIG_ADD 0x0001
+#define PSERIES_RECONFIG_REMOVE 0x0002
+#define PSERIES_DRCONF_MEM_ADD 0x0003
+#define PSERIES_DRCONF_MEM_REMOVE 0x0004
#ifdef CONFIG_PPC_PSERIES
extern int pSeries_reconfig_notifier_register(struct notifier_block *);
Index: linux-2.6.git/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/platforms/pseries/reconfig.c 2008-07-01 09:38:26.000000000 -0500
+++ linux-2.6.git/arch/powerpc/platforms/pseries/reconfig.c 2008-07-01 09:38:54.000000000 -0500
@@ -422,8 +422,8 @@
{
struct device_node *np;
unsigned char *value;
- char *name, *end;
- int length;
+ char *name, *end, *next_prop;
+ int rc, length;
struct property *newprop, *oldprop;
buf = parse_node(buf, bufsize, &np);
end = buf + bufsize;
@@ -431,7 +431,8 @@
if (!np)
return -ENODEV;
- if (parse_next_property(buf, end, &name, &length, &value) == NULL)
+ next_prop = parse_next_property(buf, end, &name, &length, &value);
+ if (!next_prop)
return -EINVAL;
newprop = new_property(name, length, value, NULL);
@@ -442,7 +443,34 @@
if (!oldprop)
return -ENODEV;
- return prom_update_property(np, newprop, oldprop);
+ rc = prom_update_property(np, newprop, oldprop);
+ if (rc)
+ return rc;
+
+ /* For memory under the ibm,dynamic-reconfiguration-memory node
+ * of the device tree, adding and removing memory is just an update
+ * to the ibm,dynamic-memory property instead of adding/removing a
+ * memory node in the device tree. For these cases we still need to
+ * involve the notifier chain.
+ */
+ if (!strcmp(name, "ibm,dynamic-memory")) {
+ int action;
+
+ next_prop = parse_next_property(next_prop, end, &name,
+ &length, &value);
+ if (!next_prop)
+ return -EINVAL;
+
+ if (!strcmp(name, "add"))
+ action = PSERIES_DRCONF_MEM_ADD;
+ else
+ action = PSERIES_DRCONF_MEM_REMOVE;
+
+ blocking_notifier_call_chain(&pSeries_reconfig_chain,
+ action, value);
+ }
+
+ return 0;
}
/**
Index: linux-2.6.git/arch/powerpc/platforms/pseries/hotplug-memory.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/platforms/pseries/hotplug-memory.c 2008-07-01 09:38:49.000000000 -0500
+++ linux-2.6.git/arch/powerpc/platforms/pseries/hotplug-memory.c 2008-07-01 18:43:33.000000000 -0500
@@ -15,32 +15,11 @@
#include <asm/machdep.h>
#include <asm/pSeries_reconfig.h>
-static int pseries_remove_memory(struct device_node *np)
+static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
{
- const char *type;
- const unsigned int *regs;
- unsigned long base;
- unsigned int lmb_size;
- u64 start_pfn, start;
+ unsigned long start, start_pfn;
struct zone *zone;
- int ret = -EINVAL;
-
- /*
- * Check to see if we are actually removing memory
- */
- type = of_get_property(np, "device_type", NULL);
- if (type == NULL || strcmp(type, "memory") != 0)
- return 0;
-
- /*
- * Find the bae address and size of the lmb
- */
- regs = of_get_property(np, "reg", NULL);
- if (!regs)
- return ret;
-
- base = *(unsigned long *)regs;
- lmb_size = regs[3];
+ int ret;
start_pfn = base >> PFN_SECTION_SHIFT;
zone = page_zone(pfn_to_page(start_pfn));
@@ -71,13 +50,41 @@
return ret;
}
+static int pseries_remove_memory(struct device_node *np)
+{
+ const char *type;
+ const unsigned int *regs;
+ unsigned long base;
+ unsigned int lmb_size;
+ int ret = -EINVAL;
+
+ /*
+ * Check to see if we are actually removing memory
+ */
+ type = of_get_property(np, "device_type", NULL);
+ if (type == NULL || strcmp(type, "memory") != 0)
+ return 0;
+
+ /*
+ * Find the bae address and size of the lmb
+ */
+ regs = of_get_property(np, "reg", NULL);
+ if (!regs)
+ return ret;
+
+ base = *(unsigned long *)regs;
+ lmb_size = regs[3];
+
+ ret = pseries_remove_lmb(base, lmb_size);
+ return ret;
+}
+
static int pseries_add_memory(struct device_node *np)
{
const char *type;
const unsigned int *regs;
unsigned long base;
unsigned int lmb_size;
- u64 start_pfn;
int ret = -EINVAL;
/*
@@ -100,8 +107,37 @@
/*
* Update memory region to represent the memory add
*/
- lmb_add(base, lmb_size);
- return 0;
+ ret = lmb_add(base, lmb_size);
+ return (ret < 0) ? -EINVAL : 0;
+}
+
+static int pseries_drconf_memory(unsigned long *base, unsigned int action)
+{
+ struct device_node *np;
+ const unsigned long *lmb_size;
+ int rc;
+
+ np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
+ if (!np)
+ return -EINVAL;
+
+ lmb_size = of_get_property(np, "ibm,lmb-size", NULL);
+ if (!lmb_size) {
+ of_node_put(np);
+ return -EINVAL;
+ }
+
+ if (action == PSERIES_DRCONF_MEM_ADD) {
+ rc = lmb_add(*base, *lmb_size);
+ rc = (rc < 0) ? -EINVAL : 0;
+ } else if (action == PSERIES_DRCONF_MEM_REMOVE) {
+ rc = pseries_remove_lmb(*base, *lmb_size);
+ } else {
+ rc = -EINVAL;
+ }
+
+ of_node_put(np);
+ return rc;
}
static int pseries_memory_notifier(struct notifier_block *nb,
@@ -118,6 +154,11 @@
if (pseries_remove_memory(node))
err = NOTIFY_BAD;
break;
+ case PSERIES_DRCONF_MEM_ADD:
+ case PSERIES_DRCONF_MEM_REMOVE:
+ if (pseries_drconf_memory(node, action))
+ err = NOTIFY_BAD;
+ break;
default:
err = NOTIFY_DONE;
break;
^ permalink raw reply
* [PATCH 2/5 v2] Use base address to derive starting page frame number
From: Nathan Fontenot @ 2008-07-03 3:20 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <486C4462.4010004@austin.ibm.com>
Use the base address of the lmb to derive the starting page frame number
instead of trying to extract it from the drc index of the lmb. The drc
index should not be used for this as it will, and did, break.
Until this point, systems that have had memory represented in the device
tree with a node for each lmb the drc index would (luckily) closely
track the base address of the lmb. For example a lmb with a drc index
of 8000000a would have a base address of a0000000. This correlation
allowed the current code to derive the starting page frame number from
the drc inddex
Device tree layouts where lmbs are represented under the
ibm,dynamic-reconfiguration-memory node in the ibm,dynamic-memory
property do not have this correlation between the drc index and base
address of the lmb.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
arch/powerpc/platforms/pseries/hotplug-memory.c | 36 +++++++++++-------------
1 file changed, 17 insertions(+), 19 deletions(-)
Index: linux-2.6.git/arch/powerpc/platforms/pseries/hotplug-memory.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/platforms/pseries/hotplug-memory.c 2008-07-01 09:38:20.000000000 -0500
+++ linux-2.6.git/arch/powerpc/platforms/pseries/hotplug-memory.c 2008-07-01 09:38:49.000000000 -0500
@@ -18,8 +18,9 @@
static int pseries_remove_memory(struct device_node *np)
{
const char *type;
- const unsigned int *my_index;
const unsigned int *regs;
+ unsigned long base;
+ unsigned int lmb_size;
u64 start_pfn, start;
struct zone *zone;
int ret = -EINVAL;
@@ -32,17 +33,16 @@
return 0;
/*
- * Find the memory index and size of the removing section
+ * Find the bae address and size of the lmb
*/
- my_index = of_get_property(np, "ibm,my-drc-index", NULL);
- if (!my_index)
- return ret;
-
regs = of_get_property(np, "reg", NULL);
if (!regs)
return ret;
- start_pfn = section_nr_to_pfn(*my_index & 0xffff);
+ base = *(unsigned long *)regs;
+ lmb_size = regs[3];
+
+ start_pfn = base >> PFN_SECTION_SHIFT;
zone = page_zone(pfn_to_page(start_pfn));
/*
@@ -54,28 +54,29 @@
* to sysfs "state" file and we can't remove sysfs entries
* while writing to it. So we have to defer it to here.
*/
- ret = __remove_pages(zone, start_pfn, regs[3] >> PAGE_SHIFT);
+ ret = __remove_pages(zone, start_pfn, lmb_size >> PAGE_SHIFT);
if (ret)
return ret;
/*
* Update memory regions for memory remove
*/
- lmb_remove(start_pfn << PAGE_SHIFT, regs[3]);
+ lmb_remove(base, lmb_size);
/*
* Remove htab bolted mappings for this section of memory
*/
- start = (unsigned long)__va(start_pfn << PAGE_SHIFT);
- ret = remove_section_mapping(start, start + regs[3]);
+ start = (unsigned long)__va(base);
+ ret = remove_section_mapping(start, start + lmb_size);
return ret;
}
static int pseries_add_memory(struct device_node *np)
{
const char *type;
- const unsigned int *my_index;
const unsigned int *regs;
+ unsigned long base;
+ unsigned int lmb_size;
u64 start_pfn;
int ret = -EINVAL;
@@ -87,22 +88,19 @@
return 0;
/*
- * Find the memory index and size of the added section
+ * Find the base and size of the lmb
*/
- my_index = of_get_property(np, "ibm,my-drc-index", NULL);
- if (!my_index)
- return ret;
-
regs = of_get_property(np, "reg", NULL);
if (!regs)
return ret;
- start_pfn = section_nr_to_pfn(*my_index & 0xffff);
+ base = *(unsigned long *)regs;
+ lmb_size = regs[3];
/*
* Update memory region to represent the memory add
*/
- lmb_add(start_pfn << PAGE_SHIFT, regs[3]);
+ lmb_add(base, lmb_size);
return 0;
}
^ permalink raw reply
* [PATCH 1/5 v2] Allow phandle to be specified in formats other than decimal
From: Nathan Fontenot @ 2008-07-03 3:19 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <486C4462.4010004@austin.ibm.com>
Allow the phandle passed to the /proc/ppc64/ofdt file to be specified
in formats other than decimal. This allows us to easily specify phandle
values in hex that would otherwise appear as negative integers.
This is an issue on systems where the value of
/proc/device-tree/ibm,dynamic-reconfiguration-memory.ibm,phandle is
fffffff9. Having to pass this to the ofdt file as a string results in
a large negative number, and simple_strtoul() does not handle negative
numbers.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
arch/powerpc/platforms/pseries/reconfig.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.git/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/platforms/pseries/reconfig.c 2008-07-01 09:38:22.000000000 -0500
+++ linux-2.6.git/arch/powerpc/platforms/pseries/reconfig.c 2008-07-01 09:38:26.000000000 -0500
@@ -365,7 +365,7 @@
*buf = '\0';
buf++;
- handle = simple_strtoul(handle_str, NULL, 10);
+ handle = simple_strtoul(handle_str, NULL, 0);
*npp = of_find_node_by_phandle(handle);
return buf;
^ permalink raw reply
* [PATCH 0/5 v2] Update memory dlpar for dynamic reconfiguration memory
From: Nathan Fontenot @ 2008-07-03 3:15 UTC (permalink / raw)
To: linuxppc-dev
The following patchset corrects a set of issues for memory dlpar and the
representation of memory in the device tree under the
ibm,dynamic-reconfiguration-memory node.
On newer hardware and kernels, the device tree has changed so that all
memory appears under the ibm,dynamic-reconfiguration-memory node in the
device tree. This node has several properties that describe all possible
lmbs, lmb-size and numa affinity.
The ibm,dynamic-memory property is a list of all possible lmbs, where each
list entry contains the base address, drc index, associativity array index
and a set of flags.
The ibm,associativity-lookup-arrays property contains a list of associativity
arrays and the ibm,lmb-size property contains the size of the lmbs
For reference, each lmb available to the system was previously represented
with a node in the device tree, of the form /proc/device-tree/memory@XXXXXXXX.
Each of these memory nodes had properties such as "ibm,my-drc-index" for the
drc index and "regs" which contained the base address and lmb size of the lmb.
With the new device tree layout, code associated with memory dlpar needs to
be updated to parse the new device tree layout and properly call the memory
hotplug notifier chains. Additionally, numa associativity done during hotplug
add of memory needs an update for parsing the new device tree layout.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
^ permalink raw reply
* Re: [PATCH v2 4/5] spi: Add OF binding support for SPI busses
From: Jon Smirl @ 2008-07-03 3:02 UTC (permalink / raw)
To: Grant Likely
Cc: david-b, linuxppc-dev, fabrizio.garetto, linux-kernel,
spi-devel-general
In-Reply-To: <20080703010313.26187.99119.stgit@trillian.secretlab.ca>
On 7/2/08, Grant Likely <grant.likely@secretlab.ca> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> This patch adds support for populating an SPI bus based on data in the
> OF device tree. This is useful for powerpc platforms which use the
> device tree instead of discrete code for describing platform layout.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>
> drivers/of/Kconfig | 6 +++
> drivers/of/Makefile | 1 +
> drivers/of/of_spi.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/of_spi.h | 18 ++++++++++
> 4 files changed, 113 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index 3a7a11a..edd6e92 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -13,3 +13,9 @@ config OF_I2C
> depends on PPC_OF && I2C
> help
> OpenFirmware I2C accessors
> +
> +config OF_SPI
> + def_tristate SPI
> + depends on OF && PPC_OF && SPI
> + help
> + OpenFirmware SPI accessors
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index 548772e..4c3c6f8 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -2,3 +2,4 @@ obj-y = base.o
> obj-$(CONFIG_OF_DEVICE) += device.o platform.o
> obj-$(CONFIG_OF_GPIO) += gpio.o
> obj-$(CONFIG_OF_I2C) += of_i2c.o
> +obj-$(CONFIG_OF_SPI) += of_spi.o
> diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
> new file mode 100644
> index 0000000..ed0c807
> --- /dev/null
> +++ b/drivers/of/of_spi.c
> @@ -0,0 +1,88 @@
> +/*
> + * SPI OF support routines
> + * Copyright (C) 2008 Secret Lab Technologies Ltd.
> + *
> + * Support routines for deriving SPI device attachments from the device
> + * tree.
> + */
> +
> +#include <linux/of.h>
> +#include <linux/device.h>
> +#include <linux/spi/spi.h>
> +#include <linux/of_spi.h>
> +
> +/**
> + * of_register_spi_devices - Register child devices onto the SPI bus
> + * @master: Pointer to spi_master device
> + * @np: parent node of SPI device nodes
> + *
> + * Registers an spi_device for each child node of 'np' which has a 'reg'
> + * property.
> + */
> +void of_register_spi_devices(struct spi_master *master, struct device_node *np)
> +{
> + struct spi_device *spi;
> + struct device_node *nc;
> + const u32 *prop;
> + const char *sprop;
> + int rc;
> + int len;
> +
> + for_each_child_of_node(np, nc) {
> + /* Alloc an spi_device */
> + spi = spi_alloc_device(master);
> + if (!spi) {
> + dev_err(&master->dev, "spi_device alloc error for %s\n",
> + nc->full_name);
> + continue;
> + }
> +
> + /* Device address */
> + prop = of_get_property(nc, "reg", &len);
> + if (!prop || len < sizeof(*prop)) {
> + dev_err(&master->dev, "%s has no 'reg' property\n",
> + nc->full_name);
> + continue;
> + }
> + spi->chip_select = *prop;
> +
> + /* Mode (clock phase/polarity/etc.) */
> + if (of_find_property(nc, "spi,cpha", NULL))
> + spi->mode |= SPI_CPHA;
> + if (of_find_property(nc, "spi,cpol", NULL))
> + spi->mode |= SPI_CPOL;
> +
> + /* Device speed */
> + prop = of_get_property(nc, "max-speed", &len);
> + if (!prop || len < sizeof(*prop)) {
> + dev_err(&master->dev, "%s has no 'max-speed' property\n",
> + nc->full_name);
> + continue;
> + }
> + spi->max_speed_hz = *prop;
> +
> + /* IRQ */
> + spi->irq = irq_of_parse_and_map(nc, 0);
> +
> + /* Select device driver */
> + sprop = of_get_property(nc, "linux,modalias", &len);
> + if (sprop && len > 0)
> + strncpy(spi->modalias, sprop, KOBJ_NAME_LEN);
> + else
> + strncpy(spi->modalias, "spidev", KOBJ_NAME_LEN);
You're missing a request_module("%s", info.type) to make sure the
module is loaded.
It might make sense to share code with of_find_i2c_driver() so we have
a common way of guessing module names.
> +
> + /* Store a pointer to the node in the device structure */
> + of_node_get(nc);
> + spi->dev.archdata.of_node = nc;
> +
> + /* Register the new device */
> + rc = spi_add_device(spi);
> + if (rc) {
> + dev_err(&master->dev, "spi_device register error %s\n",
> + nc->full_name);
> + spi_dev_put(spi);
> + }
> +
> + }
> +}
> +EXPORT_SYMBOL(of_register_spi_devices);
> diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h
> new file mode 100644
> index 0000000..5f71ee8
> --- /dev/null
> +++ b/include/linux/of_spi.h
> @@ -0,0 +1,18 @@
> +/*
> + * OpenFirmware SPI support routines
> + * Copyright (C) 2008 Secret Lab Technologies Ltd.
> + *
> + * Support routines for deriving SPI device attachments from the device
> + * tree.
> + */
> +
> +#ifndef __LINUX_OF_SPI_H
> +#define __LINUX_OF_SPI_H
> +
> +#include <linux/of.h>
> +#include <linux/spi/spi.h>
> +
> +extern void of_register_spi_devices(struct spi_master *master,
> + struct device_node *np);
> +
> +#endif /* __LINUX_OF_SPI */
>
>
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Changing zImage load and entry point address?
From: Dave Littell @ 2008-07-03 0:42 UTC (permalink / raw)
To: linuxppc-embedded
Hi all,
For a 2.6.18-based zImage, how do I change the load and the entry point
addresses to something other than the default 0x800000? Changing the
.config (CONFIG_BOOT_LOAD_BOOL and CONFIG_BOOT_LOAD) seems to accomplish
nothing...
Thanks,
Dave
^ 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