Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2556893rwb; Mon, 3 Oct 2022 02:30:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Lt22l0uQZgEGRihyzm2OKy0drOV3UtPKVwLje3ncV9nF0rTZNvIjDsZvIQkageMNTFHmt X-Received: by 2002:a17:906:ef90:b0:77c:280b:93a1 with SMTP id ze16-20020a170906ef9000b0077c280b93a1mr14855599ejb.709.1664789456339; Mon, 03 Oct 2022 02:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664789456; cv=none; d=google.com; s=arc-20160816; b=b5BslF60j/InkOkffNGRBr9BfzPfDykzkxLe4PkQqn+gnjM93sniIbjiXjCVsW6wlR d9vkR/EKR9U8ph6Y0B6K+hxMua826KDm4JW+q+0QNLI5OdZSjb5s9dPlTolyMg94iIiW M9VAB1OjyE4pxlM9WmzckiS1VrKJpnaIxymruspttXxpdefmQIp/GSssI0fsBkYyqV9Y uM1rTuNJ9l+852jxki1xvycpvpFkyZyoJIOMoyYRRA0neBEwSHuXXDmz3BdfmmyVnszj 4LoqqgbunyiYSJTvAQdoNRf1SqlBuK2BbL470FnJCiNVb6r73Q1f2iBKRKr+d9zk6/S5 E1mg== 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=5JDQ5JxwHG7ImgmOgtD4Uj5YlyQwJygadf0Ll876N/w=; b=0Y1Q/hGXxskt/Ad5JexanB9UD3gn5XFVwFqNBkn+izhLUs4pM33NUEkQpaXoaERdcs /gM/j0JEcX5YZAr8xAcTht3GdcYkbVYJjL7RKhoL2ucX7UjOGvYIAimpz4UBPBjOGvcI nQDDsCgOofboMvTiWzp7yQnjNybNu1V/skPHdRqLCGcPECFPPVyEDIyJJUrwJ/nsHiae PArgD2rUDqaccos0c07uRI5AzX6vH3qWa8pplLsfhPfEbAFdgm+jyUX36M2gCMMXrGcz YW/uaikTUppWj/IQNiNgpYnDb3NA7OGc1gX/XlrpyHyv7YKo13qY6yTKAukDJk6OzrFY PSzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2f6V+HIy; 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 d11-20020a056402144b00b00458b07cddb5si4984874edx.274.2022.10.03.02.30.30; Mon, 03 Oct 2022 02:30:56 -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=2f6V+HIy; 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 S230419AbiJCIwQ (ORCPT + 99 others); Mon, 3 Oct 2022 04:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbiJCIvt (ORCPT ); Mon, 3 Oct 2022 04:51:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D45885AC65; Mon, 3 Oct 2022 01:35:44 -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 1BA9BB80E87; Mon, 3 Oct 2022 07:19:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F5ADC433C1; Mon, 3 Oct 2022 07:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781561; bh=XlEsKmMwMZ0trT6yuKAC/k9dEZb/s+PDZV0Hw2+rCEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2f6V+HIyGe7tAAHPDpSh0OwPJFLrc1iN+61Rdw6OHMQ0f4kwdoQ2TMw8Ugdy0iQJr zc2Jk6RDStd6huNz5P3y2of1N4SX4T9Q69AoItU+PEipyuR0/y8Eezy4NeFmg81sZ1 TcTAd8HwCWjX06CM06WuQdurF5MUyjwMBYJTkdB4= 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.15 27/83] mmc: moxart: fix 4-bit bus width and remove 8-bit bus width Date: Mon, 3 Oct 2022 09:10:52 +0200 Message-Id: <20221003070722.679321491@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@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 @@ -524,9 +524,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; @@ -651,16 +648,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);