/***********************************************************************
* OK335xS mac address hacking
* 声明:
* 在一般的嵌入式产品中,一般mac地址都是存在于CPU芯片中,不过有时候
* 我们也许会表示怀疑,因为我们可能更希望知道那些东西到底存在哪里,以一
* 种什么样的形式存在。
*
* 2016-2-1 深圳 南山平山村 曾剑锋
**********************************************************************/ 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) <----------+
{
am33xx_cpuidle_init();
am33xx_mux_init(board_mux);
omap_serial_init();
am335x_evm_i2c_init();
omap_sdrc_init(NULL, NULL);
usb_musb_init(&musb_board_data); omap_board_config = am335x_evm_config;
omap_board_config_size = ARRAY_SIZE(am335x_evm_config); _configure_device(EVM_SK, mfd_dev_cfg, PROFILE_NONE); daughter_brd_detected = false;
setup_zengjf(); ------------------------------+
|
/*create /proc/boardname to export info to userspace*/ |
proc_init(); |
|
/* Create an alias for icss clock */ |
if (clk_add_alias("pruss", NULL, "pruss_uart_gclk", NULL)) |
pr_warn("failed to create an alias: icss_uart_gclk --> pruss\n"); |
/* Create an alias for gfx/sgx clock */ |
if (clk_add_alias("sgx_ck", NULL, "gfx_fclk", NULL)) |
pr_warn("failed to create an alias: gfx_fclk --> sgx_ck\n"); |
} |
|
/* sbc-zengjf */ |
#define TLK110_PHY_ID 0x2000a211 |
#define LAN8710A_PHY_ID 0x7c0f1 |
char sbc_zengjf_phy1[] = {"0:00"}; |
char sbc_zengjf_phy2[] = {"0:01"}; |
|
static void setup_zengjf(void) <--------------------------------+
{
pr_info("The board is a sbc-zengjf.\n"); /*which doesn't have Write Protect pin LAN8710A_PHY_ID */
am335x_mmc[].gpio_wp = -EINVAL; int ret; _configure_device(EVM_SK, sbc_zengjf_dev_cfg, PROFILE_NONE); am33xx_cpsw_init(AM33XX_CPSW_MODE_MII, sbc_zengjf_phy1, sbc_zengjf_phy2); ---+
phy_register_fixup_for_uid(LAN8710A_PHY_ID , AM335X_EVM_PHY_MASK, |
am33xx_evm_tx_clk_dly_phy_fixup); |
} |
|
|
int am33xx_cpsw_init(enum am33xx_cpsw_mac_mode mode, unsigned char *phy_id0, <-+
unsigned char *phy_id1)
{
struct omap_hwmod *oh;
struct platform_device *pdev;
u32 mac_lo, mac_hi, gmii_sel;
u32 i; mac_lo = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID0_LO);
mac_hi = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID0_HI); ------------+
am33xx_cpsw_slaves[].mac_addr[] = mac_hi & 0xFF; |
am33xx_cpsw_slaves[].mac_addr[] = (mac_hi & 0xFF00) >> ; |
am33xx_cpsw_slaves[].mac_addr[] = (mac_hi & 0xFF0000) >> ; |
am33xx_cpsw_slaves[].mac_addr[] = (mac_hi & 0xFF000000) >> ; |
am33xx_cpsw_slaves[].mac_addr[] = mac_lo & 0xFF; |
am33xx_cpsw_slaves[].mac_addr[] = (mac_lo & 0xFF00) >> ; |
|
/* Read MACID0 from eeprom if eFuse MACID is invalid */ |
if (!is_valid_ether_addr(am33xx_cpsw_slaves[].mac_addr)) { |
for (i = ; i < ETH_ALEN; i++) |
am33xx_cpsw_slaves[].mac_addr[i] = am33xx_macid0[i]; |
} |
|
mac_lo = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID1_LO); |
mac_hi = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID1_HI); |
am33xx_cpsw_slaves[].mac_addr[] = mac_hi & 0xFF; |
am33xx_cpsw_slaves[].mac_addr[] = (mac_hi & 0xFF00) >> ; |
am33xx_cpsw_slaves[].mac_addr[] = (mac_hi & 0xFF0000) >> ; |
am33xx_cpsw_slaves[].mac_addr[] = (mac_hi & 0xFF000000) >> ; |
am33xx_cpsw_slaves[].mac_addr[] = mac_lo & 0xFF; |
am33xx_cpsw_slaves[].mac_addr[] = (mac_lo & 0xFF00) >> ; |
// Read MACID1 from eeprom if eFuse MACID is invalid |
if (!is_valid_ether_addr(am33xx_cpsw_slaves[].mac_addr)) { |
for (i = ; i < ETH_ALEN; i++) |
am33xx_cpsw_slaves[].mac_addr[i] = am33xx_macid1[i]; |
} |
|
|
switch (mode) { |
case AM33XX_CPSW_MODE_MII: |
gmii_sel = AM33XX_MII_MODE_EN; |
break; |
case AM33XX_CPSW_MODE_RMII: |
gmii_sel = AM33XX_RMII_MODE_EN; |
break; |
case AM33XX_CPSW_MODE_RGMII: |
gmii_sel = AM33XX_RGMII_MODE_EN; |
am33xx_cpsw_slaves[].phy_if = PHY_INTERFACE_MODE_RGMII; |
am33xx_cpsw_slaves[].phy_if = PHY_INTERFACE_MODE_RGMII; |
break; |
default: |
return -EINVAL; |
} |
|
writel(gmii_sel, AM33XX_CTRL_REGADDR(AM33XX_CONTROL_GMII_SEL_OFFSET)); |
|
if (phy_id0 != NULL) |
am33xx_cpsw_slaves[].phy_id = phy_id0; |
|
if (phy_id1 != NULL) |
am33xx_cpsw_slaves[].phy_id = phy_id1; |
|
memcpy(am33xx_cpsw_pdata.mac_addr, |
am33xx_cpsw_slaves[].mac_addr, ETH_ALEN); |
|
oh = omap_hwmod_lookup("mdio"); |
if (!oh) { |
pr_err("could not find cpgmac0 hwmod data\n"); |
return -ENODEV; |
} |
|
pdev = omap_device_build("davinci_mdio", , oh, &am33xx_cpsw_mdiopdata, |
sizeof(am33xx_cpsw_mdiopdata), NULL, , ); |
if (IS_ERR(pdev)) |
pr_err("could not build omap_device for cpsw\n"); |
|
oh = omap_hwmod_lookup("cpgmac0"); |
if (!oh) { |
pr_err("could not find cpgmac0 hwmod data\n"); |
return -ENODEV; |
} |
|
pdev = omap_device_build("cpsw", -, oh, &am33xx_cpsw_pdata, |
sizeof(am33xx_cpsw_pdata), NULL, , ); |
if (IS_ERR(pdev)) |
pr_err("could not build omap_device for cpsw\n"); |
|
return ; |
} |
|
/* TI81XX spefic control submodules */ |
#define TI81XX_CONTROL_DEVCONF 0x600 <--------------------*---+
| |
/* TI81XX CONTROL_DEVCONF register offsets */ | |
#define TI81XX_CONTROL_MAC_ID0_LO (TI81XX_CONTROL_DEVCONF + 0x030) | |
// TI81XX_CONTROL_MAC_ID0_HI = 0x634 ---------------------------*---*-+
#define TI81XX_CONTROL_MAC_ID0_HI (TI81XX_CONTROL_DEVCONF + 0x034) <---+ --+ |
|
/* |
* 1. 参考文档: |
* AM335x ARM® Cortex™-A8 Microprocessors (MPUs) Technical Reference Manual |
* |
* 2. 确认寄存器: |
* Table 9-10. CONTROL_MODULE REGISTERS |
* +--------+------------------+-------------+----------------+ |
* | Offset | Acronym Register | Description | Section | |
* +--------+------------------+-------------+----------------+ |
* | 634h | mac_id0_hi | | Section 9.3.26 | <------------+
* +--------+------------------+-------------+----------------+
*
* 3. 寄存器说明:
* 26.1.8.4.1 Device Initialization
* ......
* • Device uses EFUSE registers mac_id0_lo and mac_id0_hi in the control module for Ethernet MAC address of the device.
* ......
*/

