* [PATCH v2 0/3] arm: beaglex15: fix USB Gadget
@ 2015-12-30 0:55 Chanwoo Choi
2015-12-30 0:55 ` [PATCH v2 1/3] extcon: palmas: Add the support for VBUS detection by using GPIO Chanwoo Choi
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Chanwoo Choi @ 2015-12-30 0:55 UTC (permalink / raw)
To: tony, robh+dt, lee.jones, balbi
Cc: rogerq, kishon, george.cherian, cw00.choi, myungjoo.ham,
linux-kernel, linux, linux-omap, devicetree, linux-arm-kernel
This patchset make the extcon-palmas.c more generic style and then send v2
patchset. I add the Felipe comment of v1 patchset as following:
But, I have not test on real board because I don't have it.
Just, I modify this patchset based on v1 patchset[1] from Felipe Balbi.
- Felipe comment of this patchset:
"Hi,
with the following patches I can get USB Gadget working
with my beagle x15 with today's Linus' tree.
regards".
[1] https://lkml.org/lkml/2015/11/12/508
Changes from v1:
(https://lkml.org/lkml/2015/11/12/508)
- Refactoring the extcon-palmas.c driver with more generic style to support
the VBUS gpio pin.
- Use the 'vbus-gpio' property instead of 'interrupts-extended']
Felipe Balbi (3):
extcon: palmas: Add the support for VBUS detection by using GPIO
arm: boot: dts: beaglex15: Remove ID GPIO
arm: boot: beaglex15: pass correct interrupt
arch/arm/boot/dts/am57xx-beagle-x15.dts | 3 +-
drivers/extcon/extcon-palmas.c | 50 +++++++++++++++++++++++++++++++++
include/linux/mfd/palmas.h | 3 ++
3 files changed, 54 insertions(+), 2 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] extcon: palmas: Add the support for VBUS detection by using GPIO
2015-12-30 0:55 [PATCH v2 0/3] arm: beaglex15: fix USB Gadget Chanwoo Choi
@ 2015-12-30 0:55 ` Chanwoo Choi
2016-01-11 5:49 ` Lee Jones
2015-12-30 0:55 ` [PATCH v2 2/3] arm: boot: dts: beaglex15: Remove ID GPIO Chanwoo Choi
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Chanwoo Choi @ 2015-12-30 0:55 UTC (permalink / raw)
To: tony, robh+dt, lee.jones, balbi
Cc: rogerq, kishon, george.cherian, cw00.choi, myungjoo.ham,
linux-kernel, linux, linux-omap, devicetree, linux-arm-kernel
From: Felipe Balbi <balbi@ti.com>
This patch support for VBUS detection by using GPIO pin.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/extcon/extcon-palmas.c | 50 ++++++++++++++++++++++++++++++++++++++++++
include/linux/mfd/palmas.h | 3 +++
2 files changed, 53 insertions(+)
diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 93c30a885740..885ee95a6a7b 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -216,11 +216,23 @@ static int palmas_usb_probe(struct platform_device *pdev)
return PTR_ERR(palmas_usb->id_gpiod);
}
+ palmas_usb->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus",
+ GPIOD_IN);
+ if (IS_ERR(palmas_usb->vbus_gpiod)) {
+ dev_err(&pdev->dev, "failed to get vbus gpio\n");
+ return PTR_ERR(palmas_usb->vbus_gpiod);
+ }
+
if (palmas_usb->enable_id_detection && palmas_usb->id_gpiod) {
palmas_usb->enable_id_detection = false;
palmas_usb->enable_gpio_id_detection = true;
}
+ if (palmas_usb->enable_vbus_detection && palmas_usb->vbus_gpiod) {
+ palmas_usb->enable_vbus_detection = false;
+ palmas_usb->enable_gpio_vbus_detection = true;
+ }
+
if (palmas_usb->enable_gpio_id_detection) {
u32 debounce;
@@ -311,6 +323,40 @@ static int palmas_usb_probe(struct platform_device *pdev)
palmas_usb->vbus_irq, status);
return status;
}
+ } else if (palmas_usb->enable_gpio_vbus_detection) {
+ /* remux GPIO_1 as VBUSDET */
+ status = palmas_update_bits(palmas,
+ PALMAS_PU_PD_OD_BASE,
+ PALMAS_PRIMARY_SECONDARY_PAD1,
+ PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK,
+ (1 << PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT));
+ if (status < 0) {
+ dev_err(&pdev->dev, "can't remux GPIO1\n");
+ return status;
+ }
+
+ palmas_usb->vbus_otg_irq = regmap_irq_get_virq(palmas->irq_data,
+ PALMAS_VBUS_OTG_IRQ);
+ palmas_usb->gpio_vbus_irq = gpiod_to_irq(palmas_usb->vbus_gpiod);
+ if (palmas_usb->gpio_vbus_irq < 0) {
+ dev_err(&pdev->dev, "failed to get vbus irq\n");
+ return palmas_usb->gpio_vbus_irq;
+ }
+ status = devm_request_threaded_irq(&pdev->dev,
+ palmas_usb->gpio_vbus_irq,
+ NULL,
+ palmas_vbus_irq_handler,
+ IRQF_TRIGGER_FALLING |
+ IRQF_TRIGGER_RISING |
+ IRQF_ONESHOT |
+ IRQF_EARLY_RESUME,
+ "palmas_usb_vbus",
+ palmas_usb);
+ if (status < 0) {
+ dev_err(&pdev->dev,
+ "failed to request handler for vbus irq\n");
+ return status;
+ }
}
palmas_enable_irq(palmas_usb);
@@ -337,6 +383,8 @@ static int palmas_usb_suspend(struct device *dev)
if (device_may_wakeup(dev)) {
if (palmas_usb->enable_vbus_detection)
enable_irq_wake(palmas_usb->vbus_irq);
+ if (palmas_usb->enable_gpio_vbus_detection)
+ enable_irq_wake(palmas_usb->gpio_vbus_irq);
if (palmas_usb->enable_id_detection)
enable_irq_wake(palmas_usb->id_irq);
if (palmas_usb->enable_gpio_id_detection)
@@ -352,6 +400,8 @@ static int palmas_usb_resume(struct device *dev)
if (device_may_wakeup(dev)) {
if (palmas_usb->enable_vbus_detection)
disable_irq_wake(palmas_usb->vbus_irq);
+ if (palmas_usb->enable_gpio_vbus_detection)
+ disable_irq_wake(palmas_usb->gpio_vbus_irq);
if (palmas_usb->enable_id_detection)
disable_irq_wake(palmas_usb->id_irq);
if (palmas_usb->enable_gpio_id_detection)
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 13e1d96935ed..7b2526f7bc9b 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -553,7 +553,9 @@ struct palmas_usb {
int vbus_irq;
int gpio_id_irq;
+ int gpio_vbus_irq;
struct gpio_desc *id_gpiod;
+ struct gpio_desc *vbus_gpiod;
unsigned long sw_debounce_jiffies;
struct delayed_work wq_detectid;
@@ -562,6 +564,7 @@ struct palmas_usb {
bool enable_vbus_detection;
bool enable_id_detection;
bool enable_gpio_id_detection;
+ bool enable_gpio_vbus_detection;
};
#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] arm: boot: dts: beaglex15: Remove ID GPIO
2015-12-30 0:55 [PATCH v2 0/3] arm: beaglex15: fix USB Gadget Chanwoo Choi
2015-12-30 0:55 ` [PATCH v2 1/3] extcon: palmas: Add the support for VBUS detection by using GPIO Chanwoo Choi
@ 2015-12-30 0:55 ` Chanwoo Choi
2015-12-30 0:55 ` [PATCH v2 3/3] arm: boot: beaglex15: pass correct interrupt Chanwoo Choi
2016-01-27 17:01 ` [PATCH v2 0/3] arm: beaglex15: fix USB Gadget Tony Lindgren
3 siblings, 0 replies; 6+ messages in thread
From: Chanwoo Choi @ 2015-12-30 0:55 UTC (permalink / raw)
To: tony, robh+dt, lee.jones, balbi
Cc: rogerq, kishon, george.cherian, cw00.choi, myungjoo.ham,
linux-kernel, linux, linux-omap, devicetree, linux-arm-kernel
From: Felipe Balbi <balbi@ti.com>
According to latest schematics [1], this board
leaves ID pin floating. It's not connected to
anything at all.
So let's remove it.
[1] https://github.com/beagleboard/beagleboard-x15/blob/master/BeagleBoard-X15_RevA2.pdf
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
arch/arm/boot/dts/am57xx-beagle-x15.dts | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts
index d9ba6b879fc1..be4990608c77 100644
--- a/arch/arm/boot/dts/am57xx-beagle-x15.dts
+++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
@@ -560,8 +560,6 @@
extcon_usb2: tps659038_usb {
compatible = "ti,palmas-usb-vid";
ti,enable-vbus-detection;
- ti,enable-id-detection;
- id-gpios = <&gpio7 24 GPIO_ACTIVE_HIGH>;
};
};
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] arm: boot: beaglex15: pass correct interrupt
2015-12-30 0:55 [PATCH v2 0/3] arm: beaglex15: fix USB Gadget Chanwoo Choi
2015-12-30 0:55 ` [PATCH v2 1/3] extcon: palmas: Add the support for VBUS detection by using GPIO Chanwoo Choi
2015-12-30 0:55 ` [PATCH v2 2/3] arm: boot: dts: beaglex15: Remove ID GPIO Chanwoo Choi
@ 2015-12-30 0:55 ` Chanwoo Choi
2016-01-27 17:01 ` [PATCH v2 0/3] arm: beaglex15: fix USB Gadget Tony Lindgren
3 siblings, 0 replies; 6+ messages in thread
From: Chanwoo Choi @ 2015-12-30 0:55 UTC (permalink / raw)
To: tony, robh+dt, lee.jones, balbi
Cc: rogerq, kishon, george.cherian, cw00.choi, myungjoo.ham,
linux-kernel, linux, linux-omap, devicetree, linux-arm-kernel
From: Felipe Balbi <balbi@ti.com>
According to latest schematics [1], GPIO_1/VBUSDET
on TPS659038 is tied to AM57x GPIO4_21. We can use
that as a VBUS interrupt, instead of relying on
PMIC's VBUS interrupts which don't seem to be firing
on x15 at all.
A follow up patch will add support for using this
GPIO-based interrupt mechanism for notifying about
VBUS.
[1] https://github.com/beagleboard/beagleboard-x15/blob/master/BeagleBoard-X15_RevA2.pdf
Signed-off-by: Felipe Balbi <balbi@ti.com>
[cw00.choi: Use the 'vbus-gpio' property instead of 'interrupts-extended']
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
arch/arm/boot/dts/am57xx-beagle-x15.dts | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts
index be4990608c77..3887ba89d2a5 100644
--- a/arch/arm/boot/dts/am57xx-beagle-x15.dts
+++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
@@ -560,6 +560,7 @@
extcon_usb2: tps659038_usb {
compatible = "ti,palmas-usb-vid";
ti,enable-vbus-detection;
+ vbus-gpio = <&gpio4 21 GPIO_ACTIVE_HIGH>;
};
};
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] extcon: palmas: Add the support for VBUS detection by using GPIO
2015-12-30 0:55 ` [PATCH v2 1/3] extcon: palmas: Add the support for VBUS detection by using GPIO Chanwoo Choi
@ 2016-01-11 5:49 ` Lee Jones
0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2016-01-11 5:49 UTC (permalink / raw)
To: Chanwoo Choi
Cc: tony, robh+dt, balbi, rogerq, kishon, george.cherian,
myungjoo.ham, linux-kernel, linux, linux-omap, devicetree,
linux-arm-kernel
On Wed, 30 Dec 2015, Chanwoo Choi wrote:
> From: Felipe Balbi <balbi@ti.com>
>
> This patch support for VBUS detection by using GPIO pin.
>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
> drivers/extcon/extcon-palmas.c | 50 ++++++++++++++++++++++++++++++++++++++++++
> include/linux/mfd/palmas.h | 3 +++
Acked-by: Lee Jones <lee.jones@linaro.org>
> 2 files changed, 53 insertions(+)
>
> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
> index 93c30a885740..885ee95a6a7b 100644
> --- a/drivers/extcon/extcon-palmas.c
> +++ b/drivers/extcon/extcon-palmas.c
> @@ -216,11 +216,23 @@ static int palmas_usb_probe(struct platform_device *pdev)
> return PTR_ERR(palmas_usb->id_gpiod);
> }
>
> + palmas_usb->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus",
> + GPIOD_IN);
> + if (IS_ERR(palmas_usb->vbus_gpiod)) {
> + dev_err(&pdev->dev, "failed to get vbus gpio\n");
> + return PTR_ERR(palmas_usb->vbus_gpiod);
> + }
> +
> if (palmas_usb->enable_id_detection && palmas_usb->id_gpiod) {
> palmas_usb->enable_id_detection = false;
> palmas_usb->enable_gpio_id_detection = true;
> }
>
> + if (palmas_usb->enable_vbus_detection && palmas_usb->vbus_gpiod) {
> + palmas_usb->enable_vbus_detection = false;
> + palmas_usb->enable_gpio_vbus_detection = true;
> + }
> +
> if (palmas_usb->enable_gpio_id_detection) {
> u32 debounce;
>
> @@ -311,6 +323,40 @@ static int palmas_usb_probe(struct platform_device *pdev)
> palmas_usb->vbus_irq, status);
> return status;
> }
> + } else if (palmas_usb->enable_gpio_vbus_detection) {
> + /* remux GPIO_1 as VBUSDET */
> + status = palmas_update_bits(palmas,
> + PALMAS_PU_PD_OD_BASE,
> + PALMAS_PRIMARY_SECONDARY_PAD1,
> + PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK,
> + (1 << PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT));
> + if (status < 0) {
> + dev_err(&pdev->dev, "can't remux GPIO1\n");
> + return status;
> + }
> +
> + palmas_usb->vbus_otg_irq = regmap_irq_get_virq(palmas->irq_data,
> + PALMAS_VBUS_OTG_IRQ);
> + palmas_usb->gpio_vbus_irq = gpiod_to_irq(palmas_usb->vbus_gpiod);
> + if (palmas_usb->gpio_vbus_irq < 0) {
> + dev_err(&pdev->dev, "failed to get vbus irq\n");
> + return palmas_usb->gpio_vbus_irq;
> + }
> + status = devm_request_threaded_irq(&pdev->dev,
> + palmas_usb->gpio_vbus_irq,
> + NULL,
> + palmas_vbus_irq_handler,
> + IRQF_TRIGGER_FALLING |
> + IRQF_TRIGGER_RISING |
> + IRQF_ONESHOT |
> + IRQF_EARLY_RESUME,
> + "palmas_usb_vbus",
> + palmas_usb);
> + if (status < 0) {
> + dev_err(&pdev->dev,
> + "failed to request handler for vbus irq\n");
> + return status;
> + }
> }
>
> palmas_enable_irq(palmas_usb);
> @@ -337,6 +383,8 @@ static int palmas_usb_suspend(struct device *dev)
> if (device_may_wakeup(dev)) {
> if (palmas_usb->enable_vbus_detection)
> enable_irq_wake(palmas_usb->vbus_irq);
> + if (palmas_usb->enable_gpio_vbus_detection)
> + enable_irq_wake(palmas_usb->gpio_vbus_irq);
> if (palmas_usb->enable_id_detection)
> enable_irq_wake(palmas_usb->id_irq);
> if (palmas_usb->enable_gpio_id_detection)
> @@ -352,6 +400,8 @@ static int palmas_usb_resume(struct device *dev)
> if (device_may_wakeup(dev)) {
> if (palmas_usb->enable_vbus_detection)
> disable_irq_wake(palmas_usb->vbus_irq);
> + if (palmas_usb->enable_gpio_vbus_detection)
> + disable_irq_wake(palmas_usb->gpio_vbus_irq);
> if (palmas_usb->enable_id_detection)
> disable_irq_wake(palmas_usb->id_irq);
> if (palmas_usb->enable_gpio_id_detection)
> diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
> index 13e1d96935ed..7b2526f7bc9b 100644
> --- a/include/linux/mfd/palmas.h
> +++ b/include/linux/mfd/palmas.h
> @@ -553,7 +553,9 @@ struct palmas_usb {
> int vbus_irq;
>
> int gpio_id_irq;
> + int gpio_vbus_irq;
> struct gpio_desc *id_gpiod;
> + struct gpio_desc *vbus_gpiod;
> unsigned long sw_debounce_jiffies;
> struct delayed_work wq_detectid;
>
> @@ -562,6 +564,7 @@ struct palmas_usb {
> bool enable_vbus_detection;
> bool enable_id_detection;
> bool enable_gpio_id_detection;
> + bool enable_gpio_vbus_detection;
> };
>
> #define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] arm: beaglex15: fix USB Gadget
2015-12-30 0:55 [PATCH v2 0/3] arm: beaglex15: fix USB Gadget Chanwoo Choi
` (2 preceding siblings ...)
2015-12-30 0:55 ` [PATCH v2 3/3] arm: boot: beaglex15: pass correct interrupt Chanwoo Choi
@ 2016-01-27 17:01 ` Tony Lindgren
3 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2016-01-27 17:01 UTC (permalink / raw)
To: Chanwoo Choi
Cc: robh+dt, lee.jones, balbi, rogerq, kishon, george.cherian,
myungjoo.ham, linux-kernel, linux, linux-omap, devicetree,
linux-arm-kernel
* Chanwoo Choi <cw00.choi@samsung.com> [151229 16:56]:
> This patchset make the extcon-palmas.c more generic style and then send v2
> patchset. I add the Felipe comment of v1 patchset as following:
> But, I have not test on real board because I don't have it.
> Just, I modify this patchset based on v1 patchset[1] from Felipe Balbi.
>
> - Felipe comment of this patchset:
> "Hi,
>
> with the following patches I can get USB Gadget working
> with my beagle x15 with today's Linus' tree.
>
> regards".
>
> [1] https://lkml.org/lkml/2015/11/12/508
>
> Changes from v1:
> (https://lkml.org/lkml/2015/11/12/508)
> - Refactoring the extcon-palmas.c driver with more generic style to support
> the VBUS gpio pin.
> - Use the 'vbus-gpio' property instead of 'interrupts-extended']
>
> Felipe Balbi (3):
> extcon: palmas: Add the support for VBUS detection by using GPIO
> arm: boot: dts: beaglex15: Remove ID GPIO
> arm: boot: beaglex15: pass correct interrupt
Please feel free to queue these minor dts changes along with the
extcon changes. Usually the subject starts with "ARM: dts:" though.
Anyways for the last two patches in the series:
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-27 17:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-30 0:55 [PATCH v2 0/3] arm: beaglex15: fix USB Gadget Chanwoo Choi
2015-12-30 0:55 ` [PATCH v2 1/3] extcon: palmas: Add the support for VBUS detection by using GPIO Chanwoo Choi
2016-01-11 5:49 ` Lee Jones
2015-12-30 0:55 ` [PATCH v2 2/3] arm: boot: dts: beaglex15: Remove ID GPIO Chanwoo Choi
2015-12-30 0:55 ` [PATCH v2 3/3] arm: boot: beaglex15: pass correct interrupt Chanwoo Choi
2016-01-27 17:01 ` [PATCH v2 0/3] arm: beaglex15: fix USB Gadget Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).