Hi Geert-san,
> Hi Shimoda-san,
>
> On Mon, Feb 9, 2015 at 9:16 AM, Yoshihiro Shimoda
> <[email protected]> wrote:
> > Some Renesas SoCs have the USB-DMAC. It is able to terminate transfers
> > when a short packet is received, even if less bytes than the transfer
> > counter size have been received. Also, it is able to send a short
> > packet even if the packet size is not multiples of 8bytes.
> >
> > Since the previous code has used the interruption of USBHS controller
> > when receiving packets even if this driver has used a dmac, a lot of
> > interruptions has happened. This patch will reduce such interruptions.
> >
> > This patch allows to use the USB-DMAC on R-Car H2 and M2.
> >
> > Signed-off-by: Yoshihiro Shimoda <[email protected]>
>
> > --- a/drivers/usb/renesas_usbhs/common.c
> > +++ b/drivers/usb/renesas_usbhs/common.c
>
> > @@ -487,6 +497,15 @@ static struct renesas_usbhs_platform_info
> > *usbhs_parse_dt(struct device *dev)
> > if (gpio > 0)
> > dparam->enable_gpio = gpio;
> >
> > + switch (dparam->type) {
> > + case USBHS_TYPE_R8A7790:
> > + case USBHS_TYPE_R8A7791:
> > + dparam->has_usb_dmac = 1;
> > + break;
> > + default:
> > + break;
> > + }
> > +
> > return info;
> > }
>
> > struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev);
> > diff --git a/drivers/usb/renesas_usbhs/fifo.c
> > b/drivers/usb/renesas_usbhs/fifo.c
> > index 3b77a1b..1e7dc6e 100644
> > --- a/drivers/usb/renesas_usbhs/fifo.c
> > +++ b/drivers/usb/renesas_usbhs/fifo.c
>
> > @@ -847,10 +849,13 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt
> > *pkt, int *is_done)
> > usbhs_pipe_is_dcp(pipe))
> > goto usbhsf_pio_prepare_push;
> >
> > - if (len & 0x7) /* 8byte alignment */
> > + /* default: 8byte alignment */
> > + if (!usbhs_get_dparam(priv, has_usb_dmac) && len & 0x7)
> > goto usbhsf_pio_prepare_push;
>
> So the has_usb_dmac flags indicates that DMA addresses are not limited to
> 8-byte alignment.
>
> Can't this be handled by looking at a dma_mask, as set by the DMAC?
Opps, the comment "8byte alignment" is wrong.
I will fix the comment.
The USB-DMAC can send a packet that it is not multiples of 8-bytes.
The USB-DMAC needs 32-bytes alignment by the following code.
- if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
+ align_mask = usbhs_get_dparam(priv, has_usb_dmac) ?
+ USBHS_USB_DMAC_XFER_SIZE - 1 : 0x7;
+ if ((uintptr_t)(pkt->buf + pkt->actual) & align_mask)
The previous code will use a dmac if a packet size is multiples of 8-bytes and
it is 8-bytes alignment.
Best regards,
Yoshihiro Shimoda
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 --
> [email protected]
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like
> that.
> -- Linus Torvalds
N�����r��y����b�X��ǧv�^�){.n�+����{������^n�r���z���h�����&���G���h�(�階�ݢj"���m������z�ޖ���f���h���~�m