summaryrefslogtreecommitdiff
path: root/arch/arm/mach-ux500/board-snowball-netdev.c
diff options
context:
space:
mode:
authorBenn Pörscke <benn.porscke@stericsson.com>2011-10-07 15:31:57 +0200
committerBenn Pörscke <benn.porscke@stericsson.com>2011-10-07 15:31:57 +0200
commit47a4dbf83a75014d6b3467be18997894f1c617db (patch)
tree7f5d116db48205309fbc4ae0954f20ab8a651e46 /arch/arm/mach-ux500/board-snowball-netdev.c
parentea8a52f9f4bcc3420c38ae07f8378a2f18443970 (diff)
Change-Id: If0ae9fa8067740ab2ede33703c79ec134f204a5e
Diffstat (limited to 'arch/arm/mach-ux500/board-snowball-netdev.c')
-rw-r--r--arch/arm/mach-ux500/board-snowball-netdev.c74
1 files changed, 74 insertions, 0 deletions
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 00000000000..48404e4f953
--- /dev/null
+++ b/arch/arm/mach-ux500/board-snowball-netdev.c
@@ -0,0 +1,74 @@
+#include <linux/module.h>
+#include <linux/resource.h>
+#include <linux/platform_device.h>
+#include <linux/smsc911x.h>
+#include <mach/irqs.h>
+#include <asm/io.h>
+
+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 = GPIO_TO_IRQ(140),
+ .end = 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");