Commit Graph

325 Commits (4e57c517b3cbaceb7438eeec879ca129fc17442c)

Author SHA1 Message Date
Yoann Padioleau dd00cc486a some kmalloc/memset ->kzalloc (tree wide)
Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc).

Here is a short excerpt of the semantic patch performing
this transformation:

@@
type T2;
expression x;
identifier f,fld;
expression E;
expression E1,E2;
expression e1,e2,e3,y;
statement S;
@@

 x =
- kmalloc
+ kzalloc
  (E1,E2)
  ...  when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\)
- memset((T2)x,0,E1);

@@
expression E1,E2,E3;
@@

- kzalloc(E1 * E2,E3)
+ kcalloc(E1,E2,E3)

[akpm@linux-foundation.org: get kcalloc args the right way around]
Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Bryan Wu <bryan.wu@analog.com>
Acked-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Dave Airlie <airlied@linux.ie>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Acked-by: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Greg KH <greg@kroah.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-19 10:04:50 -07:00
Rafael J. Wysocki 8314418629 Freezer: make kernel threads nonfreezable by default
Currently, the freezer treats all tasks as freezable, except for the kernel
threads that explicitly set the PF_NOFREEZE flag for themselves.  This
approach is problematic, since it requires every kernel thread to either
set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
care for the freezing of tasks at all.

It seems better to only require the kernel threads that want to or need to
be frozen to use some freezer-related code and to remove any
freezer-related code from the other (nonfreezable) kernel threads, which is
done in this patch.

The patch causes all kernel threads to be nonfreezable by default (ie.  to
have PF_NOFREEZE set by default) and introduces the set_freezable()
function that should be called by the freezable kernel threads in order to
unset PF_NOFREEZE.  It also makes all of the currently freezable kernel
threads call set_freezable(), so it shouldn't cause any (intentional)
change of behaviour to appear.  Additionally, it updates documentation to
describe the freezing of tasks more accurately.

[akpm@linux-foundation.org: build fixes]
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Nigel Cunningham <nigel@nigel.suspend2.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-17 10:23:02 -07:00
Linus Torvalds 4aabab2181 Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (50 commits)
  [ARM] sa1100: remove boot time RTC initialisation
  [ARM] sa1100: stop doing our own rtc management over suspend
  [ARM] 4474/1: Do not check the PSR_F_BIT in valid_user_regs
  [ARM] 4473/2:  Take the HWCAP definitions out of the elf.h file
  [ARM] pxa: move platform devices to separate header file
  [ARM] pxa: move device registration into CPU-specific file
  [ARM] pxa: remove boot time RTC initialisation
  [ARM] pxa: stop doing our own rtc management over suspend
  [ARM] 4451/1: pxa: make dma.c generic and remove cpu specific dma code
  [ARM] 4450/1: pxa: add pxa25x_init_irq() and pxa27x_init_irq()
  [ARM] 4440/1: PXA: enable the checking of ICIP2 for IRQs
  [ARM] 4438/1: PXA: remove #ifdef .. #endif from pxa_gpio_demux_handler()
  [ARM] 4437/1: PXA: move the GPIO IRQ initialization code to pxa_init_irq_gpio()
  [ARM] 4436/1: PXA: move low IRQ initialization code to pxa_init_irq_low()
  [ARM] 4435/1: PXA: remove PXA_INTERNAL_IRQS
  [ARM] 4434/1: PXA: remove PXA_IRQ_SKIP
  [ARM] pxa: Fix PXA27x suspend type validation, remove pxa_pm_prepare()
  [ARM] pxa: move pm_ops structure into CPU specific files
  [ARM] pxa: introduce cpu_is_pxaXXX macros
  [ARM] pxa: remove MMC register defines from pxa-regs.h
  ...
2007-07-12 14:17:12 -07:00
Russell King 7a2b94bc39 [ARM] pxa: remove MMC register defines from pxa-regs.h
pxamci.h redefines the MMC registers differently so they can be used
with ioremap.  Remove the incompatible definitions from pxa-regs.h.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-07-12 14:27:56 +01:00
Nicolas Ferre ed99c541e0 mmc: at91_mci: fix hanging and rework to match flowcharts
Fixes hanging using multi block operations (seen during CMD25).
Follows closely the datasheet flowcharts.

