Skip to content

Commit 5a294e5

Browse files
shimodayFelipe Balbi
authored and
Felipe Balbi
committed
usb: renesas_usbhs: Revise the binding document about the dma-names
Since the DT should describe the hardware (not the driver limitation), This patch revises the binding document about the dma-names to change simple numbering as "ch%d" instead of "tx<n>" and "rx<n>". Also this patch fixes the actual code of renesas_usbhs driver to handle the new dma-names. Signed-off-by: Yoshihiro Shimoda <[email protected]> Acked-by: Mark Rutland <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 4e39aca commit 5a294e5

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

Documentation/devicetree/bindings/usb/renesas_usbhs.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ Optional properties:
1515
- phys: phandle + phy specifier pair
1616
- phy-names: must be "usb"
1717
- dmas: Must contain a list of references to DMA specifiers.
18-
- dma-names : Must contain a list of DMA names:
19-
- tx0 ... tx<n>
20-
- rx0 ... rx<n>
21-
- This <n> means DnFIFO in USBHS module.
18+
- dma-names : named "ch%d", where %d is the channel number ranging from zero
19+
to the number of channels (DnFIFOs) minus one.
2220

2321
Example:
2422
usbhs: usb@e6590000 {

drivers/usb/renesas_usbhs/fifo.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,15 +1227,21 @@ static void usbhsf_dma_init_dt(struct device *dev, struct usbhs_fifo *fifo,
12271227
{
12281228
char name[16];
12291229

1230-
snprintf(name, sizeof(name), "tx%d", channel);
1231-
fifo->tx_chan = dma_request_slave_channel_reason(dev, name);
1232-
if (IS_ERR(fifo->tx_chan))
1233-
fifo->tx_chan = NULL;
1234-
1235-
snprintf(name, sizeof(name), "rx%d", channel);
1236-
fifo->rx_chan = dma_request_slave_channel_reason(dev, name);
1237-
if (IS_ERR(fifo->rx_chan))
1238-
fifo->rx_chan = NULL;
1230+
/*
1231+
* To avoid complex handing for DnFIFOs, the driver uses each
1232+
* DnFIFO as TX or RX direction (not bi-direction).
1233+
* So, the driver uses odd channels for TX, even channels for RX.
1234+
*/
1235+
snprintf(name, sizeof(name), "ch%d", channel);
1236+
if (channel & 1) {
1237+
fifo->tx_chan = dma_request_slave_channel_reason(dev, name);
1238+
if (IS_ERR(fifo->tx_chan))
1239+
fifo->tx_chan = NULL;
1240+
} else {
1241+
fifo->rx_chan = dma_request_slave_channel_reason(dev, name);
1242+
if (IS_ERR(fifo->rx_chan))
1243+
fifo->rx_chan = NULL;
1244+
}
12391245
}
12401246

12411247
static void usbhsf_dma_init(struct usbhs_priv *priv, struct usbhs_fifo *fifo,

0 commit comments

Comments
 (0)