Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5153163 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm

* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (278 commits)
  arm: remove machine_desc.io_pg_offst and .phys_io
  arm: use addruart macro to establish debug mappings
  arm: return both physical and virtual addresses from addruart
  arm/debug: consolidate addruart macros for CONFIG_DEBUG_ICEDCC
  ARM: make struct machine_desc definition coherent with its comment
  eukrea_mbimxsd-baseboard: Pass the correct GPIO to gpio_free
  cpuimx27: fix compile when ULPI is selected
  mach-pcm037_eet: fix compile errors
  Fixing ethernet driver compilation error for i.MX31 ADS board
  cpuimx51: update board support
  mx5: add cpuimx51sd module and its baseboard
  iomux-mx51: fix GPIO_1_xx 's IOMUX configuration
  imx-esdhc: update devices registration
  mx51: add resources for SD/MMC on i.MX51
  iomux-mx51: fix SD1 and SD2's iomux configuration
  clock-mx51: rename CLOCK1 to CLOCK_CCGR for better readability
  clock-mx51: factorize clk_set_parent and clk_get_rate
  eukrea_mbimxsd: add support for DVI displays
  cpuimx25 & cpuimx35: fix OTG port registration in host mode
  i.MX31 and i.MX35 : fix errate TLSbo65953 and ENGcm09472
  ...
parents a8cbf225 6451d778
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@ Interrupts
	- ARM Interrupt subsystem documentation
IXP2000
	- Release Notes for Linux on Intel's IXP2000 Network Processor
msm
	- MSM specific documentation
Netwinder
	- Netwinder specific documentation
Porting
+176 −0
Original line number Diff line number Diff line
This document provides an overview of the msm_gpiomux interface, which
is used to provide gpio pin multiplexing and configuration on mach-msm
targets.

History
=======

The first-generation API for gpio configuration & multiplexing on msm
is the function gpio_tlmm_config().  This function has a few notable
shortcomings, which led to its deprecation and replacement by gpiomux:

The 'disable' parameter:  Setting the second parameter to
gpio_tlmm_config to GPIO_CFG_DISABLE tells the peripheral
processor in charge of the subsystem to perform a look-up into a
low-power table and apply the low-power/sleep setting for the pin.
As the msm family evolved this became problematic. Not all pins
have sleep settings, not all peripheral processors will accept requests
to apply said sleep settings, and not all msm targets have their gpio
subsystems managed by a peripheral processor. In order to get consistent
behavior on all targets, drivers are forced to ignore this parameter,
rendering it useless.

The 'direction' flag: for all mux-settings other than raw-gpio (0),
the output-enable bit of a gpio is hard-wired to a known
input (usually VDD or ground).  For those settings, the direction flag
is meaningless at best, and deceptive at worst.  In addition, using the
direction flag to change output-enable (OE) directly can cause trouble in
gpiolib, which has no visibility into gpio direction changes made
in this way.  Direction control in gpio mode should be made through gpiolib.

Key Features of gpiomux
=======================

- A consistent interface across all generations of msm.  Drivers can expect
the same results on every target.
- gpiomux plays nicely with gpiolib.  Functions that should belong to gpiolib
are left to gpiolib and not duplicated here.  gpiomux is written with the
intent that gpio_chips will call gpiomux reference-counting methods
from their request() and free() hooks, providing full integration.
- Tabular configuration.  Instead of having to call gpio_tlmm_config
hundreds of times, gpio configuration is placed in a single table.
- Per-gpio sleep.  Each gpio is individually reference counted, allowing only
those lines which are in use to be put in high-power states.
- 0 means 'do nothing': all flags are designed so that the default memset-zero
equates to a sensible default of 'no configuration', preventing users
from having to provide hundreds of 'no-op' configs for unused or
unwanted lines.

Usage
=====

To use gpiomux, provide configuration information for relevant gpio lines
in the msm_gpiomux_configs table.  Since a 0 equates to "unconfigured",
only those lines to be managed by gpiomux need to be specified.  Here
is a completely fictional example:

struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
	[12] = {
		.active = GPIOMUX_VALID | GPIOMUX_DRV_8MA | GPIOMUX_FUNC_1,
		.suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN,
	},
	[34] = {
		.suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN,
	},
};

