18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ATH25_DEVICES_H
38c2ecf20Sopenharmony_ci#define __ATH25_DEVICES_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/cpu.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define ATH25_REG_MS(_val, _field)	(((_val) & _field##_M) >> _field##_S)
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define ATH25_IRQ_CPU_CLOCK	(MIPS_CPU_IRQ_BASE + 7)	/* C0_CAUSE: 0x8000 */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cienum ath25_soc_type {
128c2ecf20Sopenharmony_ci	/* handled by ar5312.c */
138c2ecf20Sopenharmony_ci	ATH25_SOC_AR2312,
148c2ecf20Sopenharmony_ci	ATH25_SOC_AR2313,
158c2ecf20Sopenharmony_ci	ATH25_SOC_AR5312,
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci	/* handled by ar2315.c */
188c2ecf20Sopenharmony_ci	ATH25_SOC_AR2315,
198c2ecf20Sopenharmony_ci	ATH25_SOC_AR2316,
208c2ecf20Sopenharmony_ci	ATH25_SOC_AR2317,
218c2ecf20Sopenharmony_ci	ATH25_SOC_AR2318,
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	ATH25_SOC_UNKNOWN
248c2ecf20Sopenharmony_ci};
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciextern enum ath25_soc_type ath25_soc;
278c2ecf20Sopenharmony_ciextern struct ar231x_board_config ath25_board;
288c2ecf20Sopenharmony_ciextern void (*ath25_irq_dispatch)(void);
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciint ath25_find_config(phys_addr_t offset, unsigned long size);
318c2ecf20Sopenharmony_civoid ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk);
328c2ecf20Sopenharmony_ciint ath25_add_wmac(int nr, u32 base, int irq);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic inline bool is_ar2315(void)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	return (current_cpu_data.cputype == CPU_4KEC);
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistatic inline bool is_ar5312(void)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	return !is_ar2315();
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#endif
45