Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Add support for GPIO based CS

Merge series from Prajna Rajendra Kumar <prajna.rajendrakumar@microchip.com>:

The Microchip PolarFire SoC SPI "hard" controller supports eight
chip selects. However, only one chip select is physically wired.
Therefore, use GPIO descriptors to configure additional chip select
lines.

+31 -4
+26 -3
Documentation/devicetree/bindings/spi/microchip,mpfs-spi.yaml
··· 13 13 maintainers: 14 14 - Conor Dooley <conor.dooley@microchip.com> 15 15 16 - allOf: 17 - - $ref: spi-controller.yaml# 18 - 19 16 properties: 20 17 compatible: 21 18 oneOf: ··· 39 42 - reg 40 43 - interrupts 41 44 - clocks 45 + 46 + allOf: 47 + - $ref: spi-controller.yaml# 48 + 49 + - if: 50 + properties: 51 + compatible: 52 + contains: 53 + const: microchip,mpfs-spi 54 + then: 55 + properties: 56 + num-cs: 57 + default: 1 58 + 59 + - if: 60 + properties: 61 + compatible: 62 + contains: 63 + const: microchip,mpfs-spi 64 + not: 65 + required: 66 + - cs-gpios 67 + then: 68 + properties: 69 + num-cs: 70 + maximum: 1 42 71 43 72 unevaluatedProperties: false 44 73
+5 -1
drivers/spi/spi-microchip-core.c
··· 21 21 #include <linux/spi/spi.h> 22 22 23 23 #define MAX_LEN (0xffff) 24 - #define MAX_CS (8) 24 + #define MAX_CS (1) 25 25 #define DEFAULT_FRAMESIZE (8) 26 26 #define FIFO_DEPTH (32) 27 27 #define CLK_GEN_MODE1_MAX (255) ··· 257 257 { 258 258 struct mchp_corespi *corespi = spi_controller_get_devdata(spi->controller); 259 259 u32 reg; 260 + 261 + if (spi_is_csgpiod(spi)) 262 + return 0; 260 263 261 264 /* 262 265 * Active high targets need to be specifically set to their inactive ··· 519 516 520 517 host->num_chipselect = num_cs; 521 518 host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; 519 + host->use_gpio_descriptors = true; 522 520 host->setup = mchp_corespi_setup; 523 521 host->bits_per_word_mask = SPI_BPW_MASK(8); 524 522 host->transfer_one = mchp_corespi_transfer_one;