mbox series

[v6,0/3] mtd: spi-nor / spi / MFD: Convert intel-spi to SPI MEM

Message ID 20220209122706.42439-1-mika.westerberg@linux.intel.com (mailing list archive)
Headers show
Series mtd: spi-nor / spi / MFD: Convert intel-spi to SPI MEM | expand

Message

Mika Westerberg Feb. 9, 2022, 12:27 p.m. UTC
Hi all,

Based on discussion on the patch I sent some time ago here:

  http://lists.infradead.org/pipermail/linux-mtd/2021-June/086867.html

it turns out that the preferred way to deal with the SPI flash controller
drivers is through SPI MEM which is part of Linux SPI subsystem.

This series does that for the intel-spi driver. This also renames the
driver to follow the convention used in the SPI subsystem. The first patch
improves the write protection handling to be slightly more safer. The
following two patches do the conversion itself. Note the Intel SPI flash
controller only allows commands such as read, write and so on and it
internally uses whatever addressing etc. it figured from the SFDP on the
flash device.

Previous versions of the patch series can be found here:

  v5: https://lore.kernel.org/linux-mtd/20211220164625.9400-1-mika.westerberg@linux.intel.com/
  v4: https://lore.kernel.org/linux-mtd/20211118130543.11179-1-mika.westerberg@linux.intel.com/
  v3: https://lore.kernel.org/linux-mtd/20211013114432.31352-1-mika.westerberg@linux.intel.com/
  v2: https://lore.kernel.org/linux-mtd/20211007112132.30934-1-mika.westerberg@linux.intel.com/
  v1: https://lore.kernel.org/linux-mtd/20210930100719.2176-1-mika.westerberg@linux.intel.com/

Changes from v5:

  * Added tags from Pratyush Yadav and Tudor Ambarus
  * Added replacement_op field to intel_spi_mem_op to be used with
    erase operations
  * Return -EOPNOTSUPP if no match is found in intel_spi_exec_mem_op()

Changes from v4:

  * Correct check in intel_spi_cmp_mem_op()
  * Added tag from Boris

Changes from v3:

  * Create an array of supported opcodes and reject everything else.
  * Fix checkpatch warnings reported by Mauro
  * Added tags from Lee and Mauro

Changes from v2:

  * Added tag from Andy
  * Check buswidth in intel_spi_supports_mem_op() and return false if octal
    mode is asked. The Intel controllers support buswidths 1-4 but this is
    not exposed to software. It figures this itself through SFDP tables.
  * In case of software sequencer, support same opcodes than we support with
    the hardware sequencer if found in the opcodes table.

Changes from v1:

  * Arrange dependencies in Kconfig entries the same way in both glue
    drivers.
  * Added empty lines between different subsystem includes.
  * dev_err() to single line
  * Return intel_spi_sw_cycle() directly in intel_spi_erase().
  * Drop redundant elses.
  * Fixed typo in the commit message of the patch 3/3.

Mika Westerberg (3):
  mtd: spi-nor: intel-spi: Disable write protection only if asked
  mtd: spi-nor: intel-spi: Convert to SPI MEM
  Documentation / MTD: Rename the intel-spi driver

 Documentation/driver-api/mtd/index.rst        |   2 +-
 .../mtd/{intel-spi.rst => spi-intel.rst}      |   8 +-
 drivers/mfd/lpc_ich.c                         |  59 +-
 drivers/mtd/spi-nor/controllers/Kconfig       |  36 -
 drivers/mtd/spi-nor/controllers/Makefile      |   3 -
 drivers/mtd/spi-nor/controllers/intel-spi.h   |  21 -
 drivers/spi/Kconfig                           |  39 +
 drivers/spi/Makefile                          |   3 +
 .../intel-spi-pci.c => spi/spi-intel-pci.c}   |  49 +-
 .../spi-intel-platform.c}                     |  21 +-
 .../intel-spi.c => spi/spi-intel.c}           | 850 ++++++++++++------
 drivers/spi/spi-intel.h                       |  19 +
 include/linux/mfd/lpc_ich.h                   |   2 +-
 .../x86/{intel-spi.h => spi-intel.h}          |  12 +-
 14 files changed, 719 insertions(+), 405 deletions(-)
 rename Documentation/driver-api/mtd/{intel-spi.rst => spi-intel.rst} (94%)
 delete mode 100644 drivers/mtd/spi-nor/controllers/intel-spi.h
 rename drivers/{mtd/spi-nor/controllers/intel-spi-pci.c => spi/spi-intel-pci.c} (84%)
 rename drivers/{mtd/spi-nor/controllers/intel-spi-platform.c => spi/spi-intel-platform.c} (65%)
 rename drivers/{mtd/spi-nor/controllers/intel-spi.c => spi/spi-intel.c} (55%)
 create mode 100644 drivers/spi/spi-intel.h
 rename include/linux/platform_data/x86/{intel-spi.h => spi-intel.h} (64%)

