<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/drivers/phy, branch v4.9-rc2</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>phy-twl4030-usb: initialize charging-related stuff via pm_runtime</title>
<updated>2016-09-14T05:29:12+00:00</updated>
<author>
<name>Andreas Kemnade</name>
<email>andreas@kemnade.info</email>
</author>
<published>2016-08-24T22:27:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=b78ea84a7d45b9e5ad2eee429a2140065a39d755'/>
<id>b78ea84a7d45b9e5ad2eee429a2140065a39d755</id>
<content type='text'>
twl4030_phy_power_on() initializes some bits which are required for
charging. As they are not set in twl4030_usb_runtime_resume()
a call to pm_runtime_get_sync() is not sufficient to enable charging.

This patch moves the initialization to twl4030_usb_runtime_resume()
so everything needed for charging is initialized upon
pm_runtime_get_sync().

That also gives improved possibilities to debug problems in that area
because the relevant parts can be checked separately. Charging can be
enabled without having the musb subsystem active.

As a side effect this hides some bugs in musb which causes
unbalanced calls to phy_power_off()/phy_power_on() so that
phy-&gt;power_count becomes -1.

The result is that e.g. the GTA04 phone (dm3730 + twl4030) works
finally as a usb gadget again and charging is working.

Signed-off-by: Andreas Kemnade &lt;andreas@kemnade.info&gt;
Acked-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
twl4030_phy_power_on() initializes some bits which are required for
charging. As they are not set in twl4030_usb_runtime_resume()
a call to pm_runtime_get_sync() is not sufficient to enable charging.

This patch moves the initialization to twl4030_usb_runtime_resume()
so everything needed for charging is initialized upon
pm_runtime_get_sync().

That also gives improved possibilities to debug problems in that area
because the relevant parts can be checked separately. Charging can be
enabled without having the musb subsystem active.

As a side effect this hides some bugs in musb which causes
unbalanced calls to phy_power_off()/phy_power_on() so that
phy-&gt;power_count becomes -1.

The result is that e.g. the GTA04 phone (dm3730 + twl4030) works
finally as a usb gadget again and charging is working.

Signed-off-by: Andreas Kemnade &lt;andreas@kemnade.info&gt;
Acked-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>phy-twl4030-usb: better handle musb_mailbox() failure</title>
<updated>2016-09-14T05:29:11+00:00</updated>
<author>
<name>Andreas Kemnade</name>
<email>andreas@kemnade.info</email>
</author>
<published>2016-08-22T19:24:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=78489c7c48d462c2a4fa9f388dd091f829573b64'/>
<id>78489c7c48d462c2a4fa9f388dd091f829573b64</id>
<content type='text'>
setting twl-&gt;linkstat = MUSB_UNKNOWN upon error in musb_mailbox as
introduced in
commit 12b7db2bf8b8 ("usb: musb: Return error value from musb_mailbox")
causes twl4030_usb_irq() to not detect a state change form cable connected
to cable disconnected after such an error so that
pm_runtime_put_autosuspend() will not be called and the usage counter
gets unbalanced. Such errors happen e.g. if the omap2430 module is not
(yet) loaded during plug/unplug events.

This patch introduces a flag instead that indicates whether there is
information for the musb_mailbox pending and calls musb_mailbox() if
that flag is set.

Signed-off-by: Andreas Kemnade &lt;andreas@kemnade.info&gt;
Tested-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
setting twl-&gt;linkstat = MUSB_UNKNOWN upon error in musb_mailbox as
introduced in
commit 12b7db2bf8b8 ("usb: musb: Return error value from musb_mailbox")
causes twl4030_usb_irq() to not detect a state change form cable connected
to cable disconnected after such an error so that
pm_runtime_put_autosuspend() will not be called and the usage counter
gets unbalanced. Such errors happen e.g. if the omap2430 module is not
(yet) loaded during plug/unplug events.

This patch introduces a flag instead that indicates whether there is
information for the musb_mailbox pending and calls musb_mailbox() if
that flag is set.

