Linux Samsung SOC development
 help / color / mirror / Atom feed
From: Kukjin Kim <kgene.kim@samsung.com>
To: 'Ajay Kumar' <ajaykumar.rs@samsung.com>,
	linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, lethal@linux-sh.org,
	jg1.han@samsung.com
Subject: RE: [PATCH 4/6] ARM: S5P64X0: Add GPIO and SPCON settings for LCD
Date: Thu, 21 Jul 2011 10:21:26 +0900	[thread overview]
Message-ID: <003401cc4744$8aec4530$a0c4cf90$%kim@samsung.com> (raw)
In-Reply-To: <1310650036-28836-5-git-send-email-ajaykumar.rs@samsung.com>

Ajay Kumar wrote:
> 
> This patch adds:
> o GPIO lines settings(HSYNC, VSYNC, VCLK and VD) for LCD.
> o Function to select type of LCD interface (RGB/i80)
> 
> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> ---
>  arch/arm/mach-s5p64x0/Kconfig                  |    6 +++
>  arch/arm/mach-s5p64x0/Makefile                 |    1 +
>  arch/arm/mach-s5p64x0/include/mach/regs-gpio.h |    4 ++
>  arch/arm/mach-s5p64x0/setup-fb.c               |   48
> ++++++++++++++++++++++++
>  arch/arm/plat-samsung/include/plat/fb.h        |   14 +++++++
>  5 files changed, 73 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/mach-s5p64x0/setup-fb.c
> 
> diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
> index 017af4c..2ca5ac0 100644
> --- a/arch/arm/mach-s5p64x0/Kconfig
> +++ b/arch/arm/mach-s5p64x0/Kconfig
> @@ -21,6 +21,12 @@ config CPU_S5P6450
>  	help
>  	  Enable S5P6450 CPU support
> 
> +config S5P64X0_SETUP_FB
> +	bool
> +	help
> +	  Common setup code for S5P64X0 based boards with a LCD display
> +	  through RGB interface.
> +
>  config S5P64X0_SETUP_I2C1
>  	bool
>  	help
> diff --git a/arch/arm/mach-s5p64x0/Makefile
b/arch/arm/mach-s5p64x0/Makefile
> index ae6bf6f..43698c6 100644
> --- a/arch/arm/mach-s5p64x0/Makefile
> +++ b/arch/arm/mach-s5p64x0/Makefile
> @@ -28,3 +28,4 @@ obj-y				+= dev-audio.o
>  obj-$(CONFIG_S3C64XX_DEV_SPI)	+= dev-spi.o
> 
>  obj-$(CONFIG_S5P64X0_SETUP_I2C1)	+= setup-i2c1.o
> +obj-$(CONFIG_S5P64X0_SETUP_FB)		+= setup-fb.o
> diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
b/arch/arm/mach-
> s5p64x0/include/mach/regs-gpio.h
> index 0953ef6..2f07cbd 100644
> --- a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
> +++ b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
> @@ -34,4 +34,8 @@
>  #define S5P6450_GPQ_BASE		(S5P_VA_GPIO + 0x0180)
>  #define S5P6450_GPS_BASE		(S5P_VA_GPIO + 0x0300)
> 
> +#define S5P64X0_SPCON0			(S5P_VA_GPIO + 0x1A0)
> +#define S5P64X0_SPCON0_LCD_SEL_MASK	(0x3 << 0)
> +#define S5P64X0_SPCON0_LCD_SEL_RGB	(0x1 << 0)
> +
>  #endif /* __ASM_ARCH_REGS_GPIO_H */
> diff --git a/arch/arm/mach-s5p64x0/setup-fb.c
b/arch/arm/mach-s5p64x0/setup-fb.c
> new file mode 100644
> index 0000000..3e8ffad
> --- /dev/null
> +++ b/arch/arm/mach-s5p64x0/setup-fb.c
> @@ -0,0 +1,48 @@
> +/* linux/arch/arm/mach-s5p64x0/setup-fb.c
> + *
> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
> + * 		http://www.samsung.com/
> + *
> + * Base S5P64X0 GPIO setup information for LCD framebuffer
> + *
> + * GPIO settings for LCD on any other board based on s5p64x0
> + * should go in this file.
> + *
> + * 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/fb.h>
> +#include <linux/gpio.h>
> +
> +#include <plat/fb.h>
> +#include <plat/gpio-cfg.h>
> +
> +#include <mach/regs-clock.h>
> +#include <mach/regs-gpio.h>
> +
> +void s5p64x0_fb_init(int lcd_interface_type)
> +{
> +	unsigned int cfg;
> +
> +	/* select TFT LCD type (RGB I/F) */
> +	cfg = readl(S5P64X0_SPCON0);