Comments

Tudor Ambarus Feb. 9, 2022, 2:16 p.m. UTC | #1
Hi, Mark,

The series is looking good to me. If you too find it good, would you
take it directly to SPI via an immutable branch and sync with Lee?
There's no need to sync with MTD, as I haven't took and won't take
any intel-spi patches for v5.17. If you want me to provide an immutable
branch to both of you, that's fine as well.

Cheers,
ta
Mark Brown Feb. 15, 2022, 12:54 p.m. UTC | #2
On Wed, 9 Feb 2022 15:27:03 +0300, Mika Westerberg wrote:
> Based on discussion on the patch I sent some time ago here:
> 
>   http://lists.infradead.org/pipermail/linux-mtd/2021-June/086867.html
> 
> it turns out that the preferred way to deal with the SPI flash controller
> drivers is through SPI MEM which is part of Linux SPI subsystem.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] mtd: spi-nor: intel-spi: Disable write protection only if asked
      commit: cd149eff8d2201a63c074a6d9d03e52926aa535d
[2/3] mtd: spi-nor: intel-spi: Convert to SPI MEM
      commit: e23e5a05d1fd9479586c40ffbcc056b3e34ef816
[3/3] Documentation / MTD: Rename the intel-spi driver
      commit: 4ab13489735d9b5b6e91634eab83922914a3310c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Tudor Ambarus Feb. 15, 2022, 1:46 p.m. UTC | #3
On 2/15/22 14:54, Mark Brown wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Wed, 9 Feb 2022 15:27:03 +0300, Mika Westerberg wrote:
>> Based on discussion on the patch I sent some time ago here:
>>
>>   http://lists.infradead.org/pipermail/linux-mtd/2021-June/086867.html
>>
>> it turns out that the preferred way to deal with the SPI flash controller
>> drivers is through SPI MEM which is part of Linux SPI subsystem.
>>
>> [...]
> 
> Applied to
> 
>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next


Hi, Mark,

Have you synced with Lee Jones? I remember he asked for an immutable branch
when the patch set will be applied. There's no need to sync with MTD.

Cheers,
ta

> 
> Thanks!
> 
> [1/3] mtd: spi-nor: intel-spi: Disable write protection only if asked
>       commit: cd149eff8d2201a63c074a6d9d03e52926aa535d
> [2/3] mtd: spi-nor: intel-spi: Convert to SPI MEM
>       commit: e23e5a05d1fd9479586c40ffbcc056b3e34ef816
> [3/3] Documentation / MTD: Rename the intel-spi driver
>       commit: 4ab13489735d9b5b6e91634eab83922914a3310c
Mark Brown Feb. 16, 2022, 4:28 p.m. UTC | #4
On Tue, Feb 15, 2022 at 01:46:13PM +0000, Tudor.Ambarus@microchip.com wrote:

> Have you synced with Lee Jones? I remember he asked for an immutable branch
> when the patch set will be applied. There's no need to sync with MTD.

I think I sent out a pull request?  Or perhaps I didn't if you
explicitly said you didn't want one.  I don't remember at this point.