[PATCH 07/25] spufs: remove asmlinkage from spufs_calls

2007-09-13 Thread Jeremy Kerr
spu_create and spu_run are wrapped by the cell syscall layer, so
we don't need the asmlinkage.

Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 include/asm-powerpc/spu.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 383ecfd..eb1159c 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -239,10 +239,10 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
 /* syscalls implemented in spufs */
 struct file;
 struct spufs_calls {
-   asmlinkage long (*create_thread)(const char __user *name,
+   long (*create_thread)(const char __user *name,
unsigned int flags, mode_t mode,
struct file *neighbor);
-   asmlinkage long (*spu_run)(struct file *filp, __u32 __user *unpc,
+   long (*spu_run)(struct file *filp, __u32 __user *unpc,
__u32 __user *ustatus);
struct module *owner;
 };
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 01/25] spufs: staticify file-internal functions & variables

2007-09-13 Thread Jeremy Kerr
From: Sebastian Siewior <[EMAIL PROTECTED]>

There are a few symbols used only in one file within spufs; this change
makes them static where suitable.

Signed-off-by: Sebastian Siewior <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spu_base.c   |2 +-
 arch/powerpc/platforms/cell/spu_callbacks.c  |2 +-
 arch/powerpc/platforms/cell/spufs/file.c |6 +++---
 arch/powerpc/platforms/cell/spufs/run.c  |4 ++--
 arch/powerpc/platforms/cell/spufs/syscalls.c |4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spu_base.c 
b/arch/powerpc/platforms/cell/spu_base.c
index 106d292..b5a2117 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -458,7 +458,7 @@ static int spu_shutdown(struct sys_device *sysdev)
return 0;
 }
 
-struct sysdev_class spu_sysdev_class = {
+static struct sysdev_class spu_sysdev_class = {
set_kset_name("spu"),
.shutdown = spu_shutdown,
 };
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c 
b/arch/powerpc/platforms/cell/spu_callbacks.c
index 47ec3be..ab39e22 100644
--- a/arch/powerpc/platforms/cell/spu_callbacks.c
+++ b/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -33,7 +33,7 @@
  * mbind, mq_open, ipc, ...
  */
 
-void *spu_syscall_table[] = {
+static void *spu_syscall_table[] = {
 #define SYSCALL(func)  sys_ni_syscall,
 #define COMPAT_SYS(func)   sys_ni_syscall,
 #define PPC_SYS(func)  sys_ni_syscall,
diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
b/arch/powerpc/platforms/cell/spufs/file.c
index 4100ddc..a4a8770 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -199,9 +199,9 @@ static int spufs_mem_mmap(struct file *file, struct 
vm_area_struct *vma)
 }
 
 #ifdef CONFIG_SPU_FS_64K_LS
-unsigned long spufs_get_unmapped_area(struct file *file, unsigned long addr,
- unsigned long len, unsigned long pgoff,
- unsigned long flags)
+static unsigned long spufs_get_unmapped_area(struct file *file,
+   unsigned long addr, unsigned long len, unsigned long pgoff,
+   unsigned long flags)
 {
struct spu_context  *ctx = file->private_data;
struct spu_state*csa = &ctx->csa;
diff --git a/arch/powerpc/platforms/cell/spufs/run.c 
b/arch/powerpc/platforms/cell/spufs/run.c
index 958f10e..1ce5e22 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -205,7 +205,7 @@ static int spu_reacquire_runnable(struct spu_context *ctx, 
u32 *npc,
  * This means we can only do a very rough approximation of POSIX
  * signal semantics.
  */
-int spu_handle_restartsys(struct spu_context *ctx, long *spu_ret,
+static int spu_handle_restartsys(struct spu_context *ctx, long *spu_ret,
  unsigned int *npc)
 {
int ret;
@@ -241,7 +241,7 @@ int spu_handle_restartsys(struct spu_context *ctx, long 
*spu_ret,
return ret;
 }
 
-int spu_process_callback(struct spu_context *ctx)
+static int spu_process_callback(struct spu_context *ctx)
 {
struct spu_syscall_block s;
u32 ls_pointer, npc;
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c 
b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 43f0fb8..3d8c328 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -76,8 +76,8 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 
__user *ustatus)
 }
 #endif
 
-asmlinkage long do_spu_create(const char __user *pathname, unsigned int flags,
-   mode_t mode, struct file *neighbor)
+static asmlinkage long do_spu_create(const char __user *pathname,
+   unsigned int flags, mode_t mode, struct file *neighbor)
 {
char *tmp;
int ret;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 17/25] spufs: Don't return -ENOSYS as extra notes size if spufs is not loaded

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

Because the SPU coredump code might be built as part of a module (spufs),
we have a stub which is called by the coredump code, this routine then calls
into spufs if it's loaded.

Unfortunately the stub returns -ENOSYS if spufs is not loaded, which is
interpreted by the coredump code as an extra note size of -38 bytes. This
leads to a corrupt core dump.

If spufs is not loaded there will be no SPU ELF notes to write, and so the
extra notes size will be == 0.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>
Acked-by: Arnd Bergmann <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spu_coredump.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spu_coredump.c 
b/arch/powerpc/platforms/cell/spu_coredump.c
index 4fd37ff..656a8c5 100644
--- a/arch/powerpc/platforms/cell/spu_coredump.c
+++ b/arch/powerpc/platforms/cell/spu_coredump.c
@@ -31,15 +31,19 @@ static DEFINE_MUTEX(spu_coredump_mutex);
 
 int arch_notes_size(void)
 {
-   long ret;
+   int ret;
 
-   ret = -ENOSYS;
mutex_lock(&spu_coredump_mutex);
+
if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
ret = spu_coredump_calls->arch_notes_size();
module_put(spu_coredump_calls->owner);
+   } else {
+   ret = 0;
}
+
mutex_unlock(&spu_coredump_mutex);
+
return ret;
 }
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 24/25] spufs: Respect RLIMIT_CORE in spu coredump code

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

Currently the spu coredump code doesn't respect the ulimit, it should.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/coredump.c |4 
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c 
b/arch/powerpc/platforms/cell/spufs/coredump.c
index 6b8aef6..80f6236 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -53,8 +53,12 @@ static ssize_t do_coredump_read(int num, struct spu_context 
*ctx, void *buffer,
  */
 static int spufs_dump_write(struct file *file, const void *addr, int nr, 
loff_t *foffset)
 {
+   unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
ssize_t written;
 
+   if (*foffset + nr > limit)
+   return -EIO;
+
written = file->f_op->write(file, addr, nr, &file->f_pos);
*foffset += written;
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 05/25] spufs: fix race condition on gang->aff_ref_spu

2007-09-13 Thread Jeremy Kerr
From: Andre Detsch <[EMAIL PROTECTED]>

Affinity reference point location (gang->aff_ref_spu) is reset
when the whole gang is descheduled. However, the last member of
a gang can be descheduled while we are trying to schedule another
member of the gang. This was leading to a race condition, and
the code was using gang->aff_ref_spu in an unsafe manner.

By holding the gang->aff_mutex a little bit longer, and increment
gang->aff_sched_count (which controls when gang->aff_ref_spu
should be reset) a little bit earlier, the problem is fixed.

Signed-off-by: Andre Detsch <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/sched.c |   49 +++---
 1 file changed, 32 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/sched.c 
b/arch/powerpc/platforms/cell/spufs/sched.c
index c784edd..17806e0 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -230,8 +230,6 @@ static void spu_bind_context(struct spu *spu, struct 
spu_context *ctx)
 
if (ctx->flags & SPU_CREATE_NOSCHED)
atomic_inc(&cbe_spu_info[spu->node].reserved_spus);
-   if (!list_empty(&ctx->aff_list))
-   atomic_inc(&ctx->gang->aff_sched_count);
 
ctx->stats.slb_flt_base = spu->stats.slb_flt;
ctx->stats.class2_intr_base = spu->stats.class2_intr;
@@ -392,7 +390,6 @@ static int has_affinity(struct spu_context *ctx)
if (list_empty(&ctx->aff_list))
return 0;
 
-   mutex_lock(&gang->aff_mutex);
if (!gang->aff_ref_spu) {
if (!(gang->aff_flags & AFF_MERGED))
aff_merge_remaining_ctxs(gang);
@@ -400,7 +397,6 @@ static int has_affinity(struct spu_context *ctx)
aff_set_offsets(gang);
aff_set_ref_point_location(gang);
}
-   mutex_unlock(&gang->aff_mutex);
 
return gang->aff_ref_spu != NULL;
 }
@@ -418,9 +414,16 @@ static void spu_unbind_context(struct spu *spu, struct 
spu_context *ctx)
 
if (spu->ctx->flags & SPU_CREATE_NOSCHED)
atomic_dec(&cbe_spu_info[spu->node].reserved_spus);
-   if (!list_empty(&ctx->aff_list))
-   if (atomic_dec_and_test(&ctx->gang->aff_sched_count))
-   ctx->gang->aff_ref_spu = NULL;
+
+   if (ctx->gang){
+   mutex_lock(&ctx->gang->aff_mutex);
+   if (has_affinity(ctx)) {
+   if (atomic_dec_and_test(&ctx->gang->aff_sched_count))
+   ctx->gang->aff_ref_spu = NULL;
+   }
+   mutex_unlock(&ctx->gang->aff_mutex);
+   }
+
spu_switch_notify(spu, NULL);
spu_unmap_mappings(ctx);
spu_save(&ctx->csa, spu);
@@ -511,20 +514,32 @@ static void spu_prio_wait(struct spu_context *ctx)
 
 static struct spu *spu_get_idle(struct spu_context *ctx)
 {
-   struct spu *spu;
+   struct spu *spu, *aff_ref_spu;
int node, n;
 
-   if (has_affinity(ctx)) {
-   node = ctx->gang->aff_ref_spu->node;
+   if (ctx->gang) {
+   mutex_lock(&ctx->gang->aff_mutex);
+   if (has_affinity(ctx)) {
+   aff_ref_spu = ctx->gang->aff_ref_spu;
+   atomic_inc(&ctx->gang->aff_sched_count);
+   mutex_unlock(&ctx->gang->aff_mutex);
+   node = aff_ref_spu->node;
 
-   mutex_lock(&cbe_spu_info[node].list_mutex);
-   spu = ctx_location(ctx->gang->aff_ref_spu, ctx->aff_offset, 
node);
-   if (spu && spu->alloc_state == SPU_FREE)
-   goto found;
-   mutex_unlock(&cbe_spu_info[node].list_mutex);
-   return NULL;
-   }
+   mutex_lock(&cbe_spu_info[node].list_mutex);
+   spu = ctx_location(aff_ref_spu, ctx->aff_offset, node);
+   if (spu && spu->alloc_state == SPU_FREE)
+   goto found;
+   mutex_unlock(&cbe_spu_info[node].list_mutex);
 
+   mutex_lock(&ctx->gang->aff_mutex);
+   if (atomic_dec_and_test(&ctx->gang->aff_sched_count))
+   ctx->gang->aff_ref_spu = NULL;
+   mutex_unlock(&ctx->gang->aff_mutex);
+
+   return NULL;
+   }
+   mutex_unlock(&ctx->gang->aff_mutex);
+   }
node = cpu_to_node(raw_smp_processor_id());
for (n = 0; n < MAX_NUMNODES; n++, node++) {
node = (node < MAX_NUMNODES) ? node : 0;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 15/25] spufs: Write some SPU coredump values as ASCII

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

Unfortunately GDB expects some of the SPU coredump values to be identical
in format to what is found in spufs. This means we need to dump some of
the values as ASCII strings, not the actual values.

Because we don't know what the values will be, we always print the values
with the format "0x%.16lx", that way we know the result will be 19 bytes.

do_coredump_read() doesn't take a __user buffer, so remove the annotation,
and because we know that it's safe to just snprintf() directly to it.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/coredump.c |8 +---
 arch/powerpc/platforms/cell/spufs/file.c |   14 +++---
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c 
b/arch/powerpc/platforms/cell/spufs/coredump.c
index 21283f6..c65b717 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -31,7 +31,7 @@
 
 #include "spufs.h"
 
-static ssize_t do_coredump_read(int num, struct spu_context *ctx, void __user 
*buffer,
+static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
size_t size, loff_t *off)
 {
u64 data;
@@ -41,8 +41,10 @@ static ssize_t do_coredump_read(int num, struct spu_context 
*ctx, void __user *b
return spufs_coredump_read[num].read(ctx, buffer, size, off);
 
data = spufs_coredump_read[num].get(ctx);
-   ret = copy_to_user(buffer, &data, 8);
-   return ret ? -EFAULT : 8;
+   ret = snprintf(buffer, size, "0x%.16lx", data);
+   if (ret >= size)
+   return size;
+   return ++ret; /* count trailing NULL */
 }
 
 /*
diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
b/arch/powerpc/platforms/cell/spufs/file.c
index 18ddde8..85edbec 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -2233,16 +2233,16 @@ struct tree_descr spufs_dir_nosched_contents[] = {
 struct spufs_coredump_reader spufs_coredump_read[] = {
{ "regs", __spufs_regs_read, NULL, sizeof(struct spu_reg128[128])},
{ "fpcr", __spufs_fpcr_read, NULL, sizeof(struct spu_reg128) },
-   { "lslr", NULL, __spufs_lslr_get, 11 },
-   { "decr", NULL, __spufs_decr_get, 11 },
-   { "decr_status", NULL, __spufs_decr_status_get, 11 },
+   { "lslr", NULL, __spufs_lslr_get, 19 },
+   { "decr", NULL, __spufs_decr_get, 19 },
+   { "decr_status", NULL, __spufs_decr_status_get, 19 },
{ "mem", __spufs_mem_read, NULL, LS_SIZE, },
{ "signal1", __spufs_signal1_read, NULL, sizeof(u32) },
-   { "signal1_type", NULL, __spufs_signal1_type_get, 2 },
+   { "signal1_type", NULL, __spufs_signal1_type_get, 19 },
{ "signal2", __spufs_signal2_read, NULL, sizeof(u32) },
-   { "signal2_type", NULL, __spufs_signal2_type_get, 2 },
-   { "event_mask", NULL, __spufs_event_mask_get, 8 },
-   { "event_status", NULL, __spufs_event_status_get, 8 },
+   { "signal2_type", NULL, __spufs_signal2_type_get, 19 },
+   { "event_mask", NULL, __spufs_event_mask_get, 19 },
+   { "event_status", NULL, __spufs_event_status_get, 19 },
{ "mbox_info", __spufs_mbox_info_read, NULL, sizeof(u32) },
{ "ibox_info", __spufs_ibox_info_read, NULL, sizeof(u32) },
{ "wbox_info", __spufs_wbox_info_read, NULL, 4 * sizeof(u32)},
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 03/25] spufs: remove spu_harvest

2007-09-13 Thread Jeremy Kerr
Based on an initial patch from Sebastian Siewior
<[EMAIL PROTECTED]>

spu_harvest isn't used, remove it.

Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/switch.c |   13 -
 1 file changed, 13 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/switch.c 
b/arch/powerpc/platforms/cell/spufs/switch.c
index 27ffdae..2506619 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -2146,19 +2146,6 @@ int spu_restore(struct spu_state *new, struct spu *spu)
 }
 EXPORT_SYMBOL_GPL(spu_restore);
 
-/**
- * spu_harvest - SPU harvest (reset) operation
- * @spu: pointer to SPU iomem structure.
- *
- * Perform SPU harvest (reset) operation.
- */
-void spu_harvest(struct spu *spu)
-{
-   acquire_spu_lock(spu);
-   harvest(NULL, spu);
-   release_spu_lock(spu);
-}
-
 static void init_prob(struct spu_state *csa)
 {
csa->spu_chnlcnt_RW[9] = 1;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 11/25] spufs: Extract the file descriptor search logic in SPU coredump code

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

Extract the logic for searching through the file descriptors for spu contexts
into a separate routine, coredump_next_context(), so we can use it elsewhere
in future. In the process we flatten the for loop, and move the NOSCHED test
into coredump_next_context().

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/coredump.c |   58 +--
 1 file changed, 38 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c 
b/arch/powerpc/platforms/cell/spufs/coredump.c
index 5e31799..99f8e0b 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -109,16 +109,11 @@ static int spufs_ctx_note_size(struct spufs_ctx_info 
*ctx_info)
return total;
 }
 
-static int spufs_add_one_context(struct file *file, int dfd)
+static int spufs_add_one_context(struct spu_context *ctx, int dfd)
 {
-   struct spu_context *ctx;
struct spufs_ctx_info *ctx_info;
int size;
 
-   ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx;
-   if (ctx->flags & SPU_CREATE_NOSCHED)
-   return 0;
-
ctx_info = kzalloc(sizeof(*ctx_info), GFP_KERNEL);
if (unlikely(!ctx_info))
return -ENOMEM;
@@ -142,22 +137,45 @@ static int spufs_add_one_context(struct file *file, int 
dfd)
  * internal functionality to dump them without needing to actually
  * open the files.
  */
-static int spufs_arch_notes_size(void)
+static struct spu_context *coredump_next_context(int *fd)
 {
struct fdtable *fdt = files_fdtable(current->files);
-   int size = 0, fd;
-
-   for (fd = 0; fd < fdt->max_fds; fd++) {
-   if (FD_ISSET(fd, fdt->open_fds)) {
-   struct file *file = fcheck(fd);
-
-   if (file && file->f_op == &spufs_context_fops) {
-   int rval = spufs_add_one_context(file, fd);
-   if (rval < 0)
-   break;
-   size += rval;
-   }
-   }
+   struct file *file;
+   struct spu_context *ctx = NULL;
+
+   for (; *fd < fdt->max_fds; (*fd)++) {
+   if (!FD_ISSET(*fd, fdt->open_fds))
+   continue;
+
+   file = fcheck(*fd);
+
+   if (!file || file->f_op != &spufs_context_fops)
+   continue;
+
+   ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx;
+   if (ctx->flags & SPU_CREATE_NOSCHED)
+   continue;
+
+   /* start searching the next fd next time we're called */
+   (*fd)++;
+   break;
+   }
+
+   return ctx;
+}
+
+static int spufs_arch_notes_size(void)
+{
+   struct spu_context *ctx;
+   int size = 0, rc, fd;
+
+   fd = 0;
+   while ((ctx = coredump_next_context(&fd)) != NULL) {
+   rc = spufs_add_one_context(ctx, fd);
+   if (rc < 0)
+   break;
+
+   size += rc;
}
 
return size;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 22/25] spufs: Cleanup ELF coredump extra notes logic

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

To start with, arch_notes_size() etc. is a little too ambiguous a name for
my liking, so change the function names to be more explicit.

Calling through macros is ugly, especially with hidden parameters, so don't
do that, call the routines directly.

Use ARCH_HAVE_EXTRA_ELF_NOTES as the only flag, and based on it decide
whether we want the extern declarations or the empty versions.

Since we have empty routines, actually use them in the coredump code to
save a few #ifdefs.

We want to change the handling of foffset so that the write routine updates
foffset as it goes, instead of using file->f_pos (so that writing to a pipe
works). So pass foffset to the write routine, and for now just set it to
file->f_pos at the end of writing.

It should also be possible for the write routine to fail, so change it to
return int and treat a non-zero return as failure.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spu_syscalls.c |   12 +---
 fs/binfmt_elf.c|   14 +++---
 include/asm-powerpc/elf.h  |9 ++---
 include/linux/elf.h|   14 --
 4 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c 
b/arch/powerpc/platforms/cell/spu_syscalls.c
index cf00251..d9b2fd2 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -21,6 +21,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -109,7 +110,7 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 
__u32 __user *ustatus)
return ret;
 }
 
-int arch_notes_size(void)
+int elf_coredump_extra_notes_size(void)
 {
struct spufs_calls *calls;
int ret;
@@ -125,17 +126,22 @@ int arch_notes_size(void)
return ret;
 }
 
-void arch_write_notes(struct file *file)
+int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
 {
struct spufs_calls *calls;
 
calls = spufs_calls_get();
if (!calls)
-   return;
+   return 0;
 
calls->coredump_extra_notes_write(file);
 
spufs_calls_put(calls);
+
+   /* Fudge foffset for now */
+   *foffset = file->f_pos;
+
+   return 0;
 }
 
 int register_spu_syscalls(struct spufs_calls *calls)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 4482a06..b1013f3 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1514,9 +1514,6 @@ static int elf_core_dump(long signr, struct pt_regs 
*regs, struct file *file)
int thread_status_size = 0;
elf_addr_t *auxv;
unsigned long mm_flags;
-#ifdef ELF_CORE_WRITE_EXTRA_NOTES
-   int extra_notes_size;
-#endif
 
/*
 * We no longer stop all VM operations.
@@ -1645,10 +1642,7 @@ static int elf_core_dump(long signr, struct pt_regs 
*regs, struct file *file)

sz += thread_status_size;
 
-#ifdef ELF_CORE_WRITE_EXTRA_NOTES
-   extra_notes_size = ELF_CORE_EXTRA_NOTES_SIZE;
-   sz += extra_notes_size;
-#endif
+   sz += elf_coredump_extra_notes_size();
 
fill_elf_note_phdr(&phdr, sz, offset);
offset += sz;
@@ -1698,10 +1692,8 @@ static int elf_core_dump(long signr, struct pt_regs 
*regs, struct file *file)
if (!writenote(notes + i, file, &foffset))
goto end_coredump;
 
-#ifdef ELF_CORE_WRITE_EXTRA_NOTES
-   ELF_CORE_WRITE_EXTRA_NOTES;
-   foffset += extra_notes_size;
-#endif
+   if (elf_coredump_extra_notes_write(file, &foffset))
+   goto end_coredump;
 
/* write out the thread status notes section */
list_for_each(t, &thread_list) {
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index de50799..e42820d 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -413,13 +413,8 @@ do {   
\
 /* Notes used in ET_CORE. Note name is "SPU//". */
 #define NT_SPU 1
 
-extern int arch_notes_size(void);
-extern void arch_write_notes(struct file *file);
-
-#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size()
-#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file)
-
 #define ARCH_HAVE_EXTRA_ELF_NOTES
-#endif /* CONFIG_PPC_CELL */
+
+#endif /* CONFIG_SPU_BASE */
 
 #endif /* _ASM_POWERPC_ELF_H */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 8b17ffe..d2da84a 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -389,12 +389,14 @@ extern Elf64_Dyn _DYNAMIC [];
 
 #endif
 
+/* Optional callbacks to write extra ELF notes. */
 #ifndef ARCH_HAVE_EXTRA_ELF_NOTES
-static inline int arch_notes_size(void) { return 0; }
-static inline void arch_write_notes(struct file *file) { }

[PATCH 20/25] spufs: Add contents of npc file to SPU coredumps

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>
Acked-by: Arnd Bergmann <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/file.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
b/arch/powerpc/platforms/cell/spufs/file.c
index 4cd34e5..985c86b 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1606,12 +1606,17 @@ static void spufs_npc_set(void *data, u64 val)
spu_release(ctx);
 }
 
+static u64 __spufs_npc_get(struct spu_context *ctx)
+{
+   return ctx->ops->npc_read(ctx);
+}
+
 static u64 spufs_npc_get(void *data)
 {
struct spu_context *ctx = data;
u64 ret;
spu_acquire(ctx);
-   ret = ctx->ops->npc_read(ctx);
+   ret = __spufs_npc_get(ctx);
spu_release(ctx);
return ret;
 }
@@ -2242,5 +2247,6 @@ struct spufs_coredump_reader spufs_coredump_read[] = {
{ "proxydma_info", __spufs_proxydma_info_read,
   NULL, sizeof(struct spu_proxydma_info)},
{ "object-id", NULL, __spufs_object_id_get, 19 },
+   { "npc", NULL, __spufs_npc_get, 19 },
{ NULL },
 };
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 08/25] Fix restore_decr_wrapped() to match CBE Handbook

2007-09-13 Thread Jeremy Kerr
Based on an original patch from Masato Noguchi
<[EMAIL PROTECTED]>.

We're currently not restoring the SPE decrementer as specified by the
CBE handbook. This change fixes our implementation to match, and makes
the function read more like the docs.

Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/switch.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/switch.c 
b/arch/powerpc/platforms/cell/spufs/switch.c
index 2506619..de7e5ee 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -1559,15 +1559,15 @@ static inline void restore_decr_wrapped(struct 
spu_state *csa, struct spu *spu)
 * "wrapped" flag is set, OR in a '1' to
 * CSA.SPU_Event_Status[Tm].
 */
-   if (csa->lscsa->decr_status.slot[0] & SPU_DECR_STATUS_WRAPPED) {
-   csa->spu_chnldata_RW[0] |= 0x20;
-   }
-   if ((csa->lscsa->decr_status.slot[0] & SPU_DECR_STATUS_WRAPPED) &&
-   (csa->spu_chnlcnt_RW[0] == 0 &&
-((csa->spu_chnldata_RW[2] & 0x20) == 0x0) &&
-((csa->spu_chnldata_RW[0] & 0x20) != 0x1))) {
+   if (!(csa->lscsa->decr_status.slot[0] & SPU_DECR_STATUS_WRAPPED))
+   return;
+
+   if ((csa->spu_chnlcnt_RW[0] == 0) &&
+   (csa->spu_chnldata_RW[1] & 0x20) &&
+   !(csa->spu_chnldata_RW[0] & 0x20))
csa->spu_chnlcnt_RW[0] = 1;
-   }
+
+   csa->spu_chnldata_RW[0] |= 0x20;
 }
 
 static inline void restore_ch_part1(struct spu_state *csa, struct spu *spu)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 18/25] spufs: Get rid of spufs_coredump_num_notes, it's not needed if we NULL terminate

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

The spufs_coredump_read array is NULL terminated, and we also store the size.
We only need one or the other, and the other arrays in file.c are NULL
terminated, so do that.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/coredump.c |4 ++--
 arch/powerpc/platforms/cell/spufs/file.c |4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c 
b/arch/powerpc/platforms/cell/spufs/coredump.c
index 52d6219..fc988fd 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -72,7 +72,7 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int 
dfd)
char *name;
char fullname[80];
 
-   for (i = 0; spufs_coredump_read[i].name; i++) {
+   for (i = 0; spufs_coredump_read[i].name != NULL; i++) {
name = spufs_coredump_read[i].name;
sz = spufs_coredump_read[i].size;
 
@@ -194,7 +194,7 @@ static void spufs_arch_write_notes(struct file *file)
while ((ctx = coredump_next_context(&fd)) != NULL) {
spu_acquire_saved(ctx);
 
-   for (j = 0; j < spufs_coredump_num_notes; j++)
+   for (j = 0; spufs_coredump_read[j].name != NULL; j++)
spufs_arch_write_note(ctx, j, file, fd);
 
spu_release_saved(ctx);
diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
b/arch/powerpc/platforms/cell/spufs/file.c
index 85edbec..6095fb1 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -2250,7 +2250,5 @@ struct spufs_coredump_reader spufs_coredump_read[] = {
{ "proxydma_info", __spufs_proxydma_info_read,
   NULL, sizeof(struct spu_proxydma_info)},
{ "object-id", NULL, __spufs_object_id_get, 19 },
-   { },
+   { NULL },
 };
-int spufs_coredump_num_notes = ARRAY_SIZE(spufs_coredump_read) - 1;
-
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 16/25] spufs: Correctly calculate the size of the local-store to dump

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

The routine to dump the local store, __spufs_mem_read(), does not take the
spu_lslr_RW value into account - so we shouldn't check it when we're
calculating the size either.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>
Acked-by: Arnd Bergmann <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/coredump.c |   16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c 
b/arch/powerpc/platforms/cell/spufs/coredump.c
index c65b717..52d6219 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -66,11 +66,6 @@ static int spufs_dump_seek(struct file *file, loff_t off)
return 1;
 }
 
-static u64 ctx_ls_size(struct spu_context *ctx)
-{
-   return ctx->csa.priv2.spu_lslr_RW + 1;
-}
-
 static int spufs_ctx_note_size(struct spu_context *ctx, int dfd)
 {
int i, sz, total = 0;
@@ -85,10 +80,7 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int 
dfd)
 
total += sizeof(struct elf_note);
total += roundup(strlen(fullname) + 1, 4);
-   if (!strcmp(name, "mem"))
-   total += roundup(ctx_ls_size(ctx), 4);
-   else
-   total += roundup(sz, 4);
+   total += roundup(sz, 4);
}
 
return total;
@@ -164,11 +156,7 @@ static void spufs_arch_write_note(struct spu_context *ctx, 
int i,
return;
 
name = spufs_coredump_read[i].name;
-
-   if (!strcmp(name, "mem"))
-   sz = ctx_ls_size(ctx);
-   else
-   sz = spufs_coredump_read[i].size;
+   sz = spufs_coredump_read[i].size;
 
sprintf(fullname, "SPU/%d/%s", dfd, name);
en.n_namesz = strlen(fullname) + 1;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 06/25] cell: unify spufs syscall path

2007-09-13 Thread Jeremy Kerr
At present, a built-in spufs will not use the spufs_calls callbacks, but
directly call sys_spu_create. This saves us an indirect branch, but
means we have duplicated functions - one for CONFIG_SPU_FS=y and one for
=m.

This change unifies the spufs syscall path, and provides access to the
spufs_calls structure through a get/put pair. At present, the only user
of the spufs_calls structure is spu_syscalls.c, but this will facilitate
adding the coredump calls later. We also add a mutex to protect the
spufs_calls struct, so that accesses to the calls don't race with
{,un}register_spu_calls.

Everyone likes numbers, right? Here's a before/after comparison with
CONFIG_SPU_FS=y, doing spu_create(); close(); 64k times.

Before:
[EMAIL PROTECTED] ~]$ time ./spu_create
performing 65536 spu_create calls

