|
root@at91sam9263ek:~# cat /dev/ttyS3
cat: read error: Input/output error
root@at91sam9263ek:~# cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:unknown mmio:0x30000018 irq:86
1: uart:unknown port:00000000 irq:0
2: uart:unknown port:00000000 irq:0
3: uart:unknown port:00000000 irq:0
代码如下:
#include <linux/module.h>
#include <linux/init.h>
#include <linux/serial_8250.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h>
#include <../sam9_smc.h>
#define XR16V554_BASE1 (AT91_CHIPSELECT_2 + 0X00) //Base address of USART0
#define XR16V554_BASE2 (AT91_CHIPSELECT_2 + 0X08)
#define XR16V554_BASE3 (AT91_CHIPSELECT_2 + 0X10)
#define XR16V554_BASE4 (AT91_CHIPSELECT_2 + 0X18)
#define XR16V554_IRQ1 AT91_PIN_PB19
#define XR16V554_IRQ2 AT91_PIN_PB20
#define XR16V554_IRQ3 AT91_PIN_PB21
#define XR16V554_IRQ4 AT91_PIN_PB22
/* Tuned for MCLK=100MHZ also applied for MCLK=133MHZ */
static struct sam9_smc_config __initdata ek_xr16v554_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 2,
.ncs_write_setup = 0,
.nwe_setup = 2,
.ncs_read_pulse = 16, /* min 40ns */
.nrd_pulse = 12, /* min 40ns */
.ncs_write_pulse = 16,
.nwe_pulse = 12,
.read_cycle = 18,
.write_cycle = 18,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
.tdf_cycles = 10,
};
#define PORT(_base,_irq) \
{ \
.mapbase = _base, \
.irq = _irq, \
.uartclk = 7372800, \
.iotype = UPIO_MEM, \
.regshift = 0, \
.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,\
}
static struct plat_serial8250_port exar_data[] = {
PORT(XR16V554_BASE1, XR16V554_IRQ1),
PORT(XR16V554_BASE2, XR16V554_IRQ2),
PORT(XR16V554_BASE3, XR16V554_IRQ3),
PORT(XR16V554_BASE4, XR16V554_IRQ4),
{ },
};
static struct platform_device exar_device = {
.name = "serial8250",
.id = PLAT8250_DEV_AT91_XR16V554,
.dev = {
.platform_data = &exar_data,
},
};
static int __init exar_init(void)
{
/* Set the inerrupt pin to gpio and enable pullup. */
at91_set_GPIO_periph(AT91_PIN_PB19, 1);
at91_set_GPIO_periph(AT91_PIN_PB20, 1);
at91_set_GPIO_periph(AT91_PIN_PB21, 1);
at91_set_GPIO_periph(AT91_PIN_PB22, 1);
/* Enable input and pullup. */
at91_set_gpio_input(AT91_PIN_PB19, 1);
at91_set_gpio_input(AT91_PIN_PB20, 1);
at91_set_gpio_input(AT91_PIN_PB21, 1);
at91_set_gpio_input(AT91_PIN_PB22, 1);
/* Enable glitch. */
at91_set_deglitch(AT91_PIN_PB19, 1);
at91_set_deglitch(AT91_PIN_PB20, 1);
at91_set_deglitch(AT91_PIN_PB21, 1);
at91_set_deglitch(AT91_PIN_PB22, 1);
/* Set up the 8-bit bus */
/* configure chip-select 2 (XR16V554D) */
sam9_smc_configure(2, &ek_xr16v554_smc_config);
printk("8250_at91_xr16v554 device register!\n");
return platform_device_register(&exar_device);
}
module_init(exar_init); |
阿莫论坛20周年了!感谢大家的支持与爱护!!
一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。
|