Commit 5d071633 authored by Aubrey Li's avatar Aubrey Li Committed by Darren Hart

platform:x86 decouple telemetry driver from the optional IPC resources

Currently the optional IPC resources prevent telemetry driver from
probing if these resources are not in ACPI table. This patch decouples
telemetry driver from these optional resources, so that telemetry driver
has dependency only on the necessary ACPI resources.
Signed-off-by: default avatarAubrey Li <aubrey.li@linux.intel.com>
Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
parent a7718360
...@@ -687,8 +687,8 @@ static int ipc_plat_get_res(struct platform_device *pdev) ...@@ -687,8 +687,8 @@ static int ipc_plat_get_res(struct platform_device *pdev)
ipcdev.acpi_io_size = size; ipcdev.acpi_io_size = size;
dev_info(&pdev->dev, "io res: %pR\n", res); dev_info(&pdev->dev, "io res: %pR\n", res);
/* This is index 0 to cover BIOS data register */
punit_res = punit_res_array; punit_res = punit_res_array;
/* This is index 0 to cover BIOS data register */
res = platform_get_resource(pdev, IORESOURCE_MEM, res = platform_get_resource(pdev, IORESOURCE_MEM,
PLAT_RESOURCE_BIOS_DATA_INDEX); PLAT_RESOURCE_BIOS_DATA_INDEX);
if (!res) { if (!res) {
...@@ -698,55 +698,51 @@ static int ipc_plat_get_res(struct platform_device *pdev) ...@@ -698,55 +698,51 @@ static int ipc_plat_get_res(struct platform_device *pdev)
*punit_res = *res; *punit_res = *res;
dev_info(&pdev->dev, "punit BIOS data res: %pR\n", res); dev_info(&pdev->dev, "punit BIOS data res: %pR\n", res);
/* This is index 1 to cover BIOS interface register */
res = platform_get_resource(pdev, IORESOURCE_MEM, res = platform_get_resource(pdev, IORESOURCE_MEM,
PLAT_RESOURCE_BIOS_IFACE_INDEX); PLAT_RESOURCE_BIOS_IFACE_INDEX);
if (!res) { if (!res) {
dev_err(&pdev->dev, "Failed to get res of punit BIOS iface\n"); dev_err(&pdev->dev, "Failed to get res of punit BIOS iface\n");
return -ENXIO; return -ENXIO;
} }
/* This is index 1 to cover BIOS interface register */
*++punit_res = *res; *++punit_res = *res;
dev_info(&pdev->dev, "punit BIOS interface res: %pR\n", res); dev_info(&pdev->dev, "punit BIOS interface res: %pR\n", res);
/* This is index 2 to cover ISP data register, optional */
res = platform_get_resource(pdev, IORESOURCE_MEM, res = platform_get_resource(pdev, IORESOURCE_MEM,
PLAT_RESOURCE_ISP_DATA_INDEX); PLAT_RESOURCE_ISP_DATA_INDEX);
if (!res) { ++punit_res;
dev_err(&pdev->dev, "Failed to get res of punit ISP data\n"); if (res) {
return -ENXIO; *punit_res = *res;
dev_info(&pdev->dev, "punit ISP data res: %pR\n", res);
} }
/* This is index 2 to cover ISP data register */
*++punit_res = *res;
dev_info(&pdev->dev, "punit ISP data res: %pR\n", res);
/* This is index 3 to cover ISP interface register, optional */
res = platform_get_resource(pdev, IORESOURCE_MEM, res = platform_get_resource(pdev, IORESOURCE_MEM,
PLAT_RESOURCE_ISP_IFACE_INDEX); PLAT_RESOURCE_ISP_IFACE_INDEX);
if (!res) { ++punit_res;
dev_err(&pdev->dev, "Failed to get res of punit ISP iface\n"); if (res) {
return -ENXIO; *punit_res = *res;
dev_info(&pdev->dev, "punit ISP interface res: %pR\n", res);
} }
/* This is index 3 to cover ISP interface register */
*++punit_res = *res;
dev_info(&pdev->dev, "punit ISP interface res: %pR\n", res);
/* This is index 4 to cover GTD data register, optional */
res = platform_get_resource(pdev, IORESOURCE_MEM, res = platform_get_resource(pdev, IORESOURCE_MEM,
PLAT_RESOURCE_GTD_DATA_INDEX); PLAT_RESOURCE_GTD_DATA_INDEX);
if (!res) { ++punit_res;
dev_err(&pdev->dev, "Failed to get res of punit GTD data\n"); if (res) {
return -ENXIO; *punit_res = *res;
dev_info(&pdev->dev, "punit GTD data res: %pR\n", res);
} }
/* This is index 4 to cover GTD data register */
*++punit_res = *res;
dev_info(&pdev->dev, "punit GTD data res: %pR\n", res);
/* This is index 5 to cover GTD interface register, optional */
res = platform_get_resource(pdev, IORESOURCE_MEM, res = platform_get_resource(pdev, IORESOURCE_MEM,
PLAT_RESOURCE_GTD_IFACE_INDEX); PLAT_RESOURCE_GTD_IFACE_INDEX);
if (!res) { ++punit_res;
dev_err(&pdev->dev, "Failed to get res of punit GTD iface\n"); if (res) {
return -ENXIO; *punit_res = *res;
dev_info(&pdev->dev, "punit GTD interface res: %pR\n", res);
} }
/* This is index 5 to cover GTD interface register */
*++punit_res = *res;
dev_info(&pdev->dev, "punit GTD interface res: %pR\n", res);
res = platform_get_resource(pdev, IORESOURCE_MEM, res = platform_get_resource(pdev, IORESOURCE_MEM,
PLAT_RESOURCE_IPC_INDEX); PLAT_RESOURCE_IPC_INDEX);
......
...@@ -227,6 +227,11 @@ static int intel_punit_get_bars(struct platform_device *pdev) ...@@ -227,6 +227,11 @@ static int intel_punit_get_bars(struct platform_device *pdev)
struct resource *res; struct resource *res;
void __iomem *addr; void __iomem *addr;
/*
* The following resources are required
* - BIOS_IPC BASE_DATA
* - BIOS_IPC BASE_IFACE
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
addr = devm_ioremap_resource(&pdev->dev, res); addr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(addr)) if (IS_ERR(addr))
...@@ -239,29 +244,40 @@ static int intel_punit_get_bars(struct platform_device *pdev) ...@@ -239,29 +244,40 @@ static int intel_punit_get_bars(struct platform_device *pdev)
return PTR_ERR(addr); return PTR_ERR(addr);
punit_ipcdev->base[BIOS_IPC][BASE_IFACE] = addr; punit_ipcdev->base[BIOS_IPC][BASE_IFACE] = addr;
/*
* The following resources are optional
* - ISPDRIVER_IPC BASE_DATA
* - ISPDRIVER_IPC BASE_IFACE
* - GTDRIVER_IPC BASE_DATA
* - GTDRIVER_IPC BASE_IFACE
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, 2); res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
addr = devm_ioremap_resource(&pdev->dev, res); if (res) {
if (IS_ERR(addr)) addr = devm_ioremap_resource(&pdev->dev, res);
return PTR_ERR(addr); if (!IS_ERR(addr))
punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr; punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 3); res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
addr = devm_ioremap_resource(&pdev->dev, res); if (res) {
if (IS_ERR(addr)) addr = devm_ioremap_resource(&pdev->dev, res);
return PTR_ERR(addr); if (!IS_ERR(addr))
punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr; punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 4); res = platform_get_resource(pdev, IORESOURCE_MEM, 4);
addr = devm_ioremap_resource(&pdev->dev, res); if (res) {
if (IS_ERR(addr)) addr = devm_ioremap_resource(&pdev->dev, res);
return PTR_ERR(addr); if (!IS_ERR(addr))
punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr; punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 5); res = platform_get_resource(pdev, IORESOURCE_MEM, 5);
addr = devm_ioremap_resource(&pdev->dev, res); if (res) {
if (IS_ERR(addr)) addr = devm_ioremap_resource(&pdev->dev, res);
return PTR_ERR(addr); if (!IS_ERR(addr))
punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr; punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment