From patchwork Tue Jun 29 02:32:14 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: 468280 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4507357jao; Mon, 28 Jun 2021 19:03:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFqTOHaNzOQxAqQy7NNQxIPhMkPrDk/DOGo/SyOzQzZTYyHw+vMWFk1bZ9AuZnK813VQCD X-Received: by 2002:a17:906:896:: with SMTP id n22mr27795698eje.117.1624932217124; Mon, 28 Jun 2021 19:03:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1624932217; cv=pass; d=google.com; s=arc-20160816; b=w+D6oXAD/65/G3DpqX6XnzmTsi0nsAiMg8vXFoUbBrUC02bpGlDAAdUPX/0KTp7ybv KYlMruRbsUierilJT/+5kquMv9YalhYCEIGbCOGt92cMbCCYHl00we3uTSfC5Izp3Uwg UGVVIN/D9SrXD++8UvdYB9xdHGEjK1cvI7Hr7rQWfZPMa28F3PS/3ulDm3Z0PwJPedfo p7pdOQ4amSIomSraUZzCIsBIyliOK11IsTIjVMt7AWSH6iX6XVFfshRlukSpykNEzDHN COKYHvr9OlCUWjoibhc+pLTtqFZALjf9iQ/uFKHx9Nzmg/Y7ReK3z7zS1BfllVu7iGD8 1w9Q== 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=NC7KSLsyGyYSzR5oA0mo45C4ltY8Xa2Vwt3XcBd3GCwOm1vKmmvBJM5d8M9oAo4UgM Gh8wrthXVhgPGjJNM242eFW4iYiVpJlLnahX1zokuC6GcDr0+iNXNp3oOtJGjKErv5hv dJgD6lgdWMeFvbT3OQG6l90RWm9l588m+kbJZAedjGR+vAriggiXkMy1HCNim1XfaL+t OZ25CE9Kndwt7iUMYRDpSOensLqsh/U784a2xcGjJsXKAK2IyRSSGAWvIDnkoYsnYQGm /r2Cr0OT3Q8z0nGPaSL1H4atNLoU/D+8Ix3RIFZn7PGnC1B2Siqmg2j+Q9I+Rfr9kpnM ZCMA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=iKTPpQLP; 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 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id hz14si15157585ejc.533.2021.06.28.19.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jun 2021 19:03:37 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=iKTPpQLP; 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 85.214.62.61 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 448CD83128; Tue, 29 Jun 2021 04:00:47 +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="iKTPpQLP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E23C882F13; Tue, 29 Jun 2021 04:00:17 +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 EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on061b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::61b]) (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 0E08982F4D for ; Tue, 29 Jun 2021 04:00:03 +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=U4DDvandhYSF3NyttPEz48qahLQOeYcT518w+lP15SpO1gegBfxkek8hI0rSxKqvAsJx4d3wBlfDWBFM/ELE9tGatGSoIjCN9zum/GK8/EqynB8jg5r/VlMfniOPvtSU5g5Yge8CvGeGBAwHJFZ9EzHp0EZbZt/lK1SHj9cFsLzvxn67TEkXC7NxGwTovYy3hqbaqKnf8A4M+1eQAb5OaV7wsnvivAX7nOuNBJ/pwWJ5vdYgxpBzu5AZb5bEnOE/bY+c9mLRlwEi0Gbt4zUbr4YwAhJwWGtZFIkG0j1O+L7rrPHrAFYzxHBy0HNss9NG7WBKXxJ8ZmgZgJAw2dFYAA== 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=CSJaizkEEVqKOt81jz5qT7UDyvFL4KgmFSUrzjLJsRcfmS2ZBARavdTUO63emtWP1m6FTJpZIDqKKOPoQluFJJQP5PZ1OxZlOUW2Iz+tZvy/LEjW1l1YSqs2UPEP4u3XbipN1QDLCduhZKsxtotN6frXtFWbloHpWK+lxUQbjHEX+tnoGOZ9+t+2iVXxb8LnzxjjA7O6Dl6B4dLw7qX63rv1D5Qmv8KgcZWtn1wkfLMSQhH8xO/Gina9R8dX5p1d6J08Yy2OiL1o+TCBNKPHeCDQC23oZtKE4C0AHaqzT9rYtpx1BVlIvl8VQJFJbzAAtQ0QLGzaXQUmYu3ahkyMZw== 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=iKTPpQLP2lf2nFBz/6iE5cb1d7OTeKH6Pn5sTZ5Lx5PcQkywv8TAsw3hfVkENCE/sDpVtla+ioDmckldS+RgciHWfekOctoxS/7UbdfJ25pua0nim0pSVx7gTXj58zm9R1+hTS3AlzXTsJCKi3EK/lxGIQ7JY2a+jrc2m9oKjyg= 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 DB6PR04MB3126.eurprd04.prod.outlook.com (2603:10a6:6:7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.23; Tue, 29 Jun 2021 02:00:01 +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.4264.026; Tue, 29 Jun 2021 02:00:01 +0000 From: "Peng Fan (OSS)" To: sbabic@denx.de, festevam@gmail.com Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Peng Fan Subject: [PATCH V2 20/46] arm: imx8ulp: disable wdog3 Date: Tue, 29 Jun 2021 10:32:14 +0800 Message-Id: <20210629023240.22394-21-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210629023240.22394-1-peng.fan@oss.nxp.com> References: <20210629023240.22394-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR06CA0088.apcprd06.prod.outlook.com (2603:1096:3:14::14) 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 SG2PR06CA0088.apcprd06.prod.outlook.com (2603:1096:3:14::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19 via Frontend Transport; Tue, 29 Jun 2021 01:59:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3ef4a7d-75f5-4218-32f1-08d93aa19af0 X-MS-TrafficTypeDiagnostic: DB6PR04MB3126: 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-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6PG79lD1rdbf+amgKVftDXoiKOhoqRXh0pDum1qVgPcVlOiORf+O11I7VDoFUMQnJBoW1Gh7VpJrTCedTi4S5zHT6PP2EJXyF54IiIB7P685jT3OnBRn03av010+tps8DTAmMizoVvoz9kz3bETvZAQTXuu/yD08aMYSMM6mTHnGSmVK1aqrzoJsdN9P9f90krH1LNPDK4Qt69f9THmwFyzMqO44eedt0kGJOUjh3rzf7NRb5gqvBSB9dLWd6lecw0kUjnxjQoIcUj5ppPW5Mm7o7OjIzVkd8cNfSWtYGoklhmv8FZM5p0NXAUij0qrzzl1NTAtr9NQ1elCYzzjzy1EoeiwYm1pzwIDadIvhhkedBVqt396I1cFSwVneGa3919O724ulSm6qgCTq3zKtfOPfRY5l+GjtQ7nGWkRdbCCuL2KUSOwMbnDGdeSB4nOke3ASPLr4B5ZVvXBu1EyM4shX9OUzTolmZcvVb+bNd9Gmyi6H10xhFYuewbxLMHSFIquiZe22PLDvfm0QHL4MTDFlGOFZHztoKJ1j3Qtwuu9daRRUPxZwsHGKKose14BdzsIhP0jTygKrURwJTttwmAAnq1nug2D2ZnVBZ2KGViHsKgTm3ubjsoJimPFdD4iMHiBdqYYsFXperKhV1vd/RGrWzizO8HkVbkKB6MjxC8YZ8Akm/pPh/BWo7FTa07xqS1EekjJfBDe1V/4j50FOhEfn0AS5cu53e+tVrawlCvM= 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)(39860400002)(346002)(366004)(376002)(396003)(136003)(66946007)(316002)(38100700002)(66476007)(52116002)(38350700002)(186003)(4326008)(956004)(6512007)(6486002)(2906002)(26005)(16526019)(66556008)(8936002)(86362001)(478600001)(5660300002)(6506007)(8676002)(6666004)(83380400001)(1076003)(2616005)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yKHeoPvTXaPD5NvTJH7n6Xr0h4zs51BQdz/emVQqpGaKJ/+//CbPd6q4JT4rjVhep1J9lUoe0cfG7NYS2aYQ3emvRjMYYKTz2A/ArX+K/1aWzrhe5RW4Awc4+Z1EJbVJhjVZTEdgzyKxbLV2VvTvJ78bvc/fcqBdgE7vK4wmRvEzym8PfJGXlKPv1jwSfNTFGktfgcFPs9Yn/v6TMEjvutRhT3IOMlWpdYR/09OJ8mQLRYW32/ZTEcDjNqNZbwQ+WHZaAti5X8BWy3P3/sDdVPxBEvzoF3Nel7QACgHl7FbGJfn0wU5ba6hoNLFGs90hNNhO1rOS/6C9KMwwsDTIEl6Cm2+bJrFK/sMIaRdu25ml89rE93lbPVfgBDyO7Dtqk2u94xUj1mxSrZGNjaIi9/m3WVDwpb+kt93eDkshdGUY+PzIE9aMvLflHWpoXI9gwzZrKmGHiQBD/R4PR2Kgwinyy2z913WLopMh7ECj3PB4LsYtE+4E5zDYPUmhklbdRg3SFp9lfzhCd5BFh86UZ/QiNuRR8utoL6CuQmmNQy5lZlbmNtgxnnP5rUowrzBChjbTgkRUtQi6w3p6K0Ff90i1ZHwFQodLSTf0ZvQElc7WLkfN+ydGSMwQGzhCozZjnkG/vI10Ni1bWWDMUgwignsCPEGwXezTAiR71WStgW0fSIMuIXm0Sm317VvnGQ+XDv1uMaNu9plIF0kUmQYRDJLxBl2ZaVNvtlaf5K9hG9lUCZkSfO+fprPduFptMyY0DqIuaNtciHskem+xPRQhCwwYixlwkdoRxU0lbtZECHsA1hD4xC+aga1+PE9E2AFLQX9oALAZWc7/bSGAXwC/j2H3ITCRVgQ/sumjxtSUow0ua8MCCIeDScSBMqCQFHJocTTY2wRjEknpneku3pzTwXhGP4qVhdu7WOwqYpEWNhDSx8+f6BxSVjPr5mivibRgS/StsXSI5wVUjnsgnfntvPrQH3sfmQJo3EWiWauDHxPg3mHD/rRqkTjy1xBYETpzqYd8HDMAm0Z99AW1ynNiSDUWWcB+WhilLfTWcYtf6sUHM7iK/tqn3UvQRXrxVTKNjn32+U7/CWuAi6TxOdUueFoKXmmAI2wIbC7+pWJTm3X5fAXc1fg8SIA7ooypaXx+Qhfsa0e33nlqHCf3zxIITh9re2nhuxD8YSrTFbTCJVF1Gn6QPlugWUoTqsq3hz0sYzmHaLCDiTu872/b9oq0kyoN+K6eW7cqcJ6o4EZRaxWaPq5VPzEG4CXwklnts60OOPc3+diFDcqB+NgaT9/TaNa1rNa9+xQ+Op262tHf50IcHrV4BfCloO2LKcz/Vyxx X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3ef4a7d-75f5-4218-32f1-08d93aa19af0 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2021 02:00:01.4983 (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: bTL6gqyJ+7VX0AkriIFbSdcoQX+FmGxPYdN0cytqVEGct2aCWQaES3NF9llv9oTRg2oSSCs7RkLL22CdrBKwZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3126 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[] = {