Jelajahi Sumber

Merge "msm: camera: icp: Update IPE/BPS register header" into camera-kernel.lnx.5.0

Haritha Chintalapati 4 tahun lalu
induk
melakukan
8a157daab6

+ 11 - 9
drivers/cam_icp/icp_hw/bps_hw/bps_core.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/of.h>
@@ -275,6 +275,7 @@ static int cam_bps_cmd_reset(struct cam_hw_soc_info *soc_info,
 	int pwr_ctrl, pwr_status, rc = 0;
 	bool reset_bps_cdm_fail = false;
 	bool reset_bps_top_fail = false;
+	struct cam_bps_device_hw_info *hw_info = NULL;
 
 	CAM_DBG(CAM_ICP, "CAM_ICP_BPS_CMD_RESET");
 
@@ -284,12 +285,14 @@ static int cam_bps_cmd_reset(struct cam_hw_soc_info *soc_info,
 		return -EINVAL;
 	}
 
+	hw_info = core_info->bps_hw_info;
+
 	/* Reset BPS CDM core*/
-	cam_io_w_mb((uint32_t)0xF,
-		soc_info->reg_map[0].mem_base + BPS_CDM_RST_CMD);
+	cam_io_w_mb(hw_info->cdm_rst_val,
+		soc_info->reg_map[0].mem_base + hw_info->cdm_rst_cmd);
 	while (retry_cnt < HFI_MAX_POLL_TRY) {
 		readw_poll_timeout((soc_info->reg_map[0].mem_base +
-			BPS_CDM_IRQ_STATUS),
+			hw_info->cdm_irq_status),
 			status, ((status & BPS_RST_DONE_IRQ_STATUS_BIT) == 0x1),
 			100, 10000);
 
@@ -300,7 +303,7 @@ static int cam_bps_cmd_reset(struct cam_hw_soc_info *soc_info,
 		retry_cnt++;
 	}
 	status = cam_io_r_mb(soc_info->reg_map[0].mem_base +
-		BPS_CDM_IRQ_STATUS);
+		hw_info->cdm_irq_status);
 	if ((status & BPS_RST_DONE_IRQ_STATUS_BIT) != 0x1) {
 		CAM_ERR(CAM_ICP, "BPS CDM rst failed status 0x%x", status);
 		reset_bps_cdm_fail = true;
@@ -309,10 +312,10 @@ static int cam_bps_cmd_reset(struct cam_hw_soc_info *soc_info,
 	/* Reset BPS core*/
 	status = 0;
 	cam_io_w_mb((uint32_t)0x3,
-		soc_info->reg_map[0].mem_base + BPS_TOP_RST_CMD);
+		soc_info->reg_map[0].mem_base + hw_info->top_rst_cmd);
 	while (retry_cnt < HFI_MAX_POLL_TRY) {
 		readw_poll_timeout((soc_info->reg_map[0].mem_base +
-			BPS_TOP_IRQ_STATUS),
+			hw_info->top_irq_status),
 			status, ((status & BPS_RST_DONE_IRQ_STATUS_BIT) == 0x1),
 			100, 10000);
 
@@ -323,13 +326,12 @@ static int cam_bps_cmd_reset(struct cam_hw_soc_info *soc_info,
 		retry_cnt++;
 	}
 	status = cam_io_r_mb(soc_info->reg_map[0].mem_base +
-		BPS_TOP_IRQ_STATUS);
+		hw_info->top_irq_status);
 	if ((status & BPS_RST_DONE_IRQ_STATUS_BIT) != 0x1) {
 		CAM_ERR(CAM_ICP, "BPS top rst failed status 0x%x", status);
 		reset_bps_top_fail = true;
 	}
 
-	cam_bps_get_gdsc_control(soc_info);
 	cam_cpas_reg_read(core_info->cpas_handle,
 		CAM_CPAS_REG_CPASTOP, core_info->bps_hw_info->pwr_ctrl,
 		true, &pwr_ctrl);

