public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] i.MX2: Support splash screen
Date: Thu, 26 Apr 2012 13:51:02 +0200	[thread overview]
Message-ID: <20120426135102.146cb257@wker> (raw)
In-Reply-To: <1334739261-7812-2-git-send-email-timo@exertus.fi>

On Wed, 18 Apr 2012 11:54:21 +0300
"Timo Ketola" <timo@exertus.fi> wrote:

> Signed-off-by: Timo Ketola <timo@exertus.fi>
> ---
>  arch/arm/include/asm/arch-mx25/imx-regs.h |   29 +++++++++
>  drivers/video/Makefile                    |    1 +
>  drivers/video/mx2fb.c                     |   92 +++++++++++++++++++++++++++++
>  include/lcd.h                             |   21 ++++++-
>  include/mx2fb.h                           |   39 ++++++++++++
>  5 files changed, 181 insertions(+), 1 deletions(-)
>  create mode 100644 drivers/video/mx2fb.c
>  create mode 100644 include/mx2fb.h

...
> diff --git a/drivers/video/mx2fb.c b/drivers/video/mx2fb.c
> new file mode 100644
> index 0000000..9ee4a3e
> --- /dev/null
> +++ b/drivers/video/mx2fb.c
> @@ -0,0 +1,92 @@

Please add Copyright info here.

> +#include <common.h>
> +#include <lcd.h>
> +#include <mx2fb.h>
> +#include <asm/arch/imx-regs.h>
> +#include <asm/io.h>
> +#include <asm/errno.h>
> +
> +#if !defined(LCD_BPP) || LCD_BPP != LCD_COLOR16
> +
> +#error Only 16bpp is supported
> +
> +#endif

Drop empty lines around #error

> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +void *lcd_base;			/* Start of framebuffer memory	*/
> +void *lcd_console_address;	/* Start of console buffer	*/
> +
> +int lcd_line_length;
> +int lcd_color_fg;
> +int lcd_color_bg;
> +
> +short console_col;
> +short console_row;
> +
> +
> +void lcd_initcolregs(void)
> +{
> +}
> +
> +void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
> +{
> +}
> +
> +void lcd_enable(void)
> +{
> +}
> +
> +void lcd_disable(void)
> +{
> +}
> +
> +void lcd_panel_disable(void)
> +{
> +}
> +
> +void lcd_ctrl_init(void *lcdbase)
> +{
> +	u32 ccm_ipg_cg, pcr;
> +	struct lcdc_regs *lcdc = (struct lcdc_regs *)IMX_LCDC_BASE;
> +	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
> +
> +	writel(gd->fb_base, &lcdc->lssar);
> +	writel(panel_info.vl_col >> 4 << 20 | panel_info.vl_row, &lcdc->lsr);
> +	writel(panel_info.vl_col / 2, &lcdc->lvpwr);
> +	if (panel_info.vl_bpix != 4)
> +		printf("Unsupported color depth (%d), only 16bpp supported\n",
> +				NBITS(panel_info.vl_bpix));

Style issue: multi-line if statements should use braces
	if (cond) {
		multi-line
		statement
	}

> +	pcr = LCDC_LPCR | 5 << 25;
> +
> +	if (panel_info.vl_sync & FB_SYNC_CLK_LAT_FALL)
> +		pcr |= 0x00200000;
> +	if (panel_info.vl_sync & FB_SYNC_DATA_INVERT)
> +		pcr |= 0x01000000;
> +	if (panel_info.vl_sync & FB_SYNC_SHARP_MODE)
> +		pcr |= 0x00000040;
> +	if (panel_info.vl_sync & FB_SYNC_OE_LOW_ACT)
> +		pcr |= 0x00100000;
> +
> +	pcr |= LCDC_LPCR_PCD;
> +
> +	writel(pcr, &lcdc->lpcr);
> +	writel((panel_info.vl_hsync - 1) << 26 |
> +				(panel_info.vl_right_margin - 1) << 8 |
> +				(panel_info.vl_left_margin - 3),

Please remove two tabs here,
> +			&lcdc->lhcr);

and one tab here.

> +	writel(panel_info.vl_vsync << 26 |
> +				panel_info.vl_lower_margin << 8 |
> +				panel_info.vl_upper_margin,
> +			&lcdc->lvcr);

ditto.

> +	writel(LCDC_LSCR, &lcdc->lscr);
> +	writel(LCDC_LRMCR, &lcdc->lrmcr);
> +	writel(LCDC_LDCR, &lcdc->ldcr);
> +	writel(LCDC_LPCCR, &lcdc->lpccr);
> +
> +	/* Off and on clock gating
> +	   FIXME: Why *off* and on; What side effects does it have? */

Style for multi-line comments is
	/*
	 * multi-line
	 * comment
	 */

> +	ccm_ipg_cg = readl(&ccm->cgr1);
> +
> +	writel(ccm_ipg_cg & 0xDFFFFFFF, &ccm->cgr1);
> +	writel(ccm_ipg_cg | 0x20000000, &ccm->cgr1);
> +}