Since no need memory barrier here, just use __raw_readl

> +	cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
> +	cfg |= lcd_interface_type;
> +	writel(cfg, S5P64X0_SPCON0);

__raw_writel

> +}
> +
> +void s5p64x0_fb_gpio_setup_24bpp(void)
> +{
> +	unsigned int cfg;
> +
> +	cfg = readl(S5P64X0_SYS_ID) & 0xf0000;
> +	if (cfg == 0x40000) {
> +		s3c_gpio_cfgrange_nopull(S5P6440_GPI(0), 16,
> S3C_GPIO_SFN(2));
> +		s3c_gpio_cfgrange_nopull(S5P6440_GPJ(0), 12,
> S3C_GPIO_SFN(2));
> +	} else if (cfg == 0x50000) {
> +		s3c_gpio_cfgrange_nopull(S5P6450_GPI(0), 16,
> S3C_GPIO_SFN(2));
> +		s3c_gpio_cfgrange_nopull(S5P6450_GPJ(0), 12,
> S3C_GPIO_SFN(2));
> +	}

Following is more make sense ?

+	unsigned int chipid;
+
+	chipid = __raw_readl(S5P64X0_SYS_ID) & 0xff000;
+	if (chipd == 0x50000) {
+		s3c_gpio_cfgrange_nopull(S5P6450_GPI(0), 16,
S3C_GPIO_SFN(2));
+		s3c_gpio_cfgrange_nopull(S5P6450_GPJ(0), 12,
S3C_GPIO_SFN(2));
+	} else {
+		s3c_gpio_cfgrange_nopull(S5P6440_GPI(0), 16,
S3C_GPIO_SFN(2));
+		s3c_gpio_cfgrange_nopull(S5P6440_GPJ(0), 12,
S3C_GPIO_SFN(2));
+	}

> +}
> diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-
> samsung/include/plat/fb.h
> index cb3ca3a..8147c59 100644
> --- a/arch/arm/plat-samsung/include/plat/fb.h
> +++ b/arch/arm/plat-samsung/include/plat/fb.h
> @@ -94,4 +94,18 @@ extern void s5pc100_fb_gpio_setup_24bpp(void);
>   */
>  extern void s5pv210_fb_gpio_setup_24bpp(void);
> 
> +/**
> + * s5p64x0_fb_init() - Common setup function for LCD
> + *
> + * Select LCD I/F configuration-RGB style or i80 style
> + */
> +extern void s5p64x0_fb_init(int lcd_interface_type);
> +
> +/**
> + * s5p64x0_fb_gpio_setup_24bpp() - Common GPIO setup function for LCD
> + *
> + * Initialise the GPIO for a LCD display on the RGB interface.
> + */
> +extern void s5p64x0_fb_gpio_setup_24bpp(void);
> +
>  #endif /* __PLAT_S3C_FB_H */
> --
> 1.7.1


Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

  reply	other threads:[~2011-07-21  1:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14 13:27 [PATCH 0/6] ARM: S5P64X0: Add Framebuffer support Ajay Kumar
2011-07-14 13:27 ` [PATCH 1/6] video: s3c-fb: Add S5P64X0 specific s3c_fb_driverdata Ajay Kumar
2011-07-14 13:27 ` [PATCH 2/6] ARM: S5P64X0: Add register base and IRQ for Framebuffer Ajay Kumar
2011-07-14 11:17   ` Marek Szyprowski
2011-07-15  5:56     ` Ajay kumar
2011-07-21  1:07   ` Kukjin Kim
2011-07-14 13:27 ` [PATCH 3/6] ARM: S5P64X0: Set s3c_device_fb name Ajay Kumar
2011-07-14 13:27 ` [PATCH 4/6] ARM: S5P64X0: Add GPIO and SPCON settings for LCD Ajay Kumar
2011-07-21  1:21   ` Kukjin Kim [this message]
2011-07-14 13:27 ` [PATCH 5/6] ARM: S5P6440: Add LCD-LTE480 and enable Framebuffer support Ajay Kumar
2011-07-14 13:27 ` [PATCH 6/6] ARM: S5P6450: " Ajay Kumar
2011-07-15  6:12 ` [PATCH 0/6] ARM: S5P64X0: Add " Tushar Behera
2011-07-15  6:27   ` Ajay kumar
2011-07-15 10:05     ` Tushar Behera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003401cc4744$8aec4530$a0c4cf90$%kim@samsung.com' \
    --to=kgene.kim@samsung.com \
    --cc=ajaykumar.rs@samsung.com \
    --cc=jg1.han@samsung.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox