LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: powerpc 476, Little-endian, pte fault
From: Michael Neuling @ 2011-10-31  5:51 UTC (permalink / raw)
  To: Santosh Kumar; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <CAJw04pD24W_nGSLheWunCa_o7QqBmRf_TSAD44EkzazigRe_nQ@mail.gmail.com>

Adding linuxppc-dev list to the CC

> KERNEL: linux 2.6.39.4
> POWERPC: 476, little endian.
> 
> I am trying to get linux 2.6.39.4 up on PPC 476 i have done done
> Big-endian to little endian Changes in:

Can you explain what you are trying to do in more detail?  What does "i
have done Big-endian to little endian Changes" mean?

> 1) bitops header file.
> 2) while reading the device tree.
> 3) the PTE read/computed in head_32.S
> 4) added E bit in the TLB entries.
> 
> with all the above changes the kernel_init is done but and inited is
> mounted.

Can you post your patch?

Are you trying to boot the kernel in little endian or just run userspace
in little endian?  

> But while spawning init process the kernel continuously hits pte
> faults at address 0x100000fc and never comes out. Please let me know
> where i should be looking into.

Is this the very first userspace instruction?

Mikey

^ permalink raw reply

* Re: [RFC][PATCH 1/2] uio: allow drivers to override the pgprot for mmap
From: Greg KH @ 2011-10-29  6:38 UTC (permalink / raw)
  To: Hans J. Koch; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20111028214812.GD23092@local>

On Fri, Oct 28, 2011 at 11:48:12PM +0200, Hans J. Koch wrote:
> On Fri, Oct 28, 2011 at 10:50:29AM -0500, Kumar Gala wrote:
> > For some devices, the default behavior of pgprot_noncached() is not
> > appropriate for all of its mappable regions. This provides a means for
> > the kernel side of the UIO driver to override the flags without having
> > to implement its own full mmap callback.
> 
> Thanks for also providing an example driver showing the use of this.
> You should also post this driver in a mainline-ready version, I'm a bit
> uncomfortable with adding a new function pointer without having any users.

I'm more than "uncomfortable", I'll refuse to take any such patch unless
there is a in-kernel user, otherwise it makes no sense to add the
pointer at all.

thanks,

greg k-h

^ permalink raw reply

* Re: Kernel hang on PS3 with SMP
From: Geoff Levand @ 2011-10-29  1:33 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: cbe-oss-dev, Andre Heider, linuxppc-dev, Frank Rowand
In-Reply-To: <4EAA02A7.7010109@infradead.org>

Hi,

On Thu, 2011-10-27 at 18:17 -0700, Geoff Levand wrote: 
> I verified that indeed 317f394160e9beb97d19a84c39b7e5eb3d7815a8
> 'sched: Move the second half of ttwu() to the remote cpu' introduces
> the hang.

After some more digging I found that it seems a short while after
startup ps3_smp_message_pass() gets called with a PPC_MSG_RESCHEDULE,
but then there is no corresponding call to scheduler_ipi() on the target
cpu.

I'll do some more work on it and verify that this is what is actually
happening.

-Geoff

^ permalink raw reply

* Re: [RFC][PATCH 1/2] uio: allow drivers to override the pgprot for mmap
From: Hans J. Koch @ 2011-10-28 21:48 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Greg KH, hjk, linux-kernel, linuxppc-dev
In-Reply-To: <1319817030-23992-1-git-send-email-galak@kernel.crashing.org>

On Fri, Oct 28, 2011 at 10:50:29AM -0500, Kumar Gala wrote:
> For some devices, the default behavior of pgprot_noncached() is not
> appropriate for all of its mappable regions. This provides a means for
> the kernel side of the UIO driver to override the flags without having
> to implement its own full mmap callback.

Thanks for also providing an example driver showing the use of this.
You should also post this driver in a mainline-ready version, I'm a bit
uncomfortable with adding a new function pointer without having any users.

And since you change uio_driver.h you should also update documentation
accordingly (Documentation/DocBook/uio-howto.tmpl).

Otherwise, I have no general objections.

Thanks,
Hans

> 
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> Signed-off-by: Geoff Thorpe <geoff@geoffthorpe.net>
> ---
>  drivers/uio/uio.c          |    6 +++++-
>  include/linux/uio_driver.h |    3 +++
>  2 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
> index dc27d89..0aebe27 100644
> --- a/drivers/uio/uio.c
> +++ b/drivers/uio/uio.c
> @@ -655,7 +655,11 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
>  
>  	vma->vm_flags |= VM_IO | VM_RESERVED;
>  
> -	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> +	if (idev->info->set_pgprot)
> +		vma->vm_page_prot = idev->info->set_pgprot(idev->info, mi,
> +							   vma->vm_page_prot);
> +	else
> +		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
>  
>  	return remap_pfn_range(vma,
>  			       vma->vm_start,
> diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
> index fd99ff9..edfe7c8 100644
> --- a/include/linux/uio_driver.h
> +++ b/include/linux/uio_driver.h
> @@ -80,6 +80,7 @@ struct uio_device;
>   * @open:		open operation for this uio device
>   * @release:		release operation for this uio device
>   * @irqcontrol:		disable/enable irqs when 0/1 is written to /dev/uioX
> + * @set_pgprot:		allow driver to override default(noncached) pgprot
>   */
>  struct uio_info {
>  	struct uio_device	*uio_dev;
> @@ -95,6 +96,8 @@ struct uio_info {
>  	int (*open)(struct uio_info *info, struct inode *inode);
>  	int (*release)(struct uio_info *info, struct inode *inode);
>  	int (*irqcontrol)(struct uio_info *info, s32 irq_on);
> +	pgprot_t (*set_pgprot)(struct uio_info *uio, unsigned int mem_idx,
> +			       pgprot_t prot);
>  };
>  
>  extern int __must_check
> -- 
> 1.7.3.4
> 
> 

^ permalink raw reply

* Re: [RFC][PATCH 2/2] Example to show use of uio pgprot
From: Hans J. Koch @ 2011-10-28 21:40 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Greg KH, hjk, linux-kernel, linuxppc-dev
In-Reply-To: <1319817030-23992-2-git-send-email-galak@kernel.crashing.org>

On Fri, Oct 28, 2011 at 10:50:30AM -0500, Kumar Gala wrote:

A few remarks below.

> +static void __init dpa_uio_portal_init(struct dpa_uio_portal *p,
> +				const struct dpa_uio_class *c)

This can't be "void". You have to return apropiate errors.

> +{
> +	struct dpa_uio_info *info;
> +	const struct resource *res;
> +	u32 index;
> +	int irq, ret;
> +
> +	/* allocate 'info' */
> +	info = kzalloc(sizeof(*info), GFP_KERNEL);
> +	if (!info)
> +		return;

return -ENOMEM (more similar cases below)

> +	atomic_set(&info->ref, 1);
> +	if (p->type == dpa_uio_portal_bman) {
> +		res = &p->bm_cfg->addr_phys[0];
> +		index = p->bm_cfg->public_cfg.index;
> +		irq = p->bm_cfg->public_cfg.irq;
> +	} else {
> +		res = &p->qm_cfg->addr_phys[0];
> +		index = p->qm_cfg->public_cfg.index;
> +		irq = p->qm_cfg->public_cfg.irq;
> +	}
> +	/* We need to map the cache-inhibited region in the kernel for
> +	 * interrupt-handling purposes. */
> +	info->addr_ci = ioremap_prot(res[DPA_PORTAL_CI].start,
> +				resource_size(&res[DPA_PORTAL_CI]),
> +				_PAGE_GUARDED | _PAGE_NO_CACHE);
> +	/* Name the UIO device according to the cell-index. It's supposed to be
> +	 * unique for each device class (Qman/Bman), and is also a convenient
> +	 * way for user-space to find the UIO device that corresponds to a given
> +	 * portal device-tree node. */
> +	sprintf(info->name, "%s%x", c->dev_prefix, index);
> +	info->pdev = platform_device_alloc(info->name, -1);
> +	if (!info->pdev) {
> +		iounmap(info->addr_ci);
> +		kfree(info);
> +		pr_err("dpa_uio_portal: platform_device_alloc() failed\n");
> +		return;
> +	}
> +	ret = platform_device_add(info->pdev);
> +	if (ret) {
> +		platform_device_put(info->pdev);
> +		iounmap(info->addr_ci);
> +		kfree(info);
> +		pr_err("dpa_uio_portal: platform_device_add() failed\n");
> +		return;
> +	}
> +	info->uio.name = info->name;
> +	info->uio.version = dpa_uio_version;
> +	info->uio.mem[DPA_PORTAL_CE].name = "cena";
> +	info->uio.mem[DPA_PORTAL_CE].addr = res[DPA_PORTAL_CE].start;
> +	info->uio.mem[DPA_PORTAL_CE].size = resource_size(&res[DPA_PORTAL_CE]);
> +	info->uio.mem[DPA_PORTAL_CE].memtype = UIO_MEM_PHYS;
> +	info->uio.mem[DPA_PORTAL_CI].name = "cinh";
> +	info->uio.mem[DPA_PORTAL_CI].addr = res[DPA_PORTAL_CI].start;
> +	info->uio.mem[DPA_PORTAL_CI].size = resource_size(&res[DPA_PORTAL_CI]);
> +	info->uio.mem[DPA_PORTAL_CI].memtype = UIO_MEM_PHYS;
> +	info->uio.irq = irq;
> +	info->uio.handler = dpa_uio_irq_handler;
> +	info->uio.set_pgprot = dpa_uio_pgprot;
> +	info->uio.open = dpa_uio_open;
> +	info->uio.release = dpa_uio_release;
> +	ret = uio_register_device(&info->pdev->dev, &info->uio);

This should be the last thing you do before return. You can have
interrupts even before uio_register_device returns.

> +	if (ret) {
> +		platform_device_del(info->pdev);
> +		platform_device_put(info->pdev);
> +		iounmap(info->addr_ci);
> +		kfree(info);
> +		pr_err("dpa_uio_portal: UIO registration failed\n");
> +		return;
> +	}
> +	list_add_tail(&info->node, &uio_portal_list);

That should probably be done prior to uio_register_device.

> +	pr_info("USDPAA portal initialised, %s\n", info->name);
> +}
> +
> +static int __init dpa_uio_init(void)
> +{
> +	const struct dpa_uio_class *classes[3], **c = classes;
> +	classes[0] = dpa_uio_bman();
> +	classes[1] = dpa_uio_qman();
> +	classes[2] = NULL;
> +	while (*c) {
> +		struct dpa_uio_portal *p;
> +		list_for_each_entry(p, &(*c)->list, node)
> +			dpa_uio_portal_init(p, *c);
> +		c++;
> +	}
> +	pr_info("USDPAA portal layer loaded\n");
> +	return 0;

You can't just return OK here if dpa_uio_portal_init() fails.

> +}
> +
> +static void __exit dpa_uio_exit(void)
> +{
> +	struct dpa_uio_info *info, *tmp;
> +	list_for_each_entry_safe(info, tmp, &uio_portal_list, node) {
> +		list_del(&info->node);
> +		uio_unregister_device(&info->uio);
> +		platform_device_del(info->pdev);
> +		platform_device_put(info->pdev);
> +		iounmap(info->addr_ci);
> +		pr_info("USDPAA portal removed, %s\n", info->name);
> +		kfree(info);
> +	}
> +	pr_info("USDPAA portal layer unloaded\n");
> +}
> +
> +
> +module_init(dpa_uio_init)
> +module_exit(dpa_uio_exit)
> +MODULE_LICENSE("GPL");
> +
> -- 
> 1.7.3.4
> 
> 

^ permalink raw reply

* RFC: ESR_I/DLK processing
From: Jimi Xenidis @ 2011-10-28 20:43 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev

arch/powerpc/kernel/head_fsl_booke.S has the following code:
> 	/* Data Storage Interrupt */
> 	START_EXCEPTION(DataStorage)
> 	NORMAL_EXCEPTION_PROLOG
> 	mfspr	r5,SPRN_ESR		/* Grab the ESR, save it, pass =
arg3 */
> 	stw	r5,_ESR(r11)
> 	mfspr	r4,SPRN_DEAR		/* Grab the DEAR, save it, pass =
arg2 */
> 	andis.	r10,r5,(ESR_ILK|ESR_DLK)@h
> 	bne	1f
> 	EXC_XFER_EE_LITE(0x0300, handle_page_fault)
> 1:
> 	addi	r3,r1,STACK_FRAME_OVERHEAD
> 	EXC_XFER_EE_LITE(0x0300, CacheLockingException)


I need something similar for A2 (and all book3e) and was wondering, why =
this isn't just:

> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 88abe70..8451822 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -159,6 +159,14 @@ int __kprobes do_page_fault(struct pt_regs *regs, =
unsigned long address,
>  	}
>  #endif
> =20
> +#ifdef CONFIG_PPC_BOOK3E
> +	if (error_code & (ESR_DLK|ESR_ILK)) {
> +		/* detect that this is a privileged op and SIGILL */
> +		_exception(SIGILL, regs, ILL_PRVOPC, regs->nip);
> +		return 0;
> +	}
> +#endif
> +
>  	if (notify_page_fault(regs))
>  		return 0;

Its not like this need to be fast or anything.
I'd be happy to submit a patch that adds to fault.c and removed the =
I/DLK processing from head_fsl_booke.S

Thoughts?
-jx

^ permalink raw reply

* Re: [1/4] powerpc: Revert show_regs() define for readability
From: Jimi Xenidis @ 2011-10-28 19:40 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Linuxppc-dev list
In-Reply-To: <1317905621-5537-1-git-send-email-galak@kernel.crashing.org>


On Oct 5, 2011, at 9:53 PM, Kumar Gala wrote:

> We had an existing ifdef for 4xx & BOOKE processors that got changed to
> CONFIG_PPC_ADV_DEBUG_REGS.  The define has nothing to do with
> CONFIG_PPC_ADV_DEBUG_REGS.  The define really should be:
> 
> #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
> 
> and not
> 
> #ifdef CONFIG_PPC_ADV_DEBUG_REGS
> 
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> 
> ---
> arch/powerpc/kernel/process.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 8f53954..a1b5981 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -657,7 +657,7 @@ void show_regs(struct pt_regs * regs)
> 	if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
> 		printk("CFAR: "REG"\n", regs->orig_gpr3);
> 	if (trap == 0x300 || trap == 0x600)
> -#ifdef CONFIG_PPC_ADV_DEBUG_REGS
> +#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
> 		printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr);

I'll be needing "|| defined(CONFIG_PPC_BOOK3E)" added to this please.
-jx


> #else
> 		printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr);

