LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: Connecting SGMII PHY to eTSEC1 on P1022
From: Timur Tabi @ 2011-06-22 16:18 UTC (permalink / raw)
  To: Felix Radensky; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <4E021113.10909@embedded-sol.com>

Felix Radensky wrote:
> What am I doing wrong ?

Can you debug the PHY driver to see if it's getting called and trying to talk to
the PHY itself?

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* Re: [PATCH] powerpc/85xx:DTS: Fix tbi node location for Px020RDB
From: Grant Likely @ 2011-06-22 16:34 UTC (permalink / raw)
  To: Kumar Gala
  Cc: meet2prabhu, devicetree-discuss, linuxppc-dev, Prabhakar Kushwaha
In-Reply-To: <F9CD495E-12BF-467D-BE96-CC11486F70B8@kernel.crashing.org>

On Wed, Jun 22, 2011 at 5:34 AM, Kumar Gala <galak@kernel.crashing.org> wro=
te:
>
> On Jun 7, 2011, at 9:49 PM, Prabhakar Kushwaha wrote:
>
>> ten-bit interface (TBI) module is part of SoC not board.
>>
>> Move tbi entries from board related dts files to Si dts.
>>
>> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
>> ---
>> Based upon http://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.=
git (branch next)
>>
>> arch/powerpc/boot/dts/p1020rdb.dts =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A09 ---=
------
>> arch/powerpc/boot/dts/p1020rdb_camp_core0.dts | =A0 =A08 --------
>> arch/powerpc/boot/dts/p1020si.dtsi =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A06 +++=
++-
>> arch/powerpc/boot/dts/p2020rdb.dts =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A08 ---=
-----
>> arch/powerpc/boot/dts/p2020rdb_camp_core0.dts | =A0 =A08 --------
>> arch/powerpc/boot/dts/p2020si.dtsi =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A06 +++=
++-
>> 6 files changed, 10 insertions(+), 35 deletions(-)
>>
>> diff --git a/arch/powerpc/boot/dts/p1020rdb.dts b/arch/powerpc/boot/dts/=
p1020rdb.dts
>> index d6a8ae4..a4e5d6c 100644
>> --- a/arch/powerpc/boot/dts/p1020rdb.dts
>> +++ b/arch/powerpc/boot/dts/p1020rdb.dts
>> @@ -211,14 +211,6 @@
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
>>
>> - =A0 =A0 =A0 =A0 =A0 =A0 mdio@25000 {
>> -
>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tbi0: tbi-phy@11 {
>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x11>=
;
>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_type =
=3D "tbi-phy";
>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
>> - =A0 =A0 =A0 =A0 =A0 =A0 };
>> -
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 enet0: ethernet@b0000 {
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fixed-link =3D <1 1 1000 0 0=
>;
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 phy-connection-type =3D "rgm=
ii-id";
>> @@ -227,7 +219,6 @@
>>
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 enet1: ethernet@b1000 {
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 phy-handle =3D <&phy0>;
>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tbi-handle =3D <&tbi0>;
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 phy-connection-type =3D "sgm=
ii";
>>
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
>
> I'm not sure we should do this. =A0The phy address we pick is board speci=
fic so it should NOT be in .dtsi

Ah, okay.  I was under the impression that the tbi address was
internal to the SoC, and not configurable.

g.

^ permalink raw reply

* Re: Connecting SGMII PHY to eTSEC1 on P1022
From: Felix Radensky @ 2011-06-22 17:12 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <4E0215E5.5060606@freescale.com>

Hi Timur,

On 06/22/2011 07:18 PM, Timur Tabi wrote:
> Felix Radensky wrote:
>> What am I doing wrong ?
> Can you debug the PHY driver to see if it's getting called and trying to talk to
> the PHY itself?
>
I'll do that tomorrow and report back.

Thanks.

Felix.

^ permalink raw reply

* Re: [PATCH v2 1/3] driver core: Add ability for arch code to setup pdev_archdata
From: Scott Wood @ 2011-06-22 17:52 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Greg KH, linux-kernel, linuxppc-dev
In-Reply-To: <1308755396-17988-1-git-send-email-galak@kernel.crashing.org>

On Wed, 22 Jun 2011 10:09:56 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:

> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 1c291af..c25e0c0 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -20,6 +20,7 @@
>  #include <linux/err.h>
>  #include <linux/slab.h>
>  #include <linux/pm_runtime.h>
> +#include <asm/platform_device.h>
>  
>  #include "base.h"
>  
> @@ -173,6 +174,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
>  		pa->pdev.id = id;
>  		device_initialize(&pa->pdev.dev);
>  		pa->pdev.dev.release = platform_device_release;
> +		arch_setup_pdev_archdata(&pa->pdev);
>  	}
>  
>  	return pa ? &pa->pdev : NULL;

Need to call this from platform_device_register() as well, for devices
which are not dynamically allocated.

> +/*
> + * an architecture can override to define arch_setup_pdev_archdata
> + */
> +#ifndef arch_setup_pdev_archdata
> +static inline void arch_setup_pdev_archdata(struct platform_device *pdev) { }
> +#endif

That's not a particularly useful comment.  More useful would be a statement
of when this hook is called, examples of what it's meant to be used for,
etc.

-Scott

^ permalink raw reply

* Re: [PATCH 3/3] powerpc: Dont require a dma_ops struct to set dma mask
From: Scott Wood @ 2011-06-22 17:53 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Greg KH, linux-kernel, linuxppc-dev
In-Reply-To: <1308744176-24491-3-git-send-email-galak@kernel.crashing.org>

On Wed, 22 Jun 2011 07:02:56 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:

> The only reason to require a dma_ops struct is to see if it has
> implemented set_dma_mask.  If not we can fall back to setting the mask
> directly.
> 
> This resolves an issue with how to sequence the setting of a DMA mask
> for platform devices.  Before we had an issue in that we have no way of
> setting the DMA mask before the various low level bus notifiers get
> called that might check it (swiotlb).
> 
> So now we can do:
> 
> 	pdev = platform_device_alloc("foobar", 0);
> 	dma_set_mask(&pdev->dev, DMA_BIT_MASK(37));
> 	platform_device_register(pdev);

Despite what Documentation/driver-model/platform.txt says, it looks like
platform_device_add() is what you want after platform_device_alloc().
Otherwise device_initialize() gets called twice, as would a call to the
archdata hook if one is added to platform_device_register().

-Scott

^ permalink raw reply

* [PATCH] powerpc, 460gt: Add 460gt as compatible in the check for 460ex-compatible crypto
From: Mike Williams @ 2011-06-22 19:30 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Mike Williams


Signed-off-by: Mike Williams <mike@mikebwilliams.com>
---
 drivers/crypto/amcc/crypto4xx_core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 1891252..4895be5 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -1161,7 +1161,8 @@ static int __init crypto4xx_probe(struct platform_device *ofdev)
 	if (rc)
 		return -ENODEV;
 
-	if (of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-crypto")) {
+	if (of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-crypto") ||
+	    of_find_compatible_node(NULL, NULL, "amcc,ppc460gt-crypto")) {
 		mtdcri(SDR0, PPC460EX_SDR0_SRST,
 		       mfdcri(SDR0, PPC460EX_SDR0_SRST) | PPC460EX_CE_RESET);
 		mtdcri(SDR0, PPC460EX_SDR0_SRST,
-- 
1.7.3.4

^ permalink raw reply related

* Re: [PATCH] fsl-diu-fb: remove the ioctl interface
From: Anatolij Gustschin @ 2011-06-22 20:11 UTC (permalink / raw)
  To: Tabi Timur-B04825
  Cc: linuxppc-dev@ozlabs.org, linux-fbdev@vger.kernel.org,
	lethal@linux-sh.org, sun york-R58495
In-Reply-To: <4E012586.7050808@freescale.com>

On Tue, 21 Jun 2011 23:13:11 +0000
Tabi Timur-B04825 <B04825@freescale.com> wrote:

> Anatolij Gustschin wrote:
> > No! We are using ioctl interface of this driver in many video
> > rendering applications on overlay planes on huge number of boards.
> > So, please don't remove it.
> 
> Ok, I had no idea anyone was using it.
> 
> Can you email me details about how you use the ioctl interface?  If I can't 
> remove it, maybe I can clean it up.

Following DIU specific ioctls are used:

MFB_SET_CHROMA_KEY
MFB_SET_PIXFMT
MFB_GET_PIXFMT
MFB_SET_AOID
MFB_GET_AOID
MFB_GET_ALPHA
MFB_SET_ALPHA

Other ioctls can be removed. I'm not sure if someone
uses FBIOGET_GWINFO. If there are no objections from
other people, it can also be dropped.

^ permalink raw reply

* [PATCH v2] powerpc/book3e-64: reraise doorbell when masked by soft-irq-disable
From: Scott Wood @ 2011-06-22 21:19 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
v2: Remove the soft irq enable code made unnecessary by this.

 arch/powerpc/include/asm/smp.h       |    1 -
 arch/powerpc/kernel/exceptions-64e.S |   22 +++++++++++++++++++++-
 arch/powerpc/kernel/irq.c            |    6 ------
 arch/powerpc/kernel/smp.c            |    8 --------
 4 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index b2a4c2d..15a70b7 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -119,7 +119,6 @@ extern const char *smp_ipi_name[];
 /* for irq controllers with only a single ipi */
 extern void smp_muxed_ipi_set_data(int cpu, unsigned long data);
 extern void smp_muxed_ipi_message_pass(int cpu, int msg);
-extern void smp_muxed_ipi_resend(void);
 extern irqreturn_t smp_ipi_demux(void);
 
 void smp_init_iSeries(void);
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index d24d440..429983c 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -120,6 +120,12 @@
 	std	r14,PACA_EXMC+EX_R14(r13);				    \
 	std	r15,PACA_EXMC+EX_R15(r13)
 
+#define PROLOG_ADDITION_DOORBELL_GEN					    \
+	lbz	r11,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */	    \
+	cmpwi	cr0,r11,0;		/* yes -> go out of line */	    \
+	beq	masked_doorbell_book3e
+
+
 /* Core exception code for all exceptions except TLB misses.
  * XXX: Needs to make SPRN_SPRG_GEN depend on exception type
  */
@@ -522,7 +528,13 @@ kernel_dbg_exc:
 	MASKABLE_EXCEPTION(0x260, perfmon, .performance_monitor_exception, ACK_NONE)
 
 /* Doorbell interrupt */
-	MASKABLE_EXCEPTION(0x2070, doorbell, .doorbell_exception, ACK_NONE)
+	START_EXCEPTION(doorbell)
+	NORMAL_EXCEPTION_PROLOG(0x2070, PROLOG_ADDITION_DOORBELL)
+	EXCEPTION_COMMON(0x2070, PACA_EXGEN, INTS_DISABLE_ALL)
+	CHECK_NAPPING()
+	addi	r3,r1,STACK_FRAME_OVERHEAD
+	bl	.doorbell_exception
+	b	.ret_from_except_lite
 
 /* Doorbell critical Interrupt */
 	START_EXCEPTION(doorbell_crit);
@@ -545,8 +557,16 @@ kernel_dbg_exc:
  * An interrupt came in while soft-disabled; clear EE in SRR1,
  * clear paca->hard_enabled and return.
  */
+masked_doorbell_book3e:
+	mtcr	r10
+	/* Resend the doorbell to fire again when ints enabled */
+	mfspr	r10,SPRN_PIR
+	PPC_MSGSND(r10)
+	b	masked_interrupt_book3e_common
+
 masked_interrupt_book3e:
 	mtcr	r10
+masked_interrupt_book3e_common:
 	stb	r11,PACAHARDIRQEN(r13)
 	mfspr	r10,SPRN_SRR1
 	rldicl	r11,r10,48,1		/* clear MSR_EE */
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 5b428e3..62f5457 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -157,12 +157,6 @@ notrace void arch_local_irq_restore(unsigned long en)
 	if (get_hard_enabled())
 		return;
 
-#if defined(CONFIG_BOOKE) && defined(CONFIG_SMP)
-	/* Check for pending doorbell interrupts and resend to ourself */
-	if (cpu_has_feature(CPU_FTR_DBELL))
-		smp_muxed_ipi_resend();
-#endif
-
 	/*
 	 * Need to hard-enable interrupts here.  Since currently disabled,
 	 * no need to take further asm precautions against preemption; but
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 2975f64..6c8e739 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -202,14 +202,6 @@ void smp_muxed_ipi_message_pass(int cpu, int msg)
 	smp_ops->cause_ipi(cpu, info->data);
 }
 
-void smp_muxed_ipi_resend(void)
-{
-	struct cpu_messages *info = &__get_cpu_var(ipi_message);
-
-	if (info->messages)
-		smp_ops->cause_ipi(smp_processor_id(), info->data);
-}
-
 irqreturn_t smp_ipi_demux(void)
 {
 	struct cpu_messages *info = &__get_cpu_var(ipi_message);
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH] powerpc/book3e-64: use a separate TLB handler when linear map is bolted
From: Scott Wood @ 2011-06-22 21:24 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1308350669.32158.60.camel@pasglop>

On Sat, 18 Jun 2011 08:44:29 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> Can't you just re-org the PACA instead ? (with a comment) ? Or at least
> if you want to keep it that way, put the cache line explanation in a
> comment somewhere.

OK.

> > > > +.macro tlb_prolog_bolted addr
> > > > +	mtspr	SPRN_SPRG_TLB_SCRATCH,r13
> > > > +	mfspr	r13,SPRN_SPRG_PACA
> > > > +	std	r10,PACA_EXTLB+EX_TLB_R10(r13)
> > > > +	mfcr	r10
> > > > +	std	r11,PACA_EXTLB+EX_TLB_R11(r13)
> > > > +	mfspr	r11,SPRN_SPRG_TLB_SCRATCH
> > > 
> > > Do you need that ? Can't you leave r13 in scratch the whole way and
> > > just pop it out in the error case when branching to DSI/ISI ? The only
> > > thing is that TLB_SCRATCH needs to be saved/restored by
> > > crit/debug/mcheck but thats worth saving cycles in the TLB miss handler
> > > no ?
> > 
> > Sounds right... I'll try it.

This saved another 1% or so.  I don't think TLB_SCRATCH needs to be saved
by crit/debug/mcheck -- they shouldn't be taking TLB misses, at least
in the bolted case.  Even non-bolted, it doesn't look like there are enough
extlb levels to deal with a linear TLB miss inside a crit/debug/mcheck
inside a linear TLB miss inside a virtual page table miss inside a normal
TLB miss.

Currently, we could just as well take that crit/debug/mcheck after
storing to TLB_SCRATCH but before saving it to extlb, and have the same
problem.

-Scott

^ permalink raw reply

* [PATCH v2] powerpc/book3e-64: use a separate TLB handler when linear map is bolted
From: Scott Wood @ 2011-06-22 21:25 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev

On MMUs such as FSL where we can guarantee the entire linear mapping is
bolted, we don't need to worry about linear TLB misses.  If on top of
that we do a full table walk, we get rid of all recursive TLB faults, and
can dispense with some state saving.  This gains a few percent on
TLB-miss-heavy workloads, and around 50% on a benchmark that had a high
rate of virtual page table faults under the normal handler.

While touching the EX_TLB layout, remove EX_TLB_MMUCR0, EX_TLB_SRR0, and
EX_TLB_SRR1 as they're not used.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
v2:
- Move pgd/kernel_pgd rather than duplicate pgd in extlb. 
- Keep the saved r13 in the scratch SPRG rather than save it to extlb.
- Move rather than duplicate comment about patching the second
  exception instruction.

 arch/powerpc/include/asm/exception-64e.h |   52 +++++---
 arch/powerpc/include/asm/paca.h          |    7 +-
 arch/powerpc/mm/tlb_low_64e.S            |  204 ++++++++++++++++++++++++++++++
 arch/powerpc/mm/tlb_nohash.c             |   35 ++++--
 4 files changed, 264 insertions(+), 34 deletions(-)

diff --git a/arch/powerpc/include/asm/exception-64e.h b/arch/powerpc/include/asm/exception-64e.h
index 6d53f31..ac13add 100644
--- a/arch/powerpc/include/asm/exception-64e.h
+++ b/arch/powerpc/include/asm/exception-64e.h
@@ -48,30 +48,33 @@
 #define EX_R14		(4 * 8)
 #define EX_R15		(5 * 8)
 
-/* The TLB miss exception uses different slots */
+/*
+ * The TLB miss exception uses different slots.
+ *
+ * The bolted variant uses only the first six fields,
+ * which in combination with pgd and kernel_pgd fits in
+ * one 64-byte cache line.
+ */
 
 #define EX_TLB_R10	( 0 * 8)
 #define EX_TLB_R11	( 1 * 8)
-#define EX_TLB_R12	( 2 * 8)
-#define EX_TLB_R13	( 3 * 8)
-#define EX_TLB_R14	( 4 * 8)
-#define EX_TLB_R15	( 5 * 8)
-#define EX_TLB_R16	( 6 * 8)
-#define EX_TLB_CR	( 7 * 8)
+#define EX_TLB_R14	( 2 * 8)
+#define EX_TLB_R15	( 3 * 8)
+#define EX_TLB_R16	( 4 * 8)
+#define EX_TLB_CR	( 5 * 8)
+#define EX_TLB_R12	( 6 * 8)
+#define EX_TLB_R13	( 7 * 8)
 #define EX_TLB_DEAR	( 8 * 8) /* Level 0 and 2 only */
 #define EX_TLB_ESR	( 9 * 8) /* Level 0 and 2 only */
 #define EX_TLB_SRR0	(10 * 8)
 #define EX_TLB_SRR1	(11 * 8)
-#define EX_TLB_MMUCR0	(12 * 8) /* Level 0 */
-#define EX_TLB_MAS1	(12 * 8) /* Level 0 */
-#define EX_TLB_MAS2	(13 * 8) /* Level 0 */
 #ifdef CONFIG_BOOK3E_MMU_TLB_STATS
-#define EX_TLB_R8	(14 * 8)
-#define EX_TLB_R9	(15 * 8)
-#define EX_TLB_LR	(16 * 8)
-#define EX_TLB_SIZE	(17 * 8)
+#define EX_TLB_R8	(12 * 8)
+#define EX_TLB_R9	(13 * 8)
+#define EX_TLB_LR	(14 * 8)
+#define EX_TLB_SIZE	(15 * 8)
 #else
-#define EX_TLB_SIZE	(14 * 8)
+#define EX_TLB_SIZE	(12 * 8)
 #endif
 
 #define	START_EXCEPTION(label)						\
@@ -168,6 +171,16 @@ exc_##label##_book3e:
 	ld	r9,EX_TLB_R9(r12);					    \
 	ld	r8,EX_TLB_R8(r12);					    \
 	mtlr	r16;
+#define TLB_MISS_PROLOG_STATS_BOLTED						    \
+	mflr	r10;							    \
+	std	r8,PACA_EXTLB+EX_TLB_R8(r13);				    \
+	std	r9,PACA_EXTLB+EX_TLB_R9(r13);				    \
+	std	r10,PACA_EXTLB+EX_TLB_LR(r13);
+#define TLB_MISS_RESTORE_STATS_BOLTED					            \
+	ld	r16,PACA_EXTLB+EX_TLB_LR(r13);				    \
+	ld	r9,PACA_EXTLB+EX_TLB_R9(r13);				    \
+	ld	r8,PACA_EXTLB+EX_TLB_R8(r13);				    \
+	mtlr	r16;
 #define TLB_MISS_STATS_D(name)						    \
 	addi	r9,r13,MMSTAT_DSTATS+name;				    \
 	bl	.tlb_stat_inc;
@@ -183,17 +196,20 @@ exc_##label##_book3e:
 61:	addi	r9,r13,MMSTAT_ISTATS+name;				    \
 62:	bl	.tlb_stat_inc;
 #define TLB_MISS_STATS_SAVE_INFO					    \
-	std	r14,EX_TLB_ESR(r12);	/* save ESR */			    \
-
-
+	std	r14,EX_TLB_ESR(r12);	/* save ESR */
+#define TLB_MISS_STATS_SAVE_INFO_BOLTED					    \
+	std	r14,PACA_EXTLB+EX_TLB_ESR(r13);	/* save ESR */
 #else
 #define TLB_MISS_PROLOG_STATS
 #define TLB_MISS_RESTORE_STATS
+#define TLB_MISS_PROLOG_STATS_BOLTED
+#define TLB_MISS_RESTORE_STATS_BOLTED
 #define TLB_MISS_STATS_D(name)
 #define TLB_MISS_STATS_I(name)
 #define TLB_MISS_STATS_X(name)
 #define TLB_MISS_STATS_Y(name)
 #define TLB_MISS_STATS_SAVE_INFO
+#define TLB_MISS_STATS_SAVE_INFO_BOLTED
 #endif
 
 #define SET_IVOR(vector_number, vector_offset)	\
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 7412676..c1f65f5 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -103,11 +103,12 @@ struct paca_struct {
 #endif /* CONFIG_PPC_STD_MMU_64 */
 
 #ifdef CONFIG_PPC_BOOK3E
-	pgd_t *pgd;			/* Current PGD */
-	pgd_t *kernel_pgd;		/* Kernel PGD */
 	u64 exgen[8] __attribute__((aligned(0x80)));
+	/* Keep pgd in the same cacheline as the start of extlb */
+	pgd_t *pgd __attribute__((aligned(0x80))); /* Current PGD */
+	pgd_t *kernel_pgd;		/* Kernel PGD */
 	/* We can have up to 3 levels of reentrancy in the TLB miss handler */
-	u64 extlb[3][EX_TLB_SIZE / sizeof(u64)] __attribute__((aligned(0x80)));
+	u64 extlb[3][EX_TLB_SIZE / sizeof(u64)];
 	u64 exmc[8];		/* used for machine checks */
 	u64 excrit[8];		/* used for crit interrupts */
 	u64 exdbg[8];		/* used for debug interrupts */
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index af08922..d464841 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -30,6 +30,210 @@
 #define VPTE_PGD_SHIFT	(VPTE_PUD_SHIFT + PUD_INDEX_SIZE)
 #define VPTE_INDEX_SIZE (VPTE_PGD_SHIFT + PGD_INDEX_SIZE)
 
+/**********************************************************************
+ *                                                                    *
+ * TLB miss handling for Book3E with a bolted linear mapping          *
+ * No virtual page table, no nested TLB misses                        *
+ *                                                                    *
+ **********************************************************************/
+
+.macro tlb_prolog_bolted addr
+	mtspr	SPRN_SPRG_TLB_SCRATCH,r13
+	mfspr	r13,SPRN_SPRG_PACA
+	std	r10,PACA_EXTLB+EX_TLB_R10(r13)
+	mfcr	r10
+	std	r11,PACA_EXTLB+EX_TLB_R11(r13)
+	std	r16,PACA_EXTLB+EX_TLB_R16(r13)
+	mfspr	r16,\addr		/* get faulting address */
+	std	r14,PACA_EXTLB+EX_TLB_R14(r13)
+	ld	r14,PACAPGD(r13)
+	std	r15,PACA_EXTLB+EX_TLB_R15(r13)
+	std	r10,PACA_EXTLB+EX_TLB_CR(r13)
+	TLB_MISS_PROLOG_STATS_BOLTED
+.endm
+
+.macro tlb_epilog_bolted
+	ld	r14,PACA_EXTLB+EX_TLB_CR(r13)
+	ld	r10,PACA_EXTLB+EX_TLB_R10(r13)
+	ld	r11,PACA_EXTLB+EX_TLB_R11(r13)
+	mtcr	r14
+	ld	r14,PACA_EXTLB+EX_TLB_R14(r13)
+	ld	r15,PACA_EXTLB+EX_TLB_R15(r13)
+	TLB_MISS_RESTORE_STATS_BOLTED
+	ld	r16,PACA_EXTLB+EX_TLB_R16(r13)
+	mfspr	r13,SPRN_SPRG_TLB_SCRATCH
+.endm
+
+/* Data TLB miss */
+	START_EXCEPTION(data_tlb_miss_bolted)
+	tlb_prolog_bolted SPRN_DEAR
+
+	/* We need _PAGE_PRESENT and  _PAGE_ACCESSED set */
+
+	/* We do the user/kernel test for the PID here along with the RW test
+	 */
+	/* We pre-test some combination of permissions to avoid double
+	 * faults:
+	 *
+	 * We move the ESR:ST bit into the position of _PAGE_BAP_SW in the PTE
+	 * ESR_ST   is 0x00800000
+	 * _PAGE_BAP_SW is 0x00000010
+	 * So the shift is >> 19. This tests for supervisor writeability.
+	 * If the page happens to be supervisor writeable and not user
+	 * writeable, we will take a new fault later, but that should be
+	 * a rare enough case.
+	 *
+	 * We also move ESR_ST in _PAGE_DIRTY position
+	 * _PAGE_DIRTY is 0x00001000 so the shift is >> 11
+	 *
+	 * MAS1 is preset for all we need except for TID that needs to
+	 * be cleared for kernel translations
+	 */
+
+	mfspr	r11,SPRN_ESR
+
+	srdi	r15,r16,60		/* get region */
+	rldicl.	r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4
+	bne-	dtlb_miss_fault_bolted
+
+	rlwinm	r10,r11,32-19,27,27
+	rlwimi	r10,r11,32-16,19,19
+	cmpwi	r15,0
+	ori	r10,r10,_PAGE_PRESENT
+	oris	r11,r10,_PAGE_ACCESSED@h
+
+	TLB_MISS_STATS_SAVE_INFO_BOLTED
+	bne	tlb_miss_kernel_bolted
+
+tlb_miss_common_bolted:
+/*
+ * This is the guts of the TLB miss handler for bolted-linear.
+ * We are entered with:
+ *
+ * r16 = faulting address
+ * r15 = crap (free to use)
+ * r14 = page table base
+ * r13 = PACA
+ * r11 = PTE permission mask
+ * r10 = crap (free to use)
+ */
+	rldicl	r15,r16,64-PGDIR_SHIFT+3,64-PGD_INDEX_SIZE-3
+	cmpldi	cr0,r14,0
+	clrrdi	r15,r15,3
+	beq	tlb_miss_fault_bolted
+
+BEGIN_MMU_FTR_SECTION
+	/* Set the TLB reservation and search for existing entry. Then load
+	 * the entry.
+	 */
+	PPC_TLBSRX_DOT(0,r16)
+	ldx	r14,r14,r15
+	beq	normal_tlb_miss_done
+MMU_FTR_SECTION_ELSE
+	ldx	r14,r14,r15
+ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV)
+
+	rldicl	r15,r16,64-PUD_SHIFT+3,64-PUD_INDEX_SIZE-3
+	clrrdi	r15,r15,3
+
+	cmpldi	cr0,r14,0
+	beq	tlb_miss_fault_bolted
+
+	ldx	r14,r14,r15
+
+	rldicl	r15,r16,64-PMD_SHIFT+3,64-PMD_INDEX_SIZE-3
+	clrrdi	r15,r15,3
+
+	cmpldi	cr0,r14,0
+	beq	tlb_miss_fault_bolted
+
+	ldx	r14,r14,r15
+
+	rldicl	r15,r16,64-PAGE_SHIFT+3,64-PTE_INDEX_SIZE-3
+	clrrdi	r15,r15,3
+
+	cmpldi	cr0,r14,0
+	beq	tlb_miss_fault_bolted
+
+	ldx	r14,r14,r15
+
+	/* Check if required permissions are met */
+	andc.	r15,r11,r14
+	rldicr	r15,r14,64-(PTE_RPN_SHIFT-PAGE_SHIFT),63-PAGE_SHIFT
+	bne-	tlb_miss_fault_bolted
+
+	/* Now we build the MAS:
+	 *
+	 * MAS 0   :	Fully setup with defaults in MAS4 and TLBnCFG
+	 * MAS 1   :	Almost fully setup
+	 *               - PID already updated by caller if necessary
+	 *               - TSIZE need change if !base page size, not
+	 *                 yet implemented for now
+	 * MAS 2   :	Defaults not useful, need to be redone
+	 * MAS 3+7 :	Needs to be done
+	 */
+	clrrdi	r11,r16,12		/* Clear low crap in EA */
+	clrldi	r15,r15,12		/* Clear crap at the top */
+	rlwimi	r11,r14,32-19,27,31	/* Insert WIMGE */
+	rlwimi	r15,r14,32-8,22,25	/* Move in U bits */
+	mtspr	SPRN_MAS2,r11
+	andi.	r11,r14,_PAGE_DIRTY
+	rlwimi	r15,r14,32-2,26,31	/* Move in BAP bits */
+
+	/* Mask out SW and UW if !DIRTY (XXX optimize this !) */
+	bne	1f
+	li	r11,MAS3_SW|MAS3_UW
+	andc	r15,r15,r11
+1:
+	mtspr	SPRN_MAS7_MAS3,r15
+	tlbwe
+
+	TLB_MISS_STATS_X(MMSTAT_TLB_MISS_NORM_OK)
+	tlb_epilog_bolted
+	rfi
+
+itlb_miss_kernel_bolted:
+	li	r11,_PAGE_PRESENT|_PAGE_BAP_SX	/* Base perm */
+	oris	r11,r11,_PAGE_ACCESSED@h
+tlb_miss_kernel_bolted:
+	mfspr	r10,SPRN_MAS1
+	ld	r14,PACA_KERNELPGD(r13)
+	cmpldi	cr0,r15,8		/* Check for vmalloc region */
+	rlwinm	r10,r10,0,16,1		/* Clear TID */
+	mtspr	SPRN_MAS1,r10
+	beq+	tlb_miss_common_bolted
+
+tlb_miss_fault_bolted:
+	/* We need to check if it was an instruction miss */
+	andi.	r10,r11,_PAGE_EXEC|_PAGE_BAP_SX
+	bne	itlb_miss_fault_bolted
+dtlb_miss_fault_bolted:
+	TLB_MISS_STATS_D(MMSTAT_TLB_MISS_NORM_FAULT)
+	tlb_epilog_bolted
+	b	exc_data_storage_book3e
+itlb_miss_fault_bolted:
+	TLB_MISS_STATS_I(MMSTAT_TLB_MISS_NORM_FAULT)
+	tlb_epilog_bolted
+	b	exc_instruction_storage_book3e
+
+/* Instruction TLB miss */
+	START_EXCEPTION(instruction_tlb_miss_bolted)
+	tlb_prolog_bolted SPRN_SRR0
+
+	rldicl.	r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4
+	srdi	r15,r16,60		/* get region */
+	TLB_MISS_STATS_SAVE_INFO_BOLTED
+	bne-	itlb_miss_fault_bolted
+
+	li	r11,_PAGE_PRESENT|_PAGE_EXEC	/* Base perm */
+
+	/* We do the user/kernel test for the PID here along with the RW test
+	 */
+
+	cmpldi	cr0,r15,0			/* Check for user region */
+	oris	r11,r11,_PAGE_ACCESSED@h
+	beq	tlb_miss_common_bolted
+	b	itlb_miss_kernel_bolted
 
 /**********************************************************************
  *                                                                    *
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index 5693499..3722185 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -443,14 +443,27 @@ static void setup_page_sizes(void)
 	}
 }
 
-static void setup_mmu_htw(void)
+static void __patch_exception(int exc, unsigned long addr)
 {
 	extern unsigned int interrupt_base_book3e;
-	extern unsigned int exc_data_tlb_miss_htw_book3e;
-	extern unsigned int exc_instruction_tlb_miss_htw_book3e;
+ 	unsigned int *ibase = &interrupt_base_book3e;
+ 
+	/* Our exceptions vectors start with a NOP and -then- a branch
+	 * to deal with single stepping from userspace which stops on
+	 * the second instruction. Thus we need to patch the second
+	 * instruction of the exception, not the first one
+	 */
+
+	patch_branch(ibase + (exc / 4) + 1, addr, 0);
+}
 
-	unsigned int *ibase = &interrupt_base_book3e;
+#define patch_exception(exc, name) do { \
+	extern unsigned int name; \
+	__patch_exception((exc), (unsigned long)&name); \
+} while (0)
 
+static void setup_mmu_htw(void)
+{
 	/* Check if HW tablewalk is present, and if yes, enable it by:
 	 *
 	 * - patching the TLB miss handlers to branch to the
@@ -462,15 +475,8 @@ static void setup_mmu_htw(void)
 
 	if ((tlb0cfg & TLBnCFG_IND) &&
 	    (tlb0cfg & TLBnCFG_PT)) {
-		/* Our exceptions vectors start with a NOP and -then- a branch
-		 * to deal with single stepping from userspace which stops on
-		 * the second instruction. Thus we need to patch the second
-		 * instruction of the exception, not the first one
-		 */
-		patch_branch(ibase + (0x1c0 / 4) + 1,
-			     (unsigned long)&exc_data_tlb_miss_htw_book3e, 0);
-		patch_branch(ibase + (0x1e0 / 4) + 1,
-			     (unsigned long)&exc_instruction_tlb_miss_htw_book3e, 0);
+		patch_exception(0x1c0, exc_data_tlb_miss_htw_book3e);
+		patch_exception(0x1e0, exc_instruction_tlb_miss_htw_book3e);
 		book3e_htw_enabled = 1;
 	}
 	pr_info("MMU: Book3E HW tablewalk %s\n",
@@ -549,6 +555,9 @@ static void __early_init_mmu(int boot_cpu)
 		/* limit memory so we dont have linear faults */
 		memblock_enforce_memory_limit(linear_map_top);
 		memblock_analyze();
+
+		patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e);
+		patch_exception(0x1e0, exc_instruction_tlb_miss_bolted_book3e);
 	}
 #endif
 
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH] powerpc/book3e-64: use a separate TLB handler when linear map is bolted
From: Benjamin Herrenschmidt @ 2011-06-22 22:05 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <20110622162457.1016390e@schlenkerla.am.freescale.net>

On Wed, 2011-06-22 at 16:24 -0500, Scott Wood wrote:
> 
> This saved another 1% or so.  I don't think TLB_SCRATCH needs to be saved
> by crit/debug/mcheck -- they shouldn't be taking TLB misses, at least
> in the bolted case.  

The code they call will (think accessing the UART)

> Even non-bolted, it doesn't look like there are enough
> extlb levels to deal with a linear TLB miss inside a crit/debug/mcheck
> inside a linear TLB miss inside a virtual page table miss inside a normal
> TLB miss.

My plan for crit/debug/mcheck (which I haven't implemented yet) was to
save the whole TLB save area onto the kernel stack and restore it.
 
> Currently, we could just as well take that crit/debug/mcheck after
> storing to TLB_SCRATCH but before saving it to extlb, and have the same
> problem.

Right. My point was more that TLB_SCRATCH itself shall be saved
somewhere by the crit/debug/mcheck handler along with the copy of the
TLB save area.

Cheers,
Ben.

^ permalink raw reply

* [PATCH] powerpc/e500mc: Add support for the wait instruction in e500_idle
From: Scott Wood @ 2011-06-22 23:10 UTC (permalink / raw)
  To: galak; +Cc: linuxppc-dev

e500mc cannot doze or nap due to an erratum (as well as having a
different mechanism than previous e500), but it has a "wait" instruction
that is similar to doze.

On 64-bit, due to the soft-irq-disable mechanism, the existing
book3e_idle should be used instead.

Signed-off-by: Vakul Garg <vakul@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/kernel/idle_e500.S        |   12 ++++++++++++
 arch/powerpc/platforms/85xx/p3041_ds.c |    1 +
 arch/powerpc/platforms/85xx/p4080_ds.c |    1 +
 arch/powerpc/platforms/85xx/p5020_ds.c |    5 +++++
 4 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/idle_e500.S b/arch/powerpc/kernel/idle_e500.S
index 47a1a98..3e2b95c 100644
--- a/arch/powerpc/kernel/idle_e500.S
+++ b/arch/powerpc/kernel/idle_e500.S
@@ -26,6 +26,17 @@ _GLOBAL(e500_idle)
 	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
 	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
 
+#ifdef CONFIG_E500MC
+	wrteei	1
+1:	wait
+
+	/*
+	 * Guard against spurious wakeups (e.g. from a hypervisor) --
+	 * any real interrupt will cause us to return to LR due to
+	 * _TLF_NAPPING.
+	 */
+	b	1b
+#else
 	/* Check if we can nap or doze, put HID0 mask in r3 */
 	lis	r3,0
 BEGIN_FTR_SECTION
@@ -72,6 +83,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_L2CSR|CPU_FTR_CAN_NAP)
 	mtmsr	r7
 	isync
 2:	b	2b
+#endif /* !E500MC */
 
 /*
  * Return from NAP/DOZE mode, restore some CPU specific registers,
diff --git a/arch/powerpc/platforms/85xx/p3041_ds.c b/arch/powerpc/platforms/85xx/p3041_ds.c
index 0ed52e1..3611330 100644
--- a/arch/powerpc/platforms/85xx/p3041_ds.c
+++ b/arch/powerpc/platforms/85xx/p3041_ds.c
@@ -55,6 +55,7 @@ define_machine(p3041_ds) {
 	.restart		= fsl_rstcr_restart,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
+	.power_save		= e500_idle,
 };
 
 machine_device_initcall(p3041_ds, corenet_ds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/p4080_ds.c b/arch/powerpc/platforms/85xx/p4080_ds.c
index 8417046..98c7e6a 100644
--- a/arch/powerpc/platforms/85xx/p4080_ds.c
+++ b/arch/powerpc/platforms/85xx/p4080_ds.c
@@ -68,6 +68,7 @@ define_machine(p4080_ds) {
 	.restart		= fsl_rstcr_restart,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
+	.power_save		= e500_idle,
 };
 
 machine_device_initcall(p4080_ds, corenet_ds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/p5020_ds.c b/arch/powerpc/platforms/85xx/p5020_ds.c
index 7467b71..aa2e494 100644
--- a/arch/powerpc/platforms/85xx/p5020_ds.c
+++ b/arch/powerpc/platforms/85xx/p5020_ds.c
@@ -60,6 +60,11 @@ define_machine(p5020_ds) {
 	.restart		= fsl_rstcr_restart,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
+#ifdef CONFIG_PPC64
+	.power_save		= book3e_idle,
+#else
+	.power_save		= e500_idle,
+#endif
 };
 
 machine_device_initcall(p5020_ds, corenet_ds_publish_devices);
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH] powerpc, 460gt: Add 460gt as compatible in the check for 460ex-compatible crypto
From: Segher Boessenkool @ 2011-06-22 23:24 UTC (permalink / raw)
  To: Mike Williams; +Cc: linuxppc-dev
In-Reply-To: <1308771051-30861-1-git-send-email-mike@mikebwilliams.com>

> -	if (of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-crypto")) {
> +	if (of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-crypto") ||
> +	    of_find_compatible_node(NULL, NULL, "amcc,ppc460gt-crypto")) {

If the device is actually compatible, the device tree node should claim
it is, and you do not need this code change.


Segher

^ permalink raw reply

* [git pull] Please pull powerpc.git merge branch
From: Kumar Gala @ 2011-06-23  2:41 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

The following changes since commit 56299378726d5f2ba8d3c8cbbd13cb280ba45e4f:
  Linus Torvalds (1):
        Linux 3.0-rc4

are available in the git repository at:

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

Scott Wood (1):
      powerpc/e500: fix breakage with fsl_rio_mcheck_exception

Shaohui Xie (1):
      powerpc/85xx: fix NAND_CMD_READID read bytes number

Timur Tabi (1):
      powerpc/p1022ds: fix audio-related properties in the device tree

 arch/powerpc/boot/dts/p1022ds.dts |    9 ++++++---
 arch/powerpc/kernel/traps.c       |    2 +-
 arch/powerpc/sysdev/fsl_rio.c     |   33 +++++++++++++++++----------------
 drivers/mtd/nand/fsl_elbc_nand.c  |    6 +++---
 4 files changed, 27 insertions(+), 23 deletions(-)

^ permalink raw reply

* Re: [PATCH] libata/sas: only set FROZEN flag if new EH is supported
From: Benjamin Herrenschmidt @ 2011-06-23  4:31 UTC (permalink / raw)
  To: Brian King
  Cc: jgarzik, wayneb, linux-kernel, linux-ide, mbizon, Tejun Heo,
	Nishanth Aravamudan, linuxppc-dev
In-Reply-To: <4E00FF58.7070802@linux.vnet.ibm.com>

On Tue, 2011-06-21 at 15:30 -0500, Brian King wrote:
> Looks good to me. Jeff/Tejun - any issues with merging this?

BTW. Current upstream with that patch applied on a machine here leads to
several oddities, I don't know at this point whether any of that is
actually a regression :




> Thanks,
> 
> Brian
> 
> On 06/21/2011 11:07 AM, Nishanth Aravamudan wrote:
> > Ping on this -- Tejun, Brian, Jeff, this is a pretty annoying 2.6.39
> > regression which it would be good to have fixed in 3.0.
> > 
> > Thanks,
> > Nish
> > 
> > On 16.06.2011 [08:28:36 -0700], Nishanth Aravamudan wrote:
> >> On 16.06.2011 [08:28:39 -0500], Brian King wrote:
> >>> On 06/16/2011 02:51 AM, Tejun Heo wrote:
> >>>> On Wed, Jun 15, 2011 at 04:34:17PM -0700, Nishanth Aravamudan wrote:
> >>>>>> That looks like the right thing to do. For ipr's usage of
> >>>>>> libata, we don't have the concept of a port frozen state, so this flag
> >>>>>> should really never get set. The alternate way to fix this would be to
> >>>>>> only set ATA_PFLAG_FROZEN in ata_port_alloc if ap->ops->error_handler
> >>>>>> is not NULL.
> >>>>>
> >>>>> It seemed like ipr is as you say, but I wasn't sure if it was
> >>>>> appropriate to make the change above in the common libata-scis code or
> >>>>> not. I don't want to break some other device on accident.
> >>>>>
> >>>>> Also, I tried your suggestion, but I don't think that can happen in
> >>>>> ata_port_alloc? ata_port_alloc is allocated ap itself, and it seems like
> >>>>> ap->ops typically gets set only after ata_port_alloc returns?
> >>>>
> >>>> Maybe we can test error_handler in ata_sas_port_start()?
> >>>
> >>> Good point. Since libsas is converted to the new eh now, we would need to have
> >>> this test.
> >>
> >> Commit 7b3a24c57d2eeda8dba9c205342b12689c4679f9 ("ahci: don't enable
> >> port irq before handler is registered") caused a regression for CD-ROMs
> >> attached to the IPR SATA bus on Power machines:
> >>
> >>   ata_port_alloc: ENTER
> >>   ata_port_probe: ata1: bus probe begin
> >>   ata1.00: ata_dev_read_id: ENTER
> >>   ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
> >>   ata1.00: ata_dev_read_id: ENTER
> >>   ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
> >>   ata1.00: limiting speed to UDMA7:PIO5
> >>   ata1.00: ata_dev_read_id: ENTER
> >>   ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
> >>   ata1.00: disabled
> >>   ata_port_probe: ata1: bus probe end
> >>   scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
> >>
> >> The FROZEN flag added in that commit is only cleared by the new EH code,
> >> which is not used by ipr. Clear this flag in the SAS code if we don't
> >> support new EH.
> >>
> >> Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> >>
> >> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> >> index d51f979..ebe1685 100644
> >> --- a/drivers/ata/libata-scsi.c
> >> +++ b/drivers/ata/libata-scsi.c
> >> @@ -3797,6 +3797,12 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
> >>   */
> >>  int ata_sas_port_start(struct ata_port *ap)
> >>  {
> >> +	/*
> >> +	 * the port is marked as frozen at allocation time, but if we don't
> >> +	 * have new eh, we won't thaw it
> >> +	 */
> >> +	if (!ap->ops->error_handler)
> >> +		ap->pflags &= ~ATA_PFLAG_FROZEN;
> >>  	return 0;
> >>  }
> >>  EXPORT_SYMBOL_GPL(ata_sas_port_start);
> >>
> >>
> >> -- 
> >> Nishanth Aravamudan <nacc@us.ibm.com>
> >> IBM Linux Technology Center
> > 
> 
> 

^ permalink raw reply

* Re: [PATCH] libata/sas: only set FROZEN flag if new EH is supported
From: Benjamin Herrenschmidt @ 2011-06-23  4:42 UTC (permalink / raw)
  To: Brian King
  Cc: jgarzik, wayneb, linux-kernel, linux-ide, mbizon, Tejun Heo,
	Nishanth Aravamudan, linuxppc-dev
In-Reply-To: <1308803461.32158.191.camel@pasglop>

On Thu, 2011-06-23 at 14:31 +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2011-06-21 at 15:30 -0500, Brian King wrote:
> > Looks good to me. Jeff/Tejun - any issues with merging this?
> 
> BTW. Current upstream with that patch applied on a machine here leads to
> several oddities, I don't know at this point whether any of that is
> actually a regression :

Ooops... pressed "send" too quickly. Here's a log excerpt with some
comments:

ipr: IBM Power RAID SCSI Device Driver version: 2.5.2 (April 27, 2011)
ipr 0000:04:00.0: Found IOA with IRQ: 129
ipr 0000:04:00.0: Initializing IOA.
ipr 0000:04:00.0: Starting IOA initialization sequence.
ipr 0000:04:00.0: Adapter firmware version: 04220029
ipr 0000:04:00.0: IOA initialized.
scsi0 : IBM 2B4C Storage Adapter
scsi 0:0:4:0: Direct-Access     IBM      ST9300603SS      BB09 PQ: 0 ANSI: 6
scsi scan: INQUIRY result too short (5), using 36

-> Are these odd INQUIRY results expected ?

scsi 0:0:5:0: Direct-Access                                    PQ: 0 ANSI: 0
scsi 0:0:6:0: Direct-Access     IBM      ST9300603SS      BB09 PQ: 0 ANSI: 6
scsi 0:0:7:0: Direct-Access     IBM      ST9300603SS      BB09 PQ: 0 ANSI: 6
scsi scan: INQUIRY result too short (5), using 36
scsi 0:0:18:0: Direct-Access                                    PQ: 0 ANSI: 0
scsi 0:2:18:0: Enclosure         IBM      PSBPD6E4A  3GSAS 0109 PQ: 0 ANSI: 4
scsi: unknown device type 31
scsi 0:255:255:255: No Device         IBM      2B4C001SISIOA    0150 PQ: 0 ANSI: 0

-> The above looks odd, not sure what it means

ipr 0000:05:00.0: Found IOA with IRQ: 130
ipr 0000:05:00.0: Initializing IOA.
scsi 0:254:0:0: Processor         IBM      57CB001SISIOA    0150 PQ: 0 ANSI: 0
ipr 0000:05:00.0: Starting IOA initialization sequence.
ipr 0000:05:00.0: Adapter firmware version: 04220029
ipr 0000:05:00.0: IOA initialized.
scsi1 : IBM 57CB Storage Adapter
scsi scan: INQUIRY result too short (5), using 36
scsi 1:0:4:0: Direct-Access                                    PQ: 0 ANSI: 0
scsi 1:0:5:0: Direct-Access     IBM      ST9300603SS      BB09 PQ: 0 ANSI: 6
scsi scan: INQUIRY result too short (5), using 36
scsi 1:0:6:0: Direct-Access                                    PQ: 0 ANSI: 0
scsi 1:0:7:0: Direct-Access     IBM      ST9300603SS      BB09 PQ: 0 ANSI: 6
scsi 1:0:18:0: Enclosure         IBM      PSBPD6E4A  3GSAS 0109 PQ: 0 ANSI: 4
scsi: On host 1 channel 0 id 18 only 511 (max_scsi_report_luns) of 402653184 luns reported, try increasing max_scsi_report_luns.
scsi: host 1 channel 0 id 18 lun 0xc0000007f01e810f has a LUN larger than currently supported.

-> Now that looks horribly wrong... that LUN number looks like a kernel pointer

scsi scan: INQUIRY result too short (5), using 36
scsi 1:2:18:0: Direct-Access                                    PQ: 0 ANSI: 0
ata1.00: ATAPI: IBM     RMBO0040532, SA61, max UDMA/100
ata1.00: failed to IDENTIFY (device reports invalid type, err_mask=0x0)
ata1.00: revalidation failed (errno=-22)
ata1.00: disabled

-> So SATA works "better" with the patch but doesn't actually work properly :-)

scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured

-> That error could give us more info... not sure what it means, we do have plenty of 
memory...
 
scsi 1:8:0:0: Enclosure         IBM      VSBPD6E4B  3GSAS   01 PQ: 0 ANSI: 2
scsi: unknown device type 31
scsi 1:255:255:255: No Device         IBM      57CB001SISIOA    0150 PQ: 0 ANSI: 0
work_for_cpu used greatest stack depth: 9520 bytes left
st: Version 20101219, fixed bufsize 32768, s/g segs 256
sd 0:0:4:0: [sda] 585937500 512-byte logical blocks: (300 GB/279 GiB)
sd 0:0:5:0: [sdb] 585937500 512-byte logical blocks: (300 GB/279 GiB)
sd 0:0:6:0: [sdc] 585937500 512-byte logical blocks: (300 GB/279 GiB)
sd 0:0:7:0: [sdd] 585937500 512-byte logical blocks: (300 GB/279 GiB)
sd 0:0:18:0: [sde] READ CAPACITY failed
sd 0:0:18:0: [sde]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sd 0:0:18:0: [sde]  Sense Key : Illegal Request [current] 
sd 0:0:18:0: [sde]  Add. Sense: Invalid command operation code

-> Any idea what's up with that guy ?

sd 0:0:4:0: Attached scsi generic sg0 type 0
sd 0:0:5:0: [sdb] Write Protect is off
sd 0:0:5:0: Attached scsi generic sg1 type 0
sd 0:0:18:0: [sde] Test WP failed, assume Write Enabled
sd 0:0:6:0: Attached scsi generic sg2 type 0
sd 0:0:18:0: [sde] Asking for cache data failed
sd 0:0:7:0: Attached scsi generic sg3 type 0
sd 0:0:18:0: [sde] Assuming drive cache: write through
sd 1:2:18:0: [sdj] READ CAPACITY failed
sd 1:2:18:0: [sdj]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sd 1:2:18:0: [sdj]  Sense Key : Illegal Request [current] 
sd 1:2:18:0: [sdj]  Add. Sense: Invalid command operation code

-> And this one ?

There's more below ...

sd 0:0:18:0: Attached scsi generic sg4 type 0
sd 1:0:4:0: [sdf] 585937500 512-byte logical blocks: (300 GB/279 GiB)
scsi 0:2:18:0: Attached scsi generic sg5 type 13
sd 1:0:6:0: [sdh] 585937500 512-byte logical blocks: (300 GB/279 GiB)
scsi 0:255:255:255: Attached scsi generic sg6 type 31
scsi 0:254:0:0: Attached scsi generic sg7 type 3
sd 1:0:4:0: Attached scsi generic sg8 type 0
sd 1:2:18:0: [sdj] Test WP failed, assume Write Enabled
sd 1:0:5:0: Attached scsi generic sg9 type 0
sd 1:0:6:0: Attached scsi generic sg10 type 0
sd 1:0:7:0: [sdi] 585937500 512-byte logical blocks: (300 GB/279 GiB)
sd 1:2:18:0: [sdj] Asking for cache data failed
sd 1:2:18:0: [sdj] Assuming drive cache: write through
sd 1:0:7:0: Attached scsi generic sg11 type 0
scsi 1:0:18:0: Attached scsi generic sg12 type 13
sd 0:0:4:0: [sda] Write Protect is off
sd 1:2:18:0: Attached scsi generic sg13 type 0
sd 0:0:18:0: [sde] READ CAPACITY failed
sd 0:0:18:0: [sde]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sd 0:0:18:0: [sde]  Sense Key : Illegal Request [current] 
sd 0:0:18:0: [sde]  Add. Sense: Invalid command operation code
scsi 1:8:0:0: Attached scsi generic sg14 type 13
scsi 1:255:255:255: Attached scsi generic sg15 type 31
e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
e1000: Copyright (c) 1999-2006 Intel Corporation.
e1000e: Intel(R) PRO/1000 Network Driver - 1.3.10-k2
e1000e: Copyright(c) 1999 - 2011 Intel Corporation.
sd 1:0:6:0: [sdh] Write Protect is off
sd 0:0:5:0: [sdb] Write cache: disabled, read cache: enabled, supports DPO and FUA
sd 0:0:18:0: [sde] Test WP failed, assume Write Enabled
sd 0:0:7:0: [sdd] Write Protect is off
sd 1:2:18:0: [sdj] READ CAPACITY failed
sd 1:2:18:0: [sdj]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sd 1:2:18:0: [sdj]  Sense Key : Illegal Request [current] 
sd 1:2:18:0: [sdj]  Add. Sense: Invalid command operation code
sd 0:0:18:0: [sde] Asking for cache data failed
sd 0:0:18:0: [sde] Assuming drive cache: write through
sd 0:0:18:0: [sde] Attached SCSI disk
sd 1:0:5:0: [sdg] 585937500 512-byte logical blocks: (300 GB/279 GiB)
sd 1:0:4:0: [sdf] Write Protect is off
sd 1:2:18:0: [sdj] Test WP failed, assume Write Enabled
sd 0:0:6:0: [sdc] Write Protect is off
sd 1:2:18:0: [sdj] Asking for cache data failed
sd 1:2:18:0: [sdj] Assuming drive cache: write through
sd 1:2:18:0: [sdj] Attached SCSI disk
sd 0:0:7:0: [sdd] Write cache: disabled, read cache: enabled, supports DPO and FUA
sd 0:0:4:0: [sda] Write cache: disabled, read cache: enabled, supports DPO and FUA
sd 1:0:6:0: [sdh] Write cache: disabled, read cache: enabled, supports DPO and FUA
sd 1:0:4:0: [sdf] Write cache: disabled, read cache: enabled, supports DPO and FUA
sd 1:0:5:0: [sdg] Write Protect is off
sd 1:0:7:0: [sdi] Write Protect is off
sd 0:0:6:0: [sdc] Write cache: disabled, read cache: enabled, supports DPO and FUA
sd 1:0:7:0: [sdi] Write cache: disabled, read cache: enabled, supports DPO and FUA
sd 1:0:5:0: [sdg] Write cache: disabled, read cache: enabled, supports DPO and FUA
 sdb: unknown partition table
 sdd: unknown partition table
 sdh: unknown partition table
 sdi: unknown partition table
 sdf: [AIX] unknown partition table
 sdg: unknown partition table
e1000e 0002:03:00.0: Disabling ASPM  L1
 sdc: unknown partition table
e1000e 0002:03:00.0: (unregistered net_device): Failed to initialize MSI interrupts.  Falling back to legacy interrupts.
scsi 1:254:0:0: Processor         IBM      2B4C001SISIOA    0150 PQ: 0 ANSI: 0
 sda: [AIX] unknown partition table
sd 0:0:5:0: [sdb] Attached SCSI disk
sd 1:0:6:0: [sdh] Attached SCSI disk
sd 1:0:7:0: [sdi] Attached SCSI disk
sd 0:0:6:0: [sdc] Attached SCSI disk
sd 1:0:5:0: [sdg] Attached SCSI disk
sd 0:0:7:0: [sdd] Attached SCSI disk
scsi 1:254:0:0: Attached scsi generic sg16 type 3
sd 1:0:4:0: [sdf] Attached SCSI disk
sd 0:0:4:0: [sda] Attached SCSI disk

Cheers,
Ben.
> 
> 
> > Thanks,
> > 
> > Brian
> > 
> > On 06/21/2011 11:07 AM, Nishanth Aravamudan wrote:
> > > Ping on this -- Tejun, Brian, Jeff, this is a pretty annoying 2.6.39
> > > regression which it would be good to have fixed in 3.0.
> > > 
> > > Thanks,
> > > Nish
> > > 
> > > On 16.06.2011 [08:28:36 -0700], Nishanth Aravamudan wrote:
> > >> On 16.06.2011 [08:28:39 -0500], Brian King wrote:
> > >>> On 06/16/2011 02:51 AM, Tejun Heo wrote:
> > >>>> On Wed, Jun 15, 2011 at 04:34:17PM -0700, Nishanth Aravamudan wrote:
> > >>>>>> That looks like the right thing to do. For ipr's usage of
> > >>>>>> libata, we don't have the concept of a port frozen state, so this flag
> > >>>>>> should really never get set. The alternate way to fix this would be to
> > >>>>>> only set ATA_PFLAG_FROZEN in ata_port_alloc if ap->ops->error_handler
> > >>>>>> is not NULL.
> > >>>>>
> > >>>>> It seemed like ipr is as you say, but I wasn't sure if it was
> > >>>>> appropriate to make the change above in the common libata-scis code or
> > >>>>> not. I don't want to break some other device on accident.
> > >>>>>
> > >>>>> Also, I tried your suggestion, but I don't think that can happen in
> > >>>>> ata_port_alloc? ata_port_alloc is allocated ap itself, and it seems like
> > >>>>> ap->ops typically gets set only after ata_port_alloc returns?
> > >>>>
> > >>>> Maybe we can test error_handler in ata_sas_port_start()?
> > >>>
> > >>> Good point. Since libsas is converted to the new eh now, we would need to have
> > >>> this test.
> > >>
> > >> Commit 7b3a24c57d2eeda8dba9c205342b12689c4679f9 ("ahci: don't enable
> > >> port irq before handler is registered") caused a regression for CD-ROMs
> > >> attached to the IPR SATA bus on Power machines:
> > >>
> > >>   ata_port_alloc: ENTER
> > >>   ata_port_probe: ata1: bus probe begin
> > >>   ata1.00: ata_dev_read_id: ENTER
> > >>   ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
> > >>   ata1.00: ata_dev_read_id: ENTER
> > >>   ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
> > >>   ata1.00: limiting speed to UDMA7:PIO5
> > >>   ata1.00: ata_dev_read_id: ENTER
> > >>   ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
> > >>   ata1.00: disabled
> > >>   ata_port_probe: ata1: bus probe end
> > >>   scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
> > >>
> > >> The FROZEN flag added in that commit is only cleared by the new EH code,
> > >> which is not used by ipr. Clear this flag in the SAS code if we don't
> > >> support new EH.
> > >>
> > >> Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > >> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> > >>
> > >> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> > >> index d51f979..ebe1685 100644
> > >> --- a/drivers/ata/libata-scsi.c
> > >> +++ b/drivers/ata/libata-scsi.c
> > >> @@ -3797,6 +3797,12 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
> > >>   */
> > >>  int ata_sas_port_start(struct ata_port *ap)
> > >>  {
> > >> +	/*
> > >> +	 * the port is marked as frozen at allocation time, but if we don't
> > >> +	 * have new eh, we won't thaw it
> > >> +	 */
> > >> +	if (!ap->ops->error_handler)
> > >> +		ap->pflags &= ~ATA_PFLAG_FROZEN;
> > >>  	return 0;
> > >>  }
> > >>  EXPORT_SYMBOL_GPL(ata_sas_port_start);
> > >>
> > >>
> > >> -- 
> > >> Nishanth Aravamudan <nacc@us.ibm.com>
> > >> IBM Linux Technology Center
> > > 
> > 
> > 
> 

^ permalink raw reply

* Re: [PATCH] libata/sas: only set FROZEN flag if new EH is supported
From: Benjamin Herrenschmidt @ 2011-06-23  5:10 UTC (permalink / raw)
  To: Brian King
  Cc: jgarzik, wayneb, linux-kernel, linux-ide, mbizon, Tejun Heo,
	Nishanth Aravamudan, linuxppc-dev
In-Reply-To: <1308804120.32158.202.camel@pasglop>

On Thu, 2011-06-23 at 14:42 +1000, Benjamin Herrenschmidt wrote:
> On Thu, 2011-06-23 at 14:31 +1000, Benjamin Herrenschmidt wrote:
> > On Tue, 2011-06-21 at 15:30 -0500, Brian King wrote:
> > > Looks good to me. Jeff/Tejun - any issues with merging this?
> > 
> > BTW. Current upstream with that patch applied on a machine here leads to
> > several oddities, I don't know at this point whether any of that is
> > actually a regression :
> 
> Ooops... pressed "send" too quickly. Here's a log excerpt with some
> comments:

 .../...

Ok so most of that is already in 2.6.39, including the odd LUN, so
nothing new under the sun.

I'll do more digging / bisection...

Ben.

^ permalink raw reply

* RE: [PATCH] powerpc/85xx:DTS: Fix tbi node location for Px020RDB
From: Aggrwal Poonam-B10812 @ 2011-06-23  7:24 UTC (permalink / raw)
  To: Kumar Gala, Kushwaha Prabhakar-B32579
  Cc: meet2prabhu@gmail.com, devicetree-discuss@lists.ozlabs.org,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <F9CD495E-12BF-467D-BE96-CC11486F70B8@kernel.crashing.org>



> -----Original Message-----
> From: linuxppc-dev-bounces+poonam.aggrwal=3Dfreescale.com@lists.ozlabs.or=
g
> [mailto:linuxppc-dev-
> bounces+poonam.aggrwal=3Dfreescale.com@lists.ozlabs.org] On Behalf Of Kum=
ar
> Gala
> Sent: Wednesday, June 22, 2011 5:04 PM
> To: Kushwaha Prabhakar-B32579
> Cc: meet2prabhu@gmail.com; devicetree-discuss@lists.ozlabs.org; linuxppc-
> dev@lists.ozlabs.org
> Subject: Re: [PATCH] powerpc/85xx:DTS: Fix tbi node location for Px020RDB
>=20
>=20
> On Jun 7, 2011, at 9:49 PM, Prabhakar Kushwaha wrote:
>=20
> > ten-bit interface (TBI) module is part of SoC not board.
> >
> > Move tbi entries from board related dts files to Si dts.
> >
> > Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
> > ---
> > Based upon
> http://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git (branch
> next)
> >
> > arch/powerpc/boot/dts/p1020rdb.dts            |    9 ---------
> > arch/powerpc/boot/dts/p1020rdb_camp_core0.dts |    8 --------
> > arch/powerpc/boot/dts/p1020si.dtsi            |    6 +++++-
> > arch/powerpc/boot/dts/p2020rdb.dts            |    8 --------
> > arch/powerpc/boot/dts/p2020rdb_camp_core0.dts |    8 --------
> > arch/powerpc/boot/dts/p2020si.dtsi            |    6 +++++-
> > 6 files changed, 10 insertions(+), 35 deletions(-)
> >
> > diff --git a/arch/powerpc/boot/dts/p1020rdb.dts
> b/arch/powerpc/boot/dts/p1020rdb.dts
> > index d6a8ae4..a4e5d6c 100644
> > --- a/arch/powerpc/boot/dts/p1020rdb.dts
> > +++ b/arch/powerpc/boot/dts/p1020rdb.dts
> > @@ -211,14 +211,6 @@
> > 			};
> > 		};
> >
> > -		mdio@25000 {
> > -
> > -			tbi0: tbi-phy@11 {
> > -				reg =3D <0x11>;
> > -				device_type =3D "tbi-phy";
> > -			};
> > -		};
> > -
> > 		enet0: ethernet@b0000 {
> > 			fixed-link =3D <1 1 1000 0 0>;
> > 			phy-connection-type =3D "rgmii-id";
> > @@ -227,7 +219,6 @@
> >
> > 		enet1: ethernet@b1000 {
> > 			phy-handle =3D <&phy0>;
> > -			tbi-handle =3D <&tbi0>;
> > 			phy-connection-type =3D "sgmii";
> >
> > 		};
>=20
> I'm not sure we should do this.  The phy address we pick is board
> specific so it should NOT be in .dtsi
The TBI phy and it's address is internal to SOC.

Regards
Poonam
>=20
> - k
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* RE: NAND BBT corruption on MPC83xx
From: Artem Bityutskiy @ 2011-06-23  8:31 UTC (permalink / raw)
  To: Atlant Schmidt
  Cc: Scott Wood, linuxppc-dev@lists.ozlabs.org,
	linux-mtd@lists.infradead.org, Matthew L. Creech,
	'Mike Hench'
In-Reply-To: <0A40042D85E7C84DB443060EC44B3FD32A7208F91B@dekaexchange07.deka.local>

On Mon, 2011-06-20 at 07:22 -0400, Atlant Schmidt wrote:
> 
>   As far as I know (and I'm sure the list will correct
>   me if I'm wrong! ;-) ), neither UBI nor UBIFS nor any
>   Linux layer provides this routine scrubbing; you have
>   to code it up yourself, probably by accessing the
>   device at the UBI (underlying block device/LEB) layer. 

UBI will scrub all LEBs with bit-flips once they are read.
But if you have bit-flips in an LEB and it is never read, it will never
be scrubbed. And erasures of the neighboring PEBs may turn bit-flips
into hard errors.

To force scrubbing, the easies way is to just read all volumes, like

dd if=/dev/ubi0_i of=/dev/null bs=4096

for each i.

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply

* Re: [PATCH] powerpc/85xx:DTS: Fix tbi node location for Px020RDB
From: Kumar Gala @ 2011-06-23 10:27 UTC (permalink / raw)
  To: Aggrwal Poonam-B10812
  Cc: meet2prabhu@gmail.com, devicetree-discuss@lists.ozlabs.org,
	linuxppc-dev@lists.ozlabs.org, Kushwaha Prabhakar-B32579
In-Reply-To: <45903308677306428B6EE7E6FF5A52041419B6@039-SN1MPN1-004.039d.mgd.msft.net>


On Jun 23, 2011, at 2:24 AM, Aggrwal Poonam-B10812 wrote:

>=20
>=20
>> -----Original Message-----
>> From: =
linuxppc-dev-bounces+poonam.aggrwal=3Dfreescale.com@lists.ozlabs.org
>> [mailto:linuxppc-dev-
>> bounces+poonam.aggrwal=3Dfreescale.com@lists.ozlabs.org] On Behalf Of =
Kumar
>> Gala
>> Sent: Wednesday, June 22, 2011 5:04 PM
>> To: Kushwaha Prabhakar-B32579
>> Cc: meet2prabhu@gmail.com; devicetree-discuss@lists.ozlabs.org; =
linuxppc-
>> dev@lists.ozlabs.org
>> Subject: Re: [PATCH] powerpc/85xx:DTS: Fix tbi node location for =
Px020RDB
>>=20
>>=20
>> On Jun 7, 2011, at 9:49 PM, Prabhakar Kushwaha wrote:
>>=20
>>> ten-bit interface (TBI) module is part of SoC not board.
>>>=20
>>> Move tbi entries from board related dts files to Si dts.
>>>=20
>>> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
>>> ---
>>> Based upon
>> http://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git =
(branch
>> next)
>>>=20
>>> arch/powerpc/boot/dts/p1020rdb.dts            |    9 ---------
>>> arch/powerpc/boot/dts/p1020rdb_camp_core0.dts |    8 --------
>>> arch/powerpc/boot/dts/p1020si.dtsi            |    6 +++++-
>>> arch/powerpc/boot/dts/p2020rdb.dts            |    8 --------
>>> arch/powerpc/boot/dts/p2020rdb_camp_core0.dts |    8 --------
>>> arch/powerpc/boot/dts/p2020si.dtsi            |    6 +++++-
>>> 6 files changed, 10 insertions(+), 35 deletions(-)
>>>=20
>>> diff --git a/arch/powerpc/boot/dts/p1020rdb.dts
>> b/arch/powerpc/boot/dts/p1020rdb.dts
>>> index d6a8ae4..a4e5d6c 100644
>>> --- a/arch/powerpc/boot/dts/p1020rdb.dts
>>> +++ b/arch/powerpc/boot/dts/p1020rdb.dts
>>> @@ -211,14 +211,6 @@
>>> 			};
>>> 		};
>>>=20
>>> -		mdio@25000 {
>>> -
>>> -			tbi0: tbi-phy@11 {
>>> -				reg =3D <0x11>;
>>> -				device_type =3D "tbi-phy";
>>> -			};
>>> -		};
>>> -
>>> 		enet0: ethernet@b0000 {
>>> 			fixed-link =3D <1 1 1000 0 0>;
>>> 			phy-connection-type =3D "rgmii-id";
>>> @@ -227,7 +219,6 @@
>>>=20
>>> 		enet1: ethernet@b1000 {
>>> 			phy-handle =3D <&phy0>;
>>> -			tbi-handle =3D <&tbi0>;
>>> 			phy-connection-type =3D "sgmii";
>>>=20
>>> 		};
>>=20
>> I'm not sure we should do this.  The phy address we pick is board
>> specific so it should NOT be in .dtsi
> The TBI phy and it's address is internal to SOC.

But it is configured to NOT conflict with external PHY addresses.  This =
the setting is board specific in my opinion.

- k=

^ permalink raw reply

* [git pull] Please pull powerpc.git next branch
From: Kumar Gala @ 2011-06-23 10:29 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

The following changes since commit dc28518f7d7dfd93cd44edb44f9b8e961f5a5c1b:

  powerpc: Fix doorbell type shift (2011-06-20 11:21:48 +1000)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git next

Ashish Kalra (2):
      powerpc/85xx: Save scratch registers to thread info instead of using SPRGs.
      powerpc: introduce the ePAPR embedded hypervisor vmpic driver

Baruch Siach (1):
      MAINTAINERS: add arch/powerpc/platforms/85xx/ to the 85xx entry

Dmitry Eremin-Solenikov (2):
      powerpc/85xx: tqm8540 - add description for onboard flash
      powerpc/85xx: specify interrupt for pq3-localbus devices

Kumar Gala (10):
      powerpc: Rename e55xx_smp_defconfig to corenet64_smp_defconfig
      powerpc: Add a defconfig for 'corenet' 32-bit platforms
      powerpc/85xx: Add P5020DS device tree
      powerpc/85xx: Add P3041DS device tree
      powerpc/85xx: Updates to P4080DS device tree
      powerpc/85xx: Cleanup PCIe support on corenet_ds boards
      powerpc/fsl_pci: Simplify matching logic for PCI_FIXUP_HEADER
      powerpc/pci: Move FSL fixup from 32-bit to common
      powerpc/85xx: Add PCI support in 64-bit mode on P5020DS
      powerpc/qe: Limit QE support to ppc32

Lei Xu (2):
      powerpc/85xx: Update device tree to add nand info for p5020ds
      powerpc/85xx: Update device tree to add nand info for p3041ds

Prabhakar Kushwaha (1):
      powerpc/85xx: Add host-pci(e) bridge only for RC

Roy Zang (1):
      powerpc/85xx: Add basic P1023RDS board support

Scott Wood (1):
      powerpc/85xx: Set up doorbells even with no mpic

Stuart Yoder (1):
      powerpc: make irq_choose_cpu() available to all PIC drivers

Timur Tabi (4):
      powerpc: introduce ePAPR embedded hypervisor hcall interface
      powerpc: add Freescale hypervisor partition control functions
      powerpc/85xx: add board support for the Freescale hypervisor
      powerpc/p1022ds: add missing iounmap calls to platform file

 MAINTAINERS                                        |    1 +
 arch/powerpc/boot/dts/mpc8568mds.dts               |    2 +
 arch/powerpc/boot/dts/p1023rds.dts                 |  546 ++++++++++++++
 arch/powerpc/boot/dts/p3041ds.dts                  |  791 ++++++++++++++++++++
 arch/powerpc/boot/dts/p4080ds.dts                  |  329 ++++++---
 arch/powerpc/boot/dts/p5020ds.dts                  |  784 +++++++++++++++++++
 arch/powerpc/boot/dts/socrates.dts                 |    2 +
 arch/powerpc/boot/dts/tqm8540.dts                  |   42 +
 arch/powerpc/boot/dts/tqm8548-bigflash.dts         |    2 +
 arch/powerpc/boot/dts/tqm8548.dts                  |    2 +
 arch/powerpc/boot/dts/tqm8560.dts                  |    2 +
 arch/powerpc/boot/dts/xpedite5200.dts              |    2 +
 arch/powerpc/boot/dts/xpedite5200_xmon.dts         |    2 +
 arch/powerpc/configs/85xx/p1023rds_defconfig       |  173 +++++
 arch/powerpc/configs/corenet32_smp_defconfig       |  183 +++++
 ...e55xx_smp_defconfig => corenet64_smp_defconfig} |    0
 arch/powerpc/configs/mpc85xx_defconfig             |    7 +-
 arch/powerpc/configs/mpc85xx_smp_defconfig         |    6 +-
 arch/powerpc/include/asm/ehv_pic.h                 |   40 +
 arch/powerpc/include/asm/epapr_hcalls.h            |  502 +++++++++++++
 arch/powerpc/include/asm/fsl_hcalls.h              |  655 ++++++++++++++++
 arch/powerpc/include/asm/irq.h                     |    2 +
 arch/powerpc/include/asm/processor.h               |    5 +
 arch/powerpc/include/asm/reg.h                     |    4 +-
 arch/powerpc/kernel/asm-offsets.c                  |    3 +
 arch/powerpc/kernel/head_booke.h                   |   42 +-
 arch/powerpc/kernel/head_fsl_booke.S               |   49 +-
 arch/powerpc/kernel/irq.c                          |   35 +
 arch/powerpc/kernel/pci-common.c                   |   18 +
 arch/powerpc/kernel/pci_32.c                       |   19 -
 arch/powerpc/platforms/85xx/Kconfig                |    9 +
 arch/powerpc/platforms/85xx/Makefile               |    1 +
 arch/powerpc/platforms/85xx/corenet_ds.c           |   41 +-
 arch/powerpc/platforms/85xx/p1022_ds.c             |   11 +-
 arch/powerpc/platforms/85xx/p1023_rds.c            |  162 ++++
 arch/powerpc/platforms/85xx/p3041_ds.c             |   16 +-
 arch/powerpc/platforms/85xx/p4080_ds.c             |   28 +-
 arch/powerpc/platforms/85xx/p5020_ds.c             |   16 +-
 arch/powerpc/platforms/85xx/smp.c                  |   21 +-
 arch/powerpc/platforms/Kconfig                     |    6 +-
 arch/powerpc/sysdev/Makefile                       |    1 +
 arch/powerpc/sysdev/ehv_pic.c                      |  302 ++++++++
 arch/powerpc/sysdev/fsl_pci.c                      |   84 +--
 arch/powerpc/sysdev/fsl_soc.c                      |   27 +
 arch/powerpc/sysdev/fsl_soc.h                      |    3 +
 arch/powerpc/sysdev/mpic.c                         |   36 -
 46 files changed, 4699 insertions(+), 315 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/p1023rds.dts
 create mode 100644 arch/powerpc/boot/dts/p3041ds.dts
 create mode 100644 arch/powerpc/boot/dts/p5020ds.dts
 create mode 100644 arch/powerpc/configs/85xx/p1023rds_defconfig
 create mode 100644 arch/powerpc/configs/corenet32_smp_defconfig
 rename arch/powerpc/configs/{e55xx_smp_defconfig => corenet64_smp_defconfig} (100%)
 create mode 100644 arch/powerpc/include/asm/ehv_pic.h
 create mode 100644 arch/powerpc/include/asm/epapr_hcalls.h
 create mode 100644 arch/powerpc/include/asm/fsl_hcalls.h
 create mode 100644 arch/powerpc/platforms/85xx/p1023_rds.c
 create mode 100644 arch/powerpc/sysdev/ehv_pic.c

