Re: Is UPS_PORT_POWER wrong?

From: Kohji Okuno <okuno.kohji_at_jp.panasonic.com>
Date: Sat, 28 Jan 2012 20:53:39 +0900 (JST)
Hi HPS,

Do you have better idea?

From: Kohji Okuno <okuno.kohji_at_jp.panasonic.com>
Date: Tue, 24 Jan 2012 09:53:29 +0900 (JST)

> Hi HPS,
> 
>> On Monday 23 January 2012 09:12:46 Kohji Okuno wrote:
>>> Hi HPS,
>>> 
>>> I think that UPS_PORT_POWER and UPS_PORT_LINK_STATE overlap.
>>> And, in xhci.c you set UPS_PORT_POWER as folows.
>>> 
>>> When UPS_PORT_POWER is set, UPS_PORT_LINK_STATE_GET() macro will
>>> return incorrect value.
>>> 
>>>                 if (v & XHCI_PS_PP) {
>>>                         /*
>>>                          * The USB 3.0 RH is using the
>>>                          * USB 2.0's power bit
>>>                          */
>>>                         i |= UPS_PORT_POWER;
>>>                 }
>>> 
>> 
>> Hi,
>> 
>> The USB 3.0 root HUB is special because it defines FULL/HIGH and LOW speed, so 
>> I had to merge that into the port status register of the XHCI root HUB like 
>> this:
>> 
>> 0: CONNECT_STATUS
>> 1: PORT_ENABLED
>> 2: SUSPEND
>> 3: OVERCURRENT_INDICATOR
>> 4: LINK STATE (USB 3.0)
>> 5: -
>> 6: -
>> 7: -
>> 8: PORT_POWER (USB 2.0)
>> # Bit 9+10 have 4 combinations which are defined: FS, LW, HS, SS
>> 9: LOW_SPEED (USB 2.0)
>> 10: HIGH_SPEED (USB 2.0)
>> 11: not implemented
>> 12: PORT_INDICATOR
>> 13:
>> 14:
>> 15: MODE_DEVICE (FreeBSD specific)
>> 
>> If you have a better idea, it is possible to change this.
> 
> I have a idea.
> 
> -#define UPS_PORT_LINK_STATE_GET(x)      (((x) >> 5) & 0xF)
> -#define UPS_PORT_LINK_STATE_SET(x)      (((x) & 0xF) << 5)
> +#define UPS_PORT_LINK_STATE_GET(x)      ((((x) >> 5) & 0x7)|(((x) >> 11) & 0x8))
> +#define UPS_PORT_LINK_STATE_SET(x)      ((((x) & 0x7) << 5)|(((x) & 0x8) << 11))
> +#define UPS_PORT_LS_SS                  0x4000  /* currently FreeBSD specific */
> 
> But, this is not cool.
> 
> Regards,
>  Kohji Okuno
Received on Sat Jan 28 2012 - 10:54:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:23 UTC