To indicate that a gpio is in use, call msm_gpiomux_get() to increase
its reference count.  To decrease the reference count, call msm_gpiomux_put().

The effect of this configuration is as follows:

When the system boots, gpios 12 and 34 will be initialized with their
'suspended' configurations.  All other gpios, which were left unconfigured,
will not be touched.

When msm_gpiomux_get() is called on gpio 12 to raise its reference count
above 0, its active configuration will be applied.  Since no other gpio
line has a valid active configuration, msm_gpiomux_get() will have no
effect on any other line.

When msm_gpiomux_put() is called on gpio 12 or 34 to drop their reference
count to 0, their suspended configurations will be applied.
Since no other gpio line has a valid suspended configuration, no other
gpio line will be effected by msm_gpiomux_put().  Since gpio 34 has no valid
active configuration, this is effectively a no-op for gpio 34 as well,
with one small caveat, see the section "About Output-Enable Settings".

All of the GPIOMUX_VALID flags may seem like unnecessary overhead, but
they address some important issues.  As unused entries (all those
except 12 and 34) are zero-filled, gpiomux needs a way to distinguish
the used fields from the unused.  In addition, the all-zero pattern
is a valid configuration!  Therefore, gpiomux defines an additional bit
which is used to indicate when a field is used.  This has the pleasant
side-effect of allowing calls to msm_gpiomux_write to use '0' to indicate
that a value should not be changed:

  msm_gpiomux_write(0, GPIOMUX_VALID, 0);

replaces the active configuration of gpio 0 with an all-zero configuration,
but leaves the suspended configuration as it was.

Static Configurations
=====================

To install a static configuration, which is applied at boot and does
not change after that, install a configuration with a suspended component
but no active component, as in the previous example:

	[34] = {
		.suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN,
	},

The suspended setting is applied during boot, and the lack of any valid
active setting prevents any other setting from being applied at runtime.
If other subsystems attempting to access the line is a concern, one could
*really* anchor the configuration down by calling msm_gpiomux_get on the
line at initialization to move the line into active mode.  With the line
held, it will never be re-suspended, and with no valid active configuration,
no new configurations will be applied.

But then, if having other subsystems grabbing for the line is truly a concern,
it should be reserved with gpio_request instead, which carries an implicit
msm_gpiomux_get.

gpiomux and gpiolib
===================

It is expected that msm gpio_chips will call msm_gpiomux_get() and
msm_gpiomux_put() from their request and free hooks, like this fictional
example:

static int request(struct gpio_chip *chip, unsigned offset)
{
        return msm_gpiomux_get(chip->base + offset);
}

static void free(struct gpio_chip *chip, unsigned offset)
{
        msm_gpiomux_put(chip->base + offset);
}

	...somewhere in a gpio_chip declaration...
	.request = request,
	.free    = free,

This provides important functionality:
- It guarantees that a gpio line will have its 'active' config applied
  when the line is requested, and will not be suspended while the line
  remains requested; and
- It guarantees that gpio-direction settings from gpiolib behave sensibly.
  See "About Output-Enable Settings."

This mechanism allows for "auto-request" of gpiomux lines via gpiolib
when it is suitable.  Drivers wishing more exact control are, of course,
free to also use msm_gpiomux_set and msm_gpiomux_get.

About Output-Enable Settings
============================

Some msm targets do not have the ability to query the current gpio
configuration setting.  This means that changes made to the output-enable
(OE) bit by gpiolib cannot be consistently detected and preserved by gpiomux.
Therefore, when gpiomux applies a configuration setting, any direction
settings which may have been applied by gpiolib are lost and the default
input settings are re-applied.

For this reason, drivers should not assume that gpio direction settings
continue to hold if they free and then re-request a gpio.  This seems like
common sense - after all, anybody could have obtained the line in the
meantime - but it needs saying.

This also means that calls to msm_gpiomux_write will reset the OE bit,
which means that if the gpio line is held by a client of gpiolib and
msm_gpiomux_write is called, the direction setting has been lost and
gpiolib's internal state has been broken.
Release gpio lines before reconfiguring them.
+12 −0
Original line number Diff line number Diff line
@@ -990,11 +990,23 @@ S: Supported
F:	arch/arm/mach-shmobile/
F:	drivers/sh/

