From patchwork Wed Sep 27 18:45:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Wolsieffer X-Patchwork-Id: 145535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2830777vqu; Wed, 27 Sep 2023 11:50:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3x2hmTj3S5gEJdRPLvB61TOm7TdywTIhpXeU2z4C/bNT9XYR+hzrwIAD9eQ0HRRkMVo/Z X-Received: by 2002:a17:902:ab96:b0:1c2:82e:32de with SMTP id f22-20020a170902ab9600b001c2082e32demr2558815plr.0.1695840602079; Wed, 27 Sep 2023 11:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695840602; cv=none; d=google.com; s=arc-20160816; b=n9YSZsCGp+i8JZHjzl/NRAJvQ5E0PLllKPLXd71w4RW6n0Mo3ejd01bVpLspOiqD4f tUSzZ7k7Hw1XaErxsOdi/TYrSx+KtlFAiPfMAJZYBMnIHxJR0/vSw3FFICj3536iLcZJ m8YSGHssStlHV9kswz8+UW/7pXk+tYzWZK+y8fz+dA12obTH9gjlgCNNNli8jayoxQIQ DBaQBe+DfDYGvXHHFDe2GVvl1mMCTBC14jd3QFHPOGrrqM2R8XRiQU0THJ+sYGBovTjs /3wSX+w9vspOEnaW3MgBcsU5HazScVRRiP8y4M3xtlTi6A/YyrsbbpovHq+oPCYtJ2jH YfBA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=xGsoS6S76d+wc39dHVr5d6LqZuXhI4/2gCLnqm1TcHs=; fh=/nWPnCvx1jFkutuC6DweaMBKA/JwhsLvoo+AyzolZQo=; b=ATRZk9ZHI+XPetwOVyuB0mOZp4vX45ao2IKZNUmscbBeV5a3BiWF9VqN8u3nBaD5cb 3WUIN0YiV5L7sMmfOChw4ICv5lIryHfZU8d5tYlZn0kZMm3zfKEZrCcFFlkSrnQJLSvt 0lDuGDPPs0+ihdKkif22uy7MsdiFw75xaHDnBnZFjVEswA7fc8k82sfCcP/8I2b3ufP8 snXpKrxK7oLJQ19Zb47zotUWir5M8/a0iW25oTdCfdw3bzG3zdKYKKLa6pW1p852SYYX iwb5UMW7P4nzOVlRh/hR2OTOn7J97MxCMuei9QHT7t0uQ6lLRk0PJSkvxagOMPSzmB8T 37jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hefring-com.20230601.gappssmtp.com header.s=20230601 header.b=Tx6qmdJG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id o11-20020a170902d4cb00b001b894687ec9si17487731plg.462.2023.09.27.11.50.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@hefring-com.20230601.gappssmtp.com header.s=20230601 header.b=Tx6qmdJG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 9C0608088541; Wed, 27 Sep 2023 11:47:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229539AbjI0SrG (ORCPT + 20 others); Wed, 27 Sep 2023 14:47:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjI0SrF (ORCPT ); Wed, 27 Sep 2023 14:47:05 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88BD3DD for ; Wed, 27 Sep 2023 11:47:04 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-7740729ae12so778896485a.1 for ; Wed, 27 Sep 2023 11:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hefring-com.20230601.gappssmtp.com; s=20230601; t=1695840423; x=1696445223; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xGsoS6S76d+wc39dHVr5d6LqZuXhI4/2gCLnqm1TcHs=; b=Tx6qmdJGqtbLxKKG5F+TQKLy+Lu9Fwv2VXVv/6UJfBoiUtTyQ+PyalRanal+PiXSlX 3UqmZWpygyX2Z2dPgBMmr4whJX1R8MKrQiSgFD+AAm/YRMMeWFq0yZZ3auJS37OqNchP QtLg5+yydBTjGGnj7/EC0Y5Zub3y7SGEx6ntAJ9q3MjSV1Zd34TLfiXkjKARqqvJ7CQW fYwCSNPTBQtSfXFlzJeMzNoPedxf9cFU/GOp+NRPWq1GwV0xW0DQCHjD2ZswhSLR5dLe WgbeSRYIHHl6akaEglgpSnEF4pevEbvP3cRVpYdFF0jDWc7BpyUVluQ7dZC/RmMZzn2S CXug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695840423; x=1696445223; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xGsoS6S76d+wc39dHVr5d6LqZuXhI4/2gCLnqm1TcHs=; b=JqiHbM6ljvTE/PaSDPW6iFYDaDPV/HwQ9rqydNR0Y9bHzkGY09KY8Wm6Jf2ItCFZU1 pqnbWerwnKFqpoyfMQ3rfRuCLAGL4Dcruidpb4/veZ5fmgTSgr/KHIZugM4DcJnIl9zR VUMfIM4Bdz1g5vHn81WYMoYfKomMmpfK1Lk6KUQ6rX5+YIyBIZAyHIRuZNhPFJlz5c6L xAdHJi4YuXuLX5w2tt076zqoVFmXnNoP4jLCWbfrL/YfH61yjmHXwtUO3rDUU5X5Um/E ius1QlvTFiY5tLz6FC91w+g8KoOX59VkebbCFG5Bct02+P17jk3icM6vOVCHnMvfbzft cpig== X-Gm-Message-State: AOJu0YxvuAe8vyZNWGGFtwA5+2YgPhuS3AA3MrK61yZkrkSFfYBluCqE 5njqhDbqliLFb5saNowDiGNfmw== X-Received: by 2002:a05:620a:8325:b0:774:2893:3f25 with SMTP id pa37-20020a05620a832500b0077428933f25mr2602290qkn.25.1695840423687; Wed, 27 Sep 2023 11:47:03 -0700 (PDT) Received: from localhost.localdomain ([50.212.55.89]) by smtp.gmail.com with ESMTPSA id d8-20020ac81188000000b00411fcc18cc1sm5522232qtj.64.2023.09.27.11.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:47:03 -0700 (PDT) From: Ben Wolsieffer To: linux-stm32@st-md-mailman.stormreply.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Russell King , Ulf Hansson , Yann Gautier , Christophe Kerello , Linus Walleij , Ben Wolsieffer Subject: [PATCH] mmc: mmci: use peripheral flow control for STM32 Date: Wed, 27 Sep 2023 14:45:56 -0400 Message-ID: <20230927184556.1422122-1-ben.wolsieffer@hefring.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 27 Sep 2023 11:47:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778217755118498983 X-GMAIL-MSGID: 1778217755118498983 From: Ben Wolsieffer The STM32 SDMMC peripheral (at least for the STM32F429, STM32F469 and STM32F746, which are all the currently supported devices using periphid 0x00880180) requires DMA to be performed in peripheral flow controller mode. From the STM32F74/5 reference manual, section 35.3.2: "SDMMC host allows only to use the DMA in peripheral flow controller mode. DMA stream used to serve SDMMC must be configured in peripheral flow controller mode" This patch adds a variant option to control peripheral flow control and enables it for the STM32 variant. Signed-off-by: Ben Wolsieffer Reviewed-by: Linus Walleij --- drivers/mmc/host/mmci.c | 3 ++- drivers/mmc/host/mmci.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 769b34afa835..90e32f18abbc 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -249,6 +249,7 @@ static struct variant_data variant_stm32 = { .f_max = 48000000, .pwrreg_clkgate = true, .pwrreg_nopower = true, + .dma_flow_controller = true, .init = mmci_variant_init, }; @@ -1012,7 +1013,7 @@ static int _mmci_dmae_prep_data(struct mmci_host *host, struct mmc_data *data, .dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, .src_maxburst = variant->fifohalfsize >> 2, /* # of words */ .dst_maxburst = variant->fifohalfsize >> 2, /* # of words */ - .device_fc = false, + .device_fc = variant->dma_flow_controller, }; struct dma_chan *chan; struct dma_device *device; diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 253197f132fc..9a81f30f6748 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -332,6 +332,7 @@ enum mmci_busy_state { * @opendrain: bitmask identifying the OPENDRAIN bit inside MMCIPOWER register * @dma_lli: true if variant has dma link list feature. * @stm32_idmabsize_mask: stm32 sdmmc idma buffer size. + * @dma_flow_controller: use peripheral as flow controller for DMA. */ struct variant_data { unsigned int clkreg; @@ -378,6 +379,7 @@ struct variant_data { u8 dma_lli:1; u32 stm32_idmabsize_mask; u32 stm32_idmabsize_align; + u8 dma_flow_controller:1; void (*init)(struct mmci_host *host); };