video: tegra: host: Add VI reset sequence
Terje Bergstrom [Mon, 9 Sep 2013 07:18:07 +0000 (10:18 +0300)]
We do not reset VI from CAR, but instead only reset its MCCIF.

Bug 1355069

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

drivers/video/tegra/host/t124/t124.c
drivers/video/tegra/host/vi/vi.c
drivers/video/tegra/host/vi/vi.h

index baa59f5..b32e094 100644 (file)
@@ -246,6 +246,7 @@ struct nvhost_device_data t124_vi_info = {
        .prepare_poweroff = nvhost_vi_prepare_poweroff,
        .finalize_poweron = nvhost_vi_finalize_poweron,
        .ctrl_ops         = &tegra_vi_ctrl_ops,
+       .reset            = nvhost_vi_reset,
        .slave         = &tegra_vi01b_device,
 };
 
index 5e03efb..d32617a 100644 (file)
@@ -44,6 +44,9 @@
 #define MAX_DEVID_LENGTH       16
 #define T12_VI_CFG_CG_CTRL     0x2e
 #define T12_CG_2ND_LEVEL_EN    1
+#define T12_VI_CSI_0_SW_RESET  0x40
+#define T12_VI_CSI_1_SW_RESET  0x80
+#define T12_VI_CSI_SW_RESET_MCCIF_RESET 3
 
 static struct of_device_id tegra_vi_of_match[] = {
 #ifdef TEGRA_2X_OR_HIGHER_CONFIG
@@ -406,6 +409,23 @@ const struct file_operations tegra_vi_ctrl_ops = {
 };
 #endif
 
+void nvhost_vi_reset(struct platform_device *pdev)
+{
+       u32 reset_reg;
+
+       if (pdev->id == 0)
+               reset_reg = T12_VI_CSI_0_SW_RESET;
+       else
+               reset_reg = T12_VI_CSI_1_SW_RESET;
+
+       nvhost_client_writel(pdev, T12_VI_CSI_SW_RESET_MCCIF_RESET,
+                       reset_reg);
+
+       udelay(10);
+
+       nvhost_client_writel(pdev, 0, reset_reg);
+}
+
 late_initcall(vi_init);
 module_exit(vi_exit);
 MODULE_LICENSE("GPL v2");
index 5878937..99bdec5 100644 (file)
@@ -35,5 +35,6 @@ int nvhost_vi_prepare_poweroff(struct platform_device *);
 int nvhost_vi_finalize_poweron(struct platform_device *);
 int nvhost_vi_init(struct platform_device *);
 void nvhost_vi_deinit(struct platform_device *);
+void nvhost_vi_reset(struct platform_device *);
 
 #endif