本帖最后由 15228876176 于 2015-6-12 09:10 编辑
static struct gpmc_timings ext_uart_timings = {
/*Minumum clock period for synchronous mode (in picoseconds)*/
.sync_clk = 0,
/*CS signal timing corresponding to GPMC_CONFIG2*/
.cs_on = 10, //T6S
.cs_rd_off = 80, //oe_off + T7H
.cs_wr_off = 60, //tcs for write: we_off + t13h
// .adv_on = 6,
// .adv_rd_off = 34,
// .adv_wr_off = 44,
.we_on = 20,
.we_off = 60,
.oe_on = 20,
.oe_off = 70,
.access = 60,
.rd_cycle = 110,
.wr_cycle = 90,
.wr_access = 40,
.wr_data_mux_bus = 0,
};
static struct plat_serial8250_port tq3359_ext_uart_data[] ={
{
.mapbase = -1,
.irq = -1,
.uartclk = 1843200,
.iotype = UPIO_MEM,
.regshift = 0,
.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
.irqflags = IRQF_TRIGGER_HIGH,
},
{
.mapbase = -1,
.irq = -1,
.uartclk = 1843200,
.iotype = UPIO_MEM,
.regshift = 0,
.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
.irqflags = IRQF_TRIGGER_HIGH,
},
{
.mapbase = -1,
.irq = -1,
.uartclk = 1843200,
.iotype = UPIO_MEM,
.regshift = 0,
.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
.irqflags = IRQF_TRIGGER_HIGH,
},
{
.mapbase = -1,
.irq = -1,
.uartclk = 1843200,
.iotype = UPIO_MEM,
.regshift = 0,
.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
.irqflags = IRQF_TRIGGER_HIGH,
},
};
static struct platform_device tq3359_ext_uart_device = {
.name = "serial8250",
.id = 0,
.dev = {
.platform_data = tq3359_ext_uart_data,
},
};
void gpmc_extuart_init(void)
{
unsigned long csn1;
unsigned long serial_gpmc_mem_base_phys = 0;
gpmc_cs_write_reg(2,GPMC_CS_CONFIG1,0x82000200);
gpmc_cs_write_reg(2,GPMC_CS_CONFIG2,0x00060801);
gpmc_cs_write_reg(2,GPMC_CS_CONFIG3,0x22000010);
gpmc_cs_write_reg(2,GPMC_CS_CONFIG4,0x06026712);
gpmc_cs_write_reg(2,GPMC_CS_CONFIG5,0x00060906);
gpmc_cs_write_reg(2,GPMC_CS_CONFIG6,0x84000000);
// gpmc_cs_write_reg(2,GPMC_CS_CONFIG7,0x00000043);
gpmc_cs_request(2,SZ_16M,&serial_gpmc_mem_base_phys);
tq3359_ext_uart_data[0].mapbase = serial_gpmc_mem_base_phys;
tq3359_ext_uart_data[0].irq = gpio_to_irq(GPIO_TO_PIN(2,21));
tq3359_ext_uart_data[1].mapbase = serial_gpmc_mem_base_phys + 0x08;
tq3359_ext_uart_data[1].irq = gpio_to_irq(GPIO_TO_PIN(2,21));
tq3359_ext_uart_data[2].mapbase = serial_gpmc_mem_base_phys + 0x10;
tq3359_ext_uart_data[2].irq = gpio_to_irq(GPIO_TO_PIN(2,21));
tq3359_ext_uart_data[3].mapbase = serial_gpmc_mem_base_phys + 0x18;
tq3359_ext_uart_data[3].irq = gpio_to_irq(GPIO_TO_PIN(2,21));
if(platform_device_register(&tq3359_ext_uart_device)<0)
{
printk(KERN_INFO "Unable to register ST16c554 device\n");
goto out_free_cs;
}
return 0;
out_free_cs:
gpmc_cs_free(2);
return -1;
// omap_init_gpmc(gpmc_device, sizeof(gpmc_device));
// omap_init_elm();
} |