From nobody Fri Feb 13 17:34:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E607E7D0C3 for ; Fri, 22 Sep 2023 01:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbjIVBvS (ORCPT ); Thu, 21 Sep 2023 21:51:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbjIVBvR (ORCPT ); Thu, 21 Sep 2023 21:51:17 -0400 Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30E4F114 for ; Thu, 21 Sep 2023 18:51:09 -0700 (PDT) Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1d6b5292aebso870165fac.1 for ; Thu, 21 Sep 2023 18:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695347469; x=1695952269; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AdU57Jx9PEmIXARyS6MsKYI5yf8mmNXKxZvGJyz9CZ0=; b=QniIRoY87sMEV/oz9MY1HtCu+GALB1T3w0zgnjNUCynTEV+9gbKJGfQS+5nJYpkXlz UHB6FumCvDCj3EJJ8l4nVuOtQn8W94SzBi11XsmK4XofsAETnFCUKKtH5PJKfMWBEV4Z SHeuU/De+E5v/uhrZqR+zMYO7nf8stxkTcs0+a4UbaOadRnwsPVLwhL/OJk8MtX7ElpV nDFJYYwce/cOZaI+GNz8gg/1eTtN/U71vwjuepRW07eflQuRlHV2LGQJkXdDxdvFwbsV dQv0bP+R1LLQVXO6uP3CmD5nJCCaTYFsDFN5miteS5CLtCR2wObu1Eca8vvGMsGypJrr 6Diw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695347469; x=1695952269; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AdU57Jx9PEmIXARyS6MsKYI5yf8mmNXKxZvGJyz9CZ0=; b=lE4Q/DLJz5Sh2C/9pMjUz9JzCDGQo0xWDZuJR6LruOUbgf9nIK7sMB2LyMs/iWaVVz k0cRohoMKCBnWghLDguCg8OkxNcrAPSivLFc9G69eYoW1g0KqB65txp+4GIjuy71UtsG gbRUQlbnIbLVjibFmgKSUmysahSH4UlnmqJqMZ84iLX6kvrJ067eck63atjPubrRgV6S Juo0gpm4kHprX279rS8PFTTTtrNgaxrxVhZP7c9ggfWPxcUvhubY/bpUvJYZbct5R+a1 2oj3HMp8h+wPcwAHNNRXYDnDpmmDsHYYv5woqiEVUJUfcLFFZLrKvo3X/lVlCyffO3Kd hLpg== X-Gm-Message-State: AOJu0Yzuee1ECG35b0bAQkRyKu7FlrsWa5mTlYSDT1+/m9ufKZOfCoCJ zVALsjKRWUgWiD26383BmkAebQ== X-Google-Smtp-Source: AGHT+IHBIOCNTfL32DX8sqcPvGCoAvfb0oRHov683BI2vSEw1XFpc+I3dbfeffGIcS9K8qEUO9NE9Q== X-Received: by 2002:a05:6870:3293:b0:1be:ccce:7991 with SMTP id q19-20020a056870329300b001beccce7991mr7369865oac.13.1695347469207; Thu, 21 Sep 2023 18:51:09 -0700 (PDT) Received: from [127.0.1.1] ([2601:1c2:1800:f680:fa26:6227:be1c:67f0]) by smtp.gmail.com with ESMTPSA id y10-20020a63b50a000000b0057412d84d25sm1973856pge.4.2023.09.21.18.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:51:08 -0700 (PDT) From: Drew Fustini Date: Thu, 21 Sep 2023 18:49:48 -0700 Subject: [PATCH 1/6] dt-bindings: mmc: sdhci-of-dwcmhsc: Add T-Head TH1520 support MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230921-th1520-mmc-v1-1-49f76c274fb3@baylibre.com> References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> In-Reply-To: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jisheng Zhang , Adrian Hunter , Guo Ren , Fu Wei , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley Cc: Robert Nelson , Jason Kridner , Xi Ruoyao , Han Gao , Icenowy Zheng , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Drew Fustini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1695347467; l=1067; i=dfustini@baylibre.com; s=20230430; h=from:subject:message-id; bh=lVStiUHxeHbyNt2+zib4d2cdPudtKK6oNMBUQREoPOc=; b=Q8id6rVsSYwP6E+iXtE8EEJBdpfTwGmm0EDwKwz276FYyD9CgqZLnz0ACffcwGavDc/d0fScS a4r/IUtRvh1A4kShsI9oBwJNbY9Otbdr+VEmtnmc12pL4kS6vyLRKBn X-Developer-Key: i=dfustini@baylibre.com; a=ed25519; pk=p3GKE9XFmjhwAayAHG4U108yag7V8xQVd4zJLdW0g7g= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add compatible value for the T-Head TH1520 dwcmshc controller and add thead,phy-pull-up property. Signed-off-by: Drew Fustini Tested-by: Xi Ruoyao --- Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml = b/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml index a43eb837f8da..46b768d46712 100644 --- a/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml +++ b/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml @@ -19,6 +19,7 @@ properties: - rockchip,rk3568-dwcmshc - rockchip,rk3588-dwcmshc - snps,dwcmshc-sdhci + - thead,th1520-dwcmshc =20 reg: maxItems: 1 @@ -60,6 +61,9 @@ properties: description: Specify the number of delay for tx sampling. $ref: /schemas/types.yaml#/definitions/uint8 =20 + thead,phy-pull-up: + description: Enable weak pull-up on PHY pads + type: boolean =20 required: - compatible --=20 2.34.1 From nobody Fri Feb 13 17:34:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4CE4E7D0BE for ; Fri, 22 Sep 2023 01:51:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230321AbjIVBvX (ORCPT ); Thu, 21 Sep 2023 21:51:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjIVBvR (ORCPT ); Thu, 21 Sep 2023 21:51:17 -0400 Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EBCD195 for ; Thu, 21 Sep 2023 18:51:11 -0700 (PDT) Received: by mail-ua1-x92e.google.com with SMTP id a1e0cc1a2514c-7a282340fdfso694331241.0 for ; Thu, 21 Sep 2023 18:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695347470; x=1695952270; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ixTqiGVx8ZXpjpR7y6lRGGFsz7OZ+ET+MZdQ4NUAsFY=; b=0BJaoaU9XC4nRsOaixYnv7sFr6wZ+OzRUAHSrqBaxDbv1QODUjSQlNmiXQ3LqlMb9M 8Rn+AherQVkpmDua9c3SV3IlLaruQkaMlPl00dxge+ZhLpQBt8gVEO140LGysAdrgH08 sWpMUdsisqUbrNrOanobDjOOQlFYF04tgJiPd/qjw/dhdw+aRGz0oLe+ltzLrPUXMHun XaGi5dsH+PMzEWeXsyo7+tYcf5POJ+VbXP8w6Do8ILFFR/t4VmxQhTHMaH7lr16Aw6pJ z2ZQ6N7NZk182Y9wOaIVJuFj9vumFEzB8TXosPtzIny3h3i23SrmsB4+2SEBO/RLtSoN Lj1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695347470; x=1695952270; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ixTqiGVx8ZXpjpR7y6lRGGFsz7OZ+ET+MZdQ4NUAsFY=; b=b+pUsf4PdCWZn0RorvHCsRa+BPBw3lsSDILrl5zr+F5LwK/FTWXYIybVjh13BtKqBE 03nfqDeJHIbssd/tdYCI7FkBU1Gd2zcplIa9qtePJ5b51tetIfvY9s93xLviF/qcdnjk IRVSp/QhpfupshI0ZPVHfC4e5e9H1QrMbnyoOtM6jCl52iEeFegjgzdqUQxEkuDSK3hf XAtPADPzd3grlTSIXu1JIoF9HJogK3Qn4DomMG5VNPm6+AseGHJTELE9V9AnPugAp1Bq +QpxezJPfTlxz6bOBXZAksEb7aCTW/a9LLbYJgeWVP61gnsJ07fG0f/pmNEKCem4Mx6m n30w== X-Gm-Message-State: AOJu0YwrZRnNmz4WTgL34m5/AVZTThrjDyozokOOPO3RBMMm/X4oAtxM xGCXww1qGJS/OJFn+UyoI7Urig== X-Google-Smtp-Source: AGHT+IHj0Lr/Be8FAt3qA85CiKz6e+2ivU8VOj029IZto83YwRL3xxqYZvq42aLws+pyGjAy7HTN1A== X-Received: by 2002:a05:6102:302c:b0:44d:4d5f:79a4 with SMTP id v12-20020a056102302c00b0044d4d5f79a4mr6139892vsa.20.1695347470206; Thu, 21 Sep 2023 18:51:10 -0700 (PDT) Received: from [127.0.1.1] ([2601:1c2:1800:f680:fa26:6227:be1c:67f0]) by smtp.gmail.com with ESMTPSA id y10-20020a63b50a000000b0057412d84d25sm1973856pge.4.2023.09.21.18.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:51:09 -0700 (PDT) From: Drew Fustini Date: Thu, 21 Sep 2023 18:49:49 -0700 Subject: [PATCH 2/6] mmc: sdhci: add __sdhci_execute_tuning() to header MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230921-th1520-mmc-v1-2-49f76c274fb3@baylibre.com> References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> In-Reply-To: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jisheng Zhang , Adrian Hunter , Guo Ren , Fu Wei , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley Cc: Robert Nelson , Jason Kridner , Xi Ruoyao , Han Gao , Icenowy Zheng , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Drew Fustini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1695347467; l=1797; i=dfustini@baylibre.com; s=20230430; h=from:subject:message-id; bh=jbhsItAspw9Y505sHjMPZkocmfoBMXCEAbwf8HhAE8A=; b=Y7zI2YH3NQD0FaxiSQ4VnQS2RFqoHRb3cydOhAc2I8kHbSV81T3H1sj3MdzwctHhwtJlv39EH CGD7yjz/YJWDePGxpJZ2guSYNA4iKk5mDzTqvA3yDNkTUQHmVRbKFIQ X-Developer-Key: i=dfustini@baylibre.com; a=ed25519; pk=p3GKE9XFmjhwAayAHG4U108yag7V8xQVd4zJLdW0g7g= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Expose __sdhci_execute_tuning() so that it can be called from the mmc host controller drivers. In the sdhci-of-dwcmshc driver, sdhci_dwcmshc_th1520_ops sets platform_execute_tuning to th1520_execute_tuning(). That function has to manipulate phy registers before tuning can be performed. To avoid copying the code verbatim from __sdhci_execute_tuning() into th1520_execute_tuning(), make it possible for __sdhci_execute_tuning() to be called from sdhci-of-dwcmshc. Signed-off-by: Drew Fustini Tested-by: Xi Ruoyao --- drivers/mmc/host/sdhci.c | 2 +- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ff41aa56564e..fd607058d176 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2841,7 +2841,7 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 o= pcode) } EXPORT_SYMBOL_GPL(sdhci_send_tuning); =20 -static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) +int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) { int i; =20 diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index f219bdea8f28..a20864fc0641 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -793,6 +793,7 @@ void sdhci_set_bus_width(struct sdhci_host *host, int w= idth); void sdhci_reset(struct sdhci_host *host, u8 mask); void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing); int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode); +int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode); void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios); --=20 2.34.1 From nobody Fri Feb 13 17:34:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 029A4E7D0BE for ; Fri, 22 Sep 2023 01:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230389AbjIVBvd (ORCPT ); Thu, 21 Sep 2023 21:51:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjIVBvT (ORCPT ); Thu, 21 Sep 2023 21:51:19 -0400 Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B1BA19A for ; Thu, 21 Sep 2023 18:51:12 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-59be6605e1dso19781637b3.3 for ; Thu, 21 Sep 2023 18:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695347471; x=1695952271; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=1Qr4tSpb4BNnKQQwWMoToDq5tTNIzWA+Sp0qHl9b8Mo=; b=CSA8i5kcymfHf2WS5lddUG9vOG6kVpnonhsZGltrXNGq2HsnzsVydt5qYwZvS/RArc KLtFejXhoE/Y8VMHgouQ1/xqeH4OByPaA25LZs5dti7Xsbz16xrQzuKP2obtJMW8YQzz x6T3oIhLxuAnvz33xphPxteqe4Gplj0n77hEnmNfu2gqGEHyQkOjge0WwTqpHiPVQ2aa 4CeqNyDjXzqxo+FHqNFUUwBaoc4hJaGtMdU1sZS2VyYLny5qTYmBmC1sT6Cl55O2qHQD ZurUgy8kph4wJp8U6iFj2ibarjdQEHK0iwH/zBiGyEFZC5tF2OoGyQSKAJHJzx6lh7di iOXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695347471; x=1695952271; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1Qr4tSpb4BNnKQQwWMoToDq5tTNIzWA+Sp0qHl9b8Mo=; b=KQIa0tYf0Ja9+b2H/QngQVsf8iWCD3cPslqn+qX7hp39efdW7HP6P7Q+6FRB8am6Y9 IbhZLEizAJE3ZPofhJhTW+vgloKF9JZMyTdEK/lR2m1whcv0XIre0rllJNOJXfoMgqbu ae2W8tmb6wXscm5KRb6eJGmAiv55zOwAywa7Ssd/kX932SmBFXirW0TX+nhCg7y70pcU r86BcT2cCJk12qHMlx0V9LzJb1A3tXisTkyTu/x3iQV3xmcW+Noeee2Cxqk4gBSPgfjQ ImoLEVDztm6OvQzy0pCH+RRT8pscjClLLsRdI+diGla+b6q9/4f3RD24T2BrZQxx3UpU Wo1A== X-Gm-Message-State: AOJu0YwY8XFdQbS5DxYbn2LdYobHLHOCzRbmdIoBpvo3zW9TKP3IhehQ 6m0FzZpCqIBtGSDd7d70lYXJpg== X-Google-Smtp-Source: AGHT+IHz4MeKzQNpGS3GuXJru1bhFANMtBidBLfjB0S7BBLwpdV+bF/LMZO4YdD6LDF1rILDlQEt4w== X-Received: by 2002:a81:5c45:0:b0:59b:fda7:9d7f with SMTP id q66-20020a815c45000000b0059bfda79d7fmr7108949ywb.49.1695347471227; Thu, 21 Sep 2023 18:51:11 -0700 (PDT) Received: from [127.0.1.1] ([2601:1c2:1800:f680:fa26:6227:be1c:67f0]) by smtp.gmail.com with ESMTPSA id y10-20020a63b50a000000b0057412d84d25sm1973856pge.4.2023.09.21.18.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:51:10 -0700 (PDT) From: Drew Fustini Date: Thu, 21 Sep 2023 18:49:50 -0700 Subject: [PATCH 3/6] mmc: sdhci-of-dwcmshc: Add support for T-Head TH1520 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230921-th1520-mmc-v1-3-49f76c274fb3@baylibre.com> References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> In-Reply-To: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jisheng Zhang , Adrian Hunter , Guo Ren , Fu Wei , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley Cc: Robert Nelson , Jason Kridner , Xi Ruoyao , Han Gao , Icenowy Zheng , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Drew Fustini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1695347467; l=20376; i=dfustini@baylibre.com; s=20230430; h=from:subject:message-id; bh=LDBhzAz693ogyYuKvJM9mF/EbXQOvMewS07B6vi+b3k=; b=yYz3jnd3fEfUzx0/uJpKvvgpPyCv7j4OeZ9Sn2VxAp4GZKuyrjqgk7tJ8bGXYL5sV2RObxTKr pp//Lt66lltA4rUCNzwYqkpUs+FZmCsr1rEqst8FYmfO5JZpmDkH1V1 X-Developer-Key: i=dfustini@baylibre.com; a=ed25519; pk=p3GKE9XFmjhwAayAHG4U108yag7V8xQVd4zJLdW0g7g= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for the mmc controller in the T-Head TH1520 with the new compatible "thead,th1520-dwcmshc". Implement custom sdhci_ops for set_uhs_signaling, reset, voltage_switch, and platform_execute_tuning. Signed-off-by: Drew Fustini Tested-by: Xi Ruoyao --- drivers/mmc/host/sdhci-of-dwcmshc.c | 456 ++++++++++++++++++++++++++++++++= ++++ 1 file changed, 456 insertions(+) diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-o= f-dwcmshc.c index 3a3bae6948a8..7294bf1afb7d 100644 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c @@ -35,6 +35,26 @@ #define DWCMSHC_CARD_IS_EMMC BIT(0) #define DWCMSHC_ENHANCED_STROBE BIT(8) #define DWCMSHC_EMMC_ATCTRL 0x40 +/* Tuning and auto-tuning fields in AT_CTRL_R control register */ +#define AT_CTRL_AT_EN 0x1 /* autotuning is enabled */ +#define AT_CTRL_CI_SEL_SHIFT 0x1 /* bit 1 */ +#define AT_CTRL_CI_SEL 0x1 /* interval to drive center phase select */ +#define AT_CTRL_SWIN_TH_EN_SHIFT 0x2 /* bit 2 */ +#define AT_CTRL_SWIN_TH_EN 0x1 /* sampling window threshold enable */ +#define AT_CTRL_RPT_TUNE_ERR_SHIFT 0x3 /* bit 3 */ +#define AT_CTRL_RPT_TUNE_ERR 0x1 /* enable reporting framing errors */ +#define AT_CTRL_SW_TUNE_EN_SHIFT 0x4 /* bit 4 */ +#define AT_CTRL_SW_TUNE_EN 0x1 /* enable software managed tuning */ +#define AT_CTRL_WIN_EDGE_SEL_SHIFT 0x8 /* bits [11:8] */ +#define AT_CTRL_WIN_EDGE_SEL 0xf /* sampling window edge select */ +#define AT_CTRL_TUNE_CLK_STOP_EN_SHIFT 0x10 /* bit 16 */ +#define AT_CTRL_TUNE_CLK_STOP_EN 0x1 /* clocks stopped during phase code = change */ +#define AT_CTRL_PRE_CHANGE_DLY_SHIFT 0x11 /* bits [18:17] */ +#define AT_CTRL_PRE_CHANGE_DLY 0x1 /* 2-cycle latency */ +#define AT_CTRL_POST_CHANGE_DLY_SHIFT 0x13 /* bits [20:19] */ +#define AT_CTRL_POST_CHANGE_DLY 0x3 /* 4-cycle latency */ +#define AT_CTRL_SWIN_TH_VAL_SHIFT 0x18 /* bits [31:24] */ +#define AT_CTRL_SWIN_TH_VAL 0x9 /* sampling window threshold */ =20 /* Rockchip specific Registers */ #define DWCMSHC_EMMC_DLL_CTRL 0x800 @@ -72,6 +92,84 @@ (((x) & DWCMSHC_EMMC_DLL_TIMEOUT) =3D=3D 0)) #define RK35xx_MAX_CLKS 3 =20 +/* PHY register area pointer */ +#define DWC_MSHC_PTR_PHY_R 0x300 + +/* PHY general configuration */ +#define PHY_CNFG_R (DWC_MSHC_PTR_PHY_R + 0x00) +#define PHY_CNFG_RSTN_DEASSERT 0x1 /* Deassert PHY reset */ +#define PHY_CNFG_PAD_SP_SHIFT 0x10 /* bits [16:9] */ +#define PHY_CNFG_PAD_SP_VALUE 0x0c /* PMOS TX drive strength */ +#define PHY_CNFG_PAD_SN_SHIFT 0x14 /* bits [23:20] */ +#define PHY_CNFG_PAD_SN_VALUE 0x0c /* NMOS TX drive strength */ + +/* PHY command/response pad settings */ +#define PHY_CMDPAD_CNFG_R (DWC_MSHC_PTR_PHY_R + 0x04) + +/* PHY data pad settings */ +#define PHY_DATAPAD_CNFG_R (DWC_MSHC_PTR_PHY_R + 0x06) + +/* PHY clock pad settings */ +#define PHY_CLKPAD_CNFG_R (DWC_MSHC_PTR_PHY_R + 0x08) + +/* PHY strobe pad settings */ +#define PHY_STBPAD_CNFG_R (DWC_MSHC_PTR_PHY_R + 0x0a) + +/* PHY reset pad settings */ +#define PHY_RSTNPAD_CNFG_R (DWC_MSHC_PTR_PHY_R + 0x0c) + +/* Bitfields are common for all pad settings */ +#define PHY_PAD_RXSEL_1V8 0x1 /* Receiver type select for 1.8V */ +#define PHY_PAD_RXSEL_3V3 0x2 /* Receiver type select for 3.3V */ + +#define PHY_PAD_WEAKPULL_SHIFT 0x3 /* bits [4:3] */ +#define PHY_PAD_WEAKPULL_PULLUP 0x1 /* Weak pull down enabled */ +#define PHY_PAD_WEAKPULL_PULLDOWN 0x2 /* Weak pull down enabled */ + +#define PHY_PAD_TXSLEW_CTRL_P_SHIFT 0x5 /* bits [8:5] */ +#define PHY_PAD_TXSLEW_CTRL_P_VALUE 0x3 /* Slew control for P-Type pad TX = */ +#define PHY_PAD_TXSLEW_CTRL_N_SHIFT 0x9 /* bits [12:9] */ +#define PHY_PAD_TXSLEW_CTRL_N_VALUE 0x3 /* Slew control for N-Type pad TX = */ + +/* PHY CLK delay line settings */ +#define PHY_SDCLKDL_CNFG_R (DWC_MSHC_PTR_PHY_R + 0x1d) +#define PHY_SDCLKDL_CNFG_UPDATE_SHIFT 0x4 /* bit 4 */ +#define PHY_SDCLKDL_CNFG_UPDATE_DC 0x1 /* set before writing to SDCLKDL_DC= */ + +/* PHY CLK delay line delay code */ +#define PHY_SDCLKDL_DC_R (DWC_MSHC_PTR_PHY_R + 0x1e) +#define PHY_SDCLKDL_DC_INITIAL 0x40 /* initial delay code */ +#define PHY_SDCLKDL_DC_DEFAULT 0x32 /* default delay code */ +#define PHY_SDCLKDL_DC_HS400 0x18 /* delay code for HS400 mode */ + +/* PHY drift_cclk_rx delay line configuration setting */ +#define PHY_ATDL_CNFG_R (DWC_MSHC_PTR_PHY_R + 0x21) +#define PHY_ATDL_CNFG_INPSEL_SHIFT 0x2 /* bits [3:2] */ +#define PHY_ATDL_CNFG_INPSEL_VALUE 0x3 /* delay line input source */ + +/* PHY DLL control settings */ +#define PHY_DLL_CTRL_R (DWC_MSHC_PTR_PHY_R + 0x24) +#define PHY_DLL_CTRL_DISABLE 0x0 /* PHY DLL is enabled */ +#define PHY_DLL_CTRL_ENABLE 0x1 /* PHY DLL is disabled */ + +/* PHY DLL configuration register 1 */ +#define PHY_DLL_CNFG1_R (DWC_MSHC_PTR_PHY_R + 0x25) +#define PHY_DLL_CNFG1_SLVDLY_SHIFT 0x4 /* bits [5:4] */ +#define PHY_DLL_CNFG1_SLVDLY_VALUE 0x2 /* DLL slave update delay input */ +#define PHY_DLL_CNFG1_WAITCYCLE 0x5 /* DLL wait cycle input */ + +/* PHY DLL configuration register 2 */ +#define PHY_DLL_CNFG2_R (DWC_MSHC_PTR_PHY_R + 0x26) +#define PHY_DLL_CNFG2_JUMPSTEP 0xa /* DLL jump step input */ + +/* PHY DLL master and slave delay line configuration settings */ +#define PHY_DLLDL_CNFG_R (DWC_MSHC_PTR_PHY_R + 0x28) +#define PHY_DLLDL_CNFG_SLV_INPSEL_SHIFT 0x5 /* bits [6:5] */ +#define PHY_DLLDL_CNFG_SLV_INPSEL_VALUE 0x3 /* clock source select for sla= ve DL */ + +#define FLAG_PULL_UP_EN BIT(0) +#define FLAG_IO_FIXED_1V8 BIT(1) + #define BOUNDARY_OK(addr, len) \ ((addr | (SZ_128M - 1)) =3D=3D ((addr + len - 1) | (SZ_128M - 1))) =20 @@ -92,6 +190,8 @@ struct dwcmshc_priv { struct clk *bus_clk; int vendor_specific_area1; /* P_VENDOR_SPECIFIC_AREA reg */ void *priv; /* pointer to SoC private stuff */ + u16 delay_line; + u16 flags; }; =20 /* @@ -157,6 +257,206 @@ static void dwcmshc_request(struct mmc_host *mmc, str= uct mmc_request *mrq) sdhci_request(mmc, mrq); } =20 +static void th1520_phy_1_8v_init_no_pull(struct sdhci_host *host) +{ + u32 val; + + /* deassert phy reset */ + sdhci_writel(host, PHY_CNFG_RSTN_DEASSERT, PHY_CNFG_R); + + /* disable delay line */ + sdhci_writeb(host, PHY_SDCLKDL_CNFG_UPDATE_DC << PHY_SDCLKDL_CNFG_UPDATE_= SHIFT, + PHY_SDCLKDL_CNFG_R); + + /* set delay line */ + sdhci_writeb(host, PHY_SDCLKDL_DC_INITIAL, PHY_SDCLKDL_DC_R); + + /* enable delay lane */ + val =3D sdhci_readb(host, PHY_SDCLKDL_CNFG_R); + val &=3D ~(PHY_SDCLKDL_CNFG_UPDATE_DC << PHY_SDCLKDL_CNFG_UPDATE_SHIFT); + sdhci_writeb(host, val, PHY_SDCLKDL_CNFG_R); + + /* configure phy pads */ + val =3D sdhci_readw(host, PHY_CMDPAD_CNFG_R); + sdhci_writew(host, val | PHY_PAD_RXSEL_1V8, PHY_CMDPAD_CNFG_R); + + val =3D sdhci_readw(host, PHY_DATAPAD_CNFG_R); + sdhci_writew(host, val | PHY_PAD_RXSEL_1V8, PHY_DATAPAD_CNFG_R); + + val =3D sdhci_readw(host, PHY_RSTNPAD_CNFG_R); + sdhci_writew(host, val | PHY_PAD_RXSEL_1V8, PHY_RSTNPAD_CNFG_R); + + val =3D sdhci_readw(host, PHY_STBPAD_CNFG_R); + sdhci_writew(host, val | PHY_PAD_RXSEL_1V8, PHY_STBPAD_CNFG_R); + + /* enable phy dll */ + val =3D sdhci_readb(host, PHY_DLL_CTRL_R); + sdhci_writeb(host, val | PHY_DLL_CTRL_ENABLE, PHY_DLL_CTRL_R); +} + +static void th1520_phy_3_3v_init_no_pull(struct sdhci_host *host) +{ + u32 val; + + /* deassert phy reset */ + sdhci_writel(host, PHY_CNFG_RSTN_DEASSERT, PHY_CNFG_R); + + /* disable delay line */ + sdhci_writeb(host, PHY_SDCLKDL_CNFG_UPDATE_DC << PHY_SDCLKDL_CNFG_UPDATE_= SHIFT, + PHY_SDCLKDL_CNFG_R); + + /* set delay line */ + sdhci_writeb(host, PHY_SDCLKDL_DC_INITIAL, PHY_SDCLKDL_DC_R); + + /* enable delay lane */ + val =3D sdhci_readb(host, PHY_SDCLKDL_CNFG_R); + val &=3D ~(PHY_SDCLKDL_CNFG_UPDATE_DC << PHY_SDCLKDL_CNFG_UPDATE_SHIFT); + sdhci_writeb(host, val, PHY_SDCLKDL_CNFG_R); + + /* configure phy pads */ + val =3D sdhci_readw(host, PHY_CMDPAD_CNFG_R); + sdhci_writew(host, val | PHY_PAD_RXSEL_3V3, PHY_CMDPAD_CNFG_R); + + val =3D sdhci_readw(host, PHY_DATAPAD_CNFG_R); + sdhci_writew(host, val | PHY_PAD_RXSEL_3V3, PHY_DATAPAD_CNFG_R); + + val =3D sdhci_readw(host, PHY_RSTNPAD_CNFG_R); + sdhci_writew(host, val | PHY_PAD_RXSEL_3V3, PHY_RSTNPAD_CNFG_R); + + val =3D sdhci_readw(host, PHY_STBPAD_CNFG_R); + sdhci_writew(host, val | PHY_PAD_RXSEL_3V3, PHY_STBPAD_CNFG_R); + + /* enable phy dll */ + val =3D sdhci_readb(host, PHY_DLL_CTRL_R); + sdhci_writeb(host, val | PHY_DLL_CTRL_ENABLE, PHY_DLL_CTRL_R); +} + +static void th1520_phy_1_8v_init(struct sdhci_host *host) +{ + struct sdhci_pltfm_host *pltfm_host =3D sdhci_priv(host); + struct dwcmshc_priv *priv =3D sdhci_pltfm_priv(pltfm_host); + u32 val; + + if (!priv) + return; + + if (!(priv->flags & FLAG_PULL_UP_EN)) { + th1520_phy_1_8v_init_no_pull(host); + return; + } + + /* deassert phy reset & set tx drive strength */ + sdhci_writel(host, PHY_CNFG_RSTN_DEASSERT | + (PHY_CNFG_PAD_SP_VALUE << PHY_CNFG_PAD_SP_SHIFT) | + (PHY_CNFG_PAD_SN_VALUE << PHY_CNFG_PAD_SN_SHIFT), + PHY_CNFG_R); + + /* disable delay line */ + sdhci_writeb(host, PHY_SDCLKDL_CNFG_UPDATE_DC << PHY_SDCLKDL_CNFG_UPDATE_= SHIFT, + PHY_SDCLKDL_CNFG_R); + + /* set delay line */ + sdhci_writeb(host, priv->delay_line, PHY_SDCLKDL_DC_R); + sdhci_writeb(host, PHY_DLL_CNFG2_JUMPSTEP, PHY_DLL_CNFG2_R); + + /* enable delay lane */ + val =3D sdhci_readb(host, PHY_SDCLKDL_CNFG_R); + val &=3D ~(PHY_SDCLKDL_CNFG_UPDATE_DC << PHY_SDCLKDL_CNFG_UPDATE_SHIFT); + sdhci_writeb(host, val, PHY_SDCLKDL_CNFG_R); + + /* configure phy pads */ + val =3D PHY_PAD_RXSEL_1V8 | (PHY_PAD_WEAKPULL_PULLUP << PHY_PAD_WEAKPULL_= SHIFT) | + (PHY_PAD_TXSLEW_CTRL_P_VALUE << PHY_PAD_TXSLEW_CTRL_P_SHIFT) | + (PHY_PAD_TXSLEW_CTRL_N_VALUE << PHY_PAD_TXSLEW_CTRL_N_SHIFT); + sdhci_writew(host, val, PHY_CMDPAD_CNFG_R); + sdhci_writew(host, val, PHY_DATAPAD_CNFG_R); + sdhci_writew(host, val, PHY_RSTNPAD_CNFG_R); + + val =3D (PHY_PAD_TXSLEW_CTRL_P_VALUE << PHY_PAD_TXSLEW_CTRL_P_SHIFT) | + (PHY_PAD_TXSLEW_CTRL_N_VALUE << PHY_PAD_TXSLEW_CTRL_N_SHIFT); + sdhci_writew(host, val, PHY_CLKPAD_CNFG_R); + + val =3D PHY_PAD_RXSEL_1V8 | (PHY_PAD_WEAKPULL_PULLDOWN << PHY_PAD_WEAKPUL= L_SHIFT) | + (PHY_PAD_TXSLEW_CTRL_P_VALUE << PHY_PAD_TXSLEW_CTRL_P_SHIFT) | + (PHY_PAD_TXSLEW_CTRL_N_VALUE << PHY_PAD_TXSLEW_CTRL_N_SHIFT); + sdhci_writew(host, val, PHY_STBPAD_CNFG_R); + + /* enable data strobe mode */ + sdhci_writeb(host, PHY_DLLDL_CNFG_SLV_INPSEL_VALUE << PHY_DLLDL_CNFG_SLV_= INPSEL_SHIFT, + PHY_DLLDL_CNFG_R); + + /* enable phy dll */ + sdhci_writeb(host, PHY_DLL_CTRL_ENABLE, PHY_DLL_CTRL_R); +} + +static void th1520_phy_3_3v_init(struct sdhci_host *host) +{ + struct sdhci_pltfm_host *pltfm_host =3D sdhci_priv(host); + struct dwcmshc_priv *priv =3D sdhci_pltfm_priv(pltfm_host); + u32 val; + + if (!(priv->flags & FLAG_PULL_UP_EN)) { + th1520_phy_3_3v_init_no_pull(host); + return; + } + + /* deassert phy reset & set tx drive strength */ + sdhci_writel(host, PHY_CNFG_RSTN_DEASSERT | + (PHY_CNFG_PAD_SP_VALUE << PHY_CNFG_PAD_SP_SHIFT) | + (PHY_CNFG_PAD_SN_VALUE << PHY_CNFG_PAD_SN_SHIFT), + PHY_CNFG_R); + + /* disable delay line */ + sdhci_writeb(host, PHY_SDCLKDL_CNFG_UPDATE_DC << PHY_SDCLKDL_CNFG_UPDATE_= SHIFT, + PHY_SDCLKDL_CNFG_R); + + /* set delay line */ + sdhci_writeb(host, priv->delay_line, PHY_SDCLKDL_DC_R); + sdhci_writeb(host, PHY_DLL_CNFG2_JUMPSTEP, PHY_DLL_CNFG2_R); + + /* enable delay lane */ + val =3D sdhci_readb(host, PHY_SDCLKDL_CNFG_R); + val &=3D ~(PHY_SDCLKDL_CNFG_UPDATE_DC << PHY_SDCLKDL_CNFG_UPDATE_SHIFT); + sdhci_writeb(host, val, PHY_SDCLKDL_CNFG_R); + + /* configure phy pads */ + val =3D PHY_PAD_RXSEL_3V3 | (PHY_PAD_WEAKPULL_PULLUP << PHY_PAD_WEAKPULL_= SHIFT) | + (PHY_PAD_TXSLEW_CTRL_P_VALUE << PHY_PAD_TXSLEW_CTRL_P_SHIFT) | + (PHY_PAD_TXSLEW_CTRL_N_VALUE << PHY_PAD_TXSLEW_CTRL_N_SHIFT); + sdhci_writew(host, val, PHY_CMDPAD_CNFG_R); + sdhci_writew(host, val, PHY_DATAPAD_CNFG_R); + sdhci_writew(host, val, PHY_RSTNPAD_CNFG_R); + + val =3D (PHY_PAD_TXSLEW_CTRL_P_VALUE << PHY_PAD_TXSLEW_CTRL_P_SHIFT) | + (PHY_PAD_TXSLEW_CTRL_N_VALUE << PHY_PAD_TXSLEW_CTRL_N_SHIFT); + sdhci_writew(host, val, PHY_CLKPAD_CNFG_R); + + val =3D PHY_PAD_RXSEL_3V3 | (PHY_PAD_WEAKPULL_PULLDOWN << PHY_PAD_WEAKPUL= L_SHIFT) | + (PHY_PAD_TXSLEW_CTRL_P_VALUE << PHY_PAD_TXSLEW_CTRL_P_SHIFT) | + (PHY_PAD_TXSLEW_CTRL_N_VALUE << PHY_PAD_TXSLEW_CTRL_N_SHIFT); + sdhci_writew(host, val, PHY_STBPAD_CNFG_R); +} + +static void th1520_sdhci_set_phy(struct sdhci_host *host) +{ + struct sdhci_pltfm_host *pltfm_host =3D sdhci_priv(host); + struct dwcmshc_priv *priv =3D sdhci_pltfm_priv(pltfm_host); + u16 emmc_ctrl; + + /* Before power on, set PHY configs */ + if (host->mmc->caps & MMC_CAP_NONREMOVABLE) { + th1520_phy_1_8v_init(host); + emmc_ctrl =3D sdhci_readw(host, priv->vendor_specific_area1 + DWCMSHC_EM= MC_CONTROL); + emmc_ctrl |=3D DWCMSHC_CARD_IS_EMMC; + sdhci_writew(host, emmc_ctrl, priv->vendor_specific_area1 + DWCMSHC_EMMC= _CONTROL); + } else { + th1520_phy_3_3v_init(host); + } + + sdhci_writeb(host, (PHY_DLL_CNFG1_SLVDLY_VALUE << PHY_DLL_CNFG1_SLVDLY_SH= IFT) | + PHY_DLL_CNFG1_WAITCYCLE, PHY_DLL_CNFG1_R); +} + static void dwcmshc_set_uhs_signaling(struct sdhci_host *host, unsigned int timing) { @@ -189,9 +489,30 @@ static void dwcmshc_set_uhs_signaling(struct sdhci_hos= t *host, ctrl_2 |=3D DWCMSHC_CTRL_HS400; } =20 + if (priv->flags & FLAG_IO_FIXED_1V8) + ctrl_2 |=3D SDHCI_CTRL_VDD_180; sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); } =20 +static void th1520_set_uhs_signaling(struct sdhci_host *host, + unsigned int timing) +{ + struct sdhci_pltfm_host *pltfm_host =3D sdhci_priv(host); + struct dwcmshc_priv *priv =3D sdhci_pltfm_priv(pltfm_host); + u32 reg; + + dwcmshc_set_uhs_signaling(host, timing); + if (timing =3D=3D MMC_TIMING_MMC_HS400) { + reg =3D sdhci_readl(host, priv->vendor_specific_area1 + DWCMSHC_EMMC_ATC= TRL); + reg &=3D ~AT_CTRL_AT_EN; + sdhci_writel(host, reg, priv->vendor_specific_area1 + DWCMSHC_EMMC_ATCTR= L); + priv->delay_line =3D PHY_SDCLKDL_DC_HS400; + th1520_sdhci_set_phy(host); + } else { + sdhci_writeb(host, 0, PHY_DLLDL_CNFG_R); + } +} + static void dwcmshc_hs400_enhanced_strobe(struct mmc_host *mmc, struct mmc_ios *ios) { @@ -338,6 +659,91 @@ static void rk35xx_sdhci_reset(struct sdhci_host *host= , u8 mask) sdhci_reset(host, mask); } =20 +static int th1520_execute_tuning(struct sdhci_host *host, u32 opcode) +{ + struct sdhci_pltfm_host *pltfm_host =3D sdhci_priv(host); + struct dwcmshc_priv *priv =3D sdhci_pltfm_priv(pltfm_host); + u32 val =3D 0; + + if (host->flags & SDHCI_HS400_TUNING) + return 0; + + sdhci_writeb(host, PHY_ATDL_CNFG_INPSEL_VALUE << PHY_ATDL_CNFG_INPSEL_SHI= FT, + PHY_ATDL_CNFG_R); + val =3D sdhci_readl(host, priv->vendor_specific_area1 + DWCMSHC_EMMC_ATCT= RL); + + /* + * configure tuning settings: + * - center phase select code driven in block gap interval + * - disable reporting of framing errors + * - disable software managed tuning + * - disable user selection of sampling window edges, + * instead tuning calculated edges are used + */ + val &=3D ~((AT_CTRL_CI_SEL << AT_CTRL_CI_SEL_SHIFT) | + (AT_CTRL_RPT_TUNE_ERR << AT_CTRL_RPT_TUNE_ERR_SHIFT) | + (AT_CTRL_SW_TUNE_EN << AT_CTRL_SW_TUNE_EN_SHIFT) | + (AT_CTRL_WIN_EDGE_SEL << AT_CTRL_WIN_EDGE_SEL_SHIFT)); + + /* + * configure tuning settings: + * - enable auto-tuning + * - enable sampling window threshold + * - stop clocks during phase code change + * - set max latency in cycles between tx and rx clocks + * - set max latency in cycles to switch output phase + * - set max sampling window threshold value + */ + val |=3D AT_CTRL_AT_EN | (AT_CTRL_SWIN_TH_EN << AT_CTRL_SWIN_TH_EN_SHIFT)= | + (AT_CTRL_TUNE_CLK_STOP_EN << AT_CTRL_TUNE_CLK_STOP_EN_SHIFT) | + (AT_CTRL_PRE_CHANGE_DLY << AT_CTRL_PRE_CHANGE_DLY_SHIFT) | + (AT_CTRL_POST_CHANGE_DLY << AT_CTRL_POST_CHANGE_DLY_SHIFT) | + (AT_CTRL_SWIN_TH_VAL << AT_CTRL_SWIN_TH_VAL_SHIFT); + + sdhci_writel(host, val, priv->vendor_specific_area1 + DWCMSHC_EMMC_ATCTRL= ); + val =3D sdhci_readl(host, priv->vendor_specific_area1 + DWCMSHC_EMMC_ATCT= RL); + + /* check if is possible to enable auto-tuning */ + if (!(val & AT_CTRL_AT_EN)) { + dev_err(mmc_dev(host->mmc), "failed to enable auto tuning\n"); + return -EIO; + } + + /* disable auto tuning */ + val &=3D ~AT_CTRL_AT_EN; + sdhci_writel(host, val, priv->vendor_specific_area1 + DWCMSHC_EMMC_ATCTRL= ); + + /* perform tuning */ + sdhci_start_tuning(host); + host->tuning_err =3D __sdhci_execute_tuning(host, opcode); + if (host->tuning_err) { + val &=3D ~AT_CTRL_AT_EN; + sdhci_writel(host, val, priv->vendor_specific_area1 + DWCMSHC_EMMC_ATCTR= L); + dev_err(mmc_dev(host->mmc), "tuning failed: %d\n", host->tuning_err); + return -EIO; + } + sdhci_end_tuning(host); + + return 0; +} + +static void th1520_sdhci_reset(struct sdhci_host *host, u8 mask) +{ + struct sdhci_pltfm_host *pltfm_host =3D sdhci_priv(host); + struct dwcmshc_priv *priv =3D sdhci_pltfm_priv(pltfm_host); + u16 ctrl_2; + + sdhci_reset(host, mask); + + if (priv->flags & FLAG_IO_FIXED_1V8) { + ctrl_2 =3D sdhci_readw(host, SDHCI_HOST_CONTROL2); + if (!(ctrl_2 & SDHCI_CTRL_VDD_180)) { + ctrl_2 |=3D SDHCI_CTRL_VDD_180; + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); + } + } +} + static const struct sdhci_ops sdhci_dwcmshc_ops =3D { .set_clock =3D sdhci_set_clock, .set_bus_width =3D sdhci_set_bus_width, @@ -356,6 +762,17 @@ static const struct sdhci_ops sdhci_dwcmshc_rk35xx_ops= =3D { .adma_write_desc =3D dwcmshc_adma_write_desc, }; =20 +static const struct sdhci_ops sdhci_dwcmshc_th1520_ops =3D { + .set_clock =3D sdhci_set_clock, + .set_bus_width =3D sdhci_set_bus_width, + .set_uhs_signaling =3D th1520_set_uhs_signaling, + .get_max_clock =3D dwcmshc_get_max_clock, + .reset =3D th1520_sdhci_reset, + .adma_write_desc =3D dwcmshc_adma_write_desc, + .voltage_switch =3D th1520_phy_1_8v_init, + .platform_execute_tuning =3D &th1520_execute_tuning, +}; + static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata =3D { .ops =3D &sdhci_dwcmshc_ops, .quirks =3D SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, @@ -379,6 +796,12 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_rk3= 5xx_pdata =3D { SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN, }; =20 +static const struct sdhci_pltfm_data sdhci_dwcmshc_th1520_pdata =3D { + .ops =3D &sdhci_dwcmshc_th1520_ops, + .quirks =3D SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, + .quirks2 =3D SDHCI_QUIRK2_PRESET_VALUE_BROKEN, +}; + static int dwcmshc_rk35xx_init(struct sdhci_host *host, struct dwcmshc_pri= v *dwc_priv) { int err; @@ -447,6 +870,10 @@ static const struct of_device_id sdhci_dwcmshc_dt_ids[= ] =3D { .compatible =3D "snps,dwcmshc-sdhci", .data =3D &sdhci_dwcmshc_pdata, }, + { + .compatible =3D "thead,th1520-dwcmshc", + .data =3D &sdhci_dwcmshc_th1520_pdata, + }, {}, }; MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids); @@ -542,6 +969,35 @@ static int dwcmshc_probe(struct platform_device *pdev) goto err_clk; } =20 + if (pltfm_data =3D=3D &sdhci_dwcmshc_th1520_pdata) { + priv->delay_line =3D PHY_SDCLKDL_DC_DEFAULT; + + if (device_property_present(&pdev->dev, "thead,phy-pull-up")) + priv->flags |=3D FLAG_PULL_UP_EN; + else + priv->flags &=3D ~FLAG_PULL_UP_EN; + + if ((device_property_read_bool(dev, "mmc-ddr-1_8v")) | + (device_property_read_bool(dev, "mmc-hs200-1_8v")) | + (device_property_read_bool(dev, "mmc-hs400-1_8v"))) + priv->flags |=3D FLAG_IO_FIXED_1V8; + else + priv->flags &=3D ~FLAG_IO_FIXED_1V8; + + /* + * start_signal_voltage_switch() will try 3.3V first + * then 1.8V. Use SDHCI_SIGNALING_180 ranther than + * SDHCI_SIGNALING_330 to avoid setting voltage to 3.3V + * in sdhci_start_signal_voltage_switch(). + */ + if (priv->flags & FLAG_IO_FIXED_1V8) { + host->flags &=3D ~SDHCI_SIGNALING_330; + host->flags |=3D SDHCI_SIGNALING_180; + } + + sdhci_enable_v4_mode(host); + } + #ifdef CONFIG_ACPI if (pltfm_data =3D=3D &sdhci_dwcmshc_bf3_pdata) sdhci_enable_v4_mode(host); --=20 2.34.1 From nobody Fri Feb 13 17:34:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 636F4E7D0C0 for ; Fri, 22 Sep 2023 01:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230345AbjIVBv0 (ORCPT ); Thu, 21 Sep 2023 21:51:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230252AbjIVBvT (ORCPT ); Thu, 21 Sep 2023 21:51:19 -0400 Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F383D114 for ; Thu, 21 Sep 2023 18:51:12 -0700 (PDT) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-1d63d38c74fso860133fac.3 for ; Thu, 21 Sep 2023 18:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695347472; x=1695952272; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FhR9frpmu/yAUsLJSS2gpg1w0JSCDYrDF2EFLnkclH4=; b=rCZCHp1YwLLJIJbacvF953DfsJbTfM0QLuy2mZjBbhk4xLiigflgrvAjdwoBPKwpBl CSVDGRxC1jFFCXg2l9QgMdWBvsAtLDEQbhPvOor0Ek15KJZ+doOGoycSdjS6B5iw8hRc 8TjaqlkNZ4oXAQEe2QGAVDzfxbJi64cWDaAZ2jz2CVJRj/85SMkVBUXQ7RoIBs2U1+8V ts8gK/blkKlRbNp21j7UBMYSK8DZPgQLEZ2qlhosZJ2EdwHOP8/5fk1P4O+jhImtITQQ 28SWK3qJQlOK24P1T0Z1RQYxbP2AaXbeN/MJg9/nfZ/Exkx63ShFGopXUr0NhZ5QY/AU Z1Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695347472; x=1695952272; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FhR9frpmu/yAUsLJSS2gpg1w0JSCDYrDF2EFLnkclH4=; b=AI3XJ12Yxlhvq/Nz9eJk6W3Y9Mt6DlvakHZml6PQoHJIF8dkFVZolSLiC68W1REttg +ZNZHIgwXkzuieBESLXozDq1VfFDTabS+LQ716FksUzjDtFlfepGPvGtHURhBzoN1Xz3 J+I2m+oumHH5mm4w+jA9CyyPmjdu4ggODfoW6OLIp/ZCY2R9jz/I/rvHi1+9gVQD2Hff 011dUDXpLaEGX3HZiOpY2I/UsKnrpr6rh/FmZY+E/+jD3hBSy5zHZHORosvcLjj84iVN 2Ra+yu99waPfY9oUgKJIx0xRradGmR2nIsuEkfXEi1Z6LT0fSglMDJlBU1LCnbfTowHp gGuQ== X-Gm-Message-State: AOJu0YwgR7SSdvCI1AJmx3U8RNstKF52r0OPz+K/C9QjYPdf9nLqnqY9 saOsDTCaD9bcvWvVHkxtall5rA== X-Google-Smtp-Source: AGHT+IG6f1s/2Qluw/AcJPeKmsWPsdAsou8qMp5DVhViZ2oFPjZlrQWRIfAn8jL/kTb28f16DxKnNQ== X-Received: by 2002:a05:6870:418f:b0:1bf:607:e0f2 with SMTP id y15-20020a056870418f00b001bf0607e0f2mr7359618oac.29.1695347472260; Thu, 21 Sep 2023 18:51:12 -0700 (PDT) Received: from [127.0.1.1] ([2601:1c2:1800:f680:fa26:6227:be1c:67f0]) by smtp.gmail.com with ESMTPSA id y10-20020a63b50a000000b0057412d84d25sm1973856pge.4.2023.09.21.18.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:51:11 -0700 (PDT) From: Drew Fustini Date: Thu, 21 Sep 2023 18:49:51 -0700 Subject: [PATCH 4/6] riscv: dts: thead: Add TH1520 mmc controller and sdhci clock MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230921-th1520-mmc-v1-4-49f76c274fb3@baylibre.com> References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> In-Reply-To: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jisheng Zhang , Adrian Hunter , Guo Ren , Fu Wei , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley Cc: Robert Nelson , Jason Kridner , Xi Ruoyao , Han Gao , Icenowy Zheng , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Drew Fustini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1695347467; l=1256; i=dfustini@baylibre.com; s=20230430; h=from:subject:message-id; bh=BOuTsoiS4wD+cP61c2nYQjChDl2neNVnlaTjhPPnjNo=; b=828BIUxxnWEqAhThpR3UsYUCLsNEjUrqd+nJV6aT2PNkFMKfXThBLTjniRlEi27zEM9N2HE7i 2TD3Ch0KrQ3BZYG48TuKVeR9eYlfwYG7F8m+g8psY+m2UCtMFgl1xpF X-Developer-Key: i=dfustini@baylibre.com; a=ed25519; pk=p3GKE9XFmjhwAayAHG4U108yag7V8xQVd4zJLdW0g7g= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add nodes for the SDHCI fixed clock and the first mmc controller which is typically connected to the eMMC device. Signed-off-by: Drew Fustini Tested-by: Xi Ruoyao --- arch/riscv/boot/dts/thead/th1520.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/th= ead/th1520.dtsi index ff364709a6df..ee0711352790 100644 --- a/arch/riscv/boot/dts/thead/th1520.dtsi +++ b/arch/riscv/boot/dts/thead/th1520.dtsi @@ -134,6 +134,13 @@ uart_sclk: uart-sclk-clock { #clock-cells =3D <0>; }; =20 + sdhci_clk: sdhci-clock { + compatible =3D "fixed-clock"; + clock-frequency =3D <198000000>; + clock-output-names =3D "sdhci_clk"; + #clock-cells =3D <0>; + }; + soc { compatible =3D "simple-bus"; interrupt-parent =3D <&plic>; @@ -292,6 +299,14 @@ dmac0: dma-controller@ffefc00000 { status =3D "disabled"; }; =20 + mmc0: mmc@ffe7080000 { + compatible =3D "thead,th1520-dwcmshc"; + reg =3D <0xff 0xe7080000 0x0 0x10000>; + interrupts =3D <62 IRQ_TYPE_LEVEL_HIGH>; + clocks =3D <&sdhci_clk>; + clock-names =3D "core"; + }; + timer0: timer@ffefc32000 { compatible =3D "snps,dw-apb-timer"; reg =3D <0xff 0xefc32000 0x0 0x14>; --=20 2.34.1 From nobody Fri Feb 13 17:34:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A35FE7D0BC for ; Fri, 22 Sep 2023 01:51:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbjIVBva (ORCPT ); Thu, 21 Sep 2023 21:51:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230262AbjIVBvT (ORCPT ); Thu, 21 Sep 2023 21:51:19 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 009201A1 for ; Thu, 21 Sep 2023 18:51:13 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-690fa0eea3cso1472621b3a.0 for ; Thu, 21 Sep 2023 18:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695347473; x=1695952273; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iPEbvkuSlI+waNlJffRe2ktpor2JpDqdyWj2rz7p8Wk=; b=Vtrg0dS1DQ1fJEANRO2Ih5Oofx6xZ3JW6pUPgxrxpY9MuyLUCkQVXH2b6Xe1OdU20s EW/PCeLI3B2ZRQkzUu/MWXsa98la71rcNFKIYt0QrHUyAv81YTyDPg0k9jdgQYGAJU1r u6R4k3W7G7j4rgFPKNAMha3effvfsZt6RWIxaQGtawTl0BnyE0VOrEajfRmO8MfrusRJ IJaBLq/3KcUPIg6jM8DC9JwyvuYyEJLBjAsIoYY18JU62CnU/XY9/TbP1Dbrl86zTGHt Rn1u/5ESnMrMc0EZ5WJloKJ63X03htgvdETC0A1EQ3q2hcM4UU9bQYOJokq1An4ifLNz Bq8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695347473; x=1695952273; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iPEbvkuSlI+waNlJffRe2ktpor2JpDqdyWj2rz7p8Wk=; b=pwhcFGDTqEl23TGFbuBJteEkdm9YqkJFSgYSG3DYbJQxPwldCDWwfkqlVCi57yWog2 oNFYbiPSjrZ4RkMDPKNIB3ZNerCct2EMYC6saTW2f0YTAx7KpDalxZ96CF8lKPiTct8g Bpef5eJQq2SyKQoW7nuam9NozUHIKqUMmsITZHGFtq+rfIhLi1gYpAY7D/BGuzP4/LXs hWQ2iq7q3FBwHQmtWwHqIYo5RcUR2aDQ7Nh0d03Fk1zbgjSFcdBr4VGT8dwqVtRzrz6W wfe43x4PnQFp+c+iH63yfSIFHMcszcp/DGoYDrkJaPYMlZdU5x9sQuu+2z3vlR/07A+p nOjQ== X-Gm-Message-State: AOJu0YzCWzcnyOWt07P7Orb86b7jFLdEPEO4lLYaRxSizpd9SEXlvXfy /gwjLbciZK3MEhZDkHNsyOA1ng== X-Google-Smtp-Source: AGHT+IE4X42yF1HXpuaoHL3ejmIEJ9fFuH2zgYBey6U1orqlaNK7fEzRXNdULELkEbDzi1O+u9EzjA== X-Received: by 2002:a05:6a00:997:b0:68a:49bc:e0af with SMTP id u23-20020a056a00099700b0068a49bce0afmr8809508pfg.1.1695347473242; Thu, 21 Sep 2023 18:51:13 -0700 (PDT) Received: from [127.0.1.1] ([2601:1c2:1800:f680:fa26:6227:be1c:67f0]) by smtp.gmail.com with ESMTPSA id y10-20020a63b50a000000b0057412d84d25sm1973856pge.4.2023.09.21.18.51.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:51:12 -0700 (PDT) From: Drew Fustini Date: Thu, 21 Sep 2023 18:49:52 -0700 Subject: [PATCH 5/6] riscv: dts: thead: Enable BeagleV Ahead eMMC controller MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230921-th1520-mmc-v1-5-49f76c274fb3@baylibre.com> References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> In-Reply-To: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jisheng Zhang , Adrian Hunter , Guo Ren , Fu Wei , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley Cc: Robert Nelson , Jason Kridner , Xi Ruoyao , Han Gao , Icenowy Zheng , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Drew Fustini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1695347467; l=956; i=dfustini@baylibre.com; s=20230430; h=from:subject:message-id; bh=e7hYW7QNhal0RaNuGY3AGvE/4Ei4UdLG9Fj7V3U8VKw=; b=IYvBWMTKLnO4eGhXZDaLu7J6cKyV/rnBRhIPRir14soBubLYnpWwdB1YUX5SiQQsnHUuOHFn8 opoUzD3CmAzChvQqTcQdMtI/oVbApUhunFrq/jQQ+eMCvA40mghGlE8 X-Developer-Key: i=dfustini@baylibre.com; a=ed25519; pk=p3GKE9XFmjhwAayAHG4U108yag7V8xQVd4zJLdW0g7g= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add properties to the emmc node and enable it and set the frequency for the sdhci clock. Signed-off-by: Drew Fustini Tested-by: Xi Ruoyao --- arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/risc= v/boot/dts/thead/th1520-beaglev-ahead.dts index 70e8042c8304..dde645789b7e 100644 --- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts @@ -52,6 +52,10 @@ &uart_sclk { clock-frequency =3D <100000000>; }; =20 +&sdhci_clk { + clock-frequency =3D <198000000>; +}; + &dmac0 { status =3D "okay"; }; @@ -59,3 +63,14 @@ &dmac0 { &uart0 { status =3D "okay"; }; + +&mmc0 { + bus-width =3D <8>; + max-frequency =3D <198000000>; + mmc-hs400-1_8v; + non-removable; + no-sdio; + no-sd; + thead,phy-pull-up; + status =3D "okay"; +}; --=20 2.34.1 From nobody Fri Feb 13 17:34:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BF42E7D0BF for ; Fri, 22 Sep 2023 01:51:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230456AbjIVBvg (ORCPT ); Thu, 21 Sep 2023 21:51:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230300AbjIVBvU (ORCPT ); Thu, 21 Sep 2023 21:51:20 -0400 Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A699FB for ; Thu, 21 Sep 2023 18:51:15 -0700 (PDT) Received: by mail-vs1-xe2b.google.com with SMTP id ada2fe7eead31-45260b91a29so833544137.2 for ; Thu, 21 Sep 2023 18:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695347474; x=1695952274; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cDyDoj9zqW3tb6f+dTciYYHXjkgtjjsfpMWk3ptqz4Y=; b=B86e/X7aEhmN3y8sZ6vGfdHFqR0IyXE0fJdlDTD7NXyLuIZLeFGOxaKRchA1l17tvy kE+1pvwAmmNuj05Zn/1VkWlK4nEu4k1ZUadus8KafP2s/ZM8RqGDerw0euCS/OTN09xX gQXwUmlvfj7yfNnx2j5E9G3I63nD9UtaSHPkoViLZj3soT0Pld25HQXJkGtagynfogWd gwpieKSDQ11zBdcBkxKDGBxM2Zn0HTvVIhiOlt0b1+keF5/UYDekqYfONFQhBJoMlKm2 MvKfotOnd0w/hmsWK+qAL6DlvU/27ecINjDth28+4Czc+Ni9ny4FA6vbTuI7PHglSJ0d Skzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695347474; x=1695952274; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cDyDoj9zqW3tb6f+dTciYYHXjkgtjjsfpMWk3ptqz4Y=; b=NEM5LW/31dVsbJTXLREaJmqN7qBOGsj5BFmdw4PEpRvVCVpDlBG7EICiIYLTHLvoJk XR9oKMDdJ/z5ofIk3qE/h7RZo/rJKprCtXFiSVjGIPWMbW9ZMfClYDt9MwDZ+SjmFY1Q i8SM77KDVncgsNYC3/Mve+r9WhEZi2rhQTWuqoOugMD1DHPCeu7p4DhTpbW+BmrHNEaY FgtO3M4Y8EpmqEZfEsvKJnPVghEoOx9cNIjLglOfYWR3YWIYOV9fqRq9Ez5Z7LQIalWR IbnXTz7vPm8IYu3T7W45jPyQ280c1N/YOWwLTfuUpVO4Hti9Qkocq5Vz43qublw5AwrB CxWQ== X-Gm-Message-State: AOJu0Yx7vjJE+EoyGVsoiiCJkXwdEc6KjhPVFJoD6EJ0TwBYynuvP/Gw fpohaIy27IeLBCrQ5sJ1ZOC88Q== X-Google-Smtp-Source: AGHT+IFXdS2JE5SAgxFGpk2JBdV0QiDMGOB+zNKqvG/7UuF33hvfFUA7v/UeS7e5AxcMQ4nkJcmsTQ== X-Received: by 2002:a67:b911:0:b0:452:5798:64b6 with SMTP id q17-20020a67b911000000b00452579864b6mr7136727vsn.29.1695347474300; Thu, 21 Sep 2023 18:51:14 -0700 (PDT) Received: from [127.0.1.1] ([2601:1c2:1800:f680:fa26:6227:be1c:67f0]) by smtp.gmail.com with ESMTPSA id y10-20020a63b50a000000b0057412d84d25sm1973856pge.4.2023.09.21.18.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:51:14 -0700 (PDT) From: Drew Fustini Date: Thu, 21 Sep 2023 18:49:53 -0700 Subject: [PATCH 6/6] riscv: dts: thead: Enable LicheePi 4A eMMC controller MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230921-th1520-mmc-v1-6-49f76c274fb3@baylibre.com> References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> In-Reply-To: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jisheng Zhang , Adrian Hunter , Guo Ren , Fu Wei , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley Cc: Robert Nelson , Jason Kridner , Xi Ruoyao , Han Gao , Icenowy Zheng , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Drew Fustini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1695347467; l=995; i=dfustini@baylibre.com; s=20230430; h=from:subject:message-id; bh=NVR/jz5zFITHdlX9LFGuP143Lx0/07lnI+f1VmxUhWc=; b=raxv8sdLi3NXEnuRTMoKuMBfYJblfB31JVKLCA7ZyLEQDTMFK0QMg4FBDAS1/RE2PwM8GeM9g 37Bq/mEBjXzC14O3M2KIDYrOlsISgPYO/PybYfDJ47mNjxkGGIw5rgl X-Developer-Key: i=dfustini@baylibre.com; a=ed25519; pk=p3GKE9XFmjhwAayAHG4U108yag7V8xQVd4zJLdW0g7g= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add properties to the emmc node and enable it and set the frequency for the sdhci clock. Signed-off-by: Drew Fustini Tested-by: Xi Ruoyao --- arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi b/arch/= riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi index a802ab110429..3de8ae0a4384 100644 --- a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi +++ b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi @@ -29,6 +29,10 @@ &apb_clk { clock-frequency =3D <62500000>; }; =20 +&sdhci_clk { + clock-frequency =3D <198000000>; +}; + &uart_sclk { clock-frequency =3D <100000000>; }; @@ -36,3 +40,14 @@ &uart_sclk { &dmac0 { status =3D "okay"; }; + +&mmc0 { + bus-width =3D <8>; + max-frequency =3D <198000000>; + mmc-hs400-1_8v; + non-removable; + no-sdio; + no-sd; + thead,phy-pull-up; + status =3D "okay"; +}; --=20 2.34.1