Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp52599lqe; Wed, 3 Apr 2024 22:02:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUPAf//8ZmHh2u4eMympXGo6gIIhQ3VPwXVXz3cf5QKTZXLyTqzpNEJooi+LqQEGR+3aCg+rJ8Wn6vNRrn7hLYnNi3nSREwUG4oRQSaeg== X-Google-Smtp-Source: AGHT+IFg4AVH2FHQ3actnuWk3bpzfAB2JPYZvBia67EwOzm3krUxHYymIBVryKDNqdNl62Pu+xeM X-Received: by 2002:a05:6358:2825:b0:183:5035:7b91 with SMTP id k37-20020a056358282500b0018350357b91mr1208877rwb.25.1712206957875; Wed, 03 Apr 2024 22:02:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712206957; cv=pass; d=google.com; s=arc-20160816; b=My17HgEggisGhWYz6MhrXT+X1DDtfv0mnnxWJrltTJk9LFvPXt/FTzi8np5xS7ZCvD VZG0h35u5mqW0MKJdS+nbc2THJc9ne6U822bZLpsFN9oRXloD4emY6XTfAhUPym6fRza mHOn0bqCdVXbe9tJawqRBHGeF0oeBRsg6TzfoKWLgZMODe66E+jHbdxvsJJN7yfIK9qO FpHQHnMUr+QItSl73X/Vl2msMaMbePIQLxgCSJCfwa+oqnvaP/Jy0Gd0IsisaiDqMhrh z+LBNK7AzB6ZFqEYB6ROun4pxKP8bHI9Gs8fz1tPephIIWyuRpCkSRogudcXzA8W152c mLrA== ARC-Message-Signature: i=2; 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=6gkHLooVY4F0IqOHPgeTMzOcMv3xTa8XyhieEh1jQOI=; fh=v4XjIS8ZnkfRSzpdvZ0kX2qBiNaW+cViNlbs+XMLZ44=; b=YfHCts7uBXn5z/NBW1dZaWJ4cs4Xmaflqo/VdiJ8h6S3VbAVuVNARUNC9Fz3gtkMVc Q2ZcVNEIgducRRb8rmtt/jIffzn1mcGaDl+xjm24GqL8rn1OZ9wV76TaL94MDy71wDpK pEfX4Pbz+ZG5r2QuSRkkqy9BDXUWpflxWw8O1bsoezvK1BvZh68JTH+0Ugw9cOay4erW 5hrmHkjPcair3GHaKwyZClUHs1TssXRLyD4fosz8bd6NNYmar5ctRgXIpKYqS9y5wOiK Bd+f8CZuwIYNNWcGNpV96IBIBxeh30oAEsMaMcLEpebM1VHRWSBsyirSypyRszVfndNI /lpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-130877-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130877-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ln5-20020a056a003cc500b006e69e291eadsi15104060pfb.379.2024.04.03.22.02.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 22:02:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130877-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-130877-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130877-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E4175289833 for ; Thu, 4 Apr 2024 05:02:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A10C65677D; Thu, 4 Apr 2024 05:00:57 +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 52EF65473D; Thu, 4 Apr 2024 05:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=153.127.30.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712206857; cv=none; b=nMUMNZreBgoyE2c/FCVHNvEwvhRSMhv7vH9VyKESCWusb8OFhVirmHpA5bOsCmkMpk36kPgrqSU1tcubBeQt3+PLRSqtyp7yJ0svLh7P44bHIkgEXJfJEezmAZtzBnCt/fTy6ySAtr+wkRqIO+Lt8rW8mnJebbqc5BuMN2OuVss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712206857; c=relaxed/simple; bh=Zl34havtMWRq2iGwzVo/GzpE+MdC5jA9xgxGJw9XNA0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aH8FYCkOIc/ke3qs94haOuvpUC8O6lF0KT2Xz/BHy99r9x7JFzYPsJRyfRDXNFyJK2vRuymoyX4QXJfg484Bq0Mh19PymhfKcP7haT0ygCODL7rCX73sT0+4NkDs0QuUdTM5Vv8+sDQWLGVVTzOQydTj41AxbBkyLqHx/DLLUSQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=users.sourceforge.jp; spf=fail smtp.mailfrom=users.sourceforge.jp; arc=none smtp.client-ip=153.127.30.23 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 (al128006.dynamic.ppp.asahi-net.or.jp [111.234.128.6]) by sakura.ysato.name (Postfix) with ESMTPSA id 1B6FC1C0912; Thu, 4 Apr 2024 14:00:53 +0900 (JST) From: Yoshinori Sato To: linux-sh@vger.kernel.org Cc: Yoshinori Sato , Damien Le Moal , Niklas Cassel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Michael Turquette , Stephen Boyd , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Thomas Gleixner , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Greg Kroah-Hartman , Jiri Slaby , Magnus Damm , Daniel Lezcano , Rich Felker , John Paul Adrian Glaubitz , Lee Jones , Helge Deller , Heiko Stuebner , Shawn Guo , Sebastian Reichel , Chris Morgan , Linus Walleij , Arnd Bergmann , David Rientjes , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Vlastimil Babka , Baoquan He , Andrew Morton , Guenter Roeck , Kefeng Wang , Stephen Rothwell , Javier Martinez Canillas , Guo Ren , Azeem Shaikh , Max Filippov , Jonathan Corbet , Jacky Huang , Herve Codina , Manikanta Guntupalli , Anup Patel , Biju Das , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Sam Ravnborg , Sergey Shtylyov , 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: [PATCH v7 10/37] sh: Common PCI Framework driver support. Date: Thu, 4 Apr 2024 13:59:37 +0900 Message-Id: <1dc50e154999c1cf5f13949fdd7d049fa363c34b.1712205900.git.ysato@users.sourceforge.jp> 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 5c544cf5201b..29b5f996cde3 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 @@ -310,4 +311,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..d1b8e496ca23 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(pci_remap_iospace) +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 vmap_page_range(vaddr, vaddr + resource_size(res), phys_addr, + pgprot_device(PAGE_KERNEL)); +} +EXPORT_SYMBOL(pci_remap_iospace); +#endif -- 2.39.2