Semen Protsenko | 00bbe96 | 2017-06-02 18:00:00 +0300 | [diff] [blame] | 1 | /* |
| 2 | * System information routines for all OMAP based boards. |
| 3 | * |
| 4 | * (C) Copyright 2017 Linaro Ltd. |
| 5 | * Sam Protsenko <semen.protsenko@linaro.org> |
| 6 | * |
| 7 | * SPDX-License-Identifier: GPL-2.0+ |
| 8 | */ |
| 9 | |
| 10 | #include <asm/arch/omap.h> |
| 11 | #include <asm/io.h> |
| 12 | #include <asm/omap_common.h> |
| 13 | |
| 14 | /** |
| 15 | * Tell if device is GP/HS/EMU/TST. |
| 16 | */ |
| 17 | u32 get_device_type(void) |
| 18 | { |
Derald D. Woods | da0227f | 2017-07-31 07:41:40 -0500 | [diff] [blame] | 19 | #if defined(CONFIG_OMAP34XX) |
| 20 | /* |
| 21 | * On OMAP3 systems we call this early enough that we must just |
| 22 | * use the direct offset for safety. |
| 23 | */ |
| 24 | return (readl(OMAP34XX_CTRL_BASE + 0x2f0) & DEVICE_TYPE_MASK) >> |
| 25 | DEVICE_TYPE_SHIFT; |
| 26 | #else |
Semen Protsenko | 00bbe96 | 2017-06-02 18:00:00 +0300 | [diff] [blame] | 27 | return (readl((*ctrl)->control_status) & DEVICE_TYPE_MASK) >> |
| 28 | DEVICE_TYPE_SHIFT; |
Derald D. Woods | da0227f | 2017-07-31 07:41:40 -0500 | [diff] [blame] | 29 | #endif |
Semen Protsenko | 00bbe96 | 2017-06-02 18:00:00 +0300 | [diff] [blame] | 30 | } |