platform/adaptation/renesas_rcar/renesas_kernel.git
13 years agoMerge branches 'omap/prcm' and 'omap/mfd' of git+ssh://master.kernel.org/pub/scm...
Arnd Bergmann [Sun, 17 Jul 2011 19:48:22 +0000 (21:48 +0200)]
Merge branches 'omap/prcm' and 'omap/mfd' of git+ssh:///linux/kernel/git/arm/linux-arm-soc into next/devel-2

13 years agoMerge branches 'omap4_clockdomain_hwmod_3.1', 'clock_debugfs_a_3.1', 'omap4_clock_aux...
Paul Walmsley [Sun, 10 Jul 2011 12:04:55 +0000 (06:04 -0600)]
Merge branches 'omap4_clockdomain_hwmod_3.1', 'clock_debugfs_a_3.1', 'omap4_clock_auxclk_3.1' and 'omap_device_a_3.1' into prcm-devel-3.1

13 years agoOMAP: Add debugfs node to show the summary of all clocks
Jon Hunter [Sun, 10 Jul 2011 11:57:33 +0000 (05:57 -0600)]
OMAP: Add debugfs node to show the summary of all clocks

Add a debugfs node called "summary" to /sys/kernel/debug/clock/
that displays a quick summary of all clocks registered in the
"clocks" structure. The format of the output from this node is:

<clock-name> <parent-name> <rate> <usecount>

This debugfs node was very helpful for taking a quick snapshot of
the linux clock tree for OMAP and ensuring clock frequencies
calculated by the kernel were indeed correct. This patch helped
uncover some bugs in the linux clock tree for OMAP4.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: hwmod: Follow the recommended PRCM module enable sequence
Rajendra Nayak [Sun, 10 Jul 2011 11:57:07 +0000 (05:57 -0600)]
OMAP2+: hwmod: Follow the recommended PRCM module enable sequence

On OMAP4, the PRCM recommended sequence for enabling
a module after power-on-reset is:
-1- Force clkdm to SW_WKUP
-2- Enabling the clocks
-3- Configure desired module mode to "enable" or "auto"
-4- Wait for the desired module idle status to be FUNC
-5- Program clkdm in HW_AUTO(if supported)

This sequence applies to all older OMAPs' as well,
however since they use autodeps, it makes sure that
no clkdm is in IDLE, and hence not requiring a force
SW_WKUP when a module is being enabled.

OMAP4 does not need to support autodeps, because
of the dyanamic dependency feature, wherein
the HW takes care of waking up a clockdomain from
idle and hence the module, whenever an interconnect
access happens to the given module.

Implementing the sequence for OMAP4 requires
the clockdomain handling that is currently done in
clock framework to be done as part of hwmod framework
since the step -4- above to "Wait for the desired
module idle status to be FUNC" is done as part of
hwmod framework.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
[b-cousson@ti.com: Adapt it to the new clkdm hwmod attribute and API]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
[paul@pwsan.com: dropped mach-omap2/clock.c changes; modified to only
 call the clockdomain code if oh->clkdm is set; disable clock->clockdomain
 interaction on OMAP4]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: clock: allow per-SoC clock init code to prevent clockdomain calls from clock...
Paul Walmsley [Sun, 10 Jul 2011 11:57:06 +0000 (05:57 -0600)]
OMAP2+: clock: allow per-SoC clock init code to prevent clockdomain calls from clock code

The OMAP2/3 clock code was written to notify the clockdomain code when
the first clock in a clockdomain is enabled and when the last enabled
clock in a clockdomain is disabled.  OMAP4 requires a different
approach: the hwmod code needs to signal the clockdomain code when to
force-enable and auto-idle a clockdomain during the IP block enable
process.  The current conjecture is that once that hwmod sequence is
implemented, it will no longer be necessary for the clock code to call
into the clockdomain code for "optional clocks" on OMAP4.

Add a static flag to the OMAP2+ clock code, clkdm_control, that by
default preserves the OMAP2/3 behavior.  Also add a function,
omap2_clk_disable_clkdm_control(), intended to be called from OMAP4
and beyond clock initcalls, that disables the old behavior.

Part of this patch was originally based on a patch by Rajendra Nayak
<rnayak@ti.com>.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoît Cousson <b-cousson@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
13 years agoOMAP2+: clockdomain: Add per clkdm lock to prevent concurrent state programming
Rajendra Nayak [Sun, 10 Jul 2011 11:56:55 +0000 (05:56 -0600)]
OMAP2+: clockdomain: Add per clkdm lock to prevent concurrent state programming

Since the clkdm state programming is now done from within the hwmod
framework (which uses a per-hwmod lock) instead of the being done
from the clock framework (which used a global lock), there is now a
need to have per-clkdm locking to prevent races between different
hwmods/modules belonging to the same clock domain concurrently
programming the clkdm state.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: PM: idle clkdms only if already in idle
Rajendra Nayak [Sun, 10 Jul 2011 11:56:54 +0000 (05:56 -0600)]
OMAP2+: PM: idle clkdms only if already in idle

The omap_set_pwrdm_state function forces clockdomains
to idle, without checking the existing idle state
programmed, instead based solely on the HW capability
of the clockdomain to support idle.
This is wrong and the clockdomains should be idled
post a state_switch *only* if idle transitions on the
clockdomain were already enabled.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: clockdomain: add clkdm_in_hwsup()
Paul Walmsley [Sun, 10 Jul 2011 11:56:54 +0000 (05:56 -0600)]
OMAP2+: clockdomain: add clkdm_in_hwsup()

Add a new function, clkdm_in_hwsup(), that returns true if a clockdomain
is configured for hardware-supervised idle.  It does not actually read the
hardware; rather, it checks an internal flag in the struct clockdomain, which
is changed when the clockdomain is switched in and out of hardware-supervised
idle.  This should be safe, since all changes to the idle mode should
pass through the clockdomain code.

Based on a set of patches by Rajendra Nayak <rnayak@ti.com> which do
the same thing by checking the hardware bits.  This approach should be
faster and more compact.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Todd Poynor <toddpoynor@google.com>
Cc: Benoît Cousson <b-cousson@ti.com>
13 years agoOMAP2+: clockdomain: Add 2 APIs to control clockdomain from hwmod framework
Benoit Cousson [Sun, 10 Jul 2011 11:56:54 +0000 (05:56 -0600)]
OMAP2+: clockdomain: Add 2 APIs to control clockdomain from hwmod framework

Duplicate the existing API for clockdomain enable from clock to enable
a clock domain from hwmod framework.
This will be needed when the hwmod framework will move from the current
clock centric approach to the module based approach.

