linux-2.6-block.git
14 years agoOMAP4: Remove the secondary wait loop
Santosh Shilimkar [Sat, 12 Dec 2009 00:16:35 +0000 (16:16 -0800)]
OMAP4: Remove the secondary wait loop

The secondary cores wakes up in time so the wait loop is not
necessary anymore.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoOMAP4: AuxCoreBoot registers only accessible in secure mode
Santosh Shilimkar [Sat, 12 Dec 2009 00:16:35 +0000 (16:16 -0800)]
OMAP4: AuxCoreBoot registers only accessible in secure mode

The AuxCoreBoot0 and AuxCoreBoot1 can be only accessed in secure
mode. Replace the current code with secure monitor API's to access/modify
these registers.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoOMAP4: Fix SRAM base and size
Santosh Shilimkar [Sat, 12 Dec 2009 00:16:35 +0000 (16:16 -0800)]
OMAP4: Fix SRAM base and size

This patch fixes the public sram base address and available
size on OMAP4430.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoOMAP4: Fix cpu detection
Santosh Shilimkar [Sat, 12 Dec 2009 00:16:34 +0000 (16:16 -0800)]
OMAP4: Fix cpu detection

This patch fixes the OMAP4430 cpu detection. The IC rev detection is
done with hawkeye and rev. Note that rev does not map directly to
defined processor revision numbers as ES1.0 uses value 0.It also fixes
the SCM base address to read the correct ID_CODE register.

Also the cpu_is_omap44xx() and cpu_is_omap443x() correctly populated
instead of always being true

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap3: pandora: board file updates for .33
Grazvydas Ignotas [Sat, 12 Dec 2009 00:16:34 +0000 (16:16 -0800)]
omap3: pandora: board file updates for .33

Pandora board file updates:
- change keycodes of game buttons
  it was decided not to use ABXY layout by the developers.
- drop i2c bus 3 speed to 100kHz
  this is needed for battery monitoring chip to work reliably.
- drop pandora_lcd platform_device
  the older DSS driver was never functional on l-o or mainline
  kernels due to missing panel driver, so remove unneeded
  pandora_lcd platform_device. This also removes last OMAP_TAG
  from the board file.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap3: Defconfig file of Always Innovating OMAP3-based Touch Book
Gregoire Gentil [Sat, 12 Dec 2009 00:16:34 +0000 (16:16 -0800)]
omap3: Defconfig file of Always Innovating OMAP3-based Touch Book

Defconfig file of Always Innovating OMAP3-based Touch Book

Signed-off-by: Gregoire Gentil <gregoire@gentil.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap3: Board file of Always Innovating OMAP3-based Touch Book
Gregoire Gentil [Sat, 12 Dec 2009 00:16:34 +0000 (16:16 -0800)]
omap3: Board file of Always Innovating OMAP3-based Touch Book

Board file of Always Innovating OMAP3-based Touch Book

Signed-off-by: Gregoire Gentil <gregoire@gentil.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap1: I2C mux and clocks for omap7xx
Cory Maccarrone [Sat, 12 Dec 2009 00:16:34 +0000 (16:16 -0800)]
omap1: I2C mux and clocks for omap7xx

This change adds MUX pin configuration and clocks for I2C support
to OMAP 730 and 850-based devices.

Signed-off-by: Cory Maccarrone <darkstar6262@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap1: Add omap7xx USB support
Cory Maccarrone [Sat, 12 Dec 2009 00:16:34 +0000 (16:16 -0800)]
omap1: Add omap7xx USB support

This change implements USB client side support into the HTC
Herald board configuration.  It uses a similar, but updated
algorithm to initialize the USB as is used in the linwizard
project.

Signed-off-by: Cory Maccarrone <darkstar6262@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap1: DMA: move LCD related code from plat-omap to mach-omap1
Janusz Krzysztofik [Sat, 12 Dec 2009 00:16:33 +0000 (16:16 -0800)]
omap1: DMA: move LCD related code from plat-omap to mach-omap1

All of the LCD DMA code in plat-omap/dma.c appears to be OMAP1-only (and
apparently only is available on a subset of OMAP1 chips).

Move this code to mach-omap1/lcd_dma.c.

Tested on OMAP1510 Amstrad Delta.
Compile-tested with omap_generic_2420_defconfig.

Reported-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Reviewed-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap1: Use gen_nand
Ladislav Michl [Sat, 12 Dec 2009 00:16:33 +0000 (16:16 -0800)]
omap1: Use gen_nand

Since omapnand driver never find its way into mainline, switch to gen_nand instead.
Following patch is compile tested only, but it is based on code I wrote for
NetStar board and runtime tested it there.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Cc: Imre Deak <imre.deak@nokia.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Kevin Hilman <kjh@hilman.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agosmc91x: remove OMAP specific bits
Ladislav Michl [Sat, 12 Dec 2009 00:16:33 +0000 (16:16 -0800)]
smc91x: remove OMAP specific bits

Now that all OMAP boards are using the board resources, we don't need
to keep the arch/board specific crap in the driver header.

Cc: linux-net@vger.kernel.org
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap: use smc91x_platdata to setup smc91x
Ladislav Michl [Sat, 12 Dec 2009 00:16:33 +0000 (16:16 -0800)]
omap: use smc91x_platdata to setup smc91x

Use smc91x_platdata to setup smc91x, so we can get rid of OMAP specific stuff
in smc91x driver

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap: mux: Add 36xx CBP package support
Tony Lindgren [Sat, 12 Dec 2009 00:16:33 +0000 (16:16 -0800)]
omap: mux: Add 36xx CBP package support

Add 36xx CBP package support

Cc: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap: mux: Remove old mux code for 34xx
Tony Lindgren [Sat, 12 Dec 2009 00:16:33 +0000 (16:16 -0800)]
omap: mux: Remove old mux code for 34xx

Remove old mux code for 34xx

Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap: mux: Replace omap_cfg_reg() with new style signal or gpio functions
Tony Lindgren [Sat, 12 Dec 2009 00:16:32 +0000 (16:16 -0800)]
omap: mux: Replace omap_cfg_reg() with new style signal or gpio functions

Replace omap_cfg_reg() with new style signal or gpio functions

Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap: Split i2c platform init for mach-omap1 and mach-omap2
Tony Lindgren [Sat, 12 Dec 2009 00:16:32 +0000 (16:16 -0800)]
omap: Split i2c platform init for mach-omap1 and mach-omap2