^ permalink raw reply

* Re: [PATCH] fsl-diu-fb: remove the ioctl interface
From: Anatolij Gustschin @ 2011-06-23 11:26 UTC (permalink / raw)
  To: Jenkins, Clive; +Cc: linuxppc-dev, linux-fbdev, lethal, Timur Tabi, yorksun
In-Reply-To: <929D3CED81F34E43887A393170D66FB90484A280@GBRSUN01MS002.eu.xerox.net>

On Wed, 22 Jun 2011 11:39:49 +0100
"Jenkins, Clive" <Clive.Jenkins@xerox.com> wrote:
...
> > > Removing the ioctl interface also allows us to clean up the header
> file and
> > > remove other unusued stuff.
> > 
> > No! We are using ioctl interface of this driver in many video
> > rendering applications on overlay planes on huge number of boards.
> > So, please don't remove it.
...
> Can you make available your application code by posting a link to it?

I do not have the code of the real applications since I didn't wrote
it. All I can share is the test and sample code that I used when working
on driver fixes:

test-app: http://pastebin.com/J2RvKb6n

HTH,
Anatolij

^ permalink raw reply

* Re: [PATCH] fsl-diu-fb: remove the ioctl interface
From: Tabi Timur-B04825 @ 2011-06-23 11:29 UTC (permalink / raw)
  To: Anatolij Gustschin
  Cc: linuxppc-dev@ozlabs.org, linux-fbdev@vger.kernel.org,
	lethal@linux-sh.org, sun york-R58495
