Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp480439lqb; Wed, 29 May 2024 01:07:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUYcdP1GD9P/XoyzLXdQNc6JNfJdiVk2t5IqrAU5BNuLSHRjpq/w6cPfCxkrVduPjIf+Bsn38dvt+nvr8Xbki2+ZruTKRkDATt+Jbnpng== X-Google-Smtp-Source: AGHT+IHWIi0Yujhjr8vU5au9MYHrKllHR5iLpn/g+R0+lZA2qEhHIOAu2YYwUc7nxL7YwLSHFGym X-Received: by 2002:a17:902:db0d:b0:1f4:8b8f:8d3a with SMTP id d9443c01a7336-1f48b8f8e29mr94309665ad.40.1716970071330; Wed, 29 May 2024 01:07:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716970071; cv=pass; d=google.com; s=arc-20160816; b=Yu0kSuIc5j/N8E0+yJD0IHkg4Xw0lY2rwZ1jmQiv35tCgv8CI/cA4kSTaUBa9GpO/p TJt6Truacp/Bxlt83EItHKQ7VlFkzJUkZv7iS5H/it7DIdNfVufemslc3xvmmy3Zbk4z py3/eqZmP2quEhYPYLIkynVBMXi/0UBPNoEh1XQ4ff2XpZKg5xRGpDWsHBarIm9qGMvG /vljM6pfviYcyEoMptqXRjgFr4yeOnRgecXfbWFKiuPKtAeFx8pjQPv6MTiVuy3BqHOK aj/fCnSnI/TFpdxKOl9/Tyn8dV7MX0BVma76x9x1UeS5H/sdhPp5Z5a/lRmYAWq1Oinz 6vXw== 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=NCl8CixGeTFE2HqgWDW+UlfZpmTMmLot3MlKffw+YoQ=; b=u4e06aE6nrDsqwNsp3oq3F6EYE9X3KtKmuZwg9QOtEfbLgZoWVg30NnL7AVYXvKB3e WOD88RnoRVISm212UszhEW2boQhu/vOCeqo1yZ5F8A8sBSdXCVS0cNoGRWSQKnXx+jNa qn/CWcI2lyhKCdIZ4pM3+zJaC+gArjVsvZEdG8dbEmGIwF9Ml89uqtVc9xpSoX7pd5SN PS/FhkWZfY/gHfohXHaIKKwPtyaiCZedEouybP6dPi6f/TmWWsUq6ABPbOhUfjtlPCVS kspPJjQQB9feyuAkEZBE7k6sM6ZZkIeRy4C/T9TVW2AtnYkE/pMHQ2bbjw+mRRu5vpXo lSDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-193648-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193648-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 d9443c01a7336-1f44c970cbfsi75734745ad.205.2024.05.29.01.07.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 01:07:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193648-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-193648-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193648-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 2E560B25704 for ; Wed, 29 May 2024 08:04:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 198D716EC00; Wed, 29 May 2024 08:01:50 +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 D7C91168C15; Wed, 29 May 2024 08:01:47 +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=1716969709; cv=none; b=mAcGpB1Nf7ZVKZz2n9UluSoGZ32lqVGgtxuxXDpO2fdorMyl6TO2y/JSzDI1rSbZCewClc80KaQB+/4+BOft3YpKHIMbPFL37OrVxbFgDM+S/GGxP7V/ahsozD+YgEIFxP4ZLgUKXeuA0N/XUcOn/vO7DP28C/lk/DZ+R7bg+k4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716969709; c=relaxed/simple; bh=Zl34havtMWRq2iGwzVo/GzpE+MdC5jA9xgxGJw9XNA0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N7oat7bUd6nY/t8Ry6pAb+P33qH0VcUujoAm5wqieSDLhFR/elHxwf2w0f4ccQH2dTplp/l3izqlmP4poRM6yYMiBYrhpsXRmvMUlYtBf9OP+bJgDXescEKp6DUPeQ8uLMxd2bMh353dnQiJFzNJHQw1QoPOr+YuEB3wYgbvqqM= 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 EFE401C0940; Wed, 29 May 2024 17:01:45 +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 , Neil Armstrong , Chris Morgan , Sebastian Reichel , Linus Walleij , Arnd Bergmann , Masahiro Yamada , Baoquan He , Andrew Morton , Guenter Roeck , Kefeng Wang , Stephen Rothwell , Azeem Shaikh , Guo Ren , Max Filippov , Jernej Skrabec , Herve Codina , Andy Shevchenko , Anup Patel , Jacky Huang , Hugo Villeneuve , Jonathan Corbet , Wolfram Sang , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Christophe JAILLET , Sam Ravnborg , Javier Martinez Canillas , 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: [DO NOT MERGE v8 10/36] sh: Common PCI Framework driver support. Date: Wed, 29 May 2024 17:00:56 +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 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