diff options
author | Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> | 2008-04-10 08:05:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-25 00:16:49 -0400 |
commit | 9424ea29658ce5bcdcf527ddf9617b9507ddf1aa (patch) | |
tree | b733f3cd7991d964810b32d7a555bdf9826a63e8 /drivers/usb/host/r8a66597.h | |
parent | 29fab0cd897519be9009ba8c898410ab83b378e9 (diff) |
USB: r8a66597-hcd: Add support for SH7366 USB host
R8A66597 is similar to SH7366 USB 2.0 Host/Function module. It can
support SH7366 USB host by changing several R8A66597 code.
Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/r8a66597.h')
-rw-r--r-- | drivers/usb/host/r8a66597.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index f46f7dd944a1..84ee01417315 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h | |||
@@ -187,7 +187,11 @@ | |||
187 | #define REW 0x4000 /* b14: Buffer rewind */ | 187 | #define REW 0x4000 /* b14: Buffer rewind */ |
188 | #define DCLRM 0x2000 /* b13: DMA buffer clear mode */ | 188 | #define DCLRM 0x2000 /* b13: DMA buffer clear mode */ |
189 | #define DREQE 0x1000 /* b12: DREQ output enable */ | 189 | #define DREQE 0x1000 /* b12: DREQ output enable */ |
190 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | ||
191 | #define MBW 0x0800 | ||
192 | #else | ||
190 | #define MBW 0x0400 /* b10: Maximum bit width for FIFO access */ | 193 | #define MBW 0x0400 /* b10: Maximum bit width for FIFO access */ |
194 | #endif | ||
191 | #define MBW_8 0x0000 /* 8bit */ | 195 | #define MBW_8 0x0000 /* 8bit */ |
192 | #define MBW_16 0x0400 /* 16bit */ | 196 | #define MBW_16 0x0400 /* 16bit */ |
193 | #define BIGEND 0x0100 /* b8: Big endian mode */ | 197 | #define BIGEND 0x0100 /* b8: Big endian mode */ |
@@ -395,7 +399,11 @@ | |||
395 | #define R8A66597_MAX_NUM_PIPE 10 | 399 | #define R8A66597_MAX_NUM_PIPE 10 |
396 | #define R8A66597_BUF_BSIZE 8 | 400 | #define R8A66597_BUF_BSIZE 8 |
397 | #define R8A66597_MAX_DEVICE 10 | 401 | #define R8A66597_MAX_DEVICE 10 |
402 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | ||
403 | #define R8A66597_MAX_ROOT_HUB 1 | ||
404 | #else | ||
398 | #define R8A66597_MAX_ROOT_HUB 2 | 405 | #define R8A66597_MAX_ROOT_HUB 2 |
406 | #endif | ||
399 | #define R8A66597_MAX_SAMPLING 5 | 407 | #define R8A66597_MAX_SAMPLING 5 |
400 | #define R8A66597_RH_POLL_TIME 10 | 408 | #define R8A66597_RH_POLL_TIME 10 |
401 | #define R8A66597_MAX_DMA_CHANNEL 2 | 409 | #define R8A66597_MAX_DMA_CHANNEL 2 |
@@ -530,8 +538,21 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
530 | unsigned long offset, u16 *buf, | 538 | unsigned long offset, u16 *buf, |
531 | int len) | 539 | int len) |
532 | { | 540 | { |
541 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | ||
542 | unsigned long fifoaddr = r8a66597->reg + offset; | ||
543 | unsigned long count; | ||
544 | |||
545 | count = len / 4; | ||
546 | insl(fifoaddr, buf, count); | ||
547 | |||
548 | if (len & 0x00000003) { | ||
549 | unsigned long tmp = inl(fifoaddr); | ||
550 | memcpy((unsigned char *)buf + count * 4, &tmp, len & 0x03); | ||
551 | } | ||
552 | #else | ||
533 | len = (len + 1) / 2; | 553 | len = (len + 1) / 2; |
534 | insw(r8a66597->reg + offset, buf, len); | 554 | insw(r8a66597->reg + offset, buf, len); |
555 | #endif | ||
535 | } | 556 | } |
536 | 557 | ||
537 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, | 558 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, |
@@ -545,6 +566,24 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | |||
545 | int len) | 566 | int len) |
546 | { | 567 | { |
547 | unsigned long fifoaddr = r8a66597->reg + offset; | 568 | unsigned long fifoaddr = r8a66597->reg + offset; |
569 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | ||
570 | unsigned long count; | ||
571 | unsigned char *pb; | ||
572 | int i; | ||
573 | |||
574 | count = len / 4; | ||
575 | outsl(fifoaddr, buf, count); | ||
576 | |||
577 | if (len & 0x00000003) { | ||
578 | pb = (unsigned char *)buf + count * 4; | ||
579 | for (i = 0; i < (len & 0x00000003); i++) { | ||
580 | if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) | ||
581 | outb(pb[i], fifoaddr + i); | ||
582 | else | ||
583 | outb(pb[i], fifoaddr + 3 - i); | ||
584 | } | ||
585 | } | ||
586 | #else | ||
548 | int odd = len & 0x0001; | 587 | int odd = len & 0x0001; |
549 | 588 | ||
550 | len = len / 2; | 589 | len = len / 2; |
@@ -553,6 +592,7 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | |||
553 | buf = &buf[len]; | 592 | buf = &buf[len]; |
554 | outb((unsigned char)*buf, fifoaddr); | 593 | outb((unsigned char)*buf, fifoaddr); |
555 | } | 594 | } |
595 | #endif | ||
556 | } | 596 | } |
557 | 597 | ||
558 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, | 598 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, |
@@ -585,6 +625,11 @@ static inline unsigned long get_dvstctr_reg(int port) | |||
585 | return port == 0 ? DVSTCTR0 : DVSTCTR1; | 625 | return port == 0 ? DVSTCTR0 : DVSTCTR1; |
586 | } | 626 | } |
587 | 627 | ||
628 | static inline unsigned long get_dmacfg_reg(int port) | ||
629 | { | ||
630 | return port == 0 ? DMA0CFG : DMA1CFG; | ||
631 | } | ||
632 | |||
588 | static inline unsigned long get_intenb_reg(int port) | 633 | static inline unsigned long get_intenb_reg(int port) |
589 | { | 634 | { |
590 | return port == 0 ? INTENB1 : INTENB2; | 635 | return port == 0 ? INTENB1 : INTENB2; |