Skip to contentSkip to conversation

Add AVR32 LCD support

PATCH New Mark Jackson 2 participants 2 messages Jul 21, 2009 – Jul 26, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add AVR32 LCD support

This patch adds support for the AVR32 LCD controller. This patch is based off the latest u-boot-video.

A quick summary of what's going on:-

Enable LCDC pixel clock
Enable LCDC port pins
Add framebuffer pointer to global_data struct
Allocate framebuffer

To use the new code, update your board config to include something like this:-

#define CONFIG_LCD 1

#if defined(CONFIG_LCD)
#define CONFIG_CMD_BMP
#define CONFIG_ATMEL_LCD 1
#define LCD_BPP LCD_COLOR16
#define CONFIG_BMP_16BPP 1
#define CONFIG_FB_ADDR 0x10600000
#define CONFIG_WHITE_ON_BLACK 1
#define CONFIG_VIDEO_BMP_GZIP 1
#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE 262144
#define CONFIG_ATMEL_LCD_BGR555 1
#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
#define CONFIG_SPLASH_SCREEN 1
#endif

The standard U-Boot BMP and Splash-screen features should just work.

---
 cpu/at32ap/at32ap700x/clk.c                       |    5 +
 cpu/at32ap/at32ap700x/portmux.c                   |   90 +++++++++++++++++++++
 include/asm-avr32/arch-at32ap700x/chip-features.h |    5 +
 include/asm-avr32/arch-at32ap700x/clk.h           |    6 ++
 include/asm-avr32/arch-at32ap700x/portmux.h       |    5 +-
 include/asm-avr32/global_data.h                   |    3 +
 lib_avr32/board.c                                 |   11 +++
 7 files changed, 124 insertions(+), 1 deletions(-)
cpu/at32ap/at32ap700x/clk.c +5 -0
index 2c2e19c..742bc6b 100644
@@ -65,6 +65,11 @@ void clk_init(void)
 #ifdef CONFIG_PLL
 	/* Use PLL0 as main clock */
 	sm_writel(PM_MCCTRL, SM_BIT(PLLSEL));
+
+#ifdef CONFIG_LCD
+	/* Set up pixel clock for the LCDC */
+	sm_writel(PM_GCCTRL(7), SM_BIT(PLLSEL) | SM_BIT(CEN));
+#endif
 #endif
 }
 
cpu/at32ap/at32ap700x/portmux.c +90 -0

93 lines not on this page · raw message

include/asm-avr32/arch-at32ap700x/chip-features.h +5 -0
index c47107e..40a2476 100644
@@ -32,4 +32,9 @@
 #define AT32AP700x_CHIP_HAS_MACB
 #endif
 
+/* AP7000 and AP7002 have LCD controller, but AP7001 does not */
+#if defined(CONFIG_AT32AP7000) || defined(CONFIG_AT32AP7002)
+#define AT32AP700x_CHIP_HAS_LCDC
+#endif
+
 #endif /* __ASM_AVR32_ARCH_CHIP_FEATURES_H__ */
include/asm-avr32/arch-at32ap700x/clk.h +6 -0
index d83e93b..7a0b655 100644
@@ -83,6 +83,12 @@ static inline unsigned long get_spi_clk_rate(unsigned int dev_id)
 	return get_pba_clk_rate();
 }
 #endif
+#ifdef AT32AP700x_CHIP_HAS_LCDC
+static inline unsigned long get_lcdc_clk_rate(unsigned int dev_id)
+{
+	return get_hsb_clk_rate();
+}
+#endif
 
 extern void clk_init(void);
 
include/asm-avr32/arch-at32ap700x/portmux.h +4 -1
index 96fe70d..8574aec 100644
@@ -85,5 +85,8 @@ void portmux_enable_mmci(unsigned int slot, unsigned long flags,
 void portmux_enable_spi0(unsigned long cs_mask, unsigned long drive_strength);
 void portmux_enable_spi1(unsigned long cs_mask, unsigned long drive_strength);
 #endif
-
+#ifdef AT32AP700x_CHIP_HAS_LCDC
+void portmux_enable_lcdc(int pin_config);
+#endif
+ 
 #endif /* __ASM_AVR32_ARCH_PORTMUX_H__ */
include/asm-avr32/global_data.h +3 -0
index 97a6c61..efbdda9 100644
@@ -42,6 +42,9 @@ typedef	struct	global_data {
 	unsigned long	env_addr;	/* Address of env struct */
 	unsigned long	env_valid;	/* Checksum of env valid? */
 	unsigned long	cpu_hz;		/* cpu core clock frequency */
+#if defined(CONFIG_LCD)
+	void		*fb_base;	/* framebuffer address */
+#endif
 	void		**jt;		/* jump table */
 } gd_t;
 
lib_avr32/board.c +11 -0
index 5b2d0ef..cb1473d 100644
@@ -239,6 +239,17 @@ void board_init_f(ulong board_type)
 	addr -= CONFIG_SYS_DMA_ALLOC_LEN;
 #endif
 
+#ifdef CONFIG_LCD
+#ifdef CONFIG_FB_ADDR
+	printf("LCD: Frame buffer allocated@preset 0x%08x\n", CONFIG_FB_ADDR);
+	gd->fb_base = (void*)CONFIG_FB_ADDR;
+#else
+	addr = lcd_setmem(addr);
+	printf("LCD: Frame buffer allocated at 0x%08lx\n", addr);
+	gd->fb_base = (void*)addr;
+#endif /* CONFIG_FB_ADDR */
+#endif /* CONFIG_LCD */
+
 	/* Allocate a Board Info struct on a word boundary */
 	addr -= sizeof(bd_t);
 	addr &= ~3UL;
#1 lore raw

PATCH v2 1/1 Add AVR32 LCD support

Quoted 32 lines · Mark Jackson

This patch adds support for the AVR32 LCD controller. This patch is based off the latest u-boot-video.

A quick summary of what's going on:-

Enable LCDC pixel clock
Enable LCDC port pins
Add framebuffer pointer to global_data struct
Allocate framebuffer

To use the new code, update your board config to include something like this:-

#define CONFIG_LCD 1

#if defined(CONFIG_LCD)
#define CONFIG_CMD_BMP
#define CONFIG_ATMEL_LCD 1
#define LCD_BPP LCD_COLOR16
#define CONFIG_BMP_16BPP 1
#define CONFIG_FB_ADDR 0x10600000
#define CONFIG_WHITE_ON_BLACK 1
#define CONFIG_VIDEO_BMP_GZIP 1
#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE 262144
#define CONFIG_ATMEL_LCD_BGR555 1
#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
#define CONFIG_SPLASH_SCREEN 1
#endif

The standard U-Boot BMP and Splash-screen features should just work.

Quoted 9 lines
---
 cpu/at32ap/at32ap700x/clk.c                       |    5 +
 cpu/at32ap/at32ap700x/portmux.c                   |   90 +++++++++++++++++++++
 include/asm-avr32/arch-at32ap700x/chip-features.h |    5 +
 include/asm-avr32/arch-at32ap700x/clk.h           |    6 ++
 include/asm-avr32/arch-at32ap700x/portmux.h       |    5 +-
 include/asm-avr32/global_data.h                   |    3 +
 lib_avr32/board.c                                 |   11 +++
 7 files changed, 124 insertions(+), 1 deletions(-)

Applied to u-boot-video. Thanks!

Best regards,
Anatolij