Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1775360imm; Fri, 6 Jul 2018 06:21:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcslC/bQ+QTlNBioVAqJjz6/v9kcCV778BoRkNeyiToZ5ezlQCVf/nLdlAP7NZRsE2e8zYz X-Received: by 2002:a62:ce81:: with SMTP id y123-v6mr10730101pfg.95.1530883306445; Fri, 06 Jul 2018 06:21:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530883306; cv=none; d=google.com; s=arc-20160816; b=uf0XWK+QtxCdCVLFjIiGe1/7uM3T56DjARQ5deic0aeyryXZ406GeI0nPAaFV0smvv 9wxM8pKZU8GRrz6Lb7dx7E2DWz0eCIqXLgtFmBKvHqbH8EvTPVFBwGuJ1i+SfaT85lPN f7zeNckvevXcjeICSvwKWdwr8mEH9S60mQwG1DQZUsathS6/mpI/6tmy4LcSjbNUbM0c B1N+KFRiXcu2v5PgCXdH0oYlGc5PhFcTFT7bpwpALfE+aUac4raPS3m8plmNDsHBIJgz xQwWJmudZCtq4UelFwN8d8khNJ+CXjh3PWltSN3D73E5kGmE0e4OyrxTq1UkqaqoGC3Z 6XCw== 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=QiO2rJVv9/hDwPeZ0+2Cxj8Q0x9fBmuPeyBdH+mgMeI=; b=mQlpP9rh0M/rsXUd/QALrTbZf8G0t535HXreA4bgZYPOcJdQ+Pkz7VT6YwWQvhEI0W 7jzNdCtTLrNMoBlWKnZ41HddpvsbCD99SSrv4nAcUWUL/UK0AuGz6ZFQE090xmkgQqdT l5vCodR0fTRdXDAkdoRxEX5nRdiwW9+QFIbuTy0PZFt99KSqgsENqL9QMYWfXPKrMVMd l6RhJ84SuDa07Jjjk/xAZiMFBBwORqxXxOqw1t+EPD5nWkSKxtX9CaRmhPRpWnvPTK4a GF9kcT4GpcFeCSFqmHAX4FYFOnSprDmk2376gTdiTaCpQzMZr3BhjKRjoweSdjWrmmNW q3Qg== 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 h2-v6si8208859plh.339.2018.07.06.06.21.22; Fri, 06 Jul 2018 06:21:46 -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 S933573AbeGFNSw (ORCPT + 99 others); Fri, 6 Jul 2018 09:18:52 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:38803 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932995AbeGFNSu (ORCPT ); Fri, 6 Jul 2018 09:18:50 -0400 Received: from ziggy.stardust ([37.223.136.20]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Fri, 06 Jul 2018 15:18:45 +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> <92a851a9-a12c-e773-5f43-007f4d08b7e3@suse.com> <20180705122223.GO496@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 cnVnZ2VyIDxtYXR0aGlhcy5iZ2dAZ21haWwuY29tPsL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ZjPWPFTxOteM0omUAS+QopwU0yPLLGJVf2iCmItHc UXI+r2JwH1CJjrHWeQEI2ucSKsNa8FllDmG/fQ== Message-ID: <9c368450-b89b-825b-4763-90825e93b656@suse.com> Date: Fri, 6 Jul 2018 15:18:44 +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: <20180705122223.GO496@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 05/07/18 14:22, Lee Jones wrote: > On Thu, 05 Jul 2018, Matthias Brugger wrote: >> 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: [...] >>>>>>>> +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] >> >> [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 > > And now we have some history. Thanks for providing those. > > So my initial reaction is the one I have just confirmed for myself. > MFD is being used as a work-around in this odd use-case and really > isn't the right place for it. > > If you're adamant that you do not wish to change the Device Tree, my > suggestion is to either move the clk functionality into the DRM > driver, or register the clk driver from DRM using standard > platform_device_register() API. > Ok, I'll try to come up with a solution with a platform device for the clocks. Stay tuened. Thanks for your feedback! Matthias