These APIs are returning 0 for the moment for OMAP2 and OMAP3 until
their hwmods are updated with the clksm attribute.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP: clockdomain: Remove redundant call to pwrdm_wait_transition()
Vaibhav Bedia [Sun, 10 Jul 2011 11:56:53 +0000 (05:56 -0600)]
OMAP: clockdomain: Remove redundant call to pwrdm_wait_transition()

The call to pwrdm_wait_transition() in clkdm_clk_enable()
is redundant since the function pwrdm_clkdm_state_switch()
which is called next also does the same thing.

Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod: Introduce the module control in hwmod control
Benoit Cousson [Sun, 10 Jul 2011 11:56:33 +0000 (05:56 -0600)]
OMAP4: hwmod: Introduce the module control in hwmod control

Take advantage of the explicit modulemode control to fix
the way parents clocks are managed.
A module must be disabled before any parents are disabled.
That programming model was not possible with the previous
implementation that was considering a modulemode as a leaf
clock node managed by the clock fmwk.
This was leading to bad crash upon disable when the parent
clock was gated before the module completed its transition
to idle.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: cm: Add two new APIs for modulemode control
Benoit Cousson [Sun, 10 Jul 2011 11:56:32 +0000 (05:56 -0600)]
OMAP4: cm: Add two new APIs for modulemode control

In OMAP4, a new programming model based on module control instead
of clock control was introduced.
Expose two APIs to allow the upper layer (omap_hwmod) to control
the module mode independently of the parent clocks management.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
[paul@pwsan.com: renamed 'omap4_cm_' fns to 'omap4_cminst_'; cleaned up
 kerneldoc]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Add modulemode entry in omap_hwmod structure
Benoit Cousson [Sun, 10 Jul 2011 11:56:32 +0000 (05:56 -0600)]
OMAP4: hwmod data: Add modulemode entry in omap_hwmod structure

Add a new field to provide the mode supported by the module.
The mode will control the way mandatory clocks are managed by the PRCM.

  0 : Module is temporarily disabled by SW. OCP access to module are stalled.
      Can be used to change timing parameter of GPMC module.
  1 : Module is managed automatically by HW according to clock domain
      transition. A clock domain sleep transition put module into idle.
      A wakeup domain transition put it back into function.
      If CLKTRCTRL=3, any OCP access to module is always granted.
      Module clocks may be gated according to the clock domain state.
  2 : Module is explicitly enabled. Interface clock (if not used for
      functions) may be gated according to the clock domain state.
      Functional clocks are guarantied to stay present. As long as
      in this configuration, power domain sleep transition cannot happen.

Some modules will have a modulemode initialized at 1 (HWCTRL) by default.
This is the case for interconnect and simple module like GPIO, WDT, MAILBOX.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Add PRM context register offset
Benoit Cousson [Sun, 10 Jul 2011 11:56:32 +0000 (05:56 -0600)]
OMAP4: hwmod data: Add PRM context register offset

Add a 'context_offs' entry in the prcm.omap4 structure to all
IPs when applicable.
The offset will be used to retrieve the per module context lost
information now available on OMAP4.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: prm: Remove deprecated functions
Benoit Cousson [Sun, 10 Jul 2011 11:56:31 +0000 (05:56 -0600)]
OMAP4: prm: Remove deprecated functions

The new prminst_xxx accessors based on partition and offset
is now used, so removed all the previous prcm_xxx accessors.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
[paul@pwsan.com: remove fn prototypes also]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: prm: Replace warm reset API with the offset based version
Benoit Cousson [Sun, 10 Jul 2011 11:56:31 +0000 (05:56 -0600)]
OMAP4: prm: Replace warm reset API with the offset based version

The warm reset function was still using the obsolete API.
Replace it by the new one and move the file to the proper c file.

Change the function names to stick to the file convention as
suggested by Paul Walmsley <paul@pwsan.com>:
prm_xxx -> prminst_xxx

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod: Replace RSTCTRL absolute address with offset macros
Benoit Cousson [Sun, 10 Jul 2011 11:56:31 +0000 (05:56 -0600)]
OMAP4: hwmod: Replace RSTCTRL absolute address with offset macros

The RSTCTRL register was accessed using an absolute address.
The usage of hardcoded macros to calculate virtual address from physical
one should be avoided as much as possible.
The usage of an offset will allow future improvement like migration from
the current architecture code toward a module driver.

Update prm_xxx accessors, move definition to the proper header file and
update copyrights.
Change the s16 register offset parameter to u16.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
[paul@pwsan.com: use '_prminst_' in function names that are part of the
 prminst44xx.c file]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP: hwmod: Wait the idle status to be disabled
Benoit Cousson [Sun, 10 Jul 2011 11:56:30 +0000 (05:56 -0600)]
OMAP: hwmod: Wait the idle status to be disabled

It is mandatory to wait for a module to be in disabled state before
potentially disabling source clock or re-asserting a reset.

omap_hwmod_idle and omap_hwmod_shutdown does not wait for
the module to be fully idle.

Add a cm_xxx accessor to wait the clkctrl idle status to be disabled.
Fix hwmod_[idle|shutdown] to use this API.

Based on Rajendra's initial patch.

Please note that most interconnects hwmod will return one timeout because
it is impossible for them to be in idle since the processor is accessing
the registers though the interconnect.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Todd Poynor <toddpoynor@google.com>
[paul@pwsan.com: move cpu_is_*() tests to the top of _wait_target_disable();
 incorporate some feedback from Todd]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod: Replace CLKCTRL absolute address with offset macros
Benoit Cousson [Sun, 10 Jul 2011 11:56:30 +0000 (05:56 -0600)]
OMAP4: hwmod: Replace CLKCTRL absolute address with offset macros

The CLKCTRL register was accessed using an absolute address.
The usage of hardcoded macros to calculate virtual address from physical
one should be avoided as much as possible.
The usage of a offset will allow future improvement like migration from
the current architecture code toward a module driver.

Update cm_xxx accessor, move definition to the proper header file and
update copyrights.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Todd Poynor <toddpoynor@google.com>
[paul@pwsan.com: renamed 'omap4_cm_' fns to 'omap4_cminst_'; removed empty
 fn prototype section from cm44xx.h; incorporated comments from Todd;
 documented some functions]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: hwmod: Init clkdm field at boot time
Benoit Cousson [Sun, 10 Jul 2011 11:56:30 +0000 (05:56 -0600)]
OMAP2+: hwmod: Init clkdm field at boot time

At boot time, lookup the clkdm_name to get the clkdm
structure pointer for further usage.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Add clock domain attribute
Benoit Cousson [Sun, 10 Jul 2011 11:56:29 +0000 (05:56 -0600)]
OMAP4: hwmod data: Add clock domain attribute

