Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2730748yba; Mon, 8 Apr 2019 03:32:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwihefZgWMMJC4p1GxRFyN9htvA9p8xm22k1hjt9SzndAklX/n1+8lcbZ/uHqK/aABqzZ9T X-Received: by 2002:a17:902:681:: with SMTP id 1mr29941420plh.31.1554719554179; Mon, 08 Apr 2019 03:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554719554; cv=none; d=google.com; s=arc-20160816; b=gbuFpFQH5/vWd7PzbgmsybzAusD1Q6A+MuBhrfX+xt47ZTkdXg3Iao+3BeXD0eYaLF Mn6IE8yJlFM3pqV7Sgvfa96vcae0xAJDu8xrXE8kqEmeutciGe1m+u+kUN8NHVaDHYka 7eTdnelaxStvENvMZktyupqeKIuOXcPE/9vsWHHaF5YVFzjYeloECdbiywXC1zMNGbsv 8CGMePsyqOWXXp3DRrHgGZrxuAUTapIH1F68HaFEzaNg/keMJNk6U1jqrP5EKr2UCQVD uH16fzoGjDy7Wf4xJs41ayXVvCIW3c9RaA7YtT6QstPB7iqjn9rEi86fbxkCXIlqMQ4q UzUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=z5P7NKR/AvOXc1Es6oHsO1vXwfxbWhtteeahZDEAFRA=; b=mS+J8n8T8Ln2V/ZyxiKLDBRBejh/z03yODEJCbZM+8Ktx8h0sUBuGQwQ0Bd84ApMHV BXrojmA3dZUGdXmVyK1Hk/uZVHliSqTysgSdVGNQWhnMftuzG5VRoLAh5dGjmKQptRD6 hO0FCdBB5Uw84/0DzPdEvmfi3Bw55Er8MSp8tvdPEpMeEZ1uEmdKysWte1b/c6iq+ZDO /CcJTRUthwkdP4eyXzpzdkoHCu83oq76IieK2QJXQeJzj62lYWOU+DC88tAYMOorbL9p Rgw1F+54mutzQTNPSjyTBf2MU6hHZdVKBwipuML0s3YE0CmR2ChH7CTt6ZQgOrPCCYT8 YP/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=OQTNbI0u; 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=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q61si27290120plb.308.2019.04.08.03.32.18; Mon, 08 Apr 2019 03:32:34 -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=@synopsys.com header.s=mail header.b=OQTNbI0u; 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=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726446AbfDHKbe (ORCPT + 99 others); Mon, 8 Apr 2019 06:31:34 -0400 Received: from smtprelay.synopsys.com ([198.182.60.111]:60192 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbfDHKbe (ORCPT ); Mon, 8 Apr 2019 06:31:34 -0400 Received: from mailhost1.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 20DE710C1F65; Mon, 8 Apr 2019 03:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1554719494; bh=aPSheZBy6ZUWyLsIaODpHxJgiQ1iymoqrTPB5BCAU+M=; h=From:To:Cc:Subject:Date:From; b=OQTNbI0u4Sg6zS4GmfWL2RT3ikqbSdXL0n/EYX+jLfRPHX0bOdc5NUqQCuLPp75T1 vXtWcRQ1gx0SKDOMEVG7+RyPxijf7ZZ0zxo8DZX4jUHrIy49RVHYzIzOsH2012gdtv NCezm3joRMs1QvbHuuB84WMXn+jPCrUXEqWbraejRuW2ZvEH3CzYRVBSJZ4NU6rtGR IkMAC6cDZzVSd6mMxPoupC04ck28Uupw4hPnfbY8AKMsmRDpFTnTRBmwrn/aZrfQbs PKUxNPr1H8wb2G5jjhDTY6MYKSbIh5vjLU0l1SFSI1Sp9gFJljfGFQdNIgzfWD+3xl 5hvyG0k5AkT1A== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost1.synopsys.com (Postfix) with ESMTP id 606A056F5; Mon, 8 Apr 2019 03:31:30 -0700 (PDT) From: Vitor Soares To: linux-kernel@vger.kernel.org Cc: Vitor Soares , Eugeniy Paltsev , Alexey Brodkin , Joao Pinto , Jose Abreu , Luis Oliveira , Gustavo Pimentel , Nelson Costa , Pedro Sousa , Philipp Zabel Subject: [PATCH] reset: axs10x: Implement assert and deassert callbacks Date: Mon, 8 Apr 2019 12:31:23 +0200 Message-Id: <33ed7b90da8439aecb3544c3ff7dcfb511e03b8e.1554457026.git.vitor.soares@synopsys.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some custom IP-block connected to ARC AXS10x board need assert and deassert functions to control reset signal of selected peripherals. This patch improve AXS10x reset driver by adding assert and deassert callbacks. Signed-off-by: Vitor Soares Cc: Eugeniy Paltsev Cc: Alexey Brodkin Cc: Joao Pinto Cc: Jose Abreu Cc: Luis Oliveira Cc: Gustavo Pimentel Cc: Nelson Costa Cc: Pedro Sousa Cc: Philipp Zabel --- drivers/reset/reset-axs10x.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/reset/reset-axs10x.c b/drivers/reset/reset-axs10x.c index a854ef41..12dac8b 100644 --- a/drivers/reset/reset-axs10x.c +++ b/drivers/reset/reset-axs10x.c @@ -37,8 +37,36 @@ static int axs10x_reset_reset(struct reset_controller_dev *rcdev, return 0; } +static int axs10x_reset_assert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct axs10x_rst *rst = to_axs10x_rst(rcdev); + unsigned long flags; + + spin_lock_irqsave(&rst->lock, flags); + writel(readl(rst->regs_rst) & ~BIT(id), rst->regs_rst); + spin_unlock_irqrestore(&rst->lock, flags); + + return 0; +} + +static int axs10x_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct axs10x_rst *rst = to_axs10x_rst(rcdev); + unsigned long flags; + + spin_lock_irqsave(&rst->lock, flags); + writel(readl(rst->regs_rst) | BIT(id), rst->regs_rst); + spin_unlock_irqrestore(&rst->lock, flags); + + return 0; +} + static const struct reset_control_ops axs10x_reset_ops = { - .reset = axs10x_reset_reset, + .reset = axs10x_reset_reset, + .assert = axs10x_reset_assert, + .deassert = axs10x_reset_deassert, }; static int axs10x_reset_probe(struct platform_device *pdev) -- 2.7.4