Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp720362img; Mon, 18 Mar 2019 12:42:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5U6THot7y6e2B9bB6FJKx+TrjGQb0TjnliG1zzeFfLhnAfBA5H62BsolBtdg/IERuapVC X-Received: by 2002:a17:902:7592:: with SMTP id j18mr21094136pll.300.1552938156300; Mon, 18 Mar 2019 12:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552938156; cv=none; d=google.com; s=arc-20160816; b=eR1AtmZ3PKQ6MLq3aJlqxnq5J5RmCsRIniTXs7W4C+SwsC2rwN7BwJYa1p5eIyIvNt BDCY7TsrrhOknnPFgYL2JVzuFhIUTr2S4sdyewDgzKSXH1xA8b7YT4UCjff5q+K8kqxM mLzcfjb/jf0rTz1i7i1ghRguZphzbbJv3LxE6aBDj6S7j2rTI7kpl132n8Hi2EHuWM1V wY/NDTm52QQaWVn5+vlK9wARNyOu8WVTGe/mvZnAdY1nMeDC/dOSidMugol7FzcdzPvT K/O1yhXJjhlRW/IRDchj5RObRAPCASznc/QnA6LDCNIj/Df4zhIRev/JRNzsahxBVuKT 30Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=mCYuzjXjAhAdmGCTChMacQlApx18wWBt60iN6MyaJRQ=; b=zSmgIscJfyrMY+xtKXNA4S3TX/u7gLGEuXlS7UscnYUVUUANVoDIbsCYH4JxzUoAlb Sz9rvITZz5Bu3818zCaiOh9u9fUy7LIpIu7JVpjUczgGma1UsLJVQ9wen7MhQc9dyZS9 3NX4mK5rYiYBs//pjlLUizg5Er0gp6NoVa1t1Xud0jm233zcL0g4mDEl1n1yJ8swQnPE wE7XQYzh9SCe/pSWgipbnwTTo821e0KfnBZxEvladvXR2b2jyUF17IKyWxtBKq11ubJ/ jMQZCxLl3FASrdfms0nmypKuMy0TV69pe30Df3gD82ei7DnBZyRRNF24aiqNkJVru9Zz tvUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hzvfasmh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si9357285pgq.133.2019.03.18.12.42.21; Mon, 18 Mar 2019 12:42:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hzvfasmh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727835AbfCRTlS (ORCPT + 99 others); Mon, 18 Mar 2019 15:41:18 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55158 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727749AbfCRTlB (ORCPT ); Mon, 18 Mar 2019 15:41:01 -0400 Received: by mail-wm1-f67.google.com with SMTP id f3so14430757wmj.4 for ; Mon, 18 Mar 2019 12:40:59 -0700 (PDT) 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-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=OuQoyV4TYnDHnpk2N54lqQXDSgrTRXQrgh5fUvx7G29kGSV+8kmztMZWwQO6GhFt0Q kbErwcYHwhJR2OZ8WbUFteB2Pyjg/GpKHdZ/gDrkpNS6phV9rBl7fAn9+5+jdPb9JwjV CE90QPZGOSQhztaavY8SzVyoIgOBQBILxsRz31GvjlWyUzJJhABKi4ZxlVAk4OEsJDR3 9Y9KomuCxNeHtOHDPxs/GA1EQm0V6ir1gcl3Fhnd8agHHYNQVWgmrMu51nozddQ2b5DB NEUv+yKozP04DYcpm40UZ538MWRFqxCNJyIM9VU808hYe59XfhhMJaTwgfT/1zgcbewJ I7Cg== X-Gm-Message-State: APjAAAVeob9lXhmLdPJvNERBI38z2nf8SuWbuJhdhZMcXqfZiOUzUx2o tPOLdoHR5xfSaQ0zShos7BTdGg== 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 Cc: john.stultz@linaro.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, yuq825@gmail.com 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.7.4