Signed-off-by: Andreas Kemnade &lt;andreas@kemnade.info&gt;
Tested-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>phy: sun4i-usb: Use spinlock to guard phyctl register access</title>
<updated>2016-09-10T12:13:38+00:00</updated>
<author>
<name>Chen-Yu Tsai</name>
<email>wens@csie.org</email>
</author>
<published>2016-09-09T03:58:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=919ab2524c52e5f801d8873f09145ce822cdd43a'/>
<id>919ab2524c52e5f801d8873f09145ce822cdd43a</id>
<content type='text'>
The musb driver calls into this phy driver to disable/enable squelch
detection. This function was introduced in 24fe86a617c5 ("phy: sun4i-usb:
Add a sunxi specific function for setting squelch-detect"). This
function in turn calls sun4i_usb_phy_write, which uses a mutex to
guard the common access register. Unfortunately musb does this
in atomic context, which results in the following warning with lock
debugging enabled:

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:97
in_atomic(): 1, irqs_disabled(): 128, pid: 96, name: kworker/0:2
CPU: 0 PID: 96 Comm: kworker/0:2 Not tainted 4.8.0-rc4-00181-gd502f8ad1c3e #13
Hardware name: Allwinner sun8i Family
Workqueue: events musb_deassert_reset
[&lt;c010bc01&gt;] (unwind_backtrace) from [&lt;c0109237&gt;] (show_stack+0xb/0xc)
[&lt;c0109237&gt;] (show_stack) from [&lt;c02a669b&gt;] (dump_stack+0x67/0x74)
[&lt;c02a669b&gt;] (dump_stack) from [&lt;c05d68c9&gt;] (mutex_lock+0x15/0x2c)
[&lt;c05d68c9&gt;] (mutex_lock) from [&lt;c02c3589&gt;] (sun4i_usb_phy_write+0x39/0xec)
[&lt;c02c3589&gt;] (sun4i_usb_phy_write) from [&lt;c03e6327&gt;] (musb_port_reset+0xfb/0x184)
[&lt;c03e6327&gt;] (musb_port_reset) from [&lt;c03e4917&gt;] (musb_deassert_reset+0x1f/0x2c)
[&lt;c03e4917&gt;] (musb_deassert_reset) from [&lt;c012ecb5&gt;] (process_one_work+0x129/0x2b8)
[&lt;c012ecb5&gt;] (process_one_work) from [&lt;c012f5e3&gt;] (worker_thread+0xf3/0x424)
[&lt;c012f5e3&gt;] (worker_thread) from [&lt;c0132dbd&gt;] (kthread+0xa1/0xb8)
[&lt;c0132dbd&gt;] (kthread) from [&lt;c0105f31&gt;] (ret_from_fork+0x11/0x20)

Since the register access is mmio, we can use a spinlock to guard this
specific access, rather than the mutex that guards the entire phy.

Fixes: ba4bdc9e1dc0 ("PHY: sunxi: Add driver for sunxi usb phy")
Cc: Hans de Goede &lt;hdegoede@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Chen-Yu Tsai &lt;wens@csie.org&gt;
Reviewed-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The musb driver calls into this phy driver to disable/enable squelch
detection. This function was introduced in 24fe86a617c5 ("phy: sun4i-usb:
Add a sunxi specific function for setting squelch-detect"). This
function in turn calls sun4i_usb_phy_write, which uses a mutex to
guard the common access register. Unfortunately musb does this
in atomic context, which results in the following warning with lock
debugging enabled:

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:97
in_atomic(): 1, irqs_disabled(): 128, pid: 96, name: kworker/0:2
CPU: 0 PID: 96 Comm: kworker/0:2 Not tainted 4.8.0-rc4-00181-gd502f8ad1c3e #13
Hardware name: Allwinner sun8i Family
Workqueue: events musb_deassert_reset
[&lt;c010bc01&gt;] (unwind_backtrace) from [&lt;c0109237&gt;] (show_stack+0xb/0xc)
[&lt;c0109237&gt;] (show_stack) from [&lt;c02a669b&gt;] (dump_stack+0x67/0x74)
[&lt;c02a669b&gt;] (dump_stack) from [&lt;c05d68c9&gt;] (mutex_lock+0x15/0x2c)
[&lt;c05d68c9&gt;] (mutex_lock) from [&lt;c02c3589&gt;] (sun4i_usb_phy_write+0x39/0xec)
[&lt;c02c3589&gt;] (sun4i_usb_phy_write) from [&lt;c03e6327&gt;] (musb_port_reset+0xfb/0x184)
[&lt;c03e6327&gt;] (musb_port_reset) from [&lt;c03e4917&gt;] (musb_deassert_reset+0x1f/0x2c)
[&lt;c03e4917&gt;] (musb_deassert_reset) from [&lt;c012ecb5&gt;] (process_one_work+0x129/0x2b8)
[&lt;c012ecb5&gt;] (process_one_work) from [&lt;c012f5e3&gt;] (worker_thread+0xf3/0x424)
[&lt;c012f5e3&gt;] (worker_thread) from [&lt;c0132dbd&gt;] (kthread+0xa1/0xb8)
[&lt;c0132dbd&gt;] (kthread) from [&lt;c0105f31&gt;] (ret_from_fork+0x11/0x20)

Since the register access is mmio, we can use a spinlock to guard this
specific access, rather than the mutex that guards the entire phy.

Fixes: ba4bdc9e1dc0 ("PHY: sunxi: Add driver for sunxi usb phy")
Cc: Hans de Goede &lt;hdegoede@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Chen-Yu Tsai &lt;wens@csie.org&gt;
Reviewed-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup</title>
<updated>2016-09-10T12:01:40+00:00</updated>
<author>
<name>Randy Li</name>
<email>ayaka@soulik.info</email>
</author>
<published>2016-09-09T18:59:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=0f74ab59ce8712e7e2bb1e4517033328e626b27c'/>
<id>0f74ab59ce8712e7e2bb1e4517033328e626b27c</id>
<content type='text'>
It is a hardware bug in RK3288, the only way to solve it is to
reset the phy.

Signed-off-by: Randy Li &lt;ayaka@soulik.info&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is a hardware bug in RK3288, the only way to solve it is to
reset the phy.

Signed-off-by: Randy Li &lt;ayaka@soulik.info&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>phy: Add reset callback</title>
<updated>2016-09-10T12:01:39+00:00</updated>
<author>
<name>Randy Li</name>
<email>ayaka@soulik.info</email>
</author>
<published>2016-09-09T18:59:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=cac18ecb6f44b11bc303d7afbae3887b27938fa4'/>
<id>cac18ecb6f44b11bc303d7afbae3887b27938fa4</id>
<content type='text'>
The only use for this is for solving a hardware design problem in
usb of Rockchip RK3288.

Signed-off-by: Randy Li &lt;ayaka@soulik.info&gt;
Reviewed-by: Heiko Stuebner &lt;heiko@sntech.de&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The only use for this is for solving a hardware design problem in
usb of Rockchip RK3288.

Signed-off-by: Randy Li &lt;ayaka@soulik.info&gt;
Reviewed-by: Heiko Stuebner &lt;heiko@sntech.de&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>phy-sun4i-usb: Warn when external vbus is detected</title>
<updated>2016-09-10T11:45:19+00:00</updated>
<author>
<name>Hans de Goede</name>
<email>hdegoede@redhat.com</email>
</author>
<published>2016-09-07T20:20:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=91d6e3b6bcf2625a07fec22a9af37ddbfd91a0df'/>
<id>91d6e3b6bcf2625a07fec22a9af37ddbfd91a0df</id>
<content type='text'>
Warn when external vbus is detected when we're trying to enable our
own vbus.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Warn when external vbus is detected when we're trying to enable our
own vbus.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>phy-sun4i-usb: Add support for phy_set_mode</title>
<updated>2016-09-10T11:45:19+00:00</updated>
<author>
<name>Hans de Goede</name>
<email>hdegoede@redhat.com</email>
</author>
<published>2016-09-07T20:20:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6ba43c2919613dad1a880fcab19cda1d68a5ce3d'/>
<id>6ba43c2919613dad1a880fcab19cda1d68a5ce3d</id>
<content type='text'>
Together with some musb sunxi glue changes this allows run-time dr_mode
switching support via the "mode" musb sysfs attribute.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Together with some musb sunxi glue changes this allows run-time dr_mode
switching support via the "mode" musb sysfs attribute.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>phy-sun4i-usb: Simplify missing dr_mode handling</title>
<updated>2016-09-10T11:45:19+00:00</updated>
<author>
<name>Hans de Goede</name>
<email>hdegoede@redhat.com</email>
</author>
<published>2016-09-07T20:20:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=5f90d31cab915e2405f8875e21239d4a6003a170'/>
<id>5f90d31cab915e2405f8875e21239d4a6003a170</id>
<content type='text'>
If we cannot get dr_mode or no id gpio is specified simply assume
peripheral mode, as this is always safe.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we cannot get dr_mode or no id gpio is specified simply assume
peripheral mode, as this is always safe.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>phy-sun4i-usb: Refactor forced session ending</title>
<updated>2016-09-10T11:45:19+00:00</updated>
<author>
<name>Hans de Goede</name>
<email>hdegoede@redhat.com</email>
</author>
<published>2016-09-07T20:20:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=36f9159ba99076ab643794a83735197b4042b16f'/>
<id>36f9159ba99076ab643794a83735197b4042b16f</id>
<content type='text'>
The phy-sun4i-usb code supports forced ending a session on systems
which lack Vbus detection, to allow switching between host and peripheral
mode on such systems.

Role switching via the musb driver "mode" sysfs attribute requires force
ending the session too. This commit refactors the code to allow other
parts of the phy-sun4i-usb code to request a forced session end.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The phy-sun4i-usb code supports forced ending a session on systems
which lack Vbus detection, to allow switching between host and peripheral
mode on such systems.

Role switching via the musb driver "mode" sysfs attribute requires force
ending the session too. This commit refactors the code to allow other
parts of the phy-sun4i-usb code to request a forced session end.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>phy-sun4i-usb: Use bool where appropriate</title>
<updated>2016-09-10T11:45:19+00:00</updated>
<author>
<name>Hans de Goede</name>
<email>hdegoede@redhat.com</email>
</author>
<published>2016-09-07T20:20:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9745ceebc4e1e593ddba1b1a104a4a99f2b9a556'/>
<id>9745ceebc4e1e593ddba1b1a104a4a99f2b9a556</id>
<content type='text'>
We're using bool as true/false type in most places in phy-sun4i-usb.c
for consistency fixup the remaining uses of ints which are ever only
0 or 1 to be bools too.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We're using bool as true/false type in most places in phy-sun4i-usb.c
for consistency fixup the remaining uses of ints which are ever only
0 or 1 to be bools too.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
