From patchwork Tue Dec 27 09:13:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "M.h. Lian" X-Patchwork-Id: 9489089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B790B62AAD for ; Tue, 27 Dec 2016 09:14:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A807D1FF26 for ; Tue, 27 Dec 2016 09:14:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B1032094F; Tue, 27 Dec 2016 09:14:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 06D211FF26 for ; Tue, 27 Dec 2016 09:14:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cLnoX-0004v7-4n; Tue, 27 Dec 2016 09:12:57 +0000 Received: from mail-dm3nam03on0057.outbound.protection.outlook.com ([104.47.41.57] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cLnnG-0004EJ-Kh for linux-arm-kernel@lists.infradead.org; Tue, 27 Dec 2016 09:11:42 +0000 Received: from CY1PR03CA0037.namprd03.prod.outlook.com (10.174.128.47) by CY1PR0301MB1578.namprd03.prod.outlook.com (10.162.166.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Tue, 27 Dec 2016 09:11:16 +0000 Received: from BY2FFO11FD019.protection.gbl (2a01:111:f400:7c0c::149) by CY1PR03CA0037.outlook.office365.com (2603:10b6:600::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11 via Frontend Transport; Tue, 27 Dec 2016 09:11:16 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD019.mail.protection.outlook.com (10.1.14.107) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Tue, 27 Dec 2016 09:11:15 +0000 Received: from lmh.ap.freescale.net (lmh.ap.freescale.net [10.193.20.69]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uBR9Ah1v026758; Tue, 27 Dec 2016 02:11:11 -0700 From: Minghuan Lian To: , , Subject: [PATCH 8/9] irqchip/ls-scfg-msi: add LS1043a v1.1 MSI support Date: Tue, 27 Dec 2016 17:13:04 +0800 Message-ID: <1482829985-24421-8-git-send-email-Minghuan.Lian@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482829985-24421-1-git-send-email-Minghuan.Lian@nxp.com> References: <1482829985-24421-1-git-send-email-Minghuan.Lian@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131273034759807440; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39450400003)(39850400002)(39860400002)(39380400002)(39400400002)(39840400002)(39410400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(38730400001)(305945005)(97736004)(2950100002)(6666003)(230783001)(5660300001)(2201001)(85426001)(8656002)(77096006)(68736007)(189998001)(86362001)(356003)(5001770100001)(5003940100001)(50466002)(36756003)(48376002)(2906002)(81166006)(47776003)(81156014)(8676002)(105606002)(92566002)(106466001)(50986999)(76176999)(50226002)(4326007)(626004)(104016004)(7416002)(8936002)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1578; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD019; 1:T31ukqTJOrjYntcWTtyErpiaCMsl2nv+ItYHnr15VIkaFxPvxy4pQ1bhnjm2zGhHDfObRbMRYs7ORlLjnG8bmZeYWwCn09Vbt6RuipkLU9pwjcqg8FMV28Fn/G1t93XM6LScFfiIz35HfiSTOWSWGuBF1h/sHBho6mQ0Tz6VB4ul/XOG0CJwmisrdTRh2d5Lv6RA+CgxM43Cb564EKs/xpyqR2ihUe6TZp0HkmexOqJWjFnWohZJrcNHGrvr+nOyxOGnU54cXZuLUg/Mf1Zb5P2mM+vN9qykr6Unh6hISP97SkSKpXFF/ZhDoJxIC3eJdKnnXDstw5juTVdP1dq6SkQIviQdh3wOd0LSdSXUIxmAoL2ptwCUXMLwoAuolWBgQT2hLEWFty08NifYWXW8kxRN7eEjGeukARFlAb4yuLHqcKETTYgoF1DsaM3ErTK9aNer+xNh62Ikh7lwIgjXlpi2oRQfjQya6KC3qJrc1a0vIKEiTTZXUkWEYTNz5NqEt2glfM7s/wutO/oWDuyCYX7Vi6wUxaN8bboQNMS0o3IWAHCiZuGjAGvIMVNd5Wjqeb6IMxv+8lfzsPjKFl7vgHF8SDgTLrAfiwazY0ET6/wvVl9Qacp4ZIOIpI0woLAfORCUgBr85QSgu8lW3xp2/GbuGMshZJrAWGYhcUCsWup/6Rjr8UHOaLToCwoecnhPGMFsP++NeWyIhHE99KAXmYifTNHXqbi7s/Ud8MRMS/18fjpqwcjbdk5g98BeO4dK MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: f4670946-fc00-4290-21d0-08d42e384fe9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0301MB1578; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 3:79dHbW888g8OdEFfnuJ29g1R1B9WTQDb1dxSmqEt1OgXELLUeCYWF9xNfRvA0+rdz6sVDzwGqUfj5803dAUmodniSUPRdNWVb4gfKcM0dIYnVU7xg8AMl0KCQbHvMu+3U4k+oKNQtu32pA67yWwie8VMkJAZQnyNLDOAKrVBOUwkvEvDf13YrvXe5D8TXMkFMnkI4ODvIRtNlwUWo30LaFT5+AVVfZhZGGNZDk8L5mAA78SSWjYigig0l7NbBySwbwN4bfRTTdSuXKfs7LQYWumcfesiKbpZ/JMHmBQuwl3ZElKSZd53KW3epXmaNKKgr39IvGnJMvaesd7cF1T8334QXKBPrk2zQVbbOanG8RNwuKs4u1pjm0TfUMrVsVf+; 25:1blGu11QQqCZjYA2OrpJaL7hSeWlKNZEDchJ50XiZdJ7StrenDCiYcwcRSZZ7ED3/LmrZgiX/WS7kMas5r0+bFhbHzSTgPZZlQuuiByD2ZZsI8vK4wOUk9mh2ThljhOu/ZH5ZdYpqZnGPJUUN85HiO790oMfSjoAlxS3uEJL81JxWzkRbmh6wW4J5drBROC8MllVegtCqfKr8CTAQgW27qFFs+euCKTaIL4wy0EEDAgY5zkXz/um6GyPqMcZ/061wmStrCo3FO4WRBu+8tI2RaxLFkRRC4eRwEZTYDFY0Lt0KwPE7Nw84BQLpmUvULbQSH4zpLdViSLww1xnYwhDf77IvKmGgimBMEolPc40MCSI0y3AT++5ENX9XYcW7cCincWWAi4twDIS/9HB6/ogTxJty8bk44MccxiktFYIXZ6TLob4MYhHP/oUgWpvkb84rnUL3vVKWp0/C2pWHlfLLQ== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 31:t4PwgjfMru+YBiF3+Z8wBBWxVO8ewGfEbUMtasFViiM8iskAc54+7BZX1lfzYSH+q17t5H5SYcnL5VmZVR316mkOVZDyVVz8QxgTRoYPvfAynfTHLi+sBHZfj5+HqHH/HHTL4sFQRSZT5qTz68eJMgUVRzmq2DArCM6V8FY6Lcx1/kps1GbKsXX1Z7etzueySZ4RBFBMdHazqUSf9HOESSkgAsn3m8nrLwmuBRMLLzAaAY1TZdXdtnwKTv5I4HQj/8iqwmeJaUleubhzPZ5YZX7wKaAeZsHwvAV8FNWIqlA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:CY1PR0301MB1578; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1578; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 4:zXoKhP2bioGNwRZUrSw9LW95HQfXa/Lxor/WVIml7q9NDed54fVHxO0L+8GO6rbWK2kARzVbKpU65BjYMmHrR1pbv4VCfhc++8xmW/0tHzLzxeO9VDQRIkwO4h7C0rjAuzbxP3Sh/idb86FZqN8ZdqDQoKdAksXccBJ74rcKJvLi3KwbgTOruggc5rRLiOQloSTiDhMcTMUxlfUlT+rI8DKp+MbBKyrafdiS0yq6BfJTOI405dt1i9pWC1TySSes5h76lCqu4i2/M06FgXRmd48HqOOYrG0zSDOW3osUmIdMrSerhy+VmY346G1+i/Fq0fa71NDuQ8gLhZriied5aCsR34RqEVVmmmf29ZFukC8KGl56PO0Btn4cbL3yw6ekgOAYSn9Zd2DUaDi1lhxIcK3l5X5L2c4cFDinLgTPCriT9nxiZWw27MFkuZ2BbXSADGvc1ulg62Fd1LAYKfJzVjt5jKEJoHdAVMvx5yytcWKdiB+uDRepYLOxuIp5biDCEarH804GjCTlS8zCf2foqxCbF/4g6uPqNcm0y+KFbHdLUHa/863mAOetwPj14PeDfSkCYX+PaTBsv0inHO0YCHcybLT32XYggeD/vejds0oiGe8bVYxHaRe2kOVg04Uv8cOY9IL2RfIr/1XKGlZ7Cu2zUeHE3RejJdwuBeRK7rD0LZv8T35j3juupXbXYBLfUDiSudRZRyWEB0TeUEMRbFS3UDglh8aU2oDkNV5qX0kEPJdSPtWSqa38oImyZQim X-Forefront-PRVS: 0169092318 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1578; 23:MAyHHkYK7t1HyZ6JWHP/4rVeGlhVPJ0C2n4Burs?= =?us-ascii?Q?3765+5bMZ9dSLFU0z+nOT1EQhx6tRyHe8VOlH/hFLsyjPeXWD2M64dTtOYbh?= =?us-ascii?Q?q3IJ4JTFIwTRJ3wPGBATb8uGJtgkFdwLzU1H/DNwT0b0lbCFzFc6TtqNYZer?= =?us-ascii?Q?pjpZeQFfIFUIFrbW7Qtb+hqWUgnAyUFoaLb/UbImpD6Dx1igUnv+KgEL1fNU?= =?us-ascii?Q?6VSyp4f59wgDZlXDHooJpfVjqPwPfbRohF5yEsqHY4dNCRzXiXXU4ZzGDcIg?= =?us-ascii?Q?Lex1MP5IW3HdC+EGXFdQtiqOiEUhYCmJZd2rdAfakosLikIERIwCNO912d37?= =?us-ascii?Q?R3L8ZPem9JR7j6XhaNfTC8dS56tGgrcGQqB2jflftLRjQzyPI1wJz1O5b6X2?= =?us-ascii?Q?1/ksciKbwK76gCGduVLR7W71tbRozbPmhxDk2lgfeLmqyCwhAYlBnNzpjpJJ?= =?us-ascii?Q?iKEKQYURpNMAa6ZVkZluxPqum3oedEIB42RAg37W7yztNTi2rHVtVBQBYjmM?= =?us-ascii?Q?LOLIa5RQIH6P7pk5d6umjugLsxsQALSDsJGVjU4r+geMUquqEOhBDgYq8GC1?= =?us-ascii?Q?mLx3y0RLeM+O7vy7TbogVTsKktbvTodGzJyQyG+DzCU74TWYvcKCXlUBrwAT?= =?us-ascii?Q?aDsZNWIcoEzQeLqMEIqZLmL04Vuy7RjPOcHFINNDsucoVfdAVvf0vpUs1smr?= =?us-ascii?Q?X0R9JqUGCHdXIJ/0dhuPkdJLK7msidZfZEqH3v6+lnJnaZ0neBGbHBPwIbTe?= =?us-ascii?Q?BIk3ZwEuMa2HN2EZCuiGWcL6iAkHNC7D7tkXe+fXlkfAtk0+qnWXHTVW081z?= =?us-ascii?Q?4SCMjWt6ekvweWvvC3vdkVvM0VvT7as3Q+lS3rwedcl2zhEYAH9oe6bpX4Wk?= =?us-ascii?Q?2nKgcdpwz8jHhiy0JNnQ1B/RBO1DH60HI/9XHjbIs6naRUQCx/+ekVW5iwQM?= =?us-ascii?Q?UqVtXy24HRiWEoamrTfU4sKYDRiAlpnuZtfI9yBUBrRHsX9hsHHLvaPtXzTA?= =?us-ascii?Q?Zx2rsNDgCHK6jpKZaFRr6sxmqTx+VYvegScxwPUmUTbUjsJWq7+noE2eJ7GU?= =?us-ascii?Q?C3b+XZoVA4C+vxlv+/mcUNo3Y+Mm3mpGPmpvImGGoaxHBZS8Iu8g5ovgZXKH?= =?us-ascii?Q?M/dpdL7hL5Ino/a740JRmnpfb4sXINgSpe2PhnHySlHv5/hMTAafU9CK7/6G?= =?us-ascii?Q?/VpPZp8PkhVJulib7RYKl7FDHMxnxJnk2oq6HeJi8eT4bwrZ3LR8+mvz9uIr?= =?us-ascii?Q?FC6+p5RFYRkQ73Nemy+I7Pt13n4cl+TvUXZB1m5NitG26iIAqy1WAK1XxpQl?= =?us-ascii?Q?qDH7eC6RQJ+PWzgMHVCTjPyM=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 6:qUARQqBvT4pXmExwqaG68TZqWZo+ZSoM0h3AceGk0MU/xAeHBjSqOo8WUCTVBRBEHE2RTx/aqPVpaZFfDexiIaouSx1qoLfcWERDD5SCbhbV1kLDkHNcoEniaPsnQEloRnOHcdTemVDk5pe3XstjAlolg4tPmwrZgfmQKEkNuTT9iKtfOpP3ykS82X5SEKNHYXmCsbvN/YwOOYUFDgbAc/bhC7VoOUFegfaww+/LfKs240lBMJ6A7xEyIr6VN5gQbZ7l6I/DHohC1by7a4gZiS8/opu9TrOM1s/Leo1aouvgqnvmwO4LJTLhgIAXY1iL8IEyHhqNnMo5jacqHtOyJY897czfSz2PpEKa5GPH6d8iRklYc127ZRppjhBifqK4fYl9Cpe/FsVC71Sb72bgHgAO/0dSn7d8gHiGpBRA8T5WJbVY46PUpODHym4BKvr1; 5:EjYF0z5HGzuu/7F9Xp7a7tsynfRdsUWJtgjjsYkTTc6gI1yLa4H9/WBQHX6RbKYeRyCDffEbefqNnaPTSn39WVuTsEMJ3q3Isk87vO3DbdknE6pOa4KFoCYlWLzg2HcIMtIxhpn/M+KLWIGhgW9CuzyZGZUhIV89cP/b3waZngeUWUzptkBVDIXtff/HDGXb; 24:61JpkanFo78hkwNa+Dy+Ll9wls5dXBEP9hZWA+8nwzGTKermwN1+GrNuCere/EV7ZDsbYKpuvB7XLzkUpwA1Y96rNzq9An4u8pas+5IyBKU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 7:O53iLzqbOgU9VJFsRu38eQLZSDx4fWUg5NUEh5vz9sIFotkCsHWPAi3cdRkr5+4cEcVgfSv9CdQuuAwXasGyIL0psyCOOkcB2c80PfxB0snj/4pAJ4TE54v065VKJZM5fE2yeXUbkOzVWQF4qRnsyGMHOHxksApWJ1vXdYwWCbkfpdHF4Dt0hf5b+hi+rFZmDy2WTE5t0lJmeCh9W2UmgURQUxCS9UZ+K7iGYXyCmvq4im+NdNtLKFKgAdBaeardrz1EkOPkZ1D5fPJhXOWK2dKsUJzx9muCZnlMvOILP8XjGrrQRbz02V6LdiaGSE50DIc8rk6bEtpxhFJXOvlPrQ8Nr7UBagi7M3lGFGDRnIUPCuzmv1JUPrES/482wgiQhax8V3OEsmcm3vY1Sd/GPSfFqF5ps/w9YEVVPbZSfjG+kSezhyb28ZfD6BX7Jo8+Tyechgd3k9j6eE6Oprq4Eg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2016 09:11:15.7467 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1578 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161227_011139_094332_954806EF X-CRM114-Status: GOOD ( 19.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Jason Cooper , Roy Zang , Marc Zyngier , Stuart Yoder , Yang-Leo Li , Minghuan Lian , Scott Wood , Mingkai Hu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP A MSI controller of LS1043a v1.0 only includes one MSIR and is assigned one GIC interrupt. In order to support affinity, LS1043a v1.1 MSI is assigned 4 MSIRs and 4 GIC interrupts. But the MSIR has the different offset and only supports 8 MSIs. The bits between variable bit_start and bit_end in structure ls_scfg_msir are used to show 8 MSI interrupts. msir_irqs and msir_base are added to describe the difference of MSI between LS1043a v1.1 and other SoCs. Signed-off-by: Minghuan Lian Acked-by: Rob Herring --- .../interrupt-controller/fsl,ls-scfg-msi.txt | 1 + drivers/irqchip/irq-ls-scfg-msi.c | 45 +++++++++++++++++++--- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-scfg-msi.txt b/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-scfg-msi.txt index dde4552..49ccabb 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-scfg-msi.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-scfg-msi.txt @@ -7,6 +7,7 @@ Required properties: "fsl,ls1021a-msi" "fsl,ls1043a-msi" "fsl,ls1046a-msi" + "fsl,ls1043a-v1.1-msi" - msi-controller: indicates that this is a PCIe MSI controller node - reg: physical base address of the controller and length of memory mapped. - interrupts: an interrupt to the parent interrupt controller. diff --git a/drivers/irqchip/irq-ls-scfg-msi.c b/drivers/irqchip/irq-ls-scfg-msi.c index 67547bd..dc19569 100644 --- a/drivers/irqchip/irq-ls-scfg-msi.c +++ b/drivers/irqchip/irq-ls-scfg-msi.c @@ -25,14 +25,21 @@ #define MSI_IRQS_PER_MSIR 32 #define MSI_MSIR_OFFSET 4 +#define MSI_LS1043V1_1_IRQS_PER_MSIR 8 +#define MSI_LS1043V1_1_MSIR_OFFSET 0x10 + struct ls_scfg_msi_cfg { u32 ibs_shift; /* Shift of interrupt bit select */ + u32 msir_irqs; /* The irq number per MSIR */ + u32 msir_base; /* The base address of MSIR */ }; struct ls_scfg_msir { struct ls_scfg_msi *msi_data; unsigned int index; unsigned int gic_irq; + unsigned int bit_start; + unsigned int bit_end; void __iomem *reg; }; @@ -140,13 +147,18 @@ static void ls_scfg_msi_irq_handler(struct irq_desc *desc) struct ls_scfg_msir *msir = irq_desc_get_handler_data(desc); struct ls_scfg_msi *msi_data = msir->msi_data; unsigned long val; - int pos, virq, hwirq; + int pos, size, virq, hwirq; chained_irq_enter(irq_desc_get_chip(desc), desc); val = ioread32be(msir->reg); - for_each_set_bit(pos, &val, MSI_IRQS_PER_MSIR) { - hwirq = ((31 - pos) << msi_data->cfg->ibs_shift) | msir->index; + + pos = msir->bit_start; + size = msir->bit_end + 1; + + for_each_set_bit_from(pos, &val, size) { + hwirq = ((msir->bit_end - pos) << msi_data->cfg->ibs_shift) | + msir->index; virq = irq_find_mapping(msi_data->parent, hwirq); if (virq) generic_handle_irq(virq); @@ -193,14 +205,24 @@ static int ls_scfg_msi_setup_hwirq(struct ls_scfg_msi *msi_data, int index) msir->index = index; msir->msi_data = msi_data; msir->gic_irq = virq; - msir->reg = msi_data->regs + MSI_MSIR_OFFSET + 4 * index; + msir->reg = msi_data->regs + msi_data->cfg->msir_base + 4 * index; + + if (msi_data->cfg->msir_irqs == MSI_LS1043V1_1_IRQS_PER_MSIR) { + msir->bit_start = 32 - ((msir->index + 1) * + MSI_LS1043V1_1_IRQS_PER_MSIR); + msir->bit_end = msir->bit_start + + MSI_LS1043V1_1_IRQS_PER_MSIR - 1; + } else { + msir->bit_start = 0; + msir->bit_end = msi_data->cfg->msir_irqs - 1; + } irq_set_chained_handler_and_data(msir->gic_irq, ls_scfg_msi_irq_handler, msir); /* Release the hwirqs corresponding to this MSIR */ - for (i = 0; i < MSI_IRQS_PER_MSIR; i++) { + for (i = 0; i < msi_data->cfg->msir_irqs; i++) { hwirq = i << msi_data->cfg->ibs_shift | msir->index; bitmap_clear(msi_data->used, hwirq, 1); } @@ -216,7 +238,7 @@ static int ls_scfg_msi_teardown_hwirq(struct ls_scfg_msir *msir) if (msir->gic_irq > 0) irq_set_chained_handler_and_data(msir->gic_irq, NULL, NULL); - for (i = 0; i < MSI_IRQS_PER_MSIR; i++) { + for (i = 0; i < msi_data->cfg->msir_irqs; i++) { hwirq = i << msi_data->cfg->ibs_shift | msir->index; bitmap_set(msi_data->used, hwirq, 1); } @@ -226,15 +248,26 @@ static int ls_scfg_msi_teardown_hwirq(struct ls_scfg_msir *msir) static struct ls_scfg_msi_cfg ls1021_msi_cfg = { .ibs_shift = 3, + .msir_irqs = MSI_IRQS_PER_MSIR, + .msir_base = MSI_MSIR_OFFSET, }; static struct ls_scfg_msi_cfg ls1046_msi_cfg = { .ibs_shift = 2, + .msir_irqs = MSI_IRQS_PER_MSIR, + .msir_base = MSI_MSIR_OFFSET, +}; + +static struct ls_scfg_msi_cfg ls1043_v1_1_msi_cfg = { + .ibs_shift = 2, + .msir_irqs = MSI_LS1043V1_1_IRQS_PER_MSIR, + .msir_base = MSI_LS1043V1_1_MSIR_OFFSET, }; static const struct of_device_id ls_scfg_msi_id[] = { { .compatible = "fsl,ls1021a-msi", .data = &ls1021_msi_cfg }, { .compatible = "fsl,ls1043a-msi", .data = &ls1021_msi_cfg }, + { .compatible = "fsl,ls1043a-v1.1-msi", .data = &ls1043_v1_1_msi_cfg }, { .compatible = "fsl,ls1046a-msi", .data = &ls1046_msi_cfg }, {}, };