Otherwise we cannot limit new mux code to mach-omap2.
The same signal names should eventually work for other
omaps under mach-omap2.

Note that these pins don't need to be OMAP_PIN_INPUT_PULLUP,
just OMAP_PIN_INPUT is enough.

Cc: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap: mux: Add debugfs support for new mux code
Tony Lindgren [Sat, 12 Dec 2009 00:16:32 +0000 (16:16 -0800)]
omap: mux: Add debugfs support for new mux code

Add debugfs support for new mux code

Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap: mux: Add new style init functions to omap3 board-*.c files
Tony Lindgren [Sat, 12 Dec 2009 00:16:32 +0000 (16:16 -0800)]
omap: mux: Add new style init functions to omap3 board-*.c files

Add new style mux init functions to omap3 board-*.c files

So far Beagle has been confirmed to be a CBB package,
and CM-T35 a CUS package.

Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap: mux: Add new style pin multiplexing data for 34xx
Tony Lindgren [Sat, 12 Dec 2009 00:16:32 +0000 (16:16 -0800)]
omap: mux: Add new style pin multiplexing data for 34xx

Add new style mux data for 34xx. This should also
work with 3630 easily by adding the processor subset
and ball data.

Note that this data is __initdata, and gets optimized
out except for the GPIO pins if CONFIG_OMAP_MUX
is not set.

Also note that this data uses omap3630 naming for
the SDMMC registers instead of 34xx naming with just
MMC.

Cc: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap: mux: Add new style pin multiplexing code for omap3
Tony Lindgren [Sat, 12 Dec 2009 00:16:32 +0000 (16:16 -0800)]
omap: mux: Add new style pin multiplexing code for omap3

Initially only for 34xx. This code allows us to:

- Make the code more generic as the omap internal signal
  names can stay the same across omap generations for some
  devices

- Map mux registers to GPIO registers that is needed for
  dynamic muxing of pins during off-idle

- Override bootloader mux values via kernel cmdline using
  omap_mux=some.signa1=0x1234,some.signal2=0x1234

- View and set the mux registers via debugfs if
  CONFIG_DEBUG_FS is enabled

Cc: Mike Rapoport <mike@compulab.co.il>
Cc: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoomap2: mux: intoduce omap_mux_{read,write}
Mike Rapoport [Sat, 12 Dec 2009 00:16:31 +0000 (16:16 -0800)]
omap2: mux: intoduce omap_mux_{read,write}

intoduce omap_mux_{read,write}

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Tony Lindgren <tony@atomide.com>
14 years agoMerge branch 'for_2_6_33' of git://git.pwsan.com/linux-2.6 into omap-for-linus
Tony Lindgren [Sat, 12 Dec 2009 00:16:02 +0000 (16:16 -0800)]
Merge branch 'for_2_6_33' of git://git.pwsan.com/linux-2.6 into omap-for-linus

14 years agoARM: OMAP4: PM: Add init api for DPLL nodes
Rajendra Nayak [Wed, 9 Dec 2009 01:47:17 +0000 (18:47 -0700)]
ARM: OMAP4: PM: Add init api for DPLL nodes

An api at init for all dpll nodes seem to be
needed to reparent the dpll clk node to its
bypass clk in case the dpll is in bypass.
If not done this causes sequencing issues at init
during propogate_rate.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: Add support for OMAP4 dpll api's
Rajendra Nayak [Wed, 9 Dec 2009 01:47:16 +0000 (18:47 -0700)]
ARM: OMAP4: PM: Add support for OMAP4 dpll api's

Most of the dpll api's from dpll.c are reused for OMAP4.
This patch does extend a few api's for OMAP4 support.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: Move DPLL control apis to dpll.c
Rajendra Nayak [Wed, 9 Dec 2009 01:47:16 +0000 (18:47 -0700)]
ARM: OMAP4: PM: Move DPLL control apis to dpll.c

This patch moves all the dpll control api's to a
common file dpll.c. This is in preperation of omap4
support wherein most of these api's can be reused.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: Add dummy hooks for OMAP4 dpll api's
Rajendra Nayak [Tue, 8 Dec 2009 18:31:44 +0000 (00:01 +0530)]
ARM: OMAP4: PM: Add dummy hooks for OMAP4 dpll api's

This patch adds dummy hooks for OMAP4 dpll api's. Removes
dummy hooks for clkdev api's and enables CLKDEV
for OMAP4.
Also comments clockdomain calls from within the clock
framework as its not supported yet for OMAP4.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: OMAP4 clock tree and clkdev registration
Rajendra Nayak [Wed, 9 Dec 2009 01:46:28 +0000 (18:46 -0700)]
ARM: OMAP4: PM: OMAP4 clock tree and clkdev registration

This patch defines all the clock nodes in OMAP4430
platform. All the clock node structs and the clkdev table is
autogenerated using a python script (gen_clock_tree.py)
developed by Paul Walmsley, Benoit Cousson and Rajendra Nayak.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: Adds CM1/2 register field masks
Rajendra Nayak [Wed, 9 Dec 2009 01:24:54 +0000 (18:24 -0700)]
ARM: OMAP4: PM: Adds CM1/2 register field masks

This patch adds OMAP4 specific CM1 and CM2 module
register field masks. Auto generated using a python
script (gen_cm_shifts_and_mask.py) developed by Benoit
Cousson, Paul Walmsley and Rajendra Nayak.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: Adds PRM register shift and mask bits
Rajendra Nayak [Wed, 9 Dec 2009 01:24:52 +0000 (18:24 -0700)]
ARM: OMAP4: PM: Adds PRM register shift and mask bits

This patch adds OMAP4 specific PRM register bit field
shifts and masks. Auto generated using a python script
(gen_prm_shifts_and_mask.py) developed by Benoit Cousson,
Paul Walmsley and Rajendra Nayak.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: Adds PRM register defs for OMAP4
Rajendra Nayak [Wed, 9 Dec 2009 01:24:51 +0000 (18:24 -0700)]
ARM: OMAP4: PM: Adds PRM register defs for OMAP4

This patch adds OMAP4 specific PRM register defs. Auto generated
using a python script (gen_prm_4430_h.py) developed by Paul
Walmsley and Benoit Cousson.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: Adds CM1/2 register defs for OMAP4
Rajendra Nayak [Wed, 9 Dec 2009 01:24:50 +0000 (18:24 -0700)]
ARM: OMAP4: PM: Adds CM1/2 register defs for OMAP4

