From patchwork Mon Jul 19 07:46:56 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: 479811 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp3867451jao; Mon, 19 Jul 2021 00:15:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhavo2HvdZHmEHLDppr4kr7xRQAl8tnhpvODR0R/ygY56utd5VWS/M4pGRgZC2ohnQf4Pa X-Received: by 2002:a17:906:9bf0:: with SMTP id de48mr7034266ejc.260.1626678917253; Mon, 19 Jul 2021 00:15:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626678917; cv=pass; d=google.com; s=arc-20160816; b=CzBGdfqV2+OSyoF0SUtFYPcyZ04xMRXPLczolTQ1+SuYeX9Aiq/LIcHSJNEqEBwGBU oy2tsQpERcrECefckUX554LMx/d2SjA46LNEDGUNjCbu8hlfMH8DT8Udwh3Oco88kMg4 bIyDGc2Cn3OwM45reifwcnbEh6J+WSQzw28lHK+Ertx7LRSI5nl135eKean5GWM8wS7V SZRtPpLo4b5AUZoSRWUc1q+ReocMOjVAW2CWIie09A4CQbhFbebMIoRZJE+VUzmF6yKm rxQECC+2Q0fdNafkrJtzVurdu1WlRN8YYk+20ZnMA38YyPphsfvWOu3EsbAlDgNZdbe7 GazA== 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=YhliCfDqZi2E7Toa86Lo2SXWbhP3ZlbrNQ0krmojeLc=; b=et9nJOBgztGlgYsNzNXddZbm3FGnm0rMBLM0kxlCveTsvArspPyaOmX6Mvn4HQLG7R hP0gB7AKKECf2GCdkjn56y0/nVyRpMRLAmWoN28vAyZwB9Kvi9DbfgkNSinhYe6rek6E Z3y5ZXKxgYLhKSBeveG+rEYXjUKA9aaJZpxk3ZfAE0W2rtWZFI/HSsCF4e946iUTg/jV eZFzNbybXbVXGQNOC25NLJeKdWlxIVTtP1F6PvVc32opjIzIlGBAjjQaFplNT1WDpJtV hG7wlT6vK+EVdecX2v0OE15p2eFcJumvlLMekRLycVenB03Tyx8m1I4CKqWkh56/ZMfo ghrg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=MnhYcZ7O; 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 t26si19980103ejf.91.2021.07.19.00.15.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 00:15:17 -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=MnhYcZ7O; 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 04D2982BB4; Mon, 19 Jul 2021 09:14:23 +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="MnhYcZ7O"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 53EA482C1F; Mon, 19 Jul 2021 09:13:57 +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.6 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 EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20623.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::623]) (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 5A7E182BD7 for ; Mon, 19 Jul 2021 09:13:49 +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=C+eXpozGdiAj40hKruVCiyHwJhFBomwah9ttagyIPZZOPDtb8otKHGuAyWCoVDojAhLU5b+pmXUMfjKKNUMyu6CS0Yf5EAFkkwhGLqohqnKrE23kZcExMt1XKqBZwEwzsos1BropDgRVnBfqGIthQkYviw9wEoPPD+rFcdvPSuCCDinE7cieMKDDRFunngjhwvTr/jd4VW1IvgTHTv0p4/mCkwOi48eatxRd4Jb17Y0OiaTmTiTHZ73Qee89zET1hiFvUGyboIUP7ZYgDwip27XnD0xwDavzXoeCzX9KdU952nBfGiAOv2cu4EI4QnVMhgVNTL7Nl8E7EV1KDGkxcA== 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=YhliCfDqZi2E7Toa86Lo2SXWbhP3ZlbrNQ0krmojeLc=; b=ekawny81YIcd/L/URxrbAjzJQhxWiyL0Q94Wl7ekX5Nb13zjpPOPqSUbXt0r5n+5ND7lqfvGa6Wzjr/wXt4vb2QmwiemFOBFfdc/sQnTMUDTY1F+1sbGQ7YKLnqv+v7/HA8FazsGVgu+Ak3ZIyzLdLSEelYo6Xo8ZQutLJONhuGSHknVFw/bogd8Y13KTAs46a2rC1dePo42psLAMbQInMg/y5wb6Y+ctMia7mOc3vYmvMbbKHqVrgBljBOlCXiXNBZACWlseWDhWTbCMt0fMxO88f31lcCe3EywL4jLARvNIpNHUFqWf8UP7L+eUk3k1RwPGA6mWZz+ItlniriZtw== 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=YhliCfDqZi2E7Toa86Lo2SXWbhP3ZlbrNQ0krmojeLc=; b=MnhYcZ7ODBK2YEo4XeSeMMrnooISWPI00MgsSgzJy4+XIZHKg2FTq0mk2ijBaUjMZOK0axL595oAdgNi3Q08egzzD++FFTro21povR9oo2h7V+mLUZdtuZwKPpcizO/C/Y3mXwKhbORzuNN4PFkx0akySAS57ZZRL4sW0GX9f+M= 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 DB6PR0402MB2933.eurprd04.prod.outlook.com (2603:10a6:4:9c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Mon, 19 Jul 2021 07:13:47 +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.032; Mon, 19 Jul 2021 07:13:47 +0000 From: "Peng Fan (OSS)" To: sbabic@denx.de, festevam@gmail.com Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Peng Fan , Ye Li Subject: [Patch V3 06/44] arm: imx: basic i.MX8ULP support Date: Mon, 19 Jul 2021 15:46:56 +0800 Message-Id: <20210719074734.29170-7-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210719074734.29170-1-peng.fan@oss.nxp.com> References: <20210719074734.29170-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SGAP274CA0006.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::18) 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 SGAP274CA0006.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 07:13:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 01751360-a7e2-421b-f9b3-08d94a84bfdd X-MS-TrafficTypeDiagnostic: DB6PR0402MB2933: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nCDxHNzyU5v4Aw/4ja56+ubEfrvmIyPx4PrymyO+NjN/GyiMzYwRc/tnOnq0se0UCuq/Su1zSLsgdSzI4oAk+cCb+Pu6Ifx5l6d8gWB/NtUSkJvktqe+zmlPB3SZ6t2BT7wjG8PIsGQ0urQjcmRUlyHUwvcdP7O8RS/43WB63/I/1td2y8QEy/dbxZ3GGpQfvh6buvKaTznqJRf+nZS+kGwkVoRGenAoVS+qO9Y96TpIP2KjAJ+wVIPxJVGmmtMV+FxObyeIb7E0s2TEm1quNOThl1k5U58bOfGp6U5YRH8PeqirfNjgj+lRM39yvgfZMaqHmI5j0S48QxO6tPIooH3+Y3Jjpkr2UdGrUgqGhyxsDJaRCgIpfpbcFykViuzkg2KSw+CxeKDKhkyqxfktUQ/fK7RSOskn3JFNteDur8eHapH5cuvdM96k599OnfOYVdqpDYW/rW1lkfZ7idbIQSfI3hQnrg/zHEYHmQS2RuysPsT8eJCjpuD2QaIyI/JKU7fKrdwe3b3oQkEneOt8F+BSz6h0zH9EOkrgSzs49Tmb0vsF+wkODL4pxi5ywDkoPuljvcK6Hh9wsincpLxHTrCSZIPbDgk/MUrwUPlNEYaHVwgGdeWOwEG8hnc70APB+BvG+dMxZpNXWCyvXkMKLxYM8iILf/9qeMwbNE7NrRH07qzDTX82161LiJss6uC0jol5XI9DHufV0B36XAUDqg== 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)(5660300002)(508600001)(6666004)(316002)(956004)(83380400001)(8676002)(66946007)(6486002)(6512007)(66476007)(66556008)(8936002)(2616005)(1076003)(26005)(52116002)(4326008)(30864003)(186003)(86362001)(38100700002)(6506007)(38350700002)(54906003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o6rtMUnakF9aCkldM+CrpAzco+9UlLlq+UWI141BFyQ0P+0IqK2DS3bNUGA89XFXBfaf0oK9awN3NoEbfYhbJIqdB++1qcJEzsFIEp5DkUJuC7lnp4IMw+pjYK9eA2KysqtFy2BjuMp0L8OJ6RTcR5DzY5e/Vwnu+QnArDpBEJkEA4TGeUZ7Qcb1z08JyOc6EwPOHyFLpOspNZlwTiKKuTF2LZXbnoLAsfPyWSOc4xSB/QCyY0TTWWLAV2BELu3fSUlB+qhgGPPfscpZSuuEvih4vyz6Bc0IhQmM1QcLJtUBt+XnbNMI5bQi4ZrU+tWNNrNMYu5hQXT7r3rVrrqBUOkSeOFAGrsb4BRPgLO2VmzpZDfsShdMD6U9CzMApJmFQg/LhTCV86g9jgHexwJtXKra8lLWyXsjv1OPiYP0jGU/wSg9qN42Ng2Uqw9iHcmD9rcy0P+vpq9FRLerUHxcaU75AYZBGzM2L+9Cpu6wVXnfywATTLSTDVhy7xANl4/25TKxTipaSrkAfcppaQPPVCKy29LDCRZyC/lAVMfQdGLszCXM4HumKDHHnLHxliIGNr72cED7DCC377Pec13cYLOAqMj+d5TlBgIzOdbME9OTnu//WGaohU99hWHzIuPvE428Jnw8X9IHFvoLvv586QF+xX+jymygQOX+IErTwfXj8b39od8h5s058iEhBQiaQultjYnNT1NCJCud/LbNdOZdpjRe6jag3YgiWenQlm5VOMbNF+ZcpwwLuvwsi6BYjn5lWbqVZzm2yGAPErQOrdQSLk8ImPUsvXrVOvqLdXKOPAEG3Yw0nLJndzI5w1VGL+EkCgg644+qlnxwcz5Zwg2u7KRhYJy2BqkWWC/gw83eZYKy9Ac1fe/xNQKH0W7IKSNjX1slLC0UFLULWHzoWxUi84eINssYA0Ju2A0Pkx+zfV1PuMwbqdhVcXVw9bcNw0w+B9IIUAoCoSODCQCLoncSjKw7a0fWj36MrfJ1yhx1FakgjgX/ntVA0Jx8EwnCi5X2qq52UjlnEEpCcLLcfmBUP1o80PzvGU6A+yb9PMoRgEwEFb9Tnhg5Fxp18mzVK3kxXaDtLg/jJIVlxwYxg0zlE6oBhnVQCXWzAqQXOmNk+sQAir7L5KI5Gtwt5Sp39zwYgzyzk6k8zy1pIdwvdA446Fm48KROr2HWnHzbDB1tvxXYDozrSveS0nTGYpSTcoNb5igKx1d8JfJM/HfvUJX21+2hmS7Z7pH0F3sumoh9PLFhpFrp3HWWPIw7qWu5JFVUnyluuNDSY3bYt0NoRnecQtSG/B3zqCGZS+6x/M3v8qwSJrSoZQeH4dx/v5N/ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01751360-a7e2-421b-f9b3-08d94a84bfdd X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 07:13:46.9397 (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: nlh7iAN3SAVAV174PgIPkHh3KfIed8OYk47ydJVSpGQeQViWcUJp7bgMjae4oIpGy7EHvHerIjxM7wfGCRZsVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2933 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 Add basic i.MX8ULP support For the MMU part, Using a simple way the calculate the MMU size to avoid default heavy calcaulation. And align address and size in the table settings to 2MB or 4GB as much as possible. So we can reduce the 4K page allocations in MMU table which will spends much time in create the page table Signed-off-by: Ye Li Signed-off-by: Peng Fan --- arch/arm/Makefile | 4 +- arch/arm/include/asm/arch-imx8ulp/clock.h | 34 ++++ arch/arm/include/asm/arch-imx8ulp/ddr.h | 38 +++++ arch/arm/include/asm/arch-imx8ulp/gpio.h | 20 +++ arch/arm/include/asm/arch-imx8ulp/imx-regs.h | 136 ++++++++++++++++ .../include/asm/arch-imx8ulp/imx8ulp-pins.h | 60 +++++++ arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/imx8ulp/Makefile | 7 + arch/arm/mach-imx/imx8ulp/clock.c | 27 +++ arch/arm/mach-imx/imx8ulp/iomux.c | 4 + arch/arm/mach-imx/imx8ulp/lowlevel_init.S | 32 ++++ arch/arm/mach-imx/imx8ulp/soc.c | 154 +++++++++++++++++- 12 files changed, 513 insertions(+), 4 deletions(-) create mode 100644 arch/arm/include/asm/arch-imx8ulp/clock.h create mode 100644 arch/arm/include/asm/arch-imx8ulp/ddr.h create mode 100644 arch/arm/include/asm/arch-imx8ulp/gpio.h create mode 100644 arch/arm/include/asm/arch-imx8ulp/imx-regs.h create mode 100644 arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h create mode 100644 arch/arm/mach-imx/imx8ulp/Makefile create mode 100644 arch/arm/mach-imx/imx8ulp/clock.c create mode 100644 arch/arm/mach-imx/imx8ulp/iomux.c create mode 100644 arch/arm/mach-imx/imx8ulp/lowlevel_init.S -- 2.30.0 diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 28b523b37c..c68e598a67 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -107,11 +107,11 @@ libs-y += arch/arm/cpu/ libs-y += arch/arm/lib/ ifeq ($(CONFIG_SPL_BUILD),y) -ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_MX35)$(filter $(SOC), mx25 mx5 mx6 mx7 mx35 imx8m imx8 imxrt)) +ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_MX35)$(filter $(SOC), mx25 mx5 mx6 mx7 mx35 imx8m imx8 imx8ulp imxrt)) libs-y += arch/arm/mach-imx/ endif else -ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx7 mx7ulp mx31 mx35 mxs imx8m imx8 imxrt vf610)) +ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx7 mx7ulp mx31 mx35 mxs imx8m imx8 imx8ulp imxrt vf610)) libs-y += arch/arm/mach-imx/ endif endif diff --git a/arch/arm/include/asm/arch-imx8ulp/clock.h b/arch/arm/include/asm/arch-imx8ulp/clock.h new file mode 100644 index 0000000000..e145c33f01 --- /dev/null +++ b/arch/arm/include/asm/arch-imx8ulp/clock.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2020 NXP + */ + +#ifndef _ASM_ARCH_IMX8ULP_CLOCK_H +#define _ASM_ARCH_IMX8ULP_CLOCK_H + +/* Mainly for compatible to imx common code. */ +enum mxc_clock { + MXC_ARM_CLK = 0, + MXC_AHB_CLK, + MXC_IPG_CLK, + MXC_UART_CLK, + MXC_CSPI_CLK, + MXC_AXI_CLK, + MXC_DDR_CLK, + MXC_ESDHC_CLK, + MXC_ESDHC2_CLK, + MXC_I2C_CLK, +}; + +u32 mxc_get_clock(enum mxc_clock clk); +u32 get_lpuart_clk(void); +#ifdef CONFIG_SYS_I2C_IMX_LPI2C +int enable_i2c_clk(unsigned char enable, unsigned int i2c_num); +u32 imx_get_i2cclk(unsigned int i2c_num); +#endif +#ifdef CONFIG_MXC_OCOTP +void enable_ocotp_clk(unsigned char enable); +#endif +void init_clk_usdhc(u32 index); +void clock_init(void); +#endif diff --git a/arch/arm/include/asm/arch-imx8ulp/ddr.h b/arch/arm/include/asm/arch-imx8ulp/ddr.h new file mode 100644 index 0000000000..4544431b05 --- /dev/null +++ b/arch/arm/include/asm/arch-imx8ulp/ddr.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2020 NXP + */ + +#ifndef __ASM_ARCH_IMX8ULP_DDR_H +#define __ASM_ARCH_IMX8ULP_DDR_H + +#include +#include + +struct dram_cfg_param { + unsigned int reg; + unsigned int val; +}; + +struct dram_timing_info2 { + /* ddr controller config */ + struct dram_cfg_param *ctl_cfg; + unsigned int ctl_cfg_num; + /* pi config */ + struct dram_cfg_param *pi_cfg; + unsigned int pi_cfg_num; + /* phy freq1 config */ + struct dram_cfg_param *phy_f1_cfg; + unsigned int phy_f1_cfg_num; + /* phy freq2 config */ + struct dram_cfg_param *phy_f2_cfg; + unsigned int phy_f2_cfg_num; + /* initialized drate table */ + unsigned int fsp_table[3]; +}; + +extern struct dram_timing_info2 dram_timing; + +int ddr_init(struct dram_timing_info2 *dram_timing); + +#endif diff --git a/arch/arm/include/asm/arch-imx8ulp/gpio.h b/arch/arm/include/asm/arch-imx8ulp/gpio.h new file mode 100644 index 0000000000..b7563bb401 --- /dev/null +++ b/arch/arm/include/asm/arch-imx8ulp/gpio.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2020 NXP + */ + +#ifndef __ASM_ARCH_IMX8ULP_GPIO_H +#define __ASM_ARCH_IMX8ULP_GPIO_H + +struct gpio_regs { + u32 gpio_pdor; + u32 gpio_psor; + u32 gpio_pcor; + u32 gpio_ptor; + u32 gpio_pdir; + u32 gpio_pddr; + u32 gpio_pidr; + u8 gpio_pxdr[32]; +}; + +#endif diff --git a/arch/arm/include/asm/arch-imx8ulp/imx-regs.h b/arch/arm/include/asm/arch-imx8ulp/imx-regs.h new file mode 100644 index 0000000000..982f2a9b28 --- /dev/null +++ b/arch/arm/include/asm/arch-imx8ulp/imx-regs.h @@ -0,0 +1,136 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2020 NXP + */ + +#ifndef _IMX8ULP_REGS_H_ +#define _IMX8ULP_REGS_H_ +#define ARCH_MXC + +#include + +#define PBRIDGE0_BASE 0x28000000 + +#define CMC0_RBASE 0x28025000 + +#define CMC1_BASE_ADDR 0x29240000 + +#define SIM1_BASE_ADDR 0x29290000 + +#define WDG3_RBASE 0x292a0000UL + +#define SIM_SEC_BASE_ADDR 0x2802B000 + +#define CGC1_SOSCDIV_ADDR 0x292C0108 +#define CGC1_FRODIV_ADDR 0x292C0208 + +#define CFG1_PLL2CSR_ADDR 0x292C0500 +#define CFG1_PLL2CFG_ADDR 0x292C0510 + +#define PCC_XRDC_MGR_ADDR 0x292d00bc + +#define PCC3_RBASE 0x292d0000 +#define PCC4_RBASE 0x29800000 +#define PCC5_RBASE 0x2da70000 + +#define IOMUXC_BASE_ADDR 0x298c0000 + +#define LPUART4_RBASE 0x29390000 +#define LPUART5_RBASE 0x293a0000 +#define LPUART6_RBASE 0x29860000 +#define LPUART7_RBASE 0x29870000 + +#define LPUART_BASE LPUART5_RBASE + +#define FSB_BASE_ADDR 0x27010000 + +#define USBOTG0_RBASE 0x29900000 +#define USB_PHY0_BASE_ADDR 0x29910000 +#define USBOTG1_RBASE 0x29920000 +#define USB_PHY1_BASE_ADDR 0x29930000 +#define USB_BASE_ADDR USBOTG0_RBASE + +#define DDR_CTL_BASE_ADDR 0x2E060000 +#define DDR_PI_BASE_ADDR 0x2E062000 +#define DDR_PHY_BASE_ADDR 0x2E064000 +#define AVD_SIM_BASE_ADDR 0x2DA50000 +#define AVD_SIM_LPDDR_CTRL (AVD_SIM_BASE_ADDR + 0x14) +#define AVD_SIM_LPDDR_CTRL2 (AVD_SIM_BASE_ADDR + 0x18) + +#define FEC_QUIRK_ENET_MAC + +#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__)) +#include + +struct usbphy_regs { + u32 usbphy_pwd; /* 0x000 */ + u32 usbphy_pwd_set; /* 0x004 */ + u32 usbphy_pwd_clr; /* 0x008 */ + u32 usbphy_pwd_tog; /* 0x00c */ + u32 usbphy_tx; /* 0x010 */ + u32 usbphy_tx_set; /* 0x014 */ + u32 usbphy_tx_clr; /* 0x018 */ + u32 usbphy_tx_tog; /* 0x01c */ + u32 usbphy_rx; /* 0x020 */ + u32 usbphy_rx_set; /* 0x024 */ + u32 usbphy_rx_clr; /* 0x028 */ + u32 usbphy_rx_tog; /* 0x02c */ + u32 usbphy_ctrl; /* 0x030 */ + u32 usbphy_ctrl_set; /* 0x034 */ + u32 usbphy_ctrl_clr; /* 0x038 */ + u32 usbphy_ctrl_tog; /* 0x03c */ + u32 usbphy_status; /* 0x040 */ + u32 reserved0[3]; + u32 usbphy_debug; /* 0x050 */ + u32 usbphy_debug_set; /* 0x054 */ + u32 usbphy_debug_clr; /* 0x058 */ + u32 usbphy_debug_tog; /* 0x05c */ + u32 usbphy_debug0_status; /* 0x060 */ + u32 reserved1[3]; + u32 usbphy_debug1; /* 0x070 */ + u32 usbphy_debug1_set; /* 0x074 */ + u32 usbphy_debug1_clr; /* 0x078 */ + u32 usbphy_debug1_tog; /* 0x07c */ + u32 usbphy_version; /* 0x080 */ + u32 reserved2[7]; + u32 usb1_pll_480_ctrl; /* 0x0a0 */ + u32 usb1_pll_480_ctrl_set; /* 0x0a4 */ + u32 usb1_pll_480_ctrl_clr; /* 0x0a8 */ + u32 usb1_pll_480_ctrl_tog; /* 0x0ac */ + u32 reserved3[4]; + u32 usb1_vbus_detect; /* 0xc0 */ + u32 usb1_vbus_detect_set; /* 0xc4 */ + u32 usb1_vbus_detect_clr; /* 0xc8 */ + u32 usb1_vbus_detect_tog; /* 0xcc */ + u32 usb1_vbus_det_stat; /* 0xd0 */ + u32 reserved4[3]; + u32 usb1_chrg_detect; /* 0xe0 */ + u32 usb1_chrg_detect_set; /* 0xe4 */ + u32 usb1_chrg_detect_clr; /* 0xe8 */ + u32 usb1_chrg_detect_tog; /* 0xec */ + u32 usb1_chrg_det_stat; /* 0xf0 */ + u32 reserved5[3]; + u32 usbphy_anactrl; /* 0x100 */ + u32 usbphy_anactrl_set; /* 0x104 */ + u32 usbphy_anactrl_clr; /* 0x108 */ + u32 usbphy_anactrl_tog; /* 0x10c */ + u32 usb1_loopback; /* 0x110 */ + u32 usb1_loopback_set; /* 0x114 */ + u32 usb1_loopback_clr; /* 0x118 */ + u32 usb1_loopback_tog; /* 0x11c */ + u32 usb1_loopback_hsfscnt; /* 0x120 */ + u32 usb1_loopback_hsfscnt_set; /* 0x124 */ + u32 usb1_loopback_hsfscnt_clr; /* 0x128 */ + u32 usb1_loopback_hsfscnt_tog; /* 0x12c */ + u32 usphy_trim_override_en; /* 0x130 */ + u32 usphy_trim_override_en_set; /* 0x134 */ + u32 usphy_trim_override_en_clr; /* 0x138 */ + u32 usphy_trim_override_en_tog; /* 0x13c */ + u32 usb1_pfda_ctrl1; /* 0x140 */ + u32 usb1_pfda_ctrl1_set; /* 0x144 */ + u32 usb1_pfda_ctrl1_clr; /* 0x148 */ + u32 usb1_pfda_ctrl1_tog; /* 0x14c */ +}; +#endif + +#endif diff --git a/arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h b/arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h new file mode 100644 index 0000000000..d7c07f41b3 --- /dev/null +++ b/arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2021 NXP + */ + +#ifndef __ASM_ARCH_IMX8ULP_PINS_H__ +#define __ASM_ARCH_IMX8ULP_PINS_H__ + +#include + +enum { + IMX8ULP_PAD_PTB7__PMIC0_MODE2 = IOMUX_PAD(0x009C, 0x009C, IOMUX_CONFIG_MPORTS | 0xA, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTB8__PMIC0_MODE1 = IOMUX_PAD(0x00A0, 0x00A0, IOMUX_CONFIG_MPORTS | 0xA, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTB9__PMIC0_MODE0 = IOMUX_PAD(0x00A4, 0x00A4, IOMUX_CONFIG_MPORTS | 0xA, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTB10__PMIC0_SDA = IOMUX_PAD(0x00A8, 0x00A8, IOMUX_CONFIG_MPORTS | 0xA, 0x0804, 0x2, 0), + IMX8ULP_PAD_PTB11__PMIC0_SCL = IOMUX_PAD(0x00AC, 0x00AC, IOMUX_CONFIG_MPORTS | 0xA, 0x0800, 0x2, 0), + + IMX8ULP_PAD_PTD0__SDHC0_RESET_b = IOMUX_PAD(0x0000, 0x0000, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD1__SDHC0_CMD = IOMUX_PAD(0x0004, 0x0004, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD2__SDHC0_CLK = IOMUX_PAD(0x0008, 0x0008, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD3__SDHC0_D7 = IOMUX_PAD(0x000C, 0x000C, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD4__SDHC0_D6 = IOMUX_PAD(0x0010, 0x0010, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD5__SDHC0_D5 = IOMUX_PAD(0x0014, 0x0014, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD6__SDHC0_D4 = IOMUX_PAD(0x0018, 0x0018, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD7__SDHC0_D3 = IOMUX_PAD(0x001C, 0x001C, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD8__SDHC0_D2 = IOMUX_PAD(0x0020, 0x0020, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD9__SDHC0_D1 = IOMUX_PAD(0x0024, 0x0024, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD10__SDHC0_D0 = IOMUX_PAD(0x0028, 0x0028, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD11__SDHC0_DQS = IOMUX_PAD(0x002C, 0x002C, 0x8, 0x0000, 0x0, 0), + + IMX8ULP_PAD_PTD11__FLEXSPI2_B_SS0_B = IOMUX_PAD(0x002C, 0x002C, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD11__FLEXSPI2_A_SS1_B = IOMUX_PAD(0x002C, 0x002C, 0xa, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD12__FLEXSPI2_A_SS0_B = IOMUX_PAD(0x0030, 0x0030, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD12__FLEXSPI2_B_SS1_B = IOMUX_PAD(0x0030, 0x0030, 0xa, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD13__FLEXSPI2_A_SCLK = IOMUX_PAD(0x0034, 0x0034, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD14__FLEXSPI2_A_DATA3 = IOMUX_PAD(0x0038, 0x0038, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD15__FLEXSPI2_A_DATA2 = IOMUX_PAD(0x003c, 0x003c, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD16__FLEXSPI2_A_DATA1 = IOMUX_PAD(0x0040, 0x0040, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD17__FLEXSPI2_A_DATA0 = IOMUX_PAD(0x0044, 0x0044, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD18__FLEXSPI2_A_DQS = IOMUX_PAD(0x0048, 0x0048, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD19__FLEXSPI2_A_DATA7 = IOMUX_PAD(0x004c, 0x004c, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD20__FLEXSPI2_A_DATA6 = IOMUX_PAD(0x0050, 0x0050, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD21__FLEXSPI2_A_DATA5 = IOMUX_PAD(0x0054, 0x0054, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD22__FLEXSPI2_A_DATA4 = IOMUX_PAD(0x0058, 0x0058, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD23__FLEXSPI2_A_SS0_B = IOMUX_PAD(0x005c, 0x005c, 0x9, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTD23__FLEXSPI2_A_SCLK = IOMUX_PAD(0x005c, 0x005c, 0xa, 0x0000, 0x0, 0), + + IMX8ULP_PAD_PTE19__ENET0_REFCLK = IOMUX_PAD(0x00CC, 0x00CC, 0xA, 0x0AF4, 0x1, 0), + IMX8ULP_PAD_PTF10__ENET0_1588_CLKIN = IOMUX_PAD(0x0128, 0x0128, 0x9, 0x0AD0, 0x2, 0), + + IMX8ULP_PAD_PTF11__SDHC1_RESET_b = IOMUX_PAD(0x012C, 0x012C, 0x8, 0x0000, 0x0, 0), + IMX8ULP_PAD_PTF3__SDHC1_CMD = IOMUX_PAD(0x010C, 0x010C, 0x8, 0x0A60, 0x2, 0), + IMX8ULP_PAD_PTF2__SDHC1_CLK = IOMUX_PAD(0x0108, 0x0108, 0x8, 0x0A5C, 0x2, 0), + IMX8ULP_PAD_PTF4__SDHC1_D3 = IOMUX_PAD(0x0110, 0x0110, 0x8, 0x0A70, 0x2, 0), + IMX8ULP_PAD_PTF5__SDHC1_D2 = IOMUX_PAD(0x0114, 0x0114, 0x8, 0x0A6C, 0x2, 0), + IMX8ULP_PAD_PTF0__SDHC1_D1 = IOMUX_PAD(0x0100, 0x0100, 0x8, 0x0A68, 0x2, 0), + IMX8ULP_PAD_PTF1__SDHC1_D0 = IOMUX_PAD(0x0104, 0x0104, 0x8, 0x0A64, 0x2, 0), + +}; +#endif /* __ASM_ARCH_IMX8ULP_PINS_H__ */ diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 82aa39dee7..36224d8db9 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -227,6 +227,7 @@ obj-$(CONFIG_MX5) += mx5/ obj-$(CONFIG_MX6) += mx6/ obj-$(CONFIG_MX7) += mx7/ obj-$(CONFIG_ARCH_MX7ULP) += mx7ulp/ +obj-$(CONFIG_ARCH_IMX8ULP) += imx8ulp/ obj-$(CONFIG_IMX8M) += imx8m/ obj-$(CONFIG_ARCH_IMX8) += imx8/ obj-$(CONFIG_ARCH_IMXRT) += imxrt/ diff --git a/arch/arm/mach-imx/imx8ulp/Makefile b/arch/arm/mach-imx/imx8ulp/Makefile new file mode 100644 index 0000000000..e8970dc04f --- /dev/null +++ b/arch/arm/mach-imx/imx8ulp/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2020 NXP +# + +obj-y += lowlevel_init.o +obj-y += soc.o clock.o iomux.o diff --git a/arch/arm/mach-imx/imx8ulp/clock.c b/arch/arm/mach-imx/imx8ulp/clock.c new file mode 100644 index 0000000000..f866809fc2 --- /dev/null +++ b/arch/arm/mach-imx/imx8ulp/clock.c @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 NXP + */ + +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +void clock_init(void) +{ +} + +unsigned int mxc_get_clock(enum mxc_clock clk) +{ + return 0; +} + +u32 get_lpuart_clk(void) +{ + return 24000000; +} diff --git a/arch/arm/mach-imx/imx8ulp/iomux.c b/arch/arm/mach-imx/imx8ulp/iomux.c new file mode 100644 index 0000000000..c52ccdeaea --- /dev/null +++ b/arch/arm/mach-imx/imx8ulp/iomux.c @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 NXP + */ diff --git a/arch/arm/mach-imx/imx8ulp/lowlevel_init.S b/arch/arm/mach-imx/imx8ulp/lowlevel_init.S new file mode 100644 index 0000000000..7d81a75639 --- /dev/null +++ b/arch/arm/mach-imx/imx8ulp/lowlevel_init.S @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2020 NXP + */ + +#include + +.align 8 +.global rom_pointer +rom_pointer: + .space 256 + +/* + * Routine: save_boot_params (called after reset from start.S) + */ + +.global save_boot_params +save_boot_params: + /* The firmware provided ATAG/FDT address can be found in r2/x0 */ + adr x0, rom_pointer + stp x1, x2, [x0], #16 + stp x3, x4, [x0], #16 + + /* Returns */ + b save_boot_params_ret + +.global restore_boot_params +restore_boot_params: + adr x0, rom_pointer + ldp x1, x2, [x0], #16 + ldp x3, x4, [x0], #16 + ret diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c index 383dbe6000..f14c6b421a 100644 --- a/arch/arm/mach-imx/imx8ulp/soc.c +++ b/arch/arm/mach-imx/imx8ulp/soc.c @@ -7,8 +7,11 @@ #include #include #include +#include #include +DECLARE_GLOBAL_DATA_PTR; + u32 get_cpu_rev(void) { return (MXC_CPU_IMX8ULP << 12) | CHIP_REV_1_0; @@ -52,8 +55,8 @@ static u32 reset_cause = -1; static char *get_reset_cause(char *ret) { u32 cause1, cause = 0, srs = 0; - void __iomem *reg_ssrs = (void __iomem *)(SRC_BASE_ADDR + 0x88); - void __iomem *reg_srs = (void __iomem *)(SRC_BASE_ADDR + 0x80); + void __iomem *reg_ssrs = (void __iomem *)(CMC1_BASE_ADDR + 0x88); + void __iomem *reg_srs = (void __iomem *)(CMC1_BASE_ADDR + 0x80); if (!ret) return "null"; @@ -137,3 +140,150 @@ int print_cpuinfo(void) } #endif +void init_wdog(void) +{ + /* TODO */ +} + +static struct mm_region imx8ulp_arm64_mem_map[] = { + { + /* ROM */ + .virt = 0x0, + .phys = 0x0, + .size = 0x40000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_OUTER_SHARE + }, + { + /* FLEXSPI0 */ + .virt = 0x04000000, + .phys = 0x04000000, + .size = 0x08000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, + { + /* SSRAM (align with 2M) */ + .virt = 0x1FE00000UL, + .phys = 0x1FE00000UL, + .size = 0x400000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_OUTER_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* SRAM1 (align with 2M) */ + .virt = 0x21000000UL, + .phys = 0x21000000UL, + .size = 0x200000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_OUTER_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* SRAM0 (align with 2M) */ + .virt = 0x22000000UL, + .phys = 0x22000000UL, + .size = 0x200000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_OUTER_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* Peripherals */ + .virt = 0x27000000UL, + .phys = 0x27000000UL, + .size = 0x3000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* Peripherals */ + .virt = 0x2D000000UL, + .phys = 0x2D000000UL, + .size = 0x1600000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* FLEXSPI1-2 */ + .virt = 0x40000000UL, + .phys = 0x40000000UL, + .size = 0x40000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* DRAM1 */ + .virt = 0x80000000UL, + .phys = 0x80000000UL, + .size = PHYS_SDRAM_SIZE, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_OUTER_SHARE + }, { + /* + * empty entrie to split table entry 5 + * if needed when TEEs are used + */ + 0, + }, { + /* List terminator */ + 0, + } +}; + +struct mm_region *mem_map = imx8ulp_arm64_mem_map; + +/* simplify the page table size to enhance boot speed */ +#define MAX_PTE_ENTRIES 512 +#define MAX_MEM_MAP_REGIONS 16 +u64 get_page_table_size(void) +{ + u64 one_pt = MAX_PTE_ENTRIES * sizeof(u64); + u64 size = 0; + + /* + * For each memory region, the max table size: + * 2 level 3 tables + 2 level 2 tables + 1 level 1 table + */ + size = (2 + 2 + 1) * one_pt * MAX_MEM_MAP_REGIONS + one_pt; + + /* + * We need to duplicate our page table once to have an emergency pt to + * resort to when splitting page tables later on + */ + size *= 2; + + /* + * We may need to split page tables later on if dcache settings change, + * so reserve up to 4 (random pick) page tables for that. + */ + size += one_pt * 4; + + return size; +} + +void enable_caches(void) +{ + /* TODO: add TEE memmap region */ + + icache_enable(); + dcache_enable(); +} + +int dram_init(void) +{ + gd->ram_size = PHYS_SDRAM_SIZE; + + return 0; +} + +#ifdef CONFIG_SERIAL_TAG +void get_board_serial(struct tag_serialnr *serialnr) +{ + /* TODO */ +} +#endif + +int arch_cpu_init(void) +{ + return 0; +}