spi.c (94817983fb2ccd1869ed0c5a763317a45283a272) spi.c (6e80133abeb09721ec4601de5b1e68be67135309)
1// SPDX-License-Identifier: GPL-2.0-or-later
2// SPI init/core code
3//
4// Copyright (C) 2005 David Brownell
5// Copyright (C) 2008 Secret Lab Technologies Ltd.
6
7#include <linux/kernel.h>
8#include <linux/device.h>

--- 590 unchanged lines hidden (view full) ---

599 struct acpi_device *adev = ACPI_COMPANION(&spi->dev);
600
601 if (adev) {
602 dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev));
603 return;
604 }
605
606 dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->controller->dev),
1// SPDX-License-Identifier: GPL-2.0-or-later
2// SPI init/core code
3//
4// Copyright (C) 2005 David Brownell
5// Copyright (C) 2008 Secret Lab Technologies Ltd.
6
7#include <linux/kernel.h>
8#include <linux/device.h>

--- 590 unchanged lines hidden (view full) ---

599 struct acpi_device *adev = ACPI_COMPANION(&spi->dev);
600
601 if (adev) {
602 dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev));
603 return;
604 }
605
606 dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->controller->dev),
607 spi->chip_select);
607 spi_get_chipselect(spi, 0));
608}
609
610static int spi_dev_check(struct device *dev, void *data)
611{
612 struct spi_device *spi = to_spi_device(dev);
613 struct spi_device *new_spi = data;
614
615 if (spi->controller == new_spi->controller &&
608}
609
610static int spi_dev_check(struct device *dev, void *data)
611{
612 struct spi_device *spi = to_spi_device(dev);
613 struct spi_device *new_spi = data;
614
615 if (spi->controller == new_spi->controller &&
616 spi->chip_select == new_spi->chip_select)
616 spi_get_chipselect(spi, 0) == spi_get_chipselect(new_spi, 0))
617 return -EBUSY;
618 return 0;
619}
620
621static void spi_cleanup(struct spi_device *spi)
622{
623 if (spi->controller->cleanup)
624 spi->controller->cleanup(spi);

--- 8 unchanged lines hidden (view full) ---

633 /*
634 * We need to make sure there's no other device with this
635 * chipselect **BEFORE** we call setup(), else we'll trash
636 * its configuration.
637 */
638 status = bus_for_each_dev(&spi_bus_type, NULL, spi, spi_dev_check);
639 if (status) {
640 dev_err(dev, "chipselect %d already in use\n",
617 return -EBUSY;
618 return 0;
619}
620
621static void spi_cleanup(struct spi_device *spi)
622{
623 if (spi->controller->cleanup)
624 spi->controller->cleanup(spi);

--- 8 unchanged lines hidden (view full) ---

633 /*
634 * We need to make sure there's no other device with this
635 * chipselect **BEFORE** we call setup(), else we'll trash
636 * its configuration.
637 */
638 status = bus_for_each_dev(&spi_bus_type, NULL, spi, spi_dev_check);
639 if (status) {
640 dev_err(dev, "chipselect %d already in use\n",
641 spi->chip_select);
641 spi_get_chipselect(spi, 0));
642 return status;
643 }
644
645 /* Controller may unregister concurrently */
646 if (IS_ENABLED(CONFIG_SPI_DYNAMIC) &&
647 !device_is_registered(&ctlr->dev)) {
648 return -ENODEV;
649 }
650
651 if (ctlr->cs_gpiods)
642 return status;
643 }
644
645 /* Controller may unregister concurrently */
646 if (IS_ENABLED(CONFIG_SPI_DYNAMIC) &&
647 !device_is_registered(&ctlr->dev)) {
648 return -ENODEV;
649 }
650
651 if (ctlr->cs_gpiods)
652 spi->cs_gpiod = ctlr->cs_gpiods[spi->chip_select];
652 spi_set_csgpiod(spi, 0, ctlr->cs_gpiods[spi_get_chipselect(spi, 0)]);
653
654 /*
655 * Drivers may modify this initial i/o setup, but will
656 * normally rely on the device being setup. Devices
657 * using SPI_CS_HIGH can't coexist well otherwise...
658 */
659 status = spi_setup(spi);
660 if (status < 0) {

--- 26 unchanged lines hidden (view full) ---

687 */
688int spi_add_device(struct spi_device *spi)
689{
690 struct spi_controller *ctlr = spi->controller;
691 struct device *dev = ctlr->dev.parent;
692 int status;
693
694 /* Chipselects are numbered 0..max; validate. */
653
654 /*
655 * Drivers may modify this initial i/o setup, but will
656 * normally rely on the device being setup. Devices
657 * using SPI_CS_HIGH can't coexist well otherwise...
658 */
659 status = spi_setup(spi);
660 if (status < 0) {

--- 26 unchanged lines hidden (view full) ---

687 */
688int spi_add_device(struct spi_device *spi)
689{
690 struct spi_controller *ctlr = spi->controller;
691 struct device *dev = ctlr->dev.parent;
692 int status;
693
694 /* Chipselects are numbered 0..max; validate. */
695 if (spi->chip_select >= ctlr->num_chipselect) {
696 dev_err(dev, "cs%d >= max %d\n", spi->chip_select,
695 if (spi_get_chipselect(spi, 0) >= ctlr->num_chipselect) {
696 dev_err(dev, "cs%d >= max %d\n", spi_get_chipselect(spi, 0),
697 ctlr->num_chipselect);
698 return -EINVAL;
699 }
700
701 /* Set the bus ID string */
702 spi_dev_set_name(spi);
703
704 mutex_lock(&ctlr->add_lock);

--- 4 unchanged lines hidden (view full) ---

709EXPORT_SYMBOL_GPL(spi_add_device);
710
711static int spi_add_device_locked(struct spi_device *spi)
712{
713 struct spi_controller *ctlr = spi->controller;
714 struct device *dev = ctlr->dev.parent;
715
716 /* Chipselects are numbered 0..max; validate. */
697 ctlr->num_chipselect);
698 return -EINVAL;
699 }
700
701 /* Set the bus ID string */
702 spi_dev_set_name(spi);
703
704 mutex_lock(&ctlr->add_lock);

--- 4 unchanged lines hidden (view full) ---

709EXPORT_SYMBOL_GPL(spi_add_device);
710
711static int spi_add_device_locked(struct spi_device *spi)
712{
713 struct spi_controller *ctlr = spi->controller;
714 struct device *dev = ctlr->dev.parent;
715
716 /* Chipselects are numbered 0..max; validate. */
717 if (spi->chip_select >= ctlr->num_chipselect) {
718 dev_err(dev, "cs%d >= max %d\n", spi->chip_select,
717 if (spi_get_chipselect(spi, 0) >= ctlr->num_chipselect) {
718 dev_err(dev, "cs%d >= max %d\n", spi_get_chipselect(spi, 0),
719 ctlr->num_chipselect);
720 return -EINVAL;
721 }
722
723 /* Set the bus ID string */
724 spi_dev_set_name(spi);
725
726 WARN_ON(!mutex_is_locked(&ctlr->add_lock));

--- 29 unchanged lines hidden (view full) ---

756 */
757
758 proxy = spi_alloc_device(ctlr);
759 if (!proxy)
760 return NULL;
761
762 WARN_ON(strlen(chip->modalias) >= sizeof(proxy->modalias));
763
719 ctlr->num_chipselect);
720 return -EINVAL;
721 }
722
723 /* Set the bus ID string */
724 spi_dev_set_name(spi);
725
726 WARN_ON(!mutex_is_locked(&ctlr->add_lock));

--- 29 unchanged lines hidden (view full) ---

756 */
757
758 proxy = spi_alloc_device(ctlr);
759 if (!proxy)
760 return NULL;
761
762 WARN_ON(strlen(chip->modalias) >= sizeof(proxy->modalias));
763
764 proxy->chip_select = chip->chip_select;
764 spi_set_chipselect(proxy, 0, chip->chip_select);
765 proxy->max_speed_hz = chip->max_speed_hz;
766 proxy->mode = chip->mode;
767 proxy->irq = chip->irq;
768 strscpy(proxy->modalias, chip->modalias, sizeof(proxy->modalias));
769 proxy->dev.platform_data = (void *) chip->platform_data;
770 proxy->controller_data = chip->controller_data;
771 proxy->controller_state = NULL;
772

--- 192 unchanged lines hidden (view full) ---

965static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
966{
967 bool activate = enable;
968
969 /*
970 * Avoid calling into the driver (or doing delays) if the chip select
971 * isn't actually changing from the last time this was called.
972 */
765 proxy->max_speed_hz = chip->max_speed_hz;
766 proxy->mode = chip->mode;
767 proxy->irq = chip->irq;
768 strscpy(proxy->modalias, chip->modalias, sizeof(proxy->modalias));
769 proxy->dev.platform_data = (void *) chip->platform_data;
770 proxy->controller_data = chip->controller_data;
771 proxy->controller_state = NULL;
772

--- 192 unchanged lines hidden (view full) ---

965static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
966{
967 bool activate = enable;
968
969 /*
970 * Avoid calling into the driver (or doing delays) if the chip select
971 * isn't actually changing from the last time this was called.
972 */
973 if (!force && ((enable && spi->controller->last_cs == spi->chip_select) ||
974 (!enable && spi->controller->last_cs != spi->chip_select)) &&
973 if (!force && ((enable && spi->controller->last_cs == spi_get_chipselect(spi, 0)) ||
974 (!enable && spi->controller->last_cs != spi_get_chipselect(spi, 0))) &&
975 (spi->controller->last_cs_mode_high == (spi->mode & SPI_CS_HIGH)))
976 return;
977
978 trace_spi_set_cs(spi, activate);
979
975 (spi->controller->last_cs_mode_high == (spi->mode & SPI_CS_HIGH)))
976 return;
977
978 trace_spi_set_cs(spi, activate);
979
980 spi->controller->last_cs = enable ? spi->chip_select : -1;
980 spi->controller->last_cs = enable ? spi_get_chipselect(spi, 0) : -1;
981 spi->controller->last_cs_mode_high = spi->mode & SPI_CS_HIGH;
982
981 spi->controller->last_cs_mode_high = spi->mode & SPI_CS_HIGH;
982
983 if ((spi->cs_gpiod || !spi->controller->set_cs_timing) && !activate) {
983 if ((spi_get_csgpiod(spi, 0) || !spi->controller->set_cs_timing) && !activate)
984 spi_delay_exec(&spi->cs_hold, NULL);
984 spi_delay_exec(&spi->cs_hold, NULL);
985 }
986
987 if (spi->mode & SPI_CS_HIGH)
988 enable = !enable;
989
985
986 if (spi->mode & SPI_CS_HIGH)
987 enable = !enable;
988
990 if (spi->cs_gpiod) {
989 if (spi_get_csgpiod(spi, 0)) {
991 if (!(spi->mode & SPI_NO_CS)) {
992 /*
993 * Historically ACPI has no means of the GPIO polarity and
994 * thus the SPISerialBus() resource defines it on the per-chip
995 * basis. In order to avoid a chain of negations, the GPIO
996 * polarity is considered being Active High. Even for the cases
997 * when _DSD() is involved (in the updated versions of ACPI)
998 * the GPIO CS polarity must be defined Active High to avoid
999 * ambiguity. That's why we use enable, that takes SPI_CS_HIGH
1000 * into account.
1001 */
1002 if (has_acpi_companion(&spi->dev))
990 if (!(spi->mode & SPI_NO_CS)) {
991 /*
992 * Historically ACPI has no means of the GPIO polarity and
993 * thus the SPISerialBus() resource defines it on the per-chip
994 * basis. In order to avoid a chain of negations, the GPIO
995 * polarity is considered being Active High. Even for the cases
996 * when _DSD() is involved (in the updated versions of ACPI)
997 * the GPIO CS polarity must be defined Active High to avoid
998 * ambiguity. That's why we use enable, that takes SPI_CS_HIGH
999 * into account.
1000 */
1001 if (has_acpi_companion(&spi->dev))
1003 gpiod_set_value_cansleep(spi->cs_gpiod, !enable);
1002 gpiod_set_value_cansleep(spi_get_csgpiod(spi, 0), !enable);
1004 else
1005 /* Polarity handled by GPIO library */
1003 else
1004 /* Polarity handled by GPIO library */
1006 gpiod_set_value_cansleep(spi->cs_gpiod, activate);
1005 gpiod_set_value_cansleep(spi_get_csgpiod(spi, 0), activate);
1007 }
1008 /* Some SPI masters need both GPIO CS & slave_select */
1009 if ((spi->controller->flags & SPI_MASTER_GPIO_SS) &&
1010 spi->controller->set_cs)
1011 spi->controller->set_cs(spi, !enable);
1012 } else if (spi->controller->set_cs) {
1013 spi->controller->set_cs(spi, !enable);
1014 }
1015
1006 }
1007 /* Some SPI masters need both GPIO CS & slave_select */
1008 if ((spi->controller->flags & SPI_MASTER_GPIO_SS) &&
1009 spi->controller->set_cs)
1010 spi->controller->set_cs(spi, !enable);
1011 } else if (spi->controller->set_cs) {
1012 spi->controller->set_cs(spi, !enable);
1013 }
1014
1016 if (spi->cs_gpiod || !spi->controller->set_cs_timing) {
1015 if (spi_get_csgpiod(spi, 0) || !spi->controller->set_cs_timing) {
1017 if (activate)
1018 spi_delay_exec(&spi->cs_setup, NULL);
1019 else
1020 spi_delay_exec(&spi->cs_inactive, NULL);
1021 }
1022}
1023
1024#ifdef CONFIG_HAS_DMA

--- 454 unchanged lines hidden (view full) ---

1479 if (ret) {
1480 dev_err_once(&msg->spi->dev,
1481 "Use of unsupported delay unit %i, using default of %luus\n",
1482 unit, default_delay_ns / NSEC_PER_USEC);
1483 _spi_transfer_delay_ns(default_delay_ns);
1484 }
1485}
1486
1016 if (activate)
1017 spi_delay_exec(&spi->cs_setup, NULL);
1018 else
1019 spi_delay_exec(&spi->cs_inactive, NULL);
1020 }
1021}
1022
1023#ifdef CONFIG_HAS_DMA

--- 454 unchanged lines hidden (view full) ---

1478 if (ret) {
1479 dev_err_once(&msg->spi->dev,
1480 "Use of unsupported delay unit %i, using default of %luus\n",
1481 unit, default_delay_ns / NSEC_PER_USEC);
1482 _spi_transfer_delay_ns(default_delay_ns);
1483 }
1484}
1485
1486void spi_transfer_cs_change_delay_exec(struct spi_message *msg,
1487 struct spi_transfer *xfer)
1488{
1489 _spi_transfer_cs_change_delay(msg, xfer);
1490}
1491EXPORT_SYMBOL_GPL(spi_transfer_cs_change_delay_exec);
1492
1487/*
1488 * spi_transfer_one_message - Default implementation of transfer_one_message()
1489 *
1490 * This is a standard implementation of transfer_one_message() for
1491 * drivers which implement a transfer_one() operation. It provides
1492 * standard handling of delays and chip select management.
1493 */
1494static int spi_transfer_one_message(struct spi_controller *ctlr,

--- 720 unchanged lines hidden (view full) ---

2215{
2216 if (ctlr->transfer == spi_queued_transfer)
2217 __spi_pump_messages(ctlr, false);
2218}
2219
2220/*-------------------------------------------------------------------------*/
2221
2222#if defined(CONFIG_OF)
1493/*
1494 * spi_transfer_one_message - Default implementation of transfer_one_message()
1495 *
1496 * This is a standard implementation of transfer_one_message() for
1497 * drivers which implement a transfer_one() operation. It provides
1498 * standard handling of delays and chip select management.
1499 */
1500static int spi_transfer_one_message(struct spi_controller *ctlr,

--- 720 unchanged lines hidden (view full) ---

2221{
2222 if (ctlr->transfer == spi_queued_transfer)
2223 __spi_pump_messages(ctlr, false);
2224}
2225
2226/*-------------------------------------------------------------------------*/
2227
2228#if defined(CONFIG_OF)
2229static void of_spi_parse_dt_cs_delay(struct device_node *nc,
2230 struct spi_delay *delay, const char *prop)
2231{
2232 u32 value;
2233
2234 if (!of_property_read_u32(nc, prop, &value)) {
2235 if (value > U16_MAX) {
2236 delay->value = DIV_ROUND_UP(value, 1000);
2237 delay->unit = SPI_DELAY_UNIT_USECS;
2238 } else {
2239 delay->value = value;
2240 delay->unit = SPI_DELAY_UNIT_NSECS;
2241 }
2242 }
2243}
2244
2223static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
2224 struct device_node *nc)
2225{
2226 u32 value;
2245static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
2246 struct device_node *nc)
2247{
2248 u32 value;
2227 u16 cs_setup;
2228 int rc;
2229
2230 /* Mode (clock phase/polarity/etc.) */
2231 if (of_property_read_bool(nc, "spi-cpha"))
2232 spi->mode |= SPI_CPHA;
2233 if (of_property_read_bool(nc, "spi-cpol"))
2234 spi->mode |= SPI_CPOL;
2235 if (of_property_read_bool(nc, "spi-3wire"))

--- 63 unchanged lines hidden (view full) ---

2299
2300 /* Device address */
2301 rc = of_property_read_u32(nc, "reg", &value);
2302 if (rc) {
2303 dev_err(&ctlr->dev, "%pOF has no valid 'reg' property (%d)\n",
2304 nc, rc);
2305 return rc;
2306 }
2249 int rc;
2250
2251 /* Mode (clock phase/polarity/etc.) */
2252 if (of_property_read_bool(nc, "spi-cpha"))
2253 spi->mode |= SPI_CPHA;
2254 if (of_property_read_bool(nc, "spi-cpol"))
2255 spi->mode |= SPI_CPOL;
2256 if (of_property_read_bool(nc, "spi-3wire"))

--- 63 unchanged lines hidden (view full) ---

2320
2321 /* Device address */
2322 rc = of_property_read_u32(nc, "reg", &value);
2323 if (rc) {
2324 dev_err(&ctlr->dev, "%pOF has no valid 'reg' property (%d)\n",
2325 nc, rc);
2326 return rc;
2327 }
2307 spi->chip_select = value;
2328 spi_set_chipselect(spi, 0, value);
2308
2309 /* Device speed */
2310 if (!of_property_read_u32(nc, "spi-max-frequency", &value))
2311 spi->max_speed_hz = value;
2312
2329
2330 /* Device speed */
2331 if (!of_property_read_u32(nc, "spi-max-frequency", &value))
2332 spi->max_speed_hz = value;
2333
2313 if (!of_property_read_u16(nc, "spi-cs-setup-delay-ns", &cs_setup)) {
2314 spi->cs_setup.value = cs_setup;
2315 spi->cs_setup.unit = SPI_DELAY_UNIT_NSECS;
2316 }
2334 /* Device CS delays */
2335 of_spi_parse_dt_cs_delay(nc, &spi->cs_setup, "spi-cs-setup-delay-ns");
2336 of_spi_parse_dt_cs_delay(nc, &spi->cs_hold, "spi-cs-hold-delay-ns");
2337 of_spi_parse_dt_cs_delay(nc, &spi->cs_inactive, "spi-cs-inactive-delay-ns");
2317
2318 return 0;
2319}
2320
2321static struct spi_device *
2322of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc)
2323{
2324 struct spi_device *spi;

--- 93 unchanged lines hidden (view full) ---

2418 if (!ancillary) {
2419 rc = -ENOMEM;
2420 goto err_out;
2421 }
2422
2423 strscpy(ancillary->modalias, "dummy", sizeof(ancillary->modalias));
2424
2425 /* Use provided chip-select for ancillary device */
2338
2339 return 0;
2340}
2341
2342static struct spi_device *
2343of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc)
2344{
2345 struct spi_device *spi;

--- 93 unchanged lines hidden (view full) ---

2439 if (!ancillary) {
2440 rc = -ENOMEM;
2441 goto err_out;
2442 }
2443
2444 strscpy(ancillary->modalias, "dummy", sizeof(ancillary->modalias));
2445
2446 /* Use provided chip-select for ancillary device */
2426 ancillary->chip_select = chip_select;
2447 spi_set_chipselect(ancillary, 0, chip_select);
2427
2428 /* Take over SPI mode/speed from SPI main device */
2429 ancillary->max_speed_hz = spi->max_speed_hz;
2430 ancillary->mode = spi->mode;
2431
2432 /* Register the new device */
2433 rc = spi_add_device_locked(ancillary);
2434 if (rc) {

--- 230 unchanged lines hidden (view full) ---

2665 return ERR_PTR(-ENOMEM);
2666 }
2667
2668 ACPI_COMPANION_SET(&spi->dev, adev);
2669 spi->max_speed_hz = lookup.max_speed_hz;
2670 spi->mode |= lookup.mode;
2671 spi->irq = lookup.irq;
2672 spi->bits_per_word = lookup.bits_per_word;
2448
2449 /* Take over SPI mode/speed from SPI main device */
2450 ancillary->max_speed_hz = spi->max_speed_hz;
2451 ancillary->mode = spi->mode;
2452
2453 /* Register the new device */
2454 rc = spi_add_device_locked(ancillary);
2455 if (rc) {

--- 230 unchanged lines hidden (view full) ---

2686 return ERR_PTR(-ENOMEM);
2687 }
2688
2689 ACPI_COMPANION_SET(&spi->dev, adev);
2690 spi->max_speed_hz = lookup.max_speed_hz;
2691 spi->mode |= lookup.mode;
2692 spi->irq = lookup.irq;
2693 spi->bits_per_word = lookup.bits_per_word;
2673 spi->chip_select = lookup.chip_select;
2694 spi_set_chipselect(spi, 0, lookup.chip_select);
2674
2675 return spi;
2676}
2677EXPORT_SYMBOL_GPL(acpi_spi_device_alloc);
2678
2679static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
2680 struct acpi_device *adev)
2681{

--- 945 unchanged lines hidden (view full) ---

3627 *
3628 * Return: zero on success, else a negative error code.
3629 */
3630static int spi_set_cs_timing(struct spi_device *spi)
3631{
3632 struct device *parent = spi->controller->dev.parent;
3633 int status = 0;
3634
2695
2696 return spi;
2697}
2698EXPORT_SYMBOL_GPL(acpi_spi_device_alloc);
2699
2700static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
2701 struct acpi_device *adev)
2702{

--- 945 unchanged lines hidden (view full) ---

3648 *
3649 * Return: zero on success, else a negative error code.
3650 */
3651static int spi_set_cs_timing(struct spi_device *spi)
3652{
3653 struct device *parent = spi->controller->dev.parent;
3654 int status = 0;
3655
3635 if (spi->controller->set_cs_timing && !spi->cs_gpiod) {
3656 if (spi->controller->set_cs_timing && !spi_get_csgpiod(spi, 0)) {
3636 if (spi->controller->auto_runtime_pm) {
3637 status = pm_runtime_get_sync(parent);
3638 if (status < 0) {
3639 pm_runtime_put_noidle(parent);
3640 dev_err(&spi->controller->dev, "Failed to power device: %d\n",
3641 status);
3642 return status;
3643 }

--- 188 unchanged lines hidden (view full) ---

3832 /*
3833 * If an SPI controller does not support toggling the CS line on each
3834 * transfer (indicated by the SPI_CS_WORD flag) or we are using a GPIO
3835 * for the CS line, we can emulate the CS-per-word hardware function by
3836 * splitting transfers into one-word transfers and ensuring that
3837 * cs_change is set for each transfer.
3838 */
3839 if ((spi->mode & SPI_CS_WORD) && (!(ctlr->mode_bits & SPI_CS_WORD) ||
3657 if (spi->controller->auto_runtime_pm) {
3658 status = pm_runtime_get_sync(parent);
3659 if (status < 0) {
3660 pm_runtime_put_noidle(parent);
3661 dev_err(&spi->controller->dev, "Failed to power device: %d\n",
3662 status);
3663 return status;
3664 }

--- 188 unchanged lines hidden (view full) ---

3853 /*
3854 * If an SPI controller does not support toggling the CS line on each
3855 * transfer (indicated by the SPI_CS_WORD flag) or we are using a GPIO
3856 * for the CS line, we can emulate the CS-per-word hardware function by
3857 * splitting transfers into one-word transfers and ensuring that
3858 * cs_change is set for each transfer.
3859 */
3860 if ((spi->mode & SPI_CS_WORD) && (!(ctlr->mode_bits & SPI_CS_WORD) ||
3840 spi->cs_gpiod)) {
3861 spi_get_csgpiod(spi, 0))) {
3841 size_t maxsize;
3842 int ret;
3843
3844 maxsize = (spi->bits_per_word + 7) / 8;
3845
3846 /* spi_split_transfers_maxsize() requires message->spi */
3847 message->spi = spi;
3848

--- 748 unchanged lines hidden ---
3862 size_t maxsize;
3863 int ret;
3864
3865 maxsize = (spi->bits_per_word + 7) / 8;
3866
3867 /* spi_split_transfers_maxsize() requires message->spi */
3868 message->spi = spi;
3869

--- 748 unchanged lines hidden ---