From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752630AbcBFQUE (ORCPT ); Sat, 6 Feb 2016 11:20:04 -0500 Received: from mail-am1on0095.outbound.protection.outlook.com ([157.56.112.95]:35458 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751686AbcBFQTs (ORCPT ); Sat, 6 Feb 2016 11:19:48 -0500 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; From: Noam Camus To: CC: , , , , , , Noam Camus Subject: [PATCH v3 1/3] soc: Support for EZchip SoC Date: Sat, 6 Feb 2016 18:16:44 +0200 Message-ID: <1454775406-25277-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 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22116.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;AM1FFO11FD047;1:2o0HHSMWsB5K2p03XUFS+F4rwKSCx0NpN9PlMmMxTEq+Y+qCEdb/qq3TMv+xSSDaRRNRN3HhtDleHpv/i0uUtB+keDU+ryjeJfcYFjmx68sR2gchT9qTBRktn98fhVpYK1kqABgggnFofnc8sWk56eAJK/28obnH6gboEm40TNKfy8qoqDXQ80T5YoSy2WqUXXsE6AlnqLI2QQcTUWXgwrVWlP7wdXMGBjDJTNWAHmCGBR4HFXLA3VWl6jHeEr1vq061X82hLwuc+H+Sf4wsz1lsXXJ7n8YU9IFYgVjUtwJ+H+Yx/0O8ZB9a2L40ECnbGhYeqzRgR6CU/s1A2AgVUKlotRzztA0n/DrMdv35KpcEr3pIn20sRzVquJzXUmz7CJO/fhlU2BjuypZUkJiv8zFlNqBaZXhhB0YqZJD4+3yhH8FbM2TzWgU5puNoHpF1uYuXq6Lfsqn+C7zvFqu5rH7lw2jg8ljqKyzq2iRl1LI= X-Forefront-Antispam-Report: CIP:212.179.42.66;CTRY:IL;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(1109001)(339900001)(189002)(199003)(50226001)(50986999)(76176999)(4326007)(19580395003)(107886002)(19580405001)(36756003)(85426001)(11100500001)(1220700001)(33646002)(110136002)(87936001)(86362001)(2950100001)(2351001)(5001970100001)(105606002)(50466002)(77096005)(47776003)(5003940100001)(49486002)(586003)(104016004)(92566002)(1096002)(48376002)(5008740100001)(6806005)(189998001)(4001430100002)(229853001)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:AMSPR02MB152;H:ezex10.ezchip.com;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;AMSPR02MB152;2:m+OYnzeUEN26bkQBA5loppEm7xAWQRKdViWjyYpN5qFUCqNMt9PqTyiL/NObuNZvuhc6g7DuTKzMO4J92aS3q1JP4IoEt5o3Ec4cTZNV+A1KwbFQi9IdEMUvcJm8I+2NlhgJeloT1PKb4qZ2fe92dA==;3:j7hFrH/il5LZ8Sk/i9K/MkU3bJbZcpS0cnXIx+Fpue2qnVceo0jkXu4DaSP07Wf7RzkG434W/MB0pHuHdm0dEHWfQ8sBiAeFufRSW4L4TXbBmmYTuxa3lmAlqADDCJXn12BlynMuXi08B9hZApKQLJ6sgvJLqUnZy9M2W0kYPSaLGbA3N3JQGth+gSWYotQOMLtWAOthaSoKPcKtUzk2CF5sDqlCLYfZxvunI99FUAk=;25:56q20cbg5JmSpNbDVqLNEQLHO28NH4rHIBuE2Rc7R/unkXchV/IzgcPcOeRvmH3w3OS409zUWE8Ch/tmWwAdznNTvrU9tSWhpH2FAl/bO2JxpmKQrkChQls+j55UUc6dC/qOoC5p4oXvhrmbAYkVBB2STK9Q/OHZCAm0uogP8hifE5LvRGOUI2FarmKMBZMTJCLt1p5eeQ253T8unxVO/iytXVd9WDN1dbSz7VMMwyZwuOb8Yh5qFsYPvPaO0Rs+0G2rOHcf9b9PJEK1C5qQWKmeR6ViR502qJtWZvR0jKqUsulHXv27+pC38rp9PXhX;20:t4tP5+Iw25RRlAP/y4+Vj3X3sA9tXouh1cO0Z3aiM0vrqnZdzhaS2DuwlPW034Y2s1ACGk2ineJurSnUXyuM1OcCV6JhdiDTxHe5a+OlwzYmNOK4WqbQngMtNiYn6SQXsLeu/aK70lJmhY42sA0iplgvMbAUegYWpgjkYIPk00o= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AMSPR02MB152; X-MS-Office365-Filtering-Correlation-Id: 3f2897a5-a985-4211-145d-08d32f1153d5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13024025)(13015025)(13018025)(13017025)(8121501046)(13023025)(5005006)(3002001)(10201501046);SRVR:AMSPR02MB152;BCL:0;PCL:0;RULEID:;SRVR:AMSPR02MB152; X-Microsoft-Exchange-Diagnostics: 1;AMSPR02MB152;4:6EE7dNnmhx4u5Vnzzlaaw5EHWSsbs1JM/i9TAJCrXqKVS+nNrHm8PCjSTdLTKWnHAW/j7S6DrZaXH6fcdkbFS1KRdGndmoPspLICp0Jnvg/kyMGyGUawJzJpHaKyDKL9b1kjdqd0xsXdPzuYse06G3+QMCu+7qXgS45/7mbo3BvbBH0u2kz/uT7h75eAbvIeOUhvR2W1kx7k9P5pUWdOitcehz6/YPn31WCj8YkoJ9CiIn+2evZMafQ35eX3gofd/djtMuc9MYufpFk6nj+Gv65YEp97aR8LiUyTKY0V2aS6beI7iUbG0nf00n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EwE7Q?= =?us-ascii?Q?zGR76ICJdANm6cSMzHVWx0Uo3J3XQZJd3QF3xMuSiqPfOqUtBq60jkCy8cQU?= =?us-ascii?Q?ZYYDaKI0vOLJ6/CZxDRUnLYn2lkD/biUqDOfuotH1p+2tz4MY6GunwpjMfx0?= =?us-ascii?Q?m57Y36Bl5ATAc10qMsw9LyG9y4VOkEex+uzZDT9anB78uQWrYxDdYlY0dQWN?= =?us-ascii?Q?d9O774Gse6gdudiXCLQZWyOI7Ub0Fv7D9DRV1WHLxqG0gZE2Er/2i4LJ36mC?= =?us-ascii?Q?nNyG9trLNtx9Ez/IYtaoZlSJnTFk9vqtJzE8/HjItY2WCkOdNR+vtf74JZUP?= =?us-ascii?Q?ID3FrJHoXyr5CN2ag/nLmHB7J5WALvrxhJFwkgueNWETQNLeuVCFlEl1Vvoi?= =?us-ascii?Q?HNbPYIWOfkVslL9jMp/wmS8KU3KGqjZiL4DMknSswHqvEQOg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;AMSPR02MB152;5:R6t7rdqV05BODhRFTbjNNSGIdi5+jzk8Np/Q3MyjOthJDQ9sTL81Y+g/Nw20JHRQFnRALmEepx8oLOd0zjo9pZlL/WdNPvG6EqWyRH2WyNamM0hRytHbjz7qaIKZP4xNba2PnQJmDcqzPzEf5Bo0ag==;24:yy9Fuj56LgLX/Q9ypLAn+DHVie37SWlEADLzb7G69MeFWLSgC2OaB7nqVqSFCXeyw0KZAN/WRvNARHMsUaK6M7r8oQCB8E4km+4D7OJVzT4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2016 16:19:45.2738 (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: AMSPR02MB152 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 */ -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: noamc@ezchip.com (Noam Camus) Date: Sat, 6 Feb 2016 18:16:44 +0200 Subject: [PATCH v3 1/3] soc: Support for EZchip SoC In-Reply-To: <1454418899-25500-1-git-send-email-noamc@ezchip.com> References: <1454418899-25500-1-git-send-email-noamc@ezchip.com> List-ID: Message-ID: <1454775406-25277-2-git-send-email-noamc@ezchip.com> To: linux-snps-arc@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 */ -- 1.7.1