Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7711975ybi; Mon, 22 Jul 2019 19:08:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx46F/tA9YW8sWHlUsPtq6C+unrVypaasskKOYt2cIF0N1ewRoAkKfW8SI5/RtNPrXY7oJB X-Received: by 2002:a17:902:9b94:: with SMTP id y20mr77996700plp.260.1563847700770; Mon, 22 Jul 2019 19:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563847700; cv=none; d=google.com; s=arc-20160816; b=K6MSDGIXkVaJPdeiFzLunMO9bqVh1gdS6ebRfebrN67ZcgKsPdCHIBmavFc77EKiSc T5r3biweWIUq+qVWQaM7osHM4uzCBsgmEY4ekVGMCRgNBwguOjnxkDj94bHJ+MRZT5rt 8jnedtcZdvJW3CZoUCu7BpihMpvuOskEdkIrmNZhFtMlLa9I4BF+zQL/7aBoDz1e4fgI GA26gj06o1gTEr5DlUZtcMnVfH+X3cxuejVh9ol+I/7GXq0kA1ZYsWux78MqC2rBbP4e wLQI8ZigAhmR0QvFm6l4DP0yHtevCk7QV4n1bVen97vUOPllXYIJUXazsd/qjfiu7dSJ tDig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RTpdlQyeL6bUmfZxFwZVri3i7nbPBO/dWR0GM1UFauc=; b=O+DZ+Lu9pNaaBP8QhbzkJ1npcsh0Gdu/DWaslWsFdzstLFiovhbbdIbW8FXmha8aVV WQpEfqGP8oHrs4PWo6xDmV8wI+4129DY2S6UrzOfnh+itBGwNfPu13oCBk53LZHU7E9j 9HEJyCBsxIZrz/i2qPTjswhzswZ4zLIq50dwiFVj5Cve93Cjs7HfN+Er9iXBUBGN7Sjp 2AHfM2Msc2G/wP01HV61kWUDIW7AYkLXsc3+uQ6XkeE4w3ZDKn/OjQwHOZxMlMHVEeaX vo6aj2+/+nnqYLOVoSM2/exFdsduX91ZBg/eagiBKHGnP4Numw+Sd9Y0r0k5RthUQy4g afIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Uie7vKzM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v184si12758074pgv.566.2019.07.22.19.08.05; Mon, 22 Jul 2019 19:08:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Uie7vKzM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727604AbfGVS76 (ORCPT + 99 others); Mon, 22 Jul 2019 14:59:58 -0400 Received: from mail-pf1-f177.google.com ([209.85.210.177]:39659 "EHLO mail-pf1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727036AbfGVS74 (ORCPT ); Mon, 22 Jul 2019 14:59:56 -0400 Received: by mail-pf1-f177.google.com with SMTP id f17so13822901pfn.6; Mon, 22 Jul 2019 11:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RTpdlQyeL6bUmfZxFwZVri3i7nbPBO/dWR0GM1UFauc=; b=Uie7vKzMH8rhSaqDU+aMcGpqyxjCAEwwYHOs8Zz8U3B2wZObu/hBnRQpJYvhmIGgDw IHk/K6jpfG6wXsMB1qUT1sh/ChhrsYn3LxIcUCmrK6vZRbrVceM3II59gJ3kh+MlrX2x 1DuHiX4OOmXS/GL5pG5qPgTuSdp7IAnFiZQTc6QW4YS1+Bjmh9K4aQZf6t0rqhuNHfuw QTYoUNyzdiW3NvWNC+WPdBiUeQGJU4eWLZBmKDyTCJLNj8TNHpSgKm/m3oO5L/BOzi6X OiJd4btOFqQz+abdaTlUTE83JA2iCBDkjFgg1DkkEOhNW/Odd8tjV65+H+egp+j8fJWA 9F3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RTpdlQyeL6bUmfZxFwZVri3i7nbPBO/dWR0GM1UFauc=; b=bWXtMcPWQk1VJ/Qa3xyF+qbc5l/dl6JPk7Gecwtb5DAtxxq11qp7OSXYiZLXYm6dBP ArzQLE9PI8dBNJ8+nhKvV/Rzy0M7DRNb9KSKjTKj7DwwMvS4McEITK/1D5qp1dDYAze6 Bp2XoIncgEVC2WvX6+xuZ2idcyyjjRI6e8QkHD+rxJNCF5v1QNki0/6T48zPaujpy2aE RzOdY5wbLY1Znl/LRUcCnxxEY7jNpqyCLVDVQSfSXn7ZhS3zuB53sqiewTiBZXz7nB/w l/tqRT1ygttVck9ftyV/xiUcuCSmoWBErrWZGSsbLs7Asopbg5LfZ/joVZ4JQWVPEGUs pTyA== X-Gm-Message-State: APjAAAW8oGTBzWX/6sH7FLaHyNZu0EgT8lyi1RBFNbJVo3go8bs28eVK j5dLEzn0L66iPX1q41uZh/7iikt5nVE= X-Received: by 2002:a63:c750:: with SMTP id v16mr56466432pgg.320.1563821995654; Mon, 22 Jul 2019 11:59:55 -0700 (PDT) Received: from localhost.localdomain ([103.51.73.174]) by smtp.gmail.com with ESMTPSA id h1sm30777675pgv.93.2019.07.22.11.59.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 11:59:55 -0700 (PDT) From: Anand Moon To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: Kishon Vijay Abraham I , Kukjin Kim , Krzysztof Kozlowski , Anand Moon , Bartlomiej Zolnierkiewicz Subject: [RFC/RFT 3/5] phy: exynos5-usbdrd: UTMI tune signal Date: Tue, 23 Jul 2019 00:29:36 +0530 Message-Id: <20190722185938.9043-4-linux.amoon@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190722185938.9043-1-linux.amoon@gmail.com> References: <20190722185938.9043-1-linux.amoon@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tune USB2.0 (UTMI+) TX signal for high speed data transfer. Signed-off-by: Anand Moon --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 42 +++++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index 135114d51bc1..54a513ca15e4 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -33,6 +33,8 @@ #define EXYNOS5_FSEL_24MHZ 0x5 #define EXYNOS5_FSEL_50MHZ 0x7 +#define __set(v, a, b) (((v) << (b)) & GENMASK(a, b)) + /* EXYNOS5: USB 3.0 DRD PHY registers */ #define EXYNOS5_DRD_LINKSYSTEM 0x04 @@ -108,8 +110,17 @@ #define EXYNOS5_DRD_PHYPARAM0 0x1c #define PHYPARAM0_REF_USE_PAD BIT(31) -#define PHYPARAM0_REF_LOSLEVEL_MASK (0x1f << 26) -#define PHYPARAM0_REF_LOSLEVEL (0x9 << 26) +#define PHYPARAM0_REF_LOSLEVEL(x) __set(x, 30, 26) +#define PHYPARAM0_TXVREFTUNE(x) __set(x, 25, 22) +#define PHYPARAM0_TXISETUNE(x) __set(x, 21, 20) +#define PHYPARAM0_TXRESTUNE(x) __set(x, 19, 18) +#define PHYPARAM0_TXPREEMPPULSETUNE BIT(17) +#define PHYPARAM0_TXPREEMPAMPTUNE(x) __set(x, 16, 15) +#define PHYPARAM0_TXHSXVTUNE(x) __set(x, 14, 13) +#define PHYPARAM0_TXFSLSTUNE(x) __set(x, 12, 9) +#define PHYPARAM0_SQRXTUNE(x) __set(x, 8, 6) +#define PHYPARAM0_OTGTUNE(x) __set(x, 5, 3) +#define PHYPARAM0_COMPDISTUNE(x) __set(x, 2, 0) #define EXYNOS5_DRD_PHYPARAM1 0x20 @@ -365,9 +376,30 @@ static void exynos5_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd) u32 reg; reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); - /* Set Loss-of-Signal Detector sensitivity */ - reg &= ~PHYPARAM0_REF_LOSLEVEL_MASK; - reg |= PHYPARAM0_REF_LOSLEVEL; + /* Set Loss-of-Signal Detector sensitivity */ + reg |= (PHYPARAM0_REF_USE_PAD | + /* Sets the sensitivity level for the Loss-of-Signal detector */ + PHYPARAM0_REF_LOSLEVEL(0x9) | + /* Adjusts the high-speed DC level voltage */ + PHYPARAM0_TXVREFTUNE(0x3) | + /* Adjust the rise/fal timie of the high-speed waveform */ + PHYPARAM0_TXISETUNE(0x1) | + /* Adjusts the driver source impedance */ + PHYPARAM0_TXRESTUNE(0x1) | + /* HS Transmitter Pre-Emphasis Duration Control */ + PHYPARAM0_TXPREEMPPULSETUNE | + /* HS Transmitter Pre-Emphasis Current Control */ + PHYPARAM0_TXPREEMPAMPTUNE(0x0) | + /* Transmitter High-Speed Crossover Adjustment */ + PHYPARAM0_TXHSXVTUNE(0x3) | + /* FS/LS Source Impedance Adjustment */ + PHYPARAM0_TXFSLSTUNE(0x3) | + /* Squelch Threshold Adjustment */ + PHYPARAM0_SQRXTUNE(0x3) | + /* VBUS Valid Threshold Adjustment */ + PHYPARAM0_OTGTUNE(0x6) | + /* Disconnect Threshold Adjustment */ + PHYPARAM0_COMPDISTUNE(0x6)); writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM1); -- 2.22.0