Merge branch 'avr32-arch' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
* 'avr32-arch' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6: avr32: add hardware handshake support to atmel_serial avr32: add RTS/CTS/CLK pin selection for the USARTs Add RTC support for Merisc boards avr32: at32ap700x: setup DMA for AC97C in the machine code avr32: at32ap700x: setup DMA for ABDAC in the machine code Add Merisc board support avr32: use gpio_is_valid() to check USBA vbus_pin I/O line atmel-usba-udc: use gpio_is_valid() to check vbus_pin I/O line avr32: fix timing LCD parameters for EVKLCD10X boards avr32: use GPIO line PB15 on EVKLCD10x boards for backlight avr32: configure MCI detect and write protect pins for EVKLCD10x boards avr32: set pin mask to alternative 18 bpp for EVKLCD10x boards avr32: add pin mask for 18-bit color on the LCD controller avr32: fix 15-bit LCDC pin mask to use MSB lines
This commit is contained in:
Коммит
87fc94d54b
|
@ -144,6 +144,19 @@ config BOARD_FAVR_32
|
|||
bool "Favr-32 LCD-board"
|
||||
select CPU_AT32AP7000
|
||||
|
||||
config BOARD_MERISC
|
||||
bool "Merisc board"
|
||||
select CPU_AT32AP7000
|
||||
help
|
||||
Merisc is the family name for a range of AVR32-based boards.
|
||||
|
||||
The boards are designed to be used in a man-machine
|
||||
interfacing environment, utilizing a touch-based graphical
|
||||
user interface. They host a vast range of I/O peripherals as
|
||||
well as a large SDRAM & Flash memory bank.
|
||||
|
||||
For more information see: http://www.martinsson.se/merisc
|
||||
|
||||
config BOARD_MIMC200
|
||||
bool "MIMC200 CPU board"
|
||||
select CPU_AT32AP7000
|
||||
|
@ -153,6 +166,7 @@ source "arch/avr32/boards/atstk1000/Kconfig"
|
|||
source "arch/avr32/boards/atngw100/Kconfig"
|
||||
source "arch/avr32/boards/hammerhead/Kconfig"
|
||||
source "arch/avr32/boards/favr-32/Kconfig"
|
||||
source "arch/avr32/boards/merisc/Kconfig"
|
||||
|
||||
choice
|
||||
prompt "Boot loader type"
|
||||
|
|
|
@ -35,6 +35,7 @@ core-$(CONFIG_BOARD_ATSTK1000) += arch/avr32/boards/atstk1000/
|
|||
core-$(CONFIG_BOARD_ATNGW100) += arch/avr32/boards/atngw100/
|
||||
core-$(CONFIG_BOARD_HAMMERHEAD) += arch/avr32/boards/hammerhead/
|
||||
core-$(CONFIG_BOARD_FAVR_32) += arch/avr32/boards/favr-32/
|
||||
core-$(CONFIG_BOARD_MERISC) += arch/avr32/boards/merisc/
|
||||
core-$(CONFIG_BOARD_MIMC200) += arch/avr32/boards/mimc200/
|
||||
core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/
|
||||
core-y += arch/avr32/kernel/
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <linux/init.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
|
@ -19,26 +20,26 @@
|
|||
#include <asm/setup.h>
|
||||
|
||||
#include <mach/at32ap700x.h>
|
||||
#include <mach/portmux.h>
|
||||
#include <mach/board.h>
|
||||
|
||||
#include <sound/atmel-ac97c.h>
|
||||
|
||||
static struct ac97c_platform_data __initdata ac97c0_data = {
|
||||
.dma_rx_periph_id = 3,
|
||||
.dma_tx_periph_id = 4,
|
||||
.dma_controller_id = 0,
|
||||
.reset_pin = GPIO_PIN_PB(19),
|
||||
.reset_pin = GPIO_PIN_PB(19),
|
||||
};
|
||||
|
||||
#ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA
|
||||
static struct fb_videomode __initdata tcg057vglad_modes[] = {
|
||||
{
|
||||
.name = "640x480 @ 60",
|
||||
.refresh = 60,
|
||||
.name = "640x480 @ 50",
|
||||
.refresh = 50,
|
||||
.xres = 640, .yres = 480,
|
||||
.pixclock = KHZ2PICOS(25180),
|
||||
|
||||
.left_margin = 64, .right_margin = 31,
|
||||
.upper_margin = 34, .lower_margin = 2,
|
||||
.hsync_len = 96, .vsync_len = 4,
|
||||
.left_margin = 64, .right_margin = 96,
|
||||
.upper_margin = 34, .lower_margin = 11,
|
||||
.hsync_len = 64, .vsync_len = 15,
|
||||
|
||||
.sync = 0,
|
||||
.vmode = FB_VMODE_NONINTERLACED,
|
||||
|
@ -69,14 +70,14 @@ static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
|
|||
#elif CONFIG_BOARD_ATNGW100_EVKLCD10X_QVGA
|
||||
static struct fb_videomode __initdata tcg057qvlad_modes[] = {
|
||||
{
|
||||
.name = "320x240 @ 60",
|
||||
.refresh = 60,
|
||||
.name = "320x240 @ 50",
|
||||
.refresh = 50,
|
||||
.xres = 320, .yres = 240,
|
||||
.pixclock = KHZ2PICOS(6300),
|
||||
|
||||
.left_margin = 52, .right_margin = 28,
|
||||
.upper_margin = 7, .lower_margin = 2,
|
||||
.hsync_len = 96, .vsync_len = 4,
|
||||
.left_margin = 34, .right_margin = 46,
|
||||
.upper_margin = 7, .lower_margin = 15,
|
||||
.hsync_len = 64, .vsync_len = 12,
|
||||
|
||||
.sync = 0,
|
||||
.vmode = FB_VMODE_NONINTERLACED,
|
||||
|
@ -144,12 +145,29 @@ static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static void atevklcd10x_lcdc_power_control(int on)
|
||||
{
|
||||
gpio_set_value(GPIO_PIN_PB(15), on);
|
||||
}
|
||||
|
||||
static int __init atevklcd10x_init(void)
|
||||
{
|
||||
at32_add_device_ac97c(0, &ac97c0_data);
|
||||
/* PB15 is connected to the enable line on the boost regulator
|
||||
* controlling the backlight for the LCD panel.
|
||||
*/
|
||||
at32_select_gpio(GPIO_PIN_PB(15), AT32_GPIOF_OUTPUT);
|
||||
gpio_request(GPIO_PIN_PB(15), "backlight");
|
||||
gpio_direction_output(GPIO_PIN_PB(15), 0);
|
||||
|
||||
atevklcd10x_lcdc_data.atmel_lcdfb_power_control =
|
||||
atevklcd10x_lcdc_power_control;
|
||||
|
||||
at32_add_device_lcdc(0, &atevklcd10x_lcdc_data,
|
||||
fbmem_start, fbmem_size, 1);
|
||||
fbmem_start, fbmem_size,
|
||||
ATMEL_LCDC_ALT_18BIT | ATMEL_LCDC_PE_DVAL);
|
||||
|
||||
at32_add_device_ac97c(0, &ac97c0_data, AC97C_BOTH);
|
||||
|
||||
return 0;
|
||||
}
|
||||
postcore_initcall(atevklcd10x_init);
|
||||
|
|
|
@ -56,13 +56,8 @@ static struct spi_board_info spi0_board_info[] __initdata = {
|
|||
static struct mci_platform_data __initdata mci0_data = {
|
||||
.slot[0] = {
|
||||
.bus_width = 4,
|
||||
#ifndef CONFIG_BOARD_ATNGW100_EVKLCD10X
|
||||
.detect_pin = GPIO_PIN_PC(25),
|
||||
.wp_pin = GPIO_PIN_PE(0),
|
||||
#else
|
||||
.detect_pin = GPIO_PIN_NONE,
|
||||
.wp_pin = GPIO_PIN_NONE,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -123,7 +118,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
|
|||
|
||||
void __init setup_board(void)
|
||||
{
|
||||
at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */
|
||||
at32_map_usart(1, 0, 0); /* USART 1: /dev/ttyS0, DB9 */
|
||||
at32_setup_serial_console(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -252,12 +252,12 @@ static void __init atstk1002_setup_extdac(void)
|
|||
void __init setup_board(void)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
|
||||
at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */
|
||||
at32_map_usart(0, 1, 0); /* USART 0/B: /dev/ttyS1, IRDA */
|
||||
#else
|
||||
at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
|
||||
at32_map_usart(1, 0, 0); /* USART 1/A: /dev/ttyS0, DB9 */
|
||||
#endif
|
||||
/* USART 2/unused: expansion connector */
|
||||
at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */
|
||||
at32_map_usart(3, 2, 0); /* USART 3/C: /dev/ttyS2, DB9 */
|
||||
|
||||
at32_setup_serial_console(0);
|
||||
}
|
||||
|
|
|
@ -115,12 +115,12 @@ static void __init atstk1003_setup_extdac(void)
|
|||
void __init setup_board(void)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
|
||||
at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */
|
||||
at32_map_usart(0, 1, 0); /* USART 0/B: /dev/ttyS1, IRDA */
|
||||
#else
|
||||
at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
|
||||
at32_map_usart(1, 0, 0); /* USART 1/A: /dev/ttyS0, DB9 */
|
||||
#endif
|
||||
/* USART 2/unused: expansion connector */
|
||||
at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */
|
||||
at32_map_usart(3, 2, 0); /* USART 3/C: /dev/ttyS2, DB9 */
|
||||
|
||||
at32_setup_serial_console(0);
|
||||
}
|
||||
|
|
|
@ -120,12 +120,12 @@ static void __init atstk1004_setup_extdac(void)
|
|||
void __init setup_board(void)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
|
||||
at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */
|
||||
at32_map_usart(0, 1, 0); /* USART 0/B: /dev/ttyS1, IRDA */
|
||||
#else
|
||||
at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
|
||||
at32_map_usart(1, 0, 0); /* USART 1/A: /dev/ttyS0, DB9 */
|
||||
#endif
|
||||
/* USART 2/unused: expansion connector */
|
||||
at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */
|
||||
at32_map_usart(3, 2, 0); /* USART 3/C: /dev/ttyS2, DB9 */
|
||||
|
||||
at32_setup_serial_console(0);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <linux/spi/spi.h>
|
||||
#include <linux/spi/ads7846.h>
|
||||
|
||||
#include <sound/atmel-abdac.h>
|
||||
|
||||
#include <video/atmel_lcdc.h>
|
||||
|
||||
#include <asm/setup.h>
|
||||
|
@ -41,6 +43,9 @@ unsigned long at32_board_osc_rates[3] = {
|
|||
/* Initialized by bootloader-specific startup code. */
|
||||
struct tag *bootloader_tags __initdata;
|
||||
|
||||
static struct atmel_abdac_pdata __initdata abdac0_data = {
|
||||
};
|
||||
|
||||
struct eth_addr {
|
||||
u8 addr[6];
|
||||
};
|
||||
|
@ -245,7 +250,7 @@ static void __init favr32_setup_atmel_pwm_bl(void)
|
|||
|
||||
void __init setup_board(void)
|
||||
{
|
||||
at32_map_usart(3, 0); /* USART 3 => /dev/ttyS0 */
|
||||
at32_map_usart(3, 0, 0); /* USART 3 => /dev/ttyS0 */
|
||||
at32_setup_serial_console(0);
|
||||
}
|
||||
|
||||
|
@ -326,7 +331,7 @@ static int __init favr32_init(void)
|
|||
|
||||
spi1_board_info[0].irq = gpio_to_irq(GPIO_PIN_PB(3));
|
||||
|
||||
set_abdac_rate(at32_add_device_abdac(0));
|
||||
set_abdac_rate(at32_add_device_abdac(0, &abdac0_data));
|
||||
|
||||
at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel);
|
||||
at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <mach/init.h>
|
||||
#include <mach/portmux.h>
|
||||
|
||||
#include <sound/atmel-ac97c.h>
|
||||
|
||||
#include "../../mach-at32ap/clock.h"
|
||||
#include "flash.h"
|
||||
|
||||
|
@ -163,7 +165,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
|
|||
|
||||
void __init setup_board(void)
|
||||
{
|
||||
at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */
|
||||
at32_map_usart(1, 0, 0); /* USART 1: /dev/ttyS0, DB9 */
|
||||
at32_setup_serial_console(0);
|
||||
}
|
||||
|
||||
|
@ -233,7 +235,7 @@ static int __init hammerhead_init(void)
|
|||
i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
|
||||
|
||||
#ifdef CONFIG_BOARD_HAMMERHEAD_SND
|
||||
at32_add_device_ac97c(0, &ac97c_data);
|
||||
at32_add_device_ac97c(0, &ac97c_data, AC97C_BOTH);
|
||||
#endif
|
||||
|
||||
/* Select the Touchscreen interrupt pin mode */
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# Merisc customization
|
||||
|
||||
if BOARD_MERISC
|
||||
|
||||
endif # BOARD_MERISC
|
|
@ -0,0 +1 @@
|
|||
obj-y += setup.o flash.o display.o merisc_sysfs.o
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Display setup code for the Merisc board
|
||||
*
|
||||
* Copyright (C) 2008 Martinsson Elektronik AB
|
||||
*
|
||||
* 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/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/fb.h>
|
||||
#include <video/atmel_lcdc.h>
|
||||
#include <asm/setup.h>
|
||||
#include <mach/board.h>
|
||||
#include "merisc.h"
|
||||
|
||||
static struct fb_videomode merisc_fb_videomode[] = {
|
||||
{
|
||||
.refresh = 44,
|
||||
.xres = 640,
|
||||
.yres = 480,
|
||||
.left_margin = 96,
|
||||
.right_margin = 96,
|
||||
.upper_margin = 34,
|
||||
.lower_margin = 8,
|
||||
.hsync_len = 64,
|
||||
.vsync_len = 64,
|
||||
.name = "640x480 @ 44",
|
||||
.pixclock = KHZ2PICOS(25180),
|
||||
.sync = 0,
|
||||
.vmode = FB_VMODE_NONINTERLACED,
|
||||
},
|
||||
};
|
||||
|
||||
static struct fb_monspecs merisc_fb_monspecs = {
|
||||
.manufacturer = "Kyo",
|
||||
.monitor = "TCG075VG2AD",
|
||||
.modedb = merisc_fb_videomode,
|
||||
.modedb_len = ARRAY_SIZE(merisc_fb_videomode),
|
||||
.hfmin = 30000,
|
||||
.hfmax = 33333,
|
||||
.vfmin = 60,
|
||||
.vfmax = 90,
|
||||
.dclkmax = 30000000,
|
||||
};
|
||||
|
||||
struct atmel_lcdfb_info merisc_lcdc_data = {
|
||||
.default_bpp = 24,
|
||||
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
|
||||
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
|
||||
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
|
||||
| ATMEL_LCDC_MEMOR_BIG),
|
||||
.default_monspecs = &merisc_fb_monspecs,
|
||||
.guard_time = 2,
|
||||
};
|
||||
|
||||
static int __init merisc_display_init(void)
|
||||
{
|
||||
at32_add_device_lcdc(0, &merisc_lcdc_data, fbmem_start,
|
||||
fbmem_size, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
device_initcall(merisc_display_init);
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* Merisc board-specific flash initialization
|
||||
*
|
||||
* Copyright (C) 2008 Martinsson Elektronik AB
|
||||
*
|
||||
* 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/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/physmap.h>
|
||||
#include <mach/smc.h>
|
||||
|
||||
/* Will be translated to units of 14.3 ns, rounded up */
|
||||
static struct smc_timing flash_timing __initdata = {
|
||||
.ncs_read_setup = 1 * 14,
|
||||
.nrd_setup = 5 * 14,
|
||||
.ncs_write_setup = 1 * 14,
|
||||
.nwe_setup = 2 * 14,
|
||||
|
||||
.ncs_read_pulse = 12 * 14,
|
||||
.nrd_pulse = 7 * 14,
|
||||
.ncs_write_pulse = 8 * 14,
|
||||
.nwe_pulse = 4 * 14,
|
||||
|
||||
.read_cycle = 14 * 14,
|
||||
.write_cycle = 10 * 14,
|
||||
};
|
||||
|
||||
static struct smc_config flash_config __initdata = {
|
||||
.bus_width = 2,
|
||||
.nrd_controlled = 1,
|
||||
.nwe_controlled = 1,
|
||||
.byte_write = 1,
|
||||
.tdf_cycles = 3,
|
||||
};
|
||||
|
||||
static struct mtd_partition flash_0_parts[] = {
|
||||
{
|
||||
.name = "boot",
|
||||
.offset = 0x00000000,
|
||||
.size = 0x00060000,
|
||||
.mask_flags = 0,
|
||||
},
|
||||
{
|
||||
.name = "kernel",
|
||||
.offset = 0x00060000,
|
||||
.size = 0x00200000,
|
||||
.mask_flags = 0,
|
||||
},
|
||||
{
|
||||
.name = "root",
|
||||
.offset = 0x00260000,
|
||||
.size = MTDPART_SIZ_FULL,
|
||||
.mask_flags = 0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct mtd_partition flash_1_parts[] = {
|
||||
{
|
||||
.name = "2ndflash",
|
||||
.offset = 0x00000000,
|
||||
.size = MTDPART_SIZ_FULL,
|
||||
.mask_flags = 0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct physmap_flash_data flash_data[] = {
|
||||
{
|
||||
.width = 2,
|
||||
.nr_parts = ARRAY_SIZE(flash_0_parts),
|
||||
.parts = flash_0_parts,
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.nr_parts = ARRAY_SIZE(flash_1_parts),
|
||||
.parts = flash_1_parts,
|
||||
}
|
||||
};
|
||||
|
||||
static struct resource flash_resource[] = {
|
||||
{
|
||||
.start = 0x00000000,
|
||||
.end = 0x03ffffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.start = 0x04000000,
|
||||
.end = 0x07ffffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device flash_device[] = {
|
||||
{
|
||||
.name = "physmap-flash",
|
||||
.id = 0,
|
||||
.resource = &flash_resource[0],
|
||||
.num_resources = 1,
|
||||
.dev = {
|
||||
.platform_data = &flash_data[0],
|
||||
},
|
||||
},
|
||||
{
|
||||
.name = "physmap-flash",
|
||||
.id = 1,
|
||||
.resource = &flash_resource[1],
|
||||
.num_resources = 1,
|
||||
.dev = {
|
||||
.platform_data = &flash_data[1],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static int __init merisc_flash_init(void)
|
||||
{
|
||||
int ret;
|
||||
smc_set_timing(&flash_config, &flash_timing);
|
||||
|
||||
ret = smc_set_configuration(0, &flash_config);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "Merisc: failed to set NOR flash timing #0\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = smc_set_configuration(4, &flash_config);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "Merisc: failed to set NOR flash timing #1\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
platform_device_register(&flash_device[0]);
|
||||
platform_device_register(&flash_device[1]);
|
||||
return 0;
|
||||
}
|
||||
device_initcall(merisc_flash_init);
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Merisc exports
|
||||
*
|
||||
* Copyright (C) 2008 Martinsson Elektronik AB
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef __ARCH_AVR32_BOARDS_MERISC_MERISC_H
|
||||
#define __ARCH_AVR32_BOARDS_MERISC_MERISC_H
|
||||
|
||||
const char *merisc_revision(void);
|
||||
const char *merisc_model(void);
|
||||
|
||||
extern struct class merisc_class;
|
||||
|
||||
#endif /* __ARCH_AVR32_BOARDS_MERISC_MERISC_H */
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Merisc sysfs exports
|
||||
*
|
||||
* Copyright (C) 2008 Martinsson Elektronik AB
|
||||
*
|
||||
* 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/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/sysdev.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/ctype.h>
|
||||
#include "merisc.h"
|
||||
|
||||
static ssize_t merisc_model_show(struct class *class, char *buf)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
|
||||
sprintf(buf, "%s\n", merisc_model());
|
||||
ret = strlen(buf) + 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t merisc_revision_show(struct class *class, char *buf)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
|
||||
sprintf(buf, "%s\n", merisc_revision());
|
||||
ret = strlen(buf) + 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct class_attribute merisc_class_attrs[] = {
|
||||
__ATTR(model, S_IRUGO, merisc_model_show, NULL),
|
||||
__ATTR(revision, S_IRUGO, merisc_revision_show, NULL),
|
||||
__ATTR_NULL,
|
||||
};
|
||||
|
||||
struct class merisc_class = {
|
||||
.name = "merisc",
|
||||
.owner = THIS_MODULE,
|
||||
.class_attrs = merisc_class_attrs,
|
||||
};
|
||||
|
||||
static int __init merisc_sysfs_init(void)
|
||||
{
|
||||
int status;
|
||||
|
||||
status = class_register(&merisc_class);
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
postcore_initcall(merisc_sysfs_init);
|
|
@ -0,0 +1,297 @@
|
|||
/*
|
||||
* Board-specific setup code for the Merisc
|
||||
*
|
||||
* Copyright (C) 2008 Martinsson Elektronik AB
|
||||
*
|
||||
* 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/clk.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-gpio.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/spi/ads7846.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/atmel-mci.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/gpio.h>
|
||||
|
||||
#include <mach/at32ap700x.h>
|
||||
#include <mach/board.h>
|
||||
#include <mach/init.h>
|
||||
#include <mach/portmux.h>
|
||||
|
||||
#include "merisc.h"
|
||||
|
||||
/* Holds the autodetected board model and revision */
|
||||
static int merisc_board_id;
|
||||
|
||||
/* Initialized by bootloader-specific startup code. */
|
||||
struct tag *bootloader_tags __initdata;
|
||||
|
||||
/* Oscillator frequencies. These are board specific */
|
||||
unsigned long at32_board_osc_rates[3] = {
|
||||
[0] = 32768, /* 32.768 kHz on RTC osc */
|
||||
[1] = 20000000, /* 20 MHz on osc0 */
|
||||
[2] = 12000000, /* 12 MHz on osc1 */
|
||||
};
|
||||
|
||||
struct eth_addr {
|
||||
u8 addr[6];
|
||||
};
|
||||
|
||||
static struct eth_addr __initdata hw_addr[2];
|
||||
static struct eth_platform_data __initdata eth_data[2];
|
||||
|
||||
static int ads7846_get_pendown_state_PB26(void)
|
||||
{
|
||||
return !gpio_get_value(GPIO_PIN_PB(26));
|
||||
}
|
||||
|
||||
static int ads7846_get_pendown_state_PB28(void)
|
||||
{
|
||||
return !gpio_get_value(GPIO_PIN_PB(28));
|
||||
}
|
||||
|
||||
static struct ads7846_platform_data __initdata ads7846_data = {
|
||||
.model = 7846,
|
||||
.vref_delay_usecs = 100,
|
||||
.vref_mv = 0,
|
||||
.keep_vref_on = 0,
|
||||
.settle_delay_usecs = 150,
|
||||
.penirq_recheck_delay_usecs = 1,
|
||||
.x_plate_ohms = 800,
|
||||
.debounce_rep = 4,
|
||||
.debounce_max = 10,
|
||||
.debounce_tol = 50,
|
||||
.get_pendown_state = ads7846_get_pendown_state_PB26,
|
||||
.filter_init = NULL,
|
||||
.filter = NULL,
|
||||
.filter_cleanup = NULL,
|
||||
};
|
||||
|
||||
static struct spi_board_info __initdata spi0_board_info[] = {
|
||||
{
|
||||
.modalias = "ads7846",
|
||||
.max_speed_hz = 3250000,
|
||||
.chip_select = 0,
|
||||
.bus_num = 0,
|
||||
.platform_data = &ads7846_data,
|
||||
.mode = SPI_MODE_0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct mci_platform_data __initdata mci0_data = {
|
||||
.slot[0] = {
|
||||
.bus_width = 4,
|
||||
.detect_pin = GPIO_PIN_PE(19),
|
||||
.wp_pin = GPIO_PIN_PE(20),
|
||||
},
|
||||
};
|
||||
|
||||
static int __init parse_tag_ethernet(struct tag *tag)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = tag->u.ethernet.mac_index;
|
||||
if (i < ARRAY_SIZE(hw_addr)) {
|
||||
memcpy(hw_addr[i].addr, tag->u.ethernet.hw_address,
|
||||
sizeof(hw_addr[i].addr));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
__tagtable(ATAG_ETHERNET, parse_tag_ethernet);
|
||||
|
||||
static void __init set_hw_addr(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
const u8 *addr;
|
||||
void __iomem *regs;
|
||||
struct clk *pclk;
|
||||
|
||||
if (!res)
|
||||
return;
|
||||
|
||||
if (pdev->id >= ARRAY_SIZE(hw_addr))
|
||||
return;
|
||||
|
||||
addr = hw_addr[pdev->id].addr;
|
||||
if (!is_valid_ether_addr(addr))
|
||||
return;
|
||||
|
||||
regs = (void __iomem __force *)res->start;
|
||||
pclk = clk_get(&pdev->dev, "pclk");
|
||||
if (!pclk)
|
||||
return;
|
||||
|
||||
clk_enable(pclk);
|
||||
__raw_writel((addr[3] << 24) | (addr[2] << 16)
|
||||
| (addr[1] << 8) | addr[0], regs + 0x98);
|
||||
__raw_writel((addr[5] << 8) | addr[4], regs + 0x9c);
|
||||
clk_disable(pclk);
|
||||
clk_put(pclk);
|
||||
}
|
||||
|
||||
static struct i2c_gpio_platform_data i2c_gpio_data = {
|
||||
.sda_pin = GPIO_PIN_PA(6),
|
||||
.scl_pin = GPIO_PIN_PA(7),
|
||||
.sda_is_open_drain = 1,
|
||||
.scl_is_open_drain = 1,
|
||||
.udelay = 2,
|
||||
};
|
||||
|
||||
static struct platform_device i2c_gpio_device = {
|
||||
.name = "i2c-gpio",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = &i2c_gpio_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct i2c_board_info __initdata i2c_info[] = {
|
||||
{
|
||||
I2C_BOARD_INFO("pcf8563", 0x51)
|
||||
},
|
||||
};
|
||||
|
||||
#ifdef CONFIG_LEDS_ATMEL_PWM
|
||||
static struct gpio_led stk_pwm_led[] = {
|
||||
{
|
||||
.name = "backlight",
|
||||
.gpio = 0, /* PWM channel 0 (LCD backlight) */
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_led_platform_data stk_pwm_led_data = {
|
||||
.num_leds = ARRAY_SIZE(stk_pwm_led),
|
||||
.leds = stk_pwm_led,
|
||||
};
|
||||
|
||||
static struct platform_device stk_pwm_led_dev = {
|
||||
.name = "leds-atmel-pwm",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &stk_pwm_led_data,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
const char *merisc_model(void)
|
||||
{
|
||||
switch (merisc_board_id) {
|
||||
case 0:
|
||||
case 1:
|
||||
return "500-01";
|
||||
case 2:
|
||||
return "BT";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const char *merisc_revision(void)
|
||||
{
|
||||
switch (merisc_board_id) {
|
||||
case 0:
|
||||
return "B";
|
||||
case 1:
|
||||
return "D";
|
||||
case 2:
|
||||
return "A";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static void detect_merisc_board_id(void)
|
||||
{
|
||||
/* Board ID pins MUST be set as input or the board may be damaged */
|
||||
at32_select_gpio(GPIO_PIN_PA(24), AT32_GPIOF_PULLUP);
|
||||
at32_select_gpio(GPIO_PIN_PA(25), AT32_GPIOF_PULLUP);
|
||||
at32_select_gpio(GPIO_PIN_PA(26), AT32_GPIOF_PULLUP);
|
||||
at32_select_gpio(GPIO_PIN_PA(27), AT32_GPIOF_PULLUP);
|
||||
|
||||
merisc_board_id = !gpio_get_value(GPIO_PIN_PA(24)) +
|
||||
!gpio_get_value(GPIO_PIN_PA(25)) * 2 +
|
||||
!gpio_get_value(GPIO_PIN_PA(26)) * 4 +
|
||||
!gpio_get_value(GPIO_PIN_PA(27)) * 8;
|
||||
}
|
||||
|
||||
void __init setup_board(void)
|
||||
{
|
||||
at32_map_usart(0, 0, 0);
|
||||
at32_map_usart(1, 1, 0);
|
||||
at32_map_usart(3, 3, 0);
|
||||
at32_setup_serial_console(1);
|
||||
}
|
||||
|
||||
static int __init merisc_init(void)
|
||||
{
|
||||
detect_merisc_board_id();
|
||||
|
||||
printk(KERN_NOTICE "BOARD: Merisc %s revision %s\n", merisc_model(),
|
||||
merisc_revision());
|
||||
|
||||
/* Reserve pins for SDRAM */
|
||||
at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL | (1 << 26));
|
||||
|
||||
if (merisc_board_id >= 1)
|
||||
at32_map_usart(2, 2, 0);
|
||||
|
||||
at32_add_device_usart(0);
|
||||
at32_add_device_usart(1);
|
||||
if (merisc_board_id >= 1)
|
||||
at32_add_device_usart(2);
|
||||
at32_add_device_usart(3);
|
||||
set_hw_addr(at32_add_device_eth(0, ð_data[0]));
|
||||
|
||||
/* ADS7846 PENIRQ */
|
||||
if (merisc_board_id == 0) {
|
||||
ads7846_data.get_pendown_state = ads7846_get_pendown_state_PB26;
|
||||
at32_select_periph(GPIO_PIOB_BASE, 1 << 26,
|
||||
GPIO_PERIPH_A, AT32_GPIOF_PULLUP);
|
||||
spi0_board_info[0].irq = AT32_EXTINT(1);
|
||||
} else {
|
||||
ads7846_data.get_pendown_state = ads7846_get_pendown_state_PB28;
|
||||
at32_select_periph(GPIO_PIOB_BASE, 1 << 28, GPIO_PERIPH_A,
|
||||
AT32_GPIOF_PULLUP);
|
||||
spi0_board_info[0].irq = AT32_EXTINT(3);
|
||||
}
|
||||
|
||||
/* ADS7846 busy pin */
|
||||
at32_select_gpio(GPIO_PIN_PA(4), AT32_GPIOF_PULLUP);
|
||||
|
||||
at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
|
||||
|
||||
at32_add_device_mci(0, &mci0_data);
|
||||
|
||||
#ifdef CONFIG_LEDS_ATMEL_PWM
|
||||
at32_add_device_pwm((1 << 0) | (1 << 2));
|
||||
platform_device_register(&stk_pwm_led_dev);
|
||||
#else
|
||||
at32_add_device_pwm((1 << 2));
|
||||
#endif
|
||||
|
||||
at32_select_gpio(i2c_gpio_data.sda_pin,
|
||||
AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
|
||||
at32_select_gpio(i2c_gpio_data.scl_pin,
|
||||
AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
|
||||
platform_device_register(&i2c_gpio_device);
|
||||
|
||||
i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
|
||||
|
||||
return 0;
|
||||
}
|
||||
postcore_initcall(merisc_init);
|
|
@ -175,10 +175,10 @@ static void __init set_hw_addr(struct platform_device *pdev)
|
|||
|
||||
void __init setup_board(void)
|
||||
{
|
||||
at32_map_usart(0, 0); /* USART 0: /dev/ttyS0 (TTL --> Altera) */
|
||||
at32_map_usart(1, 1); /* USART 1: /dev/ttyS1 (RS232) */
|
||||
at32_map_usart(2, 2); /* USART 2: /dev/ttyS2 (RS485) */
|
||||
at32_map_usart(3, 3); /* USART 3: /dev/ttyS3 (RS422 Multidrop) */
|
||||
at32_map_usart(0, 0, 0); /* USART 0: /dev/ttyS0 (TTL --> Altera) */
|
||||
at32_map_usart(1, 1, 0); /* USART 1: /dev/ttyS1 (RS232) */
|
||||
at32_map_usart(2, 2, 0); /* USART 2: /dev/ttyS2 (RS485) */
|
||||
at32_map_usart(3, 3, 0); /* USART 3: /dev/ttyS3 (RS422 Multidrop) */
|
||||
}
|
||||
|
||||
static struct i2c_gpio_platform_data i2c_gpio_data = {
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -26,6 +26,9 @@
|
|||
#include <mach/portmux.h>
|
||||
#include <mach/sram.h>
|
||||
|
||||
#include <sound/atmel-abdac.h>
|
||||
#include <sound/atmel-ac97c.h>
|
||||
|
||||
#include <video/atmel_lcdc.h>
|
||||
|
||||
#include "clock.h"
|
||||
|
@ -963,56 +966,68 @@ static struct resource atmel_usart3_resource[] = {
|
|||
DEFINE_DEV_DATA(atmel_usart, 3);
|
||||
DEV_CLK(usart, atmel_usart3, pba, 6);
|
||||
|
||||
static inline void configure_usart0_pins(void)
|
||||
static inline void configure_usart0_pins(int flags)
|
||||
{
|
||||
u32 pin_mask = (1 << 8) | (1 << 9); /* RXD & TXD */
|
||||
if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 6);
|
||||
if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 7);
|
||||
if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 10);
|
||||
|
||||
select_peripheral(PIOA, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP);
|
||||
}
|
||||
|
||||
static inline void configure_usart1_pins(void)
|
||||
static inline void configure_usart1_pins(int flags)
|
||||
{
|
||||
u32 pin_mask = (1 << 17) | (1 << 18); /* RXD & TXD */
|
||||
if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 19);
|
||||
if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 20);
|
||||
if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 16);
|
||||
|
||||
select_peripheral(PIOA, pin_mask, PERIPH_A, AT32_GPIOF_PULLUP);
|
||||
}
|
||||
|
||||
static inline void configure_usart2_pins(void)
|
||||
static inline void configure_usart2_pins(int flags)
|
||||
{
|
||||
u32 pin_mask = (1 << 26) | (1 << 27); /* RXD & TXD */
|
||||
if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 30);
|
||||
if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 29);
|
||||
if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 28);
|
||||
|
||||
select_peripheral(PIOB, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP);
|
||||
}
|
||||
|
||||
static inline void configure_usart3_pins(void)
|
||||
static inline void configure_usart3_pins(int flags)
|
||||
{
|
||||
u32 pin_mask = (1 << 18) | (1 << 17); /* RXD & TXD */
|
||||
if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 16);
|
||||
if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 15);
|
||||
if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 19);
|
||||
|
||||
select_peripheral(PIOB, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP);
|
||||
}
|
||||
|
||||
static struct platform_device *__initdata at32_usarts[4];
|
||||
|
||||
void __init at32_map_usart(unsigned int hw_id, unsigned int line)
|
||||
void __init at32_map_usart(unsigned int hw_id, unsigned int line, int flags)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
|
||||
switch (hw_id) {
|
||||
case 0:
|
||||
pdev = &atmel_usart0_device;
|
||||
configure_usart0_pins();
|
||||
configure_usart0_pins(flags);
|
||||
break;
|
||||
case 1:
|
||||
pdev = &atmel_usart1_device;
|
||||
configure_usart1_pins();
|
||||
configure_usart1_pins(flags);
|
||||
break;
|
||||
case 2:
|
||||
pdev = &atmel_usart2_device;
|
||||
configure_usart2_pins();
|
||||
configure_usart2_pins(flags);
|
||||
break;
|
||||
case 3:
|
||||
pdev = &atmel_usart3_device;
|
||||
configure_usart3_pins();
|
||||
configure_usart3_pins(flags);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -1753,7 +1768,7 @@ at32_add_device_usba(unsigned int id, struct usba_platform_data *data)
|
|||
if (platform_device_add_data(pdev, data, sizeof(usba_data)))
|
||||
goto out_free_pdev;
|
||||
|
||||
if (data->vbus_pin >= 0)
|
||||
if (gpio_is_valid(data->vbus_pin))
|
||||
at32_select_gpio(data->vbus_pin, 0);
|
||||
|
||||
usba0_pclk.dev = &pdev->dev;
|
||||
|
@ -1980,11 +1995,14 @@ static struct clk atmel_ac97c0_pclk = {
|
|||
};
|
||||
|
||||
struct platform_device *__init
|
||||
at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
|
||||
at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
struct ac97c_platform_data _data;
|
||||
u32 pin_mask;
|
||||
struct platform_device *pdev;
|
||||
struct dw_dma_slave *rx_dws;
|
||||
struct dw_dma_slave *tx_dws;
|
||||
struct ac97c_platform_data _data;
|
||||
u32 pin_mask;
|
||||
|
||||
if (id != 0)
|
||||
return NULL;
|
||||
|
@ -1995,37 +2013,52 @@ at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
|
|||
|
||||
if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
|
||||
ARRAY_SIZE(atmel_ac97c0_resource)))
|
||||
goto fail;
|
||||
goto out_free_resources;
|
||||
|
||||
if (!data) {
|
||||
data = &_data;
|
||||
memset(data, 0, sizeof(struct ac97c_platform_data));
|
||||
data->reset_pin = GPIO_PIN_NONE;
|
||||
data->reset_pin = -ENODEV;
|
||||
}
|
||||
|
||||
data->dma_rx_periph_id = 3;
|
||||
data->dma_tx_periph_id = 4;
|
||||
data->dma_controller_id = 0;
|
||||
rx_dws = &data->rx_dws;
|
||||
tx_dws = &data->tx_dws;
|
||||
|
||||
/* Check if DMA slave interface for capture should be configured. */
|
||||
if (flags & AC97C_CAPTURE) {
|
||||
rx_dws->dma_dev = &dw_dmac0_device.dev;
|
||||
rx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
|
||||
rx_dws->cfg_hi = DWC_CFGH_SRC_PER(3);
|
||||
rx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
|
||||
}
|
||||
|
||||
/* Check if DMA slave interface for playback should be configured. */
|
||||
if (flags & AC97C_PLAYBACK) {
|
||||
tx_dws->dma_dev = &dw_dmac0_device.dev;
|
||||
tx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
|
||||
tx_dws->cfg_hi = DWC_CFGH_DST_PER(4);
|
||||
tx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
|
||||
}
|
||||
|
||||
if (platform_device_add_data(pdev, data,
|
||||
sizeof(struct ac97c_platform_data)))
|
||||
goto fail;
|
||||
goto out_free_resources;
|
||||
|
||||
pin_mask = (1 << 20) | (1 << 21); /* SDO & SYNC */
|
||||
pin_mask |= (1 << 22) | (1 << 23); /* SCLK & SDI */
|
||||
/* SDO | SYNC | SCLK | SDI */
|
||||
pin_mask = (1 << 20) | (1 << 21) | (1 << 22) | (1 << 23);
|
||||
|
||||
select_peripheral(PIOB, pin_mask, PERIPH_B, 0);
|
||||
|
||||
/* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */
|
||||
if (data->reset_pin != GPIO_PIN_NONE)
|
||||
at32_select_gpio(data->reset_pin, 0);
|
||||
if (gpio_is_valid(data->reset_pin))
|
||||
at32_select_gpio(data->reset_pin, AT32_GPIOF_OUTPUT
|
||||
| AT32_GPIOF_HIGH);
|
||||
|
||||
atmel_ac97c0_pclk.dev = &pdev->dev;
|
||||
|
||||
platform_device_add(pdev);
|
||||
return pdev;
|
||||
|
||||
fail:
|
||||
out_free_resources:
|
||||
platform_device_put(pdev);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2053,21 +2086,34 @@ static struct clk abdac0_sample_clk = {
|
|||
.index = 6,
|
||||
};
|
||||
|
||||
struct platform_device *__init at32_add_device_abdac(unsigned int id)
|
||||
struct platform_device *__init
|
||||
at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
u32 pin_mask;
|
||||
struct platform_device *pdev;
|
||||
struct dw_dma_slave *dws;
|
||||
u32 pin_mask;
|
||||
|
||||
if (id != 0)
|
||||
if (id != 0 || !data)
|
||||
return NULL;
|
||||
|
||||
pdev = platform_device_alloc("abdac", id);
|
||||
pdev = platform_device_alloc("atmel_abdac", id);
|
||||
if (!pdev)
|
||||
return NULL;
|
||||
|
||||
if (platform_device_add_resources(pdev, abdac0_resource,
|
||||
ARRAY_SIZE(abdac0_resource)))
|
||||
goto err_add_resources;
|
||||
goto out_free_resources;
|
||||
|
||||
dws = &data->dws;
|
||||
|
||||
dws->dma_dev = &dw_dmac0_device.dev;
|
||||
dws->reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
|
||||
dws->cfg_hi = DWC_CFGH_DST_PER(2);
|
||||
dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
|
||||
|
||||
if (platform_device_add_data(pdev, data,
|
||||
sizeof(struct atmel_abdac_pdata)))
|
||||
goto out_free_resources;
|
||||
|
||||
pin_mask = (1 << 20) | (1 << 22); /* DATA1 & DATAN1 */
|
||||
pin_mask |= (1 << 21) | (1 << 23); /* DATA0 & DATAN0 */
|
||||
|
@ -2080,7 +2126,7 @@ struct platform_device *__init at32_add_device_abdac(unsigned int id)
|
|||
platform_device_add(pdev);
|
||||
return pdev;
|
||||
|
||||
err_add_resources:
|
||||
out_free_resources:
|
||||
platform_device_put(pdev);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -171,25 +171,49 @@
|
|||
ATMEL_LCDC(PE, DATA20) | ATMEL_LCDC(PE, DATA21) | \
|
||||
ATMEL_LCDC(PD, DATA22) | ATMEL_LCDC(PD, DATA23))
|
||||
|
||||
#define ATMEL_LCDC_PRI_15B_DATA ( \
|
||||
ATMEL_LCDC(PC, DATA0) | ATMEL_LCDC(PC, DATA1) | \
|
||||
#define ATMEL_LCDC_PRI_18B_DATA ( \
|
||||
ATMEL_LCDC(PC, DATA2) | ATMEL_LCDC(PC, DATA3) | \
|
||||
ATMEL_LCDC(PC, DATA4) | ATMEL_LCDC(PC, DATA5) | \
|
||||
ATMEL_LCDC(PD, DATA8) | ATMEL_LCDC(PD, DATA9) | \
|
||||
ATMEL_LCDC(PD, DATA6) | ATMEL_LCDC(PD, DATA7) | \
|
||||
ATMEL_LCDC(PD, DATA10) | ATMEL_LCDC(PD, DATA11) | \
|
||||
ATMEL_LCDC(PD, DATA12) | ATMEL_LCDC(PD, DATA16) | \
|
||||
ATMEL_LCDC(PD, DATA17) | ATMEL_LCDC(PD, DATA18) | \
|
||||
ATMEL_LCDC(PD, DATA19) | ATMEL_LCDC(PD, DATA20))
|
||||
ATMEL_LCDC(PD, DATA12) | ATMEL_LCDC(PD, DATA13) | \
|
||||
ATMEL_LCDC(PD, DATA14) | ATMEL_LCDC(PD, DATA15) | \
|
||||
ATMEL_LCDC(PD, DATA18) | ATMEL_LCDC(PD, DATA19) | \
|
||||
ATMEL_LCDC(PD, DATA20) | ATMEL_LCDC(PD, DATA21) | \
|
||||
ATMEL_LCDC(PD, DATA22) | ATMEL_LCDC(PD, DATA23))
|
||||
|
||||
#define ATMEL_LCDC_ALT_15B_DATA ( \
|
||||
ATMEL_LCDC(PE, DATA0) | ATMEL_LCDC(PE, DATA1) | \
|
||||
#define ATMEL_LCDC_ALT_18B_DATA ( \
|
||||
ATMEL_LCDC(PE, DATA2) | ATMEL_LCDC(PE, DATA3) | \
|
||||
ATMEL_LCDC(PE, DATA4) | ATMEL_LCDC(PC, DATA5) | \
|
||||
ATMEL_LCDC(PE, DATA8) | ATMEL_LCDC(PE, DATA9) | \
|
||||
ATMEL_LCDC(PD, DATA6) | ATMEL_LCDC(PD, DATA7) | \
|
||||
ATMEL_LCDC(PE, DATA10) | ATMEL_LCDC(PE, DATA11) | \
|
||||
ATMEL_LCDC(PE, DATA12) | ATMEL_LCDC(PE, DATA16) | \
|
||||
ATMEL_LCDC(PE, DATA17) | ATMEL_LCDC(PE, DATA18) | \
|
||||
ATMEL_LCDC(PE, DATA19) | ATMEL_LCDC(PE, DATA20))
|
||||
ATMEL_LCDC(PE, DATA12) | ATMEL_LCDC(PD, DATA13) | \
|
||||
ATMEL_LCDC(PD, DATA14) | ATMEL_LCDC(PD, DATA15) | \
|
||||
ATMEL_LCDC(PE, DATA18) | ATMEL_LCDC(PE, DATA19) | \
|
||||
ATMEL_LCDC(PE, DATA20) | ATMEL_LCDC(PE, DATA21) | \
|
||||
ATMEL_LCDC(PD, DATA22) | ATMEL_LCDC(PD, DATA23))
|
||||
|
||||
#define ATMEL_LCDC_PRI_15B_DATA ( \
|
||||
ATMEL_LCDC(PC, DATA3) | ATMEL_LCDC(PC, DATA4) | \
|
||||
ATMEL_LCDC(PC, DATA5) | ATMEL_LCDC(PD, DATA6) | \
|
||||
ATMEL_LCDC(PD, DATA7) | \
|
||||
ATMEL_LCDC(PD, DATA11) | ATMEL_LCDC(PD, DATA12) | \
|
||||
ATMEL_LCDC(PD, DATA13) | ATMEL_LCDC(PD, DATA14) | \
|
||||
ATMEL_LCDC(PD, DATA15) | \
|
||||
ATMEL_LCDC(PD, DATA19) | ATMEL_LCDC(PD, DATA20) | \
|
||||
ATMEL_LCDC(PD, DATA21) | ATMEL_LCDC(PD, DATA22) | \
|
||||
ATMEL_LCDC(PD, DATA23))
|
||||
|
||||
#define ATMEL_LCDC_ALT_15B_DATA ( \
|
||||
ATMEL_LCDC(PE, DATA3) | ATMEL_LCDC(PE, DATA4) | \
|
||||
ATMEL_LCDC(PC, DATA5) | ATMEL_LCDC(PD, DATA6) | \
|
||||
ATMEL_LCDC(PD, DATA7) | \
|
||||
ATMEL_LCDC(PE, DATA11) | ATMEL_LCDC(PE, DATA12) | \
|
||||
ATMEL_LCDC(PD, DATA13) | ATMEL_LCDC(PD, DATA14) | \
|
||||
ATMEL_LCDC(PD, DATA15) | \
|
||||
ATMEL_LCDC(PE, DATA19) | ATMEL_LCDC(PE, DATA20) | \
|
||||
ATMEL_LCDC(PE, DATA21) | ATMEL_LCDC(PD, DATA22) | \
|
||||
ATMEL_LCDC(PD, DATA23))
|
||||
|
||||
#define ATMEL_LCDC_PRI_CONTROL ( \
|
||||
ATMEL_LCDC(PC, CC) | ATMEL_LCDC(PC, DVAL) | \
|
||||
|
@ -207,6 +231,10 @@
|
|||
|
||||
#define ATMEL_LCDC_ALT_24BIT (ATMEL_LCDC_CONTROL | ATMEL_LCDC_ALT_24B_DATA)
|
||||
|
||||
#define ATMEL_LCDC_PRI_18BIT (ATMEL_LCDC_CONTROL | ATMEL_LCDC_PRI_18B_DATA)
|
||||
|
||||
#define ATMEL_LCDC_ALT_18BIT (ATMEL_LCDC_CONTROL | ATMEL_LCDC_ALT_18B_DATA)
|
||||
|
||||
#define ATMEL_LCDC_PRI_15BIT (ATMEL_LCDC_CONTROL | ATMEL_LCDC_PRI_15B_DATA)
|
||||
|
||||
#define ATMEL_LCDC_ALT_15BIT (ATMEL_LCDC_CONTROL | ATMEL_LCDC_ALT_15B_DATA)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* in this array is chip-dependent.
|
||||
*/
|
||||
extern unsigned long at32_board_osc_rates[];
|
||||
|
||||
|
||||
/*
|
||||
* This used to add essential system devices, but this is now done
|
||||
* automatically. Please don't use it in new board code.
|
||||
|
@ -26,12 +26,17 @@ static inline void __deprecated at32_add_system_devices(void)
|
|||
#define ATMEL_MAX_UART 4
|
||||
extern struct platform_device *atmel_default_console_device;
|
||||
|
||||
/* Flags for selecting USART extra pins */
|
||||
#define ATMEL_USART_RTS 0x01
|
||||
#define ATMEL_USART_CTS 0x02
|
||||
#define ATMEL_USART_CLK 0x03
|
||||
|
||||
struct atmel_uart_data {
|
||||
short use_dma_tx; /* use transmit DMA? */
|
||||
short use_dma_rx; /* use receive DMA? */
|
||||
void __iomem *regs; /* virtual base address, if any */
|
||||
};
|
||||
void at32_map_usart(unsigned int hw_id, unsigned int line);
|
||||
void at32_map_usart(unsigned int hw_id, unsigned int line, int flags);
|
||||
struct platform_device *at32_add_device_usart(unsigned int id);
|
||||
|
||||
struct eth_platform_data {
|
||||
|
@ -88,16 +93,15 @@ struct mci_platform_data;
|
|||
struct platform_device *
|
||||
at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
|
||||
|
||||
struct ac97c_platform_data {
|
||||
unsigned short dma_rx_periph_id;
|
||||
unsigned short dma_tx_periph_id;
|
||||
unsigned short dma_controller_id;
|
||||
int reset_pin;
|
||||
};
|
||||
struct ac97c_platform_data;
|
||||
struct platform_device *
|
||||
at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data);
|
||||
at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
|
||||
unsigned int flags);
|
||||
|
||||
struct atmel_abdac_pdata;
|
||||
struct platform_device *
|
||||
at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data);
|
||||
|
||||
struct platform_device *at32_add_device_abdac(unsigned int id);
|
||||
struct platform_device *at32_add_device_psif(unsigned int id);
|
||||
|
||||
struct cf_platform_data {
|
||||
|
|
|
@ -1020,7 +1020,8 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
|
|||
|
||||
/* Get current mode register */
|
||||
mode = UART_GET_MR(port) & ~(ATMEL_US_USCLKS | ATMEL_US_CHRL
|
||||
| ATMEL_US_NBSTOP | ATMEL_US_PAR);
|
||||
| ATMEL_US_NBSTOP | ATMEL_US_PAR
|
||||
| ATMEL_US_USMODE);
|
||||
|
||||
baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
|
||||
quot = uart_get_divisor(port, baud);
|
||||
|
@ -1065,6 +1066,12 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
|
|||
} else
|
||||
mode |= ATMEL_US_PAR_NONE;
|
||||
|
||||
/* hardware handshake (RTS/CTS) */
|
||||
if (termios->c_cflag & CRTSCTS)
|
||||
mode |= ATMEL_US_USMODE_HWHS;
|
||||
else
|
||||
mode |= ATMEL_US_USMODE_NORMAL;
|
||||
|
||||
spin_lock_irqsave(&port->lock, flags);
|
||||
|
||||
port->read_status_mask = ATMEL_US_OVRE;
|
||||
|
|
|
@ -319,7 +319,7 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc)
|
|||
|
||||
static int vbus_is_present(struct usba_udc *udc)
|
||||
{
|
||||
if (udc->vbus_pin != -1)
|
||||
if (gpio_is_valid(udc->vbus_pin))
|
||||
return gpio_get_value(udc->vbus_pin);
|
||||
|
||||
/* No Vbus detection: Assume always present */
|
||||
|
@ -1821,7 +1821,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
|
|||
DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name);
|
||||
|
||||
udc->vbus_prev = 0;
|
||||
if (udc->vbus_pin != -1)
|
||||
if (gpio_is_valid(udc->vbus_pin))
|
||||
enable_irq(gpio_to_irq(udc->vbus_pin));
|
||||
|
||||
/* If Vbus is present, enable the controller and wait for reset */
|
||||
|
@ -1852,7 +1852,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
|
|||
if (driver != udc->driver || !driver->unbind)
|
||||
return -EINVAL;
|
||||
|
||||
if (udc->vbus_pin != -1)
|
||||
if (gpio_is_valid(udc->vbus_pin))
|
||||
disable_irq(gpio_to_irq(udc->vbus_pin));
|
||||
|
||||
spin_lock_irqsave(&udc->lock, flags);
|
||||
|
@ -1910,7 +1910,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
|
|||
udc->pdev = pdev;
|
||||
udc->pclk = pclk;
|
||||
udc->hclk = hclk;
|
||||
udc->vbus_pin = -1;
|
||||
udc->vbus_pin = -ENODEV;
|
||||
|
||||
ret = -ENOMEM;
|
||||
udc->regs = ioremap(regs->start, regs->end - regs->start + 1);
|
||||
|
@ -1996,7 +1996,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
|
|||
goto err_device_add;
|
||||
}
|
||||
|
||||
if (pdata->vbus_pin >= 0) {
|
||||
if (gpio_is_valid(pdata->vbus_pin)) {
|
||||
if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
|
||||
udc->vbus_pin = pdata->vbus_pin;
|
||||
|
||||
|
@ -2005,7 +2005,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
|
|||
"atmel_usba_udc", udc);
|
||||
if (ret) {
|
||||
gpio_free(udc->vbus_pin);
|
||||
udc->vbus_pin = -1;
|
||||
udc->vbus_pin = -ENODEV;
|
||||
dev_warn(&udc->pdev->dev,
|
||||
"failed to request vbus irq; "
|
||||
"assuming always on\n");
|
||||
|
@ -2051,7 +2051,7 @@ static int __exit usba_udc_remove(struct platform_device *pdev)
|
|||
usba_ep_cleanup_debugfs(&usba_ep[i]);
|
||||
usba_cleanup_debugfs(udc);
|
||||
|
||||
if (udc->vbus_pin != -1)
|
||||
if (gpio_is_valid(udc->vbus_pin))
|
||||
gpio_free(udc->vbus_pin);
|
||||
|
||||
free_irq(udc->irq, udc);
|
||||
|
|
Загрузка…
Ссылка в новой задаче