LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3 v2] add MPC837x USB platform support
From: Li Yang @ 2008-01-08  7:18 UTC (permalink / raw)
  To: galak, linuxppc-dev; +Cc: sfr, Li Yang, paulus

Add chip specific and board specific initialization for MPC837x USB.

Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/platforms/83xx/mpc837x_mds.c |   51 +++++++++++++++++++++++++++++
 arch/powerpc/platforms/83xx/mpc83xx.h     |    3 ++
 arch/powerpc/platforms/83xx/usb.c         |   40 ++++++++++++++++++++++
 3 files changed, 94 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c
index 166c111..c7579f6 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c
@@ -27,6 +27,56 @@ unsigned long isa_io_base = 0;
 unsigned long isa_mem_base = 0;
 #endif
 
+#define BCSR12_USB_SER_MASK	0x8a
+#define BCSR12_USB_SER_PIN	0x80
+#define BCSR12_USB_SER_DEVICE	0x02
+extern int mpc837x_usb_cfg(void);
+
+static int mpc837xmds_usb_cfg(void)
+{
+	struct device_node *np;
+	const void *phy_type, *mode;
+	void __iomem *bcsr_regs = NULL;
+	u8 bcsr12;
+	int ret;
+
+	ret = mpc837x_usb_cfg();
+	if (ret)
+		return ret;
+	/* Map BCSR area */
+	np = of_find_node_by_name(NULL, "bcsr");
+	if (np) {
+		struct resource res;
+
+		of_address_to_resource(np, 0, &res);
+		bcsr_regs = ioremap(res.start, res.end - res.start + 1);
+		of_node_put(np);
+	}
+	if (!bcsr_regs)
+		return -1;
+
+	np = of_find_node_by_name(NULL, "usb");
+	if (!np)
+		return -ENODEV;
+	phy_type = of_get_property(np, "phy_type", NULL);
+	if (phy_type && !strcmp(phy_type, "ulpi")) {
+		clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
+	} else if (phy_type && !strcmp(phy_type, "serial")) {
+		mode = of_get_property(np, "dr_mode", NULL);
+		bcsr12 = in_8(bcsr_regs + 12) & ~BCSR12_USB_SER_MASK;
+		bcsr12 |= BCSR12_USB_SER_PIN;
+		if (mode && !strcmp(mode, "peripheral"))
+			bcsr12 |= BCSR12_USB_SER_DEVICE;
+		out_8(bcsr_regs + 12, bcsr12);
+	} else {
+		printk(KERN_ERR "USB DR: unsupported PHY\n");
+	}
+
+	of_node_put(np);
+	iounmap(bcsr_regs);
+	return 0;
+}
+
 /* ************************************************************************
  *
  * Setup the architecture
@@ -45,6 +95,7 @@ static void __init mpc837x_mds_setup_arch(void)
 	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
 		mpc83xx_add_bridge(np);
 #endif
+	mpc837xmds_usb_cfg();
 }
 
 static struct of_device_id mpc837x_ids[] = {
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index b778cb4..88bb748 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -14,6 +14,7 @@
 #define MPC83XX_SCCR_USB_DRCM_11   0x00300000
 #define MPC83XX_SCCR_USB_DRCM_01   0x00100000
 #define MPC83XX_SCCR_USB_DRCM_10   0x00200000
+#define MPC837X_SCCR_USB_DRCM_11   0x00c00000
 
 /* system i/o configuration register low */
 #define MPC83XX_SICRL_OFFS         0x114
@@ -22,6 +23,8 @@
 #define MPC834X_SICRL_USB1         0x20000000
 #define MPC831X_SICRL_USB_MASK     0x00000c00
 #define MPC831X_SICRL_USB_ULPI     0x00000800
+#define MPC837X_SICRL_USB_MASK     0xf0000000
+#define MPC837X_SICRL_USB_ULPI     0x50000000
 
 /* system i/o configuration register high */
 #define MPC83XX_SICRH_OFFS         0x118
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index b45160f..b1de453 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -179,3 +179,43 @@ int mpc831x_usb_cfg(void)
 	return ret;
 }
 #endif /* CONFIG_PPC_MPC831x */
+
+#ifdef CONFIG_PPC_MPC837x
+int mpc837x_usb_cfg(void)
+{
+	void __iomem *immap;
+	struct device_node *np = NULL;
+	const void *prop;
+	int ret = 0;
+
+	np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr");
+	if (!np)
+		return -ENODEV;
+	prop = of_get_property(np, "phy_type", NULL);
+
+	if (!prop || (strcmp(prop, "ulpi") && strcmp(prop, "serial"))) {
+		printk(KERN_WARNING "837x USB PHY type not supported\n");
+		of_node_put(np);
+		return -EINVAL;
+	}
+
+	/* Map IMMR space for pin and clock settings */
+	immap = ioremap(get_immrbase(), 0x1000);
+	if (!immap) {
+		of_node_put(np);
+		return -ENOMEM;
+	}
+
+	/* Configure clock */
+	clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, MPC837X_SCCR_USB_DRCM_11,
+			MPC837X_SCCR_USB_DRCM_11);
+
+	/* Configure pin mux for ULPI/serial */
+	clrsetbits_be32(immap + MPC83XX_SICRL_OFFS, MPC837X_SICRL_USB_MASK,
+			MPC837X_SICRL_USB_ULPI);
+
+	iounmap(immap);
+	of_node_put(np);
+	return ret;
+}
+#endif /* CONFIG_PPC_MPC837x */
-- 
1.5.3.5.643.g40e25

^ permalink raw reply related

* [PATCH 3/3 v2] USB device tree cleanups
From: Li Yang @ 2008-01-08  7:18 UTC (permalink / raw)
  To: galak, linuxppc-dev; +Cc: sfr, Li Yang, paulus
In-Reply-To: <1199776726-22963-1-git-send-email-leoli@freescale.com>

Remove device_type = "usb"

Signed-off-by: Li Yang <leoli@freescale.com>
---
 Documentation/powerpc/booting-without-of.txt |    4 ----
 arch/powerpc/boot/dts/mpc8313erdb.dts        |    1 -
 arch/powerpc/boot/dts/mpc832x_mds.dts        |    1 -
 arch/powerpc/boot/dts/mpc8349emitx.dts       |    2 --
 arch/powerpc/boot/dts/mpc8349emitxgp.dts     |    1 -
 arch/powerpc/boot/dts/mpc834x_mds.dts        |    2 --
 arch/powerpc/boot/dts/mpc836x_mds.dts        |    1 -
 arch/powerpc/platforms/83xx/usb.c            |    8 ++++----
 arch/powerpc/sysdev/fsl_soc.c                |   12 +++++-------
 9 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..65e8baa 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1408,7 +1408,6 @@ platforms are moved over to use the flattened-device-tree model.
 
    Example multi port host USB controller device node :
 	usb@22000 {
-	        device_type = "usb";
 		compatible = "fsl-usb2-mph";
 		reg = <22000 1000>;
 		#address-cells = <1>;
@@ -1422,7 +1421,6 @@ platforms are moved over to use the flattened-device-tree model.
 
    Example dual role USB controller device node :
 	usb@23000 {
-		device_type = "usb";
 		compatible = "fsl-usb2-dr";
 		reg = <23000 1000>;
 		#address-cells = <1>;
@@ -1586,7 +1584,6 @@ platforms are moved over to use the flattened-device-tree model.
    iii) USB (Universal Serial Bus Controller)
 
    Required properties:
-   - device_type : should be "usb".
    - compatible : could be "qe_udc" or "fhci-hcd".
    - mode : the could be "host" or "slave".
    - reg : Offset and length of the register set for the device
@@ -1600,7 +1597,6 @@ platforms are moved over to use the flattened-device-tree model.
 
    Example(slave):
 	usb@6c0 {
-		device_type = "usb";
 		compatible = "qe_udc";
 		reg = <6c0 40>;
 		interrupts = <8b 0>;
diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index 9e7eba9..b48b9e2 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -80,7 +80,6 @@
 
 		/* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
 		usb@23000 {
-			device_type = "usb";
 			compatible = "fsl-usb2-dr";
 			reg = <23000 1000>;
 			#address-cells = <1>;
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index c64f303..0d40adb 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -200,7 +200,6 @@
 		};
 
 		usb@6c0 {
-			device_type = "usb";
 			compatible = "qe_udc";
 			reg = <6c0 40 8B00 100>;
 			interrupts = <b>;
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 5072f6d..9d411f8 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -78,7 +78,6 @@
 		};
 
 		usb@22000 {
-			device_type = "usb";
 			compatible = "fsl-usb2-mph";
 			reg = <22000 1000>;
 			#address-cells = <1>;
@@ -90,7 +89,6 @@
 		};
 
 		usb@23000 {
-			device_type = "usb";
 			compatible = "fsl-usb2-dr";
 			reg = <23000 1000>;
 			#address-cells = <1>;
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index 074f7a2..17c4858 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -78,7 +78,6 @@
 		};
 
 		usb@23000 {
-			device_type = "usb";
 			compatible = "fsl-usb2-dr";
 			reg = <23000 1000>;
 			#address-cells = <1>;
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 49363f8..fe2928b 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -95,7 +95,6 @@
 		/* phy type (ULPI or SERIAL) are only types supportted for MPH */
 		/* port = 0 or 1 */
 		usb@22000 {
-			device_type = "usb";
 			compatible = "fsl-usb2-mph";
 			reg = <22000 1000>;
 			#address-cells = <1>;
@@ -107,7 +106,6 @@
 		};
 		/* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
 		usb@23000 {
-			device_type = "usb";
 			compatible = "fsl-usb2-dr";
 			reg = <23000 1000>;
 			#address-cells = <1>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 0b2d2b5..6fa418a 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -231,7 +231,6 @@
 		};
 
 		usb@6c0 {
-			device_type = "usb";
 			compatible = "qe_udc";
 			reg = <6c0 40 8B00 100>;
 			interrupts = <b>;
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index b1de453..6a454a4 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -41,7 +41,7 @@ int mpc834x_usb_cfg(void)
 	sicrl = in_be32(immap + MPC83XX_SICRL_OFFS) & ~MPC834X_SICRL_USB_MASK;
 	sicrh = in_be32(immap + MPC83XX_SICRH_OFFS) & ~MPC834X_SICRH_USB_UTMI;
 
-	np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr");
+	np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr");
 	if (np) {
 		sccr |= MPC83XX_SCCR_USB_DRCM_11;  /* 1:3 */
 
@@ -67,7 +67,7 @@ int mpc834x_usb_cfg(void)
 		port0_is_dr = 1;
 		of_node_put(np);
 	}
-	np = of_find_compatible_node(NULL, "usb", "fsl-usb2-mph");
+	np = of_find_compatible_node(NULL, NULL, "fsl-usb2-mph");
 	if (np) {
 		sccr |= MPC83XX_SCCR_USB_MPHCM_11; /* 1:3 */
 
@@ -111,7 +111,7 @@ int mpc831x_usb_cfg(void)
 	const void *dr_mode;
 #endif
 
-	np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr");
+	np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr");
 	if (!np)
 		return -ENODEV;
 	prop = of_get_property(np, "phy_type", NULL);
@@ -188,7 +188,7 @@ int mpc837x_usb_cfg(void)
 	const void *prop;
 	int ret = 0;
 
-	np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr");
+	np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr");
 	if (!np)
 		return -ENODEV;
 	prop = of_get_property(np, "phy_type", NULL);
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3ace747..c9eb66d 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -528,14 +528,12 @@ static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
 static int __init fsl_usb_of_init(void)
 {
 	struct device_node *np;
-	unsigned int i;
+	unsigned int i = 0;
 	struct platform_device *usb_dev_mph = NULL, *usb_dev_dr_host = NULL,
 		*usb_dev_dr_client = NULL;
 	int ret;
 
-	for (np = NULL, i = 0;
-	     (np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL;
-	     i++) {
+	for_each_compatible_node(np, NULL, "fsl-usb2-mph") {
 		struct resource r[2];
 		struct fsl_usb2_platform_data usb_data;
 		const unsigned char *prop = NULL;
@@ -578,11 +576,10 @@ static int __init fsl_usb_of_init(void)
 						    fsl_usb2_platform_data));
 		if (ret)
 			goto unreg_mph;
+		i++;
 	}
 
-	for (np = NULL;
-	     (np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL;
-	     i++) {
+	for_each_compatible_node(np, NULL, "fsl-usb2-dr") {
 		struct resource r[2];
 		struct fsl_usb2_platform_data usb_data;
 		const unsigned char *prop = NULL;
@@ -654,6 +651,7 @@ static int __init fsl_usb_of_init(void)
 						fsl_usb2_platform_data))))
 				goto unreg_dr;
 		}
+		i++;
 	}
 	return 0;
 
