Skip to content

Commit 624b0d5

Browse files
superm1Ingo Molnar
authored andcommitted
i2c: piix4, x86/platform: Move the SB800 PIIX4 FCH definitions to <asm/amd/fch.h>
SB800_PIIX4_FCH_PM_ADDR is used to indicate the base address for the FCH PM registers. Multiple drivers may need this base address, so move related defines to a common header location and rename them accordingly. Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Acked-by: Andi Shyti <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Ilpo Järvinen <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Sanket Goswami <[email protected]> Cc: Shyam Sundar S K <[email protected]> Cc: Yazen Ghannam <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 7e173eb commit 624b0d5

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

arch/x86/include/asm/amd/fch.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _ASM_X86_AMD_FCH_H_
3+
#define _ASM_X86_AMD_FCH_H_
4+
5+
#define FCH_PM_BASE 0xFED80300
6+
7+
/* Register offsets from PM base: */
8+
#define FCH_PM_DECODEEN 0x00
9+
#define FCH_PM_DECODEEN_SMBUS0SEL GENMASK(20, 19)
10+
11+
#endif /* _ASM_X86_AMD_FCH_H_ */

drivers/i2c/busses/i2c-piix4.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <linux/dmi.h>
3535
#include <linux/acpi.h>
3636
#include <linux/io.h>
37+
#include <asm/amd/fch.h>
3738

3839
#include "i2c-piix4.h"
3940

@@ -80,12 +81,11 @@
8081
#define SB800_PIIX4_PORT_IDX_MASK 0x06
8182
#define SB800_PIIX4_PORT_IDX_SHIFT 1
8283

83-
/* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
84-
#define SB800_PIIX4_PORT_IDX_KERNCZ 0x02
85-
#define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18
84+
/* SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
85+
#define SB800_PIIX4_PORT_IDX_KERNCZ (FCH_PM_DECODEEN + 0x02)
86+
#define SB800_PIIX4_PORT_IDX_MASK_KERNCZ (FCH_PM_DECODEEN_SMBUS0SEL >> 16)
8687
#define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3
8788

88-
#define SB800_PIIX4_FCH_PM_ADDR 0xFED80300
8989
#define SB800_PIIX4_FCH_PM_SIZE 8
9090
#define SB800_ASF_ACPI_PATH "\\_SB.ASFC"
9191

@@ -162,19 +162,19 @@ int piix4_sb800_region_request(struct device *dev, struct sb800_mmio_cfg *mmio_c
162162
if (mmio_cfg->use_mmio) {
163163
void __iomem *addr;
164164

165-
if (!request_mem_region_muxed(SB800_PIIX4_FCH_PM_ADDR,
165+
if (!request_mem_region_muxed(FCH_PM_BASE,
166166
SB800_PIIX4_FCH_PM_SIZE,
167167
"sb800_piix4_smb")) {
168168
dev_err(dev,
169169
"SMBus base address memory region 0x%x already in use.\n",
170-
SB800_PIIX4_FCH_PM_ADDR);
170+
FCH_PM_BASE);
171171
return -EBUSY;
172172
}
173173

174-
addr = ioremap(SB800_PIIX4_FCH_PM_ADDR,
174+
addr = ioremap(FCH_PM_BASE,
175175
SB800_PIIX4_FCH_PM_SIZE);
176176
if (!addr) {
177-
release_mem_region(SB800_PIIX4_FCH_PM_ADDR,
177+
release_mem_region(FCH_PM_BASE,
178178
SB800_PIIX4_FCH_PM_SIZE);
179179
dev_err(dev, "SMBus base address mapping failed.\n");
180180
return -ENOMEM;
@@ -201,7 +201,7 @@ void piix4_sb800_region_release(struct device *dev, struct sb800_mmio_cfg *mmio_
201201
{
202202
if (mmio_cfg->use_mmio) {
203203
iounmap(mmio_cfg->addr);
204-
release_mem_region(SB800_PIIX4_FCH_PM_ADDR,
204+
release_mem_region(FCH_PM_BASE,
205205
SB800_PIIX4_FCH_PM_SIZE);
206206
return;
207207
}

0 commit comments

Comments
 (0)