OK335xS U-boot GPIO control hacking
/****************************************************************************************
* OK335xS U-boot GPIO control hacking
* 声明:
* 本文主要是跟踪U-boot中如何设置GPIO口电平。
*
* 2015-9-26 晴 深圳 南山平山村 曾剑锋
***************************************************************************************/ cat board/forlinx/ok335x/evm.c
int board_init(void)
{
int c = ;
/* Configure the i2c0 pin mux */
enable_i2c0_pin_mux(); i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); board_id = GP_BOARD;
profile = ; /* profile 0 is internally considered as 1 */
daughter_board_connected = ; configure_evm_pin_mux(board_id, header.version, profile, daughter_board_connected); --+
|
/** |
* 1. 参考资料: |
* AM335x ARM Cortex-A8 Microprocessors (MPUs) Technical Reference Manual (Rev. H) |
* |
* 2. ARM Cortex-A8 Memory Map |
* Table 2-2. L4_WKUP Peripheral Memory Map (continued) |
* +-------------+---------------------+-------------------+------+----------------+ |
* | Region Name | Start Address (hex) | End Address (hex) | Size | Description | |
* +-------------+---------------------+-------------------+------+----------------+ |
* | GPIO0 | 0x44E0_7000 | 0x44E0_7FFF | 4KB | GPIO Registers | |
* +-------------+---------------------+-------------------+------+----------------+ |
* |
* 3. GPIO Registers(4068 页) |
* Table 25-5. GPIO REGISTERS |
* +--------+-------------------+---------------+-------------------+ |
* | Offset | Acronym | Register Name | Section | |
* +--------+-------------------+---------------+-------------------+ |
* | 134h | GPIO_OE | | Section 25.4.1.16 |<-+ |
* +--------+-------------------+---------------+-------------------+ | |
* | 190h | GPIO_CLEARDATAOUT | | Section 25.4.1.25 | |<-+ |
* +--------+-------------------+---------------+-------------------+ | | |
* | 194h | GPIO_SETDATAOUT | | Section 25.4.1.26 | | |<-+ |
* +--------+-------------------+---------------+-------------------+ | | | |
*/ | | | |
/* set gpio0_7 gpio0_12 gpio0_22 gpio0_23 output mode */ | | | |
__raw_writel(~((<<) | (<<) | (<<) |(<<)), 0x44E07134);-------+ | | |
/* set gpio0_7 12 19 23 low */ | | |
__raw_writel((<<) | (<<) | (<<), 0x44E07190); ----------+ | |
/* set gpio0_22 high to height */ | |
__raw_writel( (<<) | (<<), 0x44E07194); -------------+ |
|
|
#ifndef CONFIG_SPL_BUILD |
board_evm_init(); |
#endif |
gpmc_init(); |
|
return ; |
} +-------------------------------------------------------------------------+
V
void configure_evm_pin_mux(unsigned char dghtr_brd_id, char version[], unsigned short
profile, unsigned int daughter_board_flag)
{
if (dghtr_brd_id > BASE_BOARD)
return; set_evm_pin_mux(am335x_evm_pin_mux[], profile,daughter_board_flag);
} |
V
static struct evm_pin_mux *am335x_evm_pin_mux[] = {
general_purpose_evm_pin_mux, ----------------------+
}; |
|
/* |
* Update the structure with the modules present in the general purpose |
* board and the profiles in which the modules are present. |
* If the module is physically present but if it is not available |
* in any of the profile, then do not update it. |
* For eg, nand is avialable only in the profiles 0 and 1, whereas |
* UART0 is available in all the profiles. |
*/ |
static struct evm_pin_mux general_purpose_evm_pin_mux[] = { <----------+
{i2c1_pin_mux, PROFILE_ALL & ~PROFILE_2 & ~PROFILE_4, DEV_ON_BASEBOARD}, #ifdef CONFIG_NAND
{nand_pin_mux, PROFILE_ALL & ~PROFILE_2 & ~PROFILE_3, DEV_ON_DGHTR_BRD},
#endif #ifndef CONFIG_NO_ETH
{mii1_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD},
#endif #ifdef CONFIG_MMC
{mmc0_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD},
#endif
{backlight_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD}, -----+
{maxttl_model_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD}, |
{lcd_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD}, |
{uart0_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD}, |
{}, |
}; |
|
static struct module_pin_mux backlight_pin_mux[] = { <----+
{OFFSET(ecap0_in_pwm0_out), MODE() | PULLUP_EN | RXACTIVE}, /* GPIO0_7 */
{OFFSET(uart1_ctsn), MODE() | PULLUDDIS | RXACTIVE}, /* GPIO0_ 12 */
{-},
};
OK335xS U-boot GPIO control hacking的更多相关文章
- OK335xS 网络连接打印信息 hacking
/*********************************************************************** * OK335xS 网络连接打印信息 hacking ...
- OK335xS GPMC nand device register hacking
/********************************************************************************* * OK335xS GPMC na ...
- OK335xS pwm buzzer Linux driver hacking
/**************************************************************************** * OK335xS pwm buzzer L ...
- Raspberry Pi 3 --- GPIO control
Before input 'gpio readall', need install wiringPi download "wiringPi":git clone git://git ...
- Linux GPIO 注册和应用
Linux GPIO 注册和应用 Linux Kernel, GPIO, ARM 于Linux kernel代码.经常使用 GPIO 作为一个特殊的信号,如芯片片选信号. GPIO 功能应用,我们经常 ...
- Linux-3.0.8中基于S5PV210的GPIO模块代码追踪和分析
编写按键驱动时,想知道内核是如何管理GPIO的,所以开始追踪代码,中间走了一些弯路,现记录于此. 追踪代码之前,我猜测:第一,这部分代码应该在系统set up阶段执行:第二,GPIO的代码应该在mac ...
- bcm53344 gpio驱动分析
/********************************************************************************* * 1.查看代码是在vim下,使用 ...
- linux下GPIO的用户层操作(sysfs)
linux的GPIO通过sysfs为用户提供服务,下面是linux kernel里的说明文档,学习一下. GPIO Sysfs Interface for Userspace ============ ...
- imx6 gpio irq
/***************************************************************** * gpio irq * * 一直以来都没了解过gpio的irq, ...
随机推荐
- Java编程语言下 Selenium 驱动各个浏览器代码
这里采用的是Selenium3.7版本,首先介绍的是在Windows环境下运行的: 总结下注意事项: 1,设置各个浏览器的Driver路径 System.setProperty("" ...
- JavaScript中对象数组 作业题目以及作业
var BaiduUsers = [], WechatUsers = []; var User = function(id, name, phone, gender, age, salary) { t ...
- MVC 子对象数据传递
1.接受参数 public ActionResult Address(User user) { return View(); } 2. User对象类型 public class User { pub ...
- [框架模式]经典的模型视图控制器模式MVC
参考:<设计模式> http://blog.csdn.net/u010168160/article/details/43150049 百度百科 引言: Model(模型)是应用程序中用于处 ...
- 微信小程序 - 简述
1.小程序理解 基于微信的 免安装 MVVM 应用 编码使用 ES 6 一个页面基本组成:wxml wxss js ( html.css.js ) 2. 常见用法 ( 基本就是跟着例子走.. ) 设置 ...
- idea运行main方法报错,提示Shorten command line for xxx
在Intell IDEA运行main函数的时候遇到了如下错误: Error running' xxxxxx': Command line is too long. Shorten command li ...
- m_Orchestrate learning system---三十、项目中的dist文件一般是做什么的
m_Orchestrate learning system---三十.项目中的dist文件一般是做什么的 一.总结 一句话总结: Bootstrap switch:dist 目录是放最终的js和css ...
- 关于"架构"
杨光辉说,在构架系统的早期可能不会更多地考虑架构,主要是在做技术选型,首先是编程语言的选择.对于编程语言选择,当前主流编程语言有很多,有面向对象语言.传统式语言等.做这个选择主要根据人员知识储备,包括 ...
- android--------自定义Dialog之信息提示
对话框对于应用也是必不可少的一个组件,在Android中也不例外,对话框对于一些提示重要信息,或者一些需要用户额外交互的一些内容很有帮助. 自定义Dialog步骤: 1.主要创建Java类,并继承Di ...
- HDU 2492 树状数组
DES:按照位置编号给你选手的rank值.每场比赛要有一个裁判,位置和rank在两个选手之间.两场比赛裁判不同 或有一个选手不同则可以说 两场比赛不同.问你一共可以有多少场比赛. 思路是遍历每个人当裁 ...