Commit 45530e3943445f2787dc254cc12c58810b9e840f

Authored by Jean-Jacques Hiblot
Committed by Jaehoon Chung
1 parent 76584e3398

mmc: omap_hsmmc: do not embed struct mmc in struct omap_hsmmc_plat

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>

Showing 2 changed files with 4 additions and 4 deletions Side-by-side Diff

arch/arm/include/asm/omap_mmc.h
... ... @@ -67,7 +67,7 @@
67 67 struct omap_hsmmc_plat {
68 68 struct mmc_config cfg;
69 69 struct hsmmc *base_addr;
70   - struct mmc mmc;
  70 + struct mmc *mmc;
71 71 bool cd_inverted;
72 72 u32 controller_flags;
73 73 const char *hw_rev;
drivers/mmc/omap_hsmmc.c
... ... @@ -1858,8 +1858,8 @@
1858 1858 static int omap_hsmmc_bind(struct udevice *dev)
1859 1859 {
1860 1860 struct omap_hsmmc_plat *plat = dev_get_platdata(dev);
1861   -
1862   - return mmc_bind(dev, &plat->mmc, &plat->cfg);
  1861 + plat->mmc = calloc(1, sizeof(struct mmc));
  1862 + return mmc_bind(dev, plat->mmc, &plat->cfg);
1863 1863 }
1864 1864 #endif
1865 1865 static int omap_hsmmc_probe(struct udevice *dev)
... ... @@ -1882,7 +1882,7 @@
1882 1882 #endif
1883 1883  
1884 1884 #ifdef CONFIG_BLK
1885   - mmc = &plat->mmc;
  1885 + mmc = plat->mmc;
1886 1886 #else
1887 1887 mmc = mmc_create(cfg, priv);
1888 1888 if (mmc == NULL)