OK335xS mac address hacking的更多相关文章

  1. I.MX6 Ethernet MAC (ENET) MAC Address hacking

    /********************************************************************* * I.MX6 Ethernet MAC (ENET) M ...

  2. I.MX6 MAC Address hacking

    /************************************************************************** * I.MX6 MAC Address hack ...

  3. Python Ethical Hacking - MAC Address & How to Change(3)

    SIMPLE ALGORITHM Goal  -> Check if MAC address was changed. Steps: 1. Execute and read ifconfig. ...

  4. Python Ethical Hacking - MAC Address & How to Change(2)

    FUNCTIONS Set of instructions to carry out a task. Can take input, and return a result. Make the cod ...

  5. Python Ethical Hacking - MAC Address & How to Change(1)

    MAC ADDRESS Media Access Control Permanent Physical Unique Assigned by manufacturer WHY CHANGE THE M ...

  6. OK335xS Qt network hacking

    /********************************************************************** * OK335xS Qt network hacking ...

  7. OK335xS knob driver hacking

    /************************************************************************* * OK335xS knob driver hac ...

  8. Ubuntu 下,修改 Mac address

    ifconfig    //    check Mac address sudo ifconfig eth0 down sudo ifconfig eth0 hw ether xx:xx:xx:xx: ...

  9. 【小错误】Device eth2 has different MAC address than expected, ignoring.

    今天在搭建rac配置IP的时候报错显示如下: Device eth2 has different MAC address than expected, ignoring.[FAILED] 百度了下,问 ...

随机推荐

  1. UVA 1175 Ladies' Choice 稳定婚姻问题

    题目链接: 题目 Ladies' Choice Time Limit: 6000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu 问题 ...

  2. HDU 3974 Assign the task 暴力/线段树

    题目链接: 题目 Assign the task Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O ...

  3. HTML5网页制作教程:HTML5块级链接

    网页制作Webjx文章简介:Web 标准中处处充满了打脸行为,这条规则现在已经失效了!在那篇文章发布一个月后,HTML5doctor 发表了 “Block-level” links in HTML5, ...

  4. 【BZOJ】【1834】【ZJOI2010】Network 网络扩容

    网络流/费用流 这题……我一开始sb了. 第一问简单的最大流…… 第二问是要建费用流的图的……但是是在第一问的最大流跑完以后的残量网络上建,而不是重建…… 我们令残量网络上原有的弧的费用全部为0(因为 ...

  5. 【BZOJ】【2208】【JSOI2010】连通数

    题解: 1.Tarjan缩点以后对每个连通分量进行深搜,看能到哪些连通分量,能到达的所有连通分量的size之和记为sum.则第i个连通分量对答案的贡献为size[i]*sum(到其他连通分量)+siz ...

  6. 如何使用工具进行线上 PHP 性能追踪及分析?

    工作了一两年的 PHPer 大概都多多少少知道一些性能分析的工具,比如 Xdebug.xhprof.New Relic .OneAPM.使用基于 Xdebug 进行 PHP 的性能分析,对于本地开发环 ...

  7. 【C++之STL】理解容器(ing)

    “容器可容纳一些数据的模板类” “容器是包容其他对象的对象” 两种类型:顺序容器.关联容器   顺序容器 关联容器 访问成员 顺序访问和随机访问 经过优化关键键值访问                 ...

  8. 2015年最新中国知网CNKI免费账号直接入口

    以下是Free9免费资源网小编收集整理的2015年最新中国知网CNKI免费账号直接入口,现免费分享给大家(仅供测试使用),此类文献数据库资源有时效性,希望对您的学习.工作上有所帮助! 中国知网直接入口 ...

  9. HDU4804 Campus Design 轮廓线dp

    跟上面那篇轮廓线dp是一样的,但是多了两个条件,一个是在原图上可能有些点是不能放的(即障碍),所以转移的时候要多一个判断color[i][j]是不是等于1什么的,另外一个是我们可以有多的1*1的骨牌, ...

  10. hdu 1905 小数化分数2

    ;}