Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1677666pxb; Wed, 9 Feb 2022 01:58:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRdE74t3Xqq+BAfDuz4Qtuw5k34MQZn+P5akZaaYj9NfwzrS6CfKrQMvxfyUoYZtq/fMj7 X-Received: by 2002:a17:903:22c1:: with SMTP id y1mr1584287plg.125.1644400699090; Wed, 09 Feb 2022 01:58:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644400699; cv=none; d=google.com; s=arc-20160816; b=uKerjciPIc3QXQHVZS6W7/efYy6Husk50n2EF4z5uD3rAg3ZbiU0X4bf3Z2nROB20S urPXv6dOsKCJPKQw30u7x/wcrkcwKNuhtzeWJBV9Vr5tOHD8CZLJVu0siq7ScGLNNMYK rBZd/geCmpUAPQOLDAcDpt4gokoaeJp6hf3a3ro42gKkpDHA5Q6ZeIA3D4PdfScPXOAT //Ep505wTipYWZtA+oo0mKGRvtiZllBPqTaivDlCXIP5mm6RqSZpzTlLg23a671O1jA8 bU5u8nFbXLVl1wmxGQv8BBmHS+I1r48rL4iG4/G/sejrnntyc6f0xGZ9M9ehmXqr41YU 4FrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PJbKv3ScWJ3/TAfgKO6PRsVz/IUNS0H9jBQYHa3CD78=; b=ucuS6mR/TmWWzCLRo+sBakc6EVTDD3EWK7fna+0ntD7082w+DonFcLLFoK4eM0r3dU uSumRepj34UiC8ZZNkNqf0VCaVnlxcyeCdMvlHlCqZAbTJlxfVi3qT7v1YlZwNBPTsw2 cpA4Cec54qbqXCcEfxtnriu1/Y+e+7j2+rGybqnlPQ/cm3hsuO47bjv/cWoh5XYm5WWx jEAcqjJ++ftFBBemISObWM5sqObvZ0qM+35tmTr7d8TFMYoT4Ly3d2vNKm7hIgTZlayf pyIZBhakbqDi1+f3sQYLXdWLnYoZ4Cx7Nwzo/7WC3aFnoDbMUBybxfBBOdCizikhfpb6 Y5gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MikKXHNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s138si5941533pgs.42.2022.02.09.01.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:58:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MikKXHNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 841E3E049454; Wed, 9 Feb 2022 01:11:31 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349710AbiBHJMM (ORCPT + 99 others); Tue, 8 Feb 2022 04:12:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240331AbiBHJMK (ORCPT ); Tue, 8 Feb 2022 04:12:10 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67523C03FEC1 for ; Tue, 8 Feb 2022 01:12:08 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id v12so751111wrv.2 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=zgc/czfJ+WyT4KE5NIVTV8i1jvnb4VghBYbon7bCxWxq+0Ctz6i2MDE2aIiCjz55m3 iw0kGSFOfw46bM9pb29ZjqZoT417MWjn2V0jCv3VaANnLM6b1h48NCGitboAGSE5oZTu S56p7doEUeCgIaDfG9fv30RkDT7iNNvqgjKrBQ4Ew5s+Ifx05G7+BwjEXe4ZjEZVYR8y FZk2zJKiGmHtj989/hIfFC3gpBW/QoVp4rUmmxKjokMxHUj7ChbPofWocQxtt7pwoun2 iHdyxicWc+W4kFf47w6H7vHR5tOyXca+w3h7Jw4691NCHjVxXD3FO5kFqGh9PJoDGg8R fodg== X-Gm-Message-State: AOAM530DkmXaIKh8JdZKCEegGFr/yGJfKyhZQUJAzjAKmhmgokxWgXCW 8dG4gWPM5xKeFM4/i6zgRzPayA== 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> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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