+ 11 - 2
drivers/cam_icp/icp_hw/bps_hw/bps_core.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifndef CAM_BPS_CORE_H
@@ -11,6 +11,9 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 
+/* BPS CDM/TOP status register */
+#define BPS_RST_DONE_IRQ_STATUS_BIT  0x1
+
 #define BPS_COLLAPSE_MASK 0x1
 #define BPS_PWR_ON_MASK   0x2
 
@@ -18,7 +21,13 @@ struct cam_bps_device_hw_info {
 	uint32_t hw_idx;
 	uint32_t pwr_ctrl;
 	uint32_t pwr_status;
-	uint32_t reserved;
+
+	uint32_t top_rst_cmd;
+	uint32_t top_irq_status;
+	uint32_t cdm_rst_cmd;
+	uint32_t cdm_irq_status;
+
+	uint32_t cdm_rst_val;
 };
 
 struct cam_bps_device_core_info {

+ 23 - 4
drivers/cam_icp/icp_hw/bps_hw/bps_dev.c

@@ -21,9 +21,24 @@
 
 static struct cam_bps_device_hw_info cam_bps_hw_info = {
 	.hw_idx = 0,
-	.pwr_ctrl = 0x5c,
-	.pwr_status = 0x58,
-	.reserved = 0,
+	.pwr_ctrl = 0x48,
+	.pwr_status = 0x44,
+	.top_rst_cmd = 0x1008,
+	.top_irq_status = 0x100C,
+	.cdm_rst_cmd = 0x10,
+	.cdm_irq_status = 0x44,
+	.cdm_rst_val = 0xF,
+};
+
+static struct cam_bps_device_hw_info cam_bps680_hw_info = {
+	.hw_idx = 0,
+	.pwr_ctrl = 0x48,
+	.pwr_status = 0x44,
+	.top_rst_cmd = 0x508,
+	.top_irq_status = 0x50C,
+	.cdm_rst_cmd = 0x10,
+	.cdm_irq_status = 0x44,
+	.cdm_rst_val = 0x7F,
 };
 
 static bool cam_bps_cpas_cb(uint32_t client_handle, void *userdata,
@@ -135,7 +150,7 @@ static int cam_bps_component_bind(struct device *dev,
 		rc = -EINVAL;
 		return rc;
 	}
-	hw_info = &cam_bps_hw_info;
+	hw_info = (struct cam_bps_device_hw_info *)match_dev->data;
 	core_info->bps_hw_info = hw_info;
 
 	rc = cam_bps_init_soc_resources(&bps_dev->soc_info, cam_bps_irq,
@@ -216,6 +231,10 @@ static const struct of_device_id cam_bps_dt_match[] = {
 		.compatible = "qcom,cam-bps",
 		.data = &cam_bps_hw_info,
 	},
+	{
+		.compatible = "qcom,cam-bps680",
+		.data = &cam_bps680_hw_info,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, cam_bps_dt_match);

+ 1 - 10
drivers/cam_icp/icp_hw/icp_hw_mgr/include/cam_bps_hw_intf.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifndef CAM_BPS_HW_INTF_H
@@ -11,15 +11,6 @@
 #include "cam_hw_mgr_intf.h"
 #include "cam_icp_hw_intf.h"
 
-/* BPS register */
-#define BPS_TOP_RST_CMD              0x1008
-#define BPS_CDM_RST_CMD              0x10
-#define BPS_CDM_IRQ_STATUS           0x44
-#define BPS_TOP_IRQ_STATUS           0x100C
-
-/* BPS CDM/TOP status register */
-#define BPS_RST_DONE_IRQ_STATUS_BIT  0x1
-
 enum cam_icp_bps_cmd_type {
 	CAM_ICP_BPS_CMD_FW_DOWNLOAD,
 	CAM_ICP_BPS_CMD_POWER_COLLAPSE,

+ 1 - 10
drivers/cam_icp/icp_hw/icp_hw_mgr/include/cam_ipe_hw_intf.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifndef CAM_IPE_HW_INTF_H
@@ -11,15 +11,6 @@
 #include "cam_hw_mgr_intf.h"
 #include "cam_icp_hw_intf.h"
 
-/* IPE registers */
-#define IPE_TOP_RST_CMD              0x1008
-#define IPE_CDM_RST_CMD              0x10
-#define IPE_CDM_IRQ_STATUS           0x44
-#define IPE_TOP_IRQ_STATUS           0x100C
-
-/* IPE CDM/TOP status register */
-#define IPE_RST_DONE_IRQ_STATUS_BIT  0x1
-
 enum cam_icp_ipe_cmd_type {
 	CAM_ICP_IPE_CMD_FW_DOWNLOAD,
 	CAM_ICP_IPE_CMD_POWER_COLLAPSE,

+ 11 - 9
drivers/cam_icp/icp_hw/ipe_hw/ipe_core.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/of.h>
@@ -273,6 +273,7 @@ static int cam_ipe_cmd_reset(struct cam_hw_soc_info *soc_info,
 	uint32_t status = 0, retry_cnt = 0;
 	bool reset_ipe_cdm_fail = false;
 	bool reset_ipe_top_fail = false;
+	struct cam_ipe_device_hw_info *hw_info = NULL;
 
 	CAM_DBG(CAM_ICP, "CAM_ICP_IPE_CMD_RESET");
 	if (!core_info->clk_enable || !core_info->cpas_start) {
@@ -281,12 +282,14 @@ static int cam_ipe_cmd_reset(struct cam_hw_soc_info *soc_info,
 		return -EINVAL;
 	}
 
+	hw_info = core_info->ipe_hw_info;
+
 	/* IPE CDM core reset*/
-	cam_io_w_mb((uint32_t)0xF,
-		soc_info->reg_map[0].mem_base + IPE_CDM_RST_CMD);
+	cam_io_w_mb(hw_info->cdm_rst_val,
+		soc_info->reg_map[0].mem_base + hw_info->cdm_rst_cmd);
 	while (retry_cnt < HFI_MAX_POLL_TRY) {
 		readw_poll_timeout((soc_info->reg_map[0].mem_base +
-			IPE_CDM_IRQ_STATUS),
+			hw_info->cdm_irq_status),
 			status, ((status & IPE_RST_DONE_IRQ_STATUS_BIT) == 0x1),
 			100, 10000);
 
@@ -297,7 +300,7 @@ static int cam_ipe_cmd_reset(struct cam_hw_soc_info *soc_info,
 		retry_cnt++;
 	}
 	status = cam_io_r_mb(soc_info->reg_map[0].mem_base +
-		IPE_CDM_IRQ_STATUS);
+		hw_info->cdm_irq_status);
 	if ((status & IPE_RST_DONE_IRQ_STATUS_BIT) != 0x1) {
 		CAM_ERR(CAM_ICP, "IPE CDM rst failed status 0x%x", status);
 		reset_ipe_cdm_fail = true;
@@ -306,10 +309,10 @@ static int cam_ipe_cmd_reset(struct cam_hw_soc_info *soc_info,
 	/* IPE reset*/
 	status = 0;
 	cam_io_w_mb((uint32_t)0x3,
-		soc_info->reg_map[0].mem_base + IPE_TOP_RST_CMD);
+		soc_info->reg_map[0].mem_base + hw_info->top_rst_cmd);
 	while (retry_cnt < HFI_MAX_POLL_TRY) {
 		readw_poll_timeout((soc_info->reg_map[0].mem_base +
-			IPE_TOP_IRQ_STATUS),
+			hw_info->top_irq_status),
 			status, ((status & IPE_RST_DONE_IRQ_STATUS_BIT) == 0x1),
 			100, 10000);
 
@@ -321,13 +324,12 @@ static int cam_ipe_cmd_reset(struct cam_hw_soc_info *soc_info,
 		retry_cnt++;
 	}
 	status = cam_io_r_mb(soc_info->reg_map[0].mem_base +
-		IPE_TOP_IRQ_STATUS);
+		hw_info->top_irq_status);
 	if ((status & IPE_RST_DONE_IRQ_STATUS_BIT) != 0x1) {
 		CAM_ERR(CAM_ICP, "IPE top rst failed status 0x%x", status);
 		reset_ipe_top_fail = true;
 	}
 
-	cam_ipe_get_gdsc_control(soc_info);
 	cam_cpas_reg_read(core_info->cpas_handle,
 		CAM_CPAS_REG_CPASTOP, core_info->ipe_hw_info->pwr_ctrl,
 		true, &pwr_ctrl);

+ 11 - 2
drivers/cam_icp/icp_hw/ipe_hw/ipe_core.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifndef CAM_IPE_CORE_H
@@ -11,6 +11,9 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 
+/* IPE CDM/TOP status register */
+#define IPE_RST_DONE_IRQ_STATUS_BIT  0x1
+
 #define IPE_COLLAPSE_MASK 0x1
 #define IPE_PWR_ON_MASK   0x2
 
@@ -18,7 +21,13 @@ struct cam_ipe_device_hw_info {
 	uint32_t hw_idx;
 	uint32_t pwr_ctrl;
 	uint32_t pwr_status;
-	uint32_t reserved;
+
+	uint32_t top_rst_cmd;
+	uint32_t top_irq_status;
+	uint32_t cdm_rst_cmd;
+	uint32_t cdm_irq_status;
+
+	uint32_t cdm_rst_val;
 };
 
 struct cam_ipe_device_core_info {

+ 23 - 8
drivers/cam_icp/icp_hw/ipe_hw/ipe_dev.c

@@ -22,15 +22,26 @@
 static struct cam_ipe_device_hw_info cam_ipe_hw_info[] = {
 	{
 		.hw_idx = 0,
-		.pwr_ctrl = 0x4c,
-		.pwr_status = 0x48,
-		.reserved = 0,
+		.pwr_ctrl = 0x40,
+		.pwr_status = 0x3C,
+		.top_rst_cmd = 0x1008,
+		.top_irq_status = 0x100C,
+		.cdm_rst_cmd = 0x10,
+		.cdm_irq_status = 0x44,
+		.cdm_rst_val = 0xF,
 	},
+};
+
+static struct cam_ipe_device_hw_info cam_ipe680_hw_info[] = {
 	{
-		.hw_idx = 1,
-		.pwr_ctrl = 0x54,
-		.pwr_status = 0x50,
-		.reserved = 0,
+		.hw_idx = 0,
+		.pwr_ctrl = 0x40,
+		.pwr_status = 0x3C,
+		.top_rst_cmd = 0x1008,
+		.top_irq_status = 0x100C,
+		.cdm_rst_cmd = 0x10,
+		.cdm_irq_status = 0x44,
+		.cdm_rst_val = 0x7F,
 	},
 };
 
@@ -132,7 +143,7 @@ static int cam_ipe_component_bind(struct device *dev,
 		rc = -EINVAL;
 		return rc;
 	}
-	hw_info = &cam_ipe_hw_info[ipe_dev_intf->hw_idx];
+	hw_info = (struct cam_ipe_device_hw_info *)match_dev->data;
 	core_info->ipe_hw_info = hw_info;
 
 	rc = cam_ipe_init_soc_resources(&ipe_dev->soc_info, cam_ipe_irq,
@@ -214,6 +225,10 @@ static const struct of_device_id cam_ipe_dt_match[] = {
 		.compatible = "qcom,cam-ipe",
 		.data = &cam_ipe_hw_info,
 	},
+	{
+		.compatible = "qcom,cam-ipe680",
+		.data = &cam_ipe680_hw_info,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, cam_ipe_dt_match);