From patchwork Wed Nov 11 11:19:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 59313 X-Patchwork-Delegate: tony@atomide.com 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 nABBQ49b006212 for ; Wed, 11 Nov 2009 11:26:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757395AbZKKLZ6 (ORCPT ); Wed, 11 Nov 2009 06:25:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757372AbZKKLZ5 (ORCPT ); Wed, 11 Nov 2009 06:25:57 -0500 Received: from compulab.co.il ([67.18.134.219]:54098 "EHLO compulab.co.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757356AbZKKLZy (ORCPT ); Wed, 11 Nov 2009 06:25:54 -0500 Received: from [62.90.235.247] (helo=zimbra-mta.compulab.co.il) by compulab.site5.com with esmtp (Exim 4.69) (envelope-from ) id 1N8BKq-00070h-1v for linux-omap@vger.kernel.org; Wed, 11 Nov 2009 05:26:00 -0600 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 819E09A0358 for ; Wed, 11 Nov 2009 13:19:34 +0200 (IST) X-Virus-Scanned: amavisd-new at compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TvbFwrXqSY1y; Wed, 11 Nov 2009 13:19:34 +0200 (IST) Received: from gentoodev.compulab.local (mike-pc.compulab.local [10.1.1.95]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 22B139A034C; Wed, 11 Nov 2009 13:19:34 +0200 (IST) Received: from gentoodev.compulab.local (localhost [127.0.0.1]) by gentoodev.compulab.local (8.14.0/8.14.0) with ESMTP id nABBJXmi015719; Wed, 11 Nov 2009 13:19:33 +0200 Received: (from mike@localhost) by gentoodev.compulab.local (8.14.0/8.14.0/Submit) id nABBJXMr015718; Wed, 11 Nov 2009 13:19:33 +0200 X-Authentication-Warning: gentoodev.compulab.local: mike set sender to mike@compulab.co.il using -f From: Mike Rapoport To: linux-omap@vger.kernel.org Cc: Mike Rapoport Subject: [PATCH 3/3] omap3: cm-t35: add support for baseboard ehternet Date: Wed, 11 Nov 2009 13:19:32 +0200 Message-Id: <569daf1053bd9a1c01de3d5f6a93029028d448b6.1257937910.git.mike@compulab.co.il> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: References: X-ACL-Warn: { X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - compulab.site5.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Source: X-Source-Args: X-Source-Dir: Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index 0a46c0e..22c4529 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c @@ -52,6 +52,8 @@ #define CM_T35_SMSC911X_CS 5 #define CM_T35_SMSC911X_GPIO 163 +#define SB_T35_SMSC911X_CS 4 +#define SB_T35_SMSC911X_GPIO 65 #define NAND_BLOCK_SIZE SZ_128K #define GPMC_CS0_BASE 0x60 @@ -60,9 +62,15 @@ #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) #include +static struct smsc911x_platform_config cm_t35_smsc911x_config = { + .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, + .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, + .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, + .phy_interface = PHY_INTERFACE_MODE_MII, +}; + static struct resource cm_t35_smsc911x_resources[] = { { - .name = "smsc911x-memory", .flags = IORESOURCE_MEM, }, { @@ -72,13 +80,6 @@ static struct resource cm_t35_smsc911x_resources[] = { }, }; -static struct smsc911x_platform_config cm_t35_smsc911x_config = { - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, - .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, - .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, - .phy_interface = PHY_INTERFACE_MODE_MII, -}; - static struct platform_device cm_t35_smsc911x_device = { .name = "smsc911x", .id = 0, @@ -89,30 +90,60 @@ static struct platform_device cm_t35_smsc911x_device = { }, }; -static void __init cm_t35_init_smsc911x(void) +static struct resource sb_t35_smsc911x_resources[] = { + { + .flags = IORESOURCE_MEM, + }, + { + .start = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO), + .end = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO), + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, + }, +}; + +static struct platform_device sb_t35_smsc911x_device = { + .name = "smsc911x", + .id = 1, + .num_resources = ARRAY_SIZE(sb_t35_smsc911x_resources), + .resource = sb_t35_smsc911x_resources, + .dev = { + .platform_data = &cm_t35_smsc911x_config, + }, +}; + +static void __init cm_t35_init_smsc911x(struct platform_device *dev, + int cs, int irq_gpio) { unsigned long cs_mem_base; - if (gpmc_cs_request(CM_T35_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { + if (gpmc_cs_request(cs, SZ_16M, &cs_mem_base) < 0) { pr_err("CM-T35: Failed request for GPMC mem for smsc911x\n"); return; } - cm_t35_smsc911x_resources[0].start = cs_mem_base + 0x0; - cm_t35_smsc911x_resources[0].end = cs_mem_base + 0xff; + dev->resource[0].start = cs_mem_base + 0x0; + dev->resource[0].end = cs_mem_base + 0xff; - if ((gpio_request(CM_T35_SMSC911X_GPIO, "CM ETH IRQ") == 0) && - (gpio_direction_input(CM_T35_SMSC911X_GPIO) == 0)) { - gpio_export(CM_T35_SMSC911X_GPIO, 0); + if ((gpio_request(irq_gpio, "ETH IRQ") == 0) && + (gpio_direction_input(irq_gpio) == 0)) { + gpio_export(irq_gpio, 0); } else { pr_err("CM-T35: could not obtain gpio for SMSC911X IRQ\n"); return; } - platform_device_register(&cm_t35_smsc911x_device); + platform_device_register(dev); +} + +static void __init cm_t35_init_ethernet(void) +{ + cm_t35_init_smsc911x(&cm_t35_smsc911x_device, + CM_T35_SMSC911X_CS, CM_T35_SMSC911X_GPIO); + cm_t35_init_smsc911x(&sb_t35_smsc911x_device, + SB_T35_SMSC911X_CS, SB_T35_SMSC911X_GPIO); } #else -static inline void __init cm_t35_init_smsc911x(void) { return; } +static inline void __init cm_t35_init_ethernet(void) { return; } #endif #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) @@ -457,7 +488,7 @@ static void __init cm_t35_init(void) cm_t35_init_i2c(); cm_t35_init_nand(); cm_t35_init_ads7846(); - cm_t35_init_smsc911x(); + cm_t35_init_ethernet(); cm_t35_init_led(); usb_musb_init();