Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

reset: imx7: Add support for i.MX8MQ IP block variant

Add bits and pieces needed to support IP block variant found on
i.MX8MQ SoCs.

Cc: p.zabel@pengutronix.de
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: cphealy@gmail.com
Cc: l.stach@pengutronix.de
Cc: Leonard Crestez <leonard.crestez@nxp.com>
Cc: "A.s. Dong" <aisheng.dong@nxp.com>
Cc: Richard Zhu <hongxing.zhu@nxp.com>
Cc: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-imx@nxp.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
[p.zabel@pengutronix.de: fixed whitespace alignment]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

authored by

Andrey Smirnov and committed by
Philipp Zabel
c979dbf5 10590358

+124 -2
+2 -2
drivers/reset/Kconfig
··· 56 56 This enables the reset controller driver for HSDK board. 57 57 58 58 config RESET_IMX7 59 - bool "i.MX7 Reset Driver" if COMPILE_TEST 59 + bool "i.MX7/8 Reset Driver" if COMPILE_TEST 60 60 depends on HAS_IOMEM 61 - default SOC_IMX7D 61 + default SOC_IMX7D || (ARM64 && ARCH_MXC) 62 62 select MFD_SYSCON 63 63 help 64 64 This enables the reset controller driver for i.MX7 SoCs.
+122
drivers/reset/reset-imx7.c
··· 22 22 #include <linux/reset-controller.h> 23 23 #include <linux/regmap.h> 24 24 #include <dt-bindings/reset/imx7-reset.h> 25 + #include <dt-bindings/reset/imx8mq-reset.h> 25 26 26 27 struct imx7_src_signal { 27 28 unsigned int offset, bit; ··· 141 140 }, 142 141 }; 143 142 143 + enum imx8mq_src_registers { 144 + SRC_A53RCR0 = 0x0004, 145 + SRC_HDMI_RCR = 0x0030, 146 + SRC_DISP_RCR = 0x0034, 147 + SRC_GPU_RCR = 0x0040, 148 + SRC_VPU_RCR = 0x0044, 149 + SRC_PCIE2_RCR = 0x0048, 150 + SRC_MIPIPHY1_RCR = 0x004c, 151 + SRC_MIPIPHY2_RCR = 0x0050, 152 + SRC_DDRC2_RCR = 0x1004, 153 + }; 154 + 155 + static const struct imx7_src_signal imx8mq_src_signals[IMX8MQ_RESET_NUM] = { 156 + [IMX8MQ_RESET_A53_CORE_POR_RESET0] = { SRC_A53RCR0, BIT(0) }, 157 + [IMX8MQ_RESET_A53_CORE_POR_RESET1] = { SRC_A53RCR0, BIT(1) }, 158 + [IMX8MQ_RESET_A53_CORE_POR_RESET2] = { SRC_A53RCR0, BIT(2) }, 159 + [IMX8MQ_RESET_A53_CORE_POR_RESET3] = { SRC_A53RCR0, BIT(3) }, 160 + [IMX8MQ_RESET_A53_CORE_RESET0] = { SRC_A53RCR0, BIT(4) }, 161 + [IMX8MQ_RESET_A53_CORE_RESET1] = { SRC_A53RCR0, BIT(5) }, 162 + [IMX8MQ_RESET_A53_CORE_RESET2] = { SRC_A53RCR0, BIT(6) }, 163 + [IMX8MQ_RESET_A53_CORE_RESET3] = { SRC_A53RCR0, BIT(7) }, 164 + [IMX8MQ_RESET_A53_DBG_RESET0] = { SRC_A53RCR0, BIT(8) }, 165 + [IMX8MQ_RESET_A53_DBG_RESET1] = { SRC_A53RCR0, BIT(9) }, 166 + [IMX8MQ_RESET_A53_DBG_RESET2] = { SRC_A53RCR0, BIT(10) }, 167 + [IMX8MQ_RESET_A53_DBG_RESET3] = { SRC_A53RCR0, BIT(11) }, 168 + [IMX8MQ_RESET_A53_ETM_RESET0] = { SRC_A53RCR0, BIT(12) }, 169 + [IMX8MQ_RESET_A53_ETM_RESET1] = { SRC_A53RCR0, BIT(13) }, 170 + [IMX8MQ_RESET_A53_ETM_RESET2] = { SRC_A53RCR0, BIT(14) }, 171 + [IMX8MQ_RESET_A53_ETM_RESET3] = { SRC_A53RCR0, BIT(15) }, 172 + [IMX8MQ_RESET_A53_SOC_DBG_RESET] = { SRC_A53RCR0, BIT(20) }, 173 + [IMX8MQ_RESET_A53_L2RESET] = { SRC_A53RCR0, BIT(21) }, 174 + [IMX8MQ_RESET_SW_NON_SCLR_M4C_RST] = { SRC_M4RCR, BIT(0) }, 175 + [IMX8MQ_RESET_OTG1_PHY_RESET] = { SRC_USBOPHY1_RCR, BIT(0) }, 176 + [IMX8MQ_RESET_OTG2_PHY_RESET] = { SRC_USBOPHY2_RCR, BIT(0) }, 177 + [IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N] = { SRC_MIPIPHY_RCR, BIT(1) }, 178 + [IMX8MQ_RESET_MIPI_DSI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(2) }, 179 + [IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(3) }, 180 + [IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N] = { SRC_MIPIPHY_RCR, BIT(4) }, 181 + [IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N] = { SRC_MIPIPHY_RCR, BIT(5) }, 182 + [IMX8MQ_RESET_PCIEPHY] = { SRC_PCIEPHY_RCR, 183 + BIT(2) | BIT(1) }, 184 + [IMX8MQ_RESET_PCIEPHY_PERST] = { SRC_PCIEPHY_RCR, BIT(3) }, 185 + [IMX8MQ_RESET_PCIE_CTRL_APPS_EN] = { SRC_PCIEPHY_RCR, BIT(6) }, 186 + [IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF] = { SRC_PCIEPHY_RCR, BIT(11) }, 187 + [IMX8MQ_RESET_HDMI_PHY_APB_RESET] = { SRC_HDMI_RCR, BIT(0) }, 188 + [IMX8MQ_RESET_DISP_RESET] = { SRC_DISP_RCR, BIT(0) }, 189 + [IMX8MQ_RESET_GPU_RESET] = { SRC_GPU_RCR, BIT(0) }, 190 + [IMX8MQ_RESET_VPU_RESET] = { SRC_VPU_RCR, BIT(0) }, 191 + [IMX8MQ_RESET_PCIEPHY2] = { SRC_PCIE2_RCR, 192 + BIT(2) | BIT(1) }, 193 + [IMX8MQ_RESET_PCIEPHY2_PERST] = { SRC_PCIE2_RCR, BIT(3) }, 194 + [IMX8MQ_RESET_PCIE2_CTRL_APPS_EN] = { SRC_PCIE2_RCR, BIT(6) }, 195 + [IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF] = { SRC_PCIE2_RCR, BIT(11) }, 196 + [IMX8MQ_RESET_MIPI_CSI1_CORE_RESET] = { SRC_MIPIPHY1_RCR, BIT(0) }, 197 + [IMX8MQ_RESET_MIPI_CSI1_PHY_REF_RESET] = { SRC_MIPIPHY1_RCR, BIT(1) }, 198 + [IMX8MQ_RESET_MIPI_CSI1_ESC_RESET] = { SRC_MIPIPHY1_RCR, BIT(2) }, 199 + [IMX8MQ_RESET_MIPI_CSI2_CORE_RESET] = { SRC_MIPIPHY2_RCR, BIT(0) }, 200 + [IMX8MQ_RESET_MIPI_CSI2_PHY_REF_RESET] = { SRC_MIPIPHY2_RCR, BIT(1) }, 201 + [IMX8MQ_RESET_MIPI_CSI2_ESC_RESET] = { SRC_MIPIPHY2_RCR, BIT(2) }, 202 + [IMX8MQ_RESET_DDRC1_PRST] = { SRC_DDRC_RCR, BIT(0) }, 203 + [IMX8MQ_RESET_DDRC1_CORE_RESET] = { SRC_DDRC_RCR, BIT(1) }, 204 + [IMX8MQ_RESET_DDRC1_PHY_RESET] = { SRC_DDRC_RCR, BIT(2) }, 205 + [IMX8MQ_RESET_DDRC2_PHY_RESET] = { SRC_DDRC2_RCR, BIT(0) }, 206 + [IMX8MQ_RESET_DDRC2_CORE_RESET] = { SRC_DDRC2_RCR, BIT(1) }, 207 + [IMX8MQ_RESET_DDRC2_PRST] = { SRC_DDRC2_RCR, BIT(2) }, 208 + }; 209 + 210 + static int imx8mq_reset_set(struct reset_controller_dev *rcdev, 211 + unsigned long id, bool assert) 212 + { 213 + struct imx7_src *imx7src = to_imx7_src(rcdev); 214 + const unsigned int bit = imx7src->signals[id].bit; 215 + unsigned int value = assert ? bit : 0; 216 + 217 + switch (id) { 218 + case IMX8MQ_RESET_PCIEPHY: 219 + case IMX8MQ_RESET_PCIEPHY2: /* fallthrough */ 220 + /* 221 + * wait for more than 10us to release phy g_rst and 222 + * btnrst 223 + */ 224 + if (!assert) 225 + udelay(10); 226 + break; 227 + 228 + case IMX8MQ_RESET_PCIE_CTRL_APPS_EN: 229 + case IMX8MQ_RESET_PCIE2_CTRL_APPS_EN: /* fallthrough */ 230 + case IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N: /* fallthrough */ 231 + case IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N: /* fallthrough */ 232 + case IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N: /* fallthrough */ 233 + case IMX8MQ_RESET_MIPI_DSI_RESET_N: /* fallthrough */ 234 + case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N: /* fallthrough */ 235 + value = assert ? 0 : bit; 236 + break; 237 + } 238 + 239 + return imx7_reset_update(imx7src, id, value); 240 + } 241 + 242 + static int imx8mq_reset_assert(struct reset_controller_dev *rcdev, 243 + unsigned long id) 244 + { 245 + return imx8mq_reset_set(rcdev, id, true); 246 + } 247 + 248 + static int imx8mq_reset_deassert(struct reset_controller_dev *rcdev, 249 + unsigned long id) 250 + { 251 + return imx8mq_reset_set(rcdev, id, false); 252 + } 253 + 254 + static const struct imx7_src_variant variant_imx8mq = { 255 + .signals = imx8mq_src_signals, 256 + .signals_num = ARRAY_SIZE(imx8mq_src_signals), 257 + .ops = { 258 + .assert = imx8mq_reset_assert, 259 + .deassert = imx8mq_reset_deassert, 260 + }, 261 + }; 262 + 144 263 static int imx7_reset_probe(struct platform_device *pdev) 145 264 { 146 265 struct imx7_src *imx7src; ··· 290 169 291 170 static const struct of_device_id imx7_reset_dt_ids[] = { 292 171 { .compatible = "fsl,imx7d-src", .data = &variant_imx7 }, 172 + { .compatible = "fsl,imx8mq-src", .data = &variant_imx8mq }, 293 173 { /* sentinel */ }, 294 174 }; 295 175