Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 1.8 KB

浅谈如何获得设备驱动.md

File metadata and controls

56 lines (39 loc) · 1.8 KB

浅谈如何获得设备驱动

  1. 设备树, 记得u-boot和Linux内核的设备树要结合起来一起看。或者直接从设备上已运行的Linux中获得。

    uboot设备树提到了:

    sdio1: sdio1@16020000 {
    			compatible = "snps,dw-mshc";
    			reg = <0x0 0x16020000 0x0 0x10000>;
    			clocks = <&clkgen JH7110_SDIO1_CLK_AHB>,
    				 <&clkgen JH7110_SDIO1_CLK_SDCARD>;
    			clock-names = "biu","ciu";
    			resets = <&rstgen RSTN_U1_DW_SDIO_AHB>;
    			reset-names = "reset";
    		};
    

    所以可以在drivers/mmc/snps_dw_mmc.c 这里找到:

    struct dm_mmc_ops snps_dwmci_dm_ops;
    
    static int snps_dwmmc_probe(struct udevice *dev)
    {
    #ifdef CONFIG_BLK
    	struct snps_dwmci_plat *plat = dev_get_plat(dev);
    #endif
    	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
    	struct snps_dwmci_priv_data *priv = dev_get_priv(dev);
    	struct dwmci_host *host = &priv->host;
    	unsigned int clock_max;
    	int ret;
    
    	/* Extend generic 'dm_dwmci_ops' with our 'getcd' implementation */
    	memcpy(&snps_dwmci_dm_ops, &dm_dwmci_ops, sizeof(struct dm_mmc_ops));
    	snps_dwmci_dm_ops.get_cd = snps_dwmmc_getcd;

    所以在drivers/mmc/dw_mmc.c 这里有代码。

    之后就交给GPT好了

  2. defconfig

    这里 configs/starfive_visionfive2_defconfig也能看到:

    ONFIG_MMC_DW=y
    CONFIG_MMC_DW_SNPS=y