[openwrt/openwrt] ar71xx: add definitions for RouterBOARD hardware option bits

LEDE Commits lede-commits at lists.infradead.org
Mon Jan 22 03:54:04 PST 2018


blogic pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/c7371cd1ee1dce130aa52ac9cdeb023fc33ee4b0

commit c7371cd1ee1dce130aa52ac9cdeb023fc33ee4b0
Author: Gabor Juhos <juhosg at freemail.hu>
AuthorDate: Thu Jan 18 13:50:29 2018 +0100

    ar71xx: add definitions for RouterBOARD hardware option bits
    
    Add bit definitions for the 'hardware options' tag which is used in
    the MikroTik devices' hardware configurations. These values can be
    used in board setup codes, to do different initialization sequences.
    The values were obtained from the RouterOS 6.41-rc38 patches.
    
    Additionally, introduce two helper functions what make the processing
    of the hardware options easy.
    
    Signed-off-by: Gabor Juhos <juhosg at freemail.hu>
---
 .../ar71xx/files/arch/mips/ath79/routerboot.h      | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/routerboot.h b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.h
index c1d7fb9..cf18936 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/routerboot.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.h
@@ -21,6 +21,32 @@ struct rb_info {
 	u32 hw_options;
 };
 
+/* Bit definitions for hardware options */
+#define RB_HW_OPT_UART_ABSENT		BIT(0)
+#define RB_HW_OPT_HAS_VOLTAGE		BIT(1)
+#define RB_HW_OPT_HAS_USB		BIT(2)
+#define RB_HW_OPT_HAS_ATTINY		BIT(3)
+#define RB_HW_OPT_NO_NAND		BIT(14)
+#define RB_HW_OPT_HAS_LCD		BIT(15)
+#define RB_HW_OPT_HAS_POE_OUT		BIT(16)
+#define RB_HW_OPT_HAS_uSD		BIT(17)
+#define RB_HW_OPT_HAS_SFP		BIT(20)
+#define RB_HW_OPT_HAS_WIFI		BIT(21)
+#define RB_HW_OPT_HAS_TS_FOR_ADC	BIT(22)
+#define RB_HW_OPT_HAS_PLC		BIT(29)
+
+static inline bool
+rb_hw_option_match(const struct rb_info *info, u32 mask, u32 val)
+{
+	return (info->hw_options & (val | mask)) == val;
+}
+
+static inline bool
+rb_has_hw_option(const struct rb_info *info, u32 mask)
+{
+	return rb_hw_option_match(info, mask, mask);
+}
+
 #ifdef CONFIG_ATH79_ROUTERBOOT
 const struct rb_info *rb_init_info(void *data, unsigned int size);
 void *rb_get_wlan_data(void);



More information about the lede-commits mailing list