-- 
1.5.3.5.643.g40e25

^ permalink raw reply related

* help
From: 张自强 @ 2008-01-08  7:04 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <mailman.230.1199775553.6908.linuxppc-dev@ozlabs.org>

Help

-----=D3=CA=BC=FE=D4=AD=BC=FE-----
=B7=A2=BC=FE=C8=CB: =
linuxppc-dev-bounces+jackzhang=3Dsuperlink.com.cn@ozlabs.org
[mailto:linuxppc-dev-bounces+jackzhang=3Dsuperlink.com.cn@ozlabs.org] =
=B4=FA=B1=ED
linuxppc-dev-request@ozlabs.org
=B7=A2=CB=CD=CA=B1=BC=E4: 2008=C4=EA1=D4=C28=C8=D5 14:59
=CA=D5=BC=FE=C8=CB: linuxppc-dev@ozlabs.org
=D6=F7=CC=E2: Linuxppc-dev Digest, Vol 41, Issue 56

Send Linuxppc-dev mailing list submissions to
	linuxppc-dev@ozlabs.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://ozlabs.org/mailman/listinfo/linuxppc-dev
or, via email, send a message with subject or body 'help' to
	linuxppc-dev-request@ozlabs.org

You can reach the person managing the list at
	linuxppc-dev-owner@ozlabs.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linuxppc-dev digest..."


Today's Topics:

   1. Re: [PATCH] Fix remainder calculating bug in single floating
      point	division (Kumar Gala)
   2. Re: [PATCH] Fix carry bug in 128-bit unsigned integer adding
      (Kumar Gala)
   3. Re: [PATCH] Hwmon for Taco (Sean MacLennan)
   4. Re: [PATCH] i2c-ibm_iic driver - new patch (Stephen Rothwell)
   5. Re: [PATCH] Hwmon for Taco (Grant Likely)


----------------------------------------------------------------------

Message: 1
Date: Tue, 8 Jan 2008 00:22:25 -0600
From: Kumar Gala <galak@kernel.crashing.org>
Subject: Re: [PATCH] Fix remainder calculating bug in single floating
	point	division
To: Liu Yu <Yu.Liu@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Message-ID: <CC561FA6-0590-4BC0-B42B-7EE1B379CE8E@kernel.crashing.org>
Content-Type: text/plain; charset=3DUS-ASCII; format=3Dflowed; =
delsp=3Dyes


On Jan 6, 2008, at 8:26 AM, Liu Yu wrote:

> This bug exists in the emulation of floating point division for =20
> powerpc.
>
> The original code cannot count the remainder correctly.
> I can provide a test case to trigger this bug.
> When use fdiv to count 1.1754941e-38f / 0.9999999f,
> the result is expected to be 1.175494e-38f,
> but we will get 1.174921e-38f in the original case.
>
> Comments are always welcomed!

can you provide the test case that shows the error.

- k



------------------------------

Message: 2
Date: Tue, 8 Jan 2008 00:27:59 -0600
From: Kumar Gala <galak@kernel.crashing.org>
Subject: Re: [PATCH] Fix carry bug in 128-bit unsigned integer adding
To: Liu Yu <Yu.Liu@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Message-ID: <7040EDB2-7E89-4BBD-A4FC-50E168F9286F@kernel.crashing.org>
Content-Type: text/plain; charset=3DUS-ASCII; format=3Dflowed; =
delsp=3Dyes


On Jan 6, 2008, at 8:26 AM, Liu Yu wrote:

> This bug exists in math emulation for powerpc.
> The macro define are mainly used by multiplication.
>
> When adding two unsigned operands ( r =3D x + y ),
> the carry bit can be counted by whether r is less than x.
> However, when adding three unsigned operands, this method does not =20
> work.
>
> The original code below uses this method to count carry,
> it apparently overlook the case of three operands.
> Assume all the operands is 32-bit wide,
> ( r =3D x + y + last_carry , x =3D 0, y =3D 0xffffffff, last_carry =3D =
1),
> then r is no less than x but it actually gets a carry.
>
> I tried to fix this bug, but this patch seems not that pretty.
> Are there any better ideas?
> Comments are always welcomed!

take a look at how include/math-emu/op-4.h implements __FP_FRAC_ADD_4 =20
& __FP_FRAC_SUB_4.  Will that fix the bug, if so we should make the =20
code match how its done there.

- k



------------------------------

Message: 3
Date: Tue, 08 Jan 2008 01:30:00 -0500
From: Sean MacLennan <smaclennan@pikatech.com>
Subject: Re: [PATCH] Hwmon for Taco
To: benh@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org
Message-ID: <47831868.3030309@pikatech.com>
Content-Type: text/plain; charset=3DISO-8859-1; format=3Dflowed

Benjamin Herrenschmidt wrote:
> That should be in the device-tree...
>
> Cheers,
> Ben.
>
>  =20

Now in the device tree. The name of the file has changed.

Cheers,
    Sean

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index a0445be..1f89186 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -57,6 +57,16 @@ config SENSORS_ABITUGURU3
       This driver can also be built as a module.  If so, the module
       will be called abituguru3.
=20
+config SENSORS_AD7414
+    tristate "Analog Devices AD7414"
+    depends on I2C && EXPERIMENTAL
+    help
+      If you say yes here you get support for the Analog Devices
+      AD7414 temperature monitoring chip.
+
+      This driver can also be built as a module. If so, the module
+      will be called ad7414.
+
 config SENSORS_AD7418
     tristate "Analog Devices AD7416, AD7417 and AD7418"
     depends on I2C && EXPERIMENTAL
@@ -763,4 +773,13 @@ config HWMON_DEBUG_CHIP
       a problem with I2C support and want to see more of what is going
       on.
=20
+config PIKA_DTM
+    tristate "PIKA DTM (Dynamic Thermal Management)"
+    depends on HWMON && WARP
+    select SENSORS_AD7414
+    default y
+    help
+      Say Y here if you have a PIKA Warp(tm) Appliance. This driver is
+      required for the DTM to work properly.
+
 endif # HWMON
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 55595f6..0c6ee71 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SENSORS_W83791D)    +=3D w83791d.o
=20
 obj-$(CONFIG_SENSORS_ABITUGURU)    +=3D abituguru.o
 obj-$(CONFIG_SENSORS_ABITUGURU3)+=3D abituguru3.o
+obj-$(CONFIG_SENSORS_AD7414)    +=3D ad7414.o
 obj-$(CONFIG_SENSORS_AD7418)    +=3D ad7418.o
 obj-$(CONFIG_SENSORS_ADM1021)    +=3D adm1021.o
 obj-$(CONFIG_SENSORS_ADM1025)    +=3D adm1025.o
@@ -69,7 +70,8 @@ obj-$(CONFIG_SENSORS_VT8231)    +=3D vt8231.o
 obj-$(CONFIG_SENSORS_W83627EHF)    +=3D w83627ehf.o
 obj-$(CONFIG_SENSORS_W83L785TS)    +=3D w83l785ts.o
=20
+obj-$(CONFIG_PIKA_DTM)        +=3D pika-dtm.o
+
 ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
 EXTRA_CFLAGS +=3D -DDEBUG
 endif