This piece of code handles better big file writing. I had to take care
of the notbusy signal during write (at91_mci_handle_cmdrdy function) and
to rearrange the AT91_MCI_ENDRX and AT91_MCI_RXBUFF flag usage.

Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09 21:29:07 +02:00
Nicolas Ferre e8d04d3dba mmc: at91_mci typo
Typo fix in at91_mci driver : standardized the typo
(at91_mci everywhere)

Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09 21:29:03 +02:00
Rolf Eike Beer 9d26a5d3f2 sdhci: Fix "Unexpected interrupt" handling
Whenever a power interrupt is signaled it is also reported as an unexpected
one. All other unexpected interrupts get lost. Cause is a not inversed
bitmask to remove power interrupts from the status.

Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09 21:28:35 +02:00
Pierre Ossman 8c75deae1a mmc: fix silly copy-and-paste error
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09 21:28:09 +02:00
Pierre Ossman ffce2e7e70 mmc: move layer init and workqueue to core file
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09 21:28:06 +02:00
Pierre Ossman b93931a61a mmc: refactor host class handling
Move basic host class device handling to its own file for clarity.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09 21:28:01 +02:00
Pierre Ossman 4101c16a91 mmc: refactor bus operations
Move bus operations to its own file for the sake of clarity. Also
delegate sysfs attributes to bus handlers in preparation for other
more exotic types.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09 21:27:56 +02:00
Milko Krachounov 7de064ebc6 sdhci: add ene controller id
ENE has a very weird design where an SDHCI device (0805) is presented
on the PCI bus, but that device is non-functional, and the real device
is hidden as a more generic device.

Signed-off-by: Milko Krachounov <milko@3mhz.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09 21:23:08 +02:00
Pierre Ossman 98ccf14909 mmc: bounce requests for simple hosts
Some hosts cannot do scatter/gather in hardware. Since not doing sg
is such a big performance hit, we (optionally) bounce the requests
to a simple linear buffer that we hand over to the driver.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09 21:22:53 +02:00
Pierre Ossman c3bff2ec10 mmc: get back read-only switch function
Somehow the code to read the read-only switch of SD cards got lost
in the reorganisation.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-06-13 19:11:20 +02:00
Ragner Magalhaes 0107a4b32e mmc-omap: fix sd response type 6 vs. 1
Ignoring OMAP_MMC_STAT_CARD_ERR, treating it as if the command
completed correctly.

Signed-off-by: Ragner Magalhaes <ragner.magalhaes@indt.org.br>
Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-06-13 19:11:14 +02:00
Pierre Ossman 3373c0ae6a mmc: don't call switch on old cards
Make sure we don't call the switch function on cards too old to
support it. They should just ignore it, but some have been reported
to lock up instead.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-06-07 09:25:58 +02:00
Pierre Ossman 71651297a4 mmc: fix broken if clause
Fix a broken if clause which was causing SD cards to go into
4-bit mode even if the host did not support it.

(Reported by David Brownell and Marc Pignat)

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-06-07 09:25:54 +02:00
Robert P. J. Day 60da8de671 au1xmmc: Replace C code with call to ARRAY_SIZE() macro.
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-06-07 09:25:51 +02:00
Marc Pignat b6cedb3861 mmc-atmel: remove linux/mmc/protocol.h dependencies
Fix compilation error by removing command decoding from at91_mci.c driver.
Decoding commands in the host driver is the wrong way.

Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-06-07 09:25:47 +02:00
Pierre Ossman 9c9f2d63a7 mmc: clean up unused parts of block driver
Remove dead code and unused structs from the block driver.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-24 06:51:02 +02:00
Nicolas Pitre 90e07d9f54 pxamci: fix PXA27x MMC workaround for bad CRC with 136 bit response
... and make it depend on the response flag instead of the command type.

Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-14 18:51:48 +02:00
Pierre Ossman fe6b4c8840 mmc: use assigned major for block device
The MMC block devices now have an assigned major. Make sure
we actually use it.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-14 18:51:43 +02:00
Pierre Ossman 6ba736a10e sdhci: handle dma boundary interrupts
When the device hits certain memory boundaries, it signals an
interrupt and expects to be serviced. We don't need the feature
but we need to make sure the device doesn't stall.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-14 18:51:37 +02:00
Yoichi Yuasa c0f3b6c777 mmc: au1xmmc command types check from data flags
This patch has changed command types check from data flags.

