diff options
Diffstat (limited to 'arch/m68k/include/asm')
| -rw-r--r-- | arch/m68k/include/asm/bitops.h | 57 | ||||
| -rw-r--r-- | arch/m68k/include/asm/coldfire/flexbus.h | 68 | ||||
| -rw-r--r-- | arch/m68k/include/asm/coldfire/qspi.h | 2 | ||||
| -rw-r--r-- | arch/m68k/include/asm/io.h | 38 | ||||
| -rw-r--r-- | arch/m68k/include/asm/m5271.h | 26 | 
5 files changed, 158 insertions, 33 deletions
| diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index ad971b4f3..525d90ccb 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -17,41 +17,36 @@ extern int test_and_change_bit(int nr, volatile void *addr);  #ifdef __KERNEL__ -/* - * ffs: find first bit set. This is defined the same way as - * the libc and compiler builtin ffs routines, therefore - * differs in spirit from the above ffz (man ffs). - */ -extern __inline__ int ffs(int x) + +extern inline int test_bit(int nr, __const__ volatile void *addr) +{ +	__const__ unsigned int *p = (__const__ unsigned int *) addr; + +	return (p[nr >> 5] & (1UL << (nr & 31))) != 0; +} + +extern inline int test_and_set_bit(int nr, volatile void *vaddr)  { -	int r = 1; +	char retval; + +	volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3]; +	__asm__ __volatile__ ("bset %2,(%4); sne %0" +	     : "=d" (retval), "=m" (*p) +	     : "di" (nr & 7), "m" (*p), "a" (p)); -	if (!x) -		return 0; -	if (!(x & 0xffff)) { -		x >>= 16; -		r += 16; -	} -	if (!(x & 0xff)) { -		x >>= 8; -		r += 8; -	} -	if (!(x & 0xf)) { -		x >>= 4; -		r += 4; -	} -	if (!(x & 3)) { -		x >>= 2; -		r += 2; -	} -	if (!(x & 1)) { -		x >>= 1; -		r += 1; -	} -	return r; +	return retval;  } +  #define __ffs(x) (ffs(x) - 1) -#define PLATFORM_FFS + +/* + *  * hweightN: returns the hamming weight (i.e. the number + *   * of bits set) of a N-bit word + *    */ + +#define hweight32(x) generic_hweight32(x) +#define hweight16(x) generic_hweight16(x) +#define hweight8(x) generic_hweight8(x)  #endif /* __KERNEL__ */ diff --git a/arch/m68k/include/asm/coldfire/flexbus.h b/arch/m68k/include/asm/coldfire/flexbus.h index 51cbbd8b2..9a3078a14 100644 --- a/arch/m68k/include/asm/coldfire/flexbus.h +++ b/arch/m68k/include/asm/coldfire/flexbus.h @@ -29,7 +29,57 @@  /*********************************************************************  * FlexBus Chip Selects (FBCS)  *********************************************************************/ +#ifdef CONFIG_M5235 +typedef struct fbcs { +    u16 csar0;      /* Chip-select Address */ +    u16 res1; +    u32 csmr0;      /* Chip-select Mask */ +    u16 res2; +    u16 cscr0;      /* Chip-select Control */ + +    u16 csar1; +    u16 res3; +    u32 csmr1; +    u16 res4; +    u16 cscr1; + +    u16 csar2; +    u16 res5; +    u32 csmr2; +    u16 res6; +    u16 cscr2; + +    u16 csar3; +    u16 res7; +    u32 csmr3; +    u16 res8; +    u16 cscr3; + +    u16 csar4; +    u16 res9; +    u32 csmr4; +    u16 res10; +    u16 cscr4; + +    u16 csar5; +    u16 res11; +    u32 csmr5; +    u16 res12; +    u16 cscr5; +    u16 csar6; +    u16 res13; +    u32 csmr6; +    u16 res14; +    u16 cscr6; + +    u16 csar7; +    u16 res15; +    u32 csmr7; +    u16 res16; +    u16 cscr7; +} fbcs_t; +#else  typedef struct fbcs {  	u32 csar0;		/* Chip-select Address */  	u32 csmr0;		/* Chip-select Mask */ @@ -56,6 +106,7 @@ typedef struct fbcs {  	u32 csmr7;  	u32 cscr7;  } fbcs_t; +#endif  #define FBCS_CSAR_BA(x)			((x) & 0xFFFF0000) @@ -94,6 +145,22 @@ typedef struct fbcs {  #endif  #define FBCS_CSMR_V			(0x00000001)	/* Valid bit */ +#ifdef CONFIG_M5235 +#define FBCS_CSCR_SRWS(x)       (((x) & 0x3) << 14) +#define FBCS_CSCR_IWS(x)        (((x) & 0xF) << 10) +#define FBCS_CSCR_AA_ON         (1 << 8) +#define FBCS_CSCR_AA_OFF        (0 << 8) +#define FBCS_CSCR_PS_32         (0 << 6) +#define FBCS_CSCR_PS_16         (2 << 6) +#define FBCS_CSCR_PS_8          (1 << 6) +#define FBCS_CSCR_BEM_ON        (1 << 5) +#define FBCS_CSCR_BEM_OFF       (0 << 5) +#define FBCS_CSCR_BSTR_ON       (1 << 4) +#define FBCS_CSCR_BSTR_OFF      (0 << 4) +#define FBCS_CSCR_BSTW_ON       (1 << 3) +#define FBCS_CSCR_BSTW_OFF      (0 << 3) +#define FBCS_CSCR_SWWS(x)       (((x) & 0x7) << 0) +#else  #define FBCS_CSCR_SWS(x)		(((x) & 0x3F) << 26)  #define FBCS_CSCR_SWS_MASK		(0x03FFFFFF)  #define FBCS_CSCR_SWSEN			(0x00800000) @@ -116,5 +183,6 @@ typedef struct fbcs {  #define FBCS_CSCR_PS_16			(0x00000080)  #define FBCS_CSCR_PS_8			(0x00000040)  #define FBCS_CSCR_PS_32			(0x00000000) +#endif  #endif				/* __FLEXBUS_H */ diff --git a/arch/m68k/include/asm/coldfire/qspi.h b/arch/m68k/include/asm/coldfire/qspi.h index 8bcd2e4db..9fd98f6c0 100644 --- a/arch/m68k/include/asm/coldfire/qspi.h +++ b/arch/m68k/include/asm/coldfire/qspi.h @@ -98,7 +98,7 @@ typedef struct qspi_ctrl {  #define QSPI_QAR_RECV			(0x0010)  #define QSPI_QAR_CMD			(0x0020) -/* DR */ +/* DR with RAM command word definitions */  #define QSPI_QDR_CONT			(0x8000)  #define QSPI_QDR_BITSE			(0x4000)  #define QSPI_QDR_DT			(0x2000) diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h index d86eaf95e..50ed74989 100644 --- a/arch/m68k/include/asm/io.h +++ b/arch/m68k/include/asm/io.h @@ -1,7 +1,7 @@  /*   * IO header file   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -225,6 +225,42 @@ extern inline void out_be32(volatile unsigned *addr, int val)  	*addr = val;  } +/* Clear and set bits in one shot. These macros can be used to clear and + * set multiple bits in a register using a single call. These macros can + * also be used to set a multiple-bit bit pattern using a mask, by + * specifying the mask in the 'clear' parameter and the new bit pattern + * in the 'set' parameter. + */ + +#define clrbits(type, addr, clear) \ +	out_##type((addr), in_##type(addr) & ~(clear)) + +#define setbits(type, addr, set) \ +	out_##type((addr), in_##type(addr) | (set)) + +#define clrsetbits(type, addr, clear, set) \ +	out_##type((addr), (in_##type(addr) & ~(clear)) | (set)) + +#define clrbits_be32(addr, clear) clrbits(be32, addr, clear) +#define setbits_be32(addr, set) setbits(be32, addr, set) +#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set) + +#define clrbits_le32(addr, clear) clrbits(le32, addr, clear) +#define setbits_le32(addr, set) setbits(le32, addr, set) +#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set) + +#define clrbits_be16(addr, clear) clrbits(be16, addr, clear) +#define setbits_be16(addr, set) setbits(be16, addr, set) +#define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set) + +#define clrbits_le16(addr, clear) clrbits(le16, addr, clear) +#define setbits_le16(addr, set) setbits(le16, addr, set) +#define clrsetbits_le16(addr, clear, set) clrsetbits(le16, addr, clear, set) + +#define clrbits_8(addr, clear) clrbits(8, addr, clear) +#define setbits_8(addr, set) setbits(8, addr, set) +#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) +  static inline void sync(void)  {  	/* This sync function is for PowerPC or other architecture instruction diff --git a/arch/m68k/include/asm/m5271.h b/arch/m68k/include/asm/m5271.h index d25261bcd..b2bc05111 100644 --- a/arch/m68k/include/asm/m5271.h +++ b/arch/m68k/include/asm/m5271.h @@ -171,6 +171,32 @@  #define MCF_GPIO_PAR_UART_U1RXD_UART1		0x0C00  #define MCF_GPIO_PAR_UART_U1TXD_UART1		0x0300 +/* Bit definitions and macros for PAR_QSPI */ +#define MCF_GPIO_PAR_QSPI_PCS1_UNMASK		0x3F +#define MCF_GPIO_PAR_QSPI_PCS1_PCS1		0xC0 +#define MCF_GPIO_PAR_QSPI_PCS1_SDRAM_SCKE	0x80 +#define MCF_GPIO_PAR_QSPI_PCS1_GPIO		0x00 +#define MCF_GPIO_PAR_QSPI_PCS0_UNMASK		0xDF +#define MCF_GPIO_PAR_QSPI_PCS0_PCS0		0x20 +#define MCF_GPIO_PAR_QSPI_PCS0_GPIO		0x00 +#define MCF_GPIO_PAR_QSPI_SIN_UNMASK		0xE7 +#define MCF_GPIO_PAR_QSPI_SIN_SIN		0x18 +#define MCF_GPIO_PAR_QSPI_SIN_I2C_SDA		0x10 +#define MCF_GPIO_PAR_QSPI_SIN_GPIO		0x00 +#define MCF_GPIO_PAR_QSPI_SOUT_UNMASK		0xFB +#define MCF_GPIO_PAR_QSPI_SOUT_SOUT		0x04 +#define MCF_GPIO_PAR_QSPI_SOUT_GPIO		0x00 +#define MCF_GPIO_PAR_QSPI_SCK_UNMASK		0xFC +#define MCF_GPIO_PAR_QSPI_SCK_SCK		0x03 +#define MCF_GPIO_PAR_QSPI_SCK_I2C_SCL		0x02 +#define MCF_GPIO_PAR_QSPI_SCK_GPIO		0x00 + +/* Bit definitions and macros for PAR_TIMER for QSPI */ +#define MCF_GPIO_PAR_TIMER_T3IN_UNMASK		0x3FFF +#define MCF_GPIO_PAR_TIMER_T3IN_QSPI_PCS2	0x4000 +#define MCF_GPIO_PAR_TIMER_T3OUT_UNMASK		0xFF3F +#define MCF_GPIO_PAR_TIMER_T3OUT_QSPI_PCS3	0x0040 +  #define MCF_GPIO_PAR_SDRAM_PAR_CSSDCS(x)	(((x)&0x03)<<6)  #define MCF_SDRAMC_DCR				0x000040 |