From patchwork Sat Nov 17 18:11:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10687561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7CC71709 for ; Sat, 17 Nov 2018 18:12:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D97B12AADA for ; Sat, 17 Nov 2018 18:12:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCCA22AAE3; Sat, 17 Nov 2018 18:12:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, UPPERCASE_50_75 autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0B2B12AADA for ; Sat, 17 Nov 2018 18:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Cr864LDpVLWSSXWCAYF9JxdTiKki3BQNsj0qJX70ugk=; b=QbKPjwHUMlnXWS W44rJXH61VfRt90lPtGFkJyNiGmBkVCJX6aJaKomiQimxNdHRiBjZsP6ZH3Q/WVuZMg+tvQLCVUvp /zYPD96EhicdJ/XeUit3UWf94K1wChoe98/rxWBKLCFPvsREyVfzRHSUUuV/BFKsyeEzOmLe83/Qi rl06NUmpYsv6Y2ptrbG6veA4aHiCxglN60H46aasY5SLYMByO5tdznvx0HeBKTgXXsIyV+sC0GVuo MCye8WGtkQSvM2S7gi9mmKT+Pl1q5bJTT+iF9bde6ZLhVyr+RmgpduOoaUeZw13Yc2Eoc0W9v7alT rcKcZcllccPYH13RdhPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gO54m-00065t-Oi; Sat, 17 Nov 2018 18:12:12 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gO54c-0005xa-9M for linux-arm-kernel@lists.infradead.org; Sat, 17 Nov 2018 18:12:03 +0000 Received: by mail-pf1-x443.google.com with SMTP id w73so3575598pfk.10 for ; Sat, 17 Nov 2018 10:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m+acSq/TkpyYxv16Qw49nXaW0OzDzxcF2f5zPzPa3zU=; b=cSpajO61tHQGt5ICXg5YBchmA3WcqZ/acbl/jriTuJF/c6lS6wdx0N+gFfOPL4+Pxb HVlj3docF+jtExRI7vpaOvV9rQsJUAGIRAIS3TBeH9UmSUuj2ZWznhp1WPr48OszGs/l oSjlbruJcp9YSD+KZmFq5PHb+bMA3UloOM28N3FHfHM7vpm5zAgx2oOf+NVxvAy1F9t0 ms5N6lIv8mL5afryFaHg5Nw6QhhJoFanCbV0neHMUEJafk2EfmBjDm49PskTqy3EdC1b n1AOXCmX+5Ed0fwgrO0QwnjwCd7hCCRW3ssWsgFFm/DV2KxIdStnZI48aSitPa9JDSPH EWzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m+acSq/TkpyYxv16Qw49nXaW0OzDzxcF2f5zPzPa3zU=; b=BJ5Sa3zX2le/rQU6S/Pkd2DxkYrAirRA5wtHM4X7HcqYR5rdra365FGi+iHlkZwRZs 4r7OoUk2obiLP6Xci4aR9fggyUEjuBNf6JQd95m/K4paxo2/cBrvCRC5yWDL7rnKSdBR ySWqD0gXaaq+iSm18urP4sHQr+E1Xd1cce4BL2moDCqjLRW8HI3YN5blhxkAdmvW4zYN LSHhoZB37KXFH1c0+aJ0ENwE26nJx+OfsgjudmguIMH0ppXO2rLHgWY/+qfe/LA3wiLE IBchpgKgV5fIgd+s+iic4TGvrEunDbxpCLBtqLrG7/Y3OI4jBGYF7WUBQ30/CrOWy5jX 67uw== X-Gm-Message-State: AGRZ1gJL2UFlVuPejzYfKJSJ3wiNTWZU6/uNhIQ9RHXqf2ypu3l5FlHF ASBbz1REA/lLUEcoTuRLrXY= X-Google-Smtp-Source: AJdET5cfzmA3JQW6SQyEHv8PqAG71Je6JZUhzAC8wD0OQuilj/xpxrGGuYkNBhVJhclpqBiL//2NTQ== X-Received: by 2002:a65:42c2:: with SMTP id l2-v6mr13651015pgp.139.1542478311147; Sat, 17 Nov 2018 10:11:51 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id a73sm24816500pfa.7.2018.11.17.10.11.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Nov 2018 10:11:50 -0800 (PST) From: Andrey Smirnov To: linux-kernel@vger.kernel.org Subject: [PATCH 1/1] reset: imx7: Add support for i.MX8MQ Date: Sat, 17 Nov 2018 10:11:31 -0800 Message-Id: <20181117181131.9330-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181117181131.9330-1-andrew.smirnov@gmail.com> References: <20181117181131.9330-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181117_101202_325685_A4C8E76F X-CRM114-Status: GOOD ( 18.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-imx@nxp.com, p.zabel@pengutronix.de, Fabio Estevam , Leonard Crestez , cphealy@gmail.com, l.stach@pengutronix.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP SRC IP block used in i.MX8MQ is a superset of what is found in i.MX7D, so add all of the definitions necessary to support both. Cc: p.zabel@pengutronix.de Cc: Fabio Estevam Cc: cphealy@gmail.com Cc: l.stach@pengutronix.de Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Andrey Smirnov --- drivers/reset/Kconfig | 2 +- drivers/reset/reset-imx7.c | 66 ++++++++++++++++++++++++- include/dt-bindings/reset/imx7-reset.h | 15 +++++- include/dt-bindings/reset/imx8m-reset.h | 47 ++++++++++++++++++ 4 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 include/dt-bindings/reset/imx8m-reset.h diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index c21da9fe51ec..4909aab7401b 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -50,7 +50,7 @@ config RESET_HSDK config RESET_IMX7 bool "i.MX7 Reset Driver" if COMPILE_TEST depends on HAS_IOMEM - default SOC_IMX7D + default SOC_IMX7D || SOC_IMX8MQ select MFD_SYSCON help This enables the reset controller driver for i.MX7 SoCs. diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c index 77911fa8f31d..dffad618f805 100644 --- a/drivers/reset/reset-imx7.c +++ b/drivers/reset/reset-imx7.c @@ -21,14 +21,16 @@ #include #include #include +#include struct imx7_src { struct reset_controller_dev rcdev; struct regmap *regmap; }; -enum imx7_src_registers { +enum imx_src_registers { SRC_A7RCR0 = 0x0004, + SRC_A53RCR0 = 0x0004, SRC_M4RCR = 0x000c, SRC_ERCR = 0x0014, SRC_HSICPHY_RCR = 0x001c, @@ -36,7 +38,9 @@ enum imx7_src_registers { SRC_USBOPHY2_RCR = 0x0024, SRC_MIPIPHY_RCR = 0x0028, SRC_PCIEPHY_RCR = 0x002c, + SRC_PCIE2PHY_RCR = 0x0048, SRC_DDRC_RCR = 0x1000, + }; struct imx7_src_signal { @@ -67,11 +71,67 @@ static const struct imx7_src_signal imx7_src_signals[IMX7_RESET_NUM] = { [IMX7_RESET_PCIEPHY] = { SRC_PCIEPHY_RCR, BIT(2) | BIT(1) }, [IMX7_RESET_PCIEPHY_PERST] = { SRC_PCIEPHY_RCR, BIT(3) }, [IMX7_RESET_PCIE_CTRL_APPS_EN] = { SRC_PCIEPHY_RCR, BIT(6) }, + [IMX7_RESET_PCIE_CTRL_APPS_CLK_REQ] = { SRC_PCIEPHY_RCR, BIT(4) }, [IMX7_RESET_PCIE_CTRL_APPS_TURNOFF] = { SRC_PCIEPHY_RCR, BIT(11) }, [IMX7_RESET_DDRC_PRST] = { SRC_DDRC_RCR, BIT(0) }, [IMX7_RESET_DDRC_CORE_RST] = { SRC_DDRC_RCR, BIT(1) }, + + [IMX8M_RESET_A53_CORE_POR_RESET2] = { SRC_A53RCR0, BIT(2) }, + [IMX8M_RESET_A53_CORE_POR_RESET3] = { SRC_A53RCR0, BIT(3) }, + [IMX8M_RESET_A53_CORE_RESET2] = { SRC_A53RCR0, BIT(6) }, + [IMX8M_RESET_A53_CORE_RESET3] = { SRC_A53RCR0, BIT(7) }, + [IMX8M_RESET_A53_ETM_RESET2] = { SRC_A53RCR0, BIT(14) }, + [IMX8M_RESET_A53_ETM_RESET3] = { SRC_A53RCR0, BIT(15) }, + [IMX8M_RESET_PCIE2PHY] = { SRC_PCIEPHY_RCR, BIT(2) | BIT(1) }, + [IMX8M_RESET_PCIE2PHY_PERST] = { SRC_PCIE2PHY_RCR, BIT(3) }, + [IMX8M_RESET_PCIE2_CTRL_APPS_EN] = { SRC_PCIE2PHY_RCR, BIT(6) }, + [IMX8M_RESET_PCIE2_CTRL_APPS_CLK_REQ] = { SRC_PCIE2PHY_RCR, BIT(4) }, + [IMX8M_RESET_PCIE2_CTRL_APPS_TURNOFF] = { SRC_PCIE2PHY_RCR, BIT(11) }, }; +static inline void imx7_src_check_definitions(void) +{ + BUILD_BUG_ON(IMX8M_RESET_A53_CORE_POR_RESET0 != + IMX7_RESET_A7_CORE_POR_RESET0); + BUILD_BUG_ON(IMX8M_RESET_A53_CORE_POR_RESET1 != + IMX7_RESET_A7_CORE_POR_RESET1); + BUILD_BUG_ON(IMX8M_RESET_A53_CORE_RESET0 != + IMX7_RESET_A7_CORE_RESET0); + BUILD_BUG_ON(IMX8M_RESET_A53_CORE_RESET1 != + IMX7_RESET_A7_CORE_RESET1); + BUILD_BUG_ON(IMX8M_RESET_A53_DBG_RESET0 != + IMX7_RESET_A7_DBG_RESET0); + BUILD_BUG_ON(IMX8M_RESET_A53_DBG_RESET1 != + IMX7_RESET_A7_DBG_RESET1); + BUILD_BUG_ON(IMX8M_RESET_A53_ETM_RESET0 != + IMX7_RESET_A7_ETM_RESET0); + BUILD_BUG_ON(IMX8M_RESET_A53_ETM_RESET1 != + IMX7_RESET_A7_ETM_RESET1); + BUILD_BUG_ON(IMX8M_RESET_A53_SOC_DBG_RESET != + IMX7_RESET_A7_SOC_DBG_RESET); + BUILD_BUG_ON(IMX8M_RESET_A53_L2RESET != IMX7_RESET_A7_L2RESET); + BUILD_BUG_ON(IMX8M_RESET_SW_M4C_RST != IMX7_RESET_SW_M4C_RST); + BUILD_BUG_ON(IMX8M_RESET_SW_M4P_RST != IMX7_RESET_SW_M4P_RST); + BUILD_BUG_ON(IMX8M_RESET_EIM_RST != IMX7_RESET_EIM_RST); + BUILD_BUG_ON(IMX8M_RESET_HSICPHY_PORT_RST != + IMX7_RESET_HSICPHY_PORT_RST); + BUILD_BUG_ON(IMX8M_RESET_USBPHY1_POR != IMX7_RESET_USBPHY1_POR); + BUILD_BUG_ON(IMX8M_RESET_USBPHY1_PORT_RST != + IMX7_RESET_USBPHY1_PORT_RST); + BUILD_BUG_ON(IMX8M_RESET_USBPHY2_POR != IMX7_RESET_USBPHY2_POR); + BUILD_BUG_ON(IMX8M_RESET_USBPHY2_PORT_RST != + IMX7_RESET_USBPHY2_PORT_RST); + BUILD_BUG_ON(IMX8M_RESET_MIPI_PHY_MRST != IMX7_RESET_MIPI_PHY_MRST); + BUILD_BUG_ON(IMX8M_RESET_MIPI_PHY_SRST != IMX7_RESET_MIPI_PHY_SRST); + BUILD_BUG_ON(IMX8M_RESET_PCIEPHY != IMX7_RESET_PCIEPHY); + BUILD_BUG_ON(IMX8M_RESET_PCIE_CTRL_APPS_EN != + IMX7_RESET_PCIE_CTRL_APPS_EN); + BUILD_BUG_ON(IMX8M_RESET_PCIE_CTRL_APPS_TURNOFF != + IMX7_RESET_PCIE_CTRL_APPS_TURNOFF); + BUILD_BUG_ON(IMX8M_RESET_DDRC_PRST != IMX7_RESET_DDRC_PRST); + BUILD_BUG_ON(IMX8M_RESET_DDRC_CORE_RST != IMX7_RESET_DDRC_CORE_RST); +} + static struct imx7_src *to_imx7_src(struct reset_controller_dev *rcdev) { return container_of(rcdev, struct imx7_src, rcdev); @@ -85,6 +145,7 @@ static int imx7_reset_set(struct reset_controller_dev *rcdev, unsigned int value = assert ? signal->bit : 0; switch (id) { + case IMX8M_RESET_PCIE2PHY: /* FALLTHROUGH */ case IMX7_RESET_PCIEPHY: /* * wait for more than 10us to release phy g_rst and @@ -94,6 +155,7 @@ static int imx7_reset_set(struct reset_controller_dev *rcdev, udelay(10); break; + case IMX8M_RESET_PCIE2_CTRL_APPS_EN: /* FALLTHROUGH */ case IMX7_RESET_PCIE_CTRL_APPS_EN: value = (assert) ? 0 : signal->bit; break; @@ -126,6 +188,8 @@ static int imx7_reset_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct regmap_config config = { .name = "src" }; + imx7_src_check_definitions(); + imx7src = devm_kzalloc(dev, sizeof(*imx7src), GFP_KERNEL); if (!imx7src) return -ENOMEM; diff --git a/include/dt-bindings/reset/imx7-reset.h b/include/dt-bindings/reset/imx7-reset.h index 31b3f87dde9a..8fefd694d481 100644 --- a/include/dt-bindings/reset/imx7-reset.h +++ b/include/dt-bindings/reset/imx7-reset.h @@ -57,8 +57,21 @@ #define IMX7_RESET_DDRC_CORE_RST 24 #define IMX7_RESET_PCIE_CTRL_APPS_TURNOFF 25 +#define IMX7_RESET_PCIE_CTRL_APPS_CLK_REQ 26 -#define IMX7_RESET_NUM 26 +#define IMX8M_RESET_A53_CORE_POR_RESET2 27 +#define IMX8M_RESET_A53_CORE_POR_RESET3 28 +#define IMX8M_RESET_A53_CORE_RESET2 29 +#define IMX8M_RESET_A53_CORE_RESET3 30 +#define IMX8M_RESET_A53_ETM_RESET2 31 +#define IMX8M_RESET_A53_ETM_RESET3 32 +#define IMX8M_RESET_PCIE2PHY 33 +#define IMX8M_RESET_PCIE2PHY_PERST 34 +#define IMX8M_RESET_PCIE2_CTRL_APPS_EN 35 +#define IMX8M_RESET_PCIE2_CTRL_APPS_CLK_REQ 36 +#define IMX8M_RESET_PCIE2_CTRL_APPS_TURNOFF 37 + +#define IMX7_RESET_NUM 38 #endif diff --git a/include/dt-bindings/reset/imx8m-reset.h b/include/dt-bindings/reset/imx8m-reset.h new file mode 100644 index 000000000000..8fa840354723 --- /dev/null +++ b/include/dt-bindings/reset/imx8m-reset.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2018 Zodiac Inflight Innovations + * + * Author: Andrey Smirnov + */ + +#ifndef DT_BINDING_RESET_IMX8M_H +#define DT_BINDING_RESET_IMX8M_H + +#include "imx7-reset.h" + +#define IMX8M_RESET_A53_CORE_POR_RESET0 IMX7_RESET_A7_CORE_POR_RESET0 +#define IMX8M_RESET_A53_CORE_POR_RESET1 IMX7_RESET_A7_CORE_POR_RESET1 + +#define IMX8M_RESET_A53_CORE_RESET0 IMX7_RESET_A7_CORE_RESET0 +#define IMX8M_RESET_A53_CORE_RESET1 IMX7_RESET_A7_CORE_RESET1 + +#define IMX8M_RESET_A53_DBG_RESET0 IMX7_RESET_A7_DBG_RESET0 +#define IMX8M_RESET_A53_DBG_RESET1 IMX7_RESET_A7_DBG_RESET1 + +#define IMX8M_RESET_A53_ETM_RESET0 IMX7_RESET_A7_ETM_RESET0 +#define IMX8M_RESET_A53_ETM_RESET1 IMX7_RESET_A7_ETM_RESET1 + +#define IMX8M_RESET_A53_SOC_DBG_RESET IMX7_RESET_A7_SOC_DBG_RESET +#define IMX8M_RESET_A53_L2RESET IMX7_RESET_A7_L2RESET +#define IMX8M_RESET_SW_M4C_RST IMX7_RESET_SW_M4C_RST +#define IMX8M_RESET_SW_M4P_RST IMX7_RESET_SW_M4P_RST +#define IMX8M_RESET_EIM_RST IMX7_RESET_EIM_RST +#define IMX8M_RESET_HSICPHY_PORT_RST IMX7_RESET_HSICPHY_PORT_RST +#define IMX8M_RESET_USBPHY1_POR IMX7_RESET_USBPHY1_POR +#define IMX8M_RESET_USBPHY1_PORT_RST IMX7_RESET_USBPHY1_PORT_RST +#define IMX8M_RESET_USBPHY2_POR IMX7_RESET_USBPHY2_POR +#define IMX8M_RESET_USBPHY2_PORT_RST IMX7_RESET_USBPHY2_PORT_RST +#define IMX8M_RESET_MIPI_PHY_MRST IMX7_RESET_MIPI_PHY_MRST +#define IMX8M_RESET_MIPI_PHY_SRST IMX7_RESET_MIPI_PHY_SRST + +#define IMX8M_RESET_PCIEPHY IMX7_RESET_PCIEPHY +#define IMX8M_RESET_PCIEPHY_PERST IMX7_RESET_PCIEPHY_PERST +#define IMX8M_RESET_PCIE_CTRL_APPS_EN IMX7_RESET_PCIE_CTRL_APPS_EN +#define IMX8M_RESET_DDRC_PRST IMX7_RESET_DDRC_PRST +#define IMX8M_RESET_DDRC_CORE_RST IMX7_RESET_DDRC_CORE_RST + +#define IMX8M_RESET_PCIE_CTRL_APPS_TURNOFF IMX7_RESET_PCIE_CTRL_APPS_TURNOFF +#define IMX8M_RESET_PCIE_CTRL_APPS_CLK_REQ IMX7_RESET_PCIE_CTRL_APPS_CLK_REQ + +#endif