Skip to content

Restore SA11x0 MCP/UCB drivers to a working state

Russell King - ARM Linux linux-arm-kernel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest33 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/33Revert "ARM: sa1100: Refactor mcp-sa11x0 to use platform resources."arch/arm/mach-sa1100/assabet.c arch/arm/mach-sa1100/cerf.c arch/arm/mach-sa1100/collie.c +5 more+53 -1760 replies
2/33Revert "ARM: sa11x0: Implement autoloading of codec and codec pdata for mcp bus."arch/arm/mach-sa1100/assabet.c arch/arm/mach-sa1100/cerf.c arch/arm/mach-sa1100/collie.c +12 more+21 -1350 replies
3/33MFD: mcp-core: fix complaints from the genirq layerdrivers/mfd/mcp-core.c+11 -60 replies
4/33MFD: mcp-core: fix mcp_priv() to be more type safeinclude/linux/mfd/mcp.h+4 -10 replies
5/33MFD: ucb1x00-core: fix missing restore of io output data on resumedrivers/mfd/ucb1x00-core.c+1 -00 replies
6/33MFD: ucb1x00-core: fix gpiolib direction_output handlingdrivers/mfd/ucb1x00-core.c+12 -60 replies
7/33MFD: ucb1x00-ts: fix resume failuredrivers/mfd/ucb1x00-ts.c+5 -270 replies
8/33MFD: mcp-core: sanitize host creation/removaldrivers/mfd/mcp-core.c drivers/mfd/mcp-sa11x0.c include/linux/mfd/mcp.h+20 -100 replies
9/33MFD: mcp-sa11x0: remove DMA initializers and variablesdrivers/mfd/mcp-core.c drivers/mfd/mcp-sa11x0.c drivers/mfd/ucb1x00-assabet.c +3 more+0 -170 replies
10/33MFD: mcp-sa11x0: move setup of PPC unit out of mcp-sa11x0.carch/arm/mach-sa1100/assabet.c arch/arm/mach-sa1100/cerf.c arch/arm/mach-sa1100/collie.c +6 more+19 -90 replies
11/33MFD: mcp-sa11x0: add .owner initializerdrivers/mfd/mcp-sa11x0.c+4 -60 replies
12/33MFD: mcp-sa11x0: convert mcp-sa11x0 to use platform resourcesarch/arm/mach-sa1100/generic.c drivers/mfd/mcp-sa11x0.c+104 -420 replies
13/33MFD: mcp-sa11x0: convert to use dev_pm_opsdrivers/mfd/mcp-sa11x0.c+12 -60 replies
14/33MFD: mcp-sa11x0: use _noirq resume methodsdrivers/mfd/mcp-sa11x0.c+8 -10 replies
15/33MFD: mcp/ucb1x00: separate ucb1x00 driver data from the MCP dataarch/arm/mach-sa1100/collie.c arch/arm/mach-sa1100/include/mach/mcp.h arch/arm/mach-sa1100/simpad.c +5 more+24 -110 replies
16/33MFD: ucb1x00-ts: provide input layer with device parentdrivers/mfd/ucb1x00-ts.c+1 -00 replies
17/33MFD: ucb1x00-core: get rid of mach/hardware.h includedrivers/mfd/ucb1x00-core.c+0 -20 replies
18/33MFD: ucb1x00-core: add handling for ucb1x00 resetdrivers/mfd/ucb1x00-core.c include/linux/mfd/ucb1x00.h+20 -40 replies
19/33MFD: ucb1x00-core: add .owner initializer and module aliasdrivers/mfd/ucb1x00-core.c+2 -00 replies
20/33MFD: ucb1x00-core: use mutexes instead of semaphoresdrivers/mfd/ucb1x00-core.c include/linux/mfd/ucb1x00.h+9 -100 replies
21/33MFD: ucb1x00-core: clean up device handling in probedrivers/mfd/ucb1x00-core.c+16 -140 replies
22/33MFD: ucb1x00-core: add owner and dev initializers to gpio structuredrivers/mfd/ucb1x00-core.c+2 -00 replies
23/33MFD: ucb1x00-core: scan drivers in same order they're registereddrivers/mfd/ucb1x00-core.c+4 -40 replies
24/33MFD: ucb1x00-core: add missing ucb1x00_enable()/ucb1x00_disable()drivers/mfd/ucb1x00-core.c+15 -10 replies
25/33MFD: ucb1x00-core: disable mcp clock when bus is not requireddrivers/mfd/ucb1x00-core.c+5 -40 replies
26/33MFD: mcp-sa11x0: complain if mcp clock is left enableddrivers/mfd/mcp-sa11x0.c+7 -00 replies
27/33MFD: ucb1x00-core: convert to use dev_pm_opsdrivers/mfd/ucb1x00-core.c include/linux/mfd/ucb1x00.h+19 -150 replies
28/33MFD: mcp-core: remove legacy driver suspend/resume methodsdrivers/mfd/mcp-core.c include/linux/mfd/mcp.h+0 -300 replies
29/33MFD: ucb1x00: convert to use genirqdrivers/mfd/Kconfig drivers/mfd/ucb1x00-core.c drivers/mfd/ucb1x00-ts.c +1 more+132 -1790 replies
30/33MFD: ucb1x00-core: add wakeup supportdrivers/mfd/ucb1x00-core.c include/linux/mfd/ucb1x00.h+63 -00 replies
31/33ARM: sa11x0: add assabet ucb1x00 platform dataarch/arm/mach-sa1100/assabet.c+6 -00 replies
32/33MFD: ucb1x00-assabet: add support for UCB1x00 GPIO switchesdrivers/mfd/ucb1x00-assabet.c+39 -40 replies
33/33MFD: mcp-sa11x0/assabet: move assabet reset handling out of mcp-sa11x0.carch/arm/mach-sa1100/assabet.c drivers/mfd/mcp-sa11x0.c+8 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/33] Restore SA11x0 MCP/UCB drivers to a working state
Quoted 12 lines · Russell King - ARM Linux

Samuel,

The following patch set restores the SA11x0 MCP and UCB1x00 drivers back to a working state, as tested on the Assabet.

The first two patches are the revert I requested. The others fix a problem with the UCB1x00's use of genirq (it returns from its interrupt handler with IRQs enabled, which causes genirq to barf), and delete the SA11x0 specific DMA definitions and SA11x0 specific DMA header file from the driver. That is in preparation for me removing the existing SA11x0 private DMA backend in favour of a DMA engine implementation.

Quoted 6 lines

As the DMA changes have dependencies in my tree (on which other changes then depend on) I can't see this being sanely split from my tree, so I'll request acks for these changes.

I'll plan to send the first three patches to Linus as part of my next 'fixes' push if you agree.

I've not heard anything back from anyone, so I'm going to assume that's silent approval.

However, I've taken some time to replace some of the parts of the patches which have had to be reverted, which are fully tested on my Assabet, and to augment the patches to bring the driver up to speed with things like genirq, sparse IRQ, mutexes rather than semaphores, etc.

So, in this replacement set, the first seven patches are bug fixes of various kinds:

Revert "ARM: sa1100: Refactor mcp-sa11x0 to use platform resources." Revert "ARM: sa11x0: Implement autoloading of codec and codec pdata for
MFD: mcp-core: fix complaints from the genirq layer
MFD: mcp-core: fix mcp_priv() to be more type safe
MFD: ucb1x00-core: fix missing restore of io output data on resume
MFD: ucb1x00-core: fix gpiolib direction_output handling
MFD: ucb1x00-ts: fix resume failure

these I believe need to go in for -rc. My plan is to send them when I sent the rest of the ARM fixes, either tonight or tomorrow night.

Following this is what I consider to be development on top of what was in v3.2, and the work which Jochen produced:

