Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754105AbbEUJ5M (ORCPT ); Thu, 21 May 2015 05:57:12 -0400 Received: from mail-ig0-f174.google.com ([209.85.213.174]:36838 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbbEUJ5I convert rfc822-to-8bit (ORCPT ); Thu, 21 May 2015 05:57:08 -0400 MIME-Version: 1.0 In-Reply-To: References: <20150515195541.GL11598@ld-irv-0074> <20150518104501.GD3551@leverpostej> <20150518183442.GR11598@ld-irv-0074> <20150519013415.GV11598@ld-irv-0074> <20150520213546.GN11598@ld-irv-0074> <20150521072515.GC11112@norris-Latitude-E6410> <20150521081526.GG11112@norris-Latitude-E6410> Date: Thu, 21 May 2015 11:57:07 +0200 Message-ID: Subject: Re: [PATCH] Documentation: dt: mtd: replace "nor-jedec" binding with "jedec,spi-nor" From: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= To: Geert Uytterhoeven Cc: Brian Norris , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Stephen Warren , Marek Vasut , linux-spi Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3194 Lines: 79 On 21 May 2015 at 11:39, Geert Uytterhoeven wrote: > On Thu, May 21, 2015 at 11:31 AM, Rafał Miłecki wrote: >> On 21 May 2015 at 10:58, Geert Uytterhoeven wrote: >>> On Thu, May 21, 2015 at 10:50 AM, Rafał Miłecki wrote: >>>>>>> I think your comments suggest that I shouldn't be removing "spi-nor" >>>>>>> from m25p_ids[] nor from this block: >>>>>>> >>>>>>> if (data && data->type) >>>>>>> flash_name = data->type; >>>>>>> else if (!strcmp(spi->modalias, "spi-nor")) >>>>>>> flash_name = NULL; /* auto-detect */ >>>>>>> else >>>>>>> flash_name = spi->modalias; >>>>>>> >>>>>>> So it stays in both m25p_ids[] and .of_match_table. >>>>>>> >>>>>>> I suppose that can work. It then allows people to do weird stuff like: >>>>>>> >>>>>>> compatible = "idontknowwhatimdoing,spi-nor"; >>>>>>> >>>>>>> in their device tree. But other than that, there's not much downside I don't >>>>>>> think. >>>>>> >>>>>> It sounds like a reasonable solution. I guess there isn't a perfect >>>>>> one. Even if we decide to go for sth like "jedec-spi-nor", there >>>>>> always will be a chance of someone using >>>>>> compatible = "idontknowwhatimdoing,jedec-spi-nor"; >>>>>> So if you rework your patch to leave "spi-nor" support in m25p_ids and >>>>>> conditions block, it should be OK. >>>>> >>>>> Typically platform devices just use the driver's name. Hence IMHO there's >>>>> no need to add a shiny new spi-nor device name. >>>>> >>>>> So what's wrong with using "m25p80", and treating that as auto-detect iff >>>>> !spi->dev.of_node? >>>> >>>> Treating "m25p80" as auto-detect triggering string won't allow >>>> platform to *force* "m25p80" flash type if there ever appears to be >>>> needed. Maybe it's unlikely, but it still sounds like a bit bad design >>>> for me. >>> >>> To force m25p80 flash, you set flash_platform_data.type to "m25p80"? >> >> Oh, I think I got lost in the way m25p80 is probed. Is it handled by >> spi_board_info and its "modalias"? > > Indeed. > >> Could I leave flash_platform_data.type set to NULL and still have m25p80 probed? > > Yes, that case is the final "else" branch above. Or wait a second, I see the problem. So the last "else" branch does: flash_name = spi->modalias; which will result in flash_name getting "m25p80" which will result in passing "m25p80" model to spi-nor. So some sort of solution is to replace if (data && data->type) flash_name = data->type; with if (data) flash_name = data->type; which will allow platform stuff to *not* specify type and trigger auto (JEDEC RD ID) detection. The only minor problem is we will still need specifying spi_board_info.platform_data, but 99.9% of code does as it's requires for setting partitions anyway. Brian: so I think your initial patch was OK, sorry for all this noise :| -- Rafał -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/