From patchwork Wed Nov 28 04:37:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10701883 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 0169813BF for ; Wed, 28 Nov 2018 04:38:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E49EB296D3 for ; Wed, 28 Nov 2018 04:38:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D86592C91C; Wed, 28 Nov 2018 04:38:16 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 025C1296D3 for ; Wed, 28 Nov 2018 04:38:16 +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=pet5CsHFVB2jGimOGDCzhi7hzpcB0EOENJd9vmbBxYg=; b=jVbfHnsdFzpvvI Xk1jgJTw/jbYnUHKAdrBGz6beR9gPs9NFqVGt3qddEFC2Vh6kf3IIke+m9TYmQDpyL2ep7em7UaY+ HsyYj6llq2QUbFdk2QPDs3kfpOxUE68PtDuzcNRFiS/a5SePzMz3SibC5O9c72UjFVD6dj3NEdtTC ziO3Lews04KrliNuBLG8NHQiQq4K8pvmJY0F05cfJ6UXuzCulD0g8iRhIWqJ0cjlmRYcQa3I3S/Yg ONmDWnzmJLr8Bp8yvAP+JfcYjYWQTvNnyeLEr4dDBml9KGVeQJV/iag5/1Av6zLJ1jn0rIFNIIVJp 3gwv0lGLCM7bzmchNPtA==; 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 1gRrbz-0003hI-EU; Wed, 28 Nov 2018 04:38:07 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRrbw-0003ey-DB for linux-arm-kernel@lists.infradead.org; Wed, 28 Nov 2018 04:38:06 +0000 Received: by mail-pg1-x543.google.com with SMTP id 70so8896481pgh.8 for ; Tue, 27 Nov 2018 20:37:54 -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=wKMQWWfUHZZOA8Vzj6/uHTz4rgCPTS/PQKfPLKAd68k=; b=Aikvz4gZIOSGLjoKRlkArv9rJlKlnMWzRKpjyaJOYGn438UAppm4ZTIkPsieyPJs/J mWB0BLnXPbOKwT6K3OWVec63a2jFEREcsrmlukroyuJE8EsQqQ7eirtWLtzBoGaol3RH MNSkBtvVQZOdW8A/38TlTcACZJU1iV8zL6axmc/KPlD04/yc11BA7XBxi7Auw/41HXBI vw2kVx0oaGdLbmLHnzMxAMaeU5+LB43vOdMwOrXhtxTjfHpDwuO6EaVE1rWe+OZSqqSd 4gKnnWissIS5rT+slIROQ5Ya0Vjni/K0oEnMVwxer4sjJQh5JpGUqoiwUycXSIdYTi29 lcxQ== 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=wKMQWWfUHZZOA8Vzj6/uHTz4rgCPTS/PQKfPLKAd68k=; b=SS3AnS0qDSgRCYiAsB3RIGUqQwTHiBJe8v/Z7RF2r0JwH+SOli9E9duMPguBaCjrGA gP9+MHCS5qquDYqsp1A2j2Wx2X8FaplqWhB9mqvVgZcXPuDdlLXyg8ERB0H5fz9vVM/P ZH1HXDSah3B8j7dJMahPiben4kaIj+pOaVqno9N+/2PGYWSMSq6qfpaEN19BaIYfcYNg nDnxLUmVfVl9mf478zUaOrVx45PDDhdNALPlHUPoCtkVOiHVqtk07vYXIGAosI8baNt3 2h0f8nXdFz0ROEOQtpiPVQ6KUj3oL5sHZkQGGnIjmqwlF/cyNO9HR4w3ooXYe6jBaioC RoWA== X-Gm-Message-State: AA+aEWbHCVgyQOarT1GrUGdTdTatJ+3WVcuiTSBes9kOiiL3mYTWJ1fA IJ0UCTGqgahfyDD+v/VngqY= X-Google-Smtp-Source: AFSGD/V+/SqdeXkkcw3/hIVS3ALxB9OUqaIJsoKIXJ23hshuqHsH02bGsjXbkm6ujP9vOguuqYgnYQ== X-Received: by 2002:a63:f811:: with SMTP id n17mr32690225pgh.23.1543379873586; Tue, 27 Nov 2018 20:37:53 -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 v2sm6387369pgs.0.2018.11.27.20.37.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Nov 2018 20:37:52 -0800 (PST) From: Andrey Smirnov To: linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] reset: imx7: Add plubming to support multiple IP variants Date: Tue, 27 Nov 2018 20:37:36 -0800 Message-Id: <20181128043738.12714-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128043738.12714-1-andrew.smirnov@gmail.com> References: <20181128043738.12714-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-20181127_203804_452861_3236FABD X-CRM114-Status: GOOD ( 15.74 ) 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" , Rob Herring , Richard Zhu , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.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 In order to enable supporting i.MX8MQ with this driver, convert it to expect variant specific bits to be passed via driver data. 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: Rob Herring 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 --- drivers/reset/reset-imx7.c | 62 +++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c index 77911fa8f31d..cfbb6346a72e 100644 --- a/drivers/reset/reset-imx7.c +++ b/drivers/reset/reset-imx7.c @@ -17,14 +17,29 @@ #include #include +#include #include #include #include #include +struct imx7_src_signal { + unsigned int offset, bit; +}; + +struct imx7_src; + +struct imx7_src_variant { + const struct imx7_src_signal *signals; + unsigned int signals_num; + unsigned int (*prepare)(struct imx7_src *imx7src, unsigned long id, + bool assert); +}; + struct imx7_src { struct reset_controller_dev rcdev; struct regmap *regmap; + struct imx7_src_variant *variant; }; enum imx7_src_registers { @@ -39,10 +54,6 @@ enum imx7_src_registers { SRC_DDRC_RCR = 0x1000, }; -struct imx7_src_signal { - unsigned int offset, bit; -}; - static const struct imx7_src_signal imx7_src_signals[IMX7_RESET_NUM] = { [IMX7_RESET_A7_CORE_POR_RESET0] = { SRC_A7RCR0, BIT(0) }, [IMX7_RESET_A7_CORE_POR_RESET1] = { SRC_A7RCR0, BIT(1) }, @@ -72,17 +83,11 @@ static const struct imx7_src_signal imx7_src_signals[IMX7_RESET_NUM] = { [IMX7_RESET_DDRC_CORE_RST] = { SRC_DDRC_RCR, BIT(1) }, }; -static struct imx7_src *to_imx7_src(struct reset_controller_dev *rcdev) +static unsigned int +imx7_src_prepare(struct imx7_src *imx7src, unsigned long id, bool assert) { - return container_of(rcdev, struct imx7_src, rcdev); -} - -static int imx7_reset_set(struct reset_controller_dev *rcdev, - unsigned long id, bool assert) -{ - struct imx7_src *imx7src = to_imx7_src(rcdev); - const struct imx7_src_signal *signal = &imx7_src_signals[id]; - unsigned int value = assert ? signal->bit : 0; + const unsigned int bit = imx7src->variant->signals[id].bit; + unsigned int value = assert ? bit : 0; switch (id) { case IMX7_RESET_PCIEPHY: @@ -95,10 +100,32 @@ static int imx7_reset_set(struct reset_controller_dev *rcdev, break; case IMX7_RESET_PCIE_CTRL_APPS_EN: - value = (assert) ? 0 : signal->bit; + value = assert ? 0 : bit; break; } + return value; +} + +static const struct imx7_src_variant variant_imx7 = { + .signals = imx7_src_signals, + .signals_num = ARRAY_SIZE(imx7_src_signals), + .prepare = imx7_src_prepare, +}; + +static struct imx7_src *to_imx7_src(struct reset_controller_dev *rcdev) +{ + return container_of(rcdev, struct imx7_src, rcdev); +} + +static int imx7_reset_set(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) +{ + struct imx7_src *imx7src = to_imx7_src(rcdev); + const struct imx7_src_variant *variant = imx7src->variant; + const struct imx7_src_signal *signal = &variant->signals[id]; + const unsigned int value = variant->prepare(imx7src, id, assert); + return regmap_update_bits(imx7src->regmap, signal->offset, signal->bit, value); } @@ -130,6 +157,7 @@ static int imx7_reset_probe(struct platform_device *pdev) if (!imx7src) return -ENOMEM; + imx7src->variant = of_device_get_match_data(dev); imx7src->regmap = syscon_node_to_regmap(dev->of_node); if (IS_ERR(imx7src->regmap)) { dev_err(dev, "Unable to get imx7-src regmap"); @@ -138,7 +166,7 @@ static int imx7_reset_probe(struct platform_device *pdev) regmap_attach_dev(dev, imx7src->regmap, &config); imx7src->rcdev.owner = THIS_MODULE; - imx7src->rcdev.nr_resets = IMX7_RESET_NUM; + imx7src->rcdev.nr_resets = imx7src->variant->signals_num; imx7src->rcdev.ops = &imx7_reset_ops; imx7src->rcdev.of_node = dev->of_node; @@ -146,7 +174,7 @@ static int imx7_reset_probe(struct platform_device *pdev) } static const struct of_device_id imx7_reset_dt_ids[] = { - { .compatible = "fsl,imx7d-src", }, + { .compatible = "fsl,imx7d-src", .data = &variant_imx7 }, { /* sentinel */ }, }; From patchwork Wed Nov 28 04:37:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10701885 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 A217B13BF for ; Wed, 28 Nov 2018 04:38:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91035296CC for ; Wed, 28 Nov 2018 04:38:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84F342C90D; Wed, 28 Nov 2018 04:38:22 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, 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 D0D66296CC for ; Wed, 28 Nov 2018 04:38:21 +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=y2MT3A+BPW43VUfqN38k9Vx00OTlfY1a6gDZfejibQc=; b=Qn7xfAslWehVcv tKmjOVAxsNosvbEAE+jBqWhAAvxII4S2I9AqBVoSiF8l4+C9gwPC/Raj+03Vn0hwwlnWIZRB7+kAg 4jhhYbwk1h+4j2cKI73yHGrBLg10/oQzRG8BaAWtCEjV08TSE/Zdo6bKOMl8qygxlL9hpq/3NjHVP 0jhQY1gwQwRpFAehWq/4cqHzirr403+8hmzSYTSzIuC3nxueozW1LvoiriQTK5nMtgfreNchO7NZj pw4vB0v5GiqkoMHzdaTuiY7E7jVdT1uXtbiJl1YR4ZCr1T0mSZXLRdda5QZLxc7r+6lA3V+C8D6JJ rEYLuF5MxqYoB/sj2aZA==; 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 1gRrc9-0003qS-JS; Wed, 28 Nov 2018 04:38:17 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRrbw-0003f1-D9 for linux-arm-kernel@lists.infradead.org; Wed, 28 Nov 2018 04:38:06 +0000 Received: by mail-pg1-x543.google.com with SMTP id z11so8914373pgu.0 for ; Tue, 27 Nov 2018 20:37:56 -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=qbWsa0jVWktcktrL1lg9/sliCbQ1pku9yoOxqB5aTvg=; b=SgfTixa0rypG5eIvpVgjJ4ZYgbrFz+JzROUxiMCoKdrEafFa+OantilcnNega9u21j 4Z1GbwenlVQRxXouPQ0I+58XfS9UFVvmcivEbKXcENPFcdDHgya6AEAdNxJJvrzRY9Ov OeVR4bhHDhqMNEAS4VKcdJZbDybRM+E96qnIKtHYOnLFDc9Fxz7AHO34NcL+ZEK+EH+k mvVpWrld8LlpgcaHtj/wArxcQHBOdGt1N+O2WjuKCRVVf+Vxho+odlH05GAbIaWRNHyr Tl9u0ANZgYTgvoWeObLDapm8+ociSwwX/bqFnXwMMmLVwu4GiVzWOGmeVEsyu1rSJCEW +Gfw== 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=qbWsa0jVWktcktrL1lg9/sliCbQ1pku9yoOxqB5aTvg=; b=QXRQlRLHu3DvK6kXlJrgRBl8P3CUv6LwwALmRnaJsY3DbpiRfMH3BzT4+nk0KEy/TA GS8SlrNh5uc6yOOXysj/JGmQd1qmuFiSx5t/6ELZQ3jYoN2CjHn6/GLiZZ3U4QmP0Gvg GFF1VCOlIpilCchUJgUp1nsVrhHoYDl8+eyO1mN+ZuziLTZo+wVkXbqzjqbdryy9oudA dGGfC42taHv2JqCqNSbGoTdBrOKpDvHmbuD6iEtTxUPWP5RgoWaKus2CHIBD/cJOPh37 UTVoedjOW8EMkGNqgOd3JdHbZ7IszU8aUJ6lKheGUAm8Mo6uXqJofLB9CFWWKgzImSv7 lU0g== X-Gm-Message-State: AA+aEWZ4f0TZ+ZJQLuNweTdUP8Dk2byOn+cjoBF5A59hipQN2ps4/Qup 0ihRY4gwWnP30xxMJI2peV4= X-Google-Smtp-Source: AFSGD/UtpMSKT7pp1XBz/DJXfzWIqK3B7CynzgTpvMrYPg7bXr40IvcvRPIQfL6+o2S5VCnc0XCvZQ== X-Received: by 2002:a63:d846:: with SMTP id k6mr32440535pgj.251.1543379875535; Tue, 27 Nov 2018 20:37:55 -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 v2sm6387369pgs.0.2018.11.27.20.37.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Nov 2018 20:37:54 -0800 (PST) From: Andrey Smirnov To: linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] reset: imx7: Add support for i.MX8MQ IP block variant Date: Tue, 27 Nov 2018 20:37:37 -0800 Message-Id: <20181128043738.12714-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128043738.12714-1-andrew.smirnov@gmail.com> References: <20181128043738.12714-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-20181127_203804_452727_6AD5A773 X-CRM114-Status: GOOD ( 19.87 ) 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" , Rob Herring , Richard Zhu , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.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 Add bits and pieces needed to support IP block variant found on i.MX8MQ SoCs. 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: Rob Herring 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 --- drivers/reset/Kconfig | 2 +- drivers/reset/reset-imx7.c | 106 +++++++++++++++++++++++ include/dt-bindings/reset/imx8mq-reset.h | 64 ++++++++++++++ 3 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/reset/imx8mq-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 cfbb6346a72e..34ce7448b299 100644 --- a/drivers/reset/reset-imx7.c +++ b/drivers/reset/reset-imx7.c @@ -22,6 +22,7 @@ #include #include #include +#include struct imx7_src_signal { unsigned int offset, bit; @@ -113,6 +114,110 @@ static const struct imx7_src_variant variant_imx7 = { .prepare = imx7_src_prepare, }; +enum imx8mq_src_registers { + SRC_A53RCR0 = 0x0004, + SRC_HDMI_RCR = 0x0030, + SRC_DISP_RCR = 0x0034, + SRC_GPU_RCR = 0x0040, + SRC_VPU_RCR = 0x0044, + SRC_PCIE2_RCR = 0x0048, + SRC_MIPIPHY1_RCR = 0x004c, + SRC_MIPIPHY2_RCR = 0x0050, + SRC_DDRC2_RCR = 0x1004, +}; + +static const struct imx7_src_signal imx8mq_src_signals[IMX8MQ_RESET_NUM] = { + [IMX8MQ_RESET_A53_CORE_POR_RESET0] = { SRC_A53RCR0, BIT(0) }, + [IMX8MQ_RESET_A53_CORE_POR_RESET1] = { SRC_A53RCR0, BIT(1) }, + [IMX8MQ_RESET_A53_CORE_POR_RESET2] = { SRC_A53RCR0, BIT(2) }, + [IMX8MQ_RESET_A53_CORE_POR_RESET3] = { SRC_A53RCR0, BIT(3) }, + [IMX8MQ_RESET_A53_CORE_RESET0] = { SRC_A53RCR0, BIT(4) }, + [IMX8MQ_RESET_A53_CORE_RESET1] = { SRC_A53RCR0, BIT(5) }, + [IMX8MQ_RESET_A53_CORE_RESET2] = { SRC_A53RCR0, BIT(6) }, + [IMX8MQ_RESET_A53_CORE_RESET3] = { SRC_A53RCR0, BIT(7) }, + [IMX8MQ_RESET_A53_DBG_RESET0] = { SRC_A53RCR0, BIT(8) }, + [IMX8MQ_RESET_A53_DBG_RESET1] = { SRC_A53RCR0, BIT(9) }, + [IMX8MQ_RESET_A53_DBG_RESET2] = { SRC_A53RCR0, BIT(10) }, + [IMX8MQ_RESET_A53_DBG_RESET3] = { SRC_A53RCR0, BIT(11) }, + [IMX8MQ_RESET_A53_ETM_RESET0] = { SRC_A53RCR0, BIT(12) }, + [IMX8MQ_RESET_A53_ETM_RESET1] = { SRC_A53RCR0, BIT(13) }, + [IMX8MQ_RESET_A53_ETM_RESET2] = { SRC_A53RCR0, BIT(14) }, + [IMX8MQ_RESET_A53_ETM_RESET3] = { SRC_A53RCR0, BIT(15) }, + [IMX8MQ_RESET_A53_SOC_DBG_RESET] = { SRC_A53RCR0, BIT(20) }, + [IMX8MQ_RESET_A53_L2RESET] = { SRC_A53RCR0, BIT(21) }, + [IMX8MQ_RESET_SW_NON_SCLR_M4C_RST] = { SRC_M4RCR, BIT(0) }, + [IMX8MQ_RESET_OTG1_PHY_RESET] = { SRC_USBOPHY1_RCR, BIT(0) }, + [IMX8MQ_RESET_OTG2_PHY_RESET] = { SRC_USBOPHY2_RCR, BIT(0) }, + [IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N] = { SRC_MIPIPHY_RCR, BIT(1) }, + [IMX8MQ_RESET_MIPI_DSI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(2) }, + [IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(3) }, + [IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N] = { SRC_MIPIPHY_RCR, BIT(4) }, + [IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N] = { SRC_MIPIPHY_RCR, BIT(5) }, + [IMX8MQ_RESET_PCIEPHY] = { SRC_PCIEPHY_RCR, + BIT(2) | BIT(1) }, + [IMX8MQ_RESET_PCIEPHY_PERST] = { SRC_PCIEPHY_RCR, BIT(3) }, + [IMX8MQ_RESET_PCIE_CTRL_APPS_EN] = { SRC_PCIEPHY_RCR, BIT(6) }, + [IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF] = { SRC_PCIEPHY_RCR, BIT(11) }, + [IMX8MQ_RESET_HDMI_PHY_APB_RESET] = { SRC_HDMI_RCR, BIT(0) }, + [IMX8MQ_RESET_DISP_RESET] = { SRC_DISP_RCR, BIT(0) }, + [IMX8MQ_RESET_GPU_RESET] = { SRC_GPU_RCR, BIT(0) }, + [IMX8MQ_RESET_VPU_RESET] = { SRC_VPU_RCR, BIT(0) }, + [IMX8MQ_RESET_PCIEPHY2] = { SRC_PCIE2_RCR, + BIT(2) | BIT(1) }, + [IMX8MQ_RESET_PCIEPHY2_PERST] = { SRC_PCIE2_RCR, BIT(3) }, + [IMX8MQ_RESET_PCIE2_CTRL_APPS_EN] = { SRC_PCIE2_RCR, BIT(6) }, + [IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF] = { SRC_PCIE2_RCR, BIT(11) }, + [IMX8MQ_RESET_MIPI_CSI1_CORE_RESET] = { SRC_MIPIPHY1_RCR, BIT(0) }, + [IMX8MQ_RESET_MIPI_CSI1_PHY_REF_RESET] = { SRC_MIPIPHY1_RCR, BIT(1) }, + [IMX8MQ_RESET_MIPI_CSI1_ESC_RESET] = { SRC_MIPIPHY1_RCR, BIT(2) }, + [IMX8MQ_RESET_MIPI_CSI2_CORE_RESET] = { SRC_MIPIPHY2_RCR, BIT(0) }, + [IMX8MQ_RESET_MIPI_CSI2_PHY_REF_RESET] = { SRC_MIPIPHY2_RCR, BIT(1) }, + [IMX8MQ_RESET_MIPI_CSI2_ESC_RESET] = { SRC_MIPIPHY2_RCR, BIT(2) }, + [IMX8MQ_RESET_DDRC1_PRST] = { SRC_DDRC_RCR, BIT(0) }, + [IMX8MQ_RESET_DDRC1_CORE_RESET] = { SRC_DDRC_RCR, BIT(1) }, + [IMX8MQ_RESET_DDRC1_PHY_RESET] = { SRC_DDRC_RCR, BIT(2) }, + [IMX8MQ_RESET_DDRC2_PHY_RESET] = { SRC_DDRC2_RCR, BIT(0) }, + [IMX8MQ_RESET_DDRC2_CORE_RESET] = { SRC_DDRC2_RCR, BIT(1) }, + [IMX8MQ_RESET_DDRC2_PRST] = { SRC_DDRC2_RCR, BIT(2) }, +}; + +static unsigned int +imx8mq_src_prepare(struct imx7_src *imx7src, unsigned long id, bool assert) +{ + const unsigned int bit = imx7src->variant->signals[id].bit; + unsigned int value = assert ? bit : 0; + + switch (id) { + case IMX8MQ_RESET_PCIEPHY: + case IMX8MQ_RESET_PCIEPHY2: /* fallthrough */ + /* + * wait for more than 10us to release phy g_rst and + * btnrst + */ + if (!assert) + udelay(10); + break; + + case IMX8MQ_RESET_PCIE_CTRL_APPS_EN: + case IMX8MQ_RESET_PCIE2_CTRL_APPS_EN: /* fallthrough */ + case IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N: /* fallthrough */ + case IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N: /* fallthrough */ + case IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N: /* fallthrough */ + case IMX8MQ_RESET_MIPI_DSI_RESET_N: /* fallthrough */ + case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N: /* fallthrough */ + value = assert ? 0 : bit; + break; + } + + return value; +} + +static const struct imx7_src_variant variant_imx8mq = { + .signals = imx8mq_src_signals, + .signals_num = ARRAY_SIZE(imx8mq_src_signals), + .prepare = imx8mq_src_prepare, +}; + static struct imx7_src *to_imx7_src(struct reset_controller_dev *rcdev) { return container_of(rcdev, struct imx7_src, rcdev); @@ -175,6 +280,7 @@ static int imx7_reset_probe(struct platform_device *pdev) static const struct of_device_id imx7_reset_dt_ids[] = { { .compatible = "fsl,imx7d-src", .data = &variant_imx7 }, + { .compatible = "fsl,imx8mq-src", .data = &variant_imx8mq }, { /* sentinel */ }, }; diff --git a/include/dt-bindings/reset/imx8mq-reset.h b/include/dt-bindings/reset/imx8mq-reset.h new file mode 100644 index 000000000000..57c592498aa0 --- /dev/null +++ b/include/dt-bindings/reset/imx8mq-reset.h @@ -0,0 +1,64 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2018 Zodiac Inflight Innovations + * + * Author: Andrey Smirnov + */ + +#ifndef DT_BINDING_RESET_IMX8MQ_H +#define DT_BINDING_RESET_IMX8MQ_H + +#define IMX8MQ_RESET_A53_CORE_POR_RESET0 0 +#define IMX8MQ_RESET_A53_CORE_POR_RESET1 1 +#define IMX8MQ_RESET_A53_CORE_POR_RESET2 2 +#define IMX8MQ_RESET_A53_CORE_POR_RESET3 3 +#define IMX8MQ_RESET_A53_CORE_RESET0 4 +#define IMX8MQ_RESET_A53_CORE_RESET1 5 +#define IMX8MQ_RESET_A53_CORE_RESET2 6 +#define IMX8MQ_RESET_A53_CORE_RESET3 7 +#define IMX8MQ_RESET_A53_DBG_RESET0 8 +#define IMX8MQ_RESET_A53_DBG_RESET1 9 +#define IMX8MQ_RESET_A53_DBG_RESET2 10 +#define IMX8MQ_RESET_A53_DBG_RESET3 11 +#define IMX8MQ_RESET_A53_ETM_RESET0 12 +#define IMX8MQ_RESET_A53_ETM_RESET1 13 +#define IMX8MQ_RESET_A53_ETM_RESET2 14 +#define IMX8MQ_RESET_A53_ETM_RESET3 15 +#define IMX8MQ_RESET_A53_SOC_DBG_RESET 16 +#define IMX8MQ_RESET_A53_L2RESET 17 +#define IMX8MQ_RESET_SW_NON_SCLR_M4C_RST 18 +#define IMX8MQ_RESET_OTG1_PHY_RESET 19 +#define IMX8MQ_RESET_OTG2_PHY_RESET 20 +#define IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N 21 +#define IMX8MQ_RESET_MIPI_DSI_RESET_N 22 +#define IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N 23 +#define IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N 24 +#define IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N 25 +#define IMX8MQ_RESET_PCIEPHY 26 +#define IMX8MQ_RESET_PCIEPHY_PERST 27 +#define IMX8MQ_RESET_PCIE_CTRL_APPS_EN 28 +#define IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF 29 +#define IMX8MQ_RESET_HDMI_PHY_APB_RESET 30 +#define IMX8MQ_RESET_DISP_RESET 31 +#define IMX8MQ_RESET_GPU_RESET 32 +#define IMX8MQ_RESET_VPU_RESET 33 +#define IMX8MQ_RESET_PCIEPHY2 34 +#define IMX8MQ_RESET_PCIEPHY2_PERST 35 +#define IMX8MQ_RESET_PCIE2_CTRL_APPS_EN 36 +#define IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF 37 +#define IMX8MQ_RESET_MIPI_CSI1_CORE_RESET 38 +#define IMX8MQ_RESET_MIPI_CSI1_PHY_REF_RESET 39 +#define IMX8MQ_RESET_MIPI_CSI1_ESC_RESET 40 +#define IMX8MQ_RESET_MIPI_CSI2_CORE_RESET 41 +#define IMX8MQ_RESET_MIPI_CSI2_PHY_REF_RESET 42 +#define IMX8MQ_RESET_MIPI_CSI2_ESC_RESET 43 +#define IMX8MQ_RESET_DDRC1_PRST 44 +#define IMX8MQ_RESET_DDRC1_CORE_RESET 45 +#define IMX8MQ_RESET_DDRC1_PHY_RESET 46 +#define IMX8MQ_RESET_DDRC2_PRST 47 +#define IMX8MQ_RESET_DDRC2_CORE_RESET 48 +#define IMX8MQ_RESET_DDRC2_PHY_RESET 49 + +#define IMX8MQ_RESET_NUM 50 + +#endif From patchwork Wed Nov 28 04:37:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10701889 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 5217213BF for ; Wed, 28 Nov 2018 04:39:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41AB92C89A for ; Wed, 28 Nov 2018 04:39:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34F0C2C90D; Wed, 28 Nov 2018 04:39:07 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 B47542C89A for ; Wed, 28 Nov 2018 04:39:06 +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=sKdiXVGlxJpPR4rpn72/PCNTfCL5R6AjQSHxZ/ojt8g=; b=b62JM/UtSJzMJ7 zqh94vBqOiY43eOuifQLhEcpWBz50SF81yysVqrbFoCrh8VoUbNtYj6cU8M6YCiPrXUp/ZfZV1hX7 ffwN1fawkP21maGR1xyih1cQh9cXgSJ2ALksXWLyF0iWDN13hA7NPJV+eUl04GxHduRRSSQrm5Pxw 4mCJVI0OQpFLMhkfBCW423+skZhq8BqeWM04QGkFq796worSUBkWVyxUFK+TrgsSYqN9vNQLIqIVh QN6EXcm5EOXd3gQHu0fWjzJ55sodU5b+m5rSuiCKXH6MRNYrvJEMnIJGVRqxDk7w9ncJq4ikmfwPq tKXbblFXMmA6DqA2FV/w==; 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 1gRrct-0004Q9-B1; Wed, 28 Nov 2018 04:39:03 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRrc0-0003fO-3F for linux-arm-kernel@lists.infradead.org; Wed, 28 Nov 2018 04:38:11 +0000 Received: by mail-pl1-x644.google.com with SMTP id f12-v6so16750832plo.1 for ; Tue, 27 Nov 2018 20:37:57 -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=6lmll1IWsxEUtw2cYFC//V9pRv5fGesI1eg7SA2Km1o=; b=HUk6DR9OhEtM6ZYht4H+OhpxGZXv5T553IsVuUUBTcVc7s/QW4SQiAz0ystv/mL+Mu UvKMULbARcrDYi+27o4VcFF/CS7MZtscBq8hyPbPMSg/9LBfo/VHsyAkvAhZaPy9hCdK QMhAHO9uw/fqZ+hrWf4weDs+B4CWEe3E3m6PnE+X+CCfBqyHQFd6Llhdo97EKX+iMpP8 Oc90SZRUPbZiJAgtu10H7QpqhhVKI1i4Z9gekzs37fddDRLYzCkelBDhEukX5li/uWxp A0aIg9eenRWfus4U1uU7ECprg82lCMPIoPQ2q8oyN5aBMkyGLcyw9NX2SDLePD/LM6Q3 4jjw== 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=6lmll1IWsxEUtw2cYFC//V9pRv5fGesI1eg7SA2Km1o=; b=Ke1F9/gn4JGWeqNxNZcRVHr/MuOxa9olfyKwWBMM1PnFMEe3LCTwNobl34GUd1l1Aq yGS3x6v1UOvKI2gn/ZzZjlaHc4+3YrNmCQsx5oz2nZ4wkMZ+f2gEFFaTuBN2U3fdUSpy hIgF10yrm75bGTp1OqXbsyl0ZQl1pvLXjsfb47HvYMJ7nNd+bN//vT3eZsZD5Hz0L6Gj Ooma0aDk2+nv8m6XvdECzpZRB57o4lhep9r7xiTsQ+nC+fTICB2lLG5RG14WE9WthIsu t68scJpMvNbT18dfbCifNgpUAJk5VDA+oUE7fQ9wjRjOmxv3mO1QV/V3BqyUyd64bBM2 fz5A== X-Gm-Message-State: AA+aEWaIm9eyE+vH9HNEvfpaO5AQDhG3LyO5Uoj9IZhIXeATv85yjkZm NCxFSwuGX78a4IHLawjUAKI= X-Google-Smtp-Source: AFSGD/USX+60GnLheEVRPzbphISKnvxIRprGi7XFICLWy6E+1E/MsdeZEMGa7navk57mp8s4es4b1Q== X-Received: by 2002:a17:902:7044:: with SMTP id h4mr15269725plt.35.1543379877208; Tue, 27 Nov 2018 20:37:57 -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 v2sm6387369pgs.0.2018.11.27.20.37.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Nov 2018 20:37:56 -0800 (PST) From: Andrey Smirnov To: linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] dt-bindings: reset: imx7: Document usage on i.MX8MQ SoCs Date: Tue, 27 Nov 2018 20:37:38 -0800 Message-Id: <20181128043738.12714-4-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128043738.12714-1-andrew.smirnov@gmail.com> References: <20181128043738.12714-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-20181127_203808_421236_26308EAA X-CRM114-Status: GOOD ( 11.95 ) 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" , Rob Herring , Richard Zhu , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.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 The driver now supports i.MX8MQ, so update bindings accordingly. 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: Rob Herring 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 --- Documentation/devicetree/bindings/reset/fsl,imx7-src.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/reset/fsl,imx7-src.txt b/Documentation/devicetree/bindings/reset/fsl,imx7-src.txt index 1ab1d109318e..2ecf33815d18 100644 --- a/Documentation/devicetree/bindings/reset/fsl,imx7-src.txt +++ b/Documentation/devicetree/bindings/reset/fsl,imx7-src.txt @@ -5,7 +5,9 @@ Please also refer to reset.txt in this directory for common reset controller binding usage. Required properties: -- compatible: Should be "fsl,imx7d-src", "syscon" +- compatible: + - For i.MX7 SoCs should be "fsl,imx7d-src", "syscon" + - For i.MX8MQ SoCs should be "fsl,imx8mq-src", "syscon" - reg: should be register base and length as documented in the datasheet - interrupts: Should contain SRC interrupt @@ -44,4 +46,5 @@ Example: For list of all valid reset indicies see - + for i.MX7 and + for i.MX8MQ