/****************************************************************************************
* 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的更多相关文章

  1. OK335xS 网络连接打印信息 hacking

    /*********************************************************************** * OK335xS 网络连接打印信息 hacking ...

  2. OK335xS GPMC nand device register hacking

    /********************************************************************************* * OK335xS GPMC na ...

  3. OK335xS pwm buzzer Linux driver hacking

    /**************************************************************************** * OK335xS pwm buzzer L ...

  4. Raspberry Pi 3 --- GPIO control

    Before input 'gpio readall', need install wiringPi download "wiringPi":git clone git://git ...

  5. Linux GPIO 注册和应用

    Linux GPIO 注册和应用 Linux Kernel, GPIO, ARM 于Linux kernel代码.经常使用 GPIO 作为一个特殊的信号,如芯片片选信号. GPIO 功能应用,我们经常 ...

  6. Linux-3.0.8中基于S5PV210的GPIO模块代码追踪和分析

    编写按键驱动时,想知道内核是如何管理GPIO的,所以开始追踪代码,中间走了一些弯路,现记录于此. 追踪代码之前,我猜测:第一,这部分代码应该在系统set up阶段执行:第二,GPIO的代码应该在mac ...

  7. bcm53344 gpio驱动分析

    /********************************************************************************* * 1.查看代码是在vim下,使用 ...

  8. linux下GPIO的用户层操作(sysfs)

    linux的GPIO通过sysfs为用户提供服务,下面是linux kernel里的说明文档,学习一下. GPIO Sysfs Interface for Userspace ============ ...

  9. imx6 gpio irq

    /***************************************************************** * gpio irq * * 一直以来都没了解过gpio的irq, ...

随机推荐

  1. python 集合元素添加

    #A new empty set color_set = set() color_set.add("Red") print(color_set) #Add multiple ite ...

  2. Python day5_tuple元祖的常见方法1_笔记

    # 初识元祖# 1.元祖的一级元素不能被修改,增加,删除,但可以查看,del tu[0]错的# 2.元祖最后一个元素后注意加‘,’,并没有区别,只是为了和方法中元素区别开li=[11,22,33,44 ...

  3. STL_算法_02_排序算法

    ◆ 常用的排序算法: 1.1.合并(容器A(全部/部分)&容器B(全部/部分)==>容器C(全部/部分),容器C中元素已经排好顺序),返回的值==>iteratorOutBegin ...

  4. jsjl_for_ubuntu12.04

    1. VC++代码: #include <stdio.h> #include <windows.h> #include <wchar.h> void MoveMou ...

  5. node 文件、文件夹 增删改查

    1. 文件夹 增加文件夹 var fs = require("fs"); console.log("创建目录 tmp"); fs.mkdir("tmp ...

  6. hihoCoder 1513 小Hi的烦恼

    hihoCoder 1513 小Hi的烦恼 思路: 用bitset判断交集个数 代码: #include<bits/stdc++.h> using namespace std; #defi ...

  7. [Java学习] Java方法重载

    在Java中,同一个类中的多个方法可以有相同的名字,只要它们的参数列表不同就可以,这被称为方法重载(method overloading). 参数列表又叫参数签名,包括参数的类型.参数的个数和参数的顺 ...

  8. java concurrent包的实现原理

      由于java的CAS同时具有 volatile 读和volatile写的内存语义,因此Java线程之间的通信现在有了下面四种方式:   A线程写volatile变量,随后B线程读这个volatil ...

  9. Dajngo的CBV和FBV

    CBV: class. base. view 路由: url(r'students/', views.StudentsView.as_view()) 视图: from django.views imp ...

  10. 总结: MySQL(基础,字段约束,索引,外键,存储过程,事务)操作语法

    1. 显示数据库列表 show databases; # 查看当前所有数据库 show databases \G   #以行的方式显示 2. 在命令行中,执行sql语句 mysql -e 'show ...