All of lore.kernel.org
 help / color / mirror / Atom feed
From: Loic PALLARDY <loic.pallardy@st.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Suman Anna <s-anna@ti.com>,
	Greg Kroah-Hartman <greg@linuxfoundation.org>,
	Ohad Ben-Cohen <ohad@wizery.com>, Paul Walmsley <paul@pwsan.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	Russell King <linux@arm.linux.org.uk>,
	Benoit Cousson <b-cousson@ti.com>, Arnd Bergmann <arnd@arndb.de>,
	Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>,
	Tony Lindgren <tony@atomide.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Felipe Contreras <felipe.contreras@nokia.com>,
	Dom Cobley <popcornmix@gmail.com>,
	Wim Van Sebroeck <wim@iguana.be>,
	Omar Ramirez Luna <omar.ramirez@copitl.com>,
	Tejun Heo <tj@kernel.org>,
	Omar Ramirez Luna <omar.luna@linaro.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 10/13] mailbox: create dbx500 mailbox driver
Date: Tue, 12 Feb 2013 21:01:05 +0100	[thread overview]
Message-ID: <511A9F81.1040608@st.com> (raw)
In-Reply-To: <20130212103949.GA826@e106331-lin.cambridge.arm.com>

Hi Mark,

Thanks for your comments.

On 02/12/2013 11:39 AM, Mark Rutland wrote:
> Hello,
>
> I have a few comments on the devicetree binding and the way it's parsed.
>
>> +static const struct of_device_id dbx500_mailbox_match[] = {
>> +       { .compatible = "stericsson,db8500-mailbox",
>> +               .data = (void *)db8500_mboxes,
>> +       },
>> +       { .compatible = "stericsson,db9540-mailbox",
>> +               .data = (void *)dbx540_mboxes,
>> +       },
>> +       { /* sentinel */}
>> +};
>> +
>
> The binding for the compatible strings above and property parsing below should
> be documented.
>
Yes you're right. I will add a description in 
Documentation/devicetree/bindings/mailbox/...

>> +static int dbx500_mbox_probe(struct platform_device *pdev)
>> +{
>> +       const struct platform_device_id *platid = platform_get_device_id(pdev);
>> +       struct resource *mem;
>> +       int ret, i, legacy_offset = 0, upap_offset;
>> +       struct mailbox **list;
>> +       int irq;
>> +       struct dbx500_plat_data *pdata = dev_get_platdata(&pdev->dev);
>> +       struct device_node *np = pdev->dev.of_node;
>> +
>> +       if (!pdata) {
>> +               if (np) {
>> +                       of_property_read_u32(np, "legacy-offset",
>> +&legacy_offset);
>
> I see that legacy_offset is initialised to 0, and there's no check on the
> return value of of_property_read_u32. Does that mean this is an optional
> property? This needs to be documented.
>
Correct, I'll add a check. This offset must be compared to shared memory 
size.

>> +                       of_property_read_u32(np, "upap-offset",&upap_offset);
>
> However, upap_offset isn't initialised, but there's no check on the return
> value. If "upap-offset" isn't defined in the dt, upap_offset won't have been
> initialised.
Should be documented too. upap_offset is optional since not supported by 
all STE platforms.
Anyway, value must be checked when used.
>
> Is there no basic sanity checking that could be done here? I assume there's a
> maximum offset we expect that's less than 4GB?
>
> Additionally, of_property_read_u32 takes a *u32, not *int. It would be nice to
> be consistent with the interface.
OK
>
> I'm not familiar with the hardware. What's the difference between the legacy
> and upap cases?
Same HW, but different way to access and manage shared memory.
Link to coprocessor firmware version.
>
>> +                       list = (struct mailbox **)of_match_device(
>> +                                       dbx500_mailbox_match,&pdev->dev)->data;
>> +                       if (!list) {
>> +                               /* No mailbox configuration */
>> +                               dev_err(&pdev->dev, "No configuration found\n");
>> +                               return -ENODEV;
>> +                       }
>> +               } else {
>> +                       /* No mailbox configuration */
>> +                       dev_err(&pdev->dev, "No configuration found\n");
>> +                       return -ENODEV;
>> +               }
>> +       } else {
>> +               list = (struct mailbox **)platid->driver_data;
>> +               legacy_offset = pdata->legacy_offset;
>> +               upap_offset = pdata->upap_offset;
>> +       }
>> +
>> +       mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcm_reg");
>
> Does this work for dt? I wasn't aware we got anything more than anonymous
> memory and interrupts.
>
Yes this is working with and without dt.
dt declaration will be the following
mailbox {
	compatible = "stericsson,db8500-mailbox";
	reg = <0x80157000 0x1000>, <0x801B8000 0x2000>;
	reg-names = "prcm-reg", "prcmu-tcdm";
	interrupts = <0 47 0x4>;
	interrupt-names = "irq";
	legacy-offset = <0xdd4>;
};

>> +       mbox_base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
>> +       if (!mbox_base) {
>> +               ret = -ENOMEM;
>> +               goto out;
>> +       }
>> +
>> +       mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu_tcdm");
>
> Same here.
>
> Thanks,
> Mark.
>
Regards,
Loic

WARNING: multiple messages have this Message-ID (diff)
From: loic.pallardy@st.com (Loic PALLARDY)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 10/13] mailbox: create dbx500 mailbox driver
Date: Tue, 12 Feb 2013 21:01:05 +0100	[thread overview]
Message-ID: <511A9F81.1040608@st.com> (raw)
In-Reply-To: <20130212103949.GA826@e106331-lin.cambridge.arm.com>

