[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220209172717.178813-9-terry.bowman@amd.com>
Date: Wed, 9 Feb 2022 11:27:16 -0600
From: Terry Bowman <terry.bowman@....com>
To: <terry.bowman@....com>, <linux@...ck-us.net>,
<linux-watchdog@...r.kernel.org>, <jdelvare@...e.com>,
<linux-i2c@...r.kernel.org>, <wsa@...nel.org>,
<andy.shevchenko@...il.com>, <rafael.j.wysocki@...el.com>
CC: <linux-kernel@...r.kernel.org>, <wim@...ux-watchdog.org>,
<rrichter@....com>, <thomas.lendacky@....com>,
<sudheesh.mavila@....com>, <Nehal-bakulchandra.Shah@....com>,
<Basavaraj.Natikar@....com>, <Shyam-sundar.S-k@....com>,
<Mario.Limonciello@....com>
Subject: [PATCH v5 8/9] i2c: piix4: Add EFCH MMIO support for SMBus port select
AMD processors include registers capable of selecting between 2 SMBus
ports. Port selection is made during each user access by writing to
FCH::PM::DECODEEN[smbus0sel]. Change the driver to use MMIO during
SMBus port selection because cd6h/cd7h port I/O is not available on
later AMD processors.
Signed-off-by: Terry Bowman <terry.bowman@....com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>
Reviewed-by: Jean Delvare <jdelvare@...e.de>
---
drivers/i2c/busses/i2c-piix4.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 7f312177eb27..4789fc9ad270 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -753,10 +753,19 @@ static void piix4_imc_wakeup(void)
release_region(KERNCZ_IMC_IDX, 2);
}
-static int piix4_sb800_port_sel(u8 port)
+static int piix4_sb800_port_sel(u8 port, struct sb800_mmio_cfg *mmio_cfg)
{
u8 smba_en_lo, val;
+ if (mmio_cfg->use_mmio) {
+ smba_en_lo = ioread8(mmio_cfg->addr + piix4_port_sel_sb800);
+ val = (smba_en_lo & ~piix4_port_mask_sb800) | port;
+ if (smba_en_lo != val)
+ iowrite8(val, mmio_cfg->addr + piix4_port_sel_sb800);
+
+ return (smba_en_lo & piix4_port_mask_sb800);
+ }
+
outb_p(piix4_port_sel_sb800, SB800_PIIX4_SMB_IDX);
smba_en_lo = inb_p(SB800_PIIX4_SMB_IDX + 1);
@@ -843,12 +852,12 @@ static s32 piix4_access_sb800(struct i2c_adapter *adap, u16 addr,
}
}
- prev_port = piix4_sb800_port_sel(adapdata->port);
+ prev_port = piix4_sb800_port_sel(adapdata->port, &adapdata->mmio_cfg);
retval = piix4_access(adap, addr, flags, read_write,
command, size, data);
- piix4_sb800_port_sel(prev_port);
+ piix4_sb800_port_sel(prev_port, &adapdata->mmio_cfg);
/* Release the semaphore */
outb_p(smbslvcnt | 0x20, SMBSLVCNT);
--
2.30.2
Powered by blists - more mailing lists