fbdev: s3c2410fb: remove mach header dependency
authorArnd Bergmann <arnd@arndb.de>
Mon, 2 Sep 2019 20:33:24 +0000 (22:33 +0200)
committerKrzysztof Kozlowski <krzk@kernel.org>
Thu, 20 Aug 2020 15:48:12 +0000 (17:48 +0200)
The s3c2410fb driver is too deeply intertwined with the s3c24xx
platform code. Change it in a way that avoids the use of platform
header files but having all interface data in a platform_data
header, and the private register definitions next to the driver
itself.

One ugly bit here is that the driver pokes directly into gpio
registers, which are owned by another driver. Passing the
mapped addresses in platform_data is somewhat suboptimal, but
it is a small improvement over the previous version.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200806182059.2431-33-krzk@kernel.org
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
25 files changed:
arch/arm/mach-s3c24xx/include/mach/fb.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/regs-lcd.h [deleted file]
arch/arm/mach-s3c24xx/mach-amlm5900.c
arch/arm/mach-s3c24xx/mach-anubis.c
arch/arm/mach-s3c24xx/mach-at2440evb.c
arch/arm/mach-s3c24xx/mach-bast.c
arch/arm/mach-s3c24xx/mach-gta02.c
arch/arm/mach-s3c24xx/mach-h1940.c
arch/arm/mach-s3c24xx/mach-jive.c
arch/arm/mach-s3c24xx/mach-mini2440.c
arch/arm/mach-s3c24xx/mach-n30.c
arch/arm/mach-s3c24xx/mach-osiris.c
arch/arm/mach-s3c24xx/mach-qt2410.c
arch/arm/mach-s3c24xx/mach-rx1950.c
arch/arm/mach-s3c24xx/mach-rx3715.c
arch/arm/mach-s3c24xx/mach-smdk2413.c
arch/arm/mach-s3c24xx/mach-smdk2416.c
arch/arm/mach-s3c24xx/mach-smdk2440.c
arch/arm/mach-s3c24xx/mach-smdk2443.c
arch/arm/mach-s3c24xx/mach-vstms.c
arch/arm/plat-samsung/devs.c
arch/arm/plat-samsung/include/plat/fb-s3c2410.h [deleted file]
drivers/video/fbdev/s3c2410fb-regs-lcd.h [new file with mode: 0644]
drivers/video/fbdev/s3c2410fb.c
include/linux/platform_data/fb-s3c2410.h [new file with mode: 0644]