-
--- /dev/null    2005-11-20 22:22:37.000000000 -0500
+++ drivers/hwmon/pika-dtm.c    2008-01-08 01:23:32.000000000 -0500
@@ -0,0 +1,87 @@
+/*
+ *  drivers/hwmon/pika-dtm.c
+ *
+ *  Overview: On the Warp, the fpga controls the fan. This provides
+ *  the temperature to the fpga.
+ *
+ *  Copyright (c) 2008 PIKA Technologies
+ *    Sean MacLennan <smaclennan@pikatech.com>
+ *
+ *  This program is free software; you can redistribute     it and/or=20
modify it
+ *  under  the terms of     the GNU General  Public License as=20
published by the
+ *  Free Software Foundation;  either version 2 of the    License, or=20
(at your
+ *  option) any later version.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kthread.h>
+#include <linux/io.h>
+#include <linux/of_platform.h>
+
+
+extern int ad7414_get_temp(void);
+
+static unsigned __iomem *dtm_fpga;
+static struct task_struct *dtm_thread;
+
+
+static int pika_dtm_thread(void *arg)
+{
+    while(!kthread_should_stop()) {
+        int temp =3D ad7414_get_temp();
+
+        // Write to FPGA
+        out_be32(dtm_fpga, temp);
+
+        set_current_state(TASK_INTERRUPTIBLE);
+        schedule_timeout(HZ);
+    }
+
+    return 0;
+}
+
+
+int __init pika_dtm_init(void)
+{
+    struct device_node *np;
+    struct resource res;
+
+    if((np =3D of_find_compatible_node(NULL, NULL, "pika,fpga")) =3D=3D =
NULL) {
+        printk(KERN_ERR __FILE__ ": Unable to find FPGA\n");
+        return -ENOENT;
+    }
+
+    /* We do not call of_iomap here since it would map in the entire
+     * fpga space, which is overkill for 4 bytes.
+     */
+    if(of_address_to_resource(np, 0, &res) ||
+       (dtm_fpga =3D ioremap(res.start + 0x20, 4)) =3D=3D NULL) {
+        printk(KERN_ERR __FILE__ ": Unable to map FPGA\n");
+        return -ENOENT;
+    }
+
+    dtm_thread =3D kthread_run(pika_dtm_thread, NULL, "pika-dtm");
+
+    if(IS_ERR(dtm_thread)) {
+        iounmap(dtm_fpga);
+        printk(KERN_ERR __FILE__ ": Unable to start PIKA DTM =
thread\n");
+        return PTR_ERR(dtm_thread);
+    }
+
+    return 0;
+}
+module_init(pika_dtm_init);
+
+
+void __exit pika_dtm_exit(void)
+{
+    kthread_stop(dtm_thread);
+    iounmap(dtm_fpga);
+}
+module_exit(pika_dtm_exit);
+
+
+MODULE_DESCRIPTION("PIKA DTM driver");
+MODULE_AUTHOR("Sean MacLennan");
+MODULE_LICENSE("GPL");
--- /dev/null    2005-11-20 22:22:37.000000000 -0500
+++ drivers/hwmon/ad7414.c    2008-01-05 20:36:06.000000000 -0500
@@ -0,0 +1,296 @@
+/*
+ * An hwmon driver for the Analog Devices AD7414
+ *
+ * Copyright 2006 Stefan Roese <sr@denx.de>, DENX Software Engineering
+ *
+ * Based on ad7418.c
+ * Copyright 2006 Tower Technologies, Alessandro Zummo=20
<a.zummo@towertech.it>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/jiffies.h>
+#include <linux/i2c.h>
+#include <linux/hwmon.h>
+#include <linux/err.h>
+#include <linux/mutex.h>
+#include <linux/delay.h>
+
+
+#define DRV_VERSION "0.2"
+
+/* straight from the datasheet */
+#define AD7414_TEMP_MIN (-55000)
+#define AD7414_TEMP_MAX 125000
+
+/* Addresses to scan */
+static unsigned short normal_i2c[] =3D { 0x48, 0x4a, I2C_CLIENT_END };
+
+/* Insmod parameters */
+I2C_CLIENT_INSMOD;
+
+/* AD7414 registers */
+#define AD7414_REG_TEMP        0x00
+#define AD7414_REG_CONF        0x01
+#define AD7414_REG_T_HIGH    0x02
+#define AD7414_REG_T_LOW    0x03
+
+struct ad7414_data {
+    struct i2c_client    client;
+    struct device    *dev;
+    struct mutex        lock;
+    char            valid;        /* !=3D0 if following fields are =
valid */
+    unsigned long        last_updated;    /* In jiffies */
+    u16            temp_input;    /* Register values */
+    u8            temp_max;
+    u8            temp_min;
+    u8            temp_alert;
+    u8            temp_max_flag;
+    u8            temp_min_flag;
+};
+
+static int ad7414_attach_adapter(struct i2c_adapter *adapter);
+static int ad7414_detect(struct i2c_adapter *adapter, int address, int=20
kind);
+static int ad7414_detach_client(struct i2c_client *client);
+
+static struct i2c_driver ad7414_driver =3D {
+    .driver =3D {
+        .name    =3D "ad7414",
+    },
+    .attach_adapter    =3D ad7414_attach_adapter,
+    .detach_client    =3D ad7414_detach_client,
+};
+
+/*
+ * TEMP: 0.001C/bit (-55C to +125C)
+ * REG: (0.5C/bit, two's complement) << 7
+ */
+static inline int AD7414_TEMP_FROM_REG(u16 reg)
+{
+    /* use integer division instead of equivalent right shift to
+     * guarantee arithmetic shift and preserve the sign
+     */
+    return ((s16)reg / 128) * 500;
+}
+
+/* All registers are word-sized, except for the configuration =
registers.
+ * AD7414 uses a high-byte first convention, which is exactly opposite =
to
+ * the usual practice.
+ */
+static int ad7414_read(struct i2c_client *client, u8 reg)
+{
+    if (reg =3D=3D AD7414_REG_TEMP)
+        return swab16(i2c_smbus_read_word_data(client, reg));
+    else
+        return i2c_smbus_read_byte_data(client, reg);
+}
+
+static int ad7414_write(struct i2c_client *client, u8 reg, u16 value)
+{
+    return i2c_smbus_write_byte_data(client, reg, value);
+}
+
+/* PIKA Taco - we need to access the temperature in kernel mode. As a
+ * hack we store the device here. This works because we only have one
+ * ad7414 chip.
+ */
+static struct device *ad7414_dev;
+
+static void ad7414_init_client(struct i2c_client *client)
+{
+    /* TODO: anything to do here??? */
+    ad7414_dev =3D &client->dev;
+}
+
+static struct ad7414_data *ad7414_update_device(struct device *dev)
+{
+    struct i2c_client *client =3D to_i2c_client(dev);
+    struct ad7414_data *data =3D i2c_get_clientdata(client);
+
+    mutex_lock(&data->lock);
+
+    if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+        || !data->valid) {
+        dev_dbg(&client->dev, "starting ad7414 update\n");
+
+        data->temp_input =3D ad7414_read(client, AD7414_REG_TEMP);
+        data->temp_alert =3D (data->temp_input >> 5) & 0x01;
+        data->temp_max_flag =3D (data->temp_input >> 4) & 0x01;
+        data->temp_min_flag =3D (data->temp_input >> 3) & 0x01;
+        data->temp_max =3D ad7414_read(client, AD7414_REG_T_HIGH);
+        data->temp_min =3D ad7414_read(client, AD7414_REG_T_LOW);
+
+        data->last_updated =3D jiffies;
+        data->valid =3D 1;
+    }
+
+    mutex_unlock(&data->lock);
+
+    return data;
+}
+
+int ad7414_get_temp(void)
+{
+    if(ad7414_dev) {
+        struct ad7414_data *data =3D ad7414_update_device(ad7414_dev);
+        return data->temp_input;
+    } else
+        return 0x1f4; // +125
+}
+EXPORT_SYMBOL(ad7414_get_temp);
+
+#define show(value) \
+static ssize_t show_##value(struct device *dev, struct device_attribute =

*attr, char *buf)        \
+{                                    \
+    struct ad7414_data *data =3D ad7414_update_device(dev);        \
+    return sprintf(buf, "%d\n", AD7414_TEMP_FROM_REG(data->value));    =
\
+}
+show(temp_input);
+
+#define show_8(value)    \
+static ssize_t show_##value(struct device *dev, struct device_attribute =

*attr, char *buf)        \
+{                                \
+    struct ad7414_data *data =3D ad7414_update_device(dev);    \
+    return sprintf(buf, "%d\n", data->value);        \
+}
+show_8(temp_max);
+show_8(temp_min);
+show_8(temp_alert);
+show_8(temp_max_flag);
+show_8(temp_min_flag);
+
+#define set(value, reg)    \
+static ssize_t set_##value(struct device *dev, struct device_attribute=20
*attr, const char *buf, size_t count)    \
+{                                \
+    struct i2c_client *client =3D to_i2c_client(dev);        \
+    struct ad7414_data *data =3D i2c_get_clientdata(client);    \
+    int temp =3D simple_strtoul(buf, NULL, 10);        \
+                                \
+    mutex_lock(&data->lock);                \
+    data->value =3D temp;                    \
+    ad7414_write(client, reg, data->value);            \
+    mutex_unlock(&data->lock);                \
+    return count;                        \
+}
+set(temp_max, AD7414_REG_T_HIGH);
+set(temp_min, AD7414_REG_T_LOW);
+
+static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max,=20
set_temp_max);
+static DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp_min,=20
set_temp_min);
+static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL);
+static DEVICE_ATTR(temp1_alert, S_IRUGO, show_temp_alert, NULL);
+static DEVICE_ATTR(temp1_max_flag, S_IRUGO, show_temp_max_flag, NULL);
+static DEVICE_ATTR(temp1_min_flag, S_IRUGO, show_temp_min_flag, NULL);
+
+static int ad7414_attach_adapter(struct i2c_adapter *adapter)
+{
+    if (!(adapter->class & I2C_CLASS_HWMON))
+        return 0;
+    return i2c_probe(adapter, &addr_data, ad7414_detect);
+}
+
+static struct attribute *ad7414_attributes[] =3D {
+    &dev_attr_temp1_input.attr,
+    &dev_attr_temp1_max.attr,
+    &dev_attr_temp1_min.attr,
+    &dev_attr_temp1_alert.attr,
+    &dev_attr_temp1_max_flag.attr,
+    &dev_attr_temp1_min_flag.attr,
+    NULL
+};
+
+static const struct attribute_group ad7414_group =3D {
+    .attrs =3D ad7414_attributes,
+};
+
+static int ad7414_detect(struct i2c_adapter *adapter, int address, int=20
kind)
+{
+    struct i2c_client *client;
+    struct ad7414_data *data;
+    int err =3D 0;
+
+    if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
+                    I2C_FUNC_SMBUS_WORD_DATA))
+        goto exit;
+
+    if (!(data =3D kzalloc(sizeof(struct ad7414_data), GFP_KERNEL))) {
+        err =3D -ENOMEM;
+        goto exit;
+    }
+
+    client =3D &data->client;
+    client->addr =3D address;
+    client->adapter =3D adapter;
+    client->driver =3D &ad7414_driver;
+    client->flags =3D 0;
+
+    i2c_set_clientdata(client, data);
+
+    mutex_init(&data->lock);
+
+    /* TODO: not testing for AD7414 done yet... */
+
+    strlcpy(client->name, ad7414_driver.driver.name, I2C_NAME_SIZE);
+
+    if ((err =3D i2c_attach_client(client)))
+        goto exit_free;
+
+    dev_info(&client->dev, "chip found, driver version " DRV_VERSION =
"\n");
+
+    /* Initialize the AD7414 chip */
+    ad7414_init_client(client);
+
+    /* Register sysfs hooks */
+    if ((err =3D sysfs_create_group(&client->dev.kobj, &ad7414_group)))
+        goto exit_detach;
+
+    data->dev =3D hwmon_device_register(&client->dev);
+    if (IS_ERR(data->dev)) {
+        err =3D PTR_ERR(data->dev);
+        goto exit_remove;
+    }
+
+    return 0;
+
+exit_remove:
+    sysfs_remove_group(&client->dev.kobj, &ad7414_group);
+exit_detach:
+    i2c_detach_client(client);
+exit_free:
+    kfree(data);
+exit:
+    return err;
+}
+
+static int ad7414_detach_client(struct i2c_client *client)
+{
+    struct ad7414_data *data =3D i2c_get_clientdata(client);
+    ad7414_dev =3D NULL;
+    hwmon_device_unregister(data->dev);
+    sysfs_remove_group(&client->dev.kobj, &ad7414_group);
+    i2c_detach_client(client);
+    kfree(data);
+    return 0;
+}
+
+static int __init ad7414_init(void)
+{
+    return i2c_add_driver(&ad7414_driver);
+}
+
+static void __exit ad7414_exit(void)
+{
+    i2c_del_driver(&ad7414_driver);
+}
+
+MODULE_AUTHOR("Stefan Roese <sr@denx.de>");
+MODULE_DESCRIPTION("AD7414 driver");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(DRV_VERSION);
+
+module_init(ad7414_init);
+module_exit(ad7414_exit);




------------------------------

Message: 4
Date: Tue, 8 Jan 2008 17:36:36 +1100
From: Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH] i2c-ibm_iic driver - new patch
To: Sean MacLennan <smaclennan@pikatech.com>
Cc: linuxppc-dev@ozlabs.org, Stefan Roese <sr@denx.de>,	Arnd Bergmann
	<arnd@arndb.de>
Message-ID: <20080108173636.73db1623.sfr@canb.auug.org.au>
Content-Type: text/plain; charset=3D"us-ascii"

On Tue, 08 Jan 2008 00:56:27 -0500 Sean MacLennan =
<smaclennan@pikatech.com>
wrote:
>
> Stephen Rothwell wrote:
> >
> > On Mon, 07 Jan 2008 21:03:12 -0500 Sean MacLennan
<smaclennan@pikatech.com> wrote:
> >  =20
> > Please don't post patches as attachments.
> =20
> Ok.

Unfortunately, you are using thunderbird and so the patch is now =
wrapped.
There is a workaround, see Documentation/email-clients.txt.

> > Please split the assignments from the tests.  Here and elsewhere.
> >  =20
> I made the changes in my code. I am trying to leave the original code =
as=20
> much as possible.

Thats all we ask.

