diff mbox

[01/10,v2] mmc: block: add block number limitation flag for multiple block read

Message ID 87lhrco8pl.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kuninori Morimoto July 29, 2014, 8:44 a.m. UTC
From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>

In some controllers, when performing a multiple block read of
one or two blocks, depending on the timing with which the
response register is read, the response value may not
be read properly.
MMC_CAP2_NO_MULTI_READ flags disable all multiple block read,
but, it is over-kill for this issue.
This patch adds new MMC_CAP2_2BLKS_LIMIT to use single block read
when it was two blocks.
This is additional option of MMC_CAP2_NO_MULTI_READ

[Kuninori Morimoto: tidyup for upstreaming, and cared mach-shmobile]

Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-koelsch.c |    6 +++---
 arch/arm/mach-shmobile/board-lager.c   |    4 ++--
 drivers/mmc/card/block.c               |   19 +++++++++++++++++--
 drivers/mmc/host/sh_mobile_sdhi.c      |    2 +-
 include/linux/mmc/host.h               |    3 +++
 5 files changed, 26 insertions(+), 8 deletions(-)

Comments

Cao Minh Hiep July 31, 2014, 6:14 a.m. UTC | #1
Hi Magnus, Simon

I tested SDHI and MMCIF at Linux-upstream-v3.16-rc5 on Lager.
When I tried to read/write a 100MB or 350MB of data, kernel panic occurs.
I find out that error relates to HIGHMEM the commit "667d0f7 ARM: shmobile:
Enable HIGHMEM in shmobile_defconfig". Because, when I remove 
CONFIG_HIGHMEM
from config file, SDHI and MMCIF does not occur kernel panic error any more.

commit 667d0f7b0e940bf36e8d12bd7d64aa0f9217b3ac
Author: Magnus Damm<damm@opensource.se>
Date:   Wed Apr 2 18:06:24 2014 +0900

     ARM: shmobile: Enable HIGHMEM in shmobile_defconfig
     
     Many mach-shmobile hardware platforms include support for more
     than 1GiB of RAM. Enable HIGHMEM by default to allow use of
     larger amounts of memory.
     
     Signed-off-by: Magnus Damm<damm@opensource.se>
     Signed-off-by: Simon Horman<horms+renesas@verge.net.au>

I attach error log of SDHI and MMCIF and boot_log file.
So, Please fix this bug when you have time.


