mbox series

[U-Boot,v3,0/3] spi: Split CONFIG_DM_SPI* to CONFIG_{SPL_TPL}DM_SPI*

Message ID 20190904221639.26469-1-lukma@denx.de
Headers show
Series spi: Split CONFIG_DM_SPI* to CONFIG_{SPL_TPL}DM_SPI* | expand

Message

Lukasz Majewski Sept. 4, 2019, 10:16 p.m. UTC
This patch series introduces new SPL and TPL specific Kconfig entries for
DM_SPI* options. Such change allows using the spi driver in SPL/TPL or
U-Boot proper.

First two patches - related to ls10{42}* NXP soc fix some issues with
defining the DM_SPI* defines in <board>.h file instead of Kconfig.

This series doesn't introduce build breaks, but board maintainers are kindly
asked to check if their boards still boots.

Buildman setup for binary size regression checking:

./tools/buildman/buildman.py -b HEAD --count=4 ls1043 --output-dir=../BUILD/ --force-build -CveE
./tools/buildman/buildman.py -b HEAD --count=4 ls1043 --output-dir=../BUILD/ -Ssdel


Changes in v3:
- Provide better Kconfig flags conditionals to avoid not compiling
  relavant code (there is negative diff observed after applying those
  patches)
- Fix da850evm_nand and da850evm by enabling SPL_DM_SPI support in
  Kconfig
- Drop patch from the series
  [U-Boot,v2,1/4] kconfig: doc: Update comment regarding CONFIG_IS_ENABLED(FOO) for TPL
  as not being related to this particular change

Changes in v2:
- Resend patches with some not yet in mainline code removed as
  suggested by Adam Ford

Lukasz Majewski (3):
  spi: Move DM_SPI_FLASH to Kconfig (for NXP's ls1043a)
  spi: Move DM_SPI_FLASH and SPI_FLASH_DATAFLASH to Kconfig (for
    ls1021aXXX)
  spi: Convert CONFIG_DM_SPI* to CONFIG_$(SPL_TPL_)DM_SPI*

 arch/arm/Kconfig                            | 24 ++++++++++++++++++++++--
 board/l+g/vinco/vinco.c                     |  4 ++--
 cmd/sf.c                                    |  4 ++--
 cmd/spi.c                                   |  6 +++---
 common/spl/Kconfig                          | 28 ++++++++++++++++++++++++++++
 configs/am57xx_evm_defconfig                |  2 ++
 configs/am57xx_hs_evm_defconfig             |  2 ++
 configs/am57xx_hs_evm_usb_defconfig         |  2 ++
 configs/axm_defconfig                       |  2 ++
 configs/chromebook_link64_defconfig         |  2 ++
 configs/chromebook_samus_tpl_defconfig      |  4 ++++
 configs/dra7xx_evm_defconfig                |  2 ++
 configs/dra7xx_hs_evm_defconfig             |  2 ++
 configs/dra7xx_hs_evm_usb_defconfig         |  2 ++
 configs/j721e_evm_a72_defconfig             |  2 ++
 configs/j721e_evm_r5_defconfig              |  2 ++
 configs/ls1021aiot_qspi_defconfig           |  2 ++
 configs/ls1021aiot_sdcard_defconfig         |  2 ++
 configs/ls1021aqds_qspi_defconfig           |  1 +
 configs/ls1021aqds_sdcard_qspi_defconfig    |  1 +
 configs/ls1021atwr_qspi_defconfig           |  1 +
 configs/sama5d2_xplained_spiflash_defconfig |  2 ++
 configs/sama5d3xek_spiflash_defconfig       |  6 ++++--
 configs/sama5d4_xplained_spiflash_defconfig |  2 ++
 configs/sama5d4ek_spiflash_defconfig        |  2 ++
 configs/stm32mp15_basic_defconfig           |  2 ++
 configs/taurus_defconfig                    |  2 ++
 drivers/mtd/spi/Makefile                    |  4 ++--
 drivers/mtd/spi/sf_probe.c                  |  8 ++++----
 drivers/net/fm/fm.c                         |  4 ++--
 drivers/spi/Makefile                        |  2 +-
 drivers/spi/atmel_spi.c                     |  4 ++--
 drivers/spi/davinci_spi.c                   |  6 +++---
 drivers/spi/fsl_dspi.c                      |  5 +++--
 drivers/spi/kirkwood_spi.c                  |  2 +-
 drivers/spi/mxc_spi.c                       |  6 +++---
 drivers/spi/omap3_spi.c                     |  4 ++--
 drivers/spi/sh_qspi.c                       |  4 ++--
 env/sf.c                                    |  2 +-
 include/configs/ls1021aiot.h                |  6 ------
 include/configs/ls1021aqds.h                |  8 --------
 include/configs/ls1021atwr.h                |  5 -----
 include/configs/ls1043a_common.h            |  2 --
 include/spi.h                               |  8 ++++----
 include/spi_flash.h                         |  2 +-
 test/dm/spi.c                               |  2 +-
 46 files changed, 134 insertions(+), 63 deletions(-)

Comments

Tom Rini Sept. 5, 2019, 6:09 p.m. UTC | #1
On Thu, Sep 05, 2019 at 12:16:36AM +0200, Lukasz Majewski wrote:
> This patch series introduces new SPL and TPL specific Kconfig entries for
> DM_SPI* options. Such change allows using the spi driver in SPL/TPL or
> U-Boot proper.
> 
> First two patches - related to ls10{42}* NXP soc fix some issues with
> defining the DM_SPI* defines in <board>.h file instead of Kconfig.
> 
> This series doesn't introduce build breaks, but board maintainers are kindly
> asked to check if their boards still boots.
> 
> Buildman setup for binary size regression checking:
> 
> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043 --output-dir=../BUILD/ --force-build -CveE
> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043 --output-dir=../BUILD/ -Ssdel

So you did fix the ls1043 problems but ls1046 is still a problem.
There's also changes in (add 'B' to the buildman flags above for this
info):
       x86: (for 26/26 boards) spl/u-boot-spl:all -31.6 spl/u-boot-spl:data -11.4 spl/u-boot-spl:rodata -6.3 spl/u-boot-spl:text -13.9
            qemu-x86_64    : spl/u-boot-spl:all -821 spl/u-boot-spl:data -296 spl/u-boot-spl:rodata -164 spl/u-boot-spl:text -361
               spl-u-boot-spl: add: 0/-10, grow: 0/0 bytes: 0/-657 (-657)
                 function                                   old     new   delta
                 spi_flash_post_bind                          3       -      -3
                 dev_get_parent_priv                         11       -     -11
                 spi_post_probe                              35       -     -35
                 spi_child_post_bind                         37       -     -37
                 spi_child_pre_probe                         46       -     -46
                 _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
                 _u_boot_list_2_uclass_2_spi_nor             76       -     -76
                 _u_boot_list_2_uclass_2_spi_generic         76       -     -76
                 _u_boot_list_2_uclass_2_spi                 76       -     -76
                 spi_slave_ofdata_to_platdata               229       -    -229
       arm: (for 688/688 boards) all -19.6 bss -4.5 rodata -2.2 spl/u-boot-spl:all -12.2 spl/u-boot-spl:bss -1.1 spl/u-boot-spl:data -1.9 spl/u-boot-spl:rodata -2.0 spl/u-boot-spl:text -7.2 text -12.9
            uniphier_v7    : bss -8 rodata +8
            opos6uldev     : bss -8 rodata +8
            uniphier_ld4_sld8: bss -8 rodata +8
            da850evm       : spl/u-boot-spl:all -614 spl/u-boot-spl:data -144 spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -320
               spl-u-boot-spl: add: 2/-15, grow: 2/0 bytes: 112/-574 (-462)
                 function                                   old     new   delta
                 spi_flash_probe                             38      82     +44
                 spi_setup_slave                              -      42     +42
                 spl_spi_load_image                         124     144     +20
                 spi_free_slave                               -       6      +6
                 spi_flash_std_remove                         4       -      -4
                 spi_flash_post_bind                          4       -      -4
                 spi_flash_cmd_get_sw_write_prot              8       -      -8
                 ____aeabi_uidivmod_from_thumb                8       -      -8
                 spi_flash_std_get_sw_write_prot             18       -     -18
                 spi_flash_read_dm                           20       -     -20
                 __aeabi_uidivmod                            24       -     -24
                 __aeabi_idivmod                             24       -     -24
                 spi_flash_std_write                         42       -     -42
                 spi_flash_std_read                          42       -     -42
                 spi_flash_probe_bus_cs                      56       -     -56
                 _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
                 _u_boot_list_2_uclass_2_spi_nor             76       -     -76
                 spi_flash_std_probe                         88       -     -88
                 spi_flash_std_erase                         92       -     -92
            da850evm_nand  : spl/u-boot-spl:all -614 spl/u-boot-spl:data -144 spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -320
               spl-u-boot-spl: add: 2/-15, grow: 2/0 bytes: 112/-574 (-462)
                 function                                   old     new   delta
                 spi_flash_probe                             38      82     +44
                 spi_setup_slave                              -      42     +42
                 spl_spi_load_image                         124     144     +20
                 spi_free_slave                               -       6      +6
                 spi_flash_std_remove                         4       -      -4
                 spi_flash_post_bind                          4       -      -4
                 spi_flash_cmd_get_sw_write_prot              8       -      -8
                 ____aeabi_uidivmod_from_thumb                8       -      -8
                 spi_flash_std_get_sw_write_prot             18       -     -18
                 spi_flash_read_dm                           20       -     -20
                 __aeabi_uidivmod                            24       -     -24
                 __aeabi_idivmod                             24       -     -24
                 spi_flash_std_write                         42       -     -42
                 spi_flash_std_read                          42       -     -42
                 spi_flash_probe_bus_cs                      56       -     -56
                 _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
                 _u_boot_list_2_uclass_2_spi_nor             76       -     -76
                 spi_flash_std_probe                         88       -     -88
                 spi_flash_std_erase                         92       -     -92
            sama5d3xek_spiflash: spl/u-boot-spl:all -630 spl/u-boot-spl:data -144 spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -336
               spl-u-boot-spl: add: 2/-12, grow: 2/0 bytes: 196/-676 (-480)
                 function                                   old     new   delta
                 spi_flash_probe                             44     120     +76
                 spi_setup_slave                              -      60     +60
                 spl_spi_load_image                         172     220     +48
                 spi_free_slave                               -      12     +12
                 spi_flash_std_remove                         8       -      -8
                 spi_flash_post_bind                          8       -      -8
                 spi_flash_cmd_get_sw_write_prot             12       -     -12
                 spi_flash_std_get_sw_write_prot             16       -     -16
                 spi_flash_read_dm                           28       -     -28
                 spi_flash_std_write                         64       -     -64
                 spi_flash_std_read                          64       -     -64
                 _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
                 spi_flash_probe_bus_cs                      76       -     -76
                 _u_boot_list_2_uclass_2_spi_nor             76       -     -76
                 spi_flash_std_probe                        116       -    -116
                 spi_flash_std_erase                        140       -    -140
            socfpga_cyclone5: all -722 bss -136 rodata -98 text -488
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_std_remove                        10       4      -6
                 sf_mtd_name                                  8       -      -8
                 spi_flash_std_probe                         88      76     -12
                 spi_flash_mtd_write                         38       -     -38
                 spi_flash_mtd_read                          38       -     -38
                 spi_flash_mtd_unregister                    52       -     -52
                 spi_flash_mtd_erase                         78       -     -78
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
            socfpga_socrates: all -794 bss -208 rodata -98 text -488
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_std_remove                        10       4      -6
                 sf_mtd_name                                  8       -      -8
                 spi_flash_std_probe                         88      76     -12
                 spi_flash_mtd_write                         38       -     -38
                 spi_flash_mtd_read                          38       -     -38
                 spi_flash_mtd_unregister                    52       -     -52
                 spi_flash_mtd_erase                         78       -     -78
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
            socfpga_sockit : all -794 bss -208 rodata -98 text -488
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_std_remove                        10       4      -6
                 sf_mtd_name                                  8       -      -8
                 spi_flash_std_probe                         88      76     -12
                 spi_flash_mtd_write                         38       -     -38
                 spi_flash_mtd_read                          38       -     -38
                 spi_flash_mtd_unregister                    52       -     -52
                 spi_flash_mtd_erase                         78       -     -78
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
            socfpga_arria5 : all -794 bss -208 rodata -98 text -488
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_std_remove                        10       4      -6
                 sf_mtd_name                                  8       -      -8
                 spi_flash_std_probe                         88      76     -12
                 spi_flash_mtd_write                         38       -     -38
                 spi_flash_mtd_read                          38       -     -38
                 spi_flash_mtd_unregister                    52       -     -52
                 spi_flash_mtd_erase                         78       -     -78
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
            socfpga_is1    : all -794 bss -208 rodata -98 text -488
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_std_remove                        10       4      -6
                 sf_mtd_name                                  8       -      -8
                 spi_flash_std_probe                         88      76     -12
                 spi_flash_mtd_write                         38       -     -38
                 spi_flash_mtd_read                          38       -     -38
                 spi_flash_mtd_unregister                    52       -     -52
                 spi_flash_mtd_erase                         78       -     -78
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
            socfpga_vining_fpga: all -858 bss -272 rodata -98 text -488
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_std_remove                        10       4      -6
                 sf_mtd_name                                  8       -      -8
                 spi_flash_std_probe                         88      76     -12
                 spi_flash_mtd_write                         38       -     -38
                 spi_flash_mtd_read                          38       -     -38
                 spi_flash_mtd_unregister                    52       -     -52
                 spi_flash_mtd_erase                         78       -     -78
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
            socfpga_sr1500 : all -858 bss -280 rodata -98 text -480
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_std_remove                        10       4      -6
                 sf_mtd_name                                  8       -      -8
                 spi_flash_std_probe                         88      76     -12
                 spi_flash_mtd_write                         38       -     -38
                 spi_flash_mtd_read                          38       -     -38
                 spi_flash_mtd_unregister                    52       -     -52
                 spi_flash_mtd_erase                         78       -     -78
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
            cm_fx6         : all -1130 bss -296 rodata -146 text -688
               u-boot: add: 0/-11, grow: 0/-2 bytes: 0/-829 (-829)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_free                              26      22      -4
                 sf_mtd_name                                  8       -      -8
                 spi_flash_probe                             88      78     -10
                 idr_remove                                  20       -     -20
                 spi_flash_mtd_write                         44       -     -44
                 spi_flash_mtd_read                          44       -     -44
                 spi_flash_mtd_unregister                    52       -     -52
                 del_mtd_device                              68       -     -68
                 spi_flash_mtd_erase                        164       -    -164
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
            aristainetos   : all -1186 bss -264 rodata -98 text -824
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           4       -      -4
                 spi_flash_free                              32      28      -4
                 sf_mtd_name                                  8       -      -8
                 spi_flash_probe                            136     120     -16
                 spi_flash_mtd_write                         80       -     -80
                 spi_flash_mtd_read                          80       -     -80
                 spi_flash_mtd_unregister                    84       -     -84
                 spi_flash_mtd_erase                        220       -    -220
                 sf_mtd_info                                240       -    -240
                 spi_flash_mtd_register                     244       -    -244
            aristainetos2  : all -1186 bss -264 rodata -98 text -824
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           4       -      -4
                 spi_flash_free                              32      28      -4
                 sf_mtd_name                                  8       -      -8
                 spi_flash_probe                            136     120     -16
                 spi_flash_mtd_write                         80       -     -80
                 spi_flash_mtd_read                          80       -     -80
                 spi_flash_mtd_unregister                    84       -     -84
                 spi_flash_mtd_erase                        220       -    -220
                 sf_mtd_info                                240       -    -240
                 spi_flash_mtd_register                     244       -    -244
            aristainetos2b : all -1186 bss -264 rodata -98 text -824
               u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           4       -      -4
                 spi_flash_free                              32      28      -4
                 sf_mtd_name                                  8       -      -8
                 spi_flash_probe                            136     120     -16
                 spi_flash_mtd_write                         80       -     -80
                 spi_flash_mtd_read                          80       -     -80
                 spi_flash_mtd_unregister                    84       -     -84
                 spi_flash_mtd_erase                        220       -    -220
                 sf_mtd_info                                240       -    -240
                 spi_flash_mtd_register                     244       -    -244
            display5_factory: all -1561 bss -216 rodata -201 text -1144
               u-boot: add: 0/-13, grow: 0/-2 bytes: 0/-1237 (-1237)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_free                              26      22      -4
                 sf_mtd_name                                  8       -      -8
                 spi_flash_probe                             88      78     -10
                 idr_remove                                  20       -     -20
                 spi_flash_mtd_write                         44       -     -44
                 spi_flash_mtd_read                          44       -     -44
                 spi_flash_mtd_unregister                    52       -     -52
                 del_mtd_device                              68       -     -68
                 mtd_unlock                                  80       -     -80
                 spi_flash_mtd_erase                        164       -    -164
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
                 add_mtd_device                             328       -    -328
            display5       : all -1605 bss -248 rodata -201 text -1156
               u-boot: add: 0/-13, grow: 0/-2 bytes: 0/-1237 (-1237)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_free                              26      22      -4
                 sf_mtd_name                                  8       -      -8
                 spi_flash_probe                             88      78     -10
                 idr_remove                                  20       -     -20
                 spi_flash_mtd_write                         44       -     -44
                 spi_flash_mtd_read                          44       -     -44
                 spi_flash_mtd_unregister                    52       -     -52
                 del_mtd_device                              68       -     -68
                 mtd_unlock                                  80       -     -80
                 spi_flash_mtd_erase                        164       -    -164
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
                 add_mtd_device                             328       -    -328
            brppt1_spi     : spl/u-boot-spl:all -2109 spl/u-boot-spl:bss -4 spl/u-boot-spl:data -436 spl/u-boot-spl:rodata -309 spl/u-boot-spl:text -1360
               spl-u-boot-spl: add: 3/-41, grow: 5/-2 bytes: 1310/-3100 (-1790)
                 function                                   old     new   delta
                 spi_xfer                                     6     800    +794
                 spi_claim_bus                                6     248    +242
                 spi_setup_slave                              -     156    +156
                 spi_do_alloc_slave                           -      48     +48
                 spi_flash_probe                             26      72     +46
                 spl_spi_load_image                         124     140     +16
                 spi_release_bus                              6      12      +6
                 spi_free_slave                               -       2      +2
                 spi_flash_std_remove                         4       -      -4
                 spi_flash_post_bind                          4       -      -4
                 omap4_pdata                                  4       -      -4
                 omap2_pdata                                  4       -      -4
                 dev_get_parent_priv                          6       -      -6
                 spi_flash_cmd_get_sw_write_prot              8       -      -8
                 spi_flash_std_get_sw_write_prot             14       -     -14
                 spi_flash_read_dm                           14       -     -14
                 dm_spi_release_bus                          14       -     -14
                 ofnode_read_bool                            16       -     -16
                 fdtdec_get_bool                             20       -     -20
                 omap3_spi_release_bus                       22       -     -22
                 spi_mem_adjust_op_size                      92      68     -24
                 spi_child_post_bind                         30       -     -30
                 spi_post_probe                              32       -     -32
                 spi_flash_std_write                         34       -     -34
                 spi_flash_std_read                          34       -     -34
                 spi_child_pre_probe                         34       -     -34
                 dm_spi_xfer                                 34       -     -34
                 spi_mem_supports_op                         36       -     -36
                 spi_flash_probe_bus_cs                      48       -     -48
                 spi_find_chip_select                        50       -     -50
                 omap3_spi_claim_bus                         54       -     -54
                 static.spi_check_buswidth_req               56       -     -56
                 omap3_spi_set_wordlen                       62       -     -62
                 spi_mem_exec_op                            284     220     -64
                 _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
                 _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
                 _u_boot_list_2_driver_2_omap3_spi           68       -     -68
                 spi_set_speed_mode                          72       -     -72
                 spi_flash_std_probe                         76       -     -76
                 omap3_spi_set_speed                         76       -     -76
                 _u_boot_list_2_uclass_2_spi_nor             76       -     -76
                 _u_boot_list_2_uclass_2_spi_generic         76       -     -76
                 _u_boot_list_2_uclass_2_spi                 76       -     -76
                 spi_flash_std_erase                         84       -     -84
                 spi_mem_default_supports_op                 86       -     -86
                 omap3_spi_set_mode                          96       -     -96
                 dm_spi_claim_bus                           100       -    -100
                 omap3_spi_probe                            116       -    -116
                 spi_slave_ofdata_to_platdata               212       -    -212
                 spi_get_bus_and_cs                         232       -    -232
                 omap3_spi_xfer                             796       -    -796
            brsmarc1       : spl/u-boot-spl:all -2113 spl/u-boot-spl:bss -4 spl/u-boot-spl:data -436 spl/u-boot-spl:rodata -309 spl/u-boot-spl:text -1364
               spl-u-boot-spl: add: 3/-41, grow: 5/-2 bytes: 1310/-3100 (-1790)
                 function                                   old     new   delta
                 spi_xfer                                     6     800    +794
                 spi_claim_bus                                6     248    +242
                 spi_setup_slave                              -     156    +156
                 spi_do_alloc_slave                           -      48     +48
                 spi_flash_probe                             26      72     +46
                 spl_spi_load_image                         124     140     +16
                 spi_release_bus                              6      12      +6
                 spi_free_slave                               -       2      +2
                 spi_flash_std_remove                         4       -      -4
                 spi_flash_post_bind                          4       -      -4
                 omap4_pdata                                  4       -      -4
                 omap2_pdata                                  4       -      -4
                 dev_get_parent_priv                          6       -      -6
                 spi_flash_cmd_get_sw_write_prot              8       -      -8
                 spi_flash_std_get_sw_write_prot             14       -     -14
                 spi_flash_read_dm                           14       -     -14
                 dm_spi_release_bus                          14       -     -14
                 ofnode_read_bool                            16       -     -16
                 fdtdec_get_bool                             20       -     -20
                 omap3_spi_release_bus                       22       -     -22
                 spi_mem_adjust_op_size                      92      68     -24
                 spi_child_post_bind                         30       -     -30
                 spi_post_probe                              32       -     -32
                 spi_flash_std_write                         34       -     -34
                 spi_flash_std_read                          34       -     -34
                 spi_child_pre_probe                         34       -     -34
                 dm_spi_xfer                                 34       -     -34
                 spi_mem_supports_op                         36       -     -36
                 spi_flash_probe_bus_cs                      48       -     -48
                 spi_find_chip_select                        50       -     -50
                 omap3_spi_claim_bus                         54       -     -54
                 static.spi_check_buswidth_req               56       -     -56
                 omap3_spi_set_wordlen                       62       -     -62
                 spi_mem_exec_op                            284     220     -64
                 _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
                 _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
                 _u_boot_list_2_driver_2_omap3_spi           68       -     -68
                 spi_set_speed_mode                          72       -     -72
                 spi_flash_std_probe                         76       -     -76
                 omap3_spi_set_speed                         76       -     -76
                 _u_boot_list_2_uclass_2_spi_nor             76       -     -76
                 _u_boot_list_2_uclass_2_spi_generic         76       -     -76
                 _u_boot_list_2_uclass_2_spi                 76       -     -76
                 spi_flash_std_erase                         84       -     -84
                 spi_mem_default_supports_op                 86       -     -86
                 omap3_spi_set_mode                          96       -     -96
                 dm_spi_claim_bus                           100       -    -100
                 omap3_spi_probe                            116       -    -116
                 spi_slave_ofdata_to_platdata               212       -    -212
                 spi_get_bus_and_cs                         232       -    -232
                 omap3_spi_xfer                             796       -    -796
            stm32mp15_basic: spl/u-boot-spl:all -2312 spl/u-boot-spl:bss -772 spl/u-boot-spl:rodata -292 spl/u-boot-spl:text -1248
               spl-u-boot-spl: add: 0/-19, grow: 0/-2 bytes: 0/-2013 (-2013)
                 function                                   old     new   delta
                 sf_mtd_registered                            1       -      -1
                 spi_flash_mtd_sync                           2       -      -2
                 spi_flash_std_remove                        10       4      -6
                 spi_flash_erase_dm                           8       -      -8
                 sf_mtd_name                                  8       -      -8
                 spi_flash_std_probe                         88      76     -12
                 spi_flash_write_dm                          14       -     -14
                 idr_remove                                  20       -     -20
                 spi_flash_mtd_write                         38       -     -38
                 spi_flash_mtd_read                          38       -     -38
                 spi_flash_mtd_unregister                    52       -     -52
                 spi_flash_mtd_erase                         78       -     -78
                 mtd_unlock                                  80       -     -80
                 del_mtd_device                              80       -     -80
                 mtd_erase_callback                          88       -     -88
                 part_erase                                  96       -     -96
                 del_mtd_partitions                         136       -    -136
                 spi_flash_mtd_register                     172       -    -172
                 sf_mtd_info                                240       -    -240
                 add_mtd_device                             328       -    -328
                 mtd_idr                                    516       -    -516
