1
0
Fork 0
Commit Graph

24 Commits (0d945c1f966b2bcb67bb12be749da0a7fb00201b)

Author SHA1 Message Date
Johan Hovold c3c0ac70c7 USB: phy: drop legacy board-file support
The legacy interface for associating controllers with phys from board
files and platform code has been unused since commit 9080b8dc76 ("ARM:
OMAP2+: Remove legacy usb-host.c platform init code"). Since then, all
calls to usb_get_phy_dev() and its devres version have been returning
-ENODEV.

Now that the final calls to these functions have been removed, we can
drop this legacy lookup interface altogether.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-22 15:58:24 +02:00
Johan Hovold 60b9f942bc USB: phy: drop unused legacy controller-phy bind helper
Drop the unused legacy usb_bind_phy() helper whose last user was removed
in 2016 when OMAP moved to device-tree boot (9080b8dc76 ("ARM: OMAP2+:
Remove legacy usb-host.c platform init code")).

Note that this means that for the last couple of years the phy_bind_list
has been empty (when using mainline kernels) and that consequently all
phy lookups using the usb_get_phy_dev() interface have failed with
-ENODEV. This helper along with its current users will be removed by
follow-on patches.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-22 15:58:23 +02:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Baolin Wang eb3c74de28 usb: phy: Avoid unchecked dereference warning
Move the USB phy NULL checking before issuing usb_phy_set_charger_current()
to avoid unchecked dereference warning.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-31 18:08:47 +02:00
Baolin Wang a9081a008f usb: phy: Add USB charger support
This patch introduces the usb charger support based on usb phy that
makes an enhancement to a power driver. The basic conception of the
usb charger is that, when one usb charger is added or removed by
reporting from the extcon device state change, the usb charger will
report to power user to set the current limitation.

Power user can register a notifiee on the usb phy by issuing
usb_register_notifier() to get notified by charger status changes
or charger current changes.

we can notify what current to be drawn to power user according to
different charger type, and now we have 2 methods to get charger type.
One is get charger type from extcon subsystem, which also means the
charger state changes. Another is we can get the charger type from
USB controller detecting or PMIC detecting, and the charger state
changes should be told by issuing usb_phy_set_charger_state().

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-08-15 15:05:01 +03:00
Baolin Wang 7d21114dc6 usb: phy: Introduce one extcon device into usb phy
Usually usb phy need register one extcon device to get the connection
notifications. It will remove some duplicate code if the extcon device
is registered using common code instead of each phy driver having its
own related extcon APIs. So we add one pointer of extcon device into
usb phy structure, and some other helper functions to register extcon.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17 14:15:28 +03:00
Peter Chen 58efd4b06d usb: phy: change some comments
- Replace all "transceiver" with "phy"
- Replace one "OTG controller" with "phy"

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Arnd Bergmann 307c858bc2 usb: phy: add static inline wrapper for devm_usb_get_phy_by_node
The newly introduced devm_usb_get_phy_by_node function only has
an extern declaration, but no alternative for the case that
CONFIG_USB_PHY is disabled, which leads to a build error when
it is used anyway:

drivers/power/twl4030_charger.c: In function 'twl4030_bci_probe':
drivers/power/twl4030_charger.c:648:23: error: implicit declaration of function 'devm_usb_get_phy_by_node' [-Werror=implicit-function-declaration]
    bci->transceiver = devm_usb_get_phy_by_node(

This adds the wrapper in the same way that we have one for
all other usb-phy API functions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: e842b84c8e ("usb: phy: Add interface to get phy give of device_node.")
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-28 09:15:32 -05:00
NeilBrown e842b84c8e usb: phy: Add interface to get phy give of device_node.
Split the "get phy from device_node" functionality out of
"get phy by phandle" so it can be used directly.

This is useful when a battery-charger is intimately associated with a
particular phy but handled by a separate driver.  The charger
can find the device_node based on sibling relationships
without the need for a redundant declaration in the devicetree
description.

As a peripheral that gets a phy will often want to register a
notifier block, and de-register it later, that functionality
is included so the de-registration is automatic.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26 10:42:28 -05:00
Peter Chen 0767320477 usb: phy: change some comments
- Delete the OTG stuffs
- .set_suspend is for controller, not for A-device or B-device.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Kiran Raparthy df9f7b311d usb: phy: introduce usb_phy_set_event interface
PHY drivers require a generic interface to handle per-PHY events.

usb_phy_set_event interface sets event to phy event.
PHY drivers call this interface for each phy event.

Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Android Kernel Team <kernel-team@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Arve Hj�nnev�g <arve@android.com>
Cc: Benoit Goby <benoit@android.com>
[Original patch in Android from Todd]
Cc: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-21 09:05:45 -06:00
Antoine Tenart e47d92545c usb: move the OTG state from the USB PHY to the OTG structure
Before using the PHY framework instead of the USB PHY one, we need to
move the OTG state into another place, since it won't be available when
USB PHY isn't used. This patch moves the OTG state into the OTG
structure, and makes all the needed modifications in the drivers
using the OTG state.

[ balbi@ti.com : fix build regressions with phy-tahvo.c, musb_dsps.c,
		phy-isp1301-omap, and chipidea's debug.c ]

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:25 -06:00
Peter Chen 57bf9b09a6 usb: phy: Add set_wakeup API
This API is used to set wakeup enable at PHY registers, in that
case, the PHY can be waken up from suspend due to external events,
like vbus change, dp/dm change and id change.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05 14:40:08 -06:00
Felipe Balbi 410aee70f0 usb: phy: protect against NULL phy pointers
In order to decrease the amount of work done
by PHY users, allow NULL phy pointers to be
passed.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-29 13:56:45 +03:00
Michael Grzeschik 1c9af65357 usb: add devicetree helpers for determining dr_mode and phy_type
This adds two little devicetree helper functions for determining the
dr_mode (host, peripheral, otg) and phy_type (utmi, ulpi,...) from
the devicetree.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 13:47:09 -07:00
Felipe Balbi b7fa5c2aec usb: phy: return -ENXIO when PHY layer isn't enabled
in cases where PHY layer isn't enabled, we want
to still return an error code (actually an error
pointer) so that our users don't need to cope with
either error pointer of NULL.

This will simplify users as below:

-	return IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV;
+	return PTR_ERR(phy);

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:26 +02:00
Felipe Balbi b774212ea5 usb: phy: introduce ->set_vbus() method
this method will be used to enable or disable
the charge pump.

Whenever we have DRD devices, we need to be
able to turn VBUS on or off whenever we want.

Note that in the ideal case, this would be
controlled by the ID-pin Interrupt, but not
all devices have ID-pin properly routed since
manufacturers can choose to save that trace
if they're building a host-only product out
of a DRD IP.

This is also useful during debugging where
we might not have the proper cable hanging
around.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:09 +02:00
Felipe Balbi edc7cb2e95 usb: phy: make it a menuconfig
We already have a considerable amount of USB
PHY drivers, making it a menuconfig just
prevents us from adding too much churn to
USB's menuconfig.

While at that, also select USB_OTG_UTILS from
this new menuconfig just to keep backwards
compatibility until we manage to remove
that symbol.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:05 +02:00
Kishon Vijay Abraham I 5d3c28b5a4 usb: otg: add device tree support to otg library
Added an API devm_usb_get_phy_by_phandle(), to get usb phy by passing a
device node phandle value. This function will return a pointer to
the phy on success, -EPROBE_DEFER if there is a device_node for the phandle,
but the phy has not been added, or a ERR_PTR() otherwise.

Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-25 10:20:14 +02:00
Kishon Vijay Abraham I 0fa4fab4ee usb: otg: utils: add facilities in phy lib to support multiple PHYs of same type
In order to add support for multipe PHY's of the same type, new API's
for adding PHY and getting PHY has been added. Now the binding
information for the PHY and controller should be done in platform file
using usb_bind_phy API. And for getting a PHY, the device pointer of the
USB controller and an index should be passed. Based on the binding
information that is added in the platform file, usb_get_phy_dev will return the
appropriate PHY.
Already existing API's to add and get phy by type is not removed. These
API's are deprecated and will be removed once all the platforms start to
use the new API.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-25 10:20:14 +02:00
Kishon Vijay Abraham I b4a83e4df1 usb: otg: add an api to bind the usb controller and phy
In order to support platforms which has multiple PHY's (of same type) and
which has multiple USB controllers, a new design is adopted wherin the binding
information (between the PHY and the USB controller) should be passed to the
PHY library from platform specific file (board file).
So added a new API to pass the binding information.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-25 10:20:09 +02:00
Peter Chen ac96511bb5 usb: phy: change phy notify connect/disconnect API
The old parameter "port" is useless for phy notify, as one usb
phy is only for one usb port. New parameter "speed" stands for
the device's speed which is on the port, this "speed" parameter
is needed at some platforms which will do some phy operations
according to device's speed.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Tested-by: Mike Thompson <mpthompson@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:44:51 -08:00
Venu Byravarasu a4c3ddec5c usb: phy: fix build break
During phy interface separation from otg.h, as the enum "usb_otg_state"
was having multiple otg states info and removal of member 'state'
of this enum type from usb_phy struct did not generate any compilation
issues, I removed member state from struct usb_phy.

As this is causing build break in musb code, adding member 'state'
to usb_phy structure.

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-06 16:01:11 +03:00
Venu Byravarasu de4217d90f usb: otg: Move phy interface to separate file.
As otg.h is containing lots of phy interface related
stuff, moving all phy interface related stuff to new
file named phy.h

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-05 15:33:16 +03:00