diff --git a/arch/arm/mach-s3c24xx/include/mach/fb.h b/arch/arm/mach-s3c24xx/include/mach/fb.h
deleted file mode 100644 (file)
index 4e539cb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <plat/fb-s3c2410.h>
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-lcd.h b/arch/arm/mach-s3c24xx/include/mach/regs-lcd.h
deleted file mode 100644 (file)
index 4c3434f..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
- *                   http://www.simtec.co.uk/products/SWLINUX/
- */
-
-#ifndef ___ASM_ARCH_REGS_LCD_H
-#define ___ASM_ARCH_REGS_LCD_H
-
-#define S3C2410_LCDREG(x)      (x)
-
-/* LCD control registers */
-#define S3C2410_LCDCON1            S3C2410_LCDREG(0x00)
-#define S3C2410_LCDCON2            S3C2410_LCDREG(0x04)
-#define S3C2410_LCDCON3            S3C2410_LCDREG(0x08)
-#define S3C2410_LCDCON4            S3C2410_LCDREG(0x0C)
-#define S3C2410_LCDCON5            S3C2410_LCDREG(0x10)
-
-#define S3C2410_LCDCON1_CLKVAL(x)  ((x) << 8)
-#define S3C2410_LCDCON1_MMODE     (1<<7)
-#define S3C2410_LCDCON1_DSCAN4    (0<<5)
-#define S3C2410_LCDCON1_STN4      (1<<5)
-#define S3C2410_LCDCON1_STN8      (2<<5)
-#define S3C2410_LCDCON1_TFT       (3<<5)
-
-#define S3C2410_LCDCON1_STN1BPP           (0<<1)
-#define S3C2410_LCDCON1_STN2GREY   (1<<1)
-#define S3C2410_LCDCON1_STN4GREY   (2<<1)
-#define S3C2410_LCDCON1_STN8BPP           (3<<1)
-#define S3C2410_LCDCON1_STN12BPP   (4<<1)
-
-#define S3C2410_LCDCON1_TFT1BPP           (8<<1)
-#define S3C2410_LCDCON1_TFT2BPP           (9<<1)
-#define S3C2410_LCDCON1_TFT4BPP           (10<<1)
-#define S3C2410_LCDCON1_TFT8BPP           (11<<1)
-#define S3C2410_LCDCON1_TFT16BPP   (12<<1)
-#define S3C2410_LCDCON1_TFT24BPP   (13<<1)
-
-#define S3C2410_LCDCON1_ENVID     (1)
-
-#define S3C2410_LCDCON1_MODEMASK    0x1E
-
-#define S3C2410_LCDCON2_VBPD(x)            ((x) << 24)
-#define S3C2410_LCDCON2_LINEVAL(x)  ((x) << 14)
-#define S3C2410_LCDCON2_VFPD(x)            ((x) << 6)
-#define S3C2410_LCDCON2_VSPW(x)            ((x) << 0)
-
-#define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF)
-#define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >>  6) & 0xFF)
-#define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >>  0) & 0x3F)
-
-#define S3C2410_LCDCON3_HBPD(x)            ((x) << 19)
-#define S3C2410_LCDCON3_WDLY(x)            ((x) << 19)
-#define S3C2410_LCDCON3_HOZVAL(x)   ((x) << 8)
-#define S3C2410_LCDCON3_HFPD(x)            ((x) << 0)
-#define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0)
-
-#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F)
-#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >>  0) & 0xFF)
-
-/* LDCCON4 changes for STN mode on the S3C2412 */
-
-#define S3C2410_LCDCON4_MVAL(x)            ((x) << 8)
-#define S3C2410_LCDCON4_HSPW(x)            ((x) << 0)
-#define S3C2410_LCDCON4_WLH(x)     ((x) << 0)
-
-#define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >>  0) & 0xFF)
-
-#define S3C2410_LCDCON5_BPP24BL            (1<<12)
-#define S3C2410_LCDCON5_FRM565     (1<<11)
-#define S3C2410_LCDCON5_INVVCLK            (1<<10)
-#define S3C2410_LCDCON5_INVVLINE    (1<<9)
-#define S3C2410_LCDCON5_INVVFRAME   (1<<8)
-#define S3C2410_LCDCON5_INVVD      (1<<7)
-#define S3C2410_LCDCON5_INVVDEN            (1<<6)
-#define S3C2410_LCDCON5_INVPWREN    (1<<5)
-#define S3C2410_LCDCON5_INVLEND            (1<<4)
-#define S3C2410_LCDCON5_PWREN      (1<<3)
-#define S3C2410_LCDCON5_ENLEND     (1<<2)
-#define S3C2410_LCDCON5_BSWP       (1<<1)
-#define S3C2410_LCDCON5_HWSWP      (1<<0)
-
-/* framebuffer start addressed */
-#define S3C2410_LCDSADDR1   S3C2410_LCDREG(0x14)
-#define S3C2410_LCDSADDR2   S3C2410_LCDREG(0x18)
-#define S3C2410_LCDSADDR3   S3C2410_LCDREG(0x1C)
-
-#define S3C2410_LCDBANK(x)     ((x) << 21)
-#define S3C2410_LCDBASEU(x)    (x)
-
-#define S3C2410_OFFSIZE(x)     ((x) << 11)
-#define S3C2410_PAGEWIDTH(x)   (x)
-
-/* colour lookup and miscellaneous controls */
-
-#define S3C2410_REDLUT    S3C2410_LCDREG(0x20)
-#define S3C2410_GREENLUT   S3C2410_LCDREG(0x24)
-#define S3C2410_BLUELUT           S3C2410_LCDREG(0x28)
-
-#define S3C2410_DITHMODE   S3C2410_LCDREG(0x4C)
-#define S3C2410_TPAL      S3C2410_LCDREG(0x50)
-
-#define S3C2410_TPAL_EN                (1<<24)
-
-/* interrupt info */
-#define S3C2410_LCDINTPND  S3C2410_LCDREG(0x54)
-#define S3C2410_LCDSRCPND  S3C2410_LCDREG(0x58)
-#define S3C2410_LCDINTMSK  S3C2410_LCDREG(0x5C)
-#define S3C2410_LCDINT_FIWSEL  (1<<2)
-#define        S3C2410_LCDINT_FRSYNC   (1<<1)
-#define S3C2410_LCDINT_FICNT   (1<<0)
-
-/* s3c2442 extra stn registers */
-
-#define S3C2442_REDLUT         S3C2410_LCDREG(0x20)
-#define S3C2442_GREENLUT       S3C2410_LCDREG(0x24)
-#define S3C2442_BLUELUT                S3C2410_LCDREG(0x28)
-#define S3C2442_DITHMODE       S3C2410_LCDREG(0x20)
-
-#define S3C2410_LPCSEL    S3C2410_LCDREG(0x60)
-
-#define S3C2410_TFTPAL(x)  S3C2410_LCDREG((0x400 + (x)*4))
-
-/* S3C2412 registers */
-
-#define S3C2412_TPAL           S3C2410_LCDREG(0x20)
-
-#define S3C2412_LCDINTPND      S3C2410_LCDREG(0x24)
-#define S3C2412_LCDSRCPND      S3C2410_LCDREG(0x28)
-#define S3C2412_LCDINTMSK      S3C2410_LCDREG(0x2C)
-
-#define S3C2412_TCONSEL                S3C2410_LCDREG(0x30)
-
-#define S3C2412_LCDCON6                S3C2410_LCDREG(0x34)
-#define S3C2412_LCDCON7                S3C2410_LCDREG(0x38)
-#define S3C2412_LCDCON8                S3C2410_LCDREG(0x3C)
-#define S3C2412_LCDCON9                S3C2410_LCDREG(0x40)
-
-#define S3C2412_REDLUT(x)      S3C2410_LCDREG(0x44 + ((x)*4))
-#define S3C2412_GREENLUT(x)    S3C2410_LCDREG(0x60 + ((x)*4))
-#define S3C2412_BLUELUT(x)     S3C2410_LCDREG(0x98 + ((x)*4))
-
-#define S3C2412_FRCPAT(x)      S3C2410_LCDREG(0xB4 + ((x)*4))
-
-/* general registers */
-
-/* base of the LCD registers, where INTPND, INTSRC and then INTMSK
- * are available. */
-
-#define S3C2410_LCDINTBASE     S3C2410_LCDREG(0x54)
-#define S3C2412_LCDINTBASE     S3C2410_LCDREG(0x24)
-
-#define S3C24XX_LCDINTPND      (0x00)
-#define S3C24XX_LCDSRCPND      (0x04)
-#define S3C24XX_LCDINTMSK      (0x08)
-
-#endif /* ___ASM_ARCH_REGS_LCD_H */
index 1a2a925..f04eb9a 100644 (file)
@@ -29,9 +29,8 @@
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
-#include <mach/regs-lcd.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
 