Frieder Schrempf Sept. 9, 2019, 11:11 a.m. UTC | #2
Hi Lukasz,

On 05.09.19 20:09, Tom Rini wrote:
> On Thu, Sep 05, 2019 at 12:16:36AM +0200, Lukasz Majewski wrote:
>> This patch series introduces new SPL and TPL specific Kconfig entries for
>> DM_SPI* options. Such change allows using the spi driver in SPL/TPL or
>> U-Boot proper.
>>
>> First two patches - related to ls10{42}* NXP soc fix some issues with
>> defining the DM_SPI* defines in <board>.h file instead of Kconfig.
>>
>> This series doesn't introduce build breaks, but board maintainers are kindly
>> asked to check if their boards still boots.
>>
>> Buildman setup for binary size regression checking:
>>
>> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043 --output-dir=../BUILD/ --force-build -CveE
>> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043 --output-dir=../BUILD/ -Ssdel
> 
> So you did fix the ls1043 problems but ls1046 is still a problem.

I was trying to clean up this config mess some weeks ago. I stumbled 
over the same issues (size deltas below) when I tested with buildman and 
finally gave up on it. This was my testing branch for reference: [1].

Thanks for your work and I hope you/we can get this sorted out somehow...

Regards,
Frieder

[1]: https://github.com/fschrempf/u-boot/commits/non_dm_spi_flash_in_spl

> There's also changes in (add 'B' to the buildman flags above for this
> info):
>         x86: (for 26/26 boards) spl/u-boot-spl:all -31.6 spl/u-boot-spl:data -11.4 spl/u-boot-spl:rodata -6.3 spl/u-boot-spl:text -13.9
>              qemu-x86_64    : spl/u-boot-spl:all -821 spl/u-boot-spl:data -296 spl/u-boot-spl:rodata -164 spl/u-boot-spl:text -361
>                 spl-u-boot-spl: add: 0/-10, grow: 0/0 bytes: 0/-657 (-657)
>                   function                                   old     new   delta
>                   spi_flash_post_bind                          3       -      -3
>                   dev_get_parent_priv                         11       -     -11
>                   spi_post_probe                              35       -     -35
>                   spi_child_post_bind                         37       -     -37
>                   spi_child_pre_probe                         46       -     -46
>                   _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
>                   _u_boot_list_2_uclass_2_spi_nor             76       -     -76
>                   _u_boot_list_2_uclass_2_spi_generic         76       -     -76
>                   _u_boot_list_2_uclass_2_spi                 76       -     -76
>                   spi_slave_ofdata_to_platdata               229       -    -229
>         arm: (for 688/688 boards) all -19.6 bss -4.5 rodata -2.2 spl/u-boot-spl:all -12.2 spl/u-boot-spl:bss -1.1 spl/u-boot-spl:data -1.9 spl/u-boot-spl:rodata -2.0 spl/u-boot-spl:text -7.2 text -12.9
>              uniphier_v7    : bss -8 rodata +8
>              opos6uldev     : bss -8 rodata +8
>              uniphier_ld4_sld8: bss -8 rodata +8
>              da850evm       : spl/u-boot-spl:all -614 spl/u-boot-spl:data -144 spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -320
>                 spl-u-boot-spl: add: 2/-15, grow: 2/0 bytes: 112/-574 (-462)
>                   function                                   old     new   delta
>                   spi_flash_probe                             38      82     +44
>                   spi_setup_slave                              -      42     +42
>                   spl_spi_load_image                         124     144     +20
>                   spi_free_slave                               -       6      +6
>                   spi_flash_std_remove                         4       -      -4
>                   spi_flash_post_bind                          4       -      -4
>                   spi_flash_cmd_get_sw_write_prot              8       -      -8
>                   ____aeabi_uidivmod_from_thumb                8       -      -8
>                   spi_flash_std_get_sw_write_prot             18       -     -18
>                   spi_flash_read_dm                           20       -     -20
>                   __aeabi_uidivmod                            24       -     -24
>                   __aeabi_idivmod                             24       -     -24
>                   spi_flash_std_write                         42       -     -42
>                   spi_flash_std_read                          42       -     -42
>                   spi_flash_probe_bus_cs                      56       -     -56
>                   _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
>                   _u_boot_list_2_uclass_2_spi_nor             76       -     -76
>                   spi_flash_std_probe                         88       -     -88
>                   spi_flash_std_erase                         92       -     -92
>              da850evm_nand  : spl/u-boot-spl:all -614 spl/u-boot-spl:data -144 spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -320
>                 spl-u-boot-spl: add: 2/-15, grow: 2/0 bytes: 112/-574 (-462)
>                   function                                   old     new   delta
>                   spi_flash_probe                             38      82     +44
>                   spi_setup_slave                              -      42     +42
>                   spl_spi_load_image                         124     144     +20
>                   spi_free_slave                               -       6      +6
>                   spi_flash_std_remove                         4       -      -4
>                   spi_flash_post_bind                          4       -      -4
>                   spi_flash_cmd_get_sw_write_prot              8       -      -8
>                   ____aeabi_uidivmod_from_thumb                8       -      -8
>                   spi_flash_std_get_sw_write_prot             18       -     -18
>                   spi_flash_read_dm                           20       -     -20
>                   __aeabi_uidivmod                            24       -     -24
>                   __aeabi_idivmod                             24       -     -24
>                   spi_flash_std_write                         42       -     -42
>                   spi_flash_std_read                          42       -     -42
>                   spi_flash_probe_bus_cs                      56       -     -56
>                   _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
>                   _u_boot_list_2_uclass_2_spi_nor             76       -     -76
>                   spi_flash_std_probe                         88       -     -88
>                   spi_flash_std_erase                         92       -     -92
>              sama5d3xek_spiflash: spl/u-boot-spl:all -630 spl/u-boot-spl:data -144 spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -336
>                 spl-u-boot-spl: add: 2/-12, grow: 2/0 bytes: 196/-676 (-480)
>                   function                                   old     new   delta
>                   spi_flash_probe                             44     120     +76
>                   spi_setup_slave                              -      60     +60
>                   spl_spi_load_image                         172     220     +48
>                   spi_free_slave                               -      12     +12
>                   spi_flash_std_remove                         8       -      -8
>                   spi_flash_post_bind                          8       -      -8
>                   spi_flash_cmd_get_sw_write_prot             12       -     -12
>                   spi_flash_std_get_sw_write_prot             16       -     -16
>                   spi_flash_read_dm                           28       -     -28
>                   spi_flash_std_write                         64       -     -64
>                   spi_flash_std_read                          64       -     -64
>                   _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
>                   spi_flash_probe_bus_cs                      76       -     -76
>                   _u_boot_list_2_uclass_2_spi_nor             76       -     -76
>                   spi_flash_std_probe                        116       -    -116
>                   spi_flash_std_erase                        140       -    -140
>              socfpga_cyclone5: all -722 bss -136 rodata -98 text -488
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_std_remove                        10       4      -6
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_std_probe                         88      76     -12
>                   spi_flash_mtd_write                         38       -     -38
>                   spi_flash_mtd_read                          38       -     -38
>                   spi_flash_mtd_unregister                    52       -     -52
>                   spi_flash_mtd_erase                         78       -     -78
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>              socfpga_socrates: all -794 bss -208 rodata -98 text -488
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_std_remove                        10       4      -6
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_std_probe                         88      76     -12
>                   spi_flash_mtd_write                         38       -     -38
>                   spi_flash_mtd_read                          38       -     -38
>                   spi_flash_mtd_unregister                    52       -     -52
>                   spi_flash_mtd_erase                         78       -     -78
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>              socfpga_sockit : all -794 bss -208 rodata -98 text -488
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_std_remove                        10       4      -6
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_std_probe                         88      76     -12
>                   spi_flash_mtd_write                         38       -     -38
>                   spi_flash_mtd_read                          38       -     -38
>                   spi_flash_mtd_unregister                    52       -     -52
>                   spi_flash_mtd_erase                         78       -     -78
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>              socfpga_arria5 : all -794 bss -208 rodata -98 text -488
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_std_remove                        10       4      -6
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_std_probe                         88      76     -12
>                   spi_flash_mtd_write                         38       -     -38
>                   spi_flash_mtd_read                          38       -     -38
>                   spi_flash_mtd_unregister                    52       -     -52
>                   spi_flash_mtd_erase                         78       -     -78
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>              socfpga_is1    : all -794 bss -208 rodata -98 text -488
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_std_remove                        10       4      -6
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_std_probe                         88      76     -12
>                   spi_flash_mtd_write                         38       -     -38
>                   spi_flash_mtd_read                          38       -     -38
>                   spi_flash_mtd_unregister                    52       -     -52
>                   spi_flash_mtd_erase                         78       -     -78
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>              socfpga_vining_fpga: all -858 bss -272 rodata -98 text -488
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_std_remove                        10       4      -6
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_std_probe                         88      76     -12
>                   spi_flash_mtd_write                         38       -     -38
>                   spi_flash_mtd_read                          38       -     -38
>                   spi_flash_mtd_unregister                    52       -     -52
>                   spi_flash_mtd_erase                         78       -     -78
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>              socfpga_sr1500 : all -858 bss -280 rodata -98 text -480
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_std_remove                        10       4      -6
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_std_probe                         88      76     -12
>                   spi_flash_mtd_write                         38       -     -38
>                   spi_flash_mtd_read                          38       -     -38
>                   spi_flash_mtd_unregister                    52       -     -52
>                   spi_flash_mtd_erase                         78       -     -78
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>              cm_fx6         : all -1130 bss -296 rodata -146 text -688
>                 u-boot: add: 0/-11, grow: 0/-2 bytes: 0/-829 (-829)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_free                              26      22      -4
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_probe                             88      78     -10
>                   idr_remove                                  20       -     -20
>                   spi_flash_mtd_write                         44       -     -44
>                   spi_flash_mtd_read                          44       -     -44
>                   spi_flash_mtd_unregister                    52       -     -52
>                   del_mtd_device                              68       -     -68
>                   spi_flash_mtd_erase                        164       -    -164
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>              aristainetos   : all -1186 bss -264 rodata -98 text -824
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           4       -      -4
>                   spi_flash_free                              32      28      -4
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_probe                            136     120     -16
>                   spi_flash_mtd_write                         80       -     -80
>                   spi_flash_mtd_read                          80       -     -80
>                   spi_flash_mtd_unregister                    84       -     -84
>                   spi_flash_mtd_erase                        220       -    -220
>                   sf_mtd_info                                240       -    -240
>                   spi_flash_mtd_register                     244       -    -244
>              aristainetos2  : all -1186 bss -264 rodata -98 text -824
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           4       -      -4
>                   spi_flash_free                              32      28      -4
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_probe                            136     120     -16
>                   spi_flash_mtd_write                         80       -     -80
>                   spi_flash_mtd_read                          80       -     -80
>                   spi_flash_mtd_unregister                    84       -     -84
>                   spi_flash_mtd_erase                        220       -    -220
>                   sf_mtd_info                                240       -    -240
>                   spi_flash_mtd_register                     244       -    -244
>              aristainetos2b : all -1186 bss -264 rodata -98 text -824
>                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           4       -      -4
>                   spi_flash_free                              32      28      -4
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_probe                            136     120     -16
>                   spi_flash_mtd_write                         80       -     -80
>                   spi_flash_mtd_read                          80       -     -80
>                   spi_flash_mtd_unregister                    84       -     -84
>                   spi_flash_mtd_erase                        220       -    -220
>                   sf_mtd_info                                240       -    -240
>                   spi_flash_mtd_register                     244       -    -244
>              display5_factory: all -1561 bss -216 rodata -201 text -1144
>                 u-boot: add: 0/-13, grow: 0/-2 bytes: 0/-1237 (-1237)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_free                              26      22      -4
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_probe                             88      78     -10
>                   idr_remove                                  20       -     -20
>                   spi_flash_mtd_write                         44       -     -44
>                   spi_flash_mtd_read                          44       -     -44
>                   spi_flash_mtd_unregister                    52       -     -52
>                   del_mtd_device                              68       -     -68
>                   mtd_unlock                                  80       -     -80
>                   spi_flash_mtd_erase                        164       -    -164
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>                   add_mtd_device                             328       -    -328
>              display5       : all -1605 bss -248 rodata -201 text -1156
>                 u-boot: add: 0/-13, grow: 0/-2 bytes: 0/-1237 (-1237)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_free                              26      22      -4
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_probe                             88      78     -10
>                   idr_remove                                  20       -     -20
>                   spi_flash_mtd_write                         44       -     -44
>                   spi_flash_mtd_read                          44       -     -44
>                   spi_flash_mtd_unregister                    52       -     -52
>                   del_mtd_device                              68       -     -68
>                   mtd_unlock                                  80       -     -80
>                   spi_flash_mtd_erase                        164       -    -164
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>                   add_mtd_device                             328       -    -328
>              brppt1_spi     : spl/u-boot-spl:all -2109 spl/u-boot-spl:bss -4 spl/u-boot-spl:data -436 spl/u-boot-spl:rodata -309 spl/u-boot-spl:text -1360
>                 spl-u-boot-spl: add: 3/-41, grow: 5/-2 bytes: 1310/-3100 (-1790)
>                   function                                   old     new   delta
>                   spi_xfer                                     6     800    +794
>                   spi_claim_bus                                6     248    +242
>                   spi_setup_slave                              -     156    +156
>                   spi_do_alloc_slave                           -      48     +48
>                   spi_flash_probe                             26      72     +46
>                   spl_spi_load_image                         124     140     +16
>                   spi_release_bus                              6      12      +6
>                   spi_free_slave                               -       2      +2
>                   spi_flash_std_remove                         4       -      -4
>                   spi_flash_post_bind                          4       -      -4
>                   omap4_pdata                                  4       -      -4
>                   omap2_pdata                                  4       -      -4
>                   dev_get_parent_priv                          6       -      -6
>                   spi_flash_cmd_get_sw_write_prot              8       -      -8
>                   spi_flash_std_get_sw_write_prot             14       -     -14
>                   spi_flash_read_dm                           14       -     -14
>                   dm_spi_release_bus                          14       -     -14
>                   ofnode_read_bool                            16       -     -16
>                   fdtdec_get_bool                             20       -     -20
>                   omap3_spi_release_bus                       22       -     -22
>                   spi_mem_adjust_op_size                      92      68     -24
>                   spi_child_post_bind                         30       -     -30
>                   spi_post_probe                              32       -     -32
>                   spi_flash_std_write                         34       -     -34
>                   spi_flash_std_read                          34       -     -34
>                   spi_child_pre_probe                         34       -     -34
>                   dm_spi_xfer                                 34       -     -34
>                   spi_mem_supports_op                         36       -     -36
>                   spi_flash_probe_bus_cs                      48       -     -48
>                   spi_find_chip_select                        50       -     -50
>                   omap3_spi_claim_bus                         54       -     -54
>                   static.spi_check_buswidth_req               56       -     -56
>                   omap3_spi_set_wordlen                       62       -     -62
>                   spi_mem_exec_op                            284     220     -64
>                   _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
>                   _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
>                   _u_boot_list_2_driver_2_omap3_spi           68       -     -68
>                   spi_set_speed_mode                          72       -     -72
>                   spi_flash_std_probe                         76       -     -76
>                   omap3_spi_set_speed                         76       -     -76
>                   _u_boot_list_2_uclass_2_spi_nor             76       -     -76
>                   _u_boot_list_2_uclass_2_spi_generic         76       -     -76
>                   _u_boot_list_2_uclass_2_spi                 76       -     -76
>                   spi_flash_std_erase                         84       -     -84
>                   spi_mem_default_supports_op                 86       -     -86
>                   omap3_spi_set_mode                          96       -     -96
>                   dm_spi_claim_bus                           100       -    -100
>                   omap3_spi_probe                            116       -    -116
>                   spi_slave_ofdata_to_platdata               212       -    -212
>                   spi_get_bus_and_cs                         232       -    -232
>                   omap3_spi_xfer                             796       -    -796
>              brsmarc1       : spl/u-boot-spl:all -2113 spl/u-boot-spl:bss -4 spl/u-boot-spl:data -436 spl/u-boot-spl:rodata -309 spl/u-boot-spl:text -1364
>                 spl-u-boot-spl: add: 3/-41, grow: 5/-2 bytes: 1310/-3100 (-1790)
>                   function                                   old     new   delta
>                   spi_xfer                                     6     800    +794
>                   spi_claim_bus                                6     248    +242
>                   spi_setup_slave                              -     156    +156
>                   spi_do_alloc_slave                           -      48     +48
>                   spi_flash_probe                             26      72     +46
>                   spl_spi_load_image                         124     140     +16
>                   spi_release_bus                              6      12      +6
>                   spi_free_slave                               -       2      +2
>                   spi_flash_std_remove                         4       -      -4
>                   spi_flash_post_bind                          4       -      -4
>                   omap4_pdata                                  4       -      -4
>                   omap2_pdata                                  4       -      -4
>                   dev_get_parent_priv                          6       -      -6
>                   spi_flash_cmd_get_sw_write_prot              8       -      -8
>                   spi_flash_std_get_sw_write_prot             14       -     -14
>                   spi_flash_read_dm                           14       -     -14
>                   dm_spi_release_bus                          14       -     -14
>                   ofnode_read_bool                            16       -     -16
>                   fdtdec_get_bool                             20       -     -20
>                   omap3_spi_release_bus                       22       -     -22
>                   spi_mem_adjust_op_size                      92      68     -24
>                   spi_child_post_bind                         30       -     -30
>                   spi_post_probe                              32       -     -32
>                   spi_flash_std_write                         34       -     -34
>                   spi_flash_std_read                          34       -     -34
>                   spi_child_pre_probe                         34       -     -34
>                   dm_spi_xfer                                 34       -     -34
>                   spi_mem_supports_op                         36       -     -36
>                   spi_flash_probe_bus_cs                      48       -     -48
>                   spi_find_chip_select                        50       -     -50
>                   omap3_spi_claim_bus                         54       -     -54
>                   static.spi_check_buswidth_req               56       -     -56
>                   omap3_spi_set_wordlen                       62       -     -62
>                   spi_mem_exec_op                            284     220     -64
>                   _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
>                   _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
>                   _u_boot_list_2_driver_2_omap3_spi           68       -     -68
>                   spi_set_speed_mode                          72       -     -72
>                   spi_flash_std_probe                         76       -     -76
>                   omap3_spi_set_speed                         76       -     -76
>                   _u_boot_list_2_uclass_2_spi_nor             76       -     -76
>                   _u_boot_list_2_uclass_2_spi_generic         76       -     -76
>                   _u_boot_list_2_uclass_2_spi                 76       -     -76
>                   spi_flash_std_erase                         84       -     -84
>                   spi_mem_default_supports_op                 86       -     -86
>                   omap3_spi_set_mode                          96       -     -96
>                   dm_spi_claim_bus                           100       -    -100
>                   omap3_spi_probe                            116       -    -116
>                   spi_slave_ofdata_to_platdata               212       -    -212
>                   spi_get_bus_and_cs                         232       -    -232
>                   omap3_spi_xfer                             796       -    -796
>              stm32mp15_basic: spl/u-boot-spl:all -2312 spl/u-boot-spl:bss -772 spl/u-boot-spl:rodata -292 spl/u-boot-spl:text -1248
>                 spl-u-boot-spl: add: 0/-19, grow: 0/-2 bytes: 0/-2013 (-2013)
>                   function                                   old     new   delta
>                   sf_mtd_registered                            1       -      -1
>                   spi_flash_mtd_sync                           2       -      -2
>                   spi_flash_std_remove                        10       4      -6
>                   spi_flash_erase_dm                           8       -      -8
>                   sf_mtd_name                                  8       -      -8
>                   spi_flash_std_probe                         88      76     -12
>                   spi_flash_write_dm                          14       -     -14
>                   idr_remove                                  20       -     -20
>                   spi_flash_mtd_write                         38       -     -38
>                   spi_flash_mtd_read                          38       -     -38
>                   spi_flash_mtd_unregister                    52       -     -52
>                   spi_flash_mtd_erase                         78       -     -78
>                   mtd_unlock                                  80       -     -80
>                   del_mtd_device                              80       -     -80
>                   mtd_erase_callback                          88       -     -88
>                   part_erase                                  96       -     -96
>                   del_mtd_partitions                         136       -    -136
>                   spi_flash_mtd_register                     172       -    -172
>                   sf_mtd_info                                240       -    -240
>                   add_mtd_device                             328       -    -328
>                   mtd_idr                                    516       -    -516
> 
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
Lukasz Majewski Sept. 9, 2019, noon UTC | #3
On Mon, 9 Sep 2019 11:11:50 +0000
Schrempf Frieder <frieder.schrempf@kontron.de> wrote:

