| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 1 | /* | 
 | 2 |  * R8A66597 HCD (Host Controller Driver) | 
 | 3 |  * | 
 | 4 |  * Copyright (C) 2006-2007 Renesas Solutions Corp. | 
 | 5 |  * Portions Copyright (C) 2004 Psion Teklogix (for NetBook PRO) | 
 | 6 |  * Portions Copyright (C) 2004-2005 David Brownell | 
 | 7 |  * Portions Copyright (C) 1999 Roman Weissgaerber | 
 | 8 |  * | 
 | 9 |  * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> | 
 | 10 |  * | 
 | 11 |  * This program is free software; you can redistribute it and/or modify | 
 | 12 |  * it under the terms of the GNU General Public License as published by | 
 | 13 |  * the Free Software Foundation; version 2 of the License. | 
 | 14 |  * | 
 | 15 |  * This program is distributed in the hope that it will be useful, | 
 | 16 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 17 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 18 |  * GNU General Public License for more details. | 
 | 19 |  * | 
 | 20 |  * You should have received a copy of the GNU General Public License | 
 | 21 |  * along with this program; if not, write to the Free Software | 
 | 22 |  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA | 
 | 23 |  * | 
 | 24 |  */ | 
 | 25 |  | 
 | 26 | #ifndef __R8A66597_H__ | 
 | 27 | #define __R8A66597_H__ | 
 | 28 |  | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 29 | #ifdef CONFIG_HAVE_CLK | 
| Magnus Damm | 765786e | 2008-10-31 20:22:38 +0900 | [diff] [blame] | 30 | #include <linux/clk.h> | 
 | 31 | #endif | 
 | 32 |  | 
| Yoshihiro Shimoda | 5effabb | 2009-05-26 18:24:34 +0900 | [diff] [blame] | 33 | #include <linux/usb/r8a66597.h> | 
 | 34 |  | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 35 | #define R8A66597_MAX_NUM_PIPE		10 | 
 | 36 | #define R8A66597_BUF_BSIZE		8 | 
 | 37 | #define R8A66597_MAX_DEVICE		10 | 
 | 38 | #define R8A66597_MAX_ROOT_HUB		2 | 
