Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp883912pxu; Wed, 2 Dec 2020 06:02:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyrGmJffstNHAskRZ9zIL/WkL2OGZNGiMtTcCj9heL0etNc2tsHpzbertqJ/BVho5DXAI6 X-Received: by 2002:a17:906:b84a:: with SMTP id ga10mr2517912ejb.143.1606917725016; Wed, 02 Dec 2020 06:02:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606917725; cv=none; d=google.com; s=arc-20160816; b=MZk6gUmIVjm+/37PCK5wMGGIhKeH/t2If3zb5dO/S56B2VwKy/VVQH+Jyo+ikRmdKH G0V1hlz+lrZbNxZlEkjfdzebpEQJyoRbXHmyaiuZEL5EDKXpPtaRBrKNDLFEflSfc+sJ 1gIQaDZNYdRC3GcTp/x1ykLA7G0MnKemlCwTgexDV2S1hHA822ovQSLqWDIOYmN/Ld5M NIsZ+rMC8gaZM1Pp4G7Iu3DID37fFS+uLxhIh56GlS26zv1JvBymlps3Hv/i5n8HzF85 GYckrzESzxCPKg83ZtKnL2EgWs2UhYFtWstK/cMzpbREu1R2Tk39hS/NXh3SFGyDHuQP Q2ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=vgWRUsq8baopjOW9KGUpwOw0EtNU3l/bIMP9CsWeeR8=; b=XOM0899okVVoTF2KkZk7jcLEWoSriDi1yB3Uo5579EixLAwblxAOm7EQr1SZDePAzo OQokjnU3YH5GV/RqXbmKJBA+33C1GWE8vWItntUxnOYh3Uoj8G06m8H5V2/CANOhyiCj um+k/4d+JVwa20zaPAROtE4/dXBi0MnK9fX+DojQ4x2Ci98eP+T7cNz3Qr26IL+NPNdJ PCFiBy0opZr2+AxS26b5MOR7K8Y+cdkbaEUUntIOAzn/Kw1Bbds3e1OgJGVi/sFewMSP Sy8YiWx0aSZzdkTbhEFuaBjulBzpwooeKmOBR9k5RIKOr6pBweGC/Uq6ALrvfcWIu5z5 H/LA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si856554ejg.677.2020.12.02.06.01.38; Wed, 02 Dec 2020 06:02:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388883AbgLBN4J (ORCPT + 99 others); Wed, 2 Dec 2020 08:56:09 -0500 Received: from foss.arm.com ([217.140.110.172]:40468 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727281AbgLBN4I (ORCPT ); Wed, 2 Dec 2020 08:56:08 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C7DD139F; Wed, 2 Dec 2020 05:54:49 -0800 (PST) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AF67D3F718; Wed, 2 Dec 2020 05:54:47 -0800 (PST) From: Andre Przywara To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec Cc: Icenowy Zheng , linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, Linus Walleij , Rob Herring , Yangtao Li , linux-kernel@vger.kernel.org, Andre Przywara Subject: [PATCH 6/8] mmc: sunxi: add support for A100 mmc controller Date: Wed, 2 Dec 2020 13:54:07 +0000 Message-Id: <20201202135409.13683-7-andre.przywara@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20201202135409.13683-1-andre.przywara@arm.com> References: <20201202135409.13683-1-andre.przywara@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yangtao Li This patch adds support for A100 MMC controller, which use word address for internal dma. Signed-off-by: Yangtao Li Signed-off-by: Andre Przywara --- drivers/mmc/host/sunxi-mmc.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index fc62773602ec..1518b64112b7 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -244,6 +244,7 @@ struct sunxi_idma_des { struct sunxi_mmc_cfg { u32 idma_des_size_bits; + u32 idma_des_shift; const struct sunxi_mmc_clk_delay *clk_delays; /* does the IP block support autocalibration? */ @@ -343,7 +344,7 @@ static int sunxi_mmc_init_host(struct sunxi_mmc_host *host) /* Enable CEATA support */ mmc_writel(host, REG_FUNS, SDXC_CEATA_ON); /* Set DMA descriptor list base address */ - mmc_writel(host, REG_DLBA, host->sg_dma); + mmc_writel(host, REG_DLBA, host->sg_dma >> host->cfg->idma_des_shift); rval = mmc_readl(host, REG_GCTRL); rval |= SDXC_INTERRUPT_ENABLE_BIT; @@ -373,8 +374,10 @@ static void sunxi_mmc_init_idma_des(struct sunxi_mmc_host *host, next_desc += sizeof(struct sunxi_idma_des); pdes[i].buf_addr_ptr1 = - cpu_to_le32(sg_dma_address(&data->sg[i])); - pdes[i].buf_addr_ptr2 = cpu_to_le32((u32)next_desc); + cpu_to_le32(sg_dma_address(&data->sg[i]) >> + host->cfg->idma_des_shift); + pdes[i].buf_addr_ptr2 = cpu_to_le32((u32)next_desc >> + host->cfg->idma_des_shift); } pdes[0].config |= cpu_to_le32(SDXC_IDMAC_DES0_FD); @@ -1178,6 +1181,23 @@ static const struct sunxi_mmc_cfg sun50i_a64_emmc_cfg = { .needs_new_timings = true, }; +static const struct sunxi_mmc_cfg sun50i_a100_cfg = { + .idma_des_size_bits = 16, + .idma_des_shift = 2, + .clk_delays = NULL, + .can_calibrate = true, + .mask_data0 = true, + .needs_new_timings = true, +}; + +static const struct sunxi_mmc_cfg sun50i_a100_emmc_cfg = { + .idma_des_size_bits = 13, + .idma_des_shift = 2, + .clk_delays = NULL, + .can_calibrate = true, + .needs_new_timings = true, +}; + static const struct of_device_id sunxi_mmc_of_match[] = { { .compatible = "allwinner,sun4i-a10-mmc", .data = &sun4i_a10_cfg }, { .compatible = "allwinner,sun5i-a13-mmc", .data = &sun5i_a13_cfg }, @@ -1186,6 +1206,8 @@ static const struct of_device_id sunxi_mmc_of_match[] = { { .compatible = "allwinner,sun9i-a80-mmc", .data = &sun9i_a80_cfg }, { .compatible = "allwinner,sun50i-a64-mmc", .data = &sun50i_a64_cfg }, { .compatible = "allwinner,sun50i-a64-emmc", .data = &sun50i_a64_emmc_cfg }, + { .compatible = "allwinner,sun50i-a100-mmc", .data = &sun50i_a100_cfg }, + { .compatible = "allwinner,sun50i-a100-emmc", .data = &sun50i_a100_emmc_cfg }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sunxi_mmc_of_match); -- 2.17.5