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

Pull i2c fixes from Wolfram Sang:
"All driver fixes this time:

- fix interrupt initialization sequence (npcm)

- fix frequency setting (ls2x)

- re-enable interrupts properly at irq handler's exit (amd-asf)"

* tag 'i2c-for-6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: amd-asf: Fix EOI register write to enable successive interrupts
i2c: ls2x: Fix frequency division register access
i2c: npcm: disable interrupt enable bit before devm_request_irq

+20 -4
+1
drivers/i2c/busses/i2c-amd-asf-plat.c
··· 293 293 amd_asf_update_ioport_target(piix4_smba, ASF_SLV_INTR, SMBHSTSTS, true); 294 294 } 295 295 296 + iowrite32(irq, dev->eoi_base); 296 297 return IRQ_HANDLED; 297 298 } 298 299
+12 -4
drivers/i2c/busses/i2c-ls2x.c
··· 10 10 * Rewritten for mainline by Binbin Zhou <zhoubinbin@loongson.cn> 11 11 */ 12 12 13 + #include <linux/bitfield.h> 13 14 #include <linux/bits.h> 14 15 #include <linux/completion.h> 15 16 #include <linux/device.h> ··· 27 26 #include <linux/units.h> 28 27 29 28 /* I2C Registers */ 30 - #define I2C_LS2X_PRER 0x0 /* Freq Division Register(16 bits) */ 29 + #define I2C_LS2X_PRER_LO 0x0 /* Freq Division Low Byte Register */ 30 + #define I2C_LS2X_PRER_HI 0x1 /* Freq Division High Byte Register */ 31 31 #define I2C_LS2X_CTR 0x2 /* Control Register */ 32 32 #define I2C_LS2X_TXR 0x3 /* Transport Data Register */ 33 33 #define I2C_LS2X_RXR 0x3 /* Receive Data Register */ ··· 95 93 */ 96 94 static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv) 97 95 { 96 + u16 val; 98 97 struct i2c_timings *t = &priv->i2c_t; 99 98 struct device *dev = priv->adapter.dev.parent; 100 99 u32 acpi_speed = i2c_acpi_find_bus_speed(dev); ··· 107 104 else 108 105 t->bus_freq_hz = LS2X_I2C_FREQ_STD; 109 106 110 - /* Calculate and set i2c frequency. */ 111 - writew(LS2X_I2C_PCLK_FREQ / (5 * t->bus_freq_hz) - 1, 112 - priv->base + I2C_LS2X_PRER); 107 + /* 108 + * According to the chip manual, we can only access the registers as bytes, 109 + * otherwise the high bits will be truncated. 110 + * So set the I2C frequency with a sequential writeb() instead of writew(). 111 + */ 112 + val = LS2X_I2C_PCLK_FREQ / (5 * t->bus_freq_hz) - 1; 113 + writeb(FIELD_GET(GENMASK(7, 0), val), priv->base + I2C_LS2X_PRER_LO); 114 + writeb(FIELD_GET(GENMASK(15, 8), val), priv->base + I2C_LS2X_PRER_HI); 113 115 } 114 116 115 117 static void ls2x_i2c_init(struct ls2x_i2c_priv *priv)
+7
drivers/i2c/busses/i2c-npcm7xx.c
··· 2554 2554 if (irq < 0) 2555 2555 return irq; 2556 2556 2557 + /* 2558 + * Disable the interrupt to avoid the interrupt handler being triggered 2559 + * incorrectly by the asynchronous interrupt status since the machine 2560 + * might do a warm reset during the last smbus/i2c transfer session. 2561 + */ 2562 + npcm_i2c_int_enable(bus, false); 2563 + 2557 2564 ret = devm_request_irq(bus->dev, irq, npcm_i2c_bus_irq, 0, 2558 2565 dev_name(bus->dev), bus); 2559 2566 if (ret)