From owner-freebsd-current@FreeBSD.ORG Tue Jan 24 00:53:46 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFF81106566B for ; Tue, 24 Jan 2012 00:53:46 +0000 (UTC) (envelope-from okuno.kohji@jp.panasonic.com) Received: from smtp.mei.co.jp (smtp.mei.co.jp [133.183.100.20]) by mx1.freebsd.org (Postfix) with ESMTP id 6C09A8FC08 for ; Tue, 24 Jan 2012 00:53:45 +0000 (UTC) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile11) with ESMTP id q0O0rWfN024567; Tue, 24 Jan 2012 09:53:32 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili17) with ESMTP id q0O0rX327650; Tue, 24 Jan 2012 09:53:33 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi11) id q0O0rWj6027924; Tue, 24 Jan 2012 09:53:32 +0900 Received: from localhost by lomi11.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id q0O0rWmI027839; Tue, 24 Jan 2012 09:53:32 +0900 Date: Tue, 24 Jan 2012 09:53:29 +0900 (JST) Message-Id: <20120124.095329.1799630236416551619.okuno.kohji@jp.panasonic.com> To: hselasky@c2i.net From: Kohji Okuno In-Reply-To: <201201231829.19576.hselasky@c2i.net> References: <20120123.171246.321689433999174416.okuno.kohji@jp.panasonic.com> <201201231829.19576.hselasky@c2i.net> Organization: Panasonic Corporation X-Mailer: Mew version 6.4 on Emacs 23.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, okuno.kohji@jp.panasonic.com Subject: Re: Is UPS_PORT_POWER wrong? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2012 00:53:47 -0000 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