This is a note to let you know that I've just added the patch titled i2c: piix4: Add EFCH MMIO support for SMBus port select to the 5.17-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: i2c-piix4-add-efch-mmio-support-for-smbus-port-select.patch and it can be found in the queue-5.17 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 381a3083c6747ae5cdbef9b176d57d1b966db49f Mon Sep 17 00:00:00 2001 From: Terry Bowman <terry.bowman@xxxxxxx> Date: Wed, 9 Feb 2022 11:27:16 -0600 Subject: i2c: piix4: Add EFCH MMIO support for SMBus port select From: Terry Bowman <terry.bowman@xxxxxxx> commit 381a3083c6747ae5cdbef9b176d57d1b966db49f upstream. 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@xxxxxxx> Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx> Reviewed-by: Jean Delvare <jdelvare@xxxxxxx> Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxx> Cc: Mario Limonciello <Mario.Limonciello@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/i2c/busses/i2c-piix4.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) --- 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 } } - 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); Patches currently in stable-queue which might be from terry.bowman@xxxxxxx are queue-5.17/watchdog-sp5100_tco-add-initialization-using-efch-mmio.patch queue-5.17/i2c-piix4-add-efch-mmio-support-to-region-request-and-release.patch queue-5.17/i2c-piix4-move-smbus-port-selection-into-function.patch queue-5.17/i2c-piix4-add-efch-mmio-support-to-smbus-base-address-detect.patch queue-5.17/i2c-piix4-move-port-i-o-region-request-release-code-into-functions.patch queue-5.17/i2c-piix4-replace-hardcoded-memory-map-size-with-a-define.patch queue-5.17/kernel-resource-introduce-request_mem_region_muxed.patch queue-5.17/i2c-piix4-enable-efch-mmio-for-family-17h.patch queue-5.17/watchdog-sp5100_tco-enable-family-17h-cpus.patch queue-5.17/watchdog-sp5100_tco-move-timer-initialization-into-function.patch queue-5.17/i2c-piix4-add-efch-mmio-support-for-smbus-port-select.patch queue-5.17/watchdog-sp5100_tco-refactor-mmio-base-address-initialization.patch queue-5.17/i2c-piix4-move-smbus-controller-base-address-detect-into-function.patch