Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp880386rwb; Wed, 26 Jul 2023 04:34:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlFCXfymT3J1rcyhO2e+P/bzfA7miG3c3LLYTTGE5EZavGYVicp6OIC2e1C6T8owVgy6dS8e X-Received: by 2002:a05:6a21:3d8b:b0:135:2b01:3739 with SMTP id bj11-20020a056a213d8b00b001352b013739mr1523474pzc.56.1690371245966; Wed, 26 Jul 2023 04:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690371245; cv=none; d=google.com; s=arc-20160816; b=A55dKGESKV6p1jUB9k/DR6kpkp99dHjihAsu4P/PbPWWepiHXEiaALei3giH394VZ1 xrG6cxR3RlGqjBXd5CddWtrSpxzg7BCIGc1r9jvC3vubGKCoM94F1FOFiqUpOcyU+7x1 mWUG6Y/T5XWoyP/mEy7o0aK0H31wUEyXYUEnCRlMzXVQdO9K3Cmw4Ecej5Np8JlwBjc0 E2t4/OFCOf5HNykEeux98S5trUlQKCIguHtQgLm95A5BNc3VNv/n+9jjv25ZQR3bdUjl QbhFs+JiaoaWVEcNi4peryZb7bX9eSt0sj/sQIuXUkpKjFPemm6pW931W/+dIp+wCkpa q3Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZYvZRTaa9HmNCnS39xZ6WqO7oa0qg3Khkbi5chaJiTY=; fh=lHtUygPuyDqDXmLQa3x6TuiEioC8bNshDFp//Fz2cIM=; b=QVleTipzOsKnmy0Stp1lVawqjikyjGpzUlTai+Li+9kkoFsx4VlCY2X5Jgmh3F+OGv C8EuYxT7QrC2gztQUCcp/3v2R5JHx0jUT0nsy3s75OSeVxRFyhuZsuS2TwL7YiHtguUb K3rQbEW2fNVm5f3YNBBy2ZYwF7uJgsbLPbLwV87fB+wfr4G55TH8bkVFykwkN/ct/DJ1 yC2UDG6jNmNGBAEL8qF79nuWEdgpw+o94t93u22ujOeMKCxvyBwWiRbliW48gwGl5ic1 sheT6JgOZdnj2dEdf2GbEeuKx/fCmVcN+9Y/WG9voedwvp/atjn7XMze8u9JiZiR0635 x+RA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amlogic.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb15-20020a056a004c8f00b00680098cc5f8si12500259pfb.84.2023.07.26.04.33.52; Wed, 26 Jul 2023 04:34:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amlogic.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232720AbjGZLWf (ORCPT + 99 others); Wed, 26 Jul 2023 07:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbjGZLWe (ORCPT ); Wed, 26 Jul 2023 07:22:34 -0400 Received: from mail-sh.amlogic.com (mail-sh.amlogic.com [58.32.228.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91C2D116; Wed, 26 Jul 2023 04:22:32 -0700 (PDT) Received: from rd02-sz.amlogic.software (10.28.11.83) by mail-sh.amlogic.com (10.18.11.5) with Microsoft SMTP Server id 15.1.2507.13; Wed, 26 Jul 2023 19:22:08 +0800 From: Huqiang Qin To: , , , , , , , , CC: , , , , , Huqiang Qin Subject: [PATCH 2/4] watchdog: Add a new struct for Amlogic-GXBB driver Date: Wed, 26 Jul 2023 19:21:44 +0800 Message-ID: <20230726112146.1127145-3-huqiang.qin@amlogic.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230726112146.1127145-1-huqiang.qin@amlogic.com> References: <20230726112146.1127145-1-huqiang.qin@amlogic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.28.11.83] X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new structure wdt_params to describe the watchdog difference of different chips. Signed-off-by: Huqiang Qin --- drivers/watchdog/meson_gxbb_wdt.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c index 35d80cb39856..a6c0d743b607 100644 --- a/drivers/watchdog/meson_gxbb_wdt.c +++ b/drivers/watchdog/meson_gxbb_wdt.c @@ -22,7 +22,6 @@ #define GXBB_WDT_CTRL_CLKDIV_EN BIT(25) #define GXBB_WDT_CTRL_CLK_EN BIT(24) -#define GXBB_WDT_CTRL_EE_RESET BIT(21) #define GXBB_WDT_CTRL_EN BIT(18) #define GXBB_WDT_CTRL_DIV_MASK (BIT(18) - 1) @@ -45,6 +44,10 @@ struct meson_gxbb_wdt { struct clk *clk; }; +struct wdt_params { + u8 rst_shift; +}; + static int meson_gxbb_wdt_start(struct watchdog_device *wdt_dev) { struct meson_gxbb_wdt *data = watchdog_get_drvdata(wdt_dev); @@ -140,8 +143,12 @@ static const struct dev_pm_ops meson_gxbb_wdt_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(meson_gxbb_wdt_suspend, meson_gxbb_wdt_resume) }; +static const struct wdt_params gxbb_params = { + .rst_shift = 21, +}; + static const struct of_device_id meson_gxbb_wdt_dt_ids[] = { - { .compatible = "amlogic,meson-gxbb-wdt", }, + { .compatible = "amlogic,meson-gxbb-wdt", .data = &gxbb_params, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, meson_gxbb_wdt_dt_ids); @@ -150,6 +157,7 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct meson_gxbb_wdt *data; + struct wdt_params *params; u32 ctrl_reg; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); @@ -164,6 +172,8 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev) if (IS_ERR(data->clk)) return PTR_ERR(data->clk); + params = (struct wdt_params *)of_device_get_match_data(dev); + platform_set_drvdata(pdev, data); data->wdt_dev.parent = dev; @@ -191,7 +201,7 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev) /* Setup with 1ms timebase */ ctrl_reg |= ((clk_get_rate(data->clk) / 1000) & GXBB_WDT_CTRL_DIV_MASK) | - GXBB_WDT_CTRL_EE_RESET | + BIT(params->rst_shift) | GXBB_WDT_CTRL_CLK_EN | GXBB_WDT_CTRL_CLKDIV_EN; -- 2.37.1