blob: 7fda40ad1a60bed31ebb072fa52c5f6d066688e1 [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át2bfe9ee2019-12-04 13:42:07 +010045index 59ff088c7d75..c7c6f753b0d3 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át2bfe9ee2019-12-04 13:42:07 +010048@@ -39,6 +39,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át2bfe9ee2019-12-04 13:42:07 +010058@@ -50,21 +53,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át2bfe9ee2019-12-04 13:42:07 +010084@@ -137,6 +144,8 @@ tlc591xx_destroy_devices(struct tlc591xx_priv *priv, unsigned int j)
Jan Kundrát25016432019-03-04 21:40:58 +010085 if (priv->leds[i].active)
86 led_classdev_unregister(&priv->leds[i].ldev);
87 }
88+
89+ i2c_unregister_device(priv->swrst_client);
90 }
91
92 static int
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +010093@@ -242,6 +251,19 @@ tlc591xx_probe(struct i2c_client *client,
Jan Kundrát25016432019-03-04 21:40:58 +010094 priv->leds[reg].ldev.default_trigger =
95 of_get_property(child, "linux,default-trigger", NULL);
96 }
97+
98+ priv->swrst_client = i2c_new_dummy(client->adapter, tlc591xx->swrst_addr);
99+ if (priv->swrst_client) {
100+ err = i2c_smbus_write_byte_data(priv->swrst_client,
101+ TLC591XX_RESET_BYTE_0, TLC591XX_RESET_BYTE_1);
102+ if (err) {
103+ dev_warn(dev, "SW reset failed\n");
104+ }
105+ } else {
106+ dev_info(dev, "Skipping reset: address %02x already used\n",
107+ tlc591xx->swrst_addr);
108+ }
109+
110 return tlc591xx_configure(dev, priv, tlc591xx);
111 }
112
113diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100114index 3a235487e38d..3358891b3ea2 100644
Jan Kundrát25016432019-03-04 21:40:58 +0100115--- a/drivers/pinctrl/pinctrl-mcp23s08.c
116+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100117@@ -993,6 +993,7 @@ static int mcp23s08_probe(struct spi_device *spi)
Jan Kundrát25016432019-03-04 21:40:58 +0100118 int status, type;
119 unsigned ngpio = 0;
120 const struct of_device_id *match;
121+ struct device_node *np;
122
123 match = of_match_device(of_match_ptr(mcp23s08_spi_of_match), &spi->dev);
124 if (match)
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100125@@ -1061,6 +1062,16 @@ static int mcp23s08_probe(struct spi_device *spi)
Jan Kundrát25016432019-03-04 21:40:58 +0100126 if (pdata->base != -1)
127 pdata->base += data->mcp[addr]->chip.ngpio;
128 ngpio += data->mcp[addr]->chip.ngpio;
129+
130+ for_each_available_child_of_node(spi->dev.of_node, np) {
131+ u32 chip_addr;
132+ status = of_property_read_u32(np, "address", &chip_addr);
133+ if (status)
134+ continue;
135+ if (chip_addr != addr)
136+ continue;
137+ devprop_gpiochip_set_names(&data->mcp[addr]->chip, of_fwnode_handle(np));
138+ }
139 }
140 data->ngpio = ngpio;
141
Jan Kundráte7d21622019-03-28 22:52:38 +0100142diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100143index 6643ccdc2508..d7ec35233d7e 100644
Jan Kundráte7d21622019-03-28 22:52:38 +0100144--- a/drivers/spi/spi-orion.c
145+++ b/drivers/spi/spi-orion.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100146@@ -88,10 +88,6 @@ struct orion_direct_acc {
Jan Kundráte7d21622019-03-28 22:52:38 +0100147 u32 size;
148 };
149
150-struct orion_child_options {
151- struct orion_direct_acc direct_access;
152-};
153-
Jan Kundrát25016432019-03-04 21:40:58 +0100154 struct orion_spi {
Jan Kundráte7d21622019-03-28 22:52:38 +0100155 struct spi_master *master;
156 void __iomem *base;
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100157@@ -100,7 +96,7 @@ struct orion_spi {
Jan Kundráte7d21622019-03-28 22:52:38 +0100158 const struct orion_spi_dev *devdata;
159 int unused_hw_gpio;
160
161- struct orion_child_options child[ORION_NUM_CHIPSELECTS];
162+ struct orion_direct_acc direct_access[ORION_NUM_CHIPSELECTS];
163 };
164
165 static inline void __iomem *spi_reg(struct orion_spi *orion_spi, u32 reg)
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100166@@ -430,7 +426,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
Jan Kundrát25016432019-03-04 21:40:58 +0100167 int cs = spi->chip_select;
Jan Kundrát549db872019-03-05 12:23:25 +0100168 void __iomem *vaddr;
Jan Kundrát25016432019-03-04 21:40:58 +0100169
170- word_len = spi->bits_per_word;
171+ word_len = xfer->bits_per_word;
172 count = xfer->len;
173
174 orion_spi = spi_master_get_devdata(spi->master);
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100175@@ -439,7 +435,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
Jan Kundráte7d21622019-03-28 22:52:38 +0100176 * Use SPI direct write mode if base address is available. Otherwise
177 * fall back to PIO mode for this transfer.
178 */
179- vaddr = orion_spi->child[cs].direct_access.vaddr;
180+ vaddr = orion_spi->direct_access[cs].vaddr;
181
182 if (vaddr && xfer->tx_buf && word_len == 8) {
183 unsigned int cnt = count / 4;
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100184@@ -684,7 +680,6 @@ static int orion_spi_probe(struct platform_device *pdev)
Jan Kundráte7d21622019-03-28 22:52:38 +0100185 }
186
187 for_each_available_child_of_node(pdev->dev.of_node, np) {
188- struct orion_direct_acc *dir_acc;
189 u32 cs;
190 int cs_gpio;
191
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100192@@ -752,13 +747,14 @@ static int orion_spi_probe(struct platform_device *pdev)
Jan Kundráte7d21622019-03-28 22:52:38 +0100193 * This needs to get extended for the direct SPI-NOR / SPI-NAND
194 * support, once this gets implemented.
195 */
196- dir_acc = &spi->child[cs].direct_access;
197- dir_acc->vaddr = devm_ioremap(&pdev->dev, r->start, PAGE_SIZE);
198- if (!dir_acc->vaddr) {
199+ spi->direct_access[cs].vaddr = devm_ioremap(&pdev->dev,
200+ r->start,
201+ PAGE_SIZE);
202+ if (!spi->direct_access[cs].vaddr) {
203 status = -ENOMEM;
204 goto out_rel_axi_clk;
205 }
206- dir_acc->size = PAGE_SIZE;
207+ spi->direct_access[cs].size = PAGE_SIZE;
208
209 dev_info(&pdev->dev, "CS%d configured for direct access\n", cs);
210 }
Jan Kundráte7d21622019-03-28 22:52:38 +0100211diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100212index 8434bd5a8ec7..59d3c27d36a2 100644
Jan Kundráte7d21622019-03-28 22:52:38 +0100213--- a/drivers/tty/serial/max310x.c
214+++ b/drivers/tty/serial/max310x.c
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100215@@ -235,6 +235,10 @@
216 #define MAX310x_REV_MASK (0xf8)
217 #define MAX310X_WRITE_BIT 0x80
Jan Kundráte7d21622019-03-28 22:52:38 +0100218
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100219+/* Timeout for external crystal stability */
220+#define MAX310X_XTAL_WAIT_RETRIES 20
221+#define MAX310X_XTAL_WAIT_DELAY_MS 10
222+
223 /* MAX3107 specific */
224 #define MAX3107_REV_ID (0xa0)
Jan Kundráte7d21622019-03-28 22:52:38 +0100225
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100226@@ -610,11 +614,14 @@ static int max310x_set_ref_clk(struct device *dev, struct max310x_port *s,
227
228 /* Wait for crystal */
229 if (xtal) {
230- unsigned int val;
231- msleep(10);
232- regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val);
233+ unsigned int val = 0, i;
234+ for (i = 0; i < MAX310X_XTAL_WAIT_RETRIES && !(val & MAX310X_STS_CLKREADY_BIT); ++i) {
235+ msleep(MAX310X_XTAL_WAIT_DELAY_MS);
236+ regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val);
237+ }
238 if (!(val & MAX310X_STS_CLKREADY_BIT)) {
239- dev_warn(dev, "clock is not stable yet\n");
240+ dev_err(dev, "clock is not stable\n");
241+ return -EAGAIN;
242 }
243 }
244
245@@ -1327,6 +1334,10 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
Jan Kundráte7d21622019-03-28 22:52:38 +0100246 }
247
248 uartclk = max310x_set_ref_clk(dev, s, freq, xtal);
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100249+ if (uartclk < 0) {
250+ ret = uartclk;
251+ goto out_uart;
252+ }
253 dev_dbg(dev, "Reference clock set to %i Hz\n", uartclk);
Jan Kundráte7d21622019-03-28 22:52:38 +0100254
Jan Kundrát2bfe9ee2019-12-04 13:42:07 +0100255 for (i = 0; i < devtype->nr; i++) {