From patchwork Thu Feb 21 15:44:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FAA615AC for ; Thu, 21 Feb 2019 15:45:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B5DB311AD for ; Thu, 21 Feb 2019 15:45:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FB093132D; Thu, 21 Feb 2019 15:45:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 655A4311AD for ; Thu, 21 Feb 2019 15:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dNtl+TU7zY0dlD7ox5bG93Wo+UykTUwJisUN1KyEvWI=; b=ErkhyEOD5bM3bW X5t07XVpf11eQOrfmQLGn3fBhr1pm8y5lberS2R+FptlhOkNA2/l8FFPJTK+QJ9+6tdQJ5Lchzc71 AWWAOsss1JUvjpws4yIMYpubyrakoRHneUo2bGVng4PF8EgTCcqNsLh99zzq3AhBMhrieyk4t0Prn 10w6bW+riMn2w6nTCLRMloIOgGmRlLXq0829B8AqLoMRlRR6KtwcQ8uSpS5A4++GlXhXPlvUYi0ku X15lwflkkACSpE1AthesgnCUg8zYxB96BxzT5tzF6Icgeh7+/5vsqukdplouQi2X8f/nVIsaH/gr6 iIIweuieMC6QRqCVDe/Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXS-00055c-7d; Thu, 21 Feb 2019 15:45:30 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqX9-0004hU-It for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:15 +0000 Received: by mail-lf1-x141.google.com with SMTP id z15so4427068lff.4 for ; Thu, 21 Feb 2019 07:45:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gSl17N1w/YV1K5V5/s6f0yi8s1SWFmXb9koW3edgf7A=; b=e+K62FD7fCiEnOc7Dssd+coQVVkQTLanWqDW2X45z1pMv7PfERsiQGkliaQNhKUfiD yvIGAfVItOsU4o0FuMZbFUmUg9rtR/4nJDLiAWhdba9U0F9gcy5CoDcArJnCIgb5Y/ch izcPQLyaxP/MZUqXAeI9Y+1IKhq5Do75yIaQqYyP7kks4KFeZhhVWQGOhhyjI+Cgrygq 0pt0oW0EfkGzyaoWQAVe12Q7W2iEHtf853/PxjXHDuDgi7IUjTznaLrcv9rghZqUFaaT 3GJMg2QZhS+KINe0iKhfyBh6TnEbR1Tnze7rCgWOifoFUUqleFWd4tgyXhodSO89CIQo c9Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gSl17N1w/YV1K5V5/s6f0yi8s1SWFmXb9koW3edgf7A=; b=cL7zhDqOCUQvbPUuG/dnSYNYyuK6RhjypDR5DGLKl93W/2C91x6DHBOqggqBYE76sz Q6gOgccCrJsXpjGJ2P9IicO1LO6WHr4sI2SWt0NxbojQ3cTrmOk8HYExZuhqHZdiDXAu +R+A0sE/Hj6E1GLc63AyLYVQKh86cQf4Gy2Zb43lvrY81nq+YaVGk5MppacgYrgrnXKp oFSV2I2BAanmHysLilneKnFii7JtucsDc3JZ9g86UYpiadJdWewEzZtiNEIW2uEWdwHz 5DdBy79XWsDKCoYgaOzDMcPq2BFjpwHeAR2rPM+XtjtOzYU6wGCvtJxxQK+CN8d3rJpT tseg== X-Gm-Message-State: AHQUAuYoUwyqrvSDx+Dm9MWAAzBOt/ZIpKUP44iHGBtNtOmg1fJs6Vq6 6cWEp4xEXrvjasCtGAvQrpFkxrDwNxk= X-Google-Smtp-Source: AHgI3IbylXXJLajxNb4FjmKWx0qEHMePAFJvMXEowuiCZnBWWgIbm1uiQ9m5aHF22C51kroQWKG0xg== X-Received: by 2002:ac2:518e:: with SMTP id u14mr23206232lfi.76.1550763909412; Thu, 21 Feb 2019 07:45:09 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:08 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 01/30 v2] ARM: ixp4xx: Convert to MULTI_IRQ_HANDLER Date: Thu, 21 Feb 2019 16:44:29 +0100 Message-Id: <20190221154458.23763-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074511_795522_C189C933 X-CRM114-Status: GOOD ( 23.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This rewrites the IXP4xx to use MULTI_IRQ_HANDLER and create an irqdomain for the irqchip in the platform. We convert the timer to request the interrupt like any other driver in the process. We bump all IRQs to 16+offset to avoid using IRQ 0 and set NR_IRQS to 512 (the default for most systems). This conveniently fits with the first 16 IRQs being pre-allocated when using SPARSE_IRQ. This is a prerequisite for SPARSE_IRQ and DT boot. Signed-off-by: Linus Walleij --- arch/arm/Kconfig | 1 + arch/arm/mach-ixp4xx/common.c | 109 +++++++++++++----- .../mach-ixp4xx/include/mach/entry-macro.S | 41 ------- arch/arm/mach-ixp4xx/include/mach/irqs.h | 95 ++++++++------- 4 files changed, 126 insertions(+), 120 deletions(-) delete mode 100644 arch/arm/mach-ixp4xx/include/mach/entry-macro.S diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 664e918e2624..0bdcacd40591 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -431,6 +431,7 @@ config ARCH_IXP4XX select CPU_XSCALE select DMABOUNCE if PCI select GENERIC_CLOCKEVENTS + select GENERIC_IRQ_MULTI_HANDLER select GPIOLIB select HAVE_PCI select NEED_MACH_IO_H diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 846e033c56fa..58a1b851425e 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -31,12 +31,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -54,6 +56,7 @@ (IXP4XX_OST_RELOAD_MASK + 1) * HZ) * \ (IXP4XX_OST_RELOAD_MASK + 1) +static struct irq_domain *ixp4xx_irqdomain; static void __init ixp4xx_clocksource_init(void); static void __init ixp4xx_clockevent_init(void); static struct clock_event_device clockevent_ixp4xx; @@ -166,16 +169,17 @@ static int ixp4xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type) { - int line = irq2gpio[d->irq]; + int line = irq2gpio[d->hwirq]; u32 int_style; enum ixp4xx_irq_type irq_type; volatile u32 *int_reg; /* * Only for GPIO IRQs + * all other IRQs are simply active low */ if (line < 0) - return -EINVAL; + return 0; switch (type){ case IRQ_TYPE_EDGE_BOTH: @@ -203,9 +207,9 @@ static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type) } if (irq_type == IXP4XX_IRQ_EDGE) - ixp4xx_irq_edge |= (1 << d->irq); + ixp4xx_irq_edge |= (1 << d->hwirq); else - ixp4xx_irq_edge &= ~(1 << d->irq); + ixp4xx_irq_edge &= ~(1 << d->hwirq); if (line >= 8) { /* pins 8-15 */ line -= 8; @@ -224,22 +228,22 @@ static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type) *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE)); /* Configure the line as an input */ - gpio_line_config(irq2gpio[d->irq], IXP4XX_GPIO_IN); + gpio_line_config(irq2gpio[d->hwirq], IXP4XX_GPIO_IN); return 0; } static void ixp4xx_irq_mask(struct irq_data *d) { - if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32) - *IXP4XX_ICMR2 &= ~(1 << (d->irq - 32)); + if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->hwirq >= 32) + *IXP4XX_ICMR2 &= ~(1 << (d->hwirq - 32)); else - *IXP4XX_ICMR &= ~(1 << d->irq); + *IXP4XX_ICMR &= ~(1 << d->hwirq); } static void ixp4xx_irq_ack(struct irq_data *d) { - int line = (d->irq < 32) ? irq2gpio[d->irq] : -1; + int line = (d->hwirq < 32) ? irq2gpio[d->hwirq] : -1; if (line >= 0) *IXP4XX_GPIO_GPISR = (1 << line); @@ -251,13 +255,13 @@ static void ixp4xx_irq_ack(struct irq_data *d) */ static void ixp4xx_irq_unmask(struct irq_data *d) { - if (!(ixp4xx_irq_edge & (1 << d->irq))) + if (!(ixp4xx_irq_edge & (1 << d->hwirq))) ixp4xx_irq_ack(d); - if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32) - *IXP4XX_ICMR2 |= (1 << (d->irq - 32)); + if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->hwirq >= 32) + *IXP4XX_ICMR2 |= (1 << (d->hwirq - 32)); else - *IXP4XX_ICMR |= (1 << d->irq); + *IXP4XX_ICMR |= (1 << d->hwirq); } static struct irq_chip ixp4xx_irq_chip = { @@ -268,9 +272,50 @@ static struct irq_chip ixp4xx_irq_chip = { .irq_set_type = ixp4xx_set_irq_type, }; +asmlinkage void __exception_irq_entry ixp4xx_handle_irq(struct pt_regs *regs) +{ + unsigned long status; + int i; + + status = *IXP4XX_ICIP; + + for_each_set_bit(i, &status, 32) + handle_domain_irq(ixp4xx_irqdomain, i, regs); + + /* + * IXP465/IXP435 has an upper IRQ status register + */ + if ((cpu_is_ixp46x() || cpu_is_ixp43x())) { + status = *IXP4XX_ICIP2; + for_each_set_bit(i, &status, 32) + handle_domain_irq(ixp4xx_irqdomain, i + 32, regs); + } +} + +static int ixp4xx_irqdomain_map(struct irq_domain *d, unsigned int irq, + irq_hw_number_t hwirq) +{ + irq_set_chip_data(irq, &ixp4xx_irq_chip); + irq_set_chip_and_handler(irq, &ixp4xx_irq_chip, handle_level_irq); + irq_set_probe(irq); + + return 0; +} + +static void ixp4xx_irqdomain_unmap(struct irq_domain *d, unsigned int irq) +{ + irq_set_chip_and_handler(irq, NULL, NULL); + irq_set_chip_data(irq, NULL); +} + +static const struct irq_domain_ops ixp4xx_irqdomain_ops = { + .map = ixp4xx_irqdomain_map, + .unmap = ixp4xx_irqdomain_unmap, +}; + void __init ixp4xx_init_irq(void) { - int i = 0; + int nr_irqs; /* * ixp4xx does not implement the XScale PWRMODE register @@ -290,14 +335,21 @@ void __init ixp4xx_init_irq(void) /* Disable upper 32 interrupts */ *IXP4XX_ICMR2 = 0x00; + + nr_irqs = 64; + } else { + nr_irqs = 32; } - /* Default to all level triggered */ - for(i = 0; i < NR_IRQS; i++) { - irq_set_chip_and_handler(i, &ixp4xx_irq_chip, - handle_level_irq); - irq_clear_status_flags(i, IRQ_NOREQUEST); + ixp4xx_irqdomain = irq_domain_add_simple(NULL, nr_irqs, IRQ_IXP4XX_BASE, + &ixp4xx_irqdomain_ops, + NULL); + if (!ixp4xx_irqdomain) { + pr_crit("can not add primary irqdomain\n"); + return; } + + set_handle_irq(ixp4xx_handle_irq); } @@ -319,13 +371,6 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct irqaction ixp4xx_timer_irq = { - .name = "timer1", - .flags = IRQF_TIMER | IRQF_IRQPOLL, - .handler = ixp4xx_timer_interrupt, - .dev_id = &clockevent_ixp4xx, -}; - void __init ixp4xx_timer_init(void) { /* Reset/disable counter */ @@ -337,9 +382,6 @@ void __init ixp4xx_timer_init(void) /* Reset time-stamp counter */ *IXP4XX_OSTS = 0; - /* Connect the interrupt handler and enable the interrupt */ - setup_irq(IRQ_IXP4XX_TIMER1, &ixp4xx_timer_irq); - ixp4xx_clocksource_init(); ixp4xx_clockevent_init(); } @@ -574,7 +616,16 @@ static struct clock_event_device clockevent_ixp4xx = { static void __init ixp4xx_clockevent_init(void) { + int ret; + clockevent_ixp4xx.cpumask = cpumask_of(0); + clockevent_ixp4xx.irq = IRQ_IXP4XX_TIMER1; + ret = request_irq(IRQ_IXP4XX_TIMER1, ixp4xx_timer_interrupt, + IRQF_TIMER, "IXP4XX-TIMER1", &clockevent_ixp4xx); + if (ret) { + pr_crit("no timer IRQ\n"); + return; + } clockevents_config_and_register(&clockevent_ixp4xx, IXP4XX_TIMER_FREQ, 0xf, 0xfffffffe); } diff --git a/arch/arm/mach-ixp4xx/include/mach/entry-macro.S b/arch/arm/mach-ixp4xx/include/mach/entry-macro.S deleted file mode 100644 index 79adf83e2c3d..000000000000 --- a/arch/arm/mach-ixp4xx/include/mach/entry-macro.S +++ /dev/null @@ -1,41 +0,0 @@ -/* - * arch/arm/mach-ixp4xx/include/mach/entry-macro.S - * - * Low-level IRQ helper macros for IXP4xx-based platforms - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ -#include - - .macro get_irqnr_preamble, base, tmp - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET) - ldr \irqstat, [\irqstat] @ get interrupts - cmp \irqstat, #0 - beq 1001f @ upper IRQ? - clz \irqnr, \irqstat - mov \base, #31 - sub \irqnr, \base, \irqnr - b 1002f @ lower IRQ being - @ handled - -1001: - /* - * IXP465/IXP435 has an upper IRQ status register - */ -#if defined(CONFIG_CPU_IXP46X) || defined(CONFIG_CPU_IXP43X) - ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP2_OFFSET) - ldr \irqstat, [\irqstat] @ get upper interrupts - mov \irqnr, #63 - clz \irqstat, \irqstat - cmp \irqstat, #32 - subne \irqnr, \irqnr, \irqstat -#endif -1002: - .endm - - diff --git a/arch/arm/mach-ixp4xx/include/mach/irqs.h b/arch/arm/mach-ixp4xx/include/mach/irqs.h index 7e6d4cce7c27..dadcd4ddb0a9 100644 --- a/arch/arm/mach-ixp4xx/include/mach/irqs.h +++ b/arch/arm/mach-ixp4xx/include/mach/irqs.h @@ -15,60 +15,55 @@ #ifndef _ARCH_IXP4XX_IRQS_H_ #define _ARCH_IXP4XX_IRQS_H_ -#define IRQ_IXP4XX_NPEA 0 -#define IRQ_IXP4XX_NPEB 1 -#define IRQ_IXP4XX_NPEC 2 -#define IRQ_IXP4XX_QM1 3 -#define IRQ_IXP4XX_QM2 4 -#define IRQ_IXP4XX_TIMER1 5 -#define IRQ_IXP4XX_GPIO0 6 -#define IRQ_IXP4XX_GPIO1 7 -#define IRQ_IXP4XX_PCI_INT 8 -#define IRQ_IXP4XX_PCI_DMA1 9 -#define IRQ_IXP4XX_PCI_DMA2 10 -#define IRQ_IXP4XX_TIMER2 11 -#define IRQ_IXP4XX_USB 12 -#define IRQ_IXP4XX_UART2 13 -#define IRQ_IXP4XX_TIMESTAMP 14 -#define IRQ_IXP4XX_UART1 15 -#define IRQ_IXP4XX_WDOG 16 -#define IRQ_IXP4XX_AHB_PMU 17 -#define IRQ_IXP4XX_XSCALE_PMU 18 -#define IRQ_IXP4XX_GPIO2 19 -#define IRQ_IXP4XX_GPIO3 20 -#define IRQ_IXP4XX_GPIO4 21 -#define IRQ_IXP4XX_GPIO5 22 -#define IRQ_IXP4XX_GPIO6 23 -#define IRQ_IXP4XX_GPIO7 24 -#define IRQ_IXP4XX_GPIO8 25 -#define IRQ_IXP4XX_GPIO9 26 -#define IRQ_IXP4XX_GPIO10 27 -#define IRQ_IXP4XX_GPIO11 28 -#define IRQ_IXP4XX_GPIO12 29 -#define IRQ_IXP4XX_SW_INT1 30 -#define IRQ_IXP4XX_SW_INT2 31 -#define IRQ_IXP4XX_USB_HOST 32 -#define IRQ_IXP4XX_I2C 33 -#define IRQ_IXP4XX_SSP 34 -#define IRQ_IXP4XX_TSYNC 35 -#define IRQ_IXP4XX_EAU_DONE 36 -#define IRQ_IXP4XX_SHA_DONE 37 -#define IRQ_IXP4XX_SWCP_PE 58 -#define IRQ_IXP4XX_QM_PE 60 -#define IRQ_IXP4XX_MCU_ECC 61 -#define IRQ_IXP4XX_EXP_PE 62 +#define IRQ_IXP4XX_BASE 16 + +#define IRQ_IXP4XX_NPEA (IRQ_IXP4XX_BASE + 0) +#define IRQ_IXP4XX_NPEB (IRQ_IXP4XX_BASE + 1) +#define IRQ_IXP4XX_NPEC (IRQ_IXP4XX_BASE + 2) +#define IRQ_IXP4XX_QM1 (IRQ_IXP4XX_BASE + 3) +#define IRQ_IXP4XX_QM2 (IRQ_IXP4XX_BASE + 4) +#define IRQ_IXP4XX_TIMER1 (IRQ_IXP4XX_BASE + 5) +#define IRQ_IXP4XX_GPIO0 (IRQ_IXP4XX_BASE + 6) +#define IRQ_IXP4XX_GPIO1 (IRQ_IXP4XX_BASE + 7) +#define IRQ_IXP4XX_PCI_INT (IRQ_IXP4XX_BASE + 8) +#define IRQ_IXP4XX_PCI_DMA1 (IRQ_IXP4XX_BASE + 9) +#define IRQ_IXP4XX_PCI_DMA2 (IRQ_IXP4XX_BASE + 10) +#define IRQ_IXP4XX_TIMER2 (IRQ_IXP4XX_BASE + 11) +#define IRQ_IXP4XX_USB (IRQ_IXP4XX_BASE + 12) +#define IRQ_IXP4XX_UART2 (IRQ_IXP4XX_BASE + 13) +#define IRQ_IXP4XX_TIMESTAMP (IRQ_IXP4XX_BASE + 14) +#define IRQ_IXP4XX_UART1 (IRQ_IXP4XX_BASE + 15) +#define IRQ_IXP4XX_WDOG (IRQ_IXP4XX_BASE + 16) +#define IRQ_IXP4XX_AHB_PMU (IRQ_IXP4XX_BASE + 17) +#define IRQ_IXP4XX_XSCALE_PMU (IRQ_IXP4XX_BASE + 18) +#define IRQ_IXP4XX_GPIO2 (IRQ_IXP4XX_BASE + 19) +#define IRQ_IXP4XX_GPIO3 (IRQ_IXP4XX_BASE + 20) +#define IRQ_IXP4XX_GPIO4 (IRQ_IXP4XX_BASE + 21) +#define IRQ_IXP4XX_GPIO5 (IRQ_IXP4XX_BASE + 22) +#define IRQ_IXP4XX_GPIO6 (IRQ_IXP4XX_BASE + 23) +#define IRQ_IXP4XX_GPIO7 (IRQ_IXP4XX_BASE + 24) +#define IRQ_IXP4XX_GPIO8 (IRQ_IXP4XX_BASE + 25) +#define IRQ_IXP4XX_GPIO9 (IRQ_IXP4XX_BASE + 26) +#define IRQ_IXP4XX_GPIO10 (IRQ_IXP4XX_BASE + 27) +#define IRQ_IXP4XX_GPIO11 (IRQ_IXP4XX_BASE + 28) +#define IRQ_IXP4XX_GPIO12 (IRQ_IXP4XX_BASE + 29) +#define IRQ_IXP4XX_SW_INT1 (IRQ_IXP4XX_BASE + 30) +#define IRQ_IXP4XX_SW_INT2 (IRQ_IXP4XX_BASE + 31) +#define IRQ_IXP4XX_USB_HOST (IRQ_IXP4XX_BASE + 32) +#define IRQ_IXP4XX_I2C (IRQ_IXP4XX_BASE + 33) +#define IRQ_IXP4XX_SSP (IRQ_IXP4XX_BASE + 34) +#define IRQ_IXP4XX_TSYNC (IRQ_IXP4XX_BASE + 35) +#define IRQ_IXP4XX_EAU_DONE (IRQ_IXP4XX_BASE + 36) +#define IRQ_IXP4XX_SHA_DONE (IRQ_IXP4XX_BASE + 37) +#define IRQ_IXP4XX_SWCP_PE (IRQ_IXP4XX_BASE + 58) +#define IRQ_IXP4XX_QM_PE (IRQ_IXP4XX_BASE + 60) +#define IRQ_IXP4XX_MCU_ECC (IRQ_IXP4XX_BASE + 61) +#define IRQ_IXP4XX_EXP_PE (IRQ_IXP4XX_BASE + 62) #define _IXP4XX_GPIO_IRQ(n) (IRQ_IXP4XX_GPIO ## n) #define IXP4XX_GPIO_IRQ(n) _IXP4XX_GPIO_IRQ(n) -/* - * Only first 32 sources are valid if running on IXP42x systems - */ -#if defined(CONFIG_CPU_IXP46X) || defined(CONFIG_CPU_IXP43X) -#define NR_IRQS 64 -#else -#define NR_IRQS 32 -#endif +#define NR_IRQS 512 #define XSCALE_PMU_IRQ (IRQ_IXP4XX_XSCALE_PMU) From patchwork Thu Feb 21 15:44:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824225 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A46B515AC for ; Thu, 21 Feb 2019 15:45:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 904A531392 for ; Thu, 21 Feb 2019 15:45:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82AB1313C9; Thu, 21 Feb 2019 15:45:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A8BC31392 for ; Thu, 21 Feb 2019 15:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EbvFgoAoxiMHp1SxYuI8z59F+UQVkffME3J2gi4VKfg=; b=ARfsdoEReTBHsn uem4qNL6+PievasyV0fI4YED5B/9Up93B18WOdiZUlL3jvfXz8yn+TPieqFOJl2O/JU4Vv4E8NaV7 gurSEv1q3rSp0c/n3eIEmk2kAaIRnwz0+kz8VE9svpCOlhIjla3IlYGxqGnUKGthLWcQITSQW5NNC 6lpswz0o61qVShZHBlIUU8BdX+ktwkb4wVM0vGZV5z67LEdjrDj9KHiVPjYonKJkX3DUvOTQbCyys A215o9genmbFFOxlX8x9UNNVq/fXzz43cIhpKuY6kugKmxgo8BWOfyq+n38+vI7kPdD4i/8Zo1NPh vEO82NF/m6zP3CGwTUbw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXd-0005If-E6; Thu, 21 Feb 2019 15:45:41 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXC-0004ih-Ib for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:19 +0000 Received: by mail-lf1-x143.google.com with SMTP id m11so20695083lfc.6 for ; Thu, 21 Feb 2019 07:45:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Es9lmnWGPrW56PqgZ2XPTnl0t5zSduT/F6R/jNouSec=; b=FkysAEU4ylkoloNJHmLnvE7Vfg7yI+ritB6kYW/hukvRBL/wBlhRQSCUL35rKTzj84 M4MLbphrtZf/A7ECMW1ojUVobYgk8jXxV/NUYpcSavdU38LpcUjDQyXoNboytVjiXrus waWZ7GC8KVHPDX0E4QwOEkxDmZhjd1yQlfoM89QFAepkygNmlTm4lGRAZ7kgtM0AW3Nb 9noXpvvxFoBMQ4vTRLRXjfsm9JO0DrBgcLwr7pWZc8yA6limgScdQfeST6Zew+x4YkTl wldNS3XqFqlpGxlHaBttemm/ZSmEwIh5Ungn0cvU6CLskVcSZ5e5iZtUfUoQsHzEDm96 eI+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Es9lmnWGPrW56PqgZ2XPTnl0t5zSduT/F6R/jNouSec=; b=twqFxEI1LrK8sk83vVWqTVW7N+oJhlO5FOet77aYHbkQYJFk4zHvl82Gnz8E2WaBCt UDLvGHwETtaUsI7ElHhv9T+sI+8qSAuVMxSK7J46vbpEw718FISm6NvSdqBYI408dCE9 2Pq9ofDZqMOb+lRpOyYF+GU1WBwGPVh3626ZvlRksr0/nklX5oKBgCDQRCcwlIYn+kVu pNX6Gyjb7yD/XGcfzbQzixV295djptvSbwXxIRLi5PZNoMqS9xlonzM2j2HX2WyNeU1a Dk/9HJFbBc8Hgy58N1DPI+H0htLkoFKGQbfGm5RgCT2Q6y/7JSsM5Ly+0KPKYpJo7wxR qvcw== X-Gm-Message-State: AHQUAuYPzj95MWjowKstZb9Q2bxAPeTGcYA8oJ/NveptKBna88Du1ia6 t75aGRaoclbbou54gHDsDf5PhUuOwM4= X-Google-Smtp-Source: AHgI3Iamrc5qWJf9hj+XjsK+rQKYTFhU2k53mtK13nj7vH5ZGVuUlAJhVNBXERHqABVG5S4hF5je1g== X-Received: by 2002:ac2:51bc:: with SMTP id f28mr26068769lfk.123.1550763912126; Thu, 21 Feb 2019 07:45:12 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:10 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 02/30 v2] ARM: ixp4xx: Pass IRQ resource to beeper Date: Thu, 21 Feb 2019 16:44:30 +0100 Message-Id: <20190221154458.23763-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074515_160803_B516509A X-CRM114-Status: GOOD ( 17.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP All IXP4xx devices except the beeper passes the IRQ as a resource, augment the NSLU2 beeper to do the same. This is a prerequisite for SPARSE_IRQ. Signed-off-by: Linus Walleij --- arch/arm/mach-ixp4xx/nslu2-setup.c | 10 +++++++++- drivers/input/misc/ixp4xx-beeper.c | 20 +++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index 341b263482ef..7c2b6604187e 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c @@ -125,10 +125,18 @@ static struct platform_device nslu2_i2c_gpio = { }, }; +static struct resource nslu2_beeper_resources[] = { + { + .start = IRQ_IXP4XX_TIMER2, + .flags = IORESOURCE_IRQ, + }, +}; + static struct platform_device nslu2_beeper = { .name = "ixp4xx-beeper", .id = NSLU2_GPIO_BUZZ, - .num_resources = 0, + .resource = nslu2_beeper_resources, + .num_resources = ARRAY_SIZE(nslu2_beeper_resources), }; static struct resource nslu2_uart_resources[] = { diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index 1fe149f3def2..4776273fa10b 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c @@ -30,6 +30,8 @@ MODULE_ALIAS("platform:ixp4xx-beeper"); static DEFINE_SPINLOCK(beep_lock); +static int ixp4xx_timer2_irq; + static void ixp4xx_spkr_control(unsigned int pin, unsigned int count) { unsigned long flags; @@ -90,6 +92,7 @@ static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id) static int ixp4xx_spkr_probe(struct platform_device *dev) { struct input_dev *input_dev; + int irq; int err; input_dev = input_allocate_device(); @@ -110,15 +113,22 @@ static int ixp4xx_spkr_probe(struct platform_device *dev) input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE); input_dev->event = ixp4xx_spkr_event; + irq = platform_get_irq(dev, 0); + if (irq < 0) { + err = irq; + goto err_free_device; + } + err = gpio_request(dev->id, "ixp4-beeper"); if (err) goto err_free_device; - err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt, + err = request_irq(irq, &ixp4xx_spkr_interrupt, IRQF_NO_SUSPEND, "ixp4xx-beeper", (void *) dev->id); if (err) goto err_free_gpio; + ixp4xx_timer2_irq = irq; err = input_register_device(input_dev); if (err) @@ -129,7 +139,7 @@ static int ixp4xx_spkr_probe(struct platform_device *dev) return 0; err_free_irq: - free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); + free_irq(irq, (void *)dev->id); err_free_gpio: gpio_free(dev->id); err_free_device: @@ -146,10 +156,10 @@ static int ixp4xx_spkr_remove(struct platform_device *dev) input_unregister_device(input_dev); /* turn the speaker off */ - disable_irq(IRQ_IXP4XX_TIMER2); + disable_irq(ixp4xx_timer2_irq); ixp4xx_spkr_control(pin, 0); - free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); + free_irq(ixp4xx_timer2_irq, (void *)dev->id); gpio_free(dev->id); return 0; @@ -161,7 +171,7 @@ static void ixp4xx_spkr_shutdown(struct platform_device *dev) unsigned int pin = (unsigned int) input_get_drvdata(input_dev); /* turn off the speaker */ - disable_irq(IRQ_IXP4XX_TIMER2); + disable_irq(ixp4xx_timer2_irq); ixp4xx_spkr_control(pin, 0); } From patchwork Thu Feb 21 15:44:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE77A6C2 for ; Thu, 21 Feb 2019 15:46:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAD1B313C9 for ; Thu, 21 Feb 2019 15:46:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE9693141E; Thu, 21 Feb 2019 15:46:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE196313C9 for ; Thu, 21 Feb 2019 15:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1T+3Shyjff9a3yJznE5tqqkmRuWqVbNENCawz1BbzLk=; b=jnVmSchZ2Njxdl I4DTdWb6rBTkr0ItGZl8kPie9yDv26y6vB7/qly9xBjolNSeFeMznHGmh5qGYc989k4d2b3cFam25 OMye43X0SGPUg6bYGziwzurRNl0jTKXS4I+oXvsEjqDzhAg/nM4JtmLpZfaGtoRco1L459MhtPnM7 pgt8eGT5fW3x0ktVn1d50aWHlsgG2RT3k2ULEdijVg/i6BRGda5BUUb4V9vmLXrMk0lj8G9xH/6Kd xsEGMEcLKdCkKpZBvWzPaIHWLBAJa5d2pbyAjAh+c0nNgBXxeW4u2AoaUE4fLvK7t3K41KuVAO8HB ZRsVDJFpe94IIVtnwnNw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXo-0005Y3-3h; Thu, 21 Feb 2019 15:45:52 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXF-0004n0-BL for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:23 +0000 Received: by mail-lf1-x143.google.com with SMTP id j1so20697251lfb.10 for ; Thu, 21 Feb 2019 07:45:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NB14pN23cU5a79uf5Vo+6b4TfyyyCbisUIZiRj9SV0c=; b=n2D4RM0sd7tij8qE47B6TTI1pA+vAm1jx+kLrXSegWVmKX0MQSKeHSJxtRwexFXy+I EecG5AOO59A5DQ9RGR0mTsde1lbhwcBs3CuOJAtEhC+LHt8BwNuRIu18qPijzXVBGGv6 BFLSmWzu/Z4qMccfwvIbTKvvIa9zw8LAewGNYbOz+kynYVDEu+HQbO8xd7VrxgnLGLrn 9s9GyyeO/LF5BfM0sX1MEzmbciwJvq/qHp0FoylRS85UW/xotOq7qW4VnTPQXd4h1H2b nCPmrVcQLq4zDbHvZhrfCMjoRlyoeSkJgr1FkhXr748qhL3NyPl7231vxaXWepol2cdZ zO4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NB14pN23cU5a79uf5Vo+6b4TfyyyCbisUIZiRj9SV0c=; b=c2aiuDS/Jjk9su0uwM5pDvjXvgiL/XMO3e1PSqNeFQ1QjcDaAf2g/uLc4p1cN4xrNT uua9z1QoJ9aHuWs1i3ITSbovGASaJRzsTUW4jRsz2M5+jVwWSNIrGLrpqh4c3EVZozqk gAS3FjVxs24DJxEDIp8rjzEl4JHm+ZCcOi/DAEKDLokaXhbJUtd+B7Oo9tQPondIfKNY XS/Qwsl2+pQBXpO8JY5KkH04W7Q62mqUbByw+7ZywJnh+LzqlO5UhbldMTRbagpQvgKq sqRJOsMejzihNUcv64oHu5OVvXemXo6IO9Yk9cg5CAI3e9VH7rAoalvdIp8LDkyZ5mJ4 NmUQ== X-Gm-Message-State: AHQUAua5uk8zt4BupjZMNQOOCPXzbuho9rM2g6SffVYo7AD/WernBEIJ e779ETFOOeQDfhRqzr5Tq4+TA52lTp8= X-Google-Smtp-Source: AHgI3IYuTeXwEovqLPoQDn8n1nRWggMHqs7gKwnQ4uy1VFgnqlP2kfy9fPsCM2R/zmregAuWnjUwLg== X-Received: by 2002:ac2:5328:: with SMTP id f8mr21376687lfh.42.1550763915020; Thu, 21 Feb 2019 07:45:15 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:13 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 03/30 v2] ARM: ixp4xx: Convert to SPARSE_IRQ Date: Thu, 21 Feb 2019 16:44:31 +0100 Message-Id: <20190221154458.23763-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074517_934928_C3717DE4 X-CRM114-Status: GOOD ( 13.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This localizes the header to the mach-ixp4xx directory, removes NR_IRQS and switches IXP4xx over to using SPARSE_IRQ. This is a prerequisite for DT support. Signed-off-by: Linus Walleij --- arch/arm/Kconfig | 1 + arch/arm/mach-ixp4xx/avila-pci.c | 2 ++ arch/arm/mach-ixp4xx/avila-setup.c | 2 ++ arch/arm/mach-ixp4xx/common.c | 2 ++ arch/arm/mach-ixp4xx/coyote-pci.c | 2 ++ arch/arm/mach-ixp4xx/coyote-setup.c | 2 ++ arch/arm/mach-ixp4xx/dsmg600-pci.c | 2 ++ arch/arm/mach-ixp4xx/dsmg600-setup.c | 2 ++ arch/arm/mach-ixp4xx/fsg-pci.c | 2 ++ arch/arm/mach-ixp4xx/fsg-setup.c | 2 ++ arch/arm/mach-ixp4xx/gateway7001-pci.c | 2 ++ arch/arm/mach-ixp4xx/gateway7001-setup.c | 2 ++ arch/arm/mach-ixp4xx/gtwx5715-pci.c | 2 ++ arch/arm/mach-ixp4xx/gtwx5715-setup.c | 2 ++ arch/arm/mach-ixp4xx/{include/mach => }/irqs.h | 2 -- arch/arm/mach-ixp4xx/ixdp425-pci.c | 2 ++ arch/arm/mach-ixp4xx/ixdp425-setup.c | 2 ++ arch/arm/mach-ixp4xx/ixdpg425-pci.c | 2 ++ arch/arm/mach-ixp4xx/ixp4xx_qmgr.c | 2 ++ arch/arm/mach-ixp4xx/nas100d-pci.c | 2 ++ arch/arm/mach-ixp4xx/nas100d-setup.c | 2 ++ arch/arm/mach-ixp4xx/nslu2-pci.c | 2 ++ arch/arm/mach-ixp4xx/nslu2-setup.c | 2 ++ arch/arm/mach-ixp4xx/wg302v2-pci.c | 2 ++ arch/arm/mach-ixp4xx/wg302v2-setup.c | 2 ++ 25 files changed, 47 insertions(+), 2 deletions(-) rename arch/arm/mach-ixp4xx/{include/mach => }/irqs.h (99%) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0bdcacd40591..de2a5647e85d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -435,6 +435,7 @@ config ARCH_IXP4XX select GPIOLIB select HAVE_PCI select NEED_MACH_IO_H + select SPARSE_IRQ select USB_EHCI_BIG_ENDIAN_DESC select USB_EHCI_BIG_ENDIAN_MMIO help diff --git a/arch/arm/mach-ixp4xx/avila-pci.c b/arch/arm/mach-ixp4xx/avila-pci.c index 548c7d43ade6..9c834f0f4231 100644 --- a/arch/arm/mach-ixp4xx/avila-pci.c +++ b/arch/arm/mach-ixp4xx/avila-pci.c @@ -27,6 +27,8 @@ #include #include +#include "irqs.h" + #define AVILA_MAX_DEV 4 #define LOFT_MAX_DEV 6 #define IRQ_LINES 4 diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c index 44cbbce6bda6..1981b33109cb 100644 --- a/arch/arm/mach-ixp4xx/avila-setup.c +++ b/arch/arm/mach-ixp4xx/avila-setup.c @@ -28,6 +28,8 @@ #include #include +#include "irqs.h" + #define AVILA_SDA_PIN 7 #define AVILA_SCL_PIN 6 diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 58a1b851425e..aa8fd248c125 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -45,6 +45,8 @@ #include #include +#include "irqs.h" + #define IXP4XX_TIMER_FREQ 66666000 /* diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c index 5d14ce2aee6d..a16c35d2bb96 100644 --- a/arch/arm/mach-ixp4xx/coyote-pci.c +++ b/arch/arm/mach-ixp4xx/coyote-pci.c @@ -23,6 +23,8 @@ #include #include +#include "irqs.h" + #define SLOT0_DEVID 14 #define SLOT1_DEVID 15 diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c index 7e40fe70933b..7ca43ca2816d 100644 --- a/arch/arm/mach-ixp4xx/coyote-setup.c +++ b/arch/arm/mach-ixp4xx/coyote-setup.c @@ -25,6 +25,8 @@ #include #include +#include "irqs.h" + #define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3) #define COYOTE_IDE_BASE_VIRT 0xFFFE1000 #define COYOTE_IDE_REGION_SIZE 0x1000 diff --git a/arch/arm/mach-ixp4xx/dsmg600-pci.c b/arch/arm/mach-ixp4xx/dsmg600-pci.c index 8dca76937723..6899023bd1b7 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-pci.c +++ b/arch/arm/mach-ixp4xx/dsmg600-pci.c @@ -22,6 +22,8 @@ #include #include +#include "irqs.h" + #define MAX_DEV 4 #define IRQ_LINES 3 diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c index 397190f3a8da..0daaede8fb6d 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c @@ -35,6 +35,8 @@ #include #include +#include "irqs.h" + #define DSMG600_SDA_PIN 5 #define DSMG600_SCL_PIN 4 diff --git a/arch/arm/mach-ixp4xx/fsg-pci.c b/arch/arm/mach-ixp4xx/fsg-pci.c index fd4a8625b4ae..6c08bb9d9807 100644 --- a/arch/arm/mach-ixp4xx/fsg-pci.c +++ b/arch/arm/mach-ixp4xx/fsg-pci.c @@ -22,6 +22,8 @@ #include #include +#include "irqs.h" + #define MAX_DEV 3 #define IRQ_LINES 3 diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c index f0a152e365b1..648932d8d7a8 100644 --- a/arch/arm/mach-ixp4xx/fsg-setup.c +++ b/arch/arm/mach-ixp4xx/fsg-setup.c @@ -29,6 +29,8 @@ #include #include +#include "irqs.h" + #define FSG_SDA_PIN 12 #define FSG_SCL_PIN 13 diff --git a/arch/arm/mach-ixp4xx/gateway7001-pci.c b/arch/arm/mach-ixp4xx/gateway7001-pci.c index d9d6cc089707..903c75330b76 100644 --- a/arch/arm/mach-ixp4xx/gateway7001-pci.c +++ b/arch/arm/mach-ixp4xx/gateway7001-pci.c @@ -27,6 +27,8 @@ #include +#include "irqs.h" + void __init gateway7001_pci_preinit(void) { irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW); diff --git a/arch/arm/mach-ixp4xx/gateway7001-setup.c b/arch/arm/mach-ixp4xx/gateway7001-setup.c index 1be6faf6da9a..678e7dfff0e5 100644 --- a/arch/arm/mach-ixp4xx/gateway7001-setup.c +++ b/arch/arm/mach-ixp4xx/gateway7001-setup.c @@ -28,6 +28,8 @@ #include #include +#include "irqs.h" + static struct flash_platform_data gateway7001_flash_data = { .map_name = "cfi_probe", .width = 2, diff --git a/arch/arm/mach-ixp4xx/gtwx5715-pci.c b/arch/arm/mach-ixp4xx/gtwx5715-pci.c index 551d114c9e14..1223d160448f 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-pci.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-pci.c @@ -30,6 +30,8 @@ #include #include +#include "irqs.h" + #define SLOT0_DEVID 0 #define SLOT1_DEVID 1 #define INTA 10 /* slot 1 has INTA and INTB crossed */ diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c index 16a12994fb53..5dbdde8e2338 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c @@ -36,6 +36,8 @@ #include #include +#include "irqs.h" + /* GPIO 5,6,7 and 12 are hard wired to the Kendin KS8995M Switch and operate as an SPI type interface. The details of the interface are available on Kendin/Micrel's web site. */ diff --git a/arch/arm/mach-ixp4xx/include/mach/irqs.h b/arch/arm/mach-ixp4xx/irqs.h similarity index 99% rename from arch/arm/mach-ixp4xx/include/mach/irqs.h rename to arch/arm/mach-ixp4xx/irqs.h index dadcd4ddb0a9..6b7f220cf9e0 100644 --- a/arch/arm/mach-ixp4xx/include/mach/irqs.h +++ b/arch/arm/mach-ixp4xx/irqs.h @@ -63,8 +63,6 @@ #define _IXP4XX_GPIO_IRQ(n) (IRQ_IXP4XX_GPIO ## n) #define IXP4XX_GPIO_IRQ(n) _IXP4XX_GPIO_IRQ(n) -#define NR_IRQS 512 - #define XSCALE_PMU_IRQ (IRQ_IXP4XX_XSCALE_PMU) #endif diff --git a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c index 318424dd3c50..c1340465b2ea 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c @@ -24,6 +24,8 @@ #include #include +#include "irqs.h" + #define MAX_DEV 4 #define IRQ_LINES 4 diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index 57d7df79d838..6f0f7ed18ea8 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c @@ -32,6 +32,8 @@ #include #include +#include "irqs.h" + #define IXDP425_SDA_PIN 7 #define IXDP425_SCL_PIN 6 diff --git a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c index 1f8717ba13dc..ac0e9bc6eb4d 100644 --- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c +++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c @@ -23,6 +23,8 @@ #include +#include "irqs.h" + void __init ixdpg425_pci_preinit(void) { irq_set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW); diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c index 9d1b6b7c394c..4c7c960e1b4c 100644 --- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c +++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c @@ -14,6 +14,8 @@ #include #include +#include "irqs.h" + static struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; static struct resource *mem_res; static spinlock_t qmgr_lock; diff --git a/arch/arm/mach-ixp4xx/nas100d-pci.c b/arch/arm/mach-ixp4xx/nas100d-pci.c index 8f0eba0a6800..925ef805f966 100644 --- a/arch/arm/mach-ixp4xx/nas100d-pci.c +++ b/arch/arm/mach-ixp4xx/nas100d-pci.c @@ -21,6 +21,8 @@ #include #include +#include "irqs.h" + #define MAX_DEV 3 #define IRQ_LINES 3 diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index 4138d6aa4c52..9d67f8de0772 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c @@ -34,6 +34,8 @@ #include #include +#include "irqs.h" + #define NAS100D_SDA_PIN 5 #define NAS100D_SCL_PIN 6 diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c index 032defe111aa..d69ee4066d20 100644 --- a/arch/arm/mach-ixp4xx/nslu2-pci.c +++ b/arch/arm/mach-ixp4xx/nslu2-pci.c @@ -21,6 +21,8 @@ #include #include +#include "irqs.h" + #define MAX_DEV 3 #define IRQ_LINES 3 diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index 7c2b6604187e..ee1877fcfafe 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c @@ -32,6 +32,8 @@ #include #include +#include "irqs.h" + #define NSLU2_SDA_PIN 7 #define NSLU2_SCL_PIN 6 diff --git a/arch/arm/mach-ixp4xx/wg302v2-pci.c b/arch/arm/mach-ixp4xx/wg302v2-pci.c index c92e5b82af36..cf83f7e24179 100644 --- a/arch/arm/mach-ixp4xx/wg302v2-pci.c +++ b/arch/arm/mach-ixp4xx/wg302v2-pci.c @@ -27,6 +27,8 @@ #include +#include "irqs.h" + void __init wg302v2_pci_preinit(void) { irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW); diff --git a/arch/arm/mach-ixp4xx/wg302v2-setup.c b/arch/arm/mach-ixp4xx/wg302v2-setup.c index 90b3c604e8b6..8711e299229b 100644 --- a/arch/arm/mach-ixp4xx/wg302v2-setup.c +++ b/arch/arm/mach-ixp4xx/wg302v2-setup.c @@ -29,6 +29,8 @@ #include #include +#include "irqs.h" + static struct flash_platform_data wg302v2_flash_data = { .map_name = "cfi_probe", .width = 2, From patchwork Thu Feb 21 15:44:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD6F915AC for ; Thu, 21 Feb 2019 15:46:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A650A313C9 for ; Thu, 21 Feb 2019 15:46:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A0F1314DB; Thu, 21 Feb 2019 15:46:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A413C313C9 for ; Thu, 21 Feb 2019 15:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1nGqjDL5YA56meIhSQT+GzBqd5pErAyj1CT4QEXnDME=; b=JQxPOpVmcD9RrH wI/9tCIzvDOsDY3Rp2ehOASTZBxPGAGeqmp3jIYhhw2PiV3SePibYa3P0Z8ohoVp2qn1tGR6NlpeN RhBqZIiLX5vuoqpPQjQvK90j+mDKNepRSXMmMH39hPxvdVFG0i3OZry6geU/mLpDXpXjp/IDS078F AdBRlelsMo65bhktDVtaOC1+GzU9/8BKnMoCbP8b3V8q8qOaUYDRdZy6Q2pH2jTp18svJhhTrVQRc Q5Jxwq8B2M4SxrYho28jnBwyjSrj1XtqIp3PIjK2OpIZBImSQM9UMwEbFY7vLao6xMC8Rh+qJwiln HyKXN4bIwt5ZikBC3FHA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXz-0005oP-Pv; Thu, 21 Feb 2019 15:46:03 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXI-0004rT-V6 for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:28 +0000 Received: by mail-lf1-x142.google.com with SMTP id t14so20704960lfk.7 for ; Thu, 21 Feb 2019 07:45:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jWv+JMLmshTBCha3Qg9EKXdDDILsmEo9v0g/YeWjTnE=; b=S62JJSFe2AptPM7/5g5252sUvD3MyPSRGd7Cc5A47gyskQz0F2f0m3txQMN6OXr7Ro 8ZLGMe//Ko7L5VOBrgJBZkFh+I5/3Wv4YzyjGSLXAitjZmM4UeI2hJi5ThwTDqGY2QTE KdeHLmGmE36vEMsycEANXAEvIl59w5vGCJXfKjEUcGrTWAeVFT2kfgQwpkNkNeOkCE9D yBbUwxdpIO5ensdMfiVVgz8c7VGHbrqbxapOulYP0hRcpsB/P+l7UgD8AsWN8YG/Fmpa XseGh2aOaId4lyt2QmrMskn9hazldQ2MUpeblOd2xRGOIImwkAGUOpj73BnyNMroc2Gk WGeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jWv+JMLmshTBCha3Qg9EKXdDDILsmEo9v0g/YeWjTnE=; b=n5eisU9mQTyqI8K6W9MlVqSkR6g47xeeR8YnxSEiQaKkibIsD76IyDcH7tWwzo7pgo 5oXnsqQozMszzG1bciAH7pdZwtceVPCgFEPZ13cNBL7ZAwKiAq/Vt2R3NHM0Bov8iVI2 nNq2JMPzzfZlBwoAdnpsLHBnwad0sh6h+1aZTtKkjLgWF/brv3IjEDyfaG140g+9Rf9u orHKJSVWj/EJk8wLsIvM4zflhzTmzmx+oEmi2+FhV2x1f5/eay1qA5OBAxNnB4Oc22QK wPsHa2Yp9qwmwTu5MhRQy2FeKvD5zNN/sTMhuaLGhxv2Q/FmudP1nvOYDqwLFrz/yIeK ninA== X-Gm-Message-State: AHQUAuYbJQQ5pdY3TRqDcm/heM7kWSBk40RS/JrwHUvBIfvw6vnIh7G1 lSsY27M3NTr+mGBhIXhu1QHrA08Nsro= X-Google-Smtp-Source: AHgI3IYyL3IMxNFh5MxM0cmwKDCf9MNfD2zus2xAKaRs4MCh2iR9ZnlYfARx+6g869ZIs8i8EbdFhw== X-Received: by 2002:a19:f104:: with SMTP id p4mr4617187lfh.37.1550763918418; Thu, 21 Feb 2019 07:45:18 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:16 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 04/30 v2] irqchip: Add driver for IXP4xx Date: Thu, 21 Feb 2019 16:44:32 +0100 Message-Id: <20190221154458.23763-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074521_507045_5450734F X-CRM114-Status: GOOD ( 28.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Linus Walleij , Thomas Gleixner , Jason Cooper Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The IXP4xx (arch/arm/mach-ixp4xx) is an old Intel XScale platform that has very wide deployment and use. As part of modernizing the platform, we need to implement a proper irqchip in the irqchip subsystem. The IXP4xx irqchip is tightly jotted together with the GPIO controller, and whereas in the past we would deal with this complex logic by adding necessarily different code, we can nowadays modernize it using a hierarchical irqchip. The actual IXP4 irqchip is a simple active low level IRQ controller, whereas the GPIO functionality resides in a different memory area and adds edge trigger support for the interrupts. The interrupts from GPIO lines 0..12 are 1:1 mapped to a fixed set of hardware IRQs on this IRQchip, so we expect the child GPIO interrupt controller to go in and allocate descriptors for these interrupts. For the other interrupts, as we do not yet have DT support for this platform, we create a linear irqdomain and then go in and allocate the IRQs that the legacy boards use. This code will be removed on the DT probe path when we add DT support to the platform. We add some translation code for supporting DT translations for the fwnodes, but we leave most of that for later. Cc: Marc Zyngier Cc: Jason Cooper Cc: Thomas Gleixner Signed-off-by: Linus Walleij Acked-by: Marc Zyngier --- ChangeLog v1->v2: - Deny any other type than LEVEL_HIGH irqchip maintainers: I am requesting an ACK for this once you're happy with the driver, as I intend to merge all of this IXP4xx rework through ARM SoC. --- MAINTAINERS | 2 + drivers/irqchip/Kconfig | 6 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-ixp4xx.c | 362 +++++++++++++++++++++++++++++ include/linux/irqchip/irq-ixp4xx.h | 12 + 5 files changed, 383 insertions(+) create mode 100644 drivers/irqchip/irq-ixp4xx.c create mode 100644 include/linux/irqchip/irq-ixp4xx.h diff --git a/MAINTAINERS b/MAINTAINERS index 32d444476a90..0d48faa3e635 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1651,6 +1651,8 @@ M: Krzysztof Halasa L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained F: arch/arm/mach-ixp4xx/ +F: drivers/irqchip/irq-ixp4xx.c +F: include/linux/irqchip/irq-ixp4xx.h ARM/INTEL RESEARCH IMOTE/STARGATE 2 MACHINE SUPPORT M: Jonathan Cameron diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 3d1e60779078..c7e09913826b 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -150,6 +150,12 @@ config IMGPDC_IRQ select GENERIC_IRQ_CHIP select IRQ_DOMAIN +config IXP4XX_IRQ + bool + select IRQ_DOMAIN + select GENERIC_IRQ_MULTI_HANDLER + select SPARSE_IRQ + config MADERA_IRQ tristate diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index c93713d24b86..06139d612108 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_ATMEL_AIC5_IRQ) += irq-atmel-aic-common.o irq-atmel-aic5.o obj-$(CONFIG_I8259) += irq-i8259.o obj-$(CONFIG_IMGPDC_IRQ) += irq-imgpdc.o obj-$(CONFIG_IRQ_MIPS_CPU) += irq-mips-cpu.o +obj-$(CONFIG_IXP4XX_IRQ) += irq-ixp4xx.o obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o obj-$(CONFIG_JCORE_AIC) += irq-jcore-aic.o obj-$(CONFIG_RDA_INTC) += irq-rda-intc.o diff --git a/drivers/irqchip/irq-ixp4xx.c b/drivers/irqchip/irq-ixp4xx.c new file mode 100644 index 000000000000..89c80ce047a7 --- /dev/null +++ b/drivers/irqchip/irq-ixp4xx.c @@ -0,0 +1,362 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * irqchip for the IXP4xx interrupt controller + * Copyright (C) 2019 Linus Walleij + * + * Based on arch/arm/mach-ixp4xx/common.c + * Copyright 2002 (C) Intel Corporation + * Copyright 2003-2004 (C) MontaVista, Software, Inc. + * Copyright (C) Deepak Saxena + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define IXP4XX_ICPR 0x00 /* Interrupt Status */ +#define IXP4XX_ICMR 0x04 /* Interrupt Enable */ +#define IXP4XX_ICLR 0x08 /* Interrupt IRQ/FIQ Select */ +#define IXP4XX_ICIP 0x0C /* IRQ Status */ +#define IXP4XX_ICFP 0x10 /* FIQ Status */ +#define IXP4XX_ICHR 0x14 /* Interrupt Priority */ +#define IXP4XX_ICIH 0x18 /* IRQ Highest Pri Int */ +#define IXP4XX_ICFH 0x1C /* FIQ Highest Pri Int */ + +/* IXP43x and IXP46x-only */ +#define IXP4XX_ICPR2 0x20 /* Interrupt Status 2 */ +#define IXP4XX_ICMR2 0x24 /* Interrupt Enable 2 */ +#define IXP4XX_ICLR2 0x28 /* Interrupt IRQ/FIQ Select 2 */ +#define IXP4XX_ICIP2 0x2C /* IRQ Status */ +#define IXP4XX_ICFP2 0x30 /* FIQ Status */ +#define IXP4XX_ICEEN 0x34 /* Error High Pri Enable */ + +/** + * struct ixp4xx_irq - state container for the Faraday IRQ controller + * @irqbase: IRQ controller memory base in virtual memory + * @is_356: if this is an IXP43x, IXP45x or IX46x SoC (with 64 IRQs) + * @irqchip: irqchip for this instance + * @domain: IRQ domain for this instance + */ +struct ixp4xx_irq { + void __iomem *irqbase; + bool is_356; + struct irq_chip irqchip; + struct irq_domain *domain; +}; + +/* Local static state container */ +static struct ixp4xx_irq ixirq; + +/* GPIO Clocks */ +#define IXP4XX_GPIO_CLK_0 14 +#define IXP4XX_GPIO_CLK_1 15 + +static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type) +{ + /* All are level active high (asserted) here */ + if (type != IRQ_TYPE_LEVEL_HIGH) + return -EINVAL; + return 0; +} + +static void ixp4xx_irq_mask(struct irq_data *d) +{ + struct ixp4xx_irq *ixi = irq_data_get_irq_chip_data(d); + u32 val; + + if (ixi->is_356 && d->hwirq >= 32) { + val = __raw_readl(ixi->irqbase + IXP4XX_ICMR2); + val &= ~BIT(d->hwirq - 32); + __raw_writel(val, ixi->irqbase + IXP4XX_ICMR2); + } else { + val = __raw_readl(ixi->irqbase + IXP4XX_ICMR); + val &= ~BIT(d->hwirq); + __raw_writel(val, ixi->irqbase + IXP4XX_ICMR); + } +} + +/* + * Level triggered interrupts on GPIO lines can only be cleared when the + * interrupt condition disappears. + */ +static void ixp4xx_irq_unmask(struct irq_data *d) +{ + struct ixp4xx_irq *ixi = irq_data_get_irq_chip_data(d); + u32 val; + + if (ixi->is_356 && d->hwirq >= 32) { + val = __raw_readl(ixi->irqbase + IXP4XX_ICMR2); + val |= BIT(d->hwirq - 32); + __raw_writel(val, ixi->irqbase + IXP4XX_ICMR2); + } else { + val = __raw_readl(ixi->irqbase + IXP4XX_ICMR); + val |= BIT(d->hwirq); + __raw_writel(val, ixi->irqbase + IXP4XX_ICMR); + } +} + +asmlinkage void __exception_irq_entry ixp4xx_handle_irq(struct pt_regs *regs) +{ + struct ixp4xx_irq *ixi = &ixirq; + unsigned long status; + int i; + + status = __raw_readl(ixi->irqbase + IXP4XX_ICIP); + for_each_set_bit(i, &status, 32) + handle_domain_irq(ixi->domain, i, regs); + + /* + * IXP465/IXP435 has an upper IRQ status register + */ + if (ixi->is_356) { + status = __raw_readl(ixi->irqbase + IXP4XX_ICIP2); + for_each_set_bit(i, &status, 32) + handle_domain_irq(ixi->domain, i + 32, regs); + } +} + +static int ixp4xx_irq_domain_translate(struct irq_domain *domain, + struct irq_fwspec *fwspec, + unsigned long *hwirq, + unsigned int *type) +{ + /* We support standard DT translation */ + if (is_of_node(fwspec->fwnode) && fwspec->param_count == 2) { + *hwirq = fwspec->param[0]; + *type = fwspec->param[1]; + return 0; + } + + if (is_fwnode_irqchip(fwspec->fwnode)) { + if (fwspec->param_count != 2) + return -EINVAL; + *hwirq = fwspec->param[0]; + *type = fwspec->param[1]; + WARN_ON(*type == IRQ_TYPE_NONE); + return 0; + } + + return -EINVAL; +} + +static int ixp4xx_irq_domain_alloc(struct irq_domain *d, + unsigned int irq, unsigned int nr_irqs, + void *data) +{ + struct ixp4xx_irq *ixi = d->host_data; + irq_hw_number_t hwirq; + unsigned int type = IRQ_TYPE_NONE; + struct irq_fwspec *fwspec = data; + int ret; + int i; + + ret = ixp4xx_irq_domain_translate(d, fwspec, &hwirq, &type); + if (ret) + return ret; + + for (i = 0; i < nr_irqs; i++) { + /* + * TODO: after converting IXP4xx to only device tree, set + * handle_bad_irq as default handler and assume all consumers + * call .set_type() as this is provided in the second cell in + * the device tree phandle. + */ + irq_domain_set_info(d, + irq + i, + hwirq + i, + &ixi->irqchip, + ixi, + handle_level_irq, + NULL, NULL); + irq_set_probe(irq + i); + } + + return 0; +} + +/* + * This needs to be a hierarchical irqdomain to work well with the + * GPIO irqchip (which is lower in the hierarchy) + */ +static const struct irq_domain_ops ixp4xx_irqdomain_ops = { + .translate = ixp4xx_irq_domain_translate, + .alloc = ixp4xx_irq_domain_alloc, + .free = irq_domain_free_irqs_common, +}; + +/** + * ixp4xx_get_irq_domain() - retrieve the ixp4xx irq domain + * + * This function will go away when we transition to DT probing. + */ +struct irq_domain *ixp4xx_get_irq_domain(void) +{ + struct ixp4xx_irq *ixi = &ixirq; + + return ixi->domain; +} +EXPORT_SYMBOL_GPL(ixp4xx_get_irq_domain); + +/* + * This is the Linux IRQ to hwirq mapping table. This goes away when + * we have DT support as all IRQ resources are defined in the device + * tree. It will register all the IRQs that are not used by the hierarchical + * GPIO IRQ chip. The "holes" inbetween these IRQs will be requested by + * the GPIO driver using . This is a step-gap solution. + */ +struct ixp4xx_irq_chunk { + int irq; + int hwirq; + int nr_irqs; +}; + +static const struct ixp4xx_irq_chunk ixp4xx_irq_chunks[] = { + { + .irq = 16, + .hwirq = 0, + .nr_irqs = 6, + }, + { + .irq = 24, + .hwirq = 8, + .nr_irqs = 11, + }, + { + .irq = 46, + .hwirq = 30, + .nr_irqs = 2, + }, + /* Only on the 436 variants */ + { + .irq = 48, + .hwirq = 32, + .nr_irqs = 10, + }, +}; + +/** + * ixp4x_irq_setup() - Common setup code for the IXP4xx interrupt controller + * @ixi: State container + * @irqbase: Virtual memory base for the interrupt controller + * @fwnode: Corresponding fwnode abstraction for this controller + * @is_356: if this is an IXP43x, IXP45x or IXP46x SoC variant + */ +static int ixp4xx_irq_setup(struct ixp4xx_irq *ixi, + void __iomem *irqbase, + struct fwnode_handle *fwnode, + bool is_356) +{ + int nr_irqs; + + ixi->irqbase = irqbase; + ixi->is_356 = is_356; + + /* Route all sources to IRQ instead of FIQ */ + __raw_writel(0x0, ixi->irqbase + IXP4XX_ICLR); + + /* Disable all interrupts */ + __raw_writel(0x0, ixi->irqbase + IXP4XX_ICMR); + + if (is_356) { + /* Route upper 32 sources to IRQ instead of FIQ */ + __raw_writel(0x0, ixi->irqbase + IXP4XX_ICLR2); + + /* Disable upper 32 interrupts */ + __raw_writel(0x0, ixi->irqbase + IXP4XX_ICMR2); + + nr_irqs = 64; + } else { + nr_irqs = 32; + } + + ixi->irqchip.name = "IXP4xx"; + ixi->irqchip.irq_mask = ixp4xx_irq_mask; + ixi->irqchip.irq_unmask = ixp4xx_irq_unmask; + ixi->irqchip.irq_set_type = ixp4xx_set_irq_type; + + ixi->domain = irq_domain_create_linear(fwnode, nr_irqs, + &ixp4xx_irqdomain_ops, + ixi); + if (!ixi->domain) { + pr_crit("IXP4XX: can not add primary irqdomain\n"); + return -ENODEV; + } + + set_handle_irq(ixp4xx_handle_irq); + + return 0; +} + +/** + * ixp4xx_irq_init() - Function to initialize the irqchip from boardfiles + * @irqbase: physical base for the irq controller + * @is_356: if this is an IXP43x, IXP45x or IXP46x SoC variant + */ +void __init ixp4xx_irq_init(resource_size_t irqbase, + bool is_356) +{ + struct ixp4xx_irq *ixi = &ixirq; + void __iomem *base; + struct fwnode_handle *fwnode; + struct irq_fwspec fwspec; + int nr_chunks; + int ret; + int i; + + base = ioremap(irqbase, 0x100); + if (!base) { + pr_crit("IXP4XX: could not ioremap interrupt controller\n"); + return; + } + fwnode = irq_domain_alloc_fwnode(base); + if (!fwnode) { + pr_crit("IXP4XX: no domain handle\n"); + return; + } + ret = ixp4xx_irq_setup(ixi, base, fwnode, is_356); + if (ret) { + pr_crit("IXP4XX: failed to set up irqchip\n"); + irq_domain_free_fwnode(fwnode); + } + + nr_chunks = ARRAY_SIZE(ixp4xx_irq_chunks); + if (!is_356) + nr_chunks--; + + /* + * After adding OF support, this is no longer needed: irqs + * will be allocated for the respective fwnodes. + */ + for (i = 0; i < nr_chunks; i++) { + const struct ixp4xx_irq_chunk *chunk = &ixp4xx_irq_chunks[i]; + + pr_info("Allocate Linux IRQs %d..%d HW IRQs %d..%d\n", + chunk->irq, chunk->irq + chunk->nr_irqs - 1, + chunk->hwirq, chunk->hwirq + chunk->nr_irqs - 1); + fwspec.fwnode = fwnode; + fwspec.param[0] = chunk->hwirq; + fwspec.param[1] = IRQ_TYPE_LEVEL_HIGH; + fwspec.param_count = 2; + ret = __irq_domain_alloc_irqs(ixi->domain, + chunk->irq, + chunk->nr_irqs, + NUMA_NO_NODE, + &fwspec, + false, + NULL); + if (ret < 0) { + pr_crit("IXP4XX: can not allocate irqs in hierarchy %d\n", + ret); + return; + } + } +} +EXPORT_SYMBOL_GPL(ixp4xx_irq_init); diff --git a/include/linux/irqchip/irq-ixp4xx.h b/include/linux/irqchip/irq-ixp4xx.h new file mode 100644 index 000000000000..9395917d6936 --- /dev/null +++ b/include/linux/irqchip/irq-ixp4xx.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __IRQ_IXP4XX_H +#define __IRQ_IXP4XX_H + +#include +struct irq_domain; + +void ixp4xx_irq_init(resource_size_t irqbase, + bool is_356); +struct irq_domain *ixp4xx_get_irq_domain(void); + +#endif /* __IRQ_IXP4XX_H */ From patchwork Thu Feb 21 15:44:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824231 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CD276C2 for ; Thu, 21 Feb 2019 15:46:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBA37313C9 for ; Thu, 21 Feb 2019 15:46:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF076314DB; Thu, 21 Feb 2019 15:46:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CC69D313C9 for ; Thu, 21 Feb 2019 15:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3pALDxl3HENLISeftgkdK7Hj3oILeD4SkoS0/J/nq7Y=; b=YnHJUeLwj5TM+9 YnVbU51LF8B0ZMxBAWVnzAVsb4CcuE2DfhX4qsmWxPqD/AWlboxtmyHR0lG7tDJsP/6uXuh1yb3Ib HZvyonz0MT34JiQFGjc9MdPC4PKXZVTh268rXpuZXid/h950ylI6oJY3bvAFN6S00E1W4GQe7IRTC sqS+5CANw04H9Vtka4zSjZ3aRnyxmf6oL77SDsr5CunkFBtMIXYenS2e9UPkVsVgSHptXIjXVJKhA Ju+CGOUySOS7cdP9NGGNjH4G6WlMHGQblUqkUDl2HJ200huV1IIMKd+YtDPeH4ju4DhRmwT1ks8dr M6iVjylqF1LGC2p2XPUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqYB-00062v-8g; Thu, 21 Feb 2019 15:46:15 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXL-0004wL-LJ for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:28 +0000 Received: by mail-lf1-x142.google.com with SMTP id q12so20737155lfm.0 for ; Thu, 21 Feb 2019 07:45:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ydtr9kS0jBdprA0griqlZhz/r8SHgp5tMSx95q9fwc8=; b=cntTMUXetJ4dZVI4MED/bINKmsdMB77bNMmsivrRYXxvjjU9hi7d2UMVMi3Z/Q07UH fFIgSk1JC49KWn+1rsEiTLb245fSPVCHDXQJjwq0afbLZt6NaflqBPE+3u0DiDqY79sU NbSFWjlHpPIdsKLU7dOniM++MMp5qgQsWbJ/Bw6aVeGPUHyP+zJ2dLVTlduXjVbvhXcm uVJO/f+xbTuUxkgI/yQKBjalqwyst/7weEoYoh6UHSxsRZsTao1JyI6aH6PsXX8Twfa1 cQRSu9RhpI4A+T0LJNaK4IUs9vmSDAdIpu0I9ZRS/CteSKq4QIxe8ay9zAOBiLRgVJFx TFxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ydtr9kS0jBdprA0griqlZhz/r8SHgp5tMSx95q9fwc8=; b=tLlSrcTQrnsDH093dOPAodCXLJo9ag/4UFBnoovkOu8AjtUFevlxBF20fKdD8oik6f NLWZxeIjd6GdNXUq3/89rwMjDLX/HftXNHfjSwx0neFIKrUMscaWdRFldxSwiNH72vtl tzEfESAuKjnPGksIwFy12RsUEVYIEYhZc5NucIF5ju/exht3Cztz9lQtsopKCiveXlqM 2IXuSh0e3OFMsx+7cD8uEoJf6d4LrrFW8upkXhxrtDCrzmYd05AkmNObsDwqqSmj1Kl0 PFXWsfLanYqu45kstlbJYANki3s/SrnaizSZG+lXYJEqdJJb5KMQqgbxYkX98Izk38/2 z8bQ== X-Gm-Message-State: AHQUAubzJzuRZDpsTKKTLy7o/DtSbiJWdt2uA5V/hO9SxXlZk1SfKGHo 86f2BRQz4OSMXXoOxwAwaZkF8MV91rM= X-Google-Smtp-Source: AHgI3IbD4VoulOessIXVshFSBiSsosQrbFcAZCvIt/3OYJr2d4sk/OrWiaTBOssJkWNbGp8c3hcc7g== X-Received: by 2002:a19:d83:: with SMTP id 125mr23426782lfn.159.1550763921118; Thu, 21 Feb 2019 07:45:21 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:20 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 05/30 v2] gpio: ixp4xx: Add driver for the IXP4xx GPIO Date: Thu, 21 Feb 2019 16:44:33 +0100 Message-Id: <20190221154458.23763-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074524_446333_0A449877 X-CRM114-Status: GOOD ( 29.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a driver for the IXP4xx GPIO block found in the Intel XScale IXP4xx systems. The GPIO part of this block is pretty straight-forward and just uses the generic MMIO GPIO library. The irqchip side of this driver is hierarchical where the main irqchip will receive a processed level trigger in response to the edge detector of the GPIO block, so for this reason the v2 version of the irqdomain API is used (as well as in the parent IXP4xx irqchip) and masking, unmasking and setting up the type on IRQ happens on several levels. Currently this GPIO controller will grab the parent irqdomain using a special function, but as the platform move toward device tree probing, this will not be needed: we can just look up the parent irqdomain from the device tree. Cc: Bartosz Golaszewski Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Fix comment style in header - Fix register naming to be more intuitive --- MAINTAINERS | 1 + drivers/gpio/Kconfig | 12 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-ixp4xx.c | 444 +++++++++++++++++++++++++++++++++++++ 4 files changed, 458 insertions(+) create mode 100644 drivers/gpio/gpio-ixp4xx.c diff --git a/MAINTAINERS b/MAINTAINERS index 0d48faa3e635..6c161bd82238 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1651,6 +1651,7 @@ M: Krzysztof Halasa L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained F: arch/arm/mach-ixp4xx/ +F: drivers/gpio/gpio-ixp4xx.c F: drivers/irqchip/irq-ixp4xx.c F: include/linux/irqchip/irq-ixp4xx.h diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 699a8118c433..fe4a47e49a24 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -286,6 +286,18 @@ config GPIO_IOP If unsure, say N. +config GPIO_IXP4XX + bool "Intel IXP4xx GPIO" + depends on ARCH_IXP4XX || COMPILE_TEST + select GPIO_GENERIC + select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY + help + Say yes here to support the GPIO functionality of a number of Intel + IXP4xx series of chips. + + If unsure, say N. + config GPIO_LOONGSON bool "Loongson-2/3 GPIO support" depends on CPU_LOONGSON2 || CPU_LOONGSON3 diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 0568bbe6fe68..cf66523b5eec 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -60,6 +60,7 @@ obj-$(CONFIG_GPIO_HLWD) += gpio-hlwd.o obj-$(CONFIG_HTC_EGPIO) += gpio-htc-egpio.o obj-$(CONFIG_GPIO_ICH) += gpio-ich.o obj-$(CONFIG_GPIO_IOP) += gpio-iop.o +obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o obj-$(CONFIG_GPIO_IT87) += gpio-it87.o obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c new file mode 100644 index 000000000000..eaf317f73f75 --- /dev/null +++ b/drivers/gpio/gpio-ixp4xx.c @@ -0,0 +1,444 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// IXP4 GPIO driver +// Copyright (C) 2019 Linus Walleij +// +// based on previous work and know-how from: +// Deepak Saxena + +#include +#include +#include +#include +#include +#include +#include +/* Include that go away with DT transition */ +#include + +#include + +#define IXP4XX_REG_GPOUT 0x00 +#define IXP4XX_REG_GPOE 0x04 +#define IXP4XX_REG_GPIN 0x08 +#define IXP4XX_REG_GPIS 0x0C +#define IXP4XX_REG_GPIT1 0x10 +#define IXP4XX_REG_GPIT2 0x14 +#define IXP4XX_REG_GPCLK 0x18 +#define IXP4XX_REG_GPDBSEL 0x1C + +/* + * The hardware uses 3 bits to indicate interrupt "style". + * we clear and set these three bits accordingly. The lower 24 + * bits in two registers (GPIT1 and GPIT2) are used to set up + * the style for 8 lines each for a total of 16 GPIO lines. + */ +#define IXP4XX_GPIO_STYLE_ACTIVE_HIGH 0x0 +#define IXP4XX_GPIO_STYLE_ACTIVE_LOW 0x1 +#define IXP4XX_GPIO_STYLE_RISING_EDGE 0x2 +#define IXP4XX_GPIO_STYLE_FALLING_EDGE 0x3 +#define IXP4XX_GPIO_STYLE_TRANSITIONAL 0x4 +#define IXP4XX_GPIO_STYLE_MASK GENMASK(2, 0) +#define IXP4XX_GPIO_STYLE_SIZE 3 + +/** + * struct ixp4xx_gpio - IXP4 GPIO state container + * @dev: containing device for this instance + * @fwnode: the fwnode for this GPIO chip + * @gc: gpiochip for this instance + * @domain: irqdomain for this chip instance + * @base: remapped I/O-memory base + * @irq_edge: Each bit represents an IRQ: 1: edge-triggered, + * 0: level triggered + */ +struct ixp4xx_gpio { + struct device *dev; + struct fwnode_handle *fwnode; + struct gpio_chip gc; + struct irq_domain *domain; + void __iomem *base; + unsigned long long irq_edge; +}; + +/** + * struct ixp4xx_gpio_map - IXP4 GPIO to parent IRQ map + * @gpio_offset: offset of the IXP4 GPIO line + * @parent_hwirq: hwirq on the parent IRQ controller + */ +struct ixp4xx_gpio_map { + int gpio_offset; + int parent_hwirq; +}; + +/* GPIO lines 0..12 have corresponding IRQs, GPIOs 13..15 have no IRQs */ +const struct ixp4xx_gpio_map ixp4xx_gpiomap[] = { + { .gpio_offset = 0, .parent_hwirq = 6 }, + { .gpio_offset = 1, .parent_hwirq = 7 }, + { .gpio_offset = 2, .parent_hwirq = 19 }, + { .gpio_offset = 3, .parent_hwirq = 20 }, + { .gpio_offset = 4, .parent_hwirq = 21 }, + { .gpio_offset = 5, .parent_hwirq = 22 }, + { .gpio_offset = 6, .parent_hwirq = 23 }, + { .gpio_offset = 7, .parent_hwirq = 24 }, + { .gpio_offset = 8, .parent_hwirq = 25 }, + { .gpio_offset = 9, .parent_hwirq = 26 }, + { .gpio_offset = 10, .parent_hwirq = 27 }, + { .gpio_offset = 11, .parent_hwirq = 28 }, + { .gpio_offset = 12, .parent_hwirq = 29 }, +}; + +static void ixp4xx_gpio_irq_ack(struct irq_data *d) +{ + struct ixp4xx_gpio *g = irq_data_get_irq_chip_data(d); + + __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS); +} + +static void ixp4xx_gpio_irq_unmask(struct irq_data *d) +{ + struct ixp4xx_gpio *g = irq_data_get_irq_chip_data(d); + + /* ACK when unmasking if not edge-triggered */ + if (!(g->irq_edge & BIT(d->hwirq))) + ixp4xx_gpio_irq_ack(d); + + irq_chip_unmask_parent(d); +} + +static int ixp4xx_gpio_irq_set_type(struct irq_data *d, unsigned int type) +{ + struct ixp4xx_gpio *g = irq_data_get_irq_chip_data(d); + int line = d->hwirq; + unsigned long flags; + u32 int_style; + u32 int_reg; + u32 val; + + switch (type) { + case IRQ_TYPE_EDGE_BOTH: + irq_set_handler_locked(d, handle_edge_irq); + int_style = IXP4XX_GPIO_STYLE_TRANSITIONAL; + g->irq_edge |= BIT(d->hwirq); + break; + case IRQ_TYPE_EDGE_RISING: + irq_set_handler_locked(d, handle_edge_irq); + int_style = IXP4XX_GPIO_STYLE_RISING_EDGE; + g->irq_edge |= BIT(d->hwirq); + break; + case IRQ_TYPE_EDGE_FALLING: + irq_set_handler_locked(d, handle_edge_irq); + int_style = IXP4XX_GPIO_STYLE_FALLING_EDGE; + g->irq_edge |= BIT(d->hwirq); + break; + case IRQ_TYPE_LEVEL_HIGH: + irq_set_handler_locked(d, handle_level_irq); + int_style = IXP4XX_GPIO_STYLE_ACTIVE_HIGH; + g->irq_edge &= ~BIT(d->hwirq); + break; + case IRQ_TYPE_LEVEL_LOW: + irq_set_handler_locked(d, handle_level_irq); + int_style = IXP4XX_GPIO_STYLE_ACTIVE_LOW; + g->irq_edge &= ~BIT(d->hwirq); + break; + default: + return -EINVAL; + } + + if (line >= 8) { + /* pins 8-15 */ + line -= 8; + int_reg = IXP4XX_REG_GPIT2; + } else { + /* pins 0-7 */ + int_reg = IXP4XX_REG_GPIT1; + } + + spin_lock_irqsave(&g->gc.bgpio_lock, flags); + + /* Clear the style for the appropriate pin */ + val = __raw_readl(g->base + int_reg); + val &= ~(IXP4XX_GPIO_STYLE_MASK << (line * IXP4XX_GPIO_STYLE_SIZE)); + __raw_writel(val, g->base + int_reg); + + __raw_writel(BIT(line), g->base + IXP4XX_REG_GPIS); + + /* Set the new style */ + val = __raw_readl(g->base + int_reg); + val |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE)); + __raw_writel(val, g->base + int_reg); + + /* Force-configure this line as an input */ + val = __raw_readl(g->base + IXP4XX_REG_GPOE); + val |= BIT(d->hwirq); + __raw_writel(val, g->base + IXP4XX_REG_GPOE); + + spin_unlock_irqrestore(&g->gc.bgpio_lock, flags); + + /* This parent only accept level high (asserted) */ + return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); +} + +static struct irq_chip ixp4xx_gpio_irqchip = { + .name = "IXP4GPIO", + .irq_ack = ixp4xx_gpio_irq_ack, + .irq_mask = irq_chip_mask_parent, + .irq_unmask = ixp4xx_gpio_irq_unmask, + .irq_set_type = ixp4xx_gpio_irq_set_type, +}; + +static int ixp4xx_gpio_to_irq(struct gpio_chip *gc, unsigned int offset) +{ + struct ixp4xx_gpio *g = gpiochip_get_data(gc); + struct irq_fwspec fwspec; + + fwspec.fwnode = g->fwnode; + fwspec.param_count = 2; + fwspec.param[0] = offset; + fwspec.param[1] = IRQ_TYPE_NONE; + + return irq_create_fwspec_mapping(&fwspec); +} + +static int ixp4xx_gpio_irq_domain_translate(struct irq_domain *domain, + struct irq_fwspec *fwspec, + unsigned long *hwirq, + unsigned int *type) +{ + + /* We support standard DT translation */ + if (is_of_node(fwspec->fwnode) && fwspec->param_count == 2) { + *hwirq = fwspec->param[0]; + *type = fwspec->param[1]; + return 0; + } + + /* This goes away when we transition to DT */ + if (is_fwnode_irqchip(fwspec->fwnode)) { + if (fwspec->param_count != 2) + return -EINVAL; + *hwirq = fwspec->param[0]; + *type = fwspec->param[1]; + WARN_ON(*type == IRQ_TYPE_NONE); + return 0; + } + return -EINVAL; +} + +static int ixp4xx_gpio_irq_domain_alloc(struct irq_domain *d, + unsigned int irq, unsigned int nr_irqs, + void *data) +{ + struct ixp4xx_gpio *g = d->host_data; + irq_hw_number_t hwirq; + unsigned int type = IRQ_TYPE_NONE; + struct irq_fwspec *fwspec = data; + int ret; + int i; + + ret = ixp4xx_gpio_irq_domain_translate(d, fwspec, &hwirq, &type); + if (ret) + return ret; + + dev_dbg(g->dev, "allocate IRQ %d..%d, hwirq %lu..%lu\n", + irq, irq + nr_irqs - 1, + hwirq, hwirq + nr_irqs - 1); + + for (i = 0; i < nr_irqs; i++) { + struct irq_fwspec parent_fwspec; + const struct ixp4xx_gpio_map *map; + int j; + + /* Not all lines support IRQs */ + for (j = 0; j < ARRAY_SIZE(ixp4xx_gpiomap); j++) { + map = &ixp4xx_gpiomap[j]; + if (map->gpio_offset == hwirq) + break; + } + if (j == ARRAY_SIZE(ixp4xx_gpiomap)) { + dev_err(g->dev, "can't look up hwirq %lu\n", hwirq); + return -EINVAL; + } + dev_dbg(g->dev, "found parent hwirq %u\n", map->parent_hwirq); + + /* + * We set handle_bad_irq because the .set_type() should + * always be invoked and set the right type of handler. + */ + irq_domain_set_info(d, + irq + i, + hwirq + i, + &ixp4xx_gpio_irqchip, + g, + handle_bad_irq, + NULL, NULL); + irq_set_probe(irq + i); + + /* + * Create a IRQ fwspec to send up to the parent irqdomain: + * specify the hwirq we address on the parent and tie it + * all together up the chain. + */ + parent_fwspec.fwnode = d->parent->fwnode; + parent_fwspec.param_count = 2; + parent_fwspec.param[0] = map->parent_hwirq; + /* This parent only handles asserted level IRQs */ + parent_fwspec.param[1] = IRQ_TYPE_LEVEL_HIGH; + dev_dbg(g->dev, "alloc_irqs_parent for %d parent hwirq %d\n", + irq + i, map->parent_hwirq); + ret = irq_domain_alloc_irqs_parent(d, irq + i, 1, + &parent_fwspec); + if (ret) + dev_err(g->dev, + "failed to allocate parent hwirq %d for hwirq %lu\n", + map->parent_hwirq, hwirq); + } + + return 0; +} + +static const struct irq_domain_ops ixp4xx_gpio_irqdomain_ops = { + .translate = ixp4xx_gpio_irq_domain_translate, + .alloc = ixp4xx_gpio_irq_domain_alloc, + .free = irq_domain_free_irqs_common, +}; + +static int ixp4xx_gpio_probe(struct platform_device *pdev) +{ + unsigned long flags; + struct device *dev = &pdev->dev; + struct irq_domain *parent; + struct resource *res; + struct ixp4xx_gpio *g; + int ret; + int i; + + g = devm_kzalloc(dev, sizeof(*g), GFP_KERNEL); + if (!g) + return -ENOMEM; + g->dev = dev; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + g->base = devm_ioremap_resource(dev, res); + if (IS_ERR(g->base)) { + dev_err(dev, "ioremap error\n"); + return PTR_ERR(g->base); + } + + /* + * Make sure GPIO 14 and 15 are NOT used as clocks but GPIO on + * specific machines. + */ + if (machine_is_dsmg600() || machine_is_nas100d()) + __raw_writel(0x0, g->base + IXP4XX_REG_GPCLK); + + /* + * This is a very special big-endian ARM issue: when the IXP4xx is + * run in big endian mode, all registers in the machine are switched + * around to the CPU-native endianness. As you see mostly in the + * driver we use __raw_readl()/__raw_writel() to access the registers + * in the appropriate order. With the GPIO library we need to specify + * byte order explicitly, so this flag needs to be set when compiling + * for big endian. + */ +#if defined(CONFIG_CPU_BIG_ENDIAN) + flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER; +#else + flags = 0; +#endif + + /* Populate and register gpio chip */ + ret = bgpio_init(&g->gc, dev, 4, + g->base + IXP4XX_REG_GPIN, + g->base + IXP4XX_REG_GPOUT, + NULL, + NULL, + g->base + IXP4XX_REG_GPOE, + flags); + if (ret) { + dev_err(dev, "unable to init generic GPIO\n"); + return ret; + } + g->gc.to_irq = ixp4xx_gpio_to_irq; + g->gc.ngpio = 16; + g->gc.label = "IXP4XX_GPIO_CHIP"; + /* + * TODO: when we have migrated to device tree and all GPIOs + * are fetched using phandles, set this to -1 to get rid of + * the fixed gpiochip base. + */ + g->gc.base = 0; + g->gc.parent = &pdev->dev; + g->gc.owner = THIS_MODULE; + + ret = devm_gpiochip_add_data(dev, &g->gc, g); + if (ret) { + dev_err(dev, "failed to add SoC gpiochip\n"); + return ret; + } + + /* + * When we convert to device tree we will simply look up the + * parent irqdomain using irq_find_host(parent) as parent comes + * from IRQCHIP_DECLARE(), then use of_node_to_fwnode() to get + * the fwnode. For now we need this boardfile style code. + */ + parent = ixp4xx_get_irq_domain(); + g->fwnode = irq_domain_alloc_fwnode(g->base); + if (!g->fwnode) { + dev_err(dev, "no domain base\n"); + return -ENODEV; + } + g->domain = irq_domain_create_hierarchy(parent, + IRQ_DOMAIN_FLAG_HIERARCHY, + ARRAY_SIZE(ixp4xx_gpiomap), + g->fwnode, + &ixp4xx_gpio_irqdomain_ops, + g); + if (!g->domain) { + irq_domain_free_fwnode(g->fwnode); + dev_err(dev, "no hierarchical irq domain\n"); + return ret; + } + + /* + * After adding OF support, this is no longer needed: irqs + * will be allocated for the respective fwnodes. + */ + for (i = 0; i < ARRAY_SIZE(ixp4xx_gpiomap); i++) { + const struct ixp4xx_gpio_map *map = &ixp4xx_gpiomap[i]; + struct irq_fwspec fwspec; + + fwspec.fwnode = g->fwnode; + /* This is the hwirq for the GPIO line side of things */ + fwspec.param[0] = map->gpio_offset; + fwspec.param[1] = IRQ_TYPE_EDGE_RISING; + fwspec.param_count = 2; + ret = __irq_domain_alloc_irqs(g->domain, + -1, /* just pick something */ + 1, + NUMA_NO_NODE, + &fwspec, + false, + NULL); + if (ret < 0) { + irq_domain_free_fwnode(g->fwnode); + dev_err(dev, + "can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n", + map->gpio_offset, map->parent_hwirq, ret); + return ret; + } + } + + platform_set_drvdata(pdev, g); + dev_info(dev, "IXP4 GPIO @%p registered\n", g->base); + + return 0; +} + +static struct platform_driver ixp4xx_gpio_driver = { + .driver = { + .name = "ixp4xx-gpio", + }, + .probe = ixp4xx_gpio_probe, +}; +builtin_platform_driver(ixp4xx_gpio_driver); From patchwork Thu Feb 21 15:44:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824235 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C6216C2 for ; Thu, 21 Feb 2019 15:47:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62EF3314D4 for ; Thu, 21 Feb 2019 15:47:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53105314DD; Thu, 21 Feb 2019 15:47:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 44009314D4 for ; Thu, 21 Feb 2019 15:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WowUJrmgf7wJ7b2f4eH8eJY69izIihS+ejlYvUIDVOg=; b=XMbMSfpfArrcoN gM68Qd2xGlcNI05NYLlvJrzjsfhL6KXr61wXpbI22plDLMoh9fw4aPePHKZtJKEoJMYHUKivdAr2A O6tnvjRKYtwP3AIPtsFaK3oULoWY4yWjx5gzobLzOgPEz8tGqsVP1hij/KGQ7P4tntKQ6fBchipoe kgKtlB6pMSuPSCAW6vmORMHQuUhfEtVtEHyK2rfw37kSihsRp29bL/8bUX/rOlE/4eY9I76MNVXzv dWcfbqGY2goMB89bxJsfM+Pim5gvNoOvIRzyPZpCN56s1xyE/6mBGB0rbYe32F6Jb/K+BCb8Q3ZDn +Sm6NT7KEeEpnOkaRmZw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqYq-0006S9-QV; Thu, 21 Feb 2019 15:46:56 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXO-0004yw-4Z for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:30 +0000 Received: by mail-lf1-x144.google.com with SMTP id u21so20750233lfu.1 for ; Thu, 21 Feb 2019 07:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U1cxO7VVwqmxQbAIOAoy5XNG/YE4OZ3otvMxFXrUJPE=; b=klZIZBQ9AtQkWuhuoITtBTqWgBbRG848BhhnzJRiw8KwhcN/003cwmYFxVT5Li6Jcw xEhh4T3yl9dUo5G/CiO/ps3KxY8W6zPZeg9LdQ9zKs2k5dVPdEbVG14BG0IInfxW1Rzm eUb6M/K8L6x6klc1VD+3iyyq+wF1uV7lsrhhm2E7+qlhS6kaspss5l1/JVAHgwVfYf+1 /LdnI2SaODzaPrBy6pkHPRwAUOrMAhWf5OurmD1ANpD9ZrVRxeOOEVIE6MNtCPOs/AEP aHs75PMij+hosSKOBKnWIkeRUpFvphtkDXn4t9kOiWUZegPYbQXMFrnwtvW0sHOcbuKa 767Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U1cxO7VVwqmxQbAIOAoy5XNG/YE4OZ3otvMxFXrUJPE=; b=TOrVIKltNYsvPtMdl/R+e36pzv408CtBd3E4x5zVUOg8eB0AuGGvfIJ1UuEMjXMJlJ h4w/Z8HsLxSNxd0h04Fxlx9lh0s1lB6gcpvKAD9/fjfiQqkwp9zoVw6vBkXcCFkYnHrl tepGJrMkawdSl3sfvkuMQiXlnETpcsrEN32i+jZOje+7N/MSroEJUikGHSWwwFgFKzH3 ic8NbJM9lGVQQBpLCcIvM6QGk15L7mQptRUbpxrMcSpoe2lt2sjVgEPHIjRLZZAXUB0u iXrDwEwJS7kgOTRY/jaJp4TYS5EfDnr9jxjpW0Ttgoo8n1wyNQyvdUC5VbcDR24xwSte 3I8w== X-Gm-Message-State: AHQUAuZebziDzFTXMMYkBc5PdVwT+rO6IHAMTzntO3mYksuk7vPl84sX 8940p6L0Kvin/kuW0Eb+4hQ+S6T5HiI= X-Google-Smtp-Source: AHgI3IayufXMo2FLSaezwErWB1akiqYtz2lCrkr2W+luTmMLDzE8VFG432L0t9q9BOytLoj2DHf0SQ== X-Received: by 2002:a19:f517:: with SMTP id j23mr23569346lfb.118.1550763923595; Thu, 21 Feb 2019 07:45:23 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:22 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 06/30 v2] ARM: ixp4xx: Switch to use new IRQ+GPIO drivers Date: Thu, 21 Feb 2019 16:44:34 +0100 Message-Id: <20190221154458.23763-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074527_008145_FB7B2B72 X-CRM114-Status: GOOD ( 24.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Bartosz Golaszewski , Linus Walleij , Thomas Gleixner , Jason Cooper Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This deletes the old irq+gpiochip combo from the IXP4xx machine and switches it over to use the new drivers merged in respective subsystem. Cc: Marc Zyngier Cc: Jason Cooper Cc: Thomas Gleixner Cc: Bartosz Golaszewski Signed-off-by: Linus Walleij Acked-by: Marc Zyngier --- IRQ+GPIO folks: here you see how I activate those new drivers. Intended to be merged through ARM SoC. --- arch/arm/Kconfig | 3 +- arch/arm/mach-ixp4xx/common.c | 318 ++---------------- arch/arm/mach-ixp4xx/dsmg600-setup.c | 3 - .../mach-ixp4xx/include/mach/ixp4xx-regs.h | 89 ----- arch/arm/mach-ixp4xx/nas100d-setup.c | 3 - 5 files changed, 24 insertions(+), 392 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index de2a5647e85d..f6345594cef0 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -432,10 +432,11 @@ config ARCH_IXP4XX select DMABOUNCE if PCI select GENERIC_CLOCKEVENTS select GENERIC_IRQ_MULTI_HANDLER + select GPIO_IXP4XX select GPIOLIB select HAVE_PCI + select IXP4XX_IRQ select NEED_MACH_IO_H - select SPARSE_IRQ select USB_EHCI_BIG_ENDIAN_DESC select USB_EHCI_BIG_ENDIAN_MMIO help diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index aa8fd248c125..71683dfc48f9 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -27,11 +27,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -58,7 +58,6 @@ (IXP4XX_OST_RELOAD_MASK + 1) * HZ) * \ (IXP4XX_OST_RELOAD_MASK + 1) -static struct irq_domain *ixp4xx_irqdomain; static void __init ixp4xx_clocksource_init(void); static void __init ixp4xx_clockevent_init(void); static struct clock_event_device clockevent_ixp4xx; @@ -95,266 +94,18 @@ void __init ixp4xx_map_io(void) iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc)); } -/* - * GPIO-functions - */ -/* - * The following converted to the real HW bits the gpio_line_config - */ -/* GPIO pin types */ -#define IXP4XX_GPIO_OUT 0x1 -#define IXP4XX_GPIO_IN 0x2 - -/* GPIO signal types */ -#define IXP4XX_GPIO_LOW 0 -#define IXP4XX_GPIO_HIGH 1 - -/* GPIO Clocks */ -#define IXP4XX_GPIO_CLK_0 14 -#define IXP4XX_GPIO_CLK_1 15 - -static void gpio_line_config(u8 line, u32 direction) -{ - if (direction == IXP4XX_GPIO_IN) - *IXP4XX_GPIO_GPOER |= (1 << line); - else - *IXP4XX_GPIO_GPOER &= ~(1 << line); -} - -static void gpio_line_get(u8 line, int *value) -{ - *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1; -} - -static void gpio_line_set(u8 line, int value) -{ - if (value == IXP4XX_GPIO_HIGH) - *IXP4XX_GPIO_GPOUTR |= (1 << line); - else if (value == IXP4XX_GPIO_LOW) - *IXP4XX_GPIO_GPOUTR &= ~(1 << line); -} - -/************************************************************************* - * IXP4xx chipset IRQ handling - * - * TODO: GPIO IRQs should be marked invalid until the user of the IRQ - * (be it PCI or something else) configures that GPIO line - * as an IRQ. - **************************************************************************/ -enum ixp4xx_irq_type { - IXP4XX_IRQ_LEVEL, IXP4XX_IRQ_EDGE -}; - -/* Each bit represents an IRQ: 1: edge-triggered, 0: level triggered */ -static unsigned long long ixp4xx_irq_edge = 0; - -/* - * IRQ -> GPIO mapping table - */ -static signed char irq2gpio[32] = { - -1, -1, -1, -1, -1, -1, 0, 1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, -1, -1, -}; - -static int ixp4xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -{ - int irq; - - for (irq = 0; irq < 32; irq++) { - if (irq2gpio[irq] == gpio) - return irq; - } - return -EINVAL; -} - -static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type) -{ - int line = irq2gpio[d->hwirq]; - u32 int_style; - enum ixp4xx_irq_type irq_type; - volatile u32 *int_reg; - - /* - * Only for GPIO IRQs - * all other IRQs are simply active low - */ - if (line < 0) - return 0; - - switch (type){ - case IRQ_TYPE_EDGE_BOTH: - int_style = IXP4XX_GPIO_STYLE_TRANSITIONAL; - irq_type = IXP4XX_IRQ_EDGE; - break; - case IRQ_TYPE_EDGE_RISING: - int_style = IXP4XX_GPIO_STYLE_RISING_EDGE; - irq_type = IXP4XX_IRQ_EDGE; - break; - case IRQ_TYPE_EDGE_FALLING: - int_style = IXP4XX_GPIO_STYLE_FALLING_EDGE; - irq_type = IXP4XX_IRQ_EDGE; - break; - case IRQ_TYPE_LEVEL_HIGH: - int_style = IXP4XX_GPIO_STYLE_ACTIVE_HIGH; - irq_type = IXP4XX_IRQ_LEVEL; - break; - case IRQ_TYPE_LEVEL_LOW: - int_style = IXP4XX_GPIO_STYLE_ACTIVE_LOW; - irq_type = IXP4XX_IRQ_LEVEL; - break; - default: - return -EINVAL; - } - - if (irq_type == IXP4XX_IRQ_EDGE) - ixp4xx_irq_edge |= (1 << d->hwirq); - else - ixp4xx_irq_edge &= ~(1 << d->hwirq); - - if (line >= 8) { /* pins 8-15 */ - line -= 8; - int_reg = IXP4XX_GPIO_GPIT2R; - } else { /* pins 0-7 */ - int_reg = IXP4XX_GPIO_GPIT1R; - } - - /* Clear the style for the appropriate pin */ - *int_reg &= ~(IXP4XX_GPIO_STYLE_CLEAR << - (line * IXP4XX_GPIO_STYLE_SIZE)); - - *IXP4XX_GPIO_GPISR = (1 << line); - - /* Set the new style */ - *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE)); - - /* Configure the line as an input */ - gpio_line_config(irq2gpio[d->hwirq], IXP4XX_GPIO_IN); - - return 0; -} - -static void ixp4xx_irq_mask(struct irq_data *d) -{ - if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->hwirq >= 32) - *IXP4XX_ICMR2 &= ~(1 << (d->hwirq - 32)); - else - *IXP4XX_ICMR &= ~(1 << d->hwirq); -} - -static void ixp4xx_irq_ack(struct irq_data *d) -{ - int line = (d->hwirq < 32) ? irq2gpio[d->hwirq] : -1; - - if (line >= 0) - *IXP4XX_GPIO_GPISR = (1 << line); -} - -/* - * Level triggered interrupts on GPIO lines can only be cleared when the - * interrupt condition disappears. - */ -static void ixp4xx_irq_unmask(struct irq_data *d) -{ - if (!(ixp4xx_irq_edge & (1 << d->hwirq))) - ixp4xx_irq_ack(d); - - if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->hwirq >= 32) - *IXP4XX_ICMR2 |= (1 << (d->hwirq - 32)); - else - *IXP4XX_ICMR |= (1 << d->hwirq); -} - -static struct irq_chip ixp4xx_irq_chip = { - .name = "IXP4xx", - .irq_ack = ixp4xx_irq_ack, - .irq_mask = ixp4xx_irq_mask, - .irq_unmask = ixp4xx_irq_unmask, - .irq_set_type = ixp4xx_set_irq_type, -}; - -asmlinkage void __exception_irq_entry ixp4xx_handle_irq(struct pt_regs *regs) -{ - unsigned long status; - int i; - - status = *IXP4XX_ICIP; - - for_each_set_bit(i, &status, 32) - handle_domain_irq(ixp4xx_irqdomain, i, regs); - - /* - * IXP465/IXP435 has an upper IRQ status register - */ - if ((cpu_is_ixp46x() || cpu_is_ixp43x())) { - status = *IXP4XX_ICIP2; - for_each_set_bit(i, &status, 32) - handle_domain_irq(ixp4xx_irqdomain, i + 32, regs); - } -} - -static int ixp4xx_irqdomain_map(struct irq_domain *d, unsigned int irq, - irq_hw_number_t hwirq) -{ - irq_set_chip_data(irq, &ixp4xx_irq_chip); - irq_set_chip_and_handler(irq, &ixp4xx_irq_chip, handle_level_irq); - irq_set_probe(irq); - - return 0; -} - -static void ixp4xx_irqdomain_unmap(struct irq_domain *d, unsigned int irq) -{ - irq_set_chip_and_handler(irq, NULL, NULL); - irq_set_chip_data(irq, NULL); -} - -static const struct irq_domain_ops ixp4xx_irqdomain_ops = { - .map = ixp4xx_irqdomain_map, - .unmap = ixp4xx_irqdomain_unmap, -}; - void __init ixp4xx_init_irq(void) { - int nr_irqs; - /* * ixp4xx does not implement the XScale PWRMODE register * so it must not call cpu_do_idle(). */ cpu_idle_poll_ctrl(true); - /* Route all sources to IRQ instead of FIQ */ - *IXP4XX_ICLR = 0x0; - - /* Disable all interrupt */ - *IXP4XX_ICMR = 0x0; - - if (cpu_is_ixp46x() || cpu_is_ixp43x()) { - /* Route upper 32 sources to IRQ instead of FIQ */ - *IXP4XX_ICLR2 = 0x00; - - /* Disable upper 32 interrupts */ - *IXP4XX_ICMR2 = 0x00; - - nr_irqs = 64; - } else { - nr_irqs = 32; - } - - ixp4xx_irqdomain = irq_domain_add_simple(NULL, nr_irqs, IRQ_IXP4XX_BASE, - &ixp4xx_irqdomain_ops, - NULL); - if (!ixp4xx_irqdomain) { - pr_crit("can not add primary irqdomain\n"); - return; - } - - set_handle_irq(ixp4xx_handle_irq); + ixp4xx_irq_init(IXP4XX_INTC_BASE_PHYS, + (cpu_is_ixp46x() || cpu_is_ixp43x())); } - /************************************************************************* * IXP4xx timer tick * We use OS timer1 on the CPU for the timer tick and the timestamp @@ -408,6 +159,24 @@ static struct resource ixp4xx_udc_resources[] = { }, }; +static struct resource ixp4xx_gpio_resource[] = { + { + .start = IXP4XX_GPIO_BASE_PHYS, + .end = IXP4XX_GPIO_BASE_PHYS + 0xfff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device ixp4xx_gpio_device = { + .name = "ixp4xx-gpio", + .id = -1, + .dev = { + .coherent_dma_mask = DMA_BIT_MASK(32), + }, + .resource = ixp4xx_gpio_resource, + .num_resources = ARRAY_SIZE(ixp4xx_gpio_resource), +}; + /* * USB device controller. The IXP4xx uses the same controller as PXA25X, * so we just use the same device. @@ -423,6 +192,7 @@ static struct platform_device ixp4xx_udc_device = { }; static struct platform_device *ixp4xx_devices[] __initdata = { + &ixp4xx_gpio_device, &ixp4xx_udc_device, }; @@ -457,56 +227,12 @@ static struct platform_device *ixp46x_devices[] __initdata = { unsigned long ixp4xx_exp_bus_size; EXPORT_SYMBOL(ixp4xx_exp_bus_size); -static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) -{ - gpio_line_config(gpio, IXP4XX_GPIO_IN); - - return 0; -} - -static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, - int level) -{ - gpio_line_set(gpio, level); - gpio_line_config(gpio, IXP4XX_GPIO_OUT); - - return 0; -} - -static int ixp4xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio) -{ - int value; - - gpio_line_get(gpio, &value); - - return value; -} - -static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, - int value) -{ - gpio_line_set(gpio, value); -} - -static struct gpio_chip ixp4xx_gpio_chip = { - .label = "IXP4XX_GPIO_CHIP", - .direction_input = ixp4xx_gpio_direction_input, - .direction_output = ixp4xx_gpio_direction_output, - .get = ixp4xx_gpio_get_value, - .set = ixp4xx_gpio_set_value, - .to_irq = ixp4xx_gpio_to_irq, - .base = 0, - .ngpio = 16, -}; - void __init ixp4xx_sys_init(void) { ixp4xx_exp_bus_size = SZ_16M; platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices)); - gpiochip_add_data(&ixp4xx_gpio_chip, NULL); - if (cpu_is_ixp46x()) { int region; diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c index 0daaede8fb6d..4d4c62fced71 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c @@ -270,9 +270,6 @@ static void __init dsmg600_init(void) { ixp4xx_sys_init(); - /* Make sure that GPIO14 and GPIO15 are not used as clocks */ - *IXP4XX_GPIO_GPCLKR = 0; - dsmg600_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); dsmg600_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h index b7ddd27419c2..459abe2eb4b5 100644 --- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h +++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h @@ -147,95 +147,6 @@ #define IXP4XX_I2C_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x11000) #define IXP4XX_SSP_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x12000) -/* - * Constants to make it easy to access Interrupt Controller registers - */ -#define IXP4XX_ICPR_OFFSET 0x00 /* Interrupt Status */ -#define IXP4XX_ICMR_OFFSET 0x04 /* Interrupt Enable */ -#define IXP4XX_ICLR_OFFSET 0x08 /* Interrupt IRQ/FIQ Select */ -#define IXP4XX_ICIP_OFFSET 0x0C /* IRQ Status */ -#define IXP4XX_ICFP_OFFSET 0x10 /* FIQ Status */ -#define IXP4XX_ICHR_OFFSET 0x14 /* Interrupt Priority */ -#define IXP4XX_ICIH_OFFSET 0x18 /* IRQ Highest Pri Int */ -#define IXP4XX_ICFH_OFFSET 0x1C /* FIQ Highest Pri Int */ - -/* - * IXP465-only - */ -#define IXP4XX_ICPR2_OFFSET 0x20 /* Interrupt Status 2 */ -#define IXP4XX_ICMR2_OFFSET 0x24 /* Interrupt Enable 2 */ -#define IXP4XX_ICLR2_OFFSET 0x28 /* Interrupt IRQ/FIQ Select 2 */ -#define IXP4XX_ICIP2_OFFSET 0x2C /* IRQ Status */ -#define IXP4XX_ICFP2_OFFSET 0x30 /* FIQ Status */ -#define IXP4XX_ICEEN_OFFSET 0x34 /* Error High Pri Enable */ - - -/* - * Interrupt Controller Register Definitions. - */ - -#define IXP4XX_INTC_REG(x) ((volatile u32 *)(IXP4XX_INTC_BASE_VIRT+(x))) - -#define IXP4XX_ICPR IXP4XX_INTC_REG(IXP4XX_ICPR_OFFSET) -#define IXP4XX_ICMR IXP4XX_INTC_REG(IXP4XX_ICMR_OFFSET) -#define IXP4XX_ICLR IXP4XX_INTC_REG(IXP4XX_ICLR_OFFSET) -#define IXP4XX_ICIP IXP4XX_INTC_REG(IXP4XX_ICIP_OFFSET) -#define IXP4XX_ICFP IXP4XX_INTC_REG(IXP4XX_ICFP_OFFSET) -#define IXP4XX_ICHR IXP4XX_INTC_REG(IXP4XX_ICHR_OFFSET) -#define IXP4XX_ICIH IXP4XX_INTC_REG(IXP4XX_ICIH_OFFSET) -#define IXP4XX_ICFH IXP4XX_INTC_REG(IXP4XX_ICFH_OFFSET) -#define IXP4XX_ICPR2 IXP4XX_INTC_REG(IXP4XX_ICPR2_OFFSET) -#define IXP4XX_ICMR2 IXP4XX_INTC_REG(IXP4XX_ICMR2_OFFSET) -#define IXP4XX_ICLR2 IXP4XX_INTC_REG(IXP4XX_ICLR2_OFFSET) -#define IXP4XX_ICIP2 IXP4XX_INTC_REG(IXP4XX_ICIP2_OFFSET) -#define IXP4XX_ICFP2 IXP4XX_INTC_REG(IXP4XX_ICFP2_OFFSET) -#define IXP4XX_ICEEN IXP4XX_INTC_REG(IXP4XX_ICEEN_OFFSET) - -/* - * Constants to make it easy to access GPIO registers - */ -#define IXP4XX_GPIO_GPOUTR_OFFSET 0x00 -#define IXP4XX_GPIO_GPOER_OFFSET 0x04 -#define IXP4XX_GPIO_GPINR_OFFSET 0x08 -#define IXP4XX_GPIO_GPISR_OFFSET 0x0C -#define IXP4XX_GPIO_GPIT1R_OFFSET 0x10 -#define IXP4XX_GPIO_GPIT2R_OFFSET 0x14 -#define IXP4XX_GPIO_GPCLKR_OFFSET 0x18 -#define IXP4XX_GPIO_GPDBSELR_OFFSET 0x1C - -/* - * GPIO Register Definitions. - * [Only perform 32bit reads/writes] - */ -#define IXP4XX_GPIO_REG(x) ((volatile u32 *)(IXP4XX_GPIO_BASE_VIRT+(x))) - -#define IXP4XX_GPIO_GPOUTR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOUTR_OFFSET) -#define IXP4XX_GPIO_GPOER IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOER_OFFSET) -#define IXP4XX_GPIO_GPINR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPINR_OFFSET) -#define IXP4XX_GPIO_GPISR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPISR_OFFSET) -#define IXP4XX_GPIO_GPIT1R IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT1R_OFFSET) -#define IXP4XX_GPIO_GPIT2R IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT2R_OFFSET) -#define IXP4XX_GPIO_GPCLKR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPCLKR_OFFSET) -#define IXP4XX_GPIO_GPDBSELR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPDBSELR_OFFSET) - -/* - * GPIO register bit definitions - */ - -/* Interrupt styles - */ -#define IXP4XX_GPIO_STYLE_ACTIVE_HIGH 0x0 -#define IXP4XX_GPIO_STYLE_ACTIVE_LOW 0x1 -#define IXP4XX_GPIO_STYLE_RISING_EDGE 0x2 -#define IXP4XX_GPIO_STYLE_FALLING_EDGE 0x3 -#define IXP4XX_GPIO_STYLE_TRANSITIONAL 0x4 - -/* - * Mask used to clear interrupt styles - */ -#define IXP4XX_GPIO_STYLE_CLEAR 0x7 -#define IXP4XX_GPIO_STYLE_SIZE 3 - /* * Constants to make it easy to access Timer Control/Status registers */ diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index 9d67f8de0772..c142cfa8c5d6 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c @@ -281,9 +281,6 @@ static void __init nas100d_init(void) ixp4xx_sys_init(); - /* gpio 14 and 15 are _not_ clocks */ - *IXP4XX_GPIO_GPCLKR = 0; - nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); nas100d_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; From patchwork Thu Feb 21 15:44:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0857515AC for ; Thu, 21 Feb 2019 15:47:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E73EE311A1 for ; Thu, 21 Feb 2019 15:47:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB17A314DB; Thu, 21 Feb 2019 15:47:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0971E314D4 for ; Thu, 21 Feb 2019 15:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=F0FcIC5azFkJU2KBCG/g5/BOEDN7M6OoL+6P/bl8fwo=; b=myC5O/hMjpbtCV 3NsADn1x8dcswkTYMDTqAv+6863LvKzLrbbKQUpasXCwKNNoY0/zHQ2s237VodDVztOHsojlSHtAd IIkTL4Jxd/cNH7M5lHI3R/grdVa02sRw5dKpkJwo6AVrfcaFOdu/zYnlRe42u7uMl1MMxmYyvhA/s /mUcicX6aWfaupJhGSNefjSyiWJ1dwcAAfccI40GMTNJlcR1YQRowZ4A/7UbT8t/8rcRaNHMPpFzS fFpha5RUAi53PDMG6ySbFJ9OBVutsVD56ixr/7LZfo7Vnev2vCg88Scf9ebe8/Ujf5hMDWZwuU3qF vLBX5omawDDj5DMpPzHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqZ0-0006gU-12; Thu, 21 Feb 2019 15:47:06 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXR-00053M-0j for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:35 +0000 Received: by mail-lf1-x141.google.com with SMTP id u21so20750362lfu.1 for ; Thu, 21 Feb 2019 07:45:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IkKADZznkEQmQ+KwrhSzI2McdxMD2GahdXj+RHxHxTE=; b=MrjxQBptDkscX1ArLet6y+rgFRomp+U11jIBimJ5zCp/3t3dk3zbDpwts78sK2jcY0 06ePwKmNRaFHcBgwY4KuHfrG54rv6MNbsdrZncHwGmQiodtFXl+z0h9mWmC4Qch01dsO kcvPee3pG/SIqK+HBa427aGwlpQqsJLy1aXdlEj5urZ8QpMswgdJ5oCPKv4BXLWemSqf wZpRkgtfNCQruM+/DJvLY7VJeCzboivFyjs0rLpprr8gOqjwO+s/FZVsj4BhwAMkjmyg QIgz5c+NMHVkHX+NlEwRuTgwaoel8jdUGeUwiLk7w+yBxKoyRF8HecDfCH1aHSly1SXi WOMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IkKADZznkEQmQ+KwrhSzI2McdxMD2GahdXj+RHxHxTE=; b=IxAOSDSndrFiR75a03Dw8mtmv+i7AIp31k+reRQGw3JApGsaVfDkdnU7gdPQ3B+Lw5 4lN0qX8zBDe9CvpYrZ7OcGB368lFcnFwdCm6/IzbpP9LGuR8gxxCRHhdqPL9hakzXUkA pTV7JQ6/cJ4b1cmwhBMoOJxUr2Z3lqXrHj3tecpQQG4a2q0GYCm2ipZlirL/M2zqxQai pQagfpFYdj/uirU/U0KwTsOhW7twk4lSyaJAAUmWfrNv31KJTgptUhc/XJA1E4Cq6Yex Ja6NsAJXRnLzpXiAjSAUSg5P2iDCjc4qx5nNK+xSKvIUejB4oq/D3fm61kuDNxTb2Idz zJpA== X-Gm-Message-State: AHQUAubS2u0HpIVVUH3Oee0emmb/IvgSro5LkXRSqY+H6eAp/P+WNUMT fsFRyQuVHBFzfpSaszLhMb1xYaGx86s= X-Google-Smtp-Source: AHgI3IaMQ9PWXmVM4AFCpTGyTk21J+vqx2WD5GuXPE1Fo3g+o1xs+iooS/+uMk5fUHPnzWrtUvOxeQ== X-Received: by 2002:ac2:5183:: with SMTP id u3mr24290492lfi.153.1550763926739; Thu, 21 Feb 2019 07:45:26 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:25 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 07/30 v2] clocksource/drivers/ixp4xx: Add driver Date: Thu, 21 Feb 2019 16:44:35 +0100 Message-Id: <20190221154458.23763-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074529_347375_F3A99543 X-CRM114-Status: GOOD ( 20.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij , Daniel Lezcano , Thomas Gleixner Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a new slightly rewritten timer driver for the Intel IXP4xx clocksource, clockevent and delay timer. Cc: Daniel Lezcano Cc: Thomas Gleixner Signed-off-by: Linus Walleij --- Clocksource/timer maintainers: I am requesting an ACK for this once you're happy with the driver, as I intend to merge all of this IXP4xx rework through ARM SoC. --- MAINTAINERS | 2 + drivers/clocksource/Kconfig | 7 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-ixp4xx.c | 249 +++++++++++++++++++++ include/linux/platform_data/timer-ixp4xx.h | 11 + 5 files changed, 270 insertions(+) create mode 100644 drivers/clocksource/timer-ixp4xx.c create mode 100644 include/linux/platform_data/timer-ixp4xx.h diff --git a/MAINTAINERS b/MAINTAINERS index 6c161bd82238..a2fb67b75026 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1651,9 +1651,11 @@ M: Krzysztof Halasa L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained F: arch/arm/mach-ixp4xx/ +F: drivers/clocksource/timer-ixp4xx.c F: drivers/gpio/gpio-ixp4xx.c F: drivers/irqchip/irq-ixp4xx.c F: include/linux/irqchip/irq-ixp4xx.h +F: include/linux/platform_data/timer-ixp4xx.h ARM/INTEL RESEARCH IMOTE/STARGATE 2 MACHINE SUPPORT M: Jonathan Cameron diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index a9e26f6a81a1..d290d6c6576d 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -69,6 +69,13 @@ config FTTMR010_TIMER Enables support for the Faraday Technology timer block FTTMR010. +config IXP4XX_TIMER + bool "Intel XScale IXP4xx timer driver" if COMPILE_TEST + depends on HAS_IOMEM + select CLKSRC_MMIO + help + Enables support for the Intel XScale IXP4xx SoC timer. + config ROCKCHIP_TIMER bool "Rockchip timer driver" if COMPILE_TEST depends on ARM || ARM64 diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index cdd210ff89ea..18158257ebb3 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_OMAP_DM_TIMER) += timer-ti-dm.o obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o obj-$(CONFIG_FTTMR010_TIMER) += timer-fttmr010.o +obj-$(CONFIG_IXP4XX_TIMER) += timer-ixp4xx.o obj-$(CONFIG_ROCKCHIP_TIMER) += timer-rockchip.o obj-$(CONFIG_CLKSRC_NOMADIK_MTU) += nomadik-mtu.o obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o diff --git a/drivers/clocksource/timer-ixp4xx.c b/drivers/clocksource/timer-ixp4xx.c new file mode 100644 index 000000000000..fa78f80792db --- /dev/null +++ b/drivers/clocksource/timer-ixp4xx.c @@ -0,0 +1,249 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * IXP4 timer driver + * Copyright (C) 2019 Linus Walleij + * + * Based on arch/arm/mach-ixp4xx/common.c + * Copyright 2002 (C) Intel Corporation + * Copyright 2003-2004 (C) MontaVista, Software, Inc. + * Copyright (C) Deepak Saxena + */ +#include +#include +#include +#include +#include +#include +#include +#include +/* Goes away with OF conversion */ +#include + +/* + * Constants to make it easy to access Timer Control/Status registers + */ +#define IXP4XX_OSTS_OFFSET 0x00 /* Continuous Timestamp */ +#define IXP4XX_OST1_OFFSET 0x04 /* Timer 1 Timestamp */ +#define IXP4XX_OSRT1_OFFSET 0x08 /* Timer 1 Reload */ +#define IXP4XX_OST2_OFFSET 0x0C /* Timer 2 Timestamp */ +#define IXP4XX_OSRT2_OFFSET 0x10 /* Timer 2 Reload */ +#define IXP4XX_OSWT_OFFSET 0x14 /* Watchdog Timer */ +#define IXP4XX_OSWE_OFFSET 0x18 /* Watchdog Enable */ +#define IXP4XX_OSWK_OFFSET 0x1C /* Watchdog Key */ +#define IXP4XX_OSST_OFFSET 0x20 /* Timer Status */ + +/* + * Timer register values and bit definitions + */ +#define IXP4XX_OST_ENABLE 0x00000001 +#define IXP4XX_OST_ONE_SHOT 0x00000002 +/* Low order bits of reload value ignored */ +#define IXP4XX_OST_RELOAD_MASK 0x00000003 +#define IXP4XX_OST_DISABLED 0x00000000 +#define IXP4XX_OSST_TIMER_1_PEND 0x00000001 +#define IXP4XX_OSST_TIMER_2_PEND 0x00000002 +#define IXP4XX_OSST_TIMER_TS_PEND 0x00000004 +#define IXP4XX_OSST_TIMER_WDOG_PEND 0x00000008 +#define IXP4XX_OSST_TIMER_WARM_RESET 0x00000010 + +#define IXP4XX_WDT_KEY 0x0000482E +#define IXP4XX_WDT_RESET_ENABLE 0x00000001 +#define IXP4XX_WDT_IRQ_ENABLE 0x00000002 +#define IXP4XX_WDT_COUNT_ENABLE 0x00000004 + +struct ixp4xx_timer { + void __iomem *base; + unsigned int tick_rate; + u32 latch; + struct clock_event_device clkevt; +#ifdef CONFIG_ARM + struct delay_timer delay_timer; +#endif +}; + +/* + * A local singleton used by sched_clock and delay timer reads, which are + * fast and stateless + */ +static struct ixp4xx_timer *local_ixp4xx_timer; + +static inline struct ixp4xx_timer * +to_ixp4xx_timer(struct clock_event_device *evt) +{ + return container_of(evt, struct ixp4xx_timer, clkevt); +} + +static u64 notrace ixp4xx_read_sched_clock(void) +{ + return __raw_readl(local_ixp4xx_timer->base + IXP4XX_OSTS_OFFSET); +} + +static u64 ixp4xx_clocksource_read(struct clocksource *c) +{ + return __raw_readl(local_ixp4xx_timer->base + IXP4XX_OSTS_OFFSET); +} + +static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id) +{ + struct ixp4xx_timer *tmr = dev_id; + struct clock_event_device *evt = &tmr->clkevt; + + /* Clear Pending Interrupt */ + __raw_writel(IXP4XX_OSST_TIMER_1_PEND, + tmr->base + IXP4XX_OSST_OFFSET); + + evt->event_handler(evt); + + return IRQ_HANDLED; +} + +static int ixp4xx_set_next_event(unsigned long cycles, + struct clock_event_device *evt) +{ + struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt); + u32 val; + + val = __raw_readl(tmr->base + IXP4XX_OSRT1_OFFSET); + /* Keep enable/oneshot bits */ + val &= IXP4XX_OST_RELOAD_MASK; + __raw_writel((cycles & ~IXP4XX_OST_RELOAD_MASK) | val, + tmr->base + IXP4XX_OSRT1_OFFSET); + + return 0; +} + +static int ixp4xx_shutdown(struct clock_event_device *evt) +{ + struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt); + u32 val; + + val = __raw_readl(tmr->base + IXP4XX_OSRT1_OFFSET); + val &= ~IXP4XX_OST_ENABLE; + __raw_writel(val, tmr->base + IXP4XX_OSRT1_OFFSET); + + return 0; +} + +static int ixp4xx_set_oneshot(struct clock_event_device *evt) +{ + struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt); + + __raw_writel(IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT, + tmr->base + IXP4XX_OSRT1_OFFSET); + + return 0; +} + +static int ixp4xx_set_periodic(struct clock_event_device *evt) +{ + struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt); + u32 val; + + val = tmr->latch & ~IXP4XX_OST_RELOAD_MASK; + val |= IXP4XX_OST_ENABLE; + __raw_writel(val, tmr->base + IXP4XX_OSRT1_OFFSET); + + return 0; +} + +static int ixp4xx_resume(struct clock_event_device *evt) +{ + struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt); + u32 val; + + val = __raw_readl(tmr->base + IXP4XX_OSRT1_OFFSET); + val |= IXP4XX_OST_ENABLE; + __raw_writel(val, tmr->base + IXP4XX_OSRT1_OFFSET); + + return 0; +} + +/* + * IXP4xx timer tick + * We use OS timer1 on the CPU for the timer tick and the timestamp + * counter as a source of real clock ticks to account for missed jiffies. + */ +static __init int ixp4xx_timer_register(void __iomem *base, + int timer_irq, + unsigned int timer_freq) +{ + struct ixp4xx_timer *tmr; + int ret; + + tmr = kzalloc(sizeof(*tmr), GFP_KERNEL); + if (!tmr) + return -ENOMEM; + tmr->base = base; + tmr->tick_rate = timer_freq; + + /* + * The timer register doesn't allow to specify the two least + * significant bits of the timeout value and assumes them being zero. + * So make sure the latch is the best value with the two least + * significant bits unset. + */ + tmr->latch = DIV_ROUND_CLOSEST(timer_freq, + (IXP4XX_OST_RELOAD_MASK + 1) * HZ) + * (IXP4XX_OST_RELOAD_MASK + 1); + + local_ixp4xx_timer = tmr; + + /* Reset/disable counter */ + __raw_writel(0, tmr->base + IXP4XX_OSRT1_OFFSET); + + /* Clear any pending interrupt on timer 1 */ + __raw_writel(IXP4XX_OSST_TIMER_1_PEND, + tmr->base + IXP4XX_OSST_OFFSET); + + /* Reset time-stamp counter */ + __raw_writel(0, tmr->base + IXP4XX_OSTS_OFFSET); + + clocksource_mmio_init(NULL, "OSTS", timer_freq, 200, 32, + ixp4xx_clocksource_read); + + tmr->clkevt.name = "ixp4xx timer1"; + tmr->clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; + tmr->clkevt.rating = 200; + tmr->clkevt.set_state_shutdown = ixp4xx_shutdown; + tmr->clkevt.set_state_periodic = ixp4xx_set_periodic; + tmr->clkevt.set_state_oneshot = ixp4xx_set_oneshot; + tmr->clkevt.tick_resume = ixp4xx_resume; + tmr->clkevt.set_next_event = ixp4xx_set_next_event; + tmr->clkevt.cpumask = cpumask_of(0); + tmr->clkevt.irq = timer_irq; + ret = request_irq(timer_irq, ixp4xx_timer_interrupt, + IRQF_TIMER, "IXP4XX-TIMER1", tmr); + if (ret) { + pr_crit("no timer IRQ\n"); + return -ENODEV; + } + clockevents_config_and_register(&tmr->clkevt, timer_freq, + 0xf, 0xfffffffe); + +#ifdef CONFIG_ARM + sched_clock_register(ixp4xx_read_sched_clock, 32, timer_freq); +#endif + + return 0; +} + +/** + * ixp4xx_timer_setup() - Timer setup function to be called from boardfiles + * @timerbase: physical base of timer block + * @timer_irq: Linux IRQ number for the timer + * @timer_freq: Fixed frequency of the timer + */ +void __init ixp4xx_timer_setup(resource_size_t timerbase, + int timer_irq, + unsigned int timer_freq) +{ + void __iomem *base; + + base = ioremap(timerbase, 0x100); + if (!base) { + pr_crit("IXP4xx: can't remap timer\n"); + return; + } + ixp4xx_timer_register(base, timer_irq, timer_freq); +} +EXPORT_SYMBOL_GPL(ixp4xx_timer_setup); diff --git a/include/linux/platform_data/timer-ixp4xx.h b/include/linux/platform_data/timer-ixp4xx.h new file mode 100644 index 000000000000..ee92ae7edaed --- /dev/null +++ b/include/linux/platform_data/timer-ixp4xx.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __TIMER_IXP4XX_H +#define __TIMER_IXP4XX_H + +#include + +void __init ixp4xx_timer_setup(resource_size_t timerbase, + int timer_irq, + unsigned int timer_freq); + +#endif From patchwork Thu Feb 21 15:44:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54AA9139A for ; Thu, 21 Feb 2019 15:59:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4143431186 for ; Thu, 21 Feb 2019 15:59:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3429A31778; Thu, 21 Feb 2019 15:59:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9DB3731186 for ; Thu, 21 Feb 2019 15:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KZxfS3tR1IRd3m+wq8JmrzIGF6sH2ohfx0BwGk+1VWc=; b=LyMLlLae/gQyAQ JhC/65aKscJDaP/N65IqpgxJsVa3LALHogmGlvGS+y1cyCq4Liu64Uriv+Dm1V+Zk7+OlenHkzl0E yPz7ESwx2x0uwhA9ymtemaBi0TGe4xKgqNE9LCLf1cwy7hmL0vs80A/so4d8/rudJv/Qdz8Ohvmwq oYl4/AYIIiaoOc33uSeXUFg0rhvG9FcMFYqc+u1Rgx8DEop6Zmg++QiuACA21XnV4bp1GF8FvdM2P eHSmCFvA2rnKfp3FLB5bf11rsSwycyqe13qCd/ooY5dLX5ZUNUhlCuuX9sF5Pyn5CQ39O4uS+WEit RgLOJH/GWXIESFJuChXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqlN-0006je-5j; Thu, 21 Feb 2019 15:59:53 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXT-000565-F1 for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:42 +0000 Received: by mail-lf1-x142.google.com with SMTP id g2so20655248lfh.11 for ; Thu, 21 Feb 2019 07:45:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4xyigNek26TekTHGb8ftZvlTWQ2gVLgDODxtCyg2nRk=; b=ZAhvFLMzuQx4wtHsikuHLUbNB0/FAXWWAiBv8IQ0MinF40C0EE0O/U65ROvav3a2C4 4V7OhpzuICJ9d/jZxqX+lFgyE6W7n0TosLd4ehw7RAmIBiq0BFdo+JdLE4NsO/CkY3VA +eFe4SlLsZh0C0gc9Pp8GVjOpIivSNNRS6f8fxE4gn/SKyWTLReVc9QbgjEIWHa6QAei tIWaOYv98RqZv22VFUFOQ1pYzvoAZDqJGP5jx0LxmdvvJG1kYsMXbK2x9DRlAPlgW6M0 WgPaPyCz27BKpwQJjYAJAa+Sv4iqEPW+PZTnns7bqPI3zgbW6WTkKGzblBQBZjUmRrgs Zhhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4xyigNek26TekTHGb8ftZvlTWQ2gVLgDODxtCyg2nRk=; b=Y42RiozRoEZtkWTwr8ox5Y107p+gzawhxHwO69vbE4IW22X1CIu0tG/tFV+s9kcmwv iETRq74UZTXguRuAv8fM8fsGdAbyE/zmoN+I285IsaL1ymYAmJOH85dkwf3B8lq4zRuB hsnICt1a/SbAnT3WUpR9Za10bDbEh2P3jaTx441gEjq7EgF/lv8bPoShDDingW5RiaU3 tl58GJ2GQRwodPY1kqDbXyxCKDP3YRqnFc5LtaVh7Ojzx5CgqlxAXB1MiO24ETgj8Osh 6dStFxY0o9dcdA4WDArL9xJ98MhdKwzcqq+7QomBG9PlVGHKWbLv5TEK0QB/qvb+7vFV XrrA== X-Gm-Message-State: AHQUAuZOZpqXSzPPVIjqe8de2gtmlCGYGmRA29Ur9R0Hra2445nQ7oQ+ uhSSgETdTOW6YEhBP3HNo/ny9Dh3PRI= X-Google-Smtp-Source: AHgI3IbItfiL8jJhCJhPJJEObG7Ka8fZs8hWsmmk4nZwFmdsF4gTmj3kGZ6VJSG9U/yJakhgr9NggQ== X-Received: by 2002:ac2:4282:: with SMTP id m2mr5566028lfh.141.1550763929349; Thu, 21 Feb 2019 07:45:29 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:28 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 08/30 v2] ARM: ixp4xx: Switch to use new timer driver Date: Thu, 21 Feb 2019 16:44:36 +0100 Message-Id: <20190221154458.23763-9-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074532_041837_4FE31E19 X-CRM114-Status: GOOD ( 18.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij , Daniel Lezcano , Thomas Gleixner Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This augments the IXP4xx to select and use the new timer driver in drivers/clocksource and removes the old code in the machine. Cc: Daniel Lezcano Cc: Thomas Gleixner Signed-off-by: Linus Walleij Acked-by: Daniel Lezcano --- Clocksource/timer maintainers: here you see how I activate this new driver. Intended to be merged through ARM SoC. --- arch/arm/Kconfig | 2 +- arch/arm/mach-ixp4xx/common.c | 153 +--------------------------------- 2 files changed, 5 insertions(+), 150 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f6345594cef0..9f70d7e032d6 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -427,7 +427,6 @@ config ARCH_IXP4XX depends on MMU select ARCH_HAS_DMA_SET_COHERENT_MASK select ARCH_SUPPORTS_BIG_ENDIAN - select CLKSRC_MMIO select CPU_XSCALE select DMABOUNCE if PCI select GENERIC_CLOCKEVENTS @@ -436,6 +435,7 @@ config ARCH_IXP4XX select GPIOLIB select HAVE_PCI select IXP4XX_IRQ + select IXP4XX_TIMER select NEED_MACH_IO_H select USB_EHCI_BIG_ENDIAN_DESC select USB_EHCI_BIG_ENDIAN_MMIO diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 71683dfc48f9..fc4c9b21ca96 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -22,9 +22,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -32,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -49,19 +47,6 @@ #define IXP4XX_TIMER_FREQ 66666000 -/* - * The timer register doesn't allow to specify the two least significant bits of - * the timeout value and assumes them being zero. So make sure IXP4XX_LATCH is - * the best value with the two least significant bits unset. - */ -#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, \ - (IXP4XX_OST_RELOAD_MASK + 1) * HZ) * \ - (IXP4XX_OST_RELOAD_MASK + 1) - -static void __init ixp4xx_clocksource_init(void); -static void __init ixp4xx_clockevent_init(void); -static struct clock_event_device clockevent_ixp4xx; - /************************************************************************* * IXP4xx chipset I/O mapping *************************************************************************/ @@ -106,37 +91,11 @@ void __init ixp4xx_init_irq(void) (cpu_is_ixp46x() || cpu_is_ixp43x())); } -/************************************************************************* - * IXP4xx timer tick - * We use OS timer1 on the CPU for the timer tick and the timestamp - * counter as a source of real clock ticks to account for missed jiffies. - *************************************************************************/ - -static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id) -{ - struct clock_event_device *evt = dev_id; - - /* Clear Pending Interrupt by writing '1' to it */ - *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND; - - evt->event_handler(evt); - - return IRQ_HANDLED; -} - void __init ixp4xx_timer_init(void) { - /* Reset/disable counter */ - *IXP4XX_OSRT1 = 0; - - /* Clear Pending Interrupt by writing '1' to it */ - *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND; - - /* Reset time-stamp counter */ - *IXP4XX_OSTS = 0; - - ixp4xx_clocksource_init(); - ixp4xx_clockevent_init(); + return ixp4xx_timer_setup(IXP4XX_TIMER_BASE_PHYS, + IRQ_IXP4XX_TIMER1, + IXP4XX_TIMER_FREQ); } static struct pxa2xx_udc_mach_info ixp4xx_udc_info; @@ -251,112 +210,8 @@ void __init ixp4xx_sys_init(void) ixp4xx_exp_bus_size >> 20); } -/* - * sched_clock() - */ -static u64 notrace ixp4xx_read_sched_clock(void) -{ - return *IXP4XX_OSTS; -} - -/* - * clocksource - */ - -static u64 ixp4xx_clocksource_read(struct clocksource *c) -{ - return *IXP4XX_OSTS; -} - unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ; EXPORT_SYMBOL(ixp4xx_timer_freq); -static void __init ixp4xx_clocksource_init(void) -{ - sched_clock_register(ixp4xx_read_sched_clock, 32, ixp4xx_timer_freq); - - clocksource_mmio_init(NULL, "OSTS", ixp4xx_timer_freq, 200, 32, - ixp4xx_clocksource_read); -} - -/* - * clockevents - */ -static int ixp4xx_set_next_event(unsigned long evt, - struct clock_event_device *unused) -{ - unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK; - - *IXP4XX_OSRT1 = (evt & ~IXP4XX_OST_RELOAD_MASK) | opts; - - return 0; -} - -static int ixp4xx_shutdown(struct clock_event_device *evt) -{ - unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK; - unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK; - - opts &= ~IXP4XX_OST_ENABLE; - *IXP4XX_OSRT1 = osrt | opts; - return 0; -} - -static int ixp4xx_set_oneshot(struct clock_event_device *evt) -{ - unsigned long opts = IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT; - unsigned long osrt = 0; - - /* period set by 'set next_event' */ - *IXP4XX_OSRT1 = osrt | opts; - return 0; -} - -static int ixp4xx_set_periodic(struct clock_event_device *evt) -{ - unsigned long opts = IXP4XX_OST_ENABLE; - unsigned long osrt = IXP4XX_LATCH & ~IXP4XX_OST_RELOAD_MASK; - - *IXP4XX_OSRT1 = osrt | opts; - return 0; -} - -static int ixp4xx_resume(struct clock_event_device *evt) -{ - unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK; - unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK; - - opts |= IXP4XX_OST_ENABLE; - *IXP4XX_OSRT1 = osrt | opts; - return 0; -} - -static struct clock_event_device clockevent_ixp4xx = { - .name = "ixp4xx timer1", - .features = CLOCK_EVT_FEAT_PERIODIC | - CLOCK_EVT_FEAT_ONESHOT, - .rating = 200, - .set_state_shutdown = ixp4xx_shutdown, - .set_state_periodic = ixp4xx_set_periodic, - .set_state_oneshot = ixp4xx_set_oneshot, - .tick_resume = ixp4xx_resume, - .set_next_event = ixp4xx_set_next_event, -}; - -static void __init ixp4xx_clockevent_init(void) -{ - int ret; - - clockevent_ixp4xx.cpumask = cpumask_of(0); - clockevent_ixp4xx.irq = IRQ_IXP4XX_TIMER1; - ret = request_irq(IRQ_IXP4XX_TIMER1, ixp4xx_timer_interrupt, - IRQF_TIMER, "IXP4XX-TIMER1", &clockevent_ixp4xx); - if (ret) { - pr_crit("no timer IRQ\n"); - return; - } - clockevents_config_and_register(&clockevent_ixp4xx, IXP4XX_TIMER_FREQ, - 0xf, 0xfffffffe); -} void ixp4xx_restart(enum reboot_mode mode, const char *cmd) { From patchwork Thu Feb 21 15:44:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDF9815AC for ; Thu, 21 Feb 2019 16:00:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C850C31765 for ; Thu, 21 Feb 2019 16:00:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB0373177D; Thu, 21 Feb 2019 16:00:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B436231765 for ; Thu, 21 Feb 2019 16:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7igRIsWpoI6s0itgEW2RZVeaXwWLG92ikMLnXzO7MRE=; b=Kzq1/sJGgFF6SF SwFfMk1LeJZBQ3mvUOtRB1B98QwbJxz70KKqMlWIuBhjE+8X6dZI7HXkf+PlscDPSwdtkZ9W7W/CN E2QXVwyoht23eKDNSRMgs2mXTNnPWZhCGyHjIYl9XM+HBHP0Npi5Ii1PyDeZgjBaQKhUKMg6j1rS/ sQ1EwzLMAJsbUHT6s1tN0zq+YX7tgWawfHNN9Yl43qv57AXjWo/9DgvTJSJ4nGPn+EbFN0I7uU+pR 65oKUP5QAWS8P0PIJpyeFHFmUyS73ObSbRFZyb//NBag9BvlM//r//VLWs24wII3dx9ZZ7UxmIIPk 1LwaabAq3vFq0Kl528vQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqlT-0006s0-FS; Thu, 21 Feb 2019 15:59:59 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXW-00058c-Nw for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:50 +0000 Received: by mail-lj1-x242.google.com with SMTP id j13-v6so24437244ljc.2 for ; Thu, 21 Feb 2019 07:45:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/KRBvvDb8vJ/IUxT9QJ5LwxvIcDsKjNvBeUVd1RADoU=; b=k6IOv8NPdHKnwkB3ruTvLUZ6lv4iMw4ZoA1QaBdeOXEaVf9a61ykj6wzVVH/Fxgrlj SSjcb/k4XWkxbbN/jJeZIDtHZOXvp61POLwEMW6/ZK8S2a1mgu4lEc2q992a9KTUafH1 pkRXgTmAjaLhei19rvunYSOW68YltBYWx4r7CIAFRzqtXRgBifd/CnsD2EuY/x2CjNvz unSL01cre4m1YX4MoXz1IzSrhBtJJaFaSDKjK+vZFloy8Csp+nopDx8+3nhMEihg2SXR mBTcmlSTFEIW0VM2ymYyZGe0L6zzMdXxUw8SUXhgH2ue75X6afgfpWNkWjHqUyNsjYR3 e/zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/KRBvvDb8vJ/IUxT9QJ5LwxvIcDsKjNvBeUVd1RADoU=; b=ki+SIqvKqlRMzkEn970Cs4i3NwQ90T6qSafd+G6jvXIV70z2Lfn1SqLf3z5vvUe327 MHdhtQaqNtBpdvQ+M1tJjEH5JvbiJTFu6rBhg0A955A6Rnvc8aBAewwVNSZhwZ2HJCPv BCAfg5YuiSvvTgvc8HjFK4RlPypKL7KBS5GVfGaHyo8+/v9Hr1/6XqduEYE/5Z6qKY61 ikenF4oamvIvYxppS6qr5kwqkdagou3oIi741GdbxJlSbDgdXUw1unioDPhaHBVt8VPw cdSoImJad5Pw+5vTbNJgc5H5wGXiZ8eg6S4HPRfKCmJF4+AL22Yo/C4EYc/zRfPI1u3I fnog== X-Gm-Message-State: AHQUAua8/UjxqHWhGU6c3ZjZ06cO+0sskFMNMJLh1C02eIOhbdoU31aV gZUN3batsSFgf1IrfklR8Tyx5AmGHxk= X-Google-Smtp-Source: AHgI3IY3O2+ilBx3HvsdwXYcmn+6qpQ2t4X3/RPpCo2TcClbeScD0RcjWZuEOVVWNYDqb/m87DqOyA== X-Received: by 2002:a2e:7615:: with SMTP id r21-v6mr24318641ljc.131.1550763932024; Thu, 21 Feb 2019 07:45:32 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:31 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 09/30 v2] irqchip: ixp4xx: Add DT bindings Date: Thu, 21 Feb 2019 16:44:37 +0100 Message-Id: <20190221154458.23763-10-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074534_926511_A90CD702 X-CRM114-Status: GOOD ( 15.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , devicetree@vger.kernel.org, Linus Walleij , Thomas Gleixner , Jason Cooper Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds device tree bindings for the IXP4xx interrupt controller. It's a standard 2-cell controller. Cc: Marc Zyngier Cc: Jason Cooper Cc: Thomas Gleixner Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij Reviewed-by: Rob Herring --- ChangeLog v1->v2: - Converted to use JSON yaml schema, why not. - Not keeping Rob's ACK because I think he wants to take a second look. --- .../intel,ixp4xx-interrupt.yaml | 57 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml diff --git a/Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml b/Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml new file mode 100644 index 000000000000..f32c08f270d6 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2018 Linaro Ltd. +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/interrupt/intel-ixp4xx-interrupt.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Intel IXP4xx XScale Networking Processors Interrupt Controller + +maintainers: + - Linus Walleij + +description: | + This interrupt controller is found in the Intel IXP4xx processors. + Some processors have 32 interrupts, some have up to 64 interrupts. + The exact number of interrupts is determined from the compatible + string. + + The distinct IXP4xx families with different interrupt controller + variations are IXP42x, IXP43x, IXP45x and IXP46x. Those four + families were the only ones to reach the developer and consumer + market. + +properties: + compatible: + oneOf: + - items: + - enum: + - intel,ixp42x-interrupt + - intel,ixp43x-interrupt + - intel,ixp45x-interrupt + - intel,ixp46x-interrupt + + reg: + description: The register bank for the interrupt controller. + + interrupt-controller: true + + '#interrupt-cells': + const: 2 + description: The number of cells to define the interrupts. + with two cells specified in interrupt-controller/interrupts.txt + +required: + - compatible + - reg + - interrupt-controller + - '#interrupt-cells' + +examples: + - | + intcon: interrupt-controller@c8003000 { + compatible = "intel,ixp43x-interrupt"; + reg = <0xc8003000 0x100>; + interrupt-controller; + #interrupt-cells = <2>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index a2fb67b75026..79f01af59a63 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1650,6 +1650,7 @@ M: Imre Kaloz M: Krzysztof Halasa L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml F: arch/arm/mach-ixp4xx/ F: drivers/clocksource/timer-ixp4xx.c F: drivers/gpio/gpio-ixp4xx.c From patchwork Thu Feb 21 15:44:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9CC5A139A for ; Thu, 21 Feb 2019 16:00:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8674031784 for ; Thu, 21 Feb 2019 16:00:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AB64317F2; Thu, 21 Feb 2019 16:00:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E9B231784 for ; Thu, 21 Feb 2019 16:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mK8EY0lCiMOTK2ET3IAx4oLHa+oFfc9ONjAAcSZmU2Y=; b=DZTTMOxseHGrIr zg6uiUnokxWLX9Hdj9agq+iB6fx8uB8HQ7XK5thoIl5CzZoYdeFtwcUqIlwYId76+OXZw3Fci8SuP QIKd7FSxcwYTw4Rz4m2KfchxQYW+ioCPqcr8ShNRg6vVA8BT/fhT8zdN/aIeMD+yYvl9EGB8FyP7T ycbSvtQGM5qTVwRt1ZaE9YRx/J2wYN9d4P2bS4P0mVtWmou3rmf38SXsBoZ0FaxlZ1+7uNm3Uqjci ogf1dmpLCZKe2WtXspX/rSBg41w8qGXEeHcgcV3NvbuHAm1g1w0bRHj1q7uOxBXiR/QDyiW9RiGJb AAKRkbh78AQ+I9vUPVPA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqlk-00081E-Kn; Thu, 21 Feb 2019 16:00:16 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXY-0005BX-Rm for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:54 +0000 Received: by mail-lj1-x244.google.com with SMTP id j13-v6so24437386ljc.2 for ; Thu, 21 Feb 2019 07:45:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QeAjnzLoPiZyS27+mrcrChGYl9RVcTYFeb5TD/4DxtA=; b=inY4dKgdAd6jiYm9qDKqL9+pxB5Nt6vS4MA/vDMS4VBh5guqAdCTqwwsmX8jLwP50K PEangOdp7JYsFRqqXasV0fn1t45YRQcvirlFRTriAlEwS2Qz9tN6Qa4xi5rhqy9WVzEe tTH4xulwh9xTDGCOX7nQVGTlcZh4l2QcCwkO9yyj+YxRApHF9ldgWF0h9Y7FO6SiQeWq VMFdZfxe5fKwJswjN7za8VUjQkph7Hkg0kYDOEpHAHSOq6VSY0pTFr13Q0lMrXDMVVuE MuPIti9U//qdAo9qO0KEFnGGtlP548lzZbMWCya9lMOM2kX2gHDJQ0u5Cky1c7Matn2f OgZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QeAjnzLoPiZyS27+mrcrChGYl9RVcTYFeb5TD/4DxtA=; b=ay+4Qs3pi+BQPfTxleWqT1LckVhbY9LtFr4n6BMbx/mw+gqrbzFjWLGWgIrlHNX+6c xbjFmS9dZdEiC7JZZIbzwPvHjsdvcV2EHGlned7GzeAeejWrToRm1aN/pU0KUXTZOZN2 VD1uBqirm4QSKV52qYFoVVL8AvMxqlo1ISXYaUCVPaOva6T3LjrZ5/rdB2RUiN+jZnvj SP8nYLiSdawCaz/0jlVDMsupfw4ebkqAIpS0pTjFmIqDKvCXiMOPZ4DH88Fk2FXkAfZn mV3P+/zCX96XmjwPgOc3QGJ9fzSeyPY2VIJUnw6+FJ0g/0bHFf14QMxGWdsbMOMWQ81F m4lw== X-Gm-Message-State: AHQUAuYmx7O3Fh7SFpCJr7syptFE7HWWQuW1bg63NR5cqOj1vMuPasrB 8EmTMZRaNSyAonF7FXicadrV2BC0sgw= X-Google-Smtp-Source: AHgI3IawLzMVZaqXNr4H3kPnCBnTWQKqique+tY9LshIqcG8i74o0d2U8zoteHZOmvclS3f9vhNUAw== X-Received: by 2002:a2e:890b:: with SMTP id d11mr5088196lji.174.1550763934656; Thu, 21 Feb 2019 07:45:34 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:33 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 10/30 v2] irqchip: ixp4xx: Add OF initialization support Date: Thu, 21 Feb 2019 16:44:38 +0100 Message-Id: <20190221154458.23763-11-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074537_149533_8E9B1A0D X-CRM114-Status: GOOD ( 14.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Linus Walleij , Thomas Gleixner , Jason Cooper Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds support for probing and settin up the IXP4xx irqchip from device tree. Cc: Marc Zyngier Cc: Jason Cooper Cc: Thomas Gleixner Signed-off-by: Linus Walleij Acked-by: Marc Zyngier --- irqchip maintainers: I am requesting an ACK for this once you're happy with the driver, as I intend to merge all of this IXP4xx rework through ARM SoC. --- drivers/irqchip/irq-ixp4xx.c | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/irqchip/irq-ixp4xx.c b/drivers/irqchip/irq-ixp4xx.c index 89c80ce047a7..1ea7561fddb7 100644 --- a/drivers/irqchip/irq-ixp4xx.c +++ b/drivers/irqchip/irq-ixp4xx.c @@ -15,6 +15,9 @@ #include #include #include +#include +#include +#include #include #include @@ -360,3 +363,45 @@ void __init ixp4xx_irq_init(resource_size_t irqbase, } } EXPORT_SYMBOL_GPL(ixp4xx_irq_init); + +#ifdef CONFIG_OF +int __init ixp4xx_of_init_irq(struct device_node *np, + struct device_node *parent) +{ + struct ixp4xx_irq *ixi = &ixirq; + void __iomem *base; + struct fwnode_handle *fwnode; + bool is_356; + int ret; + + base = of_iomap(np, 0); + if (!base) { + pr_crit("IXP4XX: could not ioremap interrupt controller\n"); + return -ENODEV; + } + fwnode = of_node_to_fwnode(np); + if (!fwnode) { + pr_crit("IXP4XX: no domain handle\n"); + return -ENODEV; + } + + /* These chip variants have 64 interrupts */ + is_356 = of_device_is_compatible(np, "intel,ixp43x-interrupt") || + of_device_is_compatible(np, "intel,ixp45x-interrupt") || + of_device_is_compatible(np, "intel,ixp46x-interrupt"); + + ret = ixp4xx_irq_setup(ixi, base, fwnode, is_356); + if (ret) + pr_crit("IXP4XX: failed to set up irqchip\n"); + + return ret; +} +IRQCHIP_DECLARE(ixp42x, "intel,ixp42x-interrupt", + ixp4xx_of_init_irq); +IRQCHIP_DECLARE(ixp43x, "intel,ixp43x-interrupt", + ixp4xx_of_init_irq); +IRQCHIP_DECLARE(ixp45x, "intel,ixp45x-interrupt", + ixp4xx_of_init_irq); +IRQCHIP_DECLARE(ixp46x, "intel,ixp46x-interrupt", + ixp4xx_of_init_irq); +#endif From patchwork Thu Feb 21 15:44:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824241 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7EB816C2 for ; Thu, 21 Feb 2019 15:47:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69FAC314E5 for ; Thu, 21 Feb 2019 15:47:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DE62314EA; Thu, 21 Feb 2019 15:47:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7B91314E5 for ; Thu, 21 Feb 2019 15:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I+fitr4ogctB7ZB2BJ9p2NuNYHwzszkw1P/A61suFQA=; b=gIBcoAqtHrooxA GRBDbQlYKvSHeumF0qf7ekTvBkmTobIcM2rPwnRZTE2lygVJvMQVG6t31KSHZZfJniWILvdyLBFOh UB3hbmgQG8KH/Q8tTWnkTqXc7rYO4K5M6hujkvvyHV6Jd14pT+2bB1O/OhKvf4Ix2SYlpH4yj5DqS PmgIZS6xgduqeR4gD3W5l7QOBToryEMox8FTe2nnRUiwuQM//bVF/Bk5TlPemX55AN3a4mFq2UiRm nLQh1K50ViMweOHE2qAsbRuingNmfRHlFyT+NkWYaQZ5BR54L7NdnZB6BB5oYgO7r4O4eqm0S8T3D +bwTddUuHMY3wYFBUBoQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqZW-0007R6-4F; Thu, 21 Feb 2019 15:47:38 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXb-0005G5-Og for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:03 +0000 Received: by mail-lj1-x241.google.com with SMTP id j13-v6so24437546ljc.2 for ; Thu, 21 Feb 2019 07:45:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M/pLMnhSvVZVSoeIbvbkl48PXY+MXU30hXCPMAGgHSA=; b=SdzM9T+2iClRMDmhsUvvmz03nLqcCFgpPqPcBKfeOiUrn/qWefqEtsGcvPi9aKsvpv TVq27v4vX8byObujRH25aagGli99Yau+u+KO2bxevjZ/4VWau1ofDemTXjKQHE0cN7DV qlIvsIOzOA38/wJsVhk2h93XFWO6m3cUonbpFj1qadqzFDg3T//R8mneeygAMtC0zZRd yeKlUOB1NM1BC2OCZer2BG11kH2Anlt+CodshlNd63i7WMDoSDk9gGBKUoenOYfgySQE DaVN9JBb9Uat6Zvwnojx3NmA3bAd4wKw6p4D6QrPO5QjVW74/vcW7sWQ+WHPpoXhRFJt chUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M/pLMnhSvVZVSoeIbvbkl48PXY+MXU30hXCPMAGgHSA=; b=YUSs1nTiBipRFoHutXUTmgymBkCU1UQzWcByWqGaz4qJ8e2mlTONa9//wtVuCSbqy2 FhkD85lHIj3WAQZ2vlgYTCULRGMGsUg+7Kz1HoroV2dPLKryL3PK9Xaxhmxi/ZZ4ovKQ rrPfe5MAIpQPk3G7uXvUqt6K6NEmYObecRaGjaq3ux1TkhlAdBCALoMaWSI3PEvd8o6j bV0SbtoJkHGSX4fwaI/heicEYzLdcYWTl7/AkacC0XbU37nI+ZKa8j6dsIJf/ngiYZnm ZcKgvQOj2ph2PhKpFMU+hrzda9+NHGEZMvOpVniNXWAWtopx83EpTpZdONkLc/Lh1XUI 8a6Q== X-Gm-Message-State: AHQUAuYVFqfB3vNT8kKZBzthDfzIONjbvPTlDLvf+uVWpqN91oJDTuOz wUzRGzDPWBmLkMSwhjQuYQbDbPF0hI4= X-Google-Smtp-Source: AHgI3IYqN59k/Lq7Iwr65+N8Rb1pSwyscJdodUPM4jfC1b21YuFhwueitsu05UqmTyxGMipPFAdKKw== X-Received: by 2002:a2e:9c8e:: with SMTP id x14mr7744850lji.166.1550763937419; Thu, 21 Feb 2019 07:45:37 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:36 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 11/30 v2] clocksource/drivers/ixp4xx: Add DT bindings Date: Thu, 21 Feb 2019 16:44:39 +0100 Message-Id: <20190221154458.23763-12-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074540_122615_596EE1B8 X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Linus Walleij , Daniel Lezcano , Thomas Gleixner Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds device tree bindings for the Intel IXP4xx timers. Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij Reviewed-by: Rob Herring --- ChangeLog v1->v2: - Switch to JSON YAML schema, why not. - Not collecting any review tags as this changed a bit. --- .../bindings/timer/intel,ixp4xx-timer.yaml | 42 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml diff --git a/Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml b/Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml new file mode 100644 index 000000000000..a36a0746c056 --- /dev/null +++ b/Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2018 Linaro Ltd. +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/timer/intel-ixp4xx-timer.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Intel IXP4xx XScale Networking Processors Timers + +maintainers: + - Linus Walleij + +description: This timer is found in the Intel IXP4xx processors. + +properties: + compatible: + items: + - const: intel,ixp4xx-timer + + reg: + description: Should contain registers location and length + + interrupts: + minItems: 1 + maxItems: 2 + items: + - description: Timer 1 interrupt + - description: Timer 2 interrupt + +required: + - compatible + - reg + - interrupts + +examples: + - | + #include + timer@c8005000 { + compatible = "intel,ixp4xx-timer"; + reg = <0xc8005000 0x100>; + interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 79f01af59a63..bd04142b1026 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1651,6 +1651,7 @@ M: Krzysztof Halasa L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained F: Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml +F: Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml F: arch/arm/mach-ixp4xx/ F: drivers/clocksource/timer-ixp4xx.c F: drivers/gpio/gpio-ixp4xx.c From patchwork Thu Feb 21 15:44:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824239 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9EC915AC for ; Thu, 21 Feb 2019 15:47:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5234314D4 for ; Thu, 21 Feb 2019 15:47:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C95E8314DD; Thu, 21 Feb 2019 15:47:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D762314D4 for ; Thu, 21 Feb 2019 15:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TtpRPdXuDvwwwRRbc5A+Ths9syMH+KwVqf2rHAWj36g=; b=DPcDFnjFmJarx5 sPVJcI01fJjnARu0zUdcpDhV2+sDw26gbutLSK2s0gdZ3njXPd2pNYfm3jhNRSJ7sqhvXSbK8XqlY goI0hzhAvk3HzQLKuKoXtDxvKkQ+Y1oaOyWDvBKvyVuWaBrP9mznFF1GKllxoLyg377itLqT+TDg4 9MyC0dLFvlaRGjPz6u/TD9UwPTwbKXA49llYzouNYDSsWS3pRDM73MWIRKPKnx7iUL7+dut0cYoJn woHAEirCl6scqLjhrGeAMr465BA6FOcCNpUCB0PyUN+ySrVyGiNBRSJczZDpk+ELl+91pJkwRfjR3 EfOva3BVkNInUfZPIX1w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqZL-0007CI-AN; Thu, 21 Feb 2019 15:47:27 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXd-0005Iw-SL for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:02 +0000 Received: by mail-lj1-x241.google.com with SMTP id z20so23363756ljj.10 for ; Thu, 21 Feb 2019 07:45:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VLgcHbCjTjccbre7yEdTcWS8r6RWhpYMOJgFZ4el+Ss=; b=Dq2963PLtBnRq+Y38BnBc78nxzg5hN1V0t1yctrgQsU/m3Y6ozstQoKI4UZfOSpU8A +JLSrsa6pVQEX4bSta/9b0gaGANE6PuL4HXkhRQvGSPWoOcyrhe9bUgtaSwjmrMYU2Xy XKPWWo43/FogKmcC+gbzdAf14+Wp61jVGCx0+y6gQfWvqV9JtTDUsiEkVmIdlq39OIqy 2CuvY/UkoDdbgEmWkAwsgoZCfrHx02Rf+F/Ob5kbuNjMyhW2kVXPaDMbW5P4fLeD8Qj1 aEdDVbFBk/PFy3lr40M4YDnV32+ZOrp4udM4GCcFS0kseSry2rum5enItSlxDmhUiEad LBJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VLgcHbCjTjccbre7yEdTcWS8r6RWhpYMOJgFZ4el+Ss=; b=b5b3EX6lAdujnJMOXdJsLN3Ck6ZmY2KfXW9C4uTCX04yVJFTG/FfydqMtZb6mpBCLH pOgGrGPk2hK07vPXPJ2MdIz493YZP9rEO5aaudN2hW123L5BbPmg+F9VZ8GugvkD5mZl 2vyc9/c2G9qcBkfcpNF65R2Ywd8X0w1XgRf8zYBxW2BNKetUACBNTNd+ht5JfY1542N2 ee0OJ+IIjTVD679bzUtVH+ySg2O4fMmL3scjiO8GIrdqQNLTkv06hVCSuC325SKwM4vp ES29rH4ItnLxUnEQasfPxTUDgYQFAfhdmvZU3djYZ57REZGCCTbnuILxQsa+kKe92y+c Z1QA== X-Gm-Message-State: AHQUAubzH/y2YNNppMmWIe8jD1ccmQrgxKNS4P62hVvSyAOAPf5IaBVh v7+hcWR2VvWIwnPbUQja1onismhZUXI= X-Google-Smtp-Source: AHgI3IYNprr/5xN5hHehq1f1gbx8uqiiwaz1coLLa6H1YtMcTsjaCKe7Y8cdV4jygwIz+3GGhQkvCw== X-Received: by 2002:a2e:9c97:: with SMTP id x23mr1312649lji.13.1550763939759; Thu, 21 Feb 2019 07:45:39 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:38 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 12/30 v2] clocksource/drivers/ixp4xx: Add OF initialization support Date: Thu, 21 Feb 2019 16:44:40 +0100 Message-Id: <20190221154458.23763-13-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074542_389423_B7AB000E X-CRM114-Status: GOOD ( 14.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij , Daniel Lezcano , Thomas Gleixner Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds support for setting up the IXP4xx timer driver from device tree. Cc: Thomas Gleixner Acked-by: Daniel Lezcano Signed-off-by: Linus Walleij --- drivers/clocksource/timer-ixp4xx.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/clocksource/timer-ixp4xx.c b/drivers/clocksource/timer-ixp4xx.c index fa78f80792db..404445bc11ea 100644 --- a/drivers/clocksource/timer-ixp4xx.c +++ b/drivers/clocksource/timer-ixp4xx.c @@ -16,6 +16,8 @@ #include #include #include +#include +#include /* Goes away with OF conversion */ #include @@ -247,3 +249,36 @@ void __init ixp4xx_timer_setup(resource_size_t timerbase, ixp4xx_timer_register(base, timer_irq, timer_freq); } EXPORT_SYMBOL_GPL(ixp4xx_timer_setup); + +#ifdef CONFIG_OF +static __init int ixp4xx_of_timer_init(struct device_node *np) +{ + void __iomem *base; + int irq; + int ret; + + base = of_iomap(np, 0); + if (!base) { + pr_crit("IXP4xx: can't remap timer\n"); + return -ENODEV; + } + + irq = irq_of_parse_and_map(np, 0); + if (irq <= 0) { + pr_err("Can't parse IRQ\n"); + ret = -EINVAL; + goto out_unmap; + } + + /* TODO: get some fixed clocks into the device tree */ + ret = ixp4xx_timer_register(base, irq, 66666000); + if (ret) + goto out_unmap; + return 0; + +out_unmap: + iounmap(base); + return ret; +} +TIMER_OF_DECLARE(ixp4xx, "intel,ixp4xx-timer", ixp4xx_of_timer_init); +#endif From patchwork Thu Feb 21 15:44:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824247 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFDE46C2 for ; Thu, 21 Feb 2019 15:47:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC7DF313C7 for ; Thu, 21 Feb 2019 15:47:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0C92314EA; Thu, 21 Feb 2019 15:47:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 40F78313C7 for ; Thu, 21 Feb 2019 15:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kNOUHRKlLWmX86MDWawIJ4acY5hD0niMa7HIUfoiU0M=; b=YgNcyHueJ91rx3 CGil3O5boTA2jqVzRxpmU+XibJ3lOY6dJZ2aDFyK9wuBu7ng5X6702FUpHk0L1wnnb7YkUpF6Ivid nbeRsEdzgVCOHVrYftlYbY8m7hftjlDUkWvor72F6YzOto5l/rRnKxzfK6qQqWEBggdxuUA6/bz+i EYThKeB2pEmBDyhjTVRByiFUH2W2kW3jkrVx0GO3HaSnnsmCmO8NyJMSQmtzZFRd0zYT8e4HjUGlZ fCplopzS8JrW6QjY0sZ7eqkJf0NBHGDgg4l4l4lSySaxDU+h8+rPARLWXxfMZ11a705uLBc9Ig/GY 5e0Tgp3fIBDCCv0fPqlQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqZh-0007fz-N6; Thu, 21 Feb 2019 15:47:49 +0000 Received: from mail-lf1-f66.google.com ([209.85.167.66]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXg-0005Me-SQ for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:07 +0000 Received: by mail-lf1-f66.google.com with SMTP id z15so4428533lff.4 for ; Thu, 21 Feb 2019 07:45:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aeX9DWMdIFwcCgwi5VRHCh7QUyGrTDz0LIVexfDO4ns=; b=XYnabqTjwlcFuRqpn1M7sOJ7WljjxZ5KskCNH9dePB+MUgaOmEb98LhAj99/0QL+S2 5IWtF6IzRmgXj4MWGBvxhE2+Uj0O4ErDOgAskSv00NppLWEqMwHXrWUZ2S5RN7evnqzv 08cv76XGysCdG+0ynYindZFE7VKg4/NrF0v6lNlKBXqzNNS5M+WhSJv2Z7xMDXThcjJv AaDirCR4pWgIKJrDphX6dVRxyR9M1m5k4dP65kONEAm3uzoJ6HvK/XPlKko6jz28Tgnd VnvZHwN4MU27DxpvjAx8G+UTQaveYJ/G5AsyN6dO+x/YKf6aycntJZUHCuBG1dm2Zz3e ak4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aeX9DWMdIFwcCgwi5VRHCh7QUyGrTDz0LIVexfDO4ns=; b=MIraI87uID8Vk9UqJqI8PicQOdR8dvCcIJmdby2Etpe081bhaFj6ZEG1Rw6yeDBgja 5eMmpwJql+VrevqiiYWAqzt54GeBuVeRuQ1qcRK6p0FOy9AvCM8ejBTXnA8Ht9ZBcZG6 CifhB8Y8NUxh3xk4XHXj5V68C8rSQBhvriYgLzj5rCzzqxaoOZZYfyuIpipi1yn6BXMl quMyniXOu+99Tw6aGXn6UgyVMzwqtsZWFlunrEyPkqWKEgznIrpEiNLPaplU4/xEYEHK /0ZsU5lIsB6QYSQwHyKBsucUfLCS2eJ6qJayylXC3e2xY8M0uwdBgnAL9mJJ0wYM6Tq5 yFYA== X-Gm-Message-State: AHQUAuZMQPVLTDQzJt0+hAvvMfQKNKlGSGuKmWEEHucnVzxQt8tOpHgZ G3yDT820MIzMZEf1cd/Mb4m0Mrj50dE= X-Google-Smtp-Source: AHgI3IahL2XAYHRi70eDjSQLT20MNWwqltlhq3pvb5n06LR76ySF8ttXZat/T2kAxdiWjA5tJCoTjA== X-Received: by 2002:ac2:424e:: with SMTP id m14mr19569935lfl.4.1550763942246; Thu, 21 Feb 2019 07:45:42 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:41 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 13/30 v2] gpio: ixp4xx: Add DT bindings Date: Thu, 21 Feb 2019 16:44:41 +0100 Message-Id: <20190221154458.23763-14-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074545_406312_A76579A7 X-CRM114-Status: GOOD ( 14.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Linus Walleij , Rob Herring , Bartosz Golaszewski Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds DT bindings for the IXP4xx GPIO controller. Cc: devicetree@vger.kernel.org Reviewed-by: Bartosz Golaszewski Reviewed-by: Rob Herring Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Collect Bartosz and Rob's review tags. --- .../bindings/gpio/intel,ixp4xx-gpio.txt | 38 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt diff --git a/Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt b/Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt new file mode 100644 index 000000000000..8dc41ed99685 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt @@ -0,0 +1,38 @@ +Intel IXP4xx XScale Networking Processors GPIO + +This GPIO controller is found in the Intel IXP4xx processors. +It supports 16 GPIO lines. + +The interrupt portions of the GPIO controller is hierarchical: +the synchronous edge detector is part of the GPIO block, but the +actual enabling/disabling of the interrupt line is done in the +main IXP4xx interrupt controller which has a 1:1 mapping for +the first 12 GPIO lines to 12 system interrupts. + +The remaining 4 GPIO lines can not be used for receiving +interrupts. + +The interrupt parent of this GPIO controller must be the +IXP4xx interrupt controller. + +Required properties: + +- compatible : Should be + "intel,ixp4xx-gpio" +- reg : Should contain registers location and length +- gpio-controller : marks this as a GPIO controller +- #gpio-cells : Should be 2, see gpio/gpio.txt +- interrupt-controller : marks this as an interrupt controller +- #interrupt-cells : a standard two-cell interrupt, see + interrupt-controller/interrupts.txt + +Example: + +gpio0: gpio@c8004000 { + compatible = "intel,ixp4xx-gpio"; + reg = <0xc8004000 0x1000>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; +}; diff --git a/MAINTAINERS b/MAINTAINERS index bd04142b1026..b44ee076d57c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1650,6 +1650,7 @@ M: Imre Kaloz M: Krzysztof Halasa L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt F: Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml F: Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml F: arch/arm/mach-ixp4xx/ From patchwork Thu Feb 21 15:44:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 76E2915AC for ; Thu, 21 Feb 2019 15:48:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 636A8313C7 for ; Thu, 21 Feb 2019 15:48:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57705314EA; Thu, 21 Feb 2019 15:48:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3818313C7 for ; Thu, 21 Feb 2019 15:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ByXrciwL3JBI30s2iFGj6oarpBCLvORYvGZVkodZK5s=; b=TCf+vlG1eluhIv LxR6Gj6QH7vwhCX1xv9pwshtYocpHGdceIYkywnis27FLO6O4mni8t4SoIQ2ppt8BUDOvFJ0ktvhq 3uFwLd+Uf7eldW+APnSM9Ls/m9X6WwLUokw7dW3MGhIQIp9x9lOv+Q6pnqNSEuS+ne86NAjlV/Jtq EkAhoF+RAzWSA/awvYWJAB6jR/YiIQJrEvO/c7r+wt5WGZGLHZXgprRf37gj8l1H8s7IgBMkhQCVC avpXNO17tHDcGZumD4+fUXbCZ9YhvVJXYtPTy9FhQluVeHFTD76jfQUqGIhu6d4Y6766zkLDjU9oh sokWGfC2fPH/+cjvolmA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqZt-0007uF-6Z; Thu, 21 Feb 2019 15:48:01 +0000 Received: from mail-lf1-f68.google.com ([209.85.167.68]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXk-0005RO-7k for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:13 +0000 Received: by mail-lf1-f68.google.com with SMTP id j1so20698717lfb.10 for ; Thu, 21 Feb 2019 07:45:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n4i2gWkuhmO+iyl/cag9RpDLmpTF1yZZjxQj5VMEKeQ=; b=OFbOJfO5tfQmA0j0aql1xKvXpa89C8q8fKNzngPegkX619gQV9S4oW9newm2fIcyB7 hvjet+vJCPCCJKj3f0fnEqJvNlaEhas2pZPK9IYXglRyP5iMb+kxcdqHz90mgiBHEJNW OeCCCcCJROb9Jr4cke56Lf7wU2vOSNQFH2kQjDvQm/tOclW2bwb3IMR23oIARt4WxZbg OV/1/706G0XXLGYiAoptB8IPoogHDciecsW7EKKUlz5a1NzXCmrB9bcceOBqPD2MlXoQ uqwWe7uioBv7IU5YXG/SnYUYfLMdwf7xTbHiMoWxel3ajpR4QqmK376EZOXuQFziCqjG OZSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n4i2gWkuhmO+iyl/cag9RpDLmpTF1yZZjxQj5VMEKeQ=; b=rK0V8ZocVNR7ovuXrroS5EpRyYacXGFeOyxJo45kvElVS+QJ6aIKVocpJvdvwTZpAI cPWGg9P9yoZMxVFG/6x5chC/ItxovqrjQv0DykwsRnib4yCS20p4EW/U/AYZIs6JwuIH LWJjOKGTSjvH8rE+S0278ywMohEYFyBlIun6IuvbFvLVOjkSVw0uwq7ZttVzkeLGK3cy Na7G0G23sT/ci90mWMEtaDjRGnVOcGeriu9kB8JRiesZrmX8S4YzgNv6NHnVqEQJI9QS e663lxhRlCiyIE6eCO4ZPr5fctScSRI7aw3fO5/9UyFIAvgh7Ug1UpRjKmGBvKFTPbIW WSdg== X-Gm-Message-State: AHQUAubYh0hbKo5DwOCLqnIdWIa2kyO86sbT2eQujcgSPj+z854WmERs 0XK3bWJerlTYyO9zNGl4jigNfoYz1z4= X-Google-Smtp-Source: AHgI3IbNFHAAh1c1rq2gsHHl/N/SCJtuQoUpecgoFUGCY8AMjZhVKN/DbLWyYUam6Y+ffn6yl06SSA== X-Received: by 2002:a19:4f57:: with SMTP id a23mr25331334lfk.46.1550763945094; Thu, 21 Feb 2019 07:45:45 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:44 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 14/30 v2] gpio: ixp4xx: Add OF probing support Date: Thu, 21 Feb 2019 16:44:42 +0100 Message-Id: <20190221154458.23763-15-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074548_839759_88FFF7CE X-CRM114-Status: GOOD ( 19.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds device tree probe and registration support for the IXP4xx GPIO driver. Cc: Bartosz Golaszewski Signed-off-by: Linus Walleij --- Bartosz: looking for your ACK on this, it'd be good if the other GPIO maintainer is aligned with my ideas here. I intend to merge this through the ARM SoC tree. --- drivers/gpio/gpio-ixp4xx.c | 84 ++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 27 deletions(-) diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c index eaf317f73f75..4b1cf7ea858d 100644 --- a/drivers/gpio/gpio-ixp4xx.c +++ b/drivers/gpio/gpio-ixp4xx.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include /* Include that go away with DT transition */ @@ -306,6 +307,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev) { unsigned long flags; struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; struct irq_domain *parent; struct resource *res; struct ixp4xx_gpio *g; @@ -382,11 +384,27 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev) * from IRQCHIP_DECLARE(), then use of_node_to_fwnode() to get * the fwnode. For now we need this boardfile style code. */ - parent = ixp4xx_get_irq_domain(); - g->fwnode = irq_domain_alloc_fwnode(g->base); - if (!g->fwnode) { - dev_err(dev, "no domain base\n"); - return -ENODEV; + if (np) { + struct device_node *irq_parent; + + irq_parent = of_irq_find_parent(np); + if (!irq_parent) { + dev_err(dev, "no IRQ parent node\n"); + return -ENODEV; + } + parent = irq_find_host(irq_parent); + if (!parent) { + dev_err(dev, "no IRQ parent domain\n"); + return -ENODEV; + } + g->fwnode = of_node_to_fwnode(np); + } else { + parent = ixp4xx_get_irq_domain(); + g->fwnode = irq_domain_alloc_fwnode(g->base); + if (!g->fwnode) { + dev_err(dev, "no domain base\n"); + return -ENODEV; + } } g->domain = irq_domain_create_hierarchy(parent, IRQ_DOMAIN_FLAG_HIERARCHY, @@ -404,28 +422,31 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev) * After adding OF support, this is no longer needed: irqs * will be allocated for the respective fwnodes. */ - for (i = 0; i < ARRAY_SIZE(ixp4xx_gpiomap); i++) { - const struct ixp4xx_gpio_map *map = &ixp4xx_gpiomap[i]; - struct irq_fwspec fwspec; - - fwspec.fwnode = g->fwnode; - /* This is the hwirq for the GPIO line side of things */ - fwspec.param[0] = map->gpio_offset; - fwspec.param[1] = IRQ_TYPE_EDGE_RISING; - fwspec.param_count = 2; - ret = __irq_domain_alloc_irqs(g->domain, - -1, /* just pick something */ - 1, - NUMA_NO_NODE, - &fwspec, - false, - NULL); - if (ret < 0) { - irq_domain_free_fwnode(g->fwnode); - dev_err(dev, - "can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n", - map->gpio_offset, map->parent_hwirq, ret); - return ret; + if (!np) { + for (i = 0; i < ARRAY_SIZE(ixp4xx_gpiomap); i++) { + const struct ixp4xx_gpio_map *map = &ixp4xx_gpiomap[i]; + struct irq_fwspec fwspec; + + fwspec.fwnode = g->fwnode; + /* This is the hwirq for the GPIO line side of things */ + fwspec.param[0] = map->gpio_offset; + fwspec.param[1] = IRQ_TYPE_EDGE_RISING; + fwspec.param_count = 2; + ret = __irq_domain_alloc_irqs(g->domain, + -1, /* just pick something */ + 1, + NUMA_NO_NODE, + &fwspec, + false, + NULL); + if (ret < 0) { + irq_domain_free_fwnode(g->fwnode); + dev_err(dev, + "can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n", + map->gpio_offset, map->parent_hwirq, + ret); + return ret; + } } } @@ -435,9 +456,18 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev) return 0; } +static const struct of_device_id ixp4xx_gpio_of_match[] = { + { + .compatible = "intel,ixp4xx-gpio", + }, + {}, +}; + + static struct platform_driver ixp4xx_gpio_driver = { .driver = { .name = "ixp4xx-gpio", + .of_match_table = of_match_ptr(ixp4xx_gpio_of_match), }, .probe = ixp4xx_gpio_probe, }; From patchwork Thu Feb 21 15:44:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5F941390 for ; Thu, 21 Feb 2019 16:03:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B229130BE7 for ; Thu, 21 Feb 2019 16:03:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6C7231818; Thu, 21 Feb 2019 16:03:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 03B1230BE7 for ; Thu, 21 Feb 2019 16:03:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+GUJeE5F7a3qopqfo9CorhbSZA5g4GYZ+1h5UGUKX+4=; b=U8EmroSNBY2UUD bJms/PMbTLXwbD6pjkkcxOzqGOZhiEf4Y4RwBpAUr/OLH7KaAG++/+49KMWMipJtJUSMcMLtMVnJi xM/xYmAtc6W3cGbgke+/TEG1RAdyzu5w+Zzw/n4FoRoi6Op2eTIMZjDfjN4QbhVqDmfM53GbIA+CJ rlLUB0tfMn7RuuJDTzHrP4ZUh1cDPHT+K66oAc3qXOX+SSvbyn7CnGGULjm8QvHIzwAYCqpzR8X+q m8RjEP6qIDFY7Dv4AsgKNaksDxhJiQ7YtCC59TaZvZCOpG7NZSC3K2oAd4ArIK0Bd+vffb2UQls14 nlmJLkiu0148/nYZaeNw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqog-0001rh-Tj; Thu, 21 Feb 2019 16:03:18 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqns-0000bs-Mj for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 16:02:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GnaI9YHPXZ63mtHWRidjn+9xBecr9vZlVNuaRUYughg=; b=syG1G6tdU+hfWIzC/QbQsclPzV mI0dAZPHsbgKiFmkakzV8RqZklq26aRO0mnYsYP1ggOXTxRp1UtGaZCT8k/FCKvXPXmCGCGiMZbgB WP1gF6IR2CfknJRosY1TGgi19JZNXhyEX3+50TJftSvvxITVYWZFRR0sfBu0OCJbyHqpNGQvV/SFD X2mzSJZ2XjfKtpEqsf/Ze7tySmUB1yaZBqNMGQd5m/M8TOZdq0jAWOd+c2Z3FsXBBcr77px3gjvzs XcskP1sKTguyXo2j58/5V7IJIpM6Qb7Hgd+XlHSGaL37nADLLgkq8NCRBz/Iw6yviCiupQsm5iREh 4GDlUV3g==; Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXm-0006oq-1Z for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:52 +0000 Received: by mail-lj1-x243.google.com with SMTP id j19so23605393ljg.5 for ; Thu, 21 Feb 2019 07:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GnaI9YHPXZ63mtHWRidjn+9xBecr9vZlVNuaRUYughg=; b=TdGQDh7C1vZdMooN9Tpo0mwTTuochx0oxAyQf7GtDI/6Y2987Yh3H6WyNZR458IP21 QlDcAmsqaiX2BGm+rYMg+HnnJthQ+MTnTnI/EHADC4d8wxUYBWPfH9TaJhPcYSnKhUrO n+xJI8kTzwn7m3J/tbCKU7b4fVB/yzFu09gGPYRyjc9KPJsRQhBhn3PqZrJ2fDu8p07s Wrs47VkrjyvI/AXhCumDKsMkV7GThWBIlKW5fwnjidvPG9ca0F4bKeeMrS+zqyzpQ/DF NLwvM0lj+10eNigUemvtQKrHUR7cAl9r82U7BZvK+oVD7+8l1Fl2hFFYURohyH5TqT7/ SX+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GnaI9YHPXZ63mtHWRidjn+9xBecr9vZlVNuaRUYughg=; b=nwMx6o+LOdYEfF/HuyPyKjbw2SbTr1fq3qHthFGBux+i15+J7Wyc/nr6WPKTapPDtS WNosz2Y31BHDpjxmSIOtVLwQwJNb+Ze7MBe9RKpmK1+SrqTswozKWjE1GopX2tVOJ242 h/piZYMgguuzTTtxn6c11RPSYfkCSqluST/BMXa2f6uS9XKc5oFuep3Ke19htvYEbnXM yf/DqqiH0DeHFBil8O6496VxcBtO6YmwMOyHzRceWrzSUK1U9bbptaEATRxuLA+VsGl6 B/R0/9/bwTGWuhwLHtAXMsmKOH1Z+vGqokNMChL4nXGVUHe9PgQrv2C6mmKxriiYQMj3 EmVw== X-Gm-Message-State: AHQUAua+gK5C5fzF9QkmR6Y01EE952axdBbbHoINC4BlTfCOdzHeZKrJ oBc6M1Fj0d01kfvmpJaDXNCjIbmT968= X-Google-Smtp-Source: AHgI3Ib3d7Jg+bEoLFuLEidja+13ExMzY8HvtkBT7uG0JnElTxg+aLhcTKYKRQbWT/9E8WZ9lHFeiw== X-Received: by 2002:a2e:4285:: with SMTP id h5mr21972562ljf.32.1550763947317; Thu, 21 Feb 2019 07:45:47 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:46 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 15/30 v2] ARM: ixp4xx: Add DT bindings Date: Thu, 21 Feb 2019 16:44:43 +0100 Message-Id: <20190221154458.23763-16-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_154550_139040_86835CEC X-CRM114-Status: GOOD ( 16.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Linus Walleij , Rob Herring Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds initial device tree bindings for the IXP4xx machines. This time I tried something wild and crazy and try to make proper JSON-style YAML bindings for the top level. Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Fix up the GW2358 compatible string. --- .../devicetree/bindings/arm/intel-ixp4xx.yaml | 22 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 23 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml diff --git a/Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml b/Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml new file mode 100644 index 000000000000..f4f7451e5e8a --- /dev/null +++ b/Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/arm/intel-ixp4xx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel IXP4xx Device Tree Bindings + +maintainers: + - Linus Walleij + +properties: + compatible: + oneOf: + - items: + - enum: + - linksys,nslu2 + - const: intel,ixp42x + - items: + - enum: + - gateworks,gw2358 + - const: intel,ixp43x diff --git a/MAINTAINERS b/MAINTAINERS index b44ee076d57c..20d02e1e60a8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1650,6 +1650,7 @@ M: Imre Kaloz M: Krzysztof Halasa L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml F: Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt F: Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml F: Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml From patchwork Thu Feb 21 15:44:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D8D615AC for ; Thu, 21 Feb 2019 15:48:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A6AE314EA for ; Thu, 21 Feb 2019 15:48:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EDDB314EC; Thu, 21 Feb 2019 15:48:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6662B314EA for ; Thu, 21 Feb 2019 15:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FtQzo+8KxFGcbYWvprNfB6D9gS34pd9MmdEZSYFIjvQ=; b=JJuSj4pQ0vU0/Z KVIBOzGZklL+CKDyU3WahccMw1Fh8tfVCQkwTx4MXRVfVAe4pTB9p6OgUp43xdy9rX047KaAX0rjF kSuL8fsKpnBKmCRfV/5CstxW+SVbQBPn63C5lJnRbSfYp/sQ3Y5A+iNILXSzXid8QJ7p2Cvg/4owq xCynxUUMOcdEN/s6wuIxL7zHWuX/EsRZDK3kEe++bFvr8FyRJkqxOb7TV3tJexGicwHnn0/yl/kEZ +6vIl9k54ZVq1IG+f390yu+zN4lqB4emXJQi1TBOOJT4CbK7qkibkOsEwlsbmAqaGbwbvNhqirPhK D1jekyEBrfOb1HWT4aPg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqa4-00089C-E8; Thu, 21 Feb 2019 15:48:12 +0000 Received: from mail-lj1-f195.google.com ([209.85.208.195]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXo-0005Xn-EB for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:18 +0000 Received: by mail-lj1-f195.google.com with SMTP id j19so23605500ljg.5 for ; Thu, 21 Feb 2019 07:45:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t461vk7LadHLkgQ8qPP8Op2blKaDYcS4Yfr9x5uG6KY=; b=GAGkl1aMOScq2DuEcGSEkQ+8Kircrmkucg/OqKXEWz0r+TZupvEMg/xT1r3HvUq2aa wJ9c3b+1WIzp9mtbgNbKuuWlAqgGyllewA54i65E9tH0jWTsiNs3MNIfzimHpdUEYCth CJLHTBQ4BQxNhjdv4oPMr7CL/V7AmJdSgKnEYDJdKWIyMCgEMD6v5JaxC7/l6WdfZHEP uaBEQJEj5To2GPKwLmNmhb4YIrrolWrzb+03ADiTLHhatra49v0G0nre5ZzmSyK0ePZH p8qbhjY+qiVfNKm2uRkZkJ1SU+85mfFQF2SqD3rJZUxB+L7nQAqFylXxrjtrqA20umwZ PL+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t461vk7LadHLkgQ8qPP8Op2blKaDYcS4Yfr9x5uG6KY=; b=trPblBNpoS4LFuAKVFWsP5OJFicV/IEjzMY5XL542jKIEdjEwCBIGyoI0OsYxmhhXa ieqESGPgNEUDC2U54w5gffz3vIEet868huPNnw7TOvuO4drI/OWWnBxhhXMzIUFHYscX 40HRQnU6sQiRVWOUcM4i7ALPGNuggVJkVyQnw0nQDx5Kw3m00LW4Il/dD2T8i+Vb/oiM oDjYgmQP2jzG/OiHNMsqmDvsTVnp9RSC517fe/Rcwxs11EFEZJP2R26/7beOreTTO9BH TwQg/Y3UcvYoJTfVqiSqMXyH4e2nlLCxQZcCFVb9OZSyGnCevsSsuhzM1p2Cv6Z3jRgB Q3Eg== X-Gm-Message-State: AHQUAuYZe7dZX3lKBOESKSmjmmvXZRUg1aMZNc45JdD6O0PBKy8vblAm /jEW5NWbSX8vCCsoPzB6WzoVNVQ1Ces= X-Google-Smtp-Source: AHgI3IbjEze7UwScQx1ENdeOPu0eMQhu16yHr4kkZ7ebaFwyLI7s1AzsjqG8bxgiqKKR2PrFARCzoQ== X-Received: by 2002:a2e:850a:: with SMTP id j10mr20839401lji.102.1550763949656; Thu, 21 Feb 2019 07:45:49 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:48 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 16/30 v2] ARM: ixp4xx: Add device tree boot support Date: Thu, 21 Feb 2019 16:44:44 +0100 Message-Id: <20190221154458.23763-17-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074552_979802_2A9D26E0 X-CRM114-Status: GOOD ( 22.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a minimal support for booting IXP4xx systems from device tree. We have to add hacks to the QMGR, NPE and notably also ethernet and watchdog drivers so that they don't crash the platform: these drivers are unconditionally starting to grab regions of statically remapped IO space with no concern of the device model or other platforms. We will go in and properly fix these drivers as we go along but for now this hack gets us to a place where we can start working on proper device tree support for these platforms. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Remap the external bus registers since the feature checks for different hardware using ixp4xx_read_feature_bits() to determine the system configuration needs this static map. We can eventually move this to syscon but only if we first move all boards to device tree. --- arch/arm/mach-ixp4xx/Kconfig | 14 ++++++ arch/arm/mach-ixp4xx/Makefile | 3 ++ arch/arm/mach-ixp4xx/ixp4xx-of.c | 60 ++++++++++++++++++++++++ arch/arm/mach-ixp4xx/ixp4xx_npe.c | 5 ++ arch/arm/mach-ixp4xx/ixp4xx_qmgr.c | 5 ++ drivers/net/ethernet/xscale/ixp4xx_eth.c | 10 ++++ drivers/watchdog/ixp4xx_wdt.c | 9 ++++ 7 files changed, 106 insertions(+) create mode 100644 arch/arm/mach-ixp4xx/ixp4xx-of.c diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig index fea008123eb1..0973270f4863 100644 --- a/arch/arm/mach-ixp4xx/Kconfig +++ b/arch/arm/mach-ixp4xx/Kconfig @@ -4,6 +4,20 @@ menu "Intel IXP4xx Implementation Options" comment "IXP4xx Platforms" +config MACH_IXP4XX_OF + bool + prompt "Devce Tree IXP4xx boards" + default y + select ARM_APPENDED_DTB # Old Redboot bootloaders deployed + select I2C + select I2C_IOP3XX + select PCI + select SERIAL_OF_PLATFORM + select TIMER_OF + select USE_OF + help + Say 'Y' here to support Device Tree-based IXP4xx platforms. + config MACH_NSLU2 bool prompt "Linksys NSLU2" diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile index f09994500a34..5f63b3012826 100644 --- a/arch/arm/mach-ixp4xx/Makefile +++ b/arch/arm/mach-ixp4xx/Makefile @@ -6,6 +6,9 @@ obj-pci-y := obj-pci-n := +# Device tree platform +obj-pci-$(CONFIG_MACH_IXP4XX_OF) += ixp4xx-of.o + obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o obj-pci-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o diff --git a/arch/arm/mach-ixp4xx/ixp4xx-of.c b/arch/arm/mach-ixp4xx/ixp4xx-of.c new file mode 100644 index 000000000000..7449b8319c8a --- /dev/null +++ b/arch/arm/mach-ixp4xx/ixp4xx-of.c @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * IXP4xx Device Tree boot support + */ +#include +#include +#include + +#include +#include + +#include +#include + +static struct map_desc ixp4xx_of_io_desc[] __initdata = { + /* + * This is needed for runtime system configuration checks, + * such as reading if hardware so-and-so is present. This + * could eventually be converted into a syscon once all boards + * are converted to device tree. + */ + { + .virtual = IXP4XX_EXP_CFG_BASE_VIRT, + .pfn = __phys_to_pfn(IXP4XX_EXP_CFG_BASE_PHYS), + .length = SZ_4K, + .type = MT_DEVICE, + }, +#ifdef CONFIG_DEBUG_UART_8250 + /* This is needed for LL-debug/earlyprintk/debug-macro.S */ + { + .virtual = CONFIG_DEBUG_UART_VIRT, + .pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS), + .length = SZ_4K, + .type = MT_DEVICE, + }, +#endif +}; + +static void __init ixp4xx_of_map_io(void) +{ + iotable_init(ixp4xx_of_io_desc, ARRAY_SIZE(ixp4xx_of_io_desc)); +} + +/* + * We handle 4 differen SoC families. These compatible strings are enough + * to provide the core so that different boards can add their more detailed + * specifics. + */ +static const char *ixp4xx_of_board_compat[] = { + "intel,ixp42x", + "intel,ixp43x", + "intel,ixp45x", + "intel,ixp46x", + NULL, +}; + +DT_MACHINE_START(IXP4XX_DT, "IXP4xx (Device Tree)") + .map_io = ixp4xx_of_map_io, + .dt_compat = ixp4xx_of_board_compat, +MACHINE_END diff --git a/arch/arm/mach-ixp4xx/ixp4xx_npe.c b/arch/arm/mach-ixp4xx/ixp4xx_npe.c index d4eb09a62863..e0ce22cd9bfc 100644 --- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c +++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #define DEBUG_MSG 0 @@ -688,6 +689,10 @@ static int __init npe_init_module(void) int i, found = 0; + /* This driver does not work with device tree */ + if (of_have_populated_dt()) + return -ENODEV; + for (i = 0; i < NPE_COUNT; i++) { struct npe *npe = &npe_tab[i]; if (!(ixp4xx_read_feature_bits() & diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c index 4c7c960e1b4c..2665347a2c6f 100644 --- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c +++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "irqs.h" @@ -289,6 +290,10 @@ static int qmgr_init(void) int i, err; irq_handler_t handler1, handler2; + /* This driver does not work with device tree */ + if (of_have_populated_dt()) + return -ENODEV; + mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE, "IXP4xx Queue Manager"); diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index aee55c03def0..7ad3c3b56a77 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -1497,6 +1498,15 @@ static struct platform_driver ixp4xx_eth_driver = { static int __init eth_init_module(void) { int err; + + /* + * FIXME: we bail out on device tree boot but this really needs + * to be fixed in a nicer way: this registers the MDIO bus before + * even matching the driver infrastructure, we should only probe + * detected hardware. + */ + if (of_have_populated_dt()) + return -ENODEV; if ((err = ixp4xx_mdio_register())) return err; return platform_driver_register(&ixp4xx_eth_driver); diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c index f20cc53ff719..a80449bb36f0 100644 --- a/drivers/watchdog/ixp4xx_wdt.c +++ b/drivers/watchdog/ixp4xx_wdt.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -176,6 +177,14 @@ static int __init ixp4xx_wdt_init(void) { int ret; + /* + * FIXME: we bail out on device tree boot but this really needs + * to be fixed in a nicer way: this registers the MDIO bus before + * even matching the driver infrastructure, we should only probe + * detected hardware. + */ + if (of_have_populated_dt()) + return -ENODEV; if (!(read_cpuid_id() & 0xf) && !cpu_is_ixp46x()) { pr_err("Rev. A0 IXP42x CPU detected - watchdog disabled\n"); From patchwork Thu Feb 21 15:44:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8D501390 for ; Thu, 21 Feb 2019 16:11:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9096B31841 for ; Thu, 21 Feb 2019 16:11:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E8F231940; Thu, 21 Feb 2019 16:11:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A673D31841 for ; Thu, 21 Feb 2019 16:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u3gHSrAFkEsGRa6PeEVON4pDkeO98I+7f23JbjFnYxw=; b=igXHjBt7B/ES6+ NmfwfvT87oQ7Pzzhf+SOs8NkoNYFgueTuIoMA6lVD9fcgxNYVfYOhAjnb3nHSFaVa8HXRCsaEZdDz enxZ3QABg9WU7sEwbQB4WOHNLSm70Nr3qIJadNeEsSUwkuF4tQ+SVpqi0ZyFczyHx10oHAoumQpR3 MHLdAli7ogYq+us2WqiEpEZlbr1Wb7rfWjCYPE7Nv1DdiZDP9rfUM/5svX7QHcSUdM1xVKuGAC3x6 tnkeF1Uln++SvKV/bL+23Z5iFl0pGLQv+UDET5YEhJkTIgJ6HUWYfQsUGxf8mSgrDpP2KPgQlaY8L 2bkyke3Ki7WQ+mUtWpkw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqwR-0006Fn-FS; Thu, 21 Feb 2019 16:11:19 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqvw-0005aI-Jm for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 16:10:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DEVUqBwVCFIU2rmrXGXJl74fxTiZmB8+4DOBl79E02I=; b=Cm2Bmwgz7I8IuaQEBiN7081e2f 0SvwWaBiJltF4Q6s91scEyX1LCsjJ9box1p+wqM7pv6l1SpzuFUf52io7D/1UoZ1ZhhIhxlQA70T0 KRVGxmAD0UY1fDv+yktkBddENDYvYkQqUS/eMv4sebSZe5A5dAWgH3tz8YEstvmlUjmjLiEVzK/ov +UsuynlDYU9FATiiE1Z+fB3p5gAtnIfRAlTTZ7eun8q3+aFet+87dsX9xqAKKA3ssuc0FCBm0TPyb jyXZF6ppzOPefcph5kxLMC41vULpLB+NuZlw30l76FaAciS2AHKbspfZEiJe3trxfTnp9ExfY6Za2 10m6AEZA==; Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXu-00029w-03 for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:45:59 +0000 Received: by mail-lf1-x142.google.com with SMTP id t14so20706426lfk.7 for ; Thu, 21 Feb 2019 07:45:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DEVUqBwVCFIU2rmrXGXJl74fxTiZmB8+4DOBl79E02I=; b=CkdfS4vB9lHH9XxEa+kiV85Z8kuWktLOkMPAui9Vsnul/mXLGpQX9+VgUu3ZZ3Mwm6 NNoOk5HGFqbCVfFNjGARM4uo9SEATzfZ6iQXt4CSGzhJGkj4rdObISE40e6kOkePaWnc 9i2pucPzc5T8WFe7bxW76DFRc3QbFOBfitMwLnU7FOVdoIPnMze6/6MWilSBvEtQovjM OJBlmJo8k/WNJnFd45kcc1Fi66Pe7nCG7wJ8zTeiVLYJ254hOPr2hl1J2xhmGxD+Des+ 4GfqCBx2nVbhzfWIwbtZQdDErt6e2Z69kPCw0JVC3D5SpzpEqiyar/zH4Ayml6Xs1Itv 8fZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DEVUqBwVCFIU2rmrXGXJl74fxTiZmB8+4DOBl79E02I=; b=ouIUOJQb6+4hsolvchxmH7mF2565tEU9/8BM48Op/DhTWCF1egbiQvMlcIlubAcigi s+tkGui+BA+7VxIFFNkissIgYeAfZWQiDHx5hbhXDavLa22CRvVuJ3l3QR3xmP9RfTd2 rYIAI6CLpSUydSWiTM4jdradpLsNm+aJaM8gyY1s7y6fcRRX0Le0JX4DxBW4sVaAO8RE gclV7rZ1/uD2BKp1XAlnqZCSqh2sQuK9VIKTDtBSJIjd86ETs44lDlqpQqS/ywei0jwQ njI8Q1+upBM5LKKLFVlS7flre617By/usK+npIHZS/SMIfibEVA3HQfLgoZO3SfKln0j MikQ== X-Gm-Message-State: AHQUAuZJAYjcB/7f3ARiyeBb+7AkCrD/LQsSR1uVNhbn5yxDN3I0JXY0 vX1180TngYNpt6D3Kl/13aulTVP64cE= X-Google-Smtp-Source: AHgI3IZ+XaSSEuOR5VGi2RN2ewneoCzLU0D7neX+7fbTKwe+TPqA0FaRynf6fi4qKmeNSf1OO610FQ== X-Received: by 2002:ac2:518e:: with SMTP id u14mr23207965lfi.76.1550763951736; Thu, 21 Feb 2019 07:45:51 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:50 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 17/30 v2] ARM: dts: Add some initial IXP4xx device trees Date: Thu, 21 Feb 2019 16:44:45 +0100 Message-Id: <20190221154458.23763-18-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_104558_435558_96F7FB04 X-CRM114-Status: GOOD ( 23.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a device tree for the IXP4xx-based Linksys NSLU2 and Gateworks GW2358 which encompass the Gateworks Cambria family. These will be the first IXP4xx device tree platforms. Signed-off-by: Linus Walleij --- ChangeLog RFC->v2: - Take out of RFC - Use ISC license on the files, *BSD likes this license --- arch/arm/boot/dts/Makefile | 3 + .../boot/dts/intel-ixp42x-linksys-nslu2.dts | 109 ++++++++++++++++++ arch/arm/boot/dts/intel-ixp42x.dtsi | 25 ++++ .../dts/intel-ixp43x-gateworks-gw2358.dts | 94 +++++++++++++++ arch/arm/boot/dts/intel-ixp43x.dtsi | 15 +++ arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi | 34 ++++++ arch/arm/boot/dts/intel-ixp4xx.dtsi | 58 ++++++++++ 7 files changed, 338 insertions(+) create mode 100644 arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts create mode 100644 arch/arm/boot/dts/intel-ixp42x.dtsi create mode 100644 arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts create mode 100644 arch/arm/boot/dts/intel-ixp43x.dtsi create mode 100644 arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi create mode 100644 arch/arm/boot/dts/intel-ixp4xx.dtsi diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index bd40148a15b2..272d39317a1b 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -227,6 +227,9 @@ dtb-$(CONFIG_ARCH_HIX5HD2) += \ dtb-$(CONFIG_ARCH_INTEGRATOR) += \ integratorap.dtb \ integratorcp.dtb +dtb-$(CONFIG_ARCH_IXP4XX) += \ + intel-ixp42x-linksys-nslu2.dtb \ + intel-ixp43x-gateworks-gw2358.dtb dtb-$(CONFIG_ARCH_KEYSTONE) += \ keystone-k2hk-evm.dtb \ keystone-k2l-evm.dtb \ diff --git a/arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts b/arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts new file mode 100644 index 000000000000..8fcd95805ff4 --- /dev/null +++ b/arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: ISC +/* + * Device Tree file for Linksys NSLU2 + */ + +/dts-v1/; + +#include "intel-ixp42x.dtsi" +#include + +/ { + model = "Linksys NSLU2 (Network Storage Link for USB 2.0 Disk Drives)"; + compatible = "linksys,nslu2", "intel,ixp42x"; + #address-cells = <1>; + #size-cells = <1>; + + memory@0 { + /* 32 MB SDRAM */ + device_type = "memory"; + reg = <0x00000000 0x2000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200n8 root=/dev/mtdblock2 rw rootfstype=squashfs,jffs2 rootwait"; + stdout-path = "uart0:115200n8"; + }; + + aliases { + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; + led-status { + label = "nslu2:red:status"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; + linux,default-trigger = "heartbeat"; + }; + led-ready { + label = "nslu2:green:ready"; + gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + led-disk-1 { + label = "nslu2:green:disk-1"; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + led-disk-2 { + label = "nslu2:green:disk-2"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + + button-power { + wakeup-source; + linux,code = ; + label = "power"; + gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; + }; + button-reset { + wakeup-source; + linux,code = ; + label = "reset"; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + }; + }; + + i2c { + compatible = "i2c-gpio"; + sda-gpios = <&gpio0 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio0 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + #address-cells = <1>; + #size-cells = <0>; + + rtc@6f { + compatible = "xicor,x1205"; + reg = <0x6f>; + }; + }; + + gpio-poweroff { + compatible = "gpio-poweroff"; + gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + timeout-ms = <5000>; + }; + + /* The first 16MB region on the expansion bus */ + flash@50000000 { + compatible = "intel,ixp4xx-flash", "cfi-flash"; + bank-width = <2>; + /* + * 8 MB of Flash in 0x20000 byte blocks + * mapped in at 0x50000000 + */ + reg = <0x50000000 0x800000>; + + partitions { + compatible = "redboot-fis"; + /* Eraseblock at 0x7e0000 */ + fis-index-block = <0x3f>; + }; + }; +}; diff --git a/arch/arm/boot/dts/intel-ixp42x.dtsi b/arch/arm/boot/dts/intel-ixp42x.dtsi new file mode 100644 index 000000000000..a9622ca850cc --- /dev/null +++ b/arch/arm/boot/dts/intel-ixp42x.dtsi @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: ISC +/* + * Device Tree file for Intel XScale Network Processors + * in the IXP 42x series. This series has 32 interrupts. + */ +#include "intel-ixp4xx.dtsi" + +/ { + soc { + interrupt-controller@c8003000 { + compatible = "intel,ixp42x-interrupt"; + }; + + /* + * This is the USB Device Mode (UDC) controller, which is used + * to present the IXP4xx as a device on a USB bus. + */ + usb@c800b000 { + compatible = "intel,ixp4xx-udc"; + reg = <0xc800b000 0x1000>; + interrupts = <12 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + }; +}; diff --git a/arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts b/arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts new file mode 100644 index 000000000000..ba1163a1e1e7 --- /dev/null +++ b/arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: ISC +/* + * Device Tree file for Gateworks IXP43x-based Cambria GW2358 + */ + +/dts-v1/; + +#include "intel-ixp43x.dtsi" + +/ { + model = "Gateworks Cambria GW2358"; + compatible = "gateworks,gw2358", "intel,ixp43x"; + #address-cells = <1>; + #size-cells = <1>; + + memory@0 { + /* 128 MB SDRAM */ + device_type = "memory"; + reg = <0x00000000 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200n8 root=/dev/mtdblock2 rw rootfstype=squashfs,jffs2 rootwait"; + stdout-path = "uart0:115200n8"; + }; + + aliases { + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; + led-user { + label = "gw2358:green:LED"; + gpios = <&pld1 0 GPIO_ACTIVE_LOW>; + default-state = "on"; + linux,default-trigger = "heartbeat"; + }; + }; + + + i2c { + compatible = "i2c-gpio"; + sda-gpios = <&gpio0 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio0 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + #address-cells = <1>; + #size-cells = <0>; + + hwmon@28 { + compatible = "adi,ad7418"; + reg = <0x28>; + }; + rtc: ds1672@68 { + compatible = "dallas,ds1672"; + reg = <0x68>; + }; + eeprom@51 { + compatible = "atmel,24c08"; + reg = <0x51>; + pagesize = <16>; + size = <1024>; + read-only; + }; + pld0: pld@56 { + compatible = "gateworks,pld-gpio"; + reg = <0x56>; + gpio-controller; + #gpio-cells = <2>; + }; + /* This PLD just handles the LED and user button */ + pld1: pld@57 { + compatible = "gateworks,pld-gpio"; + reg = <0x57>; + gpio-controller; + #gpio-cells = <2>; + }; + }; + + flash@50000000 { + compatible = "intel,ixp4xx-flash", "cfi-flash"; + bank-width = <2>; + /* + * 32 MB of Flash in 0x20000 byte blocks + * mapped in at 0x50000000 + */ + reg = <0x50000000 0x2000000>; + + partitions { + compatible = "redboot-fis"; + /* Eraseblock at 0x1fe0000 */ + fis-index-block = <0xff>; + }; + }; +}; diff --git a/arch/arm/boot/dts/intel-ixp43x.dtsi b/arch/arm/boot/dts/intel-ixp43x.dtsi new file mode 100644 index 000000000000..494fb2ff57a0 --- /dev/null +++ b/arch/arm/boot/dts/intel-ixp43x.dtsi @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: ISC +/* + * Device Tree file for Intel XScale Network Processors + * in the IXP 43x series. This series has 64 interrupts and adds a few more + * peripherals over the 42x series. + */ +#include "intel-ixp4xx.dtsi" + +/ { + soc { + interrupt-controller@c8003000 { + compatible = "intel,ixp43x-interrupt"; + }; + }; +}; diff --git a/arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi b/arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi new file mode 100644 index 000000000000..f8cd506659dc --- /dev/null +++ b/arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: ISC +/* + * Device Tree file for Intel XScale Network Processors + * in the IXP45x and IXP46x series. This series has 64 interrupts and adds a + * few more peripherals over the 42x and 43x series so this extends the + * basic IXP4xx DTSI. + */ +#include "intel-ixp4xx.dtsi" + +/ { + soc { + interrupt-controller@c8003000 { + compatible = "intel,ixp43x-interrupt"; + }; + + /* + * This is the USB Device Mode (UDC) controller, which is used + * to present the IXP4xx as a device on a USB bus. + */ + usb@c800b000 { + compatible = "intel,ixp4xx-udc"; + reg = <0xc800b000 0x1000>; + interrupts = <12 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + i2c@c8011000 { + compatible = "intel,ixp4xx-i2c"; + reg = <0xc8011000 0x18>; + interrupts = <33 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + }; +}; diff --git a/arch/arm/boot/dts/intel-ixp4xx.dtsi b/arch/arm/boot/dts/intel-ixp4xx.dtsi new file mode 100644 index 000000000000..9edd49509af8 --- /dev/null +++ b/arch/arm/boot/dts/intel-ixp4xx.dtsi @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: ISC +/* + * Device Tree file for Intel XScale Network Processors + * in the IXP 4xx series. + */ +#include +#include + +/ { + soc { + #address-cells = <1>; + #size-cells = <1>; + ranges; + compatible = "simple-bus"; + interrupt-parent = <&intcon>; + + uart0: serial@c8000000 { + compatible = "intel,xscale-uart"; + reg = <0xc8000000 0x1000>; + /* + * The reg-offset and reg-shift is a side effect + * of running the platform in big endian mode. + */ + reg-offset = <3>; + reg-shift = <2>; + interrupts = <15 IRQ_TYPE_LEVEL_HIGH>; + clock-frequency = <14745600>; + no-loopback-test; + }; + + gpio0: gpio@c8004000 { + compatible = "intel,ixp4xx-gpio"; + reg = <0xc8004000 0x1000>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + intcon: interrupt-controller@c8003000 { + /* + * Note: no compatible string. The subvariant of the + * chip needs to define what version it is. The + * location of the interrupt controller is fixed in + * memory across all variants. + */ + reg = <0xc8003000 0x100>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + timer@c8005000 { + compatible = "intel,ixp4xx-timer"; + reg = <0xc8005000 0x100>; + interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; + }; + }; +}; From patchwork Thu Feb 21 15:44:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2913F6C2 for ; Thu, 21 Feb 2019 15:48:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15470313C7 for ; Thu, 21 Feb 2019 15:48:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07BD0314EC; Thu, 21 Feb 2019 15:48:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F272313C7 for ; Thu, 21 Feb 2019 15:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NNoRuBGVksIJT9rThOYzlA/YRNpmywQnNvlb50Djr1g=; b=VfE5CC28F6Ce+F ikMi2+RY29KzHMfjSsNfoEPYk71K5KBUetVJogYDjcY+72jHWwV9XtRRgNPRFaQPPWMQ9LLf27elo IzRnZjhlT6a0Urby3cuMFVd7gInzHDdYWmxOHXp1X3XLGYAzm/jZ2GMtpbaZvKlZp1Rd/IkR/qJR+ RW+YDN3ZtwYRbVBwLpZPE7yVCTTYM+q354nvom29YELAgDSWIm6wla3WKLVfb3HjbmdyqLnntLSVc wkL3ghS95lhbVaxRJy6c4JhxiQ81zCRQKE00f59Lz20c2TsNjvUcIo+7C35CnwLp4lYYNyz5U/4BC s3LnVIh6OiXnj9w3FjCA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqaG-0008Nc-0J; Thu, 21 Feb 2019 15:48:24 +0000 Received: from mail-lj1-f193.google.com ([209.85.208.193]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXt-0005eg-B1 for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:25 +0000 Received: by mail-lj1-f193.google.com with SMTP id g80so24400824ljg.6 for ; Thu, 21 Feb 2019 07:45:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R2ABnts4A81VsXKHtZ8wtITNo3WTLUTKGheobeTJauw=; b=Fi4uaO6RcCY8ZHzfFLaxI2eYSxOrON0jOjIFxRqNH6ZQ64FU0uc0+3OFbAeOFuyTcP GO4Ctuhgdy0kqnw/RlETxLXmkPhMIU8SqgsqPv1KdE+BOBCXFk6z0SYTi8y1XH4idRuv AFbCwUoav6Wqs/GX9l2LvTWqGbuzPZ3WrNBkSEBzbjsLD5DkPNPNncxPqsqSz1QgG6kM fb5Uz7YaYh2TsJq3B/Ysf5RcuDw3FmIn/F2hzSqXir8Ft2Kb37/QoPaEgGffvp5f3fuj YvRkyGnw+OP42tDz+nnzIA6EIFnDOcV+t9/7hJkvd/ctJuyAjTKttRv88g/ZuuOQ/joh Ao9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R2ABnts4A81VsXKHtZ8wtITNo3WTLUTKGheobeTJauw=; b=KzBmSXM0Hn01XKwy22LZHBugWEynfhA0gom2hmhae1yLmazzTy/lQck8rzvfGgtD9r Nj8vZtPIS1bjZzEa8L7EO6lTIgh2Wf/wWH2FteHOlPPZGlWFsEezslMNLdevlINTQnkk xpCPUhX6Rj8sJL/AGCgMztaMHoQ4E4jvOdpIHdoqTepnFoBZs/KTSCF3gvX6P8iM8OEH dNySj3N+9U9ncmHUnSy7icyTr3JjSCuQ2Ef9gu//A+iBW1jKfSZKaCm51rWqJC+vhdmw 7GiUeETq8XHBDPqyZeOM5NKluZlOjx0Y8g7LSoUbI1o9TZVXET6HEDlnHQZcL0r0JRjJ t4rg== X-Gm-Message-State: AHQUAuYiWwgeMFdnohKZyai+9ZMiAzi8QA23qB0W64LBkUk37GorYeup iwte6SW6JcmpEueXKMsuuc3xhdQ1h80= X-Google-Smtp-Source: AHgI3IZ2phmAm+D6YXU30MndFfVEunPse0DuE91LujITPpb8uqQzF2SgID9jqDmmXLGMiA0yE2sFcQ== X-Received: by 2002:a2e:980e:: with SMTP id a14mr20371561ljj.177.1550763954666; Thu, 21 Feb 2019 07:45:54 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:53 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 18/30 v2] ARM: ixp4xx: Move NPE and QMGR to drivers/soc Date: Thu, 21 Feb 2019 16:44:46 +0100 Message-Id: <20190221154458.23763-19-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074558_044676_437DB65C X-CRM114-Status: GOOD ( 18.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The Network Processing Engine and Queue Manager are versatile firmware components used by several IXP4xx drivers. Drivers are relying on getting access to these components using headers which does not work with multiplatform. We need to find a better place for the drivers to live. Let's first move them to drivers/soc and the start to refactor a bit by passing resources and moving headers. This patch introduce static IRQ assignments but that will be fixed by later patches in this series. Signed-off-by: Linus Walleij --- MAINTAINERS | 4 ++-- arch/arm/mach-ixp4xx/Kconfig | 13 ------------- arch/arm/mach-ixp4xx/Makefile | 2 -- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/ixp4xx/Kconfig | 16 ++++++++++++++++ drivers/soc/ixp4xx/Makefile | 2 ++ .../soc/ixp4xx/ixp4xx-npe.c | 0 .../soc/ixp4xx/ixp4xx-qmgr.c | 5 ++++- 9 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 drivers/soc/ixp4xx/Kconfig create mode 100644 drivers/soc/ixp4xx/Makefile rename arch/arm/mach-ixp4xx/ixp4xx_npe.c => drivers/soc/ixp4xx/ixp4xx-npe.c (100%) rename arch/arm/mach-ixp4xx/ixp4xx_qmgr.c => drivers/soc/ixp4xx/ixp4xx-qmgr.c (98%) diff --git a/MAINTAINERS b/MAINTAINERS index 20d02e1e60a8..2c4057a7c9b4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7723,8 +7723,8 @@ M: Krzysztof Halasa S: Maintained F: arch/arm/mach-ixp4xx/include/mach/qmgr.h F: arch/arm/mach-ixp4xx/include/mach/npe.h -F: arch/arm/mach-ixp4xx/ixp4xx_qmgr.c -F: arch/arm/mach-ixp4xx/ixp4xx_npe.c +F: drivers/soc/ixp4xx/ixp4xx-qmgr.c +F: drivers/soc/ixp4xx/ixp4xx-npe.c F: drivers/net/ethernet/xscale/ixp4xx_eth.c F: drivers/net/wan/ixp4xx_hss.c diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig index 0973270f4863..83afb80d38a8 100644 --- a/arch/arm/mach-ixp4xx/Kconfig +++ b/arch/arm/mach-ixp4xx/Kconfig @@ -236,19 +236,6 @@ config IXP4XX_INDIRECT_PCI need to use the indirect method instead. If you don't know what you need, leave this option unselected. -config IXP4XX_QMGR - tristate "IXP4xx Queue Manager support" - help - This driver supports IXP4xx built-in hardware queue manager - and is automatically selected by Ethernet and HSS drivers. - -config IXP4XX_NPE - tristate "IXP4xx Network Processor Engine support" - select FW_LOADER - help - This driver supports IXP4xx built-in network coprocessors - and is automatically selected by Ethernet and HSS drivers. - endmenu endif diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile index 5f63b3012826..1fa4e6605782 100644 --- a/arch/arm/mach-ixp4xx/Makefile +++ b/arch/arm/mach-ixp4xx/Makefile @@ -43,5 +43,3 @@ obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_mlr.o obj-$(CONFIG_MACH_ARCOM_VULCAN) += vulcan-setup.o obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o -obj-$(CONFIG_IXP4XX_NPE) += ixp4xx_npe.o diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index c07b4a85253f..ae9bf20b26fa 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -6,6 +6,7 @@ source "drivers/soc/atmel/Kconfig" source "drivers/soc/bcm/Kconfig" source "drivers/soc/fsl/Kconfig" source "drivers/soc/imx/Kconfig" +source "drivers/soc/ixp4xx/Kconfig" source "drivers/soc/mediatek/Kconfig" source "drivers/soc/qcom/Kconfig" source "drivers/soc/renesas/Kconfig" diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index 90b686e586c6..c7c1a139ad8d 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_MACH_DOVE) += dove/ obj-y += fsl/ obj-$(CONFIG_ARCH_GEMINI) += gemini/ obj-$(CONFIG_ARCH_MXC) += imx/ +obj-$(CONFIG_ARCH_IXP4XX) += ixp4xx/ obj-$(CONFIG_SOC_XWAY) += lantiq/ obj-y += mediatek/ obj-y += amlogic/ diff --git a/drivers/soc/ixp4xx/Kconfig b/drivers/soc/ixp4xx/Kconfig new file mode 100644 index 000000000000..de6becdc78a2 --- /dev/null +++ b/drivers/soc/ixp4xx/Kconfig @@ -0,0 +1,16 @@ +menu "IXP4xx SoC drivers" + +config IXP4XX_QMGR + tristate "IXP4xx Queue Manager support" + help + This driver supports IXP4xx built-in hardware queue manager + and is automatically selected by Ethernet and HSS drivers. + +config IXP4XX_NPE + tristate "IXP4xx Network Processor Engine support" + select FW_LOADER + help + This driver supports IXP4xx built-in network coprocessors + and is automatically selected by Ethernet and HSS drivers. + +endmenu diff --git a/drivers/soc/ixp4xx/Makefile b/drivers/soc/ixp4xx/Makefile new file mode 100644 index 000000000000..d20d99e6df65 --- /dev/null +++ b/drivers/soc/ixp4xx/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx-qmgr.o +obj-$(CONFIG_IXP4XX_NPE) += ixp4xx-npe.o diff --git a/arch/arm/mach-ixp4xx/ixp4xx_npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c similarity index 100% rename from arch/arm/mach-ixp4xx/ixp4xx_npe.c rename to drivers/soc/ixp4xx/ixp4xx-npe.c diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c similarity index 98% rename from arch/arm/mach-ixp4xx/ixp4xx_qmgr.c rename to drivers/soc/ixp4xx/ixp4xx-qmgr.c index 2665347a2c6f..2e6d33534afe 100644 --- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c +++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c @@ -15,7 +15,10 @@ #include #include -#include "irqs.h" +/* FIXME: get rid of these static assigments */ +#define IRQ_IXP4XX_BASE 16 +#define IRQ_IXP4XX_QM1 (IRQ_IXP4XX_BASE + 3) +#define IRQ_IXP4XX_QM2 (IRQ_IXP4XX_BASE + 4) static struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; static struct resource *mem_res; From patchwork Thu Feb 21 15:44:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A77D6C2 for ; Thu, 21 Feb 2019 15:48:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 836F5313C7 for ; Thu, 21 Feb 2019 15:48:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74BED314EC; Thu, 21 Feb 2019 15:48:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E45DF313C7 for ; Thu, 21 Feb 2019 15:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9OmY1PWbw3pMVJCxzM2OcJpLoPlvVOEUKtExZCJlKIc=; b=awNRGXhKSZwcCD l/IFVKl9XVQ31IJJsJDT+GJNVQpkyCvGxwBJGDcPRU1elXnH/RGaM5y09cAFLlRNWbzrZYSoUR4TA t/DWWWTWuITVhyN4W2s7DyJSznU8XIt7BLNM7WtxIi6FSyPOcG3ooFZ3e853J0ak/8COzFmf2twc9 84RDCi00vsp8opeoa18wnPAyTL0lcyF3F8U9DtUiFPSwonsDz3bU+JUjiKey8GqdBZhMAQU+1b/Ge iNQ74qKciLgsm1DpxQ1n0Z5SxO4P/G1SKYX5OKag23RgAAqddnBKHoMJELhZSC+Yl5DXb86tmwBLd pSmHWPuqXMPG+c5wIwVQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqaV-0000FX-GG; Thu, 21 Feb 2019 15:48:39 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXv-0005hM-1o for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:28 +0000 Received: by mail-lf1-x143.google.com with SMTP id g2so20656456lfh.11 for ; Thu, 21 Feb 2019 07:45:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IG8WAtyjVcV/McYwRasNEnrkhaKksxoln8zg4LDPzTc=; b=cccHI1sNwUvWbGUSyj33yPVdHkH1LOezUfZrS/bv9wEqETdm4oEwYlxXRcpbq6o1vD ryj5CuvmxGSKO0eeiE3yMGEQLt0YlLRDEhHPAYJIjeV24mlCmLZ2poET3i9XdyT4QZDj ocNMw8JZ5M/6mdtbgwOhQ7PVohrvdIxOgNGHqKMEmgrrlSIijYHDGzQX8MYzd31I2YUV kPyfAEUd9vqXvBUwXm+NhdNacOLpaDXvEUWOh6zLvz/UhgFKmCWM+g/LypwQ2gO29PR3 AF46pj64dtv8XWBWtOHQjEI7haWfyzF0aEV0pu5GCYX3hiKzbaWGBnp76f5deuEYwUlx PDZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IG8WAtyjVcV/McYwRasNEnrkhaKksxoln8zg4LDPzTc=; b=t1HArH9LBi0BVhSY28SmWOY0wQ2sEvUC0CcP2ptzk6EYzohnxFsCsqeiiSRG2ChLIi G0c1Ngv2DG6Aq6koH+H/JpO2MM7hdukvkrUs4Sp5pzISdy/Kdd5qV1Q30AWlYSlfbhP1 YaqJtupeSuqg6IuLnNYVbz2IeaviYYxkr+n5koZLZefkS1kIIGzLA2+PbH5ylNgUAWO6 /v1x6Tx3eHwVT5A0OQH5hALBX3v0HuG2kYM/1hSq6C/5ugCTUkQUR6vpbcinyCySdihq roJjhnmoSKixeKQ20WvmP/8p9sahnua00Z1U2j+FQBYyCKSRAYDfnQDXg+sBjMv+7K0D x1jw== X-Gm-Message-State: AHQUAubNHI1lU7UiLxUN8s3qYpcTXjh/6fI6hNzHePWVhQhw1mBqNB4l 85HddiiiNDpjqdjsLz88CB8LawHC2yY= X-Google-Smtp-Source: AHgI3IYAd+3WTOemMwQ1/cK/H+L8gkDYFdEkkwl4zUPmD2WCZj0SekaqaZu1nMS13CjrvETM76GJCQ== X-Received: by 2002:ac2:52ad:: with SMTP id r13mr10070097lfm.50.1550763957035; Thu, 21 Feb 2019 07:45:57 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:56 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 19/30 v2] ARM: ixp4xx: Move IXP4xx QMGR and NPE headers Date: Thu, 21 Feb 2019 16:44:47 +0100 Message-Id: <20190221154458.23763-20-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074559_777442_5F76017B X-CRM114-Status: GOOD ( 11.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This moves the IXP4xx Queue Manager and Network Processing Engine headers out of the include path as that is incompatible with multiplatform. Signed-off-by: Linus Walleij --- MAINTAINERS | 4 ++-- drivers/crypto/ixp4xx_crypto.c | 4 ++-- drivers/net/ethernet/xscale/ixp4xx_eth.c | 4 ++-- drivers/net/wan/ixp4xx_hss.c | 4 ++-- drivers/soc/ixp4xx/ixp4xx-npe.c | 2 +- drivers/soc/ixp4xx/ixp4xx-qmgr.c | 2 +- .../include/mach => include/linux/soc/ixp4xx}/npe.h | 0 .../include/mach => include/linux/soc/ixp4xx}/qmgr.h | 0 8 files changed, 10 insertions(+), 10 deletions(-) rename {arch/arm/mach-ixp4xx/include/mach => include/linux/soc/ixp4xx}/npe.h (100%) rename {arch/arm/mach-ixp4xx/include/mach => include/linux/soc/ixp4xx}/qmgr.h (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 2c4057a7c9b4..1eb9dbcefdc4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7721,8 +7721,8 @@ F: Documentation/media/v4l-drivers/ipu3.rst INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT M: Krzysztof Halasa S: Maintained -F: arch/arm/mach-ixp4xx/include/mach/qmgr.h -F: arch/arm/mach-ixp4xx/include/mach/npe.h +F: include/linux/soc/ixp4xx/qmgr.h +F: include/linux/soc/ixp4xx/npe.h F: drivers/soc/ixp4xx/ixp4xx-qmgr.c F: drivers/soc/ixp4xx/ixp4xx-npe.c F: drivers/net/ethernet/xscale/ixp4xx_eth.c diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 19fba998b86b..97f2a5dc7cc6 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -30,8 +30,8 @@ #include #include -#include -#include +#include +#include #define MAX_KEYLEN 32 diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 7ad3c3b56a77..abf59f30f18b 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include +#include #define DEBUG_DESC 0 #define DEBUG_RX 0 diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index 6a505c26a3e7..791af08ed822 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c @@ -22,8 +22,8 @@ #include #include #include -#include -#include +#include +#include #define DEBUG_DESC 0 #define DEBUG_RX 0 diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c index e0ce22cd9bfc..1f6e01369d54 100644 --- a/drivers/soc/ixp4xx/ixp4xx-npe.c +++ b/drivers/soc/ixp4xx/ixp4xx-npe.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #define DEBUG_MSG 0 #define DEBUG_FW 0 diff --git a/drivers/soc/ixp4xx/ixp4xx-qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c index 2e6d33534afe..1bed048924bb 100644 --- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c +++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include /* FIXME: get rid of these static assigments */ #define IRQ_IXP4XX_BASE 16 diff --git a/arch/arm/mach-ixp4xx/include/mach/npe.h b/include/linux/soc/ixp4xx/npe.h similarity index 100% rename from arch/arm/mach-ixp4xx/include/mach/npe.h rename to include/linux/soc/ixp4xx/npe.h diff --git a/arch/arm/mach-ixp4xx/include/mach/qmgr.h b/include/linux/soc/ixp4xx/qmgr.h similarity index 100% rename from arch/arm/mach-ixp4xx/include/mach/qmgr.h rename to include/linux/soc/ixp4xx/qmgr.h From patchwork Thu Feb 21 15:44:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2680A922 for ; Thu, 21 Feb 2019 16:11:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 125B031923 for ; Thu, 21 Feb 2019 16:11:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05B6431918; Thu, 21 Feb 2019 16:11:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9531331918 for ; Thu, 21 Feb 2019 16:11:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t9GhCzn/vWKN8pRTZ2bV06Jm5fY+YIBrT99jzOYq4vI=; b=ElvKrbCrTXH8Tg 3fTIXjjH2Sr8KXpvDik7UUG27/k1I/S+8pqwLht0cnErmb4fLndETqhxj0KPw4NJaNaaTA4p8leIX 2MKzrIDDdhJcNWTHMF0z9KOJcQnvizKq0zaBcZAsdyfCpZL9HT4acPPRFCODoyYjwPSIpcdqaZjkR 2kPy5bOngG8OCpesX7xiIPrx+IPJxYi+edX7DQ3k19HFN8hLQHasQCDeFqFZYm9FnMKsdD9G9sO5u vcfwWJovsI7nkBQseIdPDznAe3vBXTY62mMEAS7wPYKRmU81sVVQg17Zl8mOMNXgXXF8gZt2AC1XL DiqTFPjSw/1E41KasfUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqwG-0005zk-1m; Thu, 21 Feb 2019 16:11:08 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqvv-0005aI-0o for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 16:10:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OxN6fmUBC5lmGuFwAi3SDeqR+0s2c70kF7erNQAujHE=; b=G3AxkbmRDbtHholEIeEAsPQXSS hbGepriDUFwrU1H9uKBtq+WifZphv/EkYAYzdor2RD9LmtsCV4EPogM64A328Ve8yqOu/snUj4OJF mrFtwITWe3s0LlSSTM/qBBgTLp9Ag/mda7/JllDz8wUqv32wolGOfN9O11A6wNZaPNZ9kdPe5CLNw EWfQE3y9/vy3hQv4WM2kxD78uelb4EWfifM/INDzeRc0CN9o+KkK63X/p6sN+SMDbHBmuFCcmWgO/ zGxSvTxjuOl1BWbB3WKIyvnvGhfly2wTi0q2lrzLlEozirfbz4jU181C2TqudB6sHLVYC6+slexlf X+gkiwIg==; Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXy-0002AV-3B for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:02 +0000 Received: by mail-lf1-x143.google.com with SMTP id u21so20751996lfu.1 for ; Thu, 21 Feb 2019 07:46:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OxN6fmUBC5lmGuFwAi3SDeqR+0s2c70kF7erNQAujHE=; b=WaNGjlTC+qp+ctPTuKkbUZKJanv+8fA/ci1UtcdSmntCn33SBn8PinDKqPp6SC/E2h ty94TCT3bYD0VSAtPCU+7AlM7vCF9et/75yuz/6/Q5omkBA6LO/BqIbI0I1QFRNaRKvI q7GRbUDhjeFC4HWfn/XDNmKIptWa+LPLs/uyGIqzewlJVltFtPkrfJbkARAn2pnjduQo TY0q3SEmws6fpOaXzcEbbvCRxYDiEBKPVyZmvT4oiLkMbqoQ/zH+CrhVDQxBAABNwlTQ WB3c1LrDdxtBqUBMw2INlC4wEngcFGbCbDi4Cx0bsDj9e+D5Sv9XR/0DxrKjIn/mVL8y /ZKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OxN6fmUBC5lmGuFwAi3SDeqR+0s2c70kF7erNQAujHE=; b=IS3NhmZloiVXhK/Qqx2APC3+BEsXv40SmML5gZHr11QhGWwWUHAxRIOJjVfdbUmvfM vJatrbUtaUPEtWTR73tGwGWh/VCdmw+08hoPVb7CtZyXGbRAScNs+QvTe9//IE3NoANs egE86+CQbQ3hjgB0KdnYvr7hCEl8mi9keJgL/A0eANPaxToJyaMs7EJh3xWiiD9vld8g X3uKorzoKfDoGAr9D2n3l3ALesd/tV3lCXPEfyOz+B/3b91FMdN1sbvnLqjikfYuLGMr omiWqxEqroKh40THkRJAMKXhxxWdtjgc1yOEbuP6a+DOENs8NLymLCijaQu8waDk8yww MMPA== X-Gm-Message-State: AHQUAuZO9KhfzhjV2n3Jvs62Gl6WX/aZsPlFGNr+Zpfk8G7561D3BP3C UbimK09pNC9gaIN/vNXJpaYW2BL7oNU= X-Google-Smtp-Source: AHgI3IbheL7YPziRmou+MgfIYqQ6Tko0R+oqvmL2VFzluurww+/Z1DbBo0JT5vO3XPO6/5n0ykY8Pw== X-Received: by 2002:a19:4851:: with SMTP id v78mr23809322lfa.98.1550763959322; Thu, 21 Feb 2019 07:45:59 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.45.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:45:58 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 20/30 v2] ARM: ixp4xx: Turn the NPE into a platform device Date: Thu, 21 Feb 2019 16:44:48 +0100 Message-Id: <20190221154458.23763-21-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_104602_200061_EECF620F X-CRM114-Status: GOOD ( 20.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of registering everything related to the NPE unconditionally in the module_init() call (which will never work with multiplatform) create a platform device and probe the NPE like any other device. Put the device first in the list of devices added for the platform so it is there when the dependent network and crypto drivers probe later on. This probe() path will not be taken unconditionally on device tree boots, so remove the DT guard. Signed-off-by: Linus Walleij --- arch/arm/mach-ixp4xx/common.c | 6 ++++++ drivers/soc/ixp4xx/ixp4xx-npe.c | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index fc4c9b21ca96..e7789d06c39b 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -150,7 +150,13 @@ static struct platform_device ixp4xx_udc_device = { }, }; +static struct platform_device ixp4xx_npe_device = { + .name = "ixp4xx-npe", + .id = -1, +}; + static struct platform_device *ixp4xx_devices[] __initdata = { + &ixp4xx_npe_device, &ixp4xx_gpio_device, &ixp4xx_udc_device, }; diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c index 1f6e01369d54..e3294457b5de 100644 --- a/drivers/soc/ixp4xx/ixp4xx-npe.c +++ b/drivers/soc/ixp4xx/ixp4xx-npe.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #define DEBUG_MSG 0 @@ -683,16 +684,10 @@ void npe_release(struct npe *npe) module_put(THIS_MODULE); } - -static int __init npe_init_module(void) +static int ixp4xx_npe_probe(struct platform_device *pdev) { - int i, found = 0; - /* This driver does not work with device tree */ - if (of_have_populated_dt()) - return -ENODEV; - for (i = 0; i < NPE_COUNT; i++) { struct npe *npe = &npe_tab[i]; if (!(ixp4xx_read_feature_bits() & @@ -717,7 +712,7 @@ static int __init npe_init_module(void) return 0; } -static void __exit npe_cleanup_module(void) +static int ixp4xx_npe_remove(struct platform_device *pdev) { int i; @@ -726,10 +721,18 @@ static void __exit npe_cleanup_module(void) npe_reset(&npe_tab[i]); release_resource(npe_tab[i].mem_res); } + + return 0; } -module_init(npe_init_module); -module_exit(npe_cleanup_module); +static struct platform_driver ixp4xx_npe_driver = { + .driver = { + .name = "ixp4xx-npe", + }, + .probe = ixp4xx_npe_probe, + .remove = ixp4xx_npe_remove, +}; +module_platform_driver(ixp4xx_npe_driver); MODULE_AUTHOR("Krzysztof Halasa"); MODULE_LICENSE("GPL v2"); From patchwork Thu Feb 21 15:44:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4977B6C2 for ; Thu, 21 Feb 2019 15:49:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34C473176E for ; Thu, 21 Feb 2019 15:49:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28AB831782; Thu, 21 Feb 2019 15:49:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B95AD3176E for ; Thu, 21 Feb 2019 15:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B4txw5kP3XO+U5U8RuAkgQ3FdLF0oXw8QkjPuE5Ut3A=; b=BzK8H5ud9SQ8Kk HTvbQbycnU0lY8Prrl/rKr6PLHCEGSEa91cdP/di9hN9m53ImZhVnNdKPf0xLIwWlMtOJ0OZfUhHB XWkY6HDk7GXh9Amd5D8bQ0aDIeHm6SJszbN2FQpK09wVNEuPyE/eDiziZM1RvOM4yaK6jjz1xXdNh 6eVgulXuY7A7uWTOHL/2iKlBWE3v6ALzTQkK3QkAAYQ9ghsyt2hkxJ9embwR56GDpH2gXXZ+VgvQU QaVLS5D3n1CAUXbN5ZLnsUekLgf/T8eWDBsktpfmqpEmBvA1499Q/Roq/6xUOpe1lBojAmVa/GDYv Dd1mLopz4Kqlv9jMR61g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqbY-0000mZ-7j; Thu, 21 Feb 2019 15:49:44 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqXz-0005nd-KW for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:32 +0000 Received: by mail-lj1-x241.google.com with SMTP id v16so24368046ljg.13 for ; Thu, 21 Feb 2019 07:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Eqn2Bvj9SCb/dO93NxImMW9IFWDZSqHXlOR9B6GuSXg=; b=hFUvfAEGbccvJsuv7TCEaxzUJu5Uwpi3II7OzkvxptGlljChi6M2eDYjOcAQ9Jly+P G0Culc14pr5dt18AMhsWZp3WOxNv0M+sJkW2vH3lyc0+Wcp2ZcMmRdCMPj9PH+4fK2/u ObD656WFY9SlG2iDOKaC4zWgzxnAAuXXUGacsh3V0moULSgZxe/o/U/h1LWOZy5x3s3G xOBliBGiJSBWz6f60bTmXhIs3GI1ZfJ4xUFCC20qRzu+nTlx5lu8+ZjwXlMeMKAyAt1W ql5kZKUyOjZY2A6Rzbu4psI353GDNGuM5eTup+w15SztW0ln00aL+olfyEhprzCMJVI7 TViQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Eqn2Bvj9SCb/dO93NxImMW9IFWDZSqHXlOR9B6GuSXg=; b=K0k0XekNvobRN74NuM9Ry2EyilLYeR0mMZMMksav1CFMZR/Zha8ZnVEZoEjUCR6KIv /tk4ITst30PN99Xs7fntjiiLTf/sl+nwvN4PpaivDbHvaU5DPofu3hQIJe4q3jzk2V26 CVJHyPorY8nNCzBLDtunkJuRAGU7W2HOLuvR0DJLac5RvoWK9mSG0zT91gze9LxGw3pY G5BfGK/Ij2DY0MK9NAFcZnHxr7/sVx9Qb+unMuZCTn9Nb05INuwsRB9ot5ROxO9XNqPz xtpLod0Qx8DF4lRJoY477FtKZwCqWRvGtNtnNYk4HqUFt6dC4L0pk2ibltJqx0LJTADM w9cA== X-Gm-Message-State: AHQUAuYh7ZW34EtdRK+y21HcqKvOGCltqa77slBLmGaVLkpfVUgIarzC jzeS6G4dQP2c7IfsT5ckBXStXmIetro= X-Google-Smtp-Source: AHgI3IZFs3SgJ7orBCurHWlpl484ByM4JozigVG4cnpEbhvA1u7E41GZj+zv73GwqUbbIuPfaw86Yg== X-Received: by 2002:a2e:5d88:: with SMTP id v8mr24542366lje.150.1550763961783; Thu, 21 Feb 2019 07:46:01 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:00 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 21/30 v2] ARM: ixp4xx: Turn the QMGR into a platform device Date: Thu, 21 Feb 2019 16:44:49 +0100 Message-Id: <20190221154458.23763-22-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074603_962313_4B46BE43 X-CRM114-Status: GOOD ( 16.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of registering everything related to the QMGR unconditionally in the module_init() call (which will never work with multiplatform) create a platform device and probe the QMGR like any other device. Put the device second in the list of devices added for the platform so it is there when the dependent network and crypto drivers probe later on. This probe() path will not be taken unconditionally on device tree boots, so remove the DT guard. Signed-off-by: Linus Walleij --- arch/arm/mach-ixp4xx/common.c | 6 ++++++ drivers/soc/ixp4xx/ixp4xx-qmgr.c | 21 +++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index e7789d06c39b..cdcd6d6b6d3d 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -155,8 +155,14 @@ static struct platform_device ixp4xx_npe_device = { .id = -1, }; +static struct platform_device ixp4xx_qmgr_device = { + .name = "ixp4xx-qmgr", + .id = -1, +}; + static struct platform_device *ixp4xx_devices[] __initdata = { &ixp4xx_npe_device, + &ixp4xx_qmgr_device, &ixp4xx_gpio_device, &ixp4xx_udc_device, }; diff --git a/drivers/soc/ixp4xx/ixp4xx-qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c index 1bed048924bb..133914e99aeb 100644 --- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c +++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c @@ -13,6 +13,7 @@ #include #include #include +#include #include /* FIXME: get rid of these static assigments */ @@ -288,15 +289,11 @@ void qmgr_release_queue(unsigned int queue) module_put(THIS_MODULE); } -static int qmgr_init(void) +static int ixp4xx_qmgr_probe(struct platform_device *pdev) { int i, err; irq_handler_t handler1, handler2; - /* This driver does not work with device tree */ - if (of_have_populated_dt()) - return -ENODEV; - mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE, "IXP4xx Queue Manager"); @@ -355,17 +352,25 @@ static int qmgr_init(void) return err; } -static void qmgr_remove(void) +static int ixp4xx_qmgr_remove(struct platform_device *pdev) { free_irq(IRQ_IXP4XX_QM1, NULL); free_irq(IRQ_IXP4XX_QM2, NULL); synchronize_irq(IRQ_IXP4XX_QM1); synchronize_irq(IRQ_IXP4XX_QM2); release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); + + return 0; } -module_init(qmgr_init); -module_exit(qmgr_remove); +static struct platform_driver ixp4xx_qmgr_driver = { + .driver = { + .name = "ixp4xx-qmgr", + }, + .probe = ixp4xx_qmgr_probe, + .remove = ixp4xx_qmgr_remove, +}; +module_platform_driver(ixp4xx_qmgr_driver); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Krzysztof Halasa"); From patchwork Thu Feb 21 15:44:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F19EE139A for ; Thu, 21 Feb 2019 16:03:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE34731822 for ; Thu, 21 Feb 2019 16:03:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D217731870; Thu, 21 Feb 2019 16:03:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 353B131822 for ; Thu, 21 Feb 2019 16:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w6nuK6ZGiqSUV8+PzKXijEM8EIgSzJY0E9UbdQXSOaY=; b=dR+uHmH37PsfzA cr7NYzLLH/umbviQOm7pv953TnojVCyvrXOj47dj5dKIAx5bPRq1N4tNfM3wmXBg6zZsAQwc3ic98 +uu9FrJffT/V23oxrvwBkhoHuyW7p/Ru1axyCuxIpcY5ORtRJsUYWKs9IapWu6r0LNWhR06MhkXR+ ljJ318DZn+aPSS5cVuES4SQ+rGlbRVXWnBcOKGvQ2ShYERBkX4JnD7MpcFyp7Uq2nA9Iahfi/MwtF 4L494f8dUwqFTkRlGrRMvelHgF7Pl96R13o+MrCp+FON3hG5RsvfRkgVGlT0AMi1ST6bnfn+ghoeK v49o9u42loy8IbtR1YSg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqoU-0001ci-Tz; Thu, 21 Feb 2019 16:03:06 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqnr-0000bs-FK for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 16:02:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=viQosBtHxW3hm4OeJu5mhQ4chI41Fb8tTjJF6BETtcI=; b=nQF5aotqsPAKqt40JUFjyBJ9eT awAMMMGd8dLEpoovxoBrxLvkhhwGxN08lPiKv0R1UNpfgTqlLaWINAdtR9uEWAPW1CMFve38S30Cw l6IFh5jsuWzqjBIQNr7QogrtqQdxKW7DQTSVCa9nu6uy49LZ6C/jED3vQHayFH3db+QTMCWWyiwCx gSkWzgdyhxEc/aGf62GlbglrP60rqOgmrzb4y8YzKWY+1uCIHKW5G/UGnohEgijXyHdN9w6uPKJj1 FI3qA0mGtWR+vsG40f6pM7TUrxkxbfhFTCHVoSKcjHFi4BjbXBE2oHBOaJLyBolL4YTaPR7Yo7t34 9Y8Oqa7Q==; Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqY1-0006qf-W5 for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:07 +0000 Received: by mail-lj1-x244.google.com with SMTP id d14so13227123ljl.9 for ; Thu, 21 Feb 2019 07:46:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=viQosBtHxW3hm4OeJu5mhQ4chI41Fb8tTjJF6BETtcI=; b=uvztOVPXfS3TTpYg3blvdV0FzV4Vcrkm5YPfB89Ox7rybeE4y3pCzeMFttVsKa9PBC tkWIOenKFixx67U5+EMVUGamy9t4Q0nsqU6Raz2jyNROYl7knUjkuwtYzWiMaWonndUJ MrzYKuDoxlEOW/e5HppAGxcUvEBy469lNn3tQasaQXVIcPLfEBlL75MLAa1FiJq+TEK1 F2wuuvq4szEErSXzwj1ThrU3R6Fo7UrMuZdbualpTGcGwAhrEnwrkspYsIc60VroMTb5 xOHVVBWxz+yO2n9H75eUBkGDxmLNZlBH/CoVxN3qV5PYiDN0agFuTUiOE3OqAH0RVzgM qMSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=viQosBtHxW3hm4OeJu5mhQ4chI41Fb8tTjJF6BETtcI=; b=ZMpjftH5CRsLIJBoJLu5oaqOOHuEnIQYoYCTJBr8C6xyUoF+q6mJNF2+67+Jvs2nJe NSVOjcH7apswnO3jc+/rkypxdqDs6nWeM19+SnwlQpgYuCr49sTdeBnglG7LXGsOQ81k BC6ynZLOjpbUHQt3WqkhLPzeJH637pfzb/X8gsLgSUBCsgWN6sHk/YSD8hX55LP8JaMX hJEmx6CrWIp8tUvdwMhbuUSCvn4OjEZ7CIzqUe5wd7gbR5YrA+xQFvj2vXXdgv1pCfG/ LpGISI6lKqDhEgvgE74DRL8ZXw8MUBYNsmkm2OZGJ0GARB/I07nrPu2RFzOVr0cb2gNR loUQ== X-Gm-Message-State: AHQUAuYnITwFPQCarOiW7rEENVwMaVnFMAV5UuFy5r2tx6hzvrxe9g6k WnQld1Jz8QRhXbWm/Pp2t+toR/I9Wa8= X-Google-Smtp-Source: AHgI3IbYImtozlDehh8z6fpCSPXNrzhrN8+5I7timIwqUvAIqwALEO6LM13dkkZkUnbBr84A7VI/Hw== X-Received: by 2002:a2e:81c1:: with SMTP id s1mr22130680ljg.29.1550763964074; Thu, 21 Feb 2019 07:46:04 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:03 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 22/30 v2] soc: ixp4xx: npe: Pass addresses as resources Date: Thu, 21 Feb 2019 16:44:50 +0100 Message-Id: <20190221154458.23763-23-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_154606_065971_47BCC206 X-CRM114-Status: GOOD ( 23.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of using hardcoded base addresses implicitly obtained through , pass the physical base for the three NPE blocks as memory resources and remap these in the driver. Drop the memory request region business, this will anyways be done by devm_* remapping functions. Signed-off-by: Linus Walleij --- arch/arm/mach-ixp4xx/common.c | 21 +++++++++++ .../mach-ixp4xx/include/mach/ixp4xx-regs.h | 3 -- drivers/soc/ixp4xx/ixp4xx-npe.c | 36 ++++++++++--------- include/linux/soc/ixp4xx/npe.h | 2 -- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index cdcd6d6b6d3d..07c3cb312a92 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -150,9 +150,30 @@ static struct platform_device ixp4xx_udc_device = { }, }; +static struct resource ixp4xx_npe_resources[] = { + { + .start = IXP4XX_NPEA_BASE_PHYS, + .end = IXP4XX_NPEA_BASE_PHYS + 0xfff, + .flags = IORESOURCE_MEM, + }, + { + .start = IXP4XX_NPEB_BASE_PHYS, + .end = IXP4XX_NPEB_BASE_PHYS + 0xfff, + .flags = IORESOURCE_MEM, + }, + { + .start = IXP4XX_NPEC_BASE_PHYS, + .end = IXP4XX_NPEC_BASE_PHYS + 0xfff, + .flags = IORESOURCE_MEM, + }, + +}; + static struct platform_device ixp4xx_npe_device = { .name = "ixp4xx-npe", .id = -1, + .num_resources = ARRAY_SIZE(ixp4xx_npe_resources), + .resource = ixp4xx_npe_resources, }; static struct platform_device ixp4xx_qmgr_device = { diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h index 459abe2eb4b5..f5d5b258c3f7 100644 --- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h +++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h @@ -132,9 +132,6 @@ #define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000) #define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000) #define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000) -#define IXP4XX_NPEA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x6000) -#define IXP4XX_NPEB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x7000) -#define IXP4XX_NPEC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x8000) #define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000) #define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000) #define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000) diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c index e3294457b5de..d2dd916816d4 100644 --- a/drivers/soc/ixp4xx/ixp4xx-npe.c +++ b/drivers/soc/ixp4xx/ixp4xx-npe.c @@ -155,16 +155,10 @@ static struct { static struct npe npe_tab[NPE_COUNT] = { { .id = 0, - .regs = (struct npe_regs __iomem *)IXP4XX_NPEA_BASE_VIRT, - .regs_phys = IXP4XX_NPEA_BASE_PHYS, }, { .id = 1, - .regs = (struct npe_regs __iomem *)IXP4XX_NPEB_BASE_VIRT, - .regs_phys = IXP4XX_NPEB_BASE_PHYS, }, { .id = 2, - .regs = (struct npe_regs __iomem *)IXP4XX_NPEC_BASE_VIRT, - .regs_phys = IXP4XX_NPEC_BASE_PHYS, } }; @@ -687,23 +681,34 @@ void npe_release(struct npe *npe) static int ixp4xx_npe_probe(struct platform_device *pdev) { int i, found = 0; + struct device *dev = &pdev->dev; + struct resource *res; for (i = 0; i < NPE_COUNT; i++) { struct npe *npe = &npe_tab[i]; + + res = platform_get_resource(pdev, IORESOURCE_MEM, i); + if (!res) + return -ENODEV; + if (!(ixp4xx_read_feature_bits() & - (IXP4XX_FEATURE_RESET_NPEA << i))) + (IXP4XX_FEATURE_RESET_NPEA << i))) { + dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n", + i, res->start, res->end); continue; /* NPE already disabled or not present */ - if (!(npe->mem_res = request_mem_region(npe->regs_phys, - REGS_SIZE, - npe_name(npe)))) { - print_npe(KERN_ERR, npe, - "failed to request memory region\n"); - continue; } + npe->regs = devm_ioremap_resource(dev, res); + if (!npe->regs) + return -ENOMEM; - if (npe_reset(npe)) + if (npe_reset(npe)) { + dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n", + i, res->start, res->end); continue; + } npe->valid = 1; + dev_info(dev, "NPE%d at 0x%08x-0x%08x registered\n", + i, res->start, res->end); found++; } @@ -717,9 +722,8 @@ static int ixp4xx_npe_remove(struct platform_device *pdev) int i; for (i = 0; i < NPE_COUNT; i++) - if (npe_tab[i].mem_res) { + if (npe_tab[i].regs) { npe_reset(&npe_tab[i]); - release_resource(npe_tab[i].mem_res); } return 0; diff --git a/include/linux/soc/ixp4xx/npe.h b/include/linux/soc/ixp4xx/npe.h index 3a980845e557..2a91f465d456 100644 --- a/include/linux/soc/ixp4xx/npe.h +++ b/include/linux/soc/ixp4xx/npe.h @@ -16,9 +16,7 @@ struct npe_regs { }; struct npe { - struct resource *mem_res; struct npe_regs __iomem *regs; - u32 regs_phys; int id; int valid; }; From patchwork Thu Feb 21 15:44:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49D75922 for ; Thu, 21 Feb 2019 16:11:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3183C318F3 for ; Thu, 21 Feb 2019 16:11:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F8BC31923; Thu, 21 Feb 2019 16:11:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6E8B93191C for ; Thu, 21 Feb 2019 16:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZQL8To3PTBXzkOrMaZXQ2U9i5vXYZ+6jKKSJqc19tK8=; b=LpjzI5ZpowX+rV jI87vYN2cm8E26zg2Z/FoW6XkcK2wJToOiul5dVOu5qja+rYdTE58fqoan2a5rXhq/3VMGKuAJSoE R/I7FCjEPXMdtLKr/AohfLnspGBWxyQiTagQotLqKB5NbW5V8bC8jbaKodQjX1YIutd+8qgkPT3W4 FydzWiq2Av1sR8hjmg2X523H3sArzGwGKYw+7y90yl4VMN9cjEfFKRl4cmgMFOPerpdHh9J/0ILP5 ryDg52AS0bN4GKomjVh9jLg+QtdDOWFaIe+UufM7U1JInbyUY1LocrTdMfit0R+kdLg5AzlpbTPte EOL4YTwnbWPBpM7s+gcQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqw6-0005od-Nt; Thu, 21 Feb 2019 16:10:58 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqvt-0005aI-Ah for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 16:10:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qa5OdEXYMr9IGIMIfuO/mzJWw8VwU8/eAeeOD8rGlrg=; b=M0jp9B3T6XB/6OZklHhUMwxvt0 1so0DWIjoci/euf6wRYFesOVciWuskH6ni0YIAUIyDC3vM4pvONZMcVo2jPX+TbrN4Ga32g68IgT1 iqfzcb8Ws2J1oGdE2O4asPUO42xcyzDGPpsjNIDrLGSqLxz36FZ9csF1AQPKuB3JpGDBjHNVUVMo4 B6Ii6ZZ8mrrXvEPYN3GLjmMvYbBs9orY4ZaTLtrLStsdHXG+NVKgZrJXJWwqFhTlZM/ReCl3jBIi5 4SZrxvaHykyNUBClV2u9oFyAEMnTDUukOPYi69ui6b2eQsiNbg72I+cV5pBiB5Zfb+yrE7faaugi8 zjbK7FUQ==; Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqY5-0002An-6a for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:09 +0000 Received: by mail-lf1-x141.google.com with SMTP id g12so11101346lfb.13 for ; Thu, 21 Feb 2019 07:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qa5OdEXYMr9IGIMIfuO/mzJWw8VwU8/eAeeOD8rGlrg=; b=UEWm26ss9NOF4kbW07S6Wp4jtzR4cjkl9QWbeWuwFk9zFmvl3To9gsV4l0yYaMXW+C 3mMsR6DyxUSv8U89N/mPuI3ltT18Zlchul0j8nCs0a5yzAV5X28bHNiyPzVFqQcMJIUB javYdCaXodBxvtQZDq4A6qfQr1L+x/AMloDTqH2hjRW7QDLyMVCxCZT/D8INKSS9p8ll TjG6LP4qRUcCAvHROcrZ7dpelEKhFe1sKjjcI7ElvGFWMZs07Ehuh8nLsUErZri+2bh8 1dBpduzOu9i9E6d5qltnBIguupptDJhDUGXWxfxFBm/fTyz06R1q9RIQVwfFfBMWh1Be QnAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qa5OdEXYMr9IGIMIfuO/mzJWw8VwU8/eAeeOD8rGlrg=; b=V+UtJqB2ArK2DVptqdYAOnfgHN4bDxYPHdHUjN7bhBfQoFGN6scbNbpxDnPCBmkttB XmbMGRnDXW74kbVK2/368SFkQ6DdO6dVaQQf3stm2zAFBhbH5aanQ6XjGYILwyzOS63X CuIaFdvSLV0BYlv5eSOSQyknWgCClooShUkPndMKKK6tZF4Suhir70/4XWH2N7vae+Yb W9zIdoMFl9Tq3EvPispudWhbmJkxjTGatXH5IH6DDhe7WMF2YVOlhezJIP9roYqvuOj6 9P8VI/CYQmhlhc1r42kZ1z1Ld7PK8B2wihFJoDTRFb/XUJR5NK3UCjdssxF6p/x5s+ox pWYw== X-Gm-Message-State: AHQUAubyUL0ACWdDPG39YM8VUwsMOxTZdt0tYZbi9ctDuIHkvbqx0z9p BZnM5edHiSZc8kDm0S7MWjC6f3jVh94= X-Google-Smtp-Source: AHgI3IZdqSdAv0QO3jJbJkECEaRmVrBAvlH8RcGzs/TdNFveMNXhvqBw+VaAPgRFeVx+Mf6JSN6ByA== X-Received: by 2002:a19:c396:: with SMTP id t144mr13960818lff.127.1550763966429; Thu, 21 Feb 2019 07:46:06 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:05 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 23/30 v2] soc: ixp4xx: Uninline several functions Date: Thu, 21 Feb 2019 16:44:51 +0100 Message-Id: <20190221154458.23763-24-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_104609_265586_E1128765 X-CRM114-Status: GOOD ( 15.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP These inline functions immediately exploit the static ioremaps for the queue manager memory region. This does not work with multiplatform where everything need to be dynamically remapped, so get rid of these inlines and create new exports for those used by other drivers. Signed-off-by: Linus Walleij --- drivers/soc/ixp4xx/ixp4xx-qmgr.c | 117 ++++++++++++++++++++++++++++ include/linux/soc/ixp4xx/qmgr.h | 127 ++----------------------------- 2 files changed, 124 insertions(+), 120 deletions(-) diff --git a/drivers/soc/ixp4xx/ixp4xx-qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c index 133914e99aeb..412a346136d8 100644 --- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c +++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c @@ -32,6 +32,117 @@ static void *irq_pdevs[QUEUES]; char qmgr_queue_descs[QUEUES][32]; #endif +void qmgr_put_entry(unsigned int queue, u32 val) +{ +#if DEBUG_QMGR + BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ + + printk(KERN_DEBUG "Queue %s(%i) put %X\n", + qmgr_queue_descs[queue], queue, val); +#endif + __raw_writel(val, &qmgr_regs->acc[queue][0]); +} + +u32 qmgr_get_entry(unsigned int queue) +{ + u32 val; + val = __raw_readl(&qmgr_regs->acc[queue][0]); +#if DEBUG_QMGR + BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ + + printk(KERN_DEBUG "Queue %s(%i) get %X\n", + qmgr_queue_descs[queue], queue, val); +#endif + return val; +} + +static int __qmgr_get_stat1(unsigned int queue) +{ + return (__raw_readl(&qmgr_regs->stat1[queue >> 3]) + >> ((queue & 7) << 2)) & 0xF; +} + +static int __qmgr_get_stat2(unsigned int queue) +{ + BUG_ON(queue >= HALF_QUEUES); + return (__raw_readl(&qmgr_regs->stat2[queue >> 4]) + >> ((queue & 0xF) << 1)) & 0x3; +} + +/** + * qmgr_stat_empty() - checks if a hardware queue is empty + * @queue: queue number + * + * Returns non-zero value if the queue is empty. + */ +int qmgr_stat_empty(unsigned int queue) +{ + BUG_ON(queue >= HALF_QUEUES); + return __qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY; +} + +/** + * qmgr_stat_below_low_watermark() - checks if a queue is below low watermark + * @queue: queue number + * + * Returns non-zero value if the queue is below low watermark. + */ +int qmgr_stat_below_low_watermark(unsigned int queue) +{ + if (queue >= HALF_QUEUES) + return (__raw_readl(&qmgr_regs->statne_h) >> + (queue - HALF_QUEUES)) & 0x01; + return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY; +} + +/** + * qmgr_stat_above_high_watermark() - checks if a queue is above high watermark + * @queue: queue number + * + * Returns non-zero value if the queue is above high watermark + */ +static int qmgr_stat_above_high_watermark(unsigned int queue) +{ + BUG_ON(queue >= HALF_QUEUES); + return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL; +} + +/** + * qmgr_stat_full() - checks if a hardware queue is full + * @queue: queue number + * + * Returns non-zero value if the queue is full. + */ +int qmgr_stat_full(unsigned int queue) +{ + if (queue >= HALF_QUEUES) + return (__raw_readl(&qmgr_regs->statf_h) >> + (queue - HALF_QUEUES)) & 0x01; + return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL; +} + +/** + * qmgr_stat_underflow() - checks if a hardware queue experienced underflow + * @queue: queue number + * + * Returns non-zero value if the queue experienced underflow. + */ +static int qmgr_stat_underflow(unsigned int queue) +{ + return __qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW; +} + +/** + * qmgr_stat_overflow() - checks if a hardware queue experienced overflow + * @queue: queue number + * + * Returns non-zero value if the queue experienced overflow. + */ +int qmgr_stat_overflow(unsigned int queue) +{ + return __qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW; +} + void qmgr_set_irq(unsigned int queue, int src, void (*handler)(void *pdev), void *pdev) { @@ -375,6 +486,12 @@ module_platform_driver(ixp4xx_qmgr_driver); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Krzysztof Halasa"); +EXPORT_SYMBOL(qmgr_put_entry); +EXPORT_SYMBOL(qmgr_get_entry); +EXPORT_SYMBOL(qmgr_stat_empty); +EXPORT_SYMBOL(qmgr_stat_below_low_watermark); +EXPORT_SYMBOL(qmgr_stat_full); +EXPORT_SYMBOL(qmgr_stat_overflow); EXPORT_SYMBOL(qmgr_set_irq); EXPORT_SYMBOL(qmgr_enable_irq); EXPORT_SYMBOL(qmgr_disable_irq); diff --git a/include/linux/soc/ixp4xx/qmgr.h b/include/linux/soc/ixp4xx/qmgr.h index 4de8da536dbb..bed8ee94fa57 100644 --- a/include/linux/soc/ixp4xx/qmgr.h +++ b/include/linux/soc/ixp4xx/qmgr.h @@ -57,6 +57,13 @@ struct qmgr_regs { u32 sram[2048]; /* 0x2000 - 0x3FFF - config and buffer */ }; +void qmgr_put_entry(unsigned int queue, u32 val); +u32 qmgr_get_entry(unsigned int queue); +int qmgr_stat_empty(unsigned int queue); +int qmgr_stat_below_low_watermark(unsigned int queue); +int qmgr_stat_full(unsigned int queue); +int qmgr_stat_overflow(unsigned int queue); +void qmgr_release_queue(unsigned int queue); void qmgr_set_irq(unsigned int queue, int src, void (*handler)(void *pdev), void *pdev); void qmgr_enable_irq(unsigned int queue); @@ -81,124 +88,4 @@ int __qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, nearly_full_watermark) #endif -void qmgr_release_queue(unsigned int queue); - - -static inline void qmgr_put_entry(unsigned int queue, u32 val) -{ - struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; -#if DEBUG_QMGR - BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ - - printk(KERN_DEBUG "Queue %s(%i) put %X\n", - qmgr_queue_descs[queue], queue, val); -#endif - __raw_writel(val, &qmgr_regs->acc[queue][0]); -} - -static inline u32 qmgr_get_entry(unsigned int queue) -{ - u32 val; - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; - val = __raw_readl(&qmgr_regs->acc[queue][0]); -#if DEBUG_QMGR - BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ - - printk(KERN_DEBUG "Queue %s(%i) get %X\n", - qmgr_queue_descs[queue], queue, val); -#endif - return val; -} - -static inline int __qmgr_get_stat1(unsigned int queue) -{ - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; - return (__raw_readl(&qmgr_regs->stat1[queue >> 3]) - >> ((queue & 7) << 2)) & 0xF; -} - -static inline int __qmgr_get_stat2(unsigned int queue) -{ - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; - BUG_ON(queue >= HALF_QUEUES); - return (__raw_readl(&qmgr_regs->stat2[queue >> 4]) - >> ((queue & 0xF) << 1)) & 0x3; -} - -/** - * qmgr_stat_empty() - checks if a hardware queue is empty - * @queue: queue number - * - * Returns non-zero value if the queue is empty. - */ -static inline int qmgr_stat_empty(unsigned int queue) -{ - BUG_ON(queue >= HALF_QUEUES); - return __qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY; -} - -/** - * qmgr_stat_below_low_watermark() - checks if a queue is below low watermark - * @queue: queue number - * - * Returns non-zero value if the queue is below low watermark. - */ -static inline int qmgr_stat_below_low_watermark(unsigned int queue) -{ - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; - if (queue >= HALF_QUEUES) - return (__raw_readl(&qmgr_regs->statne_h) >> - (queue - HALF_QUEUES)) & 0x01; - return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY; -} - -/** - * qmgr_stat_above_high_watermark() - checks if a queue is above high watermark - * @queue: queue number - * - * Returns non-zero value if the queue is above high watermark - */ -static inline int qmgr_stat_above_high_watermark(unsigned int queue) -{ - BUG_ON(queue >= HALF_QUEUES); - return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL; -} - -/** - * qmgr_stat_full() - checks if a hardware queue is full - * @queue: queue number - * - * Returns non-zero value if the queue is full. - */ -static inline int qmgr_stat_full(unsigned int queue) -{ - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; - if (queue >= HALF_QUEUES) - return (__raw_readl(&qmgr_regs->statf_h) >> - (queue - HALF_QUEUES)) & 0x01; - return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL; -} - -/** - * qmgr_stat_underflow() - checks if a hardware queue experienced underflow - * @queue: queue number - * - * Returns non-zero value if the queue experienced underflow. - */ -static inline int qmgr_stat_underflow(unsigned int queue) -{ - return __qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW; -} - -/** - * qmgr_stat_overflow() - checks if a hardware queue experienced overflow - * @queue: queue number - * - * Returns non-zero value if the queue experienced overflow. - */ -static inline int qmgr_stat_overflow(unsigned int queue) -{ - return __qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW; -} - #endif From patchwork Thu Feb 21 15:44:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB3341390 for ; Thu, 21 Feb 2019 16:02:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C409031822 for ; Thu, 21 Feb 2019 16:02:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B86FD3187F; Thu, 21 Feb 2019 16:02:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 56E7231822 for ; Thu, 21 Feb 2019 16:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aGAA2otBwPaQxXWZVf1sTrooS4w90ESCOX0aEfIGra4=; b=GTzImlt+7cifej w8lOc0YKLlC7iCIyqyhgvdM1HeiLcjZm3Bw1JHkduSqY+EnoAwDhrlwIRt6cwEgm08GrCn7+YS3Lh P6ecMNTbtm6WxKQAdmVi06nq576dwjg1iAiUNeBZZ8bQTz92FhXGpBTSJiON21DTBUEPdCNTp1cco 6x4lu1P+jKlgy+ddQB5X32m5ZOBhl0dqIEaAFVy4f3ePEo4E+wHydp594jWlHadGm+MAkWyyq3Qgd GrioUm6jiqicj0misUH3qnshPkKaHffQ0bkqgQYVLY4WkISVTkaRewbI3FEokix4elkrxV3UxgHIM Bg0T3BHPYh0AorAnuVMw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqoI-0001N6-W5; Thu, 21 Feb 2019 16:02:55 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqnq-0000bs-Cl for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 16:02:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KIqp1Gx+3oMFpHMW3IZBqaQXCubuSyC+vxBxyjzk0Po=; b=PQq6PdhW+AMAcZ6QuV9HB+0Ks8 6tY1bxKWKtFKnxNmZQC81PqR7ODSjCfYvHxtyUqMEdXxGvR89LI0RVtjg3njVZNtmbukjKCxZK/Xm aHGStJpBrBB+faVQVXNzqJOijOAAYr+GLPFxRmnqcV3D6HIV4/JyGjnGi6Xa5IiPOG7oHawLcJqGs ju5veunR16qZE+LpZh/3Iss5Vse7QDf7pnCe3WjZodac+8Hqyw3AilMhtWSH92nh7PnA+fGW/s1RV SdLgdz8Uy0T3W2k6fenPEyO156CwBJAEStdVizo3RnkFZYy4r//OIWW1EJYaL5G/X2WZzQIYiXPY4 iRercPdw==; Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqY6-0006rj-NR for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:13 +0000 Received: by mail-lf1-x141.google.com with SMTP id u21so20752417lfu.1 for ; Thu, 21 Feb 2019 07:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KIqp1Gx+3oMFpHMW3IZBqaQXCubuSyC+vxBxyjzk0Po=; b=QPhQxBVxbm03i/g1gHo/nR+XArGph+cG0/G59OIByzcrYLJGKAWHaUVoJZ9nxFGk7y 8ojKBCw/FGZUz/Zu8rcQbfNoTdaCGI/60SUQKlvJk/fjOlq7G/HfTekGxJRLDRYLwPWc GA35kvjcDzk28mKE3mPI3PU/95hE/IMpRqAOHSGJf8s7EM2H3RTA3yrWJYmnCTv8tZwq 1LOYKoAfhiLpGio3QIma2b2ZKi0RlwxKshDkhJO1LBD/2KuPi9janjNKQaQxlkNM0894 RQjPcQf+C0qv7FnL6RzgZ/vH0Km0ShTDP9nAx/8vIIE69NsBCGkmxS4PolMfXvk310vi fgJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KIqp1Gx+3oMFpHMW3IZBqaQXCubuSyC+vxBxyjzk0Po=; b=k0k+APKt4oBPNZbBxPPk08IlGdT5yQGTeZKvEHq214e8g8SPb9tGwK6uzzqqqd+QNR qso9OcfjNcrMSAo9jXhZ4lZtJG1HAt2mqB113x5cBC1soRFhoyTcAWA+IRQitXY4BLsT Ul0tm1x+O0/f2ru0ANKl8m6/E0B5UMwcd55RBb+mJLlz8F8jDn2o3jwm8cJo5t5L7V8H 6a2KZ70SWS1bdDBfmuFWKUd9f2zEFQFc5t6PjwilJOCRSTN8baPTo4CI/lkvDUJU8aXN rr2EO0AZPDdiANjn0aX/RJhgn4UVZ5LAy9rW/fqNd/LlDpoPpKho+6nIGz//rEmlWYLi jaUg== X-Gm-Message-State: AHQUAub6l6UJz7y1RPAlomqTB/XzhSFB+iTFJUvD9gHuTnZIwz/rOdst cI2st2mJ5Ufp40pd9ecVKoSz6b8wD6w= X-Google-Smtp-Source: AHgI3Ib/NjXJVNlUrALtfje2b3eCMe9ODDJlx6todR3+QLC2r+5qr7jU+NwtT2XWurSw3Qmi8Jv9mA== X-Received: by 2002:a19:d83:: with SMTP id 125mr23428769lfn.159.1550763968759; Thu, 21 Feb 2019 07:46:08 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:07 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 24/30 v2] soc: ixp4xx: Remove unused functions Date: Thu, 21 Feb 2019 16:44:52 +0100 Message-Id: <20190221154458.23763-25-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_154610_919757_2593306C X-CRM114-Status: GOOD ( 10.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP These former inlines turn out to be unused in the kernel. If they are needed in the future, they can be resurrected by reverting or studying this commit. Signed-off-by: Linus Walleij --- drivers/soc/ixp4xx/ixp4xx-qmgr.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/soc/ixp4xx/ixp4xx-qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c index 412a346136d8..f3775346e007 100644 --- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c +++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c @@ -95,18 +95,6 @@ int qmgr_stat_below_low_watermark(unsigned int queue) return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY; } -/** - * qmgr_stat_above_high_watermark() - checks if a queue is above high watermark - * @queue: queue number - * - * Returns non-zero value if the queue is above high watermark - */ -static int qmgr_stat_above_high_watermark(unsigned int queue) -{ - BUG_ON(queue >= HALF_QUEUES); - return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL; -} - /** * qmgr_stat_full() - checks if a hardware queue is full * @queue: queue number @@ -121,17 +109,6 @@ int qmgr_stat_full(unsigned int queue) return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL; } -/** - * qmgr_stat_underflow() - checks if a hardware queue experienced underflow - * @queue: queue number - * - * Returns non-zero value if the queue experienced underflow. - */ -static int qmgr_stat_underflow(unsigned int queue) -{ - return __qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW; -} - /** * qmgr_stat_overflow() - checks if a hardware queue experienced overflow * @queue: queue number From patchwork Thu Feb 21 15:44:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 359DC1869 for ; Thu, 21 Feb 2019 15:49:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2124731778 for ; Thu, 21 Feb 2019 15:49:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1520231786; Thu, 21 Feb 2019 15:49:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EA4A331782 for ; Thu, 21 Feb 2019 15:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e8mNGFbz21pwieT5ELVrh4YWtuKnBV5+zxcC67u8z9w=; b=rNBNuESc4bGa0y /81rdog0J+rMJLnaENFZVSKRQQcFJ8CnAPhh0DnkMs9cG7ww+VrF9BASBWWJUk+meRYKb63ttIiak ntwSh7nydlBMh7SQCzKlvWaxrO7+R78X5v1Bu+A6sqXdARMcUuT3qsIgGPLOeEzJ2QfP5jzs74TWo hfAOmeyv+L3pSSXsFWuGqKchZoPdZwpDv/lJDgOMm8o6JIM2eUOs5gwp5LcUpHKRiCV1u/ctzBRyP 4+4EoBcMMao7gcKZ0JydgRU2cLk13sTqZ7Nk2LHPzig5/JVHgsUyhF/MOB/1m6L1hBeF1o/JV2Et5 b98l/KWwQtKdzgFmK/tQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqbf-0000uL-84; Thu, 21 Feb 2019 15:49:51 +0000 Received: from mail-lj1-f194.google.com ([209.85.208.194]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqY9-00060K-Jp for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:34 +0000 Received: by mail-lj1-f194.google.com with SMTP id f24-v6so24414051ljk.0 for ; Thu, 21 Feb 2019 07:46:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wxq/g1XwOmGH57v5gJ5VN8B51U6PYBwzcFrtP8VTd60=; b=t3/fZ62aCTRO9RhWEKsJEIO4T6axSVaJtnPyDlFSLQIjX2hZYZuVwU93Wehy3UdxOD He1eA5odkLWJYh3pmIukRE9d/YCZiPDGK2wKqMMWiR6+4NwLu0keXfBX4R5Sv0Vly/he yyHeeaqhqKMNey5AtZyBcBuxBe46CWTwm22y13E4FNFqCVRL8AhHW4iOuqDKB/WcqgMx EAHmtcwhty7waiKnWMWt08wqX7W16RFG0VMNYFMhUw9sm9XM0bK8wUyljREHp4wFLL2p FG4fkYyZ4Ddz5P604CloSOOvYWy2QBh/r+PrJfwkop6DRG9ol7pYUtoVuBbRE8pAdEDD PIsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wxq/g1XwOmGH57v5gJ5VN8B51U6PYBwzcFrtP8VTd60=; b=UNzWlyBGu+hYQ9zqCQl0CPaw6CbBSBsWaACcw1s6+ptozeULtMqQBkIHAsNO/dQ94O p6bU4jEEByiBHYhLO6RaJHz3by25gdz5Dm53uJom9ZevflD71mfg3IdtcJAHCqnlpg4r cUAEGR62EPhg70rXJ8CLQdF3buOF6lUOToQMXYkBIw4dLvb8DI2lQ3ZoxD4caFISJ9DE 4nhkrx5ppAL+WAtp6r6b75PngaISoMQdMNVy0U2r09XkjuDPDVfzv1tGbsjsQ2MAafI/ AWPoTth9FN7i/KdxSMfHuGFlC6q1g4jSZhdlR2RAbedEWTfrV1qX4BO0X8arbI4oU1ve pI/Q== X-Gm-Message-State: AHQUAuYHXk48wMJGxnHh6RSfNRzWJSWS8p1f6a5JVndgDHwHNV7aZRWm xZRA/Ki6e92cl0+QZ4vzno0w/EuGeW8= X-Google-Smtp-Source: AHgI3IYIhAAljBGXr/S2/gBuOm4Y2/R1xvknOb2WWv9iJmvl5NyElxg0dl+Nbmn6wLJ3Fsy7UoWotw== X-Received: by 2002:a2e:9448:: with SMTP id o8-v6mr1468185ljh.164.1550763971045; Thu, 21 Feb 2019 07:46:11 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:10 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 25/30 v2] soc: ixp4xx: qmgr: Pass resources Date: Thu, 21 Feb 2019 16:44:53 +0100 Message-Id: <20190221154458.23763-26-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074614_403446_4CF7F853 X-CRM114-Status: GOOD ( 18.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of using hardcoded base address implicitly obtained through , pass the physical base for the QMGR block as a memory resource and remap it in the driver. Also pass the two IRQs as resources and obtain them in the driver. Use devm_* accessors and simplify the error path in the process. Drop memory region request as this is done by the devm_ioremap* functions. Signed-off-by: Linus Walleij --- arch/arm/mach-ixp4xx/common.c | 25 +++++-- .../mach-ixp4xx/include/mach/ixp4xx-regs.h | 2 - drivers/soc/ixp4xx/ixp4xx-qmgr.c | 71 +++++++++---------- 3 files changed, 55 insertions(+), 43 deletions(-) diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 07c3cb312a92..cc5f15679d29 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -66,11 +66,6 @@ static struct map_desc ixp4xx_io_desc[] __initdata = { .pfn = __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS), .length = IXP4XX_PCI_CFG_REGION_SIZE, .type = MT_DEVICE - }, { /* Queue Manager */ - .virtual = (unsigned long)IXP4XX_QMGR_BASE_VIRT, - .pfn = __phys_to_pfn(IXP4XX_QMGR_BASE_PHYS), - .length = IXP4XX_QMGR_REGION_SIZE, - .type = MT_DEVICE }, }; @@ -176,9 +171,29 @@ static struct platform_device ixp4xx_npe_device = { .resource = ixp4xx_npe_resources, }; +static struct resource ixp4xx_qmgr_resources[] = { + { + .start = IXP4XX_QMGR_BASE_PHYS, + .end = IXP4XX_QMGR_BASE_PHYS + 0x3fff, + .flags = IORESOURCE_MEM, + }, + { + .start = IRQ_IXP4XX_QM1, + .end = IRQ_IXP4XX_QM1, + .flags = IORESOURCE_IRQ, + }, + { + .start = IRQ_IXP4XX_QM2, + .end = IRQ_IXP4XX_QM2, + .flags = IORESOURCE_IRQ, + }, +}; + static struct platform_device ixp4xx_qmgr_device = { .name = "ixp4xx-qmgr", .id = -1, + .num_resources = ARRAY_SIZE(ixp4xx_qmgr_resources), + .resource = ixp4xx_qmgr_resources, }; static struct platform_device *ixp4xx_devices[] __initdata = { diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h index f5d5b258c3f7..588b76651085 100644 --- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h +++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h @@ -43,8 +43,6 @@ * Queue Manager */ #define IXP4XX_QMGR_BASE_PHYS 0x60000000 -#define IXP4XX_QMGR_BASE_VIRT IOMEM(0xFEF15000) -#define IXP4XX_QMGR_REGION_SIZE 0x00004000 /* * Peripheral space, including debug UART. Must be section-aligned so that diff --git a/drivers/soc/ixp4xx/ixp4xx-qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c index f3775346e007..64572f2d6ff0 100644 --- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c +++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c @@ -16,13 +16,9 @@ #include #include -/* FIXME: get rid of these static assigments */ -#define IRQ_IXP4XX_BASE 16 -#define IRQ_IXP4XX_QM1 (IRQ_IXP4XX_BASE + 3) -#define IRQ_IXP4XX_QM2 (IRQ_IXP4XX_BASE + 4) - -static struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; -static struct resource *mem_res; +static struct qmgr_regs __iomem *qmgr_regs; +static int qmgr_irq_1; +static int qmgr_irq_2; static spinlock_t qmgr_lock; static u32 used_sram_bitmap[4]; /* 128 16-dword pages */ static void (*irq_handlers[QUEUES])(void *pdev); @@ -190,7 +186,7 @@ static irqreturn_t qmgr_irq2_a0(int irq, void *pdev) static irqreturn_t qmgr_irq(int irq, void *pdev) { - int i, half = (irq == IRQ_IXP4XX_QM1 ? 0 : 1); + int i, half = (irq == qmgr_irq_1 ? 0 : 1); u32 req_bitmap = __raw_readl(&qmgr_regs->irqstat[half]); if (!req_bitmap) @@ -381,12 +377,25 @@ static int ixp4xx_qmgr_probe(struct platform_device *pdev) { int i, err; irq_handler_t handler1, handler2; + struct device *dev = &pdev->dev; + struct resource *res; + int irq1, irq2; - mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS, - IXP4XX_QMGR_REGION_SIZE, - "IXP4xx Queue Manager"); - if (mem_res == NULL) - return -EBUSY; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + qmgr_regs = devm_ioremap_resource(dev, res); + if (!qmgr_regs) + return -ENOMEM; + + irq1 = platform_get_irq(pdev, 0); + if (irq1 <= 0) + return irq1 ? irq1 : -EINVAL; + qmgr_irq_1 = irq1; + irq2 = platform_get_irq(pdev, 1); + if (irq2 <= 0) + return irq2 ? irq2 : -EINVAL; + qmgr_irq_2 = irq2; /* reset qmgr registers */ for (i = 0; i < 4; i++) { @@ -411,43 +420,33 @@ static int ixp4xx_qmgr_probe(struct platform_device *pdev) } else handler1 = handler2 = qmgr_irq; - err = request_irq(IRQ_IXP4XX_QM1, handler1, 0, "IXP4xx Queue Manager", - NULL); + err = devm_request_irq(dev, irq1, handler1, 0, "IXP4xx Queue Manager", + NULL); if (err) { - printk(KERN_ERR "qmgr: failed to request IRQ%i (%i)\n", - IRQ_IXP4XX_QM1, err); - goto error_irq; + dev_err(dev, "failed to request IRQ%i (%i)\n", + irq1, err); + return err; } - err = request_irq(IRQ_IXP4XX_QM2, handler2, 0, "IXP4xx Queue Manager", - NULL); + err = devm_request_irq(dev, irq2, handler2, 0, "IXP4xx Queue Manager", + NULL); if (err) { - printk(KERN_ERR "qmgr: failed to request IRQ%i (%i)\n", - IRQ_IXP4XX_QM2, err); - goto error_irq2; + dev_err(dev, "failed to request IRQ%i (%i)\n", + irq2, err); + return err; } used_sram_bitmap[0] = 0xF; /* 4 first pages reserved for config */ spin_lock_init(&qmgr_lock); - printk(KERN_INFO "IXP4xx Queue Manager initialized.\n"); + dev_info(dev, "IXP4xx Queue Manager initialized.\n"); return 0; - -error_irq2: - free_irq(IRQ_IXP4XX_QM1, NULL); -error_irq: - release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); - return err; } static int ixp4xx_qmgr_remove(struct platform_device *pdev) { - free_irq(IRQ_IXP4XX_QM1, NULL); - free_irq(IRQ_IXP4XX_QM2, NULL); - synchronize_irq(IRQ_IXP4XX_QM1); - synchronize_irq(IRQ_IXP4XX_QM2); - release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); - + synchronize_irq(qmgr_irq_1); + synchronize_irq(qmgr_irq_2); return 0; } From patchwork Thu Feb 21 15:44:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFCF06C2 for ; Thu, 21 Feb 2019 15:50:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCB8A317E2 for ; Thu, 21 Feb 2019 15:50:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA88E317F8; Thu, 21 Feb 2019 15:50:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5752C317F0 for ; Thu, 21 Feb 2019 15:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GyH8SCdSE7nZQJQe/C361LWSDorcUf8/CsLoNIBPhYQ=; b=Am/CHKhDTGsim3 uSyZ1qvyRouVsypbDhDYgimAdvDeBGGKHHVAQVgAf9JFxx2ME9KtPngGjhaUJTQLNw5P86sqtbkvY GwA+ZRPuWt9urI4qbJXBTz9vsVw5aB0S1dkokqGYDQ3N5nyQUFnIWoRRqhRPvCt3cimqZfflR5a5+ NuX/D15b4K78w3qAi54Qk7XxdwmNcTYIp3WciQsYiGfDjTNemEjfKTaqIQlbHqSsCoWkTn4fT/YeR YvEh3nR01SScQF/yRB7bOq8rAQqbYZBwePLiO9qn4cy/Kpdm7hz3aTCbtDNqBfsgPYSZNw++1HN1H KLnhJTNYExIWTIud8XTA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqbr-0001Bw-Bo; Thu, 21 Feb 2019 15:50:03 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqYC-00064Z-QO for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:35 +0000 Received: by mail-lf1-x144.google.com with SMTP id v7so20718990lfd.2 for ; Thu, 21 Feb 2019 07:46:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9AKPZy57Xp9MQSyeUW4oZ24ugkhPxGm7E69P5yoWAno=; b=VgT5Q5gZ6OYWE6AeqseGL6S8SaOvXfHHkv8k5YlbUuE+MZRsuySHbszh1H5PFb2Frs K7WZi46mSmnhmLL7ZrJLdYSTZ+Ue7/ZH6wY4M8UbS2nfQjDuxgF0rhWooP8rA03OXVD+ 9DHvMg8B7hWaAGgTyR3gjzXvAD3I1Kp19sEND5DrcWx9lzGNeVVjEC6LxoDI/slLWOtD 1YzSqmRYaxyfJjubNCH24KM5IqnFAd/DKnG68t88FuVOM+RvUf0CDX2egNMwBl4vzbqZ ChOSA+vRoL09Re/TyudmNNBaGXqqyNNEwzgUo+SuiIFRJob/09W0wfcaOF6QkLLIX+3v VSEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9AKPZy57Xp9MQSyeUW4oZ24ugkhPxGm7E69P5yoWAno=; b=SZZRkDgtaYau3BdhYgxZmwgq+5wvLo0JYjYejkfxXKuZIPhv40o/xpQVisPiM9OZ4K 9AStXczpNe+X5HUY17HpbQQpeW7DFize7EwKF5skkicdGk28J++61+N7WbrHASEkSoOO GzaokMFHr8LDBqpKBT6PrxQnIBLD5qaDh7+59Gaz8G3/UcEZPeVczAHvWWRhNe0v4PmH 0YsPOgiLH/S4U2ZdbSdPZ9SDbuN3nzavwqzBDwSkrgQvK+Z0s5nsZZWx1aEnS3EV99sk I0LsR1j4TRfEzN0tatnShw0IT00bXSMQ7e7Le0RxQ1T+6ygkW6Dl45V5hXD2uFG3uzni IQSw== X-Gm-Message-State: AHQUAuYgG886QanS4OEbOQnKY+/+M4vf330UIyDmyOJSKtxdJXX6ZcAd 3z67aBTdfgtcGe05+DEzwE58NXzB6FU= X-Google-Smtp-Source: AHgI3IaxYEcQy4sNY9o7Tmpb4DLH9VE83aVHvAXWsOxHOaOhXmnkOSGbvjC6rekwrZ9Kxs+ZW+piew== X-Received: by 2002:ac2:5183:: with SMTP id u3mr24292418lfi.153.1550763973564; Thu, 21 Feb 2019 07:46:13 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:12 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 26/30 v2] soc: ixp4xx: Add DT bindings for IXP4xx NPE Date: Thu, 21 Feb 2019 16:44:54 +0100 Message-Id: <20190221154458.23763-27-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074617_275280_4D7E7EBD X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds DT bindings for the Intel IXP4xx Network Processing Engine (NPE). These are three firmware-executing units found in the IXP4xx SoC. These bindings use YAML. Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij --- ...ntel,ixp4xx-network-processing-engine.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml diff --git a/Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml b/Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml new file mode 100644 index 000000000000..8cb136c376fb --- /dev/null +++ b/Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 Linaro Ltd. +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/firmware/intel-ixp4xx-network-processing-engine.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Intel IXP4xx Network Processing Engine + +maintainers: + - Linus Walleij + +description: | + On the IXP4xx SoCs, the Network Processing Engine (NPE) is a small + processor that can load a firmware to perform offloading of networking + and crypto tasks. It also manages the MDIO bus to the ethernet PHYs + on the IXP4xx platform. All IXP4xx platforms have three NPEs at + consecutive memory locations. They are all included in the same + device node since they are not independent of each other. + +properties: + compatible: + oneOf: + - items: + - const: intel,ixp4xx-network-processing-engine + + reg: + minItems: 3 + maxItems: 3 + items: + - description: NPE0 register range + - description: NPE1 register range + - description: NPE2 register range + +required: + - compatible + - reg + +examples: + - | + npe@c8006000 { + compatible = "intel,ixp4xx-network-processing-engine"; + reg = <0xc8006000 0x1000>, <0xc8007000 0x1000>, <0xc8008000 0x1000>; + }; From patchwork Thu Feb 21 15:44:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9737A1390 for ; Thu, 21 Feb 2019 16:10:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 815243184B for ; Thu, 21 Feb 2019 16:10:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F75231904; Thu, 21 Feb 2019 16:10:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2AA5F31906 for ; Thu, 21 Feb 2019 16:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+ACdPi2QEIynzCZOy9LJYKrIgMBMK3c3qqK91vWl0HY=; b=l3753fSdiRC5LY IwOPzxabuuj3ot6t/9C8pNeEv9WlYwaty7ofFQuYQijlhgZ+TTxx1QELvUvsWo2MeFkQQslUoHPKg GwcvA/nCHODeOVb9xspkE+xOi+Bp6w9yWfi2vStaNtGPu8wyGDQXbsTbQ1r72JZ2VhQGQ8wUrVzoV IjmjzOUEFjDpTILQtUEEuOVhgPyTAVsXmVXVvsCitX+3g7sOLe2XiRJQNvRXAD/3PkwGlJH+yE8pI XeYGmIhPylFAOK5CfrJDo+AKR9+X8ZrNow3RXQws5B5t6rZxWDUWSq25cDAUW07JK3n/FwRbyPb2b 1IJhABnBEACW6Zi76MMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqvu-0005ai-0S; Thu, 21 Feb 2019 16:10:46 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqvr-0005aI-Rb for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 16:10:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FipZr1PzKuQJl1qKT0T1UxV+PsiN09U6vluBtBA1GLs=; b=nRlgadlyHj9LvDOSv+GQZFaTVo AJ38CsrM2tPVRAudGkZYv990yhUmvWPVw02Zb18KKT6bSEoNhj5zFueIiT/hehAD9npp/+4+xz3F9 Z4mR5cWT4jjuawJ3lUhILqS3Ryfe+LmJlsByJlVLOWpDYCM+LQ+TVoTbCfEW/iTLngMa6fNXnBKAR 1hw0MNwx4mKFBOHPZTEuoh9xKifFX0u0F4+BrNLuGNA4uj9ARnD77oIe/FUzcwPMcGnwXlMn4jtAd f3h17O9yT3GwUFY51jbsja440YBOqvqM+qNUm1LrmlIwiZrFg23DP/0c+cvPi4ucInP8hApJpLX1z wSy1AzoQ==; Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqYF-0002BK-Ak for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:20 +0000 Received: by mail-lj1-x243.google.com with SMTP id s5-v6so24330180ljd.12 for ; Thu, 21 Feb 2019 07:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FipZr1PzKuQJl1qKT0T1UxV+PsiN09U6vluBtBA1GLs=; b=Hpk3EXjQlE8cG9rT3tHsQA+3OGA7djd1QJB+tPozpaAdsKTNRSMIJTc17meyrFs3dw z7jasyR+Ts2cMhcX2YqUG3kiR2ZTrnyBlmq5PDRYWDWv0jaCzzR+l+ZSW/rkLLDu3NPl CdrFLkovlasST8+Mur0Q/5A51pegt+5ENonN4iAEj1Cs09uVcKlWHLx3nwwklqyGcglo FRjEVSDSqfffVMJqEUTRNG2j+5SoRmGtOHzfaSMMIkeMyjfs1gQeZUzuWoTdk5AHyxwz VCnzSOzNw96J1WLGEXCYJ3TiHRA1NZX2z8JTz0Sz81lEXn8q/RCaqKxlMh1wCWm/Bni6 fl0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FipZr1PzKuQJl1qKT0T1UxV+PsiN09U6vluBtBA1GLs=; b=gRosCUL1aghLevRKvD85B8INHM4LhCnBeOHWXxasliFGa0e3f9sjOgR4+7uudEUQjP kXiAIqtKL3cBAG9X8QvHIB69e8JY9dsRQPI5OFch5dGTnQD9aqGQ7pcRdmhVe35k4LC/ 59/owuea/rLItnVxGUdPJQ8zOGDee6lxDUHZAFRwxO1BjM8uOsl6wtWmSeDfIhuI8kFJ Sc1/TxS2r4tCLVjJwY2OvJTGM3Gi2CwpNZ5tUSexvQLbJw/xcxtUupLjPqKMuT6oH6lo kC7K/M4BYrLCaeXWo4ZSLEM30eY6J8N8wyGFeZUkI0kFa6cmlUgwnnKBr+Ih5iQK+Si6 hsnQ== X-Gm-Message-State: AHQUAuaiVgKmqFNZcXy1L7jhxXJ4OQDXS0qJt6sPMOtxT7JM7sKCYVnf dNhjDTfCcWSox1e5w13Zt1Jk4ulNuGs= X-Google-Smtp-Source: AHgI3IYeiWakzLi5p68HYAN0tJG501oXpNunsQbhyQt+iSLOpviffXCAHWu7looOviZX2cEcb3UaZg== X-Received: by 2002:a2e:9793:: with SMTP id y19mr2280180lji.194.1550763976664; Thu, 21 Feb 2019 07:46:16 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:15 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 27/30 v2] soc: ixp4xx: npe: Add DT probe code Date: Thu, 21 Feb 2019 16:44:55 +0100 Message-Id: <20190221154458.23763-28-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_104619_416019_6D124959 X-CRM114-Status: GOOD ( 14.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This makes the NPE driver able to probe from the device tree. It only needs to get three memory resources and the plaform device provide these, so all is pretty simple. Signed-off-by: Linus Walleij --- drivers/soc/ixp4xx/ixp4xx-npe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c index d2dd916816d4..15979d4376ab 100644 --- a/drivers/soc/ixp4xx/ixp4xx-npe.c +++ b/drivers/soc/ixp4xx/ixp4xx-npe.c @@ -729,9 +729,17 @@ static int ixp4xx_npe_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id ixp4xx_npe_of_match[] = { + { + .compatible = "intel,ixp4xx-network-processing-engine", + }, + {}, +}; + static struct platform_driver ixp4xx_npe_driver = { .driver = { .name = "ixp4xx-npe", + .of_match_table = of_match_ptr(ixp4xx_npe_of_match), }, .probe = ixp4xx_npe_probe, .remove = ixp4xx_npe_remove, From patchwork Thu Feb 21 15:44:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D9AA1805 for ; Thu, 21 Feb 2019 15:50:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A88031808 for ; Thu, 21 Feb 2019 15:50:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4545F317D4; Thu, 21 Feb 2019 15:50:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8B033317F0 for ; Thu, 21 Feb 2019 15:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qh105/vIKdAI6zlVT1oJRhrSXgjN8vzuN+lNano0yqs=; b=d6/XQV8RzvIXa4 8o5J1MWcG/iTvlw48m4f8NJEkBdZD1A7b71U/MO9PF+BtCjvSTXTy4ebGy9ZMWKRzreC/Iqi7T004 nmRD0jyY/yXvbrDKh8NCmhjHkkieijgmPfxdqfVxGHFQAokMsmnUAJ1sa0RyO/5iC95aKVJCu6oxs VYiuXudbPRBigZK1KtTaDRe3N08sirAyUfLu5lPA4h+dP9k+tW1PIQ0Sf11jxWKXcqtQxKjL9wq77 WTGFVHKt7jxaSEWx0muB++Vk55aOERIaDwdGwlq0OSxcqs8Y1Z2AkPRVA0IfjDsK0Kf9ka+5RGEau g0GIARLkHSv/XpEu02aQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqc6-0002cu-8B; Thu, 21 Feb 2019 15:50:18 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqYH-0006AQ-IF for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:37 +0000 Received: by mail-lj1-x243.google.com with SMTP id v16so24368862ljg.13 for ; Thu, 21 Feb 2019 07:46:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lg7YL4rHndwDCrRxPsXDrWFsjfxlwxbyihlkIAGrRzI=; b=sNakXodk/ShNGnRclW/54m3+Tjj+LeFwB4THdg93gKM2eY1OePWEwX1YLdEUuIamy4 1SZY4YTo78nm2wugtfvH4IF635ZM4an5QS7JqgwBSBU2NL1o7iKuMa0nsSDCzZOxIvR7 0xCpO7dZKjf8AlAtsBU6yqb/UNilQ3rUy/FFrVkC5QH1+L1gsjA9dmiCtDJpK0lS7pyg Vkhvvh+XPr7OPm1VR5FxLM8IlLlSOws7LBlOB/e/L9N13Njdlo9Nc/+4jmGuFac31NGD 6yKI2q9zAUI4n5/kk0mSegt5qodGCl+V2pOAkrI/q5OPrg4oDrVUOXP1XPxfltDAJ2xa ELXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lg7YL4rHndwDCrRxPsXDrWFsjfxlwxbyihlkIAGrRzI=; b=kOfix2MXQ0nP1+gH6HPpwjAsFnHSYDsUbTIDLs/Akovy0tZH8wCKJPllQkMVqxLgvf 8XO5Gd6iPfqTKsQ1d4GrY24v8ztrzBHmkumPqPfMgU+10fkM6EDhDkCo8dm+AyEi+Ryp Abv5FXiUvy6iQoZ47BTEicbffMCv/nycZXz9eIZyBF/wK+fx/KAK4RHv1n9i/U7S96oi r2HkMTw0fvzEv7NL1+GBqNbgJjlYaktanPshdbXLNkKrMtMMPGyuSfpChxIP0Tu5YJgy x3FETAFUijqTK/rS93/phgLGY/fS91Q88PQhc8DAL92qRIoJ46dbRvDjwy7zpGk1CJ3k Qp5A== X-Gm-Message-State: AHQUAubQUM45KvYoyqrKwVDUW7k1vs3nVgl4qDdiUwJ2T902q+FxoL/Y OAYqH3ujydli960Ey2nqlOfpaL0/NyA= X-Google-Smtp-Source: AHgI3IasHGq3p+GKRu8zS+xzxOTK2Er/noLd/bQVOqctmoRhnO79xgGQvSzLo2RFzpM1/qTEAVEXWA== X-Received: by 2002:a2e:4784:: with SMTP id u126-v6mr24103823lja.124.1550763979328; Thu, 21 Feb 2019 07:46:19 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:18 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 28/30 v2] soc: ixp4xx: qmgr: Add DT bindings for IXP4xx qmgr Date: Thu, 21 Feb 2019 16:44:56 +0100 Message-Id: <20190221154458.23763-29-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_074621_938169_E21F2A82 X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds device tree bindings for the Intel IXP4xx AHB Queue Manager. Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij --- .../misc/intel,ixp4xx-queue-manager.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml diff --git a/Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml b/Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml new file mode 100644 index 000000000000..c324860bede5 --- /dev/null +++ b/Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 Linaro Ltd. +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/misc/intel-ixp4xx-ahb-queue-manager.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Intel IXP4xx AHB Queue Manager + +maintainers: + - Linus Walleij + +description: | + The IXP4xx AHB Queue Manager maintains queues as circular buffers in + an 8KB embedded SRAM along with hardware pointers. It is used by both + the XScale processor and the NPEs (Network Processing Units) in the + IXP4xx for accelerating queues, especially for networking. Clients pick + queues from the queue manager with foo-queue = <&qmgr N> where the + &qmgr is a phandle to the queue manager and N is the queue resource + number. The queue resources available and their specific purpose + on a certain IXP4xx system will vary. + +properties: + compatible: + oneOf: + - items: + - const: intel,ixp4xx-ahb-queue-manager + + reg: + items: + - description: Queue Manager MMIO range + + interrupts: + minItems: 2 + maxItems: 2 + items: + - description: Interrupt for queues 0-31 + - description: Interrupt for queues 32-63 + + '#queue-cells': + const: 1 + +required: + - compatible + - reg + - interrupts + +examples: + - | + #include + + qmgr: queue-manager@60000000 { + compatible = "intel,ixp4xx-ahb-queue-manager"; + reg = <0x60000000 0x4000>; + interrupts = <3 IRQ_TYPE_LEVEL_HIGH>, <4 IRQ_TYPE_LEVEL_HIGH>; + #queue-cells = <1>; + }; From patchwork Thu Feb 21 15:44:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B34BD139A for ; Thu, 21 Feb 2019 16:02:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A041930B4E for ; Thu, 21 Feb 2019 16:02:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 944AA31818; Thu, 21 Feb 2019 16:02:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4903D30B4E for ; Thu, 21 Feb 2019 16:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=prGcoYKQLZy7G1ogaht7x9Q5sgWx0uZLdtgnxUyE9hw=; b=EvOsV+okB1WvBM DMNS9sKk1F6vn7NdPHUAtZi/nsB5Qsaw/jyxpHulm4Awhwauzj/fv+1lKX4LPNV+NhFXB2jvOdQ54 8XlgN36fBC1ILgnSeiOWQ/o/qFhkq1iux7uhlozbyJgexHsbjV6Tu4DlGtmv7dVm++yIT5X8j7UIj pPCjyaQXbiLld+ztxK1Ue1ai3c6rJ6rpmD4AeYDXKQnXAy/Y0H9MdQsrO0SayQhNeaqOh9Jl6syzu l+imKHDPS7b0vWs83ZMMqra/KSXKwwQKAeT9JyrhUmAOZZIT1Oi2Akknv7aFGORJolet0/lcowczP YOlYhaDo/7oR3U6JRBBw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqo7-00016h-IV; Thu, 21 Feb 2019 16:02:43 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqnp-0000Kw-60 for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 16:02:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TR9y9p4XuG21sRwnQp+UPGznCUiWWNyC0irrLHYfFJ8=; b=uj39mhEx9iPBZy1cYyUuO2+/hI XCRjnJ+oOuQihsi1hjOt6aD/ehO8wZdyqzvdAuN2+MdLdSJySYhlPZp2jGqdLxNyOJFj6xBKdSlqb mJonC95uJB0rf+ihpN0ERwEtrOJcy/Y2YGVFiqwf2db9T7hVTzN8QRhjvN6x/q7BSk+tQHlyDttIl x4ug+i6EjhV4eRjM8UBG3Q7zm6ddxyoDj8qAbB7URrPKYXJIr4Cl3V7XrunStsR5GO79QEr/xTJyE hBhx+BV46l2g0uTZ9bXjMVTBOXqyrGq0VE3YJV6XQAhoUPo5FkHaz02AupioMan0D/DCISrXCSSrY VVsNgH6w==; Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqYJ-0006sq-8e for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:24 +0000 Received: by mail-lj1-x241.google.com with SMTP id d14so13227979ljl.9 for ; Thu, 21 Feb 2019 07:46:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TR9y9p4XuG21sRwnQp+UPGznCUiWWNyC0irrLHYfFJ8=; b=HyUxa4koWJFV+WqP6/RKk7GykhBNMLAt/Ch3VMJyU0i9GCHMVloU0azKlGiFkmmotR 3CMMkz+E0BTxP7Z1I2c3LGZ1+0owBqB1HQlDVNQdRZghezzAZTb2GNjNASHfUmuBS6vQ D4CzDdaHfNNVjidoQueEA3mgswKS25HNXO9C894s8B+o0KMz0MINo5ZpOCVxjVbBZ0qW 6EZ7py1YKlFmgVI09gXgG41giMpKeE3ejg+1XB1YygPKFNDUrMXatRUZuzkM5xS2+n5/ AJA1Ru+cgovg1g30Y2GP2khk9AVDZeu74U3uHYa12ZwsEheP+j7Y+kVuqc+01JpFGBvZ /KZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TR9y9p4XuG21sRwnQp+UPGznCUiWWNyC0irrLHYfFJ8=; b=ETjICweUmfRx8rugrdV6VvbA3P0mTi0EE/G8IDrWuulkRsbZU+vvke852ZVwSi8gD1 MhIe3HMLI/tyWlMUDXZQsh01YSnenT88hi2yql+VLHenEO6bYvNyS8J+Fxa6ftKM7/vC /7w3+iz0eFNozy7mfljOlfTtNG/mYQYVT0BgqSVBH4u7/ekBUg+VhNB5lO3FrdfOUkbO fKwe7hRdxil8fEPN2cXl46qm3JJZfdplkeO0gCJJxnoW2Vtpk7w02PwmuSLPznIREyaa aIRKq+GNi0c0QK8e1+ANpD6WFGin0pVG+VRUJeQJNRzCSSqd+IwkYWqLIJZYObv3nrax /Hyg== X-Gm-Message-State: AHQUAuZVfqvibNBYloLmHhHB57nCz3lnMhMngJLQVmc5Cyqwp6hLl4L7 Oq2b99QjL40Icnj1YePhcr0aENhcb80= X-Google-Smtp-Source: AHgI3IZuuy7CYURzsSfKTRQxtfri25ygBQoR/HukK6s6ag38lwLhNzZxKpqMV6f2u3hTeNW5heHKOw== X-Received: by 2002:a2e:890b:: with SMTP id d11mr5090318lji.174.1550763981495; Thu, 21 Feb 2019 07:46:21 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:20 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 29/30 v2] soc: ixp4xx: qmgr: Add DT probe code Date: Thu, 21 Feb 2019 16:44:57 +0100 Message-Id: <20190221154458.23763-30-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_154623_328432_29D861A0 X-CRM114-Status: GOOD ( 16.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This makes the queue manager driver able to probe from the device tree. It only needs to get a memory resource and two interrupts and the platform device provides these as resources, so all is pretty simple. Signed-off-by: Linus Walleij --- drivers/soc/ixp4xx/ixp4xx-qmgr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/soc/ixp4xx/ixp4xx-qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c index 64572f2d6ff0..13a8a13c9b01 100644 --- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c +++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c @@ -450,9 +450,17 @@ static int ixp4xx_qmgr_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id ixp4xx_qmgr_of_match[] = { + { + .compatible = "intel,ixp4xx-ahb-queue-manager", + }, + {}, +}; + static struct platform_driver ixp4xx_qmgr_driver = { .driver = { .name = "ixp4xx-qmgr", + .of_match_table = of_match_ptr(ixp4xx_qmgr_of_match), }, .probe = ixp4xx_qmgr_probe, .remove = ixp4xx_qmgr_remove, From patchwork Thu Feb 21 15:44:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10824289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36247139A for ; Thu, 21 Feb 2019 16:02:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22F7C30B4E for ; Thu, 21 Feb 2019 16:02:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 171643178D; Thu, 21 Feb 2019 16:02:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B297E30B4E for ; Thu, 21 Feb 2019 16:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=O5HxfACUXEtfmfxx3oieGgsXSvuauuQfHRPNrU2vCKI=; b=bckFgKZSfLzbbd /NwFmQn7g25/0Oi3dp9g0msel0kwbFh63ycT5QllId8FxGj+4gYncUP2yQoZZlJ83rbJlb/02wetc eRbGSDrlGGg1czPeW2k+UMCxvmOb+C1ocPaGJbhasGJDypHXqKVTU3kpKog4/wUFoCzjBK1Z+fBgm FTxJAfJqVUTBR+eY90lwiFwCF13/YTTqIll/ES5jM4CdcDsN/m0x2i8efeluXHmEWntQzA3paiv9c X8lcFPoaBYmg5s40QMlmesXOJiN1dRIAqh1oz7FsXsCTQbpB0sD2KLoDda4D5l8yL1/kSSmUDOArE HpF4j73WGFJrrhMidwng==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqny-0000w1-RZ; Thu, 21 Feb 2019 16:02:34 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqnm-0000Kw-Nn for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Feb 2019 16:02:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iBfu8JiW0KblxSgvppeS9hOf7r89GcJL5ioxOOVRNN8=; b=UzvBA2WvHepyUAeP+k2YD1vjy9 Hiiojjo2tgj3mlklpGG6hvmcOL8dyBVkydRPYbkUEao7u10n7ogBpl4pES3fCyysIEHR6SIg/z6Kq 04g4Eo8DJtIU7lJe1FdTpyS0iuF+AGsq5EBhBxYwn9lceDQ+83wI84wKDVNNn/fT4z0dXrSN+ENJr i5TTbBew6COUXcLUlFSsxLONw5G5jXDnzZf9Cvq0RRTpo2H6w4pHUDjNJcK1BrOdnTTsiVCc/DoAP fN6g3vhVLRx8S7VZ6xUTuG1Q6rqkMx9TM5AR49QdkGW2snUa2QQKs1knsnZNaCDD36tnAd91T6/YL vEMZ14Hg==; Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqYL-0006tl-EI for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2019 15:46:26 +0000 Received: by mail-lj1-x241.google.com with SMTP id f24-v6so24414653ljk.0 for ; Thu, 21 Feb 2019 07:46:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iBfu8JiW0KblxSgvppeS9hOf7r89GcJL5ioxOOVRNN8=; b=kmOYJFEo8MpZ5ILZS51hnwLHxYHsTO2hEZivsMVB/ygYs7Z+Ip8Dvank6vE3oskVcW kpxeMWqaRNSyWkBPsGTICk5A2Lr5I6EtXMV9g9SzsrkchDCCU8bb+gQmdMGdifOiyUdj ZkO5oKhHuKlGZf09aoaxNBDi41r5sFCPYyutoidACuD0rigX4XCV2z/UWcVYZ+bxFHOc GIV+5ShZla0erxpw3XGLWpuIqbcSJPYloV9OdccqmvbtuXprcaSIx1zVPGL+DA/iTGJk UZNqxw8bDq7gC3u2XsJK98bQRgVrPTvmVR32cclB2w8CVdVvhLvpRUMAIto0s73TBO3B 5d7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iBfu8JiW0KblxSgvppeS9hOf7r89GcJL5ioxOOVRNN8=; b=I+RnHi1D7dFc90z+w+1pVjudL6r6ZnYddkimsxBkRIIbwXEohteBDQeYdaYlfC4a6i 0L/6gXgEt2aoGwoR5KdFOJYRQluslj1Yngjg9pvLaxZA3g1qO+AKGHADdj9tJLEcL2IW 1d4r3B9B3XNA6Stszys67T8vCecpvjxxHJBR6KkhuuQcc7kxHl+UJ1p4S0BTZ3so01Xg nfSoLxexQ4lqaUGy1T8DFBOzVzEZZcSRzTYteeeYsGHoUSaYaVLSP57NrF2dmGqV6xqq 0Evwb/sVoab27KoGvo3nVAjNEsHs8Eo/EHJw2FBdBCMtVQlFplMfV5DEDEjNg+R62sEd 454w== X-Gm-Message-State: AHQUAuYIE22vi9yx29R3rfamG45d97Mw8cScInA+3rRAOqcKpJAo/115 zLVe9ItlIyIy1+jcP7CPUivTy5L7voU= X-Google-Smtp-Source: AHgI3IYpXZIRVPke1fUnkMeNVRiHyyb/3Vd0YmA9dIA4HXEXaxws6lDPxfvEd2NvmpPgqxfkYcCSdw== X-Received: by 2002:a2e:6801:: with SMTP id c1mr13805731lja.81.1550763983791; Thu, 21 Feb 2019 07:46:23 -0800 (PST) Received: from linux-2.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m73sm1316965lfa.65.2019.02.21.07.46.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 07:46:22 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 30/30 v2] ARM: dts: Add queue manager and NPE to the IXP4xx DTSI Date: Thu, 21 Feb 2019 16:44:58 +0100 Message-Id: <20190221154458.23763-31-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221154458.23763-1-linus.walleij@linaro.org> References: <20190221154458.23763-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_154625_513298_FF6DDCDE X-CRM114-Status: GOOD ( 11.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The AHB queue manager and Network Processing Engines are present on all IXP4xx SoCs, so we add them to the overarching device tree include. Signed-off-by: Linus Walleij --- arch/arm/boot/dts/intel-ixp4xx.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/intel-ixp4xx.dtsi b/arch/arm/boot/dts/intel-ixp4xx.dtsi index 9edd49509af8..96a5a02f7ba9 100644 --- a/arch/arm/boot/dts/intel-ixp4xx.dtsi +++ b/arch/arm/boot/dts/intel-ixp4xx.dtsi @@ -14,6 +14,13 @@ compatible = "simple-bus"; interrupt-parent = <&intcon>; + qmgr: queue-manager@60000000 { + compatible = "intel,ixp4xx-ahb-queue-manager"; + reg = <0x60000000 0x4000>; + #queue-cells = <1>; + interrupts = <3 IRQ_TYPE_LEVEL_HIGH>, <4 IRQ_TYPE_LEVEL_HIGH>; + }; + uart0: serial@c8000000 { compatible = "intel,xscale-uart"; reg = <0xc8000000 0x1000>; @@ -54,5 +61,10 @@ reg = <0xc8005000 0x100>; interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; }; + + npe@c8006000 { + compatible = "intel,ixp4xx-network-processing-engine"; + reg = <0xc8006000 0x1000>, <0xc8007000 0x1000>, <0xc8008000 0x1000>; + }; }; };