搜索
bottom↓
回复: 5

使用at91rm9260和CH438(相当于ex16v598)扩展串口的问题。

[复制链接]

出0入0汤圆

发表于 2015-2-3 19:01:26 | 显示全部楼层 |阅读模式
本帖最后由 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周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

 楼主| 发表于 2015-2-4 11:03:11 | 显示全部楼层
CH438的外接晶体是22.1184M

出0入0汤圆

发表于 2015-2-4 11:08:09 | 显示全部楼层
weimin111 发表于 2015-2-4 11:03
CH438的外接晶体是22.1184M

建议直接使用 alphascale的arm9 , asm9260t,有以太网及 10个串口,你不用扩了。而且lqfp176封装,内置256Mbit sdram。
如果感兴趣,可以联系我。联系方式短消息发给您了。

出0入0汤圆

 楼主| 发表于 2015-2-4 11:29:26 | 显示全部楼层
共享中断时需要改动8250.c吗

出0入0汤圆

 楼主| 发表于 2015-2-4 14:52:28 | 显示全部楼层
weimin111 发表于 2015-2-4 11:29
共享中断时需要改动8250.c吗

没人知道吗

出0入36汤圆

发表于 2016-12-13 20:23:37 | 显示全部楼层
楼主最后搞定了么?
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-3-29 13:20

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表