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 #include <asm/arch/ahbc_aspeed.h> 13 14 struct aspeed_ahbc_priv { 15 struct aspeed_ahbc_reg *ahbc; 16 }; 17 18 extern void aspeed_ahbc_remap_enable(struct aspeed_ahbc_reg *ahbc) 19 { 20 writel(0x20, &ahbc->addr_remap); 21 } 22 23 static int aspeed_ahbc_probe(struct udevice *dev) 24 { 25 struct aspeed_ahbc_priv *priv = dev_get_priv(dev); 26 27 debug("%s(dev=%p) \n", __func__, dev); 28 29 priv->ahbc = devfdt_get_addr_ptr(dev); 30 if (IS_ERR(priv->ahbc)) 31 return PTR_ERR(priv->ahbc); 32 33 return 0; 34 } 35 36 static const struct udevice_id aspeed_ahbc_ids[] = { 37 { .compatible = "aspeed,aspeed-ahbc" }, 38 { } 39 }; 40 41 U_BOOT_DRIVER(aspeed_ahbc) = { 42 .name = "aspeed_ahbc", 43 .id = UCLASS_MISC, 44 .of_match = aspeed_ahbc_ids, 45 .probe = aspeed_ahbc_probe, 46 .priv_auto_alloc_size = sizeof(struct aspeed_ahbc_priv), 47 }; 48