real0m24.075s
user0m0.146s
sys 0m23.925s

After:
[EMAIL PROTECTED] ~]$ time ./spu_create
performing 65536 spu_create calls

real0m24.777s
user0m0.141s
sys 0m24.631s

So, we're adding around 11us per syscall, at the benefit of having
only one syscall path.

Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/Makefile |4 
 arch/powerpc/platforms/cell/spu_syscalls.c   |  117 +--
 arch/powerpc/platforms/cell/spufs/spufs.h|1 
 arch/powerpc/platforms/cell/spufs/syscalls.c |   42 -
 include/asm-powerpc/spu.h|   14 ---
 5 files changed, 78 insertions(+), 100 deletions(-)

diff --git a/arch/powerpc/platforms/cell/Makefile 
b/arch/powerpc/platforms/cell/Makefile
index f88a7c7..40f78e9 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -13,15 +13,13 @@ obj-$(CONFIG_PPC_CELL_NATIVE)   += smp.o
 endif
 
 # needed only when building loadable spufs.ko
-spufs-modular-$(CONFIG_SPU_FS) += spu_syscalls.o
 spu-priv1-$(CONFIG_PPC_CELL_NATIVE)+= spu_priv1_mmio.o
 
 spu-manage-$(CONFIG_PPC_CELLEB)+= spu_manage.o
 spu-manage-$(CONFIG_PPC_CELL_NATIVE)   += spu_manage.o
 
 obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
-  spu_coredump.o \
-  $(spufs-modular-m) \
+  spu_coredump.o spu_syscalls.o \
   $(spu-priv1-y) \
   $(spu-manage-y) \
   spufs/
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c 
b/arch/powerpc/platforms/cell/spu_syscalls.c
index 027ac32..76815c5 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -22,42 +22,67 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
-struct spufs_calls spufs_calls = {
-   .owner = NULL,
-};
+static struct spufs_calls *spufs_calls;
+DEFINE_MUTEX(spufs_calls_mutex);
 
-/* These stub syscalls are needed to have the actual implementation
- * within a loadable module. When spufs is built into the kernel,
- * this file is not used and the syscalls directly enter the fs code */
+#ifdef CONFIG_SPU_FS_MODULE
+
+static inline struct spufs_calls *spufs_calls_get(void)
+{
+   struct spufs_calls *calls = NULL;
+
+   mutex_lock(&spufs_calls_mutex);
+   if (spufs_calls && try_module_get(spufs_calls->owner))
+   calls = spufs_calls;
+   mutex_unlock(&spufs_calls_mutex);
+
+   return calls;
+}
+
+static inline void spufs_calls_put(struct spufs_calls *calls)
+{
+   BUG_ON(calls != spufs_calls);
+   module_put(calls->owner);
+}
+
+#else /* !defined CONFIG_SPU_FS_MODULE */
+
+static inline struct spufs_calls *spufs_calls_get(void)
+{
+   return spufs_calls;
+}
+
+static inline void spufs_calls_put(struct spufs_calls *calls) { }
+
+#endif /* CONFIG_SPU_FS_MODULE */
 
 asmlinkage long sys_spu_create(const char __user *name,
unsigned int flags, mode_t mode, int neighbor_fd)
 {
long ret;
-   struct module *owner = spufs_calls.owner;
struct file *neighbor;
int fput_needed;
+   struct spufs_calls *calls;
 
-   ret = -ENOSYS;
-   if (owner && try_module_get(owner)) {
-   if (flags & SPU_CREATE_AFFINITY_SPU) {
-   neighbor = fget_light(neighbor_fd, &fput_needed);
-   ret = -EBADF;
-   if (neighbor) {
-   ret = spufs_calls.create_thread(name, flags,
-   mode, neighbor);
-   fput_light(neighbor, fput_needed);
-   }
-   }
-   else {
-   ret = spufs_calls.create_thread(name, flags,
-   mode, NULL);
+   calls =

[PATCH 13/25] spufs: Call spu_acquire_saved() before calculating the SPU note sizes

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

It makes sense to stop the SPU processes as soon as possible. Also if we
dont acquire_saved() I think there's a possibility that the value in
csa.priv2.spu_lslr_RW won't be accurate.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/coredump.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c 
b/arch/powerpc/platforms/cell/spufs/coredump.c
index 6663669..21283f6 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -135,7 +135,9 @@ static int spufs_arch_notes_size(void)
 
fd = 0;
while ((ctx = coredump_next_context(&fd)) != NULL) {
+   spu_acquire_saved(ctx);
rc = spufs_ctx_note_size(ctx, fd);
+   spu_release_saved(ctx);
if (rc < 0)
break;
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 04/25] spufs: make isolated loader properly aligned

2007-09-13 Thread Jeremy Kerr
From: Sebastian Siewior <[EMAIL PROTECTED]>

According to the comment in spufs_init_isolated_loader(), the isolated
loader should be aligned on a 16 byte boundary.
ARCH_{KMALLOC,SLAB}_MINALIGN is not defined so only 8 byte alignment is
guaranteed.

This patch enforces alignment via __get_free_pages.

Signed-off-by: Sebastian Siewior <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/inode.c |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/inode.c 
b/arch/powerpc/platforms/cell/spufs/inode.c
index b3d0dd1..e210a4b 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -43,6 +43,7 @@
 
 static struct kmem_cache *spufs_inode_cache;
 char *isolated_loader;
+static int isolated_loader_size;
 
 static struct inode *
 spufs_alloc_inode(struct super_block *sb)
@@ -667,7 +668,8 @@ spufs_parse_options(char *options, struct inode *root)
 
 static void spufs_exit_isolated_loader(void)
 {
-   kfree(isolated_loader);
+   free_pages((unsigned long) isolated_loader,
+   get_order(isolated_loader_size));
 }
 
 static void
@@ -685,11 +687,12 @@ spufs_init_isolated_loader(void)
if (!loader)
return;
 
-   /* kmalloc should align on a 16 byte boundary..* */
-   isolated_loader = kmalloc(size, GFP_KERNEL);
+   /* the loader must be align on a 16 byte boundary */
+   isolated_loader = (char *)__get_free_pages(GFP_KERNEL, get_order(size));
if (!isolated_loader)
return;
 
+   isolated_loader_size = size;
memcpy(isolated_loader, loader, size);
printk(KERN_INFO "spufs: SPU isolation mode enabled\n");
 }
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 14/25] spufs: Use computed sizes/#defines rather than literals in SPU coredump code

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

The spufs_coredump_reader array contains the size of the data that will be
returned by the read routine. Currently these are specified as literals, and
though some are obvious, sizeof(u32) == 4, others are not, 69 * 8 ==  ???

Instead, use sizeof() whatever type is returned by each routine, or in
the case of spufs_mem_read() the #define LS_SIZE.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/file.c |   21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
b/arch/powerpc/platforms/cell/spufs/file.c
index a4a8770..18ddde8 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -2231,23 +2231,24 @@ struct tree_descr spufs_dir_nosched_contents[] = {
 };
 
 struct spufs_coredump_reader spufs_coredump_read[] = {
-   { "regs", __spufs_regs_read, NULL, 128 * 16 },
-   { "fpcr", __spufs_fpcr_read, NULL, 16 },
+   { "regs", __spufs_regs_read, NULL, sizeof(struct spu_reg128[128])},
+   { "fpcr", __spufs_fpcr_read, NULL, sizeof(struct spu_reg128) },
{ "lslr", NULL, __spufs_lslr_get, 11 },
{ "decr", NULL, __spufs_decr_get, 11 },
{ "decr_status", NULL, __spufs_decr_status_get, 11 },
-   { "mem", __spufs_mem_read, NULL, 256 * 1024, },
-   { "signal1", __spufs_signal1_read, NULL, 4 },
+   { "mem", __spufs_mem_read, NULL, LS_SIZE, },
+   { "signal1", __spufs_signal1_read, NULL, sizeof(u32) },
{ "signal1_type", NULL, __spufs_signal1_type_get, 2 },
-   { "signal2", __spufs_signal2_read, NULL, 4 },
+   { "signal2", __spufs_signal2_read, NULL, sizeof(u32) },
{ "signal2_type", NULL, __spufs_signal2_type_get, 2 },
{ "event_mask", NULL, __spufs_event_mask_get, 8 },
{ "event_status", NULL, __spufs_event_status_get, 8 },
-   { "mbox_info", __spufs_mbox_info_read, NULL, 4 },
-   { "ibox_info", __spufs_ibox_info_read, NULL, 4 },
-   { "wbox_info", __spufs_wbox_info_read, NULL, 16 },
-   { "dma_info", __spufs_dma_info_read, NULL, 69 * 8 },
-   { "proxydma_info", __spufs_proxydma_info_read, NULL, 35 * 8 },
+   { "mbox_info", __spufs_mbox_info_read, NULL, sizeof(u32) },
+   { "ibox_info", __spufs_ibox_info_read, NULL, sizeof(u32) },
+   { "wbox_info", __spufs_wbox_info_read, NULL, 4 * sizeof(u32)},
+   { "dma_info", __spufs_dma_info_read, NULL, sizeof(struct spu_dma_info)},
+   { "proxydma_info", __spufs_proxydma_info_read,
+  NULL, sizeof(struct spu_proxydma_info)},
{ "object-id", NULL, __spufs_object_id_get, 19 },
{ },
 };
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 02/25] spufs: remove asmlinkage from do_spu_create

2007-09-13 Thread Jeremy Kerr
do_spu_create doesn't need the asmlinkage qualifier; remove it.

Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/syscalls.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c 
b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 3d8c328..936e0a8 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -76,8 +76,8 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 
__user *ustatus)
 }
 #endif
 
-static asmlinkage long do_spu_create(const char __user *pathname,
-   unsigned int flags, mode_t mode, struct file *neighbor)
+static long do_spu_create(const char __user *pathname, unsigned int flags,
+   mode_t mode, struct file *neighbor)
 {
char *tmp;
int ret;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 25/25] spufs: Add DEFINE_SPUFS_ATTRIBUTE()

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

This patch adds DEFINE_SPUFS_ATTRIBUTE(), a wraper around
DEFINE_SIMPLE_ATTRIBUTE which does the specified locking for the get
routine for us.

Unfortunately we need two get routines (a locked and unlocked version) to
support the coredump code. This patch hides one of those (the locked version)
inside the macro foo.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/file.c |  216 ++-
 1 file changed, 76 insertions(+), 140 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
b/arch/powerpc/platforms/cell/spufs/file.c
index 985c86b..b93a027 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1076,6 +1076,36 @@ static const struct file_operations 
spufs_signal2_nosched_fops = {
.mmap = spufs_signal2_mmap,
 };
 
+/*
+ * This is a wrapper around DEFINE_SIMPLE_ATTRIBUTE which does the
+ * work of acquiring (or not) the SPU context before calling through
+ * to the actual get routine. The set routine is called directly.
+ */
+#define SPU_ATTR_NOACQUIRE 0
+#define SPU_ATTR_ACQUIRE   1
+#define SPU_ATTR_ACQUIRE_SAVED 2
+
+#define DEFINE_SPUFS_ATTRIBUTE(__name, __get, __set, __fmt, __acquire) \
+static u64 __##__get(void *data)   \
+{  \
+   struct spu_context *ctx = data; \
+   u64 ret;\
+   \
+   if (__acquire == SPU_ATTR_ACQUIRE) {\
+   spu_acquire(ctx);   \
+   ret = __get(ctx);   \
+   spu_release(ctx);   \
+   } else if (__acquire == SPU_ATTR_ACQUIRE_SAVED) {   \
+   spu_acquire_saved(ctx); \
+   ret = __get(ctx);   \
+   spu_release_saved(ctx); \
+   } else  \
+   ret = __get(ctx);   \
+   \
+   return ret; \
+}  \
+DEFINE_SIMPLE_ATTRIBUTE(__name, __##__get, __set, __fmt);
+
 static void spufs_signal1_type_set(void *data, u64 val)
 {
struct spu_context *ctx = data;
@@ -1085,24 +1115,13 @@ static void spufs_signal1_type_set(void *data, u64 val)
spu_release(ctx);
 }
 
-static u64 __spufs_signal1_type_get(struct spu_context *ctx)
+static u64 spufs_signal1_type_get(struct spu_context *ctx)
 {
return ctx->ops->signal1_type_get(ctx);
 }
+DEFINE_SPUFS_ATTRIBUTE(spufs_signal1_type, spufs_signal1_type_get,
+  spufs_signal1_type_set, "%llu", SPU_ATTR_ACQUIRE);
 
-static u64 spufs_signal1_type_get(void *data)
-{
-   struct spu_context *ctx = data;
-   u64 ret;
-
-   spu_acquire(ctx);
-   ret = __spufs_signal1_type_get(ctx);
-   spu_release(ctx);
-
-   return ret;
-}
-DEFINE_SIMPLE_ATTRIBUTE(spufs_signal1_type, spufs_signal1_type_get,
-   spufs_signal1_type_set, "%llu");
 
 static void spufs_signal2_type_set(void *data, u64 val)
 {
@@ -1113,24 +1132,12 @@ static void spufs_signal2_type_set(void *data, u64 val)
spu_release(ctx);
 }
 
-static u64 __spufs_signal2_type_get(struct spu_context *ctx)
+static u64 spufs_signal2_type_get(struct spu_context *ctx)
 {
return ctx->ops->signal2_type_get(ctx);
 }
-
-static u64 spufs_signal2_type_get(void *data)
-{
-   struct spu_context *ctx = data;
-   u64 ret;
-
-   spu_acquire(ctx);
-   ret = __spufs_signal2_type_get(ctx);
-   spu_release(ctx);
-
-   return ret;
-}
-DEFINE_SIMPLE_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
-   spufs_signal2_type_set, "%llu");
+DEFINE_SPUFS_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
+  spufs_signal2_type_set, "%llu", SPU_ATTR_ACQUIRE);
 
 #if SPUFS_MMAP_4K
 static unsigned long spufs_mss_mmap_nopfn(struct vm_area_struct *vma,
@@ -1606,22 +1613,12 @@ static void spufs_npc_set(void *data, u64 val)
spu_release(ctx);
 }
 
-static u64 __spufs_npc_get(struct spu_context *ctx)
+static u64 spufs_npc_get(struct spu_context *ctx)
 {
return ctx->ops->npc_read(ctx);
 }
-
-static u64 spufs_npc_get(void *data)
-{
-   struct spu_context *ctx = data;
-   u64 ret;
-   spu_acquire(ctx);
-   ret = __sp

[PATCH 12/25] spufs: Remove ctx_info and ctx_info_list

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

Remove the ctx_info struct entirely, and also the ctx_info_list. This fixes
a race where two processes can clobber each other's ctx_info structs.

Instead of using the list, we just repeat the search through the file
descriptor table.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/coredump.c |   79 ++-
 1 file changed, 19 insertions(+), 60 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c 
b/arch/powerpc/platforms/cell/spufs/coredump.c
index 99f8e0b..6663669 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -31,15 +31,6 @@
 
 #include "spufs.h"
 
-struct spufs_ctx_info {
-   struct list_head list;
-   int dfd;
-   int memsize; /* in bytes */
-   struct spu_context *ctx;
-};
-
-static LIST_HEAD(ctx_info_list);
-
 static ssize_t do_coredump_read(int num, struct spu_context *ctx, void __user 
*buffer,
size_t size, loff_t *off)
 {
@@ -73,25 +64,17 @@ static int spufs_dump_seek(struct file *file, loff_t off)
return 1;
 }
 
-static void spufs_fill_memsize(struct spufs_ctx_info *ctx_info)
+static u64 ctx_ls_size(struct spu_context *ctx)
 {
-   struct spu_context *ctx;
-   unsigned long long lslr;
-
-   ctx = ctx_info->ctx;
-   lslr = ctx->csa.priv2.spu_lslr_RW;
-   ctx_info->memsize = lslr + 1;
+   return ctx->csa.priv2.spu_lslr_RW + 1;
 }
 
-static int spufs_ctx_note_size(struct spufs_ctx_info *ctx_info)
+static int spufs_ctx_note_size(struct spu_context *ctx, int dfd)
 {
-   int dfd, memsize, i, sz, total = 0;
+   int i, sz, total = 0;
char *name;
char fullname[80];
 
-   dfd = ctx_info->dfd;
-   memsize = ctx_info->memsize;
-
for (i = 0; spufs_coredump_read[i].name; i++) {
name = spufs_coredump_read[i].name;
sz = spufs_coredump_read[i].size;
@@ -101,7 +84,7 @@ static int spufs_ctx_note_size(struct spufs_ctx_info 
*ctx_info)
total += sizeof(struct elf_note);
total += roundup(strlen(fullname) + 1, 4);
if (!strcmp(name, "mem"))
-   total += roundup(memsize, 4);
+   total += roundup(ctx_ls_size(ctx), 4);
else
total += roundup(sz, 4);
}
@@ -109,25 +92,6 @@ static int spufs_ctx_note_size(struct spufs_ctx_info 
*ctx_info)
return total;
 }
 
-static int spufs_add_one_context(struct spu_context *ctx, int dfd)
-{
-   struct spufs_ctx_info *ctx_info;
-   int size;
-
-   ctx_info = kzalloc(sizeof(*ctx_info), GFP_KERNEL);
-   if (unlikely(!ctx_info))
-   return -ENOMEM;
-
-   ctx_info->dfd = dfd;
-   ctx_info->ctx = ctx;
-
-   spufs_fill_memsize(ctx_info);
-
-   size = spufs_ctx_note_size(ctx_info);
-   list_add(&ctx_info->list, &ctx_info_list);
-   return size;
-}
-
 /*
  * The additional architecture-specific notes for Cell are various
  * context files in the spu context.
@@ -171,7 +135,7 @@ static int spufs_arch_notes_size(void)
 
fd = 0;
while ((ctx = coredump_next_context(&fd)) != NULL) {
-   rc = spufs_add_one_context(ctx, fd);
+   rc = spufs_ctx_note_size(ctx, fd);
if (rc < 0)
break;
 
@@ -181,12 +145,11 @@ static int spufs_arch_notes_size(void)
return size;
 }
 
-static void spufs_arch_write_note(struct spufs_ctx_info *ctx_info, int i,
-   struct file *file)
+static void spufs_arch_write_note(struct spu_context *ctx, int i,
+   struct file *file, int dfd)
 {
-   struct spu_context *ctx;
loff_t pos = 0;
-   int sz, dfd, rc, total = 0;
+   int sz, rc, total = 0;
const int bufsz = PAGE_SIZE;
char *name;
char fullname[80], *buf;
@@ -196,18 +159,13 @@ static void spufs_arch_write_note(struct spufs_ctx_info 
*ctx_info, int i,
if (!buf)
return;
 
-   dfd = ctx_info->dfd;
name = spufs_coredump_read[i].name;
 
if (!strcmp(name, "mem"))
-   sz = ctx_info->memsize;
+   sz = ctx_ls_size(ctx);
else
sz = spufs_coredump_read[i].size;
 
-   ctx = ctx_info->ctx;
-   if (!ctx)
-   goto out;
-
sprintf(fullname, "SPU/%d/%s", dfd, name);
en.n_namesz = strlen(fullname) + 1;
en.n_descsz = sz;
@@ -237,16 +195,17 @@ out:
 
 static void spufs_arch_write_notes(struct file *file)
 {
-   int j;
-   struct spufs_ctx_info *ctx_info, *next;
+   struct spu_context *ctx;
+   int fd, j;
+
+   fd = 0;
+   while ((ctx = coredump_next_context(&fd)) != NULL) {
+   spu_acquire_saved(ctx);
 
-   list_for_each_entry_

[PATCH 23/25] spufs: Handle errors in SPU coredump code, and support coredump to a pipe

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

Rework spufs_coredump_extra_notes_write() to check for and return errors.

If we're coredumping to a pipe we can't trust file->f_pos, we need to
maintain the foffset value passed to us. The cleanest way to do this is
to have the low level write routine increment foffset when we've
successfully written.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spu_syscalls.c   |8 --
 arch/powerpc/platforms/cell/spufs/coredump.c |   89 ++-
 arch/powerpc/platforms/cell/spufs/spufs.h|2 
 include/asm-powerpc/spu.h|2 
 4 files changed, 67 insertions(+), 34 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c 
b/arch/powerpc/platforms/cell/spu_syscalls.c
index d9b2fd2..0b69107 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -129,19 +129,17 @@ int elf_coredump_extra_notes_size(void)
 int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
 {
struct spufs_calls *calls;
+   int ret;
 
calls = spufs_calls_get();
if (!calls)
return 0;
 
-   calls->coredump_extra_notes_write(file);
+   ret = calls->coredump_extra_notes_write(file, foffset);
 
spufs_calls_put(calls);
 
-   /* Fudge foffset for now */
-   *foffset = file->f_pos;
-
-   return 0;
+   return ret;
 }
 
 int register_spu_syscalls(struct spufs_calls *calls)
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c 
b/arch/powerpc/platforms/cell/spufs/coredump.c
index 6c20e44..6b8aef6 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -51,19 +51,34 @@ static ssize_t do_coredump_read(int num, struct spu_context 
*ctx, void *buffer,
  * These are the only things you should do on a core-file: use only these
  * functions to write out all the necessary info.
  */
-static int spufs_dump_write(struct file *file, const void *addr, int nr)
+static int spufs_dump_write(struct file *file, const void *addr, int nr, 
loff_t *foffset)
 {
-   return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
+   ssize_t written;
+
+   written = file->f_op->write(file, addr, nr, &file->f_pos);
+   *foffset += written;
+
+   if (written != nr)
+   return -EIO;
+
+   return 0;
 }
 
-static int spufs_dump_seek(struct file *file, loff_t off)
+static int spufs_dump_align(struct file *file, char *buf, loff_t new_off,
+   loff_t *foffset)
 {
-   if (file->f_op->llseek) {
-   if (file->f_op->llseek(file, off, 0) != off)
-   return 0;
-   } else
-   file->f_pos = off;
-   return 1;
+   int rc, size;
+
+   size = min((loff_t)PAGE_SIZE, new_off - *foffset);
+   memset(buf, 0, size);
+
+   rc = 0;
+   while (rc == 0 && new_off > *foffset) {
+   size = min((loff_t)PAGE_SIZE, new_off - *foffset);
+   rc = spufs_dump_write(file, buf, size, foffset);
+   }
+
+   return rc;
 }
 
 static int spufs_ctx_note_size(struct spu_context *ctx, int dfd)
@@ -141,11 +156,11 @@ int spufs_coredump_extra_notes_size(void)
return size;
 }
 
