From patchwork Sun Apr 3 18:14:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noam Camus X-Patchwork-Id: 605622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qdNbh6dDHz9sC4 for ; Mon, 4 Apr 2016 04:16:16 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b=IBtoeIjn; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ammZL-0000M4-In; Sun, 03 Apr 2016 18:16:15 +0000 Received: from mail-db3on0072.outbound.protection.outlook.com ([157.55.234.72] helo=emea01-db3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ammZI-0000IG-8i for linux-snps-arc@lists.infradead.org; Sun, 03 Apr 2016 18:16:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ZQDRTO9DEXfshpPgyPPSwjdp+DJ+xiX9sYNQyLv8eKc=; b=IBtoeIjnExOJmM1qd3761fQz/EeXOWDtH69Mk7XYIfQYlqSTAQQc9gnIrzL0+cSW8MTKuwedzNkbd3IhhdM/G/j5McYyJycNaMz9fHrv6Nuel4z7Us4eh9pRuTc5Stsb9sLBrkpOkzQM4UVZyGGX7OIg+AkVAllkJRSctrnjiR0= Received: from DBXPR05CA0029.eurprd05.prod.outlook.com (10.255.178.29) by VI1PR05MB1405.eurprd05.prod.outlook.com (10.162.123.11) with Microsoft SMTP Server (TLS) id 15.1.447.15; Sun, 3 Apr 2016 18:15:49 +0000 Received: from DB3FFO11FD049.protection.gbl (2a01:111:f400:7e04::189) by DBXPR05CA0029.outlook.office365.com (2a01:111:e400:9434::29) with Microsoft SMTP Server (TLS) id 15.1.447.15 via Frontend Transport; Sun, 3 Apr 2016 18:15:48 +0000 Authentication-Results: spf=pass (sender IP is 193.47.165.134) smtp.mailfrom=mellanox.com; lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=pass action=none header.from=mellanox.com; Received-SPF: Pass (protection.outlook.com: domain of mellanox.com designates 193.47.165.134 as permitted sender) receiver=protection.outlook.com; client-ip=193.47.165.134; helo=mtlcas13.mtl.com; Received: from mtlcas13.mtl.com (193.47.165.134) by DB3FFO11FD049.mail.protection.outlook.com (10.47.217.80) with Microsoft SMTP Server (TLS) id 15.1.453.6 via Frontend Transport; Sun, 3 Apr 2016 18:15:47 +0000 Received: from MTLCAS13.mtl.com (10.0.8.78) by mtlcas13.mtl.com (10.0.8.78) with Microsoft SMTP Server (TLS) id 15.0.775.38; Sun, 3 Apr 2016 21:15:46 +0300 Received: from MTLCAS01.mtl.com (10.0.8.71) by MTLCAS13.mtl.com (10.0.8.78) with Microsoft SMTP Server (TLS) id 15.0.775.38 via Frontend Transport; Sun, 3 Apr 2016 21:15:46 +0300 Received: from ezex10.ezchip.com (10.0.13.1) by MTLCAS01.MTL.COM (10.0.8.71) with Microsoft SMTP Server (TLS) id 14.3.123.3; Sun, 3 Apr 2016 21:15:45 +0300 Received: from localhost.localdomain (10.1.3.132) by ezex10.ezchip.com (10.1.1.4) with Microsoft SMTP Server (TLS) id 14.3.224.2; Sun, 3 Apr 2016 21:15:44 +0300 From: Noam Camus To: , , Subject: [PATCH v8 1/3] soc: Support for EZchip SoC Date: Sun, 3 Apr 2016 21:14:57 +0300 Message-ID: <1459707299-31564-2-git-send-email-noamca@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1459707299-31564-1-git-send-email-noamca@mellanox.com> References: <1459707299-31564-1-git-send-email-noamca@mellanox.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22238.001 X-TM-AS-Result: No--25.736200-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Received-SPF: None (MTLCAS01.mtl.com: noamca@mellanox.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:193.47.165.134; IPV:NLI; CTRY:IL; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(586003)(49486002)(92566002)(1220700001)(11100500001)(4326007)(189998001)(76176999)(33646002)(81166005)(19580395003)(15975445007)(47776003)(2950100001)(2201001)(101416001)(50226001)(2906002)(19580405001)(86362001)(106466001)(229853001)(6806005)(5008740100001)(36756003)(50466002)(5003940100001)(87936001)(1096002)(48376002)(5001770100001)(50986999)(77096005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB1405; H:mtlcas13.mtl.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD049; 1:vz07Ffj3kMHbNo7UZy1NHfVejQPmlws8mnR7A/m5oALDenssfIc0UMKR1VJCYKF90Q7AG8ncHmPsRnpFPJz85Mt1ZDu0y4osJwqa39uf8l8kHWxdAN0lH8ysGEtgseCVu3YX2m1UC9mzIsibLDIY8SpHhrim8P3vqIAGQuhjKWhjpvU+4NbdptO0lZULfOEKu3c/qsa2I8aFvGuHs8S/29ckc6ElFHhE3v38NmzDQUe0GjjJHaEdundiPkk9fdDlFR5TRTvn7nEw7WhPy14BIJsgayzUG1tYD4ob8VX1bikBMu4DNCWu0p7m7O7csvcLLJeXTal3EhHq465VgpIY+lyoQzcM7GUuTTh6ptHN34QpEFNheyLaOqg6+VQRKGWgdDXn2636n00FHj0qxfpVQf1RpI9jftXjq2OpVvPzKLx/1Ih6aNhLmcCu3MTS6IukBVMGtN0Gdp6UTfeFNZgyBPa/RSHQyplJLRlszzerOXd5Kw+b8+3Qvt5hISegwmW96tbG435wgPDed1y8fwM0Xw== X-MS-Office365-Filtering-Correlation-Id: d702929e-648a-4e1c-e053-08d35bebfb4a X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB1405; 2:EdJf2+XS81yzk9CVJCxepKVBLiKbEkIB5vLJ/TCEBzgR9JzU2HLHUfVELQkRPjKK+dee3gdXVIFmCFyA+BjqzqDik9ERBuPwMLmRjPLMwvUWWEl1iE7r1skbN9HP2eot3EwaBla6Uu+PdkmkPNI/gO3ct7peFYwqTZ4LmiV2tKuSO89MUi9TA38YqckqyzVU; 3:ltbdA5cQ351c+mM5MtgbVIdQyyfYjzJN4EuAdfRZXBzVLHqftb2DByg2Cf39DwNs4EqiDGqpL2gLqtkln1t0kSfSMh+7TNVaLZUiUOSpRiRK6xe2Y+Wvq5KkfOhEgRqtWrn/1l5oxvUizn0ADs1iea6QJXNCgmTUijQN9wualJGTswn5DGfI9QIKnPcRdO3ioxgKES0xPqINCeZxz9N5mNRhCrNQuswajEgJBBKZiS5iFXRuyv25/Av65FmcNaz4Do86ZWbqWLjdkuYyoRvfsw== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:VI1PR05MB1405; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB1405; 25:4/uLGkOuv4btkS09J94gqEvPVnFtM6DUPodyj+EkQ7Ip3cJR7SKOKDVok/Lef6eLNP1PjQ0bkdjbDDsIBMZHzq9lFuHwF4Yh0Z0V/90rhJYqET4TuohzH39Yg+b5Qm76p4EmXbRbnwwk+W3SL5YgGmKGrBbjfxgCBJbwxLTl0CLnq8DGJ2aTtwhhfuh95dLoRtawYnbW4oYl7T10qRSj4Hv3mFvzk+k/4HKlQE5eRevIiCqfFFeNbAidcuH6rO6mJC/GTvDVXqOCN5M3r3BT0nECEwQ7yIpo6msrFzmPIHR2RWTg7AGuuwZ1ydXOgYen176NszmW6nUQtlGIC1Sa8OXJumiCtuHLJ94bgoxcMjB1NXHizT33xB7tzEqdKQsE2wEVeU/Ek3Sl9Z0NJ2QkoTCWVD02Hv7gjXB4wtm/0hUwSLtSod1lXjnqSR2f8PvrpllmNjwQ2m0c5afJaWg4qgIHgMwyCXIVoFPWu65WBNz5QcLti10BMy2j+6k9WRP981No5jT+66FFgvvN0CTn1v6yd0O2XJHxZHoqHOyXBWjUOWdIu4XNX+SAYvf0MZBKxac2DtHQch6BEcytKaQjl0KSLMqPikS0TXFdV5Q4FOEDhUxlYUzJyR5iBnW1iCm9I39gbzALk15LjPzGW2PWlaX5kzbVRCLLHRD8NZDxs+5NEigg8herFNrfbIo9VY02j1GcQTfzzjyYZL0prLMFbKo1wpsXKEP9JQfDcr6LSJY= X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB1405; 20:ToKnvR9ZPhiILMMCzelUTfXs67IbCTmq03MD8rEb9BYNDsUr7I83FvWYqpyee1zPcmJtTDP0RwMg2JBmT9vRaeItMeQyNDRZnWpR24cA+T7KuA0Ct+LapylhnIrPc1pIweWXQRWjo1Zx9OLKrSEvAqLo+c2iQjWeKhdpTW0YoQzVuddCXPtYK4Q6o7kbTanOLNfKcjt5doLIFL7FpJTd2WaUEehLEbUisYIKGv97iL36eerOPjJtBbNDCiRA2IgOGwH6c0f2TsU8PELjxgWsBctAO6dk9Xrp1Lf30gafoXuvOKChplDgwHQso65oYsz0dboezHww0/oMlStY20XRtLxaYlouG6TwsG/ynTZx1W2ZAvW0icTAoJIrElD8o+WKKaYhWQtm12BLApxJY83f+Z283FGAwtLusZIOtOnfzG3wrmUlYhM9rzMyOWg4QrZR08mKu9Elmqi2tvLdQlnQx4Oldn14MqCnTKZ/eZVW5BUl+mOjCZQh5MbTniXt+YWJ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(13017025)(13024025)(13023025)(13015025)(8121501046)(13018025)(10201501046)(3002001); SRVR:VI1PR05MB1405; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB1405; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB1405; 4:xRZ2GDAURCOEhv1MJEv4JnDjf70J1zd3lXtSCsZ7GlMjXxNMuJt9G3JwY6Uq4i5yxVLsqsgKQAqGW90AFYM3fXhDJ7MzGzvXGiLIOpoH9GScRdJumCDRKkHklY9JGoXgH2geVuzQWv73G+xxANe81TI2vSfQ7MXzEO95k0FxoTIQHZRtVwWCsUnj7Ow6LG9mFFJ260QBsKIjGx8PH96rqpjdLaC9i7q6P6sBRLYzeflAqdSnz/uITwEuoZPlPyA8nyh/lXcxp0A0Pwe0oKJpF14OPcmL0KkJacAVF0dGOiewd4Sa3jm/7zn54oUTpfgdXZ4FPDFJRF/cp+Zik2w/n+u6PDpEte7gXW+BSWZxfbpXCI4N/Qc/6kVNNawgxMtVkqfX4GoUn9uUOZA1lRGC6aPlXFl2V269q5QjLuMXe7RwbqfNxxRYTsD5UruxVZc0cl8omT38fdLI6IG+ncwazg== X-Forefront-PRVS: 09011458FC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB1405; 23:AfyA+RArnvBdMIRzFL/PXIxZTdjabmk2uCsDLhc6B?= =?us-ascii?Q?LCO/hqB7qbilzr+9Xh3VrINy5Krp4GfzxVJmi1lhGsMinqsnz8AtwMjJr73x?= =?us-ascii?Q?0JGqjF5vARg1vLpFYzAHcSQudWpZxKHypYTqF7ZeKCxh1e/m2m3yfh8XWdle?= =?us-ascii?Q?3OwUtdOebvOvLYW3w8+hFVBS3bSupfD87leF6n+9c2xQIZvr8OyimvFRC8gH?= =?us-ascii?Q?N3gbicfHPu1z/XDt7AX4bf2w5EtzzTZJipsPccv9VZNGM/gg7lgBtJMsvJb6?= =?us-ascii?Q?6vH+Ehpp9AaoeAuSmedgwUU8hCLoG//rqYze2jL2oInHYk2U2nc//zvcjmRt?= =?us-ascii?Q?VsFaReWggq/tCzkgKl9xdJ8K10p8LVrlWPWIEAUwb7QLeCthsus34VFRlNig?= =?us-ascii?Q?3tAI9ADC37dBPi1qD1+H+7Zcx6w0eMba1xdMpqsMAIzgNs8PDA0Y0ngZkbbW?= =?us-ascii?Q?XOS5xdlpgW6wZHBWMih5oMBzdveXsp1rLPHYZjpNcIcVDh5ruIAazoX3cg53?= =?us-ascii?Q?WVZO7iTfHTrO1cZLt0K9ADAREXQzBN+J5p9ErDrVoYR3DwOv6U0lvhbzizT6?= =?us-ascii?Q?i6enj2UxaAFUOszw5Pf1Uc5nre5zzYooLt2MdI4yfFUdjwnaDmF0z4JkArXW?= =?us-ascii?Q?/8jLl1QSQotEa9VzNLyteY7w5SNXZtjnV4449T0+6dOiBwAc+GOhX0Llka0H?= =?us-ascii?Q?4fvR4OKTaNuPYjYZ9Ige8OYvGnFQz5yRpE90TpnX6IMkESeh5eHPBSWPC9JX?= =?us-ascii?Q?ZiUab79tnAmEZaG5jPWwUSWebpyAD60zs3JoatDtpgKoTfaxNVx+kN0g4sJN?= =?us-ascii?Q?31x6eqRChmcpqOi6vjoqb0H83FVpj5eNzAYP9t35jtif0K001Z06ZW+0N05B?= =?us-ascii?Q?6xTWcSQeiiBpb+IdAQD8/4Y41Ig0/FFHnwd7CQWSydoENeWIxfoKQGiWttEZ?= =?us-ascii?Q?2RoRAQP3DUr3Am2RioobPvpWsfFfC1pJI9noYZ08jvCREARk2g3ayrPIu+5d?= =?us-ascii?Q?mNFNfLDx7XxQu8beEF/smUU?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB1405; 5:FkPhcTOLMv23JHVAYsYd2Sh1c+r0g57G/yf/9phVnvx6UXYK3H/3CTvmwfgEC8w0uDjnx+mzKB5DgFYObzohz3WOwpXI8D0cu1T0FnhSKhi/k9rOj2reYN6Y3dxVkxLk6n5INsmhMLdJgh5LVvyouA==; 24:r5F0sESYs+OXk81n7X538Wqn2kqAozQxUKDmle7+wLW27Grms2GlXg7Tg0mcYfu68pT4676X1UGYaYzza8HXMp36DkHUD1UECKqyFbWwlKg= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2016 18:15:47.8618 (UTC) X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a652971c-7d2e-4d9b-a6a4-d149256f461b; Ip=[193.47.165.134]; Helo=[mtlcas13.mtl.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB1405 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160403_111612_813884_94486E28 X-CRM114-Status: GOOD ( 19.94 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [157.55.234.72 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [157.55.234.72 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vineet Gupta , linux-snps-arc@lists.infradead.org, Noam Camus , linux-kernel@vger.kernel.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Noam Camus This header file is for NPS400 SoC. It includes macros for accessing memory mapped registers. These are functional registers that core can use to configure SoC. Signed-off-by: Noam Camus Cc: Daniel Lezcano Cc: Vineet Gupta --- v8: Change macro name from IPI_IRQ to NPS_IPI_IRQ. This was needed due to build warning when building for parsic. v7: Rebased on latest HEAD (4.6-rc1) v6: Files headers changed to start with: Copyright (c) 2016, Mellanox Technologies ... This is due to the acquisition of EZchip made by Mellanox. One can still find "EZchip" used in tree, and this is ok. This patch set is a requierement before I can insert new platform to ARC, one that supports the NPS400 SoC. v5: Clocksource, irqchip - Fix gracefull return. replace call to panic() with pr_err() and proper return value. v4: clocksource -- Apply all Daniel comments (Thanks) Handle gracefull return and also using clocksoure mmio driver at init v3: irqchip - Fix ARM build failure by adding missing include of linux/irq.h clocksource -- Avoid 64bit arch's to build driver by adding new dependency !PHYS_ADDR_T_64BIT This is since we use explicit io access of 32 bit. So for test coverage we allow not only build for ARC, but restrict it to 32 bit arch's. irqchip - Apply all Thomas comments (Thank you) v2: Add header file include/soc/nps/common.h. Now to build we do not depend on ARC subtree. General summay: Both drivers are now apart of previous basic patch set of new platform for ARC. The rest is now can be seen at ARC srctree: https://git.kernel.org/cgit/linux/kernel/git/vgupta/arc.git/ Now ARC is supporting DT for clockevents and the interrupt controller ARC uses irq domain handling. Compare to last version now clocksource driver do not include clockevent registration since NPS400 can use ARC generic driver. Compare to last version now irqchip driver sets domain as default since it is the root domain. Also mapping of IPI is done in this driver. Last thing is that drivers can be build cleanly for i386 (still runs only for ARC) Note: in order to build we need to merge drivers into srctree which includes new header: soc/nps/common.h This header is part of patch set applied to ARC srctree. Regards, Noam Camus --- include/soc/nps/common.h | 166 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 166 insertions(+), 0 deletions(-) create mode 100644 include/soc/nps/common.h diff --git a/include/soc/nps/common.h b/include/soc/nps/common.h new file mode 100644 index 0000000..9b1d43d --- /dev/null +++ b/include/soc/nps/common.h @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2016, Mellanox Technologies. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SOC_NPS_COMMON_H +#define SOC_NPS_COMMON_H + +#ifdef CONFIG_SMP +#define NPS_IPI_IRQ 5 +#endif + +#define NPS_HOST_REG_BASE 0xF6000000 + +#define NPS_MSU_BLKID 0x018 + +#define CTOP_INST_RSPI_GIC_0_R12 0x3C56117E +#define CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST 0x5B60 +#define CTOP_INST_MOV2B_FLIP_R3_B1_B2_LIMM 0x00010422 + +#ifndef __ASSEMBLY__ + +/* In order to increase compilation test coverage */ +#ifdef CONFIG_ARC +static inline void nps_ack_gic(void) +{ + __asm__ __volatile__ ( + " .word %0\n" + : + : "i"(CTOP_INST_RSPI_GIC_0_R12) + : "memory"); +} +#else +static inline void nps_ack_gic(void) { } +#define write_aux_reg(r, v) +#define read_aux_reg(r) 0 +#endif + +/* CPU global ID */ +struct global_id { + union { + struct { +#ifdef CONFIG_EZNPS_MTM_EXT + u32 __reserved:20, cluster:4, core:4, thread:4; +#else + u32 __reserved:24, cluster:4, core:4; +#endif + }; + u32 value; + }; +}; + +/* + * Convert logical to physical CPU IDs + * + * The conversion swap bits 1 and 2 of cluster id (out of 4 bits) + * Now quad of logical clusters id's are adjacent physically, + * and not like the id's physically came with each cluster. + * Below table is 4x4 mesh of core clusters as it layout on chip. + * Cluster ids are in format: logical (physical) + * + * ----------------- ------------------ + * 3 | 5 (3) 7 (7) | | 13 (11) 15 (15)| + * + * 2 | 4 (2) 6 (6) | | 12 (10) 14 (14)| + * ----------------- ------------------ + * 1 | 1 (1) 3 (5) | | 9 (9) 11 (13)| + * + * 0 | 0 (0) 2 (4) | | 8 (8) 10 (12)| + * ----------------- ------------------ + * 0 1 2 3 + */ +static inline int nps_cluster_logic_to_phys(int cluster) +{ +#ifdef __arc__ + __asm__ __volatile__( + " mov r3,%0\n" + " .short %1\n" + " .word %2\n" + " mov %0,r3\n" + : "+r"(cluster) + : "i"(CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST), + "i"(CTOP_INST_MOV2B_FLIP_R3_B1_B2_LIMM) + : "r3"); +#endif + + return cluster; +} + +#define NPS_CPU_TO_CLUSTER_NUM(cpu) \ + ({ struct global_id gid; gid.value = cpu; \ + nps_cluster_logic_to_phys(gid.cluster); }) + +struct nps_host_reg_address { + union { + struct { + u32 base:8, cl_x:4, cl_y:4, + blkid:6, reg:8, __reserved:2; + }; + u32 value; + }; +}; + +struct nps_host_reg_address_non_cl { + union { + struct { + u32 base:7, blkid:11, reg:12, __reserved:2; + }; + u32 value; + }; +}; + +static inline void *nps_host_reg_non_cl(u32 blkid, u32 reg) +{ + struct nps_host_reg_address_non_cl reg_address; + + reg_address.value = NPS_HOST_REG_BASE; + reg_address.blkid = blkid; + reg_address.reg = reg; + + return (void *)reg_address.value; +} + +static inline void *nps_host_reg(u32 cpu, u32 blkid, u32 reg) +{ + struct nps_host_reg_address reg_address; + u32 cl = NPS_CPU_TO_CLUSTER_NUM(cpu); + + reg_address.value = NPS_HOST_REG_BASE; + reg_address.cl_x = (cl >> 2) & 0x3; + reg_address.cl_y = cl & 0x3; + reg_address.blkid = blkid; + reg_address.reg = reg; + + return (void *)reg_address.value; +} +#endif /* __ASSEMBLY__ */ + +#endif /* SOC_NPS_COMMON_H */