From mboxrd@z Thu Jan 1 00:00:00 1970 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 49881C433F5 for ; Tue, 8 Feb 2022 09:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235905AbiBHJMK (ORCPT ); Tue, 8 Feb 2022 04:12:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239097AbiBHJMK (ORCPT ); Tue, 8 Feb 2022 04:12:10 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 676BBC03FEC3 for ; Tue, 8 Feb 2022 01:12:08 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id h6so10740132wrb.9 for ; Tue, 08 Feb 2022 01:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=PJbKv3ScWJ3/TAfgKO6PRsVz/IUNS0H9jBQYHa3CD78=; b=MikKXHNC7i8rGs44Asf8Jltk2wDHP5beBwjhNrJRwru1xPj9434goPNBtOm01gMVIK nRZtnKT7utsqD8aIkFYbhKrp4NQOyle38PSLs0r2HG3vo1RvzhCJFDIS7GazFXHq6b09 tnzf6yX8f5EhR0SR+laSdQcmjhJEu+6EsgrmNc0+24LBvmXTUseN45DA/GfPAy1tXq8N 4KLMlvbltpmOjIcLoy2IcZsWnOEVffib1NqGtaKIBhFI4feR1i+DwmMdBpMquWzL7iL6 fmmGVGG6R3dWzy3WVCoJl14kCKefoAfykRgUojxb/TfM7gbgoPvjs6Ah3qLYFmX9cyS0 t/Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=PJbKv3ScWJ3/TAfgKO6PRsVz/IUNS0H9jBQYHa3CD78=; b=CKYO/3Nua1fhlkln/dnKWCUDNiKdGoVhG+TSLXtVYZ1NN+jYTjpM4LJtuPdoxYhN8u OinzkoR2nDZc/24RIDFygQyXI6ySFuB2TrkxVnTG1sMJU8NrT754Z+Zcn0db+3n4wD4x RnYfBC42RFAt4489Tsp51csNSCFsKr/SEUTbu6zsj/H7NMA9qlEbRKG/a+HRLQPpFbVL i/dX+Xf/ChzwB1ScRp9xQbU3s5q6U3O3xXBctp9pHb0/tE4thEL522rCcpHA3FkQLlx1 +aKAxNqWXwYzsq57p0Qe1wlYZ/H4hS4D22yyL9GlXZezb6lNbPF8oJofOaayxZIbOuyz iApw== X-Gm-Message-State: AOAM531R80Om5ASo/cuF4d/7vb/kOR/ByHeOS3wZckhQOJJoQdnIOaa7 s3GIjpmZytEAEg1Bvn6Zj0eE93fWNK20zQ== X-Google-Smtp-Source: ABdhPJxPp5FT1Ln9HKzS0CItdTmHplu9PkCnWQ1NkcWrbT8LwTxXwyvXSrHh1aLxTYM8Z/xM2BydOQ== X-Received: by 2002:a5d:598a:: with SMTP id n10mr2648769wri.136.1644311526908; Tue, 08 Feb 2022 01:12:06 -0800 (PST) Received: from google.com (cpc155339-bagu17-2-0-cust87.1-3.cable.virginm.net. [86.27.177.88]) by smtp.gmail.com with ESMTPSA id 24sm1460362wmf.48.2022.02.08.01.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 01:12:06 -0800 (PST) Date: Tue, 8 Feb 2022 09:12:03 +0000 From: Lee Jones To: Quan Nguyen Cc: Joel Stanley , Andrew Jeffery , Jean Delvare , Guenter Roeck , Rob Herring , Jonathan Corbet , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Mark Brown , Greg Kroah-Hartman , "Rafael J . Wysocki" , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Gustavo Pimentel , Open Source Submission , Phong Vo , "Thang Q . Nguyen" Subject: Re: [PATCH v6 2/9] mfd: smpro-mfd: Adds Ampere's Altra SMpro MFD driver Message-ID: References: <20211224041352.29405-1-quan@os.amperecomputing.com> <20211224041352.29405-3-quan@os.amperecomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211224041352.29405-3-quan@os.amperecomputing.com> Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org On Fri, 24 Dec 2021, Quan Nguyen wrote: > Adds Multi-function devices driver for SMpro co-processor found on the > Mt.Jade hardware reference platform with Ampere's Altra processor family. > > Signed-off-by: Quan Nguyen > --- > Changes in v6: > + Update license part to reflect that this driver is clone from > simple-mfd-i2c driver [Quan] > > Changes in v5: > + Dropped the use of simple-mfd-i2c driver [Quan] > + Introduced drivers/mfd/smpro-mfd.c driver to instantiate > sub-devices. This is to avoid DT nodes without resource issue [Quan] > + Revised commit message [Quan] > > Changes in v4: > + Add "depends on I2C" to fix build issue found by kernel test > robot [Guenter] > > Changes in v3: > + None > > Changes in v2: > + Used 'struct of_device_id's .data attribute [Lee Jones] > > drivers/mfd/Kconfig | 12 +++++++ > drivers/mfd/Makefile | 1 + > drivers/mfd/smpro-mfd.c | 76 +++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 89 insertions(+) > create mode 100644 drivers/mfd/smpro-mfd.c > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index a21cbdf89477..a886da5018b1 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -77,6 +77,18 @@ config MFD_AS3711 > help > Support for the AS3711 PMIC from AMS > > +config MFD_SMPRO > + tristate "Ampere Computing MFD SMpro core driver" > + depends on I2C > + select MFD_CORE > + select REGMAP_I2C > + help > + Say yes here to enable SMpro driver support for Ampere's Altra > + processor family. > + > + Ampere's Altra SMpro exposes an I2C regmap interface that can > + be accessed by child devices. > + > config MFD_AS3722 > tristate "ams AS3722 Power Management IC" > select MFD_CORE > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index 4d53e951a92d..fbcd09dce5ce 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -267,6 +267,7 @@ obj-$(CONFIG_MFD_QCOM_PM8008) += qcom-pm8008.o > > obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o > obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o > +obj-$(CONFIG_MFD_SMPRO) += smpro-mfd.o > obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o > > obj-$(CONFIG_MFD_ATC260X) += atc260x-core.o > diff --git a/drivers/mfd/smpro-mfd.c b/drivers/mfd/smpro-mfd.c > new file mode 100644 > index 000000000000..132d4e2dde12 > --- /dev/null > +++ b/drivers/mfd/smpro-mfd.c > @@ -0,0 +1,76 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Ampere Altra Family SMPro MFD - I2C > + * > + * Copyright (c) 2021, Ampere Computing LLC > + * Author: Quan Nguyen > + * > + * Based on simple-mfd-i2c.c: Why aren't you just using this? > + * Copyright (c) by Michael Walle > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +/* Identification Registers */ > +#define MANUFACTURER_ID_REG 0x02 > +#define AMPERE_MANUFACTURER_ID 0xCD3A > + > +static const struct regmap_config simple_word_regmap_config = { > + .reg_bits = 8, > + .val_bits = 16, > +}; > + > +static const struct mfd_cell smpro_devs[] = { > + MFD_CELL_NAME("smpro-hwmon"), > +}; What are the other devices? > +static int smpro_mfd_probe(struct i2c_client *i2c) > +{ > + const struct regmap_config *config; > + struct regmap *regmap; > + unsigned int val; > + int ret; > + > + config = device_get_match_data(&i2c->dev); > + if (!config) > + config = &simple_word_regmap_config; > + > + regmap = devm_regmap_init_i2c(i2c, config); > + if (IS_ERR(regmap)) > + return PTR_ERR(regmap); > + > + /* Check for valid ID */ > + ret = regmap_read(regmap, MANUFACTURER_ID_REG, &val); > + if (ret) > + return ret; > + > + if (val != AMPERE_MANUFACTURER_ID) > + return -ENODEV; > + > + return devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, > + smpro_devs, ARRAY_SIZE(smpro_devs), NULL, 0, NULL); > +} > + > +static const struct of_device_id smpro_mfd_of_match[] = { > + { .compatible = "ampere,smpro", .data = &simple_word_regmap_config }, > + {} > +}; > +MODULE_DEVICE_TABLE(of, smpro_mfd_of_match); > + > +static struct i2c_driver smpro_mfd_driver = { > + .probe_new = smpro_mfd_probe, > + .driver = { > + .name = "smpro-mfd-i2c", > + .of_match_table = smpro_mfd_of_match, > + }, > +}; > +module_i2c_driver(smpro_mfd_driver); > + > +MODULE_AUTHOR("Quan Nguyen "); > +MODULE_DESCRIPTION("SMPRO MFD - I2C driver"); > +MODULE_LICENSE("GPL v2"); -- Lee Jones [李琼斯] Principal Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ADAFDC433EF for ; Tue, 8 Feb 2022 09:12:53 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JtHNM67qRz3bPP for ; Tue, 8 Feb 2022 20:12:51 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=MikKXHNC; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linaro.org (client-ip=2a00:1450:4864:20::432; helo=mail-wr1-x432.google.com; envelope-from=lee.jones@linaro.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=MikKXHNC; dkim-atps=neutral Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JtHMf09M2z30Mj for ; Tue, 8 Feb 2022 20:12:12 +1100 (AEDT) Received: by mail-wr1-x432.google.com with SMTP id i15so7061784wrb.3 for ; Tue, 08 Feb 2022 01:12:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=PJbKv3ScWJ3/TAfgKO6PRsVz/IUNS0H9jBQYHa3CD78=; b=MikKXHNC7i8rGs44Asf8Jltk2wDHP5beBwjhNrJRwru1xPj9434goPNBtOm01gMVIK nRZtnKT7utsqD8aIkFYbhKrp4NQOyle38PSLs0r2HG3vo1RvzhCJFDIS7GazFXHq6b09 tnzf6yX8f5EhR0SR+laSdQcmjhJEu+6EsgrmNc0+24LBvmXTUseN45DA/GfPAy1tXq8N 4KLMlvbltpmOjIcLoy2IcZsWnOEVffib1NqGtaKIBhFI4feR1i+DwmMdBpMquWzL7iL6 fmmGVGG6R3dWzy3WVCoJl14kCKefoAfykRgUojxb/TfM7gbgoPvjs6Ah3qLYFmX9cyS0 t/Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=PJbKv3ScWJ3/TAfgKO6PRsVz/IUNS0H9jBQYHa3CD78=; b=ysi9MKZ8FWMHeJ4BePGXglp2Plwt2dX8FRUxyR+AYG6pXdFQ6OSBCRzqnq1PI+DHxi 0dW7bJ1FPRdAIFcgpdR9gpqLeK9T55xeidkth++MxnB+YYy8AIUyHijS3MC7bIYfwTL1 YMEUMFVcqmoekkHws3pdinsm42Lb0PMm0q5Y1yj9WmDcx8cSsVAj8fHwXj+yBrbhXWc1 zy2yZ89vDYsCbeE7g4X15H+O5GIE21Dx0cAw9qdhisbyPbji2bOjvGN2GtCxbpPjIFt6 d3zmbtM31k/GtRf+wxxGRgMj1zojArjfL4e7f/nF5C0N9Kqk5Ocjr0EeMYSMIBHU7Ljh 0t+Q== X-Gm-Message-State: AOAM533lzZZ0zaIVCb+YWOpQo8WyU+7SomZgKrjP67ewKj3rSGYT+ERL NrCQq/KyR62oCFLggkx8NXsDag== X-Google-Smtp-Source: ABdhPJxPp5FT1Ln9HKzS0CItdTmHplu9PkCnWQ1NkcWrbT8LwTxXwyvXSrHh1aLxTYM8Z/xM2BydOQ== X-Received: by 2002:a5d:598a:: with SMTP id n10mr2648769wri.136.1644311526908; Tue, 08 Feb 2022 01:12:06 -0800 (PST) Received: from google.com (cpc155339-bagu17-2-0-cust87.1-3.cable.virginm.net. [86.27.177.88]) by smtp.gmail.com with ESMTPSA id 24sm1460362wmf.48.2022.02.08.01.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 01:12:06 -0800 (PST) Date: Tue, 8 Feb 2022 09:12:03 +0000 From: Lee Jones To: Quan Nguyen Subject: Re: [PATCH v6 2/9] mfd: smpro-mfd: Adds Ampere's Altra SMpro MFD driver Message-ID: References: <20211224041352.29405-1-quan@os.amperecomputing.com> <20211224041352.29405-3-quan@os.amperecomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211224041352.29405-3-quan@os.amperecomputing.com> X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aspeed@lists.ozlabs.org, linux-doc@vger.kernel.org, Dragan Cvetic , Phong Vo , Jonathan Corbet , openbmc@lists.ozlabs.org, "Rafael J . Wysocki" , Derek Kiernan , Guenter Roeck , devicetree@vger.kernel.org, Jean Delvare , Arnd Bergmann , "Thang Q . Nguyen" , Rob Herring , Open Source Submission , linux-hwmon@vger.kernel.org, Andrew Jeffery , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Mark Brown , Gustavo Pimentel Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Fri, 24 Dec 2021, Quan Nguyen wrote: > Adds Multi-function devices driver for SMpro co-processor found on the > Mt.Jade hardware reference platform with Ampere's Altra processor family. > > Signed-off-by: Quan Nguyen > --- > Changes in v6: > + Update license part to reflect that this driver is clone from > simple-mfd-i2c driver [Quan] > > Changes in v5: > + Dropped the use of simple-mfd-i2c driver [Quan] > + Introduced drivers/mfd/smpro-mfd.c driver to instantiate > sub-devices. This is to avoid DT nodes without resource issue [Quan] > + Revised commit message [Quan] > > Changes in v4: > + Add "depends on I2C" to fix build issue found by kernel test > robot [Guenter] > > Changes in v3: > + None > > Changes in v2: > + Used 'struct of_device_id's .data attribute [Lee Jones] > > drivers/mfd/Kconfig | 12 +++++++ > drivers/mfd/Makefile | 1 + > drivers/mfd/smpro-mfd.c | 76 +++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 89 insertions(+) > create mode 100644 drivers/mfd/smpro-mfd.c > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index a21cbdf89477..a886da5018b1 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -77,6 +77,18 @@ config MFD_AS3711 > help > Support for the AS3711 PMIC from AMS > > +config MFD_SMPRO > + tristate "Ampere Computing MFD SMpro core driver" > + depends on I2C > + select MFD_CORE > + select REGMAP_I2C > + help > + Say yes here to enable SMpro driver support for Ampere's Altra > + processor family. > + > + Ampere's Altra SMpro exposes an I2C regmap interface that can > + be accessed by child devices. > + > config MFD_AS3722 > tristate "ams AS3722 Power Management IC" > select MFD_CORE > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index 4d53e951a92d..fbcd09dce5ce 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -267,6 +267,7 @@ obj-$(CONFIG_MFD_QCOM_PM8008) += qcom-pm8008.o > > obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o > obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o > +obj-$(CONFIG_MFD_SMPRO) += smpro-mfd.o > obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o > > obj-$(CONFIG_MFD_ATC260X) += atc260x-core.o > diff --git a/drivers/mfd/smpro-mfd.c b/drivers/mfd/smpro-mfd.c > new file mode 100644 > index 000000000000..132d4e2dde12 > --- /dev/null > +++ b/drivers/mfd/smpro-mfd.c > @@ -0,0 +1,76 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Ampere Altra Family SMPro MFD - I2C > + * > + * Copyright (c) 2021, Ampere Computing LLC > + * Author: Quan Nguyen > + * > + * Based on simple-mfd-i2c.c: Why aren't you just using this? > + * Copyright (c) by Michael Walle > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +/* Identification Registers */ > +#define MANUFACTURER_ID_REG 0x02 > +#define AMPERE_MANUFACTURER_ID 0xCD3A > + > +static const struct regmap_config simple_word_regmap_config = { > + .reg_bits = 8, > + .val_bits = 16, > +}; > + > +static const struct mfd_cell smpro_devs[] = { > + MFD_CELL_NAME("smpro-hwmon"), > +}; What are the other devices? > +static int smpro_mfd_probe(struct i2c_client *i2c) > +{ > + const struct regmap_config *config; > + struct regmap *regmap; > + unsigned int val; > + int ret; > + > + config = device_get_match_data(&i2c->dev); > + if (!config) > + config = &simple_word_regmap_config; > + > + regmap = devm_regmap_init_i2c(i2c, config); > + if (IS_ERR(regmap)) > + return PTR_ERR(regmap); > + > + /* Check for valid ID */ > + ret = regmap_read(regmap, MANUFACTURER_ID_REG, &val); > + if (ret) > + return ret; > + > + if (val != AMPERE_MANUFACTURER_ID) > + return -ENODEV; > + > + return devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, > + smpro_devs, ARRAY_SIZE(smpro_devs), NULL, 0, NULL); > +} > + > +static const struct of_device_id smpro_mfd_of_match[] = { > + { .compatible = "ampere,smpro", .data = &simple_word_regmap_config }, > + {} > +}; > +MODULE_DEVICE_TABLE(of, smpro_mfd_of_match); > + > +static struct i2c_driver smpro_mfd_driver = { > + .probe_new = smpro_mfd_probe, > + .driver = { > + .name = "smpro-mfd-i2c", > + .of_match_table = smpro_mfd_of_match, > + }, > +}; > +module_i2c_driver(smpro_mfd_driver); > + > +MODULE_AUTHOR("Quan Nguyen "); > +MODULE_DESCRIPTION("SMPRO MFD - I2C driver"); > +MODULE_LICENSE("GPL v2"); -- Lee Jones [李琼斯] Principal Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog