From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.groups.io with SMTP id smtpd.web11.6258.1589377291133845822 for ; Wed, 13 May 2020 06:41:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=uSjUwwYG; spf=pass (domain: nuviainc.com, ip: 209.85.128.67, mailfrom: leif@nuviainc.com) Received: by mail-wm1-f67.google.com with SMTP id u16so28528174wmc.5 for ; Wed, 13 May 2020 06:41:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WkmAYJt8FY7DNwqG9wrDLwNQvOKJ/o8SY5/pp3acIZs=; b=uSjUwwYG7VjL7I55jZcBFjlZA9uajNzWwIpkoDx9aVax0M2QYfrTsqEXlBWtXhrELh ITWz8c27EHPPqBWuH3PIMFm8a4Hj0h+ZkmW4CJqAcDycD9skneW9eprdCYUzI6xXu0BE +dH5llB0hBpWjPLNG5hi3Mq0kJppEW3sVirG3ORDmj9ztsPZ8eG+hykM6wRrn3AqiVlG +naCQ5J13aNs76ChzI0g24NobEAs5P/vJa52gNQkbdlTMlWBhQm2/c7gIL48Mm9FoNA/ OvLOKcQofb2aARgPEO6+rhBUD6sbkbp4GNzMZheYmISF4/tM4OsZVD/PnxGNlwvDhsSE 7Pwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WkmAYJt8FY7DNwqG9wrDLwNQvOKJ/o8SY5/pp3acIZs=; b=fraMSJbn+zoucRJBQHb4ScCmvS6GzgphA4CrUZ/UWksYDQ/bFG/Gcy+62XWpmPJDlu oIlE9qQcGCgl9ZGm9i+sbceGD/RO9otxPveZ0Yo0R6CDDks8TTbkoHDwcwmaP6g6aQUt hPOxaWxZ7qkZO3+FTIEC+kVDO3phNOPT4zNr/qgxAKnE5oTBqRaCOYmA6/4+pBtiLmcC 2DwwPCNvcYBbez+jfv6eR6JCw82peNTIjDpo6tJbbC0SlqbXvZSCXoyeHjQkexQXZMTr sdlxOfYLjYR6bUI1t9/6ekwmWl6NDeAOeZWR6z/D3ZE7nv1WgfQ7sMooIf6zqKyLm1ri /oBQ== X-Gm-Message-State: AGi0PuaHt5zWDwJlCZr84/sBS+iytPd4SwiTyHBNDs1jz/YkI08PuuU8 i2P3dK/hwxaQ8Jh4ihOXNAB+tg== X-Google-Smtp-Source: APiQypJeEgVVfXrziBH/C5ObO/rg8/G9XksOhvN7/PiuaOEboUx/jYQCBWAxaPK7OAoHouIXN96f4Q== X-Received: by 2002:a1c:3c42:: with SMTP id j63mr40345354wma.118.1589377289507; Wed, 13 May 2020 06:41:29 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id t129sm9614825wmg.27.2020.05.13.06.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 06:41:28 -0700 (PDT) Date: Wed, 13 May 2020 14:41:26 +0100 From: "Leif Lindholm" To: Marcin Wojtas Cc: devel@edk2.groups.io, ard.biesheuvel@arm.com, jsd@semihalf.com, jaz@semihalf.com, kostap@marvell.com Subject: Re: [edk2-platforms: PATCH 1/3] Marvell/Library: UtmiLib: update USB2.0 analog settings Message-ID: <20200513134126.GQ21486@vanye> References: <1589309971-12939-1-git-send-email-mw@semihalf.com> <1589309971-12939-2-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1589309971-12939-2-git-send-email-mw@semihalf.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, May 12, 2020 at 20:59:29 +0200, Marcin Wojtas wrote: > This patch introduce following modifications, allowing to > overcome the instabilities observed with certain USB2.0 endpoints: > * Add additional step which enables the Impedance and PLL calibration. > * Enable old squelch detector instead of the new analog squelch detector > circuit and update host disconnect threshold value. > * Update LS TX driver strength coarse and fine adjustment values. > > Signed-off-by: Grzegorz Jaszczyk > Signed-off-by: Marcin Wojtas > --- > Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.h | 10 +++++++- > Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.c | 26 ++++++++++++++------ > 2 files changed, 27 insertions(+), 9 deletions(-) > > diff --git a/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.h b/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.h > index 20e3133..8659110 100644 > --- a/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.h > +++ b/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.h > @@ -44,6 +44,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #define UTMI_CALIB_CTRL_REG 0x8 > #define UTMI_CALIB_CTRL_IMPCAL_VTH_OFFSET 8 > #define UTMI_CALIB_CTRL_IMPCAL_VTH_MASK (0x7 << UTMI_CALIB_CTRL_IMPCAL_VTH_OFFSET) > +#define UTMI_CALIB_CTRL_IMPCAL_START_OFFSET 13 > +#define UTMI_CALIB_CTRL_IMPCAL_START_MASK (0x1 << UTMI_CALIB_CTRL_IMPCAL_START_OFFSET) > +#define UTMI_CALIB_CTRL_PLLCAL_START_OFFSET 22 > +#define UTMI_CALIB_CTRL_PLLCAL_START_MASK (0x1 << UTMI_CALIB_CTRL_PLLCAL_START_OFFSET) > #define UTMI_CALIB_CTRL_IMPCAL_DONE_OFFSET 23 > #define UTMI_CALIB_CTRL_IMPCAL_DONE_MASK (0x1 << UTMI_CALIB_CTRL_IMPCAL_DONE_OFFSET) > #define UTMI_CALIB_CTRL_PLLCAL_DONE_OFFSET 31 > @@ -54,8 +58,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #define UTMI_TX_CH_CTRL_DRV_EN_LS_MASK (0xf << UTMI_TX_CH_CTRL_DRV_EN_LS_OFFSET) > #define UTMI_TX_CH_CTRL_IMP_SEL_LS_OFFSET 16 > #define UTMI_TX_CH_CTRL_IMP_SEL_LS_MASK (0xf << UTMI_TX_CH_CTRL_IMP_SEL_LS_OFFSET) > +#define UTMI_TX_CH_CTRL_AMP_OFFSET 20 > +#define UTMI_TX_CH_CTRL_AMP_MASK (0x7 << UTMI_TX_CH_CTRL_AMP_OFFSET) > > #define UTMI_RX_CH_CTRL0_REG 0x14 > +#define UTMI_RX_CH_CTRL0_DISCON_THRESH_OFFSET 8 > +#define UTMI_RX_CH_CTRL0_DISCON_THRESH_MASK (0x3 << UTMI_RX_CH_CTRL0_DISCON_THRESH_OFFSET) > #define UTMI_RX_CH_CTRL0_SQ_DET_OFFSET 15 > #define UTMI_RX_CH_CTRL0_SQ_DET_MASK (0x1 << UTMI_RX_CH_CTRL0_SQ_DET_OFFSET) > #define UTMI_RX_CH_CTRL0_SQ_ANA_DTC_OFFSET 28 > @@ -63,7 +71,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > #define UTMI_RX_CH_CTRL1_REG 0x18 > #define UTMI_RX_CH_CTRL1_SQ_AMP_CAL_OFFSET 0 > -#define UTMI_RX_CH_CTRL1_SQ_AMP_CAL_MASK (0x3 << UTMI_RX_CH_CTRL1_SQ_AMP_CAL_OFFSET) > +#define UTMI_RX_CH_CTRL1_SQ_AMP_CAL_MASK (0x7 << UTMI_RX_CH_CTRL1_SQ_AMP_CAL_OFFSET) > #define UTMI_RX_CH_CTRL1_SQ_AMP_CAL_EN_OFFSET 3 > #define UTMI_RX_CH_CTRL1_SQ_AMP_CAL_EN_MASK (0x1 << UTMI_RX_CH_CTRL1_SQ_AMP_CAL_EN_OFFSET) > > diff --git a/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.c b/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.c > index 3881ebd..60ea06e 100644 > --- a/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.c > +++ b/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.c > @@ -117,24 +117,34 @@ UtmiPhyConfig ( > RegSet (UtmiBaseAddr + UTMI_PLL_CTRL_REG, Data, Mask); > > /* Impedance Calibration Threshold Setting */ > - RegSet (UtmiBaseAddr + UTMI_CALIB_CTRL_REG, > - 0x6 << UTMI_CALIB_CTRL_IMPCAL_VTH_OFFSET, > - UTMI_CALIB_CTRL_IMPCAL_VTH_MASK); > + Mask = UTMI_CALIB_CTRL_IMPCAL_VTH_MASK; > + Data = 0x7 << UTMI_CALIB_CTRL_IMPCAL_VTH_OFFSET; > + RegSet (UtmiBaseAddr + UTMI_CALIB_CTRL_REG, Data, Mask); > + > + /* Start Impedance and PLL Calibration */ > + Mask = UTMI_CALIB_CTRL_PLLCAL_START_MASK; > + Data = (0x1 << UTMI_CALIB_CTRL_PLLCAL_START_OFFSET); > + Mask |= UTMI_CALIB_CTRL_IMPCAL_START_MASK; > + Data |= (0x1 << UTMI_CALIB_CTRL_IMPCAL_START_OFFSET); > + RegSet (UtmiBaseAddr + UTMI_CALIB_CTRL_REG, Data, Mask); > > /* Set LS TX driver strength coarse control */ > - Mask = UTMI_TX_CH_CTRL_DRV_EN_LS_MASK; > - Data = 0x3 << UTMI_TX_CH_CTRL_DRV_EN_LS_OFFSET; > - /* Set LS TX driver fine adjustment */ > + Mask = UTMI_TX_CH_CTRL_AMP_MASK; > + Data = 0x4 << UTMI_TX_CH_CTRL_AMP_OFFSET; > Mask |= UTMI_TX_CH_CTRL_IMP_SEL_LS_MASK; > Data |= 0x3 << UTMI_TX_CH_CTRL_IMP_SEL_LS_OFFSET; > + Mask |= UTMI_TX_CH_CTRL_DRV_EN_LS_MASK; > + Data |= 0x3 << UTMI_TX_CH_CTRL_DRV_EN_LS_OFFSET; > RegSet (UtmiBaseAddr + UTMI_TX_CH_CTRL_REG, Data, Mask); The above looks a bit more chaotic than necessary, partly because what looks like spuriously moving the existing assignment around and deleting a comment Is there a rationale behind that? I.e., the following would appear equivalent: /* Set LS TX driver strength coarse control */ Mask = UTMI_TX_CH_CTRL_DRV_EN_LS_MASK; Data = 0x3 << UTMI_TX_CH_CTRL_DRV_EN_LS_OFFSET; + Mask |= UTMI_TX_CH_CTRL_AMP_MASK; + Data |= 0x4 << UTMI_TX_CH_CTRL_AMP_OFFSET; /* Set LS TX driver fine adjustment */ Mask |= UTMI_TX_CH_CTRL_IMP_SEL_LS_MASK; Data |= 0x3 << UTMI_TX_CH_CTRL_IMP_SEL_LS_OFFSET; RegSet (UtmiBaseAddr + UTMI_TX_CH_CTRL_REG, Data, Mask); / Leif > > /* Enable SQ */ > Mask = UTMI_RX_CH_CTRL0_SQ_DET_MASK; > - Data = 0x0 << UTMI_RX_CH_CTRL0_SQ_DET_OFFSET; > + Data = 0x1 << UTMI_RX_CH_CTRL0_SQ_DET_OFFSET; > /* Enable analog squelch detect */ > Mask |= UTMI_RX_CH_CTRL0_SQ_ANA_DTC_MASK; > - Data |= 0x1 << UTMI_RX_CH_CTRL0_SQ_ANA_DTC_OFFSET; > + Data |= 0x0 << UTMI_RX_CH_CTRL0_SQ_ANA_DTC_OFFSET; > + Mask |= UTMI_RX_CH_CTRL0_DISCON_THRESH_MASK; > + Data |= 0x0 << UTMI_RX_CH_CTRL0_DISCON_THRESH_OFFSET; > RegSet (UtmiBaseAddr + UTMI_RX_CH_CTRL0_REG, Data, Mask); > > /* Set External squelch calibration number */ > -- > 2.7.4 >