MMC_STOP_TRANSMISSION is never passed to au1xmmc_send_command().
SEND_STOP() is used for MMC_STOP_TRANSMISSION.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-14 18:51:24 +02:00
Martin Schwidefsky e25df1205f [S390] Kconfig: menus with depends on HAS_IOMEM.
Add "depends on HAS_IOMEM" to a number of menus to make them
disappear for s390 which does not have I/O memory.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-05-10 15:46:07 +02:00
Andrew Morton 01f41ec7b3 mmc build fix
Cc: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-09 12:30:44 -07:00
Pierre Ossman 1efd48b3ae mmc: use lock instead of claim in debug check
As mmc_detect_change() can be called from irq context, using
claim (which can sleep) is inherently unsafe. Use the host
spinlock instead, which also is faster.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-08 22:42:57 +02:00
Jan Engelhardt 790864dcc2 mmc: Use menuconfig objects
Change Kconfig objects from "menu, config" into "menuconfig" so
that the user can disable the whole feature without having to
enter the menu first.

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-08 22:41:55 +02:00
Alex Dubov 055b822414 disable socket power in adapter driver instead of media one
Socket power must be fully controlled by adapter driver. This also prevents
unnecessary power-off of the socket when media driver is unloaded, yet
media remains in the socket.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-08 22:41:47 +02:00
Linus Torvalds c6799ade4a Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (82 commits)
  [ARM] Add comments marking in-use ptrace numbers
  [ARM] Move syscall saving out of the way of utrace
  [ARM] 4360/1: S3C24XX: regs-udc.h remove unused macro
  [ARM] 4358/1: S3C24XX: mach-qt2410.c: remove linux/mmc/protocol.h header
  [ARM] mm 10: allow memory type to be specified with ioremap
  [ARM] mm 9: add additional device memory types
  [ARM] mm 8: define mem_types table L1 bit 4 to be for ARMv6
  [ARM] iop: add missing parens in macro
  [ARM] mm 7: remove duplicated __ioremap() prototypes
  ARM: OMAP: fix OMAP1 mpuio suspend/resume oops
  ARM: OMAP: MPUIO wake updates
  ARM: OMAP: speed up gpio irq handling
  ARM: OMAP: plat-omap changes for 2430 SDP
  ARM: OMAP: gpio object shrinkage, cleanup
  ARM: OMAP: /sys/kernel/debug/omap_gpio
  ARM: OMAP: Implement workaround for GPIO wakeup bug in OMAP2420 silicon
  ARM: OMAP: Enable 24xx GPIO autoidling
  [ARM] 4318/2: DSM-G600 Board Support
  [ARM] 4227/1: minor head.S fixups
  [ARM] 4328/1: Move i.MX UART regs to driver
  ...
2007-05-06 13:20:10 -07:00
Tony Lindgren d3af5abe9a mmc-omap: Clean up omap set_ios and make MMC_POWER_ON work
Move divisor calculation into a separate function and re-arrange the
init order to make MMC_POWER_ON work.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 16:36:00 +02:00
Tony Lindgren 46a6730e3f mmc-omap: Fix omap to use MMC_POWER_ON
As discussed earlier on LKML:

http://lkml.org/lkml/2006/5/4/44

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 16:34:16 +02:00
Arnaud Patard 3647afcec1 mmc-omap: add missing '\n'
This patch add a missing '\n' at the end of the 'cover is open' string
in mmc_omap_switch_handler().

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 16:18:36 +02:00
Adrian Bunk d97956f86b mmc: make tifm_sd_set_dma_data() static
This patch makes the needlessly global tifm_sd_set_dma_data() static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 16:14:29 +02:00
Pierre Ossman bd76631261 mmc: remove old card states
Remove card states that no longer make any sense.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 16:11:57 +02:00
Pierre Ossman 6abaa0c9fe mmc: support unsafe resume of cards
Since many have the system root on MMC/SD we must allow some foot
shooting when it comes to resume.

We cannot detect if a card is removed and reinserted during suspend,
so the safe approach would be to assume it was, avoiding potential
filesystem corruption. This will of course not work if you cannot
release the card before suspend.

