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