-static void spufs_arch_write_note(struct spu_context *ctx, int i,
-   struct file *file, int dfd)
+static int spufs_arch_write_note(struct spu_context *ctx, int i,
+ struct file *file, int dfd, loff_t *foffset)
 {
loff_t pos = 0;
-   int sz, rc, total = 0;
+   int sz, rc, nread, total = 0;
const int bufsz = PAGE_SIZE;
char *name;
char fullname[80], *buf;
@@ -153,7 +168,7 @@ static void spufs_arch_write_note(struct spu_context *ctx, 
int i,
 
buf = (void *)get_zeroed_page(GFP_KERNEL);
if (!buf)
-   return;
+   return -ENOMEM;
 
name = spufs_coredump_read[i].name;
sz = spufs_coredump_read[i].size;
@@ -163,40 +178,60 @@ static void spufs_arch_write_note(struct spu_context 
*ctx, int i,
en.n_descsz = sz;
en.n_type = NT_SPU;
 
-   if (!spufs_dump_write(file, &en, sizeof(en)))
+   rc = spufs_dump_write(file, &en, sizeof(en), foffset);
+   if (rc)
goto out;
-   if (!spufs_dump_write(file, fullname, en.n_namesz))
+
+   rc = spufs_dump_write(file, fullname, en.n_namesz, foffset);
+   if (rc)
goto out;
-   if (!spufs_dump_seek(file, roundup((unsigned long)file->f_pos, 4)))
+
+   rc = spufs_dump_align(file, buf, roundup(*foffset, 4), foffset);
+   if (rc)
goto out;
 
do {
-   rc = do_coredump_read(i, ctx, buf, bufsz, &pos);
-   if (rc > 0) {
-   if (!spufs_dump_write(file, buf, rc))
+   nread = do_co

[PATCH 10/25] spusched: fix null pointer dereference in find_victim

2007-09-13 Thread Jeremy Kerr
From: Christoph Hellwig <[EMAIL PROTECTED]>

find_victim can dereference a NULL pointer when iterating over the list
of victim spus because list_mutex only guarantees spu->ct to be stable,
but of course not to be non-NULL.

Also fix find_victim to not call spu_unbind_context without list_mutex
because that violates the above guarantee.

Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>
Signed-off-by: Arnd Bergmann <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/sched.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/sched.c 
b/arch/powerpc/platforms/cell/spufs/sched.c
index 17806e0..4d257b3 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -594,7 +594,7 @@ static struct spu *find_victim(struct spu_context *ctx)
list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
struct spu_context *tmp = spu->ctx;
 
-   if (tmp->prio > ctx->prio &&
+   if (tmp && tmp->prio > ctx->prio &&
(!victim || tmp->prio > victim->prio))
victim = spu->ctx;
}
@@ -626,9 +626,9 @@ static struct spu *find_victim(struct spu_context *ctx)
 
mutex_lock(&cbe_spu_info[node].list_mutex);
cbe_spu_info[node].nr_active--;
+   spu_unbind_context(spu, victim);
mutex_unlock(&cbe_spu_info[node].list_mutex);
 
-   spu_unbind_context(spu, victim);
victim->stats.invol_ctx_switch++;
spu->stats.invol_ctx_switch++;
mutex_unlock(&victim->state_mutex);
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 21/25] spufs: Combine spufs_coredump_calls with spufs_calls

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

Because spufs might be built as a module, we can't have other parts of the
kernel calling directly into it, we need stub routines that check first if the
module is loaded.

Currently we have two structures which hold callbacks for these stubs, the
syscalls are in spufs_calls and the coredump calls are in spufs_coredump_calls.
In both cases the logic for registering/unregistering is essentially the same,
so we can simplify things by combining the two.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>
Acked-by: Arnd Bergmann <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/Makefile |2 
 arch/powerpc/platforms/cell/spu_coredump.c   |   83 ---
 arch/powerpc/platforms/cell/spu_syscalls.c   |   30 +
 arch/powerpc/platforms/cell/spufs/coredump.c |   10 ---
 arch/powerpc/platforms/cell/spufs/inode.c|6 -
 arch/powerpc/platforms/cell/spufs/spufs.h|4 +
 arch/powerpc/platforms/cell/spufs/syscalls.c |2 
 include/asm-powerpc/spu.h|   12 ---
 8 files changed, 41 insertions(+), 108 deletions(-)

diff --git a/arch/powerpc/platforms/cell/Makefile 
b/arch/powerpc/platforms/cell/Makefile
index 40f78e9..61d12f1 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -19,7 +19,7 @@ spu-manage-$(CONFIG_PPC_CELLEB)   += spu_manage.o
 spu-manage-$(CONFIG_PPC_CELL_NATIVE)   += spu_manage.o
 
 obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
-  spu_coredump.o spu_syscalls.o \
+  spu_syscalls.o \
   $(spu-priv1-y) \
   $(spu-manage-y) \
   spufs/
diff --git a/arch/powerpc/platforms/cell/spu_coredump.c 
b/arch/powerpc/platforms/cell/spu_coredump.c
deleted file mode 100644
index 656a8c5..000
--- a/arch/powerpc/platforms/cell/spu_coredump.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SPU core dump code
- *
- * (C) Copyright 2006 IBM Corp.
- *
- * Author: Dwayne Grant McConnell <[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, or (at your option)
- * any later version.
- *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include 
-#include 
-#include 
-
-#include 
-
-static struct spu_coredump_calls *spu_coredump_calls;
-static DEFINE_MUTEX(spu_coredump_mutex);
-
-int arch_notes_size(void)
-{
-   int ret;
-
-   mutex_lock(&spu_coredump_mutex);
-
-   if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
-   ret = spu_coredump_calls->arch_notes_size();
-   module_put(spu_coredump_calls->owner);
-   } else {
-   ret = 0;
-   }
-
-   mutex_unlock(&spu_coredump_mutex);
-
-   return ret;
-}
-
-void arch_write_notes(struct file *file)
-{
-   mutex_lock(&spu_coredump_mutex);
-   if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
-   spu_coredump_calls->arch_write_notes(file);
-   module_put(spu_coredump_calls->owner);
-   }
-   mutex_unlock(&spu_coredump_mutex);
-}
-
-int register_arch_coredump_calls(struct spu_coredump_calls *calls)
-{
-   int ret = 0;
-
-
-   mutex_lock(&spu_coredump_mutex);
-   if (spu_coredump_calls)
-   ret = -EBUSY;
-   else
-   spu_coredump_calls = calls;
-   mutex_unlock(&spu_coredump_mutex);
-   return ret;
-}
-EXPORT_SYMBOL_GPL(register_arch_coredump_calls);
-
-void unregister_arch_coredump_calls(struct spu_coredump_calls *calls)
-{
-   BUG_ON(spu_coredump_calls != calls);
-
-   mutex_lock(&spu_coredump_mutex);
-   spu_coredump_calls = NULL;
-   mutex_unlock(&spu_coredump_mutex);
-}
-EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c 
b/arch/powerpc/platforms/cell/spu_syscalls.c
index 76815c5..cf00251 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -2,6 +2,7 @@
  * SPU file system -- system call stubs
  *
  * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
+ * (C) Copyright 2006-2007, IBM Corporation
  *
  * Author: Arnd Bergmann <[EMAIL PROTECTED]>
  *
@@ -108,6 +109,35 @@ as

[PATCH 09/25] cell: remove DEBUG for spu callbacks

2007-09-13 Thread Jeremy Kerr
We don't want SPE programs to be able to flood the kernel log by
invoking the SPE callback handler, so don't enable DEBUG for
spu_callbacks.c by default.

Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spu_callbacks.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c 
b/arch/powerpc/platforms/cell/spu_callbacks.c
index ab39e22..dceb8b6 100644
--- a/arch/powerpc/platforms/cell/spu_callbacks.c
+++ b/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -2,7 +2,7 @@
  * System call callback functions for SPUs
  */
 
-#define DEBUG
+#undef DEBUG
 
 #include 
 #include 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 19/25] spufs: Internal __spufs_get_foo() routines should take a spu_context *

2007-09-13 Thread Jeremy Kerr
From: Michael Ellerman <[EMAIL PROTECTED]>

The SPUFS attribute get routines take a void * because the generic attribute
code doesn't know what sort of data it's passing around.

However our internal __spufs_get_foo() routines can take a spu_context *
directly, which saves plonking it in and out of a void * again.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>
Acked-by: Arnd Bergmann <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spufs/file.c  |   40 --
 arch/powerpc/platforms/cell/spufs/spufs.h |2 -
 2 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
b/arch/powerpc/platforms/cell/spufs/file.c
index 6095fb1..4cd34e5 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1085,9 +1085,8 @@ static void spufs_signal1_type_set(void *data, u64 val)
spu_release(ctx);
 }
 
-static u64 __spufs_signal1_type_get(void *data)
+static u64 __spufs_signal1_type_get(struct spu_context *ctx)
 {
-   struct spu_context *ctx = data;
return ctx->ops->signal1_type_get(ctx);
 }
 
@@ -1097,7 +1096,7 @@ static u64 spufs_signal1_type_get(void *data)
u64 ret;
 
spu_acquire(ctx);
-   ret = __spufs_signal1_type_get(data);
+   ret = __spufs_signal1_type_get(ctx);
spu_release(ctx);
 
return ret;
@@ -1114,9 +1113,8 @@ static void spufs_signal2_type_set(void *data, u64 val)
spu_release(ctx);
 }
 
-static u64 __spufs_signal2_type_get(void *data)
+static u64 __spufs_signal2_type_get(struct spu_context *ctx)
 {
-   struct spu_context *ctx = data;
return ctx->ops->signal2_type_get(ctx);
 }
 
@@ -1126,7 +1124,7 @@ static u64 spufs_signal2_type_get(void *data)
u64 ret;
 
spu_acquire(ctx);
-   ret = __spufs_signal2_type_get(data);
+   ret = __spufs_signal2_type_get(ctx);
spu_release(ctx);
 
return ret;
@@ -1629,9 +1627,8 @@ static void spufs_decr_set(void *data, u64 val)
spu_release_saved(ctx);
 }
 
-static u64 __spufs_decr_get(void *data)
+static u64 __spufs_decr_get(struct spu_context *ctx)
 {
-   struct spu_context *ctx = data;
struct spu_lscsa *lscsa = ctx->csa.lscsa;
return lscsa->decr.slot[0];
 }
@@ -1641,7 +1638,7 @@ static u64 spufs_decr_get(void *data)
struct spu_context *ctx = data;
u64 ret;
spu_acquire_saved(ctx);
-   ret = __spufs_decr_get(data);
+   ret = __spufs_decr_get(ctx);
spu_release_saved(ctx);
return ret;
 }
@@ -1659,9 +1656,8 @@ static void spufs_decr_status_set(void *data, u64 val)
spu_release_saved(ctx);
 }
 
-static u64 __spufs_decr_status_get(void *data)
+static u64 __spufs_decr_status_get(struct spu_context *ctx)
 {
-   struct spu_context *ctx = data;
if (ctx->csa.priv2.mfc_control_RW & MFC_CNTL_DECREMENTER_RUNNING)
return SPU_DECR_STATUS_RUNNING;
else
@@ -1673,7 +1669,7 @@ static u64 spufs_decr_status_get(void *data)
struct spu_context *ctx = data;
u64 ret;
spu_acquire_saved(ctx);
-   ret = __spufs_decr_status_get(data);
+   ret = __spufs_decr_status_get(ctx);
spu_release_saved(ctx);
return ret;
 }
@@ -1689,9 +1685,8 @@ static void spufs_event_mask_set(void *data, u64 val)
spu_release_saved(ctx);
 }
 
-static u64 __spufs_event_mask_get(void *data)
+static u64 __spufs_event_mask_get(struct spu_context *ctx)
 {
-   struct spu_context *ctx = data;
struct spu_lscsa *lscsa = ctx->csa.lscsa;
return lscsa->event_mask.slot[0];
 }
@@ -1701,16 +1696,15 @@ static u64 spufs_event_mask_get(void *data)
struct spu_context *ctx = data;
u64 ret;
spu_acquire_saved(ctx);
-   ret = __spufs_event_mask_get(data);
+   ret = __spufs_event_mask_get(ctx);
spu_release_saved(ctx);
return ret;
 }
 DEFINE_SIMPLE_ATTRIBUTE(spufs_event_mask_ops, spufs_event_mask_get,
spufs_event_mask_set, "0x%llx\n")
 
-static u64 __spufs_event_status_get(void *data)
+static u64 __spufs_event_status_get(struct spu_context *ctx)
 {
-   struct spu_context *ctx = data;
struct spu_state *state = &ctx->csa;
u64 stat;
stat = state->spu_chnlcnt_RW[0];
@@ -1725,7 +1719,7 @@ static u64 spufs_event_status_get(void *data)
u64 ret = 0;
 
spu_acquire_saved(ctx);
-   ret = __spufs_event_status_get(data);
+   ret = __spufs_event_status_get(ctx);
spu_release_saved(ctx);
return ret;
 }
@@ -1770,16 +1764,15 @@ static u64 spufs_id_get(void *data)
 }
 DEFINE_SIMPLE_ATTRIBUTE(spufs_id_ops, spufs_id_get, NULL, "0x%llx\n")
 
-static u64 __spufs_object_id_get(void *data)
+static u64 __spufs_object_id_get(struct spu_context *ctx)
 {
-   struct spu_context *ctx = data;
return ctx->object_id;
 }
 
 static u64 spufs_object_id_get(void *data)

rtc-ds1742.c should use resource_size_t for base address

2007-09-13 Thread David Gibson
Currently the rtc driver, rtc-ds1742.c uses an unsigned long to store
the base mmio address of the NVRAM/RTC.  This breaks on systems like
PowerPC 440, which is a 32-bit core with 36-bit physical addresses: IO
on the system, including the RTC, is typically above the 4GB point,
and cannot fit into an unsigned long.

This patch fixes the problem by replacing the unsigned long with a
resource_size_t.  Tested on Ebony (PPC440) (with additional patches to
instantiate the ds1742 platform device appropriately).

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

Index: working-2.6/drivers/rtc/rtc-ds1742.c
===
--- working-2.6.orig/drivers/rtc/rtc-ds1742.c   2007-09-14 15:43:31.0 
+1000
+++ working-2.6/drivers/rtc/rtc-ds1742.c2007-09-14 15:44:09.0 
+1000
@@ -55,7 +55,7 @@ struct rtc_plat_data {
void __iomem *ioaddr_rtc;
size_t size_nvram;
size_t size;
-   unsigned long baseaddr;
+   resource_size_t baseaddr;
unsigned long last_jiffies;
 };
 

-- 
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] cell: don't cast the result of of_get_property()

2007-09-13 Thread Jeremy Kerr
The cast to u32 * isn't required, of_get_property returns a void *.

Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/cell/spu_manage.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spu_manage.c 
b/arch/powerpc/platforms/cell/spu_manage.c
index 0e14f53..1b01070 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -377,10 +377,10 @@ static int qs20_reg_memory[QS20_SPES_PER_BE] = { 1, 1, 0, 
0, 0, 0, 0, 0 };
 static struct spu *spu_lookup_reg(int node, u32 reg)
 {
struct spu *spu;
-   u32 *spu_reg;
+   const u32 *spu_reg;
 
list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
-   spu_reg = (u32*)of_get_property(spu_devnode(spu), "reg", NULL);
+   spu_reg = of_get_property(spu_devnode(spu), "reg", NULL);
if (*spu_reg == reg)
return spu;
}
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/2] fsl/embedded6xx: don't cast the result of of_get_property

2007-09-13 Thread Jeremy Kerr
Use a temporary variable of the correct type instead.

Also, this allows us to check the return value in ls_uarts_init, to
avoid dereferencing a null pointer if required properties aren't
present.

Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>

---
 arch/powerpc/platforms/embedded6xx/ls_uart.c |   14 +-
 arch/powerpc/sysdev/fsl_soc.c|   18 ++
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c 
b/arch/powerpc/platforms/embedded6xx/ls_uart.c
index d0bee9f..9d4b40c 100644
--- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
+++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
@@ -103,20 +103,24 @@ static void __init ls_uart_init(void)
 static int __init ls_uarts_init(void)
 {
struct device_node *avr;
-   phys_addr_t phys_addr;
+   const u32 *avr_clock_prop, *phys_addr;
int len;
 
avr = of_find_node_by_path("/soc10x/[EMAIL PROTECTED]");
if (!avr)
return -EINVAL;
 
-   avr_clock = *(u32*)of_get_property(avr, "clock-frequency", &len);
-   phys_addr = ((u32*)of_get_property(avr, "reg", &len))[0];
+   phys_addr = of_get_property(avr, "reg", &len);
+   avr_clock_prop = of_get_property(avr, "clock-frequency", &len);
 
-   if (!avr_clock || !phys_addr)
+   if (!avr_clock_prop || !phys_addr)
return -EINVAL;
 
-   avr_addr = ioremap(phys_addr, 32);
+   avr_clock = *avr_clock_prop;
+   if (!avr_clock || !phys_addr[0])
+   return -EINVAL;
+
+   avr_addr = ioremap(phys_addr[0], 32);
if (!avr_addr)
return -EFAULT;
 
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 1cf29c9..564d5e5 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -673,6 +673,7 @@ static int __init fs_enet_of_init(void)
struct fs_platform_info fs_enet_data;
const unsigned int *id, *phy_addr, *phy_irq;
const void *mac_addr;
+   const u32 *clk;
const phandle *ph;
const char *model;
 
@@ -740,10 +741,10 @@ static int __init fs_enet_of_init(void)
 goto unreg;
 }
 
-   fs_enet_data.clk_rx = *((u32 *)of_get_property(np,
-   "rx-clock", NULL));
-   fs_enet_data.clk_tx = *((u32 *)of_get_property(np,
-   "tx-clock", NULL));
+   clk = of_get_property(np, "rx-clock", NULL);
+   fs_enet_data.clk_rx = *clk;
+   clk = of_get_property(np, "tx-clock", NULL);
+   fs_enet_data.clk_tx = *clk;
 
if (strstr(model, "FCC")) {
int fcc_index = *id - 1;
@@ -844,6 +845,7 @@ static int __init cpm_uart_of_init(void)
struct resource r[3];
struct fs_uart_platform_info cpm_uart_data;
const int *id;
+   const u32 *clk;
const char *model;
 
memset(r, 0, sizeof(r));
@@ -882,10 +884,10 @@ static int __init cpm_uart_of_init(void)
cpm_uart_data.tx_buf_size = 32;
cpm_uart_data.rx_num_fifo = 4;
cpm_uart_data.rx_buf_size = 32;
-   cpm_uart_data.clk_rx = *((u32 *)of_get_property(np,
-   "rx-clock", NULL));
-   cpm_uart_data.clk_tx = *((u32 *)of_get_property(np,
-   "tx-clock", NULL));
+   clk = of_get_property(np, "rx-clock", NULL);
+   cpm_uart_data.clk_rx = *clk;
+   clk = of_get_property(np, "tx-clock", NULL);
+   cpm_uart_data.clk_tx = *clk;
 
ret =
platform_device_add_data(cpm_uart_dev, &cpm_uart_data,
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/9] 8xx: Infrastructure code cleanup.

2007-09-13 Thread David Gibson
On Thu, Sep 13, 2007 at 12:16:40PM +0400, Vitaly Bordug wrote:
[snip]
> > This looks bogus.  You're replacing the old crap immr_map() functions,
> > which ioremap()ed the registers every time, with a much simpler
> > version which uses an established-once mapping of the register
> > region.  AFAICT, anywah.
> > 
> > So far, so good - but your immr_unmap() still does an iounmap() which
> > is surely wrong - it should now be a no-op, leaving the mpc8xx_immr
> > mapping intact.  You probably get away with it by accident, because I
> > imagine attempting to unmap an unaligned chunk of the region will just
> > fail.
> >
> 
> yes, it should do nop instead of iounmap. 
> > In fact, with this patch in place, I'd like to see another patch which
> > removes all calls to immr_map() and immr_unmap(), simply accessing the
> > common mapping directly.
> > 
> Sorry, but originally, that stuff was created to get rid of BSP
> ifdefs in drivers. For PQ family, it is a common practice to have
> single driver handling all 3 CPU families, which use the same logic,
> but immr structure differs a little bit.
> 
> At this point it's clear case-by-case ioremapping does not have firm
> benefit, but getting back to the way it was is useless either.  In
> ideal world, we'd have all those stuff put into dts and have
> specific drivers be a shim layer between core hw and IO drivers.

Err.. I don't understand what you're getting at.  As the code stands
after Scott's cleanup, the map() and unmap() calls can certainly be
trivially removed, regardless of the history for them.

And, yes, the drivers should certainly uses addresses from the device
tree, rather than that revolting structure covering all the inbuilt
device retgisters.

-- 
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: Patches added to powerpc.git for-2.6.24 branch

2007-09-13 Thread Michael Neuling
Paulus,

Could you take this as well for 2.6.24?

  Remove barriers from the SLB shadow buffer update
  http://patchwork.ozlabs.org/linuxppc/patch?id=13116

Mikey

In message <[EMAIL PROTECTED]> you wrote:
> David Gibson (2):
>   [POWERPC] Move bootwrapper's strchr() and strncmp() from .h to string.S
>   [POWERPC] Document and implement an improved flash device binding for p
owerpc
> 
> Geert Uytterhoeven (1):
>   [POWERPC] PS3: Add new LV1 error codes
> 
> Geoff Levand (1):
>   [POWERPC] PS3: Enhance storage probe debug output
> 
> Jeremy Kerr (1):
>   [POWERPC] PS3: Fix CONFIG_SMP=n, CONFIG_KEXEC=y build
> 
> Josh Boyer (6):
>   [POWERPC] Remove dtc build cruft from DTS files
>   [POWERPC] Fix bus probe on Bamboo board
>   [POWERPC] Walnut DTS
>   [POWERPC] Walnut defconfig
>   [POWERPC] Walnut board support
>   [POWERPC] Walnut zImage wrapper
> 
> Kumar Gala (3):
>   [POWERPC] Remove old includes from arch/ppc
>   [POWERPC] Copy over headers from arch/ppc to arch/powerpc that we need
>   [POWERPC] Stop include asm-ppc when building ARCH=powerpc for ppc32
> 
> Linas Vepstas (4):
>   [POWERPC] IOMMU virtual merge is no longer experimental
>   [POWERPC] prom_init whitespace cleanup, typo fix
>   [POWERPC] prom.c whitespace cleanup
>   [POWERPC] setup_64.c and prom.c comment cleanup
> 
> Michael Ellerman (5):
>   [POWERPC] Add an optional device_node pointer to the irq_host
>   [POWERPC] Invert null match behaviour for irq_hosts
>   [POWERPC] Provide a default irq_host match, which matches on an exact o
f_node
>   [POWERPC] Initialise hwirq for legacy irqs
>   [POWERPC] Export virq mapping via debugfs
> 
> Olof Johansson (10):
>   [POWERPC] Export new __io{re,un}map_at() symbols
>   [POWERPC] pasemi: Add pasemi_pci_getcfgaddr()
>   [POWERPC] pasemi: Add workaround for erratum 5945
>   [POWERPC] pasemi: Export more SPRs to sysfs when CONFIG_DEBUG_KERNEL=y
>   [POWERPC] pasemi: Print more information at machine check
>   [POWERPC] pasemi: Move pasemi_idle_init() to late_initcall()
>   [POWERPC] Remove unused platform_machine_check()
>   [POWERPC] Move lowlevel runlatch calls under cpu feature control
>   [POWERPC] Remove warning in arch/powerpc/kernel/sysfs.c
>   [POWERPC] Add workaround for MPICs with broken register reads
> 
> Scott Wood (5):
>   [POWERPC] bootwrapper: flatdevtree fixes
>   [POWERPC] bootwrapper: Add strtoull()
>   [POWERPC] bootwrapper: Add get_path()
>   [POWERPC] bootwrapper: Only print MAC addresses when the node is actual
ly present
>   [POWERPC] Check _PAGE_RW and _PAGE_PRESENT on kernel addresses
> 
> Valentine Barshak (4):
>   [POWERPC] PowerPC 440EPx: Sequoia device tree
>   [POWERPC] PowerPC 440EPx: Sequoia defconfig
>   [POWERPC] PowerPC 440EPx: Sequoia board support
>   [POWERPC] PowerPC 440EPx: Sequoia bootwrapper
> 
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: oftree and external connected devices

2007-09-13 Thread David Gibson
On Thu, Sep 13, 2007 at 08:29:13AM -0500, Olof Johansson wrote:
> On Thu, Sep 13, 2007 at 01:26:26PM +0200, Juergen Beisert wrote:
> > Hi,
> > 
> > I'm using an MPC5200B based system with various external connected devices 
> > to 
> > its LocalPlusBus. On other architectures I would register them as platform 
> > devices (no chance to autodetect these devices). But on PowerPC 
> > architecture?
> 
> If it's a special case of something that it's unlikely that you'll reuse
> the driver for, I'd say go ahead with a platform driver. There's nothing in 
> the
> PPC kernel that stops it from working.
> 
> We're just trying to avoid it for common devices that platforms might share,
> and instead of describing hardware in the platform devices setup, describe it
> in the device tree instead.
> 
> So it depends on how much work you want to invest in it, and if you're
> planning on ever submitting the driver upstream. If you are, going
> with a simple device tree definiton would be best (the kernel side,
> to move a platform driver to instead be an of_platform driver is easy,
> and can be done afterwards).
> 
> > Is the oftree description also intended to describe these kind of external 
> > devices, or only SoC's internal devices? If its also intended for external 
> > devices, how to do so? Are there any examples? I didn't find anything 
> > useful 
> > yet.
> 
> It can be used to describe on-board or off-board devices alike.

And should be used to describe any devices that can't otherwise be
probed, whether they're on-board or not.

-- 
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 04/22] [POWERPC] Update mpc7448hpc2 device tree to be compatible for tsi109 chip

2007-09-13 Thread Segher Boessenkool
> Update mpc7448hpc2 device tree to be compatible for tsi109 chip.

Do all those boards have a tsi109?  If not, this patch is
incorrect.  If they do, is tsi109 actually backward-compatible
to tsi108?  That is, will a driver that knows about tsi108
only work correctly on a tsi109?

Also, all those names really should have a manufacturer
prefix ("XXX,...").


Segher

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


Re: [PATCH] PowerPC: usb ehci of_platform bindings for Sequoia 440EPx

2007-09-13 Thread Segher Boessenkool
> EHCI OF bindings for PowerPC 440EPx Sequoia.

Those aren't bindings, they are examples.  Bindings are pieces
of documentation that describe what device-specific properties
mean what, what standard properties are required with what
values, etc.

Examples are good to have, of course.

One thing you really need to document is what "ehci-be-desc"
and friends mean.  I can give you one comment already: for
devices that are usually little-endian, but an implementation
implements registers as big-endian, precedent is to show that
in the device tree by including an (empty) "big-endian" property,
rather than inventing new "compatible" values.


Segher

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


Re: [PATCH v3] [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port

2007-09-13 Thread Segher Boessenkool
> + PowerPC,[EMAIL PROTECTED] {

 Maybe it would be good to use "PowerPC,e500" instead -- it would
 make it easier to probe for the actual CPU type, that way.  Not
 that Linux uses the name/compatible here at all ;-)
>>>
>>> I thought about this, not sure what the best solution is.
>>
>> Since the CPU cores on all these SoCs are identical (well, there
>> might be a few revisions, or different cache sizes or such -- minor
>> differences that can be probed for separately), it probably is a
>> good idea to name them in the tree instead of having each client
>> have its own table.
>>
>> Or is there anything about the CPU that can be derived from "8572"
>> but not from "e500"?
>
> Only in so much that we need something that states what the actual 
> processor is.

You mean, something needs to say "8572"?  I think the "soc" node
would be best for that.

It's all not terribly important, just something to think about.

 And then there's the pci_bridge thing we're discussing on IRC, of
 course -- basically, get rid of the pci_bridge pseudo-node, and
 move the interrupt-map for the south-bridge devices into the
 south-bridge node.
>>>
>>> Leaving the interrupt-map in the PHB because that works and moving 
>>> it down has issues.
>>
>> Okay, fair enough.  Are you looking at resolving those kernel issues?
>
> No.  I've had enough of this device tree foo for a while :)

Heh okay :-)

> [I'm happy to test any patches related to this, if someone else comes 
> up with them]

Well I don't know what the problem is ("it doesn't work" doesn't
say much), and don't have your hardware to test.  Maybe we can do
it on IRC again ;-)


Segher

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


Re: [PATCH] [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port

2007-09-13 Thread Kumar Gala

On Sep 13, 2007, at 11:53 AM, Segher Boessenkool wrote:

>>> What is a "front side cache"?  What exactly does it cache?  If it's
>>> a cache for one CPU only, that fact should be shown in the device
>>> tree somehow.
>>
>> Its in front of the memory controllers.  Its not specific to a  
>> given CPU.
>
> Ah, I see.  That relationship is implicit in the device tree already,
> both this cache controller and that memory controller are child nodes
> of the same soc node, so your device tree is fine.
>
> Just for my own understanding, is this a coherent cache?  (I'm too
> lazy to read the manual ;-) )

yes its coherent.  Our caches tend to be coherent.

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


Re: [PATCH 10/10] mpc82xx: Add pq2fads board support.

2007-09-13 Thread Scott Wood
Kumar Gala wrote:
> No problem.  The cpm2_* code in the kernel is used on 85xx's that have a 
> CPM and I don't think we have that much ifdef for 85xx specific CPM 
> foo.  Only thing I can think of is this bit in cpm2.h:
> 
> #if defined(CONFIG_8272) || defined(CONFIG_MPC8555)
> #define CPM_DATAONLY_SIZE   ((uint)(8 * 1024) - CPM_DATAONLY_BASE)
> #define CPM_FCC_SPECIAL_BASE((uint)0x9000)
> #else

CPM_FCC_SPECIAL_BASE doesn't appear to be used anywhere in arch/powerpc.
CPM_DATAONLY_SIZE shouldn't be used anymore after this patchset.

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


Patches for 2.6.24 ??

2007-09-13 Thread Kumar Gala
Guys,

If you have things you want or think should go into 2.6.24 please  
speak up now!

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


Re: [PATCH 10/10] mpc82xx: Add pq2fads board support.

2007-09-13 Thread Kumar Gala

On Sep 13, 2007, at 11:05 AM, Scott Wood wrote:

