[ARM] pxa: add basic support for Colibri PXA300 module
authorDaniel Mack <daniel@caiaq.de>
Fri, 13 Mar 2009 15:37:09 +0000 (16:37 +0100)
committerEric Miao <eric.miao@marvell.com>
Mon, 23 Mar 2009 01:57:54 +0000 (09:57 +0800)
This patch add basic support for Toradex' Colibri PXA300 module.
Ethernet is enabled conditionally, depdending on CONFIG_AX88796.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
arch/arm/mach-pxa/Kconfig
arch/arm/mach-pxa/Makefile
arch/arm/mach-pxa/colibri-pxa300.c [new file with mode: 0644]
arch/arm/mach-pxa/include/mach/colibri.h

index fd21bba62170e528afa9a678e442754b84a0082f..1a93888c68a8e919abc3412e81b21b8140304079 100644 (file)
@@ -265,6 +265,11 @@ config MACH_COLIBRI
        bool "Toradex Colibri PXA270"
        select PXA27x
 
+config MACH_COLIBRI300
+       bool "Toradex Colibri PXA300"
+       select PXA3xx
+       select CPU_PXA300
+
 config MACH_ZYLONITE
        bool "PXA3xx Development Platform (aka Zylonite)"
        select PXA3xx
index fbbda93b73ae7b794d8e5696815162dd4e0009e6..df6534b49e31a8122c5766a4a1e50115969f84f8 100644 (file)
@@ -36,6 +36,7 @@ obj-$(CONFIG_MACH_MP900C)     += mp900.o
 obj-$(CONFIG_ARCH_PXA_IDP)     += idp.o
 obj-$(CONFIG_MACH_TRIZEPS4)    += trizeps4.o
 obj-$(CONFIG_MACH_COLIBRI)     += colibri-pxa270.o
+obj-$(CONFIG_MACH_COLIBRI300)  += colibri-pxa300.o
 obj-$(CONFIG_MACH_H5000)       += h5000.o
 obj-$(CONFIG_PXA_SHARP_C7xx)   += corgi.o sharpsl_pm.o corgi_pm.o
 obj-$(CONFIG_PXA_SHARP_Cxx00)  += spitz.o sharpsl_pm.o spitz_pm.o
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
new file mode 100644 (file)
index 0000000..b271e02
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ *  arch/arm/mach-pxa/colibri-pxa300.c
+ *
+ *  Support for Toradex PXA300 based Colibri module
+ *  Daniel Mack <daniel@caiaq.de>
+ *
+ *  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 <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <net/ax88796.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/irq.h>
+
+#include <mach/pxa300.h>
+#include <mach/colibri.h>
+
+#include "generic.h"
+#include "devices.h"
+
+/*
+ * GPIO configuration
+ */
+static mfp_cfg_t colibri_pxa300_pin_config[] __initdata = {
+       GPIO1_nCS2,                     /* AX88796 chip select */
+       GPIO26_GPIO | MFP_PULL_HIGH,    /* AX88796 IRQ */
+};
+
+#if defined(CONFIG_AX88796)
+/*
+ * Asix AX88796 Ethernet
+ */
+static struct ax_plat_data colibri_asix_platdata = {
+       .flags          = AXFLG_MAC_FROMDEV,
+       .wordlength     = 2,
+       .dcr_val        = 0x01,
+       .rcr_val        = 0x0e,
+       .gpoc_val       = 0x19
+};
+
+static struct resource colibri_asix_resource[] = {
+       [0] = {
+               .start = PXA3xx_CS2_PHYS,
+               .end   = PXA3xx_CS2_PHYS + (0x18 * 0x2) - 1,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = PXA3xx_CS2_PHYS + (1 << 11),
+               .end   = PXA3xx_CS2_PHYS + (1 << 11) + 0x3fff,
+               .flags = IORESOURCE_MEM,
+       },
+       [2] = {
+               .start = COLIBRI_PXA300_ETH_IRQ,
+               .end   = COLIBRI_PXA300_ETH_IRQ,
+               .flags = IORESOURCE_IRQ
+       }
+};
+
+static struct platform_device asix_device = {
+       .name           = "ax88796",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(colibri_asix_resource),
+       .resource       = colibri_asix_resource,
+       .dev            = {
+               .platform_data = &colibri_asix_platdata
+       }
+};
+#endif /* CONFIG_AX88796 */
+
+static struct platform_device *colibri_pxa300_devices[] __initdata = {
+#if defined(CONFIG_AX88796)
+       &asix_device
+#endif
+};
+
+static void __init colibri_pxa300_init(void)
+{
+       set_irq_type(COLIBRI_PXA300_ETH_IRQ, IRQ_TYPE_EDGE_FALLING);
+       pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_pin_config));
+       platform_add_devices(ARRAY_AND_SIZE(colibri_pxa300_devices));
+}
+
+MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
+       .phys_io        = 0x40000000,
+       .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
+       .boot_params    = COLIBRI_SDRAM_BASE + 0x100,
+       .init_machine   = colibri_pxa300_init,
+       .map_io         = pxa_map_io,
+       .init_irq       = pxa3xx_init_irq,
+       .timer          = &pxa_timer,
+MACHINE_END
+
index c7c99d07881725d4e50411519efabd443134422d..e295e8df8d640cf2e4f0ae86c7b120dbbc8d5c1d 100644 (file)
@@ -1,14 +1,31 @@
 #ifndef _COLIBRI_H_
 #define _COLIBRI_H_
+/*
+ * common settings for all modules
+ */
 
 /* physical memory regions */
 #define COLIBRI_SDRAM_BASE     0xa0000000      /* SDRAM region */
 
+/* definitions for Colibri PXA270 */
+
 #define COLIBRI_PXA270_FLASH_PHYS      (PXA_CS0_PHYS)  /* Flash region */
 #define COLIBRI_PXA270_ETH_PHYS                (PXA_CS2_PHYS)  /* Ethernet */
 #define COLIBRI_PXA270_ETH_IRQ_GPIO    114
 #define COLIBRI_PXA270_ETH_IRQ         \
        gpio_to_irq(mfp_to_gpio(COLIBRI_PXA270_ETH_IRQ_GPIO))
 
+/* definitions for Colibri PXA300 */
+
+#define COLIBRI_PXA300_ETH_IRQ_GPIO     26
+#define COLIBRI_PXA300_ETH_IRQ          \
+       gpio_to_irq(mfp_to_gpio(COLIBRI_PXA300_ETH_IRQ_GPIO))
+
+/* definitions for Colibri PXA320 */
+
+#define COLIBRI_PXA320_ETH_IRQ_GPIO     36
+#define COLIBRI_PXA320_ETH_IRQ          \
+       gpio_to_irq(mfp_to_gpio(COLIBRI_PXA320_ETH_IRQ_GPIO))
+
 #endif /* _COLIBRI_H_ */