stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Wolfram Sang <wsa@the-dreams.de>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	H Hartley Sweeten <hsweeten@visionengravers.com>,
	Chris Ball <chris@printf.net>
Subject: [PATCH 3.12 021/107] mmc: core: sd: implement proper support for sd3.0 au sizes
Date: Tue, 11 Feb 2014 11:04:47 -0800	[thread overview]
Message-ID: <20140211184748.805516227@linuxfoundation.org> (raw)
In-Reply-To: <20140211184748.191276235@linuxfoundation.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Wolfram Sang <wsa@the-dreams.de>

commit 9288cac05405a7da406097a44721aa4004609b4d upstream.

This reverts and updates commit 77776fd0a4cc541b9 ("mmc: sd: fix the
maximum au_size for SD3.0"). The au_size for SD3.0 cannot be achieved
by a simple bit shift, so this needs to be implemented differently.
Also, don't print the warning in case of 0 since 'not defined' is
different from 'invalid'.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Chris Ball <chris@printf.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/core/sd.c |   37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -11,6 +11,7 @@
  */
 
 #include <linux/err.h>
+#include <linux/sizes.h>
 #include <linux/slab.h>
 #include <linux/stat.h>
 
@@ -44,6 +45,13 @@ static const unsigned int tacc_mant[] =
 	35,	40,	45,	50,	55,	60,	70,	80,
 };
 