> Hi Lukasz,
> 
> On 05.09.19 20:09, Tom Rini wrote:
> > On Thu, Sep 05, 2019 at 12:16:36AM +0200, Lukasz Majewski wrote:  
> >> This patch series introduces new SPL and TPL specific Kconfig
> >> entries for DM_SPI* options. Such change allows using the spi
> >> driver in SPL/TPL or U-Boot proper.
> >>
> >> First two patches - related to ls10{42}* NXP soc fix some issues
> >> with defining the DM_SPI* defines in <board>.h file instead of
> >> Kconfig.
> >>
> >> This series doesn't introduce build breaks, but board maintainers
> >> are kindly asked to check if their boards still boots.
> >>
> >> Buildman setup for binary size regression checking:
> >>
> >> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
> >> --output-dir=../BUILD/ --force-build -CveE
> >> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
> >> --output-dir=../BUILD/ -Ssdel  
> > 
> > So you did fix the ls1043 problems but ls1046 is still a problem.  
> 
> I was trying to clean up this config mess some weeks ago. I stumbled 
> over the same issues (size deltas below) when I tested with buildman
> and finally gave up on it. This was my testing branch for reference:
> [1].
> 
> Thanks for your work and I hope you/we can get this sorted out
> somehow...

For now I've only posted the patch to introduce SPL_DM_SPI in Kconig:
https://patchwork.ozlabs.org/patch/1159655/

