Commit 30194002 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'spi-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi updates from Mark Brown:
 "A moderately busy release for SPI, the main core update was the
  merging of support for multiple chip selects, used in some flash
  configurations. There were also big overhauls for the AXI SPI Engine
  and PL022 drivers, plus some new device support for ST.

  There's a few patches for other trees, API updates to allow the
  multiple chip select support and one of the naming modernisations
  touched a controller embedded in the USB code.

   - Support for multiple chip selects.

   - A big overhaul for the AXI SPI engine driver, modernising it and
     adding a bunch of new features.

   - Modernisation of the PL022 driver, fixing some issues with
     submitting messages while in atomic context in the process.

   - Many drivers were converted to use new APIs which avoid outdated
     terminology for devices and controllers.

   - Support for ST Microelectronics STM32F7 and STM32MP25, and Renesas
     RZ/Five"

* tag 'spi-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (83 commits)
  spi: stm32: add st,stm32mp25-spi compatible supporting STM32MP25 soc
  dt-bindings: spi: stm32: add st,stm32mp25-spi compatible
  spi: stm32: use dma_get_slave_caps prior to configuring dma channel
  spi: axi-spi-engine: fix struct member doc warnings
  spi: pl022: update description of internal_cs_control()
  spi: pl022: delete description of cur_msg
  spi: dw: Remove Intel Thunder Bay SOC support
  spi: dw: Remove Intel Thunder Bay SOC support
  spi: sh-msiof: Enforce fixed DTDL for R-Car H3
  spi: ljca: switch to use devm_spi_alloc_host()
  spi: cs42l43: switch to use devm_spi_alloc_host()
  spi: zynqmp-gqspi: switch to use modern name
  spi: zynq-qspi: switch to use modern name
  spi: xtensa-xtfpga: switch to use modern name
  spi: xlp: switch to use modern name
  spi: xilinx: switch to use modern name
  spi: xcomm: switch to use modern name
  spi: uniphier: switch to use modern name
  spi: topcliff-pch: switch to use modern name
  spi: wpcm-fiu: switch to use devm_spi_alloc_host()
  ...
parents da968017 f6cd6623
Analog Devices AXI SPI Engine controller Device Tree Bindings
Required properties:
- compatible : Must be "adi,axi-spi-engine-1.00.a""
- reg : Physical base address and size of the register map.
- interrupts : Property with a value describing the interrupt
number.
- clock-names : List of input clock names - "s_axi_aclk", "spi_clk"
- clocks : Clock phandles and specifiers (See clock bindings for
details on clock-names and clocks).
- #address-cells : Must be <1>
- #size-cells : Must be <0>
Optional subnodes:
Subnodes are use to represent the SPI slave devices connected to the SPI
master. They follow the generic SPI bindings as outlined in spi-bus.txt.
Example:
spi@@44a00000 {
compatible = "adi,axi-spi-engine-1.00.a";
reg = <0x44a00000 0x1000>;
interrupts = <0 56 4>;
clocks = <&clkc 15 &clkc 15>;
clock-names = "s_axi_aclk", "spi_clk";
#address-cells = <1>;
#size-cells = <0>;
/* SPI devices */
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/spi/adi,axi-spi-engine.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Analog Devices AXI SPI Engine Controller
description: |
The AXI SPI Engine controller is part of the SPI Engine framework[1] and
allows memory mapped access to the SPI Engine control bus. This allows it
to be used as a general purpose software driven SPI controller as well as
some optional advanced acceleration and offloading capabilities.
[1] https://wiki.analog.com/resources/fpga/peripherals/spi_engine
maintainers:
- Michael Hennerich <Michael.Hennerich@analog.com>
- Nuno Sá <nuno.sa@analog.com>
allOf:
- $ref: /schemas/spi/spi-controller.yaml#
properties:
compatible:
const: adi,axi-spi-engine-1.00.a
reg:
maxItems: 1
interrupts:
maxItems: 1
clocks:
items:
- description: The AXI interconnect clock.
- description: The SPI controller clock.
clock-names:
items:
- const: s_axi_aclk
- const: spi_clk
required:
- compatible
- reg
- interrupts
- clocks
- clock-names
unevaluatedProperties: false
examples:
- |
spi@44a00000 {
compatible = "adi,axi-spi-engine-1.00.a";
reg = <0x44a00000 0x1000>;
interrupts = <0 56 4>;
clocks = <&clkc 15>, <&clkc 15>;
clock-names = "s_axi_aclk", "spi_clk";
#address-cells = <1>;
#size-cells = <0>;
/* SPI devices */
};
...@@ -21,7 +21,7 @@ properties: ...@@ -21,7 +21,7 @@ properties:
- enum: - enum:
- renesas,rspi-r7s72100 # RZ/A1H - renesas,rspi-r7s72100 # RZ/A1H
- renesas,rspi-r7s9210 # RZ/A2 - renesas,rspi-r7s9210 # RZ/A2
- renesas,r9a07g043-rspi # RZ/G2UL - renesas,r9a07g043-rspi # RZ/G2UL and RZ/Five
- renesas,r9a07g044-rspi # RZ/G2{L,LC} - renesas,r9a07g044-rspi # RZ/G2{L,LC}
- renesas,r9a07g054-rspi # RZ/V2L - renesas,r9a07g054-rspi # RZ/V2L
- const: renesas,rspi-rz - const: renesas,rspi-rz
......
...@@ -72,8 +72,6 @@ properties: ...@@ -72,8 +72,6 @@ properties:
- const: snps,dw-apb-ssi - const: snps,dw-apb-ssi
- description: Intel Keem Bay SPI Controller - description: Intel Keem Bay SPI Controller
const: intel,keembay-ssi const: intel,keembay-ssi
- description: Intel Thunder Bay SPI Controller
const: intel,thunderbay-ssi
- description: Intel Mount Evans Integrated Management Complex SPI Controller - description: Intel Mount Evans Integrated Management Complex SPI Controller
const: intel,mountevans-imc-ssi const: intel,mountevans-imc-ssi
- description: AMD Pensando Elba SoC SPI Controller - description: AMD Pensando Elba SoC SPI Controller
......
...@@ -23,7 +23,9 @@ properties: ...@@ -23,7 +23,9 @@ properties:
compatible: compatible:
enum: enum:
- st,stm32f4-spi - st,stm32f4-spi
- st,stm32f7-spi
- st,stm32h7-spi - st,stm32h7-spi
- st,stm32mp25-spi
reg: reg:
maxItems: 1 maxItems: 1
......
...@@ -3,13 +3,13 @@ PXA2xx SPI on SSP driver HOWTO ...@@ -3,13 +3,13 @@ PXA2xx SPI on SSP driver HOWTO
============================== ==============================
This a mini HOWTO on the pxa2xx_spi driver. The driver turns a PXA2xx This a mini HOWTO on the pxa2xx_spi driver. The driver turns a PXA2xx
synchronous serial port into an SPI master controller synchronous serial port into an SPI host controller
(see Documentation/spi/spi-summary.rst). The driver has the following features (see Documentation/spi/spi-summary.rst). The driver has the following features
- Support for any PXA2xx and compatible SSP. - Support for any PXA2xx and compatible SSP.
- SSP PIO and SSP DMA data transfers. - SSP PIO and SSP DMA data transfers.
- External and Internal (SSPFRM) chip selects. - External and Internal (SSPFRM) chip selects.
- Per slave device (chip) configuration. - Per peripheral device (chip) configuration.
- Full suspend, freeze, resume support. - Full suspend, freeze, resume support.
The driver is built around a &struct spi_message FIFO serviced by kernel The driver is built around a &struct spi_message FIFO serviced by kernel
...@@ -17,10 +17,10 @@ thread. The kernel thread, spi_pump_messages(), drives message FIFO and ...@@ -17,10 +17,10 @@ thread. The kernel thread, spi_pump_messages(), drives message FIFO and
is responsible for queuing SPI transactions and setting up and launching is responsible for queuing SPI transactions and setting up and launching
the DMA or interrupt driven transfers. the DMA or interrupt driven transfers.
Declaring PXA2xx Master Controllers Declaring PXA2xx host controllers
----------------------------------- ---------------------------------
Typically, for a legacy platform, an SPI master is defined in the Typically, for a legacy platform, an SPI host controller is defined in the
arch/.../mach-*/board-*.c as a "platform device". The master configuration arch/.../mach-*/board-*.c as a "platform device". The host controller configuration
is passed to the driver via a table found in include/linux/spi/pxa2xx_spi.h:: is passed to the driver via a table found in include/linux/spi/pxa2xx_spi.h::
struct pxa2xx_spi_controller { struct pxa2xx_spi_controller {
...@@ -30,7 +30,7 @@ is passed to the driver via a table found in include/linux/spi/pxa2xx_spi.h:: ...@@ -30,7 +30,7 @@ is passed to the driver via a table found in include/linux/spi/pxa2xx_spi.h::
}; };
The "pxa2xx_spi_controller.num_chipselect" field is used to determine the number of The "pxa2xx_spi_controller.num_chipselect" field is used to determine the number of
slave device (chips) attached to this SPI master. peripheral devices (chips) attached to this SPI host controller.
The "pxa2xx_spi_controller.enable_dma" field informs the driver that SSP DMA should The "pxa2xx_spi_controller.enable_dma" field informs the driver that SSP DMA should
be used. This caused the driver to acquire two DMA channels: Rx channel and be used. This caused the driver to acquire two DMA channels: Rx channel and
...@@ -40,8 +40,8 @@ See the "PXA2xx Developer Manual" section "DMA Controller". ...@@ -40,8 +40,8 @@ See the "PXA2xx Developer Manual" section "DMA Controller".
For the new platforms the description of the controller and peripheral devices For the new platforms the description of the controller and peripheral devices
comes from Device Tree or ACPI. comes from Device Tree or ACPI.
NSSP MASTER SAMPLE NSSP HOST SAMPLE
------------------ ----------------
Below is a sample configuration using the PXA255 NSSP for a legacy platform:: Below is a sample configuration using the PXA255 NSSP for a legacy platform::
static struct resource pxa_spi_nssp_resources[] = { static struct resource pxa_spi_nssp_resources[] = {
...@@ -57,7 +57,7 @@ Below is a sample configuration using the PXA255 NSSP for a legacy platform:: ...@@ -57,7 +57,7 @@ Below is a sample configuration using the PXA255 NSSP for a legacy platform::
}, },
}; };
static struct pxa2xx_spi_controller pxa_nssp_master_info = { static struct pxa2xx_spi_controller pxa_nssp_controller_info = {
.num_chipselect = 1, /* Matches the number of chips attached to NSSP */ .num_chipselect = 1, /* Matches the number of chips attached to NSSP */
.enable_dma = 1, /* Enables NSSP DMA */ .enable_dma = 1, /* Enables NSSP DMA */
}; };
...@@ -68,7 +68,7 @@ Below is a sample configuration using the PXA255 NSSP for a legacy platform:: ...@@ -68,7 +68,7 @@ Below is a sample configuration using the PXA255 NSSP for a legacy platform::
.resource = pxa_spi_nssp_resources, .resource = pxa_spi_nssp_resources,
.num_resources = ARRAY_SIZE(pxa_spi_nssp_resources), .num_resources = ARRAY_SIZE(pxa_spi_nssp_resources),
.dev = { .dev = {
.platform_data = &pxa_nssp_master_info, /* Passed to driver */ .platform_data = &pxa_nssp_controller_info, /* Passed to driver */
}, },
}; };
...@@ -81,17 +81,17 @@ Below is a sample configuration using the PXA255 NSSP for a legacy platform:: ...@@ -81,17 +81,17 @@ Below is a sample configuration using the PXA255 NSSP for a legacy platform::
(void)platform_add_device(devices, ARRAY_SIZE(devices)); (void)platform_add_device(devices, ARRAY_SIZE(devices));
} }
Declaring Slave Devices Declaring peripheral devices
----------------------- ----------------------------
Typically, for a legacy platform, each SPI slave (chip) is defined in the Typically, for a legacy platform, each SPI peripheral device (chip) is defined in the
arch/.../mach-*/board-*.c using the "spi_board_info" structure found in arch/.../mach-*/board-*.c using the "spi_board_info" structure found in
"linux/spi/spi.h". See "Documentation/spi/spi-summary.rst" for additional "linux/spi/spi.h". See "Documentation/spi/spi-summary.rst" for additional
information. information.
Each slave device attached to the PXA must provide slave specific configuration Each peripheral device (chip) attached to the PXA2xx must provide specific chip configuration
information via the structure "pxa2xx_spi_chip" found in information via the structure "pxa2xx_spi_chip" found in
"include/linux/spi/pxa2xx_spi.h". The pxa2xx_spi master controller driver "include/linux/spi/pxa2xx_spi.h". The PXA2xx host controller driver will use
will uses the configuration whenever the driver communicates with the slave the configuration whenever the driver communicates with the peripheral
device. All fields are optional. device. All fields are optional.
:: ::
...@@ -123,7 +123,7 @@ dma_burst_size == 0. ...@@ -123,7 +123,7 @@ dma_burst_size == 0.
The "pxa2xx_spi_chip.timeout" fields is used to efficiently handle The "pxa2xx_spi_chip.timeout" fields is used to efficiently handle
trailing bytes in the SSP receiver FIFO. The correct value for this field is trailing bytes in the SSP receiver FIFO. The correct value for this field is
dependent on the SPI bus speed ("spi_board_info.max_speed_hz") and the specific dependent on the SPI bus speed ("spi_board_info.max_speed_hz") and the specific
slave device. Please note that the PXA2xx SSP 1 does not support trailing byte peripheral device. Please note that the PXA2xx SSP 1 does not support trailing byte
timeouts and must busy-wait any trailing bytes. timeouts and must busy-wait any trailing bytes.
NOTE: the SPI driver cannot control the chip select if SSPFRM is used, so the NOTE: the SPI driver cannot control the chip select if SSPFRM is used, so the
...@@ -132,8 +132,8 @@ asserted around the complete message. Use SSPFRM as a GPIO (through a descriptor ...@@ -132,8 +132,8 @@ asserted around the complete message. Use SSPFRM as a GPIO (through a descriptor
to accommodate these chips. to accommodate these chips.
NSSP SLAVE SAMPLE NSSP PERIPHERAL SAMPLE
----------------- ----------------------
For a legacy platform or in some other cases, the pxa2xx_spi_chip structure For a legacy platform or in some other cases, the pxa2xx_spi_chip structure
is passed to the pxa2xx_spi driver in the "spi_board_info.controller_data" is passed to the pxa2xx_spi driver in the "spi_board_info.controller_data"
field. Below is a sample configuration using the PXA255 NSSP. field. Below is a sample configuration using the PXA255 NSSP.
...@@ -161,16 +161,16 @@ field. Below is a sample configuration using the PXA255 NSSP. ...@@ -161,16 +161,16 @@ field. Below is a sample configuration using the PXA255 NSSP.
.bus_num = 2, /* Framework bus number */ .bus_num = 2, /* Framework bus number */
.chip_select = 0, /* Framework chip select */ .chip_select = 0, /* Framework chip select */
.platform_data = NULL; /* No spi_driver specific config */ .platform_data = NULL; /* No spi_driver specific config */
.controller_data = &cs8415a_chip_info, /* Master chip config */ .controller_data = &cs8415a_chip_info, /* Host controller config */
.irq = STREETRACER_APCI_IRQ, /* Slave device interrupt */ .irq = STREETRACER_APCI_IRQ, /* Peripheral device interrupt */
}, },
{ {
.modalias = "cs8405a", /* Name of spi_driver for this device */ .modalias = "cs8405a", /* Name of spi_driver for this device */
.max_speed_hz = 3686400, /* Run SSP as fast a possible */ .max_speed_hz = 3686400, /* Run SSP as fast a possible */
.bus_num = 2, /* Framework bus number */ .bus_num = 2, /* Framework bus number */
.chip_select = 1, /* Framework chip select */ .chip_select = 1, /* Framework chip select */
.controller_data = &cs8405a_chip_info, /* Master chip config */ .controller_data = &cs8405a_chip_info, /* Host controller config */
.irq = STREETRACER_APCI_IRQ, /* Slave device interrupt */ .irq = STREETRACER_APCI_IRQ, /* Peripheral device interrupt */
}, },
}; };
...@@ -193,17 +193,14 @@ mode supports both coherent and stream based DMA mappings. ...@@ -193,17 +193,14 @@ mode supports both coherent and stream based DMA mappings.
The following logic is used to determine the type of I/O to be used on The following logic is used to determine the type of I/O to be used on
a per "spi_transfer" basis:: a per "spi_transfer" basis::
if !enable_dma then if spi_message.len > 65536 then
always use PIO transfers if spi_message.is_dma_mapped or rx_dma_buf != 0 or tx_dma_buf != 0 then
reject premapped transfers
if spi_message.len > 8191 then
print "rate limited" warning print "rate limited" warning
use PIO transfers use PIO transfers
if spi_message.is_dma_mapped and rx_dma_buf != 0 and tx_dma_buf != 0 then if enable_dma and the size is in the range [DMA burst size..65536] then
use coherent DMA mode
if rx_buf and tx_buf are aligned on 8 byte boundary then
use streaming DMA mode use streaming DMA mode
otherwise otherwise
......
...@@ -3408,6 +3408,16 @@ W: https://ez.analog.com/linux-software-drivers ...@@ -3408,6 +3408,16 @@ W: https://ez.analog.com/linux-software-drivers
F: Documentation/devicetree/bindings/hwmon/adi,axi-fan-control.yaml F: Documentation/devicetree/bindings/hwmon/adi,axi-fan-control.yaml
F: drivers/hwmon/axi-fan-control.c F: drivers/hwmon/axi-fan-control.c
AXI SPI ENGINE
M: Michael Hennerich <michael.hennerich@analog.com>
M: Nuno Sá <nuno.sa@analog.com>
R: David Lechner <dlechner@baylibre.com>
L: linux-spi@vger.kernel.org
S: Supported
W: https://ez.analog.com/linux-software-drivers
F: Documentation/devicetree/bindings/spi/adi,axi-spi-engine.yaml
F: drivers/spi/spi-axi-spi-engine.c
AXXIA I2C CONTROLLER AXXIA I2C CONTROLLER
M: Krzysztof Adamski <krzysztof.adamski@nokia.com> M: Krzysztof Adamski <krzysztof.adamski@nokia.com>
L: linux-i2c@vger.kernel.org L: linux-i2c@vger.kernel.org
......
...@@ -375,7 +375,7 @@ static int rmi_spi_probe(struct spi_device *spi) ...@@ -375,7 +375,7 @@ static int rmi_spi_probe(struct spi_device *spi)
struct rmi_device_platform_data *spi_pdata = spi->dev.platform_data; struct rmi_device_platform_data *spi_pdata = spi->dev.platform_data;
int error; int error;
if (spi->master->flags & SPI_MASTER_HALF_DUPLEX) if (spi->master->flags & SPI_CONTROLLER_HALF_DUPLEX)
return -EINVAL; return -EINVAL;
rmi_spi = devm_kzalloc(&spi->dev, sizeof(struct rmi_spi_xport), rmi_spi = devm_kzalloc(&spi->dev, sizeof(struct rmi_spi_xport),
......
...@@ -98,7 +98,7 @@ static int tps6594_spi_probe(struct spi_device *spi) ...@@ -98,7 +98,7 @@ static int tps6594_spi_probe(struct spi_device *spi)
spi_set_drvdata(spi, tps); spi_set_drvdata(spi, tps);
tps->dev = dev; tps->dev = dev;
tps->reg = spi->chip_select; tps->reg = spi_get_chipselect(spi, 0);
tps->irq = spi->irq; tps->irq = spi->irq;
tps->regmap = devm_regmap_init(dev, NULL, spi, &tps6594_spi_regmap_config); tps->regmap = devm_regmap_init(dev, NULL, spi, &tps6594_spi_regmap_config);
......
...@@ -1322,7 +1322,7 @@ static int mmc_spi_probe(struct spi_device *spi) ...@@ -1322,7 +1322,7 @@ static int mmc_spi_probe(struct spi_device *spi)
/* We rely on full duplex transfers, mostly to reduce /* We rely on full duplex transfers, mostly to reduce
* per-transfer overheads (by making fewer transfers). * per-transfer overheads (by making fewer transfers).
*/ */
if (spi->master->flags & SPI_MASTER_HALF_DUPLEX) if (spi->master->flags & SPI_CONTROLLER_HALF_DUPLEX)
return -EINVAL; return -EINVAL;
/* MMC and SD specs only seem to care that sampling is on the /* MMC and SD specs only seem to care that sampling is on the
......
...@@ -974,7 +974,7 @@ static int spinand_manufacturer_match(struct spinand_device *spinand, ...@@ -974,7 +974,7 @@ static int spinand_manufacturer_match(struct spinand_device *spinand,
spinand->manufacturer = manufacturer; spinand->manufacturer = manufacturer;
return 0; return 0;
} }
return -ENOTSUPP; return -EOPNOTSUPP;
} }
static int spinand_id_detect(struct spinand_device *spinand) static int spinand_id_detect(struct spinand_device *spinand)
......
...@@ -3146,7 +3146,7 @@ int spi_nor_set_4byte_addr_mode(struct spi_nor *nor, bool enable) ...@@ -3146,7 +3146,7 @@ int spi_nor_set_4byte_addr_mode(struct spi_nor *nor, bool enable)
int ret; int ret;
ret = params->set_4byte_addr_mode(nor, enable); ret = params->set_4byte_addr_mode(nor, enable);
if (ret && ret != -ENOTSUPP) if (ret && ret != -EOPNOTSUPP)
return ret; return ret;
if (enable) { if (enable) {
...@@ -3237,6 +3237,7 @@ static void spi_nor_soft_reset(struct spi_nor *nor) ...@@ -3237,6 +3237,7 @@ static void spi_nor_soft_reset(struct spi_nor *nor)
ret = spi_mem_exec_op(nor->spimem, &op); ret = spi_mem_exec_op(nor->spimem, &op);
if (ret) { if (ret) {
if (ret != -EOPNOTSUPP)
dev_warn(nor->dev, "Software reset failed: %d\n", ret); dev_warn(nor->dev, "Software reset failed: %d\n", ret);
return; return;
} }
......
...@@ -156,7 +156,7 @@ static void ks8851_rdreg(struct ks8851_net *ks, unsigned int op, ...@@ -156,7 +156,7 @@ static void ks8851_rdreg(struct ks8851_net *ks, unsigned int op,
txb[0] = cpu_to_le16(op | KS_SPIOP_RD); txb[0] = cpu_to_le16(op | KS_SPIOP_RD);
if (kss->spidev->master->flags & SPI_MASTER_HALF_DUPLEX) { if (kss->spidev->master->flags & SPI_CONTROLLER_HALF_DUPLEX) {
msg = &kss->spi_msg2; msg = &kss->spi_msg2;
xfer = kss->spi_xfer2; xfer = kss->spi_xfer2;
...@@ -180,7 +180,7 @@ static void ks8851_rdreg(struct ks8851_net *ks, unsigned int op, ...@@ -180,7 +180,7 @@ static void ks8851_rdreg(struct ks8851_net *ks, unsigned int op,
ret = spi_sync(kss->spidev, msg); ret = spi_sync(kss->spidev, msg);
if (ret < 0) if (ret < 0)
netdev_err(ks->netdev, "read: spi_sync() failed\n"); netdev_err(ks->netdev, "read: spi_sync() failed\n");
else if (kss->spidev->master->flags & SPI_MASTER_HALF_DUPLEX) else if (kss->spidev->master->flags & SPI_CONTROLLER_HALF_DUPLEX)
memcpy(rxb, trx, rxl); memcpy(rxb, trx, rxl);
else else
memcpy(rxb, trx + 2, rxl); memcpy(rxb, trx + 2, rxl);
......
...@@ -1177,9 +1177,10 @@ config SPI_ZYNQ_QSPI ...@@ -1177,9 +1177,10 @@ config SPI_ZYNQ_QSPI
config SPI_ZYNQMP_GQSPI config SPI_ZYNQMP_GQSPI
tristate "Xilinx ZynqMP GQSPI controller" tristate "Xilinx ZynqMP GQSPI controller"
depends on (SPI_MASTER && HAS_DMA) || COMPILE_TEST depends on (SPI_MEM && HAS_DMA) || COMPILE_TEST
help help
Enables Xilinx GQSPI controller driver for Zynq UltraScale+ MPSoC. Enables Xilinx GQSPI controller driver for Zynq UltraScale+ MPSoC.
This controller only supports SPI memory interface.
config SPI_AMD config SPI_AMD
tristate "AMD SPI controller" tristate "AMD SPI controller"
......
...@@ -272,7 +272,7 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op) ...@@ -272,7 +272,7 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op)
if (atmel_qspi_is_compatible(op, &atmel_qspi_modes[i])) if (atmel_qspi_is_compatible(op, &atmel_qspi_modes[i]))
return i; return i;
return -ENOTSUPP; return -EOPNOTSUPP;
} }
static bool atmel_qspi_supports_op(struct spi_mem *mem, static bool atmel_qspi_supports_op(struct spi_mem *mem,
......
...@@ -146,7 +146,7 @@ static int ath79_exec_mem_op(struct spi_mem *mem, ...@@ -146,7 +146,7 @@ static int ath79_exec_mem_op(struct spi_mem *mem,
/* Only use for fast-read op. */ /* Only use for fast-read op. */
if (op->cmd.opcode != 0x0b || op->data.dir != SPI_MEM_DATA_IN || if (op->cmd.opcode != 0x0b || op->data.dir != SPI_MEM_DATA_IN ||
op->addr.nbytes != 3 || op->dummy.nbytes != 1) op->addr.nbytes != 3 || op->dummy.nbytes != 1)
return -ENOTSUPP; return -EOPNOTSUPP;
/* disable GPIO mode */ /* disable GPIO mode */
ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0); ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0);
......
This diff is collapsed.
...@@ -1199,7 +1199,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem, ...@@ -1199,7 +1199,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem,
if (!op->data.nbytes || !op->addr.nbytes || op->addr.nbytes > 4 || if (!op->data.nbytes || !op->addr.nbytes || op->addr.nbytes > 4 ||
op->data.dir != SPI_MEM_DATA_IN) op->data.dir != SPI_MEM_DATA_IN)
return -ENOTSUPP; return -EOPNOTSUPP;
buf = op->data.buf.in; buf = op->data.buf.in;
addr = op->addr.val; addr = op->addr.val;
......
...@@ -1840,7 +1840,7 @@ static int cqspi_probe(struct platform_device *pdev) ...@@ -1840,7 +1840,7 @@ static int cqspi_probe(struct platform_device *pdev)
if (ddata->jh7110_clk_init) { if (ddata->jh7110_clk_init) {
ret = cqspi_jh7110_clk_init(pdev, cqspi); ret = cqspi_jh7110_clk_init(pdev, cqspi);
if (ret) if (ret)
goto probe_clk_failed; goto probe_reset_failed;
} }
if (of_device_is_compatible(pdev->dev.of_node, if (of_device_is_compatible(pdev->dev.of_node,
...@@ -1901,6 +1901,8 @@ static int cqspi_probe(struct platform_device *pdev) ...@@ -1901,6 +1901,8 @@ static int cqspi_probe(struct platform_device *pdev)
probe_setup_failed: probe_setup_failed:
cqspi_controller_enable(cqspi, 0); cqspi_controller_enable(cqspi, 0);
probe_reset_failed: probe_reset_failed:
if (cqspi->is_jh7110)
cqspi_jh7110_disable_clk(pdev, cqspi);
clk_disable_unprepare(cqspi->clk); clk_disable_unprepare(cqspi->clk);
probe_clk_failed: probe_clk_failed:
return ret; return ret;
......
...@@ -619,7 +619,6 @@ MODULE_DEVICE_TABLE(of, cdns_xspi_of_match); ...@@ -619,7 +619,6 @@ MODULE_DEVICE_TABLE(of, cdns_xspi_of_match);
static struct platform_driver cdns_xspi_platform_driver = { static struct platform_driver cdns_xspi_platform_driver = {
.probe = cdns_xspi_probe, .probe = cdns_xspi_probe,
.remove = NULL,
.driver = { .driver = {
.name = CDNS_XSPI_NAME, .name = CDNS_XSPI_NAME,
.of_match_table = cdns_xspi_of_match, .of_match_table = cdns_xspi_of_match,
......
...@@ -213,7 +213,7 @@ static int cs42l43_spi_probe(struct platform_device *pdev) ...@@ -213,7 +213,7 @@ static int cs42l43_spi_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
priv->ctlr = devm_spi_alloc_master(&pdev->dev, sizeof(*priv->ctlr)); priv->ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*priv->ctlr));
if (!priv->ctlr) if (!priv->ctlr)
return -ENOMEM; return -ENOMEM;
......
...@@ -411,7 +411,6 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { ...@@ -411,7 +411,6 @@ static const struct of_device_id dw_spi_mmio_of_match[] = {
{ .compatible = "renesas,rzn1-spi", .data = dw_spi_pssi_init}, { .compatible = "renesas,rzn1-spi", .data = dw_spi_pssi_init},
{ .compatible = "snps,dwc-ssi-1.01a", .data = dw_spi_hssi_init}, { .compatible = "snps,dwc-ssi-1.01a", .data = dw_spi_hssi_init},
{ .compatible = "intel,keembay-ssi", .data = dw_spi_intel_init}, { .compatible = "intel,keembay-ssi", .data = dw_spi_intel_init},
{ .compatible = "intel,thunderbay-ssi", .data = dw_spi_intel_init},
{ {
.compatible = "intel,mountevans-imc-ssi", .compatible = "intel,mountevans-imc-ssi",
.data = dw_spi_mountevans_imc_init, .data = dw_spi_mountevans_imc_init,
......
...@@ -145,10 +145,10 @@ static int get_spi_clk_cfg(unsigned int speed_hz, ...@@ -145,10 +145,10 @@ static int get_spi_clk_cfg(unsigned int speed_hz,
return ret; return ret;
} }
static void handle_se_timeout(struct spi_master *spi, static void handle_se_timeout(struct spi_controller *spi,
struct spi_message *msg) struct spi_message *msg)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
unsigned long time_left; unsigned long time_left;
struct geni_se *se = &mas->se; struct geni_se *se = &mas->se;
const struct spi_transfer *xfer; const struct spi_transfer *xfer;
...@@ -160,9 +160,9 @@ static void handle_se_timeout(struct spi_master *spi, ...@@ -160,9 +160,9 @@ static void handle_se_timeout(struct spi_master *spi,
xfer = mas->cur_xfer; xfer = mas->cur_xfer;
mas->cur_xfer = NULL; mas->cur_xfer = NULL;
if (spi->slave) { if (spi->target) {
/* /*
* skip CMD Cancel sequnece since spi slave * skip CMD Cancel sequnece since spi target
* doesn`t support CMD Cancel sequnece * doesn`t support CMD Cancel sequnece
*/ */
spin_unlock_irq(&mas->lock); spin_unlock_irq(&mas->lock);
...@@ -225,17 +225,17 @@ static void handle_se_timeout(struct spi_master *spi, ...@@ -225,17 +225,17 @@ static void handle_se_timeout(struct spi_master *spi,
} }
} }
static void handle_gpi_timeout(struct spi_master *spi, struct spi_message *msg) static void handle_gpi_timeout(struct spi_controller *spi, struct spi_message *msg)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
dmaengine_terminate_sync(mas->tx); dmaengine_terminate_sync(mas->tx);
dmaengine_terminate_sync(mas->rx); dmaengine_terminate_sync(mas->rx);
} }
static void spi_geni_handle_err(struct spi_master *spi, struct spi_message *msg) static void spi_geni_handle_err(struct spi_controller *spi, struct spi_message *msg)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
switch (mas->cur_xfer_mode) { switch (mas->cur_xfer_mode) {
case GENI_SE_FIFO: case GENI_SE_FIFO:
...@@ -286,8 +286,8 @@ static bool spi_geni_is_abort_still_pending(struct spi_geni_master *mas) ...@@ -286,8 +286,8 @@ static bool spi_geni_is_abort_still_pending(struct spi_geni_master *mas)
static void spi_geni_set_cs(struct spi_device *slv, bool set_flag) static void spi_geni_set_cs(struct spi_device *slv, bool set_flag)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(slv->master); struct spi_geni_master *mas = spi_controller_get_devdata(slv->controller);
struct spi_master *spi = dev_get_drvdata(mas->dev); struct spi_controller *spi = dev_get_drvdata(mas->dev);
struct geni_se *se = &mas->se; struct geni_se *se = &mas->se;
unsigned long time_left; unsigned long time_left;
...@@ -395,9 +395,9 @@ static int geni_spi_set_clock_and_bw(struct spi_geni_master *mas, ...@@ -395,9 +395,9 @@ static int geni_spi_set_clock_and_bw(struct spi_geni_master *mas,
} }
static int setup_fifo_params(struct spi_device *spi_slv, static int setup_fifo_params(struct spi_device *spi_slv,
struct spi_master *spi) struct spi_controller *spi)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
struct geni_se *se = &mas->se; struct geni_se *se = &mas->se;
u32 loopback_cfg = 0, cpol = 0, cpha = 0, demux_output_inv = 0; u32 loopback_cfg = 0, cpol = 0, cpha = 0, demux_output_inv = 0;
u32 demux_sel; u32 demux_sel;
...@@ -434,7 +434,7 @@ static int setup_fifo_params(struct spi_device *spi_slv, ...@@ -434,7 +434,7 @@ static int setup_fifo_params(struct spi_device *spi_slv,
static void static void
spi_gsi_callback_result(void *cb, const struct dmaengine_result *result) spi_gsi_callback_result(void *cb, const struct dmaengine_result *result)
{ {
struct spi_master *spi = cb; struct spi_controller *spi = cb;
spi->cur_msg->status = -EIO; spi->cur_msg->status = -EIO;
if (result->result != DMA_TRANS_NOERROR) { if (result->result != DMA_TRANS_NOERROR) {
...@@ -454,7 +454,7 @@ spi_gsi_callback_result(void *cb, const struct dmaengine_result *result) ...@@ -454,7 +454,7 @@ spi_gsi_callback_result(void *cb, const struct dmaengine_result *result)
} }
static int setup_gsi_xfer(struct spi_transfer *xfer, struct spi_geni_master *mas, static int setup_gsi_xfer(struct spi_transfer *xfer, struct spi_geni_master *mas,
struct spi_device *spi_slv, struct spi_master *spi) struct spi_device *spi_slv, struct spi_controller *spi)
{ {
unsigned long flags = DMA_PREP_INTERRUPT | DMA_CTRL_ACK; unsigned long flags = DMA_PREP_INTERRUPT | DMA_CTRL_ACK;
struct dma_slave_config config = {}; struct dma_slave_config config = {};
...@@ -560,14 +560,14 @@ static u32 get_xfer_len_in_words(struct spi_transfer *xfer, ...@@ -560,14 +560,14 @@ static u32 get_xfer_len_in_words(struct spi_transfer *xfer,
static bool geni_can_dma(struct spi_controller *ctlr, static bool geni_can_dma(struct spi_controller *ctlr,
struct spi_device *slv, struct spi_transfer *xfer) struct spi_device *slv, struct spi_transfer *xfer)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(slv->master); struct spi_geni_master *mas = spi_controller_get_devdata(slv->controller);
u32 len, fifo_size; u32 len, fifo_size;
if (mas->cur_xfer_mode == GENI_GPI_DMA) if (mas->cur_xfer_mode == GENI_GPI_DMA)
return true; return true;
/* Set SE DMA mode for SPI slave. */ /* Set SE DMA mode for SPI target. */
if (ctlr->slave) if (ctlr->target)
return true; return true;
len = get_xfer_len_in_words(xfer, mas); len = get_xfer_len_in_words(xfer, mas);
...@@ -579,10 +579,10 @@ static bool geni_can_dma(struct spi_controller *ctlr, ...@@ -579,10 +579,10 @@ static bool geni_can_dma(struct spi_controller *ctlr,
return false; return false;
} }
static int spi_geni_prepare_message(struct spi_master *spi, static int spi_geni_prepare_message(struct spi_controller *spi,
struct spi_message *spi_msg) struct spi_message *spi_msg)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
int ret; int ret;
switch (mas->cur_xfer_mode) { switch (mas->cur_xfer_mode) {
...@@ -657,7 +657,7 @@ static int spi_geni_init(struct spi_geni_master *mas) ...@@ -657,7 +657,7 @@ static int spi_geni_init(struct spi_geni_master *mas)
proto = geni_se_read_proto(se); proto = geni_se_read_proto(se);
if (spi->slave) { if (spi->target) {
if (proto != GENI_SE_SPI_SLAVE) { if (proto != GENI_SE_SPI_SLAVE) {
dev_err(mas->dev, "Invalid proto %d\n", proto); dev_err(mas->dev, "Invalid proto %d\n", proto);
goto out_pm; goto out_pm;
...@@ -715,7 +715,7 @@ static int spi_geni_init(struct spi_geni_master *mas) ...@@ -715,7 +715,7 @@ static int spi_geni_init(struct spi_geni_master *mas)
} }
/* We always control CS manually */ /* We always control CS manually */
if (!spi->slave) { if (!spi->target) {
spi_tx_cfg = readl(se->base + SE_SPI_TRANS_CFG); spi_tx_cfg = readl(se->base + SE_SPI_TRANS_CFG);
spi_tx_cfg &= ~CS_TOGGLE; spi_tx_cfg &= ~CS_TOGGLE;
writel(spi_tx_cfg, se->base + SE_SPI_TRANS_CFG); writel(spi_tx_cfg, se->base + SE_SPI_TRANS_CFG);
...@@ -824,7 +824,7 @@ static void geni_spi_handle_rx(struct spi_geni_master *mas) ...@@ -824,7 +824,7 @@ static void geni_spi_handle_rx(struct spi_geni_master *mas)
static int setup_se_xfer(struct spi_transfer *xfer, static int setup_se_xfer(struct spi_transfer *xfer,
struct spi_geni_master *mas, struct spi_geni_master *mas,
u16 mode, struct spi_master *spi) u16 mode, struct spi_controller *spi)
{ {
u32 m_cmd = 0; u32 m_cmd = 0;
u32 len; u32 len;
...@@ -913,11 +913,11 @@ static int setup_se_xfer(struct spi_transfer *xfer, ...@@ -913,11 +913,11 @@ static int setup_se_xfer(struct spi_transfer *xfer,
return ret; return ret;
} }
static int spi_geni_transfer_one(struct spi_master *spi, static int spi_geni_transfer_one(struct spi_controller *spi,
struct spi_device *slv, struct spi_device *slv,
struct spi_transfer *xfer) struct spi_transfer *xfer)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
int ret; int ret;
if (spi_geni_is_abort_still_pending(mas)) if (spi_geni_is_abort_still_pending(mas))
...@@ -939,8 +939,8 @@ static int spi_geni_transfer_one(struct spi_master *spi, ...@@ -939,8 +939,8 @@ static int spi_geni_transfer_one(struct spi_master *spi,
static irqreturn_t geni_spi_isr(int irq, void *data) static irqreturn_t geni_spi_isr(int irq, void *data)
{ {
struct spi_master *spi = data; struct spi_controller *spi = data;
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
struct geni_se *se = &mas->se; struct geni_se *se = &mas->se;
u32 m_irq; u32 m_irq;
...@@ -1042,7 +1042,7 @@ static irqreturn_t geni_spi_isr(int irq, void *data) ...@@ -1042,7 +1042,7 @@ static irqreturn_t geni_spi_isr(int irq, void *data)
static int spi_geni_probe(struct platform_device *pdev) static int spi_geni_probe(struct platform_device *pdev)
{ {
int ret, irq; int ret, irq;
struct spi_master *spi; struct spi_controller *spi;
struct spi_geni_master *mas; struct spi_geni_master *mas;
void __iomem *base; void __iomem *base;
struct clk *clk; struct clk *clk;
...@@ -1064,12 +1064,12 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1064,12 +1064,12 @@ static int spi_geni_probe(struct platform_device *pdev)
if (IS_ERR(clk)) if (IS_ERR(clk))
return PTR_ERR(clk); return PTR_ERR(clk);
spi = devm_spi_alloc_master(dev, sizeof(*mas)); spi = devm_spi_alloc_host(dev, sizeof(*mas));
if (!spi) if (!spi)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, spi); platform_set_drvdata(pdev, spi);
mas = spi_master_get_devdata(spi); mas = spi_controller_get_devdata(spi);
mas->irq = irq; mas->irq = irq;
mas->dev = dev; mas->dev = dev;
mas->se.dev = dev; mas->se.dev = dev;
...@@ -1113,7 +1113,7 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1113,7 +1113,7 @@ static int spi_geni_probe(struct platform_device *pdev)
pm_runtime_enable(dev); pm_runtime_enable(dev);
if (device_property_read_bool(&pdev->dev, "spi-slave")) if (device_property_read_bool(&pdev->dev, "spi-slave"))
spi->slave = true; spi->target = true;
ret = geni_icc_get(&mas->se, NULL); ret = geni_icc_get(&mas->se, NULL);
if (ret) if (ret)
...@@ -1135,7 +1135,7 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1135,7 +1135,7 @@ static int spi_geni_probe(struct platform_device *pdev)
* for dma (gsi) mode, the gsi will set cs based on params passed in * for dma (gsi) mode, the gsi will set cs based on params passed in
* TRE * TRE
*/ */
if (!spi->slave && mas->cur_xfer_mode == GENI_SE_FIFO) if (!spi->target && mas->cur_xfer_mode == GENI_SE_FIFO)
spi->set_cs = spi_geni_set_cs; spi->set_cs = spi_geni_set_cs;
/* /*
...@@ -1148,7 +1148,7 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1148,7 +1148,7 @@ static int spi_geni_probe(struct platform_device *pdev)
if (ret) if (ret)
goto spi_geni_release_dma; goto spi_geni_release_dma;
ret = spi_register_master(spi); ret = spi_register_controller(spi);
if (ret) if (ret)
goto spi_geni_probe_free_irq; goto spi_geni_probe_free_irq;
...@@ -1164,11 +1164,11 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1164,11 +1164,11 @@ static int spi_geni_probe(struct platform_device *pdev)
static void spi_geni_remove(struct platform_device *pdev) static void spi_geni_remove(struct platform_device *pdev)
{ {
struct spi_master *spi = platform_get_drvdata(pdev); struct spi_controller *spi = platform_get_drvdata(pdev);
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
/* Unregister _before_ disabling pm_runtime() so we stop transfers */ /* Unregister _before_ disabling pm_runtime() so we stop transfers */
spi_unregister_master(spi); spi_unregister_controller(spi);
spi_geni_release_dma_chan(mas); spi_geni_release_dma_chan(mas);
...@@ -1178,8 +1178,8 @@ static void spi_geni_remove(struct platform_device *pdev) ...@@ -1178,8 +1178,8 @@ static void spi_geni_remove(struct platform_device *pdev)
static int __maybe_unused spi_geni_runtime_suspend(struct device *dev) static int __maybe_unused spi_geni_runtime_suspend(struct device *dev)
{ {
struct spi_master *spi = dev_get_drvdata(dev); struct spi_controller *spi = dev_get_drvdata(dev);
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
int ret; int ret;
/* Drop the performance state vote */ /* Drop the performance state vote */
...@@ -1194,8 +1194,8 @@ static int __maybe_unused spi_geni_runtime_suspend(struct device *dev) ...@@ -1194,8 +1194,8 @@ static int __maybe_unused spi_geni_runtime_suspend(struct device *dev)
static int __maybe_unused spi_geni_runtime_resume(struct device *dev) static int __maybe_unused spi_geni_runtime_resume(struct device *dev)
{ {
struct spi_master *spi = dev_get_drvdata(dev); struct spi_controller *spi = dev_get_drvdata(dev);
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
int ret; int ret;
ret = geni_icc_enable(&mas->se); ret = geni_icc_enable(&mas->se);
...@@ -1211,30 +1211,30 @@ static int __maybe_unused spi_geni_runtime_resume(struct device *dev) ...@@ -1211,30 +1211,30 @@ static int __maybe_unused spi_geni_runtime_resume(struct device *dev)
static int __maybe_unused spi_geni_suspend(struct device *dev) static int __maybe_unused spi_geni_suspend(struct device *dev)
{ {
struct spi_master *spi = dev_get_drvdata(dev); struct spi_controller *spi = dev_get_drvdata(dev);
int ret; int ret;
ret = spi_master_suspend(spi); ret = spi_controller_suspend(spi);
if (ret) if (ret)
return ret; return ret;
ret = pm_runtime_force_suspend(dev); ret = pm_runtime_force_suspend(dev);
if (ret) if (ret)
spi_master_resume(spi); spi_controller_resume(spi);
return ret; return ret;
} }
static int __maybe_unused spi_geni_resume(struct device *dev) static int __maybe_unused spi_geni_resume(struct device *dev)
{ {
struct spi_master *spi = dev_get_drvdata(dev); struct spi_controller *spi = dev_get_drvdata(dev);
int ret; int ret;
ret = pm_runtime_force_resume(dev); ret = pm_runtime_force_resume(dev);
if (ret) if (ret)
return ret; return ret;
ret = spi_master_resume(spi); ret = spi_controller_resume(spi);
if (ret) if (ret)
pm_runtime_force_suspend(dev); pm_runtime_force_suspend(dev);
......
...@@ -346,14 +346,17 @@ static bool spi_ingenic_can_dma(struct spi_controller *ctlr, ...@@ -346,14 +346,17 @@ static bool spi_ingenic_can_dma(struct spi_controller *ctlr,
static int spi_ingenic_request_dma(struct spi_controller *ctlr, static int spi_ingenic_request_dma(struct spi_controller *ctlr,
struct device *dev) struct device *dev)
{ {
ctlr->dma_tx = dma_request_slave_channel(dev, "tx"); struct dma_chan *chan;
if (!ctlr->dma_tx)
return -ENODEV;
ctlr->dma_rx = dma_request_slave_channel(dev, "rx"); chan = dma_request_chan(dev, "tx");
if (IS_ERR(chan))
return PTR_ERR(chan);
ctlr->dma_tx = chan;
if (!ctlr->dma_rx) chan = dma_request_chan(dev, "rx");
return -ENODEV; if (IS_ERR(chan))
return PTR_ERR(chan);
ctlr->dma_rx = chan;
ctlr->can_dma = spi_ingenic_can_dma; ctlr->can_dma = spi_ingenic_can_dma;
......
...@@ -711,8 +711,7 @@ static bool intel_spi_cmp_mem_op(const struct intel_spi_mem_op *iop, ...@@ -711,8 +711,7 @@ static bool intel_spi_cmp_mem_op(const struct intel_spi_mem_op *iop,
{ {
if (iop->mem_op.cmd.nbytes != op->cmd.nbytes || if (iop->mem_op.cmd.nbytes != op->cmd.nbytes ||
iop->mem_op.cmd.buswidth != op->cmd.buswidth || iop->mem_op.cmd.buswidth != op->cmd.buswidth ||
iop->mem_op.cmd.dtr != op->cmd.dtr || iop->mem_op.cmd.dtr != op->cmd.dtr)
iop->mem_op.cmd.opcode != op->cmd.opcode)
return false; return false;
if (iop->mem_op.addr.nbytes != op->addr.nbytes || if (iop->mem_op.addr.nbytes != op->addr.nbytes ||
...@@ -737,11 +736,12 @@ intel_spi_match_mem_op(struct intel_spi *ispi, const struct spi_mem_op *op) ...@@ -737,11 +736,12 @@ intel_spi_match_mem_op(struct intel_spi *ispi, const struct spi_mem_op *op)
const struct intel_spi_mem_op *iop; const struct intel_spi_mem_op *iop;
for (iop = ispi->mem_ops; iop->mem_op.cmd.opcode; iop++) { for (iop = ispi->mem_ops; iop->mem_op.cmd.opcode; iop++) {
if (intel_spi_cmp_mem_op(iop, op)) if (iop->mem_op.cmd.opcode == op->cmd.opcode &&
break; intel_spi_cmp_mem_op(iop, op))
return iop;
} }
return iop->mem_op.cmd.opcode ? iop : NULL; return NULL;
} }
static bool intel_spi_supports_mem_op(struct spi_mem *mem, static bool intel_spi_supports_mem_op(struct spi_mem *mem,
......
...@@ -223,7 +223,7 @@ static int ljca_spi_probe(struct auxiliary_device *auxdev, ...@@ -223,7 +223,7 @@ static int ljca_spi_probe(struct auxiliary_device *auxdev,
struct ljca_spi_dev *ljca_spi; struct ljca_spi_dev *ljca_spi;
int ret; int ret;
controller = devm_spi_alloc_master(&auxdev->dev, sizeof(*ljca_spi)); controller = devm_spi_alloc_host(&auxdev->dev, sizeof(*ljca_spi));
if (!controller) if (!controller)
return -ENOMEM; return -ENOMEM;
......
...@@ -323,7 +323,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) ...@@ -323,7 +323,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
return ret; return ret;
if (!spi_mem_internal_supports_op(mem, op)) if (!spi_mem_internal_supports_op(mem, op))
return -ENOTSUPP; return -EOPNOTSUPP;
if (ctlr->mem_ops && ctlr->mem_ops->exec_op && !spi_get_csgpiod(mem->spi, 0)) { if (ctlr->mem_ops && ctlr->mem_ops->exec_op && !spi_get_csgpiod(mem->spi, 0)) {
ret = spi_mem_access_start(mem); ret = spi_mem_access_start(mem);
...@@ -339,7 +339,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) ...@@ -339,7 +339,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
* read path) and expect the core to use the regular SPI * read path) and expect the core to use the regular SPI
* interface in other cases. * interface in other cases.
*/ */
if (!ret || ret != -ENOTSUPP) if (!ret || ret != -ENOTSUPP || ret != -EOPNOTSUPP)
return ret; return ret;
} }
...@@ -559,7 +559,7 @@ spi_mem_dirmap_create(struct spi_mem *mem, ...@@ -559,7 +559,7 @@ spi_mem_dirmap_create(struct spi_mem *mem,
if (ret) { if (ret) {
desc->nodirmap = true; desc->nodirmap = true;
if (!spi_mem_supports_op(desc->mem, &desc->info.op_tmpl)) if (!spi_mem_supports_op(desc->mem, &desc->info.op_tmpl))
ret = -ENOTSUPP; ret = -EOPNOTSUPP;
else else
ret = 0; ret = 0;
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/mpc52xx.h> #include <asm/mpc52xx.h>
......
...@@ -556,7 +556,7 @@ static int npcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) ...@@ -556,7 +556,7 @@ static int npcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
op->data.nbytes); op->data.nbytes);
if (fiu->spix_mode || op->addr.nbytes > 4) if (fiu->spix_mode || op->addr.nbytes > 4)
return -ENOTSUPP; return -EOPNOTSUPP;
if (fiu->clkrate != chip->clkrate) { if (fiu->clkrate != chip->clkrate) {
ret = clk_set_rate(fiu->clk, chip->clkrate); ret = clk_set_rate(fiu->clk, chip->clkrate);
......
This diff is collapsed.
...@@ -29,12 +29,15 @@ ...@@ -29,12 +29,15 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#define SH_MSIOF_FLAG_FIXED_DTDL_200 BIT(0)
struct sh_msiof_chipdata { struct sh_msiof_chipdata {
u32 bits_per_word_mask; u32 bits_per_word_mask;
u16 tx_fifo_size; u16 tx_fifo_size;
u16 rx_fifo_size; u16 rx_fifo_size;
u16 ctlr_flags; u16 ctlr_flags;
u16 min_div_pow; u16 min_div_pow;
u32 flags;
}; };
struct sh_msiof_spi_priv { struct sh_msiof_spi_priv {
...@@ -1072,6 +1075,16 @@ static const struct sh_msiof_chipdata rcar_gen3_data = { ...@@ -1072,6 +1075,16 @@ static const struct sh_msiof_chipdata rcar_gen3_data = {
.min_div_pow = 1, .min_div_pow = 1,
}; };
static const struct sh_msiof_chipdata rcar_r8a7795_data = {
.bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16) |
SPI_BPW_MASK(24) | SPI_BPW_MASK(32),
.tx_fifo_size = 64,
.rx_fifo_size = 64,
.ctlr_flags = SPI_CONTROLLER_MUST_TX,
.min_div_pow = 1,
.flags = SH_MSIOF_FLAG_FIXED_DTDL_200,
};
static const struct of_device_id sh_msiof_match[] __maybe_unused = { static const struct of_device_id sh_msiof_match[] __maybe_unused = {
{ .compatible = "renesas,sh-mobile-msiof", .data = &sh_data }, { .compatible = "renesas,sh-mobile-msiof", .data = &sh_data },
{ .compatible = "renesas,msiof-r8a7743", .data = &rcar_gen2_data }, { .compatible = "renesas,msiof-r8a7743", .data = &rcar_gen2_data },
...@@ -1082,6 +1095,7 @@ static const struct of_device_id sh_msiof_match[] __maybe_unused = { ...@@ -1082,6 +1095,7 @@ static const struct of_device_id sh_msiof_match[] __maybe_unused = {
{ .compatible = "renesas,msiof-r8a7793", .data = &rcar_gen2_data }, { .compatible = "renesas,msiof-r8a7793", .data = &rcar_gen2_data },
{ .compatible = "renesas,msiof-r8a7794", .data = &rcar_gen2_data }, { .compatible = "renesas,msiof-r8a7794", .data = &rcar_gen2_data },
{ .compatible = "renesas,rcar-gen2-msiof", .data = &rcar_gen2_data }, { .compatible = "renesas,rcar-gen2-msiof", .data = &rcar_gen2_data },
{ .compatible = "renesas,msiof-r8a7795", .data = &rcar_r8a7795_data },
{ .compatible = "renesas,msiof-r8a7796", .data = &rcar_gen3_data }, { .compatible = "renesas,msiof-r8a7796", .data = &rcar_gen3_data },
{ .compatible = "renesas,rcar-gen3-msiof", .data = &rcar_gen3_data }, { .compatible = "renesas,rcar-gen3-msiof", .data = &rcar_gen3_data },
{ .compatible = "renesas,rcar-gen4-msiof", .data = &rcar_gen3_data }, { .compatible = "renesas,rcar-gen4-msiof", .data = &rcar_gen3_data },
...@@ -1279,6 +1293,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) ...@@ -1279,6 +1293,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
return -ENXIO; return -ENXIO;
} }
if (chipdata->flags & SH_MSIOF_FLAG_FIXED_DTDL_200)
info->dtdl = 200;
if (info->mode == MSIOF_SPI_TARGET) if (info->mode == MSIOF_SPI_TARGET)
ctlr = spi_alloc_target(&pdev->dev, ctlr = spi_alloc_target(&pdev->dev,
sizeof(struct sh_msiof_spi_priv)); sizeof(struct sh_msiof_spi_priv));
......
...@@ -138,8 +138,7 @@ struct sprd_adi_data { ...@@ -138,8 +138,7 @@ struct sprd_adi_data {
u32 slave_offset; u32 slave_offset;
u32 slave_addr_size; u32 slave_addr_size;
int (*read_check)(u32 val, u32 reg); int (*read_check)(u32 val, u32 reg);
int (*restart)(struct notifier_block *this, int (*restart)(struct sys_off_data *data);
unsigned long mode, void *cmd);
void (*wdg_rst)(void *p); void (*wdg_rst)(void *p);
}; };
...@@ -150,7 +149,6 @@ struct sprd_adi { ...@@ -150,7 +149,6 @@ struct sprd_adi {
struct hwspinlock *hwlock; struct hwspinlock *hwlock;
unsigned long slave_vbase; unsigned long slave_vbase;
unsigned long slave_pbase; unsigned long slave_pbase;
struct notifier_block restart_handler;
const struct sprd_adi_data *data; const struct sprd_adi_data *data;
}; };
...@@ -370,11 +368,9 @@ static void sprd_adi_set_wdt_rst_mode(void *p) ...@@ -370,11 +368,9 @@ static void sprd_adi_set_wdt_rst_mode(void *p)
#endif #endif
} }
static int sprd_adi_restart(struct notifier_block *this, unsigned long mode, static int sprd_adi_restart(struct sprd_adi *sadi, unsigned long mode,
void *cmd, struct sprd_adi_wdg *wdg) const char *cmd, struct sprd_adi_wdg *wdg)
{ {
struct sprd_adi *sadi = container_of(this, struct sprd_adi,
restart_handler);
u32 val, reboot_mode = 0; u32 val, reboot_mode = 0;
if (!cmd) if (!cmd)
...@@ -448,8 +444,7 @@ static int sprd_adi_restart(struct notifier_block *this, unsigned long mode, ...@@ -448,8 +444,7 @@ static int sprd_adi_restart(struct notifier_block *this, unsigned long mode,
return NOTIFY_DONE; return NOTIFY_DONE;
} }
static int sprd_adi_restart_sc9860(struct notifier_block *this, static int sprd_adi_restart_sc9860(struct sys_off_data *data)
unsigned long mode, void *cmd)
{ {
struct sprd_adi_wdg wdg = { struct sprd_adi_wdg wdg = {
.base = PMIC_WDG_BASE, .base = PMIC_WDG_BASE,
...@@ -458,7 +453,7 @@ static int sprd_adi_restart_sc9860(struct notifier_block *this, ...@@ -458,7 +453,7 @@ static int sprd_adi_restart_sc9860(struct notifier_block *this,
.wdg_clk = PMIC_CLK_EN, .wdg_clk = PMIC_CLK_EN,
}; };
return sprd_adi_restart(this, mode, cmd, &wdg); return sprd_adi_restart(data->cb_data, data->mode, data->cmd, &wdg);
} }
static void sprd_adi_hw_init(struct sprd_adi *sadi) static void sprd_adi_hw_init(struct sprd_adi *sadi)
...@@ -533,7 +528,7 @@ static int sprd_adi_probe(struct platform_device *pdev) ...@@ -533,7 +528,7 @@ static int sprd_adi_probe(struct platform_device *pdev)
pdev->id = of_alias_get_id(np, "spi"); pdev->id = of_alias_get_id(np, "spi");
num_chipselect = of_get_child_count(np); num_chipselect = of_get_child_count(np);
ctlr = spi_alloc_master(&pdev->dev, sizeof(struct sprd_adi)); ctlr = spi_alloc_host(&pdev->dev, sizeof(struct sprd_adi));
if (!ctlr) if (!ctlr)
return -ENOMEM; return -ENOMEM;
...@@ -590,9 +585,9 @@ static int sprd_adi_probe(struct platform_device *pdev) ...@@ -590,9 +585,9 @@ static int sprd_adi_probe(struct platform_device *pdev)
} }
if (sadi->data->restart) { if (sadi->data->restart) {
sadi->restart_handler.notifier_call = sadi->data->restart; ret = devm_register_restart_handler(&pdev->dev,
sadi->restart_handler.priority = 128; sadi->data->restart,
ret = register_restart_handler(&sadi->restart_handler); sadi);
if (ret) { if (ret) {
dev_err(&pdev->dev, "can not register restart handler\n"); dev_err(&pdev->dev, "can not register restart handler\n");
goto put_ctlr; goto put_ctlr;
...@@ -606,14 +601,6 @@ static int sprd_adi_probe(struct platform_device *pdev) ...@@ -606,14 +601,6 @@ static int sprd_adi_probe(struct platform_device *pdev)
return ret; return ret;
} }
static void sprd_adi_remove(struct platform_device *pdev)
{
struct spi_controller *ctlr = dev_get_drvdata(&pdev->dev);
struct sprd_adi *sadi = spi_controller_get_devdata(ctlr);
unregister_restart_handler(&sadi->restart_handler);
}
static struct sprd_adi_data sc9860_data = { static struct sprd_adi_data sc9860_data = {
.slave_offset = ADI_10BIT_SLAVE_OFFSET, .slave_offset = ADI_10BIT_SLAVE_OFFSET,
.slave_addr_size = ADI_10BIT_SLAVE_ADDR_SIZE, .slave_addr_size = ADI_10BIT_SLAVE_ADDR_SIZE,
...@@ -657,7 +644,6 @@ static struct platform_driver sprd_adi_driver = { ...@@ -657,7 +644,6 @@ static struct platform_driver sprd_adi_driver = {
.of_match_table = sprd_adi_of_match, .of_match_table = sprd_adi_of_match,
}, },
.probe = sprd_adi_probe, .probe = sprd_adi_probe,
.remove_new = sprd_adi_remove,
}; };
module_platform_driver(sprd_adi_driver); module_platform_driver(sprd_adi_driver);
......
...@@ -578,7 +578,7 @@ static void sprd_spi_dma_release(struct sprd_spi *ss) ...@@ -578,7 +578,7 @@ static void sprd_spi_dma_release(struct sprd_spi *ss)
static int sprd_spi_dma_txrx_bufs(struct spi_device *sdev, static int sprd_spi_dma_txrx_bufs(struct spi_device *sdev,
struct spi_transfer *t) struct spi_transfer *t)
{ {
struct sprd_spi *ss = spi_master_get_devdata(sdev->master); struct sprd_spi *ss = spi_controller_get_devdata(sdev->controller);
u32 trans_len = ss->trans_len; u32 trans_len = ss->trans_len;
int ret, write_size = 0; int ret, write_size = 0;
...@@ -923,7 +923,7 @@ static int sprd_spi_probe(struct platform_device *pdev) ...@@ -923,7 +923,7 @@ static int sprd_spi_probe(struct platform_device *pdev)
int ret; int ret;
pdev->id = of_alias_get_id(pdev->dev.of_node, "spi"); pdev->id = of_alias_get_id(pdev->dev.of_node, "spi");
sctlr = spi_alloc_master(&pdev->dev, sizeof(*ss)); sctlr = spi_alloc_host(&pdev->dev, sizeof(*ss));
if (!sctlr) if (!sctlr)
return -ENOMEM; return -ENOMEM;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Patrice Chotard <patrice.chotard@st.com> * Patrice Chotard <patrice.chotard@st.com>
* Lee Jones <lee.jones@linaro.org> * Lee Jones <lee.jones@linaro.org>
* *
* SPI master mode controller driver, used in STMicroelectronics devices. * SPI host mode controller driver, used in STMicroelectronics devices.
*/ */
#include <linux/clk.h> #include <linux/clk.h>
...@@ -115,10 +115,10 @@ static void ssc_read_rx_fifo(struct spi_st *spi_st) ...@@ -115,10 +115,10 @@ static void ssc_read_rx_fifo(struct spi_st *spi_st)
spi_st->words_remaining -= count; spi_st->words_remaining -= count;
} }
static int spi_st_transfer_one(struct spi_master *master, static int spi_st_transfer_one(struct spi_controller *host,
struct spi_device *spi, struct spi_transfer *t) struct spi_device *spi, struct spi_transfer *t)
{ {
struct spi_st *spi_st = spi_master_get_devdata(master); struct spi_st *spi_st = spi_controller_get_devdata(host);
uint32_t ctl = 0; uint32_t ctl = 0;
/* Setup transfer */ /* Setup transfer */
...@@ -165,7 +165,7 @@ static int spi_st_transfer_one(struct spi_master *master, ...@@ -165,7 +165,7 @@ static int spi_st_transfer_one(struct spi_master *master,
if (ctl) if (ctl)
writel_relaxed(ctl, spi_st->base + SSC_CTL); writel_relaxed(ctl, spi_st->base + SSC_CTL);
spi_finalize_current_transfer(spi->master); spi_finalize_current_transfer(spi->controller);
return t->len; return t->len;
} }
...@@ -174,7 +174,7 @@ static int spi_st_transfer_one(struct spi_master *master, ...@@ -174,7 +174,7 @@ static int spi_st_transfer_one(struct spi_master *master,
#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_LOOP | SPI_CS_HIGH) #define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_LOOP | SPI_CS_HIGH)
static int spi_st_setup(struct spi_device *spi) static int spi_st_setup(struct spi_device *spi)
{ {
struct spi_st *spi_st = spi_master_get_devdata(spi->master); struct spi_st *spi_st = spi_controller_get_devdata(spi->controller);
u32 spi_st_clk, sscbrg, var; u32 spi_st_clk, sscbrg, var;
u32 hz = spi->max_speed_hz; u32 hz = spi->max_speed_hz;
...@@ -274,35 +274,35 @@ static irqreturn_t spi_st_irq(int irq, void *dev_id) ...@@ -274,35 +274,35 @@ static irqreturn_t spi_st_irq(int irq, void *dev_id)
static int spi_st_probe(struct platform_device *pdev) static int spi_st_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct spi_master *master; struct spi_controller *host;
struct spi_st *spi_st; struct spi_st *spi_st;
int irq, ret = 0; int irq, ret = 0;
u32 var; u32 var;
master = spi_alloc_master(&pdev->dev, sizeof(*spi_st)); host = spi_alloc_host(&pdev->dev, sizeof(*spi_st));
if (!master) if (!host)
return -ENOMEM; return -ENOMEM;
master->dev.of_node = np; host->dev.of_node = np;
master->mode_bits = MODEBITS; host->mode_bits = MODEBITS;
master->setup = spi_st_setup; host->setup = spi_st_setup;
master->transfer_one = spi_st_transfer_one; host->transfer_one = spi_st_transfer_one;
master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); host->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
master->auto_runtime_pm = true; host->auto_runtime_pm = true;
master->bus_num = pdev->id; host->bus_num = pdev->id;
master->use_gpio_descriptors = true; host->use_gpio_descriptors = true;
spi_st = spi_master_get_devdata(master); spi_st = spi_controller_get_devdata(host);
spi_st->clk = devm_clk_get(&pdev->dev, "ssc"); spi_st->clk = devm_clk_get(&pdev->dev, "ssc");
if (IS_ERR(spi_st->clk)) { if (IS_ERR(spi_st->clk)) {
dev_err(&pdev->dev, "Unable to request clock\n"); dev_err(&pdev->dev, "Unable to request clock\n");
ret = PTR_ERR(spi_st->clk); ret = PTR_ERR(spi_st->clk);
goto put_master; goto put_host;
} }
ret = clk_prepare_enable(spi_st->clk); ret = clk_prepare_enable(spi_st->clk);
if (ret) if (ret)
goto put_master; goto put_host;
init_completion(&spi_st->done); init_completion(&spi_st->done);
...@@ -324,7 +324,7 @@ static int spi_st_probe(struct platform_device *pdev) ...@@ -324,7 +324,7 @@ static int spi_st_probe(struct platform_device *pdev)
var &= ~SSC_CTL_SR; var &= ~SSC_CTL_SR;
writel_relaxed(var, spi_st->base + SSC_CTL); writel_relaxed(var, spi_st->base + SSC_CTL);
/* Set SSC into slave mode before reconfiguring PIO pins */ /* Set SSC into target mode before reconfiguring PIO pins */
var = readl_relaxed(spi_st->base + SSC_CTL); var = readl_relaxed(spi_st->base + SSC_CTL);
var &= ~SSC_CTL_MS; var &= ~SSC_CTL_MS;
writel_relaxed(var, spi_st->base + SSC_CTL); writel_relaxed(var, spi_st->base + SSC_CTL);
...@@ -347,11 +347,11 @@ static int spi_st_probe(struct platform_device *pdev) ...@@ -347,11 +347,11 @@ static int spi_st_probe(struct platform_device *pdev)
pm_runtime_set_active(&pdev->dev); pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
platform_set_drvdata(pdev, master); platform_set_drvdata(pdev, host);
ret = devm_spi_register_master(&pdev->dev, master); ret = devm_spi_register_controller(&pdev->dev, host);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to register master\n"); dev_err(&pdev->dev, "Failed to register host\n");
goto rpm_disable; goto rpm_disable;
} }
...@@ -361,15 +361,15 @@ static int spi_st_probe(struct platform_device *pdev) ...@@ -361,15 +361,15 @@ static int spi_st_probe(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
clk_disable: clk_disable:
clk_disable_unprepare(spi_st->clk); clk_disable_unprepare(spi_st->clk);
put_master: put_host:
spi_master_put(master); spi_controller_put(host);
return ret; return ret;
} }
static void spi_st_remove(struct platform_device *pdev) static void spi_st_remove(struct platform_device *pdev)
{ {
struct spi_master *master = platform_get_drvdata(pdev); struct spi_controller *host = platform_get_drvdata(pdev);
struct spi_st *spi_st = spi_master_get_devdata(master); struct spi_st *spi_st = spi_controller_get_devdata(host);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
...@@ -381,8 +381,8 @@ static void spi_st_remove(struct platform_device *pdev) ...@@ -381,8 +381,8 @@ static void spi_st_remove(struct platform_device *pdev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int spi_st_runtime_suspend(struct device *dev) static int spi_st_runtime_suspend(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct spi_st *spi_st = spi_master_get_devdata(master); struct spi_st *spi_st = spi_controller_get_devdata(host);
writel_relaxed(0, spi_st->base + SSC_IEN); writel_relaxed(0, spi_st->base + SSC_IEN);
pinctrl_pm_select_sleep_state(dev); pinctrl_pm_select_sleep_state(dev);
...@@ -394,8 +394,8 @@ static int spi_st_runtime_suspend(struct device *dev) ...@@ -394,8 +394,8 @@ static int spi_st_runtime_suspend(struct device *dev)
static int spi_st_runtime_resume(struct device *dev) static int spi_st_runtime_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct spi_st *spi_st = spi_master_get_devdata(master); struct spi_st *spi_st = spi_controller_get_devdata(host);
int ret; int ret;
ret = clk_prepare_enable(spi_st->clk); ret = clk_prepare_enable(spi_st->clk);
...@@ -408,10 +408,10 @@ static int spi_st_runtime_resume(struct device *dev) ...@@ -408,10 +408,10 @@ static int spi_st_runtime_resume(struct device *dev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int spi_st_suspend(struct device *dev) static int spi_st_suspend(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
int ret; int ret;
ret = spi_master_suspend(master); ret = spi_controller_suspend(host);
if (ret) if (ret)
return ret; return ret;
...@@ -420,10 +420,10 @@ static int spi_st_suspend(struct device *dev) ...@@ -420,10 +420,10 @@ static int spi_st_suspend(struct device *dev)
static int spi_st_resume(struct device *dev) static int spi_st_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
int ret; int ret;
ret = spi_master_resume(master); ret = spi_controller_resume(host);
if (ret) if (ret)
return ret; return ret;
......
...@@ -357,7 +357,7 @@ static int stm32_qspi_get_mode(u8 buswidth) ...@@ -357,7 +357,7 @@ static int stm32_qspi_get_mode(u8 buswidth)
static int stm32_qspi_send(struct spi_device *spi, const struct spi_mem_op *op) static int stm32_qspi_send(struct spi_device *spi, const struct spi_mem_op *op)
{ {
struct stm32_qspi *qspi = spi_controller_get_devdata(spi->master); struct stm32_qspi *qspi = spi_controller_get_devdata(spi->controller);
struct stm32_qspi_flash *flash = &qspi->flash[spi_get_chipselect(spi, 0)]; struct stm32_qspi_flash *flash = &qspi->flash[spi_get_chipselect(spi, 0)];
u32 ccr, cr; u32 ccr, cr;
int timeout, err = 0, err_poll_status = 0; int timeout, err = 0, err_poll_status = 0;
...@@ -448,7 +448,7 @@ static int stm32_qspi_poll_status(struct spi_mem *mem, const struct spi_mem_op * ...@@ -448,7 +448,7 @@ static int stm32_qspi_poll_status(struct spi_mem *mem, const struct spi_mem_op *
unsigned long polling_rate_us, unsigned long polling_rate_us,
unsigned long timeout_ms) unsigned long timeout_ms)
{ {
struct stm32_qspi *qspi = spi_controller_get_devdata(mem->spi->master); struct stm32_qspi *qspi = spi_controller_get_devdata(mem->spi->controller);
int ret; int ret;
if (!spi_mem_supports_op(mem, op)) if (!spi_mem_supports_op(mem, op))
...@@ -476,7 +476,7 @@ static int stm32_qspi_poll_status(struct spi_mem *mem, const struct spi_mem_op * ...@@ -476,7 +476,7 @@ static int stm32_qspi_poll_status(struct spi_mem *mem, const struct spi_mem_op *
static int stm32_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) static int stm32_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
{ {
struct stm32_qspi *qspi = spi_controller_get_devdata(mem->spi->master); struct stm32_qspi *qspi = spi_controller_get_devdata(mem->spi->controller);
int ret; int ret;
ret = pm_runtime_resume_and_get(qspi->dev); ret = pm_runtime_resume_and_get(qspi->dev);
...@@ -500,7 +500,7 @@ static int stm32_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) ...@@ -500,7 +500,7 @@ static int stm32_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
static int stm32_qspi_dirmap_create(struct spi_mem_dirmap_desc *desc) static int stm32_qspi_dirmap_create(struct spi_mem_dirmap_desc *desc)
{ {
struct stm32_qspi *qspi = spi_controller_get_devdata(desc->mem->spi->master); struct stm32_qspi *qspi = spi_controller_get_devdata(desc->mem->spi->controller);
if (desc->info.op_tmpl.data.dir == SPI_MEM_DATA_OUT) if (desc->info.op_tmpl.data.dir == SPI_MEM_DATA_OUT)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -518,7 +518,7 @@ static int stm32_qspi_dirmap_create(struct spi_mem_dirmap_desc *desc) ...@@ -518,7 +518,7 @@ static int stm32_qspi_dirmap_create(struct spi_mem_dirmap_desc *desc)
static ssize_t stm32_qspi_dirmap_read(struct spi_mem_dirmap_desc *desc, static ssize_t stm32_qspi_dirmap_read(struct spi_mem_dirmap_desc *desc,
u64 offs, size_t len, void *buf) u64 offs, size_t len, void *buf)
{ {
struct stm32_qspi *qspi = spi_controller_get_devdata(desc->mem->spi->master); struct stm32_qspi *qspi = spi_controller_get_devdata(desc->mem->spi->controller);
struct spi_mem_op op; struct spi_mem_op op;
u32 addr_max; u32 addr_max;
int ret; int ret;
...@@ -640,7 +640,7 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl, ...@@ -640,7 +640,7 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl,
static int stm32_qspi_setup(struct spi_device *spi) static int stm32_qspi_setup(struct spi_device *spi)
{ {
struct spi_controller *ctrl = spi->master; struct spi_controller *ctrl = spi->controller;
struct stm32_qspi *qspi = spi_controller_get_devdata(ctrl); struct stm32_qspi *qspi = spi_controller_get_devdata(ctrl);
struct stm32_qspi_flash *flash; struct stm32_qspi_flash *flash;
u32 presc, mode; u32 presc, mode;
...@@ -775,7 +775,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) ...@@ -775,7 +775,7 @@ static int stm32_qspi_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
int ret, irq; int ret, irq;
ctrl = devm_spi_alloc_master(dev, sizeof(*qspi)); ctrl = devm_spi_alloc_host(dev, sizeof(*qspi));
if (!ctrl) if (!ctrl)
return -ENOMEM; return -ENOMEM;
...@@ -861,7 +861,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) ...@@ -861,7 +861,7 @@ static int stm32_qspi_probe(struct platform_device *pdev)
pm_runtime_enable(dev); pm_runtime_enable(dev);
pm_runtime_get_noresume(dev); pm_runtime_get_noresume(dev);
ret = spi_register_master(ctrl); ret = spi_register_controller(ctrl);
if (ret) if (ret)
goto err_pm_runtime_free; goto err_pm_runtime_free;
...@@ -892,7 +892,7 @@ static void stm32_qspi_remove(struct platform_device *pdev) ...@@ -892,7 +892,7 @@ static void stm32_qspi_remove(struct platform_device *pdev)
struct stm32_qspi *qspi = platform_get_drvdata(pdev); struct stm32_qspi *qspi = platform_get_drvdata(pdev);
pm_runtime_get_sync(qspi->dev); pm_runtime_get_sync(qspi->dev);
spi_unregister_master(qspi->ctrl); spi_unregister_controller(qspi->ctrl);
/* disable qspi */ /* disable qspi */
writel_relaxed(0, qspi->io_base + QSPI_CR); writel_relaxed(0, qspi->io_base + QSPI_CR);
stm32_qspi_dma_free(qspi); stm32_qspi_dma_free(qspi);
......
This diff is collapsed.
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
#define SUN4I_FIFO_STA_TF_CNT_BITS 16 #define SUN4I_FIFO_STA_TF_CNT_BITS 16
struct sun4i_spi { struct sun4i_spi {
struct spi_master *master; struct spi_controller *host;
void __iomem *base_addr; void __iomem *base_addr;
struct clk *hclk; struct clk *hclk;
struct clk *mclk; struct clk *mclk;
...@@ -161,7 +161,7 @@ static inline void sun4i_spi_fill_fifo(struct sun4i_spi *sspi, int len) ...@@ -161,7 +161,7 @@ static inline void sun4i_spi_fill_fifo(struct sun4i_spi *sspi, int len)
static void sun4i_spi_set_cs(struct spi_device *spi, bool enable) static void sun4i_spi_set_cs(struct spi_device *spi, bool enable)
{ {
struct sun4i_spi *sspi = spi_master_get_devdata(spi->master); struct sun4i_spi *sspi = spi_controller_get_devdata(spi->controller);
u32 reg; u32 reg;
reg = sun4i_spi_read(sspi, SUN4I_CTL_REG); reg = sun4i_spi_read(sspi, SUN4I_CTL_REG);
...@@ -201,11 +201,11 @@ static size_t sun4i_spi_max_transfer_size(struct spi_device *spi) ...@@ -201,11 +201,11 @@ static size_t sun4i_spi_max_transfer_size(struct spi_device *spi)
return SUN4I_MAX_XFER_SIZE - 1; return SUN4I_MAX_XFER_SIZE - 1;
} }
static int sun4i_spi_transfer_one(struct spi_master *master, static int sun4i_spi_transfer_one(struct spi_controller *host,
struct spi_device *spi, struct spi_device *spi,
struct spi_transfer *tfr) struct spi_transfer *tfr)
{ {
struct sun4i_spi *sspi = spi_master_get_devdata(master); struct sun4i_spi *sspi = spi_controller_get_devdata(host);
unsigned int mclk_rate, div, timeout; unsigned int mclk_rate, div, timeout;
unsigned int start, end, tx_time; unsigned int start, end, tx_time;
unsigned int tx_len = 0; unsigned int tx_len = 0;
...@@ -331,7 +331,7 @@ static int sun4i_spi_transfer_one(struct spi_master *master, ...@@ -331,7 +331,7 @@ static int sun4i_spi_transfer_one(struct spi_master *master,
msecs_to_jiffies(tx_time)); msecs_to_jiffies(tx_time));
end = jiffies; end = jiffies;
if (!timeout) { if (!timeout) {
dev_warn(&master->dev, dev_warn(&host->dev,
"%s: timeout transferring %u bytes@%iHz for %i(%i)ms", "%s: timeout transferring %u bytes@%iHz for %i(%i)ms",
dev_name(&spi->dev), tfr->len, tfr->speed_hz, dev_name(&spi->dev), tfr->len, tfr->speed_hz,
jiffies_to_msecs(end - start), tx_time); jiffies_to_msecs(end - start), tx_time);
...@@ -386,8 +386,8 @@ static irqreturn_t sun4i_spi_handler(int irq, void *dev_id) ...@@ -386,8 +386,8 @@ static irqreturn_t sun4i_spi_handler(int irq, void *dev_id)
static int sun4i_spi_runtime_resume(struct device *dev) static int sun4i_spi_runtime_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct sun4i_spi *sspi = spi_master_get_devdata(master); struct sun4i_spi *sspi = spi_controller_get_devdata(host);
int ret; int ret;
ret = clk_prepare_enable(sspi->hclk); ret = clk_prepare_enable(sspi->hclk);
...@@ -415,8 +415,8 @@ static int sun4i_spi_runtime_resume(struct device *dev) ...@@ -415,8 +415,8 @@ static int sun4i_spi_runtime_resume(struct device *dev)
static int sun4i_spi_runtime_suspend(struct device *dev) static int sun4i_spi_runtime_suspend(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct sun4i_spi *sspi = spi_master_get_devdata(master); struct sun4i_spi *sspi = spi_controller_get_devdata(host);
clk_disable_unprepare(sspi->mclk); clk_disable_unprepare(sspi->mclk);
clk_disable_unprepare(sspi->hclk); clk_disable_unprepare(sspi->hclk);
...@@ -426,62 +426,62 @@ static int sun4i_spi_runtime_suspend(struct device *dev) ...@@ -426,62 +426,62 @@ static int sun4i_spi_runtime_suspend(struct device *dev)
static int sun4i_spi_probe(struct platform_device *pdev) static int sun4i_spi_probe(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_controller *host;
struct sun4i_spi *sspi; struct sun4i_spi *sspi;
int ret = 0, irq; int ret = 0, irq;
master = spi_alloc_master(&pdev->dev, sizeof(struct sun4i_spi)); host = spi_alloc_host(&pdev->dev, sizeof(struct sun4i_spi));
if (!master) { if (!host) {
dev_err(&pdev->dev, "Unable to allocate SPI Master\n"); dev_err(&pdev->dev, "Unable to allocate SPI Host\n");
return -ENOMEM; return -ENOMEM;
} }
platform_set_drvdata(pdev, master); platform_set_drvdata(pdev, host);
sspi = spi_master_get_devdata(master); sspi = spi_controller_get_devdata(host);
sspi->base_addr = devm_platform_ioremap_resource(pdev, 0); sspi->base_addr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(sspi->base_addr)) { if (IS_ERR(sspi->base_addr)) {
ret = PTR_ERR(sspi->base_addr); ret = PTR_ERR(sspi->base_addr);
goto err_free_master; goto err_free_host;
} }
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
ret = -ENXIO; ret = -ENXIO;
goto err_free_master; goto err_free_host;
} }
ret = devm_request_irq(&pdev->dev, irq, sun4i_spi_handler, ret = devm_request_irq(&pdev->dev, irq, sun4i_spi_handler,
0, "sun4i-spi", sspi); 0, "sun4i-spi", sspi);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Cannot request IRQ\n"); dev_err(&pdev->dev, "Cannot request IRQ\n");
goto err_free_master; goto err_free_host;
} }
sspi->master = master; sspi->host = host;
master->max_speed_hz = 100 * 1000 * 1000; host->max_speed_hz = 100 * 1000 * 1000;
master->min_speed_hz = 3 * 1000; host->min_speed_hz = 3 * 1000;
master->set_cs = sun4i_spi_set_cs; host->set_cs = sun4i_spi_set_cs;
master->transfer_one = sun4i_spi_transfer_one; host->transfer_one = sun4i_spi_transfer_one;
master->num_chipselect = 4; host->num_chipselect = 4;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST; host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST;
master->bits_per_word_mask = SPI_BPW_MASK(8); host->bits_per_word_mask = SPI_BPW_MASK(8);
master->dev.of_node = pdev->dev.of_node; host->dev.of_node = pdev->dev.of_node;
master->auto_runtime_pm = true; host->auto_runtime_pm = true;
master->max_transfer_size = sun4i_spi_max_transfer_size; host->max_transfer_size = sun4i_spi_max_transfer_size;
sspi->hclk = devm_clk_get(&pdev->dev, "ahb"); sspi->hclk = devm_clk_get(&pdev->dev, "ahb");
if (IS_ERR(sspi->hclk)) { if (IS_ERR(sspi->hclk)) {
dev_err(&pdev->dev, "Unable to acquire AHB clock\n"); dev_err(&pdev->dev, "Unable to acquire AHB clock\n");
ret = PTR_ERR(sspi->hclk); ret = PTR_ERR(sspi->hclk);
goto err_free_master; goto err_free_host;
} }
sspi->mclk = devm_clk_get(&pdev->dev, "mod"); sspi->mclk = devm_clk_get(&pdev->dev, "mod");
if (IS_ERR(sspi->mclk)) { if (IS_ERR(sspi->mclk)) {
dev_err(&pdev->dev, "Unable to acquire module clock\n"); dev_err(&pdev->dev, "Unable to acquire module clock\n");
ret = PTR_ERR(sspi->mclk); ret = PTR_ERR(sspi->mclk);
goto err_free_master; goto err_free_host;
} }
init_completion(&sspi->done); init_completion(&sspi->done);
...@@ -493,16 +493,16 @@ static int sun4i_spi_probe(struct platform_device *pdev) ...@@ -493,16 +493,16 @@ static int sun4i_spi_probe(struct platform_device *pdev)
ret = sun4i_spi_runtime_resume(&pdev->dev); ret = sun4i_spi_runtime_resume(&pdev->dev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Couldn't resume the device\n"); dev_err(&pdev->dev, "Couldn't resume the device\n");
goto err_free_master; goto err_free_host;
} }
pm_runtime_set_active(&pdev->dev); pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
pm_runtime_idle(&pdev->dev); pm_runtime_idle(&pdev->dev);
ret = devm_spi_register_master(&pdev->dev, master); ret = devm_spi_register_controller(&pdev->dev, host);
if (ret) { if (ret) {
dev_err(&pdev->dev, "cannot register SPI master\n"); dev_err(&pdev->dev, "cannot register SPI host\n");
goto err_pm_disable; goto err_pm_disable;
} }
...@@ -511,8 +511,8 @@ static int sun4i_spi_probe(struct platform_device *pdev) ...@@ -511,8 +511,8 @@ static int sun4i_spi_probe(struct platform_device *pdev)
err_pm_disable: err_pm_disable:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
sun4i_spi_runtime_suspend(&pdev->dev); sun4i_spi_runtime_suspend(&pdev->dev);
err_free_master: err_free_host:
spi_master_put(master); spi_controller_put(host);
return ret; return ret;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -225,11 +225,11 @@ static int write_fifo(struct synquacer_spi *sspi) ...@@ -225,11 +225,11 @@ static int write_fifo(struct synquacer_spi *sspi)
return 0; return 0;
} }
static int synquacer_spi_config(struct spi_master *master, static int synquacer_spi_config(struct spi_controller *host,
struct spi_device *spi, struct spi_device *spi,
struct spi_transfer *xfer) struct spi_transfer *xfer)
{ {
struct synquacer_spi *sspi = spi_master_get_devdata(master); struct synquacer_spi *sspi = spi_controller_get_devdata(host);
unsigned int speed, mode, bpw, cs, bus_width, transfer_mode; unsigned int speed, mode, bpw, cs, bus_width, transfer_mode;
u32 rate, val, div; u32 rate, val, div;
...@@ -263,7 +263,7 @@ static int synquacer_spi_config(struct spi_master *master, ...@@ -263,7 +263,7 @@ static int synquacer_spi_config(struct spi_master *master,
} }
sspi->transfer_mode = transfer_mode; sspi->transfer_mode = transfer_mode;
rate = master->max_speed_hz; rate = host->max_speed_hz;
div = DIV_ROUND_UP(rate, speed); div = DIV_ROUND_UP(rate, speed);
if (div > 254) { if (div > 254) {
...@@ -350,11 +350,11 @@ static int synquacer_spi_config(struct spi_master *master, ...@@ -350,11 +350,11 @@ static int synquacer_spi_config(struct spi_master *master,
return 0; return 0;
} }
static int synquacer_spi_transfer_one(struct spi_master *master, static int synquacer_spi_transfer_one(struct spi_controller *host,
struct spi_device *spi, struct spi_device *spi,
struct spi_transfer *xfer) struct spi_transfer *xfer)
{ {
struct synquacer_spi *sspi = spi_master_get_devdata(master); struct synquacer_spi *sspi = spi_controller_get_devdata(host);
int ret; int ret;
int status = 0; int status = 0;
u32 words; u32 words;
...@@ -378,7 +378,7 @@ static int synquacer_spi_transfer_one(struct spi_master *master, ...@@ -378,7 +378,7 @@ static int synquacer_spi_transfer_one(struct spi_master *master,
if (bpw == 8 && !(xfer->len % 4) && !(spi->mode & SPI_LSB_FIRST)) if (bpw == 8 && !(xfer->len % 4) && !(spi->mode & SPI_LSB_FIRST))
xfer->bits_per_word = 32; xfer->bits_per_word = 32;
ret = synquacer_spi_config(master, spi, xfer); ret = synquacer_spi_config(host, spi, xfer);
/* restore */ /* restore */
xfer->bits_per_word = bpw; xfer->bits_per_word = bpw;
...@@ -482,7 +482,7 @@ static int synquacer_spi_transfer_one(struct spi_master *master, ...@@ -482,7 +482,7 @@ static int synquacer_spi_transfer_one(struct spi_master *master,
static void synquacer_spi_set_cs(struct spi_device *spi, bool enable) static void synquacer_spi_set_cs(struct spi_device *spi, bool enable)
{ {
struct synquacer_spi *sspi = spi_master_get_devdata(spi->master); struct synquacer_spi *sspi = spi_controller_get_devdata(spi->controller);
u32 val; u32 val;
val = readl(sspi->regs + SYNQUACER_HSSPI_REG_DMSTART); val = readl(sspi->regs + SYNQUACER_HSSPI_REG_DMSTART);
...@@ -517,11 +517,11 @@ static int synquacer_spi_wait_status_update(struct synquacer_spi *sspi, ...@@ -517,11 +517,11 @@ static int synquacer_spi_wait_status_update(struct synquacer_spi *sspi,
return -EBUSY; return -EBUSY;
} }
static int synquacer_spi_enable(struct spi_master *master) static int synquacer_spi_enable(struct spi_controller *host)
{ {
u32 val; u32 val;
int status; int status;
struct synquacer_spi *sspi = spi_master_get_devdata(master); struct synquacer_spi *sspi = spi_controller_get_devdata(host);
/* Disable module */ /* Disable module */
writel(0, sspi->regs + SYNQUACER_HSSPI_REG_MCTRL); writel(0, sspi->regs + SYNQUACER_HSSPI_REG_MCTRL);
...@@ -601,18 +601,18 @@ static irqreturn_t sq_spi_tx_handler(int irq, void *priv) ...@@ -601,18 +601,18 @@ static irqreturn_t sq_spi_tx_handler(int irq, void *priv)
static int synquacer_spi_probe(struct platform_device *pdev) static int synquacer_spi_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct spi_master *master; struct spi_controller *host;
struct synquacer_spi *sspi; struct synquacer_spi *sspi;
int ret; int ret;
int rx_irq, tx_irq; int rx_irq, tx_irq;
master = spi_alloc_master(&pdev->dev, sizeof(*sspi)); host = spi_alloc_host(&pdev->dev, sizeof(*sspi));
if (!master) if (!host)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, master); platform_set_drvdata(pdev, host);
sspi = spi_master_get_devdata(master); sspi = spi_controller_get_devdata(host);
sspi->dev = &pdev->dev; sspi->dev = &pdev->dev;
init_completion(&sspi->transfer_done); init_completion(&sspi->transfer_done);
...@@ -625,7 +625,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) ...@@ -625,7 +625,7 @@ static int synquacer_spi_probe(struct platform_device *pdev)
sspi->clk_src_type = SYNQUACER_HSSPI_CLOCK_SRC_IHCLK; /* Default */ sspi->clk_src_type = SYNQUACER_HSSPI_CLOCK_SRC_IHCLK; /* Default */
device_property_read_u32(&pdev->dev, "socionext,ihclk-rate", device_property_read_u32(&pdev->dev, "socionext,ihclk-rate",
&master->max_speed_hz); /* for ACPI */ &host->max_speed_hz); /* for ACPI */
if (dev_of_node(&pdev->dev)) { if (dev_of_node(&pdev->dev)) {
if (device_property_match_string(&pdev->dev, if (device_property_match_string(&pdev->dev,
...@@ -655,21 +655,21 @@ static int synquacer_spi_probe(struct platform_device *pdev) ...@@ -655,21 +655,21 @@ static int synquacer_spi_probe(struct platform_device *pdev)
goto put_spi; goto put_spi;
} }
master->max_speed_hz = clk_get_rate(sspi->clk); host->max_speed_hz = clk_get_rate(sspi->clk);
} }
if (!master->max_speed_hz) { if (!host->max_speed_hz) {
dev_err(&pdev->dev, "missing clock source\n"); dev_err(&pdev->dev, "missing clock source\n");
ret = -EINVAL; ret = -EINVAL;
goto disable_clk; goto disable_clk;
} }
master->min_speed_hz = master->max_speed_hz / 254; host->min_speed_hz = host->max_speed_hz / 254;
sspi->aces = device_property_read_bool(&pdev->dev, sspi->aces = device_property_read_bool(&pdev->dev,
"socionext,set-aces"); "socionext,set-aces");
sspi->rtm = device_property_read_bool(&pdev->dev, "socionext,use-rtm"); sspi->rtm = device_property_read_bool(&pdev->dev, "socionext,use-rtm");
master->num_chipselect = SYNQUACER_HSSPI_NUM_CHIP_SELECT; host->num_chipselect = SYNQUACER_HSSPI_NUM_CHIP_SELECT;
rx_irq = platform_get_irq(pdev, 0); rx_irq = platform_get_irq(pdev, 0);
if (rx_irq <= 0) { if (rx_irq <= 0) {
...@@ -699,27 +699,27 @@ static int synquacer_spi_probe(struct platform_device *pdev) ...@@ -699,27 +699,27 @@ static int synquacer_spi_probe(struct platform_device *pdev)
goto disable_clk; goto disable_clk;
} }
master->dev.of_node = np; host->dev.of_node = np;
master->dev.fwnode = pdev->dev.fwnode; host->dev.fwnode = pdev->dev.fwnode;
master->auto_runtime_pm = true; host->auto_runtime_pm = true;
master->bus_num = pdev->id; host->bus_num = pdev->id;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_TX_DUAL | SPI_RX_DUAL | host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_TX_DUAL | SPI_RX_DUAL |
SPI_TX_QUAD | SPI_RX_QUAD; SPI_TX_QUAD | SPI_RX_QUAD;
master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(24) | host->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(24) |
SPI_BPW_MASK(16) | SPI_BPW_MASK(8); SPI_BPW_MASK(16) | SPI_BPW_MASK(8);
master->set_cs = synquacer_spi_set_cs; host->set_cs = synquacer_spi_set_cs;
master->transfer_one = synquacer_spi_transfer_one; host->transfer_one = synquacer_spi_transfer_one;
ret = synquacer_spi_enable(master); ret = synquacer_spi_enable(host);
if (ret) if (ret)
goto disable_clk; goto disable_clk;
pm_runtime_set_active(sspi->dev); pm_runtime_set_active(sspi->dev);
pm_runtime_enable(sspi->dev); pm_runtime_enable(sspi->dev);
ret = devm_spi_register_master(sspi->dev, master); ret = devm_spi_register_controller(sspi->dev, host);
if (ret) if (ret)
goto disable_pm; goto disable_pm;
...@@ -730,15 +730,15 @@ static int synquacer_spi_probe(struct platform_device *pdev) ...@@ -730,15 +730,15 @@ static int synquacer_spi_probe(struct platform_device *pdev)
disable_clk: disable_clk:
clk_disable_unprepare(sspi->clk); clk_disable_unprepare(sspi->clk);
put_spi: put_spi:
spi_master_put(master); spi_controller_put(host);
return ret; return ret;
} }
static void synquacer_spi_remove(struct platform_device *pdev) static void synquacer_spi_remove(struct platform_device *pdev)
{ {
struct spi_master *master = platform_get_drvdata(pdev); struct spi_controller *host = platform_get_drvdata(pdev);
struct synquacer_spi *sspi = spi_master_get_devdata(master); struct synquacer_spi *sspi = spi_controller_get_devdata(host);
pm_runtime_disable(sspi->dev); pm_runtime_disable(sspi->dev);
...@@ -747,11 +747,11 @@ static void synquacer_spi_remove(struct platform_device *pdev) ...@@ -747,11 +747,11 @@ static void synquacer_spi_remove(struct platform_device *pdev)
static int __maybe_unused synquacer_spi_suspend(struct device *dev) static int __maybe_unused synquacer_spi_suspend(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct synquacer_spi *sspi = spi_master_get_devdata(master); struct synquacer_spi *sspi = spi_controller_get_devdata(host);
int ret; int ret;
ret = spi_master_suspend(master); ret = spi_controller_suspend(host);
if (ret) if (ret)
return ret; return ret;
...@@ -763,8 +763,8 @@ static int __maybe_unused synquacer_spi_suspend(struct device *dev) ...@@ -763,8 +763,8 @@ static int __maybe_unused synquacer_spi_suspend(struct device *dev)
static int __maybe_unused synquacer_spi_resume(struct device *dev) static int __maybe_unused synquacer_spi_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct synquacer_spi *sspi = spi_master_get_devdata(master); struct synquacer_spi *sspi = spi_controller_get_devdata(host);
int ret; int ret;
if (!pm_runtime_suspended(dev)) { if (!pm_runtime_suspended(dev)) {
...@@ -778,7 +778,7 @@ static int __maybe_unused synquacer_spi_resume(struct device *dev) ...@@ -778,7 +778,7 @@ static int __maybe_unused synquacer_spi_resume(struct device *dev)
return ret; return ret;
} }
ret = synquacer_spi_enable(master); ret = synquacer_spi_enable(host);
if (ret) { if (ret) {
clk_disable_unprepare(sspi->clk); clk_disable_unprepare(sspi->clk);
dev_err(dev, "failed to enable spi (%d)\n", ret); dev_err(dev, "failed to enable spi (%d)\n", ret);
...@@ -786,7 +786,7 @@ static int __maybe_unused synquacer_spi_resume(struct device *dev) ...@@ -786,7 +786,7 @@ static int __maybe_unused synquacer_spi_resume(struct device *dev)
} }
} }
ret = spi_master_resume(master); ret = spi_controller_resume(host);
if (ret < 0) if (ret < 0)
clk_disable_unprepare(sspi->clk); clk_disable_unprepare(sspi->clk);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -361,7 +361,7 @@ static int wpcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) ...@@ -361,7 +361,7 @@ static int wpcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
wpcm_fiu_stall_host(fiu, false); wpcm_fiu_stall_host(fiu, false);
return -ENOTSUPP; return -EOPNOTSUPP;
} }
static int wpcm_fiu_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op) static int wpcm_fiu_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op)
...@@ -441,7 +441,7 @@ static int wpcm_fiu_probe(struct platform_device *pdev) ...@@ -441,7 +441,7 @@ static int wpcm_fiu_probe(struct platform_device *pdev)
struct wpcm_fiu_spi *fiu; struct wpcm_fiu_spi *fiu;
struct resource *res; struct resource *res;
ctrl = devm_spi_alloc_master(dev, sizeof(*fiu)); ctrl = devm_spi_alloc_host(dev, sizeof(*fiu));
if (!ctrl) if (!ctrl)
return -ENOMEM; return -ENOMEM;
......
...@@ -132,10 +132,10 @@ static int spi_xcomm_txrx_bufs(struct spi_xcomm *spi_xcomm, ...@@ -132,10 +132,10 @@ static int spi_xcomm_txrx_bufs(struct spi_xcomm *spi_xcomm,
return t->len; return t->len;
} }
static int spi_xcomm_transfer_one(struct spi_master *master, static int spi_xcomm_transfer_one(struct spi_controller *host,
struct spi_message *msg) struct spi_message *msg)
{ {
struct spi_xcomm *spi_xcomm = spi_master_get_devdata(master); struct spi_xcomm *spi_xcomm = spi_controller_get_devdata(host);
unsigned int settings = spi_xcomm->settings; unsigned int settings = spi_xcomm->settings;
struct spi_device *spi = msg->spi; struct spi_device *spi = msg->spi;
unsigned cs_change = 0; unsigned cs_change = 0;
...@@ -197,7 +197,7 @@ static int spi_xcomm_transfer_one(struct spi_master *master, ...@@ -197,7 +197,7 @@ static int spi_xcomm_transfer_one(struct spi_master *master,
spi_xcomm_chipselect(spi_xcomm, spi, false); spi_xcomm_chipselect(spi_xcomm, spi, false);
msg->status = status; msg->status = status;
spi_finalize_current_message(master); spi_finalize_current_message(host);
return status; return status;
} }
...@@ -205,27 +205,27 @@ static int spi_xcomm_transfer_one(struct spi_master *master, ...@@ -205,27 +205,27 @@ static int spi_xcomm_transfer_one(struct spi_master *master,
static int spi_xcomm_probe(struct i2c_client *i2c) static int spi_xcomm_probe(struct i2c_client *i2c)
{ {
struct spi_xcomm *spi_xcomm; struct spi_xcomm *spi_xcomm;
struct spi_master *master; struct spi_controller *host;
int ret; int ret;
master = spi_alloc_master(&i2c->dev, sizeof(*spi_xcomm)); host = spi_alloc_host(&i2c->dev, sizeof(*spi_xcomm));
if (!master) if (!host)
return -ENOMEM; return -ENOMEM;
spi_xcomm = spi_master_get_devdata(master); spi_xcomm = spi_controller_get_devdata(host);
spi_xcomm->i2c = i2c; spi_xcomm->i2c = i2c;
master->num_chipselect = 16; host->num_chipselect = 16;
master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_3WIRE; host->mode_bits = SPI_CPHA | SPI_CPOL | SPI_3WIRE;
master->bits_per_word_mask = SPI_BPW_MASK(8); host->bits_per_word_mask = SPI_BPW_MASK(8);
master->flags = SPI_CONTROLLER_HALF_DUPLEX; host->flags = SPI_CONTROLLER_HALF_DUPLEX;
master->transfer_one_message = spi_xcomm_transfer_one; host->transfer_one_message = spi_xcomm_transfer_one;
master->dev.of_node = i2c->dev.of_node; host->dev.of_node = i2c->dev.of_node;
i2c_set_clientdata(i2c, master); i2c_set_clientdata(i2c, host);
ret = devm_spi_register_master(&i2c->dev, master); ret = devm_spi_register_controller(&i2c->dev, host);
if (ret < 0) if (ret < 0)
spi_master_put(master); spi_controller_put(host);
return ret; return ret;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -1201,7 +1201,7 @@ static int max3420_probe(struct spi_device *spi) ...@@ -1201,7 +1201,7 @@ static int max3420_probe(struct spi_device *spi)
int err, irq; int err, irq;
u8 reg[8]; u8 reg[8];
if (spi->master->flags & SPI_MASTER_HALF_DUPLEX) { if (spi->master->flags & SPI_CONTROLLER_HALF_DUPLEX) {
dev_err(&spi->dev, "UDC needs full duplex to work\n"); dev_err(&spi->dev, "UDC needs full duplex to work\n");
return -EINVAL; return -EINVAL;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment