From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jagan Teki Date: Fri, 11 Dec 2015 12:01:04 +0530 Subject: [U-Boot] [PATCH v8 01/14] sf: spi_flash_validate_params => spi_flash_scan In-Reply-To: References: <1449426866-696-1-git-send-email-jteki@openedev.com> <1449426866-696-2-git-send-email-jteki@openedev.com> Message-ID: <566A6DA8.6080602@openedev.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Friday 11 December 2015 11:51 AM, Bin Meng wrote: > Hi Jagan, > > On Thu, Dec 10, 2015 at 11:16 PM, Jagan Teki wrote: >> On 10 December 2015 at 07:00, Bin Meng wrote: >>> On Mon, Dec 7, 2015 at 2:34 AM, Jagan Teki wrote: >>>> Rename spi_flash_validate_params to spi_flash_scan >>>> as this code not only deals with params setup but >>>> also configure all spi_flash attributes. >>>> >>>> And also moved all flash related code into >>>> spi_flash_scan for future functionality addition. >>>> >>>> Reviewed-by: Simon Glass >>>> Signed-off-by: Jagan Teki >>>> --- >>>> drivers/mtd/spi/sf_probe.c | 145 +++++++++++++++++++++++---------------------- >>>> 1 file changed, 75 insertions(+), 70 deletions(-) >>>> >>>> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c >>>> index a619182..0e20088 100644 >>>> --- a/drivers/mtd/spi/sf_probe.c >>>> +++ b/drivers/mtd/spi/sf_probe.c >>>> @@ -130,13 +130,42 @@ bank_end: >>>> } >>>> #endif >>>> >>>> -static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode, >>>> +#if CONFIG_IS_ENABLED(OF_CONTROL) >>>> +int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash) >>>> +{ >>>> + fdt_addr_t addr; >>>> + fdt_size_t size; >>>> + int node; >>>> + >>>> + /* If there is no node, do nothing */ >>>> + node = fdtdec_next_compatible(blob, 0, COMPAT_GENERIC_SPI_FLASH); >>>> + if (node < 0) >>>> + return 0; >>>> + >>>> + addr = fdtdec_get_addr_size(blob, node, "memory-map", &size); >>>> + if (addr == FDT_ADDR_T_NONE) { >>>> + debug("%s: Cannot decode address\n", __func__); >>>> + return 0; >>>> + } >>>> + >>>> + if (flash->size != size) { >>>> + debug("%s: Memory map must cover entire device\n", __func__); >>>> + return -1; >>>> + } >>>> + flash->memory_map = map_sysmem(addr, size); >>>> + >>>> + return 0; >>>> +} >>>> +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */ >>>> + >>>> +static int spi_flash_scan(struct spi_slave *spi, u8 *idcode, >>>> struct spi_flash *flash) >>> >>> nits: please align above line to the left ( >> >> What is the reason, will it be an alignment issue. > > checkpatch.pl will report such warnings. > > [snip] > $> ./scripts/checkpatch.pl 0001-sf-spi_flash_validate_params-spi_flash_scan.patch total: 0 errors, 0 warnings, 0 checks, 195 lines checked NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE NETWORKING_BLOCK_COMMENT_STYLE USLEEP_RANGE 0001-sf-spi_flash_validate_params-spi_flash_scan.patch has no obvious style problems and is ready for submission. -- Jagan