Skip to content

Commit b1f8921

Browse files
Shyam Sundar S KAndi Shyti
authored andcommitted
i2c: amd-asf: Clear remote IRR bit to get successive interrupt
To ensure successive interrupts upon packet reception, it is necessary to clear the remote IRR bit by writing the interrupt number to the EOI register. The base address for this operation is provided by the BIOS and retrieved by the driver by traversing the ASF object's namespace. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
1 parent 9b25419 commit b1f8921

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
struct amd_asf_dev {
5050
struct i2c_adapter adap;
51+
void __iomem *eoi_base;
5152
struct i2c_client *target;
5253
struct delayed_work work_buf;
5354
struct sb800_mmio_cfg mmio_cfg;
@@ -299,6 +300,7 @@ static int amd_asf_probe(struct platform_device *pdev)
299300
{
300301
struct device *dev = &pdev->dev;
301302
struct amd_asf_dev *asf_dev;
303+
struct resource *eoi_addr;
302304
int ret, irq;
303305

304306
asf_dev = devm_kzalloc(dev, sizeof(*asf_dev), GFP_KERNEL);
@@ -310,6 +312,21 @@ static int amd_asf_probe(struct platform_device *pdev)
310312
if (!asf_dev->port_addr)
311313
return dev_err_probe(dev, -EINVAL, "missing IO resources\n");
312314

315+
/*
316+
* The resource obtained via ACPI might not belong to the ASF device address space. Instead,
317+
* it could be within other IP blocks of the ASIC, which are crucial for generating
318+
* subsequent interrupts. Therefore, we avoid using devm_platform_ioremap_resource() and
319+
* use platform_get_resource() and devm_ioremap() separately to prevent any address space
320+
* conflicts.
321+
*/
322+
eoi_addr = platform_get_resource(pdev, IORESOURCE_MEM, 0);
323+
if (!eoi_addr)
324+
return dev_err_probe(dev, -EINVAL, "missing MEM resources\n");
325+
326+
asf_dev->eoi_base = devm_ioremap(dev, eoi_addr->start, resource_size(eoi_addr));
327+
if (!asf_dev->eoi_base)
328+
return dev_err_probe(dev, -EBUSY, "failed mapping IO region\n");
329+
313330
ret = devm_delayed_work_autocancel(dev, &asf_dev->work_buf, amd_asf_process_target);
314331
if (ret)
315332
return dev_err_probe(dev, ret, "failed to create work queue\n");

0 commit comments

Comments
 (0)