s3c2410fb: add margin fields to s3c2410fb_display
[safe/jmp/linux-2.6] / arch / arm / mach-s3c2410 / mach-bast.c
index 4d96271..1b4f9f9 100644 (file)
@@ -8,31 +8,6 @@
  * 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.
- *
- * Modifications:
- *     14-Sep-2004 BJD  USB power control
- *     20-Aug-2004 BJD  Added s3c2410_board struct
- *     18-Aug-2004 BJD  Added platform devices from default set
- *     16-May-2003 BJD  Created initial version
- *     16-Aug-2003 BJD  Fixed header files and copyright, added URL
- *     05-Sep-2003 BJD  Moved to v2.6 kernel
- *     06-Jan-2003 BJD  Updates for <arch/map.h>
- *     18-Jan-2003 BJD  Added serial port configuration
- *     05-Oct-2004 BJD  Power management code
- *     04-Nov-2004 BJD  Updated serial port clocks
- *     04-Jan-2005 BJD  New uart init call
- *     10-Jan-2005 BJD  Removed include of s3c2410.h
- *     14-Jan-2005 BJD  Add support for muitlple NAND devices
- *     03-Mar-2005 BJD  Ensured that bast-cpld.h is included
- *     10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
- *     14-Mar-2005 BJD  Updated for __iomem changes
- *     22-Jun-2005 BJD  Added DM9000 platform information
- *     28-Jun-2005 BJD  Moved pm functionality out to common code
- *     17-Jul-2005 BJD  Changed to platform device for SuperIO 16550s
- *     25-Jul-2005 BJD  Removed ASIX static mappings
- *     27-Jul-2005 BJD  Ensure maximum frequency of i2c bus
- *     20-Sep-2005 BJD  Added static to non-exported items
- *     26-Oct-2005 BJD  Added FB platform data
 */
 
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/timer.h>
 #include <linux/init.h>
+#include <linux/serial_core.h>
 #include <linux/platform_device.h>
 #include <linux/dm9000.h>
 
+#include <net/ax88796.h>
+
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
 
 //#include <asm/debug-ll.h>
-#include <asm/arch/regs-serial.h>
+#include <asm/plat-s3c/regs-serial.h>
 #include <asm/arch/regs-gpio.h>
 #include <asm/arch/regs-mem.h>
 #include <asm/arch/regs-lcd.h>
 
-#include <asm/arch/nand.h>
-#include <asm/arch/iic.h>
+#include <asm/plat-s3c/nand.h>
+#include <asm/plat-s3c/iic.h>
 #include <asm/arch/fb.h>
 
 #include <linux/mtd/mtd.h>
@@ -74,9 +52,9 @@
 
 #include <linux/serial_8250.h>
 
-#include "clock.h"
-#include "devs.h"
-#include "cpu.h"
+#include <asm/plat-s3c24xx/clock.h>
+#include <asm/plat-s3c24xx/devs.h>
+#include <asm/plat-s3c24xx/cpu.h>
 #include "usb-simtec.h"
 
 #define COPYRIGHT ", (c) 2004-2005 Simtec Electronics"
@@ -208,7 +186,7 @@ static struct s3c24xx_uart_clksrc bast_serial_clocks[] = {
 };
 
 
