Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: r8a66597-udc: add support for SUDMAC

SH7757 has a USB function with internal DMA controller (SUDMAC).
This patch supports the SUDMAC. The SUDMAC is incompatible with
general-purpose DMAC. So, it doesn't use dmaengine.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Yoshihiro Shimoda and committed by
Felipe Balbi
b8a56e17 12158f42

+430 -20
+345 -19
drivers/usb/gadget/r8a66597-udc.c
··· 18 18 #include <linux/clk.h> 19 19 #include <linux/err.h> 20 20 #include <linux/slab.h> 21 + #include <linux/dma-mapping.h> 21 22 22 23 #include <linux/usb/ch9.h> 23 24 #include <linux/usb/gadget.h> 24 25 25 26 #include "r8a66597-udc.h" 26 27 27 - #define DRIVER_VERSION "2009-08-18" 28 + #define DRIVER_VERSION "2011-09-26" 28 29 29 30 static const char udc_name[] = "r8a66597_udc"; 30 31 static const char *r8a66597_ep_name[] = { ··· 185 184 } 186 185 } 187 186 187 + static void control_reg_sqset(struct r8a66597 *r8a66597, u16 pipenum) 188 + { 189 + unsigned long offset; 190 + 191 + pipe_stop(r8a66597, pipenum); 192 + 193 + if (pipenum == 0) { 194 + r8a66597_bset(r8a66597, SQSET, DCPCTR); 195 + } else if (pipenum < R8A66597_MAX_NUM_PIPE) { 196 + offset = get_pipectr_addr(pipenum); 197 + r8a66597_bset(r8a66597, SQSET, offset); 198 + } else { 199 + dev_err(r8a66597_to_dev(r8a66597), 200 + "unexpect pipe num(%d)\n", pipenum); 201 + } 202 + } 203 + 204 + static u16 control_reg_sqmon(struct r8a66597 *r8a66597, u16 pipenum) 205 + { 206 + unsigned long offset; 207 + 208 + if (pipenum == 0) { 209 + return r8a66597_read(r8a66597, DCPCTR) & SQMON; 210 + } else if (pipenum < R8A66597_MAX_NUM_PIPE) { 211 + offset = get_pipectr_addr(pipenum); 212 + return r8a66597_read(r8a66597, offset) & SQMON; 213 + } else { 214 + dev_err(r8a66597_to_dev(r8a66597), 215 + "unexpect pipe num(%d)\n", pipenum); 216 + } 217 + 218 + return 0; 219 + } 220 + 221 + static u16 save_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum) 222 + { 223 + return control_reg_sqmon(r8a66597, pipenum); 224 + } 225 + 226 + static void restore_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum, 227 + u16 toggle) 228 + { 229 + if (toggle) 230 + control_reg_sqset(r8a66597, pipenum); 231 + else 232 + control_reg_sqclr(r8a66597, pipenum); 233 + } 234 + 188 235 static inline int get_buffer_size(struct r8a66597 *r8a66597, u16 pipenum) 189 236 { 190 237 u16 tmp; ··· 269 220 return MBW_16; 270 221 } 271 222 223 + static void r8a66597_change_curpipe(struct r8a66597 *r8a66597, u16 pipenum, 224 + u16 isel, u16 fifosel) 225 + { 226 + u16 tmp, mask, loop; 227 + int i = 0; 228 + 229 + if (!pipenum) { 230 + mask = ISEL | CURPIPE; 231 + loop = isel; 232 + } else { 233 + mask = CURPIPE; 234 + loop = pipenum; 235 + } 236 + r8a66597_mdfy(r8a66597, loop, mask, fifosel); 237 + 238 + do { 239 + tmp = r8a66597_read(r8a66597, fifosel); 240 + if (i++ > 1000000) { 241 + dev_err(r8a66597_to_dev(r8a66597), 242 + "r8a66597: register%x, loop %x " 243 + "is timeout\n", fifosel, loop); 244 + break; 245 + } 246 + ndelay(1); 247 + } while ((tmp & mask) != loop); 248 + } 249 + 272 250 static inline void pipe_change(struct r8a66597 *r8a66597, u16 pipenum) 273 251 { 274 252 struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum]; 275 253 276 254 if (ep->use_dma) 277 - return; 255 + r8a66597_bclr(r8a66597, DREQE, ep->fifosel); 278 256 279 257 r8a66597_mdfy(r8a66597, pipenum, CURPIPE, ep->fifosel); 280 258 281 259 ndelay(450); 282 260 283 - r8a66597_bset(r8a66597, mbw_value(r8a66597), ep->fifosel); 261 + if (r8a66597_is_sudmac(r8a66597) && ep->use_dma) 262 + r8a66597_bclr(r8a66597, mbw_value(r8a66597), ep->fifosel); 263 + else 264 + r8a66597_bset(r8a66597, mbw_value(r8a66597), ep->fifosel); 265 + 266 + if (ep->use_dma) 267 + r8a66597_bset(r8a66597, DREQE, ep->fifosel); 284 268 } 285 269 286 270 static int pipe_buffer_setting(struct r8a66597 *r8a66597, ··· 418 336 ep->fifoaddr = CFIFO; 419 337 ep->fifosel = CFIFOSEL; 420 338 ep->fifoctr = CFIFOCTR; 421 - ep->fifotrn = 0; 422 339 423 340 ep->pipectr = get_pipectr_addr(pipenum); 341 + if (is_bulk_pipe(pipenum) || is_isoc_pipe(pipenum)) { 342 + ep->pipetre = get_pipetre_addr(pipenum); 343 + ep->pipetrn = get_pipetrn_addr(pipenum); 344 + } else { 345 + ep->pipetre = 0; 346 + ep->pipetrn = 0; 347 + } 424 348 ep->pipenum = pipenum; 425 349 ep->ep.maxpacket = usb_endpoint_maxp(desc); 426 350 r8a66597->pipenum2ep[pipenum] = ep; ··· 586 498 } 587 499 } 588 500 501 + static void disable_fifosel(struct r8a66597 *r8a66597, u16 pipenum, 502 + u16 fifosel) 503 + { 504 + u16 tmp; 505 + 506 + tmp = r8a66597_read(r8a66597, fifosel) & CURPIPE; 507 + if (tmp == pipenum) 508 + r8a66597_change_curpipe(r8a66597, 0, 0, fifosel); 509 + } 510 + 511 + static void change_bfre_mode(struct r8a66597 *r8a66597, u16 pipenum, 512 + int enable) 513 + { 514 + struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum]; 515 + u16 tmp, toggle; 516 + 517 + /* check current BFRE bit */ 518 + r8a66597_write(r8a66597, pipenum, PIPESEL); 519 + tmp = r8a66597_read(r8a66597, PIPECFG) & R8A66597_BFRE; 520 + if ((enable && tmp) || (!enable && !tmp)) 521 + return; 522 + 523 + /* change BFRE bit */ 524 + pipe_stop(r8a66597, pipenum); 525 + disable_fifosel(r8a66597, pipenum, CFIFOSEL); 526 + disable_fifosel(r8a66597, pipenum, D0FIFOSEL); 527 + disable_fifosel(r8a66597, pipenum, D1FIFOSEL); 528 + 529 + toggle = save_usb_toggle(r8a66597, pipenum); 530 + 531 + r8a66597_write(r8a66597, pipenum, PIPESEL); 532 + if (enable) 533 + r8a66597_bset(r8a66597, R8A66597_BFRE, PIPECFG); 534 + else 535 + r8a66597_bclr(r8a66597, R8A66597_BFRE, PIPECFG); 536 + 537 + /* initialize for internal BFRE flag */ 538 + r8a66597_bset(r8a66597, ACLRM, ep->pipectr); 539 + r8a66597_bclr(r8a66597, ACLRM, ep->pipectr); 540 + 541 + restore_usb_toggle(r8a66597, pipenum, toggle); 542 + } 543 + 544 + static int sudmac_alloc_channel(struct r8a66597 *r8a66597, 545 + struct r8a66597_ep *ep, 546 + struct r8a66597_request *req) 547 + { 548 + struct r8a66597_dma *dma; 549 + 550 + if (!r8a66597_is_sudmac(r8a66597)) 551 + return -ENODEV; 552 + 553 + /* Check transfer type */ 554 + if (!is_bulk_pipe(ep->pipenum)) 555 + return -EIO; 556 + 557 + if (r8a66597->dma.used) 558 + return -EBUSY; 559 + 560 + /* set SUDMAC parameters */ 561 + dma = &r8a66597->dma; 562 + dma->used = 1; 563 + if (ep->desc->bEndpointAddress & USB_DIR_IN) { 564 + dma->dir = 1; 565 + } else { 566 + dma->dir = 0; 567 + change_bfre_mode(r8a66597, ep->pipenum, 1); 568 + } 569 + 570 + /* set r8a66597_ep paramters */ 571 + ep->use_dma = 1; 572 + ep->dma = dma; 573 + ep->fifoaddr = D0FIFO; 574 + ep->fifosel = D0FIFOSEL; 575 + ep->fifoctr = D0FIFOCTR; 576 + 577 + /* dma mapping */ 578 + req->req.dma = dma_map_single(r8a66597_to_dev(ep->r8a66597), 579 + req->req.buf, req->req.length, 580 + dma->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); 581 + 582 + return 0; 583 + } 584 + 585 + static void sudmac_free_channel(struct r8a66597 *r8a66597, 586 + struct r8a66597_ep *ep, 587 + struct r8a66597_request *req) 588 + { 589 + if (!r8a66597_is_sudmac(r8a66597)) 590 + return; 591 + 592 + dma_unmap_single(r8a66597_to_dev(ep->r8a66597), 593 + req->req.dma, req->req.length, 594 + ep->dma->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); 595 + 596 + r8a66597_bclr(r8a66597, DREQE, ep->fifosel); 597 + r8a66597_change_curpipe(r8a66597, 0, 0, ep->fifosel); 598 + 599 + ep->dma->used = 0; 600 + ep->use_dma = 0; 601 + ep->fifoaddr = CFIFO; 602 + ep->fifosel = CFIFOSEL; 603 + ep->fifoctr = CFIFOCTR; 604 + } 605 + 606 + static void sudmac_start(struct r8a66597 *r8a66597, struct r8a66597_ep *ep, 607 + struct r8a66597_request *req) 608 + { 609 + BUG_ON(req->req.length == 0); 610 + 611 + r8a66597_sudmac_write(r8a66597, LBA_WAIT, CH0CFG); 612 + r8a66597_sudmac_write(r8a66597, req->req.dma, CH0BA); 613 + r8a66597_sudmac_write(r8a66597, req->req.length, CH0BBC); 614 + r8a66597_sudmac_write(r8a66597, CH0ENDE, DINTCTRL); 615 + 616 + r8a66597_sudmac_write(r8a66597, DEN, CH0DEN); 617 + } 618 + 589 619 static void start_packet_write(struct r8a66597_ep *ep, 590 620 struct r8a66597_request *req) 591 621 { ··· 714 508 disable_irq_empty(r8a66597, ep->pipenum); 715 509 pipe_start(r8a66597, ep->pipenum); 716 510 717 - tmp = r8a66597_read(r8a66597, ep->fifoctr); 718 - if (unlikely((tmp & FRDY) == 0)) 719 - pipe_irq_enable(r8a66597, ep->pipenum); 720 - else 721 - irq_packet_write(ep, req); 511 + if (req->req.length == 0) { 512 + transfer_complete(ep, req, 0); 513 + } else { 514 + r8a66597_write(r8a66597, ~(1 << ep->pipenum), BRDYSTS); 515 + if (sudmac_alloc_channel(r8a66597, ep, req) < 0) { 516 + /* PIO mode */ 517 + pipe_change(r8a66597, ep->pipenum); 518 + disable_irq_empty(r8a66597, ep->pipenum); 519 + pipe_start(r8a66597, ep->pipenum); 520 + tmp = r8a66597_read(r8a66597, ep->fifoctr); 521 + if (unlikely((tmp & FRDY) == 0)) 522 + pipe_irq_enable(r8a66597, ep->pipenum); 523 + else 524 + irq_packet_write(ep, req); 525 + } else { 526 + /* DMA mode */ 527 + pipe_change(r8a66597, ep->pipenum); 528 + disable_irq_nrdy(r8a66597, ep->pipenum); 529 + pipe_start(r8a66597, ep->pipenum); 530 + enable_irq_nrdy(r8a66597, ep->pipenum); 531 + sudmac_start(r8a66597, ep, req); 532 + } 533 + } 722 534 } 723 535 724 536 static void start_packet_read(struct r8a66597_ep *ep, ··· 751 527 pipe_start(r8a66597, pipenum); 752 528 pipe_irq_enable(r8a66597, pipenum); 753 529 } else { 754 - if (ep->use_dma) { 755 - r8a66597_bset(r8a66597, TRCLR, ep->fifosel); 756 - pipe_change(r8a66597, pipenum); 757 - r8a66597_bset(r8a66597, TRENB, ep->fifosel); 530 + pipe_stop(r8a66597, pipenum); 531 + if (ep->pipetre) { 532 + enable_irq_nrdy(r8a66597, pipenum); 533 + r8a66597_write(r8a66597, TRCLR, ep->pipetre); 758 534 r8a66597_write(r8a66597, 759 - (req->req.length + ep->ep.maxpacket - 1) 760 - / ep->ep.maxpacket, 761 - ep->fifotrn); 535 + DIV_ROUND_UP(req->req.length, ep->ep.maxpacket), 536 + ep->pipetrn); 537 + r8a66597_bset(r8a66597, TRENB, ep->pipetre); 762 538 } 763 - pipe_start(r8a66597, pipenum); /* trigger once */ 764 - pipe_irq_enable(r8a66597, pipenum); 539 + 540 + if (sudmac_alloc_channel(r8a66597, ep, req) < 0) { 541 + /* PIO mode */ 542 + change_bfre_mode(r8a66597, ep->pipenum, 0); 543 + pipe_start(r8a66597, pipenum); /* trigger once */ 544 + pipe_irq_enable(r8a66597, pipenum); 545 + } else { 546 + pipe_change(r8a66597, pipenum); 547 + sudmac_start(r8a66597, ep, req); 548 + pipe_start(r8a66597, pipenum); /* trigger once */ 549 + } 765 550 } 766 551 } 767 552 ··· 926 693 927 694 if (!list_empty(&ep->queue)) 928 695 restart = 1; 696 + 697 + if (ep->use_dma) 698 + sudmac_free_channel(ep->r8a66597, ep, req); 929 699 930 700 spin_unlock(&ep->r8a66597->lock); 931 701 req->req.complete(&ep->ep, &req->req); ··· 1406 1170 } 1407 1171 } 1408 1172 1173 + static void sudmac_finish(struct r8a66597 *r8a66597, struct r8a66597_ep *ep) 1174 + { 1175 + u16 pipenum; 1176 + struct r8a66597_request *req; 1177 + u32 len; 1178 + int i = 0; 1179 + 1180 + pipenum = ep->pipenum; 1181 + pipe_change(r8a66597, pipenum); 1182 + 1183 + while (!(r8a66597_read(r8a66597, ep->fifoctr) & FRDY)) { 1184 + udelay(1); 1185 + if (unlikely(i++ >= 10000)) { /* timeout = 10 msec */ 1186 + dev_err(r8a66597_to_dev(r8a66597), 1187 + "%s: FRDY was not set (%d)\n", 1188 + __func__, pipenum); 1189 + return; 1190 + } 1191 + } 1192 + 1193 + r8a66597_bset(r8a66597, BCLR, ep->fifoctr); 1194 + req = get_request_from_ep(ep); 1195 + 1196 + /* prepare parameters */ 1197 + len = r8a66597_sudmac_read(r8a66597, CH0CBC); 1198 + req->req.actual += len; 1199 + 1200 + /* clear */ 1201 + r8a66597_sudmac_write(r8a66597, CH0STCLR, DSTSCLR); 1202 + 1203 + /* check transfer finish */ 1204 + if ((!req->req.zero && (req->req.actual == req->req.length)) 1205 + || (len % ep->ep.maxpacket)) { 1206 + if (ep->dma->dir) { 1207 + disable_irq_ready(r8a66597, pipenum); 1208 + enable_irq_empty(r8a66597, pipenum); 1209 + } else { 1210 + /* Clear the interrupt flag for next transfer */ 1211 + r8a66597_write(r8a66597, ~(1 << pipenum), BRDYSTS); 1212 + transfer_complete(ep, req, 0); 1213 + } 1214 + } 1215 + } 1216 + 1217 + static void r8a66597_sudmac_irq(struct r8a66597 *r8a66597) 1218 + { 1219 + u32 irqsts; 1220 + struct r8a66597_ep *ep; 1221 + u16 pipenum; 1222 + 1223 + irqsts = r8a66597_sudmac_read(r8a66597, DINTSTS); 1224 + if (irqsts & CH0ENDS) { 1225 + r8a66597_sudmac_write(r8a66597, CH0ENDC, DINTSTSCLR); 1226 + pipenum = (r8a66597_read(r8a66597, D0FIFOSEL) & CURPIPE); 1227 + ep = r8a66597->pipenum2ep[pipenum]; 1228 + sudmac_finish(r8a66597, ep); 1229 + } 1230 + } 1231 + 1409 1232 static irqreturn_t r8a66597_irq(int irq, void *_r8a66597) 1410 1233 { 1411 1234 struct r8a66597 *r8a66597 = _r8a66597; ··· 1474 1179 u16 brdyenb, nrdyenb, bempenb; 1475 1180 u16 savepipe; 1476 1181 u16 mask0; 1182 + 1183 + if (r8a66597_is_sudmac(r8a66597)) 1184 + r8a66597_sudmac_irq(r8a66597); 1477 1185 1478 1186 spin_lock(&r8a66597->lock); 1479 1187 ··· 1854 1556 usb_del_gadget_udc(&r8a66597->gadget); 1855 1557 del_timer_sync(&r8a66597->timer); 1856 1558 iounmap(r8a66597->reg); 1559 + if (r8a66597->pdata->sudmac) 1560 + iounmap(r8a66597->sudmac_reg); 1857 1561 free_irq(platform_get_irq(pdev, 0), r8a66597); 1858 1562 r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); 1859 1563 #ifdef CONFIG_HAVE_CLK ··· 1870 1570 1871 1571 static void nop_completion(struct usb_ep *ep, struct usb_request *r) 1872 1572 { 1573 + } 1574 + 1575 + static int __init r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597, 1576 + struct platform_device *pdev) 1577 + { 1578 + struct resource *res; 1579 + 1580 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sudmac"); 1581 + if (!res) { 1582 + dev_err(&pdev->dev, "platform_get_resource error(sudmac).\n"); 1583 + return -ENODEV; 1584 + } 1585 + 1586 + r8a66597->sudmac_reg = ioremap(res->start, resource_size(res)); 1587 + if (r8a66597->sudmac_reg == NULL) { 1588 + dev_err(&pdev->dev, "ioremap error(sudmac).\n"); 1589 + return -ENOMEM; 1590 + } 1591 + 1592 + return 0; 1873 1593 } 1874 1594 1875 1595 static int __init r8a66597_probe(struct platform_device *pdev) ··· 1969 1649 clk_enable(r8a66597->clk); 1970 1650 } 1971 1651 #endif 1652 + if (r8a66597->pdata->sudmac) { 1653 + ret = r8a66597_sudmac_ioremap(r8a66597, pdev); 1654 + if (ret < 0) 1655 + goto clean_up2; 1656 + } 1972 1657 1973 1658 disable_controller(r8a66597); /* make sure controller is disabled */ 1974 1659 ··· 2006 1681 r8a66597->ep[0].fifoaddr = CFIFO; 2007 1682 r8a66597->ep[0].fifosel = CFIFOSEL; 2008 1683 r8a66597->ep[0].fifoctr = CFIFOCTR; 2009 - r8a66597->ep[0].fifotrn = 0; 2010 1684 r8a66597->ep[0].pipectr = get_pipectr_addr(0); 2011 1685 r8a66597->pipenum2ep[0] = &r8a66597->ep[0]; 2012 1686 r8a66597->epaddr2ep[0] = &r8a66597->ep[0]; ··· 2038 1714 #endif 2039 1715 clean_up: 2040 1716 if (r8a66597) { 1717 + if (r8a66597->sudmac_reg) 1718 + iounmap(r8a66597->sudmac_reg); 2041 1719 if (r8a66597->ep0_req) 2042 1720 r8a66597_free_request(&r8a66597->ep[0].ep, 2043 1721 r8a66597->ep0_req);
+25 -1
drivers/usb/gadget/r8a66597-udc.h
··· 43 43 ((pipenum >= R8A66597_BASE_PIPENUM_ISOC) && \ 44 44 (pipenum < (R8A66597_BASE_PIPENUM_ISOC + R8A66597_MAX_NUM_ISOC))) 45 45 46 + #define r8a66597_is_sudmac(r8a66597) (r8a66597->pdata->sudmac) 46 47 struct r8a66597_pipe_info { 47 48 u16 pipe; 48 49 u16 epnum; ··· 61 60 struct r8a66597_ep { 62 61 struct usb_ep ep; 63 62 struct r8a66597 *r8a66597; 63 + struct r8a66597_dma *dma; 64 64 65 65 struct list_head queue; 66 66 unsigned busy:1; ··· 77 75 unsigned char fifoaddr; 78 76 unsigned char fifosel; 79 77 unsigned char fifoctr; 80 - unsigned char fifotrn; 81 78 unsigned char pipectr; 79 + unsigned char pipetre; 80 + unsigned char pipetrn; 81 + }; 82 + 83 + struct r8a66597_dma { 84 + unsigned used:1; 85 + unsigned dir:1; /* 1 = IN(write), 0 = OUT(read) */ 82 86 }; 83 87 84 88 struct r8a66597 { 85 89 spinlock_t lock; 86 90 void __iomem *reg; 91 + void __iomem *sudmac_reg; 87 92 88 93 #ifdef CONFIG_HAVE_CLK 89 94 struct clk *clk; ··· 103 94 struct r8a66597_ep ep[R8A66597_MAX_NUM_PIPE]; 104 95 struct r8a66597_ep *pipenum2ep[R8A66597_MAX_NUM_PIPE]; 105 96 struct r8a66597_ep *epaddr2ep[16]; 97 + struct r8a66597_dma dma; 106 98 107 99 struct timer_list timer; 108 100 struct usb_request *ep0_req; /* for internal request */ ··· 261 251 return clock; 262 252 } 263 253 254 + static inline u32 r8a66597_sudmac_read(struct r8a66597 *r8a66597, 255 + unsigned long offset) 256 + { 257 + return ioread32(r8a66597->sudmac_reg + offset); 258 + } 259 + 260 + static inline void r8a66597_sudmac_write(struct r8a66597 *r8a66597, u32 val, 261 + unsigned long offset) 262 + { 263 + iowrite32(val, r8a66597->sudmac_reg + offset); 264 + } 265 + 264 266 #define get_pipectr_addr(pipenum) (PIPE1CTR + (pipenum - 1) * 2) 267 + #define get_pipetre_addr(pipenum) (PIPE1TRE + (pipenum - 1) * 4) 268 + #define get_pipetrn_addr(pipenum) (PIPE1TRN + (pipenum - 1) * 4) 265 269 266 270 #define enable_irq_ready(r8a66597, pipenum) \ 267 271 enable_pipe_irq(r8a66597, pipenum, BRDYENB)
+60
include/linux/usb/r8a66597.h
··· 48 48 49 49 /* (external controller only) set one = WR0_N shorted to WR1_N */ 50 50 unsigned wr0_shorted_to_wr1:1; 51 + 52 + /* set one = using SUDMAC */ 53 + unsigned sudmac:1; 51 54 }; 52 55 53 56 /* Register definitions */ ··· 419 416 #define HUBPORT 0x0700 420 417 #define USBSPD 0x00C0 421 418 #define RTPORT 0x0001 419 + 420 + /* SUDMAC registers */ 421 + #define CH0CFG 0x00 422 + #define CH1CFG 0x04 423 + #define CH0BA 0x10 424 + #define CH1BA 0x14 425 + #define CH0BBC 0x18 426 + #define CH1BBC 0x1C 427 + #define CH0CA 0x20 428 + #define CH1CA 0x24 429 + #define CH0CBC 0x28 430 + #define CH1CBC 0x2C 431 + #define CH0DEN 0x30 432 + #define CH1DEN 0x34 433 + #define DSTSCLR 0x38 434 + #define DBUFCTRL 0x3C 435 + #define DINTCTRL 0x40 436 + #define DINTSTS 0x44 437 + #define DINTSTSCLR 0x48 438 + #define CH0SHCTRL 0x50 439 + #define CH1SHCTRL 0x54 440 + 441 + /* SUDMAC Configuration Registers */ 442 + #define SENDBUFM 0x1000 /* b12: Transmit Buffer Mode */ 443 + #define RCVENDM 0x0100 /* b8: Receive Data Transfer End Mode */ 444 + #define LBA_WAIT 0x0030 /* b5-4: Local Bus Access Wait */ 445 + 446 + /* DMA Enable Registers */ 447 + #define DEN 0x0001 /* b1: DMA Transfer Enable */ 448 + 449 + /* DMA Status Clear Register */ 450 + #define CH1STCLR 0x0002 /* b2: Ch1 DMA Status Clear */ 451 + #define CH0STCLR 0x0001 /* b1: Ch0 DMA Status Clear */ 452 + 453 + /* DMA Buffer Control Register */ 454 + #define CH1BUFW 0x0200 /* b9: Ch1 DMA Buffer Data Transfer Enable */ 455 + #define CH0BUFW 0x0100 /* b8: Ch0 DMA Buffer Data Transfer Enable */ 456 + #define CH1BUFS 0x0002 /* b2: Ch1 DMA Buffer Data Status */ 457 + #define CH0BUFS 0x0001 /* b1: Ch0 DMA Buffer Data Status */ 458 + 459 + /* DMA Interrupt Control Register */ 460 + #define CH1ERRE 0x0200 /* b9: Ch1 SHwy Res Err Detect Int Enable */ 461 + #define CH0ERRE 0x0100 /* b8: Ch0 SHwy Res Err Detect Int Enable */ 462 + #define CH1ENDE 0x0002 /* b2: Ch1 DMA Transfer End Int Enable */ 463 + #define CH0ENDE 0x0001 /* b1: Ch0 DMA Transfer End Int Enable */ 464 + 465 + /* DMA Interrupt Status Register */ 466 + #define CH1ERRS 0x0200 /* b9: Ch1 SHwy Res Err Detect Int Status */ 467 + #define CH0ERRS 0x0100 /* b8: Ch0 SHwy Res Err Detect Int Status */ 468 + #define CH1ENDS 0x0002 /* b2: Ch1 DMA Transfer End Int Status */ 469 + #define CH0ENDS 0x0001 /* b1: Ch0 DMA Transfer End Int Status */ 470 + 471 + /* DMA Interrupt Status Clear Register */ 472 + #define CH1ERRC 0x0200 /* b9: Ch1 SHwy Res Err Detect Int Stat Clear */ 473 + #define CH0ERRC 0x0100 /* b8: Ch0 SHwy Res Err Detect Int Stat Clear */ 474 + #define CH1ENDC 0x0002 /* b2: Ch1 DMA Transfer End Int Stat Clear */ 475 + #define CH0ENDC 0x0001 /* b1: Ch0 DMA Transfer End Int Stat Clear */ 422 476 423 477 #endif /* __LINUX_USB_R8A66597_H */ 424 478