LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: + iseries-convert-to-proc_fops.patch added to -mm tree
From: Andrew Morton @ 2009-12-08  6:31 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, adobriyan
In-Reply-To: <1260247339.10809.31.camel@pasglop>

On Tue, 08 Dec 2009 15:42:19 +1100 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Tue, 2009-12-01 at 14:05 -0800, akpm@linux-foundation.org wrote:
> > The patch titled
> >      iseries: convert to proc_fops
> > has been added to the -mm tree.  Its filename is
> >      iseries-convert-to-proc_fops.patch
> 
> I was looking at that patch since It was in my queue, and while I
> have no firm objection, I started wondering what was the point :-)
> 
> IE. What does seq_file buys us here since the conversion adds more
> code than it removes and adds a hope via kmalloc that isn't necessary
> before the said conversion ?
> 
> Those files are only ever one line long (and one of them is only one
> character) so the seq_file doesn't really gets us any benefit does it ?


Might be related to this:

: Convert code away from ->read_proc/->write_proc interfaces.  Switch to
: proc_create()/proc_create_data() which make addition of proc entries
: reliable wrt NULL ->proc_fops, NULL ->data and so on.
:
: Problem with ->read_proc et al is described here commit
: 786d7e1612f0b0adb6046f19b906609e4fe8b1ba "Fix rmmod/read/write races in
: /proc entries"

but the real answer is: I have no idea.

Hopefully Andrey is now cured of his tendency to send unchangelogged
patches.

Andrey, please send along changelogs for

iseries-convert-to-proc_fops.patch
via-pmu-convert-to-proc_fops-seq_file.patch
proc_fops-convert-av7110.patch
proc_fops-convert-cpia.patch
proc_fops-convert-drivers-isdn-to-seq_file.patch
uml-convert-to-seq_file-proc_fops.patch
clps711xfb-convert-to-proc_fops.patch

^ permalink raw reply

* Re: Ping does not work on my MPC8544 board, using linux2.6.23
From: 林志平 @ 2009-12-08  6:35 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <8148211e0912071825t22ffa590va2fe22272f6aaf62@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

PING works now, after modifying the code of gianfar-mii.c

2009/12/8 林志平 <solyn123@gmail.com>

>
> 2009/12/8 Scott Wood <scottwood@freescale.com>
>
>  On Mon, Dec 07, 2009 at 11:53:22AM +0800, 林志平 wrote:
>> > Does dtc1.2.0 can compile dts files under linux2.6.23?
>>
>> Probably not -- 2.6.23 is very old, and I think newer dtcs only support
>> the
>> newer dts syntax.
>>
>> > Another question is that I found linux2.6.31 does not support
>> > board mpc8544ds,
>>
>> It should.  What problems do you see?
>
> => bootm 0x1000000 0x1800000 0x800000
> ## Booting kernel from Legacy Image at 01000000 ...
>    Image Name:   Linux-2.6.31
>    Image Type:   PowerPC Linux Kernel Image (gzip compressed)
>    Data Size:    2185099 Bytes =  2.1 MB
>    Load Address: 00000000
>    Entry Point:  00000000
>    Verifying Checksum ... OK
> ## Loading init Ramdisk from Legacy Image at 01800000 ...
>    Image Name:   Simple Embedded Linux Framework
>    Image Type:   PowerPC Linux RAMDisk Image (gzip compressed)
>    Data Size:    1859256 Bytes =  1.8 MB
>    Load Address: 00000000
>    Entry Point:  00000000
>    Verifying Checksum ... OK
> ## Flattened Device Tree blob at 00800000
>    Booting using the fdt blob at 0x800000
>    Uncompressing Kernel Image ... OK
>    Loading Ramdisk to 1fca7000, end 1fe6ceb8 ... OK
> booting kernel using flat tree
> It then stops and never print any more,  I use mpc85xx_defconfig, I select
> mpc85xxds in the menuconfig and deselect other options like mpc8540ads etc.
>
>>
>> > And I never boot linux-2.6.31 on my board, why linux-2.6.31 doesnot
>> > provide a config file like mpc8544_ds_defconfig?
>>
>> Does mpc85xx_defconfig not work?
>>
> Yes mcp85xx_defconfig does not work, I can see mpc8540ads in the
> menuconfig, but no mpc8544ds. And when I down load the generated uImage, It
> does not work.
>
>
>> -Scott
>>
>
>

[-- Attachment #2: Type: text/html, Size: 3076 bytes --]

^ permalink raw reply

* Re: Ping does not work on my MPC8544 board, using linux2.6.23
From: hank peng @ 2009-12-08  7:12 UTC (permalink / raw)
  To: 林志平; +Cc: Scott Wood, linuxppc-dev
In-Reply-To: <8148211e0912071825t22ffa590va2fe22272f6aaf62@mail.gmail.com>

2009/12/8 =E6=9E=97=E5=BF=97=E5=B9=B3 <solyn123@gmail.com>:
>
> 2009/12/8 Scott Wood <scottwood@freescale.com>
>>
>> On Mon, Dec 07, 2009 at 11:53:22AM +0800, =E6=9E=97=E5=BF=97=E5=B9=B3 wr=
ote:
>> > Does dtc1.2.0 can compile dts files under linux2.6.23?
>>
>> Probably not -- 2.6.23 is very old, and I think newer dtcs only support
>> the
>> newer dts syntax.
>>
>> > Another question is that I found linux2.6.31 does not support
>> > board mpc8544ds,
>>
>> It should. =C2=A0What problems do you see?
>
> =3D> bootm 0x1000000 0x1800000 0x800000
> ## Booting kernel from Legacy Image at 01000000 ...
> =C2=A0=C2=A0 Image Name:=C2=A0=C2=A0 Linux-2.6.31
> =C2=A0=C2=A0 Image Type:=C2=A0=C2=A0 PowerPC Linux Kernel Image (gzip com=
pressed)
> =C2=A0=C2=A0 Data Size:=C2=A0=C2=A0=C2=A0 2185099 Bytes =3D=C2=A0 2.1 MB
> =C2=A0=C2=A0 Load Address: 00000000
> =C2=A0=C2=A0 Entry Point:=C2=A0 00000000
> =C2=A0=C2=A0 Verifying Checksum ... OK
> ## Loading init Ramdisk from Legacy Image at 01800000 ...
> =C2=A0=C2=A0 Image Name:=C2=A0=C2=A0 Simple Embedded Linux Framework
> =C2=A0=C2=A0 Image Type:=C2=A0=C2=A0 PowerPC Linux RAMDisk Image (gzip co=
mpressed)
> =C2=A0=C2=A0 Data Size:=C2=A0=C2=A0=C2=A0 1859256 Bytes =3D=C2=A0 1.8 MB
> =C2=A0=C2=A0 Load Address: 00000000
> =C2=A0=C2=A0 Entry Point:=C2=A0 00000000
> =C2=A0=C2=A0 Verifying Checksum ... OK
> ## Flattened Device Tree blob at 00800000
> =C2=A0=C2=A0 Booting using the fdt blob at 0x800000
> =C2=A0=C2=A0 Uncompressing Kernel Image ... OK
> =C2=A0=C2=A0 Loading Ramdisk to 1fca7000, end 1fe6ceb8 ... OK
> booting kernel using flat tree
> It then stops and never print any more,=C2=A0 I use mpc85xx_defconfig, I =
select
> mpc85xxds in the menuconfig and deselect other options like mpc8540ads et=
c.
>>
Try to change "link_address=3D'0x400000'" tp "link_address=3D'0x800000'"
in arch/powerpc/boot/wrapper.
If you have result, remember to give me a feedback.


>> > And I never boot linux-2.6.31 on my board, why linux-2.6.31 doesnot
>> > provide a config file like mpc8544_ds_defconfig?
>>
>> Does mpc85xx_defconfig not work?
>
> Yes mcp85xx_defconfig does not work, I can see mpc8540ads in the menuconf=
ig,
> but no mpc8544ds. And when I down load the generated uImage, It does not
> work.
>
>>
>> -Scott
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
The simplest is not all best but the best is surely the simplest!

^ permalink raw reply

* [PATCH 1/3] powerpc/fsl: 85xx: document cache sram bindings
From: Vivek Mahajan @ 2009-12-08  7:31 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: kumar.gala, Vivek Mahajan

Adds binding documentation for cache sram for the PQ3 and
some QorIQ based platforms.

Signed-off-by: Vivek Mahajan <vivek.mahajan@freescale.com>
---
 .../powerpc/dts-bindings/fsl/85xx_cache_sram.txt   |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/powerpc/dts-bindings/fsl/85xx_cache_sram.txt

diff --git a/Documentation/powerpc/dts-bindings/fsl/85xx_cache_sram.txt b/Documentation/powerpc/dts-bindings/fsl/85xx_cache_sram.txt
new file mode 100644
index 0000000..781955f
--- /dev/null
+++ b/Documentation/powerpc/dts-bindings/fsl/85xx_cache_sram.txt
@@ -0,0 +1,20 @@
+* Freescale PQ3 and QorIQ based Cache SRAM
+
+Freescale's mpc85xx and some QorIQ platforms provide an
+option of configuring a part of (or full) cache memory
+as SRAM. This cache SRAM representation in the device
+tree should be done as under:-
+
+Required properties:
+
+- compatible : should be "fsl,p2020-cache-sram"
+- fsl,cache-sram-ctlr-handle : points to the L2 controller
+- reg : offset and length of the cache-sram.
+
+Example:
+
+cache-sram@fff00000 {
+	fsl,cache-sram-ctlr-handle = <&L2>;
+	reg = <0 0xfff00000 0 0x10000>;
+	compatible = "fsl,p2020-cache-sram";
+};
-- 
1.5.6.5

^ permalink raw reply related

* [PATCH 2/3] powerpc/fsl: 85xx: p2020rdb: add cache sram node
From: Vivek Mahajan @ 2009-12-08  7:31 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: kumar.gala, Vivek Mahajan
In-Reply-To: <1260257477-21942-1-git-send-email-vivek.mahajan@freescale.com>

Signed-off-by: Vivek Mahajan <vivek.mahajan@freescale.com>
---
 arch/powerpc/boot/dts/p2020rdb.dts |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/p2020rdb.dts b/arch/powerpc/boot/dts/p2020rdb.dts
index da4cb0d..8a26050 100644
--- a/arch/powerpc/boot/dts/p2020rdb.dts
+++ b/arch/powerpc/boot/dts/p2020rdb.dts
@@ -583,4 +583,10 @@
 				  0x0 0x100000>;
 		};
 	};
+
+	cache-sram@fff00000 {
+		fsl,cache-sram-ctlr-handle = <&L2>;
+		reg = <0 0xfff00000 0 0x10000>;
+		compatible = "fsl,p2020-cache-sram";
+	};
 };
-- 
1.5.6.5

^ permalink raw reply related

* [PATCH 3/3] powerpc/fsl: 85xx: add cache-sram support
From: Vivek Mahajan @ 2009-12-08  7:31 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: kumar.gala, Vivek Mahajan
In-Reply-To: <1260257477-21942-2-git-send-email-vivek.mahajan@freescale.com>

It adds PQ3 and some QorIQ based cache-sram support as under:

* A small abstraction over powerpc's remote heap allocator
* Exports mpc85xx_cache_sram_alloc()/free() APIs
* Supports only one contiguous SRAM window
* Drivers can do the following in Kconfig to use these APIs
    "select FSL_85XX_CACHE_SRAM if FSL_SOC_BOOKE"

Signed-off-by: Vivek Mahajan <vivek.mahajan@freescale.com>
---
 arch/powerpc/include/asm/fsl_85xx_cache_sram.h |   48 ++++
 arch/powerpc/platforms/85xx/Kconfig            |    4 +
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c      |    3 +
 arch/powerpc/sysdev/Makefile                   |    1 +
 arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h      |   95 ++++++++
 arch/powerpc/sysdev/fsl_85xx_cache_sram.c      |  298 ++++++++++++++++++++++++
 6 files changed, 449 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/include/asm/fsl_85xx_cache_sram.h
 create mode 100644 arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h
 create mode 100644 arch/powerpc/sysdev/fsl_85xx_cache_sram.c

