浏览代码

ARM: OMAP2+: pdata-quirks: Add device_is_enabled ops for IOMMUs and rprocs

Add a new .device_is_enabled() platform data callback ops to both
the OMAP IOMMU and remoteproc devices to check if the corresponding
omap_device/hwmod is already enabled. This helps the OMAP IOMMU and
remoteproc drivers to figure out if the corresponding processors
have already been loaded and booted by bootloaders.

Signed-off-by: Keerthy <j-keerthy@ti.com>
[s-anna@ti.com: minor cleanups]
Signed-off-by: Suman Anna <s-anna@ti.com>
Keerthy 6 年之前
父节点
当前提交
4f55ca9de0

+ 14 - 0
arch/arm/mach-omap2/pdata-quirks.c

@@ -49,7 +49,18 @@ struct pdata_init {
 static struct of_dev_auxdata omap_auxdata_lookup[];
 static struct twl4030_gpio_platform_data twl_gpio_auxdata;
 
+static bool __maybe_unused omap_device_is_enabled(struct platform_device *pdev)
+{
+	struct omap_device *od = to_omap_device(pdev);
+
+	if (od->_state == OMAP_DEVICE_STATE_ENABLED)
+		return true;
+	else
+		return false;
+}
+
 #if IS_ENABLED(CONFIG_OMAP_IOMMU)
+
 int omap_iommu_set_pwrdm_constraint(struct platform_device *pdev, bool request,
 				    u8 *pwrst);
 #else
@@ -436,6 +447,7 @@ static void __init omap3_pandora_legacy_init(void)
 static struct omap_rproc_pdata omap4_ipu_dsp_pdata = {
 	.device_enable = omap_rproc_device_enable,
 	.device_shutdown = omap_rproc_device_shutdown,
+	.device_is_enabled = omap_device_is_enabled,
 };
 #endif
 
@@ -447,6 +459,7 @@ static struct iommu_platform_data omap4_iommu_pdata = {
 	.deassert_reset = omap_device_deassert_hardreset,
 	.device_enable = omap_device_enable,
 	.device_idle = omap_device_idle,
+	.device_is_enabled = omap_device_is_enabled,
 };
 #endif
 
@@ -476,6 +489,7 @@ static struct iommu_platform_data dra7_ipu1_dsp_iommu_pdata = {
 	.assert_reset = omap_device_assert_hardreset,
 	.deassert_reset = omap_device_deassert_hardreset,
 	.device_enable = omap_device_enable,
+	.device_is_enabled = omap_device_is_enabled,
 	.device_idle = omap_device_idle,
 	.set_pwrdm_constraint = omap_iommu_set_pwrdm_constraint,
 };

+ 1 - 0
include/linux/platform_data/iommu-omap.h

@@ -17,6 +17,7 @@ struct iommu_platform_data {
 	int (*assert_reset)(struct platform_device *pdev, const char *name);
 	int (*deassert_reset)(struct platform_device *pdev, const char *name);
 	int (*device_enable)(struct platform_device *pdev);
+	bool (*device_is_enabled)(struct platform_device *pdev);
 	int (*device_idle)(struct platform_device *pdev);
 	int (*set_pwrdm_constraint)(struct platform_device *pdev, bool request,
 				    u8 *pwrst);

+ 2 - 0
include/linux/platform_data/remoteproc-omap.h

@@ -15,10 +15,12 @@ struct platform_device;
  * struct omap_rproc_pdata - omap remoteproc's platform data
  * @device_enable: omap-specific handler for enabling a device
  * @device_shutdown: omap-specific handler for shutting down a device
+ * @device_is_enabled: omap-specific handler to check if device is booted
  */
 struct omap_rproc_pdata {
 	int (*device_enable)(struct platform_device *pdev);
 	int (*device_shutdown)(struct platform_device *pdev);
+	bool (*device_is_enabled)(struct platform_device *pdev);
 };
 
 #endif /* _PLAT_REMOTEPROC_H */