From patchwork Mon Dec 7 19:05:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 339173 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3064128jai; Mon, 7 Dec 2020 11:07:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpD90AAzaHRPkEEhQFTSt28Q6mMPQapGGNR7iBNS5V+1ugWMX7WzvuvXROe7G0X1+oDaRb X-Received: by 2002:aa7:d2c9:: with SMTP id k9mr21322816edr.74.1607368043318; Mon, 07 Dec 2020 11:07:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607368043; cv=none; d=google.com; s=arc-20160816; b=cYbJneyssx8RxzEemRu15cVzMa4SxbfP4fW2gj6sxc051Ta6U0OlC3v5YrgtxjQIAD +HCjL5S6OHsrh7RVAkUuTEBzXpcKBaZbNgY044NuB47l4IeIhdDyUFMC4OZEQwdEVRU3 VDbtbfrISyoeb6szAmiju0V+YKc+n/wo4vgbCWrz9DKh/zT12zVBrDoHZtUg3A/46fcR bsjchQ+GFeFTt3Mb+r9VXfwPpE+5/MoBu24z0uoZs2OHkEK35znNDBXkSmPVZhyVitbi jxigukZD+iIYx+VcU36JIf8HbQtPJ73Gg/lQ/LeuwV9AjHbRAADNwGZvnNiLII6Gvz7+ EnhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DUMXyAQnqRiSpx1EcaFfxabW7NQgoPfU3TYBefIeljY=; b=M76Lro0EfZ74Em/UBoejoeTuRVVeodnhzj5HF0UBGdpxCAZkVSgI+/j4CSrk5cings zm1lBbOQwMyoRT/zTkr1gjHNYcAOZkUF64K7OIf3eeacCmVi7NOWt/zQ6i1u1tFKtOge skJmWMdMVCWExiG6Zho1i7mdUL120xSGbxAOqbuJMlgIPSRPiiEhMZ7oEOqyVVvTtO/U XY5mkW9r7ozNjk+YIO+F1jzhaVskNTby6WZo7oOCQjoUR7lLrno88UeXvMMFiRz62b7A 2eQl8QgZ7lrFMedsoPlE/JSWniUPQU0pwtGjq9H/9WP6163aABzxOZ5oE2fjYZdPQ+Mn aNTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q23si8877726edt.531.2020.12.07.11.07.23; Mon, 07 Dec 2020 11:07:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726265AbgLGTGP (ORCPT + 4 others); Mon, 7 Dec 2020 14:06:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:46036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbgLGTGO (ORCPT ); Mon, 7 Dec 2020 14:06:14 -0500 From: Krzysztof Kozlowski Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sylwester Nawrocki , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Arnd Bergmann , Chanwoo Choi , Alim Akhtar , Pankaj Dubey , stable@vger.kernel.org Subject: [PATCH v2 1/4] soc: samsung: exynos-asv: don't defer early on not-supported SoCs Date: Mon, 7 Dec 2020 20:05:14 +0100 Message-Id: <20201207190517.262051-2-krzk@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201207190517.262051-1-krzk@kernel.org> References: <20201207190517.262051-1-krzk@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Marek Szyprowski Check if the SoC is really supported before gathering the needed resources. This fixes endless deferred probe on some SoCs other than Exynos5422 (like Exynos5410). Fixes: 5ea428595cc5 ("soc: samsung: Add Exynos Adaptive Supply Voltage driver") Cc: Signed-off-by: Marek Szyprowski Signed-off-by: Krzysztof Kozlowski --- drivers/soc/samsung/exynos-asv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.25.1 Reviewed-by: Pankaj Dubey diff --git a/drivers/soc/samsung/exynos-asv.c b/drivers/soc/samsung/exynos-asv.c index 8abf4dfaa5c5..f653e3533f0f 100644 --- a/drivers/soc/samsung/exynos-asv.c +++ b/drivers/soc/samsung/exynos-asv.c @@ -119,11 +119,6 @@ static int exynos_asv_probe(struct platform_device *pdev) u32 product_id = 0; int ret, i; - cpu_dev = get_cpu_device(0); - ret = dev_pm_opp_get_opp_count(cpu_dev); - if (ret < 0) - return -EPROBE_DEFER; - asv = devm_kzalloc(&pdev->dev, sizeof(*asv), GFP_KERNEL); if (!asv) return -ENOMEM; @@ -144,6 +139,11 @@ static int exynos_asv_probe(struct platform_device *pdev) return -ENODEV; } + cpu_dev = get_cpu_device(0); + ret = dev_pm_opp_get_opp_count(cpu_dev); + if (ret < 0) + return -EPROBE_DEFER; + ret = of_property_read_u32(pdev->dev.of_node, "samsung,asv-bin", &asv->of_bin); if (ret < 0) From patchwork Mon Dec 7 19:05:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 339414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97FE4C2BBCD for ; Mon, 7 Dec 2020 19:06:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 769D723976 for ; Mon, 7 Dec 2020 19:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726718AbgLGTGR (ORCPT ); Mon, 7 Dec 2020 14:06:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:46050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726611AbgLGTGR (ORCPT ); Mon, 7 Dec 2020 14:06:17 -0500 From: Krzysztof Kozlowski Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sylwester Nawrocki , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Arnd Bergmann , Chanwoo Choi , Alim Akhtar , Pankaj Dubey , stable@vger.kernel.org Subject: [PATCH v2 2/4] soc: samsung: exynos-asv: handle reading revision register error Date: Mon, 7 Dec 2020 20:05:15 +0100 Message-Id: <20201207190517.262051-3-krzk@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201207190517.262051-1-krzk@kernel.org> References: <20201207190517.262051-1-krzk@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org If regmap_read() fails, the product_id local variable will contain random value from the stack. Do not try to parse such value and fail the ASV driver probe. Fixes: 5ea428595cc5 ("soc: samsung: Add Exynos Adaptive Supply Voltage driver") Cc: Signed-off-by: Krzysztof Kozlowski Reviewed-by: Pankaj Dubey --- drivers/soc/samsung/exynos-asv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/soc/samsung/exynos-asv.c b/drivers/soc/samsung/exynos-asv.c index f653e3533f0f..5daeadc36382 100644 --- a/drivers/soc/samsung/exynos-asv.c +++ b/drivers/soc/samsung/exynos-asv.c @@ -129,7 +129,13 @@ static int exynos_asv_probe(struct platform_device *pdev) return PTR_ERR(asv->chipid_regmap); } - regmap_read(asv->chipid_regmap, EXYNOS_CHIPID_REG_PRO_ID, &product_id); + ret = regmap_read(asv->chipid_regmap, EXYNOS_CHIPID_REG_PRO_ID, + &product_id); + if (ret < 0) { + dev_err(&pdev->dev, "Cannot read revision from ChipID: %d\n", + ret); + return -ENODEV; + } switch (product_id & EXYNOS_MASK) { case 0xE5422000: From patchwork Mon Dec 7 19:05:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 339415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F29EC1B0E3 for ; Mon, 7 Dec 2020 19:06:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 03E8B2395A for ; Mon, 7 Dec 2020 19:06:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726738AbgLGTGU (ORCPT ); Mon, 7 Dec 2020 14:06:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:46070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726611AbgLGTGU (ORCPT ); Mon, 7 Dec 2020 14:06:20 -0500 From: Krzysztof Kozlowski Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sylwester Nawrocki , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Arnd Bergmann , Chanwoo Choi , Alim Akhtar , Pankaj Dubey Subject: [PATCH v2 3/4] soc: samsung: exynos-chipid: order list of SoCs by name Date: Mon, 7 Dec 2020 20:05:16 +0100 Message-Id: <20201207190517.262051-4-krzk@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201207190517.262051-1-krzk@kernel.org> References: <20201207190517.262051-1-krzk@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Bring some order to the list of SoCs. No functional change. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Pankaj Dubey --- drivers/soc/samsung/exynos-chipid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index 8d4d05086906..b4cd0cc00f45 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -20,6 +20,7 @@ static const struct exynos_soc_id { const char *name; unsigned int id; } soc_ids[] = { + /* List ordered by SoC name */ { "EXYNOS3250", 0xE3472000 }, { "EXYNOS4210", 0x43200000 }, /* EVT0 revision */ { "EXYNOS4210", 0x43210000 }, @@ -29,10 +30,10 @@ static const struct exynos_soc_id { { "EXYNOS5260", 0xE5260000 }, { "EXYNOS5410", 0xE5410000 }, { "EXYNOS5420", 0xE5420000 }, + { "EXYNOS5433", 0xE5433000 }, { "EXYNOS5440", 0xE5440000 }, { "EXYNOS5800", 0xE5422000 }, { "EXYNOS7420", 0xE7420000 }, - { "EXYNOS5433", 0xE5433000 }, }; static const char * __init product_id_to_soc_id(unsigned int product_id)