Re: [PATCH] powerpc: Fix /dev/oldmem for kdump

2008-07-02 Thread Michael Ellerman
On Thu, 2008-07-03 at 12:02 +0530, Sachin P. Sant wrote:
> Michael Ellerman wrote:
> > Even though I wrote this, it was so long ago I can't really vouch for
> > it. If you've tested it and it works Sachin then we should merge it. Is
> > this fix in distros or does it not apply?
> >   
> Yes, i have tested this on couple of power boxes and the patch
> works fine. [ i can copy dump using both /proc/vmcore and /dev/oldmem
> interface ]

OK great, thanks for that.

> No this fix is not part of distro ATM. But yes it applies to distros
> also. Once it is merged upstream, distros will eventually pick this up.

Crud, OK well I guess we should hurry up and merge it then :D

Paul, this has been broken for quite a while, but it would still be nice
if the fix was in 26 - sorry!

Acked-by: Michael Ellerman <[EMAIL PROTECTED]>

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH] powerpc: Fix /dev/oldmem for kdump

2008-07-02 Thread Sachin P. Sant

Michael Ellerman wrote:

Even though I wrote this, it was so long ago I can't really vouch for
it. If you've tested it and it works Sachin then we should merge it. Is
this fix in distros or does it not apply?
  

Yes, i have tested this on couple of power boxes and the patch
works fine. [ i can copy dump using both /proc/vmcore and /dev/oldmem
interface ]

No this fix is not part of distro ATM. But yes it applies to distros
also. Once it is merged upstream, distros will eventually pick this up.

Thanks
-Sachin


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


Re: [PATCH] powerpc: Fix /dev/oldmem for kdump

2008-07-02 Thread Michael Ellerman
On Thu, 2008-06-26 at 16:25 +0530, Sachin P. Sant wrote:
> This one has been pending for a long time. Somehow never
> made it upstream.
> 
> Resending the patch which fixes /dev/oldmem interface for kdump.
> 
> Tested with 2.6.26-rc8.
> 
> Signed-off-by : Michael Ellerman <[EMAIL PROTECTED]>

Even though I wrote this, it was so long ago I can't really vouch for
it. If you've tested it and it works Sachin then we should merge it. Is
this fix in distros or does it not apply?

> Also make sure we're only reading one page or less at a time.

It looks like the generic code ensures that I think, but it can't hurt.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH] powerpc: fixup lwsync at runtime

2008-07-02 Thread Michael Ellerman
On Wed, 2008-07-02 at 10:57 -0500, Kumar Gala wrote:
> On Jul 2, 2008, at 4:34 AM, Michael Ellerman wrote:
> 
> > On Tue, 2008-07-01 at 09:48 -0500, Kumar Gala wrote:
> >> On Jul 1, 2008, at 1:29 AM, Michael Ellerman wrote:
> >
>  diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/
>  setup_32.c
>  index 9e83add..0109e7f 100644
>  --- a/arch/powerpc/kernel/setup_32.c
>  +++ b/arch/powerpc/kernel/setup_32.c
>  @@ -101,6 +101,10 @@ unsigned long __init early_init(unsigned long
>  dt_ptr)
> PTRRELOC(&__start___ftr_fixup),
> PTRRELOC(&__stop___ftr_fixup));
> 
>  +do_lwsync_fixups(spec->cpu_features,
>  + PTRRELOC(&__start___lwsync_fixup),
>  + PTRRELOC(&__stop___lwsync_fixup));
>  +
> >>>
> >>> This could be changed to use cur_cpu_spec->cpu_features, and then  
> >>> all
> >>> the call sites would be passing that, which would mean
> >>> do_lwsync_fixups() could just check cur_cpu_spec->cpu_features
> >>> directly.
> >>
> >> cur_cpu_spec and spec at this point arent the same thing.
> >
> > Aren't they? I must be missing something:
> 
> There is an issue with how ppc32 classic gets here and relocation.  If  
> I change the call to:
> 
>  do_lwsync_fixups(cur_cpu_spec->cpu_features,
>   PTRRELOC(&__start___lwsync_fixup),
>   PTRRELOC(&__stop___lwsync_fixup));
> 
> I can't boot on a 6xx based machine anymore.

OK, I guess it needs a PTRRELOC(), but it's not that important, don't
worry about it.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: linux-next: manual merge of the powerpc tree

2008-07-02 Thread Grant Likely
On Thu, Jul 03, 2008 at 01:39:05PM +1000, Stephen Rothwell wrote:
> Hi Paul,
> 
> Today's linux-next merge of the powerpc tree got a conflict in
> arch/powerpc/sysdev/fsl_soc.c between commit
> 4eac6a8b17ce5ebe66eb94b6a0b43aa3a2bf7ea6 ("i2c-mpc: Convert to an
> of_platform driver") from the i2c tree and commits

It probably would have been better for this patch to go in via the
PowerPC tree.  It only touches powerpc-specific i2c code, not any i2c
core code.  There are quite a few MPC ports which use this driver,
I'd be happier to see it dropped from the i2c tree and merged in via
either Kumar or myself.

I'd also like to see some acks from people who have tested this patch
before it goes in.  (I'm just as guilty here; I'll apply it and test it
to my tree tomorrow).

g.

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


linux-next: manual merge of the powerpc tree

2008-07-02 Thread Stephen Rothwell
Hi Paul,

Today's linux-next merge of the powerpc tree got a conflict in
arch/powerpc/sysdev/fsl_soc.c between commit
4eac6a8b17ce5ebe66eb94b6a0b43aa3a2bf7ea6 ("i2c-mpc: Convert to an
of_platform driver") from the i2c tree and commits
22fb7d9be593181e2f779cf7a8421703a6be713b ("[POWERPC] fsl: Add warning for
unrecognized I2C nodes in the device tree"),
64f9b5ee17ee7974d7cc58d75221432d86960ba3 ("[POWERPC] fsl: Add CS4270 i2c
data to fsl_soc.c") and e026892c85571e12f11abffde5a90bcc704d663e
("[POWERPC] fsl: Update fsl_soc to use cell-index property of I2C nodes")
from the powerpc tree.

The changes from the powerpc tree modify code that the i2c tree removes.
I used the i2c tree's version, but someone should check the result.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpT6hcrQgpEm.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 4/5 v2] Split code into helper routines for drconf memory

2008-07-02 Thread Nathan Fontenot

Oops, some silliness in one of the comments.  New patch below.

This patch splits off several pieces of code that parse the
ibm,dynamic-reconfiguration-memory node of the device tree into separate
helper routines.  This is in preparation for the followon patch that will
use these helper routines.  There are no functional changes in this patch.

Signed-off-by: Nathan Fontenot <[EMAIL PROTECTED]>
---
arch/powerpc/mm/numa.c |  209 +++--
1 file changed, 170 insertions(+), 39 deletions(-)

Index: linux-2.6.git/arch/powerpc/mm/numa.c
===
--- linux-2.6.git.orig/arch/powerpc/mm/numa.c   2008-07-01 18:40:55.0 
-0500
+++ linux-2.6.git/arch/powerpc/mm/numa.c2008-07-02 22:29:58.0 
-0500
@@ -268,6 +268,144 @@
return result;
}

+struct of_drconf_cell {
+   u64 base_addr;
+   u32 drc_index;
+   u32 reserved;
+   u32 aa_index;
+   u32 flags;
+};
+
+#define DRCONF_MEM_ASSIGNED0x0008
+#define DRCONF_MEM_AI_INVALID  0x0040
+#define DRCONF_MEM_RESERVED0x0080
+
+/*
+ * Read the next lmb list entry from the ibm,dynamic-memory property
+ * and return the information in the provided of_drconf_cell structure.
+ */
+static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp)
+{
+   const u32 *cp;
+
+   drmem->base_addr = read_n_cells(n_mem_addr_cells, cellp);
+
+   cp = *cellp;
+   drmem->drc_index = cp[0];
+   drmem->reserved = cp[1];
+   drmem->aa_index = cp[2];
+   drmem->flags = cp[3];
+
+   *cellp = cp + 4;
+}
+
+/*
+ * Retreive and validate the ibm,dynamic-memory property of the device tree.
+ *
+ * The layout of the ibm,dynamic-memory property is a number N of lmb
+ * list entries followed by N lmb list entries.  Each lmb list entry
+ * contains information as layed out in the of_drconf_cell struct above.
+ */
+static int of_get_drconf_memory(struct device_node *memory, const u32 **dm)
+{
+   const u32 *prop;
+   u32 len, entries;
+
+   prop = of_get_property(memory, "ibm,dynamic-memory", &len);
+   if (!prop || len < sizeof(unsigned int))
+   return 0;
+
+   entries = *prop++;
+
+   /* Now that we know the number of entries, revalidate the size
+* of the property read in to ensure we have everything
+*/
+   if (len < (entries * (n_mem_addr_cells + 4) + 1) * sizeof(unsigned int))
+   return 0;
+
+   *dm = prop;
+   return entries;
+}
+
+/*
+ * Retreive and validate the ibm,lmb-size property for drconf memory
+ * from the device tree.
+ */
+static u64 of_get_lmb_size(struct device_node *memory)
+{
+   const u32 *prop;
+   u32 len;
+
+   prop = of_get_property(memory, "ibm,lmb-size", &len);
+   if (!prop || len < sizeof(unsigned int))
+   return 0;
+
+   return read_n_cells(n_mem_size_cells, &prop);
+}
+
+struct assoc_arrays {
+   u32 n_arrays;
+   u32 array_sz;
+   const u32 *arrays;
+};
+
+/*
+ * Retreive and validate the list of associativity arrays for drconf
+ * memory from the ibm,associativity-lookup-arrays property of the
+ * device tree..
+ *
+ * The layout of the ibm,associativity-lookup-arrays property is a number N
+ * indicating the number of associativity arrays, followed by a number M
+ * indicating the size of each associativity array, followed by a list
+ * of N associativity arrays.
+ */
+static int of_get_assoc_arrays(struct device_node *memory,
+  struct assoc_arrays *aa)
+{
+   const u32 *prop;
+   u32 len;
+
+   prop = of_get_property(memory, "ibm,associativity-lookup-arrays", &len);
+   if (!prop || len < 2 * sizeof(unsigned int))
+   return -1;
+
+   aa->n_arrays = *prop++;
+   aa->array_sz = *prop++;
+
+   /* Now that we know the number of arrrays and size of each array,
+* revalidate the size of the property read in.
+*/
+   if (len < (aa->n_arrays * aa->array_sz + 2) * sizeof(unsigned int))
+   return -1;
+
+   aa->arrays = prop;
+   return 0;
+}
+
+/*
+ * This is like of_node_to_nid_single() for memory represented in the
+ * ibm,dynamic-reconfiguration-memory node.
+ */
+static int of_drconf_to_nid_single(struct of_drconf_cell *drmem,
+  struct assoc_arrays *aa)
+{
+   int default_nid = 0;
+   int nid = default_nid;
+   int index;
+
+   if (min_common_depth > 0 && min_common_depth <= aa->array_sz &&
+   !(drmem->flags & DRCONF_MEM_AI_INVALID) &&
+   drmem->aa_index < aa->n_arrays) {
+   index = drmem->aa_index * aa->array_sz + min_common_depth - 1;
+   nid = aa->arrays[index];
+
+   if (nid == 0x || nid >= MAX_NUMNODES)
+   nid = default_nid;
+   }
+
+   return nid;
+}
+
/*
 * Figure out to w

Re: [PATCH] [RFC v3] OF: OpenFirmware bindings for the mmc_spi driver

2008-07-02 Thread Jon Smirl
On 6/5/08, Anton Vorontsov <[EMAIL PROTECTED]> wrote:
> Here is v3. I'm out of ideas if you won't like it. :-)
>
>  v3:
>  - Now these bindings are using bus notifiers chain, thus we adhere to the
>   spi bus.
>
>   By the way, this scheme (IMO) looks good for I2C devices which needs
>   platform_data extracted from the device tree too (Cc'ing Jochen).
>
>  - Plus changed the OF bindings themselves, implemented voltage-range
>   property. (Pierre, please take a look at vddrange_to_ocrmask(). I
>   wonder if you would like this in the MMC core instead, with a kernel
>   doc, of course.)
>
>  v2:
>  - Bindings were adhered to the MMC_SPI driver. Withdrawn by Pierre Ossman.
>
>  v1:
>  - Bindings were adhered to the OF SPI core. Withdrawn by OF people.
>
>  Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>
>  ---
>   Documentation/powerpc/booting-without-of.txt |   21 +++
>   drivers/of/Kconfig   |8 +
>   drivers/of/Makefile  |1 +
>   drivers/of/of_mmc_spi.c  |  210 
> ++
>   4 files changed, 240 insertions(+), 0 deletions(-)
>   create mode 100644 drivers/of/of_mmc_spi.c
>
>  diff --git a/Documentation/powerpc/booting-without-of.txt 
> b/Documentation/powerpc/booting-without-of.txt
>  index 6e1711c..6c55f3f 100644
>  --- a/Documentation/powerpc/booting-without-of.txt
>  +++ b/Documentation/powerpc/booting-without-of.txt
>  @@ -3143,7 +3143,28 @@ platforms are moved over to use the 
> flattened-device-tree model.
> };
> };
>
>  +...) MMC-over-SPI
>
>  +  Required properties:
>  +  - compatible : should be "mmc-spi".
>  +  - reg : should specify SPI address (chip-select number).
>  +  - max-speed : (optional) maximum frequency for this device (Hz).
>  +  - voltage-range : two cells are required, first cell specifies minimum
>  +slot voltage (mV), second cell specifies maximum slot voltage (mV).
>  +  - gpios : (optional) may specify GPIOs in this order: Write-Protect 
> GPIO,
>  +Card-Detect GPIO.
>  +
>  +  Example:
>  +
>  +   [EMAIL PROTECTED] {
>  +   compatible = "mmc-spi";
>  +   reg = <0>;
>  +   max-speed = <5000>;
>  +   /* Unregulated slot. */
>  +   voltage-range = <3300 3300>;
>  +   gpios = <&sdcsr_pio 1 0   /*  WP */
>  +&sdcsr_pio 0 1>; /* nCD */
>  +   };
>
>   VII - Marvell Discovery mv64[345]6x System Controller chips
>   ===
>  diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
>  index 3a7a11a..aadbfb3 100644
>  --- a/drivers/of/Kconfig
>  +++ b/drivers/of/Kconfig
>  @@ -13,3 +13,11 @@ config OF_I2C
> depends on PPC_OF && I2C
> help
>   OpenFirmware I2C accessors
>  +
>  +config OF_MMC_SPI
>  +   bool "OpenFirmware bindings for MMC/SD over SPI"
>  +   depends on PPC_OF && SPI
>  +   default y if MMC_SPI
>  +   help
>  + Say Y here to enable OpenFirmware bindings for the MMC/SD over SPI
>  + driver.
>  diff --git a/drivers/of/Makefile b/drivers/of/Makefile
>  index 548772e..a7c44fc 100644
>  --- a/drivers/of/Makefile
>  +++ b/drivers/of/Makefile
>  @@ -2,3 +2,4 @@ obj-y = base.o
>   obj-$(CONFIG_OF_DEVICE) += device.o platform.o
>   obj-$(CONFIG_OF_GPIO)   += gpio.o
>   obj-$(CONFIG_OF_I2C)   += of_i2c.o
>  +obj-$(CONFIG_OF_MMC_SPI)   += of_mmc_spi.o
>  diff --git a/drivers/of/of_mmc_spi.c b/drivers/of/of_mmc_spi.c
>  new file mode 100644
>  index 000..aa4e017
>  --- /dev/null
>  +++ b/drivers/of/of_mmc_spi.c
>  @@ -0,0 +1,210 @@
>  +/*
>  + * OpenFirmware bindings for the MMC-over-SPI driver
>  + *
>  + * Copyright (c) MontaVista Software, Inc. 2008.
>  + *
>  + * Author: Anton Vorontsov <[EMAIL PROTECTED]>
>  + *
>  + * This program is free software; you can redistribute  it and/or modify it
>  + * under  the terms of  the GNU General  Public License as published by the
>  + * Free Software Foundation;  either version 2 of the  License, or (at your
>  + * option) any later version.
>  + */
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +/*
>  + * XXX: Place it somewhere in the generic MMC code?
>  + */
>  +static int vdd_to_bitnum(int vdd)
>  +{
>  +   int bit;
>  +   const int max_bit = ilog2(MMC_VDD_35_36);
>  +
>  +   if (vdd < 1650 || vdd > 3600)
>  +   return -EINVAL;
>  +
>  +   if (vdd >= 1650 && vdd <= 1950)
>  +   return ilog2(MMC_VDD_165_195);
>  +
>  +   /* base 2000 mV, step 100 mV, bit's base 8 */
>  +   bit = (vdd - 2000) / 100 + 8;
>  +   if (bit > max_bit)
>  +   return max_bit;
>  +   return bit;
>  +}
>  +
>  +static int vddrange_to_ocrmask(int vdd_min, int vdd_max, unsigned int *mask)
>  +

[PATCH 5/5 v2] Update numa association of hotplug memory add for drconf memory

2008-07-02 Thread Nathan Fontenot

Update the association of a memory section with a numa node that occurs during
hotplug add of a memory section.  This adds a check in the
hot_add_scn_to_nid() routine for the ibm,dyamic-reconfiguration-memory node 
in the device tree.  If present the new hot_add_drconf_scn_to_nid() routine 
is invoked, which can properly parse the ibm,dynamic-reconfiguration-memory

node of the device tree and make the proper numa node associations.

This also introduces the valid_hot_add_scn() routine as a helper
function for code that is common to the hot_add_scn_to_nid() and
hot_add_drconf_scn_to_nid() routines.

Signed-off-by: Nathan Fontenot <[EMAIL PROTECTED]>
---
arch/powerpc/mm/numa.c |  101 -
1 file changed, 83 insertions(+), 18 deletions(-)

Index: linux-2.6.git/arch/powerpc/mm/numa.c
===
--- linux-2.6.git.orig/arch/powerpc/mm/numa.c   2008-07-01 18:43:44.0 
-0500
+++ linux-2.6.git/arch/powerpc/mm/numa.c2008-07-01 18:43:50.0 
-0500
@@ -901,6 +901,79 @@

#ifdef CONFIG_MEMORY_HOTPLUG
/*
+ * Validate the node associated with the memory section we are
+ * trying to add.
+ */
+int valid_hot_add_scn(int *nid, unsigned long start, u32 lmb_size,
+ unsigned long scn_addr)
+{
+   nodemask_t nodes;
+
+   if (*nid < 0 || !node_online(*nid))
+   *nid = any_online_node(NODE_MASK_ALL);
+
+   if ((scn_addr >= start) && (scn_addr < (start + lmb_size))) {
+   nodes_setall(nodes);
+   while (NODE_DATA(*nid)->node_spanned_pages == 0) {
+   node_clear(*nid, nodes);
+   *nid = any_online_node(nodes);
+   }
+
+   return 1;
+   }
+
+   return 0;
+}
+
+/*
+ * Find the node associated with a hot added memory section represented
+ * by the ibm,dynamic-reconfiguration-memory node.
+ */
+static int hot_add_drconf_scn_to_nid(struct device_node *memory,
+unsigned long scn_addr)
+{
+   const u32 *dm;
+   unsigned int n, rc;
+   unsigned long lmb_size;
+   int default_nid = any_online_node(NODE_MASK_ALL);
+   int nid;
+   struct assoc_arrays aa;
+
+   n = of_get_drconf_memory(memory, &dm);
+   if (!n)
+   return default_nid;;
+
+   lmb_size = of_get_lmb_size(memory);
+   if (!lmb_size)
+   return default_nid;
+
+   rc = of_get_assoc_arrays(memory, &aa);
+   if (rc)
+   return default_nid;
+
+   for (; n != 0; --n) {
+   struct of_drconf_cell drmem;
+
+   read_drconf_cell(&drmem, &dm);
+
+   /* skip this block if it is reserved or not assigned to
+* this partition */
+   if ((drmem.flags & DRCONF_MEM_RESERVED)
+   || !(drmem.flags & DRCONF_MEM_ASSIGNED))
+   continue;
+
+   nid = of_drconf_to_nid_single(&drmem, &aa);
+
+   if (valid_hot_add_scn(&nid, drmem.base_addr, lmb_size,
+ scn_addr))
+   return nid;
+   }
+
+   BUG();  /* section address should be found above */
+   return 0;
+}
+
+/*
 * Find the node associated with a hot added memory section.  Section
 * corresponds to a SPARSEMEM section, not an LMB.  It is assumed that
 * sections are fully contained within a single LMB.
@@ -908,12 +981,17 @@
int hot_add_scn_to_nid(unsigned long scn_addr)
{
struct device_node *memory = NULL;
-   nodemask_t nodes;
-   int default_nid = any_online_node(NODE_MASK_ALL);
int nid;

if (!numa_enabled || (min_common_depth < 0))
-   return default_nid;
+   return any_online_node(NODE_MASK_ALL);
+
+   memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
+   if (memory) {
+   nid = hot_add_drconf_scn_to_nid(memory, scn_addr);
+   of_node_put(memory);
+   return nid;
+   }

while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
unsigned long start, size;
@@ -932,13 +1010,9 @@
size = read_n_cells(n_mem_size_cells, &memcell_buf);
nid = of_node_to_nid_single(memory);

-   /* Domains not present at boot default to 0 */
-   if (nid < 0 || !node_online(nid))
-   nid = default_nid;
-
-   if ((scn_addr >= start) && (scn_addr < (start + size))) {
+   if (valid_hot_add_scn(&nid, start, size, scn_addr)) {
of_node_put(memory);
-   goto got_nid;
+   return nid;
}

if (--ranges)   /* process all ranges in cell */
@@ -946,14 +1020,5 @@
}
BUG();  /* section address should be found above */
return 0;
-
-   /* Temporar

[PATCH 4/5 v2] Split code into helper routines for drconf memory

2008-07-02 Thread Nathan Fontenot

This patch splits off several pieces of code that parse the
ibm,dynamic-reconfiguration-memory node of the device tree into separate
helper routines.  This is in preparation for the followon patch that will
use these helper routines.  There are no functional changes in this patch.

Signed-off-by: Nathan Fontenot <[EMAIL PROTECTED]>
---
arch/powerpc/mm/numa.c |  209 +++--
1 file changed, 170 insertions(+), 39 deletions(-)

Index: linux-2.6.git/arch/powerpc/mm/numa.c
===
--- linux-2.6.git.orig/arch/powerpc/mm/numa.c   2008-07-01 18:40:55.0 
-0500
+++ linux-2.6.git/arch/powerpc/mm/numa.c2008-07-01 18:43:44.0 
-0500
@@ -268,6 +268,144 @@
return result;
}

+struct of_drconf_cell {
+   u64 base_addr;
+   u32 drc_index;
+   u32 reserved;
+   u32 aa_index;
+   u32 flags;
+};
+
+#define DRCONF_MEM_ASSIGNED0x0008
+#define DRCONF_MEM_AI_INVALID  0x0040
+#define DRCONF_MEM_RESERVED0x0080
+
+/*
+ * Read the next lmb list entry from the ibm,dynamic-memory property
+ * and return the information in the provided of_drconf_cell structure.
+ */
+static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp)
+{
+   const u32 *cp;
+
+   drmem->base_addr = read_n_cells(n_mem_addr_cells, cellp);
+
+   cp = *cellp;
+   drmem->drc_index = cp[0];
+   drmem->reserved = cp[1];
+   drmem->aa_index = cp[2];
+   drmem->flags = cp[3];
+
+   *cellp = cp + 4;
+}
+
+/*
+ * Retreive and validate the ibm,dynamic-memory property of the device tree.
+ *
+ * The layout of the ibm,dynamic-memory property is a number N of lmb
+ * list entries followed by N lmb list entries.  Each lmb list entry
+ * contains information as layed out in the of_drconf_cell struct above.
+ */
+static int of_get_drconf_memory(struct device_node *memory, const u32 **dm)
+{
+   const u32 *prop;
+   u32 len, entries;
+
+   prop = of_get_property(memory, "ibm,dynamic-memory", &len);
+   if (!prop || len < sizeof(unsigned int))
+   return 0;
+
+   entries = *prop++;
+
+   /* Now that we know the number of entries, revalidate the size
+* of the property read in to ensure we have everything
+*/
+   if (len < (entries * (n_mem_addr_cells + 4) + 1) * sizeof(unsigned int))
+   return 0;
+
+   *dm = prop;
+   return entries;
+}
+
+/*
+ * Retreive and validate the ibm,lmb-size property for drconf memory
+ * from the device tree.
+ */
+static u64 of_get_lmb_size(struct device_node *memory)
+{
+   const u32 *prop;
+   u32 len;
+
+   prop = of_get_property(memory, "ibm,lmb-size", &len);
+   if (!prop || len < sizeof(unsigned int))
+   return 0;
+
+   return read_n_cells(n_mem_size_cells, &prop);
+}
+
+struct assoc_arrays {
+   u32 n_arrays;
+   u32 array_sz;
+   const u32 *arrays;
+};
+
+/*
+ * Retreive and validate the list of associativity arrays for drconf
+ * memory from the ibm,associativity-lookup-arrays property of the
+ * device tree..
+ *
+ * The layout of the ibm,associativity-lookup-arrays property is a number N
+ * indicating the number of associativity arrays, followed by a number M
+ * indicating the size of each associativity array, followed by a list
+ * of N associativity arrays.
+ */
+static int of_get_assoc_arrays(struct device_node *memory,
+  struct assoc_arrays *aa)
+{
+   const u32 *prop;
+   u32 len;
+
+   prop = of_get_property(memory, "ibm,associativity-lookup-arrays", &len);
+   if (!prop || len < 2 * sizeof(unsigned int))
+   return -1;
+
+   aa->n_arrays = *prop++;
+   aa->array_sz = *prop++;
+
+   /* Now that we know the number of arrrays and size of each array,
+* revalidate the size of the property read in.
+*/
+   if (len < (aa->n_arrays * aa->array_sz + 2) * sizeof(unsigned int))
+   return -1;
+
+   aa->arrays = prop;
+   return 0;
+}
+
+/*
+ * This is like of_node_to_nid_single() for memory represented in the
+ * ibm,dynami arch/powerpc/mm/numa.c.rejc-reconfiguration-memory node.
+ */
+static int of_drconf_to_nid_single(struct of_drconf_cell *drmem,
+  struct assoc_arrays *aa)
+{
+   int default_nid = 0;
+   int nid = default_nid;
+   int index;
+
+   if (min_common_depth > 0 && min_common_depth <= aa->array_sz &&
+   !(drmem->flags & DRCONF_MEM_AI_INVALID) &&
+   drmem->aa_index < aa->n_arrays) {
+   index = drmem->aa_index * aa->array_sz + min_common_depth - 1;
+   nid = aa->arrays[index];
+
+   if (nid == 0x || nid >= MAX_NUMNODES)
+   nid = default_nid;
+   }
+
+   return nid;
+}
+
/*
 * Figure out to which domain a cpu belongs and stick i

[PATCH 3/5 v2] Update the device tree correctly for drconf memory add/remove

2008-07-02 Thread Nathan Fontenot

This patch updates the device tree manipulation routines so that memory
add/remove of lmbs represented under the
ibm,dynamic-reconfiguration-memory node of the device tree invokes the
hotplug notifier chain.

This change is needed because of the change in the way memory is
represented under the ibm,dynamic-reconfiguration-memory node.  All lmbs
are described in the ibm,dynamic-memory property instead of having a
separate node for each lmb as in previous device tree layouts.  This
requires the update_node() routine to check for updates to the
ibm,dynamic-memory property and invoke the hotplug notifier chain.

This also updates the pseries hotplug notifier to be able to gather information
for lmbs represented under the ibm,dynamic-reconfiguration-memory node and
have the lmbs added/removed.

Signed-off-by: Nathan Fontenot <[EMAIL PROTECTED]>
---
arch/powerpc/platforms/pseries/hotplug-memory.c |   95 +---
arch/powerpc/platforms/pseries/reconfig.c   |   36 -
include/asm-powerpc/pSeries_reconfig.h  |6 +
3 files changed, 104 insertions(+), 33 deletions(-)

Index: linux-2.6.git/include/asm-powerpc/pSeries_reconfig.h
===
--- linux-2.6.git.orig/include/asm-powerpc/pSeries_reconfig.h   2008-07-01 
09:38:19.0 -0500
+++ linux-2.6.git/include/asm-powerpc/pSeries_reconfig.h2008-07-01 
09:38:54.0 -0500
@@ -9,8 +9,10 @@
 * added or removed on pSeries systems.
 */

-#define PSERIES_RECONFIG_ADD0x0001
-#define PSERIES_RECONFIG_REMOVE 0x0002
+#define PSERIES_RECONFIG_ADD   0x0001
+#define PSERIES_RECONFIG_REMOVE0x0002
+#define PSERIES_DRCONF_MEM_ADD 0x0003
+#define PSERIES_DRCONF_MEM_REMOVE  0x0004

