[ARM] 4744/1: pcm027: add support for phyCORE-PXA270 CPU module
authorRobert Schwebel <robert@schwebel.de>
Tue, 8 Jan 2008 07:44:23 +0000 (08:44 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 28 Jan 2008 13:13:20 +0000 (13:13 +0000)
This patch adds main support for the generic phyCORE-PXA270 CPU module
(aka PCM-027). Its as generic as possible to support any kind of baseboard.

Note: Neither the CPU module nor the pcm027.c implementation can work without
a baseboard support. Baseboard support can be added by the PCM-990 or any
custom variant.

V2:
 After comments by Eric Miao:
  - Currently unsupported devices moved into separate patch
  - direct call of baseboard initialisation

V3:
 After comments by Russell King
  - sort include files
  - setting RTC bit for power control removed
 - style problems fixed (discovered by checkpatch.pl)

Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/Kconfig
arch/arm/mach-pxa/Makefile
arch/arm/mach-pxa/pcm027.c [new file with mode: 0644]
include/asm-arm/arch-pxa/irqs.h
include/asm-arm/arch-pxa/pcm027.h [new file with mode: 0644]

index c73da5e..958303c 100644 (file)
@@ -123,6 +123,11 @@ config MACH_MAGICIAN
        select PXA27x
        select IWMMXT
 
+config MACH_PCM027
+       bool "Phytec phyCORE-PXA270 CPU module (PCM-027)"
+       select PXA27x
+       select IWMMXT
+
 endchoice
 
 if PXA_SHARPSL
index 5e9aec5..61d3018 100644 (file)
@@ -20,6 +20,7 @@ obj-$(CONFIG_PXA_SHARP_C7xx)  += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o cor
 obj-$(CONFIG_PXA_SHARP_Cxx00)  += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o
 obj-$(CONFIG_MACH_AKITA)       += akita-ioexp.o
 obj-$(CONFIG_MACH_POODLE)      += poodle.o corgi_ssp.o
+obj-$(CONFIG_MACH_PCM027)      += pcm027.o
 obj-$(CONFIG_MACH_TOSA)                += tosa.o
 obj-$(CONFIG_MACH_EM_X270)     += em-x270.o
 obj-$(CONFIG_MACH_MAGICIAN)    += magician.o
diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c
new file mode 100644 (file)
index 0000000..540c3bb
--- /dev/null
@@ -0,0 +1,216 @@
+/*
+ *  linux/arch/arm/mach-pxa/pcm027.c
+ *  Support for the Phytec phyCORE-PXA270 CPU card (aka PCM-027).
+ *
+ *  Refer
+ *   http://www.phytec.com/products/sbc/ARM-XScale/phyCORE-XScale-PXA270.html
+ *  for additional hardware info
+ *
+ *  Author:    Juergen Kilb
+ *  Created:   April 05, 2005
+ *  Copyright: Phytec Messtechnik GmbH
+ *  e-Mail:    armlinux@phytec.de
+ *
+ *  based on Intel Mainstone Board
+ *
+ *  Copyright 2007 Juergen Beisert @ Pengutronix (j.beisert@pengutronix.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/irq.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/physmap.h>
+#include <linux/spi/spi.h>
+#include <linux/leds.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/pxa2xx_spi.h>
+#include <asm/arch/pcm027.h>
+#include "generic.h"
+
+/*
+ * ABSTRACT:
+ *
+ * The PXA270 processor comes with a bunch of hardware on its silicon.
+ * Not all of this hardware can be used at the same time and not all
+ * is routed to module's connectors. Also it depends on the baseboard, what
+ * kind of hardware can be used in which way.
+ * -> So this file supports the main devices on the CPU card only!
+ * Refer pcm990-baseboard.c how to extend this features to get a full
+ * blown system with many common interfaces.
+ *
+ * The PCM-027 supports the following interfaces through its connectors and
+ * will be used in pcm990-baseboard.c:
+ *
+ * - LCD support
+ * - MMC support
+ * - IDE/CF card
+ * - FFUART
+ * - BTUART
+ * - IRUART
+ * - AC97
+ * - SSP
+ * - SSP3
+ *
+ * Claimed GPIOs:
+ * GPIO0 -> IRQ input from RTC
+ * GPIO2 -> SYS_ENA*)
+ * GPIO3 -> PWR_SCL
+ * GPIO4 -> PWR_SDA
+ * GPIO5 -> PowerCap0*)
+ * GPIO6 -> PowerCap1*)
+ * GPIO7 -> PowerCap2*)
+ * GPIO8 -> PowerCap3*)
+ * GPIO15 -> /CS1
+ * GPIO20 -> /CS2
+ * GPIO21 -> /CS3
+ * GPIO33 -> /CS5 network controller select
+ * GPIO52 -> IRQ from network controller
+ * GPIO78 -> /CS2
+ * GPIO80 -> /CS4
+ * GPIO90 -> LED0
+ * GPIO91 -> LED1
+ * GPIO114 -> IRQ from CAN controller
+ * GPIO117 -> SCL
+ * GPIO118 -> SDA
+ *
+ * *) CPU internal use only
+ */
+
+/*
+ * SMC91x network controller specific stuff
+ */
+static struct resource smc91x_resources[] = {
+       [0] = {
+               .start  = PCM027_ETH_PHYS + 0x300,
+               .end    = PCM027_ETH_PHYS + PCM027_ETH_SIZE,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = PCM027_ETH_IRQ,
+               .end    = PCM027_ETH_IRQ,
+               /* note: smc91x's driver doesn't use the trigger bits yet */
+               .flags  = IORESOURCE_IRQ | PCM027_ETH_IRQ_EDGE,
+       }
+};
+
+static struct platform_device smc91x_device = {
+       .name           = "smc91x",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(smc91x_resources),
+       .resource       = smc91x_resources,
+};
+
+static struct physmap_flash_data pcm027_flash_data = {
+       .width  = 4,
+};
+
+static struct resource pcm027_flash_resource = {
+       .start          = PCM027_FLASH_PHYS,
+       .end            = PCM027_FLASH_PHYS + PCM027_FLASH_SIZE - 1 ,
+       .flags          = IORESOURCE_MEM,
+};
+
+static struct platform_device pcm027_flash = {
+       .name           = "physmap-flash",
+       .id             = 0,
+       .dev            = {
+               .platform_data  = &pcm027_flash_data,
+       },
+       .resource       = &pcm027_flash_resource,
+       .num_resources  = 1,
+};
+
+#ifdef CONFIG_LEDS_GPIO
+
+static struct gpio_led pcm027_led[] = {
+       {
+               .name = "led0:red",     /* FIXME */
+               .gpio = PCM027_LED_CPU
+       },
+       {
+               .name = "led1:green",   /* FIXME */
+               .gpio = PCM027_LED_HEARD_BEAT
+       },
+};
+
+static struct gpio_led_platform_data pcm027_led_data = {
+       .num_leds       = ARRAY_SIZE(pcm027_led),
+       .leds           = pcm027_led
+};
+
+static struct platform_device pcm027_led_dev = {
+       .name           = "leds-gpio",
+       .id             = 0,
+       .dev            = {
+               .platform_data  = &pcm027_led_data,
+       },
+};
+
+#endif /* CONFIG_LEDS_GPIO */
+
+/*
+ * declare the available device resources on this board
+ */
+static struct platform_device *devices[] __initdata = {
+       &smc91x_device,
+       &pcm027_flash,
+#ifdef CONFIG_LEDS_GPIO
+       &pcm027_led_dev
+#endif
+};
+
+/*
+ * pcm027_init - breath some life into the board
+ */
+static void __init pcm027_init(void)
+{
+       /* system bus arbiter setting
+        * - Core_Park
+        * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
+        */
+       ARB_CNTRL = ARB_CORE_PARK | 0x234;
+
+       platform_add_devices(devices, ARRAY_SIZE(devices));
+
+       /* LEDs (on demand only) */
+#ifdef CONFIG_LEDS_GPIO
+       pxa_gpio_mode(PCM027_LED_CPU | GPIO_OUT);
+       pxa_gpio_mode(PCM027_LED_HEARD_BEAT | GPIO_OUT);
+#endif /* CONFIG_LEDS_GPIO */
+
+       /* at last call the baseboard to initialize itself */
+#ifdef CONFIG_MACH_PCM990_BASEBOARD
+       pcm990_baseboard_init();
+#endif
+}
+
+static void __init pcm027_map_io(void)
+{
+       pxa_map_io();
+
+       /* initialize sleep mode regs (wake-up sources, etc) */
+       PGSR0 = 0x01308000;
+       PGSR1 = 0x00CF0002;
+       PGSR2 = 0x0E294000;
+       PGSR3 = 0x0000C000;
+       PWER  = 0x40000000 | PWER_GPIO0 | PWER_GPIO1;
+       PRER  = 0x00000000;
+       PFER  = 0x00000003;
+}
+
+MACHINE_START(PCM027, "Phytec Messtechnik GmbH phyCORE-PXA270")
+       /* Maintainer: Pengutronix */
+       .boot_params    = 0xa0000100,
+       .phys_io        = 0x40000000,
+       .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
+       .map_io         = pcm027_map_io,
+       .init_irq       = pxa27x_init_irq,
+       .timer          = &pxa_timer,
+       .init_machine   = pcm027_init,
+MACHINE_END
index b76ee6d..c562b97 100644 (file)
 #define NR_IRQS                        (IRQ_LOCOMO_SPI_TEND + 1)
 #elif defined(CONFIG_ARCH_LUBBOCK) || \
       defined(CONFIG_MACH_LOGICPD_PXA270) || \
-      defined(CONFIG_MACH_MAINSTONE)
+      defined(CONFIG_MACH_MAINSTONE) || \
+      defined(CONFIG_MACH_PCM027)
 #define NR_IRQS                        (IRQ_BOARD_END)
 #else
 #define NR_IRQS                        (IRQ_BOARD_START)
 #define IRQ_LOCOMO_LT_BASE     (IRQ_BOARD_START + 2)
 #define IRQ_LOCOMO_SPI_BASE    (IRQ_BOARD_START + 3)
 
+/* phyCORE-PXA270 (PCM027) Interrupts */
+#define PCM027_IRQ(x)          (IRQ_BOARD_START + (x))
+#define PCM027_BTDET_IRQ       PCM027_IRQ(0)
+#define PCM027_FF_RI_IRQ       PCM027_IRQ(1)
+#define PCM027_MMCDET_IRQ      PCM027_IRQ(2)
+#define PCM027_PM_5V_IRQ       PCM027_IRQ(3)
+
 /* ITE8152 irqs */
 /* add IT8152 IRQs beyond BOARD_END */
 #ifdef CONFIG_PCI_HOST_ITE8152
diff --git a/include/asm-arm/arch-pxa/pcm027.h b/include/asm-arm/arch-pxa/pcm027.h
new file mode 100644 (file)
index 0000000..7beae14
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * linux/include/asm-arm/arch-pxa/pcm027.h
+ *
+ * (c) 2003 Phytec Messtechnik GmbH <armlinux@phytec.de>
+ * (c) 2007 Juergen Beisert <j.beisert@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * Definitions of CPU card resources only
+ */
+
+/* I2C RTC */
+#define PCM027_RTC_IRQ_GPIO    0
+#define PCM027_RTC_IRQ         IRQ_GPIO(PCM027_RTC_IRQ_GPIO)
+#define PCM027_RTC_IRQ_EDGE    IRQ_TYPE_EDGE_FALLING
+#define ADR_PCM027_RTC         0x51    /* I2C address */
+
+/* I2C EEPROM */
+#define ADR_PCM027_EEPROM      0x54    /* I2C address */
+
+/* Ethernet chip (SMSC91C111) */
+#define PCM027_ETH_IRQ_GPIO    52
+#define PCM027_ETH_IRQ         IRQ_GPIO(PCM027_ETH_IRQ_GPIO)
+#define PCM027_ETH_IRQ_EDGE    IRQ_TYPE_EDGE_RISING
+#define PCM027_ETH_PHYS                PXA_CS5_PHYS
+#define PCM027_ETH_SIZE                (1*1024*1024)
+
+/* CAN controller SJA1000 (unsupported yet) */
+#define PCM027_CAN_IRQ_GPIO    114
+#define PCM027_CAN_IRQ         IRQ_GPIO(PCM027_CAN_IRQ_GPIO)
+#define PCM027_CAN_IRQ_EDGE    IRQ_TYPE_EDGE_FALLING
+#define PCM027_CAN_PHYS                0x22000000
+#define PCM027_CAN_SIZE                0x100
+
+/* SPI GPIO expander (unsupported yet) */
+#define PCM027_EGPIO_IRQ_GPIO  27
+#define PCM027_EGPIO_IRQ       IRQ_GPIO(PCM027_EGPIO_IRQ_GPIO)
+#define PCM027_EGPIO_IRQ_EDGE  IRQ_TYPE_EDGE_FALLING
+#define PCM027_EGPIO_CS                24
+/*
+ * TODO: Switch this pin from dedicated usage to GPIO if
+ * more than the MAX7301 device is connected to this SPI bus
+ */
+#define PCM027_EGPIO_CS_MODE   GPIO24_SFRM_MD
+
+/* Flash memory */
+#define PCM027_FLASH_PHYS      0x00000000
+#define PCM027_FLASH_SIZE      0x02000000
+
+/* onboard LEDs connected to GPIO */
+#define PCM027_LED_CPU         90
+#define PCM027_LED_HEARD_BEAT  91
+
+/*
+ * This CPU module needs a baseboard to work. After basic initializing
+ * its own devices, it calls baseboard's init function.
+ * TODO: Add your own basebaord init function and call it from
+ * inside pcm027_init(). This example here is for the developmen board.
+ * Refer pcm990-baseboard.c
+ */
+extern void pcm990_baseboard_init(void);