Re: [PATCH 24/28] mpc82xx: Remove a bunch of cruft that duplicates generic functionality.

2007-09-17 Thread David Gibson
On Mon, Sep 17, 2007 at 11:58:16AM -0500, Scott Wood wrote:
> m82xx_calibrate_decr(), mpc82xx_ads_show_cpuinfo(), and mpc82xx_halt() do
> anything useful beyond what the generic code does.
> 
> Signed-off-by: Scott Wood <[EMAIL PROTECTED]>

Acked-by: David Gibson <[EMAIL PROTECTED]>

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 02/28] Introduce new CPM device bindings.

2007-09-17 Thread David Gibson
On Mon, Sep 17, 2007 at 11:57:30AM -0500, Scott Wood wrote:
> This introduces a new device binding for the CPM and other devices on
> these boards.  Some of the changes include:
> 
> 1. Proper namespace scoping for Freescale compatibles and properties.
> 
> 2. Use compatible rather than things like device_type and model
> to determine which particular variant of a device is present.
> 
> 3. Give the drivers the relevant CPM command word directly, rather than
> requiring it to have a lookup table based on device-id, SCC v. SMC, and
> CPM version.
> 
> 4. Specify the CPCR and the usable DPRAM region in the CPM's reg property.
> 
> Boards that do not require the legacy bindings should select
> CONFIG_PPC_CPM_NEW_BINDING to enable the of_platform CPM devices. Once
> all existing boards are converted and tested, the config option can
> become default y to prevent new boards from using the old model.  Once
> arch/ppc is gone, the config option can be removed altogether.
> 
> Signed-off-by: Scott Wood <[EMAIL PROTECTED]>

Acked-by: David Gibson <[EMAIL PROTECTED]>

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 01/28] CPM: Change from fsl, brg-frequency to brg/clock-frequency

2007-09-17 Thread David Gibson
On Mon, Sep 17, 2007 at 11:57:28AM -0500, Scott Wood wrote:
> As suggested by David Gibson, now that we have a separate node
> for the baud rate generators, it's better to use the standard
> clock-frequency property than a cpm-node-level fsl,brg-frequency
> property.
> 
> This patch updates existing places where fsl,brg-frequency is
> used.
> 
> Signed-off-by: Scott Wood <[EMAIL PROTECTED]>

[snip]
> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
> index d028e8d..3052366 100644
> --- a/arch/powerpc/sysdev/fsl_soc.c
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -73,22 +73,26 @@ static u32 brgfreq = -1;
>  u32 get_brgfreq(void)
>  {
>   struct device_node *node;
> + const unsigned int *prop;
> + int size;
>  
>   if (brgfreq != -1)
>   return brgfreq;
>  
> - node = of_find_compatible_node(NULL, NULL, "fsl,cpm1");
> - if (!node)
> - node = of_find_compatible_node(NULL, NULL, "fsl,cpm2");
> - if (!node)
> - node = of_find_node_by_type(NULL, "cpm");
> + node = of_find_compatible_node(NULL, NULL, "fsl,cpm-brg");
>   if (node) {
> - int size;
> - const unsigned int *prop;
> + prop = of_get_property(node, "clock-frequency", &size);
> + if (prop && size == 4)
> + brgfreq = *prop;
>  
> - prop = of_get_property(node, "fsl,brg-frequency", &size);
> - if (!prop)
> - prop = of_get_property(node, "brg-frequency", &size);
> + of_node_put(node);
> + return brgfreq;
> + }
> +
> + /* Legacy device binding -- will go away when no users are left. */
> + node = of_find_node_by_type(NULL, "cpm");
> + if (node) {
> + prop = of_get_property(node, "brg-frequency", &size);

Shouldn't you check for "fsl,brg-frequency" here, in case of old
device trees?

>   if (prop && size == 4)
>   brgfreq = *prop;
>  

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 0/7] MPC52xx Bestcomm submission for 2.6.24

2007-09-17 Thread tnt
> On 9/16/07, Sylvain Munaut <[EMAIL PROTECTED]> wrote:
>> Hello Paul, Hi everyone,
>>
>> This series of patch is mainly the bestcomm support for
>> the mpc5200. It was posted a while ago and received some
>> comments. Theses are all addressed here (afaik).
>
> Does this series supersede these pacthes out of your older series?

Yes.
Those are the patches I wrote to fix the comments received last time.
They are now merged inside the main patches.

Apparently I forgot to fix some other comments so I'll have to do
that and repost again.


Sylvain

>
> 0010-powerpc-In-rheap.c-move-the-EXPORT_SYMBOL-and-use.patch
> 0011-powerpc-BestComm-move-the-EXPORT_SYMBOL-and-use-th.patch
> 0012-powerpc-BestComm-ATA-task-move-the-EXPORT_SYMBOL-a.patch
> 0013-powerpc-BestComm-FEC-task-move-the-EXPORT_SYMBOL-a.patch
> 0014-powerpc-BestComm-GenBD-task-move-the-EXPORT_SYMBOL.patch
> 0015-powerpc-BestComm-Replace-global-variable-bcom-by-b.patch
> 0016-powerpc-Make-the-BestComm-driver-a-standard-of_plat.patch
> 0017-powerpc-Fix-typo-in-BestComm-ATA-task-support-code.patch
> 0018-powerpc-BestComm-ATA-task-microcode-insert-copyri.patch
> 0019-powerpc-BestComm-FEC-task-microcode-insert-copyri.patch
> 0020-powerpc-BestComm-GenBD-task-microcode-insert-copy.patch
> 0021-powerpc-Fix-errors-in-bcom-bcom_eng-renaming.patch
>
>
>
> --
> Jon Smirl
> [EMAIL PROTECTED]
>
>


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


Re: [PATCH 1/3] usb: add device-tree-aware ehci driver

2007-09-17 Thread David Gibson
On Tue, Sep 18, 2007 at 02:26:06PM +1000, Stephen Rothwell wrote:
> On Mon, 17 Sep 2007 22:17:15 +0400 Valentine Barshak <[EMAIL PROTECTED]> 
> wrote:
> >
> > Looks like we'll need a patch that replaces asm/prom.h and 
> > asm/of_platform.h with linux/of.h and linux/of_platform.h
> > in other drivers.
> 
> Yeah, but at the moment I am just stopping the infection spreading
> :-)

Patching the existing instances would probably help with that, since
it would mean less bad examples for people to copy.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


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

Re: [PATCH] [POWERPC] Support setting affinity for U3/U4 MSI sources

2007-09-17 Thread Benjamin Herrenschmidt
On Mon, 2007-09-17 at 15:12 -0500, Olof Johansson wrote:
> Hook up affinity-setting for U3/U4 MSI interrupt sources.
> 
> Tested on Quad G5 with myri10ge.
> 
> 
> Signed-off-by: Olof Johansson <[EMAIL PROTECTED]>

Acked-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>

> 
> diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> index 8de29f2..22600fd 100644
> --- a/arch/powerpc/sysdev/mpic.c
> +++ b/arch/powerpc/sysdev/mpic.c
> @@ -768,7 +768,7 @@ static void mpic_end_ipi(unsigned int irq)
>  
>  #endif /* CONFIG_SMP */
>  
> -static void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)
> +void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)
>  {
>   struct mpic *mpic = mpic_from_irq(irq);
>   unsigned int src = mpic_irq_to_hw(irq);
> diff --git a/arch/powerpc/sysdev/mpic.h b/arch/powerpc/sysdev/mpic.h
> index 3a1c3d2..1cb6bd8 100644
> --- a/arch/powerpc/sysdev/mpic.h
> +++ b/arch/powerpc/sysdev/mpic.h
> @@ -34,5 +34,6 @@ extern int mpic_set_irq_type(unsigned int virq, unsigned 
> int flow_type);
>  extern void mpic_end_irq(unsigned int irq);
>  extern void mpic_mask_irq(unsigned int irq);
>  extern void mpic_unmask_irq(unsigned int irq);
> +extern void mpic_set_affinity(unsigned int irq, cpumask_t cpumask);
>  
>  #endif /* _POWERPC_SYSDEV_MPIC_H */
> diff --git a/arch/powerpc/sysdev/mpic_u3msi.c 
> b/arch/powerpc/sysdev/mpic_u3msi.c
> index 305b864..0fc4e96 100644
> --- a/arch/powerpc/sysdev/mpic_u3msi.c
> +++ b/arch/powerpc/sysdev/mpic_u3msi.c
> @@ -40,6 +40,7 @@ static struct irq_chip mpic_u3msi_chip = {
>   .unmask = mpic_u3msi_unmask_irq,
>   .eoi= mpic_end_irq,
>   .set_type   = mpic_set_irq_type,
> + .set_affinity   = mpic_set_affinity,
>   .typename   = "MPIC-U3MSI",
>  };
>  
> ___
> 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: [PATCH 1/3] usb: add device-tree-aware ehci driver

2007-09-17 Thread Stephen Rothwell
On Mon, 17 Sep 2007 22:17:15 +0400 Valentine Barshak <[EMAIL PROTECTED]> wrote:
>
> Looks like we'll need a patch that replaces asm/prom.h and 
> asm/of_platform.h with linux/of.h and linux/of_platform.h
> in other drivers.

Yeah, but at the moment I am just stopping the infection spreading :-)

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


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

Re: [PATCH 09/28] cpm_uart: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.

2007-09-17 Thread Stephen Rothwell
On Mon, 17 Sep 2007 11:57:38 -0500 Scott Wood <[EMAIL PROTECTED]> wrote:
>
> +++ b/drivers/serial/cpm_uart/cpm_uart_core.c
> @@ -10,7 +10,7 @@
> +
> +#ifdef CONFIG_PPC_CPM_NEW_BINDING
> +#include 

linux/of_platform.h

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


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

Re: [PATCH 0/7] MPC52xx Bestcomm submission for 2.6.24

2007-09-17 Thread Jon Smirl
On 9/16/07, Sylvain Munaut <[EMAIL PROTECTED]> wrote:
> Hello Paul, Hi everyone,
>
> This series of patch is mainly the bestcomm support for
> the mpc5200. It was posted a while ago and received some
> comments. Theses are all addressed here (afaik).

Does this series supersede these pacthes out of your older series?

0010-powerpc-In-rheap.c-move-the-EXPORT_SYMBOL-and-use.patch
0011-powerpc-BestComm-move-the-EXPORT_SYMBOL-and-use-th.patch
0012-powerpc-BestComm-ATA-task-move-the-EXPORT_SYMBOL-a.patch
0013-powerpc-BestComm-FEC-task-move-the-EXPORT_SYMBOL-a.patch
0014-powerpc-BestComm-GenBD-task-move-the-EXPORT_SYMBOL.patch
0015-powerpc-BestComm-Replace-global-variable-bcom-by-b.patch
0016-powerpc-Make-the-BestComm-driver-a-standard-of_plat.patch
0017-powerpc-Fix-typo-in-BestComm-ATA-task-support-code.patch
0018-powerpc-BestComm-ATA-task-microcode-insert-copyri.patch
0019-powerpc-BestComm-FEC-task-microcode-insert-copyri.patch
0020-powerpc-BestComm-GenBD-task-microcode-insert-copy.patch
0021-powerpc-Fix-errors-in-bcom-bcom_eng-renaming.patch



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


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Josh Boyer
On Mon, 17 Sep 2007 18:37:49 -0700
Randy Dunlap <[EMAIL PROTECTED]> wrote:

> On Tue, 18 Sep 2007 05:13:40 +0530 (IST) Satyam Sharma wrote:
> 
> > Untested (not even compile-tested) patch.
> > Could someone point me to ppc32/64 cross-compilers for i386?
> 
> OSDL had some, but those are gone now.
> I downloaded all of them and still use them, although it would
> be good to have some more recent versions of them.
> 
> I put the power* compiler tarballs here:
> 
> http://userweb.kernel.org/~rdunlap/cross-compilers/

Crosstool is widely used.  It'll build several combinations of
gcc/binutils/glibc for you.  

http://www.kegel.com/crosstool/

There's also the ELDK from Denx:  

http://www.denx.de/en/view/Software/WebHome#Embedded_Linux_Development_Kit

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


dtc: Whitespace cleanup

2007-09-17 Thread David Gibson
This large patch removes all trailing whitespace from dtc (including
libfdt, the testsuite and documentation).  It also removes a handful
of redundant blank lines (at the end of functions, or when there are
two blank lines together for no particular reason).

As well as anything else, this means that quilt won't whinge when I go
to convert the whole of libfdt into a patch to apply to the kernel.

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

Index: dtc/data.c
===
--- dtc.orig/data.c 2007-09-18 11:05:03.0 +1000
+++ dtc/data.c  2007-09-18 11:05:55.0 +1000
@@ -1,7 +1,7 @@
 /*
  * (C) Copyright David Gibson <[EMAIL PROTECTED]>, IBM Corporation.  2005.
  *
- * 
+ *
  * 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
@@ -11,11 +11,11 @@
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  *  General Public License for more details.
- *   
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software  
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 
- *   USA 
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ *   USA
  */
 
 #include "dtc.h"
@@ -106,7 +106,7 @@
val = strtol(x, &endx, 8);
if ((endx - x) == 0)
fprintf(stderr, "Empty \\nnn escape\n");
-   
+
(*i) += endx - x;
return val;
 }
@@ -125,7 +125,7 @@
val = strtol(x, &endx, 16);
if ((endx - x) == 0)
fprintf(stderr, "Empty \\x escape\n");
-   
+
(*i) += endx - x;
return val;
 }
Index: dtc/treesource.c
===
--- dtc.orig/treesource.c   2007-09-18 11:06:06.0 +1000
+++ dtc/treesource.c2007-09-18 11:06:25.0 +1000
@@ -1,7 +1,7 @@
 /*
  * (C) Copyright David Gibson <[EMAIL PROTECTED]>, IBM Corporation.  2005.
  *
- * 
+ *
  * 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
@@ -11,11 +11,11 @@
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  *  General Public License for more details.
- *   
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software  
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 
- *   USA 
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ *   USA
  */
 
 #include "dtc.h"
@@ -77,7 +77,6 @@
return PROP_CELLS;
else
return PROP_BYTES;
-   
 }
 
 
Index: dtc/tests/root_node.c
===
--- dtc.orig/tests/root_node.c  2007-09-18 11:06:53.0 +1000
+++ dtc/tests/root_node.c   2007-09-18 11:06:56.0 +1000
@@ -36,7 +36,7 @@
 
test_init(argc, argv);
fdt = load_blob_arg(argc, argv);
-   
+
nh = fdt_offset_ptr_typed(fdt, 0, nh);
 
if (! nh)
Index: dtc/tests/testutils.c
===
--- dtc.orig/tests/testutils.c  2007-09-18 11:06:40.0 +1000
+++ dtc/tests/testutils.c   2007-09-18 11:06:44.0 +1000
@@ -104,7 +104,6 @@
 name, proplen, len);
if (memcmp(val, prop->data, len) != 0)
FAIL("Data mismatch on property \"%s\"", name);
-   
 }
 
 const void *check_getprop(void *fdt, int nodeoffset, const char *name,
Index: dtc/tests/nop_property.c
===
--- dtc.orig/tests/nop_property.c   2007-09-18 11:07:23.0 +1000
+++ dtc/tests/nop_property.c2007-09-18 11:07:26.0 +1000
@@ -53,7 +53,7 @@
FAIL(

Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Randy Dunlap
On Tue, 18 Sep 2007 05:13:40 +0530 (IST) Satyam Sharma wrote:

> Untested (not even compile-tested) patch.
> Could someone point me to ppc32/64 cross-compilers for i386?

OSDL had some, but those are gone now.
I downloaded all of them and still use them, although it would
be good to have some more recent versions of them.

I put the power* compiler tarballs here:

http://userweb.kernel.org/~rdunlap/cross-compilers/

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


dtc: Add basic testcases for dtc

2007-09-17 Thread David Gibson
This patch adds a handful of simple testcases for dtc.  It adds a dts
file which should generate the same sample tree as is used for the
libfdt testcases, and tests invoking dtc on this dts, plus the
standard batch of libfdt cases on the resulting dtb, which effectively
checks that the dtb is correct.

Because the test framework assumes each testcase is an executable with
the right output conventions, we use a little shell script, dtc.sh, as
a wrapper around dtc itself.  It simply invokes dtc and returns a PASS
or FAIL depending on whether dtc returned an error.

It's not much, but it's a start.

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

---

NB: Jon, you won't be able to simply git-applymbox this and have it
work.  You'll need to manually add execute permission to tests/dtc.sh
before git commiting it, since I can't encode the permissions in a
patch.  Sorry for the inconvenience, but it didn't really seem worth
setting up my own git to pull from just for that.

Index: dtc/tests/run_tests.sh
===
--- dtc.orig/tests/run_tests.sh 2007-09-18 10:06:28.0 +1000
+++ dtc/tests/run_tests.sh  2007-09-18 10:06:31.0 +1000
@@ -86,6 +86,14 @@
 run_test truncated_property
 }
 
+dtc_tests () {
+# Make sure we don't have stale blobs lying around
+rm -f *.test.dtb
+
+run_test dtc.sh -f -I dts -O dtb -o dtc_tree1.test.dtb test_tree1.dts
+tree1_tests dtc_tree1.test.dtb
+}
+
 while getopts "vdt:" ARG ; do
 case $ARG in
"v")
@@ -98,7 +106,7 @@
 done
 
 if [ -z "$TESTSETS" ]; then
-TESTSETS="libfdt"
+TESTSETS="libfdt dtc"
 fi
 
 for set in $TESTSETS; do
@@ -106,6 +114,9 @@
"libfdt")
libfdt_tests
;;
+   "dtc")
+   dtc_tests
+   ;;
 esac
 done
 
Index: dtc/tests/test_tree1.dts
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ dtc/tests/test_tree1.dts2007-09-18 10:06:31.0 +1000
@@ -0,0 +1,20 @@
+/ {
+   prop-int = ;
+   prop-str = "hello world";
+
+   subnode1 {
+   prop-int = ;
+
+   subsubnode {
+   prop-int = ;
+   };
+   };
+
+   subnode2 {
+   prop-int = ;
+
+   subsubnode {
+   prop-int = ;
+   };
+   };
+};
Index: dtc/tests/dtc.sh
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ dtc/tests/dtc.sh2007-09-18 10:07:34.0 +1000
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+PASS () {
+echo "PASS"
+exit 0
+}
+
+FAIL () {
+echo "FAIL" "$@"
+exit 2
+}
+
+DTC=../dtc
+
+verbose_run () {
+if [ -z "$QUIET_TEST" ]; then
+   "$@"
+else
+   "$@" > /dev/null 2> /dev/null
+fi
+}
+
+if verbose_run "$DTC" "$@"; then
+PASS
+else
+ret="$?"
+FAIL "dtc returned error code $ret"
+fi
Index: dtc/tests/Makefile.tests
===
--- dtc.orig/tests/Makefile.tests   2007-09-18 10:27:30.0 +1000
+++ dtc/tests/Makefile.tests2007-09-18 10:27:46.0 +1000
@@ -43,10 +43,10 @@
rm -f $(STD_CLEANFILES:%=$(TESTS_PREFIX)%)
rm -f $(TESTS_CLEANFILES)
 
-check: tests
+check: tests dtc
cd $(TESTS_PREFIX); ./run_tests.sh
 
-checkv:tests
+checkv:tests dtc
cd $(TESTS_PREFIX); ./run_tests.sh -v
 
 ifneq ($(DEPTARGETS),)

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Satyam Sharma


On Tue, 18 Sep 2007, Satyam Sharma wrote:
> 
> > [ cut here ]
> > Badness at arch/powerpc/kernel/smp.c:202
> 
> comes when smp_call_function_map() has been called with irqs disabled,
> which is illegal. However, there is a special case, the panic() codepath,
> when we do not want to warn about this -- warning at that time is pointless
> anyway, and only serves to scroll away the *real* cause of the panic and
> distracts from the real bug.

BTW arch/ppc/ has same issue, but that's gonna be removed by next year
anyways, so I think there's no point making a patch for that (?)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Satyam Sharma

> [ cut here ]
> Badness at arch/powerpc/kernel/smp.c:202

comes when smp_call_function_map() has been called with irqs disabled,
which is illegal. However, there is a special case, the panic() codepath,
when we do not want to warn about this -- warning at that time is pointless
anyway, and only serves to scroll away the *real* cause of the panic and
distracts from the real bug.

* So let's extract the WARN_ON() from smp_call_function_map() into all its
  callers -- smp_call_function() and smp_call_function_single()

* Also, introduce another caller of smp_call_function_map(), namely
  __smp_call_function() (and make smp_call_function() a wrapper over this)
  which does *not* warn about disabled irqs

