2007-09-23 08:59:26 -06:00
|
|
|
/*
|
2008-10-05 03:25:44 -06:00
|
|
|
* linux/arch/arm/mach-pxa/cm-x2xx.c
|
2007-09-23 08:59:26 -06:00
|
|
|
*
|
2008-10-05 03:26:10 -06:00
|
|
|
* Copyright (C) 2008 CompuLab, Ltd.
|
2007-09-23 08:59:26 -06:00
|
|
|
* Mike Rapoport <mike@compulab.co.il>
|
|
|
|
*
|
|
|
|
* 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/platform_device.h>
|
2011-04-22 14:03:11 -06:00
|
|
|
#include <linux/syscore_ops.h>
|
2008-06-17 05:29:58 -06:00
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/gpio.h>
|
2007-09-23 08:59:26 -06:00
|
|
|
|
|
|
|
#include <linux/dm9000.h>
|
2008-06-17 05:29:58 -06:00
|
|
|
#include <linux/leds.h>
|
2007-09-23 08:59:26 -06:00
|
|
|
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
|
2011-05-18 07:19:04 -06:00
|
|
|
#include <mach/pxa25x.h>
|
|
|
|
#include <mach/pxa27x.h>
|
2008-08-05 09:14:15 -06:00
|
|
|
#include <mach/audio.h>
|
|
|
|
#include <mach/pxafb.h>
|
2010-11-03 09:29:35 -06:00
|
|
|
#include <mach/smemc.h>
|
2007-09-23 08:59:26 -06:00
|
|
|
|
|
|
|
#include <asm/hardware/it8152.h>
|
|
|
|
|
|
|
|
#include "generic.h"
|
2008-10-07 04:58:25 -06:00
|
|
|
#include "cm-x2xx-pci.h"
|
2007-09-23 08:59:26 -06:00
|
|
|
|
2008-10-05 03:26:55 -06:00
|
|
|
extern void cmx255_init(void);
|
2008-10-05 03:26:10 -06:00
|
|
|
extern void cmx270_init(void);
|
|
|
|
|
2010-08-20 01:23:59 -06:00
|
|
|
/* reserve IRQs for IT8152 */
|
|
|
|
#define CMX2XX_NR_IRQS (IRQ_BOARD_START + 40)
|
|
|
|
|
2008-06-17 05:29:58 -06:00
|
|
|
/* virtual addresses for statically mapped regions */
|
2008-10-05 03:25:44 -06:00
|
|
|
#define CMX2XX_VIRT_BASE (0xe8000000)
|
|
|
|
#define CMX2XX_IT8152_VIRT (CMX2XX_VIRT_BASE)
|
2008-06-17 05:29:58 -06:00
|
|
|
|
2008-10-05 03:26:10 -06:00
|
|
|
/* physical address if local-bus attached devices */
|
2008-10-05 03:26:55 -06:00
|
|
|
#define CMX255_DM9000_PHYS_BASE (PXA_CS1_PHYS + (8 << 22))
|
2008-10-05 03:25:44 -06:00
|
|
|
#define CMX270_DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22))
|
|
|
|
|
|
|
|
/* leds */
|
2008-10-05 03:26:55 -06:00
|
|
|
#define CMX255_GPIO_RED (27)
|
|
|
|
#define CMX255_GPIO_GREEN (32)
|
2008-10-05 03:25:44 -06:00
|
|
|
#define CMX270_GPIO_RED (93)
|
|
|
|
#define CMX270_GPIO_GREEN (94)
|
2007-09-23 08:59:26 -06:00
|
|
|
|
2008-06-17 05:29:58 -06:00
|
|
|
/* GPIO IRQ usage */
|
2008-10-05 03:26:55 -06:00
|
|
|
#define GPIO22_ETHIRQ (22)
|
2008-06-17 05:29:58 -06:00
|
|
|
#define GPIO10_ETHIRQ (10)
|
2008-10-05 03:26:55 -06:00
|
|
|
#define CMX255_GPIO_IT8152_IRQ (0)
|
2008-10-05 03:25:44 -06:00
|
|
|
#define CMX270_GPIO_IT8152_IRQ (22)
|
2008-06-17 05:29:58 -06:00
|
|
|
|
2008-10-05 03:26:55 -06:00
|
|
|
#define CMX255_ETHIRQ IRQ_GPIO(GPIO22_ETHIRQ)
|
2008-06-17 05:29:58 -06:00
|
|
|
#define CMX270_ETHIRQ IRQ_GPIO(GPIO10_ETHIRQ)
|
|
|
|
|
|
|
|
#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
|
2008-10-05 03:26:55 -06:00
|
|
|
static struct resource cmx255_dm9000_resource[] = {
|
|
|
|
[0] = {
|
|
|
|
.start = CMX255_DM9000_PHYS_BASE,
|
|
|
|
.end = CMX255_DM9000_PHYS_BASE + 3,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
[1] = {
|
|
|
|
.start = CMX255_DM9000_PHYS_BASE + 4,
|
|
|
|
.end = CMX255_DM9000_PHYS_BASE + 4 + 500,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
[2] = {
|
|
|
|
.start = CMX255_ETHIRQ,
|
|
|
|
.end = CMX255_ETHIRQ,
|
|
|
|
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-06-17 05:29:58 -06:00
|
|
|
static struct resource cmx270_dm9000_resource[] = {
|
2007-09-23 08:59:26 -06:00
|
|
|
[0] = {
|
2008-10-05 03:25:44 -06:00
|
|
|
.start = CMX270_DM9000_PHYS_BASE,
|
|
|
|
.end = CMX270_DM9000_PHYS_BASE + 3,
|
2007-09-23 08:59:26 -06:00
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
[1] = {
|
2008-10-05 03:25:44 -06:00
|
|
|
.start = CMX270_DM9000_PHYS_BASE + 8,
|
|
|
|
.end = CMX270_DM9000_PHYS_BASE + 8 + 500,
|
2007-09-23 08:59:26 -06:00
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
[2] = {
|
|
|
|
.start = CMX270_ETHIRQ,
|
|
|
|
.end = CMX270_ETHIRQ,
|
2008-06-17 05:29:58 -06:00
|
|
|
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
|
2007-09-23 08:59:26 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-06-17 05:29:58 -06:00
|
|
|
static struct dm9000_plat_data cmx270_dm9000_platdata = {
|
2009-02-23 09:01:12 -07:00
|
|
|
.flags = DM9000_PLATF_32BITONLY | DM9000_PLATF_NO_EEPROM,
|
2007-09-23 08:59:26 -06:00
|
|
|
};
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static struct platform_device cmx2xx_dm9000_device = {
|
2007-09-23 08:59:26 -06:00
|
|
|
.name = "dm9000",
|
|
|
|
.id = 0,
|
2008-06-17 05:29:58 -06:00
|
|
|
.num_resources = ARRAY_SIZE(cmx270_dm9000_resource),
|
2007-09-23 08:59:26 -06:00
|
|
|
.dev = {
|
2008-06-17 05:29:58 -06:00
|
|
|
.platform_data = &cmx270_dm9000_platdata,
|
2007-09-23 08:59:26 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static void __init cmx2xx_init_dm9000(void)
|
2008-06-17 05:29:58 -06:00
|
|
|
{
|
2008-10-05 03:26:55 -06:00
|
|
|
if (cpu_is_pxa25x())
|
|
|
|
cmx2xx_dm9000_device.resource = cmx255_dm9000_resource;
|
|
|
|
else
|
|
|
|
cmx2xx_dm9000_device.resource = cmx270_dm9000_resource;
|
2008-10-05 03:25:44 -06:00
|
|
|
platform_device_register(&cmx2xx_dm9000_device);
|
2008-06-17 05:29:58 -06:00
|
|
|
}
|
|
|
|
#else
|
2008-10-05 03:25:44 -06:00
|
|
|
static inline void cmx2xx_init_dm9000(void) {}
|
2008-06-17 05:29:58 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* UCB1400 touchscreen controller */
|
|
|
|
#if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
|
2008-10-05 03:25:44 -06:00
|
|
|
static struct platform_device cmx2xx_ts_device = {
|
2009-04-01 08:30:07 -06:00
|
|
|
.name = "ucb1400_core",
|
2007-09-23 08:59:26 -06:00
|
|
|
.id = -1,
|
|
|
|
};
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static void __init cmx2xx_init_touchscreen(void)
|
2008-06-17 05:29:58 -06:00
|
|
|
{
|
2008-10-05 03:25:44 -06:00
|
|
|
platform_device_register(&cmx2xx_ts_device);
|
2008-06-17 05:29:58 -06:00
|
|
|
}
|
|
|
|
#else
|
2008-10-05 03:25:44 -06:00
|
|
|
static inline void cmx2xx_init_touchscreen(void) {}
|
2008-06-17 05:29:58 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* CM-X270 LEDs */
|
|
|
|
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
|
2008-10-05 03:25:44 -06:00
|
|
|
static struct gpio_led cmx2xx_leds[] = {
|
2008-06-17 05:29:58 -06:00
|
|
|
[0] = {
|
2008-10-05 03:25:44 -06:00
|
|
|
.name = "cm-x2xx:red",
|
2008-06-17 05:29:58 -06:00
|
|
|
.default_trigger = "nand-disk",
|
|
|
|
.active_low = 1,
|
|
|
|
},
|
|
|
|
[1] = {
|
2008-10-05 03:25:44 -06:00
|
|
|
.name = "cm-x2xx:green",
|
2008-06-17 05:29:58 -06:00
|
|
|
.default_trigger = "heartbeat",
|
|
|
|
.active_low = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static struct gpio_led_platform_data cmx2xx_gpio_led_pdata = {
|
|
|
|
.num_leds = ARRAY_SIZE(cmx2xx_leds),
|
|
|
|
.leds = cmx2xx_leds,
|
2008-06-17 05:29:58 -06:00
|
|
|
};
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static struct platform_device cmx2xx_led_device = {
|
2008-06-17 05:29:58 -06:00
|
|
|
.name = "leds-gpio",
|
2007-09-23 08:59:26 -06:00
|
|
|
.id = -1,
|
2008-06-17 05:29:58 -06:00
|
|
|
.dev = {
|
2008-10-05 03:25:44 -06:00
|
|
|
.platform_data = &cmx2xx_gpio_led_pdata,
|
2008-06-17 05:29:58 -06:00
|
|
|
},
|
2007-09-23 08:59:26 -06:00
|
|
|
};
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static void __init cmx2xx_init_leds(void)
|
2008-06-17 05:29:58 -06:00
|
|
|
{
|
2008-10-05 03:26:55 -06:00
|
|
|
if (cpu_is_pxa25x()) {
|
|
|
|
cmx2xx_leds[0].gpio = CMX255_GPIO_RED;
|
|
|
|
cmx2xx_leds[1].gpio = CMX255_GPIO_GREEN;
|
|
|
|
} else {
|
|
|
|
cmx2xx_leds[0].gpio = CMX270_GPIO_RED;
|
|
|
|
cmx2xx_leds[1].gpio = CMX270_GPIO_GREEN;
|
|
|
|
}
|
2008-10-05 03:25:44 -06:00
|
|
|
platform_device_register(&cmx2xx_led_device);
|
2008-06-17 05:29:58 -06:00
|
|
|
}
|
|
|
|
#else
|
2008-10-05 03:25:44 -06:00
|
|
|
static inline void cmx2xx_init_leds(void) {}
|
2008-06-17 05:29:58 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
|
2007-09-23 08:59:26 -06:00
|
|
|
/*
|
|
|
|
Display definitions
|
|
|
|
keep these for backwards compatibility, although symbolic names (as
|
|
|
|
e.g. in lpd270.c) looks better
|
|
|
|
*/
|
|
|
|
#define MTYPE_STN320x240 0
|
|
|
|
#define MTYPE_TFT640x480 1
|
|
|
|
#define MTYPE_CRT640x480 2
|
|
|
|
#define MTYPE_CRT800x600 3
|
|
|
|
#define MTYPE_TFT320x240 6
|
|
|
|
#define MTYPE_STN640x480 7
|
|
|
|
|
|
|
|
static struct pxafb_mode_info generic_stn_320x240_mode = {
|
|
|
|
.pixclock = 76923,
|
|
|
|
.bpp = 8,
|
|
|
|
.xres = 320,
|
|
|
|
.yres = 240,
|
|
|
|
.hsync_len = 3,
|
|
|
|
.vsync_len = 2,
|
|
|
|
.left_margin = 3,
|
|
|
|
.upper_margin = 0,
|
|
|
|
.right_margin = 3,
|
|
|
|
.lower_margin = 0,
|
|
|
|
.sync = (FB_SYNC_HOR_HIGH_ACT |
|
|
|
|
FB_SYNC_VERT_HIGH_ACT),
|
|
|
|
.cmap_greyscale = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mach_info generic_stn_320x240 = {
|
|
|
|
.modes = &generic_stn_320x240_mode,
|
|
|
|
.num_modes = 1,
|
2008-12-07 02:49:01 -07:00
|
|
|
.lcd_conn = LCD_COLOR_STN_8BPP | LCD_PCLK_EDGE_FALL |\
|
|
|
|
LCD_AC_BIAS_FREQ(0xff),
|
2007-09-23 08:59:26 -06:00
|
|
|
.cmap_inverse = 0,
|
|
|
|
.cmap_static = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mode_info generic_tft_640x480_mode = {
|
|
|
|
.pixclock = 38461,
|
|
|
|
.bpp = 8,
|
|
|
|
.xres = 640,
|
|
|
|
.yres = 480,
|
|
|
|
.hsync_len = 60,
|
|
|
|
.vsync_len = 2,
|
|
|
|
.left_margin = 70,
|
|
|
|
.upper_margin = 10,
|
|
|
|
.right_margin = 70,
|
|
|
|
.lower_margin = 5,
|
|
|
|
.sync = 0,
|
|
|
|
.cmap_greyscale = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mach_info generic_tft_640x480 = {
|
|
|
|
.modes = &generic_tft_640x480_mode,
|
|
|
|
.num_modes = 1,
|
2008-12-07 02:49:01 -07:00
|
|
|
.lcd_conn = LCD_COLOR_TFT_8BPP | LCD_PCLK_EDGE_FALL |\
|
|
|
|
LCD_AC_BIAS_FREQ(0xff),
|
2007-09-23 08:59:26 -06:00
|
|
|
.cmap_inverse = 0,
|
|
|
|
.cmap_static = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mode_info generic_crt_640x480_mode = {
|
|
|
|
.pixclock = 38461,
|
|
|
|
.bpp = 8,
|
|
|
|
.xres = 640,
|
|
|
|
.yres = 480,
|
|
|
|
.hsync_len = 63,
|
|
|
|
.vsync_len = 2,
|
|
|
|
.left_margin = 81,
|
|
|
|
.upper_margin = 33,
|
|
|
|
.right_margin = 16,
|
|
|
|
.lower_margin = 10,
|
|
|
|
.sync = (FB_SYNC_HOR_HIGH_ACT |
|
|
|
|
FB_SYNC_VERT_HIGH_ACT),
|
|
|
|
.cmap_greyscale = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mach_info generic_crt_640x480 = {
|
|
|
|
.modes = &generic_crt_640x480_mode,
|
|
|
|
.num_modes = 1,
|
2008-12-07 02:49:01 -07:00
|
|
|
.lcd_conn = LCD_COLOR_TFT_8BPP | LCD_AC_BIAS_FREQ(0xff),
|
2007-09-23 08:59:26 -06:00
|
|
|
.cmap_inverse = 0,
|
|
|
|
.cmap_static = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mode_info generic_crt_800x600_mode = {
|
|
|
|
.pixclock = 28846,
|
|
|
|
.bpp = 8,
|
|
|
|
.xres = 800,
|
|
|
|
.yres = 600,
|
|
|
|
.hsync_len = 63,
|
|
|
|
.vsync_len = 2,
|
|
|
|
.left_margin = 26,
|
|
|
|
.upper_margin = 21,
|
|
|
|
.right_margin = 26,
|
|
|
|
.lower_margin = 11,
|
|
|
|
.sync = (FB_SYNC_HOR_HIGH_ACT |
|
|
|
|
FB_SYNC_VERT_HIGH_ACT),
|
|
|
|
.cmap_greyscale = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mach_info generic_crt_800x600 = {
|
|
|
|
.modes = &generic_crt_800x600_mode,
|
|
|
|
.num_modes = 1,
|
2008-12-07 02:49:01 -07:00
|
|
|
.lcd_conn = LCD_COLOR_TFT_8BPP | LCD_AC_BIAS_FREQ(0xff),
|
2007-09-23 08:59:26 -06:00
|
|
|
.cmap_inverse = 0,
|
|
|
|
.cmap_static = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mode_info generic_tft_320x240_mode = {
|
|
|
|
.pixclock = 134615,
|
|
|
|
.bpp = 16,
|
|
|
|
.xres = 320,
|
|
|
|
.yres = 240,
|
|
|
|
.hsync_len = 63,
|
|
|
|
.vsync_len = 7,
|
|
|
|
.left_margin = 75,
|
|
|
|
.upper_margin = 0,
|
|
|
|
.right_margin = 15,
|
|
|
|
.lower_margin = 15,
|
|
|
|
.sync = 0,
|
|
|
|
.cmap_greyscale = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mach_info generic_tft_320x240 = {
|
|
|
|
.modes = &generic_tft_320x240_mode,
|
|
|
|
.num_modes = 1,
|
2008-12-07 02:49:01 -07:00
|
|
|
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_AC_BIAS_FREQ(0xff),
|
2007-09-23 08:59:26 -06:00
|
|
|
.cmap_inverse = 0,
|
|
|
|
.cmap_static = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mode_info generic_stn_640x480_mode = {
|
|
|
|
.pixclock = 57692,
|
|
|
|
.bpp = 8,
|
|
|
|
.xres = 640,
|
|
|
|
.yres = 480,
|
|
|
|
.hsync_len = 4,
|
|
|
|
.vsync_len = 2,
|
|
|
|
.left_margin = 10,
|
|
|
|
.upper_margin = 5,
|
|
|
|
.right_margin = 10,
|
|
|
|
.lower_margin = 5,
|
|
|
|
.sync = (FB_SYNC_HOR_HIGH_ACT |
|
|
|
|
FB_SYNC_VERT_HIGH_ACT),
|
|
|
|
.cmap_greyscale = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mach_info generic_stn_640x480 = {
|
|
|
|
.modes = &generic_stn_640x480_mode,
|
|
|
|
.num_modes = 1,
|
2008-12-07 02:49:01 -07:00
|
|
|
.lcd_conn = LCD_COLOR_STN_8BPP | LCD_AC_BIAS_FREQ(0xff),
|
2007-09-23 08:59:26 -06:00
|
|
|
.cmap_inverse = 0,
|
|
|
|
.cmap_static = 0,
|
|
|
|
};
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static struct pxafb_mach_info *cmx2xx_display = &generic_crt_640x480;
|
2007-09-23 08:59:26 -06:00
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static int __init cmx2xx_set_display(char *str)
|
2007-09-23 08:59:26 -06:00
|
|
|
{
|
|
|
|
int disp_type = simple_strtol(str, NULL, 0);
|
|
|
|
switch (disp_type) {
|
|
|
|
case MTYPE_STN320x240:
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_display = &generic_stn_320x240;
|
2007-09-23 08:59:26 -06:00
|
|
|
break;
|
|
|
|
case MTYPE_TFT640x480:
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_display = &generic_tft_640x480;
|
2007-09-23 08:59:26 -06:00
|
|
|
break;
|
|
|
|
case MTYPE_CRT640x480:
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_display = &generic_crt_640x480;
|
2007-09-23 08:59:26 -06:00
|
|
|
break;
|
|
|
|
case MTYPE_CRT800x600:
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_display = &generic_crt_800x600;
|
2007-09-23 08:59:26 -06:00
|
|
|
break;
|
|
|
|
case MTYPE_TFT320x240:
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_display = &generic_tft_320x240;
|
2007-09-23 08:59:26 -06:00
|
|
|
break;
|
|
|
|
case MTYPE_STN640x480:
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_display = &generic_stn_640x480;
|
2007-09-23 08:59:26 -06:00
|
|
|
break;
|
|
|
|
default: /* fallback to CRT 640x480 */
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_display = &generic_crt_640x480;
|
2007-09-23 08:59:26 -06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
This should be done really early to get proper configuration for
|
|
|
|
frame buffer.
|
2008-10-05 03:25:44 -06:00
|
|
|
Indeed, pxafb parameters can be used istead, but CM-X2XX bootloader
|
2007-09-23 08:59:26 -06:00
|
|
|
has limitied line length for kernel command line, and also it will
|
|
|
|
break compatibitlty with proprietary releases already in field.
|
|
|
|
*/
|
2008-10-05 03:25:44 -06:00
|
|
|
__setup("monitor=", cmx2xx_set_display);
|
2007-09-23 08:59:26 -06:00
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static void __init cmx2xx_init_display(void)
|
2008-06-17 05:29:58 -06:00
|
|
|
{
|
2011-02-15 00:37:30 -07:00
|
|
|
pxa_set_fb_info(NULL, cmx2xx_display);
|
2008-06-17 05:29:58 -06:00
|
|
|
}
|
|
|
|
#else
|
2008-10-05 03:25:44 -06:00
|
|
|
static inline void cmx2xx_init_display(void) {}
|
2008-06-17 05:29:58 -06:00
|
|
|
#endif
|
|
|
|
|
2007-09-23 08:59:26 -06:00
|
|
|
#ifdef CONFIG_PM
|
|
|
|
static unsigned long sleep_save_msc[10];
|
|
|
|
|
2011-04-22 14:03:11 -06:00
|
|
|
static int cmx2xx_suspend(void)
|
2007-09-23 08:59:26 -06:00
|
|
|
{
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_pci_suspend();
|
2007-09-23 08:59:26 -06:00
|
|
|
|
|
|
|
/* save MSC registers */
|
2010-11-03 09:29:35 -06:00
|
|
|
sleep_save_msc[0] = __raw_readl(MSC0);
|
|
|
|
sleep_save_msc[1] = __raw_readl(MSC1);
|
|
|
|
sleep_save_msc[2] = __raw_readl(MSC2);
|
2007-09-23 08:59:26 -06:00
|
|
|
|
|
|
|
/* setup power saving mode registers */
|
|
|
|
PCFR = 0x0;
|
|
|
|
PSLR = 0xff400000;
|
|
|
|
PMCR = 0x00000005;
|
|
|
|
PWER = 0x80000000;
|
|
|
|
PFER = 0x00000000;
|
|
|
|
PRER = 0x00000000;
|
|
|
|
PGSR0 = 0xC0018800;
|
|
|
|
PGSR1 = 0x004F0002;
|
|
|
|
PGSR2 = 0x6021C000;
|
|
|
|
PGSR3 = 0x00020000;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-04-22 14:03:11 -06:00
|
|
|
static void cmx2xx_resume(void)
|
2007-09-23 08:59:26 -06:00
|
|
|
{
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_pci_resume();
|
2007-09-23 08:59:26 -06:00
|
|
|
|
|
|
|
/* restore MSC registers */
|
2010-11-03 09:29:35 -06:00
|
|
|
__raw_writel(sleep_save_msc[0], MSC0);
|
|
|
|
__raw_writel(sleep_save_msc[1], MSC1);
|
|
|
|
__raw_writel(sleep_save_msc[2], MSC2);
|
2007-09-23 08:59:26 -06:00
|
|
|
}
|
|
|
|
|
2011-04-22 14:03:11 -06:00
|
|
|
static struct syscore_ops cmx2xx_pm_syscore_ops = {
|
2008-10-05 03:25:44 -06:00
|
|
|
.resume = cmx2xx_resume,
|
|
|
|
.suspend = cmx2xx_suspend,
|
2007-09-23 08:59:26 -06:00
|
|
|
};
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static int __init cmx2xx_pm_init(void)
|
2007-09-23 08:59:26 -06:00
|
|
|
{
|
2011-04-22 14:03:11 -06:00
|
|
|
register_syscore_ops(&cmx2xx_pm_syscore_ops);
|
|
|
|
|
|
|
|
return 0;
|
2007-09-23 08:59:26 -06:00
|
|
|
}
|
|
|
|
#else
|
2008-10-05 03:25:44 -06:00
|
|
|
static int __init cmx2xx_pm_init(void) { return 0; }
|
2007-09-23 08:59:26 -06:00
|
|
|
#endif
|
|
|
|
|
2008-06-17 05:29:58 -06:00
|
|
|
#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
|
2008-10-05 03:25:44 -06:00
|
|
|
static void __init cmx2xx_init_ac97(void)
|
2007-09-23 08:59:26 -06:00
|
|
|
{
|
2008-06-10 05:30:05 -06:00
|
|
|
pxa_set_ac97_info(NULL);
|
2008-06-17 05:29:58 -06:00
|
|
|
}
|
|
|
|
#else
|
2008-10-05 03:25:44 -06:00
|
|
|
static inline void cmx2xx_init_ac97(void) {}
|
2008-06-17 05:29:58 -06:00
|
|
|
#endif
|
2007-09-23 08:59:26 -06:00
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static void __init cmx2xx_init(void)
|
|
|
|
{
|
2009-11-08 22:34:08 -07:00
|
|
|
pxa_set_ffuart_info(NULL);
|
|
|
|
pxa_set_btuart_info(NULL);
|
|
|
|
pxa_set_stuart_info(NULL);
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
cmx2xx_pm_init();
|
|
|
|
|
2008-10-05 03:26:55 -06:00
|
|
|
if (cpu_is_pxa25x())
|
|
|
|
cmx255_init();
|
|
|
|
else
|
|
|
|
cmx270_init();
|
2008-10-05 03:25:44 -06:00
|
|
|
|
|
|
|
cmx2xx_init_dm9000();
|
|
|
|
cmx2xx_init_display();
|
|
|
|
cmx2xx_init_ac97();
|
|
|
|
cmx2xx_init_touchscreen();
|
|
|
|
cmx2xx_init_leds();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init cmx2xx_init_irq(void)
|
2007-09-23 08:59:26 -06:00
|
|
|
{
|
2008-10-05 03:26:55 -06:00
|
|
|
if (cpu_is_pxa25x()) {
|
|
|
|
pxa25x_init_irq();
|
|
|
|
cmx2xx_pci_init_irq(CMX255_GPIO_IT8152_IRQ);
|
|
|
|
} else {
|
|
|
|
pxa27x_init_irq();
|
|
|
|
cmx2xx_pci_init_irq(CMX270_GPIO_IT8152_IRQ);
|
|
|
|
}
|
2008-06-17 05:29:58 -06:00
|
|
|
}
|
2007-09-23 08:59:26 -06:00
|
|
|
|
2008-06-17 05:29:58 -06:00
|
|
|
#ifdef CONFIG_PCI
|
|
|
|
/* Map PCI companion statically */
|
2008-10-05 03:25:44 -06:00
|
|
|
static struct map_desc cmx2xx_io_desc[] __initdata = {
|
2008-06-17 05:29:58 -06:00
|
|
|
[0] = { /* PCI bridge */
|
2008-10-05 03:25:44 -06:00
|
|
|
.virtual = CMX2XX_IT8152_VIRT,
|
2008-06-17 05:29:58 -06:00
|
|
|
.pfn = __phys_to_pfn(PXA_CS4_PHYS),
|
|
|
|
.length = SZ_64M,
|
|
|
|
.type = MT_DEVICE
|
|
|
|
},
|
|
|
|
};
|
2007-09-23 08:59:26 -06:00
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
static void __init cmx2xx_map_io(void)
|
2008-06-17 05:29:58 -06:00
|
|
|
{
|
2010-10-10 18:20:19 -06:00
|
|
|
if (cpu_is_pxa25x())
|
|
|
|
pxa25x_map_io();
|
|
|
|
|
|
|
|
if (cpu_is_pxa27x())
|
|
|
|
pxa27x_map_io();
|
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
iotable_init(cmx2xx_io_desc, ARRAY_SIZE(cmx2xx_io_desc));
|
2007-09-23 08:59:26 -06:00
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
it8152_base_address = CMX2XX_IT8152_VIRT;
|
2007-09-23 08:59:26 -06:00
|
|
|
}
|
2008-06-17 05:29:58 -06:00
|
|
|
#else
|
2008-10-05 03:25:44 -06:00
|
|
|
static void __init cmx2xx_map_io(void)
|
2007-09-23 08:59:26 -06:00
|
|
|
{
|
2010-10-10 18:20:19 -06:00
|
|
|
if (cpu_is_pxa25x())
|
|
|
|
pxa25x_map_io();
|
|
|
|
|
|
|
|
if (cpu_is_pxa27x())
|
|
|
|
pxa27x_map_io();
|
2007-09-23 08:59:26 -06:00
|
|
|
}
|
2008-06-17 05:29:58 -06:00
|
|
|
#endif
|
2007-09-23 08:59:26 -06:00
|
|
|
|
2008-10-05 03:25:44 -06:00
|
|
|
MACHINE_START(ARMCORE, "Compulab CM-X2XX")
|
2007-09-23 08:59:26 -06:00
|
|
|
.boot_params = 0xa0000100,
|
2008-10-05 03:25:44 -06:00
|
|
|
.map_io = cmx2xx_map_io,
|
2010-08-20 01:23:59 -06:00
|
|
|
.nr_irqs = CMX2XX_NR_IRQS,
|
2008-10-05 03:25:44 -06:00
|
|
|
.init_irq = cmx2xx_init_irq,
|
2011-05-18 07:30:04 -06:00
|
|
|
/* NOTE: pxa25x_handle_irq() works on PXA27x w/o camera support */
|
|
|
|
.handle_irq = pxa25x_handle_irq,
|
2007-09-23 08:59:26 -06:00
|
|
|
.timer = &pxa_timer,
|
2008-10-05 03:25:44 -06:00
|
|
|
.init_machine = cmx2xx_init,
|
2011-07-05 20:28:09 -06:00
|
|
|
#ifdef CONFIG_PCI
|
|
|
|
.dma_zone_size = SZ_64M,
|
|
|
|
#endif
|
2007-09-23 08:59:26 -06:00
|
|
|
MACHINE_END
|