#ifdef CONFIG_PPC_PSERIES
extern int pSeries_reconfig_notifier_register(struct notifier_block *);
Index: linux-2.6.git/arch/powerpc/platforms/pseries/reconfig.c
===
--- linux-2.6.git.orig/arch/powerpc/platforms/pseries/reconfig.c
2008-07-01 09:38:26.0 -0500
+++ linux-2.6.git/arch/powerpc/platforms/pseries/reconfig.c 2008-07-01 
09:38:54.0 -0500
@@ -422,8 +422,8 @@
{
struct device_node *np;
unsigned char *value;
-   char *name, *end;
-   int length;
+   char *name, *end, *next_prop;
+   int rc, length;
struct property *newprop, *oldprop;
buf = parse_node(buf, bufsize, &np);
end = buf + bufsize;
@@ -431,7 +431,8 @@
if (!np)
return -ENODEV;

-   if (parse_next_property(buf, end, &name, &length, &value) == NULL)
+   next_prop = parse_next_property(buf, end, &name, &length, &value);
+   if (!next_prop)
return -EINVAL;

newprop = new_property(name, length, value, NULL);
@@ -442,7 +443,34 @@
if (!oldprop)
return -ENODEV;

-   return prom_update_property(np, newprop, oldprop);
+   rc = prom_update_property(np, newprop, oldprop);
+   if (rc)
+   return rc;
+
+   /* For memory under the ibm,dynamic-reconfiguration-memory node
+* of the device tree, adding and removing memory is just an update
+* to the ibm,dynamic-memory property instead of adding/removing a
+* memory node in the device tree.  For these cases we still need to
+* involve the notifier chain.
+*/
+   if (!strcmp(name, "ibm,dynamic-memory")) {
+   int action;
+
+   next_prop = parse_next_property(next_prop, end, &name,
+   &length, &value);
+   if (!next_prop)
+   return -EINVAL;
+
+   if (!strcmp(name, "add"))
+   action = PSERIES_DRCONF_MEM_ADD;
+   else
+   action = PSERIES_DRCONF_MEM_REMOVE;
+
+   blocking_notifier_call_chain(&pSeries_reconfig_chain,
+action, value);
+   }
+
+   return 0;
}

/**
Index: linux-2.6.git/arch/powerpc/platforms/pseries/hotplug-memory.c
===
--- linux-2.6.git.orig/arch/powerpc/platforms/pseries/hotplug-memory.c  
2008-07-01 09:38:49.0 -0500
+++ linux-2.6.git/arch/powerpc/platforms/pseries/hotplug-memory.c   
2008-07-01 18:43:33.0 -0500
@@ -15,32 +15,11 @@
#include 
#include 

-static int pseries_remove_memory(struct device_node *np)
+static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
{
-   const char *type;
-   const unsigned int *regs;
-   unsigned long base;
-   unsigned int lmb_size;
-   u64 start_pfn, start;
+   unsigned long start, start_pfn;
struct zone *zone;
-   int ret = -EINVAL;
-
-   /*
-* Check to see if we are actually removing memory
-*/
-   type = of_get_property(np, "device_typ

[PATCH 2/5 v2] Use base address to derive starting page frame number

2008-07-02 Thread Nathan Fontenot

Use the base address of the lmb to derive the starting page frame number
instead of trying to extract it from the drc index of the lmb.  The drc
index should not be used for this as it will, and did, break.

Until this point, systems that have had memory represented in the device
tree with a node for each lmb the drc index would (luckily) closely
track the base address of the lmb.  For example a lmb with a drc index
of 800a would have a base address of a000.  This correlation
allowed the current code to derive the starting page frame number from
the drc inddex

Device tree layouts where lmbs are represented under the
ibm,dynamic-reconfiguration-memory node in the ibm,dynamic-memory
property do not have this correlation between the drc index and base
address of the lmb. 


Signed-off-by: Nathan Fontenot <[EMAIL PROTECTED]>
---
arch/powerpc/platforms/pseries/hotplug-memory.c |   36 +++-
1 file changed, 17 insertions(+), 19 deletions(-)

Index: linux-2.6.git/arch/powerpc/platforms/pseries/hotplug-memory.c
===
--- linux-2.6.git.orig/arch/powerpc/platforms/pseries/hotplug-memory.c  
2008-07-01 09:38:20.0 -0500
+++ linux-2.6.git/arch/powerpc/platforms/pseries/hotplug-memory.c   
2008-07-01 09:38:49.0 -0500
@@ -18,8 +18,9 @@
static int pseries_remove_memory(struct device_node *np)
{
const char *type;
-   const unsigned int *my_index;
const unsigned int *regs;
+   unsigned long base;
+   unsigned int lmb_size;
u64 start_pfn, start;
struct zone *zone;
int ret = -EINVAL;
@@ -32,17 +33,16 @@
return 0;

/*
-* Find the memory index and size of the removing section
+* Find the bae address and size of the lmb
 */
-   my_index = of_get_property(np, "ibm,my-drc-index", NULL);
-   if (!my_index)
-   return ret;
-
regs = of_get_property(np, "reg", NULL);
if (!regs)
return ret;

-   start_pfn = section_nr_to_pfn(*my_index & 0x);
+   base = *(unsigned long *)regs;
+   lmb_size = regs[3];
+
+   start_pfn = base >> PFN_SECTION_SHIFT;
zone = page_zone(pfn_to_page(start_pfn));

/*
@@ -54,28 +54,29 @@
 * to sysfs "state" file and we can't remove sysfs entries
 * while writing to it. So we have to defer it to here.
 */
-   ret = __remove_pages(zone, start_pfn, regs[3] >> PAGE_SHIFT);
+   ret = __remove_pages(zone, start_pfn, lmb_size >> PAGE_SHIFT);
if (ret)
return ret;

/*
 * Update memory regions for memory remove
 */
-   lmb_remove(start_pfn << PAGE_SHIFT, regs[3]);
+   lmb_remove(base, lmb_size);

/*
 * Remove htab bolted mappings for this section of memory
 */
-   start = (unsigned long)__va(start_pfn << PAGE_SHIFT);
-   ret = remove_section_mapping(start, start + regs[3]);
+   start = (unsigned long)__va(base);
+   ret = remove_section_mapping(start, start + lmb_size);
return ret;
}

static int pseries_add_memory(struct device_node *np)
{
const char *type;
-   const unsigned int *my_index;
const unsigned int *regs;
+   unsigned long base;
+   unsigned int lmb_size;
u64 start_pfn;
int ret = -EINVAL;

@@ -87,22 +88,19 @@
return 0;

/*
-* Find the memory index and size of the added section
+* Find the base and size of the lmb
 */
-   my_index = of_get_property(np, "ibm,my-drc-index", NULL);
-   if (!my_index)
-   return ret;
-
regs = of_get_property(np, "reg", NULL);
if (!regs)
return ret;

-   start_pfn = section_nr_to_pfn(*my_index & 0x);
+   base = *(unsigned long *)regs;
+   lmb_size = regs[3];

/*
 * Update memory region to represent the memory add
 */
-   lmb_add(start_pfn << PAGE_SHIFT, regs[3]);
+   lmb_add(base, lmb_size);
return 0;
}
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/5 v2] Allow phandle to be specified in formats other than decimal

2008-07-02 Thread Nathan Fontenot

Allow the phandle passed to the /proc/ppc64/ofdt file to be specified
in formats other than decimal.  This allows us to easily specify phandle
values in hex that would otherwise appear as negative integers.

This is an issue on systems where the value of 
/proc/device-tree/ibm,dynamic-reconfiguration-memory.ibm,phandle is

fff9.  Having to pass this to the ofdt file as a string results in
a large negative number, and simple_strtoul() does not handle negative
numbers.

Signed-off-by: Nathan Fontenot <[EMAIL PROTECTED]>
---
arch/powerpc/platforms/pseries/reconfig.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.git/arch/powerpc/platforms/pseries/reconfig.c
===
--- linux-2.6.git.orig/arch/powerpc/platforms/pseries/reconfig.c
2008-07-01 09:38:22.0 -0500
+++ linux-2.6.git/arch/powerpc/platforms/pseries/reconfig.c 2008-07-01 
09:38:26.0 -0500
@@ -365,7 +365,7 @@
*buf = '\0';
buf++;

-   handle = simple_strtoul(handle_str, NULL, 10);
+   handle = simple_strtoul(handle_str, NULL, 0);

*npp = of_find_node_by_phandle(handle);
return buf;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 0/5 v2] Update memory dlpar for dynamic reconfiguration memory

2008-07-02 Thread Nathan Fontenot

The following patchset corrects a set of issues for memory dlpar and the
representation of memory in the device tree under the 
ibm,dynamic-reconfiguration-memory node.


On newer hardware and kernels, the device tree has changed so that all
memory appears under the ibm,dynamic-reconfiguration-memory node in the
device tree.  This node has several properties that describe all possible
lmbs, lmb-size and numa affinity.

The ibm,dynamic-memory property is a list of all possible lmbs, where each
list entry contains the base address, drc index, associativity array index
and a set of flags.

The ibm,associativity-lookup-arrays property contains a list of associativity
arrays and the ibm,lmb-size property contains the size of the lmbs

For reference, each lmb available to the system was previously represented 
with a node in the device tree, of the form /proc/device-tree/[EMAIL PROTECTED]

Each of these memory nodes had properties such as "ibm,my-drc-index" for the
drc index and "regs" which contained the base address and lmb size of the lmb.

With the new device tree layout, code associated with memory dlpar needs to
be updated to parse the new device tree layout and properly call the memory
hotplug notifier chains.  Additionally, numa associativity done during hotplug
add of memory needs an update for parsing the new device tree layout.

Signed-off-by: Nathan Fontenot <[EMAIL PROTECTED]> 
___

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


Re: [PATCH v2 4/5] spi: Add OF binding support for SPI busses

2008-07-02 Thread Jon Smirl
On 7/2/08, Grant Likely <[EMAIL PROTECTED]> wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
>
>  This patch adds support for populating an SPI bus based on data in the
>  OF device tree.  This is useful for powerpc platforms which use the
>  device tree instead of discrete code for describing platform layout.
>
>  Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
>  ---
>
>   drivers/of/Kconfig |6 +++
>   drivers/of/Makefile|1 +
>   drivers/of/of_spi.c|   88 
> 
>   include/linux/of_spi.h |   18 ++
>   4 files changed, 113 insertions(+), 0 deletions(-)
>
>  diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
>  index 3a7a11a..edd6e92 100644
>  --- a/drivers/of/Kconfig
>  +++ b/drivers/of/Kconfig
>  @@ -13,3 +13,9 @@ config OF_I2C
> depends on PPC_OF && I2C
> help
>   OpenFirmware I2C accessors
>  +
>  +config OF_SPI
>  +   def_tristate SPI
>  +   depends on OF && PPC_OF && SPI
>  +   help
>  + OpenFirmware SPI accessors
>  diff --git a/drivers/of/Makefile b/drivers/of/Makefile
>  index 548772e..4c3c6f8 100644
>  --- a/drivers/of/Makefile
>  +++ b/drivers/of/Makefile
>  @@ -2,3 +2,4 @@ obj-y = base.o
>   obj-$(CONFIG_OF_DEVICE) += device.o platform.o
>   obj-$(CONFIG_OF_GPIO)   += gpio.o
>   obj-$(CONFIG_OF_I2C)   += of_i2c.o
>  +obj-$(CONFIG_OF_SPI)   += of_spi.o
>  diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
>  new file mode 100644
>  index 000..ed0c807
>  --- /dev/null
>  +++ b/drivers/of/of_spi.c
>  @@ -0,0 +1,88 @@
>  +/*
>  + * SPI OF support routines
>  + * Copyright (C) 2008 Secret Lab Technologies Ltd.
>  + *
>  + * Support routines for deriving SPI device attachments from the device
>  + * tree.
>  + */
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +/**
>  + * of_register_spi_devices - Register child devices onto the SPI bus
>  + * @master:Pointer to spi_master device
>  + * @np:parent node of SPI device nodes
>  + *
>  + * Registers an spi_device for each child node of 'np' which has a 'reg'
>  + * property.
>  + */
>  +void of_register_spi_devices(struct spi_master *master, struct device_node 
> *np)
>  +{
>  +   struct spi_device *spi;
>  +   struct device_node *nc;
>  +   const u32 *prop;
>  +   const char *sprop;
>  +   int rc;
>  +   int len;
>  +
>  +   for_each_child_of_node(np, nc) {
>  +   /* Alloc an spi_device */
>  +   spi = spi_alloc_device(master);
>  +   if (!spi) {
>  +   dev_err(&master->dev, "spi_device alloc error for 
> %s\n",
>  +   nc->full_name);
>  +   continue;
>  +   }
>  +
>  +   /* Device address */
>  +   prop = of_get_property(nc, "reg", &len);
>  +   if (!prop || len < sizeof(*prop)) {
>  +   dev_err(&master->dev, "%s has no 'reg' property\n",
>  +   nc->full_name);
>  +   continue;
>  +   }
>  +   spi->chip_select = *prop;
>  +
>  +   /* Mode (clock phase/polarity/etc.) */
>  +   if (of_find_property(nc, "spi,cpha", NULL))
>  +   spi->mode |= SPI_CPHA;
>  +   if (of_find_property(nc, "spi,cpol", NULL))
>  +   spi->mode |= SPI_CPOL;
>  +
>  +   /* Device speed */
>  +   prop = of_get_property(nc, "max-speed", &len);
>  +   if (!prop || len < sizeof(*prop)) {
>  +   dev_err(&master->dev, "%s has no 'max-speed' 
> property\n",
>  +   nc->full_name);
>  +   continue;
>  +   }
>  +   spi->max_speed_hz = *prop;
>  +
>  +   /* IRQ */
>  +   spi->irq = irq_of_parse_and_map(nc, 0);
>  +
>  +   /* Select device driver */
>  +   sprop = of_get_property(nc, "linux,modalias", &len);
>  +   if (sprop && len > 0)
>  +   strncpy(spi->modalias, sprop, KOBJ_NAME_LEN);
>  +   else
>  +   strncpy(spi->modalias, "spidev", KOBJ_NAME_LEN);

You're missing a request_module("%s", info.type) to make sure the
module is loaded.

It might make sense to share code with of_find_i2c_driver() so we have
a common way of guessing module names.

>  +
>  +   /* Store a pointer to the node in the device structure */
>  +   of_node_get(nc);
>  +   spi->dev.archdata.of_node = nc;
>  +
>  +   /* Register the new device */
>  +   rc = spi_add_device(spi);
>  +   if (rc) {
>  +   dev_err(&master->dev, "spi_device register error 
> %s\n",
>  +   nc->full_name);
>  +   spi_dev_put(spi);
>  +   }
>  +
>  + 

Re: [PATCH 06/12] net: use linux/of_{device,platform}.h instead of asm

2008-07-02 Thread Stephen Rothwell
Hi Kumar,

On Wed, 2 Jul 2008 02:55:29 -0500 Kumar Gala <[EMAIL PROTECTED]> wrote:
>
> I'll pick it up (since it mainly touches fsl enet controllers) if you  
> can repost it.  I seem to have lost the patch.

Here you go.
-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/

Date: Fri, 23 May 2008 16:28:54 +1000
From: Stephen Rothwell <[EMAIL PROTECTED]>
To: Jeff Garzik <[EMAIL PROTECTED]>
Cc: ppc-dev , [EMAIL PROTECTED]
Subject: [PATCH 06/12] net: use linux/of_{device,platform}.h instead of asm

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 drivers/net/fs_enet/fs_enet-main.c |2 +-
 drivers/net/fs_enet/mac-scc.c  |2 +-
 drivers/net/fs_enet/mii-fec.c  |2 +-
 drivers/net/ibm_newemac/core.h |2 +-
 drivers/net/ucc_geth.c |2 +-
 drivers/net/ucc_geth_mii.c |2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index 67b4b07..1231048 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -43,7 +43,7 @@
 #include 
 
 #ifdef CONFIG_PPC_CPM_NEW_BINDING
-#include 
+#include 
 #endif
 
 #include "fs_enet.h"
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index d7ca319..e3557ec 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -44,7 +44,7 @@
 #endif
 
 #ifdef CONFIG_PPC_CPM_NEW_BINDING
-#include 
+#include 
 #endif
 
 #include "fs_enet.h"
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index f0014cf..8f6a43b 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -37,7 +37,7 @@
 #include 
 
 #ifdef CONFIG_PPC_CPM_NEW_BINDING
-#include 
+#include 
 #endif
 
 #include "fs_enet.h"
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h
index 1683db9..2230904 100644
--- a/drivers/net/ibm_newemac/core.h
+++ b/drivers/net/ibm_newemac/core.h
@@ -33,8 +33,8 @@
 #include 
 #include 
 #include 
+#include 
 
-#include 
 #include 
 #include 
 
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index ca0bdac..1fb504c 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -28,8 +28,8 @@
 #include 
 #include 
 #include 
+#include 
 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 9404747..6d9e7ad 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -36,8 +36,8 @@
 #include 
 #include 
 #include 
+#include 
 
-#include 
 #include 
 #include 
 #include 
-- 
1.5.5.1

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


[PATCH v2 5/5] powerpc/mpc5200: Add mpc5200-spi (non-PSC) device driver

2008-07-02 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

Adds support for the dedicated SPI device on the Freescale MPC5200(b)
SoC.

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
---

 drivers/spi/Kconfig |8 +
 drivers/spi/Makefile|1 
 drivers/spi/mpc52xx_spi.c   |  595 +++
 include/linux/spi/mpc52xx_spi.h |   10 +
 4 files changed, 614 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 66ec5d8..01860ac 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -116,6 +116,14 @@ config SPI_LM70_LLP
  which interfaces to an LM70 temperature sensor using
  a parallel port.
 
+config SPI_MPC52xx
+   tristate "Freescale MPC52xx SPI (non-PSC) controller support"
+   depends on PPC_MPC52xx && SPI
+   select SPI_MASTER_OF
+   help
+ This drivers supports the MPC52xx SPI controller in master SPI
+ mode.
+
 config SPI_MPC52xx_PSC
tristate "Freescale MPC52xx PSC SPI controller"
depends on SPI_MASTER && PPC_MPC52xx && EXPERIMENTAL
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 7fca043..340b878 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_SPI_PXA2XX)  += pxa2xx_spi.o
 obj-$(CONFIG_SPI_OMAP_UWIRE)   += omap_uwire.o
 obj-$(CONFIG_SPI_OMAP24XX) += omap2_mcspi.o
 obj-$(CONFIG_SPI_MPC52xx_PSC)  += mpc52xx_psc_spi.o
+obj-$(CONFIG_SPI_MPC52xx)  += mpc52xx_spi.o
 obj-$(CONFIG_SPI_MPC83xx)  += spi_mpc83xx.o
 obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o
 obj-$(CONFIG_SPI_S3C24XX)  += spi_s3c24xx.o
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c
new file mode 100644
index 000..453690f
--- /dev/null
+++ b/drivers/spi/mpc52xx_spi.c
@@ -0,0 +1,595 @@
+/*
+ * MPC52xx SPI master driver.
+ * Copyright (C) 2008 Secret Lab Technologies Ltd.
+ *
+ * This is the driver for the MPC5200's dedicated SPI device (not for a
+ * PSC in SPI mode)
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
+MODULE_DESCRIPTION("MPC52xx SPI (non-PSC) Driver");
+MODULE_LICENSE("GPL");
+
+/* Register offsets */
+#define SPI_CTRL1  0x00
+#define SPI_CTRL1_SPIE (1 << 7)
+#define SPI_CTRL1_SPE  (1 << 6)
+#define SPI_CTRL1_MSTR (1 << 4)
+#define SPI_CTRL1_CPOL (1 << 3)
+#define SPI_CTRL1_CPHA (1 << 2)
+#define SPI_CTRL1_SSOE (1 << 1)
+#define SPI_CTRL1_LSBFE(1 << 0)
+
+#define SPI_CTRL2  0x01
+#define SPI_BRR0x04
+
+#define SPI_STATUS 0x05
+#define SPI_STATUS_SPIF(1 << 7)
+#define SPI_STATUS_WCOL(1 << 6)
+#define SPI_STATUS_MODF(1 << 4)
+
+#define SPI_DATA   0x09
+#define SPI_PORTDATA   0x0d
+#define SPI_DATADIR0x10
+
+/* FSM state return values */
+#define FSM_STOP   0
+#define FSM_POLL   1
+#define FSM_CONTINUE   2
+
+/* Driver internal data */
+struct mpc52xx_spi {
+   struct spi_master *master;
+   u32 sysclk;
+   void __iomem *regs;
+   int irq0;   /* MODF irq */
+   int irq1;   /* SPIF irq */
+   int ipb_freq;
+
+   /* Statistics */
+   int msg_count;
+   int wcol_count;
+   int wcol_ticks;
+   u32 wcol_tx_timestamp;
+   int modf_count;
+   int byte_count;
+
+   /* Hooks for platform modification of behaviour */
+   void (*premessage)(struct spi_message *m, void *context);
+   void *premessage_context;
+
+   struct list_head queue; /* queue of pending messages */
+   spinlock_t lock;
+   struct work_struct work;
+
+
+   /* Details of current transfer (length, and buffer pointers) */
+   struct spi_message *message;/* current message */
+   struct spi_transfer *transfer;  /* current transfer */
+   int (*state)(int irq, struct mpc52xx_spi *ms, u8 status, u8 data);
+   int len;
+   int timestamp;
+   u8 *rx_buf;
+   const u8 *tx_buf;
+   int cs_change;
+};
+
+/*
+ * CS control function
+ */
+static void mpc52xx_spi_chipsel(struct mpc52xx_spi *ms, int value)
+{
+   if (value)
+   writeb(0, ms->regs + SPI_PORTDATA); /* Assert SS pin */
+   else
+   writeb(0x08, ms->regs + SPI_PORTDATA); /* Deassert SS pin */
+}
+
+/*
+ * Start a new transfer.  This is called both by the idle state
+ * for the first transfer in a message, and by the wait state when the
+ * previous transfer in a message is complete.
+ */
+static void mpc52xx_spi_start_transfer(struct mpc52xx_spi *ms)
+{
+   ms->rx_buf = ms->transfer->rx_buf;
+   ms->tx_buf = ms->transfer->tx_buf;
+   ms->len = ms->transfer->len;
+
+   /* Activate the chip select */
+   if (ms->cs_change)
+   

[PATCH v2 4/5] spi: Add OF binding support for SPI busses

2008-07-02 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

This patch adds support for populating an SPI bus based on data in the
OF device tree.  This is useful for powerpc platforms which use the
device tree instead of discrete code for describing platform layout.

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
---

 drivers/of/Kconfig |6 +++
 drivers/of/Makefile|1 +
 drivers/of/of_spi.c|   88 
 include/linux/of_spi.h |   18 ++
 4 files changed, 113 insertions(+), 0 deletions(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 3a7a11a..edd6e92 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -13,3 +13,9 @@ config OF_I2C
depends on PPC_OF && I2C
help
  OpenFirmware I2C accessors
+
+config OF_SPI
+   def_tristate SPI
+   depends on OF && PPC_OF && SPI
+   help
+ OpenFirmware SPI accessors
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index 548772e..4c3c6f8 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -2,3 +2,4 @@ obj-y = base.o
 obj-$(CONFIG_OF_DEVICE) += device.o platform.o
 obj-$(CONFIG_OF_GPIO)   += gpio.o
 obj-$(CONFIG_OF_I2C)   += of_i2c.o
+obj-$(CONFIG_OF_SPI)   += of_spi.o
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
new file mode 100644
index 000..ed0c807
--- /dev/null
+++ b/drivers/of/of_spi.c
@@ -0,0 +1,88 @@
+/*
+ * SPI OF support routines
+ * Copyright (C) 2008 Secret Lab Technologies Ltd.
+ *
+ * Support routines for deriving SPI device attachments from the device
+ * tree.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * of_register_spi_devices - Register child devices onto the SPI bus
+ * @master:Pointer to spi_master device
+ * @np:parent node of SPI device nodes
+ *
+ * Registers an spi_device for each child node of 'np' which has a 'reg'
+ * property.
+ */
+void of_register_spi_devices(struct spi_master *master, struct device_node *np)
+{
+   struct spi_device *spi;
+   struct device_node *nc;
+   const u32 *prop;
+   const char *sprop;
+   int rc;
+   int len;
+
+   for_each_child_of_node(np, nc) {
+   /* Alloc an spi_device */
+   spi = spi_alloc_device(master);
+   if (!spi) {
+   dev_err(&master->dev, "spi_device alloc error for %s\n",
+   nc->full_name);
+   continue;
+   }
+
+   /* Device address */
+   prop = of_get_property(nc, "reg", &len);
+   if (!prop || len < sizeof(*prop)) {
+   dev_err(&master->dev, "%s has no 'reg' property\n",
+   nc->full_name);
+   continue;
+   }
+   spi->chip_select = *prop;
+
+   /* Mode (clock phase/polarity/etc.) */
+   if (of_find_property(nc, "spi,cpha", NULL))
+   spi->mode |= SPI_CPHA;
+   if (of_find_property(nc, "spi,cpol", NULL))
+   spi->mode |= SPI_CPOL;
+
+   /* Device speed */
+   prop = of_get_property(nc, "max-speed", &len);
+   if (!prop || len < sizeof(*prop)) {
+   dev_err(&master->dev, "%s has no 'max-speed' 
property\n",
+   nc->full_name);
+   continue;
+   }
+   spi->max_speed_hz = *prop;
+
+   /* IRQ */
+   spi->irq = irq_of_parse_and_map(nc, 0);
+
+   /* Select device driver */
+   sprop = of_get_property(nc, "linux,modalias", &len);
+   if (sprop && len > 0)
+   strncpy(spi->modalias, sprop, KOBJ_NAME_LEN);
+   else
+   strncpy(spi->modalias, "spidev", KOBJ_NAME_LEN);
+
+   /* Store a pointer to the node in the device structure */
+   of_node_get(nc);
+   spi->dev.archdata.of_node = nc;
+
+   /* Register the new device */
+   rc = spi_add_device(spi);
+   if (rc) {
+   dev_err(&master->dev, "spi_device register error %s\n",
+   nc->full_name);
+   spi_dev_put(spi);
+   }
+
+   }
+}
+EXPORT_SYMBOL(of_register_spi_devices);
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h
new file mode 100644
index 000..5f71ee8
--- /dev/null
+++ b/include/linux/of_spi.h
@@ -0,0 +1,18 @@
+/*
+ * OpenFirmware SPI support routines
+ * Copyright (C) 2008 Secret Lab Technologies Ltd.
+ *
+ * Support routines for deriving SPI device attachments from the device
+ * tree.
+ */
+
+#ifndef __LINUX_OF_SPI_H
+#define __LINUX_OF_SPI_H
+
+#include 
+#include 
+
+extern void of_register_spi_devices(struct spi_master *master,
+   struct device_node *np);
+
+#endif /* __LINUX_OF_SPI */


[PATCH v2 3/5] of-bindings: Add binding documentation for SPI busses and devices

2008-07-02 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

Add documentation about how to describe SPI busses in the device tree.

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
---

 Documentation/powerpc/booting-without-of.txt |   60 ++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index 1d2a772..7d3564f 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -58,6 +58,7 @@ Table of Contents
   o) Xilinx IP cores
   p) Freescale Synchronous Serial Interface
  q) USB EHCI controllers
+  t) SPI busses
 
   VII - Marvell Discovery mv64[345]6x System Controller chips
 1) The /system-controller node
@@ -2870,6 +2871,65 @@ platforms are moved over to use the 
flattened-device-tree model.
reg = <0xe800 32>;
};
 
+t) SPI (Serial Peripheral Interface) busses
+
+SPI busses can be described with a node for the SPI master device
+and a set of child nodes for each SPI slave on the bus.  For this
+discussion, it is assumed that the system's SPI controller is in
+SPI master mode.  This binding does not describe SPI controllers
+in slave mode.
+
+The SPI master node requires the following properties:
+- #address-cells  - number of cells required to define a chip select
+   address on the SPI bus.
+- #size-cells - should be zero.
+- compatible  - name of SPI bus controller following generic names
+   recommended practice.
+No other properties are required in the SPI bus node.  It is assumed
+that a driver for an SPI bus device will understand that it is an SPI bus.
+However, the binding does not attempt to define the specific method for
+assigning chip select numbers.  Since SPI chip select configuration is
+flexible and non-standardized, it is left out of this binding with the
+assumption that board specific platform code will be used to manage
+chip selects.  Individual drivers can define additional properties to
+support describing the chip select layout.
+
+SPI slave nodes must be children of the SPI master node and can
+contain the following properties.
+- reg - (required) chip select address of device.
+- compatible  - (required) name of SPI device following generic names
+   recommended practice
+- max-speed   - (required) Maximum SPI clocking speed of device in Hz
+- spi,cpol- (optional) Device requires inverse clock polarity
+- spi,cpha- (optional) Device requires shifted clock phase
+- linux,modalias  - (optional, Linux specific) Force binding of SPI device
+   to a particular spi_device driver.  Useful for changing
+   driver binding between spidev and a kernel SPI driver.
+
+SPI example for an MPC5200 SPI bus:
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";
+   reg = <0xf00 0x20>;
+   interrupts = <2 13 0 2 14 0>;
+   interrupt-parent = <&mpc5200_pic>;
+
+   [EMAIL PROTECTED] {
+   compatible = "micrel,ks8995m";
+   linux,modalias = "ks8995";
+   max-speed = <100>;
+   reg = <0>;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "ti,tlv320aic26";
+   max-speed = <10>;
+   reg = <1>;
+   };
+   };
+
+
 VII - Marvell Discovery mv64[345]6x System Controller chips
 ===
 

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


