From patchwork Fri Jun 1 09:04:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 137494 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp679954lji; Fri, 1 Jun 2018 02:06:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJdojK7/jUXq7nDwlD9K2Z3aOwvSfb2vWDqgTBUhLy9hHgDPUrO94INR5cF9LVJepNJE277 X-Received: by 2002:a62:df12:: with SMTP id u18-v6mr10104917pfg.230.1527843959887; Fri, 01 Jun 2018 02:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527843959; cv=none; d=google.com; s=arc-20160816; b=Bqby63/qKTzuRAX8B2TMQo9nDueTyXwzYXm294YCdaH9PLMUKQyt2/PNBAP4HPATVf d1GqQ7X8z+UN3ojj0ixNGSp9y/61uaA7r53Mt9dQzUnZ488+kYGjOg3+qQjSwktfQXAs vTwrWy1iRXbJC7GkU5/W+VC+ZnAA85mCtRQ3zAwNLF1yGm94gwNKFVw4/pJAD59IaGwe 3Lsf2gkJFjTyO2op8HKpXQVHnK6JfXav2E0o6s0g7nnVTIomC1QycBJ+zWIlSvV4qSiP gA31dTNsT0cZe5+zAX0+RdcEEkzgDOmIQAzYr2GHDO4hlQbVi/fLK8uvi6b9LIBcEZSj ShbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=XLgX3tNd82f/PKOaOoVygcCixo9oscm+4OFmU3trhRw=; b=OAAUkKwFxdIAlLPAoo+jC8hO8oAL+xdxZYMVq2KvCSkiAe9/nQNpEJBcorXvV9DPnC PhIRpTCJLStxvZoNeunv+LslFhCSZoDYVrPAowoezHJ5eVkaAM/VyPUjpEfzX5d3RDRI mkryeypbDPpgtDEIEofA04dQ0IdX7rCL6lmTanco1lGQZOPzOL4VS5KB1Sxp7UgEk1LF AW0T/I5Rt/fR2zpeZGD7rRZ54f+KxbAc05T/sukZkf/02qPhH2o1kxlauyR9bUY8Zj4d cuQvKtLs4Mvjdkzoj27Cur7QRMrHifP0Z7qwcxgfir+1HJQrelXpvlLWV5H7u1HQIIGZ 3DQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Es2/RhTT; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9-v6si21940212pgn.334.2018.06.01.02.05.59; Fri, 01 Jun 2018 02:05:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Es2/RhTT; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750872AbeFAJFy (ORCPT + 1 other); Fri, 1 Jun 2018 05:05:54 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:37495 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750850AbeFAJFt (ORCPT ); Fri, 1 Jun 2018 05:05:49 -0400 Received: by mail-pg0-f67.google.com with SMTP id a13-v6so10984495pgu.4 for ; Fri, 01 Jun 2018 02:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=1lXVCiBKqpsJgxB7Vp47gLA9OXi6CS54txe0RIlLh9k=; b=Es2/RhTTKB5hzppdA83ceOLQJV7b+QLgU/5L7TaLRTPh41lYXVcB/NU00kwOHb0hiX f1s17liOKIWMe9kpV9MsLP/MKCh5AQsMLJZROtdL9ERm7MPZaxHZgwXoOoU0oqVbyqNA qA7b5lEKOGVMfTWKJXGwVSjc4eCZcgd78skks= 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; bh=1lXVCiBKqpsJgxB7Vp47gLA9OXi6CS54txe0RIlLh9k=; b=jyPpJBn+oMwSQTJO14g1iREGtygbt2c7ccpJG2ahIlbfmVt3F73P0AwxNsTooFFwL/ P2Gq23O/CIJtIXB6oucMUm0uaJykw/It4lKfHApV2AsVlIAL1GCrVfmx4FsCnZ3XvXnx 72ssnny8BqCb9ZXJWHVuLIEtiu0+T9OpaqPMXK0YgX8MzdACXKxRo1aPGOXKsueOAobu eg3BqgnIXVLUdTDKDvP9f8+zdDXbBjDmQTosqHsVGSwOvZ6KcmNdGqNmX2pIGvPaF9zA Dkinr5O0Ulmb/SNyQtLhtE/5soySO8Xs1cG/xvNq0/LbYJJd5jLOy4YCUtRs5qnMPVl8 kLoA== X-Gm-Message-State: ALKqPwf+TMXejLPcKI2hv96rctilR9ytssvbRwLlU16V8P6V8oegsgsp 17nkEf0HuZZ0C0BxZZJmnidQtg== X-Received: by 2002:a65:4bcd:: with SMTP id p13-v6mr8251015pgr.114.1527843948833; Fri, 01 Jun 2018 02:05:48 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id a4-v6sm89505351pfj.19.2018.06.01.02.05.45 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Jun 2018 02:05:48 -0700 (PDT) From: Baolin Wang To: ohad@wizery.com, bjorn.andersson@linaro.org, broonie@kernel.org Cc: baolin.wang@linaro.org, linux-spi@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] hwspinlock: Add one new API to support getting a specific hwlock by the name Date: Fri, 1 Jun 2018 17:04:52 +0800 Message-Id: <1be6adeb558fada77de79a40cd5ef7dc2719c945.1527843425.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The hardware spinlock binding already supplied the 'hwlock-names' property to match and get a specific hwlock, but did not supply one API for users to get a specific hwlock by the hwlock name. So this patch introduces one API to support this requirement. Signed-off-by: Baolin Wang --- drivers/hwspinlock/hwspinlock_core.c | 29 +++++++++++++++++++++++++++++ include/linux/hwspinlock.h | 7 +++++++ 2 files changed, 36 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 5278d05..00bde06 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -375,6 +375,35 @@ int of_hwspin_lock_get_id(struct device_node *np, int index) } EXPORT_SYMBOL_GPL(of_hwspin_lock_get_id); +/** + * of_hwspin_lock_get_id_byname() - get lock id for an specified hwlock name + * @np: device node from which to request the specific hwlock + * @name: hwlock name + * + * This function provides a means for DT users of the hwspinlock module to + * get the global lock id of a specific hwspinlock using the specified name of + * the hwspinlock device, so that it can be requested using the normal + * hwspin_lock_request_specific() API. + * + * Returns the global lock id number on success, -EPROBE_DEFER if the hwspinlock + * device is not yet registered, -EINVAL on invalid args specifier value or an + * appropriate error as returned from the OF parsing of the DT client node. + */ +int of_hwspin_lock_get_id_byname(struct device_node *np, const char *name) +{ + int index; + + if (!name) + return -EINVAL; + + index = of_property_match_string(np, "hwlock-names", name); + if (index < 0) + return index; + + return of_hwspin_lock_get_id(np, index); +} +EXPORT_SYMBOL_GPL(of_hwspin_lock_get_id_byname); + static int hwspin_lock_register_single(struct hwspinlock *hwlock, int id) { struct hwspinlock *tmp; diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h index fe450ee..f165cc8 100644 --- a/include/linux/hwspinlock.h +++ b/include/linux/hwspinlock.h @@ -74,6 +74,7 @@ int __hwspin_lock_timeout(struct hwspinlock *, unsigned int, int, unsigned long *); int __hwspin_trylock(struct hwspinlock *, int, unsigned long *); void __hwspin_unlock(struct hwspinlock *, int, unsigned long *); +int of_hwspin_lock_get_id_byname(struct device_node *np, const char *name); #else /* !CONFIG_HWSPINLOCK */ @@ -133,6 +134,12 @@ static inline int hwspin_lock_get_id(struct hwspinlock *hwlock) return 0; } +static inline +int of_hwspin_lock_get_id_byname(struct device_node *np, const char *name) +{ + return 0; +} + #endif /* !CONFIG_HWSPINLOCK */ /** From patchwork Fri Jun 1 09:04:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 137497 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp680710lji; Fri, 1 Jun 2018 02:06:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLmPSXIU9TEFIBYtf4czj4kqDieaSbU9N82MBWvNKjEbffwEY1J8KwnwMAu4Cobp7x1xhn/ X-Received: by 2002:a62:a89:: with SMTP id 9-v6mr9961606pfk.112.1527844003742; Fri, 01 Jun 2018 02:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527844003; cv=none; d=google.com; s=arc-20160816; b=wu7AZWYX49EHaNtIgjr8IuN4D/+9rPhSe279T+NGZqh6GK+OWlaE4ydZMX6G+AAH8m wTu1Lz8qI7v7IlwHJBP6XKcj/Q6EfLlCoWe+1uhCUlaUum1bS4hejYS+ozJ+7is3B/ZL /+5u3+dVNrj2AbDaEE559qKZMZF2rBFJkN+gexeKz67HT2OV5H9y2GXMbrJhu1C6VMnt vdZTj58VoLPag9GrYxT0FSmh8LJJSmE6Gv4KSfBMPsOBrMP8n5HjvZlRgC+caerWwlH1 sWw4umyq+PPTQEuPLtdu7zuR3j+sIp11XTo1Q5YQ3l3+eWgENVDBMn9pKyuzwrSJQchc 1pxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=jLcC5liePwTgWJZJl2ndI3GqHA3NYuKZFVqtu6EmTuM=; b=hn8VWuYm7F28tMIPqotTuMVZ4lBOPg/RRR8YJK8Li4iUKxryyrolQWRYxPaL9TPKnv N3qoNVh4FG0VBTBkQbb5q+++ejiTdQRnfaBKTEHevJlxVj5c+pGV0xxnFCmSw6X5fmRJ KQGFvjUNk6/GhdGvcv5NrkiMcKuuczQN3xN3OjYqn3z2GtQ8OnaWPKtE9gGOcjyEBfZ4 V1LK11uiQgMIMfz4Yuyx+4k0DjHXOg/RHnMZ/j97n7GxrgPNGtMjx83tNkkLKb4ldwml /sKmAXFL0+5s66dNGSPrHL+lOzTtZFdQ286gcthuYgYZrG1FfwsHIzrOQIZsSxRagaNe 2Xqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=av+B13Fy; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r11-v6si30705335pgp.235.2018.06.01.02.06.43; Fri, 01 Jun 2018 02:06:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=av+B13Fy; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751422AbeFAJGm (ORCPT + 1 other); Fri, 1 Jun 2018 05:06:42 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:45915 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750961AbeFAJFz (ORCPT ); Fri, 1 Jun 2018 05:05:55 -0400 Received: by mail-pg0-f65.google.com with SMTP id z1-v6so4058620pgv.12 for ; Fri, 01 Jun 2018 02:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=mKiddEQWBDsjx6NRHIvvE6IftcVqW5H+YgW4bj7RSJU=; b=av+B13FyAJWWt3XkeKEAk1Nz6pnFOirVbqqNLQo016F6e5Qei//f4e01gSJBLyV9J/ 8BJ5VsivSNCqfCEg4RVWsaqAKNpYsMSXN5q22AcKchwKTd0aI8wOoo1lQ1Xv+lZXfxSJ 2xfxb9IRo5Tzg8WqQTSHu+UY1KpKAfm1Uy+AA= 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:in-reply-to:references; bh=mKiddEQWBDsjx6NRHIvvE6IftcVqW5H+YgW4bj7RSJU=; b=UM+N7QK/9p/EQo38GnOygrhEiFr77rLSMOO17D3Ojzj7yIs02zrzgcPs9G4rup4Ayo hGA/cm7F275OjVBNIXH3CoZ0ttev53p67H3KPlLp97aiUVeXOeW5R8vunNzQ72eGPSFl O9nKAeHXIx7eKritB87o9/M2HmjoZI1GsghrDcAG8adglPnXyh4PeJLy9v6uPzag8hmw 0lK8CVD4lAdBGiR2ItJ6fuevxiXoXVXjWtuj/qfQiWdBQ9J61XFl7lkUVQAn44vumioZ z0B63SWhZxiE1DUU8UJhzztExeQhQFfPyYyG0bh4rtlPaNfQT5zBkgFCRZ6b/Jsia3ar 5Hog== X-Gm-Message-State: ALKqPwdTzgLcg8/4VYo3aFX3oUw+bC6LRm43FdknZW1HiNsg9VuZCn6x nE1OocTcAvWWOBMsWpJ/ukiaYw== X-Received: by 2002:a63:4003:: with SMTP id n3-v6mr8183793pga.184.1527843955145; Fri, 01 Jun 2018 02:05:55 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id a4-v6sm89505351pfj.19.2018.06.01.02.05.52 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Jun 2018 02:05:54 -0700 (PDT) From: Baolin Wang To: ohad@wizery.com, bjorn.andersson@linaro.org, broonie@kernel.org Cc: baolin.wang@linaro.org, linux-spi@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] spi: sprd: Replace of_hwspin_lock_get_id() with of_hwspin_lock_get_id_byname() Date: Fri, 1 Jun 2018 17:04:54 +0800 Message-Id: <1ee51555e05ad1fbfca7fac60050d318be9181f6.1527843425.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1be6adeb558fada77de79a40cd5ef7dc2719c945.1527843425.git.baolin.wang@linaro.org> References: <1be6adeb558fada77de79a40cd5ef7dc2719c945.1527843425.git.baolin.wang@linaro.org> In-Reply-To: <1be6adeb558fada77de79a40cd5ef7dc2719c945.1527843425.git.baolin.wang@linaro.org> References: <1be6adeb558fada77de79a40cd5ef7dc2719c945.1527843425.git.baolin.wang@linaro.org> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Now the hwlock core has supplied new function to get a specific hwlock id by one hwlock name, which is more clear for users. So change to use of_hwspin_lock_get_id_byname(). Signed-off-by: Baolin Wang --- drivers/spi/spi-sprd-adi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c index 6fc50cf..d8d5e2f 100644 --- a/drivers/spi/spi-sprd-adi.c +++ b/drivers/spi/spi-sprd-adi.c @@ -459,7 +459,7 @@ static int sprd_adi_probe(struct platform_device *pdev) sadi->slave_pbase = res->start + ADI_SLAVE_OFFSET; sadi->ctlr = ctlr; sadi->dev = &pdev->dev; - ret = of_hwspin_lock_get_id(np, 0); + ret = of_hwspin_lock_get_id_byname(np, "adi"); if (ret < 0) { dev_err(&pdev->dev, "can not get the hardware spinlock\n"); goto put_ctlr;