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> 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)) 24171bb2f1SJohn Crispin #define ltq_cgu_w32(x, y) ltq_w32((x), ltq_cgu_membase + (y)) 25171bb2f1SJohn Crispin #define ltq_cgu_r32(x) ltq_r32(ltq_cgu_membase + (x)) 26171bb2f1SJohn Crispin 27171bb2f1SJohn Crispin extern __iomem void *ltq_ebu_membase; 28171bb2f1SJohn Crispin extern __iomem void *ltq_cgu_membase; 29171bb2f1SJohn Crispin 30171bb2f1SJohn Crispin extern unsigned int ltq_get_cpu_ver(void); 31171bb2f1SJohn Crispin extern unsigned int ltq_get_soc_type(void); 32171bb2f1SJohn Crispin 33171bb2f1SJohn Crispin /* clock speeds */ 34171bb2f1SJohn Crispin #define CLOCK_60M 60000000 35171bb2f1SJohn Crispin #define CLOCK_83M 83333333 36171bb2f1SJohn Crispin #define CLOCK_111M 111111111 37171bb2f1SJohn Crispin #define CLOCK_133M 133333333 38171bb2f1SJohn Crispin #define CLOCK_167M 166666667 39171bb2f1SJohn Crispin #define CLOCK_200M 200000000 40171bb2f1SJohn Crispin #define CLOCK_266M 266666666 41171bb2f1SJohn Crispin #define CLOCK_333M 333333333 42171bb2f1SJohn Crispin #define CLOCK_400M 400000000 43171bb2f1SJohn Crispin 44171bb2f1SJohn Crispin /* spinlock all ebu i/o */ 45171bb2f1SJohn Crispin extern spinlock_t ebu_lock; 46171bb2f1SJohn Crispin 47171bb2f1SJohn Crispin /* some irq helpers */ 48171bb2f1SJohn Crispin extern void ltq_disable_irq(struct irq_data *data); 49171bb2f1SJohn Crispin extern void ltq_mask_and_ack_irq(struct irq_data *data); 50171bb2f1SJohn Crispin extern void ltq_enable_irq(struct irq_data *data); 516697c693SJohn Crispin /* find out what bootsource we have */ 526697c693SJohn Crispin extern unsigned char ltq_boot_select(void); 53171bb2f1SJohn Crispin /* find out what caused the last cpu reset */ 54171bb2f1SJohn Crispin extern int ltq_reset_cause(void); 55171bb2f1SJohn Crispin #define LTQ_RST_CAUSE_WDTRST 0x20 56171bb2f1SJohn Crispin 57171bb2f1SJohn Crispin #define IOPORT_RESOURCE_START 0x10000000 58171bb2f1SJohn Crispin #define IOPORT_RESOURCE_END 0xffffffff 59171bb2f1SJohn Crispin #define IOMEM_RESOURCE_START 0x10000000 60171bb2f1SJohn Crispin #define IOMEM_RESOURCE_END 0xffffffff 61171bb2f1SJohn Crispin #define LTQ_FLASH_START 0x10000000 62171bb2f1SJohn Crispin #define LTQ_FLASH_MAX 0x04000000 63171bb2f1SJohn Crispin 64171bb2f1SJohn Crispin #endif 65