From patchwork Sat Aug 7 08:00:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 493378 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp1029858jap; Sat, 7 Aug 2021 00:31:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzIbsX9ytbLSvsfjmjlejHYeAmuem19G8vXwurINP+zrSH1IPsMZdBMNPNDWLKgaNq4yzO X-Received: by 2002:a17:906:5290:: with SMTP id c16mr13410188ejm.163.1628321478027; Sat, 07 Aug 2021 00:31:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1628321478; cv=pass; d=google.com; s=arc-20160816; b=qPZvuB77sWWkGeEnAstzOskIXDCqSoQYZO9Mq1zxJpBIJ5ESJip69trLG9nnomINGX 4R3gATcW0AsA7/PrUeNec9WeDDM1ofYaUylSY8kQHasAT7x8G/4nkJsGyYK8YkIVsq5H +sakOMO4a6Wwf92+k9xHIS1j3lCY1Xlu6E1idIvyO0gIDne1wrhUXokTtUTJ0P0Ig5Vd hsbj1EqIOagsgBNlUm2Ok6STwT+sC4GErs6iUs3SofBKIQBwd2YD/QrXmfdn/QxRbBQY 3jd64EN1Q3UI6wLgbNscIbDtkj7aX2ZlBV/C7TrYRfX6LVAsiU2yKQCdIvGX8Fz7r6kl BlEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=cNnsAIW7am4/EyhfDfCEZegNaceeUtF2nfS6EfZVEmo=; b=C8KXZ/rYPqjdrNsopeT1TqV70WndQysnwhv+rllWpijdjMwMjxs4TGfXLn8a4ly6yo qCGasztlaeDS/0wWOIZ194RYcIVdsZLNLRBtFmaR2pICZLRh8PGKuppf0Vxx769PYv2v e6+C45ER7ItSjjxh3GWXcmb/GaR85pOPvhO2Bld1ouM1hCrr11xaddC7hqkKneV1JoFV ZdrfKRs4k6svacplrGAxo+xSUXXVBk+FsVQirGimzFiVTrLnoXKDKhUONpQ0NJMA1gpt EzUd2Ekh14kEF8loy/kIqdNxrd9GDnerkOBWmvm7GbnbEgx0FpMDQ2VcqcxiqFmV6Sxi QdAg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=dt9id2bK; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id di2si10463736edb.387.2021.08.07.00.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Aug 2021 00:31:18 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=dt9id2bK; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A322831FE; Sat, 7 Aug 2021 09:28:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=oss.nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="dt9id2bK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3C59883251; Sat, 7 Aug 2021 09:27:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0629.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::629]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8AE6283244 for ; Sat, 7 Aug 2021 09:27:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=oss.nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=peng.fan@oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HQEZHOILvxeWmd0t7zPV38aIICQ/7SQL2mgCQCZWnb9+RyluHOT2NWAlOe11R+o4CEhM/STQg6Jjq/9Ftm4kchljQ6LIIfg3JXqPtZ+NSPKOEYn6UtGZlgQTlDbKX3Y3TQgwAyeEluTVjk3HKMb6dLgEzSkrZZFxD7T9WdPtpP4usntvN6g9h9/ZegUTHsuuCQd6wc0U19ZFeYfUXOJUGBMoHtwEvhHX2tDUCEURDgOMPijG0pv8ltrCWGAvSwLSszw57ur1oAa4mOl4N1EMwrHAC/F2mKOzmU3v/bncDA9tSEMi9rYg5H+lPbppGi3w39JRbJRZC88clLpmDrt9yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cNnsAIW7am4/EyhfDfCEZegNaceeUtF2nfS6EfZVEmo=; b=KoOw/NeygKE9n2R3ohu0mP2uxv8zcIrJfzWLcr9X5/GR3wDCr3nXC+Ib6Fselm04414FMPX6KlIgvHS/bJ6AXWN09d+KNE9TNdVAF+eAy2DNQ0fQk7PA/EdF+U+rf+PUpwXXl9u/7Y/Dv14LXPZQkGbfch0jF6yMMYbpb0UY4aG1OxfuHYrThuU88ZKY8JPpT8b55qlMtwtTZrXXt9xNNO2Vi9z0BsGCjpBPgW/X8TCrKmGi1sI7L8iNwYlDuE2HjbFLZrBf3jgEgl0eGBBhME5KvRHlgUuRCbHOpZ0dxVY8quSZkVXwnspRj4jZhvthfh8IQskjCuu1JLy5TysA1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cNnsAIW7am4/EyhfDfCEZegNaceeUtF2nfS6EfZVEmo=; b=dt9id2bKjf6Z70WCF6p2hl2FPtvqNEbjCV54XmdbvSjfwzk8CB+BQsTXtAWcOYgSnhWax2O+/mGM1kUosTfut4SR5eJotVxG/VtmggeMOscHfg9oOHMD5SGvQYpqNEjc2TBM02/EPutMS47qfrCw0hZORQP7j9knyGBXWmGIZg8= Authentication-Results: denx.de; dkim=none (message not signed) header.d=none; denx.de; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB6PR0402MB2758.eurprd04.prod.outlook.com (2603:10a6:4:96::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16; Sat, 7 Aug 2021 07:27:32 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c445:d742:eb76:86dd]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c445:d742:eb76:86dd%9]) with mapi id 15.20.4394.019; Sat, 7 Aug 2021 07:27:32 +0000 From: "Peng Fan (OSS)" To: sbabic@denx.de, festevam@gmail.com Cc: u-boot@lists.denx.de, uboot-imx@nxp.com, Peng Fan Subject: [PATCH V5 20/44] arm: imx8ulp: disable wdog3 Date: Sat, 7 Aug 2021 16:00:49 +0800 Message-Id: <20210807080113.16020-21-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210807080113.16020-1-peng.fan@oss.nxp.com> References: <20210807080113.16020-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2PR01CA0133.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::13) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by SG2PR01CA0133.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Sat, 7 Aug 2021 07:27:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7940358-6e83-4733-9fd8-08d95974d213 X-MS-TrafficTypeDiagnostic: DB6PR0402MB2758: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1247; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W/EcYPVBa198nUBgUlUmNlfUYCT8tRtoeT2whRGiFo7Kv3cOZiFav21+unVulYt5EpzuTM50lStzvU93tbMXSqg+vaa4LCEM0Cq74VfVhN/8wPCFTgwVtgR55kL1JAV1bxm5fszyD3dTO2uoYG9Yd5wrkWplF/ECbhzb/njuLRjjDSwsHIdRq6IcdXjX0xpZu6Xa6VmPB7t42zD5hbjmWBlTiGXNPdNiUsS6YOm8qgk1JUpAg3k5xkVbaxkx5Ur20qYULyLVpXk3/YhlDUKRSAqy25gN+KLDFqM20rx2l3pvkigUVbAHGbKkH4AgHNSQpHl8B26ywViRdDmbq4aLNuVFAuDeXlXRUd4jV1p+H8Ft6F5iWMU0mBSIWFzqnfJUrIypuiZkhu9yDZF0VUtiwLwOp868UNz123LLI5HlO1GJ8lv/EGn31p90vwiyfhkJ1HxTvlviU/TaQoZCS26h+coZrOR0nmClS5UOd15BcyO/5gpITkcqr7EvRgVtmZ57gqiNmaPSXFH/3gAr2X6/LJgHLdszgLY4tGU3r9pQDxzKRqtQmjOqICHEfiwZ6L0l+yTHVG06b0Ek9pWd6BLi+FLYoPUd4aaaNJ4Dn0yGEDJMsWcvRbkCogZzimMtcgwQYDAXiUGfvKM4ira/XfVdHHN7cT+YmGLL2TzbOH8xnfhviTbxyi6XeoxmKvoM3iNFtHFbar2HQ5JmsptrvXTk9HIYWZ5Jb4JTx6GplOrHJDo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(136003)(396003)(39860400002)(346002)(376002)(66946007)(66556008)(66476007)(8936002)(52116002)(5660300002)(6506007)(4326008)(6512007)(6666004)(38100700002)(2906002)(38350700002)(2616005)(8676002)(478600001)(956004)(1076003)(83380400001)(186003)(26005)(86362001)(6486002)(316002)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zfxhnfzf3yaFkbYeRBhgzXkH/Zh0fcWWRh+DpEyowNe+f6ONGkQqUkNTDdDfo7Ptjbtwk6Eip9/dtYl7teG1bCo870DXCVoJSfpHsMfZk3l/wyOQMVl/DB3EuBRV7F7gZBXf6EWHBCRMI4KK9RYlI15ALJG9tfFEI5W1whVjWWCi5FX157lhdqJ9KmMeBn67voupknVWNxjg8CaTiUfRyOwxC7paKTyOGaDZNXWz/BGZQvHKnI2ePv9LLT82C/kaNDOngO+OdLJPKQpUILwIiZLv/rC7kdGnV5TfsOvEnjwZuKPKTLjo0HNGvgBwvNN0bbCtalB2yYV6qPjuowrma9R1wv9pOm5DNXxgOcvq4gXiL1nAwMcH8LBmIdj40hiMzCo7PSxwzR5c8qxervzmyA+Te3hVE19Ci1EGjaUlTgS09P1SnOG6v7arY5Ia6gQRpR7mOH2Xoyrmx60RIfT1U20cR+E5neJP7wNf6tUcgZc883bjeMJuTphIBXi1rRc40oeiXCIsLdEdlXtvHSi1R4x57sgkAGECiP0rb6jj5L6IFBqF9F3Ur7PFs09wYJHrN8dyjgwfD/au8OT+N+8FACzR8ahPpFy2o2afZb3q5+mBodB2syIgt40vhWuIbLx4WmxJfTXu9GRiYXvaa3cbCAgY28J1QquWHceV3eN8ma8cosLOq1mfUX3/S0cvxJ7QXbfS/vBM9BA5pYxsahT5125Cv+zbyFApOSzP0UHV118RcUl0ITMFOcOfYQLKkGRoFOMy27JTTFPDPJMJp5j9SnK0EF+gPe4Z09OYMQY/0Rr5An484iKhe3/jjcswn3SNl5mJH2vL1ZY8F3TZI2MwELGQtFzG8PlZZPzVup6uzdkEGJdKk3S9uFeRrbmRKwbKoN/zUbJ1PGXd9X6uaKQMuXhACX5O5lRX35oyLSi4y50w/nW7UB/Gi4nJ+2ujxeNhgpTnxPmpPyufu4RhoXO/a/KFBsw8tWumVrsKEJ59+nAiA7cav5raXOTQ8wDXg7GbGYBa9jkCsOL41ZThYs2eb5tfr4PpZx2B+esIMsye22sfYfIYF01xxZywIYj0Wbosla1KstcKGd7TCnWQwT4080zpnIxsJnXzDJw7uhDNoV04Ayns2h0XIHknTljf0+Od+Im3K0/9xj+k05RTxFdUIKp+VgeS/Lec08ianJl/GaLN4+zMyEnkoHk0CG1ikL172Toy8z8mKOvDNgSlqdBuzrg5yI9+ITp2LJEhupR8RBc9Fi3lM3Vzx3fjFGcutRltKGWc50SLQpmPpJ3b7SPIdYiJrMgmxtA07vuBhewp/w7cdup0WGwwIh/TQDRQozxp X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7940358-6e83-4733-9fd8-08d95974d213 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2021 07:27:32.7094 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mEQ+IAdJidtIoz/rjGItZosjE7XdhcnYlxebeRRaNzgQRkGwpWUpJcIkoocZYR921OB4UM8HwU7PCKQV/Wyztw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2758 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Peng Fan Disable wdog3 which is configured by ROM Signed-off-by: Peng Fan --- arch/arm/mach-imx/imx8ulp/soc.c | 36 ++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) -- 2.30.0 diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c index 33aec228e3..051dec1a5a 100644 --- a/arch/arm/mach-imx/imx8ulp/soc.c +++ b/arch/arm/mach-imx/imx8ulp/soc.c @@ -144,9 +144,43 @@ int print_cpuinfo(void) } #endif +#define UNLOCK_WORD0 0xC520 /* 1st unlock word */ +#define UNLOCK_WORD1 0xD928 /* 2nd unlock word */ +#define REFRESH_WORD0 0xA602 /* 1st refresh word */ +#define REFRESH_WORD1 0xB480 /* 2nd refresh word */ + +static void disable_wdog(void __iomem *wdog_base) +{ + u32 val_cs = readl(wdog_base + 0x00); + + if (!(val_cs & 0x80)) + return; + + dmb(); + __raw_writel(REFRESH_WORD0, (wdog_base + 0x04)); /* Refresh the CNT */ + __raw_writel(REFRESH_WORD1, (wdog_base + 0x04)); + dmb(); + + if (!(val_cs & 800)) { + dmb(); + __raw_writel(UNLOCK_WORD0, (wdog_base + 0x04)); + __raw_writel(UNLOCK_WORD1, (wdog_base + 0x04)); + dmb(); + + while (!(readl(wdog_base + 0x00) & 0x800)) + ; + } + writel(0x0, (wdog_base + 0x0C)); /* Set WIN to 0 */ + writel(0x400, (wdog_base + 0x08)); /* Set timeout to default 0x400 */ + writel(0x120, (wdog_base + 0x00)); /* Disable it and set update */ + + while (!(readl(wdog_base + 0x00) & 0x400)) + ; +} + void init_wdog(void) { - /* TODO */ + disable_wdog((void __iomem *)WDG3_RBASE); } static struct mm_region imx8ulp_arm64_mem_map[] = {