^ permalink raw reply

* Re: [4/4] powerpc/booke: Re-organize debug code
From: Jimi Xenidis @ 2011-10-28 19:37 UTC (permalink / raw)
  To: Kumar Gala, Ben Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1317905621-5537-4-git-send-email-galak@kernel.crashing.org>


On Oct 5, 2011, at 9:53 PM, Kumar Gala wrote:

> * set_dabr/do_dabr are no longer used when CNFIG_PPC_ADV_DEBUG_REGS is =
set
>  refactor code a bit such that we only build the dabr code for
>  !CONFIG_PPC_ADV_DEBUG_REGS and removed some CONFIG_PPC_ADV_DEBUG_REGS
>  code in set_dabr that would never get built.
>=20
> * Move do_send_trap into traps.c as its only used there
>=20
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>=20
> ---
> arch/powerpc/include/asm/system.h |    5 +--
> arch/powerpc/kernel/process.c     |   97 =
+++++++++++++-----------------------
> arch/powerpc/kernel/traps.c       |   17 +++++++
> 3 files changed, 53 insertions(+), 66 deletions(-)
>=20
> diff --git a/arch/powerpc/include/asm/system.h =
b/arch/powerpc/include/asm/system.h
> index e30a13d..1dc5d9c 100644
> --- a/arch/powerpc/include/asm/system.h
> +++ b/arch/powerpc/include/asm/system.h
> @@ -111,11 +111,8 @@ static inline int debugger_dabr_match(struct =
pt_regs *regs) { return 0; }
> static inline int debugger_fault_handler(struct pt_regs *regs) { =
return 0; }
> #endif
>=20
> +#ifndef CONFIG_PPC_ADV_DEBUG_REGS
> extern int set_dabr(unsigned long dabr);
> -#ifdef CONFIG_PPC_ADV_DEBUG_REGS
> -extern void do_send_trap(struct pt_regs *regs, unsigned long address,
> -			 unsigned long error_code, int signal_code, int =
brkpt);
> -#else


This part of the patch breaks xmon.c
Naively I simply wrapped the xmon call:

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index f08836a..b5911b2 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -738,8 +738,10 @@ static void insert_bpts(void)
=20
 static void insert_cpu_bpts(void)
 {
+#ifndef CONFIG_PPC_ADV_DEBUG_REGS
 	if (dabr.enabled)
 		set_dabr(dabr.address | (dabr.enabled & 7));
+#endif
 	if (iabr && cpu_has_feature(CPU_FTR_IABR))
 		mtspr(SPRN_IABR, iabr->address
 			 | (iabr->enabled & (BP_IABR|BP_IABR_TE)));
@@ -767,7 +769,9 @@ static void remove_bpts(void)
=20
 static void remove_cpu_bpts(void)
 {
+#ifndef CONFIG_PPC_ADV_DEBUG_REGS
 	set_dabr(0);
+#endif
 	if (cpu_has_feature(CPU_FTR_IABR))
 		mtspr(SPRN_IABR, 0);
 }

-JX


> extern void do_dabr(struct pt_regs *regs, unsigned long address,
> 		    unsigned long error_code);
> #endif
> diff --git a/arch/powerpc/kernel/process.c =
b/arch/powerpc/kernel/process.c
> index 269a309..989e574 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -251,50 +251,6 @@ void discard_lazy_cpu_state(void)
> #endif /* CONFIG_SMP */
>=20
> #ifdef CONFIG_PPC_ADV_DEBUG_REGS
> -void do_send_trap(struct pt_regs *regs, unsigned long address,
> -		  unsigned long error_code, int signal_code, int =
breakpt)
> -{
> -	siginfo_t info;
> -
> -	if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
> -			11, SIGSEGV) =3D=3D NOTIFY_STOP)
> -		return;
> -
> -	/* Deliver the signal to userspace */
> -	info.si_signo =3D SIGTRAP;
> -	info.si_errno =3D breakpt;	/* breakpoint or watchpoint id =
*/
> -	info.si_code =3D signal_code;
> -	info.si_addr =3D (void __user *)address;
> -	force_sig_info(SIGTRAP, &info, current);
> -}
> -#else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
> -void do_dabr(struct pt_regs *regs, unsigned long address,
> -		    unsigned long error_code)
> -{
> -	siginfo_t info;
> -
> -	if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
> -			11, SIGSEGV) =3D=3D NOTIFY_STOP)
> -		return;
> -
> -	if (debugger_dabr_match(regs))
> -		return;
> -
> -	/* Clear the DABR */
> -	set_dabr(0);
> -
> -	/* Deliver the signal to userspace */
> -	info.si_signo =3D SIGTRAP;
> -	info.si_errno =3D 0;
> -	info.si_code =3D TRAP_HWBKPT;
> -	info.si_addr =3D (void __user *)address;
> -	force_sig_info(SIGTRAP, &info, current);
> -}
> -#endif	/* CONFIG_PPC_ADV_DEBUG_REGS */
> -
> -static DEFINE_PER_CPU(unsigned long, current_dabr);
> -
> -#ifdef CONFIG_PPC_ADV_DEBUG_REGS
> /*
>  * Set the debug registers back to their default "safe" values.
>  */
> @@ -357,16 +313,7 @@ static void switch_booke_debug_regs(struct =
thread_struct *new_thread)
> 			prime_debug_regs(new_thread);
> }
> #else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
> -#ifndef CONFIG_HAVE_HW_BREAKPOINT
> -static void set_debug_reg_defaults(struct thread_struct *thread)
> -{
> -	if (thread->dabr) {
> -		thread->dabr =3D 0;
> -		set_dabr(0);
> -	}
> -}
> -#endif /* !CONFIG_HAVE_HW_BREAKPOINT */
> -#endif	/* CONFIG_PPC_ADV_DEBUG_REGS */
> +static DEFINE_PER_CPU(unsigned long, current_dabr);
>=20
> int set_dabr(unsigned long dabr)
> {
> @@ -376,19 +323,45 @@ int set_dabr(unsigned long dabr)
> 		return ppc_md.set_dabr(dabr);
>=20
> 	/* XXX should we have a CPU_FTR_HAS_DABR ? */
> -#ifdef CONFIG_PPC_ADV_DEBUG_REGS
> -	mtspr(SPRN_DAC1, dabr);
> -#ifdef CONFIG_PPC_47x
> -	isync();
> -#endif
> -#elif defined(CONFIG_PPC_BOOK3S)
> 	mtspr(SPRN_DABR, dabr);
> -#endif
> -
>=20
> 	return 0;
> }
>=20
> +void do_dabr(struct pt_regs *regs, unsigned long address,
> +		    unsigned long error_code)
> +{
> +	siginfo_t info;
> +
> +	if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
> +			11, SIGSEGV) =3D=3D NOTIFY_STOP)
> +		return;
> +
> +	if (debugger_dabr_match(regs))
> +		return;
> +
> +	/* Clear the DABR */
> +	set_dabr(0);
> +
> +	/* Deliver the signal to userspace */
> +	info.si_signo =3D SIGTRAP;
> +	info.si_errno =3D 0;
> +	info.si_code =3D TRAP_HWBKPT;
> +	info.si_addr =3D (void __user *)address;
> +	force_sig_info(SIGTRAP, &info, current);
> +}
> +
> +#ifndef CONFIG_HAVE_HW_BREAKPOINT
> +static void set_debug_reg_defaults(struct thread_struct *thread)
> +{
> +	if (thread->dabr) {
> +		thread->dabr =3D 0;
> +		set_dabr(0);
> +	}
> +}
> +#endif /* !CONFIG_HAVE_HW_BREAKPOINT */
> +#endif	/* CONFIG_PPC_ADV_DEBUG_REGS */
> +
> #ifdef CONFIG_PPC64
> DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
> #endif
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index db733d3..edc1108 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -1184,6 +1184,23 @@ void SoftwareEmulation(struct pt_regs *regs)
> #endif /* CONFIG_8xx */
>=20
> #ifdef CONFIG_PPC_ADV_DEBUG_REGS
> +static void do_send_trap(struct pt_regs *regs, unsigned long address,
> +		  unsigned long error_code, int signal_code, int =
breakpt)
> +{
> +	siginfo_t info;
> +
> +	if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
> +			11, SIGSEGV) =3D=3D NOTIFY_STOP)
> +		return;
> +
> +	/* Deliver the signal to userspace */
> +	info.si_signo =3D SIGTRAP;
> +	info.si_errno =3D breakpt;	/* breakpoint or watchpoint id =
*/
> +	info.si_code =3D signal_code;
> +	info.si_addr =3D (void __user *)address;
> +	force_sig_info(SIGTRAP, &info, current);
> +}
> +
> static void handle_debug(struct pt_regs *regs, unsigned long =
debug_status)
> {
> 	int changed =3D 0;

^ permalink raw reply related

* Re: [RFC][PATCH 2/2] Example to show use of uio pgprot
From: Kumar Gala @ 2011-10-28 17:52 UTC (permalink / raw)
  To: Greg KH; +Cc: linuxppc-dev, hjk, linux-kernel
In-Reply-To: <20111028163706.GB27444@kroah.com>


On Oct 28, 2011, at 11:37 AM, Greg KH wrote:

> On Fri, Oct 28, 2011 at 10:50:30AM -0500, Kumar Gala wrote:
>> ---
>> drivers/uio/uio_dpa.c |  200 =
+++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 files changed, 200 insertions(+), 0 deletions(-)
>> create mode 100644 drivers/uio/uio_dpa.c
>=20
> You do realize this does not build, right?
>=20
> thanks,
>=20
> greg k-h

Yes, it was meant to show Hans and example of why we need to allow a UIO =
driver to set its own pgprot.  We plan on upstream all that code, but =
wanted at least to get feedback on the general UIO change.

- k=

^ permalink raw reply

* Re: [RFC][PATCH 2/2] Example to show use of uio pgprot
From: Greg KH @ 2011-10-28 16:37 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, hjk, linux-kernel
In-Reply-To: <1319817030-23992-2-git-send-email-galak@kernel.crashing.org>

On Fri, Oct 28, 2011 at 10:50:30AM -0500, Kumar Gala wrote:
> ---
>  drivers/uio/uio_dpa.c |  200 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 200 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/uio/uio_dpa.c

You do realize this does not build, right?

thanks,

greg k-h

^ permalink raw reply

* [RFC][PATCH 2/2] Example to show use of uio pgprot
From: Kumar Gala @ 2011-10-28 15:50 UTC (permalink / raw)
  To: hjk; +Cc: Greg KH, linux-kernel, linuxppc-dev
In-Reply-To: <1319817030-23992-1-git-send-email-galak@kernel.crashing.org>

---
 drivers/uio/uio_dpa.c |  200 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 200 insertions(+), 0 deletions(-)
 create mode 100644 drivers/uio/uio_dpa.c

diff --git a/drivers/uio/uio_dpa.c b/drivers/uio/uio_dpa.c
new file mode 100644
index 0000000..19360f2
--- /dev/null
+++ b/drivers/uio/uio_dpa.c
@@ -0,0 +1,200 @@
+/* Copyright 2011 Freescale Semiconductor, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Freescale Semiconductor nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "bman_private.h"
+#include "qman_private.h"
+
+static const char dpa_uio_version[] = "USDPAA UIO portal driver v0.2";
+
+static LIST_HEAD(uio_portal_list);
+
+struct dpa_uio_info {
+	atomic_t ref; /* exclusive, only one open() at a time */
+	struct uio_info uio;
+	void *addr_ci;
+	char name[16]; /* big enough for "qman-uio-xx" */
+	struct platform_device *pdev;
+	struct list_head node;
+};
+
+static int dpa_uio_open(struct uio_info *info, struct inode *inode)
+{
+	struct dpa_uio_info *i = container_of(info, struct dpa_uio_info, uio);
+	if (!atomic_dec_and_test(&i->ref)) {
+		atomic_inc(&i->ref);
+		return -EBUSY;
+	}
+	return 0;
+}
+
+static int dpa_uio_release(struct uio_info *info, struct inode *inode)
+{
+	struct dpa_uio_info *i = container_of(info, struct dpa_uio_info, uio);
+	atomic_inc(&i->ref);
+	return 0;
+}
+
+static pgprot_t dpa_uio_pgprot(struct uio_info *info, unsigned int mem_idx,
+				   pgprot_t prot)
+{
+	if (mem_idx == DPA_PORTAL_CE)
+		/* It's the cache-enabled portal region. NB, we shouldn't use
+		 * pgprot_cached() here because it includes _PAGE_COHERENT. The
+		 * region is cachable but *not* coherent - stashing (if enabled)
+		 * leads to "coherent-like" behaviour, otherwise the driver
+		 * explicitly invalidates/prefetches. */
+		return pgprot_cached_noncoherent(prot);
+	/* Otherwise it's the cache-inhibited portal region */
+	return pgprot_noncached(prot);
+}
+
+static irqreturn_t dpa_uio_irq_handler(int irq, struct uio_info *info)
+{
+	struct dpa_uio_info *i = container_of(info, struct dpa_uio_info, uio);
+	/* This is the only code outside the regular portal driver that
+	 * manipulates any portal register, so rather than breaking that
+	 * encapsulation I am simply hard-coding the offset to the inhibit
+	 * register here. */
+	out_be32(i->addr_ci + 0xe0c, ~(u32)0);
+	return IRQ_HANDLED;
+}
+
+static void __init dpa_uio_portal_init(struct dpa_uio_portal *p,
+				const struct dpa_uio_class *c)
+{
+	struct dpa_uio_info *info;
+	const struct resource *res;
+	u32 index;
+	int irq, ret;
+
+	/* allocate 'info' */
+	info = kzalloc(sizeof(*info), GFP_KERNEL);
+	if (!info)
+		return;
+	atomic_set(&info->ref, 1);
+	if (p->type == dpa_uio_portal_bman) {
+		res = &p->bm_cfg->addr_phys[0];
+		index = p->bm_cfg->public_cfg.index;
+		irq = p->bm_cfg->public_cfg.irq;
+	} else {
+		res = &p->qm_cfg->addr_phys[0];
+		index = p->qm_cfg->public_cfg.index;
+		irq = p->qm_cfg->public_cfg.irq;
+	}
+	/* We need to map the cache-inhibited region in the kernel for
+	 * interrupt-handling purposes. */
+	info->addr_ci = ioremap_prot(res[DPA_PORTAL_CI].start,
+				resource_size(&res[DPA_PORTAL_CI]),
+				_PAGE_GUARDED | _PAGE_NO_CACHE);
+	/* Name the UIO device according to the cell-index. It's supposed to be
+	 * unique for each device class (Qman/Bman), and is also a convenient
+	 * way for user-space to find the UIO device that corresponds to a given
+	 * portal device-tree node. */
+	sprintf(info->name, "%s%x", c->dev_prefix, index);
+	info->pdev = platform_device_alloc(info->name, -1);
+	if (!info->pdev) {
+		iounmap(info->addr_ci);
+		kfree(info);
+		pr_err("dpa_uio_portal: platform_device_alloc() failed\n");
+		return;
+	}
+	ret = platform_device_add(info->pdev);
+	if (ret) {
+		platform_device_put(info->pdev);
+		iounmap(info->addr_ci);
+		kfree(info);
+		pr_err("dpa_uio_portal: platform_device_add() failed\n");
+		return;
+	}
+	info->uio.name = info->name;
+	info->uio.version = dpa_uio_version;
+	info->uio.mem[DPA_PORTAL_CE].name = "cena";
+	info->uio.mem[DPA_PORTAL_CE].addr = res[DPA_PORTAL_CE].start;
+	info->uio.mem[DPA_PORTAL_CE].size = resource_size(&res[DPA_PORTAL_CE]);
+	info->uio.mem[DPA_PORTAL_CE].memtype = UIO_MEM_PHYS;
+	info->uio.mem[DPA_PORTAL_CI].name = "cinh";
+	info->uio.mem[DPA_PORTAL_CI].addr = res[DPA_PORTAL_CI].start;
+	info->uio.mem[DPA_PORTAL_CI].size = resource_size(&res[DPA_PORTAL_CI]);
+	info->uio.mem[DPA_PORTAL_CI].memtype = UIO_MEM_PHYS;
+	info->uio.irq = irq;
+	info->uio.handler = dpa_uio_irq_handler;
+	info->uio.set_pgprot = dpa_uio_pgprot;
+	info->uio.open = dpa_uio_open;
+	info->uio.release = dpa_uio_release;
+	ret = uio_register_device(&info->pdev->dev, &info->uio);
+	if (ret) {
+		platform_device_del(info->pdev);
+		platform_device_put(info->pdev);
+		iounmap(info->addr_ci);
+		kfree(info);
+		pr_err("dpa_uio_portal: UIO registration failed\n");
+		return;
+	}
+	list_add_tail(&info->node, &uio_portal_list);
+	pr_info("USDPAA portal initialised, %s\n", info->name);
+}
+
+static int __init dpa_uio_init(void)
+{
+	const struct dpa_uio_class *classes[3], **c = classes;
+	classes[0] = dpa_uio_bman();
+	classes[1] = dpa_uio_qman();
+	classes[2] = NULL;
+	while (*c) {
+		struct dpa_uio_portal *p;
+		list_for_each_entry(p, &(*c)->list, node)
+			dpa_uio_portal_init(p, *c);
+		c++;
+	}
+	pr_info("USDPAA portal layer loaded\n");
+	return 0;
+}
+
+static void __exit dpa_uio_exit(void)
+{
+	struct dpa_uio_info *info, *tmp;
+	list_for_each_entry_safe(info, tmp, &uio_portal_list, node) {
+		list_del(&info->node);
+		uio_unregister_device(&info->uio);
+		platform_device_del(info->pdev);
+		platform_device_put(info->pdev);
+		iounmap(info->addr_ci);
+		pr_info("USDPAA portal removed, %s\n", info->name);
+		kfree(info);
+	}
+	pr_info("USDPAA portal layer unloaded\n");
+}
+
+
+module_init(dpa_uio_init)
+module_exit(dpa_uio_exit)
+MODULE_LICENSE("GPL");
+
-- 
1.7.3.4

^ permalink raw reply related

* [RFC][PATCH 1/2] uio: allow drivers to override the pgprot for mmap
From: Kumar Gala @ 2011-10-28 15:50 UTC (permalink / raw)
  To: hjk; +Cc: Greg KH, linux-kernel, linuxppc-dev

For some devices, the default behavior of pgprot_noncached() is not
appropriate for all of its mappable regions. This provides a means for
the kernel side of the UIO driver to override the flags without having
to implement its own full mmap callback.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Geoff Thorpe <geoff@geoffthorpe.net>
---
 drivers/uio/uio.c          |    6 +++++-
 include/linux/uio_driver.h |    3 +++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index dc27d89..0aebe27 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -655,7 +655,11 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
 
 	vma->vm_flags |= VM_IO | VM_RESERVED;
 
