Linux-SPI Archive on lore.kernel.org
 help / color / Atom feed
From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Mark Brown <broonie@kernel.org>
Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>,
	Serge Semin <fancer.lancer@gmail.com>,
	Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
	Maxim Kaurkin <Maxim.Kaurkin@baikalelectronics.ru>,
	Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
	Ramil Zaripov <Ramil.Zaripov@baikalelectronics.ru>,
	Ekaterina Skachko <Ekaterina.Skachko@baikalelectronics.ru>,
	Vadim Vlasov <V.Vlasov@baikalelectronics.ru>,
	Alexey Kolotnikov <Alexey.Kolotnikov@baikalelectronics.ru>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Paul Burton <paulburton@kernel.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	John Garry <john.garry@huawei.com>,
	Chuanhong Guo <gch981213@gmail.com>,
	Tomer Maimon <tmaimon77@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Arnd Bergmann <arnd@arndb.de>, Rob Herring <robh+dt@kernel.org>,
	<linux-mips@vger.kernel.org>, <linux-spi@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 0/2] spi: Add Baikal-T1 System Boot SPI Controller driver
Date: Fri, 8 May 2020 12:36:19 +0300
Message-ID: <20200508093621.31619-1-Sergey.Semin@baikalelectronics.ru> (raw)

Baikal-T1 SoC System Controller is equipped with a Boot Controller. It's
responsible for the system starting up from different sources. In
particular it's possible to boot the chip either from an internal firmware
or from an externally attached 16MB SPI flash or from the SoC SRAM
pre-initialized with first 64KB of the external SPI flash. Though the later
option is formally unavailable thus undocumented. Anyway in order to
perform the booting up from the SPI flash there is a DW APB SSI-based SPI
controller embedded into the System Boot Controller. Due to being utilized
for a specific usecase it's got very limited resources: no IRQ, no DMA,
a single native chip-select and just 8 bytes Tx/Rx FIFO available. In
addition to that the transparent (from SoC CPU point of view) initial code
execution is implemented by means of the SPI flash direct mapping method.
It's done by a vendor-specific block built on top the SPI controller so the
SPI flash slave device data is available just by dword-readings from a
dedicated memory region of 16MB. Taking into account the peculiarities of
the controller registers and physically mapped SPI flash access, very
limited resources, seeing the normal usecase of the controller is to
access an external SPI-nor flash, and due to multiple Baikal-T1 specifics,
which had to be workarounded in the driver code we decided to create a
dedicated SPI driver for it instead of using the DW APB SSI driver
available in the kernel.

The driver provides callbacks for the native messages-based SPI API
(though only if GPIO-based chip-select is declared), SPI-memory and direct
mapping read operations. Due to not having any asynchronous signaling
interface provided by the core we have no choice but to implement a
polling-based data transmission/reception algorithm. In addition to that
in order to bypass the automatic native chip-select toggle the driver
disables the local interrupts during the memory-based transfers if no
complementary GPIO-based chip-select detected in the platform.

This patchset is rebased and tested on the mainline Linux kernel 5.7-rc4:
base-commit: 0e698dfa2822 ("Linux 5.7-rc4")
tag: v5.7-rc4

New vendor prefix will be added in the framework of the next patchset:
https://lkml.org/lkml/2020/5/6/1047

Note as a result of next discussion with @Lee and @Miquel
https://lkml.org/lkml/2020/3/6/421
I've added dirmap_create() and dirmap_read() callbacks to this driver,
so the Baikal-T1 Boot MFD driver won't be resubmitted and can be dropped.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Maxim Kaurkin <Maxim.Kaurkin@baikalelectronics.ru>
Cc: Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>
Cc: Ramil Zaripov <Ramil.Zaripov@baikalelectronics.ru>
Cc: Ekaterina Skachko <Ekaterina.Skachko@baikalelectronics.ru>
Cc: Vadim Vlasov <V.Vlasov@baikalelectronics.ru>
Cc: Alexey Kolotnikov <Alexey.Kolotnikov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Chuanhong Guo <gch981213@gmail.com>
Cc: Tomer Maimon <tmaimon77@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-spi@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Serge Semin (2):
  dt-bindings: spi: Add Baikal-T1 System Boot SPI Controller binding
  spi: Add Baikal-T1 System Boot SPI Controller driver

 .../bindings/spi/baikal,bt1-sys-ssi.yaml      | 100 ++
 drivers/spi/Kconfig                           |  13 +
 drivers/spi/Makefile                          |   1 +
 drivers/spi/spi-bt1-sys.c                     | 873 ++++++++++++++++++
 drivers/spi/spi-bt1-sys.h                     | 169 ++++
 5 files changed, 1156 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/baikal,bt1-sys-ssi.yaml
 create mode 100644 drivers/spi/spi-bt1-sys.c
 create mode 100644 drivers/spi/spi-bt1-sys.h

-- 
2.25.1


             reply index

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08  9:36 Serge Semin [this message]
2020-05-08  9:36 ` [PATCH 1/2] dt-bindings: spi: Add Baikal-T1 System Boot SPI Controller binding Serge Semin
2020-05-18 15:26   ` Rob Herring
2020-05-18 21:27     ` Serge Semin
2020-05-21 14:57       ` Rob Herring
2020-05-21 15:11         ` Serge Semin
2020-05-21 21:35           ` Rob Herring
2020-05-18 21:55     ` Serge Semin
2020-05-08  9:36 ` [PATCH 2/2] spi: Add Baikal-T1 System Boot SPI Controller driver Serge Semin
2020-05-08 10:03   ` Andy Shevchenko
2020-05-08 10:15     ` Serge Semin
2020-05-08 10:22       ` Mark Brown
2020-05-08 15:42         ` Serge Semin
2020-05-08 17:07           ` Mark Brown
2020-05-08 10:26       ` Andy Shevchenko
2020-05-08 16:24         ` Serge Semin
2020-05-08 11:37   ` Mark Brown
2020-05-10  0:20     ` Serge Semin
2020-05-10 22:17       ` Chris Packham
2020-05-11 21:25       ` Mark Brown
2020-05-18  0:05         ` Serge Semin
2020-05-18 15:19           ` Mark Brown
2020-05-18 21:17             ` Serge Semin
2020-05-19 10:32               ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508093621.31619-1-Sergey.Semin@baikalelectronics.ru \
    --to=sergey.semin@baikalelectronics.ru \
    --cc=Alexey.Kolotnikov@baikalelectronics.ru \
    --cc=Alexey.Malahov@baikalelectronics.ru \
    --cc=Ekaterina.Skachko@baikalelectronics.ru \
    --cc=Maxim.Kaurkin@baikalelectronics.ru \
    --cc=Pavel.Parkhomenko@baikalelectronics.ru \
    --cc=Ramil.Zaripov@baikalelectronics.ru \
    --cc=V.Vlasov@baikalelectronics.ru \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=gch981213@gmail.com \
    --cc=john.garry@huawei.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=paulburton@kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=robh+dt@kernel.org \
    --cc=tmaimon77@gmail.com \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-SPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-spi/0 linux-spi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-spi linux-spi/ https://lore.kernel.org/linux-spi \
		linux-spi@vger.kernel.org
	public-inbox-index linux-spi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-spi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git