lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200508093621.31619-1-Sergey.Semin@baikalelectronics.ru>
Date:   Fri, 8 May 2020 12:36:19 +0300
From:   Serge Semin <Sergey.Semin@...kalelectronics.ru>
To:     Mark Brown <broonie@...nel.org>
CC:     Serge Semin <Sergey.Semin@...kalelectronics.ru>,
        Serge Semin <fancer.lancer@...il.com>,
        Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
        Maxim Kaurkin <Maxim.Kaurkin@...kalelectronics.ru>,
        Pavel Parkhomenko <Pavel.Parkhomenko@...kalelectronics.ru>,
        Ramil Zaripov <Ramil.Zaripov@...kalelectronics.ru>,
        Ekaterina Skachko <Ekaterina.Skachko@...kalelectronics.ru>,
        Vadim Vlasov <V.Vlasov@...kalelectronics.ru>,
        Alexey Kolotnikov <Alexey.Kolotnikov@...kalelectronics.ru>,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        Paul Burton <paulburton@...nel.org>,
        Ralf Baechle <ralf@...ux-mips.org>,
        John Garry <john.garry@...wei.com>,
        Chuanhong Guo <gch981213@...il.com>,
        Tomer Maimon <tmaimon77@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Arnd Bergmann <arnd@...db.de>,
        Rob Herring <robh+dt@...nel.org>, <linux-mips@...r.kernel.org>,
        <linux-spi@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH 0/2] spi: Add Baikal-T1 System Boot SPI Controller driver

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@...kalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>
Cc: Maxim Kaurkin <Maxim.Kaurkin@...kalelectronics.ru>
Cc: Pavel Parkhomenko <Pavel.Parkhomenko@...kalelectronics.ru>
Cc: Ramil Zaripov <Ramil.Zaripov@...kalelectronics.ru>
Cc: Ekaterina Skachko <Ekaterina.Skachko@...kalelectronics.ru>
Cc: Vadim Vlasov <V.Vlasov@...kalelectronics.ru>
Cc: Alexey Kolotnikov <Alexey.Kolotnikov@...kalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: Paul Burton <paulburton@...nel.org>
Cc: Ralf Baechle <ralf@...ux-mips.org>
Cc: John Garry <john.garry@...wei.com>
Cc: Chuanhong Guo <gch981213@...il.com>
Cc: Tomer Maimon <tmaimon77@...il.com>
Cc: Lee Jones <lee.jones@...aro.org>
Cc: Miquel Raynal <miquel.raynal@...tlin.com>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Rob Herring <robh+dt@...nel.org>
Cc: linux-mips@...r.kernel.org
Cc: linux-spi@...r.kernel.org
Cc: devicetree@...r.kernel.org
Cc: linux-kernel@...r.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