blob: 62b40b0856d2040e382e8f1554a9f8fa7911c685 [file] [log] [blame]
Jan Kundrát25016432019-03-04 21:40:58 +01001diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +01002index 8b94aa8f5971..2723e6143aa9 100644
Jan Kundrát25016432019-03-04 21:40:58 +01003--- 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áte7d21622019-03-28 22:52:38 +010018+ compatible = "microchip,mcp23s17";
19+ gpio-controller;
20+ #gpio-cells = <2>;
Jan Kundrát25016432019-03-04 21:40:58 +010021+ /* this bitmask has bits #0 (0x01) and #2 (0x04) set */
Jan Kundráte7d21622019-03-28 22:52:38 +010022+ spi-present-mask = <0x05>;
23+ reg = <0>;
24+ spi-max-frequency = <1000000>;
Jan Kundrát25016432019-03-04 21:40:58 +010025+
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át25016432019-03-04 21:40:58 +010044diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c
Jan Kundrát89b682a2020-03-08 13:03:33 -070045index a8911ebd30e5..632fd6a4c7bc 100644
Jan Kundrát25016432019-03-04 21:40:58 +010046--- a/drivers/leds/leds-tlc591xx.c
47+++ b/drivers/leds/leds-tlc591xx.c
Jan Kundrátf97c81d2020-02-06 00:33:19 +010048@@ -40,6 +40,9 @@
Jan Kundrát25016432019-03-04 21:40:58 +010049
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átf97c81d2020-02-06 00:33:19 +010058@@ -51,21 +54,25 @@ struct tlc591xx_priv {
Jan Kundrát25016432019-03-04 21:40:58 +010059 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át31bf7ae2020-02-14 17:03:53 +010084@@ -181,6 +188,18 @@ tlc591xx_probe(struct i2c_client *client,
85
86 i2c_set_clientdata(client, priv);
Jan Kundrát25016432019-03-04 21:40:58 +010087
Jan Kundrátf97c81d2020-02-06 00:33:19 +010088+ priv->swrst_client = devm_i2c_new_dummy_device(dev, client->adapter, tlc591xx->swrst_addr);
Jan Kundrát89b682a2020-03-08 13:03:33 -070089+ 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át25016432019-03-04 21:40:58 +010093+ 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át25016432019-03-04 21:40:58 +010098+ }
99+
Jan Kundrát31bf7ae2020-02-14 17:03:53 +0100100 err = tlc591xx_set_mode(priv->regmap, MODE2_DIM);
101 if (err < 0)
102 return err;
Jan Kundrát25016432019-03-04 21:40:58 +0100103diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100104index 3a235487e38d..3358891b3ea2 100644
Jan Kundrát25016432019-03-04 21:40:58 +0100105--- a/drivers/pinctrl/pinctrl-mcp23s08.c
106+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100107@@ -993,6 +993,7 @@ static int mcp23s08_probe(struct spi_device *spi)
Jan Kundrát25016432019-03-04 21:40:58 +0100108 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át2bfe9ee2019-12-04 13:42:07 +0100115@@ -1061,6 +1062,16 @@ static int mcp23s08_probe(struct spi_device *spi)
Jan Kundrát25016432019-03-04 21:40:58 +0100116 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áte7d21622019-03-28 22:52:38 +0100132diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
Jan Kundrátf97c81d2020-02-06 00:33:19 +0100133index c7266ef295fd..576bce155456 100644
Jan Kundráte7d21622019-03-28 22:52:38 +0100134--- a/drivers/spi/spi-orion.c
135+++ b/drivers/spi/spi-orion.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100136@@ -88,10 +88,6 @@ struct orion_direct_acc {
Jan Kundráte7d21622019-03-28 22:52:38 +0100137 u32 size;
138 };
139
140-struct orion_child_options {
141- struct orion_direct_acc direct_access;
142-};
143-
Jan Kundrát25016432019-03-04 21:40:58 +0100144 struct orion_spi {
Jan Kundráte7d21622019-03-28 22:52:38 +0100145 struct spi_master *master;
146 void __iomem *base;
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100147@@ -100,7 +96,7 @@ struct orion_spi {
Jan Kundráte7d21622019-03-28 22:52:38 +0100148 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át2bfe9ee2019-12-04 13:42:07 +0100156@@ -430,7 +426,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
Jan Kundrát25016432019-03-04 21:40:58 +0100157 int cs = spi->chip_select;
Jan Kundrát549db872019-03-05 12:23:25 +0100158 void __iomem *vaddr;
Jan Kundrát25016432019-03-04 21:40:58 +0100159
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át2bfe9ee2019-12-04 13:42:07 +0100165@@ -439,7 +435,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
Jan Kundráte7d21622019-03-28 22:52:38 +0100166 * 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átf97c81d2020-02-06 00:33:19 +0100174@@ -682,7 +678,6 @@ static int orion_spi_probe(struct platform_device *pdev)
Jan Kundráte7d21622019-03-28 22:52:38 +0100175 }
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átf97c81d2020-02-06 00:33:19 +0100182@@ -750,13 +745,14 @@ static int orion_spi_probe(struct platform_device *pdev)
Jan Kundráte7d21622019-03-28 22:52:38 +0100183 * 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áte7d21622019-03-28 22:52:38 +0100201diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100202index 8434bd5a8ec7..59d3c27d36a2 100644
Jan Kundráte7d21622019-03-28 22:52:38 +0100203--- a/drivers/tty/serial/max310x.c
204+++ b/drivers/tty/serial/max310x.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100205@@ -235,6 +235,10 @@
206 #define MAX310x_REV_MASK (0xf8)
207 #define MAX310X_WRITE_BIT 0x80
Jan Kundráte7d21622019-03-28 22:52:38 +0100208
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100209+/* 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áte7d21622019-03-28 22:52:38 +0100215
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100216@@ -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áte7d21622019-03-28 22:52:38 +0100236 }
237
238 uartclk = max310x_set_ref_clk(dev, s, freq, xtal);
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100239+ 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áte7d21622019-03-28 22:52:38 +0100244
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100245 for (i = 0; i < devtype->nr; i++) {