[PATCH v2 2/5] spi: split up spi_new_device() to allow two stage registration.

2008-07-02 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

spi_new_device() allocates and registers an spi device all in one swoop.
If the driver needs to add extra data to the spi_device before it is
registered, then this causes problems.

This patch splits the allocation and registration portions of code out
of spi_new_device() and creates three new functions; spi_alloc_device(),
spi_register_device(), and spi_device_release().  spi_new_device() is
modified to use the new functions for allocation and registration.
None of the existing users of spi_new_device() should be affected by
this change.

Drivers using the new API can forego the use of an spi_board_info
structure to describe the device layout and populate data into the
spi_device structure directly.

This change is in preparation for adding an OF device tree parser to
generate spi_devices based on data in the device tree.

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
---

 drivers/spi/spi.c   |  139 ---
 include/linux/spi/spi.h |   10 +++
 2 files changed, 105 insertions(+), 44 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 32b7a42..e64add0 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -178,6 +178,96 @@ struct boardinfo {
 static LIST_HEAD(board_list);
 static DEFINE_MUTEX(board_lock);
 
+/**
+ * spi_alloc_device - Allocate a new SPI device
+ * @master: Controller to which device is connected
+ * Context: can sleep
+ *
+ * Allows a driver to allocate and initialize and spi_device without
+ * registering it immediately.  This allows a driver to directly
+ * fill the spi_device with device parameters before calling
+ * spi_add_device() on it.
+ *
+ * Caller is responsible to call spi_add_device() on the returned
+ * spi_device structure to add it to the SPI master.  If the caller
+ * needs to discard the spi_device without adding it, then it should
+ * call spi_dev_put() on it.
+ *
+ * Returns a pointer to the new device, or NULL.
+ */
+struct spi_device *spi_alloc_device(struct spi_master *master)
+{
+   struct spi_device   *spi;
+   struct device   *dev = master->dev.parent;
+
+   if (!spi_master_get(master))
+   return NULL;
+
+   spi = kzalloc(sizeof *spi, GFP_KERNEL);
+   if (!spi) {
+   dev_err(dev, "cannot alloc spi_device\n");
+   spi_master_put(master);
+   return NULL;
+   }
+
+   spi->master = master;
+   spi->dev.parent = dev;
+   spi->dev.bus = &spi_bus_type;
+   spi->dev.release = spidev_release;
+   device_initialize(&spi->dev);
+   return spi;
+}
+EXPORT_SYMBOL_GPL(spi_alloc_device);
+
+/**
+ * spi_add_device - Add an spi_device allocated with spi_alloc_device
+ * @spi: spi_device to register
+ *
+ * Companion function to spi_alloc_device.  Devices allocated with
+ * spi_alloc_device can be added onto the spi bus with this function.
+ *
+ * Returns 0 on success; non-zero on failure
+ */
+int spi_add_device(struct spi_device *spi)
+{
+   struct device *dev = spi->master->dev.parent;
+   int status;
+
+   /* Chipselects are numbered 0..max; validate. */
+   if (spi->chip_select >= spi->master->num_chipselect) {
+   dev_err(dev, "cs%d > max %d\n",
+   spi->chip_select,
+   spi->master->num_chipselect);
+   return -EINVAL;
+   }
+
+   /* Set the bus ID string */
+   snprintf(spi->dev.bus_id, sizeof spi->dev.bus_id,
+   "%s.%u", spi->master->dev.bus_id,
+   spi->chip_select);
+
+   /* drivers may modify this initial i/o setup */
+   status = spi->master->setup(spi);
+   if (status < 0) {
+   dev_err(dev, "can't %s %s, status %d\n",
+   "setup", spi->dev.bus_id, status);
+   return status;
+   }
+
+   /* driver core catches callers that misbehave by defining
+* devices that already exist.
+*/
+   status = device_add(&spi->dev);
+   if (status < 0) {
+   dev_err(dev, "can't %s %s, status %d\n",
+   "add", spi->dev.bus_id, status);
+   return status;
+   }
+
+   dev_dbg(dev, "registered child %s\n", spi->dev.bus_id);
+   return 0;
+}
+EXPORT_SYMBOL_GPL(spi_add_device);
 
 /**
  * spi_new_device - instantiate one new SPI device
@@ -197,7 +287,6 @@ struct spi_device *spi_new_device(struct spi_master *master,
  struct spi_board_info *chip)
 {
struct spi_device   *proxy;
-   struct device   *dev = master->dev.parent;
int status;
 
/* NOTE:  caller did any chip->bus_num checks necessary.
@@ -207,66 +296,28 @@ struct spi_device *spi_new_device(struct spi_master 
*master,
 * suggests syslogged diagnostics are best here (ugh).
 */
 
-   /* Chipselects are numbered 0..max; validate

[PATCH v2 1/5] spi: Change modalias from a pointer to a character array

2008-07-02 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

Currently, 'modalias' in the spi_device structure is a 'const char *'.
The spi_new_device() function fills in the modalias value from a passed
in spi_board_info data block.  Since it is a pointer copy, the new
spi_device remains dependent on the spi_board_info structure after the
new spi_device is registered (no other fields in spi_device directly
depend on the spi_board_info structure; all of the other data is copied).

This causes a problem when dynamically propulating the list of attached
SPI devices.  For example, in arch/powerpc, the list of SPI devices can
be populated from data in the device tree.  With the current code, the
device tree adapter must kmalloc() a new spi_board_info structure for
each new SPI device it finds in the device tree, and there is no simple
mechanism in place for keeping track of these allocations.

This patch changes modalias from a 'const char *' to a fixed char array.
By copying the modalias string instead of referencing it, the dependency
on the spi_board_info structure is eliminated and an outside caller does
not need to maintain a separate spi_board_info allocation for each device.

If searched through the code to the best of my ability for any references
to modalias which may be affected by this change and haven't found anything.
It has been tested with the lite5200b platform in arch/powerpc.

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
---

 drivers/spi/spi.c   |4 +++-
 include/linux/spi/spi.h |2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1ad12af..32b7a42 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -218,6 +218,8 @@ struct spi_device *spi_new_device(struct spi_master *master,
if (!spi_master_get(master))
return NULL;
 
+   WARN_ON(strlen(chip->modalias) >= sizeof(proxy->modalias));
+
proxy = kzalloc(sizeof *proxy, GFP_KERNEL);
if (!proxy) {
dev_err(dev, "can't alloc dev for cs%d\n",
@@ -229,7 +231,7 @@ struct spi_device *spi_new_device(struct spi_master *master,
proxy->max_speed_hz = chip->max_speed_hz;
proxy->mode = chip->mode;
proxy->irq = chip->irq;
-   proxy->modalias = chip->modalias;
+   strlcpy(proxy->modalias, chip->modalias, sizeof(proxy->modalias));
 
snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id,
"%s.%u", master->dev.bus_id,
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 387e428..b55910b 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -82,7 +82,7 @@ struct spi_device {
int irq;
void*controller_state;
void*controller_data;
-   const char  *modalias;
+   charmodalias[32];
 
/*
 * likely need more hooks for more protocol options affecting how

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


[PATCH v2 0/5] SPI OF bindings and mpc5200-spi driver

2008-07-02 Thread Grant Likely
I think I've addressed all the comments I've received.  This series
adds OpenFirmware device tree bindings for SPI devices.  SPI master
drivers which make use of of_spi.c can retrieve the set of spi
devices from the device tree and automatically create them.

This series depends on previously posted patch:
"spi: Change modalias from a pointer to a character array"

 Documentation/powerpc/booting-without-of.txt |   60 +++
 drivers/of/Kconfig   |6 +
 drivers/of/Makefile  |1 +
 drivers/of/of_spi.c  |   88 
 drivers/spi/Kconfig  |8 +
 drivers/spi/Makefile |1 +
 drivers/spi/mpc52xx_spi.c|  595 ++
 drivers/spi/spi.c|  141 +--
 include/linux/of_spi.h   |   18 +
 include/linux/spi/mpc52xx_spi.h  |   10 +
 include/linux/spi/spi.h  |   12 +-
 11 files changed, 895 insertions(+), 45 deletions(-)

--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [git pull] Please pull powerpc.git merge branch

2008-07-02 Thread Paul Mackerras
Linus,

Grant Likely sent me one more bug-fix for 2.6.26, which I have merged
into my merge branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git merge

So when you do the pull from there, you'll get 3 commits as listed
below.

Thanks,
Paul.

 arch/powerpc/boot/Makefile|3 ++-
 arch/powerpc/kernel/legacy_serial.c   |5 +
 arch/powerpc/platforms/52xx/lite5200_pm.c |   14 +-
 3 files changed, 20 insertions(+), 2 deletions(-)

John Linn (2):
  powerpc/bootwrapper: update for initrd with simpleImage
  powerpc/legacy_serial: Bail if reg-offset/shift properties are present

Tim Yamin (1):
  powerpc/mpc5200: Fix lite5200b suspend/resume

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


Re: [PATCH v2 1/2] powerpc: Fix building of feature-fixup tests on ppc32

2008-07-02 Thread Segher Boessenkool

We need to use PPC_LCMPI otherwise we get compile errors like:

arch/powerpc/lib/feature-fixups-test.S: Assembler messages:
arch/powerpc/lib/feature-fixups-test.S:142: Error: Unrecognized 
opcode: `cmpdi'
arch/powerpc/lib/feature-fixups-test.S:149: Error: Unrecognized 
opcode: `cmpdi'
arch/powerpc/lib/feature-fixups-test.S:164: Error: Unrecognized 
opcode: `cmpdi'


Sorry, I definitely built (and booted) a 32-bit config, so I'm not sure
how I missed that. What toolchain are you using?


It's more interesting to hear what version of GCC and GAS _you_ are
using :-)

Does it allow 64-bit-only opcodes with -a32?  Does the build system
somehow not pass -a32 for you?


Segher

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


[PATCH] powerpc: Xilinx: add defconfig for virtex 5 boards

2008-07-02 Thread John Linn
This defconfig file is specific to Xilinx Virtex 5 FXT boards.

Signed-off-by: John Linn <[EMAIL PROTECTED]>
---
 arch/powerpc/configs/44x/virtex5_defconfig | 1107 
 1 files changed, 1107 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/configs/44x/virtex5_defconfig

diff --git a/arch/powerpc/configs/44x/virtex5_defconfig 
b/arch/powerpc/configs/44x/virtex5_defconfig
new file mode 100644
index 000..9c41f66
--- /dev/null
+++ b/arch/powerpc/configs/44x/virtex5_defconfig
@@ -0,0 +1,1107 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.26-rc8
+# Wed Jul  2 15:36:41 2008
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+# CONFIG_6xx is not set
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+CONFIG_44x=y
+# CONFIG_E200 is not set
+CONFIG_4xx=y
+CONFIG_BOOKE=y
+CONFIG_PTE_64BIT=y
+CONFIG_PHYS_64BIT=y
+# CONFIG_PPC_MM_SLICES is not set
+CONFIG_NOT_COHERENT_CACHE=y
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+CONFIG_PPC_MERGE=y
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+CONFIG_IRQ_PER_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+CONFIG_PPC_UDBG_16550=y
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+# CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_PPC_DCR_NATIVE=y
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_PPC_DCR=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_RELAY is not set
+CONFIG_NAMESPACES=y
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+# CONFIG_EMBEDDED is not set
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_SYSCTL_SYSCALL_CHECK=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_COMPAT_BRK=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+# CONFIG_MARKERS is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+# CONFIG_HAVE_DMA_ATTRS is not set
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_AS is not set
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_CFQ=y
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+CONFIG_CLASSIC_RCU=y
+# CONFIG_PPC4xx_PCI_EXPRESS is not set
+
+#
+# Platform support
+#
+# CONFIG_PPC_MPC512x is not set
+# CONFIG_PPC_MPC5121 is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PQ2ADS is not set
+# CONFIG_BAMBOO is not set
+# CONFIG_EBONY is not set
+# CONFIG_SEQUOIA is not set
+# CONFIG_TAISHAN is not set
+# CONFIG_KATMAI is not set
+# CONFIG_RAINIER is not set
+# CONFIG_WARP is not set
+# CONFIG_CANYONLANDS is not set
+# CONFIG_YOSEMITE is not set
+CONFIG_XILINX_VIRTEX440_GENERIC_BOARD=y
+CONFIG_XILINX_VIRTEX=y
+CONFIG_XILINX_VIRTEX_5_FXT=y
+# CONFIG_IPIC is not set
+# CONFIG_MPIC is not set
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is no

gianfar in SGMII mode

2008-07-02 Thread Nate Case
Hi Kumar,

I'm looking at gfar_configure_serdes() and I'm at a loss as to why this
is always called when the MAC is in SGMII mode.  It looks like it
assumes the use of TBI for some reason.  On my board it's just a regular
SGMII interface to a bcm5482 PHY in SGMII mode, so there is no TBI
involved.

I'm guessing this is a case of the driver making incorrect assumptions
based on the existing Freescale boards.  Or am I missing something
here? 

-- 
Nate Case <[EMAIL PROTECTED]>

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


[PATCH] powerpc: Xilinx: Fix boot with 16550 for 405 and 440

2008-07-02 Thread John Linn
The following changes add processing to initialize the
Xilinx 16550 UART in the boot strap loader since a
boot loader is not used many times with the FPGA.

The wrapper was also modified to add the 440 build.

Signed-off-by: John Linn <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/Makefile |2 +-
 arch/powerpc/boot/simpleboot.c |6 ++
 arch/powerpc/boot/virtex.c |  100 
 arch/powerpc/boot/wrapper  |6 ++-
 4 files changed, 112 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/boot/virtex.c

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index f8ffb56..1b641cf 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -66,7 +66,7 @@ src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c 
cuboot-85xx.c holly.c
fixed-head.S ep88xc.c ep405.c \
cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \
cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c 
\
-   virtex405-head.S
+   virtex405-head.S virtex.c
 src-boot := $(src-wlib) $(src-plat) empty.c
 
 src-boot := $(addprefix $(obj)/, $(src-boot))
diff --git a/arch/powerpc/boot/simpleboot.c b/arch/powerpc/boot/simpleboot.c
index 86cd285..c58a0da 100644
--- a/arch/powerpc/boot/simpleboot.c
+++ b/arch/powerpc/boot/simpleboot.c
@@ -23,6 +23,8 @@
 
 BSS_STACK(4*1024);
 
+extern int platform_specific_init(void) __attribute__((weak));
+
 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
   unsigned long r6, unsigned long r7)
 {
@@ -80,5 +82,9 @@ void platform_init(unsigned long r3, unsigned long r4, 
unsigned long r5,
 
/* prepare the device tree and find the console */
fdt_init(_dtb_start);
+
+   if (platform_specific_init)
+   platform_specific_init();
+
serial_console_init();
 }
diff --git a/arch/powerpc/boot/virtex.c b/arch/powerpc/boot/virtex.c
new file mode 100644
index 000..f622805
--- /dev/null
+++ b/arch/powerpc/boot/virtex.c
@@ -0,0 +1,100 @@
+/*
+ * The platform specific code for virtex devices since a boot loader is not
+ * always used.
+ *
+ * (C) Copyright 2008 Xilinx, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "ops.h"
+#include "io.h"
+#include "stdio.h"
+
+#define UART_DLL   0   /* Out: Divisor Latch Low */
+#define UART_DLM   1   /* Out: Divisor Latch High */
+#define UART_FCR   2   /* Out: FIFO Control Register */
+#define UART_FCR_CLEAR_RCVR0x02/* Clear the RCVR FIFO */
+#define UART_FCR_CLEAR_XMIT0x04/* Clear the XMIT FIFO */
+#define UART_LCR   3   /* Out: Line Control Register */
+#define UART_MCR   4   /* Out: Modem Control Register */
+#define UART_MCR_RTS   0x02/* RTS complement */
+#define UART_MCR_DTR   0x01/* DTR complement */
+#define UART_LCR_DLAB  0x80/* Divisor latch access bit */
+#define UART_LCR_WLEN8 0x03/* Wordlength: 8 bits */
+
+static int virtex_ns16550_console_init(void *devp)
+{
+   unsigned char *reg_base;
+   u32 reg_shift, reg_offset, clk, spd;
+   u16 divisor;
+   int n;
+
+   if (dt_get_virtual_reg(devp, (void **)®_base, 1) < 1)
+   return -1;
+
+   n = getprop(devp, "reg-offset", ®_offset, sizeof(reg_offset));
+   if (n == sizeof(reg_offset))
+   reg_base += reg_offset;
+
+   n = getprop(devp, "reg-shift", ®_shift, sizeof(reg_shift));
+   if (n != sizeof(reg_shift))
+   reg_shift = 0;
+
+   n = getprop(devp, "current-speed", (void *)&spd, sizeof(spd));
+   if (n != sizeof(spd))
+   spd = 9600;
+
+   /* should there be a default clock rate?*/
+   n = getprop(devp, "clock-frequency", (void *)&clk, sizeof(clk));
+   if (n != sizeof(clk))
+   return -1;
+
+   divisor = clk / (16 * spd);
+
+   /* Access baud rate */
+   out_8(reg_base + (UART_LCR << reg_shift), UART_LCR_DLAB);
+
+   /* Baud rate based on input clock */
+   out_8(reg_base + (UART_DLL << reg_shift), divisor & 0xFF);
+   out_8(reg_base + (UART_DLM << reg_shift), divisor >> 8);
+
+   /* 8 data, 1 stop, no parity */
+   out_8(reg_base + (UART_LCR << reg_shift), UART_LCR_WLEN8);
+
+   /* RTS/DTR */
+   out_8(reg_base + (UART_MCR << reg_shift), UART_MCR_RTS | UART_MCR_DTR);
+
+   /* Clear transmitter and receiver */
+   out_8(reg_base + (UART_FCR << reg_shift),
+   UART_FCR_CLEAR_XMIT | UART_FCR_CLEAR_RCVR);
+   return 0;
+}
+
+/* For virtex, the kernel may be loaded without using a bootloader and if so
+   some UARTs need more setup than is provided in the normal console init
+*/
+int 

Re: Kernel marking NAND blocks bad

2008-07-02 Thread Ron Madrid
Thank you (once again).  I found the information.

Ron
--- Scott Wood <[EMAIL PROTECTED]> wrote:

> Ron Madrid wrote:
> > /* Large Page FLASH with FMR[ECCM] = 0 */
> > static struct nand_ecclayout fsl_elbc_oob_lp_eccm0 = {
> > .eccbytes = 12,
> > .eccpos = {6, 7, 8, 22, 23, 24, 38, 39, 40, 54, 55, 56},
> > -   .oobfree = { {1, 5}, {9, 13}, {25, 13}, {41, 13}, {57, 7} },
> > +   .oobfree = { {2, 4}, {9, 13}, {25, 13}, {41, 13}, {57, 7} },
> > .oobavail = 48,
> > };
> > 
> > /* Large Page FLASH with FMR[ECCM] = 1 */
> > static struct nand_ecclayout fsl_elbc_oob_lp_eccm1 = {
> > .eccbytes = 12,
> > .eccpos = {8, 9, 10, 24, 25, 26, 40, 41, 42, 56, 57, 58},
> > -   .oobfree = { {1, 7}, {11, 13}, {27, 13}, {43, 13}, {59, 5} },
> > +   .oobfree = { {2, 6}, {11, 13}, {27, 13}, {43, 13}, {59, 5} },
> > .oobavail = 48,
> > };
> 
> Anton's recent patchset (posted to the MTD list) should fix this.
> 
> -scott
> 

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


[PATCH 5/5] mpc8313erdb: Add power management to the device tree.

2008-07-02 Thread Scott Wood
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/mpc8313erdb.dts |  247 +++--
 1 files changed, 174 insertions(+), 73 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts 
b/arch/powerpc/boot/dts/mpc8313erdb.dts
index b206843..6633ec4 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -109,18 +109,41 @@
reg = <0x200 0x100>;
};
 
-   [EMAIL PROTECTED] {
+   sleep-nexus {
#address-cells = <1>;
-   #size-cells = <0>;
-   cell-index = <0>;
-   compatible = "fsl-i2c";
-   reg = <0x3000 0x100>;
-   interrupts = <14 0x8>;
-   interrupt-parent = <&ipic>;
-   dfsrr;
-   [EMAIL PROTECTED] {
-   compatible = "dallas,ds1339";
-   reg = <0x68>;
+   #size-cells = <1>;
+   compatible = "simple-bus";
+   sleep = <&pmc 0x0300>;
+   ranges;
+
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   cell-index = <0>;
+   compatible = "fsl-i2c";
+   reg = <0x3000 0x100>;
+   interrupts = <14 0x8>;
+   interrupt-parent = <&ipic>;
+   dfsrr;
+   [EMAIL PROTECTED] {
+   compatible = "dallas,ds1339";
+   reg = <0x68>;
+   };
+   };
+
+   [EMAIL PROTECTED] {
+   device_type = "crypto";
+   model = "SEC2";
+   compatible = "fsl,sec2.2", "fsl,sec2.1",
+"fsl,sec2.0";
+   reg = <0x3 0x7000>;
+   interrupts = <11 0x8>;
+   interrupt-parent = <&ipic>;
+   /* Rev. 2.2 */
+   num-channels = <1>;
+   channel-fifo-len = <24>;
+   exec-units-mask = <0x004c>;
+   descriptor-types-mask = <0x0122003f>;
};
};
 
@@ -188,37 +211,44 @@
interrupt-parent = <&ipic>;
interrupts = <38 0x8>;
phy_type = "utmi_wide";
+   sleep = <&pmc 0x0030>;
};
 
-   [EMAIL PROTECTED] {
+   enet0: [EMAIL PROTECTED] {
#address-cells = <1>;
-   #size-cells = <0>;
-   compatible = "fsl,gianfar-mdio";
-   reg = <0x24520 0x20>;
-   phy1: [EMAIL PROTECTED] {
-   interrupt-parent = <&ipic>;
-   interrupts = <19 0x8>;
-   reg = <0x1>;
-   device_type = "ethernet-phy";
-   };
-   phy4: [EMAIL PROTECTED] {
-   interrupt-parent = <&ipic>;
-   interrupts = <20 0x8>;
-   reg = <0x4>;
-   device_type = "ethernet-phy";
-   };
-   };
+   #size-cells = <1>;
+   sleep = <&pmc 0x2000>;
+   ranges;
 
-   enet0: [EMAIL PROTECTED] {
cell-index = <0>;
device_type = "network";
model = "eTSEC";
-   compatible = "gianfar";
+   compatible = "gianfar", "simple-bus";
reg = <0x24000 0x1000>;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <37 0x8 36 0x8 35 0x8>;
interrupt-parent = <&ipic>;
phy-handle = < &phy1 >;
+   fsl,magic-packet;
+
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "fsl,gianfar-mdio";
+   reg = <0x24520 0x20>;
+   phy1: [EMAIL PROTECTED] {
+   interrupt-parent = <&ipic>;
+

[PATCH 3/5] mpc83xx: Power Management support

2008-07-02 Thread Scott Wood
Basic PM support for 83xx.  Standby is implemented as sleep.
Suspend-to-RAM is implemented as "deep sleep" (with the processor
turned off) on 831x.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
Updated comments, and changed SS_CURRENT to SS_R2 as requested.

 arch/powerpc/Kconfig  |2 +-
 arch/powerpc/platforms/83xx/Makefile  |1 +
 arch/powerpc/platforms/83xx/suspend-asm.S |  533 +
 arch/powerpc/platforms/83xx/suspend.c |  390 +
 arch/powerpc/sysdev/fsl_soc.h |1 +
 arch/powerpc/sysdev/ipic.c|   71 
 include/asm-powerpc/reg.h |4 +
 include/linux/fsl_devices.h   |6 +
 8 files changed, 1007 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/platforms/83xx/suspend-asm.S
 create mode 100644 arch/powerpc/platforms/83xx/suspend.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index f2a0f50..c22a7bf 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -192,7 +192,7 @@ config ARCH_HIBERNATION_POSSIBLE
 
 config ARCH_SUSPEND_POSSIBLE
def_bool y
-   depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200
+   depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx
 
 config PPC_DCR_NATIVE
bool
diff --git a/arch/powerpc/platforms/83xx/Makefile 
b/arch/powerpc/platforms/83xx/Makefile
index f331fd7..32c7ad1 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -3,6 +3,7 @@
 #
 obj-y  := misc.o usb.o
 obj-$(CONFIG_PCI)  += pci.o
+obj-$(CONFIG_SUSPEND)  += suspend.o suspend-asm.o
 obj-$(CONFIG_MPC831x_RDB)  += mpc831x_rdb.o
 obj-$(CONFIG_MPC832x_RDB)  += mpc832x_rdb.o
 obj-$(CONFIG_MPC834x_MDS)  += mpc834x_mds.o
diff --git a/arch/powerpc/platforms/83xx/suspend-asm.S 
b/arch/powerpc/platforms/83xx/suspend-asm.S
new file mode 100644
index 000..1930543
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/suspend-asm.S
@@ -0,0 +1,533 @@
+/*
+ * Enter and leave deep sleep state on MPC83xx
+ *
+ * Copyright (c) 2006-2008 Freescale Semiconductor, Inc.
+ * Author: Scott Wood <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#define SS_MEMSAVE 0x00 /* First 8 bytes of RAM */
+#define SS_HID 0x08 /* 3 HIDs */
+#define SS_IABR0x14 /* 2 IABRs */
+#define SS_IBCR0x1c
+#define SS_DABR0x20 /* 2 DABRs */
+#define SS_DBCR0x28
+#define SS_SP  0x2c
+#define SS_SR  0x30 /* 16 segment registers */
+#define SS_R2  0x70
+#define SS_MSR 0x74
+#define SS_SDR10x78
+#define SS_LR  0x7c
+#define SS_SPRG0x80 /* 4 SPRGs */
+#define SS_DBAT0x90 /* 8 DBATs */
+#define SS_IBAT0xd0 /* 8 IBATs */
+#define SS_TB  0x110
+#define SS_CR  0x118
+#define SS_GPREG   0x11c /* r12-r31 */
+#define STATE_SAVE_SIZE 0x16c
+
+   .section .data
+   .align  5
+
+mpc83xx_sleep_save_area:
+   .space  STATE_SAVE_SIZE
+immrbase:
+   .long   0
+
+   .section .text
+   .align  5
+
+   /* r3 = physical address of IMMR */
+_GLOBAL(mpc83xx_enter_deep_sleep)
+   lis r4, [EMAIL PROTECTED]
+   stw r3, [EMAIL PROTECTED](r4)
+
+   /* The first 2 words of memory are used to communicate with the
+* bootloader, to tell it how to resume.
+*
+* The first word is the magic number 0xf5153ae5, and the second
+* is the pointer to mpc83xx_deep_resume.
+*
+* The original content of these two words is saved in SS_MEMSAVE.
+*/
+
+   lis r3, [EMAIL PROTECTED]
+   ori r3, r3, [EMAIL PROTECTED]
+
+   lis r4, [EMAIL PROTECTED]
+   lwz r5, 0(r4)
+   lwz r6, 4(r4)
+
+   stw r5, SS_MEMSAVE+0(r3)
+   stw r6, SS_MEMSAVE+4(r3)
+
+   mfspr   r5, SPRN_HID0
+   mfspr   r6, SPRN_HID1
+   mfspr   r7, SPRN_HID2
+
+   stw r5, SS_HID+0(r3)
+   stw r6, SS_HID+4(r3)
+   stw r7, SS_HID+8(r3)
+
+   mfspr   r4, SPRN_IABR
+   mfspr   r5, SPRN_IABR2
+   mfspr   r6, SPRN_IBCR
+   mfspr   r7, SPRN_DABR
+   mfspr   r8, SPRN_DABR2
+   mfspr   r9, SPRN_DBCR
+
+   stw r4, SS_IABR+0(r3)
+   stw r5, SS_IABR+4(r3)
+   stw r6, SS_IBCR(r3)
+   stw r7, SS_DABR+0(r3)
+   stw r8, SS_DABR+4(r3)
+   stw r9, SS_DBCR(r3)
+
+   mfspr   r4, SPRN_SPRG0
+   mfspr   r5, SPRN_SPRG1
+   mfspr   r6, SPRN_SPRG2
+   mfspr   r7, SPRN_SPRG3
+   mfsdr1  r8
+
+   stw r4, SS_SPRG+0(r3)
+   stw r5, SS_SPRG+4(r3)
+   stw r6, SS_SPRG+8(r3

[PATCH 4/5] gianfar: Magic Packet and suspend/resume support.

2008-07-02 Thread Scott Wood
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |5 +-
 arch/powerpc/sysdev/fsl_soc.c|3 +
 drivers/net/gianfar.c|  118 +-
 drivers/net/gianfar.h|   12 ++-
 drivers/net/gianfar_ethtool.c|   41 +-
 include/linux/fsl_devices.h  |1 +
 6 files changed, 172 insertions(+), 8 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index 713a283..bfd5202 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1301,14 +1301,15 @@ platforms are moved over to use the 
flattened-device-tree model.
   1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no
   pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause.
 
-  Recommended properties:
+  Other properties:
 
 - phy-connection-type : a string naming the controller/PHY interface type,
   i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "sgmii",
   "tbi", or "rtbi".  This property is only really needed if the connection
   is of type "rgmii-id", as all other connection types are detected by
   hardware.
-
+- fsl,magic-packet : If present, indicates that the hardware supports
+  waking up via magic packet.
 
   Example:
 
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index ca54563..2fcd714 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -357,6 +357,9 @@ static int __init gfar_of_init(void)
else
gfar_data.interface = PHY_INTERFACE_MODE_MII;
 
+   if (of_get_property(np, "fsl,magic-packet", NULL))
+   gfar_data.device_flags |= 
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET;
+
ph = of_get_property(np, "phy-handle", NULL);
if (ph == NULL) {
u32 *fixed_link;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 25bdd08..f218dcc 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -142,6 +142,7 @@ static int gfar_clean_tx_ring(struct net_device *dev);
 static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int 
length);
 static void gfar_vlan_rx_register(struct net_device *netdev,
struct vlan_group *grp);
+static void gfar_halt_nodisable(struct net_device *dev);
 void gfar_halt(struct net_device *dev);
 void gfar_start(struct net_device *dev);
 static void gfar_clear_exact_match(struct net_device *dev);
@@ -216,6 +217,7 @@ static int gfar_probe(struct platform_device *pdev)
 
spin_lock_init(&priv->txlock);
spin_lock_init(&priv->rxlock);
+   spin_lock_init(&priv->bflock);
 
platform_set_drvdata(pdev, dev);
 
@@ -393,6 +395,103 @@ static int gfar_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM
+static int gfar_suspend(struct platform_device *pdev, pm_message_t state)
+{
+   struct net_device *dev = platform_get_drvdata(pdev);
+   struct gfar_private *priv = netdev_priv(dev);
+   unsigned long flags;
+   u32 tempval;
+
+   int magic_packet = priv->wol_en &&
+   (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
+
+   netif_device_detach(dev);
+
+   if (netif_running(dev)) {
+   spin_lock_irqsave(&priv->txlock, flags);
+   spin_lock(&priv->rxlock);
+
+   gfar_halt_nodisable(dev);
+
+   /* Disable Tx, and Rx if wake-on-LAN is disabled. */
+   tempval = gfar_read(&priv->regs->maccfg1);
+
+   tempval &= ~MACCFG1_TX_EN;
+
+   if (!magic_packet)
+   tempval &= ~MACCFG1_RX_EN;
+
+   gfar_write(&priv->regs->maccfg1, tempval);
+
+   spin_unlock(&priv->rxlock);
+   spin_unlock_irqrestore(&priv->txlock, flags);
+
+#ifdef CONFIG_GFAR_NAPI
+   napi_disable(&priv->napi);
+#endif
+
+   if (magic_packet) {
+   /* Enable interrupt on Magic Packet */
+   gfar_write(&priv->regs->imask, IMASK_MAG);
+
+   /* Enable Magic Packet mode */
+   tempval = gfar_read(&priv->regs->maccfg2);
+   tempval |= MACCFG2_MPEN;
+   gfar_write(&priv->regs->maccfg2, tempval);
+   } else {
+   phy_stop(priv->phydev);
+   }
+   }
+
+   return 0;
+}
+
+static int gfar_resume(struct platform_device *pdev)
+{
+   struct net_device *dev = platform_get_drvdata(pdev);
+   struct gfar_private *priv = netdev_priv(dev);
+   unsigned long flags;
+   u32 tempval;
+   int magic_packet = priv->wol_en &&
+   (priv->einfo->device_flags & FSL_GIANFAR_

[PATCH 1/5] Document Freescale power management nodes, and the sleep property.

2008-07-02 Thread Scott Wood
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |  207 -
 1 files changed, 165 insertions(+), 42 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index f6394b5..b058b6e 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -62,6 +62,7 @@ Table of Contents
   s) Freescale on board FPGA
   t) Freescael MSI interrupt controller
   u) Freescale General-purpose Timers Module
+  v) Freescale Power Management Controller
 
   VII - Marvell Discovery mv64[345]6x System Controller chips
 1) The /system-controller node
@@ -92,10 +93,12 @@ Table of Contents
 3) OpenPIC Interrupt Controllers
 4) ISA Interrupt Controllers
 
