Re: [bisected][regression] USB Ethernet Gadget Support - Freescale 8308
On Wed, Jun 18, 2014 at 1:52 PM, Fabio Estevam feste...@gmail.com wrote: MPC does not use it only because no one has converted it yet :-) Okay. That makes sense :-) Take a look at the existing bindings of i.MX. You probably only needs to add the drivers/usb/chipidea/ci_hdrc_imx.c equivalent for MPC. That doesn't look too bad. I might take a crack at writing a binding for the 83xx series. If things go well look for a patch. I do have several 83xx custom boards I could try it on. For the sake of completeness in case some other poor sap finds this in a few months, I was able to get USB Gadget functioning on the v3.10 kernel with the following 2 complete hacks and 1 back port: diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index dcd0b07..a2f26cd 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -1219,6 +1219,10 @@ static int fsl_pullup(struct usb_gadget *gadget, int is_on) struct fsl_udc *udc; udc = container_of(gadget, struct fsl_udc, gadget); + + if (!udc-vbus_active) + return -EOPNOTSUPP; + udc-softconnect = (is_on != 0); if (can_pullup(udc)) fsl_writel((fsl_readl(dr_regs-usbcmd) | USB_CMD_RUN_STOP), diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 150866b..6f7367a 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h @@ -87,6 +87,9 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) if (unlikely(dev == NULL)) return NULL; + if (dev-archdata.dma_ops == NULL) + return dma_direct_ops; + return dev-archdata.dma_ops; } diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 28e4fc9..3385e8a 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -2662,7 +2662,7 @@ MODULE_DEVICE_TABLE(platform, fsl_udc_devtype); static struct platform_driver udc_driver = { .remove = __exit_p(fsl_udc_remove), /* Just for FSL i.mx SoC currently */ - .id_table = fsl_udc_devtype, + /* .id_table= fsl_udc_devtype, */ /* these suspend and resume are not usb suspend and resume */ .suspend= fsl_udc_suspend, .resume = fsl_udc_resume, Not this code is hacky and probably not something you would want to use in production, but for the test system I am running it was sufficient to fix my problem. Thanks for your help Fabio and Felipe! Barry -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [bisected][regression] USB Ethernet Gadget Support - Freescale 8308
On Tue, Jun 17, 2014 at 8:47 PM, Felipe Balbi ba...@ti.com wrote: Hi, 3.10 is a pretty old kernel, you need to ask support from whoever gave you that kernel, unless you can try v3.16-rc1 on your board. Thanks for responding. We are just running Vanilla 3.10 from kernel.org without any vendor per se. I did a quick port to 3.16-rc1 and booted off NFS so I didn't have to port our NAND drivers. Here is the dmesg: Using Custom Platform machine description Initializing cgroup subsys cpu Initializing cgroup subsys cpuacct Linux version 3.16.0-rc1+ (barrgr@zoidberg) (gcc version 4.2.4) #2 PREEMPT Wed Jun 18 08:39:02 PDT 2014 Found legacy serial port 0 for /immr@e000/serial@4500 mem=e0004500, taddr=e0004500, irq=0, clk=13200, speed=0 Found legacy serial port 1 for /immr@e000/serial@4600 mem=e0004600, taddr=e0004600, irq=0, clk=13200, speed=0 bootconsole [udbg0] enabled Top of RAM: 0x2000, Total RAM: 0x2000 Memory hole size: 0MB Zone ranges: DMA [mem 0x-0x1fff] Normal empty Movable zone start for each node Early memory node ranges node 0: [mem 0x-0x1fff] On node 0 totalpages: 131072 free_area_init_node: node 0, pgdat c054c700, node_mem_map c07fd000 DMA zone: 1024 pages used for memmap DMA zone: 0 pages reserved DMA zone: 131072 pages, LIFO batch:31 pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 pcpu-alloc: [0] 0 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048 Kernel command line: root=/dev/nfs nfsroot=192.168.1.1:/srv/nfs_powerpc ip=192.168.1.4::192.168.1.1:255.255.255.0::eth0:off panic=10 console=ttyS0,115200 selinux=0 PID hash table entries: 2048 (order: 1, 8192 bytes) Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) Inode-cache hash table entries: 32768 (order: 5, 131072 bytes) Sorting __ex_table... Memory: 514080K/524288K available (4156K kernel code, 268K rwdata, 880K rodata, 188K init, 116K bss, 10208K reserved) Kernel virtual memory layout: * 0xfffdf000..0xf000 : fixmap * 0xfdffc000..0xfe00 : early ioremap * 0xe100..0xfdffc000 : vmalloc ioremap Preemptible hierarchical RCU implementation. NR_IRQS:512 nr_irqs:512 16 IPIC (128 IRQ sources) at e1000700 time_init: decrementer frequency = 33.00 MHz time_init: processor frequency = 330.00 MHz clocksource: timebase mult[1e4d9365] shift[24] registered clockevent: decrementer mult[872b021] shift[32] cpu[0] pid_max: default: 32768 minimum: 301 Security Framework initialized SELinux: Disabled at boot. Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) NET: Registered protocol family 16 Registering ipic system core operations Freescale Elo series DMA driver SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb pps_core: LinuxPPS API ver. 1 registered pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giome...@linux.it PTP clock support registered EDAC MC: Ver: 3.0.0 Switched to clocksource timebase NET: Registered protocol family 2 TCP established hash table entries: 4096 (order: 2, 16384 bytes) TCP bind hash table entries: 4096 (order: 2, 16384 bytes) TCP: Hash tables configured (established 4096 bind 4096) TCP: reno registered UDP hash table entries: 256 (order: 0, 4096 bytes) UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) NET: Registered protocol family 1 RPC: Registered named UNIX socket transport module. RPC: Registered udp transport module. RPC: Registered tcp transport module. RPC: Registered tcp NFSv4.1 backchannel transport module. futex hash table entries: 256 (order: -1, 3072 bytes) audit: initializing netlink subsys (disabled) audit: type=2000 audit(0.217:1): initialized msgmni has been set to 1004 alg: No test for stdrng (krng) io scheduler noop registered (default) Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled console [ttyS0] disabled serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16, base_baud = 825) is a 16550A console [ttyS0] enabled bootconsole [udbg0] disabled serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17, base_baud = 825) is a 16550A fe00.flash: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x01 Chip ID 0x002201 Amd/Fujitsu Extended Query Table at 0x0040 Amd/Fujitsu Extended Query version 1.3. number of CFI chips: 1 fsl_spi e0007000.spi: master is unqueued, this is deprecated fsl_spi e0007000.spi: at 0xe10a6000 (irq = 21), CPU mode bonding: Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) libphy: Freescale PowerQUICC MII Bus: probed fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 00:30:a7:07:15:f6 fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for
Re: [bisected][regression] USB Ethernet Gadget Support - Freescale 8308
On Wed, Jun 18, 2014 at 9:17 AM, Barry G mr.sc...@gmail.com wrote: NIP [c02b3f58] usb_gadget_map_request+0x118/0x1a4 LR [c02bc68c] fsl_ep_queue+0xc4/0x19c Call Trace: [dfff7ea8] [c02bc68c] fsl_ep_queue+0xc4/0x19c [dfff7ec8] [c02b7514] composite_setup+0x1324/0x13e8 [dfff7f20] [c02bd070] fsl_udc_irq+0x5cc/0xcbc [dfff7f78] [c004b42c] handle_irq_event_percpu+0x4c/0x150 [dfff7fa8] [c004b594] handle_irq_event+0x64/0x94 [dfff7fc0] [c004e7bc] handle_level_irq+0x138/0x15c [dfff7fd8] [c004b118] generic_handle_irq+0x38/0x50 [dfff7fe8] [c000530c] __do_irq+0x44/0x58 [dfff7ff0] [c000c510] call_do_irq+0x24/0x3c [c054fe98] [c0005510] do_IRQ+0x94/0xe0 [c054fec0] [c000dca4] ret_from_except+0x0/0x14 --- Exception: 501 at arch_cpu_idle+0x24/0x68 LR = arch_cpu_idle+0x24/0x68 [c054ff80] [c054e000] 0xc054e000 (unreliable) [c054ff88] [c0042dec] cpu_startup_entry+0x100/0x180 [c054ffa8] [c0004068] rest_init+0x84/0x9c [c054ffc0] [c04edd18] start_kernel+0x334/0x348 [c054fff0] [3438] 0x3438 Instruction dump: 7fff0034 57ffd97f 41a2000c 3960 4808 817e00bc 20070002 7c000110 7cd0 0f00 3d20c056 3c854000 816b0010 8009f200 5484c9f4 54a5053e ---[ end trace 1e1b78a0b4f63fb8 ]--- Did some more digging into this. I found out that usb_gadget_map_request is failing in the dma_map_single call because get_dma_ops is returning NULL (and map_page is offset 16 into dma_maps_ops hence the 0x10 offset). Looks like nothing on the Freescale 83XX is calling set_dma_ops. The following complete hacks give me USB gadget support: diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 150866b..50db4f7 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h @@ -87,6 +87,12 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) if (unlikely(dev == NULL)) return NULL; + if (dev-archdata.dma_ops == NULL) + { + printk(KERN_ERR Barry's Complete Hack triggered %s\n, __func__); + return dma_direct_ops; + } + return dev-archdata.dma_ops; } diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 28e4fc9..3385e8a 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -2662,7 +2662,7 @@ MODULE_DEVICE_TABLE(platform, fsl_udc_devtype); static struct platform_driver udc_driver = { .remove = __exit_p(fsl_udc_remove), /* Just for FSL i.mx SoC currently */ - .id_table = fsl_udc_devtype, + /* .id_table= fsl_udc_devtype, */ /* these suspend and resume are not usb suspend and resume */ .suspend= fsl_udc_suspend, .resume = fsl_udc_resume, Seems to me the right solution is making a patch to add the 83XX stuff to the id_table and finding the right place to set_dma_ops? I am fine doing the leg work of creating/testing/submitting the patch providing that sounds right and people can point me in the right direction :-) Thanks, Barry -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [bisected][regression] USB Ethernet Gadget Support - Freescale 8308
On Wed, Jun 18, 2014 at 4:47 PM, Barry G mr.sc...@gmail.com wrote: Seems to me the right solution is making a patch to add the 83XX stuff to the id_table and finding the right place to set_dma_ops? I am fine doing the leg work of creating/testing/submitting the patch providing that sounds right and people can point me in the right direction :-) Can't you use the chipidea driver instead of drivers/usb/gadget/fsl_udc_core.c? -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [bisected][regression] USB Ethernet Gadget Support - Freescale 8308
On Wed, Jun 18, 2014 at 1:00 PM, Fabio Estevam feste...@gmail.com wrote: Can't you use the chipidea driver instead of drivers/usb/gadget/fsl_udc_core.c? I was under the impression that the chipidea stuff was for iMX series processors. The comments in fsl_udc_core.c say it is for the MPC8349E and friends and it worked fine for us until eb65796e. I checked out the arch/powerpc/boot/dts/mpc8308rdb.dts for the RDB and it is claiming a compatibility of fsl-usb2-dr. What would you recommend I use as a new device tree node/compatible string? Thanks, Barry -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [bisected][regression] USB Ethernet Gadget Support - Freescale 8308
On Wed, Jun 18, 2014 at 5:31 PM, Barry G mr.sc...@gmail.com wrote: On Wed, Jun 18, 2014 at 1:00 PM, Fabio Estevam feste...@gmail.com wrote: Can't you use the chipidea driver instead of drivers/usb/gadget/fsl_udc_core.c? I was under the impression that the chipidea stuff was for iMX series processors. MPC does not use it only because no one has converted it yet :-) The comments in fsl_udc_core.c say it is for the MPC8349E and friends and it worked fine for us until eb65796e. i.MX used fsl_udc_core.c in the past. Now we have moved all of the i.MX SoCs into chipidea driver. It would make things a lot simpler if MPC could be moved to chipidea driver as well so that fsl_udc_core.c could go away. I checked out the arch/powerpc/boot/dts/mpc8308rdb.dts for the RDB and it is claiming a compatibility of fsl-usb2-dr. What would you recommend I use as a new device tree node/compatible string? Take a look at the existing bindings of i.MX. You probably only needs to add the drivers/usb/chipidea/ci_hdrc_imx.c equivalent for MPC. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[bisected][regression] USB Ethernet Gadget Support - Freescale 8308
Hi all, We have a custom board that has been running on the v3.0 kernel for a while. Since that kernel version is deprecated we are working on upgrading to the 3.10 kernel (some products are 3.10-ltsi so trying to be common). Everything is now working except the USB gadget support. This is a Freescale MPC8308 based board. Our device tree entry is: usb@23000 { compatible = fsl-usb2-dr; reg = 0x23000 0x1000; #address-cells = 1; #size-cells = 0; interrupt-parent = ipic; interrupts = 38 0x8; dr_mode = peripheral; phy_type = ulpi; }; In 3.0, the dmesg shows: ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver Initializing USB Mass Storage driver... usbcore: registered new interface driver usb-storage USB Mass Storage support registered. Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007) g_ether gadget: using random self ethernet address g_ether gadget: using random host ethernet address usb0: MAC fa:75:de:cd:cc:80 usb0: HOST MAC f6:64:f6:b4:6b:23 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 g_ether gadget: g_ether ready fsl-usb2-udc: bind to driver g_ether But in 3.10 I was only getting the base ECHI driver line. After some debugging I found fsl_udc_probe wasn't getting called. I made the following change: diff -Naurp linux_kernel.orig/drivers/usb/gadget/fsl_udc_core.c linux_kernel/drivers/usb/gadget/fsl_udc_core.c --- linux_kernel.orig/drivers/usb/gadget/fsl_udc_core.c 2014-06-17 11:23:57.008453643 -0700 +++ linux_kernel/drivers/usb/gadget/fsl_udc_core.c 2014-06-17 11:25:45.881727426 -0700 @@ -2661,7 +2661,7 @@ MODULE_DEVICE_TABLE(platform, fsl_udc_de static struct platform_driver udc_driver = { .remove = __exit_p(fsl_udc_remove), /* Just for FSL i.mx SoC currently */ - .id_table = fsl_udc_devtype, + /* .id_table= fsl_udc_devtype, */ /* these suspend and resume are not usb suspend and resume */ .suspend= fsl_udc_suspend, .resume = fsl_udc_resume, And now on boot I get: ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver usbcore: registered new interface driver usb-storage g_ether gadget: using random self ethernet address usb0: MAC c6:62:4c:03:81:9a usb0: HOST MAC 00:11:22:33:44:55 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 g_ether gadget: g_ether ready i2c /dev entries driver But plugging the cable in results in nothing. The host computer doesn't see anything via lsusb or dmesg, nor does the 8308 usb client computer. It is like the cable isn't connected. In an effort to figure out what broke I bisected the kernel down to: eb65796ef161f1b2f959a6ab4b818976054b235d [PATCH] usb: gadget: fsl_udc_core: convert to udc_start/udc_stop Unfortunately this patch just switches us over to the new interface and isn't really revertible as the old interface doesn't exist. In a futile attempt to make it work, I grabbed the 3.15 fsl_udc_core.c, remarked the calls to usb_ep-set_maxpacket_limit, and booted that. I got: ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver usbcore: registered new interface driver usb-storage g_ether gadget: using random self ethernet address usb0: MAC d6:bc:72:e8:87:a1 usb0: HOST MAC 00:11:22:33:44:55 g_ether gadget: rndis: can't bind, err -19 g_ether fsl-usb2-udc.0: failed to start g_ether: -19 I know crossing over kernel versions like that is dangerous so I am not sure if I am getting to the garbage in/garbage out stage yet. What can I do to get the USB Ethernet Gadget functionality working again? Thoughts or directions would be appreciated. Thanks, Barry -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [bisected][regression] USB Ethernet Gadget Support - Freescale 8308
Hi, On Tue, Jun 17, 2014 at 04:04:04PM -0700, Barry G wrote: Hi all, We have a custom board that has been running on the v3.0 kernel for a while. Since that kernel version is deprecated we are working on upgrading to the 3.10 kernel (some products are 3.10-ltsi so trying 3.10 is a pretty old kernel, you need to ask support from whoever gave you that kernel, unless you can try v3.16-rc1 on your board. Good luck. -- balbi signature.asc Description: Digital signature