From patchwork Thu Feb 11 18:40: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: 582003 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 5BBE6140BC4 for ; Fri, 12 Feb 2016 05:49:02 +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=UDd2nwgD; 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 1aTwIV-0006S3-RU; Thu, 11 Feb 2016 18:48:59 +0000 Received: from mail-db3on0099.outbound.protection.outlook.com ([157.55.234.99] helo=emea01-db3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aTwC0-0007KZ-N3 for linux-snps-arc@lists.infradead.org; Thu, 11 Feb 2016 18:42:22 +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=VoqL5Zf4nDoovwdAdfPRLNZtS2w5oVJIaf/AaE1LLCI=; b=UDd2nwgD1dh7BTW01QfjeScIT39ZsojxPkFk6UfnZRtDGAbVOFZUvkZdFDV9H4ahPf6i8fYTWSXqAWB7YPN5UPf9TndOSCIEAwvLUg0Rr7kBZScUH23E93YBuooPczW9PdG5EpD+pXdvWoHaNG6j2RL00P6bbzoK5/fHA9S6jFE= Received: from AM2PR02CA0023.eurprd02.prod.outlook.com (10.160.28.161) by DB3PR02MB156.eurprd02.prod.outlook.com (10.141.3.153) with Microsoft SMTP Server (TLS) id 15.1.403.16; Thu, 11 Feb 2016 18:41:53 +0000 Received: from DB3FFO11FD002.protection.gbl (2a01:111:f400:7e04::132) by AM2PR02CA0023.outlook.office365.com (2a01:111:e400:8400::33) with Microsoft SMTP Server (TLS) id 15.1.409.15 via Frontend Transport; Thu, 11 Feb 2016 18:41:53 +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 DB3FFO11FD002.mail.protection.outlook.com (10.47.216.91) with Microsoft SMTP Server (TLS) id 15.1.415.6 via Frontend Transport; Thu, 11 Feb 2016 18:41:52 +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; Thu, 11 Feb 2016 20:41:29 +0200 From: Noam Camus To: Subject: [PATCH v5 1/3] soc: Support for EZchip SoC Date: Thu, 11 Feb 2016 20:40:57 +0200 Message-ID: <1455216059-29632-2-git-send-email-noamc@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1455159741-21722-1-git-send-email-noamc@ezchip.com> References: <1455159741-21722-1-git-send-email-noamc@ezchip.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22126.000 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; DB3FFO11FD002; 1:M0gBTxLwougUpSLwc29j8xv3ioC/lIjiHcnx6wQ2QfNljQNxWi1c1eHWMYKPxqMvMEhzT6ROowXxwsGxGAWr0od9cV6lkuHoEqjuSQbvxVYK8oxbl0GydevE35HwuRcawrnnt8ql9Y7xlLTxR4ZmUkaJKrwbN9ECHzcYDOcPyGbm5QR0JFsAzAmnYCLa7oVsVF9H3wI4jfewdtGK6xi6x/D3n/qBRA6tBIdZ5vtC1UppD9pOZrgMQvq+UwBLCv9+P32hLSwi8AMZGflhc/OC8WDrWdZSquh+WQQNzYk5KMAzuy9tZjENbsctRSpoYYLfdh5CWwM12I6o1TV1DSnTwzSKQ9P63k+4TMZlWnoyuoHoJPUqwxgB5zkVKjUKv/qjobXQRDqCS8Qd2/MKkmEnSXvW0bAvjTRK0DOtogExnQob1AMDoM5EyNLtU1DnE6typBcDtmufBmrmBAUh1i/4qFX9FXn0xcumIBGUz/gQgZg= X-Forefront-Antispam-Report: CIP:212.179.42.66; CTRY:IL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(586003)(19580405001)(86362001)(50986999)(36756003)(85426001)(87936001)(47776003)(6806005)(50226001)(2906002)(5008740100001)(1220700001)(76176999)(4326007)(104016004)(77096005)(19580395003)(2950100001)(1096002)(11100500001)(105606002)(50466002)(4001430100002)(107886002)(48376002)(5001970100001)(92566002)(5003940100001)(189998001)(33646002)(229853001)(2351001)(106466001)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR02MB156; H:ezex10.ezchip.com; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3PR02MB156; 2:sIEPQYl6x+cTRt8oJACe7teSAx6Y5EtbEsvjEYvuUmLQN1CNYfcyhDpDrKAnTl9j9J9ioVDdJkeu8zZefp5P55TbVdCEPBLLf6fJefcXOOHSA4pvkG+oPayoU8RliRPI8lwoW37fwAz3LAm83ZgXnw==; 3:/o5vdKHjndm+g1bZkdVtAnvvUiOkNcXwsEzfjP14Fpb1e5lJ/JAK/t/SP4sYtW3riXliKqtRnmneYADFcizuHUU9AqhOpSW0IXfgT9zOTml83wcrfPO7bXxYFMOgUG2/uJR2c8pzdH2qTIaqYzIc7hQ84K+YcZ1D/FbkRS8e+PqO7gbIbCoNHXMwqvuvuE6gY2HGkVCa2EJmCNYBdteE5/v1Dh/oHfS11v+Q3pEknTw=; 25:ptxJDPAw1y5N4gcI+YDTly79SkTvcYgRTf2A1wEd5hnnqbMT1NQW3uaqe9jkI79y3PEqcG3SYtgv8anklfMvPmFfbJpsnbLAcvQCxJ+c+ydd2qlf5Tp4XtZA2AVqoZ6SODvJ1umW+kBLbgRf0XxSGiWxHwuUQYL+4Ro+1QpqyDLe1OXuXdKllaw4NCb0sLN64+htstMWqgwA95kKBGjbO/OvQJjaq3r+bv06bH+OJLwcieFooB1YfzAgJdwmpOYdstza9vi3PEXUaKv5Xz5JPu/jPk53YypO4O1rk5NJz/1Je9nxi6wz9L1sFBHkK09o; 20:bwiiTI5yNPgIWJOJYzTDYp8aOfQNOo9QumpoTyBqZUoYjz1/gMN0jW3AQ/T9hUqqU2lp40wlwNS/XUakfz5aAg09PO3OXdLvWwPuyJYYyNQwFWhxe0qZaL2bHfcfjIh0QC0fKZWf+VINew4IFE20TM8oORkcWFRpj5D+fGIyCA0= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB3PR02MB156; X-MS-Office365-Filtering-Correlation-Id: 20f22da0-dc91-4cd8-f8b3-08d3331302a4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13024025)(8121501046)(13015025)(13018025)(13017025)(5005006)(13023025)(10201501046)(3002001); SRVR:DB3PR02MB156; BCL:0; PCL:0; RULEID:; SRVR:DB3PR02MB156; X-Microsoft-Exchange-Diagnostics: 1; DB3PR02MB156; 4:G12iSdd6HG53oUvw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u6f2fe5EL4jde?= =?us-ascii?Q?obTKOEz9qUY3blXut1agv9Pe3x74lKPt3Gr4SksEO65bypgPS5l3Kw+V6qDt?= =?us-ascii?Q?RH7Y0zWFjw3KJ1+NbG2jXC8ilYuRXwlqDbO4/gv9dfzgI6FX7IOc7xUlkWj4?= =?us-ascii?Q?bsnr3xjXBlFPacSOyf3dLmKV0uO5/j+JuKdJs5TxIH5+dY6hQImySuKsr75L?= =?us-ascii?Q?wAlPJVnsksgITpwTgtGS4RkO7VlAMpa7ZewOA9AMQP9G6qrzf1c0M7f6gcaJ?= =?us-ascii?Q?HDmhaDFwrfONKp6O4s22mnww/dICPveaqFLo+WABqllhinKs6Id4pdKgcvOL?= =?us-ascii?Q?eMp9Vtm76n68R9ExtgZRcy8znM1wwZ3MwT2i9U2kucpPfzbNcx32S+MnqSWS?= =?us-ascii?Q?u/KdU11cs1C5R7lJc3LzpZti0qzwn9XZsiRSLD50VCHEsYQ+b4NPIet9vums?= =?us-ascii?Q?HqHzNdj+MGIKnLmrFaiVEIaz4tChMrremBeDj+RJZDIoqX3/nTteoZ0Gg/3Y?= =?us-ascii?Q?+h/lttdGBV3Ze9DuTNoDJsbBVWCOGkRG7bExM9CdGtBC+1GNySA9b2PMooQf?= =?us-ascii?Q?r1+GqZslzOasp8vJLkZTZwVeqLeTknELInIW/lcZ5PBik5yxlF91RVDxNHKL?= =?us-ascii?Q?5u0AVI8QY20M3gdW8nqkfBS2jGJJe/F0m26jXesaRP23A/WA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB3PR02MB156; 5:oUI9so/YUHS1inSkvHONsWaz+DYJo41qfLIJehGjn1kMzNRTwCdj7f0EizFydUeGKKLOkTiWJ9njokYHXCvfsBXgjArA/C2/4Q7/fFKUHnym4S6BT2OjsYvgpG9YG9iWtt0k6ynLZfGMQzo0St8Btw==; 24:6fZasD80y5HSX2r18zyXEW6dnECuVLfJNjEu8WQIwrTFRiPhbQO6yNnSdG8KkS4jIKcvwVIE11SdtjNyfO0nNFqAfw53i+41N+iZDzMSjoI= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2016 18:41:52.6453 (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: DB3PR02MB156 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160211_104217_721834_AD85143A X-CRM114-Status: GOOD ( 16.41 ) 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_MSPIKE_H2 RBL: Average reputation (+2) [157.55.234.99 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [157.55.234.99 listed in list.dnswl.org] -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 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 | 150 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 150 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..35ebb00 --- /dev/null +++ b/include/soc/nps/common.h @@ -0,0 +1,150 @@ +/* + * 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 */ +#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 */