From patchwork Tue Feb 21 08:56:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Leitner X-Patchwork-Id: 730383 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vSF3g74FFz9s3v for ; Tue, 21 Feb 2017 20:06:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751107AbdBUJGW (ORCPT ); Tue, 21 Feb 2017 04:06:22 -0500 Received: from mail2.skidata.com ([91.230.2.91]:17116 "EHLO mail2.skidata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751023AbdBUJGV (ORCPT ); Tue, 21 Feb 2017 04:06:21 -0500 X-Greylist: delayed 587 seconds by postgrey-1.27 at vger.kernel.org; Tue, 21 Feb 2017 04:06:20 EST X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2GBBABJAKxY/0oKEKxeHAEBBAEBCgEBh?= =?us-ascii?q?DKBCQegAoFukSeCD4INJoV8AoMZFgECAQEBAQEBAQOBB4JiTQEBAQEBAQEBAUw?= =?us-ascii?q?CDV4GJ1IQGDlXBgENBYl8r3c6JgKLLgEBAQEBAQEBAQEBAQEBAQEBHAUJAYZCh?= =?us-ascii?q?2WBRIV/BYkZkm+CAoRyiyuKWIY0kyQmAYExEBAQBB+CZYQ3dIoDgQ0BAQE?= X-IPAS-Result: =?us-ascii?q?A2GBBABJAKxY/0oKEKxeHAEBBAEBCgEBhDKBCQegAoFukSe?= =?us-ascii?q?CD4INJoV8AoMZFgECAQEBAQEBAQOBB4JiTQEBAQEBAQEBAUwCDV4GJ1IQGDlXB?= =?us-ascii?q?gENBYl8r3c6JgKLLgEBAQEBAQEBAQEBAQEBAQEBHAUJAYZCh2WBRIV/BYkZkm+?= =?us-ascii?q?CAoRyiyuKWIY0kyQmAYExEBAQBB+CZYQ3dIoDgQ0BAQE?= X-IronPort-AV: E=Sophos;i="5.35,188,1484002800"; d="scan'208";a="404354" From: Richard Leitner To: , CC: , , , , , Richard Leitner Subject: [PATCH 2/3] usb: usb251xb: dt: add unit suffix to oc-delay and power-on-time Date: Tue, 21 Feb 2017 09:56:18 +0100 Message-ID: <1487667379-2075-3-git-send-email-richard.leitner@skidata.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1487667379-2075-1-git-send-email-richard.leitner@skidata.com> References: <1487667379-2075-1-git-send-email-richard.leitner@skidata.com> MIME-Version: 1.0 X-Originating-IP: [172.16.60.30] X-ClientProxiedBy: sdex1srv.skidata.net (172.16.10.92) To sdex1srv.skidata.net (172.16.10.92) Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Rename oc-delay-* to oc-delay-us and make it expect a time value. Furthermore add -ms suffix to power-on-time. These changes were suggested by Rob Herring in https://lkml.org/lkml/2017/2/15/1283. Signed-off-by: Richard Leitner --- Documentation/devicetree/bindings/usb/usb251xb.txt | 9 +++--- drivers/usb/misc/usb251xb.c | 32 +++++++++++++--------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/usb251xb.txt b/Documentation/devicetree/bindings/usb/usb251xb.txt index a5efd10..4d6bd73 100644 --- a/Documentation/devicetree/bindings/usb/usb251xb.txt +++ b/Documentation/devicetree/bindings/usb/usb251xb.txt @@ -31,7 +31,8 @@ Optional properties : (default is individual) - dynamic-power-switching : enable auto-switching from self- to bus-powered operation if the local power source is removed or unavailable - - oc-delay-{100us,4ms,8ms,16ms} : set over current timer delay (default is 8ms) + - oc-delay-us : microseconds over current timer delay, valid values are 100, + 4000, 8000 (default) and 16000. All other values are rounded up. - compound-device : indicated the hub is part of a compound device - port-mapping-mode : enable port mapping mode - string-support : enable string descriptor support (required for manufacturer, @@ -40,9 +41,9 @@ Optional properties : device connected. - sp-disabled-ports : Specifies the ports which will be self-power disabled - bp-disabled-ports : Specifies the ports which will be bus-power disabled - - power-on-time : Specifies the time it takes from the time the host initiates - the power-on sequence to a port until the port has adequate power. The - value is given in ms in a 0 - 510 range (default is 100ms). + - power-on-time-ms : Specifies the time it takes from the time the host + initiates the power-on sequence to a port until the port has adequate + power. The value is given in ms in a 0 - 510 range (default is 100ms). Examples: usb2512b@2c { diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c index 3f9c306..58b887a 100644 --- a/drivers/usb/misc/usb251xb.c +++ b/drivers/usb/misc/usb251xb.c @@ -375,18 +375,24 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, if (of_get_property(np, "dynamic-power-switching", NULL)) hub->conf_data2 |= BIT(7); - if (of_get_property(np, "oc-delay-100us", NULL)) { - hub->conf_data2 &= ~BIT(5); - hub->conf_data2 &= ~BIT(4); - } else if (of_get_property(np, "oc-delay-4ms", NULL)) { - hub->conf_data2 &= ~BIT(5); - hub->conf_data2 |= BIT(4); - } else if (of_get_property(np, "oc-delay-8ms", NULL)) { - hub->conf_data2 |= BIT(5); - hub->conf_data2 &= ~BIT(4); - } else if (of_get_property(np, "oc-delay-16ms", NULL)) { - hub->conf_data2 |= BIT(5); - hub->conf_data2 |= BIT(4); + if (!of_property_read_u32(np, "oc-delay-us", property_u32)) { + if (*property_u32 < 100) { + /* 100 us*/ + hub->conf_data2 &= ~BIT(5); + hub->conf_data2 &= ~BIT(4); + } else if (*property_u32 < 4000) { + /* 4 ms */ + hub->conf_data2 &= ~BIT(5); + hub->conf_data2 |= BIT(4); + } else if (*property_u32 < 8000) { + /* 8 ms */ + hub->conf_data2 |= BIT(5); + hub->conf_data2 &= ~BIT(4); + } else { + /* 16 ms */ + hub->conf_data2 |= BIT(5); + hub->conf_data2 |= BIT(4); + } } if (of_get_property(np, "compound-device", NULL)) @@ -433,7 +439,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, } hub->power_on_time = USB251XB_DEF_POWER_ON_TIME; - if (!of_property_read_u32(np, "power-on-time", property_u32)) + if (!of_property_read_u32(np, "power-on-time-ms", property_u32)) hub->power_on_time = min_t(u8, be32_to_cpu(*property_u32) / 2, 255);