From patchwork Wed Apr 14 03:12:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12201789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24182C43462 for ; Wed, 14 Apr 2021 03:13:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0234613BD for ; Wed, 14 Apr 2021 03:13:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233113AbhDNDNp (ORCPT ); Tue, 13 Apr 2021 23:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232975AbhDNDNh (ORCPT ); Tue, 13 Apr 2021 23:13:37 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C2F9C061756; Tue, 13 Apr 2021 20:12:50 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id u7so7509678plr.6; Tue, 13 Apr 2021 20:12:50 -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=uQGkHbExQKECAJaJryg6v9FWioWhZzgp18Ncbwe9/nk=; b=DSdYpVxIQFFaGAWRAPF7d09a5+OXsr5y91RTFTyPn9d/MVKoD3Q2re2NstpocIvFSM L1wR5KAsBwZ5H8uXwV6nLruz+gJrBWiuhfVv3qD+rIFm7A1o9Lkv2XLMtXD25qu92qkH UykLiqoEcY1rqO8jNaW1ZSjeX8p2pnm9LBlrwEsrkpQgeAmWhACb4BfYfFqLg0s/1K+E SrFdrUIUgapKAliNC6rCHn8eoA0ND2g78snUYHeyMZ+mhAmOXwg39kv/6r7MKfCp1Ub7 ut6A8OHsskkkeP1xWOe25LXbCNGYfu+MU7x5yXks8hTh97qHOpx2o3MbvpSALiFTKyyV ZJ1Q== 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=uQGkHbExQKECAJaJryg6v9FWioWhZzgp18Ncbwe9/nk=; b=MO4EDZdXiL4dhFQ/skbIMTQ4cgNiax4inzr/j8XUUjoBRUcxjmqPzlB5Ae5V4BBgGU T+6lwew1G2kUiEO+7f/qmBuXMnpjWPWCS6jFgXsYVK2rlL5ZFnnqdYL+yEGudkv8vPWo 1JnvgbBpqJEM73zBjenFKdl39WVpTBXAUecRTlCqyyUPGytlUGNR5jQTAStcSO7RVGnK X57y9Ch4WGz/lUl9FKGhb4apL2B71nouGNgqdlX9eXBQ4JKXEZG9ebOvWgG3IM3jk/eA 5Xe6Knd2Dt6DHHzhEL17hs1FbWmOoddFB7mPaxu4knupwlGcfDbKdh6/VVcXQuHiMOi2 0Prw== X-Gm-Message-State: AOAM532OE4HSYLAAIDzkeNygD7CMEfajJ2JDOC/3UlIQY8JMuGw5nmjl psCa9WlNvrGOydo0scpNrLY= X-Google-Smtp-Source: ABdhPJxuc0zmXzYGZ6XM6G0V+EkCOBbodJPKOHSQfMN/zwBGYbYaqhaDNYmCBnlLS4F/jS1JV090kA== X-Received: by 2002:a17:90b:3507:: with SMTP id ls7mr1057754pjb.172.1618369970530; Tue, 13 Apr 2021 20:12:50 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id d17sm13971605pfo.117.2021.04.13.20.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 20:12:50 -0700 (PDT) From: Ilya Lipnitskiy To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Ryazanov Cc: Ilya Lipnitskiy , Lorenzo Pieralisi , Tobias Wolf , stable@vger.kernel.org Subject: [PATCH v2 1/8] MIPS: pci-rt2880: fix slot 0 configuration Date: Tue, 13 Apr 2021 20:12:33 -0700 Message-Id: <20210414031240.313852-2-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> References: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org pci_fixup_irqs() used to call pcibios_map_irq on every PCI device, which for RT2880 included bus 0 slot 0. After pci_fixup_irqs() got removed, only slots/funcs with devices attached would be called. While arguably the right thing, that left no chance for this driver to ever initialize slot 0, effectively bricking PCI and USB on RT2880 devices such as the Belkin F5D8235-4 v1. Slot 0 configuration needs to happen after PCI bus enumeration, but before any device at slot 0x11 (func 0 or 1) is talked to. That was determined empirically by testing on a Belkin F5D8235-4 v1 device. A minimal BAR 0 config write followed by read, then setting slot 0 PCI_COMMAND to MASTER | IO | MEMORY is all that seems to be required for proper functionality. Tested by ensuring that full- and high-speed USB devices get enumerated on the Belkin F5D8235-4 v1 (with an out of tree DTS file from OpenWrt). Fixes: 04c81c7293df ("MIPS: PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks") Signed-off-by: Ilya Lipnitskiy Cc: Lorenzo Pieralisi Cc: Tobias Wolf Cc: # v4.14+ --- arch/mips/pci/pci-rt2880.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/arch/mips/pci/pci-rt2880.c b/arch/mips/pci/pci-rt2880.c index e1f12e398136..f1538d2be89e 100644 --- a/arch/mips/pci/pci-rt2880.c +++ b/arch/mips/pci/pci-rt2880.c @@ -180,7 +180,6 @@ static inline void rt2880_pci_write_u32(unsigned long reg, u32 val) int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) { - u16 cmd; int irq = -1; if (dev->bus->number != 0) @@ -188,8 +187,6 @@ int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) switch (PCI_SLOT(dev->devfn)) { case 0x00: - rt2880_pci_write_u32(PCI_BASE_ADDRESS_0, 0x08000000); - (void) rt2880_pci_read_u32(PCI_BASE_ADDRESS_0); break; case 0x11: irq = RT288X_CPU_IRQ_PCI; @@ -201,16 +198,6 @@ int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) break; } - pci_write_config_byte((struct pci_dev *) dev, - PCI_CACHE_LINE_SIZE, 0x14); - pci_write_config_byte((struct pci_dev *) dev, PCI_LATENCY_TIMER, 0xFF); - pci_read_config_word((struct pci_dev *) dev, PCI_COMMAND, &cmd); - cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | - PCI_COMMAND_INVALIDATE | PCI_COMMAND_FAST_BACK | - PCI_COMMAND_SERR | PCI_COMMAND_WAIT | PCI_COMMAND_PARITY; - pci_write_config_word((struct pci_dev *) dev, PCI_COMMAND, cmd); - pci_write_config_byte((struct pci_dev *) dev, PCI_INTERRUPT_LINE, - dev->irq); return irq; } @@ -251,6 +238,30 @@ static int rt288x_pci_probe(struct platform_device *pdev) int pcibios_plat_dev_init(struct pci_dev *dev) { + static bool slot0_init; + + /* + * Nobody seems to initialize slot 0, but this platform requires it, so + * do it once when some other slot is being enabled. The PCI subsystem + * should configure other slots properly, so no need to do anything + * special for those. + */ + if (!slot0_init && dev->bus->number == 0) { + u16 cmd; + u32 bar0; + + slot0_init = true; + + pci_bus_write_config_dword(dev->bus, 0, PCI_BASE_ADDRESS_0, + 0x08000000); + pci_bus_read_config_dword(dev->bus, 0, PCI_BASE_ADDRESS_0, + &bar0); + + pci_bus_read_config_word(dev->bus, 0, PCI_COMMAND, &cmd); + cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY; + pci_bus_write_config_word(dev->bus, 0, PCI_COMMAND, cmd); + } + return 0; } From patchwork Wed Apr 14 03:12:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12201783 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 852BCC433ED for ; Wed, 14 Apr 2021 03:13:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5FF77613B6 for ; Wed, 14 Apr 2021 03:13:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233052AbhDNDNn (ORCPT ); Tue, 13 Apr 2021 23:13:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232953AbhDNDNh (ORCPT ); Tue, 13 Apr 2021 23:13:37 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C57EC06175F; Tue, 13 Apr 2021 20:12:51 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id o123so12788726pfb.4; Tue, 13 Apr 2021 20:12:51 -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=I49umDhAy7qrhKAAA8aKGdOxSjLinV+njhS2bMCqgfY=; b=bhkXHTTqR/s8ug91Yn6OIvjfTBzExldD6y/nmhUcOGl4ldG87l65Wp2xO+jmmvQWzw pwV9SGjcB8Z4JRBWaoMjBX5z2MTqPNTP9sWxcDsISNyjPeak35OVooZh5gphCyJjPXCp lvuClb6b9GhyMJtrlYDWXmJTGAiOJ7LBbHhECfmeyUVr6AE693D9h61SkGXu+QnHivAl lzWgr7XH/20abQPSatBAE31yB7V6ZAcnSCMAz1L/5TUdJhhBLDLe6W3G68cmS4N2zAuo 3Db6/gEr3yfyUVIVwDG5h5kRse5LNB1kIasLHoL87B+41/n9lgZ+UInlw3cpk1brTXSO 5qbA== 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=I49umDhAy7qrhKAAA8aKGdOxSjLinV+njhS2bMCqgfY=; b=crkgtbzcBo0UH7ReywHJeQmLFoXppGOWV5BRWC0t4LfLytfCfxgN3A7dh9VhQOsuAk Am0RNb+LI+kGA4dZMxbHZ4TOUff3Z9DKkUtiohLlrLP6dIfNRYwyMlRCsRm59gfrBtFq Y+ZhIHQv0frRA0fLMEzXQGdqrYbn8XlAmgHB1wJk382VMGaR6CG/Z9jFigbXmrp/koED JTwIe3urH6nQ7dSAQXU5elJ2wGBDKV/tKHaFYbaML9yP7gQVqOQ0e7OSZ7Hr2t8P9hj+ 9XSqgIQrgMaJ+NAiXxMhhoTsv0WO6xHZhpGq3nP07DEBzxFfNCtCk4w+auZwTgJy7/sg 2zmw== X-Gm-Message-State: AOAM532X+YK2hAySdLYkGhQO27I2WLg9tphcC4d+vBI67YEfd8926RmZ B0xWo0kmX+FVvXXn8ndj9qg= X-Google-Smtp-Source: ABdhPJw9ED5YxT7WO7q0lRu/5avk8uwbp+MVNObH6Hg4mcHDJQVZCFIW4KP2A1DIN+tLLAOHGO0R4g== X-Received: by 2002:a63:130b:: with SMTP id i11mr15243105pgl.302.1618369971232; Tue, 13 Apr 2021 20:12:51 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id d17sm13971605pfo.117.2021.04.13.20.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 20:12:50 -0700 (PDT) From: Ilya Lipnitskiy To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Ryazanov Cc: Ilya Lipnitskiy Subject: [PATCH v2 2/8] MIPS: pci-rt2880: remove unneeded locks Date: Tue, 13 Apr 2021 20:12:34 -0700 Message-Id: <20210414031240.313852-3-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> References: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Mirror pci-rt3883 fix from commit e5067c718b3a ("MIPS: pci-rt3883: Remove odd locking in PCI config space access code"). pci-rt2880 shares the driver layout with pci-rt3883 and the same reasons apply. Caller (generic PCI code) already does proper locking, so no need to add another one here. Local PCI read/write functions are never called simultaneously, also they do not require synchronization with the PCI controller ops, since they are used before the controller registration. Suggested-by: Sergey Ryazanov Signed-off-by: Ilya Lipnitskiy Reviewed-by: Sergey Ryazanov --- arch/mips/pci/pci-rt2880.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/arch/mips/pci/pci-rt2880.c b/arch/mips/pci/pci-rt2880.c index f1538d2be89e..e9dd01431f21 100644 --- a/arch/mips/pci/pci-rt2880.c +++ b/arch/mips/pci/pci-rt2880.c @@ -41,7 +41,6 @@ #define RT2880_PCI_REG_ARBCTL 0x80 static void __iomem *rt2880_pci_base; -static DEFINE_SPINLOCK(rt2880_pci_lock); static u32 rt2880_pci_reg_read(u32 reg) { @@ -63,17 +62,14 @@ static inline u32 rt2880_pci_get_cfgaddr(unsigned int bus, unsigned int slot, static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) { - unsigned long flags; u32 address; u32 data; address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), where); - spin_lock_irqsave(&rt2880_pci_lock, flags); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); - spin_unlock_irqrestore(&rt2880_pci_lock, flags); switch (size) { case 1: @@ -93,14 +89,12 @@ static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn, static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val) { - unsigned long flags; u32 address; u32 data; address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), where); - spin_lock_irqsave(&rt2880_pci_lock, flags); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); @@ -119,7 +113,6 @@ static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn, } rt2880_pci_reg_write(data, RT2880_PCI_REG_CONFIG_DATA); - spin_unlock_irqrestore(&rt2880_pci_lock, flags); return PCIBIOS_SUCCESSFUL; } @@ -151,31 +144,25 @@ static struct pci_controller rt2880_pci_controller = { static inline u32 rt2880_pci_read_u32(unsigned long reg) { - unsigned long flags; u32 address; u32 ret; address = rt2880_pci_get_cfgaddr(0, 0, 0, reg); - spin_lock_irqsave(&rt2880_pci_lock, flags); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); ret = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); - spin_unlock_irqrestore(&rt2880_pci_lock, flags); return ret; } static inline void rt2880_pci_write_u32(unsigned long reg, u32 val) { - unsigned long flags; u32 address; address = rt2880_pci_get_cfgaddr(0, 0, 0, reg); - spin_lock_irqsave(&rt2880_pci_lock, flags); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); rt2880_pci_reg_write(val, RT2880_PCI_REG_CONFIG_DATA); - spin_unlock_irqrestore(&rt2880_pci_lock, flags); } int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) From patchwork Wed Apr 14 03:12:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12201793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C03DC433ED for ; Wed, 14 Apr 2021 03:13:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 266F7613B1 for ; Wed, 14 Apr 2021 03:13:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232953AbhDNDNr (ORCPT ); Tue, 13 Apr 2021 23:13:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232956AbhDNDNh (ORCPT ); Tue, 13 Apr 2021 23:13:37 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CB06C06138C; Tue, 13 Apr 2021 20:12:52 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id i190so12775619pfc.12; Tue, 13 Apr 2021 20:12:52 -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=gB2Y5Ee6tQXNfuASCG1AntUHngSRzeeF+IbJPgKxOeg=; b=c6DzTECGFr2NKizGLEiVq3XztDMAij+0ddzvSLicuH0cwo3bLFksnk7dJ9gHEY5qAG dbGJb9bvvV7IyHHqkibbIZ7+DgG5K0H4ZKfAFbHYin65ZY5zsfI192gfMEwazIHGiHSm AUaHdkYzFg+JX4KfvKn/mkxVjRcSPx/0s/dyJOyPcN4ipLFpkCY5Sf4n8yKDmItWURL+ NKbv0ARen7sCVelX5J2rl8cp0YWlMZQEL2WULxqOhU57fPqzCBYxnLcHVENrUmXlY0YV 9dD3iho3FwzJreVeujM+G8rIT5E4LiNoTShFHu0xzhefD5SrEronjKlS2nDSNtzlKQMK 5Xog== 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=gB2Y5Ee6tQXNfuASCG1AntUHngSRzeeF+IbJPgKxOeg=; b=RRklsg5VFYr7kXJ7QWh8QK746BTvEy0Z0Y6y4/e3QY9PrgWtN0x3GNSZQYMkx0oZop guFdluLHyBhLeT+SzbtPhHpH0tl2RcaKhEbyr2fY5NIDlvbAN4c9PX5n7oXX8lGMgIle w8J1XQBsqyKEEnRPdS5fW8/7lnjFS64nMbJisKn2nzBIIqojNn7czGvGmPzlaUDVrKKn gpwWfSj/N7jVaE78k/4GxMzOtROBPadJhOaS1p5mxNW8qjM+PaRrl/VX5BM7QDnJr+j4 VKpc4fGC4jx0QrsNAZEPospZoyd/bDMS6mOkIME0LGchnM8MYRT49WZIMaf1FPHU2C5z aIpA== X-Gm-Message-State: AOAM533X47VgzzP4xfL5DvP2aJHNacVn77Yu2Vq285BlTIbwaiu2Kmhq Pl82C1xWqCl+maGN2kJum2A= X-Google-Smtp-Source: ABdhPJx6GWTyrDQfMDM638g0cQJcm6ON9JFBJQ9QZDEXA/05YCgDY/LrH8zX5dsFz6ULc+OjeB9wyg== X-Received: by 2002:aa7:8a47:0:b029:24e:22de:de6a with SMTP id n7-20020aa78a470000b029024e22dede6amr10821817pfa.20.1618369971998; Tue, 13 Apr 2021 20:12:51 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id d17sm13971605pfo.117.2021.04.13.20.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 20:12:51 -0700 (PDT) From: Ilya Lipnitskiy To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Ryazanov Cc: Ilya Lipnitskiy , trivial@kernel.org Subject: [PATCH v2 3/8] MIPS: pci-rt3883: trivial: remove unused variable Date: Tue, 13 Apr 2021 20:12:35 -0700 Message-Id: <20210414031240.313852-4-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> References: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Fixes the following compiler warning: warning: unused variable 'flags' [-Wunused-variable] Fixes: e5067c718b3a ("MIPS: pci-rt3883: Remove odd locking in PCI config space access code") Signed-off-by: Ilya Lipnitskiy Acked-by: Sergey Ryazanov Cc: trivial@kernel.org --- arch/mips/pci/pci-rt3883.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c index 0ac6346026d0..e422f78db5bc 100644 --- a/arch/mips/pci/pci-rt3883.c +++ b/arch/mips/pci/pci-rt3883.c @@ -100,7 +100,6 @@ static u32 rt3883_pci_read_cfg32(struct rt3883_pci_controller *rpc, unsigned bus, unsigned slot, unsigned func, unsigned reg) { - unsigned long flags; u32 address; u32 ret; @@ -116,7 +115,6 @@ static void rt3883_pci_write_cfg32(struct rt3883_pci_controller *rpc, unsigned bus, unsigned slot, unsigned func, unsigned reg, u32 val) { - unsigned long flags; u32 address; address = rt3883_pci_get_cfgaddr(bus, slot, func, reg); @@ -229,7 +227,6 @@ static int rt3883_pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) { struct rt3883_pci_controller *rpc; - unsigned long flags; u32 address; u32 data; @@ -263,7 +260,6 @@ static int rt3883_pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val) { struct rt3883_pci_controller *rpc; - unsigned long flags; u32 address; u32 data; From patchwork Wed Apr 14 03:12:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12201785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E065C433B4 for ; Wed, 14 Apr 2021 03:13:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21DDB613B6 for ; Wed, 14 Apr 2021 03:13:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233075AbhDNDNo (ORCPT ); Tue, 13 Apr 2021 23:13:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232943AbhDNDNh (ORCPT ); Tue, 13 Apr 2021 23:13:37 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CBF3C06138D; Tue, 13 Apr 2021 20:12:53 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id w10so13408073pgh.5; Tue, 13 Apr 2021 20:12:53 -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=KyKCHbVUuM78DLJQ6iKYbE/8/YHUHid6Z5P0PEZg9RQ=; b=NAvH4TmqSeGm98xrtWJRUm6UZo4ZvRLXQaMtG2RW+EykdYihgB+RCLHvu4sNiil1qr lQlHUtBTBHzvnxu1ArOPxvXsKJnvdFFbnfqTKBpnvLTQfBxBMKIPRkF/fF0P1tdmq7O0 5nw603ZGRB+jmnorM0hEwLv4j9AqfcGWGt7i6UTja4IUyGNaT27N4dsnbAAcxGwkOj/P mt2ds2DhK48KBRrkclktwmWRMQjwCqC9zj9M5hqDXXfK56FoOvADrDgKMMsIayLjKdJY n/svZ4fTI/NHFbi1vepRMeM/d6G/GQwSz2CPGt0kDv+PMFi9lPf6Egf+BpQRRGol7cBh VVeA== 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=KyKCHbVUuM78DLJQ6iKYbE/8/YHUHid6Z5P0PEZg9RQ=; b=TPrSLVGc8UJlb3b639JNlR04xsWNIO8qFKLPy74W/IlJzVreJJ2h/7yCtmWsQc6fno LRkftzyjmjrMQq80ImeCeHdt+ZcixR2Sg5Z2griUie1v5LX3tbclFa0Be0g+FcbrSpHI E8A1jXi5vXejWF9nAaizm1Pe6ASLDNPMKmRFkSeBF7lWRSpafeQ7k1+7U1NuRMvuHN2J nb5oEk944ItMnz3p+njORizLETJyicjnh+11kG8BfGvN8kAXUQbV58EyrKbdxMNBN/zz S52AfjiLVDemBHlCahGlaiYNiRO51i/cFM1ZBu9WFrdGnHqRLO1tMZwfBfMSXJWHKM07 Osig== X-Gm-Message-State: AOAM532hrdLMqxojGY25WclvTSXo4idsJwwG5u/iClkIhel1HsO4iBBy 2h/73VWsLkMF9uQRIBGluE0= X-Google-Smtp-Source: ABdhPJyXtbiA38TQC4u9VoGMx2W05l+/EbEFz1ZPyQWp7g7rALrdYnfcrN0chDS3KRZlVi6dmlc/jQ== X-Received: by 2002:a63:c66:: with SMTP id 38mr35659580pgm.69.1618369972830; Tue, 13 Apr 2021 20:12:52 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id d17sm13971605pfo.117.2021.04.13.20.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 20:12:52 -0700 (PDT) From: Ilya Lipnitskiy To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Ryazanov Cc: Ilya Lipnitskiy Subject: [PATCH v2 4/8] MIPS: pci-rt3883: more accurate DT error messages Date: Tue, 13 Apr 2021 20:12:36 -0700 Message-Id: <20210414031240.313852-5-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> References: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Existing strings do not make sense: one is always NULL and the other refers to the wrong parent node. Signed-off-by: Ilya Lipnitskiy --- arch/mips/pci/pci-rt3883.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c index e422f78db5bc..aebd4964ea34 100644 --- a/arch/mips/pci/pci-rt3883.c +++ b/arch/mips/pci/pci-rt3883.c @@ -431,8 +431,7 @@ static int rt3883_pci_probe(struct platform_device *pdev) if (!rpc->intc_of_node) { dev_err(dev, "%pOF has no %s child node", - rpc->intc_of_node, - "interrupt controller"); + np, "interrupt controller"); return -EINVAL; } @@ -446,8 +445,7 @@ static int rt3883_pci_probe(struct platform_device *pdev) if (!rpc->pci_controller.of_node) { dev_err(dev, "%pOF has no %s child node", - rpc->intc_of_node, - "PCI host bridge"); + np, "PCI host bridge"); err = -EINVAL; goto err_put_intc_node; } From patchwork Wed Apr 14 03:12:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12201795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45F4CC433B4 for ; Wed, 14 Apr 2021 03:13:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23968613B6 for ; Wed, 14 Apr 2021 03:13:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233169AbhDNDNs (ORCPT ); Tue, 13 Apr 2021 23:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232981AbhDNDNk (ORCPT ); Tue, 13 Apr 2021 23:13:40 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CCA4C06138E; Tue, 13 Apr 2021 20:12:54 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id w8so9314443pfn.9; Tue, 13 Apr 2021 20:12:54 -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=TwYVR02YUIROEysawud1U32OvU6J+qaFmj26Z/Sycfc=; b=EIh5fxJtzBXfY56I/RXhnvQ2XGXaLd4A8j86jLEQ2fzZNm8uon7W57ZAtqOAUb7Xqk KJMZnokPYpDhp4vOQCdTKsVvEJjuQ0W8dlfEIeBQLnqcp0ixjSod2Q805vERHHKwWQmz 4CJ9ys5O55IYaGMRXCBeOFZyYDw2yLkUsiM0PVa4Ak2NacSM1EnjuMEVcqrb+PCWLnMb JHrPCz59xTBvbWW/trCakxNnWMj9P95OwNP5S6vdQnT9nKcxLYmO50XUVajyDg5Gqkd/ GF8hQ4L+56db/FbVXDI3WtFUXQvSrDdIiUNAPnTmzOIM8n3mEKfvWX8WcPcjLIsWHnXO UUgA== 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=TwYVR02YUIROEysawud1U32OvU6J+qaFmj26Z/Sycfc=; b=mewN/q8XsANagTqJtOmXYtd5jzAZDJvuAYQ2TUjQGqJ09av6vhw4OEEb2wJuVHSf8d 7Z/185TxFMWzd7N2YtGkq1eH7KPJZX9noIGjruRIR+JFaL58IaZ3YrSj41aQ0HCAFKX/ 1r29IDZcTGIa6B6EKtxn2aGggAGdPXRjD+FFxw+EJVG6BYOR/8CbRqrvIs6YV58TSnf9 GqwvRstljSSU6brP9BHhNswk2wX19fE7QqDP1jKx2OcubuVOAF3YGESdQO+8JnSUmPlC 0+o5H4GQu4EJPiR6Cd22yilZBHD0gL1zk7yj0CI1A53RGYids1gRzC4R5wMMBi092jGC i3zw== X-Gm-Message-State: AOAM531sPStAUb3KFGY3Ea30/T7Y9yTGvlbFUq8rdavfU7d2dltoILGb Hzyz/FGE3TMIFUVedhMhWGE= X-Google-Smtp-Source: ABdhPJxDh6XsNuKoi7zTxG8Bw/lpTppmcML+JLevDNNMYpXf/IRxOJRKhm1jtlANGFXck7o9Y4aTGQ== X-Received: by 2002:a63:1716:: with SMTP id x22mr35851862pgl.261.1618369973731; Tue, 13 Apr 2021 20:12:53 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id d17sm13971605pfo.117.2021.04.13.20.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 20:12:53 -0700 (PDT) From: Ilya Lipnitskiy To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Ryazanov Cc: Ilya Lipnitskiy , Liviu Dudau Subject: [PATCH v2 5/8] MIPS: pci-legacy: stop using of_pci_range_to_resource Date: Tue, 13 Apr 2021 20:12:37 -0700 Message-Id: <20210414031240.313852-6-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> References: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Mirror commit aeba3731b150 ("powerpc/pci: Fix IO space breakage after of_pci_range_to_resource() change"). Most MIPS platforms do not define PCI_IOBASE, nor implement pci_address_to_pio(). Moreover, IO_SPACE_LIMIT is 0xffff for most MIPS platforms. of_pci_range_to_resource passes the _start address_ of the IO range into pci_address_to_pio, which then checks it against IO_SPACE_LIMIT and fails, because for MIPS platforms that use pci-legacy (pci-lantiq, pci-rt3883, pci-mt7620), IO ranges start much higher than 0xffff. In fact, pci-mt7621 in staging already works around this problem, see commit 09dd629eeabb ("staging: mt7621-pci: fix io space and properly set resource limits") So just stop using of_pci_range_to_resource, which does not work for MIPS. Fixes PCI errors like: pci_bus 0000:00: root bus resource [io 0xffffffff] Fixes: 0b0b0893d49b ("of/pci: Fix the conversion of IO ranges into IO resources") Signed-off-by: Ilya Lipnitskiy Cc: Liviu Dudau Reviewed-by: Liviu Dudau --- arch/mips/pci/pci-legacy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c index 39052de915f3..3a909194284a 100644 --- a/arch/mips/pci/pci-legacy.c +++ b/arch/mips/pci/pci-legacy.c @@ -166,8 +166,13 @@ void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node) res = hose->mem_resource; break; } - if (res != NULL) - of_pci_range_to_resource(&range, node, res); + if (res != NULL) { + res->name = node->full_name; + res->flags = range.flags; + res->start = range.cpu_addr; + res->end = range.cpu_addr + range.size - 1; + res->parent = res->child = res->sibling = NULL; + } } } From patchwork Wed Apr 14 03:12:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12201797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE850C43460 for ; Wed, 14 Apr 2021 03:13:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9566C613B6 for ; Wed, 14 Apr 2021 03:13:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233205AbhDNDNs (ORCPT ); Tue, 13 Apr 2021 23:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233003AbhDNDNk (ORCPT ); Tue, 13 Apr 2021 23:13:40 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CD05C06138F; Tue, 13 Apr 2021 20:12:54 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id d10so13390132pgf.12; Tue, 13 Apr 2021 20:12:54 -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=MEVWTDjaKURrh58TF/87I+8ZbA6Ugd6pjE5oioMoAPY=; b=KYIfk4vhMnu0oFpPLZ+Ozcu44449T31i1HIbcAs82xVtXjLgSy/6fU3ZP+Xv2kue2E wIjiUhhS5EITHrQrZG84n/x5RhBd8ocFkRChMpH6CSJoqC7G4p7jnOoq8DFwtHI4LzTw EdNK/kun4Pveg2DqFIe0v0VhbZYhMMrc4+GpKeMt7W2S+wis+8ZpG5BWS/PaWWnMj9u1 3ZFkmCglLpVeGFkFwsDC+PCwYGuXM5iPJ7cH5t0CviAhjQh0LRYdIJcBwkt3RSlEUzUb L/5A0PUplsPfJnTeu0e8Y0yeGO6Pj3G3ksjSTr8RjNXJeSIBsa3H/34960vF2aUmiDib 2QHA== 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=MEVWTDjaKURrh58TF/87I+8ZbA6Ugd6pjE5oioMoAPY=; b=AdGmymH4HxbLfrtNZlPB1fTJLsimyxW1a7WM3fDZtX5MguFfRkWciHCS7umUX23PaE UFBLjpFLKLI2SqO6wGj3QIY7s7dBYsvLCs9dqkK4kgMOtHZ2hweUQqnzehVq84ALQ+/6 JDMJwZ8LiWnylNPdiAnBLiX8sS5/ATnL+daXo2wJ2v5HDLjVUsuALopmNPIMNXv0brMp S4QdkGfsc9Dn9YFLp/rD/W0bt8SPnC9ERzHsYV2Wcj6N2yO2Bhc0HbGX6oDCjC20L27I gLQKUuLtnir65pOByoCRbq0SthQExrDNxbvP6F8qmLpJpRRNY8VUZDxhtOoPeOpwZZNA 3qLw== X-Gm-Message-State: AOAM532bQKLg5J5NlNRwaAQLZLJiQsxD9t2srVaPBxS+kWkf6ypxN7FJ tJu2SP0vb1XBJsfBGdcT3E0= X-Google-Smtp-Source: ABdhPJy/Saqg7s5/Xx6OiPJkkhUC9ul7t4rrjSgher/YbcDRTvXEF/BFmR9DPeJ7wFZgXsnnRU6yKA== X-Received: by 2002:a65:420d:: with SMTP id c13mr4328951pgq.370.1618369974274; Tue, 13 Apr 2021 20:12:54 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id d17sm13971605pfo.117.2021.04.13.20.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 20:12:54 -0700 (PDT) From: Ilya Lipnitskiy To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Ryazanov Cc: Ilya Lipnitskiy Subject: [PATCH v2 6/8] MIPS: pci-legacy: remove redundant info messages Date: Tue, 13 Apr 2021 20:12:38 -0700 Message-Id: <20210414031240.313852-7-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> References: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Remove the following pci-legacy message: PCI host bridge /pci@440000/host-bridge ranges: MEM 0x0000000020000000..0x000000002fffffff IO 0x0000000000460000..0x000000000046ffff It is followed shortly by the same data from pci_register_host_bridge: PCI host bridge to bus 0000:00 pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff] pci_bus 0000:00: root bus resource [io 0x460000-0x46ffff] Signed-off-by: Ilya Lipnitskiy --- arch/mips/pci/pci-legacy.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c index 3a909194284a..ec3f52ade72d 100644 --- a/arch/mips/pci/pci-legacy.c +++ b/arch/mips/pci/pci-legacy.c @@ -140,7 +140,6 @@ void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node) struct of_pci_range range; struct of_pci_range_parser parser; - pr_info("PCI host bridge %pOF ranges:\n", node); hose->of_node = node; if (of_pci_range_parser_init(&parser, node)) @@ -151,18 +150,12 @@ void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node) switch (range.flags & IORESOURCE_TYPE_BITS) { case IORESOURCE_IO: - pr_info(" IO 0x%016llx..0x%016llx\n", - range.cpu_addr, - range.cpu_addr + range.size - 1); hose->io_map_base = (unsigned long)ioremap(range.cpu_addr, range.size); res = hose->io_resource; break; case IORESOURCE_MEM: - pr_info(" MEM 0x%016llx..0x%016llx\n", - range.cpu_addr, - range.cpu_addr + range.size - 1); res = hose->mem_resource; break; } From patchwork Wed Apr 14 03:12:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12201791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6653AC433B4 for ; Wed, 14 Apr 2021 03:13:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3692C613B6 for ; Wed, 14 Apr 2021 03:13:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233145AbhDNDNr (ORCPT ); Tue, 13 Apr 2021 23:13:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233034AbhDNDNl (ORCPT ); Tue, 13 Apr 2021 23:13:41 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D8A7C061342; Tue, 13 Apr 2021 20:12:55 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id t22so13435617pgu.0; Tue, 13 Apr 2021 20:12:55 -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=FzDdk9WeLMndWaHg27kx8Y0bv03vlpf64XRRJIexZMY=; b=rMs12k1nN+9e46i1SN3FTw6/fW7UBNLrwg7B118XsAMSgU3NzY7IA+tu6CFwtZ31Xz M+x0fLC8aFh8KQFQSRznIoc9dmFQQWBATHNyjg0UGj8sRVISXabi+fX3+yqHnqF8XqWH uudQgJ3XKJqP6DF/QVc5BjgLW22qhzxlqKvF1/BHyQVQLnxFp5AK+D/gZZkRZMAd1S9y EtfV/PK3ckVtPp0BUn8/xlFPwhKpHl7cV7Y9oGRaO1TxV5SOky1WGbqAxh207VK/xiFJ RzhVFQN7W67R3UDXZEphNpSH2FCjnVFnNVVs0y7sgvA6FKFi8H1/mDklhDlDn6yTRkfl Hs5g== 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=FzDdk9WeLMndWaHg27kx8Y0bv03vlpf64XRRJIexZMY=; b=cymhaLj1AT1sMYnbD/3RXUhIZoWe7Ab93x4GFiLiIzKWIrs3YMfKAdaCORwESTuQm7 YhFK5mc4k/BYSLtKYeoBeiMibrRaHb+84ccV7cbRKeOPromrMZj34jID9qg7GrtTZEJ9 +GlX2uPAvaSi7N2OeQ9haP4HJFjoh+FceaVGHEqHuJpdeR8HzpoUw3CuntuTuVlgM0R1 bis40dZwTOSG/QqTwy2qhjPwmw4bnSIfc6g0CZohgl8l46VD1CKIAA0nkqkh1MCBfW2n p1s+1JIIqYy1Zc0Nzd79cilbpADjwFAf0xY7QImr5N17ieyqXPHuva0ouLsnBJeuRdMh 7F0A== X-Gm-Message-State: AOAM533DoU6vxCSc2eSwyzG4GgmDvT0Hu9T0SXG8VgsJC1gqu/vx0Fgu RuVja3jXAbyPExQiRjWdAnM= X-Google-Smtp-Source: ABdhPJyKwOauVqaLgQWQi0pDSZOjy4RYyiyQGjz1v2Rb8nArW4Ji3qLqoJyrCQm/6AlAOiGdAy12JQ== X-Received: by 2002:a63:3485:: with SMTP id b127mr34879352pga.168.1618369975322; Tue, 13 Apr 2021 20:12:55 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id d17sm13971605pfo.117.2021.04.13.20.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 20:12:54 -0700 (PDT) From: Ilya Lipnitskiy To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Ryazanov Cc: Ilya Lipnitskiy , Bjorn Helgaas Subject: [PATCH v2 7/8] MIPS: pci-legacy: remove busn_resource field Date: Tue, 13 Apr 2021 20:12:39 -0700 Message-Id: <20210414031240.313852-8-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> References: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org No drivers set the busn_resource field in the pci_controller struct. Commit 7ee214b540d9 ("MIPS: PCI: Remove unused busn_offset") almost removed it over 3 years ago. Remove it for good to free up memory and eliminate messages like: pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0] Signed-off-by: Ilya Lipnitskiy Cc: Bjorn Helgaas --- arch/mips/include/asm/pci.h | 1 - arch/mips/pci/pci-legacy.c | 1 - 2 files changed, 2 deletions(-) diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h index 6f48649201c5..9ffc8192adae 100644 --- a/arch/mips/include/asm/pci.h +++ b/arch/mips/include/asm/pci.h @@ -38,7 +38,6 @@ struct pci_controller { struct resource *io_resource; unsigned long io_offset; unsigned long io_map_base; - struct resource *busn_resource; #ifndef CONFIG_PCI_DOMAINS_GENERIC unsigned int index; diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c index ec3f52ade72d..78c22987bef0 100644 --- a/arch/mips/pci/pci-legacy.c +++ b/arch/mips/pci/pci-legacy.c @@ -89,7 +89,6 @@ static void pcibios_scanbus(struct pci_controller *hose) hose->mem_resource, hose->mem_offset); pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset); - pci_add_resource(&resources, hose->busn_resource); list_splice_init(&resources, &bridge->windows); bridge->dev.parent = NULL; bridge->sysdata = hose; From patchwork Wed Apr 14 03:12:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12201799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CC39C433ED for ; Wed, 14 Apr 2021 03:13:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A4F8613B1 for ; Wed, 14 Apr 2021 03:13:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233236AbhDNDNu (ORCPT ); Tue, 13 Apr 2021 23:13:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233040AbhDNDNl (ORCPT ); Tue, 13 Apr 2021 23:13:41 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D964C061343; Tue, 13 Apr 2021 20:12:56 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id p12so13400066pgj.10; Tue, 13 Apr 2021 20:12:56 -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=WdjBbv3W8zOpO+oAoTMTaxs43N139rhZL18fdEB0EnQ=; b=JjTjIJtUgdP9wPhG5iHFZeDhAi/giO6t/melgnyajlIUqZR7gJY4heAroAI4/D9xNH 6jkPcZjaq7WnZAZ9HzBGReV32crQh8BdHt396ECFJc9aZ264AVGvYpgw5p7aZPcOUKKc OixYrPpx4K75VxK4oR7PrFTZF/OzZmD780Hn/lviljUBFGp1Y12L6OwPSWDb7zViZeKe BnYjBsMiYVDld0M2uS+82U10q96redDWQuWw8gX5wIcyS26Ncc+nzDviuPEuBDPfJEO6 Nsi3qF8AtA10Effjh1mk5o+8PfemzedomPw8cd8rOvSYHbQzlELztEtWnlzQ5ForTkzq 7P8Q== 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=WdjBbv3W8zOpO+oAoTMTaxs43N139rhZL18fdEB0EnQ=; b=T7br8S3JXgRdO99XJxr0gxM4DkTIDDiTrrLt9LXxisWekum3hLdnvzKyyb9/zCyHxF I3YTxZBCLpBdbl+OhPTqSGm1dvbZW2P6k8Iz1ab3lGVsl/xAvaUkXD4/8pYjrQfOsTpg d74wfO7pqMwJHYTxUPX4yiFbR9eSlrGW26geH/3TRyJ7RNfA73lceH9L/5+7apsGze0w 8Tzx039qHHGtns0kjeJV537SANlFwQttvr7xDdzRdOx5UGrR1lM6LPQj1XZGHXOrfqXC nbPCZOU+rHc+wd5fVfcupGDWU9q8Y1zIQ8SFota71gQglMmU1/iP7DZdoPktg32dZlUZ eflw== X-Gm-Message-State: AOAM531o+VcB3q9Lch3GFEwr2L5hYRYoRB5staL7BZ7s0J/JdbYoiI1L V1x/aRxMt4ou+SS29HlctiOILfAITrsy790G X-Google-Smtp-Source: ABdhPJxFD1I9Zx+je5HYP4AF3SFTpE2lxP6xYXGztExaw88d+1NCy/E6D4qUklY41kunmeFeOVrtxQ== X-Received: by 2002:a63:d05:: with SMTP id c5mr5250463pgl.76.1618369976021; Tue, 13 Apr 2021 20:12:56 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id d17sm13971605pfo.117.2021.04.13.20.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 20:12:55 -0700 (PDT) From: Ilya Lipnitskiy To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Ryazanov Cc: Ilya Lipnitskiy , Bjorn Helgaas Subject: [PATCH v2 8/8] MIPS: pci-legacy: use generic pci_enable_resources Date: Tue, 13 Apr 2021 20:12:40 -0700 Message-Id: <20210414031240.313852-9-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> References: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Follow the reasoning from commit 842de40d93e0 ("PCI: add generic pci_enable_resources()"): The only functional difference from the MIPS version is that the generic one uses "!r->parent" to check for resource collisions instead of "!r->start && r->end". That should have no effect on any pci-legacy driver. Suggested-by: Bjorn Helgaas Signed-off-by: Ilya Lipnitskiy --- arch/mips/pci/pci-legacy.c | 40 ++------------------------------------ 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c index 78c22987bef0..c24226ea0a6e 100644 --- a/arch/mips/pci/pci-legacy.c +++ b/arch/mips/pci/pci-legacy.c @@ -241,47 +241,11 @@ static int __init pcibios_init(void) subsys_initcall(pcibios_init); -static int pcibios_enable_resources(struct pci_dev *dev, int mask) -{ - u16 cmd, old_cmd; - int idx; - struct resource *r; - - pci_read_config_word(dev, PCI_COMMAND, &cmd); - old_cmd = cmd; - for (idx=0; idx < PCI_NUM_RESOURCES; idx++) { - /* Only set up the requested stuff */ - if (!(mask & (1<resource[idx]; - if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM))) - continue; - if ((idx == PCI_ROM_RESOURCE) && - (!(r->flags & IORESOURCE_ROM_ENABLE))) - continue; - if (!r->start && r->end) { - pci_err(dev, - "can't enable device: resource collisions\n"); - return -EINVAL; - } - if (r->flags & IORESOURCE_IO) - cmd |= PCI_COMMAND_IO; - if (r->flags & IORESOURCE_MEM) - cmd |= PCI_COMMAND_MEMORY; - } - if (cmd != old_cmd) { - pci_info(dev, "enabling device (%04x -> %04x)\n", old_cmd, cmd); - pci_write_config_word(dev, PCI_COMMAND, cmd); - } - return 0; -} - int pcibios_enable_device(struct pci_dev *dev, int mask) { - int err; + int err = pci_enable_resources(dev, mask); - if ((err = pcibios_enable_resources(dev, mask)) < 0) + if (err < 0) return err; return pcibios_plat_dev_init(dev);