am335x omap serial 驱动分析
am335x 自身的 uart 驱动集成在 kernel 的 arch/arm/mach-omap2/ 里面。
文件是 arch/arm/mach-omap2/serial.c
// 看到最底部 omap_serial_init 入口函数。
void __init omap_serial_init(void)
{
omap_serial_board_init(NULL); // ---> 1.0
}
1.0 omap_serial_board_init
void __init omap_serial_board_init(struct omap_uart_port_info *info)
{
struct omap_uart_state *uart; // ---> 1.1
struct omap_board_data bdata; // ---> 1.1
// 这里是轮询所有 uart ,并配置基本的属性一下
// 在这里,我们主要要弄懂 uart_list 是怎么来的,在哪里被初始化
list_for_each_entry(uart, &uart_list, node) {
bdata.id = uart->num;
bdata.flags = 0;
bdata.pads = NULL;
bdata.pads_cnt = 0;
if (cpu_is_omap44xx() || (cpu_is_omap34xx() &&
!cpu_is_am33xx()))
omap_serial_fill_default_pads(&bdata);
if (!info)
omap_serial_init_port(&bdata, NULL); // ---> 2.0
else
omap_serial_init_port(&bdata, &info[uart->num]);
}
}
1.1 struct omap_uart_state 和 struct omap_board_data
// arch/arm/mach-omap2/serial.c
//
struct omap_uart_state {
int num;
int can_sleep;
struct list_head node;
struct omap_hwmod *oh;
struct platform_device *pdev;
};
// arch/arm/mach-omap2/mux.h
// struct omap_board_data - board specific device data
struct omap_board_data {
int id;
u32 flags;
struct omap_device_pad *pads;
int pads_cnt;
};
2.0 omap_serial_init_port
void __init omap_serial_init_port(struct omap_board_data *bdata,
struct omap_uart_port_info *info)
{
struct omap_uart_state *uart;
struct omap_hwmod *oh;
struct platform_device *pdev;
void *pdata = NULL;
u32 pdata_size = 0;
char *name;
struct omap_uart_port_info omap_up;
if (WARN_ON(!bdata))
return;
if (WARN_ON(bdata->id < 0))
return;
if (WARN_ON(bdata->id >= num_uarts))
return;
list_for_each_entry(uart, &uart_list, node)
if (bdata->id == uart->num)
break;
if (!info)
info = omap_serial_default_info;
oh = uart->oh;
name = DRIVER_NAME;
omap_up.dma_enabled = info->dma_enabled;
omap_up.uartclk = OMAP24XX_BASE_BAUD * 16;
omap_up.flags = UPF_BOOT_AUTOCONF;
omap_up.get_context_loss_count = omap_pm_get_dev_context_loss_count;
omap_up.set_forceidle = omap_uart_set_forceidle;
omap_up.set_noidle = omap_uart_set_noidle;
omap_up.enable_wakeup = omap_uart_enable_wakeup;
omap_up.dma_rx_buf_size = info->dma_rx_buf_size;
omap_up.dma_rx_timeout = info->dma_rx_timeout;
omap_up.dma_rx_poll_rate = info->dma_rx_poll_rate;
omap_up.autosuspend_timeout = info->autosuspend_timeout;
/* Enable the MDR1 Errata i202 for OMAP2430/3xxx/44xx */
if (!cpu_is_omap2420() && !cpu_is_ti816x())
omap_up.errata |= UART_ERRATA_i202_MDR1_ACCESS;
/* Enable DMA Mode Force Idle Errata i291 for omap34xx/3630 */
if ((cpu_is_omap34xx() || cpu_is_omap3630()) && !cpu_is_am33xx())
omap_up.errata |= UART_ERRATA_i291_DMA_FORCEIDLE;
pdata = &omap_up;
pdata_size = sizeof(struct omap_uart_port_info);
if (WARN_ON(!oh))
return;
pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
NULL, 0, false);
WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n",
name, oh->name);
if ((console_uart_id == bdata->id) && no_console_suspend)
omap_device_disable_idle_on_suspend(pdev);
oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
uart->pdev = pdev;
oh->dev_attr = uart;
if (((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads)
&& !uart_debug)
device_init_wakeup(&pdev->dev, true);
}
am335x omap serial 驱动分析的更多相关文章
- [tty与uart]3.tty驱动分析
转自:http://www.wowotech.net/linux_kenrel/183.html 目录: 1 首先分析设备驱动的注册 1.1 uart_register_driver分析 1.2 tt ...
- linux内核SPI总线驱动分析(一)(转)
linux内核SPI总线驱动分析(一)(转) 下面有两个大的模块: 一个是SPI总线驱动的分析 (研究了具体实现的过程) 另一个是SPI总线驱动的编写(不用研究具体的实现过程) ...
- linux串口驱动分析
linux串口驱动分析 硬件资源及描写叙述 s3c2440A 通用异步接收器和发送器(UART)提供了三个独立的异步串行 I/O(SIO)port,每一个port都能够在中断模式或 DMA 模式下操作 ...
- 基于335X的UBOOT网口驱动分析
基于335X的UBOOT网口驱动分析 一.软硬件平台资料 1. 开发板:创龙AM3359核心板,网口采用RMII形式 2. UBOOT版本:U-Boot-2016.05,采用FDT和DM. 参考链 ...
- Linux 串口、usb转串口驱动分析(2-2) 【转】
转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=26807463&id=4186852 Linux 串口.usb转 ...
- Linux 串口、usb转串口驱动分析(2-1) 【转】
转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=26807463&id=4186851 Linux 串口.usb转 ...
- [uart]3.tty驱动分析
转自:http://www.wowotech.net/linux_kenrel/183.html 目录: 1 首先分析设备驱动的注册 1.1 uart_register_driver分析 1.2 tt ...
- linux驱动基础系列--Linux 串口、usb转串口驱动分析
前言 主要是想对Linux 串口.usb转串口驱动框架有一个整体的把控,因此会忽略某些细节,同时里面涉及到的一些驱动基础,比如字符设备驱动.平台驱动等也不进行详细说明原理.如果有任何错误地方,请指出, ...
- Linux gadget驱动分析1------驱动加载过程
为了解决一个问题,简单看了一遍linux gadget驱动的加载流程.做一下记录. 使用的内核为linux 2.6.35 硬件为芯唐NUC950. gadget是在UDC驱动上面的一层,如果要编写ga ...
随机推荐
- 百度地图API画多边型,测面积
效果: 脚本: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www ...
- [NPM] Avoid Duplicate Commands by Calling one NPM Script from Another
We can get a lot of utility through CLI tools invoked via npm scripts. Many of these tools have APIs ...
- 数组根据index拆分和查询下标
private class ArrayTool<T> { /// <summary>查询值在数组中的下标</summary> /// <param name= ...
- Android编译程序报错:Re-installation failed due to different application signatures.
如果机子上已经安装非本机编译的android程序,在编译的时候就会报错.方法首选的是删除原程序,然后再进行编译. 但是有一部分程序是烧录在系统程序里面的,无法直接删除,这时候可以使用adb shell ...
- T-SQL 之 触发器
触发器可以做很多事情,但也会带来很多问题.正确的使用在于在适当的时候使用,而不要在不适当的时候使用它们. 触发器的一些常见用途如下: [1] 弹性参照完整性:实现很多DRI不能实现的操作(例如,跨数据 ...
- Android高手进阶篇4-实现侧滑菜单框架,一分钟集成到项目中
先来看下面的这张效果图: 上面这张效果图是百度影音的,现在在Android上很流行,最初是由facebook自己实现的,而后各大应用有跟风之势,那么这种侧滑效果是如何实现的呢? 网上现在这种侧滑菜单的 ...
- AP*更新供应商地点
--更新供应商地点 PROCEDURE update_vendor_site(p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false, x_return ...
- javascript 原生实现 jquery live/delegate
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xht ...
- Zmodem transfer canceled by remote side问题的解决办法!
在使用跳转机跳转到另外一台机器的时候,上传一个安装包,此时使用rz命令上传文件,例如:resin-pro-4.0.44.tar.gz,结果出现如下错误提示: 点击确定之后,界面出现乱码,并退回到了跳转 ...
- Redis总结(五)缓存雪崩和缓存穿透等问题(转载)
前面讲过一些redis 缓存的使用和数据持久化.感兴趣的朋友可以看看之前的文章,http://www.cnblogs.com/zhangweizhong/category/771056.html .今 ...