From patchwork Mon Mar 18 19:38:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 10859017 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 58C96139A for ; Tue, 19 Mar 2019 08:12:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F857295B5 for ; Tue, 19 Mar 2019 08:12:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33CBE295C5; Tue, 19 Mar 2019 08:12:49 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1F74295B5 for ; Tue, 19 Mar 2019 08:12:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA256899E7; Tue, 19 Mar 2019 08:12:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E191898C2 for ; Mon, 18 Mar 2019 19:41:00 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id a188so14081401wmf.3 for ; Mon, 18 Mar 2019 12:40:59 -0700 (PDT) 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; bh=mCYuzjXjAhAdmGCTChMacQlApx18wWBt60iN6MyaJRQ=; b=JIvUk7d19HSI5jjTVddHbhoQPV2wIV7cg5LPJM1dz04ZhtsDXnSFfh/mgz+XnVsIh5 5ofYo+DW9xL/73LxYlo4d7z1iDrOLBor3sbC9HXbNLPTLe1zDYA2W9eQl+mLeOWbnQVO razw1wLt3WtCXCUe88dd2H5mEySngHTyZxhZ6LtN/9lmoTeQ8uOBTB4LnEux2D8Z33KN 5XfJVP+cSmwMIzdMEQHqTAbjmqlEJJ7R9I9IVWLPTSpKbs0gW7GZxvj6546Yh5UioKVe W8/0GTmJEI1Eg6w9ihUVkczdGPaBa/TpUNYsFmsTem8kG0uuUHCXjWj9toNYhpfw2Sg7 yF1A== X-Gm-Message-State: APjAAAXMT7XUB/VUQjRYu8Aupo5dBLQZpTA8vA69vhJX2d0MjT4UtvNV p6d6VWRyZXD3aiUoK7HBAVZ2QQ== X-Google-Smtp-Source: APXvYqzhTusUZxAZX+UKsouiPFztVANdEtEHZhoPKs/a4eIOoxpW2MoOwRrgddVlTUDXw8v7v30Evg== X-Received: by 2002:a1c:7517:: with SMTP id o23mr435554wmc.9.1552938058758; Mon, 18 Mar 2019 12:40:58 -0700 (PDT) Received: from localhost.localdomain (cpc89244-aztw30-2-0-cust4998.18-1.cable.virginm.net. [86.31.179.135]) by smtp.gmail.com with ESMTPSA id s10sm4583941wrv.56.2019.03.18.12.40.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Mar 2019 12:40:57 -0700 (PDT) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, mark.rutland@arm.com, p.zabel@pengutronix.de, xuwei5@hisilicon.com, mturquette@baylibre.com, sboyd@kernel.org Subject: [PATCH v1 4/6] reset: hi6220: Add support for AO reset controller Date: Mon, 18 Mar 2019 19:38:49 +0000 Message-Id: <1552937931-23050-5-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552937931-23050-1-git-send-email-peter.griffin@linaro.org> References: <1552937931-23050-1-git-send-email-peter.griffin@linaro.org> X-Mailman-Approved-At: Tue, 19 Mar 2019 08:12:25 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mCYuzjXjAhAdmGCTChMacQlApx18wWBt60iN6MyaJRQ=; b=HzvfasmhXnx4JtwlIbiPWvb50HOkNd7QnQnXq9U/+ESG1TejnfmEDg90Pc/oz36xGF 3FSmmSmVBKgE++CMgTIp8QW5g5gcHWd7kvj4GAeLCLOdKbtbjGOK//MgjviiqWJxbOBS W1sIbjiPH+oUPWgpFovf9d7XNbVAkChWDuSYDGNFYuAFnpM0fUHfuAUZYuCDI76YIITj LuwAxB/14vsrp9U6YqS1qFMou5f/wHNbFs4t6Hvf8Kx4OsPFjT/b3w20mPWpKpUF/HI9 Asnz4uFGvVG6eu6B+3MEFCUdYf5M19qG2hA1797dOk+6YQXG/F+Fjzp8bvbxhcBuF9v+ tLAA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, yuq825@gmail.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is required to bring Mali450 gpu out of reset. Signed-off-by: Peter Griffin --- drivers/reset/hisilicon/hi6220_reset.c | 51 +++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/drivers/reset/hisilicon/hi6220_reset.c b/drivers/reset/hisilicon/hi6220_reset.c index d5e5229..0cd5f92 100644 --- a/drivers/reset/hisilicon/hi6220_reset.c +++ b/drivers/reset/hisilicon/hi6220_reset.c @@ -36,6 +36,7 @@ enum hi6220_reset_ctrl_type { PERIPHERAL, MEDIA, + AO, }; struct hi6220_reset_data { @@ -95,6 +96,47 @@ static const struct reset_control_ops hi6220_media_reset_ops = { .deassert = hi6220_media_deassert, }; +#define AO_SCTRL_SC_PW_CLKEN0 0x800 +#define AO_SCTRL_SC_PW_CLKDIS0 0x804 + +#define AO_SCTRL_SC_PW_RSTEN0 0x810 +#define AO_SCTRL_SC_PW_RSTDIS0 0x814 + +#define AO_SCTRL_SC_PW_ISOEN0 0x820 +#define AO_SCTRL_SC_PW_ISODIS0 0x824 +#define AO_MAX_INDEX 12 + +static int hi6220_ao_assert(struct reset_controller_dev *rc_dev, + unsigned long idx) +{ + struct hi6220_reset_data *data = to_reset_data(rc_dev); + struct regmap *regmap = data->regmap; + int ret; + + ret = regmap_write(regmap, AO_SCTRL_SC_PW_RSTEN0, BIT(idx)); + ret |= regmap_write(regmap, AO_SCTRL_SC_PW_ISOEN0, BIT(idx)); + ret |= regmap_write(regmap, AO_SCTRL_SC_PW_CLKDIS0, BIT(idx)); + return ret; +} + +static int hi6220_ao_deassert(struct reset_controller_dev *rc_dev, + unsigned long idx) +{ + struct hi6220_reset_data *data = to_reset_data(rc_dev); + struct regmap *regmap = data->regmap; + int ret; + + ret = regmap_write(regmap, AO_SCTRL_SC_PW_RSTDIS0, BIT(idx)); + ret |= regmap_write(regmap, AO_SCTRL_SC_PW_ISODIS0, BIT(idx)); + ret |= regmap_write(regmap, AO_SCTRL_SC_PW_CLKEN0, BIT(idx)); + return ret; +} + +static const struct reset_control_ops hi6220_ao_reset_ops = { + .assert = hi6220_ao_assert, + .deassert = hi6220_ao_deassert, +}; + static int hi6220_reset_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -120,9 +162,12 @@ static int hi6220_reset_probe(struct platform_device *pdev) if (type == MEDIA) { data->rc_dev.ops = &hi6220_media_reset_ops; data->rc_dev.nr_resets = MEDIA_MAX_INDEX; - } else { + } else if (type == PERIPHERAL) { data->rc_dev.ops = &hi6220_peripheral_reset_ops; data->rc_dev.nr_resets = PERIPH_MAX_INDEX; + } else { + data->rc_dev.ops = &hi6220_ao_reset_ops; + data->rc_dev.nr_resets = AO_MAX_INDEX; } return reset_controller_register(&data->rc_dev); @@ -137,6 +182,10 @@ static const struct of_device_id hi6220_reset_match[] = { .compatible = "hisilicon,hi6220-mediactrl", .data = (void *)MEDIA, }, + { + .compatible = "hisilicon,hi6220-aoctrl", + .data = (void *)AO, + }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, hi6220_reset_match);