blob: 73256b7c7b6d2d130d57144c535109d1570114a2 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Masahiro Yamada323d1f92015-09-22 00:27:39 +09002/*
Masahiro Yamadae27d6c72017-01-21 18:05:26 +09003 * Copyright (C) 2017 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada323d1f92015-09-22 00:27:39 +09005 */
6
Masahiro Yamadae27d6c72017-01-21 18:05:26 +09007#ifndef __UNIPHIER_SOC_INFO_H__
8#define __UNIPHIER_SOC_INFO_H__
Masahiro Yamada323d1f92015-09-22 00:27:39 +09009
Masahiro Yamadaee8ef5a2017-01-21 18:05:27 +090010#include <linux/kernel.h>
11#include <linux/stddef.h>
12
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090013#define UNIPHIER_LD4_ID 0x26
14#define UNIPHIER_PRO4_ID 0x28
15#define UNIPHIER_SLD8_ID 0x29
16#define UNIPHIER_PRO5_ID 0x2a
17#define UNIPHIER_PXS2_ID 0x2e
18#define UNIPHIER_LD6B_ID 0x2f
19#define UNIPHIER_LD11_ID 0x31
20#define UNIPHIER_LD20_ID 0x32
Masahiro Yamada2c2ab3d2017-01-21 18:05:31 +090021#define UNIPHIER_PXS3_ID 0x35
Masahiro Yamada323d1f92015-09-22 00:27:39 +090022
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090023unsigned int uniphier_get_soc_id(void);
24unsigned int uniphier_get_soc_model(void);
25unsigned int uniphier_get_soc_revision(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090026
Masahiro Yamadaee8ef5a2017-01-21 18:05:27 +090027#define UNIPHIER_DEFINE_SOCDATA_FUNC(__func_name, __table) \
28static typeof(&__table[0]) __func_name(void) \
29{ \
30 unsigned int soc_id; \
31 int i; \
32 \
33 soc_id = uniphier_get_soc_id(); \
34 for (i = 0; i < ARRAY_SIZE(__table); i++) { \
35 if (__table[i].soc_id == soc_id) \
36 return &__table[i]; \
37 } \
38 \
39 return NULL; \
40}
41
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090042#endif /* __UNIPHIER_SOC_INFO_H__ */