Correct Place of calling a driver initialization function.

Greg KH gregkh at linuxfoundation.org
Fri Mar 9 10:04:21 EST 2012


On Fri, Mar 09, 2012 at 03:49:57PM +0530, KARTHIK SEKURU wrote:
> Hi,
> 
> I am new to linux-kernel and am using kernel 3.1.6 and working on
> arm-SemiHosting(through USB) drivers.
> 
> We are using SemiHosting to exchange/transfer data from the arm-board to
> the PC.

What is SemiHosting?

> Board details –
> 
> Using ARM926e-js processor with 128MB SDRAM., Clock-33Mhz
> 
> SDRAM Size = 128M
> 
> CONFIG_PAGE_OFFSET = 0xc0000000
> CONFIG_PHYS_OFFSET= 0x80000000
> Kernel Lowmem = 32M including 8M for initramfs (starting from  24M to 32M).
> HighMEM is not configured.
> Vmalloc_start =     end address of LowMem (i.e 0xC200000)
> VMALLOC_END =  Vmalloc_start + 64M  = 0xC6000000
> 
> The SemiHosting(USB) drivers have read(); write(); seek(); functionalities
> along with an InitUSB function that initializes the semihosting USB
> hardware unit on the arm board.

Is this a USB host controller, or a device controller?  Do you have a
pointer to where this code is somewhere so we can see what it does?

> We are using kernel ioremap() function for accessing the USB register set,
> which is remaped to malloc section.

Are these are the USB controller's register set for a host device, or a
"gadget"?

> Functionality in  semihosting init (InitUSB) function –
> 
> 1. We send header command to hostPC via USB DMA operation  by setting few
> USB registers.

Setting them where?

>     USB DMA takes the start address of the header and it’s size and these
> two params (addr, size) are set into corresponding USB registers.
> 
>     The USB transfer is enabled by setting USB_EN register to appropriate
> value.
> 
> 
> 
> 2.After header transfer  acknowledgement from hostPC should be received.
> 
>   As acknowledgement , hostPC should set INTC_USB register, we poll for
> this register and once this is set we are done with the initialisation.
> 
> I wanted to test if the InitUSB function is working as expected. So I
> called this function in the start_kernel(after Console_Init()).
> 
> As this function is just setting few registers and polling for few
> registers., I io_remaped this register set in the InitUSB function..
> 
> But the INTC_USB register that is set by the hostPC as acknowledgement is
> not getting set and the code is never coming out of the while loop.
> 
> Now, I wanted to know if the place from where the InitUSB() function is
> called is the culprit and due to it if I am not receiving acknowledgement
> from the PC.
> 
> As mentioned I am calling the Init_USB function in the start_kernel(after
> Console_Init()).

I think a pointer to the code would be the easiest for us to understand
exactly what is going on here.  Also, USB specific questions are best
asked on the linux-usb at vger.kernel.org mailing list, have you tried
there?

thanks,

greg k-h



More information about the Kernelnewbies mailing list