-  VIII - Specifying GPIO information for devices
+  IX - Specifying GPIO information for devices
 1) gpios property
 2) gpio-controller nodes
 
+  X - Specifying device power management information (sleep property)
+
   Appendix A - Sample SOC node for MPC8540
 
 
@@ -3009,6 +3012,70 @@ platforms are moved over to use the 
flattened-device-tree model.
clock-frequency = <0>;
 };
 
+v) Freescale Power Management Controller
+
+Properties:
+- compatible: "fsl,-pmc".
+
+  "fsl,mpc8349-pmc" should be listed for any chip whose PMC is
+  compatible.  "fsl,mpc8313-pmc" should also be listed for any chip
+  whose PMC is compatible, and implies deep-sleep capability.
+
+  "fsl,mpc8548-pmc" should be listed for any chip whose PMC is
+  compatible.  "fsl,mpc8536-pmc" should also be listed for any chip
+  whose PMC is compatible, and implies deep-sleep capability.
+
+  "fsl,mpc8641d-pmc" should be listed for any chip whose PMC is
+  compatible; all statements below that apply to "fsl,mpc8548-pmc" also
+  apply to "fsl,mpc8641d-pmc".
+
+  Compatibility does not include bit assigments in SCCR/PMCDR/DEVDISR;
+  these bit assigments are indicated via the sleep specifier in each
+  device's sleep property.
+
+- reg: For devices compatible with "fsl,mpc8349-pmc", the first resource
+  is the PMC block, and the second resource is the Clock Configuration
+  block.
+
+  For devices compatible with "fsl,mpc8548-pmc", the first resource
+  is a 32-byte block beginning with DEVDISR.
+
+- interrupts: For "fsl,mpc8349-pmc"-compatible devices, the first
+  resource is the PMC block interrupt.
+
+- fsl,mpc8313-wakeup-timer: For "fsl,mpc8313-pmc"-compatible devices,
+  this is a phandle to an "fsl,gtm" node on which timer 4 can be used as
+  a wakeup source from deep sleep.
+
+Sleep specifiers:
+
+  fsl,mpc8349-pmc: Sleep specifiers consist of one cell.  For each bit
+  that is set in the cell, the corresponding bit in SCCR will be saved
+  and cleared on suspend, and restored on resume.  This sleep controller
+  supports disabling and resuming devices at any time.
+
+  fsl,mpc8536-pmc: Sleep specifiers consist of three cells, the third of
+  which will be ORed into PMCDR upon suspend, and cleared from PMCDR
+  upon resume.  The first two cells are as described for fsl,mpc8578-pmc.
+  This sleep controller only supports disabling devices during system
+  sleep, or permanently.
+
+  fsl,mpc8548-pmc: Sleep specifiers consist of one or two cells, the
+  first of which will be ORed into DEVDISR (and the second into
+  DEVDISR2, if present -- this cell should be zero or absent if the
+  hardware does not have DEVDISR2) upon a request for permanent device
+  disabling.  This sleep controller does not support configuring devices
+  to disable during system sleep (unless supported by another compatible
+  match), or dynamically.
+
+Example:
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc8313-pmc", "fsl,mpc8349-pmc";
+   reg = <0xb00 0x100 0xa00 0x100>;
+   interrupts = <80 8>;
+   };
+
 VII - Marvell Discovery mv64[345]6x System Controller chips
 ===
 
@@ -3616,8 +3683,8 @@ encodings listed below:
2 =  high to low edge sensitive type enabled
3 =  low to high edge sensitive type enabled
 
-VIII - Specifying GPIO information for devices
-==
+IX - Specifying GPIO information for devices
+
 
 1) gpios property
 -
@@ -3665,6 +3732,37 @@ Example of two SOC GPIO banks defined as gpio-controller 
nodes:
gpio-controller;
};
 
+X - Specifying Device Power Management Information (sleep property)
+===
+
+Devices on SOCs often have mechanisms for placing devices into low-power
+states that are decoupled from the devices' own regist

Re: Kernel marking NAND blocks bad

2008-07-02 Thread Scott Wood

Ron Madrid wrote:

/* Large Page FLASH with FMR[ECCM] = 0 */
static struct nand_ecclayout fsl_elbc_oob_lp_eccm0 = {
.eccbytes = 12,
.eccpos = {6, 7, 8, 22, 23, 24, 38, 39, 40, 54, 55, 56},
-   .oobfree = { {1, 5}, {9, 13}, {25, 13}, {41, 13}, {57, 7} },
+   .oobfree = { {2, 4}, {9, 13}, {25, 13}, {41, 13}, {57, 7} },
.oobavail = 48,
};

/* Large Page FLASH with FMR[ECCM] = 1 */
static struct nand_ecclayout fsl_elbc_oob_lp_eccm1 = {
.eccbytes = 12,
.eccpos = {8, 9, 10, 24, 25, 26, 40, 41, 42, 56, 57, 58},
-   .oobfree = { {1, 7}, {11, 13}, {27, 13}, {43, 13}, {59, 5} },
+   .oobfree = { {2, 6}, {11, 13}, {27, 13}, {43, 13}, {59, 5} },
.oobavail = 48,
};


Anton's recent patchset (posted to the MTD list) should fix this.

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


Re: Kernel marking NAND blocks bad

2008-07-02 Thread Ron Madrid
During boot the kernel mounts the root file system and (I think) based on the 
size of the NAND in
the dts attempts to "format" the rest of the NAND fs partition.  At this point 
the blocks are
being marked as bad.  Therefore, when I reboot, the kernel thinks that there is 
no more usable
space in the file system due to all the "bad" blocks.  My dts is very similar 
to the 8313.

I think the problem is that for the Large Page FLASH, when checking for bad 
blocks bytes 0 and 1
in the oob are being checked.  However in fsl_elbc_nand.c the .oobfree begins 
at byte 1. 
Therefore if something is being written to byte 1 in the oob, and later is 
checked to see if the
block is bad, it will be seen as bad when it checks byte 0 and 1.  The changes 
below have worked
for me, but I don't know if these changes are "right", or if there is something 
else that should
be done instead.

/* Large Page FLASH with FMR[ECCM] = 0 */
static struct nand_ecclayout fsl_elbc_oob_lp_eccm0 = {
.eccbytes = 12,
.eccpos = {6, 7, 8, 22, 23, 24, 38, 39, 40, 54, 55, 56},
-   .oobfree = { {1, 5}, {9, 13}, {25, 13}, {41, 13}, {57, 7} },
+   .oobfree = { {2, 4}, {9, 13}, {25, 13}, {41, 13}, {57, 7} },
.oobavail = 48,
};

/* Large Page FLASH with FMR[ECCM] = 1 */
static struct nand_ecclayout fsl_elbc_oob_lp_eccm1 = {
.eccbytes = 12,
.eccpos = {8, 9, 10, 24, 25, 26, 40, 41, 42, 56, 57, 58},
-   .oobfree = { {1, 7}, {11, 13}, {27, 13}, {43, 13}, {59, 5} },
+   .oobfree = { {2, 6}, {11, 13}, {27, 13}, {43, 13}, {59, 5} },
.oobavail = 48,
};

Ron

--- Scott Wood <[EMAIL PROTECTED]> wrote:

> Ron Madrid wrote:
> > I know I asked about this in the past, but I can't remember where it was 
> > left.  Did this get
> > resolved in some other repository that isn't the main linux-2.6 repository? 
> >  If it didn't I
> think
> > I might have a solution.  BTW I'm using 2.6.26-rc8
> 
> What was the issue?
> 
> -Scott
> 

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


Re: patches for 2.6.27...

2008-07-02 Thread Kumar Gala


On Jul 2, 2008, at 2:14 PM, Phil Terry wrote:


On Wednesday 02 July 2008 12:56:16 am Kumar Gala wrote:

Please point out any patches that have been posted but havent made it
into a git tree related to Freescale chips.

What has happened to the RapidIO patches? I saw a bunch in march but  
don't
know where they've gone officially. There was talk they missed 25,  
the of
documentation would be fixed in 26 and maybe they would make 27?  
Where are
they in the process of propagating the galak tree, the paulas tree,  
and the

linus tree.
This was one of them
http://patchwork.ozlabs.org/linuxppc/patch?q=rapidio&id=17270

Cheers
Phil


These should already be in 2.6.26.

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


Re: Kernel marking NAND blocks bad

2008-07-02 Thread Scott Wood

Ron Madrid wrote:

I know I asked about this in the past, but I can't remember where it was left.  
Did this get
resolved in some other repository that isn't the main linux-2.6 repository?  If 
it didn't I think
I might have a solution.  BTW I'm using 2.6.26-rc8


What was the issue?

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


Kernel marking NAND blocks bad

2008-07-02 Thread Ron Madrid
Scott,

I know I asked about this in the past, but I can't remember where it was left.  
Did this get
resolved in some other repository that isn't the main linux-2.6 repository?  If 
it didn't I think
I might have a solution.  BTW I'm using 2.6.26-rc8

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


Re: [Bugme-new] [Bug 11027] New: random forward time jumps

2008-07-02 Thread Andrew Morton
On Wed,  2 Jul 2008 10:49:59 -0700 (PDT) [EMAIL PROTECTED] wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=11027

Hopefully someone in ppc land has set a watch on
[EMAIL PROTECTED]

If not, please go to http://bugzilla.kernel.org/userprefs.cgi?tab=email
and enter [EMAIL PROTECTED] into the "Users to watch:"
box.

You can get these directed to a mailing list by creating an account
for linuxppc-dev@ozlabs.org then getting that "person" to watch
[EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/3] mpc83xx: Power Management support

2008-07-02 Thread Scott Wood

Kumar Gala wrote:


On Jul 2, 2008, at 12:12 PM, Scott Wood wrote:


Kumar Gala wrote:

+#define SS_MEMSAVE0x00

What is this? add a comment?


There's a comment where MEMSAVE is used:

   /* The first 2 words of memory are used to communicate with the


I read this as the memory address 0, 0x4.  do you mean the first two 
words of the save area?


Both.  Memory addresses 0 and 4 are saved in the first two words of the 
save area, so that we can overwrite the former with the magic number and 
resume address.




* bootloader, to tell it how to resume.
*
* The first word is the magic number 0xf5153ae5, and the second
* is the pointer to mpc83xx_deep_resume.
*
* The original content of these two words is saved in the state
* save area.
*/

We could stick a /* First 8 bytes of RAM */ after the #define if you 
want.


ahh, might be useful to add SS_MEMSAVE into the comment.


OK.

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


Re: [PATCH v2] 85xx: publish of device for cds platforms

2008-07-02 Thread Kumar Gala


On Jun 16, 2008, at 5:36 PM, Dave Jiang wrote:


Publish the devices listed in dts under SOC as of_device for 85xx_cds
platform. The devices are needed by the 85xx EDAC driver.

Signed-off-by: Dave Jiang <[EMAIL PROTECTED]>

---

Added "simple bus" per Scott Wood

mrch/powerpc/platforms/85xx/pc85xx_cds.c |   15 +++
1 file changed, 15 insertions(+)



applied.

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


[PATCH] powerpc/86xx: Refactor pic init

2008-07-02 Thread Kumar Gala
Moved the pic initialization into its own common file and out of the board
code.  Also fixed the OF reference counting on the mpic node.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---

in my powerpc-next tree.

- k

 arch/powerpc/platforms/86xx/Makefile   |1 +
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c |   26 +
 arch/powerpc/platforms/86xx/mpc86xx.h  |3 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |   64 +--
 arch/powerpc/platforms/86xx/pic.c  |   78 
 arch/powerpc/platforms/86xx/sbc8641d.c |   25 +-
 6 files changed, 86 insertions(+), 111 deletions(-)
 create mode 100644 arch/powerpc/platforms/86xx/pic.c

diff --git a/arch/powerpc/platforms/86xx/Makefile 
b/arch/powerpc/platforms/86xx/Makefile
index 1b9b4a9..8fee37d 100644
--- a/arch/powerpc/platforms/86xx/Makefile
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -2,6 +2,7 @@
 # Makefile for the PowerPC 86xx linux kernel.
 #

+obj-y  := pic.o
 obj-$(CONFIG_SMP)  += mpc86xx_smp.o
 obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
 obj-$(CONFIG_SBC8641D) += sbc8641d.o
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c 
b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index eb16208..3072530 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -39,6 +39,8 @@
 #include 
 #include 

+#include "mpc86xx.h"
+
 static unsigned char *pixis_bdcfg0, *pixis_arch;

 static struct of_device_id __initdata mpc8610_ids[] = {
@@ -56,28 +58,6 @@ static int __init mpc8610_declare_of_platform_devices(void)
 }
 machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices);

-static void __init mpc86xx_hpcd_init_irq(void)
-{
-   struct mpic *mpic1;
-   struct device_node *np;
-   struct resource res;
-
-   /* Determine PIC address. */
-   np = of_find_node_by_type(NULL, "open-pic");
-   if (np == NULL)
-   return;
-   of_address_to_resource(np, 0, &res);
-
-   /* Alloc mpic structure and per isu has 16 INT entries. */
-   mpic1 = mpic_alloc(np, res.start,
-   MPIC_PRIMARY | MPIC_WANTS_RESET |
-   MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
-   0, 256, " MPIC ");
-   BUG_ON(mpic1 == NULL);
-
-   mpic_init(mpic1);
-}
-
 #ifdef CONFIG_PCI
 static void __devinit quirk_uli1575(struct pci_dev *dev)
 {
@@ -405,7 +385,7 @@ define_machine(mpc86xx_hpcd) {
.name   = "MPC86xx HPCD",
.probe  = mpc86xx_hpcd_probe,
.setup_arch = mpc86xx_hpcd_setup_arch,
-   .init_IRQ   = mpc86xx_hpcd_init_irq,
+   .init_IRQ   = mpc86xx_init_irq,
.get_irq= mpic_get_irq,
.restart= fsl_rstcr_restart,
.time_init  = mpc86xx_time_init,
diff --git a/arch/powerpc/platforms/86xx/mpc86xx.h 
b/arch/powerpc/platforms/86xx/mpc86xx.h
index 525ffa1..08efb57 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx.h
+++ b/arch/powerpc/platforms/86xx/mpc86xx.h
@@ -15,6 +15,7 @@
  * mpc86xx_* files. Mostly for use by mpc86xx_setup().
  */

-extern void __init mpc86xx_smp_init(void);
+extern void mpc86xx_smp_init(void);
+extern void mpc86xx_init_irq(void);

 #endif /* __MPC86XX_H__ */
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c 
b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index f13704a..7916599 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 

 #include 

@@ -46,67 +45,6 @@
 #endif

 #ifdef CONFIG_PCI
-static void mpc86xx_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_PCI */
-
-static void __init
-mpc86xx_hpcn_init_irq(void)
-{
-   struct mpic *mpic1;
-   struct device_node *np;
-   struct resource res;
-#ifdef CONFIG_PCI
-   struct device_node *cascade_node = NULL;
-   int cascade_irq;
-#endif
-
-   /* Determine PIC address. */
-   np = of_find_node_by_type(NULL, "open-pic");
-   if (np == NULL)
-   return;
-   of_address_to_resource(np, 0, &res);
-
-   /* Alloc mpic structure and per isu has 16 INT entries. */
-   mpic1 = mpic_alloc(np, res.start,
-   MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-   0, 256, " MPIC ");
-   BUG_ON(mpic1 == NULL);
-
-   mpic_init(mpic1);
-
-#ifdef CONFIG_PCI
-   /* Initialize i8259 controller */
-   for_each_node_by_type(np, "interrupt-controller")
-   if (of_device_is_compatible(np, "chrp,iic")) {
-   cascade_node = np;
-   break;
-

Re: [PATCH 1/3] mpc83xx: Power Management support

2008-07-02 Thread Kumar Gala


On Jul 2, 2008, at 12:12 PM, Scott Wood wrote:


Kumar Gala wrote:

+#define SS_MEMSAVE0x00

What is this? add a comment?


There's a comment where MEMSAVE is used:

   /* The first 2 words of memory are used to communicate with the


I read this as the memory address 0, 0x4.  do you mean the first two  
words of the save area?


* bootloader, to tell it how to resume.
*
* The first word is the magic number 0xf5153ae5, and the  
second

* is the pointer to mpc83xx_deep_resume.
*
* The original content of these two words is saved in the  
state

* save area.
*/

We could stick a /* First 8 bytes of RAM */ after the #define if you  
want.


ahh, might be useful to add SS_MEMSAVE into the comment.

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


Re: [PATCH]: [MPC5200] (v2) Add ATA DMA support

2008-07-02 Thread Grant Likely
On Wed, Jul 02, 2008 at 01:48:39PM +0100, Tim Yamin wrote:
> Hi Grant,
> 
> Thanks for the feedback. New version is attached.

Your welcome.  The patch is looking pretty good.  Some more comments
below.

> > > -#define BCOM_IPR_ATA_RX  4
> > > -#define BCOM_IPR_ATA_TX  3
> > > +#define BCOM_IPR_ATA_RX  7
> > > +#define BCOM_IPR_ATA_TX  7
> >
> > Is this a bug fix?  If so, please put it into a separate patch.
> 
> I suppose so, yes. If Ethernet has higher priority than ATA, you can
> get a deadlock if you try and download a large file over a LAN to
> disk, for example. But given that nothing other than this patch uses
> BestComm for ATA do you have any specific reason to split it out into
> another patch?

I know that only ATA uses this; but it is nice to have fixes to things
that are obviously wrong in existing code to be split into their own
patches.  That way, even if the ATA patch gets backed out, the bug fix
will remain.

> >>   priv->ipb_period = 10 / (ipb_freq / 1000);
> >>   priv->ata_regs = ata_regs;
> >> + priv->ata_regs_pa = (struct mpc52xx_ata __iomem *) res_mem.start;
> >
> > I'm not fond of this.  First off, it is *not* __iomem.  It is physical
> > address.  It would be better to use the offset_of macro to add an offset
> > to the physical base address.  Doing it this way forces you to cast and
> > sidestep the compile time checks for incorrect dereferences.
> 
> I'm afraid I'm not quite sure what you have in mind here, could you
> please provide a pointer?

See below comments

> 
> Thanks,
> 
> Tim

> This patch adds MDMA/UDMA support (using BestComm for DMA) on the MPC5200
> platform.
> 
> Based heavily on previous work by Freescale (Bernard Kuhn, John Rigby)
> and Domen Puncer.
> 
> Using a SanDisk Extreme IV CF card I get read speeds of approximately
> 26.70 MB/sec.
> 
> The BestComm ATA task priority was changed to maximum in bestcomm_priv.h;
> this fixes a deadlock issue I was experiencing when heavy DMA was
> occuring on both the ATA and Ethernet BestComm tasks, e.g. when
> downloading a large file over a LAN to disk.
> 
> There's also what I believe to be a hardware bug if you have high levels
> of BestComm ATA DMA activity along with heavy LocalPlus Bus activity;
> the address bus seems to sometimes get corrupted with ATA commands while
> the LocalPlus Bus operation is still active (i.e. Chip Select is asserted).
> 
> I've asked Freescale about this but have not received a reply yet -- if
> anybody from Freescale has any ideas please contact me; I can supply some
> analyzer traces if needed. Therefore, for now, do not enable DMA if you
> need reliable LocalPlus Bus unless you do a fixup in your driver as
> follows:
> 
> Locking example:
> 
> while (test_and_set_bit(0, &pata_mpc52xx_ata_dma_lock) != 0)
> {
> struct bcom_task_2 *tsk = pata_mpc52xx_ata_dma_task;
> 
> if(bcom_buffer_done_2(tsk))
> return 1;
> }
> 
>   return 0;
> 
> (Save the return value to `flags`)
> 
> Unlocking example:
> 
> if(flags == 0)
> clear_bit(0, &pata_mpc52xx_ata_dma_lock);
> 
> Comments and testing would of course be very welcome.
> 
> Thanks,
> 
> Signed-off-by: Tim Yamin <[EMAIL PROTECTED]>
> 
> diff -urp linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/ata.h 
> linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/ata.h
> --- linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/ata.h   2008-04-17 
> 03:49:44.0 +0100
> +++ linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/ata.h   2008-07-02 
> 12:48:14.0 +0100
> @@ -16,8 +16,8 @@
>  
>  struct bcom_ata_bd {
>   u32 status;
> - u32 dst_pa;
>   u32 src_pa;
> + u32 dst_pa;
>  };

This also looks like an obvious bug fix.  A separate patch would be nice
here.

>  
>  extern struct bcom_task *
> diff -urp linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/bestcomm.c 
> linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/bestcomm.c
> --- linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/bestcomm.c  2008-04-17 
> 03:49:44.0 +0100
> +++ linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/bestcomm.c  
> 2008-07-02 12:48:14.0 +0100
> @@ -330,11 +330,16 @@ bcom_engine_init(void)
>   /* Init 'always' initiator */
>   out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_ALWAYS], BCOM_IPR_ALWAYS);
>  
> + /* If ATA DMA is enabled, always turn prefetch off (it breaks things) */
> +#ifndef CONFIG_PATA_MPC52xx_DMA
>   /* Disable COMM Bus Prefetch on the original 5200; it's broken */
>   if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR) {
> +#endif
>   regval = in_be16(&bcom_eng->regs->PtdCntrl);
>   out_be16(&bcom_eng->regs->PtdCntrl,  regval | 1);
> +#ifndef CONFIG_PATA_MPC52xx_DMA
>   }
> +#endif
>  
>   /* Init lock */
>   spin_lock_init(&bcom_eng->lock);
> diff -urp linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/bestco

Re: patches for 2.6.27...

2008-07-02 Thread Dave Jiang

Kumar Gala wrote:
Please point out any patches that have been posted but havent made it 
into a git tree related to Freescale chips.


I know there are probably a slew of CPM patches that need to get into 
the tree.


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


Kumar can you put this one in please? Thanks!

http://patchwork.ozlabs.org/linuxppc/patch?q=Dave%20Jiang&id=19008

--

--
Dave Jiang
Software Engineer
MontaVista Software, Inc.
http://www.mvista.com
--

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


Re: [PATCH 1/3] mpc83xx: Power Management support

2008-07-02 Thread Scott Wood

Kumar Gala wrote:

+#define SS_MEMSAVE0x00


What is this? add a comment?


There's a comment where MEMSAVE is used:

/* The first 2 words of memory are used to communicate with the
 * bootloader, to tell it how to resume.
 *
 * The first word is the magic number 0xf5153ae5, and the second
 * is the pointer to mpc83xx_deep_resume.
 *
 * The original content of these two words is saved in the state
 * save area.
 */

We could stick a /* First 8 bytes of RAM */ after the #define if you want.


+#define SS_HID0x08 /* 3 HIDs */
+#define SS_IABR0x14 /* 2 IABRs */
+#define SS_IBCR0x1c
+#define SS_DABR0x20 /* 2 DABRs */
+#define SS_DBCR0x28
+#define SS_SP0x2c
+#define SS_SR0x30 /* 16 segment registers */
+#define SS_CURRENT0x70


How about SS_R2 to match the pmac sleep.S code.  It will make 
refactoring all this easier in the future.


OK.

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


Re: [PATCH 1/3] mpc83xx: Power Management support

2008-07-02 Thread Kumar Gala
diff --git a/arch/powerpc/platforms/83xx/suspend-asm.S b/arch/ 
powerpc/platforms/83xx/suspend-asm.S

new file mode 100644
index 000..03e29a2
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/suspend-asm.S
@@ -0,0 +1,539 @@
+/*
+ * Enter and leave sleep state on MPC83xx
+ *
+ * Author: Scott Wood <[EMAIL PROTECTED]>
+ *
+ * Copyright (c) 2006 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 version 2 as  
published

+ * by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#define SS_MEMSAVE 0x00


What is this? add a comment?


+#define SS_HID 0x08 /* 3 HIDs */
+#define SS_IABR0x14 /* 2 IABRs */
+#define SS_IBCR0x1c
+#define SS_DABR0x20 /* 2 DABRs */
+#define SS_DBCR0x28
+#define SS_SP  0x2c
+#define SS_SR  0x30 /* 16 segment registers */
+#define SS_CURRENT 0x70


How about SS_R2 to match the pmac sleep.S code.  It will make  
refactoring all this easier in the future.



+#define SS_MSR 0x74
+#define SS_SDR10x78
+#define SS_LR  0x7c
+#define SS_SPRG0x80 /* 4 SPRGs */
+#define SS_DBAT0x90 /* 8 DBATs */
+#define SS_IBAT0xd0 /* 8 IBATs */
+#define SS_TB  0x110
+#define SS_CR  0x118
+#define SS_GPREG   0x11c /* r12-r31 */
+#define STATE_SAVE_SIZE 0x16c


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


Re: [PATCH 1/3] mpc83xx: Power Management support

2008-07-02 Thread Scott Wood

Kumar Gala wrote:
If we are going to allocate space for save area like this, can't we do 
this in C code.  Its less error prone and easier to extend over time.  I 
know the powermac code does something similar but it places the save 
area on the stack.


Then we'd have to split it between things that can be saved from C 
versus things that can't (gpregs, cr, lr, etc), or mess around with 
exposing struct offsets to asm code.  I think it's just easier to do it 
this way.


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


[PATCH] powerpc: implement GPIO LIB API on CPM1 Freescale SoC.

2008-07-02 Thread Jochen Friedrich
This patch implement GPIO LIB support for the CPM1 GPIOs.

Signed-off-by: Jochen Friedrich <[EMAIL PROTECTED]>
---

This patch depends on the GPIO LIB support for the CPM2 GPIOs patch
from Laurent Pinchart.

Changes since last submission:

- of_gc->gpio_cells = 2 to allow passing port options in the future.
- remove the artificial fsl,cpm1-pario-bank16 and fsl,cpm1-pario-bank32
  compatible names as all ports havs slightly different register layouts.

 arch/powerpc/platforms/8xx/Kconfig |   10 ++
 arch/powerpc/sysdev/cpm1.c |  267 +++-
 2 files changed, 272 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/platforms/8xx/Kconfig 
b/arch/powerpc/platforms/8xx/Kconfig
index 6fc849e..3488bb7 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -105,6 +105,16 @@ config 8xx_COPYBACK

  If in doubt, say Y here.

+config 8xx_GPIO
+   bool "GPIO API Support"
+   select GENERIC_GPIO
+   select HAVE_GPIO_LIB
+   help
+ Saying Y here will cause the ports on an MPC8xx processor to be used
+ with the GPIO API.  If you say N here, the kernel needs less memory.
+
+ If in doubt, say Y here.
+
 config 8xx_CPU6
bool "CPU6 Silicon Errata (860 Pre Rev. C)"
help
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 58292a0..8c37690 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -42,6 +43,10 @@

 #include 

+#ifdef CONFIG_8xx_GPIO
+#include 
+#endif
+
 #define CPM_MAP_SIZE(0x4000)

 cpm8xx_t __iomem *cpmp;  /* Pointer to comm processor space */
@@ -290,20 +295,24 @@ struct cpm_ioport16 {
__be16 res[3];
 };

-struct cpm_ioport32 {
-   __be32 dir, par, sor;
+struct cpm_ioport32b {
+   __be32 dir, par, odr, dat;
+};
+
+struct cpm_ioport32e {
+   __be32 dir, par, sor, odr, dat;
 };

 static void cpm1_set_pin32(int port, int pin, int flags)
 {
-   struct cpm_ioport32 __iomem *iop;
+   struct cpm_ioport32e __iomem *iop;
pin = 1 << (31 - pin);

if (port == CPM_PORTB)
-   iop = (struct cpm_ioport32 __iomem *)
+   iop = (struct cpm_ioport32e __iomem *)
  &mpc8xx_immr->im_cpm.cp_pbdir;
else
-   iop = (struct cpm_ioport32 __iomem *)
+   iop = (struct cpm_ioport32e __iomem *)
  &mpc8xx_immr->im_cpm.cp_pedir;

if (flags & CPM_PIN_OUTPUT)
@@ -498,3 +507,251 @@ int cpm1_clk_setup(enum cpm_clk_target target, int clock, 
int mode)

return 0;
 }
+
+/*
+ * GPIO LIB API implementation
+ */
+#ifdef CONFIG_8xx_GPIO
+
+struct cpm1_gpio16_chip {
+   struct of_mm_gpio_chip mm_gc;
+   spinlock_t lock;
+
+   /* shadowed data register to clear/set bits safely */
+   u16 cpdata;
+};
+
+static inline struct cpm1_gpio16_chip *
+to_cpm1_gpio16_chip(struct of_mm_gpio_chip *mm_gc)
+{
+   return container_of(mm_gc, struct cpm1_gpio16_chip, mm_gc);
+}
+
+static void cpm1_gpio16_save_regs(struct of_mm_gpio_chip *mm_gc)
+{
+   struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
+   struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+
+   cpm1_gc->cpdata = in_be16(&iop->dat);
+}
+
+static int cpm1_gpio16_get(struct gpio_chip *gc, unsigned int gpio)
+{
+   struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+   struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+   u16 pin_mask;
+
+   pin_mask = 1 << (15 - gpio);
+
+   return !!(in_be16(&iop->dat) & pin_mask);
+}
+
+static void cpm1_gpio16_set(struct gpio_chip *gc, unsigned int gpio, int value)
+{
+   struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+   struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
+   struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+   unsigned long flags;
+   u16 pin_mask = 1 << (15 - gpio);
+
+   spin_lock_irqsave(&cpm1_gc->lock, flags);
+
+   if (value)
+   cpm1_gc->cpdata |= pin_mask;
+   else
+   cpm1_gc->cpdata &= ~pin_mask;
+
+   out_be16(&iop->dat, cpm1_gc->cpdata);
+
+   spin_unlock_irqrestore(&cpm1_gc->lock, flags);
+}
+
+static int cpm1_gpio16_dir_out(struct gpio_chip *gc, unsigned int gpio, int 
val)
+{
+   struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+   struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+   u16 pin_mask;
+
+   pin_mask = 1 << (15 - gpio);
+
+   setbits16(&iop->dir, pin_mask);
+
+   cpm1_gpio16_set(gc, gpio, val);
+
+   return 0;
+}
+
+static int cpm1_gpio16_dir_in(struct gpio_chip *gc, unsigned int gpio)
+{
+   struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+   struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+   u16 pin_mask;
+
+   pin_mask = 1 << (15 - gpio);
+
+   clrbits16(&iop->dir, pin_mask);
+
+   return

Re: [PATCH] powerpc: Add i2c pins to dts and board setup

2008-07-02 Thread Kumar Gala


On Jul 2, 2008, at 11:06 AM, Jochen Friedrich wrote:


Initialize I2C pins on boards with CPM1/CPM2 controllers
and document the i2c bus in booting-without-of.

The boards don't have any I2C chips connected to the I2C
bus, so unless some external chips are connected to the
boards, this code is just an example of setting everything
else up.

Signed-off-by: Jochen Friedrich <[EMAIL PROTECTED]>
---
Documentation/powerpc/booting-without-of.txt |   42 + 
+

arch/powerpc/boot/dts/mpc8272ads.dts |   11 +++
arch/powerpc/boot/dts/mpc866ads.dts  |   11 +++
arch/powerpc/boot/dts/mpc885ads.dts  |   11 +++
arch/powerpc/platforms/82xx/mpc8272_ads.c|4 ++
arch/powerpc/platforms/8xx/mpc86xads_setup.c |4 ++
arch/powerpc/platforms/8xx/mpc885ads_setup.c |3 ++
7 files changed, 86 insertions(+), 0 deletions(-)


applied.

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


Re: [PATCHv2] cpm_uart: Support uart_wait_until_sent()

2008-07-02 Thread Kumar Gala


On Jul 2, 2008, at 3:58 AM, Laurent Pinchart wrote:

Set port->fifosize to the software FIFO size, and update the port  
timeout
when the baud rate is modified. SCC ports have an optional 32 byte  
hardware
FIFO which is currently not taken into account, as there is no  
documented way

to check when the FIFO becomes empty.

Signed-off-by: Laurent Pinchart <[EMAIL PROTECTED]>
---
drivers/serial/cpm_uart/cpm_uart_core.c |6 ++
1 files changed, 6 insertions(+), 0 deletions(-)


applied.

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


[PATCH] powerpc: Add documentation for CPM GPIO banks to booting-without-of

2008-07-02 Thread Jochen Friedrich
Signed-off-by: Jochen Friedrich <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |   39 ++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index 26d323f..5fe68ee 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -2174,6 +2174,45 @@ platforms are moved over to use the 
flattened-device-tree model.
};
};

+   xi) GPIO
+
+   Every GPIO controller node must have #gpio-cells property defined,
+   this information will be used to translate gpio-specifiers.
+   On CPM1 devices, all ports are using slightly different register layouts.
+   Ports A, C and D are 16bit ports and Ports B and E are 32bit ports.
+   On CPM2 devices, all ports are 32bit ports and use a common register layout.
+
+   Properties:
+   - compatible : "fsl,cpm1-pario-bank-a", "fsl,cpm1-pario-bank-b",
+ "fsl,cpm1-pario-bank-c", "fsl,cpm1-pario-bank-d",
+ "fsl,cpm1-pario-bank-e", "fsl,cpm2-pario-bank"
+   - #gpio-cells : Should be two. The first cell is the pin number and the
+ second cell is used to specify optional paramters (currently unused).
+   - gpio-controller : Marks the port as GPIO controller.
+
+   Example of three SOC GPIO banks defined as gpio-controller nodes:
+
+   CPM1_PIO_A: [EMAIL PROTECTED] {
+   #gpio-cells = <2>;
+   compatible = "fsl,cpm1-pario-bank-a";
+   reg = <0x950 0x10>;
+   gpio-controller;
+   };
+
+   CPM1_PIO_B: [EMAIL PROTECTED] {
+   #gpio-cells = <2>;
+   compatible = "fsl,cpm1-pario-bank-b";
+   reg = <0xab8 0x10>;
+   gpio-controller;
+   };
+
+   CPM1_PIO_E: [EMAIL PROTECTED] {
+   #gpio-cells = <2>;
+   compatible = "fsl,cpm1-pario-bank-e";
+   reg = <0xac8 0x18>;
+   gpio-controller;
+   };
+
m) Chipselect/Local Bus

