Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp514226imm; Thu, 5 Jul 2018 04:26:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfj+QYTCu9QNgB5T6ZDBSanT9j97FPVXk65Fy3Jx1fI7C7vdikSSM9nZK8Vl12p8uU1oaNf X-Received: by 2002:a63:4924:: with SMTP id w36-v6mr5279429pga.143.1530789985366; Thu, 05 Jul 2018 04:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530789985; cv=none; d=google.com; s=arc-20160816; b=X4Pp5hr9knauSENPsieTAtp18fJf+JQwCUYP8eHD5vOm0mpIEEHQvpBlY9p8ZNXJRT 4Ot/8JGgaiuJCrc44mK0FXOgrv/aCp9QIBdk7NnGX3xEcJHtvhIQuDt2NO1aPy8SXHhE muBGHdTIGed7f64DjqNuWovnU/YK1/zk0Ff67HNMLBBPlOXjlapnEdS36wDQ/SQl4MCg eyAKGv55VXinMMH3m3zQlmZ4Xf2AszGfkM+nDRFbgkFkXb+7eXLrLvGHP2iHovs2EIgO nXYLJnJMDY9irYybqnQyIlwoMUHooWoXF5WGeY15kyfqERqzo2PHaQlMo+MFoIQduSBp 82lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=da4H4at0BpuNgu8kmh89tXuqM1hIMyovRXhEi94VfPA=; b=EuKfmFh0slMFPEhgNI8Z153ArK1WS0JMICJmt0EV2PwbpHTtg9W9G8b2QyrU90t6lL ycWARdPzMWLSELzIocfVd6Is15Rl+q7jJlromcY90ksP2MLKVqoSGX2iJca72vqzV1ay nSLlKdV+UNsWuntWkq6gyRlRz/l0kxKZvcRoDNObHIiw2rKDL9NqCuBctGxlNKGxonaV JGZhAr2XWiFOh/FTdEqBn8UFNoDQV1mFvhlhw2GWMVPAUjHg5c+5zWqDFfADsBQao+PJ 5NvjWrgOO/8pLEBIF0+WQcWazcW/lt8xGBFPmhLxOv6YTfAyxHebr0bkHJtSEx8sCRc9 lcBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5-v6si5298726pgc.210.2018.07.05.04.26.10; Thu, 05 Jul 2018 04:26:25 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753924AbeGELZe (ORCPT + 99 others); Thu, 5 Jul 2018 07:25:34 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:37518 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753548AbeGELZc (ORCPT ); Thu, 5 Jul 2018 07:25:32 -0400 Received: from ziggy.stardust ([37.223.136.20]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Thu, 05 Jul 2018 13:25:28 +0200 Subject: Re: [v3 03/10] mfd: mtk-mmsys: Add mmsys driver To: Lee Jones Cc: Matthias Brugger , matthias.bgg@kernel.org, ulrich.hecht+renesas@gmail.com, laurent.pinchart@ideasonboard.com, ck.hu@mediatek.com, p.zabel@pengutronix.de, airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, mturquette@baylibre.com, sboyd@codeaurora.org, davem@davemloft.net, gregkh@linuxfoundation.org, mchehab@kernel.org, rdunlap@infradead.org, sean.wang@mediatek.com, linux-clk@vger.kernel.org, linux@armlinux.org.uk, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20180430101826.GC5147@dell> <5269ccfd-0274-3c12-7eeb-5de923197d92@gmail.com> <20180703071103.GE20176@dell> <20180704164540.GH496@dell> From: Matthias Brugger Openpgp: preference=signencrypt Autocrypt: addr=mbrugger@suse.com; prefer-encrypt=mutual; keydata= xsFNBFP1zgUBEAC21D6hk7//0kOmsUrE3eZ55kjc9DmFPKIz6l4NggqwQjBNRHIMh04BbCMY fL3eT7ZsYV5nur7zctmJ+vbszoOASXUpfq8M+S5hU2w7sBaVk5rpH9yW8CUWz2+ZpQXPJcFa OhLZuSKB1F5JcvLbETRjNzNU7B3TdS2+zkgQQdEyt7Ij2HXGLJ2w+yG2GuR9/iyCJRf10Okq gTh//XESJZ8S6KlOWbLXRE+yfkKDXQx2Jr1XuVvM3zPqH5FMg8reRVFsQ+vI0b+OlyekT/Xe 0Hwvqkev95GG6x7yseJwI+2ydDH6M5O7fPKFW5mzAdDE2g/K9B4e2tYK6/rA7Fq4cqiAw1+u EgO44+eFgv082xtBez5WNkGn18vtw0LW3ESmKh19u6kEGoi0WZwslCNaGFrS4M7OH+aOJeqK fx5dIv2CEbxc6xnHY7dwkcHikTA4QdbdFeUSuj4YhIZ+0QlDVtS1QEXyvZbZky7ur9rHkZvP ZqlUsLJ2nOqsmahMTIQ8Mgx9SLEShWqD4kOF4zNfPJsgEMB49KbS2o9jxbGB+JKupjNddfxZ HlH1KF8QwCMZEYaTNogrVazuEJzx6JdRpR3sFda/0x5qjTadwIW6Cl9tkqe2h391dOGX1eOA 1ntn9O/39KqSrWNGvm+1raHK+Ev1yPtn0Wxn+0oy1tl67TxUjQARAQABzSlNYXR0aGlhcyBC cnVnZ2VyIDxtYXR0aGlhcy5iZ2dAZ21haWwuY29tPsLBkgQTAQIAPAIbAwYLCQgHAwIGFQgC CQoLBBYCAwECHgECF4AWIQTmuZIYwPLD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ucSKsNa8FllDmG/fQ== Message-ID: <92a851a9-a12c-e773-5f43-007f4d08b7e3@suse.com> Date: Thu, 5 Jul 2018 13:25:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180704164540.GH496@dell> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/07/18 18:45, Lee Jones wrote: > On Wed, 04 Jul 2018, Matthias Brugger wrote: > >> >> >> On 03/07/18 09:11, Lee Jones wrote: >>> On Mon, 25 Jun 2018, Matthias Brugger wrote: >>>> On 30/04/18 12:18, Lee Jones wrote: >>>>> On Fri, 27 Apr 2018, matthias.bgg@kernel.org wrote: >>>>> >>>>>> From: Matthias Brugger >>>>>> >>>>>> The MMSYS subsystem includes clocks and drm components. >>>>>> This patch adds a MFD device to probe both drivers from the same >>>>>> device tree compatible. >>>>>> >>>>>> Signed-off-by: Matthias Brugger >>>>>> --- >>>>>> drivers/mfd/Kconfig | 9 ++++++ >>>>>> drivers/mfd/Makefile | 2 ++ >>>>>> drivers/mfd/mtk-mmsys.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ >>>>>> 3 files changed, 90 insertions(+) >>>>>> create mode 100644 drivers/mfd/mtk-mmsys.c >>>>>> >>>>>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig >>>>>> index b860eb5aa194..d23a3b9a2c58 100644 >>>>>> --- a/drivers/mfd/Kconfig >>>>>> +++ b/drivers/mfd/Kconfig >>>>>> @@ -378,6 +378,15 @@ config MFD_MC13XXX_I2C >>>>>> help >>>>>> Select this if your MC13xxx is connected via an I2C bus. >>>>>> >>>>>> +config MFD_MEDIATEK_MMSYS >>>>>> + tristate "Mediatek MMSYS interface" >>>>>> + select MFD_CORE >>>>>> + select REGMAP_MMIO >>>>>> + help >>>>>> + Select this if you have a MMSYS subsystem in your SoC. The >>>>>> + MMSYS subsystem has at least a clock driver part and some >>>>>> + DRM components. >>>>>> + >>>>>> config MFD_MXS_LRADC >>>>>> tristate "Freescale i.MX23/i.MX28 LRADC" >>>>>> depends on ARCH_MXS || COMPILE_TEST >>>>>> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile >>>>>> index d9d2cf0d32ef..b96118bd68d9 100644 >>>>>> --- a/drivers/mfd/Makefile >>>>>> +++ b/drivers/mfd/Makefile >>>>>> @@ -98,6 +98,8 @@ obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o >>>>>> obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o >>>>>> obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o >>>>>> >>>>>> +obj-$(CONFIG_MFD_MEDIATEK_MMSYS) += mtk-mmsys.o >>>>>> + >>>>>> obj-$(CONFIG_MFD_CORE) += mfd-core.o >>>>>> >>>>>> obj-$(CONFIG_EZX_PCAP) += ezx-pcap.o >>>>>> diff --git a/drivers/mfd/mtk-mmsys.c b/drivers/mfd/mtk-mmsys.c >>>>>> new file mode 100644 >>>>>> index 000000000000..c802343fb1c6 >>>>>> --- /dev/null >>>>>> +++ b/drivers/mfd/mtk-mmsys.c >>>>>> @@ -0,0 +1,79 @@ >>>>>> +// SPDX-License-Identifier: GPL-2.0+ >>>>>> + >>>>>> +/* >>>>>> + * mtk-mmsys.c -- Mediatek MMSYS multi-function driver >>>>>> + * >>>>>> + * Copyright (c) 2018 Matthias Brugger >>>>>> + * >>>>>> + * Author: Matthias Brugger >>>>>> + */ >>>>>> + >>>>>> +#include >>>>>> +#include >>>>>> +#include >>>>>> +#include >>>>>> +#include >>>>>> +#include >>>>>> +#include >>>>>> +#include >>>>>> + >>>>>> +enum { >>>>>> + MMSYS_MT2701 = 1, >>>>>> +}; >>>>>> + >>>>>> +static const struct mfd_cell mmsys_mt2701_devs[] = { >>>>>> + { .name = "clk-mt2701-mm", }, >>>>>> + { .name = "drm-mt2701-mm", }, >>>>>> +}; >>>>>> + >>>>>> +static int mmsys_probe(struct platform_device *pdev) >>>>>> +{ >>>>>> + const struct mfd_cell *mmsys_cells; >>>>>> + int nr_cells; >>>>>> + long id; >>>>>> + int ret; >>>>>> + >>>>>> + id = (long) of_device_get_match_data(&pdev->dev); >>>>>> + if (!id) { >>>>>> + dev_err(&pdev->dev, "of_device_get match_data() failed\n"); >>>>>> + return -EINVAL; >>>>>> + } >>>>>> + >>>>>> + switch (id) { >>>>>> + case MMSYS_MT2701: >>>>>> + mmsys_cells = mmsys_mt2701_devs; >>>>>> + nr_cells = ARRAY_SIZE(mmsys_mt2701_devs); >>>>>> + break; >>>>>> + default: >>>>>> + return -ENODEV; >>>>>> + } >>>>>> + >>>>>> + ret = devm_mfd_add_devices(&pdev->dev, 0, mmsys_cells, nr_cells, >>>>>> + NULL, 0, NULL); >>>>>> + if (ret) { >>>>>> + dev_err(&pdev->dev, "failed to add MFD devices %d\n", ret); >>>>>> + return ret; >>>>>> + } >>>>>> + >>>>>> + return 0; >>>>>> +}; >>>>> >>>>> This driver is pretty pointless. It doesn't actually do anything. >>>>> >>>>> I think you just want to use "simple-mfd" instead. >>>>> >>>> >>>> I think the problem is, that right now we have two drivers which use the same >>>> devicetree binding, which are clk and drm driver. With a simple-mfd we would >>>> need two compatibles, and this would break backwards compatibility. >>> >>> So what functionality does this driver provide you with that you do >>> not have currently? >>> >> >> I'm not sure if I get your question. Point is, that the MMSYS implementation for >> mt8173 is broken, as it assumes that we can probe two drivers with the >> mediatek,mt8173-mmsys compatible. Somehow it used to work, but from what I >> understand it was a bug. So older devicetrees use just on mt8173-mmsys >> compatible in ther DTB. > > Okay, that is what I was getting at. Thanks for the explanation. > > Do you have a datasheet I can look at? > Unfortunately there is no datasheet you can get without a NDA. The only public available information I'm aware of is for the (not upstream supported) 96board [1]. And it's only the register description. You can find some more explanation about the MMSYS in older threads which tried to solve the very same problem [2] Regards, Matthias [1] https://www.96boards.org/documentation/consumer/mediatekx20/additional-docs/docs/MT6797_Register_Table_Part_2.pdf [2] http://lists.infradead.org/pipermail/linux-mediatek/2017-October/010979.html >> I would like to keep backwards compatibility for the device tree, that's why I >> was searching for a solution where we can probe two drivers and came up with >> this mfd solution. >> >> So no new functionality, the clk driver provides the clock the drm components need. >