This patch adds OMAP4 specific CM1 and CM2 module
register defs. Autogenerated using a python scripts
(gen_cm1_4430_h.py,gen_cm2_4430_h.py) developed
by Paul Walmsley and Benoit Cousson.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: PRM/CM module offsets for OMAP4
Rajendra Nayak [Wed, 9 Dec 2009 01:24:49 +0000 (18:24 -0700)]
ARM: OMAP4: PM: PRM/CM module offsets for OMAP4

This patch adds the offsets for new modules in PRM
and CM for OMAP4
These are autogenerated using a python script (gen_prcm44xx_h.py)
developed by Paul Walmsley and Benoit Cousson.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoARM: OMAP4: PM: Fix the PRM and CM base addresses
Rajendra Nayak [Wed, 9 Dec 2009 01:24:49 +0000 (18:24 -0700)]
ARM: OMAP4: PM: Fix the PRM and CM base addresses

This patch fixes the PRM and CM base addresses and adds
a new CM2 base address for OMAP4

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
14 years agoOMAP: omap_device: track latency in nanoseconds
Kevin Hilman [Tue, 8 Dec 2009 23:34:26 +0000 (16:34 -0700)]
OMAP: omap_device: track latency in nanoseconds

Rather than having to do a usecs = nsecs / NSECS_PER_USEC to
track latency in usecs, just track it in nanoseconds.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP: omap_device: fix nsec/usec conversion in latency calculations
Kevin Hilman [Tue, 8 Dec 2009 23:34:25 +0000 (16:34 -0700)]
OMAP: omap_device: fix nsec/usec conversion in latency calculations

Use

   usecs = nsecs / NSEC_PER_USEC;

instead of

   usecs = nsecs * NSEC_PER_USEC;

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP: hwmod: warn on missing clockdomain
Kevin Hilman [Tue, 8 Dec 2009 23:34:24 +0000 (16:34 -0700)]
OMAP: hwmod: warn on missing clockdomain

WARN if a clock/hwmod is missing a clockdomain association since
resulting hwmod will not be able to correctly enable/disable clocks.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP: omap_device: use read_persistent_clock() instead of getnstimeofday()
Kevin Hilman [Tue, 8 Dec 2009 23:34:23 +0000 (16:34 -0700)]
OMAP: omap_device: use read_persistent_clock() instead of getnstimeofday()

During suspend and resume, when omap_device deactivation and
activation is happening, the timekeeping subsystem has likely already
been suspended.  Thus getnstimeofday() will fail and trigger a WARN().

Use read_persistent_clock() instead of getnstimeofday() to avoid this.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP: omap_device: use UINT_MAX for default wakeup latency limit
Kevin Hilman [Tue, 8 Dec 2009 23:34:22 +0000 (16:34 -0700)]
OMAP: omap_device: use UINT_MAX for default wakeup latency limit

The _dev_wakeup_lat_limit field of struct omap_device is u32, so use
UINT_MAX instead of INT_MAX for the default maximum.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP: omap_device: add to_omap_device() macro
Kevin Hilman [Tue, 8 Dec 2009 23:34:17 +0000 (16:34 -0700)]
OMAP: omap_device: add to_omap_device() macro

Following the model of to_platform_device(), add to_omap_device()
macro so a platform_device pointer can be converted into an
omap_device pointer.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP3 hwmod: drop most of the OCP_SYSCONFIG.CLOCKACTIVITY code
Paul Walmsley [Tue, 8 Dec 2009 23:34:17 +0000 (16:34 -0700)]
OMAP3 hwmod: drop most of the OCP_SYSCONFIG.CLOCKACTIVITY code

Earlier, the hwmod code had considered the OCP_SYSCONFIG.CLOCKACTIVITY
bits to be incremental power saving bits, controlling internal IP
block clock gates.  This was a misapprehension.  The CLOCKACTIVITY
bits are used to indicate, in advance, which clocks will be cut when
the module acknowledges an idle request.  This enables the IP block to
take whatever action is necessary to complete any in-progress work
before asserting its IdleAck.

In the current Linux-OMAP code, this implies that the clock framework
should be changing module CLOCKACTIVITY bits as module clocks are enabled
and disabled.  We don't do that yet, but in the future, we should.
This must wait until the clock tree is annotated with omap_hwmod pointers
(or vice-versa).  In the meantime, drop most of the hwmod code that
controls CLOCKACTIVITY bits to avoid confusion.

This patch has benefited from many illuminating discussions with (in
alphabetical order) Benoît Cousson <b-cousson@ti.com>, Rajendra Nayak
<rnayak@ti.com>, and Sebastien Sabatier <s-sabatier1@ti.com>.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Sebastien Sabatier <s-sabatier1@ti.com>
Cc: Benoît Cousson <b-cousson@ti.com>
14 years agoOMAP hwmod: add names to module MPU IRQ lines
Paul Walmsley [Tue, 8 Dec 2009 23:34:16 +0000 (16:34 -0700)]
OMAP hwmod: add names to module MPU IRQ lines

Replace the existing u8 array of module MPU IRQ lines with a struct
that includes a name - similar to the existing struct
omap_hwmod_dma_info.  Device drivers can then use
platform_get_resource_byname() to retrieve specific IRQs without nasty
dependencies on array ordering.

Thanks to Benoît Cousson <b-cousson@ti.com> and Kevin Hilman
<khilman@deeprootsystems.com> for feedback on this approach.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoît Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
14 years agoOMAP3 hwmod: Add automatic OCP_SYSCONFIG AUTOIDLE handling
Paul Walmsley [Tue, 8 Dec 2009 23:34:15 +0000 (16:34 -0700)]
OMAP3 hwmod: Add automatic OCP_SYSCONFIG AUTOIDLE handling

This patch fills in the OCP_SYSCONFIG.AUTOIDLE handling in the OMAP
hwmod code.

After this patch, the hwmod code will set the module AUTOIDLE bit
(generally <module>.OCP_SYSCONFIG.AUTOIDLE) to 1 by default upon
enable.  If the hwmod flag HWMOD_NO_OCP_AUTOIDLE is set, AUTOIDLE will
be set to 0 upon enable.  Upon module disable, AUTOIDLE will be set to
1.

Enabling module autoidle should save some power.  The only reason to
not set the OCP_SYSCONFIG.AUTOIDLE bit is if there is a bug in the
module RTL, e.g., the MPUINTC block on OMAP3.

