From patchwork Mon Feb 2 06:27:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 5040 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n126Rtf9028828 for ; Mon, 2 Feb 2009 06:27:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751918AbZBBG1x (ORCPT ); Mon, 2 Feb 2009 01:27:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752282AbZBBG1x (ORCPT ); Mon, 2 Feb 2009 01:27:53 -0500 Received: from mail-bw0-f12.google.com ([209.85.218.12]:41918 "EHLO mail-bw0-f12.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752242AbZBBG1w (ORCPT ); Mon, 2 Feb 2009 01:27:52 -0500 Received: by bwz5 with SMTP id 5so1065710bwz.13 for ; Sun, 01 Feb 2009 22:27:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=dcGkk33xp1tLSRxKv13IG1V2A94TJt0YvTEOlSdQnq8=; b=lAycZSBSq/6X1mChzGU2LvxXyLxFsI6emeol4RzAT/ZgVl05gPsWqbG67VQUKXEu5x 9HFp9vYqeyw12WfYMlh0P5Nc3U60+Oo0AOL9fEdwSXCw9raveJTGo7joqOUUn8tmqSQh fTP2eYHm9Nfw2gyWUSE6fN1Q823c9A761Mi/k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=kHYvB6YuZlULsiyfNzq7u0nFSwKvoTXz65bOU9BHMkR8PN/4cE/hQlBM5DiSDrTdkk 949t8nO9esM4XVJAWRxVlTUjpHmgyedXc5M4/COsUGeVw3fMPzpnNICSLcgHkWWxYi8S vgXg1JrL9bjh4RUSWDiipJNOjMeFthv3c8eFo= MIME-Version: 1.0 Received: by 10.103.52.7 with SMTP id e7mr1699332muk.115.1233556069312; Sun, 01 Feb 2009 22:27:49 -0800 (PST) Date: Sun, 1 Feb 2009 22:27:49 -0800 Message-ID: <5e088bd90902012227o6e82ca64gbbe0bbc63ca03a69@mail.gmail.com> Subject: [PATCH] ARM: Add SMSC911X support to Overo platform (V2) From: Steve Sakoman To: linux-omap , netdev@vger.kernel.org Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Gumstix will soon be shipping a variant of their Summit board that includes an SMSC LAN9221 ethernet interface. This patch provides support via the smsc911x driver when enabled in kernel config. The Overo defconfig is not updated since the LAN9221 is an option not present on all systems. Signed-off-by: Steve Sakoman --- arch/arm/mach-omap2/board-overo.c | 62 +++++++++++++++++++++++++ arch/arm/plat-omap/include/mach/board-overo.h | 3 + 2 files changed, 65 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index 9995ac2..032a2c9 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c @@ -55,6 +55,67 @@ #define GPMC_CS0_BASE 0x60 #define GPMC_CS_SIZE 0x30 +#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) + +#include + +static struct resource overo_smsc911x_resources[] = { + { + .name = "smsc911x-memory", + .flags = IORESOURCE_MEM, + }, + { + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, + }, +}; + +static struct smsc911x_platform_config overo_smsc911x_config = { + .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, + .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, + .flags = SMSC911X_USE_32BIT , + .phy_interface = PHY_INTERFACE_MODE_MII, +}; + +static struct platform_device overo_smsc911x_device = { + .name = "smsc911x", + .id = -1, + .num_resources = ARRAY_SIZE(overo_smsc911x_resources), + .resource = &overo_smsc911x_resources, + .dev = { + .platform_data = &overo_smsc911x_config, + }, +}; + +static inline void __init overo_init_smsc911x(void) +{ + unsigned long cs_mem_base; + + if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { + printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n"); + return; + } + + overo_smsc911x_resources[0].start = cs_mem_base + 0x0; + overo_smsc911x_resources[0].end = cs_mem_base + 0xff; + + if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && + (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) { + gpio_export(OVERO_SMSC911X_GPIO, 0); + } else { + printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n"); + return; + } + + overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO); + overo_smsc911x_resources[1].end = 0; + + platform_device_register(&overo_smsc911x_device); +} + +#else +static inline void __init overo_init_smsc911x(void) { return; } +#endif + static struct mtd_partition overo_nand_partitions[] = { { .name = "xloader", @@ -234,6 +295,7 @@ static void __init overo_init(void) usb_musb_init(); usb_ehci_init(); overo_flash_init(); + overo_init_smsc911x(); if ((gpio_request(OVERO_GPIO_W2W_NRESET, "OVERO_GPIO_W2W_NRESET") == 0) && diff --git a/arch/arm/plat-omap/include/mach/board-overo.h b/arch/arm/plat-omap/include/mach/board-overo.h index 7ecae66..8635171 100644 --- a/arch/arm/plat-omap/include/mach/board-overo.h +++ b/arch/arm/plat-omap/include/mach/board-overo.h @@ -22,5 +22,8 @@ #define OVERO_GPIO_USBH_CPEN 168 #define OVERO_GPIO_USBH_NRESET 183 +#define OVERO_SMSC911X_CS 5 +#define OVERO_SMSC911X_GPIO 176 + #endif /* ____ASM_ARCH_OVERO_H */