From patchwork Tue Apr 2 01:33:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10880873 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2DB31390 for ; Tue, 2 Apr 2019 01:33:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3B2A287FA for ; Tue, 2 Apr 2019 01:33:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C71F228857; Tue, 2 Apr 2019 01:33:22 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 454B4287FA for ; Tue, 2 Apr 2019 01:33:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726206AbfDBBdV (ORCPT ); Mon, 1 Apr 2019 21:33:21 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36617 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbfDBBdV (ORCPT ); Mon, 1 Apr 2019 21:33:21 -0400 Received: by mail-pl1-f195.google.com with SMTP id ck15so4181662plb.3; Mon, 01 Apr 2019 18:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=x+YBEyd8q21TVn0yuRHS8HNRncJHYiBpNY2O31LawgM=; b=MY9S2akVFFxNVlenpTgcD/Y7QmDTalwQmT9VzBGVylWKN4s6MiZuG7S1OFd2VjhbB1 /d28H5AfBXqzbVrYD8SguhAI71iU1Nw7LYHdtgPoKU6bzscxN7n+keJpv9UCYTMvg/SD HC3MZt+8Yh1TP041ZvqVY4uXfQgQywJzn9Mu8B2Qqykq3TNOc4B+0HOWwa+mRHxfSk+6 KBCSsuv6PUI8szmBJSU/B4so/C+Nhqijtjg8Edv3wtpjueonQf5LK2jCONxFx2JQaF6/ qUbdLbsDAgM7INLvvhQvmK/sJ97wAqS3hBazHUXjQ0Dq6fbhP2WBpC4cKgmeeXS3qvPQ MD2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=x+YBEyd8q21TVn0yuRHS8HNRncJHYiBpNY2O31LawgM=; b=tpJ6m4tKCTY3rc3FLQWeXYhq4TzUJwsSrfJruapmMUfe/uUAYvz5TWHGbc0toX6W3t QtYCVAXC7z1zodKHWDPKbCRG2NNpZt8YDzDFq+xKoLtp2gVkZh6d6yZhhjlOYn+4Kagf rwVqISY/p3lYGMzSOueD6DnL8IJ5hqYfWOHXoWBSvMSj3XZxUtllCgENUDuCrJB0Q7pt EMhJM4UNu4SQGTFM0H4iyJhw0FYaEpZ1XKsORGL95LIauY2yEMu8V4+L/xSn5/uJ6iTE d5/zxl9hF620goyLUaji8pXyiI1Vz+uduSHovYOr5HVGXUHZ7b7UN4oSnkO6Aw7Gl1qF Uycg== X-Gm-Message-State: APjAAAXKAjIgUfckAdOibupHCXveXXDXDaZ9NL34RJVBZ1f+3+R3zkPo 4awaOs2pryXj9ahOrMmkJnGnzMRB X-Google-Smtp-Source: APXvYqzFtzgB1F0claRigwPcIYogwcOGNP4LX2ZbGuh/EKg940d72RLUTD023tVYezbsMi0P2u/3yQ== X-Received: by 2002:a17:902:820e:: with SMTP id x14mr4132652pln.207.1554168800315; Mon, 01 Apr 2019 18:33:20 -0700 (PDT) Received: from localhost.localdomain ([1.1.125.76]) by smtp.gmail.com with ESMTPSA id q86sm27912247pfi.171.2019.04.01.18.33.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 18:33:19 -0700 (PDT) From: marek.vasut@gmail.com To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org, Wolfram Sang Subject: [PATCH V5 1/6] PCI: rcar: Clean up remaining macros defining bits Date: Tue, 2 Apr 2019 03:33:02 +0200 Message-Id: <20190402013307.20912-1-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marek Vasut Replace macros using constants with BIT()s instead, no functional change. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org To: linux-pci@vger.kernel.org Reviewed-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Reviewed-by: Simon Horman --- V2: Bundle this patch with other cleanups before resending V3: Add Wolfram's R-B V4: Add Geert's R-B V5: Rebase on next/master 20190401 --- drivers/pci/controller/pcie-rcar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c index 6a4e435bd35f..542b5bbf4bf1 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -47,14 +47,14 @@ /* Transfer control */ #define PCIETCTLR 0x02000 #define DL_DOWN BIT(3) -#define CFINIT 1 +#define CFINIT BIT(0) #define PCIETSTR 0x02004 -#define DATA_LINK_ACTIVE 1 +#define DATA_LINK_ACTIVE BIT(0) #define PCIEERRFR 0x02020 #define UNSUPPORTED_REQUEST BIT(4) #define PCIEMSIFR 0x02044 #define PCIEMSIALR 0x02048 -#define MSIFE 1 +#define MSIFE BIT(0) #define PCIEMSIAUR 0x0204c #define PCIEMSIIER 0x02050 From patchwork Tue Apr 2 01:33:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10880877 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA7981390 for ; Tue, 2 Apr 2019 01:33:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2D08287FA for ; Tue, 2 Apr 2019 01:33:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B689628843; Tue, 2 Apr 2019 01:33:26 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AEC6287FA for ; Tue, 2 Apr 2019 01:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbfDBBd0 (ORCPT ); Mon, 1 Apr 2019 21:33:26 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42726 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbfDBBdZ (ORCPT ); Mon, 1 Apr 2019 21:33:25 -0400 Received: by mail-pf1-f193.google.com with SMTP id r15so5462213pfn.9; Mon, 01 Apr 2019 18:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=217mzBCBjhWvy1vQNChNd0vWeqQUpouuzIzh0WcsAXg=; b=GmxO6cAEY2REwB8GpSN3QRdGX5ve9f5ZLbH6tCZmlL7iWrUWHO/dd20dL60p6jKdy5 OTMQ1FwVRB/53+B4JU91+PuT+iSsIDGXyh4nCo4r2oRtcj6QSJdZSmzdMYRRiVZiGrok fe2R5nAdNSR/oMCEyYQtfmt/h2JFUWCc9zK8vVb3mOhyEICG4wXpI3NDtWDNTv2/Dd2l mYTjwH3fRJ4DcvlcV4ZlTDaS8C+SI/rNI0BMURZ8ZiOZWGxK3yemWPZet8MOCDdL41Do 2A2/qPVNmUqT2TLkwWzL2y6K8ApIcFifo7MW51Yhu9pPVf5K+gzeLuI5ymeezBEu5g9b DIxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=217mzBCBjhWvy1vQNChNd0vWeqQUpouuzIzh0WcsAXg=; b=k40opZks762paNsqBx+dg3xlhUHSJPI5tntFuC0aodto60Yy9ssl6Kr1k/XIk6BngG HINTthVO4OUlUUbpyeRhrgduRvJNo/MJ5XBbj448uT9W8mpOTpFUdp+AmtklaljOeXCJ w/elIdZEVMmacSX2lts5xNtvRAsuq0FHYnOmS/v7ChoB9kRwbG6GqvvZ55hvOPDmn8u/ LCyDTQVWUIiUliPCFZTlZel/RtASyKenRop/bMrW6/7V2DM2EcUO9KH5bgEeGg/qwpW+ T4TA6wBocz4cR5q7qIvwP7FhWj/y6r19xtVwtVW59nGVYXl5vtt7TWTyYYOtPoyPb2ge kw6w== X-Gm-Message-State: APjAAAXfYHcACR510AOItxOfBgpMdgt+QCE/FYcMjKGd3zfdlUJV3Hzk dsMTnhsM41nSgy8zjmzKd5Ej0RAT X-Google-Smtp-Source: APXvYqwhLvqUwkgWFGU5xzmDkSDmzFkaSHW5tdSDGLSwabEgR5lX0A1BzsznGfw4uL+Upqx2I0gMYw== X-Received: by 2002:a62:4e86:: with SMTP id c128mr42499851pfb.39.1554168804695; Mon, 01 Apr 2019 18:33:24 -0700 (PDT) Received: from localhost.localdomain ([1.1.125.76]) by smtp.gmail.com with ESMTPSA id q86sm27912247pfi.171.2019.04.01.18.33.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 18:33:23 -0700 (PDT) From: marek.vasut@gmail.com To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org, Wolfram Sang Subject: [PATCH V5 2/6] PCI: rcar: Replace unsigned long with u32/unsigned int in register accessors Date: Tue, 2 Apr 2019 03:33:03 +0200 Message-Id: <20190402013307.20912-2-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190402013307.20912-1-marek.vasut@gmail.com> References: <20190402013307.20912-1-marek.vasut@gmail.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marek Vasut Replace unsigned long with u32 and unsigned int in register accessor functions, since they access 32bit registers. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org To: linux-pci@vger.kernel.org Reviewed-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Reviewed-by: Simon Horman --- V2: Bundle this patch with other cleanups before resending V3: Add Wolfram's R-B V4: Change reg to unsigned int V5: Rebase on next/master 20190401 --- drivers/pci/controller/pcie-rcar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c index 542b5bbf4bf1..317f688b1fd2 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -154,14 +154,13 @@ struct rcar_pcie { struct rcar_msi msi; }; -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val, - unsigned long reg) +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, + unsigned int reg) { writel(val, pcie->base + reg); } -static unsigned long rcar_pci_read_reg(struct rcar_pcie *pcie, - unsigned long reg) +static u32 rcar_pci_read_reg(struct rcar_pcie *pcie, unsigned int reg) { return readl(pcie->base + reg); } From patchwork Tue Apr 2 01:33:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10880881 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E27AF1390 for ; Tue, 2 Apr 2019 01:33:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CECCB287FA for ; Tue, 2 Apr 2019 01:33:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1F0F28843; Tue, 2 Apr 2019 01:33:30 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52522287FA for ; Tue, 2 Apr 2019 01:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbfDBBda (ORCPT ); Mon, 1 Apr 2019 21:33:30 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41213 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbfDBBd3 (ORCPT ); Mon, 1 Apr 2019 21:33:29 -0400 Received: by mail-pf1-f195.google.com with SMTP id 188so5476355pfd.8; Mon, 01 Apr 2019 18:33:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/b2GPQ7mSz/AeuVi1zGDYx0uWgKKdLfbpSpkOtBQSvI=; b=VypiD682Q4gH9uuJuJRNXVhsy8wT6HlUqZ4UY+L2xKFnU4DElwUwoQPuyJFaw+w3Ps H9M5bzp8spqlrcLNOz7SXwRixmpfAUwDhc+dbpc9fdgF79RRWJRZ6CT9dRIlTewQUzUz g48d83DJgdtXerrPB/x9aEgcV4zD5efaja8X01UY+t838vGzyVjc/T8UJNwogm3WSbmf IFK0Iez+zWS+RbnnOGddFZu/MqOnaXmzB5lZeuaJboDQOd4Mzz1nvk2T9Fp8SeYhFJ6K mB3gi9w6aWGv5qUeUDSc5yLTZz6dYoGUy08odbLrwcEsjwKAFPaDqcHR6aOlzSvZp7xy M2ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/b2GPQ7mSz/AeuVi1zGDYx0uWgKKdLfbpSpkOtBQSvI=; b=ulofFya2yorBvofEEvI23S5hVMJTQqbp4Rz9Pt+NOTDBmdyDl/KwzXopEzk7qaVgoi teqvPSKuJ9KCJ2RklKOSKEio7PcdBU36ISQABAf6RwNP8NpMd1ULTWFxewxXdAcoLZ9T LfXbi+b/BtjGSIRmxrQchJgRTe6iZVVkfus1X56GnEXeH9dwAU4bVnhK6UYnQnt6/Rc+ Qye7V+QUVaRo5I44wL774kD3m0IiIekqjgUtNgGgu7NzOmMnFv8G36NrR/z2rZJ4jTrg 4GYBONcHvSbveWMlTIIcFJgV2lOwGcc1r1UpTV5yl2tt+UrbaXg7qYCeIt0bdSDvYI4f kNaQ== X-Gm-Message-State: APjAAAVM1OcO7pr0S0I9hJe1dwBV+IBBRSMULJ2gdEuVKyI2wwQdDY8u iYLas+JClYlw9Ayj/amfqC7DWdDR X-Google-Smtp-Source: APXvYqxUPAiNaJY6inNrH1zirrFtEU6lRCM0gj43pRU4UlRpPfsoZvu/0e1PKp/84Z7h8VXW5WhTgg== X-Received: by 2002:a63:2045:: with SMTP id r5mr63014457pgm.394.1554168808913; Mon, 01 Apr 2019 18:33:28 -0700 (PDT) Received: from localhost.localdomain ([1.1.125.76]) by smtp.gmail.com with ESMTPSA id q86sm27912247pfi.171.2019.04.01.18.33.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 18:33:28 -0700 (PDT) From: marek.vasut@gmail.com To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH V5 3/6] PCI: rcar: Replace various variable types with unsigned ones for register values Date: Tue, 2 Apr 2019 03:33:04 +0200 Message-Id: <20190402013307.20912-3-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190402013307.20912-1-marek.vasut@gmail.com> References: <20190402013307.20912-1-marek.vasut@gmail.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marek Vasut Replace various variable types with u32 or unsigned int type for variables holding register values, since the registers are 32bit. Note that rcar_pcie_msi_irq() still uses various variable types because both find_first_bit() and __fls() require various variable types as an argument. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org To: linux-pci@vger.kernel.org Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Reviewed-by: Simon Horman --- V2: - s@unsigned long@various variable types@ in the commit message - Replace int with unsigned int for the $shift variable - Replace int with unsigned int / u32 in rcar_pcie_config_access() V3: - Change shift from u32 to unsigned int - Change addr and data in phy_write_reg() from unsigned int to u32 V4: - Change reg to unsigned int in rcar_pcie_config_access() V5: Rebase on next/master 20190401 --- drivers/pci/controller/pcie-rcar.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c index 317f688b1fd2..9d0e63945842 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -172,7 +172,7 @@ enum { static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data) { - int shift = 8 * (where & 3); + unsigned int shift = 8 * (where & 3); u32 val = rcar_pci_read_reg(pcie, where & ~3); val &= ~(mask << shift); @@ -182,7 +182,7 @@ static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data) static u32 rcar_read_conf(struct rcar_pcie *pcie, int where) { - int shift = 8 * (where & 3); + unsigned int shift = 8 * (where & 3); u32 val = rcar_pci_read_reg(pcie, where & ~3); return val >> shift; @@ -193,7 +193,7 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie, unsigned char access_type, struct pci_bus *bus, unsigned int devfn, int where, u32 *data) { - int dev, func, reg, index; + unsigned int dev, func, reg, index; dev = PCI_SLOT(devfn); func = PCI_FUNC(devfn); @@ -297,8 +297,9 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val) { struct rcar_pcie *pcie = bus->sysdata; - int shift, ret; + unsigned int shift; u32 data; + int ret; ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ, bus, devfn, where, &data); @@ -508,10 +509,10 @@ static int phy_wait_for_ack(struct rcar_pcie *pcie) } static void phy_write_reg(struct rcar_pcie *pcie, - unsigned int rate, unsigned int addr, - unsigned int lane, unsigned int data) + unsigned int rate, u32 addr, + unsigned int lane, u32 data) { - unsigned long phyaddr; + u32 phyaddr; phyaddr = WRITE_CMD | ((rate & 1) << RATE_POS) | @@ -1119,7 +1120,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct rcar_pcie *pcie; - unsigned int data; + u32 data; int err; int (*phy_init_fn)(struct rcar_pcie *); struct pci_host_bridge *bridge; From patchwork Tue Apr 2 01:33:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10880885 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 279FA1708 for ; Tue, 2 Apr 2019 01:33:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14C17287FA for ; Tue, 2 Apr 2019 01:33:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 085E528843; Tue, 2 Apr 2019 01:33:35 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 989FA287FA for ; Tue, 2 Apr 2019 01:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728726AbfDBBde (ORCPT ); Mon, 1 Apr 2019 21:33:34 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42732 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbfDBBde (ORCPT ); Mon, 1 Apr 2019 21:33:34 -0400 Received: by mail-pf1-f193.google.com with SMTP id r15so5462357pfn.9; Mon, 01 Apr 2019 18:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4tGhphRrWWaHKd9rE7vscoLmSMMnrsZuw+RjG6zFgas=; b=qAvcuVjbHQHqlqr1Ro54+mh4m789guhafFF8myuSnta93A6u0cv2B+zC/YjnKunnh6 kF7IuAiNN8k/P7v6eC9cEmz4Q2eYH5/YrIbBA6M9q21H3sEnXLgyQ2BUIHXjk923bgNK wh1l1qAKQu6BoFEI3Fo1y+wOKRG5hR2SKEF5nLC1CwBhzj5K21X0yxCnV+gEiVf7E85t +am8yz+FlFCwmRAV4x62hvOKCoka9T37qTdnZw/DwKzIMtKWA+cu3VRywMVfyRUSwDs9 6Snr/tDEKubkNG03Y69L7sWhN8Ag3yRwi8y92LpkwPvrGjzqstPlMDStb7G7NYbmjGc6 wO4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4tGhphRrWWaHKd9rE7vscoLmSMMnrsZuw+RjG6zFgas=; b=DZfaLl1pzrRVHm5hqpg4y4DprRxhovsVBVd+VCw1sSgMNFvHHhwoogSbnGwTSG/rnw jafsYUZPRSwdSl3zdDvChw59R5qF3xv9a5izdclNx3gu7HdTy4vNkqfPMyPWHNUAVEDu OM49e6/oyo9nsznpw2FbHeJ2Nskfg9m6BJcaJcXUTejhIDn4vbc1JArSRAT7wuuBt7H4 K7wperqNKfPFq52oUDHzGIViiEYqg3ZMiIIebivX98wbWPYGBppj2QuRkY4374ew+nIW LxGu47A035JFIMXGrbW+hppQYibQeJ07gWooJ/SbCreks+++8TztCTICqW2alo2fRjlS A3Xw== X-Gm-Message-State: APjAAAWoVHVTLDxAyGZHe03Fhstx9sF1xLccE5OF+At0Pi9s0DNoYBIf IZEdmiu9rr1eTB1j2v9j83gCcMsd X-Google-Smtp-Source: APXvYqzI1vXeMYfKTPaXMHy/OzhbiwiegW/sjtIqgQ8PhpumHZKw4V7hXIJQVPdHBlx0MiNkuE/lmg== X-Received: by 2002:a63:36ce:: with SMTP id d197mr14686088pga.180.1554168812765; Mon, 01 Apr 2019 18:33:32 -0700 (PDT) Received: from localhost.localdomain ([1.1.125.76]) by smtp.gmail.com with ESMTPSA id q86sm27912247pfi.171.2019.04.01.18.33.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 18:33:32 -0700 (PDT) From: marek.vasut@gmail.com To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org, Wolfram Sang Subject: [PATCH V5 4/6] PCI: rcar: Replace (8 * n) with (BITS_PER_BYTE * n) Date: Tue, 2 Apr 2019 03:33:05 +0200 Message-Id: <20190402013307.20912-4-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190402013307.20912-1-marek.vasut@gmail.com> References: <20190402013307.20912-1-marek.vasut@gmail.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marek Vasut Replace (8 * n) with (BITS_PER_BYTE * n) to make bit shift operations consistent. No functional change. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org To: linux-pci@vger.kernel.org Reviewed-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Reviewed-by: Simon Horman --- V2: Bundle this patch with other cleanups before resending V3: Add Wolfram's R-B V4: Change the patch from n << 3 to BITS_PER_BYTE * n V5: Rebase on next/master 20190401 --- drivers/pci/controller/pcie-rcar.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c index 9d0e63945842..d9b8c7cd9fba 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -172,7 +172,7 @@ enum { static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data) { - unsigned int shift = 8 * (where & 3); + unsigned int shift = BITS_PER_BYTE * (where & 3); u32 val = rcar_pci_read_reg(pcie, where & ~3); val &= ~(mask << shift); @@ -182,7 +182,7 @@ static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data) static u32 rcar_read_conf(struct rcar_pcie *pcie, int where) { - unsigned int shift = 8 * (where & 3); + unsigned int shift = BITS_PER_BYTE * (where & 3); u32 val = rcar_pci_read_reg(pcie, where & ~3); return val >> shift; @@ -282,9 +282,9 @@ static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, } if (size == 1) - *val = (*val >> (8 * (where & 3))) & 0xff; + *val = (*val >> (BITS_PER_BYTE * (where & 3))) & 0xff; else if (size == 2) - *val = (*val >> (8 * (where & 2))) & 0xffff; + *val = (*val >> (BITS_PER_BYTE * (where & 2))) & 0xffff; dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n", bus->number, devfn, where, size, (unsigned long)*val); @@ -310,11 +310,11 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn, bus->number, devfn, where, size, (unsigned long)val); if (size == 1) { - shift = 8 * (where & 3); + shift = BITS_PER_BYTE * (where & 3); data &= ~(0xff << shift); data |= ((val & 0xff) << shift); } else if (size == 2) { - shift = 8 * (where & 2); + shift = BITS_PER_BYTE * (where & 2); data &= ~(0xffff << shift); data |= ((val & 0xffff) << shift); } else From patchwork Tue Apr 2 01:33:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10880889 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03AB11390 for ; Tue, 2 Apr 2019 01:33:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E23ED287FA for ; Tue, 2 Apr 2019 01:33:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6B5B28843; Tue, 2 Apr 2019 01:33:39 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76E68287FA for ; Tue, 2 Apr 2019 01:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728730AbfDBBdj (ORCPT ); Mon, 1 Apr 2019 21:33:39 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37844 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbfDBBdj (ORCPT ); Mon, 1 Apr 2019 21:33:39 -0400 Received: by mail-pg1-f195.google.com with SMTP id e6so1314331pgc.4; Mon, 01 Apr 2019 18:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kTCFqfUft32w+PCS7xScjBZEtbn1BupBZrXKsXl5ZlU=; b=qCeLtbO+dGuDRHbVWLDedkqhg7MfN5fzLAln+1kPnx/y3QTe1UO5zdvyIwBf2Fh/6o yei/A09aSu+J62WNzTzpuoH1sOiZzHlDTSoHi+j/dXWWFWZpV8gVmUc8aEJGyCDfQzkf gcUtmZ0Q4IbaS1eDPb7PzCHm+9UAQyuSnjFdrfaqXIItve1t2zVvKHtHaTw82nPcPzNe TG79432w9dljVR5NbIjvANORQKA8jDtLlr1Kni7JhluCbXkAlVhAKDocR6S9e5p2SDvO l2GX0D0q5iqheoa+msaZEJPUv3zsJCL13gQ56sJIgcomgDG3fSA95wpL5MvBSj7dhORr joUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kTCFqfUft32w+PCS7xScjBZEtbn1BupBZrXKsXl5ZlU=; b=RuWJyxfSO/WUIl6s/CzgH8QS62PYczrVQR9dj3dDPYUoQr5eOLpojfLOa4qelPp1Xx TwM90ZbQrRe65jo49zpA4/XNqSYRHmUjCHmCCyL4SZif3OQm3WWoeTRHCT+OG6mg7vHT eyK5H10wCf+LGOgYtwp41/5LfMoLrINJKllh6fWeUIb3GaGMLMXQG+erPfjiSUkBvbof d73q6KY5sgoQ6FOCKYr/EwdjqOZNpcUskhB09H3ym5tNRlfanmJ1NTZYyxWzFOP/mFoC jno+HKKGUujpTyOY3aoOYfhnj4eM9gxiEbbcZGXSedLv+gWi9a2KJhl7vEY/X69Zcwff S82w== X-Gm-Message-State: APjAAAXzdlZAb2NKPs8+4SxDKibywfFS7wcBf3VKoZozS1CXi+aDPrUU NzoySUDMCbc22VJHHM8+NWqRmGB7 X-Google-Smtp-Source: APXvYqwUjudmLV5EwzstSmqs8DO9EE1Ft3REAyoH6VD4nNzKQKWXUolMqAe4ANj9nKq9NG3P6uXMhw== X-Received: by 2002:a62:1881:: with SMTP id 123mr65287871pfy.25.1554168818167; Mon, 01 Apr 2019 18:33:38 -0700 (PDT) Received: from localhost.localdomain ([1.1.125.76]) by smtp.gmail.com with ESMTPSA id q86sm27912247pfi.171.2019.04.01.18.33.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 18:33:37 -0700 (PDT) From: marek.vasut@gmail.com To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org, Wolfram Sang Subject: [PATCH V5 5/6] PCI: rcar: Clean up debug messages Date: Tue, 2 Apr 2019 03:33:06 +0200 Message-Id: <20190402013307.20912-5-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190402013307.20912-1-marek.vasut@gmail.com> References: <20190402013307.20912-1-marek.vasut@gmail.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marek Vasut Drop useless casts from debug messages, they are no longer needed due to the data type cleanup. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org To: linux-pci@vger.kernel.org Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Reviewed-by: Simon Horman --- V2: - Bundle this patch with other cleanups before resending - Add R-B from Geert V3: Add Wolfram's R-B V4: No change V5: Rebase on next/master 20190401 --- drivers/pci/controller/pcie-rcar.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c index d9b8c7cd9fba..168bc6b9bb93 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -286,8 +286,8 @@ static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, else if (size == 2) *val = (*val >> (BITS_PER_BYTE * (where & 2))) & 0xffff; - dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n", - bus->number, devfn, where, size, (unsigned long)*val); + dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08x\n", + bus->number, devfn, where, size, *val); return ret; } @@ -306,8 +306,8 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn, if (ret != PCIBIOS_SUCCESSFUL) return ret; - dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n", - bus->number, devfn, where, size, (unsigned long)val); + dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08x\n", + bus->number, devfn, where, size, val); if (size == 1) { shift = BITS_PER_BYTE * (where & 3); From patchwork Tue Apr 2 01:33:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10880893 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2CD01708 for ; Tue, 2 Apr 2019 01:33:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FB59287FA for ; Tue, 2 Apr 2019 01:33:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83F8328843; Tue, 2 Apr 2019 01:33:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 160EC287FA for ; Tue, 2 Apr 2019 01:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728741AbfDBBdm (ORCPT ); Mon, 1 Apr 2019 21:33:42 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36633 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbfDBBdm (ORCPT ); Mon, 1 Apr 2019 21:33:42 -0400 Received: by mail-pl1-f194.google.com with SMTP id ck15so4182048plb.3; Mon, 01 Apr 2019 18:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JY5xYvCLwwUJvsda8ccnmMiMiuKZ9i5E/Z+FL52T01g=; b=m3GSkY0d973a0yQqcjly2/+V1nBDvENMqqsV83T8La7gAdrMSjvIgStoZJsx7obkkR 9uz6Z2UMZ3fFtCtVlL/xZ05+YzPFMm+CQhvkvkvgkAzTYoCVj05K+LKCUJSvPVojFDKQ 8A7LIYbaDeE9b6UQTJJ9KOZbitJV4lKOaIUagGjS1RGL5clmxFk87JmXnVM7Yh+G/pKq GT9D5T1OP5WZIqw+G+n6XMhWoROAsWfJ0e9VE+85ODg+XRUDkyXbeS3C9+rQYdIEtf/2 eqkkRP0Wzg1qYUhIbZmdZg1XHobe721lsFkx3W66+Idc1ypcZGec+5o/oXyv/elu3rwZ DC4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JY5xYvCLwwUJvsda8ccnmMiMiuKZ9i5E/Z+FL52T01g=; b=JLfR/896f2Dp0cNJy0NAs5oEWQxBxhIOm/q5oiyK6XTM1qZKMKZ8WqYy2OGC0e1zVB P0CdrN5DKcNJcd5QDlUEgPXr3ubOMx/6QxlhRMEMmaqI4rnN/Q6hiiao01kentktZGUY 71ts65DdbD8g/A3hCCsq8cobSiI2mL98xZzbUzkIHqlBLpu10D0JAZvuMtLGwrC5ASQz xXAm5nTwwSHZwXChlIIjGbTZruLYTtpejCXwZZF+mZcSBoWMux09OwNL/KkXH1svOeMn 9KABqttRfOv8fGXoJuULLezrX+7mZch0CDPuoyRm1kfBQwG5sQ+CvR5Ef7V2q7zliBlv 5TeQ== X-Gm-Message-State: APjAAAVXl0Xpoz4WrKmqXl5EAmH6HmlFOLlwKlIXMssEXl8bbORdbfV0 Ny1z3LdChzJfZme8/lkea8zIIrEt X-Google-Smtp-Source: APXvYqx01p8g/bATZsjXE77HrNQKOlVkb4aXFdJM5jTjGEEy5ZNP6Kw3+EKdaheo3QfvFkoLmKnDDg== X-Received: by 2002:a17:902:e091:: with SMTP id cb17mr43867136plb.222.1554168821697; Mon, 01 Apr 2019 18:33:41 -0700 (PDT) Received: from localhost.localdomain ([1.1.125.76]) by smtp.gmail.com with ESMTPSA id q86sm27912247pfi.171.2019.04.01.18.33.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 18:33:40 -0700 (PDT) From: marek.vasut@gmail.com To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH V5 6/6] PCI: rcar: Fix 64bit MSI message address handling Date: Tue, 2 Apr 2019 03:33:07 +0200 Message-Id: <20190402013307.20912-6-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190402013307.20912-1-marek.vasut@gmail.com> References: <20190402013307.20912-1-marek.vasut@gmail.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marek Vasut The MSI message address in the RC address space can be 64 bit. The R-Car PCIe RC supports such a 64bit MSI message address as well. The code currently uses virt_to_phys(__get_free_pages()) to obtain a reserved page for the MSI message address, and the return value of which can be a 64 bit physical address on 64 bit system. However, the driver only programs PCIEMSIALR register with the bottom 32 bits of the virt_to_phys(__get_free_pages()) return value and does not program the top 32 bits into PCIEMSIAUR, but rather programs the PCIEMSIAUR register with 0x0. This worked fine on older 32 bit R-Car SoCs, however may fail on new 64 bit R-Car SoCs. Since from a PCIe controller perspective, an inbound MSI is a memory write to a special address (in case of this controller, defined by the value in PCIEMSIAUR:PCIEMSIALR), which triggers an interrupt, but never hits the DRAM _and_ because allocation of an MSI by a PCIe card driver obtains the MSI message address by reading PCIEMSIAUR:PCIEMSIALR in rcar_msi_setup_irqs(), incorrectly programmed PCIEMSIAUR cannot cause memory corruption or other issues. There is however the possibility that if virt_to_phys(__get_free_pages()) returned address above the 32bit boundary _and_ PCIEMSIAUR was programmed to 0x0 _and_ if the system had physical RAM at the address matching the value of PCIEMSIALR, a PCIe card driver could allocate a buffer with a physical address matching the value of PCIEMSIALR and a remote write to such a buffer by a PCIe card would trigger a spurious MSI. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org To: linux-pci@vger.kernel.org Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Reviewed-by: Simon Horman --- V2: - s/it's/its/ in commit message - Add R-B from Geert V3: - Reworded commit message and thus dropped Geerts R-B V4: - Add Geert's R-B again V5: - Rebase on next/master 20190401 - Use {lower,upper}_32_bits() instead of >> 32 --- drivers/pci/controller/pcie-rcar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c index 168bc6b9bb93..5e0102796345 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -892,7 +892,7 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie) { struct device *dev = pcie->dev; struct rcar_msi *msi = &pcie->msi; - unsigned long base; + phys_addr_t base; int err, i; mutex_init(&msi->lock); @@ -933,8 +933,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie) msi->pages = __get_free_pages(GFP_KERNEL, 0); base = virt_to_phys((void *)msi->pages); - rcar_pci_write_reg(pcie, base | MSIFE, PCIEMSIALR); - rcar_pci_write_reg(pcie, 0, PCIEMSIAUR); + rcar_pci_write_reg(pcie, lower_32_bits(base) | MSIFE, PCIEMSIALR); + rcar_pci_write_reg(pcie, upper_32_bits(base), PCIEMSIAUR); /* enable all MSI interrupts */ rcar_pci_write_reg(pcie, 0xffffffff, PCIEMSIIER);