phy: for 4.8 merge window
Subsystems (5)
Hi Greg,
Please find the pull request for 4.8 merge window below.
Now the controller can configure the mode in which the PHY should work using the new phy_set_mode API. This was added by David Lechner required for da8xx-usb phy (used by MUSB). For this I created a signed tag 'phy-set-mode-v2' since the phy_set_mode API is called from musb driver which is not part of this pull request. This also adds a new phy driver for USB PHY in DA8xx SoC and includes other minor cleanups and fixes.
Consider merging this for the next merge window. Let me know if I have to change something.
The following changes since commit 04e59a0211ff012ba60c00baca673482570784e9:
phy-sun4i-usb: Fix irq free conditions to match request conditions (2016-06-22 11:33:46 +0530)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/phy-for-4.8-rc1
for you to fetch changes up to c14f8a4032efa73d9c4e155add47c19252b3bdf4:
phy: rcar-gen3-usb2: fix mutex_lock calling in interrupt (2016-07-04 18:07:39 +0530)
----------------------------------------------------------------
phy: for 4.8 -rc1
*) Add a new phy_ops for setting the phy mode
*) Add a new phy driver for DA8xx SoC USB PHY
*) Minor fixes and cleanups
----------------------------------------------------------------
David Lechner (3):
phy: Add set_mode callback
dt-bindings: Add bindings for phy-da8xx-usb
phy: da8xx-usb: new driver for DA8xx SoC USB PHY
Hans de Goede (1):
phy-sun4i-usb: Add workaround for missing Vbus det interrupts on A31
Heiko Stuebner (1):
phy: rockchip-usb: should be a child device of the GRF
Kishon Vijay Abraham I (2):
phy: xgene: rename "enum phy_mode" to "enum xgene_phy_mode"
Merge tag 'phy-set-mode-v2' of git://git.kernel.org/.../kishon/linux-phy into next
Peter Griffin (2):
phy: phy-qcom-ufs-qmp-20nm: Remove site specific OOM error message
phy: phy-qcom-ufs-qmp-14nm: Remove site specific OOM error message
Sudip Mukherjee (1):
phy: rockhip-usb: use devm_add_action_or_reset()
Yoshihiro Shimoda (1):
phy: rcar-gen3-usb2: fix mutex_lock calling in interrupt
.../devicetree/bindings/phy/phy-da8xx-usb.txt | 40 ++++ .../devicetree/bindings/phy/rockchip-usb-phy.txt | 27 ++- drivers/phy/Kconfig | 10 + drivers/phy/Makefile | 1 + drivers/phy/phy-core.c | 15 ++ drivers/phy/phy-da8xx-usb.c | 245 ++++++++++++++++++++ drivers/phy/phy-qcom-ufs-qmp-14nm.c | 1 - drivers/phy/phy-qcom-ufs-qmp-20nm.c | 1 - drivers/phy/phy-rcar-gen3-usb2.c | 26 ++- drivers/phy/phy-rockchip-usb.c | 23 +- drivers/phy/phy-sun4i-usb.c | 34 ++- drivers/phy/phy-xgene.c | 4 +- include/linux/phy/phy.h | 17 ++ 13 files changed, 408 insertions(+), 36 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/phy-da8xx-usb.txt create mode 100644 drivers/phy/phy-da8xx-usb.c
PATCH 1/10 phy: xgene: rename "enum phy_mode" to "enum xgene_phy_mode"
No functional change. Rename "enum phy_mode" to "enum xgene_phy_mode" in xgene phy driver in preparation for adding set_mode callback in phy core.
--- drivers/phy/phy-xgene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-xgene.c +2 -2
@@ -518,7 +518,7 @@ enum clk_type_t { CLK_INT_SING = 2, /* Internal single ended */ }; -enum phy_mode { +enum xgene_phy_mode {MODE_SATA =0 ,/* List them for simple reference */ MODE_SGMII =1 ,MODE_PCIE =2 ,
@@ -542,7 +542,7 @@ struct xgene_sata_override_param {struct xgene_phy_ctx {struct device *dev;struct phy *phy; -enum phy_mode mode;/* Mode of operation */ +enum xgene_phy_mode mode;/* Mode of operation */ enum clk_type_t clk_type;/* Input clock selection */ void __iomem *sds_base;/* PHY CSR base addr */ struct clk *clk;/* Optional clock */
Signature · 1 line
1.7.9.5
PATCH 2/10 phy: Add set_mode callback
In reply to Kishon Vijay Abraham IFrom: David Lechner <[email protected]>
The initial use for this is for PHYs that have a mode related to USB OTG. There are several SoCs (e.g. TI OMAP and DA8xx) that have a mode setting in the USB PHY to override OTG VBUS and ID signals.
Of course, the enum can be expaned in the future to include modes for other types of PHYs as well.
--- drivers/phy/phy-core.c | 15 +++++++++++++++ include/linux/phy/phy.h | 17 +++++++++++++++++ 2 files changed, 32 insertions(+)
drivers/phy/phy-core.c +15 -0
@@ -342,6 +342,21 @@ int phy_power_off(struct phy *phy) }EXPORT_SYMBOL_GPL (phy_power_off); +int phy_set_mode (struct phy *phy,enum phy_mode mode) +{ +int ret; + +if (!phy || !phy->ops->set_mode) +return 0 ; + +mutex_lock (&phy->mutex); + ret = phy->ops->set_mode (phy, mode); +mutex_unlock (&phy->mutex); + +return ret; +} +EXPORT_SYMBOL_GPL (phy_set_mode); +/** * _of_phy_get() - lookup and obtain a reference to a phy by phandle * @np: device_node for which to get the phy
include/linux/phy/phy.h +17 -0
@@ -22,12 +22,20 @@struct phy ; +enum phy_mode { +PHY_MODE_INVALID , +PHY_MODE_USB_HOST , +PHY_MODE_USB_DEVICE , +PHY_MODE_USB_OTG , +}; +/** * struct phy_ops - set of function pointers for performing phy operations * @init: operation to be performed for initializing phy * @exit: operation to be performed while exiting * @power_on: powering on the phy * @power_off: powering off the phy +* @set_mode: set the mode of the phy * @owner: the module owner containing the ops */ struct phy_ops {
@@ -35,6 +43,7 @@ struct phy_ops {int (*exit)(struct phy *phy);int (*power_on)(struct phy *phy);int (*power_off)(struct phy *phy); +int (*set_mode)(struct phy *phy,enum phy_mode mode);struct module *owner; };
@@ -126,6 +135,7 @@ int phy_init(struct phy *phy);int phy_exit (struct phy *phy);int phy_power_on (struct phy *phy);int phy_power_off (struct phy *phy); +int phy_set_mode (struct phy *phy,enum phy_mode mode);static inline int phy_get_bus_width (struct phy *phy) {return phy->attrs.bus_width;
@@ -233,6 +243,13 @@ static inline int phy_power_off(struct phy *phy)return -ENOSYS ; } +static inline int phy_set_mode (struct phy *phy,enum phy_mode mode) +{ +if (!phy) +return 0 ; +return -ENOSYS ; +} +static inline int phy_get_bus_width (struct phy *phy) {return -ENOSYS ;
Signature · 1 line
1.7.9.5
PATCH 3/10 dt-bindings: Add bindings for phy-da8xx-usb
In reply to Kishon Vijay Abraham IFrom: David Lechner <[email protected]>
Device tree binding for new phy-da8xx-usb driver.
--- .../devicetree/bindings/phy/phy-da8xx-usb.txt | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-da8xx-usb.txt
Documentation/devicetree/bindings/phy/phy-da8xx-usb.txt new file +40 -0
@@ -0,0 +1,40 @@ +TI DA8xx/OMAP-L1xx/AM18xx USB PHY + +Required properties: + - compatible: must be "ti,da830-usb-phy". + - #phy-cells: must be 1. + +This device controls the PHY for both the USB 1.1 OHCI and USB 2.0 OTG +controllers on DA8xx SoCs. Consumers of this device should use index 0 for +the USB 2.0 phy device and index 1 for the USB 1.1 phy device. + +It also requires a "syscon" node with compatible = "ti,da830-cfgchip", "syscon" +to access the CFGCHIP2 register. + +Example: + + cfgchip: cfgchip@1417c { + compatible = "ti,da830-cfgchip", "syscon"; + reg = <0x1417c 0x14>; + }; + + usb_phy: usb-phy { + compatible = "ti,da830-usb-phy"; + #phy-cells = <1>; + }; + + usb20: usb@200000 { + compatible = "ti,da830-musb"; + reg = <0x200000 0x1000>; + interrupts = <58>; + phys = <&usb_phy 0>; + phy-names = "usb-phy"; + }; + + usb11: usb@225000 { + compatible = "ti,da830-ohci"; + reg = <0x225000 0x1000>; + interrupts = <59>; + phys = <&usb_phy 1>; + phy-names = "usb-phy"; + };
Signature · 1 line
1.7.9.5
PATCH 4/10 phy: da8xx-usb: new driver for DA8xx SoC USB PHY
In reply to Kishon Vijay Abraham IFrom: David Lechner <[email protected]>
This is a new phy driver for the SoC USB controllers on the TI DA8xx family of microcontrollers. The USB 1.1 PHY is just a simple on/off. The USB 2.0 PHY also allows overriding the VBUS and ID pins.
--- drivers/phy/Kconfig | 10 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-da8xx-usb.c | 245 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 256 insertions(+) create mode 100644 drivers/phy/phy-da8xx-usb.c
drivers/phy/Kconfig +10 -0
@@ -44,6 +44,16 @@ config ARMADA375_USBCLUSTER_PHY depends on OF && HAS_IOMEM select GENERIC_PHY +config PHY_DA8XX_USB + tristate "TI DA8xx USB PHY Driver" + depends on ARCH_DAVINCI_DA8XX + select GENERIC_PHY + select MFD_SYSCON + help + Enable this to support the USB PHY on DA8xx SoCs. + + This driver controls both the USB 1.1 PHY and the USB 2.0 PHY. + config PHY_DM816X_USB tristate "TI dm816x USB PHY driver" depends on ARCH_OMAP2PLUS
drivers/phy/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_GENERIC_PHY) += phy-core.o obj-$(CONFIG_PHY_BCM_NS_USB2) += phy-bcm-ns-usb2.o obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o +obj-$(CONFIG_PHY_DA8XX_USB) += phy-da8xx-usb.o obj-$(CONFIG_PHY_DM816X_USB) += phy-dm816x-usb.o obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY) += phy-armada375-usb2.o obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o
drivers/phy/phy-da8xx-usb.c new file +245 -0
245 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 5/10 phy: rockchip-usb: should be a child device of the GRF
In reply to Kishon Vijay Abraham IFrom: Heiko Stuebner <[email protected]>
The usb-phy is fully enclosed in the general register files (GRF). Therefore as seen from the device-tree it shouldn't be a separate platform-device but instead a sub-device of the GRF - using the simply-mfd mechanism.
As the usb-phy is part of the kernel for some releases now, we keep the old (and now deprecated) binding for compatibility purposes.
--- .../devicetree/bindings/phy/rockchip-usb-phy.txt | 27 ++++++++++++-------- drivers/phy/phy-rockchip-usb.c | 15 ++++++++--- 2 files changed, 29 insertions(+), 13 deletions(-)
Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt +17 -10
@@ -5,11 +5,13 @@ Required properties: "rockchip,rk3066a-usb-phy" "rockchip,rk3188-usb-phy" "rockchip,rk3288-usb-phy" - - rockchip,grf : phandle to the syscon managing the "general - register files" - #address-cells: should be 1 - #size-cells: should be 0 +Deprecated properties: + - rockchip,grf : phandle to the syscon managing the "general + register files" - phy should be a child of the GRF instead + Sub-nodes: Each PHY should be represented as a sub-node.
@@ -28,14 +30,19 @@ Optional Properties: Example: -usbphy: phy { - compatible = "rockchip,rk3288-usb-phy"; - rockchip,grf = <&grf>; - #address-cells = <1>; - #size-cells = <0>; +grf: syscon@ff770000 { + compatible = "rockchip,rk3288-grf", "syscon", "simple-mfd"; + +... + + usbphy: phy { + compatible = "rockchip,rk3288-usb-phy"; + #address-cells = <1>; + #size-cells = <0>; - usbphy0: usb-phy0 { - #phy-cells = <0>; - reg = <0x320>; + usbphy0: usb-phy0 { + #phy-cells = <0>; + reg = <0x320>; + }; }; };
drivers/phy/phy-rockchip-usb.c +12 -3
@@ -397,8 +397,13 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev) phy_base->pdata = match->data; phy_base->dev = dev; - phy_base->reg_base =syscon_regmap_lookup_by_phandle (dev->of_node, -"rockchip,grf" ); + phy_base->reg_base =ERR_PTR (-ENODEV ); +if (dev->parent && dev->parent->of_node) + phy_base->reg_base =syscon_node_to_regmap ( + dev->parent->of_node); +if (IS_ERR (phy_base->reg_base)) + phy_base->reg_base =syscon_regmap_lookup_by_phandle ( + dev->of_node,"rockchip,grf" );if (IS_ERR (phy_base->reg_base)) {dev_err (&pdev->dev,"Missing rockchip,grf property\n" );return PTR_ERR (phy_base->reg_base);
@@ -463,7 +468,11 @@ static int __init rockchip_init_usb_uart(void)return -ENOTSUPP ; } - grf =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" ); + grf =ERR_PTR (-ENODEV ); +if (np->parent) + grf =syscon_node_to_regmap (np->parent); +if (IS_ERR (grf)) + grf =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" );if (IS_ERR (grf)) {pr_err ("%s: Missing rockchip,grf property, %lu\n" , __func__,PTR_ERR (grf));
Signature · 1 line
1.7.9.5
PATCH 6/10 phy: phy-qcom-ufs-qmp-20nm: Remove site specific OOM error message
In reply to Kishon Vijay Abraham IFrom: Peter Griffin <[email protected]>
kzalloc will issue its own error message including a dump_stack() so remote the site specific message.
--- drivers/phy/phy-qcom-ufs-qmp-20nm.c | 1 - 1 file changed, 1 deletion(-)
drivers/phy/phy-qcom-ufs-qmp-20nm.c +0 -1
@@ -196,7 +196,6 @@ static int ufs_qcom_phy_qmp_20nm_probe(struct platform_device *pdev) phy =devm_kzalloc (dev,sizeof (*phy),GFP_KERNEL );if (!phy) { -dev_err (dev,"%s: failed to allocate phy\n" , __func__); err = -ENOMEM ; goto out; }
Signature · 1 line
1.7.9.5
PATCH 7/10 phy: phy-qcom-ufs-qmp-14nm: Remove site specific OOM error message
In reply to Kishon Vijay Abraham IFrom: Peter Griffin <[email protected]>
kzalloc will issue its own error message including a dump_stack() so remote the site specific message.
--- drivers/phy/phy-qcom-ufs-qmp-14nm.c | 1 - 1 file changed, 1 deletion(-)
drivers/phy/phy-qcom-ufs-qmp-14nm.c +0 -1
@@ -140,7 +140,6 @@ static int ufs_qcom_phy_qmp_14nm_probe(struct platform_device *pdev) phy =devm_kzalloc (dev,sizeof (*phy),GFP_KERNEL );if (!phy) { -dev_err (dev,"%s: failed to allocate phy\n" , __func__); err = -ENOMEM ; goto out; }
Signature · 1 line
1.7.9.5
PATCH 8/10 phy-sun4i-usb: Add workaround for missing Vbus det interrupts on A31
In reply to Kishon Vijay Abraham IFrom: Hans de Goede <[email protected]>
The A31 companion pmic (axp221) does not generate vbus change interrupts when the board is driving vbus, so we must poll when using the pmic for vbus-det _and_ we're driving vbus.
--- drivers/phy/phy-sun4i-usb.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-)
drivers/phy/phy-sun4i-usb.c +24 -10
@@ -94,6 +94,7 @@enum sun4i_usb_phy_type { sun4i_a10_phy, + sun6i_a31_phy, sun8i_a33_phy, sun8i_h3_phy, };
@@ -122,7 +123,6 @@ struct sun4i_usb_phy_data {/* phy0 / otg related variables */ struct extcon_dev *extcon;bool phy0_init; -bool phy0_poll;struct gpio_desc *id_det_gpio;struct gpio_desc *vbus_det_gpio;struct power_supply *vbus_power_supply;
@@ -343,6 +343,24 @@ static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)return data->vbus_det_gpio || data->vbus_power_supply; } +static bool sun4i_usb_phy0_poll (struct sun4i_usb_phy_data *data) +{ +if ((data->id_det_gpio && data->id_det_irq <=0 ) || + (data->vbus_det_gpio && data->vbus_det_irq <=0 )) +return true; + +/* +* The A31 companion pmic (axp221) does not generate vbus change +* interrupts when the board is driving vbus, so we must poll +* when using the pmic for vbus-det _and_ we're driving vbus. +*/ +if (data->cfg->type == sun6i_a31_phy && + data->vbus_power_supply && data->phys[0 ].regulator_on) +return true; + +return false; +} +static int sun4i_usb_phy_power_on (struct phy *_phy) {struct sun4i_usb_phy *phy =phy_get_drvdata (_phy);
@@ -364,7 +382,7 @@ static int sun4i_usb_phy_power_on(struct phy *_phy) phy->regulator_on = true;/* We must report Vbus high within OTG_TIME_A_WAIT_VRISE msec. */ -if (phy->index ==0 && data->vbus_det_gpio && data->phy0_poll) +if (phy->index ==0 &&sun4i_usb_phy0_poll (data))mod_delayed_work (system_wq, &data->detect,DEBOUNCE_TIME );return 0 ;
@@ -385,7 +403,7 @@ static int sun4i_usb_phy_power_off(struct phy *_phy)* phy0 vbus typically slowly discharges, sometimes this causes the * Vbus gpio to not trigger an edge irq on Vbus off, so force a rescan. */ -if (phy->index ==0 && data->vbus_det_gpio && !data->phy0_poll) +if (phy->index ==0 && !sun4i_usb_phy0_poll (data))mod_delayed_work (system_wq, &data->detect,POLL_TIME );return 0 ;
@@ -468,7 +486,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)if (vbus_notify)extcon_set_cable_state_ (data->extcon,EXTCON_USB , vbus_det); -if (data->phy0_poll) +if (sun4i_usb_phy0_poll (data))queue_delayed_work (system_wq, &data->detect,POLL_TIME ); }
@@ -644,11 +662,6 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) } data->id_det_irq =gpiod_to_irq (data->id_det_gpio); - data->vbus_det_irq =gpiod_to_irq (data->vbus_det_gpio); -if ((data->id_det_gpio && data->id_det_irq <=0 ) || - (data->vbus_det_gpio && data->vbus_det_irq <=0 )) - data->phy0_poll = true; -if (data->id_det_irq >0 ) { ret = devm_request_irq(dev, data->id_det_irq, sun4i_usb_phy0_id_vbus_det_irq,
@@ -660,6 +673,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) } } + data->vbus_det_irq =gpiod_to_irq (data->vbus_det_gpio);if (data->vbus_det_irq >0 ) { ret = devm_request_irq(dev, data->vbus_det_irq, sun4i_usb_phy0_id_vbus_det_irq,
@@ -711,7 +725,7 @@ static const struct sun4i_usb_phy_cfg sun5i_a13_cfg = {static const struct sun4i_usb_phy_cfg sun6i_a31_cfg = { .num_phys =3 , - .type = sun4i_a10_phy, + .type = sun6i_a31_phy, .disc_thresh =3 , .phyctl_offset =REG_PHYCTL_A10 , .dedicated_clocks = true,
Signature · 1 line
1.7.9.5
PATCH 10/10 phy: rcar-gen3-usb2: fix mutex_lock calling in interrupt
In reply to Kishon Vijay Abraham IFrom: Yoshihiro Shimoda <[email protected]>
This patch fixes an issue that the extcon_set_cable_state_() is possible to cause "BUG: scheduling while atomic" because this driver calls extcon_set_cable_state_() in the interrupt handler and mutex_lock() is possible to be called by like the following call trace. So, this patch adds a workqueue function to resolve this issue.
[ 9.706504] BUG: scheduling while atomic: systemd-journal/25893/0x00010303 [ 9.714569] Modules linked in: [ 9.717629] CPU: 0 PID: 25893 Comm: systemd-journal Not tainted 4.7.0-rc4+ #86 [ 9.724844] Hardware name: Renesas Salvator-X board based on r8a7795 (DT) [ 9.731624] Call trace: [ 9.734077] [<ffff0000080889f0>] dump_backtrace+0x0/0x1a8 [ 9.739470] [<ffff000008088bac>] show_stack+0x14/0x20 [ 9.744520] [<ffff000008348ab4>] dump_stack+0x94/0xb8 [ 9.749568] [<ffff0000080da18c>] __schedule_bug+0x44/0x58 [ 9.754966] [<ffff0000087c6394>] __schedule+0x4e4/0x598 [ 9.760185] [<ffff0000087c6484>] schedule+0x3c/0xa8 [ 9.765057] [<ffff0000087c6928>] schedule_preempt_disabled+0x20/0x38 [ 9.771408] [<ffff0000080f20dc>] mutex_optimistic_spin+0x18c/0x1d0 [ 9.777583] [<ffff0000087c7ef0>] __mutex_lock_slowpath+0x38/0x140 [ 9.783669] [<ffff0000087c803c>] mutex_lock+0x44/0x60 [ 9.788717] [<ffff00000834ca48>] kobject_uevent_env+0x250/0x500 [ 9.794634] [<ffff0000086ae8c0>] extcon_update_state+0x220/0x298 [ 9.800634] [<ffff0000086ae9d8>] extcon_set_cable_state_+0x78/0x88 [ 9.806812] [<ffff000008376004>] rcar_gen3_device_recognition+0x5c/0xe0 [ 9.813420] [<ffff0000083761bc>] rcar_gen3_phy_usb2_irq+0x3c/0x48 [ 9.819509] [<ffff0000080fae94>] handle_irq_event_percpu+0x94/0x140 [ 9.825769] [<ffff0000080faf88>] handle_irq_event+0x48/0x78 [ 9.831334] [<ffff0000080fe620>] handle_fasteoi_irq+0xb8/0x1b0 [ 9.837162] [<ffff0000080fa3c4>] generic_handle_irq+0x24/0x38 [ 9.842900] [<ffff0000080fa6fc>] __handle_domain_irq+0x5c/0xb8 [ 9.848727] [<ffff000008081520>] gic_handle_irq+0x58/0xb0
--- drivers/phy/phy-rcar-gen3-usb2.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/phy/phy-rcar-gen3-usb2.c +22 -4
@@ -21,6 +21,7 @@#include <linux/phy/phy.h> #include <linux/platform_device.h> #include <linux/regulator/consumer.h> +#include <linux/workqueue.h> /******* USB2.0 Host registers (original offset is +0x200) *******/ #define USB2_INT_ENABLE 0x000
@@ -81,9 +82,25 @@ struct rcar_gen3_chan {struct extcon_dev *extcon;struct phy *phy;struct regulator *vbus; +struct work_struct work; +bool extcon_host;bool has_otg; }; +static void rcar_gen3_phy_usb2_work (struct work_struct *work) +{ + struct rcar_gen3_chan *ch = container_of(work, struct rcar_gen3_chan, + work); + +if (ch->extcon_host) { +extcon_set_cable_state_ (ch->extcon,EXTCON_USB_HOST , true); +extcon_set_cable_state_ (ch->extcon,EXTCON_USB , false); + }else { +extcon_set_cable_state_ (ch->extcon,EXTCON_USB_HOST , false); +extcon_set_cable_state_ (ch->extcon,EXTCON_USB , true); + } +} +static void rcar_gen3_set_host_mode (struct rcar_gen3_chan *ch,int host) {void __iomem *usb2_base = ch->base;
@@ -130,8 +147,8 @@ static void rcar_gen3_init_for_host(struct rcar_gen3_chan *ch)rcar_gen3_set_host_mode (ch,1 );rcar_gen3_enable_vbus_ctrl (ch,1 ); -extcon_set_cable_state_ (ch->extcon,EXTCON_USB_HOST , true); -extcon_set_cable_state_ (ch->extcon,EXTCON_USB , false); + ch->extcon_host = true; +schedule_work (&ch->work); }static void rcar_gen3_init_for_peri (struct rcar_gen3_chan *ch)
@@ -140,8 +157,8 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch)rcar_gen3_set_host_mode (ch,0 );rcar_gen3_enable_vbus_ctrl (ch,0 ); -extcon_set_cable_state_ (ch->extcon,EXTCON_USB_HOST , false); -extcon_set_cable_state_ (ch->extcon,EXTCON_USB , true); + ch->extcon_host = false; +schedule_work (&ch->work); }static bool rcar_gen3_check_id (struct rcar_gen3_chan *ch)
@@ -301,6 +318,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)if (irq >=0 ) {int ret; +INIT_WORK (&channel->work, rcar_gen3_phy_usb2_work); irq =devm_request_irq (dev, irq, rcar_gen3_phy_usb2_irq,IRQF_SHARED ,dev_name (dev), channel);if (irq <0 )
Signature · 1 line
1.7.9.5
PATCH 9/10 phy: rockhip-usb: use devm_add_action_or_reset()
In reply to Kishon Vijay Abraham IFrom: Sudip Mukherjee <[email protected]>
If devm_add_action() fails we are explicitly calling the cleanup to free the resources allocated. Lets use the helper devm_add_action_or_reset() and return directly in case of error, as we know that the cleanup function has been already called by the helper if there was any error.
--- drivers/phy/phy-rockchip-usb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/phy/phy-rockchip-usb.c +3 -5
@@ -236,9 +236,10 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base, goto err_clk_prov; } - err =devm_add_action (base->dev, rockchip_usb_phy_action, rk_phy); + err =devm_add_action_or_reset (base->dev, rockchip_usb_phy_action, + rk_phy);if (err) - goto err_devm_action; +return err; rk_phy->phy =devm_phy_create (base->dev, child, &ops);if (IS_ERR (rk_phy->phy)) {
@@ -256,9 +257,6 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,else return rockchip_usb_phy_power (rk_phy,1 ); -err_devm_action: -if (!rk_phy->uart_enabled) -of_clk_del_provider (child); err_clk_prov:if (!rk_phy->uart_enabled)clk_unregister (rk_phy->clk480m);
Signature · 1 line
1.7.9.5
Quoted 15 lines · Kishon Vijay Abraham I
Hi Greg,
Please find the pull request for 4.8 merge window below.
Now the controller can configure the mode in which the PHY should work using the new
phy_set_modeAPI. This was added by David Lechner required for da8xx-usb phy (used by MUSB). For this I created a signed tag 'phy-set-mode-v2' since thephy_set_modeAPI is called from musb driver which is not part of this pull request. This also adds a new phy driver for USB PHY in DA8xx SoC and includes other minor cleanups and fixes.Consider merging this for the next merge window. Let me know if I have to change something.
Quoted 7 lines
The following changes since commit
04e59a0211ff012ba60c00baca673482570784e9:phy-sun4i-usb: Fix irq free conditions to match request conditions (2016-06-22 11:33:46 +0530)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.gittags/phy-for-4.8-rc1
Now pulled, thanks.
greg k-h
Re: [PATCH 04/10] phy: da8xx-usb: new driver for DA8xx SoC USB PHY
In reply to Kishon Vijay Abraham IQuoted 8 lines · CEST Kishon Vijay Abraham I
From: David Lechner <[email protected]>
This is a new phy driver for the SoC USB controllers on the TI DA8xx family of microcontrollers. The USB 1.1 PHY is just a simple on/off. The USB 2.0 PHY also allows overriding the VBUS and ID pins.
Signed-off-by David Lechner <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>
This is now in linux-next, but fails to build:
drivers/phy/phy-da8xx-usb.c line 19
Quoted 4 lines
drivers/phy/phy-da8xx-usb.c new file +4
-0+#include <linux/clk.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/mfd/da8xx-cfgchip.h>
drivers/phy/phy-da8xx-usb.c:19:37: fatal error: linux/mfd/da8xx-cfgchip.h: No such file or directory
Arnd
Re: [PATCH 04/10] phy: da8xx-usb: new driver for DA8xx SoC USB PHY
Hi Arnd,
Quoted 10 lines · Arnd Bergmann
Quoted 8 lines · CEST Kishon Vijay Abraham I
From: David Lechner <[email protected]>
This is a new phy driver for the SoC USB controllers on the TI DA8xx family of microcontrollers. The USB 1.1 PHY is just a simple on/off. The USB 2.0 PHY also allows overriding the VBUS and ID pins.
Signed-off-by David Lechner <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>
Quoted 8 lines
This is now in linux-next, but fails to build:
drivers/phy/phy-da8xx-usb.c line 19
Quoted 4 lines
drivers/phy/phy-da8xx-usb.c new file +4
-0+#include <linux/clk.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/mfd/da8xx-cfgchip.h>
drivers/phy/phy-da8xx-usb.c:19:37: fatal error:linux/mfd/da8xx-cfgchip.h: No such file or directory
I'll look at this.
Thanks
Kishon