From patchwork Thu Feb 11 03:02:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noam Camus X-Patchwork-Id: 581758 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 7BD4514031E for ; Thu, 11 Feb 2016 14:06:54 +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=mQ9wbcGd; 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 1aTham-00029r-GC; Thu, 11 Feb 2016 03:06:52 +0000 Received: from mail-am1on0064.outbound.protection.outlook.com ([157.56.112.64] helo=emea01-am1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aThaj-00023M-2u for linux-snps-arc@lists.infradead.org; Thu, 11 Feb 2016 03:06:50 +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=mQ9wbcGd9WbkfEas5g/5a9fLJza6hlrWmbRyeYLsqFkQQq4PC9Vvv0X9h/Uf0aePeZpXWUSbsTg3BCw+cDej3WMtDfsHhuWwr3eTctOn6lcO7h34CgN9ehkNNNv2V9Z/EG4APlybYtKObuacCTuphtQX6OAxGgKIBz0mO7HBE+4= Received: from HE1PR02CA0044.eurprd02.prod.outlook.com (2a01:111:e400:5350::12) by AM3PR02MB081.eurprd02.prod.outlook.com (2a01:111:e400:880c::13) with Microsoft SMTP Server (TLS) id 15.1.403.16; Thu, 11 Feb 2016 03:06:26 +0000 Received: from DB3FFO11FD024.protection.gbl (2a01:111:f400:7e04::144) by HE1PR02CA0044.outlook.office365.com (2a01:111:e400:5350::12) with Microsoft SMTP Server (TLS) id 15.1.409.15 via Frontend Transport; Thu, 11 Feb 2016 03:06:26 +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 DB3FFO11FD024.mail.protection.outlook.com (10.47.217.55) with Microsoft SMTP Server (TLS) id 15.1.409.7 via Frontend Transport; Thu, 11 Feb 2016 03:06:23 +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 05:06:00 +0200 From: Noam Camus To: Subject: [PATCH v4 1/3] soc: Support for EZchip SoC Date: Thu, 11 Feb 2016 05:02:19 +0200 Message-ID: <1455159741-21722-2-git-send-email-noamc@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1454775406-25277-1-git-send-email-noamc@ezchip.com> References: <1454775406-25277-1-git-send-email-noamc@ezchip.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22124.003 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; DB3FFO11FD024; 1:hk3vG+UX8ZmVmDqFMUKCR2a1YLCxXy/Xa4K/9By8584jl1XNdwhteHWsu8u8ig3S/eFr4r/U8gNaNk/CvrporgMd6/dIp/vHwOC1B9rG3pHKxBupgCdLqp5Gbc7M4gEAuNN607Zz8uo1zzIN+0jtoqcDwoIhgIGp/VWhseCidxsOkhOkFd6HbbY7JTSVZ0TZd4Voaqg4sEO43nW+LnqEtt530Dkh/winZWRtTi6ZllT6G9eXz+YQ3KaUWVhGTww2+GTt3EezfLnIQp/WW0qNw7AA6rRoCyUaez6SV04K/iRJ9w+3Yr0OoAxgAVuIzapvXsRn+DVGKye7LspDi5WG6k5sGahkLuPAlFikvzkepWnVa3ybIKJ0a3ia1kS8C0nYiprZ6vQ0AjgfUgIBpjxcv430ZcvnlBQXl4Av1081WJ+cnAOKSvnz2BBQmyWUP4NKgJyov5E8MtUuAYVv8UepX0fGnWr/WBYWG3ARsmJzN5I= X-Forefront-Antispam-Report: CIP:212.179.42.66; CTRY:IL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(586003)(33646002)(4001430100002)(2906002)(85426001)(50226001)(4326007)(1096002)(2351001)(19580395003)(189998001)(86362001)(47776003)(1220700001)(229853001)(19580405001)(48376002)(106466001)(76176999)(105606002)(6806005)(11100500001)(36756003)(49486002)(104016004)(2950100001)(5003940100001)(92566002)(87936001)(77096005)(50986999)(107886002)(5008740100001)(5001970100001)(110136002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR02MB081; H:ezex10.ezchip.com; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB081; 2:NcKf0ElGLx3Feo7V4Wfvy5yOTdqiS8TWuv8U+PBCiEeiiBlhu0SzfwSUbeM5RryS/vJS72s14nb+jw7NWbcVo0udG6ER7b82JZe8kPjs866F8EmqHKMRerbIrMuNPQ2vpyYNXxeBCZkWxUdqfeH0VA==; 3:i7D1vTD0eKQQRNSy5v2fFQUPaLiCr3jzSiNbjOSto0EuCTlnrYB8bR33Bo2Um8360c+Ve4DxwPbJGX5MTjKk1kE9LHvTExqeXUYe737oVmWCmNwPl952vEeJ2vinUPUX0UONSD77QcvGVhBqOOoygs5RfX8H9dxBZo555JNbGAyyQsYJNwZDwgsHU+G7+cLYZuZJOXPbQSkBvLO4rUg/n2/fLhVWXauqW+GLAHzMkLg=; 25:Rzs5TMUYayt7aSmujd0748YQhesuHofPMbED0kgC7r6yTdK0UVipSZci01FoibLcJlqOdF8lLAWt+8mnk1zbR9FP+Zj9tKPPQe5nxvhYrk7SLqY43hJ1Rq9lYhdo949rmBp86KFiCSf7vZ6ld8u8lOd6lOFSA9r7X7oGWEhl6yJB6QAcEo1S4lQzhqeUfqqIoC/+nAOgIfl41YDZWgG6HQOVXGe/jqHGR8quHvQAFq5P996gpjOyocZMdK/3ED7RrYeJ6Slevp/vFW6Lr2+pU0kropnukp2c15xY9AXJNVEA7kAZKOGv/v5cbdLiACX0; 20:pyhFKLQKemGpNgt05bGJHCI8cr8emCgULIFTMJXlX6uEFyDsoWEkCgeRywuG4cKC8TX4UriiTQUEw/nG0zBDRqh5wM/zpqIwoIsnjpSaTkZOocjlpVCRzGH3Zxr4VLjJl9qVWhAuvlQpJOOlmI8LI/lPs6a9J9fiGY766MjfXm8= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM3PR02MB081; X-MS-Office365-Filtering-Correlation-Id: 7865f58b-8723-4d16-9e9d-08d33290537b X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13024025)(13018025)(13023025)(8121501046)(13015025)(5005006)(13017025)(10201501046)(3002001); SRVR:AM3PR02MB081; BCL:0; PCL:0; RULEID:; SRVR:AM3PR02MB081; X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB081; 4:61BSC5Vhron/rl2QG3iteT5wz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= =?us-ascii?Q?YpQo722BxUUYXzBC5ZjvMz4WW5i5Z9klO5jGdpL6308hy8nunEJZbyGUwnBn?= =?us-ascii?Q?3vEoJnwOyeZuyFuPPF1cyeUNB04OcZbdeggH3AnXRH6BMUn9baTD8LntTllE?= =?us-ascii?Q?cnjRKghMUGyi+JyuinarApmxSg9gyZXsbYodmvrYxfL2DySg5gSaEN/HlpSB?= =?us-ascii?Q?r3688gWEA1HoEKiT/C8Vf2cg3tJ6RK84q4Vsfu25qf7Oni3exrh5pG9O5wUB?= =?us-ascii?Q?kdWmGwo97QpSB7Q4IVzEUdKmd7GBhcImHVPLAVaz/nagnxUYO4F32xCWElwc?= =?us-ascii?Q?kxXdLtGk0OIagDfWmlFansTeqxygSDeGdaQ4/1INVcrJ9/3kQhcZ/aa034hU?= =?us-ascii?Q?o7HZxXBRKND9Yikf36eU7prnP1ldTAW3D7M8ReWGZziRahLIakiae4oaor7z?= =?us-ascii?Q?rreLhJXoSewiUgccXY5uWXstMed3XLRJjTMu/8TtC/PeedorlJ2HHuSRHQ/4?= =?us-ascii?Q?2ffW4nCG7Xh1Tq1od4K7QMy2VjeQyr6a+nj7W+BzhnwZJyQNNm4kQ6kq7rOV?= =?us-ascii?Q?7qlvhWszohCkKy2RHxuItfImvS/C2STuLq7lZRVvQ2Zkp4/YNDQRUTGgITfe?= =?us-ascii?Q?zbt7jK8M1QXVFyBxei6zWZzIjGromEOqBDgyTs2E0mgGjpep19410bfeOsCh?= =?us-ascii?Q?sDfn8L1S0=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB081; 5:UprkgonVKpwWf4TNOhrX5R81yntEq7bB459wPb6TGunZJPor8F5+hS77LG/yHsOB0/YDlv/8++wK7kAIOhnIGB993jy7Qcj0uqgOgcMz9P+Z+z69XdzpDufXDdNsOcg70gahGahypT/H+DdHKrTgOw==; 24:/CGWziZ1u7XU9bx4cZGqZQ/yA+Jdu1v/her7Yi2+zg/sPbFf6c+uRtyKNMOmnCNLx49GeXxepW7JyCtzLLt9KVBhSMEcujzhtd0qpeTaRRc= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2016 03:06:23.0749 (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: AM3PR02MB081 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160210_190649_676749_04418220 X-CRM114-Status: GOOD ( 16.78 ) 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.56.112.64 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [157.56.112.64 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 */