@@ -191,13 +190,17 @@ static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
 
        .gpccon =       0xaaaaaaaa,
        .gpccon_mask =  0xffffffff,
+       .gpccon_reg =   S3C2410_GPCCON,
        .gpcup =        0x0000ffff,
        .gpcup_mask =   0xffffffff,
+       .gpcup_reg =    S3C2410_GPCUP,
 
        .gpdcon =       0xaaaaaaaa,
        .gpdcon_mask =  0xffffffff,
+       .gpdcon_reg =   S3C2410_GPDCON,
        .gpdup =        0x0000ffff,
        .gpdup_mask =   0xffffffff,
+       .gpdup_reg =    S3C2410_GPDUP,
 };
 #endif
 
index 753a314..15cab09 100644 (file)
@@ -28,7 +28,6 @@
 #include <asm/mach-types.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
index a269324..7fcb24a 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
index 9eef0f8..3068912 100644 (file)
@@ -40,9 +40,8 @@
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 
 #include <plat/cpu.h>
index c023e26..a28e921 100644 (file)
@@ -57,8 +57,8 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/usb-ohci-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
-#include <mach/fb.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-irq.h>
 #include <mach/gpio-samsung.h>
index e9b3b04..d458258 100644 (file)
 
 #include <sound/uda1380.h>
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <mach/hardware.h>
 #include <mach/regs-clock.h>
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 
 #include <plat/cpu.h>
@@ -210,12 +209,16 @@ static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
        .lpcsel =       0x02,
        .gpccon =       0xaa940659,
        .gpccon_mask =  0xffffc0f0,
+       .gpccon_reg =   S3C2410_GPCCON,
        .gpcup =        0x0000ffff,
        .gpcup_mask =   0xffffffff,
+       .gpcup_reg =    S3C2410_GPCUP,
        .gpdcon =       0xaa84aaa0,
        .gpdcon_mask =  0xffffffff,
+       .gpdcon_reg =   S3C2410_GPDCON,
        .gpdup =        0x0000faff,
        .gpdup_mask =   0xffffffff,
+       .gpdup_reg =    S3C2410_GPDUP,
 };
 
 static int power_supply_init(struct device *dev)
index 2c630ad..ec6c40e 100644 (file)
@@ -32,8 +32,7 @@
 #include <linux/platform_data/i2c-s3c2410.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <mach/gpio-samsung.h>
 
 #include <asm/mach-types.h>
