Date: Tue, 24 Jan 2012 09:53:29 +0900 (JST) From: Kohji Okuno <okuno.kohji@jp.panasonic.com> To: hselasky@c2i.net Cc: freebsd-current@freebsd.org, okuno.kohji@jp.panasonic.com Subject: Re: Is UPS_PORT_POWER wrong? Message-ID: <20120124.095329.1799630236416551619.okuno.kohji@jp.panasonic.com> In-Reply-To: <201201231829.19576.hselasky@c2i.net> References: <20120123.171246.321689433999174416.okuno.kohji@jp.panasonic.com> <201201231829.19576.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120124.095329.1799630236416551619.okuno.kohji>
