Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp992364ybt; Fri, 19 Jun 2020 20:52:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPFBYN7Ki8XpQ7HrbCBnmuATiFB7h6VcKkHeaTiwHbVLPKibqboDFk28X6AsNrAa6kW7o4 X-Received: by 2002:a50:e791:: with SMTP id b17mr6756201edn.366.1592625126466; Fri, 19 Jun 2020 20:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592625126; cv=none; d=google.com; s=arc-20160816; b=wPyZkcDJmvNnh8ef76KPgIaguLHMuYLHuwVH/4ibmvBUM/u9mr0sdM52GCbTUEMvXr 6GkJSOspYo3BAh6mso4vVKJ9jte1z+nwuULuTWfBRAkTmeCYLh2QaVCMc48iXTLpURhj dKd3HwBMqPhcJ53kScZHJYvStybOgUzAr557RC1/inIyl+acCAf2xNDzSUaO87b7Udrf 042V3NYl3C+aToSe+PflAwanu87HjYS2LZj1U3YO26p44EjWpkS6skq0TOuxj92qsm4X EBOr3jsZV/B4i39r2hatrbO2Jna2Lp8JF9RDNeP/a8spkpcWIWpGTrBz7DhAh7kn2jJC 993Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WJ0fZwkYLlp/UvZFgE0O5B/MFSgt5Yfu87IaIneBStg=; b=E9CyUmWHCS9RNDcdKztxYK87I2gI62Pv/MarDWalhpNKf7l+1eva00vBWALOQAJNp4 aETpagUD/yMtltHj/toug/h3zF0YNyg5m14kfMoAjRIUmY3zSF8BdG+sqA0Ux6wwL9Vy bIfhKlQDlSn7QhjhMBp8J1YFZGi05/GqVosV+vtViUmFWDvEjiIHSQFYozTOMR+mFwNO 4Z2yp+kP3X3gNI+G6Qbif+reUtk6PtP92hHHs3TGPrLSu1gH8+tmamE1kU4LWCVx/lzT F5t2HMlgzR6vXHoUPv/vehiCEoJLrqiSUnWX2tT7YhL30dtfkZtV91og4InM9y05w7V3 Hj+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=znFphclS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id vr3si4865717ejb.520.2020.06.19.20.51.44; Fri, 19 Jun 2020 20:52:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=znFphclS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405588AbgFSQPY (ORCPT + 99 others); Fri, 19 Jun 2020 12:15:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:60362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391027AbgFSPDf (ORCPT ); Fri, 19 Jun 2020 11:03:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B4EFA206DB; Fri, 19 Jun 2020 15:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592579015; bh=ujyQJqUvgdZO7Pb1fTZntoKYQuPFQt9RaNQCCADeNPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=znFphclSTC/RnsigomHrMzKCZAGYcG9FGJcfuba+CSqh4UwHxxjGZBhggYpLeSXAs Os46JRKzggCuk2Vmh4lsgOekdQzd01O8vFGqmmQPkxRSx7NLr8igAimzRotbLFQzdn t3PGEnxOoQB6YO0Ykjt9BFFksIMUhqyf/hbHVOx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Bakker , Krzysztof Kozlowski Subject: [PATCH 4.19 243/267] pinctrl: samsung: Correct setting of eint wakeup mask on s5pv210 Date: Fri, 19 Jun 2020 16:33:48 +0200 Message-Id: <20200619141700.350958958@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Bakker commit b577a279914085c6b657c33e9f39ef56d96a3302 upstream. Commit a8be2af0218c ("pinctrl: samsung: Write external wakeup interrupt mask") started writing the eint wakeup mask from the pinctrl driver. Unfortunately, it made the assumption that the private retention data was always a regmap while in the case of s5pv210 it is a raw pointer to the clock base (as the eint wakeup mask not in the PMU as with newer Exynos platforms). Fixes: a8be2af0218c ("pinctrl: samsung: Write external wakeup interrupt mask") Cc: Signed-off-by: Jonathan Bakker Signed-off-by: Krzysztof Kozlowski Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/samsung/pinctrl-exynos.c | 73 ++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 24 deletions(-) --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -40,6 +40,8 @@ struct exynos_irq_chip { u32 eint_pend; u32 eint_wake_mask_value; u32 eint_wake_mask_reg; + void (*set_eint_wakeup_mask)(struct samsung_pinctrl_drv_data *drvdata, + struct exynos_irq_chip *irq_chip); }; static inline struct exynos_irq_chip *to_exynos_irq_chip(struct irq_chip *chip) @@ -350,6 +352,47 @@ static int exynos_wkup_irq_set_wake(stru return 0; } +static void +exynos_pinctrl_set_eint_wakeup_mask(struct samsung_pinctrl_drv_data *drvdata, + struct exynos_irq_chip *irq_chip) +{ + struct regmap *pmu_regs; + + if (!drvdata->retention_ctrl || !drvdata->retention_ctrl->priv) { + dev_warn(drvdata->dev, + "No retention data configured bank with external wakeup interrupt. Wake-up mask will not be set.\n"); + return; + } + + pmu_regs = drvdata->retention_ctrl->priv; + dev_info(drvdata->dev, + "Setting external wakeup interrupt mask: 0x%x\n", + irq_chip->eint_wake_mask_value); + + regmap_write(pmu_regs, irq_chip->eint_wake_mask_reg, + irq_chip->eint_wake_mask_value); +} + +static void +s5pv210_pinctrl_set_eint_wakeup_mask(struct samsung_pinctrl_drv_data *drvdata, + struct exynos_irq_chip *irq_chip) + +{ + void __iomem *clk_base; + + if (!drvdata->retention_ctrl || !drvdata->retention_ctrl->priv) { + dev_warn(drvdata->dev, + "No retention data configured bank with external wakeup interrupt. Wake-up mask will not be set.\n"); + return; + } + + + clk_base = (void __iomem *) drvdata->retention_ctrl->priv; + + __raw_writel(irq_chip->eint_wake_mask_value, + clk_base + irq_chip->eint_wake_mask_reg); +} + /* * irq_chip for wakeup interrupts */ @@ -368,8 +411,9 @@ static const struct exynos_irq_chip s5pv .eint_mask = EXYNOS_WKUP_EMASK_OFFSET, .eint_pend = EXYNOS_WKUP_EPEND_OFFSET, .eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED, - /* Only difference with exynos4210_wkup_irq_chip: */ + /* Only differences with exynos4210_wkup_irq_chip: */ .eint_wake_mask_reg = S5PV210_EINT_WAKEUP_MASK, + .set_eint_wakeup_mask = s5pv210_pinctrl_set_eint_wakeup_mask, }; static const struct exynos_irq_chip exynos4210_wkup_irq_chip __initconst = { @@ -388,6 +432,7 @@ static const struct exynos_irq_chip exyn .eint_pend = EXYNOS_WKUP_EPEND_OFFSET, .eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED, .eint_wake_mask_reg = EXYNOS_EINT_WAKEUP_MASK, + .set_eint_wakeup_mask = exynos_pinctrl_set_eint_wakeup_mask, }; static const struct exynos_irq_chip exynos7_wkup_irq_chip __initconst = { @@ -406,6 +451,7 @@ static const struct exynos_irq_chip exyn .eint_pend = EXYNOS7_WKUP_EPEND_OFFSET, .eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED, .eint_wake_mask_reg = EXYNOS5433_EINT_WAKEUP_MASK, + .set_eint_wakeup_mask = exynos_pinctrl_set_eint_wakeup_mask, }; /* list of external wakeup controllers supported */ @@ -582,27 +628,6 @@ int exynos_eint_wkup_init(struct samsung return 0; } -static void -exynos_pinctrl_set_eint_wakeup_mask(struct samsung_pinctrl_drv_data *drvdata, - struct exynos_irq_chip *irq_chip) -{ - struct regmap *pmu_regs; - - if (!drvdata->retention_ctrl || !drvdata->retention_ctrl->priv) { - dev_warn(drvdata->dev, - "No retention data configured bank with external wakeup interrupt. Wake-up mask will not be set.\n"); - return; - } - - pmu_regs = drvdata->retention_ctrl->priv; - dev_info(drvdata->dev, - "Setting external wakeup interrupt mask: 0x%x\n", - irq_chip->eint_wake_mask_value); - - regmap_write(pmu_regs, irq_chip->eint_wake_mask_reg, - irq_chip->eint_wake_mask_value); -} - static void exynos_pinctrl_suspend_bank( struct samsung_pinctrl_drv_data *drvdata, struct samsung_pin_bank *bank) @@ -634,8 +659,8 @@ void exynos_pinctrl_suspend(struct samsu else if (bank->eint_type == EINT_TYPE_WKUP) { if (!irq_chip) { irq_chip = bank->irq_chip; - exynos_pinctrl_set_eint_wakeup_mask(drvdata, - irq_chip); + irq_chip->set_eint_wakeup_mask(drvdata, + irq_chip); } else if (bank->irq_chip != irq_chip) { dev_warn(drvdata->dev, "More than one external wakeup interrupt chip configured (bank: %s). This is not supported by hardware nor by driver.\n",