> >> +	} else {
> >> +		if (dev->irq !=3D NO_IRQ){
> >> +		    iic_interrupt_mode(dev, 0);
> >> +		    free_irq(dev->irq, dev);
> >> +		}
> >> +		iounmap(dev->vaddr);
> >> +		kfree(dev);
> >>    =20
> >
> > Should these last two be after the below brace?
> >
> >  =20
> I'm not really qualified to answer, but I will anyway ;) I assume the=20
> original author is basically saying if he cannot delete the adapter, =
it=20
> is unsafe to free the memory since the i2c code may still use it. If I =

> have read that right, then I agree.

OK, I can see that this is a "that should not happen" condition.

> +    if (iic_force_poll)
> +        dev->irq =3D NO_IRQ;
> +    else if ((dev->irq =3D irq_of_parse_and_map(np, 0)) =3D=3D =
NO_IRQ)

You missed this one.

Overall looks better, except all your indentation is now 4 spaces. We =
use
a TAB character for each level of indentation and you should be able to
set your editor to *display* the TABs as 4 places if that is what you =
like.

--=20
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :
http://ozlabs.org/pipermail/linuxppc-dev/attachments/20080108/3c5fd612/at=
tac
hment-0001.pgp=20

------------------------------

Message: 5
Date: Mon, 7 Jan 2008 23:59:09 -0700
From: "Grant Likely" <grant.likely@secretlab.ca>
Subject: Re: [PATCH] Hwmon for Taco
To: "Sean MacLennan" <smaclennan@pikatech.com>
Cc: linuxppc-dev@ozlabs.org
Message-ID:
	<fa686aa40801072259w63899e74y45d55bd5e9844b68@mail.gmail.com>
Content-Type: text/plain; charset=3DISO-8859-1

On 1/7/08, Sean MacLennan <smaclennan@pikatech.com> wrote:
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index a0445be..1f89186 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -57,6 +57,16 @@ config SENSORS_ABITUGURU3
>        This driver can also be built as a module.  If so, the module
>        will be called abituguru3.
>
> +config SENSORS_AD7414
> +    tristate "Analog Devices AD7414"
> +    depends on I2C && EXPERIMENTAL
> +    help
> +      If you say yes here you get support for the Analog Devices
> +      AD7414 temperature monitoring chip.
> +
> +      This driver can also be built as a module. If so, the module
> +      will be called ad7414.
> +
>  config SENSORS_AD7418
>      tristate "Analog Devices AD7416, AD7417 and AD7418"
>      depends on I2C && EXPERIMENTAL
> @@ -763,4 +773,13 @@ config HWMON_DEBUG_CHIP
>        a problem with I2C support and want to see more of what is =
going
>        on.
>
> +config PIKA_DTM
> +    tristate "PIKA DTM (Dynamic Thermal Management)"
> +    depends on HWMON && WARP
> +    select SENSORS_AD7414

select is dangerous because it bypasses dependency checking.  Make it
'depends on' instead.

> +    default y
> +    help
> +      Say Y here if you have a PIKA Warp(tm) Appliance. This driver =
is
> +      required for the DTM to work properly.
> +

This patch should be split in 2; one for the AD7414 driver and one for
the thermal management driver.

>  endif # HWMON
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index 55595f6..0c6ee71 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -15,6 +15,7 @@ obj-$(CONFIG_SENSORS_W83791D)    +=3D w83791d.o
>
>  obj-$(CONFIG_SENSORS_ABITUGURU)    +=3D abituguru.o
>  obj-$(CONFIG_SENSORS_ABITUGURU3)+=3D abituguru3.o
> +obj-$(CONFIG_SENSORS_AD7414)    +=3D ad7414.o
>  obj-$(CONFIG_SENSORS_AD7418)    +=3D ad7418.o
>  obj-$(CONFIG_SENSORS_ADM1021)    +=3D adm1021.o
>  obj-$(CONFIG_SENSORS_ADM1025)    +=3D adm1025.o
> @@ -69,7 +70,8 @@ obj-$(CONFIG_SENSORS_VT8231)    +=3D vt8231.o
>  obj-$(CONFIG_SENSORS_W83627EHF)    +=3D w83627ehf.o
>  obj-$(CONFIG_SENSORS_W83L785TS)    +=3D w83l785ts.o
>
> +obj-$(CONFIG_PIKA_DTM)        +=3D pika-dtm.o
> +
>  ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
>  EXTRA_CFLAGS +=3D -DDEBUG
>  endif
> -
> --- /dev/null    2005-11-20 22:22:37.000000000 -0500
> +++ drivers/hwmon/pika-dtm.c    2008-01-08 01:23:32.000000000 -0500

This is *very* board specific and not very complex a driver.  It
should probably live with the platform code somewhere in
arch/powerpc/platforms.  You can use the machine_device_initcall()
hook to kick off the thread.

> @@ -0,0 +1,87 @@
> +/*
> + *  drivers/hwmon/pika-dtm.c
> + *
> + *  Overview: On the Warp, the fpga controls the fan. This provides
> + *  the temperature to the fpga.
> + *
> + *  Copyright (c) 2008 PIKA Technologies
> + *    Sean MacLennan <smaclennan@pikatech.com>
> + *
> + *  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.

Your mailer chewed up the patch here (line wrap).

> + *
> + */
> +
> +#include <linux/module.h>
> +#include <linux/kthread.h>
> +#include <linux/io.h>
> +#include <linux/of_platform.h>
> +
> +
> +extern int ad7414_get_temp(void);

Bad!  Function decls must be in common header files.

> +
> +static unsigned __iomem *dtm_fpga;
> +static struct task_struct *dtm_thread;
> +
> +
> +static int pika_dtm_thread(void *arg)
> +{
> +    while(!kthread_should_stop()) {
> +        int temp =3D ad7414_get_temp();
> +
> +        // Write to FPGA

Style; use /* */, not //

> +        out_be32(dtm_fpga, temp);
> +
> +        set_current_state(TASK_INTERRUPTIBLE);
> +        schedule_timeout(HZ);
> +    }
> +
> +    return 0;
> +}
> +
> +
> +int __init pika_dtm_init(void)
> +{
> +    struct device_node *np;
> +    struct resource res;
> +
> +    if((np =3D of_find_compatible_node(NULL, NULL, "pika,fpga")) =
=3D=3D NULL) {
> +        printk(KERN_ERR __FILE__ ": Unable to find FPGA\n");
> +        return -ENOENT;
> +    }
> +
> +    /* We do not call of_iomap here since it would map in the entire
> +     * fpga space, which is overkill for 4 bytes.
> +     */

iomapping is not expensive; just map the whole space (it's going to
map a minimum 4k page anyway).  The code will be easier to read if you
just use of_iomap().

> +    if(of_address_to_resource(np, 0, &res) ||
> +       (dtm_fpga =3D ioremap(res.start + 0x20, 4)) =3D=3D NULL) {
> +        printk(KERN_ERR __FILE__ ": Unable to map FPGA\n");
> +        return -ENOENT;
> +    }
> +
> +    dtm_thread =3D kthread_run(pika_dtm_thread, NULL, "pika-dtm");
> +
> +    if(IS_ERR(dtm_thread)) {
> +        iounmap(dtm_fpga);
> +        printk(KERN_ERR __FILE__ ": Unable to start PIKA DTM =
thread\n");
> +        return PTR_ERR(dtm_thread);
> +    }
> +
> +    return 0;
> +}
> +module_init(pika_dtm_init);
> +
> +
> +void __exit pika_dtm_exit(void)
> +{
> +    kthread_stop(dtm_thread);
> +    iounmap(dtm_fpga);
> +}
> +module_exit(pika_dtm_exit);
> +
> +
> +MODULE_DESCRIPTION("PIKA DTM driver");
> +MODULE_AUTHOR("Sean MacLennan");
> +MODULE_LICENSE("GPL");
> --- /dev/null    2005-11-20 22:22:37.000000000 -0500
> +++ drivers/hwmon/ad7414.c    2008-01-05 20:36:06.000000000 -0500
> @@ -0,0 +1,296 @@
> +/*
> + * An hwmon driver for the Analog Devices AD7414
> + *
> + * Copyright 2006 Stefan Roese <sr@denx.de>, DENX Software =
Engineering
> + *
> + * Based on ad7418.c
> + * Copyright 2006 Tower Technologies, Alessandro Zummo
> <a.zummo@towertech.it>
> + *
> + * This program is free software; you can redistribute it and/or =
modify
> + * it under the terms of the GNU General Public License as published =
by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/jiffies.h>
> +#include <linux/i2c.h>
> +#include <linux/hwmon.h>
> +#include <linux/err.h>
> +#include <linux/mutex.h>
> +#include <linux/delay.h>
> +
> +
> +#define DRV_VERSION "0.2"
> +
> +/* straight from the datasheet */
> +#define AD7414_TEMP_MIN (-55000)
> +#define AD7414_TEMP_MAX 125000
> +
> +/* Addresses to scan */
> +static unsigned short normal_i2c[] =3D { 0x48, 0x4a, I2C_CLIENT_END =
};
> +
> +/* Insmod parameters */
> +I2C_CLIENT_INSMOD;
> +
> +/* AD7414 registers */
> +#define AD7414_REG_TEMP        0x00
> +#define AD7414_REG_CONF        0x01
> +#define AD7414_REG_T_HIGH    0x02
> +#define AD7414_REG_T_LOW    0x03
> +
> +struct ad7414_data {
> +    struct i2c_client    client;
> +    struct device    *dev;
> +    struct mutex        lock;
> +    char            valid;        /* !=3D0 if following fields are =
valid */
> +    unsigned long        last_updated;    /* In jiffies */
> +    u16            temp_input;    /* Register values */
> +    u8            temp_max;
> +    u8            temp_min;
> +    u8            temp_alert;
> +    u8            temp_max_flag;
> +    u8            temp_min_flag;
> +};
> +
> +static int ad7414_attach_adapter(struct i2c_adapter *adapter);
> +static int ad7414_detect(struct i2c_adapter *adapter, int address, =
int
> kind);
> +static int ad7414_detach_client(struct i2c_client *client);
> +
> +static struct i2c_driver ad7414_driver =3D {
> +    .driver =3D {
> +        .name    =3D "ad7414",
> +    },
> +    .attach_adapter    =3D ad7414_attach_adapter,
> +    .detach_client    =3D ad7414_detach_client,
> +};
> +
> +/*
> + * TEMP: 0.001C/bit (-55C to +125C)
> + * REG: (0.5C/bit, two's complement) << 7
> + */
> +static inline int AD7414_TEMP_FROM_REG(u16 reg)
> +{
> +    /* use integer division instead of equivalent right shift to
> +     * guarantee arithmetic shift and preserve the sign
> +     */
> +    return ((s16)reg / 128) * 500;
> +}
> +
> +/* All registers are word-sized, except for the configuration =
registers.
> + * AD7414 uses a high-byte first convention, which is exactly =
opposite to
> + * the usual practice.
> + */
> +static int ad7414_read(struct i2c_client *client, u8 reg)
> +{
> +    if (reg =3D=3D AD7414_REG_TEMP)
> +        return swab16(i2c_smbus_read_word_data(client, reg));
> +    else
> +        return i2c_smbus_read_byte_data(client, reg);
> +}
> +
> +static int ad7414_write(struct i2c_client *client, u8 reg, u16 value)
> +{
> +    return i2c_smbus_write_byte_data(client, reg, value);
> +}
> +
> +/* PIKA Taco - we need to access the temperature in kernel mode. As a
> + * hack we store the device here. This works because we only have one
> + * ad7414 chip.
> + */
> +static struct device *ad7414_dev;

Can you use a list_head instead?  That would allow multiple instances.

This driver shouldn't contain board specific code.

> +
> +static void ad7414_init_client(struct i2c_client *client)
> +{
> +    /* TODO: anything to do here??? */
> +    ad7414_dev =3D &client->dev;

ick.

> +}
> +
> +static struct ad7414_data *ad7414_update_device(struct device *dev)
> +{
> +    struct i2c_client *client =3D to_i2c_client(dev);
> +    struct ad7414_data *data =3D i2c_get_clientdata(client);
> +
> +    mutex_lock(&data->lock);
> +
> +    if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
> +        || !data->valid) {
> +        dev_dbg(&client->dev, "starting ad7414 update\n");
> +
> +        data->temp_input =3D ad7414_read(client, AD7414_REG_TEMP);
> +        data->temp_alert =3D (data->temp_input >> 5) & 0x01;
> +        data->temp_max_flag =3D (data->temp_input >> 4) & 0x01;
> +        data->temp_min_flag =3D (data->temp_input >> 3) & 0x01;
> +        data->temp_max =3D ad7414_read(client, AD7414_REG_T_HIGH);
> +        data->temp_min =3D ad7414_read(client, AD7414_REG_T_LOW);
> +
> +        data->last_updated =3D jiffies;
> +        data->valid =3D 1;
> +    }
> +
> +    mutex_unlock(&data->lock);
> +
> +    return data;
> +}
> +
> +int ad7414_get_temp(void)

maybe ad7414_get_temp(int index)?  Would allow for multiple instances.

> +{
> +    if(ad7414_dev) {
> +        struct ad7414_data *data =3D =
ad7414_update_device(ad7414_dev);
> +        return data->temp_input;
> +    } else
> +        return 0x1f4; // +125

Style; c++ comment

Cheers,
g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.


------------------------------

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

End of Linuxppc-dev Digest, Vol 41, Issue 56
********************************************

^ permalink raw reply related

* Re: [PATCH 1/3] add default device trees for MPC837x MDS board
From: Kumar Gala @ 2008-01-08  7:36 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev, paulus
In-Reply-To: <1199707400-23588-1-git-send-email-leoli@freescale.com>


On Jan 7, 2008, at 6:03 AM, Li Yang 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(-)

Could I convince you to convert these to dts-v1 format?

- k

^ permalink raw reply

* Re: [PATCH 3/4] mtd: Factor out OF partition support from the NOR driver.
From: Stefan Roese @ 2008-01-08  7:45 UTC (permalink / raw)
  To: linux-mtd; +Cc: Scott Wood, linuxppc-dev, dwmw2
In-Reply-To: <20071213171552.GB4459@loki.buserror.net>

On Thursday 13 December 2007, Scott Wood wrote:
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Acked-by: Stefan Roese <sr@denx.de>

Best regards,
Stefan

^ permalink raw reply

* Re: [DTC PATCH 1/2] Convert malloc() uses to xmalloc().
From: David Gibson @ 2008-01-08  7:51 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, jdl
In-Reply-To: <20080107202736.GA17782@ld0162-tx32.am.freescale.net>

On Mon, Jan 07, 2008 at 02:27:36PM -0600, Scott Wood wrote:
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

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

^ permalink raw reply

* RE: [PATCH 1/3] add default device trees for MPC837x MDS board
From: Li Yang @ 2008-01-08  7:57 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, paulus
In-Reply-To: <FB3D7D27-D06F-4AD2-B4A1-00FBA26251AF@kernel.crashing.org>

> -----Original Message-----
> From: Kumar Gala [mailto:galak@kernel.crashing.org]=20
> Sent: Tuesday, January 08, 2008 3:37 PM
> To: Li Yang
> Cc: linuxppc-dev@ozlabs.org; paulus@samba.org
> Subject: Re: [PATCH 1/3] add default device trees for MPC837x=20
> MDS board
>=20
>=20
> On Jan 7, 2008, at 6:03 AM, Li Yang wrote:
>=20
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > ---
> > address comments and use new dts spec.
> >
> > arch/powerpc/boot/dts/mpc8377_mds.dts |  277=20
> ++++++++++++++++++++++++
> > +++++++
> > arch/powerpc/boot/dts/mpc8378_mds.dts |  263=20
> ++++++++++++++++++++++++
> > +++++
> > arch/powerpc/boot/dts/mpc8379_mds.dts |  291=20
> ++++++++++++++++++++++++
> > +++++++++
> > 3 files changed, 831 insertions(+), 0 deletions(-)
>=20
> Could I convince you to convert these to dts-v1 format?

Ok, I can do it.  The DTS spec changes too much lately.  :(

- Leo

^ permalink raw reply

* Re: [PATCH 2/4] nand base: Give drivers a chance to do late initialization.
From: David Woodhouse @ 2008-01-08  7:57 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, linux-mtd
In-Reply-To: <20071213171551.GA4459@loki.buserror.net>


On Thu, 2007-12-13 at 11:15 -0600, Scott Wood wrote:
> Some nand controllers, such as the Freescale enhanced local bus controller,
> need to do late initialization based on details of the chip that has been
> probed, such as chip size, large/small pages, etc.  A late_init() callback
> method is added to allow this.

Do you really need this so late? Can't it be done between
nand_scan_ident() and nand_scan_tail()? That's why we split nand_scan()
into two in the first place...

-- 
dwmw2

^ permalink raw reply

* Re: [PATCH 3/4] mtd: Factor out OF partition support from the NOR driver.
From: David Woodhouse @ 2008-01-08  8:10 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, linux-mtd
In-Reply-To: <20071213171552.GB4459@loki.buserror.net>

Please adjust for commit 4edaf56e0f8a6f71e3361bf74e3dc835811761e6 and
resend.

-- 
dwmw2

^ permalink raw reply

* PPC4xx memory to memory DMA
From: padmanabha @ 2008-01-08  9:53 UTC (permalink / raw)
  To: linuxppc-embedded, reynekejunk

Hi,

I  am using 2.6.23  kernel for ppc 440spe based board. When i tried 
memory to memory DMA  ( please find  the code given below )
 DMA is not happening.

I am trying the same for last few days.... without any success.  Can any 
one guide me.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include<linux/kernel.h>
#include<linux/module.h>
#include<linux/delay.h>

#include<asm/ppc4xx_dma.h>
#include<asm/io.h>
#include<linux/slab.h>

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("PPC4xx Mem to Mem DMA  demo");
MODULE_AUTHOR("padmanabha@tesbv.com");

extern void flush_dcache_all(void);

#define DMA_CHANNEL_NUM                         0
#define SIZE                                                    4096

ppc_dma_ch_t  ppc_dma_channel;
ppc_dma_ch_t p_init;

void * vir_dst_addr;
void * vir_src_addr;

unsigned long int  phy_src;
unsigned long int  phy_dst;

int ret, offset;

void dma_trns(void)
{

      memset( (char *)&p_init, 0, sizeof(p_init));

      p_init.polarity = 0;
      p_init.pwidth   = PW_8;

      ret = ppc4xx_init_dma_channel( DMA_CHANNEL_NUM, &p_init);

      if (ret  ==   DMA_STATUS_GOOD)
      {
          printk("%s: init_dma_channel return %d, dest is 
%p\n",__FUNCTION__, ret, vir_dst_addr);
      }

      else if(ret  ==   DMA_STATUS_BAD_CHANNEL)
      {

        printk("TS2: bad channel \n");

      }

      flush_dcache_all();

      ppc4xx_clr_dma_status( DMA_CHANNEL_NUM);

      ppc4xx_set_dma_mode(DMA_CHANNEL_NUM,DMA_MODE_MM);
      ppc4xx_set_src_addr( DMA_CHANNEL_NUM, (phys_addr_t) phy_src);
      ppc4xx_set_dst_addr(DMA_CHANNEL_NUM,  (phys_addr_t) phy_dst);
      ppc4xx_set_dma_count(DMA_CHANNEL_NUM,(SIZE * 2 ));

      ppc4xx_set_channel_priority(DMA_CHANNEL_NUM,PRIORITY_HIGH);

      ppc4xx_enable_dma(DMA_CHANNEL_NUM);


      // wait till completion of DMA


       while( 1)
       {
            mdelay(100);

            ret = 1;
            ret = ppc4xx_get_dma_residue( DMA_CHANNEL_NUM);

            if( ret == 0)
            {
                printk(" no dma operation is pending\n");
                break;
            }

       }

     ppc4xx_disable_dma( DMA_CHANNEL_NUM);

    return  ;
}

static int dma_test_init(void)
{

    vir_src_addr = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, 1);

    if( vir_src_addr == NULL )
    {
        printk( " Memory not allocated\n");
        return 1;
    }
    printk("%s: virtual address for src buffer is 0x%p \n",__FUNCTION__, 
(unsigned int *)vir_src_addr);
    memset( (unsigned long *)vir_src_addr, 0x55, sizeof(unsigned long) * 
(SIZE *2));

#if SRC_DISPLAY

    ret = 0;

    while(ret < 100)
    {

        printk( "%s: value at virtual addr 0x%p is 0x%X \n", 
__FUNCTION__,( (unsigned int *)vir_src_addr + ret ),\

        *( (unsigned int *)vir_src_addr + ret));

        ret++;

    }

#endif

    vir_dst_addr = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA,1);

    if( vir_dst_addr == NULL )
    {
        printk( " Memory not allocated\n");
        free_pages( (unsigned long)vir_src_addr, 1);
        return 1;
    }
    printk("%s: virtual address for dst buffer is 0x%p 
\n",__FUNCTION__,(unsigned int *)vir_dst_addr);
    memset( (unsigned long *)vir_dst_addr, 0, sizeof(unsigned long) * 
(SIZE *2));

#if DST_DISPLAY

    ret = 0;
    while(ret < 100)
    {

        printk( "%s: value at virtual addr 0x%p is 0x%X \n", 
__FUNCTION__,( (unsigned int *)vir_dst_addr + ret ),\
        *( (unsigned int *)vir_dst_addr + ret));

        ret++;

    }
#endif

//      phy_src = virt_to_bus(vir_src_addr);
//      phy_dst = virt_to_bus(vir_dst_addr);

      phy_src = iopa( (unsigned long ) vir_src_addr);
      phy_dst =  iopa(  (unsigned long )vir_dst_addr);

    dma_trns();

      ret = 1;
      ret = ppc4xx_get_dma_residue( DMA_CHANNEL_NUM);
      if( ret == 0)
      {
          printk(" no dma operation is pending\n");

      }

    return 0;
}


void dma_test_exit(void)
{
      ret = ppc4xx_get_channel_config( DMA_CHANNEL_NUM, &ppc_dma_channel);

      if( ret != DMA_STATUS_GOOD )
      {
         printk("TS2: DMA STATUS  is not good \n");
      }
      else
      {
         printk("TS2:  DMA STATUS  good \n");

      }

      ret = 0;

      while(ret < 100)
      {

         printk( "%s: value at virtual addr 0x%p after dma is 0x%X \n", 
__FUNCTION__,( (unsigned int *)vir_dst_addr + ret ), \
         *( (unsigned int *)vir_dst_addr + ret)) ;

         ret++;
      }

     mdelay(100);

     free_pages( (unsigned long)vir_src_addr, 1);
     free_pages( (unsigned long)vir_dst_addr, 1);

}

module_init(dma_test_init);
module_exit(dma_test_exit);

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Thanks and Regards,
Padmanabha.s

^ permalink raw reply

* PPC4xx : Failed to perform memory to memory DMA
From: padmanabha @ 2008-01-08 10:10 UTC (permalink / raw)
  To: linuxppc-embedded

Hi,

I  am using 2.6.23  kernel for ppc 440spe based board. When i tried 
memory to memory DMA  ( please find  the code given below )
DMA is not happening.

I am trying the same for last few days.... without any success.  Can any 
one guide me.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 


#include<linux/kernel.h>
#include<linux/module.h>
#include<linux/delay.h>

#include<asm/ppc4xx_dma.h>
#include<asm/io.h>
#include<linux/slab.h>

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("PPC4xx Mem to Mem DMA  demo");
MODULE_AUTHOR("padmanabha@tesbv.com");

extern void flush_dcache_all(void);

#define DMA_CHANNEL_NUM                         0
#define SIZE                                                    4096

ppc_dma_ch_t  ppc_dma_channel;
ppc_dma_ch_t p_init;

void * vir_dst_addr;
void * vir_src_addr;

unsigned long int  phy_src;
unsigned long int  phy_dst;

int ret, offset;

void dma_trns(void)
{

    memset( (char *)&p_init, 0, sizeof(p_init));

    p_init.polarity = 0;
    p_init.pwidth   = PW_8;

    ret = ppc4xx_init_dma_channel( DMA_CHANNEL_NUM, &p_init);

    if (ret  ==   DMA_STATUS_GOOD)
    {
        printk("%s: init_dma_channel return %d, dest is 
%p\n",__FUNCTION__, ret, vir_dst_addr);
    }

    else if(ret  ==   DMA_STATUS_BAD_CHANNEL)
    {

      printk("TS2: bad channel \n");

    }

    flush_dcache_all();

    ppc4xx_clr_dma_status( DMA_CHANNEL_NUM);

    ppc4xx_set_dma_mode(DMA_CHANNEL_NUM,DMA_MODE_MM);
    ppc4xx_set_src_addr( DMA_CHANNEL_NUM, (phys_addr_t) phy_src);
    ppc4xx_set_dst_addr(DMA_CHANNEL_NUM,  (phys_addr_t) phy_dst);
    ppc4xx_set_dma_count(DMA_CHANNEL_NUM,(SIZE * 2 ));

    ppc4xx_set_channel_priority(DMA_CHANNEL_NUM,PRIORITY_HIGH);

    ppc4xx_enable_dma(DMA_CHANNEL_NUM);


    // wait till completion of DMA


     while( 1)
     {
          mdelay(100);

          ret = 1;
          ret = ppc4xx_get_dma_residue( DMA_CHANNEL_NUM);

          if( ret == 0)
          {
              printk(" no dma operation is pending\n");
              break;
          }

     }

   ppc4xx_disable_dma( DMA_CHANNEL_NUM);

  return  ;
}

static int dma_test_init(void)
{

  vir_src_addr = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, 1);

  if( vir_src_addr == NULL )
  {
      printk( " Memory not allocated\n");
      return 1;
  }
  printk("%s: virtual address for src buffer is 0x%p \n",__FUNCTION__, 
(unsigned int *)vir_src_addr);
  memset( (unsigned long *)vir_src_addr, 0x55, sizeof(unsigned long) * 
(SIZE *2));

#if SRC_DISPLAY

  ret = 0;

  while(ret < 100)
  {

      printk( "%s: value at virtual addr 0x%p is 0x%X \n", 
__FUNCTION__,( (unsigned int *)vir_src_addr + ret ),\

      *( (unsigned int *)vir_src_addr + ret));

      ret++;

  }

#endif

  vir_dst_addr = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA,1);

  if( vir_dst_addr == NULL )
  {
      printk( " Memory not allocated\n");
      free_pages( (unsigned long)vir_src_addr, 1);
      return 1;
  }
  printk("%s: virtual address for dst buffer is 0x%p 
\n",__FUNCTION__,(unsigned int *)vir_dst_addr);
  memset( (unsigned long *)vir_dst_addr, 0, sizeof(unsigned long) * 
(SIZE *2));

#if DST_DISPLAY

  ret = 0;
  while(ret < 100)
  {

      printk( "%s: value at virtual addr 0x%p is 0x%X \n", 
__FUNCTION__,( (unsigned int *)vir_dst_addr + ret ),\
      *( (unsigned int *)vir_dst_addr + ret));

      ret++;

  }
#endif

//      phy_src = virt_to_bus(vir_src_addr);
//      phy_dst = virt_to_bus(vir_dst_addr);

    phy_src = iopa( (unsigned long ) vir_src_addr);
    phy_dst =  iopa(  (unsigned long )vir_dst_addr);

  dma_trns();

    ret = 1;
    ret = ppc4xx_get_dma_residue( DMA_CHANNEL_NUM);
    if( ret == 0)
    {
        printk(" no dma operation is pending\n");

    }

  return 0;
}


void dma_test_exit(void)
{
    ret = ppc4xx_get_channel_config( DMA_CHANNEL_NUM, &ppc_dma_channel);

    if( ret != DMA_STATUS_GOOD )
    {
       printk("TS2: DMA STATUS  is not good \n");
    }
    else
    {
       printk("TS2:  DMA STATUS  good \n");

    }

    ret = 0;

    while(ret < 100)
    {

       printk( "%s: value at virtual addr 0x%p after dma is 0x%X \n", 
__FUNCTION__,( (unsigned int *)vir_dst_addr + ret ), \
       *( (unsigned int *)vir_dst_addr + ret)) ;

       ret++;
    }

   mdelay(100);

   free_pages( (unsigned long)vir_src_addr, 1);
   free_pages( (unsigned long)vir_dst_addr, 1);

}

module_init(dma_test_init);
module_exit(dma_test_exit);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 


Thanks and Regards,
Padmanabha.s

^ permalink raw reply

* [PATCH] Convert MPC837x device trees to dts-v1
From: Li Yang @ 2008-01-08 11:32 UTC (permalink / raw)
  To: galak, linuxppc-dev; +Cc: Li Yang

Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/boot/dts/mpc8377_mds.dts |  148 ++++++++++++++++---------------
 arch/powerpc/boot/dts/mpc8378_mds.dts |  140 +++++++++++++++---------------
 arch/powerpc/boot/dts/mpc8379_mds.dts |  156 +++++++++++++++++----------------
 3 files changed, 225 insertions(+), 219 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
index b50b5f9..d66c8ad 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -9,6 +9,8 @@
  * option) any later version.
  */
 
+/dts-v1/;
+
 / {
 	model = "fsl,mpc8377emds";
 	compatible = "fsl,mpc8377emds","fsl,mpc837xmds";
@@ -30,10 +32,10 @@
 		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
+			d-cache-line-size = <0x20>;
+			i-cache-line-size = <0x20>;
+			d-cache-size = <0x8000>;		// L1, 32K
+			i-cache-size = <0x8000>;		// L1, 32K
 			timebase-frequency = <0>;
 			bus-frequency = <0>;
 			clock-frequency = <0>;
@@ -42,20 +44,20 @@
 
 	memory {
 		device_type = "memory";
-		reg = <00000000 20000000>;	// 512MB at 0
+		reg = <0x00000000 0x20000000>;	// 512MB at 0
 	};
 
 	soc@e0000000 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		device_type = "soc";
-		ranges = <0 e0000000 00100000>;
-		reg = <e0000000 00000200>;
+		ranges = <0x0 0xe0000000 0x00100000>;
+		reg = <0xe0000000 0x00000200>;
 		bus-frequency = <0>;
 
 		wdt@200 {
 			compatible = "mpc83xx_wdt";
-			reg = <200 100>;
+			reg = <0x200 0x100>;
 		};
 
 		i2c@3000 {
@@ -63,8 +65,8 @@
 			#size-cells = <0>;
 			cell-index = <0>;
 			compatible = "fsl-i2c";
-			reg = <3000 100>;
-			interrupts = <e 8>;
+			reg = <0x3000 0x100>;
+			interrupts = <0xe 0x8>;
 			interrupt-parent = < &ipic >;
 			dfsrr;
 		};
@@ -74,16 +76,16 @@
 			#size-cells = <0>;
 			cell-index = <1>;
 			compatible = "fsl-i2c";
-			reg = <3100 100>;
-			interrupts = <f 8>;
+			reg = <0x3100 0x100>;
+			interrupts = <0xf 0x8>;
 			interrupt-parent = < &ipic >;
 			dfsrr;
 		};
 
 		spi@7000 {
 			compatible = "fsl_spi";
-			reg = <7000 1000>;
-			interrupts = <10 8>;
+			reg = <0x7000 0x1000>;
+			interrupts = <0x10 0x8>;
 			interrupt-parent = < &ipic >;
 			mode = "cpu";
 		};
@@ -91,11 +93,11 @@
 		/* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
 		usb@23000 {
 			compatible = "fsl-usb2-dr";
-			reg = <23000 1000>;
+			reg = <0x23000 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			interrupt-parent = < &ipic >;
-			interrupts = <26 8>;
+			interrupts = <0x26 0x8>;
 			phy_type = "utmi_wide";
 		};
 
@@ -103,16 +105,16 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "fsl,gianfar-mdio";
-			reg = <24520 20>;
+			reg = <0x24520 0x20>;
 			phy2: ethernet-phy@2 {
 				interrupt-parent = < &ipic >;
-				interrupts = <11 8>;
+				interrupts = <0x11 0x8>;
 				reg = <2>;
 				device_type = "ethernet-phy";
 			};
 			phy3: ethernet-phy@3 {
 				interrupt-parent = < &ipic >;
-				interrupts = <12 8>;
+				interrupts = <0x12 0x8>;
 				reg = <3>;
 				device_type = "ethernet-phy";
 			};
@@ -123,9 +125,9 @@
 			device_type = "network";
 			model = "eTSEC";
 			compatible = "gianfar";
-			reg = <24000 1000>;
+			reg = <0x24000 0x1000>;
 			local-mac-address = [ 00 00 00 00 00 00 ];
-			interrupts = <20 8 21 8 22 8>;
+			interrupts = <0x20 0x8 0x21 0x8 0x22 0x8>;
 			phy-connection-type = "mii";
 			interrupt-parent = < &ipic >;
 			phy-handle = < &phy2 >;
@@ -136,9 +138,9 @@
 			device_type = "network";
 			model = "eTSEC";
 			compatible = "gianfar";
-			reg = <25000 1000>;
+			reg = <0x25000 0x1000>;
 			local-mac-address = [ 00 00 00 00 00 00 ];
-			interrupts = <23 8 24 8 25 8>;
+			interrupts = <0x23 0x8 0x24 0x8 0x25 0x8>;
 			phy-connection-type = "mii";
 			interrupt-parent = < &ipic >;
 			phy-handle = < &phy3 >;
@@ -148,9 +150,9 @@
 			cell-index = <0>;
 			device_type = "serial";
 			compatible = "ns16550";
-			reg = <4500 100>;
+			reg = <0x4500 0x100>;
 			clock-frequency = <0>;
-			interrupts = <9 8>;
+			interrupts = <0x9 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
@@ -158,44 +160,44 @@
 			cell-index = <1>;
 			device_type = "serial";
 			compatible = "ns16550";
-			reg = <4600 100>;
+			reg = <0x4600 0x100>;
 			clock-frequency = <0>;
-			interrupts = <a 8>;
+			interrupts = <0xa 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
 		crypto@30000 {
 			model = "SEC3";
 			compatible = "talitos";
-			reg = <30000 10000>;
-			interrupts = <b 8>;
+			reg = <0x30000 0x10000>;
+			interrupts = <0xb 0x8>;
 			interrupt-parent = < &ipic >;
 			/* Rev. 3.0 geometry */
 			num-channels = <4>;
-			channel-fifo-len = <18>;
-			exec-units-mask = <000001fe>;
-			descriptor-types-mask = <03ab0ebf>;
+			channel-fifo-len = <0x18>;
+			exec-units-mask = <0x000001fe>;
+			descriptor-types-mask = <0x03ab0ebf>;
 		};
 
 		sdhc@2e000 {
 			model = "eSDHC";
 			compatible = "fsl,esdhc";
-			reg = <2e000 1000>;
-			interrupts = <2a 8>;
+			reg = <0x2e000 0x1000>;
+			interrupts = <0x2a 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
 		sata@18000 {
 			compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
-			reg = <18000 1000>;
-			interrupts = <2c 8>;
+			reg = <0x18000 0x1000>;
+			interrupts = <0x2c 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
 		sata@19000 {
 			compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
-			reg = <19000 1000>;
-			interrupts = <2d 8>;
+			reg = <0x19000 0x1000>;
+			interrupts = <0x2d 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
@@ -210,67 +212,67 @@
 			interrupt-controller;
 			#address-cells = <0>;
 			#interrupt-cells = <2>;
-			reg = <700 100>;
+			reg = <0x700 0x100>;
 		};
 	};
 
 	pci0: pci@e0008500 {
 		cell-index = <0>;
-		interrupt-map-mask = <f800 0 0 7>;
+		interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
 		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
+				 0x8800 0x0 0x0 0x1 &ipic 0x14 0x8
+				 0x8800 0x0 0x0 0x2 &ipic 0x15 0x8
+				 0x8800 0x0 0x0 0x3 &ipic 0x16 0x8
+				 0x8800 0x0 0x0 0x4 &ipic 0x17 0x8
 
 				/* 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
+				 0x9000 0x0 0x0 0x1 &ipic 0x16 0x8
+				 0x9000 0x0 0x0 0x2 &ipic 0x17 0x8
+				 0x9000 0x0 0x0 0x3 &ipic 0x14 0x8
+				 0x9000 0x0 0x0 0x4 &ipic 0x15 0x8
 
 				/* 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
+				 0x9800 0x0 0x0 0x1 &ipic 0x17 0x8
+				 0x9800 0x0 0x0 0x2 &ipic 0x14 0x8
+				 0x9800 0x0 0x0 0x3 &ipic 0x15 0x8
+				 0x9800 0x0 0x0 0x4 &ipic 0x16 0x8
 
 				/* 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
+				 0xa800 0x0 0x0 0x1 &ipic 0x14 0x8
+				 0xa800 0x0 0x0 0x2 &ipic 0x15 0x8
+				 0xa800 0x0 0x0 0x3 &ipic 0x16 0x8
+				 0xa800 0x0 0x0 0x4 &ipic 0x17 0x8
 
 				/* 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
+				 0xb000 0x0 0x0 0x1 &ipic 0x17 0x8
+				 0xb000 0x0 0x0 0x2 &ipic 0x14 0x8
+				 0xb000 0x0 0x0 0x3 &ipic 0x15 0x8
+				 0xb000 0x0 0x0 0x4 &ipic 0x16 0x8
 
 				/* 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
+				 0xb800 0x0 0x0 0x1 &ipic 0x16 0x8
+				 0xb800 0x0 0x0 0x2 &ipic 0x17 0x8
+				 0xb800 0x0 0x0 0x3 &ipic 0x14 0x8
+				 0xb800 0x0 0x0 0x4 &ipic 0x15 0x8
 
 				/* 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>;
+				 0xc000 0x0 0x0 0x1 &ipic 0x15 0x8
+				 0xc000 0x0 0x0 0x2 &ipic 0x16 0x8
+				 0xc000 0x0 0x0 0x3 &ipic 0x17 0x8
+				 0xc000 0x0 0x0 0x4 &ipic 0x14 0x8>;
 		interrupt-parent = < &ipic >;
-		interrupts = <42 8>;
+		interrupts = <0x42 0x8>;
 		bus-range = <0 0>;
-		ranges = <02000000 0 90000000 90000000 0 10000000
-		          42000000 0 80000000 80000000 0 10000000
-		          01000000 0 00000000 e0300000 0 00100000>;
+		ranges = <0x02000000 0x0 0x90000000 0x90000000 0x0 0x10000000
+		          0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000
+		          0x01000000 0x0 0x00000000 0xe0300000 0x0 0x00100000>;
 		clock-frequency = <0>;
 		#interrupt-cells = <1>;
 		#size-cells = <2>;
 		#address-cells = <3>;
-		reg = <e0008500 100>;
+		reg = <0xe0008500 0x100>;
 		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
index bd9545d..c117a6a 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -9,6 +9,8 @@
  * option) any later version.
  */
 
+/dts-v1/;
+
 / {
 	model = "fsl,mpc8378emds";
 	compatible = "fsl,mpc8378emds","fsl,mpc837xmds";
@@ -30,10 +32,10 @@
 		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
+			d-cache-line-size = <0x20>;
+			i-cache-line-size = <0x20>;
+			d-cache-size = <0x8000>;		// L1, 32K
+			i-cache-size = <0x8000>;		// L1, 32K
 			timebase-frequency = <0>;
 			bus-frequency = <0>;
 			clock-frequency = <0>;
@@ -42,20 +44,20 @@
 
 	memory {
 		device_type = "memory";
-		reg = <00000000 20000000>;	// 512MB at 0
+		reg = <0x00000000 0x20000000>;	// 512MB at 0
 	};
 
 	soc@e0000000 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		device_type = "soc";
-		ranges = <0 e0000000 00100000>;
-		reg = <e0000000 00000200>;
+		ranges = <0x0 0xe0000000 0x00100000>;
+		reg = <0xe0000000 0x00000200>;
 		bus-frequency = <0>;
 
 		wdt@200 {
 			compatible = "mpc83xx_wdt";
-			reg = <200 100>;
+			reg = <0x200 0x100>;
 		};
 
 		i2c@3000 {
@@ -63,8 +65,8 @@
 			#size-cells = <0>;
 			cell-index = <0>;
 			compatible = "fsl-i2c";
-			reg = <3000 100>;
-			interrupts = <e 8>;
+			reg = <0x3000 0x100>;
+			interrupts = <0xe 0x8>;
 			interrupt-parent = < &ipic >;
 			dfsrr;
 		};
@@ -74,16 +76,16 @@
 			#size-cells = <0>;
 			cell-index = <1>;
 			compatible = "fsl-i2c";
-			reg = <3100 100>;
-			interrupts = <f 8>;
+			reg = <0x3100 0x100>;
+			interrupts = <0xf 0x8>;
 			interrupt-parent = < &ipic >;
 			dfsrr;
 		};
 
 		spi@7000 {
 			compatible = "fsl_spi";
-			reg = <7000 1000>;
-			interrupts = <10 8>;
+			reg = <0x7000 0x1000>;
+			interrupts = <0x10 0x8>;
 			interrupt-parent = < &ipic >;
 			mode = "cpu";
 		};
@@ -91,11 +93,11 @@
 		/* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
 		usb@23000 {
 			compatible = "fsl-usb2-dr";
-			reg = <23000 1000>;
+			reg = <0x23000 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			interrupt-parent = < &ipic >;
-			interrupts = <26 8>;
+			interrupts = <0x26 0x8>;
 			phy_type = "utmi_wide";
 		};
 
@@ -103,16 +105,16 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "fsl,gianfar-mdio";
-			reg = <24520 20>;
+			reg = <0x24520 0x20>;
 			phy2: ethernet-phy@2 {
 				interrupt-parent = < &ipic >;
-				interrupts = <11 8>;
+				interrupts = <0x11 0x8>;
 				reg = <2>;
 				device_type = "ethernet-phy";
 			};
 			phy3: ethernet-phy@3 {
 				interrupt-parent = < &ipic >;
-				interrupts = <12 8>;
+				interrupts = <0x12 0x8>;
 				reg = <3>;
 				device_type = "ethernet-phy";
 			};
@@ -123,9 +125,9 @@
 			device_type = "network";
 			model = "eTSEC";
 			compatible = "gianfar";
-			reg = <24000 1000>;
+			reg = <0x24000 0x1000>;
 			local-mac-address = [ 00 00 00 00 00 00 ];
-			interrupts = <20 8 21 8 22 8>;
+			interrupts = <0x20 0x8 0x21 0x8 0x22 0x8>;
 			phy-connection-type = "mii";
 			interrupt-parent = < &ipic >;
 			phy-handle = < &phy2 >;
@@ -136,9 +138,9 @@
 			device_type = "network";
 			model = "eTSEC";
 			compatible = "gianfar";
-			reg = <25000 1000>;
+			reg = <0x25000 0x1000>;
 			local-mac-address = [ 00 00 00 00 00 00 ];
-			interrupts = <23 8 24 8 25 8>;
+			interrupts = <0x23 0x8 0x24 0x8 0x25 0x8>;
 			phy-connection-type = "mii";
 			interrupt-parent = < &ipic >;
 			phy-handle = < &phy3 >;
@@ -148,9 +150,9 @@
 			cell-index = <0>;
 			device_type = "serial";
 			compatible = "ns16550";
-			reg = <4500 100>;
+			reg = <0x4500 0x100>;
 			clock-frequency = <0>;
-			interrupts = <9 8>;
+			interrupts = <0x9 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
@@ -158,30 +160,30 @@
 			cell-index = <1>;
 			device_type = "serial";
 			compatible = "ns16550";
-			reg = <4600 100>;
+			reg = <0x4600 0x100>;
 			clock-frequency = <0>;
-			interrupts = <a 8>;
+			interrupts = <0xa 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
 		crypto@30000 {
 			model = "SEC3";
 			compatible = "talitos";
-			reg = <30000 10000>;
-			interrupts = <b 8>;
+			reg = <0x30000 0x10000>;
+			interrupts = <0xb 0x8>;
 			interrupt-parent = < &ipic >;
 			/* Rev. 3.0 geometry */
 			num-channels = <4>;
-			channel-fifo-len = <18>;
-			exec-units-mask = <000001fe>;
-			descriptor-types-mask = <03ab0ebf>;
+			channel-fifo-len = <0x18>;
+			exec-units-mask = <0x000001fe>;
+			descriptor-types-mask = <0x03ab0ebf>;
 		};
 
 		sdhc@2e000 {
 			model = "eSDHC";
 			compatible = "fsl,esdhc";
-			reg = <2e000 1000>;
-			interrupts = <2a 8>;
+			reg = <0x2e000 0x1000>;
+			interrupts = <0x2a 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
@@ -196,67 +198,67 @@
 			interrupt-controller;
 			#address-cells = <0>;
 			#interrupt-cells = <2>;
-			reg = <700 100>;
+			reg = <0x700 0x100>;
 		};
 	};
 
 	pci0: pci@e0008500 {
 		cell-index = <0>;
-		interrupt-map-mask = <f800 0 0 7>;
+		interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
 		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
+				 0x8800 0x0 0x0 0x1 &ipic 0x14 0x8
+				 0x8800 0x0 0x0 0x2 &ipic 0x15 0x8
+				 0x8800 0x0 0x0 0x3 &ipic 0x16 0x8
+				 0x8800 0x0 0x0 0x4 &ipic 0x17 0x8
 
 				/* 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
+				 0x9000 0x0 0x0 0x1 &ipic 0x16 0x8
+				 0x9000 0x0 0x0 0x2 &ipic 0x17 0x8
+				 0x9000 0x0 0x0 0x3 &ipic 0x14 0x8
+				 0x9000 0x0 0x0 0x4 &ipic 0x15 0x8
 
 				/* 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
+				 0x9800 0x0 0x0 0x1 &ipic 0x17 0x8
+				 0x9800 0x0 0x0 0x2 &ipic 0x14 0x8
+				 0x9800 0x0 0x0 0x3 &ipic 0x15 0x8
+				 0x9800 0x0 0x0 0x4 &ipic 0x16 0x8
 
 				/* 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
+				 0xa800 0x0 0x0 0x1 &ipic 0x14 0x8
+				 0xa800 0x0 0x0 0x2 &ipic 0x15 0x8
+				 0xa800 0x0 0x0 0x3 &ipic 0x16 0x8
+				 0xa800 0x0 0x0 0x4 &ipic 0x17 0x8
 
 				/* 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
+				 0xb000 0x0 0x0 0x1 &ipic 0x17 0x8
+				 0xb000 0x0 0x0 0x2 &ipic 0x14 0x8
+				 0xb000 0x0 0x0 0x3 &ipic 0x15 0x8
+				 0xb000 0x0 0x0 0x4 &ipic 0x16 0x8
 
 				/* 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
+				 0xb800 0x0 0x0 0x1 &ipic 0x16 0x8
+				 0xb800 0x0 0x0 0x2 &ipic 0x17 0x8
+				 0xb800 0x0 0x0 0x3 &ipic 0x14 0x8
+				 0xb800 0x0 0x0 0x4 &ipic 0x15 0x8
 
 				/* 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>;
+				 0xc000 0x0 0x0 0x1 &ipic 0x15 0x8
+				 0xc000 0x0 0x0 0x2 &ipic 0x16 0x8
+				 0xc000 0x0 0x0 0x3 &ipic 0x17 0x8
+				 0xc000 0x0 0x0 0x4 &ipic 0x14 0x8>;
 		interrupt-parent = < &ipic >;
-		interrupts = <42 8>;
+		interrupts = <0x42 0x8>;
 		bus-range = <0 0>;
-		ranges = <02000000 0 90000000 90000000 0 10000000
-		          42000000 0 80000000 80000000 0 10000000
-		          01000000 0 00000000 e0300000 0 00100000>;
+		ranges = <0x02000000 0x0 0x90000000 0x90000000 0x0 0x10000000
+		          0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000
+		          0x01000000 0x0 0x00000000 0xe0300000 0x0 0x00100000>;
 		clock-frequency = <0>;
 		#interrupt-cells = <1>;
 		#size-cells = <2>;
 		#address-cells = <3>;
-		reg = <e0008500 100>;
+		reg = <0xe0008500 0x100>;
 		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
index 4d651a3..7510811 100644
--- a/arch/powerpc/boot/dts/mpc8379_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
@@ -9,6 +9,8 @@
  * option) any later version.
  */
 
+/dts-v1/;
+
 / {
 	model = "fsl,mpc8379emds";
 	compatible = "fsl,mpc8379emds","fsl,mpc837xmds";
@@ -30,10 +32,10 @@
 		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
+			d-cache-line-size = <0x20>;
+			i-cache-line-size = <0x20>;
+			d-cache-size = <0x8000>;		// L1, 32K
+			i-cache-size = <0x8000>;		// L1, 32K
 			timebase-frequency = <0>;
 			bus-frequency = <0>;
 			clock-frequency = <0>;
@@ -42,20 +44,20 @@
 
 	memory {
 		device_type = "memory";
-		reg = <00000000 20000000>;	// 512MB at 0
+		reg = <0x00000000 0x20000000>;	// 512MB at 0
 	};
 
 	soc@e0000000 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		device_type = "soc";
-		ranges = <0 e0000000 00100000>;
-		reg = <e0000000 00000200>;
+		ranges = <0x0 0xe0000000 0x00100000>;
+		reg = <0xe0000000 0x00000200>;
 		bus-frequency = <0>;
 
 		wdt@200 {
 			compatible = "mpc83xx_wdt";
-			reg = <200 100>;
+			reg = <0x200 0x100>;
 		};
 
 		i2c@3000 {
@@ -63,8 +65,8 @@
 			#size-cells = <0>;
 			cell-index = <0>;
 			compatible = "fsl-i2c";
-			reg = <3000 100>;
-			interrupts = <e 8>;
+			reg = <0x3000 0x100>;
+			interrupts = <0xe 0x8>;
 			interrupt-parent = < &ipic >;
 			dfsrr;
 		};
@@ -74,16 +76,16 @@
 			#size-cells = <0>;
 			cell-index = <1>;
 			compatible = "fsl-i2c";
-			reg = <3100 100>;
-			interrupts = <f 8>;
+			reg = <0x3100 0x100>;
+			interrupts = <0xf 0x8>;
 			interrupt-parent = < &ipic >;
 			dfsrr;
 		};
 
 		spi@7000 {
 			compatible = "fsl_spi";
-			reg = <7000 1000>;
-			interrupts = <10 8>;
+			reg = <0x7000 0x1000>;
+			interrupts = <0x10 0x8>;
 			interrupt-parent = < &ipic >;
 			mode = "cpu";
 		};
@@ -91,11 +93,11 @@
 		/* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
 		usb@23000 {
 			compatible = "fsl-usb2-dr";
-			reg = <23000 1000>;
+			reg = <0x23000 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			interrupt-parent = < &ipic >;
-			interrupts = <26 8>;
+			interrupts = <0x26 0x8>;
 			phy_type = "utmi_wide";
 		};
 
@@ -103,16 +105,16 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "fsl,gianfar-mdio";
-			reg = <24520 20>;
+			reg = <0x24520 0x20>;
 			phy2: ethernet-phy@2 {
 				interrupt-parent = < &ipic >;
-				interrupts = <11 8>;
+				interrupts = <0x11 0x8>;
 				reg = <2>;
 				device_type = "ethernet-phy";
 			};
 			phy3: ethernet-phy@3 {
 				interrupt-parent = < &ipic >;
-				interrupts = <12 8>;
+				interrupts = <0x12 0x8>;
 				reg = <3>;
 				device_type = "ethernet-phy";
 			};
@@ -123,9 +125,9 @@
 			device_type = "network";
 			model = "eTSEC";
 			compatible = "gianfar";
-			reg = <24000 1000>;
+			reg = <0x24000 0x1000>;
 			local-mac-address = [ 00 00 00 00 00 00 ];
-			interrupts = <20 8 21 8 22 8>;
+			interrupts = <0x20 0x8 0x21 0x8 0x22 0x8>;
 			phy-connection-type = "mii";
 			interrupt-parent = < &ipic >;
 			phy-handle = < &phy2 >;
@@ -136,9 +138,9 @@
 			device_type = "network";
 			model = "eTSEC";
 			compatible = "gianfar";
-			reg = <25000 1000>;
+			reg = <0x25000 0x1000>;
 			local-mac-address = [ 00 00 00 00 00 00 ];
-			interrupts = <23 8 24 8 25 8>;
+			interrupts = <0x23 0x8 0x24 0x8 0x25 0x8>;
 			phy-connection-type = "mii";
 			interrupt-parent = < &ipic >;
 			phy-handle = < &phy3 >;
@@ -148,9 +150,9 @@
 			cell-index = <0>;
 			device_type = "serial";
 			compatible = "ns16550";
-			reg = <4500 100>;
+			reg = <0x4500 0x100>;
 			clock-frequency = <0>;
-			interrupts = <9 8>;
+			interrupts = <0x9 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
@@ -158,58 +160,58 @@
 			cell-index = <1>;
 			device_type = "serial";
 			compatible = "ns16550";
-			reg = <4600 100>;
+			reg = <0x4600 0x100>;
 			clock-frequency = <0>;
-			interrupts = <a 8>;
+			interrupts = <0xa 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
 		crypto@30000 {
 			model = "SEC3";
 			compatible = "talitos";
-			reg = <30000 10000>;
-			interrupts = <b 8>;
+			reg = <0x30000 0x10000>;
+			interrupts = <0xb 0x8>;
 			interrupt-parent = < &ipic >;
 			/* Rev. 3.0 geometry */
 			num-channels = <4>;
-			channel-fifo-len = <18>;
-			exec-units-mask = <000001fe>;
-			descriptor-types-mask = <03ab0ebf>;
+			channel-fifo-len = <0x18>;
+			exec-units-mask = <0x000001fe>;
+			descriptor-types-mask = <0x03ab0ebf>;
 		};
 
 		sdhc@2e000 {
 			model = "eSDHC";
 			compatible = "fsl,esdhc";
-			reg = <2e000 1000>;
-			interrupts = <2a 8>;
+			reg = <0x2e000 0x1000>;
+			interrupts = <0x2a 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
 		sata@18000 {
 			compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
-			reg = <18000 1000>;
-			interrupts = <2c 8>;
+			reg = <0x18000 0x1000>;
+			interrupts = <0x2c 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
 		sata@19000 {
 			compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
-			reg = <19000 1000>;
-			interrupts = <2d 8>;
+			reg = <0x19000 0x1000>;
+			interrupts = <0x2d 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
 		sata@1a000 {
 			compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
-			reg = <1a000 1000>;
-			interrupts = <2e 8>;
+			reg = <0x1a000 0x1000>;
+			interrupts = <0x2e 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
 		sata@1b000 {
 			compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
-			reg = <1b000 1000>;
-			interrupts = <2f 8>;
+			reg = <0x1b000 0x1000>;
+			interrupts = <0x2f 0x8>;
 			interrupt-parent = < &ipic >;
 		};
 
@@ -224,67 +226,67 @@
 			interrupt-controller;
 			#address-cells = <0>;
 			#interrupt-cells = <2>;
-			reg = <700 100>;
+			reg = <0x700 0x100>;
 		};
 	};
 
 	pci0: pci@e0008500 {
 		cell-index = <0>;
-		interrupt-map-mask = <f800 0 0 7>;
+		interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
 		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
+				 0x8800 0x0 0x0 0x1 &ipic 0x14 0x8
+				 0x8800 0x0 0x0 0x2 &ipic 0x15 0x8
+				 0x8800 0x0 0x0 0x3 &ipic 0x16 0x8
+				 0x8800 0x0 0x0 0x4 &ipic 0x17 0x8
 
 				/* 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
+				 0x9000 0x0 0x0 0x1 &ipic 0x16 0x8
+				 0x9000 0x0 0x0 0x2 &ipic 0x17 0x8
+				 0x9000 0x0 0x0 0x3 &ipic 0x14 0x8
+				 0x9000 0x0 0x0 0x4 &ipic 0x15 0x8
 
 				/* 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
+				 0x9800 0x0 0x0 0x1 &ipic 0x17 0x8
+				 0x9800 0x0 0x0 0x2 &ipic 0x14 0x8
+				 0x9800 0x0 0x0 0x3 &ipic 0x15 0x8
+				 0x9800 0x0 0x0 0x4 &ipic 0x16 0x8
 
 				/* 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
+				 0xa800 0x0 0x0 0x1 &ipic 0x14 0x8
+				 0xa800 0x0 0x0 0x2 &ipic 0x15 0x8
+				 0xa800 0x0 0x0 0x3 &ipic 0x16 0x8
+				 0xa800 0x0 0x0 0x4 &ipic 0x17 0x8
 
 				/* 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
+				 0xb000 0x0 0x0 0x1 &ipic 0x17 0x8
+				 0xb000 0x0 0x0 0x2 &ipic 0x14 0x8
+				 0xb000 0x0 0x0 0x3 &ipic 0x15 0x8
+				 0xb000 0x0 0x0 0x4 &ipic 0x16 0x8
 
 				/* 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
+				 0xb800 0x0 0x0 0x1 &ipic 0x16 0x8
+				 0xb800 0x0 0x0 0x2 &ipic 0x17 0x8
+				 0xb800 0x0 0x0 0x3 &ipic 0x14 0x8
+				 0xb800 0x0 0x0 0x4 &ipic 0x15 0x8
 
 				/* 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>;
+				 0xc000 0x0 0x0 0x1 &ipic 0x15 0x8
+				 0xc000 0x0 0x0 0x2 &ipic 0x16 0x8
+				 0xc000 0x0 0x0 0x3 &ipic 0x17 0x8
+				 0xc000 0x0 0x0 0x4 &ipic 0x14 0x8>;
 		interrupt-parent = < &ipic >;
-		interrupts = <42 8>;
+		interrupts = <0x42 0x8>;
 		bus-range = <0 0>;
-		ranges = <02000000 0 90000000 90000000 0 10000000
-		          42000000 0 80000000 80000000 0 10000000
-		          01000000 0 00000000 e0300000 0 00100000>;
+		ranges = <0x02000000 0x0 0x90000000 0x90000000 0x0 0x10000000
+		          0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000
+		          0x01000000 0x0 0x00000000 0xe0300000 0x0 0x00100000>;
 		clock-frequency = <0>;
 		#interrupt-cells = <1>;
 		#size-cells = <2>;
 		#address-cells = <3>;
-		reg = <e0008500 100>;
+		reg = <0xe0008500 0x100>;
 		compatible = "fsl,mpc8349-pci";
 		device_type = "pci";
 	};
-- 
1.5.3.5.643.g40e25

^ permalink raw reply related

* 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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox