[PATCH] using mii-bitbang on different processor ports - update the booting-without-of.txt-file

2007-11-06 Thread Sergej Stepanov
The patch updates the booting-without-of.txt-file.
There is a description for the case
if mdio data and clock pins are on different processor ports.
It is a extending for e-mail [PATCH v3] using mii-bitbang on different 
processor ports.

Signed-off-by: Sergej Stepanov [EMAIL PROTECTED]
--

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index a96e853..497d8d8 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1956,6 +1956,12 @@ platforms are moved over to use the 
flattened-device-tree model.
fsl,mdc-pin = 13;
};
 
+   The reg-property may have also depending on board design
+   the following form:
+   reg = 10d40 14 10d60 14;
+   In that case the pin for mdio data controlling is on the port C,
+   and the pin for mdio clock controlling is on the port D.
+
v) Baud Rate Generators
 
Currently defined compatibles:

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


problem in follow_hugetlb_page on ppc64 architecture with get_user_pages

2007-11-06 Thread Christoph Raisch

Hello,
if get_user_pages is used on a hugetlb vma, and there was no previous write
to the pages,
follow_hugetlb_page will call
ret = hugetlb_fault(mm, vma, vaddr, 0),
although the page should be used for write access in get_user_pages.

We currently see this when testing Infiniband on ppc64 with ehca +
hugetlbfs.
From reading the code this should also be an issue on other architectures.
Roland, Adam, are you aware of anything in this area with mellanox
Infiniband cards or other usages with I/O adapters?

Gruss / Regards
Christoph R. + Nam Ng.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 2.6.24-rc1-git15 Kernel build fails on powerpc - Unrecognized opcode: `dssall'

2007-11-06 Thread Balbir Singh
On Nov 6, 2007 4:04 PM, Kamalesh Babulal [EMAIL PROTECTED] wrote:
 Hi,

 The build fails on the power6 machine while compiling 2.6.24-rc1-git15 kernel,
 with randconfig,

   CHK include/linux/compile.h
   AS  arch/powerpc/kernel/swsusp_32.o
 arch/powerpc/kernel/swsusp_32.S: Assembler messages:
 arch/powerpc/kernel/swsusp_32.S:138: Error: Unrecognized opcode: `dssall'
 make[1]: *** [arch/powerpc/kernel/swsusp_32.o] Error 1
 make: *** [arch/powerpc/kernel] Error 2


Looks suspiciously like an altivec issue. Could you compile with make
V=1 and/or do a git bisect and see what broke?

Balbir
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 2.6.24-rc1-git15 Kernel build fails on powerpc - Unrecognized opcode: `dssall'

2007-11-06 Thread David Miller
From: Johannes Berg [EMAIL PROTECTED]
Date: Tue, 06 Nov 2007 11:54:46 +0100

 
 
 CHK include/linux/compile.h
 AS  arch/powerpc/kernel/swsusp_32.o
   arch/powerpc/kernel/swsusp_32.S: Assembler messages:
   arch/powerpc/kernel/swsusp_32.S:138: Error: Unrecognized opcode: `dssall'
   make[1]: *** [arch/powerpc/kernel/swsusp_32.o] Error 1
   make: *** [arch/powerpc/kernel] Error 2
  
  
  Looks suspiciously like an altivec issue. Could you compile with make
  V=1 and/or do a git bisect and see what broke?
 
 Looks more like a toolchain issue to me.

Or, this is another instance of the CFLAGS environment variable
problem.

For a few days, the kbuild stuff would integrate any CFLAGS,
AFLAGS, etc. settings you might have set in your environment.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 2.6.24-rc1-git15 Kernel build fails on powerpc - Unrecognized opcode: `dssall'

2007-11-06 Thread Kamalesh Babulal
David Miller wrote:
 From: Johannes Berg [EMAIL PROTECTED]
 Date: Tue, 06 Nov 2007 11:54:46 +0100
 

   CHK include/linux/compile.h
   AS  arch/powerpc/kernel/swsusp_32.o
 arch/powerpc/kernel/swsusp_32.S: Assembler messages:
 arch/powerpc/kernel/swsusp_32.S:138: Error: Unrecognized opcode: `dssall'
 make[1]: *** [arch/powerpc/kernel/swsusp_32.o] Error 1
 make: *** [arch/powerpc/kernel] Error 2

 Looks suspiciously like an altivec issue. Could you compile with make
 V=1 and/or do a git bisect and see what broke?
 Looks more like a toolchain issue to me.
 
 Or, this is another instance of the CFLAGS environment variable
 problem.
 
 For a few days, the kbuild stuff would integrate any CFLAGS,
 AFLAGS, etc. settings you might have set in your environment.

Hi Balbir,

The Build error of kernel compilation with V=1

make -f scripts/Makefile.build obj=arch/powerpc/kernel
make -f scripts/Makefile.build obj=arch/powerpc/kernel/vdso32
  gcc -m32 -Wp,-MD,arch/powerpc/kernel/.swsusp_32.o.d  -nostdinc -isystem 
/usr/lib/gcc/ppc64-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include 
include/linux/autoconf.h -Iarch/powerpc -D__ASSEMBLY__ -Iarch/powerpc -Wa,-m405 
-gdwarf-2 -c -o arch/powerpc/kernel/swsusp_32.o 
arch/powerpc/kernel/swsusp_32.S
arch/powerpc/kernel/swsusp_32.S: Assembler messages:
arch/powerpc/kernel/swsusp_32.S:138: Error: Unrecognized opcode: `dssall'
make[1]: *** [arch/powerpc/kernel/swsusp_32.o] Error 1
make: *** [arch/powerpc/kernel] Error 2

-- 
Thanks  Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2 05/12] [POWERPC] Export mpc52xx_map_node() routine symbol

2007-11-06 Thread Marian Balakowicz

Hi Stephan,

Stephen Rothwell wrote:
 
 On Sun, 04 Nov 2007 00:52:40 +0100 Marian Balakowicz [EMAIL PROTECTED] 
 wrote:
 -static void __iomem *
 +void __iomem *
  mpc52xx_map_node(struct device_node *ofn)
  {
  const u32 *regaddr_p;
 @@ -48,6 +48,8 @@ mpc52xx_map_node(struct device_node *ofn)
  return ioremap((u32)regaddr64, (u32)size64);
  }
  
 +EXPORT_SYMBOL(mpc52xx_map_node);
 +
 
 We generally don't leave a blank line between a function an its
 EXPORT_SYMBOL().

Will fix that.

 Also, any reason not to use EXPORT_SYMBOL_GPL?

No, no particular reason, I used EXPORT_SYMBOL because it's used for
exporting symbols in this file. But that's good point, I'll switch  to
EXPORT_SYMBOL_GPL and I guess it would be nice to convert other
EXPORT_SYMBOL to EXPORT_SYMBOL_GPL as well, but that would be a
separate patch.

Cheers,
m.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2 10/12] [POWERPC] Motion-PRO: Add LED support.

2007-11-06 Thread Marian Balakowicz

Hi Stephen,

Stephen Rothwell wrote:
 On Sun, 04 Nov 2007 00:53:11 +0100 Marian Balakowicz [EMAIL PROTECTED] 
 wrote:
 +++ b/drivers/leds/leds-motionpro.c
[snip]
 +#include asm/io.h
 +#include asm/of_platform.h
 
 You want linux/of_platform.h instead of asm/.. and probably not
 linux/platform_device.h above.
[snip]

Thanks for comments, I'll apply your suggestions for v3 respin of the
patches.

Cheers,
m.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Replace some #includes of asm/of_platform.h with linux/of_platform.h.

2007-11-06 Thread Jon Loeliger
So, like, the other day Stephen Rothwell mumbled:
 
 Hi Jon,
 
 Thanks for starting this.

No problem.

   #include asm/of_device.h
 
 asm/of_device.h - linux/of_device.h as well?  :-)


Oh!  Sure!  I'll respin these two.

jdl
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 2.6.24-rc1-git15 Kernel build fails on powerpc - Unrecognized opcode: `dssall'

2007-11-06 Thread Balbir Singh
Kamalesh Babulal wrote:
 David Miller wrote:
 From: Johannes Berg [EMAIL PROTECTED]
 Date: Tue, 06 Nov 2007 11:54:46 +0100

   CHK include/linux/compile.h
   AS  arch/powerpc/kernel/swsusp_32.o
 arch/powerpc/kernel/swsusp_32.S: Assembler messages:
 arch/powerpc/kernel/swsusp_32.S:138: Error: Unrecognized opcode: `dssall'
 make[1]: *** [arch/powerpc/kernel/swsusp_32.o] Error 1
 make: *** [arch/powerpc/kernel] Error 2

 Looks suspiciously like an altivec issue. Could you compile with make
 V=1 and/or do a git bisect and see what broke?
 Looks more like a toolchain issue to me.
 Or, this is another instance of the CFLAGS environment variable
 problem.

 For a few days, the kbuild stuff would integrate any CFLAGS,
 AFLAGS, etc. settings you might have set in your environment.
 
 Hi Balbir,
 
 The Build error of kernel compilation with V=1
 
 make -f scripts/Makefile.build obj=arch/powerpc/kernel
 make -f scripts/Makefile.build obj=arch/powerpc/kernel/vdso32
   gcc -m32 -Wp,-MD,arch/powerpc/kernel/.swsusp_32.o.d  -nostdinc -isystem 
 /usr/lib/gcc/ppc64-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  
 -include include/linux/autoconf.h -Iarch/powerpc -D__ASSEMBLY__ 
 -Iarch/powerpc -Wa,-m405 -gdwarf-2 -c -o arch/powerpc/kernel/swsusp_32.o 
 arch/powerpc/kernel/swsusp_32.S
 arch/powerpc/kernel/swsusp_32.S: Assembler messages:
 arch/powerpc/kernel/swsusp_32.S:138: Error: Unrecognized opcode: `dssall'
 make[1]: *** [arch/powerpc/kernel/swsusp_32.o] Error 1
 make: *** [arch/powerpc/kernel] Error 2
 

I looked at your .config and now your  build. It looks like you select
CONFIG_4xx (I see -Wa,-m405) and compile swsusp_32.S. The
compiler/toolchain does not enable altivec instructions for CONFIG_4xx.
If CONFIG_HIBERNATION is enabled as in your case, it compiles
swsusp_32.S which assumes that ALTIVEC is enabled (see CPU_FTR_ALTIVEC).

You ideally need to have -Wa,-maltivec passed in your CFLAGS.

-- 
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 0/3] Add device-tree aware NDFC driver

2007-11-06 Thread Valentine Barshak
Thomas Gleixner wrote:
 Valentine,
 You know, you're really too tense Thomas. I'm not sure of the reason why
 you're being a complete nerve, but I'm feeling sorry for you.
 
 You have a perception problem. I'm not tense, I'm grumpy.

:)

 
 Rest assured, that my nerves are completely fine despite of the fact
 that you try to rack them.

That's good to hear :)

 
 I'm not saying my approach is the best, but I was hoping for a discussion.
 I've reworked the patches according to the comments to the previous version
 and used my arguments to explain why I don't see much reason to mess with the
 code we currently have and added a separate _of version.
 
 This is the exact point. You were asked to fix up the existing driver
 instead of replacing it and to do it with a series of incremental
 patches. You copied the old code anyway and modified it, so we want to
 have this documented in the history. This is not my obsession, it's
 common kernel coding practise. The fact that you do not see much
 reason to do it does not change this at all.

Replacing the original driver is not my obsession either.
I just don't see the right way to modify the original driver to 
support both platform devices and the new OF implementation. I see some 
initialization order problems with the original version, and I think 
that the easiest way to handle ndfc and chips attached to it would be to 
  do it in a single probe() function instead of having separate chip 
devices and a separate ndfc platform device on top of that.

So, my opinion is that modifying the original code involves ndfc users' 
modification. Considering the fact that ppc removal is scheduled for the 
next summer, I thought that we could leave the original version intact 
and build the new OF one.

I know the common kernel practice, but if we always followed it we'd 
never bring up arch/powerpc.
BTW, I've posted some of the ndfc questions to the MTD mailing list
(http://lists.infradead.org/pipermail/linux-mtd/2007-November/019769.html). 
If I had the answers I might get a more clear idea about the right way 
to do it. I'd appreciate if you could take a look.

 
 I'm sure you'd find some time to do it yourself the right way once and
 forever with a nice series of incremental patches to fix what we currently
 have (call it a dump or anything you like) and even maybe add new device
 tree support.
 
 It might be time for you to try to understand how OSS development
 works.

I do understand how it works.

 
 I'm sorry if for some reason I've made you feel bad.
 
 What do you expect, after you abused my Signed-off-by in a way which
 might have tricked David into pulling your code as is? This was
 pointed out to you and you did not even bother to apologize.

I apologize.
If I wanted to abuse or trick somebody and get my code in as fast as 
possible no matter what, I wouldn't cc the maintainer, the other people 
interested and send it to both mtd and ppc mailing lists.
I don't see any possible way for a guy who hasn't worked with the MTD 
community much to trick someone and get his patches in.

 
 This is the last time I disturb you with my e-mail, so please, forget it.
 
 Interesting. I thought you wanted to get the patch in, so you probably
 should ask yourself whether it is a good idea _not_ to talk to the
 responsible maintainer.

As I said above, I don't see the right way to do it. And actually I 
didn't expect you to share your thoughts and reasons on how to support 
both implementations and why this way is preferred. All I heard were 
cursing and direct orders to stop tying to explain my reasons and do it 
the right way. It looked like the responsible maintainer just wouldn't 
listen. Why talk then?

 
 If you gave up on that, it just makes it more obvious that you do not
 want to work with the community and just wanted to dump your patch and
 move along.

I never give up ;) and I didn't say I was going to stop working with the 
community.

 
  tglx

Cheers,
Valentine.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: problem in follow_hugetlb_page on ppc64 architecture with get_user_pages

2007-11-06 Thread aglitke
Please try this patch and see if it helps.

commit 6decbd17d6fb70d50f6db2c348bb41d7246a67d1
Author: Adam Litke [EMAIL PROTECTED]
Date:   Tue Nov 6 06:59:12 2007 -0800

hugetlb: follow_hugetlb_page for write access

When calling get_user_pages(), a write flag is passed in by the caller to
indicate if write access is required on the faulted-in pages.  Currently,
follow_hugetlb_page() ignores this flag and always faults pages for
read-only access.

This patch passes the write flag down to follow_hugetlb_page() and makes
sure hugetlb_fault() is called with the right write_access parameter.

Test patch only.  Not Signed-off.

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 3a19b03..31fa0a0 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -19,7 +19,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct 
*vma)
 int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user 
*, size_t *, loff_t *);
 int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void 
__user *, size_t *, loff_t *);
 int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct 
vm_area_struct *);
-int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct 
page **, struct vm_area_struct **, unsigned long *, int *, int);
+int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct 
page **, struct vm_area_struct **, unsigned long *, int *, int, int);
 void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned 
long);
 void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned 
long);
 int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index eab8c42..b645985 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -621,7 +621,8 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
 
 int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
