Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp188354rdd; Tue, 9 Jan 2024 00:25:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3qH/KMsy8Q6Om6jk5CJBKyMi7pkZp1JaGm5tI6JP5z9z0hL+HeLa5fcKmSQO2HfyoKV7x X-Received: by 2002:ac8:5a81:0:b0:429:8466:2301 with SMTP id c1-20020ac85a81000000b0042984662301mr5531930qtc.62.1704788746647; Tue, 09 Jan 2024 00:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704788746; cv=none; d=google.com; s=arc-20160816; b=yU2SyqRFzn85UB4SXO3c12Hw+75+RqNU6o1p+RumqTGAvO53Ig0akmxvgalkxrtJhS K8lle7yld/XTEPhmx1A1K9MI/XlQLZF7xjOw44dYyWSLh+4abiyrYNdX+PKOpeD+MB0o FV7MwWvUbuBBcbUngLRGWl1G5RO/LusWwP2DqYqYtRak3FZRYjpQXEtf2Mw8HiQQq/PW OEMMsmtvwkLso5jPiKwa+3FAX4a83RQtJtD2K/tJjbgs9yy8MQSgDoqE/UYZ0hWyMwyS cbDeyNQE/yviN4P/0yzH2MNZlgEmZwDjcAX3nmBAq/LDF/lPPqAW2PWljSlciWsNYtRG qQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=+xScpGNufbMg3x4HLw1wZYXCZu9vN2x/W/Gy1hkOjSY=; fh=Wggyzqk8NnmFrzie51GdRxMtBOGEs0wgwgvwAPi4VhM=; b=U+JG8yXryIk5iaWlWBrlU69h3lOneT1RegC8/aMygIBzVWdnzw0caa1U2+SJSlMBKv w71JMkwjWz1mzUiZAQd6LIx6dsluQ3I/MYrijFPIUvZgsBxWzk8CIbDTmN/axUZfm1yP 67nFOnWlIGkzbJh/DJ797RCJoTZi/Ww9OZgKWqh/19sI1SIEDauxePRAzP7s8WODEOwJ zUQtRPFnajhf0foWNq759tCQG21VyZ0xnrZmo5V0a8WGrZCc+yoxz9lKFffZ2yHsGXaD QDwhV0Sdv/emr0PkDvWt0dTVeE7dRJNw//y2fJEECSZfFvjqNEwvN02hB5eceVdrE5yU H5Ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20552-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g8-20020ac85808000000b004297a143038si1610899qtg.20.2024.01.09.00.25.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 00:25:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20552-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 62D261C2111A for ; Tue, 9 Jan 2024 08:25:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2494360BD; Tue, 9 Jan 2024 08:24:00 +0000 (UTC) Received: from sakura.ysato.name (ik1-413-38519.vs.sakura.ne.jp [153.127.30.23]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02E6233CE5; Tue, 9 Jan 2024 08:23:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=users.sourceforge.jp Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=users.sourceforge.jp Received: from SIOS1075.ysato.name (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by sakura.ysato.name (Postfix) with ESMTPSA id 1B3CE1C065E; Tue, 9 Jan 2024 17:23:57 +0900 (JST) From: Yoshinori Sato To: linux-sh@vger.kernel.org Cc: Yoshinori Sato , Damien Le Moal , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Thomas Gleixner , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Bjorn Helgaas , Greg Kroah-Hartman , Jiri Slaby , Magnus Damm , Daniel Lezcano , Rich Felker , John Paul Adrian Glaubitz , Lee Jones , Helge Deller , Heiko Stuebner , Jernej Skrabec , Chris Morgan , Yang Xiwen , Sebastian Reichel , Linus Walleij , Randy Dunlap , Arnd Bergmann , Vlastimil Babka , Hyeonggon Yoo <42.hyeyoo@gmail.com>, David Rientjes , Baoquan He , Andrew Morton , Guenter Roeck , Stephen Rothwell , Azeem Shaikh , Javier Martinez Canillas , Max Filippov , Palmer Dabbelt , Bin Meng , Jonathan Corbet , Jacky Huang , Lukas Bulwahn , Biju Das , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Sam Ravnborg , Sergey Shtylyov , Michael Karcher , Laurent Pinchart , linux-ide@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org, linux-serial@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [DO NOT MERGE v6 10/37] sh: Common PCI Framework driver support. Date: Tue, 9 Jan 2024 17:23:07 +0900 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add New OF based PCI Host driver. This driver conflicts some point in legacy PCI driver. To resolve the conflict, I made some changes to the legacy driver. Signed-off-by: Yoshinori Sato --- arch/sh/include/asm/io.h | 6 ++++++ arch/sh/include/asm/pci.h | 4 ++++ arch/sh/kernel/iomap.c | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index 5429b4169dc8..51312f356fb9 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -20,6 +20,7 @@ #include #include #include +#include #define __IO_PREFIX generic #include @@ -319,4 +320,9 @@ unsigned long long poke_real_address_q(unsigned long long addr, int valid_phys_addr_range(phys_addr_t addr, size_t size); int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); +#if defined(CONFIG_PCI) && !defined(CONFIG_GENERIC_IOMAP) +#define pci_remap_iospace pci_remap_iospace +int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr); +#endif + #endif /* __ASM_SH_IO_H */ diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h index 54c30126ea17..92b3bd604319 100644 --- a/arch/sh/include/asm/pci.h +++ b/arch/sh/include/asm/pci.h @@ -2,6 +2,7 @@ #ifndef __ASM_SH_PCI_H #define __ASM_SH_PCI_H +#ifndef CONFIG_SH_DEVICE_TREE /* Can be used to override the logic in pci_scan_bus for skipping already-configured bus numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the loader */ @@ -88,4 +89,7 @@ static inline int pci_proc_domain(struct pci_bus *bus) return hose->need_domain_info; } +#else /* CONFIG_SH_DEVICE_TREE */ +#include +#endif #endif /* __ASM_SH_PCI_H */ diff --git a/arch/sh/kernel/iomap.c b/arch/sh/kernel/iomap.c index 0a0dff4e66de..968b15868d9a 100644 --- a/arch/sh/kernel/iomap.c +++ b/arch/sh/kernel/iomap.c @@ -160,3 +160,21 @@ void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) mmio_outsl(addr, src, count); } EXPORT_SYMBOL(iowrite32_rep); + +#if defined(CONFIG_PCI) && !defined(CONFIG_GENERIC_IOMAP) +int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr) +{ + unsigned long vaddr = res->start; + + if (!(res->flags & IORESOURCE_IO)) + return -EINVAL; + + if (res->end > IO_SPACE_LIMIT) + return -EINVAL; + + __set_io_port_base(phys_addr); + return ioremap_page_range(vaddr, vaddr + resource_size(res), phys_addr, + pgprot_device(PAGE_KERNEL)); +} +EXPORT_SYMBOL(pci_remap_iospace); +#endif -- 2.39.2