Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3130586ybd; Fri, 28 Jun 2019 03:25:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwJivcprvZ2P7i9S9si1XAyKl+ZSt9Gd5edyWMZqdRrykFIXQA2liETZptC5MrtsoEr5yP X-Received: by 2002:a63:7358:: with SMTP id d24mr6012301pgn.224.1561717529800; Fri, 28 Jun 2019 03:25:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561717529; cv=none; d=google.com; s=arc-20160816; b=mJPomKRm8mteCx1Htfm717tTpt9jI5AHQk3bkuU717ltHTb2e8udHKCFoAZGu8Rdn7 dJbe6o4ZYXRyKy2+Bx86HprvsTBrT4BLFVS4Yyc1zv1AwBLdn8IXWcpH+KH+K427bpOg r7a7iy7dHRUH0KiDZ81Q3Ij1gNXc0n7f5hkn3Bx8CVK/lEZsh9Ybmv3SDzp1AABk7xa6 unm3dG99fbc5VlbuQFbCgOFbNTqnigIs2Csm1WL0kVxJTO3jaQ7/gFDKZyfMYRz4opjo V2itJ3TrelhoIcAnDWJ/pviGqfQj5RqSev6lxpQyrTXaCZwjkPE4Ty/5TXDbg1clyqP9 FPZg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+gSDQlprC3wNVZJTkEDEwtkD07MIUVX5qMZNbzm3ynQ=; b=pt/LaCJQDtAbQQkK68luyv2VUE4xKhtqWspfloeOHf5VVFhLaxzAYVAJIAkGXxXkNZ iSokYZ8FlYqP0meiGme3FeJPsP7XFVabjQHPs39WdxNVcr4smrpeF7QeqcIq7u4ADc/h hHCoxY7ujQZl1IIl5KI8HjdmLxOpmg6sYgEJIxp6xXuwfO0DZsc9oOCSGucORHdCRTSA MuvuleXoLejo1GeSC8WwbMqeMHhTX+vpOPnu9nJoGXoaVvkcXSpjj7J9Tx6Es6AsTJrY G9Kogq0Y9wDLnWzL4mQCcEQXUIb1M3F/0TYMdGAqgPufx018Fj88jcncfxdVWCIpgHbu aD9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PxCcngHc; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f14si1755090pln.386.2019.06.28.03.25.13; Fri, 28 Jun 2019 03:25:29 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PxCcngHc; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbfF1KZI (ORCPT + 99 others); Fri, 28 Jun 2019 06:25:08 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:56240 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726502AbfF1KZI (ORCPT ); Fri, 28 Jun 2019 06:25:08 -0400 Received: by mail-wm1-f68.google.com with SMTP id a15so8562625wmj.5; Fri, 28 Jun 2019 03:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+gSDQlprC3wNVZJTkEDEwtkD07MIUVX5qMZNbzm3ynQ=; b=PxCcngHcfZRARVD6NmZbBJD4QlvgXY6SEXWfEYyJypBHAtTPANXPXiB0N778DL4zG5 /6tf2wO9OHv+aH1YOdgfj5j4OsFTc5jZPNRAEzsCHN45rF4yDVTMWTL7UJpaEukHjOff PryTnfTmZC95X9cgOK8ky/KSdrCi3SyuYjbE5qtZOMk2332CNK4/UDKCkHSYbRZGwmsr Jjgq1TMLfUOn5wNKSpo4oQU7/Yg5QKFJjkFPTL9LZLUjBPqtjVsIqs+CtS1MHoXSyNv7 x2GzJQSiMZbmcV/Vfcuuxbgkscrj14UApQqt1b4bYgcWNTC2WoXKrnsjaBWB033xS8Fa JZjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+gSDQlprC3wNVZJTkEDEwtkD07MIUVX5qMZNbzm3ynQ=; b=DWMvbtWuTjriENYfrVWOMxDynAouJSoDsLdSY/7bKWwDn380AM5YHS4xp8kaQmP07w c65Z5C3rJ2lCdAn+Pl9nSEU9j1nth49lUwJ3bYaT1kEmlZiPpHTwezcuGcG1gKKDsAiV nkbRLhh8hlmpHyTPoQ7ocS29T5QXxbzbFoB6OlSTsXqAHv1qQdn399EebeXsVsIWI5Hp wUIpI1VfUgJK+oQ7StJTNcC+brPPrjSSqwpim6GUXEU/J5K4ephquzXsA4Oide7QXzUr SDYiuOoSg3za1cHmw9dXQ/SnhJ1wwMdWQma/fJJcS8nCoB9EGcvp6pE1c7ugfvkoc5TG EaOQ== X-Gm-Message-State: APjAAAWA62FuNpZAO4VoVVNt4br0FXqaYnohK3arvbLSI6ANj80gmBQa IyK3hKUU/y5P8Y+G28S/rKbNC4HvBlVxKHZefAQ= X-Received: by 2002:a1c:96c7:: with SMTP id y190mr6191140wmd.87.1561717504973; Fri, 28 Jun 2019 03:25:04 -0700 (PDT) MIME-Version: 1.0 References: <20190614081650.11880-1-daniel.baluta@nxp.com> <20190614081650.11880-3-daniel.baluta@nxp.com> In-Reply-To: From: Daniel Baluta Date: Fri, 28 Jun 2019 13:24:53 +0300 Message-ID: Subject: Re: [PATCH 2/2] dt-bindings: arm: fsl: Add DSP IPC binding support To: Rob Herring Cc: Daniel Baluta , Shawn Guo , Sascha Hauer , "S.j. Wang" , Fabio Estevam , NXP Linux Team , Dong Aisheng , Anson Huang , "linux-kernel@vger.kernel.org" , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Mark Rutland , Devicetree List , Oleksij Rempel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 27, 2019 at 6:59 PM Rob Herring wrote: > > On Thu, Jun 27, 2019 at 1:40 AM Daniel Baluta w= rote: > > > > > > > > > > > > + mboxes: > > > > > > + description: > > > > > > + List of phandle of 2 MU channels for TXDB, 2 MU channels= for RXDB > > > > > > + (see mailbox/fsl,mu.txt) > > > > > > + maxItems: 1 > > > > > > > > > > Should be 4? > > > > > > > > Actually is just a list with 1 item. I think is the terminology: > > > > > > > > You can have an example here of the mboxes defined for SCU. > > > > https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/f= reescale/imx8qxp.dtsi#L123 > > > > > > mboxes =3D <&lsio_mu1 0 0 > > > &lsio_mu1 0 1 > > > &lsio_mu1 0 2 > > > &lsio_mu1 0 3 > > > &lsio_mu1 1 0 > > > &lsio_mu1 1 1 > > > &lsio_mu1 1 2 > > > &lsio_mu1 1 3 > > > &lsio_mu1 3 3>; > > > > > > Logically, this is 9 entries and each entry is 3 cells ( or phandle > > > plus 2 cells). More below... > > > > Ok.. > > > > > > > > > > > + > > > > > > + mbox-names > > > > > > Also, missing a ':' here. This won't build. Make sure you build this > > > (make dt_binding_check). See > > > Documentation/devicetree/writing-schemas.md. > > > > > Fixed in v2. Awesome! > > > > I thought that Documentation/devicetree/bindings/dsp/fsl,dsp_ipc.yaml > > is purely decorative and used as an example. But it's actually the sche= ma for > > the newly yaml dts, right? > > Yes, that's the point. Enforcing that dts files contain what the > binding docs say. > > > > > Used make dt_binding_check everything looks OK now. > > > > > > > > + description: > > > > > > + Mailboxes names > > > > > > + allOf: > > > > > > + - $ref: "/schemas/types.yaml#/definitions/string" > > > > > > > > > > No need for this, '*-names' already has a defined type. > > > > So, should I remove the above two lines ? > > > > > > Actually, all 4. There's no need to describe what 'mbox-names' is. > > > > > > > > > + - enum: [ "txdb0", "txdb1", "rxdb0", "rxdb1" ] > > > > > > > > > > Should be an 'items' list with 4 entries? > > > > > > > > Let me better read the yaml spec. But "items" list indeed sounds be= tter. > > > > > > What you should end up with is: > > > > > > items: > > > - const: txdb0 > > > - const: txdb1 > > > - const: rxdb0 > > > - const: rxdb1 > > > > > > This is saying you have 4 strings in the listed order. The enum you > > > had would be a single string of one of the 4 values. > > > > > I see! Thanks. > > > > > > > > +required: > > > > > > + - compatible > > > > > > + - mboxes > > > > > > + - mbox-names > > > > > > > > > > This seems incomplete. How does one boot the DSP? Load firmware? = No > > > > > resources that Linux has to manage. Shared memory? > > > > > > > > This is only the IPC mailboxes used by DSP to communicate with Linu= x. The > > > > loading of the firmware, the resources needed to be managed by Linu= x, etc > > > > are part of the DSP node. > > > > > > You should just add the mailboxes to the DSP node then. I suppose you > > > didn't because you want 2 drivers? If so, that's the OS's problem and > > > not part of DT. A Linux driver can instantiate devices for other > > > drivers. > > > > Yes, I want the DSP IPC driver to be separated. And then the SOF Linux > > driver that needs > > to communicate with DSP just gets a handle to DSP IPC driver and does > > the communication. > > > > dts relevant nodes look like this now: > > > > =C2=BB dsp_ipc: dsp_ipc { > > =C2=BB =C2=BB compatible =3D "fsl,imx8qxp-dsp"; > > =C2=BB =C2=BB mbox-names =3D "txdb0", "txdb1", > > =C2=BB =C2=BB =C2=BB "rxdb0", "rxdb1"; > > =C2=BB =C2=BB mboxes =3D <&lsio_mu13 2 0>, > > =C2=BB =C2=BB =C2=BB <&lsio_mu13 2 1>, > > =C2=BB =C2=BB =C2=BB <&lsio_mu13 3 0>, > > =C2=BB =C2=BB =C2=BB <&lsio_mu13 3 1>; > > =C2=BB }; > > > > =C2=BB adma_dsp: dsp@596e8000 { > > =C2=BB =C2=BB compatible =3D "fsl,imx8qxp-sof-dsp"; > > =C2=BB =C2=BB reg =3D <0x596e8000 0x88000>; > > =C2=BB =C2=BB reserved-region =3D <&dsp_reserved>; > > =C2=BB =C2=BB ipc =3D <&dsp_ipc>; > > =C2=BB }; > > > > Your suggeston would be to have something like this: > > > > =C2=BB adma_dsp: dsp@596e8000 { > > =C2=BB =C2=BB compatible =3D "fsl,imx8qxp-sof-dsp"; > > =C2=BB =C2=BB reg =3D <0x596e8000 0x88000>; > > =C2=BB =C2=BB reserved-region =3D <&dsp_reserved>; > > =C2=BB mbox-names =3D "txdb0", "txdb1", > > =C2=BB =C2=BB =C2=BB "rxdb0", "rxdb1"; > > =C2=BB =C2=BB mboxes =3D <&lsio_mu13 2 0>, > > =C2=BB =C2=BB =C2=BB <&lsio_mu13 2 1>, > > =C2=BB =C2=BB =C2=BB <&lsio_mu13 3 0>, > > =C2=BB =C2=BB =C2=BB <&lsio_mu13 3 1>; > > =C2=BB }; > > > > Not sure exactly how to instantiate IPC DSP driver then. > > DT is not the only way to instantiate drivers. A driver can create a > platform device itself which will then instantiate a 2nd driver. > > Presumably the DSP needs to be booted, resources enabled, and firmware > loaded before IPC will work. The DSP driver controlling the lifetime > of the IPC driver is the right way to manage the dependencies. I see your point. This way I will resolve the dependency problem. So far SOF driver was probed before IPC driver and I needed to return -EPROBE_DEFF= ER. The "sad" part is that SOF driver also needs in the same way the System Controller Firmware driver to be probed. But the SC driver is already accepted with an interface that looks like my old approach. https://elixir.bootlin.com/linux/v5.2-rc6/source/drivers/firmware/imx/imx-s= cu.c#L93 Oh, well. > > > > > I already have prepared v2 with most of your feedback incorporated, > > but not this latest > > change with moving mboxes inside dsp driver. > > > > More than that I have followed the model of SCFW IPC and having to > > different approach > > for similar IPC mechanism is a little bit confusing. > > SC is system controller? Maybe I missed it, but I don't think system > controllers usually have 2 nodes. You only have the communications > interface exposed as the SC provides services to Linux and Linux > doesn't manage the SC resources. Yes, SC is the system controller. https://elixir.bootlin.com/linux/v5.2-rc6/source/drivers/firmware/imx/imx-s= cu.c I see your point of only have 1 node and I will implement it like that.