From patchwork Mon Mar 25 11:40:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10868883 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 EEC9A1390 for ; Mon, 25 Mar 2019 11:41:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D79D329116 for ; Mon, 25 Mar 2019 11:41:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBC8E291EE; Mon, 25 Mar 2019 11:41:17 +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 1DE8429116 for ; Mon, 25 Mar 2019 11:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730559AbfCYLlQ (ORCPT ); Mon, 25 Mar 2019 07:41:16 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40554 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfCYLlQ (ORCPT ); Mon, 25 Mar 2019 07:41:16 -0400 Received: by mail-wr1-f66.google.com with SMTP id t5so9683486wri.7; Mon, 25 Mar 2019 04:41:15 -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=iQLU4ZrakoZ8yhfMSqT9OlU72pPX+Agq08ND+UiglRA=; b=IVUGePq8MYuabAwceDIXSF51YymcHq0dFKMBEy+KU39cmA1EPRi8/uIOLaUwbl7gD/ LVhpUe3pP+5ZsE5qVIoWB/8cJ5bLgL6stFjrwgXVwGS0f0ULUBEEgRgDC4gnNW8sV91V By2fQZarnDLWBZ9LdiBHnEUTDqtDu1h9XLZ16J1zj+US4RxMQuWTWoPqiVwzEc/9ACFC BzocgFWVTcNyqG0EGS6+zL+y77Sd/DxTPMBtbgWrvwF4K+dFXaWAwBa+y9a2hNzzy2NQ 0J3L1w4BeQaiR8f50YvmstJh1kd5aJNYkEhXDqZqtbGoxhxuYeJi34wGsf1hbq3XXzfZ 7+ZQ== 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=iQLU4ZrakoZ8yhfMSqT9OlU72pPX+Agq08ND+UiglRA=; b=t5M5dRPiWZVmbuWxbMYLrwOX+efCr4RUv2vadduF9e0DJcfLD4nqfRY0c5JQzZq4Tr Q5in9hXBx2YSoHLoM9JNmvUFr/bUI7xYAcHaNayhENiRHlhbHgpRr1pHVdPUh6euS24P rwOGXw+aN8YjMdx3qj29GLY9Oe/GX15fhB8/MJMr6nVBspR3S91t0lUyrNYfpwgDMCeA LYQ+Lq5G9X6NY4RnYO65AEinOBRg+GBCsufixXOk7RChe9wCqP0xlnZtApVI13BB6FQG /YKZ4guD6OLzEI4Ej7n6Axmykoelt6fRWGNrIE9nySA3x6WmSXl6vIgKxNBU7ru9mfi3 m7fA== X-Gm-Message-State: APjAAAXgrfO9sHfx2553H/MmWrKj+xxLg3kxMp0Ncjt0Wb8TaxVG1hj4 zVk+jAvBRJrmZAWUOV4s1w82oHbK X-Google-Smtp-Source: APXvYqz59O/DShwXS8EB/pAF6qWaNfzXAhGilyB/TrG4lXmIS4VSbhdVGu9dziM3XBKLUzIoaI3bfg== X-Received: by 2002:a5d:458f:: with SMTP id p15mr16189006wrq.188.1553514074425; Mon, 25 Mar 2019 04:41:14 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id f1sm3905730wrt.87.2019.03.25.04.41.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 04:41:13 -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 V4 1/6] PCI: rcar: Clean up remaining macros defining bits Date: Mon, 25 Mar 2019 12:40:56 +0100 Message-Id: <20190325114101.10198-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 --- 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 c8febb009454..5b8736f0cd6b 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -46,14 +46,14 @@ /* Transfer control */ #define PCIETCTLR 0x02000 -#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 Mon Mar 25 11:40:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10868885 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 91A081390 for ; Mon, 25 Mar 2019 11:41:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C46D291EE for ; Mon, 25 Mar 2019 11:41:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 704D0291EB; Mon, 25 Mar 2019 11:41: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=-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 17569291EE for ; Mon, 25 Mar 2019 11:41:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730700AbfCYLlS (ORCPT ); Mon, 25 Mar 2019 07:41:18 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:51778 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfCYLlS (ORCPT ); Mon, 25 Mar 2019 07:41:18 -0400 Received: by mail-wm1-f67.google.com with SMTP id 4so8533119wmf.1; Mon, 25 Mar 2019 04:41:17 -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=bouaeZrzTDWAEUndAMh7kdOuqT5P+rPOivmIFXh00dk=; b=ed4EkdeTP7uaMAfz6Suk5ikELYipVRI2+2rNaNOtph5+JMQXBmL9W/KNzUkKgwQFjB kTgdFBCNHjOx2oT0rXkFrwC2Ul6FufQVSvetMBhoygsWyjUW61LdjeSFyzw/puzUdnDV AN4j1fltYQj7CZDxO4FDXIsDBRpBNGm9KkUwnvJ2fNpRjyl3keVciEqHRdl4Iejgw/lJ y8ERuFY0AAUeOjuVzX5YM03ChO6US2di3YrDkZ4LphSHOTzaEU+SiljS1AYYn/SlMlWw 7yYC10IfX6uvkG1oKjBzKBv5KDaG6nkHqT+4bZDMw0X3BuzXjpg2yB7ApOxf7KgF83WS lhSA== 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=bouaeZrzTDWAEUndAMh7kdOuqT5P+rPOivmIFXh00dk=; b=pJanK8EAR/+CQLwrIDCwuWHojre7y2W5Jhk4zLgtYqmisZPd2dJMBAZCuMEUchryza siil/z6bxOWG2ihF7/vMMbigHCNjPjEGsT8cKPXC315+zvHecPrwYfyyOR5tfh24SMt+ u5xmnNWzPa5ECmI0+u8oceru9Bpr1NAV8AiD9uOywEzWoI8BO2QQFbBJ7hZJ2t5sJYuz oSYA7xAR5bVffJNCP2medk0bO89YMvYaBoqlndNmAEmNQcHCkGmP6+twcDuwStms0JOe dtQtYvNdVtsJ65hL9IhxLrEmzNancRnZx84qHou5y/K+/bP4KUh+bIOL1KJ4PpJCbfgo 5CbQ== X-Gm-Message-State: APjAAAVTGOt1zk+9W0PxP4txK241x7NFbFUiX2GoVEppZ7WuvV9VyeP7 gAvun007cOi8Odp/E4tXToIhn6SF X-Google-Smtp-Source: APXvYqwUBdZuLZjJ93dAMqT5oyBuXz7B2T/BHVAF6UHN7C5jWN+Z0pHEdOTr2F2fKFR7ofWH9pe49g== X-Received: by 2002:a7b:c408:: with SMTP id k8mr999218wmi.69.1553514076296; Mon, 25 Mar 2019 04:41:16 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id f1sm3905730wrt.87.2019.03.25.04.41.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 04:41:14 -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 V4 2/6] PCI: rcar: Replace unsigned long with u32/unsigned int in register accessors Date: Mon, 25 Mar 2019 12:40:57 +0100 Message-Id: <20190325114101.10198-2-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190325114101.10198-1-marek.vasut@gmail.com> References: <20190325114101.10198-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 --- 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 5b8736f0cd6b..3db693b4410e 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -152,14 +152,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 Mon Mar 25 11:40:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10868889 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 EFE601575 for ; Mon, 25 Mar 2019 11:41:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBDE929123 for ; Mon, 25 Mar 2019 11:41:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D095129201; Mon, 25 Mar 2019 11:41:20 +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 677DD29123 for ; Mon, 25 Mar 2019 11:41:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730708AbfCYLlU (ORCPT ); Mon, 25 Mar 2019 07:41:20 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37028 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730642AbfCYLlT (ORCPT ); Mon, 25 Mar 2019 07:41:19 -0400 Received: by mail-wr1-f67.google.com with SMTP id w10so9734380wrm.4; Mon, 25 Mar 2019 04:41:18 -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=jrsZfqcuFEIrJ4PDQ+vRhsUOUsRk2lnr6xeyB9N9o58=; b=dDaV34AO2yWVaLNu5EStEpnpkFiyqyBQOsfBGkJNklX2MGh4krafX58/RBm8talsQ9 mihDqEmG3ANJmFqOALSqONPeLIT5I+8KEFQi0Dgx8hl+pPAhIYAXZu7Q434yVth9sH+d 0AcN6bFy6aPqnCQ20qNW7Q+FXjD5ZzMRAxStIE1NTprMo5JpkB/8m3v0GZdl48qp6C8x hflrdlgBfk4k9lAw87ZMMC8VhwNa6dipYP6ygbgScbkbD7VPpaMpYUwMvmaMdo7lEa7u Gmok/R9XBj820QJzjRxMRfuGhtxFNBnR6yeZPGpLyQ+457w0eTV9W3wgALa32+rK7/HX 7ttw== 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=jrsZfqcuFEIrJ4PDQ+vRhsUOUsRk2lnr6xeyB9N9o58=; b=FINZUugvFUisaUvDJiE6Nw3t/K5lYNbuGr4pmKgccnPS9p+gpr6fGqjBu9O7zUFCBc qFwZEK5j4DetdbQUhQ1tbeLqMOdPpeU+qCeTL2o5RZa5u2m+X2k7kYaj88Ru/1q6bOSx 1gbEi/04srs+dHsxOBEWxGfVm5E+71s7V5Fy2jGS8W9CTheSVHRYROaS0EABdSli8DHQ cpFJCrGNDSEt6jUKzB9RWdrt1DEKXAUxS+cf/N1q9Xyr+2bsxl5HNfxtdOeR4jWQma/n 4TZStl5tUbo0UlICkMki2NEOoSsdTek7zPNI0zLxalfmhjVu0sI79GzX+dilTD6qiSc5 lwhQ== X-Gm-Message-State: APjAAAUv+i+y1YB1bytcDfWZbvA93y0IWNJRBFU4org72F9U2h4I3Fbf 5Q54Y3acPWezTgT1FJz65RzRBO4K X-Google-Smtp-Source: APXvYqwVW+rP9dCMTK4hSYl51+TLfUahaLuf/AeS8f0sw21wvUUWxN+vfIvp+YfHDEknllamZjGEQQ== X-Received: by 2002:a05:6000:1286:: with SMTP id f6mr15271820wrx.93.1553514077692; Mon, 25 Mar 2019 04:41:17 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id f1sm3905730wrt.87.2019.03.25.04.41.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 04:41:16 -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 V4 3/6] PCI: rcar: Replace various variable types with unsigned ones for register values Date: Mon, 25 Mar 2019 12:40:58 +0100 Message-Id: <20190325114101.10198-3-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190325114101.10198-1-marek.vasut@gmail.com> References: <20190325114101.10198-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: 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() --- 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 3db693b4410e..6699211fdc9a 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -170,7 +170,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); @@ -180,7 +180,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; @@ -191,7 +191,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); @@ -295,8 +295,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); @@ -506,10 +507,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) | @@ -1117,7 +1118,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 Mon Mar 25 11:40:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10868893 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 966C11390 for ; Mon, 25 Mar 2019 11:41:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8166E29123 for ; Mon, 25 Mar 2019 11:41:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75838291EE; Mon, 25 Mar 2019 11:41: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 11F0D29123 for ; Mon, 25 Mar 2019 11:41:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730751AbfCYLlV (ORCPT ); Mon, 25 Mar 2019 07:41:21 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43253 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfCYLlV (ORCPT ); Mon, 25 Mar 2019 07:41:21 -0400 Received: by mail-wr1-f68.google.com with SMTP id k17so1766993wrx.10; Mon, 25 Mar 2019 04:41:20 -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=cgr+QFoF4osyfmKyRWjolF8arxagaIcsd3D6Oah1mFM=; b=nuW7E2LfesyQnXrfug+FBSfHNcL/90eo+vbEI73BVQ/Ozuaez1FtvD8mozLyfdYNuM dBk94l1IE0+jUGLiCaZcq5NykbXMlTrRu48RGZ9lZchv9bRJ3g3MHBzOs0fJfYJrygQ7 Np5omYno4kAPMF8gqne1Cou9IdS1acxjST0mwZvpWqYUtOnw+6cxnv+PQQMnOXd1sm+L qqiCZys1FJDGHeYkii1RUPYfu20EC00tywL1NeMomrdAKaYGRP45JS5BknlYKBUoDT5v rV5uaObV8uCTvnPShE6xxmUwXIGgYw8PdnUc2GQrg2bq7tf95tmR8BS299flZELjFpXh dt3A== 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=cgr+QFoF4osyfmKyRWjolF8arxagaIcsd3D6Oah1mFM=; b=SPHP1+SR+G3uPLTBmgM3q1D8Okb5BWekT9OZlPbWaO92ba5SXFDCr9dIvON6X8r3Eu C2PdrzOGUSfjdz+UB+ADXdTySS+e+OnMkpXukVNV4AT8ITP/FeA0PQ/sL8xMlfoq87sJ 5IRvKV0JOnYBMAwR20w7r4SelBgEp0UapbiHbz4pD0gTvtaWRWAJRnV/+F65Nv7GVyfy FIqM/jWv4Xaa7x1gQQBdtMVXq/XrhYHKP+daQ8iDPo+5lij9dUbi1Q5q7fVo2WEjp90m QxySvAuFvlQ5B57lm5JOeFGyHaN8omvbIiSZTbbRRPJE9AVHjavCvGcdVT1lV5wzRdp1 azgg== X-Gm-Message-State: APjAAAWXpu+EyA1k7T7+bNWdgGlwH44P9JThlTa0rmY9uhCcSY/gmjHm O0vmKr51155g1iBbrxHCfK+PAlgT X-Google-Smtp-Source: APXvYqyLV2DYx47Y6xT3kUt03JhcSqQa30oJ3v67sumUcrYZHRvouPA9dY5PJoNd7sWTbCHOAj0ERA== X-Received: by 2002:adf:ed90:: with SMTP id c16mr14751145wro.74.1553514079067; Mon, 25 Mar 2019 04:41:19 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id f1sm3905730wrt.87.2019.03.25.04.41.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 04:41:18 -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 V4 4/6] PCI: rcar: Replace (8 * n) with (BITS_PER_BYTE * n) Date: Mon, 25 Mar 2019 12:40:59 +0100 Message-Id: <20190325114101.10198-4-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190325114101.10198-1-marek.vasut@gmail.com> References: <20190325114101.10198-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 --- 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 6699211fdc9a..96210768e774 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -170,7 +170,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); @@ -180,7 +180,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; @@ -280,9 +280,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); @@ -308,11 +308,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 Mon Mar 25 11:41:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10868897 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 0E1421575 for ; Mon, 25 Mar 2019 11:41:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDAD029123 for ; Mon, 25 Mar 2019 11:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1688291EB; Mon, 25 Mar 2019 11:41:23 +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 8101529116 for ; Mon, 25 Mar 2019 11:41:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730778AbfCYLlX (ORCPT ); Mon, 25 Mar 2019 07:41:23 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34464 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730642AbfCYLlX (ORCPT ); Mon, 25 Mar 2019 07:41:23 -0400 Received: by mail-wr1-f68.google.com with SMTP id p10so9751892wrq.1; Mon, 25 Mar 2019 04:41: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:in-reply-to:references :mime-version:content-transfer-encoding; bh=VUcTd4ffmxmZqw1aKgP9LKIf3+lH96Q0sGddIMfmQuA=; b=dR7kJa2lr2hLomOYI3IDf3O2+SmxJa+ixIMdj35R1Q2M2SlgKo6TCiYoK0xE+C/oc9 CBDMbR0hTIFCrXV8xR2HxkYQGUcOhV6eJc2nPqXjMyuTr3VFSjHsCePMDwyvsdlRfJKC SslMm6XZLV0sqGVnt5AqeXQN6DsehnclhY5vuoN1r6dBkaWQa7wOggcgpQ8U9+6pj6Qj S9pfNXpb1edrxhaREFgXtZffeSOkVk+ZPtdrbJNYF29MZzVmEjuFEMLp+2x7O+anK06c D16yXAlwWr6DIiAghFXmdu2/4XBGc2+Rn5na1iCX/PeZIv9AHefg0Sr32zh3GICKcYDq 4LEw== 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=VUcTd4ffmxmZqw1aKgP9LKIf3+lH96Q0sGddIMfmQuA=; b=lefnxRDFWnHUrdIvR4vh3G9pai0mihpuRVuZWNjMO2A9zn5rJh+4ILH2ldMR3iPx6h 8uzFT8+hUbiLal2+SzpUsRd9GOQwUfss7fX3RxD8gnwvrRZonVmy88ojDgC+xRDkyGQr j22hzQsYyjC8IE5s4uTJa/aojVmJdXTkl7jW1bGbJONAG/jH1OI5WE/D97Mz7I2VA6u0 va6TiTBPwKAEMHjUr7CAGxjUIP5WJ96sCjQoX4VPT5MSiZkRxloCev7hikBy2J7qmboy 8HPwcwfludaJf9Zb47Opm9Z9aV3ADcQDEF4ACEx+i71nBt/Euo0c8gXGT0dT3RjICQBh VDyQ== X-Gm-Message-State: APjAAAXWXrn0hY1AzWRq1fu7vCEBuDl/OHU/xC95/bNQoROpiMscBAve iluT2oABUces9spkYemUh4zexqG8 X-Google-Smtp-Source: APXvYqwnWXZnXB0yNIPnbfR5h4+I+vQdheNZ7shqfeUJIp17tDpsWVF5xiE+Zq2xmkyJ2cjTE6y2Mg== X-Received: by 2002:a5d:4087:: with SMTP id o7mr3726230wrp.9.1553514080589; Mon, 25 Mar 2019 04:41:20 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id f1sm3905730wrt.87.2019.03.25.04.41.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 04:41: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 V4 5/6] PCI: rcar: Clean up debug messages Date: Mon, 25 Mar 2019 12:41:00 +0100 Message-Id: <20190325114101.10198-5-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190325114101.10198-1-marek.vasut@gmail.com> References: <20190325114101.10198-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 --- 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 96210768e774..c6013f95bdb2 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -284,8 +284,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; } @@ -304,8 +304,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 Mon Mar 25 11:41:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10868901 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 8D6A21390 for ; Mon, 25 Mar 2019 11:41:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 791D629116 for ; Mon, 25 Mar 2019 11:41:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DBC3291EE; Mon, 25 Mar 2019 11:41:25 +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 00F2929116 for ; Mon, 25 Mar 2019 11:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730820AbfCYLlY (ORCPT ); Mon, 25 Mar 2019 07:41:24 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51787 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfCYLlY (ORCPT ); Mon, 25 Mar 2019 07:41:24 -0400 Received: by mail-wm1-f68.google.com with SMTP id 4so8533420wmf.1; Mon, 25 Mar 2019 04:41:22 -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=dP5qdcCTQ74ItJjVqPX6cC3bVHkZBzJFObfiXJrn84M=; b=sj0PLddzbyCgqzZKqN1WJM8w4RhAcXvFNH3wWwQXLsEJbIY4Xcl0GwoTOvB6NiV0i/ mAZXL9clGT6kV7PezDhNGSfzNu9SRnhRf2SrHwie/BxfwSKAQqj0q06PsaZsoH6gyuq1 rLvDqHWB30sunNO1m+hqyIR9f6mk1fCJNqRR0FkU6q8loYN+WF1VUKNpLz3oWX/kh6YH 5kCone9WJ5ANnQI7g9Ykr98BQHnVpkqGdbu4SoOVZd5tC7IcG1xnDu9YXzv6lsWvezWI 2GiMkwgGbhMrZO34GcsROa5eaSR37WY7Gqv4Uwe9izJ3eEGM5PoCucLDKa+cpxRowai9 IB8A== 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=dP5qdcCTQ74ItJjVqPX6cC3bVHkZBzJFObfiXJrn84M=; b=oGqV4+JlS/8V4KE/Tbb6TQkefH9kSjbl2B1lOfFhXPOKe2TNbXTi5j+IsLz7VBgC75 mP8HgfnYKlNW5COgzy7QzU5y5iGRG4yn9+FpgKBt0bKFN4yjM2Lerl8UH8ACkYZymKFE 1Fx7cxXfn0eQ0roKP3no3jrqRgwZ2BLnbFC44HEJTjEdQFzyuKg8kLlLS3jaEUsGsDPn u1v/yqe/abUK6q77CVXu6J2oZ44LQZyOHwuDYtaPur0Uh87npkIRGR21sgCHYe3NMax5 BuaQSbkbBzitLCulYLDoFPUQUA4yysiO8WxlzK+oAafWRCzCWUxnkX76T/ENHGqTjqej mUUA== X-Gm-Message-State: APjAAAU2CnAc6dlKWgTD1brtN3AHZ/kK/VhCZ/Ortux9QmPBg7WHAj7D H50a7WY4IBN8AJq8F77nyloU7i+J X-Google-Smtp-Source: APXvYqzn0EYiaoaNx0gMu+MA1xxGksmka/mXWlLKfEuaHZ2exgGgf1n0IFVSG6Amq2up0ErPAlWwVA== X-Received: by 2002:a1c:f414:: with SMTP id z20mr4970122wma.100.1553514081998; Mon, 25 Mar 2019 04:41:21 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id f1sm3905730wrt.87.2019.03.25.04.41.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 04:41:21 -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 V4 6/6] PCI: rcar: Fix 64bit MSI message address handling Date: Mon, 25 Mar 2019 12:41:01 +0100 Message-Id: <20190325114101.10198-6-marek.vasut@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190325114101.10198-1-marek.vasut@gmail.com> References: <20190325114101.10198-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: 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 --- drivers/pci/controller/pcie-rcar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c index c6013f95bdb2..62d2de9fbf1c 100644 --- a/drivers/pci/controller/pcie-rcar.c +++ b/drivers/pci/controller/pcie-rcar.c @@ -890,7 +890,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); @@ -932,7 +932,7 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie) 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, base >> 32, PCIEMSIAUR); /* enable all MSI interrupts */ rcar_pci_write_reg(pcie, 0xffffffff, PCIEMSIIER);