> 
> Regards,
> Frieder
> 
> [1]:
> https://github.com/fschrempf/u-boot/commits/non_dm_spi_flash_in_spl
> 
> > There's also changes in (add 'B' to the buildman flags above for
> > this info):
> >         x86: (for 26/26 boards) spl/u-boot-spl:all -31.6
> > spl/u-boot-spl:data -11.4 spl/u-boot-spl:rodata -6.3
> > spl/u-boot-spl:text -13.9 qemu-x86_64    : spl/u-boot-spl:all -821
> > spl/u-boot-spl:data -296 spl/u-boot-spl:rodata -164
> > spl/u-boot-spl:text -361 spl-u-boot-spl: add: 0/-10, grow: 0/0
> > bytes: 0/-657 (-657) function                                   old
> >     new   delta spi_flash_post_bind                          3
> >  -      -3 dev_get_parent_priv                         11       -
> >   -11 spi_post_probe                              35       -
> > -35 spi_child_post_bind                         37       -     -37
> > spi_child_pre_probe                         46       -     -46
> > _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
> > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > _u_boot_list_2_uclass_2_spi_generic         76       -     -76
> > _u_boot_list_2_uclass_2_spi                 76       -     -76
> > spi_slave_ofdata_to_platdata               229       -    -229 arm:
> > (for 688/688 boards) all -19.6 bss -4.5 rodata -2.2
> > spl/u-boot-spl:all -12.2 spl/u-boot-spl:bss -1.1
> > spl/u-boot-spl:data -1.9 spl/u-boot-spl:rodata -2.0
> > spl/u-boot-spl:text -7.2 text -12.9 uniphier_v7    : bss -8 rodata
> > +8 opos6uldev     : bss -8 rodata +8 uniphier_ld4_sld8: bss -8
> > rodata +8 da850evm       : spl/u-boot-spl:all -614
> > spl/u-boot-spl:data -144 spl/u-boot-spl:rodata -150
> > spl/u-boot-spl:text -320 spl-u-boot-spl: add: 2/-15, grow: 2/0
> > bytes: 112/-574 (-462) function
> > old     new   delta spi_flash_probe                             38
> >     82     +44 spi_setup_slave                              -
> > 42     +42 spl_spi_load_image                         124     144
> >   +20 spi_free_slave                               -       6
> > +6 spi_flash_std_remove                         4       -      -4
> > spi_flash_post_bind                          4       -      -4
> > spi_flash_cmd_get_sw_write_prot              8       -      -8
> > ____aeabi_uidivmod_from_thumb                8       -      -8
> > spi_flash_std_get_sw_write_prot             18       -     -18
> > spi_flash_read_dm                           20       -     -20
> > __aeabi_uidivmod                            24       -     -24
> > __aeabi_idivmod                             24       -     -24
> > spi_flash_std_write                         42       -     -42
> > spi_flash_std_read                          42       -     -42
> > spi_flash_probe_bus_cs                      56       -     -56
> > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > spi_flash_std_probe                         88       -     -88
> > spi_flash_std_erase                         92       -     -92
> > da850evm_nand  : spl/u-boot-spl:all -614 spl/u-boot-spl:data -144
> > spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -320 spl-u-boot-spl:
> > add: 2/-15, grow: 2/0 bytes: 112/-574 (-462) function
> >                     old     new   delta spi_flash_probe
> >                 38      82     +44 spi_setup_slave
> >             -      42     +42 spl_spi_load_image
> >      124     144     +20 spi_free_slave
> >   -       6      +6 spi_flash_std_remove                         4
> >      -      -4 spi_flash_post_bind                          4
> > -      -4 spi_flash_cmd_get_sw_write_prot              8       -
> >   -8 ____aeabi_uidivmod_from_thumb                8       -      -8
> > spi_flash_std_get_sw_write_prot             18       -     -18
> > spi_flash_read_dm                           20       -     -20
> > __aeabi_uidivmod                            24       -     -24
> > __aeabi_idivmod                             24       -     -24
> > spi_flash_std_write                         42       -     -42
> > spi_flash_std_read                          42       -     -42
> > spi_flash_probe_bus_cs                      56       -     -56
> > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > spi_flash_std_probe                         88       -     -88
> > spi_flash_std_erase                         92       -     -92
> > sama5d3xek_spiflash: spl/u-boot-spl:all -630 spl/u-boot-spl:data
> > -144 spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -336
> > spl-u-boot-spl: add: 2/-12, grow: 2/0 bytes: 196/-676 (-480)
> > function                                   old     new   delta
> > spi_flash_probe                             44     120     +76
> > spi_setup_slave                              -      60     +60
> > spl_spi_load_image                         172     220     +48
> > spi_free_slave                               -      12     +12
> > spi_flash_std_remove                         8       -      -8
> > spi_flash_post_bind                          8       -      -8
> > spi_flash_cmd_get_sw_write_prot             12       -     -12
> > spi_flash_std_get_sw_write_prot             16       -     -16
> > spi_flash_read_dm                           28       -     -28
> > spi_flash_std_write                         64       -     -64
> > spi_flash_std_read                          64       -     -64
> > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > spi_flash_probe_bus_cs                      76       -     -76
> > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > spi_flash_std_probe                        116       -    -116
> > spi_flash_std_erase                        140       -    -140
> > socfpga_cyclone5: all -722 bss -136 rodata -98 text -488 u-boot:
> > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> >                   old     new   delta sf_mtd_registered
> >                1       -      -1 spi_flash_mtd_sync
> >           2       -      -2 spi_flash_std_remove
> >     10       4      -6 sf_mtd_name
> > 8       -      -8 spi_flash_std_probe                         88
> >   76     -12 spi_flash_mtd_write                         38       -
> >     -38 spi_flash_mtd_read                          38       -
> > -38 spi_flash_mtd_unregister                    52       -     -52
> > spi_flash_mtd_erase                         78       -     -78
> > spi_flash_mtd_register                     172       -    -172
> > sf_mtd_info                                240       -    -240
> > socfpga_socrates: all -794 bss -208 rodata -98 text -488 u-boot:
> > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> >                   old     new   delta sf_mtd_registered
> >                1       -      -1 spi_flash_mtd_sync
> >           2       -      -2 spi_flash_std_remove
> >     10       4      -6 sf_mtd_name
> > 8       -      -8 spi_flash_std_probe                         88
> >   76     -12 spi_flash_mtd_write                         38       -
> >     -38 spi_flash_mtd_read                          38       -
> > -38 spi_flash_mtd_unregister                    52       -     -52
> > spi_flash_mtd_erase                         78       -     -78
> > spi_flash_mtd_register                     172       -    -172
> > sf_mtd_info                                240       -    -240
> > socfpga_sockit : all -794 bss -208 rodata -98 text -488 u-boot:
> > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> >                   old     new   delta sf_mtd_registered
> >                1       -      -1 spi_flash_mtd_sync
> >           2       -      -2 spi_flash_std_remove
> >     10       4      -6 sf_mtd_name
> > 8       -      -8 spi_flash_std_probe                         88
> >   76     -12 spi_flash_mtd_write                         38       -
> >     -38 spi_flash_mtd_read                          38       -
> > -38 spi_flash_mtd_unregister                    52       -     -52
> > spi_flash_mtd_erase                         78       -     -78
> > spi_flash_mtd_register                     172       -    -172
> > sf_mtd_info                                240       -    -240
> > socfpga_arria5 : all -794 bss -208 rodata -98 text -488 u-boot:
> > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> >                   old     new   delta sf_mtd_registered
> >                1       -      -1 spi_flash_mtd_sync
> >           2       -      -2 spi_flash_std_remove
> >     10       4      -6 sf_mtd_name
> > 8       -      -8 spi_flash_std_probe                         88
> >   76     -12 spi_flash_mtd_write                         38       -
> >     -38 spi_flash_mtd_read                          38       -
> > -38 spi_flash_mtd_unregister                    52       -     -52
> > spi_flash_mtd_erase                         78       -     -78
> > spi_flash_mtd_register                     172       -    -172
> > sf_mtd_info                                240       -    -240
> > socfpga_is1    : all -794 bss -208 rodata -98 text -488 u-boot:
> > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> >                   old     new   delta sf_mtd_registered
> >                1       -      -1 spi_flash_mtd_sync
> >           2       -      -2 spi_flash_std_remove
> >     10       4      -6 sf_mtd_name
> > 8       -      -8 spi_flash_std_probe                         88
> >   76     -12 spi_flash_mtd_write                         38       -
> >     -38 spi_flash_mtd_read                          38       -
> > -38 spi_flash_mtd_unregister                    52       -     -52
> >                   spi_flash_mtd_erase                         78
> >    -     -78 spi_flash_mtd_register                     172       -
> >    -172 sf_mtd_info                                240       -
> > -240 socfpga_vining_fpga: all -858 bss -272 rodata -98 text -488
> >                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
> >                   function                                   old
> >  new   delta sf_mtd_registered                            1       -
> >      -1 spi_flash_mtd_sync                           2       -
> > -2 spi_flash_std_remove                        10       4      -6
> >                   sf_mtd_name                                  8
> >    -      -8 spi_flash_std_probe                         88      76
> >     -12 spi_flash_mtd_write                         38       -
> > -38 spi_flash_mtd_read                          38       -     -38
> >                   spi_flash_mtd_unregister                    52
> >    -     -52 spi_flash_mtd_erase                         78       -
> >     -78 spi_flash_mtd_register                     172       -
> > -172 sf_mtd_info                                240       -    -240
> >              socfpga_sr1500 : all -858 bss -280 rodata -98 text -480
> >                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
> >                   function                                   old
> >  new   delta sf_mtd_registered                            1       -
> >      -1 spi_flash_mtd_sync                           2       -
> > -2 spi_flash_std_remove                        10       4      -6
> >                   sf_mtd_name                                  8
> >    -      -8 spi_flash_std_probe                         88      76
> >     -12 spi_flash_mtd_write                         38       -
> > -38 spi_flash_mtd_read                          38       -     -38
> >                   spi_flash_mtd_unregister                    52
> >    -     -52 spi_flash_mtd_erase                         78       -
> >     -78 spi_flash_mtd_register                     172       -
> > -172 sf_mtd_info                                240       -    -240
> >              cm_fx6         : all -1130 bss -296 rodata -146 text
> > -688 u-boot: add: 0/-11, grow: 0/-2 bytes: 0/-829 (-829)
> >                   function                                   old
> >  new   delta sf_mtd_registered                            1       -
> >      -1 spi_flash_mtd_sync                           2       -
> > -2 spi_flash_free                              26      22      -4
> >                   sf_mtd_name                                  8
> >    -      -8 spi_flash_probe                             88      78
> >     -10 idr_remove                                  20       -
> > -20 spi_flash_mtd_write                         44       -     -44
> >                   spi_flash_mtd_read                          44
> >    -     -44 spi_flash_mtd_unregister                    52       -
> >     -52 del_mtd_device                              68       -
> > -68 spi_flash_mtd_erase                        164       -    -164
> >                   spi_flash_mtd_register                     172
> >    -    -172 sf_mtd_info                                240       -
> >    -240 aristainetos   : all -1186 bss -264 rodata -98 text -824
> >                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
> >                   function                                   old
> >  new   delta sf_mtd_registered                            1       -
> >      -1 spi_flash_mtd_sync                           4       -
> > -4 spi_flash_free                              32      28      -4
> >                   sf_mtd_name                                  8
> >    -      -8 spi_flash_probe                            136     120
> >     -16 spi_flash_mtd_write                         80       -
> > -80 spi_flash_mtd_read                          80       -     -80
> >                   spi_flash_mtd_unregister                    84
> >    -     -84 spi_flash_mtd_erase                        220       -
> >    -220 sf_mtd_info                                240       -
> > -240 spi_flash_mtd_register                     244       -    -244
> >              aristainetos2  : all -1186 bss -264 rodata -98 text
> > -824 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
> >                   function                                   old
> >  new   delta sf_mtd_registered                            1       -
> >      -1 spi_flash_mtd_sync                           4       -
> > -4 spi_flash_free                              32      28      -4
> >                   sf_mtd_name                                  8
> >    -      -8 spi_flash_probe                            136     120
> >     -16 spi_flash_mtd_write                         80       -
> > -80 spi_flash_mtd_read                          80       -     -80
> >                   spi_flash_mtd_unregister                    84
> >    -     -84 spi_flash_mtd_erase                        220       -
> >    -220 sf_mtd_info                                240       -
> > -240 spi_flash_mtd_register                     244       -    -244
> >              aristainetos2b : all -1186 bss -264 rodata -98 text
> > -824 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
> >                   function                                   old
> >  new   delta sf_mtd_registered                            1       -
> >      -1 spi_flash_mtd_sync                           4       -
> > -4 spi_flash_free                              32      28      -4
> >                   sf_mtd_name                                  8
> >    -      -8 spi_flash_probe                            136     120
> >     -16 spi_flash_mtd_write                         80       -
> > -80 spi_flash_mtd_read                          80       -     -80
> >                   spi_flash_mtd_unregister                    84
> >    -     -84 spi_flash_mtd_erase                        220       -
> >    -220 sf_mtd_info                                240       -
> > -240 spi_flash_mtd_register                     244       -    -244
> >              display5_factory: all -1561 bss -216 rodata -201 text
> > -1144 u-boot: add: 0/-13, grow: 0/-2 bytes: 0/-1237 (-1237)
> >                   function                                   old
> >  new   delta sf_mtd_registered                            1       -
> >      -1 spi_flash_mtd_sync                           2       -
> > -2 spi_flash_free                              26      22      -4
> >                   sf_mtd_name                                  8
> >    -      -8 spi_flash_probe                             88      78
> >     -10 idr_remove                                  20       -
> > -20 spi_flash_mtd_write                         44       -     -44
> >                   spi_flash_mtd_read                          44
> >    -     -44 spi_flash_mtd_unregister                    52       -
> >     -52 del_mtd_device                              68       -
> > -68 mtd_unlock                                  80       -     -80
> >                   spi_flash_mtd_erase                        164
> >    -    -164 spi_flash_mtd_register                     172       -
> >    -172 sf_mtd_info                                240       -
> > -240 add_mtd_device                             328       -    -328
> >              display5       : all -1605 bss -248 rodata -201 text
> > -1156 u-boot: add: 0/-13, grow: 0/-2 bytes: 0/-1237 (-1237)
> >                   function                                   old
> >  new   delta sf_mtd_registered                            1       -
> >      -1 spi_flash_mtd_sync                           2       -
> > -2 spi_flash_free                              26      22      -4
> >                   sf_mtd_name                                  8
> >    -      -8 spi_flash_probe                             88      78
> >     -10 idr_remove                                  20       -
> > -20 spi_flash_mtd_write                         44       -     -44
> >                   spi_flash_mtd_read                          44
> >    -     -44 spi_flash_mtd_unregister                    52       -
> >     -52 del_mtd_device                              68       -
> > -68 mtd_unlock                                  80       -     -80
> >                   spi_flash_mtd_erase                        164
> >    -    -164 spi_flash_mtd_register                     172       -
> >    -172 sf_mtd_info                                240       -
> > -240 add_mtd_device                             328       -    -328
> >              brppt1_spi     : spl/u-boot-spl:all -2109
> > spl/u-boot-spl:bss -4 spl/u-boot-spl:data -436
> > spl/u-boot-spl:rodata -309 spl/u-boot-spl:text -1360
> > spl-u-boot-spl: add: 3/-41, grow: 5/-2 bytes: 1310/-3100 (-1790)
> > function                                   old     new   delta
> > spi_xfer                                     6     800    +794
> > spi_claim_bus                                6     248    +242
> > spi_setup_slave                              -     156    +156
> > spi_do_alloc_slave                           -      48     +48
> > spi_flash_probe                             26      72     +46
> > spl_spi_load_image                         124     140     +16
> > spi_release_bus                              6      12      +6
> > spi_free_slave                               -       2      +2
> > spi_flash_std_remove                         4       -      -4
> > spi_flash_post_bind                          4       -      -4
> > omap4_pdata                                  4       -      -4
> > omap2_pdata                                  4       -      -4
> > dev_get_parent_priv                          6       -      -6
> > spi_flash_cmd_get_sw_write_prot              8       -      -8
> > spi_flash_std_get_sw_write_prot             14       -     -14
> > spi_flash_read_dm                           14       -     -14
> > dm_spi_release_bus                          14       -     -14
> > ofnode_read_bool                            16       -     -16
> > fdtdec_get_bool                             20       -     -20
> > omap3_spi_release_bus                       22       -     -22
> > spi_mem_adjust_op_size                      92      68     -24
> > spi_child_post_bind                         30       -     -30
> > spi_post_probe                              32       -     -32
> > spi_flash_std_write                         34       -     -34
> > spi_flash_std_read                          34       -     -34
> > spi_child_pre_probe                         34       -     -34
> > dm_spi_xfer                                 34       -     -34
> > spi_mem_supports_op                         36       -     -36
> > spi_flash_probe_bus_cs                      48       -     -48
> > spi_find_chip_select                        50       -     -50
> > omap3_spi_claim_bus                         54       -     -54
> > static.spi_check_buswidth_req               56       -     -56
> > omap3_spi_set_wordlen                       62       -     -62
> > spi_mem_exec_op                            284     220     -64
> > _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
> > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > _u_boot_list_2_driver_2_omap3_spi           68       -     -68
> > spi_set_speed_mode                          72       -     -72
> > spi_flash_std_probe                         76       -     -76
> > omap3_spi_set_speed                         76       -     -76
> > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > _u_boot_list_2_uclass_2_spi_generic         76       -     -76
> > _u_boot_list_2_uclass_2_spi                 76       -     -76
> > spi_flash_std_erase                         84       -     -84
> > spi_mem_default_supports_op                 86       -     -86
> > omap3_spi_set_mode                          96       -     -96
> > dm_spi_claim_bus                           100       -    -100
> > omap3_spi_probe                            116       -    -116
> > spi_slave_ofdata_to_platdata               212       -    -212
> > spi_get_bus_and_cs                         232       -    -232
> > omap3_spi_xfer                             796       -    -796
> > brsmarc1       : spl/u-boot-spl:all -2113 spl/u-boot-spl:bss -4
> > spl/u-boot-spl:data -436 spl/u-boot-spl:rodata -309
> > spl/u-boot-spl:text -1364 spl-u-boot-spl: add: 3/-41, grow: 5/-2
> > bytes: 1310/-3100 (-1790) function
> >  old     new   delta spi_xfer                                     6
> >     800    +794 spi_claim_bus                                6
> > 248    +242 spi_setup_slave                              -     156
> >   +156 spi_do_alloc_slave                           -      48
> > +48 spi_flash_probe                             26      72     +46
> > spl_spi_load_image                         124     140     +16
> > spi_release_bus                              6      12      +6
> > spi_free_slave                               -       2      +2
> > spi_flash_std_remove                         4       -      -4
> > spi_flash_post_bind                          4       -      -4
> > omap4_pdata                                  4       -      -4
> > omap2_pdata                                  4       -      -4
> > dev_get_parent_priv                          6       -      -6
> > spi_flash_cmd_get_sw_write_prot              8       -      -8
> > spi_flash_std_get_sw_write_prot             14       -     -14
> > spi_flash_read_dm                           14       -     -14
> > dm_spi_release_bus                          14       -     -14
> > ofnode_read_bool                            16       -     -16
> > fdtdec_get_bool                             20       -     -20
> > omap3_spi_release_bus                       22       -     -22
> > spi_mem_adjust_op_size                      92      68     -24
> > spi_child_post_bind                         30       -     -30
> > spi_post_probe                              32       -     -32
> > spi_flash_std_write                         34       -     -34
> > spi_flash_std_read                          34       -     -34
> > spi_child_pre_probe                         34       -     -34
> > dm_spi_xfer                                 34       -     -34
> > spi_mem_supports_op                         36       -     -36
> > spi_flash_probe_bus_cs                      48       -     -48
> > spi_find_chip_select                        50       -     -50
> > omap3_spi_claim_bus                         54       -     -54
> > static.spi_check_buswidth_req               56       -     -56
> > omap3_spi_set_wordlen                       62       -     -62
> > spi_mem_exec_op                            284     220     -64
> > _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
> > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > _u_boot_list_2_driver_2_omap3_spi           68       -     -68
> > spi_set_speed_mode                          72       -     -72
> > spi_flash_std_probe                         76       -     -76
> > omap3_spi_set_speed                         76       -     -76
> > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > _u_boot_list_2_uclass_2_spi_generic         76       -     -76
> > _u_boot_list_2_uclass_2_spi                 76       -     -76
> > spi_flash_std_erase                         84       -     -84
> > spi_mem_default_supports_op                 86       -     -86
> > omap3_spi_set_mode                          96       -     -96
> > dm_spi_claim_bus                           100       -    -100
> > omap3_spi_probe                            116       -    -116
> > spi_slave_ofdata_to_platdata               212       -    -212
> > spi_get_bus_and_cs                         232       -    -232
> > omap3_spi_xfer                             796       -    -796
> > stm32mp15_basic: spl/u-boot-spl:all -2312 spl/u-boot-spl:bss -772
> > spl/u-boot-spl:rodata -292 spl/u-boot-spl:text -1248
> > spl-u-boot-spl: add: 0/-19, grow: 0/-2 bytes: 0/-2013 (-2013)
> > function                                   old     new   delta
> > sf_mtd_registered                            1       -      -1
> > spi_flash_mtd_sync                           2       -      -2
> > spi_flash_std_remove                        10       4      -6
> > spi_flash_erase_dm                           8       -      -8
> > sf_mtd_name                                  8       -      -8
> > spi_flash_std_probe                         88      76     -12
> > spi_flash_write_dm                          14       -     -14
> > idr_remove                                  20       -     -20
> > spi_flash_mtd_write                         38       -     -38
> > spi_flash_mtd_read                          38       -     -38
> > spi_flash_mtd_unregister                    52       -     -52
> > spi_flash_mtd_erase                         78       -     -78
> > mtd_unlock                                  80       -     -80
> > del_mtd_device                              80       -     -80
> > mtd_erase_callback                          88       -     -88
> > part_erase                                  96       -     -96
> > del_mtd_partitions                         136       -    -136
> > spi_flash_mtd_register                     172       -    -172
> > sf_mtd_info                                240       -    -240
> > add_mtd_device                             328       -    -328
> > mtd_idr                                    516       -    -516
> > 
> > 
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
> >  



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Lukasz Majewski Sept. 10, 2019, 10:22 a.m. UTC | #4
Hi Frieder,

> On Mon, 9 Sep 2019 11:11:50 +0000
> Schrempf Frieder <frieder.schrempf@kontron.de> wrote:
> 
> > Hi Lukasz,
> > 
> > On 05.09.19 20:09, Tom Rini wrote:  
> > > On Thu, Sep 05, 2019 at 12:16:36AM +0200, Lukasz Majewski wrote:
> > >   
> > >> This patch series introduces new SPL and TPL specific Kconfig
> > >> entries for DM_SPI* options. Such change allows using the spi
> > >> driver in SPL/TPL or U-Boot proper.
> > >>
> > >> First two patches - related to ls10{42}* NXP soc fix some issues
> > >> with defining the DM_SPI* defines in <board>.h file instead of
> > >> Kconfig.
> > >>
> > >> This series doesn't introduce build breaks, but board maintainers
> > >> are kindly asked to check if their boards still boots.
> > >>
> > >> Buildman setup for binary size regression checking:
> > >>
> > >> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
> > >> --output-dir=../BUILD/ --force-build -CveE
> > >> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
> > >> --output-dir=../BUILD/ -Ssdel    
> > > 
> > > So you did fix the ls1043 problems but ls1046 is still a problem.
> > >    
> > 
> > I was trying to clean up this config mess some weeks ago. I
> > stumbled over the same issues (size deltas below) when I tested
> > with buildman and finally gave up on it. This was my testing branch
> > for reference: [1].
> > 
> > Thanks for your work and I hope you/we can get this sorted out
> > somehow...  
> 
> For now I've only posted the patch to introduce SPL_DM_SPI in Kconig:
> https://patchwork.ozlabs.org/patch/1159655/