In OMAP PRCM terminology, the clock domain is defined as a group of IPs
that share some clocks and most of the time an interface clock.
Every IP does belong to a clockdomain.
For the moment the clock domain attribute is affected to a clock node.
The issue with that approach, is that a clock might or not belong to a
clock domain. Moreover during module transition, it is up to a module
to handle properly the clock domain state and not to a clock node.

Create a clkdm_name attribute to provide this information per hwmod.

Populate this attribute for every OMAP4 hwmod entries.

Future cleanup series with remove that information from the OMAP4 clock
when it is relevant.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
[paul@pwsan.com: fix the mpuss_clkdm name]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: clock data: Add missing divider selection for auxclks
Rajendra Nayak [Sun, 10 Jul 2011 11:56:14 +0000 (05:56 -0600)]
OMAP4: clock data: Add missing divider selection for auxclks

On OMAP4 the auxclk nodes (part of SCRM) support both
divider as well as parent selection.
Supporting this requires splitting the existing nodes
(which support only parent selection) into two nodes,
one for parent and another for divider selection.
The nodes for parent selection are named auxclk*_src_ck
and the ones for divider selection as auxclk*_ck.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
[b-cousson@ti.com: Rebase on top of clock cleanup
and autogen alignement]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP: omap_device: Create clkdev entry for hwmod main_clk
Benoit Cousson [Sun, 10 Jul 2011 11:54:12 +0000 (05:54 -0600)]
OMAP: omap_device: Create clkdev entry for hwmod main_clk

Extend the existing function to create clkdev for every optional
clocks to add a well one "fck" alias for the main_clk of the
omap_hwmod.
It will allow to remove these static clkdev entries from the
clockXXX_data.c file.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Todd Poynor <toddpoynor@google.com>
[paul@pwsan.com: remove all of the "fck" role clkdev aliases from the
 clock data files; fixed error message]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoMerge branches 'powerdomain_fixes_3.1', 'hardware_workarounds_3.1', 'hwmod_dss_fix_3...
Paul Walmsley [Sun, 10 Jul 2011 11:44:23 +0000 (05:44 -0600)]
Merge branches 'powerdomain_fixes_3.1', 'hardware_workarounds_3.1', 'hwmod_dss_fix_3.1' and 'i2c_fixes_3.1' into prcm-fixes-3.1

13 years agoOMAP: hwmod: fix the i2c-reset timeout during bootup
Avinash.H.M [Sun, 10 Jul 2011 11:27:16 +0000 (05:27 -0600)]
OMAP: hwmod: fix the i2c-reset timeout during bootup

The sequence of _ocp_softreset doesn't work for i2c. The i2c module has a
special sequence to reset the module. The sequence is
 - Disable the I2C.
 - Write to SOFTRESET bit.
 - Enable the I2C.
 - Poll on the RESETDONE bit.
The sequence is implemented as a function and the i2c_class is updated with
the correct 'reset' pointer.  omap_hwmod_softreset function is implemented
which triggers the softreset by writing into sysconfig register. On following
this sequence, i2c module resets properly and timeouts are not seen.

Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Signed-off-by: Avinash.H.M <avinashhm@ti.com>
[paul@pwsan.com: combined this patch with a patch to remove
 HWMOD_INIT_NO_RESET from the 44xx hwmod flags; change register
 offset conditional code to use the IP block revision; minor code
 cleanup]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoI2C: OMAP2+: add correct functionality flags to all omap2plus i2c dev_attr
Andy Green [Sun, 10 Jul 2011 11:27:16 +0000 (05:27 -0600)]
I2C: OMAP2+: add correct functionality flags to all omap2plus i2c dev_attr

This adds the new functionality flags for omap i2c unit to all OMAP2
hwmod definitions

Cc: patches@linaro.org
Cc: Ben Dooks <ben-linux@fluff.org>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoI2C: OMAP2+: Tag all OMAP2+ hwmod defintions with I2C IP revision
Andy Green [Sun, 10 Jul 2011 11:27:15 +0000 (05:27 -0600)]
I2C: OMAP2+: Tag all OMAP2+ hwmod defintions with I2C IP revision

Since we cannot trust (or even reliably find) the OMAP I2C
peripheral unit's own revision register, we must inform the
OMAP i2c driver of which IP version it is running on.  We
do this by tagging the omap_hwmod_class for i2c on all the
OMAP2+ platform / cpu specific hwmod init and passing it up
to the driver (next patches).

Cc: patches@linaro.org
Cc: Ben Dooks <ben-linux@fluff.org>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoI2C: OMAP1/OMAP2+: create omap I2C functionality flags for each cpu_... test
Andy Green [Sun, 10 Jul 2011 11:27:15 +0000 (05:27 -0600)]
I2C: OMAP1/OMAP2+: create omap I2C functionality flags for each cpu_... test

These represent the 8 kinds of implementation functionality
that up until now were inferred by the 16 remaining cpu_...()
tests in the omap i2c driver.

Changed to use BIT() as suggested by Balaji T Krishnamoorthy.

Cc: patches@linaro.org
Cc: Ben Dooks <ben-linux@fluff.org>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoI2C: OMAP2+: Introduce I2C IP versioning constants
Andy Green [Sun, 10 Jul 2011 11:27:14 +0000 (05:27 -0600)]
I2C: OMAP2+:  Introduce I2C IP versioning constants

These represent the two kinds of (incompatible) OMAP I2C
peripheral unit in use so far.

The constants are in linux/i2c-omap.h so the omap i2c driver can have
them too.

Cc: patches@linaro.org
Cc: Ben Dooks <ben-linux@fluff.org>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoI2C: OMAP2+: increase omap_i2c_dev_attr flags from u8 to u32
Andy Green [Sun, 10 Jul 2011 11:27:14 +0000 (05:27 -0600)]
I2C: OMAP2+: increase omap_i2c_dev_attr flags from u8 to u32

As part of removing cpu_...() from the OMAP I2C driver, we need to
convert the CPU tests into functionality flags that are set by
hwmod class in the same way the IP revision is.

More flags are needed than will fit in the existing u8 flags
member of omap_i2c_dev_attr.

These flags can refer to options inside the IP block but they are
most needed for information about cpu implementation specific
options that are not part of the IP block itself.  For example,
how the CPU data bus is wired to the IP block databus differs
between OMAP cpus and affects how you must shift the address in
the IP block, but is not a feature of the IP block itself.

Cc: patches@linaro.org
Cc: Ben Dooks <ben-linux@fluff.org>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoI2C: OMAP2+: Set hwmod flags to only allow 16-bit accesses to i2c
Andy Green [Sun, 10 Jul 2011 11:27:14 +0000 (05:27 -0600)]
I2C: OMAP2+: Set hwmod flags to only allow 16-bit accesses to i2c

