Laurent Pinchart [Wed, 13 Mar 2013 02:52:31 +0000 (03:52 +0100)]
ARM: shmobile: kota2: Register pinctrl mappings for SDHI and MMCIF
Replace the GPIO-based SDHI and MMCIF pinmux configuration by pinctrl
mappings.
Board code used the non-pulled-up version of the function GPIOs, but
those are defined in the PFC driver as enabling the pull-ups anyway.
Enable pull-ups on the MMCIF data and command pins through the pinconf
API.
Laurent Pinchart [Sun, 10 Mar 2013 15:44:02 +0000 (16:44 +0100)]
sh-pfc: Implement generic pinconf support
The existing PFC pinconf implementation, tied to the PFC-specific pin
types, isn't used by drivers or boards. Replace it with the generic
pinconf types to implement bias (pull-up/down) setup. Other pin
configuration options can be implemented later if needed.
Laurent Pinchart [Sun, 10 Mar 2013 14:29:14 +0000 (15:29 +0100)]
sh-pfc: Remove configuration dry-run and free
The purpose of the dry-run is to ensure that a pin about to be
configured isn't in use. However, the current implementation is a no-op.
This proves that the dry-run isn't essential. Remove it.
Freeing configuration then becomes a no-op as well. Remove it.
The sh_pfc_pin structure supplied in SoC data contains information about
pin configuration and name. It's abused to store GPIO data registers
information and pin config type. Move those fields out of the
pinmux_data_reg structure into the new sh_pfc_gpio_pin and
sh_pfc_pin_config structures.
Laurent Pinchart [Sat, 16 Feb 2013 17:34:32 +0000 (18:34 +0100)]
sh-pfc: Don't modify pinmux_data_reg SoC data
The pinmux_data_reg structure supplied in SoC data contains information
about data registers. It's abused to store per-device mapped iomem and
shadow values. Move those fields out of the pinmux_data_reg structure
into the per-device sh_pfc_chip structure.
Laurent Pinchart [Sat, 16 Feb 2013 23:26:33 +0000 (00:26 +0100)]
sh-pfc: Don't map data registers individually
All data registers are located in the same memory resource. Locate the
mapped resource at initializat time and use it directly instead of
computing a mapped address for each register. This gets rid of the
mapped_reg field of the pinmux_data_reg structure.
Laurent Pinchart [Fri, 15 Feb 2013 01:04:55 +0000 (02:04 +0100)]
sh-pfc: Move GPIO registers access functions to gpio.c
Move the sh_pfc_setup_data_regs(), sh_pfc_setup_data_reg(),
sh_pfc_get_data_reg(), sh_pfc_read_bit() and sh_pfc_write_bit()
function to gpio.c as they belong to the GPIO implementation. Inline
sh_pfc_read_bit() and sh_pfc_write_bit() in their only call location.
Wei Yongjun [Mon, 11 Mar 2013 14:08:12 +0000 (22:08 +0800)]
sh-pfc: Fix return value check in sh_pfc_register_pinctrl()
In case of error, the function pinctrl_register() returns NULL not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: shx3: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7786: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7785: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7757: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7724: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7723: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7722: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7720: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7269: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7264: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
Laurent Pinchart [Sat, 16 Feb 2013 18:23:58 +0000 (19:23 +0100)]
sh: sh7203: Add pin control resources
Add memory resources for the pin control platform device to let the
sh-pfc driver ioremap() registers properly instead of evily casting
register physical addresses to virtual addresses.
The memory resource address range has been extracted from the config and
data registes lists in the sh-pfc driver.
sh-pfc: Expose real groups and functions in pinctrl/pinmux operations
The sh-pfc driver exposes one fake group and function per GPIO pin. As
the pinctrl and pinmux APIs are not used by any SuperH and SH Mobile
board or driver, drop the fake groups and functions and replace them by
a real pinctrl and pinmux implementation.
Groups and functions must now be explicitly provided by PFC SoC-specific
data.
Laurent Pinchart [Sat, 16 Feb 2013 06:38:50 +0000 (07:38 +0100)]
ARM: shmobile: mackerel: Replace GPIO_PORTx enum with GPIO port numbers
The PFC GPIO API implementation moved to using port numbers. Replace all
GPIO_PORTx enum usage with the corresponding port number. The GPIO_PORTx
enum values are identical to the port number on this platform.
Laurent Pinchart [Sat, 16 Feb 2013 06:38:50 +0000 (07:38 +0100)]
ARM: shmobile: bonito: Replace GPIO_PORTx enum with GPIO port numbers
The PFC GPIO API implementation moved to using port numbers. Replace all
GPIO_PORTx enum usage with the corresponding port number. The GPIO_PORTx
enum values are identical to the port number on this platform.
Laurent Pinchart [Sat, 16 Feb 2013 06:38:50 +0000 (07:38 +0100)]
ARM: shmobile: armadillo: Replace GPIO_PORTx enum with GPIO port numbers
The PFC GPIO API implementation moved to using port numbers. Replace all
GPIO_PORTx enum usage with the corresponding port number. The GPIO_PORTx
enum values are identical to the port number on this platform.
Laurent Pinchart [Sat, 16 Feb 2013 06:38:50 +0000 (07:38 +0100)]
ARM: shmobile: ap4-evb: Replace GPIO_PORTx enum with GPIO port numbers
The PFC GPIO API implementation moved to using port numbers. Replace all
GPIO_PORTx enum usage with the corresponding port number. The GPIO_PORTx
enum values are identical to the port number on this platform.
Laurent Pinchart [Fri, 15 Feb 2013 00:33:38 +0000 (01:33 +0100)]
sh-pfc: Add support for sparse pin numbers
The PFC driver assumes that the value of the GPIO_PORTxxx enumeration
names are equal to the port number. This isn't true when the port number
space is sparse, as with the SH73A0.
Fix the issue by adding support for pin numbers ranges specified through
SoC data. When no range is specified the driver considers that the PFC
implements a single contiguous range for all pins.
Laurent Pinchart [Thu, 14 Feb 2013 16:36:56 +0000 (17:36 +0100)]
sh-pfc: Use pinmux identifiers in the pin muxing API
The PFC core exposes a sh_pfc_config_gpio() function that configures
pinmuxing for a given GPIO (either a real GPIO or a function GPIO).
Handling of real and function GPIOs belong to the GPIO layer, move the
GPIO number to mark translation to the caller and rename the function to
sh_pfc_config_mux().
Instead of converting the GPIO number to an enum_id and looking up IRQ
table entries by enum_id, replace the pinmux_irq enum_ids field with a
gpios field and lookup entries using the GPIO number.
Laurent Pinchart [Thu, 29 Nov 2012 12:03:53 +0000 (13:03 +0100)]
sh-pfc: Shrink the pinctrl GPIO range to include real GPIOs only
As a step towards GPIO function removal, shorten the GPIO range
registered with the pinctrl core. Function GPIOs are now handled in the
GPIO handlers directly instead of going through the pinctrl API.
Laurent Pinchart [Thu, 29 Nov 2012 01:23:26 +0000 (02:23 +0100)]
sh-pfc: Initialize pinmux_gpio flags statically
All function GPIO entries are initialized with the GPIO_FN macro that
expands to the PINMUX_GPIO macro, used to initialize real GPIOs. Create
a PINMUX_GPIO_FN macro that duplicates PINMUX_GPIO and sets flags to
PINMUX_TYPE_FUNCTION and use it in GPIO_FN, and make PINMUX_GPIO set
flags to PINMUX_TYPE_GPIO.
This removes the need to initialize GPIO flags at runtime and thus
simplifies the code, preparing for the GPIO and functions split.
Laurent Pinchart [Thu, 29 Nov 2012 11:24:51 +0000 (12:24 +0100)]
sh-pfc: Replace SoC info data and mark ranges with a number of pins
The data and mark ranges are only used to check whether a GPIO
corresponds to a real pin or a function. As pins come first in the list
of GPIOs and in the platform-specific GPIO enumerations, we can replace
the data and mark ranges by a number of pins.
Add an nr_pins field to struct sh_pfc_soc_info to store the number of
pins implemented by the SoC, remove the data and mark range fields and
introduce sh_pfc_gpio_is_pin() and sh_pfc_gpio_is_function() functions
to replace range-based checks.
Laurent Pinchart [Wed, 28 Nov 2012 16:51:00 +0000 (17:51 +0100)]
sh-pfc: Replace first_gpio and last_gpio with nr_gpios
The SoC information first_gpio field is always equal to 0, and the
last_gpio field is the index of the last entry in the pinmux_gpios
array. Replace the first_gpio and last_gpio fields by a nr_gpios field,
and initialize it to ARRAY_SIZE(pinmux_gpios).
Laurent Pinchart [Wed, 28 Nov 2012 19:56:48 +0000 (20:56 +0100)]
sh-pfc: Don't take the sh_pfc spinlock in sh_pfc_map_gpios()
The sh_pfc_map_gpios() function is only called at initialization time
when no other task can access the sh_pfc fields. Don't protect the
operation with a spinlock.