From patchwork Tue Jun 25 11:39:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1122000 X-Patchwork-Delegate: van.freenix@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="0OWiifpl"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45Y42Z2G47z9s8m for ; Tue, 25 Jun 2019 21:39:50 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 00DC4C21CB1; Tue, 25 Jun 2019 11:39:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 936ABC21DD7; Tue, 25 Jun 2019 11:39:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 91A48C21CB6; Tue, 25 Jun 2019 11:39:15 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by lists.denx.de (Postfix) with ESMTPS id EFCE3C21C4A for ; Tue, 25 Jun 2019 11:39:14 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id h19so2100375wme.0 for ; Tue, 25 Jun 2019 04:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=GYS035Whsk1vgh45jKwDs7gBx04qQD2/C7KHNYr2crU=; b=0OWiifplWPjwPS5NsM1KCD7FTyalIYmR+lxuofSUR+rnFG+KfadXbDXC+SxUkr5sGY +kx15OjtfoEen9cirx4j3Z5Ay7HYKVkOk0LRWtiErNhZ0tzBlOGhEOPvTJ/gal101WD1 m31Fqebf4L3gIuNAWp5vLPwcPAD30DGz1+6yJE3Vkiuom4SCuTcNlJkxSrAHVBoYKSJa 0QP7yOpmsc/NhRqdKAyf4Um4NDHTuHVPyp1MSIZ6yO3ehOx0gOQvlgamaUg1q1WZzvr0 KtPz821EoY3WmvDpU8aYiGpLKj0fikB1wzvjaogWmNLqg06o57KfZH/zkCqs6bSsZ2yt ixKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=GYS035Whsk1vgh45jKwDs7gBx04qQD2/C7KHNYr2crU=; b=QkDjhkJrXXYYmvD4dC+weHlclVKWhoBoTbw3Yh/11oeVRNJapC+Lbs+PDSz7wpPljK ibxfJSuj60ove94wEl56vfxHivTcLG4zMZ4PavyP/tn/UVBLYaCDne1WdhDWSjOb3rkm 0pmV/pbsQTX9SgReDymICOTafMTYk46j2umEyMMYShyQ/SLytu1XRGm4v55JX67PylCI TQwJjdDkyZQQJ2Rc35FwOua5RDfSgoCMeqwuxR6ntt1Yo+1SLRw2fKcPKrCYBrtlOdKh G3Hi038AtS5UcbSWY/ugmm+u6ikS1m0mTYUg2Getr6l1zaKH9YwalLkgUq2yO/PnoEHi BPVg== X-Gm-Message-State: APjAAAWG8+lpImaEctgEiHVUDvnDENAvFY1yNc7fe4JntRw7eJMCflZI T4EyC5ecPZHUT7O0uvbFyaEDoDF7a2OaLA== X-Google-Smtp-Source: APXvYqzUM3jcs7oe5Z8iuhIL9uXDcXEzo9pyBBbj7qUx31W77fguQGKq9JqOrqgCMjj86OGr0aOsYQ== X-Received: by 2002:a1c:a508:: with SMTP id o8mr19798142wme.49.1561462754401; Tue, 25 Jun 2019 04:39:14 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id o20sm15977494wro.65.2019.06.25.04.39.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jun 2019 04:39:13 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, faiz_abbas@ti.com, peng.fan@nxp.com Date: Tue, 25 Jun 2019 13:39:01 +0200 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Cc: T Karthik Reddy Subject: [U-Boot] [PATCH v3 1/4] mmc: mvebu: Remove unused MMC_CAP.. macros X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: T Karthik Reddy Removed MMC_CAP_NONREMOVABLE, MMC_CAP_NEEDS_POLL macros from mvebu_mmc.h to avoid redefining of these macros when compiled with mvebu based configs. Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek --- Changes in v3: - New patch in this series to release macros Changes in v2: None include/mvebu_mmc.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/mvebu_mmc.h b/include/mvebu_mmc.h index d51b1fe4670e..7397165f67f6 100644 --- a/include/mvebu_mmc.h +++ b/include/mvebu_mmc.h @@ -222,13 +222,9 @@ #define MMC_CAP_SDIO_IRQ (1 << 3) /* Talks only SPI protocols */ #define MMC_CAP_SPI (1 << 4) -/* Needs polling for card-detection */ -#define MMC_CAP_NEEDS_POLL (1 << 5) /* Can the host do 8 bit transfers */ #define MMC_CAP_8_BIT_DATA (1 << 6) -/* Nonremovable e.g. eMMC */ -#define MMC_CAP_NONREMOVABLE (1 << 8) /* Waits while card is busy */ #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Allow erase/trim commands */ From patchwork Tue Jun 25 11:39:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1122002 X-Patchwork-Delegate: van.freenix@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="TTDo0yzf"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45Y43S6LrCz9s8m for ; Tue, 25 Jun 2019 21:40:36 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 8ACFBC21C51; Tue, 25 Jun 2019 11:39:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2156EC21C4A; Tue, 25 Jun 2019 11:39:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 08B55C21DF3; Tue, 25 Jun 2019 11:39:20 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by lists.denx.de (Postfix) with ESMTPS id 0937CC21DA2 for ; Tue, 25 Jun 2019 11:39:17 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id k11so17507004wrl.1 for ; Tue, 25 Jun 2019 04:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=cpjWLA3tmzqKkVz4QNFqzc0ZYxv8jets7plEaRw1ArE=; b=TTDo0yzftMDLwMKMFRBCA3xGgEDy5Tos0UfNirskJA2Loqb83m0drn1OX0uEnbjSbH DTHqxSttih7zBilMXaxGOroQj3TlH/ldmJ6leZW/zEmtKi6G+zC2537kwrpPpnxSaVHl XUF/ql+gP0Oe7upMDtQAnSm4YfP+G2I2Dnbj62pCGTwzg9sYCudGvRCjz2RqDePWkaov DX8q34UAO7Td1ZYV5du6u+GScvaYN1PGw9cFWjVmVpkYx1m7ZKOOW27FvBPU+ciQdugo mplJYHLTULn9xBS4iWqsMrE6bQoIhMvnT48NqKc2FIs4fhWHxwb8s3zxB0Mcv3IF0vAu R3eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=cpjWLA3tmzqKkVz4QNFqzc0ZYxv8jets7plEaRw1ArE=; b=g5X/amynxyWWtVkX4Bd8/4Jh7m7SdeptIYVALbyHLTQ4qDQ3kwo80JgTu9fLKiF3pK uFEVLdLSsXCfUvHHEXxN6KCNwcabmdQj/71BHaBmfof15k3yKM36sX8ZcbnXpyoZXRE3 dpZb0PbJmqgSwO3ga8ReX+MeyLthSpPdG5m3lx6L9Ebf7YCc9axuRlXpljLm5feCzBn3 QZY23J/HoQvrMLPDGUH5izT61vtbwJmHCyhVuFi04rSe54IvLwp+NodMVDFlTPqqnOwX o28fATZXGCHsJzzMKt7tSD2GVFqVNd8WrMNqkURilNNLf4RRSalXw7UW38gCZMCdFxex WwWQ== X-Gm-Message-State: APjAAAVxCHnwHRBdO8O8XT5f5ubNEPqCRnblHzocLMh8EW5qT2RW/+7e YZ3vbbPJxMSrs3GoDOb33yiuJF+vGd6DcQ== X-Google-Smtp-Source: APXvYqyg7QAJX8VAoKprCQswBfpW0mF6a5aRj/iB3ExN4Ri4JigNEVrLuUO/xgpdAuX76c1qKWhn+w== X-Received: by 2002:a5d:4a46:: with SMTP id v6mr22962509wrs.105.1561462756262; Tue, 25 Jun 2019 04:39:16 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id 67sm2492895wmd.38.2019.06.25.04.39.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jun 2019 04:39:15 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, faiz_abbas@ti.com, peng.fan@nxp.com Date: Tue, 25 Jun 2019 13:39:02 +0200 Message-Id: <0279d32d9d9ef93d6d1bc50f930d649172d71ad5.1561462741.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Cc: Baruch Siach , T Karthik Reddy , Marek Vasut Subject: [U-Boot] [PATCH v3 2/4] mmc: Read sd card detect properties from DT X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: T Karthik Reddy This patch reads card detect properties from device tree & added mmc capability macros in mmc.h. Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek --- Changes in v3: - Changed MMC_CAP_SD_NONREMOVABLE, MMC_CAP_SD_NEEDS_POLL names to align with Linux bit definitions by removing SD. Changes in v2: - Moved reading CD devicetree properties functionality from sdhci.c to mmc-uclass.c & moved mmc capability macros to mmc.h from sdhci.h. drivers/mmc/mmc-uclass.c | 9 +++++++++ include/mmc.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index a9c8f335c142..fa4d1af55d61 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -171,6 +171,15 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg) if (dev_read_bool(dev, "mmc-hs400-1_2v")) cfg->host_caps |= MMC_CAP(MMC_HS_400); + if (dev_read_bool(dev, "non-removable")) { + cfg->host_caps |= MMC_CAP_NONREMOVABLE; + } else { + if (dev_read_bool(dev, "cd-inverted")) + cfg->host_caps |= MMC_CAP_CD_ACTIVE_HIGH; + if (dev_read_bool(dev, "broken-cd")) + cfg->host_caps |= MMC_CAP_NEEDS_POLL; + } + return 0; } diff --git a/include/mmc.h b/include/mmc.h index 1f30f71d25f8..2be3e91fcb58 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -66,6 +66,10 @@ #define MMC_MODE_HS200 MMC_CAP(MMC_HS_200) #define MMC_MODE_HS400 MMC_CAP(MMC_HS_400) +#define MMC_CAP_NONREMOVABLE BIT(14) +#define MMC_CAP_NEEDS_POLL BIT(15) +#define MMC_CAP_CD_ACTIVE_HIGH BIT(16) + #define MMC_MODE_8BIT BIT(30) #define MMC_MODE_4BIT BIT(29) #define MMC_MODE_1BIT BIT(28) From patchwork Tue Jun 25 11:39:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1122003 X-Patchwork-Delegate: van.freenix@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="h2oyuXVR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45Y44L331Kz9s8m for ; Tue, 25 Jun 2019 21:41:22 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1AF38C21DB5; Tue, 25 Jun 2019 11:39:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 9DEE5C21E18; Tue, 25 Jun 2019 11:39:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6B297C21D65; Tue, 25 Jun 2019 11:39:21 +0000 (UTC) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by lists.denx.de (Postfix) with ESMTPS id B2E8DC21DC1 for ; Tue, 25 Jun 2019 11:39:18 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id r16so17442805wrl.11 for ; Tue, 25 Jun 2019 04:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=rrWiLwg6IstDYngsQpbsX0YD7PCMyUxCNFCy/X1vLqU=; b=h2oyuXVRDmAxpnXIojQ3RIKTlkQmaLDDjB4n0iSY2TROciiSskFQ1c5QgRrv3ZpDWs sTChR2kYW6vYhroxLHerJXzrmBPBg2VlEOUTyvkW+rlSRgqD/GTLaWStUxZ5gZ6LFFDw 9m7WV298sPxOH27zdEf/3zSg5i3Oj8RmEmYEnpCWhtKZgnOK7F4cJD2Syyn83ZannMsT MXJZT2BO2HUIinjlDS5UN+fRmGRfhfekDz0/fjzqUZc4q8D2Win8/ybfyJsZDqrpUsiR R/RZQ1I4m8AfBb9NUv8e88YP1ysRXXy1LwkAtpH/ELm8iRU4uSiiSXZrTu5dlvpJYFb3 4buQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=rrWiLwg6IstDYngsQpbsX0YD7PCMyUxCNFCy/X1vLqU=; b=qYIaWxEsTziLFO4uqxVaVFiq/mZfp3SK63NCxOMWXV2ZHf5ryZflVHvvzzZ1jfhray z5aVIctdxbevwYhuNj9tvJbnls/yLxFSg+h3oNZu6jNQZgoCuavwBBXXB0jZ8H5NnBLx g9my4u7oFmWRDNFJGZza5NJ3G883erAS0KplGRbNBJFko/FuEQ8rG6v9U4WgcAU/81Bz qtXoNx3TRObm83N+4HM4/7Mje4BjLzgYGgdKpBz7QuvqznxlgEu47Jh4pS/Iw4Sv7QQb E976Yae8GyLyfCmmzW9bI56ynjArwxJWkC4XUe1fPpDU8+aeTzB04GqW0TLkU3RV8RvJ gPUg== X-Gm-Message-State: APjAAAVDGndHqfVOe0OHuUsJ/sCsucb6Az3ugpLZhucG3ybbj1XHqiSq MIesMya7Tt1LfBjs9HCTd9bA2c8jY59D7A== X-Google-Smtp-Source: APXvYqznblY74IIxYwJEdOLlta20ZYgJGxCTmKLW/S1AUYRiGbzSL9tWOYAYA4rActENm9z1+iaTpA== X-Received: by 2002:a05:6000:128d:: with SMTP id f13mr27000120wrx.39.1561462757990; Tue, 25 Jun 2019 04:39:17 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id g19sm2214393wmg.10.2019.06.25.04.39.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jun 2019 04:39:17 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, faiz_abbas@ti.com, peng.fan@nxp.com Date: Tue, 25 Jun 2019 13:39:03 +0200 Message-Id: <5658008d944f1519cc0004d19d5a16c590b5e0de.1561462741.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Cc: T Karthik Reddy Subject: [U-Boot] [PATCH v3 3/4] mmc: sdhci: Read cd-gpio from devicetree X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: T Karthik Reddy This patch reads cd-gpio property from devicetree Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek Reviewed-by: Peng Fan --- Changes in v3: None Changes in v2: - Created a new patch for reading "cd-gpio" property from DT. drivers/mmc/sdhci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index e2bb90abbdf3..4ffe74e35e08 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -590,6 +590,12 @@ static int sdhci_set_ios(struct mmc *mmc) static int sdhci_init(struct mmc *mmc) { struct sdhci_host *host = mmc->priv; +#if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_GPIO) + struct udevice *dev = mmc->dev; + + gpio_request_by_name(dev, "cd-gpio", 0, + &host->cd_gpio, GPIOD_IS_IN); +#endif sdhci_reset(host, SDHCI_RESET_ALL); From patchwork Tue Jun 25 11:39:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1122004 X-Patchwork-Delegate: van.freenix@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="YNpiWy9p"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45Y44N5QQ5z9s8m for ; Tue, 25 Jun 2019 21:41:24 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7CF09C21CB6; Tue, 25 Jun 2019 11:40:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2A5C5C21DA6; Tue, 25 Jun 2019 11:39:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CA0DEC21DF3; Tue, 25 Jun 2019 11:39:23 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by lists.denx.de (Postfix) with ESMTPS id 4EDAFC21DED for ; Tue, 25 Jun 2019 11:39:20 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id n4so16277182wrs.3 for ; Tue, 25 Jun 2019 04:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=KtZKhW67ups92FFyfdcDEUmpk+v2CHvAU2/5/EXk6o4=; b=YNpiWy9pcx84hGUvT3W6gP5U7LekGxcuuZZjwqBq2fkqOYSj6kNgd+Lc/bm9uy0OH8 qEgt5XI8ZZ5Cp8UFKXAdcyW0poUF0MdnDvmrw82wZIvXDmdKSLX12d3G5ItWQ8S7Kvxu OMSmYFNhQB9jmsQBKRIa/bDKPRuTpBtvxm6E7Gxjv+t1ICbCeq5vg5Y3rei7g6EqG2Ix R4yb6D48sOePKR3xnNFQatGbq3F7tm3V+edtVano8U9CPlu8nqrhd/7mAC7ZCapaUU3P oPHjAtHEa6cB/fkK5ohbKyfG86kgiIf5DWTMzQgnDRx0hB7Zt67VizXtdRN8P43n58dj 3bCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=KtZKhW67ups92FFyfdcDEUmpk+v2CHvAU2/5/EXk6o4=; b=CV5Fnop9YWkuGvPhjGraM7vwItIWSNJq4RXIUqkPTX0NT7ns4BpoxY1nxXZGmpoaLa W7fXYcrtrKwsScAMjwRwSTN/75R+k6LaJYIgncJE/lXWY/H6TCNZwIpWgXFrrAVoDh1c s0F/dHvvQdrSHG3Mkdbd0YneABvruXHQrUn+SqRsbz4xZQBr4WitJAHJ6+iBSVHT90Fu cN+oEZpgPRak57Mr7vVeO7NdTKI9uOQwHKCcpok5xI9bOeGyVWTT1w5FGN9chRirfV5q zPUdcdD9CmWJhRS91IbKZsJvYtKo4cDTsNhN2lWFnxoiqjWcxbfIRuk1CWwgbHXapOpv sclQ== X-Gm-Message-State: APjAAAX3CWQa7xVJlUyqz3KK6U3dpPf+8TCmk0IqQbt0MxL2m68IX1FB RQaYFMdPKPEAI7AWlC9odM+tbRPr0Rby8g== X-Google-Smtp-Source: APXvYqwK3M6Fk6nZs0VT2vWiOXMHo4TrQzbo8cAaXrI+rwdHbwe0J9EDj9LbN1hAwgHq4KiY20o2Zw== X-Received: by 2002:a5d:66ce:: with SMTP id k14mr48768544wrw.308.1561462759739; Tue, 25 Jun 2019 04:39:19 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id t12sm14890256wrw.53.2019.06.25.04.39.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jun 2019 04:39:19 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, faiz_abbas@ti.com, peng.fan@nxp.com Date: Tue, 25 Jun 2019 13:39:04 +0200 Message-Id: <476dbfb8926b7a7dd77bc4c9afe89a58e6869959.1561462741.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Cc: T Karthik Reddy Subject: [U-Boot] [PATCH v3 4/4] mmc: sdhci: Implement SDHCI card detect X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: T Karthik Reddy Card detect function implemented for SDHCI framework. Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek --- Changes in v3: - Use new MMC_SD.. macros Changes in v2: - Used CARD_PRESENT instead of SDHCI_CARD_DETECT_PIN_LEVEL for reading sd card presence detection. drivers/mmc/sdhci.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 4ffe74e35e08..c4e88790bc68 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -12,6 +12,7 @@ #include #include #include +#include #if defined(CONFIG_FIXED_SDHCI_ALIGNED_BUFFER) void *aligned_buffer = (void *)CONFIG_FIXED_SDHCI_ALIGNED_BUFFER; @@ -630,9 +631,40 @@ int sdhci_probe(struct udevice *dev) return sdhci_init(mmc); } +int sdhci_get_cd(struct udevice *dev) +{ + struct mmc *mmc = mmc_get_mmc_dev(dev); + struct sdhci_host *host = mmc->priv; + int value; + + /* If nonremovable, assume that the card is always present. */ + if (mmc->cfg->host_caps & MMC_CAP_NONREMOVABLE) + return 1; + /* If polling, assume that the card is always present. */ + if (mmc->cfg->host_caps & MMC_CAP_NEEDS_POLL) + return 1; + +#if CONFIG_IS_ENABLED(DM_GPIO) + value = dm_gpio_get_value(&host->cd_gpio); + if (value >= 0) { + if (mmc->cfg->host_caps & MMC_CAP_CD_ACTIVE_HIGH) + return !value; + else + return value; + } +#endif + value = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & + SDHCI_CARD_PRESENT); + if (mmc->cfg->host_caps & MMC_CAP_CD_ACTIVE_HIGH) + return !value; + else + return value; +} + const struct dm_mmc_ops sdhci_ops = { .send_cmd = sdhci_send_command, .set_ios = sdhci_set_ios, + .get_cd = sdhci_get_cd, #ifdef MMC_SUPPORTS_TUNING .execute_tuning = sdhci_execute_tuning, #endif