clk: qcom: add common gdsc_gx_do_nothing_enable for gpucc drivers
authorJonathan Marek <jonathan@marek.ca>
Thu, 9 Jul 2020 13:52:40 +0000 (09:52 -0400)
committerStephen Boyd <sboyd@kernel.org>
Fri, 24 Jul 2020 08:51:26 +0000 (01:51 -0700)
All gpucc drivers need this, so move it to common code instead of
duplicating it in every gpucc driver.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20200709135251.643-10-jonathan@marek.ca
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/qcom/gdsc.c
drivers/clk/qcom/gdsc.h
drivers/clk/qcom/gpucc-sc7180.c
drivers/clk/qcom/gpucc-sdm845.c

index 04944f11659b659eaae355a8c4ce7290e387259e..6283977037177ea58ccf47b8a76ace12638a5330 100644 (file)
@@ -433,3 +433,28 @@ void gdsc_unregister(struct gdsc_desc *desc)
        }
        of_genpd_del_provider(dev->of_node);
 }
+
+/*
+ * On SDM845+ the GPU GX domain is *almost* entirely controlled by the GMU
+ * running in the CX domain so the CPU doesn't need to know anything about the
+ * GX domain EXCEPT....
+ *
+ * Hardware constraints dictate that the GX be powered down before the CX. If
+ * the GMU crashes it could leave the GX on. In order to successfully bring back
+ * the device the CPU needs to disable the GX headswitch. There being no sane
+ * way to reach in and touch that register from deep inside the GPU driver we
+ * need to set up the infrastructure to be able to ensure that the GPU can
+ * ensure that the GX is off during this super special case. We do this by
+ * defining a GX gdsc with a dummy enable function and a "default" disable
+ * function.
+ *
+ * This allows us to attach with genpd_dev_pm_attach_by_name() in the GPU
+ * driver. During power up, nothing will happen from the CPU (and the GMU will
+ * power up normally but during power down this will ensure that the GX domain
+ * is *really* off - this gives us a semi standard way of doing what we need.
+ */
+int gdsc_gx_do_nothing_enable(struct generic_pm_domain *domain)
+{
+       /* Do nothing but give genpd the impression that we were successful */
+       return 0;
+}
index c36fc26dcdffe125a6493c9d1edf6938425125b0..1896bfb2bbd1bb66e34839b1a374ad9e322314d2 100644 (file)
@@ -68,6 +68,7 @@ struct gdsc_desc {
 int gdsc_register(struct gdsc_desc *desc, struct reset_controller_dev *,
                  struct regmap *);
 void gdsc_unregister(struct gdsc_desc *desc);
+int gdsc_gx_do_nothing_enable(struct generic_pm_domain *domain);
 #else
 static inline int gdsc_register(struct gdsc_desc *desc,
                                struct reset_controller_dev *rcdev,
index 7b656b6aecedb26cdcb2bd0b764126d05182b28c..88a739b6fec3997c55ef0dcdbeb8c2fde6bce3b0 100644 (file)
@@ -170,37 +170,12 @@ static struct gdsc cx_gdsc = {
        .flags = VOTABLE,
 };
 
-/*
- * On SC7180 the GPU GX domain is *almost* entirely controlled by the GMU
- * running in the CX domain so the CPU doesn't need to know anything about the
- * GX domain EXCEPT....
- *
- * Hardware constraints dictate that the GX be powered down before the CX. If
- * the GMU crashes it could leave the GX on. In order to successfully bring back
- * the device the CPU needs to disable the GX headswitch. There being no sane
- * way to reach in and touch that register from deep inside the GPU driver we
- * need to set up the infrastructure to be able to ensure that the GPU can
- * ensure that the GX is off during this super special case. We do this by
- * defining a GX gdsc with a dummy enable function and a "default" disable
- * function.
- *
- * This allows us to attach with genpd_dev_pm_attach_by_name() in the GPU
- * driver. During power up, nothing will happen from the CPU (and the GMU will
- * power up normally but during power down this will ensure that the GX domain
- * is *really* off - this gives us a semi standard way of doing what we need.
- */
-static int gx_gdsc_enable(struct generic_pm_domain *domain)
-{
-       /* Do nothing but give genpd the impression that we were successful */
-       return 0;
-}
-
 static struct gdsc gx_gdsc = {
        .gdscr = 0x100c,
        .clamp_io_ctrl = 0x1508,
        .pd = {
                .name = "gx_gdsc",
-               .power_on = gx_gdsc_enable,
+               .power_on = gdsc_gx_do_nothing_enable,
        },
        .pwrsts = PWRSTS_OFF_ON,
        .flags = CLAMP_IO,
index e40efba1bf7d4c9a63d5cd923bb3c68a80e90eb2..5663698b306b9df623a940076bdebf20052693ae 100644 (file)
@@ -131,37 +131,12 @@ static struct gdsc gpu_cx_gdsc = {
        .flags = VOTABLE,
 };
 
-/*
- * On SDM845 the GPU GX domain is *almost* entirely controlled by the GMU
- * running in the CX domain so the CPU doesn't need to know anything about the
- * GX domain EXCEPT....
- *
- * Hardware constraints dictate that the GX be powered down before the CX. If
- * the GMU crashes it could leave the GX on. In order to successfully bring back
- * the device the CPU needs to disable the GX headswitch. There being no sane
- * way to reach in and touch that register from deep inside the GPU driver we
- * need to set up the infrastructure to be able to ensure that the GPU can
- * ensure that the GX is off during this super special case. We do this by
- * defining a GX gdsc with a dummy enable function and a "default" disable
- * function.
- *
- * This allows us to attach with genpd_dev_pm_attach_by_name() in the GPU
- * driver. During power up, nothing will happen from the CPU (and the GMU will
- * power up normally but during power down this will ensure that the GX domain
- * is *really* off - this gives us a semi standard way of doing what we need.
- */
-static int gx_gdsc_enable(struct generic_pm_domain *domain)
-{
-       /* Do nothing but give genpd the impression that we were successful */
-       return 0;
-}
-
 static struct gdsc gpu_gx_gdsc = {
        .gdscr = 0x100c,
        .clamp_io_ctrl = 0x1508,
        .pd = {
                .name = "gpu_gx_gdsc",
-               .power_on = gx_gdsc_enable,
+               .power_on = gdsc_gx_do_nothing_enable,
        },
        .pwrsts = PWRSTS_OFF_ON,
        .flags = CLAMP_IO | AON_RESET | POLL_CFG_GDSCR,