From patchwork Wed Jul 21 14:17:01 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: 483295 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp6211798jao; Wed, 21 Jul 2021 06:47:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhKR6sxr6WeXYdyDsfJgj1THnyhk7/x3NM7Kpg6mG2H1KtaU4fYvzIW1l87tMTYz7an7Tl X-Received: by 2002:aa7:c458:: with SMTP id n24mr49273423edr.30.1626875245856; Wed, 21 Jul 2021 06:47:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626875245; cv=pass; d=google.com; s=arc-20160816; b=nc4eUpXEGSGyeisIBXdDYCBZJ4qxyNKGXRcZwi44qYmmOo56r5K7lLew+h4rbNQu5l xZm53ahsObU2oasdagq8KyzQYocBMqbE6JWDDSyEkN8awqrxaSlII9koZWwJCoW+l4cB 1KYpdGlrr2PYoLgbnGo+TqF0lTDrAVajtu3d7lnH7WhyQ7ilZ1lHxjwG6TodBFp8+c+O RAtjIoYl0jVTj7qKhPMXLlALunWW9GRCJ4HrGzRAQozSvHlGu5WpEwYsmgfAuXScLSaE YbHVS+tZliRm0EXm13mv6E1CLDj9jZdP4qMbOHLylV9j4R7uh+CRTVGd8gppTctSba4y N4+A== 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=xyCOijtUeAcU7a1Y8PdaVPoHXBR0y5JndKlKEfXNw/hCrYAzmDiv2XDYYQPAlABjs7 WyqD9r8+ZuSCpxufTSwy13ybAElfldCAiTXKtbm42P4JMx5oSucP5Lmb44Lkm2ICmraR RVwKBQE7RCBVDdoU17zQ1OuPLCvKucq6QDj/YFN+zCKhzWVUMyHSr450LBO+gIArW7n0 3cWtybe+5MBG8y9P8y/g1Z4Q1vVW8YnyBFpQJ+K2qv0IF8M+3+ZJptOhrLLYGt58Z+RJ 5GGnqah2Dl8QgpYd+XKji9WnZVGnfzPpggcpS0L/+oi7OtFxBLLqCRpZxJb2IZ+L6FCf B9bQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=ZJyzQq6s; 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 u6si28834943eju.58.2021.07.21.06.47.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 06:47:25 -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=ZJyzQq6s; 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 A904882C6B; Wed, 21 Jul 2021 15:45:25 +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="ZJyzQq6s"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 405E082C89; Wed, 21 Jul 2021 15:44:21 +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 EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0627.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::627]) (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 3AA3082C6C for ; Wed, 21 Jul 2021 15:44:09 +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=n+KRhd5y610UXYgSZettwGMValA0eZsnKuQvMS9UXXFDKX8trgxxXuJ2dpNr9Zw1CRe7HAaA2HJJcX0ofxpjdcXYt7QHjNHGJ6B0O+x/97d01VCBcs08nJ//gbS/c/tKUI+mZUMYP0YKlWTJIpY4b7A2ezpSsXMxaQwDLLb7rshD4wIc5JLE+SbQZ0noFAZ8Q6DlQYK33boSESu3Ml1J5zppR/dfkcmovTKr2HLX3fEWISorPVU31Rn34bpXMxFCT6ymS7imFoRiNOedQy2496qMdnoKzDCYMW9Hrr7pHG75NOyAas6x8s2Kvdprg21Q6ukRAkE4T4u8XMFTg7Mw1Q== 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=fRP0N8N94ITKesGqN9M6nkAoJYsOaUAAG7WrCvcjsj2WME5LlsKexZzy1wAC2cF2cpBgsZneX50czWFSeZc4pNu6Wk4HgtEXt0jbzf9qPRdrjxfBpHbAxnCr/4GVYMeo0mxDf5gIlCYAC2IAqgB25NF3W3OCtLz7roMVyMb/02nIdcWRKW831R5a19tJJhPEQRAlSVLnNwGIx7ftq7RqMpFkxj2emZbmQ4sAilEw/cODPoZtr5ff+N1lmTrCOwTWu9/v3ssr+5LDWXsI9aP3mtnCZ0GxS6VbXz5LaoBbQ/AG+dmliOjFAM+ovLT49utVUow0hvEtvz8/kSEHduW25Q== 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=ZJyzQq6sgGgkuD/wqvmSUuAQFXpUT1tD/DdKxhY62gxXen0nWlehStEZQXfFdt37LPS92SaKxzjwa85cyHitCZAwqDehQHB/o96tI8NJ+hz+KGxBkBb1blYFqkB0fTgzPeRxa6Xono1YqWkAnzgWM1nDRwZ4J0bKzYIwbvp1bJ4= 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 DB7PR04MB4633.eurprd04.prod.outlook.com (2603:10a6:5:36::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Wed, 21 Jul 2021 13:44:07 +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.4331.034; Wed, 21 Jul 2021 13:44:07 +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 V4 20/44] arm: imx8ulp: disable wdog3 Date: Wed, 21 Jul 2021 22:17:01 +0800 Message-Id: <20210721141725.23346-21-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210721141725.23346-1-peng.fan@oss.nxp.com> References: <20210721141725.23346-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2PR0401CA0015.apcprd04.prod.outlook.com (2603:1096:3:1::25) 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 SG2PR0401CA0015.apcprd04.prod.outlook.com (2603:1096:3:1::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Wed, 21 Jul 2021 13:44:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b4d6ff9b-b273-47fd-a628-08d94c4d9cb5 X-MS-TrafficTypeDiagnostic: DB7PR04MB4633: 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: Y96SCYvcoFAxEqHOPAg3T4aE0QZBkdzpviKVf/K43hy5IRF/BHUJu14VbEtMfXMdAFT5+U+bnbnFSh7J5kHW+kJcgJS5OwU9UKQWgZ6UDXOeplV+CP4dou8Qy/TjHIRZ5xzc+zZh8OWXfn+vNxd9DsocXF66xTiBOkXJI/eqO1kf5uDCYbEE6Mo+g3KG/b2Fu+Eba/Nwa1wVbi88fDnW840mTR5iqXjDz+hogh9SkdSBfrUi5pQWv4BAa/DYFDBMD33P2fjTtsgGSHZFd8NOnXCyp7cPNfLqjLmi0EgjLs7XPb7JA5mmRSn54Rc1iOHKjvBuGcC7mnqCjHibrbBtlR/VkkalsjsESJjVEbBr8+04sMGuwbkyMoYZ6kVo3OOShswmZwTgG9kwFxEB49qkayfwVP2EKGRIrl+pbYHS/Ydb8/veIMsKfbbT5FLXGllE4mRyZaATD/NBmz5mGff9wOiSxM7dQW5sHVPhxJiErnzCVmQjtky47iZWbENl/P37ZOoBOldPRhFPWYeBkTEZoGSRqN5tymu/YWI1PTAz5+dDI3q41vyycnEhE9ht9NCthltfhewQ4TKMh3+/ksyBIENAkA2q1talxHEBPZIrhcwcpz55hZafr97FC/rHn0bJ5DQSKVf2P4AbqHoobrQJPUAhd6odMlRQmjhGwqxOiW5CjRk0eE8InBb5AEP6pBoEdztASOkCNm/yEaGhf5K1J3eDJGyLQPeXuAgkp1NnOEE= 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)(136003)(376002)(366004)(346002)(39860400002)(396003)(2906002)(6486002)(6666004)(6512007)(38100700002)(38350700002)(956004)(5660300002)(83380400001)(86362001)(8676002)(26005)(2616005)(66556008)(66946007)(6506007)(66476007)(478600001)(1076003)(316002)(52116002)(8936002)(4326008)(186003)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X6bJ8cto8g/gmGomxPl/c1icV2rRcfoyZl2iMxBpCkUcQkol1frILA3xugGdBNhqnA8JZ87fnVnzT58h9lcjV1VjPhLgsc5IeAOdBQ8BaC8Vq12N62ibh0+AP//DOGXOv5WUILQLP+5hBlv9Hb93+rZLgiZcshiSLmbJX0boZ7gQjvmv+wp8i0Gbc1ZVro931hTw4SPyDQiRugHM2GPhOp35mfsjpwU/WO/Z0JQbazX5MENMZLOc0Jbzn5UFlWt1fyrDQlYdiZd+HjMTZjpQkBCzow3qckAhxLc17uYVlzm65BWDHkuWMQJgkITRsMWqIbuyRFnYQ9Pcbe9aNXqI1umyM7ynAwN9PA71tG20jNqn8/npsd6CCKtT2xbNOKQD2xf7KQrrSfvqn5oeX2owcXDIjKAfDwd5Pe7PPZNs/26CDvnQx+HsQBG8Ha1zcyivHNDKgkYSVJ0JLoWcKNRmmRXEj2hvjlEtI/vPaQiGozRu36m2cuJBbV5nr3FRBCemNVsjRgOGRoMn6Au4nm1BdASlK0vxpHQfeO3VD4YXr201qw+x1uxlwxR5YBdQJxhF5mLUHTaroYx9g93n1FmL08D1R5rdlbIwU3byJ2MK8fMrpbrgMn76ldb+mE/2mHHEqo/q7W3u1Grvac26UWvrCMTyxyfbejG2bsmifxLCDpVLoCjr6Kn/yKl6+ZT+cMOPs5iZusE5D4qtk3el0erviyR3W07PBj/M8O7pwGpRNI1coc9FnEbPkf6zKQYugWxWwvVDunEv7iM4L6sT8LTuYM35s24PSxhHQ6D7G5V1M40dQL8wvzGnVCXhuVZrvs+IiXAE0DYmhTUXK2D0oZ/sp4VDURNMj4klBuHvVZVtNrgZ/mwylAiirCXnYYZp4jOuAPGMKmFhxqRmHyCm4Emg1iPRzuQEqy3uah9nTvbqdUXp2vqJJNIDIequVF467NDlAD64sCB5mmk4fIRaITedFvbZdQgG03E9BfXiivtHkl6daxKz1FE7+DkGpRqXcxoIFC0vJmrgljlx+Z/oq9pzRqgZ1prCPmfguqdtPmEv86auGkCCeX40sEvyvgl/lfaFTUZsC70Y1R6tfAveAmVS3LSpTRv0LLfYYkKFPbePdRefmLAlgZ4Dsf95p0mA2M+nIIbLumn9ALv8Vp6/iY6JCh+RneUQDHLfHRUHenolmDMyzHSY/rVUIIjbG2GPqFaZKuyBG7/8Ahm9GLLJObZrwtuFuje77NREqSNbL6BD6AL3nm8IR6UxBpQDR9ho9BNFRVTjOmE3SZsb8TDUYv0A+PKJuFAKCT2Xim0EZL2Qfltr+vKbriZkzt1RbLG7ppwE X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4d6ff9b-b273-47fd-a628-08d94c4d9cb5 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 13:44:07.7347 (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: vgjFfL/VjAvqlz+wAh3GYruA8UapeaJeP/DOjQ9ZVDQRWjt260tqdkrvxUuIP3ZkcJzHPZ+cEXNSIn5WWxmlYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4633 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[] = {