diff --git a/arch/powerpc/include/asm/fsl_85xx_cache_sram.h b/arch/powerpc/include/asm/fsl_85xx_cache_sram.h
new file mode 100644
index 0000000..d39e266
--- /dev/null
+++ b/arch/powerpc/include/asm/fsl_85xx_cache_sram.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
+ *
+ * Cache SRAM handling for PQ3 and some QorIQ platforms
+ *
+ * Author: Vivek Mahajan <vivek.mahajan@freescale.com>
+
+ * This file is derived from the original work done
+ * by Sylvain Munaut for the Bestcomm SRAM allocator.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __ASM_POWERPC_FSL_85XX_CACHE_SRAM_H__
+#define __ASM_POWERPC_FSL_85XX_CACHE_SRAM_H__
+
+#include <asm/rheap.h>
+#include <linux/spinlock.h>
+
+/*
+ * Cache-SRAM
+ */
+
+struct mpc85xx_cache_sram {
+	phys_addr_t base_phys;
+	void *base_virt;
+	unsigned int size;
+	rh_info_t *rh;
+	spinlock_t lock;
+};
+
+extern void mpc85xx_cache_sram_free(void *ptr);
+extern void *mpc85xx_cache_sram_alloc(unsigned int size,
+				  phys_addr_t *phys, unsigned int align);
+
+#endif /* __AMS_POWERPC_FSL_85XX_CACHE_SRAM_H__ */
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index d951218..74df154 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -157,6 +157,10 @@ config P4080_DS
 	help
 	  This option enables support for the P4080 DS board
 
+config FSL_85XX_CACHE_SRAM
+	bool
+	select PPC_LIB_RHEAP
+
 endif # FSL_SOC_BOOKE
 
 config TQM85xx
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index 088f30b..070b54b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -113,6 +113,9 @@ static struct of_device_id __initdata mpc85xxrdb_ids[] = {
 	{ .compatible = "soc", },
 	{ .compatible = "simple-bus", },
 	{ .compatible = "gianfar", },
+#if defined(CONFIG_FSL_85XX_CACHE_SRAM)
+	{ .compatible = "fsl,p2020-cache-sram", },
+#endif
 	{},
 };
 
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 5642924..4dc7e1d 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_FSL_PMC)		+= fsl_pmc.o
 obj-$(CONFIG_FSL_LBC)		+= fsl_lbc.o
 obj-$(CONFIG_FSL_GTM)		+= fsl_gtm.o
 obj-$(CONFIG_MPC8xxx_GPIO)	+= mpc8xxx_gpio.o
+obj-$(CONFIG_FSL_85XX_CACHE_SRAM)       += fsl_85xx_cache_sram.o
 obj-$(CONFIG_SIMPLE_GPIO)	+= simple_gpio.o
 obj-$(CONFIG_RAPIDIO)		+= fsl_rio.o
 obj-$(CONFIG_TSI108_BRIDGE)	+= tsi108_pci.o tsi108_dev.o
diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h b/arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h
new file mode 100644
index 0000000..3f51c1b
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2009 Freescale Semiconductor, Inc
+ *
+ * PQ3 or some QorIQ based Cache Controller Memory Mapped Registers
+ *
+ * Author: Vivek Mahajan <vivek.mahajan@freescale.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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __FSL_85XX_CACHE_CTLR_H__
+#define __FSL_85XX_CACHE_CTLR_H__
+
+#define L2CR_L2FI		0x40000000	/* L2 flash invalidate */
+#define L2CR_L2IO		0x00200000	/* L2 instruction only */
+#define L2CR_SRAM_ZERO		0x00000000	/* L2SRAM zero size */
+#define L2CR_SRAM_FULL		0x00010000	/* L2SRAM full size */
+#define L2CR_SRAM_HALF		0x00020000	/* L2SRAM half size */
+#define L2CR_SRAM_TWO_HALFS	0x00030000	/* L2SRAM two half sizes */
+#define L2CR_SRAM_QUART		0x00040000	/* L2SRAM one quarter size */
+#define L2CR_SRAM_TWO_QUARTS	0x00050000	/* L2SRAM two quarter size */
+#define L2CR_SRAM_EIGHTH	0x00060000	/* L2SRAM one eighth size */
+#define L2CR_SRAM_TWO_EIGHTH	0x00070000	/* L2SRAM two eighth size */
+
+#define L2SRAM_OPTIMAL_SZ_SHIFT	0x00000003	/* Optimum size for L2SRAM */
+
+#define L2SRAM_BAR_MSK_LO18	0xFFFFC000	/* Lower 18 bits */
+#define L2SRAM_BARE_MSK_HI4	0x0000000F	/* Upper 4 bits */
+
+enum cache_sram_lock_ways {
+	LOCK_WAYS_ZERO,
+	LOCK_WAYS_EIGHTH,
+	LOCK_WAYS_TWO_EIGHTH,
+	LOCK_WAYS_HALF = 4,
+	LOCK_WAYS_FULL = 8,
+};
+
+struct mpc85xx_l2ctlr {
+	u32	ctl;		/* 0x000 - L2 control */
+	u8	res1[0xC];
+	u32	ewar0;		/* 0x010 - External write address 0 */
+	u32	ewarea0;	/* 0x014 - External write address extended 0 */
+	u32	ewcr0;		/* 0x018 - External write ctrl */
+	u8	res2[4];
+	u32	ewar1;		/* 0x020 - External write address 1 */
+	u32	ewarea1;	/* 0x024 - External write address extended 1 */
+	u32	ewcr1;		/* 0x028 - External write ctrl 1 */
+	u8	res3[4];
+	u32	ewar2;		/* 0x030 - External write address 2 */
+	u32	ewarea2;	/* 0x034 - External write address extended 2 */
+	u32	ewcr2;		/* 0x038 - External write ctrl 2 */
+	u8	res4[4];
+	u32	ewar3;		/* 0x040 - External write address 3 */
+	u32	ewarea3;	/* 0x044 - External write address extended 3 */
+	u32	ewcr3;		/* 0x048 - External write ctrl 3 */
+	u8	res5[0xB4];
+	u32	srbar0;		/* 0x100 - SRAM base address 0 */
+	u32	srbarea0;	/* 0x104 - SRAM base addr reg ext address 0 */
+	u32	srbar1;		/* 0x108 - SRAM base address 1 */
+	u32	srbarea1;	/* 0x10C - SRAM base addr reg ext address 1 */
+	u8	res6[0xCF0];
+	u32	errinjhi;	/* 0xE00 - Error injection mask high */
+	u32	errinjlo;	/* 0xE04 - Error injection mask low */
+	u32	errinjctl;	/* 0xE08 - Error injection tag/ecc control */
+	u8	res7[0x14];
+	u32	captdatahi;	/* 0xE20 - Error data high capture */
+	u32	captdatalo;	/* 0xE24 - Error data low capture */
+	u32	captecc;	/* 0xE28 - Error syndrome */
+	u8	res8[0x14];
+	u32	errdet;		/* 0xE40 - Error detect */
+	u32	errdis;		/* 0xE44 - Error disable */
+	u32	errinten;	/* 0xE48 - Error interrupt enable */
+	u32	errattr;	/* 0xE4c - Error attribute capture */
+	u32	erradrrl;	/* 0xE50 - Error address capture low */
+	u32	erradrrh;	/* 0xE54 - Error address capture high */
+	u32	errctl;		/* 0xE58 - Error control */
+	u8	res9[0x1A4];
+};
+
+extern int instantiate_cache_sram(struct of_device *dev, unsigned int size);
+extern void remove_cache_sram(struct of_device *dev);
+
+#endif /* __FSL_85XX_CACHE_CTLR_H__ */
diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
new file mode 100644
index 0000000..5aaacf6
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -0,0 +1,298 @@
+/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
+ *
+ * Simple memory allocator abstraction for PQ3 and
+ * some QorIQ based Cache-SRAM
+ *
+ * Author: Vivek Mahajan <vivek.mahajan@freescale.com>
+ *
+ * This file is derived from the original work done
+ * by Sylvain Munaut for the Bestcomm SRAM allocator.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+#include <asm/pgtable.h>
+#include <asm/fsl_85xx_cache_sram.h>
+
+#include "fsl_85xx_cache_ctlr.h"
+
+struct mpc85xx_cache_sram *cache_sram;
+
+void *mpc85xx_cache_sram_alloc(unsigned int size,
+			   phys_addr_t *phys, unsigned int align)
+{
+	unsigned long offset;
+	unsigned long flags;
+
+	if (!size || (size > cache_sram->size) || (align > cache_sram->size)) {
+		pr_err("%s(): size(=%x) or align(=%x) zero or too big\n",
+			__func__, size, align);
+		return NULL;
+	}
+
+	if ((align &  (align - 1)) || align <= 1) {
+		pr_err("%s(): align(=%x) must be power of two and >1\n",
+			__func__, align);
+		return NULL;
+	}
+
+	spin_lock_irqsave(&cache_sram->lock, flags);
+	offset = rh_alloc_align(cache_sram->rh, size, align, NULL);
+	spin_unlock_irqrestore(&cache_sram->lock, flags);
+
+	if (IS_ERR_VALUE(offset))
+		return NULL;
+
+	*phys = cache_sram->base_phys + offset;
+
+	return (unsigned char *)cache_sram->base_virt + offset;
+}
+EXPORT_SYMBOL(mpc85xx_cache_sram_alloc);
+
+void mpc85xx_cache_sram_free(void *ptr)
+{
+	unsigned long flags;
+	BUG_ON(!ptr);
+
+	spin_lock_irqsave(&cache_sram->lock, flags);
+	rh_free(cache_sram->rh, ptr - cache_sram->base_virt);
+	spin_unlock_irqrestore(&cache_sram->lock, flags);
+}
+EXPORT_SYMBOL(mpc85xx_cache_sram_free);
+
+static int l2ctlr_init(struct of_device *dev, phys_addr_t *sram_start,
+						unsigned long *sram_size)
+{
+	long rval;
+	unsigned int rem;
+	unsigned char ways;
+	const phandle *ph;
+	const unsigned int *prop;
+	unsigned int l2cache_size;
+	struct device_node *np;
+	struct resource sram_rsrc;
+	struct mpc85xx_l2ctlr __iomem *l2ctlr;
+
+	ph = of_get_property(dev->node, "fsl,cache-sram-ctlr-handle", NULL);
+	if (!ph) {
+		dev_err(&dev->dev, "Missing cache-ctlr-handle\n");
+		return -EINVAL;
+	}
+
+	np = of_find_node_by_phandle(*ph);
+	if (!np) {
+		dev_err(&dev->dev, "Missing L2 controller node\n");
+		return -EINVAL;
+	}
+
+	prop = of_get_property(np, "cache-size", NULL);
+	if (!prop) {
+		dev_err(&dev->dev, "Missing L2 cache-size\n");
+		of_node_put(np);
+		return -EINVAL;
+	}
+	l2cache_size = *prop;
+
+	if (of_address_to_resource(dev->node, 0, &sram_rsrc)) {
+		dev_err(&dev->dev, "Can't read cache sram window\n");
+		of_node_put(np);
+		return -EFAULT;
+	}
+
+	*sram_start = sram_rsrc.start;
+	rval = (unsigned long)(sram_rsrc.end - sram_rsrc.start) + 1;
+	if (rval <= 0) {
+		dev_err(&dev->dev,
+			"Entire L2 as cache, Aborting cache sram stuff\n");
+		of_node_put(np);
+		return -EINVAL;
+	}
+
+	rem = l2cache_size % (unsigned int)rval;
+	ways = LOCK_WAYS_FULL * (unsigned int)rval / l2cache_size;
+	if (rem || (ways & (ways - 1))) {
+		dev_err(&dev->dev, "Illegal cache-size in the node\n");
+		of_node_put(np);
+		return -EINVAL;
+	}
+
+	*sram_size = (unsigned long)rval;
+
+	l2ctlr = of_iomap(np, 0);
+	of_node_put(np);
+	if (!l2ctlr) {
+		dev_err(&dev->dev, "Can't map L2 controller\n");
+		return -EINVAL;
+	}
+
+	/*
+	 * Write bits[0-17] to srbar0
+	 */
+	out_be32(&l2ctlr->srbar0,
+		(unsigned long)(*sram_start) & L2SRAM_BAR_MSK_LO18);
+
+	/*
+	 * Write bits[18-21] to srbare0
+	 */
+	out_be32(&l2ctlr->srbarea0,
+		(((unsigned long)(*sram_start)) >> 10) & L2SRAM_BARE_MSK_HI4);
+
+	clrsetbits_be32(&l2ctlr->ctl, L2CR_L2E, L2CR_L2FI);
+
+	switch (ways) {
+	case LOCK_WAYS_EIGHTH:
+		setbits32(&l2ctlr->ctl,
+			L2CR_L2E | L2CR_L2FI | L2CR_SRAM_EIGHTH);
+		break;
+
+	case LOCK_WAYS_TWO_EIGHTH:
+		setbits32(&l2ctlr->ctl,
+			L2CR_L2E | L2CR_L2FI | L2CR_SRAM_QUART);
+		break;
+
+	case LOCK_WAYS_HALF:
+		setbits32(&l2ctlr->ctl,
+			L2CR_L2E | L2CR_L2FI | L2CR_SRAM_HALF);
+		break;
+
+	case LOCK_WAYS_FULL:
+	default:
+		setbits32(&l2ctlr->ctl,
+			L2CR_L2E | L2CR_L2FI | L2CR_SRAM_FULL);
+		break;
+	}
+	eieio();
+
+	iounmap(l2ctlr);
+	return 0;
+}
+
+static int __devinit mpc85xx_cache_sram_of_probe(struct of_device *dev,
+					  const struct of_device_id *match)
+{
+	phys_addr_t sram_start;
+	unsigned long sram_size;
+
+	if (cache_sram) {
+		dev_err(&dev->dev, "Already initialized cache-sram\n");
+		return -EBUSY;
+	}
+
+	if (!dev->node) {
+		dev_err(&dev->dev, "Device's OF-node is NULL\n");
+		return -EINVAL;
+	}
+
+	if (l2ctlr_init(dev, &sram_start, &sram_size) < 0) {
+		dev_err(&dev->dev, "l2ctlr_init() fails\n");
+		return -EINVAL;
+	}
+
+	cache_sram = kzalloc(sizeof(struct mpc85xx_cache_sram), GFP_KERNEL);
+	if (!cache_sram) {
+		dev_err(&dev->dev, "Out of memory for cache_sram structure\n");
+		return -ENOMEM;
+	}
+
+	cache_sram->base_phys = sram_start;
+	cache_sram->size = sram_size;
+
+	if (!request_mem_region(cache_sram->base_phys, cache_sram->size,
+						"fsl_85xx_cache_sram")) {
+		dev_err(&dev->dev, "%s: request memory failed\n",
+				dev->node->full_name);
+		kfree(cache_sram);
+		return -ENXIO;
+	}
+
+	cache_sram->base_virt = ioremap_flags(cache_sram->base_phys,
+				cache_sram->size, _PAGE_COHERENT | PAGE_KERNEL);
+	if (!cache_sram->base_virt) {
+		dev_err(&dev->dev, "%s: ioremap_flags failed\n",
+				dev->node->full_name);
+		release_mem_region(cache_sram->base_phys, cache_sram->size);
+		kfree(cache_sram);
+		return -ENOMEM;
+	}
+
+	cache_sram->rh = rh_create(sizeof(unsigned int));
+	if (IS_ERR(cache_sram->rh)) {
+		dev_err(&dev->dev, "%s: Unable to create remote heap\n",
+				dev->node->full_name);
+		iounmap(cache_sram->base_virt);
+		release_mem_region(cache_sram->base_phys, cache_sram->size);
+		kfree(cache_sram);
+		return PTR_ERR(cache_sram->rh);
+	}
+
+	rh_attach_region(cache_sram->rh, 0, cache_sram->size);
+	spin_lock_init(&cache_sram->lock);
+
+	dev_info(&dev->dev, "[base:0x%x, size:0x%x] configured and loaded\n",
+		cache_sram->base_phys, cache_sram->size);
+	return 0;
+}
+
+static int __devexit mpc85xx_cache_sram_remove(struct of_device *dev)
+{
+	BUG_ON(!cache_sram);
+
+	rh_detach_region(cache_sram->rh, 0, cache_sram->size);
+	rh_destroy(cache_sram->rh);
+
+	iounmap(cache_sram->base_virt);
+	release_mem_region(cache_sram->base_phys, cache_sram->size);
+
+	kfree(cache_sram);
+	cache_sram = NULL;
+
+	dev_info(&dev->dev, "MPC85xx cache SRAM driver unloaded\n");
+	return 0;
+}
+
+static struct of_device_id mpc85xx_cache_sram_of_match[] = {
+	{
+		.compatible = "fsl,p2020-cache-sram",
+	},
+	{},
+};
+
+MODULE_DEVICE_TABLE(of, mpc85xx_cache_sram_of_match);
+
+static struct of_platform_driver mpc85xx_cache_sram_driver = {
+	.name		= "fsl-85xx-cache-sram",
+	.match_table	= mpc85xx_cache_sram_of_match,
+	.probe		= mpc85xx_cache_sram_of_probe,
+	.remove		= __devexit_p(mpc85xx_cache_sram_remove),
+};
+
+static int __init mpc85xx_cache_sram_init(void)
+{
+	return of_register_platform_driver(&mpc85xx_cache_sram_driver);
+}
+
+static void __exit mpc85xx_cache_sram_exit(void)
+{
+	of_unregister_platform_driver(&mpc85xx_cache_sram_driver);
+}
+
+subsys_initcall(mpc85xx_cache_sram_init);
+module_exit(mpc85xx_cache_sram_exit);
+
+MODULE_DESCRIPTION("Freescale MPC85xx cache SRAM driver");
+MODULE_LICENSE("GPL v2");
-- 
1.5.6.5

