Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2526141rwb; Mon, 3 Oct 2022 01:58:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7wlwww8kBai6sFOA5lGqMPONn4WaXWnjMgSrB3IIxzUtcWTK5fKw6lVOWswroBi1cvuHNG X-Received: by 2002:a17:902:e84c:b0:178:2a08:501c with SMTP id t12-20020a170902e84c00b001782a08501cmr21256321plg.110.1664787534699; Mon, 03 Oct 2022 01:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664787534; cv=none; d=google.com; s=arc-20160816; b=fbw6WyPCILajBhsGwI/1xr5B7Wd7CZOqKqfRfhVAE1tUMXoMwxflEde/iLDl7RL9FE QskKu3q55jbY+ivpW/csJreJltjzawXNeN28GSyZy16fLo8Wt1UxBu9HN7fCn/8XrXI+ 0hek4Tpaj5mTlTOqwSynIXEpJVP/GhiRbP/4LXSSxOuepfYGQPYQLNVKdUmkb8mfhtCA HRWC4lh08JP9mYEFhv+N3+LhAKExDBVN/axa3vMMmt24paYH8D7ihdwsQAusL3dZ1kbq NIlJD75nUDkP/shDQl/e106uf4aExlidovIMLjLCr3fEMqhUGdC+nLlezuVG1NN4a234 mhQQ== 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=wxqJYGuGMstn6BqUA4cvyISzVC7B3KHUTHJbHuWZusw=; b=atNNOMJ4TTGc+I0ESI3fRgdP9RKzSkyWNNxUCMBUdZScJh3bPQb69dgBAFOASn1aXA Qv53RzBNZmImmcV1ISsFTkTWSlHbn9p6GahVfMeslfmYhMEWz7SW5napcnkUrKn3ByMQ powiwR5/V3IxMMJNTF2sRTUiy8vuN2A/EkpD3uXHOJugv154d2+TQ43W1KfI0JElIYoB 7rmV3bnskCsD6oC/P5/OUzyTJraMuD+bCtmz36qSKeAY13VLrL9oVT1Txcmza8AhwHUa iufZdFa8XkTr7olfUvWDyQivCpZotPzI+N3eLsMz6XMyUDo8DoHZvPCROtDZw+s4QlAu EuLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fRmBiOHW; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mu6-20020a17090b388600b00205593e76e8si14937254pjb.81.2022.10.03.01.58.42; Mon, 03 Oct 2022 01:58:54 -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=fRmBiOHW; 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 S231981AbiJCHiq (ORCPT + 99 others); Mon, 3 Oct 2022 03:38:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231731AbiJCHg4 (ORCPT ); Mon, 3 Oct 2022 03:36:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A4E6543E4; Mon, 3 Oct 2022 00:22:57 -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 ams.source.kernel.org (Postfix) with ESMTPS id A26A6B80E89; Mon, 3 Oct 2022 07:21:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF686C433C1; Mon, 3 Oct 2022 07:21:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781672; bh=1nIAEjcL5Wy9N0B91CvpmiiumaBj4iMX6wdU2MSWZwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fRmBiOHW06SP/NqQxmGhRDsPbg+llKv5lIX00RXU5ToGzJG85WBxE0+dPpjfo0JtC Vz3oJEBs8GZZODU6GVqH+NmfIBikuil7Ztu1OCWRgagfNFzB4/5u2xz1y9niQUk6Wc xs6B/GTb8MY1eFTWOAMp7fOq3V5fhsxi8fpmhFGo= 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 5.10 21/52] mmc: moxart: fix 4-bit bus width and remove 8-bit bus width Date: Mon, 3 Oct 2022 09:11:28 +0200 Message-Id: <20221003070719.360928836@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070718.687440096@linuxfoundation.org> References: <20221003070718.687440096@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.0 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 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 @@ -527,9 +527,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; @@ -654,16 +651,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);