Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754435AbbLPBMA (ORCPT ); Tue, 15 Dec 2015 20:12:00 -0500 Received: from mail-db3on0087.outbound.protection.outlook.com ([157.55.234.87]:64467 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752144AbbLPBL5 (ORCPT ); Tue, 15 Dec 2015 20:11:57 -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 v4 02/19] soc: Support for EZchip SoC Date: Wed, 16 Dec 2015 03:10:21 +0200 Message-ID: <1450228238-4499-3-git-send-email-noamc@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1450228238-4499-1-git-send-email-noamc@ezchip.com> References: <1450228238-4499-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-22004.003 X-TM-AS-Result: No--15.658800-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;DB3FFO11FD041;1:w+4XffKYXEPaIEenre8+tB9cTNx1v4UYTZXNFs1RRIPEPfkOEn8D938R6Lxvkl9nKqW7pbfK6kRu5Pgcd71ykOr0uO36js4Ai5r7+C9otXWB8qubMZsvtIV5uh27BAFImVzpMXv2G2Tc8CPf0knLo2OOBYEgvbcAF0i4Lz/HTqvi4tXRtaCMYAB7vfF+SPEeIwOiqwzzQ63Ci5etogFmG80SDysKlHg6edozdtGxfN62ZIVzSlY8GMOEGDNKHlO74abvtp+RAmZm22KeS3C4HmM0mdMGm8UG3DPgd4zB53RxqJgEU8iDTPFo0kyqfM7+MAE/yM2vwzGjYYLjMg0N6Bhb8JPQR77a4Auwxa4tqRaWQuHOcgDnhmdT1SJN7FInFOvl6QbVtXXVK/EIlzinJw== 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)(104016004)(5001970100001)(107886002)(49486002)(33646002)(50466002)(50226001)(2351001)(50986999)(110136002)(87936001)(189998001)(19580395003)(2950100001)(19580405001)(86362001)(77096005)(1096002)(106466001)(47776003)(85426001)(5003940100001)(229853001)(36756003)(92566002)(6806005)(48376002)(5008740100001)(105606002)(1220700001)(11100500001)(586003)(4001430100002)(76176999)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB3PR02MB009;H:ezex10.ezchip.com;FPR:;SPF:Fail;PTR:ezmail.ezchip.com;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;DB3PR02MB009;2:OjdRAv6LMwxI69TViHI7GR4cFY0N0r3eLkbOf06DyvCZcd9K309YcEjUhKb3+bZp0g/wDw6tHU5H30ftqTeuOxk+n4l3T42lsw1bGVw0VpJUJ9ZvtJQ7yTlAckzXd+j5hntMR0wK8loLiE7pmovLHQ==;3:EGlDd/kOAG0FdmI4UPHbNQ0spAA1O/MmzUUXPYRr6E1BK/aDRszQ2pucdOuqxRBSsPv2M9Fi2CH1EipwLuI9T97q6zbgqgXF7GGiaoQ6QS/Cper+XUo1JoL6s4d/LEtQj3XgYNJC1KoaOsRA8wgTgqILPh0HNhAKEdzvjFVONznYPzBRuPE3CsbleRdpaXAK/mdFdnjKfVtog2w2yk8DUpK+DPLBAHVVDGUOj5HiI8k=;25:myYD8g7oLDa7QGGP7Whz72cRRJzXO8/BkaFmZLUXfh6uFp7VWG4FmNY1DLVb7g0U19EQz48iaZLi1yNRV5GpI377+2dOYC20OfFJ9W3QMup4x9FfAkZSbOLkWgSM089FBmTFFJTBtSx1V6TyjSZ1G61qaECXx1TfaiX8rPH1S/eap3eawiPjbOBS9orXr8WZX7ittRY1PInr/CCnjESGRc8/GVSC4lC1XTjacVf5lhXjOMBg/wxBzA3jNU0xAdMzaXUvyZe+ZVpmjsZxRSTg8Q==;20:4xuPxAj5YiVWHI6xdjnaJAu3oxdCZRqTRCxmOFq08Okofd0auD8CcJOm4dsubs6JMfD+JiOvXhsSZoIC4grszccKBuPGSivkpAzirP43CMBqNrCOFTRfJen/cYqp3v8CqhI7sXU360NbNVrhV+Wix5a5ZnxhvWzrC0srEhVjUeQ= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB3PR02MB009; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(10201501046);SRVR:DB3PR02MB009;BCL:0;PCL:0;RULEID:;SRVR:DB3PR02MB009; X-Microsoft-Exchange-Diagnostics: 1;DB3PR02MB009;4:kd2zMD+Cb5WcP3dRcLvs6pxHmbmomRSxDD0GU3fVEAaI+TEVsD2R+Qy5LsWcAnY9EbwNxy/hzRsG+l0YEAlAeTaRMoXdawtIU6xx2NSw0PMBvkoT3opgfG4CP/CgaJZs1UeUeOBxvR+Ah/lwUhu4nR0QvQkf+v0HnOZxwqIh1X/9JvOw92PH8julbXri2n+ny1m939dm3DkWjh03ncp5EiHzpzJSMxTyw84qVdpNXeDe0xmueNfMeIg3UshJ6t5Uj8/D0YTI14wNImVyX6VqX7Q9LWOE4JVIwfRtatehQHzNH0IFZsKtqltltMm/ZsWdXd5en0GCOwy6s1qUoS3hb1wx/yzSdnFLsEuY+4OkKzkW2OZNLC/CaCTBfjKLmIoUdSFR2RspNj6vL1V21Sxr0ZN05vJT2/Y0DHxlZ5fL4KrJN4QKMq7vsRdDV3HMFQ8H X-Forefront-PRVS: 0792DBEAD0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DB3PR02MB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+NJfHF/B?= =?us-ascii?Q?p0U9EfClhBmocq1izvk26rNPP2TZmPbNVP8BBtLiy3p0YKxoXCJRT0CbeVnU?= =?us-ascii?Q?e/o2ATPZdArSPNmBpzpr/muqAwEqfsf8+48/CmyDmmsg2GFeIJ7ZiEOSNY5B?= =?us-ascii?Q?dNBCfJq90lLnRPv3DUjyH6ew4FLnMPF+1mocRV0ByVNxrb3WuHsKfmMDLn0I?= =?us-ascii?Q?DToAr8cfpexc1lvUSQRFf23m1vAik80zNypHlvFPN/HXkA5UdoZmRCgqlnmF?= =?us-ascii?Q?T0mIs3Eqk=3D?= X-Microsoft-Exchange-Diagnostics: 1;DB3PR02MB009;5:5llm9DHFWRVBDXMmDrIkKL7racr4J3AsIOhL4qJlfXqN5G9jnY4ocMka+XnAatWi+tG0N56al1n4ghtxLt0BgJmyDXRaMnZcjBNGVUCSGi8bkbgh7AK6IvFQWJQfJqlpwvwkIcj/mt5/tEWd2PBgpw==;24:h5KspGT799U9m9hhc9SreGzyBghNQoGOqqfzGn4IappCnUvryuJRs4m8+OzdV1VerPQGfaCeDyNiegnpUZ7v5h8iV3I+g/S8ulWVSoa4D0Q= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2015 01:11:53.5355 (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: DB3PR02MB009 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4092 Lines: 149 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 | 123 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 123 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..3bc30a8 --- /dev/null +++ b/include/soc/nps/common.h @@ -0,0 +1,123 @@ +/* + * 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 + +#define NPS_HOST_REG_BASE 0xF6000000 +#define CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST 0x5B60 +#define CTOP_INST_MOV2B_FLIP_R3_B1_B2_LIMM 0x00010422 + +#ifndef __ASSEMBLY__ +/* 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) +{ + __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"); + + 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/