1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (C) ASPEED Technology Inc. 4 */ 5 6 #include <common.h> 7 #include <clk.h> 8 #include <dm.h> 9 #include <errno.h> 10 #include <fdtdec.h> 11 #include <asm/io.h> 12 13 struct aspeed_sdhci_general_reg { 14 u32 genreal_info; 15 u32 debounce_setting; 16 u32 bus_setting; 17 }; 18 19 struct aspeed_sdhci_general_data { 20 struct aspeed_sdhci_general_reg *regs; 21 struct clk_bulk clks; 22 }; 23 24 static int aspeed_sdhci_irq_ofdata_to_platdata(struct udevice *dev) 25 { 26 struct aspeed_sdhci_general_data *priv = dev_get_priv(dev); 27 28 return clk_get_bulk(dev, &priv->clks); 29 } 30 31 static int aspeed_sdhci_irq_probe(struct udevice *dev) 32 { 33 struct aspeed_sdhci_general_data *priv = dev_get_priv(dev); 34 int ret = 0; 35 36 debug("%s(dev=%p) \n", __func__, dev); 37 38 ret = clk_enable_bulk(&priv->clks); 39 if (ret) { 40 pr_debug("fail enable sdhci clk \n"); 41 return ret; 42 } 43 44 return 0; 45 } 46 47 static const struct udevice_id aspeed_sdhci_irq_ids[] = { 48 { .compatible = "aspeed,aspeed-sdhci-irq" }, 49 { .compatible = "aspeed,aspeed-emmc-irq" }, 50 { } 51 }; 52 53 U_BOOT_DRIVER(aspeed_sdhci_ic) = { 54 .name = "aspeed_sdhci_ic", 55 .id = UCLASS_MISC, 56 .of_match = aspeed_sdhci_irq_ids, 57 .probe = aspeed_sdhci_irq_probe, 58 .ofdata_to_platdata = aspeed_sdhci_irq_ofdata_to_platdata, 59 .priv_auto_alloc_size = sizeof(struct aspeed_sdhci_general_data), 60 }; 61