blob: aab65925b46368279f054e20873227d70769d5bd [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 149ae80b1d50e7db5ac7df1cdf0820017b70e716 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3Date: Thu, 14 Jan 2021 11:53:18 +0100
4Subject: [PATCH] soc: bcm: brcmstb: add stubs for getting platform IDs
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Some brcmstb drivers may be shared with other SoC families. E.g. the
10same USB PHY block is shared by brcmstb and BCM4908.
11
12To avoid building brcmstb common code on non-brcmstb platforms we need
13stubs for:
141. brcmstb_get_family_id()
152. brcmstb_get_product_id()
16(to avoid "undefined reference to" errors).
17
18With this change PHY_BRCM_USB will not have to unconditionally select
19SOC_BRCMSTB anymore.
20
21Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
22Signed-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 */