Hi Mark,

Thanks for your comments.

On 02/12/2013 11:39 AM, Mark Rutland wrote:
> Hello,
>
> I have a few comments on the devicetree binding and the way it's parsed.
>
>> +static const struct of_device_id dbx500_mailbox_match[] = {
>> +       { .compatible = "stericsson,db8500-mailbox",
>> +               .data = (void *)db8500_mboxes,
>> +       },
>> +       { .compatible = "stericsson,db9540-mailbox",
>> +               .data = (void *)dbx540_mboxes,
>> +       },
>> +       { /* sentinel */}
>> +};
>> +
>
> The binding for the compatible strings above and property parsing below should
> be documented.
>
Yes you're right. I will add a description in 
Documentation/devicetree/bindings/mailbox/...

>> +static int dbx500_mbox_probe(struct platform_device *pdev)
>> +{
>> +       const struct platform_device_id *platid = platform_get_device_id(pdev);
>> +       struct resource *mem;
>> +       int ret, i, legacy_offset = 0, upap_offset;
>> +       struct mailbox **list;
>> +       int irq;
>> +       struct dbx500_plat_data *pdata = dev_get_platdata(&pdev->dev);
>> +       struct device_node *np = pdev->dev.of_node;
>> +
>> +       if (!pdata) {
>> +               if (np) {
>> +                       of_property_read_u32(np, "legacy-offset",
>> +&legacy_offset);
>
> I see that legacy_offset is initialised to 0, and there's no check on the
> return value of of_property_read_u32. Does that mean this is an optional
> property? This needs to be documented.
>
Correct, I'll add a check. This offset must be compared to shared memory 
size.

>> +                       of_property_read_u32(np, "upap-offset",&upap_offset);
>
> However, upap_offset isn't initialised, but there's no check on the return
> value. If "upap-offset" isn't defined in the dt, upap_offset won't have been
> initialised.
Should be documented too. upap_offset is optional since not supported by 
all STE platforms.
Anyway, value must be checked when used.
>
> Is there no basic sanity checking that could be done here? I assume there's a
> maximum offset we expect that's less than 4GB?
>
> Additionally, of_property_read_u32 takes a *u32, not *int. It would be nice to
> be consistent with the interface.
OK
>
> I'm not familiar with the hardware. What's the difference between the legacy
> and upap cases?
Same HW, but different way to access and manage shared memory.
Link to coprocessor firmware version.
>
>> +                       list = (struct mailbox **)of_match_device(
>> +                                       dbx500_mailbox_match,&pdev->dev)->data;
>> +                       if (!list) {
>> +                               /* No mailbox configuration */
>> +                               dev_err(&pdev->dev, "No configuration found\n");
>> +                               return -ENODEV;
>> +                       }
>> +               } else {
>> +                       /* No mailbox configuration */
>> +                       dev_err(&pdev->dev, "No configuration found\n");
>> +                       return -ENODEV;
>> +               }
>> +       } else {
>> +               list = (struct mailbox **)platid->driver_data;
>> +               legacy_offset = pdata->legacy_offset;
>> +               upap_offset = pdata->upap_offset;
>> +       }
>> +
>> +       mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcm_reg");
>
> Does this work for dt? I wasn't aware we got anything more than anonymous
> memory and interrupts.
>
Yes this is working with and without dt.
dt declaration will be the following
mailbox {
	compatible = "stericsson,db8500-mailbox";
	reg = <0x80157000 0x1000>, <0x801B8000 0x2000>;
	reg-names = "prcm-reg", "prcmu-tcdm";
	interrupts = <0 47 0x4>;
	interrupt-names = "irq";
	legacy-offset = <0xdd4>;
};

>> +       mbox_base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
>> +       if (!mbox_base) {
>> +               ret = -ENOMEM;
>> +               goto out;
>> +       }
>> +
>> +       mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu_tcdm");
>
> Same here.
>
> Thanks,
> Mark.
>
Regards,
Loic

  reply	other threads:[~2013-02-12 20:01 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12  4:56 [PATCH v2 00/13] drivers: mailbox: framework creation Suman Anna
2013-02-12  4:56 ` Suman Anna
2013-02-12  4:56 ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 01/13] ARM: OMAP2+: mbox: remove dependencies with soc.h Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 02/13] mailbox: OMAP: introduce mailbox framework Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 03/13] mailbox: split internal header from API header Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 04/13] mailbox: rename omap_mbox in mailbox Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 05/13] mailbox: create opened message type Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 06/13] mailbox: change protection mechanisms Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 07/13] mailbox: add shared memory mailbox type Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 08/13] mailbox: add IRQF_NO_SUSPEND flag Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 09/13] mailbox: add no_irq send message Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 10/13] mailbox: create dbx500 mailbox driver Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12 10:39   ` Mark Rutland
2013-02-12 10:39     ` Mark Rutland
2013-02-12 20:01     ` Loic PALLARDY [this message]
2013-02-12 20:01       ` Loic PALLARDY
2013-02-13  9:08       ` Mark Rutland
2013-02-13  9:08         ` Mark Rutland
2013-02-12  4:57 ` [PATCH v2 11/13] mailbox/omap: check iomem resource before dereferencing it Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 12/13] mailbox: check for NULL nb in mailbox_put Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57 ` [PATCH v2 13/13] mailbox: call request_irq after mbox queues are allocated Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-12  4:57   ` Suman Anna
2013-02-13 13:36 ` [PATCH v2 00/13] drivers: mailbox: framework creation Linus Walleij
2013-02-13 13:36   ` Linus Walleij
2013-02-13 13:42   ` Russell King - ARM Linux
2013-02-13 13:42     ` Russell King - ARM Linux
2013-02-13 16:41     ` Anna, Suman
2013-02-13 16:41       ` Anna, Suman
2013-02-13 16:41       ` Anna, Suman
2013-02-13 20:36       ` Loic PALLARDY
2013-02-13 20:36         ` Loic PALLARDY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=511A9F81.1040608@st.com \
    --to=loic.pallardy@st.com \
    --cc=arnd@arndb.de \
    --cc=b-cousson@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=felipe.contreras@nokia.com \
    --cc=greg@linuxfoundation.org \
    --cc=jkrzyszt@tis.icnet.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=ohad@wizery.com \
    --cc=omar.luna@linaro.org \
    --cc=omar.ramirez@copitl.com \
    --cc=paul@pwsan.com \
    --cc=popcornmix@gmail.com \
    --cc=s-anna@ti.com \
    --cc=tj@kernel.org \
    --cc=tony@atomide.com \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.