blob: 04732527a75e5d53dac95dc8d32c949eb27b776a [file] [log] [blame]
Masahiro Yamada323d1f92015-09-22 00:27:39 +09001/*
Masahiro Yamadae27d6c72017-01-21 18:05:26 +09002 * Copyright (C) 2017 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada323d1f92015-09-22 00:27:39 +09004 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
Masahiro Yamadae27d6c72017-01-21 18:05:26 +09008#ifndef __UNIPHIER_SOC_INFO_H__
9#define __UNIPHIER_SOC_INFO_H__
Masahiro Yamada323d1f92015-09-22 00:27:39 +090010
Masahiro Yamadaee8ef5a2017-01-21 18:05:27 +090011#include <linux/kernel.h>
12#include <linux/stddef.h>
13
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090014#define UNIPHIER_SLD3_ID 0x25
15#define UNIPHIER_LD4_ID 0x26
16#define UNIPHIER_PRO4_ID 0x28
17#define UNIPHIER_SLD8_ID 0x29
18#define UNIPHIER_PRO5_ID 0x2a
19#define UNIPHIER_PXS2_ID 0x2e
20#define UNIPHIER_LD6B_ID 0x2f
21#define UNIPHIER_LD11_ID 0x31
22#define UNIPHIER_LD20_ID 0x32
Masahiro Yamada2c2ab3d2017-01-21 18:05:31 +090023#define UNIPHIER_PXS3_ID 0x35
Masahiro Yamada323d1f92015-09-22 00:27:39 +090024
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090025unsigned int uniphier_get_soc_id(void);
26unsigned int uniphier_get_soc_model(void);
27unsigned int uniphier_get_soc_revision(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090028
Masahiro Yamadaee8ef5a2017-01-21 18:05:27 +090029#define UNIPHIER_DEFINE_SOCDATA_FUNC(__func_name, __table) \
30static typeof(&__table[0]) __func_name(void) \
31{ \
32 unsigned int soc_id; \
33 int i; \
34 \
35 soc_id = uniphier_get_soc_id(); \
36 for (i = 0; i < ARRAY_SIZE(__table); i++) { \
37 if (__table[i].soc_id == soc_id) \
38 return &__table[i]; \
39 } \
40 \
41 return NULL; \
42}
43
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090044#endif /* __UNIPHIER_SOC_INFO_H__ */