-	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+	if (idev->info->set_pgprot)
+		vma->vm_page_prot = idev->info->set_pgprot(idev->info, mi,
+							   vma->vm_page_prot);
+	else
+		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
 	return remap_pfn_range(vma,
 			       vma->vm_start,
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index fd99ff9..edfe7c8 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -80,6 +80,7 @@ struct uio_device;
  * @open:		open operation for this uio device
  * @release:		release operation for this uio device
  * @irqcontrol:		disable/enable irqs when 0/1 is written to /dev/uioX
+ * @set_pgprot:		allow driver to override default(noncached) pgprot
  */
 struct uio_info {
 	struct uio_device	*uio_dev;
@@ -95,6 +96,8 @@ struct uio_info {
 	int (*open)(struct uio_info *info, struct inode *inode);
 	int (*release)(struct uio_info *info, struct inode *inode);
 	int (*irqcontrol)(struct uio_info *info, s32 irq_on);
+	pgprot_t (*set_pgprot)(struct uio_info *uio, unsigned int mem_idx,
+			       pgprot_t prot);
 };
 
 extern int __must_check
-- 
1.7.3.4

^ permalink raw reply related

* [PATCH] NUMA topology support for powernv
From: Dipankar Sarma @ 2011-10-28 14:25 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras


This patch adds support for numa topology on powernv platforms running
OPAL formware. It checks for the type of platform at run time and
sets the affinity form correctly so that NUMA topology can be discovered
correctly.

Signed-off-by: Dipankar Sarma <dipankar@in.ibm.com>
---
 arch/powerpc/mm/numa.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 0bfb90c..58f292f 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -315,7 +315,10 @@ static int __init find_min_common_depth(void)
 	struct device_node *root;
 	const char *vec5;
 
-	root = of_find_node_by_path("/rtas");
+	if (firmware_has_feature(FW_FEATURE_OPAL))
+		root = of_find_node_by_path("/ibm,opal");
+	else
+		root = of_find_node_by_path("/rtas");
 	if (!root)
 		root = of_find_node_by_path("/");
 
@@ -344,12 +347,19 @@ static int __init find_min_common_depth(void)
 
 #define VEC5_AFFINITY_BYTE	5
 #define VEC5_AFFINITY		0x80
-	chosen = of_find_node_by_path("/chosen");
-	if (chosen) {
-		vec5 = of_get_property(chosen, "ibm,architecture-vec-5", NULL);
-		if (vec5 && (vec5[VEC5_AFFINITY_BYTE] & VEC5_AFFINITY)) {
-			dbg("Using form 1 affinity\n");
-			form1_affinity = 1;
+
+	if (firmware_has_feature(FW_FEATURE_OPAL))
+		form1_affinity = 1;
+	else {
+		chosen = of_find_node_by_path("/chosen");
+		if (chosen) {
+			vec5 = of_get_property(chosen, 
+					       "ibm,architecture-vec-5", NULL);
+			if (vec5 && (vec5[VEC5_AFFINITY_BYTE] & 
+							VEC5_AFFINITY)) {
+				dbg("Using form 1 affinity\n");
+				form1_affinity = 1;
+			}
 		}
 	}
 

^ permalink raw reply related

* Re: [PATCH 2/2] powerpc/fsl-pci: Only scan PCI bus if configured as a host
From: Kumar Gala @ 2011-10-28 13:09 UTC (permalink / raw)
  To: Jia Hongtao; +Cc: B11780, linuxppc-dev
In-Reply-To: <1319789023-8924-2-git-send-email-B38951@freescale.com>


On Oct 28, 2011, at 3:03 AM, Jia Hongtao wrote:

> If we're an agent/end-point or fsl_add_bridge doesn't succeed due to =
some
> resource failure we should not scan the PCI bus. We change =
fsl_add_bridge()
> to return -ENODEV in the case we're an agent/end-point.
>=20
> Signed-off-by: Jia Hongtao <B38951@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/sysdev/fsl_pci.c |   17 ++++++++++-------
> 1 files changed, 10 insertions(+), 7 deletions(-)
>=20
> diff --git a/arch/powerpc/sysdev/fsl_pci.c =
b/arch/powerpc/sysdev/fsl_pci.c
> index 4d4536f..caa7801 100644
> --- a/arch/powerpc/sysdev/fsl_pci.c
> +++ b/arch/powerpc/sysdev/fsl_pci.c
> @@ -370,7 +370,7 @@ int __init fsl_add_bridge(struct device_node *dev, =
int is_primary)
> 			iounmap(hose->cfg_data);
> 		iounmap(hose->cfg_addr);
> 		pcibios_free_controller(hose);
> -		return 0;
> +		return -ENODEV;
> 	}
>=20
> 	setup_pci_cmd(hose);
> @@ -418,6 +418,7 @@ void fsl_pci_setup(int primary_phb_addr)
> {
> 	struct device_node *np;
> 	struct pci_controller *hose;
> +	int ret;
> 	dma_addr_t min_dma_addr =3D 0xffffffff;
>=20
> 	for_each_node_by_type(np, "pci") {
> @@ -425,14 +426,16 @@ void fsl_pci_setup(int primary_phb_addr)
> 			struct resource rsrc;
> 			of_address_to_resource(np, 0, &rsrc);
> 			if ((rsrc.start & 0xfffff) =3D=3D =
primary_phb_addr)
> -				fsl_add_bridge(np, 1);
> +				ret =3D fsl_add_bridge(np, 1);
> 			else
> -				fsl_add_bridge(np, 0);
> +				ret =3D fsl_add_bridge(np, 0);
>=20
> -			hose =3D pci_find_hose_for_OF_device(np);
> -			min_dma_addr =3D min(min_dma_addr,
> -					hose->dma_window_base_cur
> -					+ hose->dma_window_size);
> +			if (ret =3D=3D 0) {
> +				hose =3D =
pci_find_hose_for_OF_device(np);
> +				min_dma_addr =3D min(min_dma_addr,
> +						=
hose->dma_window_base_cur
> +						+ =
hose->dma_window_size);
> +			}
>=20
> 		}
> 	}

In the failure case (i.e. when ret !=3D 0), what about the following =
code:

+#ifdef CONFIG_SWIOTLB
+	/*
+	 * if we couldn't map all of DRAM via the dma windows we need =
SWIOTLB
+	 * to handle buffers located outside of dma capable memory =
region
+	 */
+	if (memblock_end_of_DRAM() > min_dma_addr) {
+		ppc_swiotlb_enable =3D 1;
+		set_pci_dma_ops(&swiotlb_dma_ops);
+		ppc_md.pci_dma_dev_setup =3D pci_dma_dev_setup_swiotlb;
+	}
+#endif

This should get updated to be:
	if ((ret =3D=3D 0) && (memblock_end_of_DRAM() > min_dma_arr)) {

^ permalink raw reply

* [PATCH] Do not hide resource for pci/pcie when configured as Agent/EP
From: Jia Hongtao @ 2011-10-28  8:08 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: B11780, b38951

From: Jason Jin <Jason.jin@freescale.com>

Current pci/pcie init code will hide the pci/pcie host resource.
But did not judge it is host/RC or agent/EP. If configured as
agent/EP, we should avoid hiding its resource in the host side.

In PCI system, the Programing Interface can be used to judge the
host/agent status:
Programing Interface = 0: host
Programing Interface = 1: Agent

In PCIE system, both the Programing Interface and Header type can
be used to judge the RC/EP status.
Header Type = 0: EP
Header Type = 1: RC

Signed-off-by: Jason Jin <Jason.jin@freescale.com>
Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/kernel/pci-common.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 4f134132c..bc61a69 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1732,10 +1732,13 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
 static void fixup_hide_host_resource_fsl(struct pci_dev *dev)
 {
 	int i, class = dev->class >> 8;
+	/* When configured as agent, programing interface = 1 */
+	int prog_if = dev->class & 0xf;
 
 	if ((class == PCI_CLASS_PROCESSOR_POWERPC ||
 	     class == PCI_CLASS_BRIDGE_OTHER) &&
 		(dev->hdr_type == PCI_HEADER_TYPE_NORMAL) &&
+		(prog_if == 0) &&
 		(dev->bus->parent == NULL)) {
 		for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
 			dev->resource[i].start = 0;
-- 
1.7.5.1

^ permalink raw reply related

* [PATCH 2/2] powerpc/fsl-pci: Only scan PCI bus if configured as a host
From: Jia Hongtao @ 2011-10-28  8:03 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: B11780, b38951
In-Reply-To: <1319789023-8924-1-git-send-email-B38951@freescale.com>

If we're an agent/end-point or fsl_add_bridge doesn't succeed due to some
resource failure we should not scan the PCI bus. We change fsl_add_bridge()
to return -ENODEV in the case we're an agent/end-point.

Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/sysdev/fsl_pci.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 4d4536f..caa7801 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -370,7 +370,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
 			iounmap(hose->cfg_data);
 		iounmap(hose->cfg_addr);
 		pcibios_free_controller(hose);
-		return 0;
+		return -ENODEV;
 	}
 
 	setup_pci_cmd(hose);
@@ -418,6 +418,7 @@ void fsl_pci_setup(int primary_phb_addr)
 {
 	struct device_node *np;
 	struct pci_controller *hose;
+	int ret;
 	dma_addr_t min_dma_addr = 0xffffffff;
 
 	for_each_node_by_type(np, "pci") {
@@ -425,14 +426,16 @@ void fsl_pci_setup(int primary_phb_addr)
 			struct resource rsrc;
 			of_address_to_resource(np, 0, &rsrc);
 			if ((rsrc.start & 0xfffff) == primary_phb_addr)
-				fsl_add_bridge(np, 1);
+				ret = fsl_add_bridge(np, 1);
 			else
-				fsl_add_bridge(np, 0);
+				ret = fsl_add_bridge(np, 0);
 
-			hose = pci_find_hose_for_OF_device(np);
-			min_dma_addr = min(min_dma_addr,
-					hose->dma_window_base_cur
-					+ hose->dma_window_size);
+			if (ret == 0) {
+				hose = pci_find_hose_for_OF_device(np);
+				min_dma_addr = min(min_dma_addr,
+						hose->dma_window_base_cur
+						+ hose->dma_window_size);
+			}
 
 		}
 	}
-- 
1.7.5.1

^ permalink raw reply related

* [PATCH 1/2] Unify pci/pcie initialization code
From: Jia Hongtao @ 2011-10-28  8:03 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: B11780, b38951

In previous version pci/pcie initialization is in platform code which
Initialize PCI bridge base on EP/RC or host/agent settings.
We unified pci/pcie initialization as common APIs named fsl_pci_setup
which can be called by platform code.

Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
We only changed MPC85xxDS board as an example.
If no problem in the review we will change other boards also.

 arch/powerpc/platforms/85xx/mpc85xx_ds.c |   30 ++-----------------
 arch/powerpc/sysdev/fsl_pci.c            |   48 ++++++++++++++++++++++++++++++
 arch/powerpc/sysdev/fsl_pci.h            |    5 +++
 3 files changed, 56 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 10e7db0..7188c0b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -157,33 +157,12 @@ extern void __init mpc85xx_smp_init(void);
 #endif
 static void __init mpc85xx_ds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-	struct pci_controller *hose;
-#endif
-	dma_addr_t max = 0xffffffff;
-
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
-		    of_device_is_compatible(np, "fsl,p2020-pcie")) {
-			struct resource rsrc;
-			of_address_to_resource(np, 0, &rsrc);
-			if ((rsrc.start & 0xfffff) == primary_phb_addr)
-				fsl_add_bridge(np, 1);
-			else
-				fsl_add_bridge(np, 0);
-
-			hose = pci_find_hose_for_OF_device(np);
-			max = min(max, hose->dma_window_base_cur +
-					hose->dma_window_size);
-		}
-	}
+	fsl_pci_setup(primary_phb_addr);
 
+#ifdef CONFIG_PCI
 	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 
@@ -192,11 +171,8 @@ static void __init mpc85xx_ds_setup_arch(void)
 #endif
 
 #ifdef CONFIG_SWIOTLB
-	if (memblock_end_of_DRAM() > max) {
+	if (memblock_end_of_DRAM() > 0xffffffff)
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
 #endif
 
 	printk("MPC85xx DS board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 80b8b7a..4d4536f 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -402,6 +402,54 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
 }
 #endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */
 
+static struct of_device_id pci_ids[] = {
+	{ .compatible = "fsl,mpc8540-pci", },
+	{ .compatible = "fsl,mpc8548-pcie", },
+	{},
+};
+
+/**
+ * fsl_pci_setup - Initialization for PCI
+ * @primary_phb_addr: primary bus address
+ *
+ * Add bridge if pci controller is a host
+ */
+void fsl_pci_setup(int primary_phb_addr)
+{
+	struct device_node *np;
+	struct pci_controller *hose;
+	dma_addr_t min_dma_addr = 0xffffffff;
+
+	for_each_node_by_type(np, "pci") {
+		if (of_match_node(pci_ids, np)) {
+			struct resource rsrc;
+			of_address_to_resource(np, 0, &rsrc);
+			if ((rsrc.start & 0xfffff) == primary_phb_addr)
+				fsl_add_bridge(np, 1);
+			else
+				fsl_add_bridge(np, 0);
+
+			hose = pci_find_hose_for_OF_device(np);
+			min_dma_addr = min(min_dma_addr,
+					hose->dma_window_base_cur
+					+ hose->dma_window_size);
+
+		}
+	}
+
+#ifdef CONFIG_SWIOTLB
+	/*
+	 * if we couldn't map all of DRAM via the dma windows we need SWIOTLB
+	 * to handle buffers located outside of dma capable memory region
+	 */
+	if (memblock_end_of_DRAM() > min_dma_addr) {
+		ppc_swiotlb_enable = 1;
+		set_pci_dma_ops(&swiotlb_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
+	}
+#endif
+}
+
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, quirk_fsl_pcie_header);
 
 #if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x)
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index a39ed5c..775ea21 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -89,6 +89,11 @@ struct ccsr_pci {
 };
 
 extern int fsl_add_bridge(struct device_node *dev, int is_primary);
+#ifndef CONFIG_PCI
+#define fsl_pci_setup(p)
+#else
+extern void fsl_pci_setup(int primary_phb_addr);
+#endif
 extern void fsl_pcibios_fixup_bus(struct pci_bus *bus);
 extern int mpc83xx_add_bridge(struct device_node *dev);
 u64 fsl_pci_immrbar_base(struct pci_controller *hose);
-- 
1.7.5.1

^ permalink raw reply related

* [PATCH SDK1.1 ] Do not hide resource for pci/pcie when configured as Agent/EP
From: Jia Hongtao @ 2011-10-28  5:52 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: B11780, b38951

From: Jason Jin <Jason.jin@freescale.com>

Current pci/pcie init code will hide the pci/pcie host resource.
But did not judge it is host/RC or agent/EP. If configured as
agent/EP, we should avoid hiding its resource in the host side.

In PCI system, the Programing Interface can be used to judge the
host/agent status:
Programing Interface = 0: host
Programing Interface = 1: Agent

In PCIE system, both the Programing Interface and Header type can
be used to judge the RC/EP status.
Header Type = 0: EP
Header Type = 1: RC

Signed-off-by: Jason Jin <Jason.jin@freescale.com>
Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/kernel/pci-common.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 4f134132c..bc61a69 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1732,10 +1732,13 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
 static void fixup_hide_host_resource_fsl(struct pci_dev *dev)
 {
 	int i, class = dev->class >> 8;
+	/* When configured as agent, programing interface = 1 */
+	int prog_if = dev->class & 0xf;
 
 	if ((class == PCI_CLASS_PROCESSOR_POWERPC ||
 	     class == PCI_CLASS_BRIDGE_OTHER) &&
 		(dev->hdr_type == PCI_HEADER_TYPE_NORMAL) &&
+		(prog_if == 0) &&
 		(dev->bus->parent == NULL)) {
 		for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
 			dev->resource[i].start = 0;
-- 
1.7.5.1

^ permalink raw reply related

* Re: [PATCH 2/3] [44x] Enable CONFIG_RELOCATABLE for PPC44x
From: Suzuki Poulose @ 2011-10-28  5:03 UTC (permalink / raw)
  To: Scott Wood
  Cc: Michal Simek, tmarri, Mahesh Jagannath Salgaonkar, Dave Hansen,
	David Laight, Paul Mackerras, linux ppc dev, Vivek Goyal
In-Reply-To: <4EA97BB1.8020009@freescale.com>

On 10/27/11 21:11, Scott Wood wrote:
> On 10/27/2011 03:43 AM, Suzuki Poulose wrote:
>> On 10/27/11 00:46, Scott Wood wrote:
>>> On 10/26/2011 02:12 PM, Suzuki Poulose wrote:
>>>> I have renamed the new type of relocation to RELOCATABLE_PPC32_PIE. The
>>>> patches
>>>> were posted yesterday. Please let me know your thoughts.
>>>
>>> I think it would make more sense to rename the existing behavior (maybe
>>> something like DYNAMIC_MEMSTART -- if there's even enough overhead to
>>> make it worth being configurable at all), since it's not fully
>>> relocatable and since 64-bit already uses RELOCATABLE to mean PIE.
>>
>> I think leaving the current behaviour as it is, and adding the PIE as an
>> additional configuration option would be safe and wouldn't disturb the
>> existing dependencies.
>
> That's how things grow to be an unmaintainable mess.  AFAICT, what
> you're doing is the same as what 64-bit does for RELOCATABLE.  If
> they're doing the same thing, they should be called the same thing.
> Whereas 64-bit and e500 are currently doing different things for
> RELOCATABLE -- so they should be called different things.

OK. Agreed. I will resend the patches with the change.

Thanks
Suzuki

^ permalink raw reply

* Re: Kernel hang on PS3 with SMP
From: Geoff Levand @ 2011-10-28  1:17 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: cbe-oss-dev, Andre Heider, linuxppc-dev, Frank Rowand
In-Reply-To: <1310808863.13765.3.camel@twins>

Hi,

On 07/16/2011 02:34 AM, Peter Zijlstra wrote:
> On Sat, 2011-07-16 at 09:38 +0200, Andre Heider wrote:
>> Hi,
>> 
>> when I boot a recent kernel I'm getting hangs early in the boot process.
>> 
>> The kernel boots most of the time, but when /sbin/init kicks in it
>> waits forever for something. I only get a few lines of output, mostly
>> udev related.
>> When the kernel does not boot, it seems to hang somewhere when mapping
>> the irqs (at least that's what the last lines of ps3fb output
>> suggest).
>> I can run into both situation with the same kernel binary. It's also
>> consistent with two userlands, I tried debian stable and testing.
>> 
>> When this happens, I can't interact with the system, so I don't have
>> much more info.
>> 
>> I bisected this to:
>> 
>> commit 317f394160e9beb97d19a84c39b7e5eb3d7815a8
>> Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
>> Date:   Tue Apr 5 17:23:58 2011 +0200
>> 
>>     sched: Move the second half of ttwu() to the remote cpu
>> 
>> All kernels including this patch only work for me when booted with 'nosmp'.

I verified that indeed 317f394160e9beb97d19a84c39b7e5eb3d7815a8
'sched: Move the second half of ttwu() to the remote cpu' introduces
the hang.

>> Any ideas?
> 
> Verify 184748cc50b2dceb8287f9fb657eda48ff8fcfe7 does indeed cover your
> PPC flavour. It has some ppc changes, but I could have missed PS3 if its
> 'special'.

I don't think PS3 is special.  The IPI code is here:

  http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=arch/powerpc/platforms/ps3/smp.c;hb=HEAD

> Another thing to check is if your sched IPI handler calls
> irq_enter()/irq_exit(), if not try that.

I tried adding some these, but no change.

I tried to figure out what is happening, but I can't seem to.  It seems
when ttwu_queue_remote() is used the pending scheduling is not performed.

I can't say for sure what is happening.  With the test patch below the
system boots OK.

Also, if I add a udbg_printf(".") statement in the body of ps3's do_message_pass()
the system boots OK.

Any help would be greatly appreciated.

-Geoff

diff --git a/kernel/sched.c b/kernel/sched.c
index 9e3ede1..c16a35a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2561,21 +2561,21 @@ static void ttwu_queue_remote(struct task_struct *p, int cpu)
 
 	if (!next)
 		smp_send_reschedule(cpu);
 }
 #endif
 
 static void ttwu_queue(struct task_struct *p, int cpu)
 {
 	struct rq *rq = cpu_rq(cpu);
 
-#if defined(CONFIG_SMP) && defined(CONFIG_SCHED_TTWU_QUEUE)
+#if 0 //defined(CONFIG_SMP) && defined(CONFIG_SCHED_TTWU_QUEUE)
 	if (sched_feat(TTWU_QUEUE) && cpu != smp_processor_id()) {
 		ttwu_queue_remote(p, cpu);
 		return;
 	}
 #endif
 
 	raw_spin_lock(&rq->lock);
 	ttwu_do_activate(rq, p, 0);
 	raw_spin_unlock(&rq->lock);
 }

^ permalink raw reply related

* RE: [PATCH v15 00/10] Add-Synopsys-DesignWare-HS-USB-OTG-driver
From: Tirumala Marri @ 2011-10-28  0:25 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linuxppc-dev
In-Reply-To: <20111027045103.GA609@kroah.com>

>
>What email client are you using, I have never seen this type of
>formatting, and it makes it impossible to read your replies.  Please
>resolve this.
Wrong prefix setting. Should be fixed now.

>Sometimes people miss things on previous reviews, this is not a perfict
>system, only the best that we currently know how to do, don't you agree?
>
>If this driver contains lots of things that are not necessary for it to
>work at this point in time, why wouldn't that be removed now?
>
>Anyway, I think it would probably be best to get this into staging for
>now, which will help you get a way to clean it up in an easier manner,
>and still have users have access to it.  Is that acceptable?
>
Yes it would be great if it can make it to staging. I will try remove
The un used code and re-send the patch.

Thx,
Marri

^ permalink raw reply

* [PATCH v2] asm-generic/gpio.h: merge basic gpiolib wrappers
From: Mike Frysinger @ 2011-10-27 22:52 UTC (permalink / raw)
  To: Grant Likely, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Haavard Skinnemoen, Hans-Christian Egtvedt, Tony Luck, Fenghua Yu,
	Michal Simek, Ralf Baechle, Paul Mundt, Jonas Bonn,
	Paul Mackerras, Benjamin Herrenschmidt, David S. Miller,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Chris Zankel,
	Russell King, Guan Xuetao, Mark Brown
  Cc: linux-arch, linux-mips, x86, linux-ia64, linux-sh,
	microblaze-uclinux, linux, linux-kernel, linux-m68k,
	Mike Frysinger, linux-alpha, sparclinux, uclinux-dist-devel,
	linuxppc-dev, linux-arm-kernel
In-Reply-To: <1319720503-3183-1-git-send-email-vapier@gentoo.org>

Rather than requiring architectures that use gpiolib but don't have
any need to define anything custom to copy an asm/gpio.h, merge this
code into the asm-generic/gpio.h.  We add ifdef checks so that arches
can still override things while using the asm-generic/gpio.h, but on
a more fine grained per-func approach.

I've compile tested these guys (with & without GPIOLIB), but don't
have the hardware to boot:
	- alpha defconfig
	- arm: every defconfig
	- blackfin defconfig
	- ia64 defconfig
	- m68k: multi & m5208evb defconfig
	- mips: ar7 & ath79 & bcm47xx & bcm63xx & ip22 defconfig
	- powerpc: mpc85xx & ppc64 defconfig
	- sh: kfr2r09 defconfig
	- sparc defconfig
	- x86_64 defconfig

There is concern for adding code to the arm gpio headers, but since my
diffstat removes more than it adds, and it only adds when there are funcs
which need to be customized in the first place, I think this holds to the
desire to ultimately kill off (when possible) the misc sub gpio headers.
After all, if you can kill the overridden function, my additional lines
shouldn't be needed either.

I don't have any toolchains for avr32, microblaze, openrisc, unicore32,
or xtensa.  So they lose :x.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
	- grub through arm gpio.h headers
	- add m68k support

note: i've done a full build of all arm defconfigs, and any warnings
	or build failures appear to be unrelated to my change (sadly, there
	seem to be way more than there should be ...).  i'll start a 2nd
	build which compares the binary output to make sure they're the
	same, but if people see something that needs more attention before
	that, feel free to highlight it.

 arch/alpha/include/asm/Kbuild                   |    2 +
 arch/alpha/include/asm/gpio.h                   |   55 -------------------
 arch/arm/include/asm/gpio.h                     |   16 ------
 arch/arm/include/asm/hardware/iop3xx-gpio.h     |   21 ++------
 arch/arm/mach-davinci/include/mach/gpio.h       |   11 ++--
 arch/arm/mach-ixp4xx/include/mach/gpio.h        |    8 +--
 arch/arm/mach-ks8695/include/mach/gpio.h        |    1 +
 arch/arm/mach-mmp/include/mach/gpio.h           |    2 -
 arch/arm/mach-pxa/include/mach/gpio.h           |    2 +-
 arch/arm/mach-sa1100/include/mach/gpio.h        |   13 ++---
 arch/arm/mach-shmobile/include/mach/gpio.h      |   16 ------
 arch/arm/mach-w90x900/include/mach/gpio.h       |    1 +
 arch/arm/plat-mxc/include/mach/irqs.h           |    2 -
 arch/arm/plat-omap/include/plat/gpio.h          |    4 +-
 arch/arm/plat-pxa/include/plat/gpio.h           |    6 +--
 arch/avr32/mach-at32ap/include/mach/gpio.h      |   19 +------
 arch/blackfin/include/asm/gpio.h                |   16 ++----
 arch/ia64/include/asm/Kbuild                    |    2 +
 arch/ia64/include/asm/gpio.h                    |   55 -------------------
 arch/m68k/include/asm/gpio.h                    |    7 +++
 arch/microblaze/include/asm/Kbuild              |    2 +
 arch/microblaze/include/asm/gpio.h              |   53 ------------------
 arch/mips/include/asm/mach-ar7/gpio.h           |    5 --
 arch/mips/include/asm/mach-ath79/gpio.h         |    8 ++-
 arch/mips/include/asm/mach-bcm47xx/gpio.h       |    3 +
 arch/mips/include/asm/mach-bcm63xx/gpio.h       |    5 --
 arch/mips/include/asm/mach-generic/gpio.h       |    8 +--
 arch/mips/include/asm/mach-loongson/gpio.h      |    7 +--
 arch/mips/include/asm/mach-rc32434/gpio.h       |   10 +---
 arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h |   12 +---
 arch/openrisc/include/asm/Kbuild                |    1 +
 arch/openrisc/include/asm/gpio.h                |   65 -----------------------
 arch/powerpc/include/asm/Kbuild                 |    2 +
 arch/powerpc/include/asm/gpio.h                 |   53 ------------------
 arch/sh/include/asm/gpio.h                      |   32 +-----------
 arch/sparc/include/asm/Kbuild                   |    1 +
 arch/sparc/include/asm/gpio.h                   |   36 -------------
 arch/unicore32/include/asm/gpio.h               |    8 ++-
 arch/x86/include/asm/Kbuild                     |    2 +
 arch/x86/include/asm/gpio.h                     |   53 ------------------
 arch/xtensa/include/asm/Kbuild                  |    2 +
 arch/xtensa/include/asm/gpio.h                  |   56 -------------------
 include/asm-generic/gpio.h                      |   23 ++++++++
 43 files changed, 105 insertions(+), 601 deletions(-)
 delete mode 100644 arch/alpha/include/asm/gpio.h
 delete mode 100644 arch/ia64/include/asm/gpio.h
 delete mode 100644 arch/microblaze/include/asm/gpio.h
 delete mode 100644 arch/openrisc/include/asm/gpio.h
 delete mode 100644 arch/powerpc/include/asm/gpio.h
 delete mode 100644 arch/sparc/include/asm/gpio.h
 delete mode 100644 arch/x86/include/asm/gpio.h
 delete mode 100644 arch/xtensa/include/asm/gpio.h

diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index e423def..0bcff1a 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += compiler.h
 header-y += console.h
 header-y += fpu.h
diff --git a/arch/alpha/include/asm/gpio.h b/arch/alpha/include/asm/gpio.h
deleted file mode 100644
index 7dc6a63..0000000
--- a/arch/alpha/include/asm/gpio.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Generic GPIO API implementation for Alpha.
- *
- * A stright copy of that for PowerPC which was:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.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.
- */
-
-#ifndef _ASM_ALPHA_GPIO_H
-#define _ASM_ALPHA_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_ALPHA_GPIO_H */
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 11ad0bf..9818329 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -4,23 +4,7 @@
 /* not all ARM platforms necessarily support this API ... */
 #include <mach/gpio.h>
 
-#ifndef __ARM_GPIOLIB_COMPLEX
 /* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
 #include <asm-generic/gpio.h>
 
-/* The trivial gpiolib dispatchers */
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-#endif
-
-/*
- * Provide a default gpio_to_irq() which should satisfy every case.
- * However, some platforms want to do this differently, so allow them
- * to override it.
- */
-#ifndef gpio_to_irq
-#define gpio_to_irq	__gpio_to_irq
-#endif
-
 #endif /* _ARCH_ARM_GPIO_H */
diff --git a/arch/arm/include/asm/hardware/iop3xx-gpio.h b/arch/arm/include/asm/hardware/iop3xx-gpio.h
index 9eda7dc..4033b81 100644
--- a/arch/arm/include/asm/hardware/iop3xx-gpio.h
+++ b/arch/arm/include/asm/hardware/iop3xx-gpio.h
@@ -25,11 +25,14 @@
 #ifndef __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
 #define __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_cansleep gpio_cansleep
+
 #include <mach/hardware.h>
 #include <asm-generic/gpio.h>
 
-#define __ARM_GPIOLIB_COMPLEX
-
 #define IOP3XX_N_GPIOS	8
 
 static inline int gpio_get_value(unsigned gpio)
@@ -57,19 +60,5 @@ static inline int gpio_cansleep(unsigned gpio)
 		return __gpio_cansleep(gpio);
 }
 
-/*
- * The GPIOs are not generating any interrupt
- * Note : manuals are not clear about this
- */
-static inline int gpio_to_irq(int gpio)
-{
-	return -EINVAL;
-}
-
-static inline int irq_to_gpio(int gpio)
-{
-	return -EINVAL;
-}
-
 #endif
 
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
index fbaae47..1604005 100644
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ b/arch/arm/mach-davinci/include/mach/gpio.h
@@ -13,6 +13,11 @@
 #ifndef	__DAVINCI_GPIO_H
 #define	__DAVINCI_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_set_value gpio_set_value
+#define gpio_get_value gpio_get_value
+#define gpio_cansleep gpio_cansleep
+
 #include <asm-generic/gpio.h>
 
 /* The inline versions use the static inlines in the driver header */
@@ -77,10 +82,4 @@ static inline int gpio_cansleep(unsigned gpio)
 		return __gpio_cansleep(gpio);
 }
 
-static inline int irq_to_gpio(unsigned irq)
-{
-	/* don't support the reverse mapping */
-	return -ENOSYS;
-}
-
 #endif				/* __DAVINCI_GPIO_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h
index 83d6b4e..7835e31 100644
--- a/arch/arm/mach-ixp4xx/include/mach/gpio.h
+++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
@@ -28,8 +28,6 @@
 #include <linux/kernel.h>
 #include <mach/hardware.h>
 
-#define __ARM_GPIOLIB_COMPLEX
-
 static inline int gpio_request(unsigned gpio, const char *label)
 {
 	return 0;
@@ -63,17 +61,17 @@ static inline int gpio_get_value(unsigned gpio)
 
 	return value;
 }
+#define gpio_get_value gpio_get_value
 
 static inline void gpio_set_value(unsigned gpio, int value)
 {
 	gpio_line_set(gpio, value);
 }
-
-#include <asm-generic/gpio.h>			/* cansleep wrappers */
+#define gpio_set_value gpio_set_value
 
 extern int gpio_to_irq(int gpio);
 #define gpio_to_irq gpio_to_irq
 extern int irq_to_gpio(unsigned int irq);
+#define irq_to_gpio irq_to_gpio
 
 #endif
-
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h
index f5fda36..d81c6f8 100644
--- a/arch/arm/mach-ks8695/include/mach/gpio.h
+++ b/arch/arm/mach-ks8695/include/mach/gpio.h
@@ -15,5 +15,6 @@
  * Map IRQ number to GPIO line.
  */
 extern int irq_to_gpio(unsigned int irq);
+#define irq_to_gpio irq_to_gpio
 
 #endif
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
index 6812623..871b4c8 100644
--- a/arch/arm/mach-mmp/include/mach/gpio.h
+++ b/arch/arm/mach-mmp/include/mach/gpio.h
@@ -1,8 +1,6 @@
 #ifndef __ASM_MACH_GPIO_H
 #define __ASM_MACH_GPIO_H
 
-#include <asm-generic/gpio.h>
-
 #define gpio_to_irq(gpio)	(IRQ_GPIO_START + (gpio))
 #define irq_to_gpio(irq)	((irq) - IRQ_GPIO_START)
 
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
index 004cade..a28277c 100644
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -24,7 +24,6 @@
 #ifndef __ASM_ARCH_PXA_GPIO_H
 #define __ASM_ARCH_PXA_GPIO_H
 
-#include <asm-generic/gpio.h>
 /* The defines for the driver are needed for the accelerated accessors */
 #include "gpio-pxa.h"
 
@@ -43,6 +42,7 @@ static inline int irq_to_gpio(unsigned int irq)
 
 	return -1;
 }
+#define irq_to_gpio irq_to_gpio
 
 #include <plat/gpio.h>
 #endif
diff --git a/arch/arm/mach-sa1100/include/mach/gpio.h b/arch/arm/mach-sa1100/include/mach/gpio.h
index 7036318..6198f7a 100644
--- a/arch/arm/mach-sa1100/include/mach/gpio.h
+++ b/arch/arm/mach-sa1100/include/mach/gpio.h
@@ -24,12 +24,16 @@
 #ifndef __ASM_ARCH_SA1100_GPIO_H
 #define __ASM_ARCH_SA1100_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_to_irq(gpio)	((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
+					(IRQ_GPIO11 - 11 + gpio))
+
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm-generic/gpio.h>
 
-#define __ARM_GPIOLIB_COMPLEX
-
 static inline int gpio_get_value(unsigned gpio)
 {
 	if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
@@ -49,9 +53,4 @@ static inline void gpio_set_value(unsigned gpio, int value)
 		__gpio_set_value(gpio, value);
 }
 
-#define gpio_cansleep	__gpio_cansleep
-
-#define gpio_to_irq(gpio)	((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
-					(IRQ_GPIO11 - 11 + gpio))
-
 #endif
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
index 7bf0890..f8a5637 100644
--- a/arch/arm/mach-shmobile/include/mach/gpio.h
+++ b/arch/arm/mach-shmobile/include/mach/gpio.h
@@ -10,23 +10,7 @@
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H
 
