Common code for the different EZX GSM phones. Functions to control LCD and
backlight power, OHCI and UART init.

Signed-off-by: Stefan Schmidt <[EMAIL PROTECTED]>
Signed-off-by: Daniel Ribeiro <[EMAIL PROTECTED]>

Index: linux-2.6-arm/arch/arm/mach-pxa/ezx.c
===================================================================
--- /dev/null
+++ linux-2.6-arm/arch/arm/mach-pxa/ezx.c
@@ -0,0 +1,193 @@
+/*
+ *  ezx.c - Common code for the EZX platform.
+ *
+ *  Copyright (C) 2005-2006 Harald Welte <[EMAIL PROTECTED]>,
+ *                               2007-2008 Daniel Ribeiro <[EMAIL PROTECTED]>,
+ *                               2007-2008 Stefan Schmidt <[EMAIL PROTECTED]>
+ *
+ *  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/platform_device.h>
+#include <linux/delay.h>
+#include <linux/pwm_backlight.h>
+
+#include <asm/arch/pxafb.h>
+#include <asm/arch/ohci.h>
+#include <asm/arch/i2c.h>
+
+#include <asm/arch/mfp-pxa27x.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/pxa2xx-regs.h>
+#include <asm/arch/pxa27x-udc.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+#include "devices.h"
+#include "generic.h"
+
+/* EZX PXA framebuffer */
+void ezx_lcd_power(int on, struct fb_var_screeninfo *var)
+{
+       /* FIXME Can we make the register poking more sane here? */
+       if (on) {
+               msleep(1);
+               GPSR3 = 0x00100000;
+               msleep(10);
+               GPCR3 = 0x00100000;
+               GPDR3 |= 0x00100000;
+       } else {
+               GPSR3 = 0x00100000;
+               PGSR3 |= 0x00100000;
+               msleep(41);
+               msleep(18);
+       }
+}
+
+static struct platform_pwm_backlight_data ezx_backlight_data = {
+       .pwm_id                 = 0,
+       .max_brightness = 1023,
+       .dft_brightness = 1023,
+       .pwm_period_ns  = 78770,
+};
+
+static struct platform_device ezx_backlight_device = {
+       .name           = "pwm-backlight",
+       .dev            = {
+               .parent = &pxa27x_device_pwm0.dev,
+               .platform_data = &ezx_backlight_data,
+       },
+};
+
+static struct pxafb_mode_info mode_ezx = {
+       .pixclock               = 150000,
+       .xres                   = 240,
+       .yres                   = 320,
+       .bpp                    = 16,
+       .hsync_len              = 10,
+       .left_margin    = 20,
+       .right_margin   = 10,
+       .vsync_len              = 2,
+       .upper_margin   = 3,
+       .lower_margin   = 2,
+       .sync                   = 0,
+};
+
+static struct pxafb_mach_info ezx_fb_info = {
+       .modes          = &mode_ezx,
+       .num_modes      = 1,
+       .lcd_conn       = LCD_COLOR_TFT_16BPP,
+       .pxafb_lcd_power = &ezx_lcd_power,
+};
+
+/* OHCI Controller */
+static int ezx_ohci_init(struct device *dev)
+{
+       /* FIXME Do we need this? */
+       //UP3OCR = 0x00000002;
+
+       UHCHR = UHCHR & ~(UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
+
+       return 0;
+}
+
+static struct pxaohci_platform_data ezx_ohci_platform_data = {
+       .port_mode      = PMM_NPS_MODE,
+       .init           = ezx_ohci_init,
+};
+
+
+static struct platform_device *devices[] __initdata = {
+       &ezx_backlight_device,
+};
+
+static unsigned long ezx_pin_config[] = {
+       /* PWM backlight */
+       GPIO16_PWM0_OUT,
+
+       /* BTUART */
+       GPIO42_BTUART_RXD,
+       GPIO43_BTUART_TXD,
+       GPIO44_BTUART_CTS,
+       GPIO45_BTUART_RTS,
+
+       /* STUART */
+       GPIO46_STUART_RXD,
+       GPIO47_STUART_TXD,
+
+       /* For A780 support (connected with Neptune GSM chip) */
+       GPIO30_USB_P3_2,        /* ICL_TXENB */
+       GPIO31_USB_P3_6,        /* ICL_VPOUT */
+       GPIO90_USB_P3_5,        /* ICL_VPIN */
+       GPIO91_USB_P3_1,        /* ICL_XRXD */
+       GPIO56_USB_P3_4,        /* ICL_VMOUT */
+       GPIO113_USB_P3_3,       /* /ICL_VMIN */
+};
+
+static void __init ezx_init(void)
+{
+       /* FIXME Do we need this? */
+       //CKEN = (1 << CKEN_OSTIMER) | (1 << CKEN_MEMC);
+
+       pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
+
+       pxa_set_ohci_info(&ezx_ohci_platform_data);
+       pxa_set_i2c_info(NULL);
+
+       /* FIXME How can we use mfp_config here? */
+       /* setup sleep mode values */
+       if (machine_is_motorola_a780()) {
+               PWER  = 0xc0007803;     /* disable usb, GPIO15 NC */
+               PFER  = 0x00007803;
+               PRER  = 0x00001802;
+               PGSR0 = 0x00000010;
+               PGSR1 = 0x02800000;
+               PGSR2 = 0x00040000;
+               PGSR3 = 0x00000008;
+               PCFR  = PCFR_DC_EN | PCFR_FS | PCFR_FP | PCFR_OPDE;
+               PSLR  = 0x05800f00;
+       } else if (machine_is_motorola_e680()) {
+               PWER  = 0xc000f803;             /* disable usb 0xdc00f803; */
+               PFER  = 0x0000f803;
+               PRER  = 0x00001802;
+               PGSR0 = 0x00000010;
+               PGSR1 = 0x02800000;
+               PGSR2 = 0x00040000;
+               PGSR3 = 0x00000000;
+               PCFR  = PCFR_DC_EN | PCFR_FS | PCFR_FP | PCFR_OPDE;
+               PSLR  = 0x05800f00;
+       }
+
+       set_pxa_fb_info(&ezx_fb_info);
+
+       platform_add_devices(devices, ARRAY_SIZE(devices));
+}
+
+#ifdef CONFIG_MACH_MOTOROLA_A780
+MACHINE_START(MOTOROLA_A780, "Motorola EZX A780")
+       .phys_io        = 0x40000000,
+       .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   = &ezx_init,
+MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_MOTOROLA_E680
+MACHINE_START(MOTOROLA_E680, "Motorola EZX E680")
+       .phys_io        = 0x40000000,
+       .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   = &ezx_init,
+MACHINE_END
+#endif
Index: linux-2.6-arm/arch/arm/mach-pxa/Kconfig
===================================================================
--- linux-2.6-arm.orig/arch/arm/mach-pxa/Kconfig
+++ linux-2.6-arm/arch/arm/mach-pxa/Kconfig
@@ -140,6 +140,23 @@
        select PXA27x
        select IWMMXT
 
+config PXA_EZX
+       bool "Motorola EZX Platform"
+       select PXA27x
+       select IWMMXT
+       select PXA_SSP
+       select HAVE_PWM
+
+config MACH_MOTOROLA_A780
+       bool "Motorola EZX A780"
+       default y
+       depends on PXA_EZX
+
+config MACH_MOTOROLA_E680
+       bool "Motorola EZX E680"
+       default y
+       depends on PXA_EZX
+
 endmenu
 
 choice
Index: linux-2.6-arm/arch/arm/mach-pxa/Makefile
===================================================================
--- linux-2.6-arm.orig/arch/arm/mach-pxa/Makefile
+++ linux-2.6-arm/arch/arm/mach-pxa/Makefile
@@ -46,6 +46,7 @@
 obj-$(CONFIG_MACH_LITTLETON)   += littleton.o
 
 obj-$(CONFIG_MACH_ARMCORE)      += cm-x270.o
+obj-$(CONFIG_PXA_EZX)      += ezx.o
 
 # Support for blinky lights
 led-y := leds.o

-- 

Reply via email to