From patchwork Mon Mar 21 14:24:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noam Camus X-Patchwork-Id: 600151 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 3qTJ5F6Kszz9s2Q for ; Tue, 22 Mar 2016 01:25:21 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b=JobBI6sg; 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 1ai0lk-000763-GR; Mon, 21 Mar 2016 14:25:20 +0000 Received: from mail-db3on0094.outbound.protection.outlook.com ([157.55.234.94] helo=emea01-db3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ai0lg-0005u5-V0 for linux-snps-arc@lists.infradead.org; Mon, 21 Mar 2016 14:25:18 +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=9PzCvXVhbMMzOLG2z+ttirtsIPg7LKv33D8uUSvfmRk=; b=JobBI6sgKjNLwy06NqO0Ye/1004P1JMiKIx7nEhYDRaWet7b6YCwOKuJqJpdhz7MwE2y5YOGZob/iTwY1iWRGXqq9vhzt9zFeTzpsJqaxOVNucTVKWydWhlQGgdPhk3bcSfvqZxG3XCi1b202gzj/4+JBqsh3VpKmc5NDkw9Ij0= Received: from AM4PR0501CA0034.eurprd05.prod.outlook.com (10.167.83.172) by DB4PR05MB0687.eurprd05.prod.outlook.com (10.161.15.154) with Microsoft SMTP Server (TLS) id 15.1.434.16; Mon, 21 Mar 2016 14:24:54 +0000 Received: from AM1FFO11FD041.protection.gbl (2a01:111:f400:7e00::102) by AM4PR0501CA0034.outlook.office365.com (2603:10a6:200:6::44) with Microsoft SMTP Server (TLS) id 15.1.443.12 via Frontend Transport; Mon, 21 Mar 2016 14:24:53 +0000 Authentication-Results: spf=pass (sender IP is 193.47.165.134) smtp.mailfrom=mellanox.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.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 AM1FFO11FD041.mail.protection.outlook.com (10.174.64.230) with Microsoft SMTP Server (TLS) id 15.1.443.6 via Frontend Transport; Mon, 21 Mar 2016 14:24:52 +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; Mon, 21 Mar 2016 16:24:51 +0200 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; Mon, 21 Mar 2016 16:24:51 +0200 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; Mon, 21 Mar 2016 16:24:50 +0200 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; Mon, 21 Mar 2016 16:24:49 +0200 From: Noam Camus To: , , Subject: [PATCH v6 1/3] soc: Support for EZchip SoC Date: Mon, 21 Mar 2016 16:24:30 +0200 Message-ID: <1458570272-23037-2-git-send-email-noamca@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1458570272-23037-1-git-send-email-noamca@mellanox.com> References: <1458570272-23037-1-git-send-email-noamca@mellanox.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22206.007 X-TM-AS-Result: No--22.091300-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)(199003)(189002)(2950100001)(92566002)(586003)(2906002)(36756003)(50226001)(1220700001)(81166005)(5003940100001)(2201001)(47776003)(87936001)(49486002)(77096005)(48376002)(50986999)(1096002)(76176999)(101416001)(50466002)(86362001)(5001770100001)(19580395003)(4001430100002)(6806005)(106466001)(107886002)(11100500001)(5008740100001)(229853001)(189998001)(33646002)(19580405001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR05MB0687; H:mtlcas13.mtl.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD041; 1:d8LMD/VQOePNPiQHcv9jXj3ykEVOHdKku4iI87neVjua25sgb0GX6NcN+WCYctRB/ON/mOSZBlijb/oQvdsKfbxSFw0iQ/Pc3/g6r5ytek528xV9y71vQDf0wMceOA4nA25+6Z488XhUZ2Mb18PXsKb3LzVtN8jMIXKXBweUtu5Lfl+tOgZuktFC7CM9mvOwEwJdt52PsRXTZomJFsYDq3iVWHpMGMCAQMTFlB7hubjM1o2ufHaSImrOWvCESnsiOWSaKpt3UAd/Wv24MtSgkBCfe02SN5ANeL4kmznMD5zNqZaZZqilaQmrq3cWZQW0pGPgO952gqBY8ChWHNIxmQNwPwVK3tJQnDdAanDKK1KMLAHK/PvNHXgy3pGZiCNj6V5S43HPfmLFApIGiPawRANFj3JYagxJPgSz0SuJoPqOsUhQdWLGAj9mIf3m4GNj9YNg3SPgAS3oDrF7XtxEkC/q3o9Kzf8UqAg9l/f1NNsIbEe6hU1HNbEM2rZnT5dw X-MS-Office365-Filtering-Correlation-Id: 796a9715-081c-4166-b47a-08d35194917a X-Microsoft-Exchange-Diagnostics: 1; DB4PR05MB0687; 2:CdS42ZBchmBVlHPtO+8G9fqEp3OHJnjD+wPWLs0iYfFkUlIi4m4c2Osyxv70L9bK6XPgLLJz+w3SXQjEegVqIklTQoni/MisguZ78JEE1l4ftqsN7O+l1B1c1WeRVjem8duhkzXz7vblNjXJa5pLDrA/zYLBzPusAYFaWijdfoatPoFzbgiCHgO6fYf0K5gG; 3:XG3AGLb4BSAFSz3SUf5NWma2BnE4ldYLKoSZidHei1uD44WTtS4hbnW3rJiq9y4yERkGw7tsEToegBV4dVfdMrGjT+a/sj1pS2i7j7y/XvbQcB0vSKv5jA5Bj3WBa/oNP1eSWUUfzpK1tXVwX/kB9IpzKoemDb7hPm3Xgpk1/6KOPfoqeQ/l2rFoN/XQmy/ZeQvDqmkEXkXw5KnBk/NATJRYLclj9SSSLqvbFWj4G03xwlGkl96AjgRyaqek12sMVwfz2GMJSJu+8qLlqM5YGA== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:DB4PR05MB0687; X-Microsoft-Exchange-Diagnostics: 1; DB4PR05MB0687; 25:XxyYu7M0Cthms9mDfWcjdG7/DD41jk+apTho/Z+Yi35gUGU55GK3BLHDial9DRN432jMLounnG7V7V5I2RJl9wyh/W/AyblNqQVGRg56IAWIkiaVNDD4pb7BMPf2qfhroNujnBE1KTx/Y3KRDRRLXZeAlWq9rkzb6tL4jGoUCw5q8E3Cm9Wu9ATEew308uTPFA5ld/Q0yIWPR6xUBh6AYkoyDg42SlpsmGElX+j54nDMxHaouoxHVTfs5ckQr/KBScxv2uW04KLU4c5qwEAA8jE6EL9vEZUsdz9utwJ3wFmTgXzqXLrKr/dA7YlV6m5fshFCQj2oMBwXns1ZsoCdRo2JlxEnGHeO5c8wMohU+rGAqGcw+k6eEPjn2rSTHLNHWH00azZLbJt2mOyWhWjFpsHQCbWKk48mswuykt0UxVWCZwd6xN9KObm6f1zM+7posWkFlgv0sYAQCLzXr5Sp9doHhMgfceKst2gMcfmP/RtPfgcf6A/r/+Zpq8lZcagV+80gMSitnFIvxKrPR1lKzoZzfh5qrfPHp2ggS55amgRR6yEI74fvjgqNDPEyy5NkPAKKhg9RI3SKTzqea0b5Ew== X-Microsoft-Exchange-Diagnostics: 1; DB4PR05MB0687; 20:fftRfPypkVN8dgfOtLNN27VIi6F1F9N2YGNSsf9uUSvoCeRpnQvvSsv6wWNjWAAQHGnHCqyeqxPNbgNk2F/94zHI4uniZHcx0tgrMaCYMrZrM8kMFuyyNWgMYuGnLtzDThGDXn1/Z66SKr6cKbBF4L8YiyaOwmeWRPA2w7D+UVmetRmUX3xa2qJChxuq8XzAOBoVBfb3DIpWgwjf93oKC5VKVDHPD+Aj6My8An0hZlLsHQQ0c9FJw0CIV+P3LBKPmCSCMzC2GbeQbrVriUJvemBOOeg0soI0UyAq4tpj83Cjjn4spMbBHuKBMnCoFhY7qt102Ywqi3N/5LF7QEv3cZN5rcGJsXvw/xNEy8BL0x9RMU30Vrqx2wAqknBgop4H/Z1zbfqQ+UctQAOrJxvnQHTtwX6HZJe5vcobUZLz7TPBueUIdossgnoVuz+Vt+aorP1fGy2qVeJ+nsnhNVA73ZKoytMHQIcFLXDxpdzztvsHrPGVdUncWHxx9yKPoqM5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(8121501046)(13023025)(13024025)(13017025)(5005006)(13015025)(10201501046)(3002001); SRVR:DB4PR05MB0687; BCL:0; PCL:0; RULEID:; SRVR:DB4PR05MB0687; X-Microsoft-Exchange-Diagnostics: 1; DB4PR05MB0687; 4:ufacBJWBFTlu+wQdCtgA8rIZcu4GEb7f8oJzYSxS0OEG6WMuj3r/JRCBu8A1oeDk+VJxHPMHz7lVv5GfNd9zjiolxyD0eVqw4cA4dJVsXrN9GoaJlQamwAbHIBjS+WCNCunoFlly87TPKM5lFTq9tX/bt/ApAXKQHUlTa8nkIPD5Z+vx6Pn6KRCpxMZtyWqNdm2WqH0XDjkITSaGNEKplO3zIMeLvg+wn8ZCVJMTB4GWLVeN99dzTOZj6uRdolh4Vy70j0XYoIQTubBN6yCCpVaQfh3cVl5jMhUDX3igzCPuNrqWVW3hedr9UDYmDkd9qBJ63xzy0ULQuQ8ojUR82DlZvRNdKaxfE89hbAZozFgfWkeWLL22yiHDpR4Oi+uEPtCGXvSl7oiQ9uiFXDMP5jk8uoo10Ho/9916V0wUfEzYgVRXqpW2WOACXFUmmjIM59liCNtixQLMdCejatBHIw== X-Forefront-PRVS: 0888B1D284 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB4PR05MB0687; 23:DkGIBr3f5yb/iKlAs4M+CzmTfflAKC9t48Awr/3My?= =?us-ascii?Q?YE5NK8/lXa8Qb7budtlWjaJGesdjtU2baMh6jaYRawgeIHubu8nJx+jvtgiL?= =?us-ascii?Q?3pvFfeI2RjeYHPakN6btFjIod9wKjkixx6F9mSfWE16nzMW76yhjgL2VZS5N?= =?us-ascii?Q?XA+vUNnO3gxz0kDiGkfHL0EEe7JYdb+ITIv+iHUp0hmaWgy4Z/hKaYAW1pbC?= =?us-ascii?Q?BK/WjmBBGp4DYTxoXV1XwwtwHw1fln3sB2opvwUsWa+hR7m2uRLqeRpepf4m?= =?us-ascii?Q?yIugbvklH7I53NzqwHGTH10U4KCRRtClNEsRZKR02gG2Up2sFxDPEBxkfKyE?= =?us-ascii?Q?IHwxO1bQ+uw+QYc8vy0ZEoDZbT3xv2b3jxGyfAvo8z3vx3ErDvLu/ZZam1H3?= =?us-ascii?Q?yMNQwnd486qjXwC4d5TDUf/AbU6YL+VVCswuL1v0Rk4OHoregC6ZBKe7XJxv?= =?us-ascii?Q?arQ7FXh3emp3JS7BNjX2zAAs1vJt+dqYf91JkdtEwV2ezbqXU79XIlVEVAMD?= =?us-ascii?Q?IcQeDtAVftUZdklxBeWlT2xOFDguXsd6CHOurw20YMTU0TCEGUu57RXPImAx?= =?us-ascii?Q?yZJotPpkm5+WnCPagi+XBSam9X38BEk763DCThi0Bp6jBTJWcZ36l555VOlg?= =?us-ascii?Q?Oq4rwj3/ZGmeenYcuIE3qw0w7ZiFtRys18Ly5WEi8tN17q/n+jxE73h9xQOG?= =?us-ascii?Q?AVNSWoFuqitMf6txwNRklATXyXQAgtHA/TLHo4mntepINW9O6k12C047pzE9?= =?us-ascii?Q?OZOzn3byNYLug0kUgoP+0QhYBWmvHzcL+isFWo0301T2cPfpWUgwswuUjZXD?= =?us-ascii?Q?ViOWzuvJrUgef6hjBpgSu7NQexeXI0iT6ViQ+dGiKqoD9dwJhYmQsSLw0m9u?= =?us-ascii?Q?TDrIvS4uDBg1QZm3d3DFquLrDIlGrm9H6cp7rDaQA4C88onhdaeObow6RBWj?= =?us-ascii?Q?TlL3v8Ev/S0TTBgoE/rzEHCcYYQSg/PWV0Jdii2mkj+3+LG/em2ziURVtEzn?= =?us-ascii?Q?MP3p0nBjTaCLtLT2HAEkSTUeB2+/vLpp0xd+z1aIwfheg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB4PR05MB0687; 5:dcK3AUNWTwQD4m8C1eVcQG1HwJtdDI62FEK3HTEpEbFitSYHYUMfoPeNgHdt4cgbsVpWlkJjil2muM5yWhVronV7ziF5jIopY+Ej9sEXykKfZEgFEpNuj4dmU3s0YMGPOVIcT/LBYcrVCcTDQdpg5g==; 24:L0CRO53HmcHhsTV0PftgoqCcsuCbiHJ6RLJf4hwjbvIY/f+Ipy+PB1WXkpOnv1BKEm/8XIBgHRn6ybqvo1RMY5eN1zLf5fQyCL6Ex+t1o0Y= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2016 14:24:52.3531 (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: DB4PR05MB0687 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160321_072517_480994_F73902B1 X-CRM114-Status: GOOD ( 15.44 ) 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.94 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [157.55.234.94 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_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 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: 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 --- 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..e959176 --- /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 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 */