| Message ID | 20200420120921.12840-4-jagan@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBD7MFH7A7EEBBB5C632AKGQEN5DRZQY@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C114F3F086 for <linux-amarula@patchwork.amarulasolutions.com>; Mon, 20 Apr 2020 14:09:44 +0200 (CEST) Received: by mail-yb1-f199.google.com with SMTP id 5sf11563072ybx.13 for <linux-amarula@patchwork.amarulasolutions.com>; Mon, 20 Apr 2020 05:09:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1587384584; cv=pass; d=google.com; s=arc-20160816; b=SaK5+P/8DET6+kKQn1iOs/q1mKxJc5NmEP7eIQRF3xy6hg+1PPenZZtK2HUXH90/n8 UatDnn+nbPBi9U3G7bcIE2Ch3TFRL9YIvOAGcYnD5WMhypVvck93GsT8lMvFyziRA9cr MxnJeKGWwqO+gOOQ51n3WuYO4YmUwf4NEj3kzX0Nl161atiZFhhj2fZyfdEumt+LxVtY 2Q1f7ljojiJ7nM0VtP9kV9OZZsqb1sky2hUJyMOVwS3ljTirUWOsKOR+CNudTWU6WPfa gS7bhVYT4z7rKxjAiLiYPumVWxcliQvvNYemZt7IW9cNJV2MrY9TjrZH8qB186/LwSRk XUiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jXU/OhrZcddKAeClnQPKtwqLI0lb6zkx1AzfjbSV6/Y=; b=CfbuNfBMDFpX0vFnzgZIlIZb2VMagUQUXPl9msQA5DkqjmfAgZocFubUNNzUrosvkv Z3TC5niDDt/f6H/ipHaOe0gx1wbDtS/JwdfnBMCETzWcuQRS4jjuoHjQH5gZKNXZuCgB nHcrFTw6fSMsNO7nkGwHgrK8lLkSTJIu9w+JHFoiK2BIsFsS5GYNXfu58HECS5RowqCo XNeR1Cnq3l7cPONkn992pGm3XBci3EAdBUxum8viIwkHzobGAvl28Az3oxIVN/DHOi9U 6hfwy8R7xPKTFwRG4h+y1tg4D0HJigG72bPjFfKkdHBD+IiRomPDos7ZVD8Wo8+7CQIK db6w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TaqzgdYO; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=jXU/OhrZcddKAeClnQPKtwqLI0lb6zkx1AzfjbSV6/Y=; b=kwKll3sI1WsxbFS7R6fWzilzKHhhwXz74gW4Ug5ItU2MHdhdeC7NUzIdUdtiTYU/DN bdv9RZd2Q2de5YlaXijQptU9oz0ur4KXj+DYFHreTGGZFPh9yEECqkU+8Ox2dSTMGfMi 81pxaPXx/5bAsCAa30Tn6O/jp6RGcY4qpkZMc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=jXU/OhrZcddKAeClnQPKtwqLI0lb6zkx1AzfjbSV6/Y=; b=KOugx2LQ3v7Cbsbn/T2wa4oowruC7Vw4EZr57NgaPYpI80WBRMrULF4klLwgA8HHcs JNQNKlcwfoTvCh5u0bkyjY1xyja/rOkPzArN0kFeqSYF50PbwyYd28j0hcq7bhC9eq67 wTYISZgcnNNayQduYqeIbWdLPSupoq6it+/9o6zNkCfGTFXT7D2Ibs788pJuGMKv1lMN W4FSHydVO8cS9zFtVlxMgApi+7eWCM9nyaavHJwJzdZPI2509NixkuslpMXfzbk2q0r6 bDQ0pKdxuxZQRiZa5JjIt/oytZZvYym2jr47icSY6S3n0l5W2rpkxDeT59t25IgMR9dI wtWw== X-Gm-Message-State: AGi0PuYI7n3vNI0FnmIMEILU2L5plg4Pu3jrKFF7Rrd4F0z1SWtXCCQ4 Ov0a2rvcEN0Ciy4P8gr7QL6xniTy X-Google-Smtp-Source: APiQypLk+MAYM4JGbMmj9DQi+VULgLIBA1wnw4GvsZ9nAsazszsaxF0jOGmV3JSZ02s+Dxss4/GA4w== X-Received: by 2002:a25:cb0e:: with SMTP id b14mr14998335ybg.76.1587384583847; Mon, 20 Apr 2020 05:09:43 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a25:e00d:: with SMTP id x13ls3857220ybg.7.gmail; Mon, 20 Apr 2020 05:09:43 -0700 (PDT) X-Received: by 2002:a25:5c5:: with SMTP id 188mr18407689ybf.342.1587384583390; Mon, 20 Apr 2020 05:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587384583; cv=none; d=google.com; s=arc-20160816; b=ZTSsOAXaXtF3jFfB00T7sOGG5SIc/FfZAPLuSOHR0ua+t0lB3dr5CxI+95RGT9LYiR Ef85z8Vt1aZ43Lhf0CO84kNF/qZilk6IaoSxCrrmbVjJvOOzMzLg+K1QBJ2N3TGP87Dy 4ZGs6uEhGdVZVdCGBbERUnmLXBZKCMI2hy2H0vzumDZ5PWIlIAleB8SJtYtUdpr2MpjT xn2E/y7zIdYANxzl2NH+LWptvq/0otnttXhIpp7dBIAE5lKa4SoLAqswdSZMnXV186x4 0xWYDOQBnMVazbf88ndqBByqkMBgE5H1tSy+HqtXbXFqGKi/fjx9bhBv/gMpk7Xqw8nl yKhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=7HHyT92RH8knthrk33d5xqjafMY0ij9sG/cbqIOa8pQ=; b=0fKLbF6mIwXrsxD1S0AR/jl3cK+WG1HLMEeTaspQvX7zApdNMwPXxIpUmaSBzwZ0Or sZInsL0uHjoWYiqGwMJmh/rZS4e0EsI00r0/tDSeq5T5n7Hb6KU586spYN1GhDyuZnMm RASKscG9M6uoKRE505KKllIzopdeSYjk3nRP2/OZLkHTK/kbuQkP3KEFZf9V5QkhW2rD RpACpckrPf0PJ92vqRJ5fGxjX8q1fyg3T9RoEoejhqoBPi4B7j10UdHcH+AJ8KfZfPEo Sd1Z/9tC0SP7SIxC7b7Yxwc5xMAn40aBhx57HP0phpY2Pnuc9LnCHkqC1X3KWWw1KtNV FjEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TaqzgdYO; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l15sor523008ybf.178.2020.04.20.05.09.43 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Mon, 20 Apr 2020 05:09:43 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:90a:33c5:: with SMTP id n63mr20475768pjb.4.1587384583046; Mon, 20 Apr 2020 05:09:43 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:7ddc:e17b:a9b3:404]) by smtp.gmail.com with ESMTPSA id o187sm920556pfb.12.2020.04.20.05.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 05:09:42 -0700 (PDT) From: Jagan Teki <jagan@amarulasolutions.com> To: Vignesh R <vigneshr@ti.com>, u-boot@lists.denx.de Cc: suneelglinux@gmail.com, sagar.kadam@sifive.com, bhargavshah1988@gmail.com, sjg@chromium.org, Bin Meng <bmeng.cn@gmail.com>, trini@konsulko.com, linux-amarula@amarulasolutions.com, Jagan Teki <jagan@amarulasolutions.com> Subject: [PATCH 3/3] spi: sifive: Fix format register proto field Date: Mon, 20 Apr 2020 17:39:21 +0530 Message-Id: <20200420120921.12840-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420120921.12840-1-jagan@amarulasolutions.com> References: <20200420120921.12840-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TaqzgdYO; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
spi: Support SPI I/O protocol lines
|
|
Commit Message
Jagan Teki
April 20, 2020, 12:09 p.m. UTC
SiFive SPI controller has a proto bit field in frame format
register which would be used to configure the SPI I/O protocol
lines used on specific transfer.
Right now the driver is configuring this proto using slave->mode
which is used for data transfer and opcode, address vary depending
on the particular transfer at runtime.
Now the SPI framework supports per transfer I/O protocol lines,
so use spi->proto instead of slave-mode.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/spi-sifive.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
Comments
On Mon, Apr 20, 2020 at 8:09 PM Jagan Teki <jagan@amarulasolutions.com> wrote: > > SiFive SPI controller has a proto bit field in frame format > register which would be used to configure the SPI I/O protocol > lines used on specific transfer. > > Right now the driver is configuring this proto using slave->mode > which is used for data transfer and opcode, address vary depending > on the particular transfer at runtime. > > Now the SPI framework supports per transfer I/O protocol lines, > so use spi->proto instead of slave-mode. > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> > --- > drivers/spi/spi-sifive.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > This patch does not apply on top of u-boot/master. Please rebase and resend. Regards, Bin
Hi Bin, Jagan, Thanks Jagan for posting the patches to enable QUAD SPI-NOR on HiFive Unleashed along with other sequels. > -----Original Message----- > From: Bin Meng <bmeng.cn@gmail.com> > Sent: Tuesday, April 21, 2020 4:44 AM > To: Jagan Teki <jagan@amarulasolutions.com> > Cc: Vignesh R <vigneshr@ti.com>; U-Boot Mailing List <u- > boot@lists.denx.de>; Suneel Garapati <suneelglinux@gmail.com>; Sagar > Kadam <sagar.kadam@sifive.com>; Bhargav Shah > <bhargavshah1988@gmail.com>; Simon Glass <sjg@chromium.org>; Tom > Rini <trini@konsulko.com>; linux-amarula <linux- > amarula@amarulasolutions.com> > Subject: Re: [PATCH 3/3] spi: sifive: Fix format register proto field > > [External Email] Do not click links or attachments unless you recognize the > sender and know the content is safe > > On Mon, Apr 20, 2020 at 8:09 PM Jagan Teki > <jagan@amarulasolutions.com> wrote: > > > > SiFive SPI controller has a proto bit field in frame format register > > which would be used to configure the SPI I/O protocol lines used on > > specific transfer. > > > > Right now the driver is configuring this proto using slave->mode which > > is used for data transfer and opcode, address vary depending on the > > particular transfer at runtime. > > > > Now the SPI framework supports per transfer I/O protocol lines, so use > > spi->proto instead of slave-mode. > > > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> > > --- > > drivers/spi/spi-sifive.c | 11 ++++++++--- > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > This patch does not apply on top of u-boot/master. > > Please rebase and resend. I guess Bin, you will also have to add following two patch series [1] and [2] before this set. I tested this and other series with following dependency chain over u-boot/master(e4837da7828293ea49abc579f939c0f5c4b127c3) 1> 1-2-mtd-spi-nor-Enable-QE-bit-for-ISSI-flash.patch 2> spi-sifive-Tidy-up-dm_spi_slave_platdata-variable.patch 3> spi: Support SPI I/O protocol lines 4> riscv: sifive/fu540: Enable SPI-NOR support I could verify flash erase/read/write operations along with mmc spi. [1] https://patchwork.ozlabs.org/project/uboot/patch/20200420100607.23009-1-jagan@amarulasolutions.com/ [2] https://patchwork.amarulasolutions.com/patch/1083/ Thanks & BR, Sagar Kadam > > Regards, > Bin
Hi Sagar and Bin, On Tue, Apr 21, 2020 at 9:17 PM Sagar Kadam <sagar.kadam@sifive.com> wrote: > > Hi Bin, Jagan, > > Thanks Jagan for posting the patches to enable QUAD SPI-NOR on HiFive Unleashed > along with other sequels. > > > -----Original Message----- > > From: Bin Meng <bmeng.cn@gmail.com> > > Sent: Tuesday, April 21, 2020 4:44 AM > > To: Jagan Teki <jagan@amarulasolutions.com> > > Cc: Vignesh R <vigneshr@ti.com>; U-Boot Mailing List <u- > > boot@lists.denx.de>; Suneel Garapati <suneelglinux@gmail.com>; Sagar > > Kadam <sagar.kadam@sifive.com>; Bhargav Shah > > <bhargavshah1988@gmail.com>; Simon Glass <sjg@chromium.org>; Tom > > Rini <trini@konsulko.com>; linux-amarula <linux- > > amarula@amarulasolutions.com> > > Subject: Re: [PATCH 3/3] spi: sifive: Fix format register proto field > > > > [External Email] Do not click links or attachments unless you recognize the > > sender and know the content is safe > > > > On Mon, Apr 20, 2020 at 8:09 PM Jagan Teki > > <jagan@amarulasolutions.com> wrote: > > > > > > SiFive SPI controller has a proto bit field in frame format register > > > which would be used to configure the SPI I/O protocol lines used on > > > specific transfer. > > > > > > Right now the driver is configuring this proto using slave->mode which > > > is used for data transfer and opcode, address vary depending on the > > > particular transfer at runtime. > > > > > > Now the SPI framework supports per transfer I/O protocol lines, so use > > > spi->proto instead of slave-mode. > > > > > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> > > > --- > > > drivers/spi/spi-sifive.c | 11 ++++++++--- > > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > > > > > This patch does not apply on top of u-boot/master. > > > > Please rebase and resend. > > I guess Bin, you will also have to add following two patch series [1] and [2] before this set. > I tested this and other series with following dependency chain over > u-boot/master(e4837da7828293ea49abc579f939c0f5c4b127c3) > > 1> 1-2-mtd-spi-nor-Enable-QE-bit-for-ISSI-flash.patch > 2> spi-sifive-Tidy-up-dm_spi_slave_platdata-variable.patch > 3> spi: Support SPI I/O protocol lines > 4> riscv: sifive/fu540: Enable SPI-NOR support > > I could verify flash erase/read/write operations along with mmc spi. Send the v4 w/o any dependencies, but on top of u-boot-spi/master tree. I/O protocol changes are now handled in spi-sifive via spi-mem exec_op for now since the actual generic code patch[3] will take some time to be in ML as it affects all platforms. Please have a test at earliest. [3] https://patchwork.ozlabs.org/project/uboot/patch/20200420120921.12840-2-jagan@amarulasolutions.com/ Jagan.
diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c index 8f5efb51a3..336b683476 100644 --- a/drivers/spi/spi-sifive.c +++ b/drivers/spi/spi-sifive.c @@ -146,12 +146,17 @@ static void sifive_spi_prep_transfer(struct sifive_spi *spi, /* Number of wires ? */ cr &= ~SIFIVE_SPI_FMT_PROTO_MASK; - if ((slave_plat->mode & SPI_TX_QUAD) || (slave_plat->mode & SPI_RX_QUAD)) + switch (slave_plat->proto) { + case SPI_PROTO_QUAD: cr |= SIFIVE_SPI_FMT_PROTO_QUAD; - else if ((slave_plat->mode & SPI_TX_DUAL) || (slave_plat->mode & SPI_RX_DUAL)) + break; + case SPI_PROTO_DUAL: cr |= SIFIVE_SPI_FMT_PROTO_DUAL; - else + break; + default: cr |= SIFIVE_SPI_FMT_PROTO_SINGLE; + break; + } /* SPI direction in/out ? */ cr &= ~SIFIVE_SPI_FMT_DIR;