* Use this __smp_call_function() from the panic codepath's smp_send_stop()

We also end having to move code of smp_send_stop() below the definition
of __smp_call_function().

Signed-off-by: Satyam Sharma <[EMAIL PROTECTED]>

---

Untested (not even compile-tested) patch.
Could someone point me to ppc32/64 cross-compilers for i386?

 arch/powerpc/kernel/smp.c |   27 ++-
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 1ea4316..b24dcba 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -152,11 +152,6 @@ static void stop_this_cpu(void *dummy)
;
 }
 
-void smp_send_stop(void)
-{
-   smp_call_function(stop_this_cpu, NULL, 1, 0);
-}
-
 /*
  * Structure and data for smp_call_function(). This is designed to minimise
  * static memory requirements. It also looks cleaner.
@@ -198,9 +193,6 @@ int smp_call_function_map(void (*func) (void *info), void 
*info, int nonatomic,
int cpu;
u64 timeout;
 
-   /* Can deadlock when called with interrupts disabled */
-   WARN_ON(irqs_disabled());
-
if (unlikely(smp_ops == NULL))
return ret;
 
@@ -270,10 +262,19 @@ int smp_call_function_map(void (*func) (void *info), void 
*info, int nonatomic,
return ret;
 }
 
+static int __smp_call_function(void (*func)(void *info), void *info,
+  int nonatomic, int wait)
+{
+   return smp_call_function_map(func,info,nonatomic,wait,cpu_online_map);
+}
+
 int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
int wait)
 {
-   return smp_call_function_map(func,info,nonatomic,wait,cpu_online_map);
+   /* Can deadlock when called with interrupts disabled */
+   WARN_ON(irqs_disabled());
+
+   return __smp_call_function(func, info, nonatomic, wait);
 }
 EXPORT_SYMBOL(smp_call_function);
 
@@ -283,6 +284,9 @@ int smp_call_function_single(int cpu, void (*func) (void 
*info), void *info, int
cpumask_t map = CPU_MASK_NONE;
int ret = 0;
 
+   /* Can deadlock when called with interrupts disabled */
+   WARN_ON(irqs_disabled());
+
if (!cpu_online(cpu))
return -EINVAL;
 
@@ -299,6 +303,11 @@ int smp_call_function_single(int cpu, void (*func) (void 
*info), void *info, int
 }
 EXPORT_SYMBOL(smp_call_function_single);
 
+void smp_send_stop(void)
+{
+   __smp_call_function(stop_this_cpu, NULL, 1, 0);
+}
+
 void smp_call_function_interrupt(void)
 {
void (*func) (void *info);
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


RE: [PATCH] [POWERPC] Fix build errors when BLOCK=n

2007-09-17 Thread Medve Emilian-EMMEDVE1
Hi David,


I've seen you patch earlier, but I'm not trying to solve the BSG related
problem/warnings. That's why I put a reference to an already existing
commit addressing the BSG/bsg.h warnings. I'm trying to address a
slightly different problem in the PowerPC code only.


Cheers,
Emil.


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Monday, September 17, 2007 5:35 PM
> To: Medve Emilian-EMMEDVE1
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Gala Kumar-B11780; 
> linuxppc-dev@ozlabs.org; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PATCH] [POWERPC] Fix build errors when BLOCK=n
> 
> 
> Try the attached.
> 
> David
> ---
> [PATCH] VFS: Make BSG declarations dependent on CONFIG_BLOCK
> 
> From: David Howells <[EMAIL PROTECTED]>
> 
> Make BSG function declarations dependent on CONFIG_BLOCK as 
> they are not
> compilable if the block layer is compiled out.
> 
> Signed-off-by: David Howells <[EMAIL PROTECTED]>
> ---
> 
>  include/linux/bsg.h |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/bsg.h b/include/linux/bsg.h
> index 60e377b..28f5d44 100644
> --- a/include/linux/bsg.h
> +++ b/include/linux/bsg.h
> @@ -52,6 +52,7 @@ struct sg_io_v4 {
>  };
>  
>  #ifdef __KERNEL__
> +#ifdef CONFIG_BLOCK
>  
>  #if defined(CONFIG_BLK_DEV_BSG)
>  struct bsg_class_device {
> @@ -73,6 +74,7 @@ static inline void 
> bsg_unregister_queue(struct request_queue *rq)
>  }
>  #endif
>  
> +#endif /* CONFIG_BLOCK */
>  #endif /* __KERNEL__ */
>  
>  #endif
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [POWERPC] Fix build errors when BLOCK=n

2007-09-17 Thread David Howells

Try the attached.

David
---
[PATCH] VFS: Make BSG declarations dependent on CONFIG_BLOCK

From: David Howells <[EMAIL PROTECTED]>

Make BSG function declarations dependent on CONFIG_BLOCK as they are not
compilable if the block layer is compiled out.

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

 include/linux/bsg.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index 60e377b..28f5d44 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -52,6 +52,7 @@ struct sg_io_v4 {
 };
 
 #ifdef __KERNEL__
+#ifdef CONFIG_BLOCK
 
 #if defined(CONFIG_BLK_DEV_BSG)
 struct bsg_class_device {
@@ -73,6 +74,7 @@ static inline void bsg_unregister_queue(struct request_queue 
*rq)
 }
 #endif
 
+#endif /* CONFIG_BLOCK */
 #endif /* __KERNEL__ */
 
 #endif
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


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

2007-09-17 Thread Roland Dreier
obviously OK...applied.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] Fix build errors when BLOCK=n

2007-09-17 Thread Emil Medve
These are the symptom error messages:

  CC  arch/powerpc/kernel/setup_32.o
In file included from include/linux/blkdev.h:17,
 from include/linux/ide.h:13,
 from arch/powerpc/kernel/setup_32.c:13:
include/linux/bsg.h:67: warning: 'struct request_queue' declared inside 
parameter list
include/linux/bsg.h:67: warning: its scope is only this definition or 
declaration, which is probably not what you want
include/linux/bsg.h:71: warning: 'struct request_queue' declared inside 
parameter list
In file included from arch/powerpc/kernel/setup_32.c:13:
include/linux/ide.h:857: error: field 'wrq' has incomplete type

  CC  arch/powerpc/kernel/ppc_ksyms.o
In file included from include/linux/blkdev.h:17,
 from include/linux/ide.h:13,
 from arch/powerpc/kernel/ppc_ksyms.c:15:
include/linux/bsg.h:67: warning: 'struct request_queue' declared inside 
parameter list
include/linux/bsg.h:67: warning: its scope is only this definition or 
declaration, which is probably not what you want
include/linux/bsg.h:71: warning: 'struct request_queue' declared inside 
parameter list
In file included from arch/powerpc/kernel/ppc_ksyms.c:15:
include/linux/ide.h:857: error: field 'wrq' has incomplete type

The fix tries to use the smallest scope CONFIG_* symbols that will fix the build
problem. In this case  needs to be included only if IDE=y or
IDE=m were selected. Also, ppc_ide_md is needed only if BLK_DEV_IDE=y or
BLK_DEV_IDE=m

Signed-off-by: Emil Medve <[EMAIL PROTECTED]>
---

I tested that the code builds with this patch in various combinations of
configuration options: all the combinations involving BLOCK, IDE and BLK_DEV_IDE

A patch for the warnings above has been already commited here: 
http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commitdiff;h=49892223f7d3a2333ef9e6cbdd526676e1fc517a

This a patch against Paul's tree (01f1c735f57548e6b862e815cc845e452405643d)

powerpc> scripts/checkpatch.pl 0001-POWERPC-Fix-build-errors-when-BLOCK-n.patch 
Your patch has no obvious style problems and is ready for submission.

 arch/powerpc/kernel/ppc_ksyms.c |5 -
 arch/powerpc/kernel/setup_32.c  |4 
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 430c502..ba3a928 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -12,12 +12,15 @@
 #include 
 #include 
 #include 
+#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE)
 #include 
+#endif
 #include 
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -95,7 +98,7 @@ EXPORT_SYMBOL(__strnlen_user);
 EXPORT_SYMBOL(copy_4K_page);
 #endif
 
-#if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || 
defined(CONFIG_BLK_DEV_IDE_MODULE))
+#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
 EXPORT_SYMBOL(ppc_ide_md);
 #endif
 
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index a288a5f..3d46a30 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -10,7 +10,9 @@
 #include 
 #include 
 #include 
+#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE)
 #include 
+#endif
 #include 
 #include 
 #include 
@@ -49,7 +51,9 @@
 
 extern void bootx_init(unsigned long r4, unsigned long phys);
 
+#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
 struct ide_machdep_calls ppc_ide_md;
+#endif
 
 int boot_cpuid;
 EXPORT_SYMBOL_GPL(boot_cpuid);
-- 
1.5.3.GIT

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


[PATCH] [POWERPC] Support setting affinity for U3/U4 MSI sources

2007-09-17 Thread Olof Johansson
Hook up affinity-setting for U3/U4 MSI interrupt sources.

Tested on Quad G5 with myri10ge.


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

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 8de29f2..22600fd 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -768,7 +768,7 @@ static void mpic_end_ipi(unsigned int irq)
 
 #endif /* CONFIG_SMP */
 
-static void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)
+void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)
 {
struct mpic *mpic = mpic_from_irq(irq);
unsigned int src = mpic_irq_to_hw(irq);
diff --git a/arch/powerpc/sysdev/mpic.h b/arch/powerpc/sysdev/mpic.h
index 3a1c3d2..1cb6bd8 100644
--- a/arch/powerpc/sysdev/mpic.h
+++ b/arch/powerpc/sysdev/mpic.h
@@ -34,5 +34,6 @@ extern int mpic_set_irq_type(unsigned int virq, unsigned int 
flow_type);
 extern void mpic_end_irq(unsigned int irq);
 extern void mpic_mask_irq(unsigned int irq);
 extern void mpic_unmask_irq(unsigned int irq);
+extern void mpic_set_affinity(unsigned int irq, cpumask_t cpumask);
 
 #endif /* _POWERPC_SYSDEV_MPIC_H */
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index 305b864..0fc4e96 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -40,6 +40,7 @@ static struct irq_chip mpic_u3msi_chip = {
.unmask = mpic_u3msi_unmask_irq,
.eoi= mpic_end_irq,
.set_type   = mpic_set_irq_type,
+   .set_affinity   = mpic_set_affinity,
.typename   = "MPIC-U3MSI",
 };
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] i2c: devtree-aware iic support for PPC4xx

2007-09-17 Thread Grant Likely
On 9/16/07, Stefan Roese <[EMAIL PROTECTED]> wrote:
> On Sunday 16 September 2007, Eugene Surovegin wrote:
> > Hmm, I just noticed that you basically added a copy of existing
> > driver with small changes to support OF while keeping OCP one.
> >
> > Why not just add OF support to the existing code (under some ifdef),
> > and then remove OCP support as soon as ppc -> powerpc transition is
> > finished? Why have two almost identical code in the tree?
>
> My understanding was, that adding many #ifdef's into the code was not the
> preferred way. I could of course change this patch to not add an additional
> driver but extend the existing driver with a bunch of #ifdef's to support
> both versions.
>
> This approach of multiple drivers seems to be common in the kernel right now:
>
> drivers/mtd/maps/physmap.c
> drivers/mtd/maps/physmap_of.c
>
> or
>
> drivers/usb/host/ohci-ppc-soc.c
> drivers/usb/host/ohci-ppc-of.c
>
> Any other opinions on this? How should this be handled to get accepted
> upstream? Two different drivers with removing the "old" one later when
> arch/ppc is gone, or one driver which supports both versions and removing the
> ocp support in this driver later?

FWIW, I'm not a big fan of duplicating drivers, and I don't think it
should be necessary.  If a large number of #ifdef block are needed
then it may be that it would be better to refactor parts of the driver
to localize the conditionally compiled code.

Also, neither of these examples are particularly strong support.  In
both cases (physmap and ohci-ppc) the mentioned C files are bus
mappings only, not the actual driver.  In this scenario it does make
sense to use separate files, but it requires the dependent driver to
be abstracted enough to support multiple bindings.

Cheers,
g.

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


Re: dtc: Cleanup testsuite organization

2007-09-17 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
> run_tests.sh from the dtc testsuite currently has a facility ro run
> just "functional" or just "stress" tests.  This distinction is carried
> over from libhugetlbfs where the test framework originated, and where
> it made sense.
> 
> In dtc, we have no stress tests, so running these subsections isn't
> particularly interesting.  This patch removes these test subsets,
> instead defining a single "libfdt" test subset for testcases related
> to libfdt (and not dtc proper only.  Currently that's all of the
> testcases, but with any luck we'll have some dtc testcases in the
> future.
> 
> Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Applied.

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


Re: libfdt: Consistently use big-endian property data in testcases

2007-09-17 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
> Flat device trees always have integers in their structure stored as
> big-endian.  From this point of view, property values are
> bags-of-bytes and any endianness is up to users of the device tree to
> determine.
> 
> The libfdt testcases which use properties with integer values,
> currently use native endian format for the architecture on which the
> testcases are run.  This works ok for now, since both the creation and
> checking of the example device trees happen in the same endianness.
> 
> This will become a problem, however, for tests of dtc which we want to
> add in the nearish future.  dtc always uses big-endian format for
> 'cell' format data in properties; as it needs to in order to produce
> powerpc-usable device trees when hosted on a little-endian
> architecture.
> 
> This patch, therefore, changes the libfdt testsuite to use big-endian
> format always for integer format data, in order to interoperate sanely
> with future dtc testcases.  This also means that the example trees
> created by the testsuite should now be byte-for-byte identical
> regardless of dtc and libfdt's host platform, which is arguably an
> advantage.
> 
> Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Applied.

jdl

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


Re: libfdt: Add fdt_node_offset_by_prop_value()

2007-09-17 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
> This patch adds a function to libfdt to locate nodes containing a
> property with a specific value.
> 
> Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Applied.

jdl

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


Re: [PATCH] i2c: devtree-aware iic support for PPC4xx

2007-09-17 Thread Jean Delvare
Hi Stefan,

On Mon, 17 Sep 2007 07:34:08 +0200, Stefan Roese wrote:
> On Sunday 16 September 2007, Eugene Surovegin wrote:
> > Hmm, I just noticed that you basically added a copy of existing
> > driver with small changes to support OF while keeping OCP one.
> >
> > Why not just add OF support to the existing code (under some ifdef),
> > and then remove OCP support as soon as ppc -> powerpc transition is
> > finished? Why have two almost identical code in the tree?
> 
> My understanding was, that adding many #ifdef's into the code was not the 
> preferred way. I could of course change this patch to not add an additional 
> driver but extend the existing driver with a bunch of #ifdef's to support 
> both versions.
> 
> This approach of multiple drivers seems to be common in the kernel right now:
> 
> drivers/mtd/maps/physmap.c
> drivers/mtd/maps/physmap_of.c
> 
> or
> 
> drivers/usb/host/ohci-ppc-soc.c
> drivers/usb/host/ohci-ppc-of.c
> 
> Any other opinions on this? How should this be handled to get accepted 
> upstream? Two different drivers with removing the "old" one later when 
> arch/ppc is gone, or one driver which supports both versions and removing the 
> ocp support in this driver later?

I'd prefer a single driver with ifdef's. Only the registration and
cleanup parts should be different, the actual I2C bus driving code
should be pretty much the same. With some efforts it should be possible
to reduce the ifdef clutter to a minimum.

> (...)
> The "old" name "i2c-ibm_iic" is kind of redundant. Nearly all bus drivers are 
> named "i2c-platform". Perhaps a better name would be "i2c-ppc4xx" then.

Agreed. But that being said, changing the name now while the old name
has been used for years might cause more trouble than it solves.

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


[PATCH 1/3] usb: add device-tree-aware ehci driver

2007-09-17 Thread Valentine Barshak
This adds ehci-ppc-of driver. The code is based on the
ehci-ppc-soc driver by Stefan Roese <[EMAIL PROTECTED]>.

Signed-off-by: Stefan Roese <[EMAIL PROTECTED]>
Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 drivers/usb/host/Kconfig   |8 +
 drivers/usb/host/ehci-hcd.c|   16 ++
 drivers/usb/host/ehci-ppc-of.c |  220 +
 drivers/usb/host/ehci.h|2 
 4 files changed, 244 insertions(+), 2 deletions(-)

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

[PATCH 0/1] ppc64: Convert cpu_sibling_map to a per_cpu data array ppc64 v2

2007-09-17 Thread travis

Stephen Rothwell wrote:
> On Mon, 17 Sep 2007 16:28:31 +1000 Stephen Rothwell <[EMAIL PROTECTED]> wrote:
>>  the topology (on my POWERPC5+ box) is not correct:
>>
>> cpu0/topology/thread_siblings:000f
>> cpu1/topology/thread_siblings:000f
>> cpu2/topology/thread_siblings:000f
>> cpu3/topology/thread_siblings:000f
>>
>> it used to be:
>>
>> cpu0/topology/thread_siblings:0003
>> cpu1/topology/thread_siblings:0003
>> cpu2/topology/thread_siblings:000c
>> cpu3/topology/thread_siblings:000c
> 
> This would be because we are setting up the cpu_sibling map before we
> call setup_per_cpu_areas().

The following patch hopefully should fix this problem.  I'm
not able to build or test it but the few references to 
cpu_sibling_map seem to all occur well after setup_per_cpu_areas
is called.

Thanks Stephen for checking this out!

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


[PATCH 1/1] ppc64: Convert cpu_sibling_map to a per_cpu data array ppc64 v2

2007-09-17 Thread travis
v2: 

This patch applies after:

convert-cpu_sibling_map-to-a-per_cpu-data-array-ppc64.patch

and should fix the "reference cpu_sibling_map before setup_per_cpu_areas()
has been called" problem.  In addtion, the cpu_sibiling_map macro has been
removed [this was missed in my original submission.]

Original Notes:

Convert cpu_sibling_map to a per_cpu cpumask_t array for the ppc64
architecture.  This fixes build errors in block/blktrace.c and
kernel/sched.c when CONFIG_SCHED_SMT is defined.

Note: these changes have not been built nor tested.

Signed-off-by: Mike Travis <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/setup-common.c|   20 
 arch/powerpc/kernel/setup_64.c|3 +++
 arch/powerpc/platforms/cell/cbe_cpufreq.c |2 +-
 include/asm-powerpc/smp.h |2 +-
 include/asm-powerpc/topology.h|2 +-
 5 files changed, 22 insertions(+), 7 deletions(-)

--- a/include/asm-powerpc/smp.h
+++ b/include/asm-powerpc/smp.h
@@ -60,7 +60,6 @@
 #endif
 
 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
-#define cpu_sibling_map(cpu) per_cpu(cpu_sibling_map, cpu)
 
 /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
  *
@@ -79,6 +78,7 @@
 void smp_init_cell(void);
 void smp_init_celleb(void);
 void smp_setup_cpu_maps(void);
+void smp_setup_cpu_sibling_map(void);
 
 extern int __cpu_disable(void);
 extern void __cpu_die(unsigned int cpu);
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -596,6 +596,9 @@
paca[i].data_offset = ptr - __per_cpu_start;
memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
}
+
+   /* Now that per_cpu is setup, initialize cpu_sibling_map */
+   smp_setup_cpu_sibling_map();
 }
 #endif
 
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -411,16 +411,28 @@
of_node_put(dn);
}
 
+   vdso_data->processorCount = num_present_cpus();
+#endif /* CONFIG_PPC64 */
+}
+
+/*
+ * Being that cpu_sibling_map is now a per_cpu array, then it cannot
+ * be initialized until the per_cpu areas have been created.  This
+ * function is now called from setup_per_cpu_areas().
+ */
+void __init smp_setup_cpu_sibling_map(void)
+{
+#if defined(CONFIG_PPC64)
+   int cpu;
+
/*
 * Do the sibling map; assume only two threads per processor.
 */
for_each_possible_cpu(cpu) {
-   cpu_set(cpu, cpu_sibling_map(cpu));
+   cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
if (cpu_has_feature(CPU_FTR_SMT))
-   cpu_set(cpu ^ 0x1, cpu_sibling_map(cpu));
+   cpu_set(cpu ^ 0x1, per_cpu(cpu_sibling_map, cpu));
}
-
-   vdso_data->processorCount = num_present_cpus();
 #endif /* CONFIG_PPC64 */
 }
 #endif /* CONFIG_SMP */
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -119,7 +119,7 @@
policy->cur = cbe_freqs[cur_pmode].frequency;
 
 #ifdef CONFIG_SMP
-   policy->cpus = cpu_sibling_map(policy->cpu);
+   policy->cpus = per_cpu(cpu_sibling_map, policy->cpu);
 #endif
 
cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -108,7 +108,7 @@
 #ifdef CONFIG_PPC64
 #include 
 
-#define topology_thread_siblings(cpu)  (cpu_sibling_map(cpu))
+#define topology_thread_siblings(cpu)  (per_cpu(cpu_sibling_map, cpu))
 #endif
 #endif
 

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


Re: [PATCH 1/3] usb: add device-tree-aware ehci driver

2007-09-17 Thread Valentine Barshak
Stephen Rothwell wrote:
> On Mon, 17 Sep 2007 16:55:43 +0400 Valentine Barshak <[EMAIL PROTECTED]> 
> wrote:
>> +++ linux-2.6/drivers/usb/host/ehci-ppc-of.c 2007-09-15 16:12:56.0 
>> +0400
>> @@ -0,0 +1,220 @@
>> +
>> +#include 
>> +#include 
> 
> Please use linux/of.h and linux/of_platform.h instead.
> 
>> +static int ehci_hcd_ppc_of_shutdown(struct of_device *op)
>> +{
>> +struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
>> +
>> +if (hcd->driver->shutdown)
>> +hcd->driver->shutdown(hcd);
> 
> White space has gone a bit funny here.
> 
Corrected...
Sending new patch in a minute.
Looks like we'll need a patch that replaces asm/prom.h and 
asm/of_platform.h with linux/of.h and linux/of_platform.h
in other drivers.
ohci-ppc-of is definitely gonna need it.
BTW, I think the ohci_hcd_ppc_of_match stuff for ohci-ppc-of.c has to be 
  modified.
I think it should be .type="usb" instead of .name="usb" and 
.compatible="ohci-littlendian" doesn't look good to me either.
Thanks,
Valentine.

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


[PATCH 28/28] mpc82xx: Add pq2fads board support.

2007-09-17 Thread Scott Wood
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/pq2fads.dts  |  229 
 arch/powerpc/configs/pq2fads_defconfig | 1003 
 arch/powerpc/platforms/82xx/Kconfig|   11 +
 arch/powerpc/platforms/82xx/Makefile   |1 +
 arch/powerpc/platforms/82xx/pq2fads.c  |  198 +++
 5 files changed, 1442 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/pq2fads.dts
 create mode 100644 arch/powerpc/configs/pq2fads_defconfig
 create mode 100644 arch/powerpc/platforms/82xx/pq2fads.c

diff --git a/arch/powerpc/boot/dts/pq2fads.dts 
b/arch/powerpc/boot/dts/pq2fads.dts
new file mode 100644
index 000..54e8bd1
--- /dev/null
+++ b/arch/powerpc/boot/dts/pq2fads.dts
@@ -0,0 +1,229 @@
+/*
+ * Device Tree for the PQ2FADS-ZU board with an MPC8280 chip.
+ *
+ * Copyright 2007 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+/ {
+   model = "pq2fads";
+   compatible = "fsl,pq2fads";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   [EMAIL PROTECTED] {
+   device_type = "cpu";
+   reg = <0>;
+   d-cache-line-size = ;
+   i-cache-line-size = ;
+   d-cache-size = ;
+   i-cache-size = ;
+   timebase-frequency = <0>;
+   clock-frequency = <0>;
+   };
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0 0>;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc8280-localbus",
+"fsl,pq2-localbus";
+   #address-cells = <2>;
+   #size-cells = <1>;
+   reg = ;
+
+   ranges = <0 0 fe00 0080
+ 1 0 f450 8000
+ 8 0 f820 8000>;
+
+   [EMAIL PROTECTED],0 {
+   compatible = "jedec-flash";
+   reg = <0 0 80>;
+   bank-width = <4>;
+   device-width = <1>;
+   };
+
+   [EMAIL PROTECTED],0 {
+   reg = <1 0 20>;
+   compatible = "fsl,pq2fads-bcsr";
+   };
+
+   PCI_PIC: [EMAIL PROTECTED],0 {
+   #interrupt-cells = <1>;
+   interrupt-controller;
+   reg = <8 0 8>;
+   compatible = "fsl,pq2ads-pci-pic";
+   interrupt-parent = <&PIC>;
+   interrupts = <18 8>;
+   };
+   };
+
+   [EMAIL PROTECTED] {
+   device_type = "pci";
+   reg = ;
+   compatible = "fsl,mpc8280-pci", "fsl,pq2-pci";
+   #interrupt-cells = <1>;
+   #size-cells = <2>;
+   #address-cells = <3>;
+   clock-frequency = ;
+   interrupt-map-mask = ;
+   interrupt-map = <
+   /* IDSEL 0x16 */
+b000 0 0 1 &PCI_PIC 0
+b000 0 0 2 &PCI_PIC 1
+b000 0 0 3 &PCI_PIC 2
+b000 0 0 4 &PCI_PIC 3
+
+   /* IDSEL 0x17 */
+b800 0 0 1 &PCI_PIC 4
+b800 0 0 2 &PCI_PIC 5
+b800 0 0 3 &PCI_PIC 6
+b800 0 0 4 &PCI_PIC 7
+
+   /* IDSEL 0x18 */
+c000 0 0 1 &PCI_PIC 8
+c000 0 0 2 &PCI_PIC 9
+c000 0 0 3 &PCI_PIC a
+c000 0 0 4 &PCI_PIC b>;
+
+   interrupt-parent = <&PIC>;
+   interrupts = <12 8>;
+   ranges = <4200 0 8000 8000 0 2000
+ 0200 0 a000 a000 0 2000
+ 0100 0  f600 0 0200>;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   device_type = "soc";
+   compatible = "fsl,mpc8280", "fsl,pq2-soc";
+   ranges = < f000 00053000>;
+
+   // Temporary -- will go away once kernel uses ranges for 
get_immrbase().
+   reg = ;
+
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cel

[PATCH 27/28] mpc82xx: Update mpc8272ads, and factor out PCI and reset.

2007-09-17 Thread Scott Wood
1. PCI and reset are factored out into pq2.c.  I renamed them from m82xx
to pq2 because they won't work on the Integrated Host Processor line of
82xx chips (i.e. 8240, 8245, and such).

2. The PCI PIC, which is nominally board-specific, is used on multiple
boards, and thus is used into pq2ads-pci-pic.c.

3. The new CPM binding is used.

4. General cleanup.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/Kconfig |2 +-
 arch/powerpc/boot/dts/mpc8272ads.dts |  309 +++--
 arch/powerpc/configs/mpc8272_ads_defconfig   |  248 +++
 arch/powerpc/platforms/82xx/Kconfig  |5 +
 arch/powerpc/platforms/82xx/Makefile |2 +
 arch/powerpc/platforms/82xx/mpc8272_ads.c|  661 +-
 arch/powerpc/platforms/82xx/pq2.c|   82 
 arch/powerpc/platforms/82xx/pq2.h|   20 +
 arch/powerpc/platforms/82xx/pq2ads-pci-pic.c |  195 
 arch/powerpc/platforms/82xx/pq2ads.h |2 -
 10 files changed, 753 insertions(+), 773 deletions(-)
 create mode 100644 arch/powerpc/platforms/82xx/pq2.c
 create mode 100644 arch/powerpc/platforms/82xx/pq2.h
 create mode 100644 arch/powerpc/platforms/82xx/pq2ads-pci-pic.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2622f04..29d1248 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -466,7 +466,7 @@ config PCI_8260
 
 config 8260_PCI9
bool "Enable workaround for MPC826x erratum PCI 9"
-   depends on PCI_8260 && !ADS8272
+   depends on PCI_8260 && !8272
default y
 
 choice
diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts 
b/arch/powerpc/boot/dts/mpc8272ads.dts
index 4313054..3fe991d 100644
--- a/arch/powerpc/boot/dts/mpc8272ads.dts
+++ b/arch/powerpc/boot/dts/mpc8272ads.dts
@@ -11,7 +11,7 @@
 
 / {
model = "MPC8272ADS";
-   compatible = "MPC8260ADS";
+   compatible = "fsl,mpc8272ads";
#address-cells = <1>;
#size-cells = <1>;
 
@@ -22,187 +22,208 @@
PowerPC,[EMAIL PROTECTED] {
device_type = "cpu";
reg = <0>;
-   d-cache-line-size = <20>;   // 32 bytes
-   i-cache-line-size = <20>;   // 32 bytes
-   d-cache-size = <4000>;  // L1, 16K
-   i-cache-size = <4000>;  // L1, 16K
+   d-cache-line-size = ;
+   i-cache-line-size = ;
+   d-cache-size = ;
+   i-cache-size = ;
timebase-frequency = <0>;
bus-frequency = <0>;
clock-frequency = <0>;
};
};
 
-   pci_pic: [EMAIL PROTECTED] {
-   #address-cells = <0>;
-   #interrupt-cells = <2>;
-   interrupt-controller;
-   reg = ;
-   device_type = "pci-pic";
-   };
-
memory {
device_type = "memory";
-   reg = < 400 f450 0020>;
-   };
-
-   chosen {
-   name = "chosen";
-   linux,platform = <0>;
-   interrupt-controller = <&Cpm_pic>;
+   reg = <0 0>;
};
 
-   [EMAIL PROTECTED] {
-   #address-cells = <1>;
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc8272-localbus",
+"fsl,pq2-localbus";
+   #address-cells = <2>;
#size-cells = <1>;
-   device_type = "soc";
-   ranges = < f000 00053000>;
-   reg = ;
+   reg = ;
 
-   [EMAIL PROTECTED] {
-   device_type = "mdio";
-   compatible = "fs_enet";
-   reg = <0 0>;
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   phy0:[EMAIL PROTECTED] {
-   interrupt-parent = <&Cpm_pic>;
-   interrupts = <17 4>;
-   reg = <0>;
-   bitbang = [ 12 12 13 02 02 01 ];
-   device_type = "ethernet-phy";
-   };
+   ranges = <0 0 fe00 0200
+ 1 0 f450 8000
+ 3 0 f820 8000>;
 
-   phy1:[EMAIL PROTECTED] {
-   interrupt-parent = <&Cpm_pic>;
-   interrupts = <17 4>;
-   bitbang = [ 12 12 13 02 02 01 ];
-   reg = <3>;
-   device_type = "ethernet-phy";
-   };
+   [EMAIL PROTECTED],0 {
+   compatible = "jedec-flash";
+   reg = <0 0 200>;
+  

[PATCH 26/28] mpc8272ads: Change references from 82xx_ADS to 8272_ADS.

2007-09-17 Thread Scott Wood
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/82xx/mpc8272_ads.c |   26 +-
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c 
b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index b251a55..97d8dc4 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -1,5 +1,5 @@
 /*
- * MPC82xx_ads setup and early boot code plus other random bits.
+ * MPC8272_ads setup and early boot code plus other random bits.
  *
  * Author: Vitaly Bordug <[EMAIL PROTECTED]>
  * m82xx_restart fix by Wade Farnsworth <[EMAIL PROTECTED]>
@@ -63,7 +63,7 @@ static unsigned long pci_int_base;
 static struct irq_host *pci_pic_host;
 #endif
 
-static void __init mpc82xx_ads_pic_init(void)
+static void __init mpc8272_ads_pic_init(void)
 {
struct device_node *np = of_find_compatible_node(NULL, "cpm-pic", 
"CPM2");
struct resource r;
@@ -553,14 +553,14 @@ static void __init mpc82xx_add_bridge(struct device_node 
*np)
 /*
  * Setup the architecture
  */
-static void __init mpc82xx_ads_setup_arch(void)
+static void __init mpc8272_ads_setup_arch(void)
 {
 #ifdef CONFIG_PCI
struct device_node *np;
 #endif
 
if (ppc_md.progress)
-   ppc_md.progress("mpc82xx_ads_setup_arch()", 0);
+   ppc_md.progress("mpc8272_ads_setup_arch()", 0);
cpm2_reset();
 
/* Map I/O region to a 256MB BAT */
@@ -582,13 +582,13 @@ static void __init mpc82xx_ads_setup_arch(void)
 #endif
 
if (ppc_md.progress)
-   ppc_md.progress("mpc82xx_ads_setup_arch(), finish", 0);
+   ppc_md.progress("mpc8272_ads_setup_arch(), finish", 0);
 }
 
 /*
  * Called very early, device-tree isn't unflattened
  */
-static int __init mpc82xx_ads_probe(void)
+static int __init mpc8272_ads_probe(void)
 {
/* We always match for now, eventually we should look at
 * the flat dev tree to ensure this is the board we are
@@ -612,14 +612,14 @@ static void m82xx_restart(char *cmd)
while (1) ;
 }
 
-define_machine(mpc82xx_ads)
+define_machine(mpc8272_ads)
 {
-   .name = "MPC82xx ADS",
-   .probe = mpc82xx_ads_probe,
-   .setup_arch =mpc82xx_ads_setup_arch,
-   .init_IRQ =mpc82xx_ads_pic_init,
-   .show_cpuinfo =mpc82xx_ads_show_cpuinfo,
-   .get_irq =cpm2_get_irq,
+   .name = "MPC8272 ADS",
+   .probe = mpc8272_ads_probe,
+   .setup_arch = mpc8272_ads_setup_arch,
+   .init_IRQ = mpc8272_ads_pic_init,
+   .show_cpuinfo = mpc8272_ads_show_cpuinfo,
+   .get_irq = cpm2_get_irq,
.calibrate_decr = generic_calibrate_decr,
.restart = m82xx_restart,
 };
-- 
1.5.3.1

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


[PATCH 24/28] mpc82xx: Remove a bunch of cruft that duplicates generic functionality.

2007-09-17 Thread Scott Wood
m82xx_calibrate_decr(), mpc82xx_ads_show_cpuinfo(), and mpc82xx_halt() do
anything useful beyond what the generic code does.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/82xx/Makefile  |1 -
 arch/powerpc/platforms/82xx/mpc82xx.c |  109 -
 arch/powerpc/platforms/82xx/mpc82xx_ads.c |   10 +--
 arch/powerpc/platforms/82xx/pq2ads.h  |6 --
 4 files changed, 2 insertions(+), 124 deletions(-)
 delete mode 100644 arch/powerpc/platforms/82xx/mpc82xx.c

diff --git a/arch/powerpc/platforms/82xx/Makefile 
b/arch/powerpc/platforms/82xx/Makefile
index d9fd4c8..534c353 100644
--- a/arch/powerpc/platforms/82xx/Makefile
+++ b/arch/powerpc/platforms/82xx/Makefile
@@ -1,5 +1,4 @@
 #
 # Makefile for the PowerPC 82xx linux kernel.
 #
-obj-$(CONFIG_PPC_82xx) += mpc82xx.o
 obj-$(CONFIG_MPC82xx_ADS) += mpc82xx_ads.o
diff --git a/arch/powerpc/platforms/82xx/mpc82xx.c 
b/arch/powerpc/platforms/82xx/mpc82xx.c
deleted file mode 100644
index c706871..000
--- a/arch/powerpc/platforms/82xx/mpc82xx.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * MPC82xx setup and early boot code plus other random bits.
- *
- * Author: Vitaly Bordug <[EMAIL PROTECTED]>
- *
- * Copyright (c) 2006 MontaVista Software, Inc.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-#include "pq2ads.h"
-
-static int __init get_freq(char *name, unsigned long *val)
-{
-   struct device_node *cpu;
-   const unsigned int *fp;
-   int found = 0;
-
-   /* The cpu node should have timebase and clock frequency properties */
-   cpu = of_find_node_by_type(NULL, "cpu");
-
-   if (cpu) {
-   fp = of_get_property(cpu, name, NULL);
-   if (fp) {
-   found = 1;
-   *val = *fp;
-   }
-
-   of_node_put(cpu);
-   }
-
-   return found;
-}
-
-void __init m82xx_calibrate_decr(void)
-{
-   ppc_tb_freq = 12500;
-   if (!get_freq("bus-frequency", &ppc_tb_freq)) {
-   printk(KERN_ERR "WARNING: Estimating decrementer frequency "
-   "(not found)\n");
-   }
-   ppc_tb_freq /= 4;
-   ppc_proc_freq = 10;
-   if (!get_freq("clock-frequency", &ppc_proc_freq))
-   printk(KERN_ERR "WARNING: Estimating processor frequency"
-   "(not found)\n");
-}
-
-void mpc82xx_ads_show_cpuinfo(struct seq_file *m)
-{
-   uint pvid, svid, phid1;
-   uint memsize = total_memory;
-
-   pvid = mfspr(SPRN_PVR);
-   svid = mfspr(SPRN_SVR);
-
-   seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
-   seq_printf(m, "Machine\t\t: %s\n", CPUINFO_MACHINE);
-   seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
-   seq_printf(m, "SVR\t\t: 0x%x\n", svid);
-
-   /* Display cpu Pll setting */
-   phid1 = mfspr(SPRN_HID1);
-   seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
-
-   /* Display the amount of memory */
-   seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
-}
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c 
b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
index 4008795..b251a55 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
@@ -612,12 +612,6 @@ static void m82xx_restart(char *cmd)
while (1) ;
 }
 
-static void m82xx_halt(void)
-{
-   local_irq_disable();
-   while (1) ;
-}
-
 define_machine(mpc82xx_ads)
 {
.name = "MPC82xx ADS",
@@ -626,6 +620,6 @@ define_machine(mpc82xx_ads)
.init_IRQ =mpc82xx_ads_pic_init,
.show_cpuinfo =mpc82xx_ads_show_cpuinfo,
.get_irq =cpm2_get_irq,
-   .calibrate_decr =m82xx_calibrate_decr,
-   .restart = m82xx_restart,.halt = m82xx_halt,
+   .calibrate_decr = generic_calibrate_decr,
+   .restart = m82xx_restart,
 };
diff --git a/arch/powerpc/platforms/82xx/pq2ads.h 
b/arch/powerpc/platforms/82xx/pq2ads.h
index 6f749b7..8b67048 100644
--- a/arch/powerpc/platforms/82xx/pq2ads.h
+++ b/arch/powerpc/platforms/82xx/pq2ads.h
@@ -24,10 +24,6 @@
 
 #include 
 
-/* For our show_cpuinfo hooks. */
-#define CPUINFO_VENDOR "Freescale Semiconductor"
-#define CPUINFO_MACHINE"PQ2 ADS PowerPC"
-
 /* Backword-compatibility stuff for the drivers */
 #define CPM_MAP_ADDR

[PATCH 07/28] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions.

2007-09-17 Thread Scott Wood
fsl_get_immr() uses /soc/ranges to determine the immr.

mpc885_get_clock() transforms a crystal frequency into a system frequency
according to the PLL register settings.

pq2_get_clocks() does the same as the above for the PowerQUICC II,
except that it produces several different clocks.

The mpc8xx/pq2 set_clocks() functions modify common properties in
the device tree based on the given clock data.

The mpc885/pq2 fixup_clocks() functions call get_clocks(), and
pass the results to set_clocks().

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/Makefile  |2 +-
 arch/powerpc/boot/fsl-soc.c |   57 
 arch/powerpc/boot/fsl-soc.h |8 +++
 arch/powerpc/boot/mpc8xx.c  |   82 ++
 arch/powerpc/boot/mpc8xx.h  |   11 +
 arch/powerpc/boot/pq2.c |  102 +++
 arch/powerpc/boot/pq2.h |   11 +
 7 files changed, 272 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/fsl-soc.c
 create mode 100644 arch/powerpc/boot/fsl-soc.h
 create mode 100644 arch/powerpc/boot/mpc8xx.c
 create mode 100644 arch/powerpc/boot/mpc8xx.h
 create mode 100644 arch/powerpc/boot/pq2.c
 create mode 100644 arch/powerpc/boot/pq2.h

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 9ec785c..932492a 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -45,7 +45,7 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c 
flatdevtree_misc.c \
ns16550.c serial.c simple_alloc.c div64.S util.S \
gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
-   cpm-serial.c stdlib.c planetcore.c
+   cpm-serial.c stdlib.c planetcore.c fsl-soc.c mpc8xx.c pq2.c
 src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
diff --git a/arch/powerpc/boot/fsl-soc.c b/arch/powerpc/boot/fsl-soc.c
new file mode 100644
index 000..b835ed6
--- /dev/null
+++ b/arch/powerpc/boot/fsl-soc.c
@@ -0,0 +1,57 @@
+/*
+ * Freescale SOC support functions
+ *
+ * Author: Scott Wood <[EMAIL PROTECTED]>
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "ops.h"
+#include "types.h"
+#include "fsl-soc.h"
+#include "stdio.h"
+
+static u32 prop_buf[MAX_PROP_LEN / 4];
+
+u32 *fsl_get_immr(void)
+{
+   void *soc;
+   unsigned long ret = 0;
+
+   soc = find_node_by_devtype(NULL, "soc");
+   if (soc) {
+   int size;
+   u32 naddr;
+
+   size = getprop(soc, "#address-cells", prop_buf, MAX_PROP_LEN);
+   if (size == 4)
+   naddr = prop_buf[0];
+   else
+   naddr = 2;
+
+   if (naddr != 1 && naddr != 2)
+   goto err;
+
+   size = getprop(soc, "ranges", prop_buf, MAX_PROP_LEN);
+
+   if (size < 12)
+   goto err;
+   if (prop_buf[0] != 0)
+   goto err;
+   if (naddr == 2 && prop_buf[1] != 0)
+   goto err;
+
+   if (!dt_xlate_addr(soc, prop_buf + naddr, 8, &ret))
+   ret = 0;
+   }
+
+err:
+   if (!ret)
+   printf("fsl_get_immr: Failed to find immr base\r\n");
+
+   return (u32 *)ret;
+}
diff --git a/arch/powerpc/boot/fsl-soc.h b/arch/powerpc/boot/fsl-soc.h
new file mode 100644
index 000..5da26fc
--- /dev/null
+++ b/arch/powerpc/boot/fsl-soc.h
@@ -0,0 +1,8 @@
+#ifndef _PPC_BOOT_FSL_SOC_H_
+#define _PPC_BOOT_FSL_SOC_H_
+
+#include "types.h"
+
+u32 *fsl_get_immr(void);
+
+#endif
diff --git a/arch/powerpc/boot/mpc8xx.c b/arch/powerpc/boot/mpc8xx.c
new file mode 100644
index 000..add55a7
--- /dev/null
+++ b/arch/powerpc/boot/mpc8xx.c
@@ -0,0 +1,82 @@
+/*
+ * MPC8xx support functions
+ *
+ * Author: Scott Wood <[EMAIL PROTECTED]>
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "ops.h"
+#include "types.h"
+#include "fsl-soc.h"
+#include "mpc8xx.h"
+#include "stdio.h"
+#include "io.h"
+
+#define MPC8XX_PLPRCR (0x284/4) /* PLL and Reset Control Register */
+
+/* Return system clock from crystal frequency */
+u32 mpc885_get_clock(u32 crystal)
+{
+   u32 *immr;
+   u32 plprcr;
+   int mfi, mfn, mfd, pdf, div;
+   u32 ret;
+
+   immr = fsl_get_immr();
+   if (!immr) {
+ 

[PATCH 11/28] cpm_uart: Issue STOP_TX command before initializing console.

2007-09-17 Thread Scott Wood
This prevents some bootloader/bootwrapper characters from being lost.

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

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index c43706e..336e05e 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -1325,6 +1325,8 @@ static int __init cpm_uart_console_setup(struct console 
*co, char *options)
udbg_putc = NULL;
 #endif
 
+   cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
+
if (IS_SMC(pinfo)) {
clrbits8(&pinfo->smcp->smc_smcm, SMCM_RX | SMCM_TX);
clrbits16(&pinfo->smcp->smc_smcmr, SMCMR_REN | SMCMR_TEN);
@@ -1346,6 +1348,7 @@ static int __init cpm_uart_console_setup(struct console 
*co, char *options)
cpm_uart_init_scc(pinfo);
 
uart_set_options(port, co, baud, parity, bits, flow);
+   cpm_line_cr_cmd(pinfo, CPM_CR_RESTART_TX);
 
return 0;
 }
-- 
1.5.3.1

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


[PATCH 25/28] mpc82xx: Rename mpc82xx_ads to mpc8272_ads.

2007-09-17 Thread Scott Wood
This is just a rename patch; internal references to mpc82xx_ads will be
changed in the next one.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/82xx/Kconfig|8 
 arch/powerpc/platforms/82xx/Makefile   |2 +-
 .../82xx/{mpc82xx_ads.c => mpc8272_ads.c}  |0 
 3 files changed, 5 insertions(+), 5 deletions(-)
 rename arch/powerpc/platforms/82xx/{mpc82xx_ads.c => mpc8272_ads.c} (100%)

diff --git a/arch/powerpc/platforms/82xx/Kconfig 
b/arch/powerpc/platforms/82xx/Kconfig
index 89fde43..f260c01 100644
--- a/arch/powerpc/platforms/82xx/Kconfig
+++ b/arch/powerpc/platforms/82xx/Kconfig
@@ -1,17 +1,17 @@
 choice
prompt "82xx Board Type"
depends on PPC_82xx
-   default MPC82xx_ADS
+   default MPC8272_ADS
 
-config MPC82xx_ADS
-   bool "Freescale MPC82xx ADS"
+config MPC8272_ADS
+   bool "Freescale MPC8272 ADS"
select DEFAULT_UIMAGE
select PQ2ADS
select 8272
select 8260
select FSL_SOC
help
-   This option enables support for the MPC8272 ADS board
+ This option enables support for the MPC8272 ADS board
 
 endchoice
 
diff --git a/arch/powerpc/platforms/82xx/Makefile 
b/arch/powerpc/platforms/82xx/Makefile
index 534c353..9b7c851 100644
--- a/arch/powerpc/platforms/82xx/Makefile
+++ b/arch/powerpc/platforms/82xx/Makefile
@@ -1,4 +1,4 @@
 #
 # Makefile for the PowerPC 82xx linux kernel.
 #
-obj-$(CONFIG_MPC82xx_ADS) += mpc82xx_ads.o
+obj-$(CONFIG_MPC8272_ADS) += mpc8272_ads.o
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c 
b/arch/powerpc/platforms/82xx/mpc8272_ads.c
similarity index 100%
rename from arch/powerpc/platforms/82xx/mpc82xx_ads.c
rename to arch/powerpc/platforms/82xx/mpc8272_ads.c
-- 
1.5.3.1

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


[PATCH 02/28] Introduce new CPM device bindings.

2007-09-17 Thread Scott Wood
This introduces a new device binding for the CPM and other devices on
these boards.  Some of the changes include:

1. Proper namespace scoping for Freescale compatibles and properties.

2. Use compatible rather than things like device_type and model
to determine which particular variant of a device is present.

3. Give the drivers the relevant CPM command word directly, rather than
requiring it to have a lookup table based on device-id, SCC v. SMC, and
CPM version.

4. Specify the CPCR and the usable DPRAM region in the CPM's reg property.

Boards that do not require the legacy bindings should select
CONFIG_PPC_CPM_NEW_BINDING to enable the of_platform CPM devices. Once
all existing boards are converted and tested, the config option can
become default y to prevent new boards from using the old model.  Once
arch/ppc is gone, the config option can be removed altogether.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |  171 +-
 arch/powerpc/platforms/Kconfig   |   11 ++
 arch/powerpc/sysdev/fsl_soc.c|2 +
 3 files changed, 183 insertions(+), 1 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index 20e0e6c..a599f1a 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1510,7 +1510,10 @@ platforms are moved over to use the 
flattened-device-tree model.
 
i) Freescale QUICC Engine module (QE)
This represents qe module that is installed on PowerQUICC II Pro.
-   Hopefully it will merge backward compatibility with CPM/CPM2.
+
+   NOTE:  This is an interim binding; it should be updated to fit
+   in with the CPM binding later in this document.
+
Basically, it is a bus of devices, that could act more or less
as a complete entity (UCC, USB etc ). All of them should be siblings on
the "root" qe node, using the common properties from there.
@@ -1848,6 +1851,172 @@ platforms are moved over to use the 
flattened-device-tree model.
fsl,has-rstcr;
};
 
+   l) Freescale Communications Processor Module
+
+   NOTE: This is an interim binding, and will likely change slightly,
+   as more devices are supported.  The QE bindings especially are
+   incomplete.
+
+   i) Root CPM node
+
+   Properties:
+   - compatible : "fsl,cpm1", "fsl,cpm2", or "fsl,qe".
+   - reg : The first resource is a 48-byte region beginning with
+   CPCR.  The second is the available general-purpose
+   DPRAM.
+
+   Example:
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   #interrupt-cells = <2>;
+   compatible = "fsl,mpc8272-cpm", "fsl,cpm2";
+   reg = <119c0 30 0 2000>;
+   }
+
+   ii) Properties common to mulitple CPM/QE devices
+
+   - fsl,cpm-command : This value is ORed with the opcode and command flag
+   to specify the device on which a CPM command operates.
+
+   - fsl,cpm-brg : Indicates which baud rate generator the device
+   is associated with.  If absent, an unused BRG
+   should be dynamically allocated.  If zero, the
+   device uses an external clock rather than a BRG.
+
+   - reg : Unless otherwise specified, the first resource represents the
+   scc/fcc/ucc registers, and the second represents the device's
+   parameter RAM region (if it has one).
+
+   iii) Serial
+
+   Currently defined compatibles:
+   - fsl,cpm1-smc-uart
+   - fsl,cpm2-smc-uart
+   - fsl,cpm1-scc-uart
+   - fsl,cpm2-scc-uart
+   - fsl,qe-uart
+
+   Example:
+
+   [EMAIL PROTECTED] {
+   device_type = "serial";
+   compatible = "fsl,mpc8272-scc-uart",
+"fsl,cpm2-scc-uart";
+   reg = <11a00 20 8000 100>;
+   interrupts = <28 8>;
+   interrupt-parent = <&PIC>;
+   fsl,cpm-brg = <1>;
+   fsl,cpm-command = <0080>;
+   };
+
+   iii) Network
+
+   Currently defined compatibles:
+   - fsl,cpm1-scc-enet
+   - fsl,cpm2-scc-enet
+   - fsl,cpm1-fec-enet
+   - fsl,cpm2-fcc-enet (third resource is GFEMR)
+   - fsl,qe-enet
+
+   Example:
+
+   [EMAIL PROTECTED] {
+   device_type = "network";
+   compatible = "fsl,mpc8272-fcc-enet",
+"fsl,cpm2-fcc-enet";
+   reg = <11300 20 8400 100 11390 1>;
+   local-mac-address = [ 00 00 00 00 00 00 ];
+   interrupts = <20 8>;
+   interrupt-parent = <&PIC>;
+   phy-handle = <&PHY0>;
+   linux,network-index = <0>;
+   fsl,cpm-command = <12000300>;
+   };
+
+   iv) MDIO
+
+   Currently defined compatibles:
+   fsl,pq1-fec-mdio (reg is same as first resource of FEC device)
+   fsl,cpm2-mdio-bitbang (reg is port C registe

[PATCH 03/28] Document local bus nodes in the device tree.

2007-09-17 Thread Scott Wood
cuboot-pq2 is updated to match the binding, and get rid of phandle linkage.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |   38 ++
 arch/powerpc/boot/cuboot-pq2.c   |   29 +--
 2 files changed, 46 insertions(+), 21 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index a599f1a..42cbfb0 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -2017,6 +2017,44 @@ platforms are moved over to use the 
flattened-device-tree model.
fsl,cpm-command = <2e60>;
};
 