Properties:
-- 
1.5.6

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


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-02 Thread Liam Girdwood
On Wed, 2008-07-02 at 09:52 -0400, Jon Smirl wrote:
> 
> I've been using asoc-v2 so it may not be possible to make this arch
> independent in asoc-v1.  Maybe try porting this to asoc-v2 and see if
> a bunch of the registration complexity disappears. Most of soc-of.c
> should be unnecessary.
> 
> Liam, when is asoc-v2 going into mainline?

Hopefully over the next 2 merge windows. I'm about to start queueing
patches

This also assumes Mark and I remain at our current work load levels.

Liam


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


[PATCH] powerpc: Add i2c pins to dts and board setup

2008-07-02 Thread Jochen Friedrich
Initialize I2C pins on boards with CPM1/CPM2 controllers
and document the i2c bus in booting-without-of.

The boards don't have any I2C chips connected to the I2C
bus, so unless some external chips are connected to the
boards, this code is just an example of setting everything
else up.

Signed-off-by: Jochen Friedrich <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |   42 ++
 arch/powerpc/boot/dts/mpc8272ads.dts |   11 +++
 arch/powerpc/boot/dts/mpc866ads.dts  |   11 +++
 arch/powerpc/boot/dts/mpc885ads.dts  |   11 +++
 arch/powerpc/platforms/82xx/mpc8272_ads.c|4 ++
 arch/powerpc/platforms/8xx/mpc86xads_setup.c |4 ++
 arch/powerpc/platforms/8xx/mpc885ads_setup.c |3 ++
 7 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index d9dc996..26d323f 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -2132,6 +2132,48 @@ platforms are moved over to use the 
flattened-device-tree model.
};
};

+   x) I2C
+
+   The I2C controller is expressed as a bus under the CPM node.
+
+   Properties:
+   - compatible : "fsl,cpm1-i2c", "fsl,cpm2-i2c"
+   - reg : On CPM2 devices, the second resource doesn't specify the I2C
+ Parameter RAM itself, but the I2C_BASE field of the CPM2 Parameter RAM
+ (typically 0x8afc 0x2).
+   - #address-cells : Should be one. The cell is the i2c device address with
+ the r/w bit set to zero.
+   - #size-cells : Should be zero.
+   - clock-frequency : Can be used to set the i2c clock frequency. If
+ unspecified, a default frequency of 60kHz is being used.
+   The following two properties are deprecated. They are only used by legacy
+   i2c drivers to find the bus to probe:
+   - linux,i2c-index : Can be used to hard code an i2c bus number. By default,
+ the bus number is dynamically assigned by the i2c core.
+   - linux,i2c-class : Can be used to override the i2c class. The class is used
+ by legacy i2c device drivers to find a bus in a specific context like
+ system management, video or sound. By default, I2C_CLASS_HWMON (1) is
+ being used. The definition of the classes can be found in
+ include/i2c/i2c.h
+
+   Example, based on mpc823:
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc823-i2c",
+"fsl,cpm1-i2c";
+   reg = <0x860 0x20 0x3c80 0x30>;
+   interrupts = <16>;
+   interrupt-parent = <&CPM_PIC>;
+   fsl,cpm-command = <0x10>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   [EMAIL PROTECTED] {
+   compatible = "dallas,ds1307";
+   reg = <0x68>;
+   };
+   };
+
m) Chipselect/Local Bus

Properties:
diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts 
b/arch/powerpc/boot/dts/mpc8272ads.dts
index 46e2da3..d27f8a7 100644
--- a/arch/powerpc/boot/dts/mpc8272ads.dts
+++ b/arch/powerpc/boot/dts/mpc8272ads.dts
@@ -217,6 +217,17 @@
linux,network-index = <1>;
fsl,cpm-command = <0x16200300>;
};
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc8272-i2c",
+"fsl,cpm2-i2c";
+   reg = <0x11860 0x20 0x8afc 0x2>;
+   interrupts = <1 8>;
+   interrupt-parent = <&PIC>;
+   fsl,cpm-command = <0x2960>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
};

PIC: [EMAIL PROTECTED] {
diff --git a/arch/powerpc/boot/dts/mpc866ads.dts 
b/arch/powerpc/boot/dts/mpc866ads.dts
index 765e43c..bd70065 100644
--- a/arch/powerpc/boot/dts/mpc866ads.dts
+++ b/arch/powerpc/boot/dts/mpc866ads.dts
@@ -171,6 +171,17 @@
fsl,cpm-command = <>;
linux,network-index = <1>;
};
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc866-i2c",
+"fsl,cpm1-i2c";
+   reg = <0x860 0x20 0x3c80 0x30>;
+   interrupts = <16>;
+   interrupt-parent = <&CPM_PIC>;
+   fsl,cpm-command = <0x10>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
};
};

diff --git a/arch/powerpc/boot/dts/mpc885ads.dts 
b/arch/powerpc/boot/dts/mpc885ads.dts
index 9895043..

Re: [alsa-devel] [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers

2008-07-02 Thread Liam Girdwood
On Wed, 2008-07-02 at 09:48 -0600, Grant Likely wrote:
> On Wed, Jul 02, 2008 at 11:50:43AM +0200, Takashi Iwai wrote:
> > 
> > This is a helper module and not necessarily manually selectable.
> > Better to make the other driver selecting this.
> 
> Yes, you're right.  I hadn't put too much thought into the Kconfig stuff
> for this patch because, at the moment, I'm viewing this as a temporary
> solution until ASoCv2 is merged.
> 
> Which raises another question: Liam and Mark, what is your opinion on
> merging this driver?  Is it something that you would merge with the v1
> API and then rework it when v2 is merged?  Or would you rather it be
> kept out until v2 is ready?  I haven't even looked at the v2 API yet, so
> I don't know how much rework is involved.
> 

I'm happy with this atm for v1. We can then rework for V2.

Liam


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


Re: [PATCH 1/3] mpc83xx: Power Management support

2008-07-02 Thread Kumar Gala
diff --git a/arch/powerpc/platforms/83xx/suspend-asm.S b/arch/ 
powerpc/platforms/83xx/suspend-asm.S

new file mode 100644
index 000..03e29a2
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/suspend-asm.S
@@ -0,0 +1,539 @@
+/*
+ * Enter and leave sleep state on MPC83xx
+ *
+ * Author: Scott Wood <[EMAIL PROTECTED]>
+ *
+ * Copyright (c) 2006 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 version 2 as  
published

+ * by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#define SS_MEMSAVE 0x00
+#define SS_HID 0x08 /* 3 HIDs */
+#define SS_IABR0x14 /* 2 IABRs */
+#define SS_IBCR0x1c
+#define SS_DABR0x20 /* 2 DABRs */
+#define SS_DBCR0x28
+#define SS_SP  0x2c
+#define SS_SR  0x30 /* 16 segment registers */
+#define SS_CURRENT 0x70
+#define SS_MSR 0x74
+#define SS_SDR10x78
+#define SS_LR  0x7c
+#define SS_SPRG0x80 /* 4 SPRGs */
+#define SS_DBAT0x90 /* 8 DBATs */
+#define SS_IBAT0xd0 /* 8 IBATs */
+#define SS_TB  0x110
+#define SS_CR  0x118
+#define SS_GPREG   0x11c /* r12-r31 */
+#define STATE_SAVE_SIZE 0x16c
+
+   .section .data
+   .align  5
+
+mpc83xx_sleep_save_area:
+   .space  STATE_SAVE_SIZE
+immrbase:
+   .long   0


If we are going to allocate space for save area like this, can't we do  
this in C code.  Its less error prone and easier to extend over time.   
I know the powermac code does something similar but it places the save  
area on the stack.


It also seems like the core register save/restore should be shared  
between 83xx and 5{1,2}xx but that would be a longer term goal.


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


[PATCH] powerpc: fix section numbering of CPM chapter in booting-without-of.

2008-07-02 Thread Jochen Friedrich
Within the Freescale Communications Processor Module chapter, both
Serial and Network have the same section number iii). Renumber the
sections to make them unique again.

Signed-off-by: Jochen Friedrich <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index 1d2a772..d9dc996 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1992,7 +1992,7 @@ platforms are moved over to use the flattened-device-tree 
model.
fsl,cpm-command = <0080>;
};

-   iii) Network
+   iv) Network

Currently defined compatibles:
- fsl,cpm1-scc-enet
@@ -2015,7 +2015,7 @@ platforms are moved over to use the flattened-device-tree 
model.
fsl,cpm-command = <12000300>;
};

-   iv) MDIO
+   v) MDIO

Currently defined compatibles:
fsl,pq1-fec-mdio (reg is same as first resource of FEC device)
@@ -2039,7 +2039,7 @@ platforms are moved over to use the flattened-device-tree 
model.
fsl,mdc-pin = <13>;
};

-   v) Baud Rate Generators
+   vi) Baud Rate Generators

Currently defined compatibles:
fsl,cpm-brg
@@ -2062,7 +2062,7 @@ platforms are moved over to use the flattened-device-tree 
model.
clock-frequency = ;
};

-   vi) Interrupt Controllers
+   vii) Interrupt Controllers

Currently defined compatibles:
- fsl,cpm1-pic
@@ -2082,7 +2082,7 @@ platforms are moved over to use the flattened-device-tree 
model.
compatible = "mpc8272-pic", "fsl,cpm2-pic";
};

-   vii) USB (Universal Serial Bus Controller)
+   viii) USB (Universal Serial Bus Controller)

Properties:
- compatible : "fsl,cpm1-usb", "fsl,cpm2-usb", "fsl,qe-usb"
@@ -2098,7 +2098,7 @@ platforms are moved over to use the flattened-device-tree 
model.
fsl,cpm-command = <2e60>;
};

-   viii) Multi-User RAM (MURAM)
+   ix) Multi-User RAM (MURAM)

The multi-user/dual-ported RAM is expressed as a bus under the CPM node.

-- 
1.5.6

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


Re: patches for 2.6.27...

2008-07-02 Thread Kim Phillips
On Wed, 2 Jul 2008 02:56:16 -0500
Kumar Gala <[EMAIL PROTECTED]> wrote:

> Please point out any patches that have been posted but havent made it  
> into a git tree related to Freescale chips.

I haven't heard back from Segher, so:

http://patchwork.ozlabs.org/linuxppc/patch?id=19313

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


Re: [PATCH] powerpc: fixup lwsync at runtime

2008-07-02 Thread Kumar Gala


On Jul 2, 2008, at 4:34 AM, Michael Ellerman wrote:


On Tue, 2008-07-01 at 09:48 -0500, Kumar Gala wrote:

On Jul 1, 2008, at 1:29 AM, Michael Ellerman wrote:



diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/
setup_32.c
index 9e83add..0109e7f 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -101,6 +101,10 @@ unsigned long __init early_init(unsigned long
dt_ptr)
  PTRRELOC(&__start___ftr_fixup),
  PTRRELOC(&__stop___ftr_fixup));

+   do_lwsync_fixups(spec->cpu_features,
+PTRRELOC(&__start___lwsync_fixup),
+PTRRELOC(&__stop___lwsync_fixup));
+


This could be changed to use cur_cpu_spec->cpu_features, and then  
all

the call sites would be passing that, which would mean
do_lwsync_fixups() could just check cur_cpu_spec->cpu_features
directly.


cur_cpu_spec and spec at this point arent the same thing.


Aren't they? I must be missing something:


There is an issue with how ppc32 classic gets here and relocation.  If  
I change the call to:


do_lwsync_fixups(cur_cpu_spec->cpu_features,
 PTRRELOC(&__start___lwsync_fixup),
 PTRRELOC(&__stop___lwsync_fixup));

I can't boot on a 6xx based machine anymore.

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