Peter Maydell noticed when running under QEMU he was getting
errors reporting 32-bit access to I2C peripheral unit registers
that are documented to be 8 or 16-bit only[1][2]

The I2C driver is blameless as it wraps its accesses in a
function using __raw_writew and __raw_readw, it turned out it
is the hwmod stuff.

However the hwmod code already has a flag to force a
perhipheral unit to only be accessed using 16-bit operations.

This patch applies the 16-bit only flag to the 2430,
OMAP3xxx and OMAP44xx hwmod structs.  2420 was already
correctly marked up as 16-bit.

The 2430 change will need testing by TI as arranged
in the comments to the previous patch version.

When the 16-bit flag is or-ed with other flags, it is placed
first as requested in comments.

[1] OMAP4430 Technical reference manual section 23.1.6.2
[2] OMAP3530 Techincal reference manual section 18.6

Cc: patches@linaro.org
Cc: Ben Dooks <ben-linux@fluff.org>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Change DSS main_clk scheme
Tomi Valkeinen [Sun, 10 Jul 2011 02:39:45 +0000 (20:39 -0600)]
OMAP4: hwmod data: Change DSS main_clk scheme

Currently using pm_runtime with DSS requires the DSS driver to enable
the DSS functional clock before calling pm_runtime_get(). That makes it
impossible to use pm_runtime in DSS as it is meant to be used, with
pm_runtime callbacks.

This patch changes the hwmod database for OMAP4 so that enabling the
hwmod via pm_runtime will also enable the DSS functional clock, allowing
us to use pm_runtime properly in DSS driver.

The DSS HWMOD side is not really correct, not before nor after this
patch, and getting DSS to retention will probably not work currently.
However, it is not supported in the mainline kernel anyway, so this
won't break anything.

So this patch allows us to write the pm_runtime adaptation for the DSS
driver the way it should be done, and the HWMOD/PM side can be fixed
later.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: powerdomain data: Remove unsupported MPU powerdomain state
Santosh Shilimkar [Sun, 10 Jul 2011 02:42:59 +0000 (20:42 -0600)]
OMAP4: powerdomain data: Remove unsupported MPU powerdomain state

On OMAP4430 devices, because of boot ROM code bug, MPU OFF state can't
be attempted independently. When coming out of MPU OFF state, ROM code
disables the clocks of IVAHD, TESLA which is not desirable. Hence the
MPU OFF state is not usable on OMAP4430 devices.

OMAP4460 onwards, MPU OFF state will be descoped completely because
the DDR firewall falls in MPU power domain. When the MPU hit OFF state,
DDR won't be accessible for other initiators. The deepest state supported
is open switch retention (OSWR) just like CORE and PER PD on OMAP4430.

So in summary MPU power domain OFF state is not supported on OMAP4
and onwards designs. Thanks to new PRCM design, device off mode can
still be achieved with power domains hitting OSWR state.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
[b-cousson@ti.com: Fix changelog typos]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: clock data: Keep GPMC clocks always enabled and hardware managed
Santosh Shilimkar [Sun, 10 Jul 2011 02:42:59 +0000 (20:42 -0600)]
OMAP4: clock data: Keep GPMC clocks always enabled and hardware managed

On OMAP4, CPU accesses on unmapped addresses are redirected to GPMC by
L3 interconnect. Because of CPU speculative nature, such accesses are
possible which can lead to indirect access to GPMC and if it's clock is
not running, it can result in hang/abort on the platform.

Above makes access to GPMC unpredictable during the execution, so it's
module mode needs to be kept under hardware control instead of software
control.
Since the auto gating is supported for GPMC, there isn't any power impact
because of this change.

The issue was un-covered with security middleware running along with HLOS.
In this case GPMC had a valid MMU descriptor on secure side where as HLOS
didn't map the GMPC because it isn't being used.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
[b-cousson@ti.com: Update subject and fix typos in the changelog]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: powerdomain data: Fix core mem states and missing cefuse flag
Benoit Cousson [Sun, 10 Jul 2011 02:42:11 +0000 (20:42 -0600)]
OMAP4: powerdomain data: Fix core mem states and missing cefuse flag

Since ES2.0, the core ocmram does not support a different state
than the main power domain anymore during both ON and RET power
domain state.
Since PM is not supported at all in ES1.0, update the common
structure.

LOWPOWERSTATECHANGE is supported by the cefuse power domain but
the flag was missing.
Add the PWRDM_HAS_LOWPOWERSTATECHANGE in flags field.

Update the TI copyright date to 2011.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
[paul@pwsan.com: moved the indentation changes to a different patch set]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: PM: Initialise sleep_switch to a non-valid value
Rajendra Nayak [Sun, 10 Jul 2011 02:42:11 +0000 (20:42 -0600)]
OMAP2+: PM: Initialise sleep_switch to a non-valid value

sleep_switch which is initialised to 0 in omap_set_pwrdm_state
happens to be a valid sleep_switch type (FORCEWAKEUP_SWITCH)
which are defined as:

 #define FORCEWAKEUP_SWITCH      0
 #define LOWPOWERSTATE_SWITCH    1

This causes the function to wrongly program some clock domains
even when the Powerdomain is in ON state.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Modify DSS opt clocks
Tomi Valkeinen [Sun, 10 Jul 2011 02:39:44 +0000 (20:39 -0600)]
OMAP4: hwmod data: Modify DSS opt clocks

Add missing DSS optional clocks to HWMOD data for OMAP4xxx.

Add HWMOD_CONTROL_OPT_CLKS_IN_RESET flag for dispc to fix dispc reset.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[b-cousson@ti.com: Remove a comment and update the subject]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
[paul@pwsan.com: removed DSS "fck" role and some clkdev aliases at Tomi's
 request]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoMerge branches 'dmtimer_precleanup_3.1', 'hwmod_core_cleanup_a_3.1', 'combine_common_...
Paul Walmsley [Sun, 10 Jul 2011 02:24:07 +0000 (20:24 -0600)]
Merge branches 'dmtimer_precleanup_3.1', 'hwmod_core_cleanup_a_3.1', 'combine_common_hwmod_3.1', 'omap4_hwmod_data_cleanup_a_3.1', 'clock_cleanup_a_3.1', 'prcm_cleanup_a_3.1', 'omap_pm_cleanup_3.1' and 'omap_device_cleanup_3.1' into prcm-cleanup-3.1

13 years agoOMAP4: clock data: Remove UNIPRO clock nodes
Jon Hunter [Sun, 10 Jul 2011 01:14:47 +0000 (19:14 -0600)]
OMAP4: clock data: Remove UNIPRO clock nodes

