public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale•com>
To: Grant Likely <grant.likely@secretlab•ca>
Cc: linuxppc-dev@ozlabs•org, devicetree-discuss@lists•ozlabs.org
Subject: Re: [PATCH] powerpc/fsl: add device tree binding for QE firmware
Date: Wed, 24 Mar 2010 12:31:54 -0500	[thread overview]
Message-ID: <4BAA4C8A.70104@freescale.com> (raw)
In-Reply-To: <fa686aa41003241007mf6052d5s4643795f4a87cdcf@mail.gmail.com>

Grant Likely wrote:
> On Wed, Mar 24, 2010 at 11:00 AM, Segher Boessenkool
> <segher@kernel•crashing.org> wrote:
>>>> Why the phandle redirection?  Why not just put the firmware blob into
>>>> a property in the QE node, or as a subnode?
>>>
>>> Because there might be multiple QE devices on a single chip, and each
>>> will need to upload the same firmware.  So instead of embedding the
>>> firmware multiple times, just embed it once, and have a pointer.
>>
>> You're messing up the binding because of a (perceived) deficiency in
>> the DTB format? 

Huh?  Who says anything about messing up?  I don't see anything "messed up" about including a blob of data with proper compatible properties, etc.

>> Or maybe just the DTS format.  Or maybe you shouldn't
>> even care about size here.  Or really, the device tree is the wrong
>> place to store firmware blobs at all.
> 
> That is a good question.  Why is it necessary to pass the blob via the
> tree? 

Because sometimes the firmware is needed before networking or serial I/O can function.  Today, we do one of two things on systems with QE (or QE-like microcontrollers):

1) U-Boot uploads the firmware, and may create a DTB node that provides some information about the firmware.

2) U-Boot uploads the firmware, but then gives Linux the physical address (in flash) of the firmware so that it can upload it again.

> So far we've avoided using firmware blobs in the flat trees.
> Or to ask in other words; what is the use case that requires passing
> via the device tree?

The Fman devices on the Freescale P4080 needs to have the firmware uploaded by the kernel before they will function.  I can't depend on having the firmware on the root file system, and we can't embed it in the kernel itself (because it's proprietary), so where else should I put it?  Today, we just leave it in flash and give the physical address to the Fman Linux driver via a command-line parameter.  But that doesn't work because then it means we have to have flash mapped to every partition that runs Linux.  

> Also, depending on firmware to correctly squirt the firmware blob into
> the dtb at boot is risky.  Even when firmware is buggy, there is
> resistance to upgrading firmware on working boards because it could
> result in a bricked board.

I'm not sure what you're getting at.  This has nothing to do with upgrading firmware.  The firmware is already in flash, I just need a better way of giving it to the kernel.  If you upgrade the firmware in flash, then U-Boot will automatically provide the new version to the kernel via the DTB.  I just don't see how upgrading is a factor.

>  In fact, every time we depend on firmware
> to modify the dtb at boot is risky, so it should only be done when
> strictly necessary (I would even say that to date we've probably been
> rather too liberal about getting u-boot to modify the device tree).

Embedding the firmware blob in the DTS is uglier than having U-Boot do it, IMHO.

> I would say that either the firmware should be loaded via the existing
> (non-dt) firmware loading mechanism, 

That, unfortunately, is not an option.

> or it should be built into the
> static dtb blob.  Don't try to add it at runtime.

Then how do I distribute the firmware blob?  It's not GPL, so it can't go into arch/powerpc/boot/dts/.  Are you suggesting I do this in the DTS:

/ {
	model = "MPC8323EMDS";
	compatible = "MPC8323EMDS", "MPC832xMDS", "MPC83xxMDS";
	#address-cells = <1>;
	#size-cells = <1>;

...

	qe_firmware:qe-firmware {
		compatible = "fsl,qe-firmware";
		fsl,firmware = <0x70 0xcd 0x00 0x00 0x01 0x46 0x45 0x63 ...>
	}
}

Most firmware is 8-12KB, so this will make for one ugly DTS.  Plus, there's the issue of distributing non-GPL firmware data inside a DTS, which is GPL.

-- 
Timur Tabi
Linux kernel developer at Freescale

  reply	other threads:[~2010-03-24 17:31 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23 21:42 [PATCH] powerpc/fsl: add device tree binding for QE firmware Timur Tabi
2010-03-24  6:07 ` Grant Likely
2010-03-24 12:05   ` Timur Tabi
2010-03-24 17:00     ` Segher Boessenkool
2010-03-24 17:07       ` Grant Likely
2010-03-24 17:31         ` Timur Tabi [this message]
2010-03-24 18:10           ` Grant Likely
2010-03-24 18:21             ` Mitch Bradley
2010-03-24 18:25             ` Timur Tabi
2010-03-24 18:24           ` M. Warner Losh
2010-03-24 18:31             ` Timur Tabi
2010-03-25  1:49           ` Segher Boessenkool
2010-03-25 14:42             ` Timur Tabi
2010-03-25 16:10               ` Grant Likely
2010-03-25 16:34                 ` Scott Wood
2010-03-25 16:46                   ` Timur Tabi
2010-03-26 18:23                     ` Rafal Jaworowski
2010-03-25 23:53               ` M. Warner Losh
2010-03-26  0:22                 ` Timur Tabi
2010-03-25 15:16             ` Scott Wood
2010-03-25 15:29               ` Mitch Bradley
2010-03-25 16:16                 ` Grant Likely
2010-03-25 16:36                   ` Timur Tabi
2010-03-25 16:50                     ` Scott Wood
2010-03-25 16:59                     ` Grant Likely
2010-03-25 17:03                       ` Timur Tabi
2010-03-25 17:35                         ` Grant Likely
2010-03-25 18:05                           ` Timur Tabi
2010-03-25 19:53                           ` Scott Wood
2010-03-25 20:04                             ` Timur Tabi
2010-03-25 21:54                               ` Grant Likely
2010-03-25 22:19                                 ` Timur Tabi
2010-03-25 21:39                             ` Grant Likely
2010-03-25 22:47                               ` Scott Wood
2010-03-25 21:22                       ` David Gibson
2010-03-26  1:26                     ` Grant Likely
2010-03-26 15:17                       ` Timur Tabi
2010-03-26 18:20                         ` Grant Likely
2010-03-26 18:39                           ` Timur Tabi
2010-03-26 18:44                             ` Grant Likely
2010-03-26 18:48                               ` Timur Tabi
2010-03-26 18:56                                 ` Grant Likely
2010-03-26 18:58                                 ` Mitch Bradley
2010-03-26 19:07                                   ` Grant Likely
2010-03-26 18:48                             ` Mitch Bradley
2010-03-24 18:27         ` Scott Wood

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=4BAA4C8A.70104@freescale.com \
    --to=timur@freescale$(echo .)com \
    --cc=devicetree-discuss@lists$(echo .)ozlabs.org \
    --cc=grant.likely@secretlab$(echo .)ca \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox