diff options
-rw-r--r-- | Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt | 4 | ||||
-rw-r--r-- | drivers/gpio/gpio-mcp23s08.c | 19 |
2 files changed, 16 insertions, 7 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt b/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt index f3332b9a8ed4..c934106b10aa 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt | |||
@@ -10,6 +10,7 @@ Required properties: | |||
10 | 10 | ||
11 | - "microchip,mcp23s08" for 8 GPIO SPI version | 11 | - "microchip,mcp23s08" for 8 GPIO SPI version |
12 | - "microchip,mcp23s17" for 16 GPIO SPI version | 12 | - "microchip,mcp23s17" for 16 GPIO SPI version |
13 | - "microchip,mcp23s18" for 16 GPIO SPI version | ||
13 | - "microchip,mcp23008" for 8 GPIO I2C version or | 14 | - "microchip,mcp23008" for 8 GPIO I2C version or |
14 | - "microchip,mcp23017" for 16 GPIO I2C version of the chip | 15 | - "microchip,mcp23017" for 16 GPIO I2C version of the chip |
15 | NOTE: Do not use the old mcp prefix any more. It is deprecated and will be | 16 | NOTE: Do not use the old mcp prefix any more. It is deprecated and will be |
@@ -43,9 +44,6 @@ Optional properties: | |||
43 | - first cell is the pin number | 44 | - first cell is the pin number |
44 | - second cell is used to specify flags. | 45 | - second cell is used to specify flags. |
45 | - interrupt-controller: Marks the device node as a interrupt controller. | 46 | - interrupt-controller: Marks the device node as a interrupt controller. |
46 | NOTE: The interrupt functionality is only supported for i2c versions of the | ||
47 | chips. The spi chips can also do the interrupts, but this is not supported by | ||
48 | the linux driver yet. | ||
49 | 47 | ||
50 | Optional device specific properties: | 48 | Optional device specific properties: |
51 | - microchip,irq-mirror: Sets the mirror flag in the IOCON register. Devices | 49 | - microchip,irq-mirror: Sets the mirror flag in the IOCON register. Devices |
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c index f8d4abcff573..971915830d7f 100644 --- a/drivers/gpio/gpio-mcp23s08.c +++ b/drivers/gpio/gpio-mcp23s08.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #define MCP_TYPE_S17 1 | 31 | #define MCP_TYPE_S17 1 |
32 | #define MCP_TYPE_008 2 | 32 | #define MCP_TYPE_008 2 |
33 | #define MCP_TYPE_017 3 | 33 | #define MCP_TYPE_017 3 |
34 | #define MCP_TYPE_S18 4 | ||
34 | 35 | ||
35 | /* Registers are all 8 bits wide. | 36 | /* Registers are all 8 bits wide. |
36 | * | 37 | * |
@@ -617,6 +618,12 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, | |||
617 | mcp->chip.ngpio = 16; | 618 | mcp->chip.ngpio = 16; |
618 | mcp->chip.label = "mcp23s17"; | 619 | mcp->chip.label = "mcp23s17"; |
619 | break; | 620 | break; |
621 | |||
622 | case MCP_TYPE_S18: | ||
623 | mcp->ops = &mcp23s17_ops; | ||
624 | mcp->chip.ngpio = 16; | ||
625 | mcp->chip.label = "mcp23s18"; | ||
626 | break; | ||
620 | #endif /* CONFIG_SPI_MASTER */ | 627 | #endif /* CONFIG_SPI_MASTER */ |
621 | 628 | ||
622 | #if IS_ENABLED(CONFIG_I2C) | 629 | #if IS_ENABLED(CONFIG_I2C) |
@@ -657,8 +664,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, | |||
657 | of_property_read_bool(mcp->chip.parent->of_node, | 664 | of_property_read_bool(mcp->chip.parent->of_node, |
658 | "microchip,irq-active-high"); | 665 | "microchip,irq-active-high"); |
659 | 666 | ||
660 | if (type == MCP_TYPE_017) | 667 | mirror = pdata->mirror; |
661 | mirror = pdata->mirror; | ||
662 | } | 668 | } |
663 | 669 | ||
664 | if ((status & IOCON_SEQOP) || !(status & IOCON_HAEN) || mirror || | 670 | if ((status & IOCON_SEQOP) || !(status & IOCON_HAEN) || mirror || |
@@ -735,6 +741,10 @@ static const struct of_device_id mcp23s08_spi_of_match[] = { | |||
735 | .compatible = "microchip,mcp23s17", | 741 | .compatible = "microchip,mcp23s17", |
736 | .data = (void *) MCP_TYPE_S17, | 742 | .data = (void *) MCP_TYPE_S17, |
737 | }, | 743 | }, |
744 | { | ||
745 | .compatible = "microchip,mcp23s18", | ||
746 | .data = (void *) MCP_TYPE_S18, | ||
747 | }, | ||
738 | /* NOTE: The use of the mcp prefix is deprecated and will be removed. */ | 748 | /* NOTE: The use of the mcp prefix is deprecated and will be removed. */ |
739 | { | 749 | { |
740 | .compatible = "mcp,mcp23s08", | 750 | .compatible = "mcp,mcp23s08", |
@@ -971,8 +981,8 @@ static int mcp23s08_probe(struct spi_device *spi) | |||
971 | goto fail; | 981 | goto fail; |
972 | 982 | ||
973 | if (pdata->base != -1) | 983 | if (pdata->base != -1) |
974 | pdata->base += (type == MCP_TYPE_S17) ? 16 : 8; | 984 | pdata->base += data->mcp[addr]->chip.ngpio; |
975 | ngpio += (type == MCP_TYPE_S17) ? 16 : 8; | 985 | ngpio += data->mcp[addr]->chip.ngpio; |
976 | } | 986 | } |
977 | data->ngpio = ngpio; | 987 | data->ngpio = ngpio; |
978 | 988 | ||
@@ -1014,6 +1024,7 @@ static int mcp23s08_remove(struct spi_device *spi) | |||
1014 | static const struct spi_device_id mcp23s08_ids[] = { | 1024 | static const struct spi_device_id mcp23s08_ids[] = { |
1015 | { "mcp23s08", MCP_TYPE_S08 }, | 1025 | { "mcp23s08", MCP_TYPE_S08 }, |
1016 | { "mcp23s17", MCP_TYPE_S17 }, | 1026 | { "mcp23s17", MCP_TYPE_S17 }, |
1027 | { "mcp23s18", MCP_TYPE_S18 }, | ||
1017 | { }, | 1028 | { }, |
1018 | }; | 1029 | }; |
1019 | MODULE_DEVICE_TABLE(spi, mcp23s08_ids); | 1030 | MODULE_DEVICE_TABLE(spi, mcp23s08_ids); |