From: Pete P. <pp...@us...> - 2002-03-07 23:30:28
|
Update of /cvsroot/linux-mips/linux/drivers/video In directory usw-pr-cvs1:/tmp/cvs-serv5932/drivers/video Modified Files: Config.in epson1356fb.c epson1356fb.h Log Message: * Added 1386 support to the driver * Modified driver so it can be used as a loadable module * Modified pb1000 and pb1500 addresses to be the true 36 bit addresses Index: Config.in =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/video/Config.in,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Config.in 7 Mar 2002 09:15:16 -0000 1.13 +++ Config.in 7 Mar 2002 23:30:22 -0000 1.14 @@ -151,6 +151,10 @@ bool ' Use Compsite NTSC on Pb1000 (J63)' CONFIG_PB1000_NTSC bool ' Use TFT Panel on Pb1000 (J64)' CONFIG_PB1000_TFT fi + if [ "$CONFIG_MIPS_PB1500" = "y" -a "$CONFIG_FB_E1356" != "n" ]; then + bool ' Use CRT on Pb1500 ' CONFIG_PB1500_CRT + bool ' Use TFT Panel on Pb1500 ' CONFIG_PB1500_TFT + fi fi # Linux VR devices Index: epson1356fb.c =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/video/epson1356fb.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- epson1356fb.c 19 Oct 2001 21:19:39 -0000 1.7 +++ epson1356fb.c 7 Mar 2002 23:30:22 -0000 1.8 @@ -1,7 +1,7 @@ /* * epson1356fb.c -- Epson SED1356 Framebuffer Driver * - * Copyright 2001 MontaVista Software Inc. + * Copyright 2001, 2002 MontaVista Software Inc. * Author: MontaVista Software, Inc. * st...@mv... or so...@mv... * @@ -34,7 +34,9 @@ */ #include <linux/config.h> +#include <linux/version.h> #include <linux/module.h> + #include <linux/kernel.h> #include <linux/errno.h> #include <linux/string.h> @@ -79,6 +81,9 @@ #undef SHADOW_FRAME_BUFFER #include "epson1356fb.h" +static char *options; +MODULE_PARM(options, "s"); + /* * Frame buffer device API */ @@ -1741,8 +1746,10 @@ static int e1356fb_open(struct fb_info *fb, int user) { struct fb_info_e1356 *info = (struct fb_info_e1356*)fb; - if (user) + if (user) { info->open++; + } + MOD_INC_USE_COUNT; return 0; } @@ -1754,6 +1761,7 @@ if (info->open == 0) info->mmaped = 0; } + MOD_DEC_USE_COUNT; return 0; } @@ -2166,14 +2174,24 @@ int dram_timing, rr_div, mclk_src; u8 rev_code, btmp, mclk_cfg; + if (options) { + e1356fb_setup(options, 0); + } + // clear out fb_info memset(&fb_info, 0, sizeof(struct fb_info_e1356)); // copy boot options fb_info.fix = boot_fix; fb_info.default_par = boot_par; - + fb_info.regbase_size = E1356_REG_SIZE; + + if (!epfix->system) { + printk(KERN_ERR "e1356/86fb: no valid system found\n"); + return -ENODEV; + } + if (epfix->system == SYS_SDU1356) { // it's the SDU1356B0C PCI eval card. struct pci_dev *pdev = NULL; @@ -2223,9 +2241,15 @@ writeb(0, ®->basic->misc); rev_code = readb(®->basic->rev_code); - if ((rev_code >> 2) != 0x04) { + if ((rev_code >> 2) == 0x04) { + printk("Found EPSON1356 Display Controller\n"); + } + else if ((rev_code >> 2) == 0x07) { + printk("Found EPSON13806 Display Controller\n"); + } + else { iounmap(fb_info.regbase_virt); - printk("e1356fb: %s not found, rev_code=0x%02x.\n", + printk("e1356/806fb: %s not found, rev_code=0x%02x.\n", name, rev_code); return -ENODEV; } @@ -2238,11 +2262,17 @@ case 2: fb_info.fb_size = 0x80000; /* 512K bytes */ break; + case 1: + if ((rev_code >> 2) == 7) /* 806 */ + fb_info.fb_size = 0x140000; /* 1.2M bytes */ + else + fb_info.fb_size = 0x200000; /* 2M bytes */ + break; default: fb_info.fb_size = 0x200000; /* 2M bytes */ break; } - + fb_info.membase_virt = ioremap_nocache(epfix->membase_phys, fb_info.fb_size); @@ -2252,8 +2282,8 @@ return -ENXIO; } - printk("e1356fb: Detected %s framebuffer\n", - fb_info.fb_size == 0x80000 ? "512KB" : "2MB"); + printk("e1356/806fb: Detected %dKB framebuffer\n", + (unsigned)fb_info.fb_size/1000); #ifdef CONFIG_MTRR if (!epfix->nomtrr) { @@ -2282,13 +2312,15 @@ // Set the GPIO1 and 2 to inputs writeb(0, ®->genio->gpio_cfg); writeb(0, ®->genio->gpio_ctrl); + if (fb_info.chip_rev == 7) /* 806 */ + writeb(0, ®->genio->gpio_ctrl2); /* * Program the clocks */ #ifdef CONFIG_MIPS_AU1000 - if (epfix->system == SYS_PB1000) + if ((epfix->system == SYS_PB1000) || (epfix->system == SYS_PB1500)) epfix->busclk = get_au1000_lcd_clock(); #endif @@ -2297,23 +2329,32 @@ goto ret_enxio; } - // Find the highest allowable MCLK epfix->mclk = mclk_cfg = 0; - if (epfix->busclk <= MAX_PIXCLOCK && epfix->busclk > epfix->mclk) { + if (epfix->system == SYS_PB1500) { epfix->mclk = epfix->busclk; mclk_cfg = 0x01; } - if (epfix->clki <= MAX_PIXCLOCK && epfix->clki > epfix->mclk) { - epfix->mclk = epfix->clki; - mclk_cfg = 0x00; - } - if (epfix->busclk/2 <= MAX_PIXCLOCK && epfix->busclk/2 > epfix->mclk) { - epfix->mclk = epfix->busclk/2; - mclk_cfg = 0x11; - } - if (epfix->clki/2 <= MAX_PIXCLOCK && epfix->clki/2 > epfix->mclk) { - epfix->mclk = epfix->clki/2; - mclk_cfg = 0x10; + else { + // Find the highest allowable MCLK + if (epfix->busclk <= MAX_PIXCLOCK && + epfix->busclk > epfix->mclk) { + epfix->mclk = epfix->busclk; + mclk_cfg = 0x01; + } + if (epfix->clki <= MAX_PIXCLOCK && epfix->clki > epfix->mclk) { + epfix->mclk = epfix->clki; + mclk_cfg = 0x00; + } + if (epfix->busclk/2 <= MAX_PIXCLOCK && + epfix->busclk/2 > epfix->mclk) { + epfix->mclk = epfix->busclk/2; + mclk_cfg = 0x11; + } + if (epfix->clki/2 <= MAX_PIXCLOCK && + epfix->clki/2 > epfix->mclk) { + epfix->mclk = epfix->clki/2; + mclk_cfg = 0x10; + } } if (!epfix->mclk) { @@ -2326,7 +2367,7 @@ ®->clk_cfg->mem_clk_cfg); writeb(mclk_cfg, ®->clk_cfg->mem_clk_cfg); - printk("e1356fb: clocks (kHz): busclk=%d, mclk=%d, clki=%d, clki2=%d\n", + printk("e1356fb: clocks (kHz): busclk=%d mclk=%d clki=%d clki2=%d\n", epfix->busclk, epfix->mclk, epfix->clki, epfix->clki2); // Set max pixel clock @@ -2353,7 +2394,9 @@ if (readb(®->md_cfg->md_cfg_stat1) & (1<<4)) periodBCLK *= 2; - if (periodMCLK - 4 > periodBCLK) + if ((epfix->system == SYS_PB1000) || (epfix->system == SYS_PB1500)) + writeb(0x00, ®->clk_cfg->cpu2mem_wait_sel); + else if (periodMCLK - 4 > periodBCLK) writeb(0x02, ®->clk_cfg->cpu2mem_wait_sel); else if (2*periodMCLK - 4 > periodBCLK) writeb(0x01, ®->clk_cfg->cpu2mem_wait_sel); @@ -2362,7 +2405,7 @@ // Program memory config if (epfix->mem_type < MEM_TYPE_EDO_2CAS || - epfix->mem_type > MEM_TYPE_FPM_2WE) { + epfix->mem_type > MEM_TYPE_EMBEDDED_SDRAM) { printk("e1356fb: bad memory type specified\n"); goto ret_enxio; } @@ -2577,7 +2620,6 @@ GET_FB_IDX(fb_info.fb_info.node), fb_info.fb_info.modename); - MOD_INC_USE_COUNT; return 0; @@ -2625,7 +2667,6 @@ module_exit(e1356fb_exit); -#ifndef MODULE void e1356fb_setup(char *options, int *ints) { @@ -2735,6 +2776,9 @@ if (!strncmp(this_opt+7, "pb1000", 10)) { boot_fix = systems[SYS_PB1000].fix; boot_par = systems[SYS_PB1000].par; + } else if (!strncmp(this_opt+7, "pb1500", 7)) { + boot_fix = systems[SYS_PB1500].fix; + boot_par = systems[SYS_PB1500].par; } else if (!strncmp(this_opt+7, "sdu1356", 7)) { boot_fix = systems[SYS_SDU1356].fix; boot_par = systems[SYS_SDU1356].par; @@ -2747,7 +2791,6 @@ } } } -#endif /* Index: epson1356fb.h =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/video/epson1356fb.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- epson1356fb.h 10 Oct 2001 19:21:06 -0000 1.5 +++ epson1356fb.h 7 Mar 2002 23:30:22 -0000 1.6 @@ -66,8 +66,10 @@ #define REG_BASE_GENIO 0x04 typedef struct { u8 gpio_cfg; // 04 - u8 spacer[3]; // 05 + u8 gpio_cfg2; // 05 SED13806 + u8 spacer[2]; // 06 u8 gpio_ctrl; // 08 + u8 gpio_ctrl2; // 09 SED13806 } reg_genio_t; // MD Config Readback @@ -264,7 +266,8 @@ MEM_TYPE_EDO_2CAS = 0, MEM_TYPE_FPM_2CAS, MEM_TYPE_EDO_2WE, - MEM_TYPE_FPM_2WE + MEM_TYPE_FPM_2WE, + MEM_TYPE_EMBEDDED_SDRAM = 0x80 }; enum mem_smr_t { @@ -448,7 +451,9 @@ // The following are boot options for particular SED1356-based target systems enum { + SYS_NULL, SYS_PB1000, + SYS_PB1500, SYS_SDU1356, SYS_CLIO1050, NUM_SYSTEMS // must be last @@ -458,8 +463,21 @@ struct e1356fb_fix fix; struct e1356fb_par par; } systems[NUM_SYSTEMS] = { + /* - * Alchemy Pb1000 evaluation board + * NULL system to help us detect missing options + * when the driver is compiled as a module. + */ + { + { // fix + SYS_NULL, + }, + { // par + } + }, + + /* + * Alchemy Pb1000 evaluation board, SED1356 */ { { // fix @@ -508,7 +526,54 @@ "800x600@60" }, { // par - 0, 0, 1024, 768, 8, 1, + 0, 0, 800, 600, 8, 1, + // timings will be set by modedb + {0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 256 + } + }, + + /* + * Alchemy Pb1500 evaluation board, SED13806 + */ + { + { // fix + SYS_PB1500, + /* + * Note!: these are "pseudo" physical addresses; + * the SED1356 is not actually mapped here, but rather + * at the 36-bit address of 0xE 0000 0000. There is an + * ugly hack in the Au1000 TLB refill handler that will + * translate pte_t's in the range 0xE000 0000 --> + * 0xEFFF FFFF to the 36-bit range 0xE 0000 0000 --> + * 0xE 0FFF FFFF. The long-term solution is to support + * 36-bit physical addresses in linux-mips32 mm, since + * the mips32 specification specifically supports this. + */ + 0xE0000000, 0xE0200000, + 50, MEM_TYPE_EMBEDDED_SDRAM, 64, MEM_SMR_CBR, + 0, 0, // BUSCLK and MCLK are calculated at run-time + 40000, 14318, // CLKI, CLKI2 +#ifdef CONFIG_PB1500_CRT + DISP_TYPE_CRT, + 0, 0, // TV Options + 0, 0, // Panel options +#else + DISP_TYPE_TFT, + 0, 0, // TV Options + 0, 12, // Panel options, EL panel?, data width? +#endif + 0, 0, +#ifdef CONFIG_MTRR + 0, +#endif + 0, + 0, + {0}, + "800x600@60" + }, + { // par + 0, 0, 800, 600, 8, 1, // timings will be set by modedb {0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 256 |