ARM/TELECHIPS ARM ARCHITECTURE
M:	"Hans J. Koch" <hjk@linutronix.de>
L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S:	Maintained
F:	arch/arm/plat-tcc/
F:	arch/arm/mach-tcc8k/

ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
M:	Lennert Buytenhek <kernel@wantstofly.org>
L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S:	Maintained

ARM/TETON BGA MACHINE SUPPORT
M:	Mark F. Brown <mark.brown314@gmail.com>
L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S:	Maintained

ARM/THECUS N2100 MACHINE SUPPORT
M:	Lennert Buytenhek <kernel@wantstofly.org>
L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+7 −0
Original line number Diff line number Diff line
@@ -554,8 +554,15 @@ endif
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS	+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
# Some targets (ARM with Thumb2, for example), can't be built with frame
# pointers.  For those, we don't have FUNCTION_TRACER automatically
# select FRAME_POINTER.  However, FUNCTION_TRACER adds -pg, and this is
# incompatible with -fomit-frame-pointer with current GCC, so we don't use
# -fomit-frame-pointer with FUNCTION_TRACER.
ifndef CONFIG_FUNCTION_TRACER
KBUILD_CFLAGS	+= -fomit-frame-pointer
endif
endif

ifdef CONFIG_DEBUG_INFO
KBUILD_CFLAGS	+= -g
+60 −16
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ config ARM
	select HAVE_KPROBES if (!XIP_KERNEL)
	select HAVE_KRETPROBES if (HAVE_KPROBES)
	select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
	select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
	select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
	select HAVE_GENERIC_DMA_COHERENT
	select HAVE_KERNEL_GZIP
	select HAVE_KERNEL_LZO
@@ -27,6 +29,7 @@ config ARM
	select HAVE_PERF_EVENTS
	select PERF_USE_VMALLOC
	select HAVE_REGS_AND_STACK_ACCESS_API
	select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V7))
	help
	  The ARM series is a line of low-power-consumption RISC chip designs
	  licensed by ARM Ltd and targeted at embedded applications and
@@ -146,6 +149,9 @@ config ARCH_HAS_CPUFREQ
	  and that the relevant menu configurations are displayed for
	  it.

config ARCH_HAS_CPU_IDLE_WAIT
       def_bool y

config GENERIC_HWEIGHT
	bool
	default y
@@ -511,6 +517,7 @@ config ARCH_MMP
	select GENERIC_CLOCKEVENTS
	select TICK_ONESHOT
	select PLAT_PXA
	select SPARSE_IRQ
	help
	  Support for Marvell's PXA168/PXA910(MMP) and MMP2 processor line.

@@ -588,6 +595,7 @@ config ARCH_PXA
	select GENERIC_CLOCKEVENTS
	select TICK_ONESHOT
	select PLAT_PXA
	select SPARSE_IRQ
	help
	  Support for Intel/Marvell's PXA2xx/PXA3xx processor line.

@@ -679,8 +687,8 @@ config ARCH_S3C64XX
	help
	  Samsung S3C64XX series based systems

config ARCH_S5P6440
	bool "Samsung S5P6440"
config ARCH_S5P64X0
	bool "Samsung S5P6440 S5P6450"
	select CPU_V6
	select GENERIC_GPIO
	select HAVE_CLK
@@ -689,7 +697,8 @@ config ARCH_S5P6440
	select HAVE_S3C2410_I2C
	select HAVE_S3C_RTC
	help
	  Samsung S5P6440 CPU based systems
	  Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440,
	  SMDK6450.

config ARCH_S5P6442
	bool "Samsung S5P6442"
