Re: [PATCH] drivers: usb: gadget: prefer pr_*() functions over raw printk()
- printk(KERN_INFO "FUSB300_IGR1_U1_ENTRY_INT\n"); > + pr_info("FUSB300_IGR1_U1_ENTRY_INT\n"); > } > > if (int_grp1 & FUSB300_IGR1_RESM_INT) { > fusb300_clear_int(fusb300, FUSB300_OFFSET_IGR1, > FUSB300_IGR1_RESM_INT); > - printk(KERN_INFO "fusb300_resume\n"); > + pr_info("fusb300_resume\n"); > } > > if (int_grp1 & FUSB300_IGR1_SUSP_INT) { > fusb300_clear_int(fusb300, FUSB300_OFFSET_IGR1, > FUSB300_IGR1_SUSP_INT); > - printk(KERN_INFO "fusb300_suspend\n"); > + pr_info("fusb300_suspend\n"); > } > > if (int_grp1 & FUSB300_IGR1_HS_LPM_INT) { > fusb300_clear_int(fusb300, FUSB300_OFFSET_IGR1, > FUSB300_IGR1_HS_LPM_INT); > - printk(KERN_INFO "fusb300_HS_LPM_INT\n"); > + pr_info("fusb300_HS_LPM_INT\n"); > } > > if (int_grp1 & FUSB300_IGR1_DEV_MODE_CHG_INT) { > @@ -1195,11 +1195,11 @@ static irqreturn_t fusb300_irq(int irq, void > *_fusb300) > > if (int_grp1 & FUSB300_IGR1_CX_COMFAIL_INT) { > fusb300_set_cxstall(fusb300); > - printk(KERN_INFO "fusb300_ep0fail\n"); > + pr_info("fusb300_ep0fail\n"); > } > > if (int_grp1 & FUSB300_IGR1_CX_SETUP_INT) { > - printk(KERN_INFO "fusb300_ep0setup\n"); > + pr_info("fusb300_ep0setup\n"); > if (setup_packet(fusb300, )) { > spin_unlock(>lock); > if (fusb300->driver->setup(>gadget, ) < 0) > @@ -1209,16 +1209,16 @@ static irqreturn_t fusb300_irq(int irq, void > *_fusb300) > } > > if (int_grp1 & FUSB300_IGR1_CX_CMDEND_INT) > - printk(KERN_INFO "fusb300_cmdend\n"); > + pr_info("fusb300_cmdend\n"); > > > if (int_grp1 & FUSB300_IGR1_CX_OUT_INT) { > - printk(KERN_INFO "fusb300_cxout\n"); > + pr_info("fusb300_cxout\n"); > fusb300_ep0out(fusb300); > } > > if (int_grp1 & FUSB300_IGR1_CX_IN_INT) { > - printk(KERN_INFO "fusb300_cxin\n"); > + pr_info("fusb300_cxin\n"); > fusb300_ep0in(fusb300); > } > > diff --git a/drivers/usb/gadget/udc/goku_udc.c > b/drivers/usb/gadget/udc/goku_udc.c > index 3e1267d38774..4f225552861a 100644 > --- a/drivers/usb/gadget/udc/goku_udc.c > +++ b/drivers/usb/gadget/udc/goku_udc.c > @@ -1748,7 +1748,7 @@ static int goku_probe(struct pci_dev *pdev, const > struct pci_device_id *id) > int retval; > > if (!pdev->irq) { > - printk(KERN_ERR "Check PCI %s IRQ setup!\n", pci_name(pdev)); > + pr_err("Check PCI %s IRQ setup!\n", pci_name(pdev)); > retval = -ENODEV; > goto err; > } > diff --git a/drivers/usb/gadget/udc/r8a66597-udc.h > b/drivers/usb/gadget/udc/r8a66597-udc.h > index 9a115caba661..fa4d62c32ea1 100644 > --- a/drivers/usb/gadget/udc/r8a66597-udc.h > +++ b/drivers/usb/gadget/udc/r8a66597-udc.h > @@ -247,7 +247,7 @@ static inline u16 get_xtal_from_pdata(struct > r8a66597_platdata *pdata) > clock = XTAL48; > break; > default: > - printk(KERN_ERR "r8a66597: platdata clock is wrong.\n"); > + pr_err("r8a66597: platdata clock is wrong.\n"); > break; > } > > -- > 2.11.0 > -- Thanks, Peter Chen
RE: [PATCH v2 31/39] docs: ABI: cleanup several ABI documents
Acked-by: Peter Chen For: Documentation/ABI/testing/usb-charger-uevent Peter
RE: [PATCH] usb: gadget: fsl: fix null pointer checking
> > Fixes: 75eaa498c99e (“usb: gadget: Correct NULL pointer checking in fsl > gadget”) > Signed-off-by: Ran Wang > --- > drivers/usb/gadget/udc/fsl_udc_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c > b/drivers/usb/gadget/udc/fsl_udc_core.c > index de528e3..ad6ff9c 100644 > --- a/drivers/usb/gadget/udc/fsl_udc_core.c > +++ b/drivers/usb/gadget/udc/fsl_udc_core.c > @@ -1051,7 +1051,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep) > u32 bitmask; > struct ep_queue_head *qh; > > - if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF)) > + if (!_ep || !_ep->desc || !(_ep->desc->bEndpointAddress&0xF)) > return -ENODEV; > Reviewed-by: Peter Chen Peter
Re: [PATCH -next] usb: gadget: fsl: remove unused variable 'driver_desc'
On 20-03-26 15:14:19, YueHaibing wrote: > drivers/usb/gadget/udc/fsl_udc_core.c:56:19: > warning: 'driver_desc' defined but not used [-Wunused-const-variable=] > > It is never used, so remove it. > > Reported-by: Hulk Robot > Signed-off-by: YueHaibing > --- > drivers/usb/gadget/udc/fsl_udc_core.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c > b/drivers/usb/gadget/udc/fsl_udc_core.c > index ec6eda426223..febabde62f71 100644 > --- a/drivers/usb/gadget/udc/fsl_udc_core.c > +++ b/drivers/usb/gadget/udc/fsl_udc_core.c > @@ -53,7 +53,6 @@ > #define DMA_ADDR_INVALID(~(dma_addr_t)0) > > static const char driver_name[] = "fsl-usb2-udc"; > -static const char driver_desc[] = DRIVER_DESC; > > static struct usb_dr_device __iomem *dr_regs; > > -- > 2.17.1 > > Reviewed-by: Peter Chen -- Thanks, Peter Chen
RE: [PATCH 1/1] pci: host: pci-layerscape: add missing of_node_put after calling of_parse_phandle
> >On Fri, Aug 12, 2016 at 09:34:41AM +0800, Peter Chen wrote: >> of_node_put needs to be called when the device node which is got from >> of_parse_phandle has finished using. >> >> Cc: Minghuan Lian <minghuan.l...@freescale.com> >> Cc: Mingkai Hu <mingkai...@freescale.com> >> Cc: Roy Zang <tie-fei.z...@freescale.com> >> Signed-off-by: Peter Chen <peter.c...@nxp.com> >> --- >> drivers/pci/host/pci-layerscape.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/pci/host/pci-layerscape.c >> b/drivers/pci/host/pci-layerscape.c >> index 114ba81..573b996 100644 >> --- a/drivers/pci/host/pci-layerscape.c >> +++ b/drivers/pci/host/pci-layerscape.c >> @@ -173,6 +173,8 @@ static int ls_pcie_msi_host_init(struct pcie_port *pp, >> return -EINVAL; >> } >> >> +of_node_put(msi_node); >> + > >Can you please look for and fix similar errors in other drivers in >drivers/pci/host/*? > >For example: > > advk_pcie_probe() and iproc_pcie_msi_enable() call > of_parse_phandle() but don't call of_node_put() in failure paths. > > dra7xx_pcie_init_irq_domain(), nwl_pcie_init_irq_domain(), and > xilinx_pcie_init_irq_domain() call of_get_next_child() but don't > call of_node_put() in failure paths. > > ks_pcie_get_irq_controller_info() calls of_find_node_by_name(). > Would you agree that I fix the issues for drivers that call of_parse_phandle or of_get_next_child or of_find_node_by_name? I can grep the symbols, and check if of_node_put is called properly. I will group all fixed within one patch set. >I think there may be others, e.g., the pci_host_bridge_msi_domain() path calls >of_parse_phandle(), but I'm not sure of_node_put() is called on failure paths. > I find pci_host_bridge_msi_domain does not call of_parse_phandle directly, only of_msi_get_domain calls of_parse_phandle, and of_node_put is called properly. Peter >When we find bugs like this, it's nice to fix one occurrence, but it's really >great if we >can squash similar bugs nearby so the bug isn't copied into new drivers. > >> return 0; >> } >> >> -- >> 1.9.1 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-pci" >> in the body of a message to majord...@vger.kernel.org More majordomo >> info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] pci: host: pci-layerscape: add missing of_node_put after calling of_parse_phandle
of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using. Cc: Minghuan Lian <minghuan.l...@freescale.com> Cc: Mingkai Hu <mingkai...@freescale.com> Cc: Roy Zang <tie-fei.z...@freescale.com> Signed-off-by: Peter Chen <peter.c...@nxp.com> --- drivers/pci/host/pci-layerscape.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c index 114ba81..573b996 100644 --- a/drivers/pci/host/pci-layerscape.c +++ b/drivers/pci/host/pci-layerscape.c @@ -173,6 +173,8 @@ static int ls_pcie_msi_host_init(struct pcie_port *pp, return -EINVAL; } + of_node_put(msi_node); + return 0; } -- 1.9.1
Re: [patch] usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame()
On Fri, Jul 15, 2016 at 02:15:47PM +0300, Dan Carpenter wrote: > We can't assign -EINVAL to a u16. > > Fixes: 3948f0e0c999 ('usb: add Freescale QE/CPM USB peripheral controller > driver') > Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> > > diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c > b/drivers/usb/gadget/udc/fsl_qe_udc.c > index 93d28cb..901366f 100644 > --- a/drivers/usb/gadget/udc/fsl_qe_udc.c > +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c > @@ -1878,11 +1878,8 @@ static int qe_get_frame(struct usb_gadget *gadget) > > tmp = in_be16(>usb_param->frame_n); > if (tmp & 0x8000) > - tmp = tmp & 0x07ff; > - else > - tmp = -EINVAL; > - > - return (int)tmp; > + return tmp & 0x07ff; > + return -EINVAL; > } Acked-by: Peter Chen <peter.c...@nxp.com> > > static int fsl_qe_start(struct usb_gadget *gadget, > -- > 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 -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [patch] usb: gadget: fsl_qe_udc: off by one in setup_received_handle()
On Wed, Jul 13, 2016 at 01:14:33PM +0300, Dan Carpenter wrote: > The udc->eps[] array has USB_MAX_ENDPOINTS elements so > should be >=. > > Fixes: 3948f0e0c999 ('usb: add Freescale QE/CPM USB peripheral controller > driver') > Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> > > diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c > b/drivers/usb/gadget/udc/fsl_qe_udc.c > index 93d28cb..cf8819a 100644 > --- a/drivers/usb/gadget/udc/fsl_qe_udc.c > +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c > @@ -2053,7 +2053,7 @@ static void setup_received_handle(struct qe_udc *udc, > struct qe_ep *ep; > > if (wValue != 0 || wLength != 0 > - || pipe > USB_MAX_ENDPOINTS) > + || pipe >= USB_MAX_ENDPOINTS) > break; > ep = >eps[pipe]; > Acked-by: Peter Chen <peter.c...@nxp.com> -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: PROBLEM: USB isochronous urb leak on EHCI driver
On Wed, Jan 7, 2015 at 2:22 AM, Alan Stern st...@rowland.harvard.edu wrote: On Tue, 6 Jan 2015, Michael Tessier wrote: That is interresting, however, I have an older kernel running an OHCI driver which is able to handle 4 codecs. Same usb hardware (codecs and hub), but older kernel on a different CPU, with much less power. This makes me believe that there's a solution to make it work... Of course there is: Install an OHCI host controller and use it to drive your codecs. It should work fine. What do you mean by that? The host controller is embedded in the i.MX CPU... Changing the CPU is not really an option to me. Unless I am missing something? I didn't realize you were talking about an i.MX-based system. On a computer with a free PCI slot, it's easy to add an OHCI controller. iMX isn't as accomodating. iMX uses chipidea controller which TT is build-in, and it does NOT support OHCI controller. If there's no way to add an extra USB controller to your system then the only choice is to upgrade the driver software. Alan Stern -- 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 -- BR, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: PROBLEM: USB isochronous urb leak on EHCI driver
My configuration: - Host: Freescale i.MX512 with ARM Cortex A8 (USB 2.0 host controller) Linux kernel: 2.6.31, using EHCI USB driver Hub: 4-PORT USB 1.1 HUB (Texas Instruments PN: tusb2046b) Devices: 4 USB 1.1 audio codecs (Texas Instruments PN: pcm2901) Note: each codec is being used in R/W access, so with 4 codecs, I have 4 playback and 4 capture streams. My problem: --- I have usb urb leaks when connecting more than 1 codec to the USB 1.1 Hub. (the result is that some of the audio data is not transferred, part of the sound is simply missing) No problem when using only 1 of the 4 codecs connected to the hub; When I connect a second codec, the sound quality starts to degrade. With 3 codecs, we just cannot recognize a speach. Tests and observations: --- Since I have 3 usb ports available on the i.MX512, I tried to connect 3 codecs directly on USB ports: the sound is perfect on each of the three ports. I bought a consumer USB 2.0 Hub: no problem when using 3 codecs connected to that Hub, however, the audio will completly stop on all channels when connecting the 4th codec. I checked the communication between the Hub (USB 1.1) and the Host controller (USB 2.0) with a scope and concluded that the communication speed is 1.5 MBytes/s has expected (so the communication is downgraded to USB 1.1, since codecs and hub are USB 1.1 devices). Also, I know that there is physically enough bandwidth to transfer the data for two reasons: 1) I have an older CPU with a USB 1.1 host controller (using the OHCI driver), using the same hub and the same codecs: works like a champ, using less than 50% of the available bandwidth (observed with a scope) 2) 1 audio stream is 32khz-mono, 16 bits = 64 kB/s, 4 codecs = 8 streams(R/W) x 64 kB/s = 512 kB/s (out of 1.5MB/s) I noticed that my sound problem starts happening with only 2 codecs (4 streams, 256 kB/s). I first thought that it was a bandwidth limitation, so I decided to connect only 1 codec using more bandwidth. I configured it to 48khz-stereo (16-bits), using 384 kB/s for both read and write streams: no problem. With that configuration, the scope shows about 30% of total bandwidth usage (300us used out of 1ms periods). Then, I added a second codec (48khz-stereo-16bits): very strange, now the total bandwidth usage felt down to about 200us, which seems to keep the same, whatever the number of codec I add (I also tried 3 and 4...). So it looks like the scheduler is not able to properly allocate Isochronous time slots when more than one device is connected to the hub. However, without the hub, it works perfectly. I am wonder if it is similar problem I met when using multiple interrupt transfers, when you find you lose the data, try to run 'top' to show cpu utilization, if it is close to 100%, it means the ehci can't queue request in time, so the host can't send IN token in time. Using a USB bus analyzer can also verify it. Peter Another interresting fact is that at application level, the Read and Write operations are returning the good amount of bytes read/written. This is not the case at kernel level: I noticed that function usb_submit_urb (from /drivers/usb/core/urb.c) will only tranfer part of the urbs when the sound is degraded. I tried to figure out where the leak comes from without success. Also, there are no error messages from kernel so everything appears to work well, excepted that part of the sound is missing! I can't change my hardware (this is in the hand of customers), so the only possible solution for me is to correct the software. I tried to change my ehci driver with the one from kernel 2.6.39.4 but did not work, same problem. Question: - Before attempting to upgrade to an earlier kernel driver (this is a fairly big amount of work), I would really like to know if this problem would still be in the 3.x kernels. Has anyone seen that issue in 3.x kernels? I am pretty new to USB driver debugging, so any ideas of where/how to find solutions will be appreciated. Thank you very much in advance for the support. Also don't hesitate to redirect me if I'm not at the right place to ask these questions. I can also provide some code if someone need it to help. Attached is a dump of my dmesg after startup. Michael Tessier ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] usb: phy: fsl: Fix build errors
On Wed, Nov 12, 2014 at 08:39:06AM -0600, Felipe Balbi wrote: commit e47d925 (usb: move the OTG state from the USB PHY to the OTG structure) moved the OTG state from struct usb_phy to struct usb_otg. Unfortunately, even though I fixed quite a few build regressions with that patch already, this one was still missing. Note that this driver still has other randconfig build problems which I'll leave for driver author to fix, as that's less trivial. Add more guys who may use this driver. Reported-by: Fengguang Wu fengguang...@intel.com Signed-off-by: Felipe Balbi ba...@ti.com --- The following build error are left for Freescale folks since they seem to be a broken for quite a long time. drivers/usb/phy/phy-fsl-usb.c: In function ‘usb_otg_start’: drivers/usb/phy/phy-fsl-usb.c:918:3: error: ‘_fsl_readl’ undeclared (first use in this function) _fsl_readl = _fsl_readl_be; ^ drivers/usb/phy/phy-fsl-usb.c:918:3: note: each undeclared identifier is reported only once for each function it appears in drivers/usb/phy/phy-fsl-usb.c:918:16: error: ‘_fsl_readl_be’ undeclared (first use in this function) _fsl_readl = _fsl_readl_be; ^ drivers/usb/phy/phy-fsl-usb.c:919:3: error: ‘_fsl_writel’ undeclared (first use in this function) _fsl_writel = _fsl_writel_be; ^ drivers/usb/phy/phy-fsl-usb.c:919:17: error: ‘_fsl_writel_be’ undeclared (first use in this function) _fsl_writel = _fsl_writel_be; ^ drivers/usb/phy/phy-fsl-usb.c:921:16: error: ‘_fsl_readl_le’ undeclared (first use in this function) _fsl_readl = _fsl_readl_le; ^ drivers/usb/phy/phy-fsl-usb.c:922:17: error: ‘_fsl_writel_le’ undeclared (first use in this function) _fsl_writel = _fsl_writel_le; ^ drivers/usb/phy/phy-fsl-usb.c | 14 +++--- drivers/usb/phy/phy-fsl-usb.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index b7f36b2..ab38aa3 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -274,7 +274,7 @@ void b_srp_end(unsigned long foo) fsl_otg_dischrg_vbus(0); srp_wait_done = 1; - if ((fsl_otg_dev-phy.state == OTG_STATE_B_SRP_INIT) + if ((fsl_otg_dev-phy.otg-state == OTG_STATE_B_SRP_INIT) fsl_otg_dev-fsm.b_sess_vld) fsl_otg_dev-fsm.b_srp_done = 1; } @@ -624,7 +624,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) /* Mini-A cable connected */ struct otg_fsm *fsm = otg_dev-fsm; - otg.state = OTG_STATE_UNDEFINED; + otg-state = OTG_STATE_UNDEFINED; fsm-protocol = PROTO_UNDEF; } } @@ -682,7 +682,7 @@ static int fsl_otg_set_power(struct usb_phy *phy, unsigned mA) { if (!fsl_otg_dev) return -ENODEV; - if (phy-otg.state == OTG_STATE_B_PERIPHERAL) + if (phy-otg-state == OTG_STATE_B_PERIPHERAL) pr_info(FSL OTG: Draw %d mA\n, mA); return 0; @@ -715,7 +715,7 @@ static int fsl_otg_start_srp(struct usb_otg *otg) { struct fsl_otg *otg_dev; - if (!otg || otg.state != OTG_STATE_B_IDLE) + if (!otg || otg-state != OTG_STATE_B_IDLE) return -ENODEV; otg_dev = container_of(otg-usb_phy, struct fsl_otg, phy); @@ -990,10 +990,10 @@ int usb_otg_start(struct platform_device *pdev) * Also: record initial state of ID pin */ if (fsl_readl(p_otg-dr_mem_map-otgsc) OTGSC_STS_USB_ID) { - p_otg-phy-otg.state = OTG_STATE_UNDEFINED; + p_otg-phy.otg-state = OTG_STATE_UNDEFINED; p_otg-fsm.id = 1; } else { - p_otg-phy-otg.state = OTG_STATE_A_IDLE; + p_otg-phy.otg-state = OTG_STATE_A_IDLE; p_otg-fsm.id = 0; } @@ -1048,7 +1048,7 @@ static int show_fsl_usb2_otg_state(struct device *dev, /* State */ t = scnprintf(next, size, OTG state: %s\n\n, - usb_otg_state_string(fsl_otg_dev-phy.state)); + usb_otg_state_string(fsl_otg_dev-phy.otg-state)); size -= t; next += t; diff --git a/drivers/usb/phy/phy-fsl-usb.h b/drivers/usb/phy/phy-fsl-usb.h index 5986c96..2314995 100644 --- a/drivers/usb/phy/phy-fsl-usb.h +++ b/drivers/usb/phy/phy-fsl-usb.h @@ -298,7 +298,7 @@ /* SE0 Time Before SRP */ #define TB_SE0_SRP (2) /* b_idle,minimum 2 ms, section:5.3.2 */ -#define SET_OTG_STATE(otg_ptr, newstate) ((otg_ptr)-state = newstate) +#define SET_OTG_STATE(phy, newstate) ((phy)-otg-state = newstate) struct usb_dr_mmap { /* Capability register */ -- 2.1.0.GIT -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc
Re: [PATCH v5 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
On Thu, Jan 17, 2013 at 11:14:22AM +0200, Felipe Balbi wrote: On Wed, Jan 16, 2013 at 09:48:25AM +0800, Peter Chen wrote: On Tue, Jan 15, 2013 at 10:03:46PM +0800, Shawn Guo wrote: On Tue, Jan 15, 2013 at 10:29:33AM +0800, Peter Chen wrote: As mach/hardware.h is deleted, we need to use platform_device_id to differentiate SoCs. Besides, one cpu_is_mx35 is useless as it has already used pdata to differentiate runtime Meanwhile we update the platform code accordingly. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 --- drivers/usb/gadget/fsl_mxc_udc.c | 24 +--- drivers/usb/gadget/fsl_udc_core.c | 42 + 4 files changed, 45 insertions(+), 37 deletions(-) Since we are splitting the original patch anyway, it's a bit strange to me that you are mixing arch/arm/mach-imx and drivers/usb/gadget in this patch. I'm fine with it, since I assume all the patches to go via USB tree anyway. diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h index 6277baf..9bd5777 100644 --- a/arch/arm/mach-imx/devices/devices-common.h +++ b/arch/arm/mach-imx/devices/devices-common.h @@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan( #include linux/fsl_devices.h struct imx_fsl_usb2_udc_data { + const char *devid; resource_size_t iobase; resource_size_t irq; }; diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c index 37e4439..fb527c7 100644 --- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c @@ -11,35 +11,36 @@ #include ../hardware.h #include devices-common.h -#define imx_fsl_usb2_udc_data_entry_single(soc) \ +#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \ { \ + .devid = _devid, \ .iobase = soc ## _USB_OTG_BASE_ADDR, \ .irq = soc ## _INT_USB_OTG, \ } #ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX25); + imx_fsl_usb2_udc_data_entry_single(MX25, imx-udc-mx25); #endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX27); + imx_fsl_usb2_udc_data_entry_single(MX27, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX31); + imx_fsl_usb2_udc_data_entry_single(MX31, imx-udc-mx31); #endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX35); + imx_fsl_usb2_udc_data_entry_single(MX35, imx-udc-mx35); #endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX51); + imx_fsl_usb2_udc_data_entry_single(MX51, imx-udc-mx51); #endif struct platform_device *__init imx_add_fsl_usb2_udc( @@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(fsl-usb2-udc, -1, + return imx_add_platform_device_dmamask(data-devid, -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } snip +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name = imx-udc-mx25, + }, { + .name = imx-udc-mx27, + }, { + .name = imx-udc-mx31, + }, { + .name = imx-udc-mx35, + }, { + .name = imx-udc-mx51, + } +}; From what I understand balbi's comment, he dislikes this full list of device id. Instead, he prefers to something like below. static const
[PATCH v6 0/3] *** SUBJECT HERE ***
Changes for v6: - Only using imx-udc-mx27 and imx-udc-mx51 stands for all kinds of i.mx udc - Fix below build error for platform_device_id at fsl_udc_core.c drivers/usb/gadget/fsl_usb2_udc: struct platform_device_id is 24 bytes.? The last of 5 is: | 0x69 0x6d 0x78 0x2d 0x75 0x64 0x63 0x2d 0x6d 0x78 0x35 0x31 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 +0x00 0x00 0x00 | FATAL: drivers/usb/gadget/fsl_usb2_udc: struct platform_device_id is not terminated with a NULL entry! | make[1]: *** [__modpost] Error 1 Changes for v5: - Using strcmp to get specific SoC - Delete one cpu_is_mx35() as it has already pdata runtime check Changes for v4: - Using pdev's struct resource to do ioremap - Add ioremap return value check Changes for v3: - Split the one big patch into three patches Changes for v2: - Add const for fsl_udc_devtype - Do ioremap for phy address at fsl-mxc-udc Peter Chen (3): usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap ARM: i.MX clock: Change the connection-id for fsl-usb2-udc arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 --- drivers/usb/gadget/fsl_mxc_udc.c | 40 +--- drivers/usb/gadget/fsl_udc_core.c | 42 drivers/usb/gadget/fsl_usb2_udc.h |5 +- 10 files changed, 78 insertions(+), 55 deletions(-) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v6 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
As mach/hardware.h is deleted, we need to use platform_device_id to differentiate SoCs. Besides, one cpu_is_mx35 is useless as it has already used pdata to differentiate runtime Meanwhile we update the platform code accordingly. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 drivers/usb/gadget/fsl_mxc_udc.c | 24 + drivers/usb/gadget/fsl_udc_core.c | 38 - 4 files changed, 41 insertions(+), 37 deletions(-) diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h index 6277baf..9bd5777 100644 --- a/arch/arm/mach-imx/devices/devices-common.h +++ b/arch/arm/mach-imx/devices/devices-common.h @@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan( #include linux/fsl_devices.h struct imx_fsl_usb2_udc_data { + const char *devid; resource_size_t iobase; resource_size_t irq; }; diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c index 37e4439..3c06bd9 100644 --- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c @@ -11,35 +11,36 @@ #include ../hardware.h #include devices-common.h -#define imx_fsl_usb2_udc_data_entry_single(soc) \ +#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \ { \ + .devid = _devid,\ .iobase = soc ## _USB_OTG_BASE_ADDR,\ .irq = soc ## _INT_USB_OTG, \ } #ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX25); + imx_fsl_usb2_udc_data_entry_single(MX25, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX27); + imx_fsl_usb2_udc_data_entry_single(MX27, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX31); + imx_fsl_usb2_udc_data_entry_single(MX31, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX35); + imx_fsl_usb2_udc_data_entry_single(MX35, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX51); + imx_fsl_usb2_udc_data_entry_single(MX51, imx-udc-mx51); #endif struct platform_device *__init imx_add_fsl_usb2_udc( @@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(fsl-usb2-udc, -1, + return imx_add_platform_device_dmamask(data-devid, -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 1b0f086..de851e5 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -18,8 +18,6 @@ #include linux/platform_device.h #include linux/io.h -#include mach/hardware.h - static struct clk *mxc_ahb_clk; static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; @@ -59,7 +57,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) clk_prepare_enable(mxc_per_clk); /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ - if (!cpu_is_mx51()) { + if (!strcmp(pdev-id_entry-name, imx-udc-mx27)) { freq = clk_get_rate(mxc_per_clk); if (pdata-phy_mode != FSL_USB2_PHY_ULPI (freq 5000 || freq 60001000)) { @@ -82,17 +80,15 @@ eclkrate: void fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; - if (cpu_is_mx35()) { - unsigned int v; - - /* workaround ENGcm09152 for i.MX35 */ - if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); - writel(v | USBPHYCTRL_EVDO, - MX35_IO_ADDRESS(MX35_USB_BASE_ADDR
[PATCH v6 3/3] ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
As we use platform_device_id for fsl-usb2-udc driver, it needs to change clk connection-id, or the related devm_clk_get will be failed. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/clk-imx25.c |6 +++--- arch/arm/mach-imx/clk-imx27.c |6 +++--- arch/arm/mach-imx/clk-imx31.c |6 +++--- arch/arm/mach-imx/clk-imx35.c |6 +++--- arch/arm/mach-imx/clk-imx51-imx53.c |6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..2c570cd 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx27); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..16ccbd4 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx27); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx27); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..f0727e8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[wdog_gate], NULL, imx2-wdt.0); clk_register_clkdev(clk[nfc_div], NULL, imx25-nand.0); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index 579023f..fb7cb84 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c @@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, clk_register_clkdev(clk[usboh3_per_gate], per, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ipg, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usboh3_per_gate], per, fsl-usb2-udc
[PATCH v6 2/3] usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
As mach/hardware.h is deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_mxc_udc.c | 30 +++--- drivers/usb/gadget/fsl_udc_core.c |4 +++- drivers/usb/gadget/fsl_usb2_udc.h |5 +++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index de851e5..d3bd7b0 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -23,7 +23,8 @@ static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; /* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8 #define USBPHYCTRL_EVDO(1 23) int fsl_udc_clk_init(struct platform_device *pdev) @@ -77,25 +78,40 @@ eclkrate: return ret; } -void fsl_udc_clk_finalize(struct platform_device *pdev) +int fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; - unsigned int v; + int ret = 0; /* workaround ENGcm09152 for i.MX35 */ if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + unsigned int v; + struct resource *res = platform_get_resource + (pdev, IORESOURCE_MEM, 0); + void __iomem *phy_regs = ioremap(res-start + + MX35_USBPHYCTRL_OFFSET, 512); + if (!phy_regs) { + dev_err(pdev-dev, ioremap for phy address fails\n); + ret = -EINVAL; + goto ioremap_err; + } + + v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET); writel(v | USBPHYCTRL_EVDO, - MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + phy_regs + USBPHYCTRL_OTGBASE_OFFSET); + + iounmap(phy_regs); } + +ioremap_err: /* ULPI transceivers don't need usbpll */ if (pdata-phy_mode == FSL_USB2_PHY_ULPI) { clk_disable_unprepare(mxc_per_clk); mxc_per_clk = NULL; } + + return ret; } void fsl_udc_clk_release(void) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 5fc1d72..667275c 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -2543,7 +2543,9 @@ static int __init fsl_udc_probe(struct platform_device *pdev) dr_controller_setup(udc_controller); } - fsl_udc_clk_finalize(pdev); + ret = fsl_udc_clk_finalize(pdev); + if (ret) + goto err_free_irq; /* Setup gadget structure */ udc_controller-gadget.ops = fsl_gadget_ops; diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index f61a967..c6703bb 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h @@ -592,15 +592,16 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep) struct platform_device; #ifdef CONFIG_ARCH_MXC int fsl_udc_clk_init(struct platform_device *pdev); -void fsl_udc_clk_finalize(struct platform_device *pdev); +int fsl_udc_clk_finalize(struct platform_device *pdev); void fsl_udc_clk_release(void); #else static inline int fsl_udc_clk_init(struct platform_device *pdev) { return 0; } -static inline void fsl_udc_clk_finalize(struct platform_device *pdev) +static inline int fsl_udc_clk_finalize(struct platform_device *pdev) { + return 0; } static inline void fsl_udc_clk_release(void) { -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v6 0/3] Fix the Build error for fsl_mxc_udc.c
Changes for v6: - Only using imx-udc-mx27 and imx-udc-mx51 stands for all kinds of i.mx udc - Fix below build error for platform_device_id at fsl_udc_core.c drivers/usb/gadget/fsl_usb2_udc: struct platform_device_id is 24 bytes.? The last of 5 is: | 0x69 0x6d 0x78 0x2d 0x75 0x64 0x63 0x2d 0x6d 0x78 0x35 0x31 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 +0x00 0x00 0x00 | FATAL: drivers/usb/gadget/fsl_usb2_udc: struct platform_device_id is not terminated with a NULL entry! | make[1]: *** [__modpost] Error 1 Changes for v5: - Using strcmp to get specific SoC - Delete one cpu_is_mx35() as it has already pdata runtime check Changes for v4: - Using pdev's struct resource to do ioremap - Add ioremap return value check Changes for v3: - Split the one big patch into three patches Changes for v2: - Add const for fsl_udc_devtype - Do ioremap for phy address at fsl-mxc-udc Peter Chen (3): usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap ARM: i.MX clock: Change the connection-id for fsl-usb2-udc arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 --- drivers/usb/gadget/fsl_mxc_udc.c | 40 +--- drivers/usb/gadget/fsl_udc_core.c | 42 drivers/usb/gadget/fsl_usb2_udc.h |5 +- 10 files changed, 78 insertions(+), 55 deletions(-) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v6 2/3] usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
As mach/hardware.h is deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_mxc_udc.c | 30 +++--- drivers/usb/gadget/fsl_udc_core.c |4 +++- drivers/usb/gadget/fsl_usb2_udc.h |5 +++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index de851e5..d3bd7b0 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -23,7 +23,8 @@ static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; /* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8 #define USBPHYCTRL_EVDO(1 23) int fsl_udc_clk_init(struct platform_device *pdev) @@ -77,25 +78,40 @@ eclkrate: return ret; } -void fsl_udc_clk_finalize(struct platform_device *pdev) +int fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; - unsigned int v; + int ret = 0; /* workaround ENGcm09152 for i.MX35 */ if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + unsigned int v; + struct resource *res = platform_get_resource + (pdev, IORESOURCE_MEM, 0); + void __iomem *phy_regs = ioremap(res-start + + MX35_USBPHYCTRL_OFFSET, 512); + if (!phy_regs) { + dev_err(pdev-dev, ioremap for phy address fails\n); + ret = -EINVAL; + goto ioremap_err; + } + + v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET); writel(v | USBPHYCTRL_EVDO, - MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + phy_regs + USBPHYCTRL_OTGBASE_OFFSET); + + iounmap(phy_regs); } + +ioremap_err: /* ULPI transceivers don't need usbpll */ if (pdata-phy_mode == FSL_USB2_PHY_ULPI) { clk_disable_unprepare(mxc_per_clk); mxc_per_clk = NULL; } + + return ret; } void fsl_udc_clk_release(void) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 5fc1d72..667275c 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -2543,7 +2543,9 @@ static int __init fsl_udc_probe(struct platform_device *pdev) dr_controller_setup(udc_controller); } - fsl_udc_clk_finalize(pdev); + ret = fsl_udc_clk_finalize(pdev); + if (ret) + goto err_free_irq; /* Setup gadget structure */ udc_controller-gadget.ops = fsl_gadget_ops; diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index f61a967..c6703bb 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h @@ -592,15 +592,16 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep) struct platform_device; #ifdef CONFIG_ARCH_MXC int fsl_udc_clk_init(struct platform_device *pdev); -void fsl_udc_clk_finalize(struct platform_device *pdev); +int fsl_udc_clk_finalize(struct platform_device *pdev); void fsl_udc_clk_release(void); #else static inline int fsl_udc_clk_init(struct platform_device *pdev) { return 0; } -static inline void fsl_udc_clk_finalize(struct platform_device *pdev) +static inline int fsl_udc_clk_finalize(struct platform_device *pdev) { + return 0; } static inline void fsl_udc_clk_release(void) { -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v6 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
As mach/hardware.h is deleted, we need to use platform_device_id to differentiate SoCs. Besides, one cpu_is_mx35 is useless as it has already used pdata to differentiate runtime Meanwhile we update the platform code accordingly. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 drivers/usb/gadget/fsl_mxc_udc.c | 24 + drivers/usb/gadget/fsl_udc_core.c | 38 - 4 files changed, 41 insertions(+), 37 deletions(-) diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h index 6277baf..9bd5777 100644 --- a/arch/arm/mach-imx/devices/devices-common.h +++ b/arch/arm/mach-imx/devices/devices-common.h @@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan( #include linux/fsl_devices.h struct imx_fsl_usb2_udc_data { + const char *devid; resource_size_t iobase; resource_size_t irq; }; diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c index 37e4439..3c06bd9 100644 --- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c @@ -11,35 +11,36 @@ #include ../hardware.h #include devices-common.h -#define imx_fsl_usb2_udc_data_entry_single(soc) \ +#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \ { \ + .devid = _devid,\ .iobase = soc ## _USB_OTG_BASE_ADDR,\ .irq = soc ## _INT_USB_OTG, \ } #ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX25); + imx_fsl_usb2_udc_data_entry_single(MX25, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX27); + imx_fsl_usb2_udc_data_entry_single(MX27, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX31); + imx_fsl_usb2_udc_data_entry_single(MX31, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX35); + imx_fsl_usb2_udc_data_entry_single(MX35, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX51); + imx_fsl_usb2_udc_data_entry_single(MX51, imx-udc-mx51); #endif struct platform_device *__init imx_add_fsl_usb2_udc( @@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(fsl-usb2-udc, -1, + return imx_add_platform_device_dmamask(data-devid, -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 1b0f086..de851e5 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -18,8 +18,6 @@ #include linux/platform_device.h #include linux/io.h -#include mach/hardware.h - static struct clk *mxc_ahb_clk; static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; @@ -59,7 +57,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) clk_prepare_enable(mxc_per_clk); /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ - if (!cpu_is_mx51()) { + if (!strcmp(pdev-id_entry-name, imx-udc-mx27)) { freq = clk_get_rate(mxc_per_clk); if (pdata-phy_mode != FSL_USB2_PHY_ULPI (freq 5000 || freq 60001000)) { @@ -82,17 +80,15 @@ eclkrate: void fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; - if (cpu_is_mx35()) { - unsigned int v; - - /* workaround ENGcm09152 for i.MX35 */ - if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); - writel(v | USBPHYCTRL_EVDO, - MX35_IO_ADDRESS(MX35_USB_BASE_ADDR
[PATCH v6 3/3] ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
As we use platform_device_id for fsl-usb2-udc driver, it needs to change clk connection-id, or the related devm_clk_get will be failed. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/clk-imx25.c |6 +++--- arch/arm/mach-imx/clk-imx27.c |6 +++--- arch/arm/mach-imx/clk-imx31.c |6 +++--- arch/arm/mach-imx/clk-imx35.c |6 +++--- arch/arm/mach-imx/clk-imx51-imx53.c |6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..2c570cd 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx27); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..16ccbd4 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx27); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx27); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..f0727e8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[wdog_gate], NULL, imx2-wdt.0); clk_register_clkdev(clk[nfc_div], NULL, imx25-nand.0); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index 579023f..fb7cb84 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c @@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, clk_register_clkdev(clk[usboh3_per_gate], per, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ipg, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usboh3_per_gate], per, fsl-usb2-udc
Re: [PATCH v6 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
On Thu, Jan 17, 2013 at 12:43:23PM -0200, Fabio Estevam wrote: On Thu, Jan 17, 2013 at 9:25 AM, Lothar Waßmann l...@karo-electronics.de wrote: The equivalent of !cpu_is_mx51() would be strcmp(pdev-id_entry-name, imx-udc-mx51) (without the '!') meaning id_entry-name is different from imx-udc-mx51. Thanks, Lothar and Fabio, I will change, and send v7. Yes, agree. strcmp(pdev-id_entry-name, imx-udc-mx51) is also better than !strcmp(pdev-id_entry-name, imx-udc-mx27)) We just think this feature only belongs to imx-udc-mx27 type udc because in the case of another soc entry gets added, let's say imx-udc-mxyy then !strcmp(pdev-id_entry-name, imx-udc-mx27)) will not correspond to !cpu_is_mx51() anymore. -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v7 0/3] Fix the Build error for fsl_mxc_udc.c
Changes for v7: - Change !strcmp(str1, str2) to strcmp(str1, str2) == 0 Changes for v6: - Only using imx-udc-mx27 and imx-udc-mx51 stands for all kinds of i.mx udc - Fix below build error for platform_device_id at fsl_udc_core.c drivers/usb/gadget/fsl_usb2_udc: struct platform_device_id is 24 bytes.? The last of 5 is: | 0x69 0x6d 0x78 0x2d 0x75 0x64 0x63 0x2d 0x6d 0x78 0x35 0x31 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 +0x00 0x00 0x00 | FATAL: drivers/usb/gadget/fsl_usb2_udc: struct platform_device_id is not terminated with a NULL entry! | make[1]: *** [__modpost] Error 1 Changes for v5: - Using strcmp to get specific SoC - Delete one cpu_is_mx35() as it has already pdata runtime check Changes for v4: - Using pdev's struct resource to do ioremap - Add ioremap return value check Changes for v3: - Split the one big patch into three patches Changes for v2: - Add const for fsl_udc_devtype - Do ioremap for phy address at fsl-mxc-udc Peter Chen (3): usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap ARM: i.MX clock: Change the connection-id for fsl-usb2-udc arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 --- drivers/usb/gadget/fsl_mxc_udc.c | 46 ++--- drivers/usb/gadget/fsl_udc_core.c | 42 +++ drivers/usb/gadget/fsl_usb2_udc.h |5 +- 10 files changed, 83 insertions(+), 56 deletions(-) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v7 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
As mach/hardware.h is deleted, we need to use platform_device_id to differentiate SoCs. Besides, one cpu_is_mx35 is useless as it has already used pdata to differentiate runtime Meanwhile we update the platform code accordingly. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 drivers/usb/gadget/fsl_mxc_udc.c | 30 drivers/usb/gadget/fsl_udc_core.c | 38 - 4 files changed, 46 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h index 6277baf..9bd5777 100644 --- a/arch/arm/mach-imx/devices/devices-common.h +++ b/arch/arm/mach-imx/devices/devices-common.h @@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan( #include linux/fsl_devices.h struct imx_fsl_usb2_udc_data { + const char *devid; resource_size_t iobase; resource_size_t irq; }; diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c index 37e4439..3c06bd9 100644 --- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c @@ -11,35 +11,36 @@ #include ../hardware.h #include devices-common.h -#define imx_fsl_usb2_udc_data_entry_single(soc) \ +#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \ { \ + .devid = _devid,\ .iobase = soc ## _USB_OTG_BASE_ADDR,\ .irq = soc ## _INT_USB_OTG, \ } #ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX25); + imx_fsl_usb2_udc_data_entry_single(MX25, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX27); + imx_fsl_usb2_udc_data_entry_single(MX27, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX31); + imx_fsl_usb2_udc_data_entry_single(MX31, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX35); + imx_fsl_usb2_udc_data_entry_single(MX35, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX51); + imx_fsl_usb2_udc_data_entry_single(MX51, imx-udc-mx51); #endif struct platform_device *__init imx_add_fsl_usb2_udc( @@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(fsl-usb2-udc, -1, + return imx_add_platform_device_dmamask(data-devid, -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 1b0f086..aa81ac5 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -18,8 +18,6 @@ #include linux/platform_device.h #include linux/io.h -#include mach/hardware.h - static struct clk *mxc_ahb_clk; static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; @@ -58,8 +56,12 @@ int fsl_udc_clk_init(struct platform_device *pdev) clk_prepare_enable(mxc_ahb_clk); clk_prepare_enable(mxc_per_clk); - /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ - if (!cpu_is_mx51()) { + /* +* Make sure USB_CLK is running at 60 MHz +/- 1000 Hz +* Only two types of udc currently, imx-udc-mx27 and +* imx-udc-mx51 (mx51 mx53) +*/ + if (strcmp(pdev-id_entry-name, imx-udc-mx27) == 0) { freq = clk_get_rate(mxc_per_clk); if (pdata-phy_mode != FSL_USB2_PHY_ULPI (freq 5000 || freq 60001000)) { @@ -82,17 +84,15 @@ eclkrate: void fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; - if (cpu_is_mx35()) { - unsigned int v; - - /* workaround ENGcm09152 for i.MX35 */ - if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl
[PATCH v7 2/3] usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
As mach/hardware.h is deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_mxc_udc.c | 30 +++--- drivers/usb/gadget/fsl_udc_core.c |4 +++- drivers/usb/gadget/fsl_usb2_udc.h |5 +++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index aa81ac5..f1aeb5c 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -23,7 +23,8 @@ static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; /* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8 #define USBPHYCTRL_EVDO(1 23) int fsl_udc_clk_init(struct platform_device *pdev) @@ -81,25 +82,40 @@ eclkrate: return ret; } -void fsl_udc_clk_finalize(struct platform_device *pdev) +int fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; - unsigned int v; + int ret = 0; /* workaround ENGcm09152 for i.MX35 */ if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + unsigned int v; + struct resource *res = platform_get_resource + (pdev, IORESOURCE_MEM, 0); + void __iomem *phy_regs = ioremap(res-start + + MX35_USBPHYCTRL_OFFSET, 512); + if (!phy_regs) { + dev_err(pdev-dev, ioremap for phy address fails\n); + ret = -EINVAL; + goto ioremap_err; + } + + v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET); writel(v | USBPHYCTRL_EVDO, - MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + phy_regs + USBPHYCTRL_OTGBASE_OFFSET); + + iounmap(phy_regs); } + +ioremap_err: /* ULPI transceivers don't need usbpll */ if (pdata-phy_mode == FSL_USB2_PHY_ULPI) { clk_disable_unprepare(mxc_per_clk); mxc_per_clk = NULL; } + + return ret; } void fsl_udc_clk_release(void) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 5fc1d72..667275c 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -2543,7 +2543,9 @@ static int __init fsl_udc_probe(struct platform_device *pdev) dr_controller_setup(udc_controller); } - fsl_udc_clk_finalize(pdev); + ret = fsl_udc_clk_finalize(pdev); + if (ret) + goto err_free_irq; /* Setup gadget structure */ udc_controller-gadget.ops = fsl_gadget_ops; diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index f61a967..c6703bb 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h @@ -592,15 +592,16 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep) struct platform_device; #ifdef CONFIG_ARCH_MXC int fsl_udc_clk_init(struct platform_device *pdev); -void fsl_udc_clk_finalize(struct platform_device *pdev); +int fsl_udc_clk_finalize(struct platform_device *pdev); void fsl_udc_clk_release(void); #else static inline int fsl_udc_clk_init(struct platform_device *pdev) { return 0; } -static inline void fsl_udc_clk_finalize(struct platform_device *pdev) +static inline int fsl_udc_clk_finalize(struct platform_device *pdev) { + return 0; } static inline void fsl_udc_clk_release(void) { -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v7 3/3] ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
As we use platform_device_id for fsl-usb2-udc driver, it needs to change clk connection-id, or the related devm_clk_get will be failed. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/clk-imx25.c |6 +++--- arch/arm/mach-imx/clk-imx27.c |6 +++--- arch/arm/mach-imx/clk-imx31.c |6 +++--- arch/arm/mach-imx/clk-imx35.c |6 +++--- arch/arm/mach-imx/clk-imx51-imx53.c |6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..2c570cd 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx27); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..16ccbd4 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx27); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx27); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..f0727e8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[wdog_gate], NULL, imx2-wdt.0); clk_register_clkdev(clk[nfc_div], NULL, imx25-nand.0); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index 579023f..fb7cb84 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c @@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, clk_register_clkdev(clk[usboh3_per_gate], per, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ipg, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usboh3_per_gate], per, fsl-usb2-udc
Re: [PATCH v7 3/3] ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
On Fri, Jan 18, 2013 at 10:23:39AM +0800, Shawn Guo wrote: Peter, On Fri, Jan 18, 2013 at 10:15:49AM +0800, Peter Chen wrote: As we use platform_device_id for fsl-usb2-udc driver, it needs to change clk connection-id, or the related devm_clk_get will be failed. Signed-off-by: Peter Chen peter.c...@freescale.com You should have my ACK put after your SoB, since I have provided it on v6 of this patch. It will make balbi's life a little bit easier when he applies the patch. thanks, will do next time So again, Acked-by: Shawn Guo shawn@linaro.org Shawn -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v5 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
On Tue, Jan 15, 2013 at 10:03:46PM +0800, Shawn Guo wrote: On Tue, Jan 15, 2013 at 10:29:33AM +0800, Peter Chen wrote: As mach/hardware.h is deleted, we need to use platform_device_id to differentiate SoCs. Besides, one cpu_is_mx35 is useless as it has already used pdata to differentiate runtime Meanwhile we update the platform code accordingly. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 --- drivers/usb/gadget/fsl_mxc_udc.c | 24 +--- drivers/usb/gadget/fsl_udc_core.c | 42 + 4 files changed, 45 insertions(+), 37 deletions(-) Since we are splitting the original patch anyway, it's a bit strange to me that you are mixing arch/arm/mach-imx and drivers/usb/gadget in this patch. I'm fine with it, since I assume all the patches to go via USB tree anyway. diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h index 6277baf..9bd5777 100644 --- a/arch/arm/mach-imx/devices/devices-common.h +++ b/arch/arm/mach-imx/devices/devices-common.h @@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan( #include linux/fsl_devices.h struct imx_fsl_usb2_udc_data { + const char *devid; resource_size_t iobase; resource_size_t irq; }; diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c index 37e4439..fb527c7 100644 --- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c @@ -11,35 +11,36 @@ #include ../hardware.h #include devices-common.h -#define imx_fsl_usb2_udc_data_entry_single(soc) \ +#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \ { \ + .devid = _devid,\ .iobase = soc ## _USB_OTG_BASE_ADDR,\ .irq = soc ## _INT_USB_OTG, \ } #ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX25); + imx_fsl_usb2_udc_data_entry_single(MX25, imx-udc-mx25); #endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX27); + imx_fsl_usb2_udc_data_entry_single(MX27, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX31); + imx_fsl_usb2_udc_data_entry_single(MX31, imx-udc-mx31); #endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX35); + imx_fsl_usb2_udc_data_entry_single(MX35, imx-udc-mx35); #endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX51); + imx_fsl_usb2_udc_data_entry_single(MX51, imx-udc-mx51); #endif struct platform_device *__init imx_add_fsl_usb2_udc( @@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(fsl-usb2-udc, -1, + return imx_add_platform_device_dmamask(data-devid, -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } snip +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name = imx-udc-mx25, + }, { + .name = imx-udc-mx27, + }, { + .name = imx-udc-mx31, + }, { + .name = imx-udc-mx35, + }, { + .name = imx-udc-mx51, + } +}; From what I understand balbi's comment, he dislikes this full list of device id. Instead, he prefers to something like below. static const struct platform_device_id fsl_udc_devtype[] = { { .name = imx-udc-mx27, }, { .name = imx-udc-mx51, } }; It basically tells that we are handling two type of devices here, one is imx-udc-mx27 type and the other is imx-udc-mx51 type, with mx25/31/35 completely compatible with mx27 type. We choose mx27 instead of mx25 to define the type because mx27 Si came out earlier than mx25. That said, we generally choose the earlies SoC name to define a particular version of IP block, since hardware
Re: [PATCH v2 1/1] usb: fsl-mxc-udc: fix build error due to mach/hardware.h
On Mon, Jan 14, 2013 at 09:48:58AM +0200, Felipe Balbi wrote: Hi, On Mon, Jan 14, 2013 at 03:18:17PM +0800, Peter Chen wrote: It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the SoC type, and updates the platform code accordingly. Compile ok at imx_v6_v7_defconfig with CONFIG_USB_FSL_USB2 enable. Tested at mx51 bbg board, it works ok after enable phy clock (Need another patch to fix this problem) Signed-off-by: Peter Chen peter.c...@freescale.com not good for -rc. You have to break this down as you're solving at least three different problems with this patch. Felipe, all my changes are for this problem, these are fix build error and let it work. arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- As we change the connection-id, we need to change clock file or the devm_clk_get will be failed. arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- We need to differentiate SoCs, so I use platform_device_id to instead of cpu_ix_xxx(), this is for machine file change drivers/usb/gadget/fsl_mxc_udc.c | 23 + drivers/usb/gadget/fsl_udc_core.c | 52 +--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ Need to get platform_device_id at driver, and replace the cpu_is_xxx to platform_device_id. Meanwhile, needs a solution for replace MX35_IO_ADDRESS. Besides there are parts which are not related to the build break. I can split this patch to two patches, one is driver part, the other is machine part. It can also fix build break, but it needs two patches to let the udc work. -- balbi -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 1/1] usb: fsl-mxc-udc: fix build error due to mach/hardware.h
On Mon, Jan 14, 2013 at 10:50:27AM +0200, Felipe Balbi wrote: Hi, On Mon, Jan 14, 2013 at 04:17:35PM +0800, Peter Chen wrote: On Mon, Jan 14, 2013 at 09:48:58AM +0200, Felipe Balbi wrote: Hi, On Mon, Jan 14, 2013 at 03:18:17PM +0800, Peter Chen wrote: It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the SoC type, and updates the platform code accordingly. Compile ok at imx_v6_v7_defconfig with CONFIG_USB_FSL_USB2 enable. Tested at mx51 bbg board, it works ok after enable phy clock (Need another patch to fix this problem) Signed-off-by: Peter Chen peter.c...@freescale.com not good for -rc. You have to break this down as you're solving at least three different problems with this patch. Felipe, all my changes are for this problem, these are fix build error and let it work. arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- As we change the connection-id, we need to change clock file or the devm_clk_get will be failed. right right, that's ok. arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- We need to differentiate SoCs, so I use platform_device_id to instead of cpu_ix_xxx(), this is for machine file change fair enough. drivers/usb/gadget/fsl_mxc_udc.c | 23 + drivers/usb/gadget/fsl_udc_core.c | 52 +--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ Need to get platform_device_id at driver, and replace the cpu_is_xxx to platform_device_id. Meanwhile, needs a solution for replace MX35_IO_ADDRESS. ok, here we go: You just listed to me three different fixes and each fix should be on a separate patch. Meaning that you should have one single patch to convert MX35_IO_ADDRESS() into ioremap(), another patch should be removing cpu_is_xxx() and the third one fixing connection-id. As you might remember, we want patches to be self-contained logical units and your patch contains 3 of such logical units. OK, three patches. Thanks. The reason I thought two patches is this build break contains two problems, (MX35_IO_ADDRESS cpu_is_xxx()). I would like fix it together, in that case, the git bisect will only show one build error at most. -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 0/3] Fix the Build error for fsl_mxc_udc.c
Changes for v3: - Split the one big patch into three patches Changes for v2: - Add const for fsl_udc_devtype - Do ioremap for phy address at fsl-mxc-udc Peter Chen (3): usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap ARM: i.MX clock: Change the connection-id for fsl-usb2-udc arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 23 + drivers/usb/gadget/fsl_udc_core.c | 52 +--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ 11 files changed, 87 insertions(+), 55 deletions(-) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
As mach/hardware.h is deleted, we need to use platform_device_id to differentiate SoCs. Besides we update the platform code accordingly. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 11 ++-- drivers/usb/gadget/fsl_udc_core.c | 52 +--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ 6 files changed, 65 insertions(+), 35 deletions(-) diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h index 6277baf..9bd5777 100644 --- a/arch/arm/mach-imx/devices/devices-common.h +++ b/arch/arm/mach-imx/devices/devices-common.h @@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan( #include linux/fsl_devices.h struct imx_fsl_usb2_udc_data { + const char *devid; resource_size_t iobase; resource_size_t irq; }; diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c index 37e4439..fb527c7 100644 --- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c @@ -11,35 +11,36 @@ #include ../hardware.h #include devices-common.h -#define imx_fsl_usb2_udc_data_entry_single(soc) \ +#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \ { \ + .devid = _devid,\ .iobase = soc ## _USB_OTG_BASE_ADDR,\ .irq = soc ## _INT_USB_OTG, \ } #ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX25); + imx_fsl_usb2_udc_data_entry_single(MX25, imx-udc-mx25); #endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX27); + imx_fsl_usb2_udc_data_entry_single(MX27, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX31); + imx_fsl_usb2_udc_data_entry_single(MX31, imx-udc-mx31); #endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX35); + imx_fsl_usb2_udc_data_entry_single(MX35, imx-udc-mx35); #endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX51); + imx_fsl_usb2_udc_data_entry_single(MX51, imx-udc-mx51); #endif struct platform_device *__init imx_add_fsl_usb2_udc( @@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(fsl-usb2-udc, -1, + return imx_add_platform_device_dmamask(data-devid, -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 1b0f086..6df45f7 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -18,8 +18,6 @@ #include linux/platform_device.h #include linux/io.h -#include mach/hardware.h - static struct clk *mxc_ahb_clk; static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; @@ -28,7 +26,7 @@ static struct clk *mxc_ipg_clk; #define USBPHYCTRL_OTGBASE_OFFSET 0x608 #define USBPHYCTRL_EVDO(1 23) -int fsl_udc_clk_init(struct platform_device *pdev) +int fsl_udc_clk_init(enum fsl_udc_type devtype, struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata; unsigned long freq; @@ -59,7 +57,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) clk_prepare_enable(mxc_per_clk); /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ - if (!cpu_is_mx51()) { + if (!(devtype == IMX51_UDC)) { freq = clk_get_rate(mxc_per_clk); if (pdata-phy_mode != FSL_USB2_PHY_ULPI (freq 5000 || freq 60001000)) { @@ -79,10 +77,11 @@ eclkrate: return ret; } -void fsl_udc_clk_finalize(struct platform_device *pdev) +void fsl_udc_clk_finalize(enum fsl_udc_type devtype, + struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev
[PATCH v3 2/3] usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
As mach/hardware.h is deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_mxc_udc.c | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 6df45f7..0e858e6 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -23,7 +23,8 @@ static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; /* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8 #define USBPHYCTRL_EVDO(1 23) int fsl_udc_clk_init(enum fsl_udc_type devtype, struct platform_device *pdev) @@ -83,15 +84,16 @@ void fsl_udc_clk_finalize(enum fsl_udc_type devtype, struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; if (devtype == IMX35_UDC) { unsigned int v; + void __iomem *phy_regs = ioremap((unsigned long)pdata-regs + + MX35_USBPHYCTRL_OFFSET, 512); /* workaround ENGcm09152 for i.MX35 */ if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET); writel(v | USBPHYCTRL_EVDO, - MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + phy_regs + USBPHYCTRL_OTGBASE_OFFSET); } + iounmap(phy_regs); } /* ULPI transceivers don't need usbpll */ -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 3/3] ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
As we use platform_device_id for fsl-usb2-udc driver, it needs to change clk connection-id, or the related devm_clk_get will be failed. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/clk-imx25.c |6 +++--- arch/arm/mach-imx/clk-imx27.c |6 +++--- arch/arm/mach-imx/clk-imx31.c |6 +++--- arch/arm/mach-imx/clk-imx35.c |6 +++--- arch/arm/mach-imx/clk-imx51-imx53.c |6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..67e353d 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx25); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx25); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx25); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..ef66eaf 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx31); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx31); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx31); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..69fe9c8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx35); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx35); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx35); clk_register_clkdev(clk[wdog_gate], NULL, imx2-wdt.0); clk_register_clkdev(clk[nfc_div], NULL, imx25-nand.0); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index 579023f..fb7cb84 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c @@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, clk_register_clkdev(clk[usboh3_per_gate], per, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ipg, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usboh3_per_gate], per, fsl-usb2-udc
Re: [PATCH v3 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
On Mon, Jan 14, 2013 at 01:06:00PM +0200, Felipe Balbi wrote: On Mon, Jan 14, 2013 at 12:03:04PM +0100, Marc Kleine-Budde wrote: On 01/14/2013 11:53 AM, Felipe Balbi wrote: Hi, On Mon, Jan 14, 2013 at 11:50:41AM +0100, Marc Kleine-Budde wrote: On 01/14/2013 11:39 AM, Felipe Balbi wrote: On Mon, Jan 14, 2013 at 11:34:05AM +0100, Marc Kleine-Budde wrote: On 01/14/2013 11:24 AM, Felipe Balbi wrote: On Mon, Jan 14, 2013 at 11:18:53AM +0100, Marc Kleine-Budde wrote: On 01/14/2013 11:16 AM, Felipe Balbi wrote: Hi, On Mon, Jan 14, 2013 at 06:12:39PM +0800, Peter Chen wrote: @@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev) return fsl_udc_resume(NULL); } - /*- Register entry point for the peripheral controller driver --*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name = imx-udc-mx25, + .driver_data = IMX25_UDC, + }, { + .name = imx-udc-mx27, + .driver_data = IMX27_UDC, + }, { + .name = imx-udc-mx31, + .driver_data = IMX31_UDC, + }, { + .name = imx-udc-mx35, + .driver_data = IMX35_UDC, + }, { + .name = imx-udc-mx51, + .driver_data = IMX51_UDC, + } +}; I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome. Why use a string compare, if the kernel infrastructure already does this for you? what do you mean ? What kernel infrastructure is doing waht for me ? The kernel infrastructure is doing the string compare for you to match the device against the driver (via platform_device_id-name). You get the a pointer to the driver_data for free. So you don't need any string compare in the driver later. but current driver data is just duplicating name with an integer, it's pretty useless driver data. I don't think so - another argument: Less code. As struct platform_device_id is a static array the space is allocated anyway. So it doesn't make any difference if driver_data is NULL or not. Later you just need to make an integer comparison instead of a call to a strcmp(), if you have a switch/case and IMX*_UDC is an enum, the compiler will warn you if you've missed an IMX variant. fair enough, but then don't create a different enum value for each imx instance if they're mostly the same. Differentiate only what's actually different. Usually there isn't any Changelog between IP cores used in the different fsl processors (at least available outside of fsl), that makes it quite difficult to say if something found on one imx is really the same as on the other one. And they (usually) don't provide any versioning information in a register or the documentation. just my 2¢ $SUBJECT is trying to differentiate a single feature (or maybe two) to replace cpu_is_xxx(), then expose that on driver_data without creating one enum value for each release from fsl. Felipe, every one or two SoCs may have their special operations for integrate PHY interface, clk operation, or workaround for IC limitation. Maybe, it will add more future or SoCs (maybe not for this driver) in the future, using enum is easier than string comparison for expanding something. -- balbi -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 2/3] usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
On Mon, Jan 14, 2013 at 12:17:08PM +0200, Felipe Balbi wrote: On Mon, Jan 14, 2013 at 06:12:40PM +0800, Peter Chen wrote: As mach/hardware.h is deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_mxc_udc.c | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 6df45f7..0e858e6 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -23,7 +23,8 @@ static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; /* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8 #define USBPHYCTRL_EVDO(1 23) int fsl_udc_clk_init(enum fsl_udc_type devtype, struct platform_device *pdev) @@ -83,15 +84,16 @@ void fsl_udc_clk_finalize(enum fsl_udc_type devtype, struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; if (devtype == IMX35_UDC) { unsigned int v; + void __iomem *phy_regs = ioremap((unsigned long)pdata-regs + + MX35_USBPHYCTRL_OFFSET, 512); as I said before, this should be passed via struct resource, not pdata. My careless, will change at next version -- balbi -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 2/3] usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
On Mon, Jan 14, 2013 at 01:10:56PM +, Russell King - ARM Linux wrote: On Mon, Jan 14, 2013 at 06:12:40PM +0800, Peter Chen wrote: @@ -83,15 +84,16 @@ void fsl_udc_clk_finalize(enum fsl_udc_type devtype, struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; if (devtype == IMX35_UDC) { unsigned int v; + void __iomem *phy_regs = ioremap((unsigned long)pdata-regs + + MX35_USBPHYCTRL_OFFSET, 512); Consider that ioremap() can fail. Thanks, will check NULL pointer. -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 0/3] Fix the Build error for fsl_mxc_udc.c
Changes for v4: - Using pdev's struct resource to do ioremap - Add ioremap return value check Changes for v3: - Split the one big patch into three patches Changes for v2: - Add const for fsl_udc_devtype - Do ioremap for phy address at fsl-mxc-udc Peter Chen (3): usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap ARM: i.MX clock: Change the connection-id for fsl-usb2-udc arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 36 ++ drivers/usb/gadget/fsl_udc_core.c | 54 ++--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ 11 files changed, 102 insertions(+), 55 deletions(-) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
As mach/hardware.h is deleted, we need to use platform_device_id to differentiate SoCs. Besides we update the platform code accordingly. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 11 ++-- drivers/usb/gadget/fsl_udc_core.c | 52 +--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ 6 files changed, 65 insertions(+), 35 deletions(-) diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h index 6277baf..9bd5777 100644 --- a/arch/arm/mach-imx/devices/devices-common.h +++ b/arch/arm/mach-imx/devices/devices-common.h @@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan( #include linux/fsl_devices.h struct imx_fsl_usb2_udc_data { + const char *devid; resource_size_t iobase; resource_size_t irq; }; diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c index 37e4439..fb527c7 100644 --- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c @@ -11,35 +11,36 @@ #include ../hardware.h #include devices-common.h -#define imx_fsl_usb2_udc_data_entry_single(soc) \ +#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \ { \ + .devid = _devid,\ .iobase = soc ## _USB_OTG_BASE_ADDR,\ .irq = soc ## _INT_USB_OTG, \ } #ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX25); + imx_fsl_usb2_udc_data_entry_single(MX25, imx-udc-mx25); #endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX27); + imx_fsl_usb2_udc_data_entry_single(MX27, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX31); + imx_fsl_usb2_udc_data_entry_single(MX31, imx-udc-mx31); #endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX35); + imx_fsl_usb2_udc_data_entry_single(MX35, imx-udc-mx35); #endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX51); + imx_fsl_usb2_udc_data_entry_single(MX51, imx-udc-mx51); #endif struct platform_device *__init imx_add_fsl_usb2_udc( @@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(fsl-usb2-udc, -1, + return imx_add_platform_device_dmamask(data-devid, -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 1b0f086..6df45f7 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -18,8 +18,6 @@ #include linux/platform_device.h #include linux/io.h -#include mach/hardware.h - static struct clk *mxc_ahb_clk; static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; @@ -28,7 +26,7 @@ static struct clk *mxc_ipg_clk; #define USBPHYCTRL_OTGBASE_OFFSET 0x608 #define USBPHYCTRL_EVDO(1 23) -int fsl_udc_clk_init(struct platform_device *pdev) +int fsl_udc_clk_init(enum fsl_udc_type devtype, struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata; unsigned long freq; @@ -59,7 +57,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) clk_prepare_enable(mxc_per_clk); /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ - if (!cpu_is_mx51()) { + if (!(devtype == IMX51_UDC)) { freq = clk_get_rate(mxc_per_clk); if (pdata-phy_mode != FSL_USB2_PHY_ULPI (freq 5000 || freq 60001000)) { @@ -79,10 +77,11 @@ eclkrate: return ret; } -void fsl_udc_clk_finalize(struct platform_device *pdev) +void fsl_udc_clk_finalize(enum fsl_udc_type devtype, + struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev
[PATCH v4 2/3] usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
As mach/hardware.h is deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_mxc_udc.c | 27 +-- drivers/usb/gadget/fsl_udc_core.c |4 +++- drivers/usb/gadget/fsl_usb2_udc.h |4 ++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 6df45f7..e505d60 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -23,7 +23,8 @@ static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; /* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8 #define USBPHYCTRL_EVDO(1 23) int fsl_udc_clk_init(enum fsl_udc_type devtype, struct platform_device *pdev) @@ -77,28 +78,42 @@ eclkrate: return ret; } -void fsl_udc_clk_finalize(enum fsl_udc_type devtype, +int fsl_udc_clk_finalize(enum fsl_udc_type devtype, struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; + int ret = 0; + if (devtype == IMX35_UDC) { unsigned int v; + struct resource *res = platform_get_resource + (pdev, IORESOURCE_MEM, 0); + void __iomem *phy_regs = ioremap(res-start + + MX35_USBPHYCTRL_OFFSET, 512); + if (!phy_regs) { + dev_err(pdev-dev, ioremap for phy address fails\n); + ret = -EINVAL; + goto ioremap_err; + } /* workaround ENGcm09152 for i.MX35 */ if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET); writel(v | USBPHYCTRL_EVDO, - MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + phy_regs + USBPHYCTRL_OTGBASE_OFFSET); } + + iounmap(phy_regs); } +ioremap_err: /* ULPI transceivers don't need usbpll */ if (pdata-phy_mode == FSL_USB2_PHY_ULPI) { clk_disable_unprepare(mxc_per_clk); mxc_per_clk = NULL; } + + return ret; } void fsl_udc_clk_release(void) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index c32119b..4391d49 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -2544,7 +2544,9 @@ static int __init fsl_udc_probe(struct platform_device *pdev) dr_controller_setup(udc_controller); } - fsl_udc_clk_finalize(udc_controller-devtype, pdev); + ret = fsl_udc_clk_finalize(udc_controller-devtype, pdev); + if (ret) + goto err_free_irq; /* Setup gadget structure */ udc_controller-gadget.ops = fsl_gadget_ops; diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index bc1f6d0..7ead5f7 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h @@ -594,7 +594,7 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep) struct platform_device; #ifdef CONFIG_ARCH_MXC int fsl_udc_clk_init(enum fsl_udc_type devtype, struct platform_device *pdev); -void fsl_udc_clk_finalize(enum fsl_udc_type devtype, +int fsl_udc_clk_finalize(enum fsl_udc_type devtype, struct platform_device *pdev); void fsl_udc_clk_release(void); #else @@ -603,7 +603,7 @@ static inline int fsl_udc_clk_init(enum fsl_udc_type devtype, { return 0; } -static inline void fsl_udc_clk_finalize(enum fsl_udc_type devtype, +static inline int fsl_udc_clk_finalize(enum fsl_udc_type devtype, struct platform_device *pdev) { } -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 3/3] ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
As we use platform_device_id for fsl-usb2-udc driver, it needs to change clk connection-id, or the related devm_clk_get will be failed. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/clk-imx25.c |6 +++--- arch/arm/mach-imx/clk-imx27.c |6 +++--- arch/arm/mach-imx/clk-imx31.c |6 +++--- arch/arm/mach-imx/clk-imx35.c |6 +++--- arch/arm/mach-imx/clk-imx51-imx53.c |6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..67e353d 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx25); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx25); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx25); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..ef66eaf 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx31); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx31); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx31); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..69fe9c8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx35); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx35); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx35); clk_register_clkdev(clk[wdog_gate], NULL, imx2-wdt.0); clk_register_clkdev(clk[nfc_div], NULL, imx25-nand.0); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index 579023f..fb7cb84 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c @@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, clk_register_clkdev(clk[usboh3_per_gate], per, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ipg, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usboh3_per_gate], per, fsl-usb2-udc
Re: [PATCH v3 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
On Mon, Jan 14, 2013 at 07:57:24PM +0200, Felipe Balbi wrote: On Mon, Jan 14, 2013 at 06:54:22PM +0100, Marc Kleine-Budde wrote: On 01/14/2013 06:40 PM, Felipe Balbi wrote: Hi, On Mon, Jan 14, 2013 at 08:56:33PM +0800, Peter Chen wrote: snip Usually there isn't any Changelog between IP cores used in the different fsl processors (at least available outside of fsl), that makes it quite difficult to say if something found on one imx is really the same as on the other one. And they (usually) don't provide any versioning information in a register or the documentation. just my 2¢ $SUBJECT is trying to differentiate a single feature (or maybe two) to replace cpu_is_xxx(), then expose that on driver_data without creating one enum value for each release from fsl. Felipe, every one or two SoCs may have their special operations for integrate PHY interface, clk operation, or workaround for IC limitation. the particular PHY and clk used should be hidden by phy layer and clk API respectively. Workarounds, fair enough, we need to handle them; but ideally those should be based on runtime revision detection, not some hackery using driver_data. If this is actually possible, I'd love to do this. But IP vendor don't include a version register in their cores. :( then fair enough, driver_data or platform_data is the way to go, still my point (a) below is valid. I will send v5 patch with your suggestion. -- balbi -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v5 0/3] Fix the Build error for fsl_mxc_udc.c
Changes for v5: - Using strcmp to get specific SoC - Delete one cpu_is_mx35() as it has already pdata runtime check Changes for v4: - Using pdev's struct resource to do ioremap - Add ioremap return value check Changes for v3: - Split the one big patch into three patches Changes for v2: - Add const for fsl_udc_devtype - Do ioremap for phy address at fsl-mxc-udc Peter Chen (3): usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap ARM: i.MX clock: Change the connection-id for fsl-usb2-udc arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 --- drivers/usb/gadget/fsl_mxc_udc.c | 40 -- drivers/usb/gadget/fsl_udc_core.c | 46 + drivers/usb/gadget/fsl_usb2_udc.h |5 +- 10 files changed, 82 insertions(+), 55 deletions(-) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v5 1/3] usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
As mach/hardware.h is deleted, we need to use platform_device_id to differentiate SoCs. Besides, one cpu_is_mx35 is useless as it has already used pdata to differentiate runtime Meanwhile we update the platform code accordingly. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 --- drivers/usb/gadget/fsl_mxc_udc.c | 24 +--- drivers/usb/gadget/fsl_udc_core.c | 42 + 4 files changed, 45 insertions(+), 37 deletions(-) diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h index 6277baf..9bd5777 100644 --- a/arch/arm/mach-imx/devices/devices-common.h +++ b/arch/arm/mach-imx/devices/devices-common.h @@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan( #include linux/fsl_devices.h struct imx_fsl_usb2_udc_data { + const char *devid; resource_size_t iobase; resource_size_t irq; }; diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c index 37e4439..fb527c7 100644 --- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c @@ -11,35 +11,36 @@ #include ../hardware.h #include devices-common.h -#define imx_fsl_usb2_udc_data_entry_single(soc) \ +#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \ { \ + .devid = _devid,\ .iobase = soc ## _USB_OTG_BASE_ADDR,\ .irq = soc ## _INT_USB_OTG, \ } #ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX25); + imx_fsl_usb2_udc_data_entry_single(MX25, imx-udc-mx25); #endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX27); + imx_fsl_usb2_udc_data_entry_single(MX27, imx-udc-mx27); #endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX31); + imx_fsl_usb2_udc_data_entry_single(MX31, imx-udc-mx31); #endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX35); + imx_fsl_usb2_udc_data_entry_single(MX35, imx-udc-mx35); #endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX51); + imx_fsl_usb2_udc_data_entry_single(MX51, imx-udc-mx51); #endif struct platform_device *__init imx_add_fsl_usb2_udc( @@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(fsl-usb2-udc, -1, + return imx_add_platform_device_dmamask(data-devid, -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 1b0f086..1176bd8 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -18,8 +18,6 @@ #include linux/platform_device.h #include linux/io.h -#include mach/hardware.h - static struct clk *mxc_ahb_clk; static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; @@ -59,7 +57,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) clk_prepare_enable(mxc_per_clk); /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ - if (!cpu_is_mx51()) { + if (strcmp(pdev-id_entry-name, imx-udc-mx51)) { freq = clk_get_rate(mxc_per_clk); if (pdata-phy_mode != FSL_USB2_PHY_ULPI (freq 5000 || freq 60001000)) { @@ -82,17 +80,15 @@ eclkrate: void fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; - if (cpu_is_mx35()) { - unsigned int v; - - /* workaround ENGcm09152 for i.MX35 */ - if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); - writel(v | USBPHYCTRL_EVDO, - MX35_IO_ADDRESS(MX35_USB_BASE_ADDR
[PATCH v5 2/3] usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
As mach/hardware.h is deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_mxc_udc.c | 30 +++--- drivers/usb/gadget/fsl_udc_core.c |4 +++- drivers/usb/gadget/fsl_usb2_udc.h |5 +++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 1176bd8..bb65c46 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -23,7 +23,8 @@ static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; /* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8 #define USBPHYCTRL_EVDO(1 23) int fsl_udc_clk_init(struct platform_device *pdev) @@ -77,25 +78,40 @@ eclkrate: return ret; } -void fsl_udc_clk_finalize(struct platform_device *pdev) +int fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; - unsigned int v; + int ret = 0; /* workaround ENGcm09152 for i.MX35 */ if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + unsigned int v; + struct resource *res = platform_get_resource + (pdev, IORESOURCE_MEM, 0); + void __iomem *phy_regs = ioremap(res-start + + MX35_USBPHYCTRL_OFFSET, 512); + if (!phy_regs) { + dev_err(pdev-dev, ioremap for phy address fails\n); + ret = -EINVAL; + goto ioremap_err; + } + + v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET); writel(v | USBPHYCTRL_EVDO, - MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); + phy_regs + USBPHYCTRL_OTGBASE_OFFSET); + + iounmap(phy_regs); } + +ioremap_err: /* ULPI transceivers don't need usbpll */ if (pdata-phy_mode == FSL_USB2_PHY_ULPI) { clk_disable_unprepare(mxc_per_clk); mxc_per_clk = NULL; } + + return ret; } void fsl_udc_clk_release(void) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index c971e84..347b1ed 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -2543,7 +2543,9 @@ static int __init fsl_udc_probe(struct platform_device *pdev) dr_controller_setup(udc_controller); } - fsl_udc_clk_finalize(pdev); + ret = fsl_udc_clk_finalize(pdev); + if (ret) + goto err_free_irq; /* Setup gadget structure */ udc_controller-gadget.ops = fsl_gadget_ops; diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index f61a967..c6703bb 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h @@ -592,15 +592,16 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep) struct platform_device; #ifdef CONFIG_ARCH_MXC int fsl_udc_clk_init(struct platform_device *pdev); -void fsl_udc_clk_finalize(struct platform_device *pdev); +int fsl_udc_clk_finalize(struct platform_device *pdev); void fsl_udc_clk_release(void); #else static inline int fsl_udc_clk_init(struct platform_device *pdev) { return 0; } -static inline void fsl_udc_clk_finalize(struct platform_device *pdev) +static inline int fsl_udc_clk_finalize(struct platform_device *pdev) { + return 0; } static inline void fsl_udc_clk_release(void) { -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v5 3/3] ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
As we use platform_device_id for fsl-usb2-udc driver, it needs to change clk connection-id, or the related devm_clk_get will be failed. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/clk-imx25.c |6 +++--- arch/arm/mach-imx/clk-imx27.c |6 +++--- arch/arm/mach-imx/clk-imx31.c |6 +++--- arch/arm/mach-imx/clk-imx35.c |6 +++--- arch/arm/mach-imx/clk-imx51-imx53.c |6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..67e353d 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx25); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx25); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx25); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..ef66eaf 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx31); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx31); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx31); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..69fe9c8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx35); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx35); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx35); clk_register_clkdev(clk[wdog_gate], NULL, imx2-wdt.0); clk_register_clkdev(clk[nfc_div], NULL, imx25-nand.0); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index 579023f..fb7cb84 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c @@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, clk_register_clkdev(clk[usboh3_per_gate], per, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ipg, mxc-ehci.2); clk_register_clkdev(clk[usboh3_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usboh3_per_gate], per, fsl-usb2-udc
Re: [PATCH 1/1] usb: fsl-mxc-udc: fix build error due to mach/hardware.h
On Fri, Jan 11, 2013 at 02:50:59PM +0200, Felipe Balbi wrote: Hi, On Fri, Jan 11, 2013 at 05:56:28PM +0800, Peter Chen wrote: It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the SoC type, and updates the platform code accordingly. Compile ok at imx_v6_v7_defconfig with CONFIG_USB_FSL_USB2 enable. Tested at mx51 bbg board, it works ok after enable phy clock (Need another patch to fix this problem) - +static struct platform_device_id fsl_udc_devtype[] = { should be const OK. + { + .name = imx-udc-mx25, + .driver_data = IMX25_UDC, + }, { + .name = imx-udc-mx27, + .driver_data = IMX27_UDC, + }, { + .name = imx-udc-mx31, + .driver_data = IMX31_UDC, + }, { + .name = imx-udc-mx35, + .driver_data = IMX35_UDC, + }, { + .name = imx-udc-mx51, + .driver_data = IMX51_UDC, + } +}; +MODULE_DEVICE_TABLE(platform, fsl_udc_devtype); static struct platform_driver udc_driver = { - .remove = __exit_p(fsl_udc_remove), + .remove = __exit_p(fsl_udc_remove), + /* Just for FSL i.mx SoC currently */ + .id_table = fsl_udc_devtype, /* these suspend and resume are not usb suspend and resume */ - .suspend = fsl_udc_suspend, - .resume = fsl_udc_resume, - .driver = { - .name = (char *)driver_name, - .owner = THIS_MODULE, - /* udc suspend/resume called from OTG driver */ - .suspend = fsl_udc_otg_suspend, - .resume = fsl_udc_otg_resume, + .suspend= fsl_udc_suspend, + .resume = fsl_udc_resume, + .driver = { + .name = (char *)driver_name, + .owner = THIS_MODULE, + /* udc suspend/resume called from OTG driver */ + .suspend = fsl_udc_otg_suspend, + .resume = fsl_udc_otg_resume, }, }; diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index f61a967..bc1f6d0 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h @@ -505,6 +505,8 @@ struct fsl_udc { u32 ep0_dir;/* Endpoint zero direction: can be USB_DIR_IN or USB_DIR_OUT */ u8 device_address; /* Device USB address */ + /* devtype for kinds of SoC, only i.mx uses it now */ + enum fsl_udc_type devtype; to me this looks wrong as it will grow forever. Are you sure you don't have a way to detect the revision in runtime ? BTW, it looks to me that, in order to remove cpu_is_*() from that driver, all you have to do is: diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 1b0f086..f06102d 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c @@ -18,8 +18,6 @@ #include linux/platform_device.h #include linux/io.h -#include mach/hardware.h - static struct clk *mxc_ahb_clk; static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; @@ -59,14 +57,12 @@ int fsl_udc_clk_init(struct platform_device *pdev) clk_prepare_enable(mxc_per_clk); /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ - if (!cpu_is_mx51()) { - freq = clk_get_rate(mxc_per_clk); - if (pdata-phy_mode != FSL_USB2_PHY_ULPI - (freq 5000 || freq 60001000)) { - dev_err(pdev-dev, USB_CLK=%lu, should be 60MHz\n, freq); - ret = -EINVAL; - goto eclkrate; - } + freq = clk_get_rate(mxc_per_clk); + if (pdata-phy_mode != FSL_USB2_PHY_ULPI + (freq 5000 || freq 60001000)) { + dev_err(pdev-dev, USB_CLK=%lu, should be 60MHz\n, freq); + ret = -EINVAL; + goto eclkrate; } For mx51, the otg port, the pdata-phy_mode is FSL_USB2_PHY_UTMI_WIDE, the freq of per_clk is 16625. So, your patch does not work. return 0; @@ -82,17 +78,15 @@ eclkrate: void fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev-dev.platform_data; - if (cpu_is_mx35()) { - unsigned int v; + unsigned int v; - /* workaround ENGcm09152 for i.MX35 */ - if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + + /* workaround ENGcm09152 for i.MX35 */ + if (pdata-workaround FLS_USB2_WORKAROUND_ENGCM09152) { + v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + USBPHYCTRL_OTGBASE_OFFSET)); - writel(v | USBPHYCTRL_EVDO, + writel(v | USBPHYCTRL_EVDO
[PATCH v2 1/1] usb: fsl-mxc-udc: fix build error due to mach/hardware.h
It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the SoC type, and updates the platform code accordingly. Compile ok at imx_v6_v7_defconfig with CONFIG_USB_FSL_USB2 enable. Tested at mx51 bbg board, it works ok after enable phy clock (Need another patch to fix this problem) Signed-off-by: Peter Chen peter.c...@freescale.com --- Changes for v2: - Add const for fsl_udc_devtype - Do ioremap for phy address at fsl-mxc-udc arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 23 + drivers/usb/gadget/fsl_udc_core.c | 52 +--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ 11 files changed, 87 insertions(+), 55 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..67e353d 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx25); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx25); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx25); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..ef66eaf 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx31); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx31); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx31); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..69fe9c8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx35); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx35); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx35); clk_register_clkdev(clk
[PATCH 1/1] usb: fsl-mxc-udc: fix build error due to mach/hardware.h
It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the SoC type, and updates the platform code accordingly. Compile ok at imx_v6_v7_defconfig with CONFIG_USB_FSL_USB2 enable. Tested at mx51 bbg board, it works ok after enable phy clock (Need another patch to fix this problem) Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 17 +++ drivers/usb/gadget/fsl_udc_core.c | 52 +--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ 11 files changed, 82 insertions(+), 54 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..67e353d 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx25); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx25); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx25); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..ef66eaf 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx31); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx31); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx31); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..69fe9c8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx35); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx35); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx35); clk_register_clkdev(clk[wdog_gate], NULL, imx2-wdt.0); clk_register_clkdev(clk[nfc_div], NULL, imx25-nand.0
Re: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3
On Thu, Jan 10, 2013 at 06:30:06AM -0800, Greg KH wrote: On Thu, Jan 10, 2013 at 12:08:35PM +0200, Felipe Balbi wrote: Hi, Some recent patch has caused fsl_mxc_udc.c driver to fail compilation because it can't find mach/hardware.h anymore. I would like this to be fixed still during this -rc cycle. Me too, who's sending a patch? :) Let me have a look, and try to send a patch as soon as possible -- 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 -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] usb: Fix build error due to dma_mask is not at pdev_archdata at ARM
On Thu, Feb 16, 2012 at 9:41 AM, Peter Chen peter.c...@freescale.com wrote: When build i.mx platform with imx_v6_v7_defconfig, and after adding USB Gadget support, it has below build error: CC drivers/usb/host/fsl-mph-dr-of.o drivers/usb/host/fsl-mph-dr-of.c: In function 'fsl_usb2_device_register': drivers/usb/host/fsl-mph-dr-of.c:97: error: 'struct pdev_archdata' has no member named 'dma_mask' It has discussed at: http://www.spinics.net/lists/linux-usb/msg57302.html For PowerPC, there is dma_mask at struct pdev_archdata, but there is no dma_mask at struct pdev_archdata for ARM. The pdev_archdata is related to specific platform, it should NOT be accessed by cross platform drivers, like USB. The code for pdev_archdata should be useless, as for PowerPC, it has already gotten the value for pdev-dev.dma_mask at function arch_setup_pdev_archdata of arch/powerpc/kernel/setup-common.c. Tested-by: Ramneek Mehresh ramneek.mehr...@freescale.com Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/host/fsl-mph-dr-of.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 7916e56..ab333ac 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c @@ -94,7 +94,6 @@ struct platform_device * __devinit fsl_usb2_device_register( pdev-dev.parent = ofdev-dev; pdev-dev.coherent_dma_mask = ofdev-dev.coherent_dma_mask; - pdev-dev.dma_mask = pdev-archdata.dma_mask; *pdev-dev.dma_mask = *ofdev-dev.dma_mask; retval = platform_device_add_data(pdev, pdata, sizeof(*pdata)); Hi Leo, can your guys give me an ACK for it? Then, Alan can apply it. Ramneek has already tested it, and confirmed it did not break host function at his platform. -- 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 -- BR, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] usb: Fix build error due to dma_mask is not at pdev_archdata at ARM
When build i.mx platform with imx_v6_v7_defconfig, and after adding USB Gadget support, it has below build error: CC drivers/usb/host/fsl-mph-dr-of.o drivers/usb/host/fsl-mph-dr-of.c: In function 'fsl_usb2_device_register': drivers/usb/host/fsl-mph-dr-of.c:97: error: 'struct pdev_archdata' has no member named 'dma_mask' It has discussed at: http://www.spinics.net/lists/linux-usb/msg57302.html For PowerPC, there is dma_mask at struct pdev_archdata, but there is no dma_mask at struct pdev_archdata for ARM. The pdev_archdata is related to specific platform, it should NOT be accessed by cross platform drivers, like USB. The code for pdev_archdata should be useless, as for PowerPC, it has already gotten the value for pdev-dev.dma_mask at function arch_setup_pdev_archdata of arch/powerpc/kernel/setup-common.c. Tested-by: Ramneek Mehresh ramneek.mehr...@freescale.com Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/host/fsl-mph-dr-of.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 7916e56..ab333ac 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c @@ -94,7 +94,6 @@ struct platform_device * __devinit fsl_usb2_device_register( pdev-dev.parent = ofdev-dev; pdev-dev.coherent_dma_mask = ofdev-dev.coherent_dma_mask; - pdev-dev.dma_mask = pdev-archdata.dma_mask; *pdev-dev.dma_mask = *ofdev-dev.dma_mask; retval = platform_device_add_data(pdev, pdata, sizeof(*pdata)); -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC] usb: Fix build error due to dma_mask is not at pdev_archdata at ARM
When build i.mx platform with imx_v6_v7_defconfig, and after adding USB Gadget support, it has below build error: CC drivers/usb/host/fsl-mph-dr-of.o drivers/usb/host/fsl-mph-dr-of.c: In function 'fsl_usb2_device_register': drivers/usb/host/fsl-mph-dr-of.c:97: error: 'struct pdev_archdata' has no member named 'dma_mask' It has discussed at: http://www.spinics.net/lists/linux-usb/msg57302.html For PowerPC, there is dma_mask at struct pdev_archdata, but there is no dma_mask at struct pdev_archdata for ARM. The pdev_archdata is related to specific platform, it should NOT be accessed by cross platform drivers, like USB. The code for pdev_archdata should be useless, as for PowerPC, it has already gotten the value for pdev-dev.dma_mask at function arch_setup_pdev_archdata of arch/powerpc/kernel/setup-common.c. Anyone who has PowerPC hardware with USB host enabled, and uses this code can help me a test? Thank you Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/host/fsl-mph-dr-of.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 7916e56..ab333ac 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c @@ -94,7 +94,6 @@ struct platform_device * __devinit fsl_usb2_device_register( pdev-dev.parent = ofdev-dev; pdev-dev.coherent_dma_mask = ofdev-dev.coherent_dma_mask; - pdev-dev.dma_mask = pdev-archdata.dma_mask; *pdev-dev.dma_mask = *ofdev-dev.dma_mask; retval = platform_device_add_data(pdev, pdata, sizeof(*pdata)); -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC] usb: Fix build error due to dma_mask is not at pdev_archdata at ARM
When build i.mx platform with imx_v6_v7_defconfig, and after adding USB Gadget support, it has below build error: CC drivers/usb/host/fsl-mph-dr-of.o drivers/usb/host/fsl-mph-dr-of.c: In function 'fsl_usb2_device_register': drivers/usb/host/fsl-mph-dr-of.c:97: error: 'struct pdev_archdata' has no member named 'dma_mask' It has discussed at: http://www.spinics.net/lists/linux-usb/msg57302.html For PowerPC, there is dma_mask at struct pdev_archdata, but there is no dma_mask at struct pdev_archdata for ARM. The pdev_archdata is related to specific platform, it should NOT be accessed by cross platform drivers, like USB. The code for pdev_archdata should be useless, as for PowerPC, it has already gotten the value for pdev-dev.dma_mask at function arch_setup_pdev_archdata of arch/powerpc/kernel/setup-common.c. Anyone who has PowerPC hardware with USB host enabled, and uses this code can help me a test? Thank you Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/host/fsl-mph-dr-of.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 7916e56..ab333ac 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c @@ -94,7 +94,6 @@ struct platform_device * __devinit fsl_usb2_device_register( pdev-dev.parent = ofdev-dev; pdev-dev.coherent_dma_mask = ofdev-dev.coherent_dma_mask; - pdev-dev.dma_mask = pdev-archdata.dma_mask; *pdev-dev.dma_mask = *ofdev-dev.dma_mask; retval = platform_device_add_data(pdev, pdata, sizeof(*pdata)); -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Driver(s) for Synopsys' DesignWare USB OTG
On Sun, Jan 08, 2012 at 04:56:49PM +0400, Nikolai Zhubr wrote: Hello Piter, 08.01.2012 7:12, you wrote: 2012/1/8 Nikolai Zhubrn-a-zh...@yandex.ru: Please see: http://marc.info/?l=linux-usbm=129906859817430w=2 Ah, thanks. So sadly uncoordinated work in this area is quite common. However, in case of Synopsys the situation is even more disappointing because initially it _was_ a single driver! What probably lacked was some shared repository and proper communication between developers to stay in sync. Maybe there were also licensing issues at some point, though currently file headers contain rather reasonable (imho) permissive license from Synopsys. I am not sure we can combine all Synopsys USB drivers to single file, but we Synopsys driver which I examine consists of 16 files (each of 2 versions), 200k lines total. I've already perpared some few smaller files for version merging. So probably it is doable, but quite a lot of work, therefore I wouldn't like it to be wasted. I mean one file is just a common udc driver for all Synopsys, not all usb file. For ehci, I think it will be easier to use single file as well as some specific SoC's quirks if needed. For udc, as there is no standard spec for how usb device should be designed, maybe different Synopsys IPs have a little different for work flow. For otg, it should be not difficult after we split PHY's operation from the otg, as common otg operation is the same. can try combine similar IP versions to one file, this work may need all Synopsys USB IP driver maintainer work together. Exactly. This is why I'm now trying to find all relevant people to begin with. I know someone(@Pengutronix and @linux.intel.com) is doing that. I think first we should find which driver file at current code base is most capable and compatible. I would like to help it, and verify it at Freescale i.MX SoCs. Thank you. Nikolai. Please CC me, I'm not subscribed to the lists. Thank you. Nikolai. -- 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 -- 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 -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Driver(s) for Synopsys' DesignWare USB OTG
2012/1/8 Nikolai Zhubr n-a-zh...@yandex.ru: Hello developers, I'm trying to find/combine/fix a driver for Synopsys' DesignWare USB controller. This thing is USB 2.0 host/slave/otg capable and is used in various SoCs including Amlogic 8726M, Ralink RT305x, and probably more. There is some code floating around, partly usable, but all I could see for now is really not perfect. I also saw commit logs on linuxppc-dev, but failed to find out what repository they are related to. I'd like to know if someone is currently developing/testing/maintaining the driver or is planning to do so in the near future (in a FOSS-friendly manner - making development results public immediately and with eventual goal of inclusion into mainline) in order to avoid duplicate/uncoordinated work and waste of effort. I'm currently examining 2 versions (That is, 2 sets of files): 1. From android kernel for 8726m-based tablets (like the one I own). Usable to some extent, but there are issues (e.g. it looks like certain packets get corrupted, reproducibly, relevant dumps are available) 2. From openwrt kernel for RT305x-based routers. The code looks a bit more tidy, but not quite well updated (slave-mode parts are unused in openwrt and they can not even be compiled for modern kernels without certain patching; have not tried host-mode on the hardware yet) Quite obviously both versions originated from the same code initially, but subsequently were apparently tested/corrected/updated by separate teams. It is not quite clear if all bugfixes were cross-applied carefully (if at all). I was initially hoping that compare and bisect will just do the job, but the driver is quite huge... and some files have diverged substantially in the 2 versions, so at the moment I'm a bit fed up and will probably resume a bit later. Meanwhile, I'd be happy to discuss the subject with whoever interested in order to plan my further steps. Please see: http://marc.info/?l=linux-usbm=129906859817430w=2 I am not sure we can combine all Synopsys USB drivers to single file, but we can try combine similar IP versions to one file, this work may need all Synopsys USB IP driver maintainer work together. Thank you. Nikolai. -- 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 -- BR, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2] usb/fsl_udc: fix dequeuing a request in progress
On Wed, Nov 23, 2011 at 08:12:56PM +0800, Li Yang wrote: The original implementation of dequeuing a request in progress is not correct. Change to use a correct process and also clean up the related functions a little bit. Signed-off-by: Li Yang le...@freescale.com Cc: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_udc_core.c | 68 +--- drivers/usb/gadget/fsl_usb2_udc.h | 10 + 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index b2c44e1..cc704dc 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -696,12 +696,31 @@ static void fsl_free_request(struct usb_ep *_ep, struct usb_request *_req) kfree(req); } -/*-*/ +/* Actually add a dTD chain to an empty dQH and let go */ +static void fsl_prime_ep(struct fsl_ep *ep, struct ep_td_struct *td) +{ + struct ep_queue_head *qh = get_qh_by_ep(ep); + + /* Write dQH next pointer and terminate bit to 0 */ + qh-next_dtd_ptr = cpu_to_hc32(td-td_dma + EP_QUEUE_HEAD_NEXT_POINTER_MASK); + + /* Clear active and halt bit */ + qh-size_ioc_int_sts = cpu_to_hc32(~(EP_QUEUE_HEAD_STATUS_ACTIVE + | EP_QUEUE_HEAD_STATUS_HALT)); + + /* Ensure that updates to the QH will occur before priming. */ + wmb(); + + /* Prime endpoint by writing correct bit to ENDPTPRIME */ + fsl_writel(ep_is_in(ep) ? (1 (ep_index(ep) + 16)) + : (1 (ep_index(ep))), dr_regs-endpointprime); +} + +/* Add dTD chain to the dQH of an EP */ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) { - int i = ep_index(ep) * 2 + ep_is_in(ep); u32 temp, bitmask, tmp_stat; - struct ep_queue_head *dQH = ep-udc-ep_qh[i]; /* VDBG(QH addr Register 0x%8x, dr_regs-endpointlistaddr); VDBG(ep_qh[%d] addr is 0x%8x, i, (u32)(ep-udc-ep_qh[i])); */ @@ -719,7 +738,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) cpu_to_hc32(req-head-td_dma DTD_ADDR_MASK); /* Read prime bit, if 1 goto done */ if (fsl_readl(dr_regs-endpointprime) bitmask) - goto out; + return; do { /* Set ATDTW bit in USBCMD */ @@ -736,28 +755,10 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) fsl_writel(temp ~USB_CMD_ATDTW, dr_regs-usbcmd); if (tmp_stat) - goto out; + return; } - /* Write dQH next pointer and terminate bit to 0 */ - temp = req-head-td_dma EP_QUEUE_HEAD_NEXT_POINTER_MASK; - dQH-next_dtd_ptr = cpu_to_hc32(temp); - - /* Clear active and halt bit */ - temp = cpu_to_hc32(~(EP_QUEUE_HEAD_STATUS_ACTIVE - | EP_QUEUE_HEAD_STATUS_HALT)); - dQH-size_ioc_int_sts = temp; - - /* Ensure that updates to the QH will occur before priming. */ - wmb(); - - /* Prime endpoint by writing 1 to ENDPTPRIME */ - temp = ep_is_in(ep) - ? (1 (ep_index(ep) + 16)) - : (1 (ep_index(ep))); - fsl_writel(temp, dr_regs-endpointprime); -out: - return; + fsl_prime_ep(ep, req-head); } /* Fill in the dTD structure @@ -973,25 +974,20 @@ static int fsl_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) /* The request isn't the last request in this ep queue */ if (req-queue.next != ep-queue) { - struct ep_queue_head *qh; struct fsl_req *next_req; - qh = ep-qh; next_req = list_entry(req-queue.next, struct fsl_req, queue); - /* Point the QH to the first TD of next request */ - fsl_writel((u32) next_req-head, qh-curr_dtd_ptr); + /* prime with dTD of next request */ + fsl_prime_ep(ep, next_req-head); } - - /* The request hasn't been processed, patch up the TD chain */ + /* The request hasn't been processed, patch up the TD chain */ } else { struct fsl_req *prev_req; prev_req = list_entry(req-queue.prev, struct fsl_req, queue); - fsl_writel(fsl_readl(req-tail-next_td_ptr), - prev_req-tail-next_td_ptr); - + prev_req-tail-next_td_ptr = req-tail-next_td_ptr; } done(ep, req, -ECONNRESET); @@ -1068,7 +1064,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep) struct fsl_udc *udc; int size = 0; u32 bitmask; - struct
Re: [PATCH] usb/fsl_udc: fix dequeuing a request in progress
it at i.mx51 bbg board using 3.2.0-rc2+. -- 1.5.4.3 -- 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 -- Best Regards, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] usb/fsl_udc: fix dequeuing a request in progress
It seems to can't get the correct qh pointer, you may still need to use below code to get it int i = ep_index(ep) * 2 + ep_is_in(ep); struct ep_queue_head *dQH = ep-udc-ep_qh[i]; Thanks for trying. It will be much easier if we can dereference QH from the ep structure. It is really strange that the ep-qh pointer is not working somehow. Seems only ep0-out's qh pointer is assigned at ep structure. At probe: /* setup udc-eps[] for ep0 */ struct_ep_setup(udc_controller, 0, ep0, 0); We have initialized it in struct_ep_setup(): ep-qh = udc-ep_qh[index]; Can you do me a favor on investigating why it's failing? Thanks, Leo -- 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 -- BR, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] usb/fsl_udc: fix dequeuing a request in progress
On Tue, Nov 22, 2011 at 7:48 PM, Peter Chen hzpeterc...@gmail.com wrote: It seems to can't get the correct qh pointer, you may still need to use below code to get it int i = ep_index(ep) * 2 + ep_is_in(ep); struct ep_queue_head *dQH = ep-udc-ep_qh[i]; Thanks for trying. It will be much easier if we can dereference QH from the ep structure. It is really strange that the ep-qh pointer is not working somehow. Seems only ep0-out's qh pointer is assigned at ep structure. At probe: /* setup udc-eps[] for ep0 */ struct_ep_setup(udc_controller, 0, ep0, 0); We have initialized it in struct_ep_setup(): ep-qh = udc-ep_qh[index]; Can you do me a favor on investigating why it's failing? Leo, I have debugged this issue at my board just now, the reason of failure is we only have one ep struct for ep0, so when talking about ep0, it always pointers to udc-ep[0]. So even we initialize the current qh address for ep0in at probe, it still can't get the ep0in's qh address through ep structure, as ep0 is always udc-ep[0]. Thanks, Leo -- 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 -- BR, Peter Chen -- BR, Peter Chen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] USB: fsl_udc_core: Use () instead of (==) to compare ISO XFER
Some ISO gadgets, like audio, has SYNC attribute as well as USB_ENDPOINT_XFER_ISOC for their bmAttributes at ISO endpoint descriptor. So, it needs to use instead of == to judge if it is ISO XFER. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_udc_core.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index d786ba3..bf40de3 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -877,7 +877,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) VDBG(%s, bad ep, __func__); return -EINVAL; } - if (ep-desc-bmAttributes == USB_ENDPOINT_XFER_ISOC) { + if (ep-desc-bmAttributes USB_ENDPOINT_XFER_ISOC) { if (req-req.length ep-ep.maxpacket) return -EMSGSIZE; } @@ -1032,7 +1032,7 @@ static int fsl_ep_set_halt(struct usb_ep *_ep, int value) goto out; } - if (ep-desc-bmAttributes == USB_ENDPOINT_XFER_ISOC) { + if (ep-desc-bmAttributes USB_ENDPOINT_XFER_ISOC) { status = -EOPNOTSUPP; goto out; } -- 1.6.3.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2] USB: fsl_udc_core: use usb_endpoint_xfer_isoc to judge ISO XFER
Some ISO gadgets, like audio, has SYNC attribute as well as USB_ENDPOINT_XFER_ISOC for their bmAttributes at ISO endpoint descriptor. So, it needs to use usb_endpoint_xfer_isoc to judge ISO XFER. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/gadget/fsl_udc_core.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index d786ba3..91df255 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -877,7 +877,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) VDBG(%s, bad ep, __func__); return -EINVAL; } - if (ep-desc-bmAttributes == USB_ENDPOINT_XFER_ISOC) { + if (usb_endpoint_xfer_isoc(ep-desc)) { if (req-req.length ep-ep.maxpacket) return -EMSGSIZE; } @@ -1032,7 +1032,7 @@ static int fsl_ep_set_halt(struct usb_ep *_ep, int value) goto out; } - if (ep-desc-bmAttributes == USB_ENDPOINT_XFER_ISOC) { + if (usb_endpoint_xfer_isoc(ep-desc)) { status = -EOPNOTSUPP; goto out; } -- 1.6.3.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev