All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Petr Cvek <petr.cvek@tul.cz>
Cc: philipp.zabel@gmail.com, daniel@zonque.org,
	haojian.zhuang@gmail.com, sameo@linux.intel.com,
	lee.jones@linaro.org, cooloney@gmail.com, rpurdie@rpsys.net,
	j.anaszewski@samsung.com, linux@arm.linux.org.uk, sre@kernel.org,
	dbaryshkov@gmail.com, dwmw2@infradead.org,
	linux-leds@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 12/21] ARM: pxa: magician: Add PXA27x UDC support
Date: Fri, 28 Aug 2015 11:58:30 +0200	[thread overview]
Message-ID: <871ten3fax.fsf@belgarion.home> (raw)
In-Reply-To: <55D652D0.90903@tul.cz> (Petr Cvek's message of "Fri, 21 Aug 2015 00:21:04 +0200")

Petr Cvek <petr.cvek@tul.cz> writes:

> Dne 20.8.2015 v 19:23 Robert Jarzmik napsal(a):
>> Petr Cvek <petr.cvek@tul.cz> writes:
>>> +static void magician_udc_command(int cmd)
>>> +{
>>> +	if (cmd == PXA2XX_UDC_CMD_CONNECT)
>>> +		UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE;
>>> +	else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
>>> +		UP2OCR &= ~(UP2OCR_DPPUE | UP2OCR_DPPUBE);
>>> +}
>>> +
>>> +/* HACK, shared USB connected state with pda-power */
>>> +int my_usb_online = 1;
>> Definitely not, a global (ie. non static variable) is not something I'll let
>> in. Besides, can't a "gpio_get_value()" give the same level of information ?
>
> I will gladly remove it, but I want my phone to be able to charge and work as
> USB device (and maybe as USB host).
Okay, I understand that, but see below.

>> 
>>> +static int magician_udc_is_connected(void)
>>> +{
>>> +	/* Shared with pda_power or gpio-vbus */
>>> +	return my_usb_online;
>> gpio_get_value() something ?
>> 
>
> I need to use EGPIO_MAGICIAN_CABLE_INSERT1 GPIO in pda_power to be able to detect source for charging.
>
>>> +}
>>> +
>>> +static struct pxa2xx_udc_mach_info magician_udc_info __initdata = {
>>> +	.udc_command		= magician_udc_command,
>>> +	.udc_is_connected	= magician_udc_is_connected,
>> I don't think udc_is_connected is a field used by pxa27x_udc.c, it it ? The VBus
>> connection information comes from a transciever, usually from gpio_vbus driver
>> nowadays.
>
> Really? Well I guess I took a bad route :-D (when I tried to learn how to add an
> udc support). As there are two ways to define udc_is_connected, would it be
> possible to remove this field altogether (only mioa701 and lubbock have relevant
> use, but if this function is never called, then it is dead code)?
>
> Do you know which code / source is responsible for gpio_vbus -> pxa27x_udc
> communication about inserted cable? I will need to put some assert for
> testing.
Yes.
 - hooking: udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
 - detection: gpio_vbus_work()
   -> usb_gadget_vbus_connect()
     -> pxa_udc_vbus_session()

>>> @@ -1175,6 +1207,11 @@ static struct platform_device *devices[] __initdata = {
>>>  
>>>  	/* NOTICE mutually exclusive with PXA I2C */
>>>  	&i2c_gpio_bus_alt,
>>> +
>>> +	/* NOTICE mutually exclusive with UDC*/
>> Euh why so ?
>> In arch/arm/mach-pxa/mioa701.c they cooperate, why can't they for magician ?
>
> In mioa701 the GPIO13_nUSB_DETECT GPIO is requested by gpio_vbus driver, used in
> pda_power (without request) and "used" in PXA UDC driver without request. It is
> basically similar solution as my (ugly) global variable.
>
> Solution: I will try to use that second new GPIO (EGPIO_MAGICIAN_CABLE_INSERT2)
> for that, so there is no GPIO request dependency. I may create new names for
> them (magician.h).
Cool.
And if by chance you find an even cleaner solution, don't hesitate to modify
mioa701, hein ? ;)

Cheers.

-- 
Robert

WARNING: multiple messages have this Message-ID (diff)
From: robert.jarzmik@free.fr (Robert Jarzmik)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 12/21] ARM: pxa: magician: Add PXA27x UDC support
Date: Fri, 28 Aug 2015 11:58:30 +0200	[thread overview]
Message-ID: <871ten3fax.fsf@belgarion.home> (raw)
In-Reply-To: <55D652D0.90903@tul.cz> (Petr Cvek's message of "Fri, 21 Aug 2015 00:21:04 +0200")

Petr Cvek <petr.cvek@tul.cz> writes:

> Dne 20.8.2015 v 19:23 Robert Jarzmik napsal(a):
>> Petr Cvek <petr.cvek@tul.cz> writes:
>>> +static void magician_udc_command(int cmd)
>>> +{
>>> +	if (cmd == PXA2XX_UDC_CMD_CONNECT)
>>> +		UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE;
>>> +	else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
>>> +		UP2OCR &= ~(UP2OCR_DPPUE | UP2OCR_DPPUBE);
>>> +}
>>> +
>>> +/* HACK, shared USB connected state with pda-power */
>>> +int my_usb_online = 1;
>> Definitely not, a global (ie. non static variable) is not something I'll let
>> in. Besides, can't a "gpio_get_value()" give the same level of information ?
>
> I will gladly remove it, but I want my phone to be able to charge and work as
> USB device (and maybe as USB host).
Okay, I understand that, but see below.

>> 
>>> +static int magician_udc_is_connected(void)
>>> +{
>>> +	/* Shared with pda_power or gpio-vbus */
>>> +	return my_usb_online;
>> gpio_get_value() something ?
>> 
>
> I need to use EGPIO_MAGICIAN_CABLE_INSERT1 GPIO in pda_power to be able to detect source for charging.
>
>>> +}
>>> +
>>> +static struct pxa2xx_udc_mach_info magician_udc_info __initdata = {
>>> +	.udc_command		= magician_udc_command,
>>> +	.udc_is_connected	= magician_udc_is_connected,
>> I don't think udc_is_connected is a field used by pxa27x_udc.c, it it ? The VBus
>> connection information comes from a transciever, usually from gpio_vbus driver
>> nowadays.
>
> Really? Well I guess I took a bad route :-D (when I tried to learn how to add an
> udc support). As there are two ways to define udc_is_connected, would it be
> possible to remove this field altogether (only mioa701 and lubbock have relevant
> use, but if this function is never called, then it is dead code)?
>
> Do you know which code / source is responsible for gpio_vbus -> pxa27x_udc
> communication about inserted cable? I will need to put some assert for
> testing.
Yes.
 - hooking: udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
 - detection: gpio_vbus_work()
   -> usb_gadget_vbus_connect()
     -> pxa_udc_vbus_session()

>>> @@ -1175,6 +1207,11 @@ static struct platform_device *devices[] __initdata = {
>>>  
>>>  	/* NOTICE mutually exclusive with PXA I2C */
>>>  	&i2c_gpio_bus_alt,
>>> +
>>> +	/* NOTICE mutually exclusive with UDC*/
>> Euh why so ?
>> In arch/arm/mach-pxa/mioa701.c they cooperate, why can't they for magician ?
>
> In mioa701 the GPIO13_nUSB_DETECT GPIO is requested by gpio_vbus driver, used in
> pda_power (without request) and "used" in PXA UDC driver without request. It is
> basically similar solution as my (ugly) global variable.
>
> Solution: I will try to use that second new GPIO (EGPIO_MAGICIAN_CABLE_INSERT2)
> for that, so there is no GPIO request dependency. I may create new names for
> them (magician.h).
Cool.
And if by chance you find an even cleaner solution, don't hesitate to modify
mioa701, hein ? ;)

Cheers.

-- 
Robert

  reply	other threads:[~2015-08-28  9:58 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1439843482.git.petr.cvek@tul.cz>
2015-08-17 21:56 ` [PATCH v2 01/21] ARM: pxa: magician: Fix Kconfig for magician to always include htc-egpio Petr Cvek
2015-08-17 21:56   ` Petr Cvek
2015-08-18 18:31   ` Robert Jarzmik
2015-08-18 18:31     ` Robert Jarzmik
2015-08-18 20:02     ` Petr Cvek
2015-08-18 20:02       ` Petr Cvek
2015-08-19  7:29       ` Philipp Zabel
2015-08-19  7:29         ` Philipp Zabel
2015-08-24  3:39         ` Petr Cvek
2015-08-24  3:39           ` Petr Cvek
2015-08-17 21:56 ` [PATCH v2 02/21] ARM: pxa: magician: Fix indentation and whitespaces Petr Cvek
2015-08-17 21:56   ` Petr Cvek
2015-08-18 18:32   ` Robert Jarzmik
2015-08-18 18:32     ` Robert Jarzmik
2015-08-19  7:42   ` Philipp Zabel
2015-08-19  7:42     ` Philipp Zabel
2015-08-17 21:57 ` [PATCH v2 03/21] ARM: pxa: magician: Fix comments, debug functions and print strings Petr Cvek
2015-08-17 21:57   ` Petr Cvek
2015-08-18 18:39   ` Robert Jarzmik
2015-08-18 18:39     ` Robert Jarzmik
2015-08-18 23:09     ` Petr Cvek
2015-08-18 23:09       ` Petr Cvek
2015-08-19  7:57   ` Philipp Zabel
2015-08-19  7:57     ` Philipp Zabel
2015-08-17 21:58 ` [PATCH v2 04/21] ARM: pxa: magician: Add, fix and init (new) GPIOs Petr Cvek
2015-08-17 21:58   ` Petr Cvek
2015-08-18 19:01   ` Robert Jarzmik
2015-08-18 19:01     ` Robert Jarzmik
2015-08-18 22:46     ` Petr Cvek
2015-08-18 22:46       ` Petr Cvek
2015-08-17 21:58 ` [PATCH v2 05/21] ARM: pxa: magician: Add support for ADS7846 touchscreen Petr Cvek
2015-08-17 21:58   ` Petr Cvek
2015-08-19 18:41   ` Robert Jarzmik
2015-08-19 18:41     ` Robert Jarzmik
2015-08-17 21:59 ` [PATCH v2 06/21] ARM: pxa: magician: Add normal and power I2C definition Petr Cvek
2015-08-17 21:59   ` Petr Cvek
2015-08-19  8:02   ` Philipp Zabel
2015-08-19  8:02     ` Philipp Zabel
2015-08-19 18:41   ` Robert Jarzmik
2015-08-19 18:41     ` Robert Jarzmik
2015-08-17 21:59 ` [PATCH v2 07/21] ARM: pxa: magician: Fix IrDA pdata and redundant GPIO request Petr Cvek
2015-08-17 21:59   ` Petr Cvek
2015-08-19 18:41   ` Robert Jarzmik
2015-08-19 18:41     ` Robert Jarzmik
2015-08-17 22:00 ` [PATCH v2 08/21] ARM: pxa: magician: Add StrataFlash Vpp GPIO and alternative driver Petr Cvek
2015-08-17 22:00   ` Petr Cvek
2015-08-17 22:01 ` [PATCH v2 09/21] ARM: pxa: magician: Add OV9640 camera support Petr Cvek
2015-08-17 22:01   ` Petr Cvek
2015-08-20 19:48   ` Robert Jarzmik
2015-08-20 19:48     ` Robert Jarzmik
2015-08-20 20:26     ` Arnd Bergmann
2015-08-20 20:26       ` Arnd Bergmann
2015-08-20 22:39       ` Petr Cvek
2015-08-20 22:39         ` Petr Cvek
2015-08-21 13:45         ` Arnd Bergmann
2015-08-21 13:45           ` Arnd Bergmann
2015-08-21 17:36           ` Robert Jarzmik
2015-08-21 22:09             ` Petr Cvek
2015-08-21 22:09               ` Petr Cvek
2015-08-22 12:41               ` Robert Jarzmik
2015-08-22 12:41                 ` Robert Jarzmik
2015-08-24  6:53           ` Lee Jones
2015-08-24  6:53             ` Lee Jones
2015-08-17 22:01 ` [PATCH v2 10/21] ARM: pxa: magician: Add UDA1380 sound support Petr Cvek
2015-08-17 22:01   ` Petr Cvek
2015-08-20 19:51   ` Robert Jarzmik
2015-08-20 19:51     ` Robert Jarzmik
2015-08-20 23:01     ` Petr Cvek
2015-08-20 23:01       ` Petr Cvek
2015-08-28  8:48       ` Robert Jarzmik
2015-08-28  8:48         ` Robert Jarzmik
2015-08-17 22:01 ` [PATCH v2 11/21] ARM: pxa: magician: Add MAX1586 Vcore regulator support Petr Cvek
2015-08-17 22:01   ` Petr Cvek
2015-08-20 19:32   ` Robert Jarzmik
2015-08-20 19:32     ` Robert Jarzmik
2015-08-20 22:33     ` Petr Cvek
2015-08-20 22:33       ` Petr Cvek
2015-08-28  8:49       ` Robert Jarzmik
2015-08-28  8:49         ` Robert Jarzmik
2015-08-17 22:02 ` [PATCH v2 12/21] ARM: pxa: magician: Add PXA27x UDC support Petr Cvek
2015-08-17 22:02   ` Petr Cvek
2015-08-20 17:23   ` Robert Jarzmik
2015-08-20 17:23     ` Robert Jarzmik
2015-08-20 22:21     ` Petr Cvek
2015-08-20 22:21       ` Petr Cvek
2015-08-28  9:58       ` Robert Jarzmik [this message]
2015-08-28  9:58         ` Robert Jarzmik
2015-08-17 22:03 ` [PATCH v2 13/21] ARM: pxa: magician: Fix charging source and add NiCd backup charging Petr Cvek
2015-08-17 22:03   ` Petr Cvek
2015-08-17 22:18   ` Petr Cvek
2015-08-17 22:18     ` Petr Cvek
2015-08-17 22:03 ` [PATCH v2 14/21] ARM: pxa: magician: Fix PXA USB OHCI port enable flags Petr Cvek
2015-08-17 22:03   ` Petr Cvek
2015-08-17 22:03 ` [PATCH v2 15/21] ARM: pxa: magician: Fix PWM backlight regulator Petr Cvek
2015-08-17 22:03   ` Petr Cvek
2015-08-20 19:58   ` Robert Jarzmik
2015-08-20 19:58     ` Robert Jarzmik
2015-08-17 22:04 ` [PATCH v2 16/21] ARM: pxa: magician: Add support for alternative LCD backlight Petr Cvek
2015-08-17 22:04   ` Petr Cvek
2015-08-20 20:01   ` Robert Jarzmik
2015-08-20 20:01     ` Robert Jarzmik
2015-08-23 20:55     ` Petr Cvek
2015-08-23 20:55       ` Petr Cvek
2015-08-24  8:25       ` Robert Jarzmik
2015-08-24  8:25         ` Robert Jarzmik
2015-08-17 22:04 ` [PATCH v2 17/21] ARM: pxa: magician: Remove (temporarily) pasic3 LED support Petr Cvek
2015-08-17 22:04   ` Petr Cvek
2015-08-22 16:25   ` Robert Jarzmik
2015-08-22 16:25     ` Robert Jarzmik
2015-08-17 22:05 ` [PATCH v2 18/21] mfd: htc-pasic3: Prepare driver for leds-pasic3 Petr Cvek
2015-08-17 22:05   ` Petr Cvek
2015-08-18  6:52   ` Lee Jones
2015-08-18  6:52     ` Lee Jones
2015-08-18 21:01     ` Petr Cvek
2015-08-18 21:01       ` Petr Cvek
2015-08-19  6:58       ` Lee Jones
2015-08-19  6:58         ` Lee Jones
2015-08-17 22:06 ` [PATCH v2 19/21] leds: leds-pasic3: Add support for PASIC3 LED controller Petr Cvek
2015-08-17 22:06   ` Petr Cvek
2015-08-17 22:14   ` Petr Cvek
2015-08-17 22:14     ` Petr Cvek
2015-08-18 10:27   ` Jacek Anaszewski
2015-08-18 10:27     ` Jacek Anaszewski
2015-08-18 21:48     ` Petr Cvek
2015-08-18 21:48       ` Petr Cvek
2015-08-19  8:09       ` Philipp Zabel
2015-08-19  8:09         ` Philipp Zabel
2015-08-19  8:49       ` Jacek Anaszewski
2015-08-19  8:49         ` Jacek Anaszewski
2015-08-17 22:06 ` [PATCH v2 20/21] ARM: pxa: magician: Re-add pdata for new leds-pasic3 driver Petr Cvek
2015-08-17 22:06   ` Petr Cvek
2015-08-17 22:07 ` [PATCH v2 21/21] ARM: pxa: magician: Move platform_add_devices() to the end of magician_init() Petr Cvek
2015-08-17 22:07   ` Petr Cvek
2015-08-22 16:27   ` Robert Jarzmik
2015-08-22 16:27     ` Robert Jarzmik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871ten3fax.fsf@belgarion.home \
    --to=robert.jarzmik@free.fr \
    --cc=cooloney@gmail.com \
    --cc=daniel@zonque.org \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=petr.cvek@tul.cz \
    --cc=philipp.zabel@gmail.com \
    --cc=rpurdie@rpsys.net \
    --cc=sameo@linux.intel.com \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.