> On Thu, Sep 13, 2007 at 01:39:58AM -0500, Kumar Gala wrote:
>>> +   CS: chipselect {
>>
>> We need to document this in booting-without-of.
>
> OK.

cool.  Want to make sure we can encompass the 83xx/85xx/86xx local  
bus in there.

>>> +   PIC: [EMAIL PROTECTED] {
>>> +   #interrupt-cells = <2>;
>>> +   interrupt-controller;
>>> +   reg = <10c00 80>;
>>> +   compatible = "fsl,mpc8280-pic", "fsl,pq2-pic";
>>
>> this should also have a "fsl,cpm2-pic" or something of that form.
>> (exact same pic exists on 8560, 85xx+CPM)
>
> OK...  I did it as pq2 rather than cpm2 because IIRC it wasn't  
> described
> under the CPM section of the manual, so I didn't know if 85xx CPM2 had
> the same thing.

No problem.  The cpm2_* code in the kernel is used on 85xx's that  
have a CPM and I don't think we have that much ifdef for 85xx  
specific CPM foo.  Only thing I can think of is this bit in cpm2.h:

#if defined(CONFIG_8272) || defined(CONFIG_MPC8555)
#define CPM_DATAONLY_SIZE   ((uint)(8 * 1024) - CPM_DATAONLY_BASE)
#define CPM_FCC_SPECIAL_BASE((uint)0x9000)
#else

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


[PATCH 19/22] [POWERPC] 86xx: Fix definition of global-utilites structure

2007-09-13 Thread Kumar Gala
From: Timur Tabi <[EMAIL PROTECTED]>

The current definition of struct ccsr_guts in immap_86xx.h was for 85xx.
This patch fixes that and replaces the vague integer types with sized types
of the correct endianness.  The unused struct ccsr_pci is also deleted.

Signed-off-by: Timur Tabi <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 include/asm-powerpc/immap_86xx.h |  151 --
 1 files changed, 46 insertions(+), 105 deletions(-)

diff --git a/include/asm-powerpc/immap_86xx.h b/include/asm-powerpc/immap_86xx.h
index 59b9e07..c83d7ad 100644
--- a/include/asm-powerpc/immap_86xx.h
+++ b/include/asm-powerpc/immap_86xx.h
@@ -1,124 +1,65 @@
-/*
+/**
  * MPC86xx Internal Memory Map
  *
- * Author: Jeff Brown
+ * Authors: Jeff Brown
+ *  Timur Tabi <[EMAIL PROTECTED]>
  *
- * Copyright 2004 Freescale Semiconductor, Inc
+ * Copyright 2004,2007 Freescale Semiconductor, Inc
  *
  * 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.
  *
+ * This header file defines structures for various 86xx SOC devices that are
+ * used by multiple source files.
  */
 
 #ifndef __ASM_POWERPC_IMMAP_86XX_H__
 #define __ASM_POWERPC_IMMAP_86XX_H__
 #ifdef __KERNEL__
 
-/* Eventually this should define all the IO block registers in 86xx */
-
-/* PCI Registers */
-typedef struct ccsr_pci {
-   uintcfg_addr;   /* 0x.000 - PCI Configuration Address Register 
*/
-   uintcfg_data;   /* 0x.004 - PCI Configuration Data Register */
-   uintint_ack;/* 0x.008 - PCI Interrupt Acknowledge Register 
*/
-   charres1[3060];
-   uintpotar0; /* 0x.c00 - PCI Outbound Transaction Address 
Register 0 */
-   uintpotear0;/* 0x.c04 - PCI Outbound Translation Extended 
Address Register 0 */
-   uintpowbar0;/* 0x.c08 - PCI Outbound Window Base Address 
Register 0 */
-   charres2[4];
-   uintpowar0; /* 0x.c10 - PCI Outbound Window Attributes 
Register 0 */
-   charres3[12];
-   uintpotar1; /* 0x.c20 - PCI Outbound Transaction Address 
Register 1 */
-   uintpotear1;/* 0x.c24 - PCI Outbound Translation Extended 
Address Register 1 */
-   uintpowbar1;/* 0x.c28 - PCI Outbound Window Base Address 
Register 1 */
-   charres4[4];
-   uintpowar1; /* 0x.c30 - PCI Outbound Window Attributes 
Register 1 */
-   charres5[12];
-   uintpotar2; /* 0x.c40 - PCI Outbound Transaction Address 
Register 2 */
-   uintpotear2;/* 0x.c44 - PCI Outbound Translation Extended 
Address Register 2 */
-   uintpowbar2;/* 0x.c48 - PCI Outbound Window Base Address 
Register 2 */
-   charres6[4];
-   uintpowar2; /* 0x.c50 - PCI Outbound Window Attributes 
Register 2 */
-   charres7[12];
-   uintpotar3; /* 0x.c60 - PCI Outbound Transaction Address 
Register 3 */
-   uintpotear3;/* 0x.c64 - PCI Outbound Translation Extended 
Address Register 3 */
-   uintpowbar3;/* 0x.c68 - PCI Outbound Window Base Address 
Register 3 */
-   charres8[4];
-   uintpowar3; /* 0x.c70 - PCI Outbound Window Attributes 
Register 3 */
-   charres9[12];
-   uintpotar4; /* 0x.c80 - PCI Outbound Transaction Address 
Register 4 */
-   uintpotear4;/* 0x.c84 - PCI Outbound Translation Extended 
Address Register 4 */
-   uintpowbar4;/* 0x.c88 - PCI Outbound Window Base Address 
Register 4 */
-   charres10[4];
-   uintpowar4; /* 0x.c90 - PCI Outbound Window Attributes 
Register 4 */
-   charres11[268];
-   uintpitar3; /* 0x.da0 - PCI Inbound Translation Address 
Register 3  */
-   charres12[4];
-   uintpiwbar3;/* 0x.da8 - PCI Inbound Window Base Address 
Register 3 */
-   uintpiwbear3;   /* 0x.dac - PCI Inbound Window Base Extended 
Address Register 3 */
-   uintpiwar3; /* 0x.db0 - PCI Inbound Window Attributes 
Register 3 */
-   charres13[12];
-   uintpitar2; /* 0x.dc0 - PCI Inbound Translation Address 
Register 2  */
-   charres14[4];
-   uintpiwbar2;/* 0x.dc8 - PCI Inbound Window Base Address 
Register 2 */
-   uintpiwbear2;   /* 0x.dcc - PCI Inbound Window Base Extended 
Address Register 2 */
-   uintpiwar2; /* 0x.dd0 - PCI Inbound Window Attributes 
Register 2 */
-   charres15[12];
-   uintpitar1; /* 0x.de0 - PCI Inbound Translation Address 
Register 1  */
-   charres16[4];
-   uintpiwbar1;/* 0x.de8 - PCI Inbound Window Base Address 

[PATCH 18/22] [POWERPC] add clrsetbits macros

2007-09-13 Thread Kumar Gala
From: Timur Tabi <[EMAIL PROTECTED]>

This patch adds the clrsetbits_xxx() macros, which are used to set and clear
multiple bits in a single read-modify-write operation.  Specify the bits to
clear in the 'clear' parameter and the bits to set in the 'set' parameter.
These macros can also be used to set a multiple-bit bit pattern using a mask,
by specifying the mask in the 'clear' parameter and the new bit pattern in the
'set' parameter.  There are big-endian and little-endian versions for 8, 16,
32, and 64 bits.

Signed-off-by: Timur Tabi <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 include/asm-powerpc/io.h |   23 +++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 4c0b550..6805efb 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -737,6 +737,29 @@ static inline void * bus_to_virt(unsigned long address)
 #define setbits8(_addr, _v) out_8((_addr), in_8(_addr) |  (_v))
 #define clrbits8(_addr, _v) out_8((_addr), in_8(_addr) & ~(_v))
 
+/* Clear and set bits in one shot.  These macros can be used to clear and
+ * set multiple bits in a register using a single read-modify-write.  These
+ * macros can also be used to set a multiple-bit bit pattern using a mask,
+ * by specifying the mask in the 'clear' parameter and the new bit pattern
+ * in the 'set' parameter.
+ */
+
+#define clrsetbits(type, addr, clear, set) \
+   out_##type((addr), (in_##type(addr) & ~(clear)) | (set))
+
+#ifdef __powerpc64__
+#define clrsetbits_be64(addr, clear, set) clrsetbits(be64, addr, clear, set)
+#define clrsetbits_le64(addr, clear, set) clrsetbits(le64, addr, clear, set)
+#endif
+
+#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set)
+#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set)
+
+#define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set)
+#define clrsetbits_le16(addr, clear, set) clrsetbits(le32, addr, clear, set)
+
+#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
+
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_POWERPC_IO_H */
-- 
1.5.2.4

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


[PATCH 22/22] [POWERPC] MPC832x_RDB: Update dts to use SPI1 in QE, register mmc_spi stub

2007-09-13 Thread Kumar Gala
From: Anton Vorontsov <[EMAIL PROTECTED]>

mmc_spi already tested to work. When it will hit mainline
the only change that will be needed is replacing "spidev"
with "mmc_spi".

Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/mpc832x_rdb.dts |2 +-
 arch/powerpc/platforms/83xx/mpc832x_rdb.c |   46 +
 2 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts 
b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index cdc4a94..388c8a7 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -175,7 +175,7 @@
reg = <4c0 40>;
interrupts = <2>;
interrupt-parent = <&qeic>;
-   mode = "cpu";
+   mode = "cpu-qe";
};
 
[EMAIL PROTECTED] {
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c 
b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index e6c1760..24a790c 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -15,6 +15,7 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 
@@ -22,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "mpc83xx.h"
 
@@ -32,6 +34,50 @@
 #define DBG(fmt...)
 #endif
 
+static void mpc83xx_spi_activate_cs(u8 cs, u8 polarity)
+{
+   pr_debug("%s %d %d\n", __func__, cs, polarity);
+   par_io_data_set(3, 13, polarity);
+}
+
+static void mpc83xx_spi_deactivate_cs(u8 cs, u8 polarity)
+{
+   pr_debug("%s %d %d\n", __func__, cs, polarity);
+   par_io_data_set(3, 13, !polarity);
+}
+
+static struct spi_board_info mpc832x_spi_boardinfo = {
+   .bus_num = 0x4c0,
+   .chip_select = 0,
+   .max_speed_hz = 5000,
+   /*
+* XXX: This is spidev (spi in userspace) stub, should
+* be replaced by "mmc_spi" when mmc_spi will hit mainline.
+*/
+   .modalias = "spidev",
+};
+
+static int __init mpc832x_spi_init(void)
+{
+   if (!machine_is(mpc832x_rdb))
+   return 0;
+
+   par_io_config_pin(3,  0, 3, 0, 1, 0); /* SPI1 MOSI, I/O */
+   par_io_config_pin(3,  1, 3, 0, 1, 0); /* SPI1 MISO, I/O */
+   par_io_config_pin(3,  2, 3, 0, 1, 0); /* SPI1 CLK,  I/O */
+   par_io_config_pin(3,  3, 2, 0, 1, 0); /* SPI1 SEL,  I   */
+
+   par_io_config_pin(3, 13, 1, 0, 0, 0); /* !SD_CS,O */
+   par_io_config_pin(3, 14, 2, 0, 0, 0); /* SD_INSERT, I */
+   par_io_config_pin(3, 15, 2, 0, 0, 0); /* SD_PROTECT,I */
+
+   return fsl_spi_init(&mpc832x_spi_boardinfo, 1,
+   mpc83xx_spi_activate_cs,
+   mpc83xx_spi_deactivate_cs);
+}
+
+device_initcall(mpc832x_spi_init);
+
 /* 
  *
  * Setup the architecture
-- 
1.5.2.4

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


[PATCH 20/22] [POWERPC] 52xx: Fix mpc52xx_uart_of_assign to use correct index

2007-09-13 Thread Kumar Gala
From: John Rigby <[EMAIL PROTECTED]>

Use idx as index into mpc52xx_uart_nodes instead of i

Signed-off-by: John Rigby <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 drivers/serial/mpc52xx_uart.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 35f8b86..035cca0 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -1051,7 +1051,7 @@ mpc52xx_uart_of_assign(struct device_node *np, int idx)
/* If the slot is already occupied, then swap slots */
if (mpc52xx_uart_nodes[idx] && (free_idx != -1))
mpc52xx_uart_nodes[free_idx] = mpc52xx_uart_nodes[idx];
-   mpc52xx_uart_nodes[i] = np;
+   mpc52xx_uart_nodes[idx] = np;
 }
 
 static void
-- 
1.5.2.4

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


[PATCH 21/22] [POWERPC] fsl_soc: add support for fsl_spi

2007-09-13 Thread Kumar Gala
From: Anton Vorontsov <[EMAIL PROTECTED]>

Add helper function to setup SPI bus/device information

Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/fsl_soc.c |   87 +
 arch/powerpc/sysdev/fsl_soc.h |7 +++
 2 files changed, 94 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 7012e51..d028e8d 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1199,3 +1200,89 @@ err:
 arch_initcall(cpm_smc_uart_of_init);
 
 #endif /* CONFIG_8xx */
+
+int __init fsl_spi_init(struct spi_board_info *board_infos,
+   unsigned int num_board_infos,
+   void (*activate_cs)(u8 cs, u8 polarity),
+   void (*deactivate_cs)(u8 cs, u8 polarity))
+{
+   struct device_node *np;
+   unsigned int i;
+   const u32 *sysclk;
+
+   np = of_find_node_by_type(NULL, "qe");
+   if (!np)
+   return -ENODEV;
+
+   sysclk = of_get_property(np, "bus-frequency", NULL);
+   if (!sysclk)
+   return -ENODEV;
+
+   for (np = NULL, i = 1;
+(np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
+i++) {
+   int ret = 0;
+   unsigned int j;
+   const void *prop;
+   struct resource res[2];
+   struct platform_device *pdev;
+   struct fsl_spi_platform_data pdata = {
+   .activate_cs = activate_cs,
+   .deactivate_cs = deactivate_cs,
+   };
+
+   memset(res, 0, sizeof(res));
+
+   pdata.sysclk = *sysclk;
+
+   prop = of_get_property(np, "reg", NULL);
+   if (!prop)
+   goto err;
+   pdata.bus_num = *(u32 *)prop;
+
+   prop = of_get_property(np, "mode", NULL);
+   if (prop && !strcmp(prop, "cpu-qe"))
+   pdata.qe_mode = 1;
+
+   for (j = 0; j < num_board_infos; j++) {
+   if (board_infos[j].bus_num == pdata.bus_num)
+   pdata.max_chipselect++;
+   }
+
+   if (!pdata.max_chipselect)
+   goto err;
+
+   ret = of_address_to_resource(np, 0, &res[0]);
+   if (ret)
+   goto err;
+
+   ret = of_irq_to_resource(np, 0, &res[1]);
+   if (ret == NO_IRQ)
+   goto err;
+
+   pdev = platform_device_alloc("mpc83xx_spi", i);
+   if (!pdev)
+   goto err;
+
+   ret = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+   if (ret)
+   goto unreg;
+
+   ret = platform_device_add_resources(pdev, res,
+   ARRAY_SIZE(res));
+   if (ret)
+   goto unreg;
+
+   ret = platform_device_register(pdev);
+   if (ret)
+   goto unreg;
+
+   continue;
+unreg:
+   platform_device_del(pdev);
+err:
+   continue;
+   }
+
+   return spi_register_board_info(board_infos, num_board_infos);
+}
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 04e145b..618d91d 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -8,5 +8,12 @@ extern phys_addr_t get_immrbase(void);
 extern u32 get_brgfreq(void);
 extern u32 get_baudrate(void);
 
+struct spi_board_info;
+
+extern int fsl_spi_init(struct spi_board_info *board_infos,
+   unsigned int num_board_infos,
+   void (*activate_cs)(u8 cs, u8 polarity),
+   void (*deactivate_cs)(u8 cs, u8 polarity));
+
 #endif
 #endif
-- 
1.5.2.4

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


[PATCH 16/22] [PPC] Add clrbits8 and setbits8.

2007-09-13 Thread Kumar Gala
From: Scott Wood <[EMAIL PROTECTED]>

These I/O accessors will be used in code under drivers/,
which is expected to still work in arch/ppc.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 include/asm-ppc/io.h |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 95d5904..f776c49 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -553,4 +553,7 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem 
*);
 #define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) |  (_v))
 #define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v))
 
+#define setbits8(_addr, _v) out_8((_addr), in_8(_addr) |  (_v))
+#define clrbits8(_addr, _v) out_8((_addr), in_8(_addr) & ~(_v))
+
 #endif /* __KERNEL__ */
-- 
1.5.2.4

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


[PATCH 17/22] [POWERPC] QE: extern par_io_config_pin and par_io_data_set funcs

2007-09-13 Thread Kumar Gala
From: Anton Vorontsov <[EMAIL PROTECTED]>

This is needed to configure and control QE pario pins from the kernel.

Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 include/asm-powerpc/qe.h |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h
index 9d304b1..ad23c58 100644
--- a/include/asm-powerpc/qe.h
+++ b/include/asm-powerpc/qe.h
@@ -32,6 +32,9 @@
 extern void qe_reset(void);
 extern int par_io_init(struct device_node *np);
 extern int par_io_of_config(struct device_node *np);
+extern int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
+int assignment, int has_irq);
+extern int par_io_data_set(u8 port, u8 pin, u8 val);
 
 /* QE internal API */
 int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
-- 
1.5.2.4

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


[PATCH 15/22] [POWERPC] Fix modpost warnings from head*.S on ppc32

2007-09-13 Thread Kumar Gala
We get warnings like the following from the various ppc32 head*.S files:

WARNING: vmlinux.o(.text+0x358): Section mismatch: reference to 
.init.text:early_init (between 'skpinv' and 'interrupt_base')
WARNING: vmlinux.o(.text+0x380): Section mismatch: reference to 
.init.text:machine_init (between 'skpinv' and 'interrupt_base')
WARNING: vmlinux.o(.text+0x384): Section mismatch: reference to 
.init.text:MMU_init (between 'skpinv' and 'interrupt_base')
WARNING: vmlinux.o(.text+0x3aa): Section mismatch: reference to 
.init.text:start_kernel (between 'skpinv' and 'interrupt_base')
WARNING: vmlinux.o(.text+0x3ae): Section mismatch: reference to 
.init.text:start_kernel (between 'skpinv' and 'interrupt_base')

Added a .text.head section simliar to what other architectures do since
modpost already excludes this from its warnings.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/head_32.S|   17 +++--
 arch/powerpc/kernel/head_40x.S   |   12 ++--
 arch/powerpc/kernel/head_44x.S   |6 +++---
 arch/powerpc/kernel/head_8xx.S   |9 +++--
 arch/powerpc/kernel/head_fsl_booke.S |6 +++---
 arch/powerpc/kernel/vmlinux.lds.S|2 ++
 include/asm-powerpc/ppc_asm.h|4 
 7 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 0e3df1f..12febfe 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -48,20 +48,17 @@
mtspr   SPRN_DBAT##n##L,RB; \
 1:
 
-   .text
+   .section.text.head, "ax"
.stabs  "arch/powerpc/kernel/",N_SO,0,0,0f
.stabs  "head_32.S",N_SO,0,0,0f
 0:
-   .globl  _stext
-_stext:
+_ENTRY(_stext);
 
 /*
  * _start is defined this way because the XCOFF loader in the OpenFirmware
  * on the powermac expects the entry point to be a procedure descriptor.
  */
-   .text
-   .globl  _start
-_start:
+_ENTRY(_start);
/*
 * These are here for legacy reasons, the kernel used to
 * need to look like a coff function entry for the pmac
@@ -841,7 +838,7 @@ relocate_kernel:
  * r3 = dest addr, r4 = source addr, r5 = copy limit, r6 = start offset
  * on exit, r3, r4, r5 are unchanged, r6 is updated to be >= r5.
  */
-_GLOBAL(copy_and_flush)
+_ENTRY(copy_and_flush)
addir5,r5,-4
addir6,r6,-4
 4: li  r0,L1_CACHE_BYTES/4
@@ -954,9 +951,9 @@ __secondary_start:
  * included in CONFIG_6xx
  */
 #if !defined(CONFIG_6xx)
-_GLOBAL(__save_cpu_setup)
+_ENTRY(__save_cpu_setup)
blr
-_GLOBAL(__restore_cpu_setup)
+_ENTRY(__restore_cpu_setup)
blr
 #endif /* !defined(CONFIG_6xx) */
 
@@ -1080,7 +1077,7 @@ start_here:
 /*
  * Set up the segment registers for a new context.
  */
-_GLOBAL(set_context)
+_ENTRY(set_context)
mulli   r3,r3,897   /* multiply context by skew factor */
rlwinm  r3,r3,4,8,27/* VSID = (context & 0xf) << 4 */
addis   r3,r3,0x6000/* Set Ks, Ku bits */
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index a8e0457..00bdb6d 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -52,9 +52,9 @@
  *
  * This is all going to change RSN when we add bi_recs...  -- Dan
  */
-   .text
-_GLOBAL(_stext)
-_GLOBAL(_start)
+   .section.text.head, "ax"
+_ENTRY(_stext);
+_ENTRY(_start);
 
/* Save parameters we are passed.
*/
@@ -89,9 +89,9 @@ turn_on_mmu:
  */
. = 0xc0
 crit_save:
-_GLOBAL(crit_r10)
+_ENTRY(crit_r10)
.space  4
-_GLOBAL(crit_r11)
+_ENTRY(crit_r11)
.space  4
 
 /*
@@ -814,7 +814,7 @@ finish_tlb_load:
  * The PowerPC 4xx family of processors do not have an FPU, so this just
  * returns.
  */
-_GLOBAL(giveup_fpu)
+_ENTRY(giveup_fpu)
blr
 
 /* This is where the main kernel code starts.
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index e26d26e..a3dc0e4 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -50,9 +50,9 @@
  *   r7 - End of kernel command line string
  *
  */
-   .text
-_GLOBAL(_stext)
-_GLOBAL(_start)
+   .section.text.head, "ax"
+_ENTRY(_stext);
+_ENTRY(_start);
/*
 * Reserve a word at a fixed location to store the address
 * of abatron_pteptrs
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 901be47..a6ecdd6 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -38,12 +38,9 @@
 #else
 #define DO_8xx_CPU6(val, reg)
 #endif
-   .text
-   .globl  _stext
-_stext:
-   .text
-   .globl  _start
-_start:
+   .section.text.head, "ax"
+_ENTRY(_stext);
+_ENTRY(_start);
 
 /* MPC8xx
  * This port was done on an MBX board with an 860.  Right now I only
diff --git a/arch/powerpc/kernel/head_fsl_booke.S 
b/arch/powerpc/kernel/head_fsl_booke.S
index 1f155d3..d8

[PATCH 14/22] [POWERPC] Add cpu feature for SPE handling

2007-09-13 Thread Kumar Gala
Make it so that SPE support can be determined at runtime.  This is similiar
to how we handle AltiVec.  This allows us to have SPE support built in and
work on processors with and without SPE.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/cputable.c |   23 +++
 arch/powerpc/kernel/entry_32.S |4 
 arch/powerpc/kernel/process.c  |   15 +++
 arch/powerpc/kernel/ptrace.c   |6 ++
 include/asm-powerpc/cputable.h |   26 ++
 5 files changed, 46 insertions(+), 28 deletions(-)

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 5873073..8eb8087 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -68,15 +68,6 @@ extern void __restore_cpu_ppc970(void);
 #define COMMON_USER_BOOKE  (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
 PPC_FEATURE_BOOKE)
 
-/* We only set the spe features if the kernel was compiled with
- * spe support
- */
-#ifdef CONFIG_SPE
-#define PPC_FEATURE_SPE_COMP   PPC_FEATURE_HAS_SPE
-#else
-#define PPC_FEATURE_SPE_COMP   0
-#endif
-
 static struct cpu_spec cpu_specs[] = {
 #ifdef CONFIG_PPC64
{   /* Power3 */
@@ -1261,8 +1252,8 @@ static struct cpu_spec cpu_specs[] = {
/* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
.cpu_features   = CPU_FTRS_E200,
.cpu_user_features  = COMMON_USER_BOOKE |
-   PPC_FEATURE_SPE_COMP |
-   PPC_FEATURE_HAS_EFP_SINGLE |
+   PPC_FEATURE_HAS_SPE_COMP |
+   PPC_FEATURE_HAS_EFP_SINGLE_COMP |
PPC_FEATURE_UNIFIED_CACHE,
.dcache_bsize   = 32,
.platform   = "ppc5554",
@@ -1274,8 +1265,8 @@ static struct cpu_spec cpu_specs[] = {
/* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
.cpu_features   = CPU_FTRS_E500,
.cpu_user_features  = COMMON_USER_BOOKE |
-   PPC_FEATURE_SPE_COMP |
-   PPC_FEATURE_HAS_EFP_SINGLE,
+   PPC_FEATURE_HAS_SPE_COMP |
+   PPC_FEATURE_HAS_EFP_SINGLE_COMP,
.icache_bsize   = 32,
.dcache_bsize   = 32,
.num_pmcs   = 4,
@@ -1290,9 +1281,9 @@ static struct cpu_spec cpu_specs[] = {
/* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
.cpu_features   = CPU_FTRS_E500_2,
.cpu_user_features  = COMMON_USER_BOOKE |
-   PPC_FEATURE_SPE_COMP |
-   PPC_FEATURE_HAS_EFP_SINGLE |
-   PPC_FEATURE_HAS_EFP_DOUBLE,
+   PPC_FEATURE_HAS_SPE_COMP |
+   PPC_FEATURE_HAS_EFP_SINGLE_COMP |
+   PPC_FEATURE_HAS_EFP_DOUBLE_COMP,
.icache_bsize   = 32,
.dcache_bsize   = 32,
.num_pmcs   = 4,
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 4074c0b..21d889e 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -504,9 +504,11 @@ BEGIN_FTR_SECTION
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 #endif /* CONFIG_ALTIVEC */
 #ifdef CONFIG_SPE
+BEGIN_FTR_SECTION
orisr0,r0,[EMAIL PROTECTED]  /* Disable SPE */
mfspr   r12,SPRN_SPEFSCR /* save spefscr register value */
stw r12,THREAD+THREAD_SPEFSCR(r2)
+END_FTR_SECTION_IFSET(CPU_FTR_SPE)
 #endif /* CONFIG_SPE */
and.r0,r0,r11   /* FP or altivec or SPE enabled? */
beq+1f
@@ -542,8 +544,10 @@ BEGIN_FTR_SECTION
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 #endif /* CONFIG_ALTIVEC */
 #ifdef CONFIG_SPE
+BEGIN_FTR_SECTION
lwz r0,THREAD+THREAD_SPEFSCR(r2)
mtspr   SPRN_SPEFSCR,r0 /* restore SPEFSCR reg */
+END_FTR_SECTION_IFSET(CPU_FTR_SPE)
 #endif /* CONFIG_SPE */
 
lwz r0,_CCR(r1)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index e477c9d..57c589c 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -669,9 +669,13 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int 
val)
 * mode (asyn, precise, disabled) for 'Classic' FP. */
if (val & PR_FP_EXC_SW_ENABLE) {
 #ifdef CONFIG_SPE
-   tsk->thread.fpexc_mode = val &
-   (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT);
-   return 0;
+   if (cpu_has_feature(CPU_FTR_SPE)) {
+   tsk->thread.fpexc_mode = val &
+   (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT);
+   return 0;
+   } else {
+   return -EINVAL;
+   }
 #else
return -EINVAL;
 #endif
@@ -697,7 +701

[PATCH 13/22] [POWERPC] 83xx: Removed PCI exclude of PHB

2007-09-13 Thread Kumar Gala
Now that the generic code doesn't assign resources for Freescale
PHBs we dont have to explicitly exclude it.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/83xx/mpc8313_rdb.c |2 --
 arch/powerpc/platforms/83xx/mpc832x_mds.c |1 -
 arch/powerpc/platforms/83xx/mpc832x_rdb.c |2 --
 arch/powerpc/platforms/83xx/mpc834x_itx.c |2 --
 arch/powerpc/platforms/83xx/mpc834x_mds.c |2 --
 arch/powerpc/platforms/83xx/mpc836x_mds.c |1 -
 arch/powerpc/platforms/83xx/mpc83xx.h |2 --
 arch/powerpc/platforms/83xx/pci.c |7 ---
 8 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/mpc8313_rdb.c 
b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
index 3edfe17..140b46f 100644
--- a/arch/powerpc/platforms/83xx/mpc8313_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
@@ -45,8 +45,6 @@ static void __init mpc8313_rdb_setup_arch(void)
 #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
mpc83xx_add_bridge(np);
-
-   ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
mpc831x_usb_cfg();
 }
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c 
b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 61e3f1c..d494bc4 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -75,7 +75,6 @@ static void __init mpc832x_sys_setup_arch(void)
 #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
mpc83xx_add_bridge(np);
-   ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
 
 #ifdef CONFIG_QUICC_ENGINE
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c 
b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index 0909061..e6c1760 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -49,8 +49,6 @@ static void __init mpc832x_rdb_setup_arch(void)
 #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
mpc83xx_add_bridge(np);
-
-   ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
 
 #ifdef CONFIG_QUICC_ENGINE
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c 
b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 6d06645..870fd20 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -54,8 +54,6 @@ static void __init mpc834x_itx_setup_arch(void)
 #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
mpc83xx_add_bridge(np);
-
-   ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
 
mpc834x_usb_cfg();
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c 
b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index f8aba9a..a9140b6 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -85,8 +85,6 @@ static void __init mpc834x_mds_setup_arch(void)
 #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
mpc83xx_add_bridge(np);
-
-   ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
 
mpc834xemds_usb_cfg();
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c 
b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 69970b9..db69576 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -81,7 +81,6 @@ static void __init mpc836x_mds_setup_arch(void)
 #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
mpc83xx_add_bridge(np);
-   ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
 
 #ifdef CONFIG_QUICC_ENGINE
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h 
b/arch/powerpc/platforms/83xx/mpc83xx.h
index 589ee55..b778cb4 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -49,8 +49,6 @@
  */
 
 extern int mpc83xx_add_bridge(struct device_node *dev);
-extern int mpc83xx_exclude_device(struct pci_controller *hose,
- u_char bus, u_char devfn);
 extern void mpc83xx_restart(char *cmd);
 extern long mpc83xx_time_init(void);
 extern int mpc834x_usb_cfg(void);
diff --git a/arch/powerpc/platforms/83xx/pci.c 
b/arch/powerpc/platforms/83xx/pci.c
index 9206946..80425d7 100644
--- a/arch/powerpc/platforms/83xx/pci.c
+++ b/arch/powerpc/platforms/83xx/pci.c
@@ -33,13 +33,6 @@
 #define DBG(x...)
 #endif
 
-int mpc83xx_exclude_device(struct pci_controller *hose, u_char bus, u_char 
devfn)
-{
-   if ((bus == hose->first_busno) && PCI_SLOT(devfn) == 0)
-   return PCIBIOS_DEVICE_NOT_FOUND;
-   return PCIBIOS_SUCCESSFUL;
-}
-
 int __init mpc83xx_add_bridge(struct device_node *dev)
 {
int len;
-- 
1.5.2.4

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

[PATCH 11/22] [POWERPC] DTS cleanup

2007-09-13 Thread Kumar Gala
Removed the following cruft from .dts files:
* 32-bit in cpu node -- doesn't exist in any spec and not used by kernel
* removed built-in (chrp legacy)
* Removed #interrupt-cells in places they don't need to be set
* Fixed ranges on lite5200*
* Removed clock-frequency from i8259 pic node, not sure where this came from
* Removed big-endian from i8259 pic nodes, this was just bogus

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/holly.dts  |1 -
 arch/powerpc/boot/dts/kuroboxHD.dts  |2 --
 arch/powerpc/boot/dts/kuroboxHG.dts  |2 --
 arch/powerpc/boot/dts/lite5200.dts   |7 ++-
 arch/powerpc/boot/dts/lite5200b.dts  |7 ++-
 arch/powerpc/boot/dts/mpc7448hpc2.dts|4 
 arch/powerpc/boot/dts/mpc8272ads.dts |5 -
 arch/powerpc/boot/dts/mpc8313erdb.dts|3 ---
 arch/powerpc/boot/dts/mpc832x_mds.dts|4 
 arch/powerpc/boot/dts/mpc832x_rdb.dts|4 
 arch/powerpc/boot/dts/mpc8349emitx.dts   |3 ---
 arch/powerpc/boot/dts/mpc8349emitxgp.dts |3 ---
 arch/powerpc/boot/dts/mpc834x_mds.dts|3 ---
 arch/powerpc/boot/dts/mpc836x_mds.dts|4 
 arch/powerpc/boot/dts/mpc8540ads.dts |3 ---
 arch/powerpc/boot/dts/mpc8541cds.dts |6 --
 arch/powerpc/boot/dts/mpc8544ds.dts  |5 -
 arch/powerpc/boot/dts/mpc8548cds.dts |5 -
 arch/powerpc/boot/dts/mpc8555cds.dts |6 --
 arch/powerpc/boot/dts/mpc8560ads.dts |5 -
 arch/powerpc/boot/dts/mpc8568mds.dts |4 
 arch/powerpc/boot/dts/mpc8641_hpcn.dts   |6 --
 arch/powerpc/boot/dts/mpc866ads.dts  |5 -
 arch/powerpc/boot/dts/mpc885ads.dts  |5 -
 arch/powerpc/boot/dts/prpmc2800.dts  |1 -
 25 files changed, 4 insertions(+), 99 deletions(-)

diff --git a/arch/powerpc/boot/dts/holly.dts b/arch/powerpc/boot/dts/holly.dts
index 1a4d0be..b5d8789 100644
--- a/arch/powerpc/boot/dts/holly.dts
+++ b/arch/powerpc/boot/dts/holly.dts
@@ -31,7 +31,6 @@
timebase-frequency = <2faf080>;
clock-frequency = <23c34600>;
bus-frequency = ;
-   32-bit;
};
};
 
diff --git a/arch/powerpc/boot/dts/kuroboxHD.dts 
b/arch/powerpc/boot/dts/kuroboxHD.dts
index a7b3714..ec71ab8 100644
--- a/arch/powerpc/boot/dts/kuroboxHD.dts
+++ b/arch/powerpc/boot/dts/kuroboxHD.dts
@@ -47,7 +47,6 @@  add flash parts, rtc, ??
soc10x { /* AFAICT need to make soc for 8245's uarts to be defined */
#address-cells = <1>;
#size-cells = <1>;
-   #interrupt-cells = <2>;
device_type = "soc";
compatible = "mpc10x";
store-gathering = <0>; /* 0 == off, !0 == on */
@@ -101,7 +100,6 @@  add flash parts, rtc, ??
compatible = "chrp,open-pic";
interrupt-controller;
reg = <8004 4>;
-   built-in;
};
 
[EMAIL PROTECTED] {
diff --git a/arch/powerpc/boot/dts/kuroboxHG.dts 
b/arch/powerpc/boot/dts/kuroboxHG.dts
index a0007b9..32ecd23 100644
--- a/arch/powerpc/boot/dts/kuroboxHG.dts
+++ b/arch/powerpc/boot/dts/kuroboxHG.dts
@@ -47,7 +47,6 @@  add flash parts, rtc, ??
soc10x { /* AFAICT need to make soc for 8245's uarts to be defined */
#address-cells = <1>;
#size-cells = <1>;
-   #interrupt-cells = <2>;
device_type = "soc";
compatible = "mpc10x";
store-gathering = <0>; /* 0 == off, !0 == on */
@@ -101,7 +100,6 @@  add flash parts, rtc, ??
compatible = "chrp,open-pic";
interrupt-controller;
reg = <8004 4>;
-   built-in;
};
 
[EMAIL PROTECTED] {
diff --git a/arch/powerpc/boot/dts/lite5200.dts 
b/arch/powerpc/boot/dts/lite5200.dts
index d29308f..d8bcbb8 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -37,7 +37,6 @@
timebase-frequency = <0>;   // from bootloader
bus-frequency = <0>;// from bootloader
clock-frequency = <0>;  // from bootloader
-   32-bit;
};
};
 
@@ -50,10 +49,9 @@
model = "fsl,mpc5200";
compatible = "mpc5200";
revision = "";  // from bootloader
-   #interrupt-cells = <3>;
device_type = "soc";
-   ranges = <0 f000 f001>;
-   reg = ;
+   ranges = <0 f000 c000>;
+   reg = ;
bus-frequency = <0>;// from bootloader
system-frequency = <0>;

[PATCH 08/22] [POWERPC] fsl_soc.c cleanup

2007-09-13 Thread Kumar Gala
From: Scott Wood <[EMAIL PROTECTED]>

1. Update the way get_brgfreq() finds things in the device tree.

It now uses names that are less namespace polluting.  The old names
are supported until all boards are converted.

2. "size" is changed from unsigned int to int, to match what
of_get_property() expects.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/fsl_soc.c |   27 +--
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index f3abce1..7012e51 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -52,13 +52,13 @@ phys_addr_t get_immrbase(void)
 
soc = of_find_node_by_type(NULL, "soc");
if (soc) {
-   unsigned int size;
+   int size;
const void *prop = of_get_property(soc, "reg", &size);
 
if (prop)
immrbase = of_translate_address(soc, prop);
of_node_put(soc);
-   };
+   }
 
return immrbase;
 }
@@ -76,16 +76,23 @@ u32 get_brgfreq(void)
if (brgfreq != -1)
return brgfreq;
 
-   node = of_find_node_by_type(NULL, "cpm");
+   node = of_find_compatible_node(NULL, NULL, "fsl,cpm1");
+   if (!node)
+   node = of_find_compatible_node(NULL, NULL, "fsl,cpm2");
+   if (!node)
+   node = of_find_node_by_type(NULL, "cpm");
if (node) {
-   unsigned int size;
-   const unsigned int *prop = of_get_property(node,
-   "brg-frequency", &size);
+   int size;
+   const unsigned int *prop;
 
-   if (prop)
+   prop = of_get_property(node, "fsl,brg-frequency", &size);
+   if (!prop)
+   prop = of_get_property(node, "brg-frequency", &size);
+   if (prop && size == 4)
brgfreq = *prop;
+
of_node_put(node);
-   };
+   }
 
return brgfreq;
 }
@@ -103,14 +110,14 @@ u32 get_baudrate(void)
 
node = of_find_node_by_type(NULL, "serial");
if (node) {
-   unsigned int size;
+   int size;
const unsigned int *prop = of_get_property(node,
"current-speed", &size);
 
if (prop)
fs_baudrate = *prop;
of_node_put(node);
-   };
+   }
 
return fs_baudrate;
 }
-- 
1.5.2.4

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


