Chinaunix首页 | 论坛 | 博客
  • 博客访问: 56313
  • 博文数量: 22
  • 博客积分: 975
  • 博客等级: 准尉
  • 技术积分: 222
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-02 21:41
文章分类
文章存档

2011年(8)

2010年(8)

2009年(6)

我的朋友

分类: LINUX

2011-02-24 11:24:44

drivers/mmc/host/sdhci-pci.c中, pci总线上有host controller时将执行probe函数,MD平台共有5个host controller,每个有一个slot, 该probe函数将执行五次,依次对每个controller进行初始化。
 
static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
 914                                      const struct pci_device_id *ent)
 915 {
 916         struct sdhci_pci_chip *chip;
 917         struct sdhci_pci_slot *slot;
 918
 919         u8 slots, rev, first_bar;
 920         int ret, i;
 921
 922         BUG_ON(pdev == NULL);
 923         BUG_ON(ent == NULL);
 924
 925         pci_read_config_byte(pdev, PCI_CLASS_REVISION, &rev);
 926
 927         printk("yohoro: pdev:0x %p\n", pdev);
 928
 929         dev_info(&pdev->dev, "SDHCI controller found [%04x:%04x] (rev %x)\n",
 930                  (int)pdev->vendor, (int)pdev->device, (int)rev);
 931
。。。
 
----------------
[    7.030845] sdhci: Secure Digital Host Controller Interface driver
[    7.030882] sdhci: Copyright(c) Pierre Ossman
[    7.031029] yohoro: pdev:0x f7517120
[    7.031061] sdhci-pci 0000:00:01.0: SDHCI controller found [8086:0823] (rev 44)
[    7.031110] sdhci-pci 0000:00:01.0: found 1 slot(s)
[    7.033612] Registered led device: mmc0::
[    7.034770] mmc0: SDHCI controller on PCI [0000:00:01.0] using ADMA
[    7.045609] yohoro: pdev:0x f7516908
[    7.045643] sdhci-pci 0000:00:01.1: SDHCI controller found [8086:0824] (rev 44)
[    7.045692] sdhci-pci 0000:00:01.1: found 1 slot(s)
[    7.046638] Registered led device: mmc1::
[    7.047217] mmc1: SDHCI controller on PCI [0000:00:01.1] using ADMA
[    7.056658] yohoro: pdev:0x f7522270
[    7.056693] sdhci-pci 0000:00:04.0: SDHCI controller found [8086:0820] (rev 44)
[    7.056742] sdhci-pci 0000:00:04.0: found 1 slot(s)
[    7.057719] Registered led device: mmc2::
[    7.058325] mmc2: SDHCI controller on PCI [0000:00:04.0] using ADMA
[    7.067598] yohoro: pdev:0x f75252e0
[    7.067631] sdhci-pci 0000:00:04.1: SDHCI controller found [8086:0821] (rev 44)
[    7.067680] sdhci-pci 0000:00:04.1: found 1 slot(s)
[    7.068633] Registered led device: mmc3::
[    7.069218] mmc3: SDHCI controller on PCI [0000:00:04.1] using ADMA
[    7.079585] yohoro: pdev:0x f7524ac8
[    7.079619] sdhci-pci 0000:00:04.2: SDHCI controller found [8086:0822] (rev 44)
[    7.079668] sdhci-pci 0000:00:04.2: found 1 slot(s)
[    7.080522] Registered led device: mmc4::
[    7.081178] mmc4: SDHCI controller on PCI [0000:00:04.2] using ADMA
 
得到每个pdev(应该是Host controller)的地址,那么就可以随意操作其内部的成员了。
 
比如调用suspend,resume进行电源管理的测试。
suspend 的 call path: sdhci_pci_suspend -> sdhci_suspend_host -> mmc_suspend_host

 
阅读(1821) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~