Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp163586imw; Wed, 13 Jul 2022 22:00:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v4U9/NGcirQ8u4wzxVyjiT4Rk/3tfSgPfaEZG3AnkBGrGSYA3VVrJf61R33Za2tu/hpCn7 X-Received: by 2002:a17:90b:4aca:b0:1f0:3395:6432 with SMTP id mh10-20020a17090b4aca00b001f033956432mr13722867pjb.19.1657774852836; Wed, 13 Jul 2022 22:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657774852; cv=none; d=google.com; s=arc-20160816; b=aAT09cvkGMmrEl4JyWkDoyNXWqZGfSDjfQd4LPPIW22f6WSHEA5CrU7lQCKz0vRTTr VKx6KLnbI9dh0nhkqvsClpI47hxtuiBLcjmMrLPyjSWRb1M+fZgr6K4+IZRf3rNXqHIt +5xuLCPx9RviGS4cNU8Vle+jqfI3NiQLxHWaUNkqwnux1i2Bk2RiRoQLWuNb/ZYOvz5+ qoreRgSrZzyJjLvrls9vJQQwuXZpxMXv67yIQ4QUE0A6N1dW0ertSTHZ8kSe7bUf8Hiy loist2Jg4BmW8AumKGFM4u5dDxZ1/yhvVatI00ZqYUMe95PuZS4Oxb7Db90CndGVAUVl 8PHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1ANa/UfBZBIYOUOOK5aYse1VM4y5RCfZnupJabCiODk=; b=u6pAK663zVP4K2xhuoW+1CNmZaNuiTqSIwc92Ms+Y98dNw5JXMfx5PPzIXwd5nJeB1 shAv1P5ffQ8MC1OWl7wpPbJ7aPvCo0V0+OrBHtKoo9C9q2419dCD24DouHgxjAO9eDUY nIBmtFcsW5+N2z8awPNbZd6mTgMWTje/Asw3OZBv0GwpT8RXazJlBS0zUVILpYaUqki6 0MeAn45sHLp4qndhAOJdDopAWhqcwPHpv1Fl89fHHm05loEuLHlC7sJPu8xkI+cyZJpK RXNCa3g+Z8CWzZKz3VLWfJ9FmBrcbxLf4YeIhUw0B11qdq32D+HtuBp8M58ojv5v58JE F5iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XyXet3y8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x22-20020a63b216000000b004129a78936fsi793568pge.1.2022.07.13.22.00.38; Wed, 13 Jul 2022 22:00:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XyXet3y8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237563AbiGNEkX (ORCPT + 99 others); Thu, 14 Jul 2022 00:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237567AbiGNEjz (ORCPT ); Thu, 14 Jul 2022 00:39:55 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 936F33FA3A for ; Wed, 13 Jul 2022 21:27:50 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id g16-20020a17090a7d1000b001ea9f820449so7067602pjl.5 for ; Wed, 13 Jul 2022 21:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1ANa/UfBZBIYOUOOK5aYse1VM4y5RCfZnupJabCiODk=; b=XyXet3y8zlu/z59ZUtVcN/LAQQMb4P3DKAdKdThaPQeHyy5vulQIu2gfwRzAn7RkEu 2lZ8kRNJ+ZpPwkUmYL8qYzJum+5/VYHRnXL8FHQoSEi5zI3v3H7sUn/pcX6mk25sHmaf C9kletF+w3P5LhJmWiJrfc4/HYoetV91307ferO9mbnOmbgMUdDnfZQA5F/QxJlqduKJ ieEgyKCNexFqoQQ3Zbl6qWDJZq1wHxAme79mdKyNA8LycVz9E4LckfmDB05lnFgHwTYs pfpNj3Y7BTkqJy2wkceCOL9HOXr7ICJRQvhaBNrIzaS1E+5dauDwo290aefyausoMcno 79xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1ANa/UfBZBIYOUOOK5aYse1VM4y5RCfZnupJabCiODk=; b=Xc3YmI7Buygwje3MFOQa0b7YXtvTHyyi8Xxos15xiCeC47Rj0B9R3qsA62r76jJCAP kcrJjI0jq4jltzkZVHQ8aQ61fj+ItsNrDz9JXpy8ERPrn2NubNGec5ZjImwWmIf9/No4 ktGM11lg6LXKadg3AwEzvsHiARbCtOhP9t3kLG7PRoVLb543ICDMYKuJTHmuhKFiA+Fr 2AJTa64x9N8r+G2804RYd/HZHk1o65e8QYA/usGkQHprOR3GQbNlIx1QaXdOsWEhCUcQ 3J2+qiitchBkdWfbmJ50N12cJGrcc8Yc+Q5F9ht9FrzTPVc+nk7iudio22FX7C5WkQiZ XtoQ== X-Gm-Message-State: AJIora8BOgec5SUv2mH08h+dTQn18priL16Q6YWNaGWLutm1QbwF9Xg8 TJVL9Yv/jJeEPdkrRKKlPselBrA/S50= X-Received: by 2002:a17:90b:30c4:b0:1ef:8d1b:f9bf with SMTP id hi4-20020a17090b30c400b001ef8d1bf9bfmr7637317pjb.158.1657772869879; Wed, 13 Jul 2022 21:27:49 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id x7-20020a1709027c0700b0016cae5f04e6sm284395pll.135.2022.07.13.21.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 21:27:49 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , Palmer Dabbelt , Peter Zijlstra , Arnd Bergmann Subject: [PATCH v2 1/2] openrisc: Add pci bus support Date: Thu, 14 Jul 2022 13:27:34 +0900 Message-Id: <20220714042736.2133067-2-shorne@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714042736.2133067-1-shorne@gmail.com> References: <20220714042736.2133067-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds required definitions to allow for PCI buses on OpenRISC. This is being in the QEMU virt platform. OpenRISC does not have IO ports so this defines PCI IO to be allowed in any range. Keeping PIO_RESERVED defined as 0 allows OpenRISC to use MMIO for all IO. Also, since commit 66bcd06099bb ("parport_pc: Also enable driver for PCI systems") all platforms that support PCI also need to support parallel port. We add a generic header to support parallel port drivers. Signed-off-by: Stafford Horne --- Since v1: - Revert definition of IO_SPACE_LIMIT arch/openrisc/Kconfig | 7 ++++--- arch/openrisc/include/asm/Kbuild | 1 + arch/openrisc/include/asm/io.h | 2 +- arch/openrisc/include/asm/pci.h | 36 ++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 arch/openrisc/include/asm/pci.h diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index e814df4c483c..327241988819 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -21,7 +21,9 @@ config OPENRISC select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW select GENERIC_IOMAP + select GENERIC_PCI_IOMAP select GENERIC_CPU_DEVICES + select HAVE_PCI select HAVE_UID16 select GENERIC_ATOMIC64 select GENERIC_CLOCKEVENTS_BROADCAST @@ -32,6 +34,8 @@ config OPENRISC select CPU_NO_EFFICIENT_FFS if !OPENRISC_HAVE_INST_FF1 select ARCH_USE_QUEUED_RWLOCKS select OMPIC if SMP + select PCI_DOMAINS_GENERIC if PCI + select PCI_MSI if PCI select ARCH_WANT_FRAME_POINTERS select GENERIC_IRQ_MULTI_HANDLER select MMU_GATHER_NO_RANGE if MMU @@ -46,9 +50,6 @@ config MMU config GENERIC_HWEIGHT def_bool y -config NO_IOPORT_MAP - def_bool y - # For now, use generic checksum functions #These can be reimplemented in assembly later if so inclined config GENERIC_CSUM diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild index 3386b9c1c073..c8c99b554ca4 100644 --- a/arch/openrisc/include/asm/Kbuild +++ b/arch/openrisc/include/asm/Kbuild @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 generic-y += extable.h generic-y += kvm_para.h +generic-y += parport.h generic-y += spinlock_types.h generic-y += spinlock.h generic-y += qrwlock_types.h diff --git a/arch/openrisc/include/asm/io.h b/arch/openrisc/include/asm/io.h index c298061c70a7..625ac6ad1205 100644 --- a/arch/openrisc/include/asm/io.h +++ b/arch/openrisc/include/asm/io.h @@ -17,7 +17,7 @@ #include /* - * PCI: can we really do 0 here if we have no port IO? + * PCI: We do not use IO ports in OpenRISC */ #define IO_SPACE_LIMIT 0 diff --git a/arch/openrisc/include/asm/pci.h b/arch/openrisc/include/asm/pci.h new file mode 100644 index 000000000000..e0865d2f3f42 --- /dev/null +++ b/arch/openrisc/include/asm/pci.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_OPENRISC_PCI_H +#define __ASM_OPENRISC_PCI_H + +#include +#include +#include + +#include + +#define PCIBIOS_MIN_IO 0 +#define PCIBIOS_MIN_MEM 0 + +/* OpenRISC bootloaders do not initialize PCI bus */ +#define pcibios_assign_all_busses() 1 + +#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1 + +extern int isa_dma_bridge_buggy; + +#ifdef CONFIG_PCI +static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) +{ + /* no legacy IRQs on or1k */ + return -ENODEV; +} + +static inline int pci_proc_domain(struct pci_bus *bus) +{ + /* always show the domain in /proc */ + return 1; +} +#endif /* CONFIG_PCI */ + +#endif /* __ASM_OPENRISC_PCI_H */ -- 2.36.1