summaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
Commit message (Collapse)AuthorAgeFilesLines
* treewide: use dev_err_probe instead of comparisons against EPROBE_DEFERAhmad Fatoum2024-02-201-3/+1
| | | | | | | | | | | | | | Drivers should not need to compare an error value against EPROBE_DEFER. We have a number of drivers doing that though to decide whether to print an error or not. This error message will be lost if the probe is deferred, so use dev_err_probe to store the error in that case. While at it, we shorten the error messages a bit. dev_err_probe will already print the string 'error' before the error code string. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219172659.3796647-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add MODULE_DEVICE_TABLE markersAhmad Fatoum2023-06-134-0/+4
| | | | | | | | | | | | | | | | Syncing device trees with Linux upstream can lead to breakage, when the device trees are switched to newer bindings, which are not yet supported in barebox. To make it easier to spot such issues, we want to start applying some heuristics to flag possibly problematic DT changes. One step towards being able to do that is to know what nodes barebox actually consumes. Most of the nodes have a compatible entry, which is matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE point at it for future extraction. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: Update core to Linux-6.3-rc2Sascha Hauer2023-03-241-36/+5
| | | | | | Our usbgadget stack is quite outdated. Sync core.c with Linux-6.3-rc2. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: move include files to place where Linux has themSascha Hauer2023-03-206-10/+10
| | | | | | | | | For easier patch merging and comparison with Linux move the usb gadget files to where Linux has them. For now do a plain git mv include/usb include/linux/usb, eventhough there might be some files which are purely barebox specific. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: rename leftover device_dAhmad Fatoum2023-02-211-1/+0
| | | | | | | | | We have some instances of device_d and driver_d still lingering in documentation and commented out code. Let's drop these as well. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20230221070758.1130869-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-104-4/+4
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-106-12/+12
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-104-5/+5
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-2218-18/+18
| | | | | | | | | | "GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier "GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>. Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-0118-276/+18
| | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: host: ehci: remove duplicated usb_host_detect() callsAhmad Fatoum2021-02-011-9/+0
| | | | | | | | With the last patch adding a fallback detect, we no longer need the duplication in the host controller drivers. Drop them. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc' into masterSascha Hauer2020-10-141-2/+2
|\
| * USB: musb: host: fix mismatched format specifier in dev_dbg()Ahmad Fatoum2020-09-281-2/+2
| | | | | | | | | | | | | | | | Unadorned 0 is an int, but is printed used %zu. As it's just an interger literal, just hardcode it into the string. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/driver-macro' into masterSascha Hauer2020-10-141-5/+1
|\ \
| * | treewide: Use driver macroSascha Hauer2020-09-291-5/+1
| |/ | | | | | | | | | | | | We have several macros for a oneline driver registration. Add some missing and use them consistently where possible througout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / USB: musb: remove dead storesAhmad Fatoum2020-10-021-4/+3
|/ | | | | | | | | | Reading the interrupt registers has a side-effect, so their value need not be used for anythig. Storing it into a variable never read obfuscates this however. Cast to (void) for clarity. Reported-by: clang-analyzer-10 Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: remove stale instances of struct deviceAhmad Fatoum2020-08-031-9/+0
| | | | | | | | We call it struct device_d, any instances of struct device are likely left-over code after porting from Linux. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* update list.h from Linux-5.7Sascha Hauer2020-06-171-2/+0
| | | | | | This updates include/linux/list.h from Linux-5.7. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: MUSB: defer driver probes where necessaryAhmad Fatoum2020-03-024-23/+57
| | | | | | | | | | | | | | | | | Kernel commit 0782e8572c ("ARM: dts: Probe am335x musb with ti-sysc") which we pulled in during the v2020.02.0 dts/ sync moved the USB nodes to be under a ti-sysc bus instead of ti,am33xx-usb. This new probe order broke am335x USB under barebox, because the MUSB drivers couldn't cope with the now different device probe order. Pepper some -EPROBE_DEFER around to make USB work again. Fixes: 574eed3f6f ("dts: update to v5.5-rc1") Reported-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Tested-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: MUSB: PHY: scrap singleton am335x_get_usb_phy()Ahmad Fatoum2020-03-023-20/+13
| | | | | | | | | | | | | | | | | | am335x_get_usb_phy() retrieves the last probed USB phy. On the BeagleBone with both PHYs enabled, this means that dependent on probe order, both MUSB instances could end up with the same PHY. Remove the global variable and have the MUSB driver parse the "phys" property instead. The cleaner way to achieve this would be to migrate phy-am335x.c and phy-am335x-control.c to the generic phy framework and have MUSB use of_phy_get, alas, even Linux hasn't done this so far and we need a short patch for master anyway, thus just do it the easy way. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Tested-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: musb: use usb_register_otg_device()Sascha Hauer2019-11-212-37/+8
| | | | | | | We now have usb_register_otg_device() to register an "otg" device. Use it and drop the custom code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: remove blackfin supportSascha Hauer2019-09-125-265/+2
| | | | | | | The blackfin architecture has been removed from barebox. Remove the blackfin specifics in the USB drivers as well. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-12-072-4/+2
|\
| * usb: musb: Add missing includesSascha Hauer2018-11-192-4/+2
| | | | | | | | | | | | | | | | | | phy-am335x.c and phy-am335x-control.c both implement functions that they do not include the header file providing the prototype for. Add the missing include and remove the duplicate definition of struct phy_control. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: musb: fix possible out of bounds accessOleksij Rempel2018-11-211-1/+6
|/ | | | | | | | Either the condition 'epnum>=((u8)16)' is redundant or the array 'musb->endpoints[16]' is accessed at index 16, which is out of bounds. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-1/+1
| | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add linux/slab.hSascha Hauer2018-10-081-1/+1
| | | | | | | | | Move stuff we already have in include/linux/barebox-wrapper.h that really belongs to include/linux/slab.h to there. Also add kmem_cache_* functions. UBIFS uses them in there own implementation, so we have to remove it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove checks for xzalloc() returning NULLUwe Kleine-König2017-09-263-8/+0
| | | | | | | xzalloc() either returns memory or panics, so checking for NULL is useless. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-073-15/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Introduce include/linux/spinlock.hYegor Yefremov2016-02-012-0/+2
| | | | | | | Move spinlock related definitions to its original place. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: musb: Use proper timeout loopSascha Hauer2015-07-031-7/+6
| | | | | | | | Poll for a well defined time in musb_init. The current counting loop takes too short for some devices. Tested on OMAP3 with a rather slowish memory stick. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'pu/am335x'Sascha Hauer2015-05-282-12/+10
|\
| * usb: musb: set controller->priv pointerSascha Hauer2015-04-281-0/+1
| | | | | | | | | | | | This is used by the detect callback but never initialized. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: musb: dsps: Do not use priv pointerSascha Hauer2015-04-281-12/+9
| | | | | | | | | | | | | | | | Use container_of instead of dev->priv pointer. dev->priv is used by the musb core layer (which maybe should not be the case, but using container_of is good anyway). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-302-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* usb: musb-dsps: select OFDEVICELucas Stach2015-01-191-0/+1
| | | | | | | | Fixes: In function `dsps_probe': undefined reference to `of_usb_get_dr_mode' Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: musb: only build musb_barebox if host is enabledLucas Stach2014-11-271-2/+2
| | | | | | | | | | | | musb_barebox.c contains code that is only ever used if CONFIG_MUSB_HOST is set. Building it uncoditionally breaks the build depending on the link order. Fixes: drivers/usb/musb/musb_barebox.c:64: undefined reference to `musb_urb_enqueue' Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: MUSB: Add barebox specific changesSascha Hauer2014-09-2617-3830/+895
| | | | | | | | | | | This changes the MUSB support from the original Kernel state to be usable with barebox. Tested on a custom board and the Beaglebone Black. The host port on the Beaglebone works, the OTG port works in device mode, but not yet in host mode. Based on the initial MUSB port from Rolf Evers Fischer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: Add MUSB driver from LinuxSascha Hauer2014-09-2613-0/+11145
This adds the necessary files from the MUSB driver directly from Linux 3.17-rc5. No changes to the original files have been made so far. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>