Skip to content

Commit 405f658

Browse files
committed
Merge tag 'spi-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown: "A busy release for SPI, almost all of it in a couple of larger fix and cleanup series for patterns that affected many drivers. We do have a couple of core API additions as well, relatively application specific but they enable some new use cases. - A packed command operation for spi-mem devices - Improvements to the ancillary device support to enable some IIO use cases from Antoniu Miclaus - Fixes for a registration ordering issue pattern caused by the handover between allocation and registration of controllers in concert with devm from Johan Hovold - Improvements to handling of clock allocation from Pei Xiao - Cleanups in the fsl-lpspi driver from Marc Kleine-Budde - Support for Renesas RZ/G3E and RZ/G3L" * tag 'spi-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (115 commits) spi: sn-f-ospi: fix incorrect return code for invalid num-cs spi: spi-mem: Add a packed command operation spi: cadence-qspi: Revert the filtering of certain opcodes in ODTR spi: mtk-snfi: unregister ECC engine on probe failure and remove() callback spi: s3c64xx: fix NULL-deref on driver unbind spi: zynq-qspi: fix controller deregistration spi: zynqmp-gqspi: fix controller deregistration spi: uniphier: fix controller deregistration spi: ti-qspi: fix controller deregistration spi: tegra20-sflash: fix controller deregistration spi: tegra114: fix controller deregistration spi: syncuacer: fix controller deregistration spi: sun6i: fix controller deregistration spi: sun4i: fix controller deregistration spi: st-ssc4: fix controller deregistration spi: sprd: fix controller deregistration spi: slave-mt27xx: fix controller deregistration spi: sifive: fix controller deregistration spi: sh-msiof: fix controller deregistration spi: sh-hspi: fix controller deregistration ...
2 parents 44f7a37 + c4c3fc8 commit 405f658

75 files changed

Lines changed: 741 additions & 493 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/devicetree/bindings/spi/microchip,mpfs-spi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ properties:
3535
interrupts:
3636
maxItems: 1
3737

38-
clock-names:
38+
clocks:
3939
maxItems: 1
4040

41-
clocks:
41+
resets:
4242
maxItems: 1
4343

4444
microchip,apb-datawidth:

Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ properties:
1313
compatible:
1414
oneOf:
1515
- enum:
16+
- renesas,r9a08g046-rspi # RZ/G3L
1617
- renesas,r9a09g057-rspi # RZ/V2H(P)
1718
- renesas,r9a09g077-rspi # RZ/T2H
1819
- items:
19-
- const: renesas,r9a09g056-rspi # RZ/V2N
20+
- enum:
21+
- renesas,r9a09g047-rspi # RZ/G3E
22+
- renesas,r9a09g056-rspi # RZ/V2N
2023
- const: renesas,r9a09g057-rspi
2124
- items:
2225
- const: renesas,r9a09g087-rspi # RZ/N2H
@@ -58,12 +61,19 @@ properties:
5861
- const: tresetn
5962

6063
dmas:
61-
maxItems: 2
64+
minItems: 2
65+
maxItems: 10
66+
description:
67+
Must contain a list of pairs of references to DMA specifiers, one for
68+
transmission, and one for reception.
6269

6370
dma-names:
71+
minItems: 2
72+
maxItems: 10
6473
items:
65-
- const: rx
66-
- const: tx
74+
enum:
75+
- rx
76+
- tx
6777

6878
power-domains:
6979
maxItems: 1
@@ -81,6 +91,34 @@ required:
8191

8292
allOf:
8393
- $ref: spi-controller.yaml#
94+
- if:
95+
properties:
96+
compatible:
97+
contains:
98+
enum:
99+
- renesas,r9a08g046-rspi
100+
then:
101+
properties:
102+
clocks:
103+
maxItems: 2
104+
105+
clock-names:
106+
items:
107+
- const: pclk
108+
- const: tclk
109+
110+
dmas:
111+
maxItems: 2
112+
113+
dma-names:
114+
items:
115+
- const: rx
116+
- const: tx
117+
118+
required:
119+
- resets
120+
- reset-names
121+
84122
- if:
85123
properties:
86124
compatible:
@@ -121,6 +159,12 @@ allOf:
121159
resets: false
122160
reset-names: false
123161

162+
dmas:
163+
maxItems: 6
164+
165+
dma-names:
166+
maxItems: 6
167+
124168
unevaluatedProperties: false
125169

126170
examples:

drivers/spi/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ config SPI_AR934X
138138

139139
config SPI_ATCSPI200
140140
tristate "Andes ATCSPI200 SPI controller"
141-
depends on ARCH_ANDES
141+
depends on ARCH_ANDES || COMPILE_TEST
142142
help
143143
SPI driver for Andes ATCSPI200 SPI controller.
144144
ATCSPI200 controller supports DMA and PIO modes. When DMA
@@ -866,7 +866,7 @@ config SPI_PIC32_SQI
866866

867867
config SPI_PL022
868868
tristate "ARM AMBA PL022 SSP controller"
869-
depends on ARM_AMBA
869+
depends on ARM_AMBA || COMPILE_TEST
870870
default y if ARCH_REALVIEW
871871
default y if INTEGRATOR_IMPD1
872872
default y if ARCH_VERSATILE

drivers/spi/spi-amlogic-spisg.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,13 +647,13 @@ static int aml_spisg_clk_init(struct spisg_device *spisg, void __iomem *base)
647647
int ret, i;
648648

649649
spisg->core = devm_clk_get_enabled(dev, "core");
650-
if (IS_ERR_OR_NULL(spisg->core)) {
650+
if (IS_ERR(spisg->core)) {
651651
dev_err(dev, "core clock request failed\n");
652652
return PTR_ERR(spisg->core);
653653
}
654654

655655
spisg->pclk = devm_clk_get_enabled(dev, "pclk");
656-
if (IS_ERR_OR_NULL(spisg->pclk)) {
656+
if (IS_ERR(spisg->pclk)) {
657657
dev_err(dev, "pclk clock request failed\n");
658658
return PTR_ERR(spisg->pclk);
659659
}
@@ -703,7 +703,7 @@ static int aml_spisg_clk_init(struct spisg_device *spisg, void __iomem *base)
703703
}
704704

705705
spisg->sclk = devm_clk_hw_get_clk(dev, &div->hw, NULL);
706-
if (IS_ERR_OR_NULL(spisg->sclk)) {
706+
if (IS_ERR(spisg->sclk)) {
707707
dev_err(dev, "get clock failed\n");
708708
return PTR_ERR(spisg->sclk);
709709
}
@@ -800,7 +800,7 @@ static int aml_spisg_probe(struct platform_device *pdev)
800800
goto out_clk;
801801
}
802802

803-
ret = devm_spi_register_controller(dev, ctlr);
803+
ret = spi_register_controller(ctlr);
804804
if (ret) {
805805
dev_err(&pdev->dev, "spi controller registration failed\n");
806806
goto out_clk;
@@ -823,6 +823,8 @@ static void aml_spisg_remove(struct platform_device *pdev)
823823
{
824824
struct spisg_device *spisg = platform_get_drvdata(pdev);
825825

826+
spi_unregister_controller(spisg->controller);
827+
826828
if (!pm_runtime_suspended(&pdev->dev)) {
827829
pinctrl_pm_select_sleep_state(&spisg->pdev->dev);
828830
clk_disable_unprepare(spisg->core);

drivers/spi/spi-aspeed-smc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ static int aspeed_spi_probe(struct platform_device *pdev)
972972
return -ENOMEM;
973973

974974
aspi = spi_controller_get_devdata(ctlr);
975-
platform_set_drvdata(pdev, aspi);
975+
platform_set_drvdata(pdev, ctlr);
976976
aspi->data = data;
977977
aspi->dev = dev;
978978

@@ -1021,7 +1021,7 @@ static int aspeed_spi_probe(struct platform_device *pdev)
10211021
return ret;
10221022
}
10231023

1024-
ret = devm_spi_register_controller(dev, ctlr);
1024+
ret = spi_register_controller(ctlr);
10251025
if (ret)
10261026
dev_err(&pdev->dev, "spi_register_controller failed\n");
10271027

@@ -1030,7 +1030,10 @@ static int aspeed_spi_probe(struct platform_device *pdev)
10301030

10311031
static void aspeed_spi_remove(struct platform_device *pdev)
10321032
{
1033-
struct aspeed_spi *aspi = platform_get_drvdata(pdev);
1033+
struct spi_controller *ctlr = platform_get_drvdata(pdev);
1034+
struct aspeed_spi *aspi = spi_controller_get_devdata(ctlr);
1035+
1036+
spi_unregister_controller(ctlr);
10341037

10351038
aspeed_spi_enable(aspi, false);
10361039
}

drivers/spi/spi-at91-usart.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ static int at91_usart_spi_probe(struct platform_device *pdev)
556556
spin_lock_init(&aus->lock);
557557
init_completion(&aus->xfer_completion);
558558

559-
ret = devm_spi_register_controller(&pdev->dev, controller);
559+
ret = spi_register_controller(controller);
560560
if (ret)
561561
goto at91_usart_fail_register_controller;
562562

@@ -634,8 +634,14 @@ static void at91_usart_spi_remove(struct platform_device *pdev)
634634
struct spi_controller *ctlr = platform_get_drvdata(pdev);
635635
struct at91_usart_spi *aus = spi_controller_get_devdata(ctlr);
636636

637+
spi_controller_get(ctlr);
638+
639+
spi_unregister_controller(ctlr);
640+
637641
at91_usart_spi_release_dma(ctlr);
638642
clk_disable_unprepare(aus->clk);
643+
644+
spi_controller_put(ctlr);
639645
}
640646

641647
static const struct dev_pm_ops at91_usart_spi_pm_ops = {

drivers/spi/spi-atcspi200.c

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,6 @@ static int atcspi_init_resources(struct platform_device *pdev,
494494
return dev_err_probe(spi->dev, PTR_ERR(spi->regmap),
495495
"Failed to init regmap\n");
496496

497-
spi->clk = devm_clk_get(spi->dev, NULL);
498-
if (IS_ERR(spi->clk))
499-
return dev_err_probe(spi->dev, PTR_ERR(spi->clk),
500-
"Failed to get SPI clock\n");
501-
502497
spi->sclk_rate = ATCSPI_MAX_SPEED_HZ;
503498
return 0;
504499
}
@@ -520,13 +515,10 @@ static int atcspi_configure_dma(struct atcspi_dev *spi)
520515

521516
static int atcspi_enable_clk(struct atcspi_dev *spi)
522517
{
523-
int ret;
524-
525-
ret = clk_prepare_enable(spi->clk);
526-
if (ret)
527-
return dev_err_probe(spi->dev, ret,
528-
"Failed to enable clock\n");
529-
518+
spi->clk = devm_clk_get_enabled(spi->dev, NULL);
519+
if (IS_ERR(spi->clk))
520+
return dev_err_probe(spi->dev, PTR_ERR(spi->clk),
521+
"Failed to get SPI clock\n");
530522
spi->clk_rate = clk_get_rate(spi->clk);
531523
if (!spi->clk_rate)
532524
return dev_err_probe(spi->dev, -EINVAL,
@@ -567,6 +559,8 @@ static int atcspi_probe(struct platform_device *pdev)
567559
spi->dev = &pdev->dev;
568560
dev_set_drvdata(&pdev->dev, host);
569561

562+
mutex_init(&spi->mutex_lock);
563+
570564
ret = atcspi_init_resources(pdev, spi, &mem_res);
571565
if (ret)
572566
goto free_controller;
@@ -579,15 +573,14 @@ static int atcspi_probe(struct platform_device *pdev)
579573

580574
ret = atcspi_setup(spi);
581575
if (ret)
582-
goto disable_clk;
576+
goto free_controller;
583577

584578
ret = devm_spi_register_controller(&pdev->dev, host);
585579
if (ret) {
586580
dev_err_probe(spi->dev, ret,
587581
"Failed to register SPI controller\n");
588-
goto disable_clk;
582+
goto free_controller;
589583
}
590-
591584
spi->use_dma = false;
592585
if (ATCSPI_DMA_SUPPORT) {
593586
ret = atcspi_configure_dma(spi);
@@ -597,14 +590,11 @@ static int atcspi_probe(struct platform_device *pdev)
597590
else
598591
spi->use_dma = true;
599592
}
600-
mutex_init(&spi->mutex_lock);
601593

602594
return 0;
603595

604-
disable_clk:
605-
clk_disable_unprepare(spi->clk);
606-
607596
free_controller:
597+
mutex_destroy(&spi->mutex_lock);
608598
spi_controller_put(host);
609599
return ret;
610600
}
@@ -661,7 +651,6 @@ static struct platform_driver atcspi_driver = {
661651
.probe = atcspi_probe,
662652
.driver = {
663653
.name = "atcspi200",
664-
.owner = THIS_MODULE,
665654
.of_match_table = atcspi_of_match,
666655
.pm = pm_sleep_ptr(&atcspi_pm_ops)
667656
}

drivers/spi/spi-atmel.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
16541654
pm_runtime_set_active(&pdev->dev);
16551655
pm_runtime_enable(&pdev->dev);
16561656

1657-
ret = devm_spi_register_controller(&pdev->dev, host);
1657+
ret = spi_register_controller(host);
16581658
if (ret)
16591659
goto out_free_dma;
16601660

@@ -1688,8 +1688,12 @@ static void atmel_spi_remove(struct platform_device *pdev)
16881688
struct spi_controller *host = platform_get_drvdata(pdev);
16891689
struct atmel_spi *as = spi_controller_get_devdata(host);
16901690

1691+
spi_controller_get(host);
1692+
16911693
pm_runtime_get_sync(&pdev->dev);
16921694

1695+
spi_unregister_controller(host);
1696+
16931697
/* reset the hardware and block queue progress */
16941698
if (as->use_dma) {
16951699
atmel_spi_stop_dma(host);
@@ -1716,6 +1720,8 @@ static void atmel_spi_remove(struct platform_device *pdev)
17161720

17171721
pm_runtime_put_noidle(&pdev->dev);
17181722
pm_runtime_disable(&pdev->dev);
1723+
1724+
spi_controller_put(host);
17191725
}
17201726

17211727
static int atmel_spi_runtime_suspend(struct device *dev)

drivers/spi/spi-axiado.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,6 @@ static int ax_spi_probe(struct platform_device *pdev)
842842

843843
ctlr->bits_per_word_mask = SPI_BPW_MASK(8);
844844

845-
pm_runtime_mark_last_busy(&pdev->dev);
846845
pm_runtime_put_autosuspend(&pdev->dev);
847846

848847
ctlr->mem_ops = &ax_spi_mem_ops;

0 commit comments

Comments
 (0)