Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp61938lqe; Wed, 3 Apr 2024 22:31:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6a6dBfbY8t2rSQLdPDSpiA4GnyzhG5d1M97Ia9NiqayI+9qVNQWYEsY/s3ldr/G+lGgTRc/Dio4dAGH65iho23px7JFMi+N+4Zpb9lg== X-Google-Smtp-Source: AGHT+IHhwi1xDfkbVZdXPOL/1Nnp5IuMDeUFk0K7JoMcQU+1MuTDQ7uhfK+YWhX1D1PMLTiqudna X-Received: by 2002:a05:6870:98a8:b0:22b:a8f3:36b7 with SMTP id eg40-20020a05687098a800b0022ba8f336b7mr1068429oab.55.1712208679504; Wed, 03 Apr 2024 22:31:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712208679; cv=pass; d=google.com; s=arc-20160816; b=bF1mXBH7is+QCCfGq6cCaXqoOCN3+gsWC9pTQgpkl2VF5VYoOuq3keFwH2M2R5w6/g 52R+L/WFlwDYfFZPnfzdgL1BBgGX84OSOqkfLkThogMygqQS2+V8545jU8eszy9+TUic 1eCX3niRMoTtGu/63m5gCj1t8xlpt4hh6AfR5nWAXpiMXmxXAoX5R5s5HAcXR4C1ZJc6 lJhMC9cpRCQlHgpVFMgM85jt9yGjNywlyr/TCqHw4O8+GKUfxaOznS2/cx0zENLAR/Nl ELoCwOoXauGvFOMuTqfXl2LdHUJglUjZ6gFs8YmhJf9llnSJ6dqHzVF94S1a6Paua5qS qOkQ== 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=yxg24746bmA0X6IJdybNASF26qM8zynbI1G8yMUdaQDtj8mbKIFicWO5koLFT7nans /530Nh5tS3YbCMoGT/8FHclVgAdL7ODGQLAtT52tcHueej7u2Ogj1t8K++oQR2k/Y25D Kp1SdZ7NfjdONumSLIpcVvA6Y/FzDBqKc0AfywKuurW9cMrsacImIcNsimIwJoGqkbTN uLVCr7WaCcXZ1za+zz3KHOKoCDFRAXOVxUAMDwKDIMuf0zDZD9Xy77aTJfjtSbR3IoY1 b7djG4FQtVw+lMT34DeFiv4QhgWJkZjgvPca5E9kBJ4HOSiKI7AEyoAJ0rTwwhqcDYeJ BhFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-130921-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130921-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ka36-20020a056a0093a400b006ead1088148si323750pfb.267.2024.04.03.22.31.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 22:31:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130921-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-130921-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130921-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8F85EB27EF9 for ; Thu, 4 Apr 2024 05:20:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B7FC762EF; Thu, 4 Apr 2024 05:15:16 +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 9B03274BFC; Thu, 4 Apr 2024 05:15:13 +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=1712207715; cv=none; b=UFe3PCi1dfr09e785r4TEBjGUMdqFHUe4fJ3aQWSIHB3PZHO8/fa1nhDnQxZcwR5kF+0NzXTgdIOzbFbXHEB4UkEIT6PhmtHVGrQDa8UY7gP0mrrKCj3jCJ0mDA7hG9X3o2dvsRBVs0JfVcC9H5+Lclu6F0I1njj75QzUaDGRnw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712207715; c=relaxed/simple; bh=Zl34havtMWRq2iGwzVo/GzpE+MdC5jA9xgxGJw9XNA0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=C0g/N1v1CNMLyT43gVcpRezPP5K++DWwFmR8XVsqRdhRRsDAaYxbSwsHF+pmLBdJZlykozMHaoIfmTqzdF49vkBugrVzZunA8TswlugzyO2OPDbyUHt1ShW0BysRRgp3V1KTzMjlqq1f2W79IBC3nS2bSrpLDHCMBpG+gwmTE2U= 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 985351C0FC7; Thu, 4 Apr 2024 14:15:11 +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: [RESEND v7 10/37] sh: Common PCI Framework driver support. Date: Thu, 4 Apr 2024 14:14:21 +0900 Message-Id: <1dc50e154999c1cf5f13949fdd7d049fa363c34b.1712207606.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