Commit Graph

28 Commits

Author SHA1 Message Date
Linus Walleij 38843e2921 pinctrl/nomadik: pass DT node to the irqdomain
When creating the simple irqdomain, pass the DT node pointer along,
as is apropriate.

Acked-by: Lee Jones <lee.jones@linaro.org>
Reported-by: Gabriel Fernandez <gabriel.fernandez@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-10-23 11:52:25 +02:00
Linus Walleij 832b6cdf72 pinctrl/nomadik: use zero as default irq_start
The irqdomain semantics were supposed to be such that a linear
domain would be used if the passed first_irq was zero or
negative, but I got it wrong so only passing zero as first_irq
will work properly. Well, zero is NO_IRQ these days so let's
pass zero. The semantics of irqdomain_add_simple() will be
fixed in a separate patch.

Acked-by: Lee Jones <lee.jones@linaro.org>
Reported-by: Rikard Olsson <rikard.p.olsson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-10-23 11:52:19 +02:00
Linus Walleij 268300be0e pinctrl/nomadik: use irq_create_mapping()
Since in the DT case, the linear domain path will not allocate
descriptors for the IRQs, we need to use irq_create_mapping()
for mapping hwirqs to Linux IRQs, so these descriptors get
created on-the-fly in this case.

ChangeLog v1->v2:

- Just use irq_create_mapping() in the .to_irq function since
  this is called before unmasking or enabling any interrupt
  lines, so irq_find_mapping() should be sufficient for the
  IRQ handler function.

Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-10-23 10:33:39 +02:00
Linus Walleij 51f58c68a3 pinctrl/nomadik: always use the simple irqdomain
Since the simple irqdomain will fall back to a linear domain
if the first_irq provided is <= 0, just use this, just make
sure the first_irq is negative in the device tree case.

Cc: Rob Herring <rob.herring@calxeda.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-10-15 09:09:27 +02:00
Linus Walleij b721370266 pinctrl/nomadik: provide stubs for legacy Nomadik
The compilation of the pinctrl driver failed on the legacy
Nomadik NHK8815 platform because it was not providing the PRCMU
interfaces needed to support the extended alternate functions
used by the ux500 series.

Solve this by providing some stubs for the legacy platform, to
avoid too much #ifdefs in the code per se. Theoretically this
actually allows the Nomadik and Ux500 to have a single kernel
image with support for the PRCM registers on the Ux500 (though
they have incompatible archs, but the spirit is there).

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-10-15 09:09:27 +02:00
Linus Walleij 6054b9cae2 pinctrl/nomadik: use simple or linear IRQ domain
This alters the Nomadik pinctrl driver to:

- Call irqdomain_add_linear() for the DT case so we get
  all independent from IRQ numbers in this case.
- Call irqdomain_add_simple() for the legacy case, which
  allocates the IRQ descriptors for the Nomadik pin controller
  dynamically.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-10-10 08:57:26 +02:00
Jean-Nicolas Graux c22df08c7f pinctrl/nomadik: support other alternate-C functions
Upgrade nomadik pinctrl driver to enable selection of other
alternate-C[1-4] functions on some specific ux500 SoC pins.
Handling of those functions is done thanks to PRCM GPIOCR
registers. This was previously managed in PRCMU driver and
it was not really convenient. Idea is to provide a common
way to control all alternate functions.

Note that this improvement does not support the old-fashioned way
used to control nomadik pins, namely the "nmk_config_pin()" function
and its derivatives.

Signed-off-by: Jean-Nicolas Graux <jean-nicolas.graux@stericsson.com>
Reviewed-by: Philippe Langlais <philippe.langlais@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-10-10 08:36:59 +02:00
Linus Walleij 95f0bc9bf0 pinctrl/nomadik: use irq_find_mapping()
The code was using a homegrown method of looking up the offset
from the irq domain, not to be encouraged. Use the proper
irq_find_mapping() call instead.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-09-28 09:31:26 +02:00
Etienne Carriere 4921e7452c pinctrl/nomadik: MASK_ON_SUSPEND
ux500 machines performs pins (GPIO) reconfiguration when entering
in the suspended mode. This reconfiguration aims at reaching an ultra
low power HW configuration.

Due to this HW reconfiguration, some HW devices can change of HW state
and have their output signals at level that could generate IRQs.

If the non-wakeup IRQs are disabled but not yet masked (delayed interrupt
disable feature from the generic irq layer), effective interrupts reach
the system only because the system attempt to enter the suspended mode.

To prevent such IRQs to trig, all irq chips embedded in ux500 platform
should enable their IRQCHIP_MASK_ON_SUSPEND flag.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-09-03 13:21:37 +02:00
Linus Walleij f79c5ed9da pinctrl/nomadik: add STn8815 ASIC support
This adds support for the STN8815 ASIC for the Nomadik pin
controller.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-09-03 13:21:37 +02:00
Patrice Chotard 45a1b53195 pinctrl/nomadik: add ASIC DB8450 pinctrl driver
This implements a subdriver for the DB8540 ASIC for the
Nomadik pin controller.

Signed-off-by: Patrice Chotard <patrice.chotard@stericsson.com>
Reviewed-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-09-03 13:21:37 +02:00
Linus Walleij 2ee38d4de5 pinctrl/nomadik: fix null in irqdomain errorpath
The irqdomain conversion failed to notice that we do not always
have a DT node to dereference, fix this up by using a simple
dev_err() that also tells the name of the device.

Cc: Loic Pallardy <loic.pallardy@st.com>
Cc: Patrice Chotard <patrice.chotard@stericsson.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-08-17 11:09:58 +02:00
Julia Lawall 75c353ecac drivers/pinctrl/pinctrl-nomadik.c: drop devm_kfree of devm_kzalloc'd data
devm_kfree should not have to be explicitly used.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,d;
@@

