mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
spi: rename SPI_CS_CNT_MAX => SPI_DEVICE_CS_CNT_MAX
Rename SPI_CS_CNT_MAX to SPI_DEVICE_CS_CNT_MAX to make it more obvious that this is the max number of CS per device supported, not per controller. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Link: https://patch.msgid.link/20250915183725.219473-8-jonas.gorski@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
08fda410ba
commit
e336ab509b
|
|
@ -33,7 +33,7 @@
|
|||
#define CQSPI_NAME "cadence-qspi"
|
||||
#define CQSPI_MAX_CHIPSELECT 4
|
||||
|
||||
static_assert(CQSPI_MAX_CHIPSELECT <= SPI_CS_CNT_MAX);
|
||||
static_assert(CQSPI_MAX_CHIPSELECT <= SPI_DEVICE_CS_CNT_MAX);
|
||||
|
||||
/* Quirks */
|
||||
#define CQSPI_NEEDS_WR_DELAY BIT(0)
|
||||
|
|
|
|||
|
|
@ -670,9 +670,9 @@ static int __spi_add_device(struct spi_device *spi)
|
|||
int status, idx;
|
||||
u8 cs;
|
||||
|
||||
if (spi->num_chipselect > SPI_CS_CNT_MAX) {
|
||||
if (spi->num_chipselect > SPI_DEVICE_CS_CNT_MAX) {
|
||||
dev_err(dev, "num_cs %d > max %d\n", spi->num_chipselect,
|
||||
SPI_CS_CNT_MAX);
|
||||
SPI_DEVICE_CS_CNT_MAX);
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
|
||||
|
|
@ -699,7 +699,7 @@ static int __spi_add_device(struct spi_device *spi)
|
|||
}
|
||||
|
||||
/* Initialize unused logical CS as invalid */
|
||||
for (idx = spi->num_chipselect; idx < SPI_CS_CNT_MAX; idx++)
|
||||
for (idx = spi->num_chipselect; idx < SPI_DEVICE_CS_CNT_MAX; idx++)
|
||||
spi_set_chipselect(spi, idx, SPI_INVALID_CS);
|
||||
|
||||
/* Set the bus ID string */
|
||||
|
|
@ -1076,7 +1076,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
|
|||
trace_spi_set_cs(spi, activate);
|
||||
|
||||
spi->controller->last_cs_index_mask = spi->cs_index_mask;
|
||||
for (idx = 0; idx < SPI_CS_CNT_MAX; idx++) {
|
||||
for (idx = 0; idx < SPI_DEVICE_CS_CNT_MAX; idx++) {
|
||||
if (enable && idx < spi->num_chipselect)
|
||||
spi->controller->last_cs[idx] = spi_get_chipselect(spi, 0);
|
||||
else
|
||||
|
|
@ -2354,7 +2354,7 @@ static void of_spi_parse_dt_cs_delay(struct device_node *nc,
|
|||
static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
|
||||
struct device_node *nc)
|
||||
{
|
||||
u32 value, cs[SPI_CS_CNT_MAX];
|
||||
u32 value, cs[SPI_DEVICE_CS_CNT_MAX];
|
||||
int rc, idx;
|
||||
|
||||
/* Mode (clock phase/polarity/etc.) */
|
||||
|
|
@ -2429,7 +2429,7 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
|
|||
|
||||
/* Device address */
|
||||
rc = of_property_read_variable_u32_array(nc, "reg", &cs[0], 1,
|
||||
SPI_CS_CNT_MAX);
|
||||
SPI_DEVICE_CS_CNT_MAX);
|
||||
if (rc < 0) {
|
||||
dev_err(&ctlr->dev, "%pOF has no valid 'reg' property (%d)\n",
|
||||
nc, rc);
|
||||
|
|
@ -3313,7 +3313,7 @@ int spi_register_controller(struct spi_controller *ctlr)
|
|||
}
|
||||
|
||||
/* Setting last_cs to SPI_INVALID_CS means no chip selected */
|
||||
for (idx = 0; idx < SPI_CS_CNT_MAX; idx++)
|
||||
for (idx = 0; idx < SPI_DEVICE_CS_CNT_MAX; idx++)
|
||||
ctlr->last_cs[idx] = SPI_INVALID_CS;
|
||||
|
||||
status = device_add(&ctlr->dev);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <uapi/linux/spi/spi.h>
|
||||
|
||||
/* Max no. of CS supported per spi device */
|
||||
#define SPI_CS_CNT_MAX 4
|
||||
#define SPI_DEVICE_CS_CNT_MAX 4
|
||||
|
||||
struct dma_chan;
|
||||
struct software_node;
|
||||
|
|
@ -229,7 +229,7 @@ struct spi_device {
|
|||
struct spi_delay cs_hold;
|
||||
struct spi_delay cs_inactive;
|
||||
|
||||
u8 chip_select[SPI_CS_CNT_MAX];
|
||||
u8 chip_select[SPI_DEVICE_CS_CNT_MAX];
|
||||
u8 num_chipselect;
|
||||
|
||||
/*
|
||||
|
|
@ -238,9 +238,9 @@ struct spi_device {
|
|||
* multiple chip selects & memories are connected in parallel
|
||||
* then more than one bit need to be set in cs_index_mask.
|
||||
*/
|
||||
u32 cs_index_mask : SPI_CS_CNT_MAX;
|
||||
u32 cs_index_mask : SPI_DEVICE_CS_CNT_MAX;
|
||||
|
||||
struct gpio_desc *cs_gpiod[SPI_CS_CNT_MAX]; /* Chip select gpio desc */
|
||||
struct gpio_desc *cs_gpiod[SPI_DEVICE_CS_CNT_MAX]; /* Chip select gpio desc */
|
||||
|
||||
/*
|
||||
* Likely need more hooks for more protocol options affecting how
|
||||
|
|
@ -721,8 +721,8 @@ struct spi_controller {
|
|||
bool auto_runtime_pm;
|
||||
bool fallback;
|
||||
bool last_cs_mode_high;
|
||||
s8 last_cs[SPI_CS_CNT_MAX];
|
||||
u32 last_cs_index_mask : SPI_CS_CNT_MAX;
|
||||
s8 last_cs[SPI_DEVICE_CS_CNT_MAX];
|
||||
u32 last_cs_index_mask : SPI_DEVICE_CS_CNT_MAX;
|
||||
struct completion xfer_completion;
|
||||
size_t max_dma_len;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user