-#include <linux/kernel.h>
-#include <linux/errno.h>
-
 #define ARCH_NR_GPIOS 1024
 #include <linux/sh_pfc.h>
 
-#ifdef CONFIG_GPIOLIB
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -ENOSYS;
-}
-
-#else
-
-#define __ARM_GPIOLIB_COMPLEX
-
-#endif /* CONFIG_GPIOLIB */
-
 #endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-w90x900/include/mach/gpio.h b/arch/arm/mach-w90x900/include/mach/gpio.h
index 5385a42..c905219 100644
--- a/arch/arm/mach-w90x900/include/mach/gpio.h
+++ b/arch/arm/mach-w90x900/include/mach/gpio.h
@@ -26,5 +26,6 @@ static inline int irq_to_gpio(unsigned irq)
 {
 	return irq;
 }
+#define irq_to_gpio irq_to_gpio
 
 #endif
diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
index 00e812b..4589307 100644
--- a/arch/arm/plat-mxc/include/mach/irqs.h
+++ b/arch/arm/plat-mxc/include/mach/irqs.h
@@ -11,8 +11,6 @@
 #ifndef __ASM_ARCH_MXC_IRQS_H__
 #define __ASM_ARCH_MXC_IRQS_H__
 
-#include <asm-generic/gpio.h>
-
 /*
  * SoCs with TZIC interrupt controller have 128 IRQs, those with AVIC have 64
  */
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 9e86ee0..1fd4986 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -219,9 +219,6 @@ extern void omap_gpio_restore_context(void);
  * The original OMAP-specific calls should eventually be removed.
  */
 
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
 static inline int irq_to_gpio(unsigned irq)
 {
 	int tmp;
@@ -238,5 +235,6 @@ static inline int irq_to_gpio(unsigned irq)
 	/* we don't supply reverse mappings for non-SOC gpios */
 	return -EIO;
 }
