Skip to content

Commit 9d855d4

Browse files
Kuppuswamy Sathyanarayananandy-shev
authored andcommitted
platform/x86: intel_pmc_ipc: Fix iTCO_wdt GCS memory mapping failure
iTCO_wdt driver need access to PMC_CFG GCR register to modify the noreboot setting. Currently, this is done by passing PMC_CFG reg address as memory resource to watchdog driver and allowing it directly modify the PMC_CFG register. But currently PMC driver also has requirement to memory map the entire GCR register space in this driver. This causes mem request failure in watchdog driver. So this patch fixes this issue by adding API to update noreboot flag and passes them to watchdog driver via platform data. Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 140c91b commit 9d855d4

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

‎drivers/platform/x86/intel_pmc_ipc.c‎

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@
112112
#define TCO_PMC_OFFSET 0x8
113113
#define TCO_PMC_SIZE 0x4
114114

115+
/* PMC register bit definitions */
116+
117+
/* PMC_CFG_REG bit masks */
118+
#define PMC_CFG_NO_REBOOT_MASK (1 << 4)
119+
#define PMC_CFG_NO_REBOOT_EN (1 << 4)
120+
#define PMC_CFG_NO_REBOOT_DIS (0 << 4)
121+
115122
static struct intel_pmc_ipc_dev {
116123
struct device *dev;
117124
void __iomem *ipc_base;
@@ -126,8 +133,6 @@ static struct intel_pmc_ipc_dev {
126133
struct platform_device *tco_dev;
127134

128135
/* gcr */
129-
resource_size_t gcr_base;
130-
int gcr_size;
131136
void __iomem *gcr_mem_base;
132137
bool has_gcr_regs;
133138

@@ -313,6 +318,14 @@ int intel_pmc_gcr_update(u32 offset, u32 mask, u32 val)
313318
}
314319
EXPORT_SYMBOL_GPL(intel_pmc_gcr_update);
315320

321+
static int update_no_reboot_bit(void *priv, bool set)
322+
{
323+
u32 value = set ? PMC_CFG_NO_REBOOT_EN : PMC_CFG_NO_REBOOT_DIS;
324+
325+
return intel_pmc_gcr_update(PMC_GCR_PMC_CFG_REG,
326+
PMC_CFG_NO_REBOOT_MASK, value);
327+
}
328+
316329
static int intel_pmc_ipc_check_status(void)
317330
{
318331
int status;
@@ -630,15 +643,13 @@ static struct resource tco_res[] = {
630643
{
631644
.flags = IORESOURCE_IO,
632645
},
633-
/* GCS */
634-
{
635-
.flags = IORESOURCE_MEM,
636-
},
637646
};
638647

639648
static struct itco_wdt_platform_data tco_info = {
640649
.name = "Apollo Lake SoC",
641650
.version = 5,
651+
.no_reboot_priv = &ipcdev,
652+
.update_no_reboot_bit = update_no_reboot_bit,
642653
};
643654

644655
#define TELEMETRY_RESOURCE_PUNIT_SSRAM 0
@@ -695,10 +706,6 @@ static int ipc_create_tco_device(void)
695706
res->start = ipcdev.acpi_io_base + SMI_EN_OFFSET;
696707
res->end = res->start + SMI_EN_SIZE - 1;
697708

698-
res = tco_res + TCO_RESOURCE_GCR_MEM;
699-
res->start = ipcdev.gcr_base + TCO_PMC_OFFSET;
700-
res->end = res->start + TCO_PMC_SIZE - 1;
701-
702709
pdev = platform_device_register_full(&pdevinfo);
703710
if (IS_ERR(pdev))
704711
return PTR_ERR(pdev);
@@ -860,9 +867,7 @@ static int ipc_plat_get_res(struct platform_device *pdev)
860867
}
861868
ipcdev.ipc_base = addr;
862869

863-
ipcdev.gcr_base = res->start + PLAT_RESOURCE_GCR_OFFSET;
864870
ipcdev.gcr_mem_base = addr + PLAT_RESOURCE_GCR_OFFSET;
865-
ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE;
866871
dev_info(&pdev->dev, "ipc res: %pR\n", res);
867872

868873
ipcdev.telem_res_inval = 0;

0 commit comments

Comments
 (0)