[PATCH V6] mtd: m25p80: Modify the name of mtd_info

Jonas Gorski jogo at openwrt.org
Tue Aug 18 01:38:16 PDT 2015


On Tue, Aug 18, 2015 at 3:30 AM, Brian Norris
<computersforpeace at gmail.com> wrote:
> On Mon, Aug 17, 2015 at 06:27:36PM +0200, Jonas Gorski wrote:
>> On Mon, Aug 17, 2015 at 6:27 AM, Zhiqiang Hou <B48286 at freescale.com> wrote:
>> > From: Hou Zhiqiang <B48286 at freescale.com>
>> >
>> > Set the mtd_info's name to a fixed one, so spi flash layouts can
>> > be specified by "mtdparts=..." in kernel cmdline, because the
>> > cmdlinepart's parser will match the name of mtd_info with the name
>> > given in cmdline.
>> >
>> > So far, if DT is used, the mtd_info's name will be set to the name
>> > of spi->dev. It includes spi_master->bus_num, and the bus_num may
>> > be dynamically allocated. So, replace the component bus_num with
>> > the physical address of spi controller.
>>
>> You can easily enforce fixed bus numers in linux using aliases in the
>> DT, this is supported
>> by the spi core since v3.9 or so.
>
> Interesting. Thanks for the suggestion. I haven't verified it myself,
> but if this is a workable solution, then I'd much prefer that to
> fiddling with the name here. So, tentative NAK.

Should have added that to my reply, it's this part:

http://lxr.free-electrons.com/source/drivers/spi/spi.c#L1536

int spi_register_master(struct spi_master *master)
{
        ...
        if ((master->bus_num < 0) && master->dev.of_node)
                master->bus_num = of_alias_get_id(master->dev.of_node, "spi");


so just using

aliases {
    spi123 = &spi;
};

should be enough to get "stable" names.

Jonas



More information about the linux-mtd mailing list