summaryrefslogtreecommitdiffstats
path: root/drivers/usb/imx
Commit message (Collapse)AuthorAgeFilesLines
* usb: imx: Fix setting of dev->privSascha Hauer2017-03-091-1/+3
| | | | | | | | | Since fc10539f7d the usbmisc pointer must be stored in dev->priv, but dev->priv has never been set. Fix this. Fixes: fc10539f7d usb: imx: Make usb-misc multi instance safe Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx: role_registered contains roleSascha Hauer2017-03-091-2/+2
| | | | | | | role_registered contains the role, it's not a bool indicating that a role is registered. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx: Add clock supportSascha Hauer2017-01-191-0/+13
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx: Add usbmisc support for i.MX7Sascha Hauer2017-01-191-0/+53
| | | | | | Taken directly from Linux-4.10-rc3 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx: Make usb-misc multi instance safeSascha Hauer2017-01-192-15/+28
| | | | | | | i.MX7 has two usbmisc devices, so we cannot use global instance variables anymore. Create a driver private data struct for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX: imx-usb-misc: Add Vybrid supportAndrey Smirnov2017-01-121-0/+28
| | | | | | | | Add code to do usbmisc initialization on VF610 family of SoCs. Based on analogous code from Linux kernel. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX: Default CONFIG_USB_IMX_PHY to 'y' on VybridAndrey Smirnov2017-01-121-1/+1
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX: imx-usb-phy: Add VF610 OF compatiblity stringAndrey Smirnov2017-01-121-0/+2
| | | | | | | | | | From looking at analogous Linux driver code it seems that all of the differences between code "imx23-usbphy" and "vf610-usbphy" pertain to suspend/resume functionality, which shouldn't affetct Barebox. As a result this commit just adds a compatiblity string and no other code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx-us-phy: implement notify_(dis)concectSascha Hauer2016-09-291-0/+27
| | | | | | | | | | | The i.MX6 USB phy does not recognize disconnects of high speed devices when the USBPHY_CTRL_ENHOSTDISCONDETECT is not set. The phy does not work properly though when this bit is always set, so implement the notify_(dis)concect() callbacks to set this bit whenever a high speed device is connected and to clear it again when the device is disconnected. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx-us-phy: Convert driver to generic phy supportSascha Hauer2016-09-293-4/+66
| | | | | | | The generic phy layer now supports USB phys, so convert the driver over to use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx-usb-phy: Drop unnecessary read/modify/writeSascha Hauer2016-09-291-5/+2
| | | | | | | When writing to the USBPHY_CTRL register read/modify/write is unncessary since we are writing to the associated bit set register anyway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX drivers: enable i.MX50 where already supportedAlexander Kurz2016-09-121-0/+6
| | | | | | | | The i.MX50 SOC includes one ESDHCv3, three ESDHCv2, one cspi and two ecspi instances which are supported by existing drivers. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: i.MX chipidea: Enable VBUS regulator when neededSascha Hauer2016-09-051-4/+13
| | | | | | | We should enable VBUS only in host mode, not unconditionally during probe(). Fix that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea i.MX: Do not return unnecessary errorSascha Hauer2016-08-291-3/+8
| | | | | | | | | We only allow to setup the host/peripheral role once, when it's already set then we return -EBUSY. Return 0 instead when we set the same role again and only return -EBUSY when we actually try to change the role. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/driver'Sascha Hauer2016-03-113-9/+15
|\
| * driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-073-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * driver: Fix return check of dev_request_mem_regionSascha Hauer2016-02-232-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region returns an ERR_PTR, fix places which check for a NULL pointer instead. This patch has been generated with this semantic patch, written by me and improved by Andrey Smirnov: // <smpl> @@ expression e; expression e1; @@ e = dev_request_mem_region(...); ... -if (!e) - return e1; +if (IS_ERR(e)) + return PTR_ERR(e); @ rule1 @ expression e; @@ e = dev_request_mem_region(...); @@ expression rule1.e; identifier ret, label; constant errno; @@ if (!e) { ... ( - ret = -errno; + ret = PTR_ERR(e); ... goto label; | - return -errno; + return PTR_ERR(e); ) } @depends on rule1@ expression rule1.e; @@ - if (e == NULL) + if (IS_ERR(e)) { ... } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
* | USB: imx-usb-phy: Fix uninitialized use of variableSascha Hauer2016-03-101-0/+1
|/ | | | | | ret may no be initialized in the error path when clk_get fails. Fix it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea-imx: check return value of regulator_get()David Jander2016-01-081-1/+2
| | | | | | | | | | The VBUS regulator is optional for the chipidea-imx glue, so it must be checked if regulator_get provided a valid regulator handle before trying to enable the regulator. Signed-off-by: David Jander <david@protonic.nl> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: mx25: fix bit position of "Host power mask"Uwe Kleine-König2015-11-091-1/+1
| | | | | | | | | | | | | | | | | The bit MX25_H1_PM_BIT value is handled for port 1 as MX25_OTG_PM_BIT is for port 0. The latter is called "OPM: OTG power mask" in the i.MX25 reference manual. Its description matches the description of "HPM: Host power mask" for the host port which is bit 16, not 8. The Linux kernel (as of 4.3) also has #define MX25_H1_PM_BIT BIT(16) . Fixes: a4076ddf6577 ("USB i.MX: Add chipidea driver support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2015-10-071-0/+7
|\
| * usb: chipidea: Add udc unregister for device removalMarkus Pargmann2015-09-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | The host may assume that the usb device is still up and running after booting if we do not deregister the udc here. I observed issues when the linux kernel was using a usb gadget directly where the complete USB Hub got disconnected through this. This patch adds a proper USB disconnect for gadget devices. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2015-10-071-1/+1
|\ \
| * | introduce strerrorpSascha Hauer2015-09-231-1/+1
| |/ | | | | | | | | | | | | | | | | | | putting an error pointer into strerror can be a bit confusing since strerror takes a positive error code but PTR_ERR returns a negative number, so we have to do strerror(-PTR_ERR(errp)). Some places got this wrong already, so introduce a strerrorp function which directly takes an error pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / chipidea-imx: allow phymode configuration in pdataEric Bénard2015-09-291-0/+1
|/ | | | | | | | | it's currently only handled through DT and for i.MX25 OTG port (at least), we need to configure portsc to get host mode working but it actually fails as ci->phymode is 0 which is USBPHY_INTERFACE_MODE_UNKNOWN Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-301-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/resource-err-ptr'Sascha Hauer2014-10-021-2/+3
|\
| * resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-161-2/+3
| | | | | | | | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | USB: add usb phy header fileSascha Hauer2014-09-261-0/+1
|/ | | | | | | Mostly taken from the Linux Kernel to ease porting phy handling code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: i.MX chipidea: Implement OTG support for the poorSascha Hauer2014-07-181-9/+92
| | | | | | | | For situations when we don't know the desired mode for the OTG port we register a otg device which has a mode parameter to specifiy the desired mode on the command line. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea i.MX: relax phy_type requirementsSascha Hauer2014-05-221-9/+10
| | | | | | | | Some USB ports only have one possiblitly for the phy_type and the type is not specified in the devicetree in this case. Rely on the reset default instead of failing. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea i.MX: add some delay after ulpi_setupSascha Hauer2014-01-071-0/+1
| | | | | | | | On the pcm038 the ULPI phy is found correctly, but after a power cycle the attached devices are not found. Adding some delay fixes this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea i.MX: always print an error message when ULPI failsSascha Hauer2014-01-071-0/+3
| | | | | | | | The ULPI code does not print a message when the operation times out. Add one to the caller so that he gets an idea that something is going wrong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea i.MX: limit port init to HSIC modeSascha Hauer2014-01-071-1/+2
| | | | | | | | imx_chipidea_port_init() will be called during startup from the ehci driver. Calling it before setting up the PORTSC register is only necessary in HSIC mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea i.MX: remove unused pdata->init hookSascha Hauer2014-01-071-5/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Add missing includesSascha Hauer2013-11-083-0/+6
| | | | | | | | A lot of files rely on include/driver.h including include/of.h (and this including include/errno.h. include the files explicitly so we can eventually get rid of including of.h from driver.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: i.MX5x: Remove usage of MXC_EHCI_INTERNAL_PHY for OTG portAlexander Shiyan2013-11-041-3/+0
| | | | | | | | i.MX5x OTG port is hardwired to the internal UTMI PHY, so having this configurable makes no sense and helps using this port with DT. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next-manual/oftree-linux-sync'Sascha Hauer2013-07-021-7/+7
|\
| * OF: base: import parse phandle functions from Linux OF APISebastian Hesselbarth2013-06-201-6/+5
| | | | | | | | | | | | | | | | This imports of_parse_phandle_with_args and of_count_phandle_with_args from Linux OF API. The slightly different of_parse_phandles_with_args is removed and all users are converted to reflect the API change. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
| * OF: base: sync of_find_property with linux OF APISebastian Hesselbarth2013-06-201-1/+2
| | | | | | | | | | | | | | | | To start synchronizing OF API of barebox with linux OF API, this adds a length pointer to of_find_property. Also all current users of that function are updated to reflect the API change. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
* | Merge branch 'for-next/imx'Sascha Hauer2013-07-011-13/+16
|\ \ | |/ |/| | | | | Conflicts: drivers/usb/imx/chipidea-imx.c
| * usb: i.MX chipidea: probe ULPI phys laterSascha Hauer2013-06-251-15/+16
| | | | | | | | | | | | | | | | Probe ULPI phys during USB initialization and not during driver probe. This lowers the pressure to have the necessary board specific setup in place early. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Revert "usb: chipidea-imx: Fix usb initialization"Lucas Stach2013-06-171-2/+2
|/ | | | | | | | | | This breaks HSIC and has no good justification why this would be needed for ULPI. This reverts commit 2e7d66f526217f6ff3167e4580aecb9548a0de33. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: i.MX chipidea: Add overcurrent disable flag for i.MX6Sascha Hauer2013-05-312-1/+12
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: i.MX chipidea: Add devicetree supportSascha Hauer2013-05-313-27/+166
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea-imx: Fix usb initializationAlexander Shiyan2013-03-131-2/+2
| | | | | | | | | | | This patch fix chipidea-imx usb initialization. "imx_chipidea_port_init" was moved before PORTSC setup in the commit "USB i.MX chipidea: implement post init support". This change breaks usb function with ULPI. Patch moves port initialization back after PORTSC setup, so it works again. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2013-03-042-25/+154
|\
| * USB i.MX: Add chipidea gadget supportSascha Hauer2013-02-151-5/+6
| | | | | | | | | | | | | | | | This adds USB gadget support to the i.MX chipidea driver. Basically we have to add a register function to the fsl udc driver and call this from the chipidea driver if device mode is selected. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB i.MX6: Add HSIC supportSascha Hauer2013-02-141-0/+60
| | | | | | | | | | | | | | | | | | | | HSIC needs some special setup for i.MX6. Most ugly detail is that the HSIC needs help of the IOMUX to configure a pullup on the strobe line. This has to be done after the ehci controller has started. Fortunately there is only one muxing possibility for the HSIC ports on i.MX6, so we can simply control the iomux from the usbmisc driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB i.MX chipidea: implement post init supportSascha Hauer2013-02-142-19/+87
| | | | | | | | | | | | | | Some controllers need an init hook after the USB controller is started, so implement the post init hook for i.MX. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>