LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] [POWERPC] devres: Add devm_ioremap_prot()
From: Kumar Gala @ 2008-05-01  3:40 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Andrew Morton, Stephen Rothwell, htejun, Jeff Garzik, Greg KH,
	linux-kernel, Emilian.Medve

From: Emil Medve <Emilian.Medve@Freescale.com>

We provide an ioremap_flags so provide a corresponding devm_ioremap_prot.
The slight name difference is at Ben Herrenschmidt request as he plans
on changing ioremap_flags to ioremap_prot in the future.

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Tejun Heo <htejun@gmail.com>
---

Added license & copyright to devres.c since its new.  Hopefully the last
version of this.

- k

 arch/powerpc/lib/Makefile |    1 +
 arch/powerpc/lib/devres.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/io.h  |    8 +++++++-
 include/linux/io.h        |    1 +
 lib/devres.c              |    2 +-
 5 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/lib/devres.c

diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 4bb023f..f1d2cdc 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -23,3 +23,4 @@ obj-$(CONFIG_SMP)	+= locks.o
 endif

 obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
+obj-$(CONFIG_HAS_IOMEM)	+= devres.o
diff --git a/arch/powerpc/lib/devres.c b/arch/powerpc/lib/devres.c
new file mode 100644
index 0000000..292115d
--- /dev/null
+++ b/arch/powerpc/lib/devres.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/device.h>	/* devres_*(), devm_ioremap_release() */
+#include <linux/io.h>		/* ioremap_flags() */
+#include <linux/module.h>	/* EXPORT_SYMBOL() */
+
+/**
+ * devm_ioremap_prot - Managed ioremap_flags()
+ * @dev: Generic device to remap IO address for
+ * @offset: BUS offset to map
+ * @size: Size of map
+ * @flags: Page flags
+ *
+ * Managed ioremap_prot().  Map is automatically unmapped on driver
+ * detach.
+ */
+void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
+				 size_t size, unsigned long flags)
+{
+	void __iomem **ptr, *addr;
+
+	ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL);
+	if (!ptr)
+		return NULL;
+
+	addr = ioremap_flags(offset, size, flags);
+	if (addr) {
+		*ptr = addr;
+		devres_add(dev, ptr);
+	} else
+		devres_free(ptr);
+
+	return addr;
+}
+EXPORT_SYMBOL(devm_ioremap_prot);
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index afae069..e0062d7 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -2,7 +2,7 @@
 #define _ASM_POWERPC_IO_H
 #ifdef __KERNEL__

-/*
+/*
  * 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
@@ -18,6 +18,9 @@ extern int check_legacy_ioport(unsigned long base_port);
 #define _PNPWRP		0xa79
 #define PNPBIOS_BASE	0xf000

+#include <linux/device.h>
+#include <linux/io.h>
+
 #include <linux/compiler.h>
 #include <asm/page.h>
 #include <asm/byteorder.h>
@@ -744,6 +747,9 @@ static inline void * bus_to_virt(unsigned long address)

 #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)

+void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
+				size_t size, unsigned long flags);
+
 #endif /* __KERNEL__ */

 #endif /* _ASM_POWERPC_IO_H */
diff --git a/include/linux/io.h b/include/linux/io.h
index 831f57c..7a390cf 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -58,6 +58,7 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
 }
 #endif

+void devm_ioremap_release(struct device *dev, void *res);
 void __iomem * devm_ioremap(struct device *dev, resource_size_t offset,
 			    unsigned long size);
 void __iomem * devm_ioremap_nocache(struct device *dev, resource_size_t offset,
diff --git a/lib/devres.c b/lib/devres.c
index 26c87c4..72c8909 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -2,7 +2,7 @@
 #include <linux/io.h>
 #include <linux/module.h>

-static void devm_ioremap_release(struct device *dev, void *res)
+void devm_ioremap_release(struct device *dev, void *res)
 {
 	iounmap(*(void __iomem **)res);
 }
-- 
1.5.4.1

^ permalink raw reply related

* Re: [patch 2/5] PS3: Add time include to lpm
From: FUJITA Tomonori @ 2008-05-01  2:33 UTC (permalink / raw)
  To: geoffrey.levand; +Cc: fujita.tomonori, linuxppc-dev, paulus
In-Reply-To: <4818F1C5.2010800@am.sony.com>

On Wed, 30 Apr 2008 15:25:09 -0700
Geoff Levand <geoffrey.levand@am.sony.com> wrote:

> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> 
> Add an include <asm/time.h> statement for get_tb().
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
> ---
> drivers/ps3/ps3-lpm.c:192: error: implicit declaration of function 'get_tb'
> 
> I could not recreate this error.  asm/time.h seems to be included
> from linux/module.h:
> 
> In file included from include2/asm/cputime.h:27,

Seems that if VIRT_CPU_ACCOUNTING is disabled, asm/time.h is not
included here.


>                  from /home/geoff/projects/cell/linux-2.6/include/linux/sched.h:67,
>                  from include2/asm/elf.h:6,
>                  from /home/geoff/projects/cell/linux-2.6/include/linux/elf.h:8,
>                  from /home/geoff/projects/cell/linux-2.6/include/linux/module.h:15,
>                  from /home/geoff/projects/cell/linux-2.6/drivers/ps3/ps3-lpm.c:24:
> include2/asm/time.h:134
> 
>  drivers/ps3/ps3-lpm.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- a/drivers/ps3/ps3-lpm.c
> +++ b/drivers/ps3/ps3-lpm.c
> @@ -22,6 +22,7 @@
>  #include <linux/module.h>
>  #include <linux/interrupt.h>
>  #include <linux/uaccess.h>
> +#include <asm/time.h>
>  #include <asm/ps3.h>
>  #include <asm/lv1call.h>
>  #include <asm/cell-pmu.h>
> 
> -- 
> 
> 
> 

^ permalink raw reply

* Re: [PATCH] [POWERPC] convert transfer_to_handler into a macro
From: Kumar Gala @ 2008-05-01  1:31 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1209602915.18023.277.camel@pasglop>


On Apr 30, 2008, at 7:48 PM, Benjamin Herrenschmidt wrote:
>
> On Wed, 2008-04-30 at 19:11 -0500, Josh Boyer wrote:
>>
>>> Nah, he meant using the slot for MAS0 in the exception frame
>> structure
>>> as to not have to define two different structures I suppose...
>>
>> Ah, ok.  Sorry, still playing catch up on email.  I thought we were
>> talking about a #define.
>
> Heh, now that I think about it ... maybe :-) That would be bad indeed.
> Kumar ?

I'll alias the slot.  Similiar to how we use _ESR -> for dsisr

Something like this will be added in asm-offset.c:

DEFINE(MMUCR, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs,  
mas0));

^ permalink raw reply

* Re: [PATCH v2] [POWERPC] devres: Add devm_ioremap_flags()
From: Kumar Gala @ 2008-05-01  1:29 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Andrew Morton, htejun, Jeff Garzik, Greg KH, linux-kernel,
	Emilian.Medve, linuxppc-dev
In-Reply-To: <20080501111817.e0d19258.sfr@canb.auug.org.au>


On Apr 30, 2008, at 8:18 PM, Stephen Rothwell wrote:
> On Wed, 30 Apr 2008 11:08:51 -0500 (CDT) Kumar Gala <galak@kernel.crashing.org 
> > wrote:
>>
>> +++ b/arch/powerpc/lib/devres.c
>> @@ -0,0 +1,33 @@
>> +#include <linux/device.h>	/* devres_*(), devm_ioremap_release() */
>> +#include <linux/io.h>		/* ioremap_flags() */
>> +#include <linux/module.h>	/* EXPORT_SYMBOL() */
>
> This file needs a copyright notice and license ...

agreed.  will add.

- k

^ permalink raw reply

* Re: [PATCH v2] [POWERPC] devres: Add devm_ioremap_flags()
From: Stephen Rothwell @ 2008-05-01  1:18 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Andrew Morton, htejun, Jeff Garzik, Greg KH, linux-kernel,
	Emilian.Medve, linuxppc-dev
In-Reply-To: <Pine.LNX.4.64.0804301106010.22992@blarg.am.freescale.net>

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

On Wed, 30 Apr 2008 11:08:51 -0500 (CDT) Kumar Gala <galak@kernel.crashing.org> wrote:
>
> +++ b/arch/powerpc/lib/devres.c
> @@ -0,0 +1,33 @@
> +#include <linux/device.h>	/* devres_*(), devm_ioremap_release() */
> +#include <linux/io.h>		/* ioremap_flags() */
> +#include <linux/module.h>	/* EXPORT_SYMBOL() */

This file needs a copyright notice and license ...

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] [POWERPC] convert transfer_to_handler into a macro
From: Benjamin Herrenschmidt @ 2008-05-01  0:48 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20080430191153.49fce28e@zod.rchland.ibm.com>


On Wed, 2008-04-30 at 19:11 -0500, Josh Boyer wrote:
> 
> > Nah, he meant using the slot for MAS0 in the exception frame
> structure
> > as to not have to define two different structures I suppose...
> 
> Ah, ok.  Sorry, still playing catch up on email.  I thought we were
> talking about a #define.

Heh, now that I think about it ... maybe :-) That would be bad indeed.
Kumar ?

Cheers
Ben.

^ permalink raw reply

* [PATCH v5] sysdev,mv64x60: MV64x60 device bus
From: Remi Machet @ 2008-05-01  0:40 UTC (permalink / raw)
  To: Stephen Rothwell, Paul Mackerras, Dale Farnsworth; +Cc: linuxppc-dev

For each mv64360 entry in the OpenFirmware database, add the 
registration of an of_bus to take care of devices connected to
the MV64x60 asynchronous devices controller.
This change makes it possible for those devices to be detected by 
drivers that support the of_platform without having a custom call 
for each of them in the board file.

Signed-off-by: Remi Machet <rmachet@slac.stanford.edu>
---
Changes:
v2: Use the compatible field to detect devices to register (on Dale Farnsworth
suggestion).
v3: Added __initdata to variable of_mv64x60_devices (thanks to Stephen Rothwell 
for pointing that out).
v4: Re-wrote the patch description.
v5: Changed the format of the email address

 arch/powerpc/sysdev/mv64x60_dev.c |   10 ++++++++++
 1 files changed, 10 insertions(+)

diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index 41af122..c38695e 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -15,6 +15,7 @@
 #include <linux/console.h>
 #include <linux/mv643xx.h>
 #include <linux/platform_device.h>
+#include <linux/of_platform.h>
 
 #include <asm/prom.h>
 
@@ -25,6 +26,11 @@
  * PowerPC of_platform_bus_type.  They support platform_bus_type instead.
  */
 
+static struct of_device_id __initdata of_mv64x60_devices[] = {
+	{ .compatible = "marvell,mv64306-devctrl", },
+	{}
+};
+
 /*
  * Create MPSC platform devices
  */
@@ -482,6 +488,10 @@ static int __init mv64x60_device_setup(void)
 		of_node_put(np);
 	}
 
+	/* Now add every node that is on the device bus */
+	for_each_compatible_node(np, NULL, "marvell,mv64360")
+		of_platform_bus_probe(np, of_mv64x60_devices, NULL);
+
 	return 0;
 }
 arch_initcall(mv64x60_device_setup);

^ permalink raw reply related

* Re: [PATCH] [POWERPC] devres: Add devm_ioremap_flags()
From: Tejun Heo @ 2008-05-01  0:40 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Andrew Morton, Jeff Garzik, Greg KH, linux-kernel, Emilian.Medve,
	linuxppc-dev
In-Reply-To: <Pine.LNX.4.64.0804301059430.22937@blarg.am.freescale.net>

Kumar Gala wrote:
> From: Emil Medve <Emilian.Medve@Freescale.com>
> 
> We provide an ioremap_flags so provide a coresphonding devm_ioremap_flags.
> 
> Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

Acked-by: Tejun Heo <htejun@gmail.com>

-- 
tejun

^ permalink raw reply

* Re: [PATCH v4] sysdev,mv64x60: MV64x60 device bus
From: Remi Machet @ 2008-05-01  0:37 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20080501095448.7ddfffb3.sfr@canb.auug.org.au>

Yes, I am sorry. I will post another patch in a few minutes ...

Remi

On Thu, 2008-05-01 at 09:54 +1000, Stephen Rothwell wrote:
> Hi Remi,
> 
> On Wed, 30 Apr 2008 09:47:16 -0700 Remi Machet <rmachet@slac.stanford.edu> wrote:
> >
> > For each mv64360 entry in the OpenFirmware database, add the 
> > registration of an of_bus to take care of devices connected to
> > the MV64x60 asynchronous devices controller.
> > This change makes it possible for those devices to be detected by 
> > drivers that support the of_platform without having a custom call 
> > for each of them in the board file.
> > 
> > Signed-off-by: Remi Machet (rmachet@slac.stanford.edu)
> 
> You really should use '<' and '>' to surround your email address.
> 

^ permalink raw reply

* Re: [PATCH] [POWERPC] convert transfer_to_handler into a macro
From: Josh Boyer @ 2008-05-01  0:11 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, Paul, Mackerras
In-Reply-To: <1209599602.18023.273.camel@pasglop>

On Thu, 01 May 2008 09:53:22 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> 
> On Wed, 2008-04-30 at 18:45 -0500, Josh Boyer wrote:
> > > thanks.  Will take a look.  I just plan on overloading MMUCR with
> > MAS0.
> > 
> > Erg.  Why?  Please don't do that.  This is common code and MAS0
> > doesn't
> > make much sense on 4xx.  It'll be confusing to anyone that isn't aware
> > of this change.
> 
> Nah, he meant using the slot for MAS0 in the exception frame structure
> as to not have to define two different structures I suppose...

Ah, ok.  Sorry, still playing catch up on email.  I thought we were
talking about a #define.

josh

^ permalink raw reply

* Re: [PATCH] [POWERPC] convert transfer_to_handler into a macro
From: Benjamin Herrenschmidt @ 2008-04-30 23:53 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20080430184502.4f0c66e2@zod.rchland.ibm.com>


On Wed, 2008-04-30 at 18:45 -0500, Josh Boyer wrote:
> > thanks.  Will take a look.  I just plan on overloading MMUCR with
> MAS0.
> 
> Erg.  Why?  Please don't do that.  This is common code and MAS0
> doesn't
> make much sense on 4xx.  It'll be confusing to anyone that isn't aware
> of this change.

Nah, he meant using the slot for MAS0 in the exception frame structure
as to not have to define two different structures I suppose...

> Can we come up with a generic #define that gets used instead?
> 
> josh

Ben.

^ permalink raw reply

* Re: [PATCH v4] sysdev,mv64x60: MV64x60 device bus
From: Stephen Rothwell @ 2008-04-30 23:54 UTC (permalink / raw)
  To: Remi Machet; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1209574037.14407.57.camel@pcds-ts102.slac.stanford.edu>

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

Hi Remi,

On Wed, 30 Apr 2008 09:47:16 -0700 Remi Machet <rmachet@slac.stanford.edu> wrote:
>
> For each mv64360 entry in the OpenFirmware database, add the 
> registration of an of_bus to take care of devices connected to
> the MV64x60 asynchronous devices controller.
> This change makes it possible for those devices to be detected by 
> drivers that support the of_platform without having a custom call 
> for each of them in the board file.
> 
> Signed-off-by: Remi Machet (rmachet@slac.stanford.edu)

You really should use '<' and '>' to surround your email address.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] [POWERPC] Rework EXC_LEVEL_EXCEPTION_PROLOG code
From: Benjamin Herrenschmidt @ 2008-04-30 23:52 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <22842BC4-C424-4681-96DF-C14E3595E335@kernel.crashing.org>


