|
@@ -6931,14 +6931,61 @@ static void cnss_mhi_write_reg(struct mhi_controller *mhi_ctrl,
|
|
|
writel_relaxed(val, addr);
|
|
|
}
|
|
|
|
|
|
+#if IS_ENABLED(CONFIG_MHI_BUS_MISC)
|
|
|
+/**
|
|
|
+ * __cnss_get_mhi_soc_info - Get SoC info before registering mhi controller
|
|
|
+ * @mhi_ctrl: MHI controller
|
|
|
+ *
|
|
|
+ * Return: 0 for success, error code on failure
|
|
|
+ */
|
|
|
+static inline int __cnss_get_mhi_soc_info(struct mhi_controller *mhi_ctrl)
|
|
|
+{
|
|
|
+ return mhi_get_soc_info(mhi_ctrl);
|
|
|
+}
|
|
|
+#else
|
|
|
+#define SOC_HW_VERSION_OFFS (0x224)
|
|
|
+#define SOC_HW_VERSION_FAM_NUM_BMSK (0xF0000000)
|
|
|
+#define SOC_HW_VERSION_FAM_NUM_SHFT (28)
|
|
|
+#define SOC_HW_VERSION_DEV_NUM_BMSK (0x0FFF0000)
|
|
|
+#define SOC_HW_VERSION_DEV_NUM_SHFT (16)
|
|
|
+#define SOC_HW_VERSION_MAJOR_VER_BMSK (0x0000FF00)
|
|
|
+#define SOC_HW_VERSION_MAJOR_VER_SHFT (8)
|
|
|
+#define SOC_HW_VERSION_MINOR_VER_BMSK (0x000000FF)
|
|
|
+#define SOC_HW_VERSION_MINOR_VER_SHFT (0)
|
|
|
+
|
|
|
+static int __cnss_get_mhi_soc_info(struct mhi_controller *mhi_ctrl)
|
|
|
+{
|
|
|
+ u32 soc_info;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ ret = mhi_ctrl->read_reg(mhi_ctrl,
|
|
|
+ mhi_ctrl->regs + SOC_HW_VERSION_OFFS,
|
|
|
+ &soc_info);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
+
|
|
|
+ mhi_ctrl->family_number = (soc_info & SOC_HW_VERSION_FAM_NUM_BMSK) >>
|
|
|
+ SOC_HW_VERSION_FAM_NUM_SHFT;
|
|
|
+ mhi_ctrl->device_number = (soc_info & SOC_HW_VERSION_DEV_NUM_BMSK) >>
|
|
|
+ SOC_HW_VERSION_DEV_NUM_SHFT;
|
|
|
+ mhi_ctrl->major_version = (soc_info & SOC_HW_VERSION_MAJOR_VER_BMSK) >>
|
|
|
+ SOC_HW_VERSION_MAJOR_VER_SHFT;
|
|
|
+ mhi_ctrl->minor_version = (soc_info & SOC_HW_VERSION_MINOR_VER_BMSK) >>
|
|
|
+ SOC_HW_VERSION_MINOR_VER_SHFT;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
static int cnss_get_mhi_soc_info(struct cnss_plat_data *plat_priv,
|
|
|
struct mhi_controller *mhi_ctrl)
|
|
|
{
|
|
|
int ret = 0;
|
|
|
|
|
|
- ret = mhi_get_soc_info(mhi_ctrl);
|
|
|
- if (ret)
|
|
|
+ ret = __cnss_get_mhi_soc_info(mhi_ctrl);
|
|
|
+ if (ret) {
|
|
|
+ cnss_pr_err("failed to get mhi soc info, ret %d\n", ret);
|
|
|
goto exit;
|
|
|
+ }
|
|
|
|
|
|
plat_priv->device_version.family_number = mhi_ctrl->family_number;
|
|
|
plat_priv->device_version.device_number = mhi_ctrl->device_number;
|