Commit 47882cf6 authored by Hans-Christian Egtvedt's avatar Hans-Christian Egtvedt Committed by Haavard Skinnemoen

avr32: Add pin configuration choice to LCDC peripheral

This patch lets the board code choose which pin out to use for the LCD
interface.

On AT32AP7000 the LCDC is wired to two sets of pins, which lets the user
choose between dual ethernet and 32-bit EBI. For the ATNGW100 board it
is vital to have the choice to select the alternative pinout since this
pinout is routed to the external headers.

Update ATSTK1002 and ATSTK1004 to use the new interface.
Signed-off-by: default avatarHans-Christian Egtvedt <hcegtvedt@atmel.com>
Signed-off-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
parent aafafddb
...@@ -238,7 +238,7 @@ static int __init atstk1002_init(void) ...@@ -238,7 +238,7 @@ static int __init atstk1002_init(void)
set_hw_addr(at32_add_device_eth(1, &eth_data[1])); set_hw_addr(at32_add_device_eth(1, &eth_data[1]));
#else #else
at32_add_device_lcdc(0, &atstk1000_lcdc_data, at32_add_device_lcdc(0, &atstk1000_lcdc_data,
fbmem_start, fbmem_size); fbmem_start, fbmem_size, 0);
#endif #endif
at32_add_device_usba(0, NULL); at32_add_device_usba(0, NULL);
#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
......
...@@ -140,7 +140,7 @@ static int __init atstk1004_init(void) ...@@ -140,7 +140,7 @@ static int __init atstk1004_init(void)
at32_add_device_mci(0); at32_add_device_mci(0);
#endif #endif
at32_add_device_lcdc(0, &atstk1000_lcdc_data, at32_add_device_lcdc(0, &atstk1000_lcdc_data,
fbmem_start, fbmem_size); fbmem_start, fbmem_size, 0);
at32_add_device_usba(0, NULL); at32_add_device_usba(0, NULL);
#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
at32_add_device_ssc(0, ATMEL_SSC_TX); at32_add_device_ssc(0, ATMEL_SSC_TX);
......
...@@ -1257,7 +1257,8 @@ static struct clk atmel_lcdfb0_pixclk = { ...@@ -1257,7 +1257,8 @@ static struct clk atmel_lcdfb0_pixclk = {
struct platform_device *__init struct platform_device *__init
at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
unsigned long fbmem_start, unsigned long fbmem_len) unsigned long fbmem_start, unsigned long fbmem_len,
unsigned int pin_config)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_lcdfb_info *info; struct atmel_lcdfb_info *info;
...@@ -1284,6 +1285,9 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, ...@@ -1284,6 +1285,9 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
switch (id) { switch (id) {
case 0: case 0:
pdev = &atmel_lcdfb0_device; pdev = &atmel_lcdfb0_device;
switch (pin_config) {
case 0:
select_peripheral(PC(19), PERIPH_A, 0); /* CC */ select_peripheral(PC(19), PERIPH_A, 0); /* CC */
select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */
select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */
...@@ -1315,6 +1319,43 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, ...@@ -1315,6 +1319,43 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */ select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */
select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */
select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */
break;
case 1:
select_peripheral(PE(0), PERIPH_B, 0); /* CC */
select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */
select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */
select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */
select_peripheral(PE(1), PERIPH_B, 0); /* DVAL */
select_peripheral(PE(2), PERIPH_B, 0); /* MODE */
select_peripheral(PC(25), PERIPH_A, 0); /* PWR */
select_peripheral(PE(3), PERIPH_B, 0); /* DATA0 */
select_peripheral(PE(4), PERIPH_B, 0); /* DATA1 */
select_peripheral(PE(5), PERIPH_B, 0); /* DATA2 */
select_peripheral(PE(6), PERIPH_B, 0); /* DATA3 */
select_peripheral(PE(7), PERIPH_B, 0); /* DATA4 */
select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */
select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */
select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */
select_peripheral(PE(8), PERIPH_B, 0); /* DATA8 */
select_peripheral(PE(9), PERIPH_B, 0); /* DATA9 */
select_peripheral(PE(10), PERIPH_B, 0); /* DATA10 */
select_peripheral(PE(11), PERIPH_B, 0); /* DATA11 */
select_peripheral(PE(12), PERIPH_B, 0); /* DATA12 */
select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */
select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */
select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */
select_peripheral(PE(13), PERIPH_B, 0); /* DATA16 */
select_peripheral(PE(14), PERIPH_B, 0); /* DATA17 */
select_peripheral(PE(15), PERIPH_B, 0); /* DATA18 */
select_peripheral(PE(16), PERIPH_B, 0); /* DATA19 */
select_peripheral(PE(17), PERIPH_B, 0); /* DATA20 */
select_peripheral(PE(18), PERIPH_B, 0); /* DATA21 */
select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */
select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */
break;
default:
goto err_invalid_id;
}
clk_set_parent(&atmel_lcdfb0_pixclk, &pll0); clk_set_parent(&atmel_lcdfb0_pixclk, &pll0);
clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0)); clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0));
......
...@@ -42,7 +42,8 @@ at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n); ...@@ -42,7 +42,8 @@ at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n);
struct atmel_lcdfb_info; struct atmel_lcdfb_info;
struct platform_device * struct platform_device *
at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
unsigned long fbmem_start, unsigned long fbmem_len); unsigned long fbmem_start, unsigned long fbmem_len,
unsigned int pin_config);
struct usba_platform_data; struct usba_platform_data;
struct platform_device * struct platform_device *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment