aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sh/pfc.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-07-10sh: pfc: Shuffle PFC support core.Paul Mundt1-578/+0
This follows the intc/clk changes and shuffles the PFC support code under its own directory. This will facilitate better code sharing, and allow us to trim down the exported interface by quite a margin. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-06-21sh: pfc: Verify pin type encoding size at build time.Paul Mundt1-0/+5
The encoding is tightly packed, and future changes (such as pinconf-generic support) can easily lead to a situation where we violate the encoding constraints and trample data bit/reg bits. This plugs in some sanity checks by way of a BUILD_BUG_ON() to blow up if we fail to fit. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-06-20sh: pfc: Split out gpio chip support.Paul Mundt1-271/+105
This implements a bit of rework for the PFC code, making the core itself slightly more pluggable and moving out the gpio chip handling completely. The API is preserved in such a way that platforms that depend on it for early configuration are still able to do so, while making it possible to migrate to alternate interfaces going forward. This is the first step of chainsawing necessary to support the pinctrl API, with the eventual goal being able to decouple pin function state from the gpio API while retaining gpio chip tie-in for gpio pin functions only, relying on the pinctrl/pinmux API for non-gpio function demux. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09sh: pfc: Unlock register supportMagnus Damm1-12/+10
Add PFC support for a 32-bit unlock register. Needed to drive the r8a7779 PFC that comes with a funky PMMR register. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09sh: pfc: Variable bitfield width config register supportMagnus Damm1-11/+33
Add support for variable config reg hardware by adding the macro PINMUX_CFG_REG_VAR(). The width of each bitfield needs to be passed to the macro, and the correct space must be consumed by each bitfield in the enum table following the macro. Data registers still need to have fixed bitfields. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09sh: pfc: Add config_reg_helper() functionMagnus Damm1-44/+32
Add a helper function for shared config reg access calculations. This allows us to reduce the amount of duplicated code, and at the same time prepare for a common place for future variable bitwidth config reg support. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09sh: pfc: Convert index to field and value pairMagnus Damm1-27/+18
Update the way the PFC code is passing bitfield selection between configure register functions. Convert the code from using index only to bitfield number and selected value. First step towards future variable bitfield width support. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09sh: pfc: Add gpio_read_bit() for data register accessMagnus Damm1-1/+14
Introduce gpio_read_bit() for data register read access and modify sh_gpio_get_value() to make use of the new function instead of gpio_read_reg(). The purpose of this change is to update the code to only use the gpio_read_reg() function for config register access. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-12-09sh: pfc: ioremap() supportMagnus Damm1-24/+113
Add support for non-entity mapped PFC registers through the use of struct resource and ioremap()/iounmap(). The PFC main data structure gets updated with a pointer to a struct resources array that point out all register windows used by the PFC instance. The register definitions are kept as physical addresses but the PFC code will do transparent conversion into virtual addresses whenever register windows are specified using with struct resource. To introduce as little performance penalty as possible the virtual address of each data register is cached in memory. The virtual address of each configuration register is however calculated during run time. This because the configuration is considered slow path so focus is instead put on keeping memory foot print as small as possible. The PFC register access code is in this patch updated from __raw_readN() / __raw_writeN() into ioreadN() / iowriteN(). This patch is needed to support the PFC block in r8a7779. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-10-28sh: pfc: Add GPIO IRQ supportMagnus Damm1-0/+27
Add GPIO IRQ support to the shared PFC code in drivers/sh/pfc.c The enums pointed out by a certain GPIO will be matched against a table for IRQ to enum mappings. Only the shared PFC code is updated by this patch. SoC specific changes are also needed to allow platforms to make use of this feature. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-10-28sh: pfc: get_config_reg() shift clean upMagnus Damm1-1/+1
Clean up the f_width shift code in get_config_reg(). Reported-by: Ryusuke Sakato <ryusuke.sakato.bx@renesas.com> Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-04sh: pfc: Fix up BUG() triggered by gpiolib debugfs lookups.Paul Mundt1-4/+2
The gpiolib debugfs entry takes a hammer approach and iterates over all of the potential GPIOs, regardless of their type. The SH PFC code on the other hand contains a variable mismash of input/output/function types spread out sparsely, leading to situations where the debug code can trigger an out of range enum for the type. Since we already have an error path for out of range enums, we can just hand that up to the higher level instead of the current BUG() behaviour. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-04sh: pfc: support pinmux deregistration.Paul Mundt1-1/+10
Presently the pinmux code is a one-way thing, but there's nothing preventing an unregistration if no one has grabbed any of the pins. This will permit us to save a bit of memory on systems that require pin demux for certain peripherals in the case where registration of those peripherals fails, or they are otherwise not attached to the system. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20sh: update PFC to allow any enum in MARK listsMagnus Damm1-5/+32
This patch updates the PFC code with some clarifying comments together with a functional change. The change allows function type of GPIO to select any type of enum in their MARK lists. Without this patch only function type of enums are allowed in MARK lists. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-12-09sh: pfc: Fixup type mismatch in debug printks.Paul Mundt1-1/+1
!!value works out to an int while we were still using %ld, so fix this up and shut gcc up. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-30sh: pfc: pr_info() -> pr_debug() cleanups.Paul Mundt1-16/+9
For some reason this was using pr_info() nested under an ifdef DEBUG. While this is appealing in that it circumvents the effort necessary to change ones loglevel, it's not terribly practical. So, convert it over to pr_debug(). Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-30sh: pfc: Convert from ctrl_xxx() to __raw_xxx() I/O routines.Paul Mundt1-9/+9
Now that the PFC code is exposed for other architectures, use the common __raw_xxx() routines instead of the ctrl_xxx() ones. This will be needed for ARM-based SH-Mobiles amongst others. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-30sh: Break out SuperH PFC codeMagnus Damm1-0/+584
This file breaks out the SuperH PFC code from arch/sh/kernel/gpio.c + arch/sh/include/asm/gpio.h to drivers/sh/pfc.c + include/linux/sh_pfc.h. Similar to the INTC stuff. The non-SuperH specific file location makes it possible to share the code between multiple architectures. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>