+#define irq_to_gpio irq_to_gpio
 
 #endif
diff --git a/arch/arm/plat-pxa/include/plat/gpio.h b/arch/arm/plat-pxa/include/plat/gpio.h
index 258f772..4ee329c 100644
--- a/arch/arm/plat-pxa/include/plat/gpio.h
+++ b/arch/arm/plat-pxa/include/plat/gpio.h
@@ -1,8 +1,6 @@
 #ifndef __PLAT_GPIO_H
 #define __PLAT_GPIO_H
 
-#define __ARM_GPIOLIB_COMPLEX
-
 /* The individual machine provides register offsets and NR_BUILTIN_GPIO */
 #include <mach/gpio-pxa.h>
 
@@ -13,6 +11,7 @@ static inline int gpio_get_value(unsigned gpio)
 	else
 		return __gpio_get_value(gpio);
 }
+#define gpio_get_value gpio_get_value
 
 static inline void gpio_set_value(unsigned gpio, int value)
 {
@@ -24,7 +23,6 @@ static inline void gpio_set_value(unsigned gpio, int value)
 	} else
 		__gpio_set_value(gpio, value);
 }
-
-#define gpio_cansleep		__gpio_cansleep
+#define gpio_set_value gpio_set_value
 
 #endif /* __PLAT_GPIO_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/gpio.h b/arch/avr32/mach-at32ap/include/mach/gpio.h
