From patchwork Fri Mar 22 07:14:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 2318291 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id A30E6DFE82 for ; Fri, 22 Mar 2013 07:20:05 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIwBt-0003ak-Rq; Fri, 22 Mar 2013 07:15:05 +0000 Received: from mail-pd0-f175.google.com ([209.85.192.175]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIwBq-0003Zh-12 for linux-arm-kernel@lists.infradead.org; Fri, 22 Mar 2013 07:15:02 +0000 Received: by mail-pd0-f175.google.com with SMTP id r11so1471342pdi.20 for ; Fri, 22 Mar 2013 00:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:sender:message-id:to:cc:in-reply-to:references:from :subject:mime-version:content-type; bh=DPVaA6RAettRRl3rTNSGiBagT0v9UEuD3FyiR43WOn8=; b=NtnAopUqvIqhbiGVaLjEeIp9Mw4BxTo+iLgVj8TO/kNoyTFm2+e+xNV5tQn+VWkatq ep+HtAm+6otj04fjXhU1TjifjM4kiv7euiqcqwTANzojf9ZuqSt1z3ZSHvED77ngqQ+5 evk4m3FcMp+38hhDitdidcumPe5NaqrDXwgVJaxybbDuuzQlY7tOAYUOVWWy3I/JAUcd 8CjmdZU8PFtZzpKN4Z5rIRjWsnRwtUCa1KX31prgke6t8QFV8Q0WMuHmOBnnlWpsSaZK eWjSIDvUPTFLm5X3Y2rd5ZxoMiv8sYb16Mry4baPKA5CX+8ovltppvZ0C42FrWu9RxBD WNCg== X-Received: by 10.68.59.199 with SMTP id b7mr1015486pbr.167.1363936500596; Fri, 22 Mar 2013 00:15:00 -0700 (PDT) Received: from morimoto-Dell-XPS420.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPS id ip8sm1331270pbc.39.2013.03.22.00.14.57 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 Mar 2013 00:14:59 -0700 (PDT) Date: Fri, 22 Mar 2013 00:14:59 -0700 (PDT) Message-ID: <87wqszewi8.wl%kuninori.morimoto.gx@renesas.com> To: Paul , Simon , arnd@arndb.de In-Reply-To: <87zjxvewko.wl%kuninori.morimoto.gx@renesas.com> References: <87zjxvewko.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [RFC][PATCH 2/3] ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin() MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130322_031502_350302_7070E914 X-CRM114-Status: GOOD ( 16.99 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.192.175 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (kuninori.morimoto.gx[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Magnus , Kuninori Morimoto , linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch adds r8a7778_init_irq_extpin() for IRQ0 - IRQ3. But this patch doesn't enable DT settings on r8a7778.dts, because R8A7778 chip external IRQ depends on IRQ0 - IRQ3 pin encoding which came from platform board implementation. Signed-off-by: Kuninori Morimoto --- arch/arm/mach-shmobile/include/mach/r8a7778.h | 1 + arch/arm/mach-shmobile/setup-r8a7778.c | 44 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h index a755dca..e0c6205 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7778.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h @@ -24,5 +24,6 @@ extern void r8a7778_init_delay(void); extern void r8a7778_init_irq(void); extern void r8a7778_init_irq_dt(void); extern void r8a7778_clock_init(void); +extern void r8a7778_init_irq_extpin(int irlm); #endif /* __ASM_R8A7778_H__ */ diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c index 45a1a53..7d8bcaf 100644 --- a/arch/arm/mach-shmobile/setup-r8a7778.c +++ b/arch/arm/mach-shmobile/setup-r8a7778.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +113,49 @@ void __init r8a7778_add_standard_devices(void) platform_device_register_full(&platform_devinfo[i]); } +static struct renesas_intc_irqpin_config irqpin_platform_data = { + .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */ + .sense_bitfield_width = 2, +}; + +static struct resource irqpin_resources[] = { + DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */ + DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */ + DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */ + DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */ + DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */ + DEFINE_RES_IRQ(gic_iid(0x3b)), /* IRQ0 */ + DEFINE_RES_IRQ(gic_iid(0x3c)), /* IRQ1 */ + DEFINE_RES_IRQ(gic_iid(0x3d)), /* IRQ2 */ + DEFINE_RES_IRQ(gic_iid(0x3e)), /* IRQ3 */ +}; + +static struct platform_device_info intc_devinfo = + PLATFORM_FULL_INFO("renesas_intc_irqpin", -1, irqpin); + +void __init r8a7778_init_irq_extpin(int irlm) +{ + void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE); + unsigned long tmp; + + if (!icr0) { + pr_warn("r8a7778: unable to setup external irq pin mode\n"); + return; + } + + tmp = ioread32(icr0); + if (irlm) + tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */ + else + tmp &= ~(1 << 23); /* IRL mode - not supported */ + tmp |= (1 << 21); /* LVLMODE = 1 */ + iowrite32(tmp, icr0); + iounmap(icr0); + + if (irlm) + platform_device_register_full(&intc_devinfo); +} + #define INT2SMSKCR0 0x82288 /* 0xfe782288 */ #define INT2SMSKCR1 0x8228c /* 0xfe78228c */