| Yoshihiro Shimoda | 29fab0c | 2008-04-10 21:05:55 +0900 | [diff] [blame] | 39 | #define R8A66597_MAX_SAMPLING		5 | 
 | 40 | #define R8A66597_RH_POLL_TIME		10 | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 41 | #define R8A66597_MAX_DMA_CHANNEL	2 | 
 | 42 | #define R8A66597_PIPE_NO_DMA		R8A66597_MAX_DMA_CHANNEL | 
 | 43 | #define check_bulk_or_isoc(pipenum)	((pipenum >= 1 && pipenum <= 5)) | 
 | 44 | #define check_interrupt(pipenum)	((pipenum >= 6 && pipenum <= 9)) | 
 | 45 | #define make_devsel(addr)		(addr << 12) | 
 | 46 |  | 
 | 47 | struct r8a66597_pipe_info { | 
| Yoshihiro Shimoda | 6d87910 | 2008-04-10 21:05:47 +0900 | [diff] [blame] | 48 | 	unsigned long timer_interval; | 
| Yoshihiro Shimoda | e294531 | 2007-07-18 23:10:34 +0900 | [diff] [blame] | 49 | 	u16 pipenum; | 
| Joe Perches | dc0d5c1 | 2007-12-17 11:40:18 -0800 | [diff] [blame] | 50 | 	u16 address;	/* R8A66597 HCD usb address */ | 
| Yoshihiro Shimoda | e294531 | 2007-07-18 23:10:34 +0900 | [diff] [blame] | 51 | 	u16 epnum; | 
 | 52 | 	u16 maxpacket; | 
 | 53 | 	u16 type; | 
 | 54 | 	u16 bufnum; | 
 | 55 | 	u16 buf_bsize; | 
 | 56 | 	u16 interval; | 
 | 57 | 	u16 dir_in; | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 58 | }; | 
 | 59 |  | 
 | 60 | struct r8a66597_pipe { | 
 | 61 | 	struct r8a66597_pipe_info info; | 
 | 62 |  | 
 | 63 | 	unsigned long fifoaddr; | 
 | 64 | 	unsigned long fifosel; | 
 | 65 | 	unsigned long fifoctr; | 
 | 66 | 	unsigned long pipectr; | 
 | 67 | 	unsigned long pipetre; | 
 | 68 | 	unsigned long pipetrn; | 
 | 69 | }; | 
 | 70 |  | 
 | 71 | struct r8a66597_td { | 
 | 72 | 	struct r8a66597_pipe *pipe; | 
 | 73 | 	struct urb *urb; | 
 | 74 | 	struct list_head queue; | 
 | 75 |  | 
 | 76 | 	u16 type; | 
 | 77 | 	u16 pipenum; | 
 | 78 | 	int iso_cnt; | 
 | 79 |  | 
 | 80 | 	u16 address;		/* R8A66597's USB address */ | 
 | 81 | 	u16 maxpacket; | 
 | 82 |  | 
 | 83 | 	unsigned zero_packet:1; | 
 | 84 | 	unsigned short_packet:1; | 
 | 85 | 	unsigned set_address:1; | 
 | 86 | }; | 
 | 87 |  | 
 | 88 | struct r8a66597_device { | 
 | 89 | 	u16	address;	/* R8A66597's USB address */ | 
 | 90 | 	u16	hub_port; | 
 | 91 | 	u16	root_port; | 
 | 92 |  | 
 | 93 | 	unsigned short ep_in_toggle; | 
 | 94 | 	unsigned short ep_out_toggle; | 
 | 95 | 	unsigned char pipe_cnt[R8A66597_MAX_NUM_PIPE]; | 
 | 96 | 	unsigned char dma_map; | 
 | 97 |  | 
 | 98 | 	enum usb_device_state state; | 
 | 99 |  | 
 | 100 | 	struct usb_device *udev; | 
 | 101 | 	int usb_address; | 
 | 102 | 	struct list_head device_list; | 
 | 103 | }; | 
 | 104 |  | 
 | 105 | struct r8a66597_root_hub { | 
 | 106 | 	u32 port; | 
 | 107 | 	u16 old_syssts; | 
 | 108 | 	int scount; | 
 | 109 |  | 
 | 110 | 	struct r8a66597_device	*dev; | 
 | 111 | }; | 
 | 112 |  | 
 | 113 | struct r8a66597 { | 
 | 114 | 	spinlock_t lock; | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 115 | 	void __iomem *reg; | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 116 | #ifdef CONFIG_HAVE_CLK | 
| Magnus Damm | 765786e | 2008-10-31 20:22:38 +0900 | [diff] [blame] | 117 | 	struct clk *clk; | 
 | 118 | #endif | 
| Yoshihiro Shimoda | 5effabb | 2009-05-26 18:24:34 +0900 | [diff] [blame] | 119 | 	struct r8a66597_platdata	*pdata; | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 120 | 	struct r8a66597_device		device0; | 
 | 121 | 	struct r8a66597_root_hub	root_hub[R8A66597_MAX_ROOT_HUB]; | 
 | 122 | 	struct list_head		pipe_queue[R8A66597_MAX_NUM_PIPE]; | 
 | 123 |  | 
 | 124 | 	struct timer_list rh_timer; | 
 | 125 | 	struct timer_list td_timer[R8A66597_MAX_NUM_PIPE]; | 
| Yoshihiro Shimoda | 6d87910 | 2008-04-10 21:05:47 +0900 | [diff] [blame] | 126 | 	struct timer_list interval_timer[R8A66597_MAX_NUM_PIPE]; | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 127 |  | 
 | 128 | 	unsigned short address_map; | 
 | 129 | 	unsigned short timeout_map; | 
| Yoshihiro Shimoda | 6d87910 | 2008-04-10 21:05:47 +0900 | [diff] [blame] | 130 | 	unsigned short interval_map; | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 131 | 	unsigned char pipe_cnt[R8A66597_MAX_NUM_PIPE]; | 
 | 132 | 	unsigned char dma_map; | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 133 | 	unsigned int max_root_hub; | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 134 |  | 
 | 135 | 	struct list_head child_device; | 
 | 136 | 	unsigned long child_connect_map[4]; | 
| Yoshihiro Shimoda | e1e609b | 2009-03-19 14:18:15 +0900 | [diff] [blame] | 137 |  | 
 | 138 | 	unsigned bus_suspended:1; | 
| Yoshihiro Shimoda | 5effabb | 2009-05-26 18:24:34 +0900 | [diff] [blame] | 139 | 	unsigned irq_sense_low:1; | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 140 | }; | 
 | 141 |  | 
 | 142 | static inline struct r8a66597 *hcd_to_r8a66597(struct usb_hcd *hcd) | 
 | 143 | { | 
 | 144 | 	return (struct r8a66597 *)(hcd->hcd_priv); | 
 | 145 | } | 
 | 146 |  | 
 | 147 | static inline struct usb_hcd *r8a66597_to_hcd(struct r8a66597 *r8a66597) | 
 | 148 | { | 
 | 149 | 	return container_of((void *)r8a66597, struct usb_hcd, hcd_priv); | 
 | 150 | } | 
 | 151 |  | 
 | 152 | static inline struct r8a66597_td *r8a66597_get_td(struct r8a66597 *r8a66597, | 
 | 153 | 						  u16 pipenum) | 
 | 154 | { | 
 | 155 | 	if (unlikely(list_empty(&r8a66597->pipe_queue[pipenum]))) | 
 | 156 | 		return NULL; | 
 | 157 |  | 
 | 158 | 	return list_entry(r8a66597->pipe_queue[pipenum].next, | 
 | 159 | 			  struct r8a66597_td, queue); | 
 | 160 | } | 
 | 161 |  | 
 | 162 | static inline struct urb *r8a66597_get_urb(struct r8a66597 *r8a66597, | 
 | 163 | 					   u16 pipenum) | 
 | 164 | { | 
 | 165 | 	struct r8a66597_td *td; | 
 | 166 |  | 
 | 167 | 	td = r8a66597_get_td(r8a66597, pipenum); | 
 | 168 | 	return (td ? td->urb : NULL); | 
 | 169 | } | 
 | 170 |  | 
 | 171 | static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) | 
 | 172 | { | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 173 | 	return ioread16(r8a66597->reg + offset); | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 174 | } | 
 | 175 |  | 
 | 176 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | 
 | 177 | 				      unsigned long offset, u16 *buf, | 
 | 178 | 				      int len) | 
 | 179 | { | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 180 | 	void __iomem *fifoaddr = r8a66597->reg + offset; | 
| Yoshihiro Shimoda | 9424ea2 | 2008-04-10 21:05:58 +0900 | [diff] [blame] | 181 | 	unsigned long count; | 
 | 182 |  | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 183 | 	if (r8a66597->pdata->on_chip) { | 
 | 184 | 		count = len / 4; | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 185 | 		ioread32_rep(fifoaddr, buf, count); | 
| Yoshihiro Shimoda | 9424ea2 | 2008-04-10 21:05:58 +0900 | [diff] [blame] | 186 |  | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 187 | 		if (len & 0x00000003) { | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 188 | 			unsigned long tmp = ioread32(fifoaddr); | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 189 | 			memcpy((unsigned char *)buf + count * 4, &tmp, | 
 | 190 | 			       len & 0x03); | 
 | 191 | 		} | 
 | 192 | 	} else { | 
 | 193 | 		len = (len + 1) / 2; | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 194 | 		ioread16_rep(fifoaddr, buf, len); | 
| Yoshihiro Shimoda | 9424ea2 | 2008-04-10 21:05:58 +0900 | [diff] [blame] | 195 | 	} | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 196 | } | 
 | 197 |  | 
 | 198 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, | 
 | 199 | 				  unsigned long offset) | 
 | 200 | { | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 201 | 	iowrite16(val, r8a66597->reg + offset); | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 202 | } | 
 | 203 |  | 
