From patchwork Mon Jan 26 21:04:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 5712681 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CE1F1C058D for ; Mon, 26 Jan 2015 21:05:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6211B2015A for ; Mon, 26 Jan 2015 21:05:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A629B20123 for ; Mon, 26 Jan 2015 21:05:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755904AbbAZVFD (ORCPT ); Mon, 26 Jan 2015 16:05:03 -0500 Received: from mail-we0-f177.google.com ([74.125.82.177]:58237 "EHLO mail-we0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755573AbbAZVFC (ORCPT ); Mon, 26 Jan 2015 16:05:02 -0500 Received: by mail-we0-f177.google.com with SMTP id l61so11371326wev.8; Mon, 26 Jan 2015 13:05:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:user-agent:cc:mime-version:content-type :content-transfer-encoding:message-id; bh=92vdgt6p5OYZ7Taqko5hzCxVedGy89/KqHmpEKX1o0c=; b=WxvIgryHW8YkHxdcbvAIyXcT7RdJk4NP/9y8k4h4gCI/XPP3mPIA3d9RRS8Wo8rXC7 QCle7NDH4MbNPuCmye3o0LfBIvOScGZduHsgf+ZIFEEZ+VbhQjWCozpKnltanPAqeG1w PQAoinNU7oKV29+EzF2sjmL9GyXstwbPTOtiQvi9sDPtCVyNuX8BHpJf9qhVsch/m8eI wXsA8N5f+jHHMLhmUifHe/34/XOEI0TuJ/dm50EUvduBe7efaD358hK3SiG2SxWLCHXS JTq0WO5vG8zNSRm91wVPSPBLpglxrbQxltit3fuVW1x7wUPp4sosrmNcp6vdGXc8KFwk x3jw== X-Received: by 10.194.234.40 with SMTP id ub8mr41496587wjc.100.1422306300858; Mon, 26 Jan 2015 13:05:00 -0800 (PST) Received: from pali-latitude.localnet ([2001:718:1e03:a01::1ca]) by mx.google.com with ESMTPSA id fc6sm15439122wib.12.2015.01.26.13.04.59 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 13:05:00 -0800 (PST) From: Pali =?utf-8?q?Roh=C3=A1r?= To: Chris Ball , Ulf Hansson Subject: mmc does not work in qemu n900 Date: Mon, 26 Jan 2015 22:04:59 +0100 User-Agent: KMail/1.13.7 (Linux/3.13.0-44-generic; KDE/4.14.2; x86_64; ; ) Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Pavel Machek , Ivaylo Dimitrov , Sebastian Reichel , Aaro Koskinen MIME-Version: 1.0 Message-Id: <201501262204.59305@pali> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, for unknown reason kernel in qemu n900 machine is not able to detect internal eMMC memory. External SD card is detected without problem. If I apply this one-line patch eMMC in qemu start working: I have no idea where is problem. I also do not understand mmc kernel code, but second patch I have on my HDD since 2.6.37. Can somebody with knowledge of mmc subsystem look at this problem? Why any of these two patches fix problem when mmc is not detected by kernel in qemu (machine n900)? Detection of mmc fails because function mmc_send_op_cond() without one of above patches fails. diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9584bff..0d4461c 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2337,6 +2337,9 @@ static int mmc_rescan_try_freq( return 0; if (!mmc_attach_sd(host)) return 0; + + mmc_go_idle(host); + if (!mmc_attach_mmc(host)) return 0; I played with mmc and qemu n900 a bit and also this simple patch (without first) fix problem (that mmc is not detected by kernel): diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 3b044c5..0c93a2c 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -157,6 +157,10 @@ int mmc_send_op_cond( BUG_ON(!host); + /* reset mmc before calling op_cond */ + memset(&cmd, 0, sizeof(struct mmc_command)); + mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); + cmd.opcode = MMC_SEND_OP_COND; cmd.arg = mmc_host_is_spi(host) ? 0 : ocr; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR;