18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Ralink SoC register definitions 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2013 John Crispin <john@phrozen.org> 68c2ecf20Sopenharmony_ci * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> 78c2ecf20Sopenharmony_ci * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifndef _RALINK_REGS_H_ 118c2ecf20Sopenharmony_ci#define _RALINK_REGS_H_ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/io.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cienum ralink_soc_type { 168c2ecf20Sopenharmony_ci RALINK_UNKNOWN = 0, 178c2ecf20Sopenharmony_ci RT2880_SOC, 188c2ecf20Sopenharmony_ci RT3883_SOC, 198c2ecf20Sopenharmony_ci RT305X_SOC_RT3050, 208c2ecf20Sopenharmony_ci RT305X_SOC_RT3052, 218c2ecf20Sopenharmony_ci RT305X_SOC_RT3350, 228c2ecf20Sopenharmony_ci RT305X_SOC_RT3352, 238c2ecf20Sopenharmony_ci RT305X_SOC_RT5350, 248c2ecf20Sopenharmony_ci MT762X_SOC_MT7620A, 258c2ecf20Sopenharmony_ci MT762X_SOC_MT7620N, 268c2ecf20Sopenharmony_ci MT762X_SOC_MT7621AT, 278c2ecf20Sopenharmony_ci MT762X_SOC_MT7628AN, 288c2ecf20Sopenharmony_ci MT762X_SOC_MT7688, 298c2ecf20Sopenharmony_ci}; 308c2ecf20Sopenharmony_ciextern enum ralink_soc_type ralink_soc; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciextern __iomem void *rt_sysc_membase; 338c2ecf20Sopenharmony_ciextern __iomem void *rt_memc_membase; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistatic inline void rt_sysc_w32(u32 val, unsigned reg) 368c2ecf20Sopenharmony_ci{ 378c2ecf20Sopenharmony_ci __raw_writel(val, rt_sysc_membase + reg); 388c2ecf20Sopenharmony_ci} 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_cistatic inline u32 rt_sysc_r32(unsigned reg) 418c2ecf20Sopenharmony_ci{ 428c2ecf20Sopenharmony_ci return __raw_readl(rt_sysc_membase + reg); 438c2ecf20Sopenharmony_ci} 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistatic inline void rt_sysc_m32(u32 clr, u32 set, unsigned reg) 468c2ecf20Sopenharmony_ci{ 478c2ecf20Sopenharmony_ci u32 val = rt_sysc_r32(reg) & ~clr; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci __raw_writel(val | set, rt_sysc_membase + reg); 508c2ecf20Sopenharmony_ci} 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_cistatic inline void rt_memc_w32(u32 val, unsigned reg) 538c2ecf20Sopenharmony_ci{ 548c2ecf20Sopenharmony_ci __raw_writel(val, rt_memc_membase + reg); 558c2ecf20Sopenharmony_ci} 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_cistatic inline u32 rt_memc_r32(unsigned reg) 588c2ecf20Sopenharmony_ci{ 598c2ecf20Sopenharmony_ci return __raw_readl(rt_memc_membase + reg); 608c2ecf20Sopenharmony_ci} 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#endif /* _RALINK_REGS_H_ */ 63