[ARM] pxa: Colibri PXA320 module basics
[deliverable/linux.git] / arch / arm / mach-pxa / colibri-pxa300.c
CommitLineData
5fc9f9a1
DM
1/*
2 * arch/arm/mach-pxa/colibri-pxa300.c
3 *
acb36559
DM
4 * Support for Toradex PXA300/310 based Colibri module
5 *
5fc9f9a1 6 * Daniel Mack <daniel@caiaq.de>
acb36559 7 * Matthias Meier <matthias.j.meier@gmx.net>
5fc9f9a1
DM
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>
acb36559 21#include <asm/sizes.h>
5fc9f9a1
DM
22#include <asm/mach/arch.h>
23#include <asm/mach/irq.h>
24
25#include <mach/pxa300.h>
26#include <mach/colibri.h>
42e07ad7 27#include <mach/ohci.h>
5fc9f9a1
DM
28
29#include "generic.h"
30#include "devices.h"
31
5fc9f9a1 32#if defined(CONFIG_AX88796)
acb36559 33#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
5fc9f9a1
DM
34/*
35 * Asix AX88796 Ethernet
36 */
37static struct ax_plat_data colibri_asix_platdata = {
38 .flags = AXFLG_MAC_FROMDEV,
626806d9 39 .wordlength = 2
5fc9f9a1
DM
40};
41
42static struct resource colibri_asix_resource[] = {
43 [0] = {
44 .start = PXA3xx_CS2_PHYS,
626806d9 45 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
5fc9f9a1
DM
46 .flags = IORESOURCE_MEM,
47 },
48 [1] = {
acb36559
DM
49 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
50 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
5fc9f9a1
DM
51 .flags = IORESOURCE_IRQ
52 }
53};
54
55static 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};
ebc046c2 64
acb36559
DM
65static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
66 GPIO1_nCS2, /* AX88796 chip select */
67 GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
ebc046c2
DM
68};
69
acb36559 70static void __init colibri_pxa300_init_eth(void)
ebc046c2 71{
acb36559
DM
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);
ebc046c2 75}
ebc046c2 76#else
acb36559
DM
77static inline void __init colibri_pxa300_init_eth(void) {}
78#endif /* CONFIG_AX88796 */
ebc046c2 79
42e07ad7 80#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
acb36559
DM
81static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = {
82 GPIO0_2_USBH_PEN,
83 GPIO1_2_USBH_PWR,
84};
85
42e07ad7
DM
86static 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
acb36559 91void __init colibri_pxa300_init_ohci(void)
42e07ad7 92{
acb36559 93 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
42e07ad7
DM
94 pxa_set_ohci_info(&colibri_pxa300_ohci_info);
95}
96#else
97static inline void colibri_pxa300_init_ohci(void) {}
98#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
99
acb36559
DM
100static 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
109void __init colibri_pxa300_init(void)
5fc9f9a1 110{
acb36559 111 colibri_pxa300_init_eth();
42e07ad7 112 colibri_pxa300_init_ohci();
acb36559
DM
113 colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config),
114 mfp_to_gpio(MFP_PIN_GPIO13));
5fc9f9a1
DM
115}
116
117MACHINE_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,
125MACHINE_END
126
This page took 0.032088 seconds and 5 git commands to generate.