Skip to contentSkip to conversation

Control drive strength in software

PATCH Jeremie Samuel 2 participants 2 messages Feb 4, 2013 – Feb 11, 2013 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

Hi,

I'm working on a SDHCI driver for linux kernel 3.4.

The IP that I have to control does not control the Driver Strength.
Driver Type B is always selected. On the other hand, I can control the drive strength of the pads in software.

I would like to use the interface select_drive_strength of the mmc_host_ops. Is it a good idea?

If so, I have an other issue.

This function doesn't have an mmc_host as parameter. It is an issue for me since the drive strength parameters can be board specific. A solution would be to add this parameter:

include/linux/mmc/host.h +0 -0
index 5674504..cb6d117 100644
@@ -134,7 +134,7 @@ struct mmc_host_ops {
        /* The tuning command opcode value is different for SD and eMMC 

cards */

        int     (*execute_tuning)(struct mmc_host *host, u32 opcode);
        void    (*enable_preset_value)(struct mmc_host *host, bool enable);
-       int     (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
+       int     (*select_drive_strength)(struct mmc_host *host, unsigned int max_dtr, int host_drv, int card_drv);
        void    (*hw_reset)(struct mmc_host *host);

};

Is this solution a good idea?

Also, the drive strength configuration might be different according to the mode (not only UHS). So, I would like to control the drive strength for the default speed and the high speed. Would it be relevant to add this a call to this function in mmc_sd_switch_hs or in mmc_sd_init_card?

Thanks,

Jeremie Samuel

#1 lore raw

Hi Jeremie,

Quoted 18 lines · Jeremie Samuel

This function doesn't have an mmc_host as parameter. It is an issue for me since the drive strength parameters can be board specific. A solution would be to add this parameter:

include/linux/mmc/host.h +0 -0
index 5674504..cb6d117 100644
@@ -134,7 +134,7 @@ struct mmc_host_ops {
        /* The tuning command opcode value is different for SD and

eMMC cards */

        int     (*execute_tuning)(struct mmc_host *host, u32 opcode);
        void    (*enable_preset_value)(struct mmc_host *host, bool enable);
-       int     (*select_drive_strength)(unsigned int max_dtr, int
host_drv, int card_drv);
+       int     (*select_drive_strength)(struct mmc_host *host,
unsigned int max_dtr, int host_drv, int card_drv);
        void    (*hw_reset)(struct mmc_host *host);
Quoted 3 lines

};

Is this solution a good idea?

Yes, sounds good. Want to send a formal patch?

Quoted 5 lines

Also, the drive strength configuration might be different according to the mode (not only UHS). So, I would like to control the drive strength for the default speed and the high speed. Would it be relevant to add this a call to this function in mmc_sd_switch_hs or in mmc_sd_init_card?

Yes, that sounds sensible too.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child