From patchwork Mon Mar 14 15:13:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 8580721 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 804C7C0553 for ; Mon, 14 Mar 2016 15:13:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 84349203F4 for ; Mon, 14 Mar 2016 15:13:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 241D2201CD for ; Mon, 14 Mar 2016 15:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965374AbcCNPNn (ORCPT ); Mon, 14 Mar 2016 11:13:43 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:35986 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932185AbcCNPNm (ORCPT ); Mon, 14 Mar 2016 11:13:42 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S27013692AbcCNPNkhzxZ0 (ORCPT ); Mon, 14 Mar 2016 16:13:40 +0100 Date: Mon, 14 Mar 2016 16:13:37 +0100 From: Ladislav Michl To: linux-omap@vger.kernel.org Cc: Richard Watts , Paul Walmsley , Robert Nelson , Tero Kristo Subject: DM3730 sprz319 erratum 2.1 Message-ID: <20160314151337.GB2897@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi there! seems it's been three years since: [PATCH 1/1] Fix sprz319 erratum 2.1 http://article.gmane.org/gmane.linux.ports.arm.omap/71633 errata: http://www.ti.com/lit/er/sprz319f/sprz319f.pdf Nice summary (third post by Rodrigo Lemos) can be found here: https://github.com/RobertCNelson/stable-kernel/issues/26 so I'm not going to repeat it here. Company I'm working for has few thousands of IGEPv2 boards in field. They have hub connected to usb port with udlfb display, 3G modem and usbserial: /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-omap/3p, 480M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=udlfb, 480M |__ Port 3: Dev 4, If 0, Class=Vendor Specific Class, Driver=option, 480M |__ Port 3: Dev 4, If 1, Class=Vendor Specific Class, Driver=, 480M |__ Port 3: Dev 4, If 2, Class=Vendor Specific Class, Driver=option, 480M |__ Port 3: Dev 4, If 3, Class=Vendor Specific Class, Driver=option, 480M |__ Port 3: Dev 4, If 4, Class=Mass Storage, Driver=usb-storage, 480M |__ Port 3: Dev 4, If 5, Class=Mass Storage, Driver=usb-storage, 480M |__ Port 4: Dev 5, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 3: Dev 6, If 0, Class=Communications, Driver=cdc_acm, 12M |__ Port 3: Dev 6, If 1, Class=CDC Data, Driver=cdc_acm, 12M Few tens of those disconnects USB after while (one minute to few hours) with: "usb usb3-port1: disabled by hub (EMI?), re-enabling..." IGEPv2 uses DM3730 with 26MHz crystal divided by two providing 13MHz SYS_CLK, therefore it is good candidate to fix. Patch bellow was used as a dirty hack to test if usb disconnects go away with errata applied. And indeed, device is already running for few days without any issues. Now question is, how should a proper fix look like as modifiing omap2_dpll_round_rate seems easy enough. Is that acceptable? How to test proper clock to apply errata? Comparing string is suboptimal. Should we introduce some flag? ladis --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux-4.5/drivers/clk/ti/dpll3xxx.c.orig 2016-03-14 12:43:58.085003085 +0100 +++ linux-4.5/drivers/clk/ti/dpll3xxx.c 2016-03-14 13:17:57.893417000 +0100 @@ -308,6 +308,7 @@ u8 dco, sd_div, ai = 0; u32 v; bool errata_i810; + const char *clk_name; /* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */ _omap3_noncore_dpll_bypass(clk); @@ -370,6 +371,12 @@ } } + clk_name = clk_hw_get_name(&clk->hw); + if (strcmp(clk_name, "dpll5_ck") == 0) { + pr_info("fixing %s (%04lx), %06x -> 01bb05\n", clk_name, dd->mult_div1_reg, v); + v = 0x1bb05; + } + ti_clk_ll_ops->clk_writel(v, dd->mult_div1_reg); /* Set 4X multiplier and low-power mode */ --- linux-4.5/drivers/clk/ti/divider.c.orig 2016-03-14 12:44:06.509211022 +0100 +++ linux-4.5/drivers/clk/ti/divider.c 2016-03-14 13:18:21.793417000 +0100 @@ -215,6 +215,7 @@ struct clk_divider *divider; unsigned int div, value; u32 val; + const char *clk_name; if (!hw || !rate) return -EINVAL; @@ -234,6 +235,13 @@ val &= ~(div_mask(divider) << divider->shift); } val |= value << divider->shift; + + clk_name = clk_hw_get_name(hw); + if (strcmp(clk_name, "dpll5_m2_ck") == 0) { + pr_info("fixing %s (%04lx), %04x -> 0008\n", clk_name, divider->reg, val); + val = 8; + } + ti_clk_ll_ops->clk_writel(val, divider->reg); return 0;