aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/common/ulpi.c
AgeCommit message (Collapse)AuthorFilesLines
2024-07-03driver core: have match() callback in struct bus_type take a const *Greg Kroah-Hartman1-1/+1
In the match() callback, the struct device_driver * should not be changed, so change the function callback to be a const *. This is one step of many towards making the driver core safe to have struct device_driver in read-only memory. Because the match() callback is in all busses, all busses are modified to handle this properly. This does entail switching some container_of() calls to container_of_const() to properly handle the constant *. For some busses, like PCI and USB and HV, the const * is cast away in the match callback as those busses do want to modify those structures at this point in time (they have a local lock in the driver structure.) That will have to be changed in the future if they wish to have their struct device * in read-only-memory. Cc: Rafael J. Wysocki <[email protected]> Reviewed-by: Alex Elder <[email protected]> Acked-by: Sumit Garg <[email protected]> Link: https://lore.kernel.org/r/2024070136-wrongdoer-busily-01e8@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
2024-01-27usb: ulpi: Fix debugfs directory leakSean Anderson1-1/+1
The ULPI per-device debugfs root is named after the ulpi device's parent, but ulpi_unregister_interface tries to remove a debugfs directory named after the ulpi device itself. This results in the directory sticking around and preventing subsequent (deferred) probes from succeeding. Change the directory name to match the ulpi device. Fixes: bd0a0a024f2a ("usb: ulpi: Add debugfs support") Cc: [email protected] Signed-off-by: Sean Anderson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-04-27Merge tag 'char-misc-6.4-rc1' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc drivers updates from Greg KH: "Here is the "big" set of char/misc and other driver subsystems for 6.4-rc1. It's pretty big, but due to the removal of pcmcia drivers, almost breaks even for number of lines added vs. removed, a nice change. Included in here are: - removal of unused PCMCIA drivers (finally!) - Interconnect driver updates and additions - Lots of IIO driver updates and additions - MHI driver updates - Coresight driver updates - NVMEM driver updates, which required some OF updates - W1 driver updates and a new maintainer to manage the subsystem - FPGA driver updates - New driver subsystem, CDX, for AMD systems - lots of other small driver updates and additions All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (196 commits) mcb-lpc: Reallocate memory region to avoid memory overlapping mcb-pci: Reallocate memory region to avoid memory overlapping mcb: Return actual parsed size when reading chameleon table kernel/configs: Drop Android config fragments virt: acrn: Replace obsolete memalign() with posix_memalign() spmi: Add a check for remove callback when removing a SPMI driver spmi: fix W=1 kernel-doc warnings spmi: mtk-pmif: Drop of_match_ptr for ID table spmi: pmic-arb: Convert to platform remove callback returning void spmi: mtk-pmif: Convert to platform remove callback returning void spmi: hisi-spmi-controller: Convert to platform remove callback returning void w1: gpio: remove unnecessary ENOMEM messages w1: omap-hdq: remove unnecessary ENOMEM messages w1: omap-hdq: add SPDX tag w1: omap-hdq: allow compile testing w1: matrox: remove unnecessary ENOMEM messages w1: matrox: use inline over __inline__ w1: matrox: switch from asm to linux header w1: ds2482: do not use assignment in if condition w1: ds2482: drop unnecessary header ...
2023-04-05usb: ulpi: Use of_request_module()Miquel Raynal1-1/+1
There is a new helper supposed to replace of_device_request_module(), called of_request_module(). They are both strictly equivalent, besides the fact the latter receives a "struct device_node" directly. Use it. Cc: Heikki Krogerus <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Acked-by: Rob Herring <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-03-23USB: mark all struct bus_type as constGreg Kroah-Hartman1-1/+1
Now that the driver core can properly handle constant struct bus_type, move all of the USB subsystem struct bus_type structures as const, placing them into read-only memory which can not be modified at runtime. Cc: Johan Hovold <[email protected]> Cc: Evan Green <[email protected]> Cc: Alan Stern <[email protected]> Cc: [email protected] Acked-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-02-24Merge tag 'driver-core-6.3-rc1' of ↵Linus Torvalds1-2/+2
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here is the large set of driver core changes for 6.3-rc1. There's a lot of changes this development cycle, most of the work falls into two different categories: - fw_devlink fixes and updates. This has gone through numerous review cycles and lots of review and testing by lots of different devices. Hopefully all should be good now, and Saravana will be keeping a watch for any potential regression on odd embedded systems. - driver core changes to work to make struct bus_type able to be moved into read-only memory (i.e. const) The recent work with Rust has pointed out a number of areas in the driver core where we are passing around and working with structures that really do not have to be dynamic at all, and they should be able to be read-only making things safer overall. This is the contuation of that work (started last release with kobject changes) in moving struct bus_type to be constant. We didn't quite make it for this release, but the remaining patches will be finished up for the release after this one, but the groundwork has been laid for this effort. Other than that we have in here: - debugfs memory leak fixes in some subsystems - error path cleanups and fixes for some never-able-to-be-hit codepaths. - cacheinfo rework and fixes - Other tiny fixes, full details are in the shortlog All of these have been in linux-next for a while with no reported problems" [ Geert Uytterhoeven points out that that last sentence isn't true, and that there's a pending report that has a fix that is queued up - Linus ] * tag 'driver-core-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (124 commits) debugfs: drop inline constant formatting for ERR_PTR(-ERROR) OPP: fix error checking in opp_migrate_dentry() debugfs: update comment of debugfs_rename() i3c: fix device.h kernel-doc warnings dma-mapping: no need to pass a bus_type into get_arch_dma_ops() driver core: class: move EXPORT_SYMBOL_GPL() lines to the correct place Revert "driver core: add error handling for devtmpfs_create_node()" Revert "devtmpfs: add debug info to handle()" Revert "devtmpfs: remove return value of devtmpfs_delete_node()" driver core: cpu: don't hand-override the uevent bus_type callback. devtmpfs: remove return value of devtmpfs_delete_node() devtmpfs: add debug info to handle() driver core: add error handling for devtmpfs_create_node() driver core: bus: update my copyright notice driver core: bus: add bus_get_dev_root() function driver core: bus: constify bus_unregister() driver core: bus: constify some internal functions driver core: bus: constify bus_get_kset() driver core: bus: constify bus_register/unregister_notifier() driver core: remove private pointer from struct bus_type ...
2023-02-06USB: ULPI: fix memory leak with using debugfs_lookup()Greg Kroah-Hartman1-8/+6
When calling debugfs_lookup() the result must have dput() called on it, otherwise the memory will leak over time. To make things simpler, just call debugfs_lookup_and_remove() instead which handles all of the logic at once. Acked-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-01-27driver core: make struct bus_type.uevent() take a const *Greg Kroah-Hartman1-2/+2
The uevent() callback in struct bus_type should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into all relevant subsystems that use this callback. Acked-by: Rafael J. Wysocki <[email protected]> Acked-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-12-28Revert "usb: ulpi: defer ulpi_register on ulpi_read_id timeout"Ferry Toth1-1/+1
This reverts commit 8a7b31d545d3a15f0e6f5984ae16f0ca4fd76aac. This patch results in some qemu test failures, specifically xilinx-zynq-a9 machine and zynq-zc702 as well as zynq-zed devicetree files, when trying to boot from USB drive. Link: https://lore.kernel.org/lkml/[email protected]/ Fixes: 8a7b31d545d3 ("usb: ulpi: defer ulpi_register on ulpi_read_id timeout") Cc: [email protected] Reported-by: Guenter Roeck <[email protected]> Signed-off-by: Ferry Toth <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-12-08usb: ulpi: defer ulpi_register on ulpi_read_id timeoutFerry Toth1-1/+1
Since commit 0f0101719138 ("usb: dwc3: Don't switch OTG -> peripheral if extcon is present") Dual Role support on Intel Merrifield platform broke due to rearranging the call to dwc3_get_extcon(). It appears to be caused by ulpi_read_id() on the first test write failing with -ETIMEDOUT. Currently ulpi_read_id() expects to discover the phy via DT when the test write fails and returns 0 in that case, even if DT does not provide the phy. As a result usb probe completes without phy. Make ulpi_read_id() return -ETIMEDOUT to its user if the first test write fails. The user should then handle it appropriately. A follow up patch will make dwc3_core_init() set -EPROBE_DEFER in this case and bail out. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Cc: [email protected] Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Ferry Toth <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-09-27usb: ulpi: use DEFINE_SHOW_ATTRIBUTE to simplify ulpi_regsLiu Shixin1-17/+3
Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code. No functional change. Signed-off-by: Liu Shixin <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-02-14usb: ulpi: Add debugfs supportSean Anderson1-1/+70
This adds a debugfs file for ULPI devices which contains a dump of their registers. This is useful for debugging basic connectivity problems. The file is created in ulpi_register because many devices will never have a driver bound (as they are managed in hardware by the USB controller device). The root directory of this subsystem is created before we register the bus to ensure that devices can always create their directories. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-01-31usb: ulpi: Call of_node_put correctlySean Anderson1-2/+6
of_node_put should always be called on device nodes gotten from of_get_*. Additionally, it should only be called after there are no remaining users. To address the first issue, call of_node_put if later steps in ulpi_register fail. To address the latter, call put_device if device_register fails, which will call ulpi_dev_release if necessary. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Cc: stable <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Sean Anderson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-01-31usb: ulpi: Move of_node_put to ulpi_dev_releaseSean Anderson1-1/+1
Drivers are not unbound from the device when ulpi_unregister_interface is called. Move of_node-freeing code to ulpi_dev_release which is called only after all users are gone. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Cc: stable <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Sean Anderson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-01-26usb: common: ulpi: Fix crash in ulpi_match()Jon Hunter1-2/+5
Commit 7495af930835 ("ARM: multi_v7_defconfig: Enable drivers for DragonBoard 410c") enables the CONFIG_PHY_QCOM_USB_HS for the ARM multi_v7_defconfig. Enabling this Kconfig is causing the kernel to crash on the Tegra20 Ventana platform in the ulpi_match() function. The Qualcomm USB HS PHY driver that is enabled by CONFIG_PHY_QCOM_USB_HS, registers a ulpi_driver but this driver does not provide an 'id_table', so when ulpi_match() is called on the Tegra20 Ventana platform, it crashes when attempting to deference the id_table pointer which is not valid. The Qualcomm USB HS PHY driver uses device-tree for matching the ULPI driver with the device and so fix this crash by using device-tree for matching if the id_table is not valid. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Cc: stable <[email protected]> Signed-off-by: Jon Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-07-21bus: Make remove callback return voidUwe Kleine-König1-3/+1
The driver core ignores the return value of this callback because there is only little it can do when a device disappears. This is the final bit of a long lasting cleanup quest where several buses were converted to also return void from their remove callback. Additionally some resource leaks were fixed that were caused by drivers returning an error code in the expectation that the driver won't go away. With struct bus_type::remove returning void it's prevented that newly implemented buses return an ignored error code and so don't anticipate wrong expectations for driver authors. Reviewed-by: Tom Rix <[email protected]> (For fpga) Reviewed-by: Mathieu Poirier <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> (For drivers/s390 and drivers/vfio) Acked-by: Russell King (Oracle) <[email protected]> (For ARM, Amba and related parts) Acked-by: Mark Brown <[email protected]> Acked-by: Chen-Yu Tsai <[email protected]> (for sunxi-rsb) Acked-by: Pali Rohár <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> (for media) Acked-by: Hans de Goede <[email protected]> (For drivers/platform) Acked-by: Alexandre Belloni <[email protected]> Acked-By: Vinod Koul <[email protected]> Acked-by: Juergen Gross <[email protected]> (For xen) Acked-by: Lee Jones <[email protected]> (For mfd) Acked-by: Johannes Thumshirn <[email protected]> (For mcb) Acked-by: Johan Hovold <[email protected]> Acked-by: Srinivas Kandagatla <[email protected]> (For slimbus) Acked-by: Kirti Wankhede <[email protected]> (For vfio) Acked-by: Maximilian Luz <[email protected]> Acked-by: Heikki Krogerus <[email protected]> (For ulpi and typec) Acked-by: Samuel Iglesias Gonsálvez <[email protected]> (For ipack) Acked-by: Geoff Levand <[email protected]> (For ps3) Acked-by: Yehezkel Bernat <[email protected]> (For thunderbolt) Acked-by: Alexander Shishkin <[email protected]> (For intel_th) Acked-by: Dominik Brodowski <[email protected]> (For pcmcia) Acked-by: Rafael J. Wysocki <[email protected]> (For ACPI) Acked-by: Bjorn Andersson <[email protected]> (rpmsg and apr) Acked-by: Srinivas Pandruvada <[email protected]> (For intel-ish-hid) Acked-by: Dan Williams <[email protected]> (For CXL, DAX, and NVDIMM) Acked-by: William Breathitt Gray <[email protected]> (For isa) Acked-by: Stefan Richter <[email protected]> (For firewire) Acked-by: Benjamin Tissoires <[email protected]> (For hid) Acked-by: Thorsten Scherer <[email protected]> (For siox) Acked-by: Sven Van Asbroeck <[email protected]> (For anybuss) Acked-by: Ulf Hansson <[email protected]> (For MMC) Acked-by: Wolfram Sang <[email protected]> # for I2C Acked-by: Sudeep Holla <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Finn Thain <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-05-27usb: common: ulpi: Add leading underscores for function name ↵Lee Jones1-1/+1
'__ulpi_register_driver()' Fixes the following W=1 kernel build warning(s): drivers/usb/common/ulpi.c:151: warning: expecting prototype for ulpi_register_driver(). Prototype was for __ulpi_register_driver() instead Cc: Heikki Krogerus <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: [email protected] Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-11-26usb: common: ulpi: Constify static attribute_group structRikard Falkeborn1-1/+1
It is never modified, so make them const to allow the compiler to put it in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard Falkeborn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-07-03usb: common: ulpi: Fix a few kerneldoc related issuesLee Jones1-2/+3
Firstly, demote function header to standard comment block as they are not suitable for kerneldoc. Then provide description for ulpi_register_driver()'s argument 'module'. Finally rename description for ulpi_unregister_interface()'s 'ulpi' arg. Fixes the following W=1 warnings: drivers/usb/common/ulpi.c:23: warning: Function parameter or member 'ulpi' not described in 'ulpi_read' drivers/usb/common/ulpi.c:23: warning: Function parameter or member 'addr' not described in 'ulpi_read' drivers/usb/common/ulpi.c:150: warning: Function parameter or member 'module' not described in '__ulpi_register_driver' drivers/usb/common/ulpi.c:299: warning: Function parameter or member 'ulpi' not described in 'ulpi_unregister_interface' drivers/usb/common/ulpi.c:299: warning: Excess function parameter 'intrf' description in 'ulpi_unregister_interface' Cc: Felipe Balbi <[email protected]> Cc: Heikki Krogerus <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-28USB: ulpi: fix bus-node lookupJohan Hovold1-2/+2
Fix bus-node lookup during registration, which ended up searching the whole device tree depth-first starting at the parent (or grand parent) rather than just matching on its children. To make things worse, the parent (or grand-parent) node could end being prematurely freed as well. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Reported-by: Peter Robinson <[email protected]> Reported-by: Stephen Boyd <[email protected]> Cc: stable <[email protected]> # 4.10 Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-04USB: common: Remove redundant license textGreg Kroah-Hartman1-4/+0
Now that the SPDX tag is in all USB files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Heikki Krogerus <[email protected]> Cc: Peter Chen <[email protected]> Cc: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-04USB: add SPDX identifiers to all remaining files in drivers/usb/Greg Kroah-Hartman1-0/+1
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/usb/ and include/linux/usb* files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Thomas Gleixner <[email protected]> Cc: Kate Stewart <[email protected]> Cc: Philippe Ombredanne <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Acked-by: Felipe Balbi <[email protected]> Acked-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-08-28usb: make device_type constBhumika Goyal1-1/+1
Make this const as it is only stored in the type field of a device structure, which is const. Done using Coccinelle. Signed-off-by: Bhumika Goyal <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-03-22of: Add function for generating a DT modalias with a newlineRob Herring1-1/+1
The modalias sysfs attr is lacking a newline for DT aliases on platform devices. The macio and ibmebus correctly add the newline, but open code it. Introduce a new function, of_device_modalias(), that fills the buffer with the modalias including the newline and update users of the old of_device_get_modalias function. Signed-off-by: Rob Herring <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Frank Rowand <[email protected]> Cc: [email protected] Acked-by: Greg Kroah-Hartman <[email protected]>
2017-01-20usb: ulpi: Support device discovery via DTStephen Boyd1-6/+73
The qcom HSIC ULPI phy doesn't have any bits set in the vendor or product ID registers. This makes it impossible to make a ULPI driver match against the ID registers. Add support to discover the ULPI phys via DT help alleviate this problem. In the DT case, we'll look for a ULPI bus node underneath the device registering the ULPI viewport (or the parent of that device to support chipidea's device layout) and then match up the phy node underneath that with the ULPI device that's created. The side benefit of this is that we can use standard properties in the phy node like clks, regulators, gpios, etc. because we don't have firmware like ACPI to turn these things on for us. And we can use the DT phy binding to point our phy consumer to the phy provider. The ULPI bus code supports native enumeration by reading the vendor ID and product ID registers at device creation time, but we can't be certain that those register reads will succeed if the phy is not powered up. To avoid any problems with reading the ID registers before the phy is powered we fallback to DT matching when the ID reads fail. If the ULPI spec had some generic power sequencing for these registers we could put that into the ULPI bus layer and power up the device before reading the ID registers. Unfortunately this doesn't exist and the power sequence is usually device specific. By having the device matched up with DT we can avoid this problem. Cc: Greg Kroah-Hartman <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Cc: <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2016-09-14Merge tag 'usb-for-v4.9' of ↵Greg Kroah-Hartman1-5/+6
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v4.9 merge window This time around we have 92 non-merge commits. Most of the changes are in drivers/usb/gadget (40.3%) with drivers/usb/gadget/function being the most active directory (27.2%). As for UDC drivers, only dwc3 (26.5%) and dwc2 (12.7%) have really been active. The most important changes for dwc3 are better support for scatterlist and, again, throughput improvements. While on dwc2 got some minor stability fixes related to soft reset and FIFO usage. Felipe Tonello has done some good work fixing up our f_midi gadget and Tal Shorer has implemented a nice API change for our ULPI bus. Apart from these, we have our usual set of non-critical fixes, spelling fixes, build warning fixes, etc.
2016-09-06usb: ulpi: make ops struct constantTal Shorer1-1/+2
None of the core ulpi functions perform any changes to the operations struct, and logically as a struct that contains function pointers there's no reason it shouldn't be constant. Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Tal Shorer <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-09-06usb: ulpi: remove "dev" field from struct ulpi_opsTal Shorer1-1/+0
Operations now use ulpi->dev.parent directly instead of via the ulpi_ops struct, making this field unused. Remove it. Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Tal Shorer <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-09-06usb: ulpi: rename operations {read|write}_dev to simply {read|write}Tal Shorer1-2/+2
With the removal of the old {read|write} operations, we can now safely rename the new api operations {read|write}_dev to use the shorter and clearer names {read|write}, respectively. Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Tal Shorer <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-09-06usb: ulpi: remove calls to old api callbacksTal Shorer1-4/+0
Now that all users use the new api callbacks, remove the old api callbacks and force new interface drivers to use the new api. Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Tal Shorer <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-09-06usb: ulpi: add new api functions, {read|write}_dev()Tal Shorer1-2/+6
Add these two new api callbacks to struct ulpi_ops. These are different than read, write in that they pass the parent device directly instead of via the ops argument. They are intended to replace the old api functions. If the new api callbacks are missing, revert to calling the old ones as before. Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Tal Shorer <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-09-06usb: ulpi: move setting of ulpi->dev parent up in ulpi_register()Tal Shorer1-1/+2
Once ulpi operations use the parent device directly, this will be needed during the operations used in ulpi_register() itself, so set the parent field before calling any ulpi operations. Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Tal Shorer <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-08-09usb: ulpi: Automatically set driver::owner with ulpi_driver_register()Stephen Boyd1-2/+3
Let's follow other driver registration functions and automatically set the driver's owner member to THIS_MODULE when ulpi_driver_register() is called. This allows ulpi driver writers to forget about this boiler plate detail and avoids common bugs in the process. Signed-off-by: Stephen Boyd <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2015-07-20usb: ulpi: ulpi_init should be executed in subsys_initcallLu Baolu1-1/+1
Phy drivers and the ulpi interface providers depend on the registration of the ulpi bus. Ulpi registers the bus in module_init(). This could cause unnecessary bus users' probe delays. i.e. unnecessary -EPROBE_DEFER happening on ulpi_drivers in case they're registered before ulpi bus itself. Reported-by: Zhuo Qiuxu <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-05-13usb: add bus type for USB ULPIHeikki Krogerus1-0/+255
UTMI+ Low Pin Interface (ULPI) is a commonly used PHY interface for USB 2.0. The ULPI specification describes a standard set of registers which the vendors can extend for their specific needs. ULPI PHYs provide often functions such as charger detection and ADP sensing and probing. There are two major issues that the bus type is meant to tackle: Firstly, ULPI registers are accessed from the controller. The bus provides convenient method for the controller drivers to share that access with the actual PHY drivers. Secondly, there are already platforms that assume ULPI PHYs are runtime detected, such as many Intel Baytrail based platforms. They do not provide any kind of hardware description for the ULPI PHYs like separate ACPI device object that could be used to enumerate a device from. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: David Cohen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>