+   m) Chipselect/Local Bus
+
+   Properties:
+   - name : Should be localbus
+   - #address-cells : Should be either two or three.  The first cell is the
+  chipselect number, and the remaining cells are the
+  offset into the chipselect.
+   - #size-cells : Either one or two, depending on how large each chipselect
+   can be.
+   - ranges : Each range should correspond to a single chipselect, and cover
+  the entire access window as configured.
+
+   Example:
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc8272ads-localbus",
+"fsl,mpc8272-localbus",
+"fsl,pq2-localbus";
+   #address-cells = <2>;
+   #size-cells = <1>;
+   reg = ;
+
+   ranges = <0 0 fe00 0200
+ 1 0 f450 8000>;
+
+   [EMAIL PROTECTED],0 {
+   compatible = "jedec-flash";
+   reg = <0 0 200>;
+   bank-width = <4>;
+   device-width = <1>;
+   };
+
+   [EMAIL PROTECTED],0 {
+   reg = <1 0 20>;
+   compatible = "fsl,mpc8272ads-bcsr";
+   };
+   };
+
+
More devices will be defined as this spec matures.
 
 VII - Specifying interrupt information for devices
diff --git a/arch/powerpc/boot/cuboot-pq2.c b/arch/powerpc/boot/cuboot-pq2.c
index b150bd4..e5d94ff 100644
--- a/arch/powerpc/boot/cuboot-pq2.c
+++ b/arch/powerpc/boot/cuboot-pq2.c
@@ -43,22 +43,21 @@ struct pci_range pci_ranges_buf[MAX_PROP_LEN / 
sizeof(struct pci_range)];
  * some don't set up the PCI PIC at all, so we assume the device tree is
  * sane and update the BRx registers appropriately.
  *
- * For any node defined as compatible with fsl,pq2-chipselect,
- * #address/#size must be 2/1 for chipselect bus, 1/1 for parent bus,
- * and ranges must be for whole chip selects.
+ * For any node defined as compatible with fsl,pq2-localbus,
+ * #address/#size must be 2/1 for the localbus, and 1/1 for the parent bus.
+ * Ranges must be for whole chip selects.
  */
 static void update_cs_ranges(void)
 {
-   u32 ctrl_ph;
-   void *ctrl_node, *bus_node, *parent_node;
+   void *bus_node, *parent_node;
u32 *ctrl_addr;
unsigned long ctrl_size;
u32 naddr, nsize;
int len;
int i;
 
-   bus_node = finddevice("/chipselect");
-   if (!bus_node || !dt_is_compatible(bus_node, "fsl,pq2-chipselect"))
+   bus_node = finddevice("/localbus");
+   if (!bus_node || !dt_is_compatible(bus_node, "fsl,pq2-localbus"))
return;
 
dt_get_reg_format(bus_node, &naddr, &nsize);
@@ -73,19 +72,7 @@ static void update_cs_ranges(void)
if (naddr != 1 || nsize != 1)
goto err;
 
-   len = getprop(bus_node, "fsl,ctrl", &ctrl_ph, 4);
-   if (len != 4)
-   goto err;
-
-   ctrl_node = find_node_by_prop_value(NULL, "linux,phandle",
-   (char *)&ctrl_ph, 4);
-   if (!ctrl_node)
-   goto err;
-
-   if (!dt_is_compatible(ctrl_node, "fsl,pq2-chipselect-ctrl"))
-   goto err;
-
-   if (!dt_xlate_reg(ctrl_node, 0, (unsigned long *)&ctrl_addr,
+   if (!dt_xlate_reg(bus_node, 0, (unsigned long *)&ctrl_addr,
  &ctrl_size))
goto err;
 
@@ -122,7 +109,7 @@ static void update_cs_ranges(void)
return;
 
 err:
-   printf("Bad /chipselect or fsl,pq2-chipselect-ctrl node\r\n");
+   printf("Bad /localbus node\r\n");
 }
 
 /* Older u-boots don't set PCI up properly.  Update the hardware to match
-- 
1.5.3.1

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


[PATCH 05/28] bootwrapper: Support all-in-one PCI nodes in cuboot-pq2.

2007-09-17 Thread Scott Wood
Consensus was reached to put PCI nodes at the root of the tree (and not
under /soc), but the phandle to a control node was rejected in favor of
simply not worrying about /pci/reg overlapping /soc/ranges.

This updates cuboot-82xx to not look for the phandle.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/cuboot-pq2.c |   25 -
 1 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/boot/cuboot-pq2.c b/arch/powerpc/boot/cuboot-pq2.c
index e5d94ff..d78e943 100644
--- a/arch/powerpc/boot/cuboot-pq2.c
+++ b/arch/powerpc/boot/cuboot-pq2.c
@@ -126,11 +126,11 @@ static void fixup_pci(void)
u32 *pci_regs[3];
u8 *soc_regs;
int i, len;
-   void *ctrl_node, *bus_node, *parent_node, *soc_node;
-   u32 naddr, nsize, bus_ph, mem_log2;
+   void *node, *parent_node, *soc_node;
+   u32 naddr, nsize, mem_log2;
 
-   ctrl_node = finddevice("/soc/pci");
-   if (!ctrl_node || !dt_is_compatible(ctrl_node, "fsl,pq2-pci"))
+   node = finddevice("/pci");
+   if (!node || !dt_is_compatible(node, "fsl,pq2-pci"))
return;
 
soc_node = finddevice("/soc");
@@ -138,27 +138,18 @@ static void fixup_pci(void)
goto err;
 
for (i = 0; i < 3; i++)
-   if (!dt_xlate_reg(ctrl_node, i,
+   if (!dt_xlate_reg(node, i,
  (unsigned long *)&pci_regs[i], NULL))
goto err;
 
if (!dt_xlate_reg(soc_node, 0, (unsigned long *)&soc_regs, NULL))
goto err;
 
-   len = getprop(ctrl_node, "fsl,bus", &bus_ph, 4);
-   if (len != 4)
-   goto err;
-
-   bus_node = find_node_by_prop_value(NULL, "linux,phandle",
-  (char *)&bus_ph, 4);
-   if (!bus_node)
-   goto err;
-
-   dt_get_reg_format(bus_node, &naddr, &nsize);
+   dt_get_reg_format(node, &naddr, &nsize);
if (naddr != 3 || nsize != 2)
goto err;
 
-   parent_node = get_parent(bus_node);
+   parent_node = get_parent(node);
if (!parent_node)
goto err;
 
@@ -166,7 +157,7 @@ static void fixup_pci(void)
if (naddr != 1 || nsize != 1)
goto err;
 
-   len = getprop(bus_node, "ranges", pci_ranges_buf,
+   len = getprop(node, "ranges", pci_ranges_buf,
  sizeof(pci_ranges_buf));
 
for (i = 0; i < len / sizeof(struct pci_range); i++) {
-- 
1.5.3.1

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


[PATCH 08/28] bootwrapper: Use fsl_get_immr() in cuboot-pq2.c.

2007-09-17 Thread Scott Wood
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/cuboot-pq2.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/boot/cuboot-pq2.c b/arch/powerpc/boot/cuboot-pq2.c
index d78e943..61574f3 100644
--- a/arch/powerpc/boot/cuboot-pq2.c
+++ b/arch/powerpc/boot/cuboot-pq2.c
@@ -15,6 +15,7 @@
 #include "stdio.h"
 #include "cuboot.h"
 #include "io.h"
+#include "fsl-soc.h"
 
 #define TARGET_CPM2
 #define TARGET_HAS_ETH1
@@ -126,23 +127,20 @@ static void fixup_pci(void)
u32 *pci_regs[3];
u8 *soc_regs;
int i, len;
-   void *node, *parent_node, *soc_node;
+   void *node, *parent_node;
u32 naddr, nsize, mem_log2;
 
node = finddevice("/pci");
if (!node || !dt_is_compatible(node, "fsl,pq2-pci"))
return;
 
-   soc_node = finddevice("/soc");
-   if (!soc_node || !dt_is_compatible(soc_node, "fsl,pq2-soc"))
-   goto err;
-
for (i = 0; i < 3; i++)
if (!dt_xlate_reg(node, i,
  (unsigned long *)&pci_regs[i], NULL))
goto err;
 
-   if (!dt_xlate_reg(soc_node, 0, (unsigned long *)&soc_regs, NULL))
+   soc_regs = (u8 *)fsl_get_immr();
+   if (!soc_regs)
goto err;
 
dt_get_reg_format(node, &naddr, &nsize);
-- 
1.5.3.1

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


[PATCH 23/28] mpc82xx: Define CPU_FTR_NEED_COHERENT

2007-09-17 Thread Scott Wood
The 8272 (and presumably other PCI PQ2 chips) appear to have the
same issue as the 83xx regarding PCI streaming DMA.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 include/asm-powerpc/cputable.h |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index f62cffd..c9b8f64 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -196,12 +196,12 @@ extern void do_feature_fixups(unsigned long value, void 
*fixup_start,
 #define PPC_FEATURE_HAS_EFP_DOUBLE_COMP 0
 #endif
 
-/* We need to mark all pages as being coherent if we're SMP or we
- * have a 74[45]x and an MPC107 host bridge. Also 83xx requires
- * it for PCI "streaming/prefetch" to work properly.
+/* We need to mark all pages as being coherent if we're SMP or we have a
+ * 74[45]x and an MPC107 host bridge. Also 83xx and PowerQUICC II
+ * require it for PCI "streaming/prefetch" to work properly.
  */
 #if defined(CONFIG_SMP) || defined(CONFIG_MPC10X_BRIDGE) \
-   || defined(CONFIG_PPC_83xx)
+   || defined(CONFIG_PPC_83xx) || defined(CONFIG_8260)
 #define CPU_FTR_COMMON  CPU_FTR_NEED_COHERENT
 #else
 #define CPU_FTR_COMMON  0
@@ -313,7 +313,7 @@ extern void do_feature_fixups(unsigned long value, void 
*fixup_start,
CPU_FTR_PPC_LE)
 #define CPU_FTRS_82XX  (CPU_FTR_COMMON | \
CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB)
-#define CPU_FTRS_G2_LE (CPU_FTR_MAYBE_CAN_DOZE | \
+#define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \
CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS)
 #define CPU_FTRS_E300  (CPU_FTR_MAYBE_CAN_DOZE | \
CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \
-- 
1.5.3.1

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


[PATCH 19/28] 8xx: Embedded Planet EP88xC support

2007-09-17 Thread Scott Wood
This board is also resold by Freescale under the names
"QUICCStart MPC885 Evaluation System" and "CWH-PPC-885XN-VE".

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/Makefile|4 +-
 arch/powerpc/boot/dts/ep88xc.dts  |  203 +
 arch/powerpc/boot/ep88xc.c|   54 +++
 arch/powerpc/boot/fixed-head.S|4 +
 arch/powerpc/boot/wrapper |   20 +-
 arch/powerpc/configs/ep88xc_defconfig |  751 +
 arch/powerpc/platforms/8xx/Kconfig|   10 +
 arch/powerpc/platforms/8xx/Makefile   |1 +
 arch/powerpc/platforms/8xx/ep88xc.c   |  176 
 9 files changed, 1216 insertions(+), 7 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/ep88xc.dts
 create mode 100644 arch/powerpc/boot/ep88xc.c
 create mode 100644 arch/powerpc/boot/fixed-head.S
 create mode 100644 arch/powerpc/configs/ep88xc_defconfig
 create mode 100644 arch/powerpc/platforms/8xx/ep88xc.c

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 932492a..5e59db5 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -49,7 +49,8 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c 
flatdevtree_misc.c \
 src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
-   cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c
+   cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c fixed-head.S \
+   ep88xc.c
 src-boot := $(src-wlib) $(src-plat) empty.c
 
 src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -142,6 +143,7 @@ image-$(CONFIG_DEFAULT_UIMAGE)  += uImage
 
 ifneq ($(CONFIG_DEVICE_TREE),"")
 image-$(CONFIG_PPC_8xx)+= cuImage.8xx
+image-$(CONFIG_PPC_EP88XC) += zImage.ep88xc
 image-$(CONFIG_8260)   += cuImage.pq2
 image-$(CONFIG_PPC_83xx)   += cuImage.83xx
 image-$(CONFIG_PPC_85xx)   += cuImage.85xx
diff --git a/arch/powerpc/boot/dts/ep88xc.dts b/arch/powerpc/boot/dts/ep88xc.dts
new file mode 100644
index 000..0406fc5
--- /dev/null
+++ b/arch/powerpc/boot/dts/ep88xc.dts
@@ -0,0 +1,203 @@
+/*
+ * EP88xC Device Tree Source
+ *
+ * Copyright 2006 MontaVista Software, Inc.
+ * Copyright 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+
+/ {
+   model = "EP88xC";
+   compatible = "fsl,ep88xc";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = "cpu";
+   reg = <0>;
+   d-cache-line-size = ;
+   i-cache-line-size = ;
+   d-cache-size = ;
+   i-cache-size = ;
+   timebase-frequency = <0>;
+   bus-frequency = <0>;
+   clock-frequency = <0>;
+   interrupts = ; // decrementer interrupt
+   interrupt-parent = <&PIC>;
+   };
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0 0>;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc885-localbus", "fsl,pq1-localbus";
+   #address-cells = <2>;
+   #size-cells = <1>;
+   reg = ;
+
+   ranges = <
+   0 0 fc00 0400
+   3 0 fa00 0100
+   >;
+
+   [EMAIL PROTECTED],200 {
+   compatible = "cfi-flash";
+   reg = <0 200 200>;
+   bank-width = <4>;
+   device-width = <2>;
+   };
+
+   [EMAIL PROTECTED],40 {
+   reg = <3 40 10>;
+   compatible = "fsl,ep88xc-bcsr";
+   };
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc885", "fsl,pq1-soc";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   device_type = "soc";
+   ranges = <0 fa20 4000>;
+   bus-frequency = <0>;
+
+   // Temporary -- will go away once kernel uses ranges for 
get_immrbase().
+   reg = ;
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc885-fec-mdio", "fsl,pq1-fec-mdio";
+   reg = ;
+   #address-cells = <1>;
+   #size-cells = <0>;

[PATCH 18/28] 8xx: mpc885ads cleanup

2007-09-17 Thread Scott Wood
It now uses the new CPM binding and the generic pin/clock functions, and
has assorted fixes and cleanup.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/mpc885ads.dts  |  195 +++-
 arch/powerpc/configs/mpc885_ads_defconfig|  297 +
 arch/powerpc/platforms/8xx/Kconfig   |1 +
 arch/powerpc/platforms/8xx/mpc885ads.h   |   38 ---
 arch/powerpc/platforms/8xx/mpc885ads_setup.c |  450 +-
 5 files changed, 423 insertions(+), 558 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc885ads.dts 
b/arch/powerpc/boot/dts/mpc885ads.dts
index e9aa9d0..cbcd16f 100644
--- a/arch/powerpc/boot/dts/mpc885ads.dts
+++ b/arch/powerpc/boot/dts/mpc885ads.dts
@@ -2,6 +2,7 @@
  * MPC885 ADS Device Tree Source
  *
  * Copyright 2006 MontaVista Software, Inc.
+ * Copyright 2007 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
@@ -12,7 +13,7 @@
 
 / {
model = "MPC885ADS";
-   compatible = "mpc8xx";
+   compatible = "fsl,mpc885ads";
#address-cells = <1>;
#size-cells = <1>;
 
@@ -23,156 +24,188 @@
PowerPC,[EMAIL PROTECTED] {
device_type = "cpu";
reg = <0>;
-   d-cache-line-size = <20>;   // 32 bytes
-   i-cache-line-size = <20>;   // 32 bytes
-   d-cache-size = <2000>;  // L1, 8K
-   i-cache-size = <2000>;  // L1, 8K
+   d-cache-line-size = ;
+   i-cache-line-size = ;
+   d-cache-size = ;
+   i-cache-size = ;
timebase-frequency = <0>;
bus-frequency = <0>;
clock-frequency = <0>;
interrupts = ; // decrementer interrupt
-   interrupt-parent = <&Mpc8xx_pic>;
+   interrupt-parent = <&PIC>;
};
};
 
memory {
device_type = "memory";
-   reg = < 80>;
+   reg = <0 0>;
};
 
-   [EMAIL PROTECTED] {
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc885-localbus", "fsl,pq1-localbus";
+   #address-cells = <2>;
+   #size-cells = <1>;
+   reg = ;
+
+   ranges = <
+   0 0 fe00 0080
+   1 0 ff08 8000
+   5 0 ff0a 8000
+   >;
+
+   [EMAIL PROTECTED],0 {
+   compatible = "jedec-flash";
+   reg = <0 0 80>;
+   bank-width = <4>;
+   device-width = <1>;
+   };
+
+   [EMAIL PROTECTED],0 {
+   reg = <1 0 20 5 300 4>;
+   compatible = "fsl,mpc885ads-bcsr";
+   };
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc885", "fsl,pq1-soc";
#address-cells = <1>;
#size-cells = <1>;
device_type = "soc";
-   ranges = <0 ff00 0010>;
-   reg = ;
+   ranges = <0 ff00 4000>;
bus-frequency = <0>;
-   [EMAIL PROTECTED] {
-   device_type = "mdio";
-   compatible = "fs_enet";
-   reg = ;
+
+   // Temporary -- will go away once kernel uses ranges for 
get_immrbase().
+   reg = ;
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,mpc885-fec-mdio", "fsl,pq1-fec-mdio";
+   reg = ;
#address-cells = <1>;
#size-cells = <0>;
-   Phy0: [EMAIL PROTECTED] {
+
+   PHY0: [EMAIL PROTECTED] {
reg = <0>;
device_type = "ethernet-phy";
};
-   Phy1: [EMAIL PROTECTED] {
+
+   PHY1: [EMAIL PROTECTED] {
reg = <1>;
device_type = "ethernet-phy";
};
-   Phy2: [EMAIL PROTECTED] {
+
+   PHY2: [EMAIL PROTECTED] {
reg = <2>;
device_type = "ethernet-phy";
};
};
 
-   [EMAIL PROTECTED] {
+   [EMAIL PROTECTED] {
device_type = "network";
-   compatible = "fs_enet";
-   model = "FEC";
-   device-id = <1>;
+

[PATCH 22/28] cpm2: Add cpm2_set_pin().

2007-09-17 Thread Scott Wood
This provides a generic way for board code to set up CPM pins, rather
than directly poking magic values into registers.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/cpm2_common.c |   33 +
 include/asm-powerpc/cpm2.h|9 +
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/cpm2_common.c 
b/arch/powerpc/sysdev/cpm2_common.c
index 9f6ef65..9058da2 100644
--- a/arch/powerpc/sysdev/cpm2_common.c
+++ b/arch/powerpc/sysdev/cpm2_common.c
@@ -418,3 +418,36 @@ void *cpm_dpram_addr(unsigned long offset)
return (void *)(im_dprambase + offset);
 }
 EXPORT_SYMBOL(cpm_dpram_addr);
+
+struct cpm2_ioports {
+   u32 dir, par, sor, odr, dat;
+   u32 res[3];
+};
+
+void cpm2_set_pin(int port, int pin, int flags)
+{
+   struct cpm2_ioports __iomem *iop =
+   (struct cpm2_ioports __iomem *)&cpm2_immr->im_ioport;
+
+   pin = 1 << (31 - pin);
+
+   if (flags & CPM_PIN_OUTPUT)
+   setbits32(&iop[port].dir, pin);
+   else
+   clrbits32(&iop[port].dir, pin);
+
+   if (!(flags & CPM_PIN_GPIO))
+   setbits32(&iop[port].par, pin);
+   else
+   clrbits32(&iop[port].par, pin);
+
+   if (flags & CPM_PIN_SECONDARY)
+   setbits32(&iop[port].sor, pin);
+   else
+   clrbits32(&iop[port].sor, pin);
+
+   if (flags & CPM_PIN_OPENDRAIN)
+   setbits32(&iop[port].odr, pin);
+   else
+   clrbits32(&iop[port].odr, pin);
+}
diff --git a/include/asm-powerpc/cpm2.h b/include/asm-powerpc/cpm2.h
index 41a45db..d7b57ac 100644
--- a/include/asm-powerpc/cpm2.h
+++ b/include/asm-powerpc/cpm2.h
@@ -1247,5 +1247,14 @@ enum cpm_clk {
 extern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode);
 extern int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock);
 
+#define CPM_PIN_INPUT 0
+#define CPM_PIN_OUTPUT1
+#define CPM_PIN_PRIMARY   0
+#define CPM_PIN_SECONDARY 2
+#define CPM_PIN_GPIO  4
+#define CPM_PIN_OPENDRAIN 8
+
+void cpm2_set_pin(int port, int pin, int flags);
+
 #endif /* __CPM2__ */
 #endif /* __KERNEL__ */
-- 
1.5.3.1

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


[PATCH 21/28] cpm2: Add SCCs to cpm2_clk_setup(), and cpm2_smc_clk_setup().

2007-09-17 Thread Scott Wood
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/cpm2_common.c |  100 +++--
 include/asm-powerpc/cpm2.h|5 ++-
 2 files changed, 99 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/sysdev/cpm2_common.c 
b/arch/powerpc/sysdev/cpm2_common.c
index b4d8bd2..9f6ef65 100644
--- a/arch/powerpc/sysdev/cpm2_common.c
+++ b/arch/powerpc/sysdev/cpm2_common.c
@@ -140,7 +140,8 @@ int cpm2_clk_setup(enum cpm_clk_target target, int clock, 
int mode)
cpmux_t __iomem *im_cpmux;
u32 __iomem *reg;
u32 mask = 7;
-   u8 clk_map [24][3] = {
+
+   u8 clk_map[][3] = {
{CPM_CLK_FCC1, CPM_BRG5, 0},
{CPM_CLK_FCC1, CPM_BRG6, 1},
{CPM_CLK_FCC1, CPM_BRG7, 2},
@@ -164,8 +165,40 @@ int cpm2_clk_setup(enum cpm_clk_target target, int clock, 
int mode)
{CPM_CLK_FCC3, CPM_CLK13, 4},
{CPM_CLK_FCC3, CPM_CLK14, 5},
{CPM_CLK_FCC3, CPM_CLK15, 6},
-   {CPM_CLK_FCC3, CPM_CLK16, 7}
-   };
+   {CPM_CLK_FCC3, CPM_CLK16, 7},
+   {CPM_CLK_SCC1, CPM_BRG1, 0},
+   {CPM_CLK_SCC1, CPM_BRG2, 1},
+   {CPM_CLK_SCC1, CPM_BRG3, 2},
+   {CPM_CLK_SCC1, CPM_BRG4, 3},
+   {CPM_CLK_SCC1, CPM_CLK11, 4},
+   {CPM_CLK_SCC1, CPM_CLK12, 5},
+   {CPM_CLK_SCC1, CPM_CLK3, 6},
+   {CPM_CLK_SCC1, CPM_CLK4, 7},
+   {CPM_CLK_SCC2, CPM_BRG1, 0},
+   {CPM_CLK_SCC2, CPM_BRG2, 1},
+   {CPM_CLK_SCC2, CPM_BRG3, 2},
+   {CPM_CLK_SCC2, CPM_BRG4, 3},
+   {CPM_CLK_SCC2, CPM_CLK11, 4},
+   {CPM_CLK_SCC2, CPM_CLK12, 5},
+   {CPM_CLK_SCC2, CPM_CLK3, 6},
+   {CPM_CLK_SCC2, CPM_CLK4, 7},
+   {CPM_CLK_SCC3, CPM_BRG1, 0},
+   {CPM_CLK_SCC3, CPM_BRG2, 1},
+   {CPM_CLK_SCC3, CPM_BRG3, 2},
+   {CPM_CLK_SCC3, CPM_BRG4, 3},
+   {CPM_CLK_SCC3, CPM_CLK5, 4},
+   {CPM_CLK_SCC3, CPM_CLK6, 5},
+   {CPM_CLK_SCC3, CPM_CLK7, 6},
+   {CPM_CLK_SCC3, CPM_CLK8, 7},
+   {CPM_CLK_SCC4, CPM_BRG1, 0},
+   {CPM_CLK_SCC4, CPM_BRG2, 1},
+   {CPM_CLK_SCC4, CPM_BRG3, 2},
+   {CPM_CLK_SCC4, CPM_BRG4, 3},
+   {CPM_CLK_SCC4, CPM_CLK5, 4},
+   {CPM_CLK_SCC4, CPM_CLK6, 5},
+   {CPM_CLK_SCC4, CPM_CLK7, 6},
+   {CPM_CLK_SCC4, CPM_CLK8, 7},
+   };
 
im_cpmux = cpm2_map(im_cpmux);
 
@@ -205,23 +238,80 @@ int cpm2_clk_setup(enum cpm_clk_target target, int clock, 
int mode)
if (mode == CPM_CLK_RX)
shift += 3;
 
-   for (i=0; i<24; i++) {
+   for (i = 0; i < ARRAY_SIZE(clk_map); i++) {
if (clk_map[i][0] == target && clk_map[i][1] == clock) {
bits = clk_map[i][2];
break;
}
}
-   if (i == sizeof(clk_map)/3)
+   if (i == ARRAY_SIZE(clk_map))
ret = -EINVAL;
 
bits <<= shift;
mask <<= shift;
+
out_be32(reg, (in_be32(reg) & ~mask) | bits);
 
cpm2_unmap(im_cpmux);
return ret;
 }
 
+int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock)
+{
+   int ret = 0;
+   int shift;
+   int i, bits = 0;
+   cpmux_t __iomem *im_cpmux;
+   u8 __iomem *reg;
+   u8 mask = 3;
+
+   u8 clk_map[][3] = {
+   {CPM_CLK_SMC1, CPM_BRG1, 0},
+   {CPM_CLK_SMC1, CPM_BRG7, 1},
+   {CPM_CLK_SMC1, CPM_CLK7, 2},
+   {CPM_CLK_SMC1, CPM_CLK9, 3},
+   {CPM_CLK_SMC2, CPM_BRG2, 0},
+   {CPM_CLK_SMC2, CPM_BRG8, 1},
+   {CPM_CLK_SMC2, CPM_CLK4, 2},
+   {CPM_CLK_SMC2, CPM_CLK15, 3},
+   };
+
+   im_cpmux = cpm2_map(im_cpmux);
+
+   switch (target) {
+   case CPM_CLK_SMC1:
+   reg = &im_cpmux->cmx_smr;
+   mask = 3;
+   shift = 4;
+   break;
+   case CPM_CLK_SMC2:
+   reg = &im_cpmux->cmx_smr;
+   mask = 3;
+   shift = 0;
+   break;
+   default:
+   printk(KERN_ERR "cpm2_smc_clock_setup: invalid clock target\n");
+   return -EINVAL;
+   }
+
+   for (i = 0; i < ARRAY_SIZE(clk_map); i++) {
+   if (clk_map[i][0] == target && clk_map[i][1] == clock) {
+   bits = clk_map[i][2];
+   break;
+   }
+   }
+   if (i == ARRAY_SIZE(clk_map))
+   ret = -EINVAL;
+
+   bits <<= shift;
+   mask <<= shift;
+
+   out_8(reg, (in_8(reg) & ~mask) | bits);
+
+   cpm2_unmap(im_cpmux);
+   return ret;
+}
+
 /*
  * dpalloc / dpfree bits.
  */
diff --git a/include/asm-powerpc/cpm2.h b/include/asm-powerpc/cpm2.h
index c036506..41a45db 

[PATCH 20/28] cpm2: Infrastructure code cleanup.

2007-09-17 Thread Scott Wood
Mostly sparse fixes (__iomem annotations, etc); also, cpm2_immr
is used rather than creating many temporary mappings.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/cpm2_common.c |   52 ++--
 arch/powerpc/sysdev/cpm2_pic.c|2 +-
 include/asm-powerpc/cpm2.h|2 +-
 include/asm-powerpc/fs_pd.h   |   19 ++---
 include/asm-powerpc/immap_cpm2.h  |4 ++-
 5 files changed, 45 insertions(+), 34 deletions(-)

diff --git a/arch/powerpc/sysdev/cpm2_common.c 
b/arch/powerpc/sysdev/cpm2_common.c
index 3bf89b3..b4d8bd2 100644
--- a/arch/powerpc/sysdev/cpm2_common.c
+++ b/arch/powerpc/sysdev/cpm2_common.c
@@ -33,6 +33,8 @@
 #include 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 #include 
@@ -45,13 +47,12 @@
 #include 
 
 static void cpm2_dpinit(void);
-cpm_cpm2_t *cpmp;  /* Pointer to comm processor space */
+cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor space */
 
 /* We allocate this here because it is used almost exclusively for
  * the communication processor devices.
  */
-cpm2_map_t *cpm2_immr;
-intctl_cpm2_t *cpm2_intctl;
+cpm2_map_t __iomem *cpm2_immr;
 
 #define CPM_MAP_SIZE   (0x4)   /* 256k - the PQ3 reserve this amount
   of space for CPM as it is larger
