From patchwork Tue Feb 2 13: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: 577161 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::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 DD23D14076E for ; Wed, 3 Feb 2016 00:16:33 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ezchip.onmicrosoft.com header.i=@ezchip.onmicrosoft.com header.b=QjWLmGeO; 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 1aQaoq-0000ZK-9f; Tue, 02 Feb 2016 13:16:32 +0000 Received: from mail-am1on0092.outbound.protection.outlook.com ([157.56.112.92] helo=emea01-am1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQaon-0000HT-0j for linux-snps-arc@lists.infradead.org; Tue, 02 Feb 2016 13:16:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ezchip.onmicrosoft.com; s=selector1-ezchip-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=24AwUG9MOY2/up656w9DpS08O78umiAFxyCIi+dQ65c=; b=QjWLmGeOJSBkffvzyIAisJlyHZIeJBw+Ctyndbpy7/ExiBz30g5/zG6AsInOvNTDf+DOW00wEfuHkkaGVJxGL/u2iELU19by/tEdgpnGgzpfldo6wbUyVR0sgZe080EsYDWRFPk9BcP4IwlyeRh4U4Du2FIPGf2jbja/a1Rsc3g= Received: from HE1PR02CA0065.eurprd02.prod.outlook.com (10.163.170.33) by HE1PR02MB0939.eurprd02.prod.outlook.com (10.163.172.21) with Microsoft SMTP Server (TLS) id 15.1.396.15; Tue, 2 Feb 2016 13:16:03 +0000 Received: from AM1FFO11OLC006.protection.gbl (2a01:111:f400:7e00::155) by HE1PR02CA0065.outlook.office365.com (2a01:111:e400:5350::33) with Microsoft SMTP Server (TLS) id 15.1.396.15 via Frontend Transport; Tue, 2 Feb 2016 13:16:03 +0000 Authentication-Results: spf=fail (sender IP is 212.179.42.66) smtp.mailfrom=ezchip.com; linaro.org; dkim=none (message not signed) header.d=none; linaro.org; dmarc=none action=none header.from=ezchip.com; Received-SPF: Fail (protection.outlook.com: domain of ezchip.com does not designate 212.179.42.66 as permitted sender) receiver=protection.outlook.com; client-ip=212.179.42.66; helo=ezex10.ezchip.com; Received: from ezex10.ezchip.com (212.179.42.66) by AM1FFO11OLC006.mail.protection.outlook.com (10.174.64.134) with Microsoft SMTP Server (TLS) id 15.1.409.7 via Frontend Transport; Tue, 2 Feb 2016 13:16:03 +0000 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; Tue, 2 Feb 2016 15:15:39 +0200 From: Noam Camus To: Subject: [PATCH v2 1/3] soc: Support for EZchip SoC Date: Tue, 2 Feb 2016 15:14:57 +0200 Message-ID: <1454418899-25500-2-git-send-email-noamc@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1454418899-25500-1-git-send-email-noamc@ezchip.com> References: <1454418899-25500-1-git-send-email-noamc@ezchip.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22106.007 X-TM-AS-Result: No--16.653500-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11OLC006; 1:/TkFVOeGVla8qhzWzk/GW3rZ20UvV86CrdZvihGQgVitlPdOKUhyBxy8UQs+/LpSrg1MUtXeIlvrp288bElhPTFyEYq5D7/0oW5QOb91gQmqWspoyAWac58hxP7Y4mQ0KFEAg1vsM5ANzqizx2SU7Q+C4Iw2Hokd3z4+6YMVZ7k+BDidush15VTAJ9HXCs0ZmgJW351C93NkwUHSJa73HvKxCRlOTD4XgLS1Lv+3stSAb464ReaLXMGfo7MB0SSNzBj1EayeMvps+oh71P+4cEZ9UQJdya8JNZM18iSosOy+cooOuhW7nRlcLYZJTJkQG4p3+ScBGVs9gFOwaTxsPR47QrQuKw+TGEZkzx/jxc2SxPWBinFEUs7b/7aCI2DL/ROZjAdt4hXClrCQ9hffJgLovrlhYmafZyEHz3ulzwfB+CmesF5GVN7fQRNlJxHoZ9nHCtaZfIzp2H1/fRGBit+MiQiWYXJb7nA/6Vvu7mU= X-Forefront-Antispam-Report: CIP:212.179.42.66; CTRY:IL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(107886002)(2950100001)(586003)(1220700001)(48376002)(1096002)(77096005)(4001430100002)(87936001)(4326007)(105606002)(5003940100001)(189998001)(50466002)(2906002)(92566002)(3470700001)(33646002)(76176999)(36756003)(86362001)(6806005)(5008740100001)(47776003)(110136002)(104016004)(49486002)(229853001)(2351001)(106466001)(50986999)(85426001)(11100500001)(5001970100001)(19580405001)(50226001)(19580395003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR02MB0939; H:ezex10.ezchip.com; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB0939; 2:AhlGnw12G2tx+u7LxjTP/Dwo/p5G+l0NGzc8Z42pPsdPYiX4zvt6tGd+ydTufSTBwJEzwbk7NNebVKk7fSrJ6dGISa4q+fQ4rj0CVnZVmMMFgL4AXk0pj1hkuhuVnALfsXFGfWF3zzFkX4R92n3uGA==; 3:5Pxf8bjW1O8dBf4316ZoAqAp4N1MLRvDGxoR6pmAAozJoIYHuhflmYnUmMC0zutxbOl2+quDxh4zQxEq+kKxh0iEXY1jryMfQkIvyLXrDPQA57YFEE7xIVq4JCorsRieRhryfLhKxP0FiJUstNfgXrnnYuEBOELhLspC3ok6z16oJ32wN6iQhB+wZ1UH6Q9OdviAE0nxYCWB2LvH7ff4/rcZO5jod4f9r2dCZL9SCM0=; 25:l1jfWIUlZPsJatBIiqLzFInHnHLUE2FPnTPHoAtXGvFBgV6Tt48HBjs/jLNO3RN/JfN0PQrGZWNRd1i/y3hUZeDA8qyulPtE7llnmA/Z6Bn9MoAHEtxaAqYrdGKOzGrW23ogwffBgjpprHi31SLrND/b/nuat02lKm4/Xkv2HxQ/M28Sp0EdqMgn7u7kzaHJgqeLKi1cWm1Km+EQbsOUjAQKATVBCsMQZebhE60tv24YNEUDPdyz2pbx55bGgjng; 20:YVJ2tkj0w5ZJm/n1At2Tr3yzszN/ygoEPGWKClczqK+pl7JXy1fLCfjU7Kx5BIUX9Gov+4Tuj4BKT/fa4kentjUR5zMbiSUrqNKjdMx4gWjdwwB/4Zlt8/HD7w0JsFjEqozdHT9YA08fcUTMQS0NXmmQpQHDZgaMCN/0i2hhX88= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB0939; X-MS-Office365-Filtering-Correlation-Id: ce69c2de-3564-44b0-2036-08d32bd30092 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(5005006)(13024025)(13018025)(13015025)(8121501046)(13017025)(10201501046)(3002001); SRVR:HE1PR02MB0939; BCL:0; PCL:0; RULEID:; SRVR:HE1PR02MB0939; X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB0939; 4:FC/04VOnR1uQHLqNRCng+vkNTVvKcyp4p29B2QabC4QwNdG0ZTY5sDCn5eX6ChFAqzUg/KGvjmbfDmd653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f/PO2OyRm9f?= =?us-ascii?Q?Bw3ORKUYseGGHnC6AGGjvQR1CzSKEQjOyy+VqZno60SNZ1+rlvo1lsJSzuPM?= =?us-ascii?Q?q0Ussmr8uOICvbgITaB0j+Hw8skTLeHfBOTI1B3Vy6pkgxu7FijJ3BBypFsH?= =?us-ascii?Q?Hii+ocMcoXILCIacCON+bq0LbveIRFDAqF/ZK/guH2Qsc5wQwNv8uTirSDcS?= =?us-ascii?Q?ZkC6UziRz69VwJS3hiD29TMFyeE91/eIdirrVa0/paGiihuFmGhzVC4ABXnc?= =?us-ascii?Q?3xvwoGmDpjb58H8O/HWt43v/4rB3mLfLASErmDN7IcUL+6tkwBvBIn1agzsq?= =?us-ascii?Q?X1KziY5kVUTgjPnHQUfKFIzQPGTBETfbDsIUQEIaWXBZIHGbfxAqWJbz2wjp?= =?us-ascii?Q?aZEh2RMAfKoPt7JX1mTBgTi7xC+tJ41SnUvVfUTzXbCEtShBRFEjes03JtiS?= =?us-ascii?Q?ir5jf7mQ1s8RnqwXtfFsWXvDABtUb7ZpW4OA2Nz7xopH69AZiIAcGAOUVMtX?= =?us-ascii?Q?GkIuwSjNE7kuzK54TZJBvJsRS8E3IEbPPh2PjcdcvyVx30yQeqDwaRymrwt4?= =?us-ascii?Q?r0fEg6Ylkfsf59R7osX4p2m/ohpY+3AFmExxcCdJ66S5l+Nq9pn/Mqa2sC67?= =?us-ascii?Q?OkZgNuwb++MVSdtO7doFRQBOym3txquOz8O47EJtPruVgS5dIUhjw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB0939; 5:A020vSfRKcKSXdENRZjLd/l9nu5yUxKEyV9XVuA/Bwk4b/siGxUB3LSKR/jdXmnhzhtQF6njK152w31HALyw7fcd+JEvR39pJzP5adWsXGkbMEwwE1pImlkx7IOjNLdEafWRJX00NoESc+krB2wOtA==; 24:8swiB5+nU54xoEJyVoutBom0/m3hxnNibMl7LAu+YB89lLHYnmg4I1x8UdI5icoiW8MLNW+It+OAbsehPglEul5CeT0M4aqENyuJEmcQLi4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2016 13:16:03.2674 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3; Ip=[212.179.42.66]; Helo=[ezex10.ezchip.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB0939 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160202_051629_720744_68AFF439 X-CRM114-Status: GOOD ( 16.68 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [157.56.112.92 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [157.56.112.92 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender 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 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: marc.zyngier@arm.com, daniel.lezcano@linaro.org, talz@ezchip.com, cmetcalf@ezchip.com, Noam Camus , linux-snps-arc@lists.infradead.org, giladb@ezchip.com 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 | 140 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 140 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..ffd5c04 --- /dev/null +++ b/include/soc/nps/common.h @@ -0,0 +1,140 @@ +/* + * Copyright(c) 2015 EZchip Technologies. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + */ + +#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 */ +#ifndef __arc__ +#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 */