Re: Linux USB file storage gadget with new UDC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, Jan 24, 2013 at 04:25:24PM +0800, victor yeo wrote:
> Hi,
> 
> >> > you should an interrupt handler to handle interrupts from your device.
> >> > Also, there are way too many mistakes on your driver, run checkpatch.pl,
> >> > compile it with sparse, don't hardcode addresses, don't reimplement a
> >> > bunch of infrastructure the kernel already gives you  and check your
> >> > list_head usage!
> >>
> >> I have run checkpatch.pl and read the linux/usb/gadget.h. The Soc
> >> interrupt controller has problem, so i use a kernel thread to read
> >> from USB controller directly.
> >>
> >> > don't reimplement a bunch of infrastructure the kernel already gives you
> >> i don't understand this. please kindly show an example.
> >
> > #define IO_OFFSET       0x55000000
> > #define __IO_ADDRESS(x) ((x) + IO_OFFSET)
> >
> > #define IO_ADDRESS(pa)          IOMEM(__IO_ADDRESS(pa))
> >
> > #ifdef IOMEM // Override asm/io.h
> > #undef IOMEM
> > #endif // IOMEM
> > #ifdef __ASSEMBLER__
> > #define IOMEM(x)                x
> > #else
> > #define IOMEM(x)                ((void __force __iomem *)(x))
> > #endif
> >
> > none of this should be in the driver.
> 
> this can be removed.
> 
> >> > Also, you shouldn't requeue the request yourself, gadget driver owns the
> >> > request.
> >> which request do i requeue? please kindly point that out. Thanks!
> >
> > look at your code. Look what you do after you call complete.
> 
> is it this code? i will remove the redundant code after complete.
> 
>         ka_ep_p->req.complete(&ka_ep_p->ep, &req->req);
>         if (num == 0) {
>                 ka_ep_p->req.length = 0;
>                 usb_ep_queue(&ka_ep_p->ep, &req->req, 0);
>                 ka_ep_p->desc = &ep0_in_desc;
>         }

you should delete the request from your list. Whatever you do, has to be
undone.

> i read the net2272.c, the net2272_enable() is called by gadget driver
> enable_endpoint(). When i run the gadget driver, enable_endpoint() is
> called for fsg->bulk_in and fsg->bulk_out. The enable_endpoint() of
> fsg->intr_in is not called because transport_is_cbi()  is false. So
> how can the endpoint 0 be enabled?

endpoint 0 has to be always enabled by the UDC driver. Gadget driver
expects endpoint 0 to be ready.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux