From patchwork Fri Dec 15 14:06:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 122108 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp527503qgn; Fri, 15 Dec 2017 06:15:40 -0800 (PST) X-Google-Smtp-Source: ACJfBotGTvKoPq4JBcz2m3NANOYuhKvsMzq/+IguvK5IfDwuP+JLvXszrDt4F7z+XEXZL6DnERw8 X-Received: by 10.159.194.1 with SMTP id x1mr13292641pln.116.1513347339927; Fri, 15 Dec 2017 06:15:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513347339; cv=none; d=google.com; s=arc-20160816; b=UjPlqmzhep84Mq23rxfkiwEecg4TMIL/OPglOt6akX4W5sqP66UB2k6K35UwFWA+yC NFbQX/075vtKgWJ3Pc4TlxJKjqCoYe1bZv4rDhwZcatb6HL/NP28I+1DHC8aoOVKZHyO NcUEwP/UJnZPmyhwVyiAYLQ9iH/McRAV/kA/CowqcaJe6p38GOzjwMoYwAWN3G29hUPC fHuZjInBAwqEBTgomw8s9yBDTAwpxvb8sEhZeHLuFmEHVFV6jned5VFZ9DyYG/zIdFTD EAq36qPI17euJ61zNtiYKT0O9YUbuU/rFMxrirMOxn4gUhuu0eK8ibRyREVoxC/+BpSq uBDA== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=i/xRiUbizHNkwV1PQLPrdDvv8e8FWLEN7Tbplfm48DQ=; b=e6neY6JupQycBNyLYxMp39nbWxy0iTCW/5D34t21Prw07Bq255Xm6HScN7qyzitZYS P8UrU8jOrHtoV1jM9b6V3GlgbZMhHI+I1z8P55pLtoO4djwSfdBYVmnu2FTJyJ696uwz lea/LvbhqvsU991xvmXRQ4COc57hll+iCP278Hudg8zGwo6RNBn00zrIF4NJ9fIHkRLz 8q9yWzK7WeWCi1gbMblGxv8oqOw5gUYRyBtm+VDcU8uxtY6OJHm0wlW11YSWPea+SfFw E8f3SpV6EZd0dhIX6IrcHECefIoJMgl7A9SizFwTVqrMOgkFsjGpxZIGEm55kkxo7wre if2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kmKB3WV1; 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=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 be11si4974560plb.81.2017.12.15.06.15.39; Fri, 15 Dec 2017 06:15:39 -0800 (PST) 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=@linaro.org header.s=google header.b=kmKB3WV1; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756690AbdLOOPg (ORCPT + 20 others); Fri, 15 Dec 2017 09:15:36 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35859 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755834AbdLOOJc (ORCPT ); Fri, 15 Dec 2017 09:09:32 -0500 Received: by mail-wr0-f194.google.com with SMTP id u19so1793345wrc.3 for ; Fri, 15 Dec 2017 06:09:31 -0800 (PST) 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; bh=i/xRiUbizHNkwV1PQLPrdDvv8e8FWLEN7Tbplfm48DQ=; b=kmKB3WV17llDLI5hwmysITrAvpE3cKagJhHG+X7h4Y3BbsfZcdfrufIpLK2aDAnTAs mfbnGaJBz2BKIU+5T8zXFPIhQXL141xlgGPwk2J+tfKhoZE0YZfyWFP8xNhA5253kMCs DrVF5kWDJ4Sauqxm6+rAJOFdS1zXNCV34tmk8= 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; bh=i/xRiUbizHNkwV1PQLPrdDvv8e8FWLEN7Tbplfm48DQ=; b=eJoyE8TlLeDiOQiOupd4RqGHX3qUG6aEuLTQXS9E9l9npiHbbYqPWvcWLShmlcgmgv tsDpk4iQUGUH3XSeK2UHpovHYwmfyVAvfWf5dKST8Eq3Na4ZfcEQfE3UMWROltj3qAjh usbtay0nef3q7R8MeK2v7CR/8exLWszwvfwekm6eB2LIplkjxFKOWzQMsC+srUAG2R99 Hx884bFAbdnaykk/hXUwG3m08010JKozcDaikkHrpEGaCGVMkRzfGDVDFFad9Q056IKV G8wvQ0mbogoFPc4YxcxgucV8Q/79gVEOzc/g3732uvrT8yVOm4k5adrsQG4rYyakyod8 gTdg== X-Gm-Message-State: AKGB3mLCYrofx+FgfQ1bUD4XMxBG1Mkqgrbd9snsn/9ju0J9EhcmfOzz CchmdrW3+C6zVUbyFF59gIftbg== X-Received: by 10.223.133.183 with SMTP id 52mr8684936wrt.188.1513346970991; Fri, 15 Dec 2017 06:09:30 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id n7sm6295034wra.23.2017.12.15.06.09.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Dec 2017 06:09:30 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Lukas Wunner Subject: [PATCH 1/6] nvmem: core: Deduplicate bus_find_device() by name matching Date: Fri, 15 Dec 2017 14:06:04 +0000 Message-Id: <20171215140609.17193-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> References: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lukas Wunner No need to reinvent the wheel, we have bus_find_device_by_name(). Signed-off-by: Lukas Wunner Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.15.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 5a5cefd12153..93084ab61e0f 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -600,16 +600,11 @@ static void __nvmem_device_put(struct nvmem_device *nvmem) mutex_unlock(&nvmem_mutex); } -static int nvmem_match(struct device *dev, void *data) -{ - return !strcmp(dev_name(dev), data); -} - static struct nvmem_device *nvmem_find(const char *name) { struct device *d; - d = bus_find_device(&nvmem_bus_type, NULL, (void *)name, nvmem_match); + d = bus_find_device_by_name(&nvmem_bus_type, NULL, name); if (!d) return NULL; From patchwork Fri Dec 15 14:06:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 122107 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp526996qgn; Fri, 15 Dec 2017 06:15:17 -0800 (PST) X-Google-Smtp-Source: ACJfBovbcKChpSYMS8k9sHTs1jrWR9y+eFJeX3AseynbTP3qM2vkvzsrRk03T1xeTJtRQ8YV/t9u X-Received: by 10.98.46.7 with SMTP id u7mr13582576pfu.37.1513347316928; Fri, 15 Dec 2017 06:15:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513347316; cv=none; d=google.com; s=arc-20160816; b=yITj1NBcMBQHkned+4UpmwtT2ua3gPyEdsmRn1VLiP9uoqymYRPg/bRAH+hYfW0wC3 MhYhG+5Z8bJ1YAavIuBRzxHHtKvT2TXtb73p4XLboM1jgrJeEs3NcEdS+/B2U/dFjDhr DspXWJFtsy214YTRt34OacK5lZnwfEvOc7RQ1xoTvIc/eN6SWMTRt5xEiOGuWFESZLGd JG1M3WG1fv4tlWUIuzpxqsuqNsR9HJvqvuVLkzxWXo5ZcZtoRElYpHkEHrMco2ssFB4O K3PUA03QvnrswsRoJ09eCVgQKozs3GU78/mq2pHiUCHExRC9gnCM4kKhZWmquRK2n4HU Fgug== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=MWOL2LsQfCZ84KdcmRUInC8SSCIGlI4mw1tChUUoTt0=; b=rh4tJaZL6h1AMjuGBjQWXGmTdKF+/smFeeAjBp4tq+/7025WfwPxMkPb988+omn/Ju O9fnBuwvnjJxrMv/QuLnJxeNS4J7kVHa+Q/5il5cjpT6qE7eV0FXjljtHjiKN03JrZb7 wuLwCdSJJrAuyg9SU+/d07Pc3EGipx92zNWg47kNSMAHIHRb0W9iO8GsSu2rNHWYmetG QuOGsAlKPNbzazNirQG6lWbNZWG4nV87imcf0RADhSduA9+mzMBAYwuXsAESxxAP6Eme /mkby72AcULOLo1aI5c/kEpH3/EmmXrbpeHZn/iJOmLEwpqR/f/MTosPXPC3+Rsur33Q uWyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JZkzz6wx; 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=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 r1si4591862pgp.308.2017.12.15.06.15.16; Fri, 15 Dec 2017 06:15:16 -0800 (PST) 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=@linaro.org header.s=google header.b=JZkzz6wx; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756411AbdLOOPN (ORCPT + 20 others); Fri, 15 Dec 2017 09:15:13 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34509 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756100AbdLOOJd (ORCPT ); Fri, 15 Dec 2017 09:09:33 -0500 Received: by mail-wm0-f66.google.com with SMTP id y82so30770255wmg.1 for ; Fri, 15 Dec 2017 06:09:32 -0800 (PST) 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; bh=MWOL2LsQfCZ84KdcmRUInC8SSCIGlI4mw1tChUUoTt0=; b=JZkzz6wxMj52/8x+96831BUXZqXC2/O5lj8iAtjWeFNsOvXXgAwo38PwoywzrtMpAI gsscC5G29vj5xTOW78tOZK6kHnkwp9oQ80cK8BW74qfzSkhQaa7w8rZ4IpdLaLMLTrhL Qju7qy9iW+tkLIKP1P/ulQ9AopPRdan1vLSlM= 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; bh=MWOL2LsQfCZ84KdcmRUInC8SSCIGlI4mw1tChUUoTt0=; b=iTKxsWvRP1FxZRPI8dILl5A4hvHr8491Ctu6tGdMmT09eK0123vQ7YoNviZqib+LNW EFyKxT+hMt8DZzV542IgD0MH+8ClnpRsmbzROnIKa4+pD4ZxZXITbrbP9S5UpwODEO4Y 5zSdnrhlTyC0J+riZCVHl8lKu5s+VmhuFthjpeJEqpvCKGv4wRUjgLTdTJgHrUfT+nne mEUEMhBfurFixtR6LzPYWmlUr0Cnx7EwHq9u61wP0Pqg8Ow+l6G0W5cHKytHg0Ub5GpR 13HEPpb2obtrEcfpoKuIRqodo7ZcUnxQwE7vN82RLxfCh2ea9Fh8dLupAb1CC/SFFGZq Jisw== X-Gm-Message-State: AKGB3mK51mDhGQnR9xtxElO5aaB6UyCmsSq8XY4cBCzLF1QiPd7IBssQ GO7APDG2rldbBI6j5iTPXtoa8A== X-Received: by 10.28.234.87 with SMTP id i84mr5447748wmh.65.1513346972260; Fri, 15 Dec 2017 06:09:32 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id n7sm6295034wra.23.2017.12.15.06.09.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Dec 2017 06:09:31 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Heiner Kallweit Subject: [PATCH 2/6] nvmem: core: let stride and word_size default to 1 Date: Fri, 15 Dec 2017 14:06:05 +0000 Message-Id: <20171215140609.17193-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> References: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiner Kallweit If the caller doesn't set stride and/or word_size in struct nvmem_config then nvmem_register accepts this but we may face strange effects later due to both values being 0. Therefore use 1 as default for both values. Signed-off-by: Heiner Kallweit Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.15.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 93084ab61e0f..4f37c9f3d120 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -464,8 +464,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->owner = config->owner; if (!nvmem->owner && config->dev->driver) nvmem->owner = config->dev->driver->owner; - nvmem->stride = config->stride; - nvmem->word_size = config->word_size; + nvmem->stride = config->stride ?: 1; + nvmem->word_size = config->word_size ?: 1; nvmem->size = config->size; nvmem->dev.type = &nvmem_provider_type; nvmem->dev.bus = &nvmem_bus_type; From patchwork Fri Dec 15 14:06:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 122103 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp519932qgn; Fri, 15 Dec 2017 06:09:43 -0800 (PST) X-Google-Smtp-Source: ACJfBos8G80oMEkgVBbEs96nb8Z1ZZfFE5odX1PEVBN+6ouiNkhY1nNKP1Pdt2oVgt6ZdtYsjshJ X-Received: by 10.101.80.138 with SMTP id r10mr11875488pgp.428.1513346983230; Fri, 15 Dec 2017 06:09:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513346983; cv=none; d=google.com; s=arc-20160816; b=BTLo0eZalP+4cK6nBLsNZWEv9LEcpMxIkNz98Dhj/KZrC/T6BxqZRTHNaTd+olqzKL rtTlK8OKKhYSK8zlE2CLbJ3Cf+8YW9cAG0/NB0vuv7AhsxTweRmCsKfI/UbUK+CfA8BQ Lvb8QYrbGMb9Y/ApO2lJmGNDF6AqasyehZYUQfMf/cyezXWC+shKWrYPAF2rx9nllcjO +2K2HDTSL97sMdEE45eSlzU+teZ9dI+1bBsgLLIhiOMOXEDdQ0AAPN1yjDY+OxB5crZO KILWfJ8fMTiVmGToJsOywUsfkEPhDYkK4BNT8faOfTCudk77fFj+2zJplNzyD/ZyEW5d hYvg== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=JuCPohq0SZA28IZ4vcYw72Oqcw+aHNWdebvFV3N/YhA=; b=x05bAh5uFPP3uwb0FgVg+5h676C05CzZT/lCmgCf947y0DEYleAnu0u7kZlROHB2zd r1vaNjkQm9cghuqkAywSVNrO4EBrBUdPLl0Q9tkb0f/o+DNBaRzzB7n7KhK0To/7ZBbg PrvwASjJk+tL7yGQOzp9h6SqXWw32ifuoe1mTggNAeI5Ow1jpZxPyWS9hJEa78C+5Lvr ZL7GniOWl1VWDyx3T1O7WkRqGI6NbuyOLjrCzQp7how9w0wAZbl76SyRvAx9nDxWshJa sclUySPd2z5zp4mHVmIE6nmF8wEkAY/O/4P7qJxLV0c/J5L8xlhdz/EG9hi6f6cyRX7D v3Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Agq+bG1W; 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=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 b89si5186665pfc.304.2017.12.15.06.09.42; Fri, 15 Dec 2017 06:09:43 -0800 (PST) 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=@linaro.org header.s=google header.b=Agq+bG1W; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756571AbdLOOJj (ORCPT + 20 others); Fri, 15 Dec 2017 09:09:39 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:45630 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756178AbdLOOJe (ORCPT ); Fri, 15 Dec 2017 09:09:34 -0500 Received: by mail-wm0-f68.google.com with SMTP id 9so17686112wme.4 for ; Fri, 15 Dec 2017 06:09:33 -0800 (PST) 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; bh=JuCPohq0SZA28IZ4vcYw72Oqcw+aHNWdebvFV3N/YhA=; b=Agq+bG1WW4sCymtyEgxGj8nVsAc6/duwDHSZijEyRAZvn57ikHKlpoN2gqLhDt6QQV rP3qDj+WuxHu1KPdVR2r0jcq+5L3aj8tlbudxM7YqwscwASs1Bt5S6Fj8GxAIz35zfF0 YRQUIC7Ubn7W8pgpUp3wqP3b8+R9Wv9ju8I10= 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; bh=JuCPohq0SZA28IZ4vcYw72Oqcw+aHNWdebvFV3N/YhA=; b=gFaU9cL4E/9Sp8oeMopoeUX6p8uemeLjPthPVU3QGz4Of4cMPk4fiDVyCgUaSEDYkU teGs3qAvTZfZdB1g/QbIBuFFxQj6rVJTzaZY4/otLATod3zac7+c5AeyAueb/QOZVh68 EqMvBnQyB1z40w9uE0impcktVGVQOkseBXfvqDG1CJLFrrqHQingGuyrK0e6+tmLV7WY f5z/dgFb8FoVKIcOekDGnoPQ2CxXE8x0xRuRwy9J94L8H4F9qlc1fd8cfkjv79UM3Dfq QIwJVOh/ZezN9iyQxc+h1RNb/DyoDfEFiOlYNkkFJR5ZPL4ZlaRITy+GQ4JZt0qu9n1i ggMg== X-Gm-Message-State: AKGB3mKL4O3H5D6PE3099g34oUzskeHhdZlrOH/itxW6FnOvf3dTpkWP x+MZjpaE/Ca1Poe+AlkJgVIIdQ== X-Received: by 10.28.105.204 with SMTP id z73mr5290398wmh.37.1513346973094; Fri, 15 Dec 2017 06:09:33 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id n7sm6295034wra.23.2017.12.15.06.09.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Dec 2017 06:09:32 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Heiner Kallweit Subject: [PATCH 3/6] nvmem: core: switch to device_property_present for reading property "read-only" Date: Fri, 15 Dec 2017 14:06:06 +0000 Message-Id: <20171215140609.17193-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> References: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiner Kallweit Switch to more generic device_property_present to consider also non-DT properties. Signed-off-by: Heiner Kallweit Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.15.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 4f37c9f3d120..35a3dbeea324 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -444,7 +444,6 @@ static int nvmem_setup_compat(struct nvmem_device *nvmem, struct nvmem_device *nvmem_register(const struct nvmem_config *config) { struct nvmem_device *nvmem; - struct device_node *np; int rval; if (!config->dev) @@ -473,13 +472,12 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->priv = config->priv; nvmem->reg_read = config->reg_read; nvmem->reg_write = config->reg_write; - np = config->dev->of_node; - nvmem->dev.of_node = np; + nvmem->dev.of_node = config->dev->of_node; dev_set_name(&nvmem->dev, "%s%d", config->name ? : "nvmem", config->name ? config->id : nvmem->id); - nvmem->read_only = of_property_read_bool(np, "read-only") | + nvmem->read_only = device_property_present(config->dev, "read-only") | config->read_only; if (config->root_only) From patchwork Fri Dec 15 14:06:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 122106 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp526389qgn; Fri, 15 Dec 2017 06:14:43 -0800 (PST) X-Google-Smtp-Source: ACJfBou8CFPnAkB6s6ahfcM/KeAMoK1hlLw+OIdjBmaeDm8KrN4DIVMqctYcI9V/I4WaXBjWFH2v X-Received: by 10.98.100.71 with SMTP id y68mr13600294pfb.178.1513347283113; Fri, 15 Dec 2017 06:14:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513347283; cv=none; d=google.com; s=arc-20160816; b=MtDf1wQjbDMLlKltjkgSm+ZpSZdV0ifXwYgmAhqKbXiSMFn14ZzMKPM9Tdqw8ArTjq UpcS/GqAxpiXe+7OHW959gxLB4XH5MGSJvAbzfs2u+f2mGVNteSfEhMDj3DAyV00hm/h jDULZ0t9dmT9C4YUCI0LhS360/irgqq1sXgBBOS7sRMKC7dSswadNT2CoxeT2fjZtRBp IC35u+/WeqjFTaB3J6mojyOS5IcU6ZxHtGLYbAAig0aCI7m9AuXW1lZWUZ/zIJ5FpqgK //06b0Wy2m0RUwZqwINE3SMepljP0asDZy6nAxbX82HMR5GGic7zmZKuS/2tc2yhHflO sxXw== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=LwkOczeODoEfqNqp5Q11+simEsBX0SBGUimATH3n8zM=; b=NKRlNmejEg1WQYPzxXxKvsxbPGCnhwm6D9ksIBaznXYAmb4rRyZ9BsKSwSdV/EwYVM QySiEmlZO4IwUzzcqUMFe27/TRqvqdAwg7JDR5ndlU4Wjr+RsDr+im/RF/HEnSOuc1OC qWvMz28egrSx6MhcCXo6OovwHACDD7OekYg8aiNHQi2nuVegwa073NNVW1E+IWbtXwUX cS4xiBqB5ZInJS73gG1Ha7dAL8sRejOWlJChRPprgR5sO5XWZZLQT0jPvuXXd0zJdAE5 TijGLozIhqopo/APbAPeVepmprqQjg3D0nguSwHZVDyJ7+tJ9NpA31+KsMiy1Th8GfCx 8kgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E6poqWdB; 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=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 p27si4612393pgc.402.2017.12.15.06.14.42; Fri, 15 Dec 2017 06:14:43 -0800 (PST) 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=@linaro.org header.s=google header.b=E6poqWdB; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932136AbdLOOOj (ORCPT + 20 others); Fri, 15 Dec 2017 09:14:39 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:40922 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755739AbdLOOJg (ORCPT ); Fri, 15 Dec 2017 09:09:36 -0500 Received: by mail-wm0-f67.google.com with SMTP id f206so17756470wmf.5 for ; Fri, 15 Dec 2017 06:09:35 -0800 (PST) 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; bh=LwkOczeODoEfqNqp5Q11+simEsBX0SBGUimATH3n8zM=; b=E6poqWdByJ+QFSXZE/RZlP2uy57IS7rkJAnVRaOdvmjiuov69Yj6VAhqSa9tmmoFzZ Wrn4G3SgQ1NrZEyrENYpSYCaP4+qgDy/5BLWNwZ5Oi4WPJLnBwJrzNJJO1cOUQdt4Hko gS41mIz/x7frI/38rs2mZGyVdPgos8EQwZjSc= 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; bh=LwkOczeODoEfqNqp5Q11+simEsBX0SBGUimATH3n8zM=; b=fBzbuDaStZbyYVE9l2ar6UHB/+wRgkTwGn9W6O9QTzTulh2e+oYi003HXKoTW+ntJV KUaNulAET08kvg3gb/T+nxD7AmDm/kDeTANst9t2Yvui19RlXitYDtvBZ91ew2RJe/BF 7NAWH5+oC+DQdfD8uSfiCH9IW8OzvqqFHT4YJAYhUDtqndSfD+ipM6Dboei1D+zPFhR/ XfcYi1WXXvkL4edGN8w1WxUG6sCh3QRO2ZElj12rUbVlZ15wUyxMdkKnUlRS5aaSJR9D 5pmscwExxVrzlNT9gpez9d8UNWdrCG1/ta/ukrg5qYEzOaWMK8+nfgi5eEFAN48XoqIw slzg== X-Gm-Message-State: AKGB3mJVLJq7hz43hLrnthgGy/xPz33cBa2/wfX1Pt5ULXFxHfV4drFJ lN+XmPQ9FA0MKmGB/HlztiwYnQ== X-Received: by 10.28.232.208 with SMTP id f77mr5013468wmi.155.1513346975288; Fri, 15 Dec 2017 06:09:35 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id n7sm6295034wra.23.2017.12.15.06.09.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Dec 2017 06:09:33 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Kunihiko Hayashi Subject: [PATCH 4/6] nvmem: uniphier: change access unit from 32bit to 8bit Date: Fri, 15 Dec 2017 14:06:07 +0000 Message-Id: <20171215140609.17193-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> References: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kunihiko Hayashi The efuse on UniPhier allows 8bit access according to the specification. Since bit offset of nvmem is limited to 0-7, it is desiable to change access unit of nvmem to 8bit. Signed-off-by: Kunihiko Hayashi Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/uniphier-efuse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.15.0 diff --git a/drivers/nvmem/uniphier-efuse.c b/drivers/nvmem/uniphier-efuse.c index 9d278b4e1dc7..be11880a1358 100644 --- a/drivers/nvmem/uniphier-efuse.c +++ b/drivers/nvmem/uniphier-efuse.c @@ -27,11 +27,11 @@ static int uniphier_reg_read(void *context, unsigned int reg, void *_val, size_t bytes) { struct uniphier_efuse_priv *priv = context; - u32 *val = _val; + u8 *val = _val; int offs; - for (offs = 0; offs < bytes; offs += sizeof(u32)) - *val++ = readl(priv->base + reg + offs); + for (offs = 0; offs < bytes; offs += sizeof(u8)) + *val++ = readb(priv->base + reg + offs); return 0; } @@ -53,8 +53,8 @@ static int uniphier_efuse_probe(struct platform_device *pdev) if (IS_ERR(priv->base)) return PTR_ERR(priv->base); - econfig.stride = 4; - econfig.word_size = 4; + econfig.stride = 1; + econfig.word_size = 1; econfig.read_only = true; econfig.reg_read = uniphier_reg_read; econfig.size = resource_size(res); From patchwork Fri Dec 15 14:06:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 122105 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp520215qgn; Fri, 15 Dec 2017 06:09:56 -0800 (PST) X-Google-Smtp-Source: ACJfBov2rLqNRAolYBacj6xH3Wd3d4xKilTQaX0J7ViUSUT7icLNi3vW5Cujs04/wofevWVtu4dG X-Received: by 10.101.90.71 with SMTP id z7mr12520236pgs.14.1513346996807; Fri, 15 Dec 2017 06:09:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513346996; cv=none; d=google.com; s=arc-20160816; b=IEsA9VG+98PylxDwRhcMsY/I/ngmNINUCAfy6k4RhHh+zYEqreTOzxSdnyzh9uCc/P FsgabcceqH7NwCR8bXBR98mbUFX32ag5fRVxnHY7XHzLLHzkN4Oi3/q9IB55bf0SAUo3 dbmh3aIqrXM2M4sUBMW8wtLqBtsIsI9630E/FRdFgsCbkIqzS6nVwp/Ifcbb2Cd2YXKG 8vbbXkAiD2ITot0po2AGYFh/jx6mOg9nLsHynaU02rwiyJSlMYhou7u12ap6peNswU7H L1mZRq56Q7WeeQNKyNetLVMCShZFNgBLsR/TVMkHekB3eL4sD3VztW0t9Rl8tnJ2wguF DTdw== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=1m4RB2F0d7KE76BF0FyEH6S6nVy2yVEfbfPTBag40Wc=; b=aDm67lOGujdRZNnmBRmXijOHOUQ+1nqR76yA4eR+FAan5sO4OeRpRYo0venQzzwC6A vC97jdcH/wK6lSjap6TxpWkCY55WwEP+Af2+/6zolLIpPYVot/jn67AfATBcDk4VWWUW BZfg7dRyR4NMR9N2TRIj1FK3wUueGZQUA6Fj9gsYshEjpRksD0g+QiKKnM0zXm1H0KOT mb9yEd44MzJndKpq+Vm9fV/2dwJF3t70bu0l1HUDKaDacS+/l5R6mcFo+3SCqxSfPm8q BX+SYbHRU/BqiBlx6BG6foViqXFN8M4n+yjGiAACAkthOt9X/9iFlhKF+DDMkPjI8BIh ZItQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gm+ilFtX; 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=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 f1si5112879plb.58.2017.12.15.06.09.56; Fri, 15 Dec 2017 06:09:56 -0800 (PST) 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=@linaro.org header.s=google header.b=gm+ilFtX; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756601AbdLOOJw (ORCPT + 20 others); Fri, 15 Dec 2017 09:09:52 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35270 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756550AbdLOOJh (ORCPT ); Fri, 15 Dec 2017 09:09:37 -0500 Received: by mail-wm0-f68.google.com with SMTP id f9so17955361wmh.0 for ; Fri, 15 Dec 2017 06:09:37 -0800 (PST) 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; bh=1m4RB2F0d7KE76BF0FyEH6S6nVy2yVEfbfPTBag40Wc=; b=gm+ilFtXgaRnMIGRzhxBIZVjAgouJBZwCIL8H92tTQ2u406Q3dqQDlMCzkksOxvMoz hhuuPItwZpVocBlr5S3v/+R1gssqvNsyO3LshHIRkBspBJjsSHbyKEmqJ6Kt5nWW2EIj +MzemXh2x8OAXkiUVoWTFZeqprVoNc5KJyY+c= 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; bh=1m4RB2F0d7KE76BF0FyEH6S6nVy2yVEfbfPTBag40Wc=; b=XRV4wl9fbTQfkLzteGNTslfBquWw3SAAhKOlYbLTOoXD0xST5nFBqAQjrhnmg6PK45 rDjEaG/Vaf3M8W1jBAbhB/6GSSGQMPWmr3etHSff7mxaWgd1RdodXCroN7pse2nGkv+D ONdPah/JcQGAlNoR9I2aQdDMNFvWpBAwoo2w+sQSKy0IECnvtIC8m2/PfTRzIpXEtF6z rfTt4L54LSNMO1LhphgCMla9Qytqp5fz5Xs9y0qZNjfEKKOAEl6okTez9vRmXzEcrkWu fXoX6TX/R4gqAUPThNu+0RMaRgyW8n9+fB5+2m8HTFozSF/JmmC9meXIEYK+ezEXtFYQ osRQ== X-Gm-Message-State: AKGB3mL6vjMdJeuvLFw7jGBGPksHBKtvemHnKrvAh5rfae9YGiq1XoY8 Wl90/GR8W17gTFTY40HnDWkzcA== X-Received: by 10.28.183.132 with SMTP id h126mr5769687wmf.76.1513346976395; Fri, 15 Dec 2017 06:09:36 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id n7sm6295034wra.23.2017.12.15.06.09.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Dec 2017 06:09:35 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Finley Xiao , Heiko Stuebner Subject: [PATCH 5/6] nvmem: rockchip-efuse: parse 'rockchip,efuse-size' Date: Fri, 15 Dec 2017 14:06:08 +0000 Message-Id: <20171215140609.17193-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> References: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Finley Xiao The eFuse size is defined in property before, but the length of registers is not equal to the size on some platforms, so we add a new property to redefine it. Signed-off-by: Finley Xiao Acked-by: Rob Herring Signed-off-by: Heiko Stuebner Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt | 4 ++++ drivers/nvmem/rockchip-efuse.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) -- 2.15.0 diff --git a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt index 60bec4782806..a6ef46dd1283 100644 --- a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt +++ b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt @@ -12,6 +12,10 @@ Required properties: - clocks: Should be the clock id of eFuse - clock-names: Should be "pclk_efuse" +Optional properties: +- rockchip,efuse-size: Should be exact eFuse size in byte, the eFuse + size in property will be invalid if define this property. + Deprecated properties: - compatible: "rockchip,rockchip-efuse" Old efuse compatible value compatible to rk3066a, rk3188 and rk3288 diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c index 123de77ca5d6..a91372816c0a 100644 --- a/drivers/nvmem/rockchip-efuse.c +++ b/drivers/nvmem/rockchip-efuse.c @@ -217,7 +217,9 @@ static int rockchip_efuse_probe(struct platform_device *pdev) return PTR_ERR(efuse->clk); efuse->dev = &pdev->dev; - econfig.size = resource_size(res); + if (of_property_read_u32(dev->of_node, "rockchip,efuse-size", + &econfig.size)) + econfig.size = resource_size(res); econfig.reg_read = match->data; econfig.priv = efuse; econfig.dev = efuse->dev; From patchwork Fri Dec 15 14:06:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 122104 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp520121qgn; Fri, 15 Dec 2017 06:09:52 -0800 (PST) X-Google-Smtp-Source: ACJfBou5M93rw9WYK0svMWGoLUVMNrwiHl1/LuWPr50O3mKbeoV6/JycFhXHfftJ7hMiohqSUVq1 X-Received: by 10.98.193.1 with SMTP id i1mr13626508pfg.29.1513346992157; Fri, 15 Dec 2017 06:09:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513346992; cv=none; d=google.com; s=arc-20160816; b=rpy8nGirrIzGhxXlDG0OS9GW3bso0V7Ju63+Fh20YO1pyqA6wo4G2eqv4MkM1s5r7Z bYxnQ7nQP8e36xJwdlZzKFCDQhD1BcaIicR8DBhJarOle9csCMshs1Xz1NqhMOdsir03 e+CToyzlSmo6lSjr7e2RQrnWcYDlS3efpAPT1N4dNQrMfjQk14MCVDZVTocRgzQOxyOZ plAy5vQ4T61D0HcD8kbbmvHIFIzR/Ka7GKWPqsAQUYy0i9EfYfhgvX1BCjG+TvHV8lQA pwmQ8AtsnRirzJhQcfKhU1DL6Z9GDqE2PZvgicQFvZIUSiBIuzYtPuxuCI4ZRaJt/ZMV wpAw== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=HmtC2StzD1ap2D/EobXJ7zpidOmA2wdoX1ZQVQC3zmo=; b=w1OW4w1dGq1v6OAAvTMlGL8ihLzXNNGCNrkJy9GULYrsOQsS/ll95eC4KpVCD3yFWk 4Ou8uUFSKAWPhWQOSMh1FUOwug0y3GJtWUcLcNBeRCq0QAQ1bEfWSFFzZXZtAntUamrD jV9za7bV+wgSVf1lihLZkOU8pDZ+6eT3p6YRcfe0Am7cs8ZAv+yiyYheV/gc3UzQw1FF vM+9//A9smAe5hYoKSK9IPbVQAeuKMNIAwWCzolf3KfrPXXsgfAjXygV+zfmDYDSqJf1 hWRSSeYfxWgTVGvW7/JUUCvpvD+dIICujEchjhElh6cUN7EHN+//xDuVlr+hh+htMedk seQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ynx3iLbN; 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=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 f1si5112879plb.58.2017.12.15.06.09.51; Fri, 15 Dec 2017 06:09:52 -0800 (PST) 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=@linaro.org header.s=google header.b=Ynx3iLbN; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756587AbdLOOJt (ORCPT + 20 others); Fri, 15 Dec 2017 09:09:49 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35274 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756563AbdLOOJi (ORCPT ); Fri, 15 Dec 2017 09:09:38 -0500 Received: by mail-wm0-f67.google.com with SMTP id f9so17955457wmh.0 for ; Fri, 15 Dec 2017 06:09:38 -0800 (PST) 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; bh=HmtC2StzD1ap2D/EobXJ7zpidOmA2wdoX1ZQVQC3zmo=; b=Ynx3iLbNeZ6nkBpAikVPuW98pSk8njU/CJVXQCV67oX1u/CTcZFwcKFlAYyVreVqeE 6nTyZPJLtLO68GgruHVLAfYN3TodmOuxmxj6uIVm7P2JWvE+1OMcD7u8RMhVc3rPHMH/ +/HsiyQuhWWQ1JZAkZ3YHOxthO0epycUx+g8U= 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; bh=HmtC2StzD1ap2D/EobXJ7zpidOmA2wdoX1ZQVQC3zmo=; b=VQ9Ffo6delyc7t+iGwRedoQ0kNKHrGHfc+JgShYeswZ/KvTCIShnHEjsUVrlldtW2R QGb4GBJoujuCjkm6//l2AF1ZszU1+LnjCkKCDEfU3P6wenJ6B4rVleDIPujHgP7Sanli LmVB06ohNscBPSeAPvj9tybr9IM3PHwwmK5JyXL/jRSjvkNYtGaG5QmNjbTILVblr54N rwHU8ErMaieR19h32XJ17+xn11mUIQA/V//chrIgnpStmCuMO7J7mgccE+uwd8xWZFOb IQ3rbrfpymbu5Bi3ESvvCL3NOOZP/O1D8nFTz1m2lJ4CCcfCHe+rkNAerzRUDfI2bpNx 53RA== X-Gm-Message-State: AKGB3mJvKFoczYeZAETIUvQA0J/2Ef1nKLTzWgrvBBAEYXyTJxua6mfU hseFBrPoCzpc317RInmcucsDjg== X-Received: by 10.28.1.196 with SMTP id 187mr5343754wmb.151.1513346977318; Fri, 15 Dec 2017 06:09:37 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id n7sm6295034wra.23.2017.12.15.06.09.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Dec 2017 06:09:36 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Finley Xiao , Heiko Stuebner Subject: [PATCH 6/6] nvmem: rockchip-efuse: add support for rk3328-efuse Date: Fri, 15 Dec 2017 14:06:09 +0000 Message-Id: <20171215140609.17193-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> References: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Finley Xiao This adds the necessary data for handling eFuse on the rk3328. Signed-off-by: Finley Xiao Acked-by: Rob Herring Signed-off-by: Heiko Stuebner Signed-off-by: Srinivas Kandagatla --- .../devicetree/bindings/nvmem/rockchip-efuse.txt | 1 + drivers/nvmem/rockchip-efuse.c | 66 ++++++++++++++++++++++ 2 files changed, 67 insertions(+) -- 2.15.0 diff --git a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt index a6ef46dd1283..265bdb7dc8aa 100644 --- a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt +++ b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt @@ -6,6 +6,7 @@ Required properties: - "rockchip,rk3188-efuse" - for RK3188 SoCs. - "rockchip,rk3228-efuse" - for RK3228 SoCs. - "rockchip,rk3288-efuse" - for RK3288 SoCs. + - "rockchip,rk3328-efuse" - for RK3328 SoCs. - "rockchip,rk3368-efuse" - for RK3368 SoCs. - "rockchip,rk3399-efuse" - for RK3399 SoCs. - reg: Should contain the registers location and exact eFuse size diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c index a91372816c0a..f13a8335f364 100644 --- a/drivers/nvmem/rockchip-efuse.c +++ b/drivers/nvmem/rockchip-efuse.c @@ -32,6 +32,14 @@ #define RK3288_STROBE BIT(1) #define RK3288_CSB BIT(0) +#define RK3328_SECURE_SIZES 96 +#define RK3328_INT_STATUS 0x0018 +#define RK3328_DOUT 0x0020 +#define RK3328_AUTO_CTRL 0x0024 +#define RK3328_INT_FINISH BIT(0) +#define RK3328_AUTO_ENB BIT(0) +#define RK3328_AUTO_RD BIT(1) + #define RK3399_A_SHIFT 16 #define RK3399_A_MASK 0x3ff #define RK3399_NBYTES 4 @@ -92,6 +100,60 @@ static int rockchip_rk3288_efuse_read(void *context, unsigned int offset, return 0; } +static int rockchip_rk3328_efuse_read(void *context, unsigned int offset, + void *val, size_t bytes) +{ + struct rockchip_efuse_chip *efuse = context; + unsigned int addr_start, addr_end, addr_offset, addr_len; + u32 out_value, status; + u8 *buf; + int ret, i = 0; + + ret = clk_prepare_enable(efuse->clk); + if (ret < 0) { + dev_err(efuse->dev, "failed to prepare/enable efuse clk\n"); + return ret; + } + + /* 128 Byte efuse, 96 Byte for secure, 32 Byte for non-secure */ + offset += RK3328_SECURE_SIZES; + addr_start = rounddown(offset, RK3399_NBYTES) / RK3399_NBYTES; + addr_end = roundup(offset + bytes, RK3399_NBYTES) / RK3399_NBYTES; + addr_offset = offset % RK3399_NBYTES; + addr_len = addr_end - addr_start; + + buf = kzalloc(sizeof(*buf) * addr_len * RK3399_NBYTES, GFP_KERNEL); + if (!buf) { + ret = -ENOMEM; + goto nomem; + } + + while (addr_len--) { + writel(RK3328_AUTO_RD | RK3328_AUTO_ENB | + ((addr_start++ & RK3399_A_MASK) << RK3399_A_SHIFT), + efuse->base + RK3328_AUTO_CTRL); + udelay(4); + status = readl(efuse->base + RK3328_INT_STATUS); + if (!(status & RK3328_INT_FINISH)) { + ret = -EIO; + goto err; + } + out_value = readl(efuse->base + RK3328_DOUT); + writel(RK3328_INT_FINISH, efuse->base + RK3328_INT_STATUS); + + memcpy(&buf[i], &out_value, RK3399_NBYTES); + i += RK3399_NBYTES; + } + + memcpy(val, buf + addr_offset, bytes); +err: + kfree(buf); +nomem: + clk_disable_unprepare(efuse->clk); + + return ret; +} + static int rockchip_rk3399_efuse_read(void *context, unsigned int offset, void *val, size_t bytes) { @@ -180,6 +242,10 @@ static const struct of_device_id rockchip_efuse_match[] = { .compatible = "rockchip,rk3368-efuse", .data = (void *)&rockchip_rk3288_efuse_read, }, + { + .compatible = "rockchip,rk3328-efuse", + .data = (void *)&rockchip_rk3328_efuse_read, + }, { .compatible = "rockchip,rk3399-efuse", .data = (void *)&rockchip_rk3399_efuse_read,