From 83b21270f89fa95326e336e6f00a962f562b0e7c Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 14 Aug 2009 03:35:44 +0200 Subject: [PATCH 04/10] Multiarch LCD --- sys/arch/palm/dev/palm_mmc.c | 11 ++++++++- sys/arch/palm/include/machine_reg.h | 5 ++- sys/arch/palm/palm/palm_lcd.c | 39 +++++++++++++++++++++++++++++----- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/sys/arch/palm/dev/palm_mmc.c b/sys/arch/palm/dev/palm_mmc.c index b2e154c..078da95 100644 --- a/sys/arch/palm/dev/palm_mmc.c +++ b/sys/arch/palm/dev/palm_mmc.c @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -70,13 +71,19 @@ int palm_mmc_set_power(void *cookie, u_int32_t ocr) { if (ISSET(ocr, MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V)) { - pxa2x0_gpio_set_bit(GPIO114_MMC_POWER); + if (mach_is_palmz72) + pxa2x0_gpio_clear_bit(GPIO98_PALMZ72_MMC_POWER); + else + pxa2x0_gpio_set_bit(GPIO114_MMC_POWER); return 0; } else if (ocr != 0) { printf("palm_mmc_set_power: unsupported OCR (%#x)\n", ocr); return EINVAL; } else { - pxa2x0_gpio_clear_bit(GPIO114_MMC_POWER); + if (mach_is_palmz72) + pxa2x0_gpio_set_bit(GPIO98_PALMZ72_MMC_POWER); + else + pxa2x0_gpio_clear_bit(GPIO114_MMC_POWER); return 0; } } diff --git a/sys/arch/palm/include/machine_reg.h b/sys/arch/palm/include/machine_reg.h index d3ac604..4da7560 100644 --- a/sys/arch/palm/include/machine_reg.h +++ b/sys/arch/palm/include/machine_reg.h @@ -56,7 +56,8 @@ #define ioreg8_write(a,v) (*(volatile uint8_t *)(a)=(v)) /* GPIOs */ -#define GPIO14_MMC_DETECT 14 /* MMC detect*/ -#define GPIO114_MMC_POWER 114 /* MMC power */ +#define GPIO14_MMC_DETECT 14 /* MMC detect*/ +#define GPIO114_MMC_POWER 114 /* MMC power */ +#define GPIO98_PALMZ72_MMC_POWER 98 /* Z72 MMC power */ #endif /* _PALM_REG_H */ diff --git a/sys/arch/palm/palm/palm_lcd.c b/sys/arch/palm/palm/palm_lcd.c index 9391671..53a40cf 100644 --- a/sys/arch/palm/palm/palm_lcd.c +++ b/sys/arch/palm/palm/palm_lcd.c @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -87,6 +88,7 @@ int lcd_ioctl(void *, u_long, caddr_t, int, struct proc *); void lcd_burner(void *, u_int, u_int); int lcd_show_screen(void *, void *, int, void (*)(void *, int, int), void *); +const struct lcd_panel_geometry *lcd_geom_get(void); int lcd_param(struct pxa2x0_lcd_softc *, u_long, struct wsdisplay_param *); @@ -111,9 +113,7 @@ struct cfdriver lcd_cd = { NULL, "lcd", DV_DULL }; -#define CURRENT_DISPLAY &palm_lcd - -const struct lcd_panel_geometry palm_lcd = +const struct lcd_panel_geometry palm_t5_lcd = { 324, /* Width */ 484, /* Height */ @@ -132,12 +132,39 @@ const struct lcd_panel_geometry palm_lcd = 0x08, /* EFW */ }; +const struct lcd_panel_geometry palm_z72_lcd = +{ + 324, /* Width */ + 324, /* Height */ + 0, /* No extra lines */ + + LCDPANEL_ACTIVE | LCDPANEL_VSP | LCDPANEL_HSP, + 2, /* clock divider */ + 0, /* AC bias pin freq */ + + 0x03, /* horizontal sync pulse width */ + 0x1a, /* BLW */ + 0x03, /* ELW */ + + 0x00, /* vertical sync pulse width */ + 0x05, /* BFW */ + 0x08, /* EFW */ +}; + int lcd_match(struct device *parent, void *cf, void *aux) { return 1; } +const struct lcd_panel_geometry *lcd_geom_get(void) +{ + if (mach_is_palmz72) + return &palm_z72_lcd; + else + return &palm_t5_lcd; +} + void lcd_attach(struct device *parent, struct device *self, void *aux) { @@ -147,8 +174,8 @@ lcd_attach(struct device *parent, struct device *self, void *aux) printf("\n"); - pxa2x0_lcd_attach_sub(sc, aux, &lcd_bpp16_screen, CURRENT_DISPLAY, - glass_console); + pxa2x0_lcd_attach_sub(sc, aux, &lcd_bpp16_screen, lcd_geom_get(), + glass_console); aa.console = glass_console; aa.scrdata = &lcd_screen_list; @@ -163,7 +190,7 @@ int lcd_cnattach(void (*clkman)(u_int, int)) { return - (pxa2x0_lcd_cnattach(&lcd_bpp16_screen, CURRENT_DISPLAY, clkman)); + (pxa2x0_lcd_cnattach(&lcd_bpp16_screen, lcd_geom_get(), clkman)); } /* -- 1.6.3.4