OK335xS pwm device register hacking
/*************************************************************************
* OK335xS pwm device register hacking
* 声明:
* 本文是对OK335xS pwm设备注册进行代码跟踪,其中有些部分是由于本人自己
* 添加的,但都是经过测试。
*
* 2015-8-25 晴 深圳 南山平山村 曾剑锋
************************************************************************/
MACHINE_START(AM335XEVM, "am335xevm")
/* Maintainer: Texas Instruments */
.atag_offset = 0x100,
.map_io = am335x_evm_map_io,
.init_early = am33xx_init_early,
.init_irq = ti81xx_init_irq,
.handle_irq = omap3_intc_handle_irq,
.timer = &omap3_am33xx_timer,
.init_machine = am335x_evm_init, ---------+
MACHINE_END |
|
MACHINE_START(AM335XIAEVM, "am335xiaevm") |
/* Maintainer: Texas Instruments */ |
.atag_offset = 0x100, |
.map_io = am335x_evm_map_io, |
.init_irq = ti81xx_init_irq, |
.init_early = am33xx_init_early, |
.timer = &omap3_am33xx_timer, |
.init_machine = am335x_evm_init, |
MACHINE_END |
|
|
static void __init am335x_evm_init(void) <--------+
{
......
setup_ok335xs(); ---------+
...... |
} |
|
static void setup_ok335xs(void) <--------+
{
pr_info("The board is a ok335xs.\n"); /* Starter Kit has Micro-SD slot which doesn't have Write Protect pin */
am335x_mmc[].gpio_wp = -EINVAL; _configure_device(EVM_SK, ok335xs_dev_cfg, PROFILE_NONE); --------+
|
am33xx_cpsw_init(AM33XX_CPSW_MODE_RGMII, NULL, NULL); |
/* Atheros Tx Clk delay Phy fixup */ |
phy_register_fixup_for_uid(AM335X_EVM_PHY_ID, AM335X_EVM_PHY_MASK, |
am33xx_evm_tx_clk_dly_phy_fixup); |
} |
|
static struct evm_dev_cfg ok335xs_dev_cfg[] = { <-------+
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_ALL},//fixed
#if defined(CONFIG_ANDROID)
{mfd_tscadc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
#endif
{rgmii1_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{rgmii2_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{lcdc_init, DEV_ON_BASEBOARD, PROFILE_ALL},//fixed
{i2c1_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{buzzer_init, DEV_ON_BASEBOARD, PROFILE_ALL},//fixed --------+
{enable_ecap2, DEV_ON_BASEBOARD, PROFILE_ALL},//fixed |
{usb0_init, DEV_ON_BASEBOARD, PROFILE_ALL}, |
{usb1_init, DEV_ON_BASEBOARD, PROFILE_ALL}, |
{evm_nand_init,DEV_ON_BASEBOARD, PROFILE_ALL},//fixed |
{mcasp1_init, DEV_ON_BASEBOARD, PROFILE_NONE},//fixed |
{gpio_keys_init_forlinx_s, DEV_ON_BASEBOARD, PROFILE_ALL},//fixed |
{gpio_led_init_s, DEV_ON_BASEBOARD, PROFILE_ALL},//fixed |
{uart2_init_s, DEV_ON_BASEBOARD, PROFILE_ALL},//fixed |
{spi1_init_s, DEV_ON_BASEBOARD, PROFILE_ALL},//fixed |
{d_can_init, DEV_ON_BASEBOARD, PROFILE_ALL},//fixed |
{sgx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, |
{NULL, , }, |
}; |
|
static void buzzer_init(int evm_id, int profile) <--------+
{
//setup_pin_mux(ecap0_pin_mux);
setup_pin_mux(ecap1_pin_mux); -----+ -------------------+
am33xx_register_ecap(, &pwm_pdata[]); ----*---------------------*+-+
} | || |
| || |
/* Module pin mux for eCAP1 */ | || |
static struct pinmux_config ecap1_pin_mux[] = { <----+ || |
{"spi0_cs1.ecap1_in_pwm1_out", -----+ || |
OMAP_MUX_MODE2 | AM33XX_PIN_OUTPUT}, | ---------------------+ || |
{NULL, }, | | || |
}; | | || |
| | || |
/* AM33XX pin mux super set */ | | || |
static struct omap_mux am33xx_muxmodes[] = { | --------------*+|| |
...... | |||| |
_AM33XX_MUXENTRY(SPI0_CS1, , V |||| |
//"spi0_cs1", "uart3_rxd", NULL, "mmc0_pow", |||| |
"spi0_cs1", "uart3_rxd", "ecap1_in_pwm1_out", "mmc0_pow", |||| |
NULL, "mmc0_sdcd", NULL, "gpio0_6"), |||| |
...... |||| |
} |||| |
|||| |
|||| |
/* 34xx mux mode options for each pin. See TRM for options */ |||| |
#define OMAP_MUX_MODE0 0 |||| |
#define OMAP_MUX_MODE1 1 |||| |
#define OMAP_MUX_MODE2 2 <-------------------------------------+||| |
#define OMAP_MUX_MODE3 3 ||| |
#define OMAP_MUX_MODE4 4 ||| |
#define OMAP_MUX_MODE5 5 ||| |
#define OMAP_MUX_MODE6 6 ||| |
#define OMAP_MUX_MODE7 7 ||| |
||| |
/* module pin mux structure */ ||| |
struct pinmux_config { <-------------------+|| |
const char *string_name; /* signal name format */ || |
int val; /* Options for the mux register value */ || |
}; || |
|| |
static void setup_pin_mux(struct pinmux_config *pin_mux) <---------------+| |
{ | |
int i; | |
| |
for (i = ; pin_mux->string_name != NULL; pin_mux++) | |
omap_mux_init_signal(pin_mux->string_name, pin_mux->val); --------+ | |
| | |
} | | |
| | |
int __init omap_mux_init_signal(const char *muxname, int val) <-------+ | |
{ | |
struct omap_mux_partition *partition = NULL; | |
struct omap_mux *mux = NULL; | |
u16 old_mode; | |
int mux_mode; | |
| |
mux_mode = omap_mux_get_by_name(muxname, &partition, &mux); --------+ | |
if (mux_mode < ) | | |
return mux_mode; | | |
| | |
old_mode = omap_mux_read(partition, mux->reg_offset); | | |
mux_mode |= val; | | |
pr_debug("%s: Setting signal %s 0x%04x -> 0x%04x\n", | | |
__func__, muxname, old_mode, mux_mode); | | |
omap_mux_write(partition, mux_mode, mux->reg_offset); | | |
| | |
return ; | | |
} | | |
| | |
int omap_mux_get_by_name(const char *muxname, <-------+ | |
struct omap_mux_partition **found_partition, | |
struct omap_mux **found_mux) | |
{ | |
struct omap_mux_partition *partition; | |
| |
list_for_each_entry(partition, &mux_partitions, node) { | |
struct omap_mux *mux = NULL; | |
int mux_mode = _omap_mux_get_by_name(partition, muxname, &mux); ---+ | |
if (mux_mode < ) | | |
continue; | | |
| | |
*found_partition = partition; | | |
*found_mux = mux; | | |
| | |
return mux_mode; +--------------------------------------------+ | |
} | | |
| | |
return -ENODEV; | | |
} | | |
V | |
static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, | |
const char *muxname, | |
struct omap_mux **found_mux) | |
{ | |
struct omap_mux *mux = NULL; | |
struct omap_mux_entry *e; | |
const char *mode_name; | |
int found = , found_mode = , mode0_len = ; | |
struct list_head *muxmodes = &partition->muxmodes; | |
| |
mode_name = strchr(muxname, '.'); | |
if (mode_name) { | |
mode0_len = strlen(muxname) - strlen(mode_name); | |
mode_name++; | |
} else { | |
mode_name = muxname; | |
} | |
| |
list_for_each_entry(e, muxmodes, node) { | |
char *m0_entry; | |
int i; | |
| |
mux = &e->mux; | |
m0_entry = mux->muxnames[]; | |
| |
/* First check for full name in mode0.muxmode format */ | |
if (mode0_len && strncmp(muxname, m0_entry, mode0_len)) | |
continue; | |
| |
/* Then check for muxmode only */ | |
for (i = ; i < OMAP_MUX_NR_MODES; i++) { | |
char *mode_cur = mux->muxnames[i]; | |
| |
if (!mode_cur) | |
continue; | |
| |
if (!strcmp(mode_name, mode_cur)) { | |
*found_mux = mux; | |
found++; | |
found_mode = i; | |
} | |
} | |
} | |
| |
if (found == ) { | |
return found_mode; | |
} | |
| |
if (found > ) { | |
pr_err("%s: Multiple signal paths (%i) for %s\n", __func__, | |
found, muxname); | |
return -EINVAL; | |
} | |
| |
pr_err("%s: Could not find signal %s\n", __func__, muxname); | |
| |
return -ENODEV; | |
} | |
| |
static struct pwmss_platform_data pwm_pdata[] = { <----------------+ |
{ |
.version = PWM_VERSION_1, |
}, |
{ |
.version = PWM_VERSION_1, |
}, |
{ |
.version = PWM_VERSION_1, |
}, |
}; |
|
#ifdef CONFIG_SOC_OMAPAM33XX |
#define PWM_STR_LEN 10 |
int __init am33xx_register_ecap(int id, struct pwmss_platform_data *pdata) <---+
{
struct platform_device *pdev;
struct omap_hwmod *oh;
char *oh_name = "ecap";
char dev_name[PWM_STR_LEN]; sprintf(dev_name, "ecap.%d", id); // for driver to match device name oh = omap_hwmod_lookup(dev_name);
if (!oh) {
pr_err("Could not look up %s hwmod\n", dev_name);
return -ENODEV;
} pdev = omap_device_build(oh_name, id, oh, pdata,
sizeof(*pdata), NULL, , ); if (IS_ERR(pdev)) {
WARN(, "Can't build omap_device for %s:%s.\n",
dev_name, oh->name);
return PTR_ERR(pdev);
}
return ;
}
OK335xS pwm device register hacking的更多相关文章
- OK335xS CAN device register and deiver match hacking
/************************************************************************* * OK335xS CAN device regi ...
- OK335xS GPMC nand device register hacking
/********************************************************************************* * OK335xS GPMC na ...
- OK335xS I2C device registe hacking
/*************************************************************************** * OK335xS I2C device re ...
- I.MX6 Ar8031 device register hacking
/***************************************************************************** * I.MX6 Ar8031 device ...
- OK335xS UART device registe hacking
/************************************************************************* * OK335xS UART device reg ...
- OK335xS pwm buzzer Linux driver hacking
/**************************************************************************** * OK335xS pwm buzzer L ...
- I.MX6 PWM buzzer driver hacking with Demo test
/***************************************************************************** * I.MX6 PWM buzzer dr ...
- OK335xS davinci mdio driver hacking
/******************************************************************************* * OK335xS davinci m ...
- I.MX6 Power off register hacking
/*********************************************************************** * I.MX6 Power off register ...
随机推荐
- python 元组元素反转
#create a tuple x = ("w3resource") # Reversed the tuple y = reversed(x) print(tuple(y)) #c ...
- XML_CPP_资料_libXml2_01_Code_ZC(?.pro)
ZC:最下面有 ?.pro文件的设置写法 ZC: Win7x64,qt-opensource-windows-x86-msvc2010_opengl-5.3.2.exe,cn_visual_studi ...
- Python -- Scrapy 框架简单介绍(Scrapy 安装及项目创建)
Python -- Scrapy 框架简单介绍 最近在学习python 爬虫,先后了解学习urllib.urllib2.requests等,后来发现爬虫也有很多框架,而推荐学习最多就是Scrapy框架 ...
- 雷林鹏分享:C# 多态性
C# 多态性 多态性意味着有多重形式.在面向对象编程范式中,多态性往往表现为"一个接口,多个功能". 多态性可以是静态的或动态的.在静态多态性中,函数的响应是在编译时发生的.在动态 ...
- vs.net应用程序图标以及制作安装程序快捷方式图标设置
我们通常在开发软件完毕后需要打包制作安装程序,这个时侯一般都会需要设置应用程序的图标,使用默认的图标一般都比较难看,那么我们应该怎样设置自定义的图标呢? 我现在要讲的图标设置有两种情况, ...
- kmp练习
kmp板子如下, 失配数组不优化的话, $f_i$就表示子串[0...i]前后缀最大匹配长度 int main() { scanf("%s%s", t, p); int n = s ...
- 浅浅的分析LED呼吸灯的实现和PWM的关系
前言 在本周,我们在python课上做了一个实验,用ARDUINO使小LED灯模仿出呼吸灯的效果,实验进行的很成功,但是机器当仅输出高/低电平的时候是怎么样才能做到渐亮渐暗(输出电压)的变化呢?在这里 ...
- python-day71--django多表操作
表关系: 1 一对多 2 多对多 3 一对一 添加记录: 一对多:书与出版社 #创建一对多: publish=models.ForeignKey("Publish") 注意:pub ...
- ~递归递归(FBI树--蓝桥)
1220: FBI树 [递归] 时间限制: 1 Sec 内存限制: 128 MB 提交: 5 解决: 4 状态 题目描述 我们可以把由“0”和“1”组成的字符串分为三类:全“0”串称为B串,全“1”串 ...
- HDOJ1008
#include "iostream" using namespace std; int main() { ) { int n; cin >> n; ) break; ...