Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 2 | * Copyright (C) 2017 Socionext Inc. |
| 3 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 8 | #ifndef __UNIPHIER_SOC_INFO_H__ |
| 9 | #define __UNIPHIER_SOC_INFO_H__ |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 10 | |
Masahiro Yamada | 1b81898 | 2017-01-21 18:05:27 +0900 | [diff] [blame] | 11 | #include <linux/kernel.h> |
| 12 | #include <linux/stddef.h> |
| 13 | |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 14 | #define UNIPHIER_LD4_ID 0x26 |
| 15 | #define UNIPHIER_PRO4_ID 0x28 |
| 16 | #define UNIPHIER_SLD8_ID 0x29 |
| 17 | #define UNIPHIER_PRO5_ID 0x2a |
| 18 | #define UNIPHIER_PXS2_ID 0x2e |
| 19 | #define UNIPHIER_LD6B_ID 0x2f |
| 20 | #define UNIPHIER_LD11_ID 0x31 |
| 21 | #define UNIPHIER_LD20_ID 0x32 |
Masahiro Yamada | 133b126 | 2017-01-21 18:05:31 +0900 | [diff] [blame] | 22 | #define UNIPHIER_PXS3_ID 0x35 |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 23 | |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 24 | unsigned int uniphier_get_soc_id(void); |
| 25 | unsigned int uniphier_get_soc_model(void); |
| 26 | unsigned int uniphier_get_soc_revision(void); |
Masahiro Yamada | f637bdf | 2015-12-17 17:47:41 +0900 | [diff] [blame] | 27 | |
Masahiro Yamada | 1b81898 | 2017-01-21 18:05:27 +0900 | [diff] [blame] | 28 | #define UNIPHIER_DEFINE_SOCDATA_FUNC(__func_name, __table) \ |
| 29 | static typeof(&__table[0]) __func_name(void) \ |
| 30 | { \ |
| 31 | unsigned int soc_id; \ |
| 32 | int i; \ |
| 33 | \ |
| 34 | soc_id = uniphier_get_soc_id(); \ |
| 35 | for (i = 0; i < ARRAY_SIZE(__table); i++) { \ |
| 36 | if (__table[i].soc_id == soc_id) \ |
| 37 | return &__table[i]; \ |
| 38 | } \ |
| 39 | \ |
| 40 | return NULL; \ |
| 41 | } |
| 42 | |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 43 | #endif /* __UNIPHIER_SOC_INFO_H__ */ |