struct page **pages, struct vm_area_struct **vmas,
-   unsigned long *position, int *length, int i)
+   unsigned long *position, int *length, int i,
+   int write)
 {
unsigned long pfn_offset;
unsigned long vaddr = *position;
@@ -643,7 +644,7 @@ int follow_hugetlb_page(struct mm_struct *mm, struct 
vm_area_struct *vma,
int ret;
 
spin_unlock(mm-page_table_lock);
-   ret = hugetlb_fault(mm, vma, vaddr, 0);
+   ret = hugetlb_fault(mm, vma, vaddr, write);
spin_lock(mm-page_table_lock);
if (!(ret  VM_FAULT_ERROR))
continue;
diff --git a/mm/memory.c b/mm/memory.c
index f82b359..1bcd444 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1039,7 +1039,7 @@ int get_user_pages(struct task_struct *tsk, struct 
mm_struct *mm,
 
if (is_vm_hugetlb_page(vma)) {
i = follow_hugetlb_page(mm, vma, pages, vmas,
-   start, len, i);
+   start, len, i, write);
continue;
}
 

On Tue, 2007-11-06 at 08:42 +0100, Christoph Raisch wrote:
 Hello,
 if get_user_pages is used on a hugetlb vma, and there was no previous write
 to the pages,
 follow_hugetlb_page will call
 ret = hugetlb_fault(mm, vma, vaddr, 0),
 although the page should be used for write access in get_user_pages.
 
 We currently see this when testing Infiniband on ppc64 with ehca +
 hugetlbfs.
 From reading the code this should also be an issue on other architectures.
 Roland, Adam, are you aware of anything in this area with mellanox
 Infiniband cards or other usages with I/O adapters?
 
 Gruss / Regards
 Christoph R. + Nam Ng.
 
 
-- 
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: problem in follow_hugetlb_page on ppc64 architecture with get_user_pages

2007-11-06 Thread Hoang-Nam Nguyen
Hello Roland!
 We currently see this when testing Infiniband on ppc64 with ehca +
 hugetlbfs.
 From reading the code this should also be an issue on other architectures.
 Roland, Adam, are you aware of anything in this area with mellanox
 Infiniband cards or other usages with I/O adapters?
Below is a testcase demonstrating this problem. You need to install
libhugetlbfs.so and run it as below:
HUGETLB_MORECORE=yes LD_PRELOAD=libhugetlbfs.so ./hugetlb_ibtest 100

This testcase does the following steps (high level desc):
1. malloc two buffers each of 100MB for send and recv
2. register them as memory regions
3. create queue pair QP
4. send data in send buffer using QP to itself (target is then recv buffer)
5. compare those buffers content

It runs fine without libhugetlbsf. If you call it with libhugetlbfs as
above, step 5 will fail. If you do memset() of the buffers before step 2
(register mr), then it runs without errors.
It appears that hugetlb_cow() is called when first write access is performed
after mrs have been registered. That means the testcase is seeing other pages
than the ones registered to the adapter...

I was able reproduce this with mthca on 2.6.23/ppc64 and fc6/intel.

Regards
Nam




#include stdio.h
#include string.h
#include assert.h
#include malloc.h
#include unistd.h
#include infiniband/verbs.h

static unsigned int pagesize;
static unsigned int bufsize=1024*1024*19;

int cmp_data(void *s, void *d, unsigned long len, unsigned long *fail_pos)
{
unsigned char *cs = s, *cd = d;
assert(cs);
assert(cd);
assert(fail_pos);
*fail_pos = 0;
while (len) {
if (*cs  *cd)
return -1;
if (*cs  *cd)
return 1;
len--;
cs++;
cd++;
*fail_pos += 1;
}
return 0;
}

int hugetlb_ibtest(struct ibv_device* device)
{
struct ibv_context *context = NULL;
struct ibv_port_attr port_attr;
struct ibv_pd *pd = NULL;
struct ibv_cq *send_cq = NULL;
struct ibv_cq *recv_cq = NULL;
struct ibv_qp *qp = NULL;
struct ibv_mr *send_mr = NULL;
struct ibv_mr *recv_mr = NULL;
unsigned char *send_buffer = NULL;
unsigned char *recv_buffer = NULL;
int port = 1; // hardcoded for now
int rc = 0;

context = ibv_open_device(device);
assert(context!=NULL);

// query port
memset(port_attr, 0, sizeof(port_attr));
rc = ibv_query_port(context, port, port_attr);
assert(rc==0);

// pd
pd = ibv_alloc_pd(context);
assert(pd!=NULL);

// ah
struct ibv_ah_attr ah_attr = {
.is_global = 0,
.dlid  = port_attr.lid,
.sl= 0,
.src_path_bits = 0,
.port_num  = port,
.static_rate = 3
};
struct ibv_ah *ah = ibv_create_ah(pd, ah_attr);
assert(ah!=NULL);

// send cq
send_cq = ibv_create_cq(context, 1, NULL, NULL, 0);
assert(send_cq!=NULL);

// recv cq
recv_cq = ibv_create_cq(context, 1, NULL, NULL, 0);
assert(recv_cq!=NULL);

// qp
struct ibv_qp_init_attr attr = {
.send_cq = send_cq,
.recv_cq = recv_cq,
.cap = {
.max_send_wr  = 2,
.max_recv_wr  = 2,
.max_send_sge = 1,
.max_recv_sge = 1
},
.qp_type = IBV_QPT_RC,
};
qp = ibv_create_qp(pd, attr);
assert(qp!=NULL);

// qp RESET - INIT
struct ibv_qp_attr qp_attr;
memset(qp_attr, 0, sizeof(qp_attr));
qp_attr.qp_state = IBV_QPS_INIT;
qp_attr.pkey_index = 0;
qp_attr.port_num = port;
qp_attr.qp_access_flags = 0;
rc = ibv_modify_qp(qp, qp_attr,
   IBV_QP_STATE|
   IBV_QP_PKEY_INDEX   |
   IBV_QP_PORT |
   IBV_QP_ACCESS_FLAGS);
assert(rc==0);

// qp INIT - RTR
memset(qp_attr, 0, sizeof(qp_attr));
qp_attr.qp_state = IBV_QPS_RTR;
qp_attr.rq_psn   = 0;
qp_attr.max_rd_atomic = 1;
qp_attr.dest_qp_num = qp-qp_num;
qp_attr.path_mtu = IBV_MTU_2048;
qp_attr.ah_attr = ah_attr;
qp_attr.min_rnr_timer = 0;
rc = ibv_modify_qp(qp, qp_attr,
   IBV_QP_STATE | IBV_QP_RQ_PSN |
   IBV_QP_MAX_DEST_RD_ATOMIC |
   IBV_QP_DEST_QPN | IBV_QP_PATH_MTU |
   IBV_QP_AV | IBV_QP_MIN_RNR_TIMER);
assert(rc==0);

// qp RTR - RTS
memset(qp_attr, 0, sizeof(qp_attr));
qp_attr.qp_state = 

Problem with PHYS_64BIT on E500 Core (2.6.23.1)

2007-11-06 Thread Morrison, Tom
I have a MPC8548E Board in which with an earlier version of 
the kernel (2.6.11++), we customized head_e500.S and other 
files to support the PHYS_64BIT  PTE_64BIT based upon 
the work done for PPC64. It works very well.

I am attempting to update our kernel to the latest and have
gotten the basic system up  running (with some hacks/problems
that I won't until I am finished). We are using cuboot.85xx 
image because our u-boot does NOT support dtb.

I noticed that the head_fsl_booke.S had the Large Physical 
Address support, and I ported the other changes required, but
I get nowhere close to the code before the processor hangs.
I have tracked it down to where it is booting into the vmlinux
(which I assume is into the head_fsl_booke.S). We haven't 
hooked a debugger up to this yet - but I am positive that it
isn't making out of this initialization code in the initial 
assembly code.

The question is: Has anyone actually tried this to do this yet?

Thanks in advance for your responses!

Tom Morrison
Principal S/W Engineer
Empirix, Inc (www.empirix.com)
[EMAIL PROTECTED]
(781) 266 - 3567

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 2.6.24-rc1-git15 Kernel build fails on powerpc - Unrecognized opcode: `dssall'

2007-11-06 Thread Andy Whitcroft
On Tue, Nov 06, 2007 at 07:09:40PM +0530, Balbir Singh wrote:
 Kamalesh Babulal wrote:
  David Miller wrote:
  From: Johannes Berg [EMAIL PROTECTED]
  Date: Tue, 06 Nov 2007 11:54:46 +0100
 
CHK include/linux/compile.h
AS  arch/powerpc/kernel/swsusp_32.o
  arch/powerpc/kernel/swsusp_32.S: Assembler messages:
  arch/powerpc/kernel/swsusp_32.S:138: Error: Unrecognized opcode: 
  `dssall'
  make[1]: *** [arch/powerpc/kernel/swsusp_32.o] Error 1
  make: *** [arch/powerpc/kernel] Error 2
 
  Looks suspiciously like an altivec issue. Could you compile with make
  V=1 and/or do a git bisect and see what broke?
  Looks more like a toolchain issue to me.
  Or, this is another instance of the CFLAGS environment variable
  problem.
 
  For a few days, the kbuild stuff would integrate any CFLAGS,
  AFLAGS, etc. settings you might have set in your environment.
  
  Hi Balbir,
  
  The Build error of kernel compilation with V=1
  
  make -f scripts/Makefile.build obj=arch/powerpc/kernel
  make -f scripts/Makefile.build obj=arch/powerpc/kernel/vdso32
gcc -m32 -Wp,-MD,arch/powerpc/kernel/.swsusp_32.o.d  -nostdinc -isystem 
  /usr/lib/gcc/ppc64-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  
  -include include/linux/autoconf.h -Iarch/powerpc -D__ASSEMBLY__ 
  -Iarch/powerpc -Wa,-m405 -gdwarf-2 -c -o 
  arch/powerpc/kernel/swsusp_32.o arch/powerpc/kernel/swsusp_32.S
  arch/powerpc/kernel/swsusp_32.S: Assembler messages:
  arch/powerpc/kernel/swsusp_32.S:138: Error: Unrecognized opcode: `dssall'
  make[1]: *** [arch/powerpc/kernel/swsusp_32.o] Error 1
  make: *** [arch/powerpc/kernel] Error 2
  
 
 I looked at your .config and now your  build. It looks like you select
 CONFIG_4xx (I see -Wa,-m405) and compile swsusp_32.S. The
 compiler/toolchain does not enable altivec instructions for CONFIG_4xx.
 If CONFIG_HIBERNATION is enabled as in your case, it compiles
 swsusp_32.S which assumes that ALTIVEC is enabled (see CPU_FTR_ALTIVEC).
 
 You ideally need to have -Wa,-maltivec passed in your CFLAGS.

So that sounds like a Kconfig problem then?  That HIBERATION requires
ALITIVEC and yet does not depend on it or set it.

-apw
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: problem in follow_hugetlb_page on ppc64 architecture with get_user_pages

2007-11-06 Thread Hoang-Nam Nguyen
Hi Adam!
On Tuesday 06 November 2007 16:05, aglitke wrote:
 Please try this patch and see if it helps.
Tested on 2.6.22 (don't have the system with 2.6.23 at the moment) and
the testcase ran perfectly.
Thanks!
Nam

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Scott Wood
Jon Smirl wrote:
 On 11/5/07, Scott Wood [EMAIL PROTECTED] wrote:
 One side effect is that legacy style i2c drivers won't work anymore.
 If you mean legacy-style client drivers, why not?
 i2c_new_device() doesn't work with legacy-style client drivers.
 No, but they should still work the old way.
 
 I'm not in favor trying to support both legacy and new style i2c
 drivers.

I don't understand what it is that you did that would break support for 
legacy clients, though.

  It took me all of five minutes to convert an existing legacy
 driver to the new style. Pretty much all you need to do is delete code
 (about 100 lines). So I'd recommend converting the drivers we are
 interest in instead of trying to support both types.

Sure, conversion is good, but that doesn't mean we want things to 
suddenly break for users.

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Jean Delvare
Hi Scott, Jon,

On Mon, 05 Nov 2007 14:51:51 -0600, Scott Wood wrote:
 Jon Smirl wrote:
  How about renaming the old driver file and leaving it hooked to ppc?
  Then it would get deleted when ppc goes away. That would let work
  progress on the powerpc version.
 
 Or we could have one driver that has two probe methods.  I don't like 
 forking the driver.

I agree with Scott here, I don't want to fork the drivers. It is
possible (and easy) to support both methods in the same module, let's
just to that. See for example David Brownell's work on the lm75 driver:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-September/021270.html

  i2c_new_device() doesn't work with legacy-style client drivers.
 
 No, but they should still work the old way.

Definitely.

  This is not hard to do but the i2c people will have to agree. I need
  to change the i2c_driver structure to include the additional names.
 
 I got a fair bit of resistance from them on the topic of multiple match 
 names for i2c clients.

Really? All I said is that you were a bit late in the game because this
had been discussed before. I know that David Brownell doesn't agree
with you (he designed what we have now), but me, I am still open to
discussing the matter, especially when more people complain about the
situation every month.

  We might as well just use i2c_new_device() instead of messing around
  with bus numbers.  Note that this is technically no longer platform
  code, so it's harder to justify claiming the static numberspace.
  
  I was allowing control of the bus number with cell-index and
  i2c_add_numbered_adapter().
  Should I get rid of this and switch to i2c_add_adapter()?
 
 Yes.

No! If you don't call i2c_add_numbered_adapter() then new-style i2c
clients will never work on your i2c adapter.

-- 
Jean Delvare
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Scott Wood
Jean Delvare wrote:
 We might as well just use i2c_new_device() instead of messing around
 with bus numbers.  Note that this is technically no longer platform
 code, so it's harder to justify claiming the static numberspace.
 I was allowing control of the bus number with cell-index and
 i2c_add_numbered_adapter().
 Should I get rid of this and switch to i2c_add_adapter()?
 Yes.
 
 No! If you don't call i2c_add_numbered_adapter() then new-style i2c
 clients will never work on your i2c adapter.

I thought that was what i2c_new_device() was for?

By handling all the device tree stuff in the driver, it acts more like 
an add-on adapter than a platform device.

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Jon Smirl
On 11/6/07, Jean Delvare [EMAIL PROTECTED] wrote:
 Hi Scott, Jon,

 On Mon, 05 Nov 2007 14:51:51 -0600, Scott Wood wrote:
  Jon Smirl wrote:
   How about renaming the old driver file and leaving it hooked to ppc?
   Then it would get deleted when ppc goes away. That would let work
   progress on the powerpc version.
 
  Or we could have one driver that has two probe methods.  I don't like
  forking the driver.

 I agree with Scott here, I don't want to fork the drivers. It is
 possible (and easy) to support both methods in the same module, let's
 just to that. See for example David Brownell's work on the lm75 driver:
 http://lists.lm-sensors.org/pipermail/lm-sensors/2007-September/021270.html

I agree that it is easy to make make a chip driver support both new
and old style.

But when I call i2c_new_device() on an old style chip driver it exits
saying that it doesn't work for the old style adapters. Checks for
is_newstyle_driver() are in the i2c_new_device code. That's what
caused me to rewrite the rtc-pcf8563 driver for the new style. This
probably related to probing, I have to pass the address in struct
i2c_board_info. The old style drivers don't support having their
address passed in.

This may be complicated by the fact that the rtc drivers I'm working
on are not probable. That's why I want to add device tree support for
them.

If this is going to work on an old style driver, how do I get the address to it?

-- 
Jon Smirl
[EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Jean Delvare
Hi Scott,

On Tue, 06 Nov 2007 11:36:23 -0600, Scott Wood wrote:
 Jean Delvare wrote:
  We might as well just use i2c_new_device() instead of messing around
  with bus numbers.  Note that this is technically no longer platform
  code, so it's harder to justify claiming the static numberspace.
  I was allowing control of the bus number with cell-index and
  i2c_add_numbered_adapter().
  Should I get rid of this and switch to i2c_add_adapter()?
  Yes.
  
  No! If you don't call i2c_add_numbered_adapter() then new-style i2c
  clients will never work on your i2c adapter.
 
 I thought that was what i2c_new_device() was for?

Sorry, I've not been completely clear. Yes, you can use
i2c_new_device() on an adapter that has been added with
i2c_add_adapter(). However, this requires that you have a reference to
that i2c_adapter, which is usually not the case with system-wide I2C
buses. Embedded platforms would rather use i2c_add_numbered_adapter(),
give a list of chips to i2c_register_board_info() and let i2c-core
instantiate them. i2c_new_device was primarily meant for multimedia
adapters.

 By handling all the device tree stuff in the driver, it acts more like 
 an add-on adapter than a platform device.

-- 
Jean Delvare
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH Rev 2] 4xx: Replace #includes of asm/of_platform.h with linux/of_platform.h.

2007-11-06 Thread Jon Loeliger
From: Jon Loeliger [EMAIL PROTECTED]

Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
Acked-by: Stephen Rothwell [EMAIL PROTECTED]
---
Chip away at some janitor work.
Add sfr's ACK.

 arch/powerpc/platforms/40x/walnut.c  |3 ++-
 arch/powerpc/platforms/44x/bamboo.c  |3 ++-
 arch/powerpc/platforms/44x/ebony.c   |3 ++-
 arch/powerpc/platforms/44x/sequoia.c |3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/40x/walnut.c 
b/arch/powerpc/platforms/40x/walnut.c
index eb0c136..ff6db24 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -17,12 +17,13 @@
  */
 
 #include linux/init.h
+#include linux/of_platform.h
+
 #include asm/machdep.h
 #include asm/prom.h
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
-#include asm/of_platform.h
 
 static struct of_device_id walnut_of_bus[] = {
{ .compatible = ibm,plb3, },
diff --git a/arch/powerpc/platforms/44x/bamboo.c 
b/arch/powerpc/platforms/44x/bamboo.c
index 470e1a3..be23f11 100644
--- a/arch/powerpc/platforms/44x/bamboo.c
+++ b/arch/powerpc/platforms/44x/bamboo.c
@@ -14,12 +14,13 @@
  * option) any later version.
  */
 #include linux/init.h
+#include linux/of_platform.h
+
 #include asm/machdep.h
 #include asm/prom.h
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
-#include asm/of_platform.h
 #include 44x.h
 
 static struct of_device_id bamboo_of_bus[] = {
diff --git a/arch/powerpc/platforms/44x/ebony.c 
b/arch/powerpc/platforms/44x/ebony.c
index 40e18fc..6cd3476 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -17,12 +17,13 @@
  */
 
 #include linux/init.h
+#include linux/of_platform.h
+
 #include asm/machdep.h
 #include asm/prom.h
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
-#include asm/of_platform.h
 
 #include 44x.h
 
diff --git a/arch/powerpc/platforms/44x/sequoia.c 
b/arch/powerpc/platforms/44x/sequoia.c
index 30700b3..21a9dd1 100644
--- a/arch/powerpc/platforms/44x/sequoia.c
+++ b/arch/powerpc/platforms/44x/sequoia.c
@@ -14,12 +14,13 @@
  * option) any later version.
  */
 #include linux/init.h
+#include linux/of_platform.h
+
 #include asm/machdep.h
 #include asm/prom.h
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
-#include asm/of_platform.h
 #include 44x.h
 
 static struct of_device_id sequoia_of_bus[] = {
-- 
1.5.3.1.139.g9346b

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Jean Delvare
Hi Jon,

On Tue, 6 Nov 2007 12:45:24 -0500, Jon Smirl wrote:
 On 11/6/07, Jean Delvare wrote:
  I agree with Scott here, I don't want to fork the drivers. It is
  possible (and easy) to support both methods in the same module, let's
  just to that. See for example David Brownell's work on the lm75 driver:
  http://lists.lm-sensors.org/pipermail/lm-sensors/2007-September/021270.html
 
 I agree that it is easy to make make a chip driver support both new
 and old style.
 
 But when I call i2c_new_device() on an old style chip driver it exits
 saying that it doesn't work for the old style adapters. Checks for
 is_newstyle_driver() are in the i2c_new_device code. That's what
 caused me to rewrite the rtc-pcf8563 driver for the new style. This
 probably related to probing, I have to pass the address in struct
 i2c_board_info. The old style drivers don't support having their
 address passed in.

I know that. The trick is to register two struct i2c_driver (again see
the lm75 example), one old-style, one new-style. I agree it's not very
elegant, but it works. Hopefully we can get rid of the old-style one
after some time, and it allows for a smooth transition.

 This may be complicated by the fact that the rtc drivers I'm working
 on are not probable. That's why I want to add device tree support for
 them.
 
 If this is going to work on an old style driver, how do I get the
 address to it?

Old-style drivers probe for supported chips on all possible addresses
(for the chip in question). If the chip can't be probed, then module
parameters must be used. That's not terribly convenient, and new-style
drivers are much preferred in this case.

-- 
Jean Delvare
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: libfdt: Fix sw_tree1 testcase

2007-11-06 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
 Crud, I screwed up and gave you an intermediate version of the patch
 which tried to do the same thing for rw_tree1.  For that to work, I'll
 need to write a dtbs_equal_notordered test.
 
 Corrected version below.
 
 libfdt: Fix sw_tree1 testcase
 
 There is a bug in the sw_tree1 testcase / utility which puts two
 compatible properties in one node in the output tree.  This patch
 fixes the bug, and also adds a new test checking that the sw_tree1
 output is equal to test_tree1.dtb as its supposed to be, which should
 catch future errors of this type.
 
 Signed-off-by: David Gibson [EMAIL PROTECTED]

Applied.

Thanks,
jdl
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Grant Likely
On 11/6/07, Jean Delvare [EMAIL PROTECTED] wrote:
 Hi Scott,

 On Tue, 06 Nov 2007 11:36:23 -0600, Scott Wood wrote:
  Jean Delvare wrote:
   We might as well just use i2c_new_device() instead of messing around
   with bus numbers.  Note that this is technically no longer platform
   code, so it's harder to justify claiming the static numberspace.
   I was allowing control of the bus number with cell-index and
   i2c_add_numbered_adapter().
   Should I get rid of this and switch to i2c_add_adapter()?
   Yes.
  
   No! If you don't call i2c_add_numbered_adapter() then new-style i2c
   clients will never work on your i2c adapter.
 
  I thought that was what i2c_new_device() was for?

 Sorry, I've not been completely clear. Yes, you can use
 i2c_new_device() on an adapter that has been added with
 i2c_add_adapter(). However, this requires that you have a reference to
 that i2c_adapter, which is usually not the case with system-wide I2C
 buses. Embedded platforms would rather use i2c_add_numbered_adapter(),
 give a list of chips to i2c_register_board_info() and let i2c-core
 instantiate them. i2c_new_device was primarily meant for multimedia
 adapters.

*Some* embedded platforms would rather use i2c_add_numbered_adapter().  :-)

On powerpc, and other platforms which have a device tree, we don't
need to define a table of devices in the platform code because we've
already got a rich structure for describing such things.  The i2c
busses and i2c devices are grouped together in the device tree, so
when the i2c bus is probed, it should call out to common i2c device
tree parsing code to instantiate all the devices described in the
tree.

It would be awkward to describe the i2c bus in the device tree but
still have to use a static structure to describe the devices on that
bus.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Scott Wood
Jean Delvare wrote:
 Sorry, I've not been completely clear. Yes, you can use
 i2c_new_device() on an adapter that has been added with
 i2c_add_adapter(). However, this requires that you have a reference to
 that i2c_adapter, which is usually not the case with system-wide I2C
 buses.

But it is the case here, because the i2c driver knows about the device 
tree, and thus can pass the device tree node and the adapter struct to 
the enumeration function.

The driver should still do i2c_add_numbered_adapter() when using the 
non-OF platform device binding, in which case it gets the bus number 
from the platform data.

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Matt Sealey
Jean Delvare wrote:
 On Mon, 05 Nov 2007 21:52:06 +, Matt Sealey wrote:
 Well, all i2c devices have a chip id you can probe for (...)
 
 This statement is completely incorrect. I2C devices do NOT have
 standard ID registers. Some devices have proprietary ID registers, some
 don't, it's really up to the manfacturer.

All I2C slave devices have to have a 7- or 10-bit address to identify them
by. They *may* not report what they ARE, but this is 9 times out of
10 a hardware design decision of soldering the chip to a board and
the address is then coded into device trees or hardcoded into drivers.

Whoever designed the board and has the datasheets knows the address
they're supposed to be at, and the device can accept this.

You simply cannot entertain an i2c bus with anonymous and unnumbered
devices, every one has to have an address it responds to, however
it is defined, or it just does not work.

WRT cell-index this is an index of the bus on the chip (not the logical
i2c bus but the physical difference between two i2c controllers) and
then any i2c devices which need to be communicated with would be
child nodes, their reg property reflecting their slave address, is
that not correct?

-- 
Matt Sealey [EMAIL PROTECTED]
Genesi, Manager, Developer Relations
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] using mii-bitbang on different processor ports - update the booting-without-of.txt-file

2007-11-06 Thread Scott Wood
On Tue, Nov 06, 2007 at 09:51:57AM +0100, Sergej Stepanov wrote:
 The patch updates the booting-without-of.txt-file.
 There is a description for the case
 if mdio data and clock pins are on different processor ports.
 It is a extending for e-mail [PATCH v3] using mii-bitbang on different 
 processor ports.
 
 Signed-off-by: Sergej Stepanov [EMAIL PROTECTED]
 --
 
 diff --git a/Documentation/powerpc/booting-without-of.txt 
 b/Documentation/powerpc/booting-without-of.txt
 index a96e853..497d8d8 100644
 --- a/Documentation/powerpc/booting-without-of.txt
 +++ b/Documentation/powerpc/booting-without-of.txt
 @@ -1956,6 +1956,12 @@ platforms are moved over to use the 
 flattened-device-tree model.
   fsl,mdc-pin = 13;
   };
  
 +   The reg-property may have also depending on board design
 +   the following form:
 + reg = 10d40 14 10d60 14;
 +   In that case the pin for mdio data controlling is on the port C,
 +   and the pin for mdio clock controlling is on the port D.

It'd be better to explicitly say that the first resource is mdio, and the
second resource is mdc, rather than require the reader to know/look up which
corresponds to 10d40 and which to 10d60.

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Grant Likely
On 11/6/07, Grant Likely [EMAIL PROTECTED] wrote:
 On 11/6/07, Jean Delvare [EMAIL PROTECTED] wrote:
  Hi Scott,
 
  On Tue, 06 Nov 2007 11:36:23 -0600, Scott Wood wrote:
   Jean Delvare wrote:
We might as well just use i2c_new_device() instead of messing around
with bus numbers.  Note that this is technically no longer platform
code, so it's harder to justify claiming the static numberspace.
I was allowing control of the bus number with cell-index and
i2c_add_numbered_adapter().
Should I get rid of this and switch to i2c_add_adapter()?
Yes.
   
No! If you don't call i2c_add_numbered_adapter() then new-style i2c
clients will never work on your i2c adapter.
  
   I thought that was what i2c_new_device() was for?
 
  Sorry, I've not been completely clear. Yes, you can use
  i2c_new_device() on an adapter that has been added with
  i2c_add_adapter(). However, this requires that you have a reference to
  that i2c_adapter, which is usually not the case with system-wide I2C
  buses. Embedded platforms would rather use i2c_add_numbered_adapter(),
  give a list of chips to i2c_register_board_info() and let i2c-core
  instantiate them. i2c_new_device was primarily meant for multimedia
  adapters.

 *Some* embedded platforms would rather use i2c_add_numbered_adapter().  :-)

 On powerpc, and other platforms which have a device tree, we don't

Specifically; an OF style device tree.  :-)

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Jon Smirl
Second pass at extending i2c core to accept strings of aliases for the
module. This version eliminate the need for separate name and type
fields when selecting a driver. PowerPC has to have a mapping from
device tree names to the i2c drivers, it makes sense to keep this
mapping inside the i2c driver.

Extend i2c-core to support lists of device tree compatible names when
matching drivers

From: Jon Smirl [EMAIL PROTECTED]


---

 drivers/i2c/busses/i2c-mpc.c |   37 +++--
 drivers/i2c/i2c-core.c   |   35 ++-
 drivers/rtc/rtc-pcf8563.c|1 +
 drivers/rtc/rtc-rs5c372.c|3 ++-
 include/linux/i2c.h  |   13 +
 5 files changed, 37 insertions(+), 52 deletions(-)


diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 4ddebe4..30420ad 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -312,34 +312,6 @@ static struct i2c_adapter mpc_ops = {
.retries = 1
 };

-struct i2c_driver_device {
-   char*of_device;
-   char*i2c_driver;
-   char*i2c_type;
-};
-
-static struct i2c_driver_device i2c_devices[] = {
-   {ricoh,rs5c372a, rtc-rs5c372, rs5c372a,},
-   {ricoh,rs5c372b, rtc-rs5c372, rs5c372b,},
-   {ricoh,rv5c386,  rtc-rs5c372, rv5c386,},
-   {ricoh,rv5c387a, rtc-rs5c372, rv5c387a,},
-   {epson,pcf8564, rtc-pcf8563, pcf8564,},
-};
-
-static int of_find_i2c_driver(struct device_node *node, struct
i2c_board_info *info)
-{
-   int i;
-
-   for (i = 0; i  ARRAY_SIZE(i2c_devices); i++) {
-   if (!of_device_is_compatible(node, i2c_devices[i].of_device))
-   continue;
-   strncpy(info-driver_name, i2c_devices[i].i2c_driver, 
KOBJ_NAME_LEN);
-   strncpy(info-type, i2c_devices[i].i2c_type, I2C_NAME_SIZE);
-   return 0;
-   }
-   return -ENODEV;
-}
-
 static void of_register_i2c_devices(struct i2c_adapter *adap, struct
device_node *adap_node)
 {
struct device_node *node = NULL;
@@ -347,11 +319,12 @@ static void of_register_i2c_devices(struct
i2c_adapter *adap, struct device_node
while ((node = of_get_next_child(adap_node, node))) {
struct i2c_board_info info;
const u32 *addr;
+   const char *compatible;
int len;

addr = of_get_property(node, reg, len);
if (!addr || len  sizeof(int) || *addr  (1  10) - 1) {
-   printk(KERN_WARNING i2c-mpc.c: invalid i2c device 
entry\n);
+   printk(KERN_WARNING i2c-mpc.c: invalid entry, missing 
reg attribute\n);
continue;
}

@@ -359,8 +332,12 @@ static void of_register_i2c_devices(struct
i2c_adapter *adap, struct device_node
if (info.irq == NO_IRQ)
info.irq = -1;

-   if (of_find_i2c_driver(node, info)  0)
+   compatible = of_get_property(node, compatible, len);
+   if (!compatible) {
+   printk(KERN_WARNING i2c-mpc.c: invalid entry, missing 
compatible
attribute\n);
continue;
+   }
+   strncpy(info.name, compatible, sizeof(info.name));

info.platform_data = NULL;
info.addr = *addr;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d663e69..d9a70c2 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -17,7 +17,7 @@
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   */
 /* - */

-/* With some changes from Kyösti Mälkki [EMAIL PROTECTED].
+/* With some changes from Kyösti MÀlkki [EMAIL PROTECTED].
All SMBus-related things are written by Frodo Looijaard [EMAIL PROTECTED]
SMBus 2.0 support by Mark Studebaker [EMAIL PROTECTED] and
Jean Delvare [EMAIL PROTECTED] */
@@ -51,6 +51,7 @@ static int i2c_device_match(struct device *dev,
struct device_driver *drv)
 {
struct i2c_client   *client = to_i2c_client(dev);
struct i2c_driver   *driver = to_i2c_driver(drv);
+   char const **alias;

/* make legacy i2c drivers bypass driver model probing entirely;
 * such drivers scan each i2c adapter/bus themselves.
@@ -60,8 +61,18 @@ static int i2c_device_match(struct device *dev,
struct device_driver *drv)

/* new style drivers use the same kind of driver matching policy
 * as platform devices or SPI:  compare device and driver IDs.
+* Match against arrary of alias device tree names. When a match
+* is found change the reference to point at the copy inside the
+* chip driver allowing the caller's string to be freed.
 */
-   return strcmp(client-driver_name, drv-name) == 0;
+   alias = driver-aliases;
+   while (*alias) {
+   

Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Jon Smirl
Second pass on rework of mpc-i2c.c. This doesn't include code for
supporting both old and new style chip drivers. I'm still not a fan of
cluttering up mpc-i2c.c to support old style drivers since it so easy
to convert them to the new style. I'd rather just fix up the i2c
drivers used by chips on the PowerPC platform.

Convert i2c to of_platform_driver from platform_driver

From: Jon Smirl [EMAIL PROTECTED]

Improve error returns
---

 arch/powerpc/sysdev/fsl_soc.c |  116 ---
 drivers/i2c/busses/i2c-mpc.c  |  178 +
 2 files changed, 126 insertions(+), 168 deletions(-)


diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 1cf29c9..6f80216 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -306,122 +306,6 @@ err:

 arch_initcall(gfar_of_init);

-#ifdef CONFIG_I2C_BOARDINFO
-#include linux/i2c.h
-struct i2c_driver_device {
-   char*of_device;
-   char*i2c_driver;
-   char*i2c_type;
-};
-
-static struct i2c_driver_device i2c_devices[] __initdata = {
-   {ricoh,rs5c372a, rtc-rs5c372, rs5c372a,},
-   {ricoh,rs5c372b, rtc-rs5c372, rs5c372b,},
-   {ricoh,rv5c386,  rtc-rs5c372, rv5c386,},
-   {ricoh,rv5c387a, rtc-rs5c372, rv5c387a,},
-};
-
-static int __init of_find_i2c_driver(struct device_node *node, struct
i2c_board_info *info)
-{
-   int i;
-
-   for (i = 0; i  ARRAY_SIZE(i2c_devices); i++) {
-   if (!of_device_is_compatible(node, i2c_devices[i].of_device))
-   continue;
-   strncpy(info-driver_name, i2c_devices[i].i2c_driver, 
KOBJ_NAME_LEN);
-   strncpy(info-type, i2c_devices[i].i2c_type, I2C_NAME_SIZE);
-   return 0;
-   }
-   return -ENODEV;
-}
-
-static void __init of_register_i2c_devices(struct device_node
*adap_node, int bus_num)
-{
-   struct device_node *node = NULL;
-
-   while ((node = of_get_next_child(adap_node, node))) {
-   struct i2c_board_info info;
-   const u32 *addr;
-   int len;
-
-   addr = of_get_property(node, reg, len);
-   if (!addr || len  sizeof(int) || *addr  (1  10) - 1) {
-   printk(KERN_WARNING fsl_ioc.c: invalid i2c device 
entry\n);
-   continue;
-   }
-
-   info.irq = irq_of_parse_and_map(node, 0);
-   if (info.irq == NO_IRQ)
-   info.irq = -1;
-
-   if (of_find_i2c_driver(node, info)  0)
-   continue;
-
-   info.platform_data = NULL;
-   info.addr = *addr;
-
-   i2c_register_board_info(bus_num, info, 1);
-   }
-}
-
-static int __init fsl_i2c_of_init(void)
-{
-   struct device_node *np;
-   unsigned int i;
-   struct platform_device *i2c_dev;
-   int ret;
-
-   for (np = NULL, i = 0;
-(np = of_find_compatible_node(np, i2c, fsl-i2c)) != NULL;
-i++) {
-   struct resource r[2];
-   struct fsl_i2c_platform_data i2c_data;
-   const unsigned char *flags = NULL;
-
-   memset(r, 0, sizeof(r));
-   memset(i2c_data, 0, sizeof(i2c_data));
-
-   ret = of_address_to_resource(np, 0, r[0]);
-   if (ret)
-   goto err;
-
-   of_irq_to_resource(np, 0, r[1]);
-
-   i2c_dev = platform_device_register_simple(fsl-i2c, i, r, 2);
-   if (IS_ERR(i2c_dev)) {
-   ret = PTR_ERR(i2c_dev);
-   goto err;
-   }
-
-   i2c_data.device_flags = 0;
-   flags = of_get_property(np, dfsrr, NULL);
-   if (flags)
-   i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
-
-   flags = of_get_property(np, fsl5200-clocking, NULL);
-   if (flags)
-   i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
-
-   ret =
-   platform_device_add_data(i2c_dev, i2c_data,
-sizeof(struct
-   fsl_i2c_platform_data));
-   if (ret)
-   goto unreg;
-
-   of_register_i2c_devices(np, i);
-   }
-
-   return 0;
-
-unreg:
-   platform_device_unregister(i2c_dev);
-err:
-   return ret;
-}
-
-arch_initcall(fsl_i2c_of_init);
-#endif

 #ifdef CONFIG_PPC_83xx
 static int __init mpc83xx_wdt_init(void)
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index d8de4ac..4ddebe4 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -17,7 +17,7 @@
 #include linux/module.h
 #include linux/sched.h
 #include linux/init.h
-#include linux/platform_device.h
+#include linux/of_platform.h

 #include asm/io.h
 #include linux/fsl_devices.h
@@ 

Re: [PATCH v2 08/12] [POWERPC] CM5200 DTS

2007-11-06 Thread Marian Balakowicz
David Gibson wrote:
 On Sun, Nov 04, 2007 at 12:52:59AM +0100, Marian Balakowicz wrote:
 Add device tree source file for CM5200 board.
 [snip]
 +[EMAIL PROTECTED] { // Real time clock
 +compatible = mpc5200b-rtc,mpc5200-rtc;
 +device_type = rtc;
 
 No device_type here.
 
 [snip]
 +[EMAIL PROTECTED] {
 +device_type = spi;
 
 Definitely no device_type here.
 
 +compatible = mpc5200b-spi,mpc5200-spi;
 +reg = f00 20;
 +interrupts = 2 d 0 2 e 0;
 +interrupt-parent = mpc5200_pic;
 +};
 
 [snip]
 +[EMAIL PROTECTED] {
 +device_type = i2c;
 
 No device_type here.

OK, device_type removed for the above devices.

Thanks
m.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Jean Delvare
On Tue, 6 Nov 2007 11:26:14 -0700, Grant Likely wrote:
 On 11/6/07, Jean Delvare [EMAIL PROTECTED] wrote:
  Sorry, I've not been completely clear. Yes, you can use
  i2c_new_device() on an adapter that has been added with
  i2c_add_adapter(). However, this requires that you have a reference to
  that i2c_adapter, which is usually not the case with system-wide I2C
  buses. Embedded platforms would rather use i2c_add_numbered_adapter(),
  give a list of chips to i2c_register_board_info() and let i2c-core
  instantiate them. i2c_new_device was primarily meant for multimedia
  adapters.
 
 *Some* embedded platforms would rather use i2c_add_numbered_adapter().  :-)
 
 On powerpc, and other platforms which have a device tree, we don't
 need to define a table of devices in the platform code because we've
 already got a rich structure for describing such things.  The i2c
 busses and i2c devices are grouped together in the device tree, so
 when the i2c bus is probed, it should call out to common i2c device
 tree parsing code to instantiate all the devices described in the
 tree.
 
 It would be awkward to describe the i2c bus in the device tree but
 still have to use a static structure to describe the devices on that
 bus.

Ah, OK, thanks for the clarification. Then indeed using
i2c_add_adapter() will work fine, agreed.

-- 
Jean Delvare
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC/PATCH 0/2] powerpc: 64 bits irqtrace / lockdep support

2007-11-06 Thread Tim Pepper
On 10/14/07, Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:
 This is 2 patches, one from Christoph Hellwig that adds the backtrace support,
 and one from Johannes Berg modified by me that adds the irq tracing support.

 This successfully boots a POWER5 pSeries machine. I'm going to run some more
 tests in the upcoming few days, so this is not an official submission (and 
 it's
 too late for .24 merge window anyway) but it's looking good so far.

FYI: Boots and survives watching /proc/lock_stat during a kernel build
for me (on a 970 based blade).


Tim
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2 06/12] [POWERPC] TQM5200 DTS

2007-11-06 Thread Marian Balakowicz
David Gibson wrote:
 On Sun, Nov 04, 2007 at 12:52:47AM +0100, Marian Balakowicz wrote:
 Add device tree source file for TQM5200 board.
 [snip]
 +[EMAIL PROTECTED] {
 
 [EMAIL PROTECTED] is the new convention, I believe, but I guess you need
 compatibility with older bootstraps.

Correct, we stick with 'soc5200' due to hardcoded paths in U-boot.

 
 +model = fsl,mpc5200;
 +compatible = mpc5200;
 
 This compatible looks bogus; it should have the fsl, at least.

Added 'fsl,'.

 [snip]
 +mpc5200_pic: [EMAIL PROTECTED] {
 +// 5200 interrupts are encoded into two levels;
 +interrupt-controller;
 +#interrupt-cells = 3;
 +device_type = interrupt-controller;
 
 No device_type here.

Removed it.

 
 +compatible = mpc5200-pic;
 +reg = 500 80;
 +};
 +
 +[EMAIL PROTECTED] { // General Purpose Timer
 +compatible = fsl,mpc5200-gpt;
 +cell-index = 0;
 
 Ok, is this actually a suitable usage for cell-index?  It should only
 be used when the cell-index number is used to program some soc-global
 register.  It should not be used just for ordering or logical-indexing
 purposes.

Rechecked that and it's not being used anywhere. Removed.

 [snip]
 +[EMAIL PROTECTED] { // PSC1
 +device_type = serial;
 +compatible = mpc5200-psc-uart;
 +port-number = 0;  // Logical port assignment
 +cell-index = 0;
 
 Ditto w.r.t. cell-index.

Not used, removed.

 port-number also looks bogus - the device tree should not generally
 contain logical numbering information in this manner.  How and what
 uses the port-number property?

'port-number' is used by serial driver (mpc52xx_uart.c), if present it
 assigns a device number (/dev/PSCport-number) for given serial port.
That allows to override default auto-numbering.

 +[EMAIL PROTECTED] {
 +compatible = mpc5200-sram,sram;
 
 Uh.. is there an sram binding?  sram doesn't look specific enough
 for a compatible property.

Right, removed sram.

Thanks,
m.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2 11/12] [POWERPC] Promess Motion-PRO DTS

2007-11-06 Thread Marian Balakowicz
David Gibson wrote:
 On Sun, Nov 04, 2007 at 12:53:17AM +0100, Marian Balakowicz wrote:
 Add device tree source file for Motion-PRO board.
 [snip]
 +[EMAIL PROTECTED] { // Motion-PRO status LED
 +compatible = promess,motionpro-statusled;
 +cell-index = 6;
 +reg = 660 10;
 +interrupts = 1 f 0;
 +interrupt-parent = mpc5200_pic;
 +blink-delay = 64; // 100 msec
 +};
 +
 +[EMAIL PROTECTED] { // Motion-PRO ready LED
 +compatible = promess,motionpro-readyled;
 +cell-index = 7;
 
 These cell-index values for the LEDs look very strange.  How are they
 used?
[snip]
 +
 +[EMAIL PROTECTED] {
 +compatible = mpc5200b-mscan,mpc5200-mscan;
 +cell-index = 1;
 
 As for serial and gpt, is cell-index really suitable here?

Ok, removed those unused cell-index properties.

 [snip]
 +[EMAIL PROTECTED] {
 +device_type = spi;
 +compatible = mpc5200b-spi,mpc5200-spi;
 +reg = f00 20;
 +interrupts = 2 d 0 2 e 0;
 +interrupt-parent = mpc5200_pic;
 +};
 [snip]
 +// PSC2 in spi master mode 
 +[EMAIL PROTECTED] { // PSC2
 +device_type = spi;
 +compatible = mpc5200b-psc-spi,mpc5200-psc-spi;
 +cell-index = 1;
 
 cell-index present for one spi, but not the other makes be even more
 suspicious about it's applicability here...

These are two different SPIs, both are part of the SoC but first one
is dedicated SPI interface while the second one is PSC port in a SPI
mode. Driver for the second one (mpc52xx_psc_spi.c) is actually using
cell-index to get the PSC port number it's controlling.

 [snip]
 +lpb {
 +model = fsl,lpb;
 +compatible = fsl,lpb;
 
 Is lpb another one of these chipselect/offset configurable bus bridge
 things?  If so, you should use a 2-cell addressing convention for the
 subnodes like fsl localbus and 4xx EBC.

Yes, it is, so I have switched to 2-cell addressing. Please see the v3
respin of the patches.


 +// 8-bit custom Anybus Module on LocalPlus Bus CS3
 +anybus5002 {
 
 Missing '@'.

Fixed.

Thanks,
m.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3 00/13] [POWERPC] Add TQM5200/CM5200/Motion-PRO board support

2007-11-06 Thread Marian Balakowicz
This is a third version of the patches that add arch/powerpc support for
three MPC5200 based boards: TQ-Components TQM5200, Schindler CM5200
and Promess Motion-PRO.

[POWERPC] Promess Motion-PRO defconfig
[POWERPC] Promess Motion-PRO DTS
[POWERPC] Motion-PRO: Add LED support.
[POWERPC] CM5200 defconfig
[POWERPC] CM5200 DTS
[POWERPC] TQM5200 defconfig
[POWERPC] TQM5200 DTS
[POWERPC] Use EXPORT_SYMBOL_GPL for 52xx common routines symbol export
[POWERPC] Export mpc52xx_map_node() routine symbol
[POWERPC] Add generic support for simple MPC5200 based boards
[POWERPC] Add common mpc52xx_setup_pci() routine
[POWERPC] Add 'fsl,lpb' bus type for MPC5200 LocalPlus Bus
[POWERPC] Add 'model: ...' line to common show_cpuinfo()

Please review them and schedule for 2.6.24-rc2 if you are ok with them.

Cheers,
m.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3 01/13] [POWERPC] Add 'model: ...' line to common show_cpuinfo()

2007-11-06 Thread Marian Balakowicz
Print out 'model' property of '/' node as a machine name
in generic show_cpuinfo() routine.

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
Acked-by: David Gibson [EMAIL PROTECTED]
Acked-by: Olof Johansson [EMAIL PROTECTED]
---

 arch/powerpc/kernel/setup-common.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)


diff --git a/arch/powerpc/kernel/setup-common.c 
b/arch/powerpc/kernel/setup-common.c
index 2de00f8..cb291f1 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -165,6 +165,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
unsigned short min;
 
if (cpu_id == NR_CPUS) {
+   struct device_node *root;
+   const char *model = NULL;
 #if defined(CONFIG_SMP)  defined(CONFIG_PPC32)
unsigned long bogosum = 0;
int i;
@@ -176,6 +178,13 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, timebase\t: %lu\n, ppc_tb_freq);
if (ppc_md.name)
seq_printf(m, platform\t: %s\n, ppc_md.name);
+   root = of_find_node_by_path(/);
+   if (root)
+   model = of_get_property(root, model, NULL);
+   of_node_put(root);
+   if (model)
+   seq_printf(m, model\t\t: %s\n, model);
+
if (ppc_md.show_cpuinfo != NULL)
ppc_md.show_cpuinfo(m);
 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3 02/13] [POWERPC] Add 'fsl, lpb' bus type for MPC5200 LocalPlus Bus

2007-11-06 Thread Marian Balakowicz
Define MPC52xx specific device id list, add new
'fsl,lpb' compatible id for LocalPlus Bus.

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
Acked-by: David Gibson [EMAIL PROTECTED]
---

 arch/powerpc/platforms/52xx/mpc52xx_common.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)


diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 9850685..2df97c5 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -124,11 +124,18 @@ mpc5200_setup_xlb_arbiter(void)
iounmap(xlb);
 }
 
+static struct of_device_id mpc52xx_ids[] = {
+   { .type = soc, },
+   { .compatible = soc, },
+   { .compatible = fsl,lpb, },
+   {},
+};
+
 void __init
 mpc52xx_declare_of_platform_devices(void)
 {
/* Find every child of the SOC node and add it to of_platform */
-   if (of_platform_bus_probe(NULL, NULL, NULL))
+   if (of_platform_bus_probe(NULL, mpc52xx_ids, NULL))
printk(KERN_ERR __FILE__ : 
Error while probing of_platform bus\n);
 }

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3 03/13] [POWERPC] Add common mpc52xx_setup_pci() routine

2007-11-06 Thread Marian Balakowicz
This patch moves a generic pci init code from lite5200
platform file to a common mpc52xx_setup_pci() routine
and adds additional compatibility property verification.

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 arch/powerpc/platforms/52xx/lite5200.c|   12 +---
 arch/powerpc/platforms/52xx/mpc52xx_pci.c |   15 +++
 include/asm-powerpc/mpc52xx.h |5 +
 3 files changed, 21 insertions(+), 11 deletions(-)


diff --git a/arch/powerpc/platforms/52xx/lite5200.c 
b/arch/powerpc/platforms/52xx/lite5200.c
index 25d2bfa..ce903be 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -131,10 +131,6 @@ static void lite5200_resume_finish(void __iomem *mbar)
 
 static void __init lite5200_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-   struct device_node *np;
-#endif
-
if (ppc_md.progress)
ppc_md.progress(lite5200_setup_arch(), 0);
 
@@ -154,13 +150,7 @@ static void __init lite5200_setup_arch(void)
lite5200_pm_init();
 #endif
 
-#ifdef CONFIG_PCI
-   np = of_find_node_by_type(NULL, pci);
-   if (np) {
-   mpc52xx_add_bridge(np);
-   of_node_put(np);
-   }
-#endif
+   mpc52xx_setup_pci();
 }
 
 /*
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c 
b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
index 4c6c82a..89304f2 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
@@ -406,3 +406,18 @@ mpc52xx_add_bridge(struct device_node *node)
 
return 0;
 }
+
+void __init mpc52xx_setup_pci(void)
+{
+   struct device_node *pci;
+
+   pci = of_find_node_by_type(NULL, pci);
+   if (!pci)
+   return;
+
+   if (of_device_is_compatible(pci, fsl,mpc5200-pci) ||
+   of_device_is_compatible(pci, mpc5200-pci))
+   mpc52xx_add_bridge(pci);
+
+   of_node_put(pci);
+}
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index fcb2ebb..d7efbe0 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -257,7 +257,12 @@ extern void mpc52xx_declare_of_platform_devices(void);
 extern void mpc52xx_init_irq(void);
 extern unsigned int mpc52xx_get_irq(void);
 
+#ifdef CONFIG_PCI
 extern int __init mpc52xx_add_bridge(struct device_node *node);
+extern void __init mpc52xx_setup_pci(void);
+#else
+static inline void mpc52xx_setup_pci(void) { }
+#endif
 
 extern void __init mpc52xx_map_wdt(void);
 extern void mpc52xx_restart(char *cmd);

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3 04/13] [POWERPC] Add generic support for simple MPC5200 based boards

2007-11-06 Thread Marian Balakowicz
This patch adds support for 'mpc5200-simple-platform' compatible
boards which do not need a platform specific setup. Such boards
are supported assuming the following:

- GPIO pins are configured by the firmware,
- CDM configuration (clocking) is setup correctly by firmware,
- if the 'fsl,has-wdt' property is present in one of the
  gpt nodes, then it is safe to use such gpt to reset the board,
- PCI is supported if enabled in the kernel configuration

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 arch/powerpc/boot/dts/lite5200.dts   |2 -
 arch/powerpc/boot/dts/lite5200b.dts  |2 -
 arch/powerpc/platforms/52xx/Kconfig  |   18 ++-
 arch/powerpc/platforms/52xx/Makefile |1 
 arch/powerpc/platforms/52xx/mpc5200_simple.c |   72 ++
 5 files changed, 91 insertions(+), 4 deletions(-)
 create mode 100644 arch/powerpc/platforms/52xx/mpc5200_simple.c


diff --git a/arch/powerpc/boot/dts/lite5200.dts 
b/arch/powerpc/boot/dts/lite5200.dts
index 6731763..5902362 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -19,7 +19,7 @@
 / {
model = fsl,lite5200;
// revision = 1.0;
-   compatible = fsl,lite5200,generic-mpc5200;
+   compatible = fsl,lite5200;
#address-cells = 1;
#size-cells = 1;
 
diff --git a/arch/powerpc/boot/dts/lite5200b.dts 
b/arch/powerpc/boot/dts/lite5200b.dts
index b540388..b509129 100644
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ b/arch/powerpc/boot/dts/lite5200b.dts
@@ -19,7 +19,7 @@
 / {
model = fsl,lite5200b;
// revision = 1.0;
-   compatible = fsl,lite5200b,generic-mpc5200;
+   compatible = fsl,lite5200b;
#address-cells = 1;
#size-cells = 1;
 
diff --git a/arch/powerpc/platforms/52xx/Kconfig 
b/arch/powerpc/platforms/52xx/Kconfig
index 2938d49..b8a6ebc 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -19,6 +19,22 @@ config PPC_MPC5200_BUGFIX
 
  It is safe to say 'Y' here
 
+config PPC_MPC5200_SIMPLE
+   bool Generic support for simple MPC5200 based boards
+   depends on PPC_MULTIPLATFORM  PPC32
+   select PPC_MPC5200
+   default n
+   help
+ This option enables support for a simple MPC52xx based boards which
+ do not need a custom platform specific setup. Such boards are
+ supported assuming the following:
+
+ - GPIO pins are configured by the firmware,
+ - CDM configuration (clocking) is setup correctly by firmware,
+ - if the 'fsl,has-wdt' property is present in one of the
+   gpt nodes, then it is safe to use such gpt to reset the board,
+ - PCI is supported if enabled in the kernel configuration
+
 config PPC_EFIKA
bool bPlan Efika 5k2. MPC5200B based computer
depends on PPC_MULTIPLATFORM  PPC32
@@ -34,5 +50,3 @@ config PPC_LITE5200
select WANT_DEVICE_TREE
select PPC_MPC5200
default n
-
-
diff --git a/arch/powerpc/platforms/52xx/Makefile 
b/arch/powerpc/platforms/52xx/Makefile
index 307dbc1..fe1b81b 100644
--- a/arch/powerpc/platforms/52xx/Makefile
+++ b/arch/powerpc/platforms/52xx/Makefile
@@ -6,6 +6,7 @@ obj-y   += mpc52xx_pic.o 
mpc52xx_common.o
 obj-$(CONFIG_PCI)  += mpc52xx_pci.o
 endif
 
+obj-$(CONFIG_PPC_MPC5200_SIMPLE) += mpc5200_simple.o
 obj-$(CONFIG_PPC_EFIKA)+= efika.o
 obj-$(CONFIG_PPC_LITE5200) += lite5200.o
 
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c 
b/arch/powerpc/platforms/52xx/mpc5200_simple.c
new file mode 100644
index 000..618cf24
--- /dev/null
+++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
@@ -0,0 +1,72 @@
+/*
+ * Support for 'mpc5200-simple-platform' compatible boards.
+ *
+ * Written by Marian Balakowicz [EMAIL PROTECTED]
+ * Copyright (C) 2007 Semihalf
+ *
+ * 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.
+ *
+ * Description:
+ * This code implements support for a simple MPC52xx based boards which
+ * do not need a custom platform specific setup. Such boards are
+ * supported assuming the following:
+ *
+ * - GPIO pins are configured by the firmware,
+ * - CDM configuration (clocking) is setup correctly by firmware,
+ * - if the 'fsl,has-wdt' property is present in one of the
+ *   gpt nodes, then it is safe to use such gpt to reset the board,
+ * - PCI is supported if enabled in the kernel configuration
+ */
+
+#undef DEBUG
+#include linux/init.h
+#include linux/pci.h
+#include linux/of.h
+#include asm/time.h
+#include asm/io.h
+#include asm/machdep.h
+#include asm/prom.h
+#include asm/mpc52xx.h
+
+/*
+ * Setup the architecture
+ */
+static void __init mpc5200_simple_setup_arch(void)
+{
+   if 

[PATCH v3 05/13] [POWERPC] Export mpc52xx_map_node() routine symbol

2007-11-06 Thread Marian Balakowicz
Make, so far static, mpc52xx_map_node() routine
symbol available for general use.

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 arch/powerpc/platforms/52xx/mpc52xx_common.c |3 ++-
 include/asm-powerpc/mpc52xx.h|1 +
 2 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 2df97c5..7224bfe 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -26,7 +26,7 @@
  */
 static volatile struct mpc52xx_gpt *mpc52xx_wdt = NULL;
 
-static void __iomem *
+void __iomem *
 mpc52xx_map_node(struct device_node *ofn)
 {
const u32 *regaddr_p;
@@ -47,6 +47,7 @@ mpc52xx_map_node(struct device_node *ofn)
 
return ioremap((u32)regaddr64, (u32)size64);
 }
+EXPORT_SYMBOL_GPL(mpc52xx_map_node);
 
 void __iomem *
 mpc52xx_find_and_map(const char *compatible)
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index d7efbe0..1887b13 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -248,6 +248,7 @@ struct mpc52xx_cdm {
 
 #ifndef __ASSEMBLY__
 
+extern void __iomem * mpc52xx_map_node(struct device_node *);
 extern void __iomem * mpc52xx_find_and_map(const char *);
 extern void __iomem * mpc52xx_find_and_map_path(const char *path);
 extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3 06/13] [POWERPC] Use EXPORT_SYMBOL_GPL for 52xx common routines symbol export

2007-11-06 Thread Marian Balakowicz
Replace EXPORT_SYMBOL with EXPORT_SYMBOL_GPL in mpc52xx_common.c

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 arch/powerpc/platforms/52xx/mpc52xx_common.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)


diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 7224bfe..c9e1ab9 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -55,16 +55,14 @@ mpc52xx_find_and_map(const char *compatible)
return mpc52xx_map_node(
of_find_compatible_node(NULL, NULL, compatible));
 }
-
-EXPORT_SYMBOL(mpc52xx_find_and_map);
+EXPORT_SYMBOL_GPL(mpc52xx_find_and_map);
 
 void __iomem *
 mpc52xx_find_and_map_path(const char *path)
 {
return mpc52xx_map_node(of_find_node_by_path(path));
 }
-
-EXPORT_SYMBOL(mpc52xx_find_and_map_path);
+EXPORT_SYMBOL_GPL(mpc52xx_find_and_map_path);
 
 /**
  * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device
@@ -93,7 +91,7 @@ mpc52xx_find_ipb_freq(struct device_node *node)
 
return p_ipb_freq ? *p_ipb_freq : 0;
 }
-EXPORT_SYMBOL(mpc52xx_find_ipb_freq);
+EXPORT_SYMBOL_GPL(mpc52xx_find_ipb_freq);
 
 
 /*

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3 07/13] [POWERPC] TQM5200 DTS

2007-11-06 Thread Marian Balakowicz
Add device tree source file for TQM5200 board.

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 arch/powerpc/boot/dts/tqm5200.dts |  185 +
 1 files changed, 185 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/tqm5200.dts


diff --git a/arch/powerpc/boot/dts/tqm5200.dts 
b/arch/powerpc/boot/dts/tqm5200.dts
new file mode 100644
index 000..24d5369
--- /dev/null
+++ b/arch/powerpc/boot/dts/tqm5200.dts
@@ -0,0 +1,185 @@
+/*
+ * TQM5200 board Device Tree Source
+ *
+ * Copyright (C) 2007 Semihalf
+ * Marian Balakowicz [EMAIL PROTECTED]
+ *
+ * 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.
+ */
+
+/*
+ * WARNING: Do not depend on this tree layout remaining static just yet.
+ * The MPC5200 device tree conventions are still in flux
+ * Keep an eye on the linuxppc-dev mailing list for more details
+ */
+
+/ {
+   model = tqc,tqm5200;
+   compatible = tqc,tqm5200,mpc5200-simple-platform;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = cpu;
+   reg = 0;
+   d-cache-line-size = 20;
+   i-cache-line-size = 20;
+   d-cache-size = 4000;  // L1, 16K
+   i-cache-size = 4000;  // L1, 16K
+   timebase-frequency = 0;   // from bootloader
+   bus-frequency = 0;// from bootloader
+   clock-frequency = 0;  // from bootloader
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg =  0400;  // 64MB
+   };
+
+   [EMAIL PROTECTED] {
+   model = fsl,mpc5200;
+   compatible = fsl,mpc5200;
+   revision = ;  // from bootloader
+   device_type = soc;
+   ranges = 0 f000 c000;
+   reg = f000 0100;
+   bus-frequency = 0;// from bootloader
+   system-frequency = 0; // from bootloader
+
+   [EMAIL PROTECTED] {
+   compatible = mpc5200-cdm;
+   reg = 200 38;
+   };
+
+   mpc5200_pic: [EMAIL PROTECTED] {
+   // 5200 interrupts are encoded into two levels;
+   interrupt-controller;
+   #interrupt-cells = 3;
+   compatible = mpc5200-pic;
+   reg = 500 80;
+   };
+
+   [EMAIL PROTECTED] { // General Purpose Timer
+   compatible = fsl,mpc5200-gpt;
+   reg = 600 10;
+   interrupts = 1 9 0;
+   interrupt-parent = mpc5200_pic;
+   fsl,has-wdt;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = mpc5200-gpio;
+   reg = b00 40;
+   interrupts = 1 7 0;
+   interrupt-parent = mpc5200_pic;
+   };
+
+   [EMAIL PROTECTED] {
+   device_type = usb-ohci-be;
+   compatible = mpc5200-ohci,ohci-be;
+   reg = 1000 ff;
+   interrupts = 2 6 0;
+   interrupt-parent = mpc5200_pic;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = mpc5200-bestcomm;
+   reg = 1200 80;
+   interrupts = 3 0 0  3 1 0  3 2 0  3 3 0
+ 3 4 0  3 5 0  3 6 0  3 7 0
+ 3 8 0  3 9 0  3 a 0  3 b 0
+ 3 c 0  3 d 0  3 e 0  3 f 0;
+   interrupt-parent = mpc5200_pic;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = mpc5200-xlb;
+   reg = 1f00 100;
+   };
+
+   [EMAIL PROTECTED] { // PSC1
+   device_type = serial;
+   compatible = mpc5200-psc-uart;
+   port-number = 0;  // Logical port assignment
+   reg = 2000 100;
+   interrupts = 2 1 0;
+   interrupt-parent = mpc5200_pic;
+   };
+
+   [EMAIL PROTECTED] { // PSC2
+   device_type = serial;
+   compatible = mpc5200-psc-uart;
+   port-number = 

[PATCH v3 08/13] [POWERPC] TQM5200 defconfig

2007-11-06 Thread Marian Balakowicz
Add TQM5200 board defconfig file.

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 arch/powerpc/configs/tqm5200_defconfig | 1306 
 1 files changed, 1306 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/configs/tqm5200_defconfig


diff --git a/arch/powerpc/configs/tqm5200_defconfig 
b/arch/powerpc/configs/tqm5200_defconfig
new file mode 100644
index 000..53fa968
--- /dev/null
+++ b/arch/powerpc/configs/tqm5200_defconfig
@@ -0,0 +1,1306 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.23
+# Mon Oct 29 14:01:58 2007
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+CONFIG_6xx=y
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_PPC_FPU=y
+# CONFIG_ALTIVEC is not set
+CONFIG_PPC_STD_MMU=y
+CONFIG_PPC_STD_MMU_32=y
+# CONFIG_PPC_MM_SLICES is not set
+# CONFIG_SMP is not set
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+CONFIG_PPC_MERGE=y
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_IRQ_PER_CPU=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+# CONFIG_PPC_UDBG_16550 is not set
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+# CONFIG_DEFAULT_UIMAGE is not set
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
+CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+# CONFIG_EPOLL is not set
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_KMOD is not set
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED=anticipatory
+
+#
+# Platform support
+#
+CONFIG_PPC_MULTIPLATFORM=y
+# CONFIG_PPC_82xx is not set
+# CONFIG_PPC_83xx is not set
+# CONFIG_PPC_86xx is not set
+CONFIG_CLASSIC32=y
+# CONFIG_PPC_CHRP is not set
+CONFIG_PPC_MPC52xx=y
+CONFIG_PPC_MPC5200=y
+# CONFIG_PPC_MPC5200_BUGFIX is not set
+CONFIG_PPC_MPC5200_SIMPLE=y
+# CONFIG_PPC_EFIKA is not set
+# CONFIG_PPC_LITE5200 is not set
+# CONFIG_PPC_PMAC is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PQ2ADS is not set
+# CONFIG_EMBEDDED6xx is not set
+# CONFIG_MPIC is not set
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_970_NAP is not set
+# CONFIG_PPC_INDIRECT_IO is not set
+# CONFIG_GENERIC_IOMAP is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_TAU is not set
+# CONFIG_CPM2 is not set
+# CONFIG_FSL_ULI1575 is not set
+# CONFIG_PPC_BESTCOMM is not set
+
+#
+# Kernel options
+#
+# CONFIG_HIGHMEM is not set
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=250
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_MISC is not set

[PATCH v3 10/13] [POWERPC] CM5200 defconfig

2007-11-06 Thread Marian Balakowicz
Add CM5200 board defconfig file.

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 arch/powerpc/configs/cm5200_defconfig | 1031 +
 1 files changed, 1031 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/configs/cm5200_defconfig


diff --git a/arch/powerpc/configs/cm5200_defconfig 
b/arch/powerpc/configs/cm5200_defconfig
new file mode 100644
index 000..a17d966
--- /dev/null
+++ b/arch/powerpc/configs/cm5200_defconfig
@@ -0,0 +1,1031 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.23
+# Mon Oct 29 14:06:34 2007
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+CONFIG_6xx=y
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_PPC_FPU=y
+# CONFIG_ALTIVEC is not set
+CONFIG_PPC_STD_MMU=y
+CONFIG_PPC_STD_MMU_32=y
+# CONFIG_PPC_MM_SLICES is not set
+# CONFIG_SMP is not set
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+CONFIG_PPC_MERGE=y
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_IRQ_PER_CPU=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+# CONFIG_PPC_UDBG_16550 is not set
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+# CONFIG_DEFAULT_UIMAGE is not set
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
+CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+# CONFIG_EPOLL is not set
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_KMOD is not set
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED=anticipatory
+
+#
+# Platform support
+#
+CONFIG_PPC_MULTIPLATFORM=y
+# CONFIG_PPC_82xx is not set
+# CONFIG_PPC_83xx is not set
+# CONFIG_PPC_86xx is not set
+CONFIG_CLASSIC32=y
+# CONFIG_PPC_CHRP is not set
+CONFIG_PPC_MPC52xx=y
+CONFIG_PPC_MPC5200=y
+# CONFIG_PPC_MPC5200_BUGFIX is not set
+CONFIG_PPC_MPC5200_SIMPLE=y
+# CONFIG_PPC_EFIKA is not set
+# CONFIG_PPC_LITE5200 is not set
+# CONFIG_PPC_PMAC is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PQ2ADS is not set
+# CONFIG_EMBEDDED6xx is not set
+# CONFIG_MPIC is not set
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_970_NAP is not set
+# CONFIG_PPC_INDIRECT_IO is not set
+# CONFIG_GENERIC_IOMAP is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_TAU is not set
+# CONFIG_CPM2 is not set
+# CONFIG_FSL_ULI1575 is not set
+# CONFIG_PPC_BESTCOMM is not set
+
+#
+# Kernel options
+#
+# CONFIG_HIGHMEM is not set
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=250
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_MISC is not set

[PATCH v3 12/13] [POWERPC] Promess Motion-PRO DTS

2007-11-06 Thread Marian Balakowicz
Add device tree source file for Motion-PRO board.

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 arch/powerpc/boot/dts/motionpro.dts |  309 +++
 1 files changed, 309 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/motionpro.dts


diff --git a/arch/powerpc/boot/dts/motionpro.dts 
b/arch/powerpc/boot/dts/motionpro.dts
new file mode 100644
index 000..6124dd5
--- /dev/null
+++ b/arch/powerpc/boot/dts/motionpro.dts
@@ -0,0 +1,309 @@
+/*
+ * Motion-PRO board Device Tree Source
+ *
+ * Copyright (C) 2007 Semihalf
+ * Marian Balakowicz [EMAIL PROTECTED]
+ *
+ * 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.
+ */
+
+/*
+ * WARNING: Do not depend on this tree layout remaining static just yet.
+ * The MPC5200 device tree conventions are still in flux
+ * Keep an eye on the linuxppc-dev mailing list for more details
+ */
+
+/ {
+   model = promess,motionpro;
+   compatible = promess,motionpro,mpc5200-simple-platform;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = cpu;
+   reg = 0;
+   d-cache-line-size = 20;
+   i-cache-line-size = 20;
+   d-cache-size = 4000;  // L1, 16K
+   i-cache-size = 4000;  // L1, 16K
+   timebase-frequency = 0;   // from bootloader
+   bus-frequency = 0;// from bootloader
+   clock-frequency = 0;  // from bootloader
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg =  0400;  // 64MB
+   };
+
+   [EMAIL PROTECTED] {
+   model = fsl,mpc5200b;
+   compatible = fsl,mpc5200b;
+   revision = ;  // from bootloader
+   device_type = soc;
+   ranges = 0 f000 c000;
+   reg = f000 0100;
+   bus-frequency = 0;// from bootloader
+   system-frequency = 0; // from bootloader
+
+   [EMAIL PROTECTED] {
+   compatible = mpc5200b-cdm,mpc5200-cdm;
+   reg = 200 38;
+   };
+
+   mpc5200_pic: [EMAIL PROTECTED] {
+   // 5200 interrupts are encoded into two levels;
+   interrupt-controller;
+   #interrupt-cells = 3;
+   compatible = mpc5200b-pic,mpc5200-pic;
+   reg = 500 80;
+   };
+
+   [EMAIL PROTECTED] { // General Purpose Timer
+   compatible = fsl,mpc5200b-gpt,fsl,mpc5200-gpt;
+   reg = 600 10;
+   interrupts = 1 9 0;
+   interrupt-parent = mpc5200_pic;
+   fsl,has-wdt;
+   };
+
+   [EMAIL PROTECTED] { // General Purpose Timer
+   compatible = fsl,mpc5200b-gpt,fsl,mpc5200-gpt;
+   reg = 610 10;
+   interrupts = 1 a 0;
+   interrupt-parent = mpc5200_pic;
+   };
+
+   [EMAIL PROTECTED] { // General Purpose Timer
+   compatible = fsl,mpc5200b-gpt,fsl,mpc5200-gpt;
+   reg = 620 10;
+   interrupts = 1 b 0;
+   interrupt-parent = mpc5200_pic;
+   };
+
+   [EMAIL PROTECTED] { // General Purpose Timer
+   compatible = fsl,mpc5200b-gpt,fsl,mpc5200-gpt;
+   reg = 630 10;
+   interrupts = 1 c 0;
+   interrupt-parent = mpc5200_pic;
+   };
+
+   [EMAIL PROTECTED] { // General Purpose Timer
+   compatible = fsl,mpc5200b-gpt,fsl,mpc5200-gpt;
+   reg = 640 10;
+   interrupts = 1 d 0;
+   interrupt-parent = mpc5200_pic;
+   };
+
+   [EMAIL PROTECTED] { // General Purpose Timer
+   compatible = fsl,mpc5200b-gpt,fsl,mpc5200-gpt;
+   reg = 650 10;
+   interrupts = 1 e 0;
+   interrupt-parent = mpc5200_pic;
+   };
+
+   [EMAIL PROTECTED] { // Motion-PRO status LED
+   compatible = promess,motionpro-statusled;
+   reg = 660 10;
+   

[RFC] Modifying i2c-core to support alias driver names compatible with device trees

2007-11-06 Thread Jon Smirl
It was requested to split this code out into a separate thread

This code modifies the i2c-core to support lists of alias names in the
chip drivers.
For example: .aliases   = (char const
*[]){ricoh,rs5c372a,ricoh,rs5c372b,ricoh,rv5c386,ricoh,rv5c387a,
0},

Support like this is needed to get the table out of the PowerPC code
that is converting from device tree name into Linux kernel versions.

Once you add the concept of aliases you don't need the separate fields
for base driver name and chip specific type. This patch eliminates the
extra field.

Of course these changes to fsl_soc.c are removed in the other patch
that updates i2c-mpc.c.


Extend i2c-core to support lists of device tree compatible names when
matching drivers

From: Jon Smirl [EMAIL PROTECTED]


---

 arch/powerpc/sysdev/fsl_soc.c |   33 +
 drivers/i2c/i2c-core.c|   35 ++-
 drivers/rtc/rtc-pcf8563.c |1 +
 drivers/rtc/rtc-rs5c372.c |3 ++-
 include/linux/i2c.h   |   13 +
 5 files changed, 39 insertions(+), 46 deletions(-)


diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 1cf29c9..e2aafd6 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -314,27 +314,6 @@ struct i2c_driver_device {
char*i2c_type;
 };

-static struct i2c_driver_device i2c_devices[] __initdata = {
-   {ricoh,rs5c372a, rtc-rs5c372, rs5c372a,},
-   {ricoh,rs5c372b, rtc-rs5c372, rs5c372b,},
-   {ricoh,rv5c386,  rtc-rs5c372, rv5c386,},
-   {ricoh,rv5c387a, rtc-rs5c372, rv5c387a,},
-};
-
-static int __init of_find_i2c_driver(struct device_node *node, struct
i2c_board_info *info)
-{
-   int i;
-
-   for (i = 0; i  ARRAY_SIZE(i2c_devices); i++) {
-   if (!of_device_is_compatible(node, i2c_devices[i].of_device))
-   continue;
-   strncpy(info-driver_name, i2c_devices[i].i2c_driver, 
KOBJ_NAME_LEN);
-   strncpy(info-type, i2c_devices[i].i2c_type, I2C_NAME_SIZE);
-   return 0;
-   }
-   return -ENODEV;
-}
-
 static void __init of_register_i2c_devices(struct device_node
*adap_node, int bus_num)
 {
struct device_node *node = NULL;
@@ -342,11 +321,12 @@ static void __init
of_register_i2c_devices(struct device_node *adap_node, int bu
while ((node = of_get_next_child(adap_node, node))) {
struct i2c_board_info info;
const u32 *addr;
+   const char *compatible;
int len;

addr = of_get_property(node, reg, len);
if (!addr || len  sizeof(int) || *addr  (1  10) - 1) {
-   printk(KERN_WARNING fsl_ioc.c: invalid i2c device 
entry\n);
+   printk(KERN_WARNING i2c-mpc.c: invalid entry, missing 
reg attribute\n);
continue;
}

@@ -354,16 +334,21 @@ static void __init
of_register_i2c_devices(struct device_node *adap_node, int bu
if (info.irq == NO_IRQ)
info.irq = -1;

-   if (of_find_i2c_driver(node, info)  0)
+   compatible = of_get_property(node, compatible, len);
+   if (!compatible) {
+   printk(KERN_WARNING i2c-mpc.c: invalid entry, missing 
compatible
attribute\n);
continue;
+   }
+   strncpy(info.name, compatible, sizeof(info.name));

info.platform_data = NULL;
info.addr = *addr;
-
+   
i2c_register_board_info(bus_num, info, 1);
}
 }

+
 static int __init fsl_i2c_of_init(void)
 {
struct device_node *np;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d663e69..d9a70c2 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -51,6 +51,7 @@ static int i2c_device_match(struct device *dev,
struct device_driver *drv)
 {
struct i2c_client   *client = to_i2c_client(dev);
struct i2c_driver   *driver = to_i2c_driver(drv);
+   char const **alias;

/* make legacy i2c drivers bypass driver model probing entirely;
 * such drivers scan each i2c adapter/bus themselves.
@@ -60,8 +61,18 @@ static int i2c_device_match(struct device *dev,
struct device_driver *drv)

/* new style drivers use the same kind of driver matching policy
 * as platform devices or SPI:  compare device and driver IDs.
+* Match against arrary of alias device tree names. When a match
+* is found change the reference to point at the copy inside the
+* chip driver allowing the caller's string to be freed.
 */
-   return strcmp(client-driver_name, drv-name) == 0;
+   alias = driver-aliases;
+   while (*alias) {
+   if (strcmp(client-name, *alias) == 0) {
+   return true;
+   }
+   

Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Jean Delvare
Hi Matt,

On Tue, 06 Nov 2007 18:53:11 +, Matt Sealey wrote:
 Jean Delvare wrote:
  On Mon, 05 Nov 2007 21:52:06 +, Matt Sealey wrote:
  Well, all i2c devices have a chip id you can probe for (...)
  
  This statement is completely incorrect. I2C devices do NOT have
  standard ID registers. Some devices have proprietary ID registers, some
  don't, it's really up to the manfacturer.
 
 All I2C slave devices have to have a 7- or 10-bit address to identify them
 by. They *may* not report what they ARE, but this is 9 times out of
 10 a hardware design decision of soldering the chip to a board and
 the address is then coded into device trees or hardcoded into drivers.
 
 Whoever designed the board and has the datasheets knows the address
 they're supposed to be at, and the device can accept this.
 
 You simply cannot entertain an i2c bus with anonymous and unnumbered
 devices, every one has to have an address it responds to, however
 it is defined, or it just does not work.

Of course, but it is all about addressing, NOT identifying.

 WRT cell-index this is an index of the bus on the chip (not the logical
 i2c bus but the physical difference between two i2c controllers) and
 then any i2c devices which need to be communicated with would be
 child nodes, their reg property reflecting their slave address, is
 that not correct?

I am not familiar with the OF tree, I can't tell, sorry.

-- 
Jean Delvare
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3 11/13] [POWERPC] Motion-PRO: Add LED support

2007-11-06 Thread Marian Balakowicz
Add LED driver for Promess Motion-PRO board.

Signed-off-by: Jan Wrobel [EMAIL PROTECTED]
Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 drivers/leds/Kconfig  |7 +
 drivers/leds/Makefile |3 -
 drivers/leds/leds-motionpro.c |  243 +
 include/asm-powerpc/mpc52xx.h |5 +
 4 files changed, 257 insertions(+), 1 deletions(-)
 create mode 100644 drivers/leds/leds-motionpro.c


diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index ec568fa..1567ed6 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -55,6 +55,13 @@ config LEDS_TOSA
  This option enables support for the LEDs on Sharp Zaurus
  SL-6000 series.
 
+config LEDS_MOTIONPRO
+   tristate Motion-PRO LEDs Support
+   depends on LEDS_CLASS  PPC_MPC5200
+   help
+ This option enables support for status and ready LEDs connected
+ to GPIO lines on Motion-PRO board.
+
 config LEDS_S3C24XX
tristate LED Support for Samsung S3C24XX GPIO LEDs
depends on LEDS_CLASS  ARCH_S3C2410
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index a60de1b..a56d399 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -18,7 +18,8 @@ obj-$(CONFIG_LEDS_H1940)  += leds-h1940.o
 obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o
 obj-$(CONFIG_LEDS_COBALT_RAQ)  += leds-cobalt-raq.o
 obj-$(CONFIG_LEDS_GPIO)+= leds-gpio.o
-obj-$(CONFIG_LEDS_CM_X270)  += leds-cm-x270.o
+obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o
+obj-$(CONFIG_LEDS_MOTIONPRO)   += leds-motionpro.o
 
 # LED Triggers
 obj-$(CONFIG_LEDS_TRIGGER_TIMER)   += ledtrig-timer.o
diff --git a/drivers/leds/leds-motionpro.c b/drivers/leds/leds-motionpro.c
new file mode 100644
index 000..11b283f
--- /dev/null
+++ b/drivers/leds/leds-motionpro.c
@@ -0,0 +1,243 @@
+/*
+ * LEDs driver for the Motion-PRO board.
+ * 
+ * Copyright (C) 2007 Semihalf
+ * Jan Wrobel [EMAIL PROTECTED]
+ * Marian Balakowicz [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ * Decription:
+ * This driver enables control over Motion-PRO status and ready LEDs through
+ * sysfs. LEDs can be controlled by writing to sysfs files:
+ * class/leds/led-name/(brightness|delay_off|delay_on).
+ * See Documentation/leds-class.txt for more details.
+ * led-name is the set to the corresponding GPT node name.
+ *
+ * Before user issues first control command via sysfs, LED blinking is
+ * controlled by the kernel ('blink-delay' property of the GPT node
+ * in the device tree blob).
+ *
+ */
+
+#undef DEBUG
+
+#include linux/module.h
+#include linux/types.h
+#include linux/kernel.h
+#include linux/leds.h
+#include linux/vmalloc.h
+#include linux/of_platform.h
+
+#include asm/mpc52xx.h
+#include asm/io.h
+
+/* LED control bits */
+#define LED_ON MPC52xx_GPT_OUTPUT_1
+
+/* LED mode */
+#define LED_MODE_KERNEL1
+#define LED_MODE_USER  2
+
+struct motionpro_led {
+   spinlock_t led_lock;/* Protects the LED data */
+   struct mpc52xx_gpt __iomem *gpt;/* LED registers */
+   struct timer_list blink_timer;  /* Used if blink_delay is nonzero */
+   unsigned int blink_delay;   /* [ms], if set to 0 blinking is off */
+   unsigned int mode;  /* kernel/user */
+   struct led_classdev mpled_cdev; /* LED class */
+};
+
+/*
+ * Timer event - blinks LED before user takes control over it
+ * with the first access via sysfs.
+ */
+static void mpled_timer_toggle(unsigned long data)
+{
+   struct motionpro_led *mpled = (struct motionpro_led *)data;
+
+   spin_lock_bh(mpled-led_lock);
+   if (mpled-mode == LED_MODE_KERNEL) {
+   u32 val = in_be32(mpled-gpt-mode);
+   val ^= LED_ON;
+   out_be32(mpled-gpt-mode, val);
+
+   mod_timer(mpled-blink_timer,
+   jiffies + msecs_to_jiffies(mpled-blink_delay));
+   }
+   spin_unlock_bh(mpled-led_lock);
+}
+
+/*
+ * Turn on/off led according to user settings in sysfs.
+ * First call to this function disables kernel blinking.
+ */
+static void mpled_set(struct led_classdev *led_cdev,
+ enum led_brightness brightness)
+{
+   struct motionpro_led *mpled;
+   int old_mode;
+   

[PATCH v3 13/13] [POWERPC] Promess Motion-PRO defconfig

2007-11-06 Thread Marian Balakowicz
Add Motion-PRO board defconfig file.

Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
---

 arch/powerpc/configs/motionpro_defconfig |  989 ++
 1 files changed, 989 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/configs/motionpro_defconfig


diff --git a/arch/powerpc/configs/motionpro_defconfig 
b/arch/powerpc/configs/motionpro_defconfig
new file mode 100644
index 000..fd7a327
--- /dev/null
+++ b/arch/powerpc/configs/motionpro_defconfig
@@ -0,0 +1,989 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.23
+# Mon Oct 29 14:11:27 2007
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+CONFIG_6xx=y
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_PPC_FPU=y
+# CONFIG_ALTIVEC is not set
+CONFIG_PPC_STD_MMU=y
+CONFIG_PPC_STD_MMU_32=y
+# CONFIG_PPC_MM_SLICES is not set
+# CONFIG_SMP is not set
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+CONFIG_PPC_MERGE=y
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_IRQ_PER_CPU=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+# CONFIG_PPC_UDBG_16550 is not set
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+# CONFIG_DEFAULT_UIMAGE is not set
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
+CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+# CONFIG_EPOLL is not set
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_KMOD is not set
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED=anticipatory
+
+#
+# Platform support
+#
+CONFIG_PPC_MULTIPLATFORM=y
+# CONFIG_PPC_82xx is not set
+# CONFIG_PPC_83xx is not set
+# CONFIG_PPC_86xx is not set
+CONFIG_CLASSIC32=y
+# CONFIG_PPC_CHRP is not set
+CONFIG_PPC_MPC52xx=y
+CONFIG_PPC_MPC5200=y
+# CONFIG_PPC_MPC5200_BUGFIX is not set
+CONFIG_PPC_MPC5200_SIMPLE=y
+# CONFIG_PPC_EFIKA is not set
+# CONFIG_PPC_LITE5200 is not set
+# CONFIG_PPC_PMAC is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PQ2ADS is not set
+# CONFIG_EMBEDDED6xx is not set
+# CONFIG_MPIC is not set
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_970_NAP is not set
+# CONFIG_PPC_INDIRECT_IO is not set
+# CONFIG_GENERIC_IOMAP is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_TAU is not set
+# CONFIG_CPM2 is not set
+# CONFIG_FSL_ULI1575 is not set
+# CONFIG_PPC_BESTCOMM is not set
+
+#
+# Kernel options
+#
+# CONFIG_HIGHMEM is not set
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=250
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_MISC is not set

Re: [PATCH v3 04/13] [POWERPC] Add generic support for simple MPC5200 based boards

2007-11-06 Thread Wolfgang Denk
Dear Grant,

in message [EMAIL PROTECTED] you wrote:

 In other words; make the assumption that it is easier to change the
 kernel than it is to change the device tree.

Are you serious about this?

Reading this from someone with your experience with device trees if
feeding my worst fears...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [EMAIL PROTECTED]
Text processing has made it possible to right-justify any idea, even
one which cannot be justified on any other grounds.
 -- J. Finnegan, USC.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread David Gibson
On Tue, Nov 06, 2007 at 02:02:12PM -0500, Jon Smirl wrote:
 Second pass at extending i2c core to accept strings of aliases for
 the
[snip]

 -/* With some changes from Kyösti Mälkki [EMAIL PROTECTED].
 +/* With some changes from Kyösti MÀlkki [EMAIL PROTECTED].

This looks like an unrelated change of character encoding has slipped
in here.

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH v3 07/13] [POWERPC] TQM5200 DTS

2007-11-06 Thread David Gibson
On Tue, Nov 06, 2007 at 09:05:48PM +0100, Marian Balakowicz wrote:
 Add device tree source file for TQM5200 board.
 
 Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]

[snip]
 + [EMAIL PROTECTED] {
 + device_type = usb-ohci-be;

This device_type is bogus.  Remember having a valid device_type is the
exception not the rule.  Really the only common device_type values are
cpu, memory, network and serial.

 + compatible = mpc5200-ohci,ohci-be;
 + reg = 1000 ff;
 + interrupts = 2 6 0;
 + interrupt-parent = mpc5200_pic;
 + };
 +
 + [EMAIL PROTECTED] {
 + compatible = mpc5200-bestcomm;
 + reg = 1200 80;
 + interrupts = 3 0 0  3 1 0  3 2 0  3 3 0
 +   3 4 0  3 5 0  3 6 0  3 7 0
 +   3 8 0  3 9 0  3 a 0  3 b 0
 +   3 c 0  3 d 0  3 e 0  3 f 0;
 + interrupt-parent = mpc5200_pic;
 + };
 +
 + [EMAIL PROTECTED] {
 + compatible = mpc5200-xlb;
 + reg = 1f00 100;
 + };
 +
 + [EMAIL PROTECTED] { // PSC1
 + device_type = serial;
 + compatible = mpc5200-psc-uart;
 + port-number = 0;  // Logical port assignment

I know you said this is still needed, but the driver really needs to
be fixed.  This is not a proper way of using the device tree for
logical numbering.

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v3 12/13] [POWERPC] Promess Motion-PRO DTS

2007-11-06 Thread David Gibson
On Tue, Nov 06, 2007 at 09:06:34PM +0100, Marian Balakowicz wrote:
 Add device tree source file for Motion-PRO board.
 
 Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]

[snip]
 + [EMAIL PROTECTED] { // Motion-PRO status LED
 + compatible = promess,motionpro-statusled;
 + reg = 660 10;
 + interrupts = 1 f 0;
 + interrupt-parent = mpc5200_pic;
 + blink-delay = 64; // 100 msec
 + };
 +
 + [EMAIL PROTECTED] { // Motion-PRO ready LED
 + compatible = promess,motionpro-readyled;
 + reg = 670 10;
 + interrupts = 1 10 0;
 + interrupt-parent = mpc5200_pic;
 + };

Is there actually any difference in behaviour betweeen the two LEDs?
If not, they should probably have the same compatible value, and
perhaps a label property or some such to associate them with a
particular LED.

[snip]
 + [EMAIL PROTECTED] {
 + device_type = spi;

No device_type!

 + compatible = mpc5200b-spi,mpc5200-spi;
 + reg = f00 20;
 + interrupts = 2 d 0 2 e 0;
 + interrupt-parent = mpc5200_pic;
 + };
 +
 + [EMAIL PROTECTED] {
 + device_type = usb-ohci-be;

Nor here.

 + compatible = mpc5200b-ohci,mpc5200-ohci,ohci-be;
 + reg = 1000 ff;
 + interrupts = 2 6 0;
 + interrupt-parent = mpc5200_pic;
 + };

[snip]
 + // PSC2 in spi master mode 
 + [EMAIL PROTECTED] { // PSC2
 + compatible = mpc5200b-psc-spi,mpc5200-psc-spi;
 + cell-index = 1;

From your description, this is an incorrect usage of cell-index - it
should *only* be used to index into SoC shared registers; never for
logical numbering.

 + reg = 2200 100;
 + interrupts = 2 2 0;
 + interrupt-parent = mpc5200_pic;
 + };

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread David Gibson
On Mon, Nov 05, 2007 at 03:46:45PM -0700, Grant Likely wrote:
 On 11/5/07, Scott Wood [EMAIL PROTECTED] wrote:
  Jon Smirl wrote:
   On 11/5/07, Scott Wood [EMAIL PROTECTED] wrote:
   Jon Smirl wrote:
   This is my first pass at reworking the Freescale i2c driver. It
   switches the driver from being a platform driver to an open firmware
   one. I've checked it out on my hardware and it is working.
   We may want to hold off on this until arch/ppc goes away (or at least
   all users of this driver in arch/ppc).
  
   How about renaming the old driver file and leaving it hooked to ppc?
   Then it would get deleted when ppc goes away. That would let work
   progress on the powerpc version.
 
  Or we could have one driver that has two probe methods.  I don't like
  forking the driver.
 
 I agree.  This driver can and should have multiple bus bindings.
 
 cell-index = 1;
   What is cell-index for?
  
   I was using it to control the bus number, is that the wrong attribute?
 
  It shouldn't be specified at all -- the hardware has no concept of a
  device number.
 
 cell-index is important.  It describes the hardware, or more
 specifically the layout of the SoC.  The SoC has 2 i2c busses which
 are numbered 0 and 1.  This property should stay for the 5200.
 However, that is the only purpose of it.  cell-index does *not*
 describe the system level bus number.

cell-index should *only* be used if it's used to index into SoC-shared
registers.  It should *never* be used for logical bus or device
numbering as it's being used here.

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/2] [PPC 4xx] invalidate_l2cache_range() implementation for ppc44x

2007-11-06 Thread Yuri Tikhonov
 Support for L2-cache coherency synchronization routines in ppc44x
processors.


Signed-off-by: Yuri Tikhonov [EMAIL PROTECTED]
Signed-off-by: Pavel Kolesnikov [EMAIL PROTECTED]

--
diff --git a/arch/powerpc/lib/dma-noncoherent.c 
b/arch/powerpc/lib/dma-noncoherent.c
index 1947380..593a425 100644
--- a/arch/powerpc/lib/dma-noncoherent.c
+++ b/arch/powerpc/lib/dma-noncoherent.c
@@ -351,12 +351,18 @@ void __dma_sync(void *vaddr, size_t size, int direction)
BUG();
case DMA_FROM_DEVICE:   /* invalidate only */
invalidate_dcache_range(start, end);
+#ifdef CONFIG_L2_CACHE
+   invalidate_l2cache_range(__pa(start), __pa(end));
+#endif
break;
case DMA_TO_DEVICE: /* writeback only */
clean_dcache_range(start, end);
break;
case DMA_BIDIRECTIONAL: /* writeback and invalidate */
flush_dcache_range(start, end);
+#ifdef CONFIG_L2_CACHE
+   invalidate_l2cache_range(__pa(start), __pa(end));
+#endif
break;
}
 }
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 46cf8fa..de62f85 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -386,6 +386,36 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
sync/* additional sync needed on g4 */
isync
blr
+
+#ifdef CONFIG_L2_CACHE
+/*
+ * Invalidate the Level-2 cache lines corresponded to the address
+ * range.
+ *
+ * invalidate_l2cache_range(unsigned long start, unsigned long stop)
+ */
+#include asm/ibm4xx.h
+_GLOBAL(invalidate_l2cache_range)
+   li  r5,L2_CACHE_BYTES-1 /* do l2-cache line alignment */
+   andcr3,r3,r5
+   subfr4,r3,r4
+   add r4,r4,r5
+   srwi.   r4,r4,L2_CACHE_SHIFT
+   mtctr   r4
+
+   lis r4, L2C_CMD_INV16
+1: mtdcr   DCRN_L2C0_ADDR,r3   /* write address to invalidate */
+   mtdcr   DCRN_L2C0_CMD,r4/* issue the Invalidate cmd */
+
+2: mfdcr   r5,DCRN_L2C0_SR /* wait for complete */
+   andis.  r5,r5,L2C_CMD_CLR16
+beq2b
+
+   addir3,r3,L2_CACHE_BYTES/* next address to invalidate */
+   bdnz1b
+   blr
+#endif
+
 /*
  * Write any modified data cache blocks out to memory.
  * Does not invalidate the corresponding cache lines (especially for
diff --git a/include/asm-powerpc/cache.h b/include/asm-powerpc/cache.h
index 5350704..8a2f9e6 100644
--- a/include/asm-powerpc/cache.h
+++ b/include/asm-powerpc/cache.h
@@ -10,12 +10,14 @@
 #define MAX_COPY_PREFETCH  1
 #elif defined(CONFIG_PPC32)
 #define L1_CACHE_SHIFT 5
+#define L2_CACHE_SHIFT 5
 #define MAX_COPY_PREFETCH  4
 #else /* CONFIG_PPC64 */
 #define L1_CACHE_SHIFT 7
 #endif
 
 #defineL1_CACHE_BYTES  (1  L1_CACHE_SHIFT)
+#defineL2_CACHE_BYTES  (1  L2_CACHE_SHIFT)
 
 #defineSMP_CACHE_BYTES L1_CACHE_BYTES
 
diff --git a/include/asm-powerpc/cacheflush.h b/include/asm-powerpc/cacheflush.h
index ba667a3..bdebfaa 100644
--- a/include/asm-powerpc/cacheflush.h
+++ b/include/asm-powerpc/cacheflush.h
@@ -49,6 +49,7 @@ extern void flush_dcache_range(unsigned long start, unsigned 
long stop);
 #ifdef CONFIG_PPC32
 extern void clean_dcache_range(unsigned long start, unsigned long stop);
 extern void invalidate_dcache_range(unsigned long start, unsigned long stop);
+extern void invalidate_l2cache_range(unsigned long start, unsigned long stop);
 #endif /* CONFIG_PPC32 */
 #ifdef CONFIG_PPC64
 extern void flush_inval_dcache_range(unsigned long start, unsigned long stop);
diff --git a/include/asm-ppc/ibm44x.h b/include/asm-ppc/ibm44x.h
index 8078a58..782909a 100644
--- a/include/asm-ppc/ibm44x.h
+++ b/include/asm-ppc/ibm44x.h
@@ -138,7 +138,6 @@
  * The residual board information structure the boot loader passes
  * into the kernel.
  */
-#ifndef __ASSEMBLY__
 
 /*
  * DCRN definitions
@@ -814,6 +813,5 @@
 
 #include asm/ibm4xx.h
 
-#endif /* __ASSEMBLY__ */
 #endif /* __ASM_IBM44x_H__ */
 #endif /* __KERNEL__ */ 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/2] [PPC 44x] enable L2-cache for ALPR, Katmai, Ocotea, and Taishan

2007-11-06 Thread Yuri Tikhonov
 This patch introduces the L2_CACHE configuration option available
for the ppc44x-based boards with L2-cache enabled.

Signed-off-by: Yuri Tikhonov [EMAIL PROTECTED]
Signed-off-by: Pavel Kolesnikov [EMAIL PROTECTED]

--
diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
index 1d2ca42..ad6b581 100644
--- a/arch/ppc/platforms/4xx/Kconfig
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -396,4 +396,12 @@ config SERIAL_SICC_CONSOLE
bool
depends on SERIAL_SICC  UART0_TTYS1
default y
+
+config L2_CACHE
+   bool Enable Level-2 Cache
+   depends on NOT_COHERENT_CACHE  (KATMAI || TAISHAN || OCOTEA || ALPR)
+   default y
+   help
+ This option enables L2-cache on ppc44x controllers.
+ If unsure, say Y.
 endmenu
diff --git a/arch/ppc/platforms/4xx/alpr.c b/arch/ppc/platforms/4xx/alpr.c
index 3b6519f..0623801 100644
--- a/arch/ppc/platforms/4xx/alpr.c
+++ b/arch/ppc/platforms/4xx/alpr.c
@@ -537,10 +537,12 @@ static void __init alpr_setup_arch(void)
printk(Prodrive ALPR port (DENX Software Engineering [EMAIL 
PROTECTED])\n);
 }
 
+#ifdef CONFIG_L2_CACHE
 static void __init alpr_init(void)
 {
ibm440gx_l2c_setup(clocks);
 }
+#endif
 
 static void alpr_progress(char *buf, unsigned short val)
 {
@@ -567,7 +569,9 @@ void __init platform_init(unsigned long r3, unsigned long 
r4,
 #ifdef CONFIG_KGDB
ppc_md.early_serial_map = alpr_early_serial_map;
 #endif
+#ifdef CONFIG_L2_CACHE
ppc_md.init = alpr_init;
+#endif
ppc_md.restart = alpr_restart;
 }
 
diff --git a/arch/ppc/platforms/4xx/katmai.c b/arch/ppc/platforms/4xx/katmai.c
index d29ebf6..01f1baf 100644
--- a/arch/ppc/platforms/4xx/katmai.c
+++ b/arch/ppc/platforms/4xx/katmai.c
@@ -219,6 +219,7 @@ katmai_show_cpuinfo(struct seq_file *m)
 {
seq_printf(m, vendor\t\t: AMCC\n);
seq_printf(m, machine\t\t: PPC440SPe EVB (Katmai)\n);
+   ibm440gx_show_cpuinfo(m);
 
return 0;
 }
@@ -584,6 +585,13 @@ static void katmai_restart(char *cmd)
mtspr(SPRN_DBCR0, DBCR0_RST_CHIP);
 }
 
+#ifdef CONFIG_L2_CACHE
+static void __init katmai_init(void)
+{
+   ibm440gx_l2c_setup(clocks);
+}
+#endif
+
 void __init platform_init(unsigned long r3, unsigned long r4,
  unsigned long r5, unsigned long r6, unsigned long r7)
 {
@@ -599,4 +607,7 @@ void __init platform_init(unsigned long r3, unsigned long 
r4,
ppc_md.early_serial_map = katmai_early_serial_map;
 #endif
ppc_md.restart = katmai_restart;
+#ifdef CONFIG_L2_CACHE
+   ppc_md.init = katmai_init;
+#endif
 }
diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
index a7435aa..8b13811 100644
--- a/arch/ppc/platforms/4xx/ocotea.c
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -321,10 +321,12 @@ ocotea_setup_arch(void)
printk(IBM Ocotea port (MontaVista Software, Inc. [EMAIL 
PROTECTED])\n);
 }
 
+#ifdef CONFIG_L2_CACHE
 static void __init ocotea_init(void)
 {
ibm440gx_l2c_setup(clocks);
 }
+#endif
 
 void __init platform_init(unsigned long r3, unsigned long r4,
unsigned long r5, unsigned long r6, unsigned long r7)
@@ -345,5 +347,7 @@ void __init platform_init(unsigned long r3, unsigned long 
r4,
 #ifdef CONFIG_KGDB
ppc_md.early_serial_map = ocotea_early_serial_map;
 #endif
+#ifdef CONFIG_L2_CACHE
ppc_md.init = ocotea_init;
+#endif
 }
diff --git a/arch/ppc/platforms/4xx/taishan.c b/arch/ppc/platforms/4xx/taishan.c
index f4b9435..8bb6f15 100644
--- a/arch/ppc/platforms/4xx/taishan.c
+++ b/arch/ppc/platforms/4xx/taishan.c
@@ -370,10 +370,12 @@ taishan_setup_arch(void)
printk(AMCC PowerPC 440GX Taishan Platform\n);
 }
 
+#ifdef CONFIG_L2_CACHE
 static void __init taishan_init(void)
 {
ibm440gx_l2c_setup(clocks);
 }
+#endif
 
 void __init platform_init(unsigned long r3, unsigned long r4,
unsigned long r5, unsigned long r6, unsigned long r7)
@@ -389,6 +391,8 @@ void __init platform_init(unsigned long r3, unsigned long 
r4,
 #ifdef CONFIG_KGDB
ppc_md.early_serial_map = taishan_early_serial_map;
 #endif
+#ifdef CONFIG_L2_CACHE
ppc_md.init = taishan_init;
+#endif
 }
   

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v3 04/13] [POWERPC] Add generic support for simple MPC5200 based boards

2007-11-06 Thread Grant Likely
On 11/6/07, Marian Balakowicz [EMAIL PROTECTED] wrote:
 This patch adds support for 'mpc5200-simple-platform' compatible
 boards which do not need a platform specific setup. Such boards
 are supported assuming the following:

 - GPIO pins are configured by the firmware,
 - CDM configuration (clocking) is setup correctly by firmware,
 - if the 'fsl,has-wdt' property is present in one of the
   gpt nodes, then it is safe to use such gpt to reset the board,
 - PCI is supported if enabled in the kernel configuration

 Signed-off-by: Marian Balakowicz [EMAIL PROTECTED]
 ---

  arch/powerpc/boot/dts/lite5200.dts   |2 -
  arch/powerpc/boot/dts/lite5200b.dts  |2 -
  arch/powerpc/platforms/52xx/Kconfig  |   18 ++-
  arch/powerpc/platforms/52xx/Makefile |1
  arch/powerpc/platforms/52xx/mpc5200_simple.c |   72 
 ++
  5 files changed, 91 insertions(+), 4 deletions(-)
  create mode 100644 arch/powerpc/platforms/52xx/mpc5200_simple.c


 diff --git a/arch/powerpc/boot/dts/lite5200.dts 
 b/arch/powerpc/boot/dts/lite5200.dts
 index 6731763..5902362 100644
 --- a/arch/powerpc/boot/dts/lite5200.dts
 +++ b/arch/powerpc/boot/dts/lite5200.dts
 @@ -19,7 +19,7 @@
  / {
 model = fsl,lite5200;
 // revision = 1.0;
 -   compatible = fsl,lite5200,generic-mpc5200;
 +   compatible = fsl,lite5200;
 #address-cells = 1;
 #size-cells = 1;

 diff --git a/arch/powerpc/boot/dts/lite5200b.dts 
 b/arch/powerpc/boot/dts/lite5200b.dts
 index b540388..b509129 100644
 --- a/arch/powerpc/boot/dts/lite5200b.dts
 +++ b/arch/powerpc/boot/dts/lite5200b.dts
 @@ -19,7 +19,7 @@
  / {
 model = fsl,lite5200b;
 // revision = 1.0;
 -   compatible = fsl,lite5200b,generic-mpc5200;
 +   compatible = fsl,lite5200b;
 #address-cells = 1;
 #size-cells = 1;

 diff --git a/arch/powerpc/platforms/52xx/Kconfig 
 b/arch/powerpc/platforms/52xx/Kconfig
 index 2938d49..b8a6ebc 100644
 --- a/arch/powerpc/platforms/52xx/Kconfig
 +++ b/arch/powerpc/platforms/52xx/Kconfig
 @@ -19,6 +19,22 @@ config PPC_MPC5200_BUGFIX

   It is safe to say 'Y' here

 +config PPC_MPC5200_SIMPLE
 +   bool Generic support for simple MPC5200 based boards
 +   depends on PPC_MULTIPLATFORM  PPC32
 +   select PPC_MPC5200
 +   default n
 +   help
 + This option enables support for a simple MPC52xx based boards which
 + do not need a custom platform specific setup. Such boards are
 + supported assuming the following:
 +
 + - GPIO pins are configured by the firmware,
 + - CDM configuration (clocking) is setup correctly by firmware,
 + - if the 'fsl,has-wdt' property is present in one of the
 +   gpt nodes, then it is safe to use such gpt to reset the board,
 + - PCI is supported if enabled in the kernel configuration

... and there is a PCI bus node in the device tree.

I'd also add a list of the known boards that behave like this.

 +/*
 + * Called very early, MMU is off, device-tree isn't unflattened
 + */
 +static int __init mpc5200_simple_probe(void)
 +{
 +   unsigned long node = of_get_flat_dt_root();
 +
 +   if (!of_flat_dt_is_compatible(node, mpc5200-simple-platform))
 +   return 0;
 +   return 1;
 +}

I've thought some more about this, and I no longer think that this is
the best approach.  I think having the mpc5200 simple platform is a
good thing, but I don't think we should have the device tree claim
compatibility with mpc5200-simple-platform

Trying to define exactly what mpc5200-simple-platform describes here
and now is probably over ambitious and there is the tendency to want
it change it's meaning over time.  (just like with the compatible
field in device nodes; better to stick with real devices and not start
making stuff up).

Instead, I think we should drop mpc5200-simple-platform from the
device trees themselves and instead make mpc5200_simple_platform()
loop over a list of known boards that work with the simple 5200
platform.

In other words; make the assumption that it is easier to change the
kernel than it is to change the device tree.

So, do something like this:

static int __init mpc5200_simple_probe(void)
{
  const char *board[] = { promess,motionpro, schindler,cm5200,
tqc,tqm5200,
NULL };
  int i = 0;

  while (board[i]) {
if (of_flat_dt_is_compatible(node, board[i]))
  break;
i++;
  }

  return (board[i] != NULL);
}

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: mmap question on ppc440

2007-11-06 Thread Josh Boyer
On Wed, 07 Nov 2007 09:02:10 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 
 On Tue, 2007-11-06 at 07:50 +0100, Stefan Roese wrote:
  On Monday 05 November 2007, Josh Boyer wrote:
I am attempting to access the CPLD on the AMCC Sequoia board from
user-land.  I open /dev/mem, and mmap it, then try to access the
resulting pointer.  That works fine when accessing physical addresses
that correspond to RAM, but as soon as I try to access the CPLD at
physical address 0xc000, I get an infinite machine check.
  
   That's because the CPLD is actually at physical address 0x1C000.
   Yay for 36-bit physical addresses.
  
  Right. Are you using arch/ppc or arch/powerpc? If it's arch/ppc you could
  give the following patch a try:
  
  @@ -275,6 +275,14 @@
   {
  size_t size = vma-vm_end - vma-vm_start;
  
  +#if defined(CONFIG_44x)  !defined(CONFIG_PPC_MERGE)
  +   /*
  +* 2006-08-07: sr
  +* Needed on 44x-er systems for 36bit addresses (like pci on 440gx)
  +*/
  +   vma-vm_pgoff = (fixup_bigphys_addr(vma-vm_pgoff  PAGE_SHIFT, 
  size)  PAGE_SHIFT);
  +#endif
  +
  if (!valid_mmap_phys_addr_range(vma-vm_pgoff, size))
  return -EINVAL;
 
 I think we need to ditch the bigphys fixup stuff and come up with a way
 to make /dev/mem work with the actual 36 bits offsets (after all, it's
 all pgoff, it should work).

We did ditch bigphys in arch/powerpc.  mmap64 works apparently.

 The other problem is X of course... 32 bits X server currently cannot
 cope with physical addresses  32 bits at all. They will just blow up or
 randomly scribble over /dev/mem.
 
 The solution is libpciaccess and the new pci-rework branch of X which
 uses it, but I haven't had a chance to test that properly yet on 4xx.

Um... because arch/powerpc 4xx doesn't have PCI support? :)  You and
Valentine and Vitaly keep trading emails about it though, which is a
good sign.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC/PATCH] Fix rtas_ibm_suspend_me bugs

2007-11-06 Thread jschopp
  -for_each_possible_cpu(i)
  -plpar_hcall_norets(H_PROD,i);

...

  +for_each_online_cpu(i)
  +plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(i));

I assume this bit would be non-contriversial and could be sent up for 
immediate upstream inclusion.

Nathan Lynch wrote:
 (very rfc for now, no sign-off, needs more testing)
 
 There are a couple of bugs in the rtas_ibm_suspend_me() and
 rtas_percpu_suspend_me() functions:
 
 1.  rtas_ibm_suspend_me() uses on_each_cpu() to invoke
 rtas_percpu_suspend_me() via IPI:
 
 if (on_each_cpu(rtas_percpu_suspend_me, data, 1, 0))
 ...
 
 'data' is on the stack, and rtas_ibm_suspend_me() takes no measures to
 ensure that all instances of rtas_percpu_suspend_me() are finished
 accessing 'data' before returning.  This can result in the IPI'd cpus
 accessing random stack data and getting stuck in H_JOIN.
 
 Fix this by moving rtas_suspend_me_data off the stack, and protect it
 with a mutex.  Use a completion to ensure that all cpus are done
 accessing the data before unlocking.
 
 2.  rtas_percpu_suspend_me passes the Linux logical cpu id to the
 H_PROD hypervisor method, when it should be using the platform
 interrupt server value for that cpu (hard_smp_processor_id).  In
 practice, this probably causes problems only on partitions where
 processors have been removed and added in a particular order.
 
 ---
  arch/powerpc/kernel/rtas.c |   64 ---
  1 files changed, 47 insertions(+), 17 deletions(-)
 
 diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
 index 2147807..24faaea 100644
 --- a/arch/powerpc/kernel/rtas.c
 +++ b/arch/powerpc/kernel/rtas.c
 @@ -19,6 +19,9 @@
  #include linux/init.h
  #include linux/capability.h
  #include linux/delay.h
 +#include linux/mutex.h
 +#include linux/completion.h
 +#include linux/smp.h
  
  #include asm/prom.h
  #include asm/rtas.h
 @@ -34,6 +37,7 @@
  #include asm/lmb.h
  #include asm/udbg.h
  #include asm/syscalls.h
 +#include asm/atomic.h
  
  struct rtas_t rtas = {
   .lock = SPIN_LOCK_UNLOCKED
 @@ -41,10 +45,21 @@ struct rtas_t rtas = {
  EXPORT_SYMBOL(rtas);
  
  struct rtas_suspend_me_data {
 + atomic_t working; /* number of cpus accessing rtas_suspend_me_data */
   long waiting;
   struct rtas_args *args;
 + struct completion done; /* wait on this until working == 0 */
  };
  
 +static void rtas_suspend_me_data_init(struct rtas_suspend_me_data *rsmd,
 +   struct rtas_args *args)
 +{
 + atomic_set(rsmd-working, 0);
 + rsmd-waiting = 1;
 + rsmd-args = args;
 + init_completion(rsmd-done);
 +}
 +
  DEFINE_SPINLOCK(rtas_data_buf_lock);
  EXPORT_SYMBOL(rtas_data_buf_lock);
  
 @@ -671,36 +686,49 @@ static void rtas_percpu_suspend_me(void *info)
* we set it to 0.
*/
   local_irq_save(flags);
 + atomic_inc(data-working);
   do {
   rc = plpar_hcall_norets(H_JOIN);
   smp_rmb();
   } while (rc == H_SUCCESS  data-waiting  0);
   if (rc == H_SUCCESS)
 + /* join is complete (or there was an error) and this
 +  * cpu was prodded
 +  */
   goto out;
  
   if (rc == H_CONTINUE) {
 + /* this cpu does the join */
   data-waiting = 0;
   data-args-args[data-args-nargs] =
   rtas_call(ibm_suspend_me_token, 0, 1, NULL);
 - for_each_possible_cpu(i)
 - plpar_hcall_norets(H_PROD,i);
   } else {
   data-waiting = -EBUSY;
   printk(KERN_ERR Error on H_JOIN hypervisor call\n);
   }
  
 + /* This cpu did the join or got an error, so we need to prod
 +  * everyone else.  Extra prods are harmless.
 +  */
 + for_each_online_cpu(i)
 + plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(i));
 +
  out:
 + if (atomic_dec_return(data-working) == 0)
 + complete(data-done);
   local_irq_restore(flags);
   return;
  }
  
 +static DEFINE_MUTEX(rsm_lock); /* protects rsm_data */
 +static struct rtas_suspend_me_data rsm_data;
 +
  static int rtas_ibm_suspend_me(struct rtas_args *args)
  {
 - int i;
 + int err;
   long state;
   long rc;
   unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
 - struct rtas_suspend_me_data data;
  
   /* Make sure the state is valid */
   rc = plpar_hcall(H_VASI_STATE, retbuf,
 @@ -721,25 +749,27 @@ static int rtas_ibm_suspend_me(struct rtas_args *args)
   return 0;
   }
  
 - data.waiting = 1;
 - data.args = args;
 + mutex_lock(rsm_lock);
 +
 + rtas_suspend_me_data_init(rsm_data, args);
  
 - /* Call function on all CPUs.  One of us will make the
 -  * rtas call
 + /* Call function on all CPUs.  One of us (but not necessarily
 +  * this one) will make the ibm,suspend-me call.
*/
 - if 

Re: [RFC] Rework of i2c-mpc.c - Freescale i2c driver

2007-11-06 Thread Matt Sealey
Jean Delvare wrote:
 Hi Matt,

 WRT cell-index this is an index of the bus on the chip (not the logical
 i2c bus but the physical difference between two i2c controllers) and
 then any i2c devices which need to be communicated with would be
 child nodes, their reg property reflecting their slave address, is
 that not correct?
 
 I am not familiar with the OF tree, I can't tell, sorry.
 

Well, it's how board designers tell you what chip is at what address :)

-- 
Matt Sealey [EMAIL PROTECTED]
Genesi, Manager, Developer Relations
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: mmap question on ppc440

2007-11-06 Thread Benjamin Herrenschmidt

On Tue, 2007-11-06 at 07:50 +0100, Stefan Roese wrote:
 On Monday 05 November 2007, Josh Boyer wrote:
   I am attempting to access the CPLD on the AMCC Sequoia board from
   user-land.  I open /dev/mem, and mmap it, then try to access the
   resulting pointer.  That works fine when accessing physical addresses
   that correspond to RAM, but as soon as I try to access the CPLD at
   physical address 0xc000, I get an infinite machine check.
 
  That's because the CPLD is actually at physical address 0x1C000.
  Yay for 36-bit physical addresses.
 
 Right. Are you using arch/ppc or arch/powerpc? If it's arch/ppc you could
 give the following patch a try:
 
 @@ -275,6 +275,14 @@
  {
 size_t size = vma-vm_end - vma-vm_start;
 
 +#if defined(CONFIG_44x)  !defined(CONFIG_PPC_MERGE)
 +   /*
 +* 2006-08-07: sr
 +* Needed on 44x-er systems for 36bit addresses (like pci on 440gx)
 +*/
 +   vma-vm_pgoff = (fixup_bigphys_addr(vma-vm_pgoff  PAGE_SHIFT, 
 size)  PAGE_SHIFT);
 +#endif
 +
 if (!valid_mmap_phys_addr_range(vma-vm_pgoff, size))
 return -EINVAL;

I think we need to ditch the bigphys fixup stuff and come up with a way
to make /dev/mem work with the actual 36 bits offsets (after all, it's
all pgoff, it should work).

The other problem is X of course... 32 bits X server currently cannot
cope with physical addresses  32 bits at all. They will just blow up or
randomly scribble over /dev/mem.

The solution is libpciaccess and the new pci-rework branch of X which
uses it, but I haven't had a chance to test that properly yet on 4xx.

Ben.




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] DTC: Polish up the DTS Version 1 implementation.

2007-11-06 Thread Jon Loeliger
From: Jon Loeliger [EMAIL PROTECTED]

Fixes BYTESTRING lexing.
Allows -O dts output to be emitted in a given (1) format version.
Skirts around a range check problem in eval_literal() for now.

Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
---

David,

This patch is directly on top of your prior two patches.
Lemme know what you think.

jdl



 dtc-lexer.l  |4 
 dtc-parser.y |   13 ++---
 dtc.c|2 +-
 dtc.h|2 +-
 treesource.c |   39 +++
 5 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/dtc-lexer.l b/dtc-lexer.l
index 1c262d2..b18c0d1 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -190,6 +190,10 @@ static int dts_version; /* = 0 */
 *.   {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
+   if (yytext[0] == '[') {
+   DPRINT(BYTESTRING\n);
+   BEGIN(BYTESTRING);
+   }
if ((yytext[0] == '{')
|| (yytext[0] == ';')) {
DPRINT(PROPNODENAME\n);
diff --git a/dtc-parser.y b/dtc-parser.y
index ffb2299..652199f 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -297,17 +297,23 @@ label:
 
 %%
 
-void yyerror (char const *s)
+void yyerror(char const *s)
 {
const char *fname = srcpos_filename_for_num(yylloc.filenum);
 
if (strcmp(fname, -) == 0)
fname = stdin;
 
-   fprintf(stderr, %s:%d %s\n,
+   fprintf(stderr, %s:%d Error: %s\n,
fname, yylloc.first_line, s);
 }
 
+/*
+ * bits is unused, but it should be 32 or 64 as needed.
+ *
+ * FIXME: However, with bits == 64, ((1ULL  bits) - 1)
+ * overflows before you can actually do the range test.
+ */
 unsigned long long eval_literal(const char *s, int base, int bits)
 {
unsigned long long val;
@@ -317,9 +323,10 @@ unsigned long long eval_literal(const char *s, int base, 
int bits)
val = strtoull(s, e, base);
if (*e)
yyerror(bad characters in literal);
-   else if ((errno == ERANGE) || (val  ((1ULL  bits)-1)))
+   else if (errno == ERANGE)
yyerror(literal out of range);
else if (errno != 0)
yyerror(bad literal);
+
return val;
 }
diff --git a/dtc.c b/dtc.c
index bbef829..38313f5 100644
--- a/dtc.c
+++ b/dtc.c
@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
}
 
if (streq(outform, dts)) {
-   dt_to_source(outf, bi);
+   dt_to_source(outf, bi, 1);
} else if (streq(outform, dtb)) {
dt_to_blob(outf, bi, outversion, boot_cpuid_phys);
} else if (streq(outform, asm)) {
diff --git a/dtc.h b/dtc.h
index d080153..ba2027b 100644
--- a/dtc.h
+++ b/dtc.h
@@ -238,7 +238,7 @@ struct boot_info *dt_from_blob(FILE *f);
 
 /* Tree source */
 
-void dt_to_source(FILE *f, struct boot_info *bi);
+void dt_to_source(FILE *f, struct boot_info *bi, int dts_version);
 struct boot_info *dt_from_source(const char *f);
 
 /* FS trees */
diff --git a/treesource.c b/treesource.c
index 376ebc8..ac0c777 100644
--- a/treesource.c
+++ b/treesource.c
@@ -140,14 +140,18 @@ static void write_propval_string(FILE *f, struct data val)
fprintf(f, \;\n);
 }
 
-static void write_propval_cells(FILE *f, struct data val)
+static void write_propval_cells(FILE *f, struct data val, int dts_version)
 {
void *propend = val.val + val.len;
cell_t *cp = (cell_t *)val.val;
 
fprintf(f,  = );
for (;;) {
-   fprintf(f, %x, be32_to_cpu(*cp++));
+   if (dts_version == 0) {
+   fprintf(f, %x, be32_to_cpu(*cp++));
+   } else {
+   fprintf(f, 0x%x, be32_to_cpu(*cp++));
+   }
if ((void *)cp = propend)
break;
fprintf(f,  );
@@ -155,14 +159,18 @@ static void write_propval_cells(FILE *f, struct data val)
fprintf(f, ;\n);
 }
 
-static void write_propval_bytes(FILE *f, struct data val)
+static void write_propval_bytes(FILE *f, struct data val, int dts_version)
 {
void *propend = val.val + val.len;
char *bp = val.val;
 
fprintf(f,  = [);
for (;;) {
-   fprintf(f, %02hhx, *bp++);
+   if (dts_version == 0) {
+   fprintf(f, %02hhx, *bp++);
+   } else {
+   fprintf(f, 0x%02hhx, *bp++);
+   }
if ((void *)bp = propend)
break;
fprintf(f,  );
@@ -170,7 +178,7 @@ static void write_propval_bytes(FILE *f, struct data val)
fprintf(f, ];\n);
 }
 
-static void write_tree_source_node(FILE *f, struct node *tree, int level)
+static void write_tree_source_node(FILE *f, struct node *tree, int level, int 
dts_version)
 {
struct 

[PATCH 0/2] [PPC 4xx] L2-cache synchronization for ppc44x

2007-11-06 Thread Yuri Tikhonov

 Hello all,

 Here is a patch-set for support L2-cache synchronization routines for
the ppc44x processors family. I know that the ppc branch is for bug-fixing 
only, thus
the patch-set is just FYI [though enabled but non-coherent L2-cache may appear 
as a bug for
someone who uses one of the boards listed below :)].

[PATCH 1/2] [PPC 4xx] invalidate_l2cache_range() implementation for ppc44x;
[PATCH 2/2] [PPC 44x] enable L2-cache for the following ppc44x-based boards: 
ALPR,
Katmai, Ocotea, and Taishan.

 Regards, Yuri

-- 
Yuri Tikhonov, Senior Software Engineer
Emcraft Systems, www.emcraft.com

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[1/2] dtc: Refactor printing of property values in -Odts mode

2007-11-06 Thread David Gibson
Currently the main recursive tree printing function,
write_tree_source_node(), calls guess_type() to apply heuristics to
see how to print a property value, then calls the appropriate
write_propval_*() function to print it.

However, future heuristics for handling internal labels and the like
don't work well this way.  Therefore, this patch refactors things to
have write_tree_source_node() call a new write_propval() function,
which incorporates the heurstic logic from guess_type() and also calls
the right function to do the actual printing.

No behavioural change.

Signed-off-by: David Gibson [EMAIL PROTECTED]

---
 treesource.c |   97 +++
 1 file changed, 38 insertions(+), 59 deletions(-)

Index: dtc/treesource.c
===
--- dtc.orig/treesource.c   2007-11-07 09:55:03.0 +1100
+++ dtc/treesource.c2007-11-07 10:19:13.0 +1100
@@ -49,13 +49,6 @@
fputc('\t', f);
 }
 
-enum proptype {
-   PROP_EMPTY,
-   PROP_STRING,
-   PROP_CELLS,
-   PROP_BYTES,
-};
-
 int isstring(char c)
 {
return (isprint(c)
@@ -63,31 +56,6 @@
|| strchr(\a\b\t\n\v\f\r, c));
 }
 
-static enum proptype guess_type(struct property *prop)
-{
-   int len = prop-val.len;
-   char *p = prop-val.val;
-   int nnotstring = 0, nnul = 0;
-   int i;
-
-   if (len == 0)
-   return PROP_EMPTY;
-
-   for (i = 0; i  len; i++) {
-   if (! isstring(p[i]))
-   nnotstring++;
-   if (p[i] == '\0')
-   nnul++;
-   }
-
-   if ((p[len-1] == '\0')  (nnotstring == 0)  (nnul  (len-nnul)))
-   return PROP_STRING;
-   else if ((len % sizeof(cell_t)) == 0)
-   return PROP_CELLS;
-   else
-   return PROP_BYTES;
-}
-
 static void write_propval_string(FILE *f, struct data val)
 {
char *str = val.val;
@@ -95,7 +63,7 @@
 
assert(str[val.len-1] == '\0');
 
-   fprintf(f,  = \);
+   fprintf(f, \);
for (i = 0; i  (val.len-1); i++) {
char c = str[i];
 
@@ -137,7 +105,7 @@
fprintf(f, \\x%02hhx, c);
}
}
-   fprintf(f, \;\n);
+   fprintf(f, \);
 }
 
 static void write_propval_cells(FILE *f, struct data val)
@@ -145,14 +113,14 @@
void *propend = val.val + val.len;
cell_t *cp = (cell_t *)val.val;
 
-   fprintf(f,  = );
+   fprintf(f, );
for (;;) {
fprintf(f, %x, be32_to_cpu(*cp++));
if ((void *)cp = propend)
break;
fprintf(f,  );
}
-   fprintf(f, ;\n);
+   fprintf(f, );
 }
 
 static void write_propval_bytes(FILE *f, struct data val)
@@ -160,14 +128,45 @@
void *propend = val.val + val.len;
char *bp = val.val;
 
-   fprintf(f,  = [);
+   fprintf(f, [);
for (;;) {
fprintf(f, %02hhx, *bp++);
if ((void *)bp = propend)
break;
fprintf(f,  );
}
-   fprintf(f, ];\n);
+   fprintf(f, ]);
+}
+
+static void write_propval(FILE *f, struct property *prop)
+{
+   int len = prop-val.len;
+   char *p = prop-val.val;
+   int nnotstring = 0, nnul = 0;
+   int i;
+
+   if (len == 0) {
+   fprintf(f, ;\n);
+   return;
+   }
+
+   for (i = 0; i  len; i++) {
+   if (! isstring(p[i]))
+   nnotstring++;
+   if (p[i] == '\0')
+   nnul++;
+   }
+
+   fprintf(f,  = );
+
+   if ((p[len-1] == '\0')  (nnotstring == 0)  (nnul  (len-nnul))) {
+   write_propval_string(f, prop-val);
+   } else if (((len % sizeof(cell_t)) == 0)) {
+   write_propval_cells(f, prop-val);
+   } else {
+   write_propval_bytes(f, prop-val);
+   }
+   fprintf(f, ;\n);
 }
 
 static void write_tree_source_node(FILE *f, struct node *tree, int level)
@@ -184,31 +183,11 @@
fprintf(f, / {\n);
 
for_each_property(tree, prop) {
-   enum proptype type;
-
write_prefix(f, level+1);
if (prop-label)
fprintf(f, %s: , prop-label);
fprintf(f, %s, prop-name);
-   type = guess_type(prop);
-
-   switch (type) {
-   case PROP_EMPTY:
-   fprintf(f, ;\n);
-   break;
-
-   case PROP_STRING:
-   write_propval_string(f, prop-val);
-   break;
-
-   case PROP_CELLS:
-   write_propval_cells(f, prop-val);
-   break;
-
-   case PROP_BYTES:
-   write_propval_bytes(f, prop-val);
-

Re: [PATCH v3 04/13] [POWERPC] Add generic support for simple MPC5200 based boards

2007-11-06 Thread Grant Likely
On 11/6/07, Wolfgang Denk [EMAIL PROTECTED] wrote:
 Dear Grant,

 in message [EMAIL PROTECTED] you wrote:
 
  In other words; make the assumption that it is easier to change the
  kernel than it is to change the device tree.

 Are you serious about this?

 Reading this from someone with your experience with device trees if
 feeding my worst fears...

I think I better clarify.

Once a device tree is written and shipped on a deployed board, it may
never change again.  Or, the kernel version may be updated more
frequently than the device tree.

Say, for example, that in kernel 2.6.25 tqm5200 and cm5200 are both
handled by the same platform code.  And lets say that in 2.6.26 we
decide that they really need to have separate platform code (perhaps
due to a firmware bug that needs to be worked around on one board).
In this case, mpc5200-simple-platform has suddenly become useless.
Or, does mpc5200-simple-platform now describe the cm5200 or the
tqm5200?  (an assumption which cannot be made due to deployed boards
of both types claiming mpc5200-simple-platform).

Trying to claim compatible at the board level is far more difficult
than claiming it at the device level.

Segher suggested on IRC: for boards it is pretty much useless most of
the time, i think -- use model instead

Cheers,
g.




 Best regards,

 Wolfgang Denk

 --
 DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [EMAIL PROTECTED]
 Text processing has made it possible to right-justify any idea, even
 one which cannot be justified on any other grounds.
  -- J. Finnegan, USC.



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


dtc: Add testcases exercising -Odts mode

2007-11-06 Thread David Gibson
This patch adds a batch of testcases exercising dtc's -Odts mode.
Specifically it checks that using dtc to convert dtb-dts-dtb
preserves the original dtb for a number of example dtb files.

Signed-off-by: David Gibson [EMAIL PROTECTED]

Index: dtc/tests/run_tests.sh
===
--- dtc.orig/tests/run_tests.sh 2007-11-07 10:23:04.0 +1100
+++ dtc/tests/run_tests.sh  2007-11-07 10:27:30.0 +1100
@@ -83,7 +83,7 @@
 done
 
 # v16 and alternate layout tests
-for tree in test_tree1.dtb; do
+for tree in test_tree1.dtb sw_tree1.test.dtb; do
for version in 17 16; do
for layout in $ALL_LAYOUTS; do
run_test mangle-layout $tree $version $layout
@@ -94,7 +94,7 @@
 done
 
 # Read-write tests
-for basetree in test_tree1.dtb; do
+for basetree in test_tree1.dtb sw_tree1.test.dtb; do
for version in 17 16; do
for layout in $ALL_LAYOUTS; do
tree=v$version.$layout.$basetree
@@ -126,6 +126,13 @@
 
 run_test dtc.sh -I dts -O dtb -o dtc_escapes.test.dtb escapes.dts
 run_test string_escapes dtc_escapes.test.dtb
+
+# Check -Odts mode preserve all dtb information
+for tree in test_tree1.dtb dtc_tree1.test.dtb dtc_escapes.test.dtb ; do
+   run_test dtc.sh -I dtb -O dts -o odts_$tree.test.dts $tree
+   run_test dtc.sh -I dts -O dtb -o odts_$tree.test.dtb odts_$tree.test.dts
+   run_test dtbs_equal_ordered $tree odts_$tree.test.dtb
+done
 }
 
 while getopts vdt: ARG ; do
@@ -144,7 +151,7 @@
 fi
 
 # Make sure we don't have stale blobs lying around
-rm -f *.test.dtb
+rm -f *.test.dtb *.test.dts
 
 for set in $TESTSETS; do
 case $set in
Index: dtc/tests/Makefile.tests
===
--- dtc.orig/tests/Makefile.tests   2007-11-07 10:24:34.0 +1100
+++ dtc/tests/Makefile.tests2007-11-07 10:24:38.0 +1100
@@ -23,7 +23,7 @@
 
 TESTS_DEPFILES = $(TESTS:%=%.d) $(TESTS_PREFIX)testutils.d
 
-TESTS_CLEANFILES_L =  *.output vgcore.* *.dtb
+TESTS_CLEANFILES_L =  *.output vgcore.* *.dtb *.test.dts
 TESTS_CLEANFILES = $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
 
 BIN += $(TESTS) $(TESTS_PREFIX)dumptrees

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


dtc: Better exercise dtc base and bytestring features

2007-11-06 Thread David Gibson
This patch alters the main testcase, and the dts file corresponding to
it so that we at least trivially exercise dtc's bytestring and base
conversion features.

Signed-off-by: David Gibson [EMAIL PROTECTED]

Index: dtc/tests/test_tree1.dts
===
--- dtc.orig/tests/test_tree1.dts   2007-11-07 10:37:38.0 +1100
+++ dtc/tests/test_tree1.dts2007-11-07 10:39:32.0 +1100
@@ -1,5 +1,5 @@
 /memreserve/ deadbeef-deadbeef000f;
-/memreserve/ abcd1234 1234;
+/memreserve/ 75bcd15 1000;
 
 / {
compatible = test_tree1;
@@ -8,20 +8,20 @@
 
[EMAIL PROTECTED] {
compatible = subnode1;
-   prop-int = deadbeef;
+   prop-int = [deadbeef];
 
subsubnode {
compatible = subsubnode1, subsubnode;
-   prop-int = deadbeef;
+   prop-int = h# deadbeef;
};
};
 
[EMAIL PROTECTED] {
-   prop-int = abcd1234;
+   prop-int = d# 123456789;
 
[EMAIL PROTECTED] {
compatible = subsubnode2, subsubnode;
-   prop-int = abcd1234;
+   prop-int = o# 0726746425;
};
};
 };
Index: dtc/tests/testdata.h
===
--- dtc.orig/tests/testdata.h   2007-11-07 10:36:40.0 +1100
+++ dtc/tests/testdata.h2007-11-07 10:37:01.0 +1100
@@ -17,11 +17,11 @@
 
 #define TEST_ADDR_1ASM_CONST_LL(0xdeadbeef)
 #define TEST_SIZE_1ASM_CONST_LL(0x10)
-#define TEST_ADDR_2ASM_CONST_LL(0xabcd1234)
-#define TEST_SIZE_2ASM_CONST_LL(0x1234)
+#define TEST_ADDR_2ASM_CONST_LL(123456789)
+#define TEST_SIZE_2ASM_CONST_LL(01)
 
 #define TEST_VALUE_1   cell_to_fdt(0xdeadbeef)
-#define TEST_VALUE_2   cell_to_fdt(0xabcd1234)
+#define TEST_VALUE_2   cell_to_fdt(123456789)
 
 #define TEST_STRING_1  hello world
 #define TEST_STRING_2  nastystring: \a\b\t\n\v\f\r\\\

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


RE: [RFC/PATCH] reduce load time for modules with lots of relocs

2007-11-06 Thread Medve Emilian
Hello Nathan,


Would it be possible to do the sort in place (without the extra
buffer)? I mean would that upset any other part of the kernel?


Thanks,
Emil.


 -Original Message-
 From: Nathan Lynch [mailto:[EMAIL PROTECTED] 
 Sent: Monday, November 05, 2007 8:34 PM
 To: Medve Emilian
 Cc: linuxppc-dev@ozlabs.org
 Subject: [RFC/PATCH] reduce load time for modules with lots of relocs
 
 Nathan Lynch wrote:
  Medve Emilian-EMMEDVE1 wrote:
   
   I have module with 36K relocation entries (I know, I 
 know, how could
   that be...) and the count_relocs() function takes ~17 
 seconds to crunch
   through the relocation table from the .rela.text section. 
 I don't think
   I can reduce the number of entries in the relocation 
 table (can I?) so
   I'm thinking at improving the performance of 
 count_relocs() (currently
   O(n^2)). Does anybody have a simpler idea? Does anyone have any
   constructive suggestion on how to improve the situation?
  
  This seems to come up every few months.  There was a patch submitted
  here:
  
  http://ozlabs.org/pipermail/linuxppc-dev/2007-June/037641.html
 
 I think this comes up often enough for us to fix it (IIRC unionfs
 people complained about it long ago too), and it's kind of lame to
 spend 17 seconds in the kernel without scheduling.  So I dug up some
 old patches that should reduce the complexity to O(n logn), using the
 sort() function, which IMO is preferable to doing our own hash thing
 as that patch from June does.  Only the 64-bit code is tested.  Does
 this help your situation?
 
  arch/powerpc/kernel/module_32.c |   85 
 +++-
  arch/powerpc/kernel/module_64.c |   80 
 ++---
  2 files changed, 132 insertions(+), 33 deletions(-)
 
 
 diff --git a/arch/powerpc/kernel/module_32.c 
 b/arch/powerpc/kernel/module_32.c
 index 07a89a3..001b941 100644
 --- a/arch/powerpc/kernel/module_32.c
 +++ b/arch/powerpc/kernel/module_32.c
 @@ -24,6 +24,7 @@
  #include linux/kernel.h
  #include linux/cache.h
  #include linux/bug.h
 +#include linux/sort.h
  
  #include setup.h
  
 @@ -50,26 +51,64 @@ void module_free(struct module *mod, void 
 *module_region)
 table entries. */
  }
  
 +static int reloc_cmp(const void *_a, const void *_b)
 +{
 + const Elf32_Rela *a = *(Elf32_Rela **)_a, *b = 
 *(Elf32_Rela **)_b;
 +
 + if (a-r_info  b-r_info)
 + return -1;
 + else if (a-r_info  b-r_info)
 + return 1;
 + else if (a-r_addend  b-r_addend)
 + return -1;
 + else if (a-r_addend  b-r_addend)
 + return 1;
 +
 + return 0;
 +}
 +
 +
  /* Count how many different relocations (different symbol, different
 addend) */
  static unsigned int count_relocs(const Elf32_Rela *rela, 
 unsigned int num)
  {
 - unsigned int i, j, ret = 0;
 + unsigned int i, sorted_count = 0;
 + Elf32_Word last_info;
 + Elf32_Sword last_addend;
 + Elf32_Rela **sortbuf = NULL;
 +
 + if (num == 0)
 + return 0;
 +
 + sortbuf = vmalloc(num * sizeof(*sortbuf));
 +
 + if (!sortbuf)
 + return -ENOMEM;
 +
 + for (i = 0; i  num; i++)
 + sortbuf[i] = (Elf32_Rela *)rela[i];
 +
 + sort(sortbuf, i, sizeof(sortbuf[0]), reloc_cmp, NULL);
 +
 + last_info = sortbuf[0]-r_info;
 + last_addend = sortbuf[0]-r_addend;
 + sorted_count = 1;
  
 - /* Sure, this is order(n^2), but it's usually short, and not
 -   time critical */
   for (i = 0; i  num; i++) {
 - for (j = 0; j  i; j++) {
 - /* If this addend appeared before, it's
 -   already been counted */
 - if (ELF32_R_SYM(rela[i].r_info)
 - == ELF32_R_SYM(rela[j].r_info)
 -  rela[i].r_addend == rela[j].r_addend)
 - break;
 - }
 - if (j == i) ret++;
 + /* If this r_info,r_addend tuple matches the previous
 +  * entry, don't count it again
 +  */
 + if (sortbuf[i]-r_info == last_info 
 + sortbuf[i]-r_addend == last_addend)
 + continue;
 +
 + last_info = sortbuf[i]-r_info;
 + last_addend = sortbuf[i]-r_addend;
 + sorted_count++;
   }
 - return ret;
 +
 + vfree(sortbuf);
 + return sorted_count;
  }
  
  /* Get the potential trampolines size required of the init and
 @@ -96,15 +135,19 @@ static unsigned long get_plt_size(const 
 Elf32_Ehdr *hdr,
   continue;
  
   if (sechdrs[i].sh_type == SHT_RELA) {
 + int count;
   DEBUGP(Found relocations in section %u\n, i);
   DEBUGP(Ptr: %p.  Number: %u\n,
  (void *)hdr + sechdrs[i].sh_offset,
  sechdrs[i].sh_size / sizeof(Elf32_Rela));
 -  

[0/3] Transition to C-style literals (cut the next)

2007-11-06 Thread David Gibson
Here's a new version of my patches to switch us over to dts-v1 and
C-style literals.  This version addresses some of the problems Jon
pointed out with the last version, and adds some polish in the last
patch which enables dts-v1 output for -Odts mode.

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[1/3] dtc: Simplify lexing/parsing of literals vs. node/property names

2007-11-06 Thread David Gibson
The current scheme of having CELLDATA and MEMRESERVE states to
recognize hex literals instead of node or property names is
arse-backwards.  The patch switches things around so that literals are
lexed in normal states, and property/node names are only recognized in
the special PROPNODENAME state, which is only entered after a { or a
;, and is left as soon as we scan a property/node name or a keyword.

Signed-off-by: David Gibson [EMAIL PROTECTED]

---
 dtc-lexer.l  |  105 +++---
 dtc-parser.y |  123 ++-
 2 files changed, 80 insertions(+), 148 deletions(-)

Index: dtc/dtc-lexer.l
===
--- dtc.orig/dtc-lexer.l2007-11-07 10:02:42.0 +1100
+++ dtc/dtc-lexer.l 2007-11-07 11:01:12.0 +1100
@@ -21,9 +21,8 @@
 %option noyywrap nounput yylineno
 
 %x INCLUDE
-%x CELLDATA
 %x BYTESTRING
-%x MEMRESERVE
+%x PROPNODENAME
 
 PROPCHAR   [a-zA-Z0-9,._+*#?-]
 UNITCHAR   [0-9a-f,]
@@ -51,7 +50,7 @@
 
 %%
 
-/include/BEGIN(INCLUDE);
+*/include/ BEGIN(INCLUDE);
 
 INCLUDE\[^\n]*\   {
yytext[strlen(yytext) - 1] = 0;
@@ -63,13 +62,13 @@
}
 
 
-EOF{
+*EOF {
if (!pop_input_file()) {
yyterminate();
}
}
 
-\([^\\]|\\.)*\  {
+*\([^\\]|\\.)*\   {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
DPRINT(String: %s\n, yytext);
@@ -79,45 +78,24 @@
return DT_STRING;
}
 
-/memreserve/ {
+*/memreserve/  {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
DPRINT(Keyword: /memreserve/\n);
-   BEGIN(MEMRESERVE);
-   return DT_MEMRESERVE;
-   }
-
-MEMRESERVE[0-9a-fA-F]+ {
-   yylloc.filenum = srcpos_filenum;
-   yylloc.first_line = yylineno;
-   if (yyleng  2*sizeof(yylval.addr)) {
-   fprintf(stderr, Address value %s too large\n,
-   yytext);
-   }
-   yylval.addr = (u64) strtoull(yytext, NULL, 16);
-   DPRINT(Addr: %llx\n,
-  (unsigned long long)yylval.addr);
-   return DT_ADDR;
-   }
-
-MEMRESERVE;{
-   yylloc.filenum = srcpos_filenum;
-   yylloc.first_line = yylineno;
-   DPRINT(/MEMRESERVE\n);
BEGIN(INITIAL);
-   return ';';
+   return DT_MEMRESERVE;
}
 
 *[a-zA-Z_][a-zA-Z0-9_]*: {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
DPRINT(Label: %s\n, yytext);
-   yylval.str = strdup(yytext);
-   yylval.str[yyleng-1] = '\0';
+   yylval.labelref = strdup(yytext);
+   yylval.labelref[yyleng-1] = '\0';
return DT_LABEL;
}
 
-CELLDATA[bodh]# {
+[bodh]# {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
if (*yytext == 'b')
@@ -132,27 +110,19 @@
return DT_BASE;
}
 
-CELLDATA[0-9a-fA-F]+ {
-   yylloc.filenum = srcpos_filenum;
-   yylloc.first_line = yylineno;
-   yylval.str = strdup(yytext);
-   DPRINT(Cell: '%s'\n, yylval.str);
-   return DT_CELL;
-   }
-
-CELLDATA  {
+[0-9a-fA-F]+   {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
-   DPRINT(/CELLDATA\n);
-   BEGIN(INITIAL);
-   return '';
+   yylval.literal = strdup(yytext);
+   DPRINT(Literal: '%s'\n, yylval.literal);
+   return DT_LITERAL;
}
 
-CELLDATA\{REFCHAR}* {
+\{REFCHAR}*   {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
DPRINT(Ref: %s\n, yytext+1);
-   yylval.str = strdup(yytext+1);
+   yylval.labelref = strdup(yytext+1);
return DT_REF;
}
 
@@ -172,30 +142,13 @@
return ']';
}
 
-,  { /* Technically this is a 

[3/3] dtc: -Odts produces v1 output

2007-11-06 Thread David Gibson
This patch alters the -Odts mode output so that it uses dts-v1 format.
This means that dtc -Idts -Odts used on a v0 dts file will convert
that file to v1.

Signed-off-by: David Gibson [EMAIL PROTECTED]

---
 treesource.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

Index: dtc/treesource.c
===
--- dtc.orig/treesource.c   2007-11-07 11:16:45.0 +1100
+++ dtc/treesource.c2007-11-07 11:16:55.0 +1100
@@ -141,7 +141,7 @@
l = l-next;
}
 
-   fprintf(f, %x, be32_to_cpu(*cp++));
+   fprintf(f, 0x%x, be32_to_cpu(*cp++));
if ((void *)cp = propend)
break;
fprintf(f,  );
@@ -258,12 +258,14 @@
 {
struct reserve_info *re;
 
+   fprintf(f, /dts-v1/;\n\n);
+
for (re = bi-reservelist; re; re = re-next) {
if (re-label)
fprintf(f, %s: , re-label);
-   fprintf(f, /memreserve/\t%016llx-%016llx;\n,
+   fprintf(f, /memreserve/\t0x%016llx 0x%016llx;\n,
(unsigned long long)re-re.address,
-   (unsigned long long)(re-re.address + re-re.size - 1));
+   (unsigned long long)re-re.size);
}
 
write_tree_source_node(f, bi-dt, 0);

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[2/3] dtc: Switch dtc to C-style literals

2007-11-06 Thread David Gibson
dtc: Switch dtc to C-style literals

This patch introduces a new version of dts file, distinguished from
older files by starting with the special token /dts-v1/.  dts files in
the new version take C-style literals instead of the old bare hex or
OF-style base notation.  In addition, the range for of memreserve entries
(/memreserve/ f-f) is no longer recognized in the new format.

Signed-off-by: David Gibson [EMAIL PROTECTED]

---
 dtc-lexer.l   |   40 
 dtc-parser.y  |   38 --
 tests/run_tests.sh|4 
 tests/test_tree1.dts  |   14 --
 tests/test_tree1_dts0.dts |   27 +++
 5 files changed, 107 insertions(+), 16 deletions(-)

Index: dtc/dtc-lexer.l
===
--- dtc.orig/dtc-lexer.l2007-11-07 11:16:47.0 +1100
+++ dtc/dtc-lexer.l 2007-11-07 11:16:51.0 +1100
@@ -23,6 +23,7 @@
 %x INCLUDE
 %x BYTESTRING
 %x PROPNODENAME
+%s V1
 
 PROPCHAR   [a-zA-Z0-9,._+*#?-]
 UNITCHAR   [0-9a-f,]
@@ -44,12 +45,18 @@
 #define DPRINT(fmt, ...)   do { } while (0)
 #endif
 
+static int dts_version; /* = 0 */
 
-
+#define BEGIN_DEFAULT()if (dts_version == 0) { \
+   DPRINT(INITIAL\n); \
+   BEGIN(INITIAL); \
+   } else { \
+   DPRINT(V1\n); \
+   BEGIN(V1); \
+   }
 %}
 
 %%
-
 */include/ BEGIN(INCLUDE);
 
 INCLUDE\[^\n]*\   {
@@ -58,7 +65,7 @@
/* Some unrecoverable error.*/
exit(1);
}
-   BEGIN(INITIAL);
+   BEGIN_DEFAULT();
}
 
 
@@ -78,11 +85,20 @@
return DT_STRING;
}
 
+*/dts-v1/  {
+   yylloc.filenum = srcpos_filenum;
+   yylloc.first_line = yylineno;
+   DPRINT(Keyword: /dts-v1/\n);
+   dts_version = 1;
+   BEGIN_DEFAULT();
+   return DT_V1;
+   }
+
 */memreserve/  {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
DPRINT(Keyword: /memreserve/\n);
-   BEGIN(INITIAL);
+   BEGIN_DEFAULT();
return DT_MEMRESERVE;
}
 
@@ -95,7 +111,7 @@
return DT_LABEL;
}
 
-[bodh]# {
+INITIAL[bodh]# {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
if (*yytext == 'b')
@@ -110,7 +126,15 @@
return DT_BASE;
}
 
-[0-9a-fA-F]+   {
+INITIAL[0-9a-fA-F]+  {
+   yylloc.filenum = srcpos_filenum;
+   yylloc.first_line = yylineno;
+   yylval.literal = strdup(yytext);
+   DPRINT(Literal: '%s'\n, yylval.literal);
+   return DT_LEGACYLITERAL;
+   }
+
+V1[0-9]+|0[xX][0-9a-fA-F]+  {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
yylval.literal = strdup(yytext);
@@ -138,7 +162,7 @@
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
DPRINT(/BYTESTRING\n);
-   BEGIN(INITIAL);
+   BEGIN_DEFAULT();
return ']';
}
 
@@ -147,7 +171,7 @@
yylloc.first_line = yylineno;
DPRINT(PropNodeName: %s\n, yytext);
yylval.propnodename = strdup(yytext);
-   BEGIN(INITIAL);
+   BEGIN_DEFAULT();
return DT_PROPNODENAME;
}
 
Index: dtc/dtc-parser.y
===
--- dtc.orig/dtc-parser.y   2007-11-07 11:16:47.0 +1100
+++ dtc/dtc-parser.y2007-11-07 11:16:51.0 +1100
@@ -48,9 +48,11 @@
struct reserve_info *re;
 }
 
+%token DT_V1
 %token DT_MEMRESERVE
 %token propnodename DT_PROPNODENAME
 %token literal DT_LITERAL
+%token literal DT_LEGACYLITERAL
 %token cbase DT_BASE
 %token byte DT_BYTE
 %token data DT_STRING
@@ -61,6 +63,8 @@
 %type data propdataprefix
 %type re memreserve
 %type re memreserves
+%type re v0_memreserve
+%type re v0_memreserves
 %type addr addr
 %type data celllist
 %type cbase cellbase
@@ -78,7 +82,11 @@
 %%
 
 sourcefile:
- memreserves devicetree
+ DT_V1 ';' memreserves devicetree
+   {
+

libfdt: Add more documentation (path the fifth)

2007-11-06 Thread David Gibson
This patch documents a few more functions in libfdt.h.  All the
read-only functions are now documented.

Signed-off-by: David Gibson [EMAIL PROTECTED]

Index: dtc/libfdt/libfdt.h
===
--- dtc.orig/libfdt/libfdt.h2007-11-06 10:37:44.0 +1100
+++ dtc/libfdt/libfdt.h 2007-11-07 11:52:27.0 +1100
@@ -515,12 +515,107 @@
  */
 int fdt_parent_offset(const void *fdt, int nodeoffset);
 
+/**
+ * fdt_node_offset_by_prop_value - find nodes with a given property value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @propname: property name to check
+ * @propval: property value to search for
+ * @proplen: length of the value in propval
+ *
+ * fdt_node_offset_by_prop_value() returns the offset of the first
+ * node after startoffset, which has a property named propname whose
+ * value is of length proplen and has value equal to propval; or if
+ * startoffset is -1, the very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ * offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
+ *propval, proplen);
+ * while (offset != -FDT_ERR_NOTFOUND) {
+ * // other code here
+ * offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
+ *propval, proplen);
+ * }
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ * structure block offset of the located node (= 0, startoffset),
+ *  on success
+ * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ * tree after startoffset
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
 int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
  const char *propname,
  const void *propval, int proplen);
 
+/**
+ * fdt_node_check_compatible: check a node's compatible property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of a tree node
+ * @compatible: string to match against
+ *
+ *
+ * fdt_node_check_compatible() returns 0 if the given node contains a
+ * 'compatible' property with the given string as one of its elements,
+ * it returns non-zero otherwise, or on error.
+ *
+ * returns:
+ * 0, if the node has a 'compatible' property listing the given string
+ * 1, if the node has a 'compatible' property, but it does not list
+ * the given string
+ * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
+ * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
 int fdt_node_check_compatible(const void *fdt, int nodeoffset,
  const char *compatible);
+
+/**
+ * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @compatible: 'compatible' string to match against
+ *
+ * fdt_node_offset_by_compatible() returns the offset of the first
+ * node after startoffset, which has a 'compatible' property which
+ * lists the given compatible string; or if startoffset is -1, the
+ * very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ * offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
+ * while (offset != -FDT_ERR_NOTFOUND) {
+ * // other code here
+ * offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
+ * }
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ * structure block offset of the located node (= 0, startoffset),
+ *  on success
+ * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ * tree after startoffset
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
  const char *compatible);
 

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank 

Re: [RFC/PATCH] reduce load time for modules with lots of relocs

2007-11-06 Thread Nathan Lynch
Medve Emilian wrote:
 Would it be possible to do the sort in place (without the extra
 buffer)? I mean would that upset any other part of the kernel?

I suspect so.  Sounds like you've got the good testcase, maybe you
should try it and see.  :)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] [PPC 44x] enable L2-cache for ALPR, Katmai, Ocotea, and Taishan

2007-11-06 Thread Olof Johansson
Hi,

See comments below.


-Olof

On Wed, Nov 07, 2007 at 01:40:41AM +0300, Yuri Tikhonov wrote:
  This patch introduces the L2_CACHE configuration option available
 for the ppc44x-based boards with L2-cache enabled.
 
 Signed-off-by: Yuri Tikhonov [EMAIL PROTECTED]
 Signed-off-by: Pavel Kolesnikov [EMAIL PROTECTED]
 
 --
 diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
 index 1d2ca42..ad6b581 100644
 --- a/arch/ppc/platforms/4xx/Kconfig
 +++ b/arch/ppc/platforms/4xx/Kconfig
 @@ -396,4 +396,12 @@ config SERIAL_SICC_CONSOLE
 bool
 depends on SERIAL_SICC  UART0_TTYS1
 default y
 +
 +config L2_CACHE
 +   bool Enable Level-2 Cache
 +   depends on NOT_COHERENT_CACHE  (KATMAI || TAISHAN || OCOTEA || ALPR)
 +   default y
 +   help
 + This option enables L2-cache on ppc44x controllers.
 + If unsure, say Y.

That's a very generic config name. Maybe something like PPC_4XX_L2_CACHE?

Is there ever a case where a user would NOT want l2 cache enabled (and
disabled permanently enough to rebuild the kernel instead of giving a
kernel command line option?)

  endmenu
 diff --git a/arch/ppc/platforms/4xx/alpr.c b/arch/ppc/platforms/4xx/alpr.c
 index 3b6519f..0623801 100644
 --- a/arch/ppc/platforms/4xx/alpr.c
 +++ b/arch/ppc/platforms/4xx/alpr.c
 @@ -537,10 +537,12 @@ static void __init alpr_setup_arch(void)
 printk(Prodrive ALPR port (DENX Software Engineering [EMAIL 
 PROTECTED])\n);
  }
  
 +#ifdef CONFIG_L2_CACHE
  static void __init alpr_init(void)
  {
 ibm440gx_l2c_setup(clocks);
  }
 +#endif
  
  static void alpr_progress(char *buf, unsigned short val)
  {
 @@ -567,7 +569,9 @@ void __init platform_init(unsigned long r3, unsigned long 
 r4,
  #ifdef CONFIG_KGDB
 ppc_md.early_serial_map = alpr_early_serial_map;
  #endif
 +#ifdef CONFIG_L2_CACHE
 ppc_md.init = alpr_init;
 +#endif

Why do you take out the above calls if the new option is selected? Seems
odd to remove something that worked(?) before.

 ppc_md.restart = alpr_restart;
  }
  
 diff --git a/arch/ppc/platforms/4xx/katmai.c b/arch/ppc/platforms/4xx/katmai.c
 index d29ebf6..01f1baf 100644
 --- a/arch/ppc/platforms/4xx/katmai.c
 +++ b/arch/ppc/platforms/4xx/katmai.c
 @@ -219,6 +219,7 @@ katmai_show_cpuinfo(struct seq_file *m)
  {
 seq_printf(m, vendor\t\t: AMCC\n);
 seq_printf(m, machine\t\t: PPC440SPe EVB (Katmai)\n);
 +   ibm440gx_show_cpuinfo(m);

This seems unrelated to this patch.

 return 0;
  }
 @@ -584,6 +585,13 @@ static void katmai_restart(char *cmd)
 mtspr(SPRN_DBCR0, DBCR0_RST_CHIP);
  }
  
 +#ifdef CONFIG_L2_CACHE
 +static void __init katmai_init(void)
 +{
 +   ibm440gx_l2c_setup(clocks);
 +}
 +#endif
 +
  void __init platform_init(unsigned long r3, unsigned long r4,
   unsigned long r5, unsigned long r6, unsigned long 
 r7)
  {
 @@ -599,4 +607,7 @@ void __init platform_init(unsigned long r3, unsigned long 
 r4,
 ppc_md.early_serial_map = katmai_early_serial_map;
  #endif
 ppc_md.restart = katmai_restart;
 +#ifdef CONFIG_L2_CACHE
 +   ppc_md.init = katmai_init;
 +#endif

See comment above. Should the above init be called for all configs, not just
when L2_CACHE is enabled?

Also, it looks like the init function is the same on every board. It would
be better to make a common function instead of duplicating it everywhere.

  }
 diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
 index a7435aa..8b13811 100644
 --- a/arch/ppc/platforms/4xx/ocotea.c
 +++ b/arch/ppc/platforms/4xx/ocotea.c
 @@ -321,10 +321,12 @@ ocotea_setup_arch(void)
 printk(IBM Ocotea port (MontaVista Software, Inc. [EMAIL 
 PROTECTED])\n);
  }
  
 +#ifdef CONFIG_L2_CACHE
  static void __init ocotea_init(void)
  {
 ibm440gx_l2c_setup(clocks);
  }
 +#endif
  
  void __init platform_init(unsigned long r3, unsigned long r4,
 unsigned long r5, unsigned long r6, unsigned long r7)
 @@ -345,5 +347,7 @@ void __init platform_init(unsigned long r3, unsigned long 
 r4,
  #ifdef CONFIG_KGDB
 ppc_md.early_serial_map = ocotea_early_serial_map;
  #endif
 +#ifdef CONFIG_L2_CACHE
 ppc_md.init = ocotea_init;
 +#endif
  }
 diff --git a/arch/ppc/platforms/4xx/taishan.c 
 b/arch/ppc/platforms/4xx/taishan.c
 index f4b9435..8bb6f15 100644
 --- a/arch/ppc/platforms/4xx/taishan.c
 +++ b/arch/ppc/platforms/4xx/taishan.c
 @@ -370,10 +370,12 @@ taishan_setup_arch(void)
 printk(AMCC PowerPC 440GX Taishan Platform\n);
  }
  
 +#ifdef CONFIG_L2_CACHE
  static void __init taishan_init(void)
  {
 ibm440gx_l2c_setup(clocks);
  }
 +#endif
  
  void __init platform_init(unsigned long r3, unsigned long r4,
 unsigned long r5, unsigned long r6, unsigned long r7)
 @@ -389,6 +391,8 @@ void __init platform_init(unsigned long r3, unsigned long 
 r4,
  #ifdef CONFIG_KGDB
 ppc_md.early_serial_map = 

[PATCH 0/2] pasemi_mac: two bugfixes for 2.6.24

2007-11-06 Thread Olof Johansson
Hi Jeff,

Two bugfixes for pasemi_mac for 2.6.24:

[PATCH 1/2] pasemi_mac: Don't set replace-source-address descriptor bits
[PATCH 2/2] pasemi_mac: Fix CRC checks


Thanks,

-Olof

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/2] pasemi_mac: Don't set replace-source-address descriptor bits

2007-11-06 Thread Olof Johansson
Don't use the replace source address with local MAC address bits, since
it causes problems on some variations of the hardware due to an erratum.


Signed-off-by: Olof Johansson [EMAIL PROTECTED]

Index: k.org/drivers/net/pasemi_mac.c
===
--- k.org.orig/drivers/net/pasemi_mac.c
+++ k.org/drivers/net/pasemi_mac.c
@@ -1126,7 +1126,7 @@ static int pasemi_mac_start_tx(struct sk
unsigned long flags;
int i, nfrags;
 
-   dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_SS | XCT_MACTX_CRC_PAD;
+   dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_CRC_PAD;
 
if (skb-ip_summed == CHECKSUM_PARTIAL) {
const unsigned char *nh = skb_network_header(skb);
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/2] pasemi_mac: Fix CRC checks

2007-11-06 Thread Olof Johansson
Make sure we don't feed packets with bad CRC up the network stack,
and discount the packet length as reported from the MAC for the CRC
field.


Signed-off-by: Olof Johansson [EMAIL PROTECTED]

Index: k.org/drivers/net/pasemi_mac.c
===
--- k.org.orig/drivers/net/pasemi_mac.c
+++ k.org/drivers/net/pasemi_mac.c
@@ -580,6 +580,16 @@ static int pasemi_mac_clean_rx(struct pa
 
len = (macrx  XCT_MACRX_LLEN_M)  XCT_MACRX_LLEN_S;
 
+   pci_unmap_single(mac-dma_pdev, dma, len, PCI_DMA_FROMDEVICE);
+
+   if (macrx  XCT_MACRX_CRC) {
+   /* CRC error flagged */
+   mac-netdev-stats.rx_errors++;
+   mac-netdev-stats.rx_crc_errors++;
+   dev_kfree_skb_irq(skb);
+   goto next;
+   }
+
if (len  256) {
struct sk_buff *new_skb;
 
@@ -595,11 +605,10 @@ static int pasemi_mac_clean_rx(struct pa
} else
info-skb = NULL;
 
-   pci_unmap_single(mac-dma_pdev, dma, len, PCI_DMA_FROMDEVICE);
-
info-dma = 0;
 
-   skb_put(skb, len);
+   /* Don't include CRC */
+   skb_put(skb, len-4);
 
if (likely((macrx  XCT_MACRX_HTY_M) == XCT_MACRX_HTY_IPV4_OK)) 
{
skb-ip_summed = CHECKSUM_UNNECESSARY;
@@ -614,6 +623,7 @@ static int pasemi_mac_clean_rx(struct pa
skb-protocol = eth_type_trans(skb, mac-netdev);
netif_receive_skb(skb);
 
+next:
RX_RING(mac, n) = 0;
RX_RING(mac, n+1) = 0;
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: problem in follow_hugetlb_page on ppc64 architecture with get_user_pages

2007-11-06 Thread David Gibson
On Tue, Nov 06, 2007 at 04:06:04PM +0100, Hoang-Nam Nguyen wrote:
 Hello Roland!
  We currently see this when testing Infiniband on ppc64 with ehca +
  hugetlbfs.
  From reading the code this should also be an issue on other architectures.
  Roland, Adam, are you aware of anything in this area with mellanox
  Infiniband cards or other usages with I/O adapters?
 Below is a testcase demonstrating this problem. You need to install
 libhugetlbfs.so and run it as below:
 HUGETLB_MORECORE=yes LD_PRELOAD=libhugetlbfs.so ./hugetlb_ibtest 100
 
 This testcase does the following steps (high level desc):
 1. malloc two buffers each of 100MB for send and recv
 2. register them as memory regions
 3. create queue pair QP
 4. send data in send buffer using QP to itself (target is then recv buffer)
 5. compare those buffers content
 
 It runs fine without libhugetlbsf. If you call it with libhugetlbfs as
 above, step 5 will fail. If you do memset() of the buffers before step 2
 (register mr), then it runs without errors.
 It appears that hugetlb_cow() is called when first write access is performed
 after mrs have been registered. That means the testcase is seeing other pages
 than the ones registered to the adapter...
 
 I was able reproduce this with mthca on 2.6.23/ppc64 and fc6/intel.

We should cut this down to the bare necessary and fold it into the
libhugetlbfs testsuite.

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] [PPC 4xx] invalidate_l2cache_range() implementation for ppc44x

2007-11-06 Thread Olof Johansson
Hi,

Some comments below. In general this patch adds #ifdefs in common code,
that's normally frowned upon.

It would maybe be better to add a new call to ppc_machdeps and call it
if set.


-Olof


On Wed, Nov 07, 2007 at 01:40:28AM +0300, Yuri Tikhonov wrote:
  Support for L2-cache coherency synchronization routines in ppc44x
 processors.
 
 
 Signed-off-by: Yuri Tikhonov [EMAIL PROTECTED]
 Signed-off-by: Pavel Kolesnikov [EMAIL PROTECTED]
 
 --
 diff --git a/arch/powerpc/lib/dma-noncoherent.c 
 b/arch/powerpc/lib/dma-noncoherent.c
 index 1947380..593a425 100644
 --- a/arch/powerpc/lib/dma-noncoherent.c
 +++ b/arch/powerpc/lib/dma-noncoherent.c
 @@ -351,12 +351,18 @@ void __dma_sync(void *vaddr, size_t size, int direction)
 BUG();
 case DMA_FROM_DEVICE:   /* invalidate only */
 invalidate_dcache_range(start, end);
 +#ifdef CONFIG_L2_CACHE
 +   invalidate_l2cache_range(__pa(start), __pa(end));
 +#endif
 break;
 case DMA_TO_DEVICE: /* writeback only */
 clean_dcache_range(start, end);
 break;
 case DMA_BIDIRECTIONAL: /* writeback and invalidate */
 flush_dcache_range(start, end);
 +#ifdef CONFIG_L2_CACHE
 +   invalidate_l2cache_range(__pa(start), __pa(end));
 +#endif
 break;
 }
  }
 diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
 index 46cf8fa..de62f85 100644
 --- a/arch/ppc/kernel/misc.S
 +++ b/arch/ppc/kernel/misc.S
 @@ -386,6 +386,36 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
 sync/* additional sync needed on g4 */
 isync
 blr
 +
 +#ifdef CONFIG_L2_CACHE
 +/*
 + * Invalidate the Level-2 cache lines corresponded to the address
 + * range.
 + *
 + * invalidate_l2cache_range(unsigned long start, unsigned long stop)
 + */
 +#include asm/ibm4xx.h

PLease don't add includes to the middle of a file.

 +_GLOBAL(invalidate_l2cache_range)
 +   li  r5,L2_CACHE_BYTES-1 /* do l2-cache line alignment */
 +   andcr3,r3,r5
 +   subfr4,r3,r4
 +   add r4,r4,r5
 +   srwi.   r4,r4,L2_CACHE_SHIFT
 +   mtctr   r4
 +
 +   lis r4, L2C_CMD_INV16
 +1: mtdcr   DCRN_L2C0_ADDR,r3   /* write address to invalidate */
 +   mtdcr   DCRN_L2C0_CMD,r4/* issue the Invalidate cmd */
 +
 +2: mfdcr   r5,DCRN_L2C0_SR /* wait for complete */
 +   andis.  r5,r5,L2C_CMD_CLR16
 +beq2b
 +
 +   addir3,r3,L2_CACHE_BYTES/* next address to invalidate */
 +   bdnz1b
 +   blr
 +#endif

The whole function above has bad whitespace (spaces instead of tabs)

 +
  /*
   * Write any modified data cache blocks out to memory.
   * Does not invalidate the corresponding cache lines (especially for
 diff --git a/include/asm-powerpc/cache.h b/include/asm-powerpc/cache.h
 index 5350704..8a2f9e6 100644
 --- a/include/asm-powerpc/cache.h
 +++ b/include/asm-powerpc/cache.h
 @@ -10,12 +10,14 @@
  #define MAX_COPY_PREFETCH  1
  #elif defined(CONFIG_PPC32)
  #define L1_CACHE_SHIFT 5
 +#define L2_CACHE_SHIFT 5
  #define MAX_COPY_PREFETCH  4
  #else /* CONFIG_PPC64 */
  #define L1_CACHE_SHIFT 7
  #endif
  
  #defineL1_CACHE_BYTES  (1  L1_CACHE_SHIFT)
 +#defineL2_CACHE_BYTES  (1  L2_CACHE_SHIFT)

The above looks highly system dependent to me. Should maybe be a part
of the cache info structures instead, and filled in from the device tree?


  
  #defineSMP_CACHE_BYTES L1_CACHE_BYTES
  
 diff --git a/include/asm-powerpc/cacheflush.h 
 b/include/asm-powerpc/cacheflush.h
 index ba667a3..bdebfaa 100644
 --- a/include/asm-powerpc/cacheflush.h
 +++ b/include/asm-powerpc/cacheflush.h
 @@ -49,6 +49,7 @@ extern void flush_dcache_range(unsigned long start, 
 unsigned long stop);
  #ifdef CONFIG_PPC32
  extern void clean_dcache_range(unsigned long start, unsigned long stop);
  extern void invalidate_dcache_range(unsigned long start, unsigned long stop);
 +extern void invalidate_l2cache_range(unsigned long start, unsigned long 
 stop);
  #endif /* CONFIG_PPC32 */
  #ifdef CONFIG_PPC64
  extern void flush_inval_dcache_range(unsigned long start, unsigned long 
 stop);
 diff --git a/include/asm-ppc/ibm44x.h b/include/asm-ppc/ibm44x.h
 index 8078a58..782909a 100644
 --- a/include/asm-ppc/ibm44x.h
 +++ b/include/asm-ppc/ibm44x.h
 @@ -138,7 +138,6 @@
   * The residual board information structure the boot loader passes
   * into the kernel.
   */
 -#ifndef __ASSEMBLY__
  
  /*
   * DCRN definitions
 @@ -814,6 +813,5 @@
  
  #include asm/ibm4xx.h
  
 -#endif /* __ASSEMBLY__ */
  #endif /* __ASM_IBM44x_H__ */
  #endif /* __KERNEL__ */ 
 
 ___
 Linuxppc-dev mailing list
 Linuxppc-dev@ozlabs.org
 https://ozlabs.org/mailman/listinfo/linuxppc-dev
___
Linuxppc-dev 

[PATCH] [POWERPC] Remove sysctl warning about writable directory

2007-11-06 Thread Olof Johansson
Getting this when booting 2.6.24-rc2:

sysctl table check failed: /kernel .1 Writable sysctl directory
Call Trace:
[c2047b60] [c000e204] .show_stack+0x54/0x1f0 (unreliable)
[c2047c10] [c006ea50] .set_fail+0x60/0x90
[c2047ca0] [c006ef64] .sysctl_check_table+0x4e4/0x730
[c2047d80] [c0055860] .register_sysctl_table+0x80/0x120
[c2047e20] [c05de924] .register_powersave_nap_sysctl+0x14/0x30
[c2047e90] [c05d58c8] .kernel_init+0x1f8/0x450
[c2047f90] [c0023bac] .kernel_thread+0x4c/0x68


Signed-off-by: Olof Johansson [EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index abd2957..c3cf0e8 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -122,7 +122,7 @@ static ctl_table powersave_nap_sysctl_root[] = {
{
.ctl_name   = CTL_KERN,
.procname   = kernel,
-   .mode   = 0755,
+   .mode   = 0555,
.child  = powersave_nap_ctl_table,
},
{}
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] Stop the TOC overflowing for large builds.

2007-11-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell [EMAIL PROTECTED]
---
 arch/powerpc/kernel/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

With this patch and my patch Fix link errors for allyesconfig, the
allyesconfig will build again.

I am not sure of the performance effects (if any) of this patch.
-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index ca51f0c..9374bc9 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -3,7 +3,7 @@
 #
 
 ifeq ($(CONFIG_PPC64),y)
-EXTRA_CFLAGS   += -mno-minimal-toc
+CFLAGS_prom_init.o += -mno-minimal-toc
 endif
 ifeq ($(CONFIG_PPC32),y)
 CFLAGS_prom_init.o  += -fPIC
-- 
1.5.3.5

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [2.6.24] [POWERPC] pasemi: Update defconfig

2007-11-06 Thread Olof Johansson
Update pasemi_defconfig. Add a few missing options for default devices
on electra boards, enable tickless and hrtimers, etc, etc.


Signed-off-by: Olof Johansson [EMAIL PROTECTED]

diff --git a/arch/powerpc/configs/pasemi_defconfig 
b/arch/powerpc/configs/pasemi_defconfig
index 1ccf3ed..78c968a 100644
--- a/arch/powerpc/configs/pasemi_defconfig
+++ b/arch/powerpc/configs/pasemi_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.23-rc4
-# Thu Aug 30 16:40:47 2007
+# Linux kernel version: 2.6.24-rc2
+# Tue Nov  6 23:23:50 2007
 #
 CONFIG_PPC64=y
 
@@ -10,6 +10,7 @@ CONFIG_PPC64=y
 #
 CONFIG_POWER4_ONLY=y
 CONFIG_POWER4=y
+# CONFIG_TUNE_CELL is not set
 CONFIG_PPC_FPU=y
 CONFIG_ALTIVEC=y
 CONFIG_PPC_STD_MMU=y
@@ -18,8 +19,13 @@ CONFIG_PPC_MM_SLICES=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=2
 CONFIG_64BIT=y
+CONFIG_WORD_SIZE=64
 CONFIG_PPC_MERGE=y
 CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_IRQ_PER_CPU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -65,7 +71,10 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=17
-# CONFIG_CPUSETS is not set
+# CONFIG_CGROUPS is not set
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
+# CONFIG_FAIR_CGROUP_SCHED is not set
 CONFIG_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
 CONFIG_BLK_DEV_INITRD=y
@@ -86,7 +95,6 @@ CONFIG_FUTEX=y
 CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
-CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_VM_EVENT_COUNTERS=y
@@ -107,14 +115,15 @@ CONFIG_STOP_MACHINE=y
 CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_BLK_DEV_BSG is not set
+CONFIG_BLOCK_COMPAT=y
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
@@ -125,7 +134,6 @@ CONFIG_DEFAULT_IOSCHED=anticipatory
 # Platform support
 #
 CONFIG_PPC_MULTIPLATFORM=y
-# CONFIG_EMBEDDED6xx is not set
 # CONFIG_PPC_82xx is not set
 # CONFIG_PPC_83xx is not set
 # CONFIG_PPC_86xx is not set
@@ -141,6 +149,7 @@ CONFIG_PPC_PASEMI=y
 # PA Semi PWRficient options
 #
 CONFIG_PPC_PASEMI_IOMMU=y
+# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set
 CONFIG_PPC_PASEMI_MDIO=y
 CONFIG_ELECTRA_IDE=y
 # CONFIG_PPC_CELLEB is not set
@@ -156,29 +165,52 @@ CONFIG_MPIC=y
 # CONFIG_U3_DART is not set
 # CONFIG_PPC_RTAS is not set
 # CONFIG_MMIO_NVRAM is not set
+CONFIG_MPIC_BROKEN_REGREAD=y
 # CONFIG_PPC_MPC106 is not set
 # CONFIG_PPC_970_NAP is not set
 # CONFIG_PPC_INDIRECT_IO is not set
 # CONFIG_GENERIC_IOMAP is not set
-# CONFIG_CPU_FREQ is not set
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_FREQ_DEBUG=y
+CONFIG_CPU_FREQ_STAT=y
+# CONFIG_CPU_FREQ_STAT_DETAILS is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
+
+#
+# CPU Frequency drivers
+#
+CONFIG_PPC_PASEMI_CPUFREQ=y
 # CONFIG_CPM2 is not set
 # CONFIG_FSL_ULI1575 is not set
 
 #
 # Kernel options
 #
-CONFIG_HZ_100=y
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_300 is not set
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=100
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
-CONFIG_PREEMPT_BKL=y
+# CONFIG_PREEMPT_BKL is not set
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
-CONFIG_FORCE_MAX_ZONEORDER=13
+CONFIG_FORCE_MAX_ZONEORDER=9
 CONFIG_IOMMU_VMERGE=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 # CONFIG_KEXEC is not set
@@ -196,12 +228,13 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_RESOURCES_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
-# CONFIG_PPC_HAS_HASH_64K is not set
-# CONFIG_PPC_64K_PAGES is not set
+CONFIG_PPC_HAS_HASH_64K=y
+CONFIG_PPC_64K_PAGES=y
 # CONFIG_SCHED_SMT is not set
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -222,11 +255,8 @@ CONFIG_PCI_SYSCALL=y
 # CONFIG_PCIEPORTBUS is not set
 CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_MSI is not set
+CONFIG_PCI_LEGACY=y
 # CONFIG_PCI_DEBUG is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
 CONFIG_PCCARD=y
 CONFIG_PCMCIA_DEBUG=y
 CONFIG_PCMCIA=y
@@ -240,6 +270,7 @@ CONFIG_CARDBUS=y
 # CONFIG_YENTA is not set
 # CONFIG_PD6729 is not