主题 : 【建议】给友善提点建议,关于dm9000 复制链接 | 浏览器收藏 | 打印
畅游在知识的海洋...
级别: 论坛版主
UID: 33629
精华: 4
发帖: 554
金钱: 3075 两
威望: 615 点
综合积分: 1188 分
注册时间: 2010-12-03
最后登录: 2015-09-22
楼主  发表于: 2011-11-09 14:59

 【建议】给友善提点建议,关于dm9000

在mach-mini6410.c中出现了dm9000的平台设备的定义:
static struct resource dm9000_resources[] = {
    [0] = {
        .start        = S3C64XX_PA_DM9000,
        .end        = S3C64XX_PA_DM9000 + 3,
        .flags        = IORESOURCE_MEM,
    },
    [1] = {
        .start        = S3C64XX_PA_DM9000 + 4,
        .end        = S3C64XX_PA_DM9000 + S3C64XX_SZ_DM9000 - 1,
        .flags        = IORESOURCE_MEM,
    },
    [2] = {
        .start        = IRQ_EINT(7),
        .end        = IRQ_EINT(7),
        .flags        = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
    },
};

static struct dm9000_plat_data dm9000_setup = {
    .flags            = DM9000_PLATF_16BITONLY,
    .dev_addr        = { 0x08, 0x90, 0x00, 0xa0, 0x90, 0x90 },
};

static struct platform_device s3c_device_dm9000 = {
    .name            = "dm9000",
    .id                = 0,
    .num_resources    = ARRAY_SIZE(dm9000_resources),
    .resource        = dm9000_resources,
    .dev            = {
        .platform_data = &dm9000_setup,
    }
};
想问下为什么友善会把网卡platform_device定义在mach-mini6410.c这个文件里,弄得这个文件很乱,而且也与干净的内核代码的风格很不符合。
一般都是专门用dev-设备名.c来定义一个平台设备的,友善能否修正一下?
好好学习,天天鲁管
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2011-11-09 16:42
dev-设备名.c通常是用于SoC上内建的外设的platform device定义,比如watchdog, rtc等。而对于像DM9000这样存在于SoC的某个特定board上的设备,通常都是定义在这个mach-<board name>.c里的。这不会引起混乱。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
畅游在知识的海洋...
级别: 论坛版主
UID: 33629
精华: 4
发帖: 554
金钱: 3075 两
威望: 615 点
综合积分: 1188 分
注册时间: 2010-12-03
最后登录: 2015-09-22
2楼  发表于: 2011-11-09 17:01
谢谢版主大人,不过还是有点疑问:nand应该和dm9000一样不算外设,为什么
struct platform_device s3c_device_nand = {
    .name          = "s3c2410-nand",
    .id          = -1,
    .num_resources      = ARRAY_SIZE(s3c_nand_resource),
    .resource      = s3c_nand_resource,
};就定义在dev-nand.c中?
好好学习,天天鲁管
畅游在知识的海洋...
级别: 论坛版主
UID: 33629
精华: 4
发帖: 554
金钱: 3075 两
威望: 615 点
综合积分: 1188 分
注册时间: 2010-12-03
最后登录: 2015-09-22
3楼  发表于: 2011-11-09 17:02

 回 1楼(kasim) 的帖子

谢谢版主大人,不过还是有点疑问:nand应该和dm9000一样不算外设,为什么
struct platform_device s3c_device_nand = {
    .name          = "s3c2410-nand",
    .id          = -1,
    .num_resources      = ARRAY_SIZE(s3c_nand_resource),
    .resource      = s3c_nand_resource,
};就定义在dev-nand.c中?
好好学习,天天鲁管
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
4楼  发表于: 2011-11-09 17:05
NAND (这里指的是S3C6410的NAND Flash Controller)属于SoC内建的外设,和内部的RTC,  Watchdog是一样的。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
畅游在知识的海洋...
级别: 论坛版主
UID: 33629
精华: 4
发帖: 554
金钱: 3075 两
威望: 615 点
综合积分: 1188 分
注册时间: 2010-12-03
最后登录: 2015-09-22
5楼  发表于: 2011-11-09 18:38

 回 4楼(kasim) 的帖子

有点迷糊
好好学习,天天鲁管
畅游在知识的海洋...
级别: 论坛版主
UID: 33629
精华: 4
发帖: 554
金钱: 3075 两
威望: 615 点
综合积分: 1188 分
注册时间: 2010-12-03
最后登录: 2015-09-22
6楼  发表于: 2011-11-10 10:41

 回 4楼(kasim) 的帖子

明白了!谢谢版主大牛!
好好学习,天天鲁管
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
7楼  发表于: 2011-11-10 11:44

 回 6楼(wuweidong) 的帖子

你会成为高手的:)
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."