From patchwork Wed Aug 26 13:54:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7077571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3DEE69F344 for ; Wed, 26 Aug 2015 13:58:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3BA802051D for ; Wed, 26 Aug 2015 13:58:22 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 0362B2054D for ; Wed, 26 Aug 2015 13:58:20 +0000 (UTC) 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 1ZUbBX-00058S-9H; Wed, 26 Aug 2015 13:56:15 +0000 Received: from mail-by2on0054.outbound.protection.outlook.com ([207.46.100.54] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZUbBT-0004vZ-KZ for linux-arm-kernel@lists.infradead.org; Wed, 26 Aug 2015 13:56:12 +0000 Received: from CY1PR12MB0716.namprd12.prod.outlook.com (10.163.238.22) by CY1PR12MB0074.namprd12.prod.outlook.com (10.160.159.16) with Microsoft SMTP Server (TLS) id 15.1.243.23; Wed, 26 Aug 2015 13:55:50 +0000 Received: from CY1PR12CA0050.namprd12.prod.outlook.com (10.163.230.18) by CY1PR12MB0716.namprd12.prod.outlook.com (10.163.238.22) with Microsoft SMTP Server (TLS) id 15.1.243.23; Wed, 26 Aug 2015 13:55:48 +0000 Received: from BY2NAM03FT006.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::204) by CY1PR12CA0050.outlook.office365.com (2a01:111:e400:c42b::18) with Microsoft SMTP Server (TLS) id 15.1.256.15 via Frontend Transport; Wed, 26 Aug 2015 13:55:48 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp01.amd.com (165.204.84.221) by BY2NAM03FT006.mail.protection.outlook.com (10.152.84.100) with Microsoft SMTP Server id 15.1.256.10 via Frontend Transport; Wed, 26 Aug 2015 13:55:43 +0000 X-WSS-ID: 0NTOZZW-07-887-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2F950CAE647; Wed, 26 Aug 2015 09:55:07 -0400 (EDT) Received: from SATLEXDAG01.amd.com (10.181.40.3) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 26 Aug 2015 08:55:17 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by SATLEXDAG01.amd.com (10.181.40.3) with Microsoft SMTP Server id 14.3.195.1; Wed, 26 Aug 2015 09:55:06 -0400 From: Suravee Suthikulpanit To: , , , , Subject: [PATCH V3 3/4] PCI: OF: Move of_pci_dma_configure() to pci_dma_configure() Date: Wed, 26 Aug 2015 20:54:38 +0700 Message-ID: <1440597279-11802-4-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1440597279-11802-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1440597279-11802-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(3050300001)(199003)(189002)(77096005)(19580405001)(2950100001)(229853001)(68736005)(46102003)(5001920100001)(64706001)(92566002)(77156002)(101416001)(575784001)(50466002)(5007970100001)(62966003)(2201001)(86362001)(5003600100002)(5003940100001)(5001860100001)(50986999)(19580395003)(47776003)(106466001)(53416004)(36756003)(5001830100001)(50226001)(97736004)(105586002)(48376002)(76176999)(4001540100001)(189998001)(5001770100001)(87936001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0716; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0716; 2:6y4RiF9bo0W+oV3xnfq80qOWnjiSJ+OyuS5KpCF8Iabq+58LchjLS/NrQb4QvvGrqMwPhu17D2l7M3dGGpk0daIHYEmvxFSgOaPy99Kfd/OYfBZykBLzpBcRSwpU4HPNIzqqSSJV1D/5uSRgQMpNjXeaxScUpPMh2OKVFCSu1lw=; 3:4CLVxDJeu+Sp4ioCDy7mAnetxV/M4vfji9uVsM8n9W/d70Vn5/CVo5opOrA20KfPdu/ManaW/yPH7JPXioNJn5UcWu8nivw/Ql03iUzB/ltSWWG2GtbRyrGPm7owmJvSgx9wFd0Dzpm9OqYBgi0LUuV6LgjB0h/eQJ6qo4keSfLT0yEr9WqbvjYNWm0m40W0RHvPkp9NXWiGLPvTwDUNL2vQb9nyYMbr5tuh379dV9Jk2yIlgqbKz5cgQatRa19T; 25:/Gom8MfvhNjw69DVv5LptAa4uBwGCgYWD+eS5xHrFoYMS+vIt4RQFwkInafOsr5ekXTTUmSzG+f0F7xS+gR8yUCJiCI2czFshVZhcDsBNjpywWmopo2mSaGItHo26r6Nb2mk2w/mvStye6dKd40bZD84o36yDP0EY6NaI98D9Q8CmQhnKHEmqwmxqPQRV6Mq/mTkESzr35MP1FkWfFUU1P7xu19wIwjSnfYT3a0CI172IvW3dRI51jmP3N8uh8BowLkboPk6LTUUKobF7I5Jmg== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0716; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0074; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0716; 20:567jeVgpHzRwFc66gg4WftDMgEN8amp/cqf6IqMSjM0cul9fCYnK5jTzmVSvhBDish/o7QcPHT0HNuXbF/Rl4dftgkhVjjmX/QFLsvBmfqpsyp2co4jXJv205a79YCSagyG2Ny1mrGzjowpunLTqIAmKNCPPswWB3F7h7F7Xrg0Dqvh9/6ybrLIc7hr5UT83ZANaakG4r0UkbkT7x4WnYJTK9Mz3t6lCqTVx/UVtdVuENhC5NzV4qPmd9iBuV65Bsi3BTUkSpZzvtTXKY9FnrDTlEKazI3lWhQ3U6Ek00eLMGtX9OsEBTWOBVxULECptB8boCL69moOiSEJ1aq9SLLZ2TMOPZMJlBQPWZwcMgQnToENOx66lD73vz4PYIFzi3yVJTrzuCGp8VffRMFJbLXESg5mI5pW5Vqnvlvtlz7bGthY1SuIrO9fSpog8FbRyIXhF8esQPyeGsT8TKSnI5bgoToqBLzUgHLpxdHBxO/PaoB5VniLeIiU5mzrsCplF; 4:6iv1Zip4cFpi/oonriGqD1rPC4VK7FtPloDR9Z/6NQ/kc5ckT7JRuQtjPNyzl8yu4U/jsxHSB7UdfDY0QJU/ArRHPhbEWmaP0UY+gkAbhSjoOa6qPiwknnpvEtbEkwpmGaDRLEIN0WkSv8dFB7LSzflBb+oLsssXjUbJfFWj3bKcbtB0xIHWqH3c1e1uWiaGrL75jH+G4TuZSsABXQkcrzlE5gSnaIVrG0F6y6WUSjz1IGPyMkbeSlYdQ4hasc+2oPWq/3JeYtTto02YBAOZRLSaQzJggSRKvGxtmQlcgrHdeFFhcsaxB1+TlECfpv5K X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(8121501046)(3002001); SRVR:CY1PR12MB0716; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0716; X-Forefront-PRVS: 0680FADD48 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0716; 23:ysIdZqKif9CcSUtw/whqsyMOqGZm58XkOlMp7A72L?= =?us-ascii?Q?a/0Weq/9bhXp2Mqu4tQhvwGtaZN2gvYrorjXmP4AuiBuOpcvNCE2Rgos9VjV?= =?us-ascii?Q?8zVKQNwGc4JOr2rUMgzLYQoMgcv+7Ca38oz0B4yxWxGn+ARYAxPI4ld/Oi7x?= =?us-ascii?Q?1gavEGVBcMP08hJ9e5/D1HLeQuxC/w7d7JxcGCb1fCDbeY/oe9IXOurbYtj2?= =?us-ascii?Q?sepUp6vfyc41E4+g7d4Ou1y4RGB7CT23uYdCbCGYjcwKdq1yd00bAYhegXSV?= =?us-ascii?Q?xKCHJoN54RW+ryadI6rxvQWuMaKs51n37Ylw8Otav2sG6lNL8ODDNvGLxXYD?= =?us-ascii?Q?M0PT1IK+jptJH6RhqdcNe5JRPFWRrZPzP8UCKSACB5tIUsnbf84D6XTWFnVF?= =?us-ascii?Q?HQJl6r/sR4xXi3WT9pShh4cP3HuZQWLcqsEsNeR6sLZpfrhVOduOyxs9HoAo?= =?us-ascii?Q?ZBfOhPIMO6hYjvyGo85U9y/XskLikfXAQwNk628XBl+VEnhvAYadn+pXFTe3?= =?us-ascii?Q?V4NChRdCgot45/IyQc3WYNx2vNJlQs4ZOJvP6sMpj9cuCSwdY/XJPqUFbq0H?= =?us-ascii?Q?JyUYqD4Md0buMexUEXy+rYDr6v0AZVtRrVoAYn+NapS9lP9UhshP1HYYYFDy?= =?us-ascii?Q?8Dql6FK191gzjA48+oADfaXFKKhYYZ16sAx7HXYyo/RDaX+Nz4tMpqX/P6WL?= =?us-ascii?Q?U8IU7ToG/R7fgs8ZzhC0Zb0FKOItW7Xec8lHHJoJDiIXoDXfXazaiGGFxczV?= =?us-ascii?Q?Sdn3mh4atvzCs65uMbktv2mtXzKm+fjh+Ef6TDxgSgAND+nozaJ0KUMQNi9i?= =?us-ascii?Q?2pDLWorUDT3NzKjWbFKqwDpt1Xx8+taO2/RG+tSERQEAM8U0lAROXRKir1gW?= =?us-ascii?Q?vnTDjrI8m0wrYp2z88xmKwxfp4ffQlw91VL739mjtDJFVwxSqyb9DElYHFkX?= =?us-ascii?Q?2nWrIh/2BQv9G8zha+JKTAMKXBx5koQ0G6dS0d0n0ILUTnAjrh4Z/eWmNbdq?= =?us-ascii?Q?wV+ITrHPLB2NJI6TqIxAPeDpQnOvQGt/RG7AI/ALx7l2pTdmfUXwVgXaOurD?= =?us-ascii?Q?Rq0k7jO/VbbQSHKobV358MDUiBF0wcFZK5BtG63GiBPI4pwLx2Hknb03xs/u?= =?us-ascii?Q?6uowq5oVrTexEL7VBoNhBeMOQVN2VU4vp1og3Re1QrUiCLzkIZB4w=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0716; 5:/kO1jQrrDd/F0fgDbpdRjPno9AY7WsN0AsK07xauy+AtRlfF1J1MlKBr4y7uIhxKlT9wIuqxSXF682VPGXWo0t/EWJyb7EVUtwpKrytprF/BiDSpJqoBak9QhvbDAtzImVIH0Hw/wnOPbJ5/j6ALvw==; 24:Al9zDAVSVZ6YJiv6kV5mA61GtHDQKVl6ubHc18H+n/UziTCaMiNzgU5Zkegq4MfzvXW9CPfkcU6Te74kwhi5czNyGPWwj98ajiPV4p31N7k=; 20:mNZyL9nnKAzUGthDPeaC0Kw6Gv3HhPLLPgwkKbvrproCk4s5CvlbM5ZXSlJYfJkXx/lXSx7qoxGWW3QUR7ozQQ== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2015 13:55:43.8621 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0716 X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0074; 2:g44947zbnyURbI79yyFwjGJZS4M85SlVY/mZkcTsZZas8cYs0mkcDEEqyDVOvAy+mqpbxxodoWGgwXsaxN/ckLFk5mf0d2o+e874gBdsnR262J+26iff1CfXk04CptIhv65PluLcGzVVi9JspabPbi+fyvZbFd0Mnr6rulM0wKE=; 3:S+OZg3Yo2hH0Mkkg/jjXDEbGDAiZqiGXOvJIPoXF44a3VfE6pW4r3Bt9fQKo9xQuQe6Ag6wX7z+HMGcphoxU4DH+r/XBN1iMP4+kxDRyxaCWPIdNp+Mwg+8TMOHxCX4N7ZJ0ISpJLBWb+C+AI1vtFR3CNXPExhYTccG/9EMJ6DUoaQjEjQ0yoO92v4/gnUXAJL5L/Wbml8M+x15w+3bzrLGGkqJBIngHSWjCKJnkK7OFsDZIlmPzD0NHtmBwrvcI; 25:C4n7s6cq73dHSapqcQPGScynJOMbxC/WJ6kC0cLWzYTPR0xTbnjjrfNYvGvvx2YneDjnaPdSBvswZTcLtT2TVjLzkokFtEf541eCP+0JSZjQv50gAiMrXuFcldfa+rX6/XCIZIyN3cRHwFiR0x68gl0oBfEV/qvv90Dgqx7pSxkJuQRyW6h9WdvFvdJV5sqfHiCABntnOlRx1RK6XmMIRQDibhyHsAIweN4xbsoQh69NMHXWgNLsgNxcTbcKb05I9DluUGDnQogAtlLPXnRyDw==; 23:FthdYVhT6mfnd4WRC7vhwkrxSv7VgbmYMd4vfXl5LeOgulAtYqGpneQ9/vWJP/DmAs8KLGJ8oqED3xbTQkpgv+/NFQJeI6FY38M0wnFF6Yvd3TnTjL/e0xjYVWQPsODEtwWOyb5kWxa/wwBExFl1rRtfc4fNdF13ejy9fmiU6GSnebtA2kSCrSob0zqURAHQ X-OriginatorOrg: amd.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150826_065611_854156_5E7ADD1B X-CRM114-Status: GOOD ( 14.12 ) X-Spam-Score: -1.9 (-) 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: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Murali Karicheri , hanjun.guo@linaro.org, Suravee Suthikulpanit , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch move of_pci_dma_configure() to a more generic pci_dma_configure(), which can be extended by non-OF code (e.g. ACPI). This has no functional change. Signed-off-by: Suravee Suthikulpanit Acked-by: Rob Herring CC: Bjorn Helgaas CC: Catalin Marinas CC: Will Deacon CC: Rafael J. Wysocki CC: Murali Karicheri --- drivers/of/of_pci.c | 20 -------------------- drivers/pci/probe.c | 27 +++++++++++++++++++++++++-- include/linux/of_pci.h | 3 --- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index 5751dc5..b66ee4e 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -117,26 +117,6 @@ int of_get_pci_domain_nr(struct device_node *node) } EXPORT_SYMBOL_GPL(of_get_pci_domain_nr); -/** - * of_pci_dma_configure - Setup DMA configuration - * @dev: ptr to pci_dev struct of the PCI device - * - * Function to update PCI devices's DMA configuration using the same - * info from the OF node of host bridge's parent (if any). - */ -void of_pci_dma_configure(struct pci_dev *pci_dev) -{ - struct device *dev = &pci_dev->dev; - struct device *bridge = pci_get_host_bridge_device(pci_dev); - - if (!bridge->parent) - return; - - of_dma_configure(dev, bridge->parent->of_node); - pci_put_host_bridge_device(bridge); -} -EXPORT_SYMBOL_GPL(of_pci_dma_configure); - #if defined(CONFIG_OF_ADDRESS) /** * of_pci_get_host_bridge_resources - Parse PCI host bridge resources from DT diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cefd636..4de6594 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -6,12 +6,14 @@ #include #include #include -#include +#include #include #include #include #include #include +#include +#include #include #include "pci.h" @@ -1544,6 +1546,27 @@ static void pci_init_capabilities(struct pci_dev *dev) pci_enable_acs(dev); } +/** + * pci_dma_configure - Setup DMA configuration + * @dev: ptr to pci_dev struct of the PCI device + * + * Function to update PCI devices's DMA configuration using the same + * info from the OF node of host bridge's parent (if any). + */ +static void pci_dma_configure(struct pci_dev *dev) +{ + struct device *bridge = pci_get_host_bridge_device(dev); + + if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) { + if (!bridge->parent) + return; + + of_dma_configure(&dev->dev, bridge->parent->of_node); + } + + pci_put_host_bridge_device(bridge); +} + void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) { int ret; @@ -1557,7 +1580,7 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) dev->dev.dma_mask = &dev->dma_mask; dev->dev.dma_parms = &dev->dma_parms; dev->dev.coherent_dma_mask = 0xffffffffull; - of_pci_dma_configure(dev); + pci_dma_configure(dev); pci_set_dma_max_seg_size(dev, 65536); pci_set_dma_seg_boundary(dev, 0xffffffff); diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index 29fd3fe..ce0e5ab 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -16,7 +16,6 @@ int of_pci_get_devfn(struct device_node *np); int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); int of_pci_parse_bus_range(struct device_node *node, struct resource *res); int of_get_pci_domain_nr(struct device_node *node); -void of_pci_dma_configure(struct pci_dev *pci_dev); #else static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) { @@ -51,8 +50,6 @@ of_get_pci_domain_nr(struct device_node *node) { return -1; } - -static inline void of_pci_dma_configure(struct pci_dev *pci_dev) { } #endif #if defined(CONFIG_OF_ADDRESS)