From patchwork Wed Dec 20 15:30:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Dasu X-Patchwork-Id: 181702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2726713dyi; Wed, 20 Dec 2023 07:39:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGL3cUUNf5cGVPAVV8mPZkb3taznhwfymXtZDFyLFYBoVnIIxeOuG1vo95+IiKVMcG42s82 X-Received: by 2002:a05:6870:2328:b0:202:ffc8:c6bb with SMTP id w40-20020a056870232800b00202ffc8c6bbmr17150839oao.4.1703086775045; Wed, 20 Dec 2023 07:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703086775; cv=none; d=google.com; s=arc-20160816; b=qcfCujsJGqGDo4MaQ8eGhN8e8mZmhDhp72AwGqQl0u8VvcwhbKRqzaU3tkN8QhsS+e J8dE86Mil2VcBMPBrEV2u+H1cshEeHm2HjfnMsmq4k6z8qK/cRMb8TDW7RSgOiEGHMQj O0PzQDRwz9tDhjJUiVRiclpf7r0nQWKEG/5MVwkXRWFh0jd7PjzenIqHqqqrfB1chZpO GLE94H7uChaTya4Sm2z2/8rJxnSa1pmCyi4yRABUjiNjy+GhP5vqjlrh5si4euaBV9un 2RX6vtotidxcdV6EMeMgYorhquBER1Npd8Ae7MQEJNBBCNu0XhrR/STxLpN6fkZl07qs H9lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=1RBNCgDyuEqsrj2oxQzemzC1x7+gkumBnr+uoBXwidA=; fh=kl6jwBYwyWQ8UusyU/LVQEf4sbplVtOrtPygnUZLHOM=; b=01pY8tzgjQgsnJzzKKZ/TCp2LzqOownpywsR/bXKLlL5ElEJVh50dXYVj1HceXQe0Q s66kOJQo7eOzCDxkVDoczEq+GC/M0gjCOIVaf8qiNMSYN1qldDVYA2MBJ4fdRKjc9NK5 kUlSZDTEIy7DjQUNkDmFDLytJ3CUd2/TAJeZ2uta9ugy0+ar8kRcqVgcPdB31pXn7Lz2 LlyjkSKhgZ8n+ZeNdG+G7gj39zF8nqO0NB4+i1UsBH3HF2nBLYDfmPE/CpxWIdskS8nw ZPtjLllGYDwGyC6xM7HwcnP72in7R6ECSAYM07FOyx8i08X+BZ3DOFtwlsS+2X3Lqtjz Q+Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=QYzAOhca; spf=pass (google.com: domain of linux-kernel+bounces-7170-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7170-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b13-20020a630c0d000000b005bda77217eesi21702153pgl.209.2023.12.20.07.39.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 07:39:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7170-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=QYzAOhca; spf=pass (google.com: domain of linux-kernel+bounces-7170-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7170-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B3F7C28944D for ; Wed, 20 Dec 2023 15:32:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCB1141741; Wed, 20 Dec 2023 15:30:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="QYzAOhca" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 105D740C19 for ; Wed, 20 Dec 2023 15:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1d3eb299e2eso7193545ad.2 for ; Wed, 20 Dec 2023 07:30:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1703086254; x=1703691054; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=1RBNCgDyuEqsrj2oxQzemzC1x7+gkumBnr+uoBXwidA=; b=QYzAOhcazSIEaM6UUlkjNSNpSeF+VQckbSE6le1im/p1jI9bXmdFjZskrK3lV1tnFE pDr70wLKPP4pfBmIPf4JWq9PTTxd74EmBu57zC3Rbq+kN3xunNCJY2PHKFjrAxV0euCW yqZyQjQC13+8KjSiqrvi4Z6bqXmiDqin+isCg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703086254; x=1703691054; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1RBNCgDyuEqsrj2oxQzemzC1x7+gkumBnr+uoBXwidA=; b=I49ehUgPf6rjW2f7foic4Agq7wllCLGCSLaCia5BgBA/64XX4PX7TRM41ZPrho1P4W lYOVNgyuwLfJvJVS/AKPD41SExY+lfFf0eh7/EcDlDurUdZN/BMrpYzQTRiJ7mCBmjaY OFXulJ+z+7oAFTcH7tWeoKvtsXh2zq72JVUa7Hv3Gv1MzX+uHyEYvVsLH4hm7Us2fy6S f9dieXLARjmLdRbxb71ps35dE3x4d1qF/Oh71tmaXyFX/fOQY5XEMd5YH9mK30lsh6e3 Y+tvarlRZf0EFzHzyiLo//dTNQZf+fVFgigrkeulWLU/iwrdoCGV+ewlgNLNPaZBBry7 DTJA== X-Gm-Message-State: AOJu0Yx/Vveroc5jUVa0E83mSKIKIfxW7yB08/fhARPS5foWwtT2PiuG DGaI5MFf35e0tL3RPYO15r17k4u3WsZDS/TqO1/kwQ== X-Received: by 2002:a17:903:124a:b0:1d3:2a94:cb47 with SMTP id u10-20020a170903124a00b001d32a94cb47mr9777633plh.45.1703086254368; Wed, 20 Dec 2023 07:30:54 -0800 (PST) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id j15-20020a170903024f00b001d0b080c7e6sm23041395plh.208.2023.12.20.07.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 07:30:53 -0800 (PST) From: Kamal Dasu To: ulf.hansson@linaro.org, linux-kernel@vger.kernel.org, alcooperx@gmail.com, linux-arm-kernel@lists.infradead.org, adrian.hunter@intel.com, linux-mmc@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Cc: f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, Kamal Dasu Subject: [PATCH v6 1/2] dt-bindings: mmc: brcm,sdhci-brcmstb: Add support for 74165b0 Date: Wed, 20 Dec 2023 10:30:30 -0500 Message-Id: <20231220153031.38678-2-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231220153031.38678-1-kamal.dasu@broadcom.com> References: <20231220153031.38678-1-kamal.dasu@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785815918327158342 X-GMAIL-MSGID: 1785815918327158342 From: Kamal Dasu With newer sdio controller core used for 74165b0 we need to update the compatibility with "brcm,bcm74165b0-sdhci". Signed-off-by: Kamal Dasu Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/mmc/brcm,sdhci-brcmstb.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/brcm,sdhci-brcmstb.yaml b/Documentation/devicetree/bindings/mmc/brcm,sdhci-brcmstb.yaml index c028039bc477..cbd3d6c6c77f 100644 --- a/Documentation/devicetree/bindings/mmc/brcm,sdhci-brcmstb.yaml +++ b/Documentation/devicetree/bindings/mmc/brcm,sdhci-brcmstb.yaml @@ -20,10 +20,8 @@ properties: - const: brcm,sdhci-brcmstb - items: - enum: + - brcm,bcm74165b0-sdhci - brcm,bcm7445-sdhci - - const: brcm,sdhci-brcmstb - - items: - - enum: - brcm,bcm7425-sdhci - const: brcm,sdhci-brcmstb From patchwork Wed Dec 20 15:30:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Dasu X-Patchwork-Id: 181703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2727239dyi; Wed, 20 Dec 2023 07:40:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGj6pikZ2fq16PrWhqhldV+lQLM7Yrpf8Om2XYwc86l2ZQDCv7ZvqkGS0uAvpcILDnN/qr3 X-Received: by 2002:a17:903:8cb:b0:1d3:cf63:41f8 with SMTP id lk11-20020a17090308cb00b001d3cf6341f8mr4853582plb.91.1703086821894; Wed, 20 Dec 2023 07:40:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703086821; cv=none; d=google.com; s=arc-20160816; b=l09B0qiC8i+cdee7QcSI9DvxZeJqKOZ0IpiIHtEsLC9t34SeE7HZ8QSjjdIkA4Xjwj RK5nbULlOAbCRW43EIxpy4KoCBkBYpHAA2MHw68qmBjBSKqCf8wtm0aqgymsbewIP4W9 hP4rA1RywMj5OdoL2aObGiDloXwDLQ3fCQpxbGiUwxpLhizBT0Pf42zUKHnSnJqSLjh6 ulARrtZ6GHc4jHmIStEpZsb5C4hsSPfrm5fJoOJZNALGeNh5/qM2cLNmk5MgJcJ1q9Rf qYlkBnTfDE2TkN4MmvCJZIWrrO3pISQUw5ISKWaFKPFWW9RhR4XZdRvZrrKOnX4C/8LF WYQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=sg6/xd1KPUIB0jq8vQBI22sE84wjtKDgWxjAWS7aakE=; fh=kl6jwBYwyWQ8UusyU/LVQEf4sbplVtOrtPygnUZLHOM=; b=zp+UDded9mitnx4oKegO3fnVGWfikTPObcpPO2lMGCP6AU5Cktw4GiJTscWN2UisVs VVLr5bdePwCM4m7WPVj1+ejaHQmC/+RW3+ExfyUM/RqKhOHiCw17sSeE8Y1zaOWEc7Er 1+uLEyvZo3xfK403XsRs9k+gM0LIlYhfxWOystzXMR8kiI7BzcEf+ZytZ6w6y73cg6BZ EfNrWfzmQ918Fm991/xWbuw58dkGHRczLt/nNmG3V1U6MA4GT4HubI3QrBZD98l2Q6MB NyVmA+ZfK/cspuRHF48rBWc0DjzfQEHQA2o3pK9/0M/qHWFodDSjGPm5VEtfFQHFhj51 Ym1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=EGCI3DHU; spf=pass (google.com: domain of linux-kernel+bounces-7171-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7171-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x15-20020a170902ec8f00b001d332818f37si15402180plg.188.2023.12.20.07.40.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 07:40:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7171-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=EGCI3DHU; spf=pass (google.com: domain of linux-kernel+bounces-7171-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7171-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 876A72899AA for ; Wed, 20 Dec 2023 15:32:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 462B246B9B; Wed, 20 Dec 2023 15:31:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="EGCI3DHU" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C4874175B for ; Wed, 20 Dec 2023 15:30:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1d3e8a51e6bso10734595ad.3 for ; Wed, 20 Dec 2023 07:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1703086259; x=1703691059; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=sg6/xd1KPUIB0jq8vQBI22sE84wjtKDgWxjAWS7aakE=; b=EGCI3DHUmKxWOE+j/D2Y7nUlOhXwyZe1LTi3rQ32yxOU6DhuaXlqTGeK9gqbu0zOs2 hz4MLv8QGnFzF/niVO9ofXeR6WCUntLJ+JTxIyrOju3yscvM1AEr1W4RB0777+PV5Lnm GxxoIDWqm8ZdGIP6OrJsuP6kgVbcSavPO3V1k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703086259; x=1703691059; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sg6/xd1KPUIB0jq8vQBI22sE84wjtKDgWxjAWS7aakE=; b=qFyQSXJWL4lbm4+DAfNuXex/a/YiBYtnmaBbo36mree5BfVKIsEK253bCE8iV05d1g 9cDebS7CSr92f6pmO9ZP02ISQkp5tKuZE/yqjJag+m8U70BnulXwWeQyoLrEvPhzyfg8 TMe1zWJDDDraw2tEj9kXCvuAV/NFaHW1HuzQ5FUfoktMOBBYzRj/HTP3Z57myc4zRexS gcNzZZuevc/7uadwQx9eG0R5LamRCFhy9li5cyDmpbJ3u9miFz28O54p+hayswaWN9Gh ea23ol34ltHvpkdCA/MxBsJrgn1sGGTBFVExZOg6sKCyzS8EN4Wq+jHtdeoyau0QyBUP Qr+A== X-Gm-Message-State: AOJu0YyNL3Qk4Sx+r71XuSz8OKguxXAYV/N2vpXd5suGWHHqtEG/h82f sKfi+ARkgMe/0sQX4X2kOTNjPA== X-Received: by 2002:a17:902:868f:b0:1d3:b308:adb8 with SMTP id g15-20020a170902868f00b001d3b308adb8mr5178828plo.17.1703086258642; Wed, 20 Dec 2023 07:30:58 -0800 (PST) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id j15-20020a170903024f00b001d0b080c7e6sm23041395plh.208.2023.12.20.07.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 07:30:57 -0800 (PST) From: Kamal Dasu To: ulf.hansson@linaro.org, linux-kernel@vger.kernel.org, alcooperx@gmail.com, linux-arm-kernel@lists.infradead.org, adrian.hunter@intel.com, linux-mmc@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Cc: f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, Kamal Dasu Subject: [PATCH v6 2/2] mmc: add new sdhci reset sequence for brcm 74165b0 Date: Wed, 20 Dec 2023 10:30:31 -0500 Message-Id: <20231220153031.38678-3-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231220153031.38678-1-kamal.dasu@broadcom.com> References: <20231220153031.38678-1-kamal.dasu@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785815438060278869 X-GMAIL-MSGID: 1785815967226893285 From: Kamal Dasu 74165b0 shall use a new sdio controller core version which requires a different reset sequence. For core reset we use sdhci_reset. For CMD and/or DATA reset added a new function to also enable SDHCI clocks SDHCI_CLOCK_CARD_EN SDHCI_CLOCK_INT_EN along with the SDHCI_RESET_CMD and/or SDHCI_RESET_DATA fields. Signed-off-by: Kamal Dasu --- drivers/mmc/host/sdhci-brcmstb.c | 67 +++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index c23251bb95f3..f171980b014e 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -44,8 +45,13 @@ struct brcmstb_match_priv { static inline void enable_clock_gating(struct sdhci_host *host) { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_brcmstb_priv *priv = sdhci_pltfm_priv(pltfm_host); u32 reg; + if (!(priv->flags & BRCMSTB_PRIV_FLAGS_GATE_CLOCK)) + return; + reg = sdhci_readl(host, SDHCI_VENDOR); reg |= SDHCI_VENDOR_GATE_SDCLK_EN; sdhci_writel(host, reg, SDHCI_VENDOR); @@ -53,14 +59,51 @@ static inline void enable_clock_gating(struct sdhci_host *host) static void brcmstb_reset(struct sdhci_host *host, u8 mask) { - struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - struct sdhci_brcmstb_priv *priv = sdhci_pltfm_priv(pltfm_host); - sdhci_and_cqhci_reset(host, mask); /* Reset will clear this, so re-enable it */ - if (priv->flags & BRCMSTB_PRIV_FLAGS_GATE_CLOCK) - enable_clock_gating(host); + enable_clock_gating(host); +} + +static void brcmstb_sdhci_reset_cmd_data(struct sdhci_host *host, u8 mask) +{ + int ret; + u32 reg; + u32 new_mask = (mask & (SDHCI_RESET_CMD | SDHCI_RESET_DATA)) << 24; + + /* + * SDHCI_CLOCK_CONTROL register CARD_EN and CLOCK_INT_EN bits shall + * be set along with SOFTWARE_RESET register RESET_CMD or RESET_DATA + * bits, hence access SDHCI_CLOCK_CONTROL register as 32-bit register + */ + new_mask |= SDHCI_CLOCK_CARD_EN | SDHCI_CLOCK_INT_EN; + reg = sdhci_readl(host, SDHCI_CLOCK_CONTROL); + sdhci_writel(host, reg | new_mask, SDHCI_CLOCK_CONTROL); + + reg = sdhci_readb(host, SDHCI_SOFTWARE_RESET); + ret = readb_poll_timeout_atomic(host->ioaddr + SDHCI_SOFTWARE_RESET, + reg, reg & mask, 10, 10000); + + if (ret) { + pr_err("%s: Reset 0x%x never completed.\n", + mmc_hostname(host->mmc), (int)mask); + sdhci_err_stats_inc(host, CTRL_TIMEOUT); + sdhci_dumpregs(host); + } +} + +static void brcmstb_reset_74165b0(struct sdhci_host *host, u8 mask) +{ + /* take care of RESET_ALL as usual */ + if (mask & SDHCI_RESET_ALL) + sdhci_and_cqhci_reset(host, SDHCI_RESET_ALL); + + /* cmd and/or data treated differently on this core */ + if (mask & (SDHCI_RESET_CMD | SDHCI_RESET_DATA)) + brcmstb_sdhci_reset_cmd_data(host, mask); + + /* Reset will clear this, so re-enable it */ + enable_clock_gating(host); } static void sdhci_brcmstb_hs400es(struct mmc_host *mmc, struct mmc_ios *ios) @@ -162,6 +205,13 @@ static struct sdhci_ops sdhci_brcmstb_ops_7216 = { .set_uhs_signaling = sdhci_brcmstb_set_uhs_signaling, }; +static struct sdhci_ops sdhci_brcmstb_ops_74165b0 = { + .set_clock = sdhci_brcmstb_set_clock, + .set_bus_width = sdhci_set_bus_width, + .reset = brcmstb_reset_74165b0, + .set_uhs_signaling = sdhci_brcmstb_set_uhs_signaling, +}; + static struct brcmstb_match_priv match_priv_7425 = { .flags = BRCMSTB_MATCH_FLAGS_NO_64BIT | BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT, @@ -179,10 +229,17 @@ static const struct brcmstb_match_priv match_priv_7216 = { .ops = &sdhci_brcmstb_ops_7216, }; +static struct brcmstb_match_priv match_priv_74165b0 = { + .flags = BRCMSTB_MATCH_FLAGS_HAS_CLOCK_GATE, + .hs400es = sdhci_brcmstb_hs400es, + .ops = &sdhci_brcmstb_ops_74165b0, +}; + static const struct of_device_id __maybe_unused sdhci_brcm_of_match[] = { { .compatible = "brcm,bcm7425-sdhci", .data = &match_priv_7425 }, { .compatible = "brcm,bcm7445-sdhci", .data = &match_priv_7445 }, { .compatible = "brcm,bcm7216-sdhci", .data = &match_priv_7216 }, + { .compatible = "brcm,bcm74165b0-sdhci", .data = &match_priv_74165b0 }, {}, };