Skip to content

Commit 911c288

Browse files
author
Wolfram Sang
committed
Merge tag 'i2c-host-fixes-6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux into i2c/for-current
i2c-host-fixes for v6.14-rc5 - npcm fixes interrupt initialization sequence. - ls2x fixes frequency setting. - amd-asf re-enables interrupts properly at irq handler's exit.
2 parents d082ecb + 9f3c507 commit 911c288

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

drivers/i2c/busses/i2c-amd-asf-plat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ static irqreturn_t amd_asf_irq_handler(int irq, void *ptr)
293293
amd_asf_update_ioport_target(piix4_smba, ASF_SLV_INTR, SMBHSTSTS, true);
294294
}
295295

296+
iowrite32(irq, dev->eoi_base);
296297
return IRQ_HANDLED;
297298
}
298299

drivers/i2c/busses/i2c-ls2x.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Rewritten for mainline by Binbin Zhou <[email protected]>
1111
*/
1212

13+
#include <linux/bitfield.h>
1314
#include <linux/bits.h>
1415
#include <linux/completion.h>
1516
#include <linux/device.h>
@@ -26,7 +27,8 @@
2627
#include <linux/units.h>
2728

2829
/* I2C Registers */
29-
#define I2C_LS2X_PRER 0x0 /* Freq Division Register(16 bits) */
30+
#define I2C_LS2X_PRER_LO 0x0 /* Freq Division Low Byte Register */
31+
#define I2C_LS2X_PRER_HI 0x1 /* Freq Division High Byte Register */
3032
#define I2C_LS2X_CTR 0x2 /* Control Register */
3133
#define I2C_LS2X_TXR 0x3 /* Transport Data Register */
3234
#define I2C_LS2X_RXR 0x3 /* Receive Data Register */
@@ -93,6 +95,7 @@ static irqreturn_t ls2x_i2c_isr(int this_irq, void *dev_id)
9395
*/
9496
static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
9597
{
98+
u16 val;
9699
struct i2c_timings *t = &priv->i2c_t;
97100
struct device *dev = priv->adapter.dev.parent;
98101
u32 acpi_speed = i2c_acpi_find_bus_speed(dev);
@@ -104,9 +107,14 @@ static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
104107
else
105108
t->bus_freq_hz = LS2X_I2C_FREQ_STD;
106109

107-
/* Calculate and set i2c frequency. */
108-
writew(LS2X_I2C_PCLK_FREQ / (5 * t->bus_freq_hz) - 1,
109-
priv->base + I2C_LS2X_PRER);
110+
/*
111+
* According to the chip manual, we can only access the registers as bytes,
112+
* otherwise the high bits will be truncated.
113+
* So set the I2C frequency with a sequential writeb() instead of writew().
114+
*/
115+
val = LS2X_I2C_PCLK_FREQ / (5 * t->bus_freq_hz) - 1;
116+
writeb(FIELD_GET(GENMASK(7, 0), val), priv->base + I2C_LS2X_PRER_LO);
117+
writeb(FIELD_GET(GENMASK(15, 8), val), priv->base + I2C_LS2X_PRER_HI);
110118
}
111119

112120
static void ls2x_i2c_init(struct ls2x_i2c_priv *priv)

drivers/i2c/busses/i2c-npcm7xx.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,6 +2554,13 @@ static int npcm_i2c_probe_bus(struct platform_device *pdev)
25542554
if (irq < 0)
25552555
return irq;
25562556

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+
25572564
ret = devm_request_irq(bus->dev, irq, npcm_i2c_bus_irq, 0,
25582565
dev_name(bus->dev), bus);
25592566
if (ret)

0 commit comments

Comments
 (0)