diff options
Diffstat (limited to 'arch/arm/mach-pxa')
120 files changed, 3950 insertions, 1603 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 8eea7306f29..96a2006cb59 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig @@ -40,6 +40,9 @@ choice config GUMSTIX_AM200EPD bool "Enable AM200EPD board support" +config GUMSTIX_AM300EPD + bool "Enable AM300EPD board support" + endchoice config MACH_INTELMOTE2 @@ -254,10 +257,24 @@ config MACH_EM_X270 bool "CompuLab EM-x270 platform" select PXA27x +config MACH_EXEDA + bool "CompuLab eXeda platform" + select PXA27x + config MACH_COLIBRI - bool "Toradex Colibri PX27x" + bool "Toradex Colibri PXA270" select PXA27x +config MACH_COLIBRI300 + bool "Toradex Colibri PXA300/310" + select PXA3xx + select CPU_PXA300 + +config MACH_COLIBRI320 + bool "Toradex Colibri PXA320" + select PXA3xx + select CPU_PXA320 + config MACH_ZYLONITE bool "PXA3xx Development Platform (aka Zylonite)" select PXA3xx @@ -295,8 +312,15 @@ config MACH_MAGICIAN bool "Enable HTC Magician Support" select PXA27x select IWMMXT + select PXA_SSP + select HAVE_PWM select PXA_HAVE_BOARD_IRQS +config MACH_HIMALAYA + bool "HTC Himalaya Support" + select CPU_PXA26x + select FB_W100 + config MACH_MIOA701 bool "Mitac Mio A701 Support" select PXA27x @@ -319,6 +343,16 @@ config ARCH_PXA_PALM bool "PXA based Palm PDAs" select HAVE_PWM +config MACH_PALMT5 + bool "Palm Tungsten|T5" + default y + depends on ARCH_PXA_PALM + select PXA27x + select IWMMXT + help + Say Y here if you intend to run this kernel on a Palm Tungsten|T5 + handheld computer. + config MACH_PALMTX bool "Palm T|X" default y @@ -339,6 +373,16 @@ config MACH_PALMZ72 Say Y here if you intend to run this kernel on Palm Zire 72 handheld computer. +config MACH_PALMLD + bool "Palm LifeDrive" + default y + depends on ARCH_PXA_PALM + select PXA27x + select IWMMXT + help + Say Y here if you intend to run this kernel on a Palm LifeDrive + handheld computer. + config MACH_PCM990_BASEBOARD bool "PHYTEC PCM-990 development board" select HAVE_PWM @@ -359,6 +403,18 @@ config PCM990_DISPLAY_NONE endchoice +config MACH_CSB726 + bool "Enable Cogent CSB726 System On a Module" + select PXA27x + select IWMMXT + help + Say Y here if you intend to run this kernel on a Cogent + CSB726 System On Module. + +config CSB726_CSB701 + bool "Enable supprot for CSB701 baseboard" + depends on MACH_CSB726 + config PXA_EZX bool "Motorola EZX Platform" select PXA27x diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 7b28bb561d6..c80e1bac494 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile @@ -3,8 +3,8 @@ # # Common support (must be linked before board specific support) -obj-y += clock.o devices.o generic.o irq.o dma.o \ - time.o gpio.o reset.o +obj-y += clock.o devices.o generic.o irq.o \ + time.o reset.o obj-$(CONFIG_PM) += pm.o sleep.o standby.o ifeq ($(CONFIG_CPU_FREQ),y) @@ -28,13 +28,16 @@ obj-$(CONFIG_CPU_PXA930) += pxa930.o # Specific board support obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o +obj-$(CONFIG_GUMSTIX_AM300EPD) += am300epd.o obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o obj-$(CONFIG_MACH_MP900C) += mp900.o obj-$(CONFIG_ARCH_PXA_IDP) += idp.o obj-$(CONFIG_MACH_TRIZEPS4) += trizeps4.o -obj-$(CONFIG_MACH_COLIBRI) += colibri.o +obj-$(CONFIG_MACH_COLIBRI) += colibri-pxa270.o +obj-$(CONFIG_MACH_COLIBRI300) += colibri-pxa3xx.o colibri-pxa300.o +obj-$(CONFIG_MACH_COLIBRI320) += colibri-pxa3xx.o colibri-pxa320.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 @@ -45,6 +48,7 @@ obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o obj-$(CONFIG_MACH_TOSA) += tosa.o obj-$(CONFIG_MACH_EM_X270) += em-x270.o obj-$(CONFIG_MACH_MAGICIAN) += magician.o +obj-$(CONFIG_MACH_HIMALAYA) += himalaya.o obj-$(CONFIG_MACH_MIOA701) += mioa701.o mioa701_bootresume.o obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o obj-$(CONFIG_MACH_E330) += e330.o @@ -53,7 +57,9 @@ obj-$(CONFIG_MACH_E740) += e740.o obj-$(CONFIG_MACH_E750) += e750.o obj-$(CONFIG_MACH_E400) += e400.o obj-$(CONFIG_MACH_E800) += e800.o +obj-$(CONFIG_MACH_PALMT5) += palmt5.o obj-$(CONFIG_MACH_PALMTX) += palmtx.o +obj-$(CONFIG_MACH_PALMLD) += palmld.o obj-$(CONFIG_MACH_PALMZ72) += palmz72.o obj-$(CONFIG_ARCH_VIPER) += viper.o @@ -71,6 +77,8 @@ obj-$(CONFIG_MACH_CM_X300) += cm-x300.o obj-$(CONFIG_PXA_EZX) += ezx.o obj-$(CONFIG_MACH_INTELMOTE2) += imote2.o +obj-$(CONFIG_MACH_CSB726) += csb726.o +obj-$(CONFIG_CSB726_CSB701) += csb701.o # Support for blinky lights led-y := leds.o diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c index 77ee80e5e47..3499fada73a 100644 --- a/arch/arm/mach-pxa/am200epd.c +++ b/arch/arm/mach-pxa/am200epd.c @@ -30,8 +30,8 @@ #include <linux/irq.h> #include <linux/gpio.h> +#include <mach/pxa25x.h> #include <mach/gumstix.h> -#include <mach/mfp-pxa25x.h> #include <mach/pxafb.h> #include "generic.h" diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c new file mode 100644 index 00000000000..4bd10a17332 --- /dev/null +++ b/arch/arm/mach-pxa/am300epd.c @@ -0,0 +1,295 @@ +/* + * am300epd.c -- Platform device for AM300 EPD kit + * + * Copyright (C) 2008, Jaya Kumar + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + * + * This work was made possible by help and equipment support from E-Ink + * Corporation. http://support.eink.com/community + * + * This driver is written to be used with the Broadsheet display controller. + * on the AM300 EPD prototype kit/development kit with an E-Ink 800x600 + * Vizplex EPD on a Gumstix board using the Broadsheet interface board. + * + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/string.h> +#include <linux/delay.h> +#include <linux/interrupt.h> +#include <linux/fb.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/irq.h> +#include <linux/gpio.h> + +#include <mach/gumstix.h> +#include <mach/mfp-pxa25x.h> +#include <mach/pxafb.h> + +#include "generic.h" + +#include <video/broadsheetfb.h> + +static unsigned int panel_type = 6; +static struct platform_device *am300_device; +static struct broadsheet_board am300_board; + +static unsigned long am300_pin_config[] __initdata = { + GPIO16_GPIO, + GPIO17_GPIO, + GPIO32_GPIO, + GPIO48_GPIO, + GPIO49_GPIO, + GPIO51_GPIO, + GPIO74_GPIO, + GPIO75_GPIO, + GPIO76_GPIO, + GPIO77_GPIO, + + /* this is the 16-bit hdb bus 58-73 */ + GPIO58_GPIO, + GPIO59_GPIO, + GPIO60_GPIO, + GPIO61_GPIO, + + GPIO62_GPIO, + GPIO63_GPIO, + GPIO64_GPIO, + GPIO65_GPIO, + + GPIO66_GPIO, + GPIO67_GPIO, + GPIO68_GPIO, + GPIO69_GPIO, + + GPIO70_GPIO, + GPIO71_GPIO, + GPIO72_GPIO, + GPIO73_GPIO, +}; + +/* register offsets for gpio control */ +#define PWR_GPIO_PIN 16 +#define CFG_GPIO_PIN 17 +#define RDY_GPIO_PIN 32 +#define DC_GPIO_PIN 48 +#define RST_GPIO_PIN 49 +#define LED_GPIO_PIN 51 +#define RD_GPIO_PIN 74 +#define WR_GPIO_PIN 75 +#define CS_GPIO_PIN 76 +#define IRQ_GPIO_PIN 77 + +/* hdb bus */ +#define DB0_GPIO_PIN 58 +#define DB15_GPIO_PIN 73 + +static int gpios[] = { PWR_GPIO_PIN, CFG_GPIO_PIN, RDY_GPIO_PIN, DC_GPIO_PIN, + RST_GPIO_PIN, RD_GPIO_PIN, WR_GPIO_PIN, CS_GPIO_PIN, + IRQ_GPIO_PIN, LED_GPIO_PIN }; +static char *gpio_names[] = { "PWR", "CFG", "RDY", "DC", "RST", "RD", "WR", + "CS", "IRQ", "LED" }; + +static int am300_wait_event(struct broadsheetfb_par *par) +{ + /* todo: improve err recovery */ + wait_event(par->waitq, gpio_get_value(RDY_GPIO_PIN)); + return 0; +} + +static int am300_init_gpio_regs(struct broadsheetfb_par *par) +{ + int i; + int err; + char dbname[8]; + + for (i = 0; i < ARRAY_SIZE(gpios); i++) { + err = gpio_request(gpios[i], gpio_names[i]); + if (err) { + dev_err(&am300_device->dev, "failed requesting " + "gpio %s, err=%d\n", gpio_names[i], err); + goto err_req_gpio; + } + } + + /* we also need to take care of the hdb bus */ + for (i = DB0_GPIO_PIN; i <= DB15_GPIO_PIN; i++) { + sprintf(dbname, "DB%d", i); + err = gpio_request(i, dbname); + if (err) { + dev_err(&am300_device->dev, "failed requesting " + "gpio %d, err=%d\n", i, err); + while (i >= DB0_GPIO_PIN) + gpio_free(i--); + i = ARRAY_SIZE(gpios) - 1; + goto err_req_gpio; + } + } + + /* setup the outputs and init values */ + gpio_direction_output(PWR_GPIO_PIN, 0); + gpio_direction_output(CFG_GPIO_PIN, 1); + gpio_direction_output(DC_GPIO_PIN, 0); + gpio_direction_output(RD_GPIO_PIN, 1); + gpio_direction_output(WR_GPIO_PIN, 1); + gpio_direction_output(CS_GPIO_PIN, 1); + gpio_direction_output(RST_GPIO_PIN, 0); + + /* setup the inputs */ + gpio_direction_input(RDY_GPIO_PIN); + gpio_direction_input(IRQ_GPIO_PIN); + + /* start the hdb bus as an input */ + for (i = DB0_GPIO_PIN; i <= DB15_GPIO_PIN; i++) + gpio_direction_output(i, 0); + + /* go into command mode */ + gpio_set_value(CFG_GPIO_PIN, 1); + gpio_set_value(RST_GPIO_PIN, 0); + msleep(10); + gpio_set_value(RST_GPIO_PIN, 1); + msleep(10); + am300_wait_event(par); + + return 0; + +err_req_gpio: + while (i > 0) + gpio_free(gpios[i--]); + + return err; +} + +static int am300_init_board(struct broadsheetfb_par *par) +{ + return am300_init_gpio_regs(par); +} + +static void am300_cleanup(struct broadsheetfb_par *par) +{ + int i; + + free_irq(IRQ_GPIO(RDY_GPIO_PIN), par); + + for (i = 0; i < ARRAY_SIZE(gpios); i++) + gpio_free(gpios[i]); + + for (i = DB0_GPIO_PIN; i <= DB15_GPIO_PIN; i++) + gpio_free(i); + +} + +static u16 am300_get_hdb(struct broadsheetfb_par *par) +{ + u16 res = 0; + int i; + + for (i = 0; i <= (DB15_GPIO_PIN - DB0_GPIO_PIN) ; i++) + res |= (gpio_get_value(DB0_GPIO_PIN + i)) ? (1 << i) : 0; + + return res; +} + +static void am300_set_hdb(struct broadsheetfb_par *par, u16 data) +{ + int i; + + for (i = 0; i <= (DB15_GPIO_PIN - DB0_GPIO_PIN) ; i++) + gpio_set_value(DB0_GPIO_PIN + i, (data >> i) & 0x01); +} + + +static void am300_set_ctl(struct broadsheetfb_par *par, unsigned char bit, + u8 state) +{ + switch (bit) { + case BS_CS: + gpio_set_value(CS_GPIO_PIN, state); + break; + case BS_DC: + gpio_set_value(DC_GPIO_PIN, state); + break; + case BS_WR: + gpio_set_value(WR_GPIO_PIN, state); + break; + } +} + +static int am300_get_panel_type(void) +{ + return panel_type; +} + +static irqreturn_t am300_handle_irq(int irq, void *dev_id) +{ + struct broadsheetfb_par *par = dev_id; + + wake_up(&par->waitq); + return IRQ_HANDLED; +} + +static int am300_setup_irq(struct fb_info *info) +{ + int ret; + struct broadsheetfb_par *par = info->par; + + ret = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am300_handle_irq, + IRQF_DISABLED|IRQF_TRIGGER_RISING, + "AM300", par); + if (ret) + dev_err(&am300_device->dev, "request_irq failed: %d\n", ret); + + return ret; +} + +static struct broadsheet_board am300_board = { + .owner = THIS_MODULE, + .init = am300_init_board, + .cleanup = am300_cleanup, + .set_hdb = am300_set_hdb, + .get_hdb = am300_get_hdb, + .set_ctl = am300_set_ctl, + .wait_for_rdy = am300_wait_event, + .get_panel_type = am300_get_panel_type, + .setup_irq = am300_setup_irq, +}; + +int __init am300_init(void) +{ + int ret; + + pxa2xx_mfp_config(ARRAY_AND_SIZE(am300_pin_config)); + + /* request our platform independent driver */ + request_module("broadsheetfb"); + + am300_device = platform_device_alloc("broadsheetfb", -1); + if (!am300_device) + return -ENOMEM; + + /* the am300_board that will be seen by broadsheetfb is a copy */ + platform_device_add_data(am300_device, &am300_board, + sizeof(am300_board)); + + ret = platform_device_add(am300_device); + + if (ret) { + platform_device_put(am300_device); + return ret; + } + + return 0; +} + +module_param(panel_type, uint, 0); +MODULE_PARM_DESC(panel_type, "Select the panel type: 6, 8, 97"); + +MODULE_DESCRIPTION("board driver for am300 epd kit"); +MODULE_AUTHOR("Jaya Kumar"); +MODULE_LICENSE("GPL"); diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c index 40b77408451..db52d2c4791 100644 --- a/arch/arm/mach-pxa/clock.c +++ b/arch/arm/mach-pxa/clock.c @@ -87,7 +87,7 @@ void clks_register(struct clk_lookup *clks, size_t num) clkdev_add(&clks[i]); } -int clk_add_alias(char *alias, struct device *alias_dev, char *id, +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id, struct device *dev) { struct clk *r = clk_get(dev, id); @@ -96,7 +96,7 @@ int clk_add_alias(char *alias, struct device *alias_dev, char *id, if (!r) return -ENODEV; - l = clkdev_alloc(r, alias, alias_dev ? dev_name(alias_dev) : NULL); + l = clkdev_alloc(r, alias, alias_dev_name); clk_put(r); if (!l) return -ENODEV; diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h index 4e9c613c676..5599bceff73 100644 --- a/arch/arm/mach-pxa/clock.h +++ b/arch/arm/mach-pxa/clock.h @@ -69,6 +69,6 @@ extern void clk_pxa3xx_cken_disable(struct clk *); #endif void clks_register(struct clk_lookup *clks, size_t num); -int clk_add_alias(char *alias, struct device *alias_dev, char *id, +int clk_add_alias(const char *alias, const char *alias_name, char *id, struct device *dev); diff --git a/arch/arm/mach-pxa/cm-x255.c b/arch/arm/mach-pxa/cm-x255.c index 83a4cdf0817..253fd76142d 100644 --- a/arch/arm/mach-pxa/cm-x255.c +++ b/arch/arm/mach-pxa/cm-x255.c @@ -22,10 +22,8 @@ #include <asm/mach-types.h> #include <asm/mach/map.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa25x.h> +#include <mach/pxa25x.h> #include <mach/pxa2xx_spi.h> -#include <mach/bitfield.h> #include "generic.h" diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c index df83b97f303..34576ba5f5f 100644 --- a/arch/arm/mach-pxa/cm-x270.c +++ b/arch/arm/mach-pxa/cm-x270.c @@ -17,7 +17,7 @@ #include <linux/rtc-v3020.h> #include <video/mbxfb.h> -#include <mach/mfp-pxa27x.h> +#include <mach/pxa27x.h> #include <mach/ohci.h> #include <mach/mmc.h> diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c index 3156b25f6e9..7873fa3d8fa 100644 --- a/arch/arm/mach-pxa/cm-x2xx-pci.c +++ b/arch/arm/mach-pxa/cm-x2xx-pci.c @@ -22,7 +22,6 @@ #include <linux/gpio.h> #include <asm/mach/pci.h> -#include <mach/pxa-regs.h> #include <asm/mach-types.h> #include <asm/hardware/it8152.h> diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c index d99fd9e4d88..117b5435f8d 100644 --- a/arch/arm/mach-pxa/cm-x2xx.c +++ b/arch/arm/mach-pxa/cm-x2xx.c @@ -22,8 +22,6 @@ #include <asm/mach/map.h> #include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa27x.h> -#include <mach/pxa-regs.h> #include <mach/audio.h> #include <mach/pxafb.h> @@ -96,7 +94,7 @@ static struct resource cmx270_dm9000_resource[] = { }; static struct dm9000_plat_data cmx270_dm9000_platdata = { - .flags = DM9000_PLATF_32BITONLY, + .flags = DM9000_PLATF_32BITONLY | DM9000_PLATF_NO_EEPROM, }; static struct platform_device cmx2xx_dm9000_device = { diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index ff0c577cd1a..a9f48b1cb54 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c @@ -28,9 +28,7 @@ #include <asm/mach-types.h> #include <asm/mach/arch.h> -#include <mach/mfp-pxa300.h> - -#include <mach/hardware.h> +#include <mach/pxa300.h> #include <mach/pxafb.h> #include <mach/mmc.h> #include <mach/ohci.h> @@ -162,7 +160,7 @@ static struct resource dm9000_resources[] = { }; static struct dm9000_plat_data cm_x300_dm9000_platdata = { - .flags = DM9000_PLATF_16BITONLY, + .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM, }; static struct platform_device dm9000_device = { diff --git a/arch/arm/mach-pxa/colibri.c b/arch/arm/mach-pxa/colibri-pxa270.c index e8473624427..01bcfaae75b 100644 --- a/arch/arm/mach-pxa/colibri.c +++ b/arch/arm/mach-pxa/colibri-pxa270.c @@ -1,7 +1,7 @@ /* - * linux/arch/arm/mach-pxa/colibri.c + * linux/arch/arm/mach-pxa/colibri-pxa270.c * - * Support for Toradex PXA27x based Colibri module + * Support for Toradex PXA270 based Colibri module * Daniel Mack <daniel@caiaq.de> * * This program is free software; you can redistribute it and/or modify @@ -20,6 +20,7 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> +#include <linux/gpio.h> #include <asm/mach-types.h> #include <mach/hardware.h> #include <asm/irq.h> @@ -28,20 +29,23 @@ #include <asm/mach/map.h> #include <asm/mach/irq.h> #include <asm/mach/flash.h> -#include <mach/pxa-regs.h> -#include <mach/mfp-pxa27x.h> + +#include <mach/pxa27x.h> #include <mach/colibri.h> #include "generic.h" #include "devices.h" -static unsigned long colibri_pin_config[] __initdata = { +/* + * GPIO configuration + */ +static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = { GPIO78_nCS_2, /* Ethernet CS */ GPIO114_GPIO, /* Ethernet IRQ */ }; /* - * Flash + * NOR flash */ static struct mtd_partition colibri_partitions[] = { { @@ -70,39 +74,40 @@ static struct physmap_flash_data colibri_flash_data[] = { } }; -static struct resource flash_resource = { +static struct resource colibri_pxa270_flash_resource = { .start = PXA_CS0_PHYS, .end = PXA_CS0_PHYS + SZ_32M - 1, .flags = IORESOURCE_MEM, }; -static struct platform_device flash_device = { +static struct platform_device colibri_pxa270_flash_device = { .name = "physmap-flash", .id = 0, .dev = { .platform_data = colibri_flash_data, }, - .resource = &flash_resource, + .resource = &colibri_pxa270_flash_resource, .num_resources = 1, }; /* * DM9000 Ethernet */ +#if defined(CONFIG_DM9000) static struct resource dm9000_resources[] = { [0] = { - .start = COLIBRI_ETH_PHYS, - .end = COLIBRI_ETH_PHYS + 3, + .start = COLIBRI_PXA270_ETH_PHYS, + .end = COLIBRI_PXA270_ETH_PHYS + 3, .flags = IORESOURCE_MEM, }, [1] = { - .start = COLIBRI_ETH_PHYS + 4, - .end = COLIBRI_ETH_PHYS + 4 + 500, + .start = COLIBRI_PXA270_ETH_PHYS + 4, + .end = COLIBRI_PXA270_ETH_PHYS + 4 + 500, .flags = IORESOURCE_MEM, }, [2] = { - .start = COLIBRI_ETH_IRQ, - .end = COLIBRI_ETH_IRQ, + .start = COLIBRI_PXA270_ETH_IRQ, + .end = COLIBRI_PXA270_ETH_IRQ, .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, }, }; @@ -113,25 +118,28 @@ static struct platform_device dm9000_device = { .num_resources = ARRAY_SIZE(dm9000_resources), .resource = dm9000_resources, }; +#endif /* CONFIG_DM9000 */ -static struct platform_device *colibri_devices[] __initdata = { - &flash_device, +static struct platform_device *colibri_pxa270_devices[] __initdata = { + &colibri_pxa270_flash_device, +#if defined(CONFIG_DM9000) &dm9000_device, +#endif }; -static void __init colibri_init(void) +static void __init colibri_pxa270_init(void) { - pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pin_config)); - - platform_add_devices(colibri_devices, ARRAY_SIZE(colibri_devices)); + pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); + platform_add_devices(ARRAY_AND_SIZE(colibri_pxa270_devices)); } -MACHINE_START(COLIBRI, "Toradex Colibri PXA27x") +MACHINE_START(COLIBRI, "Toradex Colibri PXA270") .phys_io = 0x40000000, .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .boot_params = COLIBRI_SDRAM_BASE + 0x100, - .init_machine = colibri_init, + .init_machine = colibri_pxa270_init, .map_io = pxa_map_io, .init_irq = pxa27x_init_irq, .timer = &pxa_timer, MACHINE_END + diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c new file mode 100644 index 00000000000..10c2eaf9323 --- /dev/null +++ b/arch/arm/mach-pxa/colibri-pxa300.c @@ -0,0 +1,190 @@ +/* + * arch/arm/mach-pxa/colibri-pxa300.c + * + * Support for Toradex PXA300/310 based Colibri module + * + * Daniel Mack <daniel@caiaq.de> + * Matthias Meier <matthias.j.meier@gmx.net> + * + * 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/sizes.h> +#include <asm/mach/arch.h> +#include <asm/mach/irq.h> + +#include <mach/pxa300.h> +#include <mach/colibri.h> +#include <mach/ohci.h> +#include <mach/pxafb.h> + +#include "generic.h" +#include "devices.h" + +#if defined(CONFIG_AX88796) +#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO) +/* + * Asix AX88796 Ethernet + */ +static struct ax_plat_data colibri_asix_platdata = { + .flags = AXFLG_MAC_FROMDEV, + .wordlength = 2 +}; + +static struct resource colibri_asix_resource[] = { + [0] = { + .start = PXA3xx_CS2_PHYS, + .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), + .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), + .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 + } +}; + +static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = { + GPIO1_nCS2, /* AX88796 chip select */ + GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */ +}; + +static void __init colibri_pxa300_init_eth(void) +{ + pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config)); + set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING); + platform_device_register(&asix_device); +} +#else +static inline void __init colibri_pxa300_init_eth(void) {} +#endif /* CONFIG_AX88796 */ + +#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) +static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = { + GPIO0_2_USBH_PEN, + GPIO1_2_USBH_PWR, +}; + +static struct pxaohci_platform_data colibri_pxa300_ohci_info = { + .port_mode = PMM_GLOBAL_MODE, + .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW, +}; + +void __init colibri_pxa300_init_ohci(void) +{ + pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config)); + pxa_set_ohci_info(&colibri_pxa300_ohci_info); +} +#else +static inline void colibri_pxa300_init_ohci(void) {} +#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */ + +static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = { + GPIO7_MMC1_CLK, + GPIO14_MMC1_CMD, + GPIO3_MMC1_DAT0, + GPIO4_MMC1_DAT1, + GPIO5_MMC1_DAT2, + GPIO6_MMC1_DAT3, +}; + +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) +static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = { + GPIO54_LCD_LDD_0, + GPIO55_LCD_LDD_1, + GPIO56_LCD_LDD_2, + GPIO57_LCD_LDD_3, + GPIO58_LCD_LDD_4, + GPIO59_LCD_LDD_5, + GPIO60_LCD_LDD_6, + GPIO61_LCD_LDD_7, + GPIO62_LCD_LDD_8, + GPIO63_LCD_LDD_9, + GPIO64_LCD_LDD_10, + GPIO65_LCD_LDD_11, + GPIO66_LCD_LDD_12, + GPIO67_LCD_LDD_13, + GPIO68_LCD_LDD_14, + GPIO69_LCD_LDD_15, + GPIO70_LCD_LDD_16, + GPIO71_LCD_LDD_17, + GPIO62_LCD_CS_N, + GPIO72_LCD_FCLK, + GPIO73_LCD_LCLK, + GPIO74_LCD_PCLK, + GPIO75_LCD_BIAS, + GPIO76_LCD_VSYNC, +}; + +static void __init colibri_pxa300_init_lcd(void) +{ + pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config)); +} + +#else +static inline void colibri_pxa300_init_lcd(void) {} +#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */ + +#if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE) +static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = { + GPIO24_AC97_SYSCLK, + GPIO23_AC97_nACRESET, + GPIO25_AC97_SDATA_IN_0, + GPIO27_AC97_SDATA_OUT, + GPIO28_AC97_SYNC, + GPIO29_AC97_BITCLK +}; + +static inline void __init colibri_pxa310_init_ac97(void) +{ + /* no AC97 codec on Colibri PXA300 */ + if (!cpu_is_pxa310()) + return; + + pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config)); + pxa_set_ac97_info(NULL); +} +#else +static inline void colibri_pxa310_init_ac97(void) {} +#endif + +void __init colibri_pxa300_init(void) +{ + colibri_pxa300_init_eth(); + colibri_pxa300_init_ohci(); + colibri_pxa300_init_lcd(); + colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO)); + colibri_pxa310_init_ac97(); + colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config), + mfp_to_gpio(MFP_PIN_GPIO13)); +} + +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 + diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c new file mode 100644 index 00000000000..55b74a7a615 --- /dev/null +++ b/arch/arm/mach-pxa/colibri-pxa320.c @@ -0,0 +1,187 @@ +/* + * arch/arm/mach-pxa/colibri-pxa320.c + * + * Support for Toradex PXA320/310 based Colibri module + * + * Daniel Mack <daniel@caiaq.de> + * Matthias Meier <matthias.j.meier@gmx.net> + * + * 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/sizes.h> +#include <asm/mach/arch.h> +#include <asm/mach/irq.h> + +#include <mach/pxa3xx-regs.h> +#include <mach/mfp-pxa320.h> +#include <mach/colibri.h> +#include <mach/pxafb.h> +#include <mach/ohci.h> + +#include "generic.h" +#include "devices.h" + +#if defined(CONFIG_AX88796) +#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO36_GPIO) + +/* + * Asix AX88796 Ethernet + */ +static struct ax_plat_data colibri_asix_platdata = { + .flags = AXFLG_MAC_FROMDEV, + .wordlength = 2 +}; + +static struct resource colibri_asix_resource[] = { + [0] = { + .start = PXA3xx_CS2_PHYS, + .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), + .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), + .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 + } +}; + +static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = { + GPIO3_nCS2, /* AX88796 chip select */ + GPIO36_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */ +}; + +static void __init colibri_pxa320_init_eth(void) +{ + pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config)); + set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING); + platform_device_register(&asix_device); +} +#else +static inline void __init colibri_pxa320_init_eth(void) {} +#endif /* CONFIG_AX88796 */ + +#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) +static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = { + GPIO2_2_USBH_PEN, + GPIO3_2_USBH_PWR, +}; + +static struct pxaohci_platform_data colibri_pxa320_ohci_info = { + .port_mode = PMM_GLOBAL_MODE, + .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW, +}; + +void __init colibri_pxa320_init_ohci(void) +{ + pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config)); + pxa_set_ohci_info(&colibri_pxa320_ohci_info); +} +#else +static inline void colibri_pxa320_init_ohci(void) {} +#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */ + +static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = { + GPIO22_MMC1_CLK, + GPIO23_MMC1_CMD, + GPIO18_MMC1_DAT0, + GPIO19_MMC1_DAT1, + GPIO20_MMC1_DAT2, + GPIO21_MMC1_DAT3 +}; + +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) +static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = { + GPIO6_2_LCD_LDD_0, + GPIO7_2_LCD_LDD_1, + GPIO8_2_LCD_LDD_2, + GPIO9_2_LCD_LDD_3, + GPIO10_2_LCD_LDD_4, + GPIO11_2_LCD_LDD_5, + GPIO12_2_LCD_LDD_6, + GPIO13_2_LCD_LDD_7, + GPIO63_LCD_LDD_8, + GPIO64_LCD_LDD_9, + GPIO65_LCD_LDD_10, + GPIO66_LCD_LDD_11, + GPIO67_LCD_LDD_12, + GPIO68_LCD_LDD_13, + GPIO69_LCD_LDD_14, + GPIO70_LCD_LDD_15, + GPIO71_LCD_LDD_16, + GPIO72_LCD_LDD_17, + GPIO73_LCD_CS_N, + GPIO74_LCD_VSYNC, + GPIO14_2_LCD_FCLK, + GPIO15_2_LCD_LCLK, + GPIO16_2_LCD_PCLK, + GPIO17_2_LCD_BIAS, +}; + +static void __init colibri_pxa320_init_lcd(void) +{ + pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config)); +} +#else +static inline void colibri_pxa320_init_lcd(void) {} +#endif + +#if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE) +static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = { + GPIO34_AC97_SYSCLK, + GPIO35_AC97_SDATA_IN_0, + GPIO37_AC97_SDATA_OUT, + GPIO38_AC97_SYNC, + GPIO39_AC97_BITCLK, + GPIO40_AC97_nACRESET +}; + +static inline void __init colibri_pxa320_init_ac97(void) +{ + pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config)); + pxa_set_ac97_info(NULL); +} +#else +static inline void colibri_pxa320_init_ac97(void) {} +#endif + +void __init colibri_pxa320_init(void) +{ + colibri_pxa320_init_eth(); + colibri_pxa320_init_ohci(); + colibri_pxa320_init_lcd(); + colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO)); + colibri_pxa320_init_ac97(); + colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config), + mfp_to_gpio(MFP_PIN_GPIO28)); +} + +MACHINE_START(COLIBRI320, "Toradex Colibri PXA320") + .phys_io = 0x40000000, + .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, + .boot_params = COLIBRI_SDRAM_BASE + 0x100, + .init_machine = colibri_pxa320_init, + .map_io = pxa_map_io, + .init_irq = pxa3xx_init_irq, + .timer = &pxa_timer, +MACHINE_END + diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c new file mode 100644 index 00000000000..12d0afc54aa --- /dev/null +++ b/arch/arm/mach-pxa/colibri-pxa3xx.c @@ -0,0 +1,121 @@ +/* + * arch/arm/mach-pxa/colibri-pxa3xx.c + * + * Common functions for all Toradex PXA3xx modules + * + * 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 <asm/mach-types.h> +#include <mach/hardware.h> +#include <asm/sizes.h> +#include <asm/mach/arch.h> +#include <asm/mach/irq.h> +#include <mach/pxa3xx-regs.h> +#include <mach/mfp-pxa300.h> +#include <mach/colibri.h> +#include <mach/mmc.h> +#include <mach/pxafb.h> + +#include "generic.h" +#include "devices.h" + +#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) +static int mmc_detect_pin; + +static int colibri_pxa3xx_mci_init(struct device *dev, + irq_handler_t colibri_mmc_detect_int, + void *data) +{ + int ret; + + ret = gpio_request(mmc_detect_pin, "mmc card detect"); + if (ret) + return ret; + + gpio_direction_input(mmc_detect_pin); + ret = request_irq(gpio_to_irq(mmc_detect_pin), colibri_mmc_detect_int, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + "MMC card detect", data); + if (ret) { + gpio_free(mmc_detect_pin); + return ret; + } + + return 0; +} + +static void colibri_pxa3xx_mci_exit(struct device *dev, void *data) +{ + free_irq(mmc_detect_pin, data); + gpio_free(gpio_to_irq(mmc_detect_pin)); +} + +static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = { + .detect_delay = 20, + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, + .init = colibri_pxa3xx_mci_init, + .exit = colibri_pxa3xx_mci_exit, +}; + +void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin) +{ + pxa3xx_mfp_config(pins, len); + mmc_detect_pin = detect_pin; + pxa_set_mci_info(&colibri_pxa3xx_mci_platform_data); +} +#endif /* CONFIG_MMC_PXA || CONFIG_MMC_PXA_MODULE */ + +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) +static int lcd_bl_pin; + +/* + * LCD panel (Sharp LQ043T3DX02) + */ +static void colibri_lcd_backlight(int on) +{ + gpio_set_value(lcd_bl_pin, !!on); +} + +static struct pxafb_mode_info sharp_lq43_mode = { + .pixclock = 101936, + .xres = 480, + .yres = 272, + .bpp = 32, + .depth = 18, + .hsync_len = 41, + .left_margin = 2, + .right_margin = 2, + .vsync_len = 10, + .upper_margin = 2, + .lower_margin = 2, + .sync = 0, + .cmap_greyscale = 0, +}; + +static struct pxafb_mach_info sharp_lq43_info = { + .modes = &sharp_lq43_mode, + .num_modes = 1, + .cmap_inverse = 0, + .cmap_static = 0, + .lcd_conn = LCD_COLOR_TFT_18BPP, + .pxafb_backlight_power = colibri_lcd_backlight, +}; + +void __init colibri_pxa3xx_init_lcd(int bl_pin) +{ + lcd_bl_pin = bl_pin; + gpio_request(bl_pin, "lcd backlight"); + gpio_direction_output(bl_pin, 0); + set_pxa_fb_info(&sharp_lq43_info); +} +#endif + diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index a8d91b6c136..cdf21dd135b 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c @@ -41,9 +41,7 @@ #include <asm/mach/map.h> #include <asm/mach/irq.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa25x.h> +#include <mach/pxa25x.h> #include <mach/i2c.h> #include <mach/irda.h> #include <mach/mmc.h> @@ -637,16 +635,16 @@ static void corgi_poweroff(void) /* Green LED off tells the bootloader to halt */ gpio_set_value(CORGI_GPIO_LED_GREEN, 0); - arm_machine_restart('h'); + arm_machine_restart('h', NULL); } -static void corgi_restart(char mode) +static void corgi_restart(char mode, const char *cmd) { if (!machine_is_corgi()) /* Green LED on tells the bootloader to reboot */ gpio_set_value(CORGI_GPIO_LED_GREEN, 1); - arm_machine_restart('h'); + arm_machine_restart('h', cmd); } static void __init corgi_init(void) diff --git a/arch/arm/mach-pxa/corgi_lcd.c b/arch/arm/mach-pxa/corgi_lcd.c index 411607bc1fc..d9b96319d49 100644 --- a/arch/arm/mach-pxa/corgi_lcd.c +++ b/arch/arm/mach-pxa/corgi_lcd.c @@ -22,7 +22,6 @@ #include <linux/string.h> #include <mach/corgi.h> #include <mach/hardware.h> -#include <mach/pxa-regs.h> #include <mach/sharpsl.h> #include <mach/spitz.h> #include <asm/hardware/scoop.h> diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c index e3525903281..7f04b3a761d 100644 --- a/arch/arm/mach-pxa/corgi_pm.c +++ b/arch/arm/mach-pxa/corgi_pm.c @@ -24,7 +24,6 @@ #include <mach/sharpsl.h> #include <mach/corgi.h> -#include <mach/pxa-regs.h> #include <mach/pxa2xx-regs.h> #include <mach/pxa2xx-gpio.h> #include "sharpsl.h" diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c index 8e2f2215c4b..a5ee70735e0 100644 --- a/arch/arm/mach-pxa/corgi_ssp.c +++ b/arch/arm/mach-pxa/corgi_ssp.c @@ -20,7 +20,6 @@ #include <asm/mach-types.h> #include <mach/ssp.h> -#include <mach/pxa-regs.h> #include <mach/pxa2xx-gpio.h> #include <mach/regs-ssp.h> #include "sharpsl.h" diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c index 771dd4eac93..083a1d851d4 100644 --- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c +++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c @@ -37,8 +37,6 @@ #include <linux/init.h> #include <linux/cpufreq.h> -#include <mach/hardware.h> -#include <mach/pxa-regs.h> #include <mach/pxa2xx-regs.h> #ifdef DEBUG diff --git a/arch/arm/mach-pxa/cpufreq-pxa3xx.c b/arch/arm/mach-pxa/cpufreq-pxa3xx.c index 968c8309ec3..67f34a8d8e6 100644 --- a/arch/arm/mach-pxa/cpufreq-pxa3xx.c +++ b/arch/arm/mach-pxa/cpufreq-pxa3xx.c @@ -15,8 +15,6 @@ #include <linux/init.h> #include <linux/cpufreq.h> -#include <mach/hardware.h> -#include <mach/pxa-regs.h> #include <mach/pxa3xx-regs.h> #include "generic.h" diff --git a/arch/arm/mach-pxa/csb701.c b/arch/arm/mach-pxa/csb701.c new file mode 100644 index 00000000000..4a2a2952c37 --- /dev/null +++ b/arch/arm/mach-pxa/csb701.c @@ -0,0 +1,61 @@ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/gpio_keys.h> +#include <linux/input.h> +#include <linux/leds.h> + +static struct gpio_keys_button csb701_buttons[] = { + { + .code = 0x7, + .gpio = 1, + .active_low = 1, + .desc = "SW2", + .type = EV_SW, + .wakeup = 1, + }, +}; + +static struct gpio_keys_platform_data csb701_gpio_keys_data = { + .buttons = csb701_buttons, + .nbuttons = ARRAY_SIZE(csb701_buttons), +}; + +static struct gpio_led csb701_leds[] = { + { + .name = "csb701:yellow:heartbeat", + .default_trigger = "heartbeat", + .gpio = 11, + .active_low = 1, + }, +}; + +static struct platform_device csb701_gpio_keys = { + .name = "gpio-keys", + .id = -1, + .dev.platform_data = &csb701_gpio_keys_data, +}; + +static struct gpio_led_platform_data csb701_leds_gpio_data = { + .leds = csb701_leds, + .num_leds = ARRAY_SIZE(csb701_leds), +}; + +static struct platform_device csb701_leds_gpio = { + .name = "leds-gpio", + .id = -1, + .dev.platform_data = &csb701_leds_gpio_data, +}; + +static struct platform_device *devices[] __initdata = { + &csb701_gpio_keys, + &csb701_leds_gpio, +}; + +static int __init csb701_init(void) +{ + return platform_add_devices(devices, ARRAY_SIZE(devices)); +} + +module_init(csb701_init); + diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c new file mode 100644 index 00000000000..2b289f83a61 --- /dev/null +++ b/arch/arm/mach-pxa/csb726.c @@ -0,0 +1,318 @@ +/* + * Support for Cogent CSB726 + * + * Copyright (c) 2008 Dmitry Eremin-Solenikov + * + * 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/kernel.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/gpio.h> +#include <linux/platform_device.h> +#include <linux/mtd/physmap.h> +#include <linux/mtd/partitions.h> +#include <linux/sm501.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <mach/csb726.h> +#include <mach/mfp-pxa27x.h> +#include <mach/i2c.h> +#include <mach/mmc.h> +#include <mach/ohci.h> +#include <mach/pxa2xx-regs.h> + +#include "generic.h" +#include "devices.h" + +/* + * n/a: 2, 5, 6, 7, 8, 23, 24, 25, 26, 27, 87, 88, 89, + * nu: 58 -- 77, 90, 91, 93, 102, 105-108, 114-116, + * XXX: 21, + * XXX: 79 CS_3 for LAN9215 or PSKTSEL on R2, R3 + * XXX: 33 CS_5 for LAN9215 on R1 + */ + +static unsigned long csb726_pin_config[] = { + GPIO78_nCS_2, /* EXP_CS */ + GPIO79_nCS_3, /* SMSC9215 */ + GPIO80_nCS_4, /* SM501 */ + + GPIO52_GPIO, /* #SMSC9251 int */ + GPIO53_GPIO, /* SM501 int */ + + GPIO1_GPIO, /* GPIO0 */ + GPIO11_GPIO, /* GPIO1 */ + GPIO9_GPIO, /* GPIO2 */ + GPIO10_GPIO, /* GPIO3 */ + GPIO16_PWM0_OUT, /* or GPIO4 */ + GPIO17_PWM1_OUT, /* or GPIO5 */ + GPIO94_GPIO, /* GPIO6 */ + GPIO95_GPIO, /* GPIO7 */ + GPIO96_GPIO, /* GPIO8 */ + GPIO97_GPIO, /* GPIO9 */ + GPIO15_GPIO, /* EXP_IRQ */ + GPIO18_RDY, /* EXP_WAIT */ + + GPIO0_GPIO, /* PWR_INT */ + GPIO104_GPIO, /* PWR_OFF */ + + GPIO12_GPIO, /* touch irq */ + + GPIO13_SSP2_TXD, + GPIO14_SSP2_SFRM, + MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),/* SSP2_SYSCLK */ + GPIO22_SSP2_SCLK, + + GPIO81_SSP3_TXD, + GPIO82_SSP3_RXD, + GPIO83_SSP3_SFRM, + GPIO84_SSP3_SCLK, + + GPIO20_GPIO, /* SDIO int */ + GPIO32_MMC_CLK, + GPIO92_MMC_DAT_0, + GPIO109_MMC_DAT_1, + GPIO110_MMC_DAT_2, + GPIO111_MMC_DAT_3, + GPIO112_MMC_CMD, + GPIO100_GPIO, /* SD CD */ + GPIO101_GPIO, /* SD WP */ + + GPIO28_AC97_BITCLK, + GPIO29_AC97_SDATA_IN_0, + GPIO30_AC97_SDATA_OUT, + GPIO31_AC97_SYNC, + GPIO113_AC97_nRESET, + + GPIO34_FFUART_RXD, + GPIO35_FFUART_CTS, + GPIO36_FFUART_DCD, + GPIO37_FFUART_DSR, + GPIO38_FFUART_RI, + GPIO39_FFUART_TXD, + GPIO40_FFUART_DTR, + GPIO41_FFUART_RTS, + + GPIO42_BTUART_RXD, + GPIO43_BTUART_TXD, + GPIO44_BTUART_CTS, + GPIO45_BTUART_RTS, + + GPIO46_STUART_RXD, + GPIO47_STUART_TXD, + + GPIO48_nPOE, + GPIO49_nPWE, + GPIO50_nPIOR, + GPIO51_nPIOW, + GPIO54_nPCE_2, + GPIO55_nPREG, + GPIO56_nPWAIT, + GPIO57_nIOIS16, /* maybe unused */ + GPIO85_nPCE_1, + GPIO98_GPIO, /* CF IRQ */ + GPIO99_GPIO, /* CF CD */ + GPIO103_GPIO, /* Reset */ + + GPIO117_I2C_SCL, + GPIO118_I2C_SDA, +}; + +static struct pxamci_platform_data csb726_mci_data; + +static int csb726_mci_init(struct device *dev, + irq_handler_t detect, void *data) +{ + int err; + + csb726_mci_data.detect_delay = msecs_to_jiffies(500); + + err = gpio_request(CSB726_GPIO_MMC_DETECT, "MMC detect"); + if (err) + goto err_det_req; + + err = gpio_direction_input(CSB726_GPIO_MMC_DETECT); + if (err) + goto err_det_dir; + + err = gpio_request(CSB726_GPIO_MMC_RO, "MMC ro"); + if (err) + goto err_ro_req; + + err = gpio_direction_input(CSB726_GPIO_MMC_RO); + if (err) + goto err_ro_dir; + + err = request_irq(gpio_to_irq(CSB726_GPIO_MMC_DETECT), detect, + IRQF_DISABLED, "MMC card detect", data); + if (err) + goto err_irq; + + return 0; + +err_irq: +err_ro_dir: + gpio_free(CSB726_GPIO_MMC_RO); +err_ro_req: +err_det_dir: + gpio_free(CSB726_GPIO_MMC_DETECT); +err_det_req: + return err; +} + +static int csb726_mci_get_ro(struct device *dev) +{ + return gpio_get_value(CSB726_GPIO_MMC_RO); +} + +static void csb726_mci_exit(struct device *dev, void *data) +{ + free_irq(gpio_to_irq(CSB726_GPIO_MMC_DETECT), data); + gpio_free(CSB726_GPIO_MMC_RO); + gpio_free(CSB726_GPIO_MMC_DETECT); +} + +static struct pxamci_platform_data csb726_mci = { + .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, + .init = csb726_mci_init, + .get_ro = csb726_mci_get_ro, + /* FIXME setpower */ + .exit = csb726_mci_exit, +}; + +static struct pxaohci_platform_data csb726_ohci_platform_data = { + .port_mode = PMM_NPS_MODE, + .flags = ENABLE_PORT1 | NO_OC_PROTECTION, +}; + +static struct mtd_partition csb726_flash_partitions[] = { + { + .name = "Bootloader", + .offset = 0, + .size = CSB726_FLASH_uMON, + .mask_flags = MTD_WRITEABLE /* force read-only */ + }, + { + .name = "root", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; + +static struct physmap_flash_data csb726_flash_data = { + .width = 2, + .parts = csb726_flash_partitions, + .nr_parts = ARRAY_SIZE(csb726_flash_partitions), +}; + +static struct resource csb726_flash_resources[] = { + { + .start = PXA_CS0_PHYS, + .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 , + .flags = IORESOURCE_MEM, + } +}; + +static struct platform_device csb726_flash = { + .name = "physmap-flash", + .dev = { + .platform_data = &csb726_flash_data, + }, + .resource = csb726_flash_resources, + .num_resources = ARRAY_SIZE(csb726_flash_resources), +}; + +static struct resource csb726_sm501_resources[] = { + { + .start = PXA_CS4_PHYS, + .end = PXA_CS4_PHYS + SZ_8M - 1, + .flags = IORESOURCE_MEM, + .name = "sm501-localmem", + }, + { + .start = PXA_CS4_PHYS + SZ_64M - SZ_2M, + .end = PXA_CS4_PHYS + SZ_64M - 1, + .flags = IORESOURCE_MEM, + .name = "sm501-regs", + }, + { + .start = CSB726_IRQ_SM501, + .end = CSB726_IRQ_SM501, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct sm501_initdata csb726_sm501_initdata = { +/* .devices = SM501_USE_USB_HOST, */ + .devices = SM501_USE_USB_HOST | SM501_USE_UART0 | SM501_USE_UART1, +}; + +static struct sm501_platdata csb726_sm501_platdata = { + .init = &csb726_sm501_initdata, +}; + +static struct platform_device csb726_sm501 = { + .name = "sm501", + .id = 0, + .num_resources = ARRAY_SIZE(csb726_sm501_resources), + .resource = csb726_sm501_resources, + .dev = { + .platform_data = &csb726_sm501_platdata, + }, +}; + +static struct resource csb726_lan_resources[] = { + { + .start = PXA_CS3_PHYS, + .end = PXA_CS3_PHYS + SZ_64K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = CSB726_IRQ_LAN, + .end = CSB726_IRQ_LAN, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device csb726_lan = { + .name = "smc911x", + .id = -1, + .num_resources = ARRAY_SIZE(csb726_lan_resources), + .resource = csb726_lan_resources, +}; + +static struct platform_device *devices[] __initdata = { + &csb726_flash, + &csb726_sm501, + &csb726_lan, +}; + +static void __init csb726_init(void) +{ + pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config)); +/* MSC1 = 0x7ffc3ffc; *//* LAN9215/EXP_CS */ +/* MSC2 = 0x06697ff4; *//* none/SM501 */ + MSC2 = (MSC2 & ~0xffff) | 0x7ff4; /* SM501 */ + + pxa_set_i2c_info(NULL); + pxa27x_set_i2c_power_info(NULL); + pxa_set_mci_info(&csb726_mci); + pxa_set_ohci_info(&csb726_ohci_platform_data); + + platform_add_devices(devices, ARRAY_SIZE(devices)); +} + +MACHINE_START(CSB726, "Cogent CSB726") + .phys_io = 0x40000000, + .boot_params = 0xa0000100, + .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, + .map_io = pxa_map_io, + .init_irq = pxa27x_init_irq, + .init_machine = csb726_init, + .timer = &pxa_timer, +MACHINE_END diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index e16f8e3d58d..d245e59c51b 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -4,7 +4,6 @@ #include <linux/platform_device.h> #include <linux/dma-mapping.h> -#include <mach/pxa-regs.h> #include <mach/udc.h> #include <mach/pxafb.h> #include <mach/mmc.h> diff --git a/arch/arm/mach-pxa/dma.c b/arch/arm/mach-pxa/dma.c deleted file mode 100644 index 7de17fc5d54..00000000000 --- a/arch/arm/mach-pxa/dma.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * linux/arch/arm/mach-pxa/dma.c - * - * PXA DMA registration and IRQ dispatching - * - * Author: Nicolas Pitre - * Created: Nov 15, 2001 - * Copyright: MontaVista Software Inc. - * - * 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/module.h> -#include <linux/init.h> -#include <linux/kernel.h> -#include <linux/interrupt.h> -#include <linux/errno.h> - -#include <asm/system.h> -#include <asm/irq.h> -#include <mach/hardware.h> -#include <mach/dma.h> - -#include <mach/pxa-regs.h> - -struct dma_channel { - char *name; - pxa_dma_prio prio; - void (*irq_handler)(int, void *); - void *data; -}; - -static struct dma_channel *dma_channels; -static int num_dma_channels; - -int pxa_request_dma (char *name, pxa_dma_prio prio, - void (*irq_handler)(int, void *), - void *data) -{ - unsigned long flags; - int i, found = 0; - - /* basic sanity checks */ - if (!name || !irq_handler) - return -EINVAL; - - local_irq_save(flags); - - do { - /* try grabbing a DMA channel with the requested priority */ - for (i = 0; i < num_dma_channels; i++) { - if ((dma_channels[i].prio == prio) && - !dma_channels[i].name) { - found = 1; - break; - } - } - /* if requested prio group is full, try a hier priority */ - } while (!found && prio--); - - if (found) { - DCSR(i) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR; - dma_channels[i].name = name; - dma_channels[i].irq_handler = irq_handler; - dma_channels[i].data = data; - } else { - printk (KERN_WARNING "No more available DMA channels for %s\n", name); - i = -ENODEV; - } - - local_irq_restore(flags); - return i; -} - -void pxa_free_dma (int dma_ch) -{ - unsigned long flags; - - if (!dma_channels[dma_ch].name) { - printk (KERN_CRIT - "%s: trying to free channel %d which is already freed\n", - __func__, dma_ch); - return; - } - - local_irq_save(flags); - DCSR(dma_ch) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR; - dma_channels[dma_ch].name = NULL; - local_irq_restore(flags); -} - -static irqreturn_t dma_irq_handler(int irq, void *dev_id) -{ - int i, dint = DINT; - - for (i = 0; i < num_dma_channels; i++) { - if (dint & (1 << i)) { - struct dma_channel *channel = &dma_channels[i]; - if (channel->name && channel->irq_handler) { - channel->irq_handler(i, channel->data); - } else { - /* - * IRQ for an unregistered DMA channel: - * let's clear the interrupts and disable it. - */ - printk (KERN_WARNING "spurious IRQ for DMA channel %d\n", i); - DCSR(i) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR; - } - } - } - return IRQ_HANDLED; -} - -int __init pxa_init_dma(int num_ch) -{ - int i, ret; - - dma_channels = kzalloc(sizeof(struct dma_channel) * num_ch, GFP_KERNEL); - if (dma_channels == NULL) - return -ENOMEM; - - /* dma channel priorities on pxa2xx processors: - * ch 0 - 3, 16 - 19 <--> (0) DMA_PRIO_HIGH - * ch 4 - 7, 20 - 23 <--> (1) DMA_PRIO_MEDIUM - * ch 8 - 15, 24 - 31 <--> (2) DMA_PRIO_LOW - */ - for (i = 0; i < num_ch; i++) { - DCSR(i) = 0; - dma_channels[i].prio = min((i & 0xf) >> 2, DMA_PRIO_LOW); - } - - ret = request_irq(IRQ_DMA, dma_irq_handler, IRQF_DISABLED, "DMA", NULL); - if (ret) { - printk (KERN_CRIT "Wow! Can't register IRQ for DMA\n"); - kfree(dma_channels); - return ret; - } - - num_dma_channels = num_ch; - return 0; -} - -EXPORT_SYMBOL(pxa_request_dma); -EXPORT_SYMBOL(pxa_free_dma); diff --git a/arch/arm/mach-pxa/e330.c b/arch/arm/mach-pxa/e330.c index 1bd7f740427..74d3f8987c5 100644 --- a/arch/arm/mach-pxa/e330.c +++ b/arch/arm/mach-pxa/e330.c @@ -20,9 +20,7 @@ #include <asm/mach/arch.h> #include <asm/mach-types.h> -#include <mach/mfp-pxa25x.h> -#include <mach/hardware.h> -#include <mach/pxa-regs.h> +#include <mach/pxa25x.h> #include <mach/eseries-gpio.h> #include <mach/udc.h> diff --git a/arch/arm/mach-pxa/e350.c b/arch/arm/mach-pxa/e350.c index edcd9d5ce54..08003627213 100644 --- a/arch/arm/mach-pxa/e350.c +++ b/arch/arm/mach-pxa/e350.c @@ -21,9 +21,7 @@ #include <asm/mach-types.h> #include <mach/irqs.h> -#include <mach/mfp-pxa25x.h> -#include <mach/pxa-regs.h> -#include <mach/hardware.h> +#include <mach/pxa25x.h> #include <mach/eseries-gpio.h> #include <mach/udc.h> diff --git a/arch/arm/mach-pxa/e400.c b/arch/arm/mach-pxa/e400.c index 77bb8e2c48c..ed9c0c3f64a 100644 --- a/arch/arm/mach-pxa/e400.c +++ b/arch/arm/mach-pxa/e400.c @@ -22,9 +22,7 @@ #include <asm/mach/arch.h> #include <asm/mach-types.h> -#include <mach/mfp-pxa25x.h> -#include <mach/pxa-regs.h> -#include <mach/hardware.h> +#include <mach/pxa25x.h> #include <mach/eseries-gpio.h> #include <mach/pxafb.h> #include <mach/udc.h> diff --git a/arch/arm/mach-pxa/e740.c b/arch/arm/mach-pxa/e740.c index 6d48e00f4f0..07500a04fd8 100644 --- a/arch/arm/mach-pxa/e740.c +++ b/arch/arm/mach-pxa/e740.c @@ -24,9 +24,7 @@ #include <asm/mach/arch.h> #include <asm/mach-types.h> -#include <mach/mfp-pxa25x.h> -#include <mach/pxa-regs.h> -#include <mach/hardware.h> +#include <mach/pxa25x.h> #include <mach/eseries-gpio.h> #include <mach/udc.h> #include <mach/irda.h> @@ -135,6 +133,11 @@ static unsigned long e740_pin_config[] __initdata = { /* IrDA */ GPIO38_GPIO | MFP_LPM_DRIVE_HIGH, + /* Audio power control */ + GPIO16_GPIO, /* AC97 codec AVDD2 supply (analogue power) */ + GPIO40_GPIO, /* Mic amp power */ + GPIO41_GPIO, /* Headphone amp power */ + /* PC Card */ GPIO8_GPIO, /* CD0 */ GPIO44_GPIO, /* CD1 */ @@ -189,7 +192,7 @@ static void __init e740_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config)); eseries_register_clks(); - clk_add_alias("CLK_CK48M", &e740_t7l66xb_device.dev, + clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name, "UDCCLK", &pxa25x_device_udc.dev), eseries_get_tmio_gpios(); platform_add_devices(devices, ARRAY_SIZE(devices)); diff --git a/arch/arm/mach-pxa/e750.c b/arch/arm/mach-pxa/e750.c index be1ab8edb97..6126c04e02b 100644 --- a/arch/arm/mach-pxa/e750.c +++ b/arch/arm/mach-pxa/e750.c @@ -23,9 +23,7 @@ #include <asm/mach/arch.h> #include <asm/mach-types.h> -#include <mach/mfp-pxa25x.h> -#include <mach/pxa-regs.h> -#include <mach/hardware.h> +#include <mach/pxa25x.h> #include <mach/eseries-gpio.h> #include <mach/udc.h> #include <mach/irda.h> @@ -133,6 +131,11 @@ static unsigned long e750_pin_config[] __initdata = { /* IrDA */ GPIO38_GPIO | MFP_LPM_DRIVE_HIGH, + /* Audio power control */ + GPIO4_GPIO, /* Headphone amp power */ + GPIO7_GPIO, /* Speaker amp power */ + GPIO37_GPIO, /* Headphone detect */ + /* PC Card */ GPIO8_GPIO, /* CD0 */ GPIO44_GPIO, /* CD1 */ @@ -190,7 +193,7 @@ static struct platform_device *devices[] __initdata = { static void __init e750_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(e750_pin_config)); - clk_add_alias("CLK_CK3P6MI", &e750_tc6393xb_device.dev, + clk_add_alias("CLK_CK3P6MI", e750_tc6393xb_device.name, "GPIO11_CLK", NULL), eseries_get_tmio_gpios(); platform_add_devices(devices, ARRAY_SIZE(devices)); diff --git a/arch/arm/mach-pxa/e800.c b/arch/arm/mach-pxa/e800.c index cc9b1293e86..74ab09812a7 100644 --- a/arch/arm/mach-pxa/e800.c +++ b/arch/arm/mach-pxa/e800.c @@ -23,9 +23,7 @@ #include <asm/mach/arch.h> #include <asm/mach-types.h> -#include <mach/mfp-pxa25x.h> -#include <mach/pxa-regs.h> -#include <mach/hardware.h> +#include <mach/pxa25x.h> #include <mach/eseries-gpio.h> #include <mach/udc.h> #include <mach/irqs.h> @@ -196,7 +194,7 @@ static struct platform_device *devices[] __initdata = { static void __init e800_init(void) { - clk_add_alias("CLK_CK3P6MI", &e800_tc6393xb_device.dev, + clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name, "GPIO11_CLK", NULL), eseries_get_tmio_gpios(); platform_add_devices(devices, ARRAY_SIZE(devices)); diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index f5ed8038ede..920dfb8d36d 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c @@ -11,40 +11,63 @@ #include <linux/irq.h> #include <linux/platform_device.h> +#include <linux/delay.h> #include <linux/dm9000.h> #include <linux/rtc-v3020.h> #include <linux/mtd/nand.h> #include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> #include <linux/input.h> #include <linux/gpio_keys.h> #include <linux/gpio.h> +#include <linux/mfd/da903x.h> +#include <linux/regulator/machine.h> +#include <linux/spi/spi.h> +#include <linux/spi/tdo24m.h> +#include <linux/power_supply.h> +#include <linux/apm-emulation.h> + +#include <media/soc_camera.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> -#include <mach/mfp-pxa27x.h> -#include <mach/pxa-regs.h> +#include <mach/pxa27x.h> #include <mach/pxa27x-udc.h> #include <mach/audio.h> #include <mach/pxafb.h> #include <mach/ohci.h> #include <mach/mmc.h> #include <mach/pxa27x_keypad.h> +#include <mach/i2c.h> +#include <mach/camera.h> +#include <mach/pxa2xx_spi.h> #include "generic.h" +#include "devices.h" -/* GPIO IRQ usage */ -#define GPIO41_ETHIRQ (41) +/* EM-X270 specific GPIOs */ #define GPIO13_MMC_CD (13) +#define GPIO95_MMC_WP (95) +#define GPIO56_NAND_RB (56) + +/* eXeda specific GPIOs */ +#define GPIO114_MMC_CD (114) +#define GPIO20_NAND_RB (20) +#define GPIO38_SD_PWEN (38) + +/* common GPIOs */ +#define GPIO11_NAND_CS (11) +#define GPIO93_CAM_RESET (93) +#define GPIO41_ETHIRQ (41) #define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) -#define EM_X270_MMC_CD IRQ_GPIO(GPIO13_MMC_CD) -/* NAND control GPIOs */ -#define GPIO11_NAND_CS (11) -#define GPIO56_NAND_RB (56) +static int mmc_cd; +static int nand_rb; +static int dm9000_flags; -static unsigned long em_x270_pin_config[] = { +static unsigned long common_pin_config[] = { /* AC'97 */ GPIO28_AC97_BITCLK, GPIO29_AC97_SDATA_IN_0, @@ -150,21 +173,32 @@ static unsigned long em_x270_pin_config[] = { GPIO18_RDY, /* GPIO */ - GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, + GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* sleep/resume button */ /* power controls */ GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */ + GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */ GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */ /* NAND controls */ GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */ - GPIO56_GPIO, /* NAND Ready/Busy */ /* interrupts */ - GPIO13_GPIO, /* MMC card detect */ GPIO41_GPIO, /* DM9000 interrupt */ }; +static unsigned long em_x270_pin_config[] = { + GPIO13_GPIO, /* MMC card detect */ + GPIO56_GPIO, /* NAND Ready/Busy */ + GPIO95_GPIO, /* MMC Write protect */ +}; + +static unsigned long exeda_pin_config[] = { + GPIO20_GPIO, /* NAND Ready/Busy */ + GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */ + GPIO114_GPIO, /* MMC card detect */ +}; + #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) static struct resource em_x270_dm9000_resource[] = { [0] = { @@ -185,7 +219,7 @@ static struct resource em_x270_dm9000_resource[] = { }; static struct dm9000_plat_data em_x270_dm9000_platdata = { - .flags = DM9000_PLATF_32BITONLY, + .flags = DM9000_PLATF_NO_EEPROM, }; static struct platform_device em_x270_dm9000 = { @@ -200,6 +234,7 @@ static struct platform_device em_x270_dm9000 = { static void __init em_x270_init_dm9000(void) { + em_x270_dm9000_platdata.flags |= dm9000_flags; platform_device_register(&em_x270_dm9000); } #else @@ -289,7 +324,7 @@ static int em_x270_nand_device_ready(struct mtd_info *mtd) { dsb(); - return gpio_get_value(GPIO56_NAND_RB); + return gpio_get_value(nand_rb); } static struct mtd_partition em_x270_partition_info[] = { @@ -354,14 +389,14 @@ static void __init em_x270_init_nand(void) gpio_direction_output(GPIO11_NAND_CS, 1); - err = gpio_request(GPIO56_NAND_RB, "NAND R/B"); + err = gpio_request(nand_rb, "NAND R/B"); if (err) { pr_warning("EM-X270: failed to request NAND R/B gpio\n"); gpio_free(GPIO11_NAND_CS); return; } - gpio_direction_input(GPIO56_NAND_RB); + gpio_direction_input(nand_rb); platform_device_register(&em_x270_nand); } @@ -369,6 +404,61 @@ static void __init em_x270_init_nand(void) static inline void em_x270_init_nand(void) {} #endif +#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) +static struct mtd_partition em_x270_nor_parts[] = { + { + .name = "Bootloader", + .offset = 0x00000000, + .size = 0x00050000, + .mask_flags = MTD_WRITEABLE /* force read-only */ + }, { + .name = "Environment", + .offset = 0x00050000, + .size = 0x00010000, + }, { + .name = "Reserved", + .offset = 0x00060000, + .size = 0x00050000, + .mask_flags = MTD_WRITEABLE /* force read-only */ + }, { + .name = "Splashscreen", + .offset = 0x000b0000, + .size = 0x00050000, + } +}; + +static struct physmap_flash_data em_x270_nor_data[] = { + [0] = { + .width = 2, + .parts = em_x270_nor_parts, + .nr_parts = ARRAY_SIZE(em_x270_nor_parts), + }, +}; + +static struct resource em_x270_nor_flash_resource = { + .start = PXA_CS0_PHYS, + .end = PXA_CS0_PHYS + SZ_1M - 1, + .flags = IORESOURCE_MEM, +}; + +static struct platform_device em_x270_physmap_flash = { + .name = "physmap-flash", + .id = 0, + .num_resources = 1, + .resource = &em_x270_nor_flash_resource, + .dev = { + .platform_data = &em_x270_nor_data, + }, +}; + +static void __init em_x270_init_nor(void) +{ + platform_device_register(&em_x270_physmap_flash); +} +#else +static inline void em_x270_init_nor(void) {} +#endif + /* PXA27x OHCI controller setup */ #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) static int em_x270_ohci_init(struct device *dev) @@ -395,40 +485,93 @@ static inline void em_x270_init_ohci(void) {} /* MCI controller setup */ #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) +static struct regulator *em_x270_sdio_ldo; + static int em_x270_mci_init(struct device *dev, irq_handler_t em_x270_detect_int, void *data) { - int err = request_irq(EM_X270_MMC_CD, em_x270_detect_int, - IRQF_DISABLED | IRQF_TRIGGER_FALLING, + int err; + + em_x270_sdio_ldo = regulator_get(dev, "vcc sdio"); + if (IS_ERR(em_x270_sdio_ldo)) { + dev_err(dev, "can't request SDIO power supply: %ld\n", + PTR_ERR(em_x270_sdio_ldo)); + return PTR_ERR(em_x270_sdio_ldo); + } + + err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int, + IRQF_DISABLED | IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING, "MMC card detect", data); if (err) { - printk(KERN_ERR "%s: can't request MMC card detect IRQ: %d\n", - __func__, err); - return err; + dev_err(dev, "can't request MMC card detect IRQ: %d\n", err); + goto err_irq; + } + + if (machine_is_em_x270()) { + err = gpio_request(GPIO95_MMC_WP, "MMC WP"); + if (err) { + dev_err(dev, "can't request MMC write protect: %d\n", + err); + goto err_gpio_wp; + } + gpio_direction_input(GPIO95_MMC_WP); + } else { + err = gpio_request(GPIO38_SD_PWEN, "sdio power"); + if (err) { + dev_err(dev, "can't request MMC power control : %d\n", + err); + goto err_gpio_wp; + } + gpio_direction_output(GPIO38_SD_PWEN, 1); } return 0; + +err_gpio_wp: + free_irq(gpio_to_irq(mmc_cd), data); +err_irq: + regulator_put(em_x270_sdio_ldo); + + return err; } static void em_x270_mci_setpower(struct device *dev, unsigned int vdd) { - /* - FIXME: current hardware implementation does not allow to - enable/disable MMC power. This will be fixed in next HW releases, - and we'll need to add implmentation here. - */ - return; + struct pxamci_platform_data* p_d = dev->platform_data; + + if ((1 << vdd) & p_d->ocr_mask) { + int vdd_uV = (2000 + (vdd - __ffs(MMC_VDD_20_21)) * 100) * 1000; + + regulator_set_voltage(em_x270_sdio_ldo, vdd_uV, vdd_uV); + regulator_enable(em_x270_sdio_ldo); + } else { + regulator_disable(em_x270_sdio_ldo); + } } static void em_x270_mci_exit(struct device *dev, void *data) { - int irq = gpio_to_irq(GPIO13_MMC_CD); - free_irq(irq, data); + free_irq(gpio_to_irq(mmc_cd), data); + regulator_put(em_x270_sdio_ldo); + + if (machine_is_em_x270()) + gpio_free(GPIO95_MMC_WP); + else + gpio_free(GPIO38_SD_PWEN); +} + +static int em_x270_mci_get_ro(struct device *dev) +{ + return gpio_get_value(GPIO95_MMC_WP); } static struct pxamci_platform_data em_x270_mci_platform_data = { - .ocr_mask = MMC_VDD_28_29|MMC_VDD_29_30|MMC_VDD_30_31, + .ocr_mask = MMC_VDD_20_21|MMC_VDD_21_22|MMC_VDD_22_23| + MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27| + MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30| + MMC_VDD_30_31|MMC_VDD_31_32, .init = em_x270_mci_init, .setpower = em_x270_mci_setpower, .exit = em_x270_mci_exit, @@ -436,33 +579,53 @@ static struct pxamci_platform_data em_x270_mci_platform_data = { static void __init em_x270_init_mmc(void) { + if (machine_is_em_x270()) + em_x270_mci_platform_data.get_ro = em_x270_mci_get_ro; + + em_x270_mci_platform_data.detect_delay = msecs_to_jiffies(250); pxa_set_mci_info(&em_x270_mci_platform_data); } #else static inline void em_x270_init_mmc(void) {} #endif -/* LCD 480x640 */ +/* LCD */ #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) -static struct pxafb_mode_info em_x270_lcd_mode = { - .pixclock = 50000, - .bpp = 16, - .xres = 480, - .yres = 640, - .hsync_len = 8, - .vsync_len = 2, - .left_margin = 8, - .upper_margin = 0, - .right_margin = 24, - .lower_margin = 4, - .cmap_greyscale = 0, +static struct pxafb_mode_info em_x270_lcd_modes[] = { + [0] = { + .pixclock = 38250, + .bpp = 16, + .xres = 480, + .yres = 640, + .hsync_len = 8, + .vsync_len = 2, + .left_margin = 8, + .upper_margin = 2, + .right_margin = 24, + .lower_margin = 4, + .sync = 0, + }, + [1] = { + .pixclock = 153800, + .bpp = 16, + .xres = 240, + .yres = 320, + .hsync_len = 8, + .vsync_len = 2, + .left_margin = 8, + .upper_margin = 2, + .right_margin = 88, + .lower_margin = 2, + .sync = 0, + }, }; static struct pxafb_mach_info em_x270_lcd = { - .modes = &em_x270_lcd_mode, - .num_modes = 1, + .modes = em_x270_lcd_modes, + .num_modes = 2, .lcd_conn = LCD_COLOR_TFT_16BPP, }; + static void __init em_x270_init_lcd(void) { set_pxa_fb_info(&em_x270_lcd); @@ -471,6 +634,40 @@ static void __init em_x270_init_lcd(void) static inline void em_x270_init_lcd(void) {} #endif +#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) +static struct pxa2xx_spi_master em_x270_spi_info = { + .num_chipselect = 1, +}; + +static struct pxa2xx_spi_chip em_x270_tdo24m_chip = { + .rx_threshold = 1, + .tx_threshold = 1, +}; + +static struct tdo24m_platform_data em_x270_tdo24m_pdata = { + .model = TDO35S, +}; + +static struct spi_board_info em_x270_spi_devices[] __initdata = { + { + .modalias = "tdo24m", + .max_speed_hz = 1000000, + .bus_num = 1, + .chip_select = 0, + .controller_data = &em_x270_tdo24m_chip, + .platform_data = &em_x270_tdo24m_pdata, + }, +}; + +static void __init em_x270_init_spi(void) +{ + pxa2xx_set_spi_info(1, &em_x270_spi_info); + spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices)); +} +#else +static inline void em_x270_init_spi(void) {} +#endif + #if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE) static void __init em_x270_init_ac97(void) { @@ -481,23 +678,76 @@ static inline void em_x270_init_ac97(void) {} #endif #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) -static unsigned int em_x270_matrix_keys[] = { +static unsigned int em_x270_module_matrix_keys[] = { KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B), KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT), KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D), }; -struct pxa27x_keypad_platform_data em_x270_keypad_info = { +struct pxa27x_keypad_platform_data em_x270_module_keypad_info = { /* code map for the matrix keys */ .matrix_key_rows = 3, .matrix_key_cols = 3, - .matrix_key_map = em_x270_matrix_keys, - .matrix_key_map_size = ARRAY_SIZE(em_x270_matrix_keys), + .matrix_key_map = em_x270_module_matrix_keys, + .matrix_key_map_size = ARRAY_SIZE(em_x270_module_matrix_keys), +}; + +static unsigned int em_x270_exeda_matrix_keys[] = { + KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL), + KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE), + KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL), + KEY(0, 6, KEY_ENTER), KEY(0, 7, KEY_SLASH), + + KEY(1, 0, KEY_DOT), KEY(1, 1, KEY_M), + KEY(1, 2, KEY_N), KEY(1, 3, KEY_B), + KEY(1, 4, KEY_V), KEY(1, 5, KEY_C), + KEY(1, 6, KEY_X), KEY(1, 7, KEY_Z), + + KEY(2, 0, KEY_LEFTSHIFT), KEY(2, 1, KEY_SEMICOLON), + KEY(2, 2, KEY_L), KEY(2, 3, KEY_K), + KEY(2, 4, KEY_J), KEY(2, 5, KEY_H), + KEY(2, 6, KEY_G), KEY(2, 7, KEY_F), + + KEY(3, 0, KEY_D), KEY(3, 1, KEY_S), + KEY(3, 2, KEY_A), KEY(3, 3, KEY_TAB), + KEY(3, 4, KEY_BACKSPACE), KEY(3, 5, KEY_P), + KEY(3, 6, KEY_O), KEY(3, 7, KEY_I), + + KEY(4, 0, KEY_U), KEY(4, 1, KEY_Y), + KEY(4, 2, KEY_T), KEY(4, 3, KEY_R), + KEY(4, 4, KEY_E), KEY(4, 5, KEY_W), + KEY(4, 6, KEY_Q), KEY(4, 7, KEY_MINUS), + + KEY(5, 0, KEY_0), KEY(5, 1, KEY_9), + KEY(5, 2, KEY_8), KEY(5, 3, KEY_7), + KEY(5, 4, KEY_6), KEY(5, 5, KEY_5), + KEY(5, 6, KEY_4), KEY(5, 7, KEY_3), + + KEY(6, 0, KEY_2), KEY(6, 1, KEY_1), + KEY(6, 2, KEY_ENTER), KEY(6, 3, KEY_END), + KEY(6, 4, KEY_DOWN), KEY(6, 5, KEY_UP), + KEY(6, 6, KEY_MENU), KEY(6, 7, KEY_F1), + + KEY(7, 0, KEY_LEFT), KEY(7, 1, KEY_RIGHT), + KEY(7, 2, KEY_BACK), KEY(7, 3, KEY_HOME), + KEY(7, 4, 0), KEY(7, 5, 0), + KEY(7, 6, 0), KEY(7, 7, 0), +}; + +struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = { + /* code map for the matrix keys */ + .matrix_key_rows = 8, + .matrix_key_cols = 8, + .matrix_key_map = em_x270_exeda_matrix_keys, + .matrix_key_map_size = ARRAY_SIZE(em_x270_exeda_matrix_keys), }; static void __init em_x270_init_keypad(void) { - pxa_set_keypad_info(&em_x270_keypad_info); + if (machine_is_em_x270()) + pxa_set_keypad_info(&em_x270_module_keypad_info); + else + pxa_set_keypad_info(&em_x270_exeda_keypad_info); } #else static inline void em_x270_init_keypad(void) {} @@ -535,19 +785,264 @@ static void __init em_x270_init_gpio_keys(void) static inline void em_x270_init_gpio_keys(void) {} #endif -static void __init em_x270_init(void) +/* Quick Capture Interface and sensor setup */ +#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) +static struct regulator *em_x270_camera_ldo; + +static int em_x270_sensor_init(struct device *dev) { + int ret; + + ret = gpio_request(GPIO93_CAM_RESET, "camera reset"); + if (ret) + return ret; + + gpio_direction_output(GPIO93_CAM_RESET, 0); + + em_x270_camera_ldo = regulator_get(NULL, "vcc cam"); + if (em_x270_camera_ldo == NULL) { + gpio_free(GPIO93_CAM_RESET); + return -ENODEV; + } + + ret = regulator_enable(em_x270_camera_ldo); + if (ret) { + regulator_put(em_x270_camera_ldo); + gpio_free(GPIO93_CAM_RESET); + return ret; + } + + gpio_set_value(GPIO93_CAM_RESET, 1); + + return 0; +} + +struct pxacamera_platform_data em_x270_camera_platform_data = { + .init = em_x270_sensor_init, + .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | + PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, + .mclk_10khz = 2600, +}; + +static int em_x270_sensor_power(struct device *dev, int on) +{ + int ret; + int is_on = regulator_is_enabled(em_x270_camera_ldo); + + if (on == is_on) + return 0; + + gpio_set_value(GPIO93_CAM_RESET, !on); + + if (on) + ret = regulator_enable(em_x270_camera_ldo); + else + ret = regulator_disable(em_x270_camera_ldo); + + if (ret) + return ret; + + gpio_set_value(GPIO93_CAM_RESET, on); + + return 0; +} + +static struct soc_camera_link iclink = { + .bus_id = 0, + .power = em_x270_sensor_power, +}; + +static struct i2c_board_info em_x270_i2c_cam_info[] = { + { + I2C_BOARD_INFO("mt9m111", 0x48), + .platform_data = &iclink, + }, +}; + +static struct i2c_pxa_platform_data em_x270_i2c_info = { + .fast_mode = 1, +}; + +static void __init em_x270_init_camera(void) +{ + pxa_set_i2c_info(&em_x270_i2c_info); + i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info)); + pxa_set_camera_info(&em_x270_camera_platform_data); +} +#else +static inline void em_x270_init_camera(void) {} +#endif + +/* DA9030 related initializations */ +#define REGULATOR_CONSUMER(_name, _dev, _supply) \ + static struct regulator_consumer_supply _name##_consumers[] = { \ + { \ + .dev = _dev, \ + .supply = _supply, \ + }, \ + } + +REGULATOR_CONSUMER(ldo3, NULL, "vcc gps"); +REGULATOR_CONSUMER(ldo5, NULL, "vcc cam"); +REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio"); +REGULATOR_CONSUMER(ldo12, NULL, "vcc usb"); +REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs"); + +#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \ + static struct regulator_init_data _ldo##_data = { \ + .constraints = { \ + .min_uV = _min_uV, \ + .max_uV = _max_uV, \ + .state_mem = { \ + .enabled = 0, \ + }, \ + .valid_ops_mask = _ops_mask, \ + }, \ + .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \ + .consumer_supplies = _ldo##_consumers, \ + }; + +REGULATOR_INIT(ldo3, 3200000, 3200000, REGULATOR_CHANGE_STATUS); +REGULATOR_INIT(ldo5, 3000000, 3000000, REGULATOR_CHANGE_STATUS); +REGULATOR_INIT(ldo10, 2000000, 3200000, + REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE); +REGULATOR_INIT(ldo12, 3000000, 3000000, REGULATOR_CHANGE_STATUS); +REGULATOR_INIT(ldo19, 3200000, 3200000, REGULATOR_CHANGE_STATUS); + +struct led_info em_x270_led_info = { + .name = "em-x270:orange", + .default_trigger = "battery-charging-or-full", +}; + +struct power_supply_info em_x270_psy_info = { + .name = "LP555597P6H-FPS", + .technology = POWER_SUPPLY_TECHNOLOGY_LIPO, + .voltage_max_design = 4200000, + .voltage_min_design = 3000000, + .use_for_apm = 1, +}; + +static void em_x270_battery_low(void) +{ + apm_queue_event(APM_LOW_BATTERY); +} + +static void em_x270_battery_critical(void) +{ + apm_queue_event(APM_CRITICAL_SUSPEND); +} + +struct da9030_battery_info em_x270_batterty_info = { + .battery_info = &em_x270_psy_info, + + .charge_milliamp = 1000, + .charge_millivolt = 4200, + + .vbat_low = 3600, + .vbat_crit = 3400, + .vbat_charge_start = 4100, + .vbat_charge_stop = 4200, + .vbat_charge_restart = 4000, + + .vcharge_min = 3200, + .vcharge_max = 5500, + + .tbat_low = 197, + .tbat_high = 78, + .tbat_restart = 100, + + .batmon_interval = 0, + + .battery_low = em_x270_battery_low, + .battery_critical = em_x270_battery_critical, +}; + +#define DA9030_SUBDEV(_name, _id, _pdata) \ + { \ + .name = "da903x-" #_name, \ + .id = DA9030_ID_##_id, \ + .platform_data = _pdata, \ + } + +#define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data) + +struct da903x_subdev_info em_x270_da9030_subdevs[] = { + DA9030_LDO(3), + DA9030_LDO(5), + DA9030_LDO(10), + DA9030_LDO(12), + DA9030_LDO(19), + + DA9030_SUBDEV(led, LED_PC, &em_x270_led_info), + DA9030_SUBDEV(backlight, WLED, &em_x270_led_info), + DA9030_SUBDEV(battery, BAT, &em_x270_batterty_info), +}; + +static struct da903x_platform_data em_x270_da9030_info = { + .num_subdevs = ARRAY_SIZE(em_x270_da9030_subdevs), + .subdevs = em_x270_da9030_subdevs, +}; + +static struct i2c_board_info em_x270_i2c_pmic_info = { + I2C_BOARD_INFO("da9030", 0x49), + .irq = IRQ_GPIO(0), + .platform_data = &em_x270_da9030_info, +}; + +static struct i2c_pxa_platform_data em_x270_pwr_i2c_info = { + .use_pio = 1, +}; + +static void __init em_x270_init_da9030(void) +{ + pxa27x_set_i2c_power_info(&em_x270_pwr_i2c_info); + i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1); +} + +static void __init em_x270_module_init(void) +{ + pr_info("%s\n", __func__); pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config)); + mmc_cd = GPIO13_MMC_CD; + nand_rb = GPIO56_NAND_RB; + dm9000_flags = DM9000_PLATF_32BITONLY; +} + +static void __init em_x270_exeda_init(void) +{ + pr_info("%s\n", __func__); + pxa2xx_mfp_config(ARRAY_AND_SIZE(exeda_pin_config)); + + mmc_cd = GPIO114_MMC_CD; + nand_rb = GPIO20_NAND_RB; + dm9000_flags = DM9000_PLATF_16BITONLY; +} + +static void __init em_x270_init(void) +{ + pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config)); + + if (machine_is_em_x270()) + em_x270_module_init(); + else if (machine_is_exeda()) + em_x270_exeda_init(); + else + panic("Unsupported machine: %d\n", machine_arch_type); + + em_x270_init_da9030(); em_x270_init_dm9000(); em_x270_init_rtc(); em_x270_init_nand(); + em_x270_init_nor(); em_x270_init_lcd(); em_x270_init_mmc(); em_x270_init_ohci(); em_x270_init_keypad(); em_x270_init_gpio_keys(); em_x270_init_ac97(); + em_x270_init_camera(); + em_x270_init_spi(); } MACHINE_START(EM_X270, "Compulab EM-X270") @@ -559,3 +1054,13 @@ MACHINE_START(EM_X270, "Compulab EM-X270") .timer = &pxa_timer, .init_machine = em_x270_init, MACHINE_END + +MACHINE_START(EXEDA, "Compulab eXeda") + .boot_params = 0xa0000100, + .phys_io = 0x40000000, + .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, + .map_io = pxa_map_io, + .init_irq = pxa27x_init_irq, + .timer = &pxa_timer, + .init_machine = em_x270_init, +MACHINE_END diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index dfce7d5b659..c60dadf847a 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c @@ -20,8 +20,7 @@ #include <asm/mach/arch.h> #include <asm/mach-types.h> -#include <mach/mfp-pxa25x.h> -#include <mach/hardware.h> +#include <mach/pxa25x.h> #include <mach/eseries-gpio.h> #include <mach/udc.h> #include <mach/irda.h> diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index df5f822f3b6..92ba16e1b6f 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c @@ -19,18 +19,16 @@ #include <linux/input.h> #include <asm/setup.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> + +#include <mach/pxa27x.h> #include <mach/pxafb.h> #include <mach/ohci.h> #include <mach/i2c.h> #include <mach/hardware.h> #include <mach/pxa27x_keypad.h> -#include <mach/mfp-pxa27x.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <asm/mach-types.h> -#include <asm/mach/arch.h> - #include "devices.h" #include "generic.h" diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index 0ccc91c92c4..3126a35aa00 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c @@ -26,8 +26,9 @@ #include <asm/mach/map.h> #include <asm/mach-types.h> -#include <mach/pxa-regs.h> #include <mach/reset.h> +#include <mach/gpio.h> +#include <mach/pxa2xx-gpio.h> #include "generic.h" @@ -127,3 +128,33 @@ void __init pxa_map_io(void) iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc)); get_clk_frequency_khz(1); } + +/* + * Configure pins for GPIO or other functions + */ +int pxa_gpio_mode(int gpio_mode) +{ + unsigned long flags; + int gpio = gpio_mode & GPIO_MD_MASK_NR; + int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8; + int gafr; + + if (gpio > pxa_last_gpio) + return -EINVAL; + + local_irq_save(flags); + if (gpio_mode & GPIO_DFLT_LOW) + GPCR(gpio) = GPIO_bit(gpio); + else if (gpio_mode & GPIO_DFLT_HIGH) + GPSR(gpio) = GPIO_bit(gpio); + if (gpio_mode & GPIO_MD_MASK_DIR) + GPDR(gpio) |= GPIO_bit(gpio); + else + GPDR(gpio) &= ~GPIO_bit(gpio); + gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2)); + GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2)); + local_irq_restore(flags); + + return 0; +} +EXPORT_SYMBOL(pxa_gpio_mode); diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h index dc876a8e666..3465268ca71 100644 --- a/arch/arm/mach-pxa/generic.h +++ b/arch/arm/mach-pxa/generic.h @@ -9,20 +9,17 @@ * published by the Free Software Foundation. */ -typedef int (*set_wake_t)(unsigned int, unsigned int); - struct sys_timer; extern struct sys_timer pxa_timer; -extern void __init pxa_init_irq(int irq_nr, set_wake_t fn); -extern void __init pxa_init_gpio(int gpio_nr, set_wake_t fn); +extern void __init pxa_init_irq(int irq_nr, + int (*set_wake)(unsigned int, unsigned int)); extern void __init pxa25x_init_irq(void); extern void __init pxa27x_init_irq(void); extern void __init pxa3xx_init_irq(void); extern void __init pxa_map_io(void); extern unsigned int get_clk_frequency_khz(int info); -extern int pxa_last_gpio; #define SET_BANK(__nr,__start,__size) \ mi->bank[__nr].start = (__start), \ diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c deleted file mode 100644 index 5fec1e479cb..00000000000 --- a/arch/arm/mach-pxa/gpio.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * linux/arch/arm/mach-pxa/gpio.c - * - * Generic PXA GPIO handling - * - * Author: Nicolas Pitre - * Created: Jun 15, 2001 - * Copyright: MontaVista Software Inc. - * - * 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/module.h> -#include <linux/irq.h> -#include <linux/sysdev.h> -#include <linux/io.h> - -#include <asm/gpio.h> -#include <mach/hardware.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-gpio.h> - -#include "generic.h" - -#define GPIO0_BASE ((void __iomem *)io_p2v(0x40E00000)) -#define GPIO1_BASE ((void __iomem *)io_p2v(0x40E00004)) -#define GPIO2_BASE ((void __iomem *)io_p2v(0x40E00008)) -#define GPIO3_BASE ((void __iomem *)io_p2v(0x40E00100)) - -#define GPLR_OFFSET 0x00 -#define GPDR_OFFSET 0x0C -#define GPSR_OFFSET 0x18 -#define GPCR_OFFSET 0x24 -#define GRER_OFFSET 0x30 -#define GFER_OFFSET 0x3C -#define GEDR_OFFSET 0x48 - -struct pxa_gpio_chip { - struct gpio_chip chip; - void __iomem *regbase; -}; - -int pxa_last_gpio; - -#ifdef CONFIG_CPU_PXA26x -/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted, - * as well as their Alternate Function value being '1' for GPIO in GAFRx. - */ -static int __gpio_is_inverted(unsigned gpio) -{ - return cpu_is_pxa25x() && gpio > 85; -} -#else -#define __gpio_is_inverted(gpio) (0) -#endif - -/* - * Configure pins for GPIO or other functions - */ -int pxa_gpio_mode(int gpio_mode) -{ - unsigned long flags; - int gpio = gpio_mode & GPIO_MD_MASK_NR; - int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8; - int gafr; - - if (gpio > pxa_last_gpio) - return -EINVAL; - - local_irq_save(flags); - if (gpio_mode & GPIO_DFLT_LOW) - GPCR(gpio) = GPIO_bit(gpio); - else if (gpio_mode & GPIO_DFLT_HIGH) - GPSR(gpio) = GPIO_bit(gpio); - if (gpio_mode & GPIO_MD_MASK_DIR) - GPDR(gpio) |= GPIO_bit(gpio); - else - GPDR(gpio) &= ~GPIO_bit(gpio); - gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2)); - GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2)); - local_irq_restore(flags); - - return 0; -} -EXPORT_SYMBOL(pxa_gpio_mode); - -static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) -{ - unsigned long flags; - u32 mask = 1 << offset; - u32 value; - struct pxa_gpio_chip *pxa; - void __iomem *gpdr; - - pxa = container_of(chip, struct pxa_gpio_chip, chip); - gpdr = pxa->regbase + GPDR_OFFSET; - local_irq_save(flags); - value = __raw_readl(gpdr); - if (__gpio_is_inverted(chip->base + offset)) - value |= mask; - else - value &= ~mask; - __raw_writel(value, gpdr); - local_irq_restore(flags); - - return 0; -} - -static int pxa_gpio_direction_output(struct gpio_chip *chip, - unsigned offset, int value) -{ - unsigned long flags; - u32 mask = 1 << offset; - u32 tmp; - struct pxa_gpio_chip *pxa; - void __iomem *gpdr; - - pxa = container_of(chip, struct pxa_gpio_chip, chip); - __raw_writel(mask, - pxa->regbase + (value ? GPSR_OFFSET : GPCR_OFFSET)); - gpdr = pxa->regbase + GPDR_OFFSET; - local_irq_save(flags); - tmp = __raw_readl(gpdr); - if (__gpio_is_inverted(chip->base + offset)) - tmp &= ~mask; - else - tmp |= mask; - __raw_writel(tmp, gpdr); - local_irq_restore(flags); - - return 0; -} - -/* - * Return GPIO level - */ -static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset) -{ - u32 mask = 1 << offset; - struct pxa_gpio_chip *pxa; - - pxa = container_of(chip, struct pxa_gpio_chip, chip); - return __raw_readl(pxa->regbase + GPLR_OFFSET) & mask; -} - -/* - * Set output GPIO level - */ -static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) -{ - u32 mask = 1 << offset; - struct pxa_gpio_chip *pxa; - - pxa = container_of(chip, struct pxa_gpio_chip, chip); - - if (value) - __raw_writel(mask, pxa->regbase + GPSR_OFFSET); - else - __raw_writel(mask, pxa->regbase + GPCR_OFFSET); -} - -#define GPIO_CHIP(_n) \ - [_n] = { \ - .regbase = GPIO##_n##_BASE, \ - .chip = { \ - .label = "gpio-" #_n, \ - .direction_input = pxa_gpio_direction_input, \ - .direction_output = pxa_gpio_direction_output, \ - .get = pxa_gpio_get, \ - .set = pxa_gpio_set, \ - .base = (_n) * 32, \ - .ngpio = 32, \ - }, \ - } - -static struct pxa_gpio_chip pxa_gpio_chip[] = { - GPIO_CHIP(0), - GPIO_CHIP(1), - GPIO_CHIP(2), -#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) - GPIO_CHIP(3), -#endif -}; - -/* - * PXA GPIO edge detection for IRQs: - * IRQs are generated on Falling-Edge, Rising-Edge, or both. - * Use this instead of directly setting GRER/GFER. - */ - -static unsigned long GPIO_IRQ_rising_edge[4]; -static unsigned long GPIO_IRQ_falling_edge[4]; -static unsigned long GPIO_IRQ_mask[4]; - -/* - * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate - * function of a GPIO, and GPDRx cannot be altered once configured. It - * is attributed as "occupied" here (I know this terminology isn't - * accurate, you are welcome to propose a better one :-) - */ -static int __gpio_is_occupied(unsigned gpio) -{ - if (cpu_is_pxa27x() || cpu_is_pxa25x()) { - int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3; - int dir = GPDR(gpio) & GPIO_bit(gpio); - - if (__gpio_is_inverted(gpio)) - return af != 1 || dir == 0; - else - return af != 0 || dir != 0; - } - - return 0; -} - -static int pxa_gpio_irq_type(unsigned int irq, unsigned int type) -{ - int gpio, idx; - - gpio = IRQ_TO_GPIO(irq); - idx = gpio >> 5; - - if (type == IRQ_TYPE_PROBE) { - /* Don't mess with enabled GPIOs using preconfigured edges or - * GPIOs set to alternate function or to output during probe - */ - if ((GPIO_IRQ_rising_edge[idx] & GPIO_bit(gpio)) || - (GPIO_IRQ_falling_edge[idx] & GPIO_bit(gpio))) - return 0; - - if (__gpio_is_occupied(gpio)) - return 0; - - type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; - } - - if (__gpio_is_inverted(gpio)) - GPDR(gpio) |= GPIO_bit(gpio); - else - GPDR(gpio) &= ~GPIO_bit(gpio); - - if (type & IRQ_TYPE_EDGE_RISING) - __set_bit(gpio, GPIO_IRQ_rising_edge); - else - __clear_bit(gpio, GPIO_IRQ_rising_edge); - - if (type & IRQ_TYPE_EDGE_FALLING) - __set_bit(gpio, GPIO_IRQ_falling_edge); - else - __clear_bit(gpio, GPIO_IRQ_falling_edge); - - GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx]; - GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx]; - - pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, irq, gpio, - ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""), - ((type & IRQ_TYPE_EDGE_FALLING) ? " falling" : "")); - return 0; -} - -/* - * GPIO IRQs must be acknowledged. This is for GPIO 0 and 1. - */ - -static void pxa_ack_low_gpio(unsigned int irq) -{ - GEDR0 = (1 << (irq - IRQ_GPIO0)); -} - -static void pxa_mask_low_gpio(unsigned int irq) -{ - ICMR &= ~(1 << (irq - PXA_IRQ(0))); -} - -static void pxa_unmask_low_gpio(unsigned int irq) -{ - ICMR |= 1 << (irq - PXA_IRQ(0)); -} - -static struct irq_chip pxa_low_gpio_chip = { - .name = "GPIO-l", - .ack = pxa_ack_low_gpio, - .mask = pxa_mask_low_gpio, - .unmask = pxa_unmask_low_gpio, - .set_type = pxa_gpio_irq_type, -}; - -/* - * Demux handler for GPIO>=2 edge detect interrupts - */ - -#define GEDR_BITS (sizeof(gedr) * BITS_PER_BYTE) - -static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc) -{ - int loop, bit, n; - unsigned long gedr[4]; - - do { - gedr[0] = GEDR0 & GPIO_IRQ_mask[0] & ~3; - gedr[1] = GEDR1 & GPIO_IRQ_mask[1]; - gedr[2] = GEDR2 & GPIO_IRQ_mask[2]; - gedr[3] = GEDR3 & GPIO_IRQ_mask[3]; - - GEDR0 = gedr[0]; GEDR1 = gedr[1]; - GEDR2 = gedr[2]; GEDR3 = gedr[3]; - - loop = 0; - bit = find_first_bit(gedr, GEDR_BITS); - while (bit < GEDR_BITS) { - loop = 1; - - n = PXA_GPIO_IRQ_BASE + bit; - generic_handle_irq(n); - - bit = find_next_bit(gedr, GEDR_BITS, bit + 1); - } - } while (loop); -} - -static void pxa_ack_muxed_gpio(unsigned int irq) -{ - int gpio = irq - IRQ_GPIO(2) + 2; - GEDR(gpio) = GPIO_bit(gpio); -} - -static void pxa_mask_muxed_gpio(unsigned int irq) -{ - int gpio = irq - IRQ_GPIO(2) + 2; - __clear_bit(gpio, GPIO_IRQ_mask); - GRER(gpio) &= ~GPIO_bit(gpio); - GFER(gpio) &= ~GPIO_bit(gpio); -} - -static void pxa_unmask_muxed_gpio(unsigned int irq) -{ - int gpio = irq - IRQ_GPIO(2) + 2; - int idx = gpio >> 5; - __set_bit(gpio, GPIO_IRQ_mask); - GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx]; - GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx]; -} - -static struct irq_chip pxa_muxed_gpio_chip = { - .name = "GPIO", - .ack = pxa_ack_muxed_gpio, - .mask = pxa_mask_muxed_gpio, - .unmask = pxa_unmask_muxed_gpio, - .set_type = pxa_gpio_irq_type, -}; - -void __init pxa_init_gpio(int gpio_nr, set_wake_t fn) -{ - int irq, i, gpio; - - pxa_last_gpio = gpio_nr - 1; - - /* clear all GPIO edge detects */ - for (i = 0; i < gpio_nr; i += 32) { - GFER(i) = 0; - GRER(i) = 0; - GEDR(i) = GEDR(i); - } - - /* GPIO 0 and 1 must have their mask bit always set */ - GPIO_IRQ_mask[0] = 3; - - for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) { - set_irq_chip(irq, &pxa_low_gpio_chip); - set_irq_handler(irq, handle_edge_irq); - set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); - } - - for (irq = IRQ_GPIO(2); irq < IRQ_GPIO(gpio_nr); irq++) { - set_irq_chip(irq, &pxa_muxed_gpio_chip); - set_irq_handler(irq, handle_edge_irq); - set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); - } - - /* Install handler for GPIO>=2 edge detect interrupts */ - set_irq_chained_handler(IRQ_GPIO_2_x, pxa_gpio_demux_handler); - - pxa_low_gpio_chip.set_wake = fn; - pxa_muxed_gpio_chip.set_wake = fn; - - /* add a GPIO chip for each register bank. - * the last PXA25x register only contains 21 GPIOs - */ - for (gpio = 0, i = 0; gpio < gpio_nr; gpio += 32, i++) { - if (gpio + 32 > gpio_nr) - pxa_gpio_chip[i].chip.ngpio = gpio_nr - gpio; - gpiochip_add(&pxa_gpio_chip[i].chip); - } -} - -#ifdef CONFIG_PM - -static unsigned long saved_gplr[4]; -static unsigned long saved_gpdr[4]; -static unsigned long saved_grer[4]; -static unsigned long saved_gfer[4]; - -static int pxa_gpio_suspend(struct sys_device *dev, pm_message_t state) -{ - int i, gpio; - - for (gpio = 0, i = 0; gpio < pxa_last_gpio; gpio += 32, i++) { - saved_gplr[i] = GPLR(gpio); - saved_gpdr[i] = GPDR(gpio); - saved_grer[i] = GRER(gpio); - saved_gfer[i] = GFER(gpio); - - /* Clear GPIO transition detect bits */ - GEDR(gpio) = GEDR(gpio); - } - return 0; -} - -static int pxa_gpio_resume(struct sys_device *dev) -{ - int i, gpio; - - for (gpio = 0, i = 0; gpio < pxa_last_gpio; gpio += 32, i++) { - /* restore level with set/clear */ - GPSR(gpio) = saved_gplr[i]; - GPCR(gpio) = ~saved_gplr[i]; - - GRER(gpio) = saved_grer[i]; - GFER(gpio) = saved_gfer[i]; - GPDR(gpio) = saved_gpdr[i]; - } - return 0; -} -#else -#define pxa_gpio_suspend NULL -#define pxa_gpio_resume NULL -#endif - -struct sysdev_class pxa_gpio_sysclass = { - .name = "gpio", - .suspend = pxa_gpio_suspend, - .resume = pxa_gpio_resume, -}; - -static int __init pxa_gpio_init(void) -{ - return sysdev_class_register(&pxa_gpio_sysclass); -} - -core_initcall(pxa_gpio_init); diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c index e296ce11658..ca9912ea78d 100644 --- a/arch/arm/mach-pxa/gumstix.c +++ b/arch/arm/mach-pxa/gumstix.c @@ -38,14 +38,12 @@ #include <asm/mach/map.h> #include <asm/mach/irq.h> #include <asm/mach/flash.h> + +#include <mach/pxa25x.h> #include <mach/mmc.h> #include <mach/udc.h> #include <mach/gumstix.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa25x.h> - #include "generic.h" static struct resource flash_resource = { @@ -191,6 +189,11 @@ int __attribute__((weak)) am200_init(void) return 0; } +int __attribute__((weak)) am300_init(void) +{ + return 0; +} + static void __init carrier_board_init(void) { /* @@ -198,6 +201,7 @@ static void __init carrier_board_init(void) * they cannot be detected programatically */ am200_init(); + am300_init(); } static void __init gumstix_init(void) diff --git a/arch/arm/mach-pxa/h5000.c b/arch/arm/mach-pxa/h5000.c index da6e4422c0f..f3d220c32e0 100644 --- a/arch/arm/mach-pxa/h5000.c +++ b/arch/arm/mach-pxa/h5000.c @@ -24,14 +24,15 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> + #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> + +#include <mach/pxa25x.h> #include <mach/h5000.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa25x.h> #include <mach/udc.h> + #include "generic.h" /* @@ -153,6 +154,13 @@ static unsigned long h5000_pin_config[] __initdata = { GPIO23_SSP1_SCLK, GPIO25_SSP1_TXD, GPIO26_SSP1_RXD, + + /* I2S */ + GPIO28_I2S_BITCLK_OUT, + GPIO29_I2S_SDATA_IN, + GPIO30_I2S_SDATA_OUT, + GPIO31_I2S_SYNC, + GPIO32_I2S_SYSCLK, }; /* diff --git a/arch/arm/mach-pxa/himalaya.c b/arch/arm/mach-pxa/himalaya.c new file mode 100644 index 00000000000..cea99fe65b9 --- /dev/null +++ b/arch/arm/mach-pxa/himalaya.c @@ -0,0 +1,166 @@ +/* + * linux/arch/arm/mach-pxa/himalaya.c + * + * Hardware definitions for the HTC Himalaya + * + * Based on 2.6.21-hh20's himalaya.c and himalaya_lcd.c + * + * Copyright (c) 2008 Zbynek Michl <Zbynek.Michl@seznam.cz> + * + * 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/kernel.h> +#include <linux/init.h> +#include <linux/device.h> +#include <linux/fb.h> +#include <linux/platform_device.h> + +#include <video/w100fb.h> + +#include <asm/setup.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> + +#include <mach/mfp-pxa25x.h> +#include <mach/hardware.h> + +#include "generic.h" + +/* ---------------------- Himalaya LCD definitions -------------------- */ + +static struct w100_gen_regs himalaya_lcd_regs = { + .lcd_format = 0x00000003, + .lcdd_cntl1 = 0x00000000, + .lcdd_cntl2 = 0x0003ffff, + .genlcd_cntl1 = 0x00fff003, + .genlcd_cntl2 = 0x00000003, + .genlcd_cntl3 = 0x000102aa, +}; + +static struct w100_mode himalaya4_lcd_mode = { + .xres = 240, + .yres = 320, + .left_margin = 0, + .right_margin = 31, + .upper_margin = 15, + .lower_margin = 0, + .crtc_ss = 0x80150014, + .crtc_ls = 0xa0fb00f7, + .crtc_gs = 0xc0080007, + .crtc_vpos_gs = 0x00080007, + .crtc_rev = 0x0000000a, + .crtc_dclk = 0x81700030, + .crtc_gclk = 0x8015010f, + .crtc_goe = 0x00000000, + .pll_freq = 80, + .pixclk_divider = 15, + .pixclk_divider_rotated = 15, + .pixclk_src = CLK_SRC_PLL, + .sysclk_divider = 0, + .sysclk_src = CLK_SRC_PLL, +}; + +static struct w100_mode himalaya6_lcd_mode = { + .xres = 240, + .yres = 320, + .left_margin = 9, + .right_margin = 8, + .upper_margin = 5, + .lower_margin = 4, + .crtc_ss = 0x80150014, + .crtc_ls = 0xa0fb00f7, + .crtc_gs = 0xc0080007, + .crtc_vpos_gs = 0x00080007, + .crtc_rev = 0x0000000a, + .crtc_dclk = 0xa1700030, + .crtc_gclk = 0x8015010f, + .crtc_goe = 0x00000000, + .pll_freq = 95, + .pixclk_divider = 0xb, + .pixclk_divider_rotated = 4, + .pixclk_src = CLK_SRC_PLL, + .sysclk_divider = 1, + .sysclk_src = CLK_SRC_PLL, +}; + +static struct w100_gpio_regs himalaya_w100_gpio_info = { + .init_data1 = 0xffff0000, /* GPIO_DATA */ + .gpio_dir1 = 0x00000000, /* GPIO_CNTL1 */ + .gpio_oe1 = 0x003c0000, /* GPIO_CNTL2 */ + .init_data2 = 0x00000000, /* GPIO_DATA2 */ + .gpio_dir2 = 0x00000000, /* GPIO_CNTL3 */ + .gpio_oe2 = 0x00000000, /* GPIO_CNTL4 */ +}; + +static struct w100fb_mach_info himalaya_fb_info = { + .num_modes = 1, + .regs = &himalaya_lcd_regs, + .gpio = &himalaya_w100_gpio_info, + .xtal_freq = 16000000, +}; + +static struct resource himalaya_fb_resources[] = { + [0] = { + .start = 0x08000000, + .end = 0x08ffffff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device himalaya_fb_device = { + .name = "w100fb", + .id = -1, + .dev = { + .platform_data = &himalaya_fb_info, + }, + .num_resources = ARRAY_SIZE(himalaya_fb_resources), + .resource = himalaya_fb_resources, +}; + +/* ----------------------------------------------------------------------- */ + +static struct platform_device *devices[] __initdata = { + &himalaya_fb_device, +}; + +static void __init himalaya_lcd_init(void) +{ + int himalaya_boardid; + + himalaya_boardid = 0x4; /* hardcoded (detection needs ASIC3 functions) */ + printk(KERN_INFO "himalaya LCD Driver init. boardid=%d\n", + himalaya_boardid); + + switch (himalaya_boardid) { + case 0x4: + himalaya_fb_info.modelist = &himalaya4_lcd_mode; + break; + case 0x6: + himalaya_fb_info.modelist = &himalaya6_lcd_mode; + break; + default: + printk(KERN_INFO "himalaya lcd_init: unknown boardid=%d. Using 0x4\n", + himalaya_boardid); + himalaya_fb_info.modelist = &himalaya4_lcd_mode; + } +} + +static void __init himalaya_init(void) +{ + himalaya_lcd_init(); + platform_add_devices(devices, ARRAY_SIZE(devices)); +} + + +MACHINE_START(HIMALAYA, "HTC Himalaya") + .phys_io = 0x40000000, + .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, + .boot_params = 0xa0000100, + .map_io = pxa_map_io, + .init_irq = pxa25x_init_irq, + .init_machine = himalaya_init, + .timer = &pxa_timer, +MACHINE_END diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index 013b15baa03..b6243b59d9b 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c @@ -31,8 +31,7 @@ #include <asm/mach/arch.h> #include <asm/mach/map.h> -#include <mach/pxa-regs.h> -#include <mach/mfp-pxa25x.h> +#include <mach/pxa25x.h> #include <mach/idp.h> #include <mach/pxafb.h> #include <mach/bitfield.h> diff --git a/arch/arm/mach-pxa/imote2.c b/arch/arm/mach-pxa/imote2.c index 364c5e27133..2121309b247 100644 --- a/arch/arm/mach-pxa/imote2.c +++ b/arch/arm/mach-pxa/imote2.c @@ -28,11 +28,8 @@ #include <asm/mach/map.h> #include <asm/mach/flash.h> +#include <mach/pxa27x.h> #include <mach/i2c.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa27x.h> -#include <mach/regs-ssp.h> #include <mach/udc.h> #include <mach/mmc.h> #include <mach/pxa2xx_spi.h> diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h index 2ae373fb567..3f2a01d6a03 100644 --- a/arch/arm/mach-pxa/include/mach/colibri.h +++ b/arch/arm/mach-pxa/include/mach/colibri.h @@ -1,19 +1,31 @@ #ifndef _COLIBRI_H_ #define _COLIBRI_H_ +/* + * common settings for all modules + */ + +#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) +extern void colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin); +#else +static inline void colibri_pxa3xx_init_mmc(mfp_cfg_t *, int, int) {} +#endif + +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) +extern void colibri_pxa3xx_init_lcd(int bl_pin); +#else +static inline void colibri_pxa3xx_init_lcd(int) {} +#endif /* physical memory regions */ -#define COLIBRI_FLASH_PHYS (PXA_CS0_PHYS) /* Flash region */ -#define COLIBRI_ETH_PHYS (PXA_CS2_PHYS) /* Ethernet DM9000 region */ #define COLIBRI_SDRAM_BASE 0xa0000000 /* SDRAM region */ -/* virtual memory regions */ -#define COLIBRI_DISK_VIRT 0xF0000000 /* Disk On Chip region */ +/* definitions for Colibri PXA270 */ -/* size of flash */ -#define COLIBRI_FLASH_SIZE 0x02000000 /* Flash size 32 MB */ - -/* Ethernet Controller Davicom DM9000 */ -#define GPIO_DM9000 114 -#define COLIBRI_ETH_IRQ IRQ_GPIO(GPIO_DM9000) +#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)) #endif /* _COLIBRI_H_ */ + diff --git a/arch/arm/mach-pxa/include/mach/csb726.h b/arch/arm/mach-pxa/include/mach/csb726.h new file mode 100644 index 00000000000..747ab1a71f2 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/csb726.h @@ -0,0 +1,26 @@ +/* + * Support for Cogent CSB726 + * + * Copyright (c) 2008 Dmitry Baryshkov + * + * 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. + * + */ +#ifndef CSB726_H +#define CSB726_H + +#define CSB726_GPIO_IRQ_LAN 52 +#define CSB726_GPIO_IRQ_SM501 53 +#define CSB726_GPIO_MMC_DETECT 100 +#define CSB726_GPIO_MMC_RO 101 + +#define CSB726_FLASH_SIZE (64 * 1024 * 1024) +#define CSB726_FLASH_uMON (8 * 1024 * 1024) + +#define CSB726_IRQ_LAN gpio_to_irq(CSB726_GPIO_IRQ_LAN) +#define CSB726_IRQ_SM501 gpio_to_irq(CSB726_GPIO_IRQ_SM501) + +#endif + diff --git a/arch/arm/mach-pxa/include/mach/dma.h b/arch/arm/mach-pxa/include/mach/dma.h index 7804637a6df..5bd55894a48 100644 --- a/arch/arm/mach-pxa/include/mach/dma.h +++ b/arch/arm/mach-pxa/include/mach/dma.h @@ -12,35 +12,10 @@ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H -/* - * Descriptor structure for PXA's DMA engine - * Note: this structure must always be aligned to a 16-byte boundary. - */ - -typedef struct pxa_dma_desc { - volatile u32 ddadr; /* Points to the next descriptor + flags */ - volatile u32 dsadr; /* DSADR value for the current transfer */ - volatile u32 dtadr; /* DTADR value for the current transfer */ - volatile u32 dcmd; /* DCMD value for the current transfer */ -} pxa_dma_desc; - -typedef enum { - DMA_PRIO_HIGH = 0, - DMA_PRIO_MEDIUM = 1, - DMA_PRIO_LOW = 2 -} pxa_dma_prio; - -/* - * DMA registration - */ - -int __init pxa_init_dma(int num_ch); - -int pxa_request_dma (char *name, - pxa_dma_prio prio, - void (*irq_handler)(int, void *), - void *data); +#include <mach/hardware.h> -void pxa_free_dma (int dma_ch); +/* DMA Controller Registers Definitions */ +#define DMAC_REGS_VIRT io_p2v(0x40000000) +#include <plat/dma.h> #endif /* _ASM_ARCH_DMA_H */ diff --git a/arch/arm/mach-pxa/include/mach/eseries-gpio.h b/arch/arm/mach-pxa/include/mach/eseries-gpio.h index efbd2aa9ece..f3e5509820d 100644 --- a/arch/arm/mach-pxa/include/mach/eseries-gpio.h +++ b/arch/arm/mach-pxa/include/mach/eseries-gpio.h @@ -45,6 +45,21 @@ /* e7xx IrDA power control */ #define GPIO_E7XX_IR_OFF 38 +/* e740 audio control GPIOs */ +#define GPIO_E740_WM9705_nAVDD2 16 +#define GPIO_E740_MIC_ON 40 +#define GPIO_E740_AMP_ON 41 + +/* e750 audio control GPIOs */ +#define GPIO_E750_HP_AMP_OFF 4 +#define GPIO_E750_SPK_AMP_OFF 7 +#define GPIO_E750_HP_DETECT 37 + +/* e800 audio control GPIOs */ +#define GPIO_E800_HP_DETECT 81 +#define GPIO_E800_HP_AMP_OFF 82 +#define GPIO_E800_SPK_AMP_ON 83 + /* ASIC related GPIOs */ #define GPIO_ESERIES_TMIO_IRQ 5 #define GPIO_ESERIES_TMIO_PCLR 19 diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h index 2c538d8c362..b024a8b3743 100644 --- a/arch/arm/mach-pxa/include/mach/gpio.h +++ b/arch/arm/mach-pxa/include/mach/gpio.h @@ -24,42 +24,118 @@ #ifndef __ASM_ARCH_PXA_GPIO_H #define __ASM_ARCH_PXA_GPIO_H -#include <mach/pxa-regs.h> -#include <asm/irq.h> +#include <mach/irqs.h> #include <mach/hardware.h> - #include <asm-generic/gpio.h> +#define GPIO_REGS_VIRT io_p2v(0x40E00000) + +#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) +#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x))) + +/* GPIO Pin Level Registers */ +#define GPLR0 GPIO_REG(BANK_OFF(0) + 0x00) +#define GPLR1 GPIO_REG(BANK_OFF(1) + 0x00) +#define GPLR2 GPIO_REG(BANK_OFF(2) + 0x00) +#define GPLR3 GPIO_REG(BANK_OFF(3) + 0x00) + +/* GPIO Pin Direction Registers */ +#define GPDR0 GPIO_REG(BANK_OFF(0) + 0x0c) +#define GPDR1 GPIO_REG(BANK_OFF(1) + 0x0c) +#define GPDR2 GPIO_REG(BANK_OFF(2) + 0x0c) +#define GPDR3 GPIO_REG(BANK_OFF(3) + 0x0c) + +/* GPIO Pin Output Set Registers */ +#define GPSR0 GPIO_REG(BANK_OFF(0) + 0x18) +#define GPSR1 GPIO_REG(BANK_OFF(1) + 0x18) +#define GPSR2 GPIO_REG(BANK_OFF(2) + 0x18) +#define GPSR3 GPIO_REG(BANK_OFF(3) + 0x18) + +/* GPIO Pin Output Clear Registers */ +#define GPCR0 GPIO_REG(BANK_OFF(0) + 0x24) +#define GPCR1 GPIO_REG(BANK_OFF(1) + 0x24) +#define GPCR2 GPIO_REG(BANK_OFF(2) + 0x24) +#define GPCR3 GPIO_REG(BANK_OFF(3) + 0x24) + +/* GPIO Rising Edge Detect Registers */ +#define GRER0 GPIO_REG(BANK_OFF(0) + 0x30) +#define GRER1 GPIO_REG(BANK_OFF(1) + 0x30) +#define GRER2 GPIO_REG(BANK_OFF(2) + 0x30) +#define GRER3 GPIO_REG(BANK_OFF(3) + 0x30) + +/* GPIO Falling Edge Detect Registers */ +#define GFER0 GPIO_REG(BANK_OFF(0) + 0x3c) +#define GFER1 GPIO_REG(BANK_OFF(1) + 0x3c) +#define GFER2 GPIO_REG(BANK_OFF(2) + 0x3c) +#define GFER3 GPIO_REG(BANK_OFF(3) + 0x3c) + +/* GPIO Edge Detect Status Registers */ +#define GEDR0 GPIO_REG(BANK_OFF(0) + 0x48) +#define GEDR1 GPIO_REG(BANK_OFF(1) + 0x48) +#define GEDR2 GPIO_REG(BANK_OFF(2) + 0x48) +#define GEDR3 GPIO_REG(BANK_OFF(3) + 0x48) + +/* GPIO Alternate Function Select Registers */ +#define GAFR0_L GPIO_REG(0x0054) +#define GAFR0_U GPIO_REG(0x0058) +#define GAFR1_L GPIO_REG(0x005C) +#define GAFR1_U GPIO_REG(0x0060) +#define GAFR2_L GPIO_REG(0x0064) +#define GAFR2_U GPIO_REG(0x0068) +#define GAFR3_L GPIO_REG(0x006C) +#define GAFR3_U GPIO_REG(0x0070) + +/* More handy macros. The argument is a literal GPIO number. */ + +#define GPIO_bit(x) (1 << ((x) & 0x1f)) + +#define GPLR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x00) +#define GPDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x0c) +#define GPSR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x18) +#define GPCR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x24) +#define GRER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x30) +#define GFER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x3c) +#define GEDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x48) +#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2)) + -/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85). - * Those cases currently cause holes in the GPIO number space. - */ #define NR_BUILTIN_GPIO 128 -static inline int gpio_get_value(unsigned gpio) +#define gpio_to_bank(gpio) ((gpio) >> 5) +#define gpio_to_irq(gpio) IRQ_GPIO(gpio) +#define irq_to_gpio(irq) IRQ_TO_GPIO(irq) + +#ifdef CONFIG_CPU_PXA26x +/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted, + * as well as their Alternate Function value being '1' for GPIO in GAFRx. + */ +static inline int __gpio_is_inverted(unsigned gpio) { - if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) - return GPLR(gpio) & GPIO_bit(gpio); - else - return __gpio_get_value(gpio); + return cpu_is_pxa25x() && gpio > 85; } +#else +static inline int __gpio_is_inverted(unsigned gpio) { return 0; } +#endif -static inline void gpio_set_value(unsigned gpio, int value) +/* + * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate + * function of a GPIO, and GPDRx cannot be altered once configured. It + * is attributed as "occupied" here (I know this terminology isn't + * accurate, you are welcome to propose a better one :-) + */ +static inline int __gpio_is_occupied(unsigned gpio) { - if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) { - if (value) - GPSR(gpio) = GPIO_bit(gpio); + if (cpu_is_pxa27x() || cpu_is_pxa25x()) { + int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3; + int dir = GPDR(gpio) & GPIO_bit(gpio); + + if (__gpio_is_inverted(gpio)) + return af != 1 || dir == 0; else - GPCR(gpio) = GPIO_bit(gpio); - } else { - __gpio_set_value(gpio, value); - } + return af != 0 || dir != 0; + } else + return GPDR(gpio) & GPIO_bit(gpio); } -#define gpio_cansleep __gpio_cansleep - -#define gpio_to_irq(gpio) IRQ_GPIO(gpio) -#define irq_to_gpio(irq) IRQ_TO_GPIO(irq) - - +#include <plat/gpio.h> #endif diff --git a/arch/arm/mach-pxa/include/mach/gumstix.h b/arch/arm/mach-pxa/include/mach/gumstix.h index 099f54a41de..06abd416060 100644 --- a/arch/arm/mach-pxa/include/mach/gumstix.h +++ b/arch/arm/mach-pxa/include/mach/gumstix.h @@ -97,4 +97,5 @@ has detected a cable insertion; driven low otherwise. */ /* for expansion boards that can't be programatically detected */ extern int am200_init(void); +extern int am300_init(void); diff --git a/arch/arm/mach-pxa/include/mach/lubbock.h b/arch/arm/mach-pxa/include/mach/lubbock.h index 4cb24154a5a..751b74811d0 100644 --- a/arch/arm/mach-pxa/include/mach/lubbock.h +++ b/arch/arm/mach-pxa/include/mach/lubbock.h @@ -25,7 +25,6 @@ /* FPGA register virtual addresses */ #define LUB_WHOAMI __LUB_REG(LUBBOCK_FPGA_PHYS + 0x000) -#define LUB_HEXLED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x010) #define LUB_DISC_BLNK_LED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x040) #define LUB_CONF_SWITCHES __LUB_REG(LUBBOCK_FPGA_PHYS + 0x050) #define LUB_USER_SWITCHES __LUB_REG(LUBBOCK_FPGA_PHYS + 0x060) diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h index 38d68d99f58..82a399f3f9f 100644 --- a/arch/arm/mach-pxa/include/mach/magician.h +++ b/arch/arm/mach-pxa/include/mach/magician.h @@ -69,7 +69,7 @@ #define IRQ_MAGICIAN_SD (IRQ_BOARD_START + 0) #define IRQ_MAGICIAN_EP (IRQ_BOARD_START + 1) #define IRQ_MAGICIAN_BT (IRQ_BOARD_START + 2) -#define IRQ_MAGICIAN_AC (IRQ_BOARD_START + 3) +#define IRQ_MAGICIAN_VBUS (IRQ_BOARD_START + 3) /* * CPLD EGPIOs diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h index a72869b73ee..b13dc0269a6 100644 --- a/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h @@ -1,7 +1,6 @@ #ifndef __ASM_ARCH_MFP_PXA25X_H #define __ASM_ARCH_MFP_PXA25X_H -#include <mach/mfp.h> #include <mach/mfp-pxa2xx.h> /* GPIO */ diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h index da4f85a4f99..6543c05f47e 100644 --- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h @@ -8,7 +8,6 @@ * specific controller, and this should work in most cases. */ -#include <mach/mfp.h> #include <mach/mfp-pxa2xx.h> /* Note: GPIO3/GPIO4 will be driven by Power I2C when PCFR/PI2C_EN diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h index 3e9211591e2..658b28ed129 100644 --- a/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h @@ -1,7 +1,7 @@ #ifndef __ASM_ARCH_MFP_PXA2XX_H #define __ASM_ARCH_MFP_PXA2XX_H -#include <mach/mfp.h> +#include <plat/mfp.h> /* * the following MFP_xxx bit definitions in mfp.h are re-used for pxa2xx: diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa300.h b/arch/arm/mach-pxa/include/mach/mfp-pxa300.h index bc1fb33a6e7..ae8441192ef 100644 --- a/arch/arm/mach-pxa/include/mach/mfp-pxa300.h +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa300.h @@ -15,7 +15,6 @@ #ifndef __ASM_ARCH_MFP_PXA300_H #define __ASM_ARCH_MFP_PXA300_H -#include <mach/mfp.h> #include <mach/mfp-pxa3xx.h> /* GPIO */ @@ -41,6 +40,7 @@ #endif /* Chip Select */ +#define GPIO1_nCS2 MFP_CFG(GPIO1, AF1) #define GPIO2_nCS3 MFP_CFG(GPIO2, AF1) /* AC97 */ diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa320.h b/arch/arm/mach-pxa/include/mach/mfp-pxa320.h index 67f8385ea54..07897e61d05 100644 --- a/arch/arm/mach-pxa/include/mach/mfp-pxa320.h +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa320.h @@ -15,7 +15,6 @@ #ifndef __ASM_ARCH_MFP_PXA320_H #define __ASM_ARCH_MFP_PXA320_H -#include <mach/mfp.h> #include <mach/mfp-pxa3xx.h> /* GPIO */ @@ -38,6 +37,7 @@ #define GPIO17_2_GPIO MFP_CFG(GPIO17_2, AF0) /* Chip Select */ +#define GPIO3_nCS2 MFP_CFG(GPIO3, AF1) #define GPIO4_nCS3 MFP_CFG(GPIO4, AF1) /* AC97 */ diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h b/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h index 1f6b35c015d..d375195d982 100644 --- a/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h @@ -1,68 +1,9 @@ #ifndef __ASM_ARCH_MFP_PXA3XX_H #define __ASM_ARCH_MFP_PXA3XX_H -#define MFPR_BASE (0x40e10000) -#define MFPR_SIZE (PAGE_SIZE) - -/* MFPR register bit definitions */ -#define MFPR_PULL_SEL (0x1 << 15) -#define MFPR_PULLUP_EN (0x1 << 14) -#define MFPR_PULLDOWN_EN (0x1 << 13) -#define MFPR_SLEEP_SEL (0x1 << 9) -#define MFPR_SLEEP_OE_N (0x1 << 7) -#define MFPR_EDGE_CLEAR (0x1 << 6) -#define MFPR_EDGE_FALL_EN (0x1 << 5) -#define MFPR_EDGE_RISE_EN (0x1 << 4) - -#define MFPR_SLEEP_DATA(x) ((x) << 8) -#define MFPR_DRIVE(x) (((x) & 0x7) << 10) -#define MFPR_AF_SEL(x) (((x) & 0x7) << 0) +#include <plat/mfp.h> -#define MFPR_EDGE_NONE (0) -#define MFPR_EDGE_RISE (MFPR_EDGE_RISE_EN) -#define MFPR_EDGE_FALL (MFPR_EDGE_FALL_EN) -#define MFPR_EDGE_BOTH (MFPR_EDGE_RISE | MFPR_EDGE_FALL) - -/* - * Table that determines the low power modes outputs, with actual settings - * used in parentheses for don't-care values. Except for the float output, - * the configured driven and pulled levels match, so if there is a need for - * non-LPM pulled output, the same configuration could probably be used. - * - * Output value sleep_oe_n sleep_data pullup_en pulldown_en pull_sel - * (bit 7) (bit 8) (bit 14) (bit 13) (bit 15) - * - * Input 0 X(0) X(0) X(0) 0 - * Drive 0 0 0 0 X(1) 0 - * Drive 1 0 1 X(1) 0 0 - * Pull hi (1) 1 X(1) 1 0 0 - * Pull lo (0) 1 X(0) 0 1 0 - * Z (float) 1 X(0) 0 0 0 - */ -#define MFPR_LPM_INPUT (0) -#define MFPR_LPM_DRIVE_LOW (MFPR_SLEEP_DATA(0) | MFPR_PULLDOWN_EN) -#define MFPR_LPM_DRIVE_HIGH (MFPR_SLEEP_DATA(1) | MFPR_PULLUP_EN) -#define MFPR_LPM_PULL_LOW (MFPR_LPM_DRIVE_LOW | MFPR_SLEEP_OE_N) -#define MFPR_LPM_PULL_HIGH (MFPR_LPM_DRIVE_HIGH | MFPR_SLEEP_OE_N) -#define MFPR_LPM_FLOAT (MFPR_SLEEP_OE_N) -#define MFPR_LPM_MASK (0xe080) - -/* - * The pullup and pulldown state of the MFP pin at run mode is by default - * determined by the selected alternate function. In case that some buggy - * devices need to override this default behavior, the definitions below - * indicates the setting of corresponding MFPR bits - * - * Definition pull_sel pullup_en pulldown_en - * MFPR_PULL_NONE 0 0 0 - * MFPR_PULL_LOW 1 0 1 - * MFPR_PULL_HIGH 1 1 0 - * MFPR_PULL_BOTH 1 1 1 - */ -#define MFPR_PULL_NONE (0) -#define MFPR_PULL_LOW (MFPR_PULL_SEL | MFPR_PULLDOWN_EN) -#define MFPR_PULL_BOTH (MFPR_PULL_LOW | MFPR_PULLUP_EN) -#define MFPR_PULL_HIGH (MFPR_PULL_SEL | MFPR_PULLUP_EN) +#define MFPR_BASE (0x40e10000) /* PXA3xx common MFP configurations - processor specific ones defined * in mfp-pxa300.h and mfp-pxa320.h @@ -197,56 +138,21 @@ #define GPIO5_2_GPIO MFP_CFG(GPIO5_2, AF0) #define GPIO6_2_GPIO MFP_CFG(GPIO6_2, AF0) -/* - * each MFP pin will have a MFPR register, since the offset of the - * register varies between processors, the processor specific code - * should initialize the pin offsets by pxa3xx_mfp_init_addr() - * - * pxa3xx_mfp_init_addr - accepts a table of "pxa3xx_mfp_addr_map" - * structure, which represents a range of MFP pins from "start" to - * "end", with the offset begining at "offset", to define a single - * pin, let "end" = -1 - * - * use - * - * MFP_ADDR_X() to define a range of pins - * MFP_ADDR() to define a single pin - * MFP_ADDR_END to signal the end of pin offset definitions - */ -struct pxa3xx_mfp_addr_map { - unsigned int start; - unsigned int end; - unsigned long offset; -}; - -#define MFP_ADDR_X(start, end, offset) \ - { MFP_PIN_##start, MFP_PIN_##end, offset } - -#define MFP_ADDR(pin, offset) \ - { MFP_PIN_##pin, -1, offset } - -#define MFP_ADDR_END { MFP_PIN_INVALID, 0 } - -/* - * pxa3xx_mfp_read()/pxa3xx_mfp_write() - for direct read/write access - * to the MFPR register - */ -unsigned long pxa3xx_mfp_read(int mfp); -void pxa3xx_mfp_write(int mfp, unsigned long mfpr_val); - -/* - * pxa3xx_mfp_config - configure the MFPR registers - * - * used by board specific initialization code - */ -void pxa3xx_mfp_config(unsigned long *mfp_cfgs, int num); - -/* - * pxa3xx_mfp_init_addr() - initialize the mapping between mfp pin - * index and MFPR register offset - * - * used by processor specific code +/* NOTE: usage of these two functions is not recommended, + * use pxa3xx_mfp_config() instead. */ -void __init pxa3xx_mfp_init_addr(struct pxa3xx_mfp_addr_map *); -void __init pxa3xx_init_mfp(void); +static inline unsigned long pxa3xx_mfp_read(int mfp) +{ + return mfp_read(mfp); +} + +static inline void pxa3xx_mfp_write(int mfp, unsigned long val) +{ + mfp_write(mfp, val); +} + +static inline void pxa3xx_mfp_config(unsigned long *mfp_cfg, int num) +{ + mfp_config(mfp_cfg, num); +} #endif /* __ASM_ARCH_MFP_PXA3XX_H */ diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa930.h b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h index fa73f56a137..0d119d3b922 100644 --- a/arch/arm/mach-pxa/include/mach/mfp-pxa930.h +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h @@ -13,7 +13,6 @@ #ifndef __ASM_ARCH_MFP_PXA9xx_H #define __ASM_ARCH_MFP_PXA9xx_H -#include <mach/mfp.h> #include <mach/mfp-pxa3xx.h> /* GPIO */ diff --git a/arch/arm/mach-pxa/include/mach/mtd-xip.h b/arch/arm/mach-pxa/include/mach/mtd-xip.h index cfca8155be7..297387ec361 100644 --- a/arch/arm/mach-pxa/include/mach/mtd-xip.h +++ b/arch/arm/mach-pxa/include/mach/mtd-xip.h @@ -15,8 +15,8 @@ #ifndef __ARCH_PXA_MTD_XIP_H__ #define __ARCH_PXA_MTD_XIP_H__ -#include <mach/hardware.h> -#include <mach/pxa-regs.h> +#include <mach/regs-ost.h> +#include <mach/regs-intc.h> #define xip_irqpending() (ICIP & ICMR) diff --git a/arch/arm/mach-pxa/include/mach/palmld.h b/arch/arm/mach-pxa/include/mach/palmld.h new file mode 100644 index 00000000000..7c295a48d78 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/palmld.h @@ -0,0 +1,109 @@ +/* + * GPIOs and interrupts for Palm LifeDrive Handheld Computer + * + * Authors: Alex Osborne <ato@meshy.org> + * Marek Vasut <marek.vasut@gmail.com> + * + * 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. + * + */ + +#ifndef _INCLUDE_PALMLD_H_ +#define _INCLUDE_PALMLD_H_ + +/** HERE ARE GPIOs **/ + +/* GPIOs */ +#define GPIO_NR_PALMLD_GPIO_RESET 1 +#define GPIO_NR_PALMLD_POWER_DETECT 4 +#define GPIO_NR_PALMLD_HOTSYNC_BUTTON_N 10 +#define GPIO_NR_PALMLD_POWER_SWITCH 12 +#define GPIO_NR_PALMLD_EARPHONE_DETECT 13 +#define GPIO_NR_PALMLD_LOCK_SWITCH 15 + +/* SD/MMC */ +#define GPIO_NR_PALMLD_SD_DETECT_N 14 +#define GPIO_NR_PALMLD_SD_POWER 114 +#define GPIO_NR_PALMLD_SD_READONLY 116 + +/* TOUCHSCREEN */ +#define GPIO_NR_PALMLD_WM9712_IRQ 27 + +/* IRDA */ +#define GPIO_NR_PALMLD_IR_DISABLE 108 + +/* LCD/BACKLIGHT */ +#define GPIO_NR_PALMLD_BL_POWER 19 +#define GPIO_NR_PALMLD_LCD_POWER 96 + +/* LCD BORDER */ +#define GPIO_NR_PALMLD_BORDER_SWITCH 21 +#define GPIO_NR_PALMLD_BORDER_SELECT 22 + +/* BLUETOOTH */ +#define GPIO_NR_PALMLD_BT_POWER 17 +#define GPIO_NR_PALMLD_BT_RESET 83 + +/* PCMCIA (WiFi) */ +#define GPIO_NR_PALMLD_PCMCIA_READY 38 +#define GPIO_NR_PALMLD_PCMCIA_POWER 36 +#define GPIO_NR_PALMLD_PCMCIA_RESET 81 + +/* LEDs */ +#define GPIO_NR_PALMLD_LED_GREEN 52 +#define GPIO_NR_PALMLD_LED_AMBER 94 + +/* IDE */ +#define GPIO_NR_PALMLD_IDE_IRQ 95 +#define GPIO_NR_PALMLD_IDE_RESET 98 +#define GPIO_NR_PALMLD_IDE_PWEN 115 + +/* USB */ +#define GPIO_NR_PALMLD_USB_DETECT_N 3 +#define GPIO_NR_PALMLD_USB_READY 86 +#define GPIO_NR_PALMLD_USB_RESET 88 +#define GPIO_NR_PALMLD_USB_INT 106 +#define GPIO_NR_PALMLD_USB_POWER 118 +/* 20, 53 and 86 are usb related too */ + +/* INTERRUPTS */ +#define IRQ_GPIO_PALMLD_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMLD_GPIO_RESET) +#define IRQ_GPIO_PALMLD_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMLD_SD_DETECT_N) +#define IRQ_GPIO_PALMLD_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMLD_WM9712_IRQ) +#define IRQ_GPIO_PALMLD_IDE_IRQ IRQ_GPIO(GPIO_NR_PALMLD_IDE_IRQ) + + +/** HERE ARE INIT VALUES **/ + +/* IO mappings */ +#define PALMLD_USB_PHYS PXA_CS2_PHYS +#define PALMLD_USB_VIRT 0xf0000000 +#define PALMLD_USB_SIZE 0x00100000 + +#define PALMLD_IDE_PHYS 0x20000000 +#define PALMLD_IDE_VIRT 0xf1000000 +#define PALMLD_IDE_SIZE 0x00100000 + +#define PALMLD_PHYS_IO_START 0x40000000 + +/* BATTERY */ +#define PALMLD_BAT_MAX_VOLTAGE 4000 /* 4.00V maximum voltage */ +#define PALMLD_BAT_MIN_VOLTAGE 3550 /* 3.55V critical voltage */ +#define PALMLD_BAT_MAX_CURRENT 0 /* unknokn */ +#define PALMLD_BAT_MIN_CURRENT 0 /* unknown */ +#define PALMLD_BAT_MAX_CHARGE 1 /* unknown */ +#define PALMLD_BAT_MIN_CHARGE 1 /* unknown */ +#define PALMLD_MAX_LIFE_MINS 240 /* on-life in minutes */ + +#define PALMLD_BAT_MEASURE_DELAY (HZ * 1) + +/* BACKLIGHT */ +#define PALMLD_MAX_INTENSITY 0xFE +#define PALMLD_DEFAULT_INTENSITY 0x7E +#define PALMLD_LIMIT_MASK 0x7F +#define PALMLD_PRESCALER 0x3F +#define PALMLD_PERIOD_NS 3500 + +#endif diff --git a/arch/arm/mach-pxa/include/mach/palmt5.h b/arch/arm/mach-pxa/include/mach/palmt5.h new file mode 100644 index 00000000000..94db2881f04 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/palmt5.h @@ -0,0 +1,84 @@ +/* + * GPIOs and interrupts for Palm Tungsten|T5 Handheld Computer + * + * Authors: Ales Snuparek <snuparek@atlas.cz> + * Marek Vasut <marek.vasut@gmail.com> + * Justin Kendrick <twilightsentry@gmail.com> + * RichardT5 <richard_t5@users.sourceforge.net> + * + * 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. + * + */ + +#ifndef _INCLUDE_PALMT5_H_ +#define _INCLUDE_PALMT5_H_ + +/** HERE ARE GPIOs **/ + +/* GPIOs */ +#define GPIO_NR_PALMT5_GPIO_RESET 1 + +#define GPIO_NR_PALMT5_POWER_DETECT 90 +#define GPIO_NR_PALMT5_HOTSYNC_BUTTON_N 10 +#define GPIO_NR_PALMT5_EARPHONE_DETECT 107 + +/* SD/MMC */ +#define GPIO_NR_PALMT5_SD_DETECT_N 14 +#define GPIO_NR_PALMT5_SD_POWER 114 +#define GPIO_NR_PALMT5_SD_READONLY 115 + +/* TOUCHSCREEN */ +#define GPIO_NR_PALMT5_WM9712_IRQ 27 + +/* IRDA - disable GPIO connected to SD pin of tranceiver (TFBS4710?) ? */ +#define GPIO_NR_PALMT5_IR_DISABLE 40 + +/* USB */ +#define GPIO_NR_PALMT5_USB_DETECT_N 15 +#define GPIO_NR_PALMT5_USB_POWER 95 +#define GPIO_NR_PALMT5_USB_PULLUP 93 + +/* LCD/BACKLIGHT */ +#define GPIO_NR_PALMT5_BL_POWER 84 +#define GPIO_NR_PALMT5_LCD_POWER 96 + +/* BLUETOOTH */ +#define GPIO_NR_PALMT5_BT_POWER 17 +#define GPIO_NR_PALMT5_BT_RESET 83 + +/* INTERRUPTS */ +#define IRQ_GPIO_PALMT5_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMT5_SD_DETECT_N) +#define IRQ_GPIO_PALMT5_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMT5_WM9712_IRQ) +#define IRQ_GPIO_PALMT5_USB_DETECT IRQ_GPIO(GPIO_NR_PALMT5_USB_DETECT) +#define IRQ_GPIO_PALMT5_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMT5_GPIO_RESET) + +/** HERE ARE INIT VALUES **/ + +/* Various addresses */ +#define PALMT5_PHYS_RAM_START 0xa0000000 +#define PALMT5_PHYS_IO_START 0x40000000 + +/* TOUCHSCREEN */ +#define AC97_LINK_FRAME 21 + +/* BATTERY */ +#define PALMT5_BAT_MAX_VOLTAGE 4000 /* 4.00v current voltage */ +#define PALMT5_BAT_MIN_VOLTAGE 3550 /* 3.55v critical voltage */ +#define PALMT5_BAT_MAX_CURRENT 0 /* unknokn */ +#define PALMT5_BAT_MIN_CURRENT 0 /* unknown */ +#define PALMT5_BAT_MAX_CHARGE 1 /* unknown */ +#define PALMT5_BAT_MIN_CHARGE 1 /* unknown */ +#define PALMT5_MAX_LIFE_MINS 360 /* on-life in minutes */ + +#define PALMT5_BAT_MEASURE_DELAY (HZ * 1) + +/* BACKLIGHT */ +#define PALMT5_MAX_INTENSITY 0xFE +#define PALMT5_DEFAULT_INTENSITY 0x7E +#define PALMT5_LIMIT_MASK 0x7F +#define PALMT5_PRESCALER 0x3F +#define PALMT5_PERIOD_NS 3500 + +#endif diff --git a/arch/arm/mach-pxa/include/mach/pm.h b/arch/arm/mach-pxa/include/mach/pm.h index 83342469aca..a6eeef8a075 100644 --- a/arch/arm/mach-pxa/include/mach/pm.h +++ b/arch/arm/mach-pxa/include/mach/pm.h @@ -27,3 +27,13 @@ extern void pxa27x_cpu_suspend(unsigned int); extern void pxa_cpu_resume(void); extern int pxa_pm_enter(suspend_state_t state); + +/* NOTE: this is for PM debugging on Lubbock, it's really a big + * ugly, but let's keep the crap minimum here, instead of direct + * accessing the LUBBOCK CPLD registers in arch/arm/mach-pxa/pm.c + */ +#ifdef CONFIG_ARCH_LUBBOCK +extern void lubbock_set_hexled(uint32_t value); +#else +#define lubbock_set_hexled(x) +#endif diff --git a/arch/arm/mach-pxa/include/mach/pxa-regs.h b/arch/arm/mach-pxa/include/mach/pxa-regs.h deleted file mode 100644 index 31d615aa772..00000000000 --- a/arch/arm/mach-pxa/include/mach/pxa-regs.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * arch/arm/mach-pxa/include/mach/pxa-regs.h - * - * Author: Nicolas Pitre - * Created: Jun 15, 2001 - * Copyright: MontaVista Software Inc. - * - * 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. - */ - -#ifndef __PXA_REGS_H -#define __PXA_REGS_H - -#include <mach/hardware.h> - -/* - * PXA Chip selects - */ - -#define PXA_CS0_PHYS 0x00000000 -#define PXA_CS1_PHYS 0x04000000 -#define PXA_CS2_PHYS 0x08000000 -#define PXA_CS3_PHYS 0x0C000000 -#define PXA_CS4_PHYS 0x10000000 -#define PXA_CS5_PHYS 0x14000000 - - -/* - * Personal Computer Memory Card International Association (PCMCIA) sockets - */ - -#define PCMCIAPrtSp 0x04000000 /* PCMCIA Partition Space [byte] */ -#define PCMCIASp (4*PCMCIAPrtSp) /* PCMCIA Space [byte] */ -#define PCMCIAIOSp PCMCIAPrtSp /* PCMCIA I/O Space [byte] */ -#define PCMCIAAttrSp PCMCIAPrtSp /* PCMCIA Attribute Space [byte] */ -#define PCMCIAMemSp PCMCIAPrtSp /* PCMCIA Memory Space [byte] */ - -#define PCMCIA0Sp PCMCIASp /* PCMCIA 0 Space [byte] */ -#define PCMCIA0IOSp PCMCIAIOSp /* PCMCIA 0 I/O Space [byte] */ -#define PCMCIA0AttrSp PCMCIAAttrSp /* PCMCIA 0 Attribute Space [byte] */ -#define PCMCIA0MemSp PCMCIAMemSp /* PCMCIA 0 Memory Space [byte] */ - -#define PCMCIA1Sp PCMCIASp /* PCMCIA 1 Space [byte] */ -#define PCMCIA1IOSp PCMCIAIOSp /* PCMCIA 1 I/O Space [byte] */ -#define PCMCIA1AttrSp PCMCIAAttrSp /* PCMCIA 1 Attribute Space [byte] */ -#define PCMCIA1MemSp PCMCIAMemSp /* PCMCIA 1 Memory Space [byte] */ - -#define _PCMCIA(Nb) /* PCMCIA [0..1] */ \ - (0x20000000 + (Nb)*PCMCIASp) -#define _PCMCIAIO(Nb) _PCMCIA (Nb) /* PCMCIA I/O [0..1] */ -#define _PCMCIAAttr(Nb) /* PCMCIA Attribute [0..1] */ \ - (_PCMCIA (Nb) + 2*PCMCIAPrtSp) -#define _PCMCIAMem(Nb) /* PCMCIA Memory [0..1] */ \ - (_PCMCIA (Nb) + 3*PCMCIAPrtSp) - -#define _PCMCIA0 _PCMCIA (0) /* PCMCIA 0 */ -#define _PCMCIA0IO _PCMCIAIO (0) /* PCMCIA 0 I/O */ -#define _PCMCIA0Attr _PCMCIAAttr (0) /* PCMCIA 0 Attribute */ -#define _PCMCIA0Mem _PCMCIAMem (0) /* PCMCIA 0 Memory */ - -#define _PCMCIA1 _PCMCIA (1) /* PCMCIA 1 */ -#define _PCMCIA1IO _PCMCIAIO (1) /* PCMCIA 1 I/O */ -#define _PCMCIA1Attr _PCMCIAAttr (1) /* PCMCIA 1 Attribute */ -#define _PCMCIA1Mem _PCMCIAMem (1) /* PCMCIA 1 Memory */ - - - -/* - * DMA Controller - */ -#define DCSR(x) __REG2(0x40000000, (x) << 2) - -#define DCSR_RUN (1 << 31) /* Run Bit (read / write) */ -#define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch (read / write) */ -#define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable (read / write) */ -#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */ -#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */ -#define DCSR_ENDINTR (1 << 2) /* End Interrupt (read / write) */ -#define DCSR_STARTINTR (1 << 1) /* Start Interrupt (read / write) */ -#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt (read / write) */ - -#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) -#define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable (R/W) */ -#define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */ -#define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */ -#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */ -#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */ -#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */ -#define DCSR_EORINTR (1 << 9) /* The end of Receive */ -#endif - -#define DALGN __REG(0x400000a0) /* DMA Alignment Register */ -#define DINT __REG(0x400000f0) /* DMA Interrupt Register */ - -#define DRCMR(n) (*(((n) < 64) ? \ - &__REG2(0x40000100, ((n) & 0x3f) << 2) : \ - &__REG2(0x40001100, ((n) & 0x3f) << 2))) - -#define DRCMR_MAPVLD (1 << 7) /* Map Valid (read / write) */ -#define DRCMR_CHLNUM 0x1f /* mask for Channel Number (read / write) */ - -#define DDADR(x) __REG2(0x40000200, (x) << 4) -#define DSADR(x) __REG2(0x40000204, (x) << 4) -#define DTADR(x) __REG2(0x40000208, (x) << 4) -#define DCMD(x) __REG2(0x4000020c, (x) << 4) - -#define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor (mask) */ -#define DDADR_STOP (1 << 0) /* Stop (read / write) */ - -#define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */ -#define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */ -#define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */ -#define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */ -#define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */ -#define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */ -#define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */ -#define DCMD_BURST8 (1 << 16) /* 8 byte burst */ -#define DCMD_BURST16 (2 << 16) /* 16 byte burst */ -#define DCMD_BURST32 (3 << 16) /* 32 byte burst */ -#define DCMD_WIDTH1 (1 << 14) /* 1 byte width */ -#define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */ -#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */ -#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ - -/* - * Real Time Clock - */ - -#define RCNR __REG(0x40900000) /* RTC Count Register */ -#define RTAR __REG(0x40900004) /* RTC Alarm Register */ -#define RTSR __REG(0x40900008) /* RTC Status Register */ -#define RTTR __REG(0x4090000C) /* RTC Timer Trim Register */ -#define PIAR __REG(0x40900038) /* Periodic Interrupt Alarm Register */ - -#define RTSR_PICE (1 << 15) /* Periodic interrupt count enable */ -#define RTSR_PIALE (1 << 14) /* Periodic interrupt Alarm enable */ -#define RTSR_HZE (1 << 3) /* HZ interrupt enable */ -#define RTSR_ALE (1 << 2) /* RTC alarm interrupt enable */ -#define RTSR_HZ (1 << 1) /* HZ rising-edge detected */ -#define RTSR_AL (1 << 0) /* RTC alarm detected */ - - -/* - * OS Timer & Match Registers - */ - -#define OSMR0 __REG(0x40A00000) /* */ -#define OSMR1 __REG(0x40A00004) /* */ -#define OSMR2 __REG(0x40A00008) /* */ -#define OSMR3 __REG(0x40A0000C) /* */ -#define OSMR4 __REG(0x40A00080) /* */ -#define OSCR __REG(0x40A00010) /* OS Timer Counter Register */ -#define OSCR4 __REG(0x40A00040) /* OS Timer Counter Register */ -#define OMCR4 __REG(0x40A000C0) /* */ -#define OSSR __REG(0x40A00014) /* OS Timer Status Register */ -#define OWER __REG(0x40A00018) /* OS Timer Watchdog Enable Register */ -#define OIER __REG(0x40A0001C) /* OS Timer Interrupt Enable Register */ - -#define OSSR_M3 (1 << 3) /* Match status channel 3 */ -#define OSSR_M2 (1 << 2) /* Match status channel 2 */ -#define OSSR_M1 (1 << 1) /* Match status channel 1 */ -#define OSSR_M0 (1 << 0) /* Match status channel 0 */ - -#define OWER_WME (1 << 0) /* Watchdog Match Enable */ - -#define OIER_E3 (1 << 3) /* Interrupt enable channel 3 */ -#define OIER_E2 (1 << 2) /* Interrupt enable channel 2 */ -#define OIER_E1 (1 << 1) /* Interrupt enable channel 1 */ -#define OIER_E0 (1 << 0) /* Interrupt enable channel 0 */ - - -/* - * Interrupt Controller - */ - -#define ICIP __REG(0x40D00000) /* Interrupt Controller IRQ Pending Register */ -#define ICMR __REG(0x40D00004) /* Interrupt Controller Mask Register */ -#define ICLR __REG(0x40D00008) /* Interrupt Controller Level Register */ -#define ICFP __REG(0x40D0000C) /* Interrupt Controller FIQ Pending Register */ -#define ICPR __REG(0x40D00010) /* Interrupt Controller Pending Register */ -#define ICCR __REG(0x40D00014) /* Interrupt Controller Control Register */ - -#define ICIP2 __REG(0x40D0009C) /* Interrupt Controller IRQ Pending Register 2 */ -#define ICMR2 __REG(0x40D000A0) /* Interrupt Controller Mask Register 2 */ -#define ICLR2 __REG(0x40D000A4) /* Interrupt Controller Level Register 2 */ -#define ICFP2 __REG(0x40D000A8) /* Interrupt Controller FIQ Pending Register 2 */ -#define ICPR2 __REG(0x40D000AC) /* Interrupt Controller Pending Register 2 */ - -/* - * General Purpose I/O - */ - -#define GPLR0 __REG(0x40E00000) /* GPIO Pin-Level Register GPIO<31:0> */ -#define GPLR1 __REG(0x40E00004) /* GPIO Pin-Level Register GPIO<63:32> */ -#define GPLR2 __REG(0x40E00008) /* GPIO Pin-Level Register GPIO<80:64> */ - -#define GPDR0 __REG(0x40E0000C) /* GPIO Pin Direction Register GPIO<31:0> */ -#define GPDR1 __REG(0x40E00010) /* GPIO Pin Direction Register GPIO<63:32> */ -#define GPDR2 __REG(0x40E00014) /* GPIO Pin Direction Register GPIO<80:64> */ - -#define GPSR0 __REG(0x40E00018) /* GPIO Pin Output Set Register GPIO<31:0> */ -#define GPSR1 __REG(0x40E0001C) /* GPIO Pin Output Set Register GPIO<63:32> */ -#define GPSR2 __REG(0x40E00020) /* GPIO Pin Output Set Register GPIO<80:64> */ - -#define GPCR0 __REG(0x40E00024) /* GPIO Pin Output Clear Register GPIO<31:0> */ -#define GPCR1 __REG(0x40E00028) /* GPIO Pin Output Clear Register GPIO <63:32> */ -#define GPCR2 __REG(0x40E0002C) /* GPIO Pin Output Clear Register GPIO <80:64> */ - -#define GRER0 __REG(0x40E00030) /* GPIO Rising-Edge Detect Register GPIO<31:0> */ -#define GRER1 __REG(0x40E00034) /* GPIO Rising-Edge Detect Register GPIO<63:32> */ -#define GRER2 __REG(0x40E00038) /* GPIO Rising-Edge Detect Register GPIO<80:64> */ - -#define GFER0 __REG(0x40E0003C) /* GPIO Falling-Edge Detect Register GPIO<31:0> */ -#define GFER1 __REG(0x40E00040) /* GPIO Falling-Edge Detect Register GPIO<63:32> */ -#define GFER2 __REG(0x40E00044) /* GPIO Falling-Edge Detect Register GPIO<80:64> */ - -#define GEDR0 __REG(0x40E00048) /* GPIO Edge Detect Status Register GPIO<31:0> */ -#define GEDR1 __REG(0x40E0004C) /* GPIO Edge Detect Status Register GPIO<63:32> */ -#define GEDR2 __REG(0x40E00050) /* GPIO Edge Detect Status Register GPIO<80:64> */ - -#define GAFR0_L __REG(0x40E00054) /* GPIO Alternate Function Select Register GPIO<15:0> */ -#define GAFR0_U __REG(0x40E00058) /* GPIO Alternate Function Select Register GPIO<31:16> */ -#define GAFR1_L __REG(0x40E0005C) /* GPIO Alternate Function Select Register GPIO<47:32> */ -#define GAFR1_U __REG(0x40E00060) /* GPIO Alternate Function Select Register GPIO<63:48> */ -#define GAFR2_L __REG(0x40E00064) /* GPIO Alternate Function Select Register GPIO<79:64> */ -#define GAFR2_U __REG(0x40E00068) /* GPIO Alternate Function Select Register GPIO<95-80> */ -#define GAFR3_L __REG(0x40E0006C) /* GPIO Alternate Function Select Register GPIO<111:96> */ -#define GAFR3_U __REG(0x40E00070) /* GPIO Alternate Function Select Register GPIO<127:112> */ - -#define GPLR3 __REG(0x40E00100) /* GPIO Pin-Level Register GPIO<127:96> */ -#define GPDR3 __REG(0x40E0010C) /* GPIO Pin Direction Register GPIO<127:96> */ -#define GPSR3 __REG(0x40E00118) /* GPIO Pin Output Set Register GPIO<127:96> */ -#define GPCR3 __REG(0x40E00124) /* GPIO Pin Output Clear Register GPIO<127:96> */ -#define GRER3 __REG(0x40E00130) /* GPIO Rising-Edge Detect Register GPIO<127:96> */ -#define GFER3 __REG(0x40E0013C) /* GPIO Falling-Edge Detect Register GPIO<127:96> */ -#define GEDR3 __REG(0x40E00148) /* GPIO Edge Detect Status Register GPIO<127:96> */ - -/* More handy macros. The argument is a literal GPIO number. */ - -#define GPIO_bit(x) (1 << ((x) & 0x1f)) - -#define _GPLR(x) __REG2(0x40E00000, ((x) & 0x60) >> 3) -#define _GPDR(x) __REG2(0x40E0000C, ((x) & 0x60) >> 3) -#define _GPSR(x) __REG2(0x40E00018, ((x) & 0x60) >> 3) -#define _GPCR(x) __REG2(0x40E00024, ((x) & 0x60) >> 3) -#define _GRER(x) __REG2(0x40E00030, ((x) & 0x60) >> 3) -#define _GFER(x) __REG2(0x40E0003C, ((x) & 0x60) >> 3) -#define _GEDR(x) __REG2(0x40E00048, ((x) & 0x60) >> 3) -#define _GAFR(x) __REG2(0x40E00054, ((x) & 0x70) >> 2) - -#define GPLR(x) (*((((x) & 0x7f) < 96) ? &_GPLR(x) : &GPLR3)) -#define GPDR(x) (*((((x) & 0x7f) < 96) ? &_GPDR(x) : &GPDR3)) -#define GPSR(x) (*((((x) & 0x7f) < 96) ? &_GPSR(x) : &GPSR3)) -#define GPCR(x) (*((((x) & 0x7f) < 96) ? &_GPCR(x) : &GPCR3)) -#define GRER(x) (*((((x) & 0x7f) < 96) ? &_GRER(x) : &GRER3)) -#define GFER(x) (*((((x) & 0x7f) < 96) ? &_GFER(x) : &GFER3)) -#define GEDR(x) (*((((x) & 0x7f) < 96) ? &_GEDR(x) : &GEDR3)) -#define GAFR(x) (*((((x) & 0x7f) < 96) ? &_GAFR(x) : \ - ((((x) & 0x7f) < 112) ? &GAFR3_L : &GAFR3_U))) - -#endif diff --git a/arch/arm/mach-pxa/include/mach/pxa25x.h b/arch/arm/mach-pxa/include/mach/pxa25x.h new file mode 100644 index 00000000000..508c3ba1f4d --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/pxa25x.h @@ -0,0 +1,8 @@ +#ifndef __MACH_PXA25x_H +#define __MACH_PXA25x_H + +#include <mach/hardware.h> +#include <mach/pxa2xx-regs.h> +#include <mach/mfp-pxa25x.h> + +#endif /* __MACH_PXA25x_H */ diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h new file mode 100644 index 00000000000..6876e16c297 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/pxa27x.h @@ -0,0 +1,19 @@ +#ifndef __MACH_PXA27x_H +#define __MACH_PXA27x_H + +#include <mach/hardware.h> +#include <mach/pxa2xx-regs.h> +#include <mach/mfp-pxa27x.h> + +#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */ + +#define ARB_DMA_SLV_PARK (1<<31) /* Be parked with DMA slave when idle */ +#define ARB_CI_PARK (1<<30) /* Be parked with Camera Interface when idle */ +#define ARB_EX_MEM_PARK (1<<29) /* Be parked with external MEMC when idle */ +#define ARB_INT_MEM_PARK (1<<28) /* Be parked with internal MEMC when idle */ +#define ARB_USB_PARK (1<<27) /* Be parked with USB when idle */ +#define ARB_LCD_PARK (1<<26) /* Be parked with LCD when idle */ +#define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */ +#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ +#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ +#endif /* __MACH_PXA27x_H */ diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h b/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h index d83393e2527..1209c44aa6f 100644 --- a/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h +++ b/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h @@ -3,6 +3,8 @@ #warning Please use mfp-pxa2[57]x.h instead of pxa2xx-gpio.h +#include <mach/gpio.h> + /* GPIO alternate function assignments */ #define GPIO1_RST 1 /* reset */ diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h index 77102d695cc..4fcddd9cab7 100644 --- a/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h +++ b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h @@ -14,6 +14,19 @@ #ifndef __PXA2XX_REGS_H #define __PXA2XX_REGS_H +#include <mach/hardware.h> + +/* + * PXA Chip selects + */ + +#define PXA_CS0_PHYS 0x00000000 +#define PXA_CS1_PHYS 0x04000000 +#define PXA_CS2_PHYS 0x08000000 +#define PXA_CS3_PHYS 0x0C000000 +#define PXA_CS4_PHYS 0x10000000 +#define PXA_CS5_PHYS 0x14000000 + /* * Memory controller */ @@ -69,24 +82,6 @@ #define MDREFR_K0RUN (1 << 13) /* SDCLK0 Run Control/Status */ #define MDREFR_E0PIN (1 << 12) /* SDCKE0 Level Control/Status */ - -#ifdef CONFIG_PXA27x - -#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */ - -#define ARB_DMA_SLV_PARK (1<<31) /* Be parked with DMA slave when idle */ -#define ARB_CI_PARK (1<<30) /* Be parked with Camera Interface when idle */ -#define ARB_EX_MEM_PARK (1<<29) /* Be parked with external MEMC when idle */ -#define ARB_INT_MEM_PARK (1<<28) /* Be parked with internal MEMC when idle */ -#define ARB_USB_PARK (1<<27) /* Be parked with USB when idle */ -#define ARB_LCD_PARK (1<<26) /* Be parked with LCD when idle */ -#define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */ -#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ -#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ - -#endif - - /* * Power Manager */ diff --git a/arch/arm/mach-pxa/include/mach/pxa300.h b/arch/arm/mach-pxa/include/mach/pxa300.h new file mode 100644 index 00000000000..2f33076c9e4 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/pxa300.h @@ -0,0 +1,8 @@ +#ifndef __MACH_PXA300_H +#define __MACH_PXA300_H + +#include <mach/hardware.h> +#include <mach/pxa3xx-regs.h> +#include <mach/mfp-pxa300.h> + +#endif /* __MACH_PXA300_H */ diff --git a/arch/arm/mach-pxa/include/mach/pxa320.h b/arch/arm/mach-pxa/include/mach/pxa320.h new file mode 100644 index 00000000000..cab78e90327 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/pxa320.h @@ -0,0 +1,9 @@ +#ifndef __MACH_PXA320_H +#define __MACH_PXA320_H + +#include <mach/hardware.h> +#include <mach/pxa3xx-regs.h> +#include <mach/mfp-pxa320.h> + +#endif /* __MACH_PXA320_H */ + diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h b/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h index bcf3fb2c4b3..7d1a059b3d4 100644 --- a/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h +++ b/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h @@ -13,6 +13,17 @@ #ifndef __ASM_ARCH_PXA3XX_REGS_H #define __ASM_ARCH_PXA3XX_REGS_H +#include <mach/hardware.h> + +/* + * Static Chip Selects + */ + +#define PXA300_CS0_PHYS (0x00000000) /* PXA300/PXA310 _only_ */ +#define PXA300_CS1_PHYS (0x30000000) /* PXA300/PXA310 _only_ */ +#define PXA3xx_CS2_PHYS (0x10000000) +#define PXA3xx_CS3_PHYS (0x14000000) + /* * Oscillator Configuration Register (OSCC) */ diff --git a/arch/arm/mach-pxa/include/mach/pxa930.h b/arch/arm/mach-pxa/include/mach/pxa930.h new file mode 100644 index 00000000000..d45f76a9b54 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/pxa930.h @@ -0,0 +1,8 @@ +#ifndef __MACH_PXA930_H +#define __MACH_PXA930_H + +#include <mach/hardware.h> +#include <mach/pxa3xx-regs.h> +#include <mach/mfp-pxa930.h> + +#endif /* __MACH_PXA930_H */ diff --git a/arch/arm/mach-pxa/include/mach/regs-intc.h b/arch/arm/mach-pxa/include/mach/regs-intc.h new file mode 100644 index 00000000000..ad23e74b762 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/regs-intc.h @@ -0,0 +1,23 @@ +#ifndef __ASM_MACH_REGS_INTC_H +#define __ASM_MACH_REGS_INTC_H + +#include <mach/hardware.h> + +/* + * Interrupt Controller + */ + +#define ICIP __REG(0x40D00000) /* Interrupt Controller IRQ Pending Register */ +#define ICMR __REG(0x40D00004) /* Interrupt Controller Mask Register */ +#define ICLR __REG(0x40D00008) /* Interrupt Controller Level Register */ +#define ICFP __REG(0x40D0000C) /* Interrupt Controller FIQ Pending Register */ +#define ICPR __REG(0x40D00010) /* Interrupt Controller Pending Register */ +#define ICCR __REG(0x40D00014) /* Interrupt Controller Control Register */ + +#define ICIP2 __REG(0x40D0009C) /* Interrupt Controller IRQ Pending Register 2 */ +#define ICMR2 __REG(0x40D000A0) /* Interrupt Controller Mask Register 2 */ +#define ICLR2 __REG(0x40D000A4) /* Interrupt Controller Level Register 2 */ +#define ICFP2 __REG(0x40D000A8) /* Interrupt Controller FIQ Pending Register 2 */ +#define ICPR2 __REG(0x40D000AC) /* Interrupt Controller Pending Register 2 */ + +#endif /* __ASM_MACH_REGS_INTC_H */ diff --git a/arch/arm/mach-pxa/include/mach/regs-ost.h b/arch/arm/mach-pxa/include/mach/regs-ost.h new file mode 100644 index 00000000000..a3e5f86ef67 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/regs-ost.h @@ -0,0 +1,34 @@ +#ifndef __ASM_MACH_REGS_OST_H +#define __ASM_MACH_REGS_OST_H + +#include <mach/hardware.h> + +/* + * OS Timer & Match Registers + */ + +#define OSMR0 __REG(0x40A00000) /* */ +#define OSMR1 __REG(0x40A00004) /* */ +#define OSMR2 __REG(0x40A00008) /* */ +#define OSMR3 __REG(0x40A0000C) /* */ +#define OSMR4 __REG(0x40A00080) /* */ +#define OSCR __REG(0x40A00010) /* OS Timer Counter Register */ +#define OSCR4 __REG(0x40A00040) /* OS Timer Counter Register */ +#define OMCR4 __REG(0x40A000C0) /* */ +#define OSSR __REG(0x40A00014) /* OS Timer Status Register */ +#define OWER __REG(0x40A00018) /* OS Timer Watchdog Enable Register */ +#define OIER __REG(0x40A0001C) /* OS Timer Interrupt Enable Register */ + +#define OSSR_M3 (1 << 3) /* Match status channel 3 */ +#define OSSR_M2 (1 << 2) /* Match status channel 2 */ +#define OSSR_M1 (1 << 1) /* Match status channel 1 */ +#define OSSR_M0 (1 << 0) /* Match status channel 0 */ + +#define OWER_WME (1 << 0) /* Watchdog Match Enable */ + +#define OIER_E3 (1 << 3) /* Interrupt enable channel 3 */ +#define OIER_E2 (1 << 2) /* Interrupt enable channel 2 */ +#define OIER_E1 (1 << 1) /* Interrupt enable channel 1 */ +#define OIER_E0 (1 << 0) /* Interrupt enable channel 0 */ + +#endif /* __ASM_MACH_REGS_OST_H */ diff --git a/arch/arm/mach-pxa/include/mach/regs-rtc.h b/arch/arm/mach-pxa/include/mach/regs-rtc.h new file mode 100644 index 00000000000..f0e4a589bbe --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/regs-rtc.h @@ -0,0 +1,23 @@ +#ifndef __ASM_MACH_REGS_RTC_H +#define __ASM_MACH_REGS_RTC_H + +#include <mach/hardware.h> + +/* + * Real Time Clock + */ + +#define RCNR __REG(0x40900000) /* RTC Count Register */ +#define RTAR __REG(0x40900004) /* RTC Alarm Register */ +#define RTSR __REG(0x40900008) /* RTC Status Register */ +#define RTTR __REG(0x4090000C) /* RTC Timer Trim Register */ +#define PIAR __REG(0x40900038) /* Periodic Interrupt Alarm Register */ + +#define RTSR_PICE (1 << 15) /* Periodic interrupt count enable */ +#define RTSR_PIALE (1 << 14) /* Periodic interrupt Alarm enable */ +#define RTSR_HZE (1 << 3) /* HZ interrupt enable */ +#define RTSR_ALE (1 << 2) /* RTC alarm interrupt enable */ +#define RTSR_HZ (1 << 1) /* HZ rising-edge detected */ +#define RTSR_AL (1 << 0) /* RTC alarm detected */ + +#endif /* __ASM_MACH_REGS_RTC_H */ diff --git a/arch/arm/mach-pxa/include/mach/regs-ssp.h b/arch/arm/mach-pxa/include/mach/regs-ssp.h index cf31986f6f0..6a2ed35acd5 100644 --- a/arch/arm/mach-pxa/include/mach/regs-ssp.h +++ b/arch/arm/mach-pxa/include/mach/regs-ssp.h @@ -37,7 +37,6 @@ #if defined(CONFIG_PXA25x) #define SSCR0_SCR (0x0000ff00) /* Serial Clock Rate (mask) */ #define SSCR0_SerClkDiv(x) ((((x) - 2)/2) << 8) /* Divisor [2..512] */ - #elif defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) #define SSCR0_SCR (0x000fff00) /* Serial Clock Rate (mask) */ #define SSCR0_SerClkDiv(x) (((x) - 1) << 8) /* Divisor [1..4096] */ @@ -50,7 +49,7 @@ #define SSCR0_TUM (1 << 23) /* Transmit FIFO underrun interrupt mask */ #define SSCR0_FRDC (0x07000000) /* Frame rate divider control (mask) */ #define SSCR0_SlotsPerFrm(x) (((x) - 1) << 24) /* Time slots per frame [1..8] */ -#define SSCR0_ADC (1 << 30) /* Audio clock select */ +#define SSCR0_ACS (1 << 30) /* Audio clock select */ #define SSCR0_MOD (1 << 31) /* Mode (normal or network) */ #endif @@ -109,6 +108,11 @@ #define SSSR_TINT (1 << 19) /* Receiver Time-out Interrupt */ #define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */ +#if defined(CONFIG_PXA3xx) +#define SSPSP_EDMYSTOP(x) ((x) << 28) /* Extended Dummy Stop */ +#define SSPSP_EDMYSTRT(x) ((x) << 26) /* Extended Dummy Start */ +#endif + #define SSPSP_FSRT (1 << 25) /* Frame Sync Relative Timing */ #define SSPSP_DMYSTOP(x) ((x) << 23) /* Dummy Stop */ #define SSPSP_SFRMWDTH(x) ((x) << 16) /* Serial Frame Width */ diff --git a/arch/arm/mach-pxa/include/mach/system.h b/arch/arm/mach-pxa/include/mach/system.h index 0f381e69299..d1fce8b6d10 100644 --- a/arch/arm/mach-pxa/include/mach/system.h +++ b/arch/arm/mach-pxa/include/mach/system.h @@ -13,7 +13,6 @@ #include <asm/proc-fns.h> #include "hardware.h" #include "pxa2xx-regs.h" -#include "pxa-regs.h" static inline void arch_idle(void) { @@ -21,4 +20,4 @@ static inline void arch_idle(void) } -void arch_reset(char mode); +void arch_reset(char mode, const char *cmd); diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h index f4b029c0395..5706cea95d1 100644 --- a/arch/arm/mach-pxa/include/mach/uncompress.h +++ b/arch/arm/mach-pxa/include/mach/uncompress.h @@ -35,7 +35,8 @@ static inline void flush(void) static inline void arch_decomp_setup(void) { - if (machine_is_littleton() || machine_is_intelmote2()) + if (machine_is_littleton() || machine_is_intelmote2() + || machine_is_csb726()) UART = STUART; } diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c index fa69c3a6a38..f6e0300e4f6 100644 --- a/arch/arm/mach-pxa/irq.c +++ b/arch/arm/mach-pxa/irq.c @@ -20,7 +20,8 @@ #include <mach/hardware.h> #include <asm/irq.h> #include <asm/mach/irq.h> -#include <mach/pxa-regs.h> +#include <mach/gpio.h> +#include <mach/regs-intc.h> #include "generic.h" @@ -51,6 +52,72 @@ static struct irq_chip pxa_internal_irq_chip = { .unmask = pxa_unmask_irq, }; +/* + * GPIO IRQs for GPIO 0 and 1 + */ +static int pxa_set_low_gpio_type(unsigned int irq, unsigned int type) +{ + int gpio = irq - IRQ_GPIO0; + + if (__gpio_is_occupied(gpio)) { + pr_err("%s failed: GPIO is configured\n", __func__); + return -EINVAL; + } + + if (type & IRQ_TYPE_EDGE_RISING) + GRER0 |= GPIO_bit(gpio); + else + GRER0 &= ~GPIO_bit(gpio); + + if (type & IRQ_TYPE_EDGE_FALLING) + GFER0 |= GPIO_bit(gpio); + else + GFER0 &= ~GPIO_bit(gpio); + + return 0; +} + +static void pxa_ack_low_gpio(unsigned int irq) +{ + GEDR0 = (1 << (irq - IRQ_GPIO0)); +} + +static void pxa_mask_low_gpio(unsigned int irq) +{ + ICMR &= ~(1 << (irq - PXA_IRQ(0))); +} + +static void pxa_unmask_low_gpio(unsigned int irq) +{ + ICMR |= 1 << (irq - PXA_IRQ(0)); +} + +static struct irq_chip pxa_low_gpio_chip = { + .name = "GPIO-l", + .ack = pxa_ack_low_gpio, + .mask = pxa_mask_low_gpio, + .unmask = pxa_unmask_low_gpio, + .set_type = pxa_set_low_gpio_type, +}; + +static void __init pxa_init_low_gpio_irq(set_wake_t fn) +{ + int irq; + + /* clear edge detection on GPIO 0 and 1 */ + GFER0 &= ~0x3; + GRER0 &= ~0x3; + GEDR0 = 0x3; + + for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) { + set_irq_chip(irq, &pxa_low_gpio_chip); + set_irq_handler(irq, handle_edge_irq); + set_irq_flags(irq, IRQF_VALID); + } + + pxa_low_gpio_chip.set_wake = fn; +} + void __init pxa_init_irq(int irq_nr, set_wake_t fn) { int irq; @@ -72,6 +139,7 @@ void __init pxa_init_irq(int irq_nr, set_wake_t fn) } pxa_internal_irq_chip.set_wake = fn; + pxa_init_low_gpio_irq(fn); } #ifdef CONFIG_PM diff --git a/arch/arm/mach-pxa/leds-idp.c b/arch/arm/mach-pxa/leds-idp.c index 18b20d46941..8b9c17142d5 100644 --- a/arch/arm/mach-pxa/leds-idp.c +++ b/arch/arm/mach-pxa/leds-idp.c @@ -18,7 +18,7 @@ #include <asm/leds.h> #include <asm/system.h> -#include <mach/pxa-regs.h> +#include <mach/pxa25x.h> #include <mach/idp.h> #include "leds.h" diff --git a/arch/arm/mach-pxa/leds-lubbock.c b/arch/arm/mach-pxa/leds-lubbock.c index 1a258029c33..e26d5efe196 100644 --- a/arch/arm/mach-pxa/leds-lubbock.c +++ b/arch/arm/mach-pxa/leds-lubbock.c @@ -16,7 +16,7 @@ #include <mach/hardware.h> #include <asm/leds.h> #include <asm/system.h> -#include <mach/pxa-regs.h> +#include <mach/pxa25x.h> #include <mach/lubbock.h> #include "leds.h" diff --git a/arch/arm/mach-pxa/leds-mainstone.c b/arch/arm/mach-pxa/leds-mainstone.c index 95e06b84963..db4af5eee8b 100644 --- a/arch/arm/mach-pxa/leds-mainstone.c +++ b/arch/arm/mach-pxa/leds-mainstone.c @@ -16,7 +16,7 @@ #include <asm/leds.h> #include <asm/system.h> -#include <mach/pxa-regs.h> +#include <mach/pxa27x.h> #include <mach/mainstone.h> #include "leds.h" diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c index 31da7f3c06f..e13f6a81c22 100644 --- a/arch/arm/mach-pxa/littleton.c +++ b/arch/arm/mach-pxa/littleton.c @@ -39,8 +39,7 @@ #include <asm/mach/map.h> #include <asm/mach/irq.h> -#include <mach/pxa-regs.h> -#include <mach/mfp-pxa300.h> +#include <mach/pxa300.h> #include <mach/pxafb.h> #include <mach/ssp.h> #include <mach/pxa2xx_spi.h> diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c index de3f67daaac..d64395f26a3 100644 --- a/arch/arm/mach-pxa/lpd270.c +++ b/arch/arm/mach-pxa/lpd270.c @@ -38,9 +38,8 @@ #include <asm/mach/irq.h> #include <asm/mach/flash.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa27x.h> +#include <mach/pxa27x.h> +#include <mach/gpio.h> #include <mach/lpd270.h> #include <mach/audio.h> #include <mach/pxafb.h> diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index bff704354c1..f04c8333dff 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c @@ -41,15 +41,15 @@ #include <asm/hardware/sa1111.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa25x.h> +#include <mach/pxa25x.h> +#include <mach/gpio.h> #include <mach/audio.h> #include <mach/lubbock.h> #include <mach/udc.h> #include <mach/irda.h> #include <mach/pxafb.h> #include <mach/mmc.h> +#include <mach/pm.h> #include "generic.h" #include "clock.h" @@ -113,8 +113,14 @@ static unsigned long lubbock_pin_config[] __initdata = { GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, }; +#define LUB_HEXLED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x010) #define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080) +void lubbock_set_hexled(uint32_t value) +{ + LUB_HEXLED = value; +} + void lubbock_set_misc_wr(unsigned int mask, unsigned int set) { unsigned long flags; diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 21b821e1a60..d46b36746be 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c @@ -25,14 +25,14 @@ #include <linux/mtd/physmap.h> #include <linux/pda_power.h> #include <linux/pwm_backlight.h> +#include <linux/usb/gpio_vbus.h> #include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> + +#include <mach/pxa27x.h> #include <mach/magician.h> -#include <mach/mfp-pxa27x.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> #include <mach/pxafb.h> #include <mach/i2c.h> #include <mach/mmc.h> @@ -66,6 +66,11 @@ static unsigned long magician_pin_config[] __initdata = { GPIO31_I2S_SYNC, GPIO113_I2S_SYSCLK, + /* SSP 1 */ + GPIO23_SSP1_SCLK, + GPIO24_SSP1_SFRM, + GPIO25_SSP1_TXD, + /* SSP 2 */ GPIO19_SSP2_SCLK, GPIO14_SSP2_SFRM, @@ -148,22 +153,31 @@ static struct pxaficp_platform_data magician_ficp_info = { * GPIO Keys */ +#define INIT_KEY(_code, _gpio, _desc) \ + { \ + .code = KEY_##_code, \ + .gpio = _gpio, \ + .desc = _desc, \ + .type = EV_KEY, \ + .wakeup = 1, \ + } + static struct gpio_keys_button magician_button_table[] = { - {KEY_POWER, GPIO0_MAGICIAN_KEY_POWER, 0, "Power button"}, - {KEY_ESC, GPIO37_MAGICIAN_KEY_HANGUP, 0, "Hangup button"}, - {KEY_F10, GPIO38_MAGICIAN_KEY_CONTACTS, 0, "Contacts button"}, - {KEY_CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, 0, "Calendar button"}, - {KEY_CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, 0, "Camera button"}, - {KEY_UP, GPIO93_MAGICIAN_KEY_UP, 0, "Up button"}, - {KEY_DOWN, GPIO94_MAGICIAN_KEY_DOWN, 0, "Down button"}, - {KEY_LEFT, GPIO95_MAGICIAN_KEY_LEFT, 0, "Left button"}, - {KEY_RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, 0, "Right button"}, - {KEY_KPENTER, GPIO97_MAGICIAN_KEY_ENTER, 0, "Action button"}, - {KEY_RECORD, GPIO98_MAGICIAN_KEY_RECORD, 0, "Record button"}, - {KEY_VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, 0, "Volume up"}, - {KEY_VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, 0, "Volume down"}, - {KEY_PHONE, GPIO102_MAGICIAN_KEY_PHONE, 0, "Phone button"}, - {KEY_PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, 0, "Headset button"}, + INIT_KEY(POWER, GPIO0_MAGICIAN_KEY_POWER, "Power button"), + INIT_KEY(ESC, GPIO37_MAGICIAN_KEY_HANGUP, "Hangup button"), + INIT_KEY(F10, GPIO38_MAGICIAN_KEY_CONTACTS, "Contacts button"), + INIT_KEY(CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, "Calendar button"), + INIT_KEY(CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, "Camera button"), + INIT_KEY(UP, GPIO93_MAGICIAN_KEY_UP, "Up button"), + INIT_KEY(DOWN, GPIO94_MAGICIAN_KEY_DOWN, "Down button"), + INIT_KEY(LEFT, GPIO95_MAGICIAN_KEY_LEFT, "Left button"), + INIT_KEY(RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, "Right button"), + INIT_KEY(KPENTER, GPIO97_MAGICIAN_KEY_ENTER, "Action button"), + INIT_KEY(RECORD, GPIO98_MAGICIAN_KEY_RECORD, "Record button"), + INIT_KEY(VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, "Volume up"), + INIT_KEY(VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, "Volume down"), + INIT_KEY(PHONE, GPIO102_MAGICIAN_KEY_PHONE, "Phone button"), + INIT_KEY(PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, "Headset button"), }; static struct gpio_keys_platform_data gpio_keys_data = { @@ -189,7 +203,7 @@ static struct platform_device gpio_keys = { static struct resource egpio_resources[] = { [0] = { .start = PXA_CS3_PHYS, - .end = PXA_CS3_PHYS + 0x20, + .end = PXA_CS3_PHYS + 0x20 - 1, .flags = IORESOURCE_MEM, }, [1] = { @@ -420,7 +434,7 @@ static struct gpio_led gpio_leds[] = { }, { .name = "magician::phone_bl", - .default_trigger = "none", + .default_trigger = "backlight", .gpio = GPIO103_MAGICIAN_LED_KP, }, }; @@ -468,8 +482,6 @@ static struct pasic3_led pasic3_leds[] = { }, }; -static struct platform_device pasic3; - static struct pasic3_leds_machinfo pasic3_leds_info = { .num_leds = ARRAY_SIZE(pasic3_leds), .power_gpio = EGPIO_MAGICIAN_LED_POWER, @@ -511,6 +523,31 @@ static struct platform_device pasic3 = { }; /* + * USB "Transceiver" + */ + +static struct resource gpio_vbus_resource = { + .flags = IORESOURCE_IRQ, + .start = IRQ_MAGICIAN_VBUS, + .end = IRQ_MAGICIAN_VBUS, +}; + +static struct gpio_vbus_mach_info gpio_vbus_info = { + .gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN, + .gpio_vbus = EGPIO_MAGICIAN_CABLE_STATE_USB, +}; + +static struct platform_device gpio_vbus = { + .name = "gpio-vbus", + .id = -1, + .num_resources = 1, + .resource = &gpio_vbus_resource, + .dev = { + .platform_data = &gpio_vbus_info, + }, +}; + +/* * External power */ @@ -586,15 +623,17 @@ static struct pda_power_pdata power_supply_info = { static struct resource power_supply_resources[] = { [0] = { .name = "ac", - .flags = IORESOURCE_IRQ, - .start = IRQ_MAGICIAN_AC, - .end = IRQ_MAGICIAN_AC, + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | + IORESOURCE_IRQ_LOWEDGE, + .start = IRQ_MAGICIAN_VBUS, + .end = IRQ_MAGICIAN_VBUS, }, [1] = { .name = "usb", - .flags = IORESOURCE_IRQ, - .start = IRQ_MAGICIAN_AC, - .end = IRQ_MAGICIAN_AC, + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | + IORESOURCE_IRQ_LOWEDGE, + .start = IRQ_MAGICIAN_VBUS, + .end = IRQ_MAGICIAN_VBUS, }, }; @@ -688,11 +727,9 @@ static void magician_set_vpp(struct map_info *map, int vpp) gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); } -#define PXA_CS_SIZE 0x04000000 - static struct resource strataflash_resource = { .start = PXA_CS0_PHYS, - .end = PXA_CS0_PHYS + PXA_CS_SIZE - 1, + .end = PXA_CS0_PHYS + SZ_64M - 1, .flags = IORESOURCE_MEM, }; @@ -720,6 +757,7 @@ static struct platform_device *devices[] __initdata = { &egpio, &backlight, &pasic3, + &gpio_vbus, &power_supply, &strataflash, &leds_gpio, @@ -743,6 +781,7 @@ static void __init magician_init(void) gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1); pxa_set_ficp_info(&magician_ficp_info); } + pxa27x_set_i2c_power_info(NULL); pxa_set_i2c_info(NULL); pxa_set_mci_info(&magician_mci_info); pxa_set_ohci_info(&magician_ohci_info); diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 5f224968043..a6c8429e975 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c @@ -41,9 +41,8 @@ #include <asm/mach/irq.h> #include <asm/mach/flash.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa27x.h> +#include <mach/pxa27x.h> +#include <mach/gpio.h> #include <mach/mainstone.h> #include <mach/audio.h> #include <mach/pxafb.h> diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c index 33626de8cbf..7ffb91d64c3 100644 --- a/arch/arm/mach-pxa/mfp-pxa2xx.c +++ b/arch/arm/mach-pxa/mfp-pxa2xx.c @@ -18,15 +18,12 @@ #include <linux/init.h> #include <linux/sysdev.h> -#include <mach/hardware.h> -#include <mach/pxa-regs.h> +#include <mach/gpio.h> #include <mach/pxa2xx-regs.h> #include <mach/mfp-pxa2xx.h> #include "generic.h" -#define gpio_to_bank(gpio) ((gpio) >> 5) - #define PGSR(x) __REG2(0x40F00020, (x) << 2) #define __GAFR(u, x) __REG2((u) ? 0x40E00058 : 0x40E00054, (x) << 3) #define GAFR_L(x) __GAFR(0, x) diff --git a/arch/arm/mach-pxa/mfp-pxa3xx.c b/arch/arm/mach-pxa/mfp-pxa3xx.c index eb197a6e8e9..7a270eecd48 100644 --- a/arch/arm/mach-pxa/mfp-pxa3xx.c +++ b/arch/arm/mach-pxa/mfp-pxa3xx.c @@ -20,183 +20,9 @@ #include <linux/sysdev.h> #include <mach/hardware.h> -#include <mach/mfp.h> #include <mach/mfp-pxa3xx.h> #include <mach/pxa3xx-regs.h> -/* mfp_spin_lock is used to ensure that MFP register configuration - * (most likely a read-modify-write operation) is atomic, and that - * mfp_table[] is consistent - */ -static DEFINE_SPINLOCK(mfp_spin_lock); - -static void __iomem *mfpr_mmio_base = (void __iomem *)&__REG(MFPR_BASE); - -struct pxa3xx_mfp_pin { - unsigned long config; /* -1 for not configured */ - unsigned long mfpr_off; /* MFPRxx Register offset */ - unsigned long mfpr_run; /* Run-Mode Register Value */ - unsigned long mfpr_lpm; /* Low Power Mode Register Value */ -}; - -static struct pxa3xx_mfp_pin mfp_table[MFP_PIN_MAX]; - -/* mapping of MFP_LPM_* definitions to MFPR_LPM_* register bits */ -static const unsigned long mfpr_lpm[] = { - MFPR_LPM_INPUT, - MFPR_LPM_DRIVE_LOW, - MFPR_LPM_DRIVE_HIGH, - MFPR_LPM_PULL_LOW, - MFPR_LPM_PULL_HIGH, - MFPR_LPM_FLOAT, -}; - -/* mapping of MFP_PULL_* definitions to MFPR_PULL_* register bits */ -static const unsigned long mfpr_pull[] = { - MFPR_PULL_NONE, - MFPR_PULL_LOW, - MFPR_PULL_HIGH, - MFPR_PULL_BOTH, -}; - -/* mapping of MFP_LPM_EDGE_* definitions to MFPR_EDGE_* register bits */ -static const unsigned long mfpr_edge[] = { - MFPR_EDGE_NONE, - MFPR_EDGE_RISE, - MFPR_EDGE_FALL, - MFPR_EDGE_BOTH, -}; - -#define mfpr_readl(off) \ - __raw_readl(mfpr_mmio_base + (off)) - -#define mfpr_writel(off, val) \ - __raw_writel(val, mfpr_mmio_base + (off)) - -#define mfp_configured(p) ((p)->config != -1) - -/* - * perform a read-back of any MFPR register to make sure the - * previous writings are finished - */ -#define mfpr_sync() (void)__raw_readl(mfpr_mmio_base + 0) - -static inline void __mfp_config_run(struct pxa3xx_mfp_pin *p) -{ - if (mfp_configured(p)) - mfpr_writel(p->mfpr_off, p->mfpr_run); -} - -static inline void __mfp_config_lpm(struct pxa3xx_mfp_pin *p) -{ - if (mfp_configured(p)) { - unsigned long mfpr_clr = (p->mfpr_run & ~MFPR_EDGE_BOTH) | MFPR_EDGE_CLEAR; - if (mfpr_clr != p->mfpr_run) - mfpr_writel(p->mfpr_off, mfpr_clr); - if (p->mfpr_lpm != mfpr_clr) - mfpr_writel(p->mfpr_off, p->mfpr_lpm); - } -} - -void pxa3xx_mfp_config(unsigned long *mfp_cfgs, int num) -{ - unsigned long flags; - int i; - - spin_lock_irqsave(&mfp_spin_lock, flags); - - for (i = 0; i < num; i++, mfp_cfgs++) { - unsigned long tmp, c = *mfp_cfgs; - struct pxa3xx_mfp_pin *p; - int pin, af, drv, lpm, edge, pull; - - pin = MFP_PIN(c); - BUG_ON(pin >= MFP_PIN_MAX); - p = &mfp_table[pin]; - - af = MFP_AF(c); - drv = MFP_DS(c); - lpm = MFP_LPM_STATE(c); - edge = MFP_LPM_EDGE(c); - pull = MFP_PULL(c); - - /* run-mode pull settings will conflict with MFPR bits of - * low power mode state, calculate mfpr_run and mfpr_lpm - * individually if pull != MFP_PULL_NONE - */ - tmp = MFPR_AF_SEL(af) | MFPR_DRIVE(drv); - - if (likely(pull == MFP_PULL_NONE)) { - p->mfpr_run = tmp | mfpr_lpm[lpm] | mfpr_edge[edge]; - p->mfpr_lpm = p->mfpr_run; - } else { - p->mfpr_lpm = tmp | mfpr_lpm[lpm] | mfpr_edge[edge]; - p->mfpr_run = tmp | mfpr_pull[pull]; - } - - p->config = c; __mfp_config_run(p); - } - - mfpr_sync(); - spin_unlock_irqrestore(&mfp_spin_lock, flags); -} - -unsigned long pxa3xx_mfp_read(int mfp) -{ - unsigned long val, flags; - - BUG_ON(mfp >= MFP_PIN_MAX); - - spin_lock_irqsave(&mfp_spin_lock, flags); - val = mfpr_readl(mfp_table[mfp].mfpr_off); - spin_unlock_irqrestore(&mfp_spin_lock, flags); - - return val; -} - -void pxa3xx_mfp_write(int mfp, unsigned long val) -{ - unsigned long flags; - - BUG_ON(mfp >= MFP_PIN_MAX); - - spin_lock_irqsave(&mfp_spin_lock, flags); - mfpr_writel(mfp_table[mfp].mfpr_off, val); - mfpr_sync(); - spin_unlock_irqrestore(&mfp_spin_lock, flags); -} - -void __init pxa3xx_mfp_init_addr(struct pxa3xx_mfp_addr_map *map) -{ - struct pxa3xx_mfp_addr_map *p; - unsigned long offset, flags; - int i; - - spin_lock_irqsave(&mfp_spin_lock, flags); - - for (p = map; p->start != MFP_PIN_INVALID; p++) { - offset = p->offset; - i = p->start; - - do { - mfp_table[i].mfpr_off = offset; - mfp_table[i].mfpr_run = 0; - mfp_table[i].mfpr_lpm = 0; - offset += 4; i++; - } while ((i <= p->end) && (p->end != -1)); - } - - spin_unlock_irqrestore(&mfp_spin_lock, flags); -} - -void __init pxa3xx_init_mfp(void) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(mfp_table); i++) - mfp_table[i].config = -1; -} - #ifdef CONFIG_PM /* * Configure the MFPs appropriately for suspend/resume. @@ -207,23 +33,13 @@ void __init pxa3xx_init_mfp(void) */ static int pxa3xx_mfp_suspend(struct sys_device *d, pm_message_t state) { - int pin; - - for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++) { - struct pxa3xx_mfp_pin *p = &mfp_table[pin]; - __mfp_config_lpm(p); - } + mfp_config_lpm(); return 0; } static int pxa3xx_mfp_resume(struct sys_device *d) { - int pin; - - for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++) { - struct pxa3xx_mfp_pin *p = &mfp_table[pin]; - __mfp_config_run(p); - } + mfp_config_run(); /* clear RDH bit when MFP settings are restored * @@ -231,7 +47,6 @@ static int pxa3xx_mfp_resume(struct sys_device *d) * preserve them here in case they will be referenced later */ ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); - return 0; } #else diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index 2b427e015b6..97c93a7a285 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c @@ -36,13 +36,15 @@ #include <linux/power_supply.h> #include <linux/wm97xx_batt.h> #include <linux/mtd/physmap.h> +#include <linux/usb/gpio_vbus.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> -#include <mach/mfp-pxa27x.h> + +#include <mach/pxa27x.h> +#include <mach/regs-rtc.h> #include <mach/pxa27x_keypad.h> #include <mach/pxafb.h> -#include <mach/pxa2xx-regs.h> #include <mach/mmc.h> #include <mach/udc.h> #include <mach/pxa27x-udc.h> @@ -411,21 +413,6 @@ static void gsm_exit(void) /* * USB UDC */ -static void udc_power_command(int cmd) -{ - switch (cmd) { - case PXA2XX_UDC_CMD_DISCONNECT: - gpio_set_value(GPIO22_USB_ENABLE, 0); - break; - case PXA2XX_UDC_CMD_CONNECT: - gpio_set_value(GPIO22_USB_ENABLE, 1); - break; - default: - printk(KERN_INFO "udc_control: unknown command (0x%x)!\n", cmd); - break; - } -} - static int is_usb_connected(void) { return !gpio_get_value(GPIO13_nUSB_DETECT); @@ -433,24 +420,15 @@ static int is_usb_connected(void) static struct pxa2xx_udc_mach_info mioa701_udc_info = { .udc_is_connected = is_usb_connected, - .udc_command = udc_power_command, + .gpio_pullup = GPIO22_USB_ENABLE, }; -struct gpio_ress udc_gpios[] = { - MIO_GPIO_OUT(GPIO22_USB_ENABLE, 0, "USB Vbus enable") +struct gpio_vbus_mach_info gpio_vbus_data = { + .gpio_vbus = GPIO13_nUSB_DETECT, + .gpio_vbus_inverted = 1, + .gpio_pullup = -1, }; -static int __init udc_init(void) -{ - pxa_set_udc_info(&mioa701_udc_info); - return mio_gpio_request(ARRAY_AND_SIZE(udc_gpios)); -} - -static void udc_exit(void) -{ - mio_gpio_free(ARRAY_AND_SIZE(udc_gpios)); -} - /* * SDIO/MMC Card controller */ @@ -789,6 +767,7 @@ MIO_SIMPLE_DEV(pxa2xx_ac97, "pxa2xx-ac97", NULL) MIO_PARENT_DEV(mio_wm9713_codec, "wm9713-codec", &pxa2xx_ac97.dev, NULL) MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) +MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); static struct platform_device *devices[] __initdata = { &mioa701_gpio_keys, @@ -800,7 +779,8 @@ static struct platform_device *devices[] __initdata = { &mioa701_sound, &power_dev, &strataflash, - &mioa701_board + &gpio_vbus, + &mioa701_board, }; static void mioa701_machine_exit(void); @@ -808,13 +788,13 @@ static void mioa701_machine_exit(void); static void mioa701_poweroff(void) { mioa701_machine_exit(); - arm_machine_restart('s'); + arm_machine_restart('s', NULL); } -static void mioa701_restart(char c) +static void mioa701_restart(char c, const char *cmd) { mioa701_machine_exit(); - arm_machine_restart('s'); + arm_machine_restart('s', cmd); } struct gpio_ress global_gpios[] = { @@ -837,7 +817,7 @@ static void __init mioa701_machine_init(void) pxa_set_mci_info(&mioa701_mci_info); pxa_set_keypad_info(&mioa701_keypad_info); wm97xx_bat_set_pdata(&mioa701_battery_data); - udc_init(); + pxa_set_udc_info(&mioa701_udc_info); pm_power_off = mioa701_poweroff; arm_pm_restart = mioa701_restart; platform_add_devices(devices, ARRAY_SIZE(devices)); @@ -850,7 +830,6 @@ static void __init mioa701_machine_init(void) static void mioa701_machine_exit(void) { - udc_exit(); bootstrap_exit(); gsm_exit(); } diff --git a/arch/arm/mach-pxa/mp900.c b/arch/arm/mach-pxa/mp900.c index 8a73814126b..a65713ce019 100644 --- a/arch/arm/mach-pxa/mp900.c +++ b/arch/arm/mach-pxa/mp900.c @@ -19,10 +19,10 @@ #include <linux/types.h> #include <linux/usb/isp116x.h> -#include <mach/hardware.h> -#include <mach/pxa-regs.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> + +#include <mach/pxa25x.h> #include "generic.h" static void isp116x_pfm_delay(struct device *dev, int delay) diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c new file mode 100644 index 00000000000..8587477a9bb --- /dev/null +++ b/arch/arm/mach-pxa/palmld.c @@ -0,0 +1,565 @@ +/* + * Hardware definitions for Palm LifeDrive + * + * Author: Marek Vasut <marek.vasut@gmail.com> + * + * Based on work of: + * Alex Osborne <ato@meshy.org> + * + * 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. + * + * (find more info at www.hackndev.com) + * + */ + +#include <linux/platform_device.h> +#include <linux/delay.h> +#include <linux/irq.h> +#include <linux/gpio_keys.h> +#include <linux/input.h> +#include <linux/pda_power.h> +#include <linux/pwm_backlight.h> +#include <linux/gpio.h> +#include <linux/wm97xx_batt.h> +#include <linux/power_supply.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> + +#include <mach/pxa27x.h> +#include <mach/audio.h> +#include <mach/palmld.h> +#include <mach/mmc.h> +#include <mach/pxafb.h> +#include <mach/irda.h> +#include <mach/pxa27x_keypad.h> +#include <mach/palmasoc.h> + +#include "generic.h" +#include "devices.h" + +/****************************************************************************** + * Pin configuration + ******************************************************************************/ +static unsigned long palmld_pin_config[] __initdata = { + /* MMC */ + GPIO32_MMC_CLK, + GPIO92_MMC_DAT_0, + GPIO109_MMC_DAT_1, + GPIO110_MMC_DAT_2, + GPIO111_MMC_DAT_3, + GPIO112_MMC_CMD, + GPIO14_GPIO, /* SD detect */ + GPIO114_GPIO, /* SD power */ + GPIO116_GPIO, /* SD r/o switch */ + + /* AC97 */ + GPIO28_AC97_BITCLK, + GPIO29_AC97_SDATA_IN_0, + GPIO30_AC97_SDATA_OUT, + GPIO31_AC97_SYNC, + + /* IrDA */ + GPIO108_GPIO, /* ir disable */ + GPIO46_FICP_RXD, + GPIO47_FICP_TXD, + + /* MATRIX KEYPAD */ + GPIO100_KP_MKIN_0, + GPIO101_KP_MKIN_1, + GPIO102_KP_MKIN_2, + GPIO97_KP_MKIN_3, + GPIO103_KP_MKOUT_0, + GPIO104_KP_MKOUT_1, + GPIO105_KP_MKOUT_2, + + /* LCD */ + GPIO58_LCD_LDD_0, + GPIO59_LCD_LDD_1, + GPIO60_LCD_LDD_2, + GPIO61_LCD_LDD_3, + GPIO62_LCD_LDD_4, + GPIO63_LCD_LDD_5, + GPIO64_LCD_LDD_6, + GPIO65_LCD_LDD_7, + GPIO66_LCD_LDD_8, + GPIO67_LCD_LDD_9, + GPIO68_LCD_LDD_10, + GPIO69_LCD_LDD_11, + GPIO70_LCD_LDD_12, + GPIO71_LCD_LDD_13, + GPIO72_LCD_LDD_14, + GPIO73_LCD_LDD_15, + GPIO74_LCD_FCLK, + GPIO75_LCD_LCLK, + GPIO76_LCD_PCLK, + GPIO77_LCD_BIAS, + + /* PWM */ + GPIO16_PWM0_OUT, + + /* GPIO KEYS */ + GPIO10_GPIO, /* hotsync button */ + GPIO12_GPIO, /* power switch */ + GPIO15_GPIO, /* lock switch */ + + /* LEDs */ + GPIO52_GPIO, /* green led */ + GPIO94_GPIO, /* orange led */ + + /* PCMCIA */ + GPIO48_nPOE, + GPIO49_nPWE, + GPIO50_nPIOR, + GPIO51_nPIOW, + GPIO85_nPCE_1, + GPIO54_nPCE_2, + GPIO79_PSKTSEL, + GPIO55_nPREG, + GPIO56_nPWAIT, + GPIO57_nIOIS16, + GPIO36_GPIO, /* wifi power */ + GPIO38_GPIO, /* wifi ready */ + GPIO81_GPIO, /* wifi reset */ + + /* HDD */ + GPIO95_GPIO, /* HDD irq */ + GPIO115_GPIO, /* HDD power */ + + /* MISC */ + GPIO13_GPIO, /* earphone detect */ +}; + +/****************************************************************************** + * SD/MMC card controller + ******************************************************************************/ +static int palmld_mci_init(struct device *dev, irq_handler_t palmld_detect_int, + void *data) +{ + int err = 0; + + /* Setup an interrupt for detecting card insert/remove events */ + err = gpio_request(GPIO_NR_PALMLD_SD_DETECT_N, "SD IRQ"); + if (err) + goto err; + err = gpio_direction_input(GPIO_NR_PALMLD_SD_DETECT_N); + if (err) + goto err2; + err = request_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), + palmld_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, + "SD/MMC card detect", data); + if (err) { + printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", + __func__); + goto err2; + } + + err = gpio_request(GPIO_NR_PALMLD_SD_POWER, "SD_POWER"); + if (err) + goto err3; + err = gpio_direction_output(GPIO_NR_PALMLD_SD_POWER, 0); + if (err) + goto err4; + + err = gpio_request(GPIO_NR_PALMLD_SD_READONLY, "SD_READONLY"); + if (err) + goto err4; + err = gpio_direction_input(GPIO_NR_PALMLD_SD_READONLY); + if (err) + goto err5; + + printk(KERN_DEBUG "%s: irq registered\n", __func__); + + return 0; + +err5: + gpio_free(GPIO_NR_PALMLD_SD_READONLY); +err4: + gpio_free(GPIO_NR_PALMLD_SD_POWER); +err3: + free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data); +err2: + gpio_free(GPIO_NR_PALMLD_SD_DETECT_N); +err: + return err; +} + +static void palmld_mci_exit(struct device *dev, void *data) +{ + gpio_free(GPIO_NR_PALMLD_SD_READONLY); + gpio_free(GPIO_NR_PALMLD_SD_POWER); + free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data); + gpio_free(GPIO_NR_PALMLD_SD_DETECT_N); +} + +static void palmld_mci_power(struct device *dev, unsigned int vdd) +{ + struct pxamci_platform_data *p_d = dev->platform_data; + gpio_set_value(GPIO_NR_PALMLD_SD_POWER, p_d->ocr_mask & (1 << vdd)); +} + +static int palmld_mci_get_ro(struct device *dev) +{ + return gpio_get_value(GPIO_NR_PALMLD_SD_READONLY); +} + +static struct pxamci_platform_data palmld_mci_platform_data = { + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, + .setpower = palmld_mci_power, + .get_ro = palmld_mci_get_ro, + .init = palmld_mci_init, + .exit = palmld_mci_exit, +}; + +/****************************************************************************** + * GPIO keyboard + ******************************************************************************/ +static unsigned int palmld_matrix_keys[] = { + KEY(0, 1, KEY_F2), + KEY(0, 2, KEY_UP), + + KEY(1, 0, KEY_F3), + KEY(1, 1, KEY_F4), + KEY(1, 2, KEY_RIGHT), + + KEY(2, 0, KEY_F1), + KEY(2, 1, KEY_F5), + KEY(2, 2, KEY_DOWN), + + KEY(3, 0, KEY_F6), + KEY(3, 1, KEY_ENTER), + KEY(3, 2, KEY_LEFT), +}; + +static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = { + .matrix_key_rows = 4, + .matrix_key_cols = 3, + .matrix_key_map = palmld_matrix_keys, + .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys), + + .debounce_interval = 30, +}; + +/****************************************************************************** + * GPIO keys + ******************************************************************************/ +static struct gpio_keys_button palmld_pxa_buttons[] = { + {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, + {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" }, + {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" }, +}; + +static struct gpio_keys_platform_data palmld_pxa_keys_data = { + .buttons = palmld_pxa_buttons, + .nbuttons = ARRAY_SIZE(palmld_pxa_buttons), +}; + +static struct platform_device palmld_pxa_keys = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &palmld_pxa_keys_data, + }, +}; + +/****************************************************************************** + * Backlight + ******************************************************************************/ +static int palmld_backlight_init(struct device *dev) +{ + int ret; + + ret = gpio_request(GPIO_NR_PALMLD_BL_POWER, "BL POWER"); + if (ret) + goto err; + ret = gpio_direction_output(GPIO_NR_PALMLD_BL_POWER, 0); + if (ret) + goto err2; + ret = gpio_request(GPIO_NR_PALMLD_LCD_POWER, "LCD POWER"); + if (ret) + goto err2; + ret = gpio_direction_output(GPIO_NR_PALMLD_LCD_POWER, 0); + if (ret) + goto err3; + + return 0; +err3: + gpio_free(GPIO_NR_PALMLD_LCD_POWER); +err2: + gpio_free(GPIO_NR_PALMLD_BL_POWER); +err: + return ret; +} + +static int palmld_backlight_notify(int brightness) +{ + gpio_set_value(GPIO_NR_PALMLD_BL_POWER, brightness); + gpio_set_value(GPIO_NR_PALMLD_LCD_POWER, brightness); + return brightness; +} + +static void palmld_backlight_exit(struct device *dev) +{ + gpio_free(GPIO_NR_PALMLD_BL_POWER); + gpio_free(GPIO_NR_PALMLD_LCD_POWER); +} + +static struct platform_pwm_backlight_data palmld_backlight_data = { + .pwm_id = 0, + .max_brightness = PALMLD_MAX_INTENSITY, + .dft_brightness = PALMLD_MAX_INTENSITY, + .pwm_period_ns = PALMLD_PERIOD_NS, + .init = palmld_backlight_init, + .notify = palmld_backlight_notify, + .exit = palmld_backlight_exit, +}; + +static struct platform_device palmld_backlight = { + .name = "pwm-backlight", + .dev = { + .parent = &pxa27x_device_pwm0.dev, + .platform_data = &palmld_backlight_data, + }, +}; + +/****************************************************************************** + * IrDA + ******************************************************************************/ +static int palmld_irda_startup(struct device *dev) +{ + int err; + err = gpio_request(GPIO_NR_PALMLD_IR_DISABLE, "IR DISABLE"); + if (err) + goto err; + err = gpio_direction_output(GPIO_NR_PALMLD_IR_DISABLE, 1); + if (err) + gpio_free(GPIO_NR_PALMLD_IR_DISABLE); +err: + return err; +} + +static void palmld_irda_shutdown(struct device *dev) +{ + gpio_free(GPIO_NR_PALMLD_IR_DISABLE); +} + +static void palmld_irda_transceiver_mode(struct device *dev, int mode) +{ + gpio_set_value(GPIO_NR_PALMLD_IR_DISABLE, mode & IR_OFF); + pxa2xx_transceiver_mode(dev, mode); +} + +static struct pxaficp_platform_data palmld_ficp_platform_data = { + .startup = palmld_irda_startup, + .shutdown = palmld_irda_shutdown, + .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, + .transceiver_mode = palmld_irda_transceiver_mode, +}; + +/****************************************************************************** + * LEDs + ******************************************************************************/ +struct gpio_led gpio_leds[] = { +{ + .name = "palmld:green:led", + .default_trigger = "none", + .gpio = GPIO_NR_PALMLD_LED_GREEN, +}, { + .name = "palmld:amber:led", + .default_trigger = "none", + .gpio = GPIO_NR_PALMLD_LED_AMBER, +}, +}; + +static struct gpio_led_platform_data gpio_led_info = { + .leds = gpio_leds, + .num_leds = ARRAY_SIZE(gpio_leds), +}; + +static struct platform_device palmld_leds = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &gpio_led_info, + } +}; + +/****************************************************************************** + * Power supply + ******************************************************************************/ +static int power_supply_init(struct device *dev) +{ + int ret; + + ret = gpio_request(GPIO_NR_PALMLD_POWER_DETECT, "CABLE_STATE_AC"); + if (ret) + goto err1; + ret = gpio_direction_input(GPIO_NR_PALMLD_POWER_DETECT); + if (ret) + goto err2; + + ret = gpio_request(GPIO_NR_PALMLD_USB_DETECT_N, "CABLE_STATE_USB"); + if (ret) + goto err2; + ret = gpio_direction_input(GPIO_NR_PALMLD_USB_DETECT_N); + if (ret) + goto err3; + + return 0; + +err3: + gpio_free(GPIO_NR_PALMLD_USB_DETECT_N); +err2: + gpio_free(GPIO_NR_PALMLD_POWER_DETECT); +err1: + return ret; +} + +static int palmld_is_ac_online(void) +{ + return gpio_get_value(GPIO_NR_PALMLD_POWER_DETECT); +} + +static int palmld_is_usb_online(void) +{ + return !gpio_get_value(GPIO_NR_PALMLD_USB_DETECT_N); +} + +static void power_supply_exit(struct device *dev) +{ + gpio_free(GPIO_NR_PALMLD_USB_DETECT_N); + gpio_free(GPIO_NR_PALMLD_POWER_DETECT); +} + +static char *palmld_supplicants[] = { + "main-battery", +}; + +static struct pda_power_pdata power_supply_info = { + .init = power_supply_init, + .is_ac_online = palmld_is_ac_online, + .is_usb_online = palmld_is_usb_online, + .exit = power_supply_exit, + .supplied_to = palmld_supplicants, + .num_supplicants = ARRAY_SIZE(palmld_supplicants), +}; + +static struct platform_device power_supply = { + .name = "pda-power", + .id = -1, + .dev = { + .platform_data = &power_supply_info, + }, +}; + +/****************************************************************************** + * WM97xx battery + ******************************************************************************/ +static struct wm97xx_batt_info wm97xx_batt_pdata = { + .batt_aux = WM97XX_AUX_ID3, + .temp_aux = WM97XX_AUX_ID2, + .charge_gpio = -1, + .max_voltage = PALMLD_BAT_MAX_VOLTAGE, + .min_voltage = PALMLD_BAT_MIN_VOLTAGE, + .batt_mult = 1000, + .batt_div = 414, + .temp_mult = 1, + .temp_div = 1, + .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, + .batt_name = "main-batt", +}; + +/****************************************************************************** + * aSoC audio + ******************************************************************************/ +static struct palm27x_asoc_info palm27x_asoc_pdata = { + .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT, +}; + +/****************************************************************************** + * Framebuffer + ******************************************************************************/ +static struct pxafb_mode_info palmld_lcd_modes[] = { +{ + .pixclock = 57692, + .xres = 320, + .yres = 480, + .bpp = 16, + + .left_margin = 32, + .right_margin = 1, + .upper_margin = 7, + .lower_margin = 1, + + .hsync_len = 4, + .vsync_len = 1, +}, +}; + +static struct pxafb_mach_info palmld_lcd_screen = { + .modes = palmld_lcd_modes, + .num_modes = ARRAY_SIZE(palmld_lcd_modes), + .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, +}; + +/****************************************************************************** + * Machine init + ******************************************************************************/ +static struct platform_device *devices[] __initdata = { +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) + &palmld_pxa_keys, +#endif + &palmld_backlight, + &palmld_leds, + &power_supply, +}; + +static struct map_desc palmld_io_desc[] __initdata = { +{ + .virtual = PALMLD_IDE_VIRT, + .pfn = __phys_to_pfn(PALMLD_IDE_PHYS), + .length = PALMLD_IDE_SIZE, + .type = MT_DEVICE +}, +{ + .virtual = PALMLD_USB_VIRT, + .pfn = __phys_to_pfn(PALMLD_USB_PHYS), + .length = PALMLD_USB_SIZE, + .type = MT_DEVICE +}, +}; + +static void __init palmld_map_io(void) +{ + pxa_map_io(); + iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc)); +} + +static void __init palmld_init(void) +{ + pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config)); + + set_pxa_fb_info(&palmld_lcd_screen); + pxa_set_mci_info(&palmld_mci_platform_data); + pxa_set_ac97_info(NULL); + pxa_set_ficp_info(&palmld_ficp_platform_data); + pxa_set_keypad_info(&palmld_keypad_platform_data); + wm97xx_bat_set_pdata(&wm97xx_batt_pdata); + palm27x_asoc_set_pdata(&palm27x_asoc_pdata); + + platform_add_devices(devices, ARRAY_SIZE(devices)); +} + +MACHINE_START(PALMLD, "Palm LifeDrive") + .phys_io = PALMLD_PHYS_IO_START, + .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, + .boot_params = 0xa0000100, + .map_io = palmld_map_io, + .init_irq = pxa27x_init_irq, + .timer = &pxa_timer, + .init_machine = palmld_init +MACHINE_END diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c new file mode 100644 index 00000000000..9521c7b3349 --- /dev/null +++ b/arch/arm/mach-pxa/palmt5.c @@ -0,0 +1,496 @@ +/* + * Hardware definitions for Palm Tungsten|T5 + * + * Author: Marek Vasut <marek.vasut@gmail.com> + * + * Based on work of: + * Ales Snuparek <snuparek@atlas.cz> + * Justin Kendrick <twilightsentry@gmail.com> + * RichardT5 <richard_t5@users.sourceforge.net> + * + * 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. + * + * (find more info at www.hackndev.com) + * + */ + +#include <linux/platform_device.h> +#include <linux/delay.h> +#include <linux/irq.h> +#include <linux/gpio_keys.h> +#include <linux/input.h> +#include <linux/pda_power.h> +#include <linux/pwm_backlight.h> +#include <linux/gpio.h> +#include <linux/wm97xx_batt.h> +#include <linux/power_supply.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> + +#include <mach/pxa27x.h> +#include <mach/audio.h> +#include <mach/palmt5.h> +#include <mach/mmc.h> +#include <mach/pxafb.h> +#include <mach/irda.h> +#include <mach/pxa27x_keypad.h> +#include <mach/udc.h> +#include <mach/palmasoc.h> + +#include "generic.h" +#include "devices.h" + +/****************************************************************************** + * Pin configuration + ******************************************************************************/ +static unsigned long palmt5_pin_config[] __initdata = { + /* MMC */ + GPIO32_MMC_CLK, + GPIO92_MMC_DAT_0, + GPIO109_MMC_DAT_1, + GPIO110_MMC_DAT_2, + GPIO111_MMC_DAT_3, + GPIO112_MMC_CMD, + GPIO14_GPIO, /* SD detect */ + GPIO114_GPIO, /* SD power */ + GPIO115_GPIO, /* SD r/o switch */ + + /* AC97 */ + GPIO28_AC97_BITCLK, + GPIO29_AC97_SDATA_IN_0, + GPIO30_AC97_SDATA_OUT, + GPIO31_AC97_SYNC, + + /* IrDA */ + GPIO40_GPIO, /* ir disable */ + GPIO46_FICP_RXD, + GPIO47_FICP_TXD, + + /* USB */ + GPIO15_GPIO, /* usb detect */ + GPIO95_GPIO, /* usb power */ + + /* MATRIX KEYPAD */ + GPIO100_KP_MKIN_0, + GPIO101_KP_MKIN_1, + GPIO102_KP_MKIN_2, + GPIO97_KP_MKIN_3, + GPIO103_KP_MKOUT_0, + GPIO104_KP_MKOUT_1, + GPIO105_KP_MKOUT_2, + + /* LCD */ + GPIO58_LCD_LDD_0, + GPIO59_LCD_LDD_1, + GPIO60_LCD_LDD_2, + GPIO61_LCD_LDD_3, + GPIO62_LCD_LDD_4, + GPIO63_LCD_LDD_5, + GPIO64_LCD_LDD_6, + GPIO65_LCD_LDD_7, + GPIO66_LCD_LDD_8, + GPIO67_LCD_LDD_9, + GPIO68_LCD_LDD_10, + GPIO69_LCD_LDD_11, + GPIO70_LCD_LDD_12, + GPIO71_LCD_LDD_13, + GPIO72_LCD_LDD_14, + GPIO73_LCD_LDD_15, + GPIO74_LCD_FCLK, + GPIO75_LCD_LCLK, + GPIO76_LCD_PCLK, + GPIO77_LCD_BIAS, + + /* PWM */ + GPIO16_PWM0_OUT, + + /* MISC */ + GPIO10_GPIO, /* hotsync button */ + GPIO90_GPIO, /* power detect */ + GPIO107_GPIO, /* earphone detect */ +}; + +/****************************************************************************** + * SD/MMC card controller + ******************************************************************************/ +static int palmt5_mci_init(struct device *dev, irq_handler_t palmt5_detect_int, + void *data) +{ + int err = 0; + + /* Setup an interrupt for detecting card insert/remove events */ + err = gpio_request(GPIO_NR_PALMT5_SD_DETECT_N, "SD IRQ"); + if (err) + goto err; + err = gpio_direction_input(GPIO_NR_PALMT5_SD_DETECT_N); + if (err) + goto err2; + err = request_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), + palmt5_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, + "SD/MMC card detect", data); + if (err) { + printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", + __func__); + goto err2; + } + + err = gpio_request(GPIO_NR_PALMT5_SD_POWER, "SD_POWER"); + if (err) + goto err3; + err = gpio_direction_output(GPIO_NR_PALMT5_SD_POWER, 0); + if (err) + goto err4; + + err = gpio_request(GPIO_NR_PALMT5_SD_READONLY, "SD_READONLY"); + if (err) + goto err4; + err = gpio_direction_input(GPIO_NR_PALMT5_SD_READONLY); + if (err) + goto err5; + + printk(KERN_DEBUG "%s: irq registered\n", __func__); + + return 0; + +err5: + gpio_free(GPIO_NR_PALMT5_SD_READONLY); +err4: + gpio_free(GPIO_NR_PALMT5_SD_POWER); +err3: + free_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), data); +err2: + gpio_free(GPIO_NR_PALMT5_SD_DETECT_N); +err: + return err; +} + +static void palmt5_mci_exit(struct device *dev, void *data) +{ + gpio_free(GPIO_NR_PALMT5_SD_READONLY); + gpio_free(GPIO_NR_PALMT5_SD_POWER); + free_irq(IRQ_GPIO_PALMT5_SD_DETECT_N, data); + gpio_free(GPIO_NR_PALMT5_SD_DETECT_N); +} + +static void palmt5_mci_power(struct device *dev, unsigned int vdd) +{ + struct pxamci_platform_data *p_d = dev->platform_data; + gpio_set_value(GPIO_NR_PALMT5_SD_POWER, p_d->ocr_mask & (1 << vdd)); +} + +static int palmt5_mci_get_ro(struct device *dev) +{ + return gpio_get_value(GPIO_NR_PALMT5_SD_READONLY); +} + +static struct pxamci_platform_data palmt5_mci_platform_data = { + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, + .setpower = palmt5_mci_power, + .get_ro = palmt5_mci_get_ro, + .init = palmt5_mci_init, + .exit = palmt5_mci_exit, +}; + +/****************************************************************************** + * GPIO keyboard + ******************************************************************************/ +static unsigned int palmt5_matrix_keys[] = { + KEY(0, 0, KEY_POWER), + KEY(0, 1, KEY_F1), + KEY(0, 2, KEY_ENTER), + + KEY(1, 0, KEY_F2), + KEY(1, 1, KEY_F3), + KEY(1, 2, KEY_F4), + + KEY(2, 0, KEY_UP), + KEY(2, 2, KEY_DOWN), + + KEY(3, 0, KEY_RIGHT), + KEY(3, 2, KEY_LEFT), +}; + +static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { + .matrix_key_rows = 4, + .matrix_key_cols = 3, + .matrix_key_map = palmt5_matrix_keys, + .matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys), + + .debounce_interval = 30, +}; + +/****************************************************************************** + * GPIO keys + ******************************************************************************/ +static struct gpio_keys_button palmt5_pxa_buttons[] = { + {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, +}; + +static struct gpio_keys_platform_data palmt5_pxa_keys_data = { + .buttons = palmt5_pxa_buttons, + .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons), +}; + +static struct platform_device palmt5_pxa_keys = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &palmt5_pxa_keys_data, + }, +}; + +/****************************************************************************** + * Backlight + ******************************************************************************/ +static int palmt5_backlight_init(struct device *dev) +{ + int ret; + + ret = gpio_request(GPIO_NR_PALMT5_BL_POWER, "BL POWER"); + if (ret) + goto err; + ret = gpio_direction_output(GPIO_NR_PALMT5_BL_POWER, 0); + if (ret) + goto err2; + ret = gpio_request(GPIO_NR_PALMT5_LCD_POWER, "LCD POWER"); + if (ret) + goto err2; + ret = gpio_direction_output(GPIO_NR_PALMT5_LCD_POWER, 0); + if (ret) + goto err3; + + return 0; +err3: + gpio_free(GPIO_NR_PALMT5_LCD_POWER); +err2: + gpio_free(GPIO_NR_PALMT5_BL_POWER); +err: + return ret; +} + +static int palmt5_backlight_notify(int brightness) +{ + gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness); + gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness); + return brightness; +} + +static void palmt5_backlight_exit(struct device *dev) +{ + gpio_free(GPIO_NR_PALMT5_BL_POWER); + gpio_free(GPIO_NR_PALMT5_LCD_POWER); +} + +static struct platform_pwm_backlight_data palmt5_backlight_data = { + .pwm_id = 0, + .max_brightness = PALMT5_MAX_INTENSITY, + .dft_brightness = PALMT5_MAX_INTENSITY, + .pwm_period_ns = PALMT5_PERIOD_NS, + .init = palmt5_backlight_init, + .notify = palmt5_backlight_notify, + .exit = palmt5_backlight_exit, +}; + +static struct platform_device palmt5_backlight = { + .name = "pwm-backlight", + .dev = { + .parent = &pxa27x_device_pwm0.dev, + .platform_data = &palmt5_backlight_data, + }, +}; + +/****************************************************************************** + * IrDA + ******************************************************************************/ +static int palmt5_irda_startup(struct device *dev) +{ + int err; + err = gpio_request(GPIO_NR_PALMT5_IR_DISABLE, "IR DISABLE"); + if (err) + goto err; + err = gpio_direction_output(GPIO_NR_PALMT5_IR_DISABLE, 1); + if (err) + gpio_free(GPIO_NR_PALMT5_IR_DISABLE); +err: + return err; +} + +static void palmt5_irda_shutdown(struct device *dev) +{ + gpio_free(GPIO_NR_PALMT5_IR_DISABLE); +} + +static void palmt5_irda_transceiver_mode(struct device *dev, int mode) +{ + gpio_set_value(GPIO_NR_PALMT5_IR_DISABLE, mode & IR_OFF); + pxa2xx_transceiver_mode(dev, mode); +} + +static struct pxaficp_platform_data palmt5_ficp_platform_data = { + .startup = palmt5_irda_startup, + .shutdown = palmt5_irda_shutdown, + .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, + .transceiver_mode = palmt5_irda_transceiver_mode, +}; + +/****************************************************************************** + * UDC + ******************************************************************************/ +static struct pxa2xx_udc_mach_info palmt5_udc_info __initdata = { + .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N, + .gpio_vbus_inverted = 1, + .gpio_pullup = GPIO_NR_PALMT5_USB_POWER, + .gpio_pullup_inverted = 0, +}; + +/****************************************************************************** + * Power supply + ******************************************************************************/ +static int power_supply_init(struct device *dev) +{ + int ret; + + ret = gpio_request(GPIO_NR_PALMT5_POWER_DETECT, "CABLE_STATE_AC"); + if (ret) + goto err1; + ret = gpio_direction_input(GPIO_NR_PALMT5_POWER_DETECT); + if (ret) + goto err2; + + return 0; +err2: + gpio_free(GPIO_NR_PALMT5_POWER_DETECT); +err1: + return ret; +} + +static int palmt5_is_ac_online(void) +{ + return gpio_get_value(GPIO_NR_PALMT5_POWER_DETECT); +} + +static void power_supply_exit(struct device *dev) +{ + gpio_free(GPIO_NR_PALMT5_POWER_DETECT); +} + +static char *palmt5_supplicants[] = { + "main-battery", +}; + +static struct pda_power_pdata power_supply_info = { + .init = power_supply_init, + .is_ac_online = palmt5_is_ac_online, + .exit = power_supply_exit, + .supplied_to = palmt5_supplicants, + .num_supplicants = ARRAY_SIZE(palmt5_supplicants), +}; + +static struct platform_device power_supply = { + .name = "pda-power", + .id = -1, + .dev = { + .platform_data = &power_supply_info, + }, +}; + +/****************************************************************************** + * WM97xx battery + ******************************************************************************/ +static struct wm97xx_batt_info wm97xx_batt_pdata = { + .batt_aux = WM97XX_AUX_ID3, + .temp_aux = WM97XX_AUX_ID2, + .charge_gpio = -1, + .max_voltage = PALMT5_BAT_MAX_VOLTAGE, + .min_voltage = PALMT5_BAT_MIN_VOLTAGE, + .batt_mult = 1000, + .batt_div = 414, + .temp_mult = 1, + .temp_div = 1, + .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, + .batt_name = "main-batt", +}; + +/****************************************************************************** + * aSoC audio + ******************************************************************************/ +static struct palm27x_asoc_info palm27x_asoc_pdata = { + .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT, +}; + +/****************************************************************************** + * Framebuffer + ******************************************************************************/ +static struct pxafb_mode_info palmt5_lcd_modes[] = { +{ + .pixclock = 57692, + .xres = 320, + .yres = 480, + .bpp = 16, + + .left_margin = 32, + .right_margin = 1, + .upper_margin = 7, + .lower_margin = 1, + + .hsync_len = 4, + .vsync_len = 1, +}, +}; + +static struct pxafb_mach_info palmt5_lcd_screen = { + .modes = palmt5_lcd_modes, + .num_modes = ARRAY_SIZE(palmt5_lcd_modes), + .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, +}; + +/****************************************************************************** + * Machine init + ******************************************************************************/ +static struct platform_device *devices[] __initdata = { +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) + &palmt5_pxa_keys, +#endif + &palmt5_backlight, + &power_supply, +}; + +/* setup udc GPIOs initial state */ +static void __init palmt5_udc_init(void) +{ + if (!gpio_request(GPIO_NR_PALMT5_USB_POWER, "UDC Vbus")) { + gpio_direction_output(GPIO_NR_PALMT5_USB_POWER, 1); + gpio_free(GPIO_NR_PALMT5_USB_POWER); + } +} + +static void __init palmt5_init(void) +{ + pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); + + set_pxa_fb_info(&palmt5_lcd_screen); + pxa_set_mci_info(&palmt5_mci_platform_data); + palmt5_udc_init(); + pxa_set_udc_info(&palmt5_udc_info); + pxa_set_ac97_info(NULL); + pxa_set_ficp_info(&palmt5_ficp_platform_data); + pxa_set_keypad_info(&palmt5_keypad_platform_data); + wm97xx_bat_set_pdata(&wm97xx_batt_pdata); + palm27x_asoc_set_pdata(&palm27x_asoc_pdata); + platform_add_devices(devices, ARRAY_SIZE(devices)); +} + +MACHINE_START(PALMT5, "Palm Tungsten|T5") + .phys_io = PALMT5_PHYS_IO_START, + .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, + .boot_params = 0xa0000100, + .map_io = pxa_map_io, + .init_irq = pxa27x_init_irq, + .timer = &pxa_timer, + .init_machine = palmt5_init +MACHINE_END diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index a9d94f5dbec..b490c092461 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c @@ -32,12 +32,11 @@ #include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <mach/pxa27x.h> #include <mach/audio.h> #include <mach/palmtx.h> #include <mach/mmc.h> #include <mach/pxafb.h> -#include <mach/pxa-regs.h> -#include <mach/mfp-pxa27x.h> #include <mach/irda.h> #include <mach/pxa27x_keypad.h> #include <mach/udc.h> diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c index 2f730da3bba..b88eb4dd2c8 100644 --- a/arch/arm/mach-pxa/palmz72.c +++ b/arch/arm/mach-pxa/palmz72.c @@ -33,13 +33,11 @@ #include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <mach/pxa27x.h> #include <mach/audio.h> #include <mach/palmz72.h> #include <mach/mmc.h> #include <mach/pxafb.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa27x.h> #include <mach/irda.h> #include <mach/pxa27x_keypad.h> #include <mach/udc.h> diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c index 36135a02fdc..6abfa2979c6 100644 --- a/arch/arm/mach-pxa/pcm027.c +++ b/arch/arm/mach-pxa/pcm027.c @@ -29,10 +29,7 @@ #include <asm/mach-types.h> #include <asm/mach/arch.h> -#include <mach/hardware.h> -#include <mach/pxa-regs.h> -#include <mach/mfp-pxa27x.h> -#include <mach/pxa2xx-regs.h> +#include <mach/pxa27x.h> #include <mach/pxa2xx_spi.h> #include <mach/pcm027.h> #include "generic.h" diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index 34841c72815..f46698e20c1 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c @@ -31,13 +31,12 @@ #include <mach/i2c.h> #include <mach/camera.h> #include <asm/mach/map.h> -#include <mach/pxa-regs.h> +#include <mach/pxa27x.h> #include <mach/audio.h> #include <mach/mmc.h> #include <mach/ohci.h> #include <mach/pcm990_baseboard.h> #include <mach/pxafb.h> -#include <mach/mfp-pxa27x.h> #include "devices.h" #include "generic.h" diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c index 164eb0bb632..884b174c8ea 100644 --- a/arch/arm/mach-pxa/pm.c +++ b/arch/arm/mach-pxa/pm.c @@ -14,15 +14,8 @@ #include <linux/module.h> #include <linux/suspend.h> #include <linux/errno.h> -#include <linux/time.h> -#include <mach/hardware.h> -#include <asm/memory.h> -#include <asm/system.h> #include <mach/pm.h> -#include <mach/pxa-regs.h> -#include <mach/lubbock.h> -#include <asm/mach/time.h> struct pxa_cpu_pm_fns *pxa_cpu_pm_fns; static unsigned long *sleep_save; @@ -57,9 +50,9 @@ int pxa_pm_enter(suspend_state_t state) /* if invalid, display message and wait for a hardware reset */ if (checksum != sleep_save_checksum) { -#ifdef CONFIG_ARCH_LUBBOCK - LUB_HEXLED = 0xbadbadc5; -#endif + + lubbock_set_hexled(0xbadbadc5); + while (1) pxa_cpu_pm_fns->enter(state); } diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index f9093beba75..036bbde4d22 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c @@ -36,9 +36,7 @@ #include <asm/mach/map.h> #include <asm/mach/irq.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa25x.h> +#include <mach/pxa25x.h> #include <mach/mmc.h> #include <mach/udc.h> #include <mach/i2c.h> @@ -503,12 +501,12 @@ static struct platform_device *devices[] __initdata = { static void poodle_poweroff(void) { - arm_machine_restart('h'); + arm_machine_restart('h', NULL); } -static void poodle_restart(char mode) +static void poodle_restart(char mode, const char *cmd) { - arm_machine_restart('h'); + arm_machine_restart('h', cmd); } static void __init poodle_init(void) diff --git a/arch/arm/mach-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c index 3ca7ffc6904..fcdd374437a 100644 --- a/arch/arm/mach-pxa/pwm.c +++ b/arch/arm/mach-pxa/pwm.c @@ -20,7 +20,6 @@ #include <linux/pwm.h> #include <asm/div64.h> -#include <mach/pxa-regs.h> /* PWM registers and bits definitions */ #define PWMCR (0x00) diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index 6c57522e246..77c2693cfee 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c @@ -25,9 +25,8 @@ #include <mach/hardware.h> #include <mach/irqs.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa25x.h> +#include <mach/gpio.h> +#include <mach/pxa25x.h> #include <mach/reset.h> #include <mach/pm.h> #include <mach/dma.h> @@ -310,14 +309,14 @@ set_pwer: void __init pxa25x_init_irq(void) { pxa_init_irq(32, pxa25x_set_wake); - pxa_init_gpio(85, pxa25x_set_wake); + pxa_init_gpio(IRQ_GPIO_2_x, 2, 84, pxa25x_set_wake); } #ifdef CONFIG_CPU_PXA26x void __init pxa26x_init_irq(void) { pxa_init_irq(32, pxa25x_set_wake); - pxa_init_gpio(90, pxa25x_set_wake); + pxa_init_gpio(IRQ_GPIO_2_x, 2, 89, pxa25x_set_wake); } #endif @@ -355,7 +354,7 @@ static int __init pxa25x_init(void) clks_register(pxa25x_clkregs, ARRAY_SIZE(pxa25x_clkregs)); - if ((ret = pxa_init_dma(16))) + if ((ret = pxa_init_dma(IRQ_DMA, 16))) return ret; pxa25x_init_pm(); diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 411bec54fdc..a425ec71e65 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -21,9 +21,8 @@ #include <mach/hardware.h> #include <asm/irq.h> #include <mach/irqs.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa27x.h> +#include <mach/gpio.h> +#include <mach/pxa27x.h> #include <mach/reset.h> #include <mach/ohci.h> #include <mach/pm.h> @@ -332,7 +331,7 @@ static int pxa27x_set_wake(unsigned int irq, unsigned int on) void __init pxa27x_init_irq(void) { pxa_init_irq(34, pxa27x_set_wake); - pxa_init_gpio(121, pxa27x_set_wake); + pxa_init_gpio(IRQ_GPIO_2_x, 2, 120, pxa27x_set_wake); } /* @@ -381,7 +380,7 @@ static int __init pxa27x_init(void) clks_register(pxa27x_clkregs, ARRAY_SIZE(pxa27x_clkregs)); - if ((ret = pxa_init_dma(32))) + if ((ret = pxa_init_dma(IRQ_DMA, 32))) return ret; pxa27x_init_pm(); diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c index 73d04d81c75..2f3394f8591 100644 --- a/arch/arm/mach-pxa/pxa2xx.c +++ b/arch/arm/mach-pxa/pxa2xx.c @@ -16,7 +16,6 @@ #include <mach/hardware.h> #include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa2xx.h> #include <mach/mfp-pxa25x.h> #include <mach/reset.h> #include <mach/irda.h> diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c index 83fb609b6eb..4ba6d21f851 100644 --- a/arch/arm/mach-pxa/pxa300.c +++ b/arch/arm/mach-pxa/pxa300.c @@ -17,15 +17,13 @@ #include <linux/kernel.h> #include <linux/platform_device.h> -#include <mach/hardware.h> -#include <mach/pxa3xx-regs.h> -#include <mach/mfp-pxa300.h> +#include <mach/pxa300.h> #include "generic.h" #include "devices.h" #include "clock.h" -static struct pxa3xx_mfp_addr_map pxa300_mfp_addr_map[] __initdata = { +static struct mfp_addr_map pxa300_mfp_addr_map[] __initdata = { MFP_ADDR_X(GPIO0, GPIO2, 0x00b4), MFP_ADDR_X(GPIO3, GPIO26, 0x027c), @@ -74,7 +72,7 @@ static struct pxa3xx_mfp_addr_map pxa300_mfp_addr_map[] __initdata = { }; /* override pxa300 MFP register addresses */ -static struct pxa3xx_mfp_addr_map pxa310_mfp_addr_map[] __initdata = { +static struct mfp_addr_map pxa310_mfp_addr_map[] __initdata = { MFP_ADDR_X(GPIO30, GPIO98, 0x0418), MFP_ADDR_X(GPIO7_2, GPIO12_2, 0x052C), @@ -100,13 +98,13 @@ static struct clk_lookup pxa310_clkregs[] = { static int __init pxa300_init(void) { if (cpu_is_pxa300() || cpu_is_pxa310()) { - pxa3xx_init_mfp(); - pxa3xx_mfp_init_addr(pxa300_mfp_addr_map); + mfp_init_base(io_p2v(MFPR_BASE)); + mfp_init_addr(pxa300_mfp_addr_map); clks_register(ARRAY_AND_SIZE(common_clkregs)); } if (cpu_is_pxa310()) { - pxa3xx_mfp_init_addr(pxa310_mfp_addr_map); + mfp_init_addr(pxa310_mfp_addr_map); clks_register(ARRAY_AND_SIZE(pxa310_clkregs)); } diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c index 36f066196fa..8b3d97efada 100644 --- a/arch/arm/mach-pxa/pxa320.c +++ b/arch/arm/mach-pxa/pxa320.c @@ -17,16 +17,13 @@ #include <linux/kernel.h> #include <linux/platform_device.h> -#include <mach/hardware.h> -#include <mach/mfp.h> -#include <mach/pxa3xx-regs.h> -#include <mach/mfp-pxa320.h> +#include <mach/pxa320.h> #include "generic.h" #include "devices.h" #include "clock.h" -static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = { +static struct mfp_addr_map pxa320_mfp_addr_map[] __initdata = { MFP_ADDR_X(GPIO0, GPIO4, 0x0124), MFP_ADDR_X(GPIO5, GPIO9, 0x028C), @@ -89,8 +86,8 @@ static struct clk_lookup pxa320_clkregs[] = { static int __init pxa320_init(void) { if (cpu_is_pxa320()) { - pxa3xx_init_mfp(); - pxa3xx_mfp_init_addr(pxa320_mfp_addr_map); + mfp_init_base(io_p2v(MFPR_BASE)); + mfp_init_addr(pxa320_mfp_addr_map); clks_register(ARRAY_AND_SIZE(pxa320_clkregs)); } diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 490893824e7..b02d4544dc9 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -23,6 +23,7 @@ #include <linux/sysdev.h> #include <mach/hardware.h> +#include <mach/gpio.h> #include <mach/pxa3xx-regs.h> #include <mach/reset.h> #include <mach/ohci.h> @@ -538,7 +539,7 @@ void __init pxa3xx_init_irq(void) __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); pxa_init_irq(56, pxa3xx_set_wake); - pxa_init_gpio(128, NULL); + pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL); } /* @@ -594,7 +595,7 @@ static int __init pxa3xx_init(void) clks_register(pxa3xx_clkregs, ARRAY_SIZE(pxa3xx_clkregs)); - if ((ret = pxa_init_dma(32))) + if ((ret = pxa_init_dma(IRQ_DMA, 32))) return ret; pxa3xx_init_pm(); diff --git a/arch/arm/mach-pxa/pxa930.c b/arch/arm/mach-pxa/pxa930.c index 13e6bfdfff6..71131742fff 100644 --- a/arch/arm/mach-pxa/pxa930.c +++ b/arch/arm/mach-pxa/pxa930.c @@ -16,10 +16,9 @@ #include <linux/irq.h> #include <linux/dma-mapping.h> -#include <mach/hardware.h> -#include <mach/mfp-pxa930.h> +#include <mach/pxa930.h> -static struct pxa3xx_mfp_addr_map pxa930_mfp_addr_map[] __initdata = { +static struct mfp_addr_map pxa930_mfp_addr_map[] __initdata = { MFP_ADDR(GPIO0, 0x02e0), MFP_ADDR(GPIO1, 0x02dc), @@ -180,8 +179,8 @@ static struct pxa3xx_mfp_addr_map pxa930_mfp_addr_map[] __initdata = { static int __init pxa930_init(void) { if (cpu_is_pxa930()) { - pxa3xx_init_mfp(); - pxa3xx_mfp_init_addr(pxa930_mfp_addr_map); + mfp_init_base(io_p2v(MFPR_BASE)); + mfp_init_addr(pxa930_mfp_addr_map); } return 0; diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c index 00b2dc2a107..df29d45fb4e 100644 --- a/arch/arm/mach-pxa/reset.c +++ b/arch/arm/mach-pxa/reset.c @@ -10,7 +10,7 @@ #include <linux/io.h> #include <asm/proc-fns.h> -#include <mach/pxa-regs.h> +#include <mach/regs-ost.h> #include <mach/reset.h> unsigned int reset_status; @@ -81,7 +81,7 @@ static void do_hw_reset(void) OSMR3 = OSCR + 368640; /* ... in 100 ms */ } -void arch_reset(char mode) +void arch_reset(char mode, const char *cmd) { clear_reset_status(RESET_STATUS_ALL); diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c index 5d02a732558..ff823999143 100644 --- a/arch/arm/mach-pxa/saar.c +++ b/arch/arm/mach-pxa/saar.c @@ -25,11 +25,9 @@ #include <asm/mach-types.h> #include <asm/mach/arch.h> -#include <mach/hardware.h> -#include <mach/pxa3xx-regs.h> -#include <mach/mfp-pxa930.h> + +#include <mach/pxa930.h> #include <mach/i2c.h> -#include <mach/regs-lcd.h> #include <mach/pxafb.h> #include "devices.h" diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c index f0845c1b001..16b4ec67e3b 100644 --- a/arch/arm/mach-pxa/sharpsl_pm.c +++ b/arch/arm/mach-pxa/sharpsl_pm.c @@ -25,7 +25,6 @@ #include <mach/hardware.h> #include <asm/mach-types.h> #include <mach/pm.h> -#include <mach/pxa-regs.h> #include <mach/pxa2xx-gpio.h> #include <mach/sharpsl.h> #include "sharpsl.h" diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S index a62c8375eb5..2ed95f369cf 100644 --- a/arch/arm/mach-pxa/sleep.S +++ b/arch/arm/mach-pxa/sleep.S @@ -15,7 +15,6 @@ #include <asm/assembler.h> #include <mach/hardware.h> -#include <mach/pxa-regs.h> #include <mach/pxa2xx-regs.h> #define MDREFR_KDIV 0x200a4000 // all banks diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 6d447c9ce8a..8c61ddac119 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -44,9 +44,7 @@ #include <asm/mach/map.h> #include <asm/mach/irq.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa27x.h> +#include <mach/pxa27x.h> #include <mach/pxa27x-udc.h> #include <mach/reset.h> #include <mach/i2c.h> @@ -105,6 +103,12 @@ static unsigned long spitz_pin_config[] __initdata = { GPIO57_nIOIS16, GPIO104_PSKTSEL, + /* I2S */ + GPIO28_I2S_BITCLK_OUT, + GPIO29_I2S_SDATA_IN, + GPIO30_I2S_SDATA_OUT, + GPIO31_I2S_SYNC, + /* MMC */ GPIO32_MMC_CLK, GPIO112_MMC_CMD, @@ -703,10 +707,10 @@ static struct platform_device *devices[] __initdata = { static void spitz_poweroff(void) { - arm_machine_restart('g'); + arm_machine_restart('g', NULL); } -static void spitz_restart(char mode) +static void spitz_restart(char mode, const char *cmd) { /* Bootloader magic for a reboot */ if((MSC0 & 0xffff0000) == 0x7ff00000) diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c index 072e77cfe5a..2e4490562c9 100644 --- a/arch/arm/mach-pxa/spitz_pm.c +++ b/arch/arm/mach-pxa/spitz_pm.c @@ -24,7 +24,6 @@ #include <mach/sharpsl.h> #include <mach/spitz.h> -#include <mach/pxa-regs.h> #include <mach/pxa2xx-regs.h> #include <mach/pxa2xx-gpio.h> #include "sharpsl.h" diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c index 6f42004db3e..965e38c6baf 100644 --- a/arch/arm/mach-pxa/ssp.c +++ b/arch/arm/mach-pxa/ssp.c @@ -33,7 +33,6 @@ #include <asm/irq.h> #include <mach/hardware.h> #include <mach/ssp.h> -#include <mach/pxa-regs.h> #include <mach/regs-ssp.h> #define TIMEOUT 100000 diff --git a/arch/arm/mach-pxa/standby.S b/arch/arm/mach-pxa/standby.S index f3821cfda72..29f5f5c180b 100644 --- a/arch/arm/mach-pxa/standby.S +++ b/arch/arm/mach-pxa/standby.S @@ -13,7 +13,6 @@ #include <asm/assembler.h> #include <mach/hardware.h> -#include <mach/pxa-regs.h> #include <mach/pxa2xx-regs.h> .text diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c index 58ef08a5224..b75353a2ec7 100644 --- a/arch/arm/mach-pxa/tavorevb.c +++ b/arch/arm/mach-pxa/tavorevb.c @@ -22,9 +22,8 @@ #include <asm/mach-types.h> #include <asm/mach/arch.h> -#include <mach/hardware.h> -#include <mach/pxa3xx-regs.h> -#include <mach/mfp-pxa930.h> + +#include <mach/pxa930.h> #include <mach/pxafb.h> #include <mach/pxa27x_keypad.h> diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c index 95656a72268..8eb3830fbb0 100644 --- a/arch/arm/mach-pxa/time.c +++ b/arch/arm/mach-pxa/time.c @@ -22,8 +22,7 @@ #include <asm/div64.h> #include <asm/mach/irq.h> #include <asm/mach/time.h> -#include <mach/hardware.h> -#include <mach/pxa-regs.h> +#include <mach/regs-ost.h> /* * This is PXA's sched_clock implementation. This has a resolution diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 3332e5d0356..6e8ade6ae33 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c @@ -36,8 +36,8 @@ #include <asm/setup.h> #include <asm/mach-types.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa25x.h> + +#include <mach/pxa25x.h> #include <mach/reset.h> #include <mach/irda.h> #include <mach/i2c.h> @@ -876,10 +876,10 @@ static struct platform_device *devices[] __initdata = { static void tosa_poweroff(void) { - arm_machine_restart('g'); + arm_machine_restart('g', NULL); } -static void tosa_restart(char mode) +static void tosa_restart(char mode, const char *cmd) { /* Bootloader magic for a reboot */ if((MSC0 & 0xffff0000) == 0x7ff00000) @@ -919,7 +919,7 @@ static void __init tosa_init(void) pxa2xx_set_spi_info(2, &pxa_ssp_master_info); spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); - clk_add_alias("CLK_CK3P6MI", &tc6393xb_device.dev, "GPIO11_CLK", NULL); + clk_add_alias("CLK_CK3P6MI", tc6393xb_device.name, "GPIO11_CLK", NULL); platform_add_devices(devices, ARRAY_SIZE(devices)); } diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c index a72e3add743..f79c9cb70ae 100644 --- a/arch/arm/mach-pxa/trizeps4.c +++ b/arch/arm/mach-pxa/trizeps4.c @@ -39,10 +39,7 @@ #include <asm/mach/irq.h> #include <asm/mach/flash.h> -#include <mach/hardware.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/mfp-pxa27x.h> +#include <mach/pxa27x.h> #include <mach/pxa2xx_spi.h> #include <mach/trizeps4.h> #include <mach/audio.h> diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c index 4b3120dbc04..0e65344e9f5 100644 --- a/arch/arm/mach-pxa/viper.c +++ b/arch/arm/mach-pxa/viper.c @@ -42,12 +42,9 @@ #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> -#include <mach/pxa-regs.h> -#include <mach/pxa2xx-regs.h> -#include <mach/bitfield.h> +#include <mach/pxa25x.h> #include <mach/audio.h> #include <mach/pxafb.h> -#include <mach/mfp-pxa25x.h> #include <mach/i2c.h> #include <mach/viper.h> @@ -956,7 +953,7 @@ static struct map_desc viper_io_desc[] __initdata = { }, { .virtual = VIPER_PC104IO_BASE, - .pfn = __phys_to_pfn(_PCMCIA1IO), + .pfn = __phys_to_pfn(0x30000000), .length = 0x00800000, .type = MT_DEVICE, }, diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c index 46538885a58..c1f73205d07 100644 --- a/arch/arm/mach-pxa/zylonite_pxa300.c +++ b/arch/arm/mach-pxa/zylonite_pxa300.c @@ -18,9 +18,9 @@ #include <linux/init.h> #include <linux/i2c.h> #include <linux/i2c/pca953x.h> +#include <linux/gpio.h> -#include <asm/gpio.h> -#include <mach/mfp-pxa300.h> +#include <mach/pxa300.h> #include <mach/i2c.h> #include <mach/zylonite.h> diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c index 28e4e623780..4e1c488c690 100644 --- a/arch/arm/mach-pxa/zylonite_pxa320.c +++ b/arch/arm/mach-pxa/zylonite_pxa320.c @@ -18,7 +18,7 @@ #include <linux/init.h> #include <linux/gpio.h> -#include <mach/mfp-pxa320.h> +#include <mach/pxa320.h> #include <mach/zylonite.h> #include "generic.h" |