This commit adds a compile time option that makes the MMC layer
assume the card wasn't touched if it is redetected upon resume.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 16:00:02 +02:00
Pierre Ossman 89a73cf52b mmc: separate out reading EXT_CSD
Separate the reading and decoding of the EXT_CSD register with the
actions taken on it.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 15:08:30 +02:00
Pierre Ossman 1addfcdbe4 mmc: break apart switch function
Break apart the SD switch function into one that reads the capabilities
and one that acts on them.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 14:46:08 +02:00
Philip Langdale 55556da012 MMC: Fix handling of low-voltage cards
Fix handling of low voltage MMC cards.

The latest MMC and SD specs both agree that support for
low-voltage operations is indicated by bit 7 in the OCR.
The MMC spec states that the low voltage range is
1.65-1.95V while the SD spec leaves the actual voltage
range undefined - meaning that there is still no such
thing as a low voltage SD card.

However, an old Sandisk spec implied that bits 7.0
represented voltages below 2.0V in 1V or 0.5V increments,
and the code was accordingly written with that expectation.

This confusion meant that host drivers attempting to support
the typical low voltage (1.8V) would set the wrong bits in
the host OCR mask (usually bits 5 and/or 6) resulting in the
the low voltage mode never being used.

This change corrects the low voltage range and adds sanity
checks on the reserved bits (0-6) and for SD cards that
claim to support low-voltage operations.

Signed-off-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 14:14:50 +02:00
Philip Langdale 4be34c99a2 MMC: Consolidate voltage definitions
Consolidate the list of available voltages.

Up until now, a separate set of defines has been
used for host->vdd than that used for the OCR
voltage mask values. Having two sets of defines
allows them to get out of sync and the current
sets are already inconsistent with one claiming
to describe ranges and the other specific voltages.

Only the SDHCI driver uses the host->vdd defines and
it is easily fixed to use the OCR defines.

Signed-off-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:42:28 +02:00
Pierre Ossman 7ea239d9e6 mmc: add bus handler
Delegate protocol handling to "bus handlers". This allows the core to
just handle the task of arbitrating the bus. Initialisation and
pampering of cards is now done by the different bus handlers.

This design also allows MMC and SD (and later SDIO) to be more cleanly
separated, allowing easier maintenance.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:41:06 +02:00
Pierre Ossman b2670b1c6d wbsd: check for data opcode earlier
Move the check for supported data opcodes to the beginning of the
request function to avoid wedging the card.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:35:19 +02:00
Pierre Ossman da7fbe58d2 mmc: Separate out protocol ops
Move protocol operations and definitions into their own files
in an effort to separate protocol handling and bus
arbitration more clearly.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:04:18 +02:00
Pierre Ossman aaac1b470b mmc: Move core functions to subdir
Create a "core" subdirectory to house the central bus handling
functions.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:04:18 +02:00
Pierre Ossman b855885e3b mmc: deprecate mmc bus topology
The classic MMC bus was defined as multi card bus
system, which is reflected in the design in the MMC
layer.

When SD showed up, the bus topology was abandoned
and a star topology (one card per host) was mandated.
MMC version 4 has followed this, officially deprecating
the bus topology.

As we do not have any known users of the bus
topology we can remove support for it. This will
simplify the code and rectify some incorrect
assumptions in the newer additions.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:04:18 +02:00
Pierre Ossman b5af25bee2 mmc: remove card upon suspend
Suspending MMC/SD cards (versus removing and readding them) is an
inherently unsafe operation and has even been broken for some time.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:04:18 +02:00
Pierre Ossman d2b46f66b4 mmc: allow suspended block driver to be removed
Make sure we don't deadlock when removing a suspended block
queue, something that might happen if the card is removed during
suspend.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:04:17 +02:00
Pierre Ossman 3b91e5507c mmc: Flush pending detects on host removal
Make sure we kill of any pending detection runs when the host
is removed instead of when it is freed. Also add some debugging
to make sure the driver doesn't queue up more detection after it
has removed the host.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:04:17 +02:00
Pierre Ossman 1c6a0718f0 mmc: Move host and card drivers to subdirs
Clean up the drivers/mmc directory by moving card and host drivers
into subdirectories.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:04:17 +02:00
Pierre Ossman 98ac216269 mmc: Move queue functions to mmc_block
The mmc block queue functions are tailored for the mmc_block
driver, so move those functions into that module.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:04:16 +02:00