From patchwork Wed Aug 30 02:40:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 719287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B32BFC83F25 for ; Wed, 30 Aug 2023 02:41:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241733AbjH3Ckb (ORCPT ); Tue, 29 Aug 2023 22:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241743AbjH3Ck0 (ORCPT ); Tue, 29 Aug 2023 22:40:26 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7842FCD2 for ; Tue, 29 Aug 2023 19:40:23 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4ff8cf11b90so8158985e87.1 for ; Tue, 29 Aug 2023 19:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693363222; x=1693968022; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=u79yO0iAhOgHSkdtiLEgJV1fUj3/h29d83dbFcGVhBU=; b=BrBqBKL77X0uemEsLAHm/YcDZNOl+bVb4Eam0RM3uwKqNEsxYiAhfrBrs2bun0P2s2 PLrEvJFgY3gGxeYuWcJWNOMoESggXsfLAcyaYjH3LSjnBnIpaoB7jOYA1JfOpMYG8PuC 7XbjHovhDgbRzTKd2TCTPf9GID5/1xrLMtX06zbc0iPZDf+L8ypoIYys1H3WQiQIHNnS AA4gjAlbORXmlxR3wYoS0qWkV+2wdlITIZ+0PaSssYzIGJgflz3nmZcfxDx4QQrSYhmv aqPXDqLcT1N4Y2aWXqSzwNdHOPOzrtQ1E5QN/MGWBMSW6Qko8ywh7U7PMr8KnfYtbsgO Ev9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693363222; x=1693968022; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u79yO0iAhOgHSkdtiLEgJV1fUj3/h29d83dbFcGVhBU=; b=kQaNnmI8lkGZEDiixYvKF+BLMVT6GtFFgitl5g3EYPbwNvVvT7Ni1A+vQX6gSGvqC8 YI9H2cMpnX3ffGI2EruZ4t1M7lQFG8NbGRzEPBS6Cg2b8h59rm63QKVcH0yFMfNYzjuk qByGmLgzMNB7ykv22nwM2gT6Bx3AK7JAMKC+VasvAd2KRX/EUkkiL6+lcxypuXE1XwD5 gTt+jMGrjR+i1hEXk7FgvbTHRtnT9ty6lWN4QzpTkAab/zNz8XaloLqQZLin7Q8+V24F pJi8KaXq9ME7Vpa7Nx441gFQGV1HmiRxHfZ5t2pGFZxNE2cLUC7PNbc6mL0NZq0cJooI SBoA== X-Gm-Message-State: AOJu0YyxcGbvrRtHJXaNYO2uGtgI4VzhsM23DKJLSi3pyZPRFVyG3/Wn qANbJHZcL/ic4yXOfxe5Pz/vPr5myGPy63wu6iixvQ== X-Google-Smtp-Source: AGHT+IEB+Pvy4SQ9xZVdKt+EmXsnpVvha1l5vFdek6iZ3eZULbMZNYOs++suiQW5lY4y3P0QFRWZaQ== X-Received: by 2002:a05:6512:312b:b0:500:a0a3:80ff with SMTP id p11-20020a056512312b00b00500a0a380ffmr445095lfd.58.1693363221890; Tue, 29 Aug 2023 19:40:21 -0700 (PDT) Received: from [192.168.1.101] (abyl195.neoplus.adsl.tpnet.pl. [83.9.31.195]) by smtp.gmail.com with ESMTPSA id w7-20020ac254a7000000b004fb99da37e3sm2183878lfk.220.2023.08.29.19.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 19:40:21 -0700 (PDT) From: Konrad Dybcio Date: Wed, 30 Aug 2023 04:40:18 +0200 Subject: [PATCH 4/4] phy: qualcomm: phy-qcom-eusb2-repeater: Add tuning overrides MIME-Version: 1.0 Message-Id: <20230830-topic-eusb2_override-v1-4-ab23825385a8@linaro.org> References: <20230830-topic-eusb2_override-v1-0-ab23825385a8@linaro.org> In-Reply-To: <20230830-topic-eusb2_override-v1-0-ab23825385a8@linaro.org> To: Andy Gross , Bjorn Andersson , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Abel Vesa Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1693363215; l=1714; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=NiPnqK52QKHkd/CcD5h/xTEyUsqIlLXa328usvhRCnU=; b=VOEa0hyyG8UbttF1hLRne2t5QpVGEd7PBgEJAs3wp6uAI0TP1KnT9BEe4A+kAXPL1NCFnQmTd /cC2j3wCQ5fA7z1vShBb/7d6X7rOXpxgi457n+zuW2LVAKcm2t95ufT X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org There are devices in the wild, like the Sony Xperia 1 V that *require* different tuning than the base design for USB to work. Add support for overriding the necessary tuning values. Signed-off-by: Konrad Dybcio --- drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c index 645f0e95703a..53e10feb16a1 100644 --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c @@ -141,7 +141,9 @@ static int eusb2_repeater_init_vregs(struct eusb2_repeater *rptr) static int eusb2_repeater_init(struct phy *phy) { struct eusb2_repeater *rptr = phy_get_drvdata(phy); - const u32 *init_tbl = rptr->cfg->init_tbl; + struct device_node *np = rptr->dev->of_node; + u32 init_tbl[F_NUM_TUNE_FIELDS] = { 0 }; + u8 override; u32 val; int ret; int i; @@ -152,6 +154,17 @@ static int eusb2_repeater_init(struct phy *phy) regmap_field_update_bits(rptr->regs[F_EN_CTL1], EUSB2_RPTR_EN, EUSB2_RPTR_EN); + memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl)); + + if (!of_property_read_u8(np, "qcom,tune-iusb2-value", &override)) + init_tbl[F_TUNE_IUSB2] = override; + + if (!of_property_read_u8(np, "qcom,tune-hsdisc-value", &override)) + init_tbl[F_TUNE_HSDISC] = override; + + if (!of_property_read_u8(np, "qcom,tune-usb2-preem-value", &override)) + init_tbl[F_TUNE_USB2_PREEM] = override; + for (i = 0; i < F_NUM_TUNE_FIELDS; i++) regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]);