History

Merge tag 'i2c-for-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c updates from Wolfram Sang: "I2C Core: - prevent double-free of an fwnode if it is a software node - use recent helpers instead of custom ACPI or outdated OF ones - add a more elaborate description of a message flag Cleanups and refactorings: - lpi2c, riic, st, stm32f7: general improvements - riic: support more flexible IRQ configurations - tegra: fix documentation Improvements: - lpi2c: improve register polling and add atomic transfer - imx: use guarded spinlocks New hardware support: - Samsung Exynos 2200 - Renesas RZ/T2H (R9A09G077), RZ/N2H (R9A09G087) DT binding: - rk3x: enable power domains - nxp: support clock property" * tag 'i2c-for-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: core: Fix double-free of fwnode in i2c_unregister_device() i2c: lpi2c: implement xfer_atomic callback i2c: lpi2c: use readl_poll_timeout() for register polling dt-bindings: i2c: i2c-rk3x: Allow use of a power-domain dt-bindings: i2c: exynos5: add samsung,exynos2200-hsi2c compatible i2c: lpi2c: convert to use secs_to_jiffies() i2c: st: Use min() to improve code i2c: imx: use guard to take spinlock i2c: stm32f7: Use str_on_off() helper dt-bindings: i2c: nxp,pnx-i2c: allow clocks property i2c: riic: Add support for RZ/T2H SoC i2c: riic: Move generic compatible string to end of array i2c: riic: Pass IRQ desc array as part of OF data dt-bindings: i2c: renesas,riic: Document RZ/T2H and RZ/N2H support dt-bindings: i2c: renesas,riic: Move ref for i2c-controller.yaml to the end i2c: tegra: Add missing kernel-doc for dma_dev member i2c: Clarify behavior of I2C_M_RD flag i2c: mux: pca954x: Use dev_fwnode() i2c: acpi: Replace custom code with device_match_acpi_handle()

Linus Torvalds committed 1 year ago

Commit 0ae982d2 parents 0919a5b 1c24e5f14 files · +333 −165Browse files

Unified · Split

