1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
200bbe96eSSemen Protsenko /*
300bbe96eSSemen Protsenko  * System information routines for all OMAP based boards.
400bbe96eSSemen Protsenko  *
500bbe96eSSemen Protsenko  * (C) Copyright 2017 Linaro Ltd.
600bbe96eSSemen Protsenko  * Sam Protsenko <semen.protsenko@linaro.org>
700bbe96eSSemen Protsenko  */
800bbe96eSSemen Protsenko 
900bbe96eSSemen Protsenko #include <asm/arch/omap.h>
1000bbe96eSSemen Protsenko #include <asm/io.h>
1100bbe96eSSemen Protsenko #include <asm/omap_common.h>
1200bbe96eSSemen Protsenko 
1300bbe96eSSemen Protsenko /**
1400bbe96eSSemen Protsenko  * Tell if device is GP/HS/EMU/TST.
1500bbe96eSSemen Protsenko  */
1600bbe96eSSemen Protsenko u32 get_device_type(void)
1700bbe96eSSemen Protsenko {
18da0227f7SDerald D. Woods #if defined(CONFIG_OMAP34XX)
19da0227f7SDerald D. Woods 	/*
20da0227f7SDerald D. Woods 	 * On OMAP3 systems we call this early enough that we must just
21da0227f7SDerald D. Woods 	 * use the direct offset for safety.
22da0227f7SDerald D. Woods 	 */
23da0227f7SDerald D. Woods 	return (readl(OMAP34XX_CTRL_BASE + 0x2f0) & DEVICE_TYPE_MASK) >>
24da0227f7SDerald D. Woods 		DEVICE_TYPE_SHIFT;
25da0227f7SDerald D. Woods #else
2600bbe96eSSemen Protsenko 	return (readl((*ctrl)->control_status) & DEVICE_TYPE_MASK) >>
2700bbe96eSSemen Protsenko 		DEVICE_TYPE_SHIFT;
28da0227f7SDerald D. Woods #endif
2900bbe96eSSemen Protsenko }
30