* Re: [PATCH v2] [POWERPC] Update MPC8610 HPCD to support audio drivers
From: Liam Girdwood @ 2008-01-08 12:39 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev, alsa-devel, Timur Tabi
In-Reply-To: <20080108115654.d0ac909b.sfr@canb.auug.org.au>
On Tue, 2008-01-08 at 11:56 +1100, Stephen Rothwell wrote:
> Hi Timur,
>
> On Mon, 7 Jan 2008 12:56:43 -0600 Timur Tabi <timur@freescale.com> wrote:
> >
> > +++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
> > @@ -34,9 +34,27 @@
> >
> > #include <asm/mpic.h>
> >
> > +#include <linux/of_platform.h>
> > #include <sysdev/fsl_pci.h>
> > #include <sysdev/fsl_soc.h>
> >
> > +static struct of_device_id mpc8610_ids[] = {
>
> __initdata
>
> > + { .compatible = "fsl,mpc8610", },
> > + {}
> > +};
> > +
> > +static int __init mpc8610_declare_of_platform_devices(void)
> > +{
> > + if (!machine_is(mpc86xx_hpcd))
> > + return 0;
> > +
> > + /* Without this call, the SSI device driver won't get probed. */
> > + of_platform_bus_probe(NULL, mpc8610_ids, NULL);
> > +
> > + return 0;
> > +}
> > +device_initcall(mpc8610_declare_of_platform_devices);
>
> We have machine_device_initcall for this now.
>
Now changed in ASoC dev branch.
Liam
^ permalink raw reply
* Re: [PATCH 0/2] ASoC drivers for the Freescale MPC8610 SoC
From: Liam Girdwood @ 2008-01-08 12:38 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, alsa-devel
In-Reply-To: <1199732204949-git-send-email-timur@freescale.com>
On Mon, 2008-01-07 at 12:56 -0600, Timur Tabi wrote:
> These patches add ALSA SoC device drivers for the Freescale MPC8610 SoC
> and the MPC8610-HPCD reference board.
>
> The first patch updates some files in arch/powerpc and booting-without-of.txt.
>
> The second patch adds the new audio driver files to sound/soc.
>
> Both must be applied in order to avoid a build break.
>
Both applied to the dev branch. This should let others use them atm and
allow us to port to ASoC v2.
I'll make a start on the port now.
Liam
^ permalink raw reply
* port linux-2.6 to ml410, problem on disabling external interrupts
From: diak sim @ 2008-01-08 13:40 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 2157 bytes --]
there is a strange problem.
my platform is ml410, port linux-2.6.23rc2 vertex kernel to it. the toolchain is generated by crosstool. the cross-gcc is powerpc-405-linux-gnu-gcc 4.0.2.when i complete the kernel compiling and download it to the board to run, there are a few questions.
at first, i can't see anything output after "Now booting the kernel". through debugging i found that init_IRQ() function in init/main.c can't run to the end. so i cut it and rerun the kernel. it runs so long until the rootfs is mounted. the problem occurs in executing /linuxrc. it says "init has generated signal 4 but has no handler for it". the reason, i've known, is that i disabled the init_IRQ() function. then i get down to search for the wrong point.
the init_IRQ() called in init/main.c is defined in arch/powerpc/kernel/irq.c. init_IRQ() calls ppc_md.init_IRQ(). ppc_md is a variable of "struct machdep_calls". the ppc_md.init_IRQ is evaluated in arch/ppc/syslib/ppc4xx_setup.c. the statement is ppc_md.init_IRQ = ppc4xx_init_IRQ. and the ppc4xx_init_IRQ() calls ppc4xx_pic_init() defined in arch/ppc/syslib/xilinx_pic.c.
tracing into ppc4xx_pic_init() function, i located the problem at "intc_out_be32(intc + IER, 0)". "intc_out_be32" is a macro as the real form "out_be32((addr), (mask))". the out_be32() is a function defined in include/asm-ppc/io.h.
extern inline void out_be32(volatile unsigned __iomem *addr, int val)
{
__asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
}
i replace "intc_out_be32(intc + IER, 0)" with the assemble statements and rerun, nothing changes.
XPS's debugger points out that the kernel stop in _delay() function. but there is not any call to this function. only the 2 assemble statements are there.
dividing the "sync" and "stw" into 2 __asm__ ones, "sync" is passed but "stw" makes a strange _delay() calling.
so strange it is, who can help me?
thanks.
___________________________________________________________
雅虎邮箱传递新年祝福,个性贺卡送亲朋!
http://cn.mail.yahoo.com/gc/index.html?entry=5&souce=mail_mailletter_tagline
[-- Attachment #2: Type: text/html, Size: 2401 bytes --]
^ permalink raw reply
* Re: [PATCH] Use <linux/of_{platform, device}.h> and not <asm/...> variants.
From: Jon Loeliger @ 2008-01-08 14:05 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev
In-Reply-To: <20080108113637.5208a0c7.sfr@canb.auug.org.au>
So, like, the other day Stephen Rothwell mumbled:
>
> Hi Jon,
>
> > Continue to fight the Good Fight by removing
> > old include file references that managed to
> > creep in recently.
>
> Thanks for doing this.
By $DIETY, I'll obtain Janitorial Karma one way or another!
The question now is, what next? I'm thinking about
picking on arch/sparc/, then drivers/ and sound/,
and finally pick off /include.
To be honest, I'm not sure what the final /include
structure is supposed to look like or do as both
pairs of these files mutually include their counterpart.
(i/l/of_d.h includes i/a/of_d.h which includes i/l/of_d.h)
(i/l/of_p.h includes i/a/of_p.h which includes i/l/of_p.h)
But, of course, the various asm/of_{platform,device}.h files
are different for each arch/, so I wasn't sure if the longer
term plan had folding the arch variants straight into the
include/linux/ version of the file or not. Seems there will
come a point when the sparc and powerpc variants will need
to be more unified...
arch/sparc/kernel/ioport.c:#include <asm/of_device.h>
arch/sparc/kernel/time.c:#include <asm/of_device.h>
arch/sparc64/kernel/auxio.c:#include <asm/of_device.h>
arch/sparc64/kernel/ebus.c:#include <asm/of_device.h>
arch/sparc64/kernel/isa.c:#include <asm/of_device.h>
arch/sparc64/kernel/pci_common.c:#include <asm/of_device.h>
arch/sparc64/kernel/pci_psycho.c:#include <asm/of_device.h>
arch/sparc64/kernel/pci_sabre.c:#include <asm/of_device.h>
arch/sparc64/kernel/pci_schizo.c:#include <asm/of_device.h>
arch/sparc64/kernel/power.c:#include <asm/of_device.h>
arch/sparc64/kernel/prom.c:#include <asm/of_device.h>
arch/sparc64/kernel/time.c:#include <asm/of_device.h>
drivers/char/ipmi/ipmi_si_intf.c:#include <asm/of_device.h>
drivers/hwmon/ams/ams.h:#include <asm/of_device.h>
drivers/input/serio/i8042-sparcio.h:#include <asm/of_device.h>
drivers/macintosh/smu.c:#include <asm/of_device.h>
drivers/macintosh/therm_pm72.c:#include <asm/of_device.h>
drivers/net/fs_enet/mac-fcc.c:#include <asm/of_device.h>
drivers/net/fs_enet/mac-fec.c:#include <asm/of_device.h>
drivers/pcmcia/m8xx_pcmcia.c:#include <asm/of_device.h>
drivers/sbus/sbus.c:#include <asm/of_device.h>
drivers/serial/sunhv.c:#include <asm/of_device.h>
drivers/serial/sunsab.c:#include <asm/of_device.h>
drivers/serial/sunsu.c:#include <asm/of_device.h>
drivers/serial/sunzilog.c:#include <asm/of_device.h>
drivers/video/bw2.c:#include <asm/of_device.h>
drivers/video/cg14.c:#include <asm/of_device.h>
drivers/video/cg3.c:#include <asm/of_device.h>
drivers/video/cg6.c:#include <asm/of_device.h>
drivers/video/ffb.c:#include <asm/of_device.h>
drivers/video/leo.c:#include <asm/of_device.h>
drivers/video/p9100.c:#include <asm/of_device.h>
drivers/video/platinumfb.c:#include <asm/of_device.h>
drivers/video/sunxvr2500.c:#include <asm/of_device.h>
drivers/video/sunxvr500.c:#include <asm/of_device.h>
drivers/video/tcx.c:#include <asm/of_device.h>
drivers/ata/pata_mpc52xx.c:#include <asm/of_platform.h>
drivers/char/hw_random/pasemi-rng.c:#include <asm/of_platform.h>
drivers/char/ipmi/ipmi_si_intf.c:#include <asm/of_platform.h>
drivers/hwmon/ams/ams-core.c:#include <asm/of_platform.h>
drivers/macintosh/smu.c:#include <asm/of_platform.h>
drivers/macintosh/therm_adt746x.c:#include <asm/of_platform.h>
drivers/macintosh/therm_pm72.c:#include <asm/of_platform.h>
drivers/macintosh/therm_windtunnel.c:#include <asm/of_platform.h>
drivers/net/fs_enet/fs_enet-main.c:#include <asm/of_platform.h>
drivers/net/fs_enet/mac-scc.c:#include <asm/of_platform.h>
drivers/net/fs_enet/mii-fec.c:#include <asm/of_platform.h>
drivers/net/ibm_newemac/core.h:#include <asm/of_platform.h>
drivers/net/ucc_geth.c:#include <asm/of_platform.h>
drivers/net/ucc_geth_mii.c:#include <asm/of_platform.h>
drivers/pcmcia/electra_cf.c:#include <asm/of_platform.h>
drivers/pcmcia/m8xx_pcmcia.c:#include <asm/of_platform.h>
drivers/serial/mpc52xx_uart.c:#include <asm/of_platform.h>
drivers/serial/of_serial.c:#include <asm/of_platform.h>
drivers/spi/mpc52xx_psc_spi.c:#include <asm/of_platform.h>
drivers/usb/host/ohci-ppc-of.c:#include <asm/of_platform.h>
drivers/video/platinumfb.c:#include <asm/of_platform.h>
drivers/watchdog/mpc5200_wdt.c:#include <asm/of_platform.h>
sound/aoa/soundbus/soundbus.h:#include <asm/of_device.h>
include/asm-powerpc/macio.h:#include <asm/of_device.h>
include/asm-powerpc/pmi.h:#include <asm/of_device.h>
include/asm-sparc/ebus.h:#include <asm/of_device.h>
include/asm-sparc/sbus.h:#include <asm/of_device.h>
include/asm-sparc64/ebus.h:#include <asm/of_device.h>
include/asm-sparc64/isa.h:#include <asm/of_device.h>
include/asm-sparc64/parport.h:#include <asm/of_device.h>
include/asm-sparc64/sbus.h:#include <asm/of_device.h>
include/linux/of_device.h:#include <asm/of_device.h>
include/linux/of_platform.h:#include <asm/of_platform.h>
^ permalink raw reply
* Generic MMC-over-SPI binding?
From: Simon Richter @ 2008-01-08 14:22 UTC (permalink / raw)
To: linuxppc-dev, linuxppc-embedded
Hi,
in an embedded system similar to the lite5200 board, there is an MMC
card socket connected to one of the PSCs. Ideally, I'd like to express
this fact via the device tree and have the kernel bind the mmc-spi
driver to the SPI interface, but I cannot find any place where to insert
this code that I feel comfortable with.
- It is not a board-specific thing, because any board can just use any
SPI bus for MMC.
- The mmc-spi driver appears to be platform independent, so I'm not
sure OF bindings should be added to it.
- The generic device tree scanning does not contain any special cases
yet, so I don't want to add one.
My current thought is to create a new driver that just handles MMC on
PSCs in SPI mode by gluing all the relevant drivers together, but that
doesn't seem optimal to me either.
Any ideas?
Simon
^ permalink raw reply
* [PATCH v4 0/4] device_type/compatible cleanups
From: Anton Vorontsov @ 2008-01-08 14:26 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
Hi all,
The fourth version follows...
Changes since v3:
- Thanks to reviewers, few glitches found and fixed;
- New conversion: device_type = "qeic" to compatible = "fsl,qe-ic";
- Documentation updated.
Changes since v2:
- SPI conversion fixed and actually tested on MPC8323E-RDB to not
break anything;
- Few more users of device_type = "qe" converted to
compatible = "fsl,qe";
- Got Ack on SPI part from David Brownell.
Changes since v1:
- Device tree lookup changes should be backward compatible with
older dtbs;
- Few of_put_node() cleanups;
- cell-index property added to spi nodes;
- cpm-muram{,-data} added as an addition to qe-muram{,-data}.
Thanks,
--
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2
^ permalink raw reply
* [PATCH 1/4] [POWERPC] qe_lib and users: get rid of device_types and model
From: Anton Vorontsov @ 2008-01-08 14:29 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <20080108142634.GA5989@localhost.localdomain>
Now we're searching for "fsl,qe", "fsl,qe-muram", "fsl,qe-muram-data"
and "fsl,qe-ic".
Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
Documentation/powerpc/booting-without-of.txt | 6 ++++--
arch/powerpc/boot/dts/mpc832x_mds.dts | 11 ++++++-----
arch/powerpc/boot/dts/mpc832x_rdb.dts | 11 ++++++-----
arch/powerpc/boot/dts/mpc836x_mds.dts | 11 ++++++-----
arch/powerpc/boot/dts/mpc8568mds.dts | 11 ++++++-----
arch/powerpc/platforms/83xx/mpc832x_mds.c | 11 +++++++----
arch/powerpc/platforms/83xx/mpc832x_rdb.c | 11 +++++++----
arch/powerpc/platforms/83xx/mpc836x_mds.c | 11 +++++++----
arch/powerpc/platforms/85xx/mpc85xx_mds.c | 16 +++++++++++-----
arch/powerpc/sysdev/fsl_soc.c | 5 ++++-
arch/powerpc/sysdev/qe_lib/qe.c | 16 +++++++++++++---
11 files changed, 77 insertions(+), 43 deletions(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index ee0209a..ed0b92c 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1770,7 +1770,7 @@ platforms are moved over to use the flattened-device-tree model.
vii) Multi-User RAM (MURAM)
Required properties:
- - device_type : should be "muram".
+ - compatible : should be "fsl,cpm-muram", "fsl,qe-muram".
- mode : the could be "host" or "slave".
- ranges : Should be defined as specified in 1) to describe the
translation of MURAM addresses.
@@ -1780,10 +1780,12 @@ platforms are moved over to use the flattened-device-tree model.
Example:
muram@10000 {
- device_type = "muram";
+ compatible = "fsl,cpm-muram", "fsl,qe-muram";
ranges = <0 00010000 0000c000>;
data-only@0{
+ compatible = "fsl,cpm-muram-data",
+ "fsl,qe-muram-data";
reg = <0 c000>;
};
};
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 26ac467..010c8d9 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -175,18 +175,19 @@
qe@e0100000 {
#address-cells = <1>;
#size-cells = <1>;
- device_type = "qe";
- model = "QE";
+ compatible = "fsl,qe";
ranges = <0 e0100000 00100000>;
reg = <e0100000 480>;
brg-frequency = <0>;
bus-frequency = <BCD3D80>;
muram@10000 {
- device_type = "muram";
+ compatible = "fsl,cpm-muram", "fsl,qe-muram";
ranges = <0 00010000 00004000>;
data-only@0 {
+ compatible = "fsl,cpm-muram-data",
+ "fsl,qe-muram-data";
reg = <0 4000>;
};
};
@@ -271,9 +272,9 @@
};
};
- qeic: qeic@80 {
+ qeic: interrupt-controller@80 {
interrupt-controller;
- device_type = "qeic";
+ compatible = "fsl,qe-ic";
#address-cells = <0>;
#interrupt-cells = <1>;
reg = <80 80>;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 10ff7aa..3a73134 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -165,18 +165,19 @@
qe@e0100000 {
#address-cells = <1>;
#size-cells = <1>;
- device_type = "qe";
- model = "QE";
+ compatible = "fsl,qe";
ranges = <0 e0100000 00100000>;
reg = <e0100000 480>;
brg-frequency = <0>;
bus-frequency = <BCD3D80>;
muram@10000 {
- device_type = "muram";
+ compatible = "fsl,cpm-muram", "fsl,qe-muram";
ranges = <0 00010000 00004000>;
data-only@0 {
+ compatible = "fsl,cpm-muram-data",
+ "fsl,qe-muram-data";
reg = <0 4000>;
};
};
@@ -252,9 +253,9 @@
};
};
- qeic:qeic@80 {
+ qeic:interrupt-controller@80 {
interrupt-controller;
- device_type = "qeic";
+ compatible = "fsl,qe-ic";
#address-cells = <0>;
#interrupt-cells = <1>;
reg = <80 80>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index fd841b2..2986860 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -206,18 +206,19 @@
qe@e0100000 {
#address-cells = <1>;
#size-cells = <1>;
- device_type = "qe";
- model = "QE";
+ compatible = "fsl,qe";
ranges = <0 e0100000 00100000>;
reg = <e0100000 480>;
brg-frequency = <0>;
bus-frequency = <179A7B00>;
muram@10000 {
- device_type = "muram";
+ compatible = "fsl,cpm-muram", "fsl,qe-muram";
ranges = <0 00010000 0000c000>;
data-only@0{
+ compatible = "fsl,cpm-muram-data",
+ "fsl,qe-muram-data";
reg = <0 c000>;
};
};
@@ -304,9 +305,9 @@
};
};
- qeic: qeic@80 {
+ qeic: interrupt-controller@80 {
interrupt-controller;
- device_type = "qeic";
+ compatible = "fsl,qe-ic";
#address-cells = <0>;
#interrupt-cells = <1>;
reg = <80 80>;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 5818a7c..7440347 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -283,18 +283,19 @@
qe@e0080000 {
#address-cells = <1>;
#size-cells = <1>;
- device_type = "qe";
- model = "QE";
+ compatible = "fsl,qe";
ranges = <0 e0080000 00040000>;
reg = <e0080000 480>;
brg-frequency = <0>;
bus-frequency = <179A7B00>;
muram@10000 {
- device_type = "muram";
+ compatible = "fsl,cpm-muram", "fsl,qe-muram";
ranges = <0 00010000 0000c000>;
data-only@0{
+ compatible = "fsl,cpm-muram-data",
+ "fsl,qe-muram-data";
reg = <0 c000>;
};
};
@@ -385,9 +386,9 @@
};
};
- qeic: qeic@80 {
+ qeic: interrupt-controller@80 {
interrupt-controller;
- device_type = "qeic";
+ compatible = "fsl,qe-ic";
#address-cells = <0>;
#interrupt-cells = <1>;
reg = <80 80>;
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 1e570bb..ec41284 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -105,6 +105,7 @@ static struct of_device_id mpc832x_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .type = "qe", },
+ { .compatible = "fsl,qe", },
{},
};
@@ -137,10 +138,12 @@ static void __init mpc832x_sys_init_IRQ(void)
of_node_put(np);
#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
+ np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+ if (!np) {
+ np = of_find_node_by_type(NULL, "qeic");
+ if (!np)
+ return;
+ }
qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
of_node_put(np);
#endif /* CONFIG_QUICC_ENGINE */
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index ffb2e93..3025871 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -118,6 +118,7 @@ static struct of_device_id mpc832x_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .type = "qe", },
+ { .compatible = "fsl,qe", },
{},
};
@@ -151,10 +152,12 @@ void __init mpc832x_rdb_init_IRQ(void)
of_node_put(np);
#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
+ np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+ if (!np) {
+ np = of_find_node_by_type(NULL, "qeic");
+ if (!np)
+ return;
+ }
qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
of_node_put(np);
#endif /* CONFIG_QUICC_ENGINE */
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 2ac9890..788291c 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -136,6 +136,7 @@ static struct of_device_id mpc836x_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .type = "qe", },
+ { .compatible = "fsl,qe", },
{},
};
@@ -168,10 +169,12 @@ static void __init mpc836x_mds_init_IRQ(void)
of_node_put(np);
#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
+ np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+ if (!np) {
+ np = of_find_node_by_type(NULL, "qeic");
+ if (!np)
+ return;
+ }
qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
of_node_put(np);
#endif /* CONFIG_QUICC_ENGINE */
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index e6c63a5..4fa6d6c 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -94,7 +94,10 @@ static void __init mpc85xx_mds_setup_arch(void)
#endif
#ifdef CONFIG_QUICC_ENGINE
- if ((np = of_find_node_by_name(NULL, "qe")) != NULL) {
+ np = of_find_compatible_node(NULL, NULL, "fsl,qe");
+ if (!np)
+ np = of_find_node_by_name(NULL, "qe");
+ if (np) {
qe_reset();
of_node_put(np);
}
@@ -139,6 +142,7 @@ static struct of_device_id mpc85xx_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .type = "qe", },
+ { .compatible = "fsl,qe", },
{},
};
@@ -179,10 +183,12 @@ static void __init mpc85xx_mds_pic_init(void)
mpic_init(mpic);
#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
+ np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+ if (!np) {
+ np = of_find_node_by_type(NULL, "qeic");
+ if (!np)
+ return;
+ }
qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);
of_node_put(np);
#endif /* CONFIG_QUICC_ENGINE */
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 4baad80..60d9c4e 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1226,7 +1226,10 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
const u32 *sysclk;
/* SPI controller is either clocked from QE or SoC clock */
- np = of_find_node_by_type(NULL, "qe");
+ np = of_find_compatible_node(NULL, NULL, "fsl,qe");
+ if (!np)
+ np = of_find_node_by_type(NULL, "qe");
+
if (!np)
np = of_find_node_by_type(NULL, "soc");
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 21e0106..cd6cee3 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -68,7 +68,10 @@ phys_addr_t get_qe_base(void)
if (qebase != -1)
return qebase;
- qe = of_find_node_by_type(NULL, "qe");
+ qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
+ if (!qe)
+ qe = of_find_node_by_type(NULL, "qe");
+
if (qe) {
unsigned int size;
const void *prop = of_get_property(qe, "reg", &size);
@@ -155,7 +158,10 @@ unsigned int get_brg_clk(void)
if (brg_clk)
return brg_clk;
- qe = of_find_node_by_type(NULL, "qe");
+ qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
+ if (!qe)
+ qe = of_find_node_by_type(NULL, "qe");
+
if (qe) {
unsigned int size;
const u32 *prop = of_get_property(qe, "brg-frequency", &size);
@@ -334,7 +340,11 @@ static void qe_muram_init(void)
/* XXX: This is a subset of the available muram. It
* varies with the processor and the microcode patches activated.
*/
- if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) {
+ np = of_find_compatible_node(NULL, NULL, "fsl,qe-muram-data");
+ if (!np)
+ np = of_find_node_by_name(NULL, "data-only");
+
+ if (np) {
address = *of_get_address(np, 0, &size, &flags);
of_node_put(np);
rh_attach_region(&qe_muram_info, address, (int) size);
--
1.5.2.2
^ permalink raw reply related
* [PATCH 2/4] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type
From: Anton Vorontsov @ 2008-01-08 14:29 UTC (permalink / raw)
To: Kumar Gala, Jeff Garzik; +Cc: linuxppc-dev, netdev
In-Reply-To: <20080108142634.GA5989@localhost.localdomain>
device_type property is bogus, thus use proper compatible.
Also change compatible property to "fsl,ucc-mdio".
Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/boot/dts/mpc832x_mds.dts | 3 +--
arch/powerpc/boot/dts/mpc832x_rdb.dts | 3 +--
arch/powerpc/boot/dts/mpc836x_mds.dts | 3 +--
arch/powerpc/boot/dts/mpc8568mds.dts | 2 +-
drivers/net/ucc_geth_mii.c | 3 +++
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 010c8d9..cf41194 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -255,8 +255,7 @@
#address-cells = <1>;
#size-cells = <0>;
reg = <2320 18>;
- device_type = "mdio";
- compatible = "ucc_geth_phy";
+ compatible = "fsl,ucc-mdio";
phy3: ethernet-phy@03 {
interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 3a73134..09301c1 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -236,8 +236,7 @@
#address-cells = <1>;
#size-cells = <0>;
reg = <3120 18>;
- device_type = "mdio";
- compatible = "ucc_geth_phy";
+ compatible = "fsl,ucc-mdio";
phy00:ethernet-phy@00 {
interrupt-parent = <&pic>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 2986860..3eb8f72 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -288,8 +288,7 @@
#address-cells = <1>;
#size-cells = <0>;
reg = <2120 18>;
- device_type = "mdio";
- compatible = "ucc_geth_phy";
+ compatible = "fsl,ucc-mdio";
phy0: ethernet-phy@00 {
interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 7440347..2bc147f 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -356,7 +356,7 @@
#address-cells = <1>;
#size-cells = <0>;
reg = <2120 18>;
- compatible = "ucc_geth_phy";
+ compatible = "fsl,ucc-mdio";
/* These are the same PHYs as on
* gianfar's MDIO bus */
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index df884f0..e3ba14a 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -256,6 +256,9 @@ static struct of_device_id uec_mdio_match[] = {
.type = "mdio",
.compatible = "ucc_geth_phy",
},
+ {
+ .compatible = "fsl,ucc-mdio",
+ },
{},
};
--
1.5.2.2
^ permalink raw reply related
* [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE
From: Anton Vorontsov @ 2008-01-08 14:30 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <20080108142634.GA5989@localhost.localdomain>
In case of QE we can use brg-frequency (which is qeclk/2).
Thus no need to divide sysclk in the spi_mpc83xx.
This patch also adds code to use get_brgfreq() on QE chips.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
---
arch/powerpc/sysdev/fsl_soc.c | 44 ++++++++++++++++++++++++++++------------
drivers/spi/spi_mpc83xx.c | 6 +----
2 files changed, 32 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 60d9c4e..7b13876 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -66,7 +66,7 @@ phys_addr_t get_immrbase(void)
EXPORT_SYMBOL(get_immrbase);
-#if defined(CONFIG_CPM2) || defined(CONFIG_8xx)
+#if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx)
static u32 brgfreq = -1;
@@ -91,11 +91,21 @@ u32 get_brgfreq(void)
/* Legacy device binding -- will go away when no users are left. */
node = of_find_node_by_type(NULL, "cpm");
+ if (!node)
+ node = of_find_compatible_node(NULL, NULL, "fsl,qe");
+ if (!node)
+ node = of_find_node_by_type(NULL, "qe");
+
if (node) {
prop = of_get_property(node, "brg-frequency", &size);
if (prop && size == 4)
brgfreq = *prop;
+ if (brgfreq == -1 || brgfreq == 0) {
+ prop = of_get_property(node, "bus-frequency", &size);
+ if (prop && size == 4)
+ brgfreq = *prop / 2;
+ }
of_node_put(node);
}
@@ -1223,22 +1233,30 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
{
struct device_node *np;
unsigned int i;
- const u32 *sysclk;
+ u32 sysclk;
/* SPI controller is either clocked from QE or SoC clock */
- np = of_find_compatible_node(NULL, NULL, "fsl,qe");
- if (!np)
- np = of_find_node_by_type(NULL, "qe");
+ sysclk = get_brgfreq();
+ if (sysclk == -1) {
+ const u32 *freq;
+ int size;
- if (!np)
np = of_find_node_by_type(NULL, "soc");
+ if (!np)
+ return -ENODEV;
+
+ freq = of_get_property(np, "clock-frequency", &size);
+ if (!freq || size != sizeof(*freq) || *freq == 0) {
+ freq = of_get_property(np, "bus-frequency", &size);
+ if (!freq || size != sizeof(*freq) || *freq == 0) {
+ of_node_put(np);
+ return -ENODEV;
+ }
+ }
- if (!np)
- return -ENODEV;
-
- sysclk = of_get_property(np, "bus-frequency", NULL);
- if (!sysclk)
- return -ENODEV;
+ sysclk = *freq;
+ of_node_put(np);
+ }
for (np = NULL, i = 1;
(np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
@@ -1255,7 +1273,7 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
memset(res, 0, sizeof(res));
- pdata.sysclk = *sysclk;
+ pdata.sysclk = sysclk;
prop = of_get_property(np, "reg", NULL);
if (!prop)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 4580b9c..04f7cd9 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -436,11 +436,7 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
mpc83xx_spi->qe_mode = pdata->qe_mode;
mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
-
- if (mpc83xx_spi->qe_mode)
- mpc83xx_spi->spibrg = pdata->sysclk / 2;
- else
- mpc83xx_spi->spibrg = pdata->sysclk;
+ mpc83xx_spi->spibrg = pdata->sysclk;
mpc83xx_spi->rx_shift = 0;
mpc83xx_spi->tx_shift = 0;
--
1.5.2.2
^ permalink raw reply related
* [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi"
From: Anton Vorontsov @ 2008-01-08 14:30 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <20080108142634.GA5989@localhost.localdomain>
Also:
- rename "fsl_spi" to "fsl,spi";
- add and use cell-index property, if found;
- split probing code out of fsl_spi_init, thus we can call
it for legacy device_type probing and new "compatible" probing.
Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
Documentation/powerpc/booting-without-of.txt | 8 +-
arch/powerpc/boot/dts/mpc8313erdb.dts | 4 +-
arch/powerpc/boot/dts/mpc832x_mds.dts | 8 +-
arch/powerpc/boot/dts/mpc832x_rdb.dts | 8 +-
arch/powerpc/boot/dts/mpc8349emitx.dts | 4 +-
arch/powerpc/boot/dts/mpc8349emitxgp.dts | 4 +-
arch/powerpc/boot/dts/mpc834x_mds.dts | 4 +-
arch/powerpc/boot/dts/mpc836x_mds.dts | 8 +-
arch/powerpc/boot/dts/mpc8568mds.dts | 8 +-
arch/powerpc/sysdev/fsl_soc.c | 94 ++++++++++++++++----------
10 files changed, 86 insertions(+), 64 deletions(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index ed0b92c..2b30611 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1563,8 +1563,8 @@ platforms are moved over to use the flattened-device-tree model.
ii) SPI (Serial Peripheral Interface)
Required properties:
- - device_type : should be "spi".
- - compatible : should be "fsl_spi".
+ - cell-index : SPI controller index.
+ - compatible : should be "fsl,spi".
- mode : the SPI operation mode, it can be "cpu" or "cpu-qe".
- reg : Offset and length of the register set for the device
- interrupts : <a b> where a is the interrupt number and b is a
@@ -1577,8 +1577,8 @@ platforms are moved over to use the flattened-device-tree model.
Example:
spi@4c0 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <0>;
+ compatible = "fsl,spi";
reg = <4c0 40>;
interrupts = <82 0>;
interrupt-parent = <700>;
diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index c5b6665..a0492b6 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -82,8 +82,8 @@
};
spi@7000 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <0>;
+ compatible = "fsl,spi";
reg = <7000 1000>;
interrupts = <10 8>;
interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index cf41194..cc99fb0 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -193,8 +193,8 @@
};
spi@4c0 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <0>;
+ compatible = "fsl,spi";
reg = <4c0 40>;
interrupts = <2>;
interrupt-parent = < &qeic >;
@@ -202,8 +202,8 @@
};
spi@500 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <1>;
+ compatible = "fsl,spi";
reg = <500 40>;
interrupts = <1>;
interrupt-parent = < &qeic >;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 09301c1..c0e5e93 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -183,8 +183,8 @@
};
spi@4c0 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <0>;
+ compatible = "fsl,spi";
reg = <4c0 40>;
interrupts = <2>;
interrupt-parent = <&qeic>;
@@ -192,8 +192,8 @@
};
spi@500 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <1>;
+ compatible = "fsl,spi";
reg = <500 40>;
interrupts = <1>;
interrupt-parent = <&qeic>;
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index e354f26..f8fc5f6 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -82,8 +82,8 @@
};
spi@7000 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <0>;
+ compatible = "fsl,spi";
reg = <7000 1000>;
interrupts = <10 8>;
interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index ebdf0b7..666650c 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -80,8 +80,8 @@
};
spi@7000 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <0>;
+ compatible = "fsl,spi";
reg = <7000 1000>;
interrupts = <10 8>;
interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 0ba13eb..6ed36a1 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -93,8 +93,8 @@
};
spi@7000 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <0>;
+ compatible = "fsl,spi";
reg = <7000 1000>;
interrupts = <10 8>;
interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 3eb8f72..be7dfed 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -224,8 +224,8 @@
};
spi@4c0 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <0>;
+ compatible = "fsl,spi";
reg = <4c0 40>;
interrupts = <2>;
interrupt-parent = < &qeic >;
@@ -233,8 +233,8 @@
};
spi@500 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <1>;
+ compatible = "fsl,spi";
reg = <500 40>;
interrupts = <1>;
interrupt-parent = < &qeic >;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 2bc147f..84474cb 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -301,8 +301,8 @@
};
spi@4c0 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <0>;
+ compatible = "fsl,spi";
reg = <4c0 40>;
interrupts = <2>;
interrupt-parent = <&qeic>;
@@ -310,8 +310,8 @@
};
spi@500 {
- device_type = "spi";
- compatible = "fsl_spi";
+ cell-index = <1>;
+ compatible = "fsl,spi";
reg = <500 40>;
interrupts = <1>;
interrupt-parent = <&qeic>;
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 7b13876..cec1ab7 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1226,42 +1226,17 @@ arch_initcall(cpm_smc_uart_of_init);
#endif /* CONFIG_8xx */
#endif /* CONFIG_PPC_CPM_NEW_BINDING */
-int __init fsl_spi_init(struct spi_board_info *board_infos,
- unsigned int num_board_infos,
- void (*activate_cs)(u8 cs, u8 polarity),
- void (*deactivate_cs)(u8 cs, u8 polarity))
+static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk,
+ struct spi_board_info *board_infos,
+ unsigned int num_board_infos,
+ void (*activate_cs)(u8 cs, u8 polarity),
+ void (*deactivate_cs)(u8 cs, u8 polarity))
{
struct device_node *np;
- unsigned int i;
- u32 sysclk;
-
- /* SPI controller is either clocked from QE or SoC clock */
- sysclk = get_brgfreq();
- if (sysclk == -1) {
- const u32 *freq;
- int size;
-
- np = of_find_node_by_type(NULL, "soc");
- if (!np)
- return -ENODEV;
-
- freq = of_get_property(np, "clock-frequency", &size);
- if (!freq || size != sizeof(*freq) || *freq == 0) {
- freq = of_get_property(np, "bus-frequency", &size);
- if (!freq || size != sizeof(*freq) || *freq == 0) {
- of_node_put(np);
- return -ENODEV;
- }
- }
-
- sysclk = *freq;
- of_node_put(np);
- }
+ unsigned int i = 0;
- for (np = NULL, i = 1;
- (np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
- i++) {
- int ret = 0;
+ for_each_compatible_node(np, type, compatible) {
+ int ret;
unsigned int j;
const void *prop;
struct resource res[2];
@@ -1280,6 +1255,10 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
goto err;
pdata.bus_num = *(u32 *)prop;
+ prop = of_get_property(np, "cell-index", NULL);
+ if (prop)
+ i = *(u32 *)prop;
+
prop = of_get_property(np, "mode", NULL);
if (prop && !strcmp(prop, "cpu-qe"))
pdata.qe_mode = 1;
@@ -1290,7 +1269,7 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
}
if (!pdata.max_chipselect)
- goto err;
+ continue;
ret = of_address_to_resource(np, 0, &res[0]);
if (ret)
@@ -1317,13 +1296,56 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
if (ret)
goto unreg;
- continue;
+ goto next;
unreg:
platform_device_del(pdev);
err:
- continue;
+ pr_err("%s: registration failed\n", np->full_name);
+next:
+ i++;
}
+ return i;
+}
+
+int __init fsl_spi_init(struct spi_board_info *board_infos,
+ unsigned int num_board_infos,
+ void (*activate_cs)(u8 cs, u8 polarity),
+ void (*deactivate_cs)(u8 cs, u8 polarity))
+{
+ u32 sysclk;
+ int ret;
+
+ /* SPI controller is either clocked from QE or SoC clock */
+ sysclk = get_brgfreq();
+ if (sysclk == -1) {
+ struct device_node *np;
+ const u32 *freq;
+ int size;
+
+ np = of_find_node_by_type(NULL, "soc");
+ if (!np)
+ return -ENODEV;
+
+ freq = of_get_property(np, "clock-frequency", &size);
+ if (!freq || size != sizeof(*freq) || *freq == 0) {
+ freq = of_get_property(np, "bus-frequency", &size);
+ if (!freq || size != sizeof(*freq) || *freq == 0) {
+ of_node_put(np);
+ return -ENODEV;
+ }
+ }
+
+ sysclk = *freq;
+ of_node_put(np);
+ }
+
+ ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos,
+ num_board_infos, activate_cs, deactivate_cs);
+ if (!ret)
+ of_fsl_spi_probe("spi", "fsl_spi", sysclk, board_infos,
+ num_board_infos, activate_cs, deactivate_cs);
+
return spi_register_board_info(board_infos, num_board_infos);
}
--
1.5.2.2
^ permalink raw reply related
* Re: [PATCH 1/3] add default device trees for MPC837x MDS board
From: Kumar Gala @ 2008-01-08 15:18 UTC (permalink / raw)
To: Li Yang; +Cc: linuxppc-dev, paulus
In-Reply-To: <989B956029373F45A0B8AF029708189001BA00F1@zch01exm26.fsl.freescale.net>
>>>
>>
>> Could I convince you to convert these to dts-v1 format?
>
> Ok, I can do it. The DTS spec changes too much lately. :(
Thanks. I'll merge the two patches into one when I commit. Its open
source development ;)
- k
^ permalink raw reply
* Re: [PATCH v6] qe: add ability to upload QE firmware
From: Timur Tabi @ 2008-01-08 15:26 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev
In-Reply-To: <20080108133747.f717e4b4.sfr@canb.auug.org.au>
Stephen Rothwell wrote:
> If you use:
> for_each_child_of_node(qe, fw)
> You don't need to initialise 'fw' in its declararion.
I can't find for_each_child_of_node. It's not in Kumar's for-2.6.25 branch.
> Why not:
> const u64 *iprop;
> int len;
>
> iprop = of_get_property(fs, "extended-modes", &len);
Ok.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCH v6] qe: add ability to upload QE firmware
From: Timur Tabi @ 2008-01-08 15:29 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev
In-Reply-To: <20080108133747.f717e4b4.sfr@canb.auug.org.au>
Stephen Rothwell wrote:
> Why not:
> const u64 *iprop;
> int len;
>
> iprop = of_get_property(fs, "extended-modes", &len);
> if (iprop && (len == sizeof(u64))
> qe_firmware_info.extended_modes = *iprop;
Actually, I like my way better, because then I don't have to define 'len', and I
don't have to define two integer property variables one for u32 and one for u64.
Besides, now that I'm at version 6, I'd rather not post updates for minor
stylistic changes.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCH v6] qe: add ability to upload QE firmware
From: Josh Boyer @ 2008-01-08 15:45 UTC (permalink / raw)
To: Timur Tabi; +Cc: Stephen Rothwell, linuxppc-dev
In-Reply-To: <47839623.4090200@freescale.com>
On Tue, 08 Jan 2008 09:26:27 -0600
Timur Tabi <timur@freescale.com> wrote:
> Stephen Rothwell wrote:
>
> > If you use:
> > for_each_child_of_node(qe, fw)
> > You don't need to initialise 'fw' in its declararion.
>
> I can't find for_each_child_of_node. It's not in Kumar's for-2.6.25 branch.
include/linux/of.h
http://git.kernel.org/?p=linux/kernel/git/galak/powerpc.git;a=blob;f=include/linux/of.h;h=c65af7bd1e9c6369757dfaeeecf74feccea83f97;hb=for-2.6.25
josh
^ permalink raw reply
* Re: [PATCH 1/3] add default device trees for MPC837x MDS board
From: Grant Likely @ 2008-01-08 15:58 UTC (permalink / raw)
To: Li Yang; +Cc: linuxppc-dev, paulus
In-Reply-To: <1199707400-23588-1-git-send-email-leoli@freescale.com>
Hi Leo,
comments below. I've made my comments on the first file, but they
apply to the other two also.
Cheers,
g.
On 1/7/08, Li Yang <leoli@freescale.com> wrote:
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> address comments and use new dts spec.
>
> arch/powerpc/boot/dts/mpc8377_mds.dts | 277 +++++++++++++++++++++++++++++++
> arch/powerpc/boot/dts/mpc8378_mds.dts | 263 +++++++++++++++++++++++++++++
> arch/powerpc/boot/dts/mpc8379_mds.dts | 291 +++++++++++++++++++++++++++++++++
> 3 files changed, 831 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
> new file mode 100644
> index 0000000..b50b5f9
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
> @@ -0,0 +1,277 @@
> +/*
> + * MPC8377E MDS Device Tree Source
> + *
> + * Copyright 2007 Freescale Semiconductor Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + */
> +
> +/ {
> + model = "fsl,mpc8377emds";
> + compatible = "fsl,mpc8377emds","fsl,mpc837xmds";
Compatibility at the board level is a really hard thing to claim. I'd
drop the "fsl,mpc837xmds" here and make the platform code bind to
either.
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + aliases {
> + ethernet0 = &enet0;
> + ethernet1 = &enet1;
> + serial0 = &serial0;
> + serial1 = &serial1;
> + pci0 = &pci0;
> + };
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + PowerPC,8377@0 {
> + device_type = "cpu";
> + reg = <0>;
> + d-cache-line-size = <20>;
> + i-cache-line-size = <20>;
> + d-cache-size = <8000>; // L1, 32K
> + i-cache-size = <8000>; // L1, 32K
> + timebase-frequency = <0>;
> + bus-frequency = <0>;
> + clock-frequency = <0>;
> + };
> + };
> +
> + memory {
> + device_type = "memory";
> + reg = <00000000 20000000>; // 512MB at 0
> + };
> +
> + soc@e0000000 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + device_type = "soc";
I recommend dropping device_type and adding 'compatible = "fsl,mpc8377-immr";'
> + ranges = <0 e0000000 00100000>;
> + reg = <e0000000 00000200>;
> + bus-frequency = <0>;
> +
> + wdt@200 {
> + compatible = "mpc83xx_wdt";
"fsl,mpc8377_wdt", "fsl,mpc83xx_wdt" as per generic names recommended practice.
> + reg = <200 100>;
> + };
> +
> + i2c@3000 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + cell-index = <0>;
> + compatible = "fsl-i2c";
> + reg = <3000 100>;
> + interrupts = <e 8>;
> + interrupt-parent = < &ipic >;
> + dfsrr;
> + };
> +
> + i2c@3100 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + cell-index = <1>;
> + compatible = "fsl-i2c";
> + reg = <3100 100>;
> + interrupts = <f 8>;
> + interrupt-parent = < &ipic >;
> + dfsrr;
> + };
> +
> + spi@7000 {
> + compatible = "fsl_spi";
> + reg = <7000 1000>;
> + interrupts = <10 8>;
> + interrupt-parent = < &ipic >;
> + mode = "cpu";
> + };
> +
> + /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
> + usb@23000 {
> + compatible = "fsl-usb2-dr";
> + reg = <23000 1000>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + interrupt-parent = < &ipic >;
> + interrupts = <26 8>;
> + phy_type = "utmi_wide";
fsl,phy_type please.
> + };
> +
> + mdio@24520 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "fsl,gianfar-mdio";
> + reg = <24520 20>;
> + phy2: ethernet-phy@2 {
> + interrupt-parent = < &ipic >;
> + interrupts = <11 8>;
> + reg = <2>;
> + device_type = "ethernet-phy";
> + };
> + phy3: ethernet-phy@3 {
> + interrupt-parent = < &ipic >;
> + interrupts = <12 8>;
> + reg = <3>;
> + device_type = "ethernet-phy";
> + };
> + };
> +
> + enet0: ethernet@24000 {
> + cell-index = <0>;
> + device_type = "network";
> + model = "eTSEC";
Drop model property
> + compatible = "gianfar";
> + reg = <24000 1000>;
> + local-mac-address = [ 00 00 00 00 00 00 ];
> + interrupts = <20 8 21 8 22 8>;
> + phy-connection-type = "mii";
> + interrupt-parent = < &ipic >;
> + phy-handle = < &phy2 >;
> + };
> +
> + enet1: ethernet@25000 {
> + cell-index = <1>;
> + device_type = "network";
> + model = "eTSEC";
Drop model property.
> + compatible = "gianfar";
> + reg = <25000 1000>;
> + local-mac-address = [ 00 00 00 00 00 00 ];
> + interrupts = <23 8 24 8 25 8>;
> + phy-connection-type = "mii";
> + interrupt-parent = < &ipic >;
> + phy-handle = < &phy3 >;
> + };
> +
> + serial0: serial@4500 {
> + cell-index = <0>;
> + device_type = "serial";
> + compatible = "ns16550";
> + reg = <4500 100>;
> + clock-frequency = <0>;
> + interrupts = <9 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + serial1: serial@4600 {
> + cell-index = <1>;
> + device_type = "serial";
> + compatible = "ns16550";
> + reg = <4600 100>;
> + clock-frequency = <0>;
> + interrupts = <a 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + crypto@30000 {
> + model = "SEC3";
Drop model property and encode relevant info into compatible.
> + compatible = "talitos";
> + reg = <30000 10000>;
> + interrupts = <b 8>;
> + interrupt-parent = < &ipic >;
> + /* Rev. 3.0 geometry */
> + num-channels = <4>;
> + channel-fifo-len = <18>;
> + exec-units-mask = <000001fe>;
> + descriptor-types-mask = <03ab0ebf>;
> + };
> +
> + sdhc@2e000 {
> + model = "eSDHC";
> + compatible = "fsl,esdhc";
Drop the model property and change compatible to "fsl,mpc8377-esdhc".
> + reg = <2e000 1000>;
> + interrupts = <2a 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + sata@18000 {
> + compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
> + reg = <18000 1000>;
> + interrupts = <2c 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + sata@19000 {
> + compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
> + reg = <19000 1000>;
> + interrupts = <2d 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + /* IPIC
> + * interrupts cell = <intr #, sense>
> + * sense values match linux IORESOURCE_IRQ_* defines:
> + * sense == 8: Level, low assertion
> + * sense == 2: Edge, high-to-low change
> + */
> + ipic: pic@700 {
> + compatible = "fsl,ipic";
> + interrupt-controller;
> + #address-cells = <0>;
> + #interrupt-cells = <2>;
> + reg = <700 100>;
> + };
> + };
> +
> + pci0: pci@e0008500 {
> + cell-index = <0>;
> + interrupt-map-mask = <f800 0 0 7>;
> + interrupt-map = <
> +
> + /* IDSEL 0x11 */
> + 8800 0 0 1 &ipic 14 8
> + 8800 0 0 2 &ipic 15 8
> + 8800 0 0 3 &ipic 16 8
> + 8800 0 0 4 &ipic 17 8
> +
> + /* IDSEL 0x12 */
> + 9000 0 0 1 &ipic 16 8
> + 9000 0 0 2 &ipic 17 8
> + 9000 0 0 3 &ipic 14 8
> + 9000 0 0 4 &ipic 15 8
> +
> + /* IDSEL 0x13 */
> + 9800 0 0 1 &ipic 17 8
> + 9800 0 0 2 &ipic 14 8
> + 9800 0 0 3 &ipic 15 8
> + 9800 0 0 4 &ipic 16 8
> +
> + /* IDSEL 0x15 */
> + a800 0 0 1 &ipic 14 8
> + a800 0 0 2 &ipic 15 8
> + a800 0 0 3 &ipic 16 8
> + a800 0 0 4 &ipic 17 8
> +
> + /* IDSEL 0x16 */
> + b000 0 0 1 &ipic 17 8
> + b000 0 0 2 &ipic 14 8
> + b000 0 0 3 &ipic 15 8
> + b000 0 0 4 &ipic 16 8
> +
> + /* IDSEL 0x17 */
> + b800 0 0 1 &ipic 16 8
> + b800 0 0 2 &ipic 17 8
> + b800 0 0 3 &ipic 14 8
> + b800 0 0 4 &ipic 15 8
> +
> + /* IDSEL 0x18 */
> + c000 0 0 1 &ipic 15 8
> + c000 0 0 2 &ipic 16 8
> + c000 0 0 3 &ipic 17 8
> + c000 0 0 4 &ipic 14 8>;
> + interrupt-parent = < &ipic >;
> + interrupts = <42 8>;
> + bus-range = <0 0>;
> + ranges = <02000000 0 90000000 90000000 0 10000000
> + 42000000 0 80000000 80000000 0 10000000
> + 01000000 0 00000000 e0300000 0 00100000>;
> + clock-frequency = <0>;
> + #interrupt-cells = <1>;
> + #size-cells = <2>;
> + #address-cells = <3>;
> + reg = <e0008500 100>;
> + compatible = "fsl,mpc8349-pci";
> + device_type = "pci";
> + };
> +};
> diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts
> new file mode 100644
> index 0000000..bd9545d
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
> @@ -0,0 +1,263 @@
> +/*
> + * MPC8378E MDS Device Tree Source
> + *
> + * Copyright 2007 Freescale Semiconductor Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + */
> +
> +/ {
> + model = "fsl,mpc8378emds";
> + compatible = "fsl,mpc8378emds","fsl,mpc837xmds";
Again, board level compatibility is very difficult to claim.
fsl,mpc837xmds doesn't make much sense here. Just make the platform
code bind on all the variants.
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + aliases {
> + ethernet0 = &enet0;
> + ethernet1 = &enet1;
> + serial0 = &serial0;
> + serial1 = &serial1;
> + pci0 = &pci0;
> + };
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + PowerPC,8378@0 {
> + device_type = "cpu";
> + reg = <0>;
> + d-cache-line-size = <20>;
> + i-cache-line-size = <20>;
> + d-cache-size = <8000>; // L1, 32K
> + i-cache-size = <8000>; // L1, 32K
> + timebase-frequency = <0>;
> + bus-frequency = <0>;
> + clock-frequency = <0>;
> + };
> + };
> +
> + memory {
> + device_type = "memory";
> + reg = <00000000 20000000>; // 512MB at 0
> + };
> +
> + soc@e0000000 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + device_type = "soc";
Drop device_type and add compatible
> + ranges = <0 e0000000 00100000>;
> + reg = <e0000000 00000200>;
> + bus-frequency = <0>;
> +
> + wdt@200 {
> + compatible = "mpc83xx_wdt";
> + reg = <200 100>;
> + };
> +
> + i2c@3000 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + cell-index = <0>;
> + compatible = "fsl-i2c";
> + reg = <3000 100>;
> + interrupts = <e 8>;
> + interrupt-parent = < &ipic >;
> + dfsrr;
> + };
> +
> + i2c@3100 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + cell-index = <1>;
> + compatible = "fsl-i2c";
> + reg = <3100 100>;
> + interrupts = <f 8>;
> + interrupt-parent = < &ipic >;
> + dfsrr;
> + };
> +
> + spi@7000 {
> + compatible = "fsl_spi";
> + reg = <7000 1000>;
> + interrupts = <10 8>;
> + interrupt-parent = < &ipic >;
> + mode = "cpu";
> + };
> +
> + /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
> + usb@23000 {
> + compatible = "fsl-usb2-dr";
> + reg = <23000 1000>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + interrupt-parent = < &ipic >;
> + interrupts = <26 8>;
> + phy_type = "utmi_wide";
> + };
> +
> + mdio@24520 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "fsl,gianfar-mdio";
> + reg = <24520 20>;
> + phy2: ethernet-phy@2 {
> + interrupt-parent = < &ipic >;
> + interrupts = <11 8>;
> + reg = <2>;
> + device_type = "ethernet-phy";
> + };
> + phy3: ethernet-phy@3 {
> + interrupt-parent = < &ipic >;
> + interrupts = <12 8>;
> + reg = <3>;
> + device_type = "ethernet-phy";
> + };
> + };
> +
> + enet0: ethernet@24000 {
> + cell-index = <0>;
> + device_type = "network";
> + model = "eTSEC";
> + compatible = "gianfar";
> + reg = <24000 1000>;
> + local-mac-address = [ 00 00 00 00 00 00 ];
> + interrupts = <20 8 21 8 22 8>;
> + phy-connection-type = "mii";
> + interrupt-parent = < &ipic >;
> + phy-handle = < &phy2 >;
> + };
> +
> + enet1: ethernet@25000 {
> + cell-index = <1>;
> + device_type = "network";
> + model = "eTSEC";
> + compatible = "gianfar";
> + reg = <25000 1000>;
> + local-mac-address = [ 00 00 00 00 00 00 ];
> + interrupts = <23 8 24 8 25 8>;
> + phy-connection-type = "mii";
> + interrupt-parent = < &ipic >;
> + phy-handle = < &phy3 >;
> + };
> +
> + serial0: serial@4500 {
> + cell-index = <0>;
> + device_type = "serial";
> + compatible = "ns16550";
> + reg = <4500 100>;
> + clock-frequency = <0>;
> + interrupts = <9 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + serial1: serial@4600 {
> + cell-index = <1>;
> + device_type = "serial";
> + compatible = "ns16550";
> + reg = <4600 100>;
> + clock-frequency = <0>;
> + interrupts = <a 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + crypto@30000 {
> + model = "SEC3";
> + compatible = "talitos";
> + reg = <30000 10000>;
> + interrupts = <b 8>;
> + interrupt-parent = < &ipic >;
> + /* Rev. 3.0 geometry */
> + num-channels = <4>;
> + channel-fifo-len = <18>;
> + exec-units-mask = <000001fe>;
> + descriptor-types-mask = <03ab0ebf>;
> + };
> +
> + sdhc@2e000 {
> + model = "eSDHC";
> + compatible = "fsl,esdhc";
> + reg = <2e000 1000>;
> + interrupts = <2a 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + /* IPIC
> + * interrupts cell = <intr #, sense>
> + * sense values match linux IORESOURCE_IRQ_* defines:
> + * sense == 8: Level, low assertion
> + * sense == 2: Edge, high-to-low change
> + */
> + ipic: pic@700 {
> + compatible = "fsl,ipic";
> + interrupt-controller;
> + #address-cells = <0>;
> + #interrupt-cells = <2>;
> + reg = <700 100>;
> + };
> + };
> +
> + pci0: pci@e0008500 {
> + cell-index = <0>;
> + interrupt-map-mask = <f800 0 0 7>;
> + interrupt-map = <
> +
> + /* IDSEL 0x11 */
> + 8800 0 0 1 &ipic 14 8
> + 8800 0 0 2 &ipic 15 8
> + 8800 0 0 3 &ipic 16 8
> + 8800 0 0 4 &ipic 17 8
> +
> + /* IDSEL 0x12 */
> + 9000 0 0 1 &ipic 16 8
> + 9000 0 0 2 &ipic 17 8
> + 9000 0 0 3 &ipic 14 8
> + 9000 0 0 4 &ipic 15 8
> +
> + /* IDSEL 0x13 */
> + 9800 0 0 1 &ipic 17 8
> + 9800 0 0 2 &ipic 14 8
> + 9800 0 0 3 &ipic 15 8
> + 9800 0 0 4 &ipic 16 8
> +
> + /* IDSEL 0x15 */
> + a800 0 0 1 &ipic 14 8
> + a800 0 0 2 &ipic 15 8
> + a800 0 0 3 &ipic 16 8
> + a800 0 0 4 &ipic 17 8
> +
> + /* IDSEL 0x16 */
> + b000 0 0 1 &ipic 17 8
> + b000 0 0 2 &ipic 14 8
> + b000 0 0 3 &ipic 15 8
> + b000 0 0 4 &ipic 16 8
> +
> + /* IDSEL 0x17 */
> + b800 0 0 1 &ipic 16 8
> + b800 0 0 2 &ipic 17 8
> + b800 0 0 3 &ipic 14 8
> + b800 0 0 4 &ipic 15 8
> +
> + /* IDSEL 0x18 */
> + c000 0 0 1 &ipic 15 8
> + c000 0 0 2 &ipic 16 8
> + c000 0 0 3 &ipic 17 8
> + c000 0 0 4 &ipic 14 8>;
> + interrupt-parent = < &ipic >;
> + interrupts = <42 8>;
> + bus-range = <0 0>;
> + ranges = <02000000 0 90000000 90000000 0 10000000
> + 42000000 0 80000000 80000000 0 10000000
> + 01000000 0 00000000 e0300000 0 00100000>;
> + clock-frequency = <0>;
> + #interrupt-cells = <1>;
> + #size-cells = <2>;
> + #address-cells = <3>;
> + reg = <e0008500 100>;
> + compatible = "fsl,mpc8349-pci";
> + device_type = "pci";
> + };
> +};
> diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts b/arch/powerpc/boot/dts/mpc8379_mds.dts
> new file mode 100644
> index 0000000..4d651a3
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
> @@ -0,0 +1,291 @@
> +/*
> + * MPC8379E MDS Device Tree Source
> + *
> + * Copyright 2007 Freescale Semiconductor Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + */
> +
> +/ {
> + model = "fsl,mpc8379emds";
> + compatible = "fsl,mpc8379emds","fsl,mpc837xmds";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + aliases {
> + ethernet0 = &enet0;
> + ethernet1 = &enet1;
> + serial0 = &serial0;
> + serial1 = &serial1;
> + pci0 = &pci0;
> + };
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + PowerPC,8379@0 {
> + device_type = "cpu";
> + reg = <0>;
> + d-cache-line-size = <20>;
> + i-cache-line-size = <20>;
> + d-cache-size = <8000>; // L1, 32K
> + i-cache-size = <8000>; // L1, 32K
> + timebase-frequency = <0>;
> + bus-frequency = <0>;
> + clock-frequency = <0>;
> + };
> + };
> +
> + memory {
> + device_type = "memory";
> + reg = <00000000 20000000>; // 512MB at 0
> + };
> +
> + soc@e0000000 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + device_type = "soc";
> + ranges = <0 e0000000 00100000>;
> + reg = <e0000000 00000200>;
> + bus-frequency = <0>;
> +
> + wdt@200 {
> + compatible = "mpc83xx_wdt";
> + reg = <200 100>;
> + };
> +
> + i2c@3000 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + cell-index = <0>;
> + compatible = "fsl-i2c";
> + reg = <3000 100>;
> + interrupts = <e 8>;
> + interrupt-parent = < &ipic >;
> + dfsrr;
> + };
> +
> + i2c@3100 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + cell-index = <1>;
> + compatible = "fsl-i2c";
> + reg = <3100 100>;
> + interrupts = <f 8>;
> + interrupt-parent = < &ipic >;
> + dfsrr;
> + };
> +
> + spi@7000 {
> + compatible = "fsl_spi";
> + reg = <7000 1000>;
> + interrupts = <10 8>;
> + interrupt-parent = < &ipic >;
> + mode = "cpu";
> + };
> +
> + /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
> + usb@23000 {
> + compatible = "fsl-usb2-dr";
> + reg = <23000 1000>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + interrupt-parent = < &ipic >;
> + interrupts = <26 8>;
> + phy_type = "utmi_wide";
> + };
> +
> + mdio@24520 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "fsl,gianfar-mdio";
> + reg = <24520 20>;
> + phy2: ethernet-phy@2 {
> + interrupt-parent = < &ipic >;
> + interrupts = <11 8>;
> + reg = <2>;
> + device_type = "ethernet-phy";
> + };
> + phy3: ethernet-phy@3 {
> + interrupt-parent = < &ipic >;
> + interrupts = <12 8>;
> + reg = <3>;
> + device_type = "ethernet-phy";
> + };
> + };
> +
> + enet0: ethernet@24000 {
> + cell-index = <0>;
> + device_type = "network";
> + model = "eTSEC";
> + compatible = "gianfar";
> + reg = <24000 1000>;
> + local-mac-address = [ 00 00 00 00 00 00 ];
> + interrupts = <20 8 21 8 22 8>;
> + phy-connection-type = "mii";
> + interrupt-parent = < &ipic >;
> + phy-handle = < &phy2 >;
> + };
> +
> + enet1: ethernet@25000 {
> + cell-index = <1>;
> + device_type = "network";
> + model = "eTSEC";
> + compatible = "gianfar";
> + reg = <25000 1000>;
> + local-mac-address = [ 00 00 00 00 00 00 ];
> + interrupts = <23 8 24 8 25 8>;
> + phy-connection-type = "mii";
> + interrupt-parent = < &ipic >;
> + phy-handle = < &phy3 >;
> + };
> +
> + serial0: serial@4500 {
> + cell-index = <0>;
> + device_type = "serial";
> + compatible = "ns16550";
> + reg = <4500 100>;
> + clock-frequency = <0>;
> + interrupts = <9 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + serial1: serial@4600 {
> + cell-index = <1>;
> + device_type = "serial";
> + compatible = "ns16550";
> + reg = <4600 100>;
> + clock-frequency = <0>;
> + interrupts = <a 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + crypto@30000 {
> + model = "SEC3";
> + compatible = "talitos";
> + reg = <30000 10000>;
> + interrupts = <b 8>;
> + interrupt-parent = < &ipic >;
> + /* Rev. 3.0 geometry */
> + num-channels = <4>;
> + channel-fifo-len = <18>;
> + exec-units-mask = <000001fe>;
> + descriptor-types-mask = <03ab0ebf>;
> + };
> +
> + sdhc@2e000 {
> + model = "eSDHC";
> + compatible = "fsl,esdhc";
> + reg = <2e000 1000>;
> + interrupts = <2a 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + sata@18000 {
> + compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
> + reg = <18000 1000>;
> + interrupts = <2c 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + sata@19000 {
> + compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
> + reg = <19000 1000>;
> + interrupts = <2d 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + sata@1a000 {
> + compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
> + reg = <1a000 1000>;
> + interrupts = <2e 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + sata@1b000 {
> + compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
> + reg = <1b000 1000>;
> + interrupts = <2f 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + /* IPIC
> + * interrupts cell = <intr #, sense>
> + * sense values match linux IORESOURCE_IRQ_* defines:
> + * sense == 8: Level, low assertion
> + * sense == 2: Edge, high-to-low change
> + */
> + ipic: pic@700 {
> + compatible = "fsl,ipic";
> + interrupt-controller;
> + #address-cells = <0>;
> + #interrupt-cells = <2>;
> + reg = <700 100>;
> + };
> + };
> +
> + pci0: pci@e0008500 {
> + cell-index = <0>;
> + interrupt-map-mask = <f800 0 0 7>;
> + interrupt-map = <
> +
> + /* IDSEL 0x11 */
> + 8800 0 0 1 &ipic 14 8
> + 8800 0 0 2 &ipic 15 8
> + 8800 0 0 3 &ipic 16 8
> + 8800 0 0 4 &ipic 17 8
> +
> + /* IDSEL 0x12 */
> + 9000 0 0 1 &ipic 16 8
> + 9000 0 0 2 &ipic 17 8
> + 9000 0 0 3 &ipic 14 8
> + 9000 0 0 4 &ipic 15 8
> +
> + /* IDSEL 0x13 */
> + 9800 0 0 1 &ipic 17 8
> + 9800 0 0 2 &ipic 14 8
> + 9800 0 0 3 &ipic 15 8
> + 9800 0 0 4 &ipic 16 8
> +
> + /* IDSEL 0x15 */
> + a800 0 0 1 &ipic 14 8
> + a800 0 0 2 &ipic 15 8
> + a800 0 0 3 &ipic 16 8
> + a800 0 0 4 &ipic 17 8
> +
> + /* IDSEL 0x16 */
> + b000 0 0 1 &ipic 17 8
> + b000 0 0 2 &ipic 14 8
> + b000 0 0 3 &ipic 15 8
> + b000 0 0 4 &ipic 16 8
> +
> + /* IDSEL 0x17 */
> + b800 0 0 1 &ipic 16 8
> + b800 0 0 2 &ipic 17 8
> + b800 0 0 3 &ipic 14 8
> + b800 0 0 4 &ipic 15 8
> +
> + /* IDSEL 0x18 */
> + c000 0 0 1 &ipic 15 8
> + c000 0 0 2 &ipic 16 8
> + c000 0 0 3 &ipic 17 8
> + c000 0 0 4 &ipic 14 8>;
> + interrupt-parent = < &ipic >;
> + interrupts = <42 8>;
> + bus-range = <0 0>;
> + ranges = <02000000 0 90000000 90000000 0 10000000
> + 42000000 0 80000000 80000000 0 10000000
> + 01000000 0 00000000 e0300000 0 00100000>;
> + clock-frequency = <0>;
> + #interrupt-cells = <1>;
> + #size-cells = <2>;
> + #address-cells = <3>;
> + reg = <e0008500 100>;
> + compatible = "fsl,mpc8349-pci";
> + device_type = "pci";
> + };
> +};
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* [PATCH 0/7] mpc5121 support
From: John Rigby @ 2008-01-08 16:01 UTC (permalink / raw)
To: linuxppc-dev
The following series adds basic support
for mpc5121. I'm hoping that this can get reviewed
quickly so it can get into the for-2.6.25 tree.
^ permalink raw reply
* [PATCH 1/7] mpc5121: Add IPIC config option
From: John Rigby @ 2008-01-08 16:01 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1199808093-15929-1-git-send-email-jrigby@freescale.com>
IPIC is not just for 83xx anymore so make it a separate
config option.
Signed-off-by: John Rigby <jrigby@freescale.com>
---
arch/powerpc/platforms/Kconfig | 5 +++++
arch/powerpc/sysdev/Makefile | 2 +-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index ea22cad..ad9b1c0 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -22,6 +22,7 @@ config PPC_83xx
depends on 6xx
select FSL_SOC
select 83xx
+ select FSL_IPIC
select WANT_DEVICE_TREE
config PPC_86xx
@@ -80,6 +81,10 @@ config XICS
bool
default y
+config FSL_IPIC
+ bool
+ default n
+
config MPIC
bool
default n
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 9a20ef4..66fe39c 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -24,7 +24,7 @@ obj-$(CONFIG_AXON_RAM) += axonram.o
ifeq ($(CONFIG_PPC_MERGE),y)
obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
obj-$(CONFIG_PPC_I8259) += i8259.o
-obj-$(CONFIG_PPC_83xx) += ipic.o
+obj-$(CONFIG_FSL_IPIC) += ipic.o
obj-$(CONFIG_4xx) += uic.o
obj-$(CONFIG_XILINX_VIRTEX) += xilinx_intc.o
ifeq ($(CONFIG_PCI),y)
--
1.5.3.5.726.g41a7a
^ permalink raw reply related
* [PATCH 2/7] Add mpc512x ipic support
From: John Rigby @ 2008-01-08 16:01 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1199808093-15929-2-git-send-email-jrigby@freescale.com>
Added ipic_info entries for vectors used by 512x that
were previously unused by 83xx.
Signed-off-by: John Rigby <jrigby@freescale.com>
---
arch/powerpc/sysdev/ipic.c | 62 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index 7274750..4c016da 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -48,6 +48,13 @@ static struct ipic_info ipic_info[] = {
.bit = 17,
.prio_mask = 1,
},
+ [3] = {
+ .mask = IPIC_SIMSR_H,
+ .prio = IPIC_SIPRR_C,
+ .force = IPIC_SIFCR_H,
+ .bit = 18,
+ .prio_mask = 2,
+ },
[4] = {
.mask = IPIC_SIMSR_H,
.prio = IPIC_SIPRR_C,
@@ -55,6 +62,34 @@ static struct ipic_info ipic_info[] = {
.bit = 19,
.prio_mask = 3,
},
+ [5] = {
+ .mask = IPIC_SIMSR_H,
+ .prio = IPIC_SIPRR_C,
+ .force = IPIC_SIFCR_H,
+ .bit = 20,
+ .prio_mask = 4,
+ },
+ [6] = {
+ .mask = IPIC_SIMSR_H,
+ .prio = IPIC_SIPRR_C,
+ .force = IPIC_SIFCR_H,
+ .bit = 21,
+ .prio_mask = 5,
+ },
+ [7] = {
+ .mask = IPIC_SIMSR_H,
+ .prio = IPIC_SIPRR_C,
+ .force = IPIC_SIFCR_H,
+ .bit = 22,
+ .prio_mask = 6,
+ },
+ [8] = {
+ .mask = IPIC_SIMSR_H,
+ .prio = IPIC_SIPRR_C,
+ .force = IPIC_SIFCR_H,
+ .bit = 23,
+ .prio_mask = 7,
+ },
[9] = {
.mask = IPIC_SIMSR_H,
.prio = IPIC_SIPRR_D,
@@ -223,6 +258,20 @@ static struct ipic_info ipic_info[] = {
.bit = 7,
.prio_mask = 7,
},
+ [40] = {
+ .mask = IPIC_SIMSR_H,
+ .prio = IPIC_SIPRR_B,
+ .force = IPIC_SIFCR_H,
+ .bit = 8,
+ .prio_mask = 0,
+ },
+ [41] = {
+ .mask = IPIC_SIMSR_H,
+ .prio = IPIC_SIPRR_B,
+ .force = IPIC_SIFCR_H,
+ .bit = 9,
+ .prio_mask = 1,
+ },
[42] = {
.mask = IPIC_SIMSR_H,
.prio = IPIC_SIPRR_B,
@@ -230,6 +279,13 @@ static struct ipic_info ipic_info[] = {
.bit = 10,
.prio_mask = 2,
},
+ [43] = {
+ .mask = IPIC_SIMSR_H,
+ .prio = IPIC_SIPRR_B,
+ .force = IPIC_SIFCR_H,
+ .bit = 11,
+ .prio_mask = 3,
+ },
[44] = {
.mask = IPIC_SIMSR_H,
.prio = IPIC_SIPRR_B,
@@ -387,6 +443,12 @@ static struct ipic_info ipic_info[] = {
.force = IPIC_SIFCR_L,
.bit = 18,
},
+ [83] = {
+ .mask = IPIC_SIMSR_L,
+ .prio = 0,
+ .force = IPIC_SIFCR_L,
+ .bit = 19,
+ },
[84] = {
.mask = IPIC_SIMSR_L,
.prio = 0,
--
1.5.3.5.726.g41a7a
^ permalink raw reply related
* [PATCH 3/7] Basic Freescale MPC512x support
From: John Rigby @ 2008-01-08 16:01 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1199808093-15929-3-git-send-email-jrigby@freescale.com>
512x is very similar to 83xx and most
of this is patterned after code from 83xx
New platform:
changed:
arch/powerpc/Kconfig
arch/powerpc/platforms/Kconfig
arch/powerpc/platforms/Kconfig.cputype
arch/powerpc/platforms/Makefile
new:
arch/powerpc/platforms/512x/*
Signed-off-by: John Rigby <jrigby@freescale.com>
---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/platforms/512x/Kconfig | 20 ++++++
arch/powerpc/platforms/512x/Makefile | 4 +
arch/powerpc/platforms/512x/mpc5121_ads.c | 90 +++++++++++++++++++++++++++++
arch/powerpc/platforms/Kconfig | 8 +++
arch/powerpc/platforms/Kconfig.cputype | 6 +-
arch/powerpc/platforms/Makefile | 1 +
7 files changed, 127 insertions(+), 4 deletions(-)
create mode 100644 arch/powerpc/platforms/512x/Kconfig
create mode 100644 arch/powerpc/platforms/512x/Makefile
create mode 100644 arch/powerpc/platforms/512x/mpc5121_ads.c
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 66a3d8c..81c3f05 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -470,7 +470,7 @@ config PCI
bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx \
|| PPC_MPC52xx || (EMBEDDED && (PPC_PSERIES || PPC_ISERIES)) \
|| PPC_PS3
- default y if !40x && !CPM2 && !8xx && !PPC_83xx \
+ default y if !40x && !CPM2 && !8xx && !PPC_512x && !PPC_83xx \
&& !PPC_85xx && !PPC_86xx
default PCI_PERMEDIA if !4xx && !CPM2 && !8xx
default PCI_QSPAN if !4xx && !CPM2 && 8xx
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
new file mode 100644
index 0000000..399d279
--- /dev/null
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -0,0 +1,20 @@
+menu "Platform support"
+ depends on PPC_512x
+
+choice
+ prompt "Machine Type"
+ default MPC5121_ADS
+
+config MPC5121_ADS
+ bool "Freescale MPC5121E ADS"
+ select DEFAULT_UIMAGE
+ help
+ This option enables support for the MPC5121E ADS board.
+
+endchoice
+
+config MPC5121
+ bool
+ default y if MPC5121_ADS
+
+endmenu
diff --git a/arch/powerpc/platforms/512x/Makefile b/arch/powerpc/platforms/512x/Makefile
new file mode 100644
index 0000000..232c89f
--- /dev/null
+++ b/arch/powerpc/platforms/512x/Makefile
@@ -0,0 +1,4 @@
+#
+# Makefile for the Freescale PowerPC 512x linux kernel.
+#
+obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
new file mode 100644
index 0000000..a860bf0
--- /dev/null
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: John Rigby, <jrigby@freescale.com>, Thur Mar 29 2007
+ *
+ * Description:
+ * MPC5121 ADS board setup
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/time.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+
+#include <asm/system.h>
+#include <asm/atomic.h>
+#include <asm/machdep.h>
+#include <asm/ipic.h>
+#include <asm/prom.h>
+#include <asm/time.h>
+#include <asm/of_platform.h>
+
+static void __init mpc5121_ads_setup_arch(void)
+{
+ if (ppc_md.progress)
+ ppc_md.progress("mpc5121_ads_setup_arch()", 0);
+
+ printk(KERN_INFO "MPC5121 ADS board from Freescale Semiconductor\n");
+}
+
+static void __init mpc5121_ads_declare_of_platform_devices(void)
+{
+ /* Find every child of the SOC node and add it to of_platform */
+ if (of_platform_bus_probe(NULL, NULL, NULL))
+ printk(KERN_ERR __FILE__ ": "
+ "Error while probing of_platform bus\n");
+}
+
+static void __init mpc5121_ads_init_IRQ(void)
+{
+ struct device_node *np;
+
+ np = of_find_node_by_type(NULL, "ipic");
+ if (!np)
+ return;
+
+ ipic_init(np, 0);
+
+ /*
+ * Initialize the default interrupt mapping priorities,
+ * in case the boot rom changed something on us.
+ */
+ ipic_set_default_priority();
+}
+
+/*
+ * Called very early, MMU is off, device-tree isn't unflattened
+ */
+static int __init mpc5121_ads_probe(void)
+{
+ unsigned long root = of_get_flat_dt_root();
+
+ return of_flat_dt_is_compatible(root, "MPC5121ADS");
+}
+
+define_machine(mpc5121_ads) {
+ .name = "MPC5121 ADS",
+ .probe = mpc5121_ads_probe,
+ .setup_arch = mpc5121_ads_setup_arch,
+ .init = mpc5121_ads_declare_of_platform_devices,
+ .init_IRQ = mpc5121_ads_init_IRQ,
+ .get_irq = ipic_get_irq,
+ .calibrate_decr = generic_calibrate_decr,
+};
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index ad9b1c0..1daf47f 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -25,6 +25,13 @@ config PPC_83xx
select IPIC
select WANT_DEVICE_TREE
+config PPC_512x
+ bool "Freescale 512x"
+ depends on 6xx
+ select FSL_SOC
+ select IPIC
+ select WANT_DEVICE_TREE
+
config PPC_86xx
bool "Freescale 86xx"
depends on 6xx
@@ -41,6 +48,7 @@ config CLASSIC32
source "arch/powerpc/platforms/pseries/Kconfig"
source "arch/powerpc/platforms/iseries/Kconfig"
source "arch/powerpc/platforms/chrp/Kconfig"
+source "arch/powerpc/platforms/512x/Kconfig"
source "arch/powerpc/platforms/52xx/Kconfig"
source "arch/powerpc/platforms/powermac/Kconfig"
source "arch/powerpc/platforms/prep/Kconfig"
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index c3ee0b5..e21ffa5 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -14,7 +14,7 @@ choice
There are five families of 32 bit PowerPC chips supported.
The most common ones are the desktop and server CPUs (601, 603,
604, 740, 750, 74xx) CPUs from Freescale and IBM, with their
- embedded 52xx/82xx/83xx/86xx counterparts.
+ embedded 512x/52xx/82xx/83xx/86xx counterparts.
The other embeeded parts, namely 4xx, 8xx, e200 (55xx) and e500
(85xx) each form a family of their own that is not compatible
with the others.
@@ -22,7 +22,7 @@ choice
If unsure, select 52xx/6xx/7xx/74xx/82xx/83xx/86xx.
config 6xx
- bool "52xx/6xx/7xx/74xx/82xx/83xx/86xx"
+ bool "512x/52xx/6xx/7xx/74xx/82xx/83xx/86xx"
select PPC_FPU
config PPC_85xx
@@ -229,7 +229,7 @@ config NR_CPUS
config NOT_COHERENT_CACHE
bool
- depends on 4xx || 8xx || E200
+ depends on 4xx || 8xx || E200 || PPC_512x
default y
config CHECK_CACHE_COHERENCY
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 6d9079d..633a599 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -11,6 +11,7 @@ endif
obj-$(CONFIG_PPC_CHRP) += chrp/
obj-$(CONFIG_40x) += 40x/
obj-$(CONFIG_44x) += 44x/
+obj-$(CONFIG_PPC_512x) += 512x/
obj-$(CONFIG_PPC_MPC52xx) += 52xx/
obj-$(CONFIG_PPC_8xx) += 8xx/
obj-$(CONFIG_PPC_82xx) += 82xx/
--
1.5.3.5.726.g41a7a
^ permalink raw reply related
* [PATCH 5/7] Separate MPC52xx PSC FIFO registers from rest of PSC
From: John Rigby @ 2008-01-08 16:01 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1199808093-15929-5-git-send-email-jrigby@freescale.com>
This is in preparation for the addition of MPC512x
PSC support. The main difference in the 512x is
in the fifo registers.
Signed-off-by: John Rigby <jrigby@freescale.com>
---
drivers/serial/mpc52xx_uart.c | 10 ++++++----
include/asm-powerpc/mpc52xx_psc.h | 3 +++
include/asm-ppc/mpc52xx_psc.h | 3 +++
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index ec36ad7..25a91c9 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -111,6 +111,7 @@ static void mpc52xx_uart_of_enumerate(void);
#endif
#define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase))
+#define FIFO(port) ((struct mpc52xx_psc_fifo __iomem *)(PSC(port)+1))
/* Forward declaration of the interruption handling routine */
@@ -222,6 +223,7 @@ static int
mpc52xx_uart_startup(struct uart_port *port)
{
struct mpc52xx_psc __iomem *psc = PSC(port);
+ struct mpc52xx_psc_fifo __iomem *fifo = FIFO(port);
int ret;
/* Request IRQ */
@@ -238,10 +240,10 @@ mpc52xx_uart_startup(struct uart_port *port)
out_be16(&psc->mpc52xx_psc_clock_select, 0xdd00); /* /16 prescaler on */
- out_8(&psc->rfcntl, 0x00);
- out_be16(&psc->rfalarm, 0x1ff);
- out_8(&psc->tfcntl, 0x07);
- out_be16(&psc->tfalarm, 0x80);
+ out_8(&fifo->rfcntl, 0x00);
+ out_be16(&fifo->rfalarm, 0x1ff);
+ out_8(&fifo->tfcntl, 0x07);
+ out_be16(&fifo->tfalarm, 0x80);
port->read_status_mask |= MPC52xx_PSC_IMR_RXRDY | MPC52xx_PSC_IMR_TXRDY;
out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
diff --git a/include/asm-powerpc/mpc52xx_psc.h b/include/asm-powerpc/mpc52xx_psc.h
index 26690d2..bea42b9 100644
--- a/include/asm-powerpc/mpc52xx_psc.h
+++ b/include/asm-powerpc/mpc52xx_psc.h
@@ -153,6 +153,9 @@ struct mpc52xx_psc {
u8 reserved16[3];
u8 irfdr; /* PSC + 0x54 */
u8 reserved17[3];
+};
+
+struct mpc52xx_psc_fifo {
u16 rfnum; /* PSC + 0x58 */
u16 reserved18;
u16 tfnum; /* PSC + 0x5c */
diff --git a/include/asm-ppc/mpc52xx_psc.h b/include/asm-ppc/mpc52xx_psc.h
index c82b8d4..39fcd02 100644
--- a/include/asm-ppc/mpc52xx_psc.h
+++ b/include/asm-ppc/mpc52xx_psc.h
@@ -159,6 +159,9 @@ struct mpc52xx_psc {
u8 reserved16[3];
u8 irfdr; /* PSC + 0x54 */
u8 reserved17[3];
+};
+
+struct mpc52xx_psc_fifo {
u16 rfnum; /* PSC + 0x58 */
u16 reserved18;
u16 tfnum; /* PSC + 0x5c */
--
1.5.3.5.726.g41a7a
^ permalink raw reply related
* [PATCH 4/7] Device tree for MPC5121 ADS
From: John Rigby @ 2008-01-08 16:01 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1199808093-15929-4-git-send-email-jrigby@freescale.com>
Bare minimum tree containing only
what is currently supported.
Signed-off-by: John Rigby <jrigby@freescale.com>
---
arch/powerpc/boot/dts/mpc5121ads.dts | 102 ++++++++++++++++++++++++++++++++++
1 files changed, 102 insertions(+), 0 deletions(-)
create mode 100644 arch/powerpc/boot/dts/mpc5121ads.dts
diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts
new file mode 100644
index 0000000..26471ff
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc5121ads.dts
@@ -0,0 +1,102 @@
+/*
+ * MPC5121E MDS Device Tree Source
+ *
+ * Copyright 2007 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+/ {
+ model = "MPC5121ADS";
+ compatible = "MPC5121ADS";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ PowerPC,5121@0 {
+ device_type = "cpu";
+ reg = <0>;
+ d-cache-line-size = <20>; // 32 bytes
+ i-cache-line-size = <20>; // 32 bytes
+ d-cache-size = <8000>; // L1, 32K
+ i-cache-size = <8000>; // L1, 32K
+ ref-frequency = <3ef1480>; // 66MHz ref clock
+ timebase-frequency = <2f34f60>; // 49.5MHz (396MHz/8) makes time tick correctly
+ bus-frequency = <bcd3d80>; // 198MHz csb bus
+ clock-frequency = <179a7b00>; // 396MHz ppc core ??
+ 32-bit;
+ };
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <00000000 10000000>; // 256MB at 0
+ };
+
+ cpld@82000000 {
+ device_type = "board-control";
+ reg = <82000000 8000>;
+ };
+
+ soc5121@80000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ #interrupt-cells = <2>;
+ device_type = "soc";
+ ranges = <0 80000000 400000>;
+ reg = <80000000 400000>;
+ ref-frequency = <3ef1480>; // 66MHz ref
+ bus-frequency = <5e69ec0>; // 99MHz ips ref
+
+ // IPIC
+ // interrupts cell = <intr #, sense>
+ // sense values match linux IORESOURCE_IRQ_* defines:
+ // sense == 8: Level, low assertion
+ // sense == 2: Edge, high-to-low change
+ //
+ ipic: pic@c00 {
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ reg = <c00 100>;
+ built-in;
+ device_type = "ipic";
+ };
+
+ // 512x PSCs are not 52xx PSCs compatible
+ // PSC3 serial port A aka ttyPSC0
+ serial@11300 {
+ device_type = "serial";
+ compatible = "mpc512x-psc-uart";
+ port-number = <0>; // Logical port assignment
+ cell-index = <3>;
+ reg = <11300 100>;
+ interrupts = <28 8>; // actually the fifo irq
+ interrupt-parent = < &ipic >;
+ };
+
+ // PSC4 serial port B aka ttyPSC1
+ serial@11400 {
+ device_type = "serial";
+ compatible = "mpc512x-psc-uart";
+ port-number = <1>; // Logical port assignment
+ cell-index = <4>;
+ reg = <11400 100>;
+ interrupts = <28 8>; // actually the fifo irq
+ interrupt-parent = < &ipic >;
+ };
+
+ pscsfifo@11f00 {
+ compatible = "mpc512x-pscsfifo";
+ reg = <11f00 100>;
+ interrupts = <28 8>;
+ interrupt-parent = < &ipic >;
+ };
+ };
+};
--
1.5.3.5.726.g41a7a
^ permalink raw reply related
* [PATCH 6/7] Add mpc512x_find_ips_freq
From: John Rigby @ 2008-01-08 16:01 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1199808093-15929-6-git-send-email-jrigby@freescale.com>
Added mpc512x_find_ips_freq needed by the following
serial driver patch. It is basically a renamed
mpc512x_find_ipd_freq from 52xx.
Signed-off-by: John Rigby <jrigby@freescale.com>
---
arch/powerpc/platforms/512x/mpc5121_ads.c | 28 ++++++++++++++++++++++++++++
include/asm-powerpc/mpc512x.h | 22 ++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)
create mode 100644 include/asm-powerpc/mpc512x.h
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
index a860bf0..2f4cfee 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -36,6 +36,34 @@
#include <asm/time.h>
#include <asm/of_platform.h>
+/**
+ * mpc512x_find_ips_freq - Find the IPB bus frequency for a device
+ * @node: device node
+ *
+ * Returns IPS bus frequency, or 0 if the bus frequency cannot be found.
+ */
+unsigned long
+mpc512x_find_ips_freq(struct device_node *node)
+{
+ struct device_node *np;
+ const unsigned int *p_ips_freq = NULL;
+
+ of_node_get(node);
+ while (node) {
+ p_ips_freq = of_get_property(node, "bus-frequency", NULL);
+ if (p_ips_freq)
+ break;
+
+ np = of_get_parent(node);
+ of_node_put(node);
+ node = np;
+ }
+ if (node)
+ of_node_put(node);
+
+ return p_ips_freq ? *p_ips_freq : 0;
+}
+
static void __init mpc5121_ads_setup_arch(void)
{
if (ppc_md.progress)
diff --git a/include/asm-powerpc/mpc512x.h b/include/asm-powerpc/mpc512x.h
new file mode 100644
index 0000000..c48a165
--- /dev/null
+++ b/include/asm-powerpc/mpc512x.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: John Rigby, <jrigby@freescale.com>, Friday Apr 13 2007
+ *
+ * Description:
+ * MPC5121 Prototypes and definitions
+ *
+ * This 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.
+ *
+ */
+
+#ifndef __ASM_POWERPC_MPC512x_H__
+#define __ASM_POWERPC_MPC512x_H__
+
+extern unsigned long mpc512x_find_ips_freq(struct device_node *node);
+
+#endif /* __ASM_POWERPC_MPC512x_H__ */
+
--
1.5.3.5.726.g41a7a
^ permalink raw reply related
* [PATCH 7/7] Add MPC512x PSC serial driver
From: John Rigby @ 2008-01-08 16:01 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1199808093-15929-7-git-send-email-jrigby@freescale.com>
mpc512x_uart.c is based on mpc52xx_uart.c with
names changed
arch/ppc support removed
512x psc fifo support added
shares mpc52xx_psc.h with 52xx driver
Signed-off-by: John Rigby <jrigby@freescale.com>
---
drivers/serial/Kconfig | 18 +
drivers/serial/Makefile | 1 +
drivers/serial/mpc512x_uart.c | 969 +++++++++++++++++++++++++++++++++++++
include/asm-powerpc/mpc52xx_psc.h | 47 ++
4 files changed, 1035 insertions(+), 0 deletions(-)
create mode 100644 drivers/serial/mpc512x_uart.c
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index d7e1996..643b84a 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -1113,6 +1113,24 @@ config SERIAL_SGI_L1_CONSOLE
controller serial port as your console (you want this!),
say Y. Otherwise, say N.
+config SERIAL_MPC512x
+ tristate "Freescale MPC512x family PSC serial support"
+ depends on PPC_512x
+ select SERIAL_CORE
+ help
+ This drivers support the MPC512x PSC serial ports. If you would
+ like to use them, you must answer Y or M to this option. Not that
+ for use as console, it must be included in kernel and not as a
+ module.
+
+config SERIAL_MPC512x_CONSOLE
+ bool "Console on a Freescale MPC512x family PSC serial port"
+ depends on SERIAL_MPC512x=y
+ select SERIAL_CORE_CONSOLE
+ help
+ Select this options if you'd like to use one of the PSC serial port
+ of the Freescale MPC52xx family as a console.
+
config SERIAL_MPC52xx
tristate "Freescale MPC52xx family PSC serial support"
depends on PPC_MPC52xx
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index af6377d..13e8176 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -48,6 +48,7 @@ obj-$(CONFIG_SERIAL_SH_SCI) += sh-sci.o
obj-$(CONFIG_SERIAL_SGI_L1_CONSOLE) += sn_console.o
obj-$(CONFIG_SERIAL_CPM) += cpm_uart/
obj-$(CONFIG_SERIAL_IMX) += imx.o
+obj-$(CONFIG_SERIAL_MPC512x) += mpc512x_uart.o
obj-$(CONFIG_SERIAL_MPC52xx) += mpc52xx_uart.o
obj-$(CONFIG_SERIAL_ICOM) += icom.o
obj-$(CONFIG_SERIAL_M32R_SIO) += m32r_sio.o
diff --git a/drivers/serial/mpc512x_uart.c b/drivers/serial/mpc512x_uart.c
new file mode 100644
index 0000000..e2ff0b8
--- /dev/null
+++ b/drivers/serial/mpc512x_uart.c
@@ -0,0 +1,969 @@
+/*
+ * Driver for the PSC of the Freescale MPC512x PSCs configured as UARTs.
+ *
+ * Copyright (C) 2007 Freescale Semiconductor Inc
+ * John Rigby <jrigby@freescale.com>
+ *
+ * Fork of mpc512x_uart.c:
+ *
+ * Copyright (C) 2006 Secret Lab Technologies Ltd.
+ * Grant Likely <grant.likely@secretlab.ca>
+ * Copyright (C) 2004-2006 Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2003 MontaVista, Software, Inc.
+ * Dale Farnsworth <dfarnsworth@mvista.com>.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/*
+ * The 512x PSCs are almost identical to those on 52xx. The most notable
+ * difference is that the FIFOs have been separated out. This file
+ * still uses the mpc52xx_psc.h which has had the fifo differences added.
+ *
+ * TODO (maybe) abstract out the fifo differences and merge this back
+ * into mpc512x_serial.c
+ */
+
+/* OF Platform device Usage :
+ *
+ * This driver is only used for PSCs configured in uart mode. The device
+ * tree will have a node for each PSC in uart mode w/ device_type = "serial"
+ * and "mpc52xx-psc-uart" in the compatible string
+ *
+ * By default, PSC devices are enumerated in the order they are found. However
+ * a particular PSC number can be forced by adding 'device_no = <port#>'
+ * to the device node.
+ *
+ * The driver init all necessary registers to place the PSC in uart mode without
+ * DCD. However, the pin multiplexing aren't changed and should be set either
+ * by the bootloader or in the platform init code.
+ */
+
+#undef DEBUG
+
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/tty.h>
+#include <linux/serial.h>
+#include <linux/sysrq.h>
+#include <linux/console.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+
+#include <asm/of_platform.h>
+#include <asm/mpc52xx_psc.h>
+#include <asm/mpc512x.h>
+
+#if defined(CONFIG_SERIAL_MPC512x_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#define SUPPORT_SYSRQ
+#endif
+
+#include <linux/serial_core.h>
+
+/* We've been assigned a range on the "Low-density serial ports" major */
+#define SERIAL_PSC_MAJOR 204
+#define SERIAL_PSC_MINOR 148
+
+#define ISR_PASS_LIMIT 256 /* Max number of iteration in the interrupt */
+
+static struct uart_port mpc512x_uart_ports[MPC52xx_PSC_MAXNUM];
+
+/* lookup table for matching device nodes to index numbers */
+static struct device_node *mpc512x_uart_nodes[MPC52xx_PSC_MAXNUM];
+
+static void mpc512x_uart_of_enumerate(void);
+
+static unsigned long getuartclk(void *p)
+{
+ return mpc512x_find_ips_freq(p);
+}
+
+#define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase))
+#define FIFO(port) ((struct mpc512x_psc_fifo __iomem *)(PSC(port)+1))
+
+/* Forward declaration of the interruption handling routine */
+static irqreturn_t mpc512x_uart_int(int irq, void *dev_id);
+
+/* Simple macro to test if a port is console or not. This one is taken
+ * for serial_core.c and maybe should be moved to serial_core.h ? */
+#ifdef CONFIG_SERIAL_CORE_CONSOLE
+#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line)
+#else
+#define uart_console(port) (0)
+#endif
+
+static struct of_device_id mpc512x_uart_of_match[] = {
+ {.type = "serial", .compatible = "mpc512x-psc-uart",},
+ {},
+};
+
+/* ======================================================================== */
+/* UART operations */
+/* ======================================================================== */
+
+static unsigned int mpc512x_uart_tx_empty(struct uart_port *port)
+{
+ int status;
+
+ status = in_be32(&FIFO(port)->txsr);
+ return (status & MPC512x_PSC_FIFO_EMPTY) ? TIOCSER_TEMT : 0;
+}
+
+static void mpc512x_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
+{
+ /* Not implemented */
+}
+
+static unsigned int mpc512x_uart_get_mctrl(struct uart_port *port)
+{
+ /* Not implemented */
+ return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
+}
+
+static void mpc512x_uart_stop_tx(struct uart_port *port)
+{
+ /* port->lock taken by caller */
+ unsigned long tx_fifo_imr;
+
+ tx_fifo_imr = in_be32(&FIFO(port)->tximr);
+ tx_fifo_imr &= ~MPC512x_PSC_FIFO_ALARM;
+ out_be32(&FIFO(port)->tximr, tx_fifo_imr);
+}
+
+static void mpc512x_uart_start_tx(struct uart_port *port)
+{
+ /* port->lock taken by caller */
+ unsigned long tx_fifo_imr;
+
+ tx_fifo_imr = in_be32(&FIFO(port)->tximr);
+ tx_fifo_imr |= MPC512x_PSC_FIFO_ALARM;
+ out_be32(&FIFO(port)->tximr, tx_fifo_imr);
+}
+
+static void mpc512x_uart_send_xchar(struct uart_port *port, char ch)
+{
+ unsigned long flags;
+ spin_lock_irqsave(&port->lock, flags);
+
+ port->x_char = ch;
+ if (ch) {
+ /* Make sure tx interrupts are on */
+ /* Truly necessary ??? They should be anyway */
+ unsigned long tx_fifo_imr;
+
+ tx_fifo_imr = in_be32(&FIFO(port)->tximr);
+ tx_fifo_imr |= MPC512x_PSC_FIFO_ALARM;
+ out_be32(&FIFO(port)->tximr, tx_fifo_imr);
+ }
+
+ spin_unlock_irqrestore(&port->lock, flags);
+}
+
+static void mpc512x_uart_stop_rx(struct uart_port *port)
+{
+ /* port->lock taken by caller */
+ unsigned long rx_fifo_imr;
+
+ rx_fifo_imr = in_be32(&FIFO(port)->rximr);
+ rx_fifo_imr &= ~MPC512x_PSC_FIFO_ALARM;
+ out_be32(&FIFO(port)->rximr, rx_fifo_imr);
+}
+
+static void mpc512x_uart_enable_ms(struct uart_port *port)
+{
+ /* Not implemented */
+}
+
+static void mpc512x_uart_break_ctl(struct uart_port *port, int ctl)
+{
+ unsigned long flags;
+ spin_lock_irqsave(&port->lock, flags);
+
+ if (ctl == -1)
+ out_8(&PSC(port)->command, MPC52xx_PSC_START_BRK);
+ else
+ out_8(&PSC(port)->command, MPC52xx_PSC_STOP_BRK);
+
+ spin_unlock_irqrestore(&port->lock, flags);
+}
+
+static void mpc512x_uart_fifo_init(struct mpc52xx_psc *psc)
+{
+ struct mpc512x_psc_fifo *fifo;
+
+ /* fifo is right after the psc */
+ fifo = (struct mpc512x_psc_fifo *)(psc + 1);
+
+ out_be32(&fifo->txcmd, MPC512x_PSC_FIFO_RESET_SLICE);
+ out_be32(&fifo->txcmd, MPC512x_PSC_FIFO_ENABLE_SLICE);
+ out_be32(&fifo->txalarm, 1);
+ out_be32(&fifo->tximr, 0);
+
+ out_be32(&fifo->rxcmd, MPC512x_PSC_FIFO_RESET_SLICE);
+ out_be32(&fifo->rxcmd, MPC512x_PSC_FIFO_ENABLE_SLICE);
+ out_be32(&fifo->rxalarm, 1);
+ out_be32(&fifo->rximr, 0);
+}
+
+static int mpc512x_uart_startup(struct uart_port *port)
+{
+ struct mpc52xx_psc __iomem *psc = PSC(port);
+ int ret;
+
+ /* Request IRQ */
+ ret = request_irq(port->irq, mpc512x_uart_int,
+ IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
+ "mpc512x_psc_uart", port);
+ if (ret)
+ return ret;
+
+ /* Reset/activate the port, clear and enable interrupts */
+ out_8(&psc->command, MPC52xx_PSC_RST_RX);
+ out_8(&psc->command, MPC52xx_PSC_RST_TX);
+
+ out_be32(&psc->sicr, 0); /* UART mode DCD ignored */
+
+ mpc512x_uart_fifo_init(psc);
+
+ out_be32(&FIFO(port)->tximr, MPC512x_PSC_FIFO_ALARM);
+ out_be32(&FIFO(port)->rximr, MPC512x_PSC_FIFO_ALARM);
+
+ out_8(&psc->command, MPC52xx_PSC_TX_ENABLE);
+ out_8(&psc->command, MPC52xx_PSC_RX_ENABLE);
+
+ return 0;
+}
+
+static void mpc512x_uart_shutdown(struct uart_port *port)
+{
+ struct mpc52xx_psc __iomem *psc = PSC(port);
+
+ /* Shut down the port. Leave TX active if on a console port */
+ out_8(&psc->command, MPC52xx_PSC_RST_RX);
+ if (!uart_console(port))
+ out_8(&psc->command, MPC52xx_PSC_RST_TX);
+
+ out_be32(&FIFO(port)->tximr, 0);
+ out_be32(&FIFO(port)->rximr, 0);
+
+ /* Release interrupt */
+ free_irq(port->irq, port);
+}
+
+static void
+mpc512x_uart_set_termios(struct uart_port *port, struct ktermios *new,
+ struct ktermios *old)
+{
+ struct mpc52xx_psc __iomem *psc = PSC(port);
+ unsigned long flags;
+ unsigned char mr1, mr2;
+ unsigned short ctr;
+ unsigned int j, baud, quot;
+ struct mpc512x_psc_fifo *fifo = FIFO(port);
+
+ /* Prepare what we're gonna write */
+ mr1 = 0;
+
+ switch (new->c_cflag & CSIZE) {
+ case CS5:
+ mr1 |= MPC52xx_PSC_MODE_5_BITS;
+ break;
+ case CS6:
+ mr1 |= MPC52xx_PSC_MODE_6_BITS;
+ break;
+ case CS7:
+ mr1 |= MPC52xx_PSC_MODE_7_BITS;
+ break;
+ case CS8:
+ default:
+ mr1 |= MPC52xx_PSC_MODE_8_BITS;
+ }
+
+ if (new->c_cflag & PARENB) {
+ mr1 |= (new->c_cflag & PARODD) ?
+ MPC52xx_PSC_MODE_PARODD : MPC52xx_PSC_MODE_PAREVEN;
+ } else
+ mr1 |= MPC52xx_PSC_MODE_PARNONE;
+
+ mr2 = 0;
+
+ if (new->c_cflag & CSTOPB)
+ mr2 |= MPC52xx_PSC_MODE_TWO_STOP;
+ else
+ mr2 |= ((new->c_cflag & CSIZE) == CS5) ?
+ MPC52xx_PSC_MODE_ONE_STOP_5_BITS :
+ MPC52xx_PSC_MODE_ONE_STOP;
+
+ baud = uart_get_baud_rate(port, new, old, 0, port->uartclk / 16);
+ quot = uart_get_divisor(port, baud);
+ ctr = quot & 0xffff;
+
+ /* Get the lock */
+ spin_lock_irqsave(&port->lock, flags);
+
+ /* Update the per-port timeout */
+ uart_update_timeout(port, new->c_cflag, baud);
+
+ /* Do our best to flush TX & RX, so we don't loose anything */
+ /* But we don't wait indefinitly ! */
+ j = 5000000; /* Maximum wait */
+ /* FIXME Can't receive chars since set_termios might be called at early
+ * boot for the console, all stuff is not yet ready to receive at that
+ * time and that just makes the kernel oops */
+ /* while (j-- && mpc512x_uart_int_rx_chars(port)); */
+ while (!(in_be32(&fifo->txsr) & MPC512x_PSC_FIFO_EMPTY) && --j)
+ udelay(1);
+
+ if (!j)
+ printk(KERN_ERR "mpc512x_uart.c: "
+ "Unable to flush RX & TX fifos in-time in set_termios."
+ "Some chars may have been lost.\n");
+
+ /* Reset the TX & RX */
+ out_8(&psc->command, MPC52xx_PSC_RST_RX);
+ out_8(&psc->command, MPC52xx_PSC_RST_TX);
+
+ /* Send new mode settings */
+ out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1);
+ out_8(&psc->mode, mr1);
+ out_8(&psc->mode, mr2);
+ out_8(&psc->ctur, ctr >> 8);
+ out_8(&psc->ctlr, ctr & 0xff);
+
+ /* Reenable TX & RX */
+ out_8(&psc->command, MPC52xx_PSC_TX_ENABLE);
+ out_8(&psc->command, MPC52xx_PSC_RX_ENABLE);
+
+ /* We're all set, release the lock */
+ spin_unlock_irqrestore(&port->lock, flags);
+}
+
+static const char *mpc512x_uart_type(struct uart_port *port)
+{
+ return port->type == PORT_MPC52xx ? "MPC52xx PSC" : NULL;
+}
+
+static void mpc512x_uart_release_port(struct uart_port *port)
+{
+ /* remapped by us ? */
+ if (port->flags & UPF_IOREMAP) {
+ iounmap(port->membase);
+ port->membase = NULL;
+ }
+
+ release_mem_region(port->mapbase, sizeof(struct mpc52xx_psc));
+}
+
+static int mpc512x_uart_request_port(struct uart_port *port)
+{
+ int err;
+
+ if (port->flags & UPF_IOREMAP) /* Need to remap ? */
+ port->membase = ioremap(port->mapbase,
+ sizeof(struct mpc52xx_psc));
+
+ if (!port->membase)
+ return -EINVAL;
+
+ err = request_mem_region(port->mapbase, sizeof(struct mpc52xx_psc),
+ "mpc512x_psc_uart") != NULL ? 0 : -EBUSY;
+
+ if (err && (port->flags & UPF_IOREMAP)) {
+ iounmap(port->membase);
+ port->membase = NULL;
+ }
+
+ return err;
+}
+
+static void mpc512x_uart_config_port(struct uart_port *port, int flags)
+{
+ if ((flags & UART_CONFIG_TYPE) &&
+ (mpc512x_uart_request_port(port) == 0))
+ port->type = PORT_MPC52xx;
+}
+
+static int
+mpc512x_uart_verify_port(struct uart_port *port, struct serial_struct *ser)
+{
+ if (ser->type != PORT_UNKNOWN && ser->type != PORT_MPC52xx)
+ return -EINVAL;
+
+ if ((ser->irq != port->irq) ||
+ (ser->io_type != SERIAL_IO_MEM) ||
+ (ser->baud_base != port->uartclk) ||
+ (ser->iomem_base != (void *)port->mapbase) || (ser->hub6 != 0))
+ return -EINVAL;
+
+ return 0;
+}
+
+static struct uart_ops mpc512x_uart_ops = {
+ .tx_empty = mpc512x_uart_tx_empty,
+ .set_mctrl = mpc512x_uart_set_mctrl,
+ .get_mctrl = mpc512x_uart_get_mctrl,
+ .stop_tx = mpc512x_uart_stop_tx,
+ .start_tx = mpc512x_uart_start_tx,
+ .send_xchar = mpc512x_uart_send_xchar,
+ .stop_rx = mpc512x_uart_stop_rx,
+ .enable_ms = mpc512x_uart_enable_ms,
+ .break_ctl = mpc512x_uart_break_ctl,
+ .startup = mpc512x_uart_startup,
+ .shutdown = mpc512x_uart_shutdown,
+ .set_termios = mpc512x_uart_set_termios,
+/* .pm = mpc512x_uart_pm, Not supported yet */
+/* .set_wake = mpc512x_uart_set_wake, Not supported yet */
+ .type = mpc512x_uart_type,
+ .release_port = mpc512x_uart_release_port,
+ .request_port = mpc512x_uart_request_port,
+ .config_port = mpc512x_uart_config_port,
+ .verify_port = mpc512x_uart_verify_port
+};
+
+/* ======================================================================== */
+/* Interrupt handling */
+/* ======================================================================== */
+
+static inline int mpc512x_uart_int_rx_chars(struct uart_port *port)
+{
+ struct tty_struct *tty = port->info->tty;
+ unsigned char ch, flag;
+ unsigned short status;
+ unsigned long fifostatus;
+ struct mpc52xx_psc __iomem *psc = PSC(port);
+ struct mpc512x_psc_fifo __iomem *fifo = FIFO(port);
+
+ /* While we can read, do so ! */
+ while (1) {
+ fifostatus = in_be32(&fifo->rxsr);
+
+ if (fifostatus & MPC512x_PSC_FIFO_EMPTY)
+ break;
+
+ status = in_be16(&psc->mpc52xx_psc_status);
+
+ /* Get the char */
+ ch = in_8(&fifo->rxdata_8);
+
+ /* Handle sysreq char */
+#ifdef SUPPORT_SYSRQ
+ if (uart_handle_sysrq_char(port, ch)) {
+ port->sysrq = 0;
+ continue;
+ }
+#endif
+
+ /* Store it */
+
+ flag = TTY_NORMAL;
+ port->icount.rx++;
+
+ if (status & (MPC52xx_PSC_SR_PE |
+ MPC52xx_PSC_SR_FE | MPC52xx_PSC_SR_RB)) {
+
+ if (status & MPC52xx_PSC_SR_RB) {
+ flag = TTY_BREAK;
+ uart_handle_break(port);
+ } else if (status & MPC52xx_PSC_SR_PE)
+ flag = TTY_PARITY;
+ else if (status & MPC52xx_PSC_SR_FE)
+ flag = TTY_FRAME;
+
+ /* Clear error condition */
+ out_8(&PSC(port)->command, MPC52xx_PSC_RST_ERR_STAT);
+
+ }
+ tty_insert_flip_char(tty, ch, flag);
+ if (status & MPC52xx_PSC_SR_OE) {
+ /*
+ * Overrun is special, since it's
+ * reported immediately, and doesn't
+ * affect the current character
+ */
+ tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+ }
+ }
+
+ tty_flip_buffer_push(tty);
+
+ fifostatus = in_be32(&fifo->rxsr);
+ return !(fifostatus & MPC512x_PSC_FIFO_EMPTY);
+}
+
+static inline int mpc512x_uart_int_tx_chars(struct uart_port *port)
+{
+ struct circ_buf *xmit = &port->info->xmit;
+ struct mpc512x_psc_fifo *fifo = FIFO(port);
+
+ /* Process out of band chars */
+ if (port->x_char) {
+ out_8(&fifo->txdata_8, port->x_char);
+ port->icount.tx++;
+ port->x_char = 0;
+ return 1;
+ }
+
+ /* Nothing to do ? */
+ if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
+ mpc512x_uart_stop_tx(port);
+ return 0;
+ }
+
+ /* Send chars */
+ while (!(in_be32(&fifo->txsr) & MPC512x_PSC_FIFO_FULL)) {
+ out_8(&fifo->txdata_8, xmit->buf[xmit->tail]);
+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+ port->icount.tx++;
+ if (uart_circ_empty(xmit))
+ break;
+ }
+
+ /* Wake up */
+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
+ uart_write_wakeup(port);
+
+ /* Maybe we're done after all */
+ if (uart_circ_empty(xmit)) {
+ mpc512x_uart_stop_tx(port);
+ return 0;
+ }
+
+ return 1;
+}
+
+static irqreturn_t mpc512x_uart_int(int irq, void *dev_id)
+{
+ struct uart_port *port = dev_id;
+ unsigned long pass = ISR_PASS_LIMIT;
+ unsigned int keepgoing;
+ unsigned long rx_fifo_status;
+ unsigned long tx_fifo_status;
+
+ spin_lock(&port->lock);
+
+ /* While we have stuff to do, we continue */
+ do {
+ /* If we don't find anything to do, we stop */
+ keepgoing = 0;
+
+ /* clear any pending interrupts */
+ out_be32(&FIFO(port)->rxisr, in_be32(&FIFO(port)->rxisr));
+
+ rx_fifo_status = in_be32(&FIFO(port)->rxsr);
+ out_be32(&FIFO(port)->rxisr, rx_fifo_status);
+ rx_fifo_status &= in_be32(&FIFO(port)->rximr);
+
+ if (rx_fifo_status & MPC512x_PSC_FIFO_ALARM)
+ keepgoing |= mpc512x_uart_int_rx_chars(port);
+
+ /* clear any pending interrupts */
+ out_be32(&FIFO(port)->txisr, in_be32(&FIFO(port)->txisr));
+
+ tx_fifo_status = in_be32(&FIFO(port)->txsr);
+ out_be32(&FIFO(port)->txisr, tx_fifo_status);
+ tx_fifo_status &= in_be32(&FIFO(port)->tximr);
+
+ if (tx_fifo_status & MPC512x_PSC_FIFO_ALARM)
+ keepgoing |= mpc512x_uart_int_tx_chars(port);
+
+ /* Limit number of iteration */
+ if (!(--pass))
+ keepgoing = 0;
+
+ } while (keepgoing);
+
+ spin_unlock(&port->lock);
+
+ return IRQ_HANDLED;
+}
+
+/* ======================================================================== */
+/* Console ( if applicable ) */
+/* ======================================================================== */
+
+#ifdef CONFIG_SERIAL_MPC512x_CONSOLE
+
+static void __init
+mpc512x_console_get_options(struct uart_port *port,
+ int *baud, int *parity, int *bits, int *flow)
+{
+ struct mpc52xx_psc __iomem *psc = PSC(port);
+ unsigned char mr1;
+
+ pr_debug("mpc512x_console_get_options(port=%p)\n", port);
+
+ /* Read the mode registers */
+ out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1);
+ mr1 = in_8(&psc->mode);
+
+ /* CT{U,L}R are write-only ! */
+ *baud = 115200;
+ /* Parse them */
+ switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) {
+ case MPC52xx_PSC_MODE_5_BITS:
+ *bits = 5;
+ break;
+ case MPC52xx_PSC_MODE_6_BITS:
+ *bits = 6;
+ break;
+ case MPC52xx_PSC_MODE_7_BITS:
+ *bits = 7;
+ break;
+ case MPC52xx_PSC_MODE_8_BITS:
+ default:
+ *bits = 8;
+ }
+
+ if (mr1 & MPC52xx_PSC_MODE_PARNONE)
+ *parity = 'n';
+ else
+ *parity = mr1 & MPC52xx_PSC_MODE_PARODD ? 'o' : 'e';
+}
+
+static void
+mpc512x_console_write(struct console *co, const char *s, unsigned int count)
+{
+ struct uart_port *port = &mpc512x_uart_ports[co->index];
+ unsigned int i, j;
+ unsigned long rx_fifo_imr, tx_fifo_imr;
+
+ /* Disable interrupts */
+ tx_fifo_imr = in_be32(&FIFO(port)->tximr);
+ out_be32(&FIFO(port)->tximr, 0);
+ rx_fifo_imr = in_be32(&FIFO(port)->rximr);
+ out_be32(&FIFO(port)->rximr, 0);
+
+ /* Wait the TX buffer to be empty */
+ j = 5000000; /* Maximum wait */
+ while (!(in_be32(&FIFO(port)->txsr) & MPC512x_PSC_FIFO_EMPTY) && --j)
+ udelay(1);
+ /* Write all the chars */
+ for (i = 0; i < count; i++, s++) {
+ /* Line return handling */
+ if (*s == '\n')
+ out_8(&FIFO(port)->txdata_8, '\r');
+
+ /* Send the char */
+ out_8(&FIFO(port)->txdata_8, *s);
+
+ /* Wait the TX buffer to be empty */
+ j = 20000; /* Maximum wait */
+ while (!(in_be32(&FIFO(port)->txsr) & MPC512x_PSC_FIFO_EMPTY)
+ && --j)
+ udelay(1);
+ }
+
+ /* Restore interrupt state */
+ out_be32(&FIFO(port)->tximr, tx_fifo_imr);
+ out_be32(&FIFO(port)->rximr, rx_fifo_imr);
+}
+
+static int __init mpc512x_console_setup(struct console *co, char *options)
+{
+ struct uart_port *port = &mpc512x_uart_ports[co->index];
+ struct device_node *np = mpc512x_uart_nodes[co->index];
+ struct resource res;
+
+ int baud = 115200;
+ int bits = 8;
+ int parity = 'n';
+ int flow = 'n';
+
+ pr_debug("mpc512x_console_setup co=%p, co->index=%i, options=%s\n",
+ co, co->index, options);
+
+ if ((co->index < 0) || (co->index > MPC52xx_PSC_MAXNUM)) {
+ pr_debug("PSC%x out of range\n", co->index);
+ return -EINVAL;
+ }
+
+ if (!np) {
+ pr_debug("PSC%x not found in device tree\n", co->index);
+ return -EINVAL;
+ }
+
+ pr_debug("Console on ttyPSC%x is %s\n",
+ co->index, mpc512x_uart_nodes[co->index]->full_name);
+
+ /* Fetch register locations */
+ if (of_address_to_resource(np, 0, &res)) {
+ pr_debug("Could not get resources for PSC%x\n", co->index);
+ return -EINVAL;
+ }
+
+ /* Basic port init. Needed since we use some uart_??? func before
+ * real init for early access */
+ spin_lock_init(&port->lock);
+ port->uartclk = getuartclk(np);
+ port->ops = &mpc512x_uart_ops;
+ port->mapbase = res.start;
+ port->membase = ioremap(res.start, sizeof(struct mpc52xx_psc));
+ port->irq = irq_of_parse_and_map(np, 0);
+
+ if (port->membase == NULL)
+ return -EINVAL;
+
+ pr_debug("mpc52xx-psc uart at %p, mapped to %p, irq=%x, freq=%i\n",
+ (void *)port->mapbase, port->membase, port->irq,
+ port->uartclk);
+
+ /* Setup the port parameters accoding to options */
+ if (options)
+ uart_parse_options(options, &baud, &parity, &bits, &flow);
+ else
+ mpc512x_console_get_options(port, &baud, &parity, &bits, &flow);
+
+ pr_debug("Setting console parameters: %i %i%c1 flow=%c\n",
+ baud, bits, parity, flow);
+
+ return uart_set_options(port, co, baud, parity, bits, flow);
+}
+
+static struct uart_driver mpc512x_uart_driver;
+
+static struct console mpc512x_console = {
+ .name = "ttyPSC",
+ .write = mpc512x_console_write,
+ .device = uart_console_device,
+ .setup = mpc512x_console_setup,
+ .flags = CON_PRINTBUFFER,
+ .index = -1,
+ .data = &mpc512x_uart_driver,
+};
+
+static int __init mpc512x_console_init(void)
+{
+ mpc512x_uart_of_enumerate();
+ register_console(&mpc512x_console);
+ return 0;
+}
+
+console_initcall(mpc512x_console_init);
+
+#define MPC52xx_PSC_CONSOLE &mpc512x_console
+#else
+#define MPC52xx_PSC_CONSOLE NULL
+#endif
+
+/* ======================================================================== */
+/* UART Driver */
+/* ======================================================================== */
+
+static struct uart_driver mpc512x_uart_driver = {
+ .owner = THIS_MODULE,
+ .driver_name = "mpc512x_psc_uart",
+ .dev_name = "ttyPSC",
+ .major = SERIAL_PSC_MAJOR,
+ .minor = SERIAL_PSC_MINOR,
+ .nr = MPC52xx_PSC_MAXNUM,
+ .cons = MPC52xx_PSC_CONSOLE,
+};
+
+/* ======================================================================== */
+/* OF Platform Driver */
+/* ======================================================================== */
+
+static int __devinit
+mpc512x_uart_of_probe(struct of_device *op, const struct of_device_id *match)
+{
+ int idx = -1;
+ struct uart_port *port = NULL;
+ struct resource res;
+ int ret;
+
+ dev_dbg(&op->dev, "mpc512x_uart_probe(op=%p, match=%p)\n", op, match);
+
+ /* Check validity & presence */
+ for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++)
+ if (mpc512x_uart_nodes[idx] == op->node)
+ break;
+ if (idx >= MPC52xx_PSC_MAXNUM)
+ return -EINVAL;
+ pr_debug("Found %s assigned to ttyPSC%x\n",
+ mpc512x_uart_nodes[idx]->full_name, idx);
+
+ /* Init the port structure */
+ port = &mpc512x_uart_ports[idx];
+
+ spin_lock_init(&port->lock);
+ port->uartclk = getuartclk(op->node);
+ port->fifosize = 512;
+ port->iotype = UPIO_MEM;
+ port->flags = UPF_BOOT_AUTOCONF |
+ (uart_console(port) ? 0 : UPF_IOREMAP);
+ port->line = idx;
+ port->ops = &mpc512x_uart_ops;
+ port->dev = &op->dev;
+
+ /* Search for IRQ and mapbase */
+ if (of_address_to_resource(op->node, 0, &res))
+ return -EINVAL;
+
+ port->mapbase = res.start;
+ port->irq = irq_of_parse_and_map(op->node, 0);
+
+ dev_dbg(&op->dev, "mpc52xx-psc uart at %p, irq=%x, freq=%i\n",
+ (void *)port->mapbase, port->irq, port->uartclk);
+
+ if ((port->irq == NO_IRQ) || !port->mapbase) {
+ printk(KERN_ERR "Could not allocate resources for PSC\n");
+ return -EINVAL;
+ }
+
+ /* Add the port to the uart sub-system */
+ ret = uart_add_one_port(&mpc512x_uart_driver, port);
+ if (!ret)
+ dev_set_drvdata(&op->dev, (void *)port);
+
+ return ret;
+}
+
+static int mpc512x_uart_of_remove(struct of_device *op)
+{
+ struct uart_port *port = dev_get_drvdata(&op->dev);
+ dev_set_drvdata(&op->dev, NULL);
+
+ if (port) {
+ uart_remove_one_port(&mpc512x_uart_driver, port);
+ irq_dispose_mapping(port->irq);
+ }
+
+ return 0;
+}
+
+#ifdef CONFIG_PM
+static int mpc512x_uart_of_suspend(struct of_device *op, pm_message_t state)
+{
+ struct uart_port *port = (struct uart_port *)dev_get_drvdata(&op->dev);
+
+ if (port)
+ uart_suspend_port(&mpc512x_uart_driver, port);
+
+ return 0;
+}
+
+static int mpc512x_uart_of_resume(struct of_device *op)
+{
+ struct uart_port *port = (struct uart_port *)dev_get_drvdata(&op->dev);
+
+ if (port)
+ uart_resume_port(&mpc512x_uart_driver, port);
+
+ return 0;
+}
+#endif
+
+static void mpc512x_uart_of_assign(struct device_node *np, int idx)
+{
+ int free_idx = -1;
+ int i;
+
+ /* Find the first free node */
+ for (i = 0; i < MPC52xx_PSC_MAXNUM; i++) {
+ if (mpc512x_uart_nodes[i] == NULL) {
+ free_idx = i;
+ break;
+ }
+ }
+
+ if ((idx < 0) || (idx >= MPC52xx_PSC_MAXNUM))
+ idx = free_idx;
+
+ if (idx < 0)
+ return; /* No free slot; abort */
+
+ /* If the slot is already occupied, then swap slots */
+ if (mpc512x_uart_nodes[idx] && (free_idx != -1))
+ mpc512x_uart_nodes[free_idx] = mpc512x_uart_nodes[idx];
+ mpc512x_uart_nodes[idx] = np;
+}
+
+static void mpc512x_uart_of_enumerate(void)
+{
+ static int enum_done;
+ struct device_node *np;
+ const unsigned int *devno;
+ int i;
+
+ if (enum_done)
+ return;
+
+ for_each_node_by_type(np, "serial") {
+ if (!of_match_node(mpc512x_uart_of_match, np))
+ continue;
+
+ /* Is a particular device number requested? */
+ devno = of_get_property(np, "port-number", NULL);
+ mpc512x_uart_of_assign(of_node_get(np), devno ? *devno : -1);
+ }
+
+ enum_done = 1;
+
+ for (i = 0; i < MPC52xx_PSC_MAXNUM; i++) {
+ if (mpc512x_uart_nodes[i])
+ pr_debug("%s assigned to ttyPSC%x\n",
+ mpc512x_uart_nodes[i]->full_name, i);
+ }
+}
+
+MODULE_DEVICE_TABLE(of, mpc512x_uart_of_match);
+
+static struct of_platform_driver mpc512x_uart_of_driver = {
+ .owner = THIS_MODULE,
+ .name = "mpc52xx-psc-uart",
+ .match_table = mpc512x_uart_of_match,
+ .probe = mpc512x_uart_of_probe,
+ .remove = mpc512x_uart_of_remove,
+#ifdef CONFIG_PM
+ .suspend = mpc512x_uart_of_suspend,
+ .resume = mpc512x_uart_of_resume,
+#endif
+ .driver = {
+ .name = "mpc52xx-psc-uart",
+ },
+};
+
+/* ======================================================================== */
+/* Module */
+/* ======================================================================== */
+
+static int __init mpc512x_uart_init(void)
+{
+ int ret;
+
+ printk(KERN_INFO "Serial: MPC512x PSC UART driver\n");
+
+ ret = uart_register_driver(&mpc512x_uart_driver);
+ if (ret) {
+ printk(KERN_ERR "%s: uart_register_driver failed (%i)\n",
+ __FILE__, ret);
+ return ret;
+ }
+
+ mpc512x_uart_of_enumerate();
+
+ ret = of_register_platform_driver(&mpc512x_uart_of_driver);
+ if (ret) {
+ printk(KERN_ERR "%s: of_register_platform_driver failed (%i)\n",
+ __FILE__, ret);
+ uart_unregister_driver(&mpc512x_uart_driver);
+ return ret;
+ }
+ return 0;
+}
+
+static void __exit mpc512x_uart_exit(void)
+{
+ of_unregister_platform_driver(&mpc512x_uart_of_driver);
+ uart_unregister_driver(&mpc512x_uart_driver);
+}
+
+module_init(mpc512x_uart_init);
+module_exit(mpc512x_uart_exit);
+
+MODULE_AUTHOR("John Rigby <jrigby@freescale.com>");
+MODULE_DESCRIPTION("Freescale MPC512x PSC UART");
+MODULE_LICENSE("GPL");
diff --git a/include/asm-powerpc/mpc52xx_psc.h b/include/asm-powerpc/mpc52xx_psc.h
index bea42b9..6841868 100644
--- a/include/asm-powerpc/mpc52xx_psc.h
+++ b/include/asm-powerpc/mpc52xx_psc.h
@@ -190,5 +190,52 @@ struct mpc52xx_psc_fifo {
u16 tflwfptr; /* PSC + 0x9e */
};
+#define MPC512x_PSC_FIFO_RESET_SLICE 0x80
+#define MPC512x_PSC_FIFO_ENABLE_SLICE 0x01
+
+#define MPC512x_PSC_FIFO_EMPTY 0x1
+#define MPC512x_PSC_FIFO_FULL 0x2
+#define MPC512x_PSC_FIFO_ALARM 0x4
+#define MPC512x_PSC_FIFO_URERR 0x8
+#define MPC512x_PSC_FIFO_ORERR 0x01
+#define MPC512x_PSC_FIFO_MEMERROR 0x02
+
+struct mpc512x_psc_fifo {
+ u32 reserved1[10];
+ u32 txcmd; /* PSC + 0x80 */
+ u32 txalarm; /* PSC + 0x84 */
+ u32 txsr; /* PSC + 0x88 */
+ u32 txisr; /* PSC + 0x8c */
+ u32 tximr; /* PSC + 0x90 */
+ u32 txcnt; /* PSC + 0x94 */
+ u32 txptr; /* PSC + 0x98 */
+ u32 txsz; /* PSC + 0x9c */
+ u32 reserved2[7];
+ union {
+ u8 txdata_8;
+ u16 txdata_16;
+ u32 txdata_32;
+ } txdata; /* PSC + 0xbc */
+#define txdata_8 txdata.txdata_8
+#define txdata_16 txdata.txdata_16
+#define txdata_32 txdata.txdata_32
+ u32 rxcmd; /* PSC + 0xc0 */
+ u32 rxalarm; /* PSC + 0xc4 */
+ u32 rxsr; /* PSC + 0xc8 */
+ u32 rxisr; /* PSC + 0xcc */
+ u32 rximr; /* PSC + 0xd0 */
+ u32 rxcnt; /* PSC + 0xd4 */
+ u32 rxptr; /* PSC + 0xd8 */
+ u32 rxsz; /* PSC + 0xdc */
+ u32 reserved3[7];
+ union {
+ u8 rxdata_8;
+ u16 rxdata_16;
+ u32 rxdata_32;
+ } rxdata; /* PSC + 0xfc */
+#define rxdata_8 rxdata.rxdata_8
+#define rxdata_16 rxdata.rxdata_16
+#define rxdata_32 rxdata.rxdata_32
+};
#endif /* __ASM_MPC52xx_PSC_H__ */
--
1.5.3.5.726.g41a7a
^ permalink raw reply related
* Re: [PATCH] enable built-in networking for Sequoia defconfig
From: Josh Boyer @ 2008-01-08 16:09 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: linuxppc-dev
In-Reply-To: <1199489214.9673.18.camel@basalt>
On Fri, 04 Jan 2008 17:26:54 -0600
Hollis Blanchard <hollisb@us.ibm.com> wrote:
> Enable EMAC driver for Sequoia (and while we're in there, disable
> Macintosh drivers for Sequoia and Bamboo).
>
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
applied, thanks.
josh
^ permalink raw reply
* Re: Generic MMC-over-SPI binding?
From: Robert Schwebel @ 2008-01-08 16:11 UTC (permalink / raw)
To: Simon Richter; +Cc: linuxppc-dev, linuxppc-embedded
In-Reply-To: <47838708.5050008@hogyros.de>
On Tue, Jan 08, 2008 at 03:22:00PM +0100, Simon Richter wrote:
> in an embedded system similar to the lite5200 board, there is an MMC
> card socket connected to one of the PSCs. Ideally, I'd like to express
> this fact via the device tree and have the kernel bind the mmc-spi
> driver to the SPI interface, but I cannot find any place where to insert
> this code that I feel comfortable with.
>
> - It is not a board-specific thing, because any board can just use any
> SPI bus for MMC.
>
> - The mmc-spi driver appears to be platform independent, so I'm not
> sure OF bindings should be added to it.
>
> - The generic device tree scanning does not contain any special cases
> yet, so I don't want to add one.
>
> My current thought is to create a new driver that just handles MMC on
> PSCs in SPI mode by gluing all the relevant drivers together, but that
> doesn't seem optimal to me either.
You know this driver?
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/mmc/host/mmc_spi.c;h=365024b83d3da9df9b6e4f7a9d4cf6d216ba523d;hb=HEAD
Or is your question how to express this in the device tree?
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hannoversche Str. 2, 31134 Hildesheim, Germany
Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox