All of lore.kernel.org
 help / color / mirror / Atom feed
From: matthieu.castet@parrot.com (Matthieu CASTET)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/9] usb: chipidea: add PTW and PTS handling
Date: Wed, 21 Nov 2012 17:06:26 +0100	[thread overview]
Message-ID: <50ACFC02.9010805@parrot.com> (raw)
In-Reply-To: <20121121155723.GA16409@pengutronix.de>

Michael Grzeschik a ?crit :
> On Fri, Nov 16, 2012 at 05:39:42PM +0200, Alexander Shishkin wrote:
>> Matthieu CASTET <matthieu.castet@parrot.com> writes:
>>
>>> Alexander Shishkin a ?crit :
>>>> Michael Grzeschik <mgr@pengutronix.de> writes:
>>>>
>>>>> On Fri, Nov 16, 2012 at 03:34:23PM +0200, Alexander Shishkin wrote:
>>>>>> Michael Grzeschik <mgr@pengutronix.de> writes:
>>>>>>
>>>>>>> On Fri, Nov 16, 2012 at 02:45:39PM +0200, Alexander Shishkin wrote:
>>>>>>>> Michael Grzeschik <m.grzeschik@pengutronix.de> writes:
>>>>>>>>
>>>>>>>>> This patch makes it possible to configure the PTW and PTS bits inside
>>>>>>>>> the portsc register for host and device mode before the driver starts
>>>>>>>>> and the phy can be addressed as hardware implementation is designed.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
>>>>>>>>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
>>>>>>>>> ---
>>>>>>>>>  drivers/usb/chipidea/bits.h        |    3 +++
>>>>>>>>>  drivers/usb/chipidea/ci.h          |    2 ++
>>>>>>>>>  drivers/usb/chipidea/ci13xxx_imx.c |    1 +
>>>>>>>>>  drivers/usb/chipidea/core.c        |   47 ++++++++++++++++++++++++++++++++++++
>>>>>>>>>  drivers/usb/chipidea/host.c        |    4 +++
>>>>>>>>>  include/linux/usb/chipidea.h       |    9 +++++++
>>>>>>>>>  6 files changed, 66 insertions(+)
>>>>>>>>>
>>>>>>>>> diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
>>>>>>>>> index 4b6ae3e..3cded5f 100644
>>>>>>>>> --- a/drivers/usb/chipidea/bits.h
>>>>>>>>> +++ b/drivers/usb/chipidea/bits.h
>>>>>>>>> @@ -48,6 +48,9 @@
>>>>>>>>>  #define PORTSC_SUSP           BIT(7)
>>>>>>>>>  #define PORTSC_HSP            BIT(9)
>>>>>>>>>  #define PORTSC_PTC            (0x0FUL << 16)
>>>>>>>>> +#define PORTSC_PTS            (BIT(31) | BIT(30))
>>>>>>>>> +#define PORTSC_PTW            BIT(28)
>>>>>>>>> +#define PORTSC_STS            BIT(29)
>>>>>>>> Hm, my spec says these are actually in DEVLC register and only have this
>>>>>>>> meaning in device mode. And in portsc these bits fall in device address
>>>>>>>> bitfield. Can you refer me to your spec?
>>>>>>> You can find it here:
>>>>>>> http://cache.freescale.com/files/32bit/doc/ref_manual/iMX53RM.pdf?fpsp=1
>>>>>>> Page 4947
>>>>>> Oh, but see, the offset is 0x184, which in chipidea spec (the version
>>>>>> that I have) corresponds to DEVLC and not PORTSC. So in this driver's
>>>>>> terminology it's DEVLC too, at least currently.
>>>>>>
>>>>>> So have you tested this code and did it make any difference?
>>>>> Yes, i have tested this code with MX25, MX28, MX35 and MX53. In every
>>>>> SoCs Datasheet the PORTSC register is defined on PORTBASE+0x184. Without
>>>>> this proper configuration its not possible to communicate with the PHY.
>>>> No, I mean, you're writing DEVLC (using present driver's terminology)
>>>> bits to PORTSC register. It *shouldn't* work. I suppose, it does
>>>> something, but not exactly what you intended.
>>>>
>>> I confirm in our datasheet we have PTW, PTS, STS in this register  PORTSCx with
>>> this mapping.
>>>
>>> In later design that support lpm, these bits have to move in another register
>>> because ehci 1.1 use them [1].
>> Ahh, I didn't realize imxes were nolpm. Now it makes more sense. This
>> means that, as you suggested in the other mail, these portsc/devlc
>> accesses should be done conditionally based on ci->hw_bank.lpm.
> 
> To handle lpm devices in this patch, we need some register layout of the
> lpm core. Probably only te DEVLC register. Is there some documentation
> available?

In include/linux/usb/langwell_udc.h before it was removed, you could find the
mapping :

    u32 devlc;      /* control LPM and each USB port behavior */
/* bits 31:29, parallel transceiver select */
#define LPM_PTS(d)  (((d)>>29)&7)
#define LPM_STS     BIT(28) /* serial transceiver select */
#define LPM_PTW     BIT(27) /* parallel transceiver width */
#define LPM_PSPD(d) (((d)>>25)&3)   /* bits 26:25, port speed */
#define LPM_PSPD_MASK   (BIT(26) | BIT(25))
#define LPM_SPEED_FULL  0
#define LPM_SPEED_LOW   1
#define LPM_SPEED_HIGH  2
#define LPM_SRT     BIT(24) /* shorten reset time */
#define LPM_PFSC    BIT(23) /* port force full speed connect */
#define LPM_PHCD    BIT(22) /* PHY low power suspend clock disable */
#define LPM_STL     BIT(16) /* STALL reply to LPM token */
#define LPM_BA(d)   \
    (((d)>>1)&0x7ff)    /* bits 11:1, BmAttributes */
#define LPM_NYT_ACK BIT(0)  /* NYET/ACK reply to LPM token */

WARNING: multiple messages have this Message-ID (diff)
From: Matthieu CASTET <matthieu.castet-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
To: Michael Grzeschik <mgr-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Alexander Shishkin
	<alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Michael Grzeschik
	<m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org"
	<mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	"gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org"
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	"fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org"
	<fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	"kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org"
	<kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	"devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: Re: [PATCH 6/9] usb: chipidea: add PTW and PTS handling
Date: Wed, 21 Nov 2012 17:06:26 +0100	[thread overview]
Message-ID: <50ACFC02.9010805@parrot.com> (raw)
In-Reply-To: <20121121155723.GA16409-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Michael Grzeschik a écrit :
> On Fri, Nov 16, 2012 at 05:39:42PM +0200, Alexander Shishkin wrote:
>> Matthieu CASTET <matthieu.castet-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org> writes:
>>
>>> Alexander Shishkin a écrit :
>>>> Michael Grzeschik <mgr-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> writes:
>>>>
>>>>> On Fri, Nov 16, 2012 at 03:34:23PM +0200, Alexander Shishkin wrote:
>>>>>> Michael Grzeschik <mgr-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> writes:
>>>>>>
>>>>>>> On Fri, Nov 16, 2012 at 02:45:39PM +0200, Alexander Shishkin wrote:
>>>>>>>> Michael Grzeschik <m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> writes:
>>>>>>>>
>>>>>>>>> This patch makes it possible to configure the PTW and PTS bits inside
>>>>>>>>> the portsc register for host and device mode before the driver starts
>>>>>>>>> and the phy can be addressed as hardware implementation is designed.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Michael Grzeschik <m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>>>>>>>>> Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>>>>>>>>> ---
>>>>>>>>>  drivers/usb/chipidea/bits.h        |    3 +++
>>>>>>>>>  drivers/usb/chipidea/ci.h          |    2 ++
>>>>>>>>>  drivers/usb/chipidea/ci13xxx_imx.c |    1 +
>>>>>>>>>  drivers/usb/chipidea/core.c        |   47 ++++++++++++++++++++++++++++++++++++
>>>>>>>>>  drivers/usb/chipidea/host.c        |    4 +++
>>>>>>>>>  include/linux/usb/chipidea.h       |    9 +++++++
>>>>>>>>>  6 files changed, 66 insertions(+)
>>>>>>>>>
>>>>>>>>> diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
>>>>>>>>> index 4b6ae3e..3cded5f 100644
>>>>>>>>> --- a/drivers/usb/chipidea/bits.h
>>>>>>>>> +++ b/drivers/usb/chipidea/bits.h
>>>>>>>>> @@ -48,6 +48,9 @@
>>>>>>>>>  #define PORTSC_SUSP           BIT(7)
>>>>>>>>>  #define PORTSC_HSP            BIT(9)
>>>>>>>>>  #define PORTSC_PTC            (0x0FUL << 16)
>>>>>>>>> +#define PORTSC_PTS            (BIT(31) | BIT(30))
>>>>>>>>> +#define PORTSC_PTW            BIT(28)
>>>>>>>>> +#define PORTSC_STS            BIT(29)
>>>>>>>> Hm, my spec says these are actually in DEVLC register and only have this
>>>>>>>> meaning in device mode. And in portsc these bits fall in device address
>>>>>>>> bitfield. Can you refer me to your spec?
>>>>>>> You can find it here:
>>>>>>> http://cache.freescale.com/files/32bit/doc/ref_manual/iMX53RM.pdf?fpsp=1
>>>>>>> Page 4947
>>>>>> Oh, but see, the offset is 0x184, which in chipidea spec (the version
>>>>>> that I have) corresponds to DEVLC and not PORTSC. So in this driver's
>>>>>> terminology it's DEVLC too, at least currently.
>>>>>>
>>>>>> So have you tested this code and did it make any difference?
>>>>> Yes, i have tested this code with MX25, MX28, MX35 and MX53. In every
>>>>> SoCs Datasheet the PORTSC register is defined on PORTBASE+0x184. Without
>>>>> this proper configuration its not possible to communicate with the PHY.
>>>> No, I mean, you're writing DEVLC (using present driver's terminology)
>>>> bits to PORTSC register. It *shouldn't* work. I suppose, it does
>>>> something, but not exactly what you intended.
>>>>
>>> I confirm in our datasheet we have PTW, PTS, STS in this register  PORTSCx with
>>> this mapping.
>>>
>>> In later design that support lpm, these bits have to move in another register
>>> because ehci 1.1 use them [1].
>> Ahh, I didn't realize imxes were nolpm. Now it makes more sense. This
>> means that, as you suggested in the other mail, these portsc/devlc
>> accesses should be done conditionally based on ci->hw_bank.lpm.
> 
> To handle lpm devices in this patch, we need some register layout of the
> lpm core. Probably only te DEVLC register. Is there some documentation
> available?