[PATCH 10/22] [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port

2007-09-13 Thread Kumar Gala
Added basic board port for MPC8572 DS reference platform that is
similiar to the MPC8544/33 DS reference platform in uniprocessor mode.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/mpc8572ds.dts   |  404 
 arch/powerpc/configs/mpc8572_ds_defconfig | 1496 +
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  |   31 +
 arch/powerpc/sysdev/fsl_pci.c |2 +
 include/linux/pci_ids.h   |2 +
 5 files changed, 1935 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/mpc8572ds.dts
 create mode 100644 arch/powerpc/configs/mpc8572_ds_defconfig

diff --git a/arch/powerpc/boot/dts/mpc8572ds.dts 
b/arch/powerpc/boot/dts/mpc8572ds.dts
new file mode 100644
index 000..d638dee
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8572ds.dts
@@ -0,0 +1,404 @@
+/*
+ * MPC8572 DS Device Tree Source
+ *
+ * Copyright 2007 Freescale Semiconductor Inc.
+ *
+ * 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.
+ */
+
+/ {
+   model = "fsl,MPC8572DS";
+   compatible = "fsl,MPC8572DS";
+   #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>;   // 32 bytes
+   i-cache-line-size = <20>;   // 32 bytes
+   d-cache-size = <8000>;  // L1, 32K
+   i-cache-size = <8000>;  // L1, 32K
+   timebase-frequency = <0>;
+   bus-frequency = <0>;
+   clock-frequency = <0>;
+   };
+   };
+
+   memory {
+   device_type = "memory";
+   reg = < >;  // Filled by U-Boot
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   device_type = "soc";
+   ranges = < ffe0 0010>;
+   reg = ;  // CCSRBAR & soc regs, remove 
once parse code for immrbase fixed
+   bus-frequency = <0>;// Filled out by uboot.
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc8572-memory-controller";
+   reg = <2000 1000>;
+   interrupt-parent = <&mpic>;
+   interrupts = <12 2>;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc8572-memory-controller";
+   reg = <6000 1000>;
+   interrupt-parent = <&mpic>;
+   interrupts = <12 2>;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc8572-l2-cache-controller";
+   reg = <2 1000>;
+   cache-line-size = <20>; // 32 bytes
+   cache-size = <8>;   // L2, 512K
+   interrupt-parent = <&mpic>;
+   interrupts = <10 2>;
+   };
+
+   [EMAIL PROTECTED] {
+   device_type = "i2c";
+   compatible = "fsl-i2c";
+   reg = <3000 100>;
+   interrupts = <2b 2>;
+   interrupt-parent = <&mpic>;
+   dfsrr;
+   };
+
+   [EMAIL PROTECTED] {
+   device_type = "i2c";
+   compatible = "fsl-i2c";
+   reg = <3100 100>;
+   interrupts = <2b 2>;
+   interrupt-parent = <&mpic>;
+   dfsrr;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   device_type = "mdio";
+   compatible = "gianfar";
+   reg = <24520 20>;
+   phy0: [EMAIL PROTECTED] {
+   interrupt-parent = <&mpic>;
+   interrupts = ;
+   reg = <0>;
+   };
+   phy1: [EMAIL PROTECTED] {
+   interrupt-parent = <&mpic>;
+   interrupts = ;
+   reg = <1>;
+   };
+   phy2: [EMAIL PROTECTED] {
+   interrupt-parent = <&mpic>;
+   interrupts = ;
+   reg = <2>;
+   

[PATCH 09/22] [POWERPC] Handle alignment faults on SPE load/store instructions

2007-09-13 Thread Kumar Gala
This adds code to handle alignment traps generated by the following
SPE (signal processing engine) load/store instructions, by emulating
the instruction in the kernel (as is done for other instructions that
generate alignment traps):

evldd[x] Vector Load Double Word into Double Word [Indexed]
evldw[x] Vector Load Double into Two Words [Indexed]
evldh[x] Vector Load Double into Four Half Words [Indexed]
evlhhesplat[x]   Vector Load Half Word into Half Words Even and Splat [Indexed]
evlhhousplat[x]  Vector Load Half Word into Half Word Odd Unsigned and Splat 
[Indexed]
evlhhossplat[x]  Vector Load Half Word into Half Word Odd Signed and Splat 
[Indexed]
evlwhe[x]Vector Load Word into Two Half Words Even [Indexed]
evlwhou[x]   Vector Load Word into Two Half Words Odd Unsigned 
(zero-extended) [Indexed]
evlwhos[x]   Vector Load Word into Two Half Words Odd Signed (with sign 
extension) [Indexed]
evlwwsplat[x]Vector Load Word into Word and Splat [Indexed]
evlwhsplat[x]Vector Load Word into Two Half Words and Splat [Indexed]
evstdd[x]Vector Store Double of Double [Indexed]
evstdw[x]Vector Store Double of Two Words [Indexed]
evstdh[x]Vector Store Double of Four Half Words [Indexed]
evstwhe[x]   Vector Store Word of Two Half Words from Even [Indexed]
evstwho[x]   Vector Store Word of Two Half Words from Odd [Indexed]
evstwwe[x]   Vector Store Word of Word from Even [Indexed]
evstwwo[x]   Vector Store Word of Word from Odd [Indexed]

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/align.c |  250 +++
 1 files changed, 250 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 4c47f9c..e06f75d 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -46,6 +46,8 @@ struct aligninfo {
 #define S  0x40/* single-precision fp or... */
 #define SX 0x40/* ... byte count in XER */
 #define HARD   0x80/* string, stwcx. */
+#define E4 0x40/* SPE endianness is word */
+#define E8 0x80/* SPE endianness is double word */
 
 /* DSISR bits reported for a DCBZ instruction: */
 #define DCBZ   0x5f/* 8xx/82xx dcbz faults when cache not enabled */
@@ -392,6 +394,248 @@ static int emulate_fp_pair(struct pt_regs *regs, unsigned 
char __user *addr,
return 1;   /* exception handled and fixed up */
 }
 
+#ifdef CONFIG_SPE
+
+static struct aligninfo spe_aligninfo[32] = {
+   { 8, LD+E8 },   /* 0 00 00: evldd[x] */
+   { 8, LD+E4 },   /* 0 00 01: evldw[x] */
+   { 8, LD },  /* 0 00 10: evldh[x] */
+   INVALID,/* 0 00 11 */
+   { 2, LD },  /* 0 01 00: evlhhesplat[x] */
+   INVALID,/* 0 01 01 */
+   { 2, LD },  /* 0 01 10: evlhhousplat[x] */
+   { 2, LD+SE },   /* 0 01 11: evlhhossplat[x] */
+   { 4, LD },  /* 0 10 00: evlwhe[x] */
+   INVALID,/* 0 10 01 */
+   { 4, LD },  /* 0 10 10: evlwhou[x] */
+   { 4, LD+SE },   /* 0 10 11: evlwhos[x] */
+   { 4, LD+E4 },   /* 0 11 00: evlwwsplat[x] */
+   INVALID,/* 0 11 01 */
+   { 4, LD },  /* 0 11 10: evlwhsplat[x] */
+   INVALID,/* 0 11 11 */
+
+   { 8, ST+E8 },   /* 1 00 00: evstdd[x] */
+   { 8, ST+E4 },   /* 1 00 01: evstdw[x] */
+   { 8, ST },  /* 1 00 10: evstdh[x] */
+   INVALID,/* 1 00 11 */
+   INVALID,/* 1 01 00 */
+   INVALID,/* 1 01 01 */
+   INVALID,/* 1 01 10 */
+   INVALID,/* 1 01 11 */
+   { 4, ST },  /* 1 10 00: evstwhe[x] */
+   INVALID,/* 1 10 01 */
+   { 4, ST },  /* 1 10 10: evstwho[x] */
+   INVALID,/* 1 10 11 */
+   { 4, ST+E4 },   /* 1 11 00: evstwwe[x] */
+   INVALID,/* 1 11 01 */
+   { 4, ST+E4 },   /* 1 11 10: evstwwo[x] */
+   INVALID,/* 1 11 11 */
+};
+
+#defineEVLDD   0x00
+#defineEVLDW   0x01
+#defineEVLDH   0x02
+#defineEVLHHESPLAT 0x04
+#defineEVLHHOUSPLAT0x06
+#defineEVLHHOSSPLAT0x07
+#defineEVLWHE  0x08
+#defineEVLWHOU 0x0A
+#defineEVLWHOS 0x0B
+#defineEVLWWSPLAT  0x0C
+#defineEVLWHSPLAT  0x0E
+#defineEVSTDD  0x10
+#defineEVSTDW  0x11
+#defineEVSTDH  0x12
+#defineEVSTWHE 0x18
+#defineEVSTWHO 0x1A
+#defineEVSTWWE 0x1C
+#defineEVSTWWO 0x1E
+
+/*
+ * Emulate SPE loads and stores.
+ * Only Book-E has these instruc

[PATCH 07/22] [POWERPC] 85xx: Remove unnecessary loops_per_jiffy initialization code.

2007-09-13 Thread Kumar Gala
From: Jon Loeliger <[EMAIL PROTECTED]>

Signed-off-by: Jon Loeliger <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/85xx/mpc85xx_ads.c |   13 -
 arch/powerpc/platforms/85xx/mpc85xx_cds.c |   13 -
 arch/powerpc/platforms/85xx/mpc85xx_mds.c |   11 ---
 3 files changed, 0 insertions(+), 37 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c 
b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 40a8286..c22bc1c 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -192,7 +192,6 @@ void init_fcc_ioports(struct fs_platform_info *fpi)
 
 static void __init mpc85xx_ads_setup_arch(void)
 {
-   struct device_node *cpu;
 #ifdef CONFIG_PCI
struct device_node *np;
 #endif
@@ -200,18 +199,6 @@ static void __init mpc85xx_ads_setup_arch(void)
if (ppc_md.progress)
ppc_md.progress("mpc85xx_ads_setup_arch()", 0);
 
-   cpu = of_find_node_by_type(NULL, "cpu");
-   if (cpu != 0) {
-   const unsigned int *fp;
-
-   fp = of_get_property(cpu, "clock-frequency", NULL);
-   if (fp != 0)
-   loops_per_jiffy = *fp / HZ;
-   else
-   loops_per_jiffy = 5000 / HZ;
-   of_node_put(cpu);
-   }
-
 #ifdef CONFIG_CPM2
cpm2_reset();
 #endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index b46c8d5..665e8df 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -265,7 +265,6 @@ device_initcall(mpc85xx_cds_8259_attach);
  */
 static void __init mpc85xx_cds_setup_arch(void)
 {
-   struct device_node *cpu;
 #ifdef CONFIG_PCI
struct device_node *np;
 #endif
@@ -273,18 +272,6 @@ static void __init mpc85xx_cds_setup_arch(void)
if (ppc_md.progress)
ppc_md.progress("mpc85xx_cds_setup_arch()", 0);
 
-   cpu = of_find_node_by_type(NULL, "cpu");
-   if (cpu != 0) {
-   const unsigned int *fp;
-
-   fp = of_get_property(cpu, "clock-frequency", NULL);
-   if (fp != 0)
-   loops_per_jiffy = *fp / HZ;
-   else
-   loops_per_jiffy = 5 / HZ;
-   of_node_put(cpu);
-   }
-
cadmus = ioremap(CADMUS_BASE, CADMUS_SIZE);
cds_pci_slot = ((cadmus[CM_CSR] >> 6) & 0x3) + 1;
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 66366a0..c379286 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -72,17 +72,6 @@ static void __init mpc85xx_mds_setup_arch(void)
if (ppc_md.progress)
ppc_md.progress("mpc85xx_mds_setup_arch()", 0);
 
-   np = of_find_node_by_type(NULL, "cpu");
-   if (np != NULL) {
-   const unsigned int *fp =
-   of_get_property(np, "clock-frequency", NULL);
-   if (fp != NULL)
-   loops_per_jiffy = *fp / HZ;
-   else
-   loops_per_jiffy = 5000 / HZ;
-   of_node_put(np);
-   }
-
/* Map BCSR area */
np = of_find_node_by_name(NULL, "bcsr");
if (np != NULL) {
-- 
1.5.2.4

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


[PATCH 06/22] [POWERPC] 86xx: Remove unnecessary loops_per_jiffy initialization code.

2007-09-13 Thread Kumar Gala
From: Jon Loeliger <[EMAIL PROTECTED]>

Signed-off-by: Jon Loeliger <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |   14 ++
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c 
b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 47aafa7..3ec9d5a 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -132,23 +132,13 @@ static int mpc86xx_exclude_device(struct pci_controller 
*hose,
 static void __init
 mpc86xx_hpcn_setup_arch(void)
 {
+#ifdef CONFIG_PCI
struct device_node *np;
+#endif
 
if (ppc_md.progress)
ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
 
-   np = of_find_node_by_type(NULL, "cpu");
-   if (np != 0) {
-   const unsigned int *fp;
-
-   fp = of_get_property(np, "clock-frequency", NULL);
-   if (fp != 0)
-   loops_per_jiffy = *fp / HZ;
-   else
-   loops_per_jiffy = 5000 / HZ;
-   of_node_put(np);
-   }
-
 #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) {
struct resource rsrc;
-- 
1.5.2.4

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


[PATCH 05/22] [POWERPC] linkstation updates

2007-09-13 Thread Kumar Gala
From: Guennadi Liakhovetski <[EMAIL PROTECTED]>

1. Fix RTC type - it is a rs5c372a, not rs5c372b
2. Configure both UART interrupts edge-triggered
3. Add a license header to ls_uart.c
4. Check for running on linkstation in a late_initcall() function. Needed
   for multiplatform builds, even though linkstation doesn't support them
   yet
5. Remove unneeded #include from linkstation.c

Signed-off-by: Guennadi Liakhovetski <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/kuroboxHD.dts  |4 ++--
 arch/powerpc/boot/dts/kuroboxHG.dts  |4 ++--
 arch/powerpc/platforms/embedded6xx/linkstation.c |1 -
 arch/powerpc/platforms/embedded6xx/ls_uart.c |   14 ++
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/dts/kuroboxHD.dts 
b/arch/powerpc/boot/dts/kuroboxHD.dts
index b0eeff0..a7b3714 100644
--- a/arch/powerpc/boot/dts/kuroboxHD.dts
+++ b/arch/powerpc/boot/dts/kuroboxHD.dts
@@ -69,7 +69,7 @@  add flash parts, rtc, ??
 
[EMAIL PROTECTED] {
device_type = "rtc";
-   compatible = "ricoh,rs5c372b";
+   compatible = "ricoh,rs5c372a";
reg = <32>;
};
};
@@ -80,7 +80,7 @@  add flash parts, rtc, ??
reg = <80004500 8>;
clock-frequency = <5d08d88>;
current-speed = <2580>;
-   interrupts = <9 2>;
+   interrupts = <9 0>;
interrupt-parent = <&mpic>;
};
 
diff --git a/arch/powerpc/boot/dts/kuroboxHG.dts 
b/arch/powerpc/boot/dts/kuroboxHG.dts
index ccd15a2..a0007b9 100644
--- a/arch/powerpc/boot/dts/kuroboxHG.dts
+++ b/arch/powerpc/boot/dts/kuroboxHG.dts
@@ -69,7 +69,7 @@  add flash parts, rtc, ??
 
[EMAIL PROTECTED] {
device_type = "rtc";
-   compatible = "ricoh,rs5c372b";
+   compatible = "ricoh,rs5c372a";
reg = <32>;
};
};
@@ -80,7 +80,7 @@  add flash parts, rtc, ??
reg = <80004500 8>;
clock-frequency = <7c044a8>;
current-speed = <2580>;
-   interrupts = <9 2>;
+   interrupts = <9 0>;
interrupt-parent = <&mpic>;
};
 
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c 
b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 61ca02c..f392374 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -11,7 +11,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c 
b/arch/powerpc/platforms/embedded6xx/ls_uart.c
index 0d9f150..c99264c 100644
--- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
+++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
@@ -1,3 +1,14 @@
+/*
+ * AVR power-management chip interface for the Buffalo Linkstation /
+ * Kurobox Platform.
+ *
+ * Author: 2006 (c) G. Liakhovetski
+ *  [EMAIL PROTECTED]
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of
+ * any kind, whether express or implied.
+ */
 #include 
 #include 
 #include 
@@ -106,6 +117,9 @@ static int __init ls_uarts_init(void)
phys_addr_t phys_addr;
int len;
 
+   if (!machine_is(linkstation))
+   return 0;
+
avr = of_find_node_by_path("/soc10x/[EMAIL PROTECTED]");
if (!avr)
return -EINVAL;
-- 
1.5.2.4

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


[PATCH 04/22] [POWERPC] Update mpc7448hpc2 device tree to be compatible for tsi109 chip

2007-09-13 Thread Kumar Gala
From: Roy Zang <[EMAIL PROTECTED]>

Update mpc7448hpc2 device tree to be compatible for tsi109 chip.

Signed-off-by: Roy Zang <[EMAIL PROTECTED]>
Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/mpc7448hpc2.dts |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc7448hpc2.dts 
b/arch/powerpc/boot/dts/mpc7448hpc2.dts
index b9158eb..c60ad34 100644
--- a/arch/powerpc/boot/dts/mpc7448hpc2.dts
+++ b/arch/powerpc/boot/dts/mpc7448hpc2.dts
@@ -41,11 +41,12 @@
   >;
};
 
-   [EMAIL PROTECTED] {
+   [EMAIL PROTECTED] {
#address-cells = <1>;
#size-cells = <1>;
#interrupt-cells = <2>;
device_type = "tsi-bridge";
+   compatible = "tsi109-bridge", "tsi108-bridge";
ranges = < c000 0001>;
reg = ;
bus-frequency = <0>;
@@ -55,12 +56,12 @@
interrupts = ;
reg = <7000 400>;
device_type = "i2c";
-   compatible  = "tsi108-i2c";
+   compatible  = "tsi109-i2c", "tsi108-i2c";
};
 
MDIO: [EMAIL PROTECTED] {
device_type = "mdio";
-   compatible = "tsi108-mdio";
+   compatible = "tsi109-mdio", "tsi108-mdio";
reg = <6000 50>;
#address-cells = <1>;
#size-cells = <0>;
@@ -82,7 +83,7 @@
[EMAIL PROTECTED] {
#size-cells = <0>;
device_type = "network";
-   compatible = "tsi108-ethernet";
+   compatible = "tsi109-ethernet", "tsi108-ethernet";
reg = <6000 200>;
address = [ 00 06 D2 00 00 01 ];
interrupts = <10 2>;
@@ -95,7 +96,7 @@
#address-cells = <1>;
#size-cells = <0>;
device_type = "network";
-   compatible = "tsi108-ethernet";
+   compatible = "tsi109-ethernet", "tsi108-ethernet";
reg = <6400 200>;
address = [ 00 06 D2 00 00 02 ];
interrupts = <11 2>;
@@ -134,7 +135,7 @@
big-endian;
};
[EMAIL PROTECTED] {
-   compatible = "tsi108-pci";
+   compatible = "tsi109-pci", "tsi108-pci";
device_type = "pci";
#interrupt-cells = <1>;
#size-cells = <2>;
-- 
1.5.2.4

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


[PATCH 03/22] [POWERPC] 85xx: Clean up from 85xx_ds rename

2007-09-13 Thread Kumar Gala
Renamed functions in 85xx_ds from 8544 to 85xx.

Kept an unique machine def/probe for the MPC8544 DS board to
handle some subtle differences between the future board based
on the DS platform.

Also fixed building w/o CONFIG_PCI and minor whitespace fixes.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c |   36 ++---
 1 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 48983bc..3a5c3c4 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -1,5 +1,5 @@
 /*
- * MPC8544 DS Board Setup
+ * MPC85xx DS Board Setup
  *
  * Author Xianghua Xiao ([EMAIL PROTECTED])
  * Roy Zang <[EMAIL PROTECTED]>
@@ -44,7 +44,7 @@
 #endif
 
 #ifdef CONFIG_PPC_I8259
-static void mpc8544_8259_cascade(unsigned int irq, struct irq_desc *desc)
+static void mpc85xx_8259_cascade(unsigned int irq, struct irq_desc *desc)
 {
unsigned int cascade_irq = i8259_irq();
 
@@ -55,7 +55,7 @@ static void mpc8544_8259_cascade(unsigned int irq, struct 
irq_desc *desc)
 }
 #endif /* CONFIG_PPC_I8259 */
 
-void __init mpc8544_ds_pic_init(void)
+void __init mpc85xx_ds_pic_init(void)
 {
struct mpic *mpic;
struct resource r;
@@ -104,16 +104,17 @@ void __init mpc8544_ds_pic_init(void)
return;
}
 
-   DBG("mpc8544ds: cascade mapped to irq %d\n", cascade_irq);
+   DBG("mpc85xxds: cascade mapped to irq %d\n", cascade_irq);
 
i8259_init(cascade_node, 0);
of_node_put(cascade_node);
 
-   set_irq_chained_handler(cascade_irq, mpc8544_8259_cascade);
+   set_irq_chained_handler(cascade_irq, mpc85xx_8259_cascade);
 #endif /* CONFIG_PPC_I8259 */
 }
 
 #ifdef CONFIG_PCI
+static int primary_phb_addr;
 extern int uses_fsl_uli_m1575;
 extern int uli_exclude_device(struct pci_controller *hose,
u_char bus, u_char devfn);
@@ -121,13 +122,13 @@ extern int uli_exclude_device(struct pci_controller *hose,
 static int mpc85xx_exclude_device(struct pci_controller *hose,
   u_char bus, u_char devfn)
 {
-   struct device_node* node;   
+   struct device_node* node;
struct resource rsrc;
 
node = (struct device_node *)hose->arch_data;
of_address_to_resource(node, 0, &rsrc);
 
-   if ((rsrc.start & 0xf) == 0xb000) {
+   if ((rsrc.start & 0xf) == primary_phb_addr) {
return uli_exclude_device(hose, bus, devfn);
}
 
@@ -138,20 +139,20 @@ static int mpc85xx_exclude_device(struct pci_controller 
*hose,
 /*
  * Setup the architecture
  */
-static void __init mpc8544_ds_setup_arch(void)
+static void __init mpc85xx_ds_setup_arch(void)
 {
 #ifdef CONFIG_PCI
struct device_node *np;
 #endif
 
if (ppc_md.progress)
-   ppc_md.progress("mpc8544_ds_setup_arch()", 0);
+   ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
 #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc);
-   if ((rsrc.start & 0xf) == 0xb000)
+   if ((rsrc.start & 0xf) == primary_phb_addr)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
@@ -160,7 +161,7 @@ static void __init mpc8544_ds_setup_arch(void)
ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 
-   printk("MPC8544 DS board from Freescale Semiconductor\n");
+   printk("MPC85xx DS board from Freescale Semiconductor\n");
 }
 
 /*
@@ -170,14 +171,21 @@ static int __init mpc8544_ds_probe(void)
 {
unsigned long root = of_get_flat_dt_root();
 
-   return of_flat_dt_is_compatible(root, "MPC8544DS");
+   if (of_flat_dt_is_compatible(root, "MPC8544DS")) {
+#ifdef CONFIG_PCI
+   primary_phb_addr = 0xb000;
+#endif
+   return 1;
+   } else {
+   return 0;
+   }
 }
 
 define_machine(mpc8544_ds) {
.name   = "MPC8544 DS",
.probe  = mpc8544_ds_probe,
-   .setup_arch = mpc8544_ds_setup_arch,
-   .init_IRQ   = mpc8544_ds_pic_init,
+   .setup_arch = mpc85xx_ds_setup_arch,
+   .init_IRQ   = mpc85xx_ds_pic_init,
 #ifdef CONFIG_PCI
.pcibios_fixup_bus  = fsl_pcibios_fixup_bus,
 #endif
-- 
1.5.2.4

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


[PATCH 02/22] [POWERPC] 85xx: Renamed mpc8544_ds.c to mpc85xx_ds.c

2007-09-13 Thread Kumar Gala
Renamed the mpc8544_ds.c board code to mpc85xx_ds.c to make it more
generic in prep for other boards based on the same platform.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/configs/mpc8544_ds_defconfig |2 +-
 arch/powerpc/platforms/85xx/Kconfig   |8 +-
 arch/powerpc/platforms/85xx/Makefile  |2 +-
 arch/powerpc/platforms/85xx/mpc8544_ds.c  |  188 -
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  |  188 +
 5 files changed, 194 insertions(+), 194 deletions(-)
 delete mode 100644 arch/powerpc/platforms/85xx/mpc8544_ds.c
 create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_ds.c

diff --git a/arch/powerpc/configs/mpc8544_ds_defconfig 
b/arch/powerpc/configs/mpc8544_ds_defconfig
index 86582ae..150221f 100644
--- a/arch/powerpc/configs/mpc8544_ds_defconfig
+++ b/arch/powerpc/configs/mpc8544_ds_defconfig
@@ -136,7 +136,7 @@ CONFIG_DEFAULT_IOSCHED="cfq"
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
 # CONFIG_MPC85xx_MDS is not set
-CONFIG_MPC8544_DS=y
+CONFIG_MPC85xx_DS=y
 CONFIG_MPC85xx=y
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
diff --git a/arch/powerpc/platforms/85xx/Kconfig 
b/arch/powerpc/platforms/85xx/Kconfig
index f620171..b8476b2 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -29,13 +29,13 @@ config MPC85xx_MDS
help
  This option enables support for the MPC85xx MDS board
 
-config MPC8544_DS
-   bool "Freescale MPC8544 DS"
+config MPC85xx_DS
+   bool "Freescale MPC85xx DS"
select PPC_I8259
select DEFAULT_UIMAGE
select FSL_ULI1575
help
- This option enables support for the MPC8544 DS board
+ This option enables support for the MPC85xx DS (MPC8544 DS) board
 
 endchoice
 
@@ -58,4 +58,4 @@ config MPC85xx
select FSL_PCI if PCI
select SERIAL_8250_SHARE_IRQ if SERIAL_8250
default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS \
-   || MPC85xx_MDS || MPC8544_DS
+   || MPC85xx_MDS || MPC85xx_DS
diff --git a/arch/powerpc/platforms/85xx/Makefile 
b/arch/powerpc/platforms/85xx/Makefile
index d70f2d0..25bd9e2 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -5,5 +5,5 @@ obj-$(CONFIG_PPC_85xx)  += misc.o
 obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
-obj-$(CONFIG_MPC8544_DS)  += mpc8544_ds.o
+obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o
 obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
diff --git a/arch/powerpc/platforms/85xx/mpc8544_ds.c 
b/arch/powerpc/platforms/85xx/mpc8544_ds.c
deleted file mode 100644
index 48983bc..000
--- a/arch/powerpc/platforms/85xx/mpc8544_ds.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * MPC8544 DS Board Setup
- *
- * Author Xianghua Xiao ([EMAIL PROTECTED])
- * Roy Zang <[EMAIL PROTECTED]>
- * - Add PCI/PCI Exprees support
- * Copyright 2007 Freescale Semiconductor Inc.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include "mpc85xx.h"
-
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
-#else
-#define DBG(fmt, args...)
-#endif
-
-#ifdef CONFIG_PPC_I8259
-static void mpc8544_8259_cascade(unsigned int irq, struct irq_desc *desc)
-{
-   unsigned int cascade_irq = i8259_irq();
-
-   if (cascade_irq != NO_IRQ) {
-   generic_handle_irq(cascade_irq);
-   }
-   desc->chip->eoi(irq);
-}
-#endif /* CONFIG_PPC_I8259 */
-
-void __init mpc8544_ds_pic_init(void)
-{
-   struct mpic *mpic;
-   struct resource r;
-   struct device_node *np = NULL;
-#ifdef CONFIG_PPC_I8259
-   struct device_node *cascade_node = NULL;
-   int cascade_irq;
-#endif
-
-   np = of_find_node_by_type(np, "open-pic");
-
-   if (np == NULL) {
-   printk(KERN_ERR "Could not find open-pic node\n");
-   return;
-   }
-
-   if (of_address_to_resource(np, 0, &r)) {
-   printk(KERN_ERR "Failed to map mpic register space\n");
-   of_node_put(np);
-   return;
-   }
-
-   mpic = mpic_alloc(np, r.start,
- MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-   0, 256, " OpenPIC  ");
-   BUG_ON(mpic == NULL);
-
-   mpic_init(mpic);
-
-#ifdef CONFIG_PPC_I8259
-   /* Initialize the i8259 controller */
-   for_each_node_by_type(np, "interrupt-controller")
-  

[PATCH 01/22] ucc_geth: kill unused include

2007-09-13 Thread Kumar Gala
The ucc_geth_mii code is based on the gianfar_mii code that use to include
ocp.h.  ucc never need this and it causes issues when we want to kill
arch/ppc includes from arch/powerpc.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 drivers/net/ucc_geth_mii.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 6c257b8..df884f0 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.5.2.4

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


[PATCH 00/22] [POWERPC] Patches in for-2.6.24

2007-09-13 Thread Kumar Gala
This is the set of patches in:

master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for-2.6.24

Posted here so everyone knows what's going in.  I've asked Paul to pull this 
into
his for-2.6.24 branch.

(Sorry for anyone getting duplicates of this, sent to [EMAIL PROTECTED] not 
[EMAIL PROTECTED])

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


Re: [PATCH] [POWERPC] DTS cleanup

2007-09-13 Thread Kumar Gala

On Sep 13, 2007, at 11:56 AM, Segher Boessenkool wrote:

 * built-in for non-standard buses (ISA, PCI)
>>>
>>> "built-in" is some weird CHRP property, so yes we don't need it
>>> or want it.
>>
>> Do you suggest we get ride of it from ISA nodes as well?
>
> Yes.  You aren't CHRP so you don't have to follow the CHRP binding.
> Of course it is good to copy from that binding where it makes sense,
> but how is "built-in" useful to you?
>
 * Fixed ranges on lite5200*
>>>
>>> This has a problem still:
>>>
model = "fsl,mpc5200";
compatible = "mpc5200";
revision = "";  // from bootloader
 -  #interrupt-cells = <3>;
device_type = "soc";
 -  ranges = <0 f000 f001>;
 -  reg = ;
 +  ranges = <0 f000 c000>;
 +  reg = ;
>>>
>>> That makes "reg" and "ranges" identify an identical address range,
>>> which means no subnode can claim any address in that range, so the
>>> "ranges" property should go.  Alternatively, the "reg" might be
>>> claiming too big a space.
>>>
>>> Which is it?
>>
>> Yeah, I think it should be 0x100 for the 'soc' regs on 52xx so  
>> I'll set regs to that.
>
> Okido.
>
> Did I say "nice cleanups, thank you!" already?  :-)

You did, and let me tell you I've had enough of cleaning up the .dts  
for a while :)

Someone really needs to add some macro/preprocessor magic into DTC so  
this is made a lot simpler.

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


Please pull from for-2.6.24

2007-09-13 Thread Kumar Gala
Please pull from 'for-2.6.24' branch of

master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for-2.6.24

to receive the following updates:

 arch/powerpc/boot/dts/holly.dts  |1
 arch/powerpc/boot/dts/kuroboxHD.dts  |6
 arch/powerpc/boot/dts/kuroboxHG.dts  |6
 arch/powerpc/boot/dts/lite5200.dts   |   49
 arch/powerpc/boot/dts/lite5200b.dts  |   59
 arch/powerpc/boot/dts/mpc7448hpc2.dts|   17
 arch/powerpc/boot/dts/mpc8272ads.dts |5
 arch/powerpc/boot/dts/mpc8313erdb.dts|   63
 arch/powerpc/boot/dts/mpc832x_mds.dts|  122 -
 arch/powerpc/boot/dts/mpc832x_rdb.dts|   72 -
 arch/powerpc/boot/dts/mpc8349emitx.dts   |   98 -
 arch/powerpc/boot/dts/mpc8349emitxgp.dts |   47
 arch/powerpc/boot/dts/mpc834x_mds.dts|  243 +--
 arch/powerpc/boot/dts/mpc836x_mds.dts|  123 -
 arch/powerpc/boot/dts/mpc8540ads.dts |  175 +-
 arch/powerpc/boot/dts/mpc8541cds.dts |  196 +--
 arch/powerpc/boot/dts/mpc8544ds.dts  |  377 +++--
 arch/powerpc/boot/dts/mpc8548cds.dts |  404 +++---
 arch/powerpc/boot/dts/mpc8555cds.dts |  196 +--
 arch/powerpc/boot/dts/mpc8560ads.dts |  185 +-
 arch/powerpc/boot/dts/mpc8568mds.dts |4
 arch/powerpc/boot/dts/mpc8572ds.dts  |  404 ++
 arch/powerpc/boot/dts/mpc8641_hpcn.dts   |  275 ++--
 arch/powerpc/boot/dts/mpc866ads.dts  |5
 arch/powerpc/boot/dts/mpc885ads.dts  |5
 arch/powerpc/boot/dts/prpmc2800.dts  |1
 arch/powerpc/configs/mpc8544_ds_defconfig|2
 arch/powerpc/configs/mpc8572_ds_defconfig| 1496 +++
 arch/powerpc/kernel/align.c  |  250 +++
 arch/powerpc/kernel/cputable.c   |   23
 arch/powerpc/kernel/entry_32.S   |4
 arch/powerpc/kernel/head_32.S|   17
 arch/powerpc/kernel/head_40x.S   |   12
 arch/powerpc/kernel/head_44x.S   |6
 arch/powerpc/kernel/head_8xx.S   |9
 arch/powerpc/kernel/head_fsl_booke.S |6
 arch/powerpc/kernel/process.c|   15
 arch/powerpc/kernel/ptrace.c |6
 arch/powerpc/kernel/vmlinux.lds.S|2
 arch/powerpc/platforms/83xx/mpc8313_rdb.c|2
 arch/powerpc/platforms/83xx/mpc832x_mds.c|1
 arch/powerpc/platforms/83xx/mpc832x_rdb.c|   48
 arch/powerpc/platforms/83xx/mpc834x_itx.c|2
 arch/powerpc/platforms/83xx/mpc834x_mds.c|2
 arch/powerpc/platforms/83xx/mpc836x_mds.c|1
 arch/powerpc/platforms/83xx/mpc83xx.h|2
 arch/powerpc/platforms/83xx/pci.c|7
 arch/powerpc/platforms/85xx/Kconfig  |8
 arch/powerpc/platforms/85xx/Makefile |2
 arch/powerpc/platforms/85xx/mpc8544_ds.c |  188 --
 arch/powerpc/platforms/85xx/mpc85xx_ads.c|   13
 arch/powerpc/platforms/85xx/mpc85xx_cds.c|   13
 arch/powerpc/platforms/85xx/mpc85xx_ds.c |  227 +++
 arch/powerpc/platforms/85xx/mpc85xx_mds.c|   11
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c   |   14
 arch/powerpc/platforms/embedded6xx/linkstation.c |1
 arch/powerpc/platforms/embedded6xx/ls_uart.c |   14
 arch/powerpc/sysdev/fsl_pci.c|2
 arch/powerpc/sysdev/fsl_soc.c|  114 +
 arch/powerpc/sysdev/fsl_soc.h|7
 drivers/net/ucc_geth_mii.c   |1
 drivers/serial/mpc52xx_uart.c|2
 include/asm-powerpc/cputable.h   |   26
 include/asm-powerpc/immap_86xx.h |  151 --
 include/asm-powerpc/io.h |   23
 include/asm-powerpc/ppc_asm.h|4
 include/asm-powerpc/qe.h |3
 include/asm-ppc/io.h |3
 include/linux/pci_ids.h  |2
 69 files changed, 4049 insertions(+), 1831 deletions(-)

Anton Vorontsov (3):
  [POWERPC] QE: extern par_io_config_pin and par_io_data_set funcs
  [POWERPC] fsl_soc: add support for fsl_spi
  [POWERPC] MPC832x_RDB: Update dts to use SPI1 in QE, register mmc_spi stub

Guennadi Liakhovetski (1):
  [POWERPC] linkstation updates

John Rigby (1):
  [POWERPC] 52xx: Fix mpc52xx_uart_of_assign to use correct index

Jon Loeliger (2):
  [POWERPC] 86xx: Remove unnecessary loops_per_jiffy initialization code.
  [POWERPC] 85xx: Remove unnecessary loops_per_jiffy initialization code.

Kumar Gala (10):
  ucc_geth: kill unused include
  [POWERPC] 85xx: Renamed mpc8544_ds.c to mpc85xx_ds.c
  [POWERPC] 85xx: Clean up from 85xx_ds rename
  [POWERPC] Handle alignment faults on SPE 

Re: [PATCH 1/5] Add Freescale DMA and DMA channel to Documentation/powerpc/booting-without-of.txt file.

2007-09-13 Thread Scott Wood
Segher Boessenkool wrote:
 What tree are you using?  Commit
 804ace8881d211ac448082e871dd312132393049
 in Paul's git tree should have fixed that.
>>>
>>> Strange, I don't see that commit -- maybe gitweb is broken, or
>>> maybe the patch was superseded, or maybe it just disappeared?
>>> It's still shown in patchworks with this commit id fwiw.
>>
>> I see it here:
>> http://git.kernel.org/?p=linux/kernel/git/paulus/powerpc.git;a=commit;h=804ace8881d211ac448082e871dd312132393049
>>  
>>
> 
> Ah okay.  The gitweb search functionality is broken.
> 
> Shouldn't this patch have gone to .23?  It's a pretty important
> bugfix I think.

Probably not, in the absence of a specific failing match that's already 
in .23.  It has the potential to break things that were working by chance.

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


Re: [PATCH 1/5] Add Freescale DMA and DMA channel to Documentation/powerpc/booting-without-of.txt file.

2007-09-13 Thread Segher Boessenkool
>>> What tree are you using?  Commit
>>> 804ace8881d211ac448082e871dd312132393049
>>> in Paul's git tree should have fixed that.
>>
>> Strange, I don't see that commit -- maybe gitweb is broken, or
>> maybe the patch was superseded, or maybe it just disappeared?
>> It's still shown in patchworks with this commit id fwiw.
>
> I see it here:
> http://git.kernel.org/?p=linux/kernel/git/paulus/powerpc.git;a=commit; 
> h=804ace8881d211ac448082e871dd312132393049

Ah okay.  The gitweb search functionality is broken.

Shouldn't this patch have gone to .23?  It's a pretty important
bugfix I think.


Segher

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


[PATCH] PowerPC: usb ehci of_platform bindings for Sequoia 440EPx

2007-09-13 Thread Valentine Barshak
EHCI OF bindings for PowerPC 440EPx Sequoia.

Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/sequoia.dts |7 +++
 1 files changed, 7 insertions(+)

diff -ruN linux-2.6.orig/arch/powerpc/boot/dts/sequoia.dts 
linux-2.6.bld/arch/powerpc/boot/dts/sequoia.dts
--- linux-2.6.orig/arch/powerpc/boot/dts/sequoia.dts2007-09-13 
20:58:18.0 +0400
+++ linux-2.6.bld/arch/powerpc/boot/dts/sequoia.dts 2007-09-13 
21:32:49.0 +0400
@@ -122,6 +122,13 @@
interrupt-map-mask = ;
};
 
+   [EMAIL PROTECTED] {
+   compatible = "ibm,ehci-440epx", "ehci-be-desc", 
"ehci-be-mmio";
+   interrupt-parent = <&UIC0>;
+   interrupts = <1a 4>;
+   reg = <0 e300 ff>;
+   };
+
POB0: opb {
compatible = "ibm,opb-440epx", "ibm,opb";
#address-cells = <1>;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v3] [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port

2007-09-13 Thread Kumar Gala

On Sep 13, 2007, at 12:06 PM, Segher Boessenkool wrote:

 +  PowerPC,[EMAIL PROTECTED] {
>>>
>>> Maybe it would be good to use "PowerPC,e500" instead -- it would
>>> make it easier to probe for the actual CPU type, that way.  Not
>>> that Linux uses the name/compatible here at all ;-)
>>
>> I thought about this, not sure what the best solution is.
>
> Since the CPU cores on all these SoCs are identical (well, there
> might be a few revisions, or different cache sizes or such -- minor
> differences that can be probed for separately), it probably is a
> good idea to name them in the tree instead of having each client
> have its own table.
>
> Or is there anything about the CPU that can be derived from "8572"
> but not from "e500"?

Only in so much that we need something that states what the actual  
processor is.

 +  [EMAIL PROTECTED] {
>>>
>>> You should put an interrupt-parent in here, so you can get rid of
>>> it in all the children.
>>
>> Are interrupt-parent's inherited by child nodes?
>
> A node without "interrupt-parent" uses the regular tree parent for
> walking the interrupt "tree".
>
>>> And then there's the pci_bridge thing we're discussing on IRC, of
>>> course -- basically, get rid of the pci_bridge pseudo-node, and
>>> move the interrupt-map for the south-bridge devices into the
>>> south-bridge node.
>>
>> Leaving the interrupt-map in the PHB because that works and moving  
>> it down has issues.
>
> Okay, fair enough.  Are you looking at resolving those kernel issues?

No.  I've had enough of this device tree foo for a while :)

[I'm happy to test any patches related to this, if someone else comes  
up with them]

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


Re: [PATCH] usb: add support for device tree aware EHCI driver

2007-09-13 Thread Josh Boyer
On Thu, 13 Sep 2007 21:57:02 +0400
Valentine Barshak <[EMAIL PROTECTED]> wrote:

> Some PowerPC systems have a built-in EHCI controller.
> This is a device tree aware version of the EHCI controller driver.
> Currently it's been tested on the PowerPC 440EPx Sequoia board.
> Other platforms can be added later.
> The code is based on the ehci-ppc-soc driver by Stefan Roese <[EMAIL 
> PROTECTED]>.
> The of_platform support is based on ohci-ppc-of driver
> by Sylvain Munaut <[EMAIL PROTECTED]>.

Where's the DTS binding for this?  It doesn't exist in the current
sequoia.dts.

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


Re: Define termios_1 functions for powerpc, s390, avr32 and frv

2007-09-13 Thread Alan Cox
On Thu, Sep 13, 2007 at 01:16:31AM +1000, Paul Mackerras wrote:
> asm-generic/termios.h).
> 
> Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

Acked-by: Alan Cox <[EMAIL PROTECTED]>
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 5/7] Use extended crashkernel command line on ppc64

2007-09-13 Thread Bernhard Walle
This patch adapts the ppc64 code to use the generic parse_crashkernel()
function introduced in the generic patch of that series.


Signed-off-by: Bernhard Walle <[EMAIL PROTECTED]>

---
 arch/powerpc/kernel/machine_kexec.c |   52 ++--
 1 file changed, 26 insertions(+), 26 deletions(-)

--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -61,45 +61,39 @@ NORET_TYPE void machine_kexec(struct kim
for(;;);
 }
 
-static int __init early_parse_crashk(char *p)
+void __init reserve_crashkernel(void)
 {
-   unsigned long size;
-
-   if (!p)
-   return 1;
-
-   size = memparse(p, &p);
+   unsigned long long crash_size = 0, crash_base;
+   int ret;
 
-   if (*p == '@')
-   crashk_res.start = memparse(p + 1, &p);
-   else
-   crashk_res.start = KDUMP_KERNELBASE;
-
-   crashk_res.end = crashk_res.start + size - 1;
-
-   return 0;
-}
-early_param("crashkernel", early_parse_crashk);
+   /* this is necessary because of lmb_phys_mem_size() */
+   lmb_analyze();
 
-void __init reserve_crashkernel(void)
-{
-   unsigned long size;
+   /* use common parsing */
+   ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(),
+   &crash_size, &crash_base);
+   if (ret == 0 && crash_size > 0) {
+   if (crash_base == 0)
+   crash_base = KDUMP_KERNELBASE;
+   crashk_res.start = crash_base;
+   } else {
+   /* handle the device tree */
+   crash_size = crashk_res.end - crashk_res.start + 1;
+   }
 
-   if (crashk_res.start == 0)
+   if (crash_size == 0)
return;
 
/* We might have got these values via the command line or the
 * device tree, either way sanitise them now. */
 
-   size = crashk_res.end - crashk_res.start + 1;
-
if (crashk_res.start != KDUMP_KERNELBASE)
printk("Crash kernel location must be 0x%x\n",
KDUMP_KERNELBASE);
 
crashk_res.start = KDUMP_KERNELBASE;
-   size = PAGE_ALIGN(size);
-   crashk_res.end = crashk_res.start + size - 1;
+   crash_size = PAGE_ALIGN(crash_size);
+   crashk_res.end = crashk_res.start + crash_size - 1;
 
/* Crash kernel trumps memory limit */
if (memory_limit && memory_limit <= crashk_res.end) {
@@ -108,7 +102,13 @@ void __init reserve_crashkernel(void)
memory_limit);
}
 
-   lmb_reserve(crashk_res.start, size);
+   printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
+   "for crashkernel (System RAM: %ldMB)\n",
+   (unsigned long)(crash_size >> 20),
+   (unsigned long)(crashk_res.start >> 20),
+   (unsigned long)(lmb_phys_mem_size() >> 20));
+
+   lmb_reserve(crashk_res.start, crash_size);
 }
 
 int overlaps_crashkernel(unsigned long start, unsigned long size)

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


[PATCH] usb: add support for device tree aware EHCI driver

2007-09-13 Thread Valentine Barshak
Some PowerPC systems have a built-in EHCI controller.
This is a device tree aware version of the EHCI controller driver.
Currently it's been tested on the PowerPC 440EPx Sequoia board.
Other platforms can be added later.
The code is based on the ehci-ppc-soc driver by Stefan Roese <[EMAIL 
PROTECTED]>.
The of_platform support is based on ohci-ppc-of driver
by Sylvain Munaut <[EMAIL PROTECTED]>.

Signed-off-by: Stefan Roese <[EMAIL PROTECTED]>
Signed-off-by: Sylvain Munaut <[EMAIL PROTECTED]>
Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>

---
 drivers/usb/host/Kconfig   |8 +
 drivers/usb/host/ehci-hcd.c|   16 ++
 drivers/usb/host/ehci-ppc-of.c |  251 +
 drivers/usb/host/ehci.h|2 
 4 files changed, 275 insertions(+), 2 deletions(-)

diff -ruN linux-2.6.orig/drivers/usb/host/ehci.h 
linux-2.6.bld/drivers/usb/host/ehci.h
--- linux-2.6.orig/drivers/usb/host/ehci.h  2007-09-05 22:03:19.0 
+0400
+++ linux-2.6.bld/drivers/usb/host/ehci.h   2007-09-13 18:50:45.0 
+0400
@@ -725,7 +725,7 @@
  * definition below can die once the 4xx support is
  * finally ported over.
  */
-#if defined(CONFIG_PPC)
+#if defined(CONFIG_PPC) && !defined(CONFIG_PPC_MERGE)
 #define readl_be(addr) in_be32((__force unsigned *)addr)
 #define writel_be(val, addr)   out_be32((__force unsigned *)addr, val)
 #endif
diff -ruN linux-2.6.orig/drivers/usb/host/ehci-hcd.c 
linux-2.6.bld/drivers/usb/host/ehci-hcd.c
--- linux-2.6.orig/drivers/usb/host/ehci-hcd.c  2007-09-05 22:03:19.0 
+0400
+++ linux-2.6.bld/drivers/usb/host/ehci-hcd.c   2007-09-13 18:53:37.0 
+0400
@@ -944,11 +944,16 @@
 #definePS3_SYSTEM_BUS_DRIVER   ps3_ehci_driver
 #endif
 
-#ifdef CONFIG_440EPX
+#if defined(CONFIG_440EPX) && !defined(CONFIG_PPC_MERGE)
 #include "ehci-ppc-soc.c"
 #definePLATFORM_DRIVER ehci_ppc_soc_driver
 #endif
 
+#ifdef CONFIG_USB_EHCI_HCD_PPC_OF
+#include "ehci-ppc-of.c"
+#define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver
+#endif
+
 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
 !defined(PS3_SYSTEM_BUS_DRIVER)
 #error "missing bus glue for ehci-hcd"
@@ -963,6 +968,12 @@
 sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
 sizeof(struct ehci_itd), sizeof(struct ehci_sitd));
 
+#ifdef OF_PLATFORM_DRIVER
+   retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
+   if (retval < 0)
+   return retval;
+#endif
+
 #ifdef PLATFORM_DRIVER
retval = platform_driver_register(&PLATFORM_DRIVER);
if (retval < 0)
@@ -998,6 +1009,9 @@
 
 static void __exit ehci_hcd_cleanup(void)
 {
+#ifdef OF_PLATFORM_DRIVER
+   of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+#endif
 #ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
 #endif
diff -ruN linux-2.6.orig/drivers/usb/host/ehci-ppc-of.c 
linux-2.6.bld/drivers/usb/host/ehci-ppc-of.c
--- linux-2.6.orig/drivers/usb/host/ehci-ppc-of.c   1970-01-01 
03:00:00.0 +0300
+++ linux-2.6.bld/drivers/usb/host/ehci-ppc-of.c2007-09-13 
18:45:02.0 +0400
@@ -0,0 +1,253 @@
+/*
+ * EHCI HCD (Host Controller Driver) for USB.
+ *
+ * Bus Glue for PPC On-Chip EHCI driver on the of_platform bus
+ * Tested on AMCC PPC 440EPx
+ *
+ * Valentine Barshak <[EMAIL PROTECTED]>
+ *
+ * Based on "ehci-ppc-soc.c" by Stefan Roese <[EMAIL PROTECTED]>
+ * and "ohci-ppc-of.c" by Sylvain Munaut <[EMAIL PROTECTED]>
+ *
+ * This file is licenced under the GPL.
+ */
+
+#include 
+
+#include 
+#include 
+
+/* called during probe() after chip reset completes */
+static int ehci_ppc_of_setup(struct usb_hcd *hcd)
+{
+   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+   int retval;
+
+   retval = ehci_halt(ehci);
+   if (retval)
+   return retval;
+
+   retval = ehci_init(hcd);
+   if (retval)
+   return retval;
+
+   ehci->sbrn = 0x20;
+   return ehci_reset(ehci);
+}
+
+
+static const struct hc_driver ehci_ppc_of_hc_driver = {
+   .description = hcd_name,
+   .product_desc = "OF EHCI",
+   .hcd_priv_size = sizeof(struct ehci_hcd),
+
+   /*
+* generic hardware linkage
+*/
+   .irq = ehci_irq,
+   .flags = HCD_MEMORY | HCD_USB2,
+
+   /*
+* basic lifecycle operations
+*/
+   .reset = ehci_ppc_of_setup,
+   .start = ehci_run,
+   .stop = ehci_stop,
+   .shutdown = ehci_shutdown,
+
+   /*
+* managing i/o requests and associated device resources
+*/
+   .urb_enqueue = ehci_urb_enqueue,
+   .urb_dequeue = ehci_urb_dequeue,
+   .endpoint_disable = ehci_endpoint_disable,
+
+   /*
+* scheduling support
+*/
+   .get_frame_number = ehci_get_frame,
+
+   /*
+* root hub support
+*/
+   .hub_status_data = ehci_hub_status_data,
+   .hub_control = ehci_hub_control,
+#ifdef CONFIG_PM
+ 

Patches added to powerpc.git for-2.6.24 branch

2007-09-13 Thread Paul Mackerras
David Gibson (2):
  [POWERPC] Move bootwrapper's strchr() and strncmp() from .h to string.S
  [POWERPC] Document and implement an improved flash device binding for 
powerpc

Geert Uytterhoeven (1):
  [POWERPC] PS3: Add new LV1 error codes

Geoff Levand (1):
  [POWERPC] PS3: Enhance storage probe debug output

Jeremy Kerr (1):
  [POWERPC] PS3: Fix CONFIG_SMP=n, CONFIG_KEXEC=y build

Josh Boyer (6):
  [POWERPC] Remove dtc build cruft from DTS files
  [POWERPC] Fix bus probe on Bamboo board
  [POWERPC] Walnut DTS
  [POWERPC] Walnut defconfig
  [POWERPC] Walnut board support
  [POWERPC] Walnut zImage wrapper

Kumar Gala (3):
  [POWERPC] Remove old includes from arch/ppc
  [POWERPC] Copy over headers from arch/ppc to arch/powerpc that we need
  [POWERPC] Stop include asm-ppc when building ARCH=powerpc for ppc32

Linas Vepstas (4):
  [POWERPC] IOMMU virtual merge is no longer experimental
  [POWERPC] prom_init whitespace cleanup, typo fix
  [POWERPC] prom.c whitespace cleanup
  [POWERPC] setup_64.c and prom.c comment cleanup

Michael Ellerman (5):
  [POWERPC] Add an optional device_node pointer to the irq_host
  [POWERPC] Invert null match behaviour for irq_hosts
  [POWERPC] Provide a default irq_host match, which matches on an exact 
of_node
  [POWERPC] Initialise hwirq for legacy irqs
  [POWERPC] Export virq mapping via debugfs

Olof Johansson (10):
  [POWERPC] Export new __io{re,un}map_at() symbols
  [POWERPC] pasemi: Add pasemi_pci_getcfgaddr()
  [POWERPC] pasemi: Add workaround for erratum 5945
  [POWERPC] pasemi: Export more SPRs to sysfs when CONFIG_DEBUG_KERNEL=y
  [POWERPC] pasemi: Print more information at machine check
  [POWERPC] pasemi: Move pasemi_idle_init() to late_initcall()
  [POWERPC] Remove unused platform_machine_check()
  [POWERPC] Move lowlevel runlatch calls under cpu feature control
  [POWERPC] Remove warning in arch/powerpc/kernel/sysfs.c
  [POWERPC] Add workaround for MPICs with broken register reads

Scott Wood (5):
  [POWERPC] bootwrapper: flatdevtree fixes
  [POWERPC] bootwrapper: Add strtoull()
  [POWERPC] bootwrapper: Add get_path()
  [POWERPC] bootwrapper: Only print MAC addresses when the node is actually 
present
  [POWERPC] Check _PAGE_RW and _PAGE_PRESENT on kernel addresses

Valentine Barshak (4):
  [POWERPC] PowerPC 440EPx: Sequoia device tree
  [POWERPC] PowerPC 440EPx: Sequoia defconfig
  [POWERPC] PowerPC 440EPx: Sequoia board support
  [POWERPC] PowerPC 440EPx: Sequoia bootwrapper

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


Re: [PATCH 2/5] [POWERPC] DTS cleanup

2007-09-13 Thread Segher Boessenkool
> Removed the following cruft from .dts files:
> * 32-bit in cpu node -- doesn't exist in any spec and not used by 
> kernel
> * removed built-in (chrp legacy)
> * Removed #interrupt-cells in places they don't need to be set
> * Fixed ranges on lite5200*
> * Removed clock-frequency from i8259 pic node, not sure where this 
> came from
>
> Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>

Acked-by: Segher Boessenkool <[EMAIL PROTECTED]>

You also removed "big-endian" from an 8259 node, please put that
in the commit message too.


Segher

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


Re: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xx processors.

2007-09-13 Thread Dan Williams
> Hi, Dan,
>
> Does I have followed your new API? :-)
>
[..]
> > > +static struct dma_chan
> > *of_find_dma_chan_by_phandle(phandle phandle)
> > > +{
> > > +   struct device_node *np;
> > > +   struct dma_chan *chan;
> > > +   struct fsl_dma_device *fdev;
> > > +
> > > +   np = of_find_node_by_phandle(phandle);
> > > +   if (!np || !of_device_is_compatible(np->parent, "fsl,dma"))
> > > +   return NULL;
> > > +
> > > +   fdev =
> > dev_get_drvdata(&of_find_device_by_node(np->parent)->dev);
> > > +
> > > +   list_for_each_entry(chan, &fdev->common.channels,
> > device_node)
> > > +   if
> > (to_of_device(to_fsl_chan(chan)->chan_dev)->node == np)
> > > +   return chan;
> > > +   return NULL;
> > > +}
> > > +EXPORT_SYMBOL(of_find_dma_chan_by_phandle);
> >
> > This routine implies that there is a piece of code somewhere that
> > wants to select which channels it can use.  A similar effect can be
> > achieved by registering a dma_client with the dmaengine interface
> > ('dma_async_client_register').  Then when the client code makes a call
> > to 'dma_async_client_chan_request' it receives a 'dma_event_callback'
> > for each channel in the system.  It will also be asynchronously
> > notified of channels entering and leaving the system.  The goal is to
> > share a common infrastructure for channel management.
> >
>
> It's speacial codes for our processors. Some device need the speacial DMA 
> channel, such as must be DMA channel 0. So I add these codes. Or, is it 
> possible to add a API for the special DMA channel getting?

Timur had mentioned that this is for device tree support, but your
comment makes me think that this is for client support.  This sounds
like a case where you can define a dma_client to find a specific
channel, something like:
http://marc.info/?l=linux-kernel&m=118417229619156&w=2

> > > +
> > > +static int __devinit of_fsl_dma_probe(struct of_device *dev,
> > > +   const struct of_device_id *match)
> > > +{
> > > +   int err;
> > > +   unsigned int irq;
> > > +   struct fsl_dma_device *fdev;
> > > +
> > > +   fdev = kzalloc(sizeof(struct fsl_dma_device), GFP_KERNEL);
> > > +   if (!fdev) {
> > > +   dev_err(&dev->dev, "No enough memory for 'priv'\n");
> > > +   err = -ENOMEM;
> > > +   goto err;
> > > +   }
> > > +   fdev->dev = &dev->dev;
> > > +   INIT_LIST_HEAD(&fdev->common.channels);
> > > +
> > > +   /* get DMA controller register base */
> > > +   err = of_address_to_resource(dev->node, 0, &fdev->reg);
> > > +   if (err) {
> > > +   dev_err(&dev->dev, "Can't get %s property 'reg'\n",
> > > +   dev->node->full_name);
> > > +   goto err;
> > > +   }
> > > +
> > > +   dev_info(&dev->dev, "Probe the Freescale DMA driver for %s "
> > > +   "controller at 0x%08x...\n",
> > > +   match->compatible, fdev->reg.start);
> > > +   fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end
> > > +   -
> > fdev->reg.start + 1);
> > > +
> > > +   dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask);
> > > +   fdev->common.device_alloc_chan_resources =
> > fsl_dma_alloc_chan_resources;
> > > +   fdev->common.device_free_chan_resources =
> > fsl_dma_free_chan_resources;
> > > +   fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy;
> > > +   fdev->common.device_is_tx_complete = fsl_dma_is_complete;
> > > +   fdev->common.device_issue_pending =
> > fsl_dma_memcpy_issue_pending;
> > > +   fdev->common.device_dependency_added =
> > fsl_dma_dependency_added;
> > > +   fdev->common.dev = &dev->dev;
> > > +
> > If this driver adds:
> >
> > dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);
> > fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt;
> >
> > It will be able to take advantage of interrupt triggered callbacks in
> > async_tx.  Without these changes async_tx will poll for the completion
> > of each transaction.
> >
>
> The new API have lacking documents :) I'll make some study here.
>
Yes, I will address that...

