Skip to content

Commit

Permalink
Merge tag 'spi-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/broonie/spi

Pull spi updates from Mark Brown:
 "A fairly standard release for SPI with the exception of a change to
  the API for specifying chip selects done in preparation for supporting
  devices with more than one chip select, this required some mechanical
  changes throughout the tree which have been cooking in -next happily
  for a while.

  There's also a new API to allow us to support TPM chips on half duplex
  controllers.

  Summary:

   - Refactoring in preparation for supporting multiple chip selects for
     a single device, needed by some flash devices, which required a
     change in the SPI device API visible throughout the tree

   - Support for hardware assisted interaction with SPI TPMs on half
     duplex controllers, implemented on nVidia Tedra210 QuadSPI

   - Optimisation for large transfers on fsl-cpm devices

   - Cleanups around device property use which fix some sisues with
     fwnode

   - Use of both void remove() and devm_platform_.*ioremap_resource()

   - Support for AMD Pensando Elba, Amlogic A1, Cadence device mode,
     Intel MetorLake-S and StarFive J7110 QuadSPI"

* tag 'spi-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (185 commits)
  spi: bcm63xx: use macro DEFINE_SIMPLE_DEV_PM_OPS
  spi: tegra210-quad: Enable TPM wait polling
  spi: Add TPM HW flow flag
  spi: bcm63xx: remove PM_SLEEP based conditional compilation
  spi: cadence-quadspi: use macro DEFINE_SIMPLE_DEV_PM_OPS
  spi: spi-cadence: Add support for Slave mode
  spi: spi-cadence: Switch to spi_controller structure
  spi: cadence-quadspi: fix suspend-resume implementations
  spi: dw: Add support for AMD Pensando Elba SoC
  spi: dw: Add AMD Pensando Elba SoC SPI Controller
  spi: cadence-quadspi: Disable the SPI before reconfiguring
  spi: cadence-quadspi: Update the read timeout based on the length
  spi: spi-loopback-test: Add module param for iteration length
  spi: add support for Amlogic A1 SPI Flash Controller
  dt-bindings: spi: add Amlogic A1 SPI controller
  spi: fsl-spi: No need to check transfer length versus word size
  spi: fsl-spi: Change mspi_apply_cpu_mode_quirks() to void
  spi: fsl-cpm: Use 16 bit mode for large transfers with even size
  spi: fsl-spi: Re-organise transfer bits_per_word adaptation
  spi: fsl-spi: Fix CPM/QE mode Litte Endian
  ...
  • Loading branch information
torvalds committed Apr 27, 2023
2 parents 1c15ca4 + cc5f6fa commit fc2e58b
Show file tree
Hide file tree
Showing 149 changed files with 1,845 additions and 1,288 deletions.
41 changes: 41 additions & 0 deletions Documentation/devicetree/bindings/spi/amlogic,a1-spifc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/spi/amlogic,a1-spifc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Amlogic A1 SPI Flash Controller

maintainers:
- Martin Kurbanov <[email protected]>

allOf:
- $ref: spi-controller.yaml#

properties:
compatible:
enum:
- amlogic,a1-spifc

reg:
maxItems: 1

clocks:
maxItems: 1

required:
- compatible
- reg
- clocks

unevaluatedProperties: false

examples:
- |
spi@fd000400 {
compatible = "amlogic,a1-spifc";
reg = <0xfd000400 0x290>;
clocks = <&clkc_clkid_spifc>;
#address-cells = <1>;
#size-cells = <0>;
};
37 changes: 33 additions & 4 deletions Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,33 @@ allOf:
then:
required:
- power-domains
- if:
properties:
compatible:
contains:
const: starfive,jh7110-qspi
then:
properties:
resets:
minItems: 2
maxItems: 3

reset-names:
minItems: 2
maxItems: 3
items:
enum: [ qspi, qspi-ocp, rstc_ref ]

else:
properties:
resets:
maxItems: 2

reset-names:
minItems: 1
maxItems: 2
items:
enum: [ qspi, qspi-ocp ]

properties:
compatible:
Expand All @@ -30,6 +57,7 @@ properties:
- intel,lgm-qspi
- xlnx,versal-ospi-1.0
- intel,socfpga-qspi
- starfive,jh7110-qspi
- const: cdns,qspi-nor
- const: cdns,qspi-nor

Expand Down Expand Up @@ -79,13 +107,14 @@ properties:
maxItems: 1

resets:
maxItems: 2
minItems: 2
maxItems: 3

reset-names:
minItems: 1
maxItems: 2
minItems: 2
maxItems: 3
items:
enum: [ qspi, qspi-ocp ]
enum: [ qspi, qspi-ocp, rstc_ref ]

required:
- compatible
Expand Down
23 changes: 19 additions & 4 deletions Documentation/devicetree/bindings/spi/renesas,sh-msiof.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,38 @@ required:
- compatible
- reg
- interrupts
- clocks
- power-domains
- '#address-cells'
- '#size-cells'

if:
not:
properties:
compatible:
contains:
const: renesas,sh-mobile-msiof
then:
required:
- resets

unevaluatedProperties: false

examples:
- |
#include <dt-bindings/clock/r8a7791-clock.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/clock/r8a7791-cpg-mssr.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/power/r8a7791-sysc.h>
msiof0: spi@e6e20000 {
compatible = "renesas,msiof-r8a7791", "renesas,rcar-gen2-msiof";
reg = <0xe6e20000 0x0064>;
interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>;
interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cpg CPG_MOD 000>;
dmas = <&dmac0 0x51>, <&dmac0 0x52>;
dma-names = "tx", "rx";
power-domains = <&sysc R8A7791_PD_ALWAYS_ON>;
resets = <&cpg 0>;
#address-cells = <1>;
#size-cells = <0>;
};
19 changes: 19 additions & 0 deletions Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ allOf:
else:
required:
- interrupts
- if:
properties:
compatible:
contains:
const: amd,pensando-elba-spi
then:
required:
- amd,pensando-elba-syscon
else:
properties:
amd,pensando-elba-syscon: false

properties:
compatible:
Expand All @@ -63,6 +74,8 @@ properties:
const: intel,keembay-ssi
- description: Intel Thunder Bay SPI Controller
const: intel,thunderbay-ssi
- description: AMD Pensando Elba SoC SPI Controller
const: amd,pensando-elba-spi
- description: Baikal-T1 SPI Controller
const: baikal,bt1-ssi
- description: Baikal-T1 System Boot SPI Controller
Expand Down Expand Up @@ -136,6 +149,12 @@ properties:
of the designware controller, and the upper limit is also subject to
controller configuration.
amd,pensando-elba-syscon:
$ref: /schemas/types.yaml#/definitions/phandle-array
description:
Block address to control SPI chip-selects. The Elba SoC system controller
provides an interface to override the native DWC SSI CS control.

patternProperties:
"^.*@[0-9a-f]+$":
type: object
Expand Down
23 changes: 10 additions & 13 deletions Documentation/spi/spi-summary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ shows up in sysfs in several locations::

/sys/bus/spi/drivers/D ... driver for one or more spi*.* devices

/sys/class/spi_master/spiB ... symlink (or actual device node) to
a logical node which could hold class related state for the SPI
master controller managing bus "B". All spiB.* devices share one
physical SPI bus segment, with SCLK, MOSI, and MISO.
/sys/class/spi_master/spiB ... symlink to a logical node which could hold
class related state for the SPI master controller managing bus "B".
All spiB.* devices share one physical SPI bus segment, with SCLK,
MOSI, and MISO.

/sys/devices/.../CTLR/slave ... virtual file for (un)registering the
slave device for an SPI slave controller.
Expand All @@ -191,16 +191,13 @@ shows up in sysfs in several locations::
Reading from this file shows the name of the slave device ("(null)"
if not registered).

/sys/class/spi_slave/spiB ... symlink (or actual device node) to
a logical node which could hold class related state for the SPI
slave controller on bus "B". When registered, a single spiB.*
device is present here, possible sharing the physical SPI bus
segment with other SPI slave devices.
/sys/class/spi_slave/spiB ... symlink to a logical node which could hold
class related state for the SPI slave controller on bus "B". When
registered, a single spiB.* device is present here, possible sharing
the physical SPI bus segment with other SPI slave devices.

Note that the actual location of the controller's class state depends
on whether you enabled CONFIG_SYSFS_DEPRECATED or not. At this time,
the only class-specific state is the bus number ("B" in "spiB"), so
those /sys/class entries are only useful to quickly identify busses.
At this time, the only class-specific state is the bus number ("B" in "spiB"),
so those /sys/class entries are only useful to quickly identify busses.


How does board-specific init code declare SPI devices?
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -18658,7 +18658,7 @@ F: include/linux/clk/samsung.h

SAMSUNG SPI DRIVERS
M: Krzysztof Kozlowski <[email protected]>
M: Andi Shyti <andi@etezian.org>
M: Andi Shyti <andi.shyti@kernel.org>
L: [email protected]
L: [email protected]
S: Maintained
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/83xx/mpc832x_rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static int __init fsl_spi_init(struct spi_board_info *board_infos,

static void mpc83xx_spi_cs_control(struct spi_device *spi, bool on)
{
pr_debug("%s %d %d\n", __func__, spi->chip_select, on);
pr_debug("%s %d %d\n", __func__, spi_get_chipselect(spi, 0), on);
par_io_data_set(3, 13, on);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/imu/adis16400.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev)

dev_info(&indio_dev->dev, "%s: prod_id 0x%04x at CS%d (irq %d)\n",
indio_dev->name, prod_id,
st->adis.spi->chip_select, st->adis.spi->irq);
spi_get_chipselect(st->adis.spi, 0), st->adis.spi->irq);
}
/* use high spi speed if possible */
if (st->variant->flags & ADIS16400_HAS_SLOW_MODE) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/devices/mtd_dataflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages,