@@ -748,6 +757,15 @@ config ARCH_SHARK
	  Support for the StrongARM based Digital DNARD machine, also known
	  as "Shark" (<http://www.shark-linux.de/shark.html>).

config ARCH_TCC_926
	bool "Telechips TCC ARM926-based systems"
	select CPU_ARM926T
	select HAVE_CLK
	select COMMON_CLKDEV
	select GENERIC_CLOCKEVENTS
	help
	  Support for Telechips TCC ARM926-based systems.

config ARCH_LH7A40X
	bool "Sharp LH7A40X"
	select CPU_ARM922T
@@ -916,6 +934,8 @@ source "arch/arm/plat-s5p/Kconfig"

source "arch/arm/plat-spear/Kconfig"

source "arch/arm/plat-tcc/Kconfig"

if ARCH_S3C2410
source "arch/arm/mach-s3c2400/Kconfig"
source "arch/arm/mach-s3c2410/Kconfig"
@@ -929,7 +949,7 @@ if ARCH_S3C64XX
source "arch/arm/mach-s3c64xx/Kconfig"
endif

source "arch/arm/mach-s5p6440/Kconfig"
source "arch/arm/mach-s5p64x0/Kconfig"

source "arch/arm/mach-s5p6442/Kconfig"

@@ -1003,7 +1023,7 @@ endif

config ARM_ERRATA_411920
	bool "ARM errata: Invalidation of the Instruction Cache operation can fail"
	depends on CPU_V6 && !SMP
	depends on CPU_V6
	help
	  Invalidation of the Instruction Cache operation can
	  fail. This erratum is present in 1136 (before r1p4), 1156 and 1176.
@@ -1182,13 +1202,13 @@ source "kernel/time/Kconfig"

config SMP
	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
		 ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
	depends on EXPERIMENTAL
	depends on GENERIC_CLOCKEVENTS
	depends on REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP || \
		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
		 ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4
	select USE_GENERIC_SMP_HELPERS
	select HAVE_ARM_SCU if ARCH_REALVIEW || ARCH_OMAP4 || ARCH_S5PV310 ||\
		 ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4
	select HAVE_ARM_SCU
	help
	  This enables support for systems with more than one CPU. If you have
	  a system with only one CPU, like most personal computers, say N. If
@@ -1206,6 +1226,19 @@ config SMP

	  If you don't know what to do here, say N.

config SMP_ON_UP
	bool "Allow booting SMP kernel on uniprocessor systems (EXPERIMENTAL)"
	depends on EXPERIMENTAL
	depends on SMP && !XIP && !THUMB2_KERNEL
	default y
	help
	  SMP kernels contain instructions which fail on non-SMP processors.
	  Enabling this option allows the kernel to modify itself to make
	  these instructions safe.  Disabling it allows about 1K of space
	  savings.

	  If you don't know what to do here, say Y.

config HAVE_ARM_SCU
	bool
	depends on SMP
@@ -1256,12 +1289,9 @@ config HOTPLUG_CPU

config LOCAL_TIMERS
	bool "Use local timer interrupts"
	depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || \
		REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
		ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
	depends on SMP
	default y
	select HAVE_ARM_TWD if ARCH_REALVIEW || ARCH_OMAP4 || ARCH_S5PV310 || \
		ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS
	select HAVE_ARM_TWD
	help
	  Enable support for local timers on SMP platforms, rather then the
	  legacy IPI broadcast method.  Local timers allows the system
@@ -1272,7 +1302,7 @@ source kernel/Kconfig.preempt

config HZ
	int
	default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P6440 || \
	default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P64X0 || \
		ARCH_S5P6442 || ARCH_S5PV210 || ARCH_S5PV310
	default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER
	default AT91_TIMER_HZ if ARCH_AT91
@@ -1478,6 +1508,20 @@ config UACCESS_WITH_MEMCPY
	  However, if the CPU data cache is using a write-allocate mode,
	  this option is unlikely to provide any performance gain.

config SECCOMP
	bool
	prompt "Enable seccomp to safely compute untrusted bytecode"
	---help---
	  This kernel feature is useful for number crunching applications
	  that may need to compute untrusted bytecode during their
	  execution. By using pipes or other transports made available to
	  the process as file descriptors supporting the read/write
	  syscalls, it's possible to isolate those applications in
	  their own address space using seccomp. Once seccomp is
	  enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
	  and the task is only allowed to execute a few safe syscalls
	  defined by each seccomp mode.

config CC_STACKPROTECTOR
	bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
	help
Loading