1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2171bb2f1SJohn Crispin /* 3171bb2f1SJohn Crispin * 497b92108SJohn Crispin * Copyright (C) 2010 John Crispin <john@phrozen.org> 5171bb2f1SJohn Crispin */ 6171bb2f1SJohn Crispin #ifndef _LANTIQ_H__ 7171bb2f1SJohn Crispin #define _LANTIQ_H__ 8171bb2f1SJohn Crispin 9171bb2f1SJohn Crispin #include <linux/irq.h> 10287e3f3fSJohn Crispin #include <linux/device.h> 11287e3f3fSJohn Crispin #include <linux/clk.h> 12171bb2f1SJohn Crispin 13171bb2f1SJohn Crispin /* generic reg access functions */ 14171bb2f1SJohn Crispin #define ltq_r32(reg) __raw_readl(reg) 15171bb2f1SJohn Crispin #define ltq_w32(val, reg) __raw_writel(val, reg) 16171bb2f1SJohn Crispin #define ltq_w32_mask(clear, set, reg) \ 17171bb2f1SJohn Crispin ltq_w32((ltq_r32(reg) & ~(clear)) | (set), reg) 18171bb2f1SJohn Crispin #define ltq_r8(reg) __raw_readb(reg) 19171bb2f1SJohn Crispin #define ltq_w8(val, reg) __raw_writeb(val, reg) 20171bb2f1SJohn Crispin 21171bb2f1SJohn Crispin /* register access macros for EBU and CGU */ 22171bb2f1SJohn Crispin #define ltq_ebu_w32(x, y) ltq_w32((x), ltq_ebu_membase + (y)) 23171bb2f1SJohn Crispin #define ltq_ebu_r32(x) ltq_r32(ltq_ebu_membase + (x)) 24287e3f3fSJohn Crispin #define ltq_ebu_w32_mask(x, y, z) \ 25287e3f3fSJohn Crispin ltq_w32_mask(x, y, ltq_ebu_membase + (z)) 26171bb2f1SJohn Crispin extern __iomem void *ltq_ebu_membase; 27171bb2f1SJohn Crispin 28171bb2f1SJohn Crispin /* spinlock all ebu i/o */ 29171bb2f1SJohn Crispin extern spinlock_t ebu_lock; 30171bb2f1SJohn Crispin 31171bb2f1SJohn Crispin /* some irq helpers */ 32171bb2f1SJohn Crispin extern void ltq_disable_irq(struct irq_data *data); 33171bb2f1SJohn Crispin extern void ltq_mask_and_ack_irq(struct irq_data *data); 34171bb2f1SJohn Crispin extern void ltq_enable_irq(struct irq_data *data); 3526365625SJohn Crispin extern int ltq_eiu_get_irq(int exin); 36287e3f3fSJohn Crispin 37287e3f3fSJohn Crispin /* clock handling */ 38287e3f3fSJohn Crispin extern int clk_activate(struct clk *clk); 39287e3f3fSJohn Crispin extern void clk_deactivate(struct clk *clk); 40287e3f3fSJohn Crispin extern struct clk *clk_get_cpu(void); 41287e3f3fSJohn Crispin extern struct clk *clk_get_fpi(void); 42287e3f3fSJohn Crispin extern struct clk *clk_get_io(void); 43740c606eSJohn Crispin extern struct clk *clk_get_ppe(void); 44287e3f3fSJohn Crispin 456697c693SJohn Crispin /* find out what bootsource we have */ 466697c693SJohn Crispin extern unsigned char ltq_boot_select(void); 47e8b8ca8cSJohn Crispin /* find out the soc type */ 48e8b8ca8cSJohn Crispin extern int ltq_soc_type(void); 49171bb2f1SJohn Crispin 50171bb2f1SJohn Crispin #define IOPORT_RESOURCE_START 0x10000000 51171bb2f1SJohn Crispin #define IOPORT_RESOURCE_END 0xffffffff 52171bb2f1SJohn Crispin #define IOMEM_RESOURCE_START 0x10000000 53171bb2f1SJohn Crispin #define IOMEM_RESOURCE_END 0xffffffff 54171bb2f1SJohn Crispin 55171bb2f1SJohn Crispin #endif 56