Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 1 | diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 2 | index 8b94aa8f5971..2723e6143aa9 100644 |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 3 | --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt |
| 4 | +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt |
| 5 | @@ -144,3 +144,38 @@ gpio21: gpio@21 { |
| 6 | bias-pull-up; |
| 7 | }; |
| 8 | }; |
| 9 | + |
| 10 | +Line naming |
| 11 | +=========== |
| 12 | + |
| 13 | +Because several gpio_chip instances are hidden below a single device tree |
| 14 | +node, it is necessary to split the names into several child nodes. Ensure |
| 15 | +that the configured addresses match those in the microchip,spi-present-mask: |
| 16 | + |
| 17 | +gpio@0 { |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 18 | + compatible = "microchip,mcp23s17"; |
| 19 | + gpio-controller; |
| 20 | + #gpio-cells = <2>; |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 21 | + /* this bitmask has bits #0 (0x01) and #2 (0x04) set */ |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 22 | + spi-present-mask = <0x05>; |
| 23 | + reg = <0>; |
| 24 | + spi-max-frequency = <1000000>; |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 25 | + |
| 26 | + gpio-bank@1 { |
| 27 | + address = <0>; |
| 28 | + gpio-line-names = |
| 29 | + "GPA0", |
| 30 | + "GPA1", |
| 31 | + ... |
| 32 | + "GPA7", |
| 33 | + "GPB0", |
| 34 | + "GPB1", |
| 35 | + ... |
| 36 | + "GPB7"; |
| 37 | + }; |
| 38 | + |
| 39 | + gpio-bank@2 { |
| 40 | + address = <2>; |
| 41 | + gpio-line-names = ... |
| 42 | + }; |
| 43 | +}; |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 44 | diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c |
Jan Kundrát | 89b682a | 2020-03-08 13:03:33 -0700 | [diff] [blame] | 45 | index a8911ebd30e5..632fd6a4c7bc 100644 |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 46 | --- a/drivers/leds/leds-tlc591xx.c |
| 47 | +++ b/drivers/leds/leds-tlc591xx.c |
Jan Kundrát | f97c81d | 2020-02-06 00:33:19 +0100 | [diff] [blame] | 48 | @@ -40,6 +40,9 @@ |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 49 | |
| 50 | #define ldev_to_led(c) container_of(c, struct tlc591xx_led, ldev) |
| 51 | |
| 52 | +#define TLC591XX_RESET_BYTE_0 0xa5 |
| 53 | +#define TLC591XX_RESET_BYTE_1 0x5a |
| 54 | + |
| 55 | struct tlc591xx_led { |
| 56 | bool active; |
| 57 | unsigned int led_no; |
Jan Kundrát | f97c81d | 2020-02-06 00:33:19 +0100 | [diff] [blame] | 58 | @@ -51,21 +54,25 @@ struct tlc591xx_priv { |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 59 | struct tlc591xx_led leds[TLC591XX_MAX_LEDS]; |
| 60 | struct regmap *regmap; |
| 61 | unsigned int reg_ledout_offset; |
| 62 | + struct i2c_client *swrst_client; |
| 63 | }; |
| 64 | |
| 65 | struct tlc591xx { |
| 66 | unsigned int max_leds; |
| 67 | unsigned int reg_ledout_offset; |
| 68 | + u8 swrst_addr; |
| 69 | }; |
| 70 | |
| 71 | static const struct tlc591xx tlc59116 = { |
| 72 | .max_leds = 16, |
| 73 | .reg_ledout_offset = 0x14, |
| 74 | + .swrst_addr = 0x6b, |
| 75 | }; |
| 76 | |
| 77 | static const struct tlc591xx tlc59108 = { |
| 78 | .max_leds = 8, |
| 79 | .reg_ledout_offset = 0x0c, |
| 80 | + .swrst_addr = 0x4b, |
| 81 | }; |
| 82 | |
| 83 | static int |
Jan Kundrát | 31bf7ae | 2020-02-14 17:03:53 +0100 | [diff] [blame] | 84 | @@ -181,6 +188,18 @@ tlc591xx_probe(struct i2c_client *client, |
| 85 | |
| 86 | i2c_set_clientdata(client, priv); |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 87 | |
Jan Kundrát | f97c81d | 2020-02-06 00:33:19 +0100 | [diff] [blame] | 88 | + priv->swrst_client = devm_i2c_new_dummy_device(dev, client->adapter, tlc591xx->swrst_addr); |
Jan Kundrát | 89b682a | 2020-03-08 13:03:33 -0700 | [diff] [blame] | 89 | + if (IS_ERR(priv->swrst_client)) { |
| 90 | + dev_info(dev, "Skipping reset: address %02x already used\n", |
| 91 | + tlc591xx->swrst_addr); |
| 92 | + } else { |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 93 | + err = i2c_smbus_write_byte_data(priv->swrst_client, |
| 94 | + TLC591XX_RESET_BYTE_0, TLC591XX_RESET_BYTE_1); |
| 95 | + if (err) { |
| 96 | + dev_warn(dev, "SW reset failed\n"); |
| 97 | + } |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 98 | + } |
| 99 | + |
Jan Kundrát | 31bf7ae | 2020-02-14 17:03:53 +0100 | [diff] [blame] | 100 | err = tlc591xx_set_mode(priv->regmap, MODE2_DIM); |
| 101 | if (err < 0) |
| 102 | return err; |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 103 | diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 104 | index 3a235487e38d..3358891b3ea2 100644 |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 105 | --- a/drivers/pinctrl/pinctrl-mcp23s08.c |
| 106 | +++ b/drivers/pinctrl/pinctrl-mcp23s08.c |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 107 | @@ -993,6 +993,7 @@ static int mcp23s08_probe(struct spi_device *spi) |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 108 | int status, type; |
| 109 | unsigned ngpio = 0; |
| 110 | const struct of_device_id *match; |
| 111 | + struct device_node *np; |
| 112 | |
| 113 | match = of_match_device(of_match_ptr(mcp23s08_spi_of_match), &spi->dev); |
| 114 | if (match) |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 115 | @@ -1061,6 +1062,16 @@ static int mcp23s08_probe(struct spi_device *spi) |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 116 | if (pdata->base != -1) |
| 117 | pdata->base += data->mcp[addr]->chip.ngpio; |
| 118 | ngpio += data->mcp[addr]->chip.ngpio; |
| 119 | + |
| 120 | + for_each_available_child_of_node(spi->dev.of_node, np) { |
| 121 | + u32 chip_addr; |
| 122 | + status = of_property_read_u32(np, "address", &chip_addr); |
| 123 | + if (status) |
| 124 | + continue; |
| 125 | + if (chip_addr != addr) |
| 126 | + continue; |
| 127 | + devprop_gpiochip_set_names(&data->mcp[addr]->chip, of_fwnode_handle(np)); |
| 128 | + } |
| 129 | } |
| 130 | data->ngpio = ngpio; |
| 131 | |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 132 | diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c |
Jan Kundrát | f97c81d | 2020-02-06 00:33:19 +0100 | [diff] [blame] | 133 | index c7266ef295fd..576bce155456 100644 |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 134 | --- a/drivers/spi/spi-orion.c |
| 135 | +++ b/drivers/spi/spi-orion.c |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 136 | @@ -88,10 +88,6 @@ struct orion_direct_acc { |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 137 | u32 size; |
| 138 | }; |
| 139 | |
| 140 | -struct orion_child_options { |
| 141 | - struct orion_direct_acc direct_access; |
| 142 | -}; |
| 143 | - |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 144 | struct orion_spi { |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 145 | struct spi_master *master; |
| 146 | void __iomem *base; |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 147 | @@ -100,7 +96,7 @@ struct orion_spi { |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 148 | const struct orion_spi_dev *devdata; |
| 149 | int unused_hw_gpio; |
| 150 | |
| 151 | - struct orion_child_options child[ORION_NUM_CHIPSELECTS]; |
| 152 | + struct orion_direct_acc direct_access[ORION_NUM_CHIPSELECTS]; |
| 153 | }; |
| 154 | |
| 155 | static inline void __iomem *spi_reg(struct orion_spi *orion_spi, u32 reg) |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 156 | @@ -430,7 +426,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 157 | int cs = spi->chip_select; |
Jan Kundrát | 549db87 | 2019-03-05 12:23:25 +0100 | [diff] [blame] | 158 | void __iomem *vaddr; |
Jan Kundrát | 2501643 | 2019-03-04 21:40:58 +0100 | [diff] [blame] | 159 | |
| 160 | - word_len = spi->bits_per_word; |
| 161 | + word_len = xfer->bits_per_word; |
| 162 | count = xfer->len; |
| 163 | |
| 164 | orion_spi = spi_master_get_devdata(spi->master); |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 165 | @@ -439,7 +435,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 166 | * Use SPI direct write mode if base address is available. Otherwise |
| 167 | * fall back to PIO mode for this transfer. |
| 168 | */ |
| 169 | - vaddr = orion_spi->child[cs].direct_access.vaddr; |
| 170 | + vaddr = orion_spi->direct_access[cs].vaddr; |
| 171 | |
| 172 | if (vaddr && xfer->tx_buf && word_len == 8) { |
| 173 | unsigned int cnt = count / 4; |
Jan Kundrát | f97c81d | 2020-02-06 00:33:19 +0100 | [diff] [blame] | 174 | @@ -682,7 +678,6 @@ static int orion_spi_probe(struct platform_device *pdev) |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | for_each_available_child_of_node(pdev->dev.of_node, np) { |
| 178 | - struct orion_direct_acc *dir_acc; |
| 179 | u32 cs; |
| 180 | int cs_gpio; |
| 181 | |
Jan Kundrát | f97c81d | 2020-02-06 00:33:19 +0100 | [diff] [blame] | 182 | @@ -750,13 +745,14 @@ static int orion_spi_probe(struct platform_device *pdev) |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 183 | * This needs to get extended for the direct SPI-NOR / SPI-NAND |
| 184 | * support, once this gets implemented. |
| 185 | */ |
| 186 | - dir_acc = &spi->child[cs].direct_access; |
| 187 | - dir_acc->vaddr = devm_ioremap(&pdev->dev, r->start, PAGE_SIZE); |
| 188 | - if (!dir_acc->vaddr) { |
| 189 | + spi->direct_access[cs].vaddr = devm_ioremap(&pdev->dev, |
| 190 | + r->start, |
| 191 | + PAGE_SIZE); |
| 192 | + if (!spi->direct_access[cs].vaddr) { |
| 193 | status = -ENOMEM; |
| 194 | goto out_rel_axi_clk; |
| 195 | } |
| 196 | - dir_acc->size = PAGE_SIZE; |
| 197 | + spi->direct_access[cs].size = PAGE_SIZE; |
| 198 | |
| 199 | dev_info(&pdev->dev, "CS%d configured for direct access\n", cs); |
| 200 | } |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 201 | diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 202 | index 8434bd5a8ec7..59d3c27d36a2 100644 |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 203 | --- a/drivers/tty/serial/max310x.c |
| 204 | +++ b/drivers/tty/serial/max310x.c |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 205 | @@ -235,6 +235,10 @@ |
| 206 | #define MAX310x_REV_MASK (0xf8) |
| 207 | #define MAX310X_WRITE_BIT 0x80 |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 208 | |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 209 | +/* Timeout for external crystal stability */ |
| 210 | +#define MAX310X_XTAL_WAIT_RETRIES 20 |
| 211 | +#define MAX310X_XTAL_WAIT_DELAY_MS 10 |
| 212 | + |
| 213 | /* MAX3107 specific */ |
| 214 | #define MAX3107_REV_ID (0xa0) |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 215 | |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 216 | @@ -610,11 +614,14 @@ static int max310x_set_ref_clk(struct device *dev, struct max310x_port *s, |
| 217 | |
| 218 | /* Wait for crystal */ |
| 219 | if (xtal) { |
| 220 | - unsigned int val; |
| 221 | - msleep(10); |
| 222 | - regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val); |
| 223 | + unsigned int val = 0, i; |
| 224 | + for (i = 0; i < MAX310X_XTAL_WAIT_RETRIES && !(val & MAX310X_STS_CLKREADY_BIT); ++i) { |
| 225 | + msleep(MAX310X_XTAL_WAIT_DELAY_MS); |
| 226 | + regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val); |
| 227 | + } |
| 228 | if (!(val & MAX310X_STS_CLKREADY_BIT)) { |
| 229 | - dev_warn(dev, "clock is not stable yet\n"); |
| 230 | + dev_err(dev, "clock is not stable\n"); |
| 231 | + return -EAGAIN; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | @@ -1327,6 +1334,10 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype, |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | uartclk = max310x_set_ref_clk(dev, s, freq, xtal); |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 239 | + if (uartclk < 0) { |
| 240 | + ret = uartclk; |
| 241 | + goto out_uart; |
| 242 | + } |
| 243 | dev_dbg(dev, "Reference clock set to %i Hz\n", uartclk); |
Jan Kundrát | e7d2162 | 2019-03-28 22:52:38 +0100 | [diff] [blame] | 244 | |
Jan Kundrát | 2bfe9ee | 2019-12-04 13:42:07 +0100 | [diff] [blame] | 245 | for (i = 0; i < devtype->nr; i++) { |