However, I've looked on your patchset and IMHO this work could be
divided (as doing it at once is not feasible).

For example the CONFIG_SPI_FLASH_MTD could be converted to 
(SPL_TPL_)SPI_FLASH_MTD and then one could use

#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) in drivers/mtd/spi/sf_probe.c (as
it is only used there).

Then we could avoid situations where code is added as you remove it
here [1]:
https://github.com/fschrempf/u-boot/commit/b6489fb5928c2b41d7e4cb39933f078659b4f10e#diff-9d3e174d033b8b9c9d380a22a81600aaL136

What I'm afraid though, is that split of SPI_FLASH_MTD will require
adding unwillingly SPL_(TPL_)SPI_FLASH_MTD to all boards which already
define it (and only drop ones, which use in <config>.h file pattern as
[1]).


Frieder, would you be able to work on this topic any time soon?



> 
> > 
> > Regards,
> > Frieder
> > 
> > [1]:
> > https://github.com/fschrempf/u-boot/commits/non_dm_spi_flash_in_spl
> >   
> > > There's also changes in (add 'B' to the buildman flags above for
> > > this info):
> > >         x86: (for 26/26 boards) spl/u-boot-spl:all -31.6
> > > spl/u-boot-spl:data -11.4 spl/u-boot-spl:rodata -6.3
> > > spl/u-boot-spl:text -13.9 qemu-x86_64    : spl/u-boot-spl:all -821
> > > spl/u-boot-spl:data -296 spl/u-boot-spl:rodata -164
> > > spl/u-boot-spl:text -361 spl-u-boot-spl: add: 0/-10, grow: 0/0
> > > bytes: 0/-657 (-657) function
> > > old new   delta spi_flash_post_bind                          3
> > >  -      -3 dev_get_parent_priv                         11       -
> > >   -11 spi_post_probe                              35       -
> > > -35 spi_child_post_bind                         37       -     -37
> > > spi_child_pre_probe                         46       -     -46
> > > _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
> > > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > > _u_boot_list_2_uclass_2_spi_generic         76       -     -76
> > > _u_boot_list_2_uclass_2_spi                 76       -     -76
> > > spi_slave_ofdata_to_platdata               229       -    -229
> > > arm: (for 688/688 boards) all -19.6 bss -4.5 rodata -2.2
> > > spl/u-boot-spl:all -12.2 spl/u-boot-spl:bss -1.1
> > > spl/u-boot-spl:data -1.9 spl/u-boot-spl:rodata -2.0
> > > spl/u-boot-spl:text -7.2 text -12.9 uniphier_v7    : bss -8 rodata
> > > +8 opos6uldev     : bss -8 rodata +8 uniphier_ld4_sld8: bss -8
> > > rodata +8 da850evm       : spl/u-boot-spl:all -614
> > > spl/u-boot-spl:data -144 spl/u-boot-spl:rodata -150
> > > spl/u-boot-spl:text -320 spl-u-boot-spl: add: 2/-15, grow: 2/0
> > > bytes: 112/-574 (-462) function
> > > old     new   delta spi_flash_probe                             38
> > >     82     +44 spi_setup_slave                              -
> > > 42     +42 spl_spi_load_image                         124     144
> > >   +20 spi_free_slave                               -       6
> > > +6 spi_flash_std_remove                         4       -      -4
> > > spi_flash_post_bind                          4       -      -4
> > > spi_flash_cmd_get_sw_write_prot              8       -      -8
> > > ____aeabi_uidivmod_from_thumb                8       -      -8
> > > spi_flash_std_get_sw_write_prot             18       -     -18
> > > spi_flash_read_dm                           20       -     -20
> > > __aeabi_uidivmod                            24       -     -24
> > > __aeabi_idivmod                             24       -     -24
> > > spi_flash_std_write                         42       -     -42
> > > spi_flash_std_read                          42       -     -42
> > > spi_flash_probe_bus_cs                      56       -     -56
> > > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > > spi_flash_std_probe                         88       -     -88
> > > spi_flash_std_erase                         92       -     -92
> > > da850evm_nand  : spl/u-boot-spl:all -614 spl/u-boot-spl:data -144
> > > spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -320
> > > spl-u-boot-spl: add: 2/-15, grow: 2/0 bytes: 112/-574 (-462)
> > > function old     new   delta spi_flash_probe
> > >                 38      82     +44 spi_setup_slave
> > >             -      42     +42 spl_spi_load_image
> > >      124     144     +20 spi_free_slave
> > >   -       6      +6 spi_flash_std_remove                         4
> > >      -      -4 spi_flash_post_bind                          4
> > > -      -4 spi_flash_cmd_get_sw_write_prot              8       -
> > >   -8 ____aeabi_uidivmod_from_thumb                8       -
> > > -8 spi_flash_std_get_sw_write_prot             18       -     -18
> > > spi_flash_read_dm                           20       -     -20
> > > __aeabi_uidivmod                            24       -     -24
> > > __aeabi_idivmod                             24       -     -24
> > > spi_flash_std_write                         42       -     -42
> > > spi_flash_std_read                          42       -     -42
> > > spi_flash_probe_bus_cs                      56       -     -56
> > > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > > spi_flash_std_probe                         88       -     -88
> > > spi_flash_std_erase                         92       -     -92
> > > sama5d3xek_spiflash: spl/u-boot-spl:all -630 spl/u-boot-spl:data
> > > -144 spl/u-boot-spl:rodata -150 spl/u-boot-spl:text -336
> > > spl-u-boot-spl: add: 2/-12, grow: 2/0 bytes: 196/-676 (-480)
> > > function                                   old     new   delta
> > > spi_flash_probe                             44     120     +76
> > > spi_setup_slave                              -      60     +60
> > > spl_spi_load_image                         172     220     +48
> > > spi_free_slave                               -      12     +12
> > > spi_flash_std_remove                         8       -      -8
> > > spi_flash_post_bind                          8       -      -8
> > > spi_flash_cmd_get_sw_write_prot             12       -     -12
> > > spi_flash_std_get_sw_write_prot             16       -     -16
> > > spi_flash_read_dm                           28       -     -28
> > > spi_flash_std_write                         64       -     -64
> > > spi_flash_std_read                          64       -     -64
> > > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > > spi_flash_probe_bus_cs                      76       -     -76
> > > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > > spi_flash_std_probe                        116       -    -116
> > > spi_flash_std_erase                        140       -    -140
> > > socfpga_cyclone5: all -722 bss -136 rodata -98 text -488 u-boot:
> > > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> > >                   old     new   delta sf_mtd_registered
> > >                1       -      -1 spi_flash_mtd_sync
> > >           2       -      -2 spi_flash_std_remove
> > >     10       4      -6 sf_mtd_name
> > > 8       -      -8 spi_flash_std_probe                         88
> > >   76     -12 spi_flash_mtd_write                         38
> > > - -38 spi_flash_mtd_read                          38       -
> > > -38 spi_flash_mtd_unregister                    52       -     -52
> > > spi_flash_mtd_erase                         78       -     -78
> > > spi_flash_mtd_register                     172       -    -172
> > > sf_mtd_info                                240       -    -240
> > > socfpga_socrates: all -794 bss -208 rodata -98 text -488 u-boot:
> > > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> > >                   old     new   delta sf_mtd_registered
> > >                1       -      -1 spi_flash_mtd_sync
> > >           2       -      -2 spi_flash_std_remove
> > >     10       4      -6 sf_mtd_name
> > > 8       -      -8 spi_flash_std_probe                         88
> > >   76     -12 spi_flash_mtd_write                         38
> > > - -38 spi_flash_mtd_read                          38       -
> > > -38 spi_flash_mtd_unregister                    52       -     -52
> > > spi_flash_mtd_erase                         78       -     -78
> > > spi_flash_mtd_register                     172       -    -172
> > > sf_mtd_info                                240       -    -240
> > > socfpga_sockit : all -794 bss -208 rodata -98 text -488 u-boot:
> > > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> > >                   old     new   delta sf_mtd_registered
> > >                1       -      -1 spi_flash_mtd_sync
> > >           2       -      -2 spi_flash_std_remove
> > >     10       4      -6 sf_mtd_name
> > > 8       -      -8 spi_flash_std_probe                         88
> > >   76     -12 spi_flash_mtd_write                         38
> > > - -38 spi_flash_mtd_read                          38       -
> > > -38 spi_flash_mtd_unregister                    52       -     -52
> > > spi_flash_mtd_erase                         78       -     -78
> > > spi_flash_mtd_register                     172       -    -172
> > > sf_mtd_info                                240       -    -240
> > > socfpga_arria5 : all -794 bss -208 rodata -98 text -488 u-boot:
> > > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> > >                   old     new   delta sf_mtd_registered
> > >                1       -      -1 spi_flash_mtd_sync
> > >           2       -      -2 spi_flash_std_remove
> > >     10       4      -6 sf_mtd_name
> > > 8       -      -8 spi_flash_std_probe                         88
> > >   76     -12 spi_flash_mtd_write                         38
> > > - -38 spi_flash_mtd_read                          38       -
> > > -38 spi_flash_mtd_unregister                    52       -     -52
> > > spi_flash_mtd_erase                         78       -     -78
> > > spi_flash_mtd_register                     172       -    -172
> > > sf_mtd_info                                240       -    -240
> > > socfpga_is1    : all -794 bss -208 rodata -98 text -488 u-boot:
> > > add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647) function
> > >                   old     new   delta sf_mtd_registered
> > >                1       -      -1 spi_flash_mtd_sync
> > >           2       -      -2 spi_flash_std_remove
> > >     10       4      -6 sf_mtd_name
> > > 8       -      -8 spi_flash_std_probe                         88
> > >   76     -12 spi_flash_mtd_write                         38
> > > - -38 spi_flash_mtd_read                          38       -
> > > -38 spi_flash_mtd_unregister                    52       -     -52
> > >                   spi_flash_mtd_erase                         78
> > >    -     -78 spi_flash_mtd_register                     172
> > > - -172 sf_mtd_info                                240       -
> > > -240 socfpga_vining_fpga: all -858 bss -272 rodata -98 text -488
> > >                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
> > >                   function                                   old
> > >  new   delta sf_mtd_registered                            1
> > > - -1 spi_flash_mtd_sync                           2       -
> > > -2 spi_flash_std_remove                        10       4      -6
> > >                   sf_mtd_name                                  8
> > >    -      -8 spi_flash_std_probe                         88
> > > 76 -12 spi_flash_mtd_write                         38       -
> > > -38 spi_flash_mtd_read                          38       -     -38
> > >                   spi_flash_mtd_unregister                    52
> > >    -     -52 spi_flash_mtd_erase                         78
> > > - -78 spi_flash_mtd_register                     172       -
> > > -172 sf_mtd_info                                240       -
> > > -240 socfpga_sr1500 : all -858 bss -280 rodata -98 text -480
> > >                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-647 (-647)
> > >                   function                                   old
> > >  new   delta sf_mtd_registered                            1
> > > - -1 spi_flash_mtd_sync                           2       -
> > > -2 spi_flash_std_remove                        10       4      -6
> > >                   sf_mtd_name                                  8
> > >    -      -8 spi_flash_std_probe                         88
> > > 76 -12 spi_flash_mtd_write                         38       -
> > > -38 spi_flash_mtd_read                          38       -     -38
> > >                   spi_flash_mtd_unregister                    52
> > >    -     -52 spi_flash_mtd_erase                         78
> > > - -78 spi_flash_mtd_register                     172       -
> > > -172 sf_mtd_info                                240       -
> > > -240 cm_fx6         : all -1130 bss -296 rodata -146 text
> > > -688 u-boot: add: 0/-11, grow: 0/-2 bytes: 0/-829 (-829)
> > >                   function                                   old
> > >  new   delta sf_mtd_registered                            1
> > > - -1 spi_flash_mtd_sync                           2       -
> > > -2 spi_flash_free                              26      22      -4
> > >                   sf_mtd_name                                  8
> > >    -      -8 spi_flash_probe                             88
> > > 78 -10 idr_remove                                  20       -
> > > -20 spi_flash_mtd_write                         44       -     -44
> > >                   spi_flash_mtd_read                          44
> > >    -     -44 spi_flash_mtd_unregister                    52
> > > - -52 del_mtd_device                              68       -
> > > -68 spi_flash_mtd_erase                        164       -    -164
> > >                   spi_flash_mtd_register                     172
> > >    -    -172 sf_mtd_info                                240
> > > - -240 aristainetos   : all -1186 bss -264 rodata -98 text -824
> > >                 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
> > >                   function                                   old
> > >  new   delta sf_mtd_registered                            1
> > > - -1 spi_flash_mtd_sync                           4       -
> > > -4 spi_flash_free                              32      28      -4
> > >                   sf_mtd_name                                  8
> > >    -      -8 spi_flash_probe                            136
> > > 120 -16 spi_flash_mtd_write                         80       -
> > > -80 spi_flash_mtd_read                          80       -     -80
> > >                   spi_flash_mtd_unregister                    84
> > >    -     -84 spi_flash_mtd_erase                        220
> > > - -220 sf_mtd_info                                240       -
> > > -240 spi_flash_mtd_register                     244       -
> > > -244 aristainetos2  : all -1186 bss -264 rodata -98 text
> > > -824 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
> > >                   function                                   old
> > >  new   delta sf_mtd_registered                            1
> > > - -1 spi_flash_mtd_sync                           4       -
> > > -4 spi_flash_free                              32      28      -4
> > >                   sf_mtd_name                                  8
> > >    -      -8 spi_flash_probe                            136
> > > 120 -16 spi_flash_mtd_write                         80       -
> > > -80 spi_flash_mtd_read                          80       -     -80
> > >                   spi_flash_mtd_unregister                    84
> > >    -     -84 spi_flash_mtd_erase                        220
> > > - -220 sf_mtd_info                                240       -
> > > -240 spi_flash_mtd_register                     244       -
> > > -244 aristainetos2b : all -1186 bss -264 rodata -98 text
> > > -824 u-boot: add: 0/-9, grow: 0/-2 bytes: 0/-981 (-981)
> > >                   function                                   old
> > >  new   delta sf_mtd_registered                            1
> > > - -1 spi_flash_mtd_sync                           4       -
> > > -4 spi_flash_free                              32      28      -4
> > >                   sf_mtd_name                                  8
> > >    -      -8 spi_flash_probe                            136
> > > 120 -16 spi_flash_mtd_write                         80       -
> > > -80 spi_flash_mtd_read                          80       -     -80
> > >                   spi_flash_mtd_unregister                    84
> > >    -     -84 spi_flash_mtd_erase                        220
> > > - -220 sf_mtd_info                                240       -
> > > -240 spi_flash_mtd_register                     244       -
> > > -244 display5_factory: all -1561 bss -216 rodata -201 text
> > > -1144 u-boot: add: 0/-13, grow: 0/-2 bytes: 0/-1237 (-1237)
> > >                   function                                   old
> > >  new   delta sf_mtd_registered                            1
> > > - -1 spi_flash_mtd_sync                           2       -
> > > -2 spi_flash_free                              26      22      -4
> > >                   sf_mtd_name                                  8
> > >    -      -8 spi_flash_probe                             88
> > > 78 -10 idr_remove                                  20       -
> > > -20 spi_flash_mtd_write                         44       -     -44
> > >                   spi_flash_mtd_read                          44
> > >    -     -44 spi_flash_mtd_unregister                    52
> > > - -52 del_mtd_device                              68       -
> > > -68 mtd_unlock                                  80       -     -80
> > >                   spi_flash_mtd_erase                        164
> > >    -    -164 spi_flash_mtd_register                     172
> > > - -172 sf_mtd_info                                240       -
> > > -240 add_mtd_device                             328       -
> > > -328 display5       : all -1605 bss -248 rodata -201 text
> > > -1156 u-boot: add: 0/-13, grow: 0/-2 bytes: 0/-1237 (-1237)
> > >                   function                                   old
> > >  new   delta sf_mtd_registered                            1
> > > - -1 spi_flash_mtd_sync                           2       -
> > > -2 spi_flash_free                              26      22      -4
> > >                   sf_mtd_name                                  8
> > >    -      -8 spi_flash_probe                             88
> > > 78 -10 idr_remove                                  20       -
> > > -20 spi_flash_mtd_write                         44       -     -44
> > >                   spi_flash_mtd_read                          44
> > >    -     -44 spi_flash_mtd_unregister                    52
> > > - -52 del_mtd_device                              68       -
> > > -68 mtd_unlock                                  80       -     -80
> > >                   spi_flash_mtd_erase                        164
> > >    -    -164 spi_flash_mtd_register                     172
> > > - -172 sf_mtd_info                                240       -
> > > -240 add_mtd_device                             328       -
> > > -328 brppt1_spi     : spl/u-boot-spl:all -2109
> > > spl/u-boot-spl:bss -4 spl/u-boot-spl:data -436
> > > spl/u-boot-spl:rodata -309 spl/u-boot-spl:text -1360
> > > spl-u-boot-spl: add: 3/-41, grow: 5/-2 bytes: 1310/-3100 (-1790)
> > > function                                   old     new   delta
> > > spi_xfer                                     6     800    +794
> > > spi_claim_bus                                6     248    +242
> > > spi_setup_slave                              -     156    +156
> > > spi_do_alloc_slave                           -      48     +48
> > > spi_flash_probe                             26      72     +46
> > > spl_spi_load_image                         124     140     +16
> > > spi_release_bus                              6      12      +6
> > > spi_free_slave                               -       2      +2
> > > spi_flash_std_remove                         4       -      -4
> > > spi_flash_post_bind                          4       -      -4
> > > omap4_pdata                                  4       -      -4
> > > omap2_pdata                                  4       -      -4
> > > dev_get_parent_priv                          6       -      -6
> > > spi_flash_cmd_get_sw_write_prot              8       -      -8
> > > spi_flash_std_get_sw_write_prot             14       -     -14
> > > spi_flash_read_dm                           14       -     -14
> > > dm_spi_release_bus                          14       -     -14
> > > ofnode_read_bool                            16       -     -16
> > > fdtdec_get_bool                             20       -     -20
> > > omap3_spi_release_bus                       22       -     -22
> > > spi_mem_adjust_op_size                      92      68     -24
> > > spi_child_post_bind                         30       -     -30
> > > spi_post_probe                              32       -     -32
> > > spi_flash_std_write                         34       -     -34
> > > spi_flash_std_read                          34       -     -34
> > > spi_child_pre_probe                         34       -     -34
> > > dm_spi_xfer                                 34       -     -34
> > > spi_mem_supports_op                         36       -     -36
> > > spi_flash_probe_bus_cs                      48       -     -48
> > > spi_find_chip_select                        50       -     -50
> > > omap3_spi_claim_bus                         54       -     -54
> > > static.spi_check_buswidth_req               56       -     -56
> > > omap3_spi_set_wordlen                       62       -     -62
> > > spi_mem_exec_op                            284     220     -64
> > > _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
> > > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > > _u_boot_list_2_driver_2_omap3_spi           68       -     -68
> > > spi_set_speed_mode                          72       -     -72
> > > spi_flash_std_probe                         76       -     -76
> > > omap3_spi_set_speed                         76       -     -76
> > > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > > _u_boot_list_2_uclass_2_spi_generic         76       -     -76
> > > _u_boot_list_2_uclass_2_spi                 76       -     -76
> > > spi_flash_std_erase                         84       -     -84
> > > spi_mem_default_supports_op                 86       -     -86
> > > omap3_spi_set_mode                          96       -     -96
> > > dm_spi_claim_bus                           100       -    -100
> > > omap3_spi_probe                            116       -    -116
> > > spi_slave_ofdata_to_platdata               212       -    -212
> > > spi_get_bus_and_cs                         232       -    -232
> > > omap3_spi_xfer                             796       -    -796
> > > brsmarc1       : spl/u-boot-spl:all -2113 spl/u-boot-spl:bss -4
> > > spl/u-boot-spl:data -436 spl/u-boot-spl:rodata -309
> > > spl/u-boot-spl:text -1364 spl-u-boot-spl: add: 3/-41, grow: 5/-2
> > > bytes: 1310/-3100 (-1790) function
> > >  old     new   delta spi_xfer
> > > 6 800    +794 spi_claim_bus                                6
> > > 248    +242 spi_setup_slave                              -     156
> > >   +156 spi_do_alloc_slave                           -      48
> > > +48 spi_flash_probe                             26      72     +46
> > > spl_spi_load_image                         124     140     +16
> > > spi_release_bus                              6      12      +6
> > > spi_free_slave                               -       2      +2
> > > spi_flash_std_remove                         4       -      -4
> > > spi_flash_post_bind                          4       -      -4
> > > omap4_pdata                                  4       -      -4
> > > omap2_pdata                                  4       -      -4
> > > dev_get_parent_priv                          6       -      -6
> > > spi_flash_cmd_get_sw_write_prot              8       -      -8
> > > spi_flash_std_get_sw_write_prot             14       -     -14
> > > spi_flash_read_dm                           14       -     -14
> > > dm_spi_release_bus                          14       -     -14
> > > ofnode_read_bool                            16       -     -16
> > > fdtdec_get_bool                             20       -     -20
> > > omap3_spi_release_bus                       22       -     -22
> > > spi_mem_adjust_op_size                      92      68     -24
> > > spi_child_post_bind                         30       -     -30
> > > spi_post_probe                              32       -     -32
> > > spi_flash_std_write                         34       -     -34
> > > spi_flash_std_read                          34       -     -34
> > > spi_child_pre_probe                         34       -     -34
> > > dm_spi_xfer                                 34       -     -34
> > > spi_mem_supports_op                         36       -     -36
> > > spi_flash_probe_bus_cs                      48       -     -48
> > > spi_find_chip_select                        50       -     -50
> > > omap3_spi_claim_bus                         54       -     -54
> > > static.spi_check_buswidth_req               56       -     -56
> > > omap3_spi_set_wordlen                       62       -     -62
> > > spi_mem_exec_op                            284     220     -64
> > > _u_boot_list_2_driver_2_spi_generic_drv      68       -     -68
> > > _u_boot_list_2_driver_2_spi_flash_std       68       -     -68
> > > _u_boot_list_2_driver_2_omap3_spi           68       -     -68
> > > spi_set_speed_mode                          72       -     -72
> > > spi_flash_std_probe                         76       -     -76
> > > omap3_spi_set_speed                         76       -     -76
> > > _u_boot_list_2_uclass_2_spi_nor             76       -     -76
> > > _u_boot_list_2_uclass_2_spi_generic         76       -     -76
> > > _u_boot_list_2_uclass_2_spi                 76       -     -76
> > > spi_flash_std_erase                         84       -     -84
> > > spi_mem_default_supports_op                 86       -     -86
> > > omap3_spi_set_mode                          96       -     -96
> > > dm_spi_claim_bus                           100       -    -100
> > > omap3_spi_probe                            116       -    -116
> > > spi_slave_ofdata_to_platdata               212       -    -212
> > > spi_get_bus_and_cs                         232       -    -232
> > > omap3_spi_xfer                             796       -    -796
> > > stm32mp15_basic: spl/u-boot-spl:all -2312 spl/u-boot-spl:bss -772
> > > spl/u-boot-spl:rodata -292 spl/u-boot-spl:text -1248
> > > spl-u-boot-spl: add: 0/-19, grow: 0/-2 bytes: 0/-2013 (-2013)
> > > function                                   old     new   delta
> > > sf_mtd_registered                            1       -      -1
> > > spi_flash_mtd_sync                           2       -      -2
> > > spi_flash_std_remove                        10       4      -6
> > > spi_flash_erase_dm                           8       -      -8
> > > sf_mtd_name                                  8       -      -8
> > > spi_flash_std_probe                         88      76     -12
> > > spi_flash_write_dm                          14       -     -14
> > > idr_remove                                  20       -     -20
> > > spi_flash_mtd_write                         38       -     -38
> > > spi_flash_mtd_read                          38       -     -38
> > > spi_flash_mtd_unregister                    52       -     -52
> > > spi_flash_mtd_erase                         78       -     -78
> > > mtd_unlock                                  80       -     -80
> > > del_mtd_device                              80       -     -80
> > > mtd_erase_callback                          88       -     -88
> > > part_erase                                  96       -     -96
> > > del_mtd_partitions                         136       -    -136
> > > spi_flash_mtd_register                     172       -    -172
> > > sf_mtd_info                                240       -    -240
> > > add_mtd_device                             328       -    -328
> > > mtd_idr                                    516       -    -516
> > > 
> > > 
> > > _______________________________________________
> > > U-Boot mailing list
> > > U-Boot@lists.denx.de
> > > https://lists.denx.de/listinfo/u-boot
> > >    
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Frieder Schrempf Sept. 12, 2019, 8:22 a.m. UTC | #5
Hi Lukasz,

