Re: [PATCH 1/6] usb: host: ehci-exynos: Use devm_ioremap_resource instead of devm_ioremap
Sat, 10 May 2014 15:26:58 +0530 от Vivek Gautam gautam.vi...@samsung.com: Using devm_ioremap_resource() API should actually be preferred over devm_ioremap(), since the former request the mem region first and then gives back the ioremap'ed memory pointer. devm_ioremap_resource() calls request_mem_region(), therby preventing other drivers to make any overlapping call to the same region. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- drivers/usb/host/ehci-exynos.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 7f425ac..bccb6f1 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -135,9 +135,8 @@ skip_phy: hcd-rsrc_start = res-start; hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap(pdev-dev, res-start, hcd-rsrc_len); + hcd-regs = devm_ioremap_resource(pdev-dev, res); if (!hcd-regs) { - dev_err(pdev-dev, Failed to remap I/O memory\n); err = -ENOMEM; goto fail_io; } You should check this as: if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); ... Same in other patches in this series. ---
Re: [PATCH v2 0/6] usb: host: Cleanup for ioremap'ing hcd memory
Sat, 10 May 2014 17:30:04 +0530 от Vivek Gautam gautam.vi...@samsung.com: Based on 'usb-next' branch of Greg's usb tree. devm_ioremap_resource() API is advantageous over devm_ioremap() and should therefore be preferred to request any ioremap'ed address for hcd. Changes from v1: - Changed the way returned pointer is checked for error value as pointed out in the review comment in the mailing list. hcd-rsrc_len field can be removed entirely, since I cannot find any reason how this filed can be used in the drivers now. This is of course should be in an another series. This one looks good. ---
[PATCH] usb: chipidea: core: Add missing module owner field
Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/usb/chipidea/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ca6831c..8c49220 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -680,6 +680,7 @@ static struct platform_driver ci_hdrc_driver = { .remove = ci_hdrc_remove, .driver = { .name = ci_hdrc, + .owner = THIS_MODULE, }, }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: USB OTG support on mx27pdk
Sun, 20 Apr 2014 00:48:28 + от Peter Chen peter.c...@freescale.com: -Original Message- From: Fabio Estevam [mailto:feste...@gmail.com] Sent: Sunday, April 20, 2014 1:10 AM To: Chen Peter-B29397 Cc: Michael Grzeschik; Alexander Shiyan; linux-arm- ker...@lists.infradead.org; linux-usb@vger.kernel.org; Sascha Hauer; chris.ru...@gtsys.com.hk; Guo Shawn-R65073 Subject: Re: USB OTG support on mx27pdk On Sat, Apr 19, 2014 at 4:32 AM, Peter Chen peter.c...@freescale.com wrote: The below patch is intended to fix above issues for all platforms, I have tested it at imx6 platform, if possible, have a test at imx25/imx27 please. I don't see any patch below, but anyway I have managed to fix the issue on mx27 at dts level. https://github.com/hzpeterchen/linux-usb/commit/c1f42ea27ed3f5d988c63da7849d2e6b445b4fbc Your problem is different with sasche's, which hang the system due to no phy clk. The chris's patch should not cause the oops. For me, nothing has changed. The driver works on i.MX27 PCM970 RDK with the patch as well as without it. --- N�r��yb�X��ǧv�^�){.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
Re: USB OTG support on mx27pdk
Wed, 16 Apr 2014 08:32:55 -0300 от Fabio Estevam feste...@gmail.com: On Wed, Apr 16, 2014 at 2:55 AM, Alexander Shiyan shc_w...@mail.ru wrote: ci_hdrc ci_hdrc.0: EHCI Host Controller ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1 ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00 usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb1: Product: EHCI Host Controller usb usb1: Manufacturer: Linux 3.15.0-rc1-next-20140415-dirty ehci_hcd usb usb1: SerialNumber: ci_hdrc.0 hub 1-0:1.0: USB hub found hub 1-0:1.0: 1 port detected Thanks for testing, Alexander. Does your bootloader have USB support? If so, would it be possible to remove the USB support from the bootloader, please? I am wondering if the bootloader is doing some USB related init that the kernel is missing. I can tell immediately without further testing, this will not work without the USB support in the bootoader because we do not have DT support for ULPI. ---
Re: USB OTG support on mx27pdk
Wed, 16 Apr 2014 03:23:54 + от Peter Chen peter.c...@freescale.com: Hi, I am trying to add USBOTG support to mx27pdk with the following dts patch: ... I cced chris who has imx27 hardware. Loading OS arm Linux zImage '/dev/nor0.kernel' using internal devicetree commandline: console=ttymxc0,115200n8 earlyprintk root=/dev/mtdblock3 ro booting kernel with devicetree Uncompressing Linux... done, booting the kernel. Booting Linux on physical CPU 0x0 Linux version 3.15.0-rc1-next-20140415-dirty (s...@shc.zet) (gcc version 4.7.3 (GCC) ) #11 PREEMPT Wed Apr 16 09:40:14 MSK 2014 CPU: ARM926EJ-S [41069264] revision 4 (ARMv5TEJ), cr=00053177 CPU: VIVT data cache, VIVT instruction cache Machine model: Phytec pcm970 bootconsole [earlycon0] enabled Memory policy: Data cache writeback Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512 Kernel command line: console=ttymxc0,115200n8 earlyprintk root=/dev/mtdblock3 ro PID hash table entries: 512 (order: -1, 2048 bytes) Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) Memory: 123364K/131072K available (4601K kernel code, 256K rwdata, 1244K rodata, 170K init, 143K bss, 7708K reserved) Virtual kernel memory layout: vector : 0x - 0x1000 ( 4 kB) fixmap : 0xfff0 - 0xfffe ( 896 kB) vmalloc : 0xc880 - 0xff00 ( 872 MB) lowmem : 0xc000 - 0xc800 ( 128 MB) .text : 0xc0008000 - 0xc05bd8c0 (5847 kB) .init : 0xc05be000 - 0xc05e8970 ( 171 kB) .data : 0xc05ea000 - 0xc062a260 ( 257 kB) .bss : 0xc062a26c - 0xc064e104 ( 144 kB) Preemptible hierarchical RCU implementation. NR_IRQS:16 nr_irqs:16 16 MXC IRQ initialized Switching to timer-based delay loop sched_clock: 32 bits at 14MHz, resolution 67ns, wraps every 290636879804ns CPU identified as i.MX27, silicon rev 2.1 Console: colour dummy device 80x30 Calibrating delay loop (skipped), value calculated using timer frequency.. 29.55 BogoMIPS (lpj=14) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) CPU: Testing write buffer coherency: ok Setting up static identity map for 0xa045f2c8 - 0xa045f328 devtmpfs: initialized pinctrl core: initialized pinctrl subsystem regulator-dummy: no parameters NET: Registered protocol family 16 DMA: preallocated 256 KiB pool for atomic coherent allocations cpuidle: using governor ladder cpuidle: using governor menu imx27-pinctrl 10015000.iomuxc: initialized IMX pinctrl driver 3V3: 3300 mV 5V0: 5000 mV SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb platform 0.usbphy: Driver usb_phy_gen_xceiv requests probe deferral platform 2.usbphy: Driver usb_phy_gen_xceiv requests probe deferral i2c i2c-0: IMX I2C adapter registered i2c i2c-1: IMX I2C adapter registered Linux video capture interface: v2.00 pps_core: LinuxPPS API ver. 1 registered pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giome...@linux.it PTP clock support registered Advanced Linux Sound Architecture Driver Initialized. Switched to clocksource mxc_timer1 NET: Registered protocol family 2 TCP established hash table entries: 1024 (order: 0, 4096 bytes) TCP bind hash table entries: 1024 (order: 0, 4096 bytes) TCP: Hash tables configured (established 1024 bind 1024) TCP: reno registered UDP hash table entries: 256 (order: 0, 4096 bytes) UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) NET: Registered protocol family 1 RPC: Registered named UNIX socket transport module. RPC: Registered udp transport module. RPC: Registered tcp transport module. RPC: Registered tcp NFSv4.1 backchannel transport module. futex hash table entries: 256 (order: -1, 3072 bytes) jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc. msgmni has been set to 240 Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251) io scheduler noop registered (default) imx-weim d8002000.weim: Driver registered. imx-fb 10021000.fb: i.MX Framebuffer driver Console: switching to colour frame buffer device 30x40 Serial: IMX driver 1000a000.serial: ttymxc0 at MMIO 0x1000a000 (irq = 36, base_baud = 923611) is a IMX console [ttymxc0] enabled bootconsole [earlycon0] disabled 1000b000.serial: ttymxc1 at MMIO 0x1000b000 (irq = 35, base_baud = 923611) is a IMX [drm] Initialized drm 1.1.0 20060810 at24 1-0052: 4096 byte 24c32 EEPROM, writable, 32 bytes/write physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x89 Chip ID 0x00891c Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Using buffer write method Using auto-unlock on power-up/resume
Re: [PATCH v3][ 3/9] usb: chipidea: Use standard usb-phy property.
Среда, 12 марта 2014, 11:19 +01:00 от Lothar Waßmann l...@karo-electronics.de: Hi, Denis Carikli wrote: This converts the Chipidea usbmisc driver to use the standard usb-phy property. [...] diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index c00f772..9a74100 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -130,7 +130,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) return ret; } - data-phy = devm_usb_get_phy_by_phandle(pdev-dev, fsl,usbphy, 0); + data-phy = devm_usb_get_phy_by_phandle(pdev-dev, usb-phy, 0); if (IS_ERR(data-phy)) { ret = PTR_ERR(data-phy); goto err_clk; How about accepting the old property too and print a warning, that it is deprecated, rather than breaking all existing DT blobs? And this change should be reflected in the bindings documentation. ---
Re: [PATCH 2/9] ARM: dts: i.MX51: Add a second usbphy.
Понедельник, 10 марта 2014, 5:50 UTC от Peter Chen peter.c...@freescale.com: diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi index e508e6f..917b6ed 100644 --- a/arch/arm/boot/dts/imx51.dtsi +++ b/arch/arm/boot/dts/imx51.dtsi @@ -100,6 +100,13 @@ clocks = clks IMX5_CLK_USB_PHY_GATE; clock-names = main_clk; }; + + usbphy1: usbphy@1 { + compatible = usb-nop-xceiv; + reg = 1; + clocks = clks IMX5_CLK_USB_PHY_GATE; + clock-names = main_clk; + }; Is this the ulpi phy for host1 controller? Why the clock is the same with utmi phy clock for otg controller. As far as I know, for i.MX51 this is as it should be. Are you sure? From clock file, they are different ccm clock gate. clk-imx51-imx53.c ? I think you confuse with i.MX50/53. ---
Re: [PATCH 1/9] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs
Воскресенье, 9 марта 2014, 22:21 -03:00 от Fabio Estevam feste...@gmail.com: Hi Denis, On Fri, Mar 7, 2014 at 2:04 PM, Denis Carikli de...@eukrea.com wrote: +static int usbmisc_imx25_init(struct imx_usbmisc_data *data) +{ + void __iomem *reg = NULL; This variable is not used and causes a warning. Please remove it. After applying this patch things go further when I boot with a USB thumb connected to the USB Host1 port: ... (Not sure why it says full-speed device. When I connect the same device to a PC it says high-speed) ... (Then system hangs here). If I boot without the USB thumb connected, then I reach the prompt, however after inserting the USB pen drive into USBH1 there is no detection. Any ideas? Fabio, start with to make work USB port on your board in the bootloader. Then with the previous driver (ehci-mxc). Most likely problem is a wrong (or missing) clock. As I mentioned earlier, DTS has incorrect clock nodes. ---
Re: [PATCH 1/9] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs
Пятница, 7 марта 2014, 18:04 +01:00 от Denis Carikli de...@eukrea.com: Signed-off-by: Denis Carikli de...@eukrea.com --- drivers/usb/chipidea/usbmisc_imx.c | 59 1 file changed, 59 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index cd061ab..d956ad0 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c ... + val = readl(usbmisc-base); + val = ~(MX25_OTG_SIC_MASK | MX25_OTG_PP_BIT); + val |= (MXC_EHCI_INTERFACE_DIFF_UNI MXC_EHCI_INTERFACE_MASK) MX25_OTG_SIC_SHIFT; + val |= (MX25_OTG_PM_BIT | MX25_OTG_OCPOL_BIT); + writel(val, usbmisc-base); At the moment, we only enable/disable interface and manage overcurrent option in the usbmisc driver. Is it worth it to handle type of interface here? --- N�r��yb�X��ǧv�^�){.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
Re: USB Host support for mx25
Hello. I am not familiar with mx25, but can say some hints. Четверг, 6 марта 2014, 7:23 -03:00 от Fabio Estevam feste...@gmail.com: On Thu, Mar 6, 2014 at 1:36 AM, Peter Chen peter.c...@freescale.com wrote: Do you have usbmisc node? usbmisc is not probed or its probe has failed. Thanks, Peter. usbmisc node was 'disabled' at imx25.dtsi. I removed the 'disabled' and now the probe goes a bit further: ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver usbcore: registered new interface driver usb-storage 53ff4400.usb supply vbus not found, using dummy regulator ci_hdrc ci_hdrc.0: doesn't support gadget ci_hdrc ci_hdrc.0: EHCI Host Controller ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1 ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00 hub 1-0:1.0: USB hub found hub 1-0:1.0: 1 port detected usb 1-1: new low-speed USB device number 2 using ci_hdrc usb 1-1: device descriptor read/64, error -71 usb 1-1: device descriptor read/64, error -71 usb 1-1: new low-speed USB device number 3 using ci_hdrc usb 1-1: device descriptor read/64, error -71 usb 1-1: device descriptor read/64, error -71 usb 1-1: new low-speed USB device number 4 using ci_hdrc usb 1-1: device not accepting address 4, error -71 ... usb 1-1: new low-speed USB device number 5 using ci_hdrc usb 1-1: device not accepting address 5, error -71 hub 1-0:1.0: unable to enumerate USB device on port 1 My changes now look like this: diff --git a/arch/arm/boot/dts/imx25-pdk.dts b/arch/arm/boot/dts/imx25-pdk.dts index 7a6d21f..6f17d11 100644 --- a/arch/arm/boot/dts/imx25-pdk.dts +++ b/arch/arm/boot/dts/imx25-pdk.dts @@ -107,3 +107,8 @@ fsl,uart-has-rtscts; status = okay; }; + +usbhost1 { +phy_type = serial; +status = okay; +}; diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi index 32f760e..7fa123b 100644 --- a/arch/arm/boot/dts/imx25.dtsi +++ b/arch/arm/boot/dts/imx25.dtsi @@ -482,13 +482,17 @@ }; usbphy1: usbphy@1 { -compatible = nop-usbphy; -status = disabled; +compatible = usb-nop-xceiv; +clocks = clks 0; Dummy clk? +clock-names = main_clk; +status = okay; }; usbphy2: usbphy@2 { -compatible = nop-usbphy; -status = disabled; +compatible = usb-nop-xceiv; +clocks = clks 0; +clock-names = main_clk; +status = okay; }; usbotg: usb@53ff4000 { @@ -498,6 +502,7 @@ clocks = clks 9, clks 70, clks 8; clock-names = ipg, ahb, per; Why here three clk? Chipidea driver requires only one. fsl,usbmisc = usbmisc 0; +fsl,usbphy = usbphy1; status = disabled; }; @@ -508,6 +513,7 @@ clocks = clks 9, clks 70, clks 8; clock-names = ipg, ahb, per; fsl,usbmisc = usbmisc 1; +fsl,usbphy = usbphy2; status = disabled; }; @@ -517,7 +523,6 @@ clocks = clks 9, clks 70, clks 8; clock-names = ipg, ahb, per; reg = 0x53ff4600 0x00f; -status = disabled; }; dryice@53ffc000 { Let me know if you have some other suggestion. I have added support for i.MX27 recently. You can use this as an example for i.MX25. https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=a2e502c214ae65a3e0871e6216f1bc105524d9ad https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=9089ce520f6fdcb3c921a12d24834197251bd56f ---
Re: [PATCH] usb: chipidea: imx: Use dev_name() for ci_hdrc name to distinguish USBs
Понедельник, 24 февраля 2014, 10:02 +08:00 от Peter Chen peter.c...@freescale.com: On Sat, Feb 22, 2014 at 05:17:58PM +0400, Alexander Shiyan wrote: Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/usb/chipidea/ci_hdrc_imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index c00f772..2e58f8d 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -96,7 +96,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) { struct ci_hdrc_imx_data *data; struct ci_hdrc_platform_data pdata = { - .name = ci_hdrc_imx, + .name = dev_name(pdev-dev), .capoffset = DEF_CAPOFFSET, .flags = CI_HDRC_REQUIRE_TRANSCEIVER | CI_HDRC_DISABLE_STREAMING, -- ... I don't see too much meaningful for this change, and I don't see the meaning of this entry (.name) and no user is using it. Field name is used in the function ci_hdrc_probe() (core.c) for request_irq(). That's what will result: # cat /proc.interrupts ... 71: 0 mxc-avic 55 10024400.usb 72: 0 mxc-avic 56 10024000.usb ---
[PATCH] usb: chipidea: imx: Use dev_name() for ci_hdrc name to distinguish USBs
Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/usb/chipidea/ci_hdrc_imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index c00f772..2e58f8d 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -96,7 +96,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) { struct ci_hdrc_imx_data *data; struct ci_hdrc_platform_data pdata = { - .name = ci_hdrc_imx, + .name = dev_name(pdev-dev), .capoffset = DEF_CAPOFFSET, .flags = CI_HDRC_REQUIRE_TRANSCEIVER | CI_HDRC_DISABLE_STREAMING, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs
Понедельник, 13 января 2014, 22:31 +01:00 от Uwe Kleine-König u.kleine-koe...@pengutronix.de: On Sat, Jan 11, 2014 at 06:01:48PM +0400, Alexander Shiyan wrote: Суббота, 11 января 2014, 13:55 +01:00 от Uwe Kleine-König u.kleine-koe...@pengutronix.de: On Mon, Nov 11, 2013 at 11:09:16AM +0400, Alexander Shiyan wrote: Hello. On Sunday, November 10, 2013 03:18 PM, Alexander Shiyan wrote: This adds i.MX27 and i.MX31 as the next user of the usbmisc driver. Signed-off-by: Alexander Shiyanshc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 42 ++ 1 file changed, 42 insertions(+) ... At this point might be good to patch the imx27.dtsi with the usb defines. ... I have a working configuration for i.MX27 USB, but I prefer to make a few more tests before the addition of definitions in DTS. This will be a next step. Thanks. Any news here? Not ready yet. Are you still working at it? Would you mind sharing more details, like your current tree/patch stack and what works/doesn't work for you? Now my work on this is suspended, but will continue later. I'll send you a personal letter with DT configuration. Ports (both Host OTG) are detected by kernel, but works Host only. OTG not works nor as Host, nor as Device... ---
Re: [PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs
Суббота, 11 января 2014, 13:55 +01:00 от Uwe Kleine-König u.kleine-koe...@pengutronix.de: On Mon, Nov 11, 2013 at 11:09:16AM +0400, Alexander Shiyan wrote: Hello. On Sunday, November 10, 2013 03:18 PM, Alexander Shiyan wrote: This adds i.MX27 and i.MX31 as the next user of the usbmisc driver. Signed-off-by: Alexander Shiyanshc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 42 ++ 1 file changed, 42 insertions(+) ... At this point might be good to patch the imx27.dtsi with the usb defines. ... I have a working configuration for i.MX27 USB, but I prefer to make a few more tests before the addition of definitions in DTS. This will be a next step. Thanks. Any news here? Not ready yet. ---
Re: [PATCH v2 2/2] usb: chipidea: usbmisc: Add support for i.MX51 CPU
Hello. On Tue, Nov 26, 2013 at 07:36:50PM +0400, Alexander Shiyan wrote: This adds i.MX51 as the next user of the usbmisc driver. Functionality is similar to i.MX53, so at this stage simply reuse existing i.MX53 calls. Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 4381c5a6..cd061ab 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -204,6 +204,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .data = imx27_usbmisc_ops, }, { + .compatible = fsl,imx51-usbmisc, + .data = imx53_usbmisc_ops, If it simply uses imx53 ops, why do we need to introduce a new compatible? This has been discussed here: http://www.spinics.net/lists/linux-usb/msg97502.html Additionally, fsl,imx51-usbmisc string already present in imx51.dtsi. Thanks. --- N�r��yb�X��ǧv�^�){.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
[PATCH v2 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs
This adds i.MX27 and i.MX31 as the next user of the usbmisc driver. Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 42 ++ 1 file changed, 42 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 8a1094b..4381c5a6 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -21,6 +21,10 @@ #define MX25_USB_PHY_CTRL_OFFSET 0x08 #define MX25_BM_EXTERNAL_VBUS_DIVIDER BIT(23) +#define MX27_H1_PM_BIT BIT(8) +#define MX27_H2_PM_BIT BIT(16) +#define MX27_OTG_PM_BITBIT(24) + #define MX53_USB_OTG_PHY_CTRL_0_OFFSET 0x08 #define MX53_USB_UH2_CTRL_OFFSET 0x14 #define MX53_USB_UH3_CTRL_OFFSET 0x18 @@ -68,6 +72,36 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data) return 0; } +static int usbmisc_imx27_init(struct imx_usbmisc_data *data) +{ + unsigned long flags; + u32 val; + + switch (data-index) { + case 0: + val = MX27_OTG_PM_BIT; + break; + case 1: + val = MX27_H1_PM_BIT; + break; + case 2: + val = MX27_H2_PM_BIT; + break; + default: + return -EINVAL; + }; + + spin_lock_irqsave(usbmisc-lock, flags); + if (data-disable_oc) + val = readl(usbmisc-base) | val; + else + val = readl(usbmisc-base) ~val; + writel(val, usbmisc-base); + spin_unlock_irqrestore(usbmisc-lock, flags); + + return 0; +} + static int usbmisc_imx53_init(struct imx_usbmisc_data *data) { void __iomem *reg = NULL; @@ -128,6 +162,10 @@ static const struct usbmisc_ops imx25_usbmisc_ops = { .post = usbmisc_imx25_post, }; +static const struct usbmisc_ops imx27_usbmisc_ops = { + .init = usbmisc_imx27_init, +}; + static const struct usbmisc_ops imx53_usbmisc_ops = { .init = usbmisc_imx53_init, }; @@ -162,6 +200,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .data = imx25_usbmisc_ops, }, { + .compatible = fsl,imx27-usbmisc, + .data = imx27_usbmisc_ops, + }, + { .compatible = fsl,imx53-usbmisc, .data = imx53_usbmisc_ops, }, -- 1.8.3.2 -- 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
[PATCH v2 2/2] usb: chipidea: usbmisc: Add support for i.MX51 CPU
This adds i.MX51 as the next user of the usbmisc driver. Functionality is similar to i.MX53, so at this stage simply reuse existing i.MX53 calls. Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 4381c5a6..cd061ab 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -204,6 +204,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .data = imx27_usbmisc_ops, }, { + .compatible = fsl,imx51-usbmisc, + .data = imx53_usbmisc_ops, + }, + { .compatible = fsl,imx53-usbmisc, .data = imx53_usbmisc_ops, }, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] usb: chipidea: usbmisc: Add support for i.MX51 CPU
Hello. Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 40 +- 1 file changed, 22 insertions(+), 18 deletions(-) -static int usbmisc_imx53_init(struct imx_usbmisc_data *data) +static int usbmisc_imx5_init(struct imx_usbmisc_data *data) Can we keep usbmisc_imx53_init named this? There is more to do here on i.MX5 for cases where the bootloader did not already try to set up USB (or did it badly) such as the transceiver reference clock rate and also setting the USB sysclk clock source (internal DPLL or from external transceiver in the external ULPI case) and so on, which is related and needs doing on both, but is different on i.MX51 than i.MX53. This is information sort of best passed in the PHY node that goes along with this, but it's set within the usbmisc block of the chips so the usbmisc driver will have a responsibility to go see if it's an external PHY that is feeding it's clock back into the USB block in this way. I am not sure we (Peter etc.) discussed how best to do this, the code to pull the correct information out always seems kind of misplaced no matter where it goes, but the responsibility for tweaking those registers is most certainly this driver. Essentially the layout of usbmisc-base + 0x10 register (USB_CTRL_1) is different when doing the above, and dependent on a board-specific option for the input clock to the transceiver. We could reduce a little churn, later, when usbmisc_imx could be given related usbphy information and actually do the right thing. I have a patch kinda sitting in the wings to do this.. and two *real* pieces of consumer hardware that need it, and some other kicking, to make USB work in the never-touched-before-Linux case. -static const struct usbmisc_ops imx53_usbmisc_ops = { - .init = usbmisc_imx53_init, +static const struct usbmisc_ops imx5_usbmisc_ops = { + .init = usbmisc_imx5_init, }; And keep imx53_usbmisc_ops named this? static const struct usbmisc_ops imx6q_usbmisc_ops = { @@ -204,8 +204,12 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .data = imx27_usbmisc_ops, }, { + .compatible = fsl,imx51-usbmisc, + .data = imx5_usbmisc_ops, And then just use imx53_usbmisc_ops? This gives us some breathing room later to actually do the right thing without additionally performing renames all over the place to make imx5 - imx53 (again)/imx51 (new). You may take matt's suggestion, it can reduce the code change now and in future. We can only add device_id for imx51 in this patch, split imx53 and imx51's ops when their differences are added in future. OK. Names of registers and bits also keep as is? ---
Re: [PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs
Hi Alexander, On Sunday, November 10, 2013 03:18 PM, Alexander Shiyan wrote: This adds i.MX27 and i.MX31 as the next user of the usbmisc driver. Signed-off-by: Alexander Shiyanshc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 42 ++ 1 file changed, 42 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c ... +static int usbmisc_imx27_init(struct imx_usbmisc_data *data) +{ + unsigned long flags; + u32 val; + + switch (data-index) { + case 0: + val = MX27_OTG_PM_BIT; + break; + case 1: + val = MX27_H1_PM_BIT; + break; + case 2: + val = MX27_H2_PM_BIT; + break; + default: + return -EINVAL; + }; + From my understanding this can not work, the usbmisc-base not point into the usb control register (USB_CTRL). Reference manual 30.5.1.1 says BASE + 0x600 you must add the offset to the readl instruction. Why not work? usbotg: usb@10024000 usbh1: usb@10024200 usbh2: usb@10024400 usbmisc: usbmisc@10024600 So, offset to USB_CTRL should already be defined by DTS. + spin_lock_irqsave(usbmisc-lock, flags); + if (data-disable_oc) + val = readl(usbmisc-base) | val; else part not needed, the registers bits are set to 0 (reset) the function is called on start-up once only, right?! + else + val = readl(usbmisc-base) ~val; + writel(val, usbmisc-base); + spin_unlock_irqrestore(usbmisc-lock, flags); + + return 0; +} Bit can be set/cleared wrongly by the bootloader, it is not a big overhead to set it in proper state. ... ---
Re: [PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs
On Monday, November 11, 2013 12:45 PM, Alexander Shiyan wrote: Hi Alexander, On Sunday, November 10, 2013 03:18 PM, Alexander Shiyan wrote: This adds i.MX27 and i.MX31 as the next user of the usbmisc driver. Signed-off-by: Alexander Shiyanshc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 42 ++ 1 file changed, 42 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c ... +static int usbmisc_imx27_init(struct imx_usbmisc_data *data) +{ + unsigned long flags; + u32 val; + + switch (data-index) { + case 0: + val = MX27_OTG_PM_BIT; + break; + case 1: + val = MX27_H1_PM_BIT; + break; + case 2: + val = MX27_H2_PM_BIT; + break; + default: + return -EINVAL; + }; + From my understanding this can not work, the usbmisc-base not point into the usb control register (USB_CTRL). Reference manual 30.5.1.1 says BASE + 0x600 you must add the offset to the readl instruction. Why not work? usbotg: usb@10024000 usbh1: usb@10024200 usbh2: usb@10024400 usbmisc: usbmisc@10024600 So, offset to USB_CTRL should already be defined by DTS. in the usbmisc_imx_probe() the base pointer is loaded from res = platform_get_resource(pdev, IORESOURCE_MEM, 0); data-base = devm_ioremap_resource(pdev-dev, res); (and I did not see any of_ operations) Yes, and this is an address of usbmisc node, not otg. usbmisc = data; base is set to 0x10024000 when I look around all other functions init functions did a offset calculation. Can you point me on this? For example, for i.MX5 CPUs we calculate only offset to PHY_CTRL_X register relative to basic offset 0x800, which is already defined in DTS. ... --- N�r��yb�X��ǧv�^�){.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
Re: [PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs
Hello. On Sunday, November 10, 2013 03:18 PM, Alexander Shiyan wrote: This adds i.MX27 and i.MX31 as the next user of the usbmisc driver. Signed-off-by: Alexander Shiyanshc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 42 ++ 1 file changed, 42 insertions(+) ... At this point might be good to patch the imx27.dtsi with the usb defines. ... I have a working configuration for i.MX27 USB, but I prefer to make a few more tests before the addition of definitions in DTS. This will be a next step. Thanks. ---
[PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs
This adds i.MX27 and i.MX31 as the next user of the usbmisc driver. Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 42 ++ 1 file changed, 42 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 8a1094b..4381c5a6 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -21,6 +21,10 @@ #define MX25_USB_PHY_CTRL_OFFSET 0x08 #define MX25_BM_EXTERNAL_VBUS_DIVIDER BIT(23) +#define MX27_H1_PM_BIT BIT(8) +#define MX27_H2_PM_BIT BIT(16) +#define MX27_OTG_PM_BITBIT(24) + #define MX53_USB_OTG_PHY_CTRL_0_OFFSET 0x08 #define MX53_USB_UH2_CTRL_OFFSET 0x14 #define MX53_USB_UH3_CTRL_OFFSET 0x18 @@ -68,6 +72,36 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data) return 0; } +static int usbmisc_imx27_init(struct imx_usbmisc_data *data) +{ + unsigned long flags; + u32 val; + + switch (data-index) { + case 0: + val = MX27_OTG_PM_BIT; + break; + case 1: + val = MX27_H1_PM_BIT; + break; + case 2: + val = MX27_H2_PM_BIT; + break; + default: + return -EINVAL; + }; + + spin_lock_irqsave(usbmisc-lock, flags); + if (data-disable_oc) + val = readl(usbmisc-base) | val; + else + val = readl(usbmisc-base) ~val; + writel(val, usbmisc-base); + spin_unlock_irqrestore(usbmisc-lock, flags); + + return 0; +} + static int usbmisc_imx53_init(struct imx_usbmisc_data *data) { void __iomem *reg = NULL; @@ -128,6 +162,10 @@ static const struct usbmisc_ops imx25_usbmisc_ops = { .post = usbmisc_imx25_post, }; +static const struct usbmisc_ops imx27_usbmisc_ops = { + .init = usbmisc_imx27_init, +}; + static const struct usbmisc_ops imx53_usbmisc_ops = { .init = usbmisc_imx53_init, }; @@ -162,6 +200,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .data = imx25_usbmisc_ops, }, { + .compatible = fsl,imx27-usbmisc, + .data = imx27_usbmisc_ops, + }, + { .compatible = fsl,imx53-usbmisc, .data = imx53_usbmisc_ops, }, -- 1.8.1.5 -- 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
[PATCH 2/2] usb: chipidea: usbmisc: Add support for i.MX51 CPU
This adds i.MX51 as the next user of the usbmisc driver. Since the functional is similar i.MX53, we just rename the definitions and add an alias for the new CPU. Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/usb/chipidea/usbmisc_imx.c | 40 +- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 4381c5a6..f348ebb 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -25,12 +25,12 @@ #define MX27_H2_PM_BIT BIT(16) #define MX27_OTG_PM_BITBIT(24) -#define MX53_USB_OTG_PHY_CTRL_0_OFFSET 0x08 -#define MX53_USB_UH2_CTRL_OFFSET 0x14 -#define MX53_USB_UH3_CTRL_OFFSET 0x18 -#define MX53_BM_OVER_CUR_DIS_H1BIT(5) -#define MX53_BM_OVER_CUR_DIS_OTG BIT(8) -#define MX53_BM_OVER_CUR_DIS_UHx BIT(30) +#define MX5_USB_OTG_PHY_CTRL_0_OFFSET 0x08 +#define MX5_USB_UH2_CTRL_OFFSET0x14 +#define MX5_USB_UH3_CTRL_OFFSET0x18 +#define MX5_BM_OVER_CUR_DIS_H1 BIT(5) +#define MX5_BM_OVER_CUR_DIS_OTGBIT(8) +#define MX5_BM_OVER_CUR_DIS_UHxBIT(30) #define MX6_BM_OVER_CUR_DISBIT(7) @@ -102,7 +102,7 @@ static int usbmisc_imx27_init(struct imx_usbmisc_data *data) return 0; } -static int usbmisc_imx53_init(struct imx_usbmisc_data *data) +static int usbmisc_imx5_init(struct imx_usbmisc_data *data) { void __iomem *reg = NULL; unsigned long flags; @@ -115,20 +115,20 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data) spin_lock_irqsave(usbmisc-lock, flags); switch (data-index) { case 0: - reg = usbmisc-base + MX53_USB_OTG_PHY_CTRL_0_OFFSET; - val = readl(reg) | MX53_BM_OVER_CUR_DIS_OTG; + reg = usbmisc-base + MX5_USB_OTG_PHY_CTRL_0_OFFSET; + val = readl(reg) | MX5_BM_OVER_CUR_DIS_OTG; break; case 1: - reg = usbmisc-base + MX53_USB_OTG_PHY_CTRL_0_OFFSET; - val = readl(reg) | MX53_BM_OVER_CUR_DIS_H1; + reg = usbmisc-base + MX5_USB_OTG_PHY_CTRL_0_OFFSET; + val = readl(reg) | MX5_BM_OVER_CUR_DIS_H1; break; case 2: - reg = usbmisc-base + MX53_USB_UH2_CTRL_OFFSET; - val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx; + reg = usbmisc-base + MX5_USB_UH2_CTRL_OFFSET; + val = readl(reg) | MX5_BM_OVER_CUR_DIS_UHx; break; case 3: - reg = usbmisc-base + MX53_USB_UH3_CTRL_OFFSET; - val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx; + reg = usbmisc-base + MX5_USB_UH3_CTRL_OFFSET; + val = readl(reg) | MX5_BM_OVER_CUR_DIS_UHx; break; } if (reg val) @@ -166,8 +166,8 @@ static const struct usbmisc_ops imx27_usbmisc_ops = { .init = usbmisc_imx27_init, }; -static const struct usbmisc_ops imx53_usbmisc_ops = { - .init = usbmisc_imx53_init, +static const struct usbmisc_ops imx5_usbmisc_ops = { + .init = usbmisc_imx5_init, }; static const struct usbmisc_ops imx6q_usbmisc_ops = { @@ -204,8 +204,12 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .data = imx27_usbmisc_ops, }, { + .compatible = fsl,imx51-usbmisc, + .data = imx5_usbmisc_ops, + }, + { .compatible = fsl,imx53-usbmisc, - .data = imx53_usbmisc_ops, + .data = imx5_usbmisc_ops, }, { .compatible = fsl,imx6q-usbmisc, -- 1.8.1.5 -- 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
[PATCH] ARM: OMAP-USB: Fix possible memory leak
Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- arch/arm/mach-omap2/usb-host.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index aa27d7f..8d17a0d 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c @@ -570,8 +570,10 @@ static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply, supplies-dev_name = dev_id; reg_data = kzalloc(sizeof(*reg_data), GFP_KERNEL); - if (!reg_data) + if (!reg_data) { + kfree(supplies); return -ENOMEM; + } reg_data-constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS; reg_data-consumer_supplies = supplies; @@ -579,8 +581,11 @@ static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply, config = kmemdup(hsusb_reg_config, sizeof(hsusb_reg_config), GFP_KERNEL); - if (!config) + if (!config) { + kfree(supplies); + kfree(reg_data); return -ENOMEM; + } config-supply_name = name; config-gpio = gpio; @@ -589,17 +594,25 @@ static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply, /* create a regulator device */ pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); - if (!pdev) + if (!pdev) { + kfree(supplies); + kfree(reg_data); + kfree(config); return -ENOMEM; + } pdev-id = PLATFORM_DEVID_AUTO; pdev-name = reg_name; pdev-dev.platform_data = config; ret = platform_device_register(pdev); - if (ret) + if (ret) { pr_err(%s: Failed registering regulator %s for %s\n, __func__, name, dev_id); + kfree(supplies); + kfree(reg_data); + kfree(config); + } return ret; } -- 1.8.1.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re[2]: [PATCH] ARM: OMAP-USB: Fix possible memory leak
On 20:03-20130502, Alexander Shiyan wrote: Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- arch/arm/mach-omap2/usb-host.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index aa27d7f..8d17a0d 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c @@ -570,8 +570,10 @@ static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply, supplies-dev_name = dev_id; reg_data = kzalloc(sizeof(*reg_data), GFP_KERNEL); - if (!reg_data) + if (!reg_data) { + kfree(supplies); return -ENOMEM; + } reg_data-constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS; reg_data-consumer_supplies = supplies; @@ -579,8 +581,11 @@ static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply, config = kmemdup(hsusb_reg_config, sizeof(hsusb_reg_config), GFP_KERNEL); - if (!config) + if (!config) { + kfree(supplies); + kfree(reg_data); return -ENOMEM; + } config-supply_name = name; config-gpio = gpio; @@ -589,17 +594,25 @@ static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply, /* create a regulator device */ pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); - if (!pdev) + if (!pdev) { + kfree(supplies); + kfree(reg_data); + kfree(config); return -ENOMEM; + } pdev-id = PLATFORM_DEVID_AUTO; pdev-name = reg_name; pdev-dev.platform_data = config; ret = platform_device_register(pdev); - if (ret) + if (ret) { pr_err(%s: Failed registering regulator %s for %s\n, __func__, name, dev_id); + kfree(supplies); + kfree(reg_data); + kfree(config); + } Might be better to switch to devm_XXX managed functions? If anyone can rewrite driver to use devm_xx, it would have been better. I'm not going to redo the patch yet, let it be so, I just showed a point for OMAP-developers. Thanks. ---