| Yoshihiro Shimoda | f2e9039 | 2011-07-07 09:57:10 +0900 | [diff] [blame] | 204 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, | 
 | 205 | 				 u16 val, u16 pat, unsigned long offset) | 
 | 206 | { | 
 | 207 | 	u16 tmp; | 
 | 208 | 	tmp = r8a66597_read(r8a66597, offset); | 
 | 209 | 	tmp = tmp & (~pat); | 
 | 210 | 	tmp = tmp | val; | 
 | 211 | 	r8a66597_write(r8a66597, tmp, offset); | 
 | 212 | } | 
 | 213 |  | 
 | 214 | #define r8a66597_bclr(r8a66597, val, offset)	\ | 
 | 215 | 			r8a66597_mdfy(r8a66597, 0, val, offset) | 
 | 216 | #define r8a66597_bset(r8a66597, val, offset)	\ | 
 | 217 | 			r8a66597_mdfy(r8a66597, val, 0, offset) | 
 | 218 |  | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 219 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | 
| Yoshihiro Shimoda | f2e9039 | 2011-07-07 09:57:10 +0900 | [diff] [blame] | 220 | 				       struct r8a66597_pipe *pipe, u16 *buf, | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 221 | 				       int len) | 
 | 222 | { | 
| Yoshihiro Shimoda | f2e9039 | 2011-07-07 09:57:10 +0900 | [diff] [blame] | 223 | 	void __iomem *fifoaddr = r8a66597->reg + pipe->fifoaddr; | 
| Yoshihiro Shimoda | 9424ea2 | 2008-04-10 21:05:58 +0900 | [diff] [blame] | 224 | 	unsigned long count; | 
 | 225 | 	unsigned char *pb; | 
 | 226 | 	int i; | 
 | 227 |  | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 228 | 	if (r8a66597->pdata->on_chip) { | 
 | 229 | 		count = len / 4; | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 230 | 		iowrite32_rep(fifoaddr, buf, count); | 
| Yoshihiro Shimoda | 9424ea2 | 2008-04-10 21:05:58 +0900 | [diff] [blame] | 231 |  | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 232 | 		if (len & 0x00000003) { | 
 | 233 | 			pb = (unsigned char *)buf + count * 4; | 
 | 234 | 			for (i = 0; i < (len & 0x00000003); i++) { | 
 | 235 | 				if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 236 | 					iowrite8(pb[i], fifoaddr + i); | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 237 | 				else | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 238 | 					iowrite8(pb[i], fifoaddr + 3 - i); | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 239 | 			} | 
 | 240 | 		} | 
 | 241 | 	} else { | 
 | 242 | 		int odd = len & 0x0001; | 
 | 243 |  | 
 | 244 | 		len = len / 2; | 
| Nobuhiro Iwamatsu | ac9dfe9 | 2010-10-14 14:52:54 +0900 | [diff] [blame] | 245 | 		iowrite16_rep(fifoaddr, buf, len); | 
| Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 246 | 		if (unlikely(odd)) { | 
 | 247 | 			buf = &buf[len]; | 
| Yoshihiro Shimoda | f2e9039 | 2011-07-07 09:57:10 +0900 | [diff] [blame] | 248 | 			if (r8a66597->pdata->wr0_shorted_to_wr1) | 
 | 249 | 				r8a66597_bclr(r8a66597, MBW_16, pipe->fifosel); | 
| Paul Mundt | 1c98347 | 2010-06-02 16:27:54 +0900 | [diff] [blame] | 250 | 			iowrite8((unsigned char)*buf, fifoaddr); | 
| Yoshihiro Shimoda | f2e9039 | 2011-07-07 09:57:10 +0900 | [diff] [blame] | 251 | 			if (r8a66597->pdata->wr0_shorted_to_wr1) | 
 | 252 | 				r8a66597_bset(r8a66597, MBW_16, pipe->fifosel); | 
| Yoshihiro Shimoda | 9424ea2 | 2008-04-10 21:05:58 +0900 | [diff] [blame] | 253 | 		} | 
 | 254 | 	} | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 255 | } | 
 | 256 |  | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 257 | static inline unsigned long get_syscfg_reg(int port) | 
 | 258 | { | 
 | 259 | 	return port == 0 ? SYSCFG0 : SYSCFG1; | 
 | 260 | } | 
 | 261 |  | 
 | 262 | static inline unsigned long get_syssts_reg(int port) | 
 | 263 | { | 
 | 264 | 	return port == 0 ? SYSSTS0 : SYSSTS1; | 
 | 265 | } | 
 | 266 |  | 
 | 267 | static inline unsigned long get_dvstctr_reg(int port) | 
 | 268 | { | 
 | 269 | 	return port == 0 ? DVSTCTR0 : DVSTCTR1; | 
 | 270 | } | 
 | 271 |  | 