> Thanks!
> - zw

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


Re: [PATCH v3] [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port

2007-09-13 Thread Segher Boessenkool
>>> +   PowerPC,[EMAIL PROTECTED] {
>>
>> Maybe it would be good to use "PowerPC,e500" instead -- it would
>> make it easier to probe for the actual CPU type, that way.  Not
>> that Linux uses the name/compatible here at all ;-)
>
> I thought about this, not sure what the best solution is.

Since the CPU cores on all these SoCs are identical (well, there
might be a few revisions, or different cache sizes or such -- minor
differences that can be probed for separately), it probably is a
good idea to name them in the tree instead of having each client
have its own table.

Or is there anything about the CPU that can be derived from "8572"
but not from "e500"?

>>> +   [EMAIL PROTECTED] {
>>
>> You should put an interrupt-parent in here, so you can get rid of
>> it in all the children.
>
> Are interrupt-parent's inherited by child nodes?

A node without "interrupt-parent" uses the regular tree parent for
walking the interrupt "tree".

>> And then there's the pci_bridge thing we're discussing on IRC, of
>> course -- basically, get rid of the pci_bridge pseudo-node, and
>> move the interrupt-map for the south-bridge devices into the
>> south-bridge node.
>
> Leaving the interrupt-map in the PHB because that works and moving it 
> down has issues.

Okay, fair enough.  Are you looking at resolving those kernel issues?


Segher

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


Re: [PATCH] [POWERPC] DTS cleanup

2007-09-13 Thread Segher Boessenkool
>>> * built-in for non-standard buses (ISA, PCI)
>>
>> "built-in" is some weird CHRP property, so yes we don't need it
>> or want it.
>
> Do you suggest we get ride of it from ISA nodes as well?

Yes.  You aren't CHRP so you don't have to follow the CHRP binding.
Of course it is good to copy from that binding where it makes sense,
but how is "built-in" useful to you?

>>> * Fixed ranges on lite5200*
>>
>> This has a problem still:
>>
>>> model = "fsl,mpc5200";
>>> compatible = "mpc5200";
>>> revision = "";  // from bootloader
>>> -   #interrupt-cells = <3>;
>>> device_type = "soc";
>>> -   ranges = <0 f000 f001>;
>>> -   reg = ;
>>> +   ranges = <0 f000 c000>;
>>> +   reg = ;
>>
>> That makes "reg" and "ranges" identify an identical address range,
>> which means no subnode can claim any address in that range, so the
>> "ranges" property should go.  Alternatively, the "reg" might be
>> claiming too big a space.
>>
>> Which is it?
>
> Yeah, I think it should be 0x100 for the 'soc' regs on 52xx so I'll 
> set regs to that.

Okido.

Did I say "nice cleanups, thank you!" already?  :-)


Segher

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


Re: [PATCH] [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port

2007-09-13 Thread Segher Boessenkool
>> What is a "front side cache"?  What exactly does it cache?  If it's
>> a cache for one CPU only, that fact should be shown in the device
>> tree somehow.
>
> Its in front of the memory controllers.  Its not specific to a given 
> CPU.

Ah, I see.  That relationship is implicit in the device tree already,
both this cache controller and that memory controller are child nodes
of the same soc node, so your device tree is fine.

Just for my own understanding, is this a coherent cache?  (I'm too
lazy to read the manual ;-) )


Segher

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


Re: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xxprocessors.

2007-09-13 Thread Dan Williams
On 9/13/07, Zhang Wei-r63237 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > > +static void fsl_dma_set_src(dma_addr_t addr,
> > > +   struct dma_async_tx_descriptor
> > *tx, int index)
> > > +{
> >
> > What is index supposed to mean?  It's not used, or documented
> > anywhere than
> > I can see.
>
> I've also got more document here. Hi, Dan, could you give me some
> explanation about this API? :)
>
The index field gets used for multi-source (or multi-dest) operations.
 XOR, for example, is a multi-source operation.  I am preparing a
documentation patch.

[..]

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


[PATCH 3/3] IB/ehca: Make sure user pages are from hugetlb before using MR large pages

2007-09-13 Thread Joachim Fenkes
...because, on virtualized hardware like System p, we can't be sure that the
physical pages behind them are contiguous.

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c |   25 +++--
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 4c8f3b3..4ba8b7c 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -51,6 +51,7 @@
 
 #define NUM_CHUNKS(length, chunk_size) \
(((length) + (chunk_size - 1)) / (chunk_size))
+
 /* max number of rpages (per hcall register_rpages) */
 #define MAX_RPAGES 512
 
@@ -64,6 +65,11 @@ enum ehca_mr_pgsize {
EHCA_MR_PGSIZE16M = 0x100L
 };
 
+#define EHCA_MR_PGSHIFT4K  12
+#define EHCA_MR_PGSHIFT64K 16
+#define EHCA_MR_PGSHIFT1M  20
+#define EHCA_MR_PGSHIFT16M 24
+
 static u32 ehca_encode_hwpage_size(u32 pgsize)
 {
u32 idx = 0;
@@ -347,17 +353,16 @@ struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 
start, u64 length,
/* select proper hw_pgsize */
if (ehca_mr_largepage &&
(shca->hca_cap_mr_pgsize & HCA_CAP_MR_PGSIZE_16M)) {
-   if (length <= EHCA_MR_PGSIZE4K
-   && PAGE_SIZE == EHCA_MR_PGSIZE4K)
-   hwpage_size = EHCA_MR_PGSIZE4K;
-   else if (length <= EHCA_MR_PGSIZE64K)
-   hwpage_size = EHCA_MR_PGSIZE64K;
-   else if (length <= EHCA_MR_PGSIZE1M)
-   hwpage_size = EHCA_MR_PGSIZE1M;
-   else
-   hwpage_size = EHCA_MR_PGSIZE16M;
+   int page_shift = PAGE_SHIFT;
+   if (e_mr->umem->hugetlb) {
+   /* determine page_shift, clamp between 4K and 16M */
+   page_shift = (fls64(length - 1) + 3) & ~3;
+   page_shift = min(max(page_shift, EHCA_MR_PGSHIFT4K),
+EHCA_MR_PGSHIFT16M);
+   }
+   hwpage_size = 1UL << page_shift;
} else
-   hwpage_size = EHCA_MR_PGSIZE4K;
+   hwpage_size = EHCA_MR_PGSIZE4K; /* ehca1 only supports 4k */
ehca_dbg(pd->device, "hwpage_size=%lx", hwpage_size);
 
 reg_user_mr_fallback:
-- 
1.5.2


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


[PATCH 2/3] IB/umem: Add hugetlb flag to struct ib_umem

2007-09-13 Thread Joachim Fenkes
During ib_umem_get(), determine whether all pages from the memory region are
hugetlb pages and report this in the "hugetlb" field. Low-level driver can
use this information if they need it.

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
---
 drivers/infiniband/core/umem.c |   20 +++-
 include/rdma/ib_umem.h |1 +
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 664d2fa..2f54e29 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "uverbs.h"
 
@@ -75,6 +76,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, 
unsigned long addr,
 {
struct ib_umem *umem;
struct page **page_list;
+   struct vm_area_struct **vma_list;
struct ib_umem_chunk *chunk;
unsigned long locked;
unsigned long lock_limit;
@@ -104,6 +106,9 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, 
unsigned long addr,
 */
umem->writable  = !!(access & ~IB_ACCESS_REMOTE_READ);
 
+   /* We assume the memory is from hugetlb until proved otherwise */
+   umem->hugetlb   = 1;
+
INIT_LIST_HEAD(&umem->chunk_list);
 
page_list = (struct page **) __get_free_page(GFP_KERNEL);
@@ -112,6 +117,14 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, 
unsigned long addr,
return ERR_PTR(-ENOMEM);
}
 
+   /*
+* if we can't alloc the vma_list, it's not so bad;
+* just assume the memory is not hugetlb memory
+*/
+   vma_list = (struct vm_area_struct **) __get_free_page(GFP_KERNEL);
+   if (!vma_list)
+   umem->hugetlb = 0;
+
npages = PAGE_ALIGN(size + umem->offset) >> PAGE_SHIFT;
 
down_write(¤t->mm->mmap_sem);
@@ -131,7 +144,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, 
unsigned long addr,
ret = get_user_pages(current, current->mm, cur_base,
 min_t(int, npages,
   PAGE_SIZE / sizeof (struct page *)),
-1, !umem->writable, page_list, NULL);
+1, !umem->writable, page_list, vma_list);
 
if (ret < 0)
goto out;
@@ -152,6 +165,9 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, 
unsigned long addr,
 
chunk->nents = min_t(int, ret, IB_UMEM_MAX_PAGE_CHUNK);
for (i = 0; i < chunk->nents; ++i) {
+   if (vma_list &&
+   !is_vm_hugetlb_page(vma_list[i + off]))
+   umem->hugetlb = 0;
chunk->page_list[i].page   = page_list[i + off];
chunk->page_list[i].offset = 0;
chunk->page_list[i].length = PAGE_SIZE;
@@ -186,6 +202,8 @@ out:
current->mm->locked_vm = locked;
 
up_write(¤t->mm->mmap_sem);
+   if (vma_list)
+   free_page((unsigned long) vma_list);
free_page((unsigned long) page_list);
 
return ret < 0 ? ERR_PTR(ret) : umem;
diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h
index c533d6c..2229842 100644
--- a/include/rdma/ib_umem.h
+++ b/include/rdma/ib_umem.h
@@ -45,6 +45,7 @@ struct ib_umem {
int offset;
int page_size;
int writable;
+   int hugetlb;
struct list_headchunk_list;
struct work_struct  work;
struct mm_struct   *mm;
-- 
1.5.2


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


[PATCH 1/3] IB/ehca: Fix large page HW cap defines

2007-09-13 Thread Joachim Fenkes
From: Hoang-Nam Nguyen <[EMAIL PROTECTED]>

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_classes.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h 
b/drivers/infiniband/hw/ehca/ehca_classes.h
index 206d4eb..c2edd4c 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -99,10 +99,10 @@ struct ehca_sport {
struct ehca_sma_attr saved_attr;
 };
 
-#define HCA_CAP_MR_PGSIZE_4K  1
-#define HCA_CAP_MR_PGSIZE_64K 2
-#define HCA_CAP_MR_PGSIZE_1M  4
-#define HCA_CAP_MR_PGSIZE_16M 8
+#define HCA_CAP_MR_PGSIZE_4K  0x8000
+#define HCA_CAP_MR_PGSIZE_64K 0x4000
+#define HCA_CAP_MR_PGSIZE_1M  0x2000
+#define HCA_CAP_MR_PGSIZE_16M 0x1000
 
 struct ehca_shca {
struct ib_device ib_device;
-- 
1.5.2


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


[PATCH 0/3] IB/ehca: MR/MW fixes

2007-09-13 Thread Joachim Fenkes
This patchset replaces Nam's previous MR/MW patch (posted by me). I split
the #define fixes into a separate patch and moved the "is the memory from
hugetlbfs?" code into ib_umem_get().

[1/3] fixes the page size HW cap defines
[2/3] adds the hugetlb test to ib_umem_get()
[3/3] finally uses the hugetlb flag in ehca_reg_user_mr()

The patches should apply cleanly, in order, on top of my previous 12-patch
set. Please review the changes and apply the patches for 2.6.24 if they are
okay.

Regards,
  Joachim

-- 
Joachim Fenkes  --  eHCA Linux Driver Developer and Hardware Tamer
IBM Deutschland Entwicklung GmbH  --  Dept. 3627 (I/O Firmware Dev. 2)
Schoenaicher Strasse 220  --  71032 Boeblingen  --  Germany
eMail: [EMAIL PROTECTED]



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


Re: [PATCH 10/10] mpc82xx: Add pq2fads board support.

2007-09-13 Thread Scott Wood
On Thu, Sep 13, 2007 at 01:39:58AM -0500, Kumar Gala wrote:
> >+CS: chipselect {
> 
> We need to document this in booting-without-of.

OK.

> >+PIC: [EMAIL PROTECTED] {
> >+#interrupt-cells = <2>;
> >+interrupt-controller;
> >+reg = <10c00 80>;
> >+compatible = "fsl,mpc8280-pic", "fsl,pq2-pic";
> 
> this should also have a "fsl,cpm2-pic" or something of that form.   
> (exact same pic exists on 8560, 85xx+CPM)

OK...  I did it as pq2 rather than cpm2 because IIRC it wasn't described
under the CPM section of the manual, so I didn't know if 85xx CPM2 had
the same thing.

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


[PATCH] ucc_geth: fix compilation

2007-09-13 Thread Anton Vorontsov
Currently qe_bd_t is used in the macro call -- dma_unmap_single,
which is a no-op on PPC32, thus error is hidden today. Starting
with 2.6.24, macro will be replaced by the empty static function,
and erroneous use of qe_bd_t will trigger compilation error.

Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>
---

Reposting this to include netdev in Cc.

 drivers/net/ucc_geth.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 12e01b2..9a38dfe 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2148,7 +2148,7 @@ static void ucc_geth_memclean(struct ucc_geth_private 
*ugeth)
for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) {
if (ugeth->tx_skbuff[i][j]) {
dma_unmap_single(NULL,
-((qe_bd_t *)bd)->buf,
+((struct qe_bd *)bd)->buf,
 (in_be32((u32 *)bd) &
  BD_LENGTH_MASK),
 DMA_TO_DEVICE);
-- 
1.5.0.6
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/5] Add Freescale DMA and DMA channel to Documentation/powerpc/booting-without-of.txt file.

2007-09-13 Thread Kumar Gala

On Sep 13, 2007, at 9:52 AM, Scott Wood wrote:

> On Thu, Sep 13, 2007 at 04:09:29AM +0200, Segher Boessenkool wrote:
 I have a strange issue here. If I rename 'fsl,dma' to
 'fsl,mpc8540-dma',
 the 'fsl,mpc8540-dma-channel' will be also regarded as DMA  
 device not
 DMA channel.

Have we closed on what the device-tree parts for this should look  
like?  I'd like to at least get those parts of this patch into my  
tree if possible for 2.6.24.

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


Re: [PATCH 1/5] Add Freescale DMA and DMA channel to Documentation/powerpc/booting-without-of.txt file.

2007-09-13 Thread Scott Wood
On Thu, Sep 13, 2007 at 04:09:29AM +0200, Segher Boessenkool wrote:
> >>I have a strange issue here. If I rename 'fsl,dma' to 
> >>'fsl,mpc8540-dma',
> >>the 'fsl,mpc8540-dma-channel' will be also regarded as DMA device not
> >>DMA channel.
> >
> >What tree are you using?  Commit 
> >804ace8881d211ac448082e871dd312132393049
> >in Paul's git tree should have fixed that.
> 
> Strange, I don't see that commit -- maybe gitweb is broken, or
> maybe the patch was superseded, or maybe it just disappeared?
> It's still shown in patchworks with this commit id fwiw.

I see it here:
http://git.kernel.org/?p=linux/kernel/git/paulus/powerpc.git;a=commit;h=804ace8881d211ac448082e871dd312132393049

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


Re: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xxprocessors.

2007-09-13 Thread Scott Wood
On Thu, Sep 13, 2007 at 03:13:06AM -0700, Zhang Wei-r63237 wrote:
> > After dropping the lock, you can no longer assume that your 
> > iterator is
> > still valid; you need to work off of the list head.
> > 
> 
> list_for_each_entry_safe() is used here. I think the safe should be ok.
> :P

Nope.  The safety is against the particular item you're iterating on
being removed; it doesn't protect against the *next* entry being removed
when you drop the lock.

> > Why not use an array of channels?
> 
> The list is used in dma engine core file. And it's possible that there
> are not all channel listed in dts and array.

I'm not sure I understand what you mean by the latter comment...

> > You could have the features be part of the match struct, so 
> > you don't have
> > to do extra strcmps.
> > 
> 
> Can I use the data field of struct of_device_id?

Yes, that's what it's there for. :-)

> > > +static struct of_device_id of_fsl_dma_ids[] = {
> > > + { .compatible = "fsl,dma", },
> > > +};
> > 
> > Why do we need to bind to the parent node at all?
> 
> Yes, the MPC83xx should get interrupt source from DMA device register.

You don't need to bind to it for that, though -- just call of_get_parent
from the channel probe.  Though it might be easier to bind to the parent
to ensure that you only register the IRQ once.

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


Re: [PATCH 2/9] 8xx: Infrastructure code cleanup.

2007-09-13 Thread Scott Wood
On Thu, Sep 13, 2007 at 05:11:25PM +1000, David Gibson wrote:
> > -#define immr_unmap(addr)   iounmap(addr)
> > +#define immr_map(member) (&mpc8xx_immr->member)
> > +#define immr_map_size(member, size) (&mpc8xx_immr->member)
> > +#define immr_unmap(addr) iounmap(addr)
> 
> This looks bogus.  You're replacing the old crap immr_map() functions,
> which ioremap()ed the registers every time, with a much simpler
> version which uses an established-once mapping of the register
> region.  AFAICT, anywah.
> 
> So far, so good - but your immr_unmap() still does an iounmap() which
> is surely wrong - it should now be a no-op, leaving the mpc8xx_immr
> mapping intact.  You probably get away with it by accident, because I
> imagine attempting to unmap an unaligned chunk of the region will just
> fail.

D'oh!  Thanks for pointing that out.

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


Re: [PATCH] IB/ehca: Make sure user pages are from hugetlb before using MR large pages

2007-09-13 Thread Joachim Fenkes
Roland Dreier <[EMAIL PROTECTED]> wrote on 13.09.2007 06:33:45:

>  > -#define HCA_CAP_MR_PGSIZE_4K  1
>  > -#define HCA_CAP_MR_PGSIZE_64K 2
>  > -#define HCA_CAP_MR_PGSIZE_1M  4
>  > -#define HCA_CAP_MR_PGSIZE_16M 8
>  > +#define HCA_CAP_MR_PGSIZE_4K  0x8000
>  > +#define HCA_CAP_MR_PGSIZE_64K 0x4000
>  > +#define HCA_CAP_MR_PGSIZE_1M  0x2000
>  > +#define HCA_CAP_MR_PGSIZE_16M 0x1000
> 
> Not sure I understand what this has to do with things... is this an
> unrelated fix?

Kinda. I can put it into its own patch if you want.
 
> I would suggest extending ib_umem_get() to check the vmas and adding a
> member to struct ib_umem to say whether the memory is entirely covered
> by hugetlb pages or not.

I like that approach - one patch coming right up! =)
 
>  > +  default: /* out of mem */
>  > + ib_mr = ERR_PTR(-ENOMEM);
>  > + goto reg_user_mr_exit1;
> 
> It seems like it would be better to just assume the memory is not from
> a hugetlb is ehca_is_mem_hugetlb() fails its memory allocation and
> fall back to the PAGE_SIZE case rather than failing entirely.

If ehca_is_mem_hugetlb() runs out of memory, ehca_reg_mr() is rather 
unlikely to get the memory, but it's worth a try, I'll give you that. I'll 
make the umem patch work that way.

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


Re: oftree and external connected devices

2007-09-13 Thread Olof Johansson
On Thu, Sep 13, 2007 at 01:26:26PM +0200, Juergen Beisert wrote:
> Hi,
> 
> I'm using an MPC5200B based system with various external connected devices to 
> its LocalPlusBus. On other architectures I would register them as platform 
> devices (no chance to autodetect these devices). But on PowerPC architecture?

If it's a special case of something that it's unlikely that you'll reuse
the driver for, I'd say go ahead with a platform driver. There's nothing in the
PPC kernel that stops it from working.

We're just trying to avoid it for common devices that platforms might share,
and instead of describing hardware in the platform devices setup, describe it
in the device tree instead.

So it depends on how much work you want to invest in it, and if you're
planning on ever submitting the driver upstream. If you are, going
with a simple device tree definiton would be best (the kernel side,
to move a platform driver to instead be an of_platform driver is easy,
and can be done afterwards).

> Is the oftree description also intended to describe these kind of external 
> devices, or only SoC's internal devices? If its also intended for external 
> devices, how to do so? Are there any examples? I didn't find anything useful 
> yet.

It can be used to describe on-board or off-board devices alike.


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


Re: [PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE()

2007-09-13 Thread Arnd Bergmann
On Thursday 13 September 2007, Michael Ellerman wrote:
> Well that'd be nice, but I don't see anywhere that that happens. AFAICT
> the acquire we do in the first coredump callback is the first the SPU
> contexts know about their PPE process dying. And spufs is still live, so
> I think we definitely need to grab the mutex, or we might race with
> userspace accessing spufs files.

Right, I was only thinking about the dumping process itself, but there
may be other processes that still have files open for that context.

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


oftree and external connected devices

2007-09-13 Thread Juergen Beisert
Hi,

I'm using an MPC5200B based system with various external connected devices to 
its LocalPlusBus. On other architectures I would register them as platform 
devices (no chance to autodetect these devices). But on PowerPC architecture?

Is the oftree description also intended to describe these kind of external 
devices, or only SoC's internal devices? If its also intended for external 
devices, how to do so? Are there any examples? I didn't find anything useful 
yet.

Juergen
-- 
Dipl.-Ing. Juergen Beisert | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
    Handelsregister: Amtsgericht Hildesheim, HRA 2686
     Vertretung Sued/Muenchen, Germany
   Phone: +49-8766-939 228 |  Fax: +49-5121-206917-9
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Define termios_1 functions for powerpc, s390, avr32 and frv

2007-09-13 Thread Andrew Morton
On Thu, 13 Sep 2007 18:53:46 +0900 Paul Mundt <[EMAIL PROTECTED]> wrote:

> On Thu, Sep 13, 2007 at 05:22:36PM +1000, Michael Neuling wrote:
> > > > Commit f629307c857c030d5a3dd777fee37c8bb395e171 introduced uses of
> > > > kernel_termios_to_user_termios_1 and user_termios_to_kernel_termios_1
> > > > on all architectures.  However, powerpc, s390, avr32 and frv don't
> > > > currently define those functions since their termios struct didn't
> > > > need to be changed when the arbitrary baud rate stuff was added, and
> > > > thus the kernel won't currently build on those architectures.
> > > 
> > > alpha, parisc, sh, sparc{64,}, xtensa are still broken with this error...
> > 
> > They need to include  in asm-/termios.h
> > like in powerpc.
> > 
> > Alternatively tonyb's patch should fix them.  Could also do that?
> > 
> Is there a consensus for this? It's a bit annoying to have this stuff
> broken this late in 2.6.23. If Tony's patch gets applied, then this stuff
> will work itself out. Otherwise everything has to be patched for
> asm-generic/termios.h. In which case.. here's the patch to define them on
> sh and sh64.

I think we need to go with Tony's patch.  sparc32 and sparc64 are
presently broken too, and the patch which converts sparc to use the
new interfaces introduces a few build errors.


From: Tony Breeds <[EMAIL PROTECTED]>

Add Guards around TIOCSLCKTRMIOS and TIOCGLCKTRMIOS.

Signed-off-by: Tony Breeds <[EMAIL PROTECTED]>
Cc: Alan Cox <[EMAIL PROTECTED]>
Cc: Linus Torvalds <[EMAIL PROTECTED]>
Cc: Paul Mackerras <[EMAIL PROTECTED]>
Cc: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Cc: Heiko Carstens <[EMAIL PROTECTED]>
Cc: "David S. Miller" <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/char/tty_ioctl.c |   14 ++
 1 file changed, 14 insertions(+)

diff -puN drivers/char/tty_ioctl.c~sparc64-and-others-fix-tty_ioctlc-build 
drivers/char/tty_ioctl.c
--- a/drivers/char/tty_ioctl.c~sparc64-and-others-fix-tty_ioctlc-build
+++ a/drivers/char/tty_ioctl.c
@@ -795,6 +795,19 @@ int n_tty_ioctl(struct tty_struct * tty,
if (L_ICANON(tty))
retval = inq_canon(tty);
return put_user(retval, (unsigned int __user *) arg);
+#ifndef TCGETS2
+   case TIOCGLCKTRMIOS:
+   if (kernel_termios_to_user_termios((struct termios 
__user *)arg, real_tty->termios_locked))
+   return -EFAULT;
+   return 0;
+
+   case TIOCSLCKTRMIOS:
+   if (!capable(CAP_SYS_ADMIN))
+   return -EPERM;
+   if 
(user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios 
__user *) arg))
+   return -EFAULT;
+   return 0;
+#else
case TIOCGLCKTRMIOS:
if (kernel_termios_to_user_termios_1((struct termios 
__user *)arg, real_tty->termios_locked))
return -EFAULT;
@@ -806,6 +819,7 @@ int n_tty_ioctl(struct tty_struct * tty,
if 
(user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios 
__user *) arg))
return -EFAULT;
return 0;
+#endif
 
case TIOCPKT:
{
_

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


Re: Define termios_1 functions for powerpc, s390, avr32 and frv

2007-09-13 Thread Paul Mundt
On Thu, Sep 13, 2007 at 05:22:36PM +1000, Michael Neuling wrote:
> > > Commit f629307c857c030d5a3dd777fee37c8bb395e171 introduced uses of
> > > kernel_termios_to_user_termios_1 and user_termios_to_kernel_termios_1
> > > on all architectures.  However, powerpc, s390, avr32 and frv don't
> > > currently define those functions since their termios struct didn't
> > > need to be changed when the arbitrary baud rate stuff was added, and
> > > thus the kernel won't currently build on those architectures.
> > 
> > alpha, parisc, sh, sparc{64,}, xtensa are still broken with this error...
> 
> They need to include  in asm-/termios.h
> like in powerpc.
> 
> Alternatively tonyb's patch should fix them.  Could also do that?
> 
Is there a consensus for this? It's a bit annoying to have this stuff
broken this late in 2.6.23. If Tony's patch gets applied, then this stuff
will work itself out. Otherwise everything has to be patched for
asm-generic/termios.h. In which case.. here's the patch to define them on
sh and sh64.

Signed-off-by: Paul Mundt <[EMAIL PROTECTED]>

--

 include/asm-sh/termios.h   |   34 +-
 include/asm-sh64/termios.h |   34 +-
 2 files changed, 2 insertions(+), 66 deletions(-)

diff --git a/include/asm-sh/termios.h b/include/asm-sh/termios.h
index e7c8f86..c57f74e 100644
--- a/include/asm-sh/termios.h
+++ b/include/asm-sh/termios.h
@@ -49,39 +49,7 @@ struct termio {
 */
 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
 
-/*
- * Translate a "termio" structure into a "termios". Ugh.
- */
-#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
-   unsigned short __tmp; \
-   get_user(__tmp,&(termio)->x); \
-   *(unsigned short *) &(termios)->x = __tmp; \
-}
-
-#define user_termio_to_kernel_termios(termios, termio) \
-({ \
-   SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
-   SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
-   SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
-   SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
-   copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
-})
-
-/*
- * Translate a "termios" structure into a "termio". Ugh.
- */
-#define kernel_termios_to_user_termio(termio, termios) \
-({ \
-   put_user((termios)->c_iflag, &(termio)->c_iflag); \
-   put_user((termios)->c_oflag, &(termio)->c_oflag); \
-   put_user((termios)->c_cflag, &(termio)->c_cflag); \
-   put_user((termios)->c_lflag, &(termio)->c_lflag); \
-   put_user((termios)->c_line,  &(termio)->c_line); \
-   copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
-})
-
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, 
sizeof(struct termios))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct 
termios))
+#include 
 
 #endif /* __KERNEL__ */
 
diff --git a/include/asm-sh64/termios.h b/include/asm-sh64/termios.h
index dc44e6e..b61ce95 100644
--- a/include/asm-sh64/termios.h
+++ b/include/asm-sh64/termios.h
@@ -60,39 +60,7 @@ struct termio {
 */
 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
 
-/*
- * Translate a "termio" structure into a "termios". Ugh.
- */
-#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
-   unsigned short __tmp; \
-   get_user(__tmp,&(termio)->x); \
-   *(unsigned short *) &(termios)->x = __tmp; \
-}
-
-#define user_termio_to_kernel_termios(termios, termio) \
-({ \
-   SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
-   SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
-   SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
-   SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
-   copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
-})
-
-/*
- * Translate a "termios" structure into a "termio". Ugh.
- */
-#define kernel_termios_to_user_termio(termio, termios) \
-({ \
-   put_user((termios)->c_iflag, &(termio)->c_iflag); \
-   put_user((termios)->c_oflag, &(termio)->c_oflag); \
-   put_user((termios)->c_cflag, &(termio)->c_cflag); \
-   put_user((termios)->c_lflag, &(termio)->c_lflag); \
-   put_user((termios)->c_line,  &(termio)->c_line); \
-   copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
-})
-
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, 
sizeof(struct termios))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct 
termios))
+#include 
 
 #endif /* __KERNEL__ */
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


RE: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xxprocessors.

2007-09-13 Thread Zhang Wei-r63237
Hi, 

> > +static void fsl_dma_set_src(dma_addr_t addr,
> > +   struct dma_async_tx_descriptor 
> *tx, int index)
> > +{
> 
> What is index supposed to mean?  It's not used, or documented 
> anywhere than
> I can see.

I've also got more document here. Hi, Dan, could you give me some
explanation about this API? :)

> 
> > +   else {
> > +   /* Run the link descriptor callback function */
> > +   if (desc->async_tx.callback) {
> > +   
> spin_unlock_irqrestore(&fsl_chan->desc_lock,
> > +   flags);
> > +   dev_dbg(fsl_chan->device->dev,
> > +   "link descriptor %p 
> callback\n", desc);
> > +   desc->async_tx.callback(
> > +   
> desc->async_tx.callback_param);
> > +   
> spin_lock_irqsave(&fsl_chan->desc_lock, flags);
> 
> After dropping the lock, you can no longer assume that your 
> iterator is
> still valid; you need to work off of the list head.
> 

list_for_each_entry_safe() is used here. I think the safe should be ok.
:P

> > +   /* Find the first un-transfer desciptor */
> > +   for (ld_node = fsl_chan->ld_queue.next;
> > +   (ld_node != &fsl_chan->ld_queue)
> > +   && (DMA_SUCCESS == dma_async_is_complete(
> > +   
> to_fsl_desc(ld_node)->async_tx.cookie,
> > +   fsl_chan->completed_cookie,
> > +   fsl_chan->common.cookie));
> > +   ld_node = ld_node->next);
> 
> Call fsl_dma_is_complete directly, don't waste time going through the
> virtual call.
> 
> And you have a recursive lock usage here; fsl_dma_is_complete calls
> fsl_chan_ld_cleanup, which acquires desc_lock, but you 
> already have it.
> 
> Couldn't you just call fsl_chan_ld_cleanup, and then check 
> what's at the
> head of the list?
> 

I'll split interrupt and poll here.

> > +static irqreturn_t fsl_dma_do_interrupt(int irq, void *data)
> > +{
> > +   struct fsl_dma_device *fdev = (struct fsl_dma_device *)data;
> > +   struct fsl_dma_chan *fsl_chan = NULL;
> > +   u32 gsr;
> > +   int ch_nr;
> > +   struct dma_chan *int_chan;
> > +
> > +   gsr = (fdev->feature & FSL_DMA_BIG_ENDIAN) ? 
> in_be32(fdev->reg_base)
> > +   : in_le32(fdev->reg_base);
> > +   ch_nr = (32 - ffs(gsr)) / 8;
> > +
> > +   list_for_each_entry(int_chan, &fdev->common.channels, 
> device_node)
> > +   if (to_fsl_chan(int_chan)->id == ch_nr)
> > +   fsl_chan = to_fsl_chan(int_chan);
> 
> Why not use an array of channels?

The list is used in dma engine core file. And it's possible that there
are not all channel listed in dts and array.

> > +
> > +   return fsl_chan ? fsl_dma_chan_do_interrupt(irq, 
> fsl_chan) : IRQ_NONE;
> > +
> > +}
> > +
> > +static void dma_do_tasklet(unsigned long unused)
> > +{
> > +   struct fsl_desc_sw *desc, *_desc;
> > +   unsigned long flags;
> > +
> > +   spin_lock_irqsave(&recy_ln_lock, flags);
> > +   list_for_each_entry_safe(desc, _desc, &recy_ln_chain, node) {
> > +   struct fsl_dma_chan *fsl_chan =
> > +   
> to_fsl_chan(desc->async_tx.chan);
> > +   /* Run the link descriptor callback function */
> > +   if (desc->async_tx.callback) {
> > +   spin_unlock_irqrestore(&recy_ln_lock, flags);
> > +   dev_dbg(fsl_chan->device->dev,
> > +   "dma_tasklet: link descriptor 
> %p callback\n",
> > +   desc);
> > +   desc->async_tx.callback(
> > +   desc->async_tx.callback_param);
> > +   spin_lock_irqsave(&recy_ln_lock, flags);
> > +   }
> > +   /* Recycle it! */
> > +   list_del(&desc->node);
> 
> You should remove it from the list before dropping the lock, 
> as otherwise
> something else could come along and remove it again.

All right!

> 
> > +   if (strcmp(match->compatible, "fsl,mpc8540-dma-channel") == 0)
> > +   new_fsl_chan->feature = FSL_DMA_IP_86XX | 
> FSL_DMA_BIG_ENDIAN;
> 
> Shouldn't it be 85XX, to be consistent?
> 
> > +   else if (strcmp(match->compatible, 
> "fsl,mpc8349-dma-channel") == 0)
> > +   new_fsl_chan->feature = FSL_DMA_IP_83XX | 
> FSL_DMA_LITTLE_ENDIAN;
> 
> You could have the features be part of the match struct, so 
> you don't have
> to do extra strcmps.
> 

Can I use the data field of struct of_device_id?

> 
> > +static struct of_device_id of_fsl_dma_ids[] = {
> > +   { .compatible = "fsl,dma", },
> > +};
> 
> Why do we need to bind to the parent node at all?

Yes, the MPC83xx should get interrupt source from DMA device register.

> 
> > +/* There is no asm instructions for 64 bits reverse loads 
> and stores */
> > +static u64

Re: [PATCH 00/10] x86: Reduce Memory Usage and Inter-Node message traffic (v3)

2007-09-13 Thread Andi Kleen
On Wednesday 12 September 2007 03:56, [EMAIL PROTECTED] wrote:
> Note:
>
> This patch consolidates all the previous patches regarding
> the conversion of static arrays sized by NR_CPUS into per_cpu
> data arrays and is referenced against 2.6.23-rc6 .


Looks good to me from the x86 side. I'll leave it to Andrew to
handle for now though because it touches too many files
outside x86.

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


Re: [PATCH] IB/ehca: Make sure user pages are from hugetlb before using MR large pages

2007-09-13 Thread Christoph Raisch
Roland Dreier wrote on 13.09.2007 06:33:45:

>
> Also if someone runs a kernel with 64K pages on a machine where they
> end up being simulated from 4K pages, do you have the same issue with
> the hypervisor ganging together non-contiguous pages?
With todays hypervisor and todays pagesizes and todays MMUs
we don't have this problem if eHCA is enabled.

It is difficult to make predictions about the future,
but that's not specific to driver development. ;-)

>
>  - R.

 - Christoph R.

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


Re: [PATCH 2/9] 8xx: Infrastructure code cleanup.

2007-09-13 Thread Vitaly Bordug
On Thu, 13 Sep 2007 17:11:25 +1000
David Gibson wrote:

> Didn't notice this before - only when some yak shaving led me into
> looking at the horrors of the 8xx imm mapping code...
> 
> But..
> [snip]
> > diff --git a/include/asm-powerpc/fs_pd.h
> > b/include/asm-powerpc/fs_pd.h index c624915..733e8cb 100644
> > --- a/include/asm-powerpc/fs_pd.h
> > +++ b/include/asm-powerpc/fs_pd.h
> > @@ -45,22 +45,11 @@
> >  #include 
> >  #include 
> >  
> > -#define
> > immr_map(member)\
> > -({
> > \
> > -   u32 offset = offsetof(immap_t,
> > member);\
> > -   void *addr = ioremap (IMAP_ADDR +
> > offset, \
> > -
> > sizeof( ((immap_t*)0)->member));\
> > -
> > addr;
> > \ -}) -
> > -#define immr_map_size(member,
> > size)   \
> > -({
> > \
> > -   u32 offset = offsetof(immap_t,
> > member);\
> > -   void *addr = ioremap (IMAP_ADDR + offset,
> > size);  \
> > -
> > addr;
> > \ -}) +extern immap_t __iomem *mpc8xx_immr;
> >  
> > -#define immr_unmap(addr)   iounmap(addr)
> > +#define immr_map(member) (&mpc8xx_immr->member)
> > +#define immr_map_size(member, size) (&mpc8xx_immr->member)
> > +#define immr_unmap(addr) iounmap(addr)
> 
> This looks bogus.  You're replacing the old crap immr_map() functions,
> which ioremap()ed the registers every time, with a much simpler
> version which uses an established-once mapping of the register
> region.  AFAICT, anywah.
> 
> So far, so good - but your immr_unmap() still does an iounmap() which
> is surely wrong - it should now be a no-op, leaving the mpc8xx_immr
> mapping intact.  You probably get away with it by accident, because I
> imagine attempting to unmap an unaligned chunk of the region will just
> fail.
>

yes, it should do nop instead of iounmap. 
> In fact, with this patch in place, I'd like to see another patch which
> removes all calls to immr_map() and immr_unmap(), simply accessing the
> common mapping directly.
> 
Sorry, but originally, that stuff was created to get rid of BSP ifdefs in 
drivers. For PQ family, it is a common practice
to have single driver handling all 3 CPU families, which use the same logic, 
but immr structure differs a little bit.

At this point it's clear case-by-case ioremapping does not have firm benefit, 
but getting back to the way it was is useless either.
In ideal world, we'd have all those stuff put into dts and have specific 
drivers be a shim layer between core hw and IO drivers.


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


Re: Define termios_1 functions for powerpc, s390, avr32 and frv

2007-09-13 Thread Jan Dittmer
Paul Mackerras wrote:
> Commit f629307c857c030d5a3dd777fee37c8bb395e171 introduced uses of
> kernel_termios_to_user_termios_1 and user_termios_to_kernel_termios_1
> on all architectures.  However, powerpc, s390, avr32 and frv don't
> currently define those functions since their termios struct didn't
> need to be changed when the arbitrary baud rate stuff was added, and
> thus the kernel won't currently build on those architectures.

alpha, parisc, sh, sparc{64,}, xtensa are still broken with this error...

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


Re: Define termios_1 functions for powerpc, s390, avr32 and frv

2007-09-13 Thread Michael Neuling
> > Commit f629307c857c030d5a3dd777fee37c8bb395e171 introduced uses of
> > kernel_termios_to_user_termios_1 and user_termios_to_kernel_termios_1
> > on all architectures.  However, powerpc, s390, avr32 and frv don't
> > currently define those functions since their termios struct didn't
> > need to be changed when the arbitrary baud rate stuff was added, and
> > thus the kernel won't currently build on those architectures.
> 
> alpha, parisc, sh, sparc{64,}, xtensa are still broken with this error...

They need to include  in asm-/termios.h
like in powerpc.

Alternatively tonyb's patch should fix them.  Could also do that?

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


Re: Define termios_1 functions for powerpc, s390, avr32 and frv

2007-09-13 Thread David Miller
From: Jan Dittmer <[EMAIL PROTECTED]>
Date: Thu, 13 Sep 2007 08:57:13 +0200

> Paul Mackerras wrote:
> > Commit f629307c857c030d5a3dd777fee37c8bb395e171 introduced uses of
> > kernel_termios_to_user_termios_1 and user_termios_to_kernel_termios_1
> > on all architectures.  However, powerpc, s390, avr32 and frv don't
> > currently define those functions since their termios struct didn't
> > need to be changed when the arbitrary baud rate stuff was added, and
> > thus the kernel won't currently build on those architectures.
> 
> alpha, parisc, sh, sparc{64,}, xtensa are still broken with this error...

I sent Alan a patch last week that added the Sparc bits, it would
be nice if he or someone else could merge it as I'm travelling
today :-)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


  1   2   >