Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-pxa/colibri-pxa300.c |
| 3 | * |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 4 | * Support for Toradex PXA300/310 based Colibri module |
| 5 | * |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 6 | * Daniel Mack <daniel@caiaq.de> |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 7 | * Matthias Meier <matthias.j.meier@gmx.net> |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/gpio.h> |
| 18 | #include <net/ax88796.h> |
| 19 | |
| 20 | #include <asm/mach-types.h> |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 21 | #include <asm/sizes.h> |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 22 | #include <asm/mach/arch.h> |
| 23 | #include <asm/mach/irq.h> |
| 24 | |
| 25 | #include <mach/pxa300.h> |
| 26 | #include <mach/colibri.h> |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 27 | #include <mach/ohci.h> |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 28 | |
| 29 | #include "generic.h" |
| 30 | #include "devices.h" |
| 31 | |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 32 | #if defined(CONFIG_AX88796) |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 33 | #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO) |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 34 | /* |
| 35 | * Asix AX88796 Ethernet |
| 36 | */ |
| 37 | static struct ax_plat_data colibri_asix_platdata = { |
| 38 | .flags = AXFLG_MAC_FROMDEV, |
Daniel Mack | 626806d | 2009-03-23 02:04:16 +0100 | [diff] [blame] | 39 | .wordlength = 2 |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | static struct resource colibri_asix_resource[] = { |
| 43 | [0] = { |
| 44 | .start = PXA3xx_CS2_PHYS, |
Daniel Mack | 626806d | 2009-03-23 02:04:16 +0100 | [diff] [blame] | 45 | .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1, |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 46 | .flags = IORESOURCE_MEM, |
| 47 | }, |
| 48 | [1] = { |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 49 | .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
| 50 | .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 51 | .flags = IORESOURCE_IRQ |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | static struct platform_device asix_device = { |
| 56 | .name = "ax88796", |
| 57 | .id = 0, |
| 58 | .num_resources = ARRAY_SIZE(colibri_asix_resource), |
| 59 | .resource = colibri_asix_resource, |
| 60 | .dev = { |
| 61 | .platform_data = &colibri_asix_platdata |
| 62 | } |
| 63 | }; |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 64 | |
| 65 | static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = { |
| 66 | GPIO1_nCS2, /* AX88796 chip select */ |
| 67 | GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */ |
| 68 | }; |
| 69 | |
| 70 | static void __init colibri_pxa300_init_eth(void) |
| 71 | { |
| 72 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config)); |
| 73 | set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING); |
| 74 | platform_device_register(&asix_device); |
| 75 | } |
| 76 | #else |
| 77 | static inline void __init colibri_pxa300_init_eth(void) {} |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 78 | #endif /* CONFIG_AX88796 */ |
| 79 | |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 80 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 81 | static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = { |
| 82 | GPIO0_2_USBH_PEN, |
| 83 | GPIO1_2_USBH_PWR, |
| 84 | }; |
| 85 | |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 86 | static struct pxaohci_platform_data colibri_pxa300_ohci_info = { |
| 87 | .port_mode = PMM_GLOBAL_MODE, |
| 88 | .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
| 89 | }; |
| 90 | |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 91 | void __init colibri_pxa300_init_ohci(void) |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 92 | { |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 93 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config)); |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 94 | pxa_set_ohci_info(&colibri_pxa300_ohci_info); |
| 95 | } |
| 96 | #else |
| 97 | static inline void colibri_pxa300_init_ohci(void) {} |
| 98 | #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */ |
| 99 | |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 100 | static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = { |
| 101 | GPIO7_MMC1_CLK, |
| 102 | GPIO14_MMC1_CMD, |
| 103 | GPIO3_MMC1_DAT0, |
| 104 | GPIO4_MMC1_DAT1, |
| 105 | GPIO5_MMC1_DAT2, |
| 106 | GPIO6_MMC1_DAT3, |
| 107 | }; |
| 108 | |
| 109 | void __init colibri_pxa300_init(void) |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 110 | { |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 111 | colibri_pxa300_init_eth(); |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 112 | colibri_pxa300_init_ohci(); |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame^] | 113 | colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config), |
| 114 | mfp_to_gpio(MFP_PIN_GPIO13)); |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | MACHINE_START(COLIBRI300, "Toradex Colibri PXA300") |
| 118 | .phys_io = 0x40000000, |
| 119 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 120 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, |
| 121 | .init_machine = colibri_pxa300_init, |
| 122 | .map_io = pxa_map_io, |
| 123 | .init_irq = pxa3xx_init_irq, |
| 124 | .timer = &pxa_timer, |
| 125 | MACHINE_END |
| 126 | |