Re: [alsa-devel] [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers

2008-07-02 Thread Grant Likely
On Wed, Jul 02, 2008 at 11:50:43AM +0200, Takashi Iwai wrote:
> At Tue, 01 Jul 2008 17:53:30 -0600,
> Grant Likely wrote:
> > diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
> > index 18f28ac..c5736e5 100644
> > --- a/sound/soc/Kconfig
> > +++ b/sound/soc/Kconfig
> > @@ -23,6 +23,12 @@ config SND_SOC
> >   This ASoC audio support can also be built as a module.  If so, the 
> > module
> >   will be called snd-soc-core.
> >  
> > +config SND_SOC_OF
> > +   tristate "OF helpers for SoC audio support"
> > +   depends on SND_SOC
> > +   ---help---
> > + Add support for OpenFirmware device tree descriptions of sound device
> > +
> 
> This is a helper module and not necessarily manually selectable.
> Better to make the other driver selecting this.

Yes, you're right.  I hadn't put too much thought into the Kconfig stuff
for this patch because, at the moment, I'm viewing this as a temporary
solution until ASoCv2 is merged.

Which raises another question: Liam and Mark, what is your opinion on
merging this driver?  Is it something that you would merge with the v1
API and then rework it when v2 is merged?  Or would you rather it be
kept out until v2 is ready?  I haven't even looked at the v2 API yet, so
I don't know how much rework is involved.

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


Re: patches for 2.6.27...

2008-07-02 Thread Scott Wood
On Wed, Jul 02, 2008 at 02:56:16AM -0500, Kumar Gala wrote:
> Please point out any patches that have been posted but havent made it  
> into a git tree related to Freescale chips.
> 
> I know there are probably a slew of CPM patches that need to get into  
> the tree.

Could you apply the 83xx power management patchset (the gianfar bits had
been acked by Jeff long ago)?

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


Re: [alsa-devel] [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers

2008-07-02 Thread Jon Smirl
On 7/1/08, Grant Likely <[EMAIL PROTECTED]> wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
>
>  Simple utility layer for creating ASoC machine instances based on data
>  in the OpenFirmware device tree.  OF aware platform drivers and codec
>  drivers register themselves with this framework and the framework
>  automatically instantiates a machine driver.
>
>  This is most likely temporary glue code to work around limitations in
>  the ASoC v1 framework.  I expect ASoC v2 won't need this.
>  ---
>
>   sound/soc/Kconfig  |6 ++
>   sound/soc/Makefile |1
>   sound/soc/soc-of.c |  171 
> 
>   3 files changed, 178 insertions(+), 0 deletions(-)
>
>  diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
>  index 18f28ac..c5736e5 100644
>  --- a/sound/soc/Kconfig
>  +++ b/sound/soc/Kconfig
>  @@ -23,6 +23,12 @@ config SND_SOC
>   This ASoC audio support can also be built as a module.  If so, the 
> module
>   will be called snd-soc-core.
>
>  +config SND_SOC_OF
>  +   tristate "OF helpers for SoC audio support"
>  +   depends on SND_SOC
>  +   ---help---
>  + Add support for OpenFirmware device tree descriptions of sound 
> device
>  +
>   # All the supported Soc's
>   source "sound/soc/at91/Kconfig"
>   source "sound/soc/pxa/Kconfig"
>  diff --git a/sound/soc/Makefile b/sound/soc/Makefile
>  index 782db21..191c2e5 100644
>  --- a/sound/soc/Makefile
>  +++ b/sound/soc/Makefile
>  @@ -2,3 +2,4 @@ snd-soc-core-objs := soc-core.o soc-dapm.o
>
>   obj-$(CONFIG_SND_SOC)  += snd-soc-core.o
>   obj-$(CONFIG_SND_SOC)  += codecs/ at91/ pxa/ s3c24xx/ sh/ fsl/ davinci/ 
> omap/
>  +obj-$(CONFIG_SND_SOC_OF)   += soc-of.o
>  diff --git a/sound/soc/soc-of.c b/sound/soc/soc-of.c
>  new file mode 100644
>  index 000..9694979
>  --- /dev/null
>  +++ b/sound/soc/soc-of.c
>  @@ -0,0 +1,171 @@
>  +/*
>  + * OF helpers for ALSA SoC Layer
>  + *
>  + * Copyright (C) 2008, Secret Lab Technologies Ltd.
>  + */
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
>  +MODULE_LICENSE("GPL");
>  +MODULE_DESCRIPTION("ALSA SoC OpenFirmware bindings");
>  +
>  +DEFINE_MUTEX(of_snd_soc_mutex);
>  +LIST_HEAD(of_snd_soc_device_list);
>  +static int of_snd_soc_next_index;
>  +
>  +struct of_snd_soc_device {
>  +   int id;
>  +   struct list_head list;
>  +   struct snd_soc_device device;
>  +   struct snd_soc_machine machine;
>  +   struct snd_soc_dai_link dai_link;
>  +   struct platform_device *pdev;
>  +   struct device_node *platform_node;
>  +   struct device_node *codec_node;
>  +};
>  +
>  +static struct snd_soc_ops of_snd_soc_ops = {
>  +};
>  +
>  +static struct of_snd_soc_device *
>  +of_snd_soc_get_device(struct device_node *codec_node)
>  +{
>  +   struct of_snd_soc_device *of_soc;
>  +
>  +   list_for_each_entry(of_soc, &of_snd_soc_device_list, list) {
>  +   if (of_soc->codec_node == codec_node)
>  +   return of_soc;
>  +   }
>  +
>  +   of_soc = kzalloc(sizeof(struct of_snd_soc_device), GFP_KERNEL);
>  +   if (!of_soc)
>  +   return NULL;
>  +
>  +   /* Initialize the structure and add it to the global list */
>  +   of_soc->codec_node = codec_node;
>  +   of_soc->id = of_snd_soc_next_index++;
>  +   of_soc->machine.dai_link = &of_soc->dai_link;
>  +   of_soc->machine.num_links = 1;
>  +   of_soc->device.machine = &of_soc->machine;
>  +   of_soc->dai_link.ops = &of_snd_soc_ops;
>  +   list_add(&of_soc->list, &of_snd_soc_device_list);
>  +
>  +   return of_soc;
>  +}

Isn't this performing the same basic function as this code (except for
spi)? Should this list be maintained in alsa or should there be an
equivalent for searching the spi bus? If you follow the link to the
codec node and get it's parent you know which bus to search. But it
might be simpler to just search the buses sequentially for the node.

static int of_dev_node_match(struct device *dev, void *data)
{
return dev->archdata.of_node == data;
}

struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
{
struct device *dev;

dev = bus_find_device(&i2c_bus_type, NULL, node,
 of_dev_node_match);
if (!dev)
return NULL;

return to_i2c_client(dev);
}
EXPORT_SYMBOL(of_find_i2c_device_by_node);



>  +
>  +static void of_snd_soc_register_device(struct of_snd_soc_device *of_soc)
>  +{
>  +   struct platform_device *pdev;
>  +   int rc;
>  +
>  +   /* Only register the device if both the codec and platform have
>  +* been registered */
>  +   if ((!of_soc->device.codec_data) || (!of_soc->platfo

Re: [PATCH] powerpc/85xx: Add support for MPC8536DS

2008-07-02 Thread Chen Gong
Kumar Gala 写道:
> 
> On Jul 2, 2008, at 9:04 AM, Chen Gong wrote:
> 
>> Stephen Rothwell 写道:
>>> Hi Kumar,
>>>
>>> On Wed, 2 Jul 2008 02:01:10 -0500 (CDT) Kumar Gala 
>>> <[EMAIL PROTECTED]> wrote:
 +void __init mpc8536_ds_pic_init(void)
 +{
 +struct mpic *mpic;
 +struct resource r;
 +struct device_node *np = NULL;
>>>
>>> You don't need to initialise this.
>>>
 +np = of_find_node_by_type(np, "open-pic");
 +
>>>
>>> Extra blank line.
>>>
 +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 | MPIC_BROKEN_FRR_NIRQS,
 +0, 256, " OpenPIC  ");
 +BUG_ON(mpic == NULL);
 +
 +mpic_init(mpic);
>>>
>>> You leak a reference to np here.
>>
>> It looks like there are same problem in other mpc85xx_xx.c files
> 
> agreed for the mpc85xx_ds.c, I dont see the _cds or _ads having these 
> issues.

Yes, maybe I should write as mpc8xxx_xx.c, because it seems there is
the same problem in mpc8610_hpcd.c mpc86xx_hpcn.c etc.
> 
> - k
> 
> 

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

Re: [alsa-devel] [PATCH 2/3] ALSA SoC: Add mpc5200-psc I2S driver

2008-07-02 Thread Jon Smirl
On 7/1/08, Grant Likely <[EMAIL PROTECTED]> wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
>
>  This is an I2S bus driver for the MPC5200 PSC device.  It is probably
>  will not be merged as-is because it uses v1 of the ASoC API, but I want
>  to get it out there for comments.
>  ---
>
>   sound/soc/fsl/Kconfig   |6
>   sound/soc/fsl/Makefile  |2
>   sound/soc/fsl/mpc5200_psc_i2s.c |  899 
> +++
>   3 files changed, 907 insertions(+), 0 deletions(-)
>
>  diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
>  index 257101f..5daa8d3 100644
>  --- a/sound/soc/fsl/Kconfig
>  +++ b/sound/soc/fsl/Kconfig
>  @@ -17,4 +17,10 @@ config SND_SOC_MPC8610_HPCD
> help
>   Say Y if you want to enable audio on the Freescale MPC8610 HPCD.
>
>  +config SND_SOC_MPC5200_I2S
>  +   bool "Freescale MPC5200 PSC in I2S mode driver"
>  +   depends on SND_SOC && PPC_MPC52xx
>  +   help
>  + Say Y here to support the MPC5200 PSCs in I2S mode.
>  +
>   endmenu
>  diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
>  index 62f680a..98729a1 100644
>  --- a/sound/soc/fsl/Makefile
>  +++ b/sound/soc/fsl/Makefile
>  @@ -4,3 +4,5 @@ obj-$(CONFIG_SND_SOC_MPC8610_HPCD) += mpc8610_hpcd.o
>   # MPC8610 Platform Support
>   obj-$(CONFIG_SND_SOC_MPC8610) += fsl_ssi.o fsl_dma.o
>
>  +obj-$(CONFIG_SND_SOC_MPC5200_I2S) += mpc5200_psc_i2s.o
>  +
>  diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c 
> b/sound/soc/fsl/mpc5200_psc_i2s.c
>  new file mode 100644
>  index 000..81d0933
>  --- /dev/null
>  +++ b/sound/soc/fsl/mpc5200_psc_i2s.c
>  @@ -0,0 +1,899 @@
>  +/*
>  + * Freescale MPC5200 PSC in I2S mode
>  + * ALSA SoC Digital Audio Interface (DAI) driver
>  + *
>  + * Copyright (C) 2008 Secret Lab Technologies Ltd.
>  + */
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +#include 
>  +#include 
>  +#include 
>  +
>  +MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
>  +MODULE_DESCRIPTION("Freescale MPC5200 PSC in I2S mode ASoC Driver");
>  +MODULE_LICENSE("GPL");
>  +
>  +/**
>  + * PSC_I2S_RATES: sample rates supported by the I2S
>  + *
>  + * This driver currently only supports the PSC running in I2S slave mode,
>  + * which means the codec determines the sample rate.  Therefore, we tell
>  + * ALSA that we support all rates and let the codec driver decide what rates
>  + * are really supported.
>  + */
>  +#define PSC_I2S_RATES (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_192000 | \
>  +   SNDRV_PCM_RATE_CONTINUOUS)
>  +
>  +/**
>  + * PSC_I2S_FORMATS: audio formats supported by the PSC I2S mode
>  + */
>  +#define PSC_I2S_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE | \
>  +SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S24_BE | 
> \
>  +SNDRV_PCM_FMTBIT_S32_BE)
>  +
>  +/**
>  + * psc_i2s_stream - Data specific to a single stream (playback or capture)
>  + * @active:flag indicating if the stream is active
>  + * @psc_i2s:   pointer back to parent psc_i2s data structure
>  + * @bcom_task: bestcomm task structure
>  + * @irq:   irq number for bestcomm task
>  + * @period_start:  physical address of start of DMA region
>  + * @period_end:physical address of end of DMA region
>  + * @period_next_pt:physical address of next DMA buffer to enqueue
>  + * @period_bytes:  size of DMA period in bytes
>  + */
>  +struct psc_i2s_stream {
>  +   int active;
>  +   struct psc_i2s *psc_i2s;
>  +   struct bcom_task *bcom_task;
>  +   int irq;
>  +   struct snd_pcm_substream *stream;
>  +   dma_addr_t period_start;
>  +   dma_addr_t period_end;
>  +   dma_addr_t period_next_pt;
>  +   dma_addr_t period_current_pt;
>  +   int period_bytes;
>  +};
>  +
>  +/**
>  + * psc_i2s - Private driver data
>  + * @name: short name for this device ("PSC0", "PSC1", etc)
>  + * @psc_regs: pointer to the PSC's registers
>  + * @fifo_regs: pointer to the PSC's FIFO registers
>  + * @irq: IRQ of this PSC
>  + * @dev: struct device pointer
>  + * @playback: the number of playback streams opened
>  + * @capture: the number of capture streams opened
>  + * @dai: the CPU DAI for this device
>  + * @playback_stream: Playback stream context data
>  + * @capture_stream: Capture stream context data
>  + */
>  +struct psc_i2s {
>  +   char name[32];
>  +   struct mpc52xx_psc __iomem *psc_regs;
>  +   struct mpc52xx_psc_fifo __iomem *fifo_regs;
>  +   unsigned int irq;
>  +   struct device *dev;
>  +   struct snd_soc_cpu_dai dai;
>  +   spinlock_t lock;
>  +
>  +   /* per-stream data */
>  +   struct psc_i2s_stream playback_stream;
>  +   struct psc_i2s_stream capture_stream;
>  +
>  +   /* S

Re: Commits added to powerpc.git master and powerpc-next branches

2008-07-02 Thread Kumar Gala


On Jul 2, 2008, at 7:35 AM, Jochen Friedrich wrote:


Hi Kumar,


any chance to get this one into 2.6.27?

[POWERPC] Add i2c pins to dts and board setup
http://patchwork.ozlabs.org/linuxppc/patch?person=1023&id=18603


Will we always want defconfig updates to enable the driver?


Good question. Maybe not, as the i2c bus seems to be unused on these
boards unless someone connects some i2c devices.

I'll resubmit just the booting-without-of part then.


Actually, if that's the case I'd prefer to leave the patch is as and  
just make a note about the fact that the I2C bus isn't connected to  
anything on the board in the commit message.  The code is a good  
example of setting everything else up and I'd like to have that in the  
tree.


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


Re: [PATCH v2] Change the default link address for pSeries zImage kernels.

2008-07-02 Thread Olaf Hering
On Tue, Jun 24, Tony Breeds wrote:

> Currently we set the start of the .text section to be 4Mb for pSeries.
> In situations where the zImage is > 8Mb we'll fail to boot (due to
> overlapping with OF).  Move .text in a zImage from 4MB to 64MB (well past OF).
> 
> We still will not be able to load large zImage unless we also move OF,
> to that end, add a note to the zImage ELF to move OF to 32Mb.  If this
> is the very first kernel booted then we'll need to move OF manually by
> setting real-base.

Setting real-base to what?

What currently happens with a large boot file is:
Firmware loads the zImage at load-base, finds that the ELF file is too
large to fit into the memory window and stops.

With your patch, firmware loads 12566528 bytes, and starts the zImage.
The result is a truncated file, the initrd will be corrupted, kernel
panic in populate_rootfs().

The only system where firmware relocates itself from 12MB to 32MB is a
p640 with firmware version NAN04194.
All other systems seem to ignore the NOTE section, real-base remains at
0xc0

So I do not think your patch is a real improvement,
clear error vs. silent corruption.

Do you happen to know how to automate the changing the value of
real-base? The addnote change has appearently no effect on recent
systems.

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


Re: [PATCH] powerpc/85xx: Add support for MPC8536DS

2008-07-02 Thread Kumar Gala


On Jul 2, 2008, at 9:04 AM, Chen Gong wrote:


Stephen Rothwell 写道:

Hi Kumar,

On Wed, 2 Jul 2008 02:01:10 -0500 (CDT) Kumar Gala <[EMAIL PROTECTED] 
> wrote:

+void __init mpc8536_ds_pic_init(void)
+{
+   struct mpic *mpic;
+   struct resource r;
+   struct device_node *np = NULL;


You don't need to initialise this.


+   np = of_find_node_by_type(np, "open-pic");
+


Extra blank line.


+   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 | MPIC_BROKEN_FRR_NIRQS,
+   0, 256, " OpenPIC  ");
+   BUG_ON(mpic == NULL);
+
+   mpic_init(mpic);


You leak a reference to np here.


It looks like there are same problem in other mpc85xx_xx.c files


agreed for the mpc85xx_ds.c, I dont see the _cds or _ads having these  
issues.


- k

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

[PATCH] powerpc/85xx: minor fixes for MPC85xx DS board port

2008-07-02 Thread Kumar Gala
These issues were reported by Stephen Rothwell for another 85xx board
port and pointed out by Chen Gong as issues in the DS port.

* mpic OF node reference counting was off
* of_device_id struct should be marked as __initdata

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
in my powerpc-next tree.

- k

 arch/powerpc/platforms/85xx/mpc85xx_ds.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index b010dc9..8b2d63d 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -58,14 +58,13 @@ void __init mpc85xx_ds_pic_init(void)
 {
struct mpic *mpic;
struct resource r;
-   struct device_node *np = NULL;
+   struct device_node *np;
 #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;
@@ -82,6 +81,7 @@ void __init mpc85xx_ds_pic_init(void)
  MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
0, 256, " OpenPIC  ");
BUG_ON(mpic == NULL);
+   of_node_put(np);

mpic_init(mpic);

@@ -185,7 +185,7 @@ static int __init mpc8544_ds_probe(void)
}
 }

-static struct of_device_id mpc85xxds_ids[] = {
+static struct of_device_id __initdata mpc85xxds_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{},
-- 
1.5.5.1

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


Please pull linux-2.6-mpc52xx.git for 2.6.26

2008-07-02 Thread Grant Likely
Hi Paul,

Here is one more last minute 2.6.26 bug fix.

The following changes since commit 1702b52092e9a6d05398d3f9581ddc050ef00d06:
  Linus Torvalds (1):
Merge git://git.kernel.org/.../mchehab/v4l-dvb

are available in the git repository at:

  git://git.secretlab.ca/git/linux-2.6-mpc52xx.git for-2.6.26

Tim Yamin (1):
  powerpc/mpc5200: Fix lite5200b suspend/resume

 arch/powerpc/platforms/52xx/lite5200_pm.c |   14 +-
 1 files changed, 13 insertions(+), 1 deletions(-)

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


Re: [PATCH 1/2] Convert i2c-mpc from a platform driver into a of_platform driver, V4

2008-07-02 Thread Jean Delvare
On Wed, 2 Jul 2008 15:33:43 +0200, Wolfram Sang wrote:
> Hi Jean,
> 
> On Tue, Jul 01, 2008 at 06:14:44PM +0200, Jean Delvare wrote:
> 
> > Applied, after fixing the patch so that it applies, fixing it again so
> > that it is correct in the polling case, and fixing it again to make it
> > pass checkpatch.pl.
> So, it cannot be applied directly? :(
> 
> Could you repost the correct version perhaps? I'd like to test it, but
> can't find it at http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
> (because it is scheduled for 2.6.27?).

It's at:
http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/i2c-mpc-convert-to-an-of_platform-driver.patch

It was simply a couple days since I had updated this public directory,
sorry.

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


Re: [PATCH v2 1/2] powerpc: Fix building of feature-fixup tests on ppc32

2008-07-02 Thread Kumar Gala


On Jul 2, 2008, at 4:35 AM, Michael Ellerman wrote:


On Tue, 2008-07-01 at 10:16 -0500, Kumar Gala wrote:

We need to use PPC_LCMPI otherwise we get compile errors like:

arch/powerpc/lib/feature-fixups-test.S: Assembler messages:
arch/powerpc/lib/feature-fixups-test.S:142: Error: Unrecognized  
opcode: `cmpdi'
arch/powerpc/lib/feature-fixups-test.S:149: Error: Unrecognized  
opcode: `cmpdi'
arch/powerpc/lib/feature-fixups-test.S:164: Error: Unrecognized  
opcode: `cmpdi'


Sorry, I definitely built (and booted) a 32-bit config, so I'm not  
sure

how I missed that. What toolchain are you using?


gcc-4.3.0 from fedora 9 on a G5.

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


RE: [PATCH] powerpc: Xilinx: add dts file for ML507 board

2008-07-02 Thread John Linn
Hi Josh,

It's looking like I need to update this anyway for some changes to our
reference system I just learned about.

I'll talk with Stephen about dts-v1 as he does most of the dts
generation work.

Thanks,
John

-Original Message-
From: Josh Boyer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 01, 2008 6:53 PM
To: John Linn
Cc: linuxppc-dev@ozlabs.org; [EMAIL PROTECTED]; John Linn
Subject: Re: [PATCH] powerpc: Xilinx: add dts file for ML507 board

On Tue, 1 Jul 2008 16:02:54 -0700
John Linn <[EMAIL PROTECTED]> wrote:

> This new file adds support for the ML507 board which
> has a Virtex 5 FXT FPGA with a 440.

I haven't looked this over thoroughly yet, but an immediate question
comes to mind.  Any way this can get converted to dts-v1 before it's
pulled in?  All of the in-tree DTS files should be dts-v1 now, so I'd
like to have new ones go in as that.

(Also CC'ing the proper list)

josh


This email and any attachments are intended for the sole use of the named 
recipient(s) and contain(s) confidential information that may be proprietary, 
privileged or copyrighted under applicable law. If you are not the intended 
recipient, do not read, copy, or forward this email message or any attachments. 
Delete this email message and any attachments immediately.


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


Re: [PATCH] powerpc/85xx: Add support for MPC8536DS

2008-07-02 Thread Chen Gong
Stephen Rothwell 写道:
> Hi Kumar,
> 
> On Wed, 2 Jul 2008 02:01:10 -0500 (CDT) Kumar Gala <[EMAIL PROTECTED]> wrote:
>> +void __init mpc8536_ds_pic_init(void)
>> +{
>> +struct mpic *mpic;
>> +struct resource r;
>> +struct device_node *np = NULL;
> 
> You don't need to initialise this.
> 
>> +np = of_find_node_by_type(np, "open-pic");
>> +
> 
> Extra blank line.
> 
>> +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 | MPIC_BROKEN_FRR_NIRQS,
>> +0, 256, " OpenPIC  ");
>> +BUG_ON(mpic == NULL);
>> +
>> +mpic_init(mpic);
> 
> You leak a reference to np here.

It looks like there are same problem in other mpc85xx_xx.c files

> 
>> +static struct of_device_id mpc8536_ds_ids[] = {
> 
> __initdata, please.
> 
> 
> 
> 
> 
> ___
> 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: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-02 Thread Jon Smirl
On 7/1/08, Grant Likely <[EMAIL PROTECTED]> wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
>
>  ASoC Codec driver for the TLV320AIC26 device.  This driver uses the ASoC
>  v1 API, so I don't expect it to get merged as-is, but I want to get it
>  out there for review.
>  ---
>
>   sound/soc/codecs/Kconfig   |4
>   sound/soc/codecs/Makefile  |2
>   sound/soc/codecs/tlv320aic26.c |  630 
> 
>   3 files changed, 636 insertions(+), 0 deletions(-)
>
>  diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
>  index 3903ab7..96c7bfe 100644
>  --- a/sound/soc/codecs/Kconfig
>  +++ b/sound/soc/codecs/Kconfig
>  @@ -41,6 +41,10 @@ config SND_SOC_CS4270_VD33_ERRATA
> bool
> depends on SND_SOC_CS4270
>
>  +config SND_SOC_TLV320AIC26
>  +   tristate "TI TLB320AIC26 Codec support"
>  +   depends on SND_SOC && SPI
>  +
>   config SND_SOC_TLV320AIC3X
> tristate
> depends on SND_SOC && I2C
>  diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
>  index 4e1314c..ec0cd93 100644
>  --- a/sound/soc/codecs/Makefile
>  +++ b/sound/soc/codecs/Makefile
>  @@ -5,6 +5,7 @@ snd-soc-wm8753-objs := wm8753.o
>   snd-soc-wm9712-objs := wm9712.o
>   snd-soc-wm9713-objs := wm9713.o
>   snd-soc-cs4270-objs := cs4270.o
>  +snd-soc-tlv320aic26-objs := tlv320aic26.o
>   snd-soc-tlv320aic3x-objs := tlv320aic3x.o
>
>   obj-$(CONFIG_SND_SOC_AC97_CODEC)   += snd-soc-ac97.o
>  @@ -14,4 +15,5 @@ obj-$(CONFIG_SND_SOC_WM8753)  += snd-soc-wm8753.o
>   obj-$(CONFIG_SND_SOC_WM9712)   += snd-soc-wm9712.o
>   obj-$(CONFIG_SND_SOC_WM9713)   += snd-soc-wm9713.o
>   obj-$(CONFIG_SND_SOC_CS4270)   += snd-soc-cs4270.o
>  +obj-$(CONFIG_SND_SOC_TLV320AIC26)  += snd-soc-tlv320aic26.o
>   obj-$(CONFIG_SND_SOC_TLV320AIC3X)  += snd-soc-tlv320aic3x.o
>  diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
>  new file mode 100644
>  index 000..aee1dbc
>  --- /dev/null
>  +++ b/sound/soc/codecs/tlv320aic26.c
>  @@ -0,0 +1,630 @@
>  +/*
>  + * Texas Instruments TLV320AIC26 low power audio CODEC
>  + * ALSA SoC CODEC driver
>  + *
>  + * Copyright (C) 2008 Secret Lab Technologies Ltd.
>  + */
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +MODULE_DESCRIPTION("ASoC TLV320AIC26 codec driver");
>  +MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
>  +MODULE_LICENSE("GPL");
>  +
>  +/* AIC26 Registers */
>  +#define AIC26_READ_COMMAND_WORD(addr)  ((1 << 15) | (addr << 5))
>  +#define AIC26_WRITE_COMMAND_WORD(addr) ((0 << 15) | (addr << 5))
>  +#define AIC26_PAGE_ADDR(page, offset)  ((page << 6) | offset)
>  +#define AIC26_NUM_REGS AIC26_PAGE_ADDR(3, 0)
>  +#define AIC26_REG_CACHE_SIZE   (0x20) /* only page 2 cached */
>  +#define AIC26_REG_IS_CACHED(addr)  ((addr & ~0x1f) == (2 << 6))
>  +#define AIC26_REG_CACHE_ADDR(addr) (addr & 0x1f)
>  +
>  +/* Page 0: Auxillary data registers */
>  +#define AIC26_REG_BAT1 AIC26_PAGE_ADDR(0, 0x05)
>  +#define AIC26_REG_BAT2 AIC26_PAGE_ADDR(0, 0x06)
>  +#define AIC26_REG_AUX  AIC26_PAGE_ADDR(0, 0x07)
>  +#define AIC26_REG_TEMP1AIC26_PAGE_ADDR(0, 0x09)
>  +#define AIC26_REG_TEMP2AIC26_PAGE_ADDR(0, 0x0A)
>  +
>  +/* Page 1: Auxillary control registers */
>  +#define AIC26_REG_AUX_ADC  AIC26_PAGE_ADDR(1, 0x00)
>  +#define AIC26_REG_STATUS   AIC26_PAGE_ADDR(1, 0x01)
>  +#define AIC26_REG_REFERENCEAIC26_PAGE_ADDR(1, 0x03)
>  +#define AIC26_REG_RESETAIC26_PAGE_ADDR(1, 0x04)
>  +
>  +/* Page 2: Audio control registers */
>  +#define AIC26_REG_AUDIO_CTRL1  AIC26_PAGE_ADDR(2, 0x00)
>  +#define AIC26_REG_ADC_GAIN AIC26_PAGE_ADDR(2, 0x01)
>  +#define AIC26_REG_DAC_GAIN AIC26_PAGE_ADDR(2, 0x02)
>  +#define AIC26_REG_SIDETONE AIC26_PAGE_ADDR(2, 0x03)
>  +#define AIC26_REG_AUDIO_CTRL2  AIC26_PAGE_ADDR(2, 0x04)
>  +#define AIC26_REG_POWER_CTRL   AIC26_PAGE_ADDR(2, 0x05)
>  +#define AIC26_REG_AUDIO_CTRL3  AIC26_PAGE_ADDR(2, 0x06)
>  +
>  +#define AIC26_REG_FILTER_COEFF_L_N0AIC26_PAGE_ADDR(2, 0x07)
>  +#define AIC26_REG_FILTER_COEFF_L_N1AIC26_PAGE_ADDR(2, 0x08)
>  +#define AIC26_REG_FILTER_COEFF_L_N2AIC26_PAGE_ADDR(2, 0x09)
>  +#define AIC26_REG_FILTER_COEFF_L_N3AIC26_PAGE_ADDR(2, 0x0A)
>  +#define AIC26_REG_FILTER_COEFF_L_N4AIC26_PAGE_ADDR(2, 0x0B)
>  +#define AIC26_REG_FILTER_COEFF_L_N5AIC26_PAGE_ADDR(2, 0x0C)
>  +#define AIC26_REG_FILTER_COEFF_L_D1AIC26_PAGE_ADDR(2, 0x0D)
>  +#define AIC26_REG_FILTER_COEFF_L_D2AIC26_PAGE_ADDR(2, 0x0E)
>  +#define AIC26_REG_FILTER_COEFF_L_D4AIC26_PAGE_ADDR(2, 0x0F)
>  +#define AIC26_REG_FILTER_COEFF_L

Re: [alsa-devel] [PATCH 2/3] ALSA SoC: Add mpc5200-psc I2S driver

2008-07-02 Thread Jon Smirl
DMA, needs to be split out. Efika is AC97 on the MPC5200 and needs to
share DMA code. The new Phytec pcm030 baseboard is AC97 too.

What does the device tree look like?


On 7/1/08, Grant Likely <[EMAIL PROTECTED]> wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
>
>  This is an I2S bus driver for the MPC5200 PSC device.  It is probably
>  will not be merged as-is because it uses v1 of the ASoC API, but I want
>  to get it out there for comments.
>  ---
>
>   sound/soc/fsl/Kconfig   |6
>   sound/soc/fsl/Makefile  |2
>   sound/soc/fsl/mpc5200_psc_i2s.c |  899 
> +++
>   3 files changed, 907 insertions(+), 0 deletions(-)
>
>  diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
>  index 257101f..5daa8d3 100644
>  --- a/sound/soc/fsl/Kconfig
>  +++ b/sound/soc/fsl/Kconfig
>  @@ -17,4 +17,10 @@ config SND_SOC_MPC8610_HPCD
> help
>   Say Y if you want to enable audio on the Freescale MPC8610 HPCD.
>
>  +config SND_SOC_MPC5200_I2S
>  +   bool "Freescale MPC5200 PSC in I2S mode driver"
>  +   depends on SND_SOC && PPC_MPC52xx
>  +   help
>  + Say Y here to support the MPC5200 PSCs in I2S mode.
>  +
>   endmenu
>  diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
>  index 62f680a..98729a1 100644
>  --- a/sound/soc/fsl/Makefile
>  +++ b/sound/soc/fsl/Makefile
>  @@ -4,3 +4,5 @@ obj-$(CONFIG_SND_SOC_MPC8610_HPCD) += mpc8610_hpcd.o
>   # MPC8610 Platform Support
>   obj-$(CONFIG_SND_SOC_MPC8610) += fsl_ssi.o fsl_dma.o
>
>  +obj-$(CONFIG_SND_SOC_MPC5200_I2S) += mpc5200_psc_i2s.o
>  +
>  diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c 
> b/sound/soc/fsl/mpc5200_psc_i2s.c
>  new file mode 100644
>  index 000..81d0933
>  --- /dev/null
>  +++ b/sound/soc/fsl/mpc5200_psc_i2s.c
>  @@ -0,0 +1,899 @@
>  +/*
>  + * Freescale MPC5200 PSC in I2S mode
>  + * ALSA SoC Digital Audio Interface (DAI) driver
>  + *
>  + * Copyright (C) 2008 Secret Lab Technologies Ltd.
>  + */
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +#include 
>  +#include 
>  +#include 
>  +
>  +MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
>  +MODULE_DESCRIPTION("Freescale MPC5200 PSC in I2S mode ASoC Driver");
>  +MODULE_LICENSE("GPL");
>  +
>  +/**
>  + * PSC_I2S_RATES: sample rates supported by the I2S
>  + *
>  + * This driver currently only supports the PSC running in I2S slave mode,
>  + * which means the codec determines the sample rate.  Therefore, we tell
>  + * ALSA that we support all rates and let the codec driver decide what rates
>  + * are really supported.
>  + */
>  +#define PSC_I2S_RATES (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_192000 | \
>  +   SNDRV_PCM_RATE_CONTINUOUS)
>  +
>  +/**
>  + * PSC_I2S_FORMATS: audio formats supported by the PSC I2S mode
>  + */
>  +#define PSC_I2S_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE | \
>  +SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S24_BE | 
> \
>  +SNDRV_PCM_FMTBIT_S32_BE)
>  +
>  +/**
>  + * psc_i2s_stream - Data specific to a single stream (playback or capture)
>  + * @active:flag indicating if the stream is active
>  + * @psc_i2s:   pointer back to parent psc_i2s data structure
>  + * @bcom_task: bestcomm task structure
>  + * @irq:   irq number for bestcomm task
>  + * @period_start:  physical address of start of DMA region
>  + * @period_end:physical address of end of DMA region
>  + * @period_next_pt:physical address of next DMA buffer to enqueue
>  + * @period_bytes:  size of DMA period in bytes
>  + */
>  +struct psc_i2s_stream {
>  +   int active;
>  +   struct psc_i2s *psc_i2s;
>  +   struct bcom_task *bcom_task;
>  +   int irq;
>  +   struct snd_pcm_substream *stream;
>  +   dma_addr_t period_start;
>  +   dma_addr_t period_end;
>  +   dma_addr_t period_next_pt;
>  +   dma_addr_t period_current_pt;
>  +   int period_bytes;
>  +};
>  +
>  +/**
>  + * psc_i2s - Private driver data
>  + * @name: short name for this device ("PSC0", "PSC1", etc)
>  + * @psc_regs: pointer to the PSC's registers
>  + * @fifo_regs: pointer to the PSC's FIFO registers
>  + * @irq: IRQ of this PSC
>  + * @dev: struct device pointer
>  + * @playback: the number of playback streams opened
>  + * @capture: the number of capture streams opened
>  + * @dai: the CPU DAI for this device
>  + * @playback_stream: Playback stream context data
>  + * @capture_stream: Capture stream context data
>  + */
>  +struct psc_i2s {
>  +   char name[32];
>  +   struct mpc52xx_psc __iomem *psc_regs;
>  +   struct mpc52xx_psc_fifo __iomem *fifo_regs;
>  +   unsigned int irq;
>  +   struct device *dev;
>  +   struct snd_soc_cpu_dai dai;
>  +   spi

Re: [alsa-devel] [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers

2008-07-02 Thread Jon Smirl
On 7/1/08, Grant Likely <[EMAIL PROTECTED]> wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
>
>  Simple utility layer for creating ASoC machine instances based on data
>  in the OpenFirmware device tree.  OF aware platform drivers and codec
>  drivers register themselves with this framework and the framework
>  automatically instantiates a machine driver.
>
>  This is most likely temporary glue code to work around limitations in
>  the ASoC v1 framework.  I expect ASoC v2 won't need this.
>  ---
>
>   sound/soc/Kconfig  |6 ++
>   sound/soc/Makefile |1
>   sound/soc/soc-of.c |  171 
> 
>   3 files changed, 178 insertions(+), 0 deletions(-)
>
>  diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
>  index 18f28ac..c5736e5 100644
>  --- a/sound/soc/Kconfig
>  +++ b/sound/soc/Kconfig
>  @@ -23,6 +23,12 @@ config SND_SOC
>   This ASoC audio support can also be built as a module.  If so, the 
> module
>   will be called snd-soc-core.
>
>  +config SND_SOC_OF
>  +   tristate "OF helpers for SoC audio support"
>  +   depends on SND_SOC
>  +   ---help---
>  + Add support for OpenFirmware device tree descriptions of sound 
> device
>  +
>   # All the supported Soc's
>   source "sound/soc/at91/Kconfig"
>   source "sound/soc/pxa/Kconfig"
>  diff --git a/sound/soc/Makefile b/sound/soc/Makefile
>  index 782db21..191c2e5 100644
>  --- a/sound/soc/Makefile
>  +++ b/sound/soc/Makefile
>  @@ -2,3 +2,4 @@ snd-soc-core-objs := soc-core.o soc-dapm.o
>
>   obj-$(CONFIG_SND_SOC)  += snd-soc-core.o
>   obj-$(CONFIG_SND_SOC)  += codecs/ at91/ pxa/ s3c24xx/ sh/ fsl/ davinci/ 
> omap/
>  +obj-$(CONFIG_SND_SOC_OF)   += soc-of.o
>  diff --git a/sound/soc/soc-of.c b/sound/soc/soc-of.c
>  new file mode 100644
>  index 000..9694979
>  --- /dev/null
>  +++ b/sound/soc/soc-of.c
>  @@ -0,0 +1,171 @@
>  +/*
>  + * OF helpers for ALSA SoC Layer
>  + *
>  + * Copyright (C) 2008, Secret Lab Technologies Ltd.
>  + */
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
>  +MODULE_LICENSE("GPL");
>  +MODULE_DESCRIPTION("ALSA SoC OpenFirmware bindings");
>  +
>  +DEFINE_MUTEX(of_snd_soc_mutex);
>  +LIST_HEAD(of_snd_soc_device_list);
>  +static int of_snd_soc_next_index;
>  +
>  +struct of_snd_soc_device {
>  +   int id;
>  +   struct list_head list;
>  +   struct snd_soc_device device;
>  +   struct snd_soc_machine machine;
>  +   struct snd_soc_dai_link dai_link;
>  +   struct platform_device *pdev;
>  +   struct device_node *platform_node;
>  +   struct device_node *codec_node;
>  +};
>  +
>  +static struct snd_soc_ops of_snd_soc_ops = {
>  +};
>  +
>  +static struct of_snd_soc_device *
>  +of_snd_soc_get_device(struct device_node *codec_node)
>  +{
>  +   struct of_snd_soc_device *of_soc;
>  +
>  +   list_for_each_entry(of_soc, &of_snd_soc_device_list, list) {
>  +   if (of_soc->codec_node == codec_node)
>  +   return of_soc;
>  +   }
>  +
>  +   of_soc = kzalloc(sizeof(struct of_snd_soc_device), GFP_KERNEL);
>  +   if (!of_soc)
>  +   return NULL;
>  +
>  +   /* Initialize the structure and add it to the global list */
>  +   of_soc->codec_node = codec_node;
>  +   of_soc->id = of_snd_soc_next_index++;
>  +   of_soc->machine.dai_link = &of_soc->dai_link;
>  +   of_soc->machine.num_links = 1;
>  +   of_soc->device.machine = &of_soc->machine;
>  +   of_soc->dai_link.ops = &of_snd_soc_ops;
>  +   list_add(&of_soc->list, &of_snd_soc_device_list);
>  +
>  +   return of_soc;
>  +}
>  +
>  +static void of_snd_soc_register_device(struct of_snd_soc_device *of_soc)
>  +{
>  +   struct platform_device *pdev;
>  +   int rc;
>  +
>  +   /* Only register the device if both the codec and platform have
>  +* been registered */
>  +   if ((!of_soc->device.codec_data) || (!of_soc->platform_node))
>  +   return;
>  +
>  +   pr_info("platform<-->codec match achieved; registering machine\n");
>  +
>  +   pdev = platform_device_alloc("soc-audio", of_soc->id);
>  +   if (!pdev) {
>  +   pr_err("of_soc: platform_device_alloc() failed\n");
>  +   return;
>  +   }
>  +
>  +   pdev->dev.platform_data = of_soc;
>  +   platform_set_drvdata(pdev, &of_soc->device);
>  +   of_soc->device.dev = &pdev->dev;
>  +
>  +   /* The ASoC device is complete; register it */
>  +   rc = platform_device_add(pdev);
>  +   if (rc) {
>  +   pr_err("of_soc: platform_device_add() failed\n");
>  +   return;
>  +   }

Is there a driver for this device?  Is another file missing?
sof_of.h is missing too.

>  +
>  +}
>  +
>  +int of_snd_s

RE: Graphic Card on Freescale MPC837x-rdb

2008-07-02 Thread Bizhan Gholikhamseh (bgholikh)
> -Original Message-
> From: Anatolij Gustschin [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, June 25, 2008 12:37 AM
> To: Bizhan Gholikhamseh (bgholikh)
> Cc: [EMAIL PROTECTED]; linuxppc-dev@ozlabs.org
> Subject: Re: Graphic Card on Freescale MPC837x-rdb
> 
> Bizhan Gholikhamseh (bgholikh) wrote:
> > HI all,
> > Has anyone tried using a Graphic card on Freescale 
> MPC837x-rdb board? 
> > If so I appreciate any hints and information that I can use.
> 
> take a look at these patches and info in the readme under:
> http://www.scitechsoft.com/ftp/snap/linux/videoboot/
> 
> it is pretty easy to get them working with older ATI Cards 
> (R2xx) on powerpc.
> 
Hi
Do I need to change the DT file for add-on graphic cards?

Regards,
Bizhan 

> Best regards,
> Anatolij
> 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: High Memory problem on 2.4.22 Linux, 2GB ppc card

2008-07-02 Thread Ruksen INANIR



I want to change the MAX_LOW_MEM to 1520 MB, what other settings do i 
need to change?  I do not want to use HIGHMEM because the Fiber channel 
does not support highmem. The card is 2 GB ppc. 1520 MB is enough. At 
the moment card works with 1456 MB MAX_LOW_MEM. but setting the value 
MAX_LOW_MEM to 1520 results problems. I believe there should be other 
settings.


Thanks


Ruksen INANIR wrote:


Hi all,
   I am working on a PPC Motorola card, which runs Linux 2.4.22.  The 
card has 2 GB onboard memory. But with use 1456 MB of  the available 
memory.  To increase the memory capacity i  need  to  increase the 
used memory at least 64 MB. With CONFIG_HIGHMEM option all of the 2 GB 
memory can be used but, but the fc driver on the card has no high 
memory support, so this caused problems.

 Then i saw that the memory is limited to 1456 by
   #define MAX_LOW_MEM0x5B00  setting in pgtable.c.  I 
tried to increase it by 64 MB but i could only increase the value of 
MAX_LOW_MEM by 47 MB (1503 MB) without CONFIG_HIGHMEM option.


   1)Is there any other setting that i should set other than 
MAX_LOW_MEM to increase the usable memory to 1520 ?
   2)I knew that the addressable physical memory without high memory 
option was 1 G.  How was it possible to address 1503 MB without 
CONFIG_HIGHMEM ? What is the max usable memory for 2.4.22 kernel?


   Thanks,
   Rinanir.


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


Re: [i2c] [PATCH 1/2] Convert i2c-mpc from a platform driver into a of_platform driver, V4

2008-07-02 Thread Wolfram Sang
Hi Jean,

On Tue, Jul 01, 2008 at 06:14:44PM +0200, Jean Delvare wrote:

> Applied, after fixing the patch so that it applies, fixing it again so
> that it is correct in the polling case, and fixing it again to make it
> pass checkpatch.pl.
So, it cannot be applied directly? :(

Could you repost the correct version perhaps? I'd like to test it, but
can't find it at http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
(because it is scheduled for 2.6.27?).

All the best,

   Wolfram

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry


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

powerpc: Remove old dump_task_* functions

2008-07-02 Thread Michael Neuling
Since Roland's ptrace cleanup starting
f65255e8d51ecbc6c9eef20d39e0377d19b658ca, the dump_task_* functions are
no longer being used.

Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>
---
Paulus: please add to you 2.6.27 tree.  

 arch/powerpc/kernel/process.c |   83 --
 include/asm-powerpc/elf.h |   20 --
 2 files changed, 103 deletions(-)

Index: linux-2.6-ozlabs/arch/powerpc/kernel/process.c
===
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/process.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/process.c
@@ -105,29 +105,6 @@ void enable_kernel_fp(void)
 }
 EXPORT_SYMBOL(enable_kernel_fp);
 
-int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
-{
-#ifdef CONFIG_VSX
-   int i;
-   elf_fpreg_t *reg;
-#endif
-
-   if (!tsk->thread.regs)
-   return 0;
-   flush_fp_to_thread(current);
-
-#ifdef CONFIG_VSX
-   reg = (elf_fpreg_t *)fpregs;
-   for (i = 0; i < ELF_NFPREG - 1; i++, reg++)
-   *reg = tsk->thread.TS_FPR(i);
-   memcpy(reg, &tsk->thread.fpscr, sizeof(elf_fpreg_t));
-#else
-   memcpy(fpregs, &tsk->thread.TS_FPR(0), sizeof(*fpregs));
-#endif
-
-   return 1;
-}
-
 #ifdef CONFIG_ALTIVEC
 void enable_kernel_altivec(void)
 {
@@ -161,35 +138,6 @@ void flush_altivec_to_thread(struct task
preempt_enable();
}
 }
-
-int dump_task_altivec(struct task_struct *tsk, elf_vrregset_t *vrregs)
-{
-   /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
-* separately, see below */
-   const int nregs = ELF_NVRREG - 2;
-   elf_vrreg_t *reg;
-   u32 *dest;
-
-   if (tsk == current)
-   flush_altivec_to_thread(tsk);
-
-   reg = (elf_vrreg_t *)vrregs;
-
-   /* copy the 32 vr registers */
-   memcpy(reg, &tsk->thread.vr[0], nregs * sizeof(*reg));
-   reg += nregs;
-
-   /* copy the vscr */
-   memcpy(reg, &tsk->thread.vscr, sizeof(*reg));
-   reg++;
-
-   /* vrsave is stored in the high 32bit slot of the final 128bits */
-   memset(reg, 0, sizeof(*reg));
-   dest = (u32 *)reg;
-   *dest = tsk->thread.vrsave;
-
-   return 1;
-}
 #endif /* CONFIG_ALTIVEC */
 
 #ifdef CONFIG_VSX
@@ -224,29 +172,6 @@ void flush_vsx_to_thread(struct task_str
preempt_enable();
}
 }
-
-/*
- * This dumps the lower half 64bits of the first 32 VSX registers.
- * This needs to be called with dump_task_fp and dump_task_altivec to
- * get all the VSX state.
- */
-int dump_task_vsx(struct task_struct *tsk, elf_vrreg_t *vrregs)
-{
-   elf_vrreg_t *reg;
-   double buf[32];
-   int i;
-
-   if (tsk == current)
-   flush_vsx_to_thread(tsk);
-
-   reg = (elf_vrreg_t *)vrregs;
-
-   for (i = 0; i < 32 ; i++)
-   buf[i] = current->thread.fpr[i][TS_VSRLOWOFFSET];
-   memcpy(reg, buf, sizeof(buf));
-
-   return 1;
-}
 #endif /* CONFIG_VSX */
 
 #ifdef CONFIG_SPE
@@ -279,14 +204,6 @@ void flush_spe_to_thread(struct task_str
preempt_enable();
}
 }
