Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp211713ybh; Mon, 20 Jul 2020 14:42:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1+zMQr/tWZg7oAHaVOrdIgdM74W3Qq9+nbO8YL1g1ErRHrw7XSQF296ooiK82gm33VkW1 X-Received: by 2002:a17:907:20b0:: with SMTP id pw16mr21594159ejb.551.1595281365240; Mon, 20 Jul 2020 14:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595281365; cv=none; d=google.com; s=arc-20160816; b=hqfnfTm11Uo579R5AUF4wq84eNYIqTqGMGWo/EQV6uVl8WmJDBbDGjgtOFaYF18MzI uDXWWWfudOgbXDHkDLYpu/8Oh80VZEjsHi8OS9TsZVxvR8KTvqvB0aic2b0nFDKAPWB8 Bq3g2eqgetDwsbmx2wUSmL1cL+DaGxYIYYpMOpIjNtMu1FMM5llMeWLLrcOri2HJTPz4 v4FM6WCe0qVYnV8PpRMrdWol5yfRrSYT6NXFcyKnwubjoRW6NG/1GJyZX5nqKXyWlHa7 n9u9zBNqa6XqAX+5OF8ZWdt5c5gASrGa1Lw8ox5tKocWwJZeu2D62UKmX/zZ/cr5r9O1 eKwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8P4/v6YJWiJoOcjUkUjPOOEKJFN0olDM/wmVALAHvi0=; b=UjTpiGKK1ld75rWQYWgVuk3yIYQ1KwKOBHqASNy+QjI/rNJlW3P0D2qn5NweclRyOS wUPFG73YQg2WrUKyKo/MgmlQiWQ2dtJno1rt9ApTLk4yNsqTQ4z4PTX2aHs8FAgLSy1Z U2Ourd2if84Z9T/ikbztrwQxW1jb8okgUqfz/ycG1vkoemAAUqdDaXYxsk1o2yWd8GFm EiRpa28MxN/uSAE5f68hy3H9w9oXdczx1DtRCrApEx6ZjA+KiJcQRnfoJM04shH3hGUQ LWMndUHIv/rHbfIM3XajDLnA8EB4cecrOv7M4FT+MHpmoM/pdhzt9aEMg4CbNC7dqTCu jteA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d+qqjX2+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk3si12130942ejb.323.2020.07.20.14.42.22; Mon, 20 Jul 2020 14:42:45 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=d+qqjX2+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728480AbgGTVja (ORCPT + 99 others); Mon, 20 Jul 2020 17:39:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:58018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728308AbgGTVjB (ORCPT ); Mon, 20 Jul 2020 17:39:01 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7609322CAF; Mon, 20 Jul 2020 21:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595281140; bh=5UrXs5K40IkwuyX6XDwLrEXO6fTXoOdDk5vlpHZthbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+qqjX2+2B8nr9SL3tj+uWAfmi3EyqylZIzGlvIRwV8EF8N0wE6fHGJ0jhxgL4rOE GH5A7TtbmbDV7F3oCSn1caDZWbb09LpuNyAznY2C6Uu6uCT6SB+0ITVRMoRmNuoAc8 DF1hYXWX3MKv1ny5ZLZBnICCpiG4ZLv+4P3JELYY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "leilk.liu" , Mark Brown , Sasha Levin , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH AUTOSEL 4.19 07/19] spi: mediatek: use correct SPI_CFG2_REG MACRO Date: Mon, 20 Jul 2020 17:38:38 -0400 Message-Id: <20200720213851.407715-7-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200720213851.407715-1-sashal@kernel.org> References: <20200720213851.407715-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "leilk.liu" [ Upstream commit 44b37eb79e16a56cb30ba55b2da452396b941e7a ] this patch use correct SPI_CFG2_REG offset. Signed-off-by: leilk.liu Link: https://lore.kernel.org/r/20200701090020.7935-1-leilk.liu@mediatek.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-mt65xx.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c index 0c2867deb36fc..da28c52c9da19 100644 --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -41,7 +41,6 @@ #define SPI_CFG0_SCK_LOW_OFFSET 8 #define SPI_CFG0_CS_HOLD_OFFSET 16 #define SPI_CFG0_CS_SETUP_OFFSET 24 -#define SPI_ADJUST_CFG0_SCK_LOW_OFFSET 16 #define SPI_ADJUST_CFG0_CS_HOLD_OFFSET 0 #define SPI_ADJUST_CFG0_CS_SETUP_OFFSET 16 @@ -53,6 +52,8 @@ #define SPI_CFG1_CS_IDLE_MASK 0xff #define SPI_CFG1_PACKET_LOOP_MASK 0xff00 #define SPI_CFG1_PACKET_LENGTH_MASK 0x3ff0000 +#define SPI_CFG2_SCK_HIGH_OFFSET 0 +#define SPI_CFG2_SCK_LOW_OFFSET 16 #define SPI_CMD_ACT BIT(0) #define SPI_CMD_RESUME BIT(1) @@ -259,7 +260,7 @@ static void mtk_spi_set_cs(struct spi_device *spi, bool enable) static void mtk_spi_prepare_transfer(struct spi_master *master, struct spi_transfer *xfer) { - u32 spi_clk_hz, div, sck_time, cs_time, reg_val = 0; + u32 spi_clk_hz, div, sck_time, cs_time, reg_val; struct mtk_spi *mdata = spi_master_get_devdata(master); spi_clk_hz = clk_get_rate(mdata->spi_clk); @@ -272,18 +273,18 @@ static void mtk_spi_prepare_transfer(struct spi_master *master, cs_time = sck_time * 2; if (mdata->dev_comp->enhance_timing) { + reg_val = (((sck_time - 1) & 0xffff) + << SPI_CFG2_SCK_HIGH_OFFSET); reg_val |= (((sck_time - 1) & 0xffff) - << SPI_CFG0_SCK_HIGH_OFFSET); - reg_val |= (((sck_time - 1) & 0xffff) - << SPI_ADJUST_CFG0_SCK_LOW_OFFSET); + << SPI_CFG2_SCK_LOW_OFFSET); writel(reg_val, mdata->base + SPI_CFG2_REG); - reg_val |= (((cs_time - 1) & 0xffff) + reg_val = (((cs_time - 1) & 0xffff) << SPI_ADJUST_CFG0_CS_HOLD_OFFSET); reg_val |= (((cs_time - 1) & 0xffff) << SPI_ADJUST_CFG0_CS_SETUP_OFFSET); writel(reg_val, mdata->base + SPI_CFG0_REG); } else { - reg_val |= (((sck_time - 1) & 0xff) + reg_val = (((sck_time - 1) & 0xff) << SPI_CFG0_SCK_HIGH_OFFSET); reg_val |= (((sck_time - 1) & 0xff) << SPI_CFG0_SCK_LOW_OFFSET); reg_val |= (((cs_time - 1) & 0xff) << SPI_CFG0_CS_HOLD_OFFSET); -- 2.25.1