^ permalink raw reply related

* Re: [PATCH 00/10 v6]  Fix 8xx MMU/TLB
From: Joakim Tjernlund @ 2009-12-08  8:38 UTC (permalink / raw)
  To: Scott Wood; +Cc: Rex Feany, linuxppc-dev@ozlabs.org
In-Reply-To: <4B14465A.3080804@freescale.com>

Scott Wood <scottwood@freescale.com> wrote on 30/11/2009 23:25:30:
>
> Benjamin Herrenschmidt wrote:
> > On Fri, 2009-11-27 at 11:57 +0100, Joakim Tjernlund wrote:
> >> Scott and Rex, I think we need you s-o-b to make it into the kernel proper.
> >>
> >> Marcelo and Vitaly, I noticed you guys are listed as 8xx maintainers.
> >> Have you seen this? What do you think?
> >
> > I think Marcelo isn't much involved with 8xx anymore. I'd say if Scott
> > and Vitaly are ok, then the patches are good. But I'll wait for at least
> > Scott to give an Ack as he can at least test which I can't :-)
>
> ACK

Can't see these patches in next yet, did they go somewhere else?

^ permalink raw reply

* Re: [PATCH 1/5] powerpc: Move VMX and VSX asm code to vector.S
From: Wolfgang Denk @ 2009-12-08  8:53 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20090603071751.AF006DDDF7@ozlabs.org>

Dear Benjamin Herrenschmidt,

In message <20090603071751.AF006DDDF7@ozlabs.org> you wrote:
> Currently, load_up_altivec and give_up_altivec are duplicated
> in 32-bit and 64-bit. This creates a common implementation that
> is moved away from head_32.S, head_64.S and misc_64.S and into
> vector.S, using the same macros we already use for our common
> implementation of load_up_fpu.
> 
> I also moved the VSX code over to vector.S though in that case
> I didn't make it build on 32-bit (yet).

It seems this commit broke ALTIVEC-enablked 32 bit systems. For
example, when trying to build 86xx/mpc8641_hpcn_defconfig I get:

arch/powerpc/kernel/vector.S: Assembler messages:
arch/powerpc/kernel/vector.S:61: Error: Unrecognized opcode: `cmpdi'
make[1]: *** [arch/powerpc/kernel/vector.o] Error 1

Segher suggests to s/cmpdi/cmplwi/ which indeed seems to work (atleast
it allows me to build the kernel image).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Wherever you go...There you are.                    - Buckaroo Banzai

^ permalink raw reply

* [PATCH] PowerPC: const intspec pointers
From: Roman Fietze @ 2009-12-08 12:39 UTC (permalink / raw)
  To: linuxppc-dev

Hello,

Writing a driver using SCLPC on the MPC5200B I detected, that the
intspec arrays to map irqs to Linux virq cannot be const, because the
mapping and xlate functions only take non const pointers. All those
functions do not modify the intspec, so a const pointer could be used.

I tried to compile that patch on different platforms and got no
compiler errors, so I'd like to ask you to review that patch, and
check if it's worth using it.


Signed-off-by: Roman Fietze <roman.fietze@telemotive.de>
=2D--
 arch/powerpc/include/asm/irq.h                  |    4 ++--
 arch/powerpc/kernel/irq.c                       |    2 +-
 arch/powerpc/platforms/52xx/media5200.c         |    2 +-
 arch/powerpc/platforms/52xx/mpc52xx_gpt.c       |    2 +-
 arch/powerpc/platforms/52xx/mpc52xx_pic.c       |    2 +-
 arch/powerpc/platforms/85xx/socrates_fpga_pic.c |    2 +-
 arch/powerpc/platforms/86xx/gef_pic.c           |    2 +-
 arch/powerpc/platforms/cell/beat_interrupt.c    |    4 ++--
 arch/powerpc/platforms/cell/interrupt.c         |    2 +-
 arch/powerpc/platforms/cell/spider-pic.c        |    2 +-
 arch/powerpc/platforms/powermac/pic.c           |    2 +-
 arch/powerpc/platforms/pseries/xics.c           |    2 +-
 arch/powerpc/sysdev/cpm2_pic.c                  |    2 +-
 arch/powerpc/sysdev/i8259.c                     |    2 +-
 arch/powerpc/sysdev/ipic.c                      |    2 +-
 arch/powerpc/sysdev/mpc8xx_pic.c                |    2 +-
 arch/powerpc/sysdev/mpic.c                      |    2 +-
 arch/powerpc/sysdev/qe_lib/qe_ic.c              |    2 +-
 arch/powerpc/sysdev/tsi108_pci.c                |    2 +-
 arch/powerpc/sysdev/uic.c                       |    2 +-
 arch/powerpc/sysdev/xilinx_intc.c               |    2 +-
 21 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index bbcd1aa..a0bcafc 100644
=2D-- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -99,7 +99,7 @@ struct irq_host_ops {
 	 * interrupt controller has for that line)
 	 */
 	int (*xlate)(struct irq_host *h, struct device_node *ctrler,
=2D		     u32 *intspec, unsigned int intsize,
+		     const u32 *intspec, unsigned int intsize,
 		     irq_hw_number_t *out_hwirq, unsigned int *out_type);
 };
=20
@@ -313,7 +313,7 @@ extern void irq_free_virt(unsigned int virq, unsigned i=
nt=20
count);
  * of the of_irq_map_*() functions.
  */
 extern unsigned int irq_create_of_mapping(struct device_node *controller,
=2D					  u32 *intspec, unsigned int intsize);
+					  const u32 *intspec, unsigned int intsize);
=20
 /**
  * irq_of_parse_and_map - Parse and Map an interrupt into linux virq space
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index e5d1211..6e294e0 100644
=2D-- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -699,7 +699,7 @@ unsigned int irq_create_mapping(struct irq_host *host,
 EXPORT_SYMBOL_GPL(irq_create_mapping);
=20
 unsigned int irq_create_of_mapping(struct device_node *controller,
=2D				   u32 *intspec, unsigned int intsize)
+				   const u32 *intspec, unsigned int intsize)
 {
 	struct irq_host *host;
 	irq_hw_number_t hwirq;
diff --git a/arch/powerpc/platforms/52xx/media5200.c=20
b/arch/powerpc/platforms/52xx/media5200.c
index 68e4f16..b1ec9bb 100644
=2D-- a/arch/powerpc/platforms/52xx/media5200.c
+++ b/arch/powerpc/platforms/52xx/media5200.c
@@ -127,7 +127,7 @@ static int media5200_irq_map(struct irq_host *h, unsign=
ed=20
int virq,
 }
=20
 static int media5200_irq_xlate(struct irq_host *h, struct device_node *ct,
=2D				 u32 *intspec, unsigned int intsize,
+				 const u32 *intspec, unsigned int intsize,
 				 irq_hw_number_t *out_hwirq,
 				 unsigned int *out_flags)
 {
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c=20
b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index bfbcd41..78f0ab6 100644
=2D-- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -182,7 +182,7 @@ static int mpc52xx_gpt_irq_map(struct irq_host *h,=20
unsigned int virq,
 }
=20
 static int mpc52xx_gpt_irq_xlate(struct irq_host *h, struct device_node *c=
t,
=2D				 u32 *intspec, unsigned int intsize,
+				 const u32 *intspec, unsigned int intsize,
 				 irq_hw_number_t *out_hwirq,
 				 unsigned int *out_flags)
 {
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c=20
b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 480f806..53d44f6 100644
=2D-- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -355,7 +355,7 @@ static int mpc52xx_is_extirq(int l1, int l2)
  * mpc52xx_irqhost_xlate - translate virq# from device tree interrupts=20
property
  */
 static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *c=
t,
=2D				 u32 *intspec, unsigned int intsize,
+				 const u32 *intspec, unsigned int intsize,
 				 irq_hw_number_t *out_hwirq,
 				 unsigned int *out_flags)
 {
diff --git a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c=20
b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
index 60edf63..380858a 100644
=2D-- a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
+++ b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
@@ -253,7 +253,7 @@ static int socrates_fpga_pic_host_map(struct irq_host *=
h,=20
unsigned int virq,
 }
=20
 static int socrates_fpga_pic_host_xlate(struct irq_host *h,
=2D		struct device_node *ct,	u32 *intspec, unsigned int intsize,
+		struct device_node *ct,	const u32 *intspec, unsigned int intsize,
 		irq_hw_number_t *out_hwirq, unsigned int *out_flags)
 {
 	struct socrates_fpga_irq_info *fpga_irq =3D &fpga_irqs[intspec[0]];
diff --git a/arch/powerpc/platforms/86xx/gef_pic.c=20
b/arch/powerpc/platforms/86xx/gef_pic.c
index 50d0a2b..8d4479f 100644
=2D-- a/arch/powerpc/platforms/86xx/gef_pic.c
+++ b/arch/powerpc/platforms/86xx/gef_pic.c
@@ -170,7 +170,7 @@ static int gef_pic_host_map(struct irq_host *h, unsigne=
d=20
int virq,
 }
=20
 static int gef_pic_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			    u32 *intspec, unsigned int intsize,
+			    const u32 *intspec, unsigned int intsize,
 			    irq_hw_number_t *out_hwirq, unsigned int *out_flags)
 {
=20
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c=20
b/arch/powerpc/platforms/cell/beat_interrupt.c
index 7225484..1f2fd65 100644
=2D-- a/arch/powerpc/platforms/cell/beat_interrupt.c
+++ b/arch/powerpc/platforms/cell/beat_interrupt.c
@@ -166,11 +166,11 @@ static void beatic_pic_host_remap(struct irq_host *h,=
=20
unsigned int virq,
  * Note: We have only 1 entry to translate.
  */
 static int beatic_pic_host_xlate(struct irq_host *h, struct device_node *c=
t,
=2D				 u32 *intspec, unsigned int intsize,
+				 const u32 *intspec, unsigned int intsize,
 				 irq_hw_number_t *out_hwirq,
 				 unsigned int *out_flags)
 {
=2D	u64 *intspec2 =3D (u64 *)intspec;
+	const u64 *intspec2 =3D (const u64 *)intspec;
=20
 	*out_hwirq =3D *intspec2;
 	*out_flags |=3D IRQ_TYPE_LEVEL_LOW;
diff --git a/arch/powerpc/platforms/cell/interrupt.c=20
b/arch/powerpc/platforms/cell/interrupt.c
index 882e470..d9d33cb 100644
=2D-- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -297,7 +297,7 @@ static int iic_host_map(struct irq_host *h, unsigned in=
t=20
virq,
 }
=20
 static int iic_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			   u32 *intspec, unsigned int intsize,
+			   const u32 *intspec, unsigned int intsize,
 			   irq_hw_number_t *out_hwirq, unsigned int *out_flags)
=20
 {
diff --git a/arch/powerpc/platforms/cell/spider-pic.c=20
b/arch/powerpc/platforms/cell/spider-pic.c
index 4e56556..37c2e4e 100644
=2D-- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -187,7 +187,7 @@ static int spider_host_map(struct irq_host *h, unsigned=
=20
int virq,
 }
=20
 static int spider_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			   u32 *intspec, unsigned int intsize,
+			   const u32 *intspec, unsigned int intsize,
 			   irq_hw_number_t *out_hwirq, unsigned int *out_flags)
=20
 {
diff --git a/arch/powerpc/platforms/powermac/pic.c=20
b/arch/powerpc/platforms/powermac/pic.c
index d212006..da6b4b9 100644
=2D-- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -303,7 +303,7 @@ static int pmac_pic_host_map(struct irq_host *h, unsign=
ed=20
int virq,
 }
=20
 static int pmac_pic_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			       u32 *intspec, unsigned int intsize,
+			       const u32 *intspec, unsigned int intsize,
 			       irq_hw_number_t *out_hwirq,
 			       unsigned int *out_flags)
=20
diff --git a/arch/powerpc/platforms/pseries/xics.c=20
b/arch/powerpc/platforms/pseries/xics.c
index b9bf0ee..1821eae 100644
=2D-- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -434,7 +434,7 @@ static int xics_host_map(struct irq_host *h, unsigned i=
nt=20
virq,
 }
=20
 static int xics_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			   u32 *intspec, unsigned int intsize,
+			   const u32 *intspec, unsigned int intsize,
 			   irq_hw_number_t *out_hwirq, unsigned int *out_flags)
=20
 {
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index 78f1f7c..3d2be56 100644
=2D-- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -216,7 +216,7 @@ static int cpm2_pic_host_map(struct irq_host *h, unsign=
ed=20
int virq,
 }
=20
 static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			    u32 *intspec, unsigned int intsize,
+			    const u32 *intspec, unsigned int intsize,
 			    irq_hw_number_t *out_hwirq, unsigned int *out_flags)
 {
 	*out_hwirq =3D intspec[0];
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index a96584a..ccc9a3b 100644
=2D-- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -198,7 +198,7 @@ static void i8259_host_unmap(struct irq_host *h, unsign=
ed=20
int virq)
 }
=20
 static int i8259_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			    u32 *intspec, unsigned int intsize,
+			    const u32 *intspec, unsigned int intsize,
 			    irq_hw_number_t *out_hwirq, unsigned int *out_flags)
 {
 	static unsigned char map_isa_senses[4] =3D {
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index cb7689c..27259f4 100644
=2D-- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -697,7 +697,7 @@ static int ipic_host_map(struct irq_host *h, unsigned i=
nt=20
virq,
 }
=20
 static int ipic_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			   u32 *intspec, unsigned int intsize,
+			   const u32 *intspec, unsigned int intsize,
 			   irq_hw_number_t *out_hwirq, unsigned int *out_flags)
=20
 {
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c=20
b/arch/powerpc/sysdev/mpc8xx_pic.c
index 5d2d552..72544a1 100644
=2D-- a/arch/powerpc/sysdev/mpc8xx_pic.c
+++ b/arch/powerpc/sysdev/mpc8xx_pic.c
@@ -130,7 +130,7 @@ static int mpc8xx_pic_host_map(struct irq_host *h,=20
unsigned int virq,
=20
=20
 static int mpc8xx_pic_host_xlate(struct irq_host *h, struct device_node *c=
t,
=2D			    u32 *intspec, unsigned int intsize,
+			    const u32 *intspec, unsigned int intsize,
 			    irq_hw_number_t *out_hwirq, unsigned int *out_flags)
 {
 	static unsigned char map_pic_senses[4] =3D {
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 30c44e6..1452a4e 100644
=2D-- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -994,7 +994,7 @@ static int mpic_host_map(struct irq_host *h, unsigned i=
nt=20
virq,
 }
=20
 static int mpic_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			   u32 *intspec, unsigned int intsize,
+			   const u32 *intspec, unsigned int intsize,
 			   irq_hw_number_t *out_hwirq, unsigned int *out_flags)
=20
 {
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c=20
b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 3faa42e..8192f58 100644
=2D-- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -271,7 +271,7 @@ static int qe_ic_host_map(struct irq_host *h, unsigned =
int=20
virq,
 }
=20
 static int qe_ic_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			    u32 * intspec, unsigned int intsize,
+			    const u32 * intspec, unsigned int intsize,
 			    irq_hw_number_t * out_hwirq,
 			    unsigned int *out_flags)
 {
diff --git a/arch/powerpc/sysdev/tsi108_pci.c=20
b/arch/powerpc/sysdev/tsi108_pci.c
index cf244a4..a23223d 100644
=2D-- a/arch/powerpc/sysdev/tsi108_pci.c
+++ b/arch/powerpc/sysdev/tsi108_pci.c
@@ -384,7 +384,7 @@ static struct irq_chip tsi108_pci_irq =3D {
 };
=20
 static int pci_irq_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			    u32 *intspec, unsigned int intsize,
+			    const u32 *intspec, unsigned int intsize,
 			    irq_hw_number_t *out_hwirq, unsigned int *out_flags)
 {
 	*out_hwirq =3D intspec[0];
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 466ce9a..1c315d8 100644
=2D-- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -202,7 +202,7 @@ static int uic_host_map(struct irq_host *h, unsigned in=
t=20
virq,
 }
=20
 static int uic_host_xlate(struct irq_host *h, struct device_node *ct,
=2D			  u32 *intspec, unsigned int intsize,
+			  const u32 *intspec, unsigned int intsize,
 			  irq_hw_number_t *out_hwirq, unsigned int *out_type)
=20
 {
diff --git a/arch/powerpc/sysdev/xilinx_intc.c=20
b/arch/powerpc/sysdev/xilinx_intc.c
index 40edad5..368db32 100644
=2D-- a/arch/powerpc/sysdev/xilinx_intc.c
+++ b/arch/powerpc/sysdev/xilinx_intc.c
@@ -148,7 +148,7 @@ static struct irq_chip xilinx_intc_edge_irqchip =3D {
  * xilinx_intc_xlate - translate virq# from device tree interrupts property
  */
 static int xilinx_intc_xlate(struct irq_host *h, struct device_node *ct,
=2D				u32 *intspec, unsigned int intsize,
+				const u32 *intspec, unsigned int intsize,
 				irq_hw_number_t *out_hwirq,
 				unsigned int *out_flags)
 {
=2D-=20
1.6.5.3


Thanks a lot for your help


Roman

=2D-=20
Roman Fietze                Telemotive AG B=FCro M=FChlhausen
Breitwiesen                              73347 M=FChlhausen
Tel.: +49(0)7335/18493-45        http://www.telemotive.de

^ permalink raw reply

* [PATCH] Re: ZILOG serial port broken in 2.6.32
From: Rob Landley @ 2009-12-08 12:42 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: paulus, linuxppc-dev
In-Reply-To: <1260148248.2076.1348.camel@pasglop>

On Sunday 06 December 2009 19:10:48 Benjamin Herrenschmidt wrote:
> On Sun, 2009-12-06 at 01:01 -0600, Rob Landley wrote:
> > Trying again with a few likely-looking cc's from the MAINTAINERS file:
> >
> > Summary:
> >
> > The PMACZILOG serial driver last worked in 2.6.28.  It was broken by
> > commit f751928e0ddf54ea4fe5546f35e99efc5b5d9938 by Alan Cox making bits
> > of the tty layer dynamically allocated.  The PMACZILOG driver wasn't
> > properly converted, it works with interrupts disabled (for boot
> > messages), but as soon as interrupts are enabled (PID 1 spawns) the next
> > write to the serial console panics the kernel.
>
> Ah looks like I missed that... I'll dig. Thanks for the report.
>
> Cheers,
> Ben.

Ok, here's the fix.  It's not the _right_ fix, but it Works For Me (tm) and I'll
leave it to you guys to figure out what this _means_:

Signed-off-by: Rob Landley <rob@landley.net>

diff -ru build/packages/linux/drivers/serial/serial_core.c build/packages/linux2/drivers/serial/serial_core.c
--- build/packages/linux/drivers/serial/serial_core.c	2009-12-02 21:51:21.000000000 -0600
+++ build/packages/linux2/drivers/serial/serial_core.c	2009-12-08 06:17:06.000000000 -0600
@@ -113,7 +113,7 @@
 static void uart_tasklet_action(unsigned long data)
 {
 	struct uart_state *state = (struct uart_state *)data;
-	tty_wakeup(state->port.tty);
+	if (state->port.tty) tty_wakeup(state->port.tty);
 }
 
 static inline void

That one line workaround makes the panic go away, and things seem to work fine from there.

I note that pmac_zilog.c function pmz_receiv_chars() has the following chunk:

        /* Sanity check, make sure the old bug is no longer happening */
        if (uap->port.state == NULL || uap->port.state->port.tty == NULL) {
                WARN_ON(1);
                (void)read_zsdata(uap);
                return NULL;
        }

Which doesn't catch this because it's the write code path (not the read code path) that's running into 
this.

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds

^ permalink raw reply

* DTS parsing and kernel bus support query
From: vinayak.kale @ 2009-12-08 13:53 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

Hi

I have following queries about DTS parsing and kernel bus support. I would  
really appreciate any help.

I have a PowerPC 440 core based board. We are porting Linux kernel – 2.6.31.

1) For other PowerPC 4xx based boards, what we found is devices like  
UART/I2C/GPIO are connected through PLB->OPB buses. Accordingly we specify  
the node structure inside a dts file. Does kernel uses the actual path to  
locate a node eg /plb/opb/i2c? or it uses the compatible property to locate  
a node?

2)In case of our board, instead of OPB and EBC we have buses like AI and  
APB. So our DTS node struct for UART looks like /plb/ai/apb/serial. For  
this do we need to add any extra support in kernel in order to recognize  
the devices on AI and APB buses? Similar question for Flash device. It's on  
the path /plb/ai/flash.
I need to access UART/I2C/GPIO/Flash devices over AI and APB bus. PLB is  
connected to AI bus. AI is further connected to APB.

3) Do we need to add extra support for AI/APB bus in kernel?

Thanks,
Vinayak

[-- Attachment #2: Type: text/html, Size: 1116 bytes --]

^ permalink raw reply

* Re: using different format for hugetlbfs
From: Kumar Gala @ 2009-12-08 15:44 UTC (permalink / raw)
  To: David Gibson; +Cc: linux-ppc list
In-Reply-To: <20091208022855.GC15612@yookeroo>


On Dec 7, 2009, at 8:28 PM, David Gibson wrote:

> On Mon, Dec 07, 2009 at 12:04:37PM +1100, Benjamin Herrenschmidt  
> wrote:
>>
>>>
>>> Even than, does that preclude the format I suggested?  I'm assuming
>>> that pgd_t/pud_t/pmd_t are always a double word so the low order 4-
>>> bits should be 0 (on 64-bit),
>
> Double word alignment only gives us 3 low bits.
>
>> so using the lsb as the flag between
>>> hugetlb and normal pointer should still work.
>>
>> Might do, depends if David has enough bits ...  David ?
>
> Well, the flag can go at the bottom, but that will mean grabbing more
> bits at the bottom.  At the moment to cover all the page table sizes
> that are wanted on the various setups we have, I need 5 bits, this
> would push it to 6.  At present, I just force up the minimum alignment
> of any page directory (even if it's natural alignment is smaller) so
> as to make sure I have those bits.  That's pretty easy to adjust, but
> pushing it up too high will start wasting memory, of course.
>
> If we move to a variable sized encoding, as Ben and I have discussed
> on a couple of occasions, I think we could do this though.

I don't understand.  It seems like only the flag bit of normal pointer  
vs hugetlb is the only thing that we need to distinguish.  Once we've  
done that all the other bits are free to use as we see fit.  So the  
less significant bit can be used for that purpose and the size  
encoding, etc we are free to do what we want with.

Am I missing something?

- k

^ permalink raw reply

* RE: patch status
From: Tirumala Reddy Marri @ 2009-12-08 16:53 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev
In-Reply-To: <20091208025944.GM2937@zod.rchland.ibm.com>



>>A URL to it would be fine.  I still haven't managed to find it, but
perhaps
>>the 'ALL available documents/types listed' link on this page:

>>http://www.appliedmicro.com/MyAMCC/jsp/public/productDetail/product_de
tail.jsp?productID=3DPPC460SX

>>doesn't really mean all?

Looks like need a login to get the actual engineering manual. It is also
whipped with CD of evaluation board.


>>Just reply to the patch is fine.  No need to send a new one if there
are no
>>code changes.


There are no new changes. I will reply to the patch.

Thanks,
Marri

^ permalink raw reply

* Re: DTS parsing and kernel bus support query
From: Josh Boyer @ 2009-12-08 18:32 UTC (permalink / raw)
  To: vinayak.kale; +Cc: linuxppc-dev
In-Reply-To: <0016363b7ec8d1ffb8047a37e663@google.com>

On Tue, Dec 08, 2009 at 01:53:41PM +0000, vinayak.kale@gmail.com wrote:
> Hi
>
> I have following queries about DTS parsing and kernel bus support. I 
> would really appreciate any help.
>
> I have a PowerPC 440 core based board. We are porting Linux kernel – 2.6.31.
>
> 1) For other PowerPC 4xx based boards, what we found is devices like  
> UART/I2C/GPIO are connected through PLB->OPB buses. Accordingly we 
> specify the node structure inside a dts file. Does kernel uses the actual 
> path to locate a node eg /plb/opb/i2c? or it uses the compatible property 
> to locate a node?

It calls "of_platform_bus_probe" very early with a list of buses to walk to
create the of_platform devices.  Then the device drivers will use the
compatible properties to bind to the right of_platform devices.  If the bus
isn't walked, then those devices won't get created in the kernel.  See the
beginning portions of arch/powerpc/platforms/44x/ppc44x_simple.c.

> 2)In case of our board, instead of OPB and EBC we have buses like AI and  
> APB. So our DTS node struct for UART looks like /plb/ai/apb/serial. For  
> this do we need to add any extra support in kernel in order to recognize  
> the devices on AI and APB buses? Similar question for Flash device. It's 
> on the path /plb/ai/flash.

You would need to clearly have the AI and APB buses in the DTS file, and then
have them walked via of_platform_bus_probe.  If they are simple busses without
odd translations, it shouldn't be too hard to do.

> I need to access UART/I2C/GPIO/Flash devices over AI and APB bus. PLB is  
> connected to AI bus. AI is further connected to APB.
>
> 3) Do we need to add extra support for AI/APB bus in kernel?

Not sure.  I don't know how those busses operate.

josh

^ permalink raw reply

* [RFC PATCH v2 0/4] powerpc: wii: mem2 as ram support
From: Albert Herranz @ 2009-12-08 18:43 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

The following patches add a series of workarounds to allow the use of
the second 64MB RAM block (MEM2) as normal memory on the Nintendo Wii
video game console.
Without these workarounds that portion of memory can't be used as it
is non-contiguous to the first memory block, and this is currently
unsupported on the PowerPC architecture for 32-bit systems.

This series complement the "powerpc: nintendo wii support" series.

Albert Herranz (4):
  wii: bootwrapper: add fixup to calc useable mem2
  wii: use both mem1 and mem2 as ram
  powerpc: allow ioremap within reserved memory regions
  powerpc: wii: allow ioremap within the memory hole

 arch/powerpc/boot/wii.c                  |  118 +++++++++++++++++++++++++++++-
 arch/powerpc/mm/init_32.c                |    9 ++
 arch/powerpc/mm/mmu_decl.h               |   11 +++-
 arch/powerpc/mm/pgtable_32.c             |   36 ++++++++-
 arch/powerpc/mm/ppc_mmu_32.c             |    4 +-
 arch/powerpc/platforms/embedded6xx/wii.c |   66 +++++++++++++++++
 include/linux/lmb.h                      |    1 +
 lib/lmb.c                                |    7 ++-
 8 files changed, 240 insertions(+), 12 deletions(-)

^ permalink raw reply

* [RFC PATCH v2 1/4] wii: bootwrapper: add fixup to calc useable mem2
From: Albert Herranz @ 2009-12-08 18:43 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz
In-Reply-To: <1260297833-17625-1-git-send-email-albert_herranz@yahoo.es>

The top portion of MEM2 (the second 64MB memory block) in the Nintendo
Wii video game console is used by the firmware running on the Starlet
processor.

Add code to calculate the portion of MEM2 safely useable by the
Broadway processor. When running under the 'mini' firmware this is
easily determined from an in-memory header. Otherwise, a safe default
is used.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/boot/wii.c |  118 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 115 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/boot/wii.c b/arch/powerpc/boot/wii.c
index d0e2625..2ebaec0 100644
--- a/arch/powerpc/boot/wii.c
+++ b/arch/powerpc/boot/wii.c
@@ -22,10 +22,120 @@
 
 BSS_STACK(8192);
 
-#define HW_REG(x)	((void *)(x))
+#define HW_REG(x)		((void *)(x))
 
-#define EXI_CTRL	HW_REG(0x0d800070)
-#define EXI_CTRL_ENABLE	(1<<0)
+#define EXI_CTRL		HW_REG(0x0d800070)
+#define EXI_CTRL_ENABLE		(1<<0)
+
+#define MEM2_TOP		(0x10000000 + 64*1024*1024)
+#define FIRMWARE_DEFAULT_SIZE	(12*1024*1024)
+
+
+struct mipc_infohdr {
+	char magic[3];
+	u8 version;
+	u32 mem2_boundary;
+	u32 ipc_in;
+	size_t ipc_in_size;
+	u32 ipc_out;
+	size_t ipc_out_size;
+};
+
+static int mipc_check_address(u32 pa)
+{
+	/* only MEM2 addresses */
+	if (pa < 0x10000000 || pa > 0x14000000)
+		return -EINVAL;
+	return 0;
+}
+
+static struct mipc_infohdr *mipc_get_infohdr(void)
+{
+	struct mipc_infohdr **hdrp, *hdr;
+
+	/* 'mini' header pointer is the last word of MEM2 memory */
+	hdrp = (struct mipc_infohdr **)0x13fffffc;
+	if (mipc_check_address((u32)hdrp)) {
+		printf("mini: invalid hdrp %08X\n", (u32)hdrp);
+		hdr = NULL;
+		goto out;
+	}
+
+	hdr = *hdrp;
+	if (mipc_check_address((u32)hdr)) {
+		printf("mini: invalid hdr %08X\n", (u32)hdr);
+		hdr = NULL;
+		goto out;
+	}
+	if (memcmp(hdr->magic, "IPC", 3)) {
+		printf("mini: invalid magic\n");
+		hdr = NULL;
+		goto out;
+	}
+
+out:
+	return hdr;
+}
+
+static int mipc_get_mem2_boundary(u32 *mem2_boundary)
+{
+	struct mipc_infohdr *hdr;
+	int error;
+
+	hdr = mipc_get_infohdr();
+	if (!hdr) {
+		error = -1;
+		goto out;
+	}
+
+	if (mipc_check_address(hdr->mem2_boundary)) {
+		printf("mini: invalid mem2_boundary %08X\n",
+		       hdr->mem2_boundary);
+		error = -EINVAL;
+		goto out;
+	}
+	*mem2_boundary = hdr->mem2_boundary;
+	error = 0;
+out:
+	return error;
+
+}
+
+static void platform_fixups(void)
+{
+	void *mem;
+	u32 reg[4];
+	u32 mem2_boundary;
+	int len;
+	int error;
+
+	mem = finddevice("/memory");
+	if (!mem)
+		fatal("Can't find memory node\n");
+
+	/* two ranges of (address, size) words */
+	len = getprop(mem, "reg", reg, sizeof(reg));
+	if (len != sizeof(reg)) {
+		/* nothing to do */
+		goto out;
+	}
+
+	/* retrieve MEM2 boundary from 'mini' */
+	error = mipc_get_mem2_boundary(&mem2_boundary);
+	if (error) {
+		/* if that fails use a sane value */
+		mem2_boundary = MEM2_TOP - FIRMWARE_DEFAULT_SIZE;
+	}
+
+	if (mem2_boundary > reg[2] && mem2_boundary < reg[2] + reg[3]) {
+		reg[3] = mem2_boundary - reg[2];
+		printf("top of MEM2 @ %08X\n", reg[2] + reg[3]);
+		setprop(mem, "reg", reg, sizeof(reg));
+	}
+
+out:
+	return;
+}
 
 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
 {
@@ -42,5 +152,7 @@ void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
 
 	if (ug_probe())
 		console_ops.write = ug_console_write;
+
+	platform_ops.fixups = platform_fixups;
 }
 
-- 
1.6.3.3

^ permalink raw reply related

* [RFC PATCH v2 2/4] wii: use both mem1 and mem2 as ram
From: Albert Herranz @ 2009-12-08 18:43 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz
In-Reply-To: <1260297833-17625-1-git-send-email-albert_herranz@yahoo.es>

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/mm/init_32.c                |    4 ++
 arch/powerpc/mm/mmu_decl.h               |   10 ++++-
 arch/powerpc/mm/pgtable_32.c             |   32 +++++++++++++--
 arch/powerpc/mm/ppc_mmu_32.c             |    4 +-
 arch/powerpc/platforms/embedded6xx/wii.c |   63 ++++++++++++++++++++++++++++++
 5 files changed, 106 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 9ddcfb4..703c7c2 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -131,9 +131,13 @@ void __init MMU_init(void)
 	MMU_setup();
 
 	if (lmb.memory.cnt > 1) {
+#ifndef CONFIG_WII
 		lmb.memory.cnt = 1;
 		lmb_analyze();
 		printk(KERN_WARNING "Only using first contiguous memory region");
+#else
+		wii_memory_fixups();
+#endif
 	}
 
 	total_lowmem = total_memory = lmb_end_of_DRAM() - memstart_addr;
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index d2e5321..9aa39fe 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -136,6 +136,14 @@ extern phys_addr_t total_lowmem;
 extern phys_addr_t memstart_addr;
 extern phys_addr_t lowmem_end_addr;
 
+#ifdef CONFIG_WII
+extern unsigned long wii_hole_start;
+extern unsigned long wii_hole_size;
+
+extern unsigned long wii_mmu_mapin_mem2(unsigned long top);
+extern void wii_memory_fixups(void);
+#endif
+
 /* ...and now those things that may be slightly different between processor
  * architectures.  -- Dan
  */
@@ -155,5 +163,5 @@ extern void adjust_total_lowmem(void);
 #elif defined(CONFIG_PPC32)
 /* anything 32-bit except 4xx or 8xx */
 extern void MMU_init_hw(void);
-extern unsigned long mmu_mapin_ram(void);
+extern unsigned long mmu_mapin_ram(unsigned long top);
 #endif
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index cb96cb2..b55bbe8 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -283,18 +283,18 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
 }
 
 /*
- * Map in a big chunk of physical memory starting at PAGE_OFFSET.
+ * Map in a chunk of physical memory starting at start.
  */
-void __init mapin_ram(void)
+void __init __mapin_ram_chunk(unsigned long offset, unsigned long top)
 {
 	unsigned long v, s, f;
 	phys_addr_t p;
 	int ktext;
 
-	s = mmu_mapin_ram();
+	s = offset;
 	v = PAGE_OFFSET + s;
 	p = memstart_addr + s;
-	for (; s < total_lowmem; s += PAGE_SIZE) {
+	for (; s < top; s += PAGE_SIZE) {
 		ktext = ((char *) v >= _stext && (char *) v < etext);
 		f = ktext ? PAGE_KERNEL_TEXT : PAGE_KERNEL;
 		map_page(v, p, f);
@@ -307,6 +307,30 @@ void __init mapin_ram(void)
 	}
 }
 
+void __init mapin_ram(void)
+{
+	unsigned long s, top;
+
+#ifndef CONFIG_WII
+	top = total_lowmem;
+	s = mmu_mapin_ram(top);
+	__mapin_ram_chunk(s, top);
+#else
+	if (!wii_hole_size) {
+		s = mmu_mapin_ram(total_lowmem);
+		__mapin_ram_chunk(s, total_lowmem);
+	} else {
+		top = wii_hole_start;
+		s = mmu_mapin_ram(top);
+		__mapin_ram_chunk(s, top);
+
+		top = lmb_end_of_DRAM();
+		s = wii_mmu_mapin_mem2(top);
+		__mapin_ram_chunk(s, top);
+	}
+#endif
+}
+
 /* Scan the real Linux page tables and return a PTE pointer for
  * a virtual address in a context.
  * Returns true (1) if PTE was found, zero otherwise.  The pointer to
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index 2d2a87e..f11c2cd 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -72,7 +72,7 @@ unsigned long p_mapped_by_bats(phys_addr_t pa)
 	return 0;
 }
 
-unsigned long __init mmu_mapin_ram(void)
+unsigned long __init mmu_mapin_ram(unsigned long top)
 {
 	unsigned long tot, bl, done;
 	unsigned long max_size = (256<<20);
@@ -86,7 +86,7 @@ unsigned long __init mmu_mapin_ram(void)
 
 	/* Make sure we don't map a block larger than the
 	   smallest alignment of the physical address. */
-	tot = total_lowmem;
+	tot = top;
 	for (bl = 128<<10; bl < max_size; bl <<= 1) {
 		if (bl * 2 > tot)
 			break;
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index 1bd41cc..5eaed86 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -20,6 +20,8 @@
 #include <linux/seq_file.h>
 #include <linux/kexec.h>
 #include <linux/of_platform.h>
+#include <linux/lmb.h>
+#include <mm/mmu_decl.h>
 
 #include <asm/io.h>
 #include <asm/machdep.h>
@@ -52,6 +54,67 @@
 static void __iomem *hw_ctrl;
 static void __iomem *hw_gpio;
 
+unsigned long wii_hole_start;
+unsigned long wii_hole_size;
+
+
+static int page_aligned(unsigned long x)
+{
+	return !(x & (PAGE_SIZE-1));
+}
+
+void __init wii_memory_fixups(void)
+{
+	struct lmb_property *p = lmb.memory.region;
+
+	/*
+	 * This is part of a workaround to allow the use of two
+	 * discontiguous RAM ranges on the Wii, even if this is
+	 * currently unsupported on 32-bit PowerPC Linux.
+	 *
+	 * We coealesce the two memory ranges of the Wii into a
+	 * single range, then create a reservation for the "hole"
+	 * between both ranges.
+	 */
+
+	BUG_ON(lmb.memory.cnt != 2);
+	BUG_ON(!page_aligned(p[0].base) || !page_aligned(p[1].base));
+
+	p[0].size = _ALIGN_DOWN(p[0].size, PAGE_SIZE);
+	p[1].size = _ALIGN_DOWN(p[1].size, PAGE_SIZE);
+
+	wii_hole_start = p[0].base + p[0].size;
+	wii_hole_size = p[1].base - wii_hole_start;
+
+	pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size);
+	pr_info("HOLE: <%08lx %08lx>\n", wii_hole_start, wii_hole_size);
+	pr_info("MEM2: <%08llx %08llx>\n", p[1].base, p[1].size);
+
+	p[0].size += wii_hole_size + p[1].size;
+
+	lmb.memory.cnt = 1;
+	lmb_analyze();
+
+	/* reserve the hole */
+	lmb_reserve(wii_hole_start, wii_hole_size);
+}
+
+unsigned long __init wii_mmu_mapin_mem2(unsigned long top)
+{
+	unsigned long delta, size, bl;
+	unsigned long max_size = (256<<20);
+
+	/* MEM2 64MB@0x10000000 */
+	delta = wii_hole_start + wii_hole_size;
+	size = top - delta;
+	for (bl = 128<<10; bl < max_size; bl <<= 1) {
+		if (bl * 2 > size)
+			break;
+	}
+	setbat(4, PAGE_OFFSET+delta, delta, bl, PAGE_KERNEL_X);
+	return delta + bl;
+}
+
 static void wii_spin(void)
 {
 	local_irq_disable();
-- 
1.6.3.3

^ permalink raw reply related

* [RFC PATCH v2 3/4] powerpc: allow ioremap within reserved memory regions
From: Albert Herranz @ 2009-12-08 18:43 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz
In-Reply-To: <1260297833-17625-1-git-send-email-albert_herranz@yahoo.es>

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
v1 -> v2
- use a run-time flag to allow/disallow remapping reserved regions
- use lmbs to determine reserved regions

 arch/powerpc/mm/init_32.c    |    5 +++++
 arch/powerpc/mm/mmu_decl.h   |    1 +
 arch/powerpc/mm/pgtable_32.c |    4 +++-
 include/linux/lmb.h          |    1 +
 lib/lmb.c                    |    7 ++++++-
 5 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 703c7c2..4ec900a 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -82,6 +82,11 @@ extern struct task_struct *current_set[NR_CPUS];
 int __map_without_bats;
 int __map_without_ltlbs;
 
+/*
+ * This tells the system to allow ioremapping memory marked as reserved.
+ */
+int __allow_ioremap_reserved;
+
 /* max amount of low RAM to map in */
 unsigned long __max_low_memory = MAX_LOW_MEM;
 
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index 9aa39fe..34dacc3 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -115,6 +115,7 @@ extern void settlbcam(int index, unsigned long virt, phys_addr_t phys,
 extern void invalidate_tlbcam_entry(int index);
 
 extern int __map_without_bats;
+extern int __allow_ioremap_reserved;
 extern unsigned long ioremap_base;
 extern unsigned int rtas_data, rtas_size;
 
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index b55bbe8..177e403 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -26,6 +26,7 @@
 #include <linux/vmalloc.h>
 #include <linux/init.h>
 #include <linux/highmem.h>
+#include <linux/lmb.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -191,7 +192,8 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
 	 * Don't allow anybody to remap normal RAM that we're using.
 	 * mem_init() sets high_memory so only do the check after that.
 	 */
-	if (mem_init_done && (p < virt_to_phys(high_memory))) {
+	if (mem_init_done && (p < virt_to_phys(high_memory)) &&
+	    !(__allow_ioremap_reserved && lmb_is_region_reserved(p, size))) {
 		printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n",
 		       (unsigned long long)p, __builtin_return_address(0));
 		return NULL;
diff --git a/include/linux/lmb.h b/include/linux/lmb.h
index 2442e3f..ef82b8f 100644
--- a/include/linux/lmb.h
+++ b/include/linux/lmb.h
@@ -54,6 +54,7 @@ extern u64 __init lmb_phys_mem_size(void);
 extern u64 lmb_end_of_DRAM(void);
 extern void __init lmb_enforce_memory_limit(u64 memory_limit);
 extern int __init lmb_is_reserved(u64 addr);
+extern int lmb_is_region_reserved(u64 base, u64 size);
 extern int lmb_find(struct lmb_property *res);
 
 extern void lmb_dump_all(void);
diff --git a/lib/lmb.c b/lib/lmb.c
index 0343c05..9cee171 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -263,7 +263,7 @@ long __init lmb_reserve(u64 base, u64 size)
 	return lmb_add_region(_rgn, base, size);
 }
 
-long __init lmb_overlaps_region(struct lmb_region *rgn, u64 base, u64 size)
+long lmb_overlaps_region(struct lmb_region *rgn, u64 base, u64 size)
 {
 	unsigned long i;
 
@@ -493,6 +493,11 @@ int __init lmb_is_reserved(u64 addr)
 	return 0;
 }
 
+int lmb_is_region_reserved(u64 base, u64 size)
+{
+	return lmb_overlaps_region(&lmb.reserved, base, size);
+}
+
 /*
  * Given a <base, len>, find which memory regions belong to this range.
  * Adjust the request and return a contiguous chunk.
-- 
1.6.3.3

^ permalink raw reply related

* [RFC PATCH v2 4/4] powerpc: wii: allow ioremap within the memory hole
From: Albert Herranz @ 2009-12-08 18:43 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz
In-Reply-To: <1260297833-17625-1-git-send-email-albert_herranz@yahoo.es>

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/platforms/embedded6xx/wii.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index 5eaed86..0df8a91 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -97,6 +97,9 @@ void __init wii_memory_fixups(void)
 
 	/* reserve the hole */
 	lmb_reserve(wii_hole_start, wii_hole_size);
+
+	/* allow ioremapping the address space in the hole */
+	__allow_ioremap_reserved = 1;
 }
 
 unsigned long __init wii_mmu_mapin_mem2(unsigned long top)
-- 
1.6.3.3

^ permalink raw reply related

* [PATCH] pseries: Correct pseries/dlpar.c build break without CONFIG_SMP
From: Nathan Fontenot @ 2009-12-08 19:48 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Gautham R Shenoy

The recent patch to add cpu offline/online as part of the DLPAR
process for pseries causes a build break if CONFIG_SMP is not
defined.  Original patch here;
http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-November/078299.html

This corrects the build break by moving the online_node_cpus
and offline_node_cpus under the #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
portions of dlpar.c.

This patch also slightly modifies the online_node_cpus and offline_node_cpus
routines to prepend dlpar_ to the them and make them static.  These two
routine are only used in the dlpar add/remove of cpus and these changes
should help clarify that.

Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
 arch/powerpc/platforms/pseries/dlpar.c |  188 ++++++++++++++++-----------------
 1 file changed, 94 insertions(+), 94 deletions(-)

Index: powerpc/arch/powerpc/platforms/pseries/dlpar.c
===================================================================
--- powerpc.orig/arch/powerpc/platforms/pseries/dlpar.c	2009-12-08 12:47:44.000000000 -0600
+++ powerpc/arch/powerpc/platforms/pseries/dlpar.c	2009-12-08 13:14:24.000000000 -0600
@@ -288,98 +288,6 @@
 	return 0;
 }
 
-int online_node_cpus(struct device_node *dn)
-{
-	int rc = 0;
-	unsigned int cpu;
-	int len, nthreads, i;
-	const u32 *intserv;
-
-	intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
-	if (!intserv)
-		return -EINVAL;
-
-	nthreads = len / sizeof(u32);
-
-	cpu_maps_update_begin();
-	for (i = 0; i < nthreads; i++) {
-		for_each_present_cpu(cpu) {
-			if (get_hard_smp_processor_id(cpu) != intserv[i])
-				continue;
-			BUG_ON(get_cpu_current_state(cpu)
-					!= CPU_STATE_OFFLINE);
-			cpu_maps_update_done();
-			rc = cpu_up(cpu);
-			if (rc)
-				goto out;
-			cpu_maps_update_begin();
-
-			break;
-		}
-		if (cpu == num_possible_cpus())
-			printk(KERN_WARNING "Could not find cpu to online "
-			       "with physical id 0x%x\n", intserv[i]);
-	}
-	cpu_maps_update_done();
-
-out:
-	return rc;
-
-}
-
-int offline_node_cpus(struct device_node *dn)
-{
-	int rc = 0;
-	unsigned int cpu;
-	int len, nthreads, i;
-	const u32 *intserv;
-
-	intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
-	if (!intserv)
-		return -EINVAL;
-
-	nthreads = len / sizeof(u32);
-
-	cpu_maps_update_begin();
-	for (i = 0; i < nthreads; i++) {
-		for_each_present_cpu(cpu) {
-			if (get_hard_smp_processor_id(cpu) != intserv[i])
-				continue;
-
-			if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE)
-				break;
-
-			if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) {
-				cpu_maps_update_done();
-				rc = cpu_down(cpu);
-				if (rc)
-					goto out;
-				cpu_maps_update_begin();
-				break;
-
-			}
-
-			/*
-			 * The cpu is in CPU_STATE_INACTIVE.
-			 * Upgrade it's state to CPU_STATE_OFFLINE.
-			 */
-			set_preferred_offline_state(cpu, CPU_STATE_OFFLINE);
-			BUG_ON(plpar_hcall_norets(H_PROD, intserv[i])
-								!= H_SUCCESS);
-			__cpu_die(cpu);
-			break;
-		}
-		if (cpu == num_possible_cpus())
-			printk(KERN_WARNING "Could not find cpu to offline "
-			       "with physical id 0x%x\n", intserv[i]);
-	}
-	cpu_maps_update_done();
-
-out:
-	return rc;
-
-}
-
 #define DR_ENTITY_SENSE		9003
 #define DR_ENTITY_PRESENT	1
 #define DR_ENTITY_UNUSABLE	2
@@ -448,6 +356,45 @@
 	mutex_unlock(&pseries_cpu_hotplug_mutex);
 }
 
+static int dlpar_online_cpu(struct device_node *dn)
+{
+	int rc = 0;
+	unsigned int cpu;
+	int len, nthreads, i;
+	const u32 *intserv;
+
+	intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
+	if (!intserv)
+		return -EINVAL;
+
+	nthreads = len / sizeof(u32);
+
+	cpu_maps_update_begin();
+	for (i = 0; i < nthreads; i++) {
+		for_each_present_cpu(cpu) {
+			if (get_hard_smp_processor_id(cpu) != intserv[i])
+				continue;
+			BUG_ON(get_cpu_current_state(cpu)
+					!= CPU_STATE_OFFLINE);
+			cpu_maps_update_done();
+			rc = cpu_up(cpu);
+			if (rc)
+				goto out;
+			cpu_maps_update_begin();
+
+			break;
+		}
+		if (cpu == num_possible_cpus())
+			printk(KERN_WARNING "Could not find cpu to online "
+			       "with physical id 0x%x\n", intserv[i]);
+	}
+	cpu_maps_update_done();
+
+out:
+	return rc;
+
+}
+
 static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
 {
 	struct device_node *dn;
@@ -497,13 +444,66 @@
 		dlpar_free_cc_nodes(dn);
 	}
 
-	rc = online_node_cpus(dn);
+	rc = dlpar_online_cpu(dn);
 out:
 	cpu_hotplug_driver_unlock();
 
 	return rc ? rc : count;
 }
 
+static int dlpar_offline_cpu(struct device_node *dn)
+{
+	int rc = 0;
+	unsigned int cpu;
+	int len, nthreads, i;
+	const u32 *intserv;
+
+	intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
+	if (!intserv)
+		return -EINVAL;
+
+	nthreads = len / sizeof(u32);
+
+	cpu_maps_update_begin();
+	for (i = 0; i < nthreads; i++) {
+		for_each_present_cpu(cpu) {
+			if (get_hard_smp_processor_id(cpu) != intserv[i])
+				continue;
+
+			if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE)
+				break;
+
+			if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) {
+				cpu_maps_update_done();
+				rc = cpu_down(cpu);
+				if (rc)
+					goto out;
+				cpu_maps_update_begin();
+				break;
+
+			}
+
+			/*
+			 * The cpu is in CPU_STATE_INACTIVE.
+			 * Upgrade it's state to CPU_STATE_OFFLINE.
+			 */
+			set_preferred_offline_state(cpu, CPU_STATE_OFFLINE);
+			BUG_ON(plpar_hcall_norets(H_PROD, intserv[i])
+								!= H_SUCCESS);
+			__cpu_die(cpu);
+			break;
+		}
+		if (cpu == num_possible_cpus())
+			printk(KERN_WARNING "Could not find cpu to offline "
+			       "with physical id 0x%x\n", intserv[i]);
+	}
+	cpu_maps_update_done();
+
+out:
+	return rc;
+
+}
+
 static ssize_t dlpar_cpu_release(const char *buf, size_t count)
 {
 	struct device_node *dn;
@@ -521,7 +521,7 @@
 	}
 
 	cpu_hotplug_driver_lock();
-	rc = offline_node_cpus(dn);
+	rc = dlpar_offline_cpu(dn);
 	if (rc) {
 		of_node_put(dn);
 		rc = -EINVAL;

^ permalink raw reply

* Re: [PATCH 00/10 v6]  Fix 8xx MMU/TLB
From: Benjamin Herrenschmidt @ 2009-12-08 20:01 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: Scott Wood, linuxppc-dev@ozlabs.org, Rex Feany
In-Reply-To: <OF5D73AF7D.6635CE0F-ONC1257686.002F38E4-C1257686.002F81DE@transmode.se>

On Tue, 2009-12-08 at 09:38 +0100, Joakim Tjernlund wrote:
> Scott Wood <scottwood@freescale.com> wrote on 30/11/2009 23:25:30:
> >
> > Benjamin Herrenschmidt wrote:
> > > On Fri, 2009-11-27 at 11:57 +0100, Joakim Tjernlund wrote:
> > >> Scott and Rex, I think we need you s-o-b to make it into the kernel proper.
> > >>
> > >> Marcelo and Vitaly, I noticed you guys are listed as 8xx maintainers.
> > >> Have you seen this? What do you think?
> > >
> > > I think Marcelo isn't much involved with 8xx anymore. I'd say if Scott
> > > and Vitaly are ok, then the patches are good. But I'll wait for at least
> > > Scott to give an Ack as he can at least test which I can't :-)
> >
> > ACK
> 
> Can't see these patches in next yet, did they go somewhere else?

No, but Scott has been to lazy to write proper Acked-by: lines and I've
been too lazy to do it for him so they'll go in the next batch, probably
today :-)

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH 3/3] mpc52xx/wdt: WDT uses GPT api
From: Wim Van Sebroeck @ 2009-12-08 20:48 UTC (permalink / raw)
  To: Grant Likely
  Cc: Albrecht Dreß, devicetree-discuss, Linux PPC Development
In-Reply-To: <fa686aa40911122221s24efdcc9k1daf63b600e7b429@mail.gmail.com>

Hi Grant,

Sorry for the delay, I need to deliver a project in a weeks time...

> In actual fact, it is a single device with multiple functions, some of
> which can be used at the same time.  The driver for the device
> determines what the device instance supports and registers the
> appropriate interfaces.  There is a GPIO controller, a PWM controller,
> a general purpose timer, and the watchdog.  Because of the
> multifunction nature of the device, there are subtle interactions
> between the functions that the driver needs to maintain.  I don't want
> to export functions from the driver which will only be used by a
> watchdog instance.  I also don't want the added code and complexity of
> a secondary probe path.  It is simpler and less code to roll all the
> behaviour up into the one driver single driver that gets probed once.
> 
> >From the maintenance perspective, having the main driver in
> arch/powerpc and the watchdog bit in drivers/watchdog doesn't really
> help much anyway because anything that changes the internal driver API
> (between the core and watchdog bits) will require cross-maintainer
> changes.  ie. do changes go through my tree because they touch
> arch/powerpc, or do they go through yours because they touch
> drivers/watchdog?  I'd much rather all the internal details be
> contained within a single driver.

Your argument about maintenance is the same one as I have: If all watchdog
driver pieces are under drivers/watchdog then it's easier for me to maintain
them. (Definitely if we are doing clean-up work and API changes).

> Besides, there is already precedence for very arch-specific drivers
> living under arch/*/.  find ./arch -name *gpio*

But in this case: I know where to find them and I will keep a mental note
about this one. And yes indeed some very arch specific drivers can reside
under arch/*/* .

So please go ahead with pulling this one in a single driver.

Kind regards,
Wim.

^ permalink raw reply

* Re: [PATCH 3/3] mpc52xx/wdt: WDT uses GPT api
From: Grant Likely @ 2009-12-08 21:21 UTC (permalink / raw)
  To: Wim Van Sebroeck
  Cc: Albrecht Dreß, devicetree-discuss, Linux PPC Development
In-Reply-To: <20091208204854.GE4291@infomag.iguana.be>

On Tue, Dec 8, 2009 at 1:48 PM, Wim Van Sebroeck <wim@iguana.be> wrote:
> Hi Grant,
>
> Sorry for the delay, I need to deliver a project in a weeks time...

understood.

>> In actual fact, it is a single device with multiple functions, some of
>> which can be used at the same time. =A0The driver for the device
>> determines what the device instance supports and registers the
>> appropriate interfaces. =A0There is a GPIO controller, a PWM controller,
>> a general purpose timer, and the watchdog. =A0Because of the
>> multifunction nature of the device, there are subtle interactions
>> between the functions that the driver needs to maintain. =A0I don't want
>> to export functions from the driver which will only be used by a
>> watchdog instance. =A0I also don't want the added code and complexity of
>> a secondary probe path. =A0It is simpler and less code to roll all the
>> behaviour up into the one driver single driver that gets probed once.
>>
>> >From the maintenance perspective, having the main driver in
>> arch/powerpc and the watchdog bit in drivers/watchdog doesn't really
>> help much anyway because anything that changes the internal driver API
>> (between the core and watchdog bits) will require cross-maintainer
>> changes. =A0ie. do changes go through my tree because they touch
>> arch/powerpc, or do they go through yours because they touch
>> drivers/watchdog? =A0I'd much rather all the internal details be
>> contained within a single driver.
>
> Your argument about maintenance is the same one as I have: If all watchdo=
g
> driver pieces are under drivers/watchdog then it's easier for me to maint=
ain
> them. (Definitely if we are doing clean-up work and API changes).

:-)

>> Besides, there is already precedence for very arch-specific drivers
>> living under arch/*/. =A0find ./arch -name *gpio*
>
> But in this case: I know where to find them and I will keep a mental note
> about this one. And yes indeed some very arch specific drivers can reside
> under arch/*/* .
>
> So please go ahead with pulling this one in a single driver.

Great, Thanks Wim.

g.

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

^ permalink raw reply

* Re: 2.6.33 -next tree
From: Grant Likely @ 2009-12-08 21:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Andrew Morton, linuxppc-dev
  Cc: Stephen Rothwell, David Brownell
In-Reply-To: <fa686aa40911042210q5bbbca2fi82911b7245d17588@mail.gmail.com>

On Wed, Nov 4, 2009 at 11:10 PM, Grant Likely <grant.likely@secretlab.ca> w=
rote:
> Hi Ben, Stephen.
>
> I just prepared my next branch for 2.6.33:
> git://git.secretlab.ca/git/linux-2.6 next
>
> Steven, can you please add this tree to your linux-next pull list?
> This is the branch where I put stuff that gets fed up to Ben. =A0This is
> separate from the branch that I'm using to collect OF related changes
> and that you are already pulling in.
>
> Ben, can you please pull this branch into your -next tree for 2.6.33?

Ben: ping?

Are you able to pull this tree, or should I ask Linus to pull it directly?

It contains mpc5200 and xilinx stuff.  Some of it is SPI related, but
I'm now the SPI co-maintainer, so I have no problem with it going in
via your tree.  :-)  Regardless, I want to get it out to Linus ASAP.

This tree has also been in linux-next for a while now, so it should be
a safe pull.

Thanks,
g.

> Andrew & David, you'll notice that I've also got some SPI and MMC
> changes in this branch (PPC and OF related stuff) since there is no
> current MMC maintainer, and some of these SPI patches have been
> hanging around for a while now. =A0Let me know if you object to me
> pushing these changes personally instead of going through another
> maintainer.
>
> Thanks,
> g.
>
> The following changes since commit b419148e567728f6af0c3b01965c1cc141e3e1=
3a:
> =A0Linus Torvalds (1):
> =A0 =A0 =A0 =A0Linux 2.6.32-rc6
>
> are available in the git repository at:
>
> =A0git://git.secretlab.ca/git/linux-2.6 next
>
> Albrecht Dre=DF (1):
> =A0 =A0 =A0powerpc: tiny memcpy_(to|from)io optimisation
>
> Grant Likely (4):
> =A0 =A0 =A0spi/mpc5200: Register SPI devices described in device tree
> =A0 =A0 =A0powerpc/5200: Add mpc5200-spi (non-PSC) device driver
> =A0 =A0 =A0powerpc/5200: add general purpose timer API for the MPC5200
> =A0 =A0 =A0mmc: fix missing module license declaration in of_mmc_spi.c
>
> John Bonesio (1):
> =A0 =A0 =A0powerpc/5200: add LocalPlus bus FIFO device driver
>
> John Linn (1):
> =A0 =A0 =A0Xilinx: SPI: Fix bits_per_word for transfers
>
> Wolfram Sang (2):
> =A0 =A0 =A0spi/mpc52xx-psc-spi: check for valid PSC
> =A0 =A0 =A0spi/mpc52xx: replace printk with dev_err
>
> =A0arch/powerpc/include/asm/mpc52xx.h =A0 =A0 =A0 =A0 =A0 =A0| =A0 46 ++
> =A0arch/powerpc/kernel/io.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0| =
=A0 =A04 +-
> =A0arch/powerpc/platforms/52xx/Kconfig =A0 =A0 =A0 =A0 =A0 | =A0 =A05 +
> =A0arch/powerpc/platforms/52xx/Makefile =A0 =A0 =A0 =A0 =A0| =A0 =A01 +
> =A0arch/powerpc/platforms/52xx/mpc52xx_gpt.c =A0 =A0 | =A0133 ++++++-
> =A0arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | =A0560 +++++++++++++++=
++++++++++
> =A0drivers/mmc/host/of_mmc_spi.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =
=A02 +
> =A0drivers/spi/Kconfig =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 | =A0 =A08 +
> =A0drivers/spi/Makefile =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0| =A0 =A01 +
> =A0drivers/spi/mpc52xx_psc_spi.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 25=
 +-
> =A0drivers/spi/mpc52xx_spi.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =
=A0520 +++++++++++++++++++++++
> =A0drivers/spi/xilinx_spi.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0| =
=A0 =A03 +-
> =A0include/linux/spi/mpc52xx_spi.h =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 10 +
> =A013 files changed, 1297 insertions(+), 21 deletions(-)
> =A0create mode 100644 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
> =A0create mode 100644 drivers/spi/mpc52xx_spi.c
> =A0create mode 100644 include/linux/spi/mpc52xx_spi.h
>
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
>



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

^ permalink raw reply

* Re: 2.6.33 -next tree
From: Grant Likely @ 2009-12-08 21:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Andrew Morton, linuxppc-dev
  Cc: Stephen Rothwell, Wim Van Sebroeck, David Brownell
In-Reply-To: <fa686aa40912081333r53cdc5d4ldc45dcfdd2e7536f@mail.gmail.com>

Ben, here's an updated pull request.  Can you please pull and send
them up to Linus?

I've added 4 more commits related to the 5200 GPT timer.  These
commits have also have linux-next exposure, I just had them in the
wrong branch.  One commit touches drivers/watchdog, but I got an ack
from Wim to merge it.

Cheers,
g.

The following changes since commit 22763c5cf3690a681551162c15d34d935308c8d7=
:
  Linus Torvalds (1):
        Linux 2.6.32

are available in the git repository at:

  git://git.secretlab.ca/git/linux-2.6 next

Albrecht Dre=C3=83=C5=B8 (5):
      powerpc: tiny memcpy_(to|from)io optimisation
      mpc5200/gpt: tiny fix for gpt period limitation
      mpc52xx/wdt: OF property to enable the WDT on boot
      mpc52xx/wdt: merge WDT code into the GPT driver
      mpc52xx/wdt: remove obsolete old WDT implementation

Grant Likely (4):
      spi/mpc5200: Register SPI devices described in device tree
      powerpc/5200: Add mpc5200-spi (non-PSC) device driver
      powerpc/5200: add general purpose timer API for the MPC5200
      mmc: fix missing module license declaration in of_mmc_spi.c

John Bonesio (1):
      powerpc/5200: add LocalPlus bus FIFO device driver

John Linn (1):
      Xilinx: SPI: Fix bits_per_word for transfers

Wolfram Sang (2):
      spi/mpc52xx-psc-spi: check for valid PSC
      spi/mpc52xx: replace printk with dev_err

 Documentation/powerpc/dts-bindings/fsl/mpc5200.txt |   17 +-
 arch/powerpc/include/asm/mpc52xx.h                 |   47 ++
 arch/powerpc/kernel/io.c                           |    4 +-
 arch/powerpc/platforms/52xx/Kconfig                |    5 +
 arch/powerpc/platforms/52xx/Makefile               |    1 +
 arch/powerpc/platforms/52xx/mpc52xx_gpt.c          |  428 +++++++++++++++-
 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c      |  560 ++++++++++++++++=
++++
 drivers/mmc/host/of_mmc_spi.c                      |    2 +
 drivers/spi/Kconfig                                |    8 +
 drivers/spi/Makefile                               |    1 +
 drivers/spi/mpc52xx_psc_spi.c                      |   25 +-
 drivers/spi/mpc52xx_spi.c                          |  520 ++++++++++++++++=
++
 drivers/spi/xilinx_spi.c                           |    3 +-
 drivers/watchdog/Kconfig                           |    4 +-
 drivers/watchdog/Makefile                          |    1 -
 drivers/watchdog/mpc5200_wdt.c                     |  293 ----------
 include/linux/spi/mpc52xx_spi.h                    |   10 +
 17 files changed, 1609 insertions(+), 320 deletions(-)
 create mode 100644 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
 create mode 100644 drivers/spi/mpc52xx_spi.c
 delete mode 100644 drivers/watchdog/mpc5200_wdt.c
 create mode 100644 include/linux/spi/mpc52xx_spi.h


On Tue, Dec 8, 2009 at 2:33 PM, Grant Likely <grant.likely@secretlab.ca> wr=
ote:
> On Wed, Nov 4, 2009 at 11:10 PM, Grant Likely <grant.likely@secretlab.ca>=
 wrote:
>> Hi Ben, Stephen.
>>
>> I just prepared my next branch for 2.6.33:
>> git://git.secretlab.ca/git/linux-2.6 next
>>
>> Steven, can you please add this tree to your linux-next pull list?
>> This is the branch where I put stuff that gets fed up to Ben. =C2=A0This=
 is
>> separate from the branch that I'm using to collect OF related changes
>> and that you are already pulling in.
>>
>> Ben, can you please pull this branch into your -next tree for 2.6.33?
>
> Ben: ping?
>
> Are you able to pull this tree, or should I ask Linus to pull it directly=
?
>
> It contains mpc5200 and xilinx stuff. =C2=A0Some of it is SPI related, bu=
t
> I'm now the SPI co-maintainer, so I have no problem with it going in
> via your tree. =C2=A0:-) =C2=A0Regardless, I want to get it out to Linus =
ASAP.
>
> This tree has also been in linux-next for a while now, so it should be
> a safe pull.
>
> Thanks,
> g.
>
>> Andrew & David, you'll notice that I've also got some SPI and MMC
>> changes in this branch (PPC and OF related stuff) since there is no
>> current MMC maintainer, and some of these SPI patches have been
>> hanging around for a while now. =C2=A0Let me know if you object to me
>> pushing these changes personally instead of going through another
>> maintainer.
>>
>> Thanks,
>> g.
>>
>> The following changes since commit b419148e567728f6af0c3b01965c1cc141e3e=
13a:
>> =C2=A0Linus Torvalds (1):
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0Linux 2.6.32-rc6
>>
>> are available in the git repository at:
>>
>> =C2=A0git://git.secretlab.ca/git/linux-2.6 next
>>
>> Albrecht Dre=C3=9F (1):
>> =C2=A0 =C2=A0 =C2=A0powerpc: tiny memcpy_(to|from)io optimisation
>>
>> Grant Likely (4):
>> =C2=A0 =C2=A0 =C2=A0spi/mpc5200: Register SPI devices described in devic=
e tree
>> =C2=A0 =C2=A0 =C2=A0powerpc/5200: Add mpc5200-spi (non-PSC) device drive=
r
>> =C2=A0 =C2=A0 =C2=A0powerpc/5200: add general purpose timer API for the =
MPC5200
>> =C2=A0 =C2=A0 =C2=A0mmc: fix missing module license declaration in of_mm=
c_spi.c
>>
>> John Bonesio (1):
>> =C2=A0 =C2=A0 =C2=A0powerpc/5200: add LocalPlus bus FIFO device driver
>>
>> John Linn (1):
>> =C2=A0 =C2=A0 =C2=A0Xilinx: SPI: Fix bits_per_word for transfers
>>
>> Wolfram Sang (2):
>> =C2=A0 =C2=A0 =C2=A0spi/mpc52xx-psc-spi: check for valid PSC
>> =C2=A0 =C2=A0 =C2=A0spi/mpc52xx: replace printk with dev_err
>>
>> =C2=A0arch/powerpc/include/asm/mpc52xx.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0| =C2=A0 46 ++
>> =C2=A0arch/powerpc/kernel/io.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A04 +-
>> =C2=A0arch/powerpc/platforms/52xx/Kconfig =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 | =C2=A0 =C2=A05 +
>> =C2=A0arch/powerpc/platforms/52xx/Makefile =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0| =C2=A0 =C2=A01 +
>> =C2=A0arch/powerpc/platforms/52xx/mpc52xx_gpt.c =C2=A0 =C2=A0 | =C2=A013=
3 ++++++-
>> =C2=A0arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | =C2=A0560 ++++++++=
+++++++++++++++++
>> =C2=A0drivers/mmc/host/of_mmc_spi.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A02 +
>> =C2=A0drivers/spi/Kconfig =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A08 +
>> =C2=A0drivers/spi/Makefile =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A01 +
>> =C2=A0drivers/spi/mpc52xx_psc_spi.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 | =C2=A0 25 +-
>> =C2=A0drivers/spi/mpc52xx_spi.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0520 +++++++++++++++++++++++
>> =C2=A0drivers/spi/xilinx_spi.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A03 +-
>> =C2=A0include/linux/spi/mpc52xx_spi.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 | =C2=A0 10 +
>> =C2=A013 files changed, 1297 insertions(+), 21 deletions(-)
>> =C2=A0create mode 100644 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
>> =C2=A0create mode 100644 drivers/spi/mpc52xx_spi.c
>> =C2=A0create mode 100644 include/linux/spi/mpc52xx_spi.h
>>
>>
>> --
>> Grant Likely, B.Sc., P.Eng.
>> Secret Lab Technologies Ltd.
>>
>
>
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
>



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

^ 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