In-Reply-To: <20110623132604.1a6d0d71@wker>

Anatolij Gustschin wrote:
> I do not have the code of the real applications since I didn't wrote
> it. All I can share is the test and sample code that I used when working
> on driver fixes:
>
> test-app:http://pastebin.com/J2RvKb6n

What's the "VIU"?

--=20
Timur Tabi
Linux kernel developer at Freescale=

^ permalink raw reply

* [PATCH v3 2/3] powerpc: implement arch_setup_pdev_archdata
From: Kumar Gala @ 2011-06-23 11:33 UTC (permalink / raw)
  To: Greg KH; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1308828839-27349-1-git-send-email-galak@kernel.crashing.org>

We have a long standing issues with platform devices not have a valid
dma_mask pointer.  This hasn't been an issue to date as no platform
device has tried to set its dma_mask value to a non-default value.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/include/asm/platform_device.h |   17 ++++++++++++++++-
 arch/powerpc/kernel/setup-common.c         |   27 ---------------------------
 drivers/of/platform.c                      |    5 +++--
 3 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/arch/powerpc/include/asm/platform_device.h b/arch/powerpc/include/asm/platform_device.h
index 01452c3..137b183 100644
--- a/arch/powerpc/include/asm/platform_device.h
+++ b/arch/powerpc/include/asm/platform_device.h
@@ -1 +1,16 @@
-#include <asm-generic/platform_device.h>
+#ifndef __ASM_PLATFORM_DEVICE_H_
+#define __ASM_PLATFORM_DEVICE_H_
+
+#include <linux/platform_device.h>
+#include <asm/dma-mapping.h>
+
+#define ARCH_HAS_PDEV_ARCHDATA_SETUP
+
+static inline void arch_setup_pdev_archdata(struct platform_device *pdev)
+{
+	pdev->archdata.dma_mask = DMA_BIT_MASK(32);
+	pdev->dev.dma_mask = &pdev->archdata.dma_mask;
+ 	set_dma_ops(&pdev->dev, &dma_direct_ops);
+}
+
+#endif /* __ASM_GENERIC_PLATFORM_DEVICE_H_ */
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 79fca26..eb5229e 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -703,30 +703,3 @@ static int powerpc_debugfs_init(void)
 }
 arch_initcall(powerpc_debugfs_init);
 #endif