MFD: mcp-core: sanitize host creation/removal
MFD: mcp-sa11x0: remove DMA initializers and variables
MFD: mcp-sa11x0: move setup of PPC unit out of mcp-sa11x0.c
MFD: mcp-sa11x0: add .owner initializer
MFD: mcp-sa11x0: convert mcp-sa11x0 to use platform resources
MFD: mcp-sa11x0: convert to use dev_pm_ops
MFD: mcp-sa11x0: use _noirq resume methods
MFD: mcp/ucb1x00: separate ucb1x00 driver data from the MCP data
MFD: ucb1x00-ts: provide input layer with device parent
MFD: ucb1x00-core: get rid of mach/hardware.h include
MFD: ucb1x00-core: add handling for ucb1x00 reset
MFD: ucb1x00-core: add .owner initializer and module alias
MFD: ucb1x00-core: use mutexes instead of semaphores
MFD: ucb1x00-core: clean up device handling in probe
MFD: ucb1x00-core: add owner and dev initializers to gpio structure
MFD: ucb1x00-core: scan drivers in same order they're registered
MFD: ucb1x00-core: add missing ucb1x00_enable()/ucb1x00_disable()
MFD: ucb1x00-core: disable mcp clock when bus is not required
MFD: mcp-sa11x0: complain if mcp clock is left enabled
MFD: ucb1x00-core: convert to use dev_pm_ops
MFD: mcp-core: remove legacy driver suspend/resume methods
MFD: ucb1x00: convert to use genirq
MFD: ucb1x00-core: add wakeup support
ARM: sa11x0: add assabet ucb1x00 platform data
MFD: ucb1x00-assabet: add support for UCB1x00 GPIO switches
MFD: mcp-sa11x0/assabet: move assabet reset handling out of mcp-sa11x0.c

This is purposely ordered - eg, things like converting this to genirq requires the PM stuff to be fixed first to ensure that the IRQ registers are accessible when genirq wants to resume from system suspend.

I've kept the core changes first, and the platform changes (for the Assabet) as the final three patches.

The work which was taken from Jochen's original patches is:

1. Move the PPC initialization out of the driver. I put it in a common function so we don't have individual platforms implementing the same bit of code multiple times.

2. Adding .owner initializers to MCP driver structures.

3. Using platform resources for SA11x0 MCP interface base address.

4. Using separate driver_data to pass platform specifics to the UCB1x00 driver, rather than embedding them in the MCP data structure.

There's further work to be done on this driver, namely:

1. Fixing its use of a class device. This was originally done because it seemed to make sense back in the early days of the driver model. I don't think it makes that much sense, and it gets in the way of proper wakeup support.

2. Wakeup support - provided the UCB codec is connected to a wakeup capable upstream IRQ, and the power is not removed from the codec during suspend modes, the UCB is perfectly capable of doing wakeup. I have a small patch on top of this which allows the touchscreen to do exactly that. The Assabet buttons can also wake the system up but I've not tested that. There's no reason they can't other than just not setting the relevant flag in the gpio_keys data structure.

3. Module auto-loading - this doesn't make sense when genirq requires the core UCB1x00 module to be built-in to have access to the various IRQ functions. It's probably unsafe on multiprocessor or preempt systems to have IRQ code unload once IRQ decoding handlers have been registered.

Diffstat:

 arch/arm/mach-sa1100/assabet.c          |   28 +-
 arch/arm/mach-sa1100/cerf.c             |   12 +-
 arch/arm/mach-sa1100/collie.c           |   15 +-
 arch/arm/mach-sa1100/generic.c          |   14 +-
 arch/arm/mach-sa1100/generic.h          |    1 +
 arch/arm/mach-sa1100/include/mach/mcp.h |    2 -
 arch/arm/mach-sa1100/lart.c             |   11 +-
 arch/arm/mach-sa1100/shannon.c          |   12 +-
 arch/arm/mach-sa1100/simpad.c           |   16 +-
 drivers/mfd/Kconfig                     |    5 +-
 drivers/mfd/mcp-core.c                  |  106 ++-----
 drivers/mfd/mcp-sa11x0.c                |  265 +++++++++---------
 drivers/mfd/ucb1x00-assabet.c           |   46 +++-
 drivers/mfd/ucb1x00-core.c              |  484 ++++++++++++++++---------------
 drivers/mfd/ucb1x00-ts.c                |   73 +++---
 include/linux/mfd/mcp.h                 |   22 +-
 include/linux/mfd/ucb1x00.h             |   41 ++--
 include/linux/mod_devicetable.h         |   11 -
 scripts/mod/file2alias.c                |   10 -
 19 files changed, 547 insertions(+), 627 deletions(-)