Lines Matching refs:host
39 struct dwmci_host host; member
48 static int exynos_dwmci_clksel(struct dwmci_host *host) in exynos_dwmci_clksel() argument
52 container_of(host, struct dwmci_exynos_priv_data, host); in exynos_dwmci_clksel()
54 struct dwmci_exynos_priv_data *priv = host->priv; in exynos_dwmci_clksel()
56 dwmci_writel(host, DWMCI_CLKSEL, priv->sdr_timing); in exynos_dwmci_clksel()
61 unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) in exynos_dwmci_get_clk() argument
72 clk_div = ((dwmci_readl(host, DWMCI_CLKSEL) >> DWMCI_DIVRATIO_BIT) in exynos_dwmci_get_clk()
74 sclk = get_mmc_clk(host->dev_index); in exynos_dwmci_get_clk()
80 return sclk / clk_div / (host->div + 1); in exynos_dwmci_get_clk()
83 static void exynos_dwmci_board_init(struct dwmci_host *host) in exynos_dwmci_board_init() argument
85 struct dwmci_exynos_priv_data *priv = host->priv; in exynos_dwmci_board_init()
87 if (host->quirks & DWMCI_QUIRK_DISABLE_SMU) { in exynos_dwmci_board_init()
88 dwmci_writel(host, EMMCP_MPSBEGIN0, 0); in exynos_dwmci_board_init()
89 dwmci_writel(host, EMMCP_SEND0, 0); in exynos_dwmci_board_init()
90 dwmci_writel(host, EMMCP_CTRL0, in exynos_dwmci_board_init()
99 exynos_dwmci_clksel(host); in exynos_dwmci_board_init()
102 static int exynos_dwmci_core_init(struct dwmci_host *host) in exynos_dwmci_core_init() argument
107 if (host->bus_hz) in exynos_dwmci_core_init()
108 freq = host->bus_hz; in exynos_dwmci_core_init()
113 sclk = get_mmc_clk(host->dev_index); in exynos_dwmci_core_init()
116 set_mmc_clk(host->dev_index, div); in exynos_dwmci_core_init()
118 host->name = "EXYNOS DWMMC"; in exynos_dwmci_core_init()
120 host->quirks = DWMCI_QUIRK_DISABLE_SMU; in exynos_dwmci_core_init()
122 host->board_init = exynos_dwmci_board_init; in exynos_dwmci_core_init()
124 host->caps = MMC_MODE_DDR_52MHz; in exynos_dwmci_core_init()
125 host->clksel = exynos_dwmci_clksel; in exynos_dwmci_core_init()
126 host->get_mmc_clk = exynos_dwmci_get_clk; in exynos_dwmci_core_init()
130 if (add_dwmci(host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ)) { in exynos_dwmci_core_init()
131 printf("DWMMC%d registration failed\n", host->dev_index); in exynos_dwmci_core_init()
139 static int do_dwmci_init(struct dwmci_host *host) in do_dwmci_init() argument
143 flag = host->buswidth == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE; in do_dwmci_init()
144 err = exynos_pinmux_config(host->dev_id, flag); in do_dwmci_init()
146 printf("DWMMC%d not configure\n", host->dev_index); in do_dwmci_init()
150 return exynos_dwmci_core_init(host); in do_dwmci_init()
154 struct dwmci_host *host, in exynos_dwmci_get_config() argument
161 host->dev_id = pinmux_decode_periph_id(blob, node); in exynos_dwmci_get_config()
163 host->dev_index = fdtdec_get_int(blob, node, "index", host->dev_id); in exynos_dwmci_get_config()
164 if (host->dev_index == host->dev_id) in exynos_dwmci_get_config()
165 host->dev_index = host->dev_id - PERIPH_ID_SDMMC0; in exynos_dwmci_get_config()
167 if (host->dev_index > 4) { in exynos_dwmci_get_config()
168 printf("DWMMC%d: Can't get the dev index\n", host->dev_index); in exynos_dwmci_get_config()
173 host->buswidth = fdtdec_get_int(blob, node, "samsung,bus-width", 4); in exynos_dwmci_get_config()
178 printf("DWMMC%d: Can't get base address\n", host->dev_index); in exynos_dwmci_get_config()
181 host->ioaddr = (void *)base; in exynos_dwmci_get_config()
187 host->dev_index); in exynos_dwmci_get_config()
197 if (host->dev_index == 0) in exynos_dwmci_get_config()
199 else if (host->dev_index == 2) in exynos_dwmci_get_config()
203 host->fifoth_val = fdtdec_get_int(blob, node, "fifoth_val", 0); in exynos_dwmci_get_config()
204 host->bus_hz = fdtdec_get_int(blob, node, "bus_hz", 0); in exynos_dwmci_get_config()
205 host->div = fdtdec_get_int(blob, node, "div", 0); in exynos_dwmci_get_config()
216 struct dwmci_host *host = &priv->host; in exynos_dwmmc_probe() local
219 err = exynos_dwmci_get_config(gd->fdt_blob, dev_of_offset(dev), host, in exynos_dwmmc_probe()
223 err = do_dwmci_init(host); in exynos_dwmmc_probe()
227 dwmci_setup_cfg(&plat->cfg, host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ); in exynos_dwmmc_probe()
228 host->mmc = &plat->mmc; in exynos_dwmmc_probe()
229 host->mmc->priv = &priv->host; in exynos_dwmmc_probe()
230 host->priv = dev; in exynos_dwmmc_probe()
231 upriv->mmc = host->mmc; in exynos_dwmmc_probe()