1171bb2f1SJohn Crispin /* 2171bb2f1SJohn Crispin * This program is free software; you can redistribute it and/or modify it 3171bb2f1SJohn Crispin * under the terms of the GNU General Public License version 2 as published 4171bb2f1SJohn Crispin * by the Free Software Foundation. 5171bb2f1SJohn Crispin * 6171bb2f1SJohn Crispin * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7171bb2f1SJohn Crispin */ 8171bb2f1SJohn Crispin #ifndef _LANTIQ_H__ 9171bb2f1SJohn Crispin #define _LANTIQ_H__ 10171bb2f1SJohn Crispin 11171bb2f1SJohn Crispin #include <linux/irq.h> 12287e3f3fSJohn Crispin #include <linux/device.h> 13287e3f3fSJohn Crispin #include <linux/clk.h> 14171bb2f1SJohn Crispin 15171bb2f1SJohn Crispin /* generic reg access functions */ 16171bb2f1SJohn Crispin #define ltq_r32(reg) __raw_readl(reg) 17171bb2f1SJohn Crispin #define ltq_w32(val, reg) __raw_writel(val, reg) 18171bb2f1SJohn Crispin #define ltq_w32_mask(clear, set, reg) \ 19171bb2f1SJohn Crispin ltq_w32((ltq_r32(reg) & ~(clear)) | (set), reg) 20171bb2f1SJohn Crispin #define ltq_r8(reg) __raw_readb(reg) 21171bb2f1SJohn Crispin #define ltq_w8(val, reg) __raw_writeb(val, reg) 22171bb2f1SJohn Crispin 23171bb2f1SJohn Crispin /* register access macros for EBU and CGU */ 24171bb2f1SJohn Crispin #define ltq_ebu_w32(x, y) ltq_w32((x), ltq_ebu_membase + (y)) 25171bb2f1SJohn Crispin #define ltq_ebu_r32(x) ltq_r32(ltq_ebu_membase + (x)) 26287e3f3fSJohn Crispin #define ltq_ebu_w32_mask(x, y, z) \ 27287e3f3fSJohn Crispin ltq_w32_mask(x, y, ltq_ebu_membase + (z)) 28171bb2f1SJohn Crispin extern __iomem void *ltq_ebu_membase; 29171bb2f1SJohn Crispin 30171bb2f1SJohn Crispin /* spinlock all ebu i/o */ 31171bb2f1SJohn Crispin extern spinlock_t ebu_lock; 32171bb2f1SJohn Crispin 33171bb2f1SJohn Crispin /* some irq helpers */ 34171bb2f1SJohn Crispin extern void ltq_disable_irq(struct irq_data *data); 35171bb2f1SJohn Crispin extern void ltq_mask_and_ack_irq(struct irq_data *data); 36171bb2f1SJohn Crispin extern void ltq_enable_irq(struct irq_data *data); 37287e3f3fSJohn Crispin 38287e3f3fSJohn Crispin /* clock handling */ 39287e3f3fSJohn Crispin extern int clk_activate(struct clk *clk); 40287e3f3fSJohn Crispin extern void clk_deactivate(struct clk *clk); 41287e3f3fSJohn Crispin extern struct clk *clk_get_cpu(void); 42287e3f3fSJohn Crispin extern struct clk *clk_get_fpi(void); 43287e3f3fSJohn Crispin extern struct clk *clk_get_io(void); 44740c606eSJohn Crispin extern struct clk *clk_get_ppe(void); 45287e3f3fSJohn Crispin 466697c693SJohn Crispin /* find out what bootsource we have */ 476697c693SJohn Crispin extern unsigned char ltq_boot_select(void); 48171bb2f1SJohn Crispin /* find out what caused the last cpu reset */ 49171bb2f1SJohn Crispin extern int ltq_reset_cause(void); 50171bb2f1SJohn Crispin 51171bb2f1SJohn Crispin #define IOPORT_RESOURCE_START 0x10000000 52171bb2f1SJohn Crispin #define IOPORT_RESOURCE_END 0xffffffff 53171bb2f1SJohn Crispin #define IOMEM_RESOURCE_START 0x10000000 54171bb2f1SJohn Crispin #define IOMEM_RESOURCE_END 0xffffffff 55171bb2f1SJohn Crispin 56171bb2f1SJohn Crispin #endif 57