UNIPRO was removed from OMAP4 devices from ES2.0 onwards.
Since this IP was anyway non-functional and not supported,
it is best to remove it completely.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
[b-cousson@ti.com: Update the changelog]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
[paul@pwsan.com: split PRCM header file changes into a separate patch]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: clock data: Remove McASP2, McASP3 and MMC6 clocks
Jon Hunter [Sun, 10 Jul 2011 01:14:47 +0000 (19:14 -0600)]
OMAP4: clock data: Remove McASP2, McASP3 and MMC6 clocks

McASP2, 3 and MMC6 modules are not present in the OMAP4 family.
Remove the fclk and the clksel related to these nodes.
Rename the references that were potentially re-used in order nodes.

Remove related macros in prcm header files.

Update TI copyright date.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
[b-cousson@ti.com: Update the patch according to autogen output]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
[paul@pwsan.com: split PRCM data changes into a separate patch]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP PM: remove OMAP_PM_NONE config option
Jean Pihet [Sun, 10 Jul 2011 01:15:41 +0000 (19:15 -0600)]
OMAP PM: remove OMAP_PM_NONE config option

The current code base is not linking with the OMAP_PM_NONE
option set.
Since the option OMAP_PM_NOOP provides a no-op/debug layer,
OMAP_PM_NONE can be removed.
OMAP_PM_NOOP is enabled by default by Kconfig.

Signed-off-by: Jean Pihet <j-pihet@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP: omap_device: replace _find_by_pdev() with to_omap_device()
Kevin Hilman [Sun, 10 Jul 2011 01:15:20 +0000 (19:15 -0600)]
OMAP: omap_device: replace _find_by_pdev() with to_omap_device()

The omap_device layer currently has two ways of getting an omap_device
pointer from a platform_device pointer.

Replace current usage of _find_by_pdev() with to_omap_device() since
to_omap_device() is more familiar to the existing to_platform_device()
used when getting a platform_device pointer from a struct device pointer.

Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: clockdomain data: Fix data order and wrong name
Benoit Cousson [Sun, 10 Jul 2011 01:15:06 +0000 (19:15 -0600)]
OMAP4: clockdomain data: Fix data order and wrong name

MPUSS was renamed MPU and L3_D2D D2D.
The rename will slightly change the order of the structure
and thus generate some structures moves.

Add a comment and remove a comma.

Update Copyright for TI and Nokia and add back Paul
in the author list.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: prcm_mpu: Fix indent in few macros
Benoit Cousson [Sun, 10 Jul 2011 01:15:06 +0000 (19:15 -0600)]
OMAP4: prcm_mpu: Fix indent in few macros

Some maros were not well aligned. Re-align them.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: cm: Remove RESTORE macros to avoid access from SW
Benoit Cousson [Sun, 10 Jul 2011 01:15:05 +0000 (19:15 -0600)]
OMAP4: cm: Remove RESTORE macros to avoid access from SW

The restore part of the CM is an alias of some regular registers
used only during the SAR restore to facilate the dma to write
a contiguous set of registers.
The registers should never be used by the SW, only the original
register have to be used.

Remove them from cmX_44xx.h files to avoid anybody to use them by
mistake.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: powerdomain data: Fix indentation
Benoit Cousson [Sun, 10 Jul 2011 01:15:05 +0000 (19:15 -0600)]
OMAP4: powerdomain data: Fix indentation

Indent flags to be aligned with other fields.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
[paul@pwsan.com: split this patch from an earlier patch by Benoît;
 edited commit message]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: prm: Remove wrong clockdomain offsets
Benoit Cousson [Sun, 10 Jul 2011 01:15:04 +0000 (19:15 -0600)]
OMAP4: prm: Remove wrong clockdomain offsets

The following commit introduced new macros to define an offset
per clock domain in an instance.

commit e4156ee52fe617c2c2d80b5db993ff4bf07d7c3c

    OMAP4: CM instances: add clockdomain register offsets

The PRM contains only two clock controls management entities:
EMU and WKUP.
Remove the other ones.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: prcm: Fix errors in few defines name
Benoit Cousson [Sun, 10 Jul 2011 01:15:04 +0000 (19:15 -0600)]
OMAP4: prcm: Fix errors in few defines name

A couple of macros were wrongly changed during the _MOD to _INST
rename done in the following commit:

  OMAP4: PRCM: rename _MOD macros to _INST
  cdb54c4457d68994da7c2e16907adfbfc130060d

Fix them to their original name.

Some CM and PRM instances were not well aligned. Align them.

Remove one blank line in cm2_44xx.h to align the output with
the other (cm1_44xx.h, prm44xx.h) files.

Update header copyright date.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: clock data: Fix max mult and div for USB DPLL
Benoit Cousson [Sun, 10 Jul 2011 01:14:46 +0000 (19:14 -0600)]
OMAP4: clock data: Fix max mult and div for USB DPLL

The DPLL USB can generate higher speed (x2) than the regular ones.
The max multiplication value is then twice the previous value.

Fix both max_mult and max_div with that correct values.

Change the max_div variable type to u16 to allow storing up to 256.

Replace as well the define with the value to avoid
unneeded indirection and provide a better readability.

Remove the defines that become useless.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: clock data: Re-order some clock nodes and structure fields
Benoit Cousson [Sun, 10 Jul 2011 01:14:45 +0000 (19:14 -0600)]
OMAP4: clock data: Re-order some clock nodes and structure fields

A couple of fieds were edited manually and thus do not stick
to the template used by the generator and by other structures.

Move them to the correct location.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
[paul@pwsan.com: dropped the UNIPRO changes since those will be removed
 in a later patch]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: clock data: Remove usb_host_fs clkdev with NULL dev
Benoit Cousson [Sun, 10 Jul 2011 01:14:45 +0000 (19:14 -0600)]
OMAP4: clock data: Remove usb_host_fs clkdev with NULL dev

usb_host_fs_fck does have a clkdev mapping with "usbhs-omap.0"
and "fs_fck" alias used by the driver.
The entry with NULL dev is thus not needed anymore.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: clock data: Add sddiv to USB DPLL
Benoit Cousson [Sun, 10 Jul 2011 01:14:45 +0000 (19:14 -0600)]
OMAP4: clock data: Add sddiv to USB DPLL

The USB DPLL is a J-Type DPLL with the sddiv extra parameter.  Add it
in USB DPLL.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
[paul@pwsan.com: dropped UNIPRO change since it is removed in a later patch]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Align interconnect format with regular modules
Benoit Cousson [Sun, 10 Jul 2011 01:14:28 +0000 (19:14 -0600)]
OMAP4: hwmod data: Align interconnect format with regular modules

The interconnect modules were using a slightly different layout than
the regular modules.
Align the layout for better consitency.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Fix bad alignement
Benoit Cousson [Sun, 10 Jul 2011 01:14:28 +0000 (19:14 -0600)]
OMAP4: hwmod data: Fix bad alignement

