Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp239724lqe; Thu, 4 Apr 2024 05:34:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8PIhSVotRw+fpN2zxAdjQ6wIDrwx5hBZ1WaMcFt3GyQFyI5WpsIT+23Q4qC2yJI4Y5tFsJV0iWr9KFIoo/hwua+e5szNjnzPCF4wJ+g== X-Google-Smtp-Source: AGHT+IFLw+ckryzmj6DXTHjYN1xjQtSpCHbEQD4UHdyvmswiJePNu7VUqgeF8UDKHd+0TPqVxMZ2 X-Received: by 2002:a50:934f:0:b0:56d:f246:bfa4 with SMTP id n15-20020a50934f000000b0056df246bfa4mr1910043eda.23.1712234042291; Thu, 04 Apr 2024 05:34:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712234042; cv=pass; d=google.com; s=arc-20160816; b=VvKKw9a6SsGbRbXbrVDSZxZr8YCHk41Bgf3DdZmcoqYtMmVkB2gIg8XYszBzLSnTbs wZ/ysTAhIW6ztTjg2WJvm6x+17qgZ2Sxdc/7rbYgXzb92fXnU7wb8HPcg83YjQqjEauo U47ybGVjGo55tIFrKYVhat03ATWaqDOgZsD9NBRn7QF1EhdwE33wwCin7zK6SweNVuKZ NESK+gGonl5RHoba//AKT9+xvdXFtuDDT+JLL+7Oth+hcjfjqf40vB2hY4h6W7wngucz rU/rvmKEGhrmkU4SGIoN6EVXtPN3+46DmxBBbwlZa0NpAoQcr/B65IVP6Y2oaaG5IXIW Tvcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9BAojM4xoHm2Ccy99OQ74TIvmgE7hETV2sx3J0iKu4Q=; fh=9r0hGJ139kqst91ex0ibO0M0PbOCQ56kDSURsvPRZ9Y=; b=ngopsAbFP9Cfh4SFA3Q2TqZR4WYaeYYkTjrxTLOErlADMWjBRHBdQIX1LOtQzOJaJO fGfdNv+uK2mTcF5xvdtZo3Pg+qRc0Cu4LqfStaiWYuBvZPRwhYc7uefQJK/1aFP8tD+p 2nOY2IAYV3l7K45TVmflc/Tu5rbW4i7abOUvUpu8UjyBu90DjrW+9d5PUDB4qY49SwXF 8unHqw0hbO1waG75nMyg+r8TKo4FeiRo6HMRTZ7JF7Hgw3Oaw/FZije9JqnGIz6UPUnr bxNnXkfS6d9CgjVEYJ5mTmogMwYz3G5bt3s+ONDsDTJLEHhLHqt6n0SdZgQMRMcGyTmM KZNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R2xcg+ZW; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-131430-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131430-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 20-20020a508e14000000b0056e07b4d8c0si1618025edw.51.2024.04.04.05.34.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 05:34:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131430-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R2xcg+ZW; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-131430-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131430-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B1A601F229CC for ; Thu, 4 Apr 2024 12:34:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88A0C86AC2; Thu, 4 Apr 2024 12:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R2xcg+ZW" Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE02C136E2D for ; Thu, 4 Apr 2024 12:27:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712233663; cv=none; b=Bc7xOtZl1aMDaHkxAkBN0qMJtSiLg+3NpSu6Au0iTnDcjqzxOSgixhZeCZxUlnlEdeUAZPpM+hiveb6cSfTCdaaEqiTQrXONS5JSsJ0FIqVjYkMUAYL1L5zMheYKdncGnHRSsAptbgLQh7sIcl2J3VW384bdMtE9ygQqJpBvzIs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712233663; c=relaxed/simple; bh=wMMnZkTmdU0PnDwKOoiT2jByc/edZ9XNOJoHq9JWwCA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GUKdboDWLXXdbdxx52SEhQ+6RdgNkbKhWHp2fromifuJERbsw0QLAZQHkxlupREet0zdq1s7ob/kjdQXmiY9P2aX05lw7012pgNC9+/kPuo54jjFs/6kAzXFYRg+4ee5GACITzcnjI61adgqQZ4v1jeVRO32HQDApQs0sx3YIic= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=R2xcg+ZW; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2d476d7972aso12264521fa.1 for ; Thu, 04 Apr 2024 05:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712233659; x=1712838459; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9BAojM4xoHm2Ccy99OQ74TIvmgE7hETV2sx3J0iKu4Q=; b=R2xcg+ZW/VveOfOFe8UfDGKRiZy1X/Dn9WvHn5fddJP1Wor1mgnVik2XY6Dd0gGW5k 3Ep7zSz3jMRt9bvd/2rfg7XsV0sh47lHpsa8ulT0j6He0Gu44fjrc2UXjZmraVMQsHoZ v/kAUbpmjHMlj+dJYZTs9/8YVZu7mMwO83nLEAJiDjtnOGY15gG32LeU6xASynch+OEH yFkT+rhhGnXSbzk7hznsqizFZBmzY6ssepKt+m6NdN7ilvuGjXvREYiZklUFupX5uXsf h4KjjVWLn3QkZ7BnxbPz4xjcUlcTZwLZR4r7aQFYbYGEtzzbsmNaBjs4Z6IfOiDlNVyt 3QMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712233659; x=1712838459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9BAojM4xoHm2Ccy99OQ74TIvmgE7hETV2sx3J0iKu4Q=; b=c3i5vyvRcR0Winw2KcIZpOlrjQ9L+cnbl16G0mcegTc1XkQbYtMzvh632hgiCqj+w6 1tjVZbaBwJHZZaZ2KgLpSrfHomRpTJh0iozJ1DiVPyjDnUkbrouOmJWx7UsJQXi0x9Ti Sk3BFgIbp7xdyPWxNHUM4xKY/80Ud+HqADj5GrZK0GoGewYuzESd7P9El8eMQK8NwcNI sMlGhSdlCRZer4uv5/5z46TJxBLtdjpR5V+3FHw1kO2a4/XBqi+V5SwCJ9Y5ieWsPaZs ZWKOISj2Psh20cy3i6Gd+iA/F1Jfcp5CE1YgTZS9ukGq8vdC6QShCc7kOVsNttPo3LIs lBiA== X-Forwarded-Encrypted: i=1; AJvYcCW8c0aTH4FaZNOxCS/Opzbx78R8mrmK+ZF5KgBzLzocD0t71YSegQWk+nH9FWEL2nmSibpa/EVLqjXZe+DBUmzAxVvkkH28x6bl6GXk X-Gm-Message-State: AOJu0Yz1kbgNdoBhp4h5tMiY55n6xRsk65zKBfW/BUSMFYkFr/ZE/j2C m+aewTveEdY5BbxpYSjZ+6ZLYn6C8uFuj2n7sj+KrvAEkqt8jkNnfbpdw7AO7a8= X-Received: by 2002:ac2:5233:0:b0:516:26cd:da71 with SMTP id i19-20020ac25233000000b0051626cdda71mr1865615lfl.3.1712233658831; Thu, 04 Apr 2024 05:27:38 -0700 (PDT) Received: from gpeter-l.roam.corp.google.com ([148.252.128.204]) by smtp.gmail.com with ESMTPSA id bu14-20020a056000078e00b003434b41c83fsm12106303wrb.81.2024.04.04.05.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 05:27:38 -0700 (PDT) From: Peter Griffin To: mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vkoul@kernel.org, kishon@kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, s.nawrocki@samsung.com, cw00.choi@samsung.com, jejb@linux.ibm.com, martin.petersen@oracle.com, chanho61.park@samsung.com, ebiggers@kernel.org Cc: linux-scsi@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, Peter Griffin Subject: [PATCH 15/17] scsi: ufs: host: ufs-exynos: add some pa_dbg_ register offsets into drvdata Date: Thu, 4 Apr 2024 13:25:57 +0100 Message-ID: <20240404122559.898930-16-peter.griffin@linaro.org> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog In-Reply-To: <20240404122559.898930-1-peter.griffin@linaro.org> References: <20240404122559.898930-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This allows these registers to be at different offsets or not exist at all on some SoCs variants. Signed-off-by: Peter Griffin --- drivers/ufs/host/ufs-exynos.c | 38 ++++++++++++++++++++++++----------- drivers/ufs/host/ufs-exynos.h | 6 +++++- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index 1bfda9c75703..065258203836 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -308,8 +308,9 @@ static int exynosauto_ufs_post_pwr_change(struct exynos_ufs *ufs, static int exynos7_ufs_pre_link(struct exynos_ufs *ufs) { + struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; + u32 val = attr->pa_dbg_opt_suite1_val; struct ufs_hba *hba = ufs->hba; - u32 val = ufs->drv_data->uic_attr->pa_dbg_option_suite; int i; exynos_ufs_enable_ov_tm(hba); @@ -326,12 +327,13 @@ static int exynos7_ufs_pre_link(struct exynos_ufs *ufs) UIC_ARG_MIB_SEL(TX_HIBERN8_CONTROL, i), 0x0); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_TXPHY_CFGUPDT), 0x1); udelay(1); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OPTION_SUITE), val | (1 << 12)); + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite1_off), + val | (1 << 12)); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_SKIP_RESET_PHY), 0x1); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_SKIP_LINE_RESET), 0x1); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_LINE_RESET_REQ), 0x1); udelay(1600); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OPTION_SUITE), val); + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite1_off), val); return 0; } @@ -923,14 +925,19 @@ static int exynos_ufs_phy_init(struct exynos_ufs *ufs) static void exynos_ufs_config_unipro(struct exynos_ufs *ufs) { + struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; struct ufs_hba *hba = ufs->hba; - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_CLK_PERIOD), - DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); + if (attr->pa_dbg_clk_period_off) + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_clk_period_off), + DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTRAILINGCLOCKS), ufs->drv_data->uic_attr->tx_trailingclks); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OPTION_SUITE), - ufs->drv_data->uic_attr->pa_dbg_option_suite); + + if (attr->pa_dbg_opt_suite1_off) + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite1_off), + attr->pa_dbg_opt_suite1_val); } static void exynos_ufs_config_intr(struct exynos_ufs *ufs, u32 errs, u8 index) @@ -1486,10 +1493,11 @@ static int exynosauto_ufs_vh_init(struct ufs_hba *hba) static int fsd_ufs_pre_link(struct exynos_ufs *ufs) { - int i; + struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; struct ufs_hba *hba = ufs->hba; + int i; - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_CLK_PERIOD), + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_clk_period_off), DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); ufshcd_dme_set(hba, UIC_ARG_MIB(0x201), 0x12); ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x40); @@ -1513,7 +1521,9 @@ static int fsd_ufs_pre_link(struct exynos_ufs *ufs) ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x0); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_AUTOMODE_THLD), 0x4E20); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OPTION_SUITE), 0x2e820183); + + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite1_off), + 0x2e820183); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0x0); exynos_ufs_establish_connt(ufs); @@ -1655,7 +1665,9 @@ static struct exynos_ufs_uic_attr exynos7_uic_attr = { .rx_hs_g1_prep_sync_len_cap = PREP_LEN(0xf), .rx_hs_g2_prep_sync_len_cap = PREP_LEN(0xf), .rx_hs_g3_prep_sync_len_cap = PREP_LEN(0xf), - .pa_dbg_option_suite = 0x30103, + .pa_dbg_clk_period_off = PA_DBG_CLK_PERIOD, + .pa_dbg_opt_suite1_val = 0x30103, + .pa_dbg_opt_suite1_off = PA_DBG_OPTION_SUITE, }; static const struct exynos_ufs_drv_data exynosauto_ufs_drvs = { @@ -1729,7 +1741,9 @@ static struct exynos_ufs_uic_attr fsd_uic_attr = { .rx_hs_g1_prep_sync_len_cap = PREP_LEN(0xf), .rx_hs_g2_prep_sync_len_cap = PREP_LEN(0xf), .rx_hs_g3_prep_sync_len_cap = PREP_LEN(0xf), - .pa_dbg_option_suite = 0x2E820183, + .pa_dbg_clk_period_off = PA_DBG_CLK_PERIOD, + .pa_dbg_opt_suite1_val = 0x2E820183, + .pa_dbg_opt_suite1_off = PA_DBG_OPTION_SUITE, }; static const struct exynos_ufs_drv_data fsd_ufs_drvs = { diff --git a/drivers/ufs/host/ufs-exynos.h b/drivers/ufs/host/ufs-exynos.h index 7acc13914100..f30423223474 100644 --- a/drivers/ufs/host/ufs-exynos.h +++ b/drivers/ufs/host/ufs-exynos.h @@ -145,7 +145,11 @@ struct exynos_ufs_uic_attr { /* Common Attributes */ unsigned int cmn_pwm_clk_ctrl; /* Internal Attributes */ - unsigned int pa_dbg_option_suite; + unsigned int pa_dbg_clk_period_off; + unsigned int pa_dbg_opt_suite1_val; + unsigned int pa_dbg_opt_suite1_off; + unsigned int pa_dbg_opt_suite2_val; + unsigned int pa_dbg_opt_suite2_off; /* Changeable Attributes */ unsigned int rx_adv_fine_gran_sup_en; unsigned int rx_adv_fine_gran_step; -- 2.44.0.478.gd926399ef9-goog