Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
c7db9a38
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c7db9a38
编写于
8月 19, 2005
作者:
W
Wolfgang Denk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Initialize serial# and ethaddr from manufacturer data in EEPROM on CMC-PU2
Patch by Martin Krause, 08 Jun 2005
上级
6617aae9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
130 addition
and
1 deletion
+130
-1
CHANGELOG
CHANGELOG
+3
-0
board/cmc_pu2/Makefile
board/cmc_pu2/Makefile
+1
-1
board/cmc_pu2/load_sernum_ethaddr.c
board/cmc_pu2/load_sernum_ethaddr.c
+122
-0
lib_arm/board.c
lib_arm/board.c
+4
-0
未找到文件。
CHANGELOG
浏览文件 @
c7db9a38
...
...
@@ -2,6 +2,9 @@
Changes for U-Boot 1.1.4:
======================================================================
* Initialize serial# and ethaddr from manufacturer data in EEPROM on CMC-PU2
Patch by Martin Krause, 08 Jun 2005
* Add new board specific commands for TQM5200/STK52XX
- Sound commands (beep, wav, sound)
- Test commands (led, can, backlight, rs232)
...
...
board/cmc_pu2/Makefile
浏览文件 @
c7db9a38
...
...
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
LIB
=
lib
$(BOARD)
.a
OBJS
:=
cmc_pu2.o at45.o dm9161.o flash.o
OBJS
:=
cmc_pu2.o at45.o dm9161.o flash.o
load_sernum_ethaddr.o
$(LIB)
:
$(OBJS) $(SOBJS)
$(AR)
crv
$@
$(OBJS)
$(SOBJS)
...
...
board/cmc_pu2/load_sernum_ethaddr.c
0 → 100644
浏览文件 @
c7db9a38
/*
* (C) Copyright 2000, 2001, 2002
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* (C) Copyright 2005
* Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
/* #define DEBUG */
#include <common.h>
#define I2C_CHIP 0x50
/* I2C bus address of onboard EEPROM */
#define I2C_ALEN 1
/* length of EEPROM addresses in bytes */
#define I2C_OFFSET 0x0
/* start address of manufacturere data block
* in EEPROM */
/* 64 Byte manufacturer data block in EEPROM */
struct
manufacturer_data
{
unsigned
int
serial_number
;
/* serial number (0...999999) */
unsigned
short
hardware
;
/* hardware version (e.g. V1.02) */
unsigned
short
manuf_date
;
/* manufacture date (e.g. 25/02) */
unsigned
char
name
[
20
];
/* device name (in CHIP.INI) */
unsigned
char
macadr
[
6
];
/* MAC address */
signed
char
a_kal
[
4
];
/* calibration value for U */
signed
char
i_kal
[
4
];
/* calibration value for I */
unsigned
char
reserve
[
18
];
/* reserved */
unsigned
short
save_nr
;
/* save count */
unsigned
short
chksum
;
/* checksum */
};
int
i2c_read
(
unsigned
char
chip
,
unsigned
int
addr
,
int
alen
,
unsigned
char
*
buffer
,
int
len
);
/*-----------------------------------------------------------------------
* Process manufacturer data block in EEPROM:
*
* If we boot on a system fresh from factory, check if the manufacturer data
* in the EEPROM is valid and save some information it contains.
*
* CMC manufacturer data is defined as follows:
*
* - located in the onboard EEPROM
* - starts at offset 0x0
* - size 0x00000040
*
* Internal structure: see struct definition
*/
void
load_sernum_ethaddr
(
void
)
{
struct
manufacturer_data
data
;
unsigned
char
serial
[
9
];
unsigned
char
ethaddr
[
18
];
unsigned
short
chksum
;
unsigned
char
*
p
;
unsigned
short
i
,
is
,
id
;
#if !defined(CONFIG_HARD_I2C) && !defined(CONFIG_SOFT_I2C)
#error you must define some I2C support (CONFIG_HARD_I2C or CONFIG_SOFT_I2C)
#endif
if
(
i2c_read
(
I2C_CHIP
,
I2C_OFFSET
,
I2C_ALEN
,
(
unsigned
char
*
)
&
data
,
sizeof
(
data
))
!=
0
)
{
puts
(
"Error reading manufacturer data from EEPROM
\n
"
);
return
;
}
/* check if manufacturer data block is valid */
p
=
(
unsigned
char
*
)
&
data
;
chksum
=
0
;
for
(
i
=
0
;
i
<
(
sizeof
(
data
)
-
sizeof
(
data
.
chksum
));
i
++
)
chksum
+=
*
p
++
;
debug
(
"checksum of manufacturer data block: %#.4x
\n
"
,
chksum
);
if
(
chksum
!=
data
.
chksum
)
{
puts
(
"Error: manufacturer data block has invalid checksum
\n
"
);
return
;
}
/* copy MAC address */
is
=
0
;
id
=
0
;
for
(
i
=
0
;
i
<
6
;
i
++
)
{
sprintf
(
&
ethaddr
[
id
],
"%02x"
,
data
.
macadr
[
is
++
]);
id
+=
2
;
if
(
is
<
6
)
ethaddr
[
id
++
]
=
':'
;
}
ethaddr
[
id
]
=
'\0'
;
/* just to be sure */
/* copy serial number */
sprintf
(
serial
,
"%d"
,
data
.
serial_number
);
/* set serial# and ethaddr if not yet defined */
if
(
getenv
(
"serial#"
)
==
NULL
)
{
setenv
(
"serial#"
,
serial
);
}
if
(
getenv
(
"ethaddr"
)
==
NULL
)
{
setenv
(
"ethaddr"
,
ethaddr
);
}
}
lib_arm/board.c
浏览文件 @
c7db9a38
...
...
@@ -305,6 +305,10 @@ void start_armboot (void)
devices_init
();
/* get the devices list going. */
#ifdef CONFIG_CMC_PU2
load_sernum_ethaddr
();
#endif
/* CONFIG_CMC_PU2 */
jumptable_init
();
console_init_r
();
/* fully init console as a device */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录