index 0180f58..f2ff962 100644
--- a/arch/avr32/mach-at32ap/include/mach/gpio.h
+++ b/arch/avr32/mach-at32ap/include/mach/gpio.h
@@ -10,26 +10,13 @@
  */
 #define ARCH_NR_GPIOS	(NR_GPIO_IRQS + 2 * 32)
 
+/* We implement a few ourself */
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
 
 /* Arch-neutral GPIO API, supporting both "native" and external GPIOs. */
 #include <asm-generic/gpio.h>
 
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-
 static inline int gpio_to_irq(unsigned int gpio)
 {
 	if (gpio < NR_GPIO_IRQS)
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 5a25856..6e25dcc 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -189,6 +189,12 @@ void bfin_gpio_set_value(unsigned gpio, int value);
 #include <asm/errno.h>
 
 #ifdef CONFIG_GPIOLIB
+
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define irq_to_gpio irq_to_gpio
+
 #include <asm-generic/gpio.h>		/* cansleep wrappers */
 
 static inline int gpio_get_value(unsigned int gpio)
@@ -207,16 +213,6 @@ static inline void gpio_set_value(unsigned int gpio, int value)
 		__gpio_set_value(gpio, value);
 }
 
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
 #else /* !CONFIG_GPIOLIB */
 
 static inline int gpio_request(unsigned gpio, const char *label)
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 241d1c5..d0fdd2d 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += break.h
 header-y += fpu.h
 header-y += gcc_intrin.h
diff --git a/arch/ia64/include/asm/gpio.h b/arch/ia64/include/asm/gpio.h
deleted file mode 100644
index 590a20d..0000000
--- a/arch/ia64/include/asm/gpio.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Generic GPIO API implementation for IA-64.
- *
- * A stright copy of that for PowerPC which was:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.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.
- */
-
-#ifndef _ASM_IA64_GPIO_H
-#define _ASM_IA64_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_IA64_GPIO_H */
diff --git a/arch/m68k/include/asm/gpio.h b/arch/m68k/include/asm/gpio.h
index b204683..4544b6a 100644
--- a/arch/m68k/include/asm/gpio.h
+++ b/arch/m68k/include/asm/gpio.h
@@ -16,6 +16,13 @@
 #ifndef coldfire_gpio_h
 #define coldfire_gpio_h
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_cansleep gpio_cansleep
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
+
 #include <linux/io.h>
 #include <asm-generic/gpio.h>
 #include <asm/coldfire.h>
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index db5294c..5bf1ca7 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -1,3 +1,5 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y  += elf.h
diff --git a/arch/microblaze/include/asm/gpio.h b/arch/microblaze/include/asm/gpio.h
deleted file mode 100644
index 2b2c18b..0000000
--- a/arch/microblaze/include/asm/gpio.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generic GPIO API implementation for PowerPC.
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.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.
- */
-
-#ifndef _ASM_MICROBLAZE_GPIO_H
-#define _ASM_MICROBLAZE_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_MICROBLAZE_GPIO_H */
diff --git a/arch/mips/include/asm/mach-ar7/gpio.h b/arch/mips/include/asm/mach-ar7/gpio.h
index c177cd1..78f40c2 100644
--- a/arch/mips/include/asm/mach-ar7/gpio.h
+++ b/arch/mips/include/asm/mach-ar7/gpio.h
@@ -27,11 +27,6 @@
 
 #define gpio_to_irq(gpio)	-1
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-
-#define gpio_cansleep __gpio_cansleep
-
 /* Board specific GPIO functions */
 int ar7_gpio_enable(unsigned gpio);
 int ar7_gpio_disable(unsigned gpio);
diff --git a/arch/mips/include/asm/mach-ath79/gpio.h b/arch/mips/include/asm/mach-ath79/gpio.h
index 60dcb62..2c570a0 100644
--- a/arch/mips/include/asm/mach-ath79/gpio.h
+++ b/arch/mips/include/asm/mach-ath79/gpio.h
@@ -13,6 +13,12 @@
 #ifndef __ASM_MACH_ATH79_GPIO_H
 #define __ASM_MACH_ATH79_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
+
 #define ARCH_NR_GPIOS	64
 #include <asm-generic/gpio.h>
 
@@ -21,6 +27,4 @@ int irq_to_gpio(unsigned irq);
 int gpio_get_value(unsigned gpio);
 void gpio_set_value(unsigned gpio, int value);
 
-#define gpio_cansleep	__gpio_cansleep
-
 #endif /* __ASM_MACH_ATH79_GPIO_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h
index 76961ca..d678316 100644
--- a/arch/mips/include/asm/mach-bcm47xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h
@@ -19,6 +19,7 @@
 extern int gpio_request(unsigned gpio, const char *label);
 extern void gpio_free(unsigned gpio);
 extern int gpio_to_irq(unsigned gpio);
+#define gpio_to_irq gpio_to_irq
 
 static inline int gpio_get_value(unsigned gpio)
 {
@@ -35,6 +36,7 @@ static inline int gpio_get_value(unsigned gpio)
 	}
 	return -EINVAL;
 }
+#define gpio_get_value gpio_get_value
 
 static inline void gpio_set_value(unsigned gpio, int value)
 {
@@ -53,6 +55,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
 #endif
 	}
 }
+#define gpio_set_value gpio_set_value
 
 static inline int gpio_direction_input(unsigned gpio)
 {
diff --git a/arch/mips/include/asm/mach-bcm63xx/gpio.h b/arch/mips/include/asm/mach-bcm63xx/gpio.h
index 1eb534d..c71bf66 100644
--- a/arch/mips/include/asm/mach-bcm63xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm63xx/gpio.h
@@ -5,11 +5,6 @@
 
 #define gpio_to_irq(gpio)	-1
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-
-#define gpio_cansleep __gpio_cansleep
-
 #include <asm-generic/gpio.h>
 
 #endif /* __ASM_MIPS_MACH_BCM63XX_GPIO_H */
diff --git a/arch/mips/include/asm/mach-generic/gpio.h b/arch/mips/include/asm/mach-generic/gpio.h
index b4e7020..e8a89c5 100644
--- a/arch/mips/include/asm/mach-generic/gpio.h
+++ b/arch/mips/include/asm/mach-generic/gpio.h
@@ -1,11 +1,7 @@
 #ifndef __ASM_MACH_GENERIC_GPIO_H
 #define __ASM_MACH_GENERIC_GPIO_H
 
-#ifdef CONFIG_GPIOLIB
-#define gpio_get_value	__gpio_get_value
-#define gpio_set_value	__gpio_set_value
-#define gpio_cansleep	__gpio_cansleep
-#else
+#ifndef CONFIG_GPIOLIB
 int gpio_request(unsigned gpio, const char *label);
 void gpio_free(unsigned gpio);
 int gpio_direction_input(unsigned gpio);
@@ -14,7 +10,9 @@ int gpio_get_value(unsigned gpio);
 void gpio_set_value(unsigned gpio, int value);
 #endif
 int gpio_to_irq(unsigned gpio);
+#define gpio_to_irq gpio_to_irq
 int irq_to_gpio(unsigned irq);
+#define irq_to_gpio irq_to_gpio
 
 #include <asm-generic/gpio.h>		/* cansleep wrappers */
 
diff --git a/arch/mips/include/asm/mach-loongson/gpio.h b/arch/mips/include/asm/mach-loongson/gpio.h
index e30e73d..df6efc0 100644
--- a/arch/mips/include/asm/mach-loongson/gpio.h
+++ b/arch/mips/include/asm/mach-loongson/gpio.h
@@ -13,6 +13,8 @@
 #ifndef	__STLS2F_GPIO_H
 #define	__STLS2F_GPIO_H
 
+#define gpio_to_irq gpio_to_irq
+
 #include <asm-generic/gpio.h>
 
 extern void gpio_set_value(unsigned gpio, int value);
@@ -27,9 +29,4 @@ static inline int gpio_to_irq(int gpio)
 	return -EINVAL;
 }
 
-static inline int irq_to_gpio(int gpio)
-{
-	return -EINVAL;
-}
-
 #endif				/* __STLS2F_GPIO_H */
diff --git a/arch/mips/include/asm/mach-rc32434/gpio.h b/arch/mips/include/asm/mach-rc32434/gpio.h
index 12ee8d5..8b0815b 100644
--- a/arch/mips/include/asm/mach-rc32434/gpio.h
+++ b/arch/mips/include/asm/mach-rc32434/gpio.h
@@ -13,18 +13,14 @@
 #ifndef _RC32434_GPIO_H_
 #define _RC32434_GPIO_H_
 
+#define gpio_to_irq(gpio)	(8 + 4 * 32 + gpio)
+#define irq_to_gpio(irq)	(irq - (8 + 4 * 32))
+
 #include <linux/types.h>
 #include <asm-generic/gpio.h>
 
 #define NR_BUILTIN_GPIO		32
 
-#define gpio_get_value	__gpio_get_value
-#define gpio_set_value	__gpio_set_value
-#define gpio_cansleep	__gpio_cansleep
-
-#define gpio_to_irq(gpio)	(8 + 4 * 32 + gpio)
-#define irq_to_gpio(irq)	(irq - (8 + 4 * 32))
-
 struct rb532_gpio_reg {
 	u32   gpiofunc;   /* GPIO Function Register
 			   * gpiofunc[x]==0 bit = gpio
diff --git a/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h b/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h
index ebdbab9..8356a8e 100644
--- a/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h
+++ b/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h
@@ -11,16 +11,15 @@
 #ifndef __PMC_MSP71XX_GPIO_H
 #define __PMC_MSP71XX_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_to_irq gpio_to_irq
+
 /* Max number of gpio's is 28 on chip plus 3 banks of I2C IO Expanders */
 #define ARCH_NR_GPIOS (28 + (3 * 8))
 
 /* new generic GPIO API - see Documentation/gpio.txt */
 #include <asm-generic/gpio.h>
 
-#define gpio_get_value	__gpio_get_value
-#define gpio_set_value	__gpio_set_value
-#define gpio_cansleep	__gpio_cansleep
-
 /* Setup calls for the gpio and gpio extended */
 extern void msp71xx_init_gpio(void);
 extern void msp71xx_init_gpio_extended(void);
@@ -38,9 +37,4 @@ static inline int gpio_to_irq(unsigned gpio)
 	return -EINVAL;
 }
 
-static inline int irq_to_gpio(unsigned irq)
-{
-	return -EINVAL;
-}
-
 #endif /* __PMC_MSP71XX_GPIO_H */
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 11162e6..03f0823 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -23,6 +23,7 @@ generic-y += fb.h
 generic-y += fcntl.h
 generic-y += ftrace.h
 generic-y += futex.h
+generic-y += gpio.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
 generic-y += ioctl.h
diff --git a/arch/openrisc/include/asm/gpio.h b/arch/openrisc/include/asm/gpio.h
deleted file mode 100644
index 0b0d174..0000000
--- a/arch/openrisc/include/asm/gpio.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- * et al.
- *
- * 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.
- */
-
-#ifndef __ASM_OPENRISC_GPIO_H
-#define __ASM_OPENRISC_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * OpenRISC (or1k) does not have on-chip GPIO's so there is not really
- * any standardized implementation that makes sense here.  If passing
- * through gpiolib becomes a bottleneck then it may make sense, on a
- * case-by-case basis, to implement these inlined/rapid versions.
- *
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-/*
- * Not implemented, yet.
- */
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return -ENOSYS;
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* __ASM_OPENRISC_GPIO_H */
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index d51df17..9cf0632 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += auxvec.h
 header-y += bootx.h
 header-y += byteorder.h