-static struct s3c2410_uartcfg bast_uartcfgs[] = {
+static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
        [0] = {
                .hwport      = 0,
                .flags       = 0,
@@ -433,38 +411,245 @@ static struct s3c2410_platform_i2c bast_i2c_info = {
        .max_freq       = 130*1000,
 };
 
+/* Asix AX88796 10/100 ethernet controller */
 
-static struct s3c2410fb_mach_info __initdata bast_lcd_info = {
-       .width          = 640,
-       .height         = 480,
+static struct ax_plat_data bast_asix_platdata = {
+       .flags          = AXFLG_MAC_FROMDEV,
+       .wordlength     = 2,
+       .dcr_val        = 0x48,
+       .rcr_val        = 0x40,
+};
 
-       .xres           = {
-               .min            = 320,
-               .max            = 1024,
-               .defval         = 640,
+static struct resource bast_asix_resource[] = {
+       [0] = {
+               .start = S3C2410_CS5 + BAST_PA_ASIXNET,
+               .end   = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20) - 1,
+               .flags = IORESOURCE_MEM,
        },
-
-       .yres           = {
-               .min            = 240,
-               .max            = 600,
-               .defval         = 480,
+       [1] = {
+               .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20),
+               .end   = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20),
+               .flags = IORESOURCE_MEM,
        },
+       [2] = {
+               .start = IRQ_ASIX,
+               .end   = IRQ_ASIX,
+               .flags = IORESOURCE_IRQ
+       }
+};
 
-       .bpp            = {
-               .min            = 4,
-               .max            = 16,
-               .defval         = 8,
-       },
+static struct platform_device bast_device_asix = {
+       .name           = "ax88796",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(bast_asix_resource),
+       .resource       = bast_asix_resource,
+       .dev            = {
+               .platform_data = &bast_asix_platdata
+       }
+};
 
-       .regs           = {
-               .lcdcon1        = 0x00000176,
-               .lcdcon2        = 0x1d77c7c2,
-               .lcdcon3        = 0x013a7f13,
-               .lcdcon4        = 0x00000057,
-               .lcdcon5        = 0x00014b02,
+/* Asix AX88796 10/100 ethernet controller parallel port */
+
+static struct resource bast_asixpp_resource[] = {
+       [0] = {
+               .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20),
+               .end   = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1b * 0x20) - 1,
+               .flags = IORESOURCE_MEM,
        }
 };
 
+static struct platform_device bast_device_axpp = {
+       .name           = "ax88796-pp",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(bast_asixpp_resource),
+       .resource       = bast_asixpp_resource,
+};
+
+/* LCD/VGA controller */
+
+static struct s3c2410fb_display __initdata bast_lcd_info[] = {
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+               .xres           = 320,
+               .yres           = 240,
+               .left_margin    = 40,
+               .right_margin   = 20,
+
+               .bpp            = 4,
+
+               .regs           = {
+                       .lcdcon1        = 0x00000176,
+                       .lcdcon2        = 0x1d77c7c2,
+                       .lcdcon3        = 0x013a7f13,
+                       .lcdcon4        = 0x00000057,
+                       .lcdcon5        = 0x00014b02,
+               }
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .xres           = 640,
+               .yres           = 480,
+               .bpp            = 4,
+               .left_margin    = 40,
+               .right_margin   = 20,
+
+               .regs           = {
+                       .lcdcon1        = 0x00000176,
+                       .lcdcon2        = 0x1d77c7c2,
+                       .lcdcon3        = 0x013a7f13,
+                       .lcdcon4        = 0x00000057,
+                       .lcdcon5        = 0x00014b02,
+               }
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .xres           = 800,
+               .yres           = 600,
+               .bpp            = 4,
+               .left_margin    = 40,
+               .right_margin   = 20,
+
+               .regs           = {
+                       .lcdcon1        = 0x00000176,
+                       .lcdcon2        = 0x1d77c7c2,
+                       .lcdcon3        = 0x013a7f13,
+                       .lcdcon4        = 0x00000057,
+                       .lcdcon5        = 0x00014b02,
+               }
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .xres           = 320,
+               .yres           = 240,
+               .bpp            = 8,
+               .left_margin    = 40,
+               .right_margin   = 20,
+
+               .regs           = {
+                       .lcdcon1        = 0x00000176,
+                       .lcdcon2        = 0x1d77c7c2,
+                       .lcdcon3        = 0x013a7f13,
+                       .lcdcon4        = 0x00000057,
+                       .lcdcon5        = 0x00014b02,
+               }
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .xres           = 640,
+               .yres           = 480,
+               .bpp            = 8,
+               .left_margin    = 40,
+               .right_margin   = 20,
+
+               .regs           = {
+                       .lcdcon1        = 0x00000176,
+                       .lcdcon2        = 0x1d77c7c2,
+                       .lcdcon3        = 0x013a7f13,
+                       .lcdcon4        = 0x00000057,
+                       .lcdcon5        = 0x00014b02,
+               }
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .xres           = 800,
+               .yres           = 600,
+               .bpp            = 8,
+               .left_margin    = 40,
+               .right_margin   = 20,
+
+               .regs           = {
+                       .lcdcon1        = 0x00000176,
+                       .lcdcon2        = 0x1d77c7c2,
+                       .lcdcon3        = 0x013a7f13,
+                       .lcdcon4        = 0x00000057,
+                       .lcdcon5        = 0x00014b02,
+               }
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .xres           = 320,
+               .yres           = 240,
+               .bpp            = 16,
+               .left_margin    = 40,
+               .right_margin   = 20,
+
+               .regs           = {
+                       .lcdcon1        = 0x00000176,
+                       .lcdcon2        = 0x1d77c7c2,
+                       .lcdcon3        = 0x013a7f13,
+                       .lcdcon4        = 0x00000057,
+                       .lcdcon5        = 0x00014b02,
+               }
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .xres           = 640,
+               .yres           = 480,
+               .bpp            = 16,
+               .left_margin    = 40,
+               .right_margin   = 20,
+
+               .regs           = {
+                       .lcdcon1        = 0x00000176,
+                       .lcdcon2        = 0x1d77c7c2,
+                       .lcdcon3        = 0x013a7f13,
+                       .lcdcon4        = 0x00000057,
+                       .lcdcon5        = 0x00014b02,
+               }
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .xres           = 800,
+               .yres           = 600,
+               .bpp            = 16,
+               .left_margin    = 40,
+               .right_margin   = 20,
+
+               .regs           = {
+                       .lcdcon1        = 0x00000176,
+                       .lcdcon2        = 0x1d77c7c2,
+                       .lcdcon3        = 0x013a7f13,
+                       .lcdcon4        = 0x00000057,
+                       .lcdcon5        = 0x00014b02,
+               }
+       },
+};
+
+/* LCD/VGA controller */
+
+static struct s3c2410fb_mach_info __initdata bast_fb_info = {
+
+       .displays = bast_lcd_info,
+       .num_displays = ARRAY_SIZE(bast_lcd_info),
+       .default_display = 4,
+};
+
 /* Standard BAST devices */
 
 static struct platform_device *bast_devices[] __initdata = {
@@ -477,6 +662,8 @@ static struct platform_device *bast_devices[] __initdata = {
        &s3c_device_nand,
        &bast_device_nor,
        &bast_device_dm9k,
+       &bast_device_asix,
+       &bast_device_axpp,
        &bast_sio,
 };
 
@@ -488,13 +675,6 @@ static struct clk *bast_clocks[] = {
        &s3c24xx_uclk,
 };
 
-static struct s3c24xx_board bast_board __initdata = {
-       .devices       = bast_devices,
-       .devices_count = ARRAY_SIZE(bast_devices),
-       .clocks        = bast_clocks,
-       .clocks_count  = ARRAY_SIZE(bast_clocks),
-};
-
 static void __init bast_map_io(void)
 {
        /* initialise the clocks */
@@ -510,24 +690,26 @@ static void __init bast_map_io(void)
 
        s3c24xx_uclk.parent  = &s3c24xx_clkout1;
 
+       s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
+
        s3c_device_nand.dev.platform_data = &bast_nand_info;
        s3c_device_i2c.dev.platform_data = &bast_i2c_info;
 
        s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
        s3c24xx_init_clocks(0);
        s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
-       s3c24xx_set_board(&bast_board);
+
        usb_simtec_init();
 }
 
 static void __init bast_init(void)
 {
-       s3c24xx_fb_set_platdata(&bast_lcd_info);
+       s3c24xx_fb_set_platdata(&bast_fb_info);
+       platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
 }
 
 MACHINE_START(BAST, "Simtec-BAST")
        /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
-       .phys_ram       = S3C2410_SDRAM_PA,
        .phys_io        = S3C2410_PA_UART,
        .io_pg_offst    = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
        .boot_params    = S3C2410_SDRAM_PA + 0x100,