Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * arch/arm/mach-pxa/colibri-pxa300.c |
| 3 | * |
| 4 | * Support for Toradex PXA300 based Colibri module |
| 5 | * Daniel Mack <daniel@caiaq.de> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/gpio.h> |
| 16 | #include <net/ax88796.h> |
| 17 | |
| 18 | #include <asm/mach-types.h> |
| 19 | #include <asm/mach/arch.h> |
| 20 | #include <asm/mach/irq.h> |
| 21 | |
| 22 | #include <mach/pxa300.h> |
| 23 | #include <mach/colibri.h> |
| 24 | |
| 25 | #include "generic.h" |
| 26 | #include "devices.h" |
| 27 | |
| 28 | /* |
| 29 | * GPIO configuration |
| 30 | */ |
| 31 | static mfp_cfg_t colibri_pxa300_pin_config[] __initdata = { |
| 32 | GPIO1_nCS2, /* AX88796 chip select */ |
| 33 | GPIO26_GPIO | MFP_PULL_HIGH, /* AX88796 IRQ */ |
| 34 | }; |
| 35 | |
| 36 | #if defined(CONFIG_AX88796) |
| 37 | /* |
| 38 | * Asix AX88796 Ethernet |
| 39 | */ |
| 40 | static struct ax_plat_data colibri_asix_platdata = { |
| 41 | .flags = AXFLG_MAC_FROMDEV, |
| 42 | .wordlength = 2, |
| 43 | .dcr_val = 0x01, |
| 44 | .rcr_val = 0x0e, |
| 45 | .gpoc_val = 0x19 |
| 46 | }; |
| 47 | |
| 48 | static struct resource colibri_asix_resource[] = { |
| 49 | [0] = { |
| 50 | .start = PXA3xx_CS2_PHYS, |
| 51 | .end = PXA3xx_CS2_PHYS + (0x18 * 0x2) - 1, |
| 52 | .flags = IORESOURCE_MEM, |
| 53 | }, |
| 54 | [1] = { |
| 55 | .start = PXA3xx_CS2_PHYS + (1 << 11), |
| 56 | .end = PXA3xx_CS2_PHYS + (1 << 11) + 0x3fff, |
| 57 | .flags = IORESOURCE_MEM, |
| 58 | }, |
| 59 | [2] = { |
| 60 | .start = COLIBRI_PXA300_ETH_IRQ, |
| 61 | .end = COLIBRI_PXA300_ETH_IRQ, |
| 62 | .flags = IORESOURCE_IRQ |
| 63 | } |
| 64 | }; |
| 65 | |
| 66 | static struct platform_device asix_device = { |
| 67 | .name = "ax88796", |
| 68 | .id = 0, |
| 69 | .num_resources = ARRAY_SIZE(colibri_asix_resource), |
| 70 | .resource = colibri_asix_resource, |
| 71 | .dev = { |
| 72 | .platform_data = &colibri_asix_platdata |
| 73 | } |
| 74 | }; |
| 75 | #endif /* CONFIG_AX88796 */ |
| 76 | |
| 77 | static struct platform_device *colibri_pxa300_devices[] __initdata = { |
| 78 | #if defined(CONFIG_AX88796) |
| 79 | &asix_device |
| 80 | #endif |
| 81 | }; |
| 82 | |
| 83 | static void __init colibri_pxa300_init(void) |
| 84 | { |
| 85 | set_irq_type(COLIBRI_PXA300_ETH_IRQ, IRQ_TYPE_EDGE_FALLING); |
| 86 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_pin_config)); |
| 87 | platform_add_devices(ARRAY_AND_SIZE(colibri_pxa300_devices)); |
| 88 | } |
| 89 | |
| 90 | MACHINE_START(COLIBRI300, "Toradex Colibri PXA300") |
| 91 | .phys_io = 0x40000000, |
| 92 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 93 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, |
| 94 | .init_machine = colibri_pxa300_init, |
| 95 | .map_io = pxa_map_io, |
| 96 | .init_irq = pxa3xx_init_irq, |
| 97 | .timer = &pxa_timer, |
| 98 | MACHINE_END |
| 99 | |