From patchwork Mon Oct 24 11:29:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400090wru; Mon, 24 Oct 2022 04:46:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4M1kicSHvaWevPHfjwtgoydlVKzSxCeq7DeI27+l2TFk+V8hxQWnj+0SzbqFAUY+5I5QK2 X-Received: by 2002:a17:907:97c3:b0:79b:3f8d:a354 with SMTP id js3-20020a17090797c300b0079b3f8da354mr14079497ejc.461.1666611976802; Mon, 24 Oct 2022 04:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611976; cv=none; d=google.com; s=arc-20160816; b=h/7/RT42h2zJzEdoWEID/5WaGpyE3dB8Qi+lc98NvujGwn2wpPcdMb02rAM6fEqxMx zM92qFIlC2PyDYUi5IlVPsB0kZvgYS6Q3gSoNJAtwtG6vo+76hSZ8G464NhNSTsKwpmn XB3jaYAO/fTq7HmDhNagZ5C22nRt1CLU3IkKlewrKANErcENVWaFJsMJMdudfT72k+BP 3d9hQJPjL2/4h2M9kOYl4xm/jlWchAfKIwimJDveFQOmJZLvztUqgw5a/dUogfJLsaMc F/kYC1aFpccGLf37WGBCryCZsPt4o09JBV4j/LoNbbvWC49l2zxcy5Y8rqgiWHqkeH9/ aLvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zxHWiFF2D+QcxEpX9wVlDThG/Iu9gilWkd5RFeJOVl8=; b=uM/WIpjjQ2mC2KLo/EWSLoPn/nDIMuWhN+DZ4IzeBglezWj9KeXebtnfcsJM5f0pJT C3/hmZo+tDraegK8WSMNVK/a3C79WlZJvnRz1WS7+zdxkOi11lJnoxpVlfbH4J/Ivh8T 7rwaplnd0r5hUN7UGUiS7QXzL+r5bQl5y7QqIO4tuv6tI+PBDIqDs0wBK6U1+6/Jr458 CQZWxgjmD/eK7yMz3hsu/VClVGjqUZdSQIIHiI9YZNrZU7BxHsgVSj7LR4DKUrYzW8KJ OvpKbTPM+b8HJwkkgInOk7BBJ0ZCQqhMaQ+tfMyVoMAVuP48ZutJB/r91A9TWPXTDMfn XGsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pNWea4CP; 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=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 2-20020a508e02000000b00460ce6c3a1asi10997631edw.454.2022.10.24.04.45.53; Mon, 24 Oct 2022 04:46:16 -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=@linuxfoundation.org header.s=korg header.b=pNWea4CP; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231450AbiJXLpW (ORCPT + 99 others); Mon, 24 Oct 2022 07:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231549AbiJXLn7 (ORCPT ); Mon, 24 Oct 2022 07:43:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A244871989; Mon, 24 Oct 2022 04:41:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 75B206127C; Mon, 24 Oct 2022 11:39:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86EC2C433D7; Mon, 24 Oct 2022 11:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611542; bh=X+j2w1ZK+eto3zhhvWVEinzAqML9IWon1wYQ/a8AxZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNWea4CPCCIeHz9KB+Iuuf0FqyfqpGUiD3SGFczvF8URbxS8NefOeFMcDLWheioBc 4c5/nARgINm6oLH9l8Q05eI8jxZ3+RvzJmVPpViavp2gvh0acNh7EiGh7fuFwgz85q Dj4NKuYZD41ViNPzWC8Ax7aSvTvc+Pb+PgPvSKBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Antonov , Jonas Jensen , Ulf Hansson Subject: [PATCH 4.9 006/159] mmc: moxart: fix 4-bit bus width and remove 8-bit bus width Date: Mon, 24 Oct 2022 13:29:20 +0200 Message-Id: <20221024112949.597564194@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_SBL_A 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747569320163726186?= X-GMAIL-MSGID: =?utf-8?q?1747569320163726186?= From: Sergei Antonov commit 35ca91d1338ae158f6dcc0de5d1e86197924ffda upstream. According to the datasheet [1] at page 377, 4-bit bus width is turned on by bit 2 of the Bus Width Register. Thus the current bitmask is wrong: define BUS_WIDTH_4 BIT(1) BIT(1) does not work but BIT(2) works. This has been verified on real MOXA hardware with FTSDC010 controller revision 1_6_0. The corrected value of BUS_WIDTH_4 mask collides with: define BUS_WIDTH_8 BIT(2). Additionally, 8-bit bus width mode isn't supported according to the datasheet, so let's remove the corresponding code. [1] https://bitbucket.org/Kasreyn/mkrom-uc7112lx/src/master/documents/FIC8120_DS_v1.2.pdf Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver") Signed-off-by: Sergei Antonov Cc: Jonas Jensen Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220907205753.1577434-1-saproj@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/moxart-mmc.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) --- a/drivers/mmc/host/moxart-mmc.c +++ b/drivers/mmc/host/moxart-mmc.c @@ -111,8 +111,8 @@ #define CLK_DIV_MASK 0x7f /* REG_BUS_WIDTH */ -#define BUS_WIDTH_8 BIT(2) -#define BUS_WIDTH_4 BIT(1) +#define BUS_WIDTH_4_SUPPORT BIT(3) +#define BUS_WIDTH_4 BIT(2) #define BUS_WIDTH_1 BIT(0) #define MMC_VDD_360 23 @@ -529,9 +529,6 @@ static void moxart_set_ios(struct mmc_ho case MMC_BUS_WIDTH_4: writel(BUS_WIDTH_4, host->base + REG_BUS_WIDTH); break; - case MMC_BUS_WIDTH_8: - writel(BUS_WIDTH_8, host->base + REG_BUS_WIDTH); - break; default: writel(BUS_WIDTH_1, host->base + REG_BUS_WIDTH); break; @@ -648,16 +645,8 @@ static int moxart_probe(struct platform_ dmaengine_slave_config(host->dma_chan_rx, &cfg); } - switch ((readl(host->base + REG_BUS_WIDTH) >> 3) & 3) { - case 1: + if (readl(host->base + REG_BUS_WIDTH) & BUS_WIDTH_4_SUPPORT) mmc->caps |= MMC_CAP_4_BIT_DATA; - break; - case 2: - mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA; - break; - default: - break; - } writel(0, host->base + REG_INTERRUPT_MASK);