Forum Discussion
9 Replies
- Altera_Forum
Honored Contributor
It's complicated, and I don't have it working yet myself. Search through this forum, though, for some of my threads -- I've been working on this myself, and wentao gave me some help.
- Altera_Forum
Honored Contributor
USB might be supported in next release. But you can enable it in 1.3 by yourself, like clansdown did.
- Altera_Forum
Honored Contributor
thank clansdown and wentao!!
usb module is dynamic or static?? can you tell me the detail step??? - Altera_Forum
Honored Contributor
Details are a bit complicated. But here's a bit:
(1) Copy over the driver froma stock 2.6.10 kernel. It's called sl811-hcd. It has three files: drivers/usb/host/sl811-hcd.c drivers/usb/host/sl811.h include/linux/usb_sl811.h. Copy these into the appropriate place in your microtronix kernel source directory. (2) Modify the Kconfig in your microtronix drivers/usb/host/ dir to include <div class='quotetop'>QUOTE </div> --- Quote Start --- config USB_SL811_HCD tristate "SL811HS HCD support" depends on USB default N help The SL811HS is a single-port USB controller that supports either host side or peripheral side roles. Enable this option if your board has this chip, and you want to use it as a host controller. If unsure, say N. To compile this driver as a module, choose M here: the module will be called sl811-hcd.[/b] --- Quote End --- (3) Edit sl811-hcd.c and modify the sl811_init function something like this:
(note: most of sl811_init() is the same, only the bolded line was added. You'll need to modify the data structures above it to suit your board, and you'll need to implement the power functions so that the driver can control the USB VBus power.) (4) Configure your kernel and compile. (5) Note: I am still trying to get usb-storage to work with this, and am not yet successful. Your mileage may vary.static struct resource sl811_resources = { = { .start = 0x48389D0, .end = 0x48389D3, .flags = IORESOURCE_MEM, }, = { .start = 0x48389D4, .end = 0x48389D7, .flags = IORESOURCE_MEM, }, = { .start = 7, .end = 7, .flags = IORESOURCE_IRQ, }, }; static void sm3k_port_power(struct device *dev, int is_on) { // see linux/usb_sl811.h } static void sm3k_hc_reset(struct device *dev) { // see linux/usb_sl811.h } struct sl811_platform_data sm3k_sl811 = { .potpg = 10, .power = 250, .port_power = sm3k_port_power, .reset = sm3k_hc_reset, }; static struct platform_device sl811_device = { .name = "sl811-hcd", .id = -1, .dev = { .platform_data = &sm3k_sl811, }, .num_resources = ARRAY_SIZE(sl811_resources), .resource = sl811_resources, }; static int __init sl811h_init(void) { if (usb_disabled()) return -ENODEV; platform_device_register(&sl811_device); INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); return driver_register(&sl811h_driver); } - Altera_Forum
Honored Contributor
Note: the above assumes that you've enabled usb in your kernel config by modifying the line in drivers/usb/Kconfig from
<div class='quotetop'>QUOTE </div> --- Quote Start --- config USB tristate "Support for Host-side USB" depends on THING || THING2 || ETC || NIOS[/b] --- Quote End --- to <div class='quotetop'>QUOTE </div> --- Quote Start --- config USB "Support for Host-side USB" depends on THING || THING2 || ETC || NIOS || NIOS2[/b] --- Quote End --- So that you even get the option for host-side USB support in your kernel. - Altera_Forum
Honored Contributor
Just to be more explicit about what wentao said earlier (in a different thread), if you want to get usb mass storage support working (usb-storage), you'll need to create a DMA zone in your memory setup. Modify arch/nios2nommu/mm/init.c, toward the bottom of the paging_init() function. I changed the zone creations to look like:
usb mass storage support started actually creating the SCSI devices once I did that.zones_size = (4*1024*1024) >> PAGE_SHIFT; zones_size = ((end_mem - PAGE_OFFSET) >> PAGE_SHIFT) - zones_size; - Altera_Forum
Honored Contributor
Or you can give all sdram to ZONE_DMA and leave the ZONE_NORMAL empty (as long as all you sdram is dma-able).
- Altera_Forum
Honored Contributor
Clansdown, I am looking forward to your good news!
I use kernel 2.6.11, and sl811-hcd is not like what you attached above. maybe you can try the latest version. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/rolleyes.gif - Altera_Forum
Honored Contributor
No, since the microtronix kernel is 2.6.9, you need to grab the sl811-hcd driver from 2.6.10 -- the internal HCD interface changed in the mainline kernel in 2.6.11, so it would be difficult to incorporate the driver from 2.6.11 into a 2.6.9 kernel without ripping out much of the USB core. (that's what the driver maintainer told me.)
Of course, if you just want to copy over all of drivers/usb, that's probably an option, but I can't speak for how well it works, never having tried it. Frankly, I don't want to have to try it. :-)