/* name must be usable with cmdlinepart */
sprintf(priv->name, "spi%d.%d-%s",
spi->master->bus_num, spi->chip_select,
spi->master->bus_num, spi_get_chipselect(spi, 0),
name);

device = &priv->mtd;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/adi/adin1110.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ static int adin1110_register_mdiobus(struct adin1110_priv *priv,
return -ENOMEM;

snprintf(priv->mii_bus_name, MII_BUS_ID_SIZE, "%s-%u",
priv->cfg->name, priv->spidev->chip_select);
priv->cfg->name, spi_get_chipselect(priv->spidev, 0));

mii_bus->name = priv->mii_bus_name;
mii_bus->read = adin1110_mdio_read;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/asix/ax88796c_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ static int ax88796c_probe(struct spi_device *spi)
ax_local->mdiobus->parent = &spi->dev;

snprintf(ax_local->mdiobus->id, MII_BUS_ID_SIZE,
"ax88796c-%s.%u", dev_name(&spi->dev), spi->chip_select);
"ax88796c-%s.%u", dev_name(&spi->dev), spi_get_chipselect(spi, 0));

ret = devm_mdiobus_register(&spi->dev, ax_local->mdiobus);
if (ret < 0) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/davicom/dm9051.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ static int dm9051_mdio_register(struct board_info *db)
db->mdiobus->phy_mask = (u32)~BIT(1);
db->mdiobus->parent = &spi->dev;
snprintf(db->mdiobus->id, MII_BUS_ID_SIZE,
"dm9051-%s.%u", dev_name(&spi->dev), spi->chip_select);
"dm9051-%s.%u", dev_name(&spi->dev), spi_get_chipselect(spi, 0));

ret = devm_mdiobus_register(&spi->dev, db->mdiobus);
if (ret)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/qualcomm/qca_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ qcaspi_info_show(struct seq_file *s, void *what)
seq_printf(s, "SPI mode : %x\n",
qca->spi_dev->mode);
seq_printf(s, "SPI chip select : %u\n",
(unsigned int)qca->spi_dev->chip_select);
(unsigned int)spi_get_chipselect(qca->spi_dev, 0));
seq_printf(s, "SPI legacy mode : %u\n",
(unsigned int)qca->legacy_mode);
seq_printf(s, "SPI burst length : %u\n",
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ieee802154/ca8210.c
Original file line number Diff line number Diff line change
Expand Up @@ -2969,7 +2969,7 @@ static int ca8210_test_interface_init(struct ca8210_priv *priv)
sizeof(node_name),
"ca8210@%d_%d",
priv->spi->master->bus_num,
priv->spi->chip_select
spi_get_chipselect(priv->spi, 0)
);

test->ca8210_dfs_spi_int = debugfs_create_file(
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wan/slic_ds26522.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static int slic_ds26522_probe(struct spi_device *spi)

ret = slic_ds26522_init_configure(spi);
if (ret == 0)
pr_info("DS26522 cs%d configured\n", spi->chip_select);
pr_info("DS26522 cs%d configured\n", spi_get_chipselect(spi, 0));

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/marvell/libertas/if_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ static int if_spi_init_card(struct if_spi_card *card)
"spi->max_speed_hz=%d\n",
card->card_id, card->card_rev,
card->spi->master->bus_num,
card->spi->chip_select,
spi_get_chipselect(card->spi, 0),
card->spi->max_speed_hz);
err = if_spi_prog_helper_firmware(card, helper);
if (err)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/silabs/wfx/bus_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ static int wfx_spi_probe(struct spi_device *func)

/* Trace below is also displayed by spi_setup() if compiled with DEBUG */
dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n",
func->chip_select, func->mode, func->bits_per_word, func->max_speed_hz);
spi_get_chipselect(func, 0), func->mode, func->bits_per_word, func->max_speed_hz);
if (func->bits_per_word != 16 && func->bits_per_word != 8)
dev_warn(&func->dev, "unusual bits/word value: %d\n", func->bits_per_word);
if (func->max_speed_hz > 50000000)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/st/cw1200/cw1200_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ static int cw1200_spi_probe(struct spi_device *func)
func->mode = SPI_MODE_0;

pr_info("cw1200_wlan_spi: Probe called (CS %d M %d BPW %d CLK %d)\n",
func->chip_select, func->mode, func->bits_per_word,
spi_get_chipselect(func, 0), func->mode, func->bits_per_word,
func->max_speed_hz);

if (cw1200_spi_on(plat_data)) {
Expand Down
3 changes: 2 additions & 1 deletion drivers/platform/x86/serial-multi-instantiate.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ static int smi_spi_probe(struct platform_device *pdev, struct smi *smi,
goto error;
}

dev_dbg(dev, "SPI device %s using chip select %u", name, spi_dev->chip_select);
dev_dbg(dev, "SPI device %s using chip select %u", name,
spi_get_chipselect(spi_dev, 0));

smi->spi_devs[i] = spi_dev;
smi->spi_num++;
Expand Down
Loading

0 comments on commit fc2e58b

Please sign in to comment.