x = devm_kzalloc(...)
...
?-devm_kfree(d,x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-08-07 14:34:12 +02:00
Linus Torvalds 914311c9fb Pin control changes for v3.6:
- Various cleanups to the U300 driver
 - Refactor the pin control core to automatically remove
   any GPIO ranges when the drivers are removed, instead of
   having the drivers do this explicitly.
 - Add a function for registering a batch of GPIO ranges.
 - Fix a number of incorrect but non-regressive error checks.
 - Incremental improvements to the COH901, i.MX and Nomadik drivers
 - Add a one-register-per-pin entirely Device Tree-based pin
   control driver from Tony Lindgren.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJQDUCxAAoJEEEQszewGV1z4EIQAMUREEJG+usUzX/2y9yMvtjn
 i3HQLV1UuPYiVyQfkrpwG7yEGYboZg4PoX4MjyTwiJt1Nq6QhHGjncYj8ngL7uSd
 B7EvulqH2lhLXdvW6s/nqBf5GfAqAhusLOi3FmyMbt4rnJ5bhFnbIdQ4h5MC7eFf
 jwQaDPJWcMPOisNJKAC+McVYpTO+VjivbfqMmQ/B9gmmtGSVoQf6YA3CvjJ0P8IT
 Or3xUr1VS6AnkS139qg473pYMKiSDzk9tQaN1k9V37jQvTeDv9ALOrLcJV+Bi002
 tfTtmOnPDQskgjz/NQvXuPMykZNT9E+XkjxAT1ClY6YVzrLogcYJxkFH5JQ80Lb5
 YMhgciRH92KSzQRsGJrJsH8HkAp3FubbC3rEt1MmkVV9ZPBgcUETGIR5tqcdyh8s
 5Hj4VASksTeExi7ajYEcDXDihYOB4l9ApDs+5XNhfPRGDY8sUjoxFLvpdzFXIfhn
 UZ5KJt16DoDkq0KVVIx1FHRdCcga+TtpARdi0kl2pzxDRrEti9x3F4nHFgaT4Eqb
 osnH17RlO+VGZYtg6635wcxEWr/wMzfzpVOi/0JO2wAm+R5A3VaIqsfvvm+ouRR0
 0Q++6NAVHySKTuab8Rz6D0dvTRF8O8zgJowdMDMX52C5nc5fhlKOl/Pc3g0W1q5C
 zmCaKOzT9RyPx2l+SrWz
 =79Wu
 -----END PGP SIGNATURE-----

Merge tag 'pinctrl-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control changes from Linus Walleij:
 "These are the accumulated pin control patches for v3.6:
   - Various cleanups to the U300 driver
   - Refactor the pin control core to automatically remove any GPIO
     ranges when the drivers are removed, instead of having the drivers
     do this explicitly.
   - Add a function for registering a batch of GPIO ranges.
   - Fix a number of incorrect but non-regressive error checks.
   - Incremental improvements to the COH901, i.MX and Nomadik drivers
   - Add a one-register-per-pin entirely Device Tree-based pin control
     driver from Tony Lindgren."

* tag 'pinctrl-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  pinctrl: Add one-register-per-pin type device tree based pinctrl driver
  pinctrl/nomadik: add spi2_oc1_2 pin group
  pinctrl/nomadik: kerneldoc fix
  pinctrl/nomadik: use devm_* allocators for gpio probe
  pinctrl/nomadik: add pin group to mco function
  pinctrl/nomadik: add hsit_a_2 pin group
  pinctrl/nomadik: add pin group smcs1 and smps0
  pinctrl/nomadik: fix hsir_a_1_pins pin list
  pinctrl: pinctrl-imx: fix map setting problem if NO_PAD_CTL is set
  pinctrl/coh901: use clk_prepare_[en|dis]able()
  pinctrl/pinctrl-tegra: remove IS_ERR checking of pmx->pctl
  pinctrl/pinctrl-spear: remove IS_ERR checking of pmx->pctl
  pinctrl/u300: drop unused variable
  pinctrl: select the proper symbol
  pinctrl: add pinctrl_add_gpio_ranges function
  pinctrl: remove pinctrl_remove_gpio_range
  pinctrl/pinctrl-core: cleanup pinctrl_register
  pinctrl/u300: delete pointless debug print
  pinctrl/pinctrl-u300: remove devm_kfree at driver unload
2012-07-24 14:05:46 -07:00
Lee Jones 612e1d5f1c pinctrl: pinctrl-nomadik: Append sleepmode property with vendor specific prefixes
Any non-standard property should contain the vendor's identifier which
should be perpended onto the property name followed by a comma. This
aids in name-space collision prevention. This patch ensures the
sleepmode property adheres to the rules.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2012-07-13 10:14:39 +02:00
Linus Walleij 50bcd47c31 pinctrl/nomadik: kerneldoc fix
Document a missing function parameter to nmk_config_pin().

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-07-04 11:25:36 +02:00
Linus Walleij 5e754f330d pinctrl/nomadik: use devm_* allocators for gpio probe
The GPIO portions of the Nomadik pinctrl driver was not using
the managed devm_* interfaces, lets' use them consequently and
cut down the error path and special case handling.

Acked-by: Patrice Chotard <patrice.chotard@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-07-04 11:05:05 +02:00
Linus Walleij daf731748f pinctrl/nomadik: document Alt-C glitch
This documentation comment existed in an earlier patch set for
GPIO consolidation, so I'm saving it for maintainability of the
code.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-06-17 19:44:44 +02:00
Linus Walleij e85bbc19d5 pinctrl: nomadik: fix up typo
Commit a60b57edda
"drivers/gpio: gpio-nomadik: Add support for irqdomains"
changed GPIO offset calculations to have this form:
(gpio % NMK_GPIO_PER_CHIP) except in this one place for
setting sleep mode, where the conversion was all wrong, and
instead mod:ing the GPIO with the IRQ base which does not
make any sense.

So fix this up so we can use sleepmode.

Reviewed-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
2012-06-12 13:35:24 +02:00
Linus Walleij efec381ced pinctrl: nomadik: add clk_prepare() call
We now strictly require clk_prepare() calls to be issued before
any clk_enable() calls.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-06-12 12:57:07 +02:00
Lee Jones 855f80cd16 pinctrl-nomadik: Allow Device Tree driver probing
The Nomadik GPIO controller now relies on Nomadik pinctrl, however
the pinctrl driver is not currently started by any ux500 platform.
This is requred or GPIOs do not work at all.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2012-06-01 02:03:25 +02:00
Linus Walleij d41af62763 pinctrl/nomadik: implement pin configuration
This implements the pin configuration interface for the
Nomadik pin controller.

As part of the exercise we add a bit in the pin_cfg_t for
the Nomadik pinctrl driver that indicates if the pin should
be forced into GPIO mode. This is not done to go behind the
back of the GPIO subsystem, but to ensure that default modes
can be set by hogs on boot and system suspend/resume states.
It was used implicitly by the old code defining all config
settings and modes in a single config word but we now have
a split between pinmux and pinconf leading to the need to
have this.

We also add a bit for explicitly setting sleepmode of the
pin. This was previously handled by custom calls with the
_sleep() suffix, but we now have one single interface into
the configuration so we replace this with a bit indicating
that the pin shall be configured into sleep mode.

Some of the configuration can be refactored later to use
less custom fields on the pin_cfg_t but we are currently
leaving the old function calls in place so we stay
compatible.

ChangeLog v1->v2:
- Drop a hunk changing pinmuxing for GPIO and move it
  over to the preceding pinmux patch.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-05-11 11:14:16 +02:00
Linus Walleij dbfe8ca259 pinctrl/nomadik: implement pin multiplexing
Implements basic pinmux for the Nomadik pin controller.

The plan is to split the existing singular pin config interface
nmk_config_pin(), nmk_config_pins(), that will configure muxing
and other settings at the same time, into two interfaces
by splitting the code in pinmux and pinctrl and eventually
deleting the old interface and its helper functions when all
users are gone.

nmk_gpio_set_mode() and nmk_gpio_get_mode() are two older
interfaces for just configuring muxing/altfunctions that
will also be replaced in the end.

We take some extra care to handle the glitch-avoidance here,
but it is simpler now since there is only one altsetting per
pingroup so we know immediately if we need to avoid altfunc
C glitches for a certain group.

As part of the makeover implement the .request() and .free()
calls on the GPIO chips and have them call back into the
pinctrl layer to reserve GPIOs.

ChangeLog v1->v2:
- Rebased on pinctrl-mergebase-20120418 so we get the latest
  driver infrastructure where function count is done by a fixed
  value and we can drop a few range checks since this is now
  handled by the core.
- Include a GPIO muxing hunk erroneously part of the pin config
  patch.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-05-11 11:14:16 +02:00
Linus Walleij 24cbdd75c4 pinctrl/nomadik: reuse GPIO debug function for pins
Since all pins we can control are GPIOs, match a GPIO range to
each pin in the debug function and call into the GPIO debug
print function to have the per-pin information.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-05-11 11:14:15 +02:00
Linus Walleij 6f4350a6da pinctrl/nomadik: break out single GPIO debug function
Break out the code displaying the status of a single pin so we
can use the same code in the pinctrl debug function.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-05-11 11:14:15 +02:00
Linus Walleij e98ea774c8 pinctrl/nomadik: basic Nomadik pinctrl interface
This adds a scratch pin control interface to the Nomadik pinctrl
driver, and defines the pins and groups in the DB8500 ASIC. We
define GPIO ranges to cover the pins exposed. The DB8500 has
more pins than this but we restrict the driver to the pins that
can be controlled from the combined GPIO and pin control hardware
to begin with.

ChangeLog v1->v2:
- Base on the latest pinctrl development from
  pinctrl-mergebase-20120418 so we can get rid of legacy
  group count mechanism. Also drop the range checks for group
  index, this is handled by the core now.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-05-11 11:14:14 +02:00
Arnd Bergmann 072e82a18f pinctrl/nomadik: !CONFIG_OF build error
a60b57e "drivers/gpio: gpio-nomadik: Add support for irqdomains" broke
building with CONFIG_OF_GPIO disabled.

Without this patch, building nhk8815_defconfig results in:

/home/arnd/linux-arm/drivers/gpio/gpio-nomadik.c: In function 'nmk_gpio_probe':
/home/arnd/linux-arm/drivers/gpio/gpio-nomadik.c:1238:6: error: 'struct gpio_chip' has no member named 'of_node'
make[3]: *** [drivers/gpio/gpio-nomadik.o] Error 1
make[2]: *** [drivers/gpio] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [drivers] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [sub-make] Error 2

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-05-11 10:33:59 +02:00
Linus Walleij 1ae4e59279 gpio: move the Nomadik GPIO driver to pinctrl
I'm moving this driver over to the pinctrl subsystem to convert
the custom pin mux/config scheme over to use pinctrl.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-05-11 10:33:43 +02:00