From: Robby Cai Date: Tue, 11 Sep 2018 07:01:10 +0000 (+0800) Subject: MLK-19537-2 media: mipi_csi: use PHY slave reset for MIPI CSI X-Git-Tag: rel_imx_4.19.35_1.1.0~749 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=30e89c4d3bcacd47a145903381ec36fdf8304d53;p=linux.git MLK-19537-2 media: mipi_csi: use PHY slave reset for MIPI CSI Remove PHY master reset and only need to use PHY slave reset for MIPI CSI. Use regmap framework for cleanup. Signed-off-by: Robby Cai Reviewed-by: Fancy Fang (cherry picked from commit 6968f84ad8ee1613ff90d90e19e7434d5dd95126) (cherry picked from commit 8a93a78c9bee1b456961a6d611f31d7708089798) --- diff --git a/drivers/media/platform/mxc/capture/mxc_mipi_csi.c b/drivers/media/platform/mxc/capture/mxc_mipi_csi.c index 6904314d8561..1b7eb0ed6312 100644 --- a/drivers/media/platform/mxc/capture/mxc_mipi_csi.c +++ b/drivers/media/platform/mxc/capture/mxc_mipi_csi.c @@ -193,9 +193,6 @@ MODULE_PARM_DESC(debug, "Debug level (0-2)"); #define GPR_MIPI_RESET 0x08 #define GPR_MIPI_S_RESETN BIT(16) -#define MIPI_CSIS_MISC 0x8008 - - #define DEFAULT_SCLK_CSIS_FREQ 166000000UL enum { @@ -396,18 +393,20 @@ static int mipi_csis_phy_init(struct csi_state *state) static int mipi_csis_phy_reset_mx8mm(struct csi_state *state) { - struct device_node *np; - void __iomem *reg; - - np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-csi"); - if (WARN_ON(!np)) - return -ENXIO; + struct device_node *np = state->dev->of_node; + struct regmap *gpr; - reg = of_iomap(np, 0); + gpr = syscon_regmap_lookup_by_phandle(np, "csi-gpr"); + if (IS_ERR(gpr)) + return PTR_ERR(gpr); - writel(0, reg + MIPI_CSIS_MISC); + regmap_update_bits(gpr, GPR_MIPI_RESET, + GPR_MIPI_S_RESETN, + 0x0); usleep_range(10, 20); - writel(0x30000, reg + MIPI_CSIS_MISC); + regmap_update_bits(gpr, GPR_MIPI_RESET, + GPR_MIPI_S_RESETN, + GPR_MIPI_S_RESETN); usleep_range(10, 20); return 0;