...
> diff --git a/include/mx2fb.h b/include/mx2fb.h
> new file mode 100644
> index 0000000..1f16a61
> --- /dev/null
> +++ b/include/mx2fb.h
> @@ -0,0 +1,39 @@
> +/*
> + * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
> + */
> +
> +/*
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */

Please consider Stefano's comment regarding copyright header.

> +
> +#ifndef __MX2FB_H__
> +#define __MX2FB_H__
> +
> +

please drop one empty line here.

> +/* LCDC register settings */
> +
> +#define LCDC_LSCR 0x00120300
> +
> +#define LCDC_LRMCR 0x00000000
> +
> +#define LCDC_LDCR 0x00020010
> +
> +#define LCDC_LPCCR 0x00a9037f
> +
> +#define LCDC_LPCR 0xFA008B80
> +
> +#define LCDC_LPCR_PCD 0x4

Please use the same style here as below, so remove
empty lines and indent numbers by tab.

> +
> +#define FB_SYNC_OE_LOW_ACT	0x80000000
> +#define FB_SYNC_CLK_LAT_FALL	0x40000000
> +#define FB_SYNC_DATA_INVERT	0x20000000
> +#define FB_SYNC_CLK_IDLE_EN	0x10000000
> +#define FB_SYNC_SHARP_MODE	0x08000000
> +#define FB_SYNC_SWAP_RGB	0x04000000
> +
> +#endif

Thanks,
Anatolij

  parent reply	other threads:[~2012-04-26 11:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-18  8:54 [U-Boot] [PATCH 0/1] i.MX2: Support splash screen Timo Ketola
2012-04-18  8:54 ` [U-Boot] [PATCH] " Timo Ketola
2012-04-18  9:26   ` Wolfgang Denk
2012-04-18 10:47   ` Stefano Babic
2012-04-20 11:01     ` [U-Boot] [PATCH] i.MX25: Prepare for LCD driver in board adaptation Timo Ketola
2012-04-20 11:01       ` [U-Boot] [PATCH] i.MX25: lcdc: Add register definitions Timo Ketola
2012-04-26 11:53         ` Anatolij Gustschin
2012-04-26  9:57       ` [U-Boot] [PATCH] i.MX25: Prepare for LCD driver in board adaptation Anatolij Gustschin
2012-04-26 11:18         ` Timo Ketola
2012-04-26 12:01           ` Anatolij Gustschin
2012-04-26 11:51   ` Anatolij Gustschin [this message]
2012-04-26 14:37     ` [U-Boot] [PATCH] i.MX2: Support splash screen Timo Ketola
2012-04-26 15:30       ` Anatolij Gustschin
2012-04-18  9:26 ` [U-Boot] [PATCH 0/1] " Wolfgang Denk

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=20120426135102.146cb257@wker \
    --to=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    /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