diff mbox series

[v1,6/7] soc: imx: gpcv2: add quirks to domains

Message ID 20210407212122.626137-7-adrien.grassein@gmail.com (mailing list archive)
State New
Headers show
Series imx-gpcv2 improvements | expand

Commit Message

Adrien Grassein April 7, 2021, 9:21 p.m. UTC
Some domains need quirks during their operation.
For example, on i.MX8MM, USB domains should not be powered off.

Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
---
 drivers/soc/imx/gpcv2.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 571d0381dd87..592b9808dcd4 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -119,6 +119,10 @@ 
 
 #define GPC_CLK_MAX		6
 
+/* Quirks */
+//Refuse to poweroff the domain
+#define GPC_QUIRKS_DONT_POWEROFF BIT(0)
+
 static DEFINE_MUTEX(gpc_pd_mutex);
 
 struct imx_pgc_domain {
@@ -139,6 +143,7 @@  struct imx_pgc_domain {
 
 	const int voltage;
 	struct device *dev;
+	const unsigned int quirks;
 };
 
 struct imx_pgc_domain_data {
@@ -263,6 +268,9 @@  static int imx_gpc_pu_pgc_sw_pdn_req(struct generic_pm_domain *genpd)
 	int i, ret = 0;
 	u32 value;
 
+	if (domain->quirks & GPC_QUIRKS_DONT_POWEROFF)
+		return 0;
+
 	mutex_lock(&gpc_pd_mutex);
 
 	/* Enable reset clocks for all devices in the domain */
@@ -606,6 +614,7 @@  static const struct imx_pgc_domain imx8mm_pgc_domains[] = {
 			.map = IMX8MM_OTG1_A53_DOMAIN,
 		},
 		.pgc        = IMX8MM_PGC_OTG1,
+		.quirks     = GPC_QUIRKS_DONT_POWEROFF,
 	},
 
 	[IMX8MM_POWER_DOMAIN_USB_OTG2] = {
@@ -617,6 +626,7 @@  static const struct imx_pgc_domain imx8mm_pgc_domains[] = {
 			.map = IMX8MM_OTG2_A53_DOMAIN,
 		},
 		.pgc        = IMX8MM_PGC_OTG2,
+		.quirks     = GPC_QUIRKS_DONT_POWEROFF,
 	},
 };