-
-static int ppc_dflt_bus_notify(struct notifier_block *nb,
-				unsigned long action, void *data)
-{
-	struct device *dev = data;
-
-	/* We are only intereted in device addition */
-	if (action != BUS_NOTIFY_ADD_DEVICE)
-		return 0;
-
-	set_dma_ops(dev, &dma_direct_ops);
-
-	return NOTIFY_DONE;
-}
-
-static struct notifier_block ppc_dflt_plat_bus_notifier = {
-	.notifier_call = ppc_dflt_bus_notify,
-	.priority = INT_MAX,
-};
-
-static int __init setup_bus_notifier(void)
-{
-	bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier);
-	return 0;
-}
-
-arch_initcall(setup_bus_notifier);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 63d3cb7..5ba8f48 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -21,6 +21,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <asm/platform_device.h>
 
 static int of_dev_node_match(struct device *dev, void *data)
 {
@@ -153,7 +154,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
 	}
 
 	dev->dev.of_node = of_node_get(np);
-#if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
+#if defined(CONFIG_MICROBLAZE)
 	dev->dev.dma_mask = &dev->archdata.dma_mask;
 #endif
 	dev->dev.parent = parent;
@@ -189,7 +190,7 @@ struct platform_device *of_platform_device_create(struct device_node *np,
 	if (!dev)
 		return NULL;
 
-#if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
+#if defined(CONFIG_MICROBLAZE)
 	dev->archdata.dma_mask = 0xffffffffUL;
 #endif
 	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-- 
1.7.3.4

^ permalink raw reply related

* [PATCH v3 1/3] driver core: Add ability for arch code to setup pdev_archdata
From: Kumar Gala @ 2011-06-23 11:33 UTC (permalink / raw)
  To: Greg KH; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1308744176-24491-1-git-send-email-galak@kernel.crashing.org>

On some architectures we need to setup pdev_archdata before we add the
device.  Waiting til a bus_notifier is too late since we might need the
pdev_archdata in the bus notifier.  One example is setting up of dma_mask
pointers such that it can be used in a bus_notifier.

We add noop version of arch_setup_pdev_archdata() in
<asm-generic/platform_device.h> and allow the arch code to override with
access the full definitions of struct device, struct platform_device, and
struct pdev_archdata.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
v3:
* Add more comments and add missing call to arch_setup_pdev_archdata in
  platform_device_register
v2:
* Added license, and comments about arch_setup_pdev_archdata()
  per Mike's comments

 arch/alpha/include/asm/platform_device.h      |    1 +
 arch/arm/include/asm/platform_device.h        |    1 +
 arch/avr32/include/asm/platform_device.h      |    1 +
 arch/blackfin/include/asm/platform_device.h   |    1 +
 arch/cris/include/asm/platform_device.h       |    1 +
 arch/frv/include/asm/platform_device.h        |    1 +
 arch/h8300/include/asm/platform_device.h      |    1 +
 arch/ia64/include/asm/platform_device.h       |    1 +
 arch/m32r/include/asm/platform_device.h       |    1 +
 arch/m68k/include/asm/platform_device.h       |    1 +
 arch/microblaze/include/asm/platform_device.h |    1 +
 arch/mips/include/asm/platform_device.h       |    1 +
 arch/mn10300/include/asm/platform_device.h    |    1 +
 arch/parisc/include/asm/platform_device.h     |    1 +
 arch/powerpc/include/asm/platform_device.h    |    1 +
 arch/s390/include/asm/platform_device.h       |    1 +
 arch/score/include/asm/platform_device.h      |    1 +
 arch/sh/include/asm/platform_device.h         |    1 +
 arch/sparc/include/asm/platform_device.h      |    1 +
 arch/tile/include/asm/platform_device.h       |    1 +
 arch/unicore32/include/asm/platform_device.h  |    1 +
 arch/x86/include/asm/platform_device.h        |    1 +
 arch/xtensa/include/asm/platform_device.h     |    1 +
 drivers/base/platform.c                       |    3 ++
 include/asm-generic/platform_device.h         |   41 +++++++++++++++++++++++++
 25 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100644 arch/alpha/include/asm/platform_device.h
 create mode 100644 arch/arm/include/asm/platform_device.h
 create mode 100644 arch/avr32/include/asm/platform_device.h
 create mode 100644 arch/blackfin/include/asm/platform_device.h
 create mode 100644 arch/cris/include/asm/platform_device.h
 create mode 100644 arch/frv/include/asm/platform_device.h
 create mode 100644 arch/h8300/include/asm/platform_device.h
 create mode 100644 arch/ia64/include/asm/platform_device.h
 create mode 100644 arch/m32r/include/asm/platform_device.h
 create mode 100644 arch/m68k/include/asm/platform_device.h
 create mode 100644 arch/microblaze/include/asm/platform_device.h
 create mode 100644 arch/mips/include/asm/platform_device.h
 create mode 100644 arch/mn10300/include/asm/platform_device.h
 create mode 100644 arch/parisc/include/asm/platform_device.h
 create mode 100644 arch/powerpc/include/asm/platform_device.h
 create mode 100644 arch/s390/include/asm/platform_device.h
 create mode 100644 arch/score/include/asm/platform_device.h
 create mode 100644 arch/sh/include/asm/platform_device.h
 create mode 100644 arch/sparc/include/asm/platform_device.h
 create mode 100644 arch/tile/include/asm/platform_device.h
 create mode 100644 arch/unicore32/include/asm/platform_device.h
 create mode 100644 arch/x86/include/asm/platform_device.h
 create mode 100644 arch/xtensa/include/asm/platform_device.h
 create mode 100644 include/asm-generic/platform_device.h

diff --git a/arch/alpha/include/asm/platform_device.h b/arch/alpha/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/alpha/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/arm/include/asm/platform_device.h b/arch/arm/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/arm/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/avr32/include/asm/platform_device.h b/arch/avr32/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/avr32/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/blackfin/include/asm/platform_device.h b/arch/blackfin/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/blackfin/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/cris/include/asm/platform_device.h b/arch/cris/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/cris/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/frv/include/asm/platform_device.h b/arch/frv/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/frv/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/h8300/include/asm/platform_device.h b/arch/h8300/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/h8300/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/ia64/include/asm/platform_device.h b/arch/ia64/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/ia64/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/m32r/include/asm/platform_device.h b/arch/m32r/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/m32r/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/m68k/include/asm/platform_device.h b/arch/m68k/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/m68k/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/microblaze/include/asm/platform_device.h b/arch/microblaze/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/microblaze/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/mips/include/asm/platform_device.h b/arch/mips/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/mips/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/mn10300/include/asm/platform_device.h b/arch/mn10300/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/mn10300/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/parisc/include/asm/platform_device.h b/arch/parisc/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/parisc/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/powerpc/include/asm/platform_device.h b/arch/powerpc/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/powerpc/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/s390/include/asm/platform_device.h b/arch/s390/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/s390/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/score/include/asm/platform_device.h b/arch/score/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/score/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/sh/include/asm/platform_device.h b/arch/sh/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/sh/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/sparc/include/asm/platform_device.h b/arch/sparc/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/sparc/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/tile/include/asm/platform_device.h b/arch/tile/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/tile/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/unicore32/include/asm/platform_device.h b/arch/unicore32/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/unicore32/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/x86/include/asm/platform_device.h b/arch/x86/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/x86/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/arch/xtensa/include/asm/platform_device.h b/arch/xtensa/include/asm/platform_device.h
new file mode 100644
index 0000000..01452c3
--- /dev/null
+++ b/arch/xtensa/include/asm/platform_device.h
@@ -0,0 +1 @@
+#include <asm-generic/platform_device.h>
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 1c291af..f554045 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -20,6 +20,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
+#include <asm/platform_device.h>
 
 #include "base.h"
 
@@ -173,6 +174,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
 		pa->pdev.id = id;
 		device_initialize(&pa->pdev.dev);
 		pa->pdev.dev.release = platform_device_release;
+		arch_setup_pdev_archdata(&pa->pdev);
 	}
 
 	return pa ? &pa->pdev : NULL;
