From patchwork Sat Jun 19 06:39:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Lapkin X-Patchwork-Id: 12332711 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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 37011C2B9F4 for ; Sat, 19 Jun 2021 06:40:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8C8F611CC for ; Sat, 19 Jun 2021 06:40:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8C8F611CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LvXTANDCDNFuK5A/13opgazPC32VDaY05+uKp+LahNI=; b=Us3mGV9+Bu6w1/ g/5WeJeHOeTLp5JRzfKb4onmylsVqksVxcr/sWJXRh9s0wN4CacTmhHvI7Wblmvjaxft0wASuVu8v JWoORstBMdVYV558Ji7XtlOyuva1BSpP66qjle8HtNsoxIFtiWgUwhYzin4Pp5jDBmDcozTjV1/0K 6IeoEzL9dg5xWxoa+sWiDWSsjC53kvKvzL5TucBLnS09cCoELshd+PxAtJJOgiihufPVALD/ue6aI BFjqjblowrHULF4pj38UAN9l6Nx3Ne7mAX4trRFeNsGDLpxTzBmnzhdAVwJ0JAaAfMLuoYQqqN4Ys aEhCkZ38V3m/Rn/HqPsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luUef-00GUge-O2; Sat, 19 Jun 2021 06:40:33 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luUeO-00GUcZ-5w; Sat, 19 Jun 2021 06:40:17 +0000 Received: by mail-pg1-x533.google.com with SMTP id e33so9700932pgm.3; Fri, 18 Jun 2021 23:40: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:in-reply-to:references :mime-version:content-transfer-encoding; bh=cTrGZor3giFSILahtV27RiFLtW55t+UVcQqePFHTEzI=; b=XcNwAOt4Iaca+5I7ng6jQeAUgDZQdzV4x+GsaNGBPWqmAq4s8U5PZ4FfMEEBZWsnbg /iO6gOOw4+uCrfX34VEFStsCbq5OOVSZU/ESNU4tiGHnzD6FZawjxIUXwzBkkNqzpgc5 UGdbvD03/Iw8AXIprWT5hpsLEXL9iVNGb2jW07IN+7MfStS/TW0/j6X+BaodroEsueSd e3xddEaEP1QuOJTWLD2u1Zm9jas4qm741gSJBMa7Z1mwQzzqY8GxzNXCQkBruUjqWvk5 FWmGoaGpOLc9QbblLOdV+JRTA5FspI/0o8WWSnghAPnHFy7HtUChgdBAP7nuQmYErDVx r1sg== 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=cTrGZor3giFSILahtV27RiFLtW55t+UVcQqePFHTEzI=; b=BhyChHHsdCXbVZU8pdXDmU38qCwy2mG+Cg6unfGs+bNZhuvatlMOmMxghZrXhvE4pV 9VU4TVofxVqK7TEQsxigCLySL1J60g4Pdhm+xLzq37k/3fncSPY3u99HqDrHCgIIwV75 TZEt/ez6kH20kuuC/ezbqcXGvDKvL++PHYPQ64oqWuztNIWypNohp/r6H9kFe5XyNyia 4g4g/4G3Cdq7bq8L55M2Snz/Q86V0ys9pd5vd80UxFe8cRsauKEWCrSAcyeGNSaCWtGk amvzo1uoNop72PZqh/SrJDdgiBS7XabUbFeNhyZVTxFd0JBeavSJysUJ+foZ565CoZun /yXA== X-Gm-Message-State: AOAM533WYyTk6OHBCGmcdvO2jtzdak3qODEASKkGI7I21He94H7FyhCO NcKqbu7If5IzXeRPYVAiau8= X-Google-Smtp-Source: ABdhPJywWDZq3dgNDKtQB7s+bDUb2ze2dkeB2P4aHX12qoZcnCaeqhQ+Sct5O2yT2zz/apKFljN1qw== X-Received: by 2002:a63:ff20:: with SMTP id k32mr13898803pgi.82.1624084814388; Fri, 18 Jun 2021 23:40:14 -0700 (PDT) Received: from localhost.localdomain (199.19.111.227.16clouds.com. [199.19.111.227]) by smtp.gmail.com with ESMTPSA id r19sm9440274pfh.152.2021.06.18.23.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 23:40:13 -0700 (PDT) From: Artem Lapkin X-Google-Original-From: Artem Lapkin To: narmstrong@baylibre.com Cc: yue.wang@Amlogic.com, khilman@baylibre.com, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, jbrunet@baylibre.com, christianshewitt@gmail.com, martin.blumenstingl@googlemail.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, art@khadas.com, nick@khadas.com, gouwa@khadas.com Subject: [PATCH 1/4] PCI: move Keystone and Loongson device IDs to pci_ids Date: Sat, 19 Jun 2021 14:39:49 +0800 Message-Id: <20210619063952.2008746-2-art@khadas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619063952.2008746-1-art@khadas.com> References: <20210619063952.2008746-1-art@khadas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210618_234016_270197_8AAF962D X-CRM114-Status: UNSURE ( 7.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Moved from * drivers/pci/controller/dwc/pci-keystone.c * drivers/pci/controller/pci-loongson.c Signed-off-by: Artem Lapkin --- include/linux/pci_ids.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 4c3fa5293d76..e19d224bbca8 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -151,6 +151,9 @@ /* Vendors and devices. Sort key: vendor first, device next. */ #define PCI_VENDOR_ID_LOONGSON 0x0014 +#define PCI_DEVICE_ID_LOONGSON_PCIE_PORT_0 0x7a09 +#define PCI_DEVICE_ID_LOONGSON_PCIE_PORT_1 0x7a19 +#define PCI_DEVICE_ID_LOONGSON_PCIE_PORT_2 0x7a29 #define PCI_VENDOR_ID_TTTECH 0x0357 #define PCI_DEVICE_ID_TTTECH_MC322 0x000a @@ -885,6 +888,10 @@ #define PCI_DEVICE_ID_TI_J721E 0xb00d #define PCI_DEVICE_ID_TI_DRA74x 0xb500 #define PCI_DEVICE_ID_TI_DRA72x 0xb501 +#define PCI_DEVICE_ID_TI_RC_K2HK 0xb008 +#define PCI_DEVICE_ID_TI_RC_K2E 0xb009 +#define PCI_DEVICE_ID_TI_RC_K2L 0xb00a +#define PCI_DEVICE_ID_TI_RC_K2G 0xb00b #define PCI_VENDOR_ID_SONY 0x104d From patchwork Sat Jun 19 06:39:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Lapkin X-Patchwork-Id: 12332713 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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 58EB9C2B9F4 for ; Sat, 19 Jun 2021 06:40:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21813611B0 for ; Sat, 19 Jun 2021 06:40:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21813611B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kh5Lbbyp1WQ26glf5VrOEFajtIlhU7bJX8A3k8erepI=; b=uTYBmMsr3qE/Ik kKGmXOq663R8FBBdlogT4ONQg7tphFembBiQ4cU8Zz2mW/VZ2pX4XE0rknSzke5Dtfq+2t+NdgOem PM2UoscvMp5fNe3wi4Ez7eefuVd5hwvp5DU/N/uAt6hTdGsZvJFHb4dl74X489ZMGtQ3mmNGJN+Cy Ug5LDS7SyPc31Esu3UEshWcs5iDeMEANy1sLMcf9sqQqofrQQTKsJK3cGf0X/9kLbo0quYtTtSwRR GQSbGMKo9lXKn9ibtNV4/mOjH4HqWR/AFW04uPAJBIW6junW/gfCj3pJuVaVDsFXww+CUWDbq5GMn x3YHBWP7K8mi5yXC2Jyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luUev-00GUn6-Gp; Sat, 19 Jun 2021 06:40:49 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luUeT-00GUdG-2v; Sat, 19 Jun 2021 06:40:22 +0000 Received: by mail-pl1-x633.google.com with SMTP id x19so5809432pln.2; Fri, 18 Jun 2021 23:40: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=ZBC2jKS0EXBhnjYqqHmBsLNtpsQFO2BHm+Xp1hgeFE8=; b=SPMP2ltRGwzcECcsH2aLjunU8fcC8kYzSGXILxhE5YWPRR/jrZyv6tRZvCTvPbMaOw y0E5fhpE22+hMyNXfOKTYDDwxPXZALCk/nKcZrS4w2iXpMYqj3LMZyX8XxOqvHwKFWMX UVLaCTxLOxKdpM3diOdhIiLSywvIEk7eVYo5bdavd89yMDfdHbs2kYzzk7b7PrXjw3B7 mNH6V7s8xF3tjIn8fHJBWMrwUXvMxDohYBNHqLLLg3mxnMLs2eh6tpcIn7wIyosIePsX 3U14w+zRFAKo/lxybtoKMlj+aYqAsMyOWTX9tQLJz7udmNDa6BEbUIJWem1W6TDSJZD2 v0/w== 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=ZBC2jKS0EXBhnjYqqHmBsLNtpsQFO2BHm+Xp1hgeFE8=; b=Guf3j98Djhoe7SppOqiK+XtDzeZ+khAXMNbIrmKw8e+tJORGNjdOAlaYE+0N+UevNb eqAW/OWn4Oa95SKuutzAq0jZ6Bjp3icrEfxTLjp26mArUbPeNpvdILwz5xHxiN6SERm6 b86AT+K8eucfsndqsugkhc8H2+DUbRWUQmXssLxR29Q/aOKaL097yDqoGKOAbXB04LWb 19i9oCqhfV3+8OjQCWgkgRLf6Nd1tRg4I4OAQGLeftn//Jv2hxmxspOu+QJSJyXYyY1q T3Xhvg/AOstmY/7PSHo34qebewYOu2xW86PLGFtQSnufCllslz5bYpsteLf05ENXoQlr QUTw== X-Gm-Message-State: AOAM532sKZEgB8hCArmAl5KeMaMO2rEeSzsp8zhbat/1hNvbAoK/TH6Y KyZeWpGHOefflIQKv9mAnVI= X-Google-Smtp-Source: ABdhPJyZAYPMcraY9oFytwbhDkAJuPkVaHQ2RiogYWEkWAm4fQF4c6JEkpP16vIoLpBXYob7YkRzYw== X-Received: by 2002:a17:90a:3c8d:: with SMTP id g13mr8231545pjc.229.1624084820400; Fri, 18 Jun 2021 23:40:20 -0700 (PDT) Received: from localhost.localdomain (199.19.111.227.16clouds.com. [199.19.111.227]) by smtp.gmail.com with ESMTPSA id r19sm9440274pfh.152.2021.06.18.23.40.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 23:40:20 -0700 (PDT) From: Artem Lapkin X-Google-Original-From: Artem Lapkin To: narmstrong@baylibre.com Cc: yue.wang@Amlogic.com, khilman@baylibre.com, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, jbrunet@baylibre.com, christianshewitt@gmail.com, martin.blumenstingl@googlemail.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, art@khadas.com, nick@khadas.com, gouwa@khadas.com Subject: [PATCH 2/4] PCI: core: quirks: add mrrs_limit_quirk Date: Sat, 19 Jun 2021 14:39:50 +0800 Message-Id: <20210619063952.2008746-3-art@khadas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619063952.2008746-1-art@khadas.com> References: <20210619063952.2008746-1-art@khadas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210618_234021_177572_35F97C53 X-CRM114-Status: GOOD ( 13.61 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Prepare new MRRS limit quirk which can replace dublicated functionality for some controllers from Loongson, Keystone, DesignWare Signed-off-by: Artem Lapkin --- drivers/pci/quirks.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 653660e3b..73344ec71 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -5612,3 +5612,57 @@ static void apex_pci_fixup_class(struct pci_dev *pdev) } DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a, PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class); + +/* + * Some Loongson PCIe ports have a h/w limitation of + * 256 bytes maximum read request size... + * + * Keystone PCI controller has a h/w limitation of + * 256 bytes maximum read request size. + * + * Amlogic DesignWare PCI controller on Khadas VIM3/VIM3L have some + * issue with HDMI scrambled picture and nvme devices + * at intensive writing... + */ +static void mrrs_limit_quirk(struct pci_dev *dev) +{ + struct pci_bus *bus = dev->bus; + struct pci_dev *bridge; + int mrrs; + int mrrs_limit = 256; + static const struct pci_device_id bridge_devids[] = { + { PCI_VDEVICE(LOONGSON, PCI_DEVICE_ID_LOONGSON_PCIE_PORT_0) }, + { PCI_VDEVICE(LOONGSON, PCI_DEVICE_ID_LOONGSON_PCIE_PORT_1) }, + { PCI_VDEVICE(LOONGSON, PCI_DEVICE_ID_LOONGSON_PCIE_PORT_2) }, + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_RC_K2HK), + .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_RC_K2E), + .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_RC_K2L), + .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_RC_K2G), + .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, + { PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3) }, + { 0, }, + }; + + /* look for the matching bridge */ + while (!pci_is_root_bus(bus)) { + bridge = bus->self; + bus = bus->parent; + /* + * 256 bytes maximum read request size. They can't handle + * anything larger than this. So force this limit on + * any devices attached under these ports. + */ + if (pci_match_id(bridge_devids, bridge)) { + mrrs = pcie_get_readrq(dev); + if (mrrs > mrrs_limit) { + pci_info(dev, "limiting MRRS %d to %d\n", mrrs, mrrs_limit); + pcie_set_readrq(dev, mrrs_limit); + } + break; + } + } +} +DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, mrrs_limit_quirk); From patchwork Sat Jun 19 06:39:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Lapkin X-Patchwork-Id: 12332715 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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 60A43C2B9F4 for ; Sat, 19 Jun 2021 06:41:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 289A2611B0 for ; Sat, 19 Jun 2021 06:41:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 289A2611B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6IUNGeC0gOCP0qwfu8zdzJVmPHey+kFnEipzPaFkLfY=; b=yqRBZfHRT7gLiD VhscrgGfeybTJgpgEGRhH2MTPa58om8puFXjRxhUMPQkuozdoN8lYIaGykM9x9DO9ca8G8ZoF0hnm f+l3pBgVWLsQ6B0s6cp0eSL1erByloyko2tgiIMJvN9BKtXhqvQ2wSObuPatKZqp7tUylBxIILe2M jamI8Lc+g9F1nYz6zTQjZJqgdyD7vZxqggCP/YrLOTV60+t2DedY4wEy+4sAbNlbgA5j4o3C+2DVE /d2bsJHfrSg79Tuf80QBBZxVCiLAdHQd8jAiU9gBLsEuSZ8A2xxjO+trAOZhxEMQkw8gNJxHX3caV 8YepiaPwGMVJ5MakL2rQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luUfA-00GUtY-3D; Sat, 19 Jun 2021 06:41:04 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luUeX-00GUe7-KD; Sat, 19 Jun 2021 06:40:26 +0000 Received: by mail-pj1-x102a.google.com with SMTP id o10-20020a17090aac0ab029016e92770073so7174616pjq.5; Fri, 18 Jun 2021 23:40: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=jMdLXDhFl4H1jBrVVGBSGnbHc6XgMnjwU52Wg9vOITA=; b=IH+xuUGqI1f9AUP9hnelNrxh0SN+eH8L+m0MSZOUAStxDdSMizzef6SyMrsw5aaB1P K12IXSa4V5+3Rb1FMmX61jqbGvgIUGCni1qaqyS+TG6G6ArjERDnkQzVru2zU7xdubKC zkyM0QnpKfxBDnkejKI/+I25JPvNRcSSVzzg6UiX68pYUwwrclfXnoy3Ati2dbtipn91 dWzf7R0oZq6KvSOQFZOtCQuYYz+5f6cYiTvdRnsoeB6nYDxdRi662LvnTw/0vAxPhsPc GUE3xNyzVxvgWE5YpZL+x/oxB5MPu5tNDnmIrWDHmlaP6KAn8stTju6PFO58p9GpiX/h X37Q== 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=jMdLXDhFl4H1jBrVVGBSGnbHc6XgMnjwU52Wg9vOITA=; b=sa1EFgrb8EpWgH/FRfJG61epVTvPMrQ3YcfBTisSjVYrsIqjPRMhjVbc45lwW7X7fd r8u2XBfG+gYhyNXeoVmJwIxGzBb3bcliwhnJR4E0ATLIrskj865Hd1mhiumn01eyIr0T yigVVu4iQ9H9+LtWloKH4SAHKKqKcDaJmYWMDBeyknx1I0Kytiot0B4EEPPqqJoJtdLj dfwnmROnWNZK5Sv/1rfa1ufc3/BYrjJXU0rdxQIv9JX8WNbZSoyzmDbtDfRUcng4PbGh K4zDB/8SgzJHB62dN1eppIicV9kNP/EvgFp5mn5NbboVYUyf/novzi+qGudlVRP8n/+e LLbA== X-Gm-Message-State: AOAM530sHnifsvIho76js6u8eDw9EWqBPVbEa+rHe86WkbZmfRHS/lNO qedGWi4qZpZwXa649ZOl7kPnixZk7NiH0g== X-Google-Smtp-Source: ABdhPJxsfwbnPxy93E8cwaFesNULmdimBitNo/Xif9c/y85Wm/Rca1Q+h7DW6w8IvnhnFvfgnesddw== X-Received: by 2002:a17:90a:7401:: with SMTP id a1mr25489029pjg.57.1624084824992; Fri, 18 Jun 2021 23:40:24 -0700 (PDT) Received: from localhost.localdomain (199.19.111.227.16clouds.com. [199.19.111.227]) by smtp.gmail.com with ESMTPSA id r19sm9440274pfh.152.2021.06.18.23.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 23:40:24 -0700 (PDT) From: Artem Lapkin X-Google-Original-From: Artem Lapkin To: narmstrong@baylibre.com Cc: yue.wang@Amlogic.com, khilman@baylibre.com, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, jbrunet@baylibre.com, christianshewitt@gmail.com, martin.blumenstingl@googlemail.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, art@khadas.com, nick@khadas.com, gouwa@khadas.com Subject: [PATCH 3/4] PCI: keystone move mrrs quirk to core Date: Sat, 19 Jun 2021 14:39:51 +0800 Message-Id: <20210619063952.2008746-4-art@khadas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619063952.2008746-1-art@khadas.com> References: <20210619063952.2008746-1-art@khadas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210618_234025_710749_19585283 X-CRM114-Status: GOOD ( 13.26 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Replace dublicated functionality ks_pcie_quirk to mrrs_limit_quirk from core pci quirks Signed-off-by: Artem Lapkin --- drivers/pci/controller/dwc/pci-keystone.c | 49 ----------------------- 1 file changed, 49 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index 53aa35cb3..879ae2d4f 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -83,12 +83,6 @@ #define ERR_IRQ_ALL (ERR_AER | ERR_AXI | ERR_CORR | \ ERR_NONFATAL | ERR_FATAL | ERR_SYS) -/* PCIE controller device IDs */ -#define PCIE_RC_K2HK 0xb008 -#define PCIE_RC_K2E 0xb009 -#define PCIE_RC_K2L 0xb00a -#define PCIE_RC_K2G 0xb00b - #define KS_PCIE_DEV_TYPE_MASK (0x3 << 1) #define KS_PCIE_DEV_TYPE(mode) ((mode) << 1) @@ -521,49 +515,6 @@ static int ks_pcie_start_link(struct dw_pcie *pci) return 0; } -static void ks_pcie_quirk(struct pci_dev *dev) -{ - struct pci_bus *bus = dev->bus; - struct pci_dev *bridge; - static const struct pci_device_id rc_pci_devids[] = { - { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2HK), - .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, - { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2E), - .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, - { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2L), - .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, - { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2G), - .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, - { 0, }, - }; - - if (pci_is_root_bus(bus)) - bridge = dev; - - /* look for the host bridge */ - while (!pci_is_root_bus(bus)) { - bridge = bus->self; - bus = bus->parent; - } - - if (!bridge) - return; - - /* - * Keystone PCI controller has a h/w limitation of - * 256 bytes maximum read request size. It can't handle - * anything higher than this. So force this limit on - * all downstream devices. - */ - if (pci_match_id(rc_pci_devids, bridge)) { - if (pcie_get_readrq(dev) > 256) { - dev_info(&dev->dev, "limiting MRRS to 256\n"); - pcie_set_readrq(dev, 256); - } - } -} -DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, ks_pcie_quirk); - static void ks_pcie_msi_irq_handler(struct irq_desc *desc) { unsigned int irq = desc->irq_data.hwirq; From patchwork Sat Jun 19 06:39:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Lapkin X-Patchwork-Id: 12332717 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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 AF68FC2B9F4 for ; Sat, 19 Jun 2021 06:41:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69F58611CC for ; Sat, 19 Jun 2021 06:41:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69F58611CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7kN+Gggl5FSS3fF2Xg41/BGVANjFifU3NGSvebZ98x0=; b=JpspkyatlvKx7k nnb7KDUWidgv2XgWQnrVPAQsnUx8YwIuGrv2PBoTFgCLgY5cKwcPOMfMClVO285piLvGxdGQX/dGL 00/+yl/QTEiT8XUkc9Pwz+M7fln3TgZXOS661U566ND6Jq6Mn5a/WtFLFIziSUjODZ9fKYKFJBtUv vAIrrN2HyNQl1vUX+C08l6keZ7VPthOpUB/B1EokKyWdeCRr117uO4bLeGRgmIXA9mHtVP4yC2qCD JWqi6WTQBXvL0ryp6x8S5LAFUZzRGh0s8jbVvJlf98KBW9vRhD8rf+7mUFALoKAdOmEwn/gDSM5Zb LwdzQmQ9iedov4HpozIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luUfP-00GV0y-7e; Sat, 19 Jun 2021 06:41:19 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luUec-00GUfV-17; Sat, 19 Jun 2021 06:40:31 +0000 Received: by mail-pj1-x1029.google.com with SMTP id bb10-20020a17090b008ab029016eef083425so9057519pjb.5; Fri, 18 Jun 2021 23:40: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=1glDM6oLeTVKmgkuXKty5D8QEB/JX/Xhu+0hRlzxY50=; b=ck0SbqtDwvvUv3IUYad5DJbmdangdvOau/iCF9srKXiWZ2fV80yAO2xqVqvTZbOUr9 vdKxDq+MfnRmzW9JqCyZB1oifJpXKLJmsUwXsLWYe/3xwCLFI5hGK3iblNeQshsIKBSC 9mGrHWq8CmakB5U9A9am3FED/Z3S5wE8bNGopHZBPT7LC1c0dBS/IKteyzryggtIFaDk 7uqtxXmvinZCZFHYD8aN15OmZh30c3RoLTmCWxG1AYpJ9LRvGREa+13OCPYMDw2aWmQo neQtOvKO1FYfVV4w7ChdXNMecl6yc9UiQhLFAcGCIjpgM1w571u+qSHdkSyV+GIC6HsM MM0g== 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=1glDM6oLeTVKmgkuXKty5D8QEB/JX/Xhu+0hRlzxY50=; b=qYq6Sq1WzsimDS/y9UFsPjFMrYxFuBEBxsCwX5gsXquQ8PtT3wNtJfnpj4NXzHr62j rVvodDANXjRr/5NeGy082CxknJWeDslni9xl5wDrdiTp3ujuzx4vFRWOzL9dCTyYHeau usH3psrcSua454vgVIoValtu0te7Wh6YtTcHC+Wj5nQuHwzboS8NmgVmgIh0MjCzdddQ cMH1nLrsbxEloR/oI8l1mA8qzxaSNAKWxeJRcKis/GGFJqdH0amTrgrTUEIAmzz50LPW 4rq06bk4xjV6tdqIVvyMmlGYjpVl4n1zXApijm4d8JM4BgXWi9jenLdpdY1rBgCAsz1G chMQ== X-Gm-Message-State: AOAM533PQWudRbPGDrToXSUdjvqrgvN8UJLsI5vm3E/dCPIZjvuooIeA 9nJ6KQgje0MHmb50l4W4FLw= X-Google-Smtp-Source: ABdhPJxylxUb3CRVvUOB7sWREsvDlUHSsbGKGDdn2Z/cAkCOJOGn25zImPk4XDriCcBsagFUQaG9lA== X-Received: by 2002:a17:90a:5907:: with SMTP id k7mr14518747pji.46.1624084829359; Fri, 18 Jun 2021 23:40:29 -0700 (PDT) Received: from localhost.localdomain (199.19.111.227.16clouds.com. [199.19.111.227]) by smtp.gmail.com with ESMTPSA id r19sm9440274pfh.152.2021.06.18.23.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 23:40:29 -0700 (PDT) From: Artem Lapkin X-Google-Original-From: Artem Lapkin To: narmstrong@baylibre.com Cc: yue.wang@Amlogic.com, khilman@baylibre.com, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, jbrunet@baylibre.com, christianshewitt@gmail.com, martin.blumenstingl@googlemail.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, art@khadas.com, nick@khadas.com, gouwa@khadas.com Subject: [PATCH 4/4] PCI: loongson move mrrs quirk to core Date: Sat, 19 Jun 2021 14:39:52 +0800 Message-Id: <20210619063952.2008746-5-art@khadas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619063952.2008746-1-art@khadas.com> References: <20210619063952.2008746-1-art@khadas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210618_234030_144785_4CCAB2BA X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Replace dublicated functionality loongson_mrrs_quirk to mrrs_limit_quirk from core pci quirks Signed-off-by: Artem Lapkin --- drivers/pci/controller/pci-loongson.c | 42 ++------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/drivers/pci/controller/pci-loongson.c b/drivers/pci/controller/pci-loongson.c index 48169b1e3..5a54faf10 100644 --- a/drivers/pci/controller/pci-loongson.c +++ b/drivers/pci/controller/pci-loongson.c @@ -13,10 +13,6 @@ #include "../pci.h" /* Device IDs */ -#define DEV_PCIE_PORT_0 0x7a09 -#define DEV_PCIE_PORT_1 0x7a19 -#define DEV_PCIE_PORT_2 0x7a29 - #define DEV_LS2K_APB 0x7a02 #define DEV_LS7A_CONF 0x7a10 #define DEV_LS7A_LPC 0x7a0c @@ -38,11 +34,11 @@ static void bridge_class_quirk(struct pci_dev *dev) dev->class = PCI_CLASS_BRIDGE_PCI << 8; } DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, - DEV_PCIE_PORT_0, bridge_class_quirk); + PCI_DEVICE_ID_LOONGSON_PCIE_PORT_0, bridge_class_quirk); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, - DEV_PCIE_PORT_1, bridge_class_quirk); + PCI_DEVICE_ID_LOONGSON_PCIE_PORT_1, bridge_class_quirk); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, - DEV_PCIE_PORT_2, bridge_class_quirk); + PCI_DEVICE_ID_LOONGSON_PCIE_PORT_2, bridge_class_quirk); static void system_bus_quirk(struct pci_dev *pdev) { @@ -60,38 +56,6 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, DEV_LS7A_LPC, system_bus_quirk); -static void loongson_mrrs_quirk(struct pci_dev *dev) -{ - struct pci_bus *bus = dev->bus; - struct pci_dev *bridge; - static const struct pci_device_id bridge_devids[] = { - { PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_0) }, - { PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_1) }, - { PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_2) }, - { 0, }, - }; - - /* look for the matching bridge */ - while (!pci_is_root_bus(bus)) { - bridge = bus->self; - bus = bus->parent; - /* - * Some Loongson PCIe ports have a h/w limitation of - * 256 bytes maximum read request size. They can't handle - * anything larger than this. So force this limit on - * any devices attached under these ports. - */ - if (pci_match_id(bridge_devids, bridge)) { - if (pcie_get_readrq(dev) > 256) { - pci_info(dev, "limiting MRRS to 256\n"); - pcie_set_readrq(dev, 256); - } - break; - } - } -} -DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, loongson_mrrs_quirk); - static void __iomem *cfg1_map(struct loongson_pci *priv, int bus, unsigned int devfn, int where) {