video: tegra: host: Enable ISP 2nd level cg
Terje Bergstrom [Tue, 27 Aug 2013 12:08:23 +0000 (15:08 +0300)]
Enable ISP's 2nd level clock gating when ISP is powered up.

Bug 1346075

Change-Id: I9c1f1f67b3ecd33b57c073ba1ae426db4985d317
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/267116
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

drivers/video/tegra/host/bus_client.c
drivers/video/tegra/host/bus_client.h
drivers/video/tegra/host/isp/isp.c
drivers/video/tegra/host/isp/isp.h [new file with mode: 0644]
drivers/video/tegra/host/t124/t124.c

index 3a2859b..61e70b1 100644 (file)
@@ -127,6 +127,18 @@ int nvhost_write_module_regs(struct platform_device *ndev,
        return 0;
 }
 
+void nvhost_client_writel(struct platform_device *pdev, u32 val, u32 reg)
+{
+       struct nvhost_device_data *pdata = platform_get_drvdata(pdev);
+       writel(val, pdata->aperture[0] + reg * 4);
+}
+
+u32 nvhost_client_readl(struct platform_device *pdev, u32 reg)
+{
+       struct nvhost_device_data *pdata = platform_get_drvdata(pdev);
+       return readl(pdata->aperture[0] + reg * 4);
+}
+
 struct nvhost_channel_userctx {
        struct nvhost_channel *ch;
        struct nvhost_hwctx *hwctx;
index a9cb54f..ff71742 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Tegra Graphics Host client
  *
- * Copyright (c) 2010-2013, NVIDIA Corporation.
+ * Copyright (c) 2010-2013, NVIDIA Corporation.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -32,6 +32,11 @@ int nvhost_read_module_regs(struct platform_device *ndev,
 int nvhost_write_module_regs(struct platform_device *ndev,
                        u32 offset, int count, const u32 *values);
 
+void nvhost_client_writel(struct platform_device *pdev,
+               u32 val, u32 reg);
+
+u32 nvhost_client_readl(struct platform_device *pdev, u32 reg);
+
 int nvhost_client_user_init(struct platform_device *dev);
 
 int nvhost_client_device_init(struct platform_device *dev);
index 1940b30..d722edf 100644 (file)
@@ -36,6 +36,9 @@
 #include "t148/t148.h"
 #include "t124/t124.h"
 
+#define T12_ISP_CG_CTRL                0x1d
+#define T12_CG_2ND_LEVEL_EN    1
+
 static struct of_device_id tegra_isp_of_match[] = {
 #ifdef TEGRA_2X_OR_HIGHER_CONFIG
        { .compatible = "nvidia,tegra20-isp",
@@ -60,6 +63,12 @@ static struct of_device_id tegra_isp_of_match[] = {
        { },
 };
 
+int nvhost_isp_t124_finalize_poweron(struct platform_device *pdev)
+{
+       nvhost_client_writel(pdev, T12_CG_2ND_LEVEL_EN, T12_ISP_CG_CTRL);
+       return 0;
+}
+
 static int isp_probe(struct platform_device *dev)
 {
        int err = 0;
diff --git a/drivers/video/tegra/host/isp/isp.h b/drivers/video/tegra/host/isp/isp.h
new file mode 100644 (file)
index 0000000..203e8ca
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * drivers/video/tegra/host/vi/vi.h
+ *
+ * Tegra Graphics Host ISP
+ *
+ * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __NVHOST_ISP_H__
+#define __NVHOST_ISP_H__
+
+int nvhost_isp_t124_finalize_poweron(struct platform_device *);
+
+#endif
index 6f6324a..cfd7431 100644 (file)
@@ -35,6 +35,7 @@
 #include "msenc/msenc.h"
 #include "tsec/tsec.h"
 #include "vi/vi.h"
+#include "isp/isp.h"
 
 #include "nvhost_memmgr.h"
 #include "chip_support.h"
@@ -170,6 +171,7 @@ struct nvhost_device_data t124_isp_info = {
        .powergate_delay = ISP_POWERGATE_DELAY,
        .clocks          = { {"isp", UINT_MAX} },
        .slave           = &tegra_isp01b_device,
+       .finalize_poweron = nvhost_isp_t124_finalize_poweron,
 };
 static struct platform_device tegra_isp01_device = {
        .name          = "isp",