-
-int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
-{
-   flush_spe_to_thread(current);
-   /* We copy u32 evr[32] + u64 acc + u32 spefscr -> 35 */
-   memcpy(evrregs, ¤t->thread.evr[0], sizeof(u32) * 35);
-   return 1;
-}
 #endif /* CONFIG_SPE */
 
 #ifndef CONFIG_SMP
Index: linux-2.6-ozlabs/include/asm-powerpc/elf.h
===
--- linux-2.6-ozlabs.orig/include/asm-powerpc/elf.h
+++ linux-2.6-ozlabs/include/asm-powerpc/elf.h
@@ -204,28 +204,8 @@ static inline void ppc_elf_core_copy_reg
 }
 #define ELF_CORE_COPY_REGS(gregs, regs) ppc_elf_core_copy_regs(gregs, regs);
 
-static inline int dump_task_regs(struct task_struct *tsk,
-elf_gregset_t *elf_regs)
-{
-   struct pt_regs *regs = tsk->thread.regs;
-   if (regs)
-   ppc_elf_core_copy_regs(*elf_regs, regs);
-
-   return 1;
-}
-#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
-
-extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); 
-#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
-
 typedef elf_vrregset_t elf_fpxregset_t;
 
-#ifdef CONFIG_ALTIVEC
-extern int dump_task_altivec(struct task_struct *, elf_vrregset_t *vrregs);
-#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_altivec(tsk, regs)
-#define ELF_CORE_XFPREG_TYPE NT_PPC_VMX
-#endif
-
 /* ELF_HWCAP yields a mask that user programs can use to figure out what
instruction set this cpu supports.  This could be done in userspace,
but it's not easy, and we've already done it here.  */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH]: [MPC5200] (v2) Add ATA DMA support

2008-07-02 Thread Tim Yamin
Hi Grant,

Thanks for the feedback. New version is attached.

> Is this a bug fix?  If so, please put it into a separate patch.

I suppose so, yes. If Ethernet has higher priority than ATA, you can
get a deadlock if you try and download a large file over a LAN to
disk, for example. But given that nothing other than this patch uses
BestComm for ATA do you have any specific reason to split it out into
another patch?

> Good, it can be turned off.  Do you think there is any risk to existing
> ATA users with this patch applied if this is turned off?

With the new version, the only risk if this is turned off is the
change I've made to bestcomm.h. Other than that, you should get no
risk because none of the new
code is executed (mwdma_mask and udma_mask are set to 0 if the option
is turned off).

> Can you find any way to avoid this?  This could be a performance drain.

Previous code had this, so I kept it. Things do seem to work OK
without it, so I've removed it...

> Is there any way to turn on/off DMA at runtime instead of CONFIG time?

You could use libata.dma=0 to force DMA off even if it's enabled at CONFIG time.

>>   priv->ipb_period = 10 / (ipb_freq / 1000);
>>   priv->ata_regs = ata_regs;
>> + priv->ata_regs_pa = (struct mpc52xx_ata __iomem *) res_mem.start;
>
> I'm not fond of this.  First off, it is *not* __iomem.  It is physical
> address.  It would be better to use the offset_of macro to add an offset
> to the physical base address.  Doing it this way forces you to cast and
> sidestep the compile time checks for incorrect dereferences.

I'm afraid I'm not quite sure what you have in mind here, could you
please provide a pointer?

Thanks,

Tim
This patch adds MDMA/UDMA support (using BestComm for DMA) on the MPC5200
platform.

Based heavily on previous work by Freescale (Bernard Kuhn, John Rigby)
and Domen Puncer.

Using a SanDisk Extreme IV CF card I get read speeds of approximately
26.70 MB/sec.

The BestComm ATA task priority was changed to maximum in bestcomm_priv.h;
this fixes a deadlock issue I was experiencing when heavy DMA was
occuring on both the ATA and Ethernet BestComm tasks, e.g. when
downloading a large file over a LAN to disk.

There's also what I believe to be a hardware bug if you have high levels
of BestComm ATA DMA activity along with heavy LocalPlus Bus activity;
the address bus seems to sometimes get corrupted with ATA commands while
the LocalPlus Bus operation is still active (i.e. Chip Select is asserted).

I've asked Freescale about this but have not received a reply yet -- if
anybody from Freescale has any ideas please contact me; I can supply some
analyzer traces if needed. Therefore, for now, do not enable DMA if you
need reliable LocalPlus Bus unless you do a fixup in your driver as
follows:

Locking example:

while (test_and_set_bit(0, &pata_mpc52xx_ata_dma_lock) != 0)
{
struct bcom_task_2 *tsk = pata_mpc52xx_ata_dma_task;

if(bcom_buffer_done_2(tsk))
return 1;
}

	return 0;

(Save the return value to `flags`)

Unlocking example:

if(flags == 0)
clear_bit(0, &pata_mpc52xx_ata_dma_lock);

Comments and testing would of course be very welcome.

Thanks,

Signed-off-by: Tim Yamin <[EMAIL PROTECTED]>

diff -urp linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/ata.h linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/ata.h
--- linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/ata.h	2008-04-17 03:49:44.0 +0100
+++ linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/ata.h	2008-07-02 12:48:14.0 +0100
@@ -16,8 +16,8 @@
 
 struct bcom_ata_bd {
 	u32	status;
-	u32	dst_pa;
 	u32	src_pa;
+	u32	dst_pa;
 };
 
 extern struct bcom_task *
diff -urp linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/bestcomm.c linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/bestcomm.c
--- linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/bestcomm.c	2008-04-17 03:49:44.0 +0100
+++ linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/bestcomm.c	2008-07-02 12:48:14.0 +0100
@@ -330,11 +330,16 @@ bcom_engine_init(void)
 	/* Init 'always' initiator */
 	out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_ALWAYS], BCOM_IPR_ALWAYS);
 
+	/* If ATA DMA is enabled, always turn prefetch off (it breaks things) */
+#ifndef CONFIG_PATA_MPC52xx_DMA
 	/* Disable COMM Bus Prefetch on the original 5200; it's broken */
 	if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR) {
+#endif
 		regval = in_be16(&bcom_eng->regs->PtdCntrl);
 		out_be16(&bcom_eng->regs->PtdCntrl,  regval | 1);
+#ifndef CONFIG_PATA_MPC52xx_DMA
 	}
+#endif
 
 	/* Init lock */
 	spin_lock_init(&bcom_eng->lock);
diff -urp linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/bestcomm.h linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/bestcomm.h
--- linux-2.6.26-rc6/arch/powerpc/sysdev/bestcomm/bestcomm.h	2008-04-17 03:49:44.0 +0100
+++ linux-2.6.26-rc6-ata/arch/powerpc/sysdev/bestcomm/bestcomm.h	2008-07-02 12:48:14.0 +0100
@

[git pull] Please pull powerpc.git merge branch

2008-07-02 Thread Paul Mackerras
Linus,

Please pull from the 'merge' branch of

git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git merge

to get two more small bug-fixes for powerpc, as listed below.

Thanks,
Paul.

 arch/powerpc/boot/Makefile  |3 ++-
 arch/powerpc/kernel/legacy_serial.c |5 +
 2 files changed, 7 insertions(+), 1 deletions(-)

John Linn (2):
  powerpc/bootwrapper: update for initrd with simpleImage
  powerpc/legacy_serial: Bail if reg-offset/shift properties are present

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


Re: Commits added to powerpc.git master and powerpc-next branches

2008-07-02 Thread Jochen Friedrich
Hi Kumar,

>> any chance to get this one into 2.6.27?
>>
>> [POWERPC] Add i2c pins to dts and board setup
>>  http://patchwork.ozlabs.org/linuxppc/patch?person=1023&id=18603
> 
> Will we always want defconfig updates to enable the driver?

Good question. Maybe not, as the i2c bus seems to be unused on these
boards unless someone connects some i2c devices.

I'll resubmit just the booting-without-of part then.

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


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-02 Thread Liam Girdwood
On Tue, 2008-07-01 at 17:53 -0600, Grant Likely wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
> 
> ASoC Codec driver for the TLV320AIC26 device.  This driver uses the ASoC
> v1 API, so I don't expect it to get merged as-is, but I want to get it
> out there for review.
> ---
> 
>  sound/soc/codecs/Kconfig   |4 
>  sound/soc/codecs/Makefile  |2 
>  sound/soc/codecs/tlv320aic26.c |  630 
> 
>  3 files changed, 636 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> index 3903ab7..96c7bfe 100644
> --- a/sound/soc/codecs/Kconfig
> +++ b/sound/soc/codecs/Kconfig
> @@ -41,6 +41,10 @@ config SND_SOC_CS4270_VD33_ERRATA
>   bool
>   depends on SND_SOC_CS4270
>  
> +config SND_SOC_TLV320AIC26
> + tristate "TI TLB320AIC26 Codec support"
> + depends on SND_SOC && SPI
> +
>  config SND_SOC_TLV320AIC3X
>   tristate
>   depends on SND_SOC && I2C
> diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
> index 4e1314c..ec0cd93 100644
> --- a/sound/soc/codecs/Makefile
> +++ b/sound/soc/codecs/Makefile
> @@ -5,6 +5,7 @@ snd-soc-wm8753-objs := wm8753.o
>  snd-soc-wm9712-objs := wm9712.o
>  snd-soc-wm9713-objs := wm9713.o
>  snd-soc-cs4270-objs := cs4270.o
> +snd-soc-tlv320aic26-objs := tlv320aic26.o
>  snd-soc-tlv320aic3x-objs := tlv320aic3x.o
>  
>  obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o
> @@ -14,4 +15,5 @@ obj-$(CONFIG_SND_SOC_WM8753)+= snd-soc-wm8753.o
>  obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o
>  obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
>  obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o
> +obj-$(CONFIG_SND_SOC_TLV320AIC26)+= snd-soc-tlv320aic26.o
>  obj-$(CONFIG_SND_SOC_TLV320AIC3X)+= snd-soc-tlv320aic3x.o
> diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
> new file mode 100644
> index 000..aee1dbc
> --- /dev/null
> +++ b/sound/soc/codecs/tlv320aic26.c
> @@ -0,0 +1,630 @@
> +/*
> + * Texas Instruments TLV320AIC26 low power audio CODEC
> + * ALSA SoC CODEC driver
> + *
> + * Copyright (C) 2008 Secret Lab Technologies Ltd.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +MODULE_DESCRIPTION("ASoC TLV320AIC26 codec driver");
> +MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
> +MODULE_LICENSE("GPL");
> +
> +/* AIC26 Registers */
> +#define AIC26_READ_COMMAND_WORD(addr)((1 << 15) | (addr << 5))
> +#define AIC26_WRITE_COMMAND_WORD(addr)   ((0 << 15) | (addr << 5))
> +#define AIC26_PAGE_ADDR(page, offset)((page << 6) | offset)
> +#define AIC26_NUM_REGS   AIC26_PAGE_ADDR(3, 0)
> +#define AIC26_REG_CACHE_SIZE (0x20) /* only page 2 cached */
> +#define AIC26_REG_IS_CACHED(addr)((addr & ~0x1f) == (2 << 6))
> +#define AIC26_REG_CACHE_ADDR(addr)   (addr & 0x1f)
> +
> +/* Page 0: Auxillary data registers */
> +#define AIC26_REG_BAT1   AIC26_PAGE_ADDR(0, 0x05)
> +#define AIC26_REG_BAT2   AIC26_PAGE_ADDR(0, 0x06)
> +#define AIC26_REG_AUXAIC26_PAGE_ADDR(0, 0x07)
> +#define AIC26_REG_TEMP1  AIC26_PAGE_ADDR(0, 0x09)
> +#define AIC26_REG_TEMP2  AIC26_PAGE_ADDR(0, 0x0A)
> +
> +/* Page 1: Auxillary control registers */
> +#define AIC26_REG_AUX_ADCAIC26_PAGE_ADDR(1, 0x00)
> +#define AIC26_REG_STATUS AIC26_PAGE_ADDR(1, 0x01)
> +#define AIC26_REG_REFERENCE  AIC26_PAGE_ADDR(1, 0x03)
> +#define AIC26_REG_RESET  AIC26_PAGE_ADDR(1, 0x04)
> +
> +/* Page 2: Audio control registers */
> +#define AIC26_REG_AUDIO_CTRL1AIC26_PAGE_ADDR(2, 0x00)
> +#define AIC26_REG_ADC_GAIN   AIC26_PAGE_ADDR(2, 0x01)
> +#define AIC26_REG_DAC_GAIN   AIC26_PAGE_ADDR(2, 0x02)
> +#define AIC26_REG_SIDETONE   AIC26_PAGE_ADDR(2, 0x03)
> +#define AIC26_REG_AUDIO_CTRL2AIC26_PAGE_ADDR(2, 0x04)
> +#define AIC26_REG_POWER_CTRL AIC26_PAGE_ADDR(2, 0x05)
> +#define AIC26_REG_AUDIO_CTRL3AIC26_PAGE_ADDR(2, 0x06)
> +
> +#define AIC26_REG_FILTER_COEFF_L_N0  AIC26_PAGE_ADDR(2, 0x07)
> +#define AIC26_REG_FILTER_COEFF_L_N1  AIC26_PAGE_ADDR(2, 0x08)
> +#define AIC26_REG_FILTER_COEFF_L_N2  AIC26_PAGE_ADDR(2, 0x09)
> +#define AIC26_REG_FILTER_COEFF_L_N3  AIC26_PAGE_ADDR(2, 0x0A)
> +#define AIC26_REG_FILTER_COEFF_L_N4  AIC26_PAGE_ADDR(2, 0x0B)
> +#define AIC26_REG_FILTER_COEFF_L_N5  AIC26_PAGE_ADDR(2, 0x0C)
> +#define AIC26_REG_FILTER_COEFF_L_D1  AIC26_PAGE_ADDR(2, 0x0D)
> +#define AIC26_REG_FILTER_COEFF_L_D2  AIC26_PAGE_ADDR(2, 0x0E)
> +#define AIC26_REG_FILTER_COEFF_L_D4  AIC26_PAGE_ADDR(2, 0x0F)
> +#define AIC26_REG_FILTER_COEFF_L_D5  AIC26_PAGE_ADDR(2, 0x10)
> +#define AIC26_REG_FILTER_COEFF_R_N0  AIC26_PAGE_ADDR(2, 0x11)
> +

Re: [alsa-devel] [PATCH 2/3] ALSA SoC: Add mpc5200-psc I2S driver

2008-07-02 Thread Liam Girdwood
On Tue, 2008-07-01 at 17:53 -0600, Grant Likely wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
> 
> This is an I2S bus driver for the MPC5200 PSC device.  It is probably
> will not be merged as-is because it uses v1 of the ASoC API, but I want
> to get it out there for comments.

Looks good, just minor comments.

> ---
> 
>  sound/soc/fsl/Kconfig   |6 
>  sound/soc/fsl/Makefile  |2 
>  sound/soc/fsl/mpc5200_psc_i2s.c |  899 
> +++
>  3 files changed, 907 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
> index 257101f..5daa8d3 100644
> --- a/sound/soc/fsl/Kconfig
> +++ b/sound/soc/fsl/Kconfig
> @@ -17,4 +17,10 @@ config SND_SOC_MPC8610_HPCD
>   help
> Say Y if you want to enable audio on the Freescale MPC8610 HPCD.
>  
> +config SND_SOC_MPC5200_I2S
> + bool "Freescale MPC5200 PSC in I2S mode driver"

Is this built-in only ?

> + depends on SND_SOC && PPC_MPC52xx
> + help
> +   Say Y here to support the MPC5200 PSCs in I2S mode.
> +
>  endmenu
> diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
> index 62f680a..98729a1 100644
> --- a/sound/soc/fsl/Makefile
> +++ b/sound/soc/fsl/Makefile
> @@ -4,3 +4,5 @@ obj-$(CONFIG_SND_SOC_MPC8610_HPCD) += mpc8610_hpcd.o
>  # MPC8610 Platform Support
>  obj-$(CONFIG_SND_SOC_MPC8610) += fsl_ssi.o fsl_dma.o
>  
> +obj-$(CONFIG_SND_SOC_MPC5200_I2S) += mpc5200_psc_i2s.o
> +
> diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
> new file mode 100644
> index 000..81d0933
> --- /dev/null
> +++ b/sound/soc/fsl/mpc5200_psc_i2s.c
> @@ -0,0 +1,899 @@
> +/*
> + * Freescale MPC5200 PSC in I2S mode
> + * ALSA SoC Digital Audio Interface (DAI) driver
> + *
> + * Copyright (C) 2008 Secret Lab Technologies Ltd.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
> +MODULE_DESCRIPTION("Freescale MPC5200 PSC in I2S mode ASoC Driver");
> +MODULE_LICENSE("GPL");
> +
> +/**
> + * PSC_I2S_RATES: sample rates supported by the I2S
> + *
> + * This driver currently only supports the PSC running in I2S slave mode,
> + * which means the codec determines the sample rate.  Therefore, we tell
> + * ALSA that we support all rates and let the codec driver decide what rates
> + * are really supported.
> + */
> +#define PSC_I2S_RATES (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_192000 | \
> + SNDRV_PCM_RATE_CONTINUOUS)
> +
> +/**
> + * PSC_I2S_FORMATS: audio formats supported by the PSC I2S mode
> + */
> +#define PSC_I2S_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE | \
> +  SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S24_BE | \
> +  SNDRV_PCM_FMTBIT_S32_BE)
> +
> +/**
> + * psc_i2s_stream - Data specific to a single stream (playback or capture)
> + * @active:  flag indicating if the stream is active
> + * @psc_i2s: pointer back to parent psc_i2s data structure
> + * @bcom_task:   bestcomm task structure
> + * @irq: irq number for bestcomm task
> + * @period_start:physical address of start of DMA region
> + * @period_end:  physical address of end of DMA region
> + * @period_next_pt:  physical address of next DMA buffer to enqueue
> + * @period_bytes:size of DMA period in bytes
> + */
> +struct psc_i2s_stream {
> + int active;
> + struct psc_i2s *psc_i2s;
> + struct bcom_task *bcom_task;
> + int irq;
> + struct snd_pcm_substream *stream;
> + dma_addr_t period_start;
> + dma_addr_t period_end;
> + dma_addr_t period_next_pt;
> + dma_addr_t period_current_pt;
> + int period_bytes;
> +};
> +
> +/**
> + * psc_i2s - Private driver data
> + * @name: short name for this device ("PSC0", "PSC1", etc)
> + * @psc_regs: pointer to the PSC's registers
> + * @fifo_regs: pointer to the PSC's FIFO registers
> + * @irq: IRQ of this PSC
> + * @dev: struct device pointer
> + * @playback: the number of playback streams opened
> + * @capture: the number of capture streams opened
> + * @dai: the CPU DAI for this device
> + * @playback_stream: Playback stream context data
> + * @capture_stream: Capture stream context data
> + */
> +struct psc_i2s {
> + char name[32];
> + struct mpc52xx_psc __iomem *psc_regs;
> + struct mpc52xx_psc_fifo __iomem *fifo_regs;
> + unsigned int irq;
> + struct device *dev;
> + struct snd_soc_cpu_dai dai;
> + spinlock_t lock;
> +
> + /* per-stream data */
> + struct psc_i2s_stream playback_stream;
> + struct psc_i2s_stream capture_stream;
> +
> + /* Statistics */
> + struct {
> + int overrun_count;
> + int underrun_count;
> + } stats;
> +};
> +
> +/*
>

[PATCH] [POWERPC] 52xx: add missing MSCAN FDT nodes for TQM52xx

2008-07-02 Thread Wolfgang Grandegger

This patch adds the still missing FDT nodes for the MSCAN devices for
the TQM52xx modules.

Signed-off-by: Wolfgang Grandegger <[EMAIL PROTECTED]>
---
arch/powerpc/boot/dts/tqm5200.dts |   16 
1 file changed, 16 insertions(+)

Index: linux-2.6-galak/arch/powerpc/boot/dts/tqm5200.dts
===
--- linux-2.6-galak.orig/arch/powerpc/boot/dts/tqm5200.dts
+++ linux-2.6-galak/arch/powerpc/boot/dts/tqm5200.dts
@@ -70,6 +70,22 @@
fsl,has-wdt;
};

+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc5200-mscan";
+   cell-index = <0>;
+   interrupts = <2 17 0>;
+   interrupt-parent = <&mpc5200_pic>;
+   reg = <0x900 0x80>;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc5200-mscan";
+   cell-index = <1>;
+   interrupts = <2 18 0>;
+   interrupt-parent = <&mpc5200_pic>;
+   reg = <0x980 0x80>;
+   };
+
[EMAIL PROTECTED] {
compatible = "fsl,mpc5200-gpio";
reg = <0xb00 0x40>;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers

2008-07-02 Thread Takashi Iwai
At Tue, 01 Jul 2008 17:53:30 -0600,
Grant Likely wrote:
> diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
> index 18f28ac..c5736e5 100644
> --- a/sound/soc/Kconfig
> +++ b/sound/soc/Kconfig
> @@ -23,6 +23,12 @@ config SND_SOC
> This ASoC audio support can also be built as a module.  If so, the 
> module
> will be called snd-soc-core.
>  
> +config SND_SOC_OF
> + tristate "OF helpers for SoC audio support"
> + depends on SND_SOC
> + ---help---
> +   Add support for OpenFirmware device tree descriptions of sound device
> +

This is a helper module and not necessarily manually selectable.
Better to make the other driver selecting this.


> diff --git a/sound/soc/soc-of.c b/sound/soc/soc-of.c
> new file mode 100644
> index 000..9694979
> --- /dev/null
> +++ b/sound/soc/soc-of.c
(snip)
> +DEFINE_MUTEX(of_snd_soc_mutex);
> +LIST_HEAD(of_snd_soc_device_list);

Missing static.


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


Re: [PATCH] powerpc/mpc5200: Fix lite5200b suspend/resume

2008-07-02 Thread Tim Yamin
Hi Grant,

This patch works fine for me.

Cheers,

Tim

On Tue, Jul 1, 2008 at 10:12 PM, Grant Likely <[EMAIL PROTECTED]> wrote:
> From: Tim Yamin <[EMAIL PROTECTED]>
>
> Suspend/resume ("echo mem > /sys/power/state") does not work with
> vanilla kernels -- the system does not suspend correctly and just
> hangs. This patch fixes this so suspend/resume works:
>
> 1) of_iomap does not map the whole 0xC000 of the MPC5200 immr so
> saving registers does not work.
> 2) PCI registers need to be saved and restored.
>
> Signed-off-by: Tim Yamin <[EMAIL PROTECTED]>
> Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
> ---
>
> Tim, please test this version.  I fixed a couple of bugs and want to make
> sure I haven't broken anything.  Once you ack it I'll ask Paul to pull it
> into 2.6.26.
>
> g.
>
>  arch/powerpc/platforms/52xx/lite5200_pm.c |   14 +-
>  1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c 
> b/arch/powerpc/platforms/52xx/lite5200_pm.c
> index 41c7fd9..fe92e65 100644
> --- a/arch/powerpc/platforms/52xx/lite5200_pm.c
> +++ b/arch/powerpc/platforms/52xx/lite5200_pm.c
> @@ -14,6 +14,7 @@ static struct mpc52xx_sdma __iomem *bes;
>  static struct mpc52xx_xlb __iomem *xlb;
>  static struct mpc52xx_gpio __iomem *gps;
>  static struct mpc52xx_gpio_wkup __iomem *gpw;
> +static void __iomem *pci;
>  static void __iomem *sram;
>  static const int sram_size = 0x4000;   /* 16 kBytes */
>  static void __iomem *mbar;
> @@ -50,6 +51,8 @@ static int lite5200_pm_prepare(void)
>{ .type = "builtin", .compatible = "mpc5200", }, /* efika */
>{}
>};
> +   u64 regaddr64 = 0;
> +   const u32 *regaddr_p;
>
>/* deep sleep? let mpc52xx code handle that */
>if (lite5200_pm_target_state == PM_SUSPEND_STANDBY)
> @@ -60,8 +63,12 @@ static int lite5200_pm_prepare(void)
>
>/* map registers */
>np = of_find_matching_node(NULL, immr_ids);
> -   mbar = of_iomap(np, 0);
> +   regaddr_p = of_get_address(np, 0, NULL, NULL);
> +   if (regaddr_p)
> +   regaddr64 = of_translate_address(np, regaddr_p);
>of_node_put(np);
> +
> +   mbar = ioremap((u32) regaddr64, 0xC000);
>if (!mbar) {
>printk(KERN_ERR "%s:%i Error mapping registers\n", __func__, 
> __LINE__);
>return -ENOSYS;
> @@ -71,6 +78,7 @@ static int lite5200_pm_prepare(void)
>pic = mbar + 0x500;
>gps = mbar + 0xb00;
>gpw = mbar + 0xc00;
> +   pci = mbar + 0xd00;
>bes = mbar + 0x1200;
>xlb = mbar + 0x1f00;
>sram = mbar + 0x8000;
> @@ -85,6 +93,7 @@ static struct mpc52xx_sdma sbes;
>  static struct mpc52xx_xlb sxlb;
>  static struct mpc52xx_gpio sgps;
>  static struct mpc52xx_gpio_wkup sgpw;
> +static char spci[0x200];
>
>  static void lite5200_save_regs(void)
>  {
> @@ -94,6 +103,7 @@ static void lite5200_save_regs(void)
>_memcpy_fromio(&sxlb, xlb, sizeof(*xlb));
>_memcpy_fromio(&sgps, gps, sizeof(*gps));
>_memcpy_fromio(&sgpw, gpw, sizeof(*gpw));
> +   _memcpy_fromio(spci, pci, 0x200);
>
>_memcpy_fromio(saved_sram, sram, sram_size);
>  }
> @@ -103,6 +113,8 @@ static void lite5200_restore_regs(void)
>int i;
>_memcpy_toio(sram, saved_sram, sram_size);
>
> +   /* PCI Configuration */
> +   _memcpy_toio(pci, spci, 0x200);
>
>/*
> * GPIOs. Interrupt Master Enable has higher address then other
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2 1/2] powerpc: Fix building of feature-fixup tests on ppc32

2008-07-02 Thread Michael Ellerman
On Tue, 2008-07-01 at 10:16 -0500, Kumar Gala wrote:
> We need to use PPC_LCMPI otherwise we get compile errors like:
> 
> arch/powerpc/lib/feature-fixups-test.S: Assembler messages:
> arch/powerpc/lib/feature-fixups-test.S:142: Error: Unrecognized opcode: 
> `cmpdi'
> arch/powerpc/lib/feature-fixups-test.S:149: Error: Unrecognized opcode: 
> `cmpdi'
> arch/powerpc/lib/feature-fixups-test.S:164: Error: Unrecognized opcode: 
> `cmpdi'

Sorry, I definitely built (and booted) a 32-bit config, so I'm not sure
how I missed that. What toolchain are you using?

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH] powerpc: fixup lwsync at runtime

2008-07-02 Thread Michael Ellerman
On Tue, 2008-07-01 at 09:48 -0500, Kumar Gala wrote:
> On Jul 1, 2008, at 1:29 AM, Michael Ellerman wrote:

> >> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/ 
> >> setup_32.c
> >> index 9e83add..0109e7f 100644
> >> --- a/arch/powerpc/kernel/setup_32.c
> >> +++ b/arch/powerpc/kernel/setup_32.c
> >> @@ -101,6 +101,10 @@ unsigned long __init early_init(unsigned long  
> >> dt_ptr)
> >>  PTRRELOC(&__start___ftr_fixup),
> >>  PTRRELOC(&__stop___ftr_fixup));
> >>
> >> +  do_lwsync_fixups(spec->cpu_features,
> >> +   PTRRELOC(&__start___lwsync_fixup),
> >> +   PTRRELOC(&__stop___lwsync_fixup));
> >> +
> >
> > This could be changed to use cur_cpu_spec->cpu_features, and then all
> > the call sites would be passing that, which would mean
> > do_lwsync_fixups() could just check cur_cpu_spec->cpu_features  
> > directly.
> 
> cur_cpu_spec and spec at this point arent the same thing.

Aren't they? I must be missing something:

struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
{
struct cpu_spec *s = cpu_specs;
struct cpu_spec *t = &the_cpu_spec;
int i;

for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
if ((pvr & s->pvr_mask) == s->pvr_value) {
...
*t = *s;
*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
...
return s;

then:

unsigned long __init early_init(unsigned long dt_ptr)
{
...
spec = identify_cpu(offset, mfspr(SPRN_PVR));

do_feature_fixups(spec->cpu_features,
  PTRRELOC(&__start___ftr_fixup),
  PTRRELOC(&__stop___ftr_fixup));
}


cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: patches for 2.6.27... (Kumar Gala)

2008-07-02 Thread Heiko Schocher
Hello Kumar,

On Wednesday 02 July 2008, Kumar Gala wrote:
> Please point out any patches that have been posted but havent made it
> into a git tree related to Freescale chips.

Here are 2 patches that I'd like to see in 2.6.27. They haven't made into
any git tree as far as I know.

http://ozlabs.org/pipermail/linuxppc-dev/2008-June/058118.html

http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057972.html

thanks.
bye
Heiko
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCHv2] cpm_uart: Support uart_wait_until_sent()

2008-07-02 Thread Laurent Pinchart
Set port->fifosize to the software FIFO size, and update the port timeout
when the baud rate is modified. SCC ports have an optional 32 byte hardware
FIFO which is currently not taken into account, as there is no documented way
to check when the FIFO becomes empty.

Signed-off-by: Laurent Pinchart <[EMAIL PROTECTED]>
---
 drivers/serial/cpm_uart/cpm_uart_core.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index a19dc7e..151cad2 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -608,6 +608,11 @@ static void cpm_uart_set_termios(struct uart_port *port,
}
 
/*
+* Update the timeout
+*/
+   uart_update_timeout(port, termios->c_cflag, baud);
+
+   /*
 * Set up parity check flag
 */
 #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
@@ -1068,6 +1073,7 @@ int cpm_uart_drv_get_platform_data(struct platform_device 
*pdev, int is_con)
pinfo->port.type = PORT_CPM;
pinfo->port.ops = &cpm_uart_pops,
pinfo->port.iotype = UPIO_MEM;
+   pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize;
spin_lock_init(&pinfo->port.lock);
 
pinfo->port.irq = of_irq_to_resource(np, 0, NULL);
-- 
1.5.0

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Commits added to powerpc.git master and powerpc-next branches

2008-07-02 Thread Laurent Pinchart
On Wednesday 02 July 2008, Kumar Gala wrote:
> 
> On Jul 1, 2008, at 3:49 AM, Laurent Pinchart wrote:
> 
> > Hi Paul,
> >
> > On Tuesday 01 July 2008, Paul Mackerras wrote:
> >> The following commits have been added to the master and powerpc-next
> >> branches of the powerpc.git repository.  This includes patches pulled
> >> from Kumar's and Josh's trees.
> >
> > Any change of getting the following patches into 2.6.27 ? They have  
> > either been acked and not picked, or just ignored so far :-/
> >
> > [PATCHv2] fs_enet: restore promiscuous and multicast settings in  
> > restart()
> > http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=19228
> 
> Should go via netdev unless jgarizk says otherwise

On 2008-06-18, Jeff wrote:

"My general rule is, anytime I see 80%+ of the patch dealing with 
arch-specific API functions (such as OF resource stuff), I tend to 
prefer that goes via an arch tree.

If it's a networking change, of course I'd prefer it came in my direction."

Jeff, could you please tell us if you want to pick this one or if it should go 
through the powerpc tree ? The patch has been posted to both the linuxppc-dev 
and netdev lists, and I haven't received any comment from the netdev folks.

> > [PATCH 2/2] fs_enet: MDIO on GPIO support
> > http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=18693
> 
> ditto

Jeff, same question :-)

> > [PATCHv3 1/2] [POWERPC] CPM2: Implement GPIO LIB API on CPM2  
> > Freescale SoC.
> > http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=19045
> 
> I'll look at this one

Thanks.

> > [PATCH] powerpc: Modem control lines support for the cpm_uart driver
> > http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=17928
> 
> this seems to depend on the previous patch.

It doesn't strictly depend on the previous one. You will need GPIO LIB API on 
CPM2 to use the modem control lines, but the cpm_uart driver will fall back to 
the current behaviour if no GPIO LIB support is present.

> > [PATCH] cpm_uart: Support uart_wait_until_sent()
> > http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=19233
> 
> 
> applied

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75


signature.asc
Description: This is a digitally signed message part.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: patches for 2.6.27...

2008-07-02 Thread Laurent Pinchart
Hi Kumar,

On Wednesday 02 July 2008, Kumar Gala wrote:
> Please point out any patches that have been posted but havent made it  
> into a git tree related to Freescale chips.
> 
> I know there are probably a slew of CPM patches that need to get into  
> the tree.

Here are 5 patches that I'd like to see in 2.6.27. They haven't made into any 
git tree as far as I know.

[PATCHv2] fs_enet: restore promiscuous and multicast settings in restart()
http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=19228
[PATCH 2/2] fs_enet: MDIO on GPIO support
http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=18693
[PATCHv3 1/2] [POWERPC] CPM2: Implement GPIO LIB API on CPM2 Freescale SoC.
http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=19045
[PATCH] powerpc: Modem control lines support for the cpm_uart driver
http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=17928
[PATCH] cpm_uart: Support uart_wait_until_sent()
http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=19233

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75


signature.asc
Description: This is a digitally signed message part.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH v3] [NAND] driver extension to support NAND on TQM85xx modules

2008-07-02 Thread Wolfgang Grandegger

Hello,

I would like to ask for the status of the patch below and the related 
ones. Any chance to get them in for 2.6.27.


TIA,

Wolfgang.

Wolfgang Grandegger wrote:

This patch extends the FSL UPM NAND driver from Anton Vorontsov to
support hardware which does not have the R/B pin of the NAND chip
connected, like the TQM8548 module:

- The OF_GPIO dependency has been removed from the Kconfig option
  because GPIO is not needed. The relevant gpio_* function are then
  stubbed out in .
 
- It re-introduces the chip-delay property to define an appropriate

  maximum delay time (tR) required for read operations. The binding
  will be documented in a separate patch.

Note: this patch is based on a patch from Anton Vorontsov aöready
  posted to this list:

  http://ozlabs.org/pipermail/linuxppc-dev/2008-April/055587.html.
  http://ozlabs.org/pipermail/linuxppc-dev/2008-May/057158.html

Signed-off-by: Wolfgang Grandegger <[EMAIL PROTECTED]>
---
 drivers/mtd/nand/Kconfig   |2 +-
 drivers/mtd/nand/fsl_upm.c |   17 +
 2 files changed, 14 insertions(+), 5 deletions(-)

Index: linux-2.6-galak/drivers/mtd/nand/Kconfig
===
--- linux-2.6-galak.orig/drivers/mtd/nand/Kconfig
+++ linux-2.6-galak/drivers/mtd/nand/Kconfig
@@ -380,7 +380,7 @@ config MTD_NAND_FSL_ELBC
 
 config MTD_NAND_FSL_UPM

tristate "Support for NAND on Freescale UPM"
-   depends on MTD_NAND && OF_GPIO && (PPC_83xx || PPC_85xx)
+   depends on MTD_NAND && (PPC_83xx || PPC_85xx)
select FSL_LBC
help
  Enables support for NAND Flash chips wired onto Freescale PowerPC
Index: linux-2.6-galak/drivers/mtd/nand/fsl_upm.c
===
--- linux-2.6-galak.orig/drivers/mtd/nand/fsl_upm.c
+++ linux-2.6-galak/drivers/mtd/nand/fsl_upm.c
@@ -13,6 +13,7 @@
 
 #include 

 #include 
+#include 
 #include 
 #include 
 #include 
@@ -36,6 +37,7 @@ struct fsl_upm_nand {
uint8_t upm_cmd_offset;
void __iomem *io_base;
int rnb_gpio;
+   int chip_delay;
 };
 
 #define to_fsl_upm_nand(mtd) container_of(mtd, struct fsl_upm_nand, mtd)

@@ -58,10 +60,11 @@ static void fun_wait_rnb(struct fsl_upm_
if (fun->rnb_gpio >= 0) {
while (--cnt && !fun_chip_ready(&fun->mtd))
cpu_relax();
+   if (!cnt)
+   dev_err(fun->dev, "tired waiting for RNB\n");
+   } else {
+   ndelay(100);
}
-
-   if (!cnt)
-   dev_err(fun->dev, "tired waiting for RNB\n");
 }
 
 static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)

@@ -129,7 +132,7 @@ static int __devinit fun_chip_init(struc
fun->chip.IO_ADDR_R = fun->io_base;
fun->chip.IO_ADDR_W = fun->io_base;
fun->chip.cmd_ctrl = fun_cmd_ctrl;
-   fun->chip.chip_delay = 50;
+   fun->chip.chip_delay = fun->chip_delay;
fun->chip.read_byte = fun_read_byte;
fun->chip.read_buf = fun_read_buf;
fun->chip.write_buf = fun_write_buf;
@@ -233,6 +236,12 @@ static int __devinit fun_probe(struct of
goto err2;
}
 
+	prop = of_get_property(ofdev->node, "chip-delay", NULL);

+   if (prop)
+   fun->chip_delay = *prop;
+   else
+   fun->chip_delay = 50;
+
fun->io_base = devm_ioremap_nocache(&ofdev->dev, io_res.start,
  io_res.end - io_res.start + 1);
if (!fun->io_base) {
___
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


patches for 2.6.27...

2008-07-02 Thread Kumar Gala
Please point out any patches that have been posted but havent made it  
into a git tree related to Freescale chips.


I know there are probably a slew of CPM patches that need to get into  
the tree.


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


Re: [PATCH 06/12] net: use linux/of_{device, platform}.h instead of asm

2008-07-02 Thread Kumar Gala


On Jun 26, 2008, at 11:58 PM, Jeff Garzik wrote:


Stephen Rothwell wrote:

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
drivers/net/fs_enet/fs_enet-main.c |2 +-
drivers/net/fs_enet/mac-scc.c  |2 +-
drivers/net/fs_enet/mii-fec.c  |2 +-
drivers/net/ibm_newemac/core.h |2 +-
drivers/net/ucc_geth.c |2 +-
drivers/net/ucc_geth_mii.c |2 +-
6 files changed, 6 insertions(+), 6 deletions(-)


ACK

I'll let a ppc person queue this



I'll pick it up (since it mainly touches fsl enet controllers) if you  
can repost it.  I seem to have lost the patch.


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


Re: [BUG] 2.6.26-rc8-git2 - kernel BUG at mm/page_alloc.c:585

2008-07-02 Thread Andrew Morton
On Wed, 02 Jul 2008 11:55:36 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> when running kernbench on powerpc box booted with the 2.6.26-rc8-git2
> kernel the machine drops to xmon with the kernel BUG
> 
> kernel BUG at mm/page_alloc.c:585!

static int bad_range(struct zone *zone, struct page *page)
{
if (page_outside_zone_boundaries(zone, page))
return 1;
if (!page_is_consistent(zone, page))
return 1;

return 0;
}

Called from

static inline void expand(struct zone *zone, struct page *page,
int low, int high, struct free_area *area,
int migratetype)
{
unsigned long size = 1 << high;

while (high > low) {
area--;
high--;
size >>= 1;
VM_BUG_ON(bad_range(zone, &page[size]));
list_add(&page[size].lru, &area->free_list[migratetype]);
area->nr_free++;
set_page_order(&page[size], high);
}
}

We goofed - we now don't know whether page_outside_zone_boundaries()
evaluated true, or if !page_is_consistent() evaluated true.  Bad us.

I'd suspect that something went wrong in powerpc land.

> cpu 0x0: Vector: 700 (Program Check) at [c000c389ed50]
> pc: c00e22ec: .__rmqueue+0x178/0x25c
> lr: c00e22ec: .__rmqueue+0x178/0x25c
> sp: c000c389efd0
>msr: 80029032
>   current = 0xc000f6e0e790
>   paca= 0xc0873480
> pid   = 3421, comm = tar
> kernel BUG at mm/page_alloc.c:585!
> enter ? for help
> [c000c389efd0] c00e22d0 .__rmqueue+0x15c/0x25c (unreliable)
> [c000c389f0a0] c00e2438 .rmqueue_bulk+0x68/0xf0
> [c000c389f170] c00e43cc .get_page_from_freelist+0x2d0/0x848
> [c000c389f2b0] c00e4abc .__alloc_pages_internal+0x12c/0x494
> [c000c389f3c0] c00e4e6c .__alloc_pages+0x1c/0x30
> [c000c389f440] c01107d8 .kmem_getpages+0x90/0x198
> [c000c389f4e0] c0111200 .fallback_alloc+0x190/0x26c
> [c000c389f5b0] c0111478 .cache_alloc_node+0x19c/0x1d0
> [c000c389f660] c0111e90 .kmem_cache_alloc+0x150/0x1f8
> [c000c389f710] d019fb50 .ext3_alloc_inode+0x2c/0x74 [ext3]
> [c000c389f790] c013725c .alloc_inode+0x58/0x278
> [c000c389f830] c01374b4 .new_inode+0x38/0xd4
> [c000c389f8d0] d0193930 .ext3_new_inode+0x90/0xc64 [ext3]
> [c000c389f9f0] d019dc28 .ext3_create+0xc4/0x16c [ext3]
> [c000c389fab0] c0127944 .vfs_create+0x12c/0x1d4
> [c000c389fb60] c012b54c .do_filp_open+0x210/0x8b4
> [c000c389fd00] c01191f8 .do_sys_open+0x80/0x144
> [c000c389fdb0] c015f5d8 .compat_sys_open+0x2c/0x44
> [c000c389fe30] c00086dc syscall_exit+0x0/0x40
> --- Exception: c00 (System Call) at 0ff0e6d4
> SP (ffd3f5a0) is in userspace
> 0:mon> r
> R00 = f0008d00   R16 = 0001
> R01 = c000c389efd0   R17 = 0044
> R02 = c07e74e0   R18 = 0001
> R03 = 0001   R19 = c0010828
> R04 = f0069000   R20 = c0010800
> R05 = 0003   R21 = c0015700
> R06 = 0008   R22 = 
> R07 =    R23 = 0001
> R08 = 1180   R24 = 0007
> R09 = f0008cff   R25 = 0007
> R10 = c0015700   R26 = 0080
> R11 = c0885df8   R27 = c0015e28
> R12 = c00010010080   R28 = f0066000
> R13 = c0873480   R29 = f0069000
> R14 = 0001   R30 = c0791ce0
> R15 = 0001   R31 = c000c389efd0
> pc  = c00e22ec .__rmqueue+0x178/0x25c
> lr  = c00e22ec .__rmqueue+0x178/0x25c
> msr = 80029032   cr  = 24000442
> ctr = 0003   xer = 2000   trap =  700
> 0:mon> u
> SLB contents of cpu 0
> 00 c800 40004f7ca3000510  1T  ESID=   c0  VSID=   4f7ca3 
> LLP:110 
> 01 d800 4000eb71b510  1T  ESID=   d0  VSID=   eb71b0 
> LLP:110 
> 11 0800 20b2b24a4d90 256M ESID=0  VSID=20b2b24a4 
> LLP:110 
> 12 f800 2bea2a039d90 256M ESID=f  VSID=2bea2a039 
> LLP:110 
> 13 4800 23b06bd10d90 256M ESID=4  VSID=23b06bd10 
> LLP:110 
> 14 1800 217220abfd90 256M ESID=1  VSID=217220abf 
> LLP:110 
> 38 f800 4000235bcc000500  1T  ESID=   f0  VSID=   235bcc 
> LLP:100 

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


Re: [PATCH] cpm_uart: Support uart_wait_until_sent()

2008-07-02 Thread Kumar Gala


On Jun 26, 2008, at 6:55 AM, Laurent Pinchart wrote:

Set port->fifosize to the software FIFO size, and update the port  
timeout
when the baud rate is modified. SCC ports have an optional 32 byte  
hardware
FIFO which is currently not taken into account, as there is no  
documented way

to check when the FIFO becomes empty.

Signed-off-by: Laurent Pinchart <[EMAIL PROTECTED]>
---
drivers/serial/cpm_uart/cpm_uart_core.c |6 ++
1 files changed, 6 insertions(+), 0 deletions(-)


I spoke to soon about being able to apply this.  Can you respin this  
against my powerpc-next tree.  Also, I had troubles applying this due  
to mailer formatting issues.


- k

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/ 
serial/cpm_uart/cpm_uart_core.c

index a19dc7e..151cad2 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -547,6 +547,11 @@ static void cpm_uart_set_termios(struct  
uart_port *port,

}

/*
+* Update the timeout
+*/
+   uart_update_timeout(port, termios->c_cflag, baud);
+
+   /*
 * Set up parity check flag
 */
#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK| 
INPCK))
@@ -1154,6 +1159,7 @@ int cpm_uart_drv_get_platform_data(struct  
platform_device *pdev, int is_con)

pinfo->port.uartclk = pdata->uart_clk;
pinfo->port.mapbase = (unsigned long)mem;
pinfo->port.irq = platform_get_irq(pdev, 0);
+   pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize;

return 0;
}
--
1.5.0

--
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75


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


Re: Commits added to powerpc.git master and powerpc-next branches

2008-07-02 Thread Kumar Gala


On Jul 1, 2008, at 10:54 AM, Jochen Friedrich wrote:


Hi Paul,

On Tuesday 01 July 2008, Paul Mackerras wrote:


The following commits have been added to the master and powerpc-next
branches of the powerpc.git repository.  This includes patches pulled
from Kumar's and Josh's trees.


Now that the I2C driver for CPM1/CPM2 boards is in the i2c tree, is  
there

any chance to get this one into 2.6.27?

[POWERPC] Add i2c pins to dts and board setup
 http://patchwork.ozlabs.org/linuxppc/patch?person=1023&id=18603


Will we always want defconfig updates to enable the driver?

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


Re: Commits added to powerpc.git master and powerpc-next branches

2008-07-02 Thread Kumar Gala


On Jul 1, 2008, at 3:49 AM, Laurent Pinchart wrote:


Hi Paul,

On Tuesday 01 July 2008, Paul Mackerras wrote:

The following commits have been added to the master and powerpc-next
branches of the powerpc.git repository.  This includes patches pulled
from Kumar's and Josh's trees.


Any change of getting the following patches into 2.6.27 ? They have  
either been acked and not picked, or just ignored so far :-/


[PATCHv2] fs_enet: restore promiscuous and multicast settings in  
restart()

http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=19228


Should go via netdev unless jgarizk says otherwise


[PATCH 2/2] fs_enet: MDIO on GPIO support
http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=18693


ditto

[PATCHv3 1/2] [POWERPC] CPM2: Implement GPIO LIB API on CPM2  
Freescale SoC.

http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=19045


I'll look at this one


[PATCH] powerpc: Modem control lines support for the cpm_uart driver
http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=17928


this seems to depend on the previous patch.


[PATCH] cpm_uart: Support uart_wait_until_sent()
http://patchwork.ozlabs.org/linuxppc/patch?person=968&id=19233



applied

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


  1   2   >