[U-Boot] [PATCH v8 01/14] sf: spi_flash_validate_params => spi_flash_scan
Jagan Teki
jteki at openedev.com
Fri Dec 11 07:31:04 CET 2015
On Friday 11 December 2015 11:51 AM, Bin Meng wrote:
> Hi Jagan,
>
> On Thu, Dec 10, 2015 at 11:16 PM, Jagan Teki <jteki at openedev.com> wrote:
>> On 10 December 2015 at 07:00, Bin Meng <bmeng.cn at gmail.com> wrote:
>>> On Mon, Dec 7, 2015 at 2:34 AM, Jagan Teki <jteki at openedev.com> 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 <sjg at chromium.org>
>>>> Signed-off-by: Jagan Teki <jteki at openedev.com>
>>>> ---
>>>> 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
More information about the U-Boot
mailing list