Fix .prcm alignement and usb_otg_hs class and hwmod structures.

Add a couple of more potential hwmods in the comment.
Remove hsi, since it is already included in the data.

Remove one blank line.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Remove un-needed parens
Benoit Cousson [Sun, 10 Jul 2011 01:14:28 +0000 (19:14 -0600)]
OMAP4: hwmod data: Remove un-needed parens

A couple of parens were added around some flags.

Remove them, since they are not needed and not used
for any other hwmods.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Fix L3 interconnect data order and alignement
Benoit Cousson [Sun, 10 Jul 2011 01:14:27 +0000 (19:14 -0600)]
OMAP4: hwmod data: Fix L3 interconnect data order and alignement

Change the position of the ocp_if structure to match the template.

Remove unneeded comma at the end of address space flag field.

Remove USER_SDMA since this ocp link is only from the l3_main_1
path that is accessible only from the MPU in that case and not
the SDMA.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoomap_hwmod: share identical omap_hwmod_class, omap_hwmod_class_sysconfig arrays
Paul Walmsley [Sun, 10 Jul 2011 01:14:08 +0000 (19:14 -0600)]
omap_hwmod: share identical omap_hwmod_class, omap_hwmod_class_sysconfig arrays

To reduce kernel source file data duplication, share struct
omap_hwmod_class and omap_hwmod_class_sysconfig arrays across OMAP2xxx
and 3xxx hwmod data files.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoomap_hwmod: share identical omap_hwmod_dma_info arrays
Paul Walmsley [Sun, 10 Jul 2011 01:14:07 +0000 (19:14 -0600)]
omap_hwmod: share identical omap_hwmod_dma_info arrays

To reduce kernel source file data duplication, share struct
omap_hwmod_dma_info arrays across OMAP2xxx and 3xxx hwmod data files.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoomap_hwmod: use a terminator record with omap_hwmod_dma_info arrays
Paul Walmsley [Sun, 10 Jul 2011 01:14:07 +0000 (19:14 -0600)]
omap_hwmod: use a terminator record with omap_hwmod_dma_info arrays

Previously, struct omap_hwmod_dma_info arrays were unterminated; and
users of these arrays used the ARRAY_SIZE() macro to determine the
length of the array.  However, ARRAY_SIZE() only works when the array
is in the same scope as the macro user.

So far this hasn't been a problem.  However, to reduce duplicated
data, a subsequent patch will move common data to a separate, shared
file.  When this is done, ARRAY_SIZE() will no longer be usable.

This patch removes ARRAY_SIZE() usage for struct omap_hwmod_dma_info
arrays and uses a sentinel value (irq == -1) as the array terminator
instead.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoomap_hwmod: share identical omap_hwmod_mpu_irqs arrays
Paul Walmsley [Sun, 10 Jul 2011 01:14:07 +0000 (19:14 -0600)]
omap_hwmod: share identical omap_hwmod_mpu_irqs arrays

To reduce kernel source file data duplication, share struct
omap_hwmod_mpu_irqs arrays across OMAP2xxx and 3xxx hwmod data files.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoomap_hwmod: use a terminator record with omap_hwmod_mpu_irqs arrays
Paul Walmsley [Sun, 10 Jul 2011 01:14:06 +0000 (19:14 -0600)]
omap_hwmod: use a terminator record with omap_hwmod_mpu_irqs arrays

Previously, struct omap_hwmod_mpu_irqs arrays were unterminated; and
users of these arrays used the ARRAY_SIZE() macro to determine the
length of the array.  However, ARRAY_SIZE() only works when the array
is in the same scope as the macro user.

So far this hasn't been a problem.  However, to reduce duplicated
data, a subsequent patch will move common data to a separate, shared
file.  When this is done, ARRAY_SIZE() will no longer be usable.

This patch removes ARRAY_SIZE() usage for struct omap_hwmod_mpu_irqs
arrays and uses a sentinel value (irq == -1) as the array terminator
instead.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoomap_hwmod: share identical omap_hwmod_addr_space arrays
Paul Walmsley [Sun, 10 Jul 2011 01:14:06 +0000 (19:14 -0600)]
omap_hwmod: share identical omap_hwmod_addr_space arrays

To reduce kernel source file data duplication, share struct
omap_hwmod_addr_space arrays across OMAP2xxx and 3xxx hwmod data
files.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoomap_hwmod: use a null structure record to terminate omap_hwmod_addr_space arrays
Paul Walmsley [Sun, 10 Jul 2011 01:14:05 +0000 (19:14 -0600)]
omap_hwmod: use a null structure record to terminate omap_hwmod_addr_space arrays

Previously, struct omap_hwmod_addr_space arrays were unterminated; and
users of these arrays used the ARRAY_SIZE() macro to determine the
length of the array.  However, ARRAY_SIZE() only works when the array
is in the same scope as the macro user.

So far this hasn't been a problem.  However, to reduce duplicated
data, a subsequent patch will move common data to a separate, shared
file.  When this is done, ARRAY_SIZE() will no longer be usable.

This patch removes ARRAY_SIZE() usage for struct omap_hwmod_addr_space
arrays and uses a null structure member as the array terminator
instead.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP: hwmod: Move pr_debug to improve the readability
Benoit Cousson [Fri, 1 Jul 2011 20:54:07 +0000 (22:54 +0200)]
OMAP: hwmod: Move pr_debug to improve the readability

Move the pr_debug at the top of the function
to trace the entry even if the first test is failing.
That help understanding that we entered the function
but failed in it.

Move the _enable last part out of the test to reduce
indentation and improve readability.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP: hwmod: Add warnings if enable failed
Benoit Cousson [Fri, 1 Jul 2011 20:54:06 +0000 (22:54 +0200)]
OMAP: hwmod: Add warnings if enable failed

Change the debug into warning to check what IPs are failing.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: hwmod: Fix the HW reset management
Benoit Cousson [Fri, 1 Jul 2011 20:54:05 +0000 (22:54 +0200)]
OMAP2+: hwmod: Fix the HW reset management

The HW reset must be de-assert after the clocks are enabled
but before waiting for the target to be ready. Otherwise the
reset might not work properly since the clock is not running
to proceed the reset.

De-assert the reset after _enable_clocks and before
_wait_target_ready.
Re-assert it only when the clocks are disabled.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: hwmod: Remove _populate_mpu_rt_base warning
Benoit Cousson [Fri, 1 Jul 2011 20:54:04 +0000 (22:54 +0200)]
OMAP2+: hwmod: Remove _populate_mpu_rt_base warning

