mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/staging/dedeckeh.git] / target / linux / bcm4908 / patches-5.4 / 082-v5.12-0003-soc-bcm-brcmstb-add-stubs-for-getting-platform-IDs.patch
1 From 149ae80b1d50e7db5ac7df1cdf0820017b70e716 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Thu, 14 Jan 2021 11:53:18 +0100
4 Subject: [PATCH] soc: bcm: brcmstb: add stubs for getting platform IDs
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Some brcmstb drivers may be shared with other SoC families. E.g. the
10 same USB PHY block is shared by brcmstb and BCM4908.
11
12 To avoid building brcmstb common code on non-brcmstb platforms we need
13 stubs for:
14 1. brcmstb_get_family_id()
15 2. brcmstb_get_product_id()
16 (to avoid "undefined reference to" errors).
17
18 With this change PHY_BRCM_USB will not have to unconditionally select
19 SOC_BRCMSTB anymore.
20
21 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
22 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
23 ---
24 include/linux/soc/brcmstb/brcmstb.h | 16 ++++++++++++++++
25 1 file changed, 16 insertions(+)
26
27 --- a/include/linux/soc/brcmstb/brcmstb.h
28 +++ b/include/linux/soc/brcmstb/brcmstb.h
29 @@ -2,6 +2,8 @@
30 #ifndef __BRCMSTB_SOC_H
31 #define __BRCMSTB_SOC_H
32
33 +#include <linux/kconfig.h>
34 +
35 static inline u32 BRCM_ID(u32 reg)
36 {
37 return reg >> 28 ? reg >> 16 : reg >> 8;
38 @@ -12,6 +14,8 @@ static inline u32 BRCM_REV(u32 reg)
39 return reg & 0xff;
40 }
41
42 +#if IS_ENABLED(CONFIG_SOC_BRCMSTB)
43 +
44 /*
45 * Helper functions for getting family or product id from the
46 * SoC driver.
47 @@ -19,4 +23,16 @@ static inline u32 BRCM_REV(u32 reg)
48 u32 brcmstb_get_family_id(void);
49 u32 brcmstb_get_product_id(void);
50
51 +#else
52 +static inline u32 brcmstb_get_family_id(void)
53 +{
54 + return 0;
55 +}
56 +
57 +static inline u32 brcmstb_get_product_id(void)
58 +{
59 + return 0;
60 +}
61 +#endif
62 +
63 #endif /* __BRCMSTB_SOC_H */