14 files
  1. Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml +1 −0
  2. Documentation/devicetree/bindings/i2c/i2c-rk3x.yaml +3 −0
  3. Documentation/devicetree/bindings/i2c/nxp,pnx-i2c.yaml +3 −0
  4. Documentation/devicetree/bindings/i2c/renesas,riic.yaml +71 −34
  5. drivers/i2c/busses/i2c-imx-lpi2c.c +173 −83
  6. drivers/i2c/busses/i2c-imx.c +16 −21
  7. drivers/i2c/busses/i2c-riic.c +46 −8
  8. drivers/i2c/busses/i2c-st.c +6 −13
  9. drivers/i2c/busses/i2c-stm32f7.c +2 −1
  10. drivers/i2c/busses/i2c-tegra.c +1 −0
  11. drivers/i2c/i2c-core-acpi.c +1 −1
  12. drivers/i2c/i2c-core-base.c +7 −1
  13. drivers/i2c/muxes/i2c-mux-pca954x.c +1 −2
  14. include/uapi/linux/i2c.h +2 −1
Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml+1−0
@@ -36,6 +36,7 @@ properties: · 35 unmodified lines
36 - items:36 - items:
37 - enum:37 - enum:
38 - google,gs101-hsi2c38 - google,gs101-hsi2c
39 - samsung,exynos2200-hsi2c
39 - samsung,exynos850-hsi2c40 - samsung,exynos850-hsi2c
40 - const: samsung,exynosautov9-hsi2c41 - const: samsung,exynosautov9-hsi2c
41 - const: samsung,exynos5-hsi2c # Exynos5250 and Exynos542042 - const: samsung,exynos5-hsi2c # Exynos5250 and Exynos5420
Documentation/devicetree/bindings/i2c/i2c-rk3x.yaml+3−0
@@ -105,6 +105,9 @@ properties: · 104 unmodified lines
105 (t(f) in the I2C specification). If not specified we will use the SCL105 (t(f) in the I2C specification). If not specified we will use the SCL
106 value since they are the same in nearly all cases.106 value since they are the same in nearly all cases.
107 107
108 power-domains:
109 maxItems: 1
110
108required:111required:
109 - compatible112 - compatible
110 - reg113 - reg
Documentation/devicetree/bindings/i2c/nxp,pnx-i2c.yaml+3−0
@@ -22,6 +22,9 @@ properties: · 21 unmodified lines
22 interrupts:22 interrupts:
23 maxItems: 123 maxItems: 1
24 24
25 clocks:
26 maxItems: 1
27
25 clock-frequency:28 clock-frequency:
26 default: 10000029 default: 100000
27 30
Documentation/devicetree/bindings/i2c/renesas,riic.yaml+71−34
@@ -10,9 +10,6 @@ maintainers: · 9 unmodified lines
10 - Chris Brandt <chris.brandt@renesas.com>10 - Chris Brandt <chris.brandt@renesas.com>
11 - Wolfram Sang <wsa+renesas@sang-engineering.com>11 - Wolfram Sang <wsa+renesas@sang-engineering.com>
12 12
13allOf:
14 - $ref: /schemas/i2c/i2c-controller.yaml#
15
16properties:13properties:
17 compatible:14 compatible:
18 oneOf:15 oneOf:
@@ -32,32 +29,50 @@ properties: · 13 unmodified lines
32 - renesas,riic-r9a09g056 # RZ/V2N29 - renesas,riic-r9a09g056 # RZ/V2N
33 - const: renesas,riic-r9a09g057 # RZ/V2H(P)30 - const: renesas,riic-r9a09g057 # RZ/V2H(P)
34 31
35 - const: renesas,riic-r9a09g057 # RZ/V2H(P)32 - enum:
33 - renesas,riic-r9a09g057 # RZ/V2H(P)
34 - renesas,riic-r9a09g077 # RZ/T2H
35
36 - items:
37 - const: renesas,riic-r9a09g087 # RZ/N2H
38 - const: renesas,riic-r9a09g077 # RZ/T2H
36 39
37 reg:40 reg:
38 maxItems: 141 maxItems: 1
39 42
40 interrupts:43 interrupts:
41 items:44 oneOf:
42 - description: Transmit End Interrupt45 - items:
43 - description: Receive Data Full Interrupt46 - description: Transmit End Interrupt
44 - description: Transmit Data Empty Interrupt47 - description: Receive Data Full Interrupt
45 - description: Stop Condition Detection Interrupt48 - description: Transmit Data Empty Interrupt
46 - description: Start Condition Detection Interrupt49 - description: Stop Condition Detection Interrupt
47 - description: NACK Reception Interrupt50 - description: Start Condition Detection Interrupt
48 - description: Arbitration-Lost Interrupt51 - description: NACK Reception Interrupt
49 - description: Timeout Interrupt52 - description: Arbitration-Lost Interrupt
53 - description: Timeout Interrupt
54 - items:
55 - description: Transfer Error Or Event Generation
56 - description: Receive Data Full Interrupt
57 - description: Transmit Data Empty Interrupt
58 - description: Transmit End Interrupt
50 59
51 interrupt-names:60 interrupt-names:
52 items:61 oneOf:
53 - const: tei62 - items:
54 - const: ri63 - const: tei
55 - const: ti64 - const: ri
56 - const: spi65 - const: ti
57 - const: sti66 - const: spi
58 - const: naki67 - const: sti
59 - const: ali68 - const: naki
60 - const: tmoi69 - const: ali
70 - const: tmoi
71 - items:
72 - const: eei
73 - const: rxi
74 - const: txi
75 - const: tei
61 76
62 clock-frequency:77 clock-frequency:
63 description:78 description:
@@ -84,18 +99,40 @@ required: · 20 unmodified lines
84 - '#address-cells'99 - '#address-cells'
85 - '#size-cells'100 - '#size-cells'
86 101
87if:102allOf:
88 properties:103 - $ref: /schemas/i2c/i2c-controller.yaml#
89 compatible:104
90 contains:105 - if:
91 enum:106 properties:
92 - renesas,riic-r9a07g043107 compatible:
93 - renesas,riic-r9a07g044108 contains:
94 - renesas,riic-r9a07g054109 const: renesas,riic-r9a09g077
95 - renesas,riic-r9a09g057110 then:
96then:111 properties:
97 required:112 interrupts:
98 - resets113 maxItems: 4
114 interrupt-names:
115 maxItems: 4
116 resets: false
117 else:
118 properties:
119 interrupts:
120 minItems: 8
121 interrupt-names:
122 minItems: 8
123
124 - if:
125 properties:
126 compatible:
127 contains:
128 enum:
129 - renesas,riic-r9a07g043
130 - renesas,riic-r9a07g044
131 - renesas,riic-r9a07g054
132 - renesas,riic-r9a09g057
133 then:
134 required:
135 - resets
99 136
100unevaluatedProperties: false137unevaluatedProperties: false
101 138
drivers/i2c/busses/i2c-imx-lpi2c.c+173−83
@@ -16,6 +16,7 @@ · 15 unmodified lines
16#include <linux/init.h>16#include <linux/init.h>
17#include <linux/interrupt.h>17#include <linux/interrupt.h>
18#include <linux/io.h>18#include <linux/io.h>
19#include <linux/iopoll.h>
19#include <linux/kernel.h>20#include <linux/kernel.h>
20#include <linux/module.h>21#include <linux/module.h>
21#include <linux/of.h>22#include <linux/of.h>
@@ -187,41 +188,48 @@ struct lpi2c_imx_struct { · 165 unmodified lines
187 struct i2c_client *target;188 struct i2c_client *target;
188};189};
189 190
191#define lpi2c_imx_read_msr_poll_timeout(atomic, val, cond) \
192 (atomic ? readl_poll_timeout_atomic(lpi2c_imx->base + LPI2C_MSR, val, \
193 cond, 0, 500000) : \
194 readl_poll_timeout(lpi2c_imx->base + LPI2C_MSR, val, cond, \
195 0, 500000))
196
190static void lpi2c_imx_intctrl(struct lpi2c_imx_struct *lpi2c_imx,197static void lpi2c_imx_intctrl(struct lpi2c_imx_struct *lpi2c_imx,
191 unsigned int enable)198 unsigned int enable)
192{199{
193 writel(enable, lpi2c_imx->base + LPI2C_MIER);200 writel(enable, lpi2c_imx->base + LPI2C_MIER);
194}201}
195 202
196static int lpi2c_imx_bus_busy(struct lpi2c_imx_struct *lpi2c_imx)203static int lpi2c_imx_bus_busy(struct lpi2c_imx_struct *lpi2c_imx, bool atomic)
197{204{
198 unsigned long orig_jiffies = jiffies;
199 unsigned int temp;205 unsigned int temp;
206 int err;
200 207
201 while (1) {208 err = lpi2c_imx_read_msr_poll_timeout(atomic, temp,
202 temp = readl(lpi2c_imx->base + LPI2C_MSR);209 temp & (MSR_ALF | MSR_BBF | MSR_MBF));
203
204 /* check for arbitration lost, clear if set */
205 if (temp & MSR_ALF) {
206 writel(temp, lpi2c_imx->base + LPI2C_MSR);
207 return -EAGAIN;
208 }
209 210
210 if (temp & (MSR_BBF | MSR_MBF))211 /* check for arbitration lost, clear if set */
211 break;212 if (temp & MSR_ALF) {
213 writel(temp, lpi2c_imx->base + LPI2C_MSR);
214 return -EAGAIN;
215 }
212 216
213 if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) {217 /* check for bus not busy */
214 dev_dbg(&lpi2c_imx->adapter.dev, "bus not work\n");218 if (err) {
215 if (lpi2c_imx->adapter.bus_recovery_info)219 dev_dbg(&lpi2c_imx->adapter.dev, "bus not work\n");
216 i2c_recover_bus(&lpi2c_imx->adapter);220 if (lpi2c_imx->adapter.bus_recovery_info)
217 return -ETIMEDOUT;221 i2c_recover_bus(&lpi2c_imx->adapter);
218 }222 return -ETIMEDOUT;
219 schedule();
220 }223 }
221 224
222 return 0;225 return 0;
223}226}
224 227
228static u32 lpi2c_imx_txfifo_cnt(struct lpi2c_imx_struct *lpi2c_imx)
229{
230 return readl(lpi2c_imx->base + LPI2C_MFSR) & 0xff;
231}
232
225static void lpi2c_imx_set_mode(struct lpi2c_imx_struct *lpi2c_imx)233static void lpi2c_imx_set_mode(struct lpi2c_imx_struct *lpi2c_imx)
226{234{
227 unsigned int bitrate = lpi2c_imx->bitrate;235 unsigned int bitrate = lpi2c_imx->bitrate;
@@ -242,7 +250,7 @@ static void lpi2c_imx_set_mode(struct lpi2c_imx_struct *lpi2c_imx) · 14 unmodified lines
242}250}
243 251
244static int lpi2c_imx_start(struct lpi2c_imx_struct *lpi2c_imx,252static int lpi2c_imx_start(struct lpi2c_imx_struct *lpi2c_imx,
245 struct i2c_msg *msgs)253 struct i2c_msg *msgs, bool atomic)
246{254{
247 unsigned int temp;255 unsigned int temp;
248 256
@@ -254,30 +262,23 @@ static int lpi2c_imx_start(struct lpi2c_imx_struct *lpi2c_imx, · 5 unmodified lines
254 temp = i2c_8bit_addr_from_msg(msgs) | (GEN_START << 8);262 temp = i2c_8bit_addr_from_msg(msgs) | (GEN_START << 8);
255 writel(temp, lpi2c_imx->base + LPI2C_MTDR);263 writel(temp, lpi2c_imx->base + LPI2C_MTDR);
256 264
257 return lpi2c_imx_bus_busy(lpi2c_imx);265 return lpi2c_imx_bus_busy(lpi2c_imx, atomic);
258}266}
259 267
260static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx)268static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx, bool atomic)
261{269{
262 unsigned long orig_jiffies = jiffies;
263 unsigned int temp;270 unsigned int temp;
271 int err;
264 272
265 writel(GEN_STOP << 8, lpi2c_imx->base + LPI2C_MTDR);273 writel(GEN_STOP << 8, lpi2c_imx->base + LPI2C_MTDR);
266 274
267 do {275 err = lpi2c_imx_read_msr_poll_timeout(atomic, temp, temp & MSR_SDF);
268 temp = readl(lpi2c_imx->base + LPI2C_MSR);
269 if (temp & MSR_SDF)
270 break;
271
272 if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) {
273 dev_dbg(&lpi2c_imx->adapter.dev, "stop timeout\n");
274 if (lpi2c_imx->adapter.bus_recovery_info)
275 i2c_recover_bus(&lpi2c_imx->adapter);
276 break;
277 }
278 schedule();
279 276
280 } while (1);277 if (err) {
278 dev_dbg(&lpi2c_imx->adapter.dev, "stop timeout\n");
279 if (lpi2c_imx->adapter.bus_recovery_info)
280 i2c_recover_bus(&lpi2c_imx->adapter);
281 }
281}282}
282 283
283/* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */284/* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */
@@ -391,28 +392,25 @@ static int lpi2c_imx_pio_msg_complete(struct lpi2c_imx_struct *lpi2c_imx) · 107 unmodified lines
391 return time_left ? 0 : -ETIMEDOUT;392 return time_left ? 0 : -ETIMEDOUT;
392}393}
393 394
394static int lpi2c_imx_txfifo_empty(struct lpi2c_imx_struct *lpi2c_imx)395static int lpi2c_imx_txfifo_empty(struct lpi2c_imx_struct *lpi2c_imx, bool atomic)
395{396{
396 unsigned long orig_jiffies = jiffies;397 unsigned int temp;
397 u32 txcnt;398 int err;
398
399 do {
400 txcnt = readl(lpi2c_imx->base + LPI2C_MFSR) & 0xff;
401 399
402 if (readl(lpi2c_imx->base + LPI2C_MSR) & MSR_NDF) {400 err = lpi2c_imx_read_msr_poll_timeout(atomic, temp,
403 dev_dbg(&lpi2c_imx->adapter.dev, "NDF detected\n");401 (temp & MSR_NDF) || !lpi2c_imx_txfifo_cnt(lpi2c_imx));
404 return -EIO;
405 }
406 402
407 if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) {403 if (temp & MSR_NDF) {
408 dev_dbg(&lpi2c_imx->adapter.dev, "txfifo empty timeout\n");404 dev_dbg(&lpi2c_imx->adapter.dev, "NDF detected\n");
409 if (lpi2c_imx->adapter.bus_recovery_info)405 return -EIO;
410 i2c_recover_bus(&lpi2c_imx->adapter);406 }
411 return -ETIMEDOUT;
412 }
413 schedule();
414 407
415 } while (txcnt);408 if (err) {
409 dev_dbg(&lpi2c_imx->adapter.dev, "txfifo empty timeout\n");
410 if (lpi2c_imx->adapter.bus_recovery_info)
411 i2c_recover_bus(&lpi2c_imx->adapter);
412 return -ETIMEDOUT;
413 }
416 414
417 return 0;415 return 0;
418}416}
@@ -436,7 +434,7 @@ static void lpi2c_imx_set_rx_watermark(struct lpi2c_imx_struct *lpi2c_imx) · 17 unmodified lines
436 writel(temp << 16, lpi2c_imx->base + LPI2C_MFCR);434 writel(temp << 16, lpi2c_imx->base + LPI2C_MFCR);
437}435}
438 436
439static void lpi2c_imx_write_txfifo(struct lpi2c_imx_struct *lpi2c_imx)437static bool lpi2c_imx_write_txfifo(struct lpi2c_imx_struct *lpi2c_imx, bool atomic)
440{438{
441 unsigned int data, txcnt;439 unsigned int data, txcnt;
442 440
@@ -451,13 +449,19 @@ static void lpi2c_imx_write_txfifo(struct lpi2c_imx_struct *lpi2c_imx) · 8 unmodified lines
451 txcnt++;449 txcnt++;
452 }450 }
453 451
454 if (lpi2c_imx->delivered < lpi2c_imx->msglen)452 if (lpi2c_imx->delivered < lpi2c_imx->msglen) {
455 lpi2c_imx_intctrl(lpi2c_imx, MIER_TDIE | MIER_NDIE);453 if (!atomic)
456 else454 lpi2c_imx_intctrl(lpi2c_imx, MIER_TDIE | MIER_NDIE);
455 return false;
456 }
457
458 if (!atomic)
457 complete(&lpi2c_imx->complete);459 complete(&lpi2c_imx->complete);
460
461 return true;
458}462}
459 463
460static void lpi2c_imx_read_rxfifo(struct lpi2c_imx_struct *lpi2c_imx)464static bool lpi2c_imx_read_rxfifo(struct lpi2c_imx_struct *lpi2c_imx, bool atomic)
461{465{
462 unsigned int blocklen, remaining;466 unsigned int blocklen, remaining;
463 unsigned int temp, data;467 unsigned int temp, data;
@@ -482,8 +486,9 @@ static void lpi2c_imx_read_rxfifo(struct lpi2c_imx_struct *lpi2c_imx) · 18 unmodified lines
482 remaining = lpi2c_imx->msglen - lpi2c_imx->delivered;486 remaining = lpi2c_imx->msglen - lpi2c_imx->delivered;
483 487
484 if (!remaining) {488 if (!remaining) {
485 complete(&lpi2c_imx->complete);489 if (!atomic)
486 return;490 complete(&lpi2c_imx->complete);
491 return true;
487 }492 }
488 493
489 /* not finished, still waiting for rx data */494 /* not finished, still waiting for rx data */
@@ -501,7 +506,10 @@ static void lpi2c_imx_read_rxfifo(struct lpi2c_imx_struct *lpi2c_imx) · 11 unmodified lines
501 writel(temp, lpi2c_imx->base + LPI2C_MTDR);506 writel(temp, lpi2c_imx->base + LPI2C_MTDR);
502 }507 }
503 508
504 lpi2c_imx_intctrl(lpi2c_imx, MIER_RDIE);509 if (!atomic)
510 lpi2c_imx_intctrl(lpi2c_imx, MIER_RDIE);
511
512 return false;
505}513}
506 514
507static void lpi2c_imx_write(struct lpi2c_imx_struct *lpi2c_imx,515static void lpi2c_imx_write(struct lpi2c_imx_struct *lpi2c_imx,
@@ -509,11 +517,29 @@ static void lpi2c_imx_write(struct lpi2c_imx_struct *lpi2c_imx, · 1 unmodified line
509{517{
510 lpi2c_imx->tx_buf = msgs->buf;518 lpi2c_imx->tx_buf = msgs->buf;
511 lpi2c_imx_set_tx_watermark(lpi2c_imx);519 lpi2c_imx_set_tx_watermark(lpi2c_imx);
512 lpi2c_imx_write_txfifo(lpi2c_imx);520 lpi2c_imx_write_txfifo(lpi2c_imx, false);
513}521}
514 522
515static void lpi2c_imx_read(struct lpi2c_imx_struct *lpi2c_imx,523static int lpi2c_imx_write_atomic(struct lpi2c_imx_struct *lpi2c_imx,
516 struct i2c_msg *msgs)524 struct i2c_msg *msgs)
525{
526 u32 temp;
527 int err;
528
529 lpi2c_imx->tx_buf = msgs->buf;
530
531 err = lpi2c_imx_read_msr_poll_timeout(true, temp,
532 (temp & MSR_NDF) ||
533 lpi2c_imx_write_txfifo(lpi2c_imx, true));
534
535 if (temp & MSR_NDF)
536 return -EIO;
537
538 return err;
539}
540
541static void lpi2c_imx_read_init(struct lpi2c_imx_struct *lpi2c_imx,
542 struct i2c_msg *msgs)
517{543{
518 unsigned int temp;544 unsigned int temp;
519 545
@@ -524,8 +550,43 @@ static void lpi2c_imx_read(struct lpi2c_imx_struct *lpi2c_imx, · 4 unmodified lines
524 temp = msgs->len > CHUNK_DATA ? CHUNK_DATA - 1 : msgs->len - 1;550 temp = msgs->len > CHUNK_DATA ? CHUNK_DATA - 1 : msgs->len - 1;
525 temp |= (RECV_DATA << 8);551 temp |= (RECV_DATA << 8);
526 writel(temp, lpi2c_imx->base + LPI2C_MTDR);552 writel(temp, lpi2c_imx->base + LPI2C_MTDR);
553}
554
555static bool lpi2c_imx_read_chunk_atomic(struct lpi2c_imx_struct *lpi2c_imx)
556{
557 u32 rxcnt;
558
559 rxcnt = (readl(lpi2c_imx->base + LPI2C_MFSR) >> 16) & 0xFF;
560 if (!rxcnt)
561 return false;
562
563 if (!lpi2c_imx_read_rxfifo(lpi2c_imx, true))
564 return false;
565
566 return true;
567}
568
569static int lpi2c_imx_read_atomic(struct lpi2c_imx_struct *lpi2c_imx,
570 struct i2c_msg *msgs)
571{
572 u32 temp;
573 int tmo_us;
574
575 tmo_us = 1000000;
576 do {
577 if (lpi2c_imx_read_chunk_atomic(lpi2c_imx))
578 return 0;
579
580 temp = readl(lpi2c_imx->base + LPI2C_MSR);
527 581
528 lpi2c_imx_intctrl(lpi2c_imx, MIER_RDIE | MIER_NDIE);582 if (temp & MSR_NDF)
583 return -EIO;
584
585 udelay(100);
586 tmo_us -= 100;
587 } while (tmo_us > 0);
588
589 return -ETIMEDOUT;
529}590}
530 591
531static bool is_use_dma(struct lpi2c_imx_struct *lpi2c_imx, struct i2c_msg *msg)592static bool is_use_dma(struct lpi2c_imx_struct *lpi2c_imx, struct i2c_msg *msg)
@@ -545,14 +606,27 @@ static int lpi2c_imx_pio_xfer(struct lpi2c_imx_struct *lpi2c_imx, · 13 unmodified lines
545{606{
546 reinit_completion(&lpi2c_imx->complete);607 reinit_completion(&lpi2c_imx->complete);
547 608
548 if (msg->flags & I2C_M_RD)609 if (msg->flags & I2C_M_RD) {
549 lpi2c_imx_read(lpi2c_imx, msg);610 lpi2c_imx_read_init(lpi2c_imx, msg);
550 else611 lpi2c_imx_intctrl(lpi2c_imx, MIER_RDIE | MIER_NDIE);
612 } else {
551 lpi2c_imx_write(lpi2c_imx, msg);613 lpi2c_imx_write(lpi2c_imx, msg);
614 }
552 615
553 return lpi2c_imx_pio_msg_complete(lpi2c_imx);616 return lpi2c_imx_pio_msg_complete(lpi2c_imx);
554}617}
555 618
619static int lpi2c_imx_pio_xfer_atomic(struct lpi2c_imx_struct *lpi2c_imx,
620 struct i2c_msg *msg)
621{
622 if (msg->flags & I2C_M_RD) {
623 lpi2c_imx_read_init(lpi2c_imx, msg);
624 return lpi2c_imx_read_atomic(lpi2c_imx, msg);
625 }
626
627 return lpi2c_imx_write_atomic(lpi2c_imx, msg);
628}
629
556static int lpi2c_imx_dma_timeout_calculate(struct lpi2c_imx_struct *lpi2c_imx)630static int lpi2c_imx_dma_timeout_calculate(struct lpi2c_imx_struct *lpi2c_imx)
557{631{
558 unsigned long time = 0;632 unsigned long time = 0;
@@ -563,7 +637,7 @@ static int lpi2c_imx_dma_timeout_calculate(struct lpi2c_imx_struct *lpi2c_imx) · 4 unmodified lines
563 time += 1;637 time += 1;
564 638
565 /* Double calculated time */639 /* Double calculated time */
566 return msecs_to_jiffies(time * MSEC_PER_SEC);640 return secs_to_jiffies(time);
567}641}
568 642
569static int lpi2c_imx_alloc_rx_cmd_buf(struct lpi2c_imx_struct *lpi2c_imx)643static int lpi2c_imx_alloc_rx_cmd_buf(struct lpi2c_imx_struct *lpi2c_imx)
@@ -947,8 +1021,8 @@ disable_dma: · 377 unmodified lines
947 return ret;1021 return ret;
948}1022}
949 1023
950static int lpi2c_imx_xfer(struct i2c_adapter *adapter,1024static int lpi2c_imx_xfer_common(struct i2c_adapter *adapter,
951 struct i2c_msg *msgs, int num)1025 struct i2c_msg *msgs, int num, bool atomic)
952{1026{
953 struct lpi2c_imx_struct *lpi2c_imx = i2c_get_adapdata(adapter);1027 struct lpi2c_imx_struct *lpi2c_imx = i2c_get_adapdata(adapter);
954 unsigned int temp;1028 unsigned int temp;
@@ -959,7 +1033,7 @@ static int lpi2c_imx_xfer(struct i2c_adapter *adapter, · 4 unmodified lines
959 return result;1033 return result;
960 1034
961 for (i = 0; i < num; i++) {1035 for (i = 0; i < num; i++) {
962 result = lpi2c_imx_start(lpi2c_imx, &msgs[i]);1036 result = lpi2c_imx_start(lpi2c_imx, &msgs[i], atomic);
963 if (result)1037 if (result)
964 goto disable;1038 goto disable;
965 1039
@@ -971,28 +1045,33 @@ static int lpi2c_imx_xfer(struct i2c_adapter *adapter, · 5 unmodified lines
971 lpi2c_imx->tx_buf = NULL;1045 lpi2c_imx->tx_buf = NULL;
972 lpi2c_imx->delivered = 0;1046 lpi2c_imx->delivered = 0;
973 lpi2c_imx->msglen = msgs[i].len;1047 lpi2c_imx->msglen = msgs[i].len;
974 init_completion(&lpi2c_imx->complete);
975 1048
976 if (is_use_dma(lpi2c_imx, &msgs[i])) {1049 if (atomic) {
977 result = lpi2c_imx_dma_xfer(lpi2c_imx, &msgs[i]);1050 result = lpi2c_imx_pio_xfer_atomic(lpi2c_imx, &msgs[i]);
978 if (result && lpi2c_imx->dma->using_pio_mode)
979 result = lpi2c_imx_pio_xfer(lpi2c_imx, &msgs[i]);
980 } else {1051 } else {
981 result = lpi2c_imx_pio_xfer(lpi2c_imx, &msgs[i]);1052 init_completion(&lpi2c_imx->complete);
1053
1054 if (is_use_dma(lpi2c_imx, &msgs[i])) {
1055 result = lpi2c_imx_dma_xfer(lpi2c_imx, &msgs[i]);
1056 if (result && lpi2c_imx->dma->using_pio_mode)
1057 result = lpi2c_imx_pio_xfer(lpi2c_imx, &msgs[i]);
1058 } else {
1059 result = lpi2c_imx_pio_xfer(lpi2c_imx, &msgs[i]);
1060 }
982 }1061 }
983 1062
984 if (result)1063 if (result)
985 goto stop;1064 goto stop;
986 1065
987 if (!(msgs[i].flags & I2C_M_RD)) {1066 if (!(msgs[i].flags & I2C_M_RD)) {
988 result = lpi2c_imx_txfifo_empty(lpi2c_imx);1067 result = lpi2c_imx_txfifo_empty(lpi2c_imx, atomic);
989 if (result)1068 if (result)
990 goto stop;1069 goto stop;
991 }1070 }
992 }1071 }
993 1072
994stop:1073stop:
995 lpi2c_imx_stop(lpi2c_imx);1074 lpi2c_imx_stop(lpi2c_imx, atomic);
996 1075
997 temp = readl(lpi2c_imx->base + LPI2C_MSR);1076 temp = readl(lpi2c_imx->base + LPI2C_MSR);
998 if ((temp & MSR_NDF) && !result)1077 if ((temp & MSR_NDF) && !result)
@@ -1008,6 +1087,16 @@ disable: · 9 unmodified lines
1008 return (result < 0) ? result : num;1087 return (result < 0) ? result : num;
1009}1088}
1010 1089
1090static int lpi2c_imx_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
1091{
1092 return lpi2c_imx_xfer_common(adapter, msgs, num, false);
1093}
1094
1095static int lpi2c_imx_xfer_atomic(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
1096{
1097 return lpi2c_imx_xfer_common(adapter, msgs, num, true);
1098}
1099
1011static irqreturn_t lpi2c_imx_target_isr(struct lpi2c_imx_struct *lpi2c_imx,1100static irqreturn_t lpi2c_imx_target_isr(struct lpi2c_imx_struct *lpi2c_imx,
1012 u32 ssr, u32 sier_filter)1101 u32 ssr, u32 sier_filter)
1013{1102{
@@ -1070,9 +1159,9 @@ static irqreturn_t lpi2c_imx_master_isr(struct lpi2c_imx_struct *lpi2c_imx) · 56 unmodified lines
1070 if (temp & MSR_NDF)1159 if (temp & MSR_NDF)
1071 complete(&lpi2c_imx->complete);1160 complete(&lpi2c_imx->complete);
1072 else if (temp & MSR_RDF)1161 else if (temp & MSR_RDF)
1073 lpi2c_imx_read_rxfifo(lpi2c_imx);1162 lpi2c_imx_read_rxfifo(lpi2c_imx, false);
1074 else if (temp & MSR_TDF)1163 else if (temp & MSR_TDF)
1075 lpi2c_imx_write_txfifo(lpi2c_imx);1164 lpi2c_imx_write_txfifo(lpi2c_imx, false);
1076 1165
1077 return IRQ_HANDLED;1166 return IRQ_HANDLED;
1078}1167}
@@ -1269,6 +1358,7 @@ static u32 lpi2c_imx_func(struct i2c_adapter *adapter) · 190 unmodified lines
1269 1358
1270static const struct i2c_algorithm lpi2c_imx_algo = {1359static const struct i2c_algorithm lpi2c_imx_algo = {
1271 .xfer = lpi2c_imx_xfer,1360 .xfer = lpi2c_imx_xfer,
1361 .xfer_atomic = lpi2c_imx_xfer_atomic,
1272 .functionality = lpi2c_imx_func,1362 .functionality = lpi2c_imx_func,
1273 .reg_target = lpi2c_imx_register_target,1363 .reg_target = lpi2c_imx_register_target,
1274 .unreg_target = lpi2c_imx_unregister_target,1364 .unreg_target = lpi2c_imx_unregister_target,
drivers/i2c/busses/i2c-imx.c+16−21
@@ -23,6 +23,7 @@ · 22 unmodified lines
23 23
24#include <linux/acpi.h>24#include <linux/acpi.h>
25#include <linux/clk.h>25#include <linux/clk.h>
26#include <linux/cleanup.h>
26#include <linux/completion.h>27#include <linux/completion.h>
27#include <linux/delay.h>28#include <linux/delay.h>
28#include <linux/dma-mapping.h>29#include <linux/dma-mapping.h>
@@ -891,13 +892,13 @@ static enum hrtimer_restart i2c_imx_slave_timeout(struct hrtimer *t) · 862 unmodified lines
891 struct imx_i2c_struct *i2c_imx = container_of(t, struct imx_i2c_struct,892 struct imx_i2c_struct *i2c_imx = container_of(t, struct imx_i2c_struct,
892 slave_timer);893 slave_timer);
893 unsigned int ctl, status;894 unsigned int ctl, status;
894 unsigned long flags;
895 895
896 spin_lock_irqsave(&i2c_imx->slave_lock, flags);896 guard(spinlock_irqsave)(&i2c_imx->slave_lock);
897
897 status = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR);898 status = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR);
898 ctl = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);899 ctl = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
899 i2c_imx_slave_handle(i2c_imx, status, ctl);900 i2c_imx_slave_handle(i2c_imx, status, ctl);
900 spin_unlock_irqrestore(&i2c_imx->slave_lock, flags);901
901 return HRTIMER_NORESTART;902 return HRTIMER_NORESTART;
902}903}
903 904
@@ -1126,32 +1127,26 @@ static irqreturn_t i2c_imx_isr(int irq, void *dev_id) · 222 unmodified lines
1126{1127{
1127 struct imx_i2c_struct *i2c_imx = dev_id;1128 struct imx_i2c_struct *i2c_imx = dev_id;
1128 unsigned int ctl, status;1129 unsigned int ctl, status;
1129 unsigned long flags;
1130 1130
1131 spin_lock_irqsave(&i2c_imx->slave_lock, flags);1131 scoped_guard(spinlock_irqsave, &i2c_imx->slave_lock) {
1132 status = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR);1132 status = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR);
1133 ctl = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);1133 ctl = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
1134
1135 if (!(status & I2SR_IIF))
1136 return IRQ_NONE;
1134 1137
1135 if (status & I2SR_IIF) {
1136 i2c_imx_clear_irq(i2c_imx, I2SR_IIF);1138 i2c_imx_clear_irq(i2c_imx, I2SR_IIF);
1139
1137 if (i2c_imx->slave) {1140 if (i2c_imx->slave) {
1138 if (!(ctl & I2CR_MSTA)) {1141 if (!(ctl & I2CR_MSTA))
1139 irqreturn_t ret;1142 return i2c_imx_slave_handle(i2c_imx,
1140 1143 status, ctl);
1141 ret = i2c_imx_slave_handle(i2c_imx,1144
1142 status, ctl);
1143 spin_unlock_irqrestore(&i2c_imx->slave_lock,
1144 flags);
1145 return ret;
1146 }
1147 i2c_imx_slave_finish_op(i2c_imx);1145 i2c_imx_slave_finish_op(i2c_imx);
1148 }1146 }
1149 spin_unlock_irqrestore(&i2c_imx->slave_lock, flags);
1150 return i2c_imx_master_isr(i2c_imx, status);
1151 }1147 }
1152 spin_unlock_irqrestore(&i2c_imx->slave_lock, flags);
1153 1148
1154 return IRQ_NONE;1149 return i2c_imx_master_isr(i2c_imx, status);
1155}1150}
1156 1151
1157static int i2c_imx_dma_write(struct imx_i2c_struct *i2c_imx,1152static int i2c_imx_dma_write(struct imx_i2c_struct *i2c_imx,
drivers/i2c/busses/i2c-riic.c+46−8
@@ -79,6 +79,7 @@ · 78 unmodified lines
79#define ICIER_SPIE BIT(3)79#define ICIER_SPIE BIT(3)
80 80
81#define ICSR2_NACKF BIT(4)81#define ICSR2_NACKF BIT(4)
82#define ICSR2_STOP BIT(3)
82 83
83#define ICBR_RESERVED GENMASK(7, 5) /* Should be 1 on writes */84#define ICBR_RESERVED GENMASK(7, 5) /* Should be 1 on writes */
84 85
@@ -102,6 +103,8 @@ enum riic_reg_list { · 17 unmodified lines
102 103
103struct riic_of_data {104struct riic_of_data {
104 const u8 *regs;105 const u8 *regs;
106 const struct riic_irq_desc *irqs;
107 u8 num_irqs;
105 bool fast_mode_plus;108 bool fast_mode_plus;
106};109};
107 110
@@ -324,6 +327,19 @@ static irqreturn_t riic_stop_isr(int irq, void *data) · 216 unmodified lines
324 return IRQ_HANDLED;327 return IRQ_HANDLED;
325}328}
326 329
330static irqreturn_t riic_eei_isr(int irq, void *data)
331{
332 u8 icsr2 = riic_readb(data, RIIC_ICSR2);
333
334 if (icsr2 & ICSR2_NACKF)
335 return riic_tend_isr(irq, data);
336
337 if (icsr2 & ICSR2_STOP)
338 return riic_stop_isr(irq, data);
339
340 return IRQ_NONE;
341}
342
327static u32 riic_func(struct i2c_adapter *adap)343static u32 riic_func(struct i2c_adapter *adap)
328{344{
329 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;345 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
@@ -495,6 +511,13 @@ static const struct riic_irq_desc riic_irqs[] = { · 165 unmodified lines
495 { .res_num = 5, .isr = riic_tend_isr, .name = "riic-nack" },511 { .res_num = 5, .isr = riic_tend_isr, .name = "riic-nack" },
496};512};
497 513
514static const struct riic_irq_desc riic_rzt2h_irqs[] = {
515 { .res_num = 0, .isr = riic_eei_isr, .name = "riic-eei" },
516 { .res_num = 1, .isr = riic_rdrf_isr, .name = "riic-rxi" },
517 { .res_num = 2, .isr = riic_tdre_isr, .name = "riic-txi" },
518 { .res_num = 3, .isr = riic_tend_isr, .name = "riic-tei" },
519};
520
498static int riic_i2c_probe(struct platform_device *pdev)521static int riic_i2c_probe(struct platform_device *pdev)
499{522{
500 struct device *dev = &pdev->dev;523 struct device *dev = &pdev->dev;
@@ -520,21 +543,23 @@ static int riic_i2c_probe(struct platform_device *pdev) · 19 unmodified lines
520 return dev_err_probe(dev, PTR_ERR(riic->rstc),543 return dev_err_probe(dev, PTR_ERR(riic->rstc),
521 "failed to acquire deasserted reset\n");544 "failed to acquire deasserted reset\n");
522 545
523 for (i = 0; i < ARRAY_SIZE(riic_irqs); i++) {546 riic->info = of_device_get_match_data(dev);
547
548 for (i = 0; i < riic->info->num_irqs; i++) {
549 const struct riic_irq_desc *irq_desc;
524 int irq;550 int irq;
525 551
526 irq = platform_get_irq(pdev, riic_irqs[i].res_num);552 irq_desc = &riic->info->irqs[i];
553 irq = platform_get_irq(pdev, irq_desc->res_num);
527 if (irq < 0)554 if (irq < 0)
528 return irq;555 return irq;
529 556
530 ret = devm_request_irq(dev, irq, riic_irqs[i].isr,557 ret = devm_request_irq(dev, irq, irq_desc->isr, 0, irq_desc->name, riic);
531 0, riic_irqs[i].name, riic);
532 if (ret)558 if (ret)
533 return dev_err_probe(dev, ret, "failed to request irq %s\n",559 return dev_err_probe(dev, ret, "failed to request irq %s\n",
534 riic_irqs[i].name);560 irq_desc->name);
535 }561 }
536 562
537 riic->info = of_device_get_match_data(dev);
538 563
539 adap = &riic->adapter;564 adap = &riic->adapter;
540 i2c_set_adapdata(adap, riic);565 i2c_set_adapdata(adap, riic);
@@ -606,11 +631,15 @@ static const u8 riic_rz_a_regs[RIIC_REG_END] = { · 65 unmodified lines
606 631
607static const struct riic_of_data riic_rz_a_info = {632static const struct riic_of_data riic_rz_a_info = {
608 .regs = riic_rz_a_regs,633 .regs = riic_rz_a_regs,
634 .irqs = riic_irqs,
635 .num_irqs = ARRAY_SIZE(riic_irqs),
609 .fast_mode_plus = true,636 .fast_mode_plus = true,
610};637};
611 638
612static const struct riic_of_data riic_rz_a1h_info = {639static const struct riic_of_data riic_rz_a1h_info = {
613 .regs = riic_rz_a_regs,640 .regs = riic_rz_a_regs,
641 .irqs = riic_irqs,
642 .num_irqs = ARRAY_SIZE(riic_irqs),
614};643};
615 644
616static const u8 riic_rz_v2h_regs[RIIC_REG_END] = {645static const u8 riic_rz_v2h_regs[RIIC_REG_END] = {
@@ -630,9 +659,17 @@ static const u8 riic_rz_v2h_regs[RIIC_REG_END] = { · 13 unmodified lines
630 659
631static const struct riic_of_data riic_rz_v2h_info = {660static const struct riic_of_data riic_rz_v2h_info = {
632 .regs = riic_rz_v2h_regs,661 .regs = riic_rz_v2h_regs,
662 .irqs = riic_irqs,
663 .num_irqs = ARRAY_SIZE(riic_irqs),
633 .fast_mode_plus = true,664 .fast_mode_plus = true,
634};665};
635 666
667static const struct riic_of_data riic_rz_t2h_info = {
668 .regs = riic_rz_v2h_regs,
669 .irqs = riic_rzt2h_irqs,
670 .num_irqs = ARRAY_SIZE(riic_rzt2h_irqs),
671};
672
636static int riic_i2c_suspend(struct device *dev)673static int riic_i2c_suspend(struct device *dev)
637{674{
638 struct riic_dev *riic = dev_get_drvdata(dev);675 struct riic_dev *riic = dev_get_drvdata(dev);
@@ -683,10 +720,11 @@ static const struct dev_pm_ops riic_i2c_pm_ops = { · 44 unmodified lines
683};720};
684 721
685static const struct of_device_id riic_i2c_dt_ids[] = {722static const struct of_device_id riic_i2c_dt_ids[] = {
686 { .compatible = "renesas,riic-rz", .data = &riic_rz_a_info },
687 { .compatible = "renesas,riic-r7s72100", .data = &riic_rz_a1h_info, },723 { .compatible = "renesas,riic-r7s72100", .data = &riic_rz_a1h_info, },
688 { .compatible = "renesas,riic-r9a09g057", .data = &riic_rz_v2h_info },724 { .compatible = "renesas,riic-r9a09g057", .data = &riic_rz_v2h_info },
689 { /* Sentinel */ },725 { .compatible = "renesas,riic-r9a09g077", .data = &riic_rz_t2h_info },
726 { .compatible = "renesas,riic-rz", .data = &riic_rz_a_info },
727 { /* Sentinel */ }
690};728};
691 729
692static struct platform_driver riic_i2c_driver = {730static struct platform_driver riic_i2c_driver = {
drivers/i2c/busses/i2c-st.c+6−13
@@ -13,6 +13,7 @@ · 12 unmodified lines
13#include <linux/i2c.h>13#include <linux/i2c.h>
14#include <linux/interrupt.h>14#include <linux/interrupt.h>
15#include <linux/io.h>15#include <linux/io.h>
16#include <linux/minmax.h>
16#include <linux/module.h>17#include <linux/module.h>
17#include <linux/of_address.h>18#include <linux/of_address.h>
18#include <linux/of_irq.h>19#include <linux/of_irq.h>
@@ -422,12 +423,8 @@ static void st_i2c_wr_fill_tx_fifo(struct st_i2c_dev *i2c_dev) · 403 unmodified lines
422 tx_fstat = readl_relaxed(i2c_dev->base + SSC_TX_FSTAT);423 tx_fstat = readl_relaxed(i2c_dev->base + SSC_TX_FSTAT);
423 tx_fstat &= SSC_TX_FSTAT_STATUS;424 tx_fstat &= SSC_TX_FSTAT_STATUS;
424 425
425 if (c->count < (SSC_TXFIFO_SIZE - tx_fstat))426 for (i = min(c->count, SSC_TXFIFO_SIZE - tx_fstat);
426 i = c->count;427 i > 0; i--, c->count--, c->buf++)
427 else
428 i = SSC_TXFIFO_SIZE - tx_fstat;
429
430 for (; i > 0; i--, c->count--, c->buf++)
431 st_i2c_write_tx_fifo(i2c_dev, *c->buf);428 st_i2c_write_tx_fifo(i2c_dev, *c->buf);
432}429}
433 430
@@ -439,7 +436,7 @@ static void st_i2c_wr_fill_tx_fifo(struct st_i2c_dev *i2c_dev) · 5 unmodified lines
439 * This functions fills the Tx FIFO with fixed pattern when436 * This functions fills the Tx FIFO with fixed pattern when
440 * in read mode to trigger clock.437 * in read mode to trigger clock.
441 */438 */
442static void st_i2c_rd_fill_tx_fifo(struct st_i2c_dev *i2c_dev, int max)439static void st_i2c_rd_fill_tx_fifo(struct st_i2c_dev *i2c_dev, u32 max)
443{440{
444 struct st_i2c_client *c = &i2c_dev->client;441 struct st_i2c_client *c = &i2c_dev->client;
445 u32 tx_fstat, sta;442 u32 tx_fstat, sta;
@@ -452,12 +449,8 @@ static void st_i2c_rd_fill_tx_fifo(struct st_i2c_dev *i2c_dev, int max) · 6 unmodified lines
452 tx_fstat = readl_relaxed(i2c_dev->base + SSC_TX_FSTAT);449 tx_fstat = readl_relaxed(i2c_dev->base + SSC_TX_FSTAT);
453 tx_fstat &= SSC_TX_FSTAT_STATUS;450 tx_fstat &= SSC_TX_FSTAT_STATUS;
454 451
455 if (max < (SSC_TXFIFO_SIZE - tx_fstat))452 for (i = min(max, SSC_TXFIFO_SIZE - tx_fstat);
456 i = max;453 i > 0; i--, c->xfered++)
457 else
458 i = SSC_TXFIFO_SIZE - tx_fstat;
459
460 for (; i > 0; i--, c->xfered++)
461 st_i2c_write_tx_fifo(i2c_dev, 0xff);454 st_i2c_write_tx_fifo(i2c_dev, 0xff);
462}455}
463 456
drivers/i2c/busses/i2c-stm32f7.c+2−1
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#include <linux/regmap.h>34#include <linux/regmap.h>
35#include <linux/reset.h>35#include <linux/reset.h>
36#include <linux/slab.h>36#include <linux/slab.h>
37#include <linux/string_choices.h>
37 38
38#include "i2c-stm32.h"39#include "i2c-stm32.h"
39 40
@@ -722,7 +723,7 @@ static int stm32f7_i2c_setup_timing(struct stm32f7_i2c_dev *i2c_dev, · 682 unmodified lines
722 dev_dbg(i2c_dev->dev, "I2C Rise(%i) and Fall(%i) Time\n",723 dev_dbg(i2c_dev->dev, "I2C Rise(%i) and Fall(%i) Time\n",
723 setup->rise_time, setup->fall_time);724 setup->rise_time, setup->fall_time);
724 dev_dbg(i2c_dev->dev, "I2C Analog Filter(%s), DNF(%i)\n",725 dev_dbg(i2c_dev->dev, "I2C Analog Filter(%s), DNF(%i)\n",
725 (i2c_dev->analog_filter ? "On" : "Off"), i2c_dev->dnf);726 str_on_off(i2c_dev->analog_filter), i2c_dev->dnf);
726 727
727 i2c_dev->bus_rate = setup->speed_freq;728 i2c_dev->bus_rate = setup->speed_freq;
728 729
drivers/i2c/busses/i2c-tegra.c+1−0
@@ -253,6 +253,7 @@ struct tegra_i2c_hw_feature { · 252 unmodified lines
253 * @dma_phys: handle to DMA resources253 * @dma_phys: handle to DMA resources
254 * @dma_buf: pointer to allocated DMA buffer254 * @dma_buf: pointer to allocated DMA buffer
255 * @dma_buf_size: DMA buffer size255 * @dma_buf_size: DMA buffer size
256 * @dma_dev: DMA device used for transfers
256 * @dma_mode: indicates active DMA transfer257 * @dma_mode: indicates active DMA transfer
257 * @dma_complete: DMA completion notifier258 * @dma_complete: DMA completion notifier
258 * @atomic_mode: indicates active atomic transfer259 * @atomic_mode: indicates active atomic transfer
drivers/i2c/i2c-core-acpi.c+1−1
@@ -250,7 +250,7 @@ static int i2c_acpi_get_info(struct acpi_device *adev, · 249 unmodified lines
250 250
251 if (adapter) {251 if (adapter) {
252 /* The adapter must match the one in I2cSerialBus() connector */252 /* The adapter must match the one in I2cSerialBus() connector */
253 if (ACPI_HANDLE(&adapter->dev) != lookup.adapter_handle)253 if (!device_match_acpi_handle(&adapter->dev, lookup.adapter_handle))
254 return -ENODEV;254 return -ENODEV;
255 } else {255 } else {
256 struct acpi_device *adapter_adev;256 struct acpi_device *adapter_adev;
drivers/i2c/i2c-core-base.c+7−1
@@ -1066,7 +1066,13 @@ void i2c_unregister_device(struct i2c_client *client) · 1065 unmodified lines
1066 of_node_clear_flag(to_of_node(fwnode), OF_POPULATED);1066 of_node_clear_flag(to_of_node(fwnode), OF_POPULATED);
1067 else if (is_acpi_device_node(fwnode))1067 else if (is_acpi_device_node(fwnode))
1068 acpi_device_clear_enumerated(to_acpi_device_node(fwnode));1068 acpi_device_clear_enumerated(to_acpi_device_node(fwnode));
1069 fwnode_handle_put(fwnode);1069
1070 /*
1071 * If the primary fwnode is a software node it is free-ed by
1072 * device_remove_software_node() below, avoid double-free.
1073 */
1074 if (!is_software_node(fwnode))
1075 fwnode_handle_put(fwnode);
1070 1076
1071 device_remove_software_node(&client->dev);1077 device_remove_software_node(&client->dev);
1072 device_unregister(&client->dev);1078 device_unregister(&client->dev);
drivers/i2c/muxes/i2c-mux-pca954x.c+1−2
@@ -442,8 +442,7 @@ static int pca954x_irq_setup(struct i2c_mux_core *muxc) · 441 unmodified lines
442 442
443 raw_spin_lock_init(&data->lock);443 raw_spin_lock_init(&data->lock);
444 444
445 data->irq = irq_domain_create_linear(of_fwnode_handle(client->dev.of_node),445 data->irq = irq_domain_create_linear(dev_fwnode(&client->dev), data->chip->nchans,
446 data->chip->nchans,
447 &irq_domain_simple_ops, data);446 &irq_domain_simple_ops, data);
448 if (!data->irq)447 if (!data->irq)
449 return -ENODEV;448 return -ENODEV;
include/uapi/linux/i2c.h+2−1
@@ -21,7 +21,8 @@ · 20 unmodified lines
21 *21 *
22 * @flags:22 * @flags:
23 * Supported by all adapters:23 * Supported by all adapters:
24 * %I2C_M_RD: read data (from slave to master). Guaranteed to be 0x0001!24 * %I2C_M_RD: read data (from slave to master). Guaranteed to be 0x0001! If
25 * not set, the transaction is interpreted as write.
25 *26 *
26 * Optional:27 * Optional:
27 * %I2C_M_DMA_SAFE: the buffer of this message is DMA safe. Makes only sense28 * %I2C_M_DMA_SAFE: the buffer of this message is DMA safe. Makes only sense