]> git.sur5r.net Git - u-boot/commitdiff
mmc: omap_hsmmc: do not embed struct mmc in struct omap_hsmmc_plat
authorJean-Jacques Hiblot <jjhiblot@ti.com>
Fri, 23 Feb 2018 09:40:16 +0000 (10:40 +0100)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 26 Feb 2018 01:52:15 +0000 (10:52 +0900)
The area for struct mmc can be allocated dynamically. It greatly reduces
the size of struct omap_hsmmc_plat. This is useful in cases where the board
level code declares one or two struct omap_hsmmc_plat because it doesn't
use the Driver Model.

This saves around 740 bytes for the am335x_evm SPL.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
arch/arm/include/asm/omap_mmc.h
drivers/mmc/omap_hsmmc.c

index 3d70148882cd8e530384a846a545c67bd16c3941..42ce8dcd6d00229decab4fd042c7f61150643dd1 100644 (file)
@@ -67,7 +67,7 @@ struct hsmmc {
 struct omap_hsmmc_plat {
        struct mmc_config cfg;
        struct hsmmc *base_addr;
-       struct mmc mmc;
+       struct mmc *mmc;
        bool cd_inverted;
        u32 controller_flags;
        const char *hw_rev;
index 02970f29b295787a248e530884fee18cbbdb7b69..e0b679aa2c5746f72aa0c3fb47e4ef114f83f620 100644 (file)
@@ -1858,8 +1858,8 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
 static int omap_hsmmc_bind(struct udevice *dev)
 {
        struct omap_hsmmc_plat *plat = dev_get_platdata(dev);
-
-       return mmc_bind(dev, &plat->mmc, &plat->cfg);
+       plat->mmc = calloc(1, sizeof(struct mmc));
+       return mmc_bind(dev, plat->mmc, &plat->cfg);
 }
 #endif
 static int omap_hsmmc_probe(struct udevice *dev)
@@ -1882,7 +1882,7 @@ static int omap_hsmmc_probe(struct udevice *dev)
 #endif
 
 #ifdef CONFIG_BLK
-       mmc = &plat->mmc;
+       mmc = plat->mmc;
 #else
        mmc = mmc_create(cfg, priv);
        if (mmc == NULL)