内核源码中的平台总线

 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 },
								};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值