diff --git a/arch/powerpc/include/asm/gpio.h b/arch/powerpc/include/asm/gpio.h
deleted file mode 100644
index 38762ed..0000000
--- a/arch/powerpc/include/asm/gpio.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generic GPIO API implementation for PowerPC.
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.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.
- */
-
-#ifndef __ASM_POWERPC_GPIO_H
-#define __ASM_POWERPC_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* __ASM_POWERPC_GPIO_H */
diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h
index 04f53d3..44fee05 100644
--- a/arch/sh/include/asm/gpio.h
+++ b/arch/sh/include/asm/gpio.h
@@ -12,9 +12,6 @@
 #ifndef __ASM_SH_GPIO_H
 #define __ASM_SH_GPIO_H
 
-#include <linux/kernel.h>
-#include <linux/errno.h>
-
 #if defined(CONFIG_CPU_SH3)
 #include <cpu/gpio.h>
 #endif
@@ -22,33 +19,6 @@
 #define ARCH_NR_GPIOS 512
 #include <linux/sh_pfc.h>
 
-#ifdef CONFIG_GPIOLIB
-
-static inline int gpio_get_value(unsigned gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -ENOSYS;
-}
-
-#endif /* CONFIG_GPIOLIB */
+#include <asm-generic/gpio.h>
 
 #endif /* __ASM_SH_GPIO_H */
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 2c2e388..6d27595 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -18,6 +18,7 @@ header-y += utrap.h
 header-y += watchdog.h
 
 generic-y += div64.h
+generic-y += gpio.h
 generic-y += local64.h
 generic-y += irq_regs.h
 generic-y += local.h
diff --git a/arch/sparc/include/asm/gpio.h b/arch/sparc/include/asm/gpio.h
deleted file mode 100644
index a0e3ac0..0000000
--- a/arch/sparc/include/asm/gpio.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef __ASM_SPARC_GPIO_H
-#define __ASM_SPARC_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return -ENOSYS;
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* __ASM_SPARC_GPIO_H */
diff --git a/arch/unicore32/include/asm/gpio.h b/arch/unicore32/include/asm/gpio.h
index 2716f14..437f4e8 100644
--- a/arch/unicore32/include/asm/gpio.h
+++ b/arch/unicore32/include/asm/gpio.h
@@ -13,6 +13,12 @@
 #ifndef __UNICORE_GPIO_H__
 #define __UNICORE_GPIO_H__
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
+
 #include <linux/io.h>
 #include <asm/irq.h>
 #include <mach/hardware.h>
@@ -83,8 +89,6 @@ static inline void gpio_set_value(unsigned gpio, int value)
 		__gpio_set_value(gpio, value);
 }
 
-#define gpio_cansleep	__gpio_cansleep
-
 static inline unsigned gpio_to_irq(unsigned gpio)
 {
 	if ((gpio < IRQ_GPIOHIGH) && (FIELD(1, 1, gpio) & readl(GPIO_GPIR)))
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 6fa90a8..99d44ce 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += boot.h
 header-y += bootparam.h
 header-y += debugreg.h
diff --git a/arch/x86/include/asm/gpio.h b/arch/x86/include/asm/gpio.h
deleted file mode 100644
index 91d915a..0000000
--- a/arch/x86/include/asm/gpio.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generic GPIO API implementation for x86.
- *
- * Derived from the generic GPIO API for powerpc:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.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.
- */
-
-#ifndef _ASM_X86_GPIO_H
-#define _ASM_X86_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_X86_GPIO_H */
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index c68e168..7d52c50 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1 +1,3 @@
 include include/asm-generic/Kbuild.asm
+
+generic-y += gpio.h
diff --git a/arch/xtensa/include/asm/gpio.h b/arch/xtensa/include/asm/gpio.h
deleted file mode 100644
index a8c9fc4..0000000
--- a/arch/xtensa/include/asm/gpio.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Generic GPIO API implementation for xtensa.
- *
- * Stolen from x86, which is derived from the generic GPIO API for powerpc:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.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.
- */
-
-#ifndef _ASM_XTENSA_GPIO_H
-#define _ASM_XTENSA_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-/*
- * Not implemented, yet.
- */
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_XTENSA_GPIO_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index d494001..622851c 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -170,6 +170,29 @@ extern int __gpio_cansleep(unsigned gpio);
 
 extern int __gpio_to_irq(unsigned gpio);
 
+#ifndef gpio_get_value
+#define gpio_get_value(gpio) __gpio_get_value(gpio)
+#endif
+
+#ifndef gpio_set_value
+#define gpio_set_value(gpio, value) __gpio_set_value(gpio, value)
+#endif
+
+#ifndef gpio_cansleep
+#define gpio_cansleep(gpio) __gpio_cansleep(gpio)
+#endif
+
+#ifndef gpio_to_irq
+#define gpio_to_irq(gpio) __gpio_to_irq(gpio)
+#endif
+
+#ifndef irq_to_gpio
+static inline int irq_to_gpio(unsigned int irq)
+{
+	return -EINVAL;
+}
+#endif
+
 /**
  * struct gpio - a structure describing a GPIO with configuration
  * @gpio:	the GPIO number
-- 
1.7.6.1

^ permalink raw reply related

* Re: [PATCH 1/3 v2] mmc: Move mmc_delay() to include/linux/mmc/core.h
From: Kumar Gala @ 2011-10-27 21:19 UTC (permalink / raw)
  To: Chunhe Lan; +Cc: linuxppc-dev, Chris Ball, linux-mmc
In-Reply-To: <1314345150-1803-1-git-send-email-Chunhe.Lan@freescale.com>


On Aug 26, 2011, at 2:52 AM, Chunhe Lan wrote:

> Move mmc_delay() from drivers/mmc/core/core.h to
> include/linux/mmc/core.h. So when other functions
> call it with include syntax using <linux/mmc/core.h>
> of absolute path rather than "../core/core.h" of
> relative path.
>=20
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> Cc: Chris Ball <cjb@laptop.org>
> ---
> drivers/mmc/core/core.h  |   12 ------------
> include/linux/mmc/core.h |   11 +++++++++++
> 2 files changed, 11 insertions(+), 12 deletions(-)

Chris,

Any comments on these patches or acceptance?

- k

>=20
> diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
> index d9411ed..58c3f10 100644
> --- a/drivers/mmc/core/core.h
> +++ b/drivers/mmc/core/core.h
> @@ -11,8 +11,6 @@
> #ifndef _MMC_CORE_CORE_H
> #define _MMC_CORE_CORE_H
>=20
> -#include <linux/delay.h>
> -
> #define MMC_CMD_RETRIES        3
>=20
> struct mmc_bus_ops {
> @@ -44,16 +42,6 @@ int mmc_set_signal_voltage(struct mmc_host *host, =
int signal_voltage,
> void mmc_set_timing(struct mmc_host *host, unsigned int timing);
> void mmc_set_driver_type(struct mmc_host *host, unsigned int =
drv_type);
>=20
> -static inline void mmc_delay(unsigned int ms)
> -{
> -	if (ms < 1000 / HZ) {
> -		cond_resched();
> -		mdelay(ms);
> -	} else {
> -		msleep(ms);
> -	}
> -}
> -
> void mmc_rescan(struct work_struct *work);
> void mmc_start_host(struct mmc_host *host);
> void mmc_stop_host(struct mmc_host *host);
> diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
> index b8b1b7a..7bc2798 100644
> --- a/include/linux/mmc/core.h
> +++ b/include/linux/mmc/core.h
> @@ -10,6 +10,7 @@
>=20
> #include <linux/interrupt.h>
> #include <linux/device.h>
> +#include <linux/delay.h>
>=20
> struct request;
> struct mmc_data;
> @@ -182,6 +183,16 @@ static inline void mmc_claim_host(struct mmc_host =
*host)
> 	__mmc_claim_host(host, NULL);
> }
>=20
> +static inline void mmc_delay(unsigned int ms)
> +{
> +	if (ms < 1000 / HZ) {
> +		cond_resched();
> +		mdelay(ms);
> +	} else {
> +		msleep(ms);
> +	}
> +}
> +
> extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
>=20
> #endif /* LINUX_MMC_CORE_H */
> --=20
> 1.7.5.1
>=20
>=20
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [PATCH v2] powerpc: book3e: WSP: Add Chroma as a new WSP/PowerEN platform.
From: Scott Wood @ 2011-10-27 20:48 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: linuxppc-dev
In-Reply-To: <DD04A5E8-2850-4DDC-9E7A-B899B0EEEF11@pobox.com>

On 10/11/2011 09:47 AM, Jimi Xenidis wrote:
> On Tue Oct 4 05:02:41 EST 2011, Scott Wood wrote:
> 
> Looking at your comments below, will the following be acceptable
> 
>> On 09/29/2011 09:27 PM, Jimi Xenidis wrote:
>>> diff --git a/arch/powerpc/platforms/wsp/Kconfig b/arch/powerpc/platforms/wsp/Kconfig
>>> index ea2811c..a3eef8e 100644
>>> --- a/arch/powerpc/platforms/wsp/Kconfig
>>> +++ b/arch/powerpc/platforms/wsp/Kconfig
>>> @@ -1,6 +1,7 @@
>>>  config PPC_WSP
>>>  	bool
>>>  	select PPC_A2
>>> +	select GENERIC_TBSYNC
>>>  	select PPC_ICSWX
>>>  	select PPC_SCOM
>>>  	select PPC_XICS
>>> @@ -8,14 +9,20 @@ config PPC_WSP
>>>  	select PCI
>>>  	select PPC_IO_WORKAROUNDS if PCI
>>>  	select PPC_INDIRECT_PIO if PCI
>>> +	select PPC_WSP_COPRO
>>>  	default n
>>>  
>>>  menu "WSP platform selection"
>>>  	depends on PPC_BOOK3E_64
> 
> add "&& SMP"
> 
>>>  
>>>  config PPC_PSR2
>>> -	bool "PSR-2 platform"
>>> -	select GENERIC_TBSYNC
>>> +	bool "PowerEN System Reference Platform 2"
>>> +	select EPAPR_BOOT
>>> +	select PPC_WSP
>>> +	default y
> 
> Make these "default n"
> 
> Will that address everything?

It should address the issues I've seen, though someone (IIRC Timur) said
that he saw a dependency on some PCI error detection code as well.

-Scott

^ permalink raw reply

* Re: Fix for fsl_upm
From: Kumar Gala @ 2011-10-27 18:28 UTC (permalink / raw)
  To: Rusev; +Cc: Shaohui.Xie, linux-kernel, Shengzhou.Liu, paulus, linuxppc-dev
In-Reply-To: <4EA9683D.8030100@dev.rtsoft.ru>


On Oct 27, 2011, at 9:18 AM, Rusev wrote:

> patch is vs. 2.6.39, yet it applied to 3.1
>=20
>=20
>=20
> Fix of UPM driver for Freescale PowerPC processors
>=20
> If Freescale LBC driver fails to initialise itself from device tree,
> then internal structure is freed only but not NULL-fied.
> As result functions fsl_lbc_find() after checking the structure is not =
NULL are
> trying to access device registers.
>=20
> Signed-off-by: Alexandre Rusev <arusev@dev.rtsoft.ru>=20
> --- linux-2.6.39.old/arch/powerpc/sysdev/fsl_lbc.c	2011-10-27 =
03:17:28.000000000 +0400
> +++ linux-2.6.39/arch/powerpc/sysdev/fsl_lbc.c	2011-10-27 =
05:06:44.000000000 +0400
> @@ -322,6 +322,7 @@ static int __devinit fsl_lbc_ctrl_probe(
> err:
> 	iounmap(fsl_lbc_ctrl_dev->regs);
> 	kfree(fsl_lbc_ctrl_dev);
> +	fsl_lbc_ctrl_dev =3D NULL;
> 	return ret;
> }
>=20

Can you send this as a proper patch.

- k

^ 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