Skip to content

Commit 02adc14

Browse files
committed
Merge tag 'spi-fix-v6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A collection of driver specific fixes, most minor apart from the OMAP ones which disable some recent performance optimisations in some non-standard cases where we could start driving the bus incorrectly. The change to the stm32-ospi driver to use the newer reset APIs is a fix for interactions with other IP sharing the same reset line in some SoCs" * tag 'spi-fix-v6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: spi-pci1xxxx: Drop MSI-X usage as unsupported by DMA engine spi: stm32-ospi: clean up on error in probe() spi: stm32-ospi: Make usage of reset_control_acquire/release() API spi: offload: check offload ops existence before disabling the trigger spi: spi-pci1xxxx: Fix error code in probe spi: loongson: Fix build warnings about export.h spi: omap2-mcspi: Disable multi-mode when the previous message kept CS asserted spi: omap2-mcspi: Disable multi mode when CS should be kept asserted after message
2 parents 601dddb + 9f0ad43 commit 02adc14

File tree

5 files changed

+41
-20
lines changed

5 files changed

+41
-20
lines changed

drivers/spi/spi-loongson-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/clk.h>
66
#include <linux/delay.h>
77
#include <linux/err.h>
8+
#include <linux/export.h>
89
#include <linux/init.h>
910
#include <linux/interrupt.h>
1011
#include <linux/io.h>

drivers/spi/spi-offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ int spi_offload_trigger_enable(struct spi_offload *offload,
297297
if (trigger->ops->enable) {
298298
ret = trigger->ops->enable(trigger, config);
299299
if (ret) {
300-
if (offload->ops->trigger_disable)
300+
if (offload->ops && offload->ops->trigger_disable)
301301
offload->ops->trigger_disable(offload);
302302
return ret;
303303
}

drivers/spi/spi-omap2-mcspi.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ struct omap2_mcspi {
134134
size_t max_xfer_len;
135135
u32 ref_clk_hz;
136136
bool use_multi_mode;
137+
bool last_msg_kept_cs;
137138
};
138139

139140
struct omap2_mcspi_cs {
@@ -1269,6 +1270,10 @@ static int omap2_mcspi_prepare_message(struct spi_controller *ctlr,
12691270
* multi-mode is applicable.
12701271
*/
12711272
mcspi->use_multi_mode = true;
1273+
1274+
if (mcspi->last_msg_kept_cs)
1275+
mcspi->use_multi_mode = false;
1276+
12721277
list_for_each_entry(tr, &msg->transfers, transfer_list) {
12731278
if (!tr->bits_per_word)
12741279
bits_per_word = msg->spi->bits_per_word;
@@ -1287,18 +1292,19 @@ static int omap2_mcspi_prepare_message(struct spi_controller *ctlr,
12871292
mcspi->use_multi_mode = false;
12881293
}
12891294

1290-
/* Check if transfer asks to change the CS status after the transfer */
1291-
if (!tr->cs_change)
1292-
mcspi->use_multi_mode = false;
1293-
1294-
/*
1295-
* If at least one message is not compatible, switch back to single mode
1296-
*
1297-
* The bits_per_word of certain transfer can be different, but it will have no
1298-
* impact on the signal itself.
1299-
*/
1300-
if (!mcspi->use_multi_mode)
1301-
break;
1295+
if (list_is_last(&tr->transfer_list, &msg->transfers)) {
1296+
/* Check if transfer asks to keep the CS status after the whole message */
1297+
if (tr->cs_change) {
1298+
mcspi->use_multi_mode = false;
1299+
mcspi->last_msg_kept_cs = true;
1300+
} else {
1301+
mcspi->last_msg_kept_cs = false;
1302+
}
1303+
} else {
1304+
/* Check if transfer asks to change the CS status after the transfer */
1305+
if (!tr->cs_change)
1306+
mcspi->use_multi_mode = false;
1307+
}
13021308
}
13031309

13041310
omap2_mcspi_set_mode(ctlr);

drivers/spi/spi-pci1xxxx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,10 +762,10 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id *
762762
return -EINVAL;
763763

764764
num_vector = pci_alloc_irq_vectors(pdev, 1, hw_inst_cnt,
765-
PCI_IRQ_ALL_TYPES);
765+
PCI_IRQ_INTX | PCI_IRQ_MSI);
766766
if (num_vector < 0) {
767767
dev_err(&pdev->dev, "Error allocating MSI vectors\n");
768-
return ret;
768+
return num_vector;
769769
}
770770

771771
init_completion(&spi_sub_ptr->spi_xfer_done);

drivers/spi/spi-stm32-ospi.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ static int stm32_ospi_get_resources(struct platform_device *pdev)
804804
return ret;
805805
}
806806

807-
ospi->rstc = devm_reset_control_array_get_exclusive(dev);
807+
ospi->rstc = devm_reset_control_array_get_exclusive_released(dev);
808808
if (IS_ERR(ospi->rstc))
809809
return dev_err_probe(dev, PTR_ERR(ospi->rstc),
810810
"Can't get reset\n");
@@ -936,12 +936,16 @@ static int stm32_ospi_probe(struct platform_device *pdev)
936936
if (ret < 0)
937937
goto err_pm_enable;
938938

939-
if (ospi->rstc) {
940-
reset_control_assert(ospi->rstc);
941-
udelay(2);
942-
reset_control_deassert(ospi->rstc);
939+
ret = reset_control_acquire(ospi->rstc);
940+
if (ret) {
941+
dev_err_probe(dev, ret, "Can not acquire reset %d\n", ret);
942+
goto err_pm_resume;
943943
}
944944

945+
reset_control_assert(ospi->rstc);
946+
udelay(2);
947+
reset_control_deassert(ospi->rstc);
948+
945949
ret = spi_register_controller(ctrl);
946950
if (ret) {
947951
/* Disable ospi */
@@ -987,6 +991,8 @@ static void stm32_ospi_remove(struct platform_device *pdev)
987991
if (ospi->dma_chrx)
988992
dma_release_channel(ospi->dma_chrx);
989993

994+
reset_control_release(ospi->rstc);
995+
990996
pm_runtime_put_sync_suspend(ospi->dev);
991997
pm_runtime_force_suspend(ospi->dev);
992998
}
@@ -997,6 +1003,8 @@ static int __maybe_unused stm32_ospi_suspend(struct device *dev)
9971003

9981004
pinctrl_pm_select_sleep_state(dev);
9991005

1006+
reset_control_release(ospi->rstc);
1007+
10001008
return pm_runtime_force_suspend(ospi->dev);
10011009
}
10021010

@@ -1016,6 +1024,12 @@ static int __maybe_unused stm32_ospi_resume(struct device *dev)
10161024
if (ret < 0)
10171025
return ret;
10181026

1027+
ret = reset_control_acquire(ospi->rstc);
1028+
if (ret) {
1029+
dev_err(dev, "Can not acquire reset\n");
1030+
return ret;
1031+
}
1032+
10191033
writel_relaxed(ospi->cr_reg, regs_base + OSPI_CR);
10201034
writel_relaxed(ospi->dcr_reg, regs_base + OSPI_DCR1);
10211035
pm_runtime_mark_last_busy(ospi->dev);

0 commit comments

Comments
 (0)