Page 2 of 4

Re: Implementing a USB Driver

Posted: Tue Jan 01, 2013 7:57 pm
by jamesh
Rene_is_I wrote:dwelch67 wrote:
Bare metal, that is for folks that are willing to work for their education and results anyway, dont want to take the lazy path.
Agreed but there is a limit of what is realistically achievable if the facts and figures are kept secret.
As with anything in the whole wide world. The Foundation has not control over releasing the USB docs/RTL, and neither does Broadcom. "horse dead a Flogging" - rearrange as necessary.

Re: Implementing a USB Driver

Posted: Tue Jan 01, 2013 8:23 pm
by Rene_is_I
jamesh wrote:
"horse dead a Flogging" - rearrange as necessary.
Can't, algorithm is protected by a NDA and not available. :)

Re: Implementing a USB Driver

Posted: Fri Jan 04, 2013 11:26 am
by mark_3094
I've been reading some manuals for other USB chips to try to understand some of the RPi USB driver, and I've got another question about USB hardware in general.

It seems that the Synopsys SoC can be used in Host or Device mode. As I understand it, this is because the chip can be incorporated into either an end device (eg, a printer) or into a host (eg, the RPi).

Does this mean that any registers that are listed as 'device' in those manuals would not apply to a 'host' such as the Raspberry Pi?


Thanks

Re: Implementing a USB Driver

Posted: Fri Jan 04, 2013 11:30 am
by Chadderz
Yes, there are several banks of registers in the Synopsys SoC: core, host, device, power. The device block is completely useless on the Pi.

Re: Implementing a USB Driver

Posted: Fri Jan 04, 2013 11:46 am
by ghans
I know that OTG mode is not possible due to missing pins ,but
does you statement refer to the propability of Device mode
on the Model A ? Am I confusing things ?


ghans

Re: Implementing a USB Driver

Posted: Fri Jan 04, 2013 8:47 pm
by mark_3094
ghans wrote:I know that OTG mode is not possible due to missing pins ,but
does you statement refer to the propability of Device mode
on the Model A ? Am I confusing things ?
Sorry, I don't know what you mean about device mode on Model A...

Chadderz wrote:Yes, there are several banks of registers in the Synopsys SoC: core, host, device, power. The device block is completely useless on the Pi.
This mostly answers my question. I just wanted to be sure I could ignore anything device specific. What if something is marked as 'device only' in the core block. Can that be ignored as well?

Re: Implementing a USB Driver

Posted: Fri Jan 04, 2013 8:50 pm
by Chadderz
mark_3094 wrote:This mostly answers my question. I just wanted to be sure I could ignore anything device specific. What if something is marked as 'device only' in the core block. Can that be ignored as well?
Yes, they're safe to ignore.

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 12:05 am
by DavidS
HAs any one looked at the RISC OS USB stuff yet? I am not sure which license the USB falls under, though at very least it should be a start in creating the documentation for the USB hardware.

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 9:39 am
by mark_3094
I have completed some unofficial documentation on this controller.

You can find it here:
http://networkdirection.net/index.php?o ... &Itemid=54

It still needs more added to it, but it should be useful to someone.

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 9:56 am
by Rene_is_I
Hi mark_3094

Nice piece of work, thank you.
I do however have a question about page 26, is it correct or am I missing something?
It starts off by stating that the BCM2835 sets the direction (first entry) then the BCM numbers
increase up to BCM2850.
Are there that many chips?

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 10:13 am
by jamesh
Rene_is_I wrote:Hi mark_3094

Nice piece of work, thank you.
I do however have a question about page 26, is it correct or am I missing something?
It starts off by stating that the BCM2835 sets the direction (first entry) then the BCM numbers
increase up to BCM2850.
Are there that many chips?
That's a typo, there are no chips with those numbers.

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 10:39 am
by ghans
@mark_3094
I heard that the model A was capable of acting as USB device.
I asked Chadderz if his statement was referring to this.

The guide looks useful to me. Could you put it on the Wiki for
others to extend and correct ?

ghans

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 11:25 am
by mark_3094
jamesh wrote:That's a typo, there are no chips with those numbers.
There are probably lots of inaccuracies. I have pieced this together as best as I could under the circumstances.
I'll look into it and see if I can fix it.
ghans wrote:Could you put it on the Wiki for others to extend and correct ?
I'd be happy to do this. Not sure of the procedure to do it though. Can I create and edit Wiki articles? Is there a guide I should read first?

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 11:40 am
by mark_3094
OK, I see the typo now. I have fixed it and uploaded a new version.

I used Excel to document all the data, and I copied the cells down, which automatically incremented the processor number.

All good now

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 12:11 pm
by Rene_is_I
Thanks mark_3094.
It may well have inaccuracies but for now it's a good start not only for driver development but
also simpler things like detecting if a device (and which type) is connected to a USB port.

As regards the wiki, the only down side is if others change/contribute/edit things too eagerly
without testing them first, it will quickly become a case of too many cooks.

Why not include an email address which you can setup especially for this and ask people for
changes/contributions this way and via this forum.
You can include the email address in the actual document.
That way there is only one person changing the "official" unofficial guide.

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 4:31 pm
by phil95
@mark_3094
Hello, I have tried to download
"Rasperry Pi - USB Controller"
"Written by Luke Robertson"
But I have only these 2 lines, no more text.
Any explanation ?
regards
Philippe

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 5:36 pm
by 9pi
DavidS wrote:HAs any one looked at the RISC OS USB stuff yet?
The RISC OS usb host controller driver is essentially a copy of the linux driver.

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 9:35 pm
by mark_3094
phil95 wrote:@mark_3094
Hello, I have tried to download
"Rasperry Pi - USB Controller"
"Written by Luke Robertson"
But I have only these 2 lines, no more text.
Any explanation ?
regards
Philippe
You've probably downloaded the HTML page. The link above goes to a web page, which has a link to the PDF. I have done it this way so I can update the document without having to change the link on the forum.
This way the forum link will not go stale.

Re: Implementing a USB Driver

Posted: Sat Jan 05, 2013 10:49 pm
by mark_3094
v1.02
Updated a few initial values, thanks to Richard Miller from Plan 9

Re: Implementing a USB Driver

Posted: Sun Jan 06, 2013 9:41 am
by 9pi
jamesh wrote:There's a lot of code already in this driver - it would be a brave man who attempted to completely rewrite it although some will try, certainly the bare metal people!
Rewriting 50,000+ lines of code might take bravery, but ignoring the linux driver and just writing a new and simpler one from scratch (as I did for Plan 9) is a more manageable task.

Re: Implementing a USB Driver

Posted: Sun Jan 06, 2013 11:09 am
by Rene_is_I
9pi wrote:Rewriting 50,000+ lines of code might take bravery, but ignoring the linux driver and just writing a new and simpler one from scratch (as I did for Plan 9) is a more manageable task.
Absolutely, especially if one does not need all the features such as support for cameras,
scanners, and a whole bunch of other peripherals.
A cut down version with just keyboard, mouse and perhaps HDD support would be more then adequate
for many experimental OS's.

If I'm not mistaken, DexOS is busy writing one for his DexBasic.

Re: Implementing a USB Driver

Posted: Sun Jan 06, 2013 12:43 pm
by DavidS
9pi wrote:The RISC OS usb host controller driver is essentially a copy of the linux driver.
Ok, Thank you for saving me the time of trying to reverse engineer that. Unfortunately most Linux drivers have way to much unneeded code, as well as external dependencies that are just as bad.

I had thought if the RISC OS driver was developed separately from the Linux driver it should be easier to understand.

Re: Implementing a USB Driver

Posted: Sun Jan 06, 2013 12:45 pm
by DavidS
mark_3094 wrote:I have completed some unofficial documentation on this controller.
... ...
It still needs more added to it, but it should be useful to someone.
Nice thank you much.

Re: Implementing a USB Driver

Posted: Sun Jan 06, 2013 1:52 pm
by 9pi
DavidS wrote:I had thought if the RISC OS driver was developed separately from the Linux driver it should be easier to understand.
There's also a freebsd driver now, which appears to be all original code. It's a lot smaller and clearer to read than the linux one. Looks like it will support isochronous endpoints too (needed for audio cards), which the Plan 9 driver doesn't do yet. Google for "dev/usb/controller/dwc_otg.c"

Re: Implementing a USB Driver

Posted: Sun Jan 06, 2013 4:29 pm
by tritonium
mark_3094 wrote:
phil95 wrote:@mark_3094
Hello, I have tried to download
"Rasperry Pi - USB Controller"
"Written by Luke Robertson"
But I have only these 2 lines, no more text.
Any explanation ?
regards
Philippe
You've probably downloaded the HTML page. The link above goes to a web page, which has a link to the PDF. I have done it this way so I can update the document without having to change the link on the forum.
This way the forum link will not go stale.
Well I too can find nothing to read - the link shows an empty box???

Dave