On 10.09.19 12:22, Lukasz Majewski wrote:
> Hi Frieder,
> 
>> On Mon, 9 Sep 2019 11:11:50 +0000
>> Schrempf Frieder <frieder.schrempf@kontron.de> wrote:
>>
>>> Hi Lukasz,
>>>
>>> On 05.09.19 20:09, Tom Rini wrote:
>>>> On Thu, Sep 05, 2019 at 12:16:36AM +0200, Lukasz Majewski wrote:
>>>>    
>>>>> This patch series introduces new SPL and TPL specific Kconfig
>>>>> entries for DM_SPI* options. Such change allows using the spi
>>>>> driver in SPL/TPL or U-Boot proper.
>>>>>
>>>>> First two patches - related to ls10{42}* NXP soc fix some issues
>>>>> with defining the DM_SPI* defines in <board>.h file instead of
>>>>> Kconfig.
>>>>>
>>>>> This series doesn't introduce build breaks, but board maintainers
>>>>> are kindly asked to check if their boards still boots.
>>>>>
>>>>> Buildman setup for binary size regression checking:
>>>>>
>>>>> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
>>>>> --output-dir=../BUILD/ --force-build -CveE
>>>>> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
>>>>> --output-dir=../BUILD/ -Ssdel
>>>>
>>>> So you did fix the ls1043 problems but ls1046 is still a problem.
>>>>     
>>>
>>> I was trying to clean up this config mess some weeks ago. I
>>> stumbled over the same issues (size deltas below) when I tested
>>> with buildman and finally gave up on it. This was my testing branch
>>> for reference: [1].
>>>
>>> Thanks for your work and I hope you/we can get this sorted out
>>> somehow...
>>
>> For now I've only posted the patch to introduce SPL_DM_SPI in Kconig:
>> https://patchwork.ozlabs.org/patch/1159655/
> 
> However, I've looked on your patchset and IMHO this work could be
> divided (as doing it at once is not feasible).
> 
> For example the CONFIG_SPI_FLASH_MTD could be converted to
> (SPL_TPL_)SPI_FLASH_MTD and then one could use
> 
> #if CONFIG_IS_ENABLED(SPI_FLASH_MTD) in drivers/mtd/spi/sf_probe.c (as
> it is only used there).
> 
> Then we could avoid situations where code is added as you remove it
> here [1]:
> https://github.com/fschrempf/u-boot/commit/b6489fb5928c2b41d7e4cb39933f078659b4f10e#diff-9d3e174d033b8b9c9d380a22a81600aaL136
> 
> What I'm afraid though, is that split of SPI_FLASH_MTD will require
> adding unwillingly SPL_(TPL_)SPI_FLASH_MTD to all boards which already
> define it (and only drop ones, which use in <config>.h file pattern as
> [1]).

Yes, this looks like what I've tried to do separately in this branch [1].

The problem with some socfpga boards is, that they enable 
CONFIG_SPI_FLASH_MTD in socfpga_common.h, without enabling 
CONFIG_SPI_FLASH, which is probably wrong. So I tried to correct this, 
but looking at it again, this should be done separately.

So if I remove the added "CONFIG_SPI_FLASH=y" from my patches and 
rebase, this should be ok.

For this set I have still one question: Should I split the patches as 
currently done in [1]? This would mean after the first patch some boards 
miss SPI_FLASH_MTD code and the subsequent board config patches correct 
it afterwards. Or should I merge all the changes to a single patch, to 
not break the boards in between.
Unfortunately I can't do it the other way round and apply the board 
config changes first, as this breaks the build.

> Frieder, would you be able to work on this topic any time soon?

