arch\arm\mach-s5pv210\mach-smdkv210.c
|
static void __init smdkv210_machine_init(void)
|
platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices));
|
int platform_add_devices(struct platform_device **devs, int num)
{
int i, ret = 0;
for (i = 0; i < num; i++) {
ret = platform_device_register(devs[i]);//注册设备
if (ret) {
while (--i >= 0)
platform_device_unregister(devs[i]);
break;
}
}
return ret;
}
//以上代码为下列设备注册
static struct platform_device *smdkv210_devices[] __initdata = {
&s3c_device_adc,
&s3c_device_cfcon,
&s3c_device_fb,
&s3c_device_hsmmc0,
&s3c_device_hsmmc1,
&s3c_device_hsmmc2,
&s3c_device_hsmmc3,
&s3c_device_i2c0,
&s3c_device_i2c1,
&s3c_device_i2c2,
&s3c_device_rtc,
&s3c_device_ts,
&s3c_device_wdt,
&s5pv210_device_ac97,
&s5pv210_device_iis0,
&s5pv210_device_spdif,
&samsung_asoc_dma,
&samsung_device_keypad,
&smdkv210_dm9000,---------------------------
&smdkv210_lcd_lte480wv, |
&s3c_device_timer[3], |
&smdkv210_backlight_device, |
}; |
struct platform_device smdkv210_dm9000 = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(smdkv210_dm9000_resources),
.resource = smdkv210_dm9000_resources, ---------------------
.dev = { |
.platform_data = &smdkv210_dm9000_platdata,---- |
}, | |
}; | |
| //资源
| static struct resource smdkv210_dm9000_resources[] = {
| [0] = {
| .start = 0x88000000,
| .end = 0x88000000+0x3,
| .flags = IORESOURCE_MEM,
| },
| [1] = {
| .start = 0x88000000+0x4,
| .end = 0x88000000+0x4+0x3,
| .flags = IORESOURCE_MEM,
| },
| [2] = {
| .start = IRQ_EINT(10),
| .end = IRQ_EINT(10),
| .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
| },
| };
|
|
|
|
//数据
static struct dm9000_plat_data smdkv210_dm9000_platdata = {
.flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM,
.dev_addr = { 0x00, 0x09, 0xc0, 0xff, 0xec, 0xee },
};
内核源码中的平台总线
最新推荐文章于 2024-09-03 23:23:36 发布