@@ -320,6 +319,7 @@ static struct s3c2410fb_mach_info jive_lcd_config = {
         * data. */
 
        .gpcup          = (0xf << 1) | (0x3f << 10),
+       .gpcup_reg      = S3C2410_GPCUP,
 
        .gpccon         = (S3C2410_GPC1_VCLK   | S3C2410_GPC2_VLINE |
                           S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
@@ -333,8 +333,12 @@ static struct s3c2410fb_mach_info jive_lcd_config = {
                           S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
                           S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
 
+       .gpccon_reg     = S3C2410_GPCCON,
+
        .gpdup          = (0x3f << 2) | (0x3f << 10),
 
+       .gpdup_reg      = S3C2410_GPDUP,
+
        .gpdcon         = (S3C2410_GPD2_VD10  | S3C2410_GPD3_VD11 |
                           S3C2410_GPD4_VD12  | S3C2410_GPD5_VD13 |
                           S3C2410_GPD6_VD14  | S3C2410_GPD7_VD15 |
@@ -348,6 +352,8 @@ static struct s3c2410fb_mach_info jive_lcd_config = {
                           S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
                           S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
                           S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
+
+       .gpdcon_reg     = S3C2410_GPDCON,
 };
 
 /* ILI9320 support. */
index d3cc014..6f58a34 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <asm/mach-types.h>
 
 #include <mach/regs-gpio.h>
 #include <linux/platform_data/leds-s3c24xx.h>
-#include <mach/regs-lcd.h>
 #include <mach/irqs.h>
 #include <mach/gpio-samsung.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
@@ -213,6 +212,9 @@ static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
                           S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
                           S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
 
+       .gpccon_reg     = S3C2410_GPCCON,
+       .gpcup_reg      = S3C2410_GPCUP,
+
        .gpdup          = (0x3f << 2) | (0x3f << 10),
 
        .gpdcon         = (S3C2410_GPD2_VD10  | S3C2410_GPD3_VD11 |
@@ -228,6 +230,9 @@ static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
                           S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
                           S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
                           S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
+
+       .gpdcon_reg     = S3C2410_GPDCON,
+       .gpdup_reg      = S3C2410_GPDUP,
 };
 
 /* MMC/SD  */
index 24e9764..a3c1315 100644 (file)
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/leds-s3c24xx.h>
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 #include <plat/gpio-cfg.h>
 
index 0359514..ed10a32 100644 (file)
@@ -42,7 +42,6 @@
 #include <plat/gpio-cfg.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 
 #include "common.h"
index b21f7fb..1ccad4e 100644 (file)
@@ -32,8 +32,7 @@
 #include <asm/mach-types.h>
 
 #include <linux/platform_data/leds-s3c24xx.h>
-#include <mach/regs-lcd.h>
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
index aa91785..2513ce7 100644 (file)
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
 #include <sound/uda1380.h>
 
-#include <mach/fb.h>
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 
 #include <plat/cpu.h>
@@ -360,14 +359,17 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
        .lpcsel = 0x02,
        .gpccon = 0xaa9556a9,
        .gpccon_mask = 0xffc003fc,
+       .gpccon_reg = S3C2410_GPCCON,
        .gpcup = 0x0000ffff,
        .gpcup_mask = 0xffffffff,
+       .gpcup_reg = S3C2410_GPCUP,
 
        .gpdcon = 0xaa90aaa1,
        .gpdcon_mask = 0xffc0fff0,
+       .gpdcon_reg = S3C2410_GPDCON,
        .gpdup = 0x0000fcfd,
        .gpdup_mask = 0xffffffff,
-
+       .gpdup_reg = S3C2410_GPDUP,
 };
 
 static struct pwm_lookup rx1950_pwm_lookup[] = {
index fc197ce..0eb45f1 100644 (file)
 #include <asm/mach/map.h>
 
 #include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/fb.h>
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 #include <plat/gpio-cfg.h>
 
@@ -124,13 +123,17 @@ static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
 
        .gpccon =       0xaa955699,
        .gpccon_mask =  0xffc003cc,
+       .gpccon_reg =   S3C2410_GPCCON,
        .gpcup =        0x0000ffff,
        .gpcup_mask =   0xffffffff,
+       .gpcup_reg =    S3C2410_GPCUP,
 
        .gpdcon =       0xaa95aaa1,
        .gpdcon_mask =  0xffc0fff0,
+       .gpdcon_reg =   S3C2410_GPDCON,
        .gpdup =        0x0000faff,
        .gpdup_mask =   0xffffffff,
+       .gpdup_reg =    S3C2410_GPDUP,
 };
 
 static struct mtd_partition __initdata rx3715_nand_part[] = {
index 287bd50..4604ec8 100644 (file)
 
 //#include <asm/debug-ll.h>
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <mach/gpio-samsung.h>
-#include <mach/fb.h>
 #include <plat/gpio-cfg.h>
 
 #include <plat/devs.h>
index f98feb4..217401b 100644 (file)
@@ -30,7 +30,6 @@
 #include <asm/mach-types.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/regs-s3c2443-clock.h>
 #include <mach/gpio-samsung.h>
 
index 5939372..a0116cf 100644 (file)
 #include <asm/mach-types.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 #include <plat/gpio-cfg.h>
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 
 #include <plat/devs.h>
@@ -137,6 +136,11 @@ static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
        .gpdcon_mask    = 0xffffffff,
        .gpdup          = 0x0000faff,
        .gpdup_mask     = 0xffffffff,
+
+       .gpccon_reg     = S3C2410_GPCCON,
+       .gpcup_reg      = S3C2410_GPCUP,
+       .gpdcon_reg     = S3C2410_GPDCON,
+       .gpdup_reg      = S3C2410_GPDUP,
 #endif
 
        .lpcsel         = ((0xCE6) & ~7) | 1<<4,
index 8a1f258..1c2fa7c 100644 (file)
@@ -26,9 +26,8 @@
 #include <asm/mach-types.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 
 #include <plat/devs.h>
index c6e777a..ff3fa00 100644 (file)
 #include <asm/mach-types.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
 #include <mach/gpio-samsung.h>
 #include <plat/gpio-cfg.h>
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
index b16be04..e232041 100644 (file)
@@ -52,7 +52,7 @@
 #include <linux/soc/samsung/s3c-adc.h>
 #include <linux/platform_data/ata-samsung_cf.h>
 #include <plat/fb.h>
-#include <plat/fb-s3c2410.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/hwmon-s3c.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/keypad.h>
diff --git a/arch/arm/plat-samsung/include/plat/fb-s3c2410.h b/arch/arm/plat-samsung/include/plat/fb-s3c2410.h
deleted file mode 100644 (file)
index 614240d..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org>
- *
- * Inspired by pxafb.h
-*/
-
-#ifndef __ASM_PLAT_FB_S3C2410_H
-#define __ASM_PLAT_FB_S3C2410_H __FILE__
-
-struct s3c2410fb_hw {
-       unsigned long   lcdcon1;
-       unsigned long   lcdcon2;
-       unsigned long   lcdcon3;
-       unsigned long   lcdcon4;
-       unsigned long   lcdcon5;
-};
-
-/* LCD description */
-struct s3c2410fb_display {
-       /* LCD type */
-       unsigned type;
-
-       /* Screen size */
-       unsigned short width;
-       unsigned short height;
-
-       /* Screen info */
-       unsigned short xres;
-       unsigned short yres;
-       unsigned short bpp;
-
-       unsigned pixclock;              /* pixclock in picoseconds */
-       unsigned short left_margin;  /* value in pixels (TFT) or HCLKs (STN) */
-       unsigned short right_margin; /* value in pixels (TFT) or HCLKs (STN) */
-       unsigned short hsync_len;    /* value in pixels (TFT) or HCLKs (STN) */
-       unsigned short upper_margin;    /* value in lines (TFT) or 0 (STN) */
-       unsigned short lower_margin;    /* value in lines (TFT) or 0 (STN) */
-       unsigned short vsync_len;       /* value in lines (TFT) or 0 (STN) */
-
-       /* lcd configuration registers */
-       unsigned long   lcdcon5;
-};
-
-struct s3c2410fb_mach_info {
-
-       struct s3c2410fb_display *displays;     /* attached displays info */
-       unsigned num_displays;                  /* number of defined displays */
-       unsigned default_display;
-
-       /* GPIOs */
-
-       unsigned long   gpcup;
-       unsigned long   gpcup_mask;
-       unsigned long   gpccon;
-       unsigned long   gpccon_mask;
-       unsigned long   gpdup;
-       unsigned long   gpdup_mask;
-       unsigned long   gpdcon;
-       unsigned long   gpdcon_mask;
-
-       /* lpc3600 control register */
-       unsigned long   lpcsel;
-};
-
-extern void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *);
-
-#endif /* __ASM_PLAT_FB_S3C2410_H */
diff --git a/drivers/video/fbdev/s3c2410fb-regs-lcd.h b/drivers/video/fbdev/s3c2410fb-regs-lcd.h
new file mode 100644 (file)
index 0000000..1e46f7a
--- /dev/null
@@ -0,0 +1,143 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
+ *                   http://www.simtec.co.uk/products/SWLINUX/
+ */
+
+#ifndef ___ASM_ARCH_REGS_LCD_H
+#define ___ASM_ARCH_REGS_LCD_H
+
+/*
+ * a couple of values are used as platform data in
+ * include/linux/platform_data/fb-s3c2410.h and not
+ * duplicated here.
+ */
+#include <linux/platform_data/fb-s3c2410.h>
+
+#define S3C2410_LCDREG(x)      (x)
+
+/* LCD control registers */
+#define S3C2410_LCDCON1            S3C2410_LCDREG(0x00)
+#define S3C2410_LCDCON2            S3C2410_LCDREG(0x04)
+#define S3C2410_LCDCON3            S3C2410_LCDREG(0x08)
+#define S3C2410_LCDCON4            S3C2410_LCDREG(0x0C)
+#define S3C2410_LCDCON5            S3C2410_LCDREG(0x10)
+
+#define S3C2410_LCDCON1_CLKVAL(x)  ((x) << 8)
+#define S3C2410_LCDCON1_MMODE     (1<<7)
+#define S3C2410_LCDCON1_DSCAN4    (0<<5)
+#define S3C2410_LCDCON1_STN4      (1<<5)
+#define S3C2410_LCDCON1_STN8      (2<<5)
+#define S3C2410_LCDCON1_TFT       (3<<5)
+
+#define S3C2410_LCDCON1_STN1BPP           (0<<1)
+#define S3C2410_LCDCON1_STN2GREY   (1<<1)
+#define S3C2410_LCDCON1_STN4GREY   (2<<1)
+#define S3C2410_LCDCON1_STN8BPP           (3<<1)
+#define S3C2410_LCDCON1_STN12BPP   (4<<1)
+
+#define S3C2410_LCDCON1_ENVID     (1)
+
+#define S3C2410_LCDCON1_MODEMASK    0x1E
+
+#define S3C2410_LCDCON2_VBPD(x)            ((x) << 24)
+#define S3C2410_LCDCON2_LINEVAL(x)  ((x) << 14)
+#define S3C2410_LCDCON2_VFPD(x)            ((x) << 6)
+#define S3C2410_LCDCON2_VSPW(x)            ((x) << 0)
+
+#define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF)
+#define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >>  6) & 0xFF)
+#define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >>  0) & 0x3F)
+
+#define S3C2410_LCDCON3_HBPD(x)            ((x) << 19)
+#define S3C2410_LCDCON3_WDLY(x)            ((x) << 19)
+#define S3C2410_LCDCON3_HOZVAL(x)   ((x) << 8)
+#define S3C2410_LCDCON3_HFPD(x)            ((x) << 0)
+#define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0)
+
+#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F)
+#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >>  0) & 0xFF)
+
+/* LDCCON4 changes for STN mode on the S3C2412 */
+
+#define S3C2410_LCDCON4_MVAL(x)            ((x) << 8)
+#define S3C2410_LCDCON4_HSPW(x)            ((x) << 0)
+#define S3C2410_LCDCON4_WLH(x)     ((x) << 0)
+
+#define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >>  0) & 0xFF)
+
+/* framebuffer start addressed */
+#define S3C2410_LCDSADDR1   S3C2410_LCDREG(0x14)
+#define S3C2410_LCDSADDR2   S3C2410_LCDREG(0x18)
+#define S3C2410_LCDSADDR3   S3C2410_LCDREG(0x1C)
+
+#define S3C2410_LCDBANK(x)     ((x) << 21)
+#define S3C2410_LCDBASEU(x)    (x)
+
+#define S3C2410_OFFSIZE(x)     ((x) << 11)
+#define S3C2410_PAGEWIDTH(x)   (x)
+
+/* colour lookup and miscellaneous controls */
+
+#define S3C2410_REDLUT    S3C2410_LCDREG(0x20)
+#define S3C2410_GREENLUT   S3C2410_LCDREG(0x24)
+#define S3C2410_BLUELUT           S3C2410_LCDREG(0x28)
+
+#define S3C2410_DITHMODE   S3C2410_LCDREG(0x4C)
+#define S3C2410_TPAL      S3C2410_LCDREG(0x50)
+
+#define S3C2410_TPAL_EN                (1<<24)
+
+/* interrupt info */
+#define S3C2410_LCDINTPND  S3C2410_LCDREG(0x54)
+#define S3C2410_LCDSRCPND  S3C2410_LCDREG(0x58)
+#define S3C2410_LCDINTMSK  S3C2410_LCDREG(0x5C)
+#define S3C2410_LCDINT_FIWSEL  (1<<2)
+#define        S3C2410_LCDINT_FRSYNC   (1<<1)
+#define S3C2410_LCDINT_FICNT   (1<<0)
+
+/* s3c2442 extra stn registers */
+
+#define S3C2442_REDLUT         S3C2410_LCDREG(0x20)
+#define S3C2442_GREENLUT       S3C2410_LCDREG(0x24)
+#define S3C2442_BLUELUT                S3C2410_LCDREG(0x28)
+#define S3C2442_DITHMODE       S3C2410_LCDREG(0x20)
+
+#define S3C2410_LPCSEL    S3C2410_LCDREG(0x60)
+
+#define S3C2410_TFTPAL(x)  S3C2410_LCDREG((0x400 + (x)*4))
+
+/* S3C2412 registers */
+
+#define S3C2412_TPAL           S3C2410_LCDREG(0x20)
+
+#define S3C2412_LCDINTPND      S3C2410_LCDREG(0x24)
+#define S3C2412_LCDSRCPND      S3C2410_LCDREG(0x28)
+#define S3C2412_LCDINTMSK      S3C2410_LCDREG(0x2C)
+
+#define S3C2412_TCONSEL                S3C2410_LCDREG(0x30)
+
+#define S3C2412_LCDCON6                S3C2410_LCDREG(0x34)
+#define S3C2412_LCDCON7                S3C2410_LCDREG(0x38)
+#define S3C2412_LCDCON8                S3C2410_LCDREG(0x3C)
+#define S3C2412_LCDCON9                S3C2410_LCDREG(0x40)
+
+#define S3C2412_REDLUT(x)      S3C2410_LCDREG(0x44 + ((x)*4))
+#define S3C2412_GREENLUT(x)    S3C2410_LCDREG(0x60 + ((x)*4))
+#define S3C2412_BLUELUT(x)     S3C2410_LCDREG(0x98 + ((x)*4))
+
+#define S3C2412_FRCPAT(x)      S3C2410_LCDREG(0xB4 + ((x)*4))
+
+/* general registers */
+
+/* base of the LCD registers, where INTPND, INTSRC and then INTMSK
+ * are available. */
+
+#define S3C2410_LCDINTBASE     S3C2410_LCDREG(0x54)
+#define S3C2412_LCDINTBASE     S3C2410_LCDREG(0x24)
+
+#define S3C24XX_LCDINTPND      (0x00)
+#define S3C24XX_LCDSRCPND      (0x04)
+#define S3C24XX_LCDINTMSK      (0x08)
+
+#endif /* ___ASM_ARCH_REGS_LCD_H */
index 6f8fa50..d8ae525 100644 (file)
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
 #include <linux/io.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
 #include <asm/div64.h>
 
 #include <asm/mach/map.h>
-#include <mach/regs-lcd.h>
-#include <mach/regs-gpio.h>
-#include <mach/fb.h>
 
 #ifdef CONFIG_PM
 #include <linux/pm.h>
 #endif
 
 #include "s3c2410fb.h"
+#include "s3c2410fb-regs-lcd.h"
 
 /* Debugging stuff */
 static int debug = IS_BUILTIN(CONFIG_FB_S3C2410_DEBUG);
@@ -672,6 +671,9 @@ static inline void modify_gpio(void __iomem *reg,
 {
        unsigned long tmp;
 
+       if (!reg)
+               return;
+
        tmp = readl(reg) & ~mask;
        writel(tmp | set, reg);
 }
@@ -702,10 +704,10 @@ static int s3c2410fb_init_registers(struct fb_info *info)
 
        /* modify the gpio(s) with interrupts set (bjd) */
 
-       modify_gpio(S3C2410_GPCUP,  mach_info->gpcup,  mach_info->gpcup_mask);
-       modify_gpio(S3C2410_GPCCON, mach_info->gpccon, mach_info->gpccon_mask);
-       modify_gpio(S3C2410_GPDUP,  mach_info->gpdup,  mach_info->gpdup_mask);
-       modify_gpio(S3C2410_GPDCON, mach_info->gpdcon, mach_info->gpdcon_mask);
+       modify_gpio(mach_info->gpcup_reg,  mach_info->gpcup,  mach_info->gpcup_mask);
+       modify_gpio(mach_info->gpccon_reg, mach_info->gpccon, mach_info->gpccon_mask);
+       modify_gpio(mach_info->gpdup_reg,  mach_info->gpdup,  mach_info->gpdup_mask);
+       modify_gpio(mach_info->gpdcon_reg, mach_info->gpdcon, mach_info->gpdcon_mask);
 
        local_irq_restore(flags);
 
diff --git a/include/linux/platform_data/fb-s3c2410.h b/include/linux/platform_data/fb-s3c2410.h
new file mode 100644 (file)
index 0000000..10c11e6
--- /dev/null
@@ -0,0 +1,99 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org>
+ *
+ * Inspired by pxafb.h
+*/
+
+#ifndef __ASM_PLAT_FB_S3C2410_H
+#define __ASM_PLAT_FB_S3C2410_H __FILE__
+
+#include <linux/compiler_types.h>
+
+struct s3c2410fb_hw {
+       unsigned long   lcdcon1;
+       unsigned long   lcdcon2;
+       unsigned long   lcdcon3;
+       unsigned long   lcdcon4;
+       unsigned long   lcdcon5;
+};
+
+/* LCD description */
+struct s3c2410fb_display {
+       /* LCD type */
+       unsigned type;
+#define S3C2410_LCDCON1_DSCAN4    (0<<5)
+#define S3C2410_LCDCON1_STN4      (1<<5)
+#define S3C2410_LCDCON1_STN8      (2<<5)
+#define S3C2410_LCDCON1_TFT       (3<<5)
+
+#define S3C2410_LCDCON1_TFT1BPP           (8<<1)
+#define S3C2410_LCDCON1_TFT2BPP           (9<<1)
+#define S3C2410_LCDCON1_TFT4BPP           (10<<1)
+#define S3C2410_LCDCON1_TFT8BPP           (11<<1)
+#define S3C2410_LCDCON1_TFT16BPP   (12<<1)
+#define S3C2410_LCDCON1_TFT24BPP   (13<<1)
+
+       /* Screen size */
+       unsigned short width;
+       unsigned short height;
+
+       /* Screen info */
+       unsigned short xres;
+       unsigned short yres;
+       unsigned short bpp;
+
+       unsigned pixclock;              /* pixclock in picoseconds */
+       unsigned short left_margin;  /* value in pixels (TFT) or HCLKs (STN) */
+       unsigned short right_margin; /* value in pixels (TFT) or HCLKs (STN) */
+       unsigned short hsync_len;    /* value in pixels (TFT) or HCLKs (STN) */
+       unsigned short upper_margin;    /* value in lines (TFT) or 0 (STN) */
+       unsigned short lower_margin;    /* value in lines (TFT) or 0 (STN) */
+       unsigned short vsync_len;       /* value in lines (TFT) or 0 (STN) */
+
+       /* lcd configuration registers */
+       unsigned long   lcdcon5;
+#define S3C2410_LCDCON5_BPP24BL            (1<<12)
+#define S3C2410_LCDCON5_FRM565     (1<<11)
+#define S3C2410_LCDCON5_INVVCLK            (1<<10)
+#define S3C2410_LCDCON5_INVVLINE    (1<<9)
+#define S3C2410_LCDCON5_INVVFRAME   (1<<8)
+#define S3C2410_LCDCON5_INVVD      (1<<7)
+#define S3C2410_LCDCON5_INVVDEN            (1<<6)
+#define S3C2410_LCDCON5_INVPWREN    (1<<5)
+#define S3C2410_LCDCON5_INVLEND            (1<<4)
+#define S3C2410_LCDCON5_PWREN      (1<<3)
+#define S3C2410_LCDCON5_ENLEND     (1<<2)
+#define S3C2410_LCDCON5_BSWP       (1<<1)
+#define S3C2410_LCDCON5_HWSWP      (1<<0)
+};
+
+struct s3c2410fb_mach_info {
+
+       struct s3c2410fb_display *displays;     /* attached displays info */
+       unsigned num_displays;                  /* number of defined displays */
+       unsigned default_display;
+
+       /* GPIOs */
+
+       unsigned long   gpcup;
+       unsigned long   gpcup_mask;
+       unsigned long   gpccon;
+       unsigned long   gpccon_mask;
+       unsigned long   gpdup;
+       unsigned long   gpdup_mask;
+       unsigned long   gpdcon;
+       unsigned long   gpdcon_mask;
+
+       void __iomem *  gpccon_reg;
+       void __iomem *  gpcup_reg;
+       void __iomem *  gpdcon_reg;
+       void __iomem *  gpdup_reg;
+
+       /* lpc3600 control register */
+       unsigned long   lpcsel;
+};
+
+extern void s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *);
+
+#endif /* __ASM_PLAT_FB_S3C2410_H */