Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1315365rwd; Thu, 8 Jun 2023 16:12:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4CpEpKDK6Sam3q6RACsACE0EMALNkbRAS5eTj2aoEsDMjBOhFTktZ/hntPzt1joC2Xk+7z X-Received: by 2002:a05:6358:1a8a:b0:123:3cc5:e6be with SMTP id gm10-20020a0563581a8a00b001233cc5e6bemr6961104rwb.9.1686265963970; Thu, 08 Jun 2023 16:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686265963; cv=none; d=google.com; s=arc-20160816; b=KyKhaz6MmWuweJiKKKMq2t0d8xBnsjimC4dQc+WeeYnxkedibMbS03t5+aldiZA6Za 5A2J+exnF44/xNcb/r8eLRTqioJBJ7B+2p4Gk9kKqJNk7T7OZEa4SCQXZoN4YWQUJH1v WWbquqhb2LxtJdRPRHIyTtxrVCHF9MhFpoi8YPANKp4n3EPmDQ+HHR3TtC76axZlBKcK axeruTC6CNpClt3Gs4dz5EPGA9JU9Wf8VUd8N8AdpzwLnsekesD2LZGXT1pl6FjskZvt kTfY9JkCspGdoQ1Lg2SL1j6enfr/pBlnTrqvUoWKFJbATSelZFbtlVCMKLWJXUqmNf7f Ejrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4RuUAGdF6ksVWX/V1p878VKkq1mr3gQQSAdPGDm1wSU=; b=UgLXLMw3eNw4rv8MyS4p0CdpWBcBOkA9+P2oRDDOGzV3NHacru4LlR5eIk+ts1YI5q IfLY6jPSVetQMC+/SGuhMqrMnIpnMEpoKaFoHZemjLLydpNUkiUZZHVDlOAs13hIyzPs cmzjRMGF7VX79ck0fgk0NrNX7HAnokAqbrLJmpCeg0ohOksOHULkncXMgzR+wkRad8uT JNQa+l/Wb244/XXT/s25/ZSHrbxDjhte3KODO/yp8og0/XNw9sTlpFq24EqwZbvAaGeu x+fHSUE1VgvtFIWM620SjpqmxwCWLBJ/CXQQP1mhlEaRSI1l3gafc3uTTScHXZ2OywO1 Kt5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E2n3Qmyg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c123-20020a633581000000b0052c9896a41fsi1584155pga.164.2023.06.08.16.12.28; Thu, 08 Jun 2023 16:12:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E2n3Qmyg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236392AbjFHWuc (ORCPT + 99 others); Thu, 8 Jun 2023 18:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236399AbjFHWua (ORCPT ); Thu, 8 Jun 2023 18:50:30 -0400 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D32C32D5F for ; Thu, 8 Jun 2023 15:50:28 -0700 (PDT) Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-ba81ded8d3eso1217266276.3 for ; Thu, 08 Jun 2023 15:50:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686264628; x=1688856628; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4RuUAGdF6ksVWX/V1p878VKkq1mr3gQQSAdPGDm1wSU=; b=E2n3QmygG6mBTFtq+c60GKW16BROIMRCLSvvZzyB5McQYIkFBaLl9s8uTOv0pA1sh5 lP0drdMNDgAf85uw/cF+r5BJ8WaZ2Zc3bK//QWXpIqPAUC50tK93s/3YLbjEnSX6bKNb 0AwERGiuAf1HEwA95T5CpKJOdaoiotfBuaADlXKwtVwz2M7V4umGZEvmUB/Xb+8Ti3Oe ZJy0pEa+4vZoL9BfArmZjkzAGIkZx1zqMLIpz5Iwl5w90GVvefvd7E72kL5Jnad02q5U Zpdbc8vj5HEiPZvOvUgG8iEupb3mu57u6CGq3DyJ/D1xFIJjtRGM3h7A2p3WLpa+z+3X Y2Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686264628; x=1688856628; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4RuUAGdF6ksVWX/V1p878VKkq1mr3gQQSAdPGDm1wSU=; b=SBxpSN9pbS08SRw/CHI+q4suhMVHM78C1AqmK/K/jYoMV7BJAkp8YrHe/1ulUIJTg0 6BT2kvpua9+vDi7xbGimGmZlTPLNgaCksoKOLrYn6AhnjoqoSwhMPgPJMfclpv0dqzOE D8Ji2GKCsGMIuYkGGwUAn/lKnl4qu4heV7fkFMPAZfDkGpKPKQ7fVKZM/s1slWc2tAvJ UtWmde1WFK38QsokDhSRLVew7tMkW1vQiEh4+qhASXOhE63tqV41+5U1/QacYs+29tZj aPb2gCKS9HT2Zx1N5yRqPnTv50WAUZqk5WA/ZuWzYQcJ7nPwklsOWqfiMnW/e2uWeoI1 PXGQ== X-Gm-Message-State: AC+VfDxR1rfikDOmMimTJaei2ZPutFQrRJv/NsXBDWiWI+QSKwuRSEDx MeY54838IMTbFPwtndO+wbghs9IEcThz0i5WyJ5YgQ== X-Received: by 2002:a0d:f6c4:0:b0:55a:40d3:4d6f with SMTP id g187-20020a0df6c4000000b0055a40d34d6fmr855851ywf.26.1686264628032; Thu, 08 Jun 2023 15:50:28 -0700 (PDT) MIME-Version: 1.0 References: <20230601015115.406002-1-victorshihgli@gmail.com> <20230601015115.406002-5-victorshihgli@gmail.com> In-Reply-To: <20230601015115.406002-5-victorshihgli@gmail.com> From: Ulf Hansson Date: Fri, 9 Jun 2023 00:49:52 +0200 Message-ID: Subject: Re: [PATCH V5 4/4] mmc: sdhci-pci-gli: Add support SD Express card for GL9767 To: Victor Shih Cc: adrian.hunter@intel.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, benchuanggli@gmail.com, HL.Liu@genesyslogic.com.tw, Greg.tu@genesyslogic.com.tw, Ben Chuang , Victor Shih Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [...] > +static int gl9767_init_sd_express(struct mmc_host *mmc, struct mmc_ios *ios) > +{ > + struct sdhci_host *host = mmc_priv(mmc); > + struct sdhci_pci_slot *slot = sdhci_priv(host); > + struct pci_dev *pdev; > + u32 value; > + int i; > + > + pdev = slot->chip->pdev; > + > + if (mmc->ops->get_ro(mmc)) { > + mmc->ios.timing &= ~(MMC_TIMING_SD_EXP | MMC_TIMING_SD_EXP_1_2V); > + return 0; > + } > + > + gl9767_vhs_write(pdev); > + > + pci_read_config_dword(pdev, PCIE_GLI_9767_COMBO_MUX_CTL, &value); > + value &= ~(PCIE_GLI_9767_COMBO_MUX_CTL_RST_EN | PCIE_GLI_9767_COMBO_MUX_CTL_WAIT_PERST_EN); > + pci_write_config_dword(pdev, PCIE_GLI_9767_COMBO_MUX_CTL, value); > + > + pci_read_config_dword(pdev, PCIE_GLI_9767_SD_DATA_MULTI_CTL, &value); > + value &= ~PCIE_GLI_9767_SD_DATA_MULTI_CTL_DISCONNECT_TIME; > + value |= FIELD_PREP(PCIE_GLI_9767_SD_DATA_MULTI_CTL_DISCONNECT_TIME, > + PCIE_GLI_9767_SD_DATA_MULTI_CTL_DISCONNECT_TIME_VALUE); > + pci_write_config_dword(pdev, PCIE_GLI_9767_SD_DATA_MULTI_CTL, value); > + > + pci_read_config_dword(pdev, PCIE_GLI_9767_NORMAL_ERR_INT_STATUS_REG2, &value); > + value |= PCIE_GLI_9767_NORMAL_ERR_INT_STATUS_REG2_SDEI_COMPLETE; > + pci_write_config_dword(pdev, PCIE_GLI_9767_NORMAL_ERR_INT_STATUS_REG2, value); > + > + pci_read_config_dword(pdev, PCIE_GLI_9767_NORMAL_ERR_INT_STATUS_EN_REG2, &value); > + value |= PCIE_GLI_9767_NORMAL_ERR_INT_STATUS_EN_REG2_SDEI_COMPLETE_STATUS_EN; > + pci_write_config_dword(pdev, PCIE_GLI_9767_NORMAL_ERR_INT_STATUS_EN_REG2, value); > + > + pci_read_config_dword(pdev, PCIE_GLI_9767_NORMAL_ERR_INT_SIGNAL_EN_REG2, &value); > + value |= PCIE_GLI_9767_NORMAL_ERR_INT_SIGNAL_EN_REG2_SDEI_COMPLETE_SIGNAL_EN; > + pci_write_config_dword(pdev, PCIE_GLI_9767_NORMAL_ERR_INT_SIGNAL_EN_REG2, value); > + > + pci_read_config_dword(pdev, PCIE_GLI_9767_CFG, &value); > + value |= PCIE_GLI_9767_CFG_LOW_PWR_OFF; > + pci_write_config_dword(pdev, PCIE_GLI_9767_CFG, value); > + > + value = sdhci_readw(host, SDHCI_CLOCK_CONTROL); > + value &= ~(SDHCI_CLOCK_CARD_EN | SDHCI_CLOCK_PLL_EN); > + sdhci_writew(host, value, SDHCI_CLOCK_CONTROL); > + > + value = sdhci_readb(host, SDHCI_POWER_CONTROL); > + value |= (SDHCI_VDD2_POWER_180 | SDHCI_VDD2_POWER_ON); > + sdhci_writeb(host, value, SDHCI_POWER_CONTROL); > + > + pci_read_config_dword(pdev, PCIE_GLI_9767_SD_EXPRESS_CTL, &value); > + value |= PCIE_GLI_9767_SD_EXPRESS_CTL_SDEI_EXE; > + pci_write_config_dword(pdev, PCIE_GLI_9767_SD_EXPRESS_CTL, value); > + > + for (i = 0; i < 2; i++) { > + msleep(10); Please convert to usleep_range(). [...] Kind regards Uffe