powerpc: implement support for MPC8349-compatible SOC GPIOs
PATCH v2 1/1 powerpc: implement support for MPC8349-compatible SOC GPIOs
This patch implements GPIOLIB support for MPC8349-compatible SOC GPIOs. MPC8610 adopted this GPIO unit, so let's place it into sysdev.
We'll need these gpios to support IrDA transceiver on MPC8610HPCD.
---
v2:
- Incorporated Peter Korsgaard's suggestion regarding order of setting data/direction registers.
The patch applies on top of "powerpc: add driver for simple GPIO banks".
arch/powerpc/sysdev/Kconfig | 10 ++ arch/powerpc/sysdev/Makefile | 1 + arch/powerpc/sysdev/fsl_mpc8349_gpio.c | 161 ++++++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/sysdev/fsl_mpc8349_gpio.c
arch/powerpc/sysdev/Kconfig +10 -0
@@ -17,3 +17,13 @@ config OF_SIMPLE_GPIO These are usually BCSRs used to control board's switches, LEDs, chip-selects, Ethernet/USB PHY's power and various other small on-board peripherals. + +config FSL_MPC8349_GPIO + bool "Support for MPC8349-compatible GPIO controllers" + depends on PPC32 + select GENERIC_GPIO + select ARCH_REQUIRE_GPIOLIB + help + Say Y here to support Freescale MPC8349-compatible GPIO controllers. + The controllers can be found in MPC831x, MPC834x, MPC837x and + MPC8610 processors.
arch/powerpc/sysdev/Makefile +1 -0
@@ -37,6 +37,7 @@ obj-$(CONFIG_4xx) += ppc4xx_pci.o endif obj-$(CONFIG_OF_SIMPLE_GPIO) += of_simple_gpio.o +obj-$(CONFIG_FSL_MPC8349_GPIO) += fsl_mpc8349_gpio.o # Temporary hack until we have migrated to asm-powerpc ifeq ($(ARCH),powerpc)
arch/powerpc/sysdev/fsl_mpc8349_gpio.c new file +161 -0
161 lines not on this page · raw message
Signature · 1 line
1.5.6.3
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Anton" == Anton Vorontsov <[email protected]> writes:
Hi,
Anton> This patch implements GPIOLIB support for MPC8349-compatible SOC GPIOs. Anton> MPC8610 adopted this GPIO unit, so let's place it into sysdev.
Anton> We'll need these gpios to support IrDA transceiver on MPC8610HPCD.
It seems basically the same as my patch (gpio driver for mpc831x/mpc834x/mpc837x with OF bindings) from September 5th except you don't have any documentation and the Kconfig doesn't depend on 831x/834x/837x.
Galak, did you have time to look at these patches yet?
Anton> +struct fsl_gpio_chip {
Anton> + struct of_mm_gpio_chip mm_gc;
Anton> + spinlock_t lock;
Anton> +
Anton> + /* shadowed data register to clear/set bits safely */
Anton> + u32 gpdat;
Why do you need this when you have the lock?
Signature · 1 line
Bye, Peter Korsgaard
Quoted 4 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Anton" == Anton Vorontsov <[email protected]> writes:
Hi,
Quoted 8 lines
Anton> This patch implements GPIOLIB support for MPC8349-compatible SOC GPIOs. Anton> MPC8610 adopted this GPIO unit, so let's place it into sysdev.
Anton> We'll need these gpios to support IrDA transceiver on MPC8610HPCD.
It seems basically the same as my patch (gpio driver for mpc831x/mpc834x/mpc837x with OF bindings) from September 5th except you don't have any documentation
Well, do we really need documentation for every trivial gpio controller? The bindings are the same, only different compatible entries...
If we do need the documentation for this, I can readily include it.
Quoted 2 lines
and the
Kconfigdoesn't depend on
831x/834x/837x.
This is purposely. We also need support for 8610, and maybe later we'll find another chip with the same unit. So, to not touch the Kconfig for every new chip I just made it PPC32-wide. Other option is to depend on FSL_SOC, but the driver really does not depend on any fsl_soc stuff...
Quoted 10 lines
Galak, did you have time to look at these patches yet?
Anton> +struct
fsl_gpio_chip{
Anton> + structof_mm_gpio_chipmm_gc;
Anton> +spinlock_tlock;
Anton> +
Anton> + /* shadowed data register to clear/set bits safely */
Anton> + u32 gpdat;Why do you need this when you have the lock?
See this discussion:
http://www.mail-archive.com/[email protected]/msg12299.html
Thanks,
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Anton" == Anton Vorontsov <[email protected]> writes:
Hi,
Quoted 3 lines
Quoted 3 lines
It seems basically the same as my patch (gpio driver for mpc831x/mpc834x/mpc837x with OF bindings) from September 5th except you don't have any documentation
Anton> Well, do we really need documentation for every trivial gpio Anton> controller? The bindings are the same, only different compatible Anton> entries...
Well, we need some way of knowing that atleast. Having people grepping through arch/powerpc/boot/dts/ (and knowing that they should look for 8349 even though they might use 8313 or 8610) doesn't seem optimal to me - I take it that's why we created Documentation/powerpc/dts-bindings in the first place?
Anton> If we do need the documentation for this, I can readily include it.
Quoted 2 lines
Quoted 2 lines
and the
Kconfigdoesn't depend on
831x/834x/837x.
Anton> This is purposely. We also need support for 8610, and maybe Anton> later we'll find another chip with the same unit. So, to not touch Anton> the Kconfig for every new chip I just made it PPC32-wide. Other Anton> option is to depend on FSL_SOC, but the driver really does not Anton> depend on any fsl_soc stuff...
Adding another symbol to the Kconfig once it is verified that a new SoC is compatible doesn't seem like a big deal - Figuring out all the knobs we already have is, without having options for stuff that is known to be irrelevant for the SoC.
The other 83xx specific drivers also depend on PPC_83xx.
Quoted 1 line
Quoted 1 line
Why do you need this when you have the lock?
Anton> See this discussion:
Anton> http://www.mail-archive.com/[email protected]/msg12299.html
Ahh, for open drain outputs. gpiolib doesn't actually provide an interface to put the gpios in that mode, but it could ofcause have been set up in the bootloader. I'll fix that and send an updated patch.
Signature · 1 line
Bye, Peter Korsgaard
Quoted 12 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Anton" == Anton Vorontsov <[email protected]> writes:
Hi,
Quoted 3 lines
Quoted 3 lines
It seems basically the same as my patch (gpio driver for mpc831x/mpc834x/mpc837x with OF bindings) from September 5th except you don't have any documentation
Anton> Well, do we really need documentation for every trivial gpio Anton> controller? The bindings are the same, only different compatible Anton> entries...
Quoted 5 lines
Well, we need some way of knowing that atleast. Having people grepping through
arch/powerpc/boot/dts/(and knowing that they should look for 8349 even though they might use 8313 or 8610) doesn't seem optimal to me - I take it that's why we createdDocumentation/powerpc/dts-bindingsin the first place?
Ok.
Quoted 11 lines
Anton> If we do need the documentation for this, I can readily include it.
Quoted 2 lines
Quoted 2 lines
and the
Kconfigdoesn't depend on
831x/834x/837x.Anton> This is purposely. We also need support for 8610, and maybe Anton> later we'll find another chip with the same unit. So, to not touch Anton> the
Kconfigfor every new chip I just made it PPC32-wide. Other Anton> option is to depend onFSL_SOC, but the driver really does not Anton> depend on anyfsl_socstuff...
Quoted 6 lines
Adding another symbol to the
Kconfigonce it is verified that a new SoC is compatible doesn't seem like a big deal - Figuring out all the knobs we already have is, without having options for stuff that is known to be irrelevant for the SoC.The other 83xx specific drivers also depend on
PPC_83xx.
Lets wait for Kumar's comments. We've already had a PPC_* mess for the USB_EHCI_FSL symbol. What I've learned from it, is that huge PPC_* list isn't perfect either.
See this discussion:
http://www.mail-archive.com/[email protected]/msg01926.html
And this one:
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Why do you need this when you have the lock?
Anton> See this discussion:
Anton> http://www.mail-archive.com/[email protected]/msg12299.html
Ahh, for open drain outputs. gpiolib doesn't actually provide an interface to put the gpios in that mode, but it could ofcause have been set up in the bootloader. I'll fix that and send an updated patch.
Pardon? Who will send an updated patch, and what patch exactly? ;-)
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Quoted 37 lines · Anton Vorontsov
Quoted 12 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Anton" == Anton Vorontsov <[email protected]> writes:
Hi,
Quoted 3 lines
Quoted 3 lines
It seems basically the same as my patch (gpio driver for mpc831x/mpc834x/mpc837x with OF bindings) from September 5th except you don't have any documentation
Anton> Well, do we really need documentation for every trivial gpio Anton> controller? The bindings are the same, only different compatible Anton> entries...
Quoted 5 lines
Well, we need some way of knowing that atleast. Having people grepping through
arch/powerpc/boot/dts/(and knowing that they should look for 8349 even though they might use 8313 or 8610) doesn't seem optimal to me - I take it that's why we createdDocumentation/powerpc/dts-bindingsin the first place?Ok.
Quoted 16 lines
Anton> If we do need the documentation for this, I can readily include it.
Quoted 2 lines
Quoted 2 lines
and the
Kconfigdoesn't depend on
831x/834x/837x.Anton> This is purposely. We also need support for 8610, and maybe Anton> later we'll find another chip with the same unit. So, to not touch Anton> the
Kconfigfor every new chip I just made it PPC32-wide. Other Anton> option is to depend onFSL_SOC, but the driver really does not Anton> depend on anyfsl_socstuff...Adding another symbol to the
Kconfigonce it is verified that a new SoC is compatible doesn't seem like a big deal - Figuring out all the knobs we already have is, without having options for stuff that is known to be irrelevant for the SoC.
Quoted 5 lines
Quoted 1 line
The other 83xx specific drivers also depend on
PPC_83xx.Lets wait for Kumar's comments. We've already had a PPC_* mess for the
USB_EHCI_FSLsymbol. What I've learned from it, is that huge PPC_* list isn't perfect either.
I've alone glanced over this, but some initial comments are.. lets rename the thing to not be 83xx specific since 8610 uses it and I'm sure we'll have other parts that do similar things.
With regards to the binding, lets make it generic like 'fsl,mpc8xxx-gpio", "fsl,CHIP-gpio" and than we can use cpm1/cpm2/pq1/pq2 as prefixes to distinguish and major differences.
- k
On Fri, Sep 19, 2008 at 01:02:11PM -0500, Kumar Gala wrote:
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Anton> This is purposely. We also need support for 8610, and maybe Anton> later we'll find another chip with the same unit. So, to not touch
Anton> theKconfigfor every new chip I just made it PPC32-wide. Other
Anton> option is to depend onFSL_SOC, but the driver really does not Anton> depend on anyfsl_socstuff...Adding another symbol to the
Kconfigonce it is verified that a new SoC is compatible doesn't seem like a big deal - Figuring out all the knobs we already have is, without having options for stuff that is known to be irrelevant for the SoC.The other 83xx specific drivers also depend on
PPC_83xx.
Quoted 7 lines
Quoted 3 lines
Lets wait for Kumar's comments. We've already had a PPC_* mess for the
USB_EHCI_FSLsymbol. What I've learned from it, is that huge PPC_* list isn't perfect either.I've alone glanced over this, but some initial comments are.. lets rename the thing to not be 83xx specific since 8610 uses it and I'm sure we'll have other parts that do similar things.
Ok, mpc8xxx_gpio.c would be fine? (Note that I'm agree with 8xxx, for the file name).
Quoted 3 lines
With regards to the binding, lets make it generic like 'fsl,mpc8xxx- gpio", "fsl,CHIP-gpio" and than we can use cpm1/cpm2/pq1/pq2 as prefixes to distinguish and major differences.
But for compatible entry, shouldn't we use the last compatiblle entry as a generic one? Then fsl,mpc8349-gpio is perfectly valid. I.e., for MPC8610 chips we will have:
"fsl,mpc8610-gpio", "fsl,mpc8349-gpio"
The last entry is most generic, and 8610 is registers-compatible with the earlier (8349) chips. I thought that we tend to not do "made up" 8xxx things in the device tree... Am I wrong?
Thanks!
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Quoted 32 lines · Anton Vorontsov
On Fri, Sep 19, 2008 at 01:02:11PM -0500, Kumar Gala wrote:
[...]Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Anton> This is purposely. We also need support for 8610, and maybe Anton> later we'll find another chip with the same unit. So, to not touch
Anton> theKconfigfor every new chip I just made it PPC32-wide. Other
Anton> option is to depend onFSL_SOC, but the driver really does not Anton> depend on anyfsl_socstuff...Adding another symbol to the
Kconfigonce it is verified that a new SoC is compatible doesn't seem like a big deal - Figuring out all the knobs we already have is, without having options for stuff that is known to be irrelevant for the SoC.The other 83xx specific drivers also depend on
PPC_83xx.Quoted 7 lines
Quoted 3 lines
Lets wait for Kumar's comments. We've already had a PPC_* mess for the
USB_EHCI_FSLsymbol. What I've learned from it, is that huge PPC_* list isn't perfect either.I've alone glanced over this, but some initial comments are.. lets rename the thing to not be 83xx specific since 8610 uses it and I'm sure we'll have other parts that do similar things.
Ok,
mpc8xxx_gpio.cwould be fine? (Note that I'm agree with 8xxx, for the file name).Quoted 3 lines
With regards to the binding, lets make it generic like 'fsl,mpc8xxx- gpio", "fsl,CHIP-gpio" and than we can use cpm1/cpm2/pq1/pq2 as prefixes to distinguish and major differences.
Quoted 5 lines
But for compatible entry, shouldn't we use the last compatiblle entry as a generic one? Then fsl,mpc8349-gpio is perfectly valid. I.e., for MPC8610 chips we will have:
"fsl,mpc8610-gpio", "fsl,mpc8349-gpio"
Yeah the order is correct.. should be:
"fsl,CHIP-gpio", "fsl,mpc8xxx-gpio"
The last entry is most generic, and 8610 is registers-compatible with
Quoted 3 lines
the earlier (8349) chips. I thought that we tend to not do "made up" 8xxx things in the device tree... Am I wrong?
You are correct we try to avoid this, but than I suggest we do it by family. I think its confusing to show 8610 and 8349 in the same dev tree.
What we do in PCI is use the first in family. So lets take 8379 as an example it would look like:
"fsl,mpc8379-gpio", "fsl-mpc8349-gpio"
and 8610 would look like:
"fsl,mpc8610-gpio"
This way the compatiable binding in the code just lists something like "fsl,mpc8349-gpio", "fsl,mpc8610-gpio", "fsl,mpc8572-gpio".
Does that make sense?
- k
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Kumar" == Kumar Gala <[email protected]> writes:
Hi,
Kumar> This way the compatiable binding in the code just lists something like Kumar> "fsl,mpc8349-gpio", "fsl,mpc8610-gpio", "fsl,mpc8572-gpio".
Kumar> Does that make sense?
Yes, sounds fine - I'll adapt the patch and resend.
Signature · 1 line
Bye, Peter Korsgaard
Quoted 3 lines · Kumar Gala
You are correct we try to avoid this, but than I suggest we do it by family. I think its confusing to show 8610 and 8349 in the same dev tree.
I don't think it's confusing (at least, not moreso than picking an arbitrary chip within the same family), if it really is compatible and there is nothing new in the 86xx GPIO that warrants having a common compatible for them.
-Scott
Quoted 10 lines · Peter Korsgaard
Anton> This is purposely. We also need support for 8610, and maybe Anton> later we'll find another chip with the same unit. So, to not touch Anton> the
Kconfigfor every new chip I just made it PPC32-wide. Other Anton> option is to depend onFSL_SOC, but the driver really does not Anton> depend on anyfsl_socstuff...Adding another symbol to the
Kconfigonce it is verified that a new SoC is compatible doesn't seem like a big deal - Figuring out all the knobs we already have is, without having options for stuff that is known to be irrelevant for the SoC.
I agree with Anton; it's a lot less of a headache to say "no" to some unfamiliar kconfig option than it is to hunt around and figure out why you're not being given the option. I'd be OK with depending on FSL_SOC.
Quoted 1 line
The other 83xx specific drivers also depend on
PPC_83xx.
As pointed out above, this isn't 83xx-specific.
-Scott