]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: OMAP2+: omap_device: expose hwmod assert/deassert to omap devices
authorOmar Ramirez Luna <omar.luna@linaro.org>
Sun, 23 Sep 2012 23:28:18 +0000 (17:28 -0600)
committerPaul Walmsley <paul@pwsan.com>
Sun, 23 Sep 2012 23:28:18 +0000 (17:28 -0600)
This API is meant to be an interface to hwmod assert/deassert
function, omap devices can call them through their platform data to
control their reset lines, they are expected to know the name of the
reset line they are trying to control.

Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org>
[paul@pwsan.com: tweaked some documentation; fixed CodingStyle issue]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
arch/arm/plat-omap/include/plat/omap_device.h
arch/arm/plat-omap/omap_device.c

index 4327b2c90c3db5b8fbe4dedb6ad80fcadabed0c7..27bcc24411950f86de7f91db0fb8a542e5e3cf3c 100644 (file)
@@ -118,6 +118,10 @@ int omap_device_get_context_loss_count(struct platform_device *pdev);
 
 /* Other */
 
+int omap_device_assert_hardreset(struct platform_device *pdev,
+                                const char *name);
+int omap_device_deassert_hardreset(struct platform_device *pdev,
+                                const char *name);
 int omap_device_idle_hwmods(struct omap_device *od);
 int omap_device_enable_hwmods(struct omap_device *od);
 
index 6056a622a5f9c6d87f03c8bf7cf8b9fd136c9f20..5b69742691074819a07b9f9eac29bab016906369 100644 (file)
@@ -919,6 +919,61 @@ int omap_device_shutdown(struct platform_device *pdev)
        return ret;
 }
 
+/**
+ * omap_device_assert_hardreset - set a device's hardreset line
+ * @pdev: struct platform_device * to reset
+ * @name: const char * name of the reset line
+ *
+ * Set the hardreset line identified by @name on the IP blocks
+ * associated with the hwmods backing the platform_device @pdev.  All
+ * of the hwmods associated with @pdev must have the same hardreset
+ * line linked to them for this to work.  Passes along the return value
+ * of omap_hwmod_assert_hardreset() in the event of any failure, or
+ * returns 0 upon success.
+ */
+int omap_device_assert_hardreset(struct platform_device *pdev, const char *name)
+{
+       struct omap_device *od = to_omap_device(pdev);
+       int ret = 0;
+       int i;
+
+       for (i = 0; i < od->hwmods_cnt; i++) {
+               ret = omap_hwmod_assert_hardreset(od->hwmods[i], name);
+               if (ret)
+                       break;
+       }
+
+       return ret;
+}
+
+/**
+ * omap_device_deassert_hardreset - release a device's hardreset line
+ * @pdev: struct platform_device * to reset
+ * @name: const char * name of the reset line
+ *
+ * Release the hardreset line identified by @name on the IP blocks
+ * associated with the hwmods backing the platform_device @pdev.  All
+ * of the hwmods associated with @pdev must have the same hardreset
+ * line linked to them for this to work.  Passes along the return
+ * value of omap_hwmod_deassert_hardreset() in the event of any
+ * failure, or returns 0 upon success.
+ */
+int omap_device_deassert_hardreset(struct platform_device *pdev,
+                                  const char *name)
+{
+       struct omap_device *od = to_omap_device(pdev);
+       int ret = 0;
+       int i;
+
+       for (i = 0; i < od->hwmods_cnt; i++) {
+               ret = omap_hwmod_deassert_hardreset(od->hwmods[i], name);
+               if (ret)
+                       break;
+       }
+
+       return ret;
+}
+
 /**
  * omap_device_align_pm_lat - activate/deactivate device to match wakeup lat lim
  * @od: struct omap_device *