It is perfectly valid for some hwmod to not have any
register target address for sysconfig. This is especially
true for interconnect hwmods.
Remove the warning.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: hwmod: Do not write the enawakeup bit if SYSC_HAS_ENAWAKEUP is not set
Benoit Cousson [Fri, 1 Jul 2011 20:54:03 +0000 (22:54 +0200)]
OMAP2+: hwmod: Do not write the enawakeup bit if SYSC_HAS_ENAWAKEUP is not set

The Type 2 type of IPs will not have any enawakeup bit in their sysconfig.
Writing to that bit will instead trigger a softreset.
Check the flag to write this bit only if the module supports it.

Reported-by: Miguel Vadillo <vadillo@ti.com>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: hwmod: Enable module in shutdown to access sysconfig
Miguel Vadillo [Fri, 1 Jul 2011 20:54:02 +0000 (22:54 +0200)]
OMAP2+: hwmod: Enable module in shutdown to access sysconfig

When calling the shutdown, the module may be already in idle.
Accessing the sysconfig register will then lead to a crash.
In that case, re-enable the module in order to allow the access
to the sysconfig register.

Signed-off-by: Miguel Vadillo <vadillo@ti.com>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP4: hwmod data: Add MSTANDBY_SMART_WKUP flag
Benoit Cousson [Fri, 1 Jul 2011 20:54:01 +0000 (22:54 +0200)]
OMAP4: hwmod data: Add MSTANDBY_SMART_WKUP flag

Add the flag to every IPs that support it to allow the
framework to enable it instead of the SMART_STANDBY default
mode.
Without that, an IP with busmaster capability will not
be able to wakeup the interconnect at all.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP2+: hwmod: Fix smart-standby + wakeup support
Benoit Cousson [Fri, 1 Jul 2011 20:54:00 +0000 (22:54 +0200)]
OMAP2+: hwmod: Fix smart-standby + wakeup support

The commit 86009eb326afde34ffdc5648cd344aa86b8d58d4 was adding
the wakeup support for new OMAP4 IPs. This support is incomplete for
busmaster IPs that need as well to use smart-standby with wakeup.

This new standbymode is suported on HSI and USB_HOST_FS for the moment.

Add the new MSTANDBY_SMART_WKUP flag to mark the IPs that support this
capability.

Enable this new mode when applicable in _enable_wakeup, _disable_wakeup,
_enable_sysc and _idle_sysc.

The omap_hwmod_44xx_data.c will have to be updated to add this new flag.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 years agoOMAP: dmtimer: add missing include
Paul Walmsley [Sun, 10 Jul 2011 00:00:25 +0000 (18:00 -0600)]
OMAP: dmtimer: add missing include

