From patchwork Tue Apr 2 04:20:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 2374171 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 53788DF2A1 for ; Tue, 2 Apr 2013 04:22:20 +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 1UMshd-0003Pw-9G; Tue, 02 Apr 2013 04:20:09 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UMshY-0003OC-Nf for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2013 04:20:05 +0000 Received: by mail-pa0-f54.google.com with SMTP id fa11so55967pad.13 for ; Mon, 01 Apr 2013 21:20:03 -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=vhak7BfjSppgQJDpal8WzElVNYagjCOO6i0mM8ib+CI=; b=PkWhB6aiIqqNMPMfuP6y2PYuOC8L9yzCb8GQXdjNklnSt+WDHkxWYG/L57Vu9FHz5D GgtgsprjzTPjN9mnnHkoltSGRUsZ6F8ayF6fjbzI63iKQRV/ZAExFd1FZcZIGgmYAMOx ErzzWPRvS8Q9JYHqj184rUQhxnOmYZ850NQI80HEG95M6G7NgkEDCuxp1R5vaXC+QoVh Vik6rsApnNi4T3zV3p4y8ciZm5i9bbeHuwV8KgayjtL2kpnh3BDlTOWJ+/vo//z65sGd E2eEl6Ep5uAAr+Jvn77nOTKBFKfAsxftMokstLsVG7fPXhFizWa/juxbVQ4dgGFTR4vC 6Gag== X-Received: by 10.66.14.232 with SMTP id s8mr22773436pac.13.1364876403664; Mon, 01 Apr 2013 21:20:03 -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 qb10sm16261615pbb.43.2013.04.01.21.20.01 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 01 Apr 2013 21:20:02 -0700 (PDT) Date: Mon, 01 Apr 2013 21:20:02 -0700 (PDT) Message-ID: <87obdx5ztd.wl%kuninori.morimoto.gx@renesas.com> To: Paul , Simon , arnd@arndb.de In-Reply-To: <87sj395zvv.wl%kuninori.morimoto.gx@renesas.com> References: <87zjxvewko.wl%kuninori.morimoto.gx@renesas.com> <87fvzb56n3.wl%kuninori.morimoto.gx@renesas.com> <87sj395zvv.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/5 v3] ARM: shmobile: bockw: add SMSC ethernet support 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-20130402_002004_982506_0E263157 X-CRM114-Status: GOOD ( 16.46 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.54 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 SMSC ethernet support on Bock-W Bock-W SMSC needs FPGA settings which enables interrupt. This patch does it on bockw_init() function. As notes for future, this FPGA settings should be updated, since this FPGA is using cascaded interrupt. Current code is assuming that this FPGA interrupt user is only SMSC. Signed-off-by: Kuninori Morimoto --- v2 -> v3 - C code only arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/board-bockw.c | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 9125e14..b2219bd 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -119,6 +119,7 @@ config MACH_BOCKW bool "BOCK-W platform" depends on ARCH_R8A7778 select ARCH_REQUIRE_GPIOLIB + select RENESAS_INTC_IRQPIN select USE_OF config MACH_MARZEN diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c index 56ab56e..38e5e50 100644 --- a/arch/arm/mach-shmobile/board-bockw.c +++ b/arch/arm/mach-shmobile/board-bockw.c @@ -19,14 +19,52 @@ */ #include +#include #include +#include #include #include +static struct smsc911x_platform_config smsc911x_data = { + .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, + .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, + .flags = SMSC911X_USE_32BIT, + .phy_interface = PHY_INTERFACE_MODE_MII, +}; + +static struct resource smsc911x_resources[] = { + DEFINE_RES_MEM(0x18300000, 0x1000), + DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */ +}; + +#define IRQ0MR 0x30 static void __init bockw_init(void) { + void __iomem *fpga; + r8a7778_clock_init(); + r8a7778_init_irq_extpin(1); r8a7778_add_standard_devices(); + + fpga = ioremap_nocache(0x18200000, SZ_1M); + if (fpga) { + /* + * CAUTION + * + * IRQ0/1 is cascaded interrupt from FPGA. + * it should be cared in the future + * Now, it is assuming IRQ0 was used only from SMSC. + */ + u16 val = ioread16(fpga + IRQ0MR); + val &= ~(1 << 4); /* enable SMSC911x */ + iowrite16(val, fpga + IRQ0MR); + iounmap(fpga); + + platform_device_register_resndata( + &platform_bus, "smsc911x", -1, + smsc911x_resources, ARRAY_SIZE(smsc911x_resources), + &smsc911x_data, sizeof(smsc911x_data)); + } } static const char *bockw_boards_compat_dt[] __initdata = {