Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1812945ybz; Sun, 26 Apr 2020 04:53:41 -0700 (PDT) X-Google-Smtp-Source: APiQypLCvFrjHKEO+gFTKkuUa/lurlWI1rlRgX3xNAIUtFPUjO+fy+EgFRwGRhs5MbbFNKDkjWww X-Received: by 2002:a17:906:6a84:: with SMTP id p4mr10261493ejr.21.1587902021490; Sun, 26 Apr 2020 04:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587902021; cv=none; d=google.com; s=arc-20160816; b=Uwg/8BCg8r1QGRLEsgw8v4zKHUZyJueAgz7UgN5giNJtdqCiIzRwG5SownGVBG+DKU GmusSgYqWStaDTvUXx3fFpAxc8lLOXBGcTNVSkOWCDJ775O0FOZawO6aAtlr2wh7c52f KY+9Yxy3/7DEAFOb9z5bXNlhvqDmkaRGgHUj6FDPHR/bvVkyZ5y7eTNWjamxRSKArqUW IIl2Zj2KPHlfYLzzlvL1AdFJKawuTbpyN7soiMkxg6XkeEsXvOGW/rOkAZmBdmJxtWqn m1MD0wU6cQpUhDQ7LJGZJTBz6TiFjvpBvFiJdh3sK0aPPiTx1thkMdcpaauLeSCChVy/ qf6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7C2S+ZTsD7Mj6JaGPnG2kNVFtjoaiY54HifLNbOfbug=; b=fG8IoTOAmRc3SNawTR1xVZxtX4ElPd+cx6nrmY4p+6V1qEb8I8Q9fAU7E3w5EYMlte isjZ5NL7ocHf9sal5Ne8z3tioGljasv+C91mFsrMeOTzr9TeLj63Q4pedo16q/Bb3FM3 ZPGsRjnYmQIv5u054/NqwPJNrJ8d2FSEBiFUdYSL2J0UlwNxly0ZQj4tQ6QsS4Dqg3vK k4zj8kdbPIkImgbtOTxEPKh7IWoVZf4+fWw/1VMpaghGmKkGq5ZK7UhNFZHXlZYVgsJJ mSf3wsQbxkAWgGrL2l2j+X/qukd+36s3NhdsxqSSRiSu0eHUy1aRj7IiBq62R4E3dFkp bzaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b=QpyOxyFt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si1352707ede.28.2020.04.26.04.53.18; Sun, 26 Apr 2020 04:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b=QpyOxyFt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726323AbgDZLvQ (ORCPT + 99 others); Sun, 26 Apr 2020 07:51:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbgDZLvP (ORCPT ); Sun, 26 Apr 2020 07:51:15 -0400 Received: from vultr.net.flygoat.com (vultr.net.flygoat.com [IPv6:2001:19f0:6001:3633:5400:2ff:fe8c:553]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C71BC061A0E; Sun, 26 Apr 2020 04:51:15 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id 18F8420CE7; Sun, 26 Apr 2020 11:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1587901875; bh=FIpkVgCcZIOSR5LDhY/QsB4UvPKGRBmMbi5Ln6/hcIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QpyOxyFtVI9AhdwU/EaFyuJLre0YiMrOJR0N9E5ACBf3t3cAamMrKv1Numq1ZYnSg UNd1r3qGxmz1+UjGqIPmYlXNHhxNniEg/7Q1Tngn+hkS9UYJC3JOBdcsi12mBBQZoy HYY1RvPxMU9zuPuA3RL1RHBacPUF3aTZQkUxyW6t1g9NnYz/ZySf/oTuflKjsrzVgL HYYKp2NFhYIQU1bMCapxhBZKH4eYLvClvEEpMMUPGHrNIhXQBa3U8J8mJISSWsdmhE n94sJoMn2WP+OYWD/0pF7C80f0HHwAawkSyuq8GT4doBiZGRd5fLbpAK7k58zmCekV cLW7rxDJBp5Ew== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: Jiaxun Yang , Thomas Bogendoerfer , Huacai Chen , Paul Burton , Stephen Kitt , Andrew Morton , Nick Desaulniers , Serge Semin , Geert Uytterhoeven , Anshuman Khandual , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mike Rapoport , Daniel Silsby , Paul Cercueil , Mark Tomlinson , Greg Kroah-Hartman , Allison Randal , Thomas Gleixner , Tiezhu Yang , Wei Xu , John Garry , linux-kernel@vger.kernel.org Subject: [PATCH 4/4] MIPS: Loongson64: Enable PCI_IO_VMMAP Date: Sun, 26 Apr 2020 19:47:37 +0800 Message-Id: <20200426114806.1176629-5-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200426114806.1176629-1-jiaxun.yang@flygoat.com> References: <20200426114806.1176629-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Finally we are able to elegantly add I/O ports for PCI host bridge via devicetree with logic_pio. To deal with legacy drivers that have fixed I/O ports range we reserved 0x10000 in PCI_IOBASE, should be enough for i8259 i8042 stuff. Signed-off-by: Jiaxun Yang --- arch/mips/Kconfig | 1 + arch/mips/include/asm/io.h | 4 ++++ arch/mips/loongson64/init.c | 12 ++++++++---- arch/mips/loongson64/pci.c | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 4e5308178649..1669735dacd8 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -479,6 +479,7 @@ config MACH_LOONGSON64 select I8259 select IRQ_MIPS_CPU select NR_CPUS_DEFAULT_64 + select PCI_IO_VMMAP select USE_GENERIC_EARLY_PRINTK_8250 select SYS_HAS_CPU_LOONGSON64 select SYS_HAS_EARLY_PRINTK diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index f15ddcd27f35..7f9716c95aa0 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -66,6 +66,10 @@ #define PCI_IOBASE ((void __iomem *)PCI_IO_START) #define IOPORT_RW_BASE PCI_IO_START +#ifdef CONFIG_MACH_LOONGSON64 +#define MMIO_LOWER_RESERVED 0x10000 +#endif + #else #define IO_SPACE_LIMIT 0xffff diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c index da38944471f4..3117edbbea46 100644 --- a/arch/mips/loongson64/init.c +++ b/arch/mips/loongson64/init.c @@ -29,10 +29,6 @@ void __init prom_init(void) fw_init_cmdline(); prom_init_env(); - /* init base address of io space */ - set_io_port_base((unsigned long) - ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE)); - prom_init_numa_memory(); /* Hardcode to CPU UART 0 */ @@ -48,5 +44,13 @@ void __init prom_free_prom_memory(void) void __init arch_init_irq(void) { + /* + * i8259 would access I/O space, so mapping must be done here. + * Please remove it when all drivers can be managed by logic_pio. + */ + ioremap_page_range(PCI_IO_START, PCI_IO_START + MMIO_LOWER_RESERVED, + LOONGSON_PCIIO_BASE, + pgprot_device(PAGE_KERNEL)); + irqchip_init(); } diff --git a/arch/mips/loongson64/pci.c b/arch/mips/loongson64/pci.c index a440a2725a20..7aecb88dd377 100644 --- a/arch/mips/loongson64/pci.c +++ b/arch/mips/loongson64/pci.c @@ -37,7 +37,7 @@ extern int sbx00_acpi_init(void); static int __init pcibios_init(void) { - loongson_pci_controller.io_map_base = mips_io_port_base; + loongson_pci_controller.io_map_base = IOPORT_RW_BASE; loongson_pci_mem_resource.start = loongson_sysconf.pci_mem_start_addr; loongson_pci_mem_resource.end = loongson_sysconf.pci_mem_end_addr; -- 2.26.0.rc2