diff options
Diffstat (limited to 'arch/blackfin/include/asm')
118 files changed, 2837 insertions, 2129 deletions
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild index 9e7c5379d3f..0d93b9a79ca 100644 --- a/arch/blackfin/include/asm/Kbuild +++ b/arch/blackfin/include/asm/Kbuild @@ -1,5 +1,49 @@ -include include/asm-generic/Kbuild.asm -header-y += bfin_sport.h -header-y += cachectl.h -header-y += fixed_code.h +generic-y += auxvec.h +generic-y += bitsperlong.h +generic-y += bugs.h +generic-y += cputime.h +generic-y += current.h +generic-y += device.h +generic-y += div64.h +generic-y += emergency-restart.h +generic-y += errno.h +generic-y += fb.h +generic-y += futex.h +generic-y += hash.h +generic-y += hw_irq.h +generic-y += ioctl.h +generic-y += ipcbuf.h +generic-y += irq_regs.h +generic-y += kdebug.h +generic-y += kmap_types.h +generic-y += kvm_para.h +generic-y += local.h +generic-y += local64.h +generic-y += mcs_spinlock.h +generic-y += mman.h +generic-y += msgbuf.h +generic-y += mutex.h +generic-y += param.h +generic-y += percpu.h +generic-y += pgalloc.h +generic-y += preempt.h +generic-y += resource.h +generic-y += scatterlist.h +generic-y += sembuf.h +generic-y += serial.h +generic-y += setup.h +generic-y += shmbuf.h +generic-y += shmparam.h +generic-y += socket.h +generic-y += sockios.h +generic-y += statfs.h +generic-y += termbits.h +generic-y += termios.h +generic-y += topology.h +generic-y += trace_clock.h +generic-y += types.h +generic-y += ucontext.h +generic-y += unaligned.h +generic-y += user.h +generic-y += xor.h diff --git a/arch/blackfin/include/asm/atomic.h b/arch/blackfin/include/asm/atomic.h index d27c6274247..a107a98e997 100644 --- a/arch/blackfin/include/asm/atomic.h +++ b/arch/blackfin/include/asm/atomic.h @@ -1,124 +1,37 @@  /* - * Copyright 2004-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ + * Copyright 2004-2011 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */  #ifndef __ARCH_BLACKFIN_ATOMIC__  #define __ARCH_BLACKFIN_ATOMIC__ -#ifndef CONFIG_SMP -# include <asm-generic/atomic.h> -#else - -#include <linux/types.h> -#include <asm/system.h>	/* local_irq_XXX() */ - -/* - * Atomic operations that C can't guarantee us.  Useful for - * resource counting etc.. - */ +#include <asm/cmpxchg.h> -#define ATOMIC_INIT(i)	{ (i) } -#define atomic_set(v, i)	(((v)->counter) = i) +#ifdef CONFIG_SMP -#define atomic_read(v)	__raw_uncached_fetch_asm(&(v)->counter) +#include <asm/barrier.h> +#include <linux/linkage.h> +#include <linux/types.h>  asmlinkage int __raw_uncached_fetch_asm(const volatile int *ptr); -  asmlinkage int __raw_atomic_update_asm(volatile int *ptr, int value); -  asmlinkage int __raw_atomic_clear_asm(volatile int *ptr, int value); -  asmlinkage int __raw_atomic_set_asm(volatile int *ptr, int value); -  asmlinkage int __raw_atomic_xor_asm(volatile int *ptr, int value); -  asmlinkage int __raw_atomic_test_asm(const volatile int *ptr, int value); -static inline void atomic_add(int i, atomic_t *v) -{ -	__raw_atomic_update_asm(&v->counter, i); -} - -static inline void atomic_sub(int i, atomic_t *v) -{ -	__raw_atomic_update_asm(&v->counter, -i); -} - -static inline int atomic_add_return(int i, atomic_t *v) -{ -	return __raw_atomic_update_asm(&v->counter, i); -} +#define atomic_read(v) __raw_uncached_fetch_asm(&(v)->counter) -static inline int atomic_sub_return(int i, atomic_t *v) -{ -	return __raw_atomic_update_asm(&v->counter, -i); -} +#define atomic_add_return(i, v) __raw_atomic_update_asm(&(v)->counter, i) +#define atomic_sub_return(i, v) __raw_atomic_update_asm(&(v)->counter, -(i)) -static inline void atomic_inc(volatile atomic_t *v) -{ -	__raw_atomic_update_asm(&v->counter, 1); -} - -static inline void atomic_dec(volatile atomic_t *v) -{ -	__raw_atomic_update_asm(&v->counter, -1); -} - -static inline void atomic_clear_mask(int mask, atomic_t *v) -{ -	__raw_atomic_clear_asm(&v->counter, mask); -} - -static inline void atomic_set_mask(int mask, atomic_t *v) -{ -	__raw_atomic_set_asm(&v->counter, mask); -} - -static inline int atomic_test_mask(int mask, atomic_t *v) -{ -	return __raw_atomic_test_asm(&v->counter, mask); -} - -/* Atomic operations are already serializing */ -#define smp_mb__before_atomic_dec()    barrier() -#define smp_mb__after_atomic_dec() barrier() -#define smp_mb__before_atomic_inc()    barrier() -#define smp_mb__after_atomic_inc() barrier() - -#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0) -#define atomic_dec_return(v) atomic_sub_return(1,(v)) -#define atomic_inc_return(v) atomic_add_return(1,(v)) - -#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) -#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) - -#define atomic_add_unless(v, a, u)				\ -({								\ -	int c, old;						\ -	c = atomic_read(v);					\ -	while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ -		c = old;					\ -	c != (u);						\ -}) -#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) - -/* - * atomic_inc_and_test - increment and test - * @v: pointer of type atomic_t - * - * Atomically increments @v by 1 - * and returns true if the result is zero, or false for all - * other cases. - */ -#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) - -#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) -#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) - -#include <asm-generic/atomic-long.h> +#define atomic_clear_mask(m, v) __raw_atomic_clear_asm(&(v)->counter, m) +#define atomic_set_mask(m, v)   __raw_atomic_set_asm(&(v)->counter, m)  #endif +#include <asm-generic/atomic.h> +  #endif diff --git a/arch/blackfin/include/asm/auxvec.h b/arch/blackfin/include/asm/auxvec.h deleted file mode 100644 index 41fa68b7128..00000000000 --- a/arch/blackfin/include/asm/auxvec.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/auxvec.h> diff --git a/arch/blackfin/include/asm/barrier.h b/arch/blackfin/include/asm/barrier.h new file mode 100644 index 00000000000..42000687799 --- /dev/null +++ b/arch/blackfin/include/asm/barrier.h @@ -0,0 +1,35 @@ +/* + * Copyright 2004-2009 Analog Devices Inc. + *               Tony Kou (tonyko@lineo.ca) + * + * Licensed under the GPL-2 or later + */ + +#ifndef _BLACKFIN_BARRIER_H +#define _BLACKFIN_BARRIER_H + +#include <asm/cache.h> + +#define nop()  __asm__ __volatile__ ("nop;\n\t" : : ) + +/* + * Force strict CPU ordering. + */ +#ifdef CONFIG_SMP + +#ifdef __ARCH_SYNC_CORE_DCACHE +/* Force Core data cache coherence */ +# define mb()	do { barrier(); smp_check_barrier(); smp_mark_barrier(); } while (0) +# define rmb()	do { barrier(); smp_check_barrier(); } while (0) +# define wmb()	do { barrier(); smp_mark_barrier(); } while (0) +# define read_barrier_depends()	do { barrier(); smp_check_barrier(); } while (0) +#endif + +#endif /* !CONFIG_SMP */ + +#define smp_mb__before_atomic()	barrier() +#define smp_mb__after_atomic()	barrier() + +#include <asm-generic/barrier.h> + +#endif /* _BLACKFIN_BARRIER_H */ diff --git a/arch/blackfin/include/asm/bfin-global.h b/arch/blackfin/include/asm/bfin-global.h index 121cc04d877..dc47d79287f 100644 --- a/arch/blackfin/include/asm/bfin-global.h +++ b/arch/blackfin/include/asm/bfin-global.h @@ -14,7 +14,13 @@  #include <linux/linkage.h>  #include <linux/types.h> -#if defined(CONFIG_DMA_UNCACHED_4M) +#if defined(CONFIG_DMA_UNCACHED_32M) +# define DMA_UNCACHED_REGION (32 * 1024 * 1024) +#elif defined(CONFIG_DMA_UNCACHED_16M) +# define DMA_UNCACHED_REGION (16 * 1024 * 1024) +#elif defined(CONFIG_DMA_UNCACHED_8M) +# define DMA_UNCACHED_REGION (8 * 1024 * 1024) +#elif defined(CONFIG_DMA_UNCACHED_4M)  # define DMA_UNCACHED_REGION (4 * 1024 * 1024)  #elif defined(CONFIG_DMA_UNCACHED_2M)  # define DMA_UNCACHED_REGION (2 * 1024 * 1024) @@ -35,6 +41,11 @@ extern void bfin_setup_cpudata(unsigned int cpu);  extern unsigned long get_cclk(void);  extern unsigned long get_sclk(void); +#ifdef CONFIG_BF60x +extern unsigned long get_sclk0(void); +extern unsigned long get_sclk1(void); +extern unsigned long get_dclk(void); +#endif  extern unsigned long sclk_to_usecs(unsigned long sclk);  extern unsigned long usecs_to_sclk(unsigned long usecs); @@ -49,16 +60,6 @@ extern void dump_bfin_trace_buffer(void);  #define dump_bfin_trace_buffer()  #endif -/* init functions only */ -extern int init_arch_irq(void); -extern void init_exception_vectors(void); -extern void program_IAR(void); - -extern asmlinkage void lower_to_irq14(void); -extern asmlinkage void bfin_return_from_exception(void); -extern asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs); -extern int bfin_internal_set_wake(unsigned int irq, unsigned int state); -  extern void *l1_data_A_sram_alloc(size_t);  extern void *l1_data_B_sram_alloc(size_t);  extern void *l1_inst_sram_alloc(size_t); diff --git a/arch/blackfin/include/asm/bfin5xx_spi.h b/arch/blackfin/include/asm/bfin5xx_spi.h index 5392583d025..fb95c853bb1 100644 --- a/arch/blackfin/include/asm/bfin5xx_spi.h +++ b/arch/blackfin/include/asm/bfin5xx_spi.h @@ -77,7 +77,6 @@ struct bfin5xx_spi_master {  struct bfin5xx_spi_chip {  	u16 ctl_reg;  	u8 enable_dma; -	u8 bits_per_word;  	u16 cs_chg_udelay; /* Some devices require 16-bit delays */  	/* Value to send if no TX value is supplied, usually 0x0 or 0xFFFF */  	u16 idle_tx_val; diff --git a/arch/blackfin/include/asm/bfin_dma.h b/arch/blackfin/include/asm/bfin_dma.h new file mode 100644 index 00000000000..6319f4e4908 --- /dev/null +++ b/arch/blackfin/include/asm/bfin_dma.h @@ -0,0 +1,165 @@ +/* + * bfin_dma.h - Blackfin DMA defines/structures/etc... + * + * Copyright 2004-2010 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#ifndef __ASM_BFIN_DMA_H__ +#define __ASM_BFIN_DMA_H__ + +#include <linux/types.h> + +/* DMA_CONFIG Masks */ +#define DMAEN			0x0001	/* DMA Channel Enable */ +#define WNR				0x0002	/* Channel Direction (W/R*) */ +#define WDSIZE_8		0x0000	/* Transfer Word Size = 8 */ +#define PSIZE_8			0x00000000	/* Transfer Word Size = 16 */ + +#ifdef CONFIG_BF60x + +#define PSIZE_16		0x00000010	/* Transfer Word Size = 16 */ +#define PSIZE_32		0x00000020	/* Transfer Word Size = 32 */ +#define PSIZE_64		0x00000030	/* Transfer Word Size = 32 */ +#define WDSIZE_16		0x00000100	/* Transfer Word Size = 16 */ +#define WDSIZE_32		0x00000200	/* Transfer Word Size = 32 */ +#define WDSIZE_64		0x00000300	/* Transfer Word Size = 32 */ +#define WDSIZE_128		0x00000400	/* Transfer Word Size = 32 */ +#define WDSIZE_256		0x00000500	/* Transfer Word Size = 32 */ +#define DMA2D			0x04000000	/* DMA Mode (2D/1D*) */ +#define RESTART			0x00000004	/* DMA Buffer Clear SYNC */ +#define DI_EN_X			0x00100000	/* Data Interrupt Enable in X count */ +#define DI_EN_Y			0x00200000	/* Data Interrupt Enable in Y count */ +#define DI_EN_P			0x00300000	/* Data Interrupt Enable in Peripheral */ +#define DI_EN			DI_EN_X		/* Data Interrupt Enable */ +#define NDSIZE_0		0x00000000	/* Next Descriptor Size = 1 */ +#define NDSIZE_1		0x00010000	/* Next Descriptor Size = 2 */ +#define NDSIZE_2		0x00020000	/* Next Descriptor Size = 3 */ +#define NDSIZE_3		0x00030000	/* Next Descriptor Size = 4 */ +#define NDSIZE_4		0x00040000	/* Next Descriptor Size = 5 */ +#define NDSIZE_5		0x00050000	/* Next Descriptor Size = 6 */ +#define NDSIZE_6		0x00060000	/* Next Descriptor Size = 7 */ +#define NDSIZE			0x00070000	/* Next Descriptor Size */ +#define NDSIZE_OFFSET		16		/* Next Descriptor Size Offset */ +#define DMAFLOW_LIST		0x00004000	/* Descriptor List Mode */ +#define DMAFLOW_LARGE		DMAFLOW_LIST +#define DMAFLOW_ARRAY		0x00005000	/* Descriptor Array Mode */ +#define DMAFLOW_LIST_DEMAND	0x00006000	/* Descriptor Demand List Mode */ +#define DMAFLOW_ARRAY_DEMAND	0x00007000	/* Descriptor Demand Array Mode */ +#define DMA_RUN_DFETCH		0x00000100	/* DMA Channel Running Indicator (DFETCH) */ +#define DMA_RUN			0x00000200	/* DMA Channel Running Indicator */ +#define DMA_RUN_WAIT_TRIG	0x00000300	/* DMA Channel Running Indicator (WAIT TRIG) */ +#define DMA_RUN_WAIT_ACK	0x00000400	/* DMA Channel Running Indicator (WAIT ACK) */ + +#else + +#define PSIZE_16		0x0000	/* Transfer Word Size = 16 */ +#define PSIZE_32		0x0000	/* Transfer Word Size = 32 */ +#define WDSIZE_16		0x0004	/* Transfer Word Size = 16 */ +#define WDSIZE_32		0x0008	/* Transfer Word Size = 32 */ +#define DMA2D			0x0010	/* DMA Mode (2D/1D*) */ +#define RESTART			0x0020	/* DMA Buffer Clear */ +#define DI_SEL			0x0040	/* Data Interrupt Timing Select */ +#define DI_EN			0x0080	/* Data Interrupt Enable */ +#define DI_EN_X			0x00C0	/* Data Interrupt Enable in X count*/ +#define DI_EN_Y			0x0080	/* Data Interrupt Enable in Y count*/ +#define NDSIZE_0		0x0000	/* Next Descriptor Size = 0 (Stop/Autobuffer) */ +#define NDSIZE_1		0x0100	/* Next Descriptor Size = 1 */ +#define NDSIZE_2		0x0200	/* Next Descriptor Size = 2 */ +#define NDSIZE_3		0x0300	/* Next Descriptor Size = 3 */ +#define NDSIZE_4		0x0400	/* Next Descriptor Size = 4 */ +#define NDSIZE_5		0x0500	/* Next Descriptor Size = 5 */ +#define NDSIZE_6		0x0600	/* Next Descriptor Size = 6 */ +#define NDSIZE_7		0x0700	/* Next Descriptor Size = 7 */ +#define NDSIZE_8		0x0800	/* Next Descriptor Size = 8 */ +#define NDSIZE_9		0x0900	/* Next Descriptor Size = 9 */ +#define NDSIZE			0x0f00	/* Next Descriptor Size */ +#define NDSIZE_OFFSET		8	/* Next Descriptor Size Offset */ +#define DMAFLOW_ARRAY	0x4000	/* Descriptor Array Mode */ +#define DMAFLOW_SMALL	0x6000	/* Small Model Descriptor List Mode */ +#define DMAFLOW_LARGE	0x7000	/* Large Model Descriptor List Mode */ +#define DFETCH			0x0004	/* DMA Descriptor Fetch Indicator */ +#define DMA_RUN			0x0008	/* DMA Channel Running Indicator */ + +#endif +#define DMAFLOW			0x7000	/* Flow Control */ +#define DMAFLOW_STOP	0x0000	/* Stop Mode */ +#define DMAFLOW_AUTO	0x1000	/* Autobuffer Mode */ + +/* DMA_IRQ_STATUS Masks */ +#define DMA_DONE		0x0001	/* DMA Completion Interrupt Status */ +#define DMA_ERR			0x0002	/* DMA Error Interrupt Status */ +#ifdef CONFIG_BF60x +#define DMA_PIRQ		0x0004	/* DMA Peripheral Error Interrupt Status */ +#else +#define DMA_PIRQ		0 +#endif + +/* + * All Blackfin system MMRs are padded to 32bits even if the register + * itself is only 16bits.  So use a helper macro to streamline this. + */ +#define __BFP(m) u16 m; u16 __pad_##m + +/* + * bfin dma registers layout + */ +struct bfin_dma_regs { +	u32 next_desc_ptr; +	u32 start_addr; +#ifdef CONFIG_BF60x +	u32 cfg; +	u32 x_count; +	u32 x_modify; +	u32 y_count; +	u32 y_modify; +	u32 pad1; +	u32 pad2; +	u32 curr_desc_ptr; +	u32 prev_desc_ptr; +	u32 curr_addr; +	u32 irq_status; +	u32 curr_x_count; +	u32 curr_y_count; +	u32 pad3; +	u32 bw_limit_count; +	u32 curr_bw_limit_count; +	u32 bw_monitor_count; +	u32 curr_bw_monitor_count; +#else +	__BFP(config); +	u32 __pad0; +	__BFP(x_count); +	__BFP(x_modify); +	__BFP(y_count); +	__BFP(y_modify); +	u32 curr_desc_ptr; +	u32 curr_addr; +	__BFP(irq_status); +	__BFP(peripheral_map); +	__BFP(curr_x_count); +	u32 __pad1; +	__BFP(curr_y_count); +	u32 __pad2; +#endif +}; + +#ifndef CONFIG_BF60x +/* + * bfin handshake mdma registers layout + */ +struct bfin_hmdma_regs { +	__BFP(control); +	__BFP(ecinit); +	__BFP(bcinit); +	__BFP(ecurgent); +	__BFP(ecoverflow); +	__BFP(ecount); +	__BFP(bcount); +}; +#endif + +#undef __BFP + +#endif diff --git a/arch/blackfin/include/asm/bfin_pfmon.h b/arch/blackfin/include/asm/bfin_pfmon.h new file mode 100644 index 00000000000..bf52e1f3225 --- /dev/null +++ b/arch/blackfin/include/asm/bfin_pfmon.h @@ -0,0 +1,44 @@ +/* + * Blackfin Performance Monitor definitions + * + * Copyright 2005-2011 Analog Devices Inc. + * + * Licensed under the Clear BSD license or GPL-2 (or later). + */ + +#ifndef __ASM_BFIN_PFMON_H__ +#define __ASM_BFIN_PFMON_H__ + +/* PFCTL Masks */ +#define PFMON_MASK	0xff +#define PFCEN_MASK	0x3 +#define PFCEN_DISABLE	0x0 +#define PFCEN_ENABLE_USER	0x1 +#define PFCEN_ENABLE_SUPV	0x2 +#define PFCEN_ENABLE_ALL	(PFCEN_ENABLE_USER | PFCEN_ENABLE_SUPV) + +#define PFPWR_P	0 +#define PEMUSW0_P	2 +#define PFCEN0_P	3 +#define PFMON0_P	5 +#define PEMUSW1_P	13 +#define PFCEN1_P	14 +#define PFMON1_P	16 +#define PFCNT0_P	24 +#define PFCNT1_P	25 + +#define PFPWR	(1 << PFPWR_P) +#define PEMUSW(n, x)	((x) << ((n) ? PEMUSW1_P : PEMUSW0_P)) +#define PEMUSW0	PEMUSW(0, 1) +#define PEMUSW1	PEMUSW(1, 1) +#define PFCEN(n, x)	((x) << ((n) ? PFCEN1_P : PFCEN0_P)) +#define PFCEN0	PFCEN(0, PFCEN_MASK) +#define PFCEN1	PFCEN(1, PFCEN_MASK) +#define PFCNT(n, x)	((x) << ((n) ? PFCNT1_P : PFCNT0_P)) +#define PFCNT0	PFCNT(0, 1) +#define PFCNT1	PFCNT(1, 1) +#define PFMON(n, x)	((x) << ((n) ? PFMON1_P : PFMON0_P)) +#define PFMON0	PFMON(0, PFMON_MASK) +#define PFMON1	PFMON(1, PFMON_MASK) + +#endif diff --git a/arch/blackfin/include/asm/bfin_ppi.h b/arch/blackfin/include/asm/bfin_ppi.h index 3be05faa2c6..a4e872e16e7 100644 --- a/arch/blackfin/include/asm/bfin_ppi.h +++ b/arch/blackfin/include/asm/bfin_ppi.h @@ -10,6 +10,7 @@  #define __ASM_BFIN_PPI_H__  #include <linux/types.h> +#include <asm/blackfin.h>  /*   * All Blackfin system MMRs are padded to 32bits even if the register @@ -48,6 +49,133 @@ struct bfin_eppi_regs {  	u32 clip;  }; +/* + * bfin eppi3 registers layout + */ +struct bfin_eppi3_regs { +	u32 stat; +	u32 hcnt; +	u32 hdly; +	u32 vcnt; +	u32 vdly; +	u32 frame; +	u32 line; +	u32 clkdiv; +	u32 ctl; +	u32 fs1_wlhb; +	u32 fs1_paspl; +	u32 fs2_wlvb; +	u32 fs2_palpf; +	u32 imsk; +	u32 oddclip; +	u32 evenclip; +	u32 fs1_dly; +	u32 fs2_dly; +	u32 ctl2; +}; +  #undef __BFP +#ifdef EPPI0_CTL2 +#define EPPI_STAT_CFIFOERR              0x00000001    /* Chroma FIFO Error */ +#define EPPI_STAT_YFIFOERR              0x00000002    /* Luma FIFO Error */ +#define EPPI_STAT_LTERROVR              0x00000004    /* Line Track Overflow */ +#define EPPI_STAT_LTERRUNDR             0x00000008    /* Line Track Underflow */ +#define EPPI_STAT_FTERROVR              0x00000010    /* Frame Track Overflow */ +#define EPPI_STAT_FTERRUNDR             0x00000020    /* Frame Track Underflow */ +#define EPPI_STAT_ERRNCOR               0x00000040    /* Preamble Error Not Corrected */ +#define EPPI_STAT_PXPERR                0x00000080    /* PxP Ready Error */ +#define EPPI_STAT_ERRDET                0x00004000    /* Preamble Error Detected */ +#define EPPI_STAT_FLD                   0x00008000    /* Current Field Received by EPPI */ + +#define EPPI_HCNT_VALUE                 0x0000FFFF    /* Holds the number of samples to read in or write out per line, after PPIx_HDLY number of cycles have expired since the last assertion of PPIx_FS1 */ + +#define EPPI_HDLY_VALUE                 0x0000FFFF    /* Number of PPIx_CLK cycles to delay after assertion of PPIx_FS1 before starting to read or write data */ + +#define EPPI_VCNT_VALUE                 0x0000FFFF    /* Holds the number of lines to read in or write out, after PPIx_VDLY number of lines from the start of frame */ + +#define EPPI_VDLY_VALUE                 0x0000FFFF    /* Number of lines to wait after the start of a new frame before starting to read/transmit data */ + +#define EPPI_FRAME_VALUE                0x0000FFFF    /* Holds the number of lines expected per frame of data */ + +#define EPPI_LINE_VALUE                 0x0000FFFF    /* Holds the number of samples expected per line */ + +#define EPPI_CLKDIV_VALUE               0x0000FFFF    /* Internal clock divider */ + +#define EPPI_CTL_EN                     0x00000001    /* PPI Enable */ +#define EPPI_CTL_DIR                    0x00000002    /* PPI Direction */ +#define EPPI_CTL_XFRTYPE                0x0000000C    /* PPI Operating Mode */ +#define EPPI_CTL_ACTIVE656              0x00000000    /* XFRTYPE: ITU656 Active Video Only Mode */ +#define EPPI_CTL_ENTIRE656              0x00000004    /* XFRTYPE: ITU656 Entire Field Mode */ +#define EPPI_CTL_VERT656                0x00000008    /* XFRTYPE: ITU656 Vertical Blanking Only Mode */ +#define EPPI_CTL_NON656                 0x0000000C    /* XFRTYPE: Non-ITU656 Mode (GP Mode) */ +#define EPPI_CTL_FSCFG                  0x00000030    /* Frame Sync Configuration */ +#define EPPI_CTL_SYNC0                  0x00000000    /* FSCFG: Sync Mode 0 */ +#define EPPI_CTL_SYNC1                  0x00000010    /* FSCFG: Sync Mode 1 */ +#define EPPI_CTL_SYNC2                  0x00000020    /* FSCFG: Sync Mode 2 */ +#define EPPI_CTL_SYNC3                  0x00000030    /* FSCFG: Sync Mode 3 */ +#define EPPI_CTL_FLDSEL                 0x00000040    /* Field Select/Trigger */ +#define EPPI_CTL_ITUTYPE                0x00000080    /* ITU Interlace or Progressive */ +#define EPPI_CTL_BLANKGEN               0x00000100    /* ITU Output Mode with Internal Blanking Generation */ +#define EPPI_CTL_ICLKGEN                0x00000200    /* Internal Clock Generation */ +#define EPPI_CTL_IFSGEN                 0x00000400    /* Internal Frame Sync Generation */ +#define EPPI_CTL_SIGNEXT                0x00000800    /* Sign Extension */ +#define EPPI_CTL_POLC                   0x00003000    /* Frame Sync and Data Driving and Sampling Edges */ +#define EPPI_CTL_POLC0                  0x00000000    /* POLC: Clock/Sync polarity mode 0 */ +#define EPPI_CTL_POLC1                  0x00001000    /* POLC: Clock/Sync polarity mode 1 */ +#define EPPI_CTL_POLC2                  0x00002000    /* POLC: Clock/Sync polarity mode 2 */ +#define EPPI_CTL_POLC3                  0x00003000    /* POLC: Clock/Sync polarity mode 3 */ +#define EPPI_CTL_POLS                   0x0000C000    /* Frame Sync Polarity */ +#define EPPI_CTL_FS1HI_FS2HI            0x00000000    /* POLS: FS1 and FS2 are active high */ +#define EPPI_CTL_FS1LO_FS2HI            0x00004000    /* POLS: FS1 is active low. FS2 is active high */ +#define EPPI_CTL_FS1HI_FS2LO            0x00008000    /* POLS: FS1 is active high. FS2 is active low */ +#define EPPI_CTL_FS1LO_FS2LO            0x0000C000    /* POLS: FS1 and FS2 are active low */ +#define EPPI_CTL_DLEN                   0x00070000    /* Data Length */ +#define EPPI_CTL_DLEN08                 0x00000000    /* DLEN: 8 bits */ +#define EPPI_CTL_DLEN10                 0x00010000    /* DLEN: 10 bits */ +#define EPPI_CTL_DLEN12                 0x00020000    /* DLEN: 12 bits */ +#define EPPI_CTL_DLEN14                 0x00030000    /* DLEN: 14 bits */ +#define EPPI_CTL_DLEN16                 0x00040000    /* DLEN: 16 bits */ +#define EPPI_CTL_DLEN18                 0x00050000    /* DLEN: 18 bits */ +#define EPPI_CTL_DLEN20                 0x00060000    /* DLEN: 20 bits */ +#define EPPI_CTL_DLEN24                 0x00070000    /* DLEN: 24 bits */ +#define EPPI_CTL_DMIRR                  0x00080000    /* Data Mirroring */ +#define EPPI_CTL_SKIPEN                 0x00100000    /* Skip Enable */ +#define EPPI_CTL_SKIPEO                 0x00200000    /* Skip Even or Odd */ +#define EPPI_CTL_PACKEN                 0x00400000    /* Pack/Unpack Enable */ +#define EPPI_CTL_SWAPEN                 0x00800000    /* Swap Enable */ +#define EPPI_CTL_SPLTEO                 0x01000000    /* Split Even and Odd Data Samples */ +#define EPPI_CTL_SUBSPLTODD             0x02000000    /* Sub-Split Odd Samples */ +#define EPPI_CTL_SPLTWRD                0x04000000    /* Split Word */ +#define EPPI_CTL_RGBFMTEN               0x08000000    /* RGB Formatting Enable */ +#define EPPI_CTL_DMACFG                 0x10000000    /* One or Two DMA Channels Mode */ +#define EPPI_CTL_DMAFINEN               0x20000000    /* DMA Finish Enable */ +#define EPPI_CTL_MUXSEL                 0x40000000    /* MUX Select */ +#define EPPI_CTL_CLKGATEN               0x80000000    /* Clock Gating Enable */ + +#define EPPI_FS2_WLVB_F2VBAD            0xFF000000    /* In GP transmit mode with BLANKGEN = 1, contains number of lines of vertical blanking after field 2 */ +#define EPPI_FS2_WLVB_F2VBBD            0x00FF0000    /* In GP transmit mode with BLANKGEN = 1, contains number of lines of vertical blanking before field 2 */ +#define EPPI_FS2_WLVB_F1VBAD            0x0000FF00    /* In GP transmit mode with, BLANKGEN = 1, contains number of lines of vertical blanking after field 1 */ +#define EPPI_FS2_WLVB_F1VBBD            0x000000FF    /* In GP 2, or 3 FS modes used to generate PPIx_FS2 width (32-bit). In GP Transmit mode, with BLANKGEN=1, contains the number of lines of Vertical blanking before field 1. */ + +#define EPPI_FS2_PALPF_F2ACT            0xFFFF0000    /* Number of lines of Active Data in Field 2 */ +#define EPPI_FS2_PALPF_F1ACT            0x0000FFFF    /* Number of lines of Active Data in Field 1 */ + +#define EPPI_IMSK_CFIFOERR              0x00000001    /* Mask CFIFO Underflow or Overflow Error Interrupt */ +#define EPPI_IMSK_YFIFOERR              0x00000002    /* Mask YFIFO Underflow or Overflow Error Interrupt */ +#define EPPI_IMSK_LTERROVR              0x00000004    /* Mask Line Track Overflow Error Interrupt */ +#define EPPI_IMSK_LTERRUNDR             0x00000008    /* Mask Line Track Underflow Error Interrupt */ +#define EPPI_IMSK_FTERROVR              0x00000010    /* Mask Frame Track Overflow Error Interrupt */ +#define EPPI_IMSK_FTERRUNDR             0x00000020    /* Mask Frame Track Underflow Error Interrupt */ +#define EPPI_IMSK_ERRNCOR               0x00000040    /* Mask ITU Preamble Error Not Corrected Interrupt */ +#define EPPI_IMSK_PXPERR                0x00000080    /* Mask PxP Ready Error Interrupt */ + +#define EPPI_ODDCLIP_HIGHODD            0xFFFF0000 +#define EPPI_ODDCLIP_LOWODD             0x0000FFFF + +#define EPPI_EVENCLIP_HIGHEVEN          0xFFFF0000 +#define EPPI_EVENCLIP_LOWEVEN           0x0000FFFF + +#define EPPI_CTL2_FS1FINEN              0x00000002    /* HSYNC Finish Enable */ +#endif  #endif diff --git a/arch/blackfin/include/asm/bfin_rotary.h b/arch/blackfin/include/asm/bfin_rotary.h index 0b6910bdc57..8895a750c70 100644 --- a/arch/blackfin/include/asm/bfin_rotary.h +++ b/arch/blackfin/include/asm/bfin_rotary.h @@ -39,6 +39,7 @@ struct bfin_rotary_platform_data {  	unsigned int rotary_rel_code;  	unsigned short debounce;	/* 0..17 */  	unsigned short mode; +	unsigned short pm_wakeup;  };  /* CNT_CONFIG bitmasks */ diff --git a/arch/blackfin/include/asm/bfin_sdh.h b/arch/blackfin/include/asm/bfin_sdh.h index 6a4cfe2d336..a99957ea9e9 100644 --- a/arch/blackfin/include/asm/bfin_sdh.h +++ b/arch/blackfin/include/asm/bfin_sdh.h @@ -24,18 +24,27 @@ struct bfin_sd_host {  #define CMD_INT_E          (1 << 8)    /* Command Interrupt */  #define CMD_PEND_E         (1 << 9)    /* Command Pending */  #define CMD_E              (1 << 10)   /* Command Enable */ +#ifdef RSI_BLKSZ +#define CMD_CRC_CHECK_D    (1 << 11)   /* CRC Check is disabled */ +#define CMD_DATA0_BUSY     (1 << 12)   /* Check for Busy State on the DATA0 pin */ +#endif  /* SDH_PWR_CTL bitmasks */ +#ifndef RSI_BLKSZ  #define PWR_ON             0x3         /* Power On */  #define SD_CMD_OD          (1 << 6)    /* Open Drain Output */  #define ROD_CTL            (1 << 7)    /* Rod Control */ +#endif  /* SDH_CLK_CTL bitmasks */  #define CLKDIV             0xff        /* MC_CLK Divisor */  #define CLK_E              (1 << 8)    /* MC_CLK Bus Clock Enable */  #define PWR_SV_E           (1 << 9)    /* Power Save Enable */  #define CLKDIV_BYPASS      (1 << 10)   /* Bypass Divisor */ -#define WIDE_BUS           (1 << 11)   /* Wide Bus Mode Enable */ +#define BUS_MODE_MASK      0x1800      /* Bus Mode Mask */ +#define STD_BUS_1          0x000       /* Standard Bus 1 bit mode */ +#define WIDE_BUS_4         0x800       /* Wide Bus 4 bit mode */ +#define BYTE_BUS_8         0x1000      /* Byte Bus 8 bit mode */  /* SDH_RESP_CMD bitmasks */  #define RESP_CMD           0x3f        /* Response Command */ @@ -45,7 +54,13 @@ struct bfin_sd_host {  #define DTX_DIR            (1 << 1)    /* Data Transfer Direction */  #define DTX_MODE           (1 << 2)    /* Data Transfer Mode */  #define DTX_DMA_E          (1 << 3)    /* Data Transfer DMA Enable */ +#ifndef RSI_BLKSZ  #define DTX_BLK_LGTH       (0xf << 4)  /* Data Transfer Block Length */ +#else + +/* Bit masks for SDH_BLK_SIZE */ +#define DTX_BLK_LGTH       0x1fff      /* Data Transfer Block Length */ +#endif  /* SDH_STATUS bitmasks */  #define CMD_CRC_FAIL       (1 << 0)    /* CMD CRC Fail */ @@ -114,10 +129,14 @@ struct bfin_sd_host {  /* SDH_E_STATUS bitmasks */  #define SDIO_INT_DET       (1 << 1)    /* SDIO Int Detected */  #define SD_CARD_DET        (1 << 4)    /* SD Card Detect */ +#define SD_CARD_BUSYMODE   (1 << 31)   /* Card is in Busy mode */ +#define SD_CARD_SLPMODE    (1 << 30)   /* Card in Sleep Mode */ +#define SD_CARD_READY      (1 << 17)   /* Card Ready */  /* SDH_E_MASK bitmasks */  #define SDIO_MSK           (1 << 1)    /* Mask SDIO Int Detected */ -#define SCD_MSK            (1 << 6)    /* Mask Card Detect */ +#define SCD_MSK            (1 << 4)    /* Mask Card Detect */ +#define CARD_READY_MSK     (1 << 16)   /* Mask Card Ready */  /* SDH_CFG bitmasks */  #define CLKS_EN            (1 << 0)    /* Clocks Enable */ @@ -126,7 +145,15 @@ struct bfin_sd_host {  #define SD_RST             (1 << 4)    /* SDMMC Reset */  #define PUP_SDDAT          (1 << 5)    /* Pull-up SD_DAT */  #define PUP_SDDAT3         (1 << 6)    /* Pull-up SD_DAT3 */ +#ifndef RSI_BLKSZ  #define PD_SDDAT3          (1 << 7)    /* Pull-down SD_DAT3 */ +#else +#define PWR_ON             0x600       /* Power On */ +#define SD_CMD_OD          (1 << 11)   /* Open Drain Output */ +#define BOOT_EN            (1 << 12)   /* Boot Enable */ +#define BOOT_MODE          (1 << 13)   /* Alternate Boot Mode */ +#define BOOT_ACK_EN        (1 << 14)   /* Boot ACK is expected */ +#endif  /* SDH_RD_WAIT_EN bitmasks */  #define RWR                (1 << 0)    /* Read Wait Request */ diff --git a/arch/blackfin/include/asm/bfin_serial.h b/arch/blackfin/include/asm/bfin_serial.h new file mode 100644 index 00000000000..2d90d62edc9 --- /dev/null +++ b/arch/blackfin/include/asm/bfin_serial.h @@ -0,0 +1,430 @@ +/* + * bfin_serial.h - Blackfin UART/Serial definitions + * + * Copyright 2006-2010 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#ifndef __BFIN_ASM_SERIAL_H__ +#define __BFIN_ASM_SERIAL_H__ + +#include <linux/serial_core.h> +#include <linux/spinlock.h> +#include <mach/anomaly.h> +#include <mach/bfin_serial.h> + +#if defined(CONFIG_BFIN_UART0_CTSRTS) || \ +    defined(CONFIG_BFIN_UART1_CTSRTS) || \ +    defined(CONFIG_BFIN_UART2_CTSRTS) || \ +    defined(CONFIG_BFIN_UART3_CTSRTS) +# if defined(BFIN_UART_BF54X_STYLE) || defined(BFIN_UART_BF60X_STYLE) +#  define CONFIG_SERIAL_BFIN_HARD_CTSRTS +# else +#  define CONFIG_SERIAL_BFIN_CTSRTS +# endif +#endif + +struct circ_buf; +struct timer_list; +struct work_struct; + +struct bfin_serial_port { +	struct uart_port port; +	unsigned int old_status; +	int tx_irq; +	int rx_irq; +	int status_irq; +#ifndef BFIN_UART_BF54X_STYLE +	unsigned int lsr; +#endif +#ifdef CONFIG_SERIAL_BFIN_DMA +	int tx_done; +	int tx_count; +	struct circ_buf rx_dma_buf; +	struct timer_list rx_dma_timer; +	int rx_dma_nrows; +	spinlock_t rx_lock; +	unsigned int tx_dma_channel; +	unsigned int rx_dma_channel; +	struct work_struct tx_dma_workqueue; +#elif ANOMALY_05000363 +	unsigned int anomaly_threshold; +#endif +#if defined(CONFIG_SERIAL_BFIN_CTSRTS) || \ +	defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS) +	int cts_pin; +	int rts_pin; +#endif +}; + +#ifdef BFIN_UART_BF60X_STYLE + +/* UART_CTL Masks */ +#define UCEN                     0x1  /* Enable UARTx Clocks */ +#define LOOP_ENA                 0x2  /* Loopback Mode Enable */ +#define UMOD_MDB                 0x10  /* Enable MDB Mode */ +#define UMOD_IRDA                0x20  /* Enable IrDA Mode */ +#define UMOD_MASK                0x30  /* Uart Mode Mask */ +#define WLS(x)                   (((x-5) & 0x03) << 8)  /* Word Length Select */ +#define WLS_MASK                 0x300  /* Word length Select Mask */ +#define WLS_OFFSET               8      /* Word length Select Offset */ +#define STB                      0x1000  /* Stop Bits */ +#define STBH                     0x2000  /* Half Stop Bits */ +#define PEN                      0x4000  /* Parity Enable */ +#define EPS                      0x8000  /* Even Parity Select */ +#define STP                      0x10000  /* Stick Parity */ +#define FPE                      0x20000  /* Force Parity Error On Transmit */ +#define FFE                      0x40000  /* Force Framing Error On Transmit */ +#define SB                       0x80000  /* Set Break */ +#define LCR_MASK		 (SB | STP | EPS | PEN | STB | WLS_MASK) +#define FCPOL                    0x400000  /* Flow Control Pin Polarity */ +#define RPOLC                    0x800000  /* IrDA RX Polarity Change */ +#define TPOLC                    0x1000000  /* IrDA TX Polarity Change */ +#define MRTS                     0x2000000  /* Manual Request To Send */ +#define XOFF                     0x4000000  /* Transmitter Off */ +#define ARTS                     0x8000000  /* Automatic Request To Send */ +#define ACTS                     0x10000000  /* Automatic Clear To Send */ +#define RFIT                     0x20000000  /* Receive FIFO IRQ Threshold */ +#define RFRT                     0x40000000  /* Receive FIFO RTS Threshold */ + +/* UART_STAT Masks */ +#define DR                       0x01  /* Data Ready */ +#define OE                       0x02  /* Overrun Error */ +#define PE                       0x04  /* Parity Error */ +#define FE                       0x08  /* Framing Error */ +#define BI                       0x10  /* Break Interrupt */ +#define THRE                     0x20  /* THR Empty */ +#define TEMT                     0x80  /* TSR and UART_THR Empty */ +#define TFI                      0x100  /* Transmission Finished Indicator */ + +#define ASTKY                    0x200  /* Address Sticky */ +#define ADDR                     0x400  /* Address bit status */ +#define RO			 0x800  /* Reception Ongoing */ +#define SCTS                     0x1000  /* Sticky CTS */ +#define CTS                      0x10000  /* Clear To Send */ +#define RFCS                     0x20000  /* Receive FIFO Count Status */ + +/* UART_CLOCK Masks */ +#define EDBO                     0x80000000 /* Enable Devide by One */ + +#else /* BFIN_UART_BF60X_STYLE */ + +/* UART_LCR Masks */ +#define WLS(x)                   (((x)-5) & 0x03)  /* Word Length Select */ +#define WLS_MASK                 0x03  /* Word length Select Mask */ +#define WLS_OFFSET               0     /* Word length Select Offset */ +#define STB                      0x04  /* Stop Bits */ +#define PEN                      0x08  /* Parity Enable */ +#define EPS                      0x10  /* Even Parity Select */ +#define STP                      0x20  /* Stick Parity */ +#define SB                       0x40  /* Set Break */ +#define DLAB                     0x80  /* Divisor Latch Access */ +#define LCR_MASK		 (SB | STP | EPS | PEN | STB | WLS_MASK) + +/* UART_LSR Masks */ +#define DR                       0x01  /* Data Ready */ +#define OE                       0x02  /* Overrun Error */ +#define PE                       0x04  /* Parity Error */ +#define FE                       0x08  /* Framing Error */ +#define BI                       0x10  /* Break Interrupt */ +#define THRE                     0x20  /* THR Empty */ +#define TEMT                     0x40  /* TSR and UART_THR Empty */ +#define TFI                      0x80  /* Transmission Finished Indicator */ + +/* UART_MCR Masks */ +#define XOFF                     0x01  /* Transmitter Off */ +#define MRTS                     0x02  /* Manual Request To Send */ +#define RFIT                     0x04  /* Receive FIFO IRQ Threshold */ +#define RFRT                     0x08  /* Receive FIFO RTS Threshold */ +#define LOOP_ENA                 0x10  /* Loopback Mode Enable */ +#define FCPOL                    0x20  /* Flow Control Pin Polarity */ +#define ARTS                     0x40  /* Automatic Request To Send */ +#define ACTS                     0x80  /* Automatic Clear To Send */ + +/* UART_MSR Masks */ +#define SCTS                     0x01  /* Sticky CTS */ +#define CTS                      0x10  /* Clear To Send */ +#define RFCS                     0x20  /* Receive FIFO Count Status */ + +/* UART_GCTL Masks */ +#define UCEN                     0x01  /* Enable UARTx Clocks */ +#define UMOD_IRDA                0x02  /* Enable IrDA Mode */ +#define UMOD_MASK                0x02  /* Uart Mode Mask */ +#define TPOLC                    0x04  /* IrDA TX Polarity Change */ +#define RPOLC                    0x08  /* IrDA RX Polarity Change */ +#define FPE                      0x10  /* Force Parity Error On Transmit */ +#define FFE                      0x20  /* Force Framing Error On Transmit */ + +#endif /* BFIN_UART_BF60X_STYLE */ + +/* UART_IER Masks */ +#define ERBFI                    0x01  /* Enable Receive Buffer Full Interrupt */ +#define ETBEI                    0x02  /* Enable Transmit Buffer Empty Interrupt */ +#define ELSI                     0x04  /* Enable RX Status Interrupt */ +#define EDSSI                    0x08  /* Enable Modem Status Interrupt */ +#define EDTPTI                   0x10  /* Enable DMA Transmit PIRQ Interrupt */ +#define ETFI                     0x20  /* Enable Transmission Finished Interrupt */ +#define ERFCI                    0x40  /* Enable Receive FIFO Count Interrupt */ + +#if defined(BFIN_UART_BF60X_STYLE) +# define OFFSET_REDIV            0x00  /* Version ID Register             */ +# define OFFSET_CTL              0x04  /* Control Register                */ +# define OFFSET_STAT             0x08  /* Status Register                 */ +# define OFFSET_SCR              0x0C  /* SCR Scratch Register            */ +# define OFFSET_CLK              0x10  /* Clock Rate Register             */ +# define OFFSET_IER              0x14  /* Interrupt Enable Register       */ +# define OFFSET_IER_SET          0x18  /* Set Interrupt Enable Register   */ +# define OFFSET_IER_CLEAR        0x1C  /* Clear Interrupt Enable Register */ +# define OFFSET_RBR              0x20  /* Receive Buffer register         */ +# define OFFSET_THR              0x24  /* Transmit Holding register       */ +#elif defined(BFIN_UART_BF54X_STYLE) +# define OFFSET_DLL              0x00  /* Divisor Latch (Low-Byte)        */ +# define OFFSET_DLH              0x04  /* Divisor Latch (High-Byte)       */ +# define OFFSET_GCTL             0x08  /* Global Control Register         */ +# define OFFSET_LCR              0x0C  /* Line Control Register           */ +# define OFFSET_MCR              0x10  /* Modem Control Register          */ +# define OFFSET_LSR              0x14  /* Line Status Register            */ +# define OFFSET_MSR              0x18  /* Modem Status Register           */ +# define OFFSET_SCR              0x1C  /* SCR Scratch Register            */ +# define OFFSET_IER_SET          0x20  /* Set Interrupt Enable Register   */ +# define OFFSET_IER_CLEAR        0x24  /* Clear Interrupt Enable Register */ +# define OFFSET_THR              0x28  /* Transmit Holding register       */ +# define OFFSET_RBR              0x2C  /* Receive Buffer register         */ +#else /* BF533 style */ +# define OFFSET_THR              0x00  /* Transmit Holding register         */ +# define OFFSET_RBR              0x00  /* Receive Buffer register           */ +# define OFFSET_DLL              0x00  /* Divisor Latch (Low-Byte)          */ +# define OFFSET_DLH              0x04  /* Divisor Latch (High-Byte)         */ +# define OFFSET_IER              0x04  /* Interrupt Enable Register         */ +# define OFFSET_IIR              0x08  /* Interrupt Identification Register */ +# define OFFSET_LCR              0x0C  /* Line Control Register             */ +# define OFFSET_MCR              0x10  /* Modem Control Register            */ +# define OFFSET_LSR              0x14  /* Line Status Register              */ +# define OFFSET_MSR              0x18  /* Modem Status Register             */ +# define OFFSET_SCR              0x1C  /* SCR Scratch Register              */ +# define OFFSET_GCTL             0x24  /* Global Control Register           */ +/* code should not need IIR, so force build error if they use it */ +# undef OFFSET_IIR +#endif + +/* + * All Blackfin system MMRs are padded to 32bits even if the register + * itself is only 16bits.  So use a helper macro to streamline this. + */ +#define __BFP(m) u16 m; u16 __pad_##m +struct bfin_uart_regs { +#if defined(BFIN_UART_BF60X_STYLE) +	u32 revid; +	u32 ctl; +	u32 stat; +	u32 scr; +	u32 clk; +	u32 ier; +	u32 ier_set; +	u32 ier_clear; +	u32 rbr; +	u32 thr; +	u32 taip; +	u32 tsr; +	u32 rsr; +	u32 txdiv; +	u32 rxdiv; +#elif defined(BFIN_UART_BF54X_STYLE) +	__BFP(dll); +	__BFP(dlh); +	__BFP(gctl); +	__BFP(lcr); +	__BFP(mcr); +	__BFP(lsr); +	__BFP(msr); +	__BFP(scr); +	__BFP(ier_set); +	__BFP(ier_clear); +	__BFP(thr); +	__BFP(rbr); +#else +	union { +		u16 dll; +		u16 thr; +		const u16 rbr; +	}; +	const u16 __pad0; +	union { +		u16 dlh; +		u16 ier; +	}; +	const u16 __pad1; +	const __BFP(iir); +	__BFP(lcr); +	__BFP(mcr); +	__BFP(lsr); +	__BFP(msr); +	__BFP(scr); +	const u32 __pad2; +	__BFP(gctl); +#endif +}; +#undef __BFP + +#define port_membase(uart)     (((struct bfin_serial_port *)(uart))->port.membase) + +/* +#ifndef port_membase +# define port_membase(p) 0 +#endif +*/ +#ifdef BFIN_UART_BF60X_STYLE + +#define UART_GET_CHAR(p)      bfin_read32(port_membase(p) + OFFSET_RBR) +#define UART_GET_CLK(p)       bfin_read32(port_membase(p) + OFFSET_CLK) +#define UART_GET_CTL(p)       bfin_read32(port_membase(p) + OFFSET_CTL) +#define UART_GET_GCTL(p)      UART_GET_CTL(p) +#define UART_GET_LCR(p)       UART_GET_CTL(p) +#define UART_GET_MCR(p)       UART_GET_CTL(p) +#if ANOMALY_16000030 +#define UART_GET_STAT(p) \ +({ \ +	u32 __ret; \ +	unsigned long flags; \ +	flags = hard_local_irq_save(); \ +	__ret = bfin_read32(port_membase(p) + OFFSET_STAT); \ +	hard_local_irq_restore(flags); \ +	__ret; \ +}) +#else +#define UART_GET_STAT(p)      bfin_read32(port_membase(p) + OFFSET_STAT) +#endif +#define UART_GET_MSR(p)       UART_GET_STAT(p) + +#define UART_PUT_CHAR(p, v)   bfin_write32(port_membase(p) + OFFSET_THR, v) +#define UART_PUT_CLK(p, v)    bfin_write32(port_membase(p) + OFFSET_CLK, v) +#define UART_PUT_CTL(p, v)    bfin_write32(port_membase(p) + OFFSET_CTL, v) +#define UART_PUT_GCTL(p, v)   UART_PUT_CTL(p, v) +#define UART_PUT_LCR(p, v)    UART_PUT_CTL(p, v) +#define UART_PUT_MCR(p, v)    UART_PUT_CTL(p, v) +#define UART_PUT_STAT(p, v)   bfin_write32(port_membase(p) + OFFSET_STAT, v) + +#define UART_CLEAR_IER(p, v)  bfin_write32(port_membase(p) + OFFSET_IER_CLEAR, v) +#define UART_GET_IER(p)       bfin_read32(port_membase(p) + OFFSET_IER) +#define UART_SET_IER(p, v)    bfin_write32(port_membase(p) + OFFSET_IER_SET, v) + +#define UART_CLEAR_DLAB(p)    /* MMRs not muxed on BF60x */ +#define UART_SET_DLAB(p)      /* MMRs not muxed on BF60x */ + +#define UART_CLEAR_LSR(p)     UART_PUT_STAT(p, -1) +#define UART_GET_LSR(p)       UART_GET_STAT(p) +#define UART_PUT_LSR(p, v)    UART_PUT_STAT(p, v) + +/* This handles hard CTS/RTS */ +#define BFIN_UART_CTSRTS_HARD +#define UART_CLEAR_SCTS(p)      UART_PUT_STAT(p, SCTS) +#define UART_GET_CTS(x)         (UART_GET_MSR(x) & CTS) +#define UART_DISABLE_RTS(x)     UART_PUT_MCR(x, UART_GET_MCR(x) & ~(ARTS | MRTS)) +#define UART_ENABLE_RTS(x)      UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS | ARTS) +#define UART_ENABLE_INTS(x, v)  UART_SET_IER(x, v) +#define UART_DISABLE_INTS(x)    UART_CLEAR_IER(x, 0xF) + +#else /* BFIN_UART_BF60X_STYLE */ + +#define UART_GET_CHAR(p)      bfin_read16(port_membase(p) + OFFSET_RBR) +#define UART_GET_DLL(p)       bfin_read16(port_membase(p) + OFFSET_DLL) +#define UART_GET_DLH(p)       bfin_read16(port_membase(p) + OFFSET_DLH) +#define UART_GET_CLK(p)	      ((UART_GET_DLH(p) << 8) | UART_GET_DLL(p)) +#define UART_GET_GCTL(p)      bfin_read16(port_membase(p) + OFFSET_GCTL) +#define UART_GET_LCR(p)       bfin_read16(port_membase(p) + OFFSET_LCR) +#define UART_GET_MCR(p)       bfin_read16(port_membase(p) + OFFSET_MCR) +#define UART_GET_MSR(p)       bfin_read16(port_membase(p) + OFFSET_MSR) + +#define UART_PUT_CHAR(p, v)   bfin_write16(port_membase(p) + OFFSET_THR, v) +#define UART_PUT_DLL(p, v)    bfin_write16(port_membase(p) + OFFSET_DLL, v) +#define UART_PUT_DLH(p, v)    bfin_write16(port_membase(p) + OFFSET_DLH, v) +#define UART_PUT_CLK(p, v) do \ +{\ +UART_PUT_DLL(p, v & 0xFF); \ +UART_PUT_DLH(p, (v >> 8) & 0xFF); } while (0); + +#define UART_PUT_GCTL(p, v)   bfin_write16(port_membase(p) + OFFSET_GCTL, v) +#define UART_PUT_LCR(p, v)    bfin_write16(port_membase(p) + OFFSET_LCR, v) +#define UART_PUT_MCR(p, v)    bfin_write16(port_membase(p) + OFFSET_MCR, v) + +#ifdef BFIN_UART_BF54X_STYLE + +#define UART_CLEAR_IER(p, v)  bfin_write16(port_membase(p) + OFFSET_IER_CLEAR, v) +#define UART_GET_IER(p)       bfin_read16(port_membase(p) + OFFSET_IER_SET) +#define UART_SET_IER(p, v)    bfin_write16(port_membase(p) + OFFSET_IER_SET, v) + +#define UART_CLEAR_DLAB(p)    /* MMRs not muxed on BF54x */ +#define UART_SET_DLAB(p)      /* MMRs not muxed on BF54x */ + +#define UART_CLEAR_LSR(p)     bfin_write16(port_membase(p) + OFFSET_LSR, -1) +#define UART_GET_LSR(p)       bfin_read16(port_membase(p) + OFFSET_LSR) +#define UART_PUT_LSR(p, v)    bfin_write16(port_membase(p) + OFFSET_LSR, v) + +/* This handles hard CTS/RTS */ +#define BFIN_UART_CTSRTS_HARD +#define UART_CLEAR_SCTS(p)      bfin_write16((port_membase(p) + OFFSET_MSR), SCTS) +#define UART_GET_CTS(x)         (UART_GET_MSR(x) & CTS) +#define UART_DISABLE_RTS(x)     UART_PUT_MCR(x, UART_GET_MCR(x) & ~(ARTS | MRTS)) +#define UART_ENABLE_RTS(x)      UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS | ARTS) +#define UART_ENABLE_INTS(x, v)  UART_SET_IER(x, v) +#define UART_DISABLE_INTS(x)    UART_CLEAR_IER(x, 0xF) + +#else /* BF533 style */ + +#define UART_CLEAR_IER(p, v)  UART_PUT_IER(p, UART_GET_IER(p) & ~(v)) +#define UART_GET_IER(p)       bfin_read16(port_membase(p) + OFFSET_IER) +#define UART_PUT_IER(p, v)    bfin_write16(port_membase(p) + OFFSET_IER, v) +#define UART_SET_IER(p, v)    UART_PUT_IER(p, UART_GET_IER(p) | (v)) + +#define UART_CLEAR_DLAB(p)    do { UART_PUT_LCR(p, UART_GET_LCR(p) & ~DLAB); SSYNC(); } while (0) +#define UART_SET_DLAB(p)      do { UART_PUT_LCR(p, UART_GET_LCR(p) | DLAB); SSYNC(); } while (0) + +#define get_lsr_cache(uart)    (((struct bfin_serial_port *)(uart))->lsr) +#define put_lsr_cache(uart, v) (((struct bfin_serial_port *)(uart))->lsr = (v)) + +/* +#ifndef put_lsr_cache +# define put_lsr_cache(p, v) +#endif +#ifndef get_lsr_cache +# define get_lsr_cache(p) 0 +#endif +*/ + +/* The hardware clears the LSR bits upon read, so we need to cache + * some of the more fun bits in software so they don't get lost + * when checking the LSR in other code paths (TX). + */ +static inline void UART_CLEAR_LSR(void *p) +{ +	put_lsr_cache(p, 0); +	bfin_write16(port_membase(p) + OFFSET_LSR, -1); +} +static inline unsigned int UART_GET_LSR(void *p) +{ +	unsigned int lsr = bfin_read16(port_membase(p) + OFFSET_LSR); +	put_lsr_cache(p, get_lsr_cache(p) | (lsr & (BI|FE|PE|OE))); +	return lsr | get_lsr_cache(p); +} +static inline void UART_PUT_LSR(void *p, uint16_t val) +{ +	put_lsr_cache(p, get_lsr_cache(p) & ~val); +} + +/* This handles soft CTS/RTS */ +#define UART_GET_CTS(x)        gpio_get_value((x)->cts_pin) +#define UART_DISABLE_RTS(x)    gpio_set_value((x)->rts_pin, 1) +#define UART_ENABLE_RTS(x)     gpio_set_value((x)->rts_pin, 0) +#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) +#define UART_DISABLE_INTS(x)   UART_PUT_IER(x, 0) + +#endif /* BFIN_UART_BF54X_STYLE */ + +#endif /* BFIN_UART_BF60X_STYLE */ + +#ifndef BFIN_UART_TX_FIFO_SIZE +# define BFIN_UART_TX_FIFO_SIZE 2 +#endif + +#endif /* __BFIN_ASM_SERIAL_H__ */ diff --git a/arch/blackfin/include/asm/bfin_simple_timer.h b/arch/blackfin/include/asm/bfin_simple_timer.h index 5248c133bc6..b2d5e733079 100644 --- a/arch/blackfin/include/asm/bfin_simple_timer.h +++ b/arch/blackfin/include/asm/bfin_simple_timer.h @@ -11,9 +11,17 @@  #define BFIN_SIMPLE_TIMER_IOCTL_MAGIC 't' -#define BFIN_SIMPLE_TIMER_SET_PERIOD _IO (BFIN_SIMPLE_TIMER_IOCTL_MAGIC,  2) -#define BFIN_SIMPLE_TIMER_START      _IO (BFIN_SIMPLE_TIMER_IOCTL_MAGIC,  6) -#define BFIN_SIMPLE_TIMER_STOP       _IO (BFIN_SIMPLE_TIMER_IOCTL_MAGIC,  8) -#define BFIN_SIMPLE_TIMER_READ       _IO (BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 10) +#define BFIN_SIMPLE_TIMER_SET_PERIOD _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC,  2) +#define BFIN_SIMPLE_TIMER_SET_WIDTH _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC,  3) +#define BFIN_SIMPLE_TIMER_SET_MODE _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC,  4) +#define BFIN_SIMPLE_TIMER_START      _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC,  6) +#define BFIN_SIMPLE_TIMER_STOP       _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC,  8) +#define BFIN_SIMPLE_TIMER_READ       _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 10) +#define BFIN_SIMPLE_TIMER_READ_COUNTER _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 11) + +#define BFIN_SIMPLE_TIMER_MODE_PWM_ONESHOT		0 +#define BFIN_SIMPLE_TIMER_MODE_PWMOUT_CONT		1 +#define BFIN_SIMPLE_TIMER_MODE_WDTH_CAP			2 +#define BFIN_SIMPLE_TIMER_MODE_PWMOUT_CONT_NOIRQ	3  #endif diff --git a/arch/blackfin/include/asm/bfin_sport.h b/arch/blackfin/include/asm/bfin_sport.h index d27600c262c..50b9dfd4839 100644 --- a/arch/blackfin/include/asm/bfin_sport.h +++ b/arch/blackfin/include/asm/bfin_sport.h @@ -5,61 +5,12 @@   *   * Licensed under the GPL-2 or later.   */ -  #ifndef __BFIN_SPORT_H__  #define __BFIN_SPORT_H__ -/* Sport mode: it can be set to TDM, i2s or others */ -#define NORM_MODE	0x0 -#define TDM_MODE	0x1 -#define I2S_MODE	0x2 - -/* Data format, normal, a-law or u-law */ -#define NORM_FORMAT	0x0 -#define ALAW_FORMAT	0x2 -#define ULAW_FORMAT	0x3 - -/* Function driver which use sport must initialize the structure */ -struct sport_config { -	/* TDM (multichannels), I2S or other mode */ -	unsigned int mode:3; - -	/* if TDM mode is selected, channels must be set */ -	int channels;	/* Must be in 8 units */ -	unsigned int frame_delay:4;	/* Delay between frame sync pulse and first bit */ - -	/* I2S mode */ -	unsigned int right_first:1;	/* Right stereo channel first */ - -	/* In mormal mode, the following item need to be set */ -	unsigned int lsb_first:1;	/* order of transmit or receive data */ -	unsigned int fsync:1;	/* Frame sync required */ -	unsigned int data_indep:1;	/* data independent frame sync generated */ -	unsigned int act_low:1;	/* Active low TFS */ -	unsigned int late_fsync:1;	/* Late frame sync */ -	unsigned int tckfe:1; -	unsigned int sec_en:1;	/* Secondary side enabled */ - -	/* Choose clock source */ -	unsigned int int_clk:1;	/* Internal or external clock */ - -	/* If external clock is used, the following fields are ignored */ -	int serial_clk; -	int fsync_clk; - -	unsigned int data_format:2;	/* Normal, u-law or a-law */ - -	int word_len;		/* How length of the word in bits, 3-32 bits */ -	int dma_enabled; -}; - -/* Userspace interface */ -#define SPORT_IOC_MAGIC		'P' -#define SPORT_IOC_CONFIG	_IOWR('P', 0x01, struct sport_config) - -#ifdef __KERNEL__  #include <linux/types.h> +#include <uapi/asm/bfin_sport.h>  /*   * All Blackfin system MMRs are padded to 32bits even if the register @@ -100,6 +51,10 @@ struct sport_register {  };  #undef __BFP +struct bfin_snd_platform_data { +	const unsigned short *pin_req; +}; +  #define bfin_read_sport_rx32(base) \  ({ \  	struct sport_register *__mmrs = (void *)base; \ @@ -114,76 +69,3 @@ struct sport_register {  })  #endif - -/* SPORT_TCR1 Masks */ -#define TSPEN		0x0001	/* TX enable */ -#define ITCLK		0x0002	/* Internal TX Clock Select */ -#define TDTYPE		0x000C	/* TX Data Formatting Select */ -#define DTYPE_NORM	0x0000	/* Data Format Normal */ -#define DTYPE_ULAW	0x0008	/* Compand Using u-Law */ -#define DTYPE_ALAW	0x000C	/* Compand Using A-Law */ -#define TLSBIT		0x0010	/* TX Bit Order */ -#define ITFS		0x0200	/* Internal TX Frame Sync Select */ -#define TFSR		0x0400	/* TX Frame Sync Required Select */ -#define DITFS		0x0800	/* Data Independent TX Frame Sync Select */ -#define LTFS		0x1000	/* Low TX Frame Sync Select */ -#define LATFS		0x2000	/* Late TX Frame Sync Select */ -#define TCKFE		0x4000	/* TX Clock Falling Edge Select */ - -/* SPORT_TCR2 Masks */ -#define SLEN		0x001F	/* SPORT TX Word Length (2 - 31) */ -#define DP_SLEN(x)	BFIN_DEPOSIT(SLEN, x) -#define EX_SLEN(x)	BFIN_EXTRACT(SLEN, x) -#define TXSE		0x0100	/* TX Secondary Enable */ -#define TSFSE		0x0200	/* TX Stereo Frame Sync Enable */ -#define TRFST		0x0400	/* TX Right-First Data Order */ - -/* SPORT_RCR1 Masks */ -#define RSPEN		0x0001	/* RX enable */ -#define IRCLK		0x0002	/* Internal RX Clock Select */ -#define RDTYPE		0x000C	/* RX Data Formatting Select */ -/* DTYPE_* defined above */ -#define RLSBIT		0x0010	/* RX Bit Order */ -#define IRFS		0x0200	/* Internal RX Frame Sync Select */ -#define RFSR		0x0400	/* RX Frame Sync Required Select */ -#define LRFS		0x1000	/* Low RX Frame Sync Select */ -#define LARFS		0x2000	/* Late RX Frame Sync Select */ -#define RCKFE		0x4000	/* RX Clock Falling Edge Select */ - -/* SPORT_RCR2 Masks */ -/* SLEN defined above */ -#define RXSE		0x0100	/* RX Secondary Enable */ -#define RSFSE		0x0200	/* RX Stereo Frame Sync Enable */ -#define RRFST		0x0400	/* Right-First Data Order */ - -/* SPORT_STAT Masks */ -#define RXNE		0x0001	/* RX FIFO Not Empty Status */ -#define RUVF		0x0002	/* RX Underflow Status */ -#define ROVF		0x0004	/* RX Overflow Status */ -#define TXF		0x0008	/* TX FIFO Full Status */ -#define TUVF		0x0010	/* TX Underflow Status */ -#define TOVF		0x0020	/* TX Overflow Status */ -#define TXHRE		0x0040	/* TX Hold Register Empty */ - -/* SPORT_MCMC1 Masks */ -#define SP_WOFF		0x03FF	/* Multichannel Window Offset Field */ -#define DP_SP_WOFF(x)	BFIN_DEPOSIT(SP_WOFF, x) -#define EX_SP_WOFF(x)	BFIN_EXTRACT(SP_WOFF, x) -#define SP_WSIZE	0xF000	/* Multichannel Window Size Field */ -#define DP_SP_WSIZE(x)	BFIN_DEPOSIT(SP_WSIZE, x) -#define EX_SP_WSIZE(x)	BFIN_EXTRACT(SP_WSIZE, x) - -/* SPORT_MCMC2 Masks */ -#define MCCRM		0x0003	/* Multichannel Clock Recovery Mode */ -#define REC_BYPASS	0x0000	/* Bypass Mode (No Clock Recovery) */ -#define REC_2FROM4	0x0002	/* Recover 2 MHz Clock from 4 MHz Clock */ -#define REC_8FROM16	0x0003	/* Recover 8 MHz Clock from 16 MHz Clock */ -#define MCDTXPE		0x0004	/* Multichannel DMA Transmit Packing */ -#define MCDRXPE		0x0008	/* Multichannel DMA Receive Packing */ -#define MCMEN		0x0010	/* Multichannel Frame Mode Enable */ -#define FSDR		0x0080	/* Multichannel Frame Sync to Data Relationship */ -#define MFD		0xF000	/* Multichannel Frame Delay */ -#define DP_MFD(x)	BFIN_DEPOSIT(MFD, x) -#define EX_MFD(x)	BFIN_EXTRACT(MFD, x) - -#endif diff --git a/arch/blackfin/include/asm/bfin_sport3.h b/arch/blackfin/include/asm/bfin_sport3.h new file mode 100644 index 00000000000..d82f5fa0ad9 --- /dev/null +++ b/arch/blackfin/include/asm/bfin_sport3.h @@ -0,0 +1,107 @@ +/* + * bfin_sport - Analog Devices BF6XX SPORT registers + * + * Copyright (c) 2012 Analog Devices Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _BFIN_SPORT3_H_ +#define _BFIN_SPORT3_H_ + +#include <linux/types.h> + +#define SPORT_CTL_SPENPRI             0x00000001    /* Enable Primary Channel */ +#define SPORT_CTL_DTYPE               0x00000006    /* Data type select */ +#define SPORT_CTL_RJUSTIFY_ZFILL      0x00000000    /* DTYPE: MCM mode: Right-justify, zero-fill unused MSBs */ +#define SPORT_CTL_RJUSTIFY_SFILL      0x00000002    /* DTYPE: MCM mode: Right-justify, sign-extend unused MSBs */ +#define SPORT_CTL_USE_U_LAW           0x00000004    /* DTYPE: MCM mode: Compand using u-law */ +#define SPORT_CTL_USE_A_LAW           0x00000006    /* DTYPE: MCM mode: Compand using A-law */ +#define SPORT_CTL_LSBF                0x00000008    /* Serial bit endian select */ +#define SPORT_CTL_SLEN                0x000001F0    /* Serial Word length select */ +#define SPORT_CTL_PACK                0x00000200    /* 16-bit to 32-bit packing enable */ +#define SPORT_CTL_ICLK                0x00000400    /* Internal Clock Select */ +#define SPORT_CTL_OPMODE              0x00000800    /* Operation mode */ +#define SPORT_CTL_CKRE                0x00001000    /* Clock rising edge select */ +#define SPORT_CTL_FSR                 0x00002000    /* Frame Sync required */ +#define SPORT_CTL_IFS                 0x00004000    /* Internal Frame Sync select */ +#define SPORT_CTL_DIFS                0x00008000    /* Data-independent frame sync select */ +#define SPORT_CTL_LFS                 0x00010000    /* Active low frame sync select */ +#define SPORT_CTL_LAFS                0x00020000    /* Late Transmit frame select */ +#define SPORT_CTL_RJUST               0x00040000    /* Right Justified mode select */ +#define SPORT_CTL_FSED                0x00080000    /* External frame sync edge select */ +#define SPORT_CTL_TFIEN               0x00100000    /* Transmit finish interrupt enable select */ +#define SPORT_CTL_GCLKEN              0x00200000    /* Gated clock mode select */ +#define SPORT_CTL_SPENSEC             0x01000000    /* Enable secondary channel */ +#define SPORT_CTL_SPTRAN              0x02000000    /* Data direction control */ +#define SPORT_CTL_DERRSEC             0x04000000    /* Secondary channel error status */ +#define SPORT_CTL_DXSSEC              0x18000000    /* Secondary channel data buffer status */ +#define SPORT_CTL_SEC_EMPTY           0x00000000    /* DXSSEC: Empty */ +#define SPORT_CTL_SEC_PART_FULL       0x10000000    /* DXSSEC: Partially full */ +#define SPORT_CTL_SEC_FULL            0x18000000    /* DXSSEC: Full */ +#define SPORT_CTL_DERRPRI             0x20000000    /* Primary channel error status */ +#define SPORT_CTL_DXSPRI              0xC0000000    /* Primary channel data buffer status */ +#define SPORT_CTL_PRM_EMPTY           0x00000000    /* DXSPRI: Empty */ +#define SPORT_CTL_PRM_PART_FULL       0x80000000    /* DXSPRI: Partially full */ +#define SPORT_CTL_PRM_FULL            0xC0000000    /* DXSPRI: Full */ + +#define SPORT_DIV_CLKDIV              0x0000FFFF    /* Clock divisor */ +#define SPORT_DIV_FSDIV               0xFFFF0000    /* Frame sync divisor */ + +#define SPORT_MCTL_MCE                0x00000001    /* Multichannel enable */ +#define SPORT_MCTL_MCPDE              0x00000004    /* Multichannel data packing select */ +#define SPORT_MCTL_MFD                0x000000F0    /* Multichannel frame delay */ +#define SPORT_MCTL_WSIZE              0x00007F00    /* Number of multichannel slots */ +#define SPORT_MCTL_WOFFSET            0x03FF0000    /* Window offset size */ + +#define SPORT_CNT_CLKCNT              0x0000FFFF    /* Current state of clk div counter */ +#define SPORT_CNT_FSDIVCNT            0xFFFF0000    /* Current state of frame div counter */ + +#define SPORT_ERR_DERRPMSK            0x00000001    /* Primary channel data error interrupt enable */ +#define SPORT_ERR_DERRSMSK            0x00000002    /* Secondary channel data error interrupt enable */ +#define SPORT_ERR_FSERRMSK            0x00000004    /* Frame sync error interrupt enable */ +#define SPORT_ERR_DERRPSTAT           0x00000010    /* Primary channel data error status */ +#define SPORT_ERR_DERRSSTAT           0x00000020    /* Secondary channel data error status */ +#define SPORT_ERR_FSERRSTAT           0x00000040    /* Frame sync error status */ + +#define SPORT_MSTAT_CURCHAN           0x000003FF    /* Channel which is being serviced in the multichannel operation */ + +#define SPORT_CTL2_FSMUXSEL           0x00000001    /* Frame Sync MUX Select */ +#define SPORT_CTL2_CKMUXSEL           0x00000002    /* Clock MUX Select */ +#define SPORT_CTL2_LBSEL              0x00000004    /* Loopback Select */ + +struct sport_register { +	u32 spctl; +	u32 div; +	u32 spmctl; +	u32 spcs0; +	u32 spcs1; +	u32 spcs2; +	u32 spcs3; +	u32 spcnt; +	u32 sperrctl; +	u32 spmstat; +	u32 spctl2; +	u32 txa; +	u32 rxa; +	u32 txb; +	u32 rxb; +	u32 revid; +}; + +struct bfin_snd_platform_data { +	const unsigned short *pin_req; +}; + +#endif diff --git a/arch/blackfin/include/asm/bfin_twi.h b/arch/blackfin/include/asm/bfin_twi.h index e767d649dfc..aaa0834d34a 100644 --- a/arch/blackfin/include/asm/bfin_twi.h +++ b/arch/blackfin/include/asm/bfin_twi.h @@ -9,37 +9,74 @@  #ifndef __ASM_BFIN_TWI_H__  #define __ASM_BFIN_TWI_H__ -#include <linux/types.h> +#include <asm/blackfin.h> -/* - * All Blackfin system MMRs are padded to 32bits even if the register - * itself is only 16bits.  So use a helper macro to streamline this. - */ -#define __BFP(m) u16 m; u16 __pad_##m +#define DEFINE_TWI_REG(reg_name, reg) \ +static inline u16 read_##reg_name(struct bfin_twi_iface *iface) \ +	{ return bfin_read16(&iface->regs_base->reg); } \ +static inline void write_##reg_name(struct bfin_twi_iface *iface, u16 v) \ +	{ bfin_write16(&iface->regs_base->reg, v); } -/* - * bfin twi registers layout - */ -struct bfin_twi_regs { -	__BFP(clkdiv); -	__BFP(control); -	__BFP(slave_ctl); -	__BFP(slave_stat); -	__BFP(slave_addr); -	__BFP(master_ctl); -	__BFP(master_stat); -	__BFP(master_addr); -	__BFP(int_stat); -	__BFP(int_mask); -	__BFP(fifo_ctl); -	__BFP(fifo_stat); -	u32 __pad[20]; -	__BFP(xmt_data8); -	__BFP(xmt_data16); -	__BFP(rcv_data8); -	__BFP(rcv_data16); -}; - -#undef __BFP +DEFINE_TWI_REG(CLKDIV, clkdiv) +DEFINE_TWI_REG(SLAVE_CTL, slave_ctl) +DEFINE_TWI_REG(SLAVE_STAT, slave_stat) +DEFINE_TWI_REG(SLAVE_ADDR, slave_addr) +DEFINE_TWI_REG(MASTER_CTL, master_ctl) +DEFINE_TWI_REG(MASTER_STAT, master_stat) +DEFINE_TWI_REG(MASTER_ADDR, master_addr) +DEFINE_TWI_REG(INT_STAT, int_stat) +DEFINE_TWI_REG(INT_MASK, int_mask) +DEFINE_TWI_REG(FIFO_STAT, fifo_stat) +DEFINE_TWI_REG(XMT_DATA8, xmt_data8) +DEFINE_TWI_REG(XMT_DATA16, xmt_data16) +#if !ANOMALY_16000030 +DEFINE_TWI_REG(RCV_DATA8, rcv_data8) +DEFINE_TWI_REG(RCV_DATA16, rcv_data16) +#else +static inline u16 read_RCV_DATA8(struct bfin_twi_iface *iface) +{ +	u16 ret; +	unsigned long flags; + +	flags = hard_local_irq_save(); +	ret = bfin_read16(&iface->regs_base->rcv_data8); +	hard_local_irq_restore(flags); + +	return ret; +} + +static inline u16 read_RCV_DATA16(struct bfin_twi_iface *iface) +{ +	u16 ret; +	unsigned long flags; + +	flags = hard_local_irq_save(); +	ret = bfin_read16(&iface->regs_base->rcv_data16); +	hard_local_irq_restore(flags); + +	return ret; +} +#endif + +static inline u16 read_FIFO_CTL(struct bfin_twi_iface *iface) +{ +	return bfin_read16(&iface->regs_base->fifo_ctl); +} + +static inline void write_FIFO_CTL(struct bfin_twi_iface *iface, u16 v) +{ +	bfin_write16(&iface->regs_base->fifo_ctl, v); +	SSYNC(); +} + +static inline u16 read_CONTROL(struct bfin_twi_iface *iface) +{ +	return bfin_read16(&iface->regs_base->control); +} +static inline void write_CONTROL(struct bfin_twi_iface *iface, u16 v) +{ +	SSYNC(); +	bfin_write16(&iface->regs_base->control, v); +}  #endif diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h index 3f7ef4d9779..b298b654a26 100644 --- a/arch/blackfin/include/asm/bitops.h +++ b/arch/blackfin/include/asm/bitops.h @@ -25,20 +25,15 @@  #include <asm-generic/bitops/const_hweight.h>  #include <asm-generic/bitops/lock.h> -#include <asm-generic/bitops/ext2-non-atomic.h>  #include <asm-generic/bitops/ext2-atomic.h> -#include <asm-generic/bitops/minix.h> + +#include <asm/barrier.h>  #ifndef CONFIG_SMP  #include <linux/irqflags.h> -  /*   * clear_bit may not imply a memory barrier   */ -#ifndef smp_mb__before_clear_bit -#define smp_mb__before_clear_bit()	smp_mb() -#define smp_mb__after_clear_bit()	smp_mb() -#endif  #include <asm-generic/bitops/atomic.h>  #include <asm-generic/bitops/non-atomic.h>  #else @@ -102,16 +97,15 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)  	return __raw_bit_test_toggle_asm(a, nr & 0x1f);  } -/* - * clear_bit() doesn't provide any barrier for the compiler. - */ -#define smp_mb__before_clear_bit()	barrier() -#define smp_mb__after_clear_bit()	barrier() - +#define test_bit __skip_test_bit  #include <asm-generic/bitops/non-atomic.h> +#undef test_bit  #endif /* CONFIG_SMP */ +/* Needs to be after test_bit and friends */ +#include <asm-generic/bitops/le.h> +  /*   * hweightN: returns the hamming weight (i.e. the number   * of bits set) of a N-bit word diff --git a/arch/blackfin/include/asm/bitsperlong.h b/arch/blackfin/include/asm/bitsperlong.h deleted file mode 100644 index 6dc0bb0c13b..00000000000 --- a/arch/blackfin/include/asm/bitsperlong.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/bitsperlong.h> diff --git a/arch/blackfin/include/asm/blackfin.h b/arch/blackfin/include/asm/blackfin.h index eb7c1441d8f..f111f366d75 100644 --- a/arch/blackfin/include/asm/blackfin.h +++ b/arch/blackfin/include/asm/blackfin.h @@ -1,9 +1,9 @@  /*   * Common header file for Blackfin family of processors.   * - * Copyright 2004-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. + * Copyright 2004-2009 Analog Devices Inc. + * + * Licensed under the GPL-2 or later.   */  #ifndef _BLACKFIN_H_ @@ -17,22 +17,16 @@  static inline void SSYNC(void)  {  	int _tmp; -	if (ANOMALY_05000312) +	if (ANOMALY_05000312 || ANOMALY_05000244)  		__asm__ __volatile__(  			"cli %0;"  			"nop;"  			"nop;" +			"nop;"  			"ssync;"  			"sti %0;"  			: "=d" (_tmp)  		); -	else if (ANOMALY_05000244) -		__asm__ __volatile__( -			"nop;" -			"nop;" -			"nop;" -			"ssync;" -		);  	else  		__asm__ __volatile__("ssync;");  } @@ -41,22 +35,16 @@ static inline void SSYNC(void)  static inline void CSYNC(void)  {  	int _tmp; -	if (ANOMALY_05000312) +	if (ANOMALY_05000312 || ANOMALY_05000244)  		__asm__ __volatile__(  			"cli %0;"  			"nop;"  			"nop;" +			"nop;"  			"csync;"  			"sti %0;"  			: "=d" (_tmp)  		); -	else if (ANOMALY_05000244) -		__asm__ __volatile__( -			"nop;" -			"nop;" -			"nop;" -			"csync;" -		);  	else  		__asm__ __volatile__("csync;");  } @@ -73,18 +61,22 @@ static inline void CSYNC(void)  #define ssync(x) SSYNC(x)  #define csync(x) CSYNC(x) -#if ANOMALY_05000312 -#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; -#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; +#if ANOMALY_05000312 || ANOMALY_05000244 +#define SSYNC(scratch)	\ +	cli scratch;	\ +	nop; nop; nop;	\ +	SSYNC;		\ +	sti scratch; -#elif ANOMALY_05000244 -#define SSYNC(scratch) nop; nop; nop; SSYNC; -#define CSYNC(scratch) nop; nop; nop; CSYNC; +#define CSYNC(scratch)	\ +	cli scratch;	\ +	nop; nop; nop;	\ +	CSYNC;		\ +	sti scratch;  #else  #define SSYNC(scratch) SSYNC;  #define CSYNC(scratch) CSYNC; -  #endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */  #endif /* __ASSEMBLY__ */ diff --git a/arch/blackfin/include/asm/bugs.h b/arch/blackfin/include/asm/bugs.h deleted file mode 100644 index 61791e1ad9f..00000000000 --- a/arch/blackfin/include/asm/bugs.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/bugs.h> diff --git a/arch/blackfin/include/asm/byteorder.h b/arch/blackfin/include/asm/byteorder.h deleted file mode 100644 index 9558416d578..00000000000 --- a/arch/blackfin/include/asm/byteorder.h +++ /dev/null @@ -1 +0,0 @@ -#include <linux/byteorder/little_endian.h> diff --git a/arch/blackfin/include/asm/cache.h b/arch/blackfin/include/asm/cache.h index bd0641a267f..568885a2c28 100644 --- a/arch/blackfin/include/asm/cache.h +++ b/arch/blackfin/include/asm/cache.h @@ -7,6 +7,8 @@  #ifndef __ARCH_BLACKFIN_CACHE_H  #define __ARCH_BLACKFIN_CACHE_H +#include <linux/linkage.h>	/* for asmlinkage */ +  /*   * Bytes per L1 cache line   * Blackfin loads 32 bytes for cache diff --git a/arch/blackfin/include/asm/cachectl.h b/arch/blackfin/include/asm/cachectl.h deleted file mode 100644 index 03255df6c1e..00000000000 --- a/arch/blackfin/include/asm/cachectl.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * based on the mips/cachectl.h - * - * Copyright 2010 Analog Devices Inc. - * Copyright (C) 1994, 1995, 1996 by Ralf Baechle - * - * Licensed under the GPL-2 or later. - */ - -#ifndef	_ASM_CACHECTL -#define	_ASM_CACHECTL - -/* - * Options for cacheflush system call - */ -#define	ICACHE	(1<<0)		/* flush instruction cache        */ -#define	DCACHE	(1<<1)		/* writeback and flush data cache */ -#define	BCACHE	(ICACHE|DCACHE)	/* flush both caches              */ - -#endif	/* _ASM_CACHECTL */ diff --git a/arch/blackfin/include/asm/cacheflush.h b/arch/blackfin/include/asm/cacheflush.h index 2666ff8ea95..9a5b2c572eb 100644 --- a/arch/blackfin/include/asm/cacheflush.h +++ b/arch/blackfin/include/asm/cacheflush.h @@ -11,6 +11,9 @@  #include <asm/blackfin.h>	/* for SSYNC() */  #include <asm/sections.h>	/* for _ramend */ +#ifdef CONFIG_SMP +#include <asm/smp.h> +#endif  extern void blackfin_icache_flush_range(unsigned long start_address, unsigned long end_address);  extern void blackfin_dcache_flush_range(unsigned long start_address, unsigned long end_address); @@ -36,8 +39,13 @@ extern void blackfin_invalidate_entire_icache(void);  static inline void flush_icache_range(unsigned start, unsigned end)  { -#if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) || defined(CONFIG_BFIN_L2_WRITEBACK) -	blackfin_dcache_flush_range(start, end); +#if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) +	if (end <= physical_mem_end) +		blackfin_dcache_flush_range(start, end); +#endif +#if defined(CONFIG_BFIN_L2_WRITEBACK) +	if (start >= L2_START && end <= L2_START + L2_LENGTH) +		blackfin_dcache_flush_range(start, end);  #endif  	/* Make sure all write buffers in the data side of the core @@ -49,9 +57,17 @@ static inline void flush_icache_range(unsigned start, unsigned end)  	 * the pipeline.  	 */  	SSYNC(); -#if defined(CONFIG_BFIN_ICACHE) -	blackfin_icache_flush_range(start, end); -	flush_icache_range_others(start, end); +#if defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) +	if (end <= physical_mem_end) { +		blackfin_icache_flush_range(start, end); +		flush_icache_range_others(start, end); +	} +#endif +#if defined(CONFIG_BFIN_L2_ICACHEABLE) +	if (start >= L2_START && end <= L2_START + L2_LENGTH) { +		blackfin_icache_flush_range(start, end); +		flush_icache_range_others(start, end); +	}  #endif  } diff --git a/arch/blackfin/include/asm/clkdev.h b/arch/blackfin/include/asm/clkdev.h new file mode 100644 index 00000000000..7ac2436856a --- /dev/null +++ b/arch/blackfin/include/asm/clkdev.h @@ -0,0 +1,16 @@ +#ifndef __ASM_CLKDEV__H_ +#define __ASM_CLKDEV__H_ + +#include <linux/slab.h> + +static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) +{ +	return kzalloc(size, GFP_KERNEL); +} + +#ifndef CONFIG_COMMON_CLK +#define __clk_put(clk) +#define __clk_get(clk) ({ 1; }) +#endif + +#endif diff --git a/arch/blackfin/include/asm/clocks.h b/arch/blackfin/include/asm/clocks.h index 6f0b61852f5..9b3c85b3c28 100644 --- a/arch/blackfin/include/asm/clocks.h +++ b/arch/blackfin/include/asm/clocks.h @@ -48,4 +48,27 @@  # define CONFIG_VCO_MULT 0  #endif +#include <linux/clk.h> + +struct clk_ops { +	unsigned long (*get_rate)(struct clk *clk); +	unsigned long (*round_rate)(struct clk *clk, unsigned long rate); +	int (*set_rate)(struct clk *clk, unsigned long rate); +	int (*enable)(struct clk *clk); +	int (*disable)(struct clk *clk); +}; + +struct clk { +	struct clk		*parent; +	const char              *name; +	unsigned long           rate; +	spinlock_t              lock; +	u32                     flags; +	const struct clk_ops    *ops; +	void __iomem            *reg; +	u32                     mask; +	u32                     shift; +}; + +int clk_init(void);  #endif diff --git a/arch/blackfin/include/asm/system.h b/arch/blackfin/include/asm/cmpxchg.h index 19e2c7c3e63..c05868cc61c 100644 --- a/arch/blackfin/include/asm/system.h +++ b/arch/blackfin/include/asm/cmpxchg.h @@ -1,31 +1,16 @@  /* - * Copyright 2004-2009 Analog Devices Inc. - *               Tony Kou (tonyko@lineo.ca) + * Copyright 2004-2011 Analog Devices Inc.   * - * Licensed under the GPL-2 or later + * Licensed under the GPL-2 or later.   */ -#ifndef _BLACKFIN_SYSTEM_H -#define _BLACKFIN_SYSTEM_H +#ifndef __ARCH_BLACKFIN_CMPXCHG__ +#define __ARCH_BLACKFIN_CMPXCHG__ -#include <linux/linkage.h> -#include <linux/irqflags.h> -#include <mach/anomaly.h> -#include <asm/cache.h> -#include <asm/pda.h> -#include <asm/irq.h> +#ifdef CONFIG_SMP -/* - * Force strict CPU ordering. - */ -#define nop()  __asm__ __volatile__ ("nop;\n\t" : : ) -#define mb()   __asm__ __volatile__ (""   : : : "memory") -#define rmb()  __asm__ __volatile__ (""   : : : "memory") -#define wmb()  __asm__ __volatile__ (""   : : : "memory") -#define set_mb(var, value) do { (void) xchg(&var, value); } while (0) -#define read_barrier_depends() 		do { } while(0) +#include <linux/linkage.h> -#ifdef CONFIG_SMP  asmlinkage unsigned long __raw_xchg_1_asm(volatile void *ptr, unsigned long value);  asmlinkage unsigned long __raw_xchg_2_asm(volatile void *ptr, unsigned long value);  asmlinkage unsigned long __raw_xchg_4_asm(volatile void *ptr, unsigned long value); @@ -36,19 +21,6 @@ asmlinkage unsigned long __raw_cmpxchg_2_asm(volatile void *ptr,  asmlinkage unsigned long __raw_cmpxchg_4_asm(volatile void *ptr,  					unsigned long new, unsigned long old); -#ifdef __ARCH_SYNC_CORE_DCACHE -# define smp_mb()	do { barrier(); smp_check_barrier(); smp_mark_barrier(); } while (0) -# define smp_rmb()	do { barrier(); smp_check_barrier(); } while (0) -# define smp_wmb()	do { barrier(); smp_mark_barrier(); } while (0) -#define smp_read_barrier_depends()	do { barrier(); smp_check_barrier(); } while (0) - -#else -# define smp_mb()	barrier() -# define smp_rmb()	barrier() -# define smp_wmb()	barrier() -#define smp_read_barrier_depends()	barrier() -#endif -  static inline unsigned long __xchg(unsigned long x, volatile void *ptr,  				   int size)  { @@ -99,18 +71,14 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,  #else /* !CONFIG_SMP */ -#define smp_mb()	barrier() -#define smp_rmb()	barrier() -#define smp_wmb()	barrier() -#define smp_read_barrier_depends()	do { } while(0) +#include <mach/blackfin.h> +#include <asm/irqflags.h>  struct __xchg_dummy {  	unsigned long a[100];  };  #define __xg(x) ((volatile struct __xchg_dummy *)(x)) -#include <mach/blackfin.h> -  static inline unsigned long __xchg(unsigned long x, volatile void *ptr,  				   int size)  { @@ -154,39 +122,12 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,  			(unsigned long)(n), sizeof(*(ptr))))  #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) -#include <asm-generic/cmpxchg.h> +#define cmpxchg(ptr, o, n)	cmpxchg_local((ptr), (o), (n)) +#define cmpxchg64(ptr, o, n)	cmpxchg64_local((ptr), (o), (n))  #endif /* !CONFIG_SMP */  #define xchg(ptr, x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))  #define tas(ptr) ((void)xchg((ptr), 1)) -#define prepare_to_switch()     do { } while(0) - -/* - * switch_to(n) should switch tasks to task ptr, first checking that - * ptr isn't the current task, in which case it does nothing. - */ - -#include <asm/l1layout.h> -#include <asm/mem_map.h> - -asmlinkage struct task_struct *resume(struct task_struct *prev, struct task_struct *next); - -#ifndef CONFIG_SMP -#define switch_to(prev,next,last) \ -do {    \ -	memcpy (&task_thread_info(prev)->l1_task_info, L1_SCRATCH_TASK_INFO, \ -		sizeof *L1_SCRATCH_TASK_INFO); \ -	memcpy (L1_SCRATCH_TASK_INFO, &task_thread_info(next)->l1_task_info, \ -		sizeof *L1_SCRATCH_TASK_INFO); \ -	(last) = resume (prev, next);   \ -} while (0) -#else -#define switch_to(prev, next, last) \ -do {    \ -	(last) = resume(prev, next);   \ -} while (0) -#endif - -#endif	/* _BLACKFIN_SYSTEM_H */ +#endif /* __ARCH_BLACKFIN_CMPXCHG__ */ diff --git a/arch/blackfin/include/asm/context.S b/arch/blackfin/include/asm/context.S index 1f9060395a0..507e7aa6a56 100644 --- a/arch/blackfin/include/asm/context.S +++ b/arch/blackfin/include/asm/context.S @@ -396,3 +396,12 @@  	call \func;  #endif  .endm + +#if defined(CONFIG_BFIN_SCRATCH_REG_RETN) +# define EX_SCRATCH_REG RETN +#elif defined(CONFIG_BFIN_SCRATCH_REG_RETE) +# define EX_SCRATCH_REG RETE +#else +# define EX_SCRATCH_REG CYCLES +#endif + diff --git a/arch/blackfin/include/asm/cplb.h b/arch/blackfin/include/asm/cplb.h index fda96261ed6..5c37f620c4b 100644 --- a/arch/blackfin/include/asm/cplb.h +++ b/arch/blackfin/include/asm/cplb.h @@ -62,6 +62,10 @@  #define SIZE_4K 0x00001000      /* 4K */  #define SIZE_1M 0x00100000      /* 1M */  #define SIZE_4M 0x00400000      /* 4M */ +#define SIZE_16K 0x00004000      /* 16K */ +#define SIZE_64K 0x00010000      /* 64K */ +#define SIZE_16M 0x01000000      /* 16M */ +#define SIZE_64M 0x04000000      /* 64M */  #define MAX_CPLBS 16 diff --git a/arch/blackfin/include/asm/cpu.h b/arch/blackfin/include/asm/cpu.h index 16883e582e3..e349631c829 100644 --- a/arch/blackfin/include/asm/cpu.h +++ b/arch/blackfin/include/asm/cpu.h @@ -10,13 +10,13 @@  #include <linux/percpu.h> -struct task_struct; -  struct blackfin_cpudata {  	struct cpu cpu; -	struct task_struct *idle;  	unsigned int imemctl;  	unsigned int dmemctl; +#ifdef CONFIG_SMP +	struct task_struct *idle; +#endif  };  DECLARE_PER_CPU(struct blackfin_cpudata, cpu_data); diff --git a/arch/blackfin/include/asm/cputime.h b/arch/blackfin/include/asm/cputime.h deleted file mode 100644 index 6d68ad7e0ea..00000000000 --- a/arch/blackfin/include/asm/cputime.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/cputime.h> diff --git a/arch/blackfin/include/asm/current.h b/arch/blackfin/include/asm/current.h deleted file mode 100644 index 4c51401b553..00000000000 --- a/arch/blackfin/include/asm/current.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/current.h> diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h index e3f0f4c4981..c5c8d8a3a5f 100644 --- a/arch/blackfin/include/asm/def_LPBlackfin.h +++ b/arch/blackfin/include/asm/def_LPBlackfin.h @@ -3,7 +3,7 @@   *   * Copyright 2005-2008 Analog Devices Inc.   * - * Licensed under the ADI BSD license or GPL-2 (or later). + * Licensed under the Clear BSD license or GPL-2 (or later).   */  #ifndef _DEF_LPBLACKFIN_H @@ -52,20 +52,32 @@  #define bfin_read(addr) \  ({ \ -    sizeof(*(addr)) == 1 ? bfin_read8(addr)  : \ -    sizeof(*(addr)) == 2 ? bfin_read16(addr) : \ -    sizeof(*(addr)) == 4 ? bfin_read32(addr) : \ -    ({ BUG(); 0; }); \ +	sizeof(*(addr)) == 1 ? bfin_read8(addr)  : \ +	sizeof(*(addr)) == 2 ? bfin_read16(addr) : \ +	sizeof(*(addr)) == 4 ? bfin_read32(addr) : \ +	({ BUG(); 0; }); \  })  #define bfin_write(addr, val) \ -({ \ +do { \  	switch (sizeof(*(addr))) { \  	case 1: bfin_write8(addr, val);  break; \  	case 2: bfin_write16(addr, val); break; \  	case 4: bfin_write32(addr, val); break; \  	default: BUG(); \  	} \ -}) +} while (0) + +#define bfin_write_or(addr, bits) \ +do { \ +	typeof(addr) __addr = (addr); \ +	bfin_write(__addr, bfin_read(__addr) | (bits)); \ +} while (0) + +#define bfin_write_and(addr, bits) \ +do { \ +	typeof(addr) __addr = (addr); \ +	bfin_write(__addr, bfin_read(__addr) & (bits)); \ +} while (0)  #endif /* __ASSEMBLY__ */ @@ -532,6 +544,7 @@  #define DCBS_P			0x04	/* L1 Data Cache Bank Select */  #define PORT_PREF0_P		0x12	/* DAG0 Port Preference */  #define PORT_PREF1_P		0x13	/* DAG1 Port Preference */ +#define RDCHK			0x9	/* Enable L1 Parity Check */  /* Masks */  #define ENDM               0x00000001	/* (doesn't really exist) Enable @@ -610,6 +623,12 @@  #define PAGE_SIZE_4KB      0x00010000	/* 4 KB page size */  #define PAGE_SIZE_1MB      0x00020000	/* 1 MB page size */  #define PAGE_SIZE_4MB      0x00030000	/* 4 MB page size */ +#ifdef CONFIG_BF60x +#define PAGE_SIZE_16KB     0x00040000	/* 16 KB page size */ +#define PAGE_SIZE_64KB     0x00050000	/* 64 KB page size */ +#define PAGE_SIZE_16MB     0x00060000	/* 16 MB page size */ +#define PAGE_SIZE_64MB     0x00070000	/* 64 MB page size */ +#endif  #define CPLB_L1SRAM        0x00000020	/* 0=SRAM mapped in L1, 0=SRAM not  					 * mapped to L1  					 */ diff --git a/arch/blackfin/include/asm/device.h b/arch/blackfin/include/asm/device.h deleted file mode 100644 index f0a4c256403..00000000000 --- a/arch/blackfin/include/asm/device.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/device.h> diff --git a/arch/blackfin/include/asm/div64.h b/arch/blackfin/include/asm/div64.h deleted file mode 100644 index 6cd978cefb2..00000000000 --- a/arch/blackfin/include/asm/div64.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/div64.h> diff --git a/arch/blackfin/include/asm/dma-mapping.h b/arch/blackfin/include/asm/dma-mapping.h index bbf461076a0..054d9ec57d9 100644 --- a/arch/blackfin/include/asm/dma-mapping.h +++ b/arch/blackfin/include/asm/dma-mapping.h @@ -154,4 +154,14 @@ dma_cache_sync(struct device *dev, void *vaddr, size_t size,  	_dma_sync((dma_addr_t)vaddr, size, dir);  } +/* drivers/base/dma-mapping.c */ +extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, +			   void *cpu_addr, dma_addr_t dma_addr, size_t size); +extern int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, +				  void *cpu_addr, dma_addr_t dma_addr, +				  size_t size); + +#define dma_mmap_coherent(d, v, c, h, s) dma_common_mmap(d, v, c, h, s) +#define dma_get_sgtable(d, t, v, h, s) dma_common_get_sgtable(d, t, v, h, s) +  #endif				/* _BLACKFIN_DMA_MAPPING_H */ diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h index eedf3ca65ba..40e9c2bbc6e 100644 --- a/arch/blackfin/include/asm/dma.h +++ b/arch/blackfin/include/asm/dma.h @@ -10,44 +10,11 @@  #include <linux/interrupt.h>  #include <mach/dma.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/blackfin.h>  #include <asm/page.h>  #include <asm-generic/dma.h> - -/* DMA_CONFIG Masks */ -#define DMAEN			0x0001	/* DMA Channel Enable */ -#define WNR				0x0002	/* Channel Direction (W/R*) */ -#define WDSIZE_8		0x0000	/* Transfer Word Size = 8 */ -#define WDSIZE_16		0x0004	/* Transfer Word Size = 16 */ -#define WDSIZE_32		0x0008	/* Transfer Word Size = 32 */ -#define DMA2D			0x0010	/* DMA Mode (2D/1D*) */ -#define RESTART			0x0020	/* DMA Buffer Clear */ -#define DI_SEL			0x0040	/* Data Interrupt Timing Select */ -#define DI_EN			0x0080	/* Data Interrupt Enable */ -#define NDSIZE_0		0x0000	/* Next Descriptor Size = 0 (Stop/Autobuffer) */ -#define NDSIZE_1		0x0100	/* Next Descriptor Size = 1 */ -#define NDSIZE_2		0x0200	/* Next Descriptor Size = 2 */ -#define NDSIZE_3		0x0300	/* Next Descriptor Size = 3 */ -#define NDSIZE_4		0x0400	/* Next Descriptor Size = 4 */ -#define NDSIZE_5		0x0500	/* Next Descriptor Size = 5 */ -#define NDSIZE_6		0x0600	/* Next Descriptor Size = 6 */ -#define NDSIZE_7		0x0700	/* Next Descriptor Size = 7 */ -#define NDSIZE_8		0x0800	/* Next Descriptor Size = 8 */ -#define NDSIZE_9		0x0900	/* Next Descriptor Size = 9 */ -#define NDSIZE			0x0f00	/* Next Descriptor Size */ -#define DMAFLOW			0x7000	/* Flow Control */ -#define DMAFLOW_STOP	0x0000	/* Stop Mode */ -#define DMAFLOW_AUTO	0x1000	/* Autobuffer Mode */ -#define DMAFLOW_ARRAY	0x4000	/* Descriptor Array Mode */ -#define DMAFLOW_SMALL	0x6000	/* Small Model Descriptor List Mode */ -#define DMAFLOW_LARGE	0x7000	/* Large Model Descriptor List Mode */ - -/* DMA_IRQ_STATUS Masks */ -#define DMA_DONE		0x0001	/* DMA Completion Interrupt Status */ -#define DMA_ERR			0x0002	/* DMA Error Interrupt Status */ -#define DFETCH			0x0004	/* DMA Descriptor Fetch Indicator */ -#define DMA_RUN			0x0008	/* DMA Channel Running Indicator */ +#include <asm/bfin_dma.h>  /*-------------------------   * config reg bits value @@ -55,12 +22,22 @@  #define DATA_SIZE_8			0  #define DATA_SIZE_16		1  #define DATA_SIZE_32		2 +#ifdef CONFIG_BF60x +#define DATA_SIZE_64		3 +#endif  #define DMA_FLOW_STOP		0  #define DMA_FLOW_AUTO		1 +#ifdef CONFIG_BF60x +#define DMA_FLOW_LIST		4 +#define DMA_FLOW_ARRAY		5 +#define DMA_FLOW_LIST_DEMAND	6 +#define DMA_FLOW_ARRAY_DEMAND	7 +#else  #define DMA_FLOW_ARRAY		4  #define DMA_FLOW_SMALL		6  #define DMA_FLOW_LARGE		7 +#endif  #define DIMENSION_LINEAR	0  #define DIMENSION_2D		1 @@ -69,26 +46,80 @@  #define DIR_WRITE			1  #define INTR_DISABLE		0 +#ifdef CONFIG_BF60x +#define INTR_ON_PERI			1 +#endif  #define INTR_ON_BUF			2  #define INTR_ON_ROW			3  #define DMA_NOSYNC_KEEP_DMA_BUF	0  #define DMA_SYNC_RESTART		1 +#ifdef DMA_MMR_SIZE_32 +#define DMA_MMR_SIZE_TYPE long +#define DMA_MMR_READ bfin_read32 +#define DMA_MMR_WRITE bfin_write32 +#else +#define DMA_MMR_SIZE_TYPE short +#define DMA_MMR_READ bfin_read16 +#define DMA_MMR_WRITE bfin_write16 +#endif + +struct dma_desc_array { +	unsigned long start_addr; +	unsigned DMA_MMR_SIZE_TYPE cfg; +	unsigned DMA_MMR_SIZE_TYPE x_count; +	DMA_MMR_SIZE_TYPE x_modify; +} __attribute__((packed)); +  struct dmasg {  	void *next_desc_addr;  	unsigned long start_addr; -	unsigned short cfg; -	unsigned short x_count; -	short x_modify; -	unsigned short y_count; -	short y_modify; +	unsigned DMA_MMR_SIZE_TYPE cfg; +	unsigned DMA_MMR_SIZE_TYPE x_count; +	DMA_MMR_SIZE_TYPE x_modify; +	unsigned DMA_MMR_SIZE_TYPE y_count; +	DMA_MMR_SIZE_TYPE y_modify;  } __attribute__((packed));  struct dma_register {  	void *next_desc_ptr;	/* DMA Next Descriptor Pointer register */  	unsigned long start_addr;	/* DMA Start address  register */ +#ifdef CONFIG_BF60x +	unsigned long cfg;	/* DMA Configuration register */ + +	unsigned long x_count;	/* DMA x_count register */ + +	long x_modify;	/* DMA x_modify register */ + +	unsigned long y_count;	/* DMA y_count register */ + +	long y_modify;	/* DMA y_modify register */ + +	unsigned long reserved; +	unsigned long reserved2; +	void *curr_desc_ptr;	/* DMA Current Descriptor Pointer +					   register */ +	void *prev_desc_ptr;	/* DMA previous initial Descriptor Pointer +					   register */ +	unsigned long curr_addr_ptr;	/* DMA Current Address Pointer +						   register */ +	unsigned long irq_status;	/* DMA irq status register */ + +	unsigned long curr_x_count;	/* DMA Current x-count register */ + +	unsigned long curr_y_count;	/* DMA Current y-count register */ + +	unsigned long reserved3; + +	unsigned long bw_limit_count;	/* DMA band width limit count register */ +	unsigned long curr_bw_limit_count;	/* DMA Current band width limit +							count register */ +	unsigned long bw_monitor_count;	/* DMA band width limit count register */ +	unsigned long curr_bw_monitor_count;	/* DMA Current band width limit +							count register */ +#else  	unsigned short cfg;	/* DMA Configuration register */  	unsigned short dummy1;	/* DMA Configuration register */ @@ -125,6 +156,7 @@ struct dma_register {  	unsigned short dummy9;  	unsigned long reserved3; +#endif  }; @@ -149,7 +181,7 @@ void blackfin_dma_resume(void);  *	DMA API's  *******************************************************************************/  extern struct dma_channel dma_ch[MAX_DMA_CHANNELS]; -extern struct dma_register *dma_io_base_addr[MAX_DMA_CHANNELS]; +extern struct dma_register * const dma_io_base_addr[MAX_DMA_CHANNELS];  extern int channel2irq(unsigned int channel);  static inline void set_dma_start_addr(unsigned int channel, unsigned long addr) @@ -164,23 +196,23 @@ static inline void set_dma_curr_desc_addr(unsigned int channel, void *addr)  {  	dma_ch[channel].regs->curr_desc_ptr = addr;  } -static inline void set_dma_x_count(unsigned int channel, unsigned short x_count) +static inline void set_dma_x_count(unsigned int channel, unsigned DMA_MMR_SIZE_TYPE x_count)  {  	dma_ch[channel].regs->x_count = x_count;  } -static inline void set_dma_y_count(unsigned int channel, unsigned short y_count) +static inline void set_dma_y_count(unsigned int channel, unsigned DMA_MMR_SIZE_TYPE y_count)  {  	dma_ch[channel].regs->y_count = y_count;  } -static inline void set_dma_x_modify(unsigned int channel, short x_modify) +static inline void set_dma_x_modify(unsigned int channel, DMA_MMR_SIZE_TYPE x_modify)  {  	dma_ch[channel].regs->x_modify = x_modify;  } -static inline void set_dma_y_modify(unsigned int channel, short y_modify) +static inline void set_dma_y_modify(unsigned int channel, DMA_MMR_SIZE_TYPE y_modify)  {  	dma_ch[channel].regs->y_modify = y_modify;  } -static inline void set_dma_config(unsigned int channel, unsigned short config) +static inline void set_dma_config(unsigned int channel, unsigned DMA_MMR_SIZE_TYPE config)  {  	dma_ch[channel].regs->cfg = config;  } @@ -189,23 +221,55 @@ static inline void set_dma_curr_addr(unsigned int channel, unsigned long addr)  	dma_ch[channel].regs->curr_addr_ptr = addr;  } -static inline unsigned short +#ifdef CONFIG_BF60x +static inline unsigned long +set_bfin_dma_config2(char direction, char flow_mode, char intr_mode, +		     char dma_mode, char mem_width, char syncmode, char peri_width) +{ +	unsigned long config = 0; + +	switch (intr_mode) { +	case INTR_ON_BUF: +		if (dma_mode == DIMENSION_2D) +			config = DI_EN_Y; +		else +			config = DI_EN_X; +		break; +	case INTR_ON_ROW: +		config = DI_EN_X; +		break; +	case INTR_ON_PERI: +		config = DI_EN_P; +		break; +	}; + +	return config | (direction << 1) | (mem_width << 8) | (dma_mode << 26) | +		(flow_mode << 12) | (syncmode << 2) | (peri_width << 4); +} +#endif + +static inline unsigned DMA_MMR_SIZE_TYPE  set_bfin_dma_config(char direction, char flow_mode, -		    char intr_mode, char dma_mode, char width, char syncmode) +		    char intr_mode, char dma_mode, char mem_width, char syncmode)  { -	return (direction << 1) | (width << 2) | (dma_mode << 4) | +#ifdef CONFIG_BF60x +	return set_bfin_dma_config2(direction, flow_mode, intr_mode, dma_mode, +		mem_width, syncmode, mem_width); +#else +	return (direction << 1) | (mem_width << 2) | (dma_mode << 4) |  		(intr_mode << 6) | (flow_mode << 12) | (syncmode << 5); +#endif  } -static inline unsigned short get_dma_curr_irqstat(unsigned int channel) +static inline unsigned DMA_MMR_SIZE_TYPE get_dma_curr_irqstat(unsigned int channel)  {  	return dma_ch[channel].regs->irq_status;  } -static inline unsigned short get_dma_curr_xcount(unsigned int channel) +static inline unsigned DMA_MMR_SIZE_TYPE get_dma_curr_xcount(unsigned int channel)  {  	return dma_ch[channel].regs->curr_x_count;  } -static inline unsigned short get_dma_curr_ycount(unsigned int channel) +static inline unsigned DMA_MMR_SIZE_TYPE get_dma_curr_ycount(unsigned int channel)  {  	return dma_ch[channel].regs->curr_y_count;  } @@ -217,7 +281,7 @@ static inline void *get_dma_curr_desc_ptr(unsigned int channel)  {  	return dma_ch[channel].regs->curr_desc_ptr;  } -static inline unsigned short get_dma_config(unsigned int channel) +static inline unsigned DMA_MMR_SIZE_TYPE get_dma_config(unsigned int channel)  {  	return dma_ch[channel].regs->cfg;  } @@ -236,8 +300,8 @@ static inline void set_dma_sg(unsigned int channel, struct dmasg *sg, int ndsize  	dma_ch[channel].regs->next_desc_ptr = sg;  	dma_ch[channel].regs->cfg = -		(dma_ch[channel].regs->cfg & ~(0xf << 8)) | -		((ndsize & 0xf) << 8); +		(dma_ch[channel].regs->cfg & ~NDSIZE) | +		((ndsize << NDSIZE_OFFSET) & NDSIZE);  }  static inline int dma_channel_active(unsigned int channel) @@ -272,7 +336,7 @@ static inline void dma_enable_irq(unsigned int channel)  }  static inline void clear_dma_irqstat(unsigned int channel)  { -	dma_ch[channel].regs->irq_status = DMA_DONE | DMA_ERR; +	dma_ch[channel].regs->irq_status = DMA_DONE | DMA_ERR | DMA_PIRQ;  }  void *dma_memcpy(void *dest, const void *src, size_t count); diff --git a/arch/blackfin/include/asm/dpmc.h b/arch/blackfin/include/asm/dpmc.h index efcc3aebeae..2673b11376f 100644 --- a/arch/blackfin/include/asm/dpmc.h +++ b/arch/blackfin/include/asm/dpmc.h @@ -9,6 +9,653 @@  #ifndef _BLACKFIN_DPMC_H_  #define _BLACKFIN_DPMC_H_ +#ifdef __ASSEMBLY__ +#define PM_REG0  R7 +#define PM_REG1  R6 +#define PM_REG2  R5 +#define PM_REG3  R4 +#define PM_REG4  R3 +#define PM_REG5  R2 +#define PM_REG6  R1 +#define PM_REG7  R0 +#define PM_REG8  P5 +#define PM_REG9  P4 +#define PM_REG10 P3 +#define PM_REG11 P2 +#define PM_REG12 P1 +#define PM_REG13 P0 + +#define PM_REGSET0  R7:7 +#define PM_REGSET1  R7:6 +#define PM_REGSET2  R7:5 +#define PM_REGSET3  R7:4 +#define PM_REGSET4  R7:3 +#define PM_REGSET5  R7:2 +#define PM_REGSET6  R7:1 +#define PM_REGSET7  R7:0 +#define PM_REGSET8  R7:0, P5:5 +#define PM_REGSET9  R7:0, P5:4 +#define PM_REGSET10 R7:0, P5:3 +#define PM_REGSET11 R7:0, P5:2 +#define PM_REGSET12 R7:0, P5:1 +#define PM_REGSET13 R7:0, P5:0 + +#define _PM_PUSH(n, x, w, base) PM_REG##n = w[FP + ((x) - (base))]; +#define _PM_POP(n, x, w, base)  w[FP + ((x) - (base))] = PM_REG##n; +#define PM_PUSH_SYNC(n)         [--sp] = (PM_REGSET##n); +#define PM_POP_SYNC(n)          (PM_REGSET##n) = [sp++]; +#define PM_PUSH(n, x)		PM_REG##n = [FP++]; +#define PM_POP(n, x)            [FP--] = PM_REG##n; +#define PM_CORE_PUSH(n, x)      _PM_PUSH(n, x, , COREMMR_BASE) +#define PM_CORE_POP(n, x)       _PM_POP(n, x, , COREMMR_BASE) +#define PM_SYS_PUSH(n, x)       _PM_PUSH(n, x, , SYSMMR_BASE) +#define PM_SYS_POP(n, x)        _PM_POP(n, x, , SYSMMR_BASE) +#define PM_SYS_PUSH16(n, x)     _PM_PUSH(n, x, w, SYSMMR_BASE) +#define PM_SYS_POP16(n, x)      _PM_POP(n, x, w, SYSMMR_BASE) + +	.macro bfin_init_pm_bench_cycles +#ifdef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH +	R4 = 0; +	CYCLES = R4; +	CYCLES2 = R4; +	R4 = SYSCFG; +	BITSET(R4, 1); +	SYSCFG = R4; +#endif +	.endm + +	.macro bfin_cpu_reg_save +	/* +	 * Save the core regs early so we can blow them away when +	 * saving/restoring MMR states +	 */ +	[--sp] = (R7:0, P5:0); +	[--sp] = fp; +	[--sp] = usp; + +	[--sp] = i0; +	[--sp] = i1; +	[--sp] = i2; +	[--sp] = i3; + +	[--sp] = m0; +	[--sp] = m1; +	[--sp] = m2; +	[--sp] = m3; + +	[--sp] = l0; +	[--sp] = l1; +	[--sp] = l2; +	[--sp] = l3; + +	[--sp] = b0; +	[--sp] = b1; +	[--sp] = b2; +	[--sp] = b3; +	[--sp] = a0.x; +	[--sp] = a0.w; +	[--sp] = a1.x; +	[--sp] = a1.w; + +	[--sp] = LC0; +	[--sp] = LC1; +	[--sp] = LT0; +	[--sp] = LT1; +	[--sp] = LB0; +	[--sp] = LB1; + +	/* We can't push RETI directly as that'll change IPEND[4] */ +	r7 = RETI; +	[--sp] = RETS; +	[--sp] = ASTAT; +#ifndef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH +	[--sp] = CYCLES; +	[--sp] = CYCLES2; +#endif +	[--sp] = SYSCFG; +	[--sp] = RETX; +	[--sp] = SEQSTAT; +	[--sp] = r7; + +	/* Save first func arg in M3 */ +	M3 = R0; +	.endm + +	.macro bfin_cpu_reg_restore +	/* Restore Core Registers */ +	RETI = [sp++]; +	SEQSTAT = [sp++]; +	RETX = [sp++]; +	SYSCFG = [sp++]; +#ifndef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH +	CYCLES2 = [sp++]; +	CYCLES = [sp++]; +#endif +	ASTAT = [sp++]; +	RETS = [sp++]; + +	LB1 = [sp++]; +	LB0 = [sp++]; +	LT1 = [sp++]; +	LT0 = [sp++]; +	LC1 = [sp++]; +	LC0 = [sp++]; + +	a1.w = [sp++]; +	a1.x = [sp++]; +	a0.w = [sp++]; +	a0.x = [sp++]; +	b3 = [sp++]; +	b2 = [sp++]; +	b1 = [sp++]; +	b0 = [sp++]; + +	l3 = [sp++]; +	l2 = [sp++]; +	l1 = [sp++]; +	l0 = [sp++]; + +	m3 = [sp++]; +	m2 = [sp++]; +	m1 = [sp++]; +	m0 = [sp++]; + +	i3 = [sp++]; +	i2 = [sp++]; +	i1 = [sp++]; +	i0 = [sp++]; + +	usp = [sp++]; +	fp = [sp++]; +	(R7:0, P5:0) = [sp++]; + +	.endm + +	.macro bfin_sys_mmr_save +	/* Save system MMRs */ +	FP.H = hi(SYSMMR_BASE); +	FP.L = lo(SYSMMR_BASE); +#ifdef SIC_IMASK0 +	PM_SYS_PUSH(0, SIC_IMASK0) +	PM_SYS_PUSH(1, SIC_IMASK1) +# ifdef SIC_IMASK2 +	PM_SYS_PUSH(2, SIC_IMASK2) +# endif +#else +# ifdef SIC_IMASK +	PM_SYS_PUSH(0, SIC_IMASK) +# endif +#endif + +#ifdef SIC_IAR0 +	PM_SYS_PUSH(3, SIC_IAR0) +	PM_SYS_PUSH(4, SIC_IAR1) +	PM_SYS_PUSH(5, SIC_IAR2) +#endif +#ifdef SIC_IAR3 +	PM_SYS_PUSH(6, SIC_IAR3) +#endif +#ifdef SIC_IAR4 +	PM_SYS_PUSH(7, SIC_IAR4) +	PM_SYS_PUSH(8, SIC_IAR5) +	PM_SYS_PUSH(9, SIC_IAR6) +#endif +#ifdef SIC_IAR7 +	PM_SYS_PUSH(10, SIC_IAR7) +#endif +#ifdef SIC_IAR8 +	PM_SYS_PUSH(11, SIC_IAR8) +	PM_SYS_PUSH(12, SIC_IAR9) +	PM_SYS_PUSH(13, SIC_IAR10) +#endif +	PM_PUSH_SYNC(13) +#ifdef SIC_IAR11 +	PM_SYS_PUSH(0, SIC_IAR11) +#endif + +#ifdef SIC_IWR +	PM_SYS_PUSH(1, SIC_IWR) +#endif +#ifdef SIC_IWR0 +	PM_SYS_PUSH(1, SIC_IWR0) +#endif +#ifdef SIC_IWR1 +	PM_SYS_PUSH(2, SIC_IWR1) +#endif +#ifdef SIC_IWR2 +	PM_SYS_PUSH(3, SIC_IWR2) +#endif + +#ifdef PINT0_ASSIGN +	PM_SYS_PUSH(4, PINT0_MASK_SET) +	PM_SYS_PUSH(5, PINT1_MASK_SET) +	PM_SYS_PUSH(6, PINT2_MASK_SET) +	PM_SYS_PUSH(7, PINT3_MASK_SET) +	PM_SYS_PUSH(8, PINT0_ASSIGN) +	PM_SYS_PUSH(9, PINT1_ASSIGN) +	PM_SYS_PUSH(10, PINT2_ASSIGN) +	PM_SYS_PUSH(11, PINT3_ASSIGN) +	PM_SYS_PUSH(12, PINT0_INVERT_SET) +	PM_SYS_PUSH(13, PINT1_INVERT_SET) +	PM_PUSH_SYNC(13) +	PM_SYS_PUSH(0, PINT2_INVERT_SET) +	PM_SYS_PUSH(1, PINT3_INVERT_SET) +	PM_SYS_PUSH(2, PINT0_EDGE_SET) +	PM_SYS_PUSH(3, PINT1_EDGE_SET) +	PM_SYS_PUSH(4, PINT2_EDGE_SET) +	PM_SYS_PUSH(5, PINT3_EDGE_SET) +#endif + +#ifdef SYSCR +	PM_SYS_PUSH16(6, SYSCR) +#endif + +#ifdef EBIU_AMGCTL +	PM_SYS_PUSH16(7, EBIU_AMGCTL) +	PM_SYS_PUSH(8, EBIU_AMBCTL0) +	PM_SYS_PUSH(9, EBIU_AMBCTL1) +#endif +#ifdef EBIU_FCTL +	PM_SYS_PUSH(10, EBIU_MBSCTL) +	PM_SYS_PUSH(11, EBIU_MODE) +	PM_SYS_PUSH(12, EBIU_FCTL) +	PM_PUSH_SYNC(12) +#else +	PM_PUSH_SYNC(9) +#endif +	.endm + + +	.macro bfin_sys_mmr_restore +/* Restore System MMRs */ +	FP.H = hi(SYSMMR_BASE); +	FP.L = lo(SYSMMR_BASE); + +#ifdef EBIU_FCTL +	PM_POP_SYNC(12) +	PM_SYS_POP(12, EBIU_FCTL) +	PM_SYS_POP(11, EBIU_MODE) +	PM_SYS_POP(10, EBIU_MBSCTL) +#else +	PM_POP_SYNC(9) +#endif + +#ifdef EBIU_AMGCTL +	PM_SYS_POP(9, EBIU_AMBCTL1) +	PM_SYS_POP(8, EBIU_AMBCTL0) +	PM_SYS_POP16(7, EBIU_AMGCTL) +#endif + +#ifdef SYSCR +	PM_SYS_POP16(6, SYSCR) +#endif + +#ifdef PINT0_ASSIGN +	PM_SYS_POP(5, PINT3_EDGE_SET) +	PM_SYS_POP(4, PINT2_EDGE_SET) +	PM_SYS_POP(3, PINT1_EDGE_SET) +	PM_SYS_POP(2, PINT0_EDGE_SET) +	PM_SYS_POP(1, PINT3_INVERT_SET) +	PM_SYS_POP(0, PINT2_INVERT_SET) +	PM_POP_SYNC(13) +	PM_SYS_POP(13, PINT1_INVERT_SET) +	PM_SYS_POP(12, PINT0_INVERT_SET) +	PM_SYS_POP(11, PINT3_ASSIGN) +	PM_SYS_POP(10, PINT2_ASSIGN) +	PM_SYS_POP(9, PINT1_ASSIGN) +	PM_SYS_POP(8, PINT0_ASSIGN) +	PM_SYS_POP(7, PINT3_MASK_SET) +	PM_SYS_POP(6, PINT2_MASK_SET) +	PM_SYS_POP(5, PINT1_MASK_SET) +	PM_SYS_POP(4, PINT0_MASK_SET) +#endif + +#ifdef SIC_IWR2 +	PM_SYS_POP(3, SIC_IWR2) +#endif +#ifdef SIC_IWR1 +	PM_SYS_POP(2, SIC_IWR1) +#endif +#ifdef SIC_IWR0 +	PM_SYS_POP(1, SIC_IWR0) +#endif +#ifdef SIC_IWR +	PM_SYS_POP(1, SIC_IWR) +#endif + +#ifdef SIC_IAR11 +	PM_SYS_POP(0, SIC_IAR11) +#endif +	PM_POP_SYNC(13) +#ifdef SIC_IAR8 +	PM_SYS_POP(13, SIC_IAR10) +	PM_SYS_POP(12, SIC_IAR9) +	PM_SYS_POP(11, SIC_IAR8) +#endif +#ifdef SIC_IAR7 +	PM_SYS_POP(10, SIC_IAR7) +#endif +#ifdef SIC_IAR6 +	PM_SYS_POP(9, SIC_IAR6) +	PM_SYS_POP(8, SIC_IAR5) +	PM_SYS_POP(7, SIC_IAR4) +#endif +#ifdef SIC_IAR3 +	PM_SYS_POP(6, SIC_IAR3) +#endif +#ifdef SIC_IAR0 +	PM_SYS_POP(5, SIC_IAR2) +	PM_SYS_POP(4, SIC_IAR1) +	PM_SYS_POP(3, SIC_IAR0) +#endif +#ifdef SIC_IMASK0 +# ifdef SIC_IMASK2 +	PM_SYS_POP(2, SIC_IMASK2) +# endif +	PM_SYS_POP(1, SIC_IMASK1) +	PM_SYS_POP(0, SIC_IMASK0) +#else +# ifdef SIC_IMASK +	PM_SYS_POP(0, SIC_IMASK) +# endif +#endif +	.endm + +	.macro bfin_core_mmr_save +	/* Save Core MMRs */ +	I0.H = hi(COREMMR_BASE); +	I0.L = lo(COREMMR_BASE); +	I1 = I0; +	I2 = I0; +	I3 = I0; +	B0 = I0; +	B1 = I0; +	B2 = I0; +	B3 = I0; +	I1.L = lo(DCPLB_ADDR0); +	I2.L = lo(DCPLB_DATA0); +	I3.L = lo(ICPLB_ADDR0); +	B0.L = lo(ICPLB_DATA0); +	B1.L = lo(EVT2); +	B2.L = lo(IMASK); +	B3.L = lo(TCNTL); + +	/* Event Vectors */ +	FP = B1; +	PM_PUSH(0, EVT2) +	PM_PUSH(1, EVT3) +	FP += 4;	/* EVT4 */ +	PM_PUSH(2, EVT5) +	PM_PUSH(3, EVT6) +	PM_PUSH(4, EVT7) +	PM_PUSH(5, EVT8) +	PM_PUSH_SYNC(5) + +	PM_PUSH(0, EVT9) +	PM_PUSH(1, EVT10) +	PM_PUSH(2, EVT11) +	PM_PUSH(3, EVT12) +	PM_PUSH(4, EVT13) +	PM_PUSH(5, EVT14) +	PM_PUSH(6, EVT15) + +	/* CEC */ +	FP = B2; +	PM_PUSH(7, IMASK) +	FP += 4;	/* IPEND */ +	PM_PUSH(8, ILAT) +	PM_PUSH(9, IPRIO) + +	/* Core Timer */ +	FP = B3; +	PM_PUSH(10, TCNTL) +	PM_PUSH(11, TPERIOD) +	PM_PUSH(12, TSCALE) +	PM_PUSH(13, TCOUNT) +	PM_PUSH_SYNC(13) + +	/* Misc non-contiguous registers */ +	FP = I0; +	PM_CORE_PUSH(0, DMEM_CONTROL); +	PM_CORE_PUSH(1, IMEM_CONTROL); +	PM_CORE_PUSH(2, TBUFCTL); +	PM_PUSH_SYNC(2) + +	/* DCPLB Addr */ +	FP = I1; +	PM_PUSH(0, DCPLB_ADDR0) +	PM_PUSH(1, DCPLB_ADDR1) +	PM_PUSH(2, DCPLB_ADDR2) +	PM_PUSH(3, DCPLB_ADDR3) +	PM_PUSH(4, DCPLB_ADDR4) +	PM_PUSH(5, DCPLB_ADDR5) +	PM_PUSH(6, DCPLB_ADDR6) +	PM_PUSH(7, DCPLB_ADDR7) +	PM_PUSH(8, DCPLB_ADDR8) +	PM_PUSH(9, DCPLB_ADDR9) +	PM_PUSH(10, DCPLB_ADDR10) +	PM_PUSH(11, DCPLB_ADDR11) +	PM_PUSH(12, DCPLB_ADDR12) +	PM_PUSH(13, DCPLB_ADDR13) +	PM_PUSH_SYNC(13) +	PM_PUSH(0, DCPLB_ADDR14) +	PM_PUSH(1, DCPLB_ADDR15) + +	/* DCPLB Data */ +	FP = I2; +	PM_PUSH(2, DCPLB_DATA0) +	PM_PUSH(3, DCPLB_DATA1) +	PM_PUSH(4, DCPLB_DATA2) +	PM_PUSH(5, DCPLB_DATA3) +	PM_PUSH(6, DCPLB_DATA4) +	PM_PUSH(7, DCPLB_DATA5) +	PM_PUSH(8, DCPLB_DATA6) +	PM_PUSH(9, DCPLB_DATA7) +	PM_PUSH(10, DCPLB_DATA8) +	PM_PUSH(11, DCPLB_DATA9) +	PM_PUSH(12, DCPLB_DATA10) +	PM_PUSH(13, DCPLB_DATA11) +	PM_PUSH_SYNC(13) +	PM_PUSH(0, DCPLB_DATA12) +	PM_PUSH(1, DCPLB_DATA13) +	PM_PUSH(2, DCPLB_DATA14) +	PM_PUSH(3, DCPLB_DATA15) + +	/* ICPLB Addr */ +	FP = I3; +	PM_PUSH(4, ICPLB_ADDR0) +	PM_PUSH(5, ICPLB_ADDR1) +	PM_PUSH(6, ICPLB_ADDR2) +	PM_PUSH(7, ICPLB_ADDR3) +	PM_PUSH(8, ICPLB_ADDR4) +	PM_PUSH(9, ICPLB_ADDR5) +	PM_PUSH(10, ICPLB_ADDR6) +	PM_PUSH(11, ICPLB_ADDR7) +	PM_PUSH(12, ICPLB_ADDR8) +	PM_PUSH(13, ICPLB_ADDR9) +	PM_PUSH_SYNC(13) +	PM_PUSH(0, ICPLB_ADDR10) +	PM_PUSH(1, ICPLB_ADDR11) +	PM_PUSH(2, ICPLB_ADDR12) +	PM_PUSH(3, ICPLB_ADDR13) +	PM_PUSH(4, ICPLB_ADDR14) +	PM_PUSH(5, ICPLB_ADDR15) + +	/* ICPLB Data */ +	FP = B0; +	PM_PUSH(6, ICPLB_DATA0) +	PM_PUSH(7, ICPLB_DATA1) +	PM_PUSH(8, ICPLB_DATA2) +	PM_PUSH(9, ICPLB_DATA3) +	PM_PUSH(10, ICPLB_DATA4) +	PM_PUSH(11, ICPLB_DATA5) +	PM_PUSH(12, ICPLB_DATA6) +	PM_PUSH(13, ICPLB_DATA7) +	PM_PUSH_SYNC(13) +	PM_PUSH(0, ICPLB_DATA8) +	PM_PUSH(1, ICPLB_DATA9) +	PM_PUSH(2, ICPLB_DATA10) +	PM_PUSH(3, ICPLB_DATA11) +	PM_PUSH(4, ICPLB_DATA12) +	PM_PUSH(5, ICPLB_DATA13) +	PM_PUSH(6, ICPLB_DATA14) +	PM_PUSH(7, ICPLB_DATA15) +	PM_PUSH_SYNC(7) +	.endm + +	.macro bfin_core_mmr_restore +	/* Restore Core MMRs */ +	I0.H = hi(COREMMR_BASE); +	I0.L = lo(COREMMR_BASE); +	I1 = I0; +	I2 = I0; +	I3 = I0; +	B0 = I0; +	B1 = I0; +	B2 = I0; +	B3 = I0; +	I1.L = lo(DCPLB_ADDR15); +	I2.L = lo(DCPLB_DATA15); +	I3.L = lo(ICPLB_ADDR15); +	B0.L = lo(ICPLB_DATA15); +	B1.L = lo(EVT15); +	B2.L = lo(IPRIO); +	B3.L = lo(TCOUNT); + +	/* ICPLB Data */ +	FP = B0; +	PM_POP_SYNC(7) +	PM_POP(7, ICPLB_DATA15) +	PM_POP(6, ICPLB_DATA14) +	PM_POP(5, ICPLB_DATA13) +	PM_POP(4, ICPLB_DATA12) +	PM_POP(3, ICPLB_DATA11) +	PM_POP(2, ICPLB_DATA10) +	PM_POP(1, ICPLB_DATA9) +	PM_POP(0, ICPLB_DATA8) +	PM_POP_SYNC(13) +	PM_POP(13, ICPLB_DATA7) +	PM_POP(12, ICPLB_DATA6) +	PM_POP(11, ICPLB_DATA5) +	PM_POP(10, ICPLB_DATA4) +	PM_POP(9, ICPLB_DATA3) +	PM_POP(8, ICPLB_DATA2) +	PM_POP(7, ICPLB_DATA1) +	PM_POP(6, ICPLB_DATA0) + +	/* ICPLB Addr */ +	FP = I3; +	PM_POP(5, ICPLB_ADDR15) +	PM_POP(4, ICPLB_ADDR14) +	PM_POP(3, ICPLB_ADDR13) +	PM_POP(2, ICPLB_ADDR12) +	PM_POP(1, ICPLB_ADDR11) +	PM_POP(0, ICPLB_ADDR10) +	PM_POP_SYNC(13) +	PM_POP(13, ICPLB_ADDR9) +	PM_POP(12, ICPLB_ADDR8) +	PM_POP(11, ICPLB_ADDR7) +	PM_POP(10, ICPLB_ADDR6) +	PM_POP(9, ICPLB_ADDR5) +	PM_POP(8, ICPLB_ADDR4) +	PM_POP(7, ICPLB_ADDR3) +	PM_POP(6, ICPLB_ADDR2) +	PM_POP(5, ICPLB_ADDR1) +	PM_POP(4, ICPLB_ADDR0) + +	/* DCPLB Data */ +	FP = I2; +	PM_POP(3, DCPLB_DATA15) +	PM_POP(2, DCPLB_DATA14) +	PM_POP(1, DCPLB_DATA13) +	PM_POP(0, DCPLB_DATA12) +	PM_POP_SYNC(13) +	PM_POP(13, DCPLB_DATA11) +	PM_POP(12, DCPLB_DATA10) +	PM_POP(11, DCPLB_DATA9) +	PM_POP(10, DCPLB_DATA8) +	PM_POP(9, DCPLB_DATA7) +	PM_POP(8, DCPLB_DATA6) +	PM_POP(7, DCPLB_DATA5) +	PM_POP(6, DCPLB_DATA4) +	PM_POP(5, DCPLB_DATA3) +	PM_POP(4, DCPLB_DATA2) +	PM_POP(3, DCPLB_DATA1) +	PM_POP(2, DCPLB_DATA0) + +	/* DCPLB Addr */ +	FP = I1; +	PM_POP(1, DCPLB_ADDR15) +	PM_POP(0, DCPLB_ADDR14) +	PM_POP_SYNC(13) +	PM_POP(13, DCPLB_ADDR13) +	PM_POP(12, DCPLB_ADDR12) +	PM_POP(11, DCPLB_ADDR11) +	PM_POP(10, DCPLB_ADDR10) +	PM_POP(9, DCPLB_ADDR9) +	PM_POP(8, DCPLB_ADDR8) +	PM_POP(7, DCPLB_ADDR7) +	PM_POP(6, DCPLB_ADDR6) +	PM_POP(5, DCPLB_ADDR5) +	PM_POP(4, DCPLB_ADDR4) +	PM_POP(3, DCPLB_ADDR3) +	PM_POP(2, DCPLB_ADDR2) +	PM_POP(1, DCPLB_ADDR1) +	PM_POP(0, DCPLB_ADDR0) + + +	/* Misc non-contiguous registers */ + +	/* icache & dcache will enable later  +	   drop IMEM_CONTROL, DMEM_CONTROL pop +	*/ +	FP = I0; +	PM_POP_SYNC(2) +	PM_CORE_POP(2, TBUFCTL) +	PM_CORE_POP(1, IMEM_CONTROL) +	PM_CORE_POP(0, DMEM_CONTROL) + +	/* Core Timer */ +	FP = B3; +	R0 = 0x1; +	[FP - 0xC] = R0; + +	PM_POP_SYNC(13) +	FP = B3; +	PM_POP(13, TCOUNT) +	PM_POP(12, TSCALE) +	PM_POP(11, TPERIOD) +	PM_POP(10, TCNTL) + +	/* CEC */ +	FP = B2; +	PM_POP(9, IPRIO) +	PM_POP(8, ILAT) +	FP += -4;	/* IPEND */ +	PM_POP(7, IMASK) + +	/* Event Vectors */ +	FP = B1; +	PM_POP(6, EVT15) +	PM_POP(5, EVT14) +	PM_POP(4, EVT13) +	PM_POP(3, EVT12) +	PM_POP(2, EVT11) +	PM_POP(1, EVT10) +	PM_POP(0, EVT9) +	PM_POP_SYNC(5) +	PM_POP(5, EVT8) +	PM_POP(4, EVT7) +	PM_POP(3, EVT6) +	PM_POP(2, EVT5) +	FP += -4;	/* EVT4 */ +	PM_POP(1, EVT3) +	PM_POP(0, EVT2) +	.endm +#endif + +#include <mach/pll.h> +  /* PLL_CTL Masks */  #define DF			0x0001	/* 0: PLL = CLKIN, 1: PLL = CLKIN/2 */  #define PLL_OFF			0x0002	/* PLL Not Powered */ @@ -96,6 +743,16 @@  #define VLEV_130		0x00F0	/* VLEV = 1.30 V (-5% - +10% Accuracy) */  #endif +#ifdef CONFIG_BF60x +#define PA15WE			0x00000001 /* Allow Wake-Up from PA15 */ +#define PB15WE			0x00000002 /* Allow Wake-Up from PB15 */ +#define PC15WE			0x00000004 /* Allow Wake-Up from PC15 */ +#define PD06WE			0x00000008 /* Allow Wake-Up from PD06(ETH0_PHYINT) */ +#define PE12WE			0x00000010 /* Allow Wake-Up from PE12(ETH1_PHYINT, PUSH BUTTON) */ +#define PG04WE			0x00000020 /* Allow Wake-Up from PG04(CAN0_RX) */ +#define PG13WE			0x00000040 /* Allow Wake-Up from PG13 */ +#define USBWE			0x00000080 /* Allow Wake-Up from (USB) */ +#else  #define WAKE			0x0100	/* Enable RTC/Reset Wakeup From Hibernate */  #define CANWE			0x0200	/* Enable CAN Wakeup From Hibernate */  #define PHYWE			0x0400	/* Enable PHY Wakeup From Hibernate */ @@ -111,11 +768,11 @@  #else  #define USBWE			0x0800	/* Enable USB Wakeup From Hibernate */  #endif +#endif  #ifndef __ASSEMBLY__  void sleep_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); -void hibernate_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);  void sleep_deeper(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);  void do_hibernate(int wakeup);  void set_dram_srfs(void); @@ -123,38 +780,15 @@ void unset_dram_srfs(void);  #define VRPAIR(vlev, freq) (((vlev) << 16) | ((freq) >> 16)) +#ifdef CONFIG_CPU_FREQ +#define CPUFREQ_CPU 0 +#endif  struct bfin_dpmc_platform_data {  	const unsigned int *tuple_tab;  	unsigned short tabsize;  	unsigned short vr_settling_time; /* in us */  }; -#else - -#define PM_PUSH(x) \ -	R0 = [P0 + (x - SRAM_BASE_ADDRESS)];\ -	[--SP] =  R0;\ - -#define PM_POP(x) \ -	R0 = [SP++];\ -	[P0 + (x - SRAM_BASE_ADDRESS)] = R0;\ - -#define PM_SYS_PUSH(x) \ -	R0 = [P0 + (x - PLL_CTL)];\ -	[--SP] =  R0;\ - -#define PM_SYS_POP(x) \ -	R0 = [SP++];\ -	[P0 + (x - PLL_CTL)] = R0;\ - -#define PM_SYS_PUSH16(x) \ -	R0 = w[P0 + (x - PLL_CTL)];\ -	[--SP] =  R0;\ - -#define PM_SYS_POP16(x) \ -	R0 = [SP++];\ -	w[P0 + (x - PLL_CTL)] = R0;\ -  #endif  #endif	/*_BLACKFIN_DPMC_H_*/ diff --git a/arch/blackfin/include/asm/elf.h b/arch/blackfin/include/asm/elf.h index e6c6812a9ab..d15cb9b5d52 100644 --- a/arch/blackfin/include/asm/elf.h +++ b/arch/blackfin/include/asm/elf.h @@ -132,6 +132,4 @@ do {											\  #define ELF_PLATFORM  (NULL) -#define SET_PERSONALITY(ex) set_personality(PER_LINUX) -  #endif diff --git a/arch/blackfin/include/asm/emergency-restart.h b/arch/blackfin/include/asm/emergency-restart.h deleted file mode 100644 index 3711bd9d50b..00000000000 --- a/arch/blackfin/include/asm/emergency-restart.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/emergency-restart.h> diff --git a/arch/blackfin/include/asm/errno.h b/arch/blackfin/include/asm/errno.h deleted file mode 100644 index 4c82b503d92..00000000000 --- a/arch/blackfin/include/asm/errno.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/errno.h> diff --git a/arch/blackfin/include/asm/exec.h b/arch/blackfin/include/asm/exec.h new file mode 100644 index 00000000000..54c2e1db274 --- /dev/null +++ b/arch/blackfin/include/asm/exec.h @@ -0,0 +1 @@ +/* define arch_align_stack() here */ diff --git a/arch/blackfin/include/asm/fb.h b/arch/blackfin/include/asm/fb.h deleted file mode 100644 index 3a4988e8df4..00000000000 --- a/arch/blackfin/include/asm/fb.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/fb.h> diff --git a/arch/blackfin/include/asm/fcntl.h b/arch/blackfin/include/asm/fcntl.h deleted file mode 100644 index 251c911d59c..00000000000 --- a/arch/blackfin/include/asm/fcntl.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2004-2008 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -#ifndef _BFIN_FCNTL_H -#define _BFIN_FCNTL_H - -#define O_DIRECTORY	 040000	/* must be a directory */ -#define O_NOFOLLOW	0100000	/* don't follow links */ -#define O_DIRECT	0200000	/* direct disk access hint - currently ignored */ -#define O_LARGEFILE	0400000 - -#include <asm-generic/fcntl.h> - -#endif diff --git a/arch/blackfin/include/asm/fixed_code.h b/arch/blackfin/include/asm/fixed_code.h index 73fe53e7fd2..bc330f06207 100644 --- a/arch/blackfin/include/asm/fixed_code.h +++ b/arch/blackfin/include/asm/fixed_code.h @@ -6,11 +6,11 @@   *   * Licensed under the GPL-2 or later.   */ -  #ifndef __BFIN_ASM_FIXED_CODE_H__  #define __BFIN_ASM_FIXED_CODE_H__ -#ifdef __KERNEL__ +#include <uapi/asm/fixed_code.h> +  #ifndef __ASSEMBLY__  #include <linux/linkage.h>  #include <linux/ptrace.h> @@ -28,25 +28,3 @@ extern void safe_user_instruction(void);  extern void sigreturn_stub(void);  #endif  #endif - -#define FIXED_CODE_START	0x400 - -#define SIGRETURN_STUB		0x400 - -#define ATOMIC_SEQS_START	0x410 - -#define ATOMIC_XCHG32		0x410 -#define ATOMIC_CAS32		0x420 -#define ATOMIC_ADD32		0x430 -#define ATOMIC_SUB32		0x440 -#define ATOMIC_IOR32		0x450 -#define ATOMIC_AND32		0x460 -#define ATOMIC_XOR32		0x470 - -#define ATOMIC_SEQS_END		0x480 - -#define SAFE_USER_INSTRUCTION   0x480 - -#define FIXED_CODE_END		0x490 - -#endif diff --git a/arch/blackfin/include/asm/ftrace.h b/arch/blackfin/include/asm/ftrace.h index 8a029505d7b..2f1c3c2657a 100644 --- a/arch/blackfin/include/asm/ftrace.h +++ b/arch/blackfin/include/asm/ftrace.h @@ -66,16 +66,7 @@ extern inline void *return_address(unsigned int level)  #endif /* CONFIG_FRAME_POINTER */ -#define HAVE_ARCH_CALLER_ADDR - -/* inline function or macro may lead to unexpected result */ -#define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) -#define CALLER_ADDR1 ((unsigned long)return_address(1)) -#define CALLER_ADDR2 ((unsigned long)return_address(2)) -#define CALLER_ADDR3 ((unsigned long)return_address(3)) -#define CALLER_ADDR4 ((unsigned long)return_address(4)) -#define CALLER_ADDR5 ((unsigned long)return_address(5)) -#define CALLER_ADDR6 ((unsigned long)return_address(6)) +#define ftrace_return_address(n) return_address(n)  #endif /* __ASSEMBLY__ */ diff --git a/arch/blackfin/include/asm/futex.h b/arch/blackfin/include/asm/futex.h deleted file mode 100644 index 0b745828f42..00000000000 --- a/arch/blackfin/include/asm/futex.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/futex.h> diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h index 1ef8417f5d2..99d338ca2ea 100644 --- a/arch/blackfin/include/asm/gpio.h +++ b/arch/blackfin/include/asm/gpio.h @@ -16,61 +16,21 @@  #include <mach/gpio.h> -#define GPIO_0	0 -#define GPIO_1	1 -#define GPIO_2	2 -#define GPIO_3	3 -#define GPIO_4	4 -#define GPIO_5	5 -#define GPIO_6	6 -#define GPIO_7	7 -#define GPIO_8	8 -#define GPIO_9	9 -#define GPIO_10	10 -#define GPIO_11	11 -#define GPIO_12	12 -#define GPIO_13	13 -#define GPIO_14	14 -#define GPIO_15	15 -#define GPIO_16	16 -#define GPIO_17	17 -#define GPIO_18	18 -#define GPIO_19	19 -#define GPIO_20	20 -#define GPIO_21	21 -#define GPIO_22	22 -#define GPIO_23	23 -#define GPIO_24	24 -#define GPIO_25	25 -#define GPIO_26	26 -#define GPIO_27	27 -#define GPIO_28	28 -#define GPIO_29	29 -#define GPIO_30	30 -#define GPIO_31	31 -#define GPIO_32	32 -#define GPIO_33	33 -#define GPIO_34	34 -#define GPIO_35	35 -#define GPIO_36	36 -#define GPIO_37	37 -#define GPIO_38	38 -#define GPIO_39	39 -#define GPIO_40	40 -#define GPIO_41	41 -#define GPIO_42	42 -#define GPIO_43	43 -#define GPIO_44	44 -#define GPIO_45	45 -#define GPIO_46	46 -#define GPIO_47	47 -  #define PERIPHERAL_USAGE 1  #define GPIO_USAGE 0 +#ifndef BFIN_GPIO_PINT +# define BFIN_GPIO_PINT 0 +#endif +  #ifndef __ASSEMBLY__ +#ifndef CONFIG_PINCTRL +  #include <linux/compiler.h> +#include <asm/blackfin.h> +#include <asm/portmux.h> +#include <asm/irq_handler.h>  /***********************************************************  * @@ -89,7 +49,6 @@  * MODIFICATION HISTORY :  **************************************************************/ -#ifndef CONFIG_BF54x  void set_gpio_dir(unsigned, unsigned short);  void set_gpio_inen(unsigned, unsigned short);  void set_gpio_polar(unsigned, unsigned short); @@ -159,31 +118,32 @@ struct gpio_port_t {  	unsigned short dummy16;  	unsigned short inen;  }; -#endif  #ifdef BFIN_SPECIAL_GPIO_BANKS  void bfin_special_gpio_free(unsigned gpio);  int bfin_special_gpio_request(unsigned gpio, const char *label); +# ifdef CONFIG_PM +void bfin_special_gpio_pm_hibernate_restore(void); +void bfin_special_gpio_pm_hibernate_suspend(void); +# endif  #endif  #ifdef CONFIG_PM -int bfin_pm_standby_ctrl(unsigned ctrl); +void bfin_gpio_pm_hibernate_restore(void); +void bfin_gpio_pm_hibernate_suspend(void); +int bfin_gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl); +int bfin_gpio_pm_standby_ctrl(unsigned ctrl);  static inline int bfin_pm_standby_setup(void)  { -	return bfin_pm_standby_ctrl(1); +	return bfin_gpio_pm_standby_ctrl(1);  }  static inline void bfin_pm_standby_restore(void)  { -	bfin_pm_standby_ctrl(0); +	bfin_gpio_pm_standby_ctrl(0);  } -void bfin_gpio_pm_hibernate_restore(void); -void bfin_gpio_pm_hibernate_suspend(void); - -#ifndef CONFIG_BF54x -int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);  struct gpio_port_s {  	unsigned short data; @@ -199,8 +159,8 @@ struct gpio_port_s {  	unsigned short reserved;  	unsigned short mux;  }; -#endif /*CONFIG_BF54x*/  #endif /*CONFIG_PM*/ +  /***********************************************************  *  * FUNCTIONS: Blackfin GPIO Driver @@ -215,36 +175,29 @@ struct gpio_port_s {  *************************************************************  * MODIFICATION HISTORY :  **************************************************************/ - -int bfin_gpio_request(unsigned gpio, const char *label); -void bfin_gpio_free(unsigned gpio);  int bfin_gpio_irq_request(unsigned gpio, const char *label);  void bfin_gpio_irq_free(unsigned gpio); -int bfin_gpio_direction_input(unsigned gpio); -int bfin_gpio_direction_output(unsigned gpio, int value); -int bfin_gpio_get_value(unsigned gpio); -void bfin_gpio_set_value(unsigned gpio, int value); +void bfin_gpio_irq_prepare(unsigned gpio); + +static inline int irq_to_gpio(unsigned irq) +{ +	return irq - GPIO_IRQ_BASE; +} +#endif /* CONFIG_PINCTRL */  #include <asm/irq.h>  #include <asm/errno.h> -#ifdef CONFIG_GPIOLIB  #include <asm-generic/gpio.h>		/* cansleep wrappers */  static inline int gpio_get_value(unsigned int gpio)  { -	if (gpio < MAX_BLACKFIN_GPIOS) -		return bfin_gpio_get_value(gpio); -	else -		return __gpio_get_value(gpio); +	return __gpio_get_value(gpio);  }  static inline void gpio_set_value(unsigned int gpio, int value)  { -	if (gpio < MAX_BLACKFIN_GPIOS) -		bfin_gpio_set_value(gpio, value); -	else -		__gpio_set_value(gpio, value); +	__gpio_set_value(gpio, value);  }  static inline int gpio_cansleep(unsigned int gpio) @@ -256,60 +209,6 @@ static inline int gpio_to_irq(unsigned gpio)  {  	return __gpio_to_irq(gpio);  } - -#else /* !CONFIG_GPIOLIB */ - -static inline int gpio_request(unsigned gpio, const char *label) -{ -	return bfin_gpio_request(gpio, label); -} - -static inline void gpio_free(unsigned gpio) -{ -	return bfin_gpio_free(gpio); -} - -static inline int gpio_direction_input(unsigned gpio) -{ -	return bfin_gpio_direction_input(gpio); -} - -static inline int gpio_direction_output(unsigned gpio, int value) -{ -	return bfin_gpio_direction_output(gpio, value); -} - -static inline int gpio_set_debounce(unsigned gpio, unsigned debounce) -{ -	return -EINVAL; -} - -static inline int gpio_get_value(unsigned gpio) -{ -	return bfin_gpio_get_value(gpio); -} - -static inline void gpio_set_value(unsigned gpio, int value) -{ -	return bfin_gpio_set_value(gpio, value); -} - -static inline int gpio_to_irq(unsigned gpio) -{ -	if (likely(gpio < MAX_BLACKFIN_GPIOS)) -		return gpio + GPIO_IRQ_BASE; - -	return -EINVAL; -} - -#include <asm-generic/gpio.h>		/* cansleep wrappers */ -#endif	/* !CONFIG_GPIOLIB */ - -static inline int irq_to_gpio(unsigned irq) -{ -	return (irq - GPIO_IRQ_BASE); -} -  #endif /* __ASSEMBLY__ */  #endif /* __ARCH_BLACKFIN_GPIO_H__ */ diff --git a/arch/blackfin/include/asm/gptimers.h b/arch/blackfin/include/asm/gptimers.h index c722acdda0d..381e3d621a4 100644 --- a/arch/blackfin/include/asm/gptimers.h +++ b/arch/blackfin/include/asm/gptimers.h @@ -44,6 +44,13 @@  # define TIMER_GROUP2          1  #endif  /* + * BF609: 8 timers: + */ +#if defined(CONFIG_BF60x) +# define MAX_BLACKFIN_GPTIMERS 8 +# define TIMER0_GROUP_REG     TIMER_RUN +#endif +/*   * All others: 3 timers:   */  #define TIMER_GROUP1           0 @@ -104,6 +111,72 @@  # define FS2_TIMER_BIT TIMER1bit  #endif +#ifdef CONFIG_BF60x +/* + * Timer Configuration Register Bits + */ +#define TIMER_EMU_RUN       0x8000 +#define TIMER_BPER_EN       0x4000 +#define TIMER_BWID_EN       0x2000 +#define TIMER_BDLY_EN       0x1000 +#define TIMER_OUT_DIS       0x0800 +#define TIMER_TIN_SEL       0x0400 +#define TIMER_CLK_SEL       0x0300 +#define TIMER_CLK_SCLK      0x0000 +#define TIMER_CLK_ALT_CLK0  0x0100 +#define TIMER_CLK_ALT_CLK1  0x0300 +#define TIMER_PULSE_HI 	    0x0080 +#define TIMER_SLAVE_TRIG    0x0040 +#define TIMER_IRQ_MODE      0x0030 +#define TIMER_IRQ_ACT_EDGE  0x0000 +#define TIMER_IRQ_DLY       0x0010 +#define TIMER_IRQ_WID_DLY   0x0020 +#define TIMER_IRQ_PER       0x0030 +#define TIMER_MODE          0x000f +#define TIMER_MODE_WDOG_P   0x0008 +#define TIMER_MODE_WDOG_W   0x0009 +#define TIMER_MODE_PWM_CONT 0x000c +#define TIMER_MODE_PWM      0x000d +#define TIMER_MODE_WDTH     0x000a +#define TIMER_MODE_WDTH_D   0x000b +#define TIMER_MODE_EXT_CLK  0x000e +#define TIMER_MODE_PININT   0x000f + +/* + * Timer Status Register Bits + */ +#define TIMER_STATUS_TIMIL0  0x0001 +#define TIMER_STATUS_TIMIL1  0x0002 +#define TIMER_STATUS_TIMIL2  0x0004 +#define TIMER_STATUS_TIMIL3  0x0008 +#define TIMER_STATUS_TIMIL4  0x0010 +#define TIMER_STATUS_TIMIL5  0x0020 +#define TIMER_STATUS_TIMIL6  0x0040 +#define TIMER_STATUS_TIMIL7  0x0080 + +#define TIMER_STATUS_TOVF0   0x0001	/* timer 0 overflow error */ +#define TIMER_STATUS_TOVF1   0x0002 +#define TIMER_STATUS_TOVF2   0x0004 +#define TIMER_STATUS_TOVF3   0x0008 +#define TIMER_STATUS_TOVF4   0x0010 +#define TIMER_STATUS_TOVF5   0x0020 +#define TIMER_STATUS_TOVF6   0x0040 +#define TIMER_STATUS_TOVF7   0x0080 + +/* + * Timer Slave Enable Status : write 1 to clear + */ +#define TIMER_STATUS_TRUN0  0x0001 +#define TIMER_STATUS_TRUN1  0x0002 +#define TIMER_STATUS_TRUN2  0x0004 +#define TIMER_STATUS_TRUN3  0x0008 +#define TIMER_STATUS_TRUN4  0x0010 +#define TIMER_STATUS_TRUN5  0x0020 +#define TIMER_STATUS_TRUN6  0x0040 +#define TIMER_STATUS_TRUN7  0x0080 + +#else +  /*   * Timer Configuration Register Bits   */ @@ -170,12 +243,18 @@  #define TIMER_STATUS_TRUN10 0x4000  #define TIMER_STATUS_TRUN11 0x8000 +#endif +  /* The actual gptimer API */  void     set_gptimer_pwidth(unsigned int timer_id, uint32_t width);  uint32_t get_gptimer_pwidth(unsigned int timer_id);  void     set_gptimer_period(unsigned int timer_id, uint32_t period);  uint32_t get_gptimer_period(unsigned int timer_id); +#ifdef CONFIG_BF60x +void     set_gptimer_delay(unsigned int timer_id, uint32_t delay); +uint32_t get_gptimer_delay(unsigned int timer_id); +#endif  uint32_t get_gptimer_count(unsigned int timer_id);  int      get_gptimer_intr(unsigned int timer_id);  void     clear_gptimer_intr(unsigned int timer_id); @@ -193,4 +272,66 @@ uint16_t get_enabled_gptimers(void);  uint32_t get_gptimer_status(unsigned int group);  void     set_gptimer_status(unsigned int group, uint32_t value); +static inline void enable_gptimer(unsigned int timer_id) +{ +	enable_gptimers(1 << timer_id); +} + +static inline void disable_gptimer(unsigned int timer_id) +{ +	disable_gptimers(1 << timer_id); +} + +/* + * All Blackfin system MMRs are padded to 32bits even if the register + * itself is only 16bits.  So use a helper macro to streamline this. + */ +#define __BFP(m) u16 m; u16 __pad_##m + +/* + * bfin timer registers layout + */ +struct bfin_gptimer_regs { +	__BFP(config); +	u32 counter; +	u32 period; +	u32 width; +#ifdef CONFIG_BF60x +	u32 delay; +#endif +}; + +/* + * bfin group timer registers layout + */ +#ifndef CONFIG_BF60x +struct bfin_gptimer_group_regs { +	__BFP(enable); +	__BFP(disable); +	u32 status; +}; +#else +struct bfin_gptimer_group_regs { +	__BFP(run); +	__BFP(enable); +	__BFP(disable); +	__BFP(stop_cfg); +	__BFP(stop_cfg_set); +	__BFP(stop_cfg_clr); +	__BFP(data_imsk); +	__BFP(stat_imsk); +	__BFP(tr_msk); +	__BFP(tr_ie); +	__BFP(data_ilat); +	__BFP(stat_ilat); +	__BFP(err_status); +	__BFP(bcast_per); +	__BFP(bcast_wid); +	__BFP(bcast_dly); + +}; +#endif + +#undef __BFP +  #endif diff --git a/arch/blackfin/include/asm/hardirq.h b/arch/blackfin/include/asm/hardirq.h index c078dd78d99..58b54a6d5a1 100644 --- a/arch/blackfin/include/asm/hardirq.h +++ b/arch/blackfin/include/asm/hardirq.h @@ -12,9 +12,6 @@  extern void ack_bad_irq(unsigned int irq);  #define ack_bad_irq ack_bad_irq -/* Define until common code gets sane defaults */ -#define HARDIRQ_BITS 9 -  #include <asm-generic/hardirq.h>  #endif diff --git a/arch/blackfin/include/asm/hw_irq.h b/arch/blackfin/include/asm/hw_irq.h deleted file mode 100644 index 1f5ef7da004..00000000000 --- a/arch/blackfin/include/asm/hw_irq.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/hw_irq.h> diff --git a/arch/blackfin/include/asm/io.h b/arch/blackfin/include/asm/io.h index 234fbac17ec..dccae26805b 100644 --- a/arch/blackfin/include/asm/io.h +++ b/arch/blackfin/include/asm/io.h @@ -1,5 +1,5 @@  /* - * Copyright 2004-2009 Analog Devices Inc. + * Copyright 2004-2010 Analog Devices Inc.   *   * Licensed under the GPL-2 or later.   */ @@ -7,148 +7,48 @@  #ifndef _BFIN_IO_H  #define _BFIN_IO_H -#ifdef __KERNEL__ - -#ifndef __ASSEMBLY__ -#include <linux/types.h> -#endif  #include <linux/compiler.h> - -/* - * These are for ISA/PCI shared memory _only_ and should never be used - * on any other type of memory, including Zorro memory. They are meant to - * access the bus in the bus byte order which is little-endian!. - * - * readX/writeX() are used to access memory mapped devices. On some - * architectures the memory mapped IO stuff needs to be accessed - * differently. On the bfin architecture, we just read/write the - * memory location directly. - */ -#ifndef __ASSEMBLY__ - -static inline unsigned char readb(const volatile void __iomem *addr) -{ -	unsigned int val; -	int tmp; - -	__asm__ __volatile__ ( -		"cli %1;" -		"NOP; NOP; SSYNC;" -		"%0 = b [%2] (z);" -		"sti %1;" -		: "=d"(val), "=d"(tmp) -		: "a"(addr) -	); - -	return (unsigned char) val; -} - -static inline unsigned short readw(const volatile void __iomem *addr) -{ -	unsigned int val; -	int tmp; - -	__asm__ __volatile__ ( -		"cli %1;" -		"NOP; NOP; SSYNC;" -		"%0 = w [%2] (z);" -		"sti %1;" -		: "=d"(val), "=d"(tmp) -		: "a"(addr) -	); - -	return (unsigned short) val; -} - -static inline unsigned int readl(const volatile void __iomem *addr) -{ -	unsigned int val; -	int tmp; - -	__asm__ __volatile__ ( -		"cli %1;" -		"NOP; NOP; SSYNC;" -		"%0 = [%2];" -		"sti %1;" -		: "=d"(val), "=d"(tmp) -		: "a"(addr) -	); - -	return val; +#include <linux/types.h> +#include <asm/byteorder.h> + +#define DECLARE_BFIN_RAW_READX(size, type, asm, asm_sign) \ +static inline type __raw_read##size(const volatile void __iomem *addr) \ +{ \ +	unsigned int val; \ +	int tmp; \ +	__asm__ __volatile__ ( \ +		"cli %1;" \ +		"NOP; NOP; SSYNC;" \ +		"%0 = "#asm" [%2] "#asm_sign";" \ +		"sti %1;" \ +		: "=d"(val), "=d"(tmp) \ +		: "a"(addr) \ +	); \ +	return (type) val; \  } - -#endif /*  __ASSEMBLY__ */ - -#define writeb(b, addr) (void)((*(volatile unsigned char *) (addr)) = (b)) -#define writew(b, addr) (void)((*(volatile unsigned short *) (addr)) = (b)) -#define writel(b, addr) (void)((*(volatile unsigned int *) (addr)) = (b)) - -#define __raw_readb readb -#define __raw_readw readw -#define __raw_readl readl -#define __raw_writeb writeb -#define __raw_writew writew -#define __raw_writel writel -#define memset_io(a, b, c)	memset((void *)(a), (b), (c)) -#define memcpy_fromio(a, b, c)	memcpy((a), (void *)(b), (c)) -#define memcpy_toio(a, b, c)	memcpy((void *)(a), (b), (c)) - -/* Convert "I/O port addresses" to actual addresses.  i.e. ugly casts. */ -#define __io(port) ((void *)(unsigned long)(port)) - -#define inb(port)    readb(__io(port)) -#define inw(port)    readw(__io(port)) -#define inl(port)    readl(__io(port)) -#define outb(x, port) writeb(x, __io(port)) -#define outw(x, port) writew(x, __io(port)) -#define outl(x, port) writel(x, __io(port)) - -#define inb_p(port)    inb(__io(port)) -#define inw_p(port)    inw(__io(port)) -#define inl_p(port)    inl(__io(port)) -#define outb_p(x, port) outb(x, __io(port)) -#define outw_p(x, port) outw(x, __io(port)) -#define outl_p(x, port) outl(x, __io(port)) - -#define ioread8_rep(a, d, c)	readsb(a, d, c) -#define ioread16_rep(a, d, c)	readsw(a, d, c) -#define ioread32_rep(a, d, c)	readsl(a, d, c) -#define iowrite8_rep(a, s, c)	writesb(a, s, c) -#define iowrite16_rep(a, s, c)	writesw(a, s, c) -#define iowrite32_rep(a, s, c)	writesl(a, s, c) - -#define ioread8(x)			readb(x) -#define ioread16(x)			readw(x) -#define ioread32(x)			readl(x) -#define iowrite8(val, x)		writeb(val, x) -#define iowrite16(val, x)		writew(val, x) -#define iowrite32(val, x)		writel(val, x) - -/** - * I/O write barrier - * - * Ensure ordering of I/O space writes. This will make sure that writes - * following the barrier will arrive after all previous writes. - */ -#define mmiowb() do { SSYNC(); wmb(); } while (0) - -#define IO_SPACE_LIMIT 0xffffffff - -/* Values for nocacheflag and cmode */ -#define IOMAP_NOCACHE_SER		1 - -#ifndef __ASSEMBLY__ +DECLARE_BFIN_RAW_READX(b, u8, b, (z)) +#define __raw_readb __raw_readb +DECLARE_BFIN_RAW_READX(w, u16, w, (z)) +#define __raw_readw __raw_readw +DECLARE_BFIN_RAW_READX(l, u32, , ) +#define __raw_readl __raw_readl  extern void outsb(unsigned long port, const void *addr, unsigned long count);  extern void outsw(unsigned long port, const void *addr, unsigned long count);  extern void outsw_8(unsigned long port, const void *addr, unsigned long count);  extern void outsl(unsigned long port, const void *addr, unsigned long count); +#define outsb outsb +#define outsw outsw +#define outsl outsl  extern void insb(unsigned long port, void *addr, unsigned long count);  extern void insw(unsigned long port, void *addr, unsigned long count);  extern void insw_8(unsigned long port, void *addr, unsigned long count);  extern void insl(unsigned long port, void *addr, unsigned long count);  extern void insl_16(unsigned long port, void *addr, unsigned long count); +#define insb insb +#define insw insw +#define insl insl  extern void dma_outsb(unsigned long port, const void *addr, unsigned short count);  extern void dma_outsw(unsigned long port, const void *addr, unsigned short count); @@ -158,108 +58,14 @@ extern void dma_insb(unsigned long port, void *addr, unsigned short count);  extern void dma_insw(unsigned long port, void *addr, unsigned short count);  extern void dma_insl(unsigned long port, void *addr, unsigned short count); -static inline void readsl(const void __iomem *addr, void *buf, int len) -{ -	insl((unsigned long)addr, buf, len); -} - -static inline void readsw(const void __iomem *addr, void *buf, int len) -{ -	insw((unsigned long)addr, buf, len); -} - -static inline void readsb(const void __iomem *addr, void *buf, int len) -{ -	insb((unsigned long)addr, buf, len); -} - -static inline void writesl(const void __iomem *addr, const void *buf, int len) -{ -	outsl((unsigned long)addr, buf, len); -} - -static inline void writesw(const void __iomem *addr, const void *buf, int len) -{ -	outsw((unsigned long)addr, buf, len); -} - -static inline void writesb(const void __iomem *addr, const void *buf, int len) -{ -	outsb((unsigned long)addr, buf, len); -} - -/* - * Map some physical address range into the kernel address space. - */ -static inline void __iomem *__ioremap(unsigned long physaddr, unsigned long size, -				int cacheflag) -{ -	return (void __iomem *)physaddr; -} - -/* - * Unmap a ioremap()ed region again - */ -static inline void iounmap(void *addr) -{ -} - -/* - * __iounmap unmaps nearly everything, so be careful - * it doesn't free currently pointer/page tables anymore but it - * wans't used anyway and might be added later. - */ -static inline void __iounmap(void *addr, unsigned long size) -{ -} - -/* - * Set new cache mode for some kernel address space. - * The caller must push data for that range itself, if such data may already - * be in the cache. +/** + * I/O write barrier + * + * Ensure ordering of I/O space writes. This will make sure that writes + * following the barrier will arrive after all previous writes.   */ -static inline void kernel_set_cachemode(void *addr, unsigned long size, -					int cmode) -{ -} - -static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) -{ -	return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); -} -static inline void __iomem *ioremap_nocache(unsigned long physaddr, -					    unsigned long size) -{ -	return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); -} +#define mmiowb() do { SSYNC(); wmb(); } while (0) -extern void blkfin_inv_cache_all(void); +#include <asm-generic/io.h>  #endif - -#define	ioport_map(port, nr)		((void __iomem*)(port)) -#define	ioport_unmap(addr) - -/* Pages to physical address... */ -#define page_to_bus(page)       ((page - mem_map) << PAGE_SHIFT) - -#define phys_to_virt(vaddr)	((void *) (vaddr)) -#define virt_to_phys(vaddr)	((unsigned long) (vaddr)) - -#define virt_to_bus virt_to_phys -#define bus_to_virt phys_to_virt - -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p)	__va(p) - -/* - * Convert a virtual cached pointer to an uncached pointer - */ -#define xlate_dev_kmem_ptr(p)	p - -#endif				/* __KERNEL__ */ - -#endif				/* _BFIN_IO_H */ diff --git a/arch/blackfin/include/asm/ioctl.h b/arch/blackfin/include/asm/ioctl.h deleted file mode 100644 index b279fe06dfe..00000000000 --- a/arch/blackfin/include/asm/ioctl.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/ioctl.h> diff --git a/arch/blackfin/include/asm/ioctls.h b/arch/blackfin/include/asm/ioctls.h deleted file mode 100644 index eca8d75b0a8..00000000000 --- a/arch/blackfin/include/asm/ioctls.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __ARCH_BFIN_IOCTLS_H__ -#define __ARCH_BFIN_IOCTLS_H__ - -#define FIOQSIZE	0x545E -#include <asm-generic/ioctls.h> - -#endif diff --git a/arch/blackfin/include/asm/ipcbuf.h b/arch/blackfin/include/asm/ipcbuf.h deleted file mode 100644 index 84c7e51cb6d..00000000000 --- a/arch/blackfin/include/asm/ipcbuf.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/ipcbuf.h> diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h index 40f94a704c0..17b5e92e3bc 100644 --- a/arch/blackfin/include/asm/ipipe.h +++ b/arch/blackfin/include/asm/ipipe.h @@ -32,13 +32,14 @@  #include <asm/ptrace.h>  #include <asm/irq.h>  #include <asm/bitops.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/traps.h> +#include <asm/bitsperlong.h> -#define IPIPE_ARCH_STRING     "1.12-00" +#define IPIPE_ARCH_STRING     "1.16-01"  #define IPIPE_MAJOR_NUMBER    1 -#define IPIPE_MINOR_NUMBER    12 -#define IPIPE_PATCH_NUMBER    0 +#define IPIPE_MINOR_NUMBER    16 +#define IPIPE_PATCH_NUMBER    1  #ifdef CONFIG_SMP  #error "I-pipe/blackfin: SMP not implemented" @@ -55,25 +56,19 @@ do {						\  #define task_hijacked(p)						\  	({								\  		int __x__ = __ipipe_root_domain_p;			\ -		__clear_bit(IPIPE_SYNC_FLAG, &ipipe_root_cpudom_var(status)); \  		if (__x__)						\ -			hard_local_irq_enable();				\ +			hard_local_irq_enable();			\  		!__x__;							\  	})  struct ipipe_domain;  struct ipipe_sysinfo { - -	int ncpus;		/* Number of CPUs on board */ -	u64 cpufreq;		/* CPU frequency (in Hz) */ - -	/* Arch-dependent block */ - -	struct { -		unsigned tmirq;	/* Timer tick IRQ */ -		u64 tmfreq;	/* Timer frequency */ -	} archdep; +	int sys_nr_cpus;	/* Number of CPUs on board */ +	int sys_hrtimer_irq;	/* hrtimer device IRQ */ +	u64 sys_hrtimer_freq;	/* hrtimer device frequency */ +	u64 sys_hrclock_freq;	/* hrclock device frequency */ +	u64 sys_cpu_freq;	/* CPU frequency (Hz) */  };  #define ipipe_read_tsc(t)					\ @@ -115,9 +110,19 @@ void __ipipe_enable_irqdesc(struct ipipe_domain *ipd,  void __ipipe_disable_irqdesc(struct ipipe_domain *ipd,  			     unsigned irq); -#define __ipipe_enable_irq(irq)		(irq_desc[irq].chip->unmask(irq)) +#define __ipipe_enable_irq(irq)						\ +	do {								\ +		struct irq_desc *desc = irq_to_desc(irq);		\ +		struct irq_chip *chip = get_irq_desc_chip(desc);	\ +		chip->irq_unmask(&desc->irq_data);			\ +	} while (0) -#define __ipipe_disable_irq(irq)	(irq_desc[irq].chip->mask(irq)) +#define __ipipe_disable_irq(irq)					\ +	do {								\ +		struct irq_desc *desc = irq_to_desc(irq);		\ +		struct irq_chip *chip = get_irq_desc_chip(desc);	\ +		chip->irq_mask(&desc->irq_data);			\ +	} while (0)  static inline int __ipipe_check_tickdev(const char *devname)  { @@ -128,12 +133,11 @@ void __ipipe_enable_pipeline(void);  #define __ipipe_hook_critical_ipi(ipd) do { } while (0) -#define __ipipe_sync_pipeline  ___ipipe_sync_pipeline -void ___ipipe_sync_pipeline(unsigned long syncmask); +void ___ipipe_sync_pipeline(void);  void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs); -int __ipipe_get_irq_priority(unsigned irq); +int __ipipe_get_irq_priority(unsigned int irq);  void __ipipe_serial_debug(const char *fmt, ...); @@ -152,7 +156,10 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)  	return ffs(ul) - 1;  } -#define __ipipe_run_irqtail()  /* Must be a macro */			\ +#define __ipipe_do_root_xirq(ipd, irq)					\ +	((ipd)->irqs[irq].handler(irq, &__raw_get_cpu_var(__ipipe_tick_regs))) + +#define __ipipe_run_irqtail(irq)  /* Must be a macro */			\  	do {								\  		unsigned long __pending;				\  		CSYNC();						\ @@ -164,42 +171,8 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)  		}							\  	} while (0) -#define __ipipe_run_isr(ipd, irq)					\ -	do {								\ -		if (!__ipipe_pipeline_head_p(ipd))			\ -			hard_local_irq_enable();				\ -		if (ipd == ipipe_root_domain) {				\ -			if (unlikely(ipipe_virtual_irq_p(irq))) {	\ -				irq_enter();				\ -				ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \ -				irq_exit();				\ -			} else 						\ -				ipd->irqs[irq].handler(irq, &__raw_get_cpu_var(__ipipe_tick_regs)); \ -		} else {						\ -			__clear_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \ -			ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \ -			/* Attempt to exit the outer interrupt level before \ -			 * starting the deferred IRQ processing. */	\ -			__ipipe_run_irqtail();				\ -			__set_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \ -		}							\ -		hard_local_irq_disable();					\ -	} while (0) -  #define __ipipe_syscall_watched_p(p, sc)	\ -	(((p)->flags & PF_EVNOTIFY) || (unsigned long)sc >= NR_syscalls) - -void ipipe_init_irq_threads(void); - -int ipipe_start_irq_thread(unsigned irq, struct irq_desc *desc); - -#ifdef CONFIG_TICKSOURCE_CORETMR -#define IRQ_SYSTMR		IRQ_CORETMR -#define IRQ_PRIOTMR		IRQ_CORETMR -#else -#define IRQ_SYSTMR		IRQ_TIMER0 -#define IRQ_PRIOTMR		CONFIG_IRQ_TIMER0 -#endif +	(ipipe_notifier_enabled_p(p) || (unsigned long)sc >= NR_syscalls)  #ifdef CONFIG_BF561  #define bfin_write_TIMER_DISABLE(val)	bfin_write_TMRS8_DISABLE(val) @@ -219,11 +192,11 @@ int ipipe_start_irq_thread(unsigned irq, struct irq_desc *desc);  #define task_hijacked(p)		0  #define ipipe_trap_notify(t, r)  	0 +#define __ipipe_root_tick_p(regs)	1 -#define ipipe_init_irq_threads()		do { } while (0) -#define ipipe_start_irq_thread(irq, desc)	0 +#endif /* !CONFIG_IPIPE */ -#ifndef CONFIG_TICKSOURCE_GPTMR0 +#ifdef CONFIG_TICKSOURCE_CORETMR  #define IRQ_SYSTMR		IRQ_CORETMR  #define IRQ_PRIOTMR		IRQ_CORETMR  #else @@ -231,10 +204,6 @@ int ipipe_start_irq_thread(unsigned irq, struct irq_desc *desc);  #define IRQ_PRIOTMR		CONFIG_IRQ_TIMER0  #endif -#define __ipipe_root_tick_p(regs)	1 - -#endif /* !CONFIG_IPIPE */ -  #define ipipe_update_tick_evtdev(evtdev)	do { } while (0)  #endif	/* !__ASM_BLACKFIN_IPIPE_H */ diff --git a/arch/blackfin/include/asm/ipipe_base.h b/arch/blackfin/include/asm/ipipe_base.h index 00409201d9e..84a4ffd3674 100644 --- a/arch/blackfin/include/asm/ipipe_base.h +++ b/arch/blackfin/include/asm/ipipe_base.h @@ -24,8 +24,10 @@  #ifdef CONFIG_IPIPE +#include <asm/bitsperlong.h> +#include <mach/irq.h> +  #define IPIPE_NR_XIRQS		NR_IRQS -#define IPIPE_IRQ_ISHIFT	5	/* 2^5 for 32bits arch. */  /* Blackfin-specific, per-cpu pipeline status */  #define IPIPE_SYNCDEFER_FLAG	15 @@ -42,11 +44,14 @@  #define IPIPE_EVENT_INIT	(IPIPE_FIRST_EVENT + 4)  #define IPIPE_EVENT_EXIT	(IPIPE_FIRST_EVENT + 5)  #define IPIPE_EVENT_CLEANUP	(IPIPE_FIRST_EVENT + 6) -#define IPIPE_LAST_EVENT	IPIPE_EVENT_CLEANUP +#define IPIPE_EVENT_RETURN	(IPIPE_FIRST_EVENT + 7) +#define IPIPE_LAST_EVENT	IPIPE_EVENT_RETURN  #define IPIPE_NR_EVENTS		(IPIPE_LAST_EVENT + 1)  #define IPIPE_TIMER_IRQ		IRQ_CORETMR +#define __IPIPE_FEATURE_SYSINFO_V2	1 +  #ifndef __ASSEMBLY__  extern unsigned long __ipipe_root_status; /* Alias to ipipe_root_cpudom_var(status) */ @@ -63,6 +68,8 @@ void __ipipe_unlock_root(void);  #endif /* !__ASSEMBLY__ */ +#define __IPIPE_FEATURE_SYSINFO_V2	1 +  #endif /* CONFIG_IPIPE */  #endif /* !__ASM_BLACKFIN_IPIPE_BASE_H */ diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h index 12f4060a31b..89de539ed01 100644 --- a/arch/blackfin/include/asm/irq.h +++ b/arch/blackfin/include/asm/irq.h @@ -38,8 +38,4 @@  #include <asm-generic/irq.h> -#ifdef CONFIG_NMI_WATCHDOG -# define ARCH_HAS_NMI_WATCHDOG -#endif -  #endif				/* _BFIN_IRQ_H_ */ diff --git a/arch/blackfin/include/asm/irq_handler.h b/arch/blackfin/include/asm/irq_handler.h index 7fbe42307b9..4b2a992794d 100644 --- a/arch/blackfin/include/asm/irq_handler.h +++ b/arch/blackfin/include/asm/irq_handler.h @@ -9,6 +9,17 @@  #include <linux/types.h>  #include <linux/linkage.h> +#include <mach/irq.h> + +/* init functions only */ +extern int init_arch_irq(void); +extern void init_exception_vectors(void); +extern void program_IAR(void); +#ifdef init_mach_irq +extern void init_mach_irq(void); +#else +# define init_mach_irq() +#endif  /* BASE LEVEL interrupt handler routines */  asmlinkage void evt_exception(void); @@ -37,4 +48,19 @@ extern void return_from_exception(void);  extern int bfin_request_exception(unsigned int exception, void (*handler)(void));  extern int bfin_free_exception(unsigned int exception, void (*handler)(void)); +extern asmlinkage void lower_to_irq14(void); +extern asmlinkage void bfin_return_from_exception(void); +extern asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs); +extern int bfin_internal_set_wake(unsigned int irq, unsigned int state); + +struct irq_data; +extern void bfin_handle_irq(unsigned irq); +extern void bfin_ack_noop(struct irq_data *); +extern void bfin_internal_mask_irq(unsigned int irq); +extern void bfin_internal_unmask_irq(unsigned int irq); + +struct irq_desc; +extern void bfin_demux_mac_status_irq(unsigned int, struct irq_desc *); +extern void bfin_demux_gpio_irq(unsigned int, struct irq_desc *); +  #endif diff --git a/arch/blackfin/include/asm/irq_regs.h b/arch/blackfin/include/asm/irq_regs.h deleted file mode 100644 index 3dd9c0b7027..00000000000 --- a/arch/blackfin/include/asm/irq_regs.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/irq_regs.h> diff --git a/arch/blackfin/include/asm/irqflags.h b/arch/blackfin/include/asm/irqflags.h index 41c4d70544e..07aff230a81 100644 --- a/arch/blackfin/include/asm/irqflags.h +++ b/arch/blackfin/include/asm/irqflags.h @@ -13,20 +13,17 @@  #ifdef CONFIG_SMP  # include <asm/pda.h>  # include <asm/processor.h> -/* Forward decl needed due to cdef inter dependencies */ -static inline uint32_t __pure bfin_dspid(void); -# define blackfin_core_id() (bfin_dspid() & 0xff)  # define bfin_irq_flags cpu_pda[blackfin_core_id()].imask  #else  extern unsigned long bfin_irq_flags;  #endif -static inline void bfin_sti(unsigned long flags) +static inline notrace void bfin_sti(unsigned long flags)  {  	asm volatile("sti %0;" : : "d" (flags));  } -static inline unsigned long bfin_cli(void) +static inline notrace unsigned long bfin_cli(void)  {  	unsigned long flags;  	asm volatile("cli %0;" : "=d" (flags)); @@ -43,22 +40,22 @@ static inline unsigned long bfin_cli(void)  /*   * Hard, untraced CPU interrupt flag manipulation and access.   */ -static inline void __hard_local_irq_disable(void) +static inline notrace void __hard_local_irq_disable(void)  {  	bfin_cli();  } -static inline void __hard_local_irq_enable(void) +static inline notrace void __hard_local_irq_enable(void)  {  	bfin_sti(bfin_irq_flags);  } -static inline unsigned long hard_local_save_flags(void) +static inline notrace unsigned long hard_local_save_flags(void)  {  	return bfin_read_IMASK();  } -static inline unsigned long __hard_local_irq_save(void) +static inline notrace unsigned long __hard_local_irq_save(void)  {  	unsigned long flags;  	flags = bfin_cli(); @@ -68,18 +65,22 @@ static inline unsigned long __hard_local_irq_save(void)  	return flags;  } -static inline int hard_irqs_disabled_flags(unsigned long flags) +static inline notrace int hard_irqs_disabled_flags(unsigned long flags)  { +#ifdef CONFIG_BF60x +	return (flags & IMASK_IVG11) == 0; +#else  	return (flags & ~0x3f) == 0; +#endif  } -static inline int hard_irqs_disabled(void) +static inline notrace int hard_irqs_disabled(void)  {  	unsigned long flags = hard_local_save_flags();  	return hard_irqs_disabled_flags(flags);  } -static inline void __hard_local_irq_restore(unsigned long flags) +static inline notrace void __hard_local_irq_restore(unsigned long flags)  {  	if (!hard_irqs_disabled_flags(flags))  		__hard_local_irq_enable(); @@ -92,49 +93,72 @@ static inline void __hard_local_irq_restore(unsigned long flags)  #ifdef CONFIG_IPIPE  #include <linux/compiler.h> -#include <linux/ipipe_base.h>  #include <linux/ipipe_trace.h> +/* + * Way too many inter-deps between low-level headers in this port, so + * we redeclare the required bits we cannot pick from + * <asm/ipipe_base.h> to prevent circular dependencies. + */ +void __ipipe_stall_root(void); +void __ipipe_unstall_root(void); +unsigned long __ipipe_test_root(void); +unsigned long __ipipe_test_and_stall_root(void); +void __ipipe_restore_root(unsigned long flags); + +#ifdef CONFIG_IPIPE_DEBUG_CONTEXT +struct ipipe_domain; +extern struct ipipe_domain ipipe_root; +void ipipe_check_context(struct ipipe_domain *ipd); +#define __check_irqop_context(ipd)  ipipe_check_context(&ipipe_root) +#else /* !CONFIG_IPIPE_DEBUG_CONTEXT */ +#define __check_irqop_context(ipd)  do { } while (0) +#endif /* !CONFIG_IPIPE_DEBUG_CONTEXT */  /*   * Interrupt pipe interface to linux/irqflags.h.   */ -static inline void arch_local_irq_disable(void) +static inline notrace void arch_local_irq_disable(void)  { -	ipipe_check_context(ipipe_root_domain); +	__check_irqop_context();  	__ipipe_stall_root();  	barrier();  } -static inline void arch_local_irq_enable(void) +static inline notrace void arch_local_irq_enable(void)  {  	barrier(); -	ipipe_check_context(ipipe_root_domain); +	__check_irqop_context();  	__ipipe_unstall_root();  } -static inline unsigned long arch_local_save_flags(void) +static inline notrace unsigned long arch_local_save_flags(void)  {  	return __ipipe_test_root() ? bfin_no_irqs : bfin_irq_flags;  } -static inline int arch_irqs_disabled_flags(unsigned long flags) +static inline notrace int arch_irqs_disabled_flags(unsigned long flags)  {  	return flags == bfin_no_irqs;  } -static inline void arch_local_irq_save_ptr(unsigned long *_flags) +static inline notrace unsigned long arch_local_irq_save(void)  { -	x = __ipipe_test_and_stall_root() ? bfin_no_irqs : bfin_irq_flags; +	unsigned long flags; + +	__check_irqop_context(); +	flags = __ipipe_test_and_stall_root() ? bfin_no_irqs : bfin_irq_flags;  	barrier(); + +	return flags;  } -static inline unsigned long arch_local_irq_save(void) +static inline notrace void arch_local_irq_restore(unsigned long flags)  { -	ipipe_check_context(ipipe_root_domain); -	return __hard_local_irq_save(); +	__check_irqop_context(); +	__ipipe_restore_root(flags == bfin_no_irqs);  } -static inline unsigned long arch_mangle_irq_bits(int virt, unsigned long real) +static inline notrace unsigned long arch_mangle_irq_bits(int virt, unsigned long real)  {  	/*  	 * Merge virtual and real interrupt mask bits into a single @@ -143,7 +167,7 @@ static inline unsigned long arch_mangle_irq_bits(int virt, unsigned long real)  	return (real & ~(1 << 31)) | ((virt != 0) << 31);  } -static inline int arch_demangle_irq_bits(unsigned long *x) +static inline notrace int arch_demangle_irq_bits(unsigned long *x)  {  	int virt = (*x & (1 << 31)) != 0;  	*x &= ~(1L << 31); @@ -154,7 +178,7 @@ static inline int arch_demangle_irq_bits(unsigned long *x)   * Interface to various arch routines that may be traced.   */  #ifdef CONFIG_IPIPE_TRACE_IRQSOFF -static inline void hard_local_irq_disable(void) +static inline notrace void hard_local_irq_disable(void)  {  	if (!hard_irqs_disabled()) {  		__hard_local_irq_disable(); @@ -162,7 +186,7 @@ static inline void hard_local_irq_disable(void)  	}  } -static inline void hard_local_irq_enable(void) +static inline notrace void hard_local_irq_enable(void)  {  	if (hard_irqs_disabled()) {  		ipipe_trace_end(0x80000000); @@ -170,7 +194,7 @@ static inline void hard_local_irq_enable(void)  	}  } -static inline unsigned long hard_local_irq_save(void) +static inline notrace unsigned long hard_local_irq_save(void)  {  	unsigned long flags = hard_local_save_flags();  	if (!hard_irqs_disabled_flags(flags)) { @@ -180,7 +204,7 @@ static inline unsigned long hard_local_irq_save(void)  	return flags;  } -static inline void hard_local_irq_restore(unsigned long flags) +static inline notrace void hard_local_irq_restore(unsigned long flags)  {  	if (!hard_irqs_disabled_flags(flags)) {  		ipipe_trace_end(0x80000001); @@ -195,13 +219,16 @@ static inline void hard_local_irq_restore(unsigned long flags)  # define hard_local_irq_restore(flags)	__hard_local_irq_restore(flags)  #endif /* !CONFIG_IPIPE_TRACE_IRQSOFF */ -#else /* CONFIG_IPIPE */ +#define hard_local_irq_save_cond()		hard_local_irq_save() +#define hard_local_irq_restore_cond(flags)	hard_local_irq_restore(flags) + +#else /* !CONFIG_IPIPE */  /*   * Direct interface to linux/irqflags.h.   */  #define arch_local_save_flags()		hard_local_save_flags() -#define arch_local_irq_save(flags)	__hard_local_irq_save() +#define arch_local_irq_save()		__hard_local_irq_save()  #define arch_local_irq_restore(flags)	__hard_local_irq_restore(flags)  #define arch_local_irq_enable()		__hard_local_irq_enable()  #define arch_local_irq_disable()	__hard_local_irq_disable() @@ -215,7 +242,48 @@ static inline void hard_local_irq_restore(unsigned long flags)  #define hard_local_irq_restore(flags)	__hard_local_irq_restore(flags)  #define hard_local_irq_enable()		__hard_local_irq_enable()  #define hard_local_irq_disable()	__hard_local_irq_disable() - +#define hard_local_irq_save_cond()		hard_local_save_flags() +#define hard_local_irq_restore_cond(flags)	do { (void)(flags); } while (0)  #endif /* !CONFIG_IPIPE */ + +#ifdef CONFIG_SMP +#define hard_local_irq_save_smp()		hard_local_irq_save() +#define hard_local_irq_restore_smp(flags)	hard_local_irq_restore(flags) +#else +#define hard_local_irq_save_smp()		hard_local_save_flags() +#define hard_local_irq_restore_smp(flags)	do { (void)(flags); } while (0) +#endif + +/* + * Remap the arch-neutral IRQ state manipulation macros to the + * blackfin-specific hard_local_irq_* API. + */ +#define local_irq_save_hw(flags)			\ +	do {						\ +		(flags) = hard_local_irq_save();	\ +	} while (0) +#define local_irq_restore_hw(flags)		\ +	do {					\ +		hard_local_irq_restore(flags);	\ +	} while (0) +#define local_irq_disable_hw()			\ +	do {					\ +		hard_local_irq_disable();	\ +	} while (0) +#define local_irq_enable_hw()			\ +	do {					\ +		hard_local_irq_enable();	\ +	} while (0) +#define local_irq_save_hw_notrace(flags)		\ +	do {						\ +		(flags) = __hard_local_irq_save();	\ +	} while (0) +#define local_irq_restore_hw_notrace(flags)		\ +	do {						\ +		__hard_local_irq_restore(flags);	\ +	} while (0) + +#define irqs_disabled_hw()	hard_irqs_disabled() +  #endif diff --git a/arch/blackfin/include/asm/kdebug.h b/arch/blackfin/include/asm/kdebug.h deleted file mode 100644 index 6ece1b03766..00000000000 --- a/arch/blackfin/include/asm/kdebug.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/kdebug.h> diff --git a/arch/blackfin/include/asm/kgdb.h b/arch/blackfin/include/asm/kgdb.h index 8651afe1299..2703ddeeb5d 100644 --- a/arch/blackfin/include/asm/kgdb.h +++ b/arch/blackfin/include/asm/kgdb.h @@ -103,7 +103,13 @@ static inline void arch_kgdb_breakpoint(void)  	asm("EXCPT 2;");  }  #define BREAK_INSTR_SIZE	2 -#define CACHE_FLUSH_IS_SAFE	1 +#ifdef CONFIG_SMP +# define CACHE_FLUSH_IS_SAFE	0 +#else +# define CACHE_FLUSH_IS_SAFE	1 +#endif +#define GDB_ADJUSTS_BREAK_OFFSET +#define GDB_SKIP_HW_WATCH_TEST  #define HW_INST_WATCHPOINT_NUM	6  #define HW_WATCHPOINT_NUM	8  #define TYPE_INST_WATCHPOINT	0 diff --git a/arch/blackfin/include/asm/kmap_types.h b/arch/blackfin/include/asm/kmap_types.h deleted file mode 100644 index 3575c64af42..00000000000 --- a/arch/blackfin/include/asm/kmap_types.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/kmap_types.h> diff --git a/arch/blackfin/include/asm/local.h b/arch/blackfin/include/asm/local.h deleted file mode 100644 index c11c530f74d..00000000000 --- a/arch/blackfin/include/asm/local.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/local.h> diff --git a/arch/blackfin/include/asm/local64.h b/arch/blackfin/include/asm/local64.h deleted file mode 100644 index 36c93b5cc23..00000000000 --- a/arch/blackfin/include/asm/local64.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/local64.h> diff --git a/arch/blackfin/include/asm/mem_init.h b/arch/blackfin/include/asm/mem_init.h index 237579935e2..c865b33eeb6 100644 --- a/arch/blackfin/include/asm/mem_init.h +++ b/arch/blackfin/include/asm/mem_init.h @@ -6,6 +6,9 @@   * Licensed under the GPL-2 or later.   */ +#ifndef __MEM_INIT_H__ +#define __MEM_INIT_H__ +  #if defined(EBIU_SDGCTL)  #if defined(CONFIG_MEM_MT48LC16M16A2TG_75) || \      defined(CONFIG_MEM_MT48LC64M4A2FB_7E) || \ @@ -277,3 +280,221 @@  #else  #define PLL_BYPASS       0  #endif + +#ifdef CONFIG_BF60x + +/* DMC status bits */ +#define IDLE			0x1 +#define MEMINITDONE		0x4 +#define SRACK			0x8 +#define PDACK			0x10 +#define DPDACK			0x20 +#define DLLCALDONE		0x2000 +#define PENDREF			0xF0000 +#define PHYRDPHASE		0xF00000 +#define PHYRDPHASE_OFFSET	20 + +/* DMC control bits */ +#define LPDDR			0x2 +#define INIT			0x4 +#define	SRREQ			0x8 +#define PDREQ			0x10 +#define DPDREQ			0x20 +#define PREC			0x40 +#define ADDRMODE		0x100 +#define RDTOWR			0xE00 +#define PPREF			0x1000 +#define DLLCAL			0x2000 + +/* DMC DLL control bits */ +#define DLLCALRDCNT		0xFF +#define DATACYC			0xF00 +#define DATACYC_OFFSET		8 + +/* CGU Divisor bits */ +#define CSEL_OFFSET		0 +#define S0SEL_OFFSET		5 +#define SYSSEL_OFFSET		8 +#define S1SEL_OFFSET		13 +#define DSEL_OFFSET		16 +#define OSEL_OFFSET		22 +#define ALGN			0x20000000 +#define UPDT			0x40000000 +#define LOCK			0x80000000 + +/* CGU Status bits */ +#define PLLEN			0x1 +#define PLLBP			0x2 +#define PLOCK			0x4 +#define CLKSALGN		0x8 + +/* CGU Control bits */ +#define MSEL_MASK		0x7F00 +#define DF_MASK			0x1 + +struct ddr_config { +	u32 ddr_clk; +	u32 dmc_ddrctl; +	u32 dmc_effctl; +	u32 dmc_ddrcfg; +	u32 dmc_ddrtr0; +	u32 dmc_ddrtr1; +	u32 dmc_ddrtr2; +	u32 dmc_ddrmr; +	u32 dmc_ddrmr1; +}; + +#if defined(CONFIG_MEM_MT47H64M16) +static struct ddr_config ddr_config_table[] __attribute__((section(".data_l1"))) = { +	[0] = { +		.ddr_clk    = 125, +		.dmc_ddrctl = 0x00000904, +		.dmc_effctl = 0x004400C0, +		.dmc_ddrcfg = 0x00000422, +		.dmc_ddrtr0 = 0x20705212, +		.dmc_ddrtr1 = 0x201003CF, +		.dmc_ddrtr2 = 0x00320107, +		.dmc_ddrmr  = 0x00000422, +		.dmc_ddrmr1 = 0x4, +	}, +	[1] = { +		.ddr_clk    = 133, +		.dmc_ddrctl = 0x00000904, +		.dmc_effctl = 0x004400C0, +		.dmc_ddrcfg = 0x00000422, +		.dmc_ddrtr0 = 0x20806313, +		.dmc_ddrtr1 = 0x2013040D, +		.dmc_ddrtr2 = 0x00320108, +		.dmc_ddrmr  = 0x00000632, +		.dmc_ddrmr1 = 0x4, +	}, +	[2] = { +		.ddr_clk    = 150, +		.dmc_ddrctl = 0x00000904, +		.dmc_effctl = 0x004400C0, +		.dmc_ddrcfg = 0x00000422, +		.dmc_ddrtr0 = 0x20A07323, +		.dmc_ddrtr1 = 0x20160492, +		.dmc_ddrtr2 = 0x00320209, +		.dmc_ddrmr  = 0x00000632, +		.dmc_ddrmr1 = 0x4, +	}, +	[3] = { +		.ddr_clk    = 166, +		.dmc_ddrctl = 0x00000904, +		.dmc_effctl = 0x004400C0, +		.dmc_ddrcfg = 0x00000422, +		.dmc_ddrtr0 = 0x20A07323, +		.dmc_ddrtr1 = 0x2016050E, +		.dmc_ddrtr2 = 0x00320209, +		.dmc_ddrmr  = 0x00000632, +		.dmc_ddrmr1 = 0x4, +	}, +	[4] = { +		.ddr_clk    = 200, +		.dmc_ddrctl = 0x00000904, +		.dmc_effctl = 0x004400C0, +		.dmc_ddrcfg = 0x00000422, +		.dmc_ddrtr0 = 0x20a07323, +		.dmc_ddrtr1 = 0x2016050f, +		.dmc_ddrtr2 = 0x00320509, +		.dmc_ddrmr  = 0x00000632, +		.dmc_ddrmr1 = 0x4, +	}, +	[5] = { +		.ddr_clk    = 225, +		.dmc_ddrctl = 0x00000904, +		.dmc_effctl = 0x004400C0, +		.dmc_ddrcfg = 0x00000422, +		.dmc_ddrtr0 = 0x20E0A424, +		.dmc_ddrtr1 = 0x302006DB, +		.dmc_ddrtr2 = 0x0032020D, +		.dmc_ddrmr  = 0x00000842, +		.dmc_ddrmr1 = 0x4, +	}, +	[6] = { +		.ddr_clk    = 250, +		.dmc_ddrctl = 0x00000904, +		.dmc_effctl = 0x004400C0, +		.dmc_ddrcfg = 0x00000422, +		.dmc_ddrtr0 = 0x20E0A424, +		.dmc_ddrtr1 = 0x3020079E, +		.dmc_ddrtr2 = 0x0032050D, +		.dmc_ddrmr  = 0x00000842, +		.dmc_ddrmr1 = 0x4, +	}, +}; +#endif + +static inline void dmc_enter_self_refresh(void) +{ +	if (bfin_read_DMC0_STAT() & MEMINITDONE) { +		bfin_write_DMC0_CTL(bfin_read_DMC0_CTL() | SRREQ); +		while (!(bfin_read_DMC0_STAT() & SRACK)) +			continue; +	} +} + +static inline void dmc_exit_self_refresh(void) +{ +	if (bfin_read_DMC0_STAT() & MEMINITDONE) { +		bfin_write_DMC0_CTL(bfin_read_DMC0_CTL() & ~SRREQ); +		while (bfin_read_DMC0_STAT() & SRACK) +			continue; +	} +} + +static inline void init_cgu(u32 cgu_div, u32 cgu_ctl) +{ +	dmc_enter_self_refresh(); + +	/* Don't set the same value of MSEL and DF to CGU_CTL */ +	if ((bfin_read32(CGU0_CTL) & (MSEL_MASK | DF_MASK)) +		!= cgu_ctl) { +		bfin_write32(CGU0_DIV, cgu_div); +		bfin_write32(CGU0_CTL, cgu_ctl); +		while ((bfin_read32(CGU0_STAT) & (CLKSALGN | PLLBP)) || +			!(bfin_read32(CGU0_STAT) & PLOCK)) +			continue; +	} + +	bfin_write32(CGU0_DIV, cgu_div | UPDT); +	while (bfin_read32(CGU0_STAT) & CLKSALGN) +		continue; + +	dmc_exit_self_refresh(); +} + +static inline void init_dmc(u32 dmc_clk) +{ +	int i, dlldatacycle, dll_ctl; + +	for (i = 0; i < 7; i++) { +		if (ddr_config_table[i].ddr_clk == dmc_clk) { +			bfin_write_DMC0_CFG(ddr_config_table[i].dmc_ddrcfg); +			bfin_write_DMC0_TR0(ddr_config_table[i].dmc_ddrtr0); +			bfin_write_DMC0_TR1(ddr_config_table[i].dmc_ddrtr1); +			bfin_write_DMC0_TR2(ddr_config_table[i].dmc_ddrtr2); +			bfin_write_DMC0_MR(ddr_config_table[i].dmc_ddrmr); +			bfin_write_DMC0_EMR1(ddr_config_table[i].dmc_ddrmr1); +			bfin_write_DMC0_EFFCTL(ddr_config_table[i].dmc_effctl); +			bfin_write_DMC0_CTL(ddr_config_table[i].dmc_ddrctl); +			break; +		} +	} + +	while (!(bfin_read_DMC0_STAT() & MEMINITDONE)) +		continue; + +	dlldatacycle = (bfin_read_DMC0_STAT() & PHYRDPHASE) >> PHYRDPHASE_OFFSET; +	dll_ctl = bfin_read_DMC0_DLLCTL(); +	dll_ctl &= ~DATACYC; +	bfin_write_DMC0_DLLCTL(dll_ctl | (dlldatacycle << DATACYC_OFFSET)); + +	while (!(bfin_read_DMC0_STAT() & DLLCALDONE)) +		continue; +} +#endif + +#endif /*__MEM_INIT_H__*/ + diff --git a/arch/blackfin/include/asm/mman.h b/arch/blackfin/include/asm/mman.h deleted file mode 100644 index 8eebf89f5ab..00000000000 --- a/arch/blackfin/include/asm/mman.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/mman.h> diff --git a/arch/blackfin/include/asm/mmu_context.h b/arch/blackfin/include/asm/mmu_context.h index 3828c70e7a2..15b16d3e8de 100644 --- a/arch/blackfin/include/asm/mmu_context.h +++ b/arch/blackfin/include/asm/mmu_context.h @@ -30,8 +30,11 @@ extern void *l1sram_alloc_max(void*);  static inline void free_l1stack(void)  {  	nr_l1stack_tasks--; -	if (nr_l1stack_tasks == 0) +	if (nr_l1stack_tasks == 0) {  		l1sram_free(l1_stack_base); +		l1_stack_base = NULL; +		l1_stack_len = 0; +	}  }  static inline unsigned long diff --git a/arch/blackfin/include/asm/module.h b/arch/blackfin/include/asm/module.h index 4282b169ead..231a149b3f7 100644 --- a/arch/blackfin/include/asm/module.h +++ b/arch/blackfin/include/asm/module.h @@ -1,15 +1,13 @@  /* - * Copyright 2004-2008 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ + * Copyright 2004-2008 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */  #ifndef _ASM_BFIN_MODULE_H  #define _ASM_BFIN_MODULE_H -#define Elf_Shdr        Elf32_Shdr -#define Elf_Sym         Elf32_Sym -#define Elf_Ehdr        Elf32_Ehdr +#include <asm-generic/module.h>  struct mod_arch_specific {  	Elf_Shdr	*text_l1; diff --git a/arch/blackfin/include/asm/msgbuf.h b/arch/blackfin/include/asm/msgbuf.h deleted file mode 100644 index 809134c644a..00000000000 --- a/arch/blackfin/include/asm/msgbuf.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/msgbuf.h> diff --git a/arch/blackfin/include/asm/mutex.h b/arch/blackfin/include/asm/mutex.h deleted file mode 100644 index f726e3a80ad..00000000000 --- a/arch/blackfin/include/asm/mutex.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Pull in the generic implementation for the mutex fastpath. - * - * TODO: implement optimized primitives instead, or leave the generic - * implementation in place, or pick the atomic_xchg() based generic - * implementation. (see asm-generic/mutex-xchg.h for details) - * - * Copyright 2006-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -#ifndef _ASM_MUTEX_H -#define _ASM_MUTEX_H - -#ifndef CONFIG_SMP -#include <asm-generic/mutex.h> -#else - -static inline void -__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) -{ -	if (unlikely(atomic_dec_return(count) < 0)) -		fail_fn(count); -	else -		smp_mb(); -} - -static inline int -__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) -{ -	if (unlikely(atomic_dec_return(count) < 0)) -		return fail_fn(count); -	else { -		smp_mb(); -		return 0; -	} -} - -static inline void -__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *)) -{ -	smp_mb(); -	if (unlikely(atomic_inc_return(count) <= 0)) -		fail_fn(count); -} - -#define __mutex_slowpath_needs_to_unlock()		1 - -static inline int -__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) -{ -	/* -	 * We have two variants here. The cmpxchg based one is the best one -	 * because it never induce a false contention state.  It is included -	 * here because architectures using the inc/dec algorithms over the -	 * xchg ones are much more likely to support cmpxchg natively. -	 * -	 * If not we fall back to the spinlock based variant - that is -	 * just as efficient (and simpler) as a 'destructive' probing of -	 * the mutex state would be. -	 */ -#ifdef __HAVE_ARCH_CMPXCHG -	if (likely(atomic_cmpxchg(count, 1, 0) == 1)) { -		smp_mb(); -		return 1; -	} -	return 0; -#else -	return fail_fn(count); -#endif -} - -#endif - -#endif diff --git a/arch/blackfin/include/asm/page.h b/arch/blackfin/include/asm/page.h index d0ce975bcd4..b93474d5be7 100644 --- a/arch/blackfin/include/asm/page.h +++ b/arch/blackfin/include/asm/page.h @@ -1,20 +1,21 @@  /* - * Copyright 2004-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ + * Copyright 2004-2009 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */  #ifndef _BLACKFIN_PAGE_H  #define _BLACKFIN_PAGE_H -#include <asm-generic/page.h> -#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) +#define ARCH_PFN_OFFSET (CONFIG_PHY_RAM_BASE_ADDRESS >> PAGE_SHIFT) +#define MAP_NR(addr) ((unsigned long)(addr) >> PAGE_SHIFT)  #define VM_DATA_DEFAULT_FLAGS \  	(VM_READ | VM_WRITE | \  	((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \  		 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) +#include <asm-generic/page.h>  #include <asm-generic/memory_model.h>  #include <asm-generic/getorder.h> diff --git a/arch/blackfin/include/asm/param.h b/arch/blackfin/include/asm/param.h deleted file mode 100644 index 965d4542797..00000000000 --- a/arch/blackfin/include/asm/param.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/param.h> diff --git a/arch/blackfin/include/asm/pci.h b/arch/blackfin/include/asm/pci.h index 99cae2e3bac..c737909fba4 100644 --- a/arch/blackfin/include/asm/pci.h +++ b/arch/blackfin/include/asm/pci.h @@ -10,13 +10,4 @@  #define PCIBIOS_MIN_IO 0x00001000  #define PCIBIOS_MIN_MEM 0x10000000 -static inline void pcibios_set_master(struct pci_dev *dev) -{ -	/* No special bus mastering setup handling */ -} -static inline void pcibios_penalize_isa_irq(int irq) -{ -	/* We don't do dynamic PCI IRQ allocation */ -} -  #endif				/* _ASM_BFIN_PCI_H */ diff --git a/arch/blackfin/include/asm/pda.h b/arch/blackfin/include/asm/pda.h index d49bb261d9b..68d6f6618f2 100644 --- a/arch/blackfin/include/asm/pda.h +++ b/arch/blackfin/include/asm/pda.h @@ -13,7 +13,9 @@  #ifndef __ASSEMBLY__  struct blackfin_pda {			/* Per-processor Data Area */ +#ifdef CONFIG_SMP  	struct blackfin_pda *next; +#endif  	unsigned long syscfg;  #ifdef CONFIG_SMP @@ -54,6 +56,16 @@ struct blackfin_pda {			/* Per-processor Data Area */  #endif  }; +struct blackfin_initial_pda { +	void *retx; +#ifdef CONFIG_DEBUG_DOUBLEFAULT +	void *dcplb_doublefault_addr; +	void *icplb_doublefault_addr; +	void *retx_doublefault; +	unsigned seqstat_doublefault; +#endif +}; +  extern struct blackfin_pda cpu_pda[];  #endif	/* __ASSEMBLY__ */ diff --git a/arch/blackfin/include/asm/percpu.h b/arch/blackfin/include/asm/percpu.h deleted file mode 100644 index 06a959d6723..00000000000 --- a/arch/blackfin/include/asm/percpu.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/percpu.h> diff --git a/arch/blackfin/include/asm/perf_event.h b/arch/blackfin/include/asm/perf_event.h new file mode 100644 index 00000000000..3d2b1716322 --- /dev/null +++ b/arch/blackfin/include/asm/perf_event.h @@ -0,0 +1 @@ +#define MAX_HWEVENTS 2 diff --git a/arch/blackfin/include/asm/pgalloc.h b/arch/blackfin/include/asm/pgalloc.h deleted file mode 100644 index f261cb7dda0..00000000000 --- a/arch/blackfin/include/asm/pgalloc.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/pgalloc.h> diff --git a/arch/blackfin/include/asm/pgtable.h b/arch/blackfin/include/asm/pgtable.h index dcca3e6d6e8..0b049019eba 100644 --- a/arch/blackfin/include/asm/pgtable.h +++ b/arch/blackfin/include/asm/pgtable.h @@ -83,14 +83,11 @@ PTE_BIT_FUNC(mkyoung, |= _PAGE_ACCESSED);  #define ZERO_PAGE(vaddr)	virt_to_page(empty_zero_page)  extern char empty_zero_page[]; -extern unsigned int kobjsize(const void *objp); -  #define swapper_pg_dir ((pgd_t *) 0)  /*   * No page table caches to initialise.   */  #define pgtable_cache_init()	do { } while (0) -#define io_remap_pfn_range      remap_pfn_range  /*   * All 32bit addresses are effectively valid for vmalloc... diff --git a/arch/blackfin/include/asm/pm.h b/arch/blackfin/include/asm/pm.h new file mode 100644 index 00000000000..f72239bf363 --- /dev/null +++ b/arch/blackfin/include/asm/pm.h @@ -0,0 +1,31 @@ +/* + * Blackfin bf609 power management + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2 + */ + +#ifndef __PM_H__ +#define __PM_H__ + +#include <linux/suspend.h> + +struct bfin_cpu_pm_fns { +	void    (*save)(unsigned long *); +	void    (*restore)(unsigned long *); +	int     (*valid)(suspend_state_t state); +	void    (*enter)(suspend_state_t state); +	int     (*prepare)(void); +	void    (*finish)(void); +}; + +extern struct bfin_cpu_pm_fns *bfin_cpu_pm; + +# ifdef CONFIG_BFIN_COREB +void bfin_coreb_start(void); +void bfin_coreb_stop(void); +void bfin_coreb_reset(void); +# endif + +#endif diff --git a/arch/blackfin/include/asm/poll.h b/arch/blackfin/include/asm/poll.h deleted file mode 100644 index 072d8966c5c..00000000000 --- a/arch/blackfin/include/asm/poll.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2004-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - * - */ - -#ifndef __BFIN_POLL_H -#define __BFIN_POLL_H - -#define POLLWRNORM	4 /* POLLOUT */ -#define POLLWRBAND	256 - -#include <asm-generic/poll.h> - -#endif diff --git a/arch/blackfin/include/asm/portmux.h b/arch/blackfin/include/asm/portmux.h index 9b1e2c37b32..c8f0939419b 100644 --- a/arch/blackfin/include/asm/portmux.h +++ b/arch/blackfin/include/asm/portmux.h @@ -17,14 +17,27 @@  #define P_MAYSHARE	0x2000  #define P_DONTCARE	0x1000 +#ifdef CONFIG_PINCTRL +int bfin_internal_set_wake(unsigned int irq, unsigned int state); +#define gpio_pint_regs bfin_pint_regs +#define adi_internal_set_wake bfin_internal_set_wake + +#define peripheral_request(per, label) (0) +#define peripheral_free(per) +#define peripheral_request_list(per, label) (0) +#define peripheral_free_list(per) +#else  int peripheral_request(unsigned short per, const char *label);  void peripheral_free(unsigned short per);  int peripheral_request_list(const unsigned short per[], const char *label);  void peripheral_free_list(const unsigned short per[]); +#endif -#include <asm/gpio.h> +#include <linux/err.h> +#include <linux/pinctrl/pinctrl.h>  #include <mach/portmux.h> +#include <mach/gpio.h>  #ifndef P_SPORT2_TFS  #define P_SPORT2_TFS P_UNDEF diff --git a/arch/blackfin/include/asm/posix_types.h b/arch/blackfin/include/asm/posix_types.h deleted file mode 100644 index 41bc1875c4d..00000000000 --- a/arch/blackfin/include/asm/posix_types.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2004-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -#ifndef __ARCH_BFIN_POSIX_TYPES_H -#define __ARCH_BFIN_POSIX_TYPES_H - -typedef unsigned short __kernel_mode_t; -#define __kernel_mode_t __kernel_mode_t - -typedef unsigned short __kernel_nlink_t; -#define __kernel_nlink_t __kernel_nlink_t - -typedef unsigned int __kernel_ipc_pid_t; -#define __kernel_ipc_pid_t __kernel_ipc_pid_t - -typedef unsigned long __kernel_size_t; -typedef long __kernel_ssize_t; -typedef int __kernel_ptrdiff_t; -#define __kernel_size_t __kernel_size_t - -typedef unsigned short __kernel_old_uid_t; -typedef unsigned short __kernel_old_gid_t; -#define __kernel_old_uid_t __kernel_old_uid_t - -typedef unsigned short __kernel_old_dev_t; -#define __kernel_old_dev_t __kernel_old_dev_t - -#include <asm-generic/posix_types.h> - -#endif diff --git a/arch/blackfin/include/asm/processor.h b/arch/blackfin/include/asm/processor.h index aea880274de..d0e72e9475a 100644 --- a/arch/blackfin/include/asm/processor.h +++ b/arch/blackfin/include/asm/processor.h @@ -14,7 +14,7 @@  #define current_text_addr() ({ __label__ _l; _l: &&_l;})  #include <asm/ptrace.h> -#include <asm/blackfin.h> +#include <mach/blackfin.h>  static inline unsigned long rdusp(void)  { @@ -75,10 +75,6 @@ static inline void release_thread(struct task_struct *dead_task)  {  } -#define prepare_to_copy(tsk)	do { } while (0) - -extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags); -  /*   * Free current thread data structures etc..   */ @@ -134,6 +130,8 @@ static inline uint32_t __pure bfin_dspid(void)  	return bfin_read_DSPID();  } +#define blackfin_core_id() (bfin_dspid() & 0xff) +  static inline uint32_t __pure bfin_compiled_revid(void)  {  #if defined(CONFIG_BF_REV_0_0) diff --git a/arch/blackfin/include/asm/ptrace.h b/arch/blackfin/include/asm/ptrace.h index 832d7c009a2..c00491594b4 100644 --- a/arch/blackfin/include/asm/ptrace.h +++ b/arch/blackfin/include/asm/ptrace.h @@ -3,115 +3,21 @@   *   * Licensed under the GPL-2 or later.   */ -  #ifndef _BFIN_PTRACE_H  #define _BFIN_PTRACE_H -/* - * GCC defines register number like this: - * ----------------------------- - *       0 - 7 are data registers R0-R7 - *       8 - 15 are address registers P0-P7 - *      16 - 31 dsp registers I/B/L0 -- I/B/L3 & M0--M3 - *      32 - 33 A registers A0 & A1 - *      34 -    status register - * ----------------------------- - * - * We follows above, except: - *      32-33 --- Low 32-bit of A0&1 - *      34-35 --- High 8-bit of A0&1 - */ +#include <uapi/asm/ptrace.h>  #ifndef __ASSEMBLY__ -struct task_struct; - -/* this struct defines the way the registers are stored on the -   stack during a system call. */ - -struct pt_regs { -	long orig_pc; -	long ipend; -	long seqstat; -	long rete; -	long retn; -	long retx; -	long pc;		/* PC == RETI */ -	long rets; -	long reserved;		/* Used as scratch during system calls */ -	long astat; -	long lb1; -	long lb0; -	long lt1; -	long lt0; -	long lc1; -	long lc0; -	long a1w; -	long a1x; -	long a0w; -	long a0x; -	long b3; -	long b2; -	long b1; -	long b0; -	long l3; -	long l2; -	long l1; -	long l0; -	long m3; -	long m2; -	long m1; -	long m0; -	long i3; -	long i2; -	long i1; -	long i0; -	long usp; -	long fp; -	long p5; -	long p4; -	long p3; -	long p2; -	long p1; -	long p0; -	long r7; -	long r6; -	long r5; -	long r4; -	long r3; -	long r2; -	long r1; -	long r0; -	long orig_r0; -	long orig_p0; -	long syscfg; -}; - -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ -#define PTRACE_GETREGS            12 -#define PTRACE_SETREGS            13	/* ptrace signal  */ - -#define PTRACE_GETFDPIC           31	/* get the ELF fdpic loadmap address */ -#define PTRACE_GETFDPIC_EXEC       0	/* [addr] request the executable loadmap */ -#define PTRACE_GETFDPIC_INTERP     1	/* [addr] request the interpreter loadmap */ - -#define PS_S  (0x0002) - -#ifdef __KERNEL__ -  /* user_mode returns true if only one bit is set in IPEND, other than the     master interrupt enable.  */  #define user_mode(regs) (!(((regs)->ipend & ~0x10) & (((regs)->ipend & ~0x10) - 1))) -#define instruction_pointer(regs) ((regs)->pc) -#define user_stack_pointer(regs)  ((regs)->usp) -#define profile_pc(regs) instruction_pointer(regs) -extern void show_regs(struct pt_regs *);  #define arch_has_single_step()	(1) -extern void user_enable_single_step(struct task_struct *child); -extern void user_disable_single_step(struct task_struct *child);  /* common code demands this function */  #define ptrace_disable(child) user_disable_single_step(child) +#define current_user_stack_pointer() rdusp()  extern int is_user_addr_valid(struct task_struct *child,  			      unsigned long start, unsigned long len); @@ -130,75 +36,7 @@ extern int is_user_addr_valid(struct task_struct *child,  	    ((unsigned long)task_stack_page(task) + \  	     (THREAD_SIZE - sizeof(struct pt_regs))) -#endif  /*  __KERNEL__  */ +#include <asm-generic/ptrace.h>  #endif				/* __ASSEMBLY__ */ - -/* - * Offsets used by 'ptrace' system call interface. - */ - -#define PT_R0 204 -#define PT_R1 200 -#define PT_R2 196 -#define PT_R3 192 -#define PT_R4 188 -#define PT_R5 184 -#define PT_R6 180 -#define PT_R7 176 -#define PT_P0 172 -#define PT_P1 168 -#define PT_P2 164 -#define PT_P3 160 -#define PT_P4 156 -#define PT_P5 152 -#define PT_FP 148 -#define PT_USP 144 -#define PT_I0 140 -#define PT_I1 136 -#define PT_I2 132 -#define PT_I3 128 -#define PT_M0 124 -#define PT_M1 120 -#define PT_M2 116 -#define PT_M3 112 -#define PT_L0 108 -#define PT_L1 104 -#define PT_L2 100 -#define PT_L3 96 -#define PT_B0 92 -#define PT_B1 88 -#define PT_B2 84 -#define PT_B3 80 -#define PT_A0X 76 -#define PT_A0W 72 -#define PT_A1X 68 -#define PT_A1W 64 -#define PT_LC0 60 -#define PT_LC1 56 -#define PT_LT0 52 -#define PT_LT1 48 -#define PT_LB0 44 -#define PT_LB1 40 -#define PT_ASTAT 36 -#define PT_RESERVED 32 -#define PT_RETS 28 -#define PT_PC 24 -#define PT_RETX 20 -#define PT_RETN 16 -#define PT_RETE 12 -#define PT_SEQSTAT 8 -#define PT_IPEND 4 - -#define PT_ORIG_R0 208 -#define PT_ORIG_P0 212 -#define PT_SYSCFG 216 -#define PT_TEXT_ADDR 220 -#define PT_TEXT_END_ADDR 224 -#define PT_DATA_ADDR 228 -#define PT_FDPIC_EXEC 232 -#define PT_FDPIC_INTERP 236 - -#define PT_LAST_PSEUDO PT_FDPIC_INTERP -  #endif				/* _BFIN_PTRACE_H */ diff --git a/arch/blackfin/include/asm/resource.h b/arch/blackfin/include/asm/resource.h deleted file mode 100644 index 04bc4db8921..00000000000 --- a/arch/blackfin/include/asm/resource.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/resource.h> diff --git a/arch/blackfin/include/asm/scatterlist.h b/arch/blackfin/include/asm/scatterlist.h deleted file mode 100644 index d177a158895..00000000000 --- a/arch/blackfin/include/asm/scatterlist.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _BLACKFIN_SCATTERLIST_H -#define _BLACKFIN_SCATTERLIST_H - -#include <asm-generic/scatterlist.h> - -#endif				/* !(_BLACKFIN_SCATTERLIST_H) */ diff --git a/arch/blackfin/include/asm/scb.h b/arch/blackfin/include/asm/scb.h new file mode 100644 index 00000000000..a294cc0d1a4 --- /dev/null +++ b/arch/blackfin/include/asm/scb.h @@ -0,0 +1,21 @@ +/* + * arch/blackfin/mach-common/scb-init.c - reprogram system cross bar priority + * + * Copyright 2012 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#define SCB_SLOT_OFFSET	24 +#define SCB_MI_MAX_SLOT 32 + +struct scb_mi_prio { +	unsigned long scb_mi_arbr; +	unsigned long scb_mi_arbw; +	unsigned char scb_mi_slots; +	unsigned char scb_mi_prio[SCB_MI_MAX_SLOT]; +}; + +extern struct scb_mi_prio scb_data[]; + +extern void init_scb(void); diff --git a/arch/blackfin/include/asm/sections.h b/arch/blackfin/include/asm/sections.h index 14a3e66d916..fbd40847572 100644 --- a/arch/blackfin/include/asm/sections.h +++ b/arch/blackfin/include/asm/sections.h @@ -1,8 +1,8 @@  /* - * Copyright 2004-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ + * Copyright 2004-2009 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */  #ifndef _BLACKFIN_SECTIONS_H  #define _BLACKFIN_SECTIONS_H diff --git a/arch/blackfin/include/asm/sembuf.h b/arch/blackfin/include/asm/sembuf.h deleted file mode 100644 index 7673b83cfef..00000000000 --- a/arch/blackfin/include/asm/sembuf.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/sembuf.h> diff --git a/arch/blackfin/include/asm/serial.h b/arch/blackfin/include/asm/serial.h deleted file mode 100644 index a0cb0caff15..00000000000 --- a/arch/blackfin/include/asm/serial.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/serial.h> diff --git a/arch/blackfin/include/asm/setup.h b/arch/blackfin/include/asm/setup.h deleted file mode 100644 index 552df83f1a4..00000000000 --- a/arch/blackfin/include/asm/setup.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/setup.h> diff --git a/arch/blackfin/include/asm/shmbuf.h b/arch/blackfin/include/asm/shmbuf.h deleted file mode 100644 index 83c05fc2de3..00000000000 --- a/arch/blackfin/include/asm/shmbuf.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/shmbuf.h> diff --git a/arch/blackfin/include/asm/shmparam.h b/arch/blackfin/include/asm/shmparam.h deleted file mode 100644 index 93f30deb95d..00000000000 --- a/arch/blackfin/include/asm/shmparam.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/shmparam.h> diff --git a/arch/blackfin/include/asm/sigcontext.h b/arch/blackfin/include/asm/sigcontext.h deleted file mode 100644 index ce4081a4d81..00000000000 --- a/arch/blackfin/include/asm/sigcontext.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2004-2008 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -#ifndef _ASM_BLACKFIN_SIGCONTEXT_H -#define _ASM_BLACKFIN_SIGCONTEXT_H - -/* Add new entries at the end of the structure only.  */ -struct sigcontext { -	unsigned long sc_r0; -	unsigned long sc_r1; -	unsigned long sc_r2; -	unsigned long sc_r3; -	unsigned long sc_r4; -	unsigned long sc_r5; -	unsigned long sc_r6; -	unsigned long sc_r7; -	unsigned long sc_p0; -	unsigned long sc_p1; -	unsigned long sc_p2; -	unsigned long sc_p3; -	unsigned long sc_p4; -	unsigned long sc_p5; -	unsigned long sc_usp; -	unsigned long sc_a0w; -	unsigned long sc_a1w; -	unsigned long sc_a0x; -	unsigned long sc_a1x; -	unsigned long sc_astat; -	unsigned long sc_rets; -	unsigned long sc_pc; -	unsigned long sc_retx; -	unsigned long sc_fp; -	unsigned long sc_i0; -	unsigned long sc_i1; -	unsigned long sc_i2; -	unsigned long sc_i3; -	unsigned long sc_m0; -	unsigned long sc_m1; -	unsigned long sc_m2; -	unsigned long sc_m3; -	unsigned long sc_l0; -	unsigned long sc_l1; -	unsigned long sc_l2; -	unsigned long sc_l3; -	unsigned long sc_b0; -	unsigned long sc_b1; -	unsigned long sc_b2; -	unsigned long sc_b3; -	unsigned long sc_lc0; -	unsigned long sc_lc1; -	unsigned long sc_lt0; -	unsigned long sc_lt1; -	unsigned long sc_lb0; -	unsigned long sc_lb1; -	unsigned long sc_seqstat; -}; - -#endif diff --git a/arch/blackfin/include/asm/siginfo.h b/arch/blackfin/include/asm/siginfo.h deleted file mode 100644 index 3e81306394e..00000000000 --- a/arch/blackfin/include/asm/siginfo.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2004-2008 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -#ifndef _BFIN_SIGINFO_H -#define _BFIN_SIGINFO_H - -#include <linux/types.h> -#include <asm-generic/siginfo.h> - -#define UID16_SIGINFO_COMPAT_NEEDED - -#define si_uid16	_sifields._kill._uid - -#define ILL_ILLPARAOP	(__SI_FAULT|2)	/* illegal opcode combine ********** */ -#define ILL_ILLEXCPT	(__SI_FAULT|4)	/* unrecoverable exception ********** */ -#define ILL_CPLB_VI	(__SI_FAULT|9)	/* D/I CPLB protect violation ******** */ -#define ILL_CPLB_MISS	(__SI_FAULT|10)	/* D/I CPLB miss ******** */ -#define ILL_CPLB_MULHIT	(__SI_FAULT|11)	/* D/I CPLB multiple hit ******** */ - -/* - * SIGBUS si_codes - */ -#define BUS_OPFETCH	(__SI_FAULT|4)	/* error from instruction fetch ******** */ - -/* - * SIGTRAP si_codes - */ -#define TRAP_STEP	(__SI_FAULT|1)	/* single-step breakpoint************* */ -#define TRAP_TRACEFLOW	(__SI_FAULT|2)	/* trace buffer overflow ************* */ -#define TRAP_WATCHPT	(__SI_FAULT|3)	/* watchpoint match      ************* */ -#define TRAP_ILLTRAP	(__SI_FAULT|4)	/* illegal trap          ************* */ - -/* - * SIGSEGV si_codes - */ -#define SEGV_STACKFLOW	(__SI_FAULT|3)	/* stack overflow */ - -#endif diff --git a/arch/blackfin/include/asm/signal.h b/arch/blackfin/include/asm/signal.h deleted file mode 100644 index 77a3bf37b69..00000000000 --- a/arch/blackfin/include/asm/signal.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _BLACKFIN_SIGNAL_H -#define _BLACKFIN_SIGNAL_H - -#define SA_RESTORER 0x04000000 -#include <asm-generic/signal.h> - -#endif diff --git a/arch/blackfin/include/asm/smp.h b/arch/blackfin/include/asm/smp.h index f5b53796711..9631598dcc5 100644 --- a/arch/blackfin/include/asm/smp.h +++ b/arch/blackfin/include/asm/smp.h @@ -17,7 +17,14 @@  #define raw_smp_processor_id()  blackfin_core_id() -extern char coreb_trampoline_start, coreb_trampoline_end; +extern void bfin_relocate_coreb_l1_mem(void); +extern void arch_send_call_function_single_ipi(int cpu); +extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); + +#if defined(CONFIG_SMP) && defined(CONFIG_ICACHE_FLUSH_L1) +asmlinkage void blackfin_icache_flush_range_l1(unsigned long *ptr); +extern unsigned long blackfin_iflush_l1_entry[NR_CPUS]; +#endif  struct corelock_slot {  	int lock; @@ -32,13 +39,16 @@ extern unsigned long dcache_invld_count[NR_CPUS];  #endif  void smp_icache_flush_range_others(unsigned long start, -				   unsigned long end); +					unsigned long end);  #ifdef CONFIG_HOTPLUG_CPU -void coreb_sleep(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); +void coreb_die(void);  void cpu_die(void);  void platform_cpu_die(void);  int __cpu_disable(void);  int __cpu_die(unsigned int cpu);  #endif +void smp_timer_broadcast(const struct cpumask *mask); + +  #endif /* !__ASM_BLACKFIN_SMP_H */ diff --git a/arch/blackfin/include/asm/socket.h b/arch/blackfin/include/asm/socket.h deleted file mode 100644 index 6b71384b9d8..00000000000 --- a/arch/blackfin/include/asm/socket.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/socket.h> diff --git a/arch/blackfin/include/asm/sockios.h b/arch/blackfin/include/asm/sockios.h deleted file mode 100644 index def6d4746ee..00000000000 --- a/arch/blackfin/include/asm/sockios.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/sockios.h> diff --git a/arch/blackfin/include/asm/spinlock.h b/arch/blackfin/include/asm/spinlock.h index 1942ccfedbe..490c7caa02d 100644 --- a/arch/blackfin/include/asm/spinlock.h +++ b/arch/blackfin/include/asm/spinlock.h @@ -1,8 +1,8 @@  /* - * Copyright 2004-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ + * Copyright 2004-2009 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */  #ifndef __BFIN_SPINLOCK_H  #define __BFIN_SPINLOCK_H @@ -11,18 +11,18 @@  # include <asm-generic/spinlock.h>  #else -#include <asm/atomic.h> +#include <linux/atomic.h>  asmlinkage int __raw_spin_is_locked_asm(volatile int *ptr);  asmlinkage void __raw_spin_lock_asm(volatile int *ptr);  asmlinkage int __raw_spin_trylock_asm(volatile int *ptr);  asmlinkage void __raw_spin_unlock_asm(volatile int *ptr); -asmlinkage void arch_read_lock_asm(volatile int *ptr); -asmlinkage int arch_read_trylock_asm(volatile int *ptr); -asmlinkage void arch_read_unlock_asm(volatile int *ptr); -asmlinkage void arch_write_lock_asm(volatile int *ptr); -asmlinkage int arch_write_trylock_asm(volatile int *ptr); -asmlinkage void arch_write_unlock_asm(volatile int *ptr); +asmlinkage void __raw_read_lock_asm(volatile int *ptr); +asmlinkage int __raw_read_trylock_asm(volatile int *ptr); +asmlinkage void __raw_read_unlock_asm(volatile int *ptr); +asmlinkage void __raw_write_lock_asm(volatile int *ptr); +asmlinkage int __raw_write_trylock_asm(volatile int *ptr); +asmlinkage void __raw_write_unlock_asm(volatile int *ptr);  static inline int arch_spin_is_locked(arch_spinlock_t *lock)  { @@ -64,32 +64,36 @@ static inline int arch_write_can_lock(arch_rwlock_t *rw)  static inline void arch_read_lock(arch_rwlock_t *rw)  { -	arch_read_lock_asm(&rw->lock); +	__raw_read_lock_asm(&rw->lock);  } +#define arch_read_lock_flags(lock, flags) arch_read_lock(lock) +  static inline int arch_read_trylock(arch_rwlock_t *rw)  { -	return arch_read_trylock_asm(&rw->lock); +	return __raw_read_trylock_asm(&rw->lock);  }  static inline void arch_read_unlock(arch_rwlock_t *rw)  { -	arch_read_unlock_asm(&rw->lock); +	__raw_read_unlock_asm(&rw->lock);  }  static inline void arch_write_lock(arch_rwlock_t *rw)  { -	arch_write_lock_asm(&rw->lock); +	__raw_write_lock_asm(&rw->lock);  } +#define arch_write_lock_flags(lock, flags) arch_write_lock(lock) +  static inline int arch_write_trylock(arch_rwlock_t *rw)  { -	return arch_write_trylock_asm(&rw->lock); +	return __raw_write_trylock_asm(&rw->lock);  }  static inline void arch_write_unlock(arch_rwlock_t *rw)  { -	arch_write_unlock_asm(&rw->lock); +	__raw_write_unlock_asm(&rw->lock);  }  #define arch_spin_relax(lock)  	cpu_relax() diff --git a/arch/blackfin/include/asm/stat.h b/arch/blackfin/include/asm/stat.h deleted file mode 100644 index 2e27665c4e9..00000000000 --- a/arch/blackfin/include/asm/stat.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2004-2006 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#ifndef _BFIN_STAT_H -#define _BFIN_STAT_H - -struct stat { -	unsigned short st_dev; -	unsigned short __pad1; -	unsigned long st_ino; -	unsigned short st_mode; -	unsigned short st_nlink; -	unsigned short st_uid; -	unsigned short st_gid; -	unsigned short st_rdev; -	unsigned short __pad2; -	unsigned long st_size; -	unsigned long st_blksize; -	unsigned long st_blocks; -	unsigned long st_atime; -	unsigned long __unused1; -	unsigned long st_mtime; -	unsigned long __unused2; -	unsigned long st_ctime; -	unsigned long __unused3; -	unsigned long __unused4; -	unsigned long __unused5; -}; - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat64 { -	unsigned long long st_dev; -	unsigned char __pad1[4]; - -#define STAT64_HAS_BROKEN_ST_INO	1 -	unsigned long __st_ino; - -	unsigned int st_mode; -	unsigned int st_nlink; - -	unsigned long st_uid; -	unsigned long st_gid; - -	unsigned long long st_rdev; -	unsigned char __pad2[4]; - -	long long st_size; -	unsigned long st_blksize; - -	long long st_blocks;	/* Number 512-byte blocks allocated. */ - -	unsigned long st_atime; -	unsigned long st_atime_nsec; - -	unsigned long st_mtime; -	unsigned long st_mtime_nsec; - -	unsigned long st_ctime; -	unsigned long st_ctime_nsec; - -	unsigned long long st_ino; -}; - -#endif				/* _BFIN_STAT_H */ diff --git a/arch/blackfin/include/asm/statfs.h b/arch/blackfin/include/asm/statfs.h deleted file mode 100644 index 0b91fe198c2..00000000000 --- a/arch/blackfin/include/asm/statfs.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/statfs.h> diff --git a/arch/blackfin/include/asm/swab.h b/arch/blackfin/include/asm/swab.h deleted file mode 100644 index 89de6507ca2..00000000000 --- a/arch/blackfin/include/asm/swab.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -#ifndef _BLACKFIN_SWAB_H -#define _BLACKFIN_SWAB_H - -#include <linux/types.h> -#include <asm-generic/swab.h> - -#ifdef __GNUC__ - -static __inline__ __attribute_const__ __u32 __arch_swahb32(__u32 xx) -{ -	__u32 tmp; -	__asm__("%1 = %0 >> 8 (V);\n\t" -		"%0 = %0 << 8 (V);\n\t" -		"%0 = %0 | %1;\n\t" -		: "+d"(xx), "=&d"(tmp)); -	return xx; -} -#define __arch_swahb32 __arch_swahb32 - -static __inline__ __attribute_const__ __u32 __arch_swahw32(__u32 xx) -{ -	__u32 rv; -	__asm__("%0 = PACK(%1.L, %1.H);\n\t": "=d"(rv): "d"(xx)); -	return rv; -} -#define __arch_swahw32 __arch_swahw32 - -static __inline__ __attribute_const__ __u32 __arch_swab32(__u32 xx) -{ -	return __arch_swahb32(__arch_swahw32(xx)); -} -#define __arch_swab32 __arch_swab32 - -static __inline__ __attribute_const__ __u16 __arch_swab16(__u16 xx) -{ -	__u32 xw = xx; -	__asm__("%0 <<= 8;\n	%0.L = %0.L + %0.H (NS);\n": "+d"(xw)); -	return (__u16)xw; -} -#define __arch_swab16 __arch_swab16 - -#endif /* __GNUC__ */ - -#endif				/* _BLACKFIN_SWAB_H */ diff --git a/arch/blackfin/include/asm/switch_to.h b/arch/blackfin/include/asm/switch_to.h new file mode 100644 index 00000000000..aaf671be924 --- /dev/null +++ b/arch/blackfin/include/asm/switch_to.h @@ -0,0 +1,39 @@ +/* + * Copyright 2004-2009 Analog Devices Inc. + *               Tony Kou (tonyko@lineo.ca) + * + * Licensed under the GPL-2 or later + */ + +#ifndef _BLACKFIN_SWITCH_TO_H +#define _BLACKFIN_SWITCH_TO_H + +#define prepare_to_switch()     do { } while(0) + +/* + * switch_to(n) should switch tasks to task ptr, first checking that + * ptr isn't the current task, in which case it does nothing. + */ + +#include <asm/l1layout.h> +#include <asm/mem_map.h> + +asmlinkage struct task_struct *resume(struct task_struct *prev, struct task_struct *next); + +#ifndef CONFIG_SMP +#define switch_to(prev,next,last) \ +do {    \ +	memcpy (&task_thread_info(prev)->l1_task_info, L1_SCRATCH_TASK_INFO, \ +		sizeof *L1_SCRATCH_TASK_INFO); \ +	memcpy (L1_SCRATCH_TASK_INFO, &task_thread_info(next)->l1_task_info, \ +		sizeof *L1_SCRATCH_TASK_INFO); \ +	(last) = resume (prev, next);   \ +} while (0) +#else +#define switch_to(prev, next, last) \ +do {    \ +	(last) = resume(prev, next);   \ +} while (0) +#endif + +#endif /* _BLACKFIN_SWITCH_TO_H */ diff --git a/arch/blackfin/include/asm/termbits.h b/arch/blackfin/include/asm/termbits.h deleted file mode 100644 index 3935b106de7..00000000000 --- a/arch/blackfin/include/asm/termbits.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/termbits.h> diff --git a/arch/blackfin/include/asm/termios.h b/arch/blackfin/include/asm/termios.h deleted file mode 100644 index 280d78a9d96..00000000000 --- a/arch/blackfin/include/asm/termios.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/termios.h> diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h index 02560fd8a12..55f473bdad3 100644 --- a/arch/blackfin/include/asm/thread_info.h +++ b/arch/blackfin/include/asm/thread_info.h @@ -88,19 +88,14 @@ static inline struct thread_info *current_thread_info(void)  #define TI_CPU		12  #define TI_PREEMPT	16 -#define	PREEMPT_ACTIVE	0x4000000 -  /*   * thread information flag bit numbers   */  #define TIF_SYSCALL_TRACE	0	/* syscall trace active */  #define TIF_SIGPENDING		1	/* signal pending */  #define TIF_NEED_RESCHED	2	/* rescheduling necessary */ -#define TIF_POLLING_NRFLAG	3	/* true if poll_idle() is polling -					   TIF_NEED_RESCHED */  #define TIF_MEMDIE		4	/* is terminating due to OOM killer */  #define TIF_RESTORE_SIGMASK	5	/* restore signal mask in do_signal() */ -#define TIF_FREEZE		6	/* is freezing for suspend */  #define TIF_IRQ_SYNC		7	/* sync pipeline stage */  #define TIF_NOTIFY_RESUME	8	/* callback before returning to user */  #define TIF_SINGLESTEP		9 @@ -109,9 +104,6 @@ static inline struct thread_info *current_thread_info(void)  #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)  #define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)  #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED) -#define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG) -#define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK) -#define _TIF_FREEZE		(1<<TIF_FREEZE)  #define _TIF_IRQ_SYNC		(1<<TIF_IRQ_SYNC)  #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)  #define _TIF_SINGLESTEP		(1<<TIF_SINGLESTEP) diff --git a/arch/blackfin/include/asm/topology.h b/arch/blackfin/include/asm/topology.h deleted file mode 100644 index 5428f333a02..00000000000 --- a/arch/blackfin/include/asm/topology.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/topology.h> diff --git a/arch/blackfin/include/asm/traps.h b/arch/blackfin/include/asm/traps.h index 9fe0da612c0..cec771b8100 100644 --- a/arch/blackfin/include/asm/traps.h +++ b/arch/blackfin/include/asm/traps.h @@ -57,7 +57,7 @@  #define HWC_x3(level) \  	"External Memory Addressing Error\n"  #define EXC_0x04(level) \ -	"Unimplmented exception occured\n" \ +	"Unimplmented exception occurred\n" \  	level " - Maybe you forgot to install a custom exception handler?\n"  #define HWC_x12(level) \  	"Performance Monitor Overflow\n" @@ -125,5 +125,7 @@  	level "   for Supervisor use: Supervisor only registers, all MMRs, and Supervisor\n" \  	level "   only instructions.\n" +extern void double_fault_c(struct pt_regs *fp); +  #endif				/* __ASSEMBLY__ */  #endif				/* _BFIN_TRAPS_H */ diff --git a/arch/blackfin/include/asm/types.h b/arch/blackfin/include/asm/types.h deleted file mode 100644 index b9e79bc580d..00000000000 --- a/arch/blackfin/include/asm/types.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/types.h> diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h index 1c0d190adae..57701c3b8a5 100644 --- a/arch/blackfin/include/asm/uaccess.h +++ b/arch/blackfin/include/asm/uaccess.h @@ -34,23 +34,6 @@ static inline void set_fs(mm_segment_t fs)  #define access_ok(type, addr, size) _access_ok((unsigned long)(addr), (size)) -static inline int is_in_rom(unsigned long addr) -{ -	/* -	 * What we are really trying to do is determine if addr is -	 * in an allocated kernel memory region. If not then assume -	 * we cannot free it or otherwise de-allocate it. Ideally -	 * we could restrict this to really being in a ROM or flash, -	 * but that would need to be done on a board by board basis, -	 * not globally. -	 */ -	if ((addr < _ramstart) || (addr >= _ramend)) -		return (1); - -	/* Default case, not in ROM */ -	return (0); -} -  /*   * The fs value determines whether argument validity checking should be   * performed or not.  If get_fs() == USER_DS, checking is performed, with @@ -89,7 +72,7 @@ struct exception_table_entry {  	({							\  		int _err = 0;					\  		typeof(*(p)) _x = (x);				\ -		typeof(*(p)) *_p = (p);				\ +		typeof(*(p)) __user *_p = (p);				\  		if (!access_ok(VERIFY_WRITE, _p, sizeof(*(_p)))) {\  			_err = -EFAULT;				\  		}						\ @@ -108,8 +91,8 @@ struct exception_table_entry {  			long _xl, _xh;				\  			_xl = ((long *)&_x)[0];			\  			_xh = ((long *)&_x)[1];			\ -			__put_user_asm(_xl, ((long *)_p)+0, );	\ -			__put_user_asm(_xh, ((long *)_p)+1, );	\ +			__put_user_asm(_xl, ((long __user *)_p)+0, );	\ +			__put_user_asm(_xh, ((long __user *)_p)+1, );	\  		} break;					\  		default:					\  			_err = __put_user_bad();		\ @@ -136,7 +119,7 @@ static inline int bad_user_access_length(void)   * aliasing issues.   */ -#define __ptr(x) ((unsigned long *)(x)) +#define __ptr(x) ((unsigned long __force *)(x))  #define __put_user_asm(x,p,bhw)				\  	__asm__ (#bhw"[%1] = %0;\n\t"			\ @@ -195,19 +178,20 @@ static inline unsigned long __must_check  copy_from_user(void *to, const void __user *from, unsigned long n)  {  	if (access_ok(VERIFY_READ, from, n)) -		memcpy(to, from, n); +		memcpy(to, (const void __force *)from, n);  	else  		return n;  	return 0;  }  static inline unsigned long __must_check -copy_to_user(void *to, const void __user *from, unsigned long n) +copy_to_user(void __user *to, const void *from, unsigned long n)  {  	if (access_ok(VERIFY_WRITE, to, n)) -		memcpy(to, from, n); +		memcpy((void __force *)to, from, n);  	else  		return n; +	SSYNC();  	return 0;  } @@ -216,12 +200,12 @@ copy_to_user(void *to, const void __user *from, unsigned long n)   */  static inline long __must_check -strncpy_from_user(char *dst, const char *src, long count) +strncpy_from_user(char *dst, const char __user *src, long count)  {  	char *tmp;  	if (!access_ok(VERIFY_READ, src, 1))  		return -EFAULT; -	strncpy(dst, src, count); +	strncpy(dst, (const char __force *)src, count);  	for (tmp = dst; *tmp && count > 0; tmp++, count--) ;  	return (tmp - dst);  } @@ -237,18 +221,18 @@ strncpy_from_user(char *dst, const char *src, long count)   * On exception, returns 0.   * If the string is too long, returns a value greater than n.   */ -static inline long __must_check strnlen_user(const char *src, long n) +static inline long __must_check strnlen_user(const char __user *src, long n)  {  	if (!access_ok(VERIFY_READ, src, 1))  		return 0; -	return strnlen(src, n) + 1; +	return strnlen((const char __force *)src, n) + 1;  } -static inline long __must_check strlen_user(const char *src) +static inline long __must_check strlen_user(const char __user *src)  {  	if (!access_ok(VERIFY_READ, src, 1))  		return 0; -	return strlen(src) + 1; +	return strlen((const char __force *)src) + 1;  }  /* @@ -256,11 +240,11 @@ static inline long __must_check strlen_user(const char *src)   */  static inline unsigned long __must_check -__clear_user(void *to, unsigned long n) +__clear_user(void __user *to, unsigned long n)  {  	if (!access_ok(VERIFY_WRITE, to, n))  		return n; -	memset(to, 0, n); +	memset((void __force *)to, 0, n);  	return 0;  } diff --git a/arch/blackfin/include/asm/ucontext.h b/arch/blackfin/include/asm/ucontext.h deleted file mode 100644 index 9bc07b9f30f..00000000000 --- a/arch/blackfin/include/asm/ucontext.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/ucontext.h> diff --git a/arch/blackfin/include/asm/unaligned.h b/arch/blackfin/include/asm/unaligned.h deleted file mode 100644 index 6cecbbb2111..00000000000 --- a/arch/blackfin/include/asm/unaligned.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/unaligned.h> diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h index 928ae975b87..c8c8ff9eff6 100644 --- a/arch/blackfin/include/asm/unistd.h +++ b/arch/blackfin/include/asm/unistd.h @@ -3,451 +3,20 @@   *   * Licensed under the GPL-2 or later.   */ -  #ifndef __ASM_BFIN_UNISTD_H  #define __ASM_BFIN_UNISTD_H -/* - * This file contains the system call numbers. - */ -#define __NR_restart_syscall	  0 -#define __NR_exit		  1 -#define __NR_fork		  2 -#define __NR_read		  3 -#define __NR_write		  4 -#define __NR_open		  5 -#define __NR_close		  6 -				/* 7 __NR_waitpid obsolete */ -#define __NR_creat		  8 -#define __NR_link		  9 -#define __NR_unlink		 10 -#define __NR_execve		 11 -#define __NR_chdir		 12 -#define __NR_time		 13 -#define __NR_mknod		 14 -#define __NR_chmod		 15 -#define __NR_chown		 16 -				/* 17 __NR_break obsolete */ -				/* 18 __NR_oldstat obsolete */ -#define __NR_lseek		 19 -#define __NR_getpid		 20 -#define __NR_mount		 21 -				/* 22 __NR_umount obsolete */ -#define __NR_setuid		 23 -#define __NR_getuid		 24 -#define __NR_stime		 25 -#define __NR_ptrace		 26 -#define __NR_alarm		 27 -				/* 28 __NR_oldfstat obsolete */ -#define __NR_pause		 29 -				/* 30 __NR_utime obsolete */ -				/* 31 __NR_stty obsolete */ -				/* 32 __NR_gtty obsolete */ -#define __NR_access		 33 -#define __NR_nice		 34 -				/* 35 __NR_ftime obsolete */ -#define __NR_sync		 36 -#define __NR_kill		 37 -#define __NR_rename		 38 -#define __NR_mkdir		 39 -#define __NR_rmdir		 40 -#define __NR_dup		 41 -#define __NR_pipe		 42 -#define __NR_times		 43 -				/* 44 __NR_prof obsolete */ -#define __NR_brk		 45 -#define __NR_setgid		 46 -#define __NR_getgid		 47 -				/* 48 __NR_signal obsolete */ -#define __NR_geteuid		 49 -#define __NR_getegid		 50 -#define __NR_acct		 51 -#define __NR_umount2		 52 -				/* 53 __NR_lock obsolete */ -#define __NR_ioctl		 54 -#define __NR_fcntl		 55 -				/* 56 __NR_mpx obsolete */ -#define __NR_setpgid		 57 -				/* 58 __NR_ulimit obsolete */ -				/* 59 __NR_oldolduname obsolete */ -#define __NR_umask		 60 -#define __NR_chroot		 61 -#define __NR_ustat		 62 -#define __NR_dup2		 63 -#define __NR_getppid		 64 -#define __NR_getpgrp		 65 -#define __NR_setsid		 66 -				/* 67 __NR_sigaction obsolete */ -#define __NR_sgetmask		 68 -#define __NR_ssetmask		 69 -#define __NR_setreuid		 70 -#define __NR_setregid		 71 -				/* 72 __NR_sigsuspend obsolete */ -				/* 73 __NR_sigpending obsolete */ -#define __NR_sethostname	 74 -#define __NR_setrlimit		 75 -				/* 76 __NR_old_getrlimit obsolete */ -#define __NR_getrusage		 77 -#define __NR_gettimeofday	 78 -#define __NR_settimeofday	 79 -#define __NR_getgroups		 80 -#define __NR_setgroups		 81 -				/* 82 __NR_select obsolete */ -#define __NR_symlink		 83 -				/* 84 __NR_oldlstat obsolete */ -#define __NR_readlink		 85 -				/* 86 __NR_uselib obsolete */ -				/* 87 __NR_swapon obsolete */ -#define __NR_reboot		 88 -				/* 89 __NR_readdir obsolete */ -				/* 90 __NR_mmap obsolete */ -#define __NR_munmap		 91 -#define __NR_truncate		 92 -#define __NR_ftruncate		 93 -#define __NR_fchmod		 94 -#define __NR_fchown		 95 -#define __NR_getpriority	 96 -#define __NR_setpriority	 97 -				/* 98 __NR_profil obsolete */ -#define __NR_statfs		 99 -#define __NR_fstatfs		100 -				/* 101 __NR_ioperm */ -				/* 102 __NR_socketcall obsolete */ -#define __NR_syslog		103 -#define __NR_setitimer		104 -#define __NR_getitimer		105 -#define __NR_stat		106 -#define __NR_lstat		107 -#define __NR_fstat		108 -				/* 109 __NR_olduname obsolete */ -				/* 110 __NR_iopl obsolete */ -#define __NR_vhangup		111 -				/* 112 __NR_idle obsolete */ -				/* 113 __NR_vm86old */ -#define __NR_wait4		114 -				/* 115 __NR_swapoff obsolete */ -#define __NR_sysinfo		116 -				/* 117 __NR_ipc oboslete */ -#define __NR_fsync		118 -				/* 119 __NR_sigreturn obsolete */ -#define __NR_clone		120 -#define __NR_setdomainname	121 -#define __NR_uname		122 -				/* 123 __NR_modify_ldt obsolete */ -#define __NR_adjtimex		124 -#define __NR_mprotect		125 -				/* 126 __NR_sigprocmask obsolete */ -				/* 127 __NR_create_module obsolete */ -#define __NR_init_module	128 -#define __NR_delete_module	129 -				/* 130 __NR_get_kernel_syms obsolete */ -#define __NR_quotactl		131 -#define __NR_getpgid		132 -#define __NR_fchdir		133 -#define __NR_bdflush		134 -				/* 135 was sysfs */ -#define __NR_personality	136 -				/* 137 __NR_afs_syscall */ -#define __NR_setfsuid		138 -#define __NR_setfsgid		139 -#define __NR__llseek		140 -#define __NR_getdents		141 -				/* 142 __NR__newselect obsolete */ -#define __NR_flock		143 -				/* 144 __NR_msync obsolete */ -#define __NR_readv		145 -#define __NR_writev		146 -#define __NR_getsid		147 -#define __NR_fdatasync		148 -#define __NR__sysctl		149 -				/* 150 __NR_mlock */ -				/* 151 __NR_munlock */ -				/* 152 __NR_mlockall */ -				/* 153 __NR_munlockall */ -#define __NR_sched_setparam		154 -#define __NR_sched_getparam		155 -#define __NR_sched_setscheduler		156 -#define __NR_sched_getscheduler		157 -#define __NR_sched_yield		158 -#define __NR_sched_get_priority_max	159 -#define __NR_sched_get_priority_min	160 -#define __NR_sched_rr_get_interval	161 -#define __NR_nanosleep		162 -#define __NR_mremap		163 -#define __NR_setresuid		164 -#define __NR_getresuid		165 -				/* 166 __NR_vm86 */ -				/* 167 __NR_query_module */ -				/* 168 __NR_poll */ -#define __NR_nfsservctl		169 -#define __NR_setresgid		170 -#define __NR_getresgid		171 -#define __NR_prctl		172 -#define __NR_rt_sigreturn	173 -#define __NR_rt_sigaction	174 -#define __NR_rt_sigprocmask	175 -#define __NR_rt_sigpending	176 -#define __NR_rt_sigtimedwait	177 -#define __NR_rt_sigqueueinfo	178 -#define __NR_rt_sigsuspend	179 -#define __NR_pread		180 -#define __NR_pwrite		181 -#define __NR_lchown		182 -#define __NR_getcwd		183 -#define __NR_capget		184 -#define __NR_capset		185 -#define __NR_sigaltstack	186 -#define __NR_sendfile		187 -				/* 188 __NR_getpmsg */ -				/* 189 __NR_putpmsg */ -#define __NR_vfork		190 -#define __NR_getrlimit		191 -#define __NR_mmap2		192 -#define __NR_truncate64		193 -#define __NR_ftruncate64	194 -#define __NR_stat64		195 -#define __NR_lstat64		196 -#define __NR_fstat64		197 -#define __NR_chown32		198 -#define __NR_getuid32		199 -#define __NR_getgid32		200 -#define __NR_geteuid32		201 -#define __NR_getegid32		202 -#define __NR_setreuid32		203 -#define __NR_setregid32		204 -#define __NR_getgroups32	205 -#define __NR_setgroups32	206 -#define __NR_fchown32		207 -#define __NR_setresuid32	208 -#define __NR_getresuid32	209 -#define __NR_setresgid32	210 -#define __NR_getresgid32	211 -#define __NR_lchown32		212 -#define __NR_setuid32		213 -#define __NR_setgid32		214 -#define __NR_setfsuid32		215 -#define __NR_setfsgid32		216 -#define __NR_pivot_root		217 -				/* 218 __NR_mincore */ -				/* 219 __NR_madvise */ -#define __NR_getdents64		220 -#define __NR_fcntl64		221 -				/* 222 reserved for TUX */ -				/* 223 reserved for TUX */ -#define __NR_gettid		224 -#define __NR_readahead		225 -#define __NR_setxattr		226 -#define __NR_lsetxattr		227 -#define __NR_fsetxattr		228 -#define __NR_getxattr		229 -#define __NR_lgetxattr		230 -#define __NR_fgetxattr		231 -#define __NR_listxattr		232 -#define __NR_llistxattr		233 -#define __NR_flistxattr		234 -#define __NR_removexattr	235 -#define __NR_lremovexattr	236 -#define __NR_fremovexattr	237 -#define __NR_tkill		238 -#define __NR_sendfile64		239 -#define __NR_futex		240 -#define __NR_sched_setaffinity	241 -#define __NR_sched_getaffinity	242 -				/* 243 __NR_set_thread_area */ -				/* 244 __NR_get_thread_area */ -#define __NR_io_setup		245 -#define __NR_io_destroy		246 -#define __NR_io_getevents	247 -#define __NR_io_submit		248 -#define __NR_io_cancel		249 -				/* 250 __NR_alloc_hugepages */ -				/* 251 __NR_free_hugepages */ -#define __NR_exit_group		252 -#define __NR_lookup_dcookie     253 -#define __NR_bfin_spinlock      254 - -#define __NR_epoll_create	255 -#define __NR_epoll_ctl		256 -#define __NR_epoll_wait		257 -				/* 258 __NR_remap_file_pages */ -#define __NR_set_tid_address	259 -#define __NR_timer_create	260 -#define __NR_timer_settime	261 -#define __NR_timer_gettime	262 -#define __NR_timer_getoverrun	263 -#define __NR_timer_delete	264 -#define __NR_clock_settime	265 -#define __NR_clock_gettime	266 -#define __NR_clock_getres	267 -#define __NR_clock_nanosleep	268 -#define __NR_statfs64		269 -#define __NR_fstatfs64		270 -#define __NR_tgkill		271 -#define __NR_utimes		272 -#define __NR_fadvise64_64	273 -				/* 274 __NR_vserver */ -				/* 275 __NR_mbind */ -				/* 276 __NR_get_mempolicy */ -				/* 277 __NR_set_mempolicy */ -#define __NR_mq_open 		278 -#define __NR_mq_unlink		279 -#define __NR_mq_timedsend	280 -#define __NR_mq_timedreceive	281 -#define __NR_mq_notify		282 -#define __NR_mq_getsetattr	283 -#define __NR_kexec_load		284 -#define __NR_waitid		285 -#define __NR_add_key		286 -#define __NR_request_key	287 -#define __NR_keyctl		288 -#define __NR_ioprio_set		289 -#define __NR_ioprio_get		290 -#define __NR_inotify_init	291 -#define __NR_inotify_add_watch	292 -#define __NR_inotify_rm_watch	293 -				/* 294 __NR_migrate_pages */ -#define __NR_openat		295 -#define __NR_mkdirat		296 -#define __NR_mknodat		297 -#define __NR_fchownat		298 -#define __NR_futimesat		299 -#define __NR_fstatat64		300 -#define __NR_unlinkat		301 -#define __NR_renameat		302 -#define __NR_linkat		303 -#define __NR_symlinkat		304 -#define __NR_readlinkat		305 -#define __NR_fchmodat		306 -#define __NR_faccessat		307 -#define __NR_pselect6		308 -#define __NR_ppoll		309 -#define __NR_unshare		310 - -/* Blackfin private syscalls */ -#define __NR_sram_alloc		311 -#define __NR_sram_free		312 -#define __NR_dma_memcpy		313 - -/* socket syscalls */ -#define __NR_accept		314 -#define __NR_bind		315 -#define __NR_connect		316 -#define __NR_getpeername	317 -#define __NR_getsockname	318 -#define __NR_getsockopt		319 -#define __NR_listen		320 -#define __NR_recv		321 -#define __NR_recvfrom		322 -#define __NR_recvmsg		323 -#define __NR_send		324 -#define __NR_sendmsg		325 -#define __NR_sendto		326 -#define __NR_setsockopt		327 -#define __NR_shutdown		328 -#define __NR_socket		329 -#define __NR_socketpair		330 - -/* sysv ipc syscalls */ -#define __NR_semctl		331 -#define __NR_semget		332 -#define __NR_semop		333 -#define __NR_msgctl		334 -#define __NR_msgget		335 -#define __NR_msgrcv		336 -#define __NR_msgsnd		337 -#define __NR_shmat		338 -#define __NR_shmctl		339 -#define __NR_shmdt		340 -#define __NR_shmget		341 - -#define __NR_splice		342 -#define __NR_sync_file_range	343 -#define __NR_tee		344 -#define __NR_vmsplice		345 - -#define __NR_epoll_pwait	346 -#define __NR_utimensat		347 -#define __NR_signalfd		348 -#define __NR_timerfd_create	349 -#define __NR_eventfd		350 -#define __NR_pread64		351 -#define __NR_pwrite64		352 -#define __NR_fadvise64		353 -#define __NR_set_robust_list	354 -#define __NR_get_robust_list	355 -#define __NR_fallocate		356 -#define __NR_semtimedop		357 -#define __NR_timerfd_settime	358 -#define __NR_timerfd_gettime	359 -#define __NR_signalfd4		360 -#define __NR_eventfd2		361 -#define __NR_epoll_create1	362 -#define __NR_dup3		363 -#define __NR_pipe2		364 -#define __NR_inotify_init1	365 -#define __NR_preadv		366 -#define __NR_pwritev		367 -#define __NR_rt_tgsigqueueinfo	368 -#define __NR_perf_event_open	369 -#define __NR_recvmmsg		370 -#define __NR_fanotify_init	371 -#define __NR_fanotify_mark	372 -#define __NR_prlimit64		373 -#define __NR_cacheflush		374 -#define __NR_syscall		375 -#define NR_syscalls		__NR_syscall +#include <uapi/asm/unistd.h> -/* Old optional stuff no one actually uses */ -#define __IGNORE_sysfs -#define __IGNORE_uselib - -/* Implement the newer interfaces */ -#define __IGNORE_mmap -#define __IGNORE_poll -#define __IGNORE_select -#define __IGNORE_utime - -/* Not relevant on no-mmu */ -#define __IGNORE_swapon -#define __IGNORE_swapoff -#define __IGNORE_msync -#define __IGNORE_mlock -#define __IGNORE_munlock -#define __IGNORE_mlockall -#define __IGNORE_munlockall -#define __IGNORE_mincore -#define __IGNORE_madvise -#define __IGNORE_remap_file_pages -#define __IGNORE_mbind -#define __IGNORE_get_mempolicy -#define __IGNORE_set_mempolicy -#define __IGNORE_migrate_pages -#define __IGNORE_move_pages -#define __IGNORE_getcpu - -#ifdef __KERNEL__ -#define __ARCH_WANT_IPC_PARSE_VERSION  #define __ARCH_WANT_STAT64  #define __ARCH_WANT_SYS_ALARM  #define __ARCH_WANT_SYS_GETHOSTNAME  #define __ARCH_WANT_SYS_PAUSE -#define __ARCH_WANT_SYS_SGETMASK  #define __ARCH_WANT_SYS_TIME  #define __ARCH_WANT_SYS_FADVISE64  #define __ARCH_WANT_SYS_GETPGRP  #define __ARCH_WANT_SYS_LLSEEK  #define __ARCH_WANT_SYS_NICE -#define __ARCH_WANT_SYS_RT_SIGACTION -#define __ARCH_WANT_SYS_RT_SIGSUSPEND - -/* - * "Conditional" syscalls - * - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), - * but it doesn't work on all toolchains, so we just do it by hand - */ -#define cond_syscall(x) asm(".weak\t_" #x "\n\t.set\t_" #x ",_sys_ni_syscall"); - -#endif	/* __KERNEL__ */ +#define __ARCH_WANT_SYS_VFORK  #endif				/* __ASM_BFIN_UNISTD_H */ diff --git a/arch/blackfin/include/asm/user.h b/arch/blackfin/include/asm/user.h deleted file mode 100644 index 4792a60831e..00000000000 --- a/arch/blackfin/include/asm/user.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/user.h> diff --git a/arch/blackfin/include/asm/xor.h b/arch/blackfin/include/asm/xor.h deleted file mode 100644 index c82eb12a5b1..00000000000 --- a/arch/blackfin/include/asm/xor.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/xor.h>  | 
