|
本帖最后由 weimin111 于 2015-2-3 19:01 编辑
使用at91rm9260的A2与CH438的A0连接,使用PC15作为中断,at91rm9260的CS0与与CS连接。现在就是能注册,使用cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:XScale mmio:0x10000080 irq:111 tx:0 rx:0
1: uart:XScale mmio:0x100000C0 irq:111 tx:8 rx:0 RTS|DTR
2: uart:XScale mmio:0x10000020 irq:111 tx:5 rx:0 RTS|DTR
3: uart:XScale mmio:0x10000060 irq:111 tx:0 rx:0
4: uart:XScale mmio:0x100000A0 irq:111 tx:0 rx:0
5: uart:XScale mmio:0x100000E0 irq:111 tx:8 rx:0 RTS|DTR
6: uart:XScale mmio:0x10000000 irq:111 tx:0 rx:0
7: uart:XScale mmio:0x10000040 irq:111 tx:0 rx:0
但是就是收发不了。
我在serial目录下新加了st16v598.c,
/*
* linux/drivers/serial/8250_exar.c
*
* Written by Paul B Schroeder < pschroeder "at" uplogix "dot" com >
* Based on 8250_boca.
*
* Copyright (C) 2005 Russell King.
* Data taken from include/asm-i386/serial.h
*
* 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/init.h>
#include <linux/serial_8250.h>
#include <mach/at91sam9_smc.h>
#include <mach/gpio.h>
#include <../sam9_smc.h>
#define PORT(_base,_irq) \
{ \
.mapbase =(unsigned long)_base, \
.irq = _irq, \
.uartclk = 1843200, \
.iotype = UPIO_MEM, \
.flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP, \
.regshift = 0,\
}
static struct plat_serial8250_port exar598_data[] = {
PORT(AT91_CHIPSELECT_0+0x80,AT91_PIN_PC15),
PORT(AT91_CHIPSELECT_0+0xc0,AT91_PIN_PC15),
PORT(AT91_CHIPSELECT_0+0x20,AT91_PIN_PC15),
PORT(AT91_CHIPSELECT_0+0x60,AT91_PIN_PC15),
PORT(AT91_CHIPSELECT_0+0xa0,AT91_PIN_PC15),
PORT(AT91_CHIPSELECT_0+0xe0,AT91_PIN_PC15),
PORT(AT91_CHIPSELECT_0+0x0,AT91_PIN_PC15),
PORT(AT91_CHIPSELECT_0+0x40,AT91_PIN_PC15),
{ },
};
static struct platform_device exar_device = {
.name = "serial8250",
.id = PLAT8250_DEV_EXAR_ST16V598,
.dev = {
.platform_data = &exar598_data,
},
};
static struct sam9_smc_config __initdata ek_xr16v598_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 2,
.ncs_write_setup = 0,
.nwe_setup = 2,
.ncs_read_pulse = 16,
.nrd_pulse = 12,
.ncs_write_pulse = 16,
.nwe_pulse = 12,
.read_cycle = 18,
.write_cycle = 18,
.mode = AT91_SMC_DBW_8+AT91_SMC_EXNWMODE_DISABLE+
AT91_SMC_READMODE+AT91_SMC_WRITEMODE,
.tdf_cycles = 10,
};
#if defined(CONFIG_SERIAL_8250_EXAR_ST16V598)
static void __init exar_init(struct sam9_smc_config *info)
{
int i;
at91_set_GPIO_periph(AT91_PIN_PC15,1);
at91_set_gpio_input(AT91_PIN_PC15,1);
at91_set_deglitch(AT91_PIN_PC15,1);
sam9_smc_configure(0,&ek_xr16v598_smc_config);
printk("8250_at91_xr598 device register! \n");
return platform_device_register(&exar_device);
}
#else
static void __init exar_init(struct sam9_smc_config *info)
{
}
#endif
module_init(exar_init);
MODULE_AUTHOR("Paul B Schroeder");
MODULE_DESCRIPTION("8250 serial probe module for Exar cards");
MODULE_LICENSE("GPL");
结果是这样
Serial: 8250/16550 driver, 8 ports, IRQ sharing enabled
8250_at91_xr598 device register!
serial8250.6: ttyS0 at MMIO 0x10000080 (irq = 111) is a XScale
serial8250.6: ttyS1 at MMIO 0x100000c0 (irq = 111) is a XScale
serial8250.6: ttyS2 at MMIO 0x10000020 (irq = 111) is a XScale
serial8250.6: ttyS3 at MMIO 0x10000060 (irq = 111) is a XScale
serial8250.6: ttyS4 at MMIO 0x100000a0 (irq = 111) is a XScale
serial8250.6: ttyS5 at MMIO 0x100000e0 (irq = 111) is a XScale
serial8250.6: ttyS6 at MMIO 0x10000000 (irq = 111) is a XScale
serial8250.6: ttyS7 at MMIO 0x10000040 (irq = 111) is a XScale
为什么不是is a 16550a呢 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|