Skip to content

Commit

Permalink
usb: renesas_usbhs: add DMAEngine support
Browse files Browse the repository at this point in the history
USB DMA was installed on "normal DMAC" when SH7724 or older SuperH,
but the "USB-DMAC" was prepared on recent SuperH.
These 2 DMAC have a little bit different behavior.

This patch add DMAEngine code for "normal DMAC",
but it is still using PIO fifo.
The DMA fifo will be formally supported in the future.

You can enable DMA fifo by local fixup
usbhs_fifo_pio_push_handler -> usbhs_fifo_dma_push_handler
usbhs_fifo_pio_pop_handler  -> usbhs_fifo_dma_pop_handler
on usbhsg_ep_enable.

This DMAEngine was tested by g_file_storage on SH7724 Ecovec board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
morimoto authored and gregkh committed Jun 7, 2011
1 parent 0cb7e61 commit e73a989
Show file tree
Hide file tree
Showing 8 changed files with 533 additions and 3 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/renesas_usbhs/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ static int __devinit usbhs_probe(struct platform_device *pdev)
priv->dparam->pipe_type = usbhsc_default_pipe_type;
priv->dparam->pipe_size = ARRAY_SIZE(usbhsc_default_pipe_type);
}
if (!priv->dparam->pio_dma_border)
priv->dparam->pio_dma_border = 64; /* 64byte */

/* FIXME */
/* runtime power control ? */
Expand Down
35 changes: 35 additions & 0 deletions drivers/usb/renesas_usbhs/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ struct usbhs_priv;
#define CFIFO 0x0014
#define CFIFOSEL 0x0020
#define CFIFOCTR 0x0022
#define D0FIFO 0x0100
#define D0FIFOSEL 0x0028
#define D0FIFOCTR 0x002A
#define D1FIFO 0x0120
#define D1FIFOSEL 0x002C
#define D1FIFOCTR 0x002E
#define INTENB0 0x0030
#define INTENB1 0x0032
#define BRDYENB 0x0036
Expand All @@ -60,6 +66,30 @@ struct usbhs_priv;
#define PIPEMAXP 0x006C
#define PIPEPERI 0x006E
#define PIPEnCTR 0x0070
#define PIPE1TRE 0x0090
#define PIPE1TRN 0x0092
#define PIPE2TRE 0x0094
#define PIPE2TRN 0x0096
#define PIPE3TRE 0x0098
#define PIPE3TRN 0x009A
#define PIPE4TRE 0x009C
#define PIPE4TRN 0x009E
#define PIPE5TRE 0x00A0
#define PIPE5TRN 0x00A2
#define PIPEBTRE 0x00A4
#define PIPEBTRN 0x00A6
#define PIPECTRE 0x00A8
#define PIPECTRN 0x00AA
#define PIPEDTRE 0x00AC
#define PIPEDTRN 0x00AE
#define PIPEETRE 0x00B0
#define PIPEETRN 0x00B2
#define PIPEFTRE 0x00B4
#define PIPEFTRN 0x00B6
#define PIPE9TRE 0x00B8
#define PIPE9TRN 0x00BA
#define PIPEATRE 0x00BC
#define PIPEATRN 0x00BE

/* SYSCFG */
#define SCKE (1 << 10) /* USB Module Clock Enable */
Expand All @@ -78,6 +108,7 @@ struct usbhs_priv;
#define RHST_HIGH_SPEED 3 /* High-speed connection */

/* CFIFOSEL */
#define DREQE (1 << 12) /* DMA Transfer Request Enable */
#define MBW_32 (0x2 << 10) /* CFIFO Port Access Bit Width */

/* CFIFOCTR */
Expand Down Expand Up @@ -164,6 +195,10 @@ struct usbhs_priv;

#define CCPL (1 << 2) /* Control Transfer End Enable */

/* PIPEnTRE */
#define TRENB (1 << 9) /* Transaction Counter Enable */
#define TRCLR (1 << 8) /* Transaction Counter Clear */

/* FRMNUM */
#define FRNM_MASK (0x7FF)

Expand Down
Loading

0 comments on commit e73a989

Please sign in to comment.