Best regards,
Cao Minh Hiep
root@linaro-nano:~# dmesg
Booting Linux on physical CPU 0x0
Linux version 3.16.0-rc5 (jinso@jinso-OptiPlex-980) (gcc version 4.8.3 20140401 (prereleas4
CPU: ARMv7 Processor [413fc0f2] revision 2 (ARMv7), cr=10c5347d
CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
Ignoring memory block 0x180000000 - 0x200000000
Machine model: Lager
debug: ignoring loglevel setting.
Memory policy: Data cache writealloc
On node 0 totalpages: 524288
free_area_init_node: node 0, pgdat c0603b00, node_mem_map ee7f9000
  Normal zone: 1520 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 194560 pages, LIFO batch:31
  HighMem zone: 2576 pages used for memmap
  HighMem zone: 329728 pages, LIFO batch:31
PERCPU: Embedded 5 pages/cpu @ee79e000 s6912 r0 d13568 u32768
pcpu-alloc: s6912 r0 d13568 u32768 alloc=8*4096
pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [0] 4 [0] 5 [0] 6 [0] 7 
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 522768
Kernel command line: console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 2073328K/2097152K available (4615K kernel code, 196K rwdata, 1068K rodata, 242K in)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
    vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
    lowmem  : 0xc0000000 - 0xef800000   ( 760 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
      .text : 0xc0008000 - 0xc0595f8c   (5688 kB)
      .init : 0xc0596000 - 0xc05d2b00   ( 243 kB)
      .data : 0xc05d4000 - 0xc0605280   ( 197 kB)
       .bss : 0xc0605288 - 0xc0636bf4   ( 199 kB)
Hierarchical RCU implementation.
NR_IRQS:16 nr_irqs:16 16
Architected cp15 timer(s) running at 10.00MHz (virt).
sched_clock: 56 bits at 10MHz, resolution 100ns, wraps every 3435973836800ns
Switching to timer-based delay loop
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS )
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
CPU0: update cpu_capacity 1535
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x40489258 - 0x404892b0
CPU1: Booted secondary processor
CPU1: update cpu_capacity 1535
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
CPU2: Booted secondary processor
CPU2: update cpu_capacity 1535
CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
CPU3: Booted secondary processor
CPU3: update cpu_capacity 1535
CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
CPU4: failed to boot: -22
CPU5: failed to boot: -22
CPU6: failed to boot: -22
CPU7: failed to boot: -22
Brought up 4 CPUs
SMP: Total of 4 processors activated.
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 4 part 30 variant f rev 0
pinctrl core: initialized pinctrl subsystem
regulator-dummy: no parameters
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
renesas_irqc e61c0000.interrupt-controller: driving 4 irqs
sh-pfc e6060000.pfc: r8a77900_pfc support registered
No ATAGs?
hw-breakpoint: Failed to enable monitor mode on CPU 1.
fixed-3.3V: 3300 mV 
platform regulator@1: Driver reg-fixed-voltage requests probe deferral
platform regulator@3: Driver reg-fixed-voltage requests probe deferral
gpio-regulator regulator@2: Could not obtain regulator setting GPIOs: -517
platform regulator@2: Driver gpio-regulator requests probe deferral
gpio-regulator regulator@4: Could not obtain regulator setting GPIOs: -517
platform regulator@4: Driver gpio-regulator requests probe deferral
vgaarb: loaded
SCSI subsystem initialized
libata version 3.00 loaded.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
Linux video capture interface: v2.00
sh_cmt sh-cmt-48-gen2.0: ch0: used for clock events
sh_cmt sh-cmt-48-gen2.0: ch1: used as clock source
Advanced Linux Sound Architecture Driver Initialized.
Switched to clocksource arch_sys_counter
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP: reno registered
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: CLS 0 bytes, default 64
futex hash table entries: 2048 (order: 5, 131072 bytes)
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
nfs4filelayout_init: NFSv4 File Layout Driver Registering...
msgmni has been set to 1473
bounce: pool size: 64 pages
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
gpio_rcar e6050000.gpio: Runtime PM disabled, clock forced on.
gpio_rcar e6050000.gpio: driving 32 GPIOs
gpio_rcar e6051000.gpio: Runtime PM disabled, clock forced on.
gpio_rcar e6051000.gpio: driving 32 GPIOs
gpio_rcar e6052000.gpio: Runtime PM disabled, clock forced on.
gpio_rcar e6052000.gpio: driving 32 GPIOs
gpio_rcar e6053000.gpio: Runtime PM disabled, clock forced on.
gpio_rcar e6053000.gpio: driving 32 GPIOs
gpio_rcar e6054000.gpio: Runtime PM disabled, clock forced on.
gpio_rcar e6054000.gpio: driving 32 GPIOs
gpio_rcar e6055000.gpio: Runtime PM disabled, clock forced on.
gpio_rcar e6055000.gpio: driving 32 GPIOs
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
SuperH (H)SCI(F) driver initialized
sh-sci e6e60000.serial: Runtime PM disabled, clock forced on.
e6e60000.serial: ttySC6 at MMIO 0xe6e60000 (irq = 184, base_baud = 0) is a scif
console [ttySC6] enabled
sh-sci e6e68000.serial: Runtime PM disabled, clock forced on.
e6e68000.serial: ttySC7 at MMIO 0xe6e68000 (irq = 185, base_baud = 0) is a scif
[drm] Initialized drm 1.1.0 20060810
rcar-du rcar-du-r8a7790: fb0:  frame buffer device
rcar-du rcar-du-r8a7790: registered panic notifier
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] No driver support for vblank timestamp query.
[drm] Initialized rcar-du 1.0.0 20130110 on minor 0
sata_rcar ee500000.sata: Runtime PM disabled, clock forced on.
scsi0 : sata_rcar
ata1: SATA max UDMA/133 irq 138
renesas_spi e6b10000.spi: Runtime PM disabled, clock forced on.
m25p80 spi0.0: s25fl512s (65536 Kbytes)
3 ofpart partitions found on MTD device spi0.0
Creating 3 MTD partitions on "spi0.0":
0x000000000000-0x000000040000 : "loader"
0x000000040000-0x000000440000 : "user"
0x000000440000-0x000004000000 : "flash"
renesas_spi e6b10000.spi: probed
spi_sh_msiof e6e10000.spi: Runtime PM disabled, clock forced on.
sh-eth ee700000.ethernet: Runtime PM disabled, clock forced on.
libphy: sh_mii: probed
sh-eth ee700000.ethernet eth0: Base address at 0xee700000, 2e:09:0a:00:6e:bc, IRQ 194.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-pci: OHCI PCI platform driver
mousedev: PS/2 mouse device common for all mice
rcar_thermal e61f0000.thermal: Runtime PM disabled, clock forced on.
rcar_thermal e61f0000.thermal: 1 sensor probed
sh_mobile_sdhi ee100000.sd: Runtime PM disabled, clock forced on.
sh_mobile_sdhi ee100000.sd: Got CD GPIO #902.
platform ee100000.sd: Driver sh_mobile_sdhi requests probe deferral
sh_mobile_sdhi ee140000.sd: Runtime PM disabled, clock forced on.
sh_mobile_sdhi ee140000.sd: Got CD GPIO #918.
platform ee140000.sd: Driver sh_mobile_sdhi requests probe deferral
sh_mmcif ee220000.mmc: Runtime PM disabled, clock forced on.
sh_mmcif ee220000.mmc: No vqmmc regulator found
of_dma_request_slave_channel: dma-names property of node '/mmc@ee220000' missing or empty
sh_mmcif ee220000.mmc: driver version 2010-04-28
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
Key type dns_resolver registered
SDHI0 Vcc: 3300 mV 
SDHI2 Vcc: 3300 mV 
SDHI0 VccQ: 1800 <--> 3300 mV at 3300 mV 
SDHI2 VccQ: 1800 <--> 3300 mV at 3300 mV 
sh_mobile_sdhi ee100000.sd: Runtime PM disabled, clock forced on.
sh_mobile_sdhi ee100000.sd: Got CD GPIO #902.
of_dma_request_slave_channel: dma-names property of node '/sd@ee100000' missing or empty
sh_mobile_sdhi ee100000.sd: mmc1 base at 0xee100000 clock rate 97 MHz
sh_mobile_sdhi ee140000.sd: Runtime PM disabled, clock forced on.
sh_mobile_sdhi ee140000.sd: Got CD GPIO #918.
ata1: link resume succeeded after 1 retries
of_dma_request_slave_channel: dma-names property of node '/sd@ee140000' missing or empty
ata1: SATA link down (SStatus 0 SControl 300)
sh_mobile_sdhi ee140000.sd: mmc2 base at 0xee140000 clock rate 48 MHz
input: gpio_keys as /devices/gpio_keys/input/input0
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
mmc0: BKOPS_EN bit is not set
mmc0: new high speed MMC card at address 0001
mmcblk0: mmc0:0001 MMC08G 7.32 GiB 
mmcblk0boot0: mmc0:0001 MMC08G partition 1 2.00 MiB
mmcblk0boot1: mmc0:0001 MMC08G partition 2 2.00 MiB
 mmcblk0: p1 p2
 mmcblk0boot1: unknown partition table
 mmcblk0boot0: unknown partition table
sh-eth ee700000.ethernet eth0: attached PHY 1 (IRQ 416) to driver Micrel KSZ8041RNLI
Sending DHCP requests ..
sh-eth ee700000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
., OK
IP-Config: Got DHCP answer from 172.16.1.27, my address is 172.16.1.35
IP-Config: Complete:
     device=eth0, hwaddr=2e:09:0a:00:6e:bc, ipaddr=172.16.1.35, mask=255.255.255.0, gw=1727
     host=172.16.1.35, domain=, nis-domain=(none)
     bootserver=172.16.1.27, rootserver=172.16.1.27, rootpath=
     nameserver0=172.16.1.27
SDHI2 VccQ: disabling
SDHI0 VccQ: disabling
SDHI2 Vcc: disabling
SDHI0 Vcc: disabling
ALSA device list:
  No soundcards found.
VFS: Mounted root (nfs filesystem) on device 0:13.
devtmpfs: mounted
Freeing unused kernel memory: 240K (c0596000 - c05d2000)
random: init urandom read with 65 bits of entropy available
random: nonblocking pool is initialized
systemd-udevd[657]: starting version 204
CPU4: failed to boot: -22
CPU5: failed to boot: -22
CPU6: failed to boot: -22
CPU7: failed to boot: -22
init: plymouth main process (571) killed by ABRT signal
init: plymouth-splash main process (962) terminated with status 2
init: failsafe main process (1014) killed by TERM signal
init: plymouth-stop pre-start process (1129) terminated with status 1
init: tty1 main process (1131) killed by TERM signal
root@linaro-nano:~# mount /dev/mmcblk0p1 /mnt/eMMC/
kjournald starting.  Commit interval 5 seconds
EXT3-fs (mmcblk0p1): using internal journal
EXT3-fs (mmcblk0p1): recovery complete
EXT3-fs (mmcblk0p1): mounted filesystem with ordered data mode
root@linaro-nano:~# mount -t tmpfs -o size=400m tmpfs /tmp/
root@linaro-nano:~# dd if=/dev/urandom of=/tmp/file-100mb bs=1M count=10

10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 3.29865 s, 3.2 MB/s
root@linaro-nano:~# 
root@linaro-nano:~# cp /tmp/file-100mb /mnt/eMMC/
root@linaro-nano:~# cUnable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 17 [#1] SMP ARM
CPU: 1 PID: 494 Comm: irq/202-ee22000 Not tainted 3.16.0-rc5 #1
task: ed972040 ti: ee3b8000 task.ti: ee3b8000
PC is at sh_mmcif_irqt+0x944/0xc18
LR is at sh_mmcif_irqt+0x30/0xc18
pc : [<c0355638>]    lr : [<c0354d24>]    psr: 80070013
sp : ee3b9ea8  ip : ee3b9ea8  fp : ee3b9efc
r10: 00000001  r9 : c005f688  r8 : ee3b8000
r7 : ee2eade0  r6 : ed8610f8  r5 : ed861034  r4 : edb76680
r3 : 00000000  r2 : 00000200  r1 : 00000000  r0 : edb766f8
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5347d  Table: 6d16806a  DAC: 00000015
Process irq/202-ee22000 (pid: 494, stack limit = 0xee3b8240)
Stack: (0xee3b9ea8 to 0xee3ba000)
9ea0:                   00000000 c005f688 00000000 ee010a74 60070013 00000001
9ec0: 00000003 edb766b4 c005f688 edb766f8 ee3b9f0c ee2eadc0 ee2eadc0 ee010a00
9ee0: ee2eade0 ee3b8000 c005f688 00000001 ee3b9f1c ee3b9f00 c005f6ac c0354d00
9f00: 00000004 ee010a00 ee2eadc0 ee3b8020 ee3b9f5c ee3b9f20 c005f990 c005f694
9f20: c0055b6c 00000000 00000000 c005f7e4 c005f898 ee2ead80 00000000 ee2eadc0
9f40: c005f898 00000000 00000000 00000000 ee3b9fac ee3b9f60 c003f5a0 c005f8a4
9f60: ee3b9f60 00000000 00000000 ee2eadc0 00000000 00000000 ee3b9f78 ee3b9f78
9f80: 00000000 00000000 ee3b9f88 ee3b9f88 ee2ead80 c003f4b0 00000000 00000000
9fa0: 00000000 ee3b9fb0 c000e958 c003f4bc 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
Backtrace: 
[<c0354cf4>] (sh_mmcif_irqt) from [<c005f6ac>] (irq_thread_fn+0x24/0x3c)
 r10:00000001 r9:c005f688 r8:ee3b8000 r7:ee2eade0 r6:ee010a00 r5:ee2eadc0
 r4:ee2eadc0
[<c005f688>] (irq_thread_fn) from [<c005f990>] (irq_thread+0xf8/0x174)
 r6:ee3b8020 r5:ee2eadc0 r4:ee010a00 r3:00000004
[<c005f898>] (irq_thread) from [<c003f5a0>] (kthread+0xf0/0x104)
 r10:00000000 r9:00000000 r8:00000000 r7:c005f898 r6:ee2eadc0 r5:00000000
 r4:ee2ead80
[<c003f4b0>] (kthread) from [<c000e958>] (ret_from_fork+0x14/0x3c)
 r7:00000000 r6:00000000 r5:c003f4b0 r4:ee2ead80
Code: e7f001f2 e5942068 e1530122 2a000004 (e4910004) 
---[ end trace 00854a296d6158ad ]---
Unable to handle kernel paging request at virtual address ffffffec
pgd = c0004000
[ffffffec] *pgd=6f7fd821, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#2] SMP ARM
CPU: 1 PID: 494 Comm: irq/202-ee22000 Tainted: G      D       3.16.0-rc5 #1
task: ed972040 ti: ee3b8000 task.ti: ee3b8000
PC is at kthread_data+0x10/0x18
LR is at irq_thread_dtor+0x58/0xb4
pc : [<c003f748>]    lr : [<c005f83c>]    psr: 20070113
sp : ee3b9c00  ip : ee3b9c10  fp : ee3b9c0c
r10: c0355638  r9 : 00000001  r8 : ee3b9c60
r7 : ee3b8008  r6 : c0600a68  r5 : ed972040  r4 : ed972040
r3 : 00000000  r2 : ee3b9c10  r1 : ee3b9f28  r0 : ed972040
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5347d  Table: 6d16806a  DAC: 00000015
Process irq/202-ee22000 (pid: 494, stack limit = 0xee3b8240)
Stack: (0xee3b9c00 to 0xee3ba000)
9c00: ee3b9c24 ee3b9c10 c005f83c c003f744 ed972040 00000000 ee3b9c44 ee3b9c28
9c20: c003d014 c005f7f0 00000000 ed972040 00000000 c035563a ee3b9c7c ee3b9c48
9c40: c0026cc4 c003cf68 c0024bc4 c05de72c ee3b9e60 0000000b c035563a ee3b8000
9c60: ee3b9c7c ee3b9c70 c0024c88 ee3b8000 ee3b9cfc ee3b9c80 c00120bc c0026934
9c80: ee3b8240 0000000b 00000000 60070113 00000008 00000000 65000000 30306637
9ca0: 20326631 34393565 38363032 35316520 32313033 61322032 30303030 28203430
9cc0: 31393465 34303030 c0002029 c047faa0 c054045e 00000000 00000017 00000000
9ce0: ee3b9e60 ed972040 00000000 00000017 ee3b9d14 ee3b9d00 c047f3e4 c0011e08
9d00: ee3b9e60 ee3b9e60 ee3b9db4 ee3b9d18 c001a358 c047f394 00000000 00000001
9d20: c006eb28 00000001 ed411c38 ee7a7440 c05cd440 00000001 c05d6714 c05d009c
9d40: 00000100 c05cd440 ee3b9d8c ee3b9d58 c0050f58 c0050cb0 c002ede8 c048564c
9d60: ee3b9d60 00000020 ee3b8010 ee3b8000 c05d0088 c05d009c 00000000 ee3b8010
9d80: ee3b9ddc ee3b9d90 c002893c 00000017 c05db210 00000000 ee3b9e60 ee3b8000
9da0: c005f688 00000001 ee3b9e5c ee3b9db8 c00091d8 c001a054 ee7a7440 ee3b8000
9dc0: c05ccaf4 00000000 ee3b9e6c 00000064 ee7a7440 ed9720f0 ee7a74f0 c05d6714
9de0: 00000000 ee7a7440 ee3b9e24 ee3b9df8 c0052fac c0051f94 c05cd440 ed972040
9e00: ee3b9e2c ee3b9e10 c002e8dc c04855f4 edb766c4 ee2eadc0 ee3b9e6c ee3b9e28
9e20: c003a36c c0037894 c002f58c c0485700 c0042dcc a0070093 edb766b4 ee2eadc0
9e40: c0355638 80070013 ffffffff ee3b9e94 ee3b9efc ee3b9e60 c0012958 c00091a8
9e60: edb766f8 00000000 00000200 00000000 edb76680 ed861034 ed8610f8 ee2eade0
9e80: ee3b8000 c005f688 00000001 ee3b9efc ee3b9ea8 ee3b9ea8 c0354d24 c0355638
9ea0: 80070013 ffffffff 00000000 c005f688 00000000 ee010a74 60070013 00000001
9ec0: 00000003 edb766b4 c005f688 edb766f8 ee3b9f0c ee2eadc0 ee2eadc0 ee010a00
9ee0: ee2eade0 ee3b8000 c005f688 00000001 ee3b9f1c ee3b9f00 c005f6ac c0354d00
9f00: 00000004 ee010a00 ee2eadc0 ee3b8020 ee3b9f5c ee3b9f20 c005f990 c005f694
9f20: c0055b6c 00000000 00000000 c005f7e4 c005f898 ee2ead80 00000000 ee2eadc0
9f40: c005f898 00000000 00000000 00000000 ee3b9fac ee3b9f60 c003f5a0 c005f8a4
9f60: ee3b9f60 00000000 00000000 ee2eadc0 00000000 00000000 ee3b9f78 ee3b9f78
9f80: 00000001 00010001 ee3b9f88 ee3b9f88 ee2ead80 c003f4b0 00000000 00000000
9fa0: 00000000 ee3b9fb0 c000e958 c003f4bc 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
Backtrace: 
[<c003f738>] (kthread_data) from [<c005f83c>] (irq_thread_dtor+0x58/0xb4)
[<c005f7e4>] (irq_thread_dtor) from [<c003d014>] (task_work_run+0xb8/0xd0)
 r5:00000000 r4:ed972040
[<c003cf5c>] (task_work_run) from [<c0026cc4>] (do_exit+0x39c/0x884)
 r6:c035563a r5:00000000 r4:ed972040 r3:00000000
[<c0026928>] (do_exit) from [<c00120bc>] (die+0x2c0/0x3c4)
 r7:ee3b8000
[<c0011dfc>] (die) from [<c047f3e4>] (__do_kernel_fault.part.11+0x5c/0x7c)
 r10:00000017 r9:00000000 r8:ed972040 r7:ee3b9e60 r6:00000000 r5:00000017
 r4:00000000
[<c047f388>] (__do_kernel_fault.part.11) from [<c001a358>] (do_page_fault+0x310/0x370)
 r7:ee3b9e60 r3:ee3b9e60
[<c001a048>] (do_page_fault) from [<c00091d8>] (do_DataAbort+0x3c/0xa0)
 r10:00000001 r9:c005f688 r8:ee3b8000 r7:ee3b9e60 r6:00000000 r5:c05db210
 r4:00000017
[<c000919c>] (do_DataAbort) from [<c0012958>] (__dabt_svc+0x38/0x60)
Exception stack(0xee3b9e60 to 0xee3b9ea8)
9e60: edb766f8 00000000 00000200 00000000 edb76680 ed861034 ed8610f8 ee2eade0
9e80: ee3b8000 c005f688 00000001 ee3b9efc ee3b9ea8 ee3b9ea8 c0354d24 c0355638
9ea0: 80070013 ffffffff
 r7:ee3b9e94 r6:ffffffff r5:80070013 r4:c0355638
[<c0354cf4>] (sh_mmcif_irqt) from [<c005f6ac>] (irq_thread_fn+0x24/0x3c)
 r10:00000001 r9:c005f688 r8:ee3b8000 r7:ee2eade0 r6:ee010a00 r5:ee2eadc0
 r4:ee2eadc0
[<c005f688>] (irq_thread_fn) from [<c005f990>] (irq_thread+0xf8/0x174)
 r6:ee3b8020 r5:ee2eadc0 r4:ee010a00 r3:00000004
[<c005f898>] (irq_thread) from [<c003f5a0>] (kthread+0xf0/0x104)
 r10:00000000 r9:00000000 r8:00000000 r7:c005f898 r6:ee2eadc0 r5:00000000
 r4:ee2ead80
[<c003f4b0>] (kthread) from [<c000e958>] (ret_from_fork+0x14/0x3c)
 r7:00000000 r6:00000000 r5:c003f4b0 r4:ee2ead80
Code: e1a0c00d e92dd800 e24cb004 e5903238 (e5130014) 
---[ end trace 00854a296d6158ae ]---
Fixing recursive fault but reboot is needed!
root@linaro-nano:~# mount -t tmpfs -o size=400m tmpfs /tmp/
root@linaro-nano:~# dd if=/dev/urandom of=/tmp/file-100mb bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 32.9928 s, 3.2 MB/s
root@linaro-nano:~# mount /dev/mmcblk1p1 /mnt/sd1/
kjournald starting.  Commit interval 5 seconds
EXT3-fs (mmcblk1p1): using internal journal
EXT3-fs (mmcblk1p1): mounted filesystem with ordered data mode
root@linaro-nano:~# sync; echo 3 > /proc/sys/vm/drop_caches
bash (1177): drop_caches: 3
root@linaro-nano:~# cp /tmp/file-100mb /mnt/sd1/
Unable to handle kernel paging request at virtual address ffc03000
pgd = c0004000
[ffc03000] *pgd=6f7fa811, *pte=00000000, *ppte=00000000
Internal error: Oops: 7 [#1] SMP ARM
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.16.0-rc5 #2
task: c05df418 ti: c05d4000 task.ti: c05d4000
PC is at __raw_writesw+0x1c/0xe4
LR is at __tmio_mmc_sdcard_irq+0x270/0x42c
pc : [<c047d5bc>]    lr : [<c0355de8>]    psr: 200f0193
sp : c05d5e2c  ip : 00000000  fp : c05d5e5c
r10: c06050f3  r9 : ee0107c0  r8 : 00000200
r7 : ffc00000  r6 : ed01a610  r5 : a00f0193  r4 : ed9e5a80
r3 : 00000000  r2 : 000000f8  r1 : ffc03000  r0 : f00bc030
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5347d  Table: 69a7c06a  DAC: 00000015
Process swapper/0 (pid: 0, stack limit = 0xc05d4240)
Stack: (0xc05d5e2c to 0xc05d6000)
5e20:                            ed9e5a80 a00f0193 c0355de8 02000000 ed9e5a80
5e40: 000000c7 00000000 00000000 ef7fcc40 c05d5e7c c05d5e60 c035615c c0355b84
5e60: 02000000 42800700 ed9e6d00 000000c7 c05d5eb4 c05d5e80 c005f174 c035611c
5e80: c0070fac c0047f94 ee7a01c0 ee0107c0 c05ebf04 00000000 c05d5f74 ef7fcc40
5ea0: 413fc0f2 00000000 c05d5ecc c05d5eb8 c005f2b4 c005f148 ee0107c0 c05ebf04
5ec0: c05d5ee4 c05d5ed0 c0062058 c005f278 000000c7 c05d1af4 c05d5efc c05d5ee8
5ee0: c005eb9c c0061fa8 000001a7 000000c7 c05d5f1c c05d5f00 c000f184 c005eb80
5f00: 000001a0 f0002000 c05d5f40 c05dc88c c05d5f3c c05d5f20 c0009320 c000f120
5f20: c000f484 c000f488 600f0013 ffffffff c05d5f94 c05d5f40 c00129c0 c00092e8
5f40: ee79e420 00000000 0011f146 00000000 c05d4018 c05d4000 c05d4000 c05c7dc0
5f60: ef7fcc40 413fc0f2 00000000 c05d5f94 c05d5f98 c05d5f88 c000f484 c000f488
5f80: 600f0013 ffffffff c05d5fa4 c05d5f98 c00562c0 c000f468 c05d5fb4 c05d5fa8
5fa0: c0480d0c c00561d8 c05d5ff4 c05d5fb8 c0596b74 c0480cb0 ffffffff ffffffff
5fc0: c0596644 00000000 00000000 c05c7dc0 00000000 c0605654 c05dc40c c05c7dbc
5fe0: c05e0498 4000406a 00000000 c05d5ff8 40008074 c05968b4 00000000 00000000
Backtrace: 
[<c0355b78>] (__tmio_mmc_sdcard_irq) from [<c035615c>] (tmio_mmc_irq+0x4c/0x6c)
 r8:ef7fcc40 r7:00000000 r6:00000000 r5:000000c7 r4:ed9e5a80 r3:02000000
[<c0356110>] (tmio_mmc_irq) from [<c005f174>] (handle_irq_event_percpu+0x38/0x130)
 r5:000000c7 r4:ed9e6d00
[<c005f13c>] (handle_irq_event_percpu) from [<c005f2b4>] (handle_irq_event+0x48/0x68)
 r10:00000000 r9:413fc0f2 r8:ef7fcc40 r7:c05d5f74 r6:00000000 r5:c05ebf04
 r4:ee0107c0
[<c005f26c>] (handle_irq_event) from [<c0062058>] (handle_fasteoi_irq+0xbc/0x144)
 r5:c05ebf04 r4:ee0107c0
[<c0061f9c>] (handle_fasteoi_irq) from [<c005eb9c>] (generic_handle_irq+0x28/0x38)
 r5:c05d1af4 r4:000000c7
[<c005eb74>] (generic_handle_irq) from [<c000f184>] (handle_IRQ+0x70/0x98)
 r4:000000c7 r3:000001a7
[<c000f114>] (handle_IRQ) from [<c0009320>] (gic_handle_irq+0x44/0x68)
 r6:c05dc88c r5:c05d5f40 r4:f0002000 r3:000001a0
[<c00092dc>] (gic_handle_irq) from [<c00129c0>] (__irq_svc+0x40/0x50)
Exception stack(0xc05d5f40 to 0xc05d5f88)
5f40: ee79e420 00000000 0011f146 00000000 c05d4018 c05d4000 c05d4000 c05c7dc0
5f60: ef7fcc40 413fc0f2 00000000 c05d5f94 c05d5f98 c05d5f88 c000f484 c000f488
5f80: 600f0013 ffffffff
 r6:ffffffff r5:600f0013 r4:c000f488 r3:c000f484
[<c000f45c>] (arch_cpu_idle) from [<c00562c0>] (cpu_startup_entry+0xf4/0x154)
[<c00561cc>] (cpu_startup_entry) from [<c0480d0c>] (rest_init+0x68/0x80)
[<c0480ca4>] (rest_init) from [<c0596b74>] (start_kernel+0x2cc/0x31c)
[<c05968a8>] (start_kernel) from [<40008074>] (0x40008074)
Code: 1afffff6 e92d4030 e2522008 4a00000e (e8b11038) 
---[ end trace b95a7313963532bd ]---
Kernel panic - not syncing: Fatal exception in interrupt
CPU1: stopping
CPU: 1 PID: 0 Comm: swapper/1 Tainted: G      D       3.16.0-rc5 #2
Backtrace: 
[<c0011bbc>] (dump_backtrace) from [<c0011df8>] (show_stack+0x18/0x1c)
 r6:c05d1af4 r5:00000000 r4:00000000 r3:00200040
[<c0011de0>] (show_stack) from [<c0484454>] (dump_stack+0x7c/0x98)
[<c04843d8>] (dump_stack) from [<c0014368>] (handle_IPI+0xcc/0x16c)
 r4:00000001 r3:600f0193
[<c001429c>] (handle_IPI) from [<c000933c>] (gic_handle_irq+0x60/0x68)
 r6:c05dc88c r5:ee09bf78 r4:f0002000 r3:00000005
[<c00092dc>] (gic_handle_irq) from [<c00129c0>] (__irq_svc+0x40/0x50)
Exception stack(0xee09bf78 to 0xee09bfc0)
bf60:                                                       ee7a6420 00000000
bf80: 0000542e 00000000 ee09a010 ee09a000 ee09a000 c06056cc 4000406a 413fc0f2
bfa0: 00000000 ee09bfcc ee09bfd0 ee09bfc0 c000f484 c000f488 600f0013 ffffffff
 r6:ffffffff r5:600f0013 r4:c000f488 r3:c000f484
[<c000f45c>] (arch_cpu_idle) from [<c00562c0>] (cpu_startup_entry+0xf4/0x154)
[<c00561cc>] (cpu_startup_entry) from [<c001402c>] (secondary_start_kernel+0x124/0x140)
[<c0013f08>] (secondary_start_kernel) from [<400093e4>] (0x400093e4)
 r4:6e06406a r3:c00093cc
CPU3: stopping
CPU: 3 PID: 0 Comm: swapper/3 Tainted: G      D       3.16.0-rc5 #2
Backtrace: 
[<c0011bbc>] (dump_backtrace) from [<c0011df8>] (show_stack+0x18/0x1c)
 r6:c05d1af4 r5:00000000 r4:00000000 r3:00200040
[<c0011de0>] (show_stack) from [<c0484454>] (dump_stack+0x7c/0x98)
[<c04843d8>] (dump_stack) from [<c0014368>] (handle_IPI+0xcc/0x16c)
 r4:00000003 r3:60070193
[<c001429c>] (handle_IPI) from [<c000933c>] (gic_handle_irq+0x60/0x68)
 r6:c05dc88c r5:ee09ff78 r4:f0002000 r3:00000005
[<c00092dc>] (gic_handle_irq) from [<c00129c0>] (__irq_svc+0x40/0x50)
Exception stack(0xee09ff78 to 0xee09ffc0)
ff60:                                                       ee7b6420 00000000
ff80: 000037ec 00000000 ee09e010 ee09e000 ee09e000 c06056cc 4000406a 413fc0f2
ffa0: 00000000 ee09ffcc ee09ffd0 ee09ffc0 c000f484 c000f488 60070013 ffffffff
 r6:ffffffff r5:60070013 r4:c000f488 r3:c000f484
[<c000f45c>] (arch_cpu_idle) from [<c00562c0>] (cpu_startup_entry+0xf4/0x154)
[<c00561cc>] (cpu_startup_entry) from [<c001402c>] (secondary_start_kernel+0x124/0x140)
[<c0013f08>] (secondary_start_kernel) from [<400093e4>] (0x400093e4)
 r4:6e06406a r3:c00093cc
CPU2: stopping
CPU: 2 PID: 0 Comm: swapper/2 Tainted: G      D       3.16.0-rc5 #2
Backtrace: 
[<c0011bbc>] (dump_backtrace) from [<c0011df8>] (show_stack+0x18/0x1c)
 r6:c05d1af4 r5:00000000 r4:00000000 r3:00200040
[<c0011de0>] (show_stack) from [<c0484454>] (dump_stack+0x7c/0x98)
[<c04843d8>] (dump_stack) from [<c0014368>] (handle_IPI+0xcc/0x16c)
 r4:00000002 r3:60070193
[<c001429c>] (handle_IPI) from [<c000933c>] (gic_handle_irq+0x60/0x68)
 r6:c05dc88c r5:ee09df78 r4:f0002000 r3:00000005
[<c00092dc>] (gic_handle_irq) from [<c00129c0>] (__irq_svc+0x40/0x50)
Exception stack(0xee09df78 to 0xee09dfc0)
df60:                                                       ee7ae420 00000000
df80: 00003e08 00000000 ee09c010 ee09c000 ee09c000 c06056cc 4000406a 413fc0f2
dfa0: 00000000 ee09dfcc ee09dfd0 ee09dfc0 c000f484 c000f488 60070013 ffffffff
 r6:ffffffff r5:60070013 r4:c000f488 r3:c000f484
[<c000f45c>] (arch_cpu_idle) from [<c00562c0>] (cpu_startup_entry+0xf4/0x154)
[<c00561cc>] (cpu_startup_entry) from [<c001402c>] (secondary_start_kernel+0x124/0x140)
[<c0013f08>] (secondary_start_kernel) from [<400093e4>] (0x400093e4)
 r4:6e06406a r3:c00093cc
drm_kms_helper: panic occurred, switching back to text console
---[ end Kernel panic - not syncing: Fatal exception in interrupt
diff mbox

Patch

diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index 2cd3194..4936436 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -333,7 +333,7 @@  SDHI_REGULATOR(2, RCAR_GP_PIN(7, 19), RCAR_GP_PIN(2, 26));
 static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
 	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
 			  MMC_CAP_POWER_OFF_CARD,
-	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_caps2	= MMC_CAP2_NO_2BLKS_READ,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT,
 };
 
@@ -346,7 +346,7 @@  static struct resource sdhi0_resources[] __initdata = {
 static struct sh_mobile_sdhi_info sdhi1_info __initdata = {
 	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
 			  MMC_CAP_POWER_OFF_CARD,
-	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_caps2	= MMC_CAP2_NO_2BLKS_READ,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT,
 };
 
@@ -359,7 +359,7 @@  static struct resource sdhi1_resources[] __initdata = {
 static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
 	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
 			  MMC_CAP_POWER_OFF_CARD,
-	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_caps2	= MMC_CAP2_NO_2BLKS_READ,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
 			  TMIO_MMC_WRPROTECT_DISABLE,
 };
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index b8b2b44..ad85f9d 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -634,7 +634,7 @@  static void __init lager_add_rsnd_device(void)
 static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
 	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
 			  MMC_CAP_POWER_OFF_CARD,
-	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_caps2	= MMC_CAP2_NO_2BLKS_READ,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
 			  TMIO_MMC_WRPROTECT_DISABLE,
 };
@@ -648,7 +648,7 @@  static struct resource sdhi0_resources[] __initdata = {
 static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
 	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
 			  MMC_CAP_POWER_OFF_CARD,
-	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_caps2	= MMC_CAP2_NO_2BLKS_READ,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
 			  TMIO_MMC_WRPROTECT_DISABLE,
 };
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 452782b..f3cbe37 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1400,8 +1400,23 @@  static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
 
 		/* Some controllers can't do multiblock reads due to hw bugs */
 		if (card->host->caps2 & MMC_CAP2_NO_MULTI_READ &&
-		    rq_data_dir(req) == READ)
-			brq->data.blocks = 1;
+		    rq_data_dir(req) == READ) {
+
+			if (card->host->caps2 & MMC_CAP2_2BLKS_LIMIT) {
+				/*
+				 * In some controllers, when performing a
+				 * multiple block read of one or two blocks,
+				 * depending on the timing with which the
+				 * response register is read, the response
+				 * value may not be read properly.
+				 * Use single block read for this HW bug
+				 */
+				if (brq->data.blocks == 2)
+					brq->data.blocks = 1;
+			} else {
+				brq->data.blocks = 1;
+			}
+		}
 	}
 
 	if (brq->data.blocks > 1 || do_rel_wr) {
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 91058da..b3baa83 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -55,7 +55,7 @@  static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = {
 static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = {
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
 	.capabilities	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
-	.capabilities2	= MMC_CAP2_NO_MULTI_READ,
+	.capabilities2	= MMC_CAP2_NO_2BLKS_READ,
 };
 
 static const struct of_device_id sh_mobile_sdhi_of_match[] = {
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7960424..3510fba 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -266,6 +266,9 @@  struct mmc_host {
 #define MMC_CAP2_BOOTPART_NOACC	(1 << 0)	/* Boot partition no access */
 #define MMC_CAP2_FULL_PWR_CYCLE	(1 << 2)	/* Can do full power cycle */
 #define MMC_CAP2_NO_MULTI_READ	(1 << 3)	/* Multiblock reads don't work */
+#define MMC_CAP2_2BLKS_LIMIT	(1 << 4)	/* 2 blocks limit for multi read */
+#define MMC_CAP2_NO_2BLKS_READ	(MMC_CAP2_NO_MULTI_READ | \
+				 MMC_CAP2_2BLKS_LIMIT)
 #define MMC_CAP2_HS200_1_8V_SDR	(1 << 5)        /* can support */
 #define MMC_CAP2_HS200_1_2V_SDR	(1 << 6)        /* can support */
 #define MMC_CAP2_HS200		(MMC_CAP2_HS200_1_8V_SDR | \