On Wed, 2008-04-30 at 18:28 -0500, Kumar Gala wrote:
> > Well, you can be in trouble if you lose TIF_SIGPENDING. You don't - 
> > have-
> > to actually take the signal, it will then be done on the next
> return  
> > to
> > userspace (next timer interrupt, next syscall, ...), but  
> > TIF_SIGPENDING
> > must not be lost.
> 
> Interesting.  It seems like causing a signal from an async interrupt  
> from kernel space shouldn't be allowed.  At worse we can store back  
> the flags into the "real" thread_info.

Why shouldn't it be allowed ? We do store back flags in the real thread
info when doing irqstacks... though I just noticed we don't do that for
softirqs... paulus, isn't there a chance that we may lose a signal
there ? I wouldn't expect softirq's to often send signals to current
thread info (ie, they would use targetted flag sending which means the
SIGPENDING flag will be set in the right thread_info obtained from the
target task struct) but it still sounds safer to copy the flags back
just in case...

> yeah, so we are now pointing to stack bottom.  will fix this up.

Call it "base" rather than "bottom", sounds nicer :-)

> I agree we run all these interrupt levels with EE disabled.  Not
> sure  
> I follow what you mean by irq_enter/ext.

That should do the right thing with preempt_count(), look at do_IRQ().

Ben.

^ permalink raw reply

* Re: [PATCH] [POWERPC] convert transfer_to_handler into a macro
From: Josh Boyer @ 2008-04-30 23:45 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Paul Mackerras, linuxppc-dev
In-Reply-To: <2A2997EA-F3AF-4C90-8952-42CA48AA07BC@kernel.crashing.org>

On Wed, 30 Apr 2008 17:04:08 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:

> 
> On Apr 30, 2008, at 4:59 PM, Benjamin Herrenschmidt wrote:
> >
> > On Wed, 2008-04-30 at 03:02 -0500, Kumar Gala wrote:
> >> got that.  Does 40x/44x have anything similar we need to save/ 
> >> restore?
> >
> > MMUCR I'd say... look at what our tlbie does there...
> 
> thanks.  Will take a look.  I just plan on overloading MMUCR with MAS0.

Erg.  Why?  Please don't do that.  This is common code and MAS0 doesn't
make much sense on 4xx.  It'll be confusing to anyone that isn't aware
of this change.

Can we come up with a generic #define that gets used instead?

josh

^ permalink raw reply

* Re: [PATCH] [POWERPC] Rework EXC_LEVEL_EXCEPTION_PROLOG code
From: Paul Mackerras @ 2008-04-30 23:47 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <12ECF63E-7CEA-48FD-9447-7D534C29271D@kernel.crashing.org>

Kumar Gala writes:

> If we don't handle reschedule or signal will we actually not function  
> properly?  I assume reschedule isn't an issue, but could we lose a  
> signal?

It depends on whether a critical or machine check handler can ever do
anything to generate a signal or a reschedule.  If they can't, then
there is no problem.

If they can, then we have to be very careful.  If a critical or
machine check happens at a point where normal interrupts are disabled
then we have to be extremely careful not to do anything that the code
we've interrupted assumes can't happen - so we'd better not try to
take any spinlocks, for example.  That severely limits what the
handler can do.  It probably shouldn't even call printk, for
instance, or wake any process up, and definitely shouldn't call
schedule (or schedule_preempt) on the way out.

If the critical/mcheck interrupt happens at a point where a normal
interrupt could have happened (including when userspace is running)
then we could treat it pretty much as a normal interrupt, including
handling signals or reschedules on the way out if appropriate.

Paul.

^ permalink raw reply

* [PATCH] rapidio: fix current kernel-doc notation
From: Randy Dunlap @ 2008-04-30 23:45 UTC (permalink / raw)
  To: lkml; +Cc: linuxppc-dev, Paul Mackerras, Andrew Morton, torvalds, Wei.Zhang
In-Reply-To: <4818EFEC.4080003@oracle.com>

From: Randy Dunlap <randy.dunlap@oracle.com>

Fix current (-git16) missing docbook/kernel-doc notation in RapidIO files.

Warning(linux-2.6.25-git16//include/linux/rio.h:187): No description found for parameter 'sys_size'
Warning(linux-2.6.25-git16//include/linux/rio.h:187): No description found for parameter 'phy_type'

Warning(linux-2.6.25-git16//arch/powerpc/sysdev/fsl_rio.c:188): No description found for parameter 'mport'
Warning(linux-2.6.25-git16//arch/powerpc/sysdev/fsl_rio.c:224): No description found for parameter 'mport'
Warning(linux-2.6.25-git16//arch/powerpc/sysdev/fsl_rio.c:245): No description found for parameter 'mport'
Warning(linux-2.6.25-git16//arch/powerpc/sysdev/fsl_rio.c:270): No description found for parameter 'mport'
Warning(linux-2.6.25-git16//arch/powerpc/sysdev/fsl_rio.c:311): No description found for parameter 'mport'
Warning(linux-2.6.25-git16//arch/powerpc/sysdev/fsl_rio.c:996): No description found for parameter 'dev'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 arch/powerpc/sysdev/fsl_rio.c |    9 +++++++--
 include/linux/rio.h           |    2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

--- linux-2.6.25-git16.orig/include/linux/rio.h
+++ linux-2.6.25-git16/include/linux/rio.h
@@ -161,6 +161,8 @@ enum rio_phy_type {
  * @ops: configuration space functions
  * @id: Port ID, unique among all ports
  * @index: Port index, unique among all port interfaces of the same type
+ * @sys_size: RapidIO common transport system size
+ * @phy_type: RapidIO phy type
  * @name: Port name string
  * @priv: Master port private data
  */
--- linux-2.6.25-git16.orig/arch/powerpc/sysdev/fsl_rio.c
+++ linux-2.6.25-git16/arch/powerpc/sysdev/fsl_rio.c
@@ -176,6 +176,7 @@ struct rio_priv {
 
 /**
  * fsl_rio_doorbell_send - Send a MPC85xx doorbell message
+ * @mport: RapidIO master port info
  * @index: ID of RapidIO interface
  * @destid: Destination ID of target device
  * @data: 16-bit info field of RapidIO doorbell message
@@ -211,6 +212,7 @@ static int fsl_rio_doorbell_send(struct 
 
 /**
  * fsl_local_config_read - Generate a MPC85xx local config space read
+ * @mport: RapidIO master port info
  * @index: ID of RapdiIO interface
  * @offset: Offset into configuration space
  * @len: Length (in bytes) of the maintenance transaction
@@ -232,6 +234,7 @@ static int fsl_local_config_read(struct 
 
 /**
  * fsl_local_config_write - Generate a MPC85xx local config space write
+ * @mport: RapidIO master port info
  * @index: ID of RapdiIO interface
  * @offset: Offset into configuration space
  * @len: Length (in bytes) of the maintenance transaction
@@ -254,6 +257,7 @@ static int fsl_local_config_write(struct
 
 /**
  * fsl_rio_config_read - Generate a MPC85xx read maintenance transaction
+ * @mport: RapidIO master port info
  * @index: ID of RapdiIO interface
  * @destid: Destination ID of transaction
  * @hopcount: Number of hops to target device
@@ -295,6 +299,7 @@ fsl_rio_config_read(struct rio_mport *mp
 
 /**
  * fsl_rio_config_write - Generate a MPC85xx write maintenance transaction
+ * @mport: RapidIO master port info
  * @index: ID of RapdiIO interface
  * @destid: Destination ID of transaction
  * @hopcount: Number of hops to target device
@@ -985,8 +990,8 @@ static inline void fsl_rio_info(struct d
 }
 
 /**
- * fsl_rio_setup - Setup MPC85xx RapidIO interface
- * @fsl_rio_setup - Setup Freescale PowerPC RapidIO interface
+ * fsl_rio_setup - Setup Freescale PowerPC RapidIO interface
+ * @dev: of_device pointer
  *
  * Initializes MPC85xx RapidIO hardware interface, configures
  * master port with system-specific info, and registers the

^ permalink raw reply

* [RFC] POWERPC: Merge 32 and 64-bit dma code
From: Becky Bruce @ 2008-04-30 23:36 UTC (permalink / raw)
  To: linuxppc-dev


I essentially adopt the 64-bit dma code, with some changes to support
32-bit systems, including HIGHMEM.  dma functions on 32-bit are now
invoked via accessor functions which call the correct op for a device based
on archdata dma_ops.  Currently, this defaults to dma_direct_ops, but this
structure will make it easier to do iommu/swiotlb on 32-bit going
forward.

In addition, the dma_map/unmap_page functions are added to dma_ops on
HIGHMEM-enabled configs because we can't just fall back on map/unmap_single
when HIGHMEM is enabled.  Adding these to dma_ops makes it cleaner to
substitute different functionality once we have iommu/swiotlb support.

This code conflicts with the dma_attrs code that Mark Nelson just pushed.
At this point, I'm just looking for some review, and suggestions on how 
this code might be improved.  I'll uprev it to work with Mark's code once
that goes in.

There will be other patches that precede this one - I plan to duplicate 
dma_mapping.h into include/asm-ppc to avoid breakage there.  There will 
also be a patch to rename dma_64.c to dma.c, and a series of patches to 
modify drivers that pass NULL dev pointers.

Dma experts, please review this when you can - I was a dma newbie 
until very recently, and the odds that I'm missing some subtlety 
in this merge are fairly high.

Cheers,
Becky

 ---
 arch/powerpc/kernel/Makefile      |    4 +-
 arch/powerpc/kernel/dma_64.c      |   80 ++++++++++++++++++-
 arch/powerpc/kernel/pci-common.c  |   53 +++++++++++++
 arch/powerpc/kernel/pci_32.c      |    7 ++
 arch/powerpc/kernel/pci_64.c      |   49 ------------
 include/asm-powerpc/dma-mapping.h |  156 +++++++++----------------------------
 include/asm-powerpc/machdep.h     |    5 +-
 include/asm-powerpc/pci.h         |   14 ++--
 8 files changed, 186 insertions(+), 182 deletions(-)

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 0ee4352..8534882 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -57,10 +57,10 @@ extra-$(CONFIG_8xx)		:= head_8xx.o
 extra-y				+= vmlinux.lds
 
 obj-y				+= time.o prom.o traps.o setup-common.o \
-				   udbg.o misc.o io.o \
+				   udbg.o misc.o io.o dma_64.o\
 				   misc_$(CONFIG_WORD_SIZE).o
 obj-$(CONFIG_PPC32)		+= entry_32.o setup_32.o
-obj-$(CONFIG_PPC64)		+= dma_64.o iommu.o
+obj-$(CONFIG_PPC64)		+= iommu.o
 obj-$(CONFIG_PPC_MULTIPLATFORM)	+= prom_init.o
 obj-$(CONFIG_MODULES)		+= ppc_ksyms.o
 obj-$(CONFIG_BOOTX_TEXT)	+= btext.o
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c
index 3a317cb..4225b4c 100644
--- a/arch/powerpc/kernel/dma_64.c
+++ b/arch/powerpc/kernel/dma_64.c
@@ -8,9 +8,11 @@
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <asm/bug.h>
-#include <asm/iommu.h>
 #include <asm/abs_addr.h>
 
+#ifdef CONFIG_PPC64
+#include <asm/iommu.h>
+
 /*
  * Generic iommu implementation
  */
@@ -108,6 +110,8 @@ struct dma_mapping_ops dma_iommu_ops = {
 	.dma_supported	= dma_iommu_dma_supported,
 };
 EXPORT_SYMBOL(dma_iommu_ops);
+#endif /* CONFIG_PPC64 */
+
 
 /*
  * Generic direct DMA implementation
@@ -123,12 +127,26 @@ static unsigned long get_dma_direct_offset(struct device *dev)
 	return (unsigned long)dev->archdata.dma_data;
 }
 
+#ifndef CONFIG_NOT_COHERENT_CACHE
 static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
 				       dma_addr_t *dma_handle, gfp_t flag)
 {
-	struct page *page;
 	void *ret;
-	int node = dev->archdata.numa_node;
+	struct page *page;
+	int node = -1;
+
+#ifdef CONFIG_PPC64
+	node = dev->archdata.numa_node;
+#else
+	/* ignore region specifiers */
+	flag  &= ~(__GFP_DMA | __GFP_HIGHMEM);
+
+	/* Bust slacker drivers that pass a NULL dev ptr */
+	BUG_ON(dev == NULL);
+
+	if (dev->coherent_dma_mask < 0xffffffff)
+		flag |= GFP_DMA;
+#endif
 
 	page = alloc_pages_node(node, flag, get_order(size));
 	if (page == NULL)
@@ -146,10 +164,27 @@ static void dma_direct_free_coherent(struct device *dev, size_t size,
 	free_pages((unsigned long)vaddr, get_order(size));
 }
 
+#else /* CONFIG_NOT_COHERENT_CACHE */
+
+static void *dma_direct_alloc_noncoherent(struct device *dev, size_t size,
+				       dma_addr_t *dma_handle, gfp_t flag)
+{
+	return __dma_alloc_coherent(size, dma_handle, flag);
+}
+
+static void dma_direct_free_noncoherent(struct device *dev, size_t size,
+				     void *vaddr, dma_addr_t dma_handle)
+{
+	__dma_free_coherent(size, vaddr);
+}
+#endif /* CONFIG_NOT_COHERENT_CACHE */
+
 static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr,
 					size_t size,
 					enum dma_data_direction direction)
 {
+	BUG_ON(direction == DMA_NONE);
+	__dma_sync(ptr, size, direction);
 	return virt_to_abs(ptr) + get_dma_direct_offset(dev);
 }
 
@@ -180,20 +215,59 @@ static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
 
 static int dma_direct_dma_supported(struct device *dev, u64 mask)
 {
+#ifdef CONFIG_PPC64
 	/* Could be improved to check for memory though it better be
 	 * done via some global so platforms can set the limit in case
 	 * they have limited DMA windows
 	 */
 	return mask >= DMA_32BIT_MASK;
+#else
+	return 1;
+#endif
 }
 
+#ifdef CONFIG_HIGHMEM
+/*
+ * dma_direct_map_page is used on systems that have HIGHMEM
+ * enabled.  Platforms without HIGHMEM can just call
+ * dma_ops->map_single.
+ */
+static inline dma_addr_t dma_direct_map_page(struct device *dev,
+					     struct page *page,
+					     unsigned long offset,
+					     size_t size,
+					     enum dma_data_direction dir)
+{
+	BUG_ON(dir == DMA_NONE);
+	__dma_sync_page(page, offset, size, dir);
+	return page_to_phys(page) + offset + get_dma_direct_offset(dev);
+}
+
+static inline void dma_direct_unmap_page(struct device *dev,
+					 dma_addr_t dma_address,
+					 size_t size,
+					 enum dma_data_direction direction)
+{
+}
+
+#endif /* CONFIG_HIGHMEM */
+
 struct dma_mapping_ops dma_direct_ops = {
+#ifdef CONFIG_NOT_COHERENT_CACHE
+	.alloc_coherent	= dma_direct_alloc_noncoherent,
+	.free_coherent	= dma_direct_free_noncoherent,
+#else
 	.alloc_coherent	= dma_direct_alloc_coherent,
 	.free_coherent	= dma_direct_free_coherent,
+#endif
 	.map_single	= dma_direct_map_single,
 	.unmap_single	= dma_direct_unmap_single,
 	.map_sg		= dma_direct_map_sg,
 	.unmap_sg	= dma_direct_unmap_sg,
 	.dma_supported	= dma_direct_dma_supported,
+#ifdef CONFIG_HIGHMEM
+	.map_page	= dma_direct_map_page,
+	.unmap_page	= dma_direct_unmap_page,
+#endif
 };
 EXPORT_SYMBOL(dma_direct_ops);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 063cdd4..4b32136 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -56,6 +56,34 @@ resource_size_t isa_mem_base;
 /* Default PCI flags is 0 */
 unsigned int ppc_pci_flags;
 
+static struct dma_mapping_ops *pci_dma_ops;
+
+void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
+{
+	pci_dma_ops = dma_ops;
+}
+
+struct dma_mapping_ops *get_pci_dma_ops(void)
+{
+	return pci_dma_ops;
+}
+EXPORT_SYMBOL(get_pci_dma_ops);
+
+int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
+{
+	return dma_set_mask(&dev->dev, mask);
+}
+
+int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
+{
+	int rc;
+
+	rc = dma_set_mask(&dev->dev, mask);
+	dev->dev.coherent_dma_mask = dev->dma_mask;
+
+	return rc;
+}
+
 struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 {
 	struct pci_controller *phb;
@@ -180,6 +208,31 @@ char __devinit *pcibios_setup(char *str)
 	return str;
 }
 
+void __devinit pcibios_setup_new_device(struct pci_dev *dev)
+{
+	struct dev_archdata *sd = &dev->dev.archdata;
+
+	sd->of_node = pci_device_to_OF_node(dev);
+
+	DBG("PCI: device %s OF node: %s\n", pci_name(dev),
+	    sd->of_node ? sd->of_node->full_name : "<none>");
+
+	sd->dma_ops = pci_dma_ops;
+#ifdef CONFIG_PPC32
+	/* Temporary hack until 32-bit plats do setup correctly. */
+	sd->dma_data = (void *)PCI_DRAM_OFFSET;
+#endif
+
+#ifdef CONFIG_NUMA
+	sd->numa_node = pcibus_to_node(dev->bus);
+#else
+	sd->numa_node = -1;
+#endif
+	if (ppc_md.pci_dma_dev_setup)
+		ppc_md.pci_dma_dev_setup(dev);
+}
+EXPORT_SYMBOL(pcibios_setup_new_device);
+
 /*
  * Reads the interrupt pin to determine if interrupt is use by card.
  * If the interrupt is used, then gets the interrupt line from the
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 88db4ff..174b77e 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -424,6 +424,7 @@ void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
 	unsigned long io_offset;
 	struct resource *res;
 	int i;
+	struct pci_dev *dev;
 
 	/* Hookup PHB resources */
 	io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
@@ -457,6 +458,12 @@ void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
 			bus->resource[i+1] = res;
 		}
 	}
+
+	if (ppc_md.pci_dma_bus_setup)
+		ppc_md.pci_dma_bus_setup(bus);
+
+	list_for_each_entry(dev, &bus->devices, bus_list)
+		pcibios_setup_new_device(dev);
 }
 
 /* the next one is stolen from the alpha port... */
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 5275074..2a5487c 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -52,35 +52,6 @@ EXPORT_SYMBOL(pci_io_base);
 
 LIST_HEAD(hose_list);
 
-static struct dma_mapping_ops *pci_dma_ops;
-
-void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
-{
-	pci_dma_ops = dma_ops;
-}
-
-struct dma_mapping_ops *get_pci_dma_ops(void)
-{
-	return pci_dma_ops;
-}
-EXPORT_SYMBOL(get_pci_dma_ops);
-
-
-int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
-{
-	return dma_set_mask(&dev->dev, mask);
-}
-
-int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
-{
-	int rc;
-
-	rc = dma_set_mask(&dev->dev, mask);
-	dev->dev.coherent_dma_mask = dev->dma_mask;
-
-	return rc;
-}
-
 static void fixup_broken_pcnet32(struct pci_dev* dev)
 {
 	if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
@@ -548,26 +519,6 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
 }
 EXPORT_SYMBOL_GPL(pcibios_map_io_space);
 
-void __devinit pcibios_setup_new_device(struct pci_dev *dev)
-{
-	struct dev_archdata *sd = &dev->dev.archdata;
-
-	sd->of_node = pci_device_to_OF_node(dev);
-
-	DBG("PCI: device %s OF node: %s\n", pci_name(dev),
-	    sd->of_node ? sd->of_node->full_name : "<none>");
-
-	sd->dma_ops = pci_dma_ops;
-#ifdef CONFIG_NUMA
-	sd->numa_node = pcibus_to_node(dev->bus);
-#else
-	sd->numa_node = -1;
-#endif
-	if (ppc_md.pci_dma_dev_setup)
-		ppc_md.pci_dma_dev_setup(dev);
-}
-EXPORT_SYMBOL(pcibios_setup_new_device);
-
 void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
 {
 	struct pci_dev *dev;
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index bbefb69..dcebf4d 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -36,16 +36,15 @@ extern void __dma_sync_page(struct page *page, unsigned long offset,
  * Cache coherent cores.
  */
 
-#define __dma_alloc_coherent(gfp, size, handle)	NULL
-#define __dma_free_coherent(size, addr)		((void)0)
 #define __dma_sync(addr, size, rw)		((void)0)
 #define __dma_sync_page(pg, off, sz, rw)	((void)0)
 
 #endif /* ! CONFIG_NOT_COHERENT_CACHE */
 
-#ifdef CONFIG_PPC64
+extern struct dma_mapping_ops dma_direct_ops;
+
 /*
- * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
+ * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO, etc.
  */
 struct dma_mapping_ops {
 	void *		(*alloc_coherent)(struct device *dev, size_t size,
@@ -62,6 +61,14 @@ struct dma_mapping_ops {
 				int nents, enum dma_data_direction direction);
 	int		(*dma_supported)(struct device *dev, u64 mask);
 	int		(*set_dma_mask)(struct device *dev, u64 dma_mask);
+#ifdef CONFIG_HIGHMEM
+	dma_addr_t 	(*map_page)(struct device *dev, struct page *page,
+				unsigned long offset, size_t size,
+				enum dma_data_direction direction);
+	void		(*unmap_page)(struct device *dev,
+				dma_addr_t dma_address, size_t size,
+				enum dma_data_direction direction);
+#endif
 };
 
 static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
@@ -71,8 +78,23 @@ static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
 	 * only ISA DMA device we support is the floppy and we have a hack
 	 * in the floppy driver directly to get a device for us.
 	 */
-	if (unlikely(dev == NULL || dev->archdata.dma_ops == NULL))
+	if (unlikely(dev == NULL))
 		return NULL;
+
+	if (unlikely(dev->archdata.dma_ops == NULL)) {
+#ifdef CONFIG_PPC64
+		return NULL;
+#else
+		/* Some legacy devices don't support archdata dma ops.
+		 * Assume those devices can use dma_direct_ops.
+		 * This also serves as a default for 32-bit platforms
+		 * on which all devices use the direct ops and so we haven't
+		 * set up the archdata dma_ops.
+		 */
+		return &dma_direct_ops;
+#endif
+	}
+
 	return dev->archdata.dma_ops;
 }
 
@@ -154,8 +176,12 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
 	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
+#ifdef CONFIG_HIGHMEM
+	return dma_ops->map_page(dev, page, offset, size, direction);
+#else
 	return dma_ops->map_single(dev, page_address(page) + offset, size,
 			direction);
+#endif
 }
 
 static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
@@ -165,7 +191,12 @@ static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
 	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
+
+#ifdef CONFIG_HIGHMEM
+	dma_ops->unmap_page(dev, dma_address, size, direction);
+#else
 	dma_ops->unmap_single(dev, dma_address, size, direction);
+#endif
 }
 
 static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
@@ -192,121 +223,6 @@ static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
  * Available generic sets of operations
  */
 extern struct dma_mapping_ops dma_iommu_ops;
-extern struct dma_mapping_ops dma_direct_ops;
-
-#else /* CONFIG_PPC64 */
-
-#define dma_supported(dev, mask)	(1)
-
-static inline int dma_set_mask(struct device *dev, u64 dma_mask)
-{
-	if (!dev->dma_mask || !dma_supported(dev, mask))
-		return -EIO;
-
-	*dev->dma_mask = dma_mask;
-
-	return 0;
-}
-
-static inline void *dma_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t * dma_handle,
-				       gfp_t gfp)
-{
-#ifdef CONFIG_NOT_COHERENT_CACHE
-	return __dma_alloc_coherent(size, dma_handle, gfp);
-#else
-	void *ret;
-	/* ignore region specifiers */
-	gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
-
-	if (dev == NULL || dev->coherent_dma_mask < 0xffffffff)
-		gfp |= GFP_DMA;
-
-	ret = (void *)__get_free_pages(gfp, get_order(size));
-
-	if (ret != NULL) {
-		memset(ret, 0, size);
-		*dma_handle = virt_to_bus(ret);
-	}
-
-	return ret;
-#endif
-}
-
-static inline void
-dma_free_coherent(struct device *dev, size_t size, void *vaddr,
-		  dma_addr_t dma_handle)
-{
-#ifdef CONFIG_NOT_COHERENT_CACHE
-	__dma_free_coherent(size, vaddr);
-#else
-	free_pages((unsigned long)vaddr, get_order(size));
-#endif
-}
-
-static inline dma_addr_t
-dma_map_single(struct device *dev, void *ptr, size_t size,
-	       enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	__dma_sync(ptr, size, direction);
-
-	return virt_to_bus(ptr);
-}
-
-static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
-				    size_t size,
-				    enum dma_data_direction direction)
-{
-	/* We do nothing. */
-}
-
-static inline dma_addr_t
-dma_map_page(struct device *dev, struct page *page,
-	     unsigned long offset, size_t size,
-	     enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	__dma_sync_page(page, offset, size, direction);
-
-	return page_to_bus(page) + offset;
-}
-
-static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-				  size_t size,
-				  enum dma_data_direction direction)
-{
-	/* We do nothing. */
-}
-
-static inline int
-dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
-	   enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	BUG_ON(direction == DMA_NONE);
-
-	for_each_sg(sgl, sg, nents, i) {
-		BUG_ON(!sg_page(sg));
-		__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
-		sg->dma_address = page_to_bus(sg_page(sg)) + sg->offset;
-	}
-
-	return nents;
-}
-
-static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-				int nhwentries,
-				enum dma_data_direction direction)
-{
-	/* We don't do anything here. */
-}
-
-#endif /* CONFIG_PPC64 */
 
 static inline void dma_sync_single_for_cpu(struct device *dev,
 		dma_addr_t dma_handle, size_t size,
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 54ed64d..d94d295 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -87,8 +87,6 @@ struct machdep_calls {
 	unsigned long	(*tce_get)(struct iommu_table *tbl,
 				    long index);
 	void		(*tce_flush)(struct iommu_table *tbl);
-	void		(*pci_dma_dev_setup)(struct pci_dev *dev);
-	void		(*pci_dma_bus_setup)(struct pci_bus *bus);
 
 	void __iomem *	(*ioremap)(phys_addr_t addr, unsigned long size,
 				   unsigned long flags);
@@ -100,6 +98,9 @@ struct machdep_calls {
 #endif
 #endif /* CONFIG_PPC64 */
 
+	void		(*pci_dma_dev_setup)(struct pci_dev *dev);
+	void		(*pci_dma_bus_setup)(struct pci_bus *bus);
+
 	int		(*probe)(void);
 	void		(*setup_arch)(void); /* Optional, may be NULL */
 	void		(*init_early)(void);
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index a05a942..0e52c78 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -60,6 +60,14 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
+#ifdef CONFIG_PCI
+extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
+extern struct dma_mapping_ops *get_pci_dma_ops(void);
+#else	/* CONFIG_PCI */
+#define set_pci_dma_ops(d)
+#define get_pci_dma_ops()	NULL
+#endif
+
 #ifdef CONFIG_PPC64
 
 /*
@@ -70,9 +78,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 #define PCI_DISABLE_MWI
 
 #ifdef CONFIG_PCI
-extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
-extern struct dma_mapping_ops *get_pci_dma_ops(void);
-
 static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 					enum pci_dma_burst_strategy *strat,
 					unsigned long *strategy_parameter)
@@ -89,9 +94,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 	*strat = PCI_DMA_BURST_MULTIPLE;
 	*strategy_parameter = cacheline_size;
 }
-#else	/* CONFIG_PCI */
-#define set_pci_dma_ops(d)
-#define get_pci_dma_ops()	NULL
 #endif
 
 #else /* 32-bit */
-- 
1.5.4.1

^ permalink raw reply related

* Re: [PATCH] [POWERPC] Rework EXC_LEVEL_EXCEPTION_PROLOG code
From: Kumar Gala @ 2008-04-30 23:28 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1209594130.18023.258.camel@pasglop>


On Apr 30, 2008, at 5:22 PM, Benjamin Herrenschmidt wrote:
>
> On Wed, 2008-04-30 at 17:13 -0500, Kumar Gala wrote:
>>
>> If we don't handle reschedule or signal will we actually not
>> function
>> properly?  I assume reschedule isn't an issue, but could we lose a
>> signal?
>
> Well, you can be in trouble if you lose TIF_SIGPENDING. You don't - 
> have-
> to actually take the signal, it will then be done on the next return  
> to
> userspace (next timer interrupt, next syscall, ...), but  
> TIF_SIGPENDING
> must not be lost.

Interesting.  It seems like causing a signal from an async interrupt  
from kernel space shouldn't be allowed.  At worse we can store back  
the flags into the "real" thread_info.

>>> Nothing specific to your patch, but those level##_STACK_TOP seem to
>>> be pretty badly named if you end up -adding- THREAD_SIZE to actually
>>> get to the stack's top. Do they really contain the stack top or do
>>> they in fact contain the stack base/bottom ?
>>
>> That might be stale from how the old code worked.  I can never
>> remember what we consider the top and bottom of the stack.  (please
>> remind me and I'll fixup the comments and variables).
>
> Well, top is the high address and bottom is the low address in my view
> of things :-)

yeah, so we are now pointing to stack bottom.  will fix this up.

>> I thought about that.  The only case its a bit of an issue is for
>> CriticalInput.  I don't see Watchdog, Debug, or MachineCheck as
>> being
>> performance critical.  I can use r10 if I save and restored the CR
>> or
>> some other register.
>
> You can save CR first yeah and then interleave a bit using 2 registers
> (ie. 2 loads, 2 stores, or something like load 1, load 2, store 1,  
> load
> 3, store 2, etc...)

Ok, will look at that.

>> just leaving it to C code.  I assume that preempt_count should be
>> the
>> same value on entry and exit.  Do think we should set HARDIRQ_OFFSET
>> for debug level exceptions?
>
> Well... I think all those things should run with EE disabled, and thus
> be considered as far as linux is concerned, as interrupts. So the C  
> code
> should do irq_enter/exit.

I agree we run all these interrupt levels with EE disabled.  Not sure  
I follow what you mean by irq_enter/ext.

>> Where should I look for an example of how to convey that information
>> to lockdep?
>
> The irqtrace stuff in the asm would do maybe unless  
> transfer_to_handler
> does it already, I have to look at the code with all your patches
> applied...

ok.

- k

^ permalink raw reply

* Re: [PATCH] [POWERPC] Rework EXC_LEVEL_EXCEPTION_PROLOG code
From: Kumar Gala @ 2008-04-30 23:24 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1209593896.18023.253.camel@pasglop>


On Apr 30, 2008, at 5:18 PM, Benjamin Herrenschmidt wrote:
>
> On Wed, 2008-04-30 at 17:13 -0500, Kumar Gala wrote:
>>>> stack there by make references go from GPR11-INT_FRAME_SIZE(r8) to
>>>> just GPR(r8)
>>>           ^^ 11 ?
>>
>> r8 is correct for my example.  My point is
>> s/GPR11-INT_FRAME_SIZE/GPR11/
>
> Sorry, I put the ^^ in the wrong place :-) I meant the example should
> say GPR11(r8)

ah, that makes sense.  Will fix in the next revision.

- k

^ permalink raw reply

* Re: [PATCH v2 4/6] [POWERPC] QE: implement support for the GPIO LIB API
From: Anton Vorontsov @ 2008-04-30 23:24 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev
In-Reply-To: <4818FAD1.8020808@freescale.com>

On Wed, Apr 30, 2008 at 06:03:45PM -0500, Timur Tabi wrote:
> Anton Vorontsov wrote:
> 
> > What is the problem with returning (int)(u32 & u32) value?
> 
> Technically, a signed int is smaller than an unsigned int, so a value of
> 0x80000000 won't fit in an 'int'.

They're of the same size. And because of that, we'll not lose
information, so (int)(0x80000000U) still != 0, it is just negative.

> > You've asked to remove "!!" stuff and now purposing exactly the
> > same... :-?
> 
> The !! stuff was because the function was returning a boolean value, so non-zero
> == TRUE.  I don't think the return value from 'get' is a technically a boolean,
> so I'm assuming that the spec says the return value should be 0 or 1, to reflect
> the value of that GPIO pin.

No. The spec indeed says that 0 for low, non-0 for high.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply

* mucking with cputable ...
From: Kevin Diggs @ 2008-04-30 23:52 UTC (permalink / raw)
  To: linuxppc-dev

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

Hi,

	I'm trying to monkey with cputable. It is hanging after printing:

Preparing BATs

on the console (PowerMac 8600 with PowerLogix 750GX card, 2.6.24 YDL 4.0).

	I am guessing I am doing this PTRRELOC() thing wrong? Can someone 
explain what is going on here:

	*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;

Up above both s and t needed reloccing? This is from identify_cpu(). 
Does this have something to do with data items in different sections 
(i.e. initdata)?

	I also welcome comments on where else the data I'm trying to graft into 
cputable might go (i.e. cpu_freq driver).

Thanks!

kevin

[-- Attachment #2: cputable.c.diff --]
[-- Type: text/plain, Size: 5017 bytes --]

--- cputable-old_c	2008-02-25 18:24:23.000000000 -0800
+++ cputable-new_c	2008-04-30 14:31:37.000000000 -0700
@@ -38,11 +38,13 @@
 extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_750cx(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_750fx(unsigned long offset, struct cpu_spec* spec);
+extern void __setup_cpu_750gx(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_7400(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
+
 #endif /* CONFIG_PPC32 */
 #ifdef CONFIG_PPC64
 extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_ppc970MP(unsigned long offset, struct cpu_spec* spec);
@@ -70,8 +72,25 @@
 				 PPC_FEATURE_HAS_ALTIVEC_COMP)
 #define COMMON_USER_BOOKE	(PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
 				 PPC_FEATURE_BOOKE)
 
+#ifdef CONFIG_PPC32
+static struct ppc_misc_750fgx __initdata ppc_misc_750fx={
+	.misc_cp=ppc_misc_cp_750fgx,
+	.min_ratio=2,		/* min bus ratio */
+	.max_ratio=20,		/* max bus ratio */
+	.min_core=400000,	/* min core frequency per spec */
+	.max_core=800000,	/* max core frequency per spec */
+};
+static struct ppc_misc_750fgx __initdata ppc_misc_750gx={
+	.misc_cp=ppc_misc_cp_750fgx,
+	.min_ratio=2,		/* min bus ratio */
+	.max_ratio=20,		/* max bus ratio */
+	.min_core=500000,	/* min core frequency per spec */
+	.max_core=1000000,	/* max core frequency per spec */
+};
+#endif /* CONFIG_PPC32 */
+
 static struct cpu_spec __initdata cpu_specs[] = {
 #ifdef CONFIG_PPC64
 	{	/* Power3 */
 		.pvr_mask		= 0xffff0000,
@@ -590,8 +609,9 @@
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
 		.cpu_setup		= __setup_cpu_750,
+		.misc			= (void *) &ppc_misc_750fx,
 		.platform		= "ppc750",
 	},
 	{	/* 750FX rev 2.0 must disable HID0[DPM] */
 		.pvr_mask		= 0xffffffff,
@@ -602,8 +622,9 @@
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
 		.cpu_setup		= __setup_cpu_750,
+		.misc			= (void *) &ppc_misc_750fx,
 		.platform		= "ppc750",
 	},
 	{	/* 750FX (All revs except 2.0) */
 		.pvr_mask		= 0xffff0000,
@@ -614,20 +635,48 @@
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
 		.cpu_setup		= __setup_cpu_750fx,
+		.misc			= (void *) &ppc_misc_750fx,
 		.platform		= "ppc750",
 	},
-	{	/* 750GX */
+	{	/* 750GX rev 1.x */
 		.pvr_mask		= 0xffff0000,
 		.pvr_value		= 0x70020000,
 		.cpu_name		= "750GX",
 		.cpu_features		= CPU_FTRS_750GX,
 		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
-		.cpu_setup		= __setup_cpu_750fx,
+		.cpu_setup		= __setup_cpu_750gx,
+		.misc			= (void *) &ppc_misc_750gx,
+		.platform		= "ppc750",
+	},
+	{	/* 750GX (rev 2.3, as used on PowerLogix 750GX upgrade card */
+		.pvr_mask		= 0xffffffff,
+		.pvr_value		= 0x00080203,
+		.cpu_name		= "750GX",
+		.cpu_features		= CPU_FTRS_750GX,
+		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,
+		.icache_bsize		= 32,
+		.dcache_bsize		= 32,
+		.num_pmcs		= 4,
+		.cpu_setup		= __setup_cpu_750gx,
+		.misc			= (void *) &ppc_misc_750gx,
+		.platform		= "ppc750",
+	},
+	{	/* 750GX (All revs >= 2.0) */
+		.pvr_mask		= 0xffffff00,
+		.pvr_value		= 0x70020200,
+		.cpu_name		= "750GX",
+		.cpu_features		= CPU_FTRS_750GX,
+		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,
+		.icache_bsize		= 32,
+		.dcache_bsize		= 32,
+		.num_pmcs		= 4,
+		.cpu_setup		= __setup_cpu_750gx,
+		.misc			= (void *) &ppc_misc_750gx,
 		.platform		= "ppc750",
 	},
 	{	/* 740/750 (L2CR bit need fixup for 740) */
 		.pvr_mask		= 0xffff0000,
@@ -1331,8 +1380,34 @@
 #endif /* CONFIG_PPC32 */
 };
 
 static struct cpu_spec the_cpu_spec;
+#ifdef CONFIG_PPC32
+/*
+ * Used to hold misc data structure
+ */
+static int ppc_misc_space[4];
+
+void * __init ppc_misc_cp_750fgx(void *miscp)
+{
+struct ppc_misc_750fgx *s=(struct ppc_misc_750fgx *)miscp;
+struct ppc_misc_750fgx *t=(struct ppc_misc_750fgx *)&ppc_misc_space;
+
+	/*
+	 * Make sure we have enough static space!
+	 */
+	if(sizeof(struct ppc_misc_750fgx)>sizeof(ppc_misc_space)) return NULL;
+
+	s=PTRRELOC(s);
+//	t=PTRRELOC(t);
+
+	*t=*s;
+	t->misc_cp=NULL;
+
+	return &ppc_misc_space;
+}
+
+#endif /* CONFIG_PPC32 */
 
 struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
 {
 	struct cpu_spec *s = cpu_specs;
@@ -1373,8 +1448,17 @@
 			if (s->cpu_setup) {
 				s->cpu_setup(offset, s);
 			}
 #endif /* CONFIG_PPC64 || CONFIG_BOOKE */
+#if 0
+			if(s->misc) *PTRRELOC(&t->misc)=((struct ppc_misc_any *)
+				(s->misc))->misc_cp(s->misc);
+			else *PTRRELOC(&t->misc)=NULL;
+#else
+			if(s->misc) t->misc=((struct ppc_misc_any *)
+				(s->misc))->misc_cp(s->misc);
+			else t->misc=NULL;
+#endif
 			return s;
 		}
 	BUG();
 	return NULL;

[-- Attachment #3: cputable.h.diff --]
[-- Type: text/plain, Size: 1439 bytes --]

--- cputable-old_h	2008-02-25 18:24:47.000000000 -0800
+++ cputable-new_h	2008-04-30 06:45:14.000000000 -0700
@@ -56,8 +56,20 @@
 	PPC_PMC_IBM = 1,
 	PPC_PMC_PA6T = 2,
 };
 
+struct ppc_misc_any {
+	void * (*misc_cp)(void *);
+};
+
+struct ppc_misc_750fgx {
+	void * (*misc_cp)(void *);
+	unsigned short min_ratio;
+	unsigned short max_ratio;
+	int min_core;
+	int max_core;
+};
+
 /* NOTE WELL: Update identify_cpu() if fields are added or removed! */
 struct cpu_spec {
 	/* CPU is matched via (PVR & pvr_mask) == pvr_value */
 	unsigned int	pvr_mask;
@@ -96,8 +108,12 @@
 	unsigned long	oprofile_mmcra_clear;
 
 	/* Name of processor class, for the ELF AT_PLATFORM entry */
 	char		*platform;
+
+	/* miscellaneous catch all for various data (like min and max core
+	 * frequencies for dual pll cpus) */
+	void *misc;
 };
 
 extern struct cpu_spec		*cur_cpu_spec;
 
@@ -249,9 +265,9 @@
 #define CPU_FTRS_750FX1	(CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM)
 #define CPU_FTRS_750FX2	(CPU_FTRS_750 | CPU_FTR_NO_DPM)
 #define CPU_FTRS_750FX	(CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX | \
 		CPU_FTR_HAS_HIGH_BATS)
-#define CPU_FTRS_750GX	(CPU_FTRS_750FX)
+#define CPU_FTRS_750GX	(CPU_FTRS_750FX | CPU_FTR_DUAL_PLL_750FX)
 #define CPU_FTRS_7400_NOTAU	(CPU_FTR_COMMON | \
 	    CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
 	    CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \
 	    CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)

^ permalink raw reply

* Re: [PATCH v2 4/6] [POWERPC] QE: implement support for the GPIO LIB API
From: Timur Tabi @ 2008-04-30 23:03 UTC (permalink / raw)
  To: cbouatmailru; +Cc: linuxppc-dev
In-Reply-To: <20080430225951.GA10361@zarina>

Anton Vorontsov wrote:

> What is the problem with returning (int)(u32 & u32) value?

Technically, a signed int is smaller than an unsigned int, so a value of
0x80000000 won't fit in an 'int'.

> You've asked to remove "!!" stuff and now purposing exactly the
> same... :-?

The !! stuff was because the function was returning a boolean value, so non-zero
== TRUE.  I don't think the return value from 'get' is a technically a boolean,
so I'm assuming that the spec says the return value should be 0 or 1, to reflect
the value of that GPIO pin.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* Re: [patch 1/5] POWERPC: Fix slb.c compile warnings
From: Benjamin Herrenschmidt @ 2008-04-30 23:01 UTC (permalink / raw)
  To: Geoff Levand; +Cc: linuxppc-dev, paulus
In-Reply-To: <4818F1BA.80408@am.sony.com>


On Wed, 2008-04-30 at 15:24 -0700, Geoff Levand wrote:
> Arrange for a syntax check to always be done on the powerpc/mm/slb.c
> DBG() macro by defining it to pr_debug() for non-debug builds. 
> 
> Also, fix these related compile warnings:
> 
>   slb.c:273: warning: format '%04x' expects type 'unsigned int', but argument 2 has type 'long unsigned int
>   slb.c:274: warning: format '%04x' expects type 'unsigned int', but argument 2 has type 'long unsigned int'
> 
> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  arch/powerpc/mm/slb.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> --- a/arch/powerpc/mm/slb.c
> +++ b/arch/powerpc/mm/slb.c
> @@ -30,7 +30,7 @@
>  #ifdef DEBUG
>  #define DBG(fmt...) udbg_printf(fmt)
>  #else
> -#define DBG(fmt...)
> +#define DBG pr_debug
>  #endif
>  
>  extern void slb_allocate_realmode(unsigned long ea);
> @@ -279,8 +279,8 @@ void slb_initialize(void)
>  		patch_slb_encoding(slb_compare_rr_to_size,
>  				   mmu_slb_size);
>  
> -		DBG("SLB: linear  LLP = %04x\n", linear_llp);
> -		DBG("SLB: io      LLP = %04x\n", io_llp);
> +		DBG("SLB: linear  LLP = %04lx\n", linear_llp);
> +		DBG("SLB: io      LLP = %04lx\n", io_llp);
>  	}
>  
>  	get_paca()->stab_rr = SLB_NUM_BOLTED;
> 

^ permalink raw reply

* Re: [PATCH] docbook: fix fatal rapidio yet again (and more to come)
From: Randy Dunlap @ 2008-04-30 22:11 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: linux-kernel, linuxppc-dev, Andrew Morton, torvalds,
	"Zhang Wei" rdunlap@xenotime.net
In-Reply-To: <18456.60948.463017.139935@cargo.ozlabs.ibm.com>

On Thu, 1 May 2008 08:09:24 +1000 Paul Mackerras wrote:

> Andrew Morton writes:
> 
> > > Odd.  I thought Paul had picked up a docbook RapidIO patch from you in  
> > > the latest merge round.
> > > 
> > 
> > Well it's more than "a" patch.  The six-week-old patch series is:
> > 
> > rapidio-add-memory-mapping-driver-to-rapidio.patch
> > rapidio-add-rapidio-space-allocation-bitmap-arithmetic.patch
> > rapidio-add-fsl-rapidio-controller-memory-ops-functions.patch
> > rapidio-add-the-rapidio-master-port-maintance-and-doorbell-window-to-space-resources.patch
> > rapidio-add-rapidio-proc-fs-for-memory-mapping-debugging.patch
> > rapidio-add-the-memory-mapping-support-in-rionet-driver.patch
> > rapidio-fix-docbook-references.patch
> > rapidio-fix-kernel-doc-problems.patch
> 
> What happened is that you (Andrew) sent them on to me pretty much
> unexamined.  I took a look at them and dropped one of them because it
> created a new /proc file.  I asked Kumar to look at them and he had
> issues with another three of the patches, and dropping those meant
> that all the following ones (including the fix-kernel-doc one)
> wouldn't apply, so I dropped them too.  I applied the rest and sent
> them to Linus.
> 
> > (seems that I forgot to cc Jeff on the rionet change too).
> 
> Yeah.  I nearly dropped that one too.  I probably should have. :)
> 
> > Oh well.  If nobody puts their hand up in the next 24 hours or so I'll just
> > send it all in to Linus.
> 
> Please don't.  At this stage I think the best thing is for Kumar to
> talk to Zhang Wei (they both work for Freescale, so that should be
> possible in theory :) and get him to rework the remaining patches as
> required for inclusion in 2.6.27.

Just to be clear, the docbook changes shouldn't wait for 2.6.27.
There's no need for that.

---
~Randy

^ permalink raw reply

* Re: [PATCH v2 4/6] [POWERPC] QE: implement support for the GPIO LIB API
From: Anton Vorontsov @ 2008-04-30 22:59 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev
In-Reply-To: <4818F7C2.2030408@freescale.com>

On Wed, Apr 30, 2008 at 05:50:42PM -0500, Timur Tabi wrote:
> Anton Vorontsov wrote:
> 
> > Per Grant Likely's comments, "fsl,qe-pario-bank" considered as a made up
> > stuff. MPC8323 is the first QE chip, so every next QE chips should be
> > compatible.
> 
> Ok.
> 
> >> Return value should be "u32", not "int".
> > 
> > gpio.h disagree
> > 
> > $ cat include/asm-generic/gpio.h  | grep \*get
> >         int                     (*get)(struct gpio_chip *chip,
> > 
> 
> In that case, perhaps you should return this:
> 
> 	return in_be32(&regs->cpdata) & pin_mask ? 1 : 0;

What is the problem with returning (int)(u32 & u32) value?

You've asked to remove "!!" stuff and now purposing exactly the
same... :-?

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ 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