From owner-freebsd-current@FreeBSD.ORG Sat Jan 28 11:54:02 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 0E934106566C for ; Sat, 28 Jan 2012 11:54:02 +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 A6B828FC0A for ; Sat, 28 Jan 2012 11:54:01 +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-maile13) with ESMTP id q0SBreml018303; Sat, 28 Jan 2012 20:53:40 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili11) with ESMTP id q0SBrda21533; Sat, 28 Jan 2012 20:53:39 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi15) id q0SBrdTI016542; Sat, 28 Jan 2012 20:53:39 +0900 Received: from localhost by lomi15.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id q0SBrduU016530; Sat, 28 Jan 2012 20:53:39 +0900 Date: Sat, 28 Jan 2012 20:53:39 +0900 (JST) Message-Id: <20120128.205339.1305564732068259146.okuno.kohji@jp.panasonic.com> To: hselasky@c2i.net From: Kohji Okuno In-Reply-To: <20120124.095329.1799630236416551619.okuno.kohji@jp.panasonic.com> References: <20120123.171246.321689433999174416.okuno.kohji@jp.panasonic.com> <201201231829.19576.hselasky@c2i.net> <20120124.095329.1799630236416551619.okuno.kohji@jp.panasonic.com> 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: Sat, 28 Jan 2012 11:54:02 -0000 Hi HPS, Do you have better idea? From: Kohji Okuno 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