In include/linux/usb/langwell_udc.h before it was removed, you could find the
mapping :

    u32 devlc;      /* control LPM and each USB port behavior */
/* bits 31:29, parallel transceiver select */
#define LPM_PTS(d)  (((d)>>29)&7)
#define LPM_STS     BIT(28) /* serial transceiver select */
#define LPM_PTW     BIT(27) /* parallel transceiver width */
#define LPM_PSPD(d) (((d)>>25)&3)   /* bits 26:25, port speed */
#define LPM_PSPD_MASK   (BIT(26) | BIT(25))
#define LPM_SPEED_FULL  0
#define LPM_SPEED_LOW   1
#define LPM_SPEED_HIGH  2
#define LPM_SRT     BIT(24) /* shorten reset time */
#define LPM_PFSC    BIT(23) /* port force full speed connect */
#define LPM_PHCD    BIT(22) /* PHY low power suspend clock disable */
#define LPM_STL     BIT(16) /* STALL reply to LPM token */
#define LPM_BA(d)   \
    (((d)>>1)&0x7ff)    /* bits 11:1, BmAttributes */
#define LPM_NYT_ACK BIT(0)  /* NYET/ACK reply to LPM token */
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2012-11-21 16:06 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 16:19 [PATCH 0/9] chipidea fixes and features Michael Grzeschik
2012-11-14 16:19 ` Michael Grzeschik
2012-11-14 16:19 ` [PATCH 1/9] usb: chipidea: pci: mark platformdata as static and __devinitdata Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 10:06   ` Alexander Shishkin
2012-11-16 10:06     ` Alexander Shishkin
2012-11-16 10:17     ` Marc Kleine-Budde
2012-11-16 10:17       ` Marc Kleine-Budde
2012-11-16 11:41       ` Alexander Shishkin
2012-11-16 11:41         ` Alexander Shishkin
2012-11-16 12:02     ` Greg KH
2012-11-16 12:02       ` Greg KH
2012-11-14 16:19 ` [PATCH 2/9] usb: chipidea: ci13xxx_imx: add 2nd and 3rd clock to support imx5x and newer Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-26  9:29   ` Peter Chen
2012-11-26  9:29     ` Peter Chen
2012-11-26 10:22     ` Sascha Hauer
2012-11-26 10:22       ` Sascha Hauer
2012-11-27  6:50       ` Peter Chen
2012-11-27  6:50         ` Peter Chen
2012-11-27  7:34         ` Sascha Hauer
2012-11-27  7:34           ` Sascha Hauer
2012-11-14 16:19 ` [PATCH 3/9] usb: chipidea: ci13xxx-imx: create dynamic platformdata Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 10:14   ` Alexander Shishkin
2012-11-16 10:14     ` Alexander Shishkin
2012-11-16 10:19     ` Marc Kleine-Budde
2012-11-16 10:19       ` Marc Kleine-Budde
2012-11-16 12:06   ` Alexander Shishkin
2012-11-16 12:06     ` Alexander Shishkin
2012-11-14 16:19 ` [PATCH 4/9] usb: chipidea: ci13xxx-imx: add "dr_mode" property to device tree bindings Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 11:53   ` Alexander Shishkin
2012-11-16 11:53     ` Alexander Shishkin
2012-11-16 11:55     ` Marc Kleine-Budde
2012-11-16 11:55       ` Marc Kleine-Budde
2012-11-26  9:46     ` Peter Chen
2012-11-26  9:46       ` Peter Chen
2012-11-29 12:54       ` Alexander Shishkin
2012-11-29 12:54         ` Alexander Shishkin
2012-11-14 16:19 ` [PATCH 5/9] usb: add phy connection by phy-mode Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16  9:25   ` Alexander Shishkin
2012-11-16  9:25     ` Alexander Shishkin
2012-11-16 11:28   ` Felipe Balbi
2012-11-16 11:28     ` Felipe Balbi
2012-11-16 11:31   ` Felipe Balbi
2012-11-16 11:31     ` Felipe Balbi
2012-11-16 11:44     ` Marc Kleine-Budde
2012-11-16 11:44       ` Marc Kleine-Budde
2012-11-16 13:41       ` Felipe Balbi
2012-11-16 13:41         ` Felipe Balbi
2012-11-16 14:32         ` Marc Kleine-Budde
2012-11-16 14:32           ` Marc Kleine-Budde
2012-11-26  9:56   ` Peter Chen
2012-11-26  9:56     ` Peter Chen
2012-11-14 16:19 ` [PATCH 6/9] usb: chipidea: add PTW and PTS handling Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 12:18   ` Alexander Shishkin
2012-11-16 12:18     ` Alexander Shishkin
2012-11-16 12:45   ` Alexander Shishkin
2012-11-16 12:45     ` Alexander Shishkin
2012-11-16 13:16     ` Michael Grzeschik
2012-11-16 13:16       ` Michael Grzeschik
2012-11-16 13:34       ` Alexander Shishkin
2012-11-16 13:34         ` Alexander Shishkin
2012-11-16 13:57         ` Michael Grzeschik
2012-11-16 13:57           ` Michael Grzeschik
2012-11-16 14:06           ` Alexander Shishkin
2012-11-16 14:06             ` Alexander Shishkin
2012-11-16 14:46             ` Matthieu CASTET
2012-11-16 14:46               ` Matthieu CASTET
2012-11-16 15:39               ` Alexander Shishkin
2012-11-16 15:39                 ` Alexander Shishkin
2012-11-21 15:57                 ` Michael Grzeschik
2012-11-21 15:57                   ` Michael Grzeschik
2012-11-21 16:06                   ` Matthieu CASTET [this message]
2012-11-21 16:06                     ` Matthieu CASTET
2012-11-27  1:12   ` Peter Chen
2012-11-27  1:12     ` Peter Chen
2012-11-27  9:54     ` Michael Grzeschik
2012-11-27  9:54       ` Michael Grzeschik
2012-11-28  1:26       ` Peter Chen
2012-11-28  1:26         ` Peter Chen
2012-11-14 16:19 ` [PATCH 7/9] usb: chipidea: udc: add force-full-speed option Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 12:51   ` Alexander Shishkin
2012-11-16 12:51     ` Alexander Shishkin
2012-11-16 14:53     ` Matthieu CASTET
2012-11-16 14:53       ` Matthieu CASTET
2012-11-14 16:19 ` [PATCH 8/9] usb: chipidea: udc: remove unlocked ep_queue which can lead to an race Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 12:55   ` Alexander Shishkin
2012-11-16 12:55     ` Alexander Shishkin
2012-11-14 16:19 ` [PATCH 9/9] usb: chipidea: udc: configure iso endpoints Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-14 18:04   ` Sergei Shtylyov
2012-11-14 18:04     ` Sergei Shtylyov

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=50ACFC02.9010805@parrot.com \
    --to=matthieu.castet@parrot.com \
    --cc=linux-arm-kernel@lists.infradead.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.