@@ -334,6 +336,7 @@ EXPORT_SYMBOL_GPL(platform_device_del);
 int platform_device_register(struct platform_device *pdev)
 {
 	device_initialize(&pdev->dev);
+	arch_setup_pdev_archdata(pdev);
 	return platform_device_add(pdev);
 }
 EXPORT_SYMBOL_GPL(platform_device_register);
diff --git a/include/asm-generic/platform_device.h b/include/asm-generic/platform_device.h
new file mode 100644
index 0000000..c03570c
--- /dev/null
+++ b/include/asm-generic/platform_device.h
@@ -0,0 +1,41 @@
+/*
+ * include/asm-generic/platform_device.h
+ *
+ * Provides a callout when we allocate a platform device to architecture code
+ * to update archdata.
+ *
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * You should have received a copy of the GNU General Public License
+ * (for example /usr/src/linux/COPYING); if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef __ASM_GENERIC_PLATFORM_DEVICE_H_
+#define __ASM_GENERIC_PLATFORM_DEVICE_H_
+
+struct platform_device;
+
+/*
+ * an architecture can override to define arch_setup_pdev_archdata
+ * 
+ * This is called before platform_device_add() such that any pdev_archdata may
+ * be setup before the platform_notifier is called.  So if a user needs to
+ * manipulate any relevant information in the pdev_archdata they can do:
+ *
+ * 	platform_devic_alloc()
+ * 	... manipulate ...
+ * 	platform_device_add()
+ *
+ * And if they don't care they can just call platform_device_register() and
+ * everything will just work out.
+ */
+#ifndef arch_setup_pdev_archdata
+static inline void arch_setup_pdev_archdata(struct platform_device *pdev) { }
+#endif
+
+#endif /* __ASM_GENERIC_PLATFORM_DEVICE_H_ */
-- 
1.7.3.4

^ permalink raw reply related


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