Comments from Kevin Hilman <khilman@deeprootsystems.com> inspired this patch,
and Kevin tested an earlier version of this patch.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Kevin Hilman <khilman@deeprootsystems.com>
14 years agoOMAP3 hwmod: reprogram OCP_SYSCONFIG register after setting SOFTRESET
Paul Walmsley [Tue, 8 Dec 2009 23:34:14 +0000 (16:34 -0700)]
OMAP3 hwmod: reprogram OCP_SYSCONFIG register after setting SOFTRESET

Reprogram the module's OCP_SYSCONFIG register after module reset (SOFTRESET
= 1).  This may not be needed, but the definition of the reset performed by
the SOFTRESET bit is unclear.

Kevin Hilman <khilman@deeprootsystems.com> tested an earlier version of
this patch.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Kevin Hilman <khilman@deeprootsystems.com>
14 years agoOMAP clock/hwmod: fix off-by-one errors
Paul Walmsley [Tue, 8 Dec 2009 23:33:16 +0000 (16:33 -0700)]
OMAP clock/hwmod: fix off-by-one errors

Fix loop bailout off-by-one bugs reported by Juha Leppänen
<juha_motorsportcom@luukku.com>.

This second version incorporates comments from Russell King
<linux@arm.linux.org.uk>.  A new macro, 'omap_test_timeout', has
been created, with cleaner code, and existing code has been converted
to use it.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Juha Leppänen <juha_motorsportcom@luukku.com>
Cc: Russell King <linux@arm.linux.org.uk>
14 years agoOMAP3: PM: Fix for MPU power domain MEM BANK position
Thara Gopinath [Tue, 8 Dec 2009 23:33:15 +0000 (16:33 -0700)]
OMAP3: PM: Fix for MPU power domain MEM BANK position

MPU power domain bank 0 bits are displayed in position of bank 1
in PWRSTS and PREPWRSTS registers. So read them from correct
position

Signed-off-by: Thara Gopinath <thara@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP3: SDRC: Place SDRC AC timing and MR changes in CORE DVFS SRAM code behind Kconfig
Paul Walmsley [Tue, 8 Dec 2009 23:33:14 +0000 (16:33 -0700)]
OMAP3: SDRC: Place SDRC AC timing and MR changes in CORE DVFS SRAM code behind Kconfig

The code that reprograms the SDRC memory controller during CORE DVFS,
mach-omap2/sram34xx.S:omap3_sram_configure_core_dpll(), does not
ensure that all L3 initiators are prevented from accessing the SDRAM
before modifying the SDRC AC timing and MR registers.  This can cause
memory to be corrupted or cause the SDRC to enter an unpredictable
state.  This patch places that code behind a Kconfig option,
CONFIG_OMAP3_SDRC_AC_TIMING for now, and adds a note explaining what
is going on.  Ideally the code can be added back in once supporting
code is present to ensure that other initiators aren't touching the
SDRAM.  At the very least, these registers should be reprogrammable
during kernel init to deal with buggy bootloaders.  Users who know
that all other system initiators will not be touching the SDRAM can
also re-enable this Kconfig option.

