From patchwork Fri Mar 11 23:08:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 522 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:43:17 -0000 Delivered-To: patches@linaro.org Received: by 10.224.67.207 with SMTP id s15cs76513qai; Fri, 11 Mar 2011 15:08:34 -0800 (PST) Received: by 10.150.138.14 with SMTP id l14mr3270630ybd.176.1299884914143; Fri, 11 Mar 2011 15:08:34 -0800 (PST) Received: from mail-gx0-f178.google.com (mail-gx0-f178.google.com [209.85.161.178]) by mx.google.com with ESMTPS id o4si12436329ybh.3.2011.03.11.15.08.32 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Mar 2011 15:08:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) client-ip=209.85.161.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) smtp.mail=mathieu.poirier@linaro.org Received: by gxk8 with SMTP id 8so403050gxk.37 for ; Fri, 11 Mar 2011 15:08:32 -0800 (PST) Received: by 10.90.126.19 with SMTP id y19mr499177agc.114.1299884912482; Fri, 11 Mar 2011 15:08:32 -0800 (PST) Received: from localhost.localdomain (S0106002369de4dac.cg.shawcable.net [70.73.24.112]) by mx.google.com with ESMTPS id i10sm5945021anh.32.2011.03.11.15.08.30 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Mar 2011 15:08:31 -0800 (PST) From: mathieu.poirier@linaro.org To: linux-arm-kernel@lists.infradead.org Cc: mathieu.poirier@linaro.org, patches@linaro.org, linus.walleij@stericsson.com Subject: [PATCH 06/10] ux500: added snowball-netev with latest fixes Date: Fri, 11 Mar 2011 16:08:08 -0700 Message-Id: <1299884892-6766-7-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1299884892-6766-1-git-send-email-mathieu.poirier@linaro.org> References: <1299884892-6766-1-git-send-email-mathieu.poirier@linaro.org> From: Alessandro Rubini Signed-off-by: Alessandro Rubini --- arch/arm/mach-ux500/board-snowball-netdev.c | 86 +++++++++++++++++++++++++++ 1 files changed, 86 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-ux500/board-snowball-netdev.c diff --git a/arch/arm/mach-ux500/board-snowball-netdev.c b/arch/arm/mach-ux500/board-snowball-netdev.c new file mode 100644 index 0000000..ee2ab7a --- /dev/null +++ b/arch/arm/mach-ux500/board-snowball-netdev.c @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2010-2011 ST-Ericsson + * + * Author: Alessandro Rubini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + */ + + +#include +#include +#include +#include +#include +#include +#include + +struct smsc911x_platform_config sbnet_cfg = { + .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, + .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, + .shift = 1, + .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, +}; + +struct resource sbnet_res[] = { + { + .name = "smsc911x-memory", + .start = (0x5000 << 16), + .end = (0x5000 << 16) + 0x3ff, + .flags = IORESOURCE_MEM, + },{ + .start = NOMADIK_GPIO_TO_IRQ(140), + .end = NOMADIK_GPIO_TO_IRQ(140), + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, + }, +}; + +struct platform_device sbnet_dev = { + .name = "smsc911x", + .num_resources = ARRAY_SIZE(sbnet_res), + .resource = sbnet_res, + .dev = { + .platform_data = &sbnet_cfg, + }, +}; + +int sbnet_init(void) +{ + volatile u32 *ptr = ioremap(0x80000000, 0x10000); + + if (!machine_is_snowball()) { + printk("no netdev: no snowball\n"); + return 0; + } + printk("init netdev: is snowball\n"); + + /* + * Horribly, fix all the configuration by hand + */ + /* Turn on the FSMC device */ + *(ptr + 0xf000 / 4) = 1; + *(ptr + 0xf008 / 4) = 1; + + /* Configure the FSMC device */ + *(ptr + 0x0000 / 4) = 0x0000305b; + *(ptr + 0x0004 / 4) = 0x01010110; + + /* Fix some gpio bits */ + *(ptr + 0xe120 / 4) &= ~0x7f8; + *(ptr + 0xe124 / 4) |= 0x7f8; + iounmap(ptr); + + return platform_device_register(&sbnet_dev); +} + +void sbnet_exit(void) +{ + platform_device_unregister(&sbnet_dev); +} + +module_init(sbnet_init); +module_exit(sbnet_exit); + +MODULE_LICENSE("GPL");