I can try to find some time this weekend and try to get [1] ready. But I 
probably won't be able to spend serious amounts of time anytime soon on 
the remaining tasks.

Thanks,
Frieder

[1]: https://github.com/fschrempf/u-boot/commits/spi_flash_mtd_cleanup
Lukasz Majewski Sept. 12, 2019, 9:03 a.m. UTC | #6
Hi Frieder,

> Hi Lukasz,
> 
> On 10.09.19 12:22, Lukasz Majewski wrote:
> > Hi Frieder,
> >   
> >> On Mon, 9 Sep 2019 11:11:50 +0000
> >> Schrempf Frieder <frieder.schrempf@kontron.de> wrote:
> >>  
> >>> Hi Lukasz,
> >>>
> >>> On 05.09.19 20:09, Tom Rini wrote:  
> >>>> On Thu, Sep 05, 2019 at 12:16:36AM +0200, Lukasz Majewski wrote:
> >>>>      
> >>>>> This patch series introduces new SPL and TPL specific Kconfig
> >>>>> entries for DM_SPI* options. Such change allows using the spi
> >>>>> driver in SPL/TPL or U-Boot proper.
> >>>>>
> >>>>> First two patches - related to ls10{42}* NXP soc fix some issues
> >>>>> with defining the DM_SPI* defines in <board>.h file instead of
> >>>>> Kconfig.
> >>>>>
> >>>>> This series doesn't introduce build breaks, but board
> >>>>> maintainers are kindly asked to check if their boards still
> >>>>> boots.
> >>>>>
> >>>>> Buildman setup for binary size regression checking:
> >>>>>
> >>>>> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
> >>>>> --output-dir=../BUILD/ --force-build -CveE
> >>>>> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
> >>>>> --output-dir=../BUILD/ -Ssdel  
> >>>>
> >>>> So you did fix the ls1043 problems but ls1046 is still a problem.
> >>>>       
> >>>
> >>> I was trying to clean up this config mess some weeks ago. I
> >>> stumbled over the same issues (size deltas below) when I tested
> >>> with buildman and finally gave up on it. This was my testing
> >>> branch for reference: [1].
> >>>
> >>> Thanks for your work and I hope you/we can get this sorted out
> >>> somehow...  
> >>
> >> For now I've only posted the patch to introduce SPL_DM_SPI in
> >> Kconig: https://patchwork.ozlabs.org/patch/1159655/  
> > 
> > However, I've looked on your patchset and IMHO this work could be
> > divided (as doing it at once is not feasible).
> > 
> > For example the CONFIG_SPI_FLASH_MTD could be converted to
> > (SPL_TPL_)SPI_FLASH_MTD and then one could use
> > 
> > #if CONFIG_IS_ENABLED(SPI_FLASH_MTD) in drivers/mtd/spi/sf_probe.c
> > (as it is only used there).
> > 
> > Then we could avoid situations where code is added as you remove it
> > here [1]:
> > https://github.com/fschrempf/u-boot/commit/b6489fb5928c2b41d7e4cb39933f078659b4f10e#diff-9d3e174d033b8b9c9d380a22a81600aaL136
> > 
> > What I'm afraid though, is that split of SPI_FLASH_MTD will require
> > adding unwillingly SPL_(TPL_)SPI_FLASH_MTD to all boards which
> > already define it (and only drop ones, which use in <config>.h file
> > pattern as [1]).  
> 
> Yes, this looks like what I've tried to do separately in this branch
> [1].
> 
> The problem with some socfpga boards is, that they enable 
> CONFIG_SPI_FLASH_MTD in socfpga_common.h, without enabling 
> CONFIG_SPI_FLASH, which is probably wrong.

It looks to me like the code in:
https://github.com/fschrempf/u-boot/commit/059d67efa34da92aaf738758e596f436203c84c2#diff-9d3e174d033b8b9c9d380a22a81600aaL136

is to prevent ALL socfpgas from compiling in FLASH MTD support to SPL,
as it causes build breaks (as I do have such situation in one of my
boards - it uses tiny SPI in SPL to read data from SPI-NOR, without the
need to enable MTD there) .

In other words those boards only use FLASH MTD driver in U-Boot proper.
(and probably there shall not be any deltas in buildman build binaries
[*])

> So I tried to correct
> this, but looking at it again, this should be done separately.
> 
> So if I remove the added "CONFIG_SPI_FLASH=y" from my patches and 
> rebase, this should be ok.

I think yes. I guess that ALL socfpgas shall have added
CONFIG_SPI_FLASH_MTD=y to their _defconfigs


It may also happen that boards, which define CONFIG_SPI_FLASH_MTD would
require both CONFIG_SPI_FLASH_MTD and CONFIG_SPL_SPI_FLASH_MTD defined
(if they don't use socfpga style <config>.h code) to have the same
binaries build.

> 
> For this set I have still one question: Should I split the patches as 
> currently done in [1]? This would mean after the first patch some
> boards miss SPI_FLASH_MTD code and the subsequent board config
> patches correct it afterwards. Or should I merge all the changes to a
> single patch, to not break the boards in between.

I would opt for preparing one single patch with conversion (to avoid
build breaks). This would also allow easy buildman testing [*] to see
if there is any difference in sizes of binaries (elf sections to be
precise).

I would also add the patch to define CONFIG_SPL_SPI_FLASH_MTD in
Kconfig to show that such option is available for use after the
conversion (IMHO it shall be added before the conversion patch).

> Unfortunately I can't do it the other way round and apply the board 
> config changes first, as this breaks the build.

The volume of changes is rather small - so single patch would be
optimal here.

> 
> > Frieder, would you be able to work on this topic any time soon?  
> 
> I can try to find some time this weekend and try to get [1] ready.

Great, thanks :-)

> But I probably won't be able to spend serious amounts of time anytime
> soon on the remaining tasks.

I think that we shall do it step by step. As we both learned from the
experience - doing it at once is not feasible.

My comments to the patch set [1]:

1. 
https://github.com/fschrempf/u-boot/commit/059d67efa34da92aaf738758e596f436203c84c2#diff-94a725bbe2cb8781105dab5153da9209R44

Is the CONFIG_SPI_FLASH = y necessary?




[*] - Buildman setup for testing (shared with me by Tom):

Set date:
export SOURCE_DATE_EPOCH=`date +%s`

Build the code:

./tools/buildman/buildman.py -b HEAD --count=1 socfpga dh_imx6 <other>
--output-dir=../BUILD/ --force-build -CveE

Check build results (including binary deltas):

./tools/buildman/buildman.py -b HEAD --count=1 socfpga dh_imx6 <other>
--output-dir=../BUILD/ -SsdelB


And you shall see the build results (with binary deltas).

> 
> Thanks,
> Frieder
> 
> [1]: https://github.com/fschrempf/u-boot/commits/spi_flash_mtd_cleanup


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Frieder Schrempf Sept. 12, 2019, 9:16 a.m. UTC | #7
On 12.09.19 11:03, Lukasz Majewski wrote:
> Hi Frieder,
> 
>> Hi Lukasz,
>>
>> On 10.09.19 12:22, Lukasz Majewski wrote:
>>> Hi Frieder,
>>>    
>>>> On Mon, 9 Sep 2019 11:11:50 +0000
>>>> Schrempf Frieder <frieder.schrempf@kontron.de> wrote:
>>>>   
>>>>> Hi Lukasz,
>>>>>
>>>>> On 05.09.19 20:09, Tom Rini wrote:
>>>>>> On Thu, Sep 05, 2019 at 12:16:36AM +0200, Lukasz Majewski wrote:
>>>>>>       
>>>>>>> This patch series introduces new SPL and TPL specific Kconfig
>>>>>>> entries for DM_SPI* options. Such change allows using the spi
>>>>>>> driver in SPL/TPL or U-Boot proper.
>>>>>>>
>>>>>>> First two patches - related to ls10{42}* NXP soc fix some issues
>>>>>>> with defining the DM_SPI* defines in <board>.h file instead of
>>>>>>> Kconfig.
>>>>>>>
>>>>>>> This series doesn't introduce build breaks, but board
>>>>>>> maintainers are kindly asked to check if their boards still
>>>>>>> boots.
>>>>>>>
>>>>>>> Buildman setup for binary size regression checking:
>>>>>>>
>>>>>>> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
>>>>>>> --output-dir=../BUILD/ --force-build -CveE
>>>>>>> ./tools/buildman/buildman.py -b HEAD --count=4 ls1043
>>>>>>> --output-dir=../BUILD/ -Ssdel
>>>>>>
>>>>>> So you did fix the ls1043 problems but ls1046 is still a problem.
>>>>>>        
>>>>>
>>>>> I was trying to clean up this config mess some weeks ago. I
>>>>> stumbled over the same issues (size deltas below) when I tested
>>>>> with buildman and finally gave up on it. This was my testing
>>>>> branch for reference: [1].
>>>>>
>>>>> Thanks for your work and I hope you/we can get this sorted out
>>>>> somehow...
>>>>
>>>> For now I've only posted the patch to introduce SPL_DM_SPI in
>>>> Kconig: https://patchwork.ozlabs.org/patch/1159655/
>>>
>>> However, I've looked on your patchset and IMHO this work could be
>>> divided (as doing it at once is not feasible).
>>>
>>> For example the CONFIG_SPI_FLASH_MTD could be converted to
>>> (SPL_TPL_)SPI_FLASH_MTD and then one could use
>>>
>>> #if CONFIG_IS_ENABLED(SPI_FLASH_MTD) in drivers/mtd/spi/sf_probe.c
>>> (as it is only used there).
>>>
>>> Then we could avoid situations where code is added as you remove it
>>> here [1]:
>>> https://github.com/fschrempf/u-boot/commit/b6489fb5928c2b41d7e4cb39933f078659b4f10e#diff-9d3e174d033b8b9c9d380a22a81600aaL136
>>>
>>> What I'm afraid though, is that split of SPI_FLASH_MTD will require
>>> adding unwillingly SPL_(TPL_)SPI_FLASH_MTD to all boards which
>>> already define it (and only drop ones, which use in <config>.h file
>>> pattern as [1]).
>>
>> Yes, this looks like what I've tried to do separately in this branch
>> [1].
>>
>> The problem with some socfpga boards is, that they enable
>> CONFIG_SPI_FLASH_MTD in socfpga_common.h, without enabling
>> CONFIG_SPI_FLASH, which is probably wrong.
> 
> It looks to me like the code in:
> https://github.com/fschrempf/u-boot/commit/059d67efa34da92aaf738758e596f436203c84c2#diff-9d3e174d033b8b9c9d380a22a81600aaL136
> 
> is to prevent ALL socfpgas from compiling in FLASH MTD support to SPL,
> as it causes build breaks (as I do have such situation in one of my
> boards - it uses tiny SPI in SPL to read data from SPI-NOR, without the
> need to enable MTD there) .
> 
> In other words those boards only use FLASH MTD driver in U-Boot proper.
> (and probably there shall not be any deltas in buildman build binaries
> [*])

Right.

> 
>> So I tried to correct
>> this, but looking at it again, this should be done separately.
>>
>> So if I remove the added "CONFIG_SPI_FLASH=y" from my patches and
>> rebase, this should be ok.
> 
> I think yes. I guess that ALL socfpgas shall have added
> CONFIG_SPI_FLASH_MTD=y to their _defconfigs

Right.

> 
> 
> It may also happen that boards, which define CONFIG_SPI_FLASH_MTD would
> require both CONFIG_SPI_FLASH_MTD and CONFIG_SPL_SPI_FLASH_MTD defined
> (if they don't use socfpga style <config>.h code) to have the same
> binaries build.

Last time I looked such boards didn't exist, but I'll check again.

> 
>>
>> For this set I have still one question: Should I split the patches as
>> currently done in [1]? This would mean after the first patch some
>> boards miss SPI_FLASH_MTD code and the subsequent board config
>> patches correct it afterwards. Or should I merge all the changes to a
>> single patch, to not break the boards in between.
> 
> I would opt for preparing one single patch with conversion (to avoid
> build breaks). This would also allow easy buildman testing [*] to see
> if there is any difference in sizes of binaries (elf sections to be
> precise).
> 
> I would also add the patch to define CONFIG_SPL_SPI_FLASH_MTD in
> Kconfig to show that such option is available for use after the
> conversion (IMHO it shall be added before the conversion patch).

Ok. Last time I worked on this, there was no board using SPI_FLASH_MTD 
in SPL. But this might not be true anymore. Anyway, I'll add the option.

> 
>> Unfortunately I can't do it the other way round and apply the board
>> config changes first, as this breaks the build.
> 
> The volume of changes is rather small - so single patch would be
> optimal here.

Ok.

> 
>>
>>> Frieder, would you be able to work on this topic any time soon?
>>
>> I can try to find some time this weekend and try to get [1] ready.
> 
> Great, thanks :-)
> 
>> But I probably won't be able to spend serious amounts of time anytime
>> soon on the remaining tasks.
> 
> I think that we shall do it step by step. As we both learned from the
> experience - doing it at once is not feasible.

Definitely!

> 
> My comments to the patch set [1]:
> 
> 1.
> https://github.com/fschrempf/u-boot/commit/059d67efa34da92aaf738758e596f436203c84c2#diff-94a725bbe2cb8781105dab5153da9209R44
> 
> Is the CONFIG_SPI_FLASH = y necessary?

For the boards to work properly, it probably is necessary, but it builds 
fine without, so as said above I will leave this fix for someone who 
knows about socfpga.

> 
> 
> 
> [*] - Buildman setup for testing (shared with me by Tom):
> 
> Set date:
> export SOURCE_DATE_EPOCH=`date +%s`
> 
> Build the code:
> 
> ./tools/buildman/buildman.py -b HEAD --count=1 socfpga dh_imx6 <other>
> --output-dir=../BUILD/ --force-build -CveE
> 
> Check build results (including binary deltas):
> 
> ./tools/buildman/buildman.py -b HEAD --count=1 socfpga dh_imx6 <other>
> --output-dir=../BUILD/ -SsdelB
> 
> 
> And you shall see the build results (with binary deltas).

Thanks, I already use such buildman setup to test the binary deltas.

> 
>>
>> Thanks,
>> Frieder
>>
>> [1]: https://github.com/fschrempf/u-boot/commits/spi_flash_mtd_cleanup
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
>