This is a modification of a patch originally written by Rajendra Nayak
<rnayak@ti.com> (the original is at http://patchwork.kernel.org/patch/51927/).
Rather than removing the code completely, this patch just comments it out.

Thanks to Benoît Cousson <b-cousson@ti.com> and Christophe Sucur
<c-sucur@ti.com> for explaining the technical basis for this and for
explaining what can be done to make this path work in future code.
Thanks to Richard Woodruff <r-woodruff2@ti.com>, Nishanth Menon
<nm@ti.com>, and Olof Johansson <olof@lixom.net> for their comments.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Christophe Sucur <c-sucur@ti.com>
Cc: Benoît Cousson <b-cousson@ti.com>
Cc: Richard Woodruff <r-woodruff2@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Olof Johansson <olof@lixom.net>
14 years agoOMAP2/3 powerdomain: return errors rather than returning the output of IS_ERR()
Roel Kluin [Tue, 8 Dec 2009 23:33:13 +0000 (16:33 -0700)]
OMAP2/3 powerdomain: return errors rather than returning the output of IS_ERR()

IS_ERR returns only 1 or 0, and the functions return a negative error
in other cases anyways.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP powerdomain: rearrange struct powerdomain to save some memory
Paul Walmsley [Tue, 8 Dec 2009 23:33:13 +0000 (16:33 -0700)]
OMAP powerdomain: rearrange struct powerdomain to save some memory

This patch rearranges the order of structure members in struct powerdomain
to avoid wasting memory due to alignment restrictions.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP powerdomain/PM: use symbolic constants for the max number of power states
Paul Walmsley [Tue, 8 Dec 2009 23:33:12 +0000 (16:33 -0700)]
OMAP powerdomain/PM: use symbolic constants for the max number of power states

Replace some bare constants with power states.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
14 years agoOMAP clockdomain/powerdomain: optimize out sleepdep code on OMAP24xx
Paul Walmsley [Tue, 8 Dec 2009 23:33:11 +0000 (16:33 -0700)]
OMAP clockdomain/powerdomain: optimize out sleepdep code on OMAP24xx

OMAP24xx chips don't support software-configurable sleep dependencies.
Test early for this so the compiler can redact the entire function body
on OMAP24xx.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP clockdomain/powerdomain: remove CONFIG_OMAP_DEBUG_{CLOCK,POWER}DOMAIN
Paul Walmsley [Tue, 8 Dec 2009 23:33:10 +0000 (16:33 -0700)]
OMAP clockdomain/powerdomain: remove CONFIG_OMAP_DEBUG_{CLOCK,POWER}DOMAIN

Avoid cluttering the Kconfig space with debug options that are rarely
used.  These can now be enabled and disabled by patching the "#undef DEBUG"
in the source files with "#define DEBUG", conforming to the practice for
the rest of the linux-omap code.

Also, while we're here, some lines in plat-omap/Kconfig use sets of
leading spaces when those lines should start with tabs.  Convert most
of them to use tabs.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Tony Lindgren <tony@atomide.com>
14 years agoOMAP2/3 PRCM: don't export prm_*(), cm_*() functions
Paul Walmsley [Tue, 8 Dec 2009 23:33:09 +0000 (16:33 -0700)]
OMAP2/3 PRCM: don't export prm_*(), cm_*() functions

Device drivers and loadable modules should not be calling these
prm_* and cm_* functions, so stop exporting them.  Only core code
and device driver integration code (in arch/arm/*omap*) should
call these functions.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoOMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c
Paul Walmsley [Tue, 8 Dec 2009 23:29:38 +0000 (16:29 -0700)]
OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

The OMAP1 clock code currently #includes a large .h file full of static
data structures.  Instead, define the data in a .c file.

Russell King <linux@arm.linux.org.uk> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2

This patch also deals with most of the flagrant checkpatch violations.

While here, separate the mpu_rate data structures out into their own
files, opp.h and opp_data.c.  In the long run, these mpu_rate tables
should be replaced with OPP code.

Also includes a patch from Felipe Balbi <felipe.balbi@nokia.com> to
mark omap1_clk_functions as __initdata to avoid a section warning:

    http://patchwork.kernel.org/patch/64366/

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Felipe Balbi <felipe.balbi@nokia.com>
Cc: Nishanth Menon <nm@ti.com>
14 years agoOMAP1 clock: convert test in disable_unused() to use ENABLE_ON_INIT
Paul Walmsley [Tue, 8 Dec 2009 23:29:37 +0000 (16:29 -0700)]
OMAP1 clock: convert test in disable_unused() to use ENABLE_ON_INIT

mach-omap1/clock.c:omap1_clk_disable_unused() contains a test that
assumes that the clock structures are available in the file's
namespace.  After a following patch, this will no longer be the case.
So we need to reimplement that test.  It turns out that we already
have a facility in the clock framework to handle this case - the
ENABLE_ON_INIT flag - used on OMAP2/3.  Remove the offending test and
mark the clocks that it was intended to catch as ENABLE_ON_INIT.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
14 years agoMerge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
Linus Torvalds [Fri, 11 Dec 2009 23:59:23 +0000 (15:59 -0800)]
Merge branch 'next' of git://git./linux/kernel/git/davej/cpufreq

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
  [ACPI/CPUFREQ] Introduce bios_limit per cpu cpufreq sysfs interface
  [CPUFREQ] make internal cpufreq_add_dev_* static
  [CPUFREQ] use an enum for speedstep processor identification
  [CPUFREQ] Document units for transition latency
  [CPUFREQ] Use global sysfs cpufreq structure for conservative governor tunings
  [CPUFREQ] Documentation: ABI: /sys/devices/system/cpu/cpu#/cpufreq/
  [CPUFREQ] powernow-k6: set transition latency value so ondemand governor can be used
  [CPUFREQ] cpumask: don't put a cpumask on the stack in x86...cpufreq/powernow-k8.c

14 years agoStaging: batman: fix debug Kconfig option
Greg Kroah-Hartman [Fri, 11 Dec 2009 23:40:17 +0000 (15:40 -0800)]
Staging: batman: fix debug Kconfig option

The debug batman option needs to depend on the correct
config option.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[ "No means no!"  - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
Linus Torvalds [Fri, 11 Dec 2009 23:34:40 +0000 (15:34 -0800)]
Merge git://git./linux/kernel/git/gregkh/tty-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (58 commits)
  tty: split the lock up a bit further
  tty: Move the leader test in disassociate
  tty: Push the bkl down a bit in the hangup code
  tty: Push the lock down further into the ldisc code
  tty: push the BKL down into the handlers a bit
  tty: moxa: split open lock
  tty: moxa: Kill the use of lock_kernel
  tty: moxa: Fix modem op locking
  tty: moxa: Kill off the throttle method
  tty: moxa: Locking clean up
  tty: moxa: rework the locking a bit
  tty: moxa: Use more tty_port ops
  tty: isicom: fix deadlock on shutdown
  tty: mxser: Use the new locking rules to fix setserial properly
  tty: mxser: use the tty_port_open method
  tty: isicom: sort out the board init logic
  tty: isicom: switch to the new tty_port_open helper
  tty: tty_port: Add a kref object to the tty port
  tty: istallion: tty port open/close methods
  tty: stallion: Convert to the tty_port_open/close methods
  ...

14 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
Linus Torvalds [Fri, 11 Dec 2009 23:31:13 +0000 (15:31 -0800)]
Merge branch 'for_linus' of git://git./linux/kernel/git/jack/linux-fs-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: (21 commits)
  ext3: PTR_ERR return of wrong pointer in setup_new_group_blocks()
  ext3: Fix data / filesystem corruption when write fails to copy data
  ext4: Support for 64-bit quota format
  ext3: Support for vfsv1 quota format
  quota: Implement quota format with 64-bit space and inode limits
  quota: Move definition of QFMT_OCFS2 to linux/quota.h
  ext2: fix comment in ext2_find_entry about return values
  ext3: Unify log messages in ext3
  ext2: clear uptodate flag on super block I/O error
  ext2: Unify log messages in ext2
  ext3: make "norecovery" an alias for "noload"
  ext3: Don't update the superblock in ext3_statfs()
  ext3: journal all modifications in ext3_xattr_set_handle
  ext2: Explicitly assign values to on-disk enum of filetypes
  quota: Fix WARN_ON in lookup_one_len
  const: struct quota_format_ops
  ubifs: remove manual O_SYNC handling
  afs: remove manual O_SYNC handling
  kill wait_on_page_writeback_range
  vfs: Implement proper O_SYNC semantics
  ...

14 years agoMerge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
Linus Torvalds [Fri, 11 Dec 2009 23:30:29 +0000 (15:30 -0800)]
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

* 'for-linus' of git://oss.sgi.com/xfs/xfs:
  xfs: Fix error return for fallocate() on XFS
  xfs: cleanup dmapi macros in the umount path
  xfs: remove incorrect sparse annotation for xfs_iget_cache_miss
  xfs: kill the STATIC_INLINE macro
  xfs: uninline xfs_get_extsz_hint
  xfs: rename xfs_attr_fetch to xfs_attr_get_int
  xfs: simplify xfs_buf_get / xfs_buf_read interfaces
  xfs: remove IO_ISAIO
  xfs: Wrapped journal record corruption on read at recovery
  xfs: cleanup data end I/O handlers
  xfs: use WRITE_SYNC_PLUG for synchronous writeout
  xfs: reset the i_iolock lock class in the reclaim path
  xfs: I/O completion handlers must use NOFS allocations
  xfs: fix mmap_sem/iolock inversion in xfs_free_eofblocks
  xfs: simplify inode teardown

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
Linus Torvalds [Fri, 11 Dec 2009 23:25:56 +0000 (15:25 -0800)]
Merge git://git./linux/kernel/git/gregkh/staging-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (235 commits)
  Staging: IIO: add selection of IIO_SW_RING to LIS3L02DQ as needed
  Staging: IIO: Add tsl2560-2 support to tsl2563 driver.
  Staging: IIO: Remove tsl2561 driver. Support merged with tsl2563.
  Staging: wlags49_h2: fix up signal levels
  + drivers-staging-wlags49_h2-remove-cvs-metadata.patch added to -mm tree
  Staging: samsung-laptop: add TODO file
  Staging: samsung-laptop: remove old kernel code
  Staging: add Samsung Laptop driver
  staging: batman-adv meshing protocol
  Staging: rtl8192u: depends on USB
  Staging: rtl8192u: remove dead code
  Staging: rtl8192u: remove bad whitespaces
  Staging: rtl8192u: make it compile
  Staging: Added Realtek rtl8192u driver to staging
  Staging: dream: add gpio and pmem support
  Staging: dream: add TODO file
  Staging: android: delete android drivers
  Staging: et131x: clean up the avail fields in the rx registers
  Staging: et131x: Clean up number fields
  Staging: et131x: kill RX_DMA_MAX_PKT_TIME
  ...

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
Linus Torvalds [Fri, 11 Dec 2009 23:24:56 +0000 (15:24 -0800)]
Merge git://git./linux/kernel/git/gregkh/driver-core-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (27 commits)
  Driver core: fix race in dev_driver_string
  Driver Core: Early platform driver buffer
  sysfs: sysfs_setattr remove unnecessary permission check.
  sysfs: Factor out sysfs_rename from sysfs_rename_dir and sysfs_move_dir
  sysfs: Propagate renames to the vfs on demand
  sysfs: Gut sysfs_addrm_start and sysfs_addrm_finish
  sysfs: In sysfs_chmod_file lazily propagate the mode change.
  sysfs: Implement sysfs_getattr & sysfs_permission
  sysfs: Nicely indent sysfs_symlink_inode_operations
  sysfs: Update s_iattr on link and unlink.
  sysfs: Fix locking and factor out sysfs_sd_setattr
  sysfs: Simplify iattr time assignments
  sysfs: Simplify sysfs_chmod_file semantics
  sysfs: Use dentry_ops instead of directly playing with the dcache
  sysfs: Rename sysfs_d_iput to sysfs_dentry_iput
  sysfs: Update sysfs_setxattr so it updates secdata under the sysfs_mutex
  debugfs: fix create mutex racy fops and private data
  Driver core: Don't remove kobjects in device_shutdown.
  firmware_class: make request_firmware_nowait more useful
  Driver-Core: devtmpfs - set root directory mode to 0755
  ...

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
Linus Torvalds [Fri, 11 Dec 2009 23:22:55 +0000 (15:22 -0800)]
Merge git://git./linux/kernel/git/gregkh/usb-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (122 commits)
  USB: mos7840: add device IDs for B&B electronics devices
  USB: ftdi_sio: add USB device ID's for B&B Electronics line
  USB: musb: musb_host: fix sparse warning
  USB: musb: musb_gadget: fix sparse warning
  USB: musb: omap2430: fix sparse warning
  USB: core: message: fix sparse warning
  USB: core: hub: fix sparse warning
  USB: core: fix sparse warning for static function
  USB: Added USB_ETH_RNDIS to use instead of CONFIG_USB_ETH_RNDIS
  USB: Check bandwidth when switching alt settings.
  USB: Refactor code to find alternate interface settings.
  USB: xhci: Fix command completion after a drop endpoint.
  USB: xhci: Make reverting an alt setting "unfailable".
  USB: usbtmc: Use usb_clear_halt() instead of custom code.
  USB: xhci: Add correct email and files to MAINTAINERS entry.
  USB: ehci-omap.c: introduce missing kfree
  USB: xhci-mem.c: introduce missing kfree
  USB: add remove_id sysfs attr for usb drivers
  USB: g_multi kconfig: fix depends and help text
  USB: option: add pid for ZTE
  ...

14 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
Linus Torvalds [Fri, 11 Dec 2009 23:22:27 +0000 (15:22 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/ieee1394/linux1394-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
  firewire: ohci: handle receive packets with a data length of zero

14 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel...
Linus Torvalds [Fri, 11 Dec 2009 23:19:56 +0000 (15:19 -0800)]
Merge branch 'for_linus' of git://git./linux/kernel/git/jwessel/linux-2.6-kgdb

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb:
  kgdb: Always process the whole breakpoint list on activate or deactivate
  kgdb: continue and warn on signal passing from gdb
  kgdb,x86: do not set kgdb_single_step on x86
  kgdb: allow for cpu switch when single stepping
  kgdb,i386: Fix corner case access to ss with NMI watch dog exception
  kgdb: Replace strstr() by strchr() for single-character needles
  kgdbts: Read buffer overflow
  kgdb: Read buffer overflow
  kgdb,x86: remove redundant test

14 years agotty: split the lock up a bit further
Alan Cox [Mon, 30 Nov 2009 13:18:51 +0000 (13:18 +0000)]
tty: split the lock up a bit further

The tty count sanity check may need the BKL, that isn't clear. However it
is clear that the count use of the lock is internal and independant of the
bigger use of the lock.

Furthermore the file list locking is also separately locked already

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: Move the leader test in disassociate
Alan Cox [Mon, 30 Nov 2009 13:18:45 +0000 (13:18 +0000)]
tty: Move the leader test in disassociate

There are two call points, both want to check that tty->signal->leader is
set. Move the test into disassociate_ctty() as that will make locking
changes easier in a bit

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: Push the bkl down a bit in the hangup code
Alan Cox [Mon, 30 Nov 2009 13:18:40 +0000 (13:18 +0000)]
tty: Push the bkl down a bit in the hangup code

We know that the redirect field is handled via its own locking in all
places

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: Push the lock down further into the ldisc code
Alan Cox [Mon, 30 Nov 2009 13:18:35 +0000 (13:18 +0000)]
tty: Push the lock down further into the ldisc code

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: push the BKL down into the handlers a bit
Alan Cox [Mon, 30 Nov 2009 13:18:29 +0000 (13:18 +0000)]
tty: push the BKL down into the handlers a bit

Start trying to untangle the remaining BKL mess

Updated to fix missing unlock_kernel noted by Dan Carpenter

Signed-off-by: Alan "I must be out of my tree" Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: moxa: split open lock
Alan Cox [Mon, 30 Nov 2009 13:18:24 +0000 (13:18 +0000)]
tty: moxa: split open lock

moxa_openlock is used for several situations where we want to handle the
case of an ioctl that crosses many ports (not just the open tty), and also
cases where an open races a deinit (eg a pci unplug) and we hangup a port
before we can cope with that.

The non open race cases can use the moxa_lock spinlock. This simplifies sorting
out the remaining mess.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: moxa: Kill the use of lock_kernel
Alan Cox [Mon, 30 Nov 2009 13:18:18 +0000 (13:18 +0000)]
tty: moxa: Kill the use of lock_kernel

It isn't needed here any more

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: moxa: Fix modem op locking
Alan Cox [Mon, 30 Nov 2009 13:18:13 +0000 (13:18 +0000)]
tty: moxa: Fix modem op locking

This is overkill and mostly not needed

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: moxa: Kill off the throttle method
Alan Cox [Mon, 30 Nov 2009 13:18:08 +0000 (13:18 +0000)]
tty: moxa: Kill off the throttle method

The tty flag can be tested so the shadow flag isn't needed

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: moxa: Locking clean up
Alan Cox [Mon, 30 Nov 2009 13:18:02 +0000 (13:18 +0000)]
tty: moxa: Locking clean up

- The open lock is needed to fix up the case of a board reset occuring during
  tty open but too early for a sane hangup response.
- The lock can however got for other cases
- Use the port mutex for get/setserial
- Fix up the confused lack of locking on the THROTTLE and other bits in the
  private flags. Just use set/test/clear bit and it covers the cases we need

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: moxa: rework the locking a bit
Alan Cox [Mon, 30 Nov 2009 13:17:57 +0000 (13:17 +0000)]
tty: moxa: rework the locking a bit

Introduce a lock for moxafunc() to protect the cases where were get collisions
between two function requests at the same time.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: moxa: Use more tty_port ops
Alan Cox [Mon, 30 Nov 2009 13:17:51 +0000 (13:17 +0000)]
tty: moxa: Use more tty_port ops

Rework a few bits of this into tty_port format

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: isicom: fix deadlock on shutdown
Alan Cox [Mon, 30 Nov 2009 13:17:46 +0000 (13:17 +0000)]
tty: isicom: fix deadlock on shutdown

Alexander Strakh <strakh@ispras.ru> reported

KERNEL_VERSION: 2.6.31
DESCRIBE:
Driver drivers/char/isicom.c might sleep in atomic  context, because it
calls
tty_port_xmit_buf under spin_lock.

./drivers/char/isicom.c:
1307 static void isicom_hangup(struct tty_struct *tty)
1308 {
...
1315         spin_lock_irqsave(&port->card->card_lock, flags);
1316         isicom_shutdown_port(port);
...

Path to might_sleep macro from isicom_hangup:
1. isicom_hangup calls spin_lock_irqsave (drivers/char/isicom.c:1315) and
then
calls isicom_shutdown_port.
2. isiscom_shutdown_port calls tty_port_free_xmit_buf at
drivers/char/isicom.c:906
3. tty_port_free_xmit_buf calls mutex_lock at drivers/char/tty_port:48

Found by Linux Driver Verification Project.

Reported-by: Alexander Strakh <strakh@ispras.ru>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: mxser: Use the new locking rules to fix setserial properly
Alan Cox [Mon, 30 Nov 2009 13:17:41 +0000 (13:17 +0000)]
tty: mxser: Use the new locking rules to fix setserial properly

Propogate the init/shutdown mutex through the setserial logic. Use the proper
locks for the various bits still using the BKL. Kill the BKL in this driver.

Updated to fix the bug noted by Dan Carpenter

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: mxser: use the tty_port_open method
Alan Cox [Mon, 30 Nov 2009 13:17:35 +0000 (13:17 +0000)]
tty: mxser: use the tty_port_open method

At first this looks a fairly trivial conversion but we can't quite push
everything into the right format yet. The open side is easy but care is needed
over the setserial methods. Fix up the locking now that we've adopted the
port->mutex locking rule for the initialization.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: isicom: sort out the board init logic
Alan Cox [Mon, 30 Nov 2009 13:17:30 +0000 (13:17 +0000)]
tty: isicom: sort out the board init logic

Split this into two flags - INIT meaning the board is set up and ACTIVE
meaning the board has ports open. Remove the broken HUPCL casing and push
the counts somewhere sensible.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: isicom: switch to the new tty_port_open helper
Alan Cox [Mon, 30 Nov 2009 13:17:24 +0000 (13:17 +0000)]
tty: isicom: switch to the new tty_port_open helper

Trivial conversion in this case so might as well do it while testing the
port_open design is right

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: tty_port: Add a kref object to the tty port
Alan Cox [Mon, 30 Nov 2009 13:17:14 +0000 (13:17 +0000)]
tty: tty_port: Add a kref object to the tty port

Users of tty port need a way to refcount ports when hotplugging is
involved.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: istallion: tty port open/close methods
Alan Cox [Mon, 30 Nov 2009 13:17:08 +0000 (13:17 +0000)]
tty: istallion: tty port open/close methods

Slice/dice/repeat as with the stallion driver this is just code shuffling
and removal

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: stallion: Convert to the tty_port_open/close methods
Alan Cox [Mon, 30 Nov 2009 13:17:03 +0000 (13:17 +0000)]
tty: stallion: Convert to the tty_port_open/close methods

The driver is already structured this way so just slice and dice

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: tty_port: Move the IO_ERROR clear
Alan Cox [Mon, 30 Nov 2009 13:16:57 +0000 (13:16 +0000)]
tty: tty_port: Move the IO_ERROR clear

Some devices want to set IO_ERROR in their activate methods so that you can
be handed a 'dead' port for operations like setserial. Thus we need to
clear the flag before activate so that activate can choose to set the flag
and still return 0.

This is fine as the file handle/tty are not accessible to the user yet.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: tty_port: Add IO_ERROR bit handling
Alan Cox [Mon, 30 Nov 2009 13:16:52 +0000 (13:16 +0000)]
tty: tty_port: Add IO_ERROR bit handling

To propogate tty_port_open/close to a few other devices we need to start
handling the IO_ERROR flag on the tty. We can do this pretty trivially.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: riscom8: switch to the tty_port_open API
Alan Cox [Mon, 30 Nov 2009 13:16:47 +0000 (13:16 +0000)]
tty: riscom8: switch to the tty_port_open API

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: tty_port: Change the buffer allocator locking
Alan Cox [Mon, 30 Nov 2009 13:16:41 +0000 (13:16 +0000)]
tty: tty_port: Change the buffer allocator locking

We want to be able to do this without regard for the activate/own open
method being used which causes a problem using port->mutex. Add another
mutex for now. Once everything uses port_open to do buffer allocs we can
kill it back off

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: sdio_uart: Fix the locking on "func" for new code
Alan Cox [Mon, 30 Nov 2009 13:16:30 +0000 (13:16 +0000)]
tty: sdio_uart: Fix the locking on "func" for new code

The new dtr_rts function didn't take the port->func lock as it should
so add use of the lock there.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: sdio_uart: add modem functionality
Alan Cox [Mon, 30 Nov 2009 13:16:36 +0000 (13:16 +0000)]
tty: sdio_uart: add modem functionality

Add the POSIX block for carrier

Linux TIOCMIWAIT functionality is still lacking from the driver.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: sdio_uart: Style fixes
Alan Cox [Mon, 30 Nov 2009 13:16:25 +0000 (13:16 +0000)]
tty: sdio_uart: Style fixes

Running the current code through checkpatch shows a few bits of noise
mostly but not entirely from before the changes.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: sdio_uart: Fix termios handling
Alan Cox [Mon, 30 Nov 2009 13:16:14 +0000 (13:16 +0000)]
tty: sdio_uart: Fix termios handling

Switching between two non standard baud rates fails because of the cflag
test. Do as we did elsewhere and just kill the "optimisation".

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty: sdio_uart: Switch to the open/close helpers
Alan Cox [Mon, 30 Nov 2009 13:16:09 +0000 (13:16 +0000)]
tty: sdio_uart: Switch to the open/close helpers

Gets us proper tty semantics, removes some code and fixes up a few corner
case races (hangup during open etc)

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agosdio_uart: Move the open lock
Alan Cox [Thu, 5 Nov 2009 13:28:38 +0000 (13:28 +0000)]
sdio_uart: Move the open lock

When we move to the tty_port logic the port mutex will protect open v close
v hangup. Move to this first in the existing open code so we have a bisection
point.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agosdio_uart: refcount the tty objects
Alan Cox [Thu, 5 Nov 2009 13:28:29 +0000 (13:28 +0000)]
sdio_uart: refcount the tty objects

The tty can go away underneath us, so we must refcount it. Do the naïve
implementation initially. We will worry about startup shortly.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agosdio_uart: Fix oops caused by the previous changeset
Nicolas Pitre [Thu, 5 Nov 2009 13:28:17 +0000 (13:28 +0000)]
sdio_uart: Fix oops caused by the previous changeset

Now... testing reveals that the very first patch "sdio_uart: use
tty_port" causes a segmentation fault in sdio_uart_open():

Unable to handle kernel NULL pointer dereference at virtual address 00000084
pgd = dfb44000 [00000084] *pgd=1fb99031, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] PREEMPT
last sysfs file:
/sys/devices/platform/mvsdio/mmc_host/mmc0/mmc0:f111/uevent
Modules linked in:
CPU: 0    Not tainted  (2.6.32-rc5-next-20091102-00001-gb36eae9 #10)
PC is at sdio_uart_open+0x204/0x2cc
[...]

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agosdio_uart: use tty_port
Alan Cox [Thu, 5 Nov 2009 13:28:06 +0000 (13:28 +0000)]
sdio_uart: use tty_port

Add a tty_port object to the sdio uart. For the moment just begin using the
tty field of the port, as this is the critical one to clean up.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotty_port: Move hupcl handling
Alan Cox [Thu, 5 Nov 2009 13:27:57 +0000 (13:27 +0000)]
tty_port: Move hupcl handling

Move the HUCPL handling from the end of close_port_start to the beginning
of close_port_end. What this actually does is change the ordering from

port shutdown
port->dtr_rts

to

port->dtr_rts
port shutdown

Some hardware drops the physical connection on shutdown so we must perform
the port operations before the shutdown.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodevpts_get_tty() should validate inode
Sukadev Bhattiprolu [Wed, 18 Nov 2009 02:35:43 +0000 (18:35 -0800)]
devpts_get_tty() should validate inode

devpts_get_tty() assumes that the inode passed in is associated with a valid
pty.  But if the only reference to the pty is via a bind-mount, the inode
passed to devpts_get_tty() while valid, would refer to a pty that no longer
exists.

With a lot of debug effort, Grzegorz Nosek developed a small program (see
below) to reproduce a crash on recent kernels. This crash is a regression
introduced by the commit:

commit 527b3e4773628b30d03323a2cb5fb0d84441990f
Author: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Date:   Mon Oct 13 10:43:08 2008 +0100

To fix, ensure that the dentry associated with the inode has not yet been
deleted/unhashed by devpts_pty_kill().

See also:
https://lists.linux-foundation.org/pipermail/containers/2009-July/019273.html

tty-bug.c:

#define _GNU_SOURCE
#include <fcntl.h>
#include <sched.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/signal.h>
#include <unistd.h>
#include <stdio.h>

#include <linux/fs.h>

void dummy(int sig)
{
}

static int child(void *unused)
{
int fd;

signal(SIGINT, dummy); signal(SIGHUP, dummy);
pause(); /* cheesy synchronisation to wait for /dev/pts/0 to appear */

mount("/dev/pts/0", "/dev/console", NULL, MS_BIND, NULL);
sleep(2);

fd = open("/dev/console", O_RDWR);
dup(0); dup(0);
write(1, "Hello world!\n", sizeof("Hello world!\n")-1);
return 0;
}

int main(void)
{
pid_t pid;
char *stack;

stack = malloc(16384);
pid = clone(child, stack+16384, CLONE_NEWNS|SIGCHLD, NULL);

open("/dev/ptmx", O_RDWR|O_NOCTTY|O_NONBLOCK);

unlockpt(fd); grantpt(fd);

sleep(2);
kill(pid, SIGHUP);
sleep(1);
return 0; /* exit before child opens /dev/console */
}

Reported-by: Grzegorz Nosek <root@localdomain.pl>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Tested-by: Serge Hallyn <serue@us.ibm.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>