@@ -60,8 +61,7 @@ intctl_cpm2_t *cpm2_intctl;
 void
 cpm2_reset(void)
 {
-   cpm2_immr = (cpm2_map_t *)ioremap(CPM_MAP_ADDR, CPM_MAP_SIZE);
-   cpm2_intctl = cpm2_map(im_intctl);
+   cpm2_immr = ioremap(get_immrbase(), CPM_MAP_SIZE);
 
/* Reclaim the DP memory for our use.
 */
@@ -91,7 +91,7 @@ cpm2_reset(void)
 void
 cpm_setbrg(uint brg, uint rate)
 {
-   volatile uint   *bp;
+   u32 __iomem *bp;
 
/* This is good enough to get SMCs running.
*/
@@ -113,7 +113,8 @@ cpm_setbrg(uint brg, uint rate)
 void
 cpm2_fastbrg(uint brg, uint rate, int div16)
 {
-   volatile uint   *bp;
+   u32 __iomem *bp;
+   u32 val;
 
if (brg < 4) {
bp = cpm2_map_size(im_brgc1, 16);
@@ -123,10 +124,11 @@ cpm2_fastbrg(uint brg, uint rate, int div16)
brg -= 4;
}
bp += brg;
-   *bp = ((BRG_INT_CLK / rate) << 1) | CPM_BRG_EN;
+   val = ((BRG_INT_CLK / rate) << 1) | CPM_BRG_EN;
if (div16)
-   *bp |= CPM_BRG_DIV16;
+   val |= CPM_BRG_DIV16;
 
+   out_be32(bp, val);
cpm2_unmap(bp);
 }
 
@@ -135,8 +137,8 @@ int cpm2_clk_setup(enum cpm_clk_target target, int clock, 
int mode)
int ret = 0;
int shift;
int i, bits = 0;
-   cpmux_t *im_cpmux;
-   u32 *reg;
+   cpmux_t __iomem *im_cpmux;
+   u32 __iomem *reg;
u32 mask = 7;
u8 clk_map [24][3] = {
{CPM_CLK_FCC1, CPM_BRG5, 0},
@@ -228,13 +230,33 @@ static spinlock_t cpm_dpmem_lock;
  * until the memory subsystem goes up... */
 static rh_block_t cpm_boot_dpmem_rh_block[16];
 static rh_info_t cpm_dpmem_info;
-static u8* im_dprambase;
+static u8 __iomem *im_dprambase;
 
 static void cpm2_dpinit(void)
 {
-   spin_lock_init(&cpm_dpmem_lock);
+   struct resource r;
+
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+   struct device_node *np;
+
+   np = of_find_compatible_node(NULL, NULL, "fsl,cpm2");
+   if (!np)
+   panic("Cannot find CPM2 node");
 
-   im_dprambase = ioremap(CPM_MAP_ADDR, CPM_DATAONLY_BASE + 
CPM_DATAONLY_SIZE);
+   if (of_address_to_resource(np, 1, &r))
+   panic("Cannot get CPM2 resource 1");
+
+   of_node_put(np);
+#else
+   r.start = CPM_MAP_ADDR + CPM_DATAONLY_BASE;
+   r.end = r.start + CPM_DATAONLY_SIZE - 1;
+#endif
+
+   im_dprambase = ioremap(r.start, r.end - r.start + 1);
+   if (!im_dprambase)
+   panic("Cannot map DPRAM");
+
+   spin_lock_init(&cpm_dpmem_lock);
 
/* initialize the info header */
rh_init(&cpm_dpmem_info, 1,
@@ -248,7 +270,7 @@ static void cpm2_dpinit(void)
 * varies with the processor and the microcode patches activated.
 * But the following should be at least safe.
 */
-   rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
+   rh_attach_region(&cpm_dpmem_info, 0, r.end - r.start + 1);
 }
 
 /* This function returns an index into the DPRAM area.
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index d5b36e0..5fe65b2 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -48,7 +48,7 @@
 #define CPM2_IRQ_PORTC15   48
 #define CPM2_IRQ_PORTC063
 
-static intctl_cpm2_t *cpm2_intctl;
+static intctl_cpm2_t __iomem *cpm2_intctl;
 
 static struct irq_host *cpm2_pic_host;
 #define NR_MASK_WORDS   ((NR_IRQS + 31) / 32)
diff --git a/include/asm-powerpc/cpm2.h b/include/asm-powerpc/cpm2.h
index 12a2860..c036506 100644
--- a/include/asm-powerpc/cpm2.h
+++ b/include/asm-powerpc/cpm2.h
@@ -107,7 

[PATCH 17/28] 8xx: Set initial memory limit.

2007-09-17 Thread Scott Wood
From: John Traill <[EMAIL PROTECTED]>

The 8xx can only support a max of 8M during early boot (it seems a lot of
8xx boards only have 8M so the bug was never triggered), but the early
allocator isn't aware of this.  The following change makes it able to run
with larger memory.

Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/mm/init_32.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index d65995a..e09513a 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -132,6 +132,9 @@ void __init MMU_init(void)
/* 601 can only access 16MB at the moment */
if (PVR_VER(mfspr(SPRN_PVR)) == 1)
__initial_memory_limit = 0x0100;
+   /* 8xx can only access 8MB at the moment */
+   if (PVR_VER(mfspr(SPRN_PVR)) == 0x50)
+   __initial_memory_limit = 0x0080;
 
/* parse args from command line */
MMU_setup();
-- 
1.5.3.1

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


[PATCH 04/28] Add early debug console for CPM serial ports.

2007-09-17 Thread Scott Wood
This code assumes that the ports have been previously set up, with
buffers in DPRAM.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/Kconfig.debug |   21 
 arch/powerpc/kernel/head_32.S  |   16 
 arch/powerpc/kernel/udbg.c |2 +
 arch/powerpc/platforms/8xx/Kconfig |1 +
 arch/powerpc/platforms/Kconfig |4 +++
 arch/powerpc/sysdev/Makefile   |1 +
 arch/powerpc/sysdev/cpm_common.c   |   46 
 include/asm-powerpc/udbg.h |1 +
 8 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/sysdev/cpm_common.c

diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index c38bc22..f4e5d22 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -221,6 +221,15 @@ config PPC_EARLY_DEBUG_44x
  Select this to enable early debugging for IBM 44x chips via the
  inbuilt serial port.
 
+config PPC_EARLY_DEBUG_CPM
+   bool "Early serial debugging for Freescale CPM-based serial ports"
+   depends on SERIAL_CPM
+   select PIN_TLB if PPC_8xx
+   help
+ Select this to enable early debugging for Freescale chips
+ using a CPM-based serial port.  This assumes that the bootwrapper
+ has run, and set up the CPM in a particular way.
+
 endchoice
 
 config PPC_EARLY_DEBUG_44x_PHYSLOW
@@ -233,4 +242,16 @@ config PPC_EARLY_DEBUG_44x_PHYSHIGH
depends PPC_EARLY_DEBUG_44x
default "0x1"
 
+config PPC_EARLY_DEBUG_CPM_ADDR
+   hex "CPM UART early debug transmit descriptor address"
+   depends on PPC_EARLY_DEBUG_CPM
+   default "0xfa202808" if PPC_EP88XC
+   default "0xf808" if CPM2
+   default "0xff002808" if CPM1
+   help
+ This specifies the address of the transmit descriptor
+ used for early debug output.  Because it is needed before
+ platform probing is done, all platforms selected must
+ share the same address.
+
 endmenu
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 12febfe..6bee0a0 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -149,6 +149,9 @@ __after_mmu_off:
 #if defined(CONFIG_BOOTX_TEXT)
bl  setup_disp_bat
 #endif
+#ifdef CONFIG_PPC_EARLY_DEBUG_CPM
+   bl  setup_cpm_bat
+#endif
 
 /*
  * Call setup_cpu for CPU 0 and initialize 6xx Idle
@@ -1245,6 +1248,19 @@ setup_disp_bat:
blr
 #endif /* CONFIG_BOOTX_TEXT */
 
+#ifdef CONFIG_PPC_EARLY_DEBUG_CPM
+setup_cpm_bat:
+   lis r8, 0xf000
+   ori r8, r8, 0x002a
+   mtspr   SPRN_DBAT1L, r8
+
+   lis r11, 0xf000
+   ori r11, r11, (BL_1M << 2) | 2
+   mtspr   SPRN_DBAT1U, r11
+
+   blr
+#endif
+
 #ifdef CONFIG_8260
 /* Jump into the system reset for the rom.
  * We first disable the MMU, and then jump to the ROM reset address.
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 0f9b4ea..d723070 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -54,6 +54,8 @@ void __init udbg_early_init(void)
 #elif defined(CONFIG_PPC_EARLY_DEBUG_44x)
/* PPC44x debug */
udbg_init_44x_as1();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_CPM)
+   udbg_init_cpm();
 #endif
 }
 
diff --git a/arch/powerpc/platforms/8xx/Kconfig 
b/arch/powerpc/platforms/8xx/Kconfig
index 39bb8c5..8ecd01a 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -3,6 +3,7 @@ config FADS
 
 config CPM1
bool
+   select CPM
 
 choice
prompt "8xx Machine Type"
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 7ad7b9c..06eda35 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -277,6 +277,7 @@ config QUICC_ENGINE
 config CPM2
bool
default n
+   select CPM
help
  The CPM2 (Communications Processor Module) is a coprocessor on
  embedded CPUs made by Freescale.  Selecting this option means that
@@ -313,4 +314,7 @@ config FSL_ULI1575
  Freescale reference boards. The boards all use the ULI in pretty
  much the same way.
 
+config CPM
+   bool
+
 endmenu
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 08ce31e..cdf044f 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -34,6 +34,7 @@ endif
 
 # Temporary hack until we have migrated to asm-powerpc
 ifeq ($(ARCH),powerpc)
+obj-$(CONFIG_CPM)  += cpm_common.o
 obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o
 obj-$(CONFIG_8xx)  += mpc8xx_pic.o commproc.o
 obj-$(CONFIG_UCODE_PATCH)  += micropatch.o
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
new file mode 100644
index 000..9daa6ac
--- /dev/null
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -0,0 +1,46 @@
+/*
+ * Common CPM c

[PATCH 16/28] 8xx: Don't call non-existent Soft_emulate_8xx from SoftwareEmulation.

2007-09-17 Thread Scott Wood
On arch/ppc, Soft_emulate_8xx was used when full math emulation was
turned off to emulate a minimal subset of floating point load/store
instructions, to avoid needing a soft-float toolchain.  This function
is called, but not present, on arch/powerpc, causing a build error
if floating point emulation is turned off.

As:
1. soft-float toolchains are now common,
2. partial emulation could mislead someone into thinking they have
a soft-float userspace because things usually work, only to have it
fail when actual FP gets executed under unusual circumstances, and
3. full emulation is still available for those who need to run
non-soft-float userspace,

I'm deleting the call rather than moving Soft_emulate_8xx over to
arch/powerpc.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/traps.c |   16 +++-
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index ccfc99d..7398beb 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -896,9 +896,10 @@ void performance_monitor_exception(struct pt_regs *regs)
 #ifdef CONFIG_8xx
 void SoftwareEmulation(struct pt_regs *regs)
 {
+#ifdef CONFIG_MATH_EMULATION
extern int do_mathemu(struct pt_regs *);
-   extern int Soft_emulate_8xx(struct pt_regs *);
int errcode;
+#endif
 
CHECK_FULL_REGS(regs);
 
@@ -929,18 +930,7 @@ void SoftwareEmulation(struct pt_regs *regs)
}
 
 #else
-   errcode = Soft_emulate_8xx(regs);
-   switch (errcode) {
-   case 0:
-   emulate_single_step(regs);
-   return;
-   case 1:
-   _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
-   return;
-   case -EFAULT:
-   _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
-   return;
-   }
+   _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
 #endif
 }
 #endif /* CONFIG_8xx */
-- 
1.5.3.1

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


[PATCH 13/28] 8xx: Infrastructure code cleanup.

2007-09-17 Thread Scott Wood
1. Keep a global mpc8xx_immr mapping, rather than constantly
creating temporary mappings.
2. Look for new fsl,cpm1 and fsl,cpm1-pic names.
3. Always reset the CPM when not using the udbg console;
this is required in case the firmware initialized a device
that is incompatible with one that the kernel is about to
use.
4. Remove some superfluous casts and header includes.
5. Change a usage of IMAP_ADDR to get_immrbase().
6. Use phys_addr_t, not uint, for dpram_pbase.
7. Various sparse-related fixes, such as __iomem annotations.
8. Remove mpc8xx_show_cpuinfo, which doesn't provide anything
useful beyond the generic cpuinfo handler.
9. Move prototypes for 8xx support functions from board files
to sysdev/commproc.h.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/8xx/m8xx_setup.c  |   90 ++
 arch/powerpc/platforms/8xx/mpc86xads.h   |3 -
 arch/powerpc/platforms/8xx/mpc86xads_setup.c |   10 +---
 arch/powerpc/platforms/8xx/mpc885ads.h   |3 -
 arch/powerpc/platforms/8xx/mpc885ads_setup.c |   11 +---
 arch/powerpc/sysdev/commproc.c   |   67 +++
 arch/powerpc/sysdev/commproc.h   |   12 
 arch/powerpc/sysdev/mpc8xx_pic.c |   19 +++---
 include/asm-powerpc/commproc.h   |4 +-
 include/asm-powerpc/fs_pd.h  |   19 +
 10 files changed, 88 insertions(+), 150 deletions(-)
 create mode 100644 arch/powerpc/sysdev/commproc.h

diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c 
b/arch/powerpc/platforms/8xx/m8xx_setup.c
index b2b98dd..d35eda8 100644
--- a/arch/powerpc/platforms/8xx/m8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/m8xx_setup.c
@@ -10,57 +10,33 @@
  * bootup setup stuff..
  */
 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
-#include 
 
-#include 
-#include 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
 
-#include "sysdev/mpc8xx_pic.h"
+#include 
+#include 
 
 #ifdef CONFIG_PCMCIA_M8XX
 struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops;
 #endif
 
 void m8xx_calibrate_decr(void);
-#ifdef CONFIG_8xx_WDT
-extern void m8xx_wdt_handler_install(bd_t *bp);
-#endif
 extern int cpm_pic_init(void);
 extern int cpm_get_irq(void);
 
 /* A place holder for time base interrupts, if they are ever enabled. */
-irqreturn_t timebase_interrupt(int irq, void * dev)
+static irqreturn_t timebase_interrupt(int irq, void *dev)
 {
printk ("timebase_interrupt()\n");
 
@@ -77,7 +53,7 @@ static struct irqaction tbint_irqaction = {
 void __init __attribute__ ((weak))
 init_internal_rtc(void)
 {
-   sit8xx_t *sys_tmr = (sit8xx_t *) immr_map(im_sit);
+   sit8xx_t __iomem *sys_tmr = immr_map(im_sit);
 
/* Disable the RTC one second and alarm interrupts. */
clrbits16(&sys_tmr->sit_rtcsc, (RTCSC_SIE | RTCSC_ALE));
@@ -116,13 +92,13 @@ static int __init get_freq(char *name, unsigned long *val)
 void __init mpc8xx_calibrate_decr(void)
 {
struct device_node *cpu;
-   cark8xx_t *clk_r1;
-   car8xx_t *clk_r2;
-   sitk8xx_t *sys_tmr1;
-   sit8xx_t *sys_tmr2;
+   cark8xx_t __iomem *clk_r1;
+   car8xx_t __iomem *clk_r2;
+   sitk8xx_t __iomem *sys_tmr1;
+   sit8xx_t __iomem *sys_tmr2;
int irq, virq;
 
-   clk_r1 = (cark8xx_t *) immr_map(im_clkrstk);
+   clk_r1 = immr_map(im_clkrstk);
 
/* Unlock the SCCR. */
out_be32(&clk_r1->cark_sccrk, ~KAPWR_KEY);
@@ -130,7 +106,7 @@ void __init mpc8xx_calibrate_decr(void)
immr_unmap(clk_r1);
 
/* Force all 8xx processors to use divide by 16 processor clock. */
-   clk_r2 = (car8xx_t *) immr_map(im_clkrst);
+   clk_r2 = immr_map(im_clkrst);
setbits32(&clk_r2->car_sccr, 0x0200);
immr_unmap(clk_r2);
 
@@ -164,7 +140,7 @@ void __init mpc8xx_calibrate_decr(void)
 * we guarantee the registers are locked, then we unlock them
 * for our use.
 */
-   sys_tmr1 = (sitk8xx_t *) immr_map(im_sitk);
+   sys_tmr1 = immr_map(im_sitk);
out_be32(&sys_tmr1->sitk_tbscrk, ~KAPWR_KEY);
out_be32(&sys_tmr1->sitk_rtcsck, ~KAPWR_KEY);
out_be32(&sys_tmr1->sitk_tbk, ~KAPWR_KEY);
@@ -184,20 +160,13 @@ void __init mpc8xx_calibrate_decr(void)
virq= irq_of_parse_and_map(cpu, 0);
irq = irq_map[virq].hwirq;
 
-   sys_tmr2 = (sit8xx_t *) immr_map(im_sit);
+   sys_tmr2 = immr_map(im_sit);
out_be16(&sys_tmr2->sit_tbscr, ((1 << (7 - (irq/2))) << 8) |
(TBSCR_TBF | TBSCR_TBE));
immr_unmap(sys_tmr2);
 
if (setup_irq(virq, &tbint_irqaction))
panic("Could not allocate timer IRQ!");
-
-#ifdef CONFIG_8xx_WDT
-   /* Install watchdog timer handler early because it m

[PATCH 15/28] 8xx: Work around CPU15 erratum.

2007-09-17 Thread Scott Wood
The CPU15 erratum on MPC8xx chips can cause incorrect code execution
under certain circumstances, where there is a conditional or indirect
branch in the last word of a page, with a target in the last cache line
of the next page.  This patch implements one of the suggested
workarounds, by forcing a TLB miss whenever execution crosses a page
boundary.  This is done by invalidating the pages before and after the
one being loaded into the TLB in the ITLB miss handler.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/head_8xx.S |6 ++
 arch/powerpc/platforms/8xx/Kconfig |   16 
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 0ad0d17..1cefa84 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -298,6 +298,12 @@ InstructionTLBMiss:
stw r10, 0(r0)
stw r11, 4(r0)
mfspr   r10, SPRN_SRR0  /* Get effective address of fault */
+#ifdef CONFIG_8xx_CPU15
+   addir11, r10, 0x1000
+   tlbie   r11
+   addir11, r10, -0x1000
+   tlbie   r11
+#endif
DO_8xx_CPU6(0x3780, r3)
mtspr   SPRN_MD_EPN, r10/* Have to use MD_EPN for walk, MI_EPN 
can't */
mfspr   r10, SPRN_M_TWB /* Get level 1 table entry address */
diff --git a/arch/powerpc/platforms/8xx/Kconfig 
b/arch/powerpc/platforms/8xx/Kconfig
index 8ecd01a..322b155 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -100,6 +100,22 @@ config 8xx_CPU6
 
  If in doubt, say N here.
 
+config 8xx_CPU15
+   bool "CPU15 Silicon Errata"
+   default y
+   help
+ This enables a workaround for erratum CPU15 on MPC8xx chips.
+ This bug can cause incorrect code execution under certain
+ circumstances.  This workaround adds some overhead (a TLB miss
+ every time execution crosses a page boundary), and you may wish
+ to disable it if you have worked around the bug in the compiler
+ (by not placing conditional branches or branches to LR or CTR
+ in the last word of a page, with a target of the last cache
+ line in the next page), or if you have used some other
+ workaround.
+
+ If in doubt, say Y here.
+
 choice
prompt "Microcode patch selection"
default NO_UCODE_PATCH
-- 
1.5.3.1

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


[PATCH 14/28] 8xx: Add pin and clock setting functions.

2007-09-17 Thread Scott Wood
These let board code set up pins and clocks without having to
put magic numbers directly into the registers.

The clock function is mostly duplicated from the cpm2 version;
hopefully this stuff can be merged at some point.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/commproc.c |  201 
 include/asm-powerpc/commproc.h |   49 ++
 2 files changed, 250 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
index ddfa2e3..e37f0a8 100644
--- a/arch/powerpc/sysdev/commproc.c
+++ b/arch/powerpc/sysdev/commproc.c
@@ -397,3 +397,204 @@ uint cpm_dpram_phys(u8 *addr)
return (dpram_pbase + (uint)(addr - dpram_vbase));
 }
 EXPORT_SYMBOL(cpm_dpram_addr);
+
+struct cpm_ioport16 {
+   __be16 dir, par, sor, dat, intr;
+   __be16 res[3];
+};
+
+struct cpm_ioport32 {
+   __be32 dir, par, sor;
+};
+
+static void cpm1_set_pin32(int port, int pin, int flags)
+{
+   struct cpm_ioport32 __iomem *iop;
+   pin = 1 << (31 - pin);
+
+   if (port == CPM_PORTB)
+   iop = (struct cpm_ioport32 __iomem *)
+ &mpc8xx_immr->im_cpm.cp_pbdir;
+   else
+   iop = (struct cpm_ioport32 __iomem *)
+ &mpc8xx_immr->im_cpm.cp_pedir;
+
+   if (flags & CPM_PIN_OUTPUT)
+   setbits32(&iop->dir, pin);
+   else
+   clrbits32(&iop->dir, pin);
+
+   if (!(flags & CPM_PIN_GPIO))
+   setbits32(&iop->par, pin);
+   else
+   clrbits32(&iop->par, pin);
+
+   if (port == CPM_PORTE) {
+   if (flags & CPM_PIN_SECONDARY)
+   setbits32(&iop->sor, pin);
+   else
+   clrbits32(&iop->sor, pin);
+
+   if (flags & CPM_PIN_OPENDRAIN)
+   setbits32(&mpc8xx_immr->im_cpm.cp_peodr, pin);
+   else
+   clrbits32(&mpc8xx_immr->im_cpm.cp_peodr, pin);
+   }
+}
+
+static void cpm1_set_pin16(int port, int pin, int flags)
+{
+   struct cpm_ioport16 __iomem *iop =
+   (struct cpm_ioport16 __iomem *)&mpc8xx_immr->im_ioport;
+
+   pin = 1 << (15 - pin);
+
+   if (port != 0)
+   iop += port - 1;
+
+   if (flags & CPM_PIN_OUTPUT)
+   setbits16(&iop->dir, pin);
+   else
+   clrbits16(&iop->dir, pin);
+
+   if (!(flags & CPM_PIN_GPIO))
+   setbits16(&iop->par, pin);
+   else
+   clrbits16(&iop->par, pin);
+
+   if (port == CPM_PORTC) {
+   if (flags & CPM_PIN_SECONDARY)
+   setbits16(&iop->sor, pin);
+   else
+   clrbits16(&iop->sor, pin);
+   }
+}
+
+void cpm1_set_pin(enum cpm_port port, int pin, int flags)
+{
+   if (port == CPM_PORTB || port == CPM_PORTE)
+   cpm1_set_pin32(port, pin, flags);
+   else
+   cpm1_set_pin16(port, pin, flags);
+}
+
+int cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode)
+{
+   int shift;
+   int i, bits = 0;
+   u32 __iomem *reg;
+   u32 mask = 7;
+
+   u8 clk_map[][3] = {
+   {CPM_CLK_SCC1, CPM_BRG1, 0},
+   {CPM_CLK_SCC1, CPM_BRG2, 1},
+   {CPM_CLK_SCC1, CPM_BRG3, 2},
+   {CPM_CLK_SCC1, CPM_BRG4, 3},
+   {CPM_CLK_SCC1, CPM_CLK1, 4},
+   {CPM_CLK_SCC1, CPM_CLK2, 5},
+   {CPM_CLK_SCC1, CPM_CLK3, 6},
+   {CPM_CLK_SCC1, CPM_CLK4, 7},
+
+   {CPM_CLK_SCC2, CPM_BRG1, 0},
+   {CPM_CLK_SCC2, CPM_BRG2, 1},
+   {CPM_CLK_SCC2, CPM_BRG3, 2},
+   {CPM_CLK_SCC2, CPM_BRG4, 3},
+   {CPM_CLK_SCC2, CPM_CLK1, 4},
+   {CPM_CLK_SCC2, CPM_CLK2, 5},
+   {CPM_CLK_SCC2, CPM_CLK3, 6},
+   {CPM_CLK_SCC2, CPM_CLK4, 7},
+
+   {CPM_CLK_SCC3, CPM_BRG1, 0},
+   {CPM_CLK_SCC3, CPM_BRG2, 1},
+   {CPM_CLK_SCC3, CPM_BRG3, 2},
+   {CPM_CLK_SCC3, CPM_BRG4, 3},
+   {CPM_CLK_SCC3, CPM_CLK5, 4},
+   {CPM_CLK_SCC3, CPM_CLK6, 5},
+   {CPM_CLK_SCC3, CPM_CLK7, 6},
+   {CPM_CLK_SCC3, CPM_CLK8, 7},
+
+   {CPM_CLK_SCC4, CPM_BRG1, 0},
+   {CPM_CLK_SCC4, CPM_BRG2, 1},
+   {CPM_CLK_SCC4, CPM_BRG3, 2},
+   {CPM_CLK_SCC4, CPM_BRG4, 3},
+   {CPM_CLK_SCC4, CPM_CLK5, 4},
+   {CPM_CLK_SCC4, CPM_CLK6, 5},
+   {CPM_CLK_SCC4, CPM_CLK7, 6},
+   {CPM_CLK_SCC4, CPM_CLK8, 7},
+
+   {CPM_CLK_SMC1, CPM_BRG1, 0},
+   {CPM_CLK_SMC1, CPM_BRG2, 1},
+   {CPM_CLK_SMC1, CPM_BRG3, 2},
+   {CPM_CLK_SMC1, CPM_BRG4, 3},
+   {CPM_CLK_SMC1, CPM_CLK1, 4},
+   {CPM_CLK_SMC1, CPM_CLK2, 5},
+   {CPM_CLK_SMC1, CPM_CLK3, 6},
+

[PATCH 10/28] cpm_uart: sparse fixes

2007-09-17 Thread Scott Wood
Mostly a bunch of direct access to in/out conversions, plus a few
cast removals, __iomem annotations, and miscellaneous cleanup.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/serial/cpm_uart/cpm_uart.h  |   42 +++--
 drivers/serial/cpm_uart/cpm_uart_core.c |  299 ---
 drivers/serial/cpm_uart/cpm_uart_cpm1.c |2 +-
 drivers/serial/cpm_uart/cpm_uart_cpm1.h |   14 +-
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |4 +-
 drivers/serial/cpm_uart/cpm_uart_cpm2.h |   14 +-
 6 files changed, 192 insertions(+), 183 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart.h 
b/drivers/serial/cpm_uart/cpm_uart.h
index 4e1987a..32b9737 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -56,21 +56,21 @@ struct uart_cpm_port {
u16 rx_fifosize;
u16 tx_nrfifos;
u16 tx_fifosize;
-   smc_t   *smcp;
-   smc_uart_t  *smcup;
-   scc_t   *sccp;
-   scc_uart_t  *sccup;
-   volatile cbd_t  *rx_bd_base;
-   volatile cbd_t  *rx_cur;
-   volatile cbd_t  *tx_bd_base;
-   volatile cbd_t  *tx_cur;
+   smc_t __iomem   *smcp;
+   smc_uart_t __iomem  *smcup;
+   scc_t __iomem   *sccp;
+   scc_uart_t __iomem  *sccup;
+   cbd_t __iomem   *rx_bd_base;
+   cbd_t __iomem   *rx_cur;
+   cbd_t __iomem   *tx_bd_base;
+   cbd_t __iomem   *tx_cur;
unsigned char   *tx_buf;
unsigned char   *rx_buf;
u32 flags;
void(*set_lineif)(struct uart_cpm_port *);
u8  brg;
uint dp_addr;
-   void*mem_addr;
+   void*mem_addr;
dma_addr_t   dma_addr;
u32 mem_size;
/* helpers */
@@ -106,34 +106,36 @@ void scc4_lineif(struct uart_cpm_port *pinfo);
 /*
virtual to phys transtalion
 */
-static inline unsigned long cpu2cpm_addr(void* addr, struct uart_cpm_port 
*pinfo)
+static inline unsigned long cpu2cpm_addr(void *addr,
+ struct uart_cpm_port *pinfo)
 {
int offset;
u32 val = (u32)addr;
+   u32 mem = (u32)pinfo->mem_addr;
/* sane check */
-   if (likely((val >= (u32)pinfo->mem_addr)) &&
-   (val<((u32)pinfo->mem_addr + pinfo->mem_size))) {
-   offset = val - (u32)pinfo->mem_addr;
-   return pinfo->dma_addr+offset;
+   if (likely(val >= mem && val < mem + pinfo->mem_size)) {
+   offset = val - mem;
+   return pinfo->dma_addr + offset;
}
/* something nasty happened */
BUG();
return 0;
 }
 
-static inline void *cpm2cpu_addr(unsigned long addr, struct uart_cpm_port 
*pinfo)
+static inline void *cpm2cpu_addr(unsigned long addr,
+ struct uart_cpm_port *pinfo)
 {
int offset;
u32 val = addr;
+   u32 dma = (u32)pinfo->dma_addr;
/* sane check */
-   if (likely((val >= pinfo->dma_addr) &&
-   (val<(pinfo->dma_addr + pinfo->mem_size {
-   offset = val - (u32)pinfo->dma_addr;
-   return (void*)(pinfo->mem_addr+offset);
+   if (likely(val >= dma && val < dma + pinfo->mem_size)) {
+   offset = val - dma;
+   return pinfo->mem_addr + offset;
}
/* something nasty happened */
BUG();
-   return 0;
+   return NULL;
 }
 
 
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index 78171d0..c43706e 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -131,14 +131,14 @@ static int cpm_uart_id2nr(int id)
 static unsigned int cpm_uart_tx_empty(struct uart_port *port)
 {
struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
-   volatile cbd_t *bdp = pinfo->tx_bd_base;
+   cbd_t __iomem *bdp = pinfo->tx_bd_base;
int ret = 0;
 
while (1) {
-   if (bdp->cbd_sc & BD_SC_READY)
+   if (in_be16(&bdp->cbd_sc) & BD_SC_READY)
break;
 
-   if (bdp->cbd_sc & BD_SC_WRAP) {
+   if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP) {
ret = TIOCSER_TEMT;
break;
}
@@ -167,15 +167,15 @@ static unsigned int cpm_uart_get_mctrl(struct uart_port 
*port)
 static void cpm_uart_stop_tx(struct uart_port *port)
 {
struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
-   volatile smc_t *smcp = pinfo->smcp;
-   volatile scc_t *sccp = pinfo->sccp;
+   smc_t __iomem *smcp = pinfo->smcp;
+  

[PATCH 12/28] 8xx: Fix CONFIG_PIN_TLB.

2007-09-17 Thread Scott Wood
1. Move CONSISTENT_START on 8xx so that it doesn't overlap the IMMR mapping.
2. The wrong register was being loaded into SPRN_MD_RPN.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/Kconfig   |1 +
 arch/powerpc/kernel/head_8xx.S |4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 66a3295..2622f04 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -582,6 +582,7 @@ config CONSISTENT_START_BOOL
 
 config CONSISTENT_START
hex "Base virtual address of consistent memory pool" if 
CONSISTENT_START_BOOL
+   default "0xfd00" if (NOT_COHERENT_CACHE && 8xx)
default "0xff10" if NOT_COHERENT_CACHE
 
 config CONSISTENT_SIZE_BOOL
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index a6ecdd6..0ad0d17 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -727,13 +727,13 @@ initial_mmu:
mtspr   SPRN_MD_TWC, r9
li  r11, MI_BOOTINIT/* Create RPN for address 0 */
addis   r11, r11, 0x0080/* Add 8M */
-   mtspr   SPRN_MD_RPN, r8
+   mtspr   SPRN_MD_RPN, r11
 
addis   r8, r8, 0x0080  /* Add 8M */
mtspr   SPRN_MD_EPN, r8
mtspr   SPRN_MD_TWC, r9
addis   r11, r11, 0x0080/* Add 8M */
-   mtspr   SPRN_MD_RPN, r8
+   mtspr   SPRN_MD_RPN, r11
 #endif
 
/* Since the cache is enabled according to the information we
-- 
1.5.3.1

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


[PATCH 09/28] cpm_uart: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.

2007-09-17 Thread Scott Wood
The existing OF glue code was crufty and broken.  Rather than fix it,
it has been removed, and the serial driver now talks to the device tree
directly.

The non-CONFIG_PPC_CPM_NEW_BINDING code can go away once CPM platforms
are dropped from arch/ppc (which will hopefully be soon), and existing
arch/powerpc boards that I wasn't able to test on for this patchset get
converted (which should be even sooner).

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/serial/cpm_uart/cpm_uart.h  |6 +-
 drivers/serial/cpm_uart/cpm_uart_core.c |  241 ---
 drivers/serial/cpm_uart/cpm_uart_cpm1.c |   16 ++-
 drivers/serial/cpm_uart/cpm_uart_cpm1.h |2 +
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |   18 +++-
 drivers/serial/cpm_uart/cpm_uart_cpm2.h |2 +
 6 files changed, 260 insertions(+), 25 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart.h 
b/drivers/serial/cpm_uart/cpm_uart.h
index a8f894c..4e1987a 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -80,14 +80,18 @@ struct uart_cpm_port {
int is_portb;
/* wait on close if needed */
int wait_closing;
+   /* value to combine with opcode to form cpm command */
+   u32 command;
 };
 
+#ifndef CONFIG_PPC_CPM_NEW_BINDING
 extern int cpm_uart_port_map[UART_NR];
+#endif
 extern int cpm_uart_nr;
 extern struct uart_cpm_port cpm_uart_ports[UART_NR];
 
 /* these are located in their respective files */
-void cpm_line_cr_cmd(int line, int cmd);
+void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd);
 int cpm_uart_init_portdesc(void);
 int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
 void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index cefde58..78171d0 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -10,7 +10,7 @@
  *  Maintainer: Kumar Gala ([EMAIL PROTECTED]) (CPM2)
  *  Pantelis Antoniou ([EMAIL PROTECTED]) (CPM1)
  *
- *  Copyright (C) 2004 Freescale Semiconductor, Inc.
+ *  Copyright (C) 2004, 2007 Freescale Semiconductor, Inc.
  *(C) 2004 Intracom, S.A.
  *(C) 2005-2006 MontaVista Software, Inc.
  * Vitaly Bordug <[EMAIL PROTECTED]>
@@ -47,6 +47,11 @@
 #include 
 #include 
 #include 
+#include 
+
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+#include 
+#endif
 
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 #define SUPPORT_SYSRQ
@@ -57,12 +62,6 @@
 
 #include "cpm_uart.h"
 
-/***/
-
-/* Track which ports are configured as uarts */
-int cpm_uart_port_map[UART_NR];
-/* How many ports did we config as uarts */
-int cpm_uart_nr = 0;
 
 /**/
 
@@ -73,6 +72,11 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo);
 
 /**/
 
+#ifndef CONFIG_PPC_CPM_NEW_BINDING
+/* Track which ports are configured as uarts */
+int cpm_uart_port_map[UART_NR];
+/* How many ports did we config as uarts */
+int cpm_uart_nr;
 
 /* Place-holder for board-specific stuff */
 struct platform_device* __attribute__ ((weak)) __init
@@ -119,6 +123,7 @@ static int cpm_uart_id2nr(int id)
/* not found or invalid argument */
return -1;
 }
+#endif
 
 /*
  * Check, if transmit buffers are processed
@@ -232,15 +237,14 @@ static void cpm_uart_enable_ms(struct uart_port *port)
 static void cpm_uart_break_ctl(struct uart_port *port, int break_state)
 {
struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
-   int line = pinfo - cpm_uart_ports;
 
pr_debug("CPM uart[%d]:break ctrl, break_state: %d\n", port->line,
break_state);
 
if (break_state)
-   cpm_line_cr_cmd(line, CPM_CR_STOP_TX);
+   cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
else
-   cpm_line_cr_cmd(line, CPM_CR_RESTART_TX);
+   cpm_line_cr_cmd(pinfo, CPM_CR_RESTART_TX);
 }
 
 /*
@@ -407,7 +411,6 @@ static int cpm_uart_startup(struct uart_port *port)
 {
int retval;
struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
-   int line = pinfo - cpm_uart_ports;
 
pr_debug("CPM uart[%d]:startup\n", port->line);
 
@@ -426,7 +429,7 @@ static int cpm_uart_startup(struct uart_port *port)
}
 
if (!(pinfo->flags & FLAG_CONSOLE))
-   cpm_line_cr_cmd(line,CPM_CR_INIT_TRX);
+   cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
return 0;
 }
 
@@ -442,7 +445,6 @@ inline void cpm_uart_wait_until_send(struct uart_cpm_port 
*pinfo)
 static void cpm_uart_shutdown(struct uart_port *port)
 {
struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
-   int line = pin

[PATCH 06/28] bootwrapper: Add PlanetCore firmware support.

2007-09-17 Thread Scott Wood
This is a library that board code can use to extract information from the
PlanetCore configuration keys.  PlanetCore is used on various boards from
Embedded Planet.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/Makefile |2 +-
 arch/powerpc/boot/planetcore.c |  175 
 arch/powerpc/boot/planetcore.h |   49 +++
 3 files changed, 225 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/planetcore.c
 create mode 100644 arch/powerpc/boot/planetcore.h

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index cffef14..9ec785c 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -45,7 +45,7 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c 
flatdevtree_misc.c \
ns16550.c serial.c simple_alloc.c div64.S util.S \
gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
-   cpm-serial.c stdlib.c
+   cpm-serial.c stdlib.c planetcore.c
 src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
diff --git a/arch/powerpc/boot/planetcore.c b/arch/powerpc/boot/planetcore.c
new file mode 100644
index 000..82d3dbd
--- /dev/null
+++ b/arch/powerpc/boot/planetcore.c
@@ -0,0 +1,175 @@
+/*
+ * PlanetCore configuration data support functions
+ *
+ * Author: Scott Wood <[EMAIL PROTECTED]>
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "stdio.h"
+#include "stdlib.h"
+#include "ops.h"
+#include "planetcore.h"
+#include "io.h"
+
+/* PlanetCore passes information to the OS in the form of
+ * a table of key=value strings, separated by newlines.
+ *
+ * The list is terminated by an empty string (i.e. two
+ * consecutive newlines).
+ *
+ * To make it easier to parse, we first convert all the
+ * newlines into null bytes.
+ */
+
+void planetcore_prepare_table(char *table)
+{
+   do {
+   if (*table == '\n')
+   *table = 0;
+
+   table++;
+   } while (*(table - 1) || *table != '\n');
+
+   *table = 0;
+}
+
+const char *planetcore_get_key(const char *table, const char *key)
+{
+   int keylen = strlen(key);
+
+   do {
+   if (!strncmp(table, key, keylen) && table[keylen] == '=')
+   return table + keylen + 1;
+
+   table += strlen(table) + 1;
+   } while (strlen(table) != 0);
+
+   return NULL;
+}
+
+int planetcore_get_decimal(const char *table, const char *key, u64 *val)
+{
+   const char *str = planetcore_get_key(table, key);
+   if (!str)
+   return 0;
+
+   *val = strtoull(str, NULL, 10);
+   return 1;
+}
+
+int planetcore_get_hex(const char *table, const char *key, u64 *val)
+{
+   const char *str = planetcore_get_key(table, key);
+   if (!str)
+   return 0;
+
+   *val = strtoull(str, NULL, 16);
+   return 1;
+}
+
+static u64 mac_table[4] = {
+   0x,
+   0x0080,
+   0x0040,
+   0x00c0,
+};
+
+void planetcore_set_mac_addrs(const char *table)
+{
+   char addr[4][6];
+   u64 int_addr;
+   u32 i;
+   int j;
+   void *node;
+
+   if (!planetcore_get_hex(table, PLANETCORE_KEY_MAC_ADDR, &int_addr))
+   return;
+
+   for (i = 0; i < 4; i++) {
+   u64 this_dev_addr = int_addr | mac_table[i];
+
+   for (j = 5; j >= 0; j--) {
+   addr[i][j] = this_dev_addr & 0xff;
+   this_dev_addr >>= 8;
+   }
+
+   node = find_node_by_prop_value(NULL, "linux,network-index",
+  (void *)&i, 4);
+   if (node) {
+   printf("ENET%u: local-mac-address <-"
+  " %02x:%02x:%02x:%02x:%02x:%02x\n\r", i,
+  addr[i][0], addr[i][1], addr[i][2],
+  addr[i][3], addr[i][4], addr[i][5]);
+
+   setprop(node, "local-mac-address", addr[i], 6);
+   }
+   }
+}
+
+static char prop_buf[MAX_PROP_LEN];
+
+void planetcore_set_stdout_path(const char *table)
+{
+   char *path;
+   const char *label;
+   void *node, *chosen;
+
+   label = planetcore_get_key(table, PLANETCORE_KEY_SERIAL_PORT);
+   if (!label)
+   return;
+
+   node = find_node_by_prop_value_str(NULL, "linux,planetcore-label",
+  label);
+   if (!node)
+   retu

[PATCH 01/28] CPM: Change from fsl,brg-frequency to brg/clock-frequency

2007-09-17 Thread Scott Wood
As suggested by David Gibson, now that we have a separate node
for the baud rate generators, it's better to use the standard
clock-frequency property than a cpm-node-level fsl,brg-frequency
property.

This patch updates existing places where fsl,brg-frequency is
used.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/cuboot-8xx.c |8 +---
 arch/powerpc/boot/cuboot-pq2.c |8 +---
 arch/powerpc/sysdev/fsl_soc.c  |   24 ++--
 3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/boot/cuboot-8xx.c b/arch/powerpc/boot/cuboot-8xx.c
index 88ed840..0e82015 100644
--- a/arch/powerpc/boot/cuboot-8xx.c
+++ b/arch/powerpc/boot/cuboot-8xx.c
@@ -29,10 +29,12 @@ static void platform_fixups(void)
dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 16, bd.bi_busfreq);
 
node = finddevice("/soc/cpm");
-   if (node) {
+   if (node)
setprop(node, "clock-frequency", &bd.bi_busfreq, 4);
-   setprop(node, "fsl,brg-frequency", &bd.bi_busfreq, 4);
-   }
+
+   node = finddevice("/soc/cpm/brg");
+   if (node)
+   setprop(node, "clock-frequency",  &bd.bi_busfreq, 4);
 }
 
 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
diff --git a/arch/powerpc/boot/cuboot-pq2.c b/arch/powerpc/boot/cuboot-pq2.c
index 8021fd4..b150bd4 100644
--- a/arch/powerpc/boot/cuboot-pq2.c
+++ b/arch/powerpc/boot/cuboot-pq2.c
@@ -264,10 +264,12 @@ static void pq2_platform_fixups(void)
dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
 
node = finddevice("/soc/cpm");
-   if (node) {
+   if (node)
setprop(node, "clock-frequency", &bd.bi_cpmfreq, 4);
-   setprop(node, "fsl,brg-frequency", &bd.bi_brgfreq, 4);
-   }
+
+   node = finddevice("/soc/cpm/brg");
+   if (node)
+   setprop(node, "clock-frequency",  &bd.bi_brgfreq, 4);
 
update_cs_ranges();
fixup_pci();
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index d028e8d..3052366 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -73,22 +73,26 @@ static u32 brgfreq = -1;
 u32 get_brgfreq(void)
 {
struct device_node *node;
+   const unsigned int *prop;
+   int size;
 
if (brgfreq != -1)
return brgfreq;
 
-   node = of_find_compatible_node(NULL, NULL, "fsl,cpm1");
-   if (!node)
-   node = of_find_compatible_node(NULL, NULL, "fsl,cpm2");
-   if (!node)
-   node = of_find_node_by_type(NULL, "cpm");
+   node = of_find_compatible_node(NULL, NULL, "fsl,cpm-brg");
if (node) {
-   int size;
-   const unsigned int *prop;
+   prop = of_get_property(node, "clock-frequency", &size);
+   if (prop && size == 4)
+   brgfreq = *prop;
 
-   prop = of_get_property(node, "fsl,brg-frequency", &size);
-   if (!prop)
-   prop = of_get_property(node, "brg-frequency", &size);
+   of_node_put(node);
+   return brgfreq;
+   }
+
+   /* Legacy device binding -- will go away when no users are left. */
+   node = of_find_node_by_type(NULL, "cpm");
+   if (node) {
+   prop = of_get_property(node, "brg-frequency", &size);
if (prop && size == 4)
brgfreq = *prop;
 
-- 
1.5.3.1

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


[PATCH 00/28] 8xx/82xx patches

2007-09-17 Thread Scott Wood
This is the latest set of 8xx/82xx patches; please apply for 2.6.24.

Kumar, sorry if you got this twice, but my mailer was misconfigured last
time, and thus it didn't get to the list.

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


Re: [PATCH 09/10] ppc64: Convert cpu_sibling_map to a per_cpu data array (v3)

2007-09-17 Thread Mike Travis
Stephen Rothwell wrote:
> On Tue, 11 Sep 2007 18:56:53 -0700 [EMAIL PROTECTED] wrote:
>> Convert cpu_sibling_map to a per_cpu cpumask_t array for the ppc64
>> architecture.  This fixes build errors in block/blktrace.c and
>> kernel/sched.c when CONFIG_SCHED_SMT is defined.
>>
>> Note: these changes have not been built nor tested.
> 
> After applying all 10 patches, the ppc64_defconfig builds but:
> 
>   vmlinux is larger:
> 
>textdata bss dec hex filename
> 7705776 1756984  504624 9967384  981718 ppc64/vmlinux
> 7706228 1757120  504624 9967972  981964 trav.bld/vmlinux
> 
>   the topology (on my POWERPC5+ box) is not correct:
> 
> cpu0/topology/thread_siblings:000f
> cpu1/topology/thread_siblings:000f
> cpu2/topology/thread_siblings:000f
> cpu3/topology/thread_siblings:000f
> 
> it used to be:
> 
> cpu0/topology/thread_siblings:0003
> cpu1/topology/thread_siblings:0003
> cpu2/topology/thread_siblings:000c
> cpu3/topology/thread_siblings:000c
> 
> Similarly on my iSeries box, the topology is displayed as above
> while it used to be:
> 
> cpu0/topology/thread_siblings:0001
> cpu1/topology/thread_siblings:0002
> cpu2/topology/thread_siblings:0004
> cpu3/topology/thread_siblings:0008
> 

Thanks Stephen for the feedback.  It may be the same situation
that some of the other arch's encounter in that the per_cpu
area is being accessed before it's setup.  I'll investigate
that a bit more.

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


Re: CONFIG_BLK_DEV_BSG=n

2007-09-17 Thread David Howells

James Bottomley <[EMAIL PROTECTED]> wrote:

> > Which solution would you be more comfortable with?
> 
> The one which is currently in -mm is this one:
> 
> http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=49892223f7d3a2333ef9e6cbdd526676e1fc517a

In my opinion, this is the wrong fix.  There shouldn't be anything in the
kernel using stuff from bsg.h if CONFIG_BLOCK=n, so there should be an error if
anything tries to.  The correct fix is to exclude the non-userspace-visible
contents of bsg.h with #ifdef CONFIG_BLOCK, not to declare things that we've
tried to make sure specifically aren't declared.

David
---

[PATCH] VFS: Make BSG declarations dependent on CONFIG_BLOCK

From: David Howells <[EMAIL PROTECTED]>

Make BSG function declarations dependent on CONFIG_BLOCK as they are not
compilable if the block layer is compiled out.

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

 include/linux/bsg.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index 60e377b..28f5d44 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -52,6 +52,7 @@ struct sg_io_v4 {
 };
 
 #ifdef __KERNEL__
+#ifdef CONFIG_BLOCK
 
 #if defined(CONFIG_BLK_DEV_BSG)
 struct bsg_class_device {
@@ -73,6 +74,7 @@ static inline void bsg_unregister_queue(struct request_queue 
*rq)
 }
 #endif
 
+#endif /* CONFIG_BLOCK */
 #endif /* __KERNEL__ */
 
 #endif
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/3] usb: add device-tree-aware ehci driver

2007-09-17 Thread Josh Boyer
On Mon, 17 Sep 2007 23:28:09 +1000
Stephen Rothwell <[EMAIL PROTECTED]> wrote:

> On Mon, 17 Sep 2007 16:55:43 +0400 Valentine Barshak <[EMAIL PROTECTED]> 
> wrote:
> >
> > +++ linux-2.6/drivers/usb/host/ehci-ppc-of.c2007-09-15 
> > 16:12:56.0 +0400
> > @@ -0,0 +1,220 @@
> > +
> > +#include 
> > +#include 
> 
> Please use linux/of.h and linux/of_platform.h instead.

This seems to be a common error these days.  Perhaps a #warning in the
asm/ files if _LINUX_OF_PLATFORM_H and _LINUX_OF_H aren't defined would
be helpful.

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


Re: [PATCH 1/3] usb: add device-tree-aware ehci driver

2007-09-17 Thread Stephen Rothwell
On Mon, 17 Sep 2007 16:55:43 +0400 Valentine Barshak <[EMAIL PROTECTED]> wrote:
>
> +++ linux-2.6/drivers/usb/host/ehci-ppc-of.c  2007-09-15 16:12:56.0 
> +0400
> @@ -0,0 +1,220 @@
> +
> +#include 
> +#include 

Please use linux/of.h and linux/of_platform.h instead.

> +static int ehci_hcd_ppc_of_shutdown(struct of_device *op)
> +{
> + struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
> +
> +if (hcd->driver->shutdown)
> +hcd->driver->shutdown(hcd);

White space has gone a bit funny here.

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


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

[PATCH 2/3] usb: ehci-ppc-of dts bindings.

2007-09-17 Thread Valentine Barshak
Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |   30 +++
 1 file changed, 30 insertions(+)

diff -ruN linux-2.6.orig/Documentation/powerpc/booting-without-of.txt 
linux-2.6.new/Documentation/powerpc/booting-without-of.txt
--- linux-2.6.orig/Documentation/powerpc/booting-without-of.txt 2007-09-15 
14:27:57.0 +0400
+++ linux-2.6.new/Documentation/powerpc/booting-without-of.txt  2007-09-15 
17:19:06.0 +0400
@@ -52,6 +52,7 @@
   i) Freescale QUICC Engine module (QE)
   j) CFI or JEDEC memory-mapped NOR flash
   k) Global Utilities Block
+  l) USB EHCI controllers
 
   VII - Specifying interrupt information for devices
 1) interrupts property
@@ -1848,6 +1849,35 @@
fsl,has-rstcr;
};
 
+  l) USB EHCI controllers
+
+  Required properties:
+  - device_type : should be "usb".
+  - compatible : should be "ehci".
+  - reg : Offset and length of the register set for the device
+  - interrupts :  where a is the interrupt number and b is a
+field that represents an encoding of the sense and level
+information for the interrupt.  This should be encoded based on
+the information in section 2) depending on the type of interrupt
+controller you have.
+  - interrupt-parent : the phandle for the interrupt controller that
+services interrupts for this device.
+  If device registers are implemented in big endian mode, the device
+  node should have "big-endian" property.
+  If controller implementation operates with big endian descriptors,
+  compatible should also have "ehci-be-desc"
+
+   Example (Sequoia 440EPx):
+   [EMAIL PROTECTED] {
+   device_type = "usb";
+   compatible = "ibm,ehci-440epx", "ehci-be-desc", "ehci";
+   interrupts = <1a 4>;
+   interrupt-parent = <&UIC0>;
+   reg = <0 e300 ff>;
+   big-endian;
+   };
+
+
More devices will be defined as this spec matures.
 
 VII - Specifying interrupt information for devices
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/3] Add PowerPC 440EPx Sequoia ehci dts entry.

2007-09-17 Thread Valentine Barshak
The patch adds usb ehci entry to PowerPC440EPx Sequoia DTS.

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

diff -ruN linux-2.6.orig/arch/powerpc/boot/dts/sequoia.dts 
linux-2.6/arch/powerpc/boot/dts/sequoia.dts
--- linux-2.6.orig/arch/powerpc/boot/dts/sequoia.dts2007-09-15 
14:28:06.0 +0400
+++ linux-2.6/arch/powerpc/boot/dts/sequoia.dts 2007-09-15 16:20:19.0 
+0400
@@ -122,6 +122,15 @@
interrupt-map-mask = ;
};
 
+   USB0: [EMAIL PROTECTED] {
+   device_type = "usb";
+   compatible = "ibm,ehci-440epx", "ehci-be-desc", "ehci";
+   interrupt-parent = <&UIC0>;
+   interrupts = <1a 4>;
+   reg = <0 e300 ff>;
+   big-endian;
+   };
+
POB0: opb {
compatible = "ibm,opb-440epx", "ibm,opb";
#address-cells = <1>;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/3] usb: add device-tree-aware ehci driver

2007-09-17 Thread Valentine Barshak
This adds ehci-ppc-of driver. The code is based on the
ehci-ppc-soc driver by Stefan Roese <[EMAIL PROTECTED]>.

Signed-off-by: Stefan Roese <[EMAIL PROTECTED]>
Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 drivers/usb/host/Kconfig   |8 +
 drivers/usb/host/ehci-hcd.c|   16 ++
 drivers/usb/host/ehci-ppc-of.c |  220 +
 drivers/usb/host/ehci.h|2 
 4 files changed, 244 insertions(+), 2 deletions(-)

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

[PATCH 0/3] usb: ehci ppc device-tree-aware driver

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

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


Re: [PATCH] fix xmon input on 440

2007-09-17 Thread Milton Miller
On Sat Sep 15 06:44:47 EST 2007, Hollis Blanchard wrote:

> Implement udbg_getc() for 440, which fixes xmon input.
> Signed-off-by: Hollis Blanchard 

> udbg_putc = udbg_44x_as1_putc;
> +   udbg_getc = udbg_44x_as1_getc;

How about adding udbg_getc_poll as well?

While there are no in-tree users, we can use it for console input later.

milton

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


Re: [PATCH] [POWERPC] Remove unused variabls from drivers/ide/ppc/pmac.c

2007-09-17 Thread Bartlomiej Zolnierkiewicz
On Monday 17 September 2007, Stephen Rothwell wrote:
> Removes these warnings:
> 
> /home/sfr/kernels/linus/drivers/ide/ppc/pmac.c: In function 
> 'pmac_ide_dma_check':
> /home/sfr/kernels/linus/drivers/ide/ppc/pmac.c:1807: warning: unused variable 
> 'map'
> /home/sfr/kernels/linus/drivers/ide/ppc/pmac.c:1805: warning: unused variable 
> 'pmif'
> 
> Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>

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


Re: [PATCH] fix xmon input on 440

2007-09-17 Thread Josh Boyer
On Sun, 2007-09-16 at 23:15 -0500, Hollis Blanchard wrote:
> On Sun, 2007-09-16 at 22:39 -0500, Olof Johansson wrote:
> > On Sun, Sep 16, 2007 at 10:26:37PM -0500, Josh Boyer wrote:
> > > On Mon, 2007-09-17 at 12:52 +1000, David Gibson wrote:
> > > > On Fri, Sep 14, 2007 at 03:44:47PM -0500, Hollis Blanchard wrote:
> > > > > Implement udbg_getc() for 440, which fixes xmon input.
> > > > > Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
> > > > Acked-by: David Gibson <[EMAIL PROTECTED]>
> > > > 
> > > 
> > > I fixed up the whitespace issues and applied it to my tree.  Oh, and
> > > comments don't need semi-colons ;)
> > 
> > Well, there's a big difference between:
> > 
> > while (foo)
> > /* moof */;
> > return bar;
> > 
> > and:
> > while (foo)
> > /* moof */
> > return bar;
> 
> Right, so this commit is broken:
> http://git.infradead.org/?p=users/jwboyer/powerpc.git;a=commitdiff;h=81ec428065c01e37fb143ad31dc04fea27fddcac

Yes, it is.  I realized that right as I was going to bed.  I've pushed a
new commit instead.

http://git.infradead.org/?p=users/jwboyer/powerpc.git;a=commitdiff;h=88305119ccab262897ddbbceeb5a1f725f2b60fa

josh

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


Re: [PATCH 4/7] powerpc: BestComm core support for Freescale MPC5200

2007-09-17 Thread Matt Sealey
My only nitpick is the function naming.

Why not bestcomm_blah() rather than bcom_blah()?

I also think, even though the SRAM functionality is dependant
on BestComm (it's hard to seperate into another driver because
of kernel driver init order being 'random'?) it should be named
after the chip and not the DMA unit - the SRAM can be used for
pretty much anything a developer wants.

For instance, you could allocate it for the power management
code, or simply as some kind of buffer between a PIO managed
port if you do not want to use main memory for some reason.
On the MPC5121E it looks like AXE (audio DSP) and certain other
components will be sharing SRAM with BestComm and there will
be a good deal more of it.

Just looking to the future on some code sharing, because of
the above.

On a lighter note (not something that should block these
patches), would it be a good idea perhaps to abstract SRAM
allocations into a driver class of it's own in this same
way? Nearly every SoC has some kind of built-in SRAM and
even some Northbridges (Marvell Discovery) - ostensibly for
peripheral buffers like ethernet and so on, they can still
be used for anything. Couldn't it be a library or driver
simply with a custom init/teardown function (platform
specific)? I suppose the fact that SRAM could be probed
after BestComm or other peripherals is the problem here,
but there is a platform device for Pegasos ethernet which
modifies Discovery SRAM parameters.. I suppose this is
what I am thinking of getting rid of and allowing code
to be shared and SRAM allocation and usage becoming more
of a tool for other devices and drivers to use, and not
simply something claimed/controlled by BestComm or Ethernet,
and occasionally hijacked by something else.

-- 
Matt Sealey <[EMAIL PROTECTED]>
Genesi, Manager, Developer Relations

Sylvain Munaut wrote:
> This patch adds support for the core of the BestComm API
> for the Freescale MPC5200(b). The BestComm engine is a
> microcode-controlled / tasks-based DMA used by several
> of the onchip devices.
> 
> Setting up the tasks / memory allocation and all common
> low level functions are handled by this patch.
> The specifics details of each tasks and their microcode
> are split-out in separate patches.
> 
> This is not the official API, but a much cleaner one.
> (hopefully)
> 
> Signed-off-by: Sylvain Munaut <[EMAIL PROTECTED]>
> ---
>  arch/powerpc/platforms/Kconfig   |2 +
>  arch/powerpc/sysdev/Makefile |1 +
>  arch/powerpc/sysdev/bestcomm/Kconfig |   18 +
>  arch/powerpc/sysdev/bestcomm/Makefile|8 +
>  arch/powerpc/sysdev/bestcomm/bestcomm.c  |  657 
> ++
>  arch/powerpc/sysdev/bestcomm/bestcomm.h  |  136 ++
>  arch/powerpc/sysdev/bestcomm/bestcomm_priv.h |  325 +
>  arch/powerpc/sysdev/bestcomm/sram.c  |  177 +++
>  arch/powerpc/sysdev/bestcomm/sram.h  |   54 +++
>  9 files changed, 1378 insertions(+), 0 deletions(-)
>  create mode 100644 arch/powerpc/sysdev/bestcomm/Kconfig
>  create mode 100644 arch/powerpc/sysdev/bestcomm/Makefile
>  create mode 100644 arch/powerpc/sysdev/bestcomm/bestcomm.c
>  create mode 100644 arch/powerpc/sysdev/bestcomm/bestcomm.h
>  create mode 100644 arch/powerpc/sysdev/bestcomm/bestcomm_priv.h
>  create mode 100644 arch/powerpc/sysdev/bestcomm/sram.c
>  create mode 100644 arch/powerpc/sysdev/bestcomm/sram.h
> 
> diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
> index 9189ba5..99d48be 100644
> --- a/arch/powerpc/platforms/Kconfig
> +++ b/arch/powerpc/platforms/Kconfig
> @@ -293,4 +293,6 @@ config FSL_ULI1575
> Freescale reference boards. The boards all use the ULI in pretty
> much the same way.
>  
> +source "arch/powerpc/sysdev/bestcomm/Kconfig"
> +
>  endmenu
> diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
> index 08ce31e..0c8a29d 100644
> --- a/arch/powerpc/sysdev/Makefile
> +++ b/arch/powerpc/sysdev/Makefile
> @@ -15,6 +15,7 @@ obj-$(CONFIG_FSL_SOC)   += fsl_soc.o
>  obj-$(CONFIG_FSL_PCI)+= fsl_pci.o
>  obj-$(CONFIG_TSI108_BRIDGE)  += tsi108_pci.o tsi108_dev.o
>  obj-$(CONFIG_QUICC_ENGINE)   += qe_lib/
> +obj-$(CONFIG_PPC_BESTCOMM)   += bestcomm/
>  mv64x60-$(CONFIG_PCI)+= mv64x60_pci.o
>  obj-$(CONFIG_MV64X60)+= $(mv64x60-y) mv64x60_pic.o 
> mv64x60_dev.o
>  obj-$(CONFIG_RTC_DRV_CMOS)   += rtc_cmos_setup.o
> diff --git a/arch/powerpc/sysdev/bestcomm/Kconfig 
> b/arch/powerpc/sysdev/bestcomm/Kconfig
> new file mode 100644
> index 000..3366e24
> --- /dev/null
> +++ b/arch/powerpc/sysdev/bestcomm/Kconfig
> @@ -0,0 +1,18 @@
> +#
> +# Kconfig options for Bestcomm
> +#
> +
> +config PPC_BESTCOMM
> + tristate "Bestcomm DMA engine support"
> + depends on PPC_MPC52xx
> + default n
> + select PPC_LIB_RHEAP
> + help
> +   BestComm is the name of the communication coprocessor found
> +   on 

Re: SYSFS: need a noncaching read

2007-09-17 Thread Tejun Heo
Greg KH wrote:
> On Wed, Sep 12, 2007 at 07:32:07AM +0200, Robert Schwebel wrote:
>> On Tue, Sep 11, 2007 at 11:43:17AM +0200, Heiko Schocher wrote:
>>> I have developed a device driver and use the sysFS to export some
>>> registers to userspace.
>> Uuuh, uggly. Don't do that. Device drivers are there to abstract things,
>> not to play around with registers from userspace.
>>
>>> I opened the sysFS File for one register and did some reads from this
>>> File, but I alwas becoming the same value from the register, whats not
>>> OK, because they are changing. So I found out that the sysFS caches
>>> the reads ... :-(
>> Yes, it does. What you can do is close()ing the file handle between
>> accesses, which makes it work but is slow.
> 
> Do an lseek back to 0 and then re-read, you will get called in your
> driver again.

There should be an intervening sysfs_notify() call from kernel side to
make sysfs re-populate its cache on read again.  sysfs bin files buffer
the result but don't cache the result but this again doesn't really fit
the usage case.

Thanks.

-- 
tejun

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