Skip to content

Commit e73a989

Browse files
morimotogregkh
authored andcommitted
usb: renesas_usbhs: add DMAEngine support
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0cb7e61 commit e73a989

File tree

8 files changed

+533
-3
lines changed

8 files changed

+533
-3
lines changed

drivers/usb/renesas_usbhs/common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ static int __devinit usbhs_probe(struct platform_device *pdev)
304304
priv->dparam->pipe_type = usbhsc_default_pipe_type;
305305
priv->dparam->pipe_size = ARRAY_SIZE(usbhsc_default_pipe_type);
306306
}
307+
if (!priv->dparam->pio_dma_border)
308+
priv->dparam->pio_dma_border = 64; /* 64byte */
307309

308310
/* FIXME */
309311
/* runtime power control ? */

drivers/usb/renesas_usbhs/common.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ struct usbhs_priv;
3636
#define CFIFO 0x0014
3737
#define CFIFOSEL 0x0020
3838
#define CFIFOCTR 0x0022
39+
#define D0FIFO 0x0100
40+
#define D0FIFOSEL 0x0028
41+
#define D0FIFOCTR 0x002A
42+
#define D1FIFO 0x0120
43+
#define D1FIFOSEL 0x002C
44+
#define D1FIFOCTR 0x002E
3945
#define INTENB0 0x0030
4046
#define INTENB1 0x0032
4147
#define BRDYENB 0x0036
@@ -60,6 +66,30 @@ struct usbhs_priv;
6066
#define PIPEMAXP 0x006C
6167
#define PIPEPERI 0x006E
6268
#define PIPEnCTR 0x0070
69+
#define PIPE1TRE 0x0090
70+
#define PIPE1TRN 0x0092
71+
#define PIPE2TRE 0x0094
72+
#define PIPE2TRN 0x0096
73+
#define PIPE3TRE 0x0098
74+
#define PIPE3TRN 0x009A
75+
#define PIPE4TRE 0x009C
76+
#define PIPE4TRN 0x009E
77+
#define PIPE5TRE 0x00A0
78+
#define PIPE5TRN 0x00A2
79+
#define PIPEBTRE 0x00A4
80+
#define PIPEBTRN 0x00A6
81+
#define PIPECTRE 0x00A8
82+
#define PIPECTRN 0x00AA
83+
#define PIPEDTRE 0x00AC
84+
#define PIPEDTRN 0x00AE
85+
#define PIPEETRE 0x00B0
86+
#define PIPEETRN 0x00B2
87+
#define PIPEFTRE 0x00B4
88+
#define PIPEFTRN 0x00B6
89+
#define PIPE9TRE 0x00B8
90+
#define PIPE9TRN 0x00BA
91+
#define PIPEATRE 0x00BC
92+
#define PIPEATRN 0x00BE
6393

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

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

83114
/* CFIFOCTR */
@@ -164,6 +195,10 @@ struct usbhs_priv;
164195

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

198+
/* PIPEnTRE */
199+
#define TRENB (1 << 9) /* Transaction Counter Enable */
200+
#define TRCLR (1 << 8) /* Transaction Counter Clear */
201+
167202
/* FRMNUM */
168203
#define FRNM_MASK (0x7FF)
169204

0 commit comments

Comments
 (0)