X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=arch%2Farm%2Fmach-uniphier%2Fsoc-info.h;h=04732527a75e5d53dac95dc8d32c949eb27b776a;hb=fed9c76641b02ccbda4119d1bee34767c8729107;hp=3cfd1e9d6e0a5330c415cdd30078f1e831f86aa9;hpb=774da4b9aadeea4d6973a16debc02a6801ff9344;p=oweals%2Fu-boot.git diff --git a/arch/arm/mach-uniphier/soc-info.h b/arch/arm/mach-uniphier/soc-info.h index 3cfd1e9d6e..04732527a7 100644 --- a/arch/arm/mach-uniphier/soc-info.h +++ b/arch/arm/mach-uniphier/soc-info.h @@ -1,76 +1,44 @@ /* - * Copyright (C) 2015 Masahiro Yamada + * Copyright (C) 2017 Socionext Inc. + * Author: Masahiro Yamada * * SPDX-License-Identifier: GPL-2.0+ */ -#ifndef __MACH_SOC_INFO_H__ -#define __MACH_SOC_INFO_H__ - -enum uniphier_soc_id { - SOC_UNIPHIER_PH1_SLD3, - SOC_UNIPHIER_PH1_LD4, - SOC_UNIPHIER_PH1_PRO4, - SOC_UNIPHIER_PH1_SLD8, - SOC_UNIPHIER_PH1_PRO5, - SOC_UNIPHIER_PROXSTREAM2, - SOC_UNIPHIER_PH1_LD6B, - SOC_UNIPHIER_PH1_SLD11, - SOC_UNIPHIER_PH1_LD10, - SOC_UNIPHIER_UNKNOWN, -}; - -#define UNIPHIER_NR_ENABLED_SOCS \ - IS_ENABLED(CONFIG_ARCH_UNIPHIER_PH1_SLD3) + \ - IS_ENABLED(CONFIG_ARCH_UNIPHIER_PH1_LD4) + \ - IS_ENABLED(CONFIG_ARCH_UNIPHIER_PH1_PRO4) + \ - IS_ENABLED(CONFIG_ARCH_UNIPHIER_PH1_SLD8) + \ - IS_ENABLED(CONFIG_ARCH_UNIPHIER_PH1_PRO5) + \ - IS_ENABLED(CONFIG_ARCH_UNIPHIER_PROXSTREAM2) + \ - IS_ENABLED(CONFIG_ARCH_UNIPHIER_PH1_LD6B) + \ - IS_ENABLED(CONFIG_ARCH_UNIPHIER_PH1_SLD11) + \ - IS_ENABLED(CONFIG_ARCH_UNIPHIER_PH1_LD10) - -#define UNIPHIER_MULTI_SOC ((UNIPHIER_NR_ENABLED_SOCS) > 1) - -#if UNIPHIER_MULTI_SOC -enum uniphier_soc_id uniphier_get_soc_type(void); -#else -static inline enum uniphier_soc_id uniphier_get_soc_type(void) -{ -#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3) - return SOC_UNIPHIER_PH1_SLD3; -#endif -#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4) - return SOC_UNIPHIER_PH1_LD4; -#endif -#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4) - return SOC_UNIPHIER_PH1_PRO4; -#endif -#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8) - return SOC_UNIPHIER_PH1_SLD8; -#endif -#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5) - return SOC_UNIPHIER_PH1_PRO5; -#endif -#if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2) - return SOC_UNIPHIER_PROXSTREAM2; -#endif -#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B) - return SOC_UNIPHIER_PH1_LD6B; -#endif -#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD11) - return SOC_UNIPHIER_PH1_SLD11; -#endif -#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD10) - return SOC_UNIPHIER_PH1_LD10; -#endif - - return SOC_UNIPHIER_UNKNOWN; +#ifndef __UNIPHIER_SOC_INFO_H__ +#define __UNIPHIER_SOC_INFO_H__ + +#include +#include + +#define UNIPHIER_SLD3_ID 0x25 +#define UNIPHIER_LD4_ID 0x26 +#define UNIPHIER_PRO4_ID 0x28 +#define UNIPHIER_SLD8_ID 0x29 +#define UNIPHIER_PRO5_ID 0x2a +#define UNIPHIER_PXS2_ID 0x2e +#define UNIPHIER_LD6B_ID 0x2f +#define UNIPHIER_LD11_ID 0x31 +#define UNIPHIER_LD20_ID 0x32 +#define UNIPHIER_PXS3_ID 0x35 + +unsigned int uniphier_get_soc_id(void); +unsigned int uniphier_get_soc_model(void); +unsigned int uniphier_get_soc_revision(void); + +#define UNIPHIER_DEFINE_SOCDATA_FUNC(__func_name, __table) \ +static typeof(&__table[0]) __func_name(void) \ +{ \ + unsigned int soc_id; \ + int i; \ + \ + soc_id = uniphier_get_soc_id(); \ + for (i = 0; i < ARRAY_SIZE(__table); i++) { \ + if (__table[i].soc_id == soc_id) \ + return &__table[i]; \ + } \ + \ + return NULL; \ } -#endif - -int uniphier_get_soc_model(void); -int uniphier_get_soc_revision(void); -#endif /* __MACH_SOC_INFO_H__ */ +#endif /* __UNIPHIER_SOC_INFO_H__ */