After commit caf64f2fdc48472995d40656eb1a75524c464447 ("omap: Make a subset
of dmtimer functions into inline functions"),
arch/arm/plat-omap/include/plat/dmtimer.h is missing an include of linux/io.h
- add it.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Tony Lindgren <tony@atomide.com>
13 years agoMerge branch 'cleanup-part-2' of git+ssh://master.kernel.org/pub/scm/linux/kernel...
Arnd Bergmann [Fri, 8 Jul 2011 15:01:45 +0000 (15:01 +0000)]
Merge branch 'cleanup-part-2' of git+ssh:///linux/kernel/git/tmlind/linux-omap-2.6 into omap/cleanup

13 years agoMerge branch 'peter/topic/for-tony' of git://gitorious.org/omap-audio/linux-audio...
Tony Lindgren [Thu, 7 Jul 2011 19:11:23 +0000 (12:11 -0700)]
Merge branch 'peter/topic/for-tony' of git://gitorious.org/omap-audio/linux-audio into twl-asoc

13 years agoMerge branch 'peter/topic/for-tony_mach-cleanup' of git://gitorious.org/omap-audio...
Tony Lindgren [Thu, 7 Jul 2011 19:08:58 +0000 (12:08 -0700)]
Merge branch 'peter/topic/for-tony_mach-cleanup' of git://gitorious.org/omap-audio/linux-audio into cleanup-part-2

13 years agoomap: mcbsp: Remove port number enums
Jarkko Nikula [Fri, 1 Jul 2011 08:52:27 +0000 (08:52 +0000)]
omap: mcbsp: Remove port number enums

These McBSP port number enums are used only in two places in the McBSP code
so we may remove then and just use numeric values like rest of the code does.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
13 years agoomap: mcbsp: Remove rx_/tx_word_length variables
Jarkko Nikula [Fri, 1 Jul 2011 08:52:26 +0000 (08:52 +0000)]
omap: mcbsp: Remove rx_/tx_word_length variables

These variables got unused after ("omap: mcbsp: Drop in-driver transfer
support") but was noticed only afterwards.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
13 years agoASoC: twl6040: Add back support for legacy mode
Peter Ujfalusi [Tue, 5 Jul 2011 19:35:53 +0000 (22:35 +0300)]
ASoC: twl6040: Add back support for legacy mode

The legacy mode has been accidentaly removed by commit:
ASoC: twl6040: add all ABE DAIs

Add back the twl6040-hifi dai.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoASoC: twl6040: No need to convert the PLL ID
Peter Ujfalusi [Mon, 4 Jul 2011 07:35:23 +0000 (10:35 +0300)]
ASoC: twl6040: No need to convert the PLL ID

Since the PLL handling has been simplified, and
rebased on 0, there is no longer need for converting
the PLL ID.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoMFD: twl6040: Remove enum for PLL tracking
Peter Ujfalusi [Mon, 4 Jul 2011 07:28:28 +0000 (10:28 +0300)]
MFD: twl6040: Remove enum for PLL tracking

There is no need to have two different types for
tracking the selected PLL.
Use only the defines, when dealing with the PLLs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agoASoC: twl6040: Configure PLL only once
Peter Ujfalusi [Sat, 2 Jul 2011 23:06:07 +0000 (02:06 +0300)]
ASoC: twl6040: Configure PLL only once

Avoid configuring the PLL several times during audio startup.
We can configure the PLL at prepare time with parameters collected
earlier hw_param, and set_dai_sysclk calls.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoASoC: twl6040: Simplify sample rate constraint handling
Peter Ujfalusi [Wed, 29 Jun 2011 10:28:18 +0000 (13:28 +0300)]
ASoC: twl6040: Simplify sample rate constraint handling

We can manage the sample rate constraints without the need
to maintain a variable and a pointer.
This simplifies the handling of the constraint, and makes it
more robust.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoASoC: twl6040: Move PLL selection to codec driver
Peter Ujfalusi [Mon, 27 Jun 2011 14:03:14 +0000 (17:03 +0300)]
ASoC: twl6040: Move PLL selection to codec driver

It is better if the selection between the Low power,
and High performance PLL is handled within the codec
driver, not in machine driver(s) to avoid duplicated
code, and also to have consistent tracking of the selected
PLL, and the resulting differences in supported sample
rates.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoASoC: twl6040: Use neutral name for power mode text/enum
Peter Ujfalusi [Mon, 27 Jun 2011 10:33:14 +0000 (13:33 +0300)]
ASoC: twl6040: Use neutral name for power mode text/enum

Change the variable names to be neutral (not refering to HS).
This will ease up the introduction of PLL selection, which
going to use the same enum strings.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoMFD: twl6040: Remove wrapper for threaded irq request
Peter Ujfalusi [Mon, 4 Jul 2011 17:16:23 +0000 (20:16 +0300)]
MFD: twl6040: Remove wrapper for threaded irq request

Remove the twl6040_request_irq/free_irq inline functions,
and use direct calls instead in the core driver to
register the threaded irq.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agoMFD: twl6040: Demand valid interrupt configuration
Peter Ujfalusi [Mon, 4 Jul 2011 17:15:19 +0000 (20:15 +0300)]
MFD: twl6040: Demand valid interrupt configuration

In order to operate correctly twl6040 needs correct
interrupt configuration.
The slave drivers (vibra, and ASoC codec) will refuse
to probe, if the interrupt configuration is not correct.
In this way some checks can be removed from the code.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agoASoC: twl6040: Do not use wrapper for irq request
Peter Ujfalusi [Mon, 4 Jul 2011 16:52:26 +0000 (19:52 +0300)]
ASoC: twl6040: Do not use wrapper for irq request

The twl6040_request_irq/free_irq inline functions are going
to be removed, so replace them with direct calls.
The irq number is provided by the core driver via resource.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoinput: twl6040-vibra: Do not use wrapper for irq request
Peter Ujfalusi [Mon, 4 Jul 2011 16:50:02 +0000 (19:50 +0300)]
input: twl6040-vibra: Do not use wrapper for irq request

The twl6040_request_irq/free_irq inline functions are going
to be removed, so replace them with direct calls.
The irq number is provided by the core driver via resource.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
13 years agoMFD: twl6040: Use resource to provide irq number for slaves
Peter Ujfalusi [Tue, 5 Jul 2011 08:40:33 +0000 (11:40 +0300)]
MFD: twl6040: Use resource to provide irq number for slaves

Provide the irq number for slaves via resource on the
platform device.
The irq number configuration is done in the twl6040-core
at probe time, so machine drivers do not need to be
modified.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agoOMAP4: SDP4430: Add twl6040 codec platform support
Misael Lopez Cruz [Sat, 12 Feb 2011 01:50:37 +0000 (19:50 -0600)]
OMAP4: SDP4430: Add twl6040 codec platform support

Configure, and enable the twl6040 codec on SDP4430.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
13 years agoASoC: twl6040: Configure ramp step based on platform
Axel Castaneda Gonzalez [Thu, 24 Feb 2011 02:08:28 +0000 (20:08 -0600)]
ASoC: twl6040: Configure ramp step based on platform

Enable ramp down/up step to be configured based on
platform.

Signed-off-by: Axel Castaneda Gonzalez <x0055901@ti.com>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoASoC: twl6040: set default constraints.
Liam Girdwood [Mon, 7 Mar 2011 15:25:23 +0000 (15:25 +0000)]
ASoC: twl6040: set default constraints.

Set default sysclk constraints to high performance mode.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoASoC: twl6040: Remove pll and headset mode dependency
Misael Lopez Cruz [Fri, 11 Feb 2011 23:51:05 +0000 (17:51 -0600)]
ASoC: twl6040: Remove pll and headset mode dependency

Remove dependency between pll (hppll, lppll) and headset power
mode (low-power, high-performance), as headset power mode can
be used with any pll.

A new control is created to allow headset power mode configuration
from userspace. Changing headset power mode during earpiece related
usecases is not propagated down to the codec as earpiece requires
HS DAC in HP mode.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoASoC: twl6040: Support other sample rates in constraints.
Liam Girdwood [Fri, 18 Mar 2011 19:00:50 +0000 (19:00 +0000)]
ASoC: twl6040: Support other sample rates in constraints.

Add other supported sample rates to LP and HP modes.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoASoC: twl6040: add all ABE DAIs
Liam Girdwood [Fri, 11 Feb 2011 17:37:51 +0000 (17:37 +0000)]
ASoC: twl6040: add all ABE DAIs

Add all DAIs to fully support OMAP4 ABE.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agoOMAP4: SDP4430: Add twl6040 vibrator platform support
Peter Ujfalusi [Wed, 1 Jun 2011 08:30:38 +0000 (11:30 +0300)]
OMAP4: SDP4430: Add twl6040 vibrator platform support

Add twl4030_vibra platform data, and the needed regulators
for twl6040 vibrator.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
13 years agoinput: Add initial support for TWL6040 vibrator
Misael Lopez Cruz [Sun, 1 May 2011 08:51:24 +0000 (03:51 -0500)]
input: Add initial support for TWL6040 vibrator

Add twl6040_vibra as a child of MFD device twl6040_codec. This
implementation covers the PCM-to-PWM mode of TWL6040 vibrator
module.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Tejun Heo <tj@kernel.org>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
13 years agoMFD: twl6040: Change platform data for soc codec driver
Peter Ujfalusi [Wed, 1 Jun 2011 10:05:10 +0000 (13:05 +0300)]
MFD: twl6040: Change platform data for soc codec driver

Pass twl4030_codec_data instead of the twl4030_audio_data
for the ASoC codec driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agoASoC: twl6040: Convert into TWL6040 MFD child
Misael Lopez Cruz [Mon, 2 May 2011 02:27:00 +0000 (21:27 -0500)]
ASoC: twl6040: Convert into TWL6040 MFD child

Convert TWL6040 CODEC driver into a TWL6040 MFD child, it implies
that MFD-level operations like register accesses, clock setting
and power management are done through MFD APIs, not directly by
CODEC driver anymore. To avoid conflicts with the other MFD child,
vibrator registers are skipped in CODEC driver.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agomfd: twl6040: Add initial support
Misael Lopez Cruz [Wed, 27 Apr 2011 07:14:07 +0000 (02:14 -0500)]
mfd: twl6040: Add initial support

TWL6040 IC provides analog high-end audio codec functions for
handset applications. It contains several audio analog inputs
and outputs as well as vibrator support. It's connected to the
host processor via PDM interface for audio data communication.
The audio modules are controlled by internal registers that
can be accessed by I2C and PDM interface.

TWL6040 MFD will be registered as a child of TWL-CORE, and will
have two children of its own: twl6040-codec and twl6040-vibra.

This driver is based on TWL4030 and WM8350 MFD drivers.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>