xref: /openbmc/u-boot/drivers/misc/fsl_devdis.c (revision c0982871)
1 /*
2  * Copyright 2015 Freescale Semiconductor, Inc.
3  * Author: Zhuoyu Zhang <Zhuoyu.Zhang@freescale.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 #include <common.h>
8 #include <asm/io.h>
9 #include <asm/arch-ls102xa/immap_ls102xa.h>
10 #include <asm/arch-ls102xa/config.h>
11 #include <linux/compiler.h>
12 #include <hwconfig.h>
13 #include <fsl_devdis.h>
14 
15 void device_disable(const struct devdis_table *tbl, uint32_t num)
16 {
17 	int i;
18 	struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
19 
20 	/*
21 	 * Extract hwconfig from environment and disable unused device.
22 	 */
23 	for (i = 0; i < num; i++) {
24 		if (hwconfig_sub("devdis", tbl[i].name))
25 			setbits_be32(&gur->devdisr + tbl[i].offset,
26 				tbl[i].mask);
27 	}
28 }
29 
30