| Yoshihiro Shimoda | 9424ea2 | 2008-04-10 21:05:58 +0900 | [diff] [blame] | 272 | static inline unsigned long get_dmacfg_reg(int port) | 
 | 273 | { | 
 | 274 | 	return port == 0 ? DMA0CFG : DMA1CFG; | 
 | 275 | } | 
 | 276 |  | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 277 | static inline unsigned long get_intenb_reg(int port) | 
 | 278 | { | 
 | 279 | 	return port == 0 ? INTENB1 : INTENB2; | 
 | 280 | } | 
 | 281 |  | 
 | 282 | static inline unsigned long get_intsts_reg(int port) | 
 | 283 | { | 
 | 284 | 	return port == 0 ? INTSTS1 : INTSTS2; | 
 | 285 | } | 
 | 286 |  | 
 | 287 | static inline u16 get_rh_usb_speed(struct r8a66597 *r8a66597, int port) | 
 | 288 | { | 
 | 289 | 	unsigned long dvstctr_reg = get_dvstctr_reg(port); | 
 | 290 |  | 
 | 291 | 	return r8a66597_read(r8a66597, dvstctr_reg) & RHST; | 
 | 292 | } | 
 | 293 |  | 
 | 294 | static inline void r8a66597_port_power(struct r8a66597 *r8a66597, int port, | 
 | 295 | 				       int power) | 
 | 296 | { | 
 | 297 | 	unsigned long dvstctr_reg = get_dvstctr_reg(port); | 
 | 298 |  | 
| Yoshihiro Shimoda | 5effabb | 2009-05-26 18:24:34 +0900 | [diff] [blame] | 299 | 	if (r8a66597->pdata->port_power) { | 
 | 300 | 		r8a66597->pdata->port_power(port, power); | 
 | 301 | 	} else { | 
 | 302 | 		if (power) | 
 | 303 | 			r8a66597_bset(r8a66597, VBOUT, dvstctr_reg); | 
 | 304 | 		else | 
 | 305 | 			r8a66597_bclr(r8a66597, VBOUT, dvstctr_reg); | 
 | 306 | 	} | 
 | 307 | } | 
 | 308 |  | 
 | 309 | static inline u16 get_xtal_from_pdata(struct r8a66597_platdata *pdata) | 
 | 310 | { | 
 | 311 | 	u16 clock = 0; | 
 | 312 |  | 
 | 313 | 	switch (pdata->xtal) { | 
 | 314 | 	case R8A66597_PLATDATA_XTAL_12MHZ: | 
 | 315 | 		clock = XTAL12; | 
 | 316 | 		break; | 
 | 317 | 	case R8A66597_PLATDATA_XTAL_24MHZ: | 
 | 318 | 		clock = XTAL24; | 
 | 319 | 		break; | 
 | 320 | 	case R8A66597_PLATDATA_XTAL_48MHZ: | 
 | 321 | 		clock = XTAL48; | 
 | 322 | 		break; | 
 | 323 | 	default: | 
 | 324 | 		printk(KERN_ERR "r8a66597: platdata clock is wrong.\n"); | 
 | 325 | 		break; | 
 | 326 | 	} | 
 | 327 |  | 
 | 328 | 	return clock; | 
| Yoshihiro Shimoda | 5d30435 | 2007-05-10 13:18:19 +0900 | [diff] [blame] | 329 | } | 
 | 330 |  | 
 | 331 | #define get_pipectr_addr(pipenum)	(PIPE1CTR + (pipenum - 1) * 2) | 
 | 332 | #define get_pipetre_addr(pipenum)	(PIPE1TRE + (pipenum - 1) * 4) | 
 | 333 | #define get_pipetrn_addr(pipenum)	(PIPE1TRN + (pipenum - 1) * 4) | 
 | 334 | #define get_devadd_addr(address)	(DEVADD0 + address * 2) | 
 | 335 |  | 
 | 336 | #define enable_irq_ready(r8a66597, pipenum)	\ | 
 | 337 | 	enable_pipe_irq(r8a66597, pipenum, BRDYENB) | 
 | 338 | #define disable_irq_ready(r8a66597, pipenum)	\ | 
 | 339 | 	disable_pipe_irq(r8a66597, pipenum, BRDYENB) | 
 | 340 | #define enable_irq_empty(r8a66597, pipenum)	\ | 
 | 341 | 	enable_pipe_irq(r8a66597, pipenum, BEMPENB) | 
 | 342 | #define disable_irq_empty(r8a66597, pipenum)	\ | 
 | 343 | 	disable_pipe_irq(r8a66597, pipenum, BEMPENB) | 
 | 344 | #define enable_irq_nrdy(r8a66597, pipenum)	\ | 
 | 345 | 	enable_pipe_irq(r8a66597, pipenum, NRDYENB) | 
 | 346 | #define disable_irq_nrdy(r8a66597, pipenum)	\ | 
 | 347 | 	disable_pipe_irq(r8a66597, pipenum, NRDYENB) | 
 | 348 |  | 
 | 349 | #endif	/* __R8A66597_H__ */ | 
 | 350 |  |