15962Sgoetz// SPDX-License-Identifier: GPL-2.0+
213051Siklam/*
313051Siklam * System information routines for all OMAP based boards.
45962Sgoetz *
55962Sgoetz * (C) Copyright 2017 Linaro Ltd.
65962Sgoetz * Sam Protsenko <semen.protsenko@linaro.org>
75962Sgoetz */
85962Sgoetz
95962Sgoetz#include <asm/arch/omap.h>
105962Sgoetz#include <asm/io.h>
115962Sgoetz#include <asm/omap_common.h>
125962Sgoetz
135962Sgoetz/**
145962Sgoetz * Tell if device is GP/HS/EMU/TST.
155962Sgoetz */
165962Sgoetzu32 get_device_type(void)
175962Sgoetz{
185962Sgoetz#if defined(CONFIG_OMAP34XX)
195962Sgoetz	/*
205962Sgoetz	 * On OMAP3 systems we call this early enough that we must just
215962Sgoetz	 * use the direct offset for safety.
225962Sgoetz	 */
235962Sgoetz	return (readl(OMAP34XX_CTRL_BASE + 0x2f0) & DEVICE_TYPE_MASK) >>
245962Sgoetz		DEVICE_TYPE_SHIFT;
255962Sgoetz#else
265962Sgoetz	return (readl((*ctrl)->control_status) & DEVICE_TYPE_MASK) >>
275962Sgoetz		DEVICE_TYPE_SHIFT;
285962Sgoetz#endif
2911658Sgoetz}
305962Sgoetz