+static const unsigned int sd_au_size[] = {
+	0,		SZ_16K / 512,		SZ_32K / 512,	SZ_64K / 512,
+	SZ_128K / 512,	SZ_256K / 512,		SZ_512K / 512,	SZ_1M / 512,
+	SZ_2M / 512,	SZ_4M / 512,		SZ_8M / 512,	(SZ_8M + SZ_4M) / 512,
+	SZ_16M / 512,	(SZ_16M + SZ_8M) / 512,	SZ_32M / 512,	SZ_64M / 512,
+};
+
 #define UNSTUFF_BITS(resp,start,size)					\
 	({								\
 		const int __size = size;				\
@@ -215,7 +223,7 @@ static int mmc_decode_scr(struct mmc_car
 static int mmc_read_ssr(struct mmc_card *card)
 {
 	unsigned int au, es, et, eo;
-	int err, i, max_au;
+	int err, i;
 	u32 *ssr;
 
 	if (!(card->csd.cmdclass & CCC_APP_SPEC)) {
@@ -239,26 +247,25 @@ static int mmc_read_ssr(struct mmc_card
 	for (i = 0; i < 16; i++)
 		ssr[i] = be32_to_cpu(ssr[i]);
 
-	/* SD3.0 increases max AU size to 64MB (0xF) from 4MB (0x9) */
-	max_au = card->scr.sda_spec3 ? 0xF : 0x9;
-
 	/*
 	 * UNSTUFF_BITS only works with four u32s so we have to offset the
 	 * bitfield positions accordingly.
 	 */
 	au = UNSTUFF_BITS(ssr, 428 - 384, 4);
-	if (au > 0 && au <= max_au) {
-		card->ssr.au = 1 << (au + 4);
-		es = UNSTUFF_BITS(ssr, 408 - 384, 16);
-		et = UNSTUFF_BITS(ssr, 402 - 384, 6);
-		eo = UNSTUFF_BITS(ssr, 400 - 384, 2);
-		if (es && et) {
-			card->ssr.erase_timeout = (et * 1000) / es;
-			card->ssr.erase_offset = eo * 1000;
+	if (au) {
+		if (au <= 9 || card->scr.sda_spec3) {
+			card->ssr.au = sd_au_size[au];
+			es = UNSTUFF_BITS(ssr, 408 - 384, 16);
+			et = UNSTUFF_BITS(ssr, 402 - 384, 6);
+			if (es && et) {
+				eo = UNSTUFF_BITS(ssr, 400 - 384, 2);
+				card->ssr.erase_timeout = (et * 1000) / es;
+				card->ssr.erase_offset = eo * 1000;
+			}
+		} else {
+			pr_warning("%s: SD Status: Invalid Allocation Unit size.\n",
+				   mmc_hostname(card->host));
 		}
-	} else {
-		pr_warning("%s: SD Status: Invalid Allocation Unit "
-			"size.\n", mmc_hostname(card->host));
 	}
 out:
 	kfree(ssr);



  parent reply	other threads:[~2014-02-11 19:04 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 19:04 [PATCH 3.12 000/107] 3.12.11-stable review Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 001/107] SELinux: Fix memory leak upon loading policy Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 002/107] tracing: Have trace buffer point back to trace_array Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 003/107] tracing: Check if tracing is enabled in trace_puts() Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 004/107] arch/sh/kernel/kgdb.c: add missing #include <linux/sched.h> Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 005/107] intel-iommu: fix off-by-one in pagetable freeing Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 006/107] Revert "EISA: Initialize device before its resources" Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 007/107] fuse: fix pipe_buf_operations Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 008/107] audit: reset audit backlog wait time after error recovery Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 009/107] audit: correct a type mismatch in audit_syscall_exit() Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 010/107] xen/pvhvm: If xen_platform_pci=0 is set dont blow up (v4) Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 011/107] mm/memory-failure.c: shift page lock from head page to tail page after thp split Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 012/107] mm/memcg: iteration skip memcgs not yet fully initialized Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 013/107] mm/page-writeback.c: fix dirty_balance_reserve subtraction from dirtyable memory Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 014/107] mm/page-writeback.c: do not count anon pages as " Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 015/107] memcg: fix endless loop caused by mem_cgroup_iter Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 016/107] memcg: fix css reference leak and endless loop in mem_cgroup_iter Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 017/107] mm: ignore VM_SOFTDIRTY on VMA merging Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 018/107] mm: dont lose the SOFT_DIRTY flag on mprotect Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 019/107] mmc: fix host release issue after discard operation Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 020/107] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA Greg Kroah-Hartman
2014-02-11 19:04 ` Greg Kroah-Hartman [this message]
2014-02-11 19:04 ` [PATCH 3.12 022/107] ARM: orion: provide C-style interrupt handler for MULTI_IRQ_HANDLER Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 023/107] ARM: mvebu: Fix kernel hang in mvebu_soc_id_init() when of_iomap failed Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 024/107] slub: Fix calculation of cpu slabs Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 025/107] turbostat: Dont put unprocessed uapi headers in the include path Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 027/107] ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 028/107] compat: fix sys_fanotify_mark Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 029/107] fs/compat: fix parameter handling for compat readv/writev syscalls Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 030/107] fs/compat: fix lookup_dcookie() parameter handling Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 031/107] tile: remove compat_sys_lookup_dcookie declaration to fix compile error Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 032/107] mtd: mxc_nand: remove duplicated ecc_stats counting Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.12 033/107] ore: Fix wrong math in allocation of per device BIO Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 034/107] xtensa: xtfpga: fix definitions of platform devices Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 035/107] IB/qib: Fix QP check when looping back to/from QP1 Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 036/107] spi/bcm63xx: dont substract prepend length from total length Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 037/107] spidev: fix hang when transfer_one_message fails Greg Kroah-Hartman
2014-02-20 12:42   ` Geert Uytterhoeven
2014-02-20 21:41     ` Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 038/107] spi/pxa2xx: initialize DMA channels to -1 to prevent inadvertent match Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 039/107] NFSv4: OPEN must handle the NFS4ERR_IO return code correctly Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 040/107] nfs4.1: properly handle ENOTSUP in SECINFO_NO_NAME Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 042/107] NFSv4.1: Handle errors correctly in nfs41_walk_client_list Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 043/107] nfs4: fix discover_server_trunking use after free Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 044/107] pnfs: Proper delay for NFS4ERR_RECALLCONFLICT in layout_get_done Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 045/107] NFSv4: Fix a slot leak in nfs40_sequence_done Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 046/107] sunrpc: Fix infinite loop in RPC state machine Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 047/107] sunrpc: dont wait for write before allowing reads from use-gss-proxy file Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 048/107] dm thin: fix discard support to a previously shared block Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 049/107] dm thin: initialize dm_thin_new_mapping returned by get_next_mapping Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 050/107] dm thin: fix set_pool_mode exposed pool operation races Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 051/107] dm: wait until embedded kobject is released before destroying a device Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 052/107] dm space map common: make sure new space is used during extend Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 053/107] dm space map metadata: fix extending the space map Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 054/107] dm space map metadata: fix bug in resizing of thin metadata Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 056/107] drm/radeon/dpm: disable mclk switching on desktop RV770 Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 058/107] mei: mei_hbm_dispatch() returns void Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 059/107] percpu_ida: Make percpu_ida_alloc + callers accept task state bitmask Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 060/107] iscsi-target: Fix connection reset hang with percpu_ida_alloc Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 061/107] mm, oom: base root bonus on current usage Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 062/107] media: media: v4l2-dev: fix video device index assignment Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 063/107] media: anysee: fix non-working E30 Combo Plus DVB-T Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 064/107] [media] dib8000: make 32 bits read atomic Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 065/107] [media] media: s5p_mfc: remove s5p_mfc_get_node_type() function Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 066/107] [media] it913x: Add support for Avermedia H335 id 0x0335 Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 067/107] [media] nxt200x: increase write buffer size Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 068/107] [media] dib8000: fix regression with dib807x Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 069/107] [media] m88rs2000: add m88rs2000_set_carrieroffset Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 070/107] [media] m88rs2000: set symbol rate accurately Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 072/107] drm/radeon: disable ss on DP for DCE3.x Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 073/107] drm/radeon: fix surface sync in fence on cayman (v2) Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 074/107] drm/radeon: set the full cache bit for fences on r7xx+ Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 075/107] drm/radeon: add UVD support for OLAND Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 076/107] drm/radeon: fix DAC interrupt handling on DCE5+ Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 077/107] drm/radeon/DCE4+: clear bios scratch dpms bit (v2) Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 078/107] drm/radeon/dce8: workaround for atom BlankCrtc table Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 079/107] dm sysfs: fix a module unload race Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 080/107] drm/nouveau: fix m2mf copy to tiled gart Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 081/107] drm/nouveau/falcon: use vmalloc to create firwmare copies Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 082/107] drm/i915: Flush outstanding requests before allocating new seqno Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 083/107] drm/i915: Fix the offset issue for the stolen GEM objects Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 084/107] drm/i915: VLV2 - Fix hotplug detect bits Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 085/107] i915: remove pm_qos request on error Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 087/107] drm/cirrus: correct register values for 16bpp Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 088/107] drm/gem: Always initialize the gem object in object_init Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 089/107] drm/rcar-du: Update plane pitch in .mode_set_base() operation Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 090/107] drm/gma500: Lock struct_mutex around cursor updates Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 091/107] drm: ast,cirrus,mgag200: use drm_can_sleep Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 092/107] drm/vmwgfx: Fix regression caused by "drm/ttm: make ttm reservation calls behave like reservation calls" Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.12 093/107] drm/mgag200: fix oops in cursor code Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 094/107] drm/mgag200: fix typo causing bw limits to be ignored on some chips Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 095/107] drm/mgag200,ast,cirrus: fix regression with drm_can_sleep conversion Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 096/107] ftrace: Synchronize setting function_trace_op with ftrace_trace_function Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 097/107] ftrace: Fix synchronization location disabling and freeing ftrace_ops Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 098/107] ftrace: Have function graph only trace based on global_ops filters Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 099/107] timekeeping: Fix lost updates to tai adjustment Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 100/107] timekeeping: Fix potential lost pv notification of time change Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 101/107] timekeeping: Avoid possible deadlock from clock_was_set_delayed Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 102/107] 3.13.y: timekeeping: Fix clock_set/clock_was_set think-o Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 103/107] timekeeping: Fix CLOCK_TAI timer/nanosleep delays Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 104/107] timekeeping: Fix missing timekeeping_update in suspend path Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 105/107] rtc-cmos: Add an alarm disable quirk Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 106/107] mmc: sdhci-pci: Fix BYT sd card getting stuck in runtime suspend Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.12 107/107] mmc: sdhci-pci: Fix possibility of chip->fixes being null Greg Kroah-Hartman
2014-02-12  4:21 ` [PATCH 3.12 000/107] 3.12.11-stable review Guenter Roeck
2014-02-12 18:49 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140211184748.805516227@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=chris@printf.net \
    --cc=hsweeten@visionengravers.com \
    --cc=jh80.chung@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).