From patchwork Thu Mar 16 05:19:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangfl X-Patchwork-Id: 70574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp299885wrt; Wed, 15 Mar 2023 22:35:44 -0700 (PDT) X-Google-Smtp-Source: AK7set+WoPOGUsd8fYmfXqCw2mebAfrDk6We7jssVRjYN7aZRHUcSxg3GHmewM9RIijw+Rtod5Kp X-Received: by 2002:a05:6a20:4412:b0:d5:e107:bd19 with SMTP id ce18-20020a056a20441200b000d5e107bd19mr3017718pzb.31.1678944944516; Wed, 15 Mar 2023 22:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678944944; cv=none; d=google.com; s=arc-20160816; b=VQXauF9Y/YGHTVpbyEsXjfiBs+5bbgzQvniICoObkAOLDViDSGBFfxKsX9fX9rW150 ARqqD83n1oeSZYW381nXaIn0leyzThf/mNa0bLDnrg7EF5xELZOtkM/gmgJ7NF+Tu33I 7KjkRmWMw7GuaiiP81WKcoHqiYMe4i9srk4JR4EIRC5JDg28P6hTlgxrYnOrBl6Lg1RF MCbZ3wlDiHiKEiDMbQAI+M1TL58Dsy3yjvsyn7g3NgW7Yj53bo7hbzUVYetHagCPKp7/ 5PolVzsNbv/TggG7Miw3WwvD+F+bzgKKboTk/RC/4hbi9qGlH0Zu7PaRL6xywbDzr1k8 FRTw== 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 :dkim-signature; bh=cnS/2L5eapvwqGTZQsUuWuWrYgLcDrvgqwnYFYygers=; b=evYUmPfMzIyrNv4VWSrV/XTCg49lH0jriYxBRtEK3bfoND4eB/cKlCHvpUpvQ4uXrL MojWGFOtYSZXmQHqL0Ml/Cw2IqUcuwfAXYVzRwdj3r0oKq/N8PfIYrmq8lNrdNXLL5CT quJ2MOu7EQRWGhplAfBZxvkyxx0eE2EbmTR/uxE2LBqm5faeWoaKTazFtJqC+iLXCaby QDDeCyAatmhPbDnhKtEIUZ9+6LRFbNkPjug2VdLvgt35vnhq1+DhZu6AzVfB8O0dtW89 GzgjtZhHGl4QvfT5mwDG0VwC0u/r25s0JT9LgfovRmyFDaIEvdb4V10F7c5GjzTcRYFy T9mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QE826bxy; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020a6560d4000000b00508caaf69besi6736370pgv.862.2023.03.15.22.35.31; Wed, 15 Mar 2023 22:35:44 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QE826bxy; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229727AbjCPFUH (ORCPT + 99 others); Thu, 16 Mar 2023 01:20:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229712AbjCPFUF (ORCPT ); Thu, 16 Mar 2023 01:20:05 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F4DA9DFA for ; Wed, 15 Mar 2023 22:20:02 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id p13-20020a17090a284d00b0023d2e945aebso4969957pjf.0 for ; Wed, 15 Mar 2023 22:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678944002; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cnS/2L5eapvwqGTZQsUuWuWrYgLcDrvgqwnYFYygers=; b=QE826bxyY1maP+6E6wVynxn9Mv6IuqRQViB2FhQD0h/chSW/Kw+weOZ4aZ4wVs81Pf Ing4sukZ64gzdoNgoFnEKc1PUpuvKZmKztMqw5eFxiRCO8X1OIjuVsEGuhYJOkjl/Jqf taUF8/Q8HWqTvOx3TQmc1s2avXtx3xP0JavcyM3wlC2IBVTz17uGXho9CLqP0sRoe65f vdOyOoCURiYufz8tH653p2RPal+y1gioShzqK6otX5Z01blem1kiFqghfcjNxYaJergQ BF9XVxFbTiGT9aWCVT+nHcza7vCFaZ89i89ufYjjHTfRjOfmpXqO04UtM7B/bUPc5DS6 1ROg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678944002; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cnS/2L5eapvwqGTZQsUuWuWrYgLcDrvgqwnYFYygers=; b=ETdVZNVcPRt32zKHYi7IgqD/3ui8R/b2t9bacTQwURSfL3vm0vPl4AkGPprOVJq2+T C6qSL7B0NRp9/Vx6u9FBB+V0JvK0XLkQ79zHqnvE/M5KEC68n0tHRCZ2CyK58cofJCzO pMkHT+SKnuL1gG6Hzg2ySG73SH4J24QrJnqrPTLVXTLoNvbcD/WSNHY9bzLBk4gEcF1L mFxJe70y+IJUL8nkEin1y93R0IodKU5txq2Fm6oujOExX0k02VCRm+zKoPV8R+YOZ5Ex JY+oHJJQPccpxCb0VKMC8/+xN4Z7M/pGejgMZ9hphDGXI8ejEGsQUqmBHGYhEiPXB3t7 4B7g== X-Gm-Message-State: AO0yUKVDUN+i1ctotz/1Qv/adkJs7MBVmHyev5ZVXCIKctwj9N7LH4sW myB1MQZDpcWtXHxg4jMy4gzMEvld2LE418mG+D0= X-Received: by 2002:a17:902:ce92:b0:19c:fd73:5586 with SMTP id f18-20020a170902ce9200b0019cfd735586mr2269077plg.38.1678944002224; Wed, 15 Mar 2023 22:20:02 -0700 (PDT) Received: from d.home.yangfl.dn42 ([104.28.213.199]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b0019a593e45f1sm4475708plb.261.2023.03.15.22.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 22:20:02 -0700 (PDT) From: David Yang To: mmyangfl@gmail.com Cc: Wei Xu , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] ARM: hisi: Add S40 IO map Date: Thu, 16 Mar 2023 13:19:33 +0800 Message-Id: <20230316051936.1775033-2-mmyangfl@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230316051936.1775033-1-mmyangfl@gmail.com> References: <20230316051936.1775033-1-mmyangfl@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760501374066645952?= X-GMAIL-MSGID: =?utf-8?q?1760501374066645952?= Hisilion S40 platform supports ARM Cortex-A9 processors. Signed-off-by: David Yang --- arch/arm/mach-hisi/hisilicon.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/arch/arm/mach-hisi/hisilicon.c b/arch/arm/mach-hisi/hisilicon.c index b8d14b369..9f56b0f56 100644 --- a/arch/arm/mach-hisi/hisilicon.c +++ b/arch/arm/mach-hisi/hisilicon.c @@ -50,3 +50,36 @@ DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)") .map_io = hi3620_map_io, .dt_compat = hi3xxx_compat, MACHINE_END + +#define S40_IOCH1_PHYS_BASE 0xf8000000 +#define S40_IOCH1_VIRT_BASE 0xf9000000 +#define S40_IOCH1_SIZE 0x02000000 + +static struct map_desc s40_io_desc[] __initdata = { + { + .pfn = __phys_to_pfn(S40_IOCH1_PHYS_BASE), + .virtual = S40_IOCH1_VIRT_BASE, + .length = S40_IOCH1_SIZE, + .type = MT_DEVICE, + }, +}; + +static void __init s40_map_io(void) +{ + debug_ll_io_init(); + iotable_init(s40_io_desc, ARRAY_SIZE(s40_io_desc)); +} + +static const char *const s40_compat[] __initconst = { + "hisilicon,hi3798cv200", + "hisilicon,hi3796mv200", + "hisilicon,hi3798cv200", + "hisilicon,hi3798mv200", + "hisilicon,hi3798mv300", + NULL, +}; + +DT_MACHINE_START(S40, "Hisilicon S40 (Flattened Device Tree)") + .map_io = s40_map_io, + .dt_compat = s40_compat, +MACHINE_END From patchwork Thu Mar 16 05:19:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangfl X-Patchwork-Id: 70576 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp301274wrt; Wed, 15 Mar 2023 22:40:55 -0700 (PDT) X-Google-Smtp-Source: AK7set8K9T26zUzd4/565llHuMfNQIiVPBW4WTeHpMKbvGZM65/JvsBPFv/tJI+aDoZPBofvd3N0 X-Received: by 2002:a05:6a20:a91f:b0:cb:cfb1:5009 with SMTP id cd31-20020a056a20a91f00b000cbcfb15009mr2015544pzb.34.1678945255277; Wed, 15 Mar 2023 22:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678945255; cv=none; d=google.com; s=arc-20160816; b=vXg8cQCeiSIFOzrnPPg1yW0INcBdPK75+YfHQBl/NsV0sDCpxxNVqVm9tSjwctu3p/ VKVm93gqV5RO+r61pZJBAz+8zGSWWDT6QbGzpi8mD+olBDyGhfeV67f3dLJWa8RVa1W/ B4YRv/R4LS4mKtB3aDwmLIHrkl5J55ut2AmYGadTgKDHGETjLRHT7EJmXajVlDxwFVPF a0+pMDrSjYKcPPy2qyROrD4SQrMo1mUiMmb1tzO4E7rIR798INriXX4TRjv/XE9BVmfS 2MOfiR96XAGMYH3eyb+uX9tH8KtlvQUi1C8Uqi1TA0hF+g/JVQgmchDPICN9EIkP2/+L cFQg== 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 :dkim-signature; bh=LN29kza4KP9+va9q8WQlQCM3UUiFt6hAQqDjXosgzqs=; b=BC0G7lA+Ijfk/QOLfwUZjBjIp/EaFiNUNz0V8oeTcu1DMN0AvfLMHhGKG1sL2CfJn8 +egiGesSE2C16wS2MW2HtdpOQHhICNKKCBec4RwpK2FTcUjr6S6hifWEJoPsUAvRRzTl 0fDCUNquZFE/tmaVwzpWmh0ayUKJ0CcZiPwGWSACIlg+zOX+jqUk/mvO8+ObuFxS2OPQ kSbSXoroLm33NR04OjF8kyZCRSaRFol8GUscCgBm1WXzkhPUU81W1UQ/bgHlVDka6PvG d1G2sGvDfjyHYC5BLFSaIqC2TYOn88bSFMDkXdIgOqGVx/QWouvU5fcC1qTYTPcZRrMF P/kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=muzRYG4n; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a62520e000000b00623b50eb7d0si6415948pfb.214.2023.03.15.22.40.39; Wed, 15 Mar 2023 22:40:55 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=muzRYG4n; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229760AbjCPFUS (ORCPT + 99 others); Thu, 16 Mar 2023 01:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjCPFUP (ORCPT ); Thu, 16 Mar 2023 01:20:15 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC82CAA262 for ; Wed, 15 Mar 2023 22:20:08 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id p13-20020a17090a284d00b0023d2e945aebso4970094pjf.0 for ; Wed, 15 Mar 2023 22:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678944008; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LN29kza4KP9+va9q8WQlQCM3UUiFt6hAQqDjXosgzqs=; b=muzRYG4npi5Fc+pBJCCHrt/h4NEe3GwxCYPXhlBC2XF0Ypm5YpzWQOkTd/7jltf4rI ha9wslI/6XTVb5f4gwyFVZfmazKVY0Z14ReT6xI2FPYBPf/AZYte+I+3N+OH3F+nugRY vQB70q2AnoeOUU6nLsIKS6woKvEQwiqWlTIiRruqr7unVdkDlQEuRZH7/w0QKE4e7zgp JG0gmv+wjyRoQ1TVYL8k81h5BEHGGafjiZH4nzUrN/JtucKJ2U1EgqtsnUuPTWF1fSiV GsrUVx/EZmQZZ/s/AxcKQ5GpSSwVLO8M8148R7rkeTDXFqWx+io6wqB5mHta8lwr46ab uAhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678944008; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LN29kza4KP9+va9q8WQlQCM3UUiFt6hAQqDjXosgzqs=; b=rk5el88VuNrshUCxCjqAiK0Xj/K8oGyiP+SLtxyH4L+QRarn60J6F1GB9HsJ08Sy9U m6YMylWP7f0KSVjbk6VnRmrFejt75Rad9nlEkLv4vZtRdTsZvFVd44DZltCb5o01ael9 wGLpGHHD/THosCCDdlfTCXYc5rvBwzx2Vn3KYXY2B+ex85YTk3JBtqL/gxOAvzFMAgc6 fOc/o2wJG2EAryk4Uy8QjIYDMhUzIYsdI5hESjav4oqwFwKQ2+lNj6+dRmZ4iu7eud93 u0/Zc2s2pTZMBmm/peu6o8+l6HXGi6EJhu4tFmm9i9PJjAauL9fxD+SfuXN3jgg6VBhR SIYA== X-Gm-Message-State: AO0yUKV0vHj07LZHcMZmUa/17jXQu8VjOssFnUt4fJpS470snJbv49iP cW1XEEv6N6C1GqHXb1I4XCo= X-Received: by 2002:a17:90b:388d:b0:234:b082:48a2 with SMTP id mu13-20020a17090b388d00b00234b08248a2mr2448834pjb.28.1678944008407; Wed, 15 Mar 2023 22:20:08 -0700 (PDT) Received: from d.home.yangfl.dn42 ([104.28.213.199]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b0019a593e45f1sm4475708plb.261.2023.03.15.22.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 22:20:08 -0700 (PDT) From: David Yang To: mmyangfl@gmail.com Cc: Wei Xu , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] ARM: hisi: Add S5 IO map Date: Thu, 16 Mar 2023 13:19:34 +0800 Message-Id: <20230316051936.1775033-3-mmyangfl@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230316051936.1775033-1-mmyangfl@gmail.com> References: <20230316051936.1775033-1-mmyangfl@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760501700072827776?= X-GMAIL-MSGID: =?utf-8?q?1760501700072827776?= Hisilion S5 platform supports ARM Cortex-A7 processors. Signed-off-by: David Yang --- arch/arm/mach-hisi/hisilicon.c | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/arch/arm/mach-hisi/hisilicon.c b/arch/arm/mach-hisi/hisilicon.c index 9f56b0f56..f9109df8c 100644 --- a/arch/arm/mach-hisi/hisilicon.c +++ b/arch/arm/mach-hisi/hisilicon.c @@ -83,3 +83,40 @@ DT_MACHINE_START(S40, "Hisilicon S40 (Flattened Device Tree)") .map_io = s40_map_io, .dt_compat = s40_compat, MACHINE_END + +#define S5_IOCH2_PHYS_BASE 0xff000000 +#define S5_IOCH2_VIRT_BASE 0xfb000000 +#define S5_IOCH2_SIZE 0x00430000 + +static struct map_desc s5_io_desc[] __initdata = { + { + .pfn = __phys_to_pfn(S5_IOCH2_PHYS_BASE), + .virtual = S5_IOCH2_VIRT_BASE, + .length = S5_IOCH2_SIZE, + .type = MT_DEVICE, + }, + { + .pfn = __phys_to_pfn(S40_IOCH1_PHYS_BASE), + .virtual = S40_IOCH1_VIRT_BASE, + .length = S40_IOCH1_SIZE, + .type = MT_DEVICE, + }, +}; + +static void __init s5_map_io(void) +{ + debug_ll_io_init(); + iotable_init(s5_io_desc, ARRAY_SIZE(s5_io_desc)); +} + +static const char *const s5_compat[] __initconst = { + "hisilicon,hi3716cv200", + "hisilicon,hi3716mv410", + "hisilicon,hi3798mv100", + NULL, +}; + +DT_MACHINE_START(S5, "Hisilicon S5 (Flattened Device Tree)") + .map_io = s5_map_io, + .dt_compat = s5_compat, +MACHINE_END From patchwork Thu Mar 16 05:19:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangfl X-Patchwork-Id: 70572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp299487wrt; Wed, 15 Mar 2023 22:34:16 -0700 (PDT) X-Google-Smtp-Source: AK7set/B+symMww5KHkmXgFlGmnUGyTOoPiU/5T5x5m5bptKIJFXZ+9mCG52vXBjVAM2bIRlnZ19 X-Received: by 2002:a17:902:dacf:b0:1a0:712e:1c8f with SMTP id q15-20020a170902dacf00b001a0712e1c8fmr2448279plx.34.1678944856477; Wed, 15 Mar 2023 22:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678944856; cv=none; d=google.com; s=arc-20160816; b=M+UBrf/R9MN5jovBYZrZfEqPxBrerYO+CjPba0m3obDKebTa3XsX6RbRXbksdoxfV/ swTtoL5fQDU0gXyh3lY4jZq37MRP+XimUmkmUJ4KwL4DoILCTZ4OvWGnE23HIkmcZI5z MH1ooD3amuWkhyewKIcsdYqiyadt32ph/5umH59wjsmGpI9pFCXB7HE8nZuniZcbKZZB 9hIqn5iQS61Y49IUDDQfZxL+r2F/CE+TurwYj0DHzAIOZPfJtMA7m3rS5CI5s4MyXNhw 2FIfqVshdEsIVMyKkrsKvCcBgVmKJs3v6QE3YHs6pE7fqjfZ0avssHTFChntfrURuJfm aWLA== 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 :dkim-signature; bh=MdHaFK8bWu3beR7Jd/q7mNjpdPdNabQi6H6vrXWG2vM=; b=U+z46teIVwuyb9dNNqOqRoKYYe/5vEd/OmhFjuOPYC+t3p2xwEZm5uJDKYJTMn2GJs 4hhhPnoQxnR4HUbNDRoNS80F9OBX2ksZB9M8xTox0dur7afr8VzKqkFV7mITUA9SnFzr /iyFxTSKHMvRwYaiHPDOL8GP34/5He8tjhggBEK7xPK4T9bof3KlsU0BNsN3Jzlpkz3h uzZBtpHwRmbDZ51nPjgKxWYO2XmqsrcnQzX1OKnVCqfg5tCi6jg74vSoejqzhBsWPO09 6mL7EUqhswohL8+XHuAuyDfgm8cGHsI30UQBtMILITNfSmt0/nn0mQM/p36GUBeY1l5N sIOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ICXNUrFz; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a1709027c0200b0019e57f5a5aesi7107228pll.567.2023.03.15.22.34.03; Wed, 15 Mar 2023 22:34:16 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ICXNUrFz; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229712AbjCPFUb (ORCPT + 99 others); Thu, 16 Mar 2023 01:20:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbjCPFU2 (ORCPT ); Thu, 16 Mar 2023 01:20:28 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494ACA8C77 for ; Wed, 15 Mar 2023 22:20:16 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id f6-20020a17090ac28600b0023b9bf9eb63so438546pjt.5 for ; Wed, 15 Mar 2023 22:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678944014; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MdHaFK8bWu3beR7Jd/q7mNjpdPdNabQi6H6vrXWG2vM=; b=ICXNUrFzhY87RvUD7KoIgmJhvGt9ZXbHUe1gGgAGeE7renBeuMu/qKG05SqKClZUxm 4Us0GMSyDrKUBq+GEwxgvP3morI+C4YL5VdAbpDNPB4SylS6ARWTHlp3/dicyrFbHeDy gMdZceAqZbihAB+xcThdeFnPVAWlvfOA19HECHmHwNP/Cek51uWImoQgEKlDsAHldpul 4o0qE6Ze0xErbWDMm37ZK8F5Ufk+n4EdBzQ7I6qkH0zjo5NvgVNu3Iev5tYwu3FF9s91 AXPwZrKkbLqv5XBZJQP3EkO1ZWZmRZEtDjd4Tg3YuOKaKUJtTjomuSeGdKwCiOT9s7DY LY9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678944014; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MdHaFK8bWu3beR7Jd/q7mNjpdPdNabQi6H6vrXWG2vM=; b=QKmOUTv46zf73OnFE4vjZmPWHlzDkqDI/tDjZBYdJ8EfVIO/ejxDhamioRe+MQylwV 7dKQfvqEEd4BkaoC0ASftz9gadWGv3fKsz4X3efuxcyzeERhnfC/MmaKkYaSdV9Q0jfF e7sb97GN4IMJSpH2VplN0E/slJoyMV8amkz0aCwRPM8YpOHAvWhWXB3YcCzhi2N/vf1/ x3393HP9GuzpkVPLcuatZVobDAjUEG2/bhBeQqCdd/1w2LilspBnDkY8Jx8G66ugESSx wwAu45kUg+rDATXQkd6LJYkHUPJ9nKobRoCSX/h2v1StcIeHQLvdz6d8ewqkKWkzfNus HjTA== X-Gm-Message-State: AO0yUKXeRJr+qsAlJZ1efhjdJGZJfTbZYXrS/qaPjDF4wsqJvxQM0D1b p0C89oz0srYrny9lkmMczqo= X-Received: by 2002:a17:902:da8f:b0:1a0:d2c8:8c58 with SMTP id j15-20020a170902da8f00b001a0d2c88c58mr2017860plx.61.1678944014365; Wed, 15 Mar 2023 22:20:14 -0700 (PDT) Received: from d.home.yangfl.dn42 ([104.28.213.199]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b0019a593e45f1sm4475708plb.261.2023.03.15.22.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 22:20:13 -0700 (PDT) From: David Yang To: mmyangfl@gmail.com Cc: Wei Xu , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] ARM: hisi: Support Hi3798 SoC Date: Thu, 16 Mar 2023 13:19:35 +0800 Message-Id: <20230316051936.1775033-4-mmyangfl@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230316051936.1775033-1-mmyangfl@gmail.com> References: <20230316051936.1775033-1-mmyangfl@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760501281533598048?= X-GMAIL-MSGID: =?utf-8?q?1760501281533598048?= Hi3798 are SoC series for IPTV STB, with Cortex A9 or A7 cores. Signed-off-by: David Yang --- arch/arm/mach-hisi/Makefile | 2 +- arch/arm/mach-hisi/core.h | 6 ++ arch/arm/mach-hisi/headsmp.S | 36 ++++++++++ arch/arm/mach-hisi/hotplug.c | 120 ++++++++++++++++++++++++++++++-- arch/arm/mach-hisi/platsmp.c | 128 +++++++++++++++++++++++++++++++++++ 5 files changed, 287 insertions(+), 5 deletions(-) create mode 100644 arch/arm/mach-hisi/headsmp.S diff --git a/arch/arm/mach-hisi/Makefile b/arch/arm/mach-hisi/Makefile index 39476355e..71e2f67cd 100644 --- a/arch/arm/mach-hisi/Makefile +++ b/arch/arm/mach-hisi/Makefile @@ -7,4 +7,4 @@ CFLAGS_platmcpm.o := -march=armv7-a obj-y += hisilicon.o obj-$(CONFIG_MCPM) += platmcpm.o -obj-$(CONFIG_SMP) += platsmp.o hotplug.o +obj-$(CONFIG_SMP) += headsmp.o platsmp.o hotplug.o diff --git a/arch/arm/mach-hisi/core.h b/arch/arm/mach-hisi/core.h index 61245274f..1ada6503b 100644 --- a/arch/arm/mach-hisi/core.h +++ b/arch/arm/mach-hisi/core.h @@ -4,6 +4,9 @@ #include +extern volatile int hisi_pen_release; +extern void hisi_secondary_startup(void); + extern void hi3xxx_set_cpu_jump(int cpu, void *jump_addr); extern int hi3xxx_get_cpu_jump(int cpu); extern void secondary_startup(void); @@ -16,4 +19,7 @@ extern void hix5hd2_set_cpu(int cpu, bool enable); extern void hix5hd2_cpu_die(unsigned int cpu); extern void hip01_set_cpu(int cpu, bool enable); + +extern void hi3798_set_cpu(int cpu, bool enable); +extern void hi3798_cpu_die(unsigned int cpu); #endif diff --git a/arch/arm/mach-hisi/headsmp.S b/arch/arm/mach-hisi/headsmp.S new file mode 100644 index 000000000..67cfb584a --- /dev/null +++ b/arch/arm/mach-hisi/headsmp.S @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2003 ARM Limited + * All Rights Reserved + */ +#include +#include +#include + +/* + * Hisilicon specific entry point for secondary CPUs. This provides + * a "holding pen" into which all secondary cores are held until we're + * ready for them to initialise. + */ +ENTRY(hisi_secondary_startup) + ARM_BE8(setend be) + mrc p15, 0, r0, c0, c0, 5 + and r0, r0, #15 + adr r4, 1f + ldmia r4, {r5, r6} + sub r4, r4, r5 + add r6, r6, r4 +pen: ldr r7, [r6] + cmp r7, r0 + bne pen + + /* + * we've been released from the holding pen: secondary_stack + * should now contain the SVC stack for this core + */ + b secondary_startup + + .align +1: .long . + .long hisi_pen_release +ENDPROC(hisi_secondary_startup) diff --git a/arch/arm/mach-hisi/hotplug.c b/arch/arm/mach-hisi/hotplug.c index c51794141..7102546e7 100644 --- a/arch/arm/mach-hisi/hotplug.c +++ b/arch/arm/mach-hisi/hotplug.c @@ -55,7 +55,7 @@ #define CPU0_SRST_REQ_EN (1 << 0) #define HIX5HD2_PERI_CRG20 0x50 -#define CRG20_CPU1_RESET (1 << 17) +#define CRG20_ARM_SRST(i) (1 << ((i) + 16)) #define HIX5HD2_PERI_PMC0 0x1000 #define PMC0_CPU1_WAIT_MTCOMS_ACK (1 << 8) @@ -65,6 +65,12 @@ #define HIP01_PERI9 0x50 #define PERI9_CPU1_RESET (1 << 1) +#define HI3798_PERI_CRG18 0x48 +#define CRG18_CPU_SW_BEGIN (1 << 10) +#define HI3798_PERI_CRG20 0x50 +#define CRG20_ARM_POR_SRST(i) (1 << ((i) + 12)) +#define CRG20_CLUSTER_DBG_SRST(i) (1 << ((i) + 20)) + enum { HI3620_CTRL, ERROR_CTRL, @@ -204,7 +210,7 @@ void hix5hd2_set_cpu(int cpu, bool enable) writel_relaxed(val, ctrl_base + HIX5HD2_PERI_PMC0); /* unreset */ val = readl_relaxed(ctrl_base + HIX5HD2_PERI_CRG20); - val &= ~CRG20_CPU1_RESET; + val &= ~CRG20_ARM_SRST(cpu); writel_relaxed(val, ctrl_base + HIX5HD2_PERI_CRG20); } else { /* power down cpu1 */ @@ -212,10 +218,9 @@ void hix5hd2_set_cpu(int cpu, bool enable) val |= PMC0_CPU1_PMC_ENABLE | PMC0_CPU1_POWERDOWN; val &= ~PMC0_CPU1_WAIT_MTCOMS_ACK; writel_relaxed(val, ctrl_base + HIX5HD2_PERI_PMC0); - /* reset */ val = readl_relaxed(ctrl_base + HIX5HD2_PERI_CRG20); - val |= CRG20_CPU1_RESET; + val |= CRG20_ARM_SRST(cpu); writel_relaxed(val, ctrl_base + HIX5HD2_PERI_CRG20); } } @@ -248,6 +253,54 @@ void hip01_set_cpu(int cpu, bool enable) } } +void hi3798_set_cpu(int cpu, bool enable) +{ + u32 val; + u32 val_crg18; + + if (!ctrl_base) + if (!hix5hd2_hotplug_init()) + BUG(); + + if (enable) { + val_crg18 = readl_relaxed(ctrl_base + HI3798_PERI_CRG18); + /* select 400MHz */ + val = 0x306; + writel_relaxed(val, ctrl_base + HI3798_PERI_CRG18); + val |= CRG18_CPU_SW_BEGIN; + writel_relaxed(val, ctrl_base + HI3798_PERI_CRG18); + /* unreset arm_por_srst_req */ + val = readl_relaxed(ctrl_base + HI3798_PERI_CRG20); + val &= ~CRG20_ARM_POR_SRST(cpu); + writel_relaxed(val, ctrl_base + HI3798_PERI_CRG20); + /* unreset cluster_dbg_srst_req */ + val = readl_relaxed(ctrl_base + HI3798_PERI_CRG20); + val &= ~CRG20_CLUSTER_DBG_SRST(cpu); + writel_relaxed(val, ctrl_base + HI3798_PERI_CRG20); + /* unreset */ + val = readl_relaxed(ctrl_base + HI3798_PERI_CRG20); + val &= ~CRG20_ARM_SRST(cpu); + writel_relaxed(val, ctrl_base + HI3798_PERI_CRG20); + /* restore freq */ + val = val_crg18 & ~CRG18_CPU_SW_BEGIN; + writel_relaxed(val, ctrl_base + HI3798_PERI_CRG18); + writel_relaxed(val_crg18, ctrl_base + HI3798_PERI_CRG18); + } else { + /* reset */ + val = readl_relaxed(ctrl_base + HI3798_PERI_CRG20); + val |= CRG20_ARM_SRST(cpu); + writel_relaxed(val, ctrl_base + HI3798_PERI_CRG20); + /* reset cluster_dbg_srst_req */ + val = readl_relaxed(ctrl_base + HI3798_PERI_CRG20); + val |= CRG20_CLUSTER_DBG_SRST(cpu); + writel_relaxed(val, ctrl_base + HI3798_PERI_CRG20); + /* reset arm_por_srst_req */ + val = readl_relaxed(ctrl_base + HI3798_PERI_CRG20); + val |= CRG20_ARM_POR_SRST(cpu); + writel_relaxed(val, ctrl_base + HI3798_PERI_CRG20); + } +} + static inline void cpu_enter_lowpower(void) { unsigned int v; @@ -269,6 +322,45 @@ static inline void cpu_enter_lowpower(void) : "cc"); } +static inline void cpu_leave_lowpower(void) +{ + unsigned int v; + + asm volatile( + " mrc p15, 0, %0, c1, c0, 0\n" + " orr %0, %0, #0x04\n" + " mcr p15, 0, %0, c1, c0, 0\n" + " mrc p15, 0, %0, c1, c0, 1\n" + " orr %0, %0, #0x20\n" + " mcr p15, 0, %0, c1, c0, 1\n" + : "=&r" (v) + : + : "cc"); +} + +static inline void hisi_do_lowpower(unsigned int cpu, int *spurious) +{ + for (;;) { + wfi(); + + if (hisi_pen_release == cpu) { + /* + * OK, proper wakeup, we're done + */ + break; + } + + /* + * Getting here, means that we have come out of WFI without + * having been woken up - this shouldn't happen + * + * Just note it happening - when we're woken, we can report + * its occurrence. + */ + (*spurious)++; + } +} + #ifdef CONFIG_HOTPLUG_CPU void hi3xxx_cpu_die(unsigned int cpu) { @@ -296,4 +388,24 @@ void hix5hd2_cpu_die(unsigned int cpu) flush_cache_all(); hix5hd2_set_cpu(cpu, false); } + +void hi3798_cpu_die(unsigned int cpu) +{ + int spurious = 0; + + /* + * we're ready for shutdown now, so do it + */ + cpu_enter_lowpower(); + hisi_do_lowpower(cpu, &spurious); + + /* + * bring this CPU back into the world of cache + * coherency, and then restore interrupts + */ + cpu_leave_lowpower(); + + if (spurious) + pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); +} #endif diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c index 9ce93e0b6..da4c620a1 100644 --- a/arch/arm/mach-hisi/platsmp.c +++ b/arch/arm/mach-hisi/platsmp.c @@ -20,6 +20,48 @@ static void __iomem *ctrl_base; +/* + * hisi_pen_release controls the release of CPUs from the holding + * pen in headsmp.S, which exists because we are not always able to + * control the release of individual CPUs from the board firmware. + */ +volatile int hisi_pen_release = -1; + +/* + * Write hisi_write_pen_release in a way that is guaranteed to be visible to + * all observers, irrespective of whether they're taking part in coherency + * or not. This is necessary for the hotplug code to work reliably. + */ +static void hisi_write_pen_release(int val) +{ + hisi_pen_release = val; + smp_wmb(); + sync_cache_w(&hisi_pen_release); +} + +/* + * hisi_lock exists to avoid running the loops_per_jiffy delay loop + * calibrations on the secondary CPU while the requesting CPU is using + * the limited-bandwidth bus - which affects the calibration value. + */ +static DEFINE_RAW_SPINLOCK(hisi_lock); + +static void hisi_pen_secondary_init(unsigned int cpu) +{ + /* + * let the primary processor know we're out of the + * pen, then head off into the C entry point + */ + hisi_write_pen_release(-1); + + /* + * Synchronise with the boot thread. + */ + raw_spin_lock(&hisi_lock); + raw_spin_unlock(&hisi_lock); +} + + void hi3xxx_set_cpu_jump(int cpu, void *jump_addr) { cpu = cpu_logical_map(cpu); @@ -182,6 +224,92 @@ static const struct smp_operations hip01_smp_ops __initconst = { .smp_boot_secondary = hip01_boot_secondary, }; + +static void hi3798_smp_prepare_cpus(unsigned int max_cpus) +{ + unsigned int i; + unsigned int l2ctlr; + unsigned int ncores; + + asm ("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr)); + ncores = ((l2ctlr >> 24) & 0x3) + 1; + + pr_info("SMP: %u cores detected\n", ncores); + if (ncores > max_cpus) { + pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", + ncores, max_cpus); + ncores = max_cpus; + } + for (i = 0; i < ncores; i++) + set_cpu_possible(i, true); + + /* Put the boot address in this magic register */ + hix5hd2_set_scu_boot_addr(HIX5HD2_BOOT_ADDRESS, + __pa_symbol(hisi_secondary_startup)); +} + +static int hi3798_boot_secondary(unsigned int cpu, struct task_struct *idle) +{ + unsigned long timeout; + + /* + * Set synchronisation state between this boot processor + * and the secondary one + */ + raw_spin_lock(&hisi_lock); + + hi3798_set_cpu(cpu, true); + + /* + * This is really belt and braces; we hold unintended secondary + * CPUs in the holding pen until we're ready for them. However, + * since we haven't sent them a soft interrupt, they shouldn't + * be there. + */ + hisi_write_pen_release(cpu); + + /* + * Send the secondary CPU a soft interrupt, thereby causing + * the boot monitor to read the system wide flags register, + * and branch to the address found there. + */ + arch_send_wakeup_ipi_mask(cpumask_of(cpu)); + + timeout = jiffies + (1 * HZ); + while (time_before(jiffies, timeout)) { + smp_rmb(); + if (hisi_pen_release == -1) + break; + + udelay(10); + } + + /* + * now the secondary core is starting up let it run its + * calibrations, then wait for it to finish + */ + raw_spin_unlock(&hisi_lock); + + return hisi_pen_release != -1 ? -ENOSYS : 0; +} + +static int hi3798_cpu_kill(unsigned int cpu) +{ + hi3798_set_cpu(cpu, false); + return 1; +} + +static const struct smp_operations hi3798_smp_ops __initconst = { + .smp_prepare_cpus = hi3798_smp_prepare_cpus, + .smp_secondary_init = hisi_pen_secondary_init, + .smp_boot_secondary = hi3798_boot_secondary, +#ifdef CONFIG_HOTPLUG_CPU + .cpu_die = hi3798_cpu_die, + .cpu_kill = hi3798_cpu_kill, +#endif +}; + CPU_METHOD_OF_DECLARE(hi3xxx_smp, "hisilicon,hi3620-smp", &hi3xxx_smp_ops); CPU_METHOD_OF_DECLARE(hix5hd2_smp, "hisilicon,hix5hd2-smp", &hix5hd2_smp_ops); CPU_METHOD_OF_DECLARE(hip01_smp, "hisilicon,hip01-smp", &hip01_smp_ops); +CPU_METHOD_OF_DECLARE(hi3798_smp, "hisilicon,hi3798-smp", &hi3798_smp_ops);