aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.azure-pipelines.yml8
-rw-r--r--.gitlab-ci.yml4
-rw-r--r--Kconfig21
-rw-r--r--README41
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/fdt.c12
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/soc.c2
-rw-r--r--arch/arm/dts/exynos5250-smdk5250.dts1
-rw-r--r--arch/arm/lib/semihosting.c2
-rw-r--r--arch/arm/mach-exynos/include/mach/sromc.h18
-rw-r--r--arch/arm/mach-imx/cmd_dek.c6
-rw-r--r--arch/arm/mach-imx/cmd_mfgprot.c4
-rw-r--r--arch/arm/mach-imx/cmd_nandbcb.c10
-rw-r--r--arch/arm/mach-imx/cpu.c4
-rw-r--r--arch/arm/mach-imx/hab.c6
-rw-r--r--arch/arm/mach-imx/imx8/ahab.c2
-rw-r--r--arch/arm/mach-imx/imx8/snvs_security_sc.c56
-rw-r--r--arch/arm/mach-imx/imx_bootaux.c2
-rw-r--r--arch/arm/mach-imx/mx6/mp.c2
-rw-r--r--arch/arm/mach-keystone/cmd_clock.c10
-rw-r--r--arch/arm/mach-keystone/cmd_mon.c8
-rw-r--r--arch/arm/mach-kirkwood/cpu.c2
-rw-r--r--arch/arm/mach-mvebu/arm64-common.c5
-rw-r--r--arch/arm/mach-nexell/clock.c2
-rw-r--r--arch/arm/mach-snapdragon/misc.c2
-rw-r--r--arch/arm/mach-socfpga/misc.c2
-rw-r--r--arch/arm/mach-socfpga/vab.c4
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32key.c4
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c6
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c2
-rw-r--r--arch/arm/mach-uniphier/board_late_init.c2
-rw-r--r--arch/arm/mach-zynqmp/mp.c2
-rw-r--r--arch/mips/mach-octeon/bootoctlinux.c5
-rw-r--r--arch/nds32/include/asm/arch-ag102/ag102.h2
-rw-r--r--arch/nds32/lib/bootm.c2
-rw-r--r--arch/nios2/lib/bootm.c2
-rw-r--r--arch/powerpc/cpu/mpc83xx/ecc.c18
-rw-r--r--arch/powerpc/cpu/mpc83xx/pci.c160
-rw-r--r--arch/powerpc/cpu/mpc85xx/Makefile1
-rw-r--r--arch/powerpc/cpu/mpc85xx/mp.c2
-rw-r--r--arch/powerpc/cpu/mpc85xx/pci.c191
-rw-r--r--arch/sandbox/cpu/start.c9
-rw-r--r--arch/sandbox/cpu/state.c18
-rw-r--r--arch/sandbox/dts/sandbox.dtsi2
-rw-r--r--arch/sandbox/include/asm/state.h1
-rw-r--r--arch/sh/lib/zimageboot.c5
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/cpu/mtrr.c13
-rw-r--r--arch/x86/cpu/quark/Kconfig5
-rw-r--r--arch/x86/cpu/queensbay/tnc.c20
-rw-r--r--arch/x86/cpu/tangier/acpi.c4
-rw-r--r--arch/x86/dts/bayleybay.dts3
-rw-r--r--arch/x86/dts/baytrail_som-db5800-som-6867.dts3
-rw-r--r--arch/x86/dts/cherryhill.dts3
-rw-r--r--arch/x86/dts/chromebook_coral.dts4
-rw-r--r--arch/x86/dts/chromebook_link.dts3
-rw-r--r--arch/x86/dts/chromebook_samus.dts3
-rw-r--r--arch/x86/dts/chromebox_panther.dts3
-rw-r--r--arch/x86/dts/conga-qeval20-qa3-e3845.dts3
-rw-r--r--arch/x86/dts/coreboot.dts7
-rw-r--r--arch/x86/dts/cougarcanyon2.dts3
-rw-r--r--arch/x86/dts/crownbay.dts2
-rw-r--r--arch/x86/dts/dfi-bt700.dtsi1
-rw-r--r--arch/x86/dts/edison.dts2
-rw-r--r--arch/x86/dts/efi-x86_app.dts7
-rw-r--r--arch/x86/dts/efi-x86_payload.dts7
-rw-r--r--arch/x86/dts/galileo.dts7
-rw-r--r--arch/x86/dts/minnowmax.dts3
-rw-r--r--arch/x86/dts/qemu-x86_i440fx.dts6
-rw-r--r--arch/x86/dts/qemu-x86_q35.dts6
-rw-r--r--arch/x86/dts/slimbootloader.dts2
-rw-r--r--arch/x86/dts/tsc_timer.dtsi1
-rw-r--r--arch/x86/include/asm/mtrr.h7
-rw-r--r--arch/x86/lib/fsp/fsp_common.c16
-rw-r--r--arch/x86/lib/fsp/fsp_dram.c27
-rw-r--r--arch/x86/lib/fsp2/fsp_common.c17
-rw-r--r--arch/x86/lib/zimage.c14
-rw-r--r--board/Arcturus/ucp1020/ucp1020.c2
-rw-r--r--board/BuS/eb_cpu5282/eb_cpu5282.c10
-rw-r--r--board/Marvell/octeontx2/board.c2
-rw-r--r--board/amlogic/beelink-s922x/beelink-s922x.c2
-rw-r--r--board/amlogic/odroid-n2/odroid-n2.c2
-rw-r--r--board/amlogic/vim3/vim3.c2
-rw-r--r--board/atmel/common/board.c2
-rw-r--r--board/bluewater/gurnard/gurnard.c2
-rw-r--r--board/cavium/thunderx/atf.c32
-rw-r--r--board/cavium/thunderx/thunderx.c7
-rw-r--r--board/compulab/common/eeprom.c2
-rw-r--r--board/compulab/common/omap3_display.c2
-rw-r--r--board/davinci/da8xxevm/da850evm.c2
-rw-r--r--board/esd/meesc/meesc.c2
-rw-r--r--board/freescale/common/Makefile1
-rw-r--r--board/freescale/common/cds_pci_ft.c59
-rw-r--r--board/freescale/common/cmd_esbc_validate.c2
-rw-r--r--board/freescale/common/fsl_validate.c2
-rw-r--r--board/freescale/common/idt8t49n222a_serdes_clk.c208
-rw-r--r--board/freescale/common/idt8t49n222a_serdes_clk.h106
-rw-r--r--board/freescale/common/p_corenet/Makefile1
-rw-r--r--board/freescale/common/p_corenet/pci.c25
-rw-r--r--board/freescale/common/pixis.c8
-rw-r--r--board/freescale/common/sys_eeprom.c6
-rw-r--r--board/freescale/lx2160a/eth_lx2160aqds.c2
-rw-r--r--board/freescale/lx2160a/eth_lx2162aqds.c2
-rw-r--r--board/freescale/mpc8349emds/pci.c73
-rw-r--r--board/freescale/mpc837xerdb/Makefile1
-rw-r--r--board/freescale/mpc837xerdb/pci.c109
-rw-r--r--board/freescale/mpc8548cds/mpc8548cds.c114
-rw-r--r--board/freescale/p1010rdb/p1010rdb.c11
-rw-r--r--board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c13
-rw-r--r--board/freescale/p2041rdb/cpld.c4
-rw-r--r--board/freescale/t102xrdb/Makefile1
-rw-r--r--board/freescale/t102xrdb/pci.c25
-rw-r--r--board/freescale/t104xrdb/Makefile1
-rw-r--r--board/freescale/t104xrdb/pci.c25
-rw-r--r--board/freescale/t208xqds/Makefile1
-rw-r--r--board/freescale/t208xqds/pci.c25
-rw-r--r--board/freescale/t208xrdb/Makefile1
-rw-r--r--board/freescale/t208xrdb/pci.c25
-rw-r--r--board/freescale/t4rdb/Makefile1
-rw-r--r--board/freescale/t4rdb/pci.c25
-rw-r--r--board/gateworks/gw_ventana/common.c2
-rw-r--r--board/gateworks/gw_ventana/gsc.c4
-rw-r--r--board/gateworks/gw_ventana/gw_ventana.c4
-rw-r--r--board/gateworks/venice/gsc.c2
-rw-r--r--board/gdsys/common/cmd_ioloop.c16
-rw-r--r--board/gdsys/common/osd.c18
-rw-r--r--board/gdsys/common/osd_cmd.c16
-rw-r--r--board/imgtec/malta/malta.c67
-rw-r--r--board/keymile/common/common.c4
-rw-r--r--board/kontron/sl28/cmds.c2
-rw-r--r--board/menlo/m53menlo/m53menlo.c2
-rw-r--r--board/renesas/stout/cpld.c4
-rw-r--r--board/renesas/ulcb/cpld.c4
-rw-r--r--board/samsung/common/Makefile2
-rw-r--r--board/samsung/common/board.c78
-rw-r--r--board/samsung/common/exynos5-dt.c2
-rw-r--r--board/samsung/common/sromc.c76
-rw-r--r--board/samsung/odroid/odroid.c2
-rw-r--r--board/samsung/smdkv310/smdkv310.c9
-rw-r--r--board/siemens/common/factoryset.c14
-rw-r--r--board/siemens/taurus/taurus.c5
-rw-r--r--board/sifive/unmatched/hifive-platform-i2c-eeprom.c8
-rw-r--r--board/socrates/socrates.c4
-rw-r--r--board/synopsys/hsdk/env-lib.c4
-rw-r--r--board/ti/am64x/evm.c2
-rw-r--r--board/ti/j721e/evm.c2
-rw-r--r--board/toradex/common/tdx-cfg-block.c14
-rw-r--r--board/varisys/common/sys_eeprom.c6
-rw-r--r--board/work-microwave/work_92105/work_92105_display.c3
-rw-r--r--board/xes/common/fsl_8xxx_pci.c50
-rw-r--r--board/xilinx/common/fru.c4
-rw-r--r--board/xilinx/versal/cmds.c2
-rw-r--r--board/xilinx/zynq/cmds.c14
-rw-r--r--board/xilinx/zynqmp/cmds.c46
-rw-r--r--cmd/abootimg.c2
-rw-r--r--cmd/adtimg.c2
-rw-r--r--cmd/aes.c10
-rw-r--r--cmd/armflash.c2
-rw-r--r--cmd/avb.c26
-rw-r--r--cmd/axi.c18
-rw-r--r--cmd/bedbug.c6
-rw-r--r--cmd/bind.c4
-rw-r--r--cmd/binop.c8
-rw-r--r--cmd/blk_common.c16
-rw-r--r--cmd/blkcache.c3
-rw-r--r--cmd/blob.c8
-rw-r--r--cmd/bmp.c10
-rw-r--r--cmd/boot.c2
-rw-r--r--cmd/bootefi.c4
-rw-r--r--cmd/booti.c2
-rw-r--r--cmd/bootm.c4
-rw-r--r--cmd/bootstage.c4
-rw-r--r--cmd/bootz.c2
-rw-r--r--cmd/broadcom/nitro_image_load.c4
-rw-r--r--cmd/cbfs.c6
-rw-r--r--cmd/clk.c2
-rw-r--r--cmd/clone.c2
-rw-r--r--cmd/cramfs.c4
-rw-r--r--cmd/cros_ec.c8
-rw-r--r--cmd/demo.c4
-rw-r--r--cmd/disk.c2
-rw-r--r--cmd/efidebug.c14
-rw-r--r--cmd/elf.c4
-rw-r--r--cmd/exit.c2
-rw-r--r--cmd/fastboot.c4
-rw-r--r--cmd/fdt.c83
-rw-r--r--cmd/flash.c16
-rw-r--r--cmd/fpga.c10
-rw-r--r--cmd/fpgad.c6
-rw-r--r--cmd/gpio.c4
-rw-r--r--cmd/gpt.c2
-rw-r--r--cmd/host.c6
-rw-r--r--cmd/i2c.c68
-rw-r--r--cmd/ini.c8
-rw-r--r--cmd/io.c8
-rw-r--r--cmd/iotrace.c8
-rw-r--r--cmd/itest.c6
-rw-r--r--cmd/jffs2.c2
-rw-r--r--cmd/led.c2
-rw-r--r--cmd/legacy_led.c2
-rw-r--r--cmd/load.c16
-rw-r--r--cmd/log.c4
-rw-r--r--cmd/lzmadec.c6
-rw-r--r--cmd/mbr.c2
-rw-r--r--cmd/md5sum.c14
-rw-r--r--cmd/mdio.c2
-rw-r--r--cmd/mem.c56
-rw-r--r--cmd/mfsl.c14
-rw-r--r--cmd/mii.c8
-rw-r--r--cmd/misc.c6
-rw-r--r--cmd/mmc.c80
-rw-r--r--cmd/mp.c2
-rw-r--r--cmd/mtd.c10
-rw-r--r--cmd/mtdparts.c4
-rw-r--r--cmd/mvebu/bubt.c2
-rw-r--r--cmd/mvebu/comphy_rx_training.c4
-rw-r--r--cmd/nand.c20
-rw-r--r--cmd/net.c6
-rw-r--r--cmd/nvedit.c12
-rw-r--r--cmd/nvedit_efi.c4
-rw-r--r--cmd/onenand.c8
-rw-r--r--cmd/optee_rpmb.c2
-rw-r--r--cmd/osd.c20
-rw-r--r--cmd/pcap.c4
-rw-r--r--cmd/pci.c224
-rw-r--r--cmd/pstore.c16
-rw-r--r--cmd/pwm.c10
-rw-r--r--cmd/pxe_utils.c4
-rw-r--r--cmd/qfw.c10
-rw-r--r--cmd/read.c10
-rw-r--r--cmd/reiser.c10
-rw-r--r--cmd/remoteproc.c10
-rw-r--r--cmd/rng.c2
-rw-r--r--cmd/rtc.c14
-rw-r--r--cmd/sata.c2
-rw-r--r--cmd/setexpr.c4
-rw-r--r--cmd/sf.c10
-rw-r--r--cmd/sleep.c2
-rw-r--r--cmd/smccc.c16
-rw-r--r--cmd/sound.c4
-rw-r--r--cmd/source.c2
-rw-r--r--cmd/spi.c10
-rw-r--r--cmd/strings.c4
-rw-r--r--cmd/ti/ddr3.c10
-rw-r--r--cmd/ti/pd.c4
-rw-r--r--cmd/tlv_eeprom.c2
-rw-r--r--cmd/tpm-common.c4
-rw-r--r--cmd/trace.c4
-rw-r--r--cmd/tsi148.c10
-rw-r--r--cmd/ubi.c10
-rw-r--r--cmd/ubifs.c4
-rw-r--r--cmd/ufs.c2
-rw-r--r--cmd/universe.c12
-rw-r--r--cmd/unlz4.c6
-rw-r--r--cmd/unzip.c12
-rw-r--r--cmd/usb.c6
-rw-r--r--cmd/w1.c8
-rw-r--r--cmd/x86/hob.c9
-rw-r--r--cmd/x86/mtrr.c6
-rw-r--r--cmd/ximg.c6
-rw-r--r--cmd/yaffs2.c10
-rw-r--r--cmd/zfs.c6
-rw-r--r--cmd/zip.c8
-rw-r--r--common/autoboot.c6
-rw-r--r--common/bedbug.c4
-rw-r--r--common/board_r.c8
-rw-r--r--common/bootm_os.c5
-rw-r--r--common/fdt_support.c2
-rw-r--r--common/hash.c14
-rw-r--r--common/image-fdt.c6
-rw-r--r--common/image-fit-sig.c8
-rw-r--r--common/image-fit.c2
-rw-r--r--common/image.c12
-rw-r--r--common/kallsyms.c2
-rw-r--r--common/lcd.c2
-rw-r--r--common/lcd_console.c4
-rw-r--r--common/splash.c4
-rw-r--r--common/splash_source.c2
-rw-r--r--common/update.c2
-rw-r--r--configs/arndale_defconfig1
-rw-r--r--configs/crownbay_defconfig3
-rw-r--r--configs/odroid-xu3_defconfig1
-rw-r--r--configs/peach-pi_defconfig1
-rw-r--r--configs/peach-pit_defconfig1
-rw-r--r--configs/sandbox_spl_defconfig2
-rw-r--r--configs/smdk5250_defconfig1
-rw-r--r--configs/smdk5420_defconfig1
-rw-r--r--configs/smdkv310_defconfig1
-rw-r--r--configs/snow_defconfig3
-rw-r--r--configs/spring_defconfig1
-rw-r--r--disk/part.c6
-rw-r--r--disk/part_amiga.c4
-rw-r--r--doc/Makefile2
-rw-r--r--doc/arch/x86.rst13
-rw-r--r--doc/board/freescale/b4860qds.rst453
-rw-r--r--doc/board/freescale/index.rst1
-rw-r--r--doc/board/sifive/unleashed.rst20
-rw-r--r--doc/board/sifive/unmatched.rst30
-rw-r--r--doc/board/ti/index.rst9
-rw-r--r--doc/build/gcc.rst6
-rw-r--r--doc/develop/ci_testing.rst70
-rw-r--r--doc/develop/driver-model/migration.rst9
-rw-r--r--doc/develop/index.rst11
-rw-r--r--doc/develop/moveconfig.rst282
-rw-r--r--doc/develop/testing.rst6
-rw-r--r--doc/usage/cmdline.rst93
-rw-r--r--doc/usage/index.rst1
-rw-r--r--drivers/ata/sata_sil.c8
-rw-r--r--drivers/ata/sata_sil.h4
-rw-r--r--drivers/bios_emulator/atibios.c98
-rw-r--r--drivers/bios_emulator/bios.c39
-rw-r--r--drivers/core/fdtaddr.c3
-rw-r--r--drivers/dfu/dfu_mmc.c2
-rw-r--r--drivers/dfu/dfu_mtd.c6
-rw-r--r--drivers/dfu/dfu_nand.c8
-rw-r--r--drivers/dfu/dfu_ram.c4
-rw-r--r--drivers/dfu/dfu_sf.c8
-rw-r--r--drivers/dfu/dfu_virt.c2
-rw-r--r--drivers/fastboot/fb_command.c2
-rw-r--r--drivers/gpio/gpio-uclass.c2
-rw-r--r--drivers/gpio/mxs_gpio.c4
-rw-r--r--drivers/gpio/pca953x.c4
-rw-r--r--drivers/gpio/tca642x.c4
-rw-r--r--drivers/misc/ds4510.c10
-rw-r--r--drivers/mmc/arm_pl180_mmci.c48
-rw-r--r--drivers/mmc/arm_pl180_mmci.h1
-rw-r--r--drivers/mmc/rpmb.c18
-rw-r--r--drivers/mtd/spi/spi-nor-core.c23
-rw-r--r--drivers/mtd/spi/spi-nor-ids.c1
-rw-r--r--drivers/net/e1000.c2
-rw-r--r--drivers/net/e1000_spi.c4
-rw-r--r--drivers/net/fm/fdt.c2
-rw-r--r--drivers/net/fsl-mc/mc.c5
-rw-r--r--drivers/net/netconsole.c6
-rw-r--r--drivers/net/pfe_eth/pfe_cmd.c14
-rw-r--r--drivers/net/pfe_eth/pfe_firmware.c2
-rw-r--r--drivers/net/phy/b53.c14
-rw-r--r--drivers/net/phy/mv88e6352.c14
-rw-r--r--drivers/net/qe/dm_qe_uec.c4
-rw-r--r--drivers/pci/Makefile1
-rw-r--r--drivers/pci/pci_common.c4
-rw-r--r--drivers/pci/pci_ftpci100.c319
-rw-r--r--drivers/pci/pci_gt64120.c64
-rw-r--r--drivers/pci/pci_msc01.c64
-rw-r--r--drivers/pci/pcie_imx.c81
-rw-r--r--drivers/pinctrl/nexell/pinctrl-nexell.c2
-rw-r--r--drivers/pinctrl/pinctrl-uclass.c2
-rw-r--r--drivers/power/power_core.c6
-rw-r--r--drivers/qe/qe.c4
-rw-r--r--drivers/ram/octeon/octeon_ddr.c2
-rw-r--r--drivers/rtc/m41t60.c2
-rw-r--r--drivers/scsi/scsi.c6
-rw-r--r--drivers/serial/serial-uclass.c2
-rw-r--r--drivers/serial/serial.c2
-rw-r--r--drivers/spi/ich.c6
-rw-r--r--drivers/spi/spi-mem-nodm.c10
-rw-r--r--drivers/timer/Kconfig8
-rw-r--r--drivers/timer/tsc_timer.c5
-rw-r--r--drivers/tpm/Makefile4
-rw-r--r--drivers/tpm/sandbox_common.c77
-rw-r--r--drivers/tpm/sandbox_common.h108
-rw-r--r--drivers/tpm/tpm2_tis_sandbox.c283
-rw-r--r--drivers/tpm/tpm_tis_sandbox.c171
-rw-r--r--drivers/usb/cdns3/gadget.c2
-rw-r--r--drivers/usb/gadget/epautoconf.c2
-rw-r--r--drivers/usb/gadget/ether.c3
-rw-r--r--drivers/usb/host/ohci-hcd.c2
-rw-r--r--drivers/video/ati_radeon_fb.c2
-rw-r--r--drivers/video/cfb_console.c2
-rw-r--r--drivers/video/console_truetype.c26
-rw-r--r--drivers/video/mx3fb.c2
-rw-r--r--drivers/video/vidconsole-uclass.c4
-rw-r--r--examples/standalone/atmel_df_pow2.c5
-rw-r--r--fs/fs.c14
-rw-r--r--fs/squashfs/sqfs_filesystem.h2
-rw-r--r--include/autoboot.h36
-rw-r--r--include/bios_emul.h16
-rw-r--r--include/config_distro_bootcmd.h2
-rw-r--r--include/configs/MPC8349EMDS.h1
-rw-r--r--include/configs/MPC8349EMDS_SDRAM.h1
-rw-r--r--include/configs/MPC837XERDB.h1
-rw-r--r--include/configs/MPC8540ADS.h1
-rw-r--r--include/configs/MPC8548CDS.h17
-rw-r--r--include/configs/MPC8560ADS.h1
-rw-r--r--include/configs/P1010RDB.h28
-rw-r--r--include/configs/P2041RDB.h17
-rw-r--r--include/configs/T102xRDB.h17
-rw-r--r--include/configs/T104xRDB.h20
-rw-r--r--include/configs/T208xQDS.h20
-rw-r--r--include/configs/T208xRDB.h20
-rw-r--r--include/configs/T4240RDB.h21
-rw-r--r--include/configs/corenet_ds.h21
-rw-r--r--include/configs/p1_p2_rdb_pc.h24
-rw-r--r--include/configs/t4qds.h240
-rw-r--r--include/fdtdec.h2
-rw-r--r--include/init.h3
-rw-r--r--include/pci.h12
-rw-r--r--include/tpm-v2.h2
-rw-r--r--include/vsprintf.h55
-rw-r--r--lib/Kconfig3
-rw-r--r--lib/dhry/cmd_dhry.c2
-rw-r--r--lib/efi_loader/Makefile2
-rw-r--r--lib/fdtdec.c4
-rw-r--r--lib/net_utils.c4
-rw-r--r--lib/strto.c76
-rw-r--r--lib/uuid.c14
-rw-r--r--lib/vsprintf.c2
-rw-r--r--net/bootp.c2
-rw-r--r--net/eth-uclass.c4
-rw-r--r--net/eth_legacy.c2
-rw-r--r--net/net.c2
-rw-r--r--net/tftp.c13
-rw-r--r--scripts/config_whitelist.txt6
-rw-r--r--test/common/test_autoboot.c6
-rw-r--r--test/dm/of_platdata.c7
-rw-r--r--test/lib/strlcat.c4
-rw-r--r--test/py/tests/test_tpm2.py18
-rw-r--r--test/str_ut.c97
-rw-r--r--tools/docker/Dockerfile6
-rw-r--r--tools/dtoc/fdt.py40
-rw-r--r--tools/dtoc/test/dtoc_test_simple.dts2
-rwxr-xr-xtools/dtoc/test_dtoc.py9
-rwxr-xr-xtools/dtoc/test_fdt.py29
-rwxr-xr-xtools/moveconfig.py315
-rw-r--r--tools/patman/func_test.py11
-rw-r--r--tools/patman/patchstream.py9
426 files changed, 2591 insertions, 5000 deletions
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index c088e1ac99..15507a7357 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -2,7 +2,7 @@ variables:
windows_vm: vs2017-win2016
ubuntu_vm: ubuntu-18.04
macos_vm: macOS-10.15
- ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20210609-06Jul2021
+ ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20210723-04Aug2021
# Add '-u 0' options for Azure pipelines, otherwise we get "permission
# denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
# since our $(ci_runner_image) user is not root.
@@ -183,7 +183,7 @@ jobs:
TEST_PY_BD: "sandbox"
sandbox_clang:
TEST_PY_BD: "sandbox"
- OVERRIDE: "-O clang-10"
+ OVERRIDE: "-O clang-12"
sandbox_spl:
TEST_PY_BD: "sandbox_spl"
TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
@@ -413,11 +413,11 @@ jobs:
non_fsl_ppc:
BUILDMAN: "powerpc -x freescale"
mpc85xx_freescale:
- BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
+ BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x bsc91*"
t208xrdb_corenet_ds:
BUILDMAN: "t208xrdb corenet_ds"
fsl_ppc:
- BUILDMAN: "t4qds b4860qds mpc83xx&freescale"
+ BUILDMAN: "mpc83xx&freescale"
t102x:
BUILDMAN: "t102*"
p1_p2_rdb_pc:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 86026a15f9..ffdeaae5a8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@
# Grab our configured image. The source for this is found at:
# https://source.denx.de/u-boot/gitlab-ci-runner
-image: trini/u-boot-gitlab-ci-runner:focal-20210609-06Jul2021
+image: trini/u-boot-gitlab-ci-runner:focal-20210723-04Aug2021
# We run some tests in different order, to catch some failures quicker.
stages:
@@ -178,7 +178,7 @@ sandbox test.py:
sandbox with clang test.py:
variables:
TEST_PY_BD: "sandbox"
- OVERRIDE: "-O clang-10"
+ OVERRIDE: "-O clang-12"
<<: *buildman_and_testpy_dfn
sandbox_spl test.py:
diff --git a/Kconfig b/Kconfig
index 76c0cdacb0..a6c42b902f 100644
--- a/Kconfig
+++ b/Kconfig
@@ -343,27 +343,6 @@ config HAS_ROM
Enables building of a u-boot.rom target. This collects U-Boot and
any necessary binary blobs.
-config ROM_NEEDS_BLOBS
- bool
- depends on HAS_ROM
- help
- Enable this if building the u-boot.rom target needs binary blobs, and
- so cannot be done normally. In this case, U-Boot will only build the
- ROM if the required blobs exist. If not, you will see an warning like:
-
- Image 'main-section' is missing external blobs and is non-functional:
- intel-descriptor intel-me intel-refcode intel-vga intel-mrc
-
-config BUILD_ROM
- bool "Build U-Boot as BIOS replacement"
- depends on HAS_ROM
- default y if !ROM_NEEDS_BLOBS
- help
- This option allows to build a ROM version of U-Boot.
- The build process generally requires several binary blobs
- which are not shipped in the U-Boot source tree.
- Please, see doc/arch/x86.rst for details.
-
config SPL_IMAGE
string "SPL image used in the combined SPL+U-Boot image"
default "spl/boot.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
diff --git a/README b/README
index 4fdc49fbb9..1c1db98098 100644
--- a/README
+++ b/README
@@ -3510,47 +3510,6 @@ The signature of the callback functions is:
The return value is 0 if the variable change is accepted and 1 otherwise.
-Command Line Parsing:
-=====================
-
-There are two different command line parsers available with U-Boot:
-the old "simple" one, and the much more powerful "hush" shell:
-
-Old, simple command line parser:
---------------------------------
-
-- supports environment variables (through setenv / saveenv commands)
-- several commands on one line, separated by ';'
-- variable substitution using "... ${name} ..." syntax
-- special characters ('$', ';') can be escaped by prefixing with '\',
- for example:
- setenv bootcmd bootm \${address}
-- You can also escape text by enclosing in single apostrophes, for example:
- setenv addip 'setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname::off'
-
-Hush shell:
------------
-
-- similar to Bourne shell, with control structures like
- if...then...else...fi, for...do...done; while...do...done,
- until...do...done, ...
-- supports environment ("global") variables (through setenv / saveenv
- commands) and local shell variables (through standard shell syntax
- "name=value"); only environment variables can be used with "run"
- command
-
-General rules:
---------------
-
-(1) If a command line (or an environment variable executed by a "run"
- command) contains several commands separated by semicolon, and
- one of these commands fails, then the remaining commands will be
- executed anyway.
-
-(2) If you execute several variables with one call to run (i. e.
- calling run with a list of variables as arguments), any failing
- command will cause "run" to terminate, i. e. the remaining
- variables are not executed.
Note for Redundant Ethernet Interfaces:
=======================================
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2b7b625705..3a745ce126 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -661,6 +661,7 @@ config ARCH_EXYNOS
select DM
select DM_GPIO
select DM_I2C
+ select DM_ETH
select DM_KEYBOARD
select DM_SERIAL
select DM_SPI
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index f1624ff30a..6eb7f9c214 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -565,28 +565,28 @@ void fdt_fixup_pfe_firmware(void *blob)
if (!p)
return;
- pclassfw = (void *)simple_strtoul(p, NULL, 16);
+ pclassfw = (void *)hextoul(p, NULL);
if (!pclassfw)
return;
p = env_get("class_elf_size");
if (!p)
return;
- len_class = simple_strtoul(p, NULL, 16);
+ len_class = hextoul(p, NULL);
/* If the environment variable is not set, then exit silently */
p = env_get("tmu_elf_firmware");
if (!p)
return;
- ptmufw = (void *)simple_strtoul(p, NULL, 16);
+ ptmufw = (void *)hextoul(p, NULL);
if (!ptmufw)
return;
p = env_get("tmu_elf_size");
if (!p)
return;
- len_tmu = simple_strtoul(p, NULL, 16);
+ len_tmu = hextoul(p, NULL);
if (len_class == 0 || len_tmu == 0) {
printf("PFE FW corrupted. CLASS FW size %d, TMU FW size %d\n",
@@ -605,14 +605,14 @@ void fdt_fixup_pfe_firmware(void *blob)
if (!p)
return;
- putilfw = (void *)simple_strtoul(p, NULL, 16);
+ putilfw = (void *)hextoul(p, NULL);
if (!putilfw)
return;
p = env_get("util_elf_size");
if (!p)
return;
- len_util = simple_strtoul(p, NULL, 16);
+ len_util = hextoul(p, NULL);
if (len_util) {
printf("PFE Util PE firmware is not added to FDT.\n");
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 0562d28705..1641b65799 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -277,7 +277,7 @@ static unsigned long get_internval_val_mhz(void)
ulong interval_mhz = get_bus_freq(0) / (1000 * 1000);
if (interval)
- interval_mhz = simple_strtoul(interval, NULL, 10);
+ interval_mhz = dectoul(interval, NULL);
return interval_mhz;
}
diff --git a/arch/arm/dts/exynos5250-smdk5250.dts b/arch/arm/dts/exynos5250-smdk5250.dts
index e542a79076..afe0cca48a 100644
--- a/arch/arm/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/dts/exynos5250-smdk5250.dts
@@ -41,6 +41,7 @@
};
sromc@12250000 {
+ compatible = "samsung,exynos5-sromc";
bank = <1>;
srom-timing = <1 9 12 1 6 1 1>;
width = <2>;
diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c
index 904fddd6c0..9fd82459b2 100644
--- a/arch/arm/lib/semihosting.c
+++ b/arch/arm/lib/semihosting.c
@@ -191,7 +191,7 @@ static int do_smhload(struct cmd_tbl *cmdtp, int flag, int argc,
int ret;
char end_str[64];
- load_addr = simple_strtoul(argv[2], NULL, 16);
+ load_addr = hextoul(argv[2], NULL);
if (!load_addr)
return -1;
diff --git a/arch/arm/mach-exynos/include/mach/sromc.h b/arch/arm/mach-exynos/include/mach/sromc.h
index 15c9ccc723..ac229e0d16 100644
--- a/arch/arm/mach-exynos/include/mach/sromc.h
+++ b/arch/arm/mach-exynos/include/mach/sromc.h
@@ -33,22 +33,4 @@ struct s5p_sromc {
/* Configure the Band Width and Bank Control Regs for required SROMC Bank */
void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf);
-enum {
- FDT_SROM_PMC,
- FDT_SROM_TACP,
- FDT_SROM_TAH,
- FDT_SROM_TCOH,
- FDT_SROM_TACC,
- FDT_SROM_TCOS,
- FDT_SROM_TACS,
-
- FDT_SROM_TIMING_COUNT,
-};
-
-struct fdt_sromc {
- u8 bank; /* srom bank number */
- u8 width; /* bus width in bytes */
- unsigned int timing[FDT_SROM_TIMING_COUNT]; /* timing parameters */
-};
-
#endif /* __ASM_ARCH_SROMC_H_ */
diff --git a/arch/arm/mach-imx/cmd_dek.c b/arch/arm/mach-imx/cmd_dek.c
index b10ead1942..1e3cfee473 100644
--- a/arch/arm/mach-imx/cmd_dek.c
+++ b/arch/arm/mach-imx/cmd_dek.c
@@ -300,9 +300,9 @@ static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 4)
return CMD_RET_USAGE;
- src_addr = simple_strtoul(argv[1], NULL, 16);
- dst_addr = simple_strtoul(argv[2], NULL, 16);
- len = simple_strtoul(argv[3], NULL, 10);
+ src_addr = hextoul(argv[1], NULL);
+ dst_addr = hextoul(argv[2], NULL);
+ len = dectoul(argv[3], NULL);
return blob_encap_dek(src_addr, dst_addr, len);
}
diff --git a/arch/arm/mach-imx/cmd_mfgprot.c b/arch/arm/mach-imx/cmd_mfgprot.c
index 1430f61909..1e866b76c8 100644
--- a/arch/arm/mach-imx/cmd_mfgprot.c
+++ b/arch/arm/mach-imx/cmd_mfgprot.c
@@ -71,8 +71,8 @@ static int do_mfgprot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (argc != 4)
return CMD_RET_USAGE;
- m_addr = simple_strtoul(argv[2], NULL, 16);
- m_size = simple_strtoul(argv[3], NULL, 10);
+ m_addr = hextoul(argv[2], NULL);
+ m_size = dectoul(argv[3], NULL);
m_ptr = map_physmem(m_addr, m_size, MAP_NOCACHE);
if (!m_ptr)
return -ENOMEM;
diff --git a/arch/arm/mach-imx/cmd_nandbcb.c b/arch/arm/mach-imx/cmd_nandbcb.c
index 7157c9e979..cd51344597 100644
--- a/arch/arm/mach-imx/cmd_nandbcb.c
+++ b/arch/arm/mach-imx/cmd_nandbcb.c
@@ -1083,13 +1083,13 @@ static int do_nandbcb_bcbonly(int argc, char *const argv[])
mtd = cfg.mtd;
- cfg.boot_stream1_address = simple_strtoul(argv[2], NULL, 16);
- cfg.boot_stream1_size = simple_strtoul(argv[3], NULL, 16);
+ cfg.boot_stream1_address = hextoul(argv[2], NULL);
+ cfg.boot_stream1_size = hextoul(argv[3], NULL);
cfg.boot_stream1_size = ALIGN(cfg.boot_stream1_size, mtd->writesize);
if (argc > 5) {
- cfg.boot_stream2_address = simple_strtoul(argv[4], NULL, 16);
- cfg.boot_stream2_size = simple_strtoul(argv[5], NULL, 16);
+ cfg.boot_stream2_address = hextoul(argv[4], NULL);
+ cfg.boot_stream2_size = hextoul(argv[5], NULL);
cfg.boot_stream2_size = ALIGN(cfg.boot_stream2_size,
mtd->writesize);
}
@@ -1450,7 +1450,7 @@ static int do_nandbcb_init(int argc, char * const argv[])
if (nandbcb_set_boot_config(argc, argv, &cfg))
return CMD_RET_FAILURE;
- addr = simple_strtoul(argv[1], &endp, 16);
+ addr = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return CMD_RET_FAILURE;
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index 423b715352..8eb05c8dd6 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -283,10 +283,6 @@ u32 get_ahb_clk(void)
void arch_preboot_os(void)
{
-#if defined(CONFIG_PCIE_IMX) && !CONFIG_IS_ENABLED(DM_PCI)
- imx_pcie_remove();
-#endif
-
#if defined(CONFIG_IMX_AHCI)
struct udevice *dev;
int rc;
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 00bd157d0e..cc39e6bf56 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -609,12 +609,12 @@ static int do_authenticate_image(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], NULL, 16);
- length = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[1], NULL);
+ length = hextoul(argv[2], NULL);
if (argc == 3)
ivt_offset = get_image_ivt_offset(addr);
else
- ivt_offset = simple_strtoul(argv[3], NULL, 16);
+ ivt_offset = hextoul(argv[3], NULL);
rcode = imx_hab_authenticate_image(addr, length, ivt_offset);
if (rcode == 0)
diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c
index 6392fe267a..015267c8b2 100644
--- a/arch/arm/mach-imx/imx8/ahab.c
+++ b/arch/arm/mach-imx/imx8/ahab.c
@@ -161,7 +161,7 @@ static int do_authenticate(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
printf("Authenticate OS container at 0x%lx\n", addr);
diff --git a/arch/arm/mach-imx/imx8/snvs_security_sc.c b/arch/arm/mach-imx/imx8/snvs_security_sc.c
index 6f9b1c99fc..507b5b4231 100644
--- a/arch/arm/mach-imx/imx8/snvs_security_sc.c
+++ b/arch/arm/mach-imx/imx8/snvs_security_sc.c
@@ -638,24 +638,24 @@ static int do_snvs_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != (NB_REGISTERS + 1))
return CMD_RET_USAGE;
- conf.hp.lock = simple_strtoul(argv[++idx], NULL, 16);
- conf.hp.secvio_ctl = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.lock = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.secvio_ctl = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.tamper_filt_cfg = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.tamper_det_cfg = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.tamper_det_cfg2 = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.tamper_filt1_cfg = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.tamper_filt2_cfg = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.act_tamper1_cfg = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.act_tamper2_cfg = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.act_tamper3_cfg = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.act_tamper4_cfg = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.act_tamper5_cfg = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.act_tamper_ctl = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.act_tamper_clk_ctl = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.act_tamper_routing_ctl1 = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.act_tamper_routing_ctl2 = simple_strtoul(argv[++idx], NULL, 16);
+ conf.hp.lock = hextoul(argv[++idx], NULL);
+ conf.hp.secvio_ctl = hextoul(argv[++idx], NULL);
+ conf.lp.lock = hextoul(argv[++idx], NULL);
+ conf.lp.secvio_ctl = hextoul(argv[++idx], NULL);
+ conf.lp.tamper_filt_cfg = hextoul(argv[++idx], NULL);
+ conf.lp.tamper_det_cfg = hextoul(argv[++idx], NULL);
+ conf.lp.tamper_det_cfg2 = hextoul(argv[++idx], NULL);
+ conf.lp.tamper_filt1_cfg = hextoul(argv[++idx], NULL);
+ conf.lp.tamper_filt2_cfg = hextoul(argv[++idx], NULL);
+ conf.lp.act_tamper1_cfg = hextoul(argv[++idx], NULL);
+ conf.lp.act_tamper2_cfg = hextoul(argv[++idx], NULL);
+ conf.lp.act_tamper3_cfg = hextoul(argv[++idx], NULL);
+ conf.lp.act_tamper4_cfg = hextoul(argv[++idx], NULL);
+ conf.lp.act_tamper5_cfg = hextoul(argv[++idx], NULL);
+ conf.lp.act_tamper_ctl = hextoul(argv[++idx], NULL);
+ conf.lp.act_tamper_clk_ctl = hextoul(argv[++idx], NULL);
+ conf.lp.act_tamper_routing_ctl1 = hextoul(argv[++idx], NULL);
+ conf.lp.act_tamper_routing_ctl2 = hextoul(argv[++idx], NULL);
err = apply_snvs_config(&conf);
@@ -690,12 +690,12 @@ static int do_snvs_dgo_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != (6 + 1))
return CMD_RET_USAGE;
- conf.tamper_offset_ctl = simple_strtoul(argv[++idx], NULL, 16);
- conf.tamper_pull_ctl = simple_strtoul(argv[++idx], NULL, 16);
- conf.tamper_ana_test_ctl = simple_strtoul(argv[++idx], NULL, 16);
- conf.tamper_sensor_trim_ctl = simple_strtoul(argv[++idx], NULL, 16);
- conf.tamper_misc_ctl = simple_strtoul(argv[++idx], NULL, 16);
- conf.tamper_core_volt_mon_ctl = simple_strtoul(argv[++idx], NULL, 16);
+ conf.tamper_offset_ctl = hextoul(argv[++idx], NULL);
+ conf.tamper_pull_ctl = hextoul(argv[++idx], NULL);
+ conf.tamper_ana_test_ctl = hextoul(argv[++idx], NULL);
+ conf.tamper_sensor_trim_ctl = hextoul(argv[++idx], NULL);
+ conf.tamper_misc_ctl = hextoul(argv[++idx], NULL);
+ conf.tamper_core_volt_mon_ctl = hextoul(argv[++idx], NULL);
err = apply_snvs_dgo_config(&conf);
@@ -726,8 +726,8 @@ static int do_tamper_pin_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != (2 + 1))
return CMD_RET_USAGE;
- conf.pad = simple_strtoul(argv[++idx], NULL, 10);
- conf.mux_conf = simple_strtoul(argv[++idx], NULL, 16);
+ conf.pad = dectoul(argv[++idx], NULL);
+ conf.mux_conf = hextoul(argv[++idx], NULL);
err = apply_tamper_pin_list_config(&conf, 1);
@@ -761,8 +761,8 @@ static int do_snvs_clear_status(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != (2 + 1))
return CMD_RET_USAGE;
- conf.lp.status = simple_strtoul(argv[++idx], NULL, 16);
- conf.lp.tamper_det_status = simple_strtoul(argv[++idx], NULL, 16);
+ conf.lp.status = hextoul(argv[++idx], NULL);
+ conf.lp.tamper_det_status = hextoul(argv[++idx], NULL);
scierr = check_write_secvio_config(SC_CONF_OFFSET_OF(lp.status),
&conf.lp.status, NULL, NULL, NULL,
diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index 30fb45d48c..9ffe5ac6e3 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -180,7 +180,7 @@ static int do_bootaux(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_SUCCESS;
}
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
if (!addr)
return CMD_RET_FAILURE;
diff --git a/arch/arm/mach-imx/mx6/mp.c b/arch/arm/mach-imx/mx6/mp.c
index 2fdf070a08..de9ace083c 100644
--- a/arch/arm/mach-imx/mx6/mp.c
+++ b/arch/arm/mach-imx/mx6/mp.c
@@ -47,7 +47,7 @@ int cpu_release(u32 nr, int argc, char *const argv[])
{
uint32_t boot_addr;
- boot_addr = simple_strtoul(argv[0], NULL, 16);
+ boot_addr = hextoul(argv[0], NULL);
switch (nr) {
case 1:
diff --git a/arch/arm/mach-keystone/cmd_clock.c b/arch/arm/mach-keystone/cmd_clock.c
index 7165d666e5..72dc394df5 100644
--- a/arch/arm/mach-keystone/cmd_clock.c
+++ b/arch/arm/mach-keystone/cmd_clock.c
@@ -42,9 +42,9 @@ int do_pll_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
goto pll_cmd_usage;
- cmd_pll_data.pll_m = simple_strtoul(argv[2], NULL, 10);
- cmd_pll_data.pll_d = simple_strtoul(argv[3], NULL, 10);
- cmd_pll_data.pll_od = simple_strtoul(argv[4], NULL, 10);
+ cmd_pll_data.pll_m = dectoul(argv[2], NULL);
+ cmd_pll_data.pll_d = dectoul(argv[3], NULL);
+ cmd_pll_data.pll_od = dectoul(argv[4], NULL);
printf("Trying to set pll %d; mult %d; div %d; OD %d\n",
cmd_pll_data.pll, cmd_pll_data.pll_m,
@@ -72,7 +72,7 @@ int do_getclk_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
goto getclk_cmd_usage;
- clk = simple_strtoul(argv[1], NULL, 10);
+ clk = dectoul(argv[1], NULL);
freq = ks_clk_get_rate(clk);
if (freq)
@@ -101,7 +101,7 @@ int do_psc_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc != 3)
goto psc_cmd_usage;
- psc_module = simple_strtoul(argv[1], NULL, 10);
+ psc_module = dectoul(argv[1], NULL);
if (strcmp(argv[2], "en") == 0) {
res = psc_enable_module(psc_module);
printf("psc_enable_module(%d) - %s\n", psc_module,
diff --git a/arch/arm/mach-keystone/cmd_mon.c b/arch/arm/mach-keystone/cmd_mon.c
index 049d573473..e26296b6da 100644
--- a/arch/arm/mach-keystone/cmd_mon.c
+++ b/arch/arm/mach-keystone/cmd_mon.c
@@ -25,7 +25,7 @@ static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc,
freq = CONFIG_SYS_HZ_CLOCK;
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
header = (struct image_header *)addr;
@@ -40,7 +40,7 @@ static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc,
size);
if (argc >= 3)
- ecrypt_bm_addr = simple_strtoul(argv[2], NULL, 16);
+ ecrypt_bm_addr = hextoul(argv[2], NULL);
rcode = mon_install(load_addr, dpsc_base, freq, ecrypt_bm_addr);
printf("## installed monitor @ 0x%x, freq [%d], status %d\n",
@@ -76,8 +76,8 @@ int do_mon_power(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- core_id = simple_strtoul(argv[1], NULL, 16);
- on = simple_strtoul(argv[2], NULL, 16);
+ core_id = hextoul(argv[1], NULL);
+ on = hextoul(argv[2], NULL);
if (on)
rcode = mon_power_on(core_id, fn);
diff --git a/arch/arm/mach-kirkwood/cpu.c b/arch/arm/mach-kirkwood/cpu.c
index 339ae7fd20..3953aa9b9b 100644
--- a/arch/arm/mach-kirkwood/cpu.c
+++ b/arch/arm/mach-kirkwood/cpu.c
@@ -125,7 +125,7 @@ static void kw_sysrst_check(void)
return;
/* read sysrstdelay value */
- sysrst_dly = (u32) simple_strtoul(s, NULL, 10);
+ sysrst_dly = (u32)dectoul(s, NULL);
/* read SysRst Length counter register (bits 28:0) */
sysrst_cnt = (0x1fffffff & readl(KW_REG_SYSRST_CNT));
diff --git a/arch/arm/mach-mvebu/arm64-common.c b/arch/arm/mach-mvebu/arm64-common.c
index fa687d8abb..5357aa554d 100644
--- a/arch/arm/mach-mvebu/arm64-common.c
+++ b/arch/arm/mach-mvebu/arm64-common.c
@@ -104,10 +104,9 @@ int arch_early_init_r(void)
/* Cause the SATA device to do its early init */
uclass_first_device(UCLASS_AHCI, &dev);
-#ifdef CONFIG_DM_PCI
/* Trigger PCIe devices detection */
- pci_init();
-#endif
+ if (IS_ENABLED(CONFIG_PCI))
+ pci_init();
return 0;
}
diff --git a/arch/arm/mach-nexell/clock.c b/arch/arm/mach-nexell/clock.c
index d5b46a87a1..24fa204ccd 100644
--- a/arch/arm/mach-nexell/clock.c
+++ b/arch/arm/mach-nexell/clock.c
@@ -592,7 +592,7 @@ struct clk *clk_get(const char *id)
c = strrchr((const char *)str, (int)'.');
if (!c || !cdev->peri)
break;
- devid = simple_strtoul(++c, NULL, 10);
+ devid = dectoul(++c, NULL);
if (cdev->peri->dev_id == devid)
break;
}
diff --git a/arch/arm/mach-snapdragon/misc.c b/arch/arm/mach-snapdragon/misc.c
index aaa561c2c6..985625a548 100644
--- a/arch/arm/mach-snapdragon/misc.c
+++ b/arch/arm/mach-snapdragon/misc.c
@@ -47,7 +47,7 @@ void msm_generate_mac_addr(u8 *mac)
mac[0] = 0x02;
mac[1] = 00;
for (i = 3; i >= 0; i--) {
- mac[i + 2] = simple_strtoul(&sn[2 * i], NULL, 16);
+ mac[i + 2] = hextoul(&sn[2 * i], NULL);
sn[2 * i] = 0;
}
}
diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c
index 64a7c9d652..f8d3d48ee8 100644
--- a/arch/arm/mach-socfpga/misc.c
+++ b/arch/arm/mach-socfpga/misc.c
@@ -191,7 +191,7 @@ static int do_bridge(struct cmd_tbl *cmdtp, int flag, int argc,
argv++;
if (argc == 3)
- mask = simple_strtoul(argv[1], NULL, 16);
+ mask = hextoul(argv[1], NULL);
switch (*argv[0]) {
case 'e': /* Enable */
diff --git a/arch/arm/mach-socfpga/vab.c b/arch/arm/mach-socfpga/vab.c
index 85b3f30211..e146f2c529 100644
--- a/arch/arm/mach-socfpga/vab.c
+++ b/arch/arm/mach-socfpga/vab.c
@@ -17,8 +17,8 @@ static int do_vab(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], NULL, 16);
- len = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[1], NULL);
+ len = hextoul(argv[2], NULL);
if (socfpga_vendor_authentication((void *)&addr, (size_t *)&len) != 0)
return CMD_RET_FAILURE;
diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
index 50840b0f38..68f28922d1 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32key.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
@@ -162,7 +162,7 @@ static int do_stm32key_read(struct cmd_tbl *cmdtp, int flag, int argc, char *con
return CMD_RET_SUCCESS;
}
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
if (!addr)
return CMD_RET_USAGE;
@@ -185,7 +185,7 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
yes = true;
}
- addr = simple_strtoul(argv[argc - 1], NULL, 16);
+ addr = hextoul(argv[argc - 1], NULL);
if (!addr)
return CMD_RET_USAGE;
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
index 064f51b2c7..be53a52977 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
@@ -59,17 +59,17 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
- dev = (int)simple_strtoul(argv[2], NULL, 10);
+ dev = (int)dectoul(argv[2], NULL);
addr = STM32_DDR_BASE;
size = 0;
if (argc > 3) {
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
if (!addr)
return CMD_RET_FAILURE;
}
if (argc > 4)
- size = simple_strtoul(argv[4], NULL, 16);
+ size = hextoul(argv[4], NULL);
/* check STM32IMAGE presence */
if (size == 0) {
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
index 96ebc6d978..26fe8b654a 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
@@ -253,7 +253,7 @@ static int parse_type(struct stm32prog_data *data,
result = -EINVAL;
else
part->bin_nb =
- simple_strtoul(&p[7], NULL, 10);
+ dectoul(&p[7], NULL);
}
} else if (!strcmp(p, "System")) {
part->part_type = PART_SYSTEM;
diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c
index b33c4b1938..b5356ed87e 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -66,7 +66,7 @@ static void uniphier_set_env_addr(const char *env, const char *offset_env)
if (!str)
goto fail;
- offset = simple_strtoul(str, &end, 16);
+ offset = hextoul(str, &end);
if (*end)
goto fail;
}
diff --git a/arch/arm/mach-zynqmp/mp.c b/arch/arm/mach-zynqmp/mp.c
index 74783ae5a7..704520e7a3 100644
--- a/arch/arm/mach-zynqmp/mp.c
+++ b/arch/arm/mach-zynqmp/mp.c
@@ -252,7 +252,7 @@ int cpu_release(u32 nr, int argc, char *const argv[])
return 1;
}
- u32 boot_addr = simple_strtoul(argv[0], NULL, 16);
+ u32 boot_addr = hextoul(argv[0], NULL);
u32 boot_addr_uniq = 0;
if (!(boot_addr == ZYNQMP_R5_LOVEC_ADDR ||
boot_addr == ZYNQMP_R5_HIVEC_ADDR)) {
diff --git a/arch/mips/mach-octeon/bootoctlinux.c b/arch/mips/mach-octeon/bootoctlinux.c
index c195dc28ad..349da08da6 100644
--- a/arch/mips/mach-octeon/bootoctlinux.c
+++ b/arch/mips/mach-octeon/bootoctlinux.c
@@ -281,8 +281,7 @@ int octeon_parse_bootopts(int argc, char *const argv[],
} else if (!strncmp(argv[arg], "forceboot", 9)) {
boot_args->forceboot = true;
} else if (!strncmp(argv[arg], "nodemask=", 9)) {
- boot_args->node_mask = simple_strtoul(argv[arg] + 9,
- NULL, 16);
+ boot_args->node_mask = hextoul(argv[arg] + 9, NULL);
} else if (!strncmp(argv[arg], "numcores=", 9)) {
memset(node_values, 0, sizeof(node_values));
num_values = octeon_parse_nodes(node_values,
@@ -383,7 +382,7 @@ int do_bootoctlinux(struct cmd_tbl *cmdtp, int flag, int argc,
argv[1][1] == 'x' ||
argv[1][1] == 'X' ||
argv[1][1] == '\0'))) {
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
if (!addr)
addr = CONFIG_SYS_LOAD_ADDR;
arg_start++;
diff --git a/arch/nds32/include/asm/arch-ag102/ag102.h b/arch/nds32/include/asm/arch-ag102/ag102.h
index d1f4b02e10..3255db6592 100644
--- a/arch/nds32/include/asm/arch-ag102/ag102.h
+++ b/arch/nds32/include/asm/arch-ag102/ag102.h
@@ -11,8 +11,6 @@
* Hardware register bases
*/
-/* PCI Controller */
-#define CONFIG_FTPCI100_BASE 0x90000000
/* LPC Controller */
#define CONFIG_LPC_IO_BASE 0x90100000
/* LPC Controller */
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index b3b8bc2903..4cb0f530ae 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -64,7 +64,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
s = env_get("machid");
if (s) {
- machid = simple_strtoul(s, NULL, 16);
+ machid = hextoul(s, NULL);
printf("Using machid 0x%x from environment\n", machid);
}
diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index 2c8f9731c7..5037467151 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -27,7 +27,7 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
of_flat_tree = images->ft_addr;
#endif
if (!of_flat_tree && argc > 1)
- of_flat_tree = (char *)simple_strtoul(argv[1], NULL, 16);
+ of_flat_tree = (char *)hextoul(argv[1], NULL);
if (of_flat_tree)
initrd_end = (ulong)of_flat_tree;
diff --git a/arch/powerpc/cpu/mpc83xx/ecc.c b/arch/powerpc/cpu/mpc83xx/ecc.c
index 1343dd3d3a..7a8ec7f42f 100644
--- a/arch/powerpc/cpu/mpc83xx/ecc.c
+++ b/arch/powerpc/cpu/mpc83xx/ecc.c
@@ -138,7 +138,7 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (argc == 3) {
if (strcmp(argv[1], "sbecnt") == 0) {
- val = simple_strtoul(argv[2], NULL, 10);
+ val = dectoul(argv[2], NULL);
if (val > 255) {
printf("Incorrect Counter value, "
"should be 0..255\n");
@@ -151,7 +151,7 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
ddr->err_sbe = val;
return 0;
} else if (strcmp(argv[1], "sbethr") == 0) {
- val = simple_strtoul(argv[2], NULL, 10);
+ val = dectoul(argv[2], NULL);
if (val > 255) {
printf("Incorrect Counter value, "
"should be 0..255\n");
@@ -219,17 +219,17 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
ddr->err_detect = val;
return 0;
} else if (strcmp(argv[1], "injectdatahi") == 0) {
- val = simple_strtoul(argv[2], NULL, 16);
+ val = hextoul(argv[2], NULL);
ddr->data_err_inject_hi = val;
return 0;
} else if (strcmp(argv[1], "injectdatalo") == 0) {
- val = simple_strtoul(argv[2], NULL, 16);
+ val = hextoul(argv[2], NULL);
ddr->data_err_inject_lo = val;
return 0;
} else if (strcmp(argv[1], "injectecc") == 0) {
- val = simple_strtoul(argv[2], NULL, 16);
+ val = hextoul(argv[2], NULL);
if (val > 0xff) {
printf("Incorrect ECC inject mask, "
"should be 0x00..0xff\n");
@@ -269,8 +269,8 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (argc == 4) {
if (strcmp(argv[1], "testdw") == 0) {
- addr = (u64 *) simple_strtoul(argv[2], NULL, 16);
- count = simple_strtoul(argv[3], NULL, 16);
+ addr = (u64 *)hextoul(argv[2], NULL);
+ count = hextoul(argv[3], NULL);
if ((u32) addr % 8) {
printf("Address not aligned on "
@@ -308,8 +308,8 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 0;
}
if (strcmp(argv[1], "testword") == 0) {
- addr = (u64 *) simple_strtoul(argv[2], NULL, 16);
- count = simple_strtoul(argv[3], NULL, 16);
+ addr = (u64 *)hextoul(argv[2], NULL);
+ count = hextoul(argv[3], NULL);
if ((u32) addr % 8) {
printf("Address not aligned on "
diff --git a/arch/powerpc/cpu/mpc83xx/pci.c b/arch/powerpc/cpu/mpc83xx/pci.c
index 507ab3417b..65ef0497c2 100644
--- a/arch/powerpc/cpu/mpc83xx/pci.c
+++ b/arch/powerpc/cpu/mpc83xx/pci.c
@@ -27,166 +27,6 @@ DECLARE_GLOBAL_DATA_PTR;
static struct pci_controller pci_hose[MAX_BUSES];
static int pci_num_buses;
-#if !defined(CONFIG_DM_PCI)
-static void pci_init_bus(int bus, struct pci_region *reg)
-{
- volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
- volatile pot83xx_t *pot = immr->ios.pot;
- volatile pcictrl83xx_t *pci_ctrl = &immr->pci_ctrl[bus];
- struct pci_controller *hose = &pci_hose[bus];
- u32 dev;
- u16 reg16;
- int i;
-
- if (bus == 1)
- pot += 3;
-
- /* Setup outbound translation windows */
- for (i = 0; i < 3; i++, reg++, pot++) {
- if (reg->size == 0)
- break;
-
- hose->regions[i] = *reg;
- hose->region_count++;
-
- pot->potar = reg->bus_start >> 12;
- pot->pobar = reg->phys_start >> 12;
- pot->pocmr = ~(reg->size - 1) >> 12;
-
- if (reg->flags & PCI_REGION_IO)
- pot->pocmr |= POCMR_IO;
-#ifdef CONFIG_83XX_PCI_STREAMING
- else if (reg->flags & PCI_REGION_PREFETCH)
- pot->pocmr |= POCMR_SE;
-#endif
-
- if (bus == 1)
- pot->pocmr |= POCMR_DST;
-
- pot->pocmr |= POCMR_EN;
- }
-
- /* Point inbound translation at RAM */
- pci_ctrl->pitar1 = 0;
- pci_ctrl->pibar1 = 0;
- pci_ctrl->piebar1 = 0;
- pci_ctrl->piwar1 = PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP |
- PIWAR_WTT_SNOOP | (__ilog2(gd->ram_size - 1));
-
- i = hose->region_count++;
- hose->regions[i].bus_start = 0;
- hose->regions[i].phys_start = 0;
- hose->regions[i].size = gd->ram_size;
- hose->regions[i].flags = PCI_REGION_MEM | PCI_REGION_SYS_MEMORY;
-
- hose->first_busno = pci_last_busno() + 1;
- hose->last_busno = 0xff;
-
- pci_setup_indirect(hose, CONFIG_SYS_IMMR + 0x8300 + bus * 0x80,
- CONFIG_SYS_IMMR + 0x8304 + bus * 0x80);
-
- pci_register_hose(hose);
-
- /*
- * Write to Command register
- */
- reg16 = 0xff;
- dev = PCI_BDF(hose->first_busno, 0, 0);
- pci_hose_read_config_word(hose, dev, PCI_COMMAND, &reg16);
- reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
- pci_hose_write_config_word(hose, dev, PCI_COMMAND, reg16);
-
- /*
- * Clear non-reserved bits in status register.
- */
- pci_hose_write_config_word(hose, dev, PCI_STATUS, 0xffff);
- pci_hose_write_config_byte(hose, dev, PCI_LATENCY_TIMER, 0x80);
- pci_hose_write_config_byte(hose, dev, PCI_CACHE_LINE_SIZE, 0x08);
-
-#ifdef CONFIG_PCI_SCAN_SHOW
- printf("PCI: Bus Dev VenId DevId Class Int\n");
-#endif
-#ifndef CONFIG_PCISLAVE
- /*
- * Hose scan.
- */
- hose->last_busno = pci_hose_scan(hose);
-#endif
-}
-
-/*
- * The caller must have already set OCCR, and the PCI_LAW BARs
- * must have been set to cover all of the requested regions.
- *
- * If fewer than three regions are requested, then the region
- * list is terminated with a region of size 0.
- */
-void mpc83xx_pci_init(int num_buses, struct pci_region **reg)
-{
- volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
- int i;
-
- if (num_buses > MAX_BUSES) {
- printf("%d PCI buses requested, %d supported\n",
- num_buses, MAX_BUSES);
-
- num_buses = MAX_BUSES;
- }
-
- pci_num_buses = num_buses;
-
- /*
- * Release PCI RST Output signal.
- * Power on to RST high must be at least 100 ms as per PCI spec.
- * On warm boots only 1 ms is required, but we play it safe.
- */
- udelay(100000);
-
- for (i = 0; i < num_buses; i++)
- immr->pci_ctrl[i].gcr = 1;
-
- /*
- * RST high to first config access must be at least 2^25 cycles
- * as per PCI spec. This could be cut in half if we know we're
- * running at 66MHz. This could be insufficiently long if we're
- * running the PCI bus at significantly less than 33MHz.
- */
- udelay(1020000);
-
- for (i = 0; i < num_buses; i++)
- pci_init_bus(i, reg[i]);
-}
-
-#ifdef CONFIG_PCISLAVE
-
-#define PCI_FUNCTION_CONFIG 0x44
-#define PCI_FUNCTION_CFG_LOCK 0x20
-
-/*
- * Unlock the configuration bit so that the host system can begin booting
- *
- * This should be used after you have:
- * 1) Called mpc83xx_pci_init()
- * 2) Set up your inbound translation windows to the appropriate size
- */
-void mpc83xx_pcislave_unlock(int bus)
-{
- struct pci_controller *hose = &pci_hose[bus];
- u32 dev;
- u16 reg16;
-
- /* Unlock configuration lock in PCI function configuration register */
- dev = PCI_BDF(hose->first_busno, 0, 0);
- pci_hose_read_config_word (hose, dev, PCI_FUNCTION_CONFIG, &reg16);
- reg16 &= ~(PCI_FUNCTION_CFG_LOCK);
- pci_hose_write_config_word (hose, dev, PCI_FUNCTION_CONFIG, reg16);
-
- /* The configuration bit is now unlocked, so we can scan the bus */
- hose->last_busno = pci_hose_scan(hose);
-}
-#endif
-#endif /* CONFIG_DM_PCI */
-
#if defined(CONFIG_OF_LIBFDT)
void ft_pci_setup(void *blob, struct bd_info *bd)
{
diff --git a/arch/powerpc/cpu/mpc85xx/Makefile b/arch/powerpc/cpu/mpc85xx/Makefile
index 993e487318..15248a4082 100644
--- a/arch/powerpc/cpu/mpc85xx/Makefile
+++ b/arch/powerpc/cpu/mpc85xx/Makefile
@@ -33,7 +33,6 @@ obj-$(CONFIG_CPM2) += ether_fcc.o
obj-$(CONFIG_OF_LIBFDT) += fdt.o
obj-$(CONFIG_FSL_CORENET) += liodn.o
obj-$(CONFIG_MP) += mp.o
-obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_SYS_DPAA_QBMAN) += portals.o
# various SoC specific assignments
diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c
index 653efe09f9..b1b002c900 100644
--- a/arch/powerpc/cpu/mpc85xx/mp.c
+++ b/arch/powerpc/cpu/mpc85xx/mp.c
@@ -167,7 +167,7 @@ int cpu_release(u32 nr, int argc, char *const argv[])
for (i = 1; i < 3; i++) {
if (argv[i][0] != '-') {
u8 entry = boot_entry_map[i];
- val = simple_strtoul(argv[i], NULL, 16);
+ val = hextoul(argv[i], NULL);
table[entry] = val;
}
}
diff --git a/arch/powerpc/cpu/mpc85xx/pci.c b/arch/powerpc/cpu/mpc85xx/pci.c
deleted file mode 100644
index b7835c0fee..0000000000
--- a/arch/powerpc/cpu/mpc85xx/pci.c
+++ /dev/null
@@ -1,191 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2004 Freescale Semiconductor.
- * Copyright (C) 2003 Motorola Inc.
- * Xianghua Xiao (x.xiao@motorola.com)
- */
-
-/*
- * PCI Configuration space access support for MPC85xx PCI Bridge
- */
-#include <common.h>
-#include <asm/bitops.h>
-#include <asm/cpm_85xx.h>
-#include <pci.h>
-
-#if !defined(CONFIG_FSL_PCI_INIT) && !defined(CONFIG_DM_PCI)
-
-#ifndef CONFIG_SYS_PCI1_MEM_BUS
-#define CONFIG_SYS_PCI1_MEM_BUS CONFIG_SYS_PCI1_MEM_BASE
-#endif
-
-#ifndef CONFIG_SYS_PCI1_IO_BUS
-#define CONFIG_SYS_PCI1_IO_BUS CONFIG_SYS_PCI1_IO_BASE
-#endif
-
-#ifndef CONFIG_SYS_PCI2_MEM_BUS
-#define CONFIG_SYS_PCI2_MEM_BUS CONFIG_SYS_PCI2_MEM_BASE
-#endif
-
-#ifndef CONFIG_SYS_PCI2_IO_BUS
-#define CONFIG_SYS_PCI2_IO_BUS CONFIG_SYS_PCI2_IO_BASE
-#endif
-
-static struct pci_controller *pci_hose;
-
-void
-pci_mpc85xx_init(struct pci_controller *board_hose)
-{
- u16 reg16;
- u32 dev;
-
- volatile ccsr_pcix_t *pcix = (void *)(CONFIG_SYS_MPC85xx_PCIX_ADDR);
-#ifdef CONFIG_MPC85XX_PCI2
- volatile ccsr_pcix_t *pcix2 = (void *)(CONFIG_SYS_MPC85xx_PCIX2_ADDR);
-#endif
- volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
- struct pci_controller * hose;
-
- pci_hose = board_hose;
-
- hose = &pci_hose[0];
-
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- pci_setup_indirect(hose,
- (CONFIG_SYS_IMMR+0x8000),
- (CONFIG_SYS_IMMR+0x8004));
-
- /*
- * Hose scan.
- */
- dev = PCI_BDF(hose->first_busno, 0, 0);
- pci_hose_read_config_word (hose, dev, PCI_COMMAND, &reg16);
- reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
- pci_hose_write_config_word(hose, dev, PCI_COMMAND, reg16);
-
- /*
- * Clear non-reserved bits in status register.
- */
- pci_hose_write_config_word(hose, dev, PCI_STATUS, 0xffff);
-
- if (!(gur->pordevsr & MPC85xx_PORDEVSR_PCI1)) {
- /* PCI-X init */
- if (CONFIG_SYS_CLK_FREQ < 66000000)
- printf("PCI-X will only work at 66 MHz\n");
-
- reg16 = PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ
- | PCI_X_CMD_ERO | PCI_X_CMD_DPERR_E;
- pci_hose_write_config_word(hose, dev, PCIX_COMMAND, reg16);
- }
-
- pcix->potar1 = (CONFIG_SYS_PCI1_MEM_BUS >> 12) & 0x000fffff;
- pcix->potear1 = 0x00000000;
- pcix->powbar1 = (CONFIG_SYS_PCI1_MEM_PHYS >> 12) & 0x000fffff;
- pcix->powbear1 = 0x00000000;
- pcix->powar1 = (POWAR_EN | POWAR_MEM_READ |
- POWAR_MEM_WRITE | (__ilog2(CONFIG_SYS_PCI1_MEM_SIZE) - 1));
-
- pcix->potar2 = (CONFIG_SYS_PCI1_IO_BUS >> 12) & 0x000fffff;
- pcix->potear2 = 0x00000000;
- pcix->powbar2 = (CONFIG_SYS_PCI1_IO_PHYS >> 12) & 0x000fffff;
- pcix->powbear2 = 0x00000000;
- pcix->powar2 = (POWAR_EN | POWAR_IO_READ |
- POWAR_IO_WRITE | (__ilog2(CONFIG_SYS_PCI1_IO_SIZE) - 1));
-
- pcix->pitar1 = 0x00000000;
- pcix->piwbar1 = 0x00000000;
- pcix->piwar1 = (PIWAR_EN | PIWAR_PF | PIWAR_LOCAL |
- PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP | PIWAR_MEM_2G);
-
- pcix->powar3 = 0;
- pcix->powar4 = 0;
- pcix->piwar2 = 0;
- pcix->piwar3 = 0;
-
- pci_set_region(hose->regions + 0,
- CONFIG_SYS_PCI1_MEM_BUS,
- CONFIG_SYS_PCI1_MEM_PHYS,
- CONFIG_SYS_PCI1_MEM_SIZE,
- PCI_REGION_MEM);
-
- pci_set_region(hose->regions + 1,
- CONFIG_SYS_PCI1_IO_BUS,
- CONFIG_SYS_PCI1_IO_PHYS,
- CONFIG_SYS_PCI1_IO_SIZE,
- PCI_REGION_IO);
-
- hose->region_count = 2;
-
- pci_register_hose(hose);
-
- hose->last_busno = pci_hose_scan(hose);
-
-#ifdef CONFIG_MPC85XX_PCI2
- hose = &pci_hose[1];
-
- hose->first_busno = pci_hose[0].last_busno + 1;
- hose->last_busno = 0xff;
-
- pci_setup_indirect(hose,
- (CONFIG_SYS_IMMR+0x9000),
- (CONFIG_SYS_IMMR+0x9004));
-
- dev = PCI_BDF(hose->first_busno, 0, 0);
- pci_hose_read_config_word (hose, dev, PCI_COMMAND, &reg16);
- reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
- pci_hose_write_config_word(hose, dev, PCI_COMMAND, reg16);
-
- /*
- * Clear non-reserved bits in status register.
- */
- pci_hose_write_config_word(hose, dev, PCI_STATUS, 0xffff);
-
- pcix2->potar1 = (CONFIG_SYS_PCI2_MEM_BUS >> 12) & 0x000fffff;
- pcix2->potear1 = 0x00000000;
- pcix2->powbar1 = (CONFIG_SYS_PCI2_MEM_PHYS >> 12) & 0x000fffff;
- pcix2->powbear1 = 0x00000000;
- pcix2->powar1 = (POWAR_EN | POWAR_MEM_READ |
- POWAR_MEM_WRITE | (__ilog2(CONFIG_SYS_PCI2_MEM_SIZE) - 1));
-
- pcix2->potar2 = (CONFIG_SYS_PCI2_IO_BUS >> 12) & 0x000fffff;
- pcix2->potear2 = 0x00000000;
- pcix2->powbar2 = (CONFIG_SYS_PCI2_IO_PHYS >> 12) & 0x000fffff;
- pcix2->powbear2 = 0x00000000;
- pcix2->powar2 = (POWAR_EN | POWAR_IO_READ |
- POWAR_IO_WRITE | (__ilog2(CONFIG_SYS_PCI2_IO_SIZE) - 1));
-
- pcix2->pitar1 = 0x00000000;
- pcix2->piwbar1 = 0x00000000;
- pcix2->piwar1 = (PIWAR_EN | PIWAR_PF | PIWAR_LOCAL |
- PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP | PIWAR_MEM_2G);
-
- pcix2->powar3 = 0;
- pcix2->powar4 = 0;
- pcix2->piwar2 = 0;
- pcix2->piwar3 = 0;
-
- pci_set_region(hose->regions + 0,
- CONFIG_SYS_PCI2_MEM_BUS,
- CONFIG_SYS_PCI2_MEM_PHYS,
- CONFIG_SYS_PCI2_MEM_SIZE,
- PCI_REGION_MEM);
-
- pci_set_region(hose->regions + 1,
- CONFIG_SYS_PCI2_IO_BUS,
- CONFIG_SYS_PCI2_IO_PHYS,
- CONFIG_SYS_PCI2_IO_SIZE,
- PCI_REGION_IO);
-
- hose->region_count = 2;
-
- /*
- * Hose scan.
- */
- pci_register_hose(hose);
-
- hose->last_busno = pci_hose_scan(hose);
-#endif
-}
-#endif /* !CONFIG_FSL_PCI_INIT */
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 777db4e952..a74f5ec7ba 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -400,6 +400,15 @@ static int sandbox_cmdline_cb_signals(struct sandbox_state *state,
SANDBOX_CMDLINE_OPT_SHORT(signals, 'S', 0,
"Handle signals (such as SIGSEGV) in sandbox");
+static int sandbox_cmdline_cb_autoboot_keyed(struct sandbox_state *state,
+ const char *arg)
+{
+ state->autoboot_keyed = true;
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT(autoboot_keyed, 0, "Allow keyed autoboot");
+
static void setup_ram_buf(struct sandbox_state *state)
{
/* Zero the RAM buffer if we didn't read it, to keep valgrind happy */
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index a4d99bade4..4e822538ba 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <autoboot.h>
#include <bloblist.h>
#include <errno.h>
#include <fdtdec.h>
@@ -378,6 +379,23 @@ void state_reset_for_test(struct sandbox_state *state)
state->next_tag = state->ram_size;
}
+bool autoboot_keyed(void)
+{
+ struct sandbox_state *state = state_get_current();
+
+ return IS_ENABLED(CONFIG_AUTOBOOT_KEYED) && state->autoboot_keyed;
+}
+
+bool autoboot_set_keyed(bool autoboot_keyed)
+{
+ struct sandbox_state *state = state_get_current();
+ bool old_val = state->autoboot_keyed;
+
+ state->autoboot_keyed = autoboot_keyed;
+
+ return old_val;
+}
+
int state_init(void)
{
state = &main_state;
diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi
index 31db50db35..200fcab6a4 100644
--- a/arch/sandbox/dts/sandbox.dtsi
+++ b/arch/sandbox/dts/sandbox.dtsi
@@ -231,6 +231,7 @@
boolval;
intval = <1>;
intarray = <2 3 4>;
+ maybe-empty-int = <>;
byteval = [05];
bytearray = [06];
longbytearray = [09 0a 0b 0c 0d 0e 0f 10 11];
@@ -254,6 +255,7 @@
u-boot,dm-pre-reloc;
compatible = "sandbox,spl-test";
stringarray = "one";
+ maybe-empty-int = <1>;
};
spl-test5 {
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index 1c4c571e28..10352a587e 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -94,6 +94,7 @@ struct sandbox_state {
bool run_unittests; /* Run unit tests */
const char *select_unittests; /* Unit test to run */
bool handle_signals; /* Handle signals within sandbox */
+ bool autoboot_keyed; /* Use keyed-autoboot feature */
/* Pointer to information for each SPI bus/cs */
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
diff --git a/arch/sh/lib/zimageboot.c b/arch/sh/lib/zimageboot.c
index c38f0933f8..c2e285ff0f 100644
--- a/arch/sh/lib/zimageboot.c
+++ b/arch/sh/lib/zimageboot.c
@@ -37,11 +37,12 @@ int do_sh_zimageboot(struct cmd_tbl *cmdtp, int flag, int argc,
}
if (s0)
- zboot_entry = (ulong (*)(int, char * const []))simple_strtoul(s0, NULL, 16);
+ zboot_entry = (ulong (*)(int, char * const []))hextoul(s0,
+ NULL);
/* empty_zero_page */
if (s1)
- param = (unsigned char*)simple_strtoul(s1, NULL, 16);
+ param = (unsigned char *)hextoul(s1, NULL);
/* Linux kernel command line */
cmdline = (char *)param + COMMAND_LINE;
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 970bdff37f..300b48505e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -364,7 +364,6 @@ config HAVE_FSP
depends on !EFI
select USE_HOB
select HAS_ROM
- select ROM_NEEDS_BLOBS
help
Select this option to add an Firmware Support Package binary to
the resulting U-Boot image. It is a binary blob which U-Boot uses
@@ -525,7 +524,6 @@ config ENABLE_MRC_CACHE
config HAVE_MRC
bool "Add a System Agent binary"
select HAS_ROM
- select ROM_NEEDS_BLOBS
depends on !HAVE_FSP
help
Select this option to add a System Agent binary to
diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c
index 166aff380c..260a008093 100644
--- a/arch/x86/cpu/mtrr.c
+++ b/arch/x86/cpu/mtrr.c
@@ -26,6 +26,7 @@
#include <asm/mp.h>
#include <asm/msr.h>
#include <asm/mtrr.h>
+#include <linux/log2.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -155,12 +156,8 @@ int mtrr_commit(bool do_caches)
debug("open done\n");
qsort(req, gd->arch.mtrr_req_count, sizeof(*req), h_comp_mtrr);
for (i = 0; i < gd->arch.mtrr_req_count; i++, req++)
- set_var_mtrr(i, req->type, req->start, req->size);
+ mtrr_set_next_var(req->type, req->start, req->size);
- /* Clear the ones that are unused */
- debug("clear\n");
- for (; i < mtrr_get_var_count(); i++)
- wrmsrl(MTRR_PHYS_MASK_MSR(i), 0);
debug("close\n");
mtrr_close(&state, do_caches);
debug("mtrr done\n");
@@ -183,6 +180,9 @@ int mtrr_add_request(int type, uint64_t start, uint64_t size)
if (!gd->arch.has_mtrr)
return -ENOSYS;
+ if (!is_power_of_2(size))
+ return -EINVAL;
+
if (gd->arch.mtrr_req_count == MAX_MTRR_REQUESTS)
return -ENOSPC;
req = &gd->arch.mtrr_req[gd->arch.mtrr_req_count++];
@@ -227,6 +227,9 @@ int mtrr_set_next_var(uint type, uint64_t start, uint64_t size)
{
int mtrr;
+ if (!is_power_of_2(size))
+ return -EINVAL;
+
mtrr = get_free_var_mtrr();
if (mtrr < 0)
return mtrr;
diff --git a/arch/x86/cpu/quark/Kconfig b/arch/x86/cpu/quark/Kconfig
index 2fee38aed7..61bb5792c8 100644
--- a/arch/x86/cpu/quark/Kconfig
+++ b/arch/x86/cpu/quark/Kconfig
@@ -24,7 +24,6 @@ if INTEL_QUARK
config HAVE_RMU
bool "Add a Remote Management Unit (RMU) binary"
- select ROM_NEEDS_BLOBS
help
Select this option to add a Remote Management Unit (RMU) binary
to the resulting U-Boot image. It is a data block (up to 64K) of
@@ -131,8 +130,8 @@ config SYS_CAR_SIZE
Space in bytes in eSRAM used as Cache-As-ARM (CAR).
Note this size must not exceed eSRAM's total size.
-config X86_TSC_TIMER_EARLY_FREQ
+config X86_TSC_TIMER_FREQ
int
- default 400
+ default 400000000
endif
diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c
index 782ed863fe..4a008622d1 100644
--- a/arch/x86/cpu/queensbay/tnc.c
+++ b/arch/x86/cpu/queensbay/tnc.c
@@ -18,19 +18,17 @@
static int __maybe_unused disable_igd(void)
{
- struct udevice *igd, *sdvo;
+ struct udevice *igd = NULL;
+ struct udevice *sdvo = NULL;
int ret;
- ret = dm_pci_bus_find_bdf(TNC_IGD, &igd);
- if (ret)
- return ret;
- if (!igd)
- return 0;
-
- ret = dm_pci_bus_find_bdf(TNC_SDVO, &sdvo);
- if (ret)
- return ret;
- if (!sdvo)
+ /*
+ * In case the IGD and SDVO devices were already in disabled state,
+ * we should return and not proceed any further.
+ */
+ dm_pci_bus_find_bdf(TNC_IGD, &igd);
+ dm_pci_bus_find_bdf(TNC_SDVO, &sdvo);
+ if (!igd || !sdvo)
return 0;
/*
diff --git a/arch/x86/cpu/tangier/acpi.c b/arch/x86/cpu/tangier/acpi.c
index 41bd177e09..82f4ce5a34 100644
--- a/arch/x86/cpu/tangier/acpi.c
+++ b/arch/x86/cpu/tangier/acpi.c
@@ -89,8 +89,8 @@ static u32 acpi_fill_csrt_dma(struct acpi_csrt_group *grp)
si->mmio_base_low = 0xff192000;
si->mmio_base_high = 0;
si->gsi_interrupt = 32;
- si->interrupt_polarity = 1;
- si->interrupt_mode = 0;
+ si->interrupt_polarity = 0; /* Active High */
+ si->interrupt_mode = 0; /* Level triggered */
si->num_channels = 8;
si->dma_address_width = 32;
si->base_request_line = 0;
diff --git a/arch/x86/dts/bayleybay.dts b/arch/x86/dts/bayleybay.dts
index 70e5798403..b92729dd0b 100644
--- a/arch/x86/dts/bayleybay.dts
+++ b/arch/x86/dts/bayleybay.dts
@@ -14,8 +14,8 @@
/include/ "serial.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -176,6 +176,7 @@
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
+ m25p,fast-read;
compatible = "winbond,w25q64dw",
"jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
diff --git a/arch/x86/dts/baytrail_som-db5800-som-6867.dts b/arch/x86/dts/baytrail_som-db5800-som-6867.dts
index a7dc03b645..e9b56de792 100644
--- a/arch/x86/dts/baytrail_som-db5800-som-6867.dts
+++ b/arch/x86/dts/baytrail_som-db5800-som-6867.dts
@@ -14,8 +14,8 @@
/include/ "serial.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -200,6 +200,7 @@
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
+ m25p,fast-read;
compatible = "macronix,mx25l6405d",
"jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
diff --git a/arch/x86/dts/cherryhill.dts b/arch/x86/dts/cherryhill.dts
index 2ce7f1aa91..7a273670bd 100644
--- a/arch/x86/dts/cherryhill.dts
+++ b/arch/x86/dts/cherryhill.dts
@@ -12,8 +12,8 @@
/include/ "serial.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -149,6 +149,7 @@
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
+ m25p,fast-read;
compatible = "macronix,mx25u6435f", "jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
rw-mrc-cache {
diff --git a/arch/x86/dts/chromebook_coral.dts b/arch/x86/dts/chromebook_coral.dts
index 66c31efb6c..f0caaacfee 100644
--- a/arch/x86/dts/chromebook_coral.dts
+++ b/arch/x86/dts/chromebook_coral.dts
@@ -8,7 +8,8 @@
/include/ "keyboard.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+
+#include "tsc_timer.dtsi"
#if defined(CONFIG_CHROMEOS_VBOOT) && defined(CONFIG_ROM_SIZE)
#include "chromeos-x86.dtsi"
@@ -362,6 +363,7 @@
u-boot,dm-pre-proper;
u-boot,dm-spl;
reg = <0>;
+ m25p,fast-read;
compatible = "winbond,w25q128fw",
"jedec,spi-nor";
rw-mrc-cache {
diff --git a/arch/x86/dts/chromebook_link.dts b/arch/x86/dts/chromebook_link.dts
index e529c4b63e..11ff520ac2 100644
--- a/arch/x86/dts/chromebook_link.dts
+++ b/arch/x86/dts/chromebook_link.dts
@@ -9,8 +9,8 @@
/include/ "serial.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -430,6 +430,7 @@
#address-cells = <1>;
u-boot,dm-pre-reloc;
reg = <0>;
+ m25p,fast-read;
compatible = "winbond,w25q64",
"jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
diff --git a/arch/x86/dts/chromebook_samus.dts b/arch/x86/dts/chromebook_samus.dts
index ad35ab2e3f..930ec1ace0 100644
--- a/arch/x86/dts/chromebook_samus.dts
+++ b/arch/x86/dts/chromebook_samus.dts
@@ -7,8 +7,8 @@
/include/ "serial.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
#if defined(CONFIG_CHROMEOS_VBOOT) && defined(CONFIG_ROM_SIZE)
@@ -594,6 +594,7 @@
#size-cells = <1>;
#address-cells = <1>;
reg = <0>;
+ m25p,fast-read;
compatible = "winbond,w25q64",
"jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
diff --git a/arch/x86/dts/chromebox_panther.dts b/arch/x86/dts/chromebox_panther.dts
index 77b6ac9ab9..b25f759c79 100644
--- a/arch/x86/dts/chromebox_panther.dts
+++ b/arch/x86/dts/chromebox_panther.dts
@@ -4,8 +4,8 @@
/include/ "serial.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -48,6 +48,7 @@
#size-cells = <1>;
#address-cells = <1>;
reg = <0>;
+ m25p,fast-read;
compatible = "winbond,w25q64",
"jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
diff --git a/arch/x86/dts/conga-qeval20-qa3-e3845.dts b/arch/x86/dts/conga-qeval20-qa3-e3845.dts
index bbea99da2c..705157ceaa 100644
--- a/arch/x86/dts/conga-qeval20-qa3-e3845.dts
+++ b/arch/x86/dts/conga-qeval20-qa3-e3845.dts
@@ -14,8 +14,8 @@
/include/ "serial.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -187,6 +187,7 @@
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
+ m25p,fast-read;
compatible = "stmicro,n25q064a",
"jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
diff --git a/arch/x86/dts/coreboot.dts b/arch/x86/dts/coreboot.dts
index 38ddaafa19..d21978d6e0 100644
--- a/arch/x86/dts/coreboot.dts
+++ b/arch/x86/dts/coreboot.dts
@@ -12,7 +12,8 @@
/include/ "pcspkr.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+
+#include "tsc_timer.dtsi"
/ {
model = "coreboot x86 payload";
@@ -30,10 +31,6 @@
stdout-path = "/serial";
};
- tsc-timer {
- clock-frequency = <1000000000>;
- };
-
pci {
compatible = "pci-x86";
u-boot,dm-pre-reloc;
diff --git a/arch/x86/dts/cougarcanyon2.dts b/arch/x86/dts/cougarcanyon2.dts
index 602523333e..58395b5eb6 100644
--- a/arch/x86/dts/cougarcanyon2.dts
+++ b/arch/x86/dts/cougarcanyon2.dts
@@ -12,8 +12,8 @@
/include/ "keyboard.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -156,6 +156,7 @@
spi-flash@0 {
reg = <0>;
+ m25p,fast-read;
compatible = "winbond,w25q64bv", "jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
};
diff --git a/arch/x86/dts/crownbay.dts b/arch/x86/dts/crownbay.dts
index a7166a9749..5768352531 100644
--- a/arch/x86/dts/crownbay.dts
+++ b/arch/x86/dts/crownbay.dts
@@ -13,8 +13,8 @@
/include/ "pcspkr.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
diff --git a/arch/x86/dts/dfi-bt700.dtsi b/arch/x86/dts/dfi-bt700.dtsi
index 7d7b8357d9..dff2345d60 100644
--- a/arch/x86/dts/dfi-bt700.dtsi
+++ b/arch/x86/dts/dfi-bt700.dtsi
@@ -198,6 +198,7 @@
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
+ m25p,fast-read;
compatible = "stmicro,n25q064a",
"jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
diff --git a/arch/x86/dts/edison.dts b/arch/x86/dts/edison.dts
index 8d245bffc2..64b6228363 100644
--- a/arch/x86/dts/edison.dts
+++ b/arch/x86/dts/edison.dts
@@ -10,8 +10,8 @@
/include/ "skeleton.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
diff --git a/arch/x86/dts/efi-x86_app.dts b/arch/x86/dts/efi-x86_app.dts
index 20150f6ede..04e044a07a 100644
--- a/arch/x86/dts/efi-x86_app.dts
+++ b/arch/x86/dts/efi-x86_app.dts
@@ -6,7 +6,8 @@
/dts-v1/;
/include/ "skeleton.dtsi"
-/include/ "tsc_timer.dtsi"
+
+#include "tsc_timer.dtsi"
/ {
model = "EFI x86 Application";
@@ -16,10 +17,6 @@
stdout-path = &serial;
};
- tsc-timer {
- clock-frequency = <1000000000>;
- };
-
serial: serial {
compatible = "efi,uart";
};
diff --git a/arch/x86/dts/efi-x86_payload.dts b/arch/x86/dts/efi-x86_payload.dts
index 5ccb986774..087865f225 100644
--- a/arch/x86/dts/efi-x86_payload.dts
+++ b/arch/x86/dts/efi-x86_payload.dts
@@ -12,7 +12,8 @@
/include/ "keyboard.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+
+#include "tsc_timer.dtsi"
/ {
model = "EFI x86 Payload";
@@ -30,10 +31,6 @@
stdout-path = "/serial";
};
- tsc-timer {
- clock-frequency = <1000000000>;
- };
-
pci {
compatible = "pci-x86";
u-boot,dm-pre-reloc;
diff --git a/arch/x86/dts/galileo.dts b/arch/x86/dts/galileo.dts
index 501047124e..4120e8f5c4 100644
--- a/arch/x86/dts/galileo.dts
+++ b/arch/x86/dts/galileo.dts
@@ -11,7 +11,8 @@
/include/ "skeleton.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+
+#include "tsc_timer.dtsi"
/ {
model = "Intel Galileo";
@@ -41,10 +42,6 @@
};
};
- tsc-timer {
- clock-frequency = <400000000>;
- };
-
mrc {
compatible = "intel,quark-mrc";
flags = <MRC_FLAG_SCRAMBLE_EN>;
diff --git a/arch/x86/dts/minnowmax.dts b/arch/x86/dts/minnowmax.dts
index 133d55bc20..68e0510c68 100644
--- a/arch/x86/dts/minnowmax.dts
+++ b/arch/x86/dts/minnowmax.dts
@@ -13,8 +13,8 @@
/include/ "serial.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -200,6 +200,7 @@
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
+ m25p,fast-read;
compatible = "stmicro,n25q064a",
"jedec,spi-nor";
memory-map = <0xff800000 0x00800000>;
diff --git a/arch/x86/dts/qemu-x86_i440fx.dts b/arch/x86/dts/qemu-x86_i440fx.dts
index c33a11d593..6556e9ebcd 100644
--- a/arch/x86/dts/qemu-x86_i440fx.dts
+++ b/arch/x86/dts/qemu-x86_i440fx.dts
@@ -12,8 +12,8 @@
/include/ "keyboard.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -42,10 +42,6 @@
};
};
- tsc-timer {
- clock-frequency = <1000000000>;
- };
-
pci {
compatible = "pci-x86";
#address-cells = <3>;
diff --git a/arch/x86/dts/qemu-x86_q35.dts b/arch/x86/dts/qemu-x86_q35.dts
index 9faae7fb56..d0830892e8 100644
--- a/arch/x86/dts/qemu-x86_q35.dts
+++ b/arch/x86/dts/qemu-x86_q35.dts
@@ -22,8 +22,8 @@
/include/ "keyboard.dtsi"
/include/ "reset.dtsi"
/include/ "rtc.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
#include "smbios.dtsi"
/ {
@@ -53,10 +53,6 @@
};
};
- tsc-timer {
- clock-frequency = <1000000000>;
- };
-
pci {
compatible = "pci-x86";
#address-cells = <3>;
diff --git a/arch/x86/dts/slimbootloader.dts b/arch/x86/dts/slimbootloader.dts
index d04095c4f8..9b581c8489 100644
--- a/arch/x86/dts/slimbootloader.dts
+++ b/arch/x86/dts/slimbootloader.dts
@@ -7,7 +7,7 @@
/include/ "skeleton.dtsi"
/include/ "reset.dtsi"
-/include/ "tsc_timer.dtsi"
+#include "tsc_timer.dtsi"
/ {
model = "slimbootloader x86 payload";
diff --git a/arch/x86/dts/tsc_timer.dtsi b/arch/x86/dts/tsc_timer.dtsi
index 4f5021d96f..4df8e9d7fc 100644
--- a/arch/x86/dts/tsc_timer.dtsi
+++ b/arch/x86/dts/tsc_timer.dtsi
@@ -1,6 +1,7 @@
/ {
tsc-timer {
compatible = "x86,tsc-timer";
+ clock-frequency = <CONFIG_X86_TSC_TIMER_FREQ>;
u-boot,dm-pre-reloc;
};
};
diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index 384672e93f..d1aa86bf1d 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -119,7 +119,7 @@ void mtrr_close(struct mtrr_state *state, bool do_caches);
*
* @type: Requested type (MTRR_TYPE_)
* @start: Start address
- * @size: Size
+ * @size: Size, must be power of 2
*
* @return: 0 on success, non-zero on failure
*/
@@ -144,8 +144,9 @@ int mtrr_commit(bool do_caches);
*
* @type: Requested type (MTRR_TYPE_)
* @start: Start address
- * @size: Size
- * @return 0 on success, -ENOSPC if there are no more MTRRs
+ * @size: Size, must be power of 2
+ * @return 0 on success, -EINVAL if size is not power of 2,
+ * -ENOSPC if there are no more MTRRs
*/
int mtrr_set_next_var(uint type, uint64_t base, uint64_t size);
diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c
index 6365b0a50a..82f7d3ab5f 100644
--- a/arch/x86/lib/fsp/fsp_common.c
+++ b/arch/x86/lib/fsp/fsp_common.c
@@ -61,22 +61,6 @@ void board_final_init(void)
debug("OK\n");
}
-void board_final_cleanup(void)
-{
- u32 status;
-
- /* TODO(sjg@chromium.org): This causes Linux to crash */
- return;
-
- /* call into FspNotify */
- debug("Calling into FSP (notify phase INIT_PHASE_END_FIRMWARE): ");
- status = fsp_notify(NULL, INIT_PHASE_END_FIRMWARE);
- if (status)
- debug("fail, error code %x\n", status);
- else
- debug("OK\n");
-}
-
int fsp_save_s3_stack(void)
{
struct udevice *dev;
diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c
index 8ad9aeedac..2bd408d0c5 100644
--- a/arch/x86/lib/fsp/fsp_dram.c
+++ b/arch/x86/lib/fsp/fsp_dram.c
@@ -48,12 +48,28 @@ int dram_init_banksize(void)
phys_addr_t mtrr_top;
phys_addr_t low_end;
uint bank;
+ bool update_mtrr;
+
+ /*
+ * For FSP1, the system memory and reserved memory used by FSP are
+ * already programmed in the MTRR by FSP. Also it is observed that
+ * FSP on Intel Queensbay platform reports the TSEG memory range
+ * that has the same RES_MEM_RESERVED resource type whose address
+ * is programmed by FSP to be near the top of 4 GiB space, which is
+ * not what we want for DRAM.
+ *
+ * However it seems FSP2's behavior is different. We need to add the
+ * DRAM range in MTRR otherwise the boot process goes very slowly,
+ * which was observed on Chrromebook Coral with FSP2.
+ */
+ update_mtrr = CONFIG_IS_ENABLED(FSP_VERSION2);
if (!ll_boot_init()) {
gd->bd->bi_dram[0].start = 0;
gd->bd->bi_dram[0].size = gd->ram_size;
- mtrr_add_request(MTRR_TYPE_WRBACK, 0, gd->ram_size);
+ if (update_mtrr)
+ mtrr_add_request(MTRR_TYPE_WRBACK, 0, gd->ram_size);
return 0;
}
@@ -76,8 +92,10 @@ int dram_init_banksize(void)
} else {
gd->bd->bi_dram[bank].start = res_desc->phys_start;
gd->bd->bi_dram[bank].size = res_desc->len;
- mtrr_add_request(MTRR_TYPE_WRBACK, res_desc->phys_start,
- res_desc->len);
+ if (update_mtrr)
+ mtrr_add_request(MTRR_TYPE_WRBACK,
+ res_desc->phys_start,
+ res_desc->len);
log_debug("ram %llx %llx\n",
gd->bd->bi_dram[bank].start,
gd->bd->bi_dram[bank].size);
@@ -92,7 +110,8 @@ int dram_init_banksize(void)
* Set up an MTRR to the top of low, reserved memory. This is necessary
* for graphics to run at full speed in U-Boot.
*/
- mtrr_add_request(MTRR_TYPE_WRBACK, 0, mtrr_top);
+ if (update_mtrr)
+ mtrr_add_request(MTRR_TYPE_WRBACK, 0, mtrr_top);
return 0;
}
diff --git a/arch/x86/lib/fsp2/fsp_common.c b/arch/x86/lib/fsp2/fsp_common.c
index f69456e43a..20c3f6406a 100644
--- a/arch/x86/lib/fsp2/fsp_common.c
+++ b/arch/x86/lib/fsp2/fsp_common.c
@@ -6,8 +6,25 @@
#include <common.h>
#include <init.h>
+#include <asm/fsp/fsp_support.h>
int arch_fsp_init(void)
{
return 0;
}
+
+void board_final_cleanup(void)
+{
+ u32 status;
+
+ /* TODO(sjg@chromium.org): This causes Linux to crash */
+ return;
+
+ /* call into FspNotify */
+ debug("Calling into FSP (notify phase INIT_PHASE_END_FIRMWARE): ");
+ status = fsp_notify(NULL, INIT_PHASE_END_FIRMWARE);
+ if (status)
+ debug("fail, error code %x\n", status);
+ else
+ debug("OK\n");
+}
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index cf4210cd4b..9938c80a42 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -405,17 +405,17 @@ static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc,
}
if (s)
- state.bzimage_addr = simple_strtoul(s, NULL, 16);
+ state.bzimage_addr = hextoul(s, NULL);
if (argc >= 3) {
/* argv[2] holds the size of the bzImage */
- state.bzimage_size = simple_strtoul(argv[2], NULL, 16);
+ state.bzimage_size = hextoul(argv[2], NULL);
}
if (argc >= 4)
- state.initrd_addr = simple_strtoul(argv[3], NULL, 16);
+ state.initrd_addr = hextoul(argv[3], NULL);
if (argc >= 5)
- state.initrd_size = simple_strtoul(argv[4], NULL, 16);
+ state.initrd_size = hextoul(argv[4], NULL);
if (argc >= 6) {
/*
* When the base_ptr is passed in, we assume that the image is
@@ -428,7 +428,7 @@ static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc,
* load address and set bzimage_addr to 0 so we know that it
* cannot be proceesed (or processed again).
*/
- state.base_ptr = (void *)simple_strtoul(argv[5], NULL, 16);
+ state.base_ptr = (void *)hextoul(argv[5], NULL);
state.load_address = state.bzimage_addr;
state.bzimage_addr = 0;
}
@@ -702,7 +702,7 @@ static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc,
struct boot_params *base_ptr = state.base_ptr;
if (argc > 1)
- base_ptr = (void *)simple_strtoul(argv[1], NULL, 16);
+ base_ptr = (void *)hextoul(argv[1], NULL);
if (!base_ptr) {
printf("No zboot setup_base\n");
return CMD_RET_FAILURE;
@@ -749,7 +749,7 @@ int do_zboot_parent(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc > 1) {
char *endp;
- simple_strtoul(argv[1], &endp, 16);
+ hextoul(argv[1], &endp);
/*
* endp pointing to nul means that argv[1] was just a valid
* number, so pass it along to the normal processing
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index 24d1d57ec4..ee8a9e0a5e 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -52,7 +52,7 @@ void spi_set_speed(struct spi_slave *slave, uint hz)
*/
int name_to_gpio(const char *name)
{
- int gpio = 31 - simple_strtoul(name, NULL, 10);
+ int gpio = 31 - dectoul(name, NULL);
if (gpio < 16)
gpio = -1;
diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c b/board/BuS/eb_cpu5282/eb_cpu5282.c
index 144a08922b..b739bc3ca6 100644
--- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c
@@ -194,13 +194,13 @@ int drv_video_init(void)
printf("Init Video as ");
s = env_get("displaywidth");
if (s != NULL)
- display_width = simple_strtoul(s, NULL, 10);
+ display_width = dectoul(s, NULL);
else
display_width = 256;
s = env_get("displayheight");
if (s != NULL)
- display_height = simple_strtoul(s, NULL, 10);
+ display_height = dectoul(s, NULL);
else
display_height = 256;
@@ -214,7 +214,7 @@ int drv_video_init(void)
#ifdef CONFIG_SPLASH_SCREEN
s = env_get("splashimage");
if (s != NULL) {
- splash = simple_strtoul(s, NULL, 16);
+ splash = hextoul(s, NULL);
vcxk_acknowledge_wait();
video_display_bitmap(splash, 0, 0);
}
@@ -234,8 +234,8 @@ int do_brightness(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
switch (argc) {
case 3:
- side = simple_strtoul(argv[1], NULL, 10);
- bright = simple_strtoul(argv[2], NULL, 10);
+ side = dectoul(argv[1], NULL);
+ bright = dectoul(argv[2], NULL);
if ((side >= 0) && (side <= 3) &&
(bright >= 0) && (bright <= 1000)) {
vcxk_setbrightness(side, bright);
diff --git a/board/Marvell/octeontx2/board.c b/board/Marvell/octeontx2/board.c
index 9b973a4ace..4e8cb839f5 100644
--- a/board/Marvell/octeontx2/board.c
+++ b/board/Marvell/octeontx2/board.c
@@ -230,7 +230,7 @@ static int do_go_uboot(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
fdt = board_fdt_blob_setup();
entry = (uboot_entry_t)addr;
flush_cache((ulong)addr, 1 << 20); /* 1MiB should be enough */
diff --git a/board/amlogic/beelink-s922x/beelink-s922x.c b/board/amlogic/beelink-s922x/beelink-s922x.c
index bb74426266..adae27fc7e 100644
--- a/board/amlogic/beelink-s922x/beelink-s922x.c
+++ b/board/amlogic/beelink-s922x/beelink-s922x.c
@@ -39,7 +39,7 @@ int misc_init_r(void)
tmp[0] = efuse_mac_addr[i * 2];
tmp[1] = efuse_mac_addr[i * 2 + 1];
tmp[2] = '\0';
- mac_addr[i] = simple_strtoul(tmp, NULL, 16);
+ mac_addr[i] = hextoul(tmp, NULL);
}
if (is_valid_ethaddr(mac_addr))
diff --git a/board/amlogic/odroid-n2/odroid-n2.c b/board/amlogic/odroid-n2/odroid-n2.c
index 88a60f34fe..c37ea65417 100644
--- a/board/amlogic/odroid-n2/odroid-n2.c
+++ b/board/amlogic/odroid-n2/odroid-n2.c
@@ -126,7 +126,7 @@ int misc_init_r(void)
tmp[0] = efuse_mac_addr[i * 2];
tmp[1] = efuse_mac_addr[i * 2 + 1];
tmp[2] = '\0';
- mac_addr[i] = simple_strtoul(tmp, NULL, 16);
+ mac_addr[i] = hextoul(tmp, NULL);
}
if (is_valid_ethaddr(mac_addr))
diff --git a/board/amlogic/vim3/vim3.c b/board/amlogic/vim3/vim3.c
index 18ef146218..5d9ac6458d 100644
--- a/board/amlogic/vim3/vim3.c
+++ b/board/amlogic/vim3/vim3.c
@@ -166,7 +166,7 @@ int misc_init_r(void)
tmp[0] = efuse_mac_addr[i * 2];
tmp[1] = efuse_mac_addr[i * 2 + 1];
tmp[2] = '\0';
- mac_addr[i] = simple_strtoul(tmp, NULL, 16);
+ mac_addr[i] = hextoul(tmp, NULL);
}
if (is_valid_ethaddr(mac_addr))
diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c
index eee5c357bd..c93c0e52e3 100644
--- a/board/atmel/common/board.c
+++ b/board/atmel/common/board.c
@@ -47,7 +47,7 @@ void at91_pda_detect(void)
break;
}
}
- pda = simple_strtoul((const char *)buf, NULL, 10);
+ pda = dectoul((const char *)buf, NULL);
switch (pda) {
case 7000:
diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c
index e217b95b4f..35c89850be 100644
--- a/board/bluewater/gurnard/gurnard.c
+++ b/board/bluewater/gurnard/gurnard.c
@@ -376,7 +376,7 @@ int board_late_init(void)
/* Parse MAC address */
for (i = 0; i < 6; i++) {
env_enetaddr[i] = env_str ?
- simple_strtoul(env_str, &end, 16) : 0;
+ hextoul(env_str, &end) : 0;
if (env_str)
env_str = (*end) ? end+1 : end;
}
diff --git a/board/cavium/thunderx/atf.c b/board/cavium/thunderx/atf.c
index 64aa198765..1a039c53c1 100644
--- a/board/cavium/thunderx/atf.c
+++ b/board/cavium/thunderx/atf.c
@@ -235,48 +235,48 @@ int do_atf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
char str[4 * sizeof(uint64_t)];
if ((argc == 5) && !strcmp(argv[1], "readmmc")) {
- buffer = (void *)simple_strtoul(argv[2], NULL, 16);
- offset = simple_strtoul(argv[3], NULL, 10);
- size = simple_strtoul(argv[4], NULL, 10);
+ buffer = (void *)hextoul(argv[2], NULL);
+ offset = dectoul(argv[3], NULL);
+ size = dectoul(argv[4], NULL);
ret = atf_read_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "readnor")) {
- buffer = (void *)simple_strtoul(argv[2], NULL, 16);
- offset = simple_strtoul(argv[3], NULL, 10);
- size = simple_strtoul(argv[4], NULL, 10);
+ buffer = (void *)hextoul(argv[2], NULL);
+ offset = dectoul(argv[3], NULL);
+ size = dectoul(argv[4], NULL);
ret = atf_read_nor(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writemmc")) {
- buffer = (void *)simple_strtoul(argv[2], NULL, 16);
- offset = simple_strtoul(argv[3], NULL, 10);
- size = simple_strtoul(argv[4], NULL, 10);
+ buffer = (void *)hextoul(argv[2], NULL);
+ offset = dectoul(argv[3], NULL);
+ size = dectoul(argv[4], NULL);
ret = atf_write_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writenor")) {
- buffer = (void *)simple_strtoul(argv[2], NULL, 16);
- offset = simple_strtoul(argv[3], NULL, 10);
- size = simple_strtoul(argv[4], NULL, 10);
+ buffer = (void *)hextoul(argv[2], NULL);
+ offset = dectoul(argv[3], NULL);
+ size = dectoul(argv[4], NULL);
ret = atf_write_nor(offset, buffer, size);
} else if ((argc == 2) && !strcmp(argv[1], "part")) {
atf_print_part_table();
} else if ((argc == 4) && !strcmp(argv[1], "erasenor")) {
- offset = simple_strtoul(argv[2], NULL, 10);
- size = simple_strtoul(argv[3], NULL, 10);
+ offset = dectoul(argv[2], NULL);
+ size = dectoul(argv[3], NULL);
ret = atf_erase_nor(offset, size);
} else if ((argc == 2) && !strcmp(argv[1], "envcount")) {
ret = atf_env_count();
printf("Number of environment strings: %zd\n", ret);
} else if ((argc == 3) && !strcmp(argv[1], "envstring")) {
- index = simple_strtoul(argv[2], NULL, 10);
+ index = dectoul(argv[2], NULL);
ret = atf_env_string(index, str);
if (ret > 0)
printf("Environment string %d: %s\n", index, str);
else
printf("Return code: %zd\n", ret);
} else if ((argc == 3) && !strcmp(argv[1], "dramsize")) {
- node = simple_strtoul(argv[2], NULL, 10);
+ node = dectoul(argv[2], NULL);
ret = atf_dram_size(node);
printf("DRAM size: %zd Mbytes\n", ret >> 20);
} else if ((argc == 2) && !strcmp(argv[1], "nodes")) {
diff --git a/board/cavium/thunderx/thunderx.c b/board/cavium/thunderx/thunderx.c
index a7dc5c6aeb..a8f8c78558 100644
--- a/board/cavium/thunderx/thunderx.c
+++ b/board/cavium/thunderx/thunderx.c
@@ -123,10 +123,3 @@ int board_eth_init(struct bd_info *bis)
return rc;
}
-
-#ifdef CONFIG_PCI
-void pci_init_board(void)
-{
- printf("DEBUG: PCI Init TODO *****\n");
-}
-#endif
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index 5206cf5c0a..b41c64d2a3 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -153,7 +153,7 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus)
*/
if (cl_eeprom_layout == LAYOUT_LEGACY) {
sprintf(str, "%x", board_rev);
- board_rev = simple_strtoul(str, NULL, 10);
+ board_rev = dectoul(str, NULL);
}
return board_rev;
diff --git a/board/compulab/common/omap3_display.c b/board/compulab/common/omap3_display.c
index cb9ebae7f9..4ed3b9c00a 100644
--- a/board/compulab/common/omap3_display.c
+++ b/board/compulab/common/omap3_display.c
@@ -244,7 +244,7 @@ static int parse_pixclock(char *pixclock)
int divisor, pixclock_val;
char *pixclk_start = pixclock;
- pixclock_val = simple_strtoul(pixclock, &pixclock, 10);
+ pixclock_val = dectoul(pixclock, &pixclock);
divisor = DIV_ROUND_UP(PIXEL_CLK_NUMERATOR, pixclock_val);
/* 0 and 1 are illegal values for PCD */
if (divisor <= 1)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 383a861738..6c75231ddf 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -284,7 +284,7 @@ u32 get_board_rev(void)
s = env_get("maxcpuclk");
if (s)
- maxcpuclk = simple_strtoul(s, NULL, 10);
+ maxcpuclk = dectoul(s, NULL);
if (maxcpuclk >= 456000000)
rev = 3;
diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c
index eaa525eb00..a3eee63e37 100644
--- a/board/esd/meesc/meesc.c
+++ b/board/esd/meesc/meesc.c
@@ -208,7 +208,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
str = strchr(serial, '_');
if (str && (strlen(str) >= 4)) {
serialnr->high = (*(str + 1) << 8) | *(str + 2);
- serialnr->low = simple_strtoul(str + 3, NULL, 16);
+ serialnr->low = hextoul(str + 3, NULL);
}
} else {
serialnr->high = 0;
diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
index 116c1e71cc..3a171688c3 100644
--- a/board/freescale/common/Makefile
+++ b/board/freescale/common/Makefile
@@ -63,7 +63,6 @@ obj-$(CONFIG_TARGET_P3041DS) += ics307_clk.o
obj-$(CONFIG_TARGET_P4080DS) += ics307_clk.o
obj-$(CONFIG_TARGET_P5040DS) += ics307_clk.o
obj-$(CONFIG_VSC_CROSSBAR) += vsc3316_3308.o
-obj-$(CONFIG_IDT8T49N222A) += idt8t49n222a_serdes_clk.o
obj-$(CONFIG_ZM7300) += zm7300.o
obj-$(CONFIG_POWER_PFUZE100) += pfuze.o
obj-$(CONFIG_DM_PMIC_PFUZE100) += pfuze.o
diff --git a/board/freescale/common/cds_pci_ft.c b/board/freescale/common/cds_pci_ft.c
index be97a28ed2..dc2d62850d 100644
--- a/board/freescale/common/cds_pci_ft.c
+++ b/board/freescale/common/cds_pci_ft.c
@@ -9,68 +9,9 @@
#include "cadmus.h"
#if defined(CONFIG_OF_BOARD_SETUP)
-#if defined(CONFIG_PCI) && !defined(CONFIG_DM_PCI)
-static void cds_pci_fixup(void *blob)
-{
- int node;
- const char *path;
- int len, slot, i;
- u32 *map = NULL, *piccells = NULL;
- int off, cells;
-
- node = fdt_path_offset(blob, "/aliases");
- if (node >= 0) {
- path = fdt_getprop(blob, node, "pci0", NULL);
- if (path) {
- node = fdt_path_offset(blob, path);
- if (node >= 0) {
- map = fdt_getprop_w(blob, node, "interrupt-map", &len);
- }
- /* Each item in "interrupt-map" property is translated with
- * following cells:
- * PCI #address-cells, PCI #interrupt-cells,
- * PIC address, PIC #address-cells, PIC #interrupt-cells.
- */
- cells = fdt_getprop_u32_default(blob, path, "#address-cells", 1);
- cells += fdt_getprop_u32_default(blob, path, "#interrupt-cells", 1);
- off = fdt_node_offset_by_phandle(blob, fdt32_to_cpu(*(map+cells)));
- if (off <= 0)
- return;
- cells += 1;
- piccells = (u32 *)fdt_getprop(blob, off, "#address-cells", NULL);
- if (piccells == NULL)
- return;
- cells += *piccells;
- piccells = (u32 *)fdt_getprop(blob, off, "#interrupt-cells", NULL);
- if (piccells == NULL)
- return;
- cells += *piccells;
- }
- }
-
- if (map) {
- len /= sizeof(u32);
-
- slot = get_pci_slot();
-
- for (i=0;i<len;i+=cells) {
- /* We rotate the interrupt pins so that the mapping
- * changes depending on the slot the carrier card is in.
- */
- map[3] = ((map[3] + slot - 2) % 4) + 1;
- map+=cells;
- }
- }
-}
-#endif
-
int ft_board_setup(void *blob, struct bd_info *bd)
{
ft_cpu_setup(blob, bd);
-#if defined(CONFIG_PCI) && !defined(CONFIG_DM_PCI)
- ft_pci_setup(blob, bd);
- cds_pci_fixup(blob);
-#endif
return 0;
}
diff --git a/board/freescale/common/cmd_esbc_validate.c b/board/freescale/common/cmd_esbc_validate.c
index 638aa3c19a..6c096266b4 100644
--- a/board/freescale/common/cmd_esbc_validate.c
+++ b/board/freescale/common/cmd_esbc_validate.c
@@ -40,7 +40,7 @@ static int do_esbc_validate(struct cmd_tbl *cmdtp, int flag, int argc,
hash_str = argv[2];
/* First argument - header address -32/64bit */
- haddr = (uintptr_t)simple_strtoul(argv[1], NULL, 16);
+ haddr = (uintptr_t)hextoul(argv[1], NULL);
/* With esbc_validate command, Image address must be
* part of header. So, the function is called
diff --git a/board/freescale/common/fsl_validate.c b/board/freescale/common/fsl_validate.c
index 564a8b3b54..066aa9a7c3 100644
--- a/board/freescale/common/fsl_validate.c
+++ b/board/freescale/common/fsl_validate.c
@@ -767,7 +767,7 @@ static inline int str2longbe(const char *p, ulong *num)
if (!p) {
return 0;
} else {
- tmp = simple_strtoul(p, &endptr, 16);
+ tmp = hextoul(p, &endptr);
if (sizeof(ulong) == 4)
*num = cpu_to_be32(tmp);
else
diff --git a/board/freescale/common/idt8t49n222a_serdes_clk.c b/board/freescale/common/idt8t49n222a_serdes_clk.c
deleted file mode 100644
index bb3cdac841..0000000000
--- a/board/freescale/common/idt8t49n222a_serdes_clk.c
+++ /dev/null
@@ -1,208 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2013 Freescale Semiconductor, Inc.
- * Author: Shaveta Leekha <shaveta@freescale.com>
- */
-
-#include "idt8t49n222a_serdes_clk.h"
-#include <log.h>
-#include <linux/delay.h>
-
-#define DEVICE_ID_REG 0x00
-
-static int check_pll_status(u8 idt_addr)
-{
- u8 val = 0;
- int ret;
-
- ret = i2c_read(idt_addr, 0x17, 1, &val, 1);
- if (ret < 0) {
- printf("IDT:0x%x could not read status register from device.\n",
- idt_addr);
- return ret;
- }
-
- if (val & 0x04) {
- debug("idt8t49n222a PLL is LOCKED: %x\n", val);
- } else {
- printf("idt8t49n222a PLL is not LOCKED: %x\n", val);
- return -1;
- }
-
- return 0;
-}
-
-int set_serdes_refclk(u8 idt_addr, u8 serdes_num,
- enum serdes_refclk refclk1,
- enum serdes_refclk refclk2, u8 feedback)
-{
- u8 dev_id = 0;
- int i, ret;
-
- debug("IDT:Configuring idt8t49n222a device at I2C address: 0x%2x\n",
- idt_addr);
-
- ret = i2c_read(idt_addr, DEVICE_ID_REG, 1, &dev_id, 1);
- if (ret < 0) {
- debug("IDT:0x%x could not read DEV_ID from device.\n",
- idt_addr);
- return ret;
- }
-
- if ((dev_id != 0x00) && (dev_id != 0x24) && (dev_id != 0x2a)) {
- debug("IDT: device at address 0x%x is not idt8t49n222a.\n",
- idt_addr);
- }
-
- if (serdes_num != 1 && serdes_num != 2) {
- debug("serdes_num should be 1 for SerDes1 and"
- " 2 for SerDes2.\n");
- return -1;
- }
-
- if ((refclk1 == SERDES_REFCLK_122_88 && refclk2 != SERDES_REFCLK_122_88)
- || (refclk1 != SERDES_REFCLK_122_88
- && refclk2 == SERDES_REFCLK_122_88)) {
- debug("Only one refclk at 122.88MHz is not supported."
- " Please set both refclk1 & refclk2 to 122.88MHz"
- " or both not to 122.88MHz.\n");
- return -1;
- }
-
- if (refclk1 != SERDES_REFCLK_100 && refclk1 != SERDES_REFCLK_122_88
- && refclk1 != SERDES_REFCLK_125
- && refclk1 != SERDES_REFCLK_156_25) {
- debug("refclk1 should be 100MHZ, 122.88MHz, 125MHz"
- " or 156.25MHz.\n");
- return -1;
- }
-
- if (refclk2 != SERDES_REFCLK_100 && refclk2 != SERDES_REFCLK_122_88
- && refclk2 != SERDES_REFCLK_125
- && refclk2 != SERDES_REFCLK_156_25) {
- debug("refclk2 should be 100MHZ, 122.88MHz, 125MHz"
- " or 156.25MHz.\n");
- return -1;
- }
-
- if (feedback != 0 && feedback != 1) {
- debug("valid values for feedback are 0(default) or 1.\n");
- return -1;
- }
-
- /* Configuring IDT for output refclks as
- * Refclk1 = 122.88MHz Refclk2 = 122.88MHz
- */
- if (refclk1 == SERDES_REFCLK_122_88 &&
- refclk2 == SERDES_REFCLK_122_88) {
- printf("Setting refclk1:122.88 and refclk2:122.88\n");
- for (i = 0; i < NUM_IDT_REGS; i++)
- i2c_reg_write(idt_addr, idt_conf_122_88[i][0],
- idt_conf_122_88[i][1]);
-
- if (feedback) {
- for (i = 0; i < NUM_IDT_REGS_FEEDBACK; i++)
- i2c_reg_write(idt_addr,
- idt_conf_122_88_feedback[i][0],
- idt_conf_122_88_feedback[i][1]);
- }
- }
-
- if (refclk1 != SERDES_REFCLK_122_88 &&
- refclk2 != SERDES_REFCLK_122_88) {
- for (i = 0; i < NUM_IDT_REGS; i++)
- i2c_reg_write(idt_addr, idt_conf_not_122_88[i][0],
- idt_conf_not_122_88[i][1]);
- }
-
- /* Configuring IDT for output refclks as
- * Refclk1 = 100MHz Refclk2 = 125MHz
- */
- if (refclk1 == SERDES_REFCLK_100 && refclk2 == SERDES_REFCLK_125) {
- printf("Setting refclk1:100 and refclk2:125\n");
- i2c_reg_write(idt_addr, 0x11, 0x10);
- }
-
- /* Configuring IDT for output refclks as
- * Refclk1 = 125MHz Refclk2 = 125MHz
- */
- if (refclk1 == SERDES_REFCLK_125 && refclk2 == SERDES_REFCLK_125) {
- printf("Setting refclk1:125 and refclk2:125\n");
- i2c_reg_write(idt_addr, 0x10, 0x10);
- i2c_reg_write(idt_addr, 0x11, 0x10);
- }
-
- /* Configuring IDT for output refclks as
- * Refclk1 = 125MHz Refclk2 = 100MHz
- */
- if (refclk1 == SERDES_REFCLK_125 && refclk2 == SERDES_REFCLK_100) {
- printf("Setting refclk1:125 and refclk2:100\n");
- i2c_reg_write(idt_addr, 0x10, 0x10);
- }
-
- /* Configuring IDT for output refclks as
- * Refclk1 = 156.25MHz Refclk2 = 156.25MHz
- */
- if (refclk1 == SERDES_REFCLK_156_25 &&
- refclk2 == SERDES_REFCLK_156_25) {
- printf("Setting refclk1:156.25 and refclk2:156.25\n");
- for (i = 0; i < NUM_IDT_REGS_156_25; i++)
- i2c_reg_write(idt_addr, idt_conf_156_25[i][0],
- idt_conf_156_25[i][1]);
- }
-
- /* Configuring IDT for output refclks as
- * Refclk1 = 100MHz Refclk2 = 156.25MHz
- */
- if (refclk1 == SERDES_REFCLK_100 &&
- refclk2 == SERDES_REFCLK_156_25) {
- printf("Setting refclk1:100 and refclk2:156.25\n");
- for (i = 0; i < NUM_IDT_REGS_156_25; i++)
- i2c_reg_write(idt_addr, idt_conf_100_156_25[i][0],
- idt_conf_100_156_25[i][1]);
- }
-
- /* Configuring IDT for output refclks as
- * Refclk1 = 125MHz Refclk2 = 156.25MHz
- */
- if (refclk1 == SERDES_REFCLK_125 &&
- refclk2 == SERDES_REFCLK_156_25) {
- printf("Setting refclk1:125 and refclk2:156.25\n");
- for (i = 0; i < NUM_IDT_REGS_156_25; i++)
- i2c_reg_write(idt_addr, idt_conf_125_156_25[i][0],
- idt_conf_125_156_25[i][1]);
- }
-
- /* Configuring IDT for output refclks as
- * Refclk1 = 156.25MHz Refclk2 = 100MHz
- */
- if (refclk1 == SERDES_REFCLK_156_25 &&
- refclk2 == SERDES_REFCLK_100) {
- printf("Setting refclk1:156.25 and refclk2:100\n");
- for (i = 0; i < NUM_IDT_REGS_156_25; i++)
- i2c_reg_write(idt_addr, idt_conf_156_25_100[i][0],
- idt_conf_156_25_100[i][1]);
- }
-
- /* Configuring IDT for output refclks as
- * Refclk1 = 156.25MHz Refclk2 = 125MHz
- */
- if (refclk1 == SERDES_REFCLK_156_25 &&
- refclk2 == SERDES_REFCLK_125) {
- printf("Setting refclk1:156.25 and refclk2:125\n");
- for (i = 0; i < NUM_IDT_REGS_156_25; i++)
- i2c_reg_write(idt_addr, idt_conf_156_25_125[i][0],
- idt_conf_156_25_125[i][1]);
- }
-
- /* waiting for maximum of 1 second if PLL doesn'r get locked
- * initially. then check the status again.
- */
- if (check_pll_status(idt_addr)) {
- mdelay(1000);
- if (check_pll_status(idt_addr))
- return -1;
- }
-
- return 0;
-}
diff --git a/board/freescale/common/idt8t49n222a_serdes_clk.h b/board/freescale/common/idt8t49n222a_serdes_clk.h
deleted file mode 100644
index b1528e3266..0000000000
--- a/board/freescale/common/idt8t49n222a_serdes_clk.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2013 Freescale Semiconductor, Inc.
- * Author: Shaveta Leekha <shaveta@freescale.com>
- */
-
-#ifndef __IDT8T49N222A_SERDES_CLK_H_
-#define __IDT8T49N222A_SERDES_CLK_H_ 1
-
-#include <common.h>
-#include <i2c.h>
-#include "qixis.h"
-#include "../b4860qds/b4860qds_qixis.h"
-#include <errno.h>
-
-#define NUM_IDT_REGS 23
-#define NUM_IDT_REGS_FEEDBACK 12
-#define NUM_IDT_REGS_156_25 11
-
-/* CLK */
-enum serdes_refclk {
- SERDES_REFCLK_100, /* refclk 100Mhz */
- SERDES_REFCLK_122_88, /* refclk 122.88Mhz */
- SERDES_REFCLK_125, /* refclk 125Mhz */
- SERDES_REFCLK_156_25, /* refclk 156.25Mhz */
- SERDES_REFCLK_NONE = -1,
-};
-
-/* configuration values for IDT registers for Output Refclks:
- * Refclk1 = 122.88MHz Refclk2 = 122.88MHz
- */
-static const u8 idt_conf_122_88[23][2] = { {0x00, 0x3C}, {0x01, 0x00},
- {0x02, 0x9F}, {0x03, 0x00}, {0x04, 0x0B}, {0x05, 0x00},
- {0x06, 0x00}, {0x07, 0x00}, {0x08, 0x7D}, {0x09, 0x00},
- {0x0A, 0x08}, {0x0B, 0x00}, {0x0C, 0xDC}, {0x0D, 0x00},
- {0x0E, 0x00}, {0x0F, 0x00}, {0x10, 0x12}, {0x11, 0x12},
- {0x12, 0xB9}, {0x13, 0xBC}, {0x14, 0x40}, {0x15, 0x08},
- {0x16, 0xA0} };
-
-
-/* configuration values for IDT registers for Output Refclks:
- * Refclk1 not equal to 122.88MHz Refclk2 not equal to 122.88MHz
- */
-static const u8 idt_conf_not_122_88[23][2] = { {0x00, 0x00}, {0x01, 0x00},
- {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x0A}, {0x05, 0x00},
- {0x06, 0x00}, {0x07, 0x00}, {0x08, 0x7D}, {0x09, 0x00},
- {0x0A, 0x08}, {0x0B, 0x00}, {0x0C, 0xDC}, {0x0D, 0x00},
- {0x0E, 0x00}, {0x0F, 0x00}, {0x10, 0x14}, {0x11, 0x14},
- {0x12, 0x35}, {0x13, 0xBC}, {0x14, 0x40}, {0x15, 0x08},
- {0x16, 0xA0} };
-
-/* Reconfiguration values for some of IDT registers for
- * Output Refclks:
- * Refclk1 = 122.88MHz Refclk2 = 122.88MHz
- * and with feedback as 1
- */
-static const u8 idt_conf_122_88_feedback[12][2] = { {0x00, 0x50}, {0x02, 0xD7},
- {0x04, 0x89}, {0x06, 0xC3}, {0x08, 0xC0}, {0x0A, 0x07},
- {0x0C, 0x80}, {0x10, 0x10}, {0x11, 0x10}, {0x12, 0x1B},
- {0x14, 0x00}, {0x15, 0xE8} };
-
-/* configuration values for IDT registers for Output Refclks:
- * Refclk1 : 156.25MHz Refclk2 : 156.25MHz
- */
-static const u8 idt_conf_156_25[11][2] = { {0x04, 0x19}, {0x06, 0x03},
- {0x08, 0xC0}, {0x0A, 0x07}, {0x0C, 0xA1}, {0x0E, 0x20},
- {0x10, 0x10}, {0x11, 0x10}, {0x12, 0xB5}, {0x13, 0x3C},
- {0x15, 0xE8} };
-
-/* configuration values for IDT registers for Output Refclks:
- * Refclk1 : 100MHz Refclk2 : 156.25MHz
- */
-static const u8 idt_conf_100_156_25[11][2] = { {0x04, 0x19}, {0x06, 0x03},
- {0x08, 0xC0}, {0x0A, 0x07}, {0x0C, 0xA1}, {0x0E, 0x20},
- {0x10, 0x19}, {0x11, 0x10}, {0x12, 0xB5}, {0x13, 0x3C},
- {0x15, 0xE8} };
-
-/* configuration values for IDT registers for Output Refclks:
- * Refclk1 : 125MHz Refclk2 : 156.25MHz
- */
-static const u8 idt_conf_125_156_25[11][2] = { {0x04, 0x19}, {0x06, 0x03},
- {0x08, 0xC0}, {0x0A, 0x07}, {0x0C, 0xA1}, {0x0E, 0x20},
- {0x10, 0x14}, {0x11, 0x10}, {0x12, 0xB5}, {0x13, 0x3C},
- {0x15, 0xE8} };
-
-/* configuration values for IDT registers for Output Refclks:
- * Refclk1 : 156.25MHz Refclk2 : 100MHz
- */
-static const u8 idt_conf_156_25_100[11][2] = { {0x04, 0x19}, {0x06, 0x03},
- {0x08, 0xC0}, {0x0A, 0x07}, {0x0C, 0xA1}, {0x0E, 0x20},
- {0x10, 0x10}, {0x11, 0x19}, {0x12, 0xB5}, {0x13, 0x3C},
- {0x15, 0xE8} };
-
-/* configuration values for IDT registers for Output Refclks:
- * Refclk1 : 156.25MHz Refclk2 : 125MHz
- */
-static const u8 idt_conf_156_25_125[11][2] = { {0x04, 0x19}, {0x06, 0x03},
- {0x08, 0xC0}, {0x0A, 0x07}, {0x0C, 0xA1}, {0x0E, 0x20},
- {0x10, 0x10}, {0x11, 0x14}, {0x12, 0xB5}, {0x13, 0x3C},
- {0x15, 0xE8} };
-
-int set_serdes_refclk(u8 idt_addr, u8 serdes_num,
- enum serdes_refclk refclk1,
- enum serdes_refclk refclk2, u8 feedback);
-
-#endif /*__IDT8T49N222A_SERDES_CLK_H_ */
diff --git a/board/freescale/common/p_corenet/Makefile b/board/freescale/common/p_corenet/Makefile
index 29c9d544ae..ce156018a0 100644
--- a/board/freescale/common/p_corenet/Makefile
+++ b/board/freescale/common/p_corenet/Makefile
@@ -4,5 +4,4 @@
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
obj-y += law.o
-obj-$(CONFIG_PCI) += pci.o
obj-y += tlb.o
diff --git a/board/freescale/common/p_corenet/pci.c b/board/freescale/common/p_corenet/pci.c
deleted file mode 100644
index 636334863e..0000000000
--- a/board/freescale/common/p_corenet/pci.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2007-2011 Freescale Semiconductor, Inc.
- */
-
-#include <common.h>
-#include <command.h>
-#include <init.h>
-#include <pci.h>
-#include <asm/fsl_pci.h>
-#include <linux/libfdt.h>
-#include <fdt_support.h>
-#include <asm/fsl_serdes.h>
-
-#if !defined(CONFIG_DM_PCI)
-void pci_init_board(void)
-{
- fsl_pcie_init_board(0);
-}
-
-void pci_of_setup(void *blob, struct bd_info *bd)
-{
- FT_FSL_PCI_SETUP;
-}
-#endif
diff --git a/board/freescale/common/pixis.c b/board/freescale/common/pixis.c
index 4127fbc139..6fdb11039e 100644
--- a/board/freescale/common/pixis.c
+++ b/board/freescale/common/pixis.c
@@ -403,10 +403,10 @@ static unsigned long strfractoint(char *strptr)
mulconst = 1;
for (i = 0; i < j; i++)
mulconst *= 10;
- decval = simple_strtoul(decarr, NULL, 10);
+ decval = dectoul(decarr, NULL);
}
- intval = simple_strtoul(intarr, NULL, 10);
+ intval = dectoul(intarr, NULL);
intval = intval * mulconst;
return intval + decval;
@@ -489,9 +489,9 @@ static int pixis_reset_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
unsigned long corepll;
unsigned long mpxpll;
- sysclk = simple_strtoul(p_cf_sysclk, NULL, 10);
+ sysclk = dectoul(p_cf_sysclk, NULL);
corepll = strfractoint(p_cf_corepll);
- mpxpll = simple_strtoul(p_cf_mpxpll, NULL, 10);
+ mpxpll = dectoul(p_cf_mpxpll, NULL);
if (!(set_px_sysclk(sysclk)
&& set_px_corepll(corepll)
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index be0fda0638..35df8ba389 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -378,7 +378,7 @@ static void set_mac_address(unsigned int index, const char *string)
}
for (i = 0; *p && (i < 6); i++) {
- e.mac[index][i] = simple_strtoul(p, &p, 16);
+ e.mac[index][i] = hextoul(p, &p);
if (*p == ':')
p++;
}
@@ -452,11 +452,11 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
set_date(argv[2]);
break;
case 'p': /* MAC table size */
- e.mac_count = simple_strtoul(argv[2], NULL, 16);
+ e.mac_count = hextoul(argv[2], NULL);
update_crc();
break;
case '0' ... '9': /* "mac 0" through "mac 22" */
- set_mac_address(simple_strtoul(argv[1], NULL, 10), argv[2]);
+ set_mac_address(dectoul(argv[1], NULL), argv[2]);
break;
case 'h': /* help */
default:
diff --git a/board/freescale/lx2160a/eth_lx2160aqds.c b/board/freescale/lx2160a/eth_lx2160aqds.c
index 437f0bc4cf..a2b6442b54 100644
--- a/board/freescale/lx2160a/eth_lx2160aqds.c
+++ b/board/freescale/lx2160a/eth_lx2160aqds.c
@@ -416,7 +416,7 @@ static inline void do_dpmac_config(int dpmac, const char *arg_dpmacid,
env_dpmac, phy_num + 1, arg_dpmacid);
else
wriop_set_phy_address(dpmac, phy_num,
- simple_strtoul(ret, NULL, 16));
+ hextoul(ret, NULL));
}
/*search mdio in dpmac arg*/
diff --git a/board/freescale/lx2160a/eth_lx2162aqds.c b/board/freescale/lx2160a/eth_lx2162aqds.c
index b742c1ff52..3b04dea39c 100644
--- a/board/freescale/lx2160a/eth_lx2162aqds.c
+++ b/board/freescale/lx2160a/eth_lx2162aqds.c
@@ -437,7 +437,7 @@ static inline void do_dpmac_config(int dpmac, const char *arg_dpmacid,
env_dpmac, phy_num + 1, arg_dpmacid);
else
wriop_set_phy_address(dpmac, phy_num,
- simple_strtoul(ret, NULL, 16));
+ hextoul(ret, NULL));
}
/*search mdio in dpmac arg*/
diff --git a/board/freescale/mpc8349emds/pci.c b/board/freescale/mpc8349emds/pci.c
index 3ddbe71775..8c76c46d42 100644
--- a/board/freescale/mpc8349emds/pci.c
+++ b/board/freescale/mpc8349emds/pci.c
@@ -115,77 +115,4 @@ void pib_init(void)
i2c_set_bus_num(orig_i2c_bus);
}
-void pci_init_board(void)
-{
- volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
- volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
- volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
-#ifndef CONFIG_MPC83XX_PCI2
- struct pci_region *reg[] = { pci1_regions };
-#else
- struct pci_region *reg[] = { pci1_regions, pci2_regions };
-#endif
-
- /* initialize the PCA9555PW IO expander on the PIB board */
- pib_init();
-
- /* Enable all 8 PCI_CLK_OUTPUTS */
- clk->occr = 0xff000000;
- udelay(2000);
-
- /* Configure PCI Local Access Windows */
- pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
- pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
-
- pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
- pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M;
-
- udelay(2000);
-
-#ifndef CONFIG_MPC83XX_PCI2
- mpc83xx_pci_init(1, reg);
-#else
- mpc83xx_pci_init(2, reg);
-#endif
-}
-
-#else
-void pci_init_board(void)
-{
- volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
- volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
- volatile pcictrl83xx_t *pci_ctrl = &immr->pci_ctrl[0];
- struct pci_region *reg[] = { pci1_regions };
-
- /* Configure PCI Local Access Windows */
- pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
- pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
-
- pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
- pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M;
-
- mpc83xx_pci_init(1, reg);
-
- /* Configure PCI Inbound Translation Windows (3 1MB windows) */
- pci_ctrl->pitar0 = 0x0;
- pci_ctrl->pibar0 = 0x0;
- pci_ctrl->piwar0 = PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP |
- PIWAR_WTT_SNOOP | PIWAR_IWS_1M;
-
- pci_ctrl->pitar1 = 0x0;
- pci_ctrl->pibar1 = 0x0;
- pci_ctrl->piebar1 = 0x0;
- pci_ctrl->piwar1 = PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP |
- PIWAR_WTT_SNOOP | PIWAR_IWS_1M;
-
- pci_ctrl->pitar2 = 0x0;
- pci_ctrl->pibar2 = 0x0;
- pci_ctrl->piebar2 = 0x0;
- pci_ctrl->piwar2 = PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP |
- PIWAR_WTT_SNOOP | PIWAR_IWS_1M;
-
- /* Unlock the configuration bit */
- mpc83xx_pcislave_unlock(0);
- printf("PCI: Agent mode enabled\n");
-}
#endif /* CONFIG_PCISLAVE */
diff --git a/board/freescale/mpc837xerdb/Makefile b/board/freescale/mpc837xerdb/Makefile
index c683b017b5..4661e4cf23 100644
--- a/board/freescale/mpc837xerdb/Makefile
+++ b/board/freescale/mpc837xerdb/Makefile
@@ -4,4 +4,3 @@
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
obj-y += mpc837xerdb.o
-obj-$(CONFIG_PCI) += pci.o
diff --git a/board/freescale/mpc837xerdb/pci.c b/board/freescale/mpc837xerdb/pci.c
deleted file mode 100644
index dccf8c5551..0000000000
--- a/board/freescale/mpc837xerdb/pci.c
+++ /dev/null
@@ -1,109 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
- */
-
-#include <common.h>
-#include <init.h>
-#include <mpc83xx.h>
-#include <pci.h>
-#include <asm/io.h>
-#include <linux/delay.h>
-
-static struct pci_region pci_regions[] = {
- {
- bus_start: CONFIG_SYS_PCI_MEM_BASE,
- phys_start: CONFIG_SYS_PCI_MEM_PHYS,
- size: CONFIG_SYS_PCI_MEM_SIZE,
- flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
- },
- {
- bus_start: CONFIG_SYS_PCI_MMIO_BASE,
- phys_start: CONFIG_SYS_PCI_MMIO_PHYS,
- size: CONFIG_SYS_PCI_MMIO_SIZE,
- flags: PCI_REGION_MEM
- },
- {
- bus_start: CONFIG_SYS_PCI_IO_BASE,
- phys_start: CONFIG_SYS_PCI_IO_PHYS,
- size: CONFIG_SYS_PCI_IO_SIZE,
- flags: PCI_REGION_IO
- }
-};
-
-static struct pci_region pcie_regions_0[] = {
- {
- .bus_start = CONFIG_SYS_PCIE1_MEM_BASE,
- .phys_start = CONFIG_SYS_PCIE1_MEM_PHYS,
- .size = CONFIG_SYS_PCIE1_MEM_SIZE,
- .flags = PCI_REGION_MEM,
- },
- {
- .bus_start = CONFIG_SYS_PCIE1_IO_BASE,
- .phys_start = CONFIG_SYS_PCIE1_IO_PHYS,
- .size = CONFIG_SYS_PCIE1_IO_SIZE,
- .flags = PCI_REGION_IO,
- },
-};
-
-static struct pci_region pcie_regions_1[] = {
- {
- .bus_start = CONFIG_SYS_PCIE2_MEM_BASE,
- .phys_start = CONFIG_SYS_PCIE2_MEM_PHYS,
- .size = CONFIG_SYS_PCIE2_MEM_SIZE,
- .flags = PCI_REGION_MEM,
- },
- {
- .bus_start = CONFIG_SYS_PCIE2_IO_BASE,
- .phys_start = CONFIG_SYS_PCIE2_IO_PHYS,
- .size = CONFIG_SYS_PCIE2_IO_SIZE,
- .flags = PCI_REGION_IO,
- },
-};
-
-void pci_init_board(void)
-{
- volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
- volatile sysconf83xx_t *sysconf = &immr->sysconf;
- volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
- volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
- volatile law83xx_t *pcie_law = sysconf->pcielaw;
- struct pci_region *reg[] = { pci_regions };
- struct pci_region *pcie_reg[] = { pcie_regions_0, pcie_regions_1, };
- u32 spridr = in_be32(&immr->sysconf.spridr);
-
- /* Enable all 5 PCI_CLK_OUTPUTS */
- clk->occr |= 0xf8000000;
- udelay(2000);
-
- /* Configure PCI Local Access Windows */
- pci_law[0].bar = CONFIG_SYS_PCI_MEM_PHYS & LAWBAR_BAR;
- pci_law[0].ar = LBLAWAR_EN | LBLAWAR_512MB;
-
- pci_law[1].bar = CONFIG_SYS_PCI_IO_PHYS & LAWBAR_BAR;
- pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB;
-
- mpc83xx_pci_init(1, reg);
-
- /* There is no PEX in MPC8379 parts. */
- if (PARTID_NO_E(spridr) == SPR_8379)
- return;
-
- /* Configure the clock for PCIE controller */
- clrsetbits_be32(&clk->sccr, SCCR_PCIEXP1CM | SCCR_PCIEXP2CM,
- SCCR_PCIEXP1CM_1 | SCCR_PCIEXP2CM_1);
-
- /* Deassert the resets in the control register */
- out_be32(&sysconf->pecr1, 0xE0008000);
- out_be32(&sysconf->pecr2, 0xE0008000);
- udelay(2000);
-
- /* Configure PCI Express Local Access Windows */
- out_be32(&pcie_law[0].bar, CONFIG_SYS_PCIE1_BASE & LAWBAR_BAR);
- out_be32(&pcie_law[0].ar, LBLAWAR_EN | LBLAWAR_512MB);
-
- out_be32(&pcie_law[1].bar, CONFIG_SYS_PCIE2_BASE & LAWBAR_BAR);
- out_be32(&pcie_law[1].ar, LBLAWAR_EN | LBLAWAR_512MB);
-
- mpc83xx_pcie_init(2, pcie_reg);
-}
diff --git a/board/freescale/mpc8548cds/mpc8548cds.c b/board/freescale/mpc8548cds/mpc8548cds.c
index a1a9742bfa..cfb5b0b38b 100644
--- a/board/freescale/mpc8548cds/mpc8548cds.c
+++ b/board/freescale/mpc8548cds/mpc8548cds.c
@@ -168,113 +168,6 @@ void lbc_sdram_init(void)
#endif /* enable SDRAM init */
}
-#if (defined(CONFIG_PCI) || defined(CONFIG_PCI1)) && !defined(CONFIG_DM_PCI)
-/* For some reason the Tundra PCI bridge shows up on itself as a
- * different device. Work around that by refusing to configure it.
- */
-void dummy_func(struct pci_controller* hose, pci_dev_t dev, struct pci_config_table *tab) { }
-
-static struct pci_config_table pci_mpc85xxcds_config_table[] = {
- {0x10e3, 0x0513, PCI_ANY_ID, 1, 3, PCI_ANY_ID, dummy_func, {0,0,0}},
- {0x1106, 0x0686, PCI_ANY_ID, 1, VIA_ID, 0, mpc85xx_config_via, {0,0,0}},
- {0x1106, 0x0571, PCI_ANY_ID, 1, VIA_ID, 1,
- mpc85xx_config_via_usbide, {0,0,0}},
- {0x1105, 0x3038, PCI_ANY_ID, 1, VIA_ID, 2,
- mpc85xx_config_via_usb, {0,0,0}},
- {0x1106, 0x3038, PCI_ANY_ID, 1, VIA_ID, 3,
- mpc85xx_config_via_usb2, {0,0,0}},
- {0x1106, 0x3058, PCI_ANY_ID, 1, VIA_ID, 5,
- mpc85xx_config_via_power, {0,0,0}},
- {0x1106, 0x3068, PCI_ANY_ID, 1, VIA_ID, 6,
- mpc85xx_config_via_ac97, {0,0,0}},
- {},
-};
-
-static struct pci_controller pci1_hose;
-#endif /* CONFIG_PCI */
-
-#if !defined(CONFIG_DM_PCI)
-void pci_init_board(void)
-{
- volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
- struct fsl_pci_info pci_info;
- u32 devdisr, pordevsr, io_sel;
- u32 porpllsr, pci_agent, pci_speed, pci_32, pci_arb, pci_clk_sel;
- int first_free_busno = 0;
- char buf[32];
-
- devdisr = in_be32(&gur->devdisr);
- pordevsr = in_be32(&gur->pordevsr);
- porpllsr = in_be32(&gur->porpllsr);
- io_sel = (pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19;
-
- debug (" pci_init_board: devdisr=%x, io_sel=%x\n", devdisr, io_sel);
-
-#ifdef CONFIG_PCI1
- pci_speed = get_clock_freq (); /* PCI PSPEED in [4:5] */
- pci_32 = pordevsr & MPC85xx_PORDEVSR_PCI1_PCI32; /* PORDEVSR[15] */
- pci_arb = pordevsr & MPC85xx_PORDEVSR_PCI1_ARB;
- pci_clk_sel = porpllsr & MPC85xx_PORDEVSR_PCI1_SPD;
-
- if (!(devdisr & MPC85xx_DEVDISR_PCI1)) {
- SET_STD_PCI_INFO(pci_info, 1);
- set_next_law(pci_info.mem_phys,
- law_size_bits(pci_info.mem_size), pci_info.law);
- set_next_law(pci_info.io_phys,
- law_size_bits(pci_info.io_size), pci_info.law);
-
- pci_agent = fsl_setup_hose(&pci1_hose, pci_info.regs);
- printf("PCI1: %d bit, %s MHz, %s, %s, %s (base address %lx)\n",
- (pci_32) ? 32 : 64,
- strmhz(buf, pci_speed),
- pci_clk_sel ? "sync" : "async",
- pci_agent ? "agent" : "host",
- pci_arb ? "arbiter" : "external-arbiter",
- pci_info.regs);
-
- pci1_hose.config_table = pci_mpc85xxcds_config_table;
- first_free_busno = fsl_pci_init_port(&pci_info,
- &pci1_hose, first_free_busno);
-
-#ifdef CONFIG_PCIX_CHECK
- if (!(pordevsr & MPC85xx_PORDEVSR_PCI1)) {
- /* PCI-X init */
- if (CONFIG_SYS_CLK_FREQ < 66000000)
- printf("PCI-X will only work at 66 MHz\n");
-
- reg16 = PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ
- | PCI_X_CMD_ERO | PCI_X_CMD_DPERR_E;
- pci_hose_write_config_word(hose, bus, PCIX_COMMAND, reg16);
- }
-#endif
- } else {
- printf("PCI1: disabled\n");
- }
-
- puts("\n");
-#else
- setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI1); /* disable */
-#endif
-
-#ifdef CONFIG_PCI2
-{
- uint pci2_clk_sel = porpllsr & 0x4000; /* PORPLLSR[17] */
- uint pci_dual = get_pci_dual (); /* PCI DUAL in CM_PCI[3] */
- if (pci_dual) {
- printf("PCI2: 32 bit, 66 MHz, %s\n",
- pci2_clk_sel ? "sync" : "async");
- } else {
- printf("PCI2: disabled\n");
- }
-}
-#else
- setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI2); /* disable */
-#endif /* CONFIG_PCI2 */
-
- fsl_pcie_init_board(first_free_busno);
-}
-#endif
-
void configure_rgmii(void)
{
unsigned short temp;
@@ -354,10 +247,3 @@ int board_eth_init(struct bd_info *bis)
return pci_eth_init(bis);
}
-
-#if defined(CONFIG_OF_BOARD_SETUP) && !defined(CONFIG_DM_PCI)
-void ft_pci_setup(void *blob, struct bd_info *bd)
-{
- FT_FSL_PCI_SETUP;
-}
-#endif
diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c
index 90436337df..84fc891b67 100644
--- a/board/freescale/p1010rdb/p1010rdb.c
+++ b/board/freescale/p1010rdb/p1010rdb.c
@@ -129,13 +129,6 @@ int board_early_init_r(void)
return 0;
}
-#if defined(CONFIG_PCI) && !defined(CONFIG_DM_PCI)
-void pci_init_board(void)
-{
- fsl_pcie_init_board(0);
-}
-#endif /* ifdef CONFIG_PCI */
-
int config_board_mux(int ctrl_type)
{
ccsr_gur_t __iomem *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
@@ -617,10 +610,6 @@ int ft_board_setup(void *blob, struct bd_info *bd)
base = env_get_bootm_low();
size = env_get_bootm_size();
-#if defined(CONFIG_PCI) && !defined(CONFIG_DM_PCI)
- FT_FSL_PCI_SETUP;
-#endif
-
fdt_fixup_memory(blob, (u64)base, (u64)size);
#if defined(CONFIG_HAS_FSL_DR_USB)
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index 8273384f2d..19ece12296 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -239,13 +239,6 @@ int checkboard(void)
return 0;
}
-#if defined(CONFIG_PCI) && !defined(CONFIG_DM_PCI)
-void pci_init_board(void)
-{
- fsl_pcie_init_board(0);
-}
-#endif
-
int board_early_init_r(void)
{
const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
@@ -281,7 +274,7 @@ int board_early_init_r(void)
/* If a VSC7385 microcode image is present, then upload it. */
tmp = env_get("vscfw_addr");
if (tmp) {
- vscfw_addr = simple_strtoul(tmp, NULL, 16);
+ vscfw_addr = hextoul(tmp, NULL);
printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
if (vsc7385_upload_firmware((void *)vscfw_addr,
CONFIG_VSC7385_IMAGE_SIZE))
@@ -363,10 +356,6 @@ int ft_board_setup(void *blob, struct bd_info *bd)
fdt_fixup_memory(blob, (u64)base, (u64)size);
-#if !defined(CONFIG_DM_PCI)
- FT_FSL_PCI_SETUP;
-#endif
-
#ifdef CONFIG_QE
do_fixup_by_compat(blob, "fsl,qe", "status", "okay",
sizeof("okay"), 0);
diff --git a/board/freescale/p2041rdb/cpld.c b/board/freescale/p2041rdb/cpld.c
index b042fe3bcb..a1908b8a57 100644
--- a/board/freescale/p2041rdb/cpld.c
+++ b/board/freescale/p2041rdb/cpld.c
@@ -100,8 +100,8 @@ int cpld_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
cpld_set_defbank();
} else if (strcmp(argv[1], "lane_mux") == 0) {
- u32 lane = simple_strtoul(argv[2], NULL, 16);
- u8 val = (u8)simple_strtoul(argv[3], NULL, 16);
+ u32 lane = hextoul(argv[2], NULL);
+ u8 val = (u8)hextoul(argv[3], NULL);
u8 reg = CPLD_READ(serdes_mux);
switch (lane) {
diff --git a/board/freescale/t102xrdb/Makefile b/board/freescale/t102xrdb/Makefile
index ddeb44f36e..e597486c94 100644
--- a/board/freescale/t102xrdb/Makefile
+++ b/board/freescale/t102xrdb/Makefile
@@ -10,7 +10,6 @@ else
obj-y += t102xrdb.o
obj-$(CONFIG_TARGET_T1024RDB) += cpld.o
obj-y += eth_t102xrdb.o
-obj-$(CONFIG_PCI) += pci.o
endif
obj-y += ddr.o
obj-y += law.o
diff --git a/board/freescale/t102xrdb/pci.c b/board/freescale/t102xrdb/pci.c
deleted file mode 100644
index 45ab9223ae..0000000000
--- a/board/freescale/t102xrdb/pci.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2007-2014 Freescale Semiconductor, Inc.
- */
-
-#include <common.h>
-#include <command.h>
-#include <init.h>
-#include <pci.h>
-#include <asm/fsl_pci.h>
-#include <linux/libfdt.h>
-#include <fdt_support.h>
-#include <asm/fsl_serdes.h>
-
-#if !defined(CONFIG_DM_PCI)
-void pci_init_board(void)
-{
- fsl_pcie_init_board(0);
-}
-
-void pci_of_setup(void *blob, struct bd_info *bd)
-{
- FT_FSL_PCI_SETUP;
-}
-#endif
diff --git a/board/freescale/t104xrdb/Makefile b/board/freescale/t104xrdb/Makefile
index 31abbd9aca..d67e9412ec 100644
--- a/board/freescale/t104xrdb/Makefile
+++ b/board/freescale/t104xrdb/Makefile
@@ -8,7 +8,6 @@ else
obj-y += t104xrdb.o
obj-y += cpld.o
obj-y += eth.o
-obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_FSL_DIU_FB)+= diu.o
endif
obj-y += ddr.o
diff --git a/board/freescale/t104xrdb/pci.c b/board/freescale/t104xrdb/pci.c
deleted file mode 100644
index 1fd2402700..0000000000
--- a/board/freescale/t104xrdb/pci.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2013 Freescale Semiconductor, Inc.
- */
-
-#include <common.h>
-#include <command.h>
-#include <init.h>
-#include <pci.h>
-#include <asm/fsl_pci.h>
-#include <linux/libfdt.h>
-#include <fdt_support.h>
-#include <asm/fsl_serdes.h>
-
-#if !defined(CONFIG_DM_PCI)
-void pci_init_board(void)
-{
- fsl_pcie_init_board(0);
-}
-
-void pci_of_setup(void *blob, struct bd_info *bd)
-{
- FT_FSL_PCI_SETUP;
-}
-#endif
diff --git a/board/freescale/t208xqds/Makefile b/board/freescale/t208xqds/Makefile
index 55b1e7390a..de8613058d 100644
--- a/board/freescale/t208xqds/Makefile
+++ b/board/freescale/t208xqds/Makefile
@@ -8,7 +8,6 @@ ifdef CONFIG_SPL_BUILD
obj-y += spl.o
else
obj-$(CONFIG_TARGET_T2080QDS) += t208xqds.o eth_t208xqds.o
-obj-$(CONFIG_PCI) += pci.o
endif
obj-y += ddr.o
diff --git a/board/freescale/t208xqds/pci.c b/board/freescale/t208xqds/pci.c
deleted file mode 100644
index a03b11ccb5..0000000000
--- a/board/freescale/t208xqds/pci.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2007-2013 Freescale Semiconductor, Inc.
- */
-
-#include <common.h>
-#include <command.h>
-#include <init.h>
-#include <pci.h>
-#include <asm/fsl_pci.h>
-#include <linux/libfdt.h>
-#include <fdt_support.h>
-#include <asm/fsl_serdes.h>
-
-#if !defined(CONFIG_DM_PCI)
-void pci_init_board(void)
-{
- fsl_pcie_init_board(0);
-}
-
-void pci_of_setup(void *blob, struct bd_info *bd)
-{
- FT_FSL_PCI_SETUP;
-}
-#endif
diff --git a/board/freescale/t208xrdb/Makefile b/board/freescale/t208xrdb/Makefile
index 25ea66a024..7af3cd0ac4 100644
--- a/board/freescale/t208xrdb/Makefile
+++ b/board/freescale/t208xrdb/Makefile
@@ -8,7 +8,6 @@ ifdef CONFIG_SPL_BUILD
obj-y += spl.o
else
obj-$(CONFIG_TARGET_T2080RDB) += t208xrdb.o eth_t208xrdb.o cpld.o
-obj-$(CONFIG_PCI) += pci.o
endif
obj-y += ddr.o
diff --git a/board/freescale/t208xrdb/pci.c b/board/freescale/t208xrdb/pci.c
deleted file mode 100644
index 45ab9223ae..0000000000
--- a/board/freescale/t208xrdb/pci.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2007-2014 Freescale Semiconductor, Inc.
- */
-
-#include <common.h>
-#include <command.h>
-#include <init.h>
-#include <pci.h>
-#include <asm/fsl_pci.h>
-#include <linux/libfdt.h>
-#include <fdt_support.h>
-#include <asm/fsl_serdes.h>
-
-#if !defined(CONFIG_DM_PCI)
-void pci_init_board(void)
-{
- fsl_pcie_init_board(0);
-}
-
-void pci_of_setup(void *blob, struct bd_info *bd)
-{
- FT_FSL_PCI_SETUP;
-}
-#endif
diff --git a/board/freescale/t4rdb/Makefile b/board/freescale/t4rdb/Makefile
index f1fd623339..3106848639 100644
--- a/board/freescale/t4rdb/Makefile
+++ b/board/freescale/t4rdb/Makefile
@@ -10,7 +10,6 @@ else
obj-$(CONFIG_TARGET_T4240RDB) += t4240rdb.o
obj-y += cpld.o
obj-y += eth.o
-obj-$(CONFIG_PCI) += pci.o
endif
obj-y += ddr.o
diff --git a/board/freescale/t4rdb/pci.c b/board/freescale/t4rdb/pci.c
deleted file mode 100644
index c2bc05164d..0000000000
--- a/board/freescale/t4rdb/pci.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2014 Freescale Semiconductor, Inc.
- */
-
-#include <common.h>
-#include <command.h>
-#include <init.h>
-#include <pci.h>
-#include <asm/fsl_pci.h>
-#include <linux/libfdt.h>
-#include <fdt_support.h>
-#include <asm/fsl_serdes.h>
-
-#if !defined(CONFIG_DM_PCI)
-void pci_init_board(void)
-{
- fsl_pcie_init_board(0);
-}
-
-void pci_of_setup(void *blob, struct bd_info *bd)
-{
- FT_FSL_PCI_SETUP;
-}
-#endif
diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c
index c07eb627a2..4a15837473 100644
--- a/board/gateworks/gw_ventana/common.c
+++ b/board/gateworks/gw_ventana/common.c
@@ -1502,7 +1502,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info)
continue;
s = hwconfig_subarg(arg, "padctrl", &len);
if (s) {
- ctrl = MUX_PAD_CTRL(simple_strtoul(s, NULL, 16)
+ ctrl = MUX_PAD_CTRL(hextoul(s, NULL)
& 0x1ffff) | MUX_MODE_SION;
}
if (hwconfig_subarg_cmp(arg, "mode", "gpio")) {
diff --git a/board/gateworks/gw_ventana/gsc.c b/board/gateworks/gw_ventana/gsc.c
index ffed6b5fc8..59fd1b6939 100644
--- a/board/gateworks/gw_ventana/gsc.c
+++ b/board/gateworks/gw_ventana/gsc.c
@@ -277,7 +277,7 @@ static int do_gsc_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
- secs = simple_strtoul(argv[1], NULL, 10);
+ secs = dectoul(argv[1], NULL);
printf("GSC Sleeping for %ld seconds\n", secs);
i2c_set_bus_num(0);
@@ -322,7 +322,7 @@ static int do_gsc_wd(struct cmd_tbl *cmdtp, int flag, int argc,
int timeout = 0;
if (argc > 2)
- timeout = simple_strtoul(argv[2], NULL, 10);
+ timeout = dectoul(argv[2], NULL);
i2c_set_bus_num(0);
if (gsc_i2c_read(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1))
return CMD_RET_FAILURE;
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 468fb093b7..912075db88 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -471,7 +471,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
if (serial) {
serialnr->high = 0;
- serialnr->low = simple_strtoul(serial, NULL, 10);
+ serialnr->low = dectoul(serial, NULL);
} else if (ventana_info.model[0]) {
serialnr->high = 0;
serialnr->low = ventana_info.serial;
@@ -915,7 +915,7 @@ int fdt_fixup_sky2(void *blob, int np, struct pci_dev *dev)
if (tmp) {
for (j = 0; j < 6; j++) {
mac_addr[j] = tmp ?
- simple_strtoul(tmp, &end,16) : 0;
+ hextoul(tmp, &end) : 0;
if (tmp)
tmp = (*end) ? end+1 : end;
}
diff --git a/board/gateworks/venice/gsc.c b/board/gateworks/venice/gsc.c
index c75bc6f855..271bc8c229 100644
--- a/board/gateworks/venice/gsc.c
+++ b/board/gateworks/venice/gsc.c
@@ -660,7 +660,7 @@ static int do_gsc(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]
if (strcasecmp(argv[1], "sleep") == 0) {
if (argc < 3)
return CMD_RET_USAGE;
- if (!gsc_sleep(simple_strtoul(argv[2], NULL, 10)))
+ if (!gsc_sleep(dectoul(argv[2], NULL)))
return CMD_RET_SUCCESS;
} else if (strcasecmp(argv[1], "hwmon") == 0) {
if (!gsc_hwmon())
diff --git a/board/gdsys/common/cmd_ioloop.c b/board/gdsys/common/cmd_ioloop.c
index 658756d984..1412421a02 100644
--- a/board/gdsys/common/cmd_ioloop.c
+++ b/board/gdsys/common/cmd_ioloop.c
@@ -275,13 +275,13 @@ int do_ioreflect(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
return CMD_RET_USAGE;
- fpga = simple_strtoul(argv[1], NULL, 10);
+ fpga = dectoul(argv[1], NULL);
/*
* If another parameter, it is the report rate in packets.
*/
if (argc > 2)
- rate = simple_strtoul(argv[2], NULL, 10);
+ rate = dectoul(argv[2], NULL);
/* Enable receive path */
FPGA_SET_REG(fpga, ep.rx_tx_control, CTRL_PROC_RECEIVE_ENABLE);
@@ -388,18 +388,18 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* FPGA is specified since argc > 2
*/
- fpga = simple_strtoul(argv[1], NULL, 10);
+ fpga = dectoul(argv[1], NULL);
/*
* packet size is specified since argc > 2
*/
- size = simple_strtoul(argv[2], NULL, 10);
+ size = dectoul(argv[2], NULL);
/*
* If another parameter, it is the test rate in packets per second.
*/
if (argc > 3)
- rate = simple_strtoul(argv[3], NULL, 10);
+ rate = dectoul(argv[3], NULL);
/* enable receive path */
FPGA_SET_REG(fpga, ep.rx_tx_control, CTRL_PROC_RECEIVE_ENABLE);
@@ -463,13 +463,13 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* packet size is specified since argc > 1
*/
- size = simple_strtoul(argv[2], NULL, 10);
+ size = dectoul(argv[2], NULL);
/*
* If another parameter, it is the test rate in packets per second.
*/
if (argc > 2)
- rate = simple_strtoul(argv[3], NULL, 10);
+ rate = dectoul(argv[3], NULL);
/* Enable receive path */
misc_set_enabled(dev, true);
@@ -514,7 +514,7 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_FAILURE;
if (argc > 1) {
- int i = simple_strtoul(argv[1], NULL, 10);
+ int i = dectoul(argv[1], NULL);
snprintf(name, sizeof(name), "ioep%d", i);
diff --git a/board/gdsys/common/osd.c b/board/gdsys/common/osd.c
index 679f8f3019..dc548efbc7 100644
--- a/board/gdsys/common/osd.c
+++ b/board/gdsys/common/osd.c
@@ -284,9 +284,9 @@ static int osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
if (!(osd_screen_mask & (1 << screen)))
continue;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
- color = simple_strtoul(argv[3], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
+ color = hextoul(argv[3], NULL);
text = argv[4];
charcount = strlen(text);
len = (charcount > bufsize) ? bufsize : charcount;
@@ -416,13 +416,13 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
char *rp;
u16 *wp = buffer;
unsigned count = (argc > 4) ?
- simple_strtoul(argv[4], NULL, 16) : 1;
+ hextoul(argv[4], NULL) : 1;
if (!(osd_screen_mask & (1 << screen)))
continue;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
rp = argv[3];
@@ -431,7 +431,7 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
memcpy(substr, rp, 4);
substr[4] = 0;
- *wp = simple_strtoul(substr, NULL, 16);
+ *wp = hextoul(substr, NULL);
rp += 4;
wp++;
@@ -463,8 +463,8 @@ int osd_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
}
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
if (!x || (x > 64) || (x > MAX_X_CHARS) ||
!y || (y > 32) || (y > MAX_Y_CHARS)) {
diff --git a/board/gdsys/common/osd_cmd.c b/board/gdsys/common/osd_cmd.c
index fe6249794e..6a9c0b4c24 100644
--- a/board/gdsys/common/osd_cmd.c
+++ b/board/gdsys/common/osd_cmd.c
@@ -30,10 +30,10 @@ static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 4 || (strlen(argv[3])) % 2)
return CMD_RET_USAGE;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
hexstr = argv[3];
- count = (argc > 4) ? simple_strtoul(argv[4], NULL, 16) : 1;
+ count = (argc > 4) ? hextoul(argv[4], NULL) : 1;
buflen = strlen(hexstr) / 2;
@@ -80,9 +80,9 @@ static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 5)
return CMD_RET_USAGE;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
- color = simple_strtoul(argv[3], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
+ color = hextoul(argv[3], NULL);
text = argv[4];
for (uclass_first_device(UCLASS_VIDEO_OSD, &dev);
@@ -109,8 +109,8 @@ static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
for (uclass_first_device(UCLASS_VIDEO_OSD, &dev);
dev;
diff --git a/board/imgtec/malta/malta.c b/board/imgtec/malta/malta.c
index 9af1f92e5d..d2e2e4ae20 100644
--- a/board/imgtec/malta/malta.c
+++ b/board/imgtec/malta/malta.c
@@ -196,7 +196,6 @@ int board_fix_fdt(void *rw_fdt_blob)
}
#endif
-#if IS_ENABLED(CONFIG_DM_PCI)
int board_early_init_r(void)
{
struct udevice *dev;
@@ -243,69 +242,3 @@ int board_early_init_r(void)
return 0;
}
-#else
-void pci_init_board(void)
-{
- pci_dev_t bdf;
- u32 val32;
- u8 val8;
-
- switch (malta_sys_con()) {
- case SYSCON_GT64120:
- gt64120_pci_init((void *)CKSEG1ADDR(MALTA_GT_BASE),
- 0x00000000, 0x00000000, CONFIG_SYS_MEM_SIZE,
- 0x10000000, 0x10000000, 128 * 1024 * 1024,
- 0x00000000, 0x00000000, 0x20000);
- break;
-
- default:
- case SYSCON_MSC01:
- msc01_pci_init((void *)CKSEG1ADDR(MALTA_MSC01_PCI_BASE),
- 0x00000000, 0x00000000, CONFIG_SYS_MEM_SIZE,
- MALTA_MSC01_PCIMEM_MAP,
- CKSEG1ADDR(MALTA_MSC01_PCIMEM_BASE),
- MALTA_MSC01_PCIMEM_SIZE, MALTA_MSC01_PCIIO_MAP,
- 0x00000000, MALTA_MSC01_PCIIO_SIZE);
- break;
- }
-
- bdf = pci_find_device(PCI_VENDOR_ID_INTEL,
- PCI_DEVICE_ID_INTEL_82371AB_0, 0);
- if (bdf == -1)
- panic("Failed to find PIIX4 PCI bridge\n");
-
- /* setup PCI interrupt routing */
- pci_write_config_byte(bdf, PCI_CFG_PIIX4_PIRQRCA, 10);
- pci_write_config_byte(bdf, PCI_CFG_PIIX4_PIRQRCB, 10);
- pci_write_config_byte(bdf, PCI_CFG_PIIX4_PIRQRCC, 11);
- pci_write_config_byte(bdf, PCI_CFG_PIIX4_PIRQRCD, 11);
-
- /* mux SERIRQ onto SERIRQ pin */
- pci_read_config_dword(bdf, PCI_CFG_PIIX4_GENCFG, &val32);
- val32 |= PCI_CFG_PIIX4_GENCFG_SERIRQ;
- pci_write_config_dword(bdf, PCI_CFG_PIIX4_GENCFG, val32);
-
- /* enable SERIRQ - Linux currently depends upon this */
- pci_read_config_byte(bdf, PCI_CFG_PIIX4_SERIRQC, &val8);
- val8 |= PCI_CFG_PIIX4_SERIRQC_EN | PCI_CFG_PIIX4_SERIRQC_CONT;
- pci_write_config_byte(bdf, PCI_CFG_PIIX4_SERIRQC, val8);
-
- bdf = pci_find_device(PCI_VENDOR_ID_INTEL,
- PCI_DEVICE_ID_INTEL_82371AB, 0);
- if (bdf == -1)
- panic("Failed to find PIIX4 IDE controller\n");
-
- /* enable bus master & IO access */
- val32 |= PCI_COMMAND_MASTER | PCI_COMMAND_IO;
- pci_write_config_dword(bdf, PCI_COMMAND, val32);
-
- /* set latency */
- pci_write_config_byte(bdf, PCI_LATENCY_TIMER, 0x40);
-
- /* enable IDE/ATA */
- pci_write_config_dword(bdf, PCI_CFG_PIIX4_IDETIM_PRI,
- PCI_CFG_PIIX4_IDETIM_IDE);
- pci_write_config_dword(bdf, PCI_CFG_PIIX4_IDETIM_SEC,
- PCI_CFG_PIIX4_IDETIM_IDE);
-}
-#endif
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 016806a2a6..ff07260194 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -278,7 +278,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc,
* use simple_strtoul because we need &end and
* we know we got non numeric char at the end
*/
- bid = simple_strtoul(rest, &endp, 16);
+ bid = hextoul(rest, &endp);
/* BoardId and HWkey are separated with a "_" */
if (*endp == '_') {
rest = endp + 1;
@@ -286,7 +286,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc,
* use simple_strtoul because we need
* &end
*/
- hwkey = simple_strtoul(rest, &endp, 16);
+ hwkey = hextoul(rest, &endp);
rest = endp;
while (*rest && !isxdigit(*rest))
rest++;
diff --git a/board/kontron/sl28/cmds.c b/board/kontron/sl28/cmds.c
index 046d3b4903..08a22b5d01 100644
--- a/board/kontron/sl28/cmds.c
+++ b/board/kontron/sl28/cmds.c
@@ -138,7 +138,7 @@ static int do_sl28_nvm(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
if (argc > 1) {
- nvm = simple_strtoul(argv[1], &endp, 16);
+ nvm = hextoul(argv[1], &endp);
if (*endp != '\0') {
printf("ERROR: argument is not a valid number\n");
ret = -EINVAL;
diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c
index c34baca602..2b331b32df 100644
--- a/board/menlo/m53menlo/m53menlo.c
+++ b/board/menlo/m53menlo/m53menlo.c
@@ -347,7 +347,7 @@ int board_late_init(void)
if (!s)
return 0;
- addr = simple_strtoul(s, NULL, 16);
+ addr = hextoul(s, NULL);
dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
if (!dst)
return -ENOMEM;
diff --git a/board/renesas/stout/cpld.c b/board/renesas/stout/cpld.c
index ac8048c81c..b7c75f5aa6 100644
--- a/board/renesas/stout/cpld.c
+++ b/board/renesas/stout/cpld.c
@@ -133,7 +133,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
if (!(addr == CPLD_ADDR_VERSION || addr == CPLD_ADDR_MODE ||
addr == CPLD_ADDR_MUX || addr == CPLD_ADDR_HDMI ||
addr == CPLD_ADDR_DIPSW || addr == CPLD_ADDR_RESET)) {
@@ -144,7 +144,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc == 3 && strcmp(argv[1], "read") == 0) {
printf("0x%x\n", cpld_read(addr));
} else if (argc == 4 && strcmp(argv[1], "write") == 0) {
- val = simple_strtoul(argv[3], NULL, 16);
+ val = hextoul(argv[3], NULL);
if (addr == CPLD_ADDR_MUX) {
/* never mask SCIFA0 console */
val &= ~MUX_MSK_SCIFA0_USB;
diff --git a/board/renesas/ulcb/cpld.c b/board/renesas/ulcb/cpld.c
index ebb2d6f742..0c060a5323 100644
--- a/board/renesas/ulcb/cpld.c
+++ b/board/renesas/ulcb/cpld.c
@@ -111,7 +111,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
if (!(addr == CPLD_ADDR_VERSION || addr == CPLD_ADDR_MODE ||
addr == CPLD_ADDR_MUX || addr == CPLD_ADDR_DIPSW6 ||
addr == CPLD_ADDR_RESET)) {
@@ -122,7 +122,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc == 3 && strcmp(argv[1], "read") == 0) {
printf("0x%x\n", cpld_read(dev, addr));
} else if (argc == 4 && strcmp(argv[1], "write") == 0) {
- val = simple_strtoul(argv[3], NULL, 16);
+ val = hextoul(argv[3], NULL);
cpld_write(dev, addr, val);
}
diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 3593c77cbc..d31b81abf1 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -7,7 +7,7 @@ obj-$(CONFIG_USB_GADGET_DOWNLOAD) += gadget.o
obj-$(CONFIG_MISC_COMMON) += misc.o
ifndef CONFIG_SPL_BUILD
-obj-$(CONFIG_BOARD_COMMON) += board.o
+obj-$(CONFIG_BOARD_COMMON) += board.o sromc.o
ifdef CONFIG_EXYNOS5_DT
obj-y += exynos5-dt.o
obj-$(CONFIG_BOARD_TYPES) += exynos5-dt-types.o
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 104d2a6574..1c2fe025e8 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -26,7 +26,6 @@
#include <asm/arch/pinmux.h>
#include <asm/arch/power.h>
#include <asm/arch/system.h>
-#include <asm/arch/sromc.h>
#include <lcd.h>
#include <i2c.h>
#include <mmc.h>
@@ -195,83 +194,6 @@ int power_init_board(void)
}
#endif
-#ifdef CONFIG_SMC911X
-static int decode_sromc(const void *blob, struct fdt_sromc *config)
-{
- int err;
- int node;
-
- node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS5_SROMC);
- if (node < 0) {
- debug("Could not find SROMC node\n");
- return node;
- }
-
- config->bank = fdtdec_get_int(blob, node, "bank", 0);
- config->width = fdtdec_get_int(blob, node, "width", 2);
-
- err = fdtdec_get_int_array(blob, node, "srom-timing", config->timing,
- FDT_SROM_TIMING_COUNT);
- if (err < 0) {
- debug("Could not decode SROMC configuration Error: %s\n",
- fdt_strerror(err));
- return -FDT_ERR_NOTFOUND;
- }
- return 0;
-}
-#endif
-
-int board_eth_init(struct bd_info *bis)
-{
-#ifdef CONFIG_SMC911X
- u32 smc_bw_conf, smc_bc_conf;
- struct fdt_sromc config;
- fdt_addr_t base_addr;
- int node;
-
- node = decode_sromc(gd->fdt_blob, &config);
- if (node < 0) {
- debug("%s: Could not find sromc configuration\n", __func__);
- return 0;
- }
- node = fdtdec_next_compatible(gd->fdt_blob, node, COMPAT_SMSC_LAN9215);
- if (node < 0) {
- debug("%s: Could not find lan9215 configuration\n", __func__);
- return 0;
- }
-
- /* We now have a node, so any problems from now on are errors */
- base_addr = fdtdec_get_addr(gd->fdt_blob, node, "reg");
- if (base_addr == FDT_ADDR_T_NONE) {
- debug("%s: Could not find lan9215 address\n", __func__);
- return -1;
- }
-
- /* Ethernet needs data bus width of 16 bits */
- if (config.width != 2) {
- debug("%s: Unsupported bus width %d\n", __func__,
- config.width);
- return -1;
- }
- smc_bw_conf = SROMC_DATA16_WIDTH(config.bank)
- | SROMC_BYTE_ENABLE(config.bank);
-
- smc_bc_conf = SROMC_BC_TACS(config.timing[FDT_SROM_TACS]) |
- SROMC_BC_TCOS(config.timing[FDT_SROM_TCOS]) |
- SROMC_BC_TACC(config.timing[FDT_SROM_TACC]) |
- SROMC_BC_TCOH(config.timing[FDT_SROM_TCOH]) |
- SROMC_BC_TAH(config.timing[FDT_SROM_TAH]) |
- SROMC_BC_TACP(config.timing[FDT_SROM_TACP]) |
- SROMC_BC_PMC(config.timing[FDT_SROM_PMC]);
-
- /* Select and configure the SROMC bank */
- exynos_pinmux_config(PERIPH_ID_SROMC, config.bank);
- s5p_config_sromc(config.bank, smc_bw_conf, smc_bc_conf);
- return smc911x_initialize(0, base_addr);
-#endif
- return 0;
-}
-
#if defined(CONFIG_DISPLAY_BOARDINFO) || defined(CONFIG_DISPLAY_BOARDINFO_LATE)
int checkboard(void)
{
diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c
index 1318ea716a..0d77a57f80 100644
--- a/board/samsung/common/exynos5-dt.c
+++ b/board/samsung/common/exynos5-dt.c
@@ -169,7 +169,7 @@ char *get_dfu_alt_boot(char *interface, char *devstr)
if (board_is_odroidxu4() || board_is_odroidhc1() || board_is_odroidhc2())
return info;
- dev_num = simple_strtoul(devstr, NULL, 10);
+ dev_num = dectoul(devstr, NULL);
mmc = find_mmc_device(dev_num);
if (!mmc)
diff --git a/board/samsung/common/sromc.c b/board/samsung/common/sromc.c
new file mode 100644
index 0000000000..76e37dfe26
--- /dev/null
+++ b/board/samsung/common/sromc.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Google LLC
+ */
+
+#define LOG_CATEGORY UCLASS_ETH
+
+#include <common.h>
+#include <dm.h>
+#include <log.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/sromc.h>
+
+enum {
+ FDT_SROM_PMC,
+ FDT_SROM_TACP,
+ FDT_SROM_TAH,
+ FDT_SROM_TCOH,
+ FDT_SROM_TACC,
+ FDT_SROM_TCOS,
+ FDT_SROM_TACS,
+
+ FDT_SROM_TIMING_COUNT,
+};
+
+static int exyno5_sromc_probe(struct udevice *dev)
+{
+ u32 timing[FDT_SROM_TIMING_COUNT]; /* timing parameters */
+ u32 smc_bw_conf, smc_bc_conf;
+ int bank; /* srom bank number */
+ int width; /* bus width in bytes */
+ int ret;
+
+ if (!IS_ENABLED(CONFIG_SMC911X))
+ return 0;
+
+ bank = dev_read_s32_default(dev, "bank", 0);
+ width = dev_read_s32_default(dev, "width", 2);
+
+ /* Ethernet needs data bus width of 16 bits */
+ if (width != 2) {
+ log_debug("Unsupported bus width %d\n", width);
+ return log_msg_ret("width", -EINVAL);
+ }
+ ret = dev_read_u32_array(dev, "srom-timing", timing,
+ FDT_SROM_TIMING_COUNT);
+ if (ret)
+ return log_msg_ret("sromc", -EINVAL);
+
+ smc_bw_conf = SROMC_DATA16_WIDTH(bank) | SROMC_BYTE_ENABLE(bank);
+ smc_bc_conf = SROMC_BC_TACS(timing[FDT_SROM_TACS]) |
+ SROMC_BC_TCOS(timing[FDT_SROM_TCOS]) |
+ SROMC_BC_TACC(timing[FDT_SROM_TACC]) |
+ SROMC_BC_TCOH(timing[FDT_SROM_TCOH]) |
+ SROMC_BC_TAH(timing[FDT_SROM_TAH]) |
+ SROMC_BC_TACP(timing[FDT_SROM_TACP]) |
+ SROMC_BC_PMC(timing[FDT_SROM_PMC]);
+
+ /* Select and configure the SROMC bank */
+ exynos_pinmux_config(PERIPH_ID_SROMC, bank);
+ s5p_config_sromc(bank, smc_bw_conf, smc_bc_conf);
+
+ return 0;
+}
+
+static const struct udevice_id exyno5_sromc_ids[] = {
+ { .compatible = "samsung,exynos5-sromc" },
+ {}
+};
+
+U_BOOT_DRIVER(exyno5_sromc) = {
+ .name = "exyno5_sromc",
+ .id = UCLASS_SIMPLE_BUS,
+ .of_match = exyno5_sromc_ids,
+ .probe = exyno5_sromc_probe,
+};
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 90aab62d33..35e4cee74f 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -85,7 +85,7 @@ char *get_dfu_alt_boot(char *interface, char *devstr)
char *alt_boot;
int dev_num;
- dev_num = simple_strtoul(devstr, NULL, 10);
+ dev_num = dectoul(devstr, NULL);
mmc = find_mmc_device(dev_num);
if (!mmc)
diff --git a/board/samsung/smdkv310/smdkv310.c b/board/samsung/smdkv310/smdkv310.c
index 8811cbb9ad..bb61ba1f81 100644
--- a/board/samsung/smdkv310/smdkv310.c
+++ b/board/samsung/smdkv310/smdkv310.c
@@ -73,15 +73,6 @@ int dram_init_banksize(void)
return 0;
}
-int board_eth_init(struct bd_info *bis)
-{
- int rc = 0;
-#ifdef CONFIG_SMC911X
- rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
-#endif
- return rc;
-}
-
#ifdef CONFIG_DISPLAY_BOARDINFO
int checkboard(void)
{
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c
index 2e3ae1a54d..fba678b426 100644
--- a/board/siemens/common/factoryset.c
+++ b/board/siemens/common/factoryset.c
@@ -243,7 +243,7 @@ int factoryset_read_eeprom(int i2c_addr)
buf, MAX_STRING_LENGTH);
cp1 = buf;
for (i = 0; i < 6; i++) {
- factory_dat.mac[i] = simple_strtoul((char *)cp1, NULL, 16);
+ factory_dat.mac[i] = hextoul((char *)cp1, NULL);
cp1 += 3;
}
@@ -254,8 +254,7 @@ int factoryset_read_eeprom(int i2c_addr)
if (ret > 0) {
cp1 = buf;
for (i = 0; i < 6; i++) {
- factory_dat.mac_wlan[i] = simple_strtoul((char *)cp1,
- NULL, 16);
+ factory_dat.mac_wlan[i] = hextoul((char *)cp1, NULL);
cp1 += 3;
}
}
@@ -266,15 +265,13 @@ int factoryset_read_eeprom(int i2c_addr)
if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1",
(uchar *)"vid", buf,
MAX_STRING_LENGTH)) {
- factory_dat.usb_vendor_id = simple_strtoul((char *)buf,
- NULL, 16);
+ factory_dat.usb_vendor_id = hextoul((char *)buf, NULL);
}
if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1",
(uchar *)"pid", buf,
MAX_STRING_LENGTH)) {
- factory_dat.usb_product_id = simple_strtoul((char *)buf,
- NULL, 16);
+ factory_dat.usb_product_id = hextoul((char *)buf, NULL);
}
printf("DFU USB: VID = 0x%4x, PID = 0x%4x\n", factory_dat.usb_vendor_id,
factory_dat.usb_product_id);
@@ -294,8 +291,7 @@ int factoryset_read_eeprom(int i2c_addr)
if (0 <= get_factory_record_val(cp, size, (uchar *)"DEV",
(uchar *)"ver", buf,
MAX_STRING_LENGTH)) {
- factory_dat.version = simple_strtoul((char *)buf,
- NULL, 16);
+ factory_dat.version = hextoul((char *)buf, NULL);
debug("version number: %d\n", factory_dat.version);
}
/* Get ASN from factory set if available */
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index cad16f9065..dae064d465 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -394,10 +394,9 @@ static int do_upgrade_available(struct cmd_tbl *cmdtp, int flag, int argc,
unsigned long boot_retry = 0;
char boot_buf[10];
- upgrade_available = simple_strtoul(env_get("upgrade_available"), NULL,
- 10);
+ upgrade_available = dectoul(env_get("upgrade_available"), NULL);
if (upgrade_available) {
- boot_retry = simple_strtoul(env_get("boot_retries"), NULL, 10);
+ boot_retry = dectoul(env_get("boot_retries"), NULL);
boot_retry++;
sprintf(boot_buf, "%lx", boot_retry);
env_set("boot_retries", boot_buf);
diff --git a/board/sifive/unmatched/hifive-platform-i2c-eeprom.c b/board/sifive/unmatched/hifive-platform-i2c-eeprom.c
index ad2f3155d0..2b985b9b22 100644
--- a/board/sifive/unmatched/hifive-platform-i2c-eeprom.c
+++ b/board/sifive/unmatched/hifive-platform-i2c-eeprom.c
@@ -281,7 +281,7 @@ static void set_mac_address(char *string)
}
for (i = 0; *string && (i < MAC_ADDR_BYTES); i++) {
- e.mac_addr[i] = simple_strtoul(string, &string, 16);
+ e.mac_addr[i] = hextoul(string, &string);
if (*string == ':')
string++;
}
@@ -324,7 +324,7 @@ static void set_pcb_revision(char *string)
{
unsigned long p;
- p = simple_strtoul(string, &string, 10);
+ p = dectoul(string, &string);
if (p > U8_MAX) {
printf("%s must not be greater than %d\n", "PCB revision",
U8_MAX);
@@ -366,7 +366,7 @@ static void set_bom_variant(char *string)
{
unsigned long p;
- p = simple_strtoul(string, &string, 10);
+ p = dectoul(string, &string);
if (p > U8_MAX) {
printf("%s must not be greater than %d\n", "BOM variant",
U8_MAX);
@@ -389,7 +389,7 @@ static void set_product_id(char *string)
{
unsigned long p;
- p = simple_strtoul(string, &string, 10);
+ p = dectoul(string, &string);
if (p > U16_MAX) {
printf("%s must not be greater than %d\n", "Product ID",
U16_MAX);
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index 3444af6a8c..3ba2fbbd56 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -53,7 +53,7 @@ int checkboard (void)
}
putc('\n');
-#if defined(CONFIG_PCI) || defined(CONFIG_DM_PCI)
+#if defined(CONFIG_PCI)
/* Check the PCI_clk sel bit */
if (in_be32(&gur->porpllsr) & (1<<15)) {
src = "SYSCLK";
@@ -130,9 +130,7 @@ int misc_init_r (void)
&flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
}
-#if defined(CONFIG_DM_PCI)
pci_init();
-#endif
return 0;
}
diff --git a/board/synopsys/hsdk/env-lib.c b/board/synopsys/hsdk/env-lib.c
index 235f29565f..fd54ac75f2 100644
--- a/board/synopsys/hsdk/env-lib.c
+++ b/board/synopsys/hsdk/env-lib.c
@@ -252,9 +252,9 @@ static int arg_read_set(const struct env_map_common *map, u32 i, int argc,
char *endp = argv[1];
if (map[i].type == ENV_HEX)
- map[i].val->val = simple_strtoul(argv[1], &endp, 16);
+ map[i].val->val = hextoul(argv[1], &endp);
else
- map[i].val->val = simple_strtoul(argv[1], &endp, 10);
+ map[i].val->val = dectoul(argv[1], &endp);
map[i].val->set = true;
diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
index cdbb9a87bc..21c58c76d6 100644
--- a/board/ti/am64x/evm.c
+++ b/board/ti/am64x/evm.c
@@ -120,7 +120,7 @@ static void setup_serial(void)
if (env_get("serial#"))
return;
- board_serial = simple_strtoul(ep->serial, &endp, 16);
+ board_serial = hextoul(ep->serial, &endp);
if (*endp != '\0') {
pr_err("Error: Can't set serial# to %s\n", ep->serial);
return;
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 580f13c3ab..077d83420c 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -201,7 +201,7 @@ static void setup_serial(void)
if (env_get("serial#"))
return;
- board_serial = simple_strtoul(ep->serial, &endp, 16);
+ board_serial = hextoul(ep->serial, &endp);
if (*endp != '\0') {
pr_err("Error: Can't set serial# to %s\n", ep->serial);
return;
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
index 93eb20cf63..e4f9a0db91 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -548,7 +548,7 @@ static int get_cfgblock_interactive(void)
len = cli_readline(message);
}
- tdx_serial = simple_strtoul(console_buffer, NULL, 10);
+ tdx_serial = dectoul(console_buffer, NULL);
return 0;
}
@@ -566,14 +566,14 @@ static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag,
/* Get hardware information from the first 8 digits */
tag->ver_major = barcode[4] - '0';
tag->ver_minor = barcode[5] - '0';
- tag->ver_assembly = simple_strtoul(revision, NULL, 10);
+ tag->ver_assembly = dectoul(revision, NULL);
barcode[4] = '\0';
- tag->prodid = simple_strtoul(barcode, NULL, 10);
+ tag->prodid = dectoul(barcode, NULL);
/* Parse second part of the barcode (serial number */
barcode += 8;
- *serial = simple_strtoul(barcode, NULL, 10);
+ *serial = dectoul(barcode, NULL);
return 0;
}
@@ -710,7 +710,7 @@ int try_migrate_tdx_cfg_block_carrier(void)
tdx_car_hw_tag.ver_assembly = pid8[7] - '0';
pid8[4] = '\0';
- tdx_car_hw_tag.prodid = simple_strtoul(pid8, NULL, 10);
+ tdx_car_hw_tag.prodid = dectoul(pid8, NULL);
/* Valid Tag */
write_tag(config_block, &offset, TAG_VALID, NULL, 0);
@@ -754,7 +754,7 @@ static int get_cfgblock_carrier_interactive(void)
sprintf(message, "Choose your carrier board (provide ID): ");
len = cli_readline(message);
- tdx_car_hw_tag.prodid = simple_strtoul(console_buffer, NULL, 10);
+ tdx_car_hw_tag.prodid = dectoul(console_buffer, NULL);
do {
sprintf(message, "Enter carrier board version (e.g. V1.1B): V");
@@ -770,7 +770,7 @@ static int get_cfgblock_carrier_interactive(void)
len = cli_readline(message);
}
- tdx_car_serial = simple_strtoul(console_buffer, NULL, 10);
+ tdx_car_serial = dectoul(console_buffer, NULL);
return 0;
}
diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c
index 251d9fd73e..8f624e5e36 100644
--- a/board/varisys/common/sys_eeprom.c
+++ b/board/varisys/common/sys_eeprom.c
@@ -299,7 +299,7 @@ static void set_mac_address(unsigned int index, const char *string)
}
for (i = 0; *p && (i < 6); i++) {
- e.mac[index][i] = simple_strtoul(p, &p, 16);
+ e.mac[index][i] = hextoul(p, &p);
if (*p == ':')
p++;
}
@@ -364,11 +364,11 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
set_date(argv[2]);
break;
case 'p': /* MAC table size */
- e.mac_count = simple_strtoul(argv[2], NULL, 16);
+ e.mac_count = hextoul(argv[2], NULL);
update_crc();
break;
case '0' ... '9': /* "mac 0" through "mac 22" */
- set_mac_address(simple_strtoul(argv[1], NULL, 10), argv[2]);
+ set_mac_address(dectoul(argv[1], NULL), argv[2]);
break;
case 'h': /* help */
default:
diff --git a/board/work-microwave/work_92105/work_92105_display.c b/board/work-microwave/work_92105/work_92105_display.c
index fecbbbdb58..e8e559ce1f 100644
--- a/board/work-microwave/work_92105/work_92105_display.c
+++ b/board/work-microwave/work_92105/work_92105_display.c
@@ -233,8 +233,7 @@ void work_92105_display_init(void)
/* set display contrast */
display_contrast_str = env_get("fwopt_dispcontrast");
if (display_contrast_str)
- display_contrast = simple_strtoul(display_contrast_str,
- NULL, 10);
+ display_contrast = dectoul(display_contrast_str, NULL);
i2c_write(0x2c, 0x00, 1, &display_contrast, 1);
/* request GPO_15 as an output initially set to 1 */
diff --git a/board/xes/common/fsl_8xxx_pci.c b/board/xes/common/fsl_8xxx_pci.c
index 157aa32826..c1fce7d331 100644
--- a/board/xes/common/fsl_8xxx_pci.c
+++ b/board/xes/common/fsl_8xxx_pci.c
@@ -14,56 +14,6 @@
#include <linux/libfdt.h>
#include <fdt_support.h>
-
-#ifdef CONFIG_PCI1
-static struct pci_controller pci1_hose;
-#endif
-
-void pci_init_board(void)
-{
- int first_free_busno = 0;
-
-#ifdef CONFIG_PCI1
- int pcie_ep;
- struct fsl_pci_info pci_info;
- volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
- u32 devdisr = in_be32(&gur->devdisr);
- uint pci_spd_norm = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1_SPD;
- uint pci_32 = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1_PCI32;
- uint pci_arb = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1_ARB;
- uint pcix = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1;
- uint freq = CONFIG_SYS_CLK_FREQ / 1000 / 1000;
-
- if (!(devdisr & MPC85xx_DEVDISR_PCI1)) {
- SET_STD_PCI_INFO(pci_info, 1);
- set_next_law(pci_info.mem_phys,
- law_size_bits(pci_info.mem_size), pci_info.law);
- set_next_law(pci_info.io_phys,
- law_size_bits(pci_info.io_size), pci_info.law);
-
- pcie_ep = fsl_setup_hose(&pci1_hose, pci_info.regs);
- printf("PCI1: %d bit %s, %s %d MHz, %s, %s\n",
- pci_32 ? 32 : 64,
- pcix ? "PCIX" : "PCI",
- pci_spd_norm ? ">=" : "<=",
- pcix ? freq * 2 : freq,
- pcie_ep ? "agent" : "host",
- pci_arb ? "arbiter" : "external-arbiter");
-
- first_free_busno = fsl_pci_init_port(&pci_info,
- &pci1_hose, first_free_busno);
- } else {
- printf("PCI1: disabled\n");
- }
-#elif defined CONFIG_ARCH_MPC8548
- volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
- /* PCI1 not present on MPC8572 */
- setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI1);
-#endif
-
- fsl_pcie_init_board(first_free_busno);
-}
-
#if defined(CONFIG_OF_BOARD_SETUP)
void ft_board_pci_setup(void *blob, struct bd_info *bd)
{
diff --git a/board/xilinx/common/fru.c b/board/xilinx/common/fru.c
index ccf48723ff..f6ca46c3ce 100644
--- a/board/xilinx/common/fru.c
+++ b/board/xilinx/common/fru.c
@@ -19,7 +19,7 @@ static int do_fru_capture(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], &endp, 16);
+ addr = hextoul(argv[2], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
@@ -41,7 +41,7 @@ static int do_fru_generate(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
return fru_generate(addr, argv[3], argv[4], argv[5], argv[6], argv[7]);
}
diff --git a/board/xilinx/versal/cmds.c b/board/xilinx/versal/cmds.c
index f5735d0c62..04d4cdb141 100644
--- a/board/xilinx/versal/cmds.c
+++ b/board/xilinx/versal/cmds.c
@@ -32,7 +32,7 @@ static int do_versal_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
- len = simple_strtoul(argv[3], NULL, 16);
+ len = hextoul(argv[3], NULL);
if (!len) {
debug("pdi_load: zero size\n");
return CMD_RET_USAGE;
diff --git a/board/xilinx/zynq/cmds.c b/board/xilinx/zynq/cmds.c
index 6c697caa62..024fac65f3 100644
--- a/board/xilinx/zynq/cmds.c
+++ b/board/xilinx/zynq/cmds.c
@@ -422,7 +422,7 @@ static int do_zynq_rsa(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_FAILURE;
- src_ptr = simple_strtoul(argv[2], &endp, 16);
+ src_ptr = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return CMD_RET_USAGE;
@@ -453,26 +453,26 @@ static int zynq_decrypt_image(struct cmd_tbl *cmdtp, int flag, int argc,
else
return CMD_RET_USAGE;
- srcaddr = simple_strtoul(argv[3], &endp, 16);
+ srcaddr = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return CMD_RET_USAGE;
- srclen = simple_strtoul(argv[4], &endp, 16);
+ srclen = hextoul(argv[4], &endp);
if (*argv[4] == 0 || *endp != 0)
return CMD_RET_USAGE;
dstaddr = 0xFFFFFFFF;
dstlen = srclen;
} else {
- srcaddr = simple_strtoul(argv[2], &endp, 16);
+ srcaddr = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return CMD_RET_USAGE;
- srclen = simple_strtoul(argv[3], &endp, 16);
+ srclen = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return CMD_RET_USAGE;
- dstaddr = simple_strtoul(argv[4], &endp, 16);
+ dstaddr = hextoul(argv[4], &endp);
if (*argv[4] == 0 || *endp != 0)
return CMD_RET_USAGE;
- dstlen = simple_strtoul(argv[5], &endp, 16);
+ dstlen = hextoul(argv[5], &endp);
if (*argv[5] == 0 || *endp != 0)
return CMD_RET_USAGE;
}
diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
index cf63ad97fa..b15c0f599b 100644
--- a/board/xilinx/zynqmp/cmds.c
+++ b/board/xilinx/zynqmp/cmds.c
@@ -40,7 +40,7 @@ static int do_zynqmp_verify_secure(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
src_addr = simple_strtoull(argv[2], NULL, 16);
- len = simple_strtoul(argv[3], NULL, 16);
+ len = hextoul(argv[3], NULL);
if (argc == 5)
key_ptr = (uint8_t *)(uintptr_t)simple_strtoull(argv[4],
@@ -86,7 +86,7 @@ static int do_zynqmp_mmio_read(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
ret = zynqmp_mmio_read(addr, &read_val);
if (!ret)
@@ -107,9 +107,9 @@ static int do_zynqmp_mmio_write(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
- mask = simple_strtoul(argv[3], NULL, 16);
- val = simple_strtoul(argv[4], NULL, 16);
+ addr = hextoul(argv[2], NULL);
+ mask = hextoul(argv[3], NULL);
+ val = hextoul(argv[4], NULL);
ret = zynqmp_mmio_write(addr, mask, val);
if (ret != 0)
@@ -135,12 +135,12 @@ static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs - 1)
return CMD_RET_USAGE;
- aes->srcaddr = simple_strtoul(argv[2], NULL, 16);
- aes->ivaddr = simple_strtoul(argv[3], NULL, 16);
- aes->len = simple_strtoul(argv[4], NULL, 16);
- aes->op = simple_strtoul(argv[5], NULL, 16);
- aes->keysrc = simple_strtoul(argv[6], NULL, 16);
- aes->dstaddr = simple_strtoul(argv[7], NULL, 16);
+ aes->srcaddr = hextoul(argv[2], NULL);
+ aes->ivaddr = hextoul(argv[3], NULL);
+ aes->len = hextoul(argv[4], NULL);
+ aes->op = hextoul(argv[5], NULL);
+ aes->keysrc = hextoul(argv[6], NULL);
+ aes->dstaddr = hextoul(argv[7], NULL);
flush_dcache_range((ulong)aes, (ulong)(aes) +
roundup(sizeof(struct aes), ARCH_DMA_MINALIGN));
@@ -161,7 +161,7 @@ static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs)
return CMD_RET_USAGE;
- aes->keyaddr = simple_strtoul(argv[8], NULL, 16);
+ aes->keyaddr = hextoul(argv[8], NULL);
if (aes->keyaddr)
flush_dcache_range(aes->keyaddr,
(aes->keyaddr +
@@ -187,7 +187,7 @@ static int do_zynqmp_tcm_init(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
- mode = simple_strtoul(argv[2], NULL, 16);
+ mode = hextoul(argv[2], NULL);
if (mode != TCM_LOCK && mode != TCM_SPLIT) {
printf("Mode should be either 0(lock)/1(split)\n");
return CMD_RET_FAILURE;
@@ -209,8 +209,8 @@ static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
- size = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[2], NULL);
+ size = hextoul(argv[3], NULL);
flush_dcache_range((ulong)addr, (ulong)(addr + size));
zynqmp_pmufw_load_config_object((const void *)(uintptr_t)addr,
@@ -236,16 +236,16 @@ static int do_zynqmp_rsa(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
- srcaddr = simple_strtoul(argv[2], NULL, 16);
- srclen = simple_strtoul(argv[3], NULL, 16);
+ srcaddr = hextoul(argv[2], NULL);
+ srclen = hextoul(argv[3], NULL);
if (srclen != RSA_KEY_SIZE) {
puts("ERR: srclen should be equal to 0x200(512 bytes)\n");
return CMD_RET_USAGE;
}
- mod = simple_strtoul(argv[4], NULL, 16);
- exp = simple_strtoul(argv[5], NULL, 16);
- rsaop = simple_strtoul(argv[6], NULL, 16);
+ mod = hextoul(argv[4], NULL);
+ exp = hextoul(argv[5], NULL);
+ rsaop = hextoul(argv[6], NULL);
if (!(rsaop == 0 || rsaop == 1)) {
puts("ERR: rsaop should be either 0 or 1\n");
return CMD_RET_USAGE;
@@ -299,11 +299,11 @@ static int do_zynqmp_sha3(struct cmd_tbl *cmdtp, int flag,
return CMD_RET_FAILURE;
}
- srcaddr = simple_strtoul(argv[2], NULL, 16);
- srclen = simple_strtoul(argv[3], NULL, 16);
+ srcaddr = hextoul(argv[2], NULL);
+ srclen = hextoul(argv[3], NULL);
if (argc == 5) {
- hashaddr = simple_strtoul(argv[4], NULL, 16);
+ hashaddr = hextoul(argv[4], NULL);
flush_dcache_range(hashaddr,
hashaddr + roundup(ZYNQMP_SHA3_SIZE,
ARCH_DMA_MINALIGN));
diff --git a/cmd/abootimg.c b/cmd/abootimg.c
index 40e8978f15..f48a9dcb02 100644
--- a/cmd/abootimg.c
+++ b/cmd/abootimg.c
@@ -161,7 +161,7 @@ static int do_abootimg_addr(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
- img_addr = simple_strtoul(argv[1], &endp, 16);
+ img_addr = hextoul(argv[1], &endp);
if (*endp != '\0') {
printf("Error: Wrong image address\n");
return CMD_RET_FAILURE;
diff --git a/cmd/adtimg.c b/cmd/adtimg.c
index aa943007f3..f4b5cbf35b 100644
--- a/cmd/adtimg.c
+++ b/cmd/adtimg.c
@@ -27,7 +27,7 @@ static int do_adtimg_addr(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
- hdr_addr = simple_strtoul(argv[1], &endp, 16);
+ hdr_addr = hextoul(argv[1], &endp);
if (*endp != '\0') {
printf("Error: Wrong image address '%s'\n", argv[1]);
return CMD_RET_FAILURE;
diff --git a/cmd/aes.c b/cmd/aes.c
index 4c0dad9932..1936518824 100644
--- a/cmd/aes.c
+++ b/cmd/aes.c
@@ -55,11 +55,11 @@ static int do_aes(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
return CMD_RET_USAGE;
- key_addr = simple_strtoul(argv[2], NULL, 16);
- iv_addr = simple_strtoul(argv[3], NULL, 16);
- src_addr = simple_strtoul(argv[4], NULL, 16);
- dst_addr = simple_strtoul(argv[5], NULL, 16);
- len = simple_strtoul(argv[6], NULL, 16);
+ key_addr = hextoul(argv[2], NULL);
+ iv_addr = hextoul(argv[3], NULL);
+ src_addr = hextoul(argv[4], NULL);
+ dst_addr = hextoul(argv[5], NULL);
+ len = hextoul(argv[6], NULL);
key_ptr = (uint8_t *)map_sysmem(key_addr, key_len);
iv_ptr = (uint8_t *)map_sysmem(iv_addr, 128 / 8);
diff --git a/cmd/armflash.c b/cmd/armflash.c
index 5e7315eb7c..d1466f73aa 100644
--- a/cmd/armflash.c
+++ b/cmd/armflash.c
@@ -280,7 +280,7 @@ static int do_afs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
} else if (argc == 4 && !strcmp(argv[1], "load")) {
ulong load_addr;
- load_addr = simple_strtoul(argv[3], NULL, 16);
+ load_addr = hextoul(argv[3], NULL);
ret = load_image(argv[2], load_addr);
} else {
return CMD_RET_USAGE;
diff --git a/cmd/avb.c b/cmd/avb.c
index 88172a9ee6..783f51b816 100644
--- a/cmd/avb.c
+++ b/cmd/avb.c
@@ -22,7 +22,7 @@ int do_avb_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc != 2)
return CMD_RET_USAGE;
- mmc_dev = simple_strtoul(argv[1], NULL, 16);
+ mmc_dev = hextoul(argv[1], NULL);
if (avb_ops)
avb_ops_free(avb_ops);
@@ -53,9 +53,9 @@ int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
part = argv[1];
- offset = simple_strtoul(argv[2], NULL, 16);
- bytes = simple_strtoul(argv[3], NULL, 16);
- buffer = (void *)simple_strtoul(argv[4], NULL, 16);
+ offset = hextoul(argv[2], NULL);
+ bytes = hextoul(argv[3], NULL);
+ buffer = (void *)hextoul(argv[4], NULL);
if (avb_ops->read_from_partition(avb_ops, part, offset, bytes,
buffer, &bytes_read) ==
@@ -86,8 +86,8 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
part = argv[1];
- offset = simple_strtoul(argv[2], NULL, 16);
- bytes = simple_strtoul(argv[3], NULL, 16);
+ offset = hextoul(argv[2], NULL);
+ bytes = hextoul(argv[3], NULL);
buffer = malloc(bytes);
if (!buffer) {
@@ -132,9 +132,9 @@ int do_avb_write_part(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
part = argv[1];
- offset = simple_strtoul(argv[2], NULL, 16);
- bytes = simple_strtoul(argv[3], NULL, 16);
- buffer = (void *)simple_strtoul(argv[4], NULL, 16);
+ offset = hextoul(argv[2], NULL);
+ bytes = hextoul(argv[3], NULL);
+ buffer = (void *)hextoul(argv[4], NULL);
if (avb_ops->write_to_partition(avb_ops, part, offset, bytes, buffer) ==
AVB_IO_RESULT_OK) {
@@ -161,7 +161,7 @@ int do_avb_read_rb(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
- index = (size_t)simple_strtoul(argv[1], NULL, 16);
+ index = (size_t)hextoul(argv[1], NULL);
if (avb_ops->read_rollback_index(avb_ops, index, &rb_idx) ==
AVB_IO_RESULT_OK) {
@@ -188,8 +188,8 @@ int do_avb_write_rb(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 3)
return CMD_RET_USAGE;
- index = (size_t)simple_strtoul(argv[1], NULL, 16);
- rb_idx = simple_strtoul(argv[2], NULL, 16);
+ index = (size_t)hextoul(argv[1], NULL);
+ rb_idx = hextoul(argv[2], NULL);
if (avb_ops->write_rollback_index(avb_ops, index, rb_idx) ==
AVB_IO_RESULT_OK)
@@ -366,7 +366,7 @@ int do_avb_read_pvalue(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
name = argv[1];
- bytes = simple_strtoul(argv[2], &endp, 10);
+ bytes = dectoul(argv[2], &endp);
if (*endp && *endp != '\n')
return CMD_RET_USAGE;
diff --git a/cmd/axi.c b/cmd/axi.c
index c72197ee82..0c80fef053 100644
--- a/cmd/axi.c
+++ b/cmd/axi.c
@@ -120,7 +120,7 @@ static int do_axi_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
int i;
/* show specific bus */
- i = simple_strtoul(argv[1], NULL, 10);
+ i = dectoul(argv[1], NULL);
struct udevice *bus;
int ret;
@@ -153,7 +153,7 @@ static int do_axi_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
printf("Current bus is %d\n", bus_no);
} else {
- bus_no = simple_strtoul(argv[1], NULL, 10);
+ bus_no = dectoul(argv[1], NULL);
printf("Setting bus to %d\n", bus_no);
ret = axi_set_cur_bus(bus_no);
@@ -193,19 +193,19 @@ static int do_axi_md(struct cmd_tbl *cmdtp, int flag, int argc,
}
if ((flag & CMD_FLAG_REPEAT) == 0) {
- size = simple_strtoul(argv[1], NULL, 10);
+ size = dectoul(argv[1], NULL);
/*
* Address is specified since argc >= 3
*/
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
/*
* If there's another parameter, it is the length to display;
* length is the number of objects, not number of bytes
*/
if (argc > 3)
- length = simple_strtoul(argv[3], NULL, 16);
+ length = hextoul(argv[3], NULL);
}
switch (size) {
@@ -273,7 +273,7 @@ static int do_axi_mw(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc <= 3 || argc >= 6)
return CMD_RET_USAGE;
- size = simple_strtoul(argv[1], NULL, 10);
+ size = dectoul(argv[1], NULL);
switch (size) {
case 8:
@@ -291,14 +291,14 @@ static int do_axi_mw(struct cmd_tbl *cmdtp, int flag, int argc,
};
/* Address is specified since argc > 4 */
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
/* Get the value to write */
- writeval = simple_strtoul(argv[3], NULL, 16);
+ writeval = hextoul(argv[3], NULL);
/* Count ? */
if (argc == 5)
- count = simple_strtoul(argv[4], NULL, 16);
+ count = hextoul(argv[4], NULL);
else
count = 1;
diff --git a/cmd/bedbug.c b/cmd/bedbug.c
index bef617b6a4..549c9056dd 100644
--- a/cmd/bedbug.c
+++ b/cmd/bedbug.c
@@ -75,11 +75,11 @@ int do_bedbug_dis(struct cmd_tbl *cmdtp, int flag, int argc,
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command */
- addr = simple_strtoul (argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
/* If an extra param is given then it is the length */
if (argc > 2)
- len = simple_strtoul (argv[2], NULL, 16);
+ len = hextoul(argv[2], NULL);
}
/* Run the disassembler */
@@ -114,7 +114,7 @@ int do_bedbug_asm(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
printf ("\nEnter '.' when done\n");
- mem_addr = simple_strtoul (argv[1], NULL, 16);
+ mem_addr = hextoul(argv[1], NULL);
while (1) {
putc ('\n');
diff --git a/cmd/bind.c b/cmd/bind.c
index af2f22cc4c..07c629eff7 100644
--- a/cmd/bind.c
+++ b/cmd/bind.c
@@ -218,13 +218,13 @@ static int do_bind_unbind(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
ret = unbind_by_node_path(argv[1]);
} else if (!by_node && bind) {
- int index = (argc > 2) ? simple_strtoul(argv[2], NULL, 10) : 0;
+ int index = (argc > 2) ? dectoul(argv[2], NULL) : 0;
if (argc != 4)
return CMD_RET_USAGE;
ret = bind_by_class_index(argv[1], index, argv[3]);
} else if (!by_node && !bind) {
- int index = (argc > 2) ? simple_strtoul(argv[2], NULL, 10) : 0;
+ int index = (argc > 2) ? dectoul(argv[2], NULL) : 0;
if (argc == 3)
ret = unbind_by_class_index(argv[1], index);
diff --git a/cmd/binop.c b/cmd/binop.c
index c85cb51568..592e914690 100644
--- a/cmd/binop.c
+++ b/cmd/binop.c
@@ -58,7 +58,7 @@ void write_to_mem(char *varname, u8 *result, ulong len)
ulong addr;
u8 *buf;
- addr = simple_strtoul(varname, NULL, 16);
+ addr = hextoul(varname, NULL);
buf = map_sysmem(addr, len);
memcpy(buf, result, len);
unmap_sysmem(buf);
@@ -89,18 +89,18 @@ static int do_binop(struct cmd_tbl *cmdtp, int flag, int argc,
else
return CMD_RET_USAGE;
- len = simple_strtoul(lenarg, NULL, 10);
+ len = dectoul(lenarg, NULL);
src1 = malloc(len);
src2 = malloc(len);
if (*src1arg == '*')
- read_from_mem(simple_strtoul(src1arg + 1, NULL, 16), src1, len);
+ read_from_mem(hextoul(src1arg + 1, NULL), src1, len);
else
read_from_env_var(src1arg, src1);
if (*src2arg == '*')
- read_from_mem(simple_strtoul(src2arg + 1, NULL, 16), src2, len);
+ read_from_mem(hextoul(src2arg + 1, NULL), src2, len);
else
read_from_env_var(src2arg, src2);
diff --git a/cmd/blk_common.c b/cmd/blk_common.c
index 87f94b5abb..4e442f2918 100644
--- a/cmd/blk_common.c
+++ b/cmd/blk_common.c
@@ -40,7 +40,7 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
return CMD_RET_USAGE;
case 3:
if (strncmp(argv[1], "dev", 3) == 0) {
- int dev = (int)simple_strtoul(argv[2], NULL, 10);
+ int dev = (int)dectoul(argv[2], NULL);
if (!blk_show_device(if_type, dev)) {
*cur_devnump = dev;
@@ -50,7 +50,7 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
}
return 0;
} else if (strncmp(argv[1], "part", 4) == 0) {
- int dev = (int)simple_strtoul(argv[2], NULL, 10);
+ int dev = (int)dectoul(argv[2], NULL);
if (blk_print_part_devnum(if_type, dev)) {
printf("\n%s device %d not available\n",
@@ -63,9 +63,9 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
default: /* at least 4 args */
if (strcmp(argv[1], "read") == 0) {
- ulong addr = simple_strtoul(argv[2], NULL, 16);
- lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
- ulong cnt = simple_strtoul(argv[4], NULL, 16);
+ ulong addr = hextoul(argv[2], NULL);
+ lbaint_t blk = hextoul(argv[3], NULL);
+ ulong cnt = hextoul(argv[4], NULL);
ulong n;
printf("\n%s read: device %d block # "LBAFU", count %lu ... ",
@@ -78,9 +78,9 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
n == cnt ? "OK" : "ERROR");
return n == cnt ? 0 : 1;
} else if (strcmp(argv[1], "write") == 0) {
- ulong addr = simple_strtoul(argv[2], NULL, 16);
- lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
- ulong cnt = simple_strtoul(argv[4], NULL, 16);
+ ulong addr = hextoul(argv[2], NULL);
+ lbaint_t blk = hextoul(argv[3], NULL);
+ ulong cnt = hextoul(argv[4], NULL);
ulong n;
printf("\n%s write: device %d block # "LBAFU", count %lu ... ",
diff --git a/cmd/blkcache.c b/cmd/blkcache.c
index 25f252e455..47ea1ec0b9 100644
--- a/cmd/blkcache.c
+++ b/cmd/blkcache.c
@@ -83,5 +83,6 @@ U_BOOT_CMD(
blkcache, 4, 0, do_blkcache,
"block cache diagnostics and control",
"show - show and reset statistics\n"
- "blkcache configure blocks entries\n"
+ "blkcache configure <blocks> <entries> "
+ "- set max blocks per entry and max cache entries\n"
);
diff --git a/cmd/blob.c b/cmd/blob.c
index 887219cc07..e2efae7a11 100644
--- a/cmd/blob.c
+++ b/cmd/blob.c
@@ -70,10 +70,10 @@ static int do_blob(struct cmd_tbl *cmdtp, int flag, int argc,
else
return CMD_RET_USAGE;
- src_addr = simple_strtoul(argv[2], NULL, 16);
- dst_addr = simple_strtoul(argv[3], NULL, 16);
- len = simple_strtoul(argv[4], NULL, 16);
- key_addr = simple_strtoul(argv[5], NULL, 16);
+ src_addr = hextoul(argv[2], NULL);
+ dst_addr = hextoul(argv[3], NULL);
+ len = hextoul(argv[4], NULL);
+ key_addr = hextoul(argv[5], NULL);
km_ptr = (uint8_t *)(uintptr_t)key_addr;
src_ptr = (uint8_t *)(uintptr_t)src_addr;
diff --git a/cmd/bmp.c b/cmd/bmp.c
index 6040fa5d95..071ba90b43 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -102,7 +102,7 @@ static int do_bmp_info(struct cmd_tbl *cmdtp, int flag, int argc,
addr = image_load_addr;
break;
case 2: /* use argument */
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
break;
default:
return CMD_RET_USAGE;
@@ -124,18 +124,18 @@ static int do_bmp_display(struct cmd_tbl *cmdtp, int flag, int argc,
addr = image_load_addr;
break;
case 2: /* use argument */
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
break;
case 4:
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
if (!strcmp(argv[2], "m"))
x = BMP_ALIGN_CENTER;
else
- x = simple_strtoul(argv[2], NULL, 10);
+ x = dectoul(argv[2], NULL);
if (!strcmp(argv[3], "m"))
y = BMP_ALIGN_CENTER;
else
- y = simple_strtoul(argv[3], NULL, 10);
+ y = dectoul(argv[3], NULL);
break;
default:
return CMD_RET_USAGE;
diff --git a/cmd/boot.c b/cmd/boot.c
index b84c0ed89e..fab294e622 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -29,7 +29,7 @@ static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
printf ("## Starting application at 0x%08lX ...\n", addr);
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index cba81ffe75..83eab0bd7f 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -281,7 +281,7 @@ efi_status_t efi_install_fdt(void *fdt)
return EFI_NOT_FOUND;
}
}
- fdt_addr = simple_strtoul(fdt_opt, NULL, 16);
+ fdt_addr = hextoul(fdt_opt, NULL);
if (!fdt_addr) {
log_err("ERROR: invalid $fdt_addr or $fdtcontroladdr\n");
return EFI_LOAD_ERROR;
@@ -628,7 +628,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc > 2) {
uintptr_t fdt_addr;
- fdt_addr = simple_strtoul(argv[2], NULL, 16);
+ fdt_addr = hextoul(argv[2], NULL);
fdt = map_sysmem(fdt_addr, 0);
} else {
fdt = EFI_FDT_USE_INTERNAL;
diff --git a/cmd/booti.c b/cmd/booti.c
index 3df70ea9ca..397d4b8323 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -43,7 +43,7 @@ static int booti_start(struct cmd_tbl *cmdtp, int flag, int argc,
debug("* kernel: default image load address = 0x%08lx\n",
image_load_addr);
} else {
- ld = simple_strtoul(argv[0], NULL, 16);
+ ld = hextoul(argv[0], NULL);
debug("* kernel: cmdline image address = 0x%08lx\n", ld);
}
diff --git a/cmd/bootm.c b/cmd/bootm.c
index 81c6b93978..92468d09a1 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -112,7 +112,7 @@ int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc > 0) {
char *endp;
- simple_strtoul(argv[0], &endp, 16);
+ hextoul(argv[0], &endp);
/* endp pointing to NULL means that argv[0] was just a
* valid number, pass it along to the normal bootm processing
*
@@ -240,7 +240,7 @@ static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc,
}
for (arg = 1; arg < argc; ++arg) {
- addr = simple_strtoul(argv[arg], NULL, 16);
+ addr = hextoul(argv[arg], NULL);
if (image_info(addr) != 0)
rcode = 1;
}
diff --git a/cmd/bootstage.c b/cmd/bootstage.c
index 0e623f216b..77a4bc66ff 100644
--- a/cmd/bootstage.c
+++ b/cmd/bootstage.c
@@ -24,12 +24,12 @@ static int get_base_size(int argc, char *const argv[], ulong *basep,
*sizep = CONFIG_BOOTSTAGE_STASH_SIZE;
if (argc < 2)
return 0;
- *basep = simple_strtoul(argv[1], &endp, 16);
+ *basep = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
if (argc == 2)
return 0;
- *sizep = simple_strtoul(argv[2], &endp, 16);
+ *sizep = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return -1;
diff --git a/cmd/bootz.c b/cmd/bootz.c
index 7556cd2752..4f024bde5f 100644
--- a/cmd/bootz.c
+++ b/cmd/bootz.c
@@ -39,7 +39,7 @@ static int bootz_start(struct cmd_tbl *cmdtp, int flag, int argc,
debug("* kernel: default image load address = 0x%08lx\n",
image_load_addr);
} else {
- images->ep = simple_strtoul(argv[0], NULL, 16);
+ images->ep = hextoul(argv[0], NULL);
debug("* kernel: cmdline image address = 0x%08lx\n",
images->ep);
}
diff --git a/cmd/broadcom/nitro_image_load.c b/cmd/broadcom/nitro_image_load.c
index 4a36b300c4..93b5cb4ceb 100644
--- a/cmd/broadcom/nitro_image_load.c
+++ b/cmd/broadcom/nitro_image_load.c
@@ -53,13 +53,13 @@ static int do_spi_images_addr(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
/* convert command parameter to fastboot address (base 16), i.e. hex */
- images_load_addr = simple_strtoul(argv[1], NULL, 16);
+ images_load_addr = hextoul(argv[1], NULL);
if (!images_load_addr) {
pr_err("Invalid load address\n");
return CMD_RET_USAGE;
}
- spi_load_addr = simple_strtoul(argv[2], NULL, 16);
+ spi_load_addr = hextoul(argv[2], NULL);
if (!spi_load_addr) {
pr_err("Invalid spi load address\n");
return CMD_RET_USAGE;
diff --git a/cmd/cbfs.c b/cmd/cbfs.c
index 10c2c929c3..8a61f2c26f 100644
--- a/cmd/cbfs.c
+++ b/cmd/cbfs.c
@@ -22,7 +22,7 @@ static int do_cbfs_init(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
if (argc == 2) {
- end_of_rom = simple_strtoul(argv[1], &ep, 16);
+ end_of_rom = hextoul(argv[1], &ep);
if (*ep) {
puts("\n** Invalid end of ROM **\n");
return 1;
@@ -58,9 +58,9 @@ static int do_cbfs_fsload(struct cmd_tbl *cmdtp, int flag, int argc,
}
/* parse offset and count */
- offset = simple_strtoul(argv[1], NULL, 16);
+ offset = hextoul(argv[1], NULL);
if (argc == 4)
- count = simple_strtoul(argv[3], NULL, 16);
+ count = hextoul(argv[3], NULL);
else
count = 0;
diff --git a/cmd/clk.c b/cmd/clk.c
index 7ece2454e0..dbbdc31b35 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -120,7 +120,7 @@ static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc,
s32 freq;
struct udevice *dev;
- freq = simple_strtoul(argv[2], NULL, 10);
+ freq = dectoul(argv[2], NULL);
dev = clk_lookup(argv[1]);
diff --git a/cmd/clone.c b/cmd/clone.c
index 32473a032c..a906207757 100644
--- a/cmd/clone.c
+++ b/cmd/clone.c
@@ -34,7 +34,7 @@ static int do_clone(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv
printf("Unable to open destination device\n");
return 1;
}
- requested = simple_strtoul(argv[5], &unit, 10);
+ requested = dectoul(argv[5], &unit);
srcbz = srcdesc->blksz;
destbz = destdesc->blksz;
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 1aeb56702c..44c0818d5d 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -107,7 +107,7 @@ int do_cramfs_load(struct cmd_tbl *cmdtp, int flag, int argc,
struct mtdids id;
ulong addr;
- addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
+ addr = hextoul(env_get("cramfsaddr"), NULL);
/* hack! */
/* cramfs_* only supports NOR flash chips */
@@ -172,7 +172,7 @@ int do_cramfs_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
struct mtdids id;
ulong addr;
- addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
+ addr = hextoul(env_get("cramfsaddr"), NULL);
/* hack! */
/* cramfs_* only supports NOR flash chips */
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c
index eb5053d642..a40f5898b5 100644
--- a/cmd/cros_ec.c
+++ b/cmd/cros_ec.c
@@ -65,11 +65,11 @@ static int do_read_write(struct udevice *dev, int is_write, int argc,
return 1;
if (argc < 4)
return 1;
- addr = simple_strtoul(argv[3], &endp, 16);
+ addr = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return 1;
if (argc > 4) {
- size = simple_strtoul(argv[4], &endp, 16);
+ size = hextoul(argv[4], &endp);
if (*argv[4] == 0 || *endp != 0)
return 1;
}
@@ -501,11 +501,11 @@ static int do_cros_ec(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- index = simple_strtoul(argv[2], &endp, 10);
+ index = dectoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return CMD_RET_USAGE;
if (argc > 3) {
- state = simple_strtoul(argv[3], &endp, 10);
+ state = dectoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return CMD_RET_USAGE;
ret = cros_ec_set_ldo(dev, index, state);
diff --git a/cmd/demo.c b/cmd/demo.c
index 78a55f72b6..571f562ec6 100644
--- a/cmd/demo.c
+++ b/cmd/demo.c
@@ -48,7 +48,7 @@ static int do_demo_light(struct cmd_tbl *cmdtp, int flag, int argc,
int ret;
if (argc) {
- light = simple_strtoul(argv[0], NULL, 16);
+ light = hextoul(argv[0], NULL);
ret = demo_set_light(demo_dev, light);
} else {
ret = demo_get_light(demo_dev);
@@ -106,7 +106,7 @@ static int do_demo(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
if (argc) {
- devnum = simple_strtoul(argv[0], NULL, 10);
+ devnum = dectoul(argv[0], NULL);
ret = uclass_get_device(UCLASS_DEMO, devnum, &demo_dev);
if (ret)
return cmd_process_error(cmdtp, ret);
diff --git a/cmd/disk.c b/cmd/disk.c
index 2726115e85..cb3b990ba3 100644
--- a/cmd/disk.c
+++ b/cmd/disk.c
@@ -36,7 +36,7 @@ int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
bootstage_mark(BOOTSTAGE_ID_IDE_ADDR);
if (argc > 1)
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 8211a589ac..67ab06aefc 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -61,7 +61,7 @@ static int do_efi_capsule_update(struct cmd_tbl *cmdtp, int flag,
argv++;
}
- capsule = (typeof(capsule))simple_strtoul(argv[1], &endp, 16);
+ capsule = (typeof(capsule))hextoul(argv[1], &endp);
if (endp == argv[1]) {
printf("Invalid address: %s", argv[1]);
return CMD_RET_FAILURE;
@@ -117,7 +117,7 @@ static int do_efi_capsule_show(struct cmd_tbl *cmdtp, int flag,
if (argc != 2)
return CMD_RET_USAGE;
- capsule = (typeof(capsule))simple_strtoul(argv[1], &endp, 16);
+ capsule = (typeof(capsule))hextoul(argv[1], &endp);
if (endp == argv[1]) {
printf("Invalid address: %s", argv[1]);
return CMD_RET_FAILURE;
@@ -256,7 +256,7 @@ static int do_efi_capsule_res(struct cmd_tbl *cmdtp, int flag,
argc--;
argv++;
- capsule_id = simple_strtoul(argv[0], &endp, 16);
+ capsule_id = hextoul(argv[0], &endp);
if (capsule_id < 0 || capsule_id > 0xffff)
return CMD_RET_USAGE;
@@ -983,7 +983,7 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag,
r = CMD_RET_USAGE;
goto out;
}
- id = (int)simple_strtoul(argv[1], &endp, 16);
+ id = (int)hextoul(argv[1], &endp);
if (*endp != '\0' || id > 0xffff)
return CMD_RET_USAGE;
@@ -1113,7 +1113,7 @@ static int do_efi_boot_rm(struct cmd_tbl *cmdtp, int flag,
guid = efi_global_variable_guid;
for (i = 1; i < argc; i++, argv++) {
- id = (int)simple_strtoul(argv[1], &endp, 16);
+ id = (int)hextoul(argv[1], &endp);
if (*endp != '\0' || id > 0xffff)
return CMD_RET_FAILURE;
@@ -1410,7 +1410,7 @@ static int do_efi_boot_next(struct cmd_tbl *cmdtp, int flag,
if (argc != 2)
return CMD_RET_USAGE;
- bootnext = (u16)simple_strtoul(argv[1], &endp, 16);
+ bootnext = (u16)hextoul(argv[1], &endp);
if (*endp) {
printf("invalid value: %s\n", argv[1]);
r = CMD_RET_FAILURE;
@@ -1469,7 +1469,7 @@ static int do_efi_boot_order(struct cmd_tbl *cmdtp, int flag,
return CMD_RET_FAILURE;
for (i = 0; i < argc; i++) {
- id = (int)simple_strtoul(argv[i], &endp, 16);
+ id = (int)hextoul(argv[i], &endp);
if (*endp != '\0' || id > 0xffff) {
printf("invalid value: %s\n", argv[i]);
r = CMD_RET_FAILURE;
diff --git a/cmd/elf.c b/cmd/elf.c
index d44b95d903..d75b21461c 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -115,7 +115,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
addr = image_load_addr;
else
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
#if defined(CONFIG_CMD_NET)
/*
@@ -200,7 +200,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (!bootaddr)
- bootaddr = simple_strtoul(tmp, NULL, 16);
+ bootaddr = hextoul(tmp, NULL);
/*
* Check to see if the bootline is defined in the 'bootargs' parameter.
diff --git a/cmd/exit.c b/cmd/exit.c
index 923f0870fb..2c7132693a 100644
--- a/cmd/exit.c
+++ b/cmd/exit.c
@@ -11,7 +11,7 @@ static int do_exit(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
if (argc > 1)
- return simple_strtoul(argv[1], NULL, 10);
+ return dectoul(argv[1], NULL);
return 0;
}
diff --git a/cmd/fastboot.c b/cmd/fastboot.c
index ad5c064911..033a2c95e8 100644
--- a/cmd/fastboot.c
+++ b/cmd/fastboot.c
@@ -112,13 +112,13 @@ static int do_fastboot(struct cmd_tbl *cmdtp, int flag, int argc,
case 'l':
if (--argc <= 0)
return CMD_RET_USAGE;
- buf_addr = simple_strtoul(*++argv, NULL, 16);
+ buf_addr = hextoul(*++argv, NULL);
goto NXTARG;
case 's':
if (--argc <= 0)
return CMD_RET_USAGE;
- buf_size = simple_strtoul(*++argv, NULL, 16);
+ buf_size = hextoul(*++argv, NULL);
goto NXTARG;
default:
diff --git a/cmd/fdt.c b/cmd/fdt.c
index f1e2fc2fd8..c42f1c79d4 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -115,26 +115,20 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
return CMD_RET_USAGE;
- /*
- * Set the address of the fdt
- */
+ /* fdt addr: Set the address of the fdt */
if (strncmp(argv[1], "ad", 2) == 0) {
unsigned long addr;
int control = 0;
struct fdt_header *blob;
- /*
- * Set the address [and length] of the fdt.
- */
+
+ /* Set the address [and length] of the fdt */
argc -= 2;
argv += 2;
-/* Temporary #ifdef - some archs don't have fdt_blob yet */
-#ifdef CONFIG_OF_CONTROL
if (argc && !strcmp(*argv, "-c")) {
control = 1;
argc--;
argv++;
}
-#endif
if (argc == 0) {
if (control)
blob = (struct fdt_header *)gd->fdt_blob;
@@ -142,13 +136,14 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
blob = working_fdt;
if (!blob || !fdt_valid(&blob))
return 1;
- printf("The address of the fdt is %#08lx\n",
+ printf("%s fdt: %08lx\n",
+ control ? "Control" : "Working",
control ? (ulong)map_to_sysmem(blob) :
- env_get_hex("fdtaddr", 0));
+ env_get_hex("fdtaddr", 0));
return 0;
}
- addr = simple_strtoul(argv[0], NULL, 16);
+ addr = hextoul(argv[0], NULL);
blob = map_sysmem(addr, 0);
if (!fdt_valid(&blob))
return 1;
@@ -160,22 +155,18 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc >= 2) {
int len;
int err;
- /*
- * Optional new length
- */
- len = simple_strtoul(argv[1], NULL, 16);
+
+ /* Optional new length */
+ len = hextoul(argv[1], NULL);
if (len < fdt_totalsize(blob)) {
- printf ("New length %d < existing length %d, "
- "ignoring.\n",
- len, fdt_totalsize(blob));
+ printf("New length %d < existing length %d, ignoring\n",
+ len, fdt_totalsize(blob));
} else {
- /*
- * Open in place with a new length.
- */
+ /* Open in place with a new length */
err = fdt_open_into(blob, blob, len);
if (err != 0) {
- printf ("libfdt fdt_open_into(): %s\n",
- fdt_strerror(err));
+ printf("libfdt fdt_open_into(): %s\n",
+ fdt_strerror(err));
}
}
}
@@ -184,10 +175,9 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (!working_fdt) {
- puts(
- "No FDT memory address configured. Please configure\n"
- "the FDT address via \"fdt addr <address>\" command.\n"
- "Aborting!\n");
+ puts("No FDT memory address configured. Please configure\n"
+ "the FDT address via \"fdt addr <address>\" command.\n"
+ "Aborting!\n");
return CMD_RET_FAILURE;
}
@@ -205,11 +195,11 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* Set the address and length of the fdt.
*/
- working_fdt = (struct fdt_header *)simple_strtoul(argv[2], NULL, 16);
+ working_fdt = (struct fdt_header *)hextoul(argv[2], NULL);
if (!fdt_valid(&working_fdt))
return 1;
- newaddr = (struct fdt_header *)simple_strtoul(argv[3],NULL,16);
+ newaddr = (struct fdt_header *)hextoul(argv[3], NULL);
/*
* If the user specifies a length, use that. Otherwise use the
@@ -218,7 +208,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc <= 4) {
len = fdt_totalsize(working_fdt);
} else {
- len = simple_strtoul(argv[4], NULL, 16);
+ len = hextoul(argv[4], NULL);
if (len < fdt_totalsize(working_fdt)) {
printf ("New length 0x%X < existing length "
"0x%X, aborting.\n",
@@ -374,21 +364,22 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (subcmd[0] == 'n' || (subcmd[0] == 's' && argc == 5)) {
- int reqIndex = -1;
+ int req_index = -1;
int startDepth = fdt_node_depth(
working_fdt, nodeoffset);
int curDepth = startDepth;
- int curIndex = -1;
+ int cur_index = -1;
int nextNodeOffset = fdt_next_node(
working_fdt, nodeoffset, &curDepth);
if (subcmd[0] == 'n')
- reqIndex = simple_strtoul(argv[5], NULL, 16);
+ req_index = hextoul(argv[5], NULL);
while (curDepth > startDepth) {
if (curDepth == startDepth + 1)
- curIndex++;
- if (subcmd[0] == 'n' && curIndex == reqIndex) {
+ cur_index++;
+ if (subcmd[0] == 'n' &&
+ cur_index == req_index) {
const char *node_name;
node_name = fdt_get_name(working_fdt,
@@ -404,7 +395,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (subcmd[0] == 's') {
/* get the num nodes at this level */
- env_set_ulong(var, curIndex + 1);
+ env_set_ulong(var, cur_index + 1);
} else {
/* node index not found */
printf("libfdt node not found\n");
@@ -558,7 +549,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
* Set boot cpu id
*/
} else if (strncmp(argv[1], "boo", 3) == 0) {
- unsigned long tmp = simple_strtoul(argv[2], NULL, 16);
+ unsigned long tmp = hextoul(argv[2], NULL);
fdt_set_boot_cpuid_phys(working_fdt, tmp);
/*
@@ -610,7 +601,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return err;
}
} else if (argv[2][0] == 'd') {
- unsigned long idx = simple_strtoul(argv[3], NULL, 16);
+ unsigned long idx = hextoul(argv[3], NULL);
int err = fdt_del_mem_rsv(working_fdt, idx);
if (err < 0) {
@@ -646,8 +637,8 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
if (argc == 4) {
- initrd_start = simple_strtoul(argv[2], NULL, 16);
- initrd_end = simple_strtoul(argv[3], NULL, 16);
+ initrd_start = hextoul(argv[2], NULL);
+ initrd_end = hextoul(argv[3], NULL);
}
fdt_chosen(working_fdt);
@@ -664,7 +655,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_FAILURE;
if (argc > 2) {
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
blob = map_sysmem(addr, 0);
} else {
blob = (struct fdt_header *)gd->fdt_blob;
@@ -701,7 +692,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (!working_fdt)
return CMD_RET_FAILURE;
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
blob = map_sysmem(addr, 0);
if (!fdt_valid(&blob))
return CMD_RET_FAILURE;
@@ -716,7 +707,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else if (strncmp(argv[1], "re", 2) == 0) {
uint extrasize;
if (argc > 2)
- extrasize = simple_strtoul(argv[2], NULL, 16);
+ extrasize = hextoul(argv[2], NULL);
else
extrasize = 0;
fdt_shrink_to_minimum(working_fdt, extrasize);
@@ -807,7 +798,7 @@ static int fdt_parse_prop(char * const *newval, int count, char *data, int *len)
}
if (!isxdigit(*newp))
break;
- tmp = simple_strtoul(newp, &newp, 16);
+ tmp = hextoul(newp, &newp);
*data++ = tmp & 0xFF;
*len = *len + 1;
}
@@ -893,7 +884,7 @@ static void print_data(const void *data, int len)
env_max_dump = env_get("fdt_max_dump");
if (env_max_dump)
- max_dump = simple_strtoul(env_max_dump, NULL, 16);
+ max_dump = hextoul(env_max_dump, NULL);
/*
* It is a string, but it may have multiple strings (embedded '\0's).
diff --git a/cmd/flash.c b/cmd/flash.c
index 240871e808..819febc10e 100644
--- a/cmd/flash.c
+++ b/cmd/flash.c
@@ -57,7 +57,7 @@ abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)
return 0;
*p++ = '\0';
- bank = simple_strtoul (str, &ep, 10);
+ bank = dectoul(str, &ep);
if (ep == str || *ep != '\0' ||
bank < 1 || bank > CONFIG_SYS_MAX_FLASH_BANKS ||
(fp = &flash_info[bank - 1])->flash_id == FLASH_UNKNOWN)
@@ -67,12 +67,12 @@ abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)
if ((p = strchr (str, '-')) != NULL)
*p++ = '\0';
- first = simple_strtoul (str, &ep, 10);
+ first = dectoul(str, &ep);
if (ep == str || *ep != '\0' || first >= fp->sector_count)
return -1;
if (p != NULL) {
- last = simple_strtoul (p, &ep, 10);
+ last = dectoul(p, &ep);
if (ep == p || *ep != '\0' ||
last < first || last >= fp->sector_count)
return -1;
@@ -151,7 +151,7 @@ addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last)
char *ep;
char len_used; /* indicates if the "start +length" form used */
- *addr_first = simple_strtoul(arg1, &ep, 16);
+ *addr_first = hextoul(arg1, &ep);
if (ep == arg1 || *ep != '\0')
return -1;
@@ -161,7 +161,7 @@ addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last)
++arg2;
}
- *addr_last = simple_strtoul(arg2, &ep, 16);
+ *addr_last = hextoul(arg2, &ep);
if (ep == arg2 || *ep != '\0')
return -1;
@@ -287,7 +287,7 @@ static int do_flinfo(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
- bank = simple_strtoul(argv[1], NULL, 16);
+ bank = hextoul(argv[1], NULL);
if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) {
printf ("Only FLASH Banks # 1 ... # %d supported\n",
CONFIG_SYS_MAX_FLASH_BANKS);
@@ -366,7 +366,7 @@ static int do_flerase(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
if (strcmp(argv[1], "bank") == 0) {
- bank = simple_strtoul(argv[2], NULL, 16);
+ bank = hextoul(argv[2], NULL);
if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) {
printf ("Only FLASH Banks # 1 ... # %d supported\n",
CONFIG_SYS_MAX_FLASH_BANKS);
@@ -547,7 +547,7 @@ static int do_protect(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
if (strcmp(argv[2], "bank") == 0) {
- bank = simple_strtoul(argv[3], NULL, 16);
+ bank = hextoul(argv[3], NULL);
if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) {
printf ("Only FLASH Banks # 1 ... # %d supported\n",
CONFIG_SYS_MAX_FLASH_BANKS);
diff --git a/cmd/fpga.c b/cmd/fpga.c
index 51410a8e42..3fdd0b35e8 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -57,7 +57,7 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
}
*fpga_data = local_fpga_data;
- local_data_size = simple_strtoul(argv[2], NULL, 16);
+ local_data_size = hextoul(argv[2], NULL);
if (!local_data_size) {
debug("fpga: zero size\n");
return CMD_RET_USAGE;
@@ -95,8 +95,8 @@ int do_fpga_loads(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
*/
argc++;
- fpga_sec_info.encflag = (u8)simple_strtoul(argv[4], NULL, 16);
- fpga_sec_info.authflag = (u8)simple_strtoul(argv[3], NULL, 16);
+ fpga_sec_info.encflag = (u8)hextoul(argv[4], NULL);
+ fpga_sec_info.authflag = (u8)hextoul(argv[3], NULL);
if (fpga_sec_info.authflag >= FPGA_NO_ENC_OR_NO_AUTH &&
fpga_sec_info.encflag >= FPGA_NO_ENC_OR_NO_AUTH) {
@@ -134,7 +134,7 @@ static int do_fpga_loadfs(struct cmd_tbl *cmdtp, int flag, int argc,
return ret;
fpga_fsinfo.fstype = FS_TYPE_ANY;
- fpga_fsinfo.blocksize = (unsigned int)simple_strtoul(argv[3], NULL, 16);
+ fpga_fsinfo.blocksize = (unsigned int)hextoul(argv[3], NULL);
fpga_fsinfo.interface = argv[4];
fpga_fsinfo.dev_part = argv[5];
fpga_fsinfo.filename = argv[6];
@@ -274,7 +274,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc,
} else
#endif
{
- fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
+ fpga_data = (void *)hextoul(datastr, NULL);
debug("* fpga: cmdline image address = 0x%08lx\n",
(ulong)fpga_data);
}
diff --git a/cmd/fpgad.c b/cmd/fpgad.c
index fb2fe63e78..e65441bb76 100644
--- a/cmd/fpgad.c
+++ b/cmd/fpgad.c
@@ -49,19 +49,19 @@ int do_fpga_md(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* FPGA is specified since argc > 2
*/
- fpga = simple_strtoul(argv[1], NULL, 16);
+ fpga = hextoul(argv[1], NULL);
/*
* Address is specified since argc > 2
*/
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
/*
* If another parameter, it is the length to display.
* Length is the number of objects, not number of bytes.
*/
if (argc > 3)
- length = simple_strtoul(argv[3], NULL, 16);
+ length = hextoul(argv[3], NULL);
}
nbytes = length * sizeof(u16);
diff --git a/cmd/gpio.c b/cmd/gpio.c
index 4fdb3135fc..4150024e62 100644
--- a/cmd/gpio.c
+++ b/cmd/gpio.c
@@ -17,7 +17,7 @@
__weak int name_to_gpio(const char *name)
{
- return simple_strtoul(name, NULL, 10);
+ return dectoul(name, NULL);
}
enum gpio_cmd {
@@ -99,7 +99,7 @@ static int do_gpio_status(bool all, const char *gpio_name)
p = gpio_name + banklen;
if (gpio_name && *p) {
- offset = simple_strtoul(p, NULL, 10);
+ offset = dectoul(p, NULL);
gpio_get_description(dev, bank_name, offset,
&flags, true);
} else {
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 17f2b839d7..f818fbb71f 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -985,7 +985,7 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
#endif
return CMD_RET_USAGE;
- dev = (int)simple_strtoul(argv[3], &ep, 10);
+ dev = (int)dectoul(argv[3], &ep);
if (!ep || ep[0] != '\0') {
printf("'%s' is not a number\n", argv[3]);
return CMD_RET_USAGE;
diff --git a/cmd/host.c b/cmd/host.c
index 6aa3d9167a..2e998abbcd 100644
--- a/cmd/host.c
+++ b/cmd/host.c
@@ -62,7 +62,7 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc > 2)
return CMD_RET_USAGE;
dev_str = argv[0];
- dev = simple_strtoul(dev_str, &ep, 16);
+ dev = hextoul(dev_str, &ep);
if (*ep) {
printf("** Bad device specification %s **\n", dev_str);
return CMD_RET_USAGE;
@@ -82,7 +82,7 @@ static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc >= 2) {
char *ep;
char *dev_str = argv[1];
- int dev = simple_strtoul(dev_str, &ep, 16);
+ int dev = hextoul(dev_str, &ep);
if (*ep) {
printf("** Bad device specification %s **\n", dev_str);
return CMD_RET_USAGE;
@@ -139,7 +139,7 @@ static int do_host_dev(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
- dev = simple_strtoul(argv[1], &ep, 16);
+ dev = hextoul(argv[1], &ep);
if (*ep) {
printf("** Bad device specification %s **\n", argv[2]);
return CMD_RET_USAGE;
diff --git a/cmd/i2c.c b/cmd/i2c.c
index 0e1895ad65..c7c08c4e32 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -308,13 +308,13 @@ static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* I2C chip address
*/
- chip = simple_strtoul(argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
/*
* I2C data address within the chip. This can be 1 or
* 2 bytes long. Some day it might be 3 bytes long :-).
*/
- devaddr = simple_strtoul(argv[2], NULL, 16);
+ devaddr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@@ -322,12 +322,12 @@ static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Length is the number of objects, not number of bytes.
*/
- length = simple_strtoul(argv[3], NULL, 16);
+ length = hextoul(argv[3], NULL);
/*
* memaddr is the address where to store things in memory
*/
- memaddr = (u_char *)simple_strtoul(argv[4], NULL, 16);
+ memaddr = (u_char *)hextoul(argv[4], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
@@ -363,18 +363,18 @@ static int do_i2c_write(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* memaddr is the address where to store things in memory
*/
- memaddr = (u_char *)simple_strtoul(argv[1], NULL, 16);
+ memaddr = (u_char *)hextoul(argv[1], NULL);
/*
* I2C chip address
*/
- chip = simple_strtoul(argv[2], NULL, 16);
+ chip = hextoul(argv[2], NULL);
/*
* I2C data address within the chip. This can be 1 or
* 2 bytes long. Some day it might be 3 bytes long :-).
*/
- devaddr = simple_strtoul(argv[3], NULL, 16);
+ devaddr = hextoul(argv[3], NULL);
alen = get_alen(argv[3], DEFAULT_ADDR_LEN);
if (alen > 3)
return cmd_usage(cmdtp);
@@ -382,7 +382,7 @@ static int do_i2c_write(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Length is the number of bytes.
*/
- length = simple_strtoul(argv[4], NULL, 16);
+ length = hextoul(argv[4], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
@@ -447,13 +447,13 @@ static int do_i2c_flags(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
- chip = simple_strtoul(argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
ret = i2c_get_cur_bus_chip(chip, &dev);
if (ret)
return i2c_report_err(ret, I2C_ERR_READ);
if (argc > 2) {
- flags = simple_strtoul(argv[2], NULL, 16);
+ flags = hextoul(argv[2], NULL);
ret = i2c_set_chip_flags(dev, flags);
} else {
ret = i2c_get_chip_flags(dev, &flags);
@@ -477,13 +477,13 @@ static int do_i2c_olen(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
- chip = simple_strtoul(argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
ret = i2c_get_cur_bus_chip(chip, &dev);
if (ret)
return i2c_report_err(ret, I2C_ERR_READ);
if (argc > 2) {
- olen = simple_strtoul(argv[2], NULL, 16);
+ olen = hextoul(argv[2], NULL);
ret = i2c_set_chip_offset_len(dev, olen);
} else {
ret = i2c_get_chip_offset_len(dev);
@@ -543,13 +543,13 @@ static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* I2C chip address
*/
- chip = simple_strtoul(argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
/*
* I2C data address within the chip. This can be 1 or
* 2 bytes long. Some day it might be 3 bytes long :-).
*/
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@@ -559,7 +559,7 @@ static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,
* Length is the number of objects, not number of bytes.
*/
if (argc > 3)
- length = simple_strtoul(argv[3], NULL, 16);
+ length = hextoul(argv[3], NULL);
}
#if CONFIG_IS_ENABLED(DM_I2C)
@@ -651,12 +651,12 @@ static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Chip is always specified.
*/
- chip = simple_strtoul(argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
/*
* Address is always specified.
*/
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@@ -671,13 +671,13 @@ static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Value to write is always specified.
*/
- byte = simple_strtoul(argv[3], NULL, 16);
+ byte = hextoul(argv[3], NULL);
/*
* Optional count
*/
if (argc == 5)
- count = simple_strtoul(argv[4], NULL, 16);
+ count = hextoul(argv[4], NULL);
else
count = 1;
@@ -740,12 +740,12 @@ static int do_i2c_crc(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Chip is always specified.
*/
- chip = simple_strtoul(argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
/*
* Address is always specified.
*/
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@@ -760,7 +760,7 @@ static int do_i2c_crc(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Count is always specified
*/
- count = simple_strtoul(argv[3], NULL, 16);
+ count = hextoul(argv[3], NULL);
printf ("CRC32 for %08lx ... %08lx ==> ", addr, addr + count - 1);
/*
@@ -840,12 +840,12 @@ static int mod_i2c_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
/*
* Chip is always specified.
*/
- chip = simple_strtoul(argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
/*
* Address is always specified.
*/
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@@ -900,7 +900,7 @@ static int mod_i2c_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
else {
char *endp;
- data = simple_strtoul(console_buffer, &endp, 16);
+ data = hextoul(console_buffer, &endp);
if (size == 1)
data = data << 24;
else if (size == 2)
@@ -1049,12 +1049,12 @@ static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Chip is always specified.
*/
- chip = simple_strtoul(argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
/*
* Address is always specified.
*/
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@@ -1070,7 +1070,7 @@ static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,
* Length is the number of objects, not number of bytes.
*/
length = 1;
- length = simple_strtoul(argv[3], NULL, 16);
+ length = hextoul(argv[3], NULL);
if (length > sizeof(bytes))
length = sizeof(bytes);
@@ -1079,7 +1079,7 @@ static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,
*/
delay = 1000;
if (argc > 3)
- delay = simple_strtoul(argv[4], NULL, 10);
+ delay = dectoul(argv[4], NULL);
/*
* Run the loop...
*/
@@ -1219,7 +1219,7 @@ static int do_sdram(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Chip is always specified.
*/
- chip = simple_strtoul (argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
@@ -1673,7 +1673,7 @@ int do_edid(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
}
- chip = simple_strtoul(argv[1], NULL, 16);
+ chip = hextoul(argv[1], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
if (!ret)
@@ -1765,7 +1765,7 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
int i;
/* show specific bus */
- i = simple_strtoul(argv[1], NULL, 10);
+ i = dectoul(argv[1], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
struct udevice *bus;
int ret;
@@ -1833,7 +1833,7 @@ static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
#endif
printf("Current bus is %d\n", bus_no);
} else {
- bus_no = simple_strtoul(argv[1], NULL, 10);
+ bus_no = dectoul(argv[1], NULL);
#if defined(CONFIG_SYS_I2C_LEGACY)
if (bus_no >= CONFIG_SYS_NUM_I2C_BUSES) {
printf("Invalid bus %d\n", bus_no);
@@ -1884,7 +1884,7 @@ static int do_i2c_bus_speed(struct cmd_tbl *cmdtp, int flag, int argc,
/* querying current speed */
printf("Current bus speed=%d\n", speed);
} else {
- speed = simple_strtoul(argv[1], NULL, 10);
+ speed = dectoul(argv[1], NULL);
printf("Setting bus speed to %d Hz\n", speed);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = dm_i2c_set_bus_speed(bus, speed);
diff --git a/cmd/ini.c b/cmd/ini.c
index c075be623c..81dfc4c4e8 100644
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -236,10 +236,10 @@ static int do_ini(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
section = argv[1];
- file_address = (char *)simple_strtoul(
- argc < 3 ? env_get("loadaddr") : argv[2], NULL, 16);
- file_size = (size_t)simple_strtoul(
- argc < 4 ? env_get("filesize") : argv[3], NULL, 16);
+ file_address = (char *)hextoul(argc < 3 ? env_get("loadaddr") : argv[2],
+ NULL);
+ file_size = (size_t)hextoul(argc < 4 ? env_get("filesize") : argv[3],
+ NULL);
return ini_parse(file_address, file_size, ini_handler, (void *)section);
}
diff --git a/cmd/io.c b/cmd/io.c
index c7e964153b..e23ea62700 100644
--- a/cmd/io.c
+++ b/cmd/io.c
@@ -51,7 +51,7 @@ int do_io_iod(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
/* Address is specified since argc > 1 */
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
/*
@@ -59,7 +59,7 @@ int do_io_iod(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
* Length is the number of objects, not number of bytes.
*/
if (argc > 2)
- length = simple_strtoul(argv[2], NULL, 16);
+ length = hextoul(argv[2], NULL);
}
bytes = size * length;
@@ -102,8 +102,8 @@ int do_io_iow(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (size < 0)
return 1;
- addr = simple_strtoul(argv[1], NULL, 16);
- val = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[1], NULL);
+ val = hextoul(argv[2], NULL);
if (size == 4)
outl((u32) val, addr);
diff --git a/cmd/iotrace.c b/cmd/iotrace.c
index 652ebefb89..f28359e287 100644
--- a/cmd/iotrace.c
+++ b/cmd/iotrace.c
@@ -60,8 +60,8 @@ static int do_set_buffer(int argc, char *const argv[])
ulong addr = 0, size = 0;
if (argc == 2) {
- addr = simple_strtoul(*argv++, NULL, 16);
- size = simple_strtoul(*argv++, NULL, 16);
+ addr = hextoul(*argv++, NULL);
+ size = hextoul(*argv++, NULL);
} else if (argc != 0) {
return CMD_RET_USAGE;
}
@@ -76,8 +76,8 @@ static int do_set_region(int argc, char *const argv[])
ulong addr = 0, size = 0;
if (argc == 2) {
- addr = simple_strtoul(*argv++, NULL, 16);
- size = simple_strtoul(*argv++, NULL, 16);
+ addr = hextoul(*argv++, NULL);
+ size = hextoul(*argv++, NULL);
} else if (argc != 0) {
return CMD_RET_USAGE;
}
diff --git a/cmd/itest.c b/cmd/itest.c
index 9a441ce9b8..74414cbdc4 100644
--- a/cmd/itest.c
+++ b/cmd/itest.c
@@ -57,7 +57,7 @@ static long evalexp(char *s, int w)
/* if the parameter starts with a * then assume is a pointer to the value we want */
if (s[0] == '*') {
- addr = simple_strtoul(&s[1], NULL, 16);
+ addr = hextoul(&s[1], NULL);
buf = map_physmem(addr, w, MAP_WRBACK);
if (!buf && addr) {
puts("Failed to map physical memory\n");
@@ -82,7 +82,7 @@ static long evalexp(char *s, int w)
unmap_physmem(buf, w);
return l;
} else {
- l = simple_strtoul(s, NULL, 16);
+ l = hextoul(s, NULL);
}
/* avoid overflow on mask calculus */
@@ -93,7 +93,7 @@ static char * evalstr(char *s)
{
/* if the parameter starts with a * then assume a string pointer else its a literal */
if (s[0] == '*') {
- return (char *)simple_strtoul(&s[1], NULL, 16);
+ return (char *)hextoul(&s[1], NULL);
} else if (s[0] == '$') {
int i = 2;
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index 9540988e33..63bd55263a 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -491,7 +491,7 @@ int do_jffs2_fsload(struct cmd_tbl *cmdtp, int flag, int argc,
filename = argv[1];
}
if (argc == 3) {
- offset = simple_strtoul(argv[1], NULL, 16);
+ offset = hextoul(argv[1], NULL);
image_load_addr = offset;
filename = argv[2];
}
diff --git a/cmd/led.c b/cmd/led.c
index aa7751933e..48a02baf50 100644
--- a/cmd/led.c
+++ b/cmd/led.c
@@ -93,7 +93,7 @@ int do_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (cmd == LEDST_BLINK) {
if (argc < 4)
return CMD_RET_USAGE;
- freq_ms = simple_strtoul(argv[3], NULL, 10);
+ freq_ms = dectoul(argv[3], NULL);
}
#endif
ret = led_get_by_label(led_label, &dev);
diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c
index 86cd969e40..5256255f05 100644
--- a/cmd/legacy_led.c
+++ b/cmd/legacy_led.c
@@ -129,7 +129,7 @@ int do_legacy_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc != 4)
return CMD_RET_USAGE;
- freq = simple_strtoul(argv[3], NULL, 10);
+ freq = dectoul(argv[3], NULL);
__led_blink(led_commands[i].mask, freq);
}
/* Need to set only 1 led if led_name wasn't 'all' */
diff --git a/cmd/load.c b/cmd/load.c
index b7894d7db0..381ed1b3e2 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -70,7 +70,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc,
offset = simple_strtol(argv[1], NULL, 16);
}
if (argc == 3) {
- load_baudrate = (int)simple_strtoul(argv[2], NULL, 10);
+ load_baudrate = (int)dectoul(argv[2], NULL);
/* default to current baudrate */
if (load_baudrate == 0)
@@ -257,14 +257,14 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
#endif
if (argc >= 2) {
- offset = simple_strtoul(argv[1], NULL, 16);
+ offset = hextoul(argv[1], NULL);
}
#ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
if (argc >= 3) {
- size = simple_strtoul(argv[2], NULL, 16);
+ size = hextoul(argv[2], NULL);
}
if (argc == 4) {
- save_baudrate = (int)simple_strtoul(argv[3], NULL, 10);
+ save_baudrate = (int)dectoul(argv[3], NULL);
/* default to current baudrate */
if (save_baudrate == 0)
@@ -284,7 +284,7 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
}
#else /* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
if (argc == 3) {
- size = simple_strtoul(argv[2], NULL, 16);
+ size = hextoul(argv[2], NULL);
}
#endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */
@@ -438,15 +438,15 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
/* pre-set offset from $loadaddr */
s = env_get("loadaddr");
if (s)
- offset = simple_strtoul(s, NULL, 16);
+ offset = hextoul(s, NULL);
load_baudrate = current_baudrate = gd->baudrate;
if (argc >= 2) {
- offset = simple_strtoul(argv[1], NULL, 16);
+ offset = hextoul(argv[1], NULL);
}
if (argc == 3) {
- load_baudrate = (int)simple_strtoul(argv[2], NULL, 10);
+ load_baudrate = (int)dectoul(argv[2], NULL);
/* default to current baudrate */
if (load_baudrate == 0)
diff --git a/cmd/log.c b/cmd/log.c
index 72380c5691..c377aee85c 100644
--- a/cmd/log.c
+++ b/cmd/log.c
@@ -352,7 +352,7 @@ static int do_log_rec(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 7)
return CMD_RET_USAGE;
cat = log_get_cat_by_name(argv[1]);
- level = simple_strtoul(argv[2], &end, 10);
+ level = dectoul(argv[2], &end);
if (end == argv[2]) {
level = log_get_level_by_name(argv[2]);
@@ -366,7 +366,7 @@ static int do_log_rec(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
file = argv[3];
- line = simple_strtoul(argv[4], NULL, 10);
+ line = dectoul(argv[4], NULL);
func = argv[5];
msg = argv[6];
if (_log(cat, level, file, line, func, "%s\n", msg))
diff --git a/cmd/lzmadec.c b/cmd/lzmadec.c
index 3b8db0a853..81924da461 100644
--- a/cmd/lzmadec.c
+++ b/cmd/lzmadec.c
@@ -26,11 +26,11 @@ static int do_lzmadec(struct cmd_tbl *cmdtp, int flag, int argc,
switch (argc) {
case 4:
- dst_len = simple_strtoul(argv[3], NULL, 16);
+ dst_len = hextoul(argv[3], NULL);
/* fall through */
case 3:
- src = simple_strtoul(argv[1], NULL, 16);
- dst = simple_strtoul(argv[2], NULL, 16);
+ src = hextoul(argv[1], NULL);
+ dst = hextoul(argv[2], NULL);
break;
default:
return CMD_RET_USAGE;
diff --git a/cmd/mbr.c b/cmd/mbr.c
index da2e3a4722..e7e2298096 100644
--- a/cmd/mbr.c
+++ b/cmd/mbr.c
@@ -269,7 +269,7 @@ static int do_mbr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc != 4 && argc != 5)
return CMD_RET_USAGE;
- dev = (int)simple_strtoul(argv[3], &ep, 10);
+ dev = (int)dectoul(argv[3], &ep);
if (!ep || ep[0] != '\0') {
printf("'%s' is not a number\n", argv[3]);
return CMD_RET_USAGE;
diff --git a/cmd/md5sum.c b/cmd/md5sum.c
index 5ae3ddf85f..0f0e1d3dd6 100644
--- a/cmd/md5sum.c
+++ b/cmd/md5sum.c
@@ -25,7 +25,7 @@ static void store_result(const u8 *sum, const char *dest)
if (*dest == '*') {
u8 *ptr;
- ptr = (u8 *)simple_strtoul(dest + 1, NULL, 16);
+ ptr = (u8 *)hextoul(dest + 1, NULL);
for (i = 0; i < 16; i++)
*ptr++ = sum[i];
} else {
@@ -46,7 +46,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum)
if (*verify_str == '*') {
u8 *ptr;
- ptr = (u8 *)simple_strtoul(verify_str + 1, NULL, 16);
+ ptr = (u8 *)hextoul(verify_str + 1, NULL);
memcpy(vsum, ptr, 16);
} else {
unsigned int i;
@@ -66,7 +66,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum)
*nullp = '\0';
*(u8 *)(vsum + i) =
- simple_strtoul(vsum_str + (i * 2), NULL, 16);
+ hextoul(vsum_str + (i * 2), NULL);
*nullp = end;
}
}
@@ -97,8 +97,8 @@ int do_md5sum(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
}
- addr = simple_strtoul(*av++, NULL, 16);
- len = simple_strtoul(*av++, NULL, 16);
+ addr = hextoul(*av++, NULL);
+ len = hextoul(*av++, NULL);
buf = map_sysmem(addr, len);
md5_wd(buf, len, output, CHUNKSZ_MD5);
@@ -147,8 +147,8 @@ static int do_md5sum(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], NULL, 16);
- len = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[1], NULL);
+ len = hextoul(argv[2], NULL);
buf = map_sysmem(addr, len);
md5_wd(buf, len, output, CHUNKSZ_MD5);
diff --git a/cmd/mdio.c b/cmd/mdio.c
index cfa45ad12a..3c74326161 100644
--- a/cmd/mdio.c
+++ b/cmd/mdio.c
@@ -254,7 +254,7 @@ static int do_mdio(struct cmd_tbl *cmdtp, int flag, int argc,
switch (op[0]) {
case 'w':
if (pos > 1)
- data = simple_strtoul(argv[pos--], NULL, 16);
+ data = hextoul(argv[pos--], NULL);
/* Intentional fall-through - Get reg for read and write */
case 'r':
if (pos > 1)
diff --git a/cmd/mem.c b/cmd/mem.c
index 1eb83b7570..b7511382d3 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -89,14 +89,14 @@ static int do_mem_md(struct cmd_tbl *cmdtp, int flag, int argc,
/* Address is specified since argc > 1
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
/* If another parameter, it is the length to display.
* Length is the number of objects, not number of bytes.
*/
if (argc > 2)
- length = simple_strtoul(argv[2], NULL, 16);
+ length = hextoul(argv[2], NULL);
}
bytes = size * length;
@@ -144,7 +144,7 @@ static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc,
/* Address is specified since argc > 1
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
/* Get the value to write.
@@ -152,11 +152,11 @@ static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc,
if (SUPPORT_64BIT_DATA)
writeval = simple_strtoull(argv[2], NULL, 16);
else
- writeval = simple_strtoul(argv[2], NULL, 16);
+ writeval = hextoul(argv[2], NULL);
/* Count ? */
if (argc == 4) {
- count = simple_strtoul(argv[3], NULL, 16);
+ count = hextoul(argv[3], NULL);
} else {
count = 1;
}
@@ -189,7 +189,7 @@ static int do_mem_mdc(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 4)
return CMD_RET_USAGE;
- count = simple_strtoul(argv[3], NULL, 10);
+ count = dectoul(argv[3], NULL);
for (;;) {
do_mem_md (NULL, 0, 3, argv);
@@ -217,7 +217,7 @@ static int do_mem_mwc(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 4)
return CMD_RET_USAGE;
- count = simple_strtoul(argv[3], NULL, 10);
+ count = dectoul(argv[3], NULL);
for (;;) {
do_mem_mw (NULL, 0, 3, argv);
@@ -258,13 +258,13 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc,
size == 4 ? "word" :
size == 2 ? "halfword" : "byte";
- addr1 = simple_strtoul(argv[1], NULL, 16);
+ addr1 = hextoul(argv[1], NULL);
addr1 += base_address;
- addr2 = simple_strtoul(argv[2], NULL, 16);
+ addr2 = hextoul(argv[2], NULL);
addr2 += base_address;
- count = simple_strtoul(argv[3], NULL, 16);
+ count = hextoul(argv[3], NULL);
bytes = size * count;
base = buf1 = map_sysmem(addr1, bytes);
@@ -321,13 +321,13 @@ static int do_mem_cp(struct cmd_tbl *cmdtp, int flag, int argc,
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
return 1;
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
- dest = simple_strtoul(argv[2], NULL, 16);
+ dest = hextoul(argv[2], NULL);
dest += base_address;
- count = simple_strtoul(argv[3], NULL, 16);
+ count = hextoul(argv[3], NULL);
if (count == 0) {
puts ("Zero length ???\n");
@@ -405,7 +405,7 @@ static int do_mem_search(struct cmd_tbl *cmdtp, int flag, int argc,
if (ch == 'q')
quiet = true;
else if (ch == 'l' && isxdigit(argv[0][2]))
- limit = simple_strtoul(argv[0] + 2, NULL, 16);
+ limit = hextoul(argv[0] + 2, NULL);
else
return CMD_RET_USAGE;
argc--;
@@ -413,11 +413,11 @@ static int do_mem_search(struct cmd_tbl *cmdtp, int flag, int argc,
}
/* Address is specified since argc > 1 */
- addr = simple_strtoul(argv[0], NULL, 16);
+ addr = hextoul(argv[0], NULL);
addr += base_address;
/* Length is the number of objects, not number of bytes */
- length = simple_strtoul(argv[1], NULL, 16);
+ length = hextoul(argv[1], NULL);
/* Read the bytes to search for */
end = search_buf + sizeof(search_buf);
@@ -434,7 +434,7 @@ static int do_mem_search(struct cmd_tbl *cmdtp, int flag, int argc,
ptr += len;
continue;
} else {
- u32 val = simple_strtoul(argv[i], NULL, 16);
+ u32 val = hextoul(argv[i], NULL);
switch (size) {
case 1:
@@ -512,7 +512,7 @@ static int do_mem_base(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc > 1) {
/* Set new base address.
*/
- base_address = simple_strtoul(argv[1], NULL, 16);
+ base_address = hextoul(argv[1], NULL);
}
/* Print the current base address.
*/
@@ -543,11 +543,11 @@ static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc,
/* Address is always specified.
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
/* Length is the number of objects, not number of bytes.
*/
- length = simple_strtoul(argv[2], NULL, 16);
+ length = hextoul(argv[2], NULL);
bytes = size * length;
buf = map_sysmem(addr, bytes);
@@ -636,17 +636,17 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc,
/* Address is always specified.
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
/* Length is the number of objects, not number of bytes.
*/
- length = simple_strtoul(argv[2], NULL, 16);
+ length = hextoul(argv[2], NULL);
/* data to write */
if (SUPPORT_64BIT_DATA)
data = simple_strtoull(argv[3], NULL, 16);
else
- data = simple_strtoul(argv[3], NULL, 16);
+ data = hextoul(argv[3], NULL);
bytes = size * length;
buf = map_sysmem(addr, bytes);
@@ -1175,7 +1175,7 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
/* Address is specified since argc > 1
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
}
@@ -1215,7 +1215,7 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
if (SUPPORT_64BIT_DATA)
i = simple_strtoull(console_buffer, &endp, 16);
else
- i = simple_strtoul(console_buffer, &endp, 16);
+ i = hextoul(console_buffer, &endp);
nbytes = endp - console_buffer;
if (nbytes) {
/* good enough to not time out
@@ -1282,11 +1282,11 @@ static int do_random(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3 || argc > 4)
return CMD_RET_USAGE;
- len = simple_strtoul(argv[2], NULL, 16);
- addr = simple_strtoul(argv[1], NULL, 16);
+ len = hextoul(argv[2], NULL);
+ addr = hextoul(argv[1], NULL);
if (argc == 4) {
- seed = simple_strtoul(argv[3], NULL, 16);
+ seed = hextoul(argv[3], NULL);
if (seed == 0) {
printf("The seed cannot be 0. Using 0xDEADBEEF.\n");
seed = 0xDEADBEEF;
diff --git a/cmd/mfsl.c b/cmd/mfsl.c
index 31f5b36ade..0c78720ec4 100644
--- a/cmd/mfsl.c
+++ b/cmd/mfsl.c
@@ -23,8 +23,8 @@ int do_frd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
return CMD_RET_USAGE;
- fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
- blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16);
+ fslnum = (unsigned int)hextoul(argv[1], NULL);
+ blocking = (unsigned int)hextoul(argv[2], NULL);
if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
puts ("Bad number of FSL\n");
return CMD_RET_USAGE;
@@ -178,9 +178,9 @@ int do_fwr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 3)
return CMD_RET_USAGE;
- fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
- num = (unsigned int)simple_strtoul (argv[2], NULL, 16);
- blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16);
+ fslnum = (unsigned int)hextoul(argv[1], NULL);
+ num = (unsigned int)hextoul(argv[2], NULL);
+ blocking = (unsigned int)hextoul(argv[3], NULL);
if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER)
return CMD_RET_USAGE;
@@ -332,8 +332,8 @@ int do_rspr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
return CMD_RET_USAGE;
- reg = (unsigned int)simple_strtoul (argv[1], NULL, 16);
- val = (unsigned int)simple_strtoul (argv[2], NULL, 16);
+ reg = (unsigned int)hextoul(argv[1], NULL);
+ val = (unsigned int)hextoul(argv[2], NULL);
switch (reg) {
case 0x1:
if (argc > 2) {
diff --git a/cmd/mii.c b/cmd/mii.c
index fe8602eb7c..fab420ee29 100644
--- a/cmd/mii.c
+++ b/cmd/mii.c
@@ -267,10 +267,10 @@ static void extract_range(
unsigned char * phi)
{
char * end;
- *plo = simple_strtoul(input, &end, 16);
+ *plo = hextoul(input, &end);
if (*end == '-') {
end++;
- *phi = simple_strtoul(end, NULL, 16);
+ *phi = hextoul(end, NULL);
}
else {
*phi = *plo;
@@ -319,9 +319,9 @@ static int do_mii(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc >= 4)
extract_range(argv[3], &reglo, &reghi);
if (argc >= 5)
- data = simple_strtoul(argv[4], NULL, 16);
+ data = hextoul(argv[4], NULL);
if (argc >= 6)
- mask = simple_strtoul(argv[5], NULL, 16);
+ mask = hextoul(argv[5], NULL);
}
if (addrhi > 31 && strncmp(op, "de", 2)) {
diff --git a/cmd/misc.c b/cmd/misc.c
index ef540e836f..bcd8d960ee 100644
--- a/cmd/misc.c
+++ b/cmd/misc.c
@@ -57,9 +57,9 @@ static int do_misc_op(struct cmd_tbl *cmdtp, int flag,
return ret;
}
- offset = simple_strtoul(argv[1], NULL, 16);
- buf = (void *)simple_strtoul(argv[2], NULL, 16);
- size = simple_strtoul(argv[3], NULL, 16);
+ offset = hextoul(argv[1], NULL);
+ buf = (void *)hextoul(argv[2], NULL);
+ size = hextoul(argv[3], NULL);
if (op == MISC_OP_READ)
misc_op = misc_read;
diff --git a/cmd/mmc.c b/cmd/mmc.c
index b942576b58..c67ad76242 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -189,7 +189,7 @@ static int do_mmcrpmb_key(struct cmd_tbl *cmdtp, int flag,
if (argc != 2)
return CMD_RET_USAGE;
- key_addr = (void *)simple_strtoul(argv[1], NULL, 16);
+ key_addr = (void *)hextoul(argv[1], NULL);
if (!confirm_key_prog())
return CMD_RET_FAILURE;
if (mmc_rpmb_set_key(mmc, key_addr)) {
@@ -211,12 +211,12 @@ static int do_mmcrpmb_read(struct cmd_tbl *cmdtp, int flag,
if (argc < 4)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
- cnt = simple_strtoul(argv[3], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
+ cnt = hextoul(argv[3], NULL);
if (argc == 5)
- key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
+ key_addr = (void *)hextoul(argv[4], NULL);
printf("\nMMC RPMB read: dev # %d, block # %d, count %d ... ",
curr_device, blk, cnt);
@@ -240,10 +240,10 @@ static int do_mmcrpmb_write(struct cmd_tbl *cmdtp, int flag,
if (argc != 5)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
- cnt = simple_strtoul(argv[3], NULL, 16);
- key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
+ cnt = hextoul(argv[3], NULL);
+ key_addr = (void *)hextoul(argv[4], NULL);
printf("\nMMC RPMB write: dev # %d, block # %d, count %d ... ",
curr_device, blk, cnt);
@@ -334,9 +334,9 @@ static int do_mmc_read(struct cmd_tbl *cmdtp, int flag,
if (argc != 4)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
- cnt = simple_strtoul(argv[3], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
+ cnt = hextoul(argv[3], NULL);
mmc = init_mmc_device(curr_device, false);
if (!mmc)
@@ -379,8 +379,8 @@ static int do_mmc_sparse_write(struct cmd_tbl *cmdtp, int flag,
if (argc != 3)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
if (!is_sparse_image(addr)) {
printf("Not a sparse image\n");
@@ -427,9 +427,9 @@ static int do_mmc_write(struct cmd_tbl *cmdtp, int flag,
if (argc != 4)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
- cnt = simple_strtoul(argv[3], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
+ cnt = hextoul(argv[3], NULL);
mmc = init_mmc_device(curr_device, false);
if (!mmc)
@@ -457,8 +457,8 @@ static int do_mmc_erase(struct cmd_tbl *cmdtp, int flag,
if (argc != 3)
return CMD_RET_USAGE;
- blk = simple_strtoul(argv[1], NULL, 16);
- cnt = simple_strtoul(argv[2], NULL, 16);
+ blk = hextoul(argv[1], NULL);
+ cnt = hextoul(argv[2], NULL);
mmc = init_mmc_device(curr_device, false);
if (!mmc)
@@ -519,10 +519,10 @@ static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag,
if (argc == 1) {
dev = curr_device;
} else if (argc == 2) {
- dev = simple_strtoul(argv[1], NULL, 10);
+ dev = dectoul(argv[1], NULL);
} else if (argc == 3) {
- dev = (int)simple_strtoul(argv[1], NULL, 10);
- part = (int)simple_strtoul(argv[2], NULL, 10);
+ dev = (int)dectoul(argv[1], NULL);
+ part = (int)dectoul(argv[2], NULL);
if (part > PART_ACCESS_MASK) {
printf("#part_num shouldn't be larger than %d\n",
PART_ACCESS_MASK);
@@ -572,9 +572,9 @@ static int parse_hwpart_user(struct mmc_hwpart_conf *pconf,
if (i + 2 >= argc)
return -1;
pconf->user.enh_start =
- simple_strtoul(argv[i+1], NULL, 10);
+ dectoul(argv[i + 1], NULL);
pconf->user.enh_size =
- simple_strtoul(argv[i+2], NULL, 10);
+ dectoul(argv[i + 2], NULL);
i += 3;
} else if (!strcmp(argv[i], "wrrel")) {
if (i + 1 >= argc)
@@ -603,7 +603,7 @@ static int parse_hwpart_gp(struct mmc_hwpart_conf *pconf, int pidx,
if (1 >= argc)
return -1;
- pconf->gp_part[pidx].size = simple_strtoul(argv[0], NULL, 10);
+ pconf->gp_part[pidx].size = dectoul(argv[0], NULL);
i = 1;
while (i < argc) {
@@ -721,10 +721,10 @@ static int do_mmc_bootbus(struct cmd_tbl *cmdtp, int flag,
if (argc != 5)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
- width = simple_strtoul(argv[2], NULL, 10);
- reset = simple_strtoul(argv[3], NULL, 10);
- mode = simple_strtoul(argv[4], NULL, 10);
+ dev = dectoul(argv[1], NULL);
+ width = dectoul(argv[2], NULL);
+ reset = dectoul(argv[3], NULL);
+ mode = dectoul(argv[4], NULL);
mmc = init_mmc_device(dev, false);
if (!mmc)
@@ -785,9 +785,9 @@ static int do_mmc_boot_resize(struct cmd_tbl *cmdtp, int flag,
if (argc != 4)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
- bootsize = simple_strtoul(argv[2], NULL, 10);
- rpmbsize = simple_strtoul(argv[3], NULL, 10);
+ dev = dectoul(argv[1], NULL);
+ bootsize = dectoul(argv[2], NULL);
+ rpmbsize = dectoul(argv[3], NULL);
mmc = init_mmc_device(dev, false);
if (!mmc)
@@ -842,7 +842,7 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
if (argc != 2 && argc != 3 && argc != 5)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
+ dev = dectoul(argv[1], NULL);
mmc = init_mmc_device(dev, false);
if (!mmc)
@@ -856,9 +856,9 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
if (argc == 2 || argc == 3)
return mmc_partconf_print(mmc, argc == 3 ? argv[2] : NULL);
- ack = simple_strtoul(argv[2], NULL, 10);
- part_num = simple_strtoul(argv[3], NULL, 10);
- access = simple_strtoul(argv[4], NULL, 10);
+ ack = dectoul(argv[2], NULL);
+ part_num = dectoul(argv[3], NULL);
+ access = dectoul(argv[4], NULL);
/* acknowledge to be sent during boot operation */
return mmc_set_part_conf(mmc, ack, part_num, access);
@@ -879,8 +879,8 @@ static int do_mmc_rst_func(struct cmd_tbl *cmdtp, int flag,
if (argc != 3)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
- enable = simple_strtoul(argv[2], NULL, 10);
+ dev = dectoul(argv[1], NULL);
+ enable = dectoul(argv[2], NULL);
if (enable > 2) {
puts("Invalid RST_n_ENABLE value\n");
@@ -908,7 +908,7 @@ static int do_mmc_setdsr(struct cmd_tbl *cmdtp, int flag,
if (argc != 2)
return CMD_RET_USAGE;
- val = simple_strtoul(argv[1], NULL, 16);
+ val = hextoul(argv[1], NULL);
mmc = find_mmc_device(curr_device);
if (!mmc) {
@@ -937,7 +937,7 @@ static int do_mmc_bkops_enable(struct cmd_tbl *cmdtp, int flag,
if (argc != 2)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
+ dev = dectoul(argv[1], NULL);
mmc = init_mmc_device(dev, false);
if (!mmc)
diff --git a/cmd/mp.c b/cmd/mp.c
index c2b5235a37..8d14401b49 100644
--- a/cmd/mp.c
+++ b/cmd/mp.c
@@ -36,7 +36,7 @@ cpu_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 3)
return CMD_RET_USAGE;
- cpuid = simple_strtoul(argv[1], NULL, 10);
+ cpuid = dectoul(argv[1], NULL);
if (!is_core_valid(cpuid)) {
printf ("Core num: %lu is not valid\n", cpuid);
return 1;
diff --git a/cmd/mtd.c b/cmd/mtd.c
index c22478c152..ad5cc9827d 100644
--- a/cmd/mtd.c
+++ b/cmd/mtd.c
@@ -285,12 +285,12 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
goto out_put_mtd;
}
- user_addr = simple_strtoul(argv[0], NULL, 16);
+ user_addr = hextoul(argv[0], NULL);
argc--;
argv++;
}
- start_off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0;
+ start_off = argc > 0 ? hextoul(argv[0], NULL) : 0;
if (!mtd_is_aligned_with_min_io_size(mtd, start_off)) {
printf("Offset not aligned with a page (0x%x)\n",
mtd->writesize);
@@ -299,7 +299,7 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
}
default_len = dump ? mtd->writesize : mtd->size;
- len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) : default_len;
+ len = argc > 1 ? hextoul(argv[1], NULL) : default_len;
if (!mtd_is_aligned_with_min_io_size(mtd, len)) {
len = round_up(len, mtd->writesize);
printf("Size not on a page boundary (0x%x), rounding to 0x%llx\n",
@@ -411,8 +411,8 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc,
argc -= 2;
argv += 2;
- off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0;
- len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) : mtd->size;
+ off = argc > 0 ? hextoul(argv[0], NULL) : 0;
+ len = argc > 1 ? hextoul(argv[1], NULL) : mtd->size;
if (!mtd_is_aligned_with_block_size(mtd, off)) {
printf("Offset not aligned with a block (0x%x)\n",
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index ed373a8c4d..3048700778 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -2077,9 +2077,9 @@ static int do_mtdparts(struct cmd_tbl *cmdtp, int flag, int argc,
/***************************************************/
U_BOOT_CMD(
chpart, 2, 0, do_chpart,
- "change active partition",
+ "change active partition of a MTD device",
"part-id\n"
- " - change active partition (e.g. part-id = nand0,1)"
+ " - change active partition (e.g. part-id = nand0,1) of a MTD device"
);
#ifdef CONFIG_SYS_LONGHELP
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 5cd520e46b..d4f381b6ad 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -137,7 +137,7 @@ static ulong get_load_addr(void)
addr_str = env_get("loadaddr");
if (addr_str)
- addr = simple_strtoul(addr_str, NULL, 16);
+ addr = hextoul(addr_str, NULL);
else
addr = CONFIG_SYS_LOAD_ADDR;
diff --git a/cmd/mvebu/comphy_rx_training.c b/cmd/mvebu/comphy_rx_training.c
index 0798decfae..25a9e153de 100644
--- a/cmd/mvebu/comphy_rx_training.c
+++ b/cmd/mvebu/comphy_rx_training.c
@@ -25,8 +25,8 @@ int mvebu_comphy_rx_training_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
return -1;
}
- cp_index = simple_strtoul(argv[1], NULL, 16);
- comphy_index = simple_strtoul(argv[2], NULL, 16);
+ cp_index = hextoul(argv[1], NULL);
+ comphy_index = hextoul(argv[2], NULL);
ret = uclass_get(UCLASS_MISC, &uc);
if (ret) {
diff --git a/cmd/nand.c b/cmd/nand.c
index 97e117a979..d381053c6a 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -424,7 +424,7 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
- dev = (int)simple_strtoul(argv[2], NULL, 10);
+ dev = (int)dectoul(argv[2], NULL);
set_dev(dev);
return 0;
@@ -543,7 +543,7 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
goto usage;
- off = (int)simple_strtoul(argv[2], NULL, 16);
+ off = (int)hextoul(argv[2], NULL);
ret = nand_dump(mtd, off, !strcmp(&cmd[4], ".oob"), repeat);
return ret == 0 ? 1 : 0;
@@ -559,7 +559,7 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 4)
goto usage;
- addr = (ulong)simple_strtoul(argv[2], NULL, 16);
+ addr = (ulong)hextoul(argv[2], NULL);
read = strncmp(cmd, "read", 4) == 0; /* 1 = read, 0 = write */
printf("\nNAND %s: ", read ? "read" : "write");
@@ -713,7 +713,7 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc,
goto usage;
while (argc > 0) {
- addr = simple_strtoul(*argv, NULL, 16);
+ addr = hextoul(*argv, NULL);
if (mtd_block_markbad(mtd, addr)) {
printf("block 0x%08lx NOT marked "
@@ -957,7 +957,7 @@ static int do_nandboot(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc > 3)
goto usage;
if (argc == 3)
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
else
addr = CONFIG_SYS_LOAD_ADDR;
@@ -975,17 +975,17 @@ static int do_nandboot(struct cmd_tbl *cmdtp, int flag, int argc,
boot_device = env_get("bootdevice");
break;
case 2:
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
boot_device = env_get("bootdevice");
break;
case 3:
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
boot_device = argv[2];
break;
case 4:
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
boot_device = argv[2];
- offset = simple_strtoul(argv[3], NULL, 16);
+ offset = hextoul(argv[3], NULL);
break;
default:
#if defined(CONFIG_CMD_MTDPARTS)
@@ -1003,7 +1003,7 @@ usage:
}
bootstage_mark(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
- idx = simple_strtoul(boot_device, NULL, 16);
+ idx = hextoul(boot_device, NULL);
mtd = get_nand_dev_by_index(idx);
if (!mtd) {
diff --git a/cmd/net.c b/cmd/net.c
index 76c7e75125..651c1411f4 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -205,7 +205,7 @@ static int netboot_common(enum proto_t proto, struct cmd_tbl *cmdtp, int argc,
/* pre-set image_load_addr */
s = env_get("loadaddr");
if (s != NULL)
- image_load_addr = simple_strtoul(s, NULL, 16);
+ image_load_addr = hextoul(s, NULL);
switch (argc) {
case 1:
@@ -220,7 +220,7 @@ static int netboot_common(enum proto_t proto, struct cmd_tbl *cmdtp, int argc,
* form must be written in a format which can not be
* mis-interpreted as a valid number.
*/
- addr = simple_strtoul(argv[1], &end, 16);
+ addr = hextoul(argv[1], &end);
if (end == (argv[1] + strlen(argv[1]))) {
image_load_addr = addr;
/* refresh bootfile name from env */
@@ -234,7 +234,7 @@ static int netboot_common(enum proto_t proto, struct cmd_tbl *cmdtp, int argc,
break;
case 3:
- image_load_addr = simple_strtoul(argv[1], NULL, 16);
+ image_load_addr = hextoul(argv[1], NULL);
net_boot_file_name_explicit = true;
copy_filename(net_boot_file_name, argv[2],
sizeof(net_boot_file_name));
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index d14ba10cef..ddc715b4f9 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -358,7 +358,7 @@ ulong env_get_hex(const char *varname, ulong default_val)
s = env_get(varname);
if (s)
- value = simple_strtoul(s, &endp, 16);
+ value = hextoul(s, &endp);
if (!s || endp == s)
return default_val;
@@ -423,7 +423,7 @@ int do_env_ask(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
* the size. Otherwise we echo it as part of the
* message.
*/
- i = simple_strtoul(argv[argc - 1], &endptr, 10);
+ i = dectoul(argv[argc - 1], &endptr);
if (*endptr != '\0') { /* no size */
size = CONFIG_SYS_CBSIZE - 1;
} else { /* size given */
@@ -984,7 +984,7 @@ static int do_env_export(struct cmd_tbl *cmdtp, int flag,
case 's': /* size given */
if (--argc <= 0)
return cmd_usage(cmdtp);
- size = simple_strtoul(*++argv, NULL, 16);
+ size = hextoul(*++argv, NULL);
goto NXTARG;
case 't': /* text format */
if (fmt++)
@@ -1001,7 +1001,7 @@ NXTARG: ;
if (argc < 1)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[0], NULL, 16);
+ addr = hextoul(argv[0], NULL);
ptr = map_sysmem(addr, size);
if (size)
@@ -1140,11 +1140,11 @@ static int do_env_import(struct cmd_tbl *cmdtp, int flag,
if (sep != '\n' && crlf_is_lf )
crlf_is_lf = 0;
- addr = simple_strtoul(argv[0], NULL, 16);
+ addr = hextoul(argv[0], NULL);
ptr = map_sysmem(addr, 0);
if (argc >= 2 && strcmp(argv[1], "-")) {
- size = simple_strtoul(argv[1], NULL, 16);
+ size = hextoul(argv[1], NULL);
} else if (chk) {
puts("## Error: external checksum format must pass size\n");
return CMD_RET_FAILURE;
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index d5e93827e4..676bbda950 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -471,12 +471,12 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
argc--;
argv++;
- addr = simple_strtoul(argv[0], &ep, 16);
+ addr = hextoul(argv[0], &ep);
if (*ep != ':')
return CMD_RET_USAGE;
/* 0 should be allowed for delete */
- size = simple_strtoul(++ep, NULL, 16);
+ size = hextoul(++ep, NULL);
value_on_memory = true;
} else if (!strcmp(argv[0], "-v")) {
diff --git a/cmd/onenand.c b/cmd/onenand.c
index 216458bb47..852ed5c7b2 100644
--- a/cmd/onenand.c
+++ b/cmd/onenand.c
@@ -398,7 +398,7 @@ static int do_onenand_read(struct cmd_tbl *cmdtp, int flag, int argc,
if ((s != NULL) && (!strcmp(s, ".oob")))
oob = 1;
- addr = (ulong)simple_strtoul(argv[1], NULL, 16);
+ addr = (ulong)hextoul(argv[1], NULL);
printf("\nOneNAND read: ");
if (arg_off_size_onenand(argc - 2, argv + 2, &ofs, &len) != 0)
@@ -425,7 +425,7 @@ static int do_onenand_write(struct cmd_tbl *cmdtp, int flag, int argc,
if (strncmp(argv[0] + 6, "yaffs", 5) == 0)
withoob = 1;
- addr = (ulong)simple_strtoul(argv[1], NULL, 16);
+ addr = (ulong)hextoul(argv[1], NULL);
printf("\nOneNAND write: ");
if (arg_off_size_onenand(argc - 2, argv + 2, &ofs, &len) != 0)
@@ -512,7 +512,7 @@ static int do_onenand_dump(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
s = strchr(argv[0], '.');
- ofs = (int)simple_strtoul(argv[1], NULL, 16);
+ ofs = (int)hextoul(argv[1], NULL);
if (s != NULL && strcmp(s, ".oob") == 0)
ret = onenand_dump(mtd, ofs, 1);
@@ -535,7 +535,7 @@ static int do_onenand_markbad(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
while (argc > 0) {
- addr = simple_strtoul(*argv, NULL, 16);
+ addr = hextoul(*argv, NULL);
if (mtd_block_markbad(mtd, addr)) {
printf("block 0x%08lx NOT marked "
diff --git a/cmd/optee_rpmb.c b/cmd/optee_rpmb.c
index 0d6b1cb1d8..e0e44bbed0 100644
--- a/cmd/optee_rpmb.c
+++ b/cmd/optee_rpmb.c
@@ -195,7 +195,7 @@ int do_optee_rpmb_read(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
name = argv[1];
- bytes = simple_strtoul(argv[2], &endp, 10);
+ bytes = dectoul(argv[2], &endp);
if (*endp && *endp != '\n')
return CMD_RET_USAGE;
diff --git a/cmd/osd.c b/cmd/osd.c
index 703d640b04..c8c62d4a2a 100644
--- a/cmd/osd.c
+++ b/cmd/osd.c
@@ -99,10 +99,10 @@ static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
hexstr = argv[3];
- count = (argc > 4) ? simple_strtoul(argv[4], NULL, 16) : 1;
+ count = (argc > 4) ? hextoul(argv[4], NULL) : 1;
buflen = strlen(hexstr) / 2;
@@ -148,9 +148,9 @@ static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
- color = simple_strtoul(argv[3], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
+ color = hextoul(argv[3], NULL);
text = argv[4];
res = video_osd_print(osd_cur, x, y, color, text);
@@ -176,8 +176,8 @@ static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
res = video_osd_set_size(osd_cur, x, y);
if (res) {
@@ -211,7 +211,7 @@ static int do_show_osd(struct cmd_tbl *cmdtp, int flag, int argc,
int i, res;
/* show specific OSD */
- i = simple_strtoul(argv[1], NULL, 10);
+ i = dectoul(argv[1], NULL);
res = uclass_get_device_by_seq(UCLASS_VIDEO_OSD, i, &osd);
if (res) {
@@ -240,7 +240,7 @@ static int do_osd_num(struct cmd_tbl *cmdtp, int flag, int argc,
osd_no = -1;
printf("Current osd is %d\n", osd_no);
} else {
- osd_no = simple_strtoul(argv[1], NULL, 10);
+ osd_no = dectoul(argv[1], NULL);
printf("Setting osd to %d\n", osd_no);
res = cmd_osd_set_osd_num(osd_no);
diff --git a/cmd/pcap.c b/cmd/pcap.c
index d0172f3fff..ab5c1a7e87 100644
--- a/cmd/pcap.c
+++ b/cmd/pcap.c
@@ -18,8 +18,8 @@ static int do_pcap_init(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 3)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], NULL, 16);
- size = simple_strtoul(argv[2], NULL, 10);
+ addr = hextoul(argv[1], NULL);
+ size = dectoul(argv[2], NULL);
return pcap_init(addr, size) ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
}
diff --git a/cmd/pci.c b/cmd/pci.c
index e53b7c858c..af75a6cfff 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -47,7 +47,6 @@ static int pci_field_width(enum pci_size_t size)
return pci_byte_size(size) * 2;
}
-#ifdef CONFIG_DM_PCI
static void pci_show_regs(struct udevice *dev, struct pci_reg_info *regs)
{
for (; regs->name; regs++) {
@@ -59,40 +58,7 @@ static void pci_show_regs(struct udevice *dev, struct pci_reg_info *regs)
pci_field_width(regs->size), val);
}
}
-#else
-static unsigned long pci_read_config(pci_dev_t dev, int offset,
- enum pci_size_t size)
-{
- u32 val32;
- u16 val16;
- u8 val8;
- switch (size) {
- case PCI_SIZE_8:
- pci_read_config_byte(dev, offset, &val8);
- return val8;
- case PCI_SIZE_16:
- pci_read_config_word(dev, offset, &val16);
- return val16;
- case PCI_SIZE_32:
- default:
- pci_read_config_dword(dev, offset, &val32);
- return val32;
- }
-}
-
-static void pci_show_regs(pci_dev_t dev, struct pci_reg_info *regs)
-{
- for (; regs->name; regs++) {
- printf(" %s =%*s%#.*lx\n", regs->name,
- (int)(28 - strlen(regs->name)), "",
- pci_field_width(regs->size),
- pci_read_config(dev, regs->offset, regs->size));
- }
-}
-#endif
-
-#ifdef CONFIG_DM_PCI
int pci_bar_show(struct udevice *dev)
{
u8 header_type;
@@ -162,7 +128,6 @@ int pci_bar_show(struct udevice *dev)
return 0;
}
-#endif
static struct pci_reg_info regs_start[] = {
{ "vendor ID", PCI_SIZE_16, PCI_VENDOR_ID },
@@ -258,23 +223,12 @@ static struct pci_reg_info regs_cardbus[] = {
*
* @dev: Bus+Device+Function number
*/
-#ifdef CONFIG_DM_PCI
void pci_header_show(struct udevice *dev)
-#else
-void pci_header_show(pci_dev_t dev)
-#endif
{
-#ifdef CONFIG_DM_PCI
unsigned long class, header_type;
dm_pci_read_config(dev, PCI_CLASS_CODE, &class, PCI_SIZE_8);
dm_pci_read_config(dev, PCI_HEADER_TYPE, &header_type, PCI_SIZE_8);
-#else
- u8 class, header_type;
-
- pci_read_config_byte(dev, PCI_CLASS_CODE, &class);
- pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type);
-#endif
pci_show_regs(dev, regs_start);
printf(" class code = 0x%.2x (%s)\n", (int)class,
pci_class_str(class));
@@ -307,7 +261,6 @@ void pciinfo_header(int busnum, bool short_listing)
}
}
-#ifdef CONFIG_DM_PCI
/**
* pci_header_show_brief() - Show the short-form PCI device header
*
@@ -355,102 +308,6 @@ static void pciinfo(struct udevice *bus, bool short_listing)
}
}
-#else
-
-/**
- * pci_header_show_brief() - Show the short-form PCI device header
- *
- * Reads and prints the header of the specified PCI device in short form.
- *
- * @dev: Bus+Device+Function number
- */
-void pci_header_show_brief(pci_dev_t dev)
-{
- u16 vendor, device;
- u8 class, subclass;
-
- pci_read_config_word(dev, PCI_VENDOR_ID, &vendor);
- pci_read_config_word(dev, PCI_DEVICE_ID, &device);
- pci_read_config_byte(dev, PCI_CLASS_CODE, &class);
- pci_read_config_byte(dev, PCI_CLASS_SUB_CODE, &subclass);
-
- printf("0x%.4x 0x%.4x %-23s 0x%.2x\n",
- vendor, device,
- pci_class_str(class), subclass);
-}
-
-/**
- * pciinfo() - Show a list of devices on the PCI bus
- *
- * Show information about devices on PCI bus. Depending on @short_pci_listing
- * the output will be more or less exhaustive.
- *
- * @bus_num: The number of the bus to be scanned
- * @short_pci_listing: true to use short form, showing only a brief header
- * for each device
- */
-void pciinfo(int bus_num, int short_pci_listing)
-{
- struct pci_controller *hose = pci_bus_to_hose(bus_num);
- int device;
- int function;
- unsigned char header_type;
- unsigned short vendor_id;
- pci_dev_t dev;
- int ret;
-
- if (!hose)
- return;
-
- pciinfo_header(bus_num, short_pci_listing);
-
- for (device = 0; device < PCI_MAX_PCI_DEVICES; device++) {
- header_type = 0;
- vendor_id = 0;
- for (function = 0; function < PCI_MAX_PCI_FUNCTIONS;
- function++) {
- /*
- * If this is not a multi-function device, we skip
- * the rest.
- */
- if (function && !(header_type & 0x80))
- break;
-
- dev = PCI_BDF(bus_num, device, function);
-
- if (pci_skip_dev(hose, dev))
- continue;
-
- ret = pci_read_config_word(dev, PCI_VENDOR_ID,
- &vendor_id);
- if (ret)
- goto error;
- if ((vendor_id == 0xFFFF) || (vendor_id == 0x0000))
- continue;
-
- if (!function) {
- pci_read_config_byte(dev, PCI_HEADER_TYPE,
- &header_type);
- }
-
- if (short_pci_listing) {
- printf("%02x.%02x.%02x ", bus_num, device,
- function);
- pci_header_show_brief(dev);
- } else {
- printf("\nFound PCI device %02x.%02x.%02x:\n",
- bus_num, device, function);
- pci_header_show(dev);
- }
- }
- }
-
- return;
-error:
- printf("Cannot read bus configuration: %d\n", ret);
-}
-#endif
-
/**
* get_pci_dev() - Convert the "bus.device.function" identifier into a number
*
@@ -470,25 +327,20 @@ static pci_dev_t get_pci_dev(char *name)
if (name[i] == '.') {
memcpy(cnum, &name[iold], i - iold);
cnum[i - iold] = '\0';
- bdfs[n++] = simple_strtoul(cnum, NULL, 16);
+ bdfs[n++] = hextoul(cnum, NULL);
iold = i + 1;
}
}
strcpy(cnum, &name[iold]);
if (n == 0)
n = 1;
- bdfs[n] = simple_strtoul(cnum, NULL, 16);
+ bdfs[n] = hextoul(cnum, NULL);
return PCI_BDF(bdfs[0], bdfs[1], bdfs[2]);
}
-#ifdef CONFIG_DM_PCI
static int pci_cfg_display(struct udevice *dev, ulong addr,
enum pci_size_t size, ulong length)
-#else
-static int pci_cfg_display(pci_dev_t bdf, ulong addr, enum pci_size_t size,
- ulong length)
-#endif
{
#define DISP_LINE_LEN 16
ulong i, nbytes, linebytes;
@@ -509,11 +361,7 @@ static int pci_cfg_display(pci_dev_t bdf, ulong addr, enum pci_size_t size,
for (i = 0; i < linebytes; i += byte_size) {
unsigned long val;
-#ifdef CONFIG_DM_PCI
dm_pci_read_config(dev, addr, &val, size);
-#else
- val = pci_read_config(bdf, addr, size);
-#endif
printf(" %0*lx", pci_field_width(size), val);
addr += byte_size;
}
@@ -528,31 +376,8 @@ static int pci_cfg_display(pci_dev_t bdf, ulong addr, enum pci_size_t size,
return (rc);
}
-#ifndef CONFIG_DM_PCI
-static int pci_cfg_write (pci_dev_t bdf, ulong addr, ulong size, ulong value)
-{
- if (size == 4) {
- pci_write_config_dword(bdf, addr, value);
- }
- else if (size == 2) {
- ushort val = value & 0xffff;
- pci_write_config_word(bdf, addr, val);
- }
- else {
- u_char val = value & 0xff;
- pci_write_config_byte(bdf, addr, val);
- }
- return 0;
-}
-#endif
-
-#ifdef CONFIG_DM_PCI
static int pci_cfg_modify(struct udevice *dev, ulong addr, ulong size,
ulong value, int incrflag)
-#else
-static int pci_cfg_modify(pci_dev_t bdf, ulong addr, ulong size, ulong value,
- int incrflag)
-#endif
{
ulong i;
int nbytes;
@@ -563,11 +388,7 @@ static int pci_cfg_modify(pci_dev_t bdf, ulong addr, ulong size, ulong value,
*/
do {
printf("%08lx:", addr);
-#ifdef CONFIG_DM_PCI
dm_pci_read_config(dev, addr, &val, size);
-#else
- val = pci_read_config(bdf, addr, size);
-#endif
printf(" %0*lx", pci_field_width(size), val);
nbytes = cli_readline(" ? ");
@@ -588,17 +409,13 @@ static int pci_cfg_modify(pci_dev_t bdf, ulong addr, ulong size, ulong value,
#endif
else {
char *endp;
- i = simple_strtoul(console_buffer, &endp, 16);
+ i = hextoul(console_buffer, &endp);
nbytes = endp - console_buffer;
if (nbytes) {
/* good enough to not time out
*/
bootretry_reset_cmd_timeout();
-#ifdef CONFIG_DM_PCI
dm_pci_write_config(dev, addr, i, size);
-#else
- pci_cfg_write(bdf, addr, size, i);
-#endif
if (incrflag)
addr += size;
}
@@ -608,7 +425,6 @@ static int pci_cfg_modify(pci_dev_t bdf, ulong addr, ulong size, ulong value,
return 0;
}
-#ifdef CONFIG_DM_PCI
static const struct pci_flag_info {
uint flag;
const char *name;
@@ -647,7 +463,6 @@ static void pci_show_regions(struct udevice *bus)
printf("\n");
}
}
-#endif
/* PCI Configuration Space access commands
*
@@ -661,11 +476,7 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
ulong addr = 0, value = 0, cmd_size = 0;
enum pci_size_t size = PCI_SIZE_32;
-#ifdef CONFIG_DM_PCI
struct udevice *dev, *bus;
-#else
- pci_dev_t dev;
-#endif
int busnum = 0;
pci_dev_t bdf = 0;
char cmd = 's';
@@ -683,23 +494,19 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
cmd_size = cmd_get_data_size(argv[1], 4);
size = (cmd_size == 4) ? PCI_SIZE_32 : cmd_size - 1;
if (argc > 3)
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
if (argc > 4)
- value = simple_strtoul(argv[4], NULL, 16);
+ value = hextoul(argv[4], NULL);
case 'h': /* header */
-#ifdef CONFIG_DM_PCI
case 'b': /* bars */
-#endif
if (argc < 3)
goto usage;
if ((bdf = get_pci_dev(argv[2])) == -1)
return 1;
break;
-#if defined(CONFIG_DM_PCI)
case 'e':
pci_init();
return 0;
-#endif
case 'r': /* no break */
default: /* scan bus */
value = 1; /* short listing */
@@ -709,9 +516,8 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
argc--;
}
if (argc > 1)
- busnum = simple_strtoul(argv[1], NULL, 16);
+ busnum = hextoul(argv[1], NULL);
}
-#ifdef CONFIG_DM_PCI
ret = uclass_get_device_by_seq(UCLASS_PCI, busnum, &bus);
if (ret) {
printf("No such bus\n");
@@ -721,21 +527,14 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
pci_show_regions(bus);
else
pciinfo(bus, value);
-#else
- pciinfo(busnum, value);
-#endif
return 0;
}
-#ifdef CONFIG_DM_PCI
ret = dm_pci_bus_find_bdf(bdf, &dev);
if (ret) {
printf("No such device\n");
return CMD_RET_FAILURE;
}
-#else
- dev = bdf;
-#endif
switch (argv[1][0]) {
case 'h': /* header */
@@ -756,17 +555,10 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
case 'w': /* write */
if (argc < 5)
goto usage;
-#ifdef CONFIG_DM_PCI
ret = dm_pci_write_config(dev, addr, value, size);
-#else
- ret = pci_cfg_write(dev, addr, size, value);
-#endif
break;
-#ifdef CONFIG_DM_PCI
-
case 'b': /* bars */
return pci_bar_show(dev);
-#endif
default:
ret = CMD_RET_USAGE;
break;
@@ -783,18 +575,14 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
static char pci_help_text[] =
"[bus] [long]\n"
" - short or long list of PCI devices on bus 'bus'\n"
-#if defined(CONFIG_DM_PCI)
"pci enum\n"
" - Enumerate PCI buses\n"
-#endif
"pci header b.d.f\n"
" - show header of PCI device 'bus.device.function'\n"
-#ifdef CONFIG_DM_PCI
"pci bar b.d.f\n"
" - show BARs base and size for device b.d.f'\n"
"pci regions\n"
" - show PCI regions\n"
-#endif
"pci display[.b, .w, .l] b.d.f [address] [# of objects]\n"
" - display PCI configuration space (CFG)\n"
"pci next[.b, .w, .l] b.d.f address\n"
diff --git a/cmd/pstore.c b/cmd/pstore.c
index 5656bae6d3..9fac8c7218 100644
--- a/cmd/pstore.c
+++ b/cmd/pstore.c
@@ -172,26 +172,26 @@ static int pstore_set(struct cmd_tbl *cmdtp, int flag, int argc,
/* Address is specified since argc > 2
*/
- pstore_addr = simple_strtoul(argv[1], NULL, 16);
+ pstore_addr = hextoul(argv[1], NULL);
/* Length is specified since argc > 2
*/
- pstore_length = simple_strtoul(argv[2], NULL, 16);
+ pstore_length = hextoul(argv[2], NULL);
if (argc > 3)
- pstore_record_size = simple_strtoul(argv[3], NULL, 16);
+ pstore_record_size = hextoul(argv[3], NULL);
if (argc > 4)
- pstore_console_size = simple_strtoul(argv[4], NULL, 16);
+ pstore_console_size = hextoul(argv[4], NULL);
if (argc > 5)
- pstore_ftrace_size = simple_strtoul(argv[5], NULL, 16);
+ pstore_ftrace_size = hextoul(argv[5], NULL);
if (argc > 6)
- pstore_pmsg_size = simple_strtoul(argv[6], NULL, 16);
+ pstore_pmsg_size = hextoul(argv[6], NULL);
if (argc > 7)
- pstore_ecc_size = simple_strtoul(argv[7], NULL, 16);
+ pstore_ecc_size = hextoul(argv[7], NULL);
if (pstore_length < (pstore_record_size + pstore_console_size
+ pstore_ftrace_size + pstore_pmsg_size)) {
@@ -279,7 +279,7 @@ static int pstore_display(struct cmd_tbl *cmdtp, int flag, int argc,
- pstore_ftrace_size - pstore_console_size;
if (argc > 2) {
- ptr += simple_strtoul(argv[2], NULL, 10)
+ ptr += dectoul(argv[2], NULL)
* pstore_record_size;
ptr_end = ptr + pstore_record_size;
}
diff --git a/cmd/pwm.c b/cmd/pwm.c
index e1f97c759d..87d840a2b9 100644
--- a/cmd/pwm.c
+++ b/cmd/pwm.c
@@ -66,7 +66,7 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
- pwm_dev = simple_strtoul(str_pwm, NULL, 10);
+ pwm_dev = dectoul(str_pwm, NULL);
ret = uclass_get_device(UCLASS_PWM, pwm_dev, &dev);
if (ret) {
printf("pwm: '%s' not found\n", str_pwm);
@@ -74,22 +74,22 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc,
}
str_channel = *argv;
- channel = simple_strtoul(str_channel, NULL, 10);
+ channel = dectoul(str_channel, NULL);
argc--;
argv++;
if (sub_cmd == PWM_SET_INVERT) {
str_enable = *argv;
- pwm_enable = simple_strtoul(str_enable, NULL, 10);
+ pwm_enable = dectoul(str_enable, NULL);
ret = pwm_set_invert(dev, channel, pwm_enable);
} else if (sub_cmd == PWM_SET_CONFIG) {
str_period = *argv;
argc--;
argv++;
- period_ns = simple_strtoul(str_period, NULL, 10);
+ period_ns = dectoul(str_period, NULL);
str_duty = *argv;
- duty_ns = simple_strtoul(str_duty, NULL, 10);
+ duty_ns = dectoul(str_duty, NULL);
ret = pwm_set_config(dev, channel, period_ns, duty_ns);
} else if (sub_cmd == PWM_SET_ENABLE) {
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index 9a30629e26..067c24e5ff 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -351,7 +351,7 @@ static void label_boot_fdtoverlay(struct cmd_tbl *cmdtp, struct pxe_label *label
int err;
/* Get the main fdt and map it */
- fdt_addr = simple_strtoul(env_get("fdt_addr_r"), NULL, 16);
+ fdt_addr = hextoul(env_get("fdt_addr_r"), NULL);
working_fdt = map_sysmem(fdt_addr, 0);
err = fdt_check_header(working_fdt);
if (err)
@@ -364,7 +364,7 @@ static void label_boot_fdtoverlay(struct cmd_tbl *cmdtp, struct pxe_label *label
return;
}
- fdtoverlay_addr = simple_strtoul(fdtoverlay_addr_env, NULL, 16);
+ fdtoverlay_addr = hextoul(fdtoverlay_addr_env, NULL);
/* Cycle over the overlay files and apply them in order */
do {
diff --git a/cmd/qfw.c b/cmd/qfw.c
index e6a9fdb2af..eb6a552f6f 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -120,7 +120,7 @@ static int qemu_fwcfg_do_load(struct cmd_tbl *cmdtp, int flag,
env = env_get("loadaddr");
load_addr = env ?
- (void *)simple_strtoul(env, NULL, 16) :
+ (void *)hextoul(env, NULL) :
#ifdef CONFIG_LOADADDR
(void *)CONFIG_LOADADDR;
#else
@@ -129,7 +129,7 @@ static int qemu_fwcfg_do_load(struct cmd_tbl *cmdtp, int flag,
env = env_get("ramdiskaddr");
initrd_addr = env ?
- (void *)simple_strtoul(env, NULL, 16) :
+ (void *)hextoul(env, NULL) :
#ifdef CONFIG_RAMDISK_ADDR
(void *)CONFIG_RAMDISK_ADDR;
#else
@@ -137,10 +137,10 @@ static int qemu_fwcfg_do_load(struct cmd_tbl *cmdtp, int flag,
#endif
if (argc == 2) {
- load_addr = (void *)simple_strtoul(argv[0], NULL, 16);
- initrd_addr = (void *)simple_strtoul(argv[1], NULL, 16);
+ load_addr = (void *)hextoul(argv[0], NULL);
+ initrd_addr = (void *)hextoul(argv[1], NULL);
} else if (argc == 1) {
- load_addr = (void *)simple_strtoul(argv[0], NULL, 16);
+ load_addr = (void *)hextoul(argv[0], NULL);
}
if (!load_addr || !initrd_addr) {
diff --git a/cmd/read.c b/cmd/read.c
index 34f53f9a29..99c7e3854e 100644
--- a/cmd/read.c
+++ b/cmd/read.c
@@ -30,13 +30,13 @@ int do_read(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
}
- dev = (int)simple_strtoul(argv[2], &ep, 16);
+ dev = (int)hextoul(argv[2], &ep);
if (*ep) {
if (*ep != ':') {
printf("Invalid block device %s\n", argv[2]);
return 1;
}
- part = (int)simple_strtoul(++ep, NULL, 16);
+ part = (int)hextoul(++ep, NULL);
}
dev_desc = blk_get_dev(argv[1], dev);
@@ -45,9 +45,9 @@ int do_read(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
}
- addr = (void *)simple_strtoul(argv[3], NULL, 16);
- blk = simple_strtoul(argv[4], NULL, 16);
- cnt = simple_strtoul(argv[5], NULL, 16);
+ addr = (void *)hextoul(argv[3], NULL);
+ blk = hextoul(argv[4], NULL);
+ cnt = hextoul(argv[5], NULL);
if (part != 0) {
if (part_get_info(dev_desc, part, &part_info)) {
diff --git a/cmd/reiser.c b/cmd/reiser.c
index 3db926f806..707167fcd5 100644
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
@@ -90,7 +90,7 @@ int do_reiserload(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
case 3:
addr_str = env_get("loadaddr");
if (addr_str != NULL) {
- addr = simple_strtoul (addr_str, NULL, 16);
+ addr = hextoul(addr_str, NULL);
} else {
addr = CONFIG_SYS_LOAD_ADDR;
}
@@ -98,19 +98,19 @@ int do_reiserload(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
count = 0;
break;
case 4:
- addr = simple_strtoul (argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = env_get("bootfile");
count = 0;
break;
case 5:
- addr = simple_strtoul (argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = argv[4];
count = 0;
break;
case 6:
- addr = simple_strtoul (argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = argv[4];
- count = simple_strtoul (argv[5], NULL, 16);
+ count = hextoul(argv[5], NULL);
break;
default:
diff --git a/cmd/remoteproc.c b/cmd/remoteproc.c
index b3ddcebe31..ca3b436242 100644
--- a/cmd/remoteproc.c
+++ b/cmd/remoteproc.c
@@ -84,7 +84,7 @@ static int do_rproc_init(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
printf("Few Remote Processors failed to be initialized\n");
} else if (argc == 2) {
- id = (int)simple_strtoul(argv[1], NULL, 10);
+ id = (int)dectoul(argv[1], NULL);
if (!rproc_dev_init(id))
return 0;
printf("Remote Processor %d failed to be initialized\n", id);
@@ -129,10 +129,10 @@ static int do_remoteproc_load(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 4)
return CMD_RET_USAGE;
- id = (int)simple_strtoul(argv[1], NULL, 10);
- addr = simple_strtoul(argv[2], NULL, 16);
+ id = (int)dectoul(argv[1], NULL);
+ addr = hextoul(argv[2], NULL);
- size = simple_strtoul(argv[3], NULL, 16);
+ size = hextoul(argv[3], NULL);
if (!size) {
printf("\t Expect some size??\n");
@@ -167,7 +167,7 @@ static int do_remoteproc_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
- id = (int)simple_strtoul(argv[1], NULL, 10);
+ id = (int)dectoul(argv[1], NULL);
if (!strcmp(argv[0], "start")) {
ret = rproc_start(id);
diff --git a/cmd/rng.c b/cmd/rng.c
index 9747c11be4..1ad5a096c0 100644
--- a/cmd/rng.c
+++ b/cmd/rng.c
@@ -24,7 +24,7 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (argc >= 2)
- n = simple_strtoul(argv[1], NULL, 16);
+ n = hextoul(argv[1], NULL);
buf = malloc(n);
if (!buf) {
diff --git a/cmd/rtc.c b/cmd/rtc.c
index b4f61b2e83..75d4b64d68 100644
--- a/cmd/rtc.c
+++ b/cmd/rtc.c
@@ -18,13 +18,13 @@ static int do_rtc_read(struct udevice *dev, int argc, char * const argv[])
if (argc < 2 || argc > 3)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[0], NULL, 16);
- len = simple_strtoul(argv[1], NULL, 16);
+ reg = hextoul(argv[0], NULL);
+ len = hextoul(argv[1], NULL);
if (argc == 3) {
u8 *addr;
- addr = map_sysmem(simple_strtoul(argv[2], NULL, 16), len);
+ addr = map_sysmem(hextoul(argv[2], NULL), len);
ret = dm_rtc_read(dev, reg, addr, len);
unmap_sysmem(addr);
if (ret) {
@@ -59,13 +59,13 @@ static int do_rtc_write(struct udevice *dev, int argc, char * const argv[])
if (argc < 2 || argc > 3)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[0], NULL, 16);
+ reg = hextoul(argv[0], NULL);
if (argc == 3) {
u8 *addr;
- len = simple_strtoul(argv[1], NULL, 16);
- addr = map_sysmem(simple_strtoul(argv[2], NULL, 16), len);
+ len = hextoul(argv[1], NULL);
+ addr = map_sysmem(hextoul(argv[2], NULL), len);
ret = dm_rtc_write(dev, reg, addr, len);
unmap_sysmem(addr);
if (ret) {
@@ -130,7 +130,7 @@ int do_rtc(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
idx = curr_rtc;
if (!strcmp(argv[0], "dev") && argc >= 2)
- idx = simple_strtoul(argv[1], NULL, 10);
+ idx = dectoul(argv[1], NULL);
ret = uclass_get_device(UCLASS_RTC, idx, &dev);
if (ret) {
diff --git a/cmd/sata.c b/cmd/sata.c
index aa396c1bbd..76da1906b7 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -88,7 +88,7 @@ static int do_sata(struct cmd_tbl *cmdtp, int flag, int argc,
int devnum = 0;
if (argc == 3)
- devnum = (int)simple_strtoul(argv[2], NULL, 10);
+ devnum = (int)dectoul(argv[2], NULL);
if (!strcmp(argv[1], "stop"))
return sata_remove(devnum);
diff --git a/cmd/setexpr.c b/cmd/setexpr.c
index 1eb67e2eff..05d655809b 100644
--- a/cmd/setexpr.c
+++ b/cmd/setexpr.c
@@ -49,7 +49,7 @@ static int get_arg(char *s, int w, struct expr_arg *argp)
int len;
char *str;
- addr = simple_strtoul(&s[1], NULL, 16);
+ addr = hextoul(&s[1], NULL);
switch (w) {
case 1:
p = map_sysmem(addr, sizeof(uchar));
@@ -94,7 +94,7 @@ static int get_arg(char *s, int w, struct expr_arg *argp)
} else {
if (w == CMD_DATA_SIZE_STR)
return -EINVAL;
- arg.ival = simple_strtoul(s, NULL, 16);
+ arg.ival = hextoul(s, NULL);
}
*argp = arg;
diff --git a/cmd/sf.c b/cmd/sf.c
index 46346fb9d4..eac27ed2d7 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -54,7 +54,7 @@ static int sf_parse_len_arg(char *arg, ulong *len)
++arg;
}
- len_arg = simple_strtoul(arg, &ep, 16);
+ len_arg = hextoul(arg, &ep);
if (ep == arg || *ep != '\0')
return -1;
@@ -119,7 +119,7 @@ static int do_spi_flash_probe(int argc, char *const argv[])
return -1;
}
if (argc >= 4) {
- mode = simple_strtoul(argv[3], &endp, 16);
+ mode = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return -1;
}
@@ -272,7 +272,7 @@ static int do_spi_flash_read_write(int argc, char *const argv[])
if (argc < 3)
return -1;
- addr = simple_strtoul(argv[1], &endp, 16);
+ addr = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
@@ -517,10 +517,10 @@ static int do_spi_flash_test(int argc, char *const argv[])
if (argc < 3)
return -1;
- offset = simple_strtoul(argv[1], &endp, 16);
+ offset = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
- len = simple_strtoul(argv[2], &endp, 16);
+ len = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return -1;
diff --git a/cmd/sleep.c b/cmd/sleep.c
index 1fff400c79..c741b4aa02 100644
--- a/cmd/sleep.c
+++ b/cmd/sleep.c
@@ -20,7 +20,7 @@ static int do_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
- delay = simple_strtoul(argv[1], NULL, 10) * CONFIG_SYS_HZ;
+ delay = dectoul(argv[1], NULL) * CONFIG_SYS_HZ;
frpart = strchr(argv[1], '.');
diff --git a/cmd/smccc.c b/cmd/smccc.c
index 0ff9a08021..f527181772 100644
--- a/cmd/smccc.c
+++ b/cmd/smccc.c
@@ -28,15 +28,15 @@ static int do_call(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
- fid = simple_strtoul(argv[1], NULL, 16);
+ fid = hextoul(argv[1], NULL);
- a1 = argc > 2 ? simple_strtoul(argv[2], NULL, 16) : 0;
- a2 = argc > 3 ? simple_strtoul(argv[3], NULL, 16) : 0;
- a3 = argc > 4 ? simple_strtoul(argv[4], NULL, 16) : 0;
- a4 = argc > 5 ? simple_strtoul(argv[5], NULL, 16) : 0;
- a5 = argc > 6 ? simple_strtoul(argv[6], NULL, 16) : 0;
- a6 = argc > 7 ? simple_strtoul(argv[7], NULL, 16) : 0;
- a7 = argc > 8 ? simple_strtoul(argv[8], NULL, 16) : 0;
+ a1 = argc > 2 ? hextoul(argv[2], NULL) : 0;
+ a2 = argc > 3 ? hextoul(argv[3], NULL) : 0;
+ a3 = argc > 4 ? hextoul(argv[4], NULL) : 0;
+ a4 = argc > 5 ? hextoul(argv[5], NULL) : 0;
+ a5 = argc > 6 ? hextoul(argv[6], NULL) : 0;
+ a6 = argc > 7 ? hextoul(argv[7], NULL) : 0;
+ a7 = argc > 8 ? hextoul(argv[8], NULL) : 0;
if (!strcmp(argv[0], "smc"))
arm_smccc_smc(fid, a1, a2, a3, a4, a5, a6, a7, &res);
diff --git a/cmd/sound.c b/cmd/sound.c
index fdcde36533..f82f2aa670 100644
--- a/cmd/sound.c
+++ b/cmd/sound.c
@@ -41,9 +41,9 @@ static int do_play(struct cmd_tbl *cmdtp, int flag, int argc,
int freq = 400;
if (argc > 1)
- msec = simple_strtoul(argv[1], NULL, 10);
+ msec = dectoul(argv[1], NULL);
if (argc > 2)
- freq = simple_strtoul(argv[2], NULL, 10);
+ freq = dectoul(argv[2], NULL);
ret = uclass_first_device_err(UCLASS_SOUND, &dev);
if (!ret)
diff --git a/cmd/source.c b/cmd/source.c
index 71f71528ad..81e015b64e 100644
--- a/cmd/source.c
+++ b/cmd/source.c
@@ -179,7 +179,7 @@ static int do_source(struct cmd_tbl *cmdtp, int flag, int argc,
fit_uname, addr);
#endif
} else {
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
debug("* source: cmdline image address = 0x%08lx\n", addr);
}
diff --git a/cmd/spi.c b/cmd/spi.c
index 4aea191412..bdbdbacecd 100644
--- a/cmd/spi.c
+++ b/cmd/spi.c
@@ -114,20 +114,20 @@ int do_spi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
if (argc >= 2) {
mode = CONFIG_DEFAULT_SPI_MODE;
- bus = simple_strtoul(argv[1], &cp, 10);
+ bus = dectoul(argv[1], &cp);
if (*cp == ':') {
- cs = simple_strtoul(cp+1, &cp, 10);
+ cs = dectoul(cp + 1, &cp);
} else {
cs = bus;
bus = CONFIG_DEFAULT_SPI_BUS;
}
if (*cp == '.')
- mode = simple_strtoul(cp+1, &cp, 10);
+ mode = dectoul(cp + 1, &cp);
if (*cp == '@')
- freq = simple_strtoul(cp+1, &cp, 10);
+ freq = dectoul(cp + 1, &cp);
}
if (argc >= 3)
- bitlen = simple_strtoul(argv[2], NULL, 10);
+ bitlen = dectoul(argv[2], NULL);
if (argc >= 4) {
cp = argv[3];
for(j = 0; *cp; j++, cp++) {
diff --git a/cmd/strings.c b/cmd/strings.c
index 85fdc34f08..bf348afce8 100644
--- a/cmd/strings.c
+++ b/cmd/strings.c
@@ -18,9 +18,9 @@ int do_strings(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
if ((flag & CMD_FLAG_REPEAT) == 0) {
- start_addr = (char *)simple_strtoul(argv[1], NULL, 16);
+ start_addr = (char *)hextoul(argv[1], NULL);
if (argc > 2)
- last_addr = (char *)simple_strtoul(argv[2], NULL, 16);
+ last_addr = (char *)hextoul(argv[2], NULL);
else
last_addr = (char *)-1;
}
diff --git a/cmd/ti/ddr3.c b/cmd/ti/ddr3.c
index 6b43a73868..be937a7531 100644
--- a/cmd/ti/ddr3.c
+++ b/cmd/ti/ddr3.c
@@ -290,8 +290,8 @@ static int do_ddr_test(struct cmd_tbl *cmdtp,
return CMD_RET_FAILURE;
}
- start_addr = simple_strtoul(argv[2], NULL, 16);
- ecc_err = simple_strtoul(argv[3], NULL, 16);
+ start_addr = hextoul(argv[2], NULL);
+ ecc_err = hextoul(argv[3], NULL);
if (!is_addr_valid(start_addr)) {
puts("Invalid address. Please enter ECC supported address!\n");
@@ -306,8 +306,8 @@ static int do_ddr_test(struct cmd_tbl *cmdtp,
((argc == 5) && (strncmp(argv[1], "compare", 8) == 0))))
return cmd_usage(cmdtp);
- start_addr = simple_strtoul(argv[2], NULL, 16);
- end_addr = simple_strtoul(argv[3], NULL, 16);
+ start_addr = hextoul(argv[2], NULL);
+ end_addr = hextoul(argv[3], NULL);
if ((start_addr < CONFIG_SYS_SDRAM_BASE) ||
(start_addr > (CONFIG_SYS_SDRAM_BASE +
@@ -321,7 +321,7 @@ static int do_ddr_test(struct cmd_tbl *cmdtp,
puts("Please wait ...\n");
if (argc == 5) {
- size = simple_strtoul(argv[4], NULL, 16);
+ size = hextoul(argv[4], NULL);
ddr_memory_compare(start_addr, end_addr, size);
} else {
ddr_memory_test(start_addr, end_addr, 0);
diff --git a/cmd/ti/pd.c b/cmd/ti/pd.c
index 9e820b84ca..008668fd90 100644
--- a/cmd/ti/pd.c
+++ b/cmd/ti/pd.c
@@ -119,8 +119,8 @@ static int do_pd_endis(int argc, char *const argv[], u8 state)
if (!data)
return CMD_RET_FAILURE;
- psc_id = simple_strtoul(argv[1], NULL, 10);
- lpsc_id = simple_strtoul(argv[2], NULL, 10);
+ psc_id = dectoul(argv[1], NULL);
+ lpsc_id = dectoul(argv[2], NULL);
for (i = 0; i < data->num_lpsc; i++) {
lpsc = &data->lpsc[i];
diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c
index 5099cbdd95..2b643f9587 100644
--- a/cmd/tlv_eeprom.c
+++ b/cmd/tlv_eeprom.c
@@ -751,7 +751,7 @@ static int set_mac(char *buf, const char *string)
/* Convert string to binary */
for (i = 0, p = (char *)string; i < 6; i++) {
- buf[i] = p ? simple_strtoul(p, &end, 16) : 0;
+ buf[i] = p ? hextoul(p, &end) : 0;
if (p)
p = (*end) ? end + 1 : end;
}
diff --git a/cmd/tpm-common.c b/cmd/tpm-common.c
index 88c9e08e31..1d5442c06f 100644
--- a/cmd/tpm-common.c
+++ b/cmd/tpm-common.c
@@ -68,7 +68,7 @@ void *parse_byte_string(char *bytes, u8 *data, size_t *count_ptr)
for (i = 0; i < length; i += 2) {
byte[0] = bytes[i];
byte[1] = bytes[i + 1];
- data[i / 2] = (u8)simple_strtoul(byte, NULL, 16);
+ data[i / 2] = (u8)hextoul(byte, NULL);
}
if (count_ptr)
@@ -302,7 +302,7 @@ int do_tpm_device(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
int rc;
if (argc == 2) {
- num = simple_strtoul(argv[1], NULL, 10);
+ num = dectoul(argv[1], NULL);
rc = tpm_set_device(num);
if (rc)
diff --git a/cmd/trace.c b/cmd/trace.c
index 4ce47c7627..2e3ee1d3ba 100644
--- a/cmd/trace.c
+++ b/cmd/trace.c
@@ -21,8 +21,8 @@ static int get_args(int argc, char *const argv[], char **buff,
*buff_size);
*buff_ptr = env_get_ulong("profoffset", 16, 0);
} else {
- *buff_size = simple_strtoul(argv[3], NULL, 16);
- *buff = map_sysmem(simple_strtoul(argv[2], NULL, 16),
+ *buff_size = hextoul(argv[3], NULL);
+ *buff = map_sysmem(hextoul(argv[2], NULL),
*buff_size);
*buff_ptr = 0;
};
diff --git a/cmd/tsi148.c b/cmd/tsi148.c
index 2eae14f87f..0d849d9979 100644
--- a/cmd/tsi148.c
+++ b/cmd/tsi148.c
@@ -392,15 +392,15 @@ int do_tsi148(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc > 1)
cmd = argv[1][0];
if (argc > 2)
- addr1 = simple_strtoul(argv[2], NULL, 16);
+ addr1 = hextoul(argv[2], NULL);
if (argc > 3)
- addr2 = simple_strtoul(argv[3], NULL, 16);
+ addr2 = hextoul(argv[3], NULL);
if (argc > 4)
- size = simple_strtoul(argv[4], NULL, 16);
+ size = hextoul(argv[4], NULL);
if (argc > 5)
- vam = simple_strtoul(argv[5], NULL, 16);
+ vam = hextoul(argv[5], NULL);
if (argc > 6)
- vdw = simple_strtoul(argv[6], NULL, 16);
+ vdw = hextoul(argv[6], NULL);
switch (cmd) {
case 'c':
diff --git a/cmd/ubi.c b/cmd/ubi.c
index cb14e3e1e7..fe8ac58bac 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -661,8 +661,8 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
}
- addr = simple_strtoul(argv[2], NULL, 16);
- size = simple_strtoul(argv[4], NULL, 16);
+ addr = hextoul(argv[2], NULL);
+ size = hextoul(argv[4], NULL);
if (strlen(argv[1]) == 10 &&
strncmp(argv[1] + 5, ".part", 5) == 0) {
@@ -671,7 +671,7 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
(void *)addr, size);
} else {
size_t full_size;
- full_size = simple_strtoul(argv[5], NULL, 16);
+ full_size = hextoul(argv[5], NULL);
ret = ubi_volume_begin_write(argv[3],
(void *)addr, size, full_size);
}
@@ -691,13 +691,13 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/* E.g., read volume size */
if (argc == 5) {
- size = simple_strtoul(argv[4], NULL, 16);
+ size = hextoul(argv[4], NULL);
argc--;
}
/* E.g., read volume */
if (argc == 4) {
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
argc--;
}
diff --git a/cmd/ubifs.c b/cmd/ubifs.c
index a26b653d61..7a620c5e21 100644
--- a/cmd/ubifs.c
+++ b/cmd/ubifs.c
@@ -122,14 +122,14 @@ static int do_ubifs_load(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], &endp, 16);
+ addr = hextoul(argv[1], &endp);
if (endp == argv[1])
return CMD_RET_USAGE;
filename = argv[2];
if (argc == 4) {
- size = simple_strtoul(argv[3], &endp, 16);
+ size = hextoul(argv[3], &endp);
if (endp == argv[3])
return CMD_RET_USAGE;
}
diff --git a/cmd/ufs.c b/cmd/ufs.c
index 858cd49b59..d4a1e66c1b 100644
--- a/cmd/ufs.c
+++ b/cmd/ufs.c
@@ -16,7 +16,7 @@ static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc >= 2) {
if (!strcmp(argv[1], "init")) {
if (argc == 3) {
- dev = simple_strtoul(argv[2], NULL, 10);
+ dev = dectoul(argv[2], NULL);
ret = ufs_probe_dev(dev);
if (ret)
return CMD_RET_FAILURE;
diff --git a/cmd/universe.c b/cmd/universe.c
index 5ff47dde4f..fb3a32d4d5 100644
--- a/cmd/universe.c
+++ b/cmd/universe.c
@@ -307,17 +307,17 @@ int do_universe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc > 1)
cmd = argv[1][0];
if (argc > 2)
- addr1 = simple_strtoul(argv[2], NULL, 16);
+ addr1 = hextoul(argv[2], NULL);
if (argc > 3)
- addr2 = simple_strtoul(argv[3], NULL, 16);
+ addr2 = hextoul(argv[3], NULL);
if (argc > 4)
- size = simple_strtoul(argv[4], NULL, 16);
+ size = hextoul(argv[4], NULL);
if (argc > 5)
- vam = simple_strtoul(argv[5], NULL, 16);
+ vam = hextoul(argv[5], NULL);
if (argc > 6)
- pms = simple_strtoul(argv[6], NULL, 16);
+ pms = hextoul(argv[6], NULL);
if (argc > 7)
- vdw = simple_strtoul(argv[7], NULL, 16);
+ vdw = hextoul(argv[7], NULL);
switch (cmd) {
case 'i': /* init */
diff --git a/cmd/unlz4.c b/cmd/unlz4.c
index 4ae7f34d36..323ab46717 100644
--- a/cmd/unlz4.c
+++ b/cmd/unlz4.c
@@ -18,9 +18,9 @@ static int do_unlz4(struct cmd_tbl *cmdtp, int flag, int argc,
switch (argc) {
case 4:
- src = simple_strtoul(argv[1], NULL, 16);
- dst = simple_strtoul(argv[2], NULL, 16);
- dst_len = simple_strtoul(argv[3], NULL, 16);
+ src = hextoul(argv[1], NULL);
+ dst = hextoul(argv[2], NULL);
+ dst_len = hextoul(argv[3], NULL);
break;
default:
return CMD_RET_USAGE;
diff --git a/cmd/unzip.c b/cmd/unzip.c
index 9b28328a1d..3d1f5f3ac1 100644
--- a/cmd/unzip.c
+++ b/cmd/unzip.c
@@ -18,11 +18,11 @@ static int do_unzip(struct cmd_tbl *cmdtp, int flag, int argc,
switch (argc) {
case 4:
- dst_len = simple_strtoul(argv[3], NULL, 16);
+ dst_len = hextoul(argv[3], NULL);
/* fall through */
case 3:
- src = simple_strtoul(argv[1], NULL, 16);
- dst = simple_strtoul(argv[2], NULL, 16);
+ src = hextoul(argv[1], NULL);
+ dst = hextoul(argv[2], NULL);
break;
default:
return CMD_RET_USAGE;
@@ -60,11 +60,11 @@ static int do_gzwrite(struct cmd_tbl *cmdtp, int flag,
if (ret < 0)
return CMD_RET_FAILURE;
- addr = (unsigned char *)simple_strtoul(argv[3], NULL, 16);
- length = simple_strtoul(argv[4], NULL, 16);
+ addr = (unsigned char *)hextoul(argv[3], NULL);
+ length = hextoul(argv[4], NULL);
if (5 < argc) {
- writebuf = simple_strtoul(argv[5], NULL, 16);
+ writebuf = hextoul(argv[5], NULL);
if (6 < argc) {
startoffs = simple_strtoull(argv[6], NULL, 16);
if (7 < argc)
diff --git a/cmd/usb.c b/cmd/usb.c
index b9ec29a845..3d87376525 100644
--- a/cmd/usb.c
+++ b/cmd/usb.c
@@ -690,7 +690,7 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
* have multiple controllers and the device numbering
* starts at 1 on each bus.
*/
- i = simple_strtoul(argv[2], NULL, 10);
+ i = dectoul(argv[2], NULL);
printf("config for device %d\n", i);
udev = usb_find_device(i);
if (udev == NULL) {
@@ -706,13 +706,13 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (strncmp(argv[1], "test", 4) == 0) {
if (argc < 5)
return CMD_RET_USAGE;
- i = simple_strtoul(argv[2], NULL, 10);
+ i = dectoul(argv[2], NULL);
udev = usb_find_device(i);
if (udev == NULL) {
printf("Device %d does not exist.\n", i);
return 1;
}
- i = simple_strtoul(argv[3], NULL, 10);
+ i = dectoul(argv[3], NULL);
return usb_test(udev, i, argv[4]);
}
#ifdef CONFIG_USB_STORAGE
diff --git a/cmd/w1.c b/cmd/w1.c
index d0f0ee1234..3209e65f37 100644
--- a/cmd/w1.c
+++ b/cmd/w1.c
@@ -51,16 +51,16 @@ static int w1_read(int argc, char *const argv[])
u8 buf[512];
if (argc > 2)
- bus_n = simple_strtoul(argv[2], NULL, 10);
+ bus_n = dectoul(argv[2], NULL);
if (argc > 3)
- dev_n = simple_strtoul(argv[3], NULL, 10);
+ dev_n = dectoul(argv[3], NULL);
if (argc > 4)
- offset = simple_strtoul(argv[4], NULL, 10);
+ offset = dectoul(argv[4], NULL);
if (argc > 5)
- len = simple_strtoul(argv[5], NULL, 10);
+ len = dectoul(argv[5], NULL);
if (len > 512) {
printf("len needs to be <= 512\n");
diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c
index 01db93eb3e..04d092dbe7 100644
--- a/cmd/x86/hob.c
+++ b/cmd/x86/hob.c
@@ -78,7 +78,7 @@ static void show_hob_details(const struct hob_header *hdr)
const struct hob_res_desc *res = ptr;
const char *typename;
- typename = res->type > 0 && res->type <= RES_MAX_MEM_TYPE ?
+ typename = res->type >= RES_SYS_MEM && res->type <= RES_MAX_MEM_TYPE ?
res_type[res->type] : "unknown";
printf(" base = %08llx, len = %08llx, end = %08llx, type = %d (%s)\n\n",
@@ -158,8 +158,7 @@ static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
U_BOOT_CMD(hob, 3, 1, do_hob,
- "[-v] [seq] Print Hand-Off Block (HOB) information"
- " -v - Show detailed HOB information where available"
- " seq - Record # to show (all by default)",
- ""
+ "[-v] [seq] Print Hand-Off Block (HOB) information",
+ " -v - Show detailed HOB information where available\n"
+ " seq - Record # to show (all by default)"
);
diff --git a/cmd/x86/mtrr.c b/cmd/x86/mtrr.c
index fc61a549b0..b213a942fd 100644
--- a/cmd/x86/mtrr.c
+++ b/cmd/x86/mtrr.c
@@ -78,8 +78,8 @@ static int do_mtrr_set(int cpu_select, uint reg, int argc, char *const argv[])
printf("Invalid type name %s\n", typename);
return CMD_RET_USAGE;
}
- start = simple_strtoul(argv[1], NULL, 16);
- size = simple_strtoul(argv[2], NULL, 16);
+ start = hextoul(argv[1], NULL);
+ size = hextoul(argv[2], NULL);
base = start | type;
valid = native_read_msr(MTRR_PHYS_MASK_MSR(reg)) & MTRR_PHYS_MASK_VALID;
@@ -126,7 +126,7 @@ static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc,
if (cmd != 'l') {
if (argc < 2)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[1], NULL, 16);
+ reg = hextoul(argv[1], NULL);
if (reg >= reg_count) {
printf("Invalid register number\n");
return CMD_RET_USAGE;
diff --git a/cmd/ximg.c b/cmd/ximg.c
index ef738ebfa2..65ba41320a 100644
--- a/cmd/ximg.c
+++ b/cmd/ximg.c
@@ -59,16 +59,16 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
verify = env_get_yesno("verify");
if (argc > 1) {
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
}
if (argc > 2) {
- part = simple_strtoul(argv[2], NULL, 16);
+ part = hextoul(argv[2], NULL);
#if defined(CONFIG_FIT)
uname = argv[2];
#endif
}
if (argc > 3) {
- dest = simple_strtoul(argv[3], NULL, 16);
+ dest = hextoul(argv[3], NULL);
}
switch (genimg_get_format((void *)addr)) {
diff --git a/cmd/yaffs2.c b/cmd/yaffs2.c
index f29ebcc026..27fbd1be8f 100644
--- a/cmd/yaffs2.c
+++ b/cmd/yaffs2.c
@@ -165,8 +165,8 @@ int do_ywr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
filename = argv[1];
- value = simple_strtoul(argv[2], NULL, 16);
- numValues = simple_strtoul(argv[3], NULL, 16);
+ value = hextoul(argv[2], NULL);
+ numValues = hextoul(argv[3], NULL);
printf("Writing value (%lx) %lx times to %s... ", value, numValues,
filename);
@@ -188,7 +188,7 @@ int do_yrdm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
filename = argv[1];
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
cmd_yaffs_mread_file(filename, (char *)addr);
@@ -207,8 +207,8 @@ int do_ywrm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
filename = argv[1];
- addr = simple_strtoul(argv[2], NULL, 16);
- size = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[2], NULL);
+ size = hextoul(argv[3], NULL);
cmd_yaffs_mwrite_file(filename, (char *)addr, size);
diff --git a/cmd/zfs.c b/cmd/zfs.c
index e429ac88d7..6ef1b56ab1 100644
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -50,13 +50,13 @@ static int do_zfs_load(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
count = 0;
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = env_get("bootfile");
switch (argc) {
case 3:
addr_str = env_get("loadaddr");
if (addr_str != NULL)
- addr = simple_strtoul(addr_str, NULL, 16);
+ addr = hextoul(addr_str, NULL);
else
addr = CONFIG_SYS_LOAD_ADDR;
@@ -68,7 +68,7 @@ static int do_zfs_load(struct cmd_tbl *cmdtp, int flag, int argc,
break;
case 6:
filename = argv[4];
- count = simple_strtoul(argv[5], NULL, 16);
+ count = hextoul(argv[5], NULL);
break;
default:
diff --git a/cmd/zip.c b/cmd/zip.c
index 8ad3768464..08afd62b97 100644
--- a/cmd/zip.c
+++ b/cmd/zip.c
@@ -16,12 +16,12 @@ static int do_zip(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
switch (argc) {
case 5:
- dst_len = simple_strtoul(argv[4], NULL, 16);
+ dst_len = hextoul(argv[4], NULL);
/* fall through */
case 4:
- src = simple_strtoul(argv[1], NULL, 16);
- src_len = simple_strtoul(argv[2], NULL, 16);
- dst = simple_strtoul(argv[3], NULL, 16);
+ src = hextoul(argv[1], NULL);
+ src_len = hextoul(argv[2], NULL);
+ dst = hextoul(argv[3], NULL);
break;
default:
return cmd_usage(cmdtp);
diff --git a/common/autoboot.c b/common/autoboot.c
index 8b9e9aa878..5bb2e19089 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -406,7 +406,7 @@ static int abortboot(int bootdelay)
int abort = 0;
if (bootdelay >= 0) {
- if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
+ if (autoboot_keyed())
abort = abortboot_key_sequence(bootdelay);
else
abort = abortboot_single_key(bootdelay);
@@ -481,7 +481,7 @@ void autoboot_command(const char *s)
bool lock;
int prev;
- lock = IS_ENABLED(CONFIG_AUTOBOOT_KEYED) &&
+ lock = autoboot_keyed() &&
!IS_ENABLED(CONFIG_AUTOBOOT_KEYED_CTRLC);
if (lock)
prev = disable_ctrlc(1); /* disable Ctrl-C checking */
@@ -498,4 +498,4 @@ void autoboot_command(const char *s)
if (s)
run_command_list(s, -1, 0);
}
-} \ No newline at end of file
+}
diff --git a/common/bedbug.c b/common/bedbug.c
index 18a35ca23e..c76fa4898c 100644
--- a/common/bedbug.c
+++ b/common/bedbug.c
@@ -1005,9 +1005,9 @@ long read_number (char *txt)
}
if (txt[0] == '0' && (txt[1] == 'x' || txt[1] == 'X')) /* hex */
- val = simple_strtoul (&txt[2], NULL, 16);
+ val = hextoul(&txt[2], NULL);
else /* decimal */
- val = simple_strtoul (txt, NULL, 10);
+ val = dectoul(txt, NULL);
if (is_neg)
val = -val;
diff --git a/common/board_r.c b/common/board_r.c
index 3f82404772..e3e6248a1f 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -323,10 +323,16 @@ static int initr_manual_reloc_cmdtable(void)
static int initr_binman(void)
{
+ int ret;
+
if (!CONFIG_IS_ENABLED(BINMAN_FDT))
return 0;
- return binman_init();
+ ret = binman_init();
+ if (ret)
+ printf("binman_init failed:%d\n", ret);
+
+ return ret;
}
#if defined(CONFIG_MTD_NOR_FLASH)
diff --git a/common/bootm_os.c b/common/bootm_os.c
index 0b6325db66..d635037064 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -238,7 +238,7 @@ static int do_bootm_plan9(int flag, int argc, char *const argv[],
/* See README.plan9 */
s = env_get("confaddr");
if (s != NULL) {
- char *confaddr = (char *)simple_strtoul(s, NULL, 16);
+ char *confaddr = (char *)hextoul(s, NULL);
if (argc > 0) {
copy_args(confaddr, argc, argv, '\n');
@@ -360,8 +360,7 @@ int do_bootm_vxworks(int flag, int argc, char *const argv[],
/* find f=0xnumber flag */
if ((bootargs[pos] == '=') && (pos >= 1) &&
(bootargs[pos - 1] == 'f')) {
- vxflags = simple_strtoul(&bootargs[pos + 1],
- NULL, 16);
+ vxflags = hextoul(&bootargs[pos + 1], NULL);
if (vxflags & VXWORKS_SYSFLG_STD_DTB)
std_dtb = true;
}
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 240f1e57d1..4341d84bd5 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -579,7 +579,7 @@ void fdt_fixup_ethernet(void *fdt)
for (j = 0; j < 6; j++) {
mac_addr[j] = tmp ?
- simple_strtoul(tmp, &end, 16) : 0;
+ hextoul(tmp, &end) : 0;
if (tmp)
tmp = (*end) ? end + 1 : end;
}
diff --git a/common/hash.c b/common/hash.c
index 90cf46bcba..dca23635ab 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -396,8 +396,8 @@ int hash_parse_string(const char *algo_name, const char *str, uint8_t *result)
for (i = 0; i < algo->digest_size; i++) {
char chr[3];
- strncpy(chr, &str[i * 2], 2);
- result[i] = simple_strtoul(chr, NULL, 16);
+ strlcpy(chr, &str[i * 2], 3);
+ result[i] = hextoul(chr, NULL);
}
return 0;
@@ -470,7 +470,7 @@ static void store_result(struct hash_algo *algo, const uint8_t *sum,
ulong addr;
void *buf;
- addr = simple_strtoul(dest, NULL, 16);
+ addr = hextoul(dest, NULL);
buf = map_sysmem(addr, algo->digest_size);
memcpy(buf, sum, algo->digest_size);
unmap_sysmem(buf);
@@ -510,7 +510,7 @@ static int parse_verify_sum(struct hash_algo *algo, char *verify_str,
ulong addr;
void *buf;
- addr = simple_strtoul(verify_str, NULL, 16);
+ addr = hextoul(verify_str, NULL);
buf = map_sysmem(addr, algo->digest_size);
memcpy(vsum, buf, algo->digest_size);
} else {
@@ -555,8 +555,8 @@ int hash_command(const char *algo_name, int flags, struct cmd_tbl *cmdtp,
if ((argc < 2) || ((flags & HASH_FLAG_VERIFY) && (argc < 3)))
return CMD_RET_USAGE;
- addr = simple_strtoul(*argv++, NULL, 16);
- len = simple_strtoul(*argv++, NULL, 16);
+ addr = hextoul(*argv++, NULL);
+ len = hextoul(*argv++, NULL);
if (multi_hash()) {
struct hash_algo *algo;
@@ -628,7 +628,7 @@ int hash_command(const char *algo_name, int flags, struct cmd_tbl *cmdtp,
addr, addr + len - 1, crc);
if (argc >= 3) {
- ptr = (ulong *)simple_strtoul(argv[0], NULL, 16);
+ ptr = (ulong *)hextoul(argv[0], NULL);
*ptr = crc;
}
}
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 06dce92a28..9441e63a3d 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -186,7 +186,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
/* If fdt_high is set use it to select the relocation address */
fdt_high = env_get("fdt_high");
if (fdt_high) {
- void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16);
+ void *desired_addr = (void *)hextoul(fdt_high, NULL);
if (((ulong) desired_addr) == ~0UL) {
/* All ones means use fdt in place */
@@ -297,7 +297,7 @@ int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
*of_size = 0;
img_addr = (argc == 0) ? image_load_addr :
- simple_strtoul(argv[0], NULL, 16);
+ hextoul(argv[0], NULL);
buf = map_sysmem(img_addr, 0);
if (argc > 2)
@@ -329,7 +329,7 @@ int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
} else
#endif
{
- fdt_addr = simple_strtoul(select, NULL, 16);
+ fdt_addr = hextoul(select, NULL);
debug("* fdt: cmdline image address = 0x%08lx\n",
fdt_addr);
}
diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c
index 55ddf1879e..b979cd2a4b 100644
--- a/common/image-fit-sig.c
+++ b/common/image-fit-sig.c
@@ -245,7 +245,13 @@ static int fit_config_check_sig(const void *fit, int noffset,
int required_keynode, int conf_noffset,
char **err_msgp)
{
- char * const exc_prop[] = {"data", "data-size", "data-position"};
+ static char * const exc_prop[] = {
+ "data",
+ "data-size",
+ "data-position",
+ "data-offset"
+ };
+
const char *prop, *end, *name;
struct image_sign_info info;
const uint32_t *strings;
diff --git a/common/image-fit.c b/common/image-fit.c
index d6b2c3c7ec..aff4670be3 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -53,7 +53,7 @@ static int fit_parse_spec(const char *spec, char sepc, ulong addr_curr,
sep = strchr(spec, sepc);
if (sep) {
if (sep - spec > 0)
- *addr = simple_strtoul(spec, NULL, 16);
+ *addr = hextoul(spec, NULL);
*name = sep + 1;
return 1;
diff --git a/common/image.c b/common/image.c
index 51854aae5d..59c52a1f9a 100644
--- a/common/image.c
+++ b/common/image.c
@@ -662,7 +662,7 @@ static int on_loadaddr(const char *name, const char *value, enum env_op op,
switch (op) {
case env_op_create:
case env_op_overwrite:
- image_load_addr = simple_strtoul(value, NULL, 16);
+ image_load_addr = hextoul(value, NULL);
break;
default:
break;
@@ -676,7 +676,7 @@ ulong env_get_bootm_low(void)
{
char *s = env_get("bootm_low");
if (s) {
- ulong tmp = simple_strtoul(s, NULL, 16);
+ ulong tmp = hextoul(s, NULL);
return tmp;
}
@@ -1060,7 +1060,7 @@ ulong genimg_get_kernel_addr_fit(char * const img_addr,
*fit_uname_kernel, kernel_addr);
#endif
} else {
- kernel_addr = simple_strtoul(img_addr, NULL, 16);
+ kernel_addr = hextoul(img_addr, NULL);
debug("* kernel: cmdline image address = 0x%08lx\n",
kernel_addr);
}
@@ -1227,7 +1227,7 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
} else
#endif
{
- rd_addr = simple_strtoul(select, NULL, 16);
+ rd_addr = hextoul(select, NULL);
debug("* ramdisk: cmdline image address = "
"0x%08lx\n",
rd_addr);
@@ -1301,7 +1301,7 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
if (select)
end = strchr(select, ':');
if (end) {
- rd_len = simple_strtoul(++end, NULL, 16);
+ rd_len = hextoul(++end, NULL);
rd_data = rd_addr;
} else
#endif
@@ -1379,7 +1379,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
/* a value of "no" or a similar string will act like 0,
* turning the "load high" feature off. This is intentional.
*/
- initrd_high = simple_strtoul(s, NULL, 16);
+ initrd_high = hextoul(s, NULL);
if (initrd_high == ~0)
initrd_copy_to_ram = 0;
} else {
diff --git a/common/kallsyms.c b/common/kallsyms.c
index ce42a932bb..13344e634b 100644
--- a/common/kallsyms.c
+++ b/common/kallsyms.c
@@ -31,7 +31,7 @@ const char *symbol_lookup(unsigned long addr, unsigned long *caddr)
*caddr = 0;
while (*sym) {
- sym_addr = simple_strtoul(sym, &esym, 16);
+ sym_addr = hextoul(sym, &esym);
sym = esym;
if (sym_addr > addr)
break;
diff --git a/common/lcd.c b/common/lcd.c
index ab5614ad0e..16a0a7cea8 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -747,7 +747,7 @@ static int on_splashimage(const char *name, const char *value, enum env_op op,
if (op == env_op_delete)
return 0;
- addr = simple_strtoul(value, NULL, 16);
+ addr = hextoul(value, NULL);
/* See README.displaying-bmps */
aligned = (addr % 4 == 2);
if (!aligned) {
diff --git a/common/lcd_console.c b/common/lcd_console.c
index 1a246c492c..9c0ff4480e 100644
--- a/common/lcd_console.c
+++ b/common/lcd_console.c
@@ -229,8 +229,8 @@ static int do_lcd_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 3)
return CMD_RET_USAGE;
- col = simple_strtoul(argv[1], NULL, 10);
- row = simple_strtoul(argv[2], NULL, 10);
+ col = dectoul(argv[1], NULL);
+ row = dectoul(argv[2], NULL);
lcd_position_cursor(col, row);
return 0;
diff --git a/common/splash.c b/common/splash.c
index 2b9313e03f..de720df9f5 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -65,7 +65,7 @@ static int splash_video_logo_load(void)
if (!splashimage)
return -ENOENT;
- bmp_load_addr = simple_strtoul(splashimage, 0, 16);
+ bmp_load_addr = hextoul(splashimage, 0);
if (!bmp_load_addr) {
printf("Error: bad 'splashimage' address\n");
return -EFAULT;
@@ -162,7 +162,7 @@ int splash_display(void)
if (!s)
return -EINVAL;
- addr = simple_strtoul(s, NULL, 16);
+ addr = hextoul(s, NULL);
ret = splash_screen_prepare();
if (ret)
return ret;
diff --git a/common/splash_source.c b/common/splash_source.c
index 3cf926d91a..d05670f5ee 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -414,7 +414,7 @@ int splash_source_load(struct splash_location *locations, uint size)
if (env_splashimage_value == NULL)
return -ENOENT;
- bmp_load_addr = simple_strtoul(env_splashimage_value, 0, 16);
+ bmp_load_addr = hextoul(env_splashimage_value, 0);
if (bmp_load_addr == 0) {
printf("Error: bad splashimage address specified\n");
return -EFAULT;
diff --git a/common/update.c b/common/update.c
index f0848954e5..f5c8684f1b 100644
--- a/common/update.c
+++ b/common/update.c
@@ -272,7 +272,7 @@ int update_tftp(ulong addr, char *interface, char *devstring)
/* get load address of downloaded update file */
env_addr = env_get("loadaddr");
if (env_addr)
- addr = simple_strtoul(env_addr, NULL, 16);
+ addr = hextoul(env_addr, NULL);
else
addr = CONFIG_UPDATE_LOAD_ADDR;
diff --git a/configs/arndale_defconfig b/configs/arndale_defconfig
index a3e74ab626..133c0eb888 100644
--- a/configs/arndale_defconfig
+++ b/configs/arndale_defconfig
@@ -37,7 +37,6 @@ CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_S5P=y
CONFIG_MTD=y
CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
CONFIG_SOUND=y
CONFIG_I2S=y
CONFIG_I2S_SAMSUNG=y
diff --git a/configs/crownbay_defconfig b/configs/crownbay_defconfig
index 0258f31089..d7ee0fe45e 100644
--- a/configs/crownbay_defconfig
+++ b/configs/crownbay_defconfig
@@ -8,8 +8,8 @@ CONFIG_MAX_CPUS=2
CONFIG_DEFAULT_DEVICE_TREE="crownbay"
CONFIG_VENDOR_INTEL=y
CONFIG_TARGET_CROWNBAY=y
+CONFIG_DISABLE_IGD=y
CONFIG_SMP=y
-CONFIG_HAVE_VGA_BIOS=y
CONFIG_GENERATE_PIRQ_TABLE=y
CONFIG_GENERATE_MP_TABLE=y
CONFIG_FIT=y
@@ -46,6 +46,7 @@ CONFIG_TFTP_TSIZE=y
CONFIG_REGMAP=y
CONFIG_SYSCON=y
CONFIG_CPU=y
+# CONFIG_SPI_FLASH_SMART_HWCAPS is not set
CONFIG_E1000=y
CONFIG_SOUND=y
CONFIG_SOUND_I8254=y
diff --git a/configs/odroid-xu3_defconfig b/configs/odroid-xu3_defconfig
index 99ac4170a1..f56dfb7d8e 100644
--- a/configs/odroid-xu3_defconfig
+++ b/configs/odroid-xu3_defconfig
@@ -46,7 +46,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y
CONFIG_MMC_DW=y
CONFIG_MTD=y
CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
CONFIG_DM_PMIC=y
CONFIG_PMIC_S2MPS11=y
CONFIG_DM_REGULATOR=y
diff --git a/configs/peach-pi_defconfig b/configs/peach-pi_defconfig
index 45162a5b16..92d6be43f8 100644
--- a/configs/peach-pi_defconfig
+++ b/configs/peach-pi_defconfig
@@ -53,7 +53,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
CONFIG_DM_PMIC=y
CONFIG_PMIC_TPS65090=y
CONFIG_DM_REGULATOR=y
diff --git a/configs/peach-pit_defconfig b/configs/peach-pit_defconfig
index 1354aa78ae..824a664904 100644
--- a/configs/peach-pit_defconfig
+++ b/configs/peach-pit_defconfig
@@ -52,7 +52,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
CONFIG_DM_PMIC=y
CONFIG_PMIC_TPS65090=y
CONFIG_DM_REGULATOR=y
diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index 6741cd0c52..77dd83cf6f 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -224,6 +224,8 @@ CONFIG_RSA_VERIFY_WITH_PKEY=y
CONFIG_TPM=y
CONFIG_LZ4=y
CONFIG_ERRNO_STR=y
+CONFIG_HEXDUMP=y
+CONFIG_SPL_HEXDUMP=y
CONFIG_UNIT_TEST=y
CONFIG_SPL_UNIT_TEST=y
CONFIG_UT_TIME=y
diff --git a/configs/smdk5250_defconfig b/configs/smdk5250_defconfig
index 0a7f1c515f..3ed1947fd6 100644
--- a/configs/smdk5250_defconfig
+++ b/configs/smdk5250_defconfig
@@ -48,7 +48,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
CONFIG_DM_PMIC=y
CONFIG_DM_PMIC_MAX77686=y
CONFIG_DM_REGULATOR=y
diff --git a/configs/smdk5420_defconfig b/configs/smdk5420_defconfig
index b3cb188f5f..7b739400a5 100644
--- a/configs/smdk5420_defconfig
+++ b/configs/smdk5420_defconfig
@@ -43,7 +43,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
CONFIG_DM_PMIC=y
CONFIG_DM_REGULATOR=y
CONFIG_EXYNOS_SPI=y
diff --git a/configs/smdkv310_defconfig b/configs/smdkv310_defconfig
index fcc655c1f5..ac84fde7d3 100644
--- a/configs/smdkv310_defconfig
+++ b/configs/smdkv310_defconfig
@@ -28,5 +28,4 @@ CONFIG_MMC_SDHCI_SDMA=y
CONFIG_MMC_SDHCI_S5P=y
CONFIG_MTD=y
CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
CONFIG_USB=y
diff --git a/configs/snow_defconfig b/configs/snow_defconfig
index d6b16802b1..a5fbd1d346 100644
--- a/configs/snow_defconfig
+++ b/configs/snow_defconfig
@@ -58,7 +58,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
CONFIG_DM_PMIC=y
CONFIG_DM_PMIC_MAX77686=y
CONFIG_PMIC_S5M8767=y
@@ -92,3 +91,5 @@ CONFIG_VIDEO_BRIDGE_NXP_PTN3460=y
CONFIG_LCD=y
CONFIG_TPM=y
CONFIG_ERRNO_STR=y
+CONFIG_UNIT_TEST=y
+# CONFIG_UT_LIB_ASN1 is not set
diff --git a/configs/spring_defconfig b/configs/spring_defconfig
index a6cc2b42bf..53c375e5b4 100644
--- a/configs/spring_defconfig
+++ b/configs/spring_defconfig
@@ -58,7 +58,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
CONFIG_DM_PMIC=y
CONFIG_DM_PMIC_MAX77686=y
CONFIG_PMIC_S5M8767=y
diff --git a/disk/part.c b/disk/part.c
index 086da84b7f..a6a8f7052b 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -396,7 +396,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
hwpart = 0;
}
- dev = simple_strtoul(dev_str, &ep, 16);
+ dev = hextoul(dev_str, &ep);
if (*ep) {
printf("** Bad device specification %s %s **\n",
ifname, dev_str);
@@ -405,7 +405,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
}
if (hwpart_str) {
- hwpart = simple_strtoul(hwpart_str, &ep, 16);
+ hwpart = hextoul(hwpart_str, &ep);
if (*ep) {
printf("** Bad HW partition specification %s %s **\n",
ifname, hwpart_str);
@@ -534,7 +534,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
part = PART_AUTO;
} else {
/* Something specified -> use exactly that */
- part = (int)simple_strtoul(part_str, &ep, 16);
+ part = (int)hextoul(part_str, &ep);
/*
* Less than whole string converted,
* or request for whole device, but caller requires partition.
diff --git a/disk/part_amiga.c b/disk/part_amiga.c
index 7eea60b564..ac7ada5478 100644
--- a/disk/part_amiga.c
+++ b/disk/part_amiga.c
@@ -135,7 +135,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
s = env_get("amiga_scanlimit");
if (s)
- limit = simple_strtoul(s, NULL, 10);
+ limit = dectoul(s, NULL);
else
limit = AMIGA_BLOCK_LIMIT;
@@ -175,7 +175,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
s = env_get("amiga_scanlimit");
if (s)
- limit = simple_strtoul(s, NULL, 10);
+ limit = dectoul(s, NULL);
else
limit = AMIGA_BLOCK_LIMIT;
diff --git a/doc/Makefile b/doc/Makefile
index 683e4b5609..050d9dd239 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -6,7 +6,7 @@ subdir-y :=
# You can set these variables from the command line.
SPHINXBUILD = sphinx-build
-SPHINXOPTS =
+SPHINXOPTS = -W
SPHINXDIRS = .
_SPHINXDIRS = $(patsubst $(srctree)/doc/%/conf.py,%,$(wildcard $(srctree)/doc/*/conf.py))
SPHINX_CONF = conf.py
diff --git a/doc/arch/x86.rst b/doc/arch/x86.rst
index 2ebfed871b..0fdd43be80 100644
--- a/doc/arch/x86.rst
+++ b/doc/arch/x86.rst
@@ -42,17 +42,8 @@ Build Instructions for U-Boot as BIOS replacement (bare mode)
-------------------------------------------------------------
Building a ROM version of U-Boot (hereafter referred to as u-boot.rom) is a
little bit tricky, as generally it requires several binary blobs which are not
-shipped in the U-Boot source tree. Due to this reason, the u-boot.rom build is
-not turned on by default in the U-Boot source tree. Firstly, you need turn it
-on by enabling the ROM build either via an environment variable::
-
- $ export BUILD_ROM=y
-
-or via configuration::
-
- CONFIG_BUILD_ROM=y
-
-Both tell the Makefile to build u-boot.rom as a target.
+shipped in the U-Boot source tree. Due to this reason, the u-boot.rom build may
+print some warnings if required binary blobs (e.g.: FSP) are not present.
CPU Microcode
-------------
diff --git a/doc/board/freescale/b4860qds.rst b/doc/board/freescale/b4860qds.rst
deleted file mode 100644
index de14d857b9..0000000000
--- a/doc/board/freescale/b4860qds.rst
+++ /dev/null
@@ -1,453 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0+
-
-B4860QDS
-========
-
-The B4860QDS is a Freescale reference board that hosts the B4860 SoC
-(and variants).
-
-B4860 Overview
---------------
-The B4860 QorIQ Qonverge device is a Freescale high-end, multicore SoC based on
-StarCore and Power Architecture® cores. It targets the broadband wireless
-infrastructure and builds upon the proven success of the existing multicore
-DSPs and Power CPUs. It is designed to bolster the rapidly changing and
-expanding wireless markets, such as 3GLTE (FDD and TDD), LTE-Advanced, and UMTS.
-
-The B4860 is a highly-integrated StarCore and Power Architecture processor that
-contains:
-
-* Six fully-programmable StarCore SC3900 FVP subsystems, divided into three
- clusters-each core runs up to 1.2 GHz, with an architecture highly optimized
- for wireless base station applications
-* Four dual-thread e6500 Power Architecture processors organized in one
- cluster-each core runs up to 1.8 GHz
-* Two DDR3/3L controllers for high-speed, industry-standard memory interface
- each runs at up to 1866.67 MHz
-* MAPLE-B3 hardware acceleration-for forward error correction schemes including
- Turbo or Viterbi decoding, Turbo encoding and rate matching, MIMO MMSE
- equalization scheme, matrix operations, CRC insertion and check, DFT/iDFT and
- FFT/iFFT calculations, PUSCH/PDSCH acceleration, and UMTS chip rate
- acceleration
-* CoreNet fabric that fully supports coherency using MESI protocol between the
- e6500 cores, SC3900 FVP cores, memories and external interfaces.
- CoreNet fabric interconnect runs at 667 MHz and supports coherent and
- non-coherent out of order transactions with prioritization and bandwidth
- allocation amongst CoreNet endpoints.
-* Data Path Acceleration Architecture, which includes the following:
-
- * Frame Manager (FMan), which supports in-line packet parsing and general
- classification to enable policing and QoS-based packet distribution
- * Queue Manager (QMan) and Buffer Manager (BMan), which allow offloading
- of queue management, task management, load distribution, flow ordering,
- buffer management, and allocation tasks from the cores
- * Security engine (SEC 5.3)-crypto-acceleration for protocols such as
- IPsec, SSL, and 802.16
- * RapidIO manager (RMAN) - Support SRIO types 8, 9, 10, and 11 (inbound
- and outbound). Supports types 5, 6 (outbound only)
-
-* Large internal cache memory with snooping and stashing capabilities for
- bandwidth saving and high utilization of processor elements. The 9856-Kbyte
- internal memory space includes the following:
-
- * 32 Kbyte L1 ICache per e6500/SC3900 core
- * 32 Kbyte L1 DCache per e6500/SC3900 core
- * 2048 Kbyte unified L2 cache for each SC3900 FVP cluster
- * 2048 Kbyte unified L2 cache for the e6500 cluster
- * Two 512 Kbyte shared L3 CoreNet platform caches (CPC)
-
-* Sixteen 10-GHz SerDes lanes serving:
-
- * Two Serial RapidIO interfaces
- * Each supports up to 4 lanes and a total of up to 8 lanes
-
-* Up to 8-lanes Common Public Radio Interface (CPRI) controller for
- glue-less antenna connection
-* Two 10-Gbit Ethernet controllers (10GEC)
-* Six 1G/2.5-Gbit Ethernet controllers for network communications
-* PCI Express controller
-* Debug (Aurora)
-* Two OCeaN DMAs
-* Various system peripherals
-* 182 32-bit timers
-
-B4860QDS Overview
------------------
-- DDRC1: Ten separate DDR3 parts of 16-bit to support 72-bit (ECC) at 1866MT/s,
- ECC, 4 GB of memory in two ranks of 2 GB.
-- DDRC2: Five separate DDR3 parts of 16-bit to support 72-bit (ECC) at 1866MT/s,
- ECC, 2 GB of memory. Single rank.
-- SerDes 1 multiplexing: Two Vitesse (transmit and receive path) cross-point
- 16x16 switch VSC3316
-- SerDes 2 multiplexing: Two Vitesse (transmit and receive path) cross-point
- 8x8 switch VSC3308
-- USB 2.0 ULPI PHY USB3315 by SMSC supports USB port in host mode.
- B4860 UART port is available over USB-to-UART translator USB2SER or over
- RS232 flat cable.
-- A Vitesse dual SGMII phy VSC8662 links the B4860 SGMII lines to 2xRJ-45
- copper connectors for Stand-alone mode and to the 1000Base-X over AMC
- MicroTCA connector ports 0 and 2 for AMC mode.
-- The B4860 configuration may be loaded from nine bits coded reset configuration
- reset source. The RCW source is set by appropriate DIP-switches.
-- 16-bit NOR Flash / PROMJet
-- QIXIS 8-bit NOR Flash Emulator
-- 8-bit NAND Flash
-- 24-bit SPI Flash
-- Long address I2C EEPROM
-- Available debug interfaces are:
-
- - On-board eCWTAP controller with ETH and USB I/F
- - JTAG/COP 16-pin header for any external TAP controller
- - External JTAG source over AMC to support B2B configuration
- - 70-pin Aurora debug connector
-
-- QIXIS (FPGA) logic:
- - 2 KB internal memory space including
-
-- IDT840NT4 clock synthesizer provides B4860 essential clocks : SYSCLK,
- DDRCLK1,2 and RTCCLK.
-- Two 8T49N222A SerDes ref clock devices support two SerDes port clock
- frequency - total four refclk, including CPRI clock scheme.
-
-
-B4420 Personality
------------------
-
-B4420 is a reduced personality of B4860 with less core/clusters(both SC3900
-and e6500), less DDR controllers, less serdes lanes, less SGMII interfaces
-and reduced target frequencies.
-
-Key differences between B4860 and B4420
----------------------------------------
-
-B4420 has:
-
-1. Less e6500 cores: 1 cluster with 2 e6500 cores
-2. Less SC3900 cores/clusters: 1 cluster with 2 SC3900 cores per cluster
-3. Single DDRC
-4. 2X 4 lane serdes
-5. 3 SGMII interfaces
-6. no sRIO
-7. no 10G
-
-B4860QDS Default Settings
--------------------------
-
-Switch Settings
-^^^^^^^^^^^^^^^
-
-.. code-block:: none
-
- SW1 OFF [0] OFF [0] OFF [0] OFF [0] OFF [0] OFF [0] OFF [0] OFF [0]
- SW2 ON ON ON ON ON ON OFF OFF
- SW3 OFF OFF OFF ON OFF OFF ON OFF
- SW5 OFF OFF OFF OFF OFF OFF ON ON
-
-Note:
-
-- PCIe slots modes: All the PCIe devices work as Root Complex.
-- Boot location: NOR flash.
-
-SysClk/Core(e6500)/CCB/DDR/FMan/DDRCLK/StarCore/CPRI-Maple/eTVPE-Maple/ULB-Maple
-66MHz/1.6GHz/667MHz/1.6GHz data rate/667MHz/133MHz/1200MHz/500MHz/800MHz/667MHz
-
-NAND boot::
-
- SW1 [1.1] = 0
- SW2 [1.1] = 1
- SW3 [1:4] = 0001
-
-NOR boot::
-
- SW1 [1.1] = 1
- SW2 [1.1] = 0
- SW3 [1:4] = 1000
-
-B4420QDS Default Settings
--------------------------
-
-Switch Settings
-^^^^^^^^^^^^^^^
-
-.. code-block:: none
-
- SW1 OFF[0] OFF [0] OFF [0] OFF [0] OFF [0] OFF [0] OFF [0] OFF [0]
- SW2 ON OFF ON OFF ON ON OFF OFF
- SW3 OFF OFF OFF ON OFF OFF ON OFF
- SW5 OFF OFF OFF OFF OFF OFF ON ON
-
-Note:
-
-- PCIe slots modes: All the PCIe devices work as Root Complex.
-- Boot location: NOR flash.
-
-SysClk/Core(e6500)/CCB/DDR/FMan/DDRCLK/StarCore/CPRI-Maple/eTVPE-Maple/ULB-Maple
-66MHz/1.6GHz/667MHz/1.6GHz data rate/667MHz/133MHz/1200MHz/500MHz/800MHz/667MHz
-
-NAND boot::
-
- SW1 [1.1] = 0
- SW2 [1.1] = 1
- SW3 [1:4] = 0001
-
-NOR boot::
-
- SW1 [1.1] = 1
- SW2 [1.1] = 0
- SW3 [1:4] = 1000
-
-Memory map on B4860QDS
-----------------------
-The addresses in brackets are physical addresses.
-
-============= ============= =============== =======
-Start Address End Address Description Size
-============= ============= =============== =======
-0xF_FFDF_1000 0xF_FFFF_FFFF Free 2 MB
-0xF_FFDF_0000 0xF_FFDF_0FFF IFC - FPGA 4 KB
-0xF_FF81_0000 0xF_FFDE_FFFF Free 5 MB
-0xF_FF80_0000 0xF_FF80_FFFF IFC NAND Flash 64 KB
-0xF_FF00_0000 0xF_FF7F_FFFF Free 8 MB
-0xF_FE00_0000 0xF_FEFF_FFFF CCSRBAR 16 MB
-0xF_F801_0000 0xF_FDFF_FFFF Free 95 MB
-0xF_F800_0000 0xF_F800_FFFF PCIe I/O Space 64 KB
-0xF_F600_0000 0xF_F7FF_FFFF QMAN s/w portal 32 MB
-0xF_F400_0000 0xF_F5FF_FFFF BMAN s/w portal 32 MB
-0xF_F000_0000 0xF_F3FF_FFFF Free 64 MB
-0xF_E800_0000 0xF_EFFF_FFFF IFC NOR Flash 128 MB
-0xF_E000_0000 0xF_E7FF_FFFF Promjet 128 MB
-0xF_A0C0_0000 0xF_DFFF_FFFF Free 1012 MB
-0xF_A000_0000 0xF_A0BF_FFFF MAPLE0/1/2 12 MB
-0xF_0040_0000 0xF_9FFF_FFFF Free 12 GB
-0xF_0000_0000 0xF_01FF_FFFF DCSR 32 MB
-0xC_4000_0000 0xE_FFFF_FFFF Free 11 GB
-0xC_3000_0000 0xC_3FFF_FFFF sRIO-2 I/O 256 MB
-0xC_2000_0000 0xC_2FFF_FFFF sRIO-1 I/O 256 MB
-0xC_0000_0000 0xC_1FFF_FFFF PCIe Mem Space 512 MB
-0x1_0000_0000 0xB_FFFF_FFFF Free 44 GB
-0x0_8000_0000 0x0_FFFF_FFFF DDRC1 2 GB
-0x0_0000_0000 0x0_7FFF_FFFF DDRC2 2 GB
-============= ============= =============== =======
-
-Memory map on B4420QDS
-----------------------
-The addresses in brackets are physical addresses.
-
-============= ============= =============== =======
-Start Address End Address Description Size
-============= ============= =============== =======
-0xF_FFDF_1000 0xF_FFFF_FFFF Free 2 MB
-0xF_FFDF_0000 0xF_FFDF_0FFF IFC - FPGA 4 KB
-0xF_FF81_0000 0xF_FFDE_FFFF Free 5 MB
-0xF_FF80_0000 0xF_FF80_FFFF IFC NAND Flash 64 KB
-0xF_FF00_0000 0xF_FF7F_FFFF Free 8 MB
-0xF_FE00_0000 0xF_FEFF_FFFF CCSRBAR 16 MB
-0xF_F801_0000 0xF_FDFF_FFFF Free 95 MB
-0xF_F800_0000 0xF_F800_FFFF PCIe I/O Space 64 KB
-0xF_F600_0000 0xF_F7FF_FFFF QMAN s/w portal 32 MB
-0xF_F400_0000 0xF_F5FF_FFFF BMAN s/w portal 32 MB
-0xF_F000_0000 0xF_F3FF_FFFF Free 64 MB
-0xF_E800_0000 0xF_EFFF_FFFF IFC NOR Flash 128 MB
-0xF_E000_0000 0xF_E7FF_FFFF Promjet 128 MB
-0xF_A0C0_0000 0xF_DFFF_FFFF Free 1012 MB
-0xF_A000_0000 0xF_A0BF_FFFF MAPLE0/1/2 12 MB
-0xF_0040_0000 0xF_9FFF_FFFF Free 12 GB
-0xF_0000_0000 0xF_01FF_FFFF DCSR 32 MB
-0xC_4000_0000 0xE_FFFF_FFFF Free 11 GB
-0xC_3000_0000 0xC_3FFF_FFFF sRIO-2 I/O 256 MB
-0xC_2000_0000 0xC_2FFF_FFFF sRIO-1 I/O 256 MB
-0xC_0000_0000 0xC_1FFF_FFFF PCIe Mem Space 512 MB
-0x1_0000_0000 0xB_FFFF_FFFF Free 44 GB
-0x0_0000_0000 0x0_FFFF_FFFF DDRC1 4 GB
-============= ============= =============== =======
-
-NOR Flash memory Map on B4860 and B4420QDS
-------------------------------------------
-
-============= ============= ============================== =========
- Start End Definition Size
-============= ============= ============================== =========
-0xEFF40000 0xEFFFFFFF U-Boot (current bank) 768KB
-0xEFF20000 0xEFF3FFFF U-Boot env (current bank) 128KB
-0xEFF00000 0xEFF1FFFF FMAN Ucode (current bank) 128KB
-0xEF300000 0xEFEFFFFF rootfs (alternate bank) 12MB
-0xEE800000 0xEE8FFFFF device tree (alternate bank) 1MB
-0xEE020000 0xEE6FFFFF Linux.uImage (alternate bank) 6MB+896KB
-0xEE000000 0xEE01FFFF RCW (alternate bank) 128KB
-0xEDF40000 0xEDFFFFFF U-Boot (alternate bank) 768KB
-0xEDF20000 0xEDF3FFFF U-Boot env (alternate bank) 128KB
-0xEDF00000 0xEDF1FFFF FMAN ucode (alternate bank) 128KB
-0xED300000 0xEDEFFFFF rootfs (current bank) 12MB
-0xEC800000 0xEC8FFFFF device tree (current bank) 1MB
-0xEC020000 0xEC6FFFFF Linux.uImage (current bank) 6MB+896KB
-0xEC000000 0xEC01FFFF RCW (current bank) 128KB
-============= ============= ============================== =========
-
-Various Software configurations/environment variables/commands
---------------------------------------------------------------
-The below commands apply to both B4860QDS and B4420QDS.
-
-U-Boot environment variable hwconfig
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The default hwconfig is:
-
-.. code-block:: none
-
- hwconfig=fsl_ddr:ctlr_intlv=null,bank_intlv=cs0_cs1;usb1:dr_mode=host,phy_type=ulpi
-
-Note: For USB gadget set "dr_mode=peripheral"
-
-FMAN Ucode versions
-^^^^^^^^^^^^^^^^^^^
-
-fsl_fman_ucode_B4860_106_3_6.bin
-
-Switching to alternate bank
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Commands for switching to alternate bank.
-
-1. To change from vbank0 to vbank2
-
-.. code-block:: none
-
- => qixis_reset altbank (it will boot using vbank2)
-
-2. To change from vbank2 to vbank0
-
-.. code-block:: none
-
- => qixis reset (it will boot using vbank0)
-
-To change personality of board
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-For changing personality from B4860 to B4420
-
-1. Boot from vbank0
-2. Flash vbank2 with b4420 rcw and U-Boot
-3. Give following commands to uboot prompt
-
-.. code-block:: none
-
- => mw.b ffdf0040 0x30;
- => mw.b ffdf0010 0x00;
- => mw.b ffdf0062 0x02;
- => mw.b ffdf0050 0x02;
- => mw.b ffdf0010 0x30;
- => reset
-
-Note:
-
-- Power off cycle will lead to default switch settings.
-- 0xffdf0000 is the address of the QIXIS FPGA.
-
-Switching between NOR and NAND boot(RCW src changed from NOR <-> NAND)
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-To change from NOR to NAND boot give following command on uboot prompt
-
-.. code-block:: none
-
- => mw.b ffdf0040 0x30
- => mw.b ffdf0010 0x00
- => mw.b 0xffdf0050 0x08
- => mw.b 0xffdf0060 0x82
- => mw.b ffdf0061 0x00
- => mw.b ffdf0010 0x30
- => reset
-
-To change from NAND to NOR boot give following command on uboot prompt:
-
-.. code-block:: none
-
- => mw.b ffdf0040 0x30
- => mw.b ffdf0010 0x00
- => mw.b 0xffdf0050 0x00(for vbank0) or (mw.b 0xffdf0050 0x02 for vbank2)
- => mw.b 0xffdf0060 0x12
- => mw.b ffdf0061 0x01
- => mw.b ffdf0010 0x30
- => reset
-
-Note:
-
-- Power off cycle will lead to default switch settings.
-- 0xffdf0000 is the address of the QIXIS FPGA.
-
-Ethernet interfaces for B4860QDS
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Serdes protocosl tested:
-* 0x2a, 0x8d (serdes1, serdes2) [DEFAULT]
-* 0x2a, 0xb2 (serdes1, serdes2)
-
-When using [DEFAULT] RCW, which including 2 * 1G SGMII on board and 2 * 1G
-SGMII on SGMII riser card.
-
-Under U-Boot these network interfaces are recognized as::
-
- FM1@DTSEC3, FM1@DTSEC4, FM1@DTSEC5 and FM1@DTSEC6.
-
-On Linux the interfaces are renamed as::
-
- eth2 -> fm1-gb2
- eth3 -> fm1-gb3
- eth4 -> fm1-gb4
- eth5 -> fm1-gb5
-
-RCW and Ethernet interfaces for B4420QDS
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Serdes protocosl tested:
-* 0x18, 0x9e (serdes1, serdes2)
-
-Under U-Boot these network interfaces are recognized as::
-
- FM1@DTSEC3, FM1@DTSEC4 and e1000#0.
-
-On Linux the interfaces are renamed as::
-
- eth2 -> fm1-gb2
- eth3 -> fm1-gb3
-
-NAND boot with 2 Stage boot loader
-----------------------------------
-PBL initialise the internal SRAM and copy SPL(160KB) in SRAM.
-SPL further initialise DDR using SPD and environment variables and copy
-U-Boot(768 KB) from flash to DDR.
-Finally SPL transer control to U-Boot for futher booting.
-
-SPL has following features:
- - Executes within 256K
- - No relocation required
-
-Run time view of SPL framework during boot:
-
-+----------------------------------------------+
-|Area | Address |
-+----------------------------------------------+
-|Secure boot | 0xFFFC0000 (32KB) |
-|headers | |
-+----------------------------------------------+
-|GD, BD | 0xFFFC8000 (4KB) |
-+----------------------------------------------+
-|ENV | 0xFFFC9000 (8KB) |
-+----------------------------------------------+
-|HEAP | 0xFFFCB000 (30KB) |
-+----------------------------------------------+
-|STACK | 0xFFFD8000 (22KB) |
-+----------------------------------------------+
-|U-Boot SPL | 0xFFFD8000 (160KB) |
-+----------------------------------------------+
-
-NAND Flash memory Map on B4860 and B4420QDS
--------------------------------------------
-
-============= ============= ============================= =====
-Start End Definition Size
-============= ============= ============================= =====
-0x000000 0x0FFFFF U-Boot 1MB
-0x140000 0x15FFFF U-Boot env 128KB
-0x1A0000 0x1BFFFF FMAN Ucode 128KB
-============= ============= ============================= =====
diff --git a/doc/board/freescale/index.rst b/doc/board/freescale/index.rst
index 313cf409a6..bddc6c6c2c 100644
--- a/doc/board/freescale/index.rst
+++ b/doc/board/freescale/index.rst
@@ -6,7 +6,6 @@ Freescale
.. toctree::
:maxdepth: 2
- b4860qds
imx8mm_evk
imx8mn_evk
imx8mp_evk
diff --git a/doc/board/sifive/unleashed.rst b/doc/board/sifive/unleashed.rst
index 4e4c852ff3..c8a62068a7 100644
--- a/doc/board/sifive/unleashed.rst
+++ b/doc/board/sifive/unleashed.rst
@@ -456,21 +456,21 @@ device tree blob (hifive-unleashed-a00.dtb)
Format the SD card (make sure the disk has GPT, otherwise use gdisk to switch)
-.. code-block:: none
+.. code-block:: bash
- # sudo sgdisk --clear \
- > --set-alignment=2 \
- > --new=1:34:2081 --change-name=1:loader1 --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \
- > --new=2:2082:10273 --change-name=2:loader2 --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \
- > --new=3:10274: --change-name=3:rootfs --typecode=3:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \
- > /dev/sda
+ sudo sgdisk --clear \
+ --set-alignment=2 \
+ --new=1:34:2081 --change-name=1:loader1 --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \
+ --new=2:2082:10273 --change-name=2:loader2 --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \
+ --new=3:10274: --change-name=3:rootfs --typecode=3:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \
+ /dev/sdX
Program the SD card
-.. code-block:: none
+.. code-block:: bash
- sudo dd if=spl/u-boot-spl.bin of=/dev/sda seek=34
- sudo dd if=u-boot.itb of=/dev/sda seek=2082
+ sudo dd if=spl/u-boot-spl.bin of=/dev/sdX seek=34
+ sudo dd if=u-boot.itb of=/dev/sdX seek=2082
Booting
~~~~~~~
diff --git a/doc/board/sifive/unmatched.rst b/doc/board/sifive/unmatched.rst
index e65b0d3206..6b024f07f6 100644
--- a/doc/board/sifive/unmatched.rst
+++ b/doc/board/sifive/unmatched.rst
@@ -61,31 +61,31 @@ device tree blob (hifive-unmatched-a00.dtb)
Format the SD card (make sure the disk has GPT, otherwise use gdisk to switch)
-.. code-block:: none
+.. code-block:: bash
- # sudo sgdisk -g --clear -a 1 \
- > --new=1:34:2081 --change-name=1:spl --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \
- > --new=2:2082:10273 --change-name=2:uboot --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \
- > --new=3:16384:282623 --change-name=3:boot --typecode=3:0x0700 \
- > --new=4:286720:13918207 --change-name=4:root --typecode=4:0x8300 \
- > /dev/sdb
+ sudo sgdisk -g --clear -a 1 \
+ --new=1:34:2081 --change-name=1:spl --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \
+ --new=2:2082:10273 --change-name=2:uboot --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \
+ --new=3:16384:282623 --change-name=3:boot --typecode=3:0x0700 \
+ --new=4:286720:13918207 --change-name=4:root --typecode=4:0x8300 \
+ /dev/sdX
Copy linux Image.gz and hifive-unmatched-a00.dtb to boot partition
-.. code-block:: none
+.. code-block:: bash
- sudo mkfs.vfat /dev/sdb3
- sudo mkfs.ext4 /dev/sdb4
+ sudo mkfs.vfat /dev/sdX3
+ sudo mkfs.ext4 /dev/sdX4
- sudo mount /dev/sdb3 /media/sdb3
- sudo cp Image.gz hifive-unmatched-a00.dtb /media/sdb3/
+ sudo mount /dev/sdX3 /media/sdX3
+ sudo cp Image.gz hifive-unmatched-a00.dtb /media/sdX3/
Program the SD card
-.. code-block:: none
+.. code-block:: bash
- sudo dd if=spl/u-boot-spl.bin of=/dev/sda seek=34
- sudo dd if=u-boot.itb of=/dev/sda seek=2082
+ sudo dd if=spl/u-boot-spl.bin of=/dev/sdX seek=34
+ sudo dd if=u-boot.itb of=/dev/sdX seek=2082
Booting
-------
diff --git a/doc/board/ti/index.rst b/doc/board/ti/index.rst
new file mode 100644
index 0000000000..c0da04b109
--- /dev/null
+++ b/doc/board/ti/index.rst
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Texas Instruments
+=================
+
+.. toctree::
+ :maxdepth: 2
+
+ j721e_evm
diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst
index 8ffb4e3447..e03e0b9460 100644
--- a/doc/build/gcc.rst
+++ b/doc/build/gcc.rst
@@ -24,9 +24,9 @@ Depending on the build targets further packages maybe needed
.. code-block:: bash
sudo apt-get install bc bison build-essential coccinelle \
- device-tree-compiler dfu-util efitools flex gdisk liblz4-tool \
- libguestfs-tools libncurses-dev libpython3-dev libsdl2-dev libssl-dev \
- lz4 lzma lzma-alone openssl python3 python3-coverage \
+ device-tree-compiler dfu-util efitools flex gdisk graphviz imagemagick \
+ liblz4-tool libguestfs-tools libncurses-dev libpython3-dev libsdl2-dev \
+ libssl-dev lz4 lzma lzma-alone openssl python3 python3-coverage \
python3-pycryptodome python3-pyelftools python3-pytest \
python3-sphinxcontrib.apidoc python3-sphinx-rtd-theme python3-virtualenv \
swig
diff --git a/doc/develop/ci_testing.rst b/doc/develop/ci_testing.rst
new file mode 100644
index 0000000000..b9a9a516c1
--- /dev/null
+++ b/doc/develop/ci_testing.rst
@@ -0,0 +1,70 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Continuous Integration testing
+==============================
+
+All changes require passing our continuous integration tests prior to being
+merged in to mainline. To help facilitate merges being accepted quickly,
+custodians are encouraged but not required to run a pipeline prior to sending a
+pull request. Individual developers submitting significant or widespread
+changes are encouraged to run a pipeline themselves prior to posting.
+
+In order to make this process as easy as possible, the ability to run a CI
+pipeline is provided in both Azure and GitLab. Both of these pipelines perform
+their Linux build jobs on the same Docker container image and to cover the same
+platforms. In addition, Azure is also used to confirm that our host tools can
+be built with mingw to run on Windows.
+
+Each of the pipelines is written in such as way as to be a "world build" style
+test and as such we try and build all possible platforms. In addition, for all
+platforms that support being run in QEMU we run them in QEMU and use our pytest
+suite. See :doc:`py_testing` for more information about those tests.
+
+Azure Pipelines
+---------------
+
+This pipeline is defined in the top-level ``.azure-pipelines.yml`` file.
+Currently there are two ways to run a Microsoft Azure Pipeline test for U-Boot.
+
+The first way is to create an account with Microsoft at
+https://azure.microsoft.com/en-us/services/devops/ and then use the
+``.azure-pipelines.yml`` file in the U-Boot repository as the pipeline
+description.
+
+The second way is to use GitHub. This requires a GitHub account
+and to fork the repository at https://github.com/u-boot/u-boot and to then
+submit a pull request as this will trigger an Azure pipeline run. Clicking on
+your pull request on the list at https://github.com/u-boot/u-boot/pulls and
+then the "Checks" tab will show the results.
+
+GitLab CI Pipelines
+-------------------
+
+This pipeline is defined in the top-level ``.gitlab-ci.yml`` file. Currently,
+we support running GitLab CI pipelines only for custodians, due to the
+resources the project has available. For Custodians, it is a matter of
+enabling the pipeline feature in your project repository following the standard
+GitLab documentation. For non-custodians, the pipeline itself is part of the
+tree and should be able to be used on any GitLab instance, with whatever
+runners you are able to provide. While it is intended to be able to run this
+pipeline on the free public instances provided at https://gitlab.com/ a problem
+with our squashfs tests currently prevents this.
+
+Docker container
+----------------
+
+As previously stated, both of the above pipelines build using the same Docker
+container image. This is maintained in the U-Boot source tree at
+``tools/docker/Dockerfile`` and new images are made as needed to support new
+tests or features. This file needs to be updated whenever adding new external
+tool requirements to tests.
+
+Customizing CI
+--------------
+
+As noted above, the CI pipelines perform a world build. While this is good for
+overall project testing, it can be less useful for testing specific cases or
+developing features. In that case, it can be useful as part of your own
+testing cycle to edit these pipelines in separate local commits to pair them
+down to just the jobs you're interested in. These changes must be removed
+prior to submission.
diff --git a/doc/develop/driver-model/migration.rst b/doc/develop/driver-model/migration.rst
index 8d0bb7635b..8bb8601c58 100644
--- a/doc/develop/driver-model/migration.rst
+++ b/doc/develop/driver-model/migration.rst
@@ -75,15 +75,6 @@ Partially converted::
* Status: In progress
* Deadline: 2019.07
-CONFIG_DM_PCI
--------------
-Deadline: 2019.07
-
-The PCI subsystem has supported driver model since mid 2015. Maintainers should
-submit patches switching over to using CONFIG_DM_PCI and other base driver
-model options in time for inclusion in the 2019.07 release.
-
-
CONFIG_DM_VIDEO
---------------
Deadline: 2019.07
diff --git a/doc/develop/index.rst b/doc/develop/index.rst
index 54e14dd77b..1203409db7 100644
--- a/doc/develop/index.rst
+++ b/doc/develop/index.rst
@@ -9,6 +9,7 @@ Implementation
.. toctree::
:maxdepth: 1
+ ci_testing
commands
driver-model/index
global_data
@@ -41,8 +42,16 @@ Testing
.. toctree::
:maxdepth: 1
- coccinelle
testing
py_testing
tests_writing
tests_sandbox
+
+Refactoring
+-----------
+
+.. toctree::
+ :maxdepth: 1
+
+ coccinelle
+ moveconfig
diff --git a/doc/develop/moveconfig.rst b/doc/develop/moveconfig.rst
new file mode 100644
index 0000000000..dcd4d927e4
--- /dev/null
+++ b/doc/develop/moveconfig.rst
@@ -0,0 +1,282 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+moveconfig
+==========
+
+Since Kconfig was introduced to U-Boot, we have worked on moving
+config options from headers to Kconfig (defconfig).
+
+This tool intends to help this tremendous work.
+
+Installing
+----------
+
+You may need to install 'python3-asteval' for the 'asteval' module.
+
+Usage
+-----
+
+First, you must edit the Kconfig to add the menu entries for the configs
+you are moving.
+
+Then run this tool giving CONFIG names you want to move.
+For example, if you want to move CONFIG_CMD_USB and CONFIG_SYS_TEXT_BASE,
+simply type as follows::
+
+ $ tools/moveconfig.py CONFIG_CMD_USB CONFIG_SYS_TEXT_BASE
+
+The tool walks through all the defconfig files and move the given CONFIGs.
+
+The log is also displayed on the terminal.
+
+The log is printed for each defconfig as follows::
+
+ <defconfig_name>
+ <action1>
+ <action2>
+ <action3>
+ ...
+
+`<defconfig_name>` is the name of the defconfig.
+
+`<action*>` shows what the tool did for that defconfig.
+It looks like one of the following:
+
+ - Move 'CONFIG\_... '
+ This config option was moved to the defconfig
+
+ - CONFIG\_... is not defined in Kconfig. Do nothing.
+ The entry for this CONFIG was not found in Kconfig. The option is not
+ defined in the config header, either. So, this case can be just skipped.
+
+ - CONFIG\_... is not defined in Kconfig (suspicious). Do nothing.
+ This option is defined in the config header, but its entry was not found
+ in Kconfig.
+ There are two common cases:
+
+ - You forgot to create an entry for the CONFIG before running
+ this tool, or made a typo in a CONFIG passed to this tool.
+ - The entry was hidden due to unmet 'depends on'.
+
+ The tool does not know if the result is reasonable, so please check it
+ manually.
+
+ - 'CONFIG\_...' is the same as the define in Kconfig. Do nothing.
+ The define in the config header matched the one in Kconfig.
+ We do not need to touch it.
+
+ - Compiler is missing. Do nothing.
+ The compiler specified for this architecture was not found
+ in your PATH environment.
+ (If -e option is passed, the tool exits immediately.)
+
+ - Failed to process.
+ An error occurred during processing this defconfig. Skipped.
+ (If -e option is passed, the tool exits immediately on error.)
+
+Finally, you will be asked, Clean up headers? [y/n]:
+
+If you say 'y' here, the unnecessary config defines are removed
+from the config headers (include/configs/\*.h).
+It just uses the regex method, so you should not rely on it.
+Just in case, please do 'git diff' to see what happened.
+
+
+How does it work?
+-----------------
+
+This tool runs configuration and builds include/autoconf.mk for every
+defconfig. The config options defined in Kconfig appear in the .config
+file (unless they are hidden because of unmet dependency.)
+On the other hand, the config options defined by board headers are seen
+in include/autoconf.mk. The tool looks for the specified options in both
+of them to decide the appropriate action for the options. If the given
+config option is found in the .config, but its value does not match the
+one from the board header, the config option in the .config is replaced
+with the define in the board header. Then, the .config is synced by
+"make savedefconfig" and the defconfig is updated with it.
+
+For faster processing, this tool handles multi-threading. It creates
+separate build directories where the out-of-tree build is run. The
+temporary build directories are automatically created and deleted as
+needed. The number of threads are chosen based on the number of the CPU
+cores of your system although you can change it via -j (--jobs) option.
+
+
+Toolchains
+----------
+
+Appropriate toolchain are necessary to generate include/autoconf.mk
+for all the architectures supported by U-Boot. Most of them are available
+at the kernel.org site, some are not provided by kernel.org. This tool uses
+the same tools as buildman, so see that tool for setup (e.g. --fetch-arch).
+
+
+Tips and trips
+--------------
+
+To sync only X86 defconfigs::
+
+ ./tools/moveconfig.py -s -d <(grep -l X86 configs/*)
+
+or::
+
+ grep -l X86 configs/* | ./tools/moveconfig.py -s -d -
+
+To process CONFIG_CMD_FPGAD only for a subset of configs based on path match::
+
+ ls configs/{hrcon*,iocon*,strider*} | \
+ ./tools/moveconfig.py -Cy CONFIG_CMD_FPGAD -d -
+
+
+Finding implied CONFIGs
+-----------------------
+
+Some CONFIG options can be implied by others and this can help to reduce
+the size of the defconfig files. For example, CONFIG_X86 implies
+CONFIG_CMD_IRQ, so we can put 'imply CMD_IRQ' under 'config X86' and
+all x86 boards will have that option, avoiding adding CONFIG_CMD_IRQ to
+each of the x86 defconfig files.
+
+This tool can help find such configs. To use it, first build a database::
+
+ ./tools/moveconfig.py -b
+
+Then try to query it::
+
+ ./tools/moveconfig.py -i CONFIG_I8042_KEYB
+ CONFIG_I8042_KEYB found in 33/5155 defconfigs
+ 28 : CONFIG_X86
+ 28 : CONFIG_SA_PCIEX_LENGTH
+ 28 : CONFIG_HPET_ADDRESS
+ 28 : CONFIG_MAX_PIRQ_LINKS
+ 28 : CONFIG_I8254_TIMER
+ 28 : CONFIG_I8259_PIC
+ 28 : CONFIG_RAMBASE
+ 28 : CONFIG_IRQ_SLOT_COUNT
+ 28 : CONFIG_PCIE_ECAM_SIZE
+ 28 : CONFIG_APIC
+ ...
+
+This shows a list of config options which might imply CONFIG_I8042_KEYB along
+with how many defconfigs they cover. From this you can see that CONFIG_X86
+generally implies CONFIG_I8042_KEYB but not always (28 out of 35). Therefore,
+instead of adding CONFIG_I8042_KEYB to
+the defconfig of every x86 board, you could add a single imply line to the
+Kconfig file::
+
+ config X86
+ bool "x86 architecture"
+ ...
+ imply CMD_EEPROM
+
+That will cover 28 defconfigs and you can perhaps find another condition that
+indicates that CONFIG_I8042_KEYB is not needed for the remaining 5 boards. Many
+of the options listed are not suitable as they are not related. E.g. it would be
+odd for CONFIG_RAMBASE to imply CONFIG_I8042_KEYB.
+
+Using this search you can reduce the size of moveconfig patches.
+
+You can automatically add 'imply' statements in the Kconfig with the -a
+option::
+
+ ./tools/moveconfig.py -s -i CONFIG_SCSI \
+ -a CONFIG_ARCH_LS1021A,CONFIG_ARCH_LS1043A
+
+This will add 'imply SCSI' to the two CONFIG options mentioned, assuming that
+the database indicates that they do actually imply CONFIG_SCSI and do not
+already have an 'imply SCSI'.
+
+The output shows where the imply is added::
+
+ 18 : CONFIG_ARCH_LS1021A arch/arm/cpu/armv7/ls102xa/Kconfig:1
+ 13 : CONFIG_ARCH_LS1043A arch/arm/cpu/armv8/fsl-layerscape/Kconfig:11
+ 12 : CONFIG_ARCH_LS1046A arch/arm/cpu/armv8/fsl-layerscape/Kconfig:31
+
+The first number is the number of boards which can avoid having a special
+CONFIG_SCSI option in their defconfig file if this 'imply' is added.
+The location at the right is the Kconfig file and line number where the config
+appears. For example, adding 'imply CONFIG_SCSI' to the 'config ARCH_LS1021A'
+in arch/arm/cpu/armv7/ls102xa/Kconfig at line 1 will help 18 boards to reduce
+the size of their defconfig files.
+
+If you want to add an 'imply' to every imply config in the list, you can use::
+
+ ./tools/moveconfig.py -s -i CONFIG_SCSI -a all
+
+To control which ones are displayed, use -I <list> where list is a list of
+options (use '-I help' to see possible options and their meaning).
+
+To skip showing you options that already have an 'imply' attached, use -A.
+
+When you have finished adding 'imply' options you can regenerate the
+defconfig files for affected boards with something like::
+
+ git show --stat | ./tools/moveconfig.py -s -d -
+
+This will regenerate only those defconfigs changed in the current commit.
+If you start with (say) 100 defconfigs being changed in the commit, and add
+a few 'imply' options as above, then regenerate, hopefully you can reduce the
+number of defconfigs changed in the commit.
+
+
+Available options
+-----------------
+
+ -c, --color
+ Surround each portion of the log with escape sequences to display it
+ in color on the terminal.
+
+ -C, --commit
+ Create a git commit with the changes when the operation is complete. A
+ standard commit message is used which may need to be edited.
+
+ -d, --defconfigs
+ Specify a file containing a list of defconfigs to move. The defconfig
+ files can be given with shell-style wildcards. Use '-' to read from stdin.
+
+ -n, --dry-run
+ Perform a trial run that does not make any changes. It is useful to
+ see what is going to happen before one actually runs it.
+
+ -e, --exit-on-error
+ Exit immediately if Make exits with a non-zero status while processing
+ a defconfig file.
+
+ -s, --force-sync
+ Do "make savedefconfig" forcibly for all the defconfig files.
+ If not specified, "make savedefconfig" only occurs for cases
+ where at least one CONFIG was moved.
+
+ -S, --spl
+ Look for moved config options in spl/include/autoconf.mk instead of
+ include/autoconf.mk. This is useful for moving options for SPL build
+ because SPL related options (mostly prefixed with CONFIG_SPL\_) are
+ sometimes blocked by CONFIG_SPL_BUILD ifdef conditionals.
+
+ -H, --headers-only
+ Only cleanup the headers; skip the defconfig processing
+
+ -j, --jobs
+ Specify the number of threads to run simultaneously. If not specified,
+ the number of threads is the same as the number of CPU cores.
+
+ -r, --git-ref
+ Specify the git ref to clone for building the autoconf.mk. If unspecified
+ use the CWD. This is useful for when changes to the Kconfig affect the
+ default values and you want to capture the state of the defconfig from
+ before that change was in effect. If in doubt, specify a ref pre-Kconfig
+ changes (use HEAD if Kconfig changes are not committed). Worst case it will
+ take a bit longer to run, but will always do the right thing.
+
+ -v, --verbose
+ Show any build errors as boards are built
+
+ -y, --yes
+ Instead of prompting, automatically go ahead with all operations. This
+ includes cleaning up headers, CONFIG_SYS_EXTRA_OPTIONS, the config whitelist
+ and the README.
+
+To see the complete list of supported options, run::
+
+ tools/moveconfig.py -h
diff --git a/doc/develop/testing.rst b/doc/develop/testing.rst
index ced13ac8bb..1abe4d7f0f 100644
--- a/doc/develop/testing.rst
+++ b/doc/develop/testing.rst
@@ -1,5 +1,7 @@
-Testing in U-Boot
-=================
+.. SPDX-License-Identifier: GPL-2.0+
+
+Introduction to testing
+=======================
U-Boot has a large amount of code. This file describes how this code is
tested and what tests you should write when adding a new feature.
diff --git a/doc/usage/cmdline.rst b/doc/usage/cmdline.rst
new file mode 100644
index 0000000000..88f18c974c
--- /dev/null
+++ b/doc/usage/cmdline.rst
@@ -0,0 +1,93 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Command-line Parsing
+====================
+
+The command line is available in U-Boot proper, enabled by CONFIG_CMDLINE which
+is on by default. It is not enabled in SPL.
+
+There are two different command-line parsers available with U-Boot:
+the old "simple" one, and the much more powerful "hush" shell:
+
+Simple command-line parser
+--------------------------
+
+This takes very little code space and offers only basic features:
+
+- supports environment variables (through setenv / saveenv commands)
+- several commands on one line, separated by ';'
+- variable substitution using "... ${name} ..." syntax
+- special characters ('$', ';') can be escaped by prefixing with '\',
+ for example::
+
+ setenv bootcmd bootm \${address}
+
+- You can also escape text by enclosing in single apostrophes, for example::
+
+ setenv addip 'setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname::off'
+
+Hush shell
+----------
+
+This is similar to Bourne shell, with control structures like:
+
+- `if`... `then` ... `else`... `fi`
+- `for`... `do` ... `done`
+- `while` ... `do` ... `done`
+- `until` ... `do` ... `done`
+
+Hush supports environment ("global") variables (through setenv / saveenv
+commands) and local shell variables (through standard shell syntax
+`name=value`); only environment variables can be used with the "run" command
+
+The Hush shell is enabled with `CONFIG_HUSH_PARSER`.
+
+General rules
+-------------
+
+#. If a command line (or an environment variable executed by a "run"
+ command) contains several commands separated by semicolon, and
+ one of these commands fails, then the remaining commands will be
+ executed anyway.
+
+#. If you execute several variables with one call to run (i. e.
+ calling run with a list of variables as arguments), any failing
+ command will cause "run" to terminate, i. e. the remaining
+ variables are not executed.
+
+Representing numbers
+--------------------
+
+Most U-Boot commands use hexadecimal (hex) as the default base, for convenient
+use of addresses, for example::
+
+ => md 1000 6
+ 00001000: 2c786f62 00697073 03000000 0c000000 box,spi.........
+ 00001010: 67020000 00000000 ...g....
+
+There is no need to add a `0x` prefix to the arguments and the output is shown
+in hex also, without any prefixes. This helps to avoid clutter.
+
+Some commands use decimal where it is more natural::
+
+ => i2c dev 0
+ Setting bus to 0
+ => i2c speed
+ Current bus speed=400000
+ => i2c speed 100000
+ Setting bus speed to 100000 Hz
+
+In some cases the default is decimal but it is possible to use octal if that is
+useful::
+
+ pmic dev pmic@41
+ dev: 1 @ pmic@41
+ => pmic write 2 0177
+ => pmic read 2
+ 0x02: 0x00007f
+
+It is possible to use a `0x` prefix to use a hex value if that is more
+convenient::
+
+ => i2c speed 0x30000
+ Setting bus speed to 196608 Hz
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index 719b2c90b9..356f2a5618 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -9,6 +9,7 @@ Use U-Boot
fit
netconsole
partitions
+ cmdline
Shell commands
--------------
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 7e4e97d803..dda712f42c 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -27,11 +27,7 @@
#include "sata_sil.h"
-#ifdef CONFIG_DM_PCI
#define virt_to_bus(devno, v) dm_pci_virt_to_mem(devno, (void *) (v))
-#else
-#define virt_to_bus(devno, v) pci_virt_to_mem(devno, (void *) (v))
-#endif
/* just compatible ahci_ops */
struct sil_ops {
@@ -616,11 +612,7 @@ static int sil_init_sata(struct udevice *uc_dev, int dev)
#else
priv->sil_sata_desc[dev] = sata;
priv->port_num = dev;
-#ifdef CONFIG_DM_PCI
sata->devno = uc_dev->parent;
-#else
- sata->devno = sata_info.devno;
-#endif /* CONFIG_DM_PCI */
#endif
sata->id = dev;
sata->port = port;
diff --git a/drivers/ata/sata_sil.h b/drivers/ata/sata_sil.h
index a300c0c388..bea4322c91 100644
--- a/drivers/ata/sata_sil.h
+++ b/drivers/ata/sata_sil.h
@@ -21,11 +21,7 @@ struct sil_sata {
u16 pio;
u16 mwdma;
u16 udma;
-#ifdef CONFIG_DM_PCI
struct udevice *devno;
-#else
- pci_dev_t devno;
-#endif
int wcache;
int flush;
int flush_ext;
diff --git a/drivers/bios_emulator/atibios.c b/drivers/bios_emulator/atibios.c
index 6c7cc24cbd..9547470a2f 100644
--- a/drivers/bios_emulator/atibios.c
+++ b/drivers/bios_emulator/atibios.c
@@ -230,19 +230,12 @@ This function executes the BIOS POST code on the controller. We assume that
at this stage the controller has its I/O and memory space enabled and
that all other controllers are in a disabled state.
****************************************************************************/
-#ifdef CONFIG_DM_PCI
static void PCI_doBIOSPOST(struct udevice *pcidev, BE_VGAInfo *vga_info,
int vesa_mode, struct vbe_mode_info *mode_info)
-#else
-static void PCI_doBIOSPOST(pci_dev_t pcidev, BE_VGAInfo *vga_info,
- int vesa_mode, struct vbe_mode_info *mode_info)
-#endif
{
RMREGS regs;
RMSREGS sregs;
-#ifdef CONFIG_DM_PCI
pci_dev_t bdf;
-#endif
/* Determine the value to store in AX for BIOS POST. Per the PCI specs,
AH must contain the bus and AL must contain the devfn, encoded as
@@ -250,14 +243,9 @@ static void PCI_doBIOSPOST(pci_dev_t pcidev, BE_VGAInfo *vga_info,
*/
memset(&regs, 0, sizeof(regs));
memset(&sregs, 0, sizeof(sregs));
-#ifdef CONFIG_DM_PCI
bdf = dm_pci_get_bdf(pcidev);
regs.x.ax = (int)PCI_BUS(bdf) << 8 |
(int)PCI_DEV(bdf) << 3 | (int)PCI_FUNC(bdf);
-#else
- regs.x.ax = ((int)PCI_BUS(pcidev) << 8) |
- ((int)PCI_DEV(pcidev) << 3) | (int)PCI_FUNC(pcidev);
-#endif
/*Setup the X86 emulator for the VGA BIOS*/
BE_setVGA(vga_info);
@@ -300,28 +288,15 @@ NOTE: This function leaves the original memory aperture disabled by leaving
it programmed to all 1's. It must be restored to the correct value
later.
****************************************************************************/
-#ifdef CONFIG_DM_PCI
static u32 PCI_findBIOSAddr(struct udevice *pcidev, int *bar)
-#else
-static u32 PCI_findBIOSAddr(pci_dev_t pcidev, int *bar)
-#endif
{
u32 base, size;
for (*bar = 0x10; *bar <= 0x14; (*bar) += 4) {
-#ifdef CONFIG_DM_PCI
dm_pci_read_config32(pcidev, *bar, &base);
-#else
- pci_read_config_dword(pcidev, *bar, &base);
-#endif
if (!(base & 0x1)) {
-#ifdef CONFIG_DM_PCI
dm_pci_write_config32(pcidev, *bar, 0xFFFFFFFF);
dm_pci_read_config32(pcidev, *bar, &size);
-#else
- pci_write_config_dword(pcidev, *bar, 0xFFFFFFFF);
- pci_read_config_dword(pcidev, *bar, &size);
-#endif
size = ~(size & ~0xFF) + 1;
if (size >= MAX_BIOSLEN)
return base & ~0xFF;
@@ -344,19 +319,11 @@ necessary).
Anyway to fix this we change all I/O mapped base registers and
chop off the top bits.
****************************************************************************/
-#ifdef CONFIG_DM_PCI
static void PCI_fixupIObase(struct udevice *pcidev, int reg, u32 *base)
-#else
-static void PCI_fixupIObase(pci_dev_t pcidev, int reg, u32 * base)
-#endif
{
if ((*base & 0x1) && (*base > 0xFFFE)) {
*base &= 0xFFFF;
-#ifdef CONFIG_DM_PCI
dm_pci_write_config32(pcidev, reg, *base);
-#else
- pci_write_config_dword(pcidev, reg, *base);
-#endif
}
}
@@ -371,30 +338,18 @@ Pointers to the mapped BIOS image
REMARKS:
Maps a pointer to the BIOS image on the graphics card on the PCI bus.
****************************************************************************/
-#ifdef CONFIG_DM_PCI
void *PCI_mapBIOSImage(struct udevice *pcidev)
-#else
-void *PCI_mapBIOSImage(pci_dev_t pcidev)
-#endif
{
u32 BIOSImageBus;
int BIOSImageBAR;
u8 *BIOSImage;
/*Save PCI BAR registers that might get changed*/
-#ifdef CONFIG_DM_PCI
dm_pci_read_config32(pcidev, PCI_ROM_ADDRESS, &saveROMBaseAddress);
dm_pci_read_config32(pcidev, PCI_BASE_ADDRESS_0, &saveBaseAddress10);
dm_pci_read_config32(pcidev, PCI_BASE_ADDRESS_1, &saveBaseAddress14);
dm_pci_read_config32(pcidev, PCI_BASE_ADDRESS_2, &saveBaseAddress18);
dm_pci_read_config32(pcidev, PCI_BASE_ADDRESS_4, &saveBaseAddress20);
-#else
- pci_read_config_dword(pcidev, PCI_ROM_ADDRESS, &saveROMBaseAddress);
- pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_0, &saveBaseAddress10);
- pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_1, &saveBaseAddress14);
- pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_2, &saveBaseAddress18);
- pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_4, &saveBaseAddress20);
-#endif
/*Fix up I/O base registers to less than 64K */
if(saveBaseAddress14 != 0)
@@ -413,21 +368,12 @@ void *PCI_mapBIOSImage(pci_dev_t pcidev)
return NULL;
}
-#ifdef CONFIG_DM_PCI
BIOSImage = dm_pci_bus_to_virt(pcidev, BIOSImageBus,
PCI_REGION_MEM, 0, MAP_NOCACHE);
/*Change the PCI BAR registers to map it onto the bus.*/
dm_pci_write_config32(pcidev, BIOSImageBAR, 0);
dm_pci_write_config32(pcidev, PCI_ROM_ADDRESS, BIOSImageBus | 0x1);
-#else
- BIOSImage = pci_bus_to_virt(pcidev, BIOSImageBus,
- PCI_REGION_MEM, 0, MAP_NOCACHE);
-
- /*Change the PCI BAR registers to map it onto the bus.*/
- pci_write_config_dword(pcidev, BIOSImageBAR, 0);
- pci_write_config_dword(pcidev, PCI_ROM_ADDRESS, BIOSImageBus | 0x1);
-#endif
udelay(1);
/*Check that the BIOS image is valid. If not fail, or return the
@@ -447,7 +393,6 @@ pcidev - PCI device info for the video card on the bus
REMARKS:
Unmaps the BIOS image for the device and restores framebuffer mappings
****************************************************************************/
-#ifdef CONFIG_DM_PCI
void PCI_unmapBIOSImage(struct udevice *pcidev, void *BIOSImage)
{
dm_pci_write_config32(pcidev, PCI_ROM_ADDRESS, saveROMBaseAddress);
@@ -456,16 +401,6 @@ void PCI_unmapBIOSImage(struct udevice *pcidev, void *BIOSImage)
dm_pci_write_config32(pcidev, PCI_BASE_ADDRESS_2, saveBaseAddress18);
dm_pci_write_config32(pcidev, PCI_BASE_ADDRESS_4, saveBaseAddress20);
}
-#else
-void PCI_unmapBIOSImage(pci_dev_t pcidev, void *BIOSImage)
-{
- pci_write_config_dword(pcidev, PCI_ROM_ADDRESS, saveROMBaseAddress);
- pci_write_config_dword(pcidev, PCI_BASE_ADDRESS_0, saveBaseAddress10);
- pci_write_config_dword(pcidev, PCI_BASE_ADDRESS_1, saveBaseAddress14);
- pci_write_config_dword(pcidev, PCI_BASE_ADDRESS_2, saveBaseAddress18);
- pci_write_config_dword(pcidev, PCI_BASE_ADDRESS_4, saveBaseAddress20);
-}
-#endif
/****************************************************************************
PARAMETERS:
@@ -479,22 +414,14 @@ REMARKS:
Loads and POST's the display controllers BIOS, directly from the BIOS
image we can extract over the PCI bus.
****************************************************************************/
-#ifdef CONFIG_DM_PCI
static int PCI_postController(struct udevice *pcidev, uchar *bios_rom,
int bios_len, BE_VGAInfo *vga_info,
int vesa_mode, struct vbe_mode_info *mode_info)
-#else
-static int PCI_postController(pci_dev_t pcidev, uchar *bios_rom, int bios_len,
- BE_VGAInfo *vga_info, int vesa_mode,
- struct vbe_mode_info *mode_info)
-#endif
{
u32 bios_image_len;
uchar *mapped_bios;
uchar *copy_of_bios;
-#ifdef CONFIG_DM_PCI
pci_dev_t bdf;
-#endif
if (bios_rom) {
copy_of_bios = bios_rom;
@@ -522,16 +449,10 @@ static int PCI_postController(pci_dev_t pcidev, uchar *bios_rom, int bios_len,
}
/*Save information in vga_info structure*/
-#ifdef CONFIG_DM_PCI
bdf = dm_pci_get_bdf(pcidev);
vga_info->function = PCI_FUNC(bdf);
vga_info->device = PCI_DEV(bdf);
vga_info->bus = PCI_BUS(bdf);
-#else
- vga_info->function = PCI_FUNC(pcidev);
- vga_info->device = PCI_DEV(pcidev);
- vga_info->bus = PCI_BUS(pcidev);
-#endif
vga_info->pcidev = pcidev;
vga_info->BIOSImage = copy_of_bios;
vga_info->BIOSImageLen = bios_image_len;
@@ -549,22 +470,13 @@ static int PCI_postController(pci_dev_t pcidev, uchar *bios_rom, int bios_len,
return true;
}
-#ifdef CONFIG_DM_PCI
int biosemu_setup(struct udevice *pcidev, BE_VGAInfo **vga_infop)
-#else
-int biosemu_setup(pci_dev_t pcidev, BE_VGAInfo **vga_infop)
-#endif
{
BE_VGAInfo *VGAInfo;
-#ifdef CONFIG_DM_PCI
pci_dev_t bdf = dm_pci_get_bdf(pcidev);
printf("videoboot: Booting PCI video card bus %d, function %d, device %d\n",
PCI_BUS(bdf), PCI_FUNC(bdf), PCI_DEV(bdf));
-#else
- printf("videoboot: Booting PCI video card bus %d, function %d, device %d\n",
- PCI_BUS(pcidev), PCI_FUNC(pcidev), PCI_DEV(pcidev));
-#endif
/*Initialise the x86 BIOS emulator*/
if ((VGAInfo = malloc(sizeof(*VGAInfo))) == NULL) {
printf("videoboot: Out of memory!\n");
@@ -582,15 +494,9 @@ void biosemu_set_interrupt_handler(int intnum, int (*int_func)(void))
X86EMU_setupIntrFunc(intnum, (X86EMU_intrFuncs)int_func);
}
-#ifdef CONFIG_DM_PCI
int biosemu_run(struct udevice *pcidev, uchar *bios_rom, int bios_len,
BE_VGAInfo *vga_info, int clean_up, int vesa_mode,
struct vbe_mode_info *mode_info)
-#else
-int biosemu_run(pci_dev_t pcidev, uchar *bios_rom, int bios_len,
- BE_VGAInfo *vga_info, int clean_up, int vesa_mode,
- struct vbe_mode_info *mode_info)
-#endif
{
/*Post all the display controller BIOS'es*/
if (!PCI_postController(pcidev, bios_rom, bios_len, vga_info,
@@ -623,12 +529,8 @@ REMARKS:
Boots the PCI/AGP video card on the bus using the Video ROM BIOS image
and the X86 BIOS emulator module.
****************************************************************************/
-#ifdef CONFIG_DM_PCI
int BootVideoCardBIOS(struct udevice *pcidev, BE_VGAInfo **pVGAInfo,
int clean_up)
-#else
-int BootVideoCardBIOS(pci_dev_t pcidev, BE_VGAInfo **pVGAInfo, int clean_up)
-#endif
{
BE_VGAInfo *VGAInfo;
int ret;
diff --git a/drivers/bios_emulator/bios.c b/drivers/bios_emulator/bios.c
index 77c7f94bc6..9596a1fdd3 100644
--- a/drivers/bios_emulator/bios.c
+++ b/drivers/bios_emulator/bios.c
@@ -185,21 +185,12 @@ static void X86API int1A(int unused)
case 0xB103: /* Find PCI class code */
M.x86.R_AH = DEVICE_NOT_FOUND;
#ifdef __KERNEL__
-#ifdef CONFIG_DM_PCI
dm_pci_read_config8(_BE_env.vgaInfo.pcidev, PCI_CLASS_PROG,
&interface);
dm_pci_read_config8(_BE_env.vgaInfo.pcidev, PCI_CLASS_DEVICE,
&subclass);
dm_pci_read_config8(_BE_env.vgaInfo.pcidev,
PCI_CLASS_DEVICE + 1, &baseclass);
-#else
- pci_read_config_byte(_BE_env.vgaInfo.pcidev, PCI_CLASS_PROG,
- &interface);
- pci_read_config_byte(_BE_env.vgaInfo.pcidev, PCI_CLASS_DEVICE,
- &subclass);
- pci_read_config_byte(_BE_env.vgaInfo.pcidev,
- PCI_CLASS_DEVICE + 1, &baseclass);
-#endif
if (M.x86.R_CL == interface && M.x86.R_CH == subclass
&& (u8) (M.x86.R_ECX >> 16) == baseclass) {
#else
@@ -218,13 +209,8 @@ static void X86API int1A(int unused)
if (M.x86.R_BX == pciSlot) {
M.x86.R_AH = SUCCESSFUL;
#ifdef __KERNEL__
-# ifdef CONFIG_DM_PCI
dm_pci_read_config8(_BE_env.vgaInfo.pcidev, M.x86.R_DI,
&M.x86.R_CL);
-# else
- pci_read_config_byte(_BE_env.vgaInfo.pcidev, M.x86.R_DI,
- &M.x86.R_CL);
-# endif
#else
M.x86.R_CL =
(u8) PCI_accessReg(M.x86.R_DI, 0, PCI_READ_BYTE,
@@ -238,13 +224,8 @@ static void X86API int1A(int unused)
if (M.x86.R_BX == pciSlot) {
M.x86.R_AH = SUCCESSFUL;
#ifdef __KERNEL__
-# ifdef CONFIG_DM_PCI
dm_pci_read_config16(_BE_env.vgaInfo.pcidev, M.x86.R_DI,
&M.x86.R_CX);
-# else
- pci_read_config_word(_BE_env.vgaInfo.pcidev, M.x86.R_DI,
- &M.x86.R_CX);
-# endif
#else
M.x86.R_CX =
(u16) PCI_accessReg(M.x86.R_DI, 0, PCI_READ_WORD,
@@ -258,13 +239,8 @@ static void X86API int1A(int unused)
if (M.x86.R_BX == pciSlot) {
M.x86.R_AH = SUCCESSFUL;
#ifdef __KERNEL__
-# ifdef CONFIG_DM_PCI
dm_pci_read_config32(_BE_env.vgaInfo.pcidev,
M.x86.R_DI, &M.x86.R_ECX);
-# else
- pci_read_config_dword(_BE_env.vgaInfo.pcidev,
- M.x86.R_DI, &M.x86.R_ECX);
-# endif
#else
M.x86.R_ECX =
(u32) PCI_accessReg(M.x86.R_DI, 0, PCI_READ_DWORD,
@@ -278,13 +254,8 @@ static void X86API int1A(int unused)
if (M.x86.R_BX == pciSlot) {
M.x86.R_AH = SUCCESSFUL;
#ifdef __KERNEL__
-# ifdef CONFIG_DM_PCI
dm_pci_write_config8(_BE_env.vgaInfo.pcidev,
M.x86.R_DI, M.x86.R_CL);
-# else
- pci_write_config_byte(_BE_env.vgaInfo.pcidev,
- M.x86.R_DI, M.x86.R_CL);
-# endif
#else
PCI_accessReg(M.x86.R_DI, M.x86.R_CL, PCI_WRITE_BYTE,
_BE_env.vgaInfo.pciInfo);
@@ -297,13 +268,8 @@ static void X86API int1A(int unused)
if (M.x86.R_BX == pciSlot) {
M.x86.R_AH = SUCCESSFUL;
#ifdef __KERNEL__
-# ifdef CONFIG_DM_PCI
dm_pci_write_config32(_BE_env.vgaInfo.pcidev,
M.x86.R_DI, M.x86.R_CX);
-# else
- pci_write_config_word(_BE_env.vgaInfo.pcidev,
- M.x86.R_DI, M.x86.R_CX);
-# endif
#else
PCI_accessReg(M.x86.R_DI, M.x86.R_CX, PCI_WRITE_WORD,
_BE_env.vgaInfo.pciInfo);
@@ -316,13 +282,8 @@ static void X86API int1A(int unused)
if (M.x86.R_BX == pciSlot) {
M.x86.R_AH = SUCCESSFUL;
#ifdef __KERNEL__
-# ifdef CONFIG_DM_PCI
dm_pci_write_config32(_BE_env.vgaInfo.pcidev,
M.x86.R_DI, M.x86.R_ECX);
-# else
- pci_write_config_dword(_BE_env.vgaInfo.pcidev,
- M.x86.R_DI, M.x86.R_ECX);
-# endif
#else
PCI_accessReg(M.x86.R_DI, M.x86.R_ECX, PCI_WRITE_DWORD,
_BE_env.vgaInfo.pciInfo);
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index b9874c743d..4ffbd6b2eb 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -200,8 +200,7 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
ulong addr;
addr = devfdt_get_addr(dev);
- if (CONFIG_IS_ENABLED(PCI) && IS_ENABLED(CONFIG_DM_PCI) &&
- addr == FDT_ADDR_T_NONE) {
+ if (CONFIG_IS_ENABLED(PCI) && addr == FDT_ADDR_T_NONE) {
struct fdt_pci_addr pci_addr;
u32 bar;
int ret;
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index e63fa84ce4..3dab5a5f63 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -348,7 +348,7 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s)
const char *argv[3];
const char **parg = argv;
- dfu->data.mmc.dev_num = simple_strtoul(devstr, NULL, 10);
+ dfu->data.mmc.dev_num = dectoul(devstr, NULL);
for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
*parg = strsep(&s, " ");
diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c
index 894b570875..0b7f17761f 100644
--- a/drivers/dfu/dfu_mtd.c
+++ b/drivers/dfu/dfu_mtd.c
@@ -268,9 +268,9 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char *s)
st = strsep(&s, " ");
if (!strcmp(st, "raw")) {
dfu->layout = DFU_RAW_ADDR;
- dfu->data.mtd.start = simple_strtoul(s, &s, 16);
+ dfu->data.mtd.start = hextoul(s, &s);
s++;
- dfu->data.mtd.size = simple_strtoul(s, &s, 16);
+ dfu->data.mtd.size = hextoul(s, &s);
} else if ((!strcmp(st, "part")) || (!strcmp(st, "partubi"))) {
char mtd_id[32];
struct mtd_device *mtd_dev;
@@ -279,7 +279,7 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char *s)
dfu->layout = DFU_RAW_ADDR;
- part = simple_strtoul(s, &s, 10);
+ part = dectoul(s, &s);
sprintf(mtd_id, "%s,%d", devstr, part - 1);
printf("using id '%s'\n", mtd_id);
diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index b8d24d203b..e53b35e42b 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -204,9 +204,9 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
st = strsep(&s, " ");
if (!strcmp(st, "raw")) {
dfu->layout = DFU_RAW_ADDR;
- dfu->data.nand.start = simple_strtoul(s, &s, 16);
+ dfu->data.nand.start = hextoul(s, &s);
s++;
- dfu->data.nand.size = simple_strtoul(s, &s, 16);
+ dfu->data.nand.size = hextoul(s, &s);
} else if ((!strcmp(st, "part")) || (!strcmp(st, "partubi"))) {
char mtd_id[32];
struct mtd_device *mtd_dev;
@@ -215,9 +215,9 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
dfu->layout = DFU_RAW_ADDR;
- dev = simple_strtoul(s, &s, 10);
+ dev = dectoul(s, &s);
s++;
- part = simple_strtoul(s, &s, 10);
+ part = dectoul(s, &s);
sprintf(mtd_id, "%s%d,%d", "nand", dev, part - 1);
debug("using id '%s'\n", mtd_id);
diff --git a/drivers/dfu/dfu_ram.c b/drivers/dfu/dfu_ram.c
index ab0ce9e6fa..cc7e45ba33 100644
--- a/drivers/dfu/dfu_ram.c
+++ b/drivers/dfu/dfu_ram.c
@@ -74,8 +74,8 @@ int dfu_fill_entity_ram(struct dfu_entity *dfu, char *devstr, char *s)
}
dfu->layout = DFU_RAM_ADDR;
- dfu->data.ram.start = simple_strtoul(argv[1], NULL, 16);
- dfu->data.ram.size = simple_strtoul(argv[2], NULL, 16);
+ dfu->data.ram.start = hextoul(argv[1], NULL);
+ dfu->data.ram.size = hextoul(argv[2], NULL);
dfu->write_medium = dfu_write_medium_ram;
dfu->get_medium_size = dfu_get_medium_size_ram;
diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index 8f8c425977..7e64ab772f 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -171,9 +171,9 @@ int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s)
st = strsep(&s, " ");
if (!strcmp(st, "raw")) {
dfu->layout = DFU_RAW_ADDR;
- dfu->data.sf.start = simple_strtoul(s, &s, 16);
+ dfu->data.sf.start = hextoul(s, &s);
s++;
- dfu->data.sf.size = simple_strtoul(s, &s, 16);
+ dfu->data.sf.size = hextoul(s, &s);
} else if (CONFIG_IS_ENABLED(DFU_SF_PART) &&
(!strcmp(st, "part") || !strcmp(st, "partubi"))) {
char mtd_id[32];
@@ -184,9 +184,9 @@ int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s)
dfu->layout = DFU_RAW_ADDR;
- dev = simple_strtoul(s, &s, 10);
+ dev = dectoul(s, &s);
s++;
- part = simple_strtoul(s, &s, 10);
+ part = dectoul(s, &s);
sprintf(mtd_id, "%s%d,%d", "nor", dev, part - 1);
printf("using id '%s'\n", mtd_id);
diff --git a/drivers/dfu/dfu_virt.c b/drivers/dfu/dfu_virt.c
index 62605bcde5..80c99cb06e 100644
--- a/drivers/dfu/dfu_virt.c
+++ b/drivers/dfu/dfu_virt.c
@@ -38,7 +38,7 @@ int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, char *s)
dfu->dev_type = DFU_DEV_VIRT;
dfu->layout = DFU_RAW_ADDR;
- dfu->data.virt.dev_num = simple_strtoul(devstr, NULL, 10);
+ dfu->data.virt.dev_num = dectoul(devstr, NULL);
dfu->write_medium = dfu_write_medium_virt;
dfu->get_medium_size = dfu_get_medium_size_virt;
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 3a5db5b08f..98eccc3455 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -208,7 +208,7 @@ static void download(char *cmd_parameter, char *response)
return;
}
fastboot_bytes_received = 0;
- fastboot_bytes_expected = simple_strtoul(cmd_parameter, &tmp, 16);
+ fastboot_bytes_expected = hextoul(cmd_parameter, &tmp);
if (fastboot_bytes_expected == 0) {
fastboot_fail("Expected nonzero image size", response);
return;
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 131099cc17..8c77777dbe 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -122,7 +122,7 @@ int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc)
int numeric;
int ret;
- numeric = isdigit(*name) ? simple_strtoul(name, NULL, 10) : -1;
+ numeric = isdigit(*name) ? dectoul(name, NULL) : -1;
for (ret = uclass_first_device(UCLASS_GPIO, &dev);
dev;
ret = uclass_next_device(&dev)) {
diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c
index 5775a22abd..7b9d88a8a7 100644
--- a/drivers/gpio/mxs_gpio.c
+++ b/drivers/gpio/mxs_gpio.c
@@ -123,12 +123,12 @@ int name_to_gpio(const char *name)
unsigned bank, pin;
char *end;
- bank = simple_strtoul(name, &end, 10);
+ bank = dectoul(name, &end);
if (!*end || *end != ':')
return bank;
- pin = simple_strtoul(end + 1, NULL, 10);
+ pin = dectoul(end + 1, NULL);
return (bank << MXS_PAD_BANK_SHIFT) | (pin << MXS_PAD_PIN_SHIFT);
}
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 4ab8cee2d1..2fd2996798 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -221,11 +221,11 @@ static int do_pca953x(struct cmd_tbl *cmdtp, int flag, int argc,
/* arg2 used as chip number or pin number */
if (argc > 2)
- ul_arg2 = simple_strtoul(argv[2], NULL, 16);
+ ul_arg2 = hextoul(argv[2], NULL);
/* arg3 used as pin or invert value */
if (argc > 3)
- ul_arg3 = simple_strtoul(argv[3], NULL, 16) & 0x1;
+ ul_arg3 = hextoul(argv[3], NULL) & 0x1;
switch ((long)c->cmd) {
case PCA953X_CMD_INFO:
diff --git a/drivers/gpio/tca642x.c b/drivers/gpio/tca642x.c
index 7007c7a002..7f67f96b0e 100644
--- a/drivers/gpio/tca642x.c
+++ b/drivers/gpio/tca642x.c
@@ -262,11 +262,11 @@ static int do_tca642x(struct cmd_tbl *cmdtp, int flag, int argc,
/* arg2 used as chip number or pin number */
if (argc > 2)
- ul_arg2 = simple_strtoul(argv[2], NULL, 10);
+ ul_arg2 = dectoul(argv[2], NULL);
/* arg3 used as pin or invert value */
if (argc > 3)
- ul_arg3 = simple_strtoul(argv[3], NULL, 10) & 0x1;
+ ul_arg3 = dectoul(argv[3], NULL) & 0x1;
switch ((int)c->cmd) {
case TCA642X_CMD_INFO:
diff --git a/drivers/misc/ds4510.c b/drivers/misc/ds4510.c
index a2a5291565..9340596f2c 100644
--- a/drivers/misc/ds4510.c
+++ b/drivers/misc/ds4510.c
@@ -271,11 +271,11 @@ int do_ds4510(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/* arg2 used as chip addr and pin number */
if (argc > 2)
- ul_arg2 = simple_strtoul(argv[2], NULL, 16);
+ ul_arg2 = hextoul(argv[2], NULL);
/* arg3 used as output/pullup value */
if (argc > 3)
- ul_arg3 = simple_strtoul(argv[3], NULL, 16);
+ ul_arg3 = hextoul(argv[3], NULL);
switch ((int)c->cmd) {
case DS4510_CMD_DEVICE:
@@ -337,9 +337,9 @@ int do_ds4510(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
return cmd_usage(cmdtp);
- addr = simple_strtoul(argv[3], NULL, 16);
- off += simple_strtoul(argv[4], NULL, 16);
- cnt = simple_strtoul(argv[5], NULL, 16);
+ addr = hextoul(argv[3], NULL);
+ off += hextoul(argv[4], NULL);
+ cnt = hextoul(argv[5], NULL);
if ((off + cnt) > end) {
printf("ERROR: invalid len\n");
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index b2d1b4f9aa..f99b5f997e 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -424,7 +424,6 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
struct pl180_mmc_host *host = dev_get_priv(dev);
struct mmc_config *cfg = &pdata->cfg;
struct clk clk;
- u32 bus_width;
u32 periphid;
int ret;
@@ -444,37 +443,35 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
SDI_CLKCR_HWFC_EN;
host->clock_in = clk_get_rate(&clk);
+ cfg->name = dev->name;
+ cfg->voltages = VOLTAGE_WINDOW_SD;
+ cfg->host_caps = 0;
+ cfg->f_min = host->clock_in / (2 * (SDI_CLKCR_CLKDIV_INIT_V1 + 1));
+ cfg->f_max = MMC_CLOCK_MAX;
+ cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
+
periphid = dev_read_u32_default(dev, "arm,primecell-periphid", 0);
switch (periphid) {
case STM32_MMCI_ID: /* stm32 variant */
host->version2 = false;
break;
+ case UX500V2_MMCI_ID:
+ host->pwr_init = SDI_PWR_OPD | SDI_PWR_PWRCTRL_ON;
+ host->clkdiv_init = SDI_CLKCR_CLKDIV_INIT_V2 | SDI_CLKCR_CLKEN |
+ SDI_CLKCR_HWFC_EN;
+ cfg->voltages = VOLTAGE_WINDOW_MMC;
+ cfg->f_min = host->clock_in / (2 + SDI_CLKCR_CLKDIV_INIT_V2);
+ host->version2 = true;
+ break;
default:
host->version2 = true;
}
- cfg->name = dev->name;
- cfg->voltages = VOLTAGE_WINDOW_SD;
- cfg->host_caps = 0;
- cfg->f_min = host->clock_in / (2 * (SDI_CLKCR_CLKDIV_INIT_V1 + 1));
- cfg->f_max = dev_read_u32_default(dev, "max-frequency", MMC_CLOCK_MAX);
- cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
-
gpio_request_by_name(dev, "cd-gpios", 0, &host->cd_gpio, GPIOD_IS_IN);
- bus_width = dev_read_u32_default(dev, "bus-width", 1);
- switch (bus_width) {
- case 8:
- cfg->host_caps |= MMC_MODE_8BIT;
- /* Hosts capable of 8-bit transfers can also do 4 bits */
- case 4:
- cfg->host_caps |= MMC_MODE_4BIT;
- break;
- case 1:
- break;
- default:
- dev_err(dev, "Invalid bus-width value %u\n", bus_width);
- }
+ ret = mmc_of_parse(dev, cfg);
+ if (ret)
+ return ret;
arm_pl180_mmc_init(host);
mmc->priv = host;
@@ -526,20 +523,17 @@ static const struct dm_mmc_ops arm_pl180_dm_mmc_ops = {
static int arm_pl180_mmc_of_to_plat(struct udevice *dev)
{
struct pl180_mmc_host *host = dev_get_priv(dev);
- fdt_addr_t addr;
- addr = dev_read_addr(dev);
- if (addr == FDT_ADDR_T_NONE)
+ host->base = dev_read_addr_ptr(dev);
+ if (!host->base)
return -EINVAL;
- host->base = (void *)addr;
-
return 0;
}
static const struct udevice_id arm_pl180_mmc_match[] = {
{ .compatible = "arm,pl180" },
- { .compatible = "arm,primecell" },
+ { .compatible = "arm,pl18x" },
{ /* sentinel */ }
};
diff --git a/drivers/mmc/arm_pl180_mmci.h b/drivers/mmc/arm_pl180_mmci.h
index 61ee96a112..15c29beadb 100644
--- a/drivers/mmc/arm_pl180_mmci.h
+++ b/drivers/mmc/arm_pl180_mmci.h
@@ -142,6 +142,7 @@
#define SDI_FIFO_BURST_SIZE 8
#define STM32_MMCI_ID 0x00880180
+#define UX500V2_MMCI_ID 0x10480180
struct sdi_registers {
u32 power; /* 0x00*/
diff --git a/drivers/mmc/rpmb.c b/drivers/mmc/rpmb.c
index ea7e506666..b68d98573c 100644
--- a/drivers/mmc/rpmb.c
+++ b/drivers/mmc/rpmb.c
@@ -480,10 +480,24 @@ int mmc_rpmb_route_frames(struct mmc *mmc, void *req, unsigned long reqlen,
* and possibly just delay an eventual error which will be harder
* to track down.
*/
+ void *rpmb_data = NULL;
+ int ret;
if (reqlen % sizeof(struct s_rpmb) || rsplen % sizeof(struct s_rpmb))
return -EINVAL;
- return rpmb_route_frames(mmc, req, reqlen / sizeof(struct s_rpmb),
- rsp, rsplen / sizeof(struct s_rpmb));
+ if (!IS_ALIGNED((uintptr_t)req, ARCH_DMA_MINALIGN)) {
+ /* Memory alignment is required by MMC driver */
+ rpmb_data = malloc(reqlen);
+ if (!rpmb_data)
+ return -ENOMEM;
+
+ memcpy(rpmb_data, req, reqlen);
+ req = rpmb_data;
+ }
+
+ ret = rpmb_route_frames(mmc, req, reqlen / sizeof(struct s_rpmb),
+ rsp, rsplen / sizeof(struct s_rpmb));
+ free(rpmb_data);
+ return ret;
}
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 99e2f16349..d5d905fa5a 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -2604,18 +2604,28 @@ static int spi_nor_init_params(struct spi_nor *nor,
params->size = info->sector_size * info->n_sectors;
params->page_size = info->page_size;
+ if (!(info->flags & SPI_NOR_NO_FR)) {
+ /* Default to Fast Read for DT and non-DT platform devices. */
+ params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST;
+
+ /* Mask out Fast Read if not requested at DT instantiation. */
+#if CONFIG_IS_ENABLED(DM_SPI)
+ if (!ofnode_read_bool(dev_ofnode(nor->spi->dev),
+ "m25p,fast-read"))
+ params->hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST;
+#endif
+ }
+
/* (Fast) Read settings. */
params->hwcaps.mask |= SNOR_HWCAPS_READ;
spi_nor_set_read_settings(&params->reads[SNOR_CMD_READ],
0, 0, SPINOR_OP_READ,
SNOR_PROTO_1_1_1);
- if (!(info->flags & SPI_NOR_NO_FR)) {
- params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST;
+ if (params->hwcaps.mask & SNOR_HWCAPS_READ_FAST)
spi_nor_set_read_settings(&params->reads[SNOR_CMD_READ_FAST],
0, 8, SPINOR_OP_READ_FAST,
SNOR_PROTO_1_1_1);
- }
if (info->flags & SPI_NOR_DUAL_READ) {
params->hwcaps.mask |= SNOR_HWCAPS_READ_1_1_2;
@@ -2858,10 +2868,11 @@ spi_nor_adjust_hwcaps(struct spi_nor *nor,
unsigned int cap;
/*
- * Enable all caps by default. We will mask them after checking what's
- * really supported using spi_mem_supports_op().
+ * Start by assuming the controller supports every capability.
+ * We will mask them after checking what's really supported
+ * using spi_mem_supports_op().
*/
- *hwcaps = SNOR_HWCAPS_ALL;
+ *hwcaps = SNOR_HWCAPS_ALL & params->hwcaps.mask;
/* X-X-X modes are not supported yet, mask them all. */
*hwcaps &= ~SNOR_HWCAPS_X_X_X;
diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c
index 6f84c54a47..cb3a08872d 100644
--- a/drivers/mtd/spi/spi-nor-ids.c
+++ b/drivers/mtd/spi/spi-nor-ids.c
@@ -359,6 +359,7 @@ const struct flash_info spi_nor_ids[] = {
#ifdef CONFIG_SPI_FLASH_XMC
/* XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) */
{ INFO("XM25QH64A", 0x207017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+ { INFO("XM25QH64C", 0x204017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ INFO("XM25QH128A", 0x207018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
#endif
{ },
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 60613b7df0..5bdcede8f1 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5796,7 +5796,7 @@ static int do_e1000(struct cmd_tbl *cmdtp, int flag, int argc,
}
/* Make sure we can find the requested e1000 card */
- cardnum = simple_strtoul(argv[1], NULL, 10);
+ cardnum = dectoul(argv[1], NULL);
#ifdef CONFIG_DM_ETH
e1000_name(name, cardnum);
ret = uclass_get_device_by_name(UCLASS_ETH, name, &dev);
diff --git a/drivers/net/e1000_spi.c b/drivers/net/e1000_spi.c
index 4fcc65d978..69adf282c7 100644
--- a/drivers/net/e1000_spi.c
+++ b/drivers/net/e1000_spi.c
@@ -399,7 +399,7 @@ static int do_e1000_spi_dump(struct cmd_tbl *cmdtp, struct e1000_hw *hw,
}
/* Parse the arguments */
- dest = (void *)simple_strtoul(argv[0], NULL, 16);
+ dest = (void *)hextoul(argv[0], NULL);
offset = simple_strtoul(argv[1], NULL, 0);
length = simple_strtoul(argv[2], NULL, 0);
@@ -444,7 +444,7 @@ static int do_e1000_spi_program(struct cmd_tbl *cmdtp, struct e1000_hw *hw,
}
/* Parse the arguments */
- source = (const void *)simple_strtoul(argv[0], NULL, 16);
+ source = (const void *)hextoul(argv[0], NULL);
offset = simple_strtoul(argv[1], NULL, 0);
length = simple_strtoul(argv[2], NULL, 0);
diff --git a/drivers/net/fm/fdt.c b/drivers/net/fm/fdt.c
index 242d27a34e..3855d7d58f 100644
--- a/drivers/net/fm/fdt.c
+++ b/drivers/net/fm/fdt.c
@@ -42,7 +42,7 @@ void fdt_fixup_fman_firmware(void *blob)
if (!p)
return;
- fmanfw = (struct qe_firmware *)simple_strtoul(p, NULL, 16);
+ fmanfw = (struct qe_firmware *)hextoul(p, NULL);
if (!fmanfw)
return;
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 914ec001ec..d52c986d4b 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -642,7 +642,7 @@ static unsigned long get_mc_boot_timeout_ms(void)
char *timeout_ms_env_var = env_get(MC_BOOT_TIMEOUT_ENV_VAR);
if (timeout_ms_env_var) {
- timeout_ms = simple_strtoul(timeout_ms_env_var, NULL, 10);
+ timeout_ms = dectoul(timeout_ms_env_var, NULL);
if (timeout_ms == 0) {
printf("fsl-mc: WARNING: Invalid value for \'"
MC_BOOT_TIMEOUT_ENV_VAR
@@ -956,8 +956,7 @@ unsigned long mc_get_dram_block_size(void)
char *dram_block_size_env_var = env_get(MC_MEM_SIZE_ENV_VAR);
if (dram_block_size_env_var) {
- dram_block_size = simple_strtoul(dram_block_size_env_var, NULL,
- 16);
+ dram_block_size = hextoul(dram_block_size_env_var, NULL);
if (dram_block_size < CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE) {
printf("fsl-mc: WARNING: Invalid value for \'"
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index f1d0630d02..cec96c5715 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -87,7 +87,7 @@ static int refresh_settings_from_env(void)
return -1; /* ncip is 0.0.0.0 */
p = strchr(env_get("ncip"), ':');
if (p != NULL) {
- nc_out_port = simple_strtoul(p + 1, NULL, 10);
+ nc_out_port = dectoul(p + 1, NULL);
nc_in_port = nc_out_port;
}
} else {
@@ -96,10 +96,10 @@ static int refresh_settings_from_env(void)
p = env_get("ncoutport");
if (p != NULL)
- nc_out_port = simple_strtoul(p, NULL, 10);
+ nc_out_port = dectoul(p, NULL);
p = env_get("ncinport");
if (p != NULL)
- nc_in_port = simple_strtoul(p, NULL, 10);
+ nc_in_port = dectoul(p, NULL);
if (is_broadcast(nc_ip))
/* broadcast MAC address */
diff --git a/drivers/net/pfe_eth/pfe_cmd.c b/drivers/net/pfe_eth/pfe_cmd.c
index 364750f65c..2fe0db0fe7 100644
--- a/drivers/net/pfe_eth/pfe_cmd.c
+++ b/drivers/net/pfe_eth/pfe_cmd.c
@@ -41,7 +41,7 @@ static void pfe_command_pe(int argc, char *const argv[])
}
id = simple_strtoul(argv[4], NULL, 0);
- addr = simple_strtoul(argv[5], NULL, 16);
+ addr = hextoul(argv[5], NULL);
size = 4;
for (i = 0; i < num; i++, addr += 4) {
@@ -75,7 +75,7 @@ static void pfe_command_pe(int argc, char *const argv[])
}
id = simple_strtoul(argv[4], NULL, 0);
- addr = simple_strtoul(argv[5], NULL, 16);
+ addr = hextoul(argv[5], NULL);
size = 4;
for (i = 0; i < num; i++, addr += 4) {
@@ -99,9 +99,9 @@ static void pfe_command_pe(int argc, char *const argv[])
}
id = simple_strtoul(argv[4], NULL, 0);
- val = simple_strtoul(argv[5], NULL, 16);
+ val = hextoul(argv[5], NULL);
val = cpu_to_be32(val);
- addr = simple_strtoul(argv[6], NULL, 16);
+ addr = hextoul(argv[6], NULL);
size = 4;
pe_dmem_write(id, val, addr, size);
} else {
@@ -123,7 +123,7 @@ static void pfe_command_pe(int argc, char *const argv[])
return;
}
- offset = simple_strtoul(argv[4], NULL, 16);
+ offset = hextoul(argv[4], NULL);
for (i = 0; i < num; i++, offset += 4) {
pe_lmem_read(&val, 4, offset);
@@ -141,9 +141,9 @@ static void pfe_command_pe(int argc, char *const argv[])
return;
}
- val = simple_strtoul(argv[4], NULL, 16);
+ val = hextoul(argv[4], NULL);
val = cpu_to_be32(val);
- offset = simple_strtoul(argv[5], NULL, 16);
+ offset = hextoul(argv[5], NULL);
pe_lmem_write(&val, 4, offset);
} else {
printf("Usage: pfe pe lmem [read | write] <parameters>\n");
diff --git a/drivers/net/pfe_eth/pfe_firmware.c b/drivers/net/pfe_eth/pfe_firmware.c
index ac86e33c55..ad5bc3c862 100644
--- a/drivers/net/pfe_eth/pfe_firmware.c
+++ b/drivers/net/pfe_eth/pfe_firmware.c
@@ -298,7 +298,7 @@ int pfe_firmware_init(void)
if (!p) {
max_fw_count = 2;
} else {
- max_fw_count = simple_strtoul(p, NULL, 10);
+ max_fw_count = dectoul(p, NULL);
if (max_fw_count)
max_fw_count = 3;
else
diff --git a/drivers/net/phy/b53.c b/drivers/net/phy/b53.c
index 21da53c7e5..c706e2b9bd 100644
--- a/drivers/net/phy/b53.c
+++ b/drivers/net/phy/b53.c
@@ -646,9 +646,9 @@ int do_b53_reg_read(const char *name, int argc, char *const argv[])
return ret;
}
- page = simple_strtoul(argv[1], NULL, 16);
- offset = simple_strtoul(argv[2], NULL, 16);
- width = simple_strtoul(argv[3], NULL, 10);
+ page = hextoul(argv[1], NULL);
+ offset = hextoul(argv[2], NULL);
+ width = dectoul(argv[3], NULL);
switch (width) {
case 8:
@@ -698,13 +698,13 @@ int do_b53_reg_write(const char *name, int argc, char *const argv[])
return ret;
}
- page = simple_strtoul(argv[1], NULL, 16);
- offset = simple_strtoul(argv[2], NULL, 16);
- width = simple_strtoul(argv[3], NULL, 10);
+ page = hextoul(argv[1], NULL);
+ offset = hextoul(argv[2], NULL);
+ width = dectoul(argv[3], NULL);
if (width == 48 || width == 64)
value64 = simple_strtoull(argv[4], NULL, 16);
else
- value = simple_strtoul(argv[4], NULL, 16);
+ value = hextoul(argv[4], NULL);
switch (width) {
case 8:
diff --git a/drivers/net/phy/mv88e6352.c b/drivers/net/phy/mv88e6352.c
index 62a7f19214..56060762d8 100644
--- a/drivers/net/phy/mv88e6352.c
+++ b/drivers/net/phy/mv88e6352.c
@@ -238,9 +238,9 @@ int do_mvsw_reg_read(const char *name, int argc, char *const argv[])
u16 value = 0, phyaddr, reg, port;
int ret;
- phyaddr = simple_strtoul(argv[1], NULL, 10);
- port = simple_strtoul(argv[2], NULL, 10);
- reg = simple_strtoul(argv[3], NULL, 10);
+ phyaddr = dectoul(argv[1], NULL);
+ port = dectoul(argv[2], NULL);
+ reg = dectoul(argv[3], NULL);
ret = sw_reg_read(name, phyaddr, port, reg, &value);
printf("%#x\n", value);
@@ -253,10 +253,10 @@ int do_mvsw_reg_write(const char *name, int argc, char *const argv[])
u16 value = 0, phyaddr, reg, port;
int ret;
- phyaddr = simple_strtoul(argv[1], NULL, 10);
- port = simple_strtoul(argv[2], NULL, 10);
- reg = simple_strtoul(argv[3], NULL, 10);
- value = simple_strtoul(argv[4], NULL, 16);
+ phyaddr = dectoul(argv[1], NULL);
+ port = dectoul(argv[2], NULL);
+ reg = dectoul(argv[3], NULL);
+ value = hextoul(argv[4], NULL);
ret = sw_reg_write(name, phyaddr, port, reg, value);
diff --git a/drivers/net/qe/dm_qe_uec.c b/drivers/net/qe/dm_qe_uec.c
index eb0501bc5a..a12c8cd2ac 100644
--- a/drivers/net/qe/dm_qe_uec.c
+++ b/drivers/net/qe/dm_qe_uec.c
@@ -938,7 +938,7 @@ enum qe_clock qe_clock_source(const char *source)
return QE_CLK_NONE;
if (strncasecmp(source, "brg", 3) == 0) {
- i = simple_strtoul(source + 3, NULL, 10);
+ i = dectoul(source + 3, NULL);
if (i >= 1 && i <= 16)
return (QE_BRG1 - 1) + i;
else
@@ -946,7 +946,7 @@ enum qe_clock qe_clock_source(const char *source)
}
if (strncasecmp(source, "clk", 3) == 0) {
- i = simple_strtoul(source + 3, NULL, 10);
+ i = dectoul(source + 3, NULL);
if (i >= 1 && i <= 24)
return (QE_CLK1 - 1) + i;
else
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 83d7a4e403..bdfdec98a0 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -19,7 +19,6 @@ obj-$(CONFIG_PCI_GT64120) += pci_gt64120.o
obj-$(CONFIG_PCI_MPC85XX) += pci_mpc85xx.o
obj-$(CONFIG_PCI_MSC01) += pci_msc01.o
obj-$(CONFIG_PCIE_IMX) += pcie_imx.o
-obj-$(CONFIG_FTPCI100) += pci_ftpci100.o
obj-$(CONFIG_PCI_MVEBU) += pci_mvebu.o
obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o
obj-$(CONFIG_PCI_RCAR_GEN3) += pci-rcar-gen3.o
diff --git a/drivers/pci/pci_common.c b/drivers/pci/pci_common.c
index 5231b69dc9..02a71da30f 100644
--- a/drivers/pci/pci_common.c
+++ b/drivers/pci/pci_common.c
@@ -99,7 +99,7 @@ __weak int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
return 0;
}
-#if !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT)
+#if defined(CONFIG_DM_PCI_COMPAT)
/* Get a virtual address associated with a BAR region */
void *pci_map_bar(pci_dev_t pdev, int bar, int flags)
{
@@ -361,4 +361,4 @@ pci_dev_t pci_find_class(uint find_class, int index)
return -ENODEV;
}
-#endif /* !CONFIG_DM_PCI || CONFIG_DM_PCI_COMPAT */
+#endif /* CONFIG_DM_PCI_COMPAT */
diff --git a/drivers/pci/pci_ftpci100.c b/drivers/pci/pci_ftpci100.c
deleted file mode 100644
index 32fac878a6..0000000000
--- a/drivers/pci/pci_ftpci100.c
+++ /dev/null
@@ -1,319 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Faraday FTPCI100 PCI Bridge Controller Device Driver Implementation
- *
- * Copyright (C) 2011 Andes Technology Corporation
- * Gavin Guo, Andes Technology Corporation <gavinguo@andestech.com>
- * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
- */
-#include <common.h>
-#include <init.h>
-#include <log.h>
-#include <malloc.h>
-#include <pci.h>
-
-#include <faraday/ftpci100.h>
-
-#include <asm/io.h>
-#include <asm/types.h> /* u32, u16.... used by pci.h */
-
-struct ftpci100_data {
- unsigned int reg_base;
- unsigned int io_base;
- unsigned int mem_base;
- unsigned int mmio_base;
- unsigned int ndevs;
-};
-
-static struct pci_config devs[FTPCI100_MAX_FUNCTIONS];
-static struct pci_controller local_hose;
-
-static void setup_pci_bar(unsigned int bus, unsigned int dev, unsigned func,
- unsigned char header, struct ftpci100_data *priv)
-{
- struct pci_controller *hose = (struct pci_controller *)&local_hose;
- unsigned int i, tmp32, bar_no, iovsmem = 1;
- pci_dev_t dev_nu;
-
- /* A device is present, add an entry to the array */
- devs[priv->ndevs].bus = bus;
- devs[priv->ndevs].dev = dev;
- devs[priv->ndevs].func = func;
-
- dev_nu = PCI_BDF(bus, dev, func);
-
- if ((header & 0x7f) == 0x01)
- /* PCI-PCI Bridge */
- bar_no = 2;
- else
- bar_no = 6;
-
- /* Allocate address spaces by configuring BARs */
- for (i = 0; i < bar_no; i++) {
- pci_hose_write_config_dword(hose, dev_nu,
- PCI_BASE_ADDRESS_0 + i * 4, 0xffffffff);
- pci_hose_read_config_dword(hose, dev_nu,
- PCI_BASE_ADDRESS_0 + i * 4, &tmp32);
-
- if (tmp32 == 0x0)
- continue;
-
- /* IO space */
- if (tmp32 & 0x1) {
- iovsmem = 0;
- unsigned int size_mask = ~(tmp32 & 0xfffffffc);
-
- if (priv->io_base & size_mask)
- priv->io_base = (priv->io_base & ~size_mask) + \
- size_mask + 1;
-
- devs[priv->ndevs].bar[i].addr = priv->io_base;
- devs[priv->ndevs].bar[i].size = size_mask + 1;
-
- pci_hose_write_config_dword(hose, dev_nu,
- PCI_BASE_ADDRESS_0 + i * 4,
- priv->io_base);
-
- debug("Allocated IO address 0x%X-" \
- "0x%X for Bus %d, Device %d, Function %d\n",
- priv->io_base,
- priv->io_base + size_mask, bus, dev, func);
-
- priv->io_base += size_mask + 1;
- } else {
- /* Memory space */
- unsigned int is_64bit = ((tmp32 & 0x6) == 0x4);
- unsigned int is_pref = tmp32 & 0x8;
- unsigned int size_mask = ~(tmp32 & 0xfffffff0);
- unsigned int alloc_base;
- unsigned int *addr_mem_base;
-
- if (is_pref)
- addr_mem_base = &priv->mem_base;
- else
- addr_mem_base = &priv->mmio_base;
-
- alloc_base = *addr_mem_base;
-
- if (alloc_base & size_mask)
- alloc_base = (alloc_base & ~size_mask) \
- + size_mask + 1;
-
- pci_hose_write_config_dword(hose, dev_nu,
- PCI_BASE_ADDRESS_0 + i * 4, alloc_base);
-
- debug("Allocated %s address 0x%X-" \
- "0x%X for Bus %d, Device %d, Function %d\n",
- is_pref ? "MEM" : "MMIO", alloc_base,
- alloc_base + size_mask, bus, dev, func);
-
- devs[priv->ndevs].bar[i].addr = alloc_base;
- devs[priv->ndevs].bar[i].size = size_mask + 1;
-
- debug("BAR address BAR size\n");
- debug("%010x %08d\n",
- devs[priv->ndevs].bar[0].addr,
- devs[priv->ndevs].bar[0].size);
-
- alloc_base += size_mask + 1;
- *addr_mem_base = alloc_base;
-
- if (is_64bit) {
- i++;
- pci_hose_write_config_dword(hose, dev_nu,
- PCI_BASE_ADDRESS_0 + i * 4, 0x0);
- }
- }
- }
-
- /* Enable Bus Master, Memory Space, and IO Space */
- pci_hose_read_config_dword(hose, dev_nu, PCI_CACHE_LINE_SIZE, &tmp32);
- pci_hose_write_config_dword(hose, dev_nu, PCI_CACHE_LINE_SIZE, 0x08);
- pci_hose_read_config_dword(hose, dev_nu, PCI_CACHE_LINE_SIZE, &tmp32);
-
- pci_hose_read_config_dword(hose, dev_nu, PCI_COMMAND, &tmp32);
-
- tmp32 &= 0xffff;
-
- if (iovsmem == 0)
- tmp32 |= 0x5;
- else
- tmp32 |= 0x6;
-
- pci_hose_write_config_dword(hose, dev_nu, PCI_COMMAND, tmp32);
-}
-
-static void pci_bus_scan(struct ftpci100_data *priv)
-{
- struct pci_controller *hose = (struct pci_controller *)&local_hose;
- unsigned int bus, dev, func;
- pci_dev_t dev_nu;
- unsigned int data32;
- unsigned int tmp;
- unsigned char header;
- unsigned char int_pin;
- unsigned int niobars;
- unsigned int nmbars;
-
- priv->ndevs = 1;
-
- nmbars = 0;
- niobars = 0;
-
- for (bus = 0; bus < MAX_BUS_NUM; bus++)
- for (dev = 0; dev < MAX_DEV_NUM; dev++)
- for (func = 0; func < MAX_FUN_NUM; func++) {
- dev_nu = PCI_BDF(bus, dev, func);
- pci_hose_read_config_dword(hose, dev_nu,
- PCI_VENDOR_ID, &data32);
-
- /*
- * some broken boards return 0 or ~0,
- * if a slot is empty.
- */
- if (data32 == 0xffffffff ||
- data32 == 0x00000000 ||
- data32 == 0x0000ffff ||
- data32 == 0xffff0000)
- continue;
-
- pci_hose_read_config_dword(hose, dev_nu,
- PCI_HEADER_TYPE, &tmp);
- header = (unsigned char)tmp;
- setup_pci_bar(bus, dev, func, header, priv);
-
- devs[priv->ndevs].v_id = (u16)(data32 & \
- 0x0000ffff);
-
- devs[priv->ndevs].d_id = (u16)((data32 & \
- 0xffff0000) >> 16);
-
- /* Figure out what INTX# line the card uses */
- pci_hose_read_config_byte(hose, dev_nu,
- PCI_INTERRUPT_PIN, &int_pin);
-
- /* assign the appropriate irq line */
- if (int_pin > PCI_IRQ_LINES) {
- printf("more irq lines than expect\n");
- } else if (int_pin != 0) {
- /* This device uses an interrupt line */
- devs[priv->ndevs].pin = int_pin;
- }
-
- pci_hose_read_config_dword(hose, dev_nu,
- PCI_CLASS_DEVICE, &data32);
-
- debug("%06d %03d %03d " \
- "%04d %08x %08x " \
- "%03d %08x %06d %08x\n",
- priv->ndevs, devs[priv->ndevs].bus,
- devs[priv->ndevs].dev,
- devs[priv->ndevs].func,
- devs[priv->ndevs].d_id,
- devs[priv->ndevs].v_id,
- devs[priv->ndevs].pin,
- devs[priv->ndevs].bar[0].addr,
- devs[priv->ndevs].bar[0].size,
- data32 >> 8);
-
- priv->ndevs++;
- }
-}
-
-static void ftpci_preinit(struct ftpci100_data *priv)
-{
- struct ftpci100_ahbc *ftpci100;
- struct pci_controller *hose = (struct pci_controller *)&local_hose;
- u32 pci_config_addr;
- u32 pci_config_data;
-
- priv->reg_base = CONFIG_FTPCI100_BASE;
- priv->io_base = CONFIG_FTPCI100_BASE + CONFIG_FTPCI100_IO_SIZE;
- priv->mmio_base = CONFIG_FTPCI100_MEM_BASE;
- priv->mem_base = CONFIG_FTPCI100_MEM_BASE + CONFIG_FTPCI100_MEM_SIZE;
-
- ftpci100 = (struct ftpci100_ahbc *)priv->reg_base;
-
- pci_config_addr = (u32) &ftpci100->conf;
- pci_config_data = (u32) &ftpci100->data;
-
- /* print device name */
- printf("FTPCI100\n");
-
- /* dump basic configuration */
- debug("%s: Config addr is %08X, data port is %08X\n",
- __func__, pci_config_addr, pci_config_data);
-
- /* PCI memory space */
- pci_set_region(hose->regions + 0,
- CONFIG_PCI_MEM_BUS,
- CONFIG_PCI_MEM_PHYS,
- CONFIG_PCI_MEM_SIZE,
- PCI_REGION_MEM);
- hose->region_count++;
-
- /* PCI IO space */
- pci_set_region(hose->regions + 1,
- CONFIG_PCI_IO_BUS,
- CONFIG_PCI_IO_PHYS,
- CONFIG_PCI_IO_SIZE,
- PCI_REGION_IO);
- hose->region_count++;
-
-#if defined(CONFIG_PCI_SYS_BUS)
- /* PCI System Memory space */
- pci_set_region(hose->regions + 2,
- CONFIG_PCI_SYS_BUS,
- CONFIG_PCI_SYS_PHYS,
- CONFIG_PCI_SYS_SIZE,
- PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
- hose->region_count++;
-#endif
-
- /* setup indirect read/write function */
- pci_setup_indirect(hose, pci_config_addr, pci_config_data);
-
- /* register hose */
- pci_register_hose(hose);
-}
-
-void pci_ftpci_init(void)
-{
- struct ftpci100_data *priv = NULL;
- struct pci_controller *hose = (struct pci_controller *)&local_hose;
- pci_dev_t bridge_num;
-
- struct pci_device_id bridge_ids[] = {
- {FTPCI100_BRIDGE_VENDORID, FTPCI100_BRIDGE_DEVICEID},
- {0, 0}
- };
-
- priv = malloc(sizeof(struct ftpci100_data));
-
- if (!priv) {
- printf("%s(): failed to malloc priv\n", __func__);
- return;
- }
-
- memset(priv, 0, sizeof(struct ftpci100_data));
-
- ftpci_preinit(priv);
-
- debug("Device bus dev func deviceID vendorID pin address" \
- " size class\n");
-
- pci_bus_scan(priv);
-
- /*
- * Setup the PCI Bridge Window to 1GB,
- * it will cause USB OHCI Host controller Unrecoverable Error
- * if it is not set.
- */
- bridge_num = pci_find_devices(bridge_ids, 0);
- if (bridge_num == -1) {
- printf("PCI Bridge not found\n");
- return;
- }
- pci_hose_write_config_dword(hose, bridge_num, PCI_MEM_BASE_SIZE1,
- FTPCI100_BASE_ADR_SIZE(1024));
-}
diff --git a/drivers/pci/pci_gt64120.c b/drivers/pci/pci_gt64120.c
index e57fedf036..153c65b119 100644
--- a/drivers/pci/pci_gt64120.c
+++ b/drivers/pci/pci_gt64120.c
@@ -114,69 +114,6 @@ static int gt_config_access(struct gt64120_pci_controller *gt,
return 0;
}
-#if !IS_ENABLED(CONFIG_DM_PCI)
-static int gt_read_config_dword(struct pci_controller *hose, pci_dev_t dev,
- int where, u32 *value)
-{
- struct gt64120_pci_controller *gt = hose_to_gt64120(hose);
-
- *value = 0xffffffff;
- return gt_config_access(gt, PCI_ACCESS_READ, dev, where, value);
-}
-
-static int gt_write_config_dword(struct pci_controller *hose, pci_dev_t dev,
- int where, u32 value)
-{
- struct gt64120_pci_controller *gt = hose_to_gt64120(hose);
- u32 data = value;
-
- return gt_config_access(gt, PCI_ACCESS_WRITE, dev, where, &data);
-}
-
-void gt64120_pci_init(void *regs, unsigned long sys_bus, unsigned long sys_phys,
- unsigned long sys_size, unsigned long mem_bus,
- unsigned long mem_phys, unsigned long mem_size,
- unsigned long io_bus, unsigned long io_phys,
- unsigned long io_size)
-{
- static struct gt64120_pci_controller global_gt;
- struct gt64120_pci_controller *gt;
- struct pci_controller *hose;
-
- gt = &global_gt;
- gt->regs = regs;
-
- hose = &gt->hose;
-
- hose->first_busno = 0;
- hose->last_busno = 0;
-
- /* System memory space */
- pci_set_region(&hose->regions[0], sys_bus, sys_phys, sys_size,
- PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
-
- /* PCI memory space */
- pci_set_region(&hose->regions[1], mem_bus, mem_phys, mem_size,
- PCI_REGION_MEM);
-
- /* PCI I/O space */
- pci_set_region(&hose->regions[2], io_bus, io_phys, io_size,
- PCI_REGION_IO);
-
- hose->region_count = 3;
-
- pci_set_ops(hose,
- pci_hose_read_config_byte_via_dword,
- pci_hose_read_config_word_via_dword,
- gt_read_config_dword,
- pci_hose_write_config_byte_via_dword,
- pci_hose_write_config_word_via_dword,
- gt_write_config_dword);
-
- pci_register_hose(hose);
- hose->last_busno = pci_hose_scan(hose);
-}
-#else
static int gt64120_pci_read_config(const struct udevice *dev, pci_dev_t bdf,
uint where, ulong *val,
enum pci_size_t size)
@@ -246,4 +183,3 @@ U_BOOT_DRIVER(gt64120_pci) = {
.probe = gt64120_pci_probe,
.priv_auto = sizeof(struct gt64120_pci_controller),
};
-#endif
diff --git a/drivers/pci/pci_msc01.c b/drivers/pci/pci_msc01.c
index c17da475d0..2f1b688fc3 100644
--- a/drivers/pci/pci_msc01.c
+++ b/drivers/pci/pci_msc01.c
@@ -62,69 +62,6 @@ static int msc01_config_access(struct msc01_pci_controller *msc01,
return 0;
}
-#if !IS_ENABLED(CONFIG_DM_PCI)
-static int msc01_read_config_dword(struct pci_controller *hose, pci_dev_t dev,
- int where, u32 *value)
-{
- struct msc01_pci_controller *msc01 = hose_to_msc01(hose);
-
- *value = 0xffffffff;
- return msc01_config_access(msc01, PCI_ACCESS_READ, dev, where, value);
-}
-
-static int msc01_write_config_dword(struct pci_controller *hose, pci_dev_t dev,
- int where, u32 value)
-{
- struct msc01_pci_controller *gt = hose_to_msc01(hose);
- u32 data = value;
-
- return msc01_config_access(gt, PCI_ACCESS_WRITE, dev, where, &data);
-}
-
-void msc01_pci_init(void *base, unsigned long sys_bus, unsigned long sys_phys,
- unsigned long sys_size, unsigned long mem_bus,
- unsigned long mem_phys, unsigned long mem_size,
- unsigned long io_bus, unsigned long io_phys,
- unsigned long io_size)
-{
- static struct msc01_pci_controller global_msc01;
- struct msc01_pci_controller *msc01;
- struct pci_controller *hose;
-
- msc01 = &global_msc01;
- msc01->base = base;
-
- hose = &msc01->hose;
-
- hose->first_busno = 0;
- hose->last_busno = 0;
-
- /* System memory space */
- pci_set_region(&hose->regions[0], sys_bus, sys_phys, sys_size,
- PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
-
- /* PCI memory space */
- pci_set_region(&hose->regions[1], mem_bus, mem_phys, mem_size,
- PCI_REGION_MEM);
-
- /* PCI I/O space */
- pci_set_region(&hose->regions[2], io_bus, io_phys, io_size,
- PCI_REGION_IO);
-
- hose->region_count = 3;
-
- pci_set_ops(hose,
- pci_hose_read_config_byte_via_dword,
- pci_hose_read_config_word_via_dword,
- msc01_read_config_dword,
- pci_hose_write_config_byte_via_dword,
- pci_hose_write_config_word_via_dword,
- msc01_write_config_dword);
-
- pci_register_hose(hose);
- hose->last_busno = pci_hose_scan(hose);
-}
-#else
static int msc01_pci_read_config(const struct udevice *dev, pci_dev_t bdf,
uint where, ulong *val, enum pci_size_t size)
{
@@ -192,4 +129,3 @@ U_BOOT_DRIVER(msc01_pci) = {
.probe = msc01_pci_probe,
.priv_auto = sizeof(struct msc01_pci_controller),
};
-#endif
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 7b46fdb89a..756166fd3e 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -681,86 +681,6 @@ static int imx_pcie_link_up(struct imx_pcie_priv *priv)
return 0;
}
-#if !CONFIG_IS_ENABLED(DM_PCI)
-static struct imx_pcie_priv imx_pcie_priv = {
- .dbi_base = (void __iomem *)MX6_DBI_ADDR,
- .cfg_base = (void __iomem *)MX6_ROOT_ADDR,
-};
-
-static struct imx_pcie_priv *priv = &imx_pcie_priv;
-
-static int imx_pcie_read_config(struct pci_controller *hose, pci_dev_t d,
- int where, u32 *val)
-{
- struct imx_pcie_priv *priv = hose->priv_data;
-
- return imx_pcie_read_cfg(priv, d, where, val);
-}
-
-static int imx_pcie_write_config(struct pci_controller *hose, pci_dev_t d,
- int where, u32 val)
-{
- struct imx_pcie_priv *priv = hose->priv_data;
-
- return imx_pcie_write_cfg(priv, d, where, val);
-}
-
-void imx_pcie_init(void)
-{
- /* Static instance of the controller. */
- static struct pci_controller pcc;
- struct pci_controller *hose = &pcc;
- int ret;
-
- memset(&pcc, 0, sizeof(pcc));
-
- hose->priv_data = priv;
-
- /* PCI I/O space */
- pci_set_region(&hose->regions[0],
- MX6_IO_ADDR, MX6_IO_ADDR,
- MX6_IO_SIZE, PCI_REGION_IO);
-
- /* PCI memory space */
- pci_set_region(&hose->regions[1],
- MX6_MEM_ADDR, MX6_MEM_ADDR,
- MX6_MEM_SIZE, PCI_REGION_MEM);
-
- /* System memory space */
- pci_set_region(&hose->regions[2],
- MMDC0_ARB_BASE_ADDR, MMDC0_ARB_BASE_ADDR,
- 0xefffffff, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
-
- hose->region_count = 3;
-
- pci_set_ops(hose,
- pci_hose_read_config_byte_via_dword,
- pci_hose_read_config_word_via_dword,
- imx_pcie_read_config,
- pci_hose_write_config_byte_via_dword,
- pci_hose_write_config_word_via_dword,
- imx_pcie_write_config);
-
- /* Start the controller. */
- ret = imx_pcie_link_up(priv);
-
- if (!ret) {
- pci_register_hose(hose);
- hose->last_busno = pci_hose_scan(hose);
- }
-}
-
-void imx_pcie_remove(void)
-{
- imx6_pcie_assert_core_reset(priv, true);
-}
-
-/* Probe function. */
-void pci_init_board(void)
-{
- imx_pcie_init();
-}
-#else
static int imx_pcie_dm_read_config(const struct udevice *dev, pci_dev_t bdf,
uint offset, ulong *value,
enum pci_size_t size)
@@ -852,4 +772,3 @@ U_BOOT_DRIVER(imx_pcie) = {
.priv_auto = sizeof(struct imx_pcie_priv),
.flags = DM_FLAG_OS_PREPARE,
};
-#endif
diff --git a/drivers/pinctrl/nexell/pinctrl-nexell.c b/drivers/pinctrl/nexell/pinctrl-nexell.c
index 6b01f47657..20497a746d 100644
--- a/drivers/pinctrl/nexell/pinctrl-nexell.c
+++ b/drivers/pinctrl/nexell/pinctrl-nexell.c
@@ -34,7 +34,7 @@ unsigned long pin_to_bank_base(struct udevice *dev, const char *pin_name,
idx++;
}
bank[idx] = '\0';
- *pin = (u32)simple_strtoul(&pin_name[++idx], NULL, 10);
+ *pin = (u32)dectoul(&pin_name[++idx], NULL);
/* lookup the pin bank data using the pin bank name */
for (idx = 0; idx < nr_banks; idx++)
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index ea7275ca00..dfe60b6dad 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -69,7 +69,7 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
* If statename is not found in "pinctrl-names",
* assume statename is just the integer state ID.
*/
- state = simple_strtoul(statename, &end, 10);
+ state = dectoul(statename, &end);
if (*end)
return -EINVAL;
}
diff --git a/drivers/power/power_core.c b/drivers/power/power_core.c
index eeed8e24a9..4f7ba099cd 100644
--- a/drivers/power/power_core.c
+++ b/drivers/power/power_core.c
@@ -159,7 +159,7 @@ static int do_pmic(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 4)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[3], NULL, 16);
+ reg = hextoul(argv[3], NULL);
ret = pmic_reg_read(p, reg, &val);
if (ret)
@@ -174,8 +174,8 @@ static int do_pmic(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 5)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[3], NULL, 16);
- val = simple_strtoul(argv[4], NULL, 16);
+ reg = hextoul(argv[3], NULL);
+ val = hextoul(argv[4], NULL);
pmic_reg_write(p, reg, val);
return CMD_RET_SUCCESS;
diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
index 97883ffc87..bd0a10c9d2 100644
--- a/drivers/qe/qe.c
+++ b/drivers/qe/qe.c
@@ -794,7 +794,7 @@ static int qe_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return cmd_usage(cmdtp);
if (strcmp(argv[1], "fw") == 0) {
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
if (!addr) {
printf("Invalid address\n");
@@ -807,7 +807,7 @@ static int qe_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
*/
if (argc > 3) {
- ulong length = simple_strtoul(argv[3], NULL, 16);
+ ulong length = hextoul(argv[3], NULL);
struct qe_firmware *firmware = (void *)addr;
if (length != be32_to_cpu(firmware->header.length)) {
diff --git a/drivers/ram/octeon/octeon_ddr.c b/drivers/ram/octeon/octeon_ddr.c
index e7b61d39f5..42daf06866 100644
--- a/drivers/ram/octeon/octeon_ddr.c
+++ b/drivers/ram/octeon/octeon_ddr.c
@@ -2544,7 +2544,7 @@ try_again:
eptr = env_get("limit_dram_mbytes");
if (eptr) {
- unsigned int mbytes = simple_strtoul(eptr, NULL, 10);
+ unsigned int mbytes = dectoul(eptr, NULL);
if (mbytes > 0) {
memsize_mbytes = mbytes;
diff --git a/drivers/rtc/m41t60.c b/drivers/rtc/m41t60.c
index 692042b935..b8ad33e012 100644
--- a/drivers/rtc/m41t60.c
+++ b/drivers/rtc/m41t60.c
@@ -214,7 +214,7 @@ void rtc_reset(void)
* the M41T60 documentation for further details.
*/
if (s) {
- unsigned long const l = simple_strtoul(s, 0, 16);
+ unsigned long const l = hextoul(s, 0);
if (l <= 0x3F) {
if ((data[RTC_CTRL] & 0x3F) != l) {
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index ce69750c7f..d93d241928 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -284,7 +284,6 @@ void scsi_init(void)
*/
for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) {
/* get PCI Device ID */
-#ifdef CONFIG_DM_PCI
struct udevice *dev;
int ret;
@@ -294,11 +293,6 @@ void scsi_init(void)
busdevfunc = dm_pci_get_bdf(dev);
break;
}
-#else
- busdevfunc = pci_find_device(scsi_device_list[i].vendor,
- scsi_device_list[i].device,
- 0);
-#endif
if (busdevfunc != -1)
break;
}
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 2b4feace53..8171b17faf 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -395,7 +395,7 @@ static int on_baudrate(const char *name, const char *value, enum env_op op,
/*
* Switch to new baudrate if new baudrate is supported
*/
- baudrate = simple_strtoul(value, NULL, 10);
+ baudrate = dectoul(value, NULL);
/* Not actually changing */
if (gd->baudrate == baudrate)
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index dea25a049c..ebbd21916d 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -61,7 +61,7 @@ static int on_baudrate(const char *name, const char *value, enum env_op op,
/*
* Switch to new baudrate if new baudrate is supported
*/
- baudrate = simple_strtoul(value, NULL, 10);
+ baudrate = dectoul(value, NULL);
/* Not actually changing */
if (gd->baudrate == baudrate)
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index 3d49c22a9d..08d54e86f4 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -918,12 +918,14 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
struct spi_slave *slave = dev_get_parent_priv(dev);
/*
- * Yes this controller can only write a small number of bytes at
+ * Yes this controller can only transfer a small number of bytes at
* once! The limit is typically 64 bytes. For hardware sequencing a
* a loop is used to get around this.
*/
- if (!plat->hwseq)
+ if (!plat->hwseq) {
+ slave->max_read_size = priv->databytes;
slave->max_write_size = priv->databytes;
+ }
/*
* ICH 7 SPI controller only supports array read command
* and byte program command for SST flash
diff --git a/drivers/spi/spi-mem-nodm.c b/drivers/spi/spi-mem-nodm.c
index a228c808c7..77ddb19a9f 100644
--- a/drivers/spi/spi-mem-nodm.c
+++ b/drivers/spi/spi-mem-nodm.c
@@ -93,12 +93,14 @@ int spi_mem_adjust_op_size(struct spi_slave *slave,
if (slave->max_write_size && len > slave->max_write_size)
return -EINVAL;
- if (op->data.dir == SPI_MEM_DATA_IN && slave->max_read_size)
- op->data.nbytes = min(op->data.nbytes,
- slave->max_read_size);
- else if (slave->max_write_size)
+ if (op->data.dir == SPI_MEM_DATA_IN) {
+ if (slave->max_read_size)
+ op->data.nbytes = min(op->data.nbytes,
+ slave->max_read_size);
+ } else if (slave->max_write_size) {
op->data.nbytes = min(op->data.nbytes,
slave->max_write_size - len);
+ }
if (!op->data.nbytes)
return -EINVAL;
diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
index ee81dfa776..8913142654 100644
--- a/drivers/timer/Kconfig
+++ b/drivers/timer/Kconfig
@@ -124,12 +124,12 @@ config RENESAS_OSTM_TIMER
Enables support for the Renesas OSTM Timer driver.
This timer is present on Renesas RZ/A1 R7S72100 SoCs.
-config X86_TSC_TIMER_EARLY_FREQ
- int "x86 TSC timer frequency in MHz when used as the early timer"
+config X86_TSC_TIMER_FREQ
+ int "x86 TSC timer frequency in Hz"
depends on X86_TSC_TIMER
- default 1000
+ default 1000000000
help
- Sets the estimated CPU frequency in MHz when TSC is used as the
+ Sets the estimated CPU frequency in Hz when TSC is used as the
early timer and the frequency can neither be calibrated via some
hardware ways, nor got from device tree at the time when device
tree is not available yet.
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index 7d19a99622..adef50c374 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -425,12 +425,13 @@ static void tsc_timer_ensure_setup(bool early)
goto done;
if (early)
- fast_calibrate = CONFIG_X86_TSC_TIMER_EARLY_FREQ;
+ gd->arch.clock_rate = CONFIG_X86_TSC_TIMER_FREQ;
else
return;
done:
- gd->arch.clock_rate = fast_calibrate * 1000000;
+ if (!gd->arch.clock_rate)
+ gd->arch.clock_rate = fast_calibrate * 1000000;
}
gd->arch.tsc_inited = true;
}
diff --git a/drivers/tpm/Makefile b/drivers/tpm/Makefile
index f64d20067f..c65be52670 100644
--- a/drivers/tpm/Makefile
+++ b/drivers/tpm/Makefile
@@ -6,11 +6,11 @@ obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm-uclass.o
obj-$(CONFIG_TPM_ATMEL_TWI) += tpm_atmel_twi.o
obj-$(CONFIG_TPM_TIS_INFINEON) += tpm_tis_infineon.o
obj-$(CONFIG_TPM_TIS_LPC) += tpm_tis_lpc.o
-obj-$(CONFIG_TPM_TIS_SANDBOX) += tpm_tis_sandbox.o
+obj-$(CONFIG_TPM_TIS_SANDBOX) += tpm_tis_sandbox.o sandbox_common.o
obj-$(CONFIG_TPM_ST33ZP24_I2C) += tpm_tis_st33zp24_i2c.o
obj-$(CONFIG_TPM_ST33ZP24_SPI) += tpm_tis_st33zp24_spi.o
obj-$(CONFIG_$(SPL_TPL_)TPM2_CR50_I2C) += cr50_i2c.o
-obj-$(CONFIG_TPM2_TIS_SANDBOX) += tpm2_tis_sandbox.o
+obj-$(CONFIG_TPM2_TIS_SANDBOX) += tpm2_tis_sandbox.o sandbox_common.o
obj-$(CONFIG_TPM2_TIS_SPI) += tpm2_tis_spi.o
obj-$(CONFIG_TPM2_FTPM_TEE) += tpm2_ftpm_tee.o
diff --git a/drivers/tpm/sandbox_common.c b/drivers/tpm/sandbox_common.c
new file mode 100644
index 0000000000..7e0b2502e3
--- /dev/null
+++ b/drivers/tpm/sandbox_common.c
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Common features for sandbox TPM1 and TPM2 implementations
+ *
+ * Copyright 2021 Google LLC
+ */
+
+#define LOG_CATEGORY UCLASS_TPM
+
+#include <common.h>
+#include <tpm-v1.h>
+#include <tpm-v2.h>
+#include <asm/unaligned.h>
+#include "sandbox_common.h"
+
+#define TPM_ERR_CODE_OFS (2 + 4) /* after tag and size */
+
+int sb_tpm_index_to_seq(u32 index)
+{
+ index &= ~HR_NV_INDEX;
+ switch (index) {
+ case FIRMWARE_NV_INDEX:
+ return NV_SEQ_FIRMWARE;
+ case KERNEL_NV_INDEX:
+ return NV_SEQ_KERNEL;
+ case BACKUP_NV_INDEX:
+ return NV_SEQ_BACKUP;
+ case FWMP_NV_INDEX:
+ return NV_SEQ_FWMP;
+ case MRC_REC_HASH_NV_INDEX:
+ return NV_SEQ_REC_HASH;
+ case 0:
+ return NV_SEQ_GLOBAL_LOCK;
+ case TPM_NV_INDEX_LOCK:
+ return NV_SEQ_ENABLE_LOCKING;
+ }
+
+ printf("Invalid nv index %#x\n", index);
+ return -1;
+}
+
+void sb_tpm_read_data(const struct nvdata_state nvdata[NV_SEQ_COUNT],
+ enum sandbox_nv_space seq, u8 *buf, int data_ofs,
+ int length)
+{
+ const struct nvdata_state *nvd = &nvdata[seq];
+
+ if (!nvd->present)
+ put_unaligned_be32(TPM_BADINDEX, buf + TPM_ERR_CODE_OFS);
+ else if (length > nvd->length)
+ put_unaligned_be32(TPM_BAD_DATASIZE, buf + TPM_ERR_CODE_OFS);
+ else
+ memcpy(buf + data_ofs, &nvd->data, length);
+}
+
+void sb_tpm_write_data(struct nvdata_state nvdata[NV_SEQ_COUNT],
+ enum sandbox_nv_space seq, const u8 *buf, int data_ofs,
+ int length)
+{
+ struct nvdata_state *nvd = &nvdata[seq];
+
+ if (length > nvd->length)
+ log_err("Invalid length %x (max %x)\n", length, nvd->length);
+ else
+ memcpy(&nvdata[seq].data, buf + data_ofs, length);
+}
+
+void sb_tpm_define_data(struct nvdata_state nvdata[NV_SEQ_COUNT],
+ enum sandbox_nv_space seq, int length)
+{
+ struct nvdata_state *nvd = &nvdata[seq];
+
+ if (length > NV_DATA_SIZE)
+ log_err("Invalid length %x (max %x)\n", length, NV_DATA_SIZE);
+ nvd->length = length;
+ nvd->present = true;
+}
diff --git a/drivers/tpm/sandbox_common.h b/drivers/tpm/sandbox_common.h
new file mode 100644
index 0000000000..e822a200fd
--- /dev/null
+++ b/drivers/tpm/sandbox_common.h
@@ -0,0 +1,108 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Common features for sandbox TPM1 and TPM2 implementations
+ *
+ * Copyright 2021 Google LLC
+ */
+
+#ifndef __TPM_SANDBOX_COMMON_H
+#define __TPM_SANDBOX_COMMON_H
+
+/*
+ * These numbers derive from adding the sizes of command fields as shown in
+ * the TPM commands manual.
+ */
+#define TPM_HDR_LEN 10
+
+/* These are the different non-volatile spaces that we emulate */
+enum sandbox_nv_space {
+ NV_SEQ_ENABLE_LOCKING,
+ NV_SEQ_GLOBAL_LOCK,
+ NV_SEQ_FIRMWARE,
+ NV_SEQ_KERNEL,
+ NV_SEQ_BACKUP,
+ NV_SEQ_FWMP,
+ NV_SEQ_REC_HASH,
+
+ NV_SEQ_COUNT,
+};
+
+/* TPM NVRAM location indices */
+#define FIRMWARE_NV_INDEX 0x1007
+#define KERNEL_NV_INDEX 0x1008
+#define BACKUP_NV_INDEX 0x1009
+#define FWMP_NV_INDEX 0x100a
+#define MRC_REC_HASH_NV_INDEX 0x100b
+
+/* Size of each non-volatile space */
+#define NV_DATA_SIZE 0x28
+
+/**
+ * struct nvdata_state - state of a single non-volatile-data 'space'
+ *
+ * @present: true if present
+ * @length: length in bytes (max NV_DATA_SIZE)
+ * @data: contents of non-volatile space
+ */
+struct nvdata_state {
+ bool present;
+ int length;
+ u8 data[NV_DATA_SIZE];
+};
+
+/**
+ * sb_tpm_index_to_seq() - convert an index into a space sequence number
+ *
+ * This converts the index as used by the vboot code into an internal sequence
+ * number used by the sandbox emulation.
+ *
+ * @index: Index to use (FIRMWARE_NV_INDEX, etc.)
+ * @return associated space (enum sandbox_nv_space)
+ */
+int sb_tpm_index_to_seq(uint index);
+
+/**
+ * sb_tpm_read_data() - Read non-volatile data
+ *
+ * This handles a TPM read of nvdata. If the nvdata is not present, a
+ * TPM_BADINDEX error is put in the buffer. If @length is too large,
+ * TPM_BAD_DATASIZE is put in the buffer.
+ *
+ * @nvdata: Current nvdata state
+ * @seq: Sequence number to read
+ * @recvbuf: Buffer to update with the TPM response, assumed to contain zeroes
+ * @data_ofs: Offset of the 'data' portion of @recvbuf
+ * @length: Number of bytes to read
+ */
+void sb_tpm_read_data(const struct nvdata_state nvdata[NV_SEQ_COUNT],
+ enum sandbox_nv_space seq, u8 *recvbuf, int data_ofs,
+ int length);
+
+/**
+ * sb_tpm_write_data() - Write non-volatile data
+ *
+ * If @length is too large, an error is logged and nothing is written.
+ *
+ * @nvdata: Current nvdata state
+ * @seq: Sequence number to read
+ * @buf: Buffer containing the data to write
+ * @data_ofs: Offset of the 'data' portion of @buf
+ * @length: Number of bytes to write
+ */
+void sb_tpm_write_data(struct nvdata_state nvdata[NV_SEQ_COUNT],
+ enum sandbox_nv_space seq, const u8 *buf, int data_ofs,
+ int length);
+
+/**
+ * sb_tpm_define_data() - Set up non-volatile data
+ *
+ * If @length is too large, an error is logged and nothing is written.
+ *
+ * @nvdata: Current nvdata state
+ * @seq: Sequence number to set up
+ * @length: Length of space in bytes
+ */
+void sb_tpm_define_data(struct nvdata_state nvdata[NV_SEQ_COUNT],
+ enum sandbox_nv_space seq, int length);
+
+#endif
diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c
index 24c804a564..ac6eb14353 100644
--- a/drivers/tpm/tpm2_tis_sandbox.c
+++ b/drivers/tpm/tpm2_tis_sandbox.c
@@ -11,6 +11,8 @@
#include <asm/unaligned.h>
#include <linux/bitops.h>
#include <u-boot/crc.h>
+#include <u-boot/sha256.h>
+#include "sandbox_common.h"
/* Hierarchies */
enum tpm2_hierarchy {
@@ -38,29 +40,178 @@ enum tpm2_cap_tpm_property {
#define SANDBOX_TPM_PCR_NB 1
-static const u8 sandbox_extended_once_pcr[] = {
- 0xf5, 0xa5, 0xfd, 0x42, 0xd1, 0x6a, 0x20, 0x30,
- 0x27, 0x98, 0xef, 0x6e, 0xd3, 0x09, 0x97, 0x9b,
- 0x43, 0x00, 0x3d, 0x23, 0x20, 0xd9, 0xf0, 0xe8,
- 0xea, 0x98, 0x31, 0xa9, 0x27, 0x59, 0xfb, 0x4b,
-};
-
+/*
+ * Information about our TPM emulation. This is preserved in the sandbox
+ * state file if enabled.
+ *
+ * @valid: true if this is valid (only used in s_state)
+ * @init_done: true if open() has been called
+ * @startup_done: true if TPM2_CC_STARTUP has been processed
+ * @tests_done: true if TPM2_CC_SELF_TEST has be processed
+ * @pw: TPM password per hierarchy
+ * @pw_sz: Size of each password in bytes
+ * @properties: TPM properties
+ * @pcr: TPM Platform Configuration Registers. Each of these holds a hash and
+ * can be 'extended' a number of times, meaning another hash is added into
+ * its value (initial value all zeroes)
+ * @pcr_extensions: Number of times each PCR has been extended (starts at 0)
+ * @nvdata: non-volatile data, used to store important things for the platform
+ */
struct sandbox_tpm2 {
+ bool valid;
/* TPM internal states */
bool init_done;
bool startup_done;
bool tests_done;
- /* TPM password per hierarchy */
char pw[TPM2_HIERARCHY_NB][TPM2_DIGEST_LEN + 1];
int pw_sz[TPM2_HIERARCHY_NB];
- /* TPM properties */
u32 properties[TPM2_PROPERTY_NB];
- /* TPM PCRs */
u8 pcr[SANDBOX_TPM_PCR_NB][TPM2_DIGEST_LEN];
- /* TPM PCR extensions */
u32 pcr_extensions[SANDBOX_TPM_PCR_NB];
+ struct nvdata_state nvdata[NV_SEQ_COUNT];
};
+static struct sandbox_tpm2 s_state, *g_state;
+
+/**
+ * sandbox_tpm2_read_state() - read the sandbox EC state from the state file
+ *
+ * If data is available, then blob and node will provide access to it. If
+ * not this function sets up an empty TPM.
+ *
+ * @blob: Pointer to device tree blob, or NULL if no data to read
+ * @node: Node offset to read from
+ */
+static int sandbox_tpm2_read_state(const void *blob, int node)
+{
+ struct sandbox_tpm2 *state = &s_state;
+ char prop_name[20];
+ const char *prop;
+ int len;
+ int i;
+
+ if (!blob)
+ return 0;
+ state->tests_done = fdtdec_get_int(blob, node, "tests-done", 0);
+
+ for (i = 0; i < TPM2_HIERARCHY_NB; i++) {
+ snprintf(prop_name, sizeof(prop_name), "pw%d", i);
+
+ prop = fdt_getprop(blob, node, prop_name, &len);
+ if (len > TPM2_DIGEST_LEN)
+ return log_msg_ret("pw", -E2BIG);
+ if (prop) {
+ memcpy(state->pw[i], prop, len);
+ state->pw_sz[i] = len;
+ }
+ }
+
+ for (i = 0; i < TPM2_PROPERTY_NB; i++) {
+ snprintf(prop_name, sizeof(prop_name), "properties%d", i);
+ state->properties[i] = fdtdec_get_uint(blob, node, prop_name,
+ 0);
+ }
+
+ for (i = 0; i < SANDBOX_TPM_PCR_NB; i++) {
+ int subnode;
+
+ snprintf(prop_name, sizeof(prop_name), "pcr%d", i);
+ subnode = fdt_subnode_offset(blob, node, prop_name);
+ if (subnode < 0)
+ continue;
+ prop = fdt_getprop(blob, subnode, "value", &len);
+ if (len != TPM2_DIGEST_LEN)
+ return log_msg_ret("pcr", -E2BIG);
+ memcpy(state->pcr[i], prop, TPM2_DIGEST_LEN);
+ state->pcr_extensions[i] = fdtdec_get_uint(blob, subnode,
+ "extensions", 0);
+ }
+
+ for (i = 0; i < NV_SEQ_COUNT; i++) {
+ struct nvdata_state *nvd = &state->nvdata[i];
+
+ sprintf(prop_name, "nvdata%d", i);
+ prop = fdt_getprop(blob, node, prop_name, &len);
+ if (len > NV_DATA_SIZE)
+ return log_msg_ret("nvd", -E2BIG);
+ if (prop) {
+ memcpy(nvd->data, prop, len);
+ nvd->length = len;
+ nvd->present = true;
+ }
+ }
+ s_state.valid = true;
+
+ return 0;
+}
+
+/**
+ * sandbox_tpm2_write_state() - Write out our state to the state file
+ *
+ * The caller will ensure that there is a node ready for the state. The node
+ * may already contain the old state, in which case it is overridden.
+ *
+ * @blob: Device tree blob holding state
+ * @node: Node to write our state into
+ */
+static int sandbox_tpm2_write_state(void *blob, int node)
+{
+ const struct sandbox_tpm2 *state = g_state;
+ char prop_name[20];
+ int i;
+
+ if (!state)
+ return 0;
+
+ /*
+ * We are guaranteed enough space to write basic properties. This is
+ * SANDBOX_STATE_MIN_SPACE.
+ *
+ * We could use fdt_add_subnode() to put each set of data in its
+ * own node - perhaps useful if we add access information to each.
+ */
+ fdt_setprop_u32(blob, node, "tests-done", state->tests_done);
+
+ for (i = 0; i < TPM2_HIERARCHY_NB; i++) {
+ if (state->pw_sz[i]) {
+ snprintf(prop_name, sizeof(prop_name), "pw%d", i);
+ fdt_setprop(blob, node, prop_name, state->pw[i],
+ state->pw_sz[i]);
+ }
+ }
+
+ for (i = 0; i < TPM2_PROPERTY_NB; i++) {
+ snprintf(prop_name, sizeof(prop_name), "properties%d", i);
+ fdt_setprop_u32(blob, node, prop_name, state->properties[i]);
+ }
+
+ for (i = 0; i < SANDBOX_TPM_PCR_NB; i++) {
+ int subnode;
+
+ snprintf(prop_name, sizeof(prop_name), "pcr%d", i);
+ subnode = fdt_add_subnode(blob, node, prop_name);
+ fdt_setprop(blob, subnode, "value", state->pcr[i],
+ TPM2_DIGEST_LEN);
+ fdt_setprop_u32(blob, subnode, "extensions",
+ state->pcr_extensions[i]);
+ }
+
+ for (i = 0; i < NV_SEQ_COUNT; i++) {
+ const struct nvdata_state *nvd = &state->nvdata[i];
+
+ if (nvd->present) {
+ snprintf(prop_name, sizeof(prop_name), "nvdata%d", i);
+ fdt_setprop(blob, node, prop_name, nvd->data,
+ nvd->length);
+ }
+ }
+
+ return 0;
+}
+
+SANDBOX_STATE_IO(sandbox_tpm2, "sandbox,tpm2", sandbox_tpm2_read_state,
+ sandbox_tpm2_write_state);
+
/*
* Check the tag validity depending on the command (authentication required or
* not). If authentication is required, check it is valid. Update the auth
@@ -93,6 +244,10 @@ static int sandbox_tpm2_check_session(struct udevice *dev, u32 command, u16 tag,
case TPM2_CC_DAM_RESET:
case TPM2_CC_DAM_PARAMETERS:
case TPM2_CC_PCR_EXTEND:
+ case TPM2_CC_NV_READ:
+ case TPM2_CC_NV_WRITE:
+ case TPM2_CC_NV_WRITELOCK:
+ case TPM2_CC_NV_DEFINE_SPACE:
if (tag != TPM2_ST_SESSIONS) {
printf("Session required for command 0x%x\n", command);
return TPM2_RC_AUTH_CONTEXT;
@@ -121,6 +276,10 @@ static int sandbox_tpm2_check_session(struct udevice *dev, u32 command, u16 tag,
break;
case TPM2_RH_PLATFORM:
*hierarchy = TPM2_HIERARCHY_PLATFORM;
+ if (command == TPM2_CC_NV_READ ||
+ command == TPM2_CC_NV_WRITE ||
+ command == TPM2_CC_NV_WRITELOCK)
+ *auth += sizeof(u32);
break;
default:
printf("Wrong handle 0x%x\n", handle);
@@ -242,15 +401,17 @@ static int sandbox_tpm2_extend(struct udevice *dev, int pcr_index,
const u8 *extension)
{
struct sandbox_tpm2 *tpm = dev_get_priv(dev);
- int i;
+ sha256_context ctx;
- /* Only simulate the first extensions from all '0' with only '0' */
- for (i = 0; i < TPM2_DIGEST_LEN; i++)
- if (tpm->pcr[pcr_index][i] || extension[i])
- return TPM2_RC_FAILURE;
+ /* Zero the PCR if this is the first use */
+ if (!tpm->pcr_extensions[pcr_index])
+ memset(tpm->pcr[pcr_index], '\0', TPM2_DIGEST_LEN);
+
+ sha256_starts(&ctx);
+ sha256_update(&ctx, tpm->pcr[pcr_index], TPM2_DIGEST_LEN);
+ sha256_update(&ctx, extension, TPM2_DIGEST_LEN);
+ sha256_finish(&ctx, tpm->pcr[pcr_index]);
- memcpy(tpm->pcr[pcr_index], sandbox_extended_once_pcr,
- TPM2_DIGEST_LEN);
tpm->pcr_extensions[pcr_index]++;
return 0;
@@ -477,15 +638,8 @@ static int sandbox_tpm2_xfer(struct udevice *dev, const u8 *sendbuf,
for (i = 0; i < pcr_array_sz; i++)
pcr_map += (u64)sent[i] << (i * 8);
- if (pcr_map >> SANDBOX_TPM_PCR_NB) {
- printf("Sandbox TPM handles up to %d PCR(s)\n",
- SANDBOX_TPM_PCR_NB);
- rc = TPM2_RC_VALUE;
- return sandbox_tpm2_fill_buf(recv, recv_len, tag, rc);
- }
-
if (!pcr_map) {
- printf("Empty PCR map.\n");
+ printf("Empty PCR map\n");
rc = TPM2_RC_VALUE;
return sandbox_tpm2_fill_buf(recv, recv_len, tag, rc);
}
@@ -494,6 +648,13 @@ static int sandbox_tpm2_xfer(struct udevice *dev, const u8 *sendbuf,
if (pcr_map & BIT(i))
pcr_index = i;
+ if (pcr_index >= SANDBOX_TPM_PCR_NB) {
+ printf("Invalid index %d, sandbox TPM handles up to %d PCR(s)\n",
+ pcr_index, SANDBOX_TPM_PCR_NB);
+ rc = TPM2_RC_VALUE;
+ return sandbox_tpm2_fill_buf(recv, recv_len, tag, rc);
+ }
+
/* Write tag */
put_unaligned_be16(tag, recv);
recv += sizeof(tag);
@@ -527,9 +688,9 @@ static int sandbox_tpm2_xfer(struct udevice *dev, const u8 *sendbuf,
pcr_index = get_unaligned_be32(sendbuf + sizeof(tag) +
sizeof(length) +
sizeof(command));
- if (pcr_index > SANDBOX_TPM_PCR_NB) {
- printf("Sandbox TPM handles up to %d PCR(s)\n",
- SANDBOX_TPM_PCR_NB);
+ if (pcr_index >= SANDBOX_TPM_PCR_NB) {
+ printf("Invalid index %d, sandbox TPM handles up to %d PCR(s)\n",
+ pcr_index, SANDBOX_TPM_PCR_NB);
rc = TPM2_RC_VALUE;
}
@@ -557,6 +718,64 @@ static int sandbox_tpm2_xfer(struct udevice *dev, const u8 *sendbuf,
sandbox_tpm2_fill_buf(recv, recv_len, tag, rc);
break;
+ case TPM2_CC_NV_READ: {
+ int index, seq;
+
+ index = get_unaligned_be32(sendbuf + TPM2_HDR_LEN + 4);
+ length = get_unaligned_be16(sent);
+ /* ignore offset */
+ seq = sb_tpm_index_to_seq(index);
+ if (seq < 0)
+ return log_msg_ret("index", -EINVAL);
+ printf("tpm: nvread index=%#02x, len=%#02x, seq=%#02x\n", index,
+ length, seq);
+ *recv_len = TPM2_HDR_LEN + 6 + length;
+ memset(recvbuf, '\0', *recv_len);
+ put_unaligned_be32(length, recvbuf + 2);
+ sb_tpm_read_data(tpm->nvdata, seq, recvbuf,
+ TPM2_HDR_LEN + 4 + 2, length);
+ break;
+ }
+ case TPM2_CC_NV_WRITE: {
+ int index, seq;
+
+ index = get_unaligned_be32(sendbuf + TPM2_HDR_LEN + 4);
+ length = get_unaligned_be16(sent);
+ sent += sizeof(u16);
+
+ /* ignore offset */
+ seq = sb_tpm_index_to_seq(index);
+ if (seq < 0)
+ return log_msg_ret("index", -EINVAL);
+ printf("tpm: nvwrite index=%#02x, len=%#02x, seq=%#02x\n", index,
+ length, seq);
+ memcpy(&tpm->nvdata[seq].data, sent, length);
+ tpm->nvdata[seq].present = true;
+ *recv_len = TPM2_HDR_LEN + 2;
+ memset(recvbuf, '\0', *recv_len);
+ break;
+ }
+ case TPM2_CC_NV_DEFINE_SPACE: {
+ int policy_size, index, seq;
+
+ policy_size = get_unaligned_be16(sent + 12);
+ index = get_unaligned_be32(sent + 2);
+ sent += 14 + policy_size;
+ length = get_unaligned_be16(sent);
+ seq = sb_tpm_index_to_seq(index);
+ if (seq < 0)
+ return -EINVAL;
+ printf("tpm: define_space index=%x, len=%x, seq=%x, policy_size=%x\n",
+ index, length, seq, policy_size);
+ sb_tpm_define_data(tpm->nvdata, seq, length);
+ *recv_len = 12;
+ memset(recvbuf, '\0', *recv_len);
+ break;
+ }
+ case TPM2_CC_NV_WRITELOCK:
+ *recv_len = 12;
+ memset(recvbuf, '\0', *recv_len);
+ break;
default:
printf("TPM2 command %02x unknown in Sandbox\n", command);
rc = TPM2_RC_COMMAND_CODE;
@@ -594,11 +813,13 @@ static int sandbox_tpm2_probe(struct udevice *dev)
/* Use the TPM v2 stack */
priv->version = TPM_V2;
- memset(tpm, 0, sizeof(*tpm));
-
priv->pcr_count = 32;
priv->pcr_select_min = 2;
+ if (s_state.valid)
+ memcpy(tpm, &s_state, sizeof(*tpm));
+ g_state = tpm;
+
return 0;
}
diff --git a/drivers/tpm/tpm_tis_sandbox.c b/drivers/tpm/tpm_tis_sandbox.c
index 67139cea3b..efbeb00ab6 100644
--- a/drivers/tpm/tpm_tis_sandbox.c
+++ b/drivers/tpm/tpm_tis_sandbox.c
@@ -9,61 +9,10 @@
#include <asm/state.h>
#include <asm/unaligned.h>
#include <u-boot/crc.h>
-
-/* TPM NVRAM location indices. */
-#define FIRMWARE_NV_INDEX 0x1007
-#define KERNEL_NV_INDEX 0x1008
-#define BACKUP_NV_INDEX 0x1009
-#define FWMP_NV_INDEX 0x100a
-#define REC_HASH_NV_INDEX 0x100b
-#define REC_HASH_NV_SIZE VB2_SHA256_DIGEST_SIZE
+#include "sandbox_common.h"
#define NV_DATA_PUBLIC_PERMISSIONS_OFFSET 60
-/* Kernel TPM space - KERNEL_NV_INDEX, locked with physical presence */
-#define ROLLBACK_SPACE_KERNEL_VERSION 2
-#define ROLLBACK_SPACE_KERNEL_UID 0x4752574C /* 'GRWL' */
-
-struct rollback_space_kernel {
- /* Struct version, for backwards compatibility */
- uint8_t struct_version;
- /* Unique ID to detect space redefinition */
- uint32_t uid;
- /* Kernel versions */
- uint32_t kernel_versions;
- /* Reserved for future expansion */
- uint8_t reserved[3];
- /* Checksum (v2 and later only) */
- uint8_t crc8;
-} __packed rollback_space_kernel;
-
-/*
- * These numbers derive from adding the sizes of command fields as shown in
- * the TPM commands manual.
- */
-#define TPM_REQUEST_HEADER_LENGTH 10
-#define TPM_RESPONSE_HEADER_LENGTH 10
-
-/* These are the different non-volatile spaces that we emulate */
-enum {
- NV_GLOBAL_LOCK,
- NV_SEQ_FIRMWARE,
- NV_SEQ_KERNEL,
- NV_SEQ_BACKUP,
- NV_SEQ_FWMP,
- NV_SEQ_REC_HASH,
-
- NV_SEQ_COUNT,
-};
-
-/* Size of each non-volatile space */
-#define NV_DATA_SIZE 0x20
-
-struct nvdata_state {
- bool present;
- u8 data[NV_DATA_SIZE];
-};
-
/*
* Information about our TPM emulation. This is preserved in the sandbox
* state file if enabled.
@@ -71,7 +20,7 @@ struct nvdata_state {
static struct tpm_state {
bool valid;
struct nvdata_state nvdata[NV_SEQ_COUNT];
-} g_state;
+} s_state, *g_state;
/**
* sandbox_tpm_read_state() - read the sandbox EC state from the state file
@@ -84,6 +33,7 @@ static struct tpm_state {
*/
static int sandbox_tpm_read_state(const void *blob, int node)
{
+ struct tpm_state *state = &s_state;
const char *prop;
int len;
int i;
@@ -92,22 +42,27 @@ static int sandbox_tpm_read_state(const void *blob, int node)
return 0;
for (i = 0; i < NV_SEQ_COUNT; i++) {
+ struct nvdata_state *nvd = &state->nvdata[i];
char prop_name[20];
sprintf(prop_name, "nvdata%d", i);
prop = fdt_getprop(blob, node, prop_name, &len);
- if (prop && len == NV_DATA_SIZE) {
- memcpy(g_state.nvdata[i].data, prop, NV_DATA_SIZE);
- g_state.nvdata[i].present = true;
+ if (len >= NV_DATA_SIZE)
+ return log_msg_ret("nvd", -E2BIG);
+ if (prop) {
+ memcpy(nvd->data, prop, len);
+ nvd->length = len;
+ nvd->present = true;
}
}
- g_state.valid = true;
+
+ s_state.valid = true;
return 0;
}
/**
- * cros_ec_write_state() - Write out our state to the state file
+ * sandbox_tpm_write_state() - Write out our state to the state file
*
* The caller will ensure that there is a node ready for the state. The node
* may already contain the old state, in which case it is overridden.
@@ -117,20 +72,25 @@ static int sandbox_tpm_read_state(const void *blob, int node)
*/
static int sandbox_tpm_write_state(void *blob, int node)
{
+ const struct tpm_state *state = g_state;
int i;
+ if (!state)
+ return 0;
+
/*
* We are guaranteed enough space to write basic properties.
* We could use fdt_add_subnode() to put each set of data in its
* own node - perhaps useful if we add access informaiton to each.
*/
for (i = 0; i < NV_SEQ_COUNT; i++) {
+ const struct nvdata_state *nvd = &state->nvdata[i];
char prop_name[20];
- if (g_state.nvdata[i].present) {
- sprintf(prop_name, "nvdata%d", i);
- fdt_setprop(blob, node, prop_name,
- g_state.nvdata[i].data, NV_DATA_SIZE);
+ if (nvd->present) {
+ snprintf(prop_name, sizeof(prop_name), "nvdata%d", i);
+ fdt_setprop(blob, node, prop_name, nvd->data,
+ nvd->length);
}
}
@@ -140,27 +100,6 @@ static int sandbox_tpm_write_state(void *blob, int node)
SANDBOX_STATE_IO(sandbox_tpm, "google,sandbox-tpm", sandbox_tpm_read_state,
sandbox_tpm_write_state);
-static int index_to_seq(uint32_t index)
-{
- switch (index) {
- case FIRMWARE_NV_INDEX:
- return NV_SEQ_FIRMWARE;
- case KERNEL_NV_INDEX:
- return NV_SEQ_KERNEL;
- case BACKUP_NV_INDEX:
- return NV_SEQ_BACKUP;
- case FWMP_NV_INDEX:
- return NV_SEQ_FWMP;
- case REC_HASH_NV_INDEX:
- return NV_SEQ_REC_HASH;
- case 0:
- return NV_GLOBAL_LOCK;
- }
-
- printf("Invalid nv index %#x\n", index);
- return -1;
-}
-
static void handle_cap_flag_space(u8 **datap, uint index)
{
struct tpm_nv_data_public pub;
@@ -201,16 +140,13 @@ static int sandbox_tpm_xfer(struct udevice *dev, const uint8_t *sendbuf,
printf("Get flags index %#02x\n", index);
*recv_len = 22;
memset(recvbuf, '\0', *recv_len);
- data = recvbuf + TPM_RESPONSE_HEADER_LENGTH +
- sizeof(uint32_t);
+ data = recvbuf + TPM_HDR_LEN + sizeof(uint32_t);
switch (index) {
case FIRMWARE_NV_INDEX:
break;
case KERNEL_NV_INDEX:
handle_cap_flag_space(&data, index);
- *recv_len = data - recvbuf -
- TPM_RESPONSE_HEADER_LENGTH -
- sizeof(uint32_t);
+ *recv_len = data - recvbuf;
break;
case TPM_CAP_FLAG_PERMANENT: {
struct tpm_permanent_flags *pflags;
@@ -227,15 +163,12 @@ static int sandbox_tpm_xfer(struct udevice *dev, const uint8_t *sendbuf,
printf(" ** Unknown flags index %x\n", index);
return -ENOSYS;
}
- put_unaligned_be32(*recv_len,
- recvbuf +
- TPM_RESPONSE_HEADER_LENGTH);
+ put_unaligned_be32(*recv_len, recvbuf + TPM_HDR_LEN);
break;
case TPM_CAP_NV_INDEX:
index = get_unaligned_be32(sendbuf + 18);
printf("Get cap nv index %#02x\n", index);
- put_unaligned_be32(22, recvbuf +
- TPM_RESPONSE_HEADER_LENGTH);
+ put_unaligned_be32(22, recvbuf + TPM_HDR_LEN);
break;
default:
printf(" ** Unknown 0x65 command type %#02x\n",
@@ -246,54 +179,42 @@ static int sandbox_tpm_xfer(struct udevice *dev, const uint8_t *sendbuf,
case TPM_CMD_NV_WRITE_VALUE:
index = get_unaligned_be32(sendbuf + 10);
length = get_unaligned_be32(sendbuf + 18);
- seq = index_to_seq(index);
+ seq = sb_tpm_index_to_seq(index);
if (seq < 0)
return -EINVAL;
printf("tpm: nvwrite index=%#02x, len=%#02x\n", index, length);
- memcpy(&tpm->nvdata[seq].data, sendbuf + 22, length);
- tpm->nvdata[seq].present = true;
- *recv_len = 12;
- memset(recvbuf, '\0', *recv_len);
+ sb_tpm_write_data(tpm->nvdata, seq, sendbuf, 22, length);
break;
case TPM_CMD_NV_READ_VALUE: /* nvread */
index = get_unaligned_be32(sendbuf + 10);
length = get_unaligned_be32(sendbuf + 18);
- seq = index_to_seq(index);
+ seq = sb_tpm_index_to_seq(index);
if (seq < 0)
return -EINVAL;
printf("tpm: nvread index=%#02x, len=%#02x, seq=%#02x\n", index,
length, seq);
- *recv_len = TPM_RESPONSE_HEADER_LENGTH + sizeof(uint32_t) +
- length;
+ *recv_len = TPM_HDR_LEN + sizeof(uint32_t) + length;
memset(recvbuf, '\0', *recv_len);
- put_unaligned_be32(length, recvbuf +
- TPM_RESPONSE_HEADER_LENGTH);
- if (seq == NV_SEQ_KERNEL) {
- struct rollback_space_kernel rsk;
-
- data = recvbuf + TPM_RESPONSE_HEADER_LENGTH +
- sizeof(uint32_t);
- memset(&rsk, 0, sizeof(struct rollback_space_kernel));
- rsk.struct_version = 2;
- rsk.uid = ROLLBACK_SPACE_KERNEL_UID;
- rsk.crc8 = crc8(0, (unsigned char *)&rsk,
- offsetof(struct rollback_space_kernel,
- crc8));
- memcpy(data, &rsk, sizeof(rsk));
- } else if (!tpm->nvdata[seq].present) {
- put_unaligned_be32(TPM_BADINDEX, recvbuf +
- sizeof(uint16_t) + sizeof(uint32_t));
- } else {
- memcpy(recvbuf + TPM_RESPONSE_HEADER_LENGTH +
- sizeof(uint32_t), &tpm->nvdata[seq].data,
- length);
- }
+ put_unaligned_be32(length, recvbuf + TPM_HDR_LEN);
+ sb_tpm_read_data(tpm->nvdata, seq, recvbuf, TPM_HDR_LEN + 4,
+ length);
break;
case TPM_CMD_EXTEND:
*recv_len = 30;
memset(recvbuf, '\0', *recv_len);
break;
case TPM_CMD_NV_DEFINE_SPACE:
+ index = get_unaligned_be32(sendbuf + 12);
+ length = get_unaligned_be32(sendbuf + 77);
+ seq = sb_tpm_index_to_seq(index);
+ if (seq < 0)
+ return -EINVAL;
+ printf("tpm: define_space index=%#02x, len=%#02x, seq=%#02x\n",
+ index, length, seq);
+ sb_tpm_define_data(tpm->nvdata, seq, length);
+ *recv_len = 12;
+ memset(recvbuf, '\0', *recv_len);
+ break;
case 0x15: /* pcr read */
case 0x5d: /* force clear */
case 0x6f: /* physical enable */
@@ -328,7 +249,9 @@ static int sandbox_tpm_probe(struct udevice *dev)
{
struct tpm_state *tpm = dev_get_priv(dev);
- memcpy(tpm, &g_state, sizeof(*tpm));
+ if (s_state.valid)
+ memcpy(tpm, &s_state, sizeof(*tpm));
+ g_state = tpm;
return 0;
}
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 83dbb5a103..fcaeab9cc1 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -1659,7 +1659,7 @@ cdns3_endpoint *cdns3_find_available_ep(struct cdns3_device *priv_dev,
/* ep name pattern likes epXin or epXout */
char c[2] = {ep->name[2], '\0'};
- num = simple_strtoul(c, NULL, 10);
+ num = dectoul(c, NULL);
priv_ep = ep_to_cdns3_ep(ep);
if (cdns3_ep_dir_is_correct(desc, priv_ep)) {
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 7da334f5d3..01337d6511 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -144,7 +144,7 @@ static int ep_matches(
/* report address */
if (isdigit(ep->name[2])) {
- u8 num = simple_strtoul(&ep->name[2], NULL, 10);
+ u8 num = dectoul(&ep->name[2], NULL);
desc->bEndpointAddress |= num;
#ifdef MANY_ENDPOINTS
} else if (desc->bEndpointAddress & USB_DIR_IN) {
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 16922ff15c..4307328657 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2401,8 +2401,7 @@ static int _usb_eth_init(struct ether_priv *priv)
usb_gadget_connect(gadget);
if (env_get("cdc_connect_timeout"))
- timeout = simple_strtoul(env_get("cdc_connect_timeout"),
- NULL, 10) * CONFIG_SYS_HZ;
+ timeout = dectoul(env_get("cdc_connect_timeout"), NULL) * CONFIG_SYS_HZ;
ts = get_timer(0);
while (!dev->network_started) {
/* Handle control-c and timeouts */
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index c62d8feecc..fedf0db9c7 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -54,7 +54,7 @@
#if defined(CONFIG_CPU_ARM920T) || \
defined(CONFIG_PCI_OHCI) || \
- defined(CONFIG_DM_PCI) || \
+ defined(CONFIG_PCI) || \
defined(CONFIG_SYS_OHCI_USE_NPS)
# define OHCI_USE_NPS /* force NoPowerSwitching mode */
#endif
diff --git a/drivers/video/ati_radeon_fb.c b/drivers/video/ati_radeon_fb.c
index c4da2e3ae7..383666781c 100644
--- a/drivers/video/ati_radeon_fb.c
+++ b/drivers/video/ati_radeon_fb.c
@@ -642,7 +642,7 @@ void *video_hw_init(void)
if (penv) {
/* deceide if it is a string */
if (penv[0] <= '9') {
- videomode = (int) simple_strtoul (penv, NULL, 16);
+ videomode = (int)hextoul(penv, NULL);
tmp = 1;
}
} else {
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 1f491a48d6..5e1ee061e8 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1857,7 +1857,7 @@ static void *video_logo(void)
ret = splash_screen_prepare();
if (ret < 0)
return video_fb_address;
- addr = simple_strtoul(s, NULL, 16);
+ addr = hextoul(s, NULL);
if (video_display_bitmap(addr,
video_logo_xpos,
diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index fa11b3bbef..98427f4c61 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -128,38 +128,36 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr)
struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
struct console_tt_priv *priv = dev_get_priv(dev);
void *end, *line;
- int pixels = priv->font_size * vid_priv->line_length;
- int i, ret;
+ int ret;
line = vid_priv->fb + row * priv->font_size * vid_priv->line_length;
+ end = line + priv->font_size * vid_priv->line_length;
+
switch (vid_priv->bpix) {
#ifdef CONFIG_VIDEO_BPP8
case VIDEO_BPP8: {
- uint8_t *dst = line;
+ u8 *dst;
- for (i = 0; i < pixels; i++)
- *dst++ = clr;
- end = dst;
+ for (dst = line; dst < (u8 *)end; ++dst)
+ *dst = clr;
break;
}
#endif
#ifdef CONFIG_VIDEO_BPP16
case VIDEO_BPP16: {
- uint16_t *dst = line;
+ u16 *dst = line;
- for (i = 0; i < pixels; i++)
- *dst++ = clr;
- end = dst;
+ for (dst = line; dst < (u16 *)end; ++dst)
+ *dst = clr;
break;
}
#endif
#ifdef CONFIG_VIDEO_BPP32
case VIDEO_BPP32: {
- uint32_t *dst = line;
+ u32 *dst = line;
- for (i = 0; i < pixels; i++)
- *dst++ = clr;
- end = dst;
+ for (dst = line; dst < (u32 *)end; ++dst)
+ *dst = clr;
break;
}
#endif
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index 9b42ca8d03..e6dd2b83c6 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -820,7 +820,7 @@ void *video_hw_init(void)
if (penv) {
/* decide if it is a string */
if (penv[0] <= '9') {
- videomode = (int) simple_strtoul(penv, NULL, 16);
+ videomode = (int)hextoul(penv, NULL);
tmp = 1;
}
} else {
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 8f7d987cdd..8132efa55a 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -692,8 +692,8 @@ static int do_video_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,
if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
return CMD_RET_FAILURE;
- col = simple_strtoul(argv[1], NULL, 10);
- row = simple_strtoul(argv[2], NULL, 10);
+ col = dectoul(argv[1], NULL);
+ row = dectoul(argv[2], NULL);
vidconsole_position_cursor(dev, col, row);
return 0;
diff --git a/examples/standalone/atmel_df_pow2.c b/examples/standalone/atmel_df_pow2.c
index 9c74f4994b..dcb25da949 100644
--- a/examples/standalone/atmel_df_pow2.c
+++ b/examples/standalone/atmel_df_pow2.c
@@ -141,11 +141,12 @@ int atmel_df_pow2(int argc, char *const argv[])
if (line[0] == '\0')
continue;
- bus = cs = simple_strtoul(line, &p, 10);
+ bus = dectoul(line, &p);
+ cs = bus;
if (*p) {
if (*p == ':') {
++p;
- cs = simple_strtoul(p, &p, 10);
+ cs = dectoul(p, &p);
}
if (*p) {
puts("invalid format, please try again\n");
diff --git a/fs/fs.c b/fs/fs.c
index b7936fd4cf..7c682582c8 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -717,13 +717,13 @@ int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
}
if (argc >= 4) {
- addr = simple_strtoul(argv[3], &ep, 16);
+ addr = hextoul(argv[3], &ep);
if (ep == argv[3] || *ep != '\0')
return CMD_RET_USAGE;
} else {
addr_str = env_get("loadaddr");
if (addr_str != NULL)
- addr = simple_strtoul(addr_str, NULL, 16);
+ addr = hextoul(addr_str, NULL);
else
addr = CONFIG_SYS_LOAD_ADDR;
}
@@ -737,11 +737,11 @@ int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
}
}
if (argc >= 6)
- bytes = simple_strtoul(argv[5], NULL, 16);
+ bytes = hextoul(argv[5], NULL);
else
bytes = 0;
if (argc >= 7)
- pos = simple_strtoul(argv[6], NULL, 16);
+ pos = hextoul(argv[6], NULL);
else
pos = 0;
@@ -815,11 +815,11 @@ int do_save(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
if (fs_set_blk_dev(argv[1], argv[2], fstype))
return 1;
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = argv[4];
- bytes = simple_strtoul(argv[5], NULL, 16);
+ bytes = hextoul(argv[5], NULL);
if (argc >= 7)
- pos = simple_strtoul(argv[6], NULL, 16);
+ pos = hextoul(argv[6], NULL);
else
pos = 0;
diff --git a/fs/squashfs/sqfs_filesystem.h b/fs/squashfs/sqfs_filesystem.h
index 856cd15e34..5440b6c0e0 100644
--- a/fs/squashfs/sqfs_filesystem.h
+++ b/fs/squashfs/sqfs_filesystem.h
@@ -231,7 +231,7 @@ union squashfs_inode {
struct squashfs_directory_entry {
u16 offset;
- u16 inode_offset;
+ s16 inode_offset;
u16 type;
u16 name_size;
char name[0];
diff --git a/include/autoboot.h b/include/autoboot.h
index ac8157e570..d6915dd0cc 100644
--- a/include/autoboot.h
+++ b/include/autoboot.h
@@ -11,6 +11,42 @@
#ifndef __AUTOBOOT_H
#define __AUTOBOOT_H
+#include <stdbool.h>
+
+#ifdef CONFIG_SANDBOX
+
+/**
+ * autoboot_keyed() - check whether keyed autoboot should be used
+ *
+ * This is only implemented for sandbox since other platforms don't have a way
+ * of controlling the feature at runtime.
+ *
+ * @return true if enabled, false if not
+ */
+bool autoboot_keyed(void);
+
+/**
+ * autoboot_set_keyed() - set whether keyed autoboot should be used
+ *
+ * @autoboot_keyed: true to enable the feature, false to disable
+ * @return old value of the flag
+ */
+bool autoboot_set_keyed(bool autoboot_keyed);
+#else
+static inline bool autoboot_keyed(void)
+{
+ /* There is no runtime flag, so just use the CONFIG */
+ return IS_ENABLED(CONFIG_AUTOBOOT_KEYED);
+}
+
+static inline bool autoboot_set_keyed(bool autoboot_keyed)
+{
+ /* There is no runtime flag to set */
+ return false;
+}
+
+#endif
+
#ifdef CONFIG_AUTOBOOT
/**
* bootdelay_process() - process the bootd delay
diff --git a/include/bios_emul.h b/include/bios_emul.h
index 158e0f223d..72410dc794 100644
--- a/include/bios_emul.h
+++ b/include/bios_emul.h
@@ -30,11 +30,7 @@ typedef struct {
int bus;
u32 VendorID;
u32 DeviceID;
-#ifdef CONFIG_DM_PCI
struct udevice *pcidev;
-#else
- pci_dev_t pcidev;
-#endif
void *BIOSImage;
u32 BIOSImageLen;
u8 LowMem[1536];
@@ -42,12 +38,8 @@ typedef struct {
struct vbe_mode_info;
-#ifdef CONFIG_DM_PCI
int BootVideoCardBIOS(struct udevice *pcidev, BE_VGAInfo **pVGAInfo,
int clean_up);
-#else
-int BootVideoCardBIOS(pci_dev_t pcidev, BE_VGAInfo **pVGAInfo, int clean_up);
-#endif
/* Run a BIOS ROM natively (only supported on x86 machines) */
void bios_run_on_x86(struct udevice *dev, unsigned long addr, int vesa_mode,
@@ -65,18 +57,10 @@ void bios_set_interrupt_handler(int intnum, int (*int_handler_func)(void));
void biosemu_set_interrupt_handler(int intnum, int (*int_func)(void));
-#ifdef CONFIG_DM_PCI
int biosemu_setup(struct udevice *pcidev, BE_VGAInfo **pVGAInfo);
int biosemu_run(struct udevice *dev, uchar *bios_rom, int bios_len,
BE_VGAInfo *vga_info, int clean_up, int vesa_mode,
struct vbe_mode_info *mode_info);
-#else
-int biosemu_setup(pci_dev_t pcidev, BE_VGAInfo **pVGAInfo);
-
-int biosemu_run(pci_dev_t pcidev, uchar *bios_rom, int bios_len,
- BE_VGAInfo *vga_info, int clean_up, int vesa_mode,
- struct vbe_mode_info *mode_info);
-#endif
#endif
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index e70423f25d..750e9e04e8 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -265,7 +265,7 @@
BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_IDE
#endif
-#if defined(CONFIG_DM_PCI)
+#if defined(CONFIG_PCI)
#define BOOTENV_RUN_PCI_ENUM "run boot_pci_enum; "
#define BOOTENV_SHARED_PCI \
"boot_pci_enum=pci enum\0"
diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h
index 4dad6a58ff..d6ae419456 100644
--- a/include/configs/MPC8349EMDS.h
+++ b/include/configs/MPC8349EMDS.h
@@ -228,7 +228,6 @@
#endif
#undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
-#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */
#endif /* CONFIG_PCI */
diff --git a/include/configs/MPC8349EMDS_SDRAM.h b/include/configs/MPC8349EMDS_SDRAM.h
index f7c13d417f..8ebca99d98 100644
--- a/include/configs/MPC8349EMDS_SDRAM.h
+++ b/include/configs/MPC8349EMDS_SDRAM.h
@@ -283,7 +283,6 @@
#endif
#undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
-#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */
#endif /* CONFIG_PCI */
diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index e16a5930ad..0a136b4f92 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -258,7 +258,6 @@
#define CONFIG_PCI_INDIRECT_BRIDGE
#undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
-#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */
#endif /* CONFIG_PCI */
/*
diff --git a/include/configs/MPC8540ADS.h b/include/configs/MPC8540ADS.h
index d843ba1ff7..ac9afa179a 100644
--- a/include/configs/MPC8540ADS.h
+++ b/include/configs/MPC8540ADS.h
@@ -241,7 +241,6 @@
#endif
#undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
-#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1057 /* Motorola */
#endif /* CONFIG_PCI */
diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h
index 2046bf215b..d3e5da0c43 100644
--- a/include/configs/MPC8548CDS.h
+++ b/include/configs/MPC8548CDS.h
@@ -310,7 +310,6 @@ extern unsigned long get_clock_freq(void);
/* EEPROM */
#define CONFIG_ID_EEPROM
#define CONFIG_SYS_I2C_EEPROM_CCID
-#define CONFIG_SYS_ID_EEPROM
#define CONFIG_SYS_I2C_EEPROM_ADDR 0x57
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
@@ -371,23 +370,7 @@ extern unsigned long get_clock_freq(void);
#endif
#if defined(CONFIG_PCI)
-
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT 1 /* Use common FSL init code */
-#define CONFIG_PCI_INDIRECT_BRIDGE 1
-#define CONFIG_SYS_PCIE1_NAME "Slot"
-#ifdef CONFIG_PHYS_64BIT
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
-#else
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xa0000000
-#endif
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00100000 /* 1M */
-#endif
-
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
-
#endif /* CONFIG_PCI */
#if defined(CONFIG_TSEC_ENET)
diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h
index 464e7c7284..02aeb6f3d5 100644
--- a/include/configs/MPC8560ADS.h
+++ b/include/configs/MPC8560ADS.h
@@ -238,7 +238,6 @@
#endif
#undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
-#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1057 /* Motorola */
#endif /* CONFIG_PCI */
diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h
index f5209e1796..b7e44d1737 100644
--- a/include/configs/P1010RDB.h
+++ b/include/configs/P1010RDB.h
@@ -150,34 +150,6 @@
#define CONFIG_SYS_PCIE2_IO_PHYS 0xffc10000
#endif
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_PCI_INDIRECT_BRIDGE /* indirect PCI bridge support */
-#define CONFIG_SYS_PCIE1_NAME "mini PCIe Slot"
-#ifdef CONFIG_PHYS_64BIT
-#define CONFIG_SYS_PCIE1_MEM_BUS 0x80000000
-#else
-#define CONFIG_SYS_PCIE1_MEM_BUS 0x80000000
-#endif
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-
-#if defined(CONFIG_TARGET_P1010RDB_PA)
-#define CONFIG_SYS_PCIE2_NAME "PCIe Slot"
-#elif defined(CONFIG_TARGET_P1010RDB_PB)
-#define CONFIG_SYS_PCIE2_NAME "mini PCIe Slot"
-#endif
-#ifdef CONFIG_PHYS_64BIT
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xc0000000
-#else
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xa0000000
-#endif
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-#endif
-
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif
diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h
index b5b159406a..4ef061343c 100644
--- a/include/configs/P2041RDB.h
+++ b/include/configs/P2041RDB.h
@@ -417,23 +417,6 @@ unsigned long get_board_sys_clk(unsigned long dummy);
#define CONFIG_SYS_FDT_PAD (0x3000 + CONFIG_SYS_QE_FMAN_FW_LENGTH)
#ifdef CONFIG_PCI
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE3_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE3_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE3_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE3_IO_SIZE 0x00010000 /* 64k */
-#endif
-
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif /* CONFIG_PCI */
diff --git a/include/configs/T102xRDB.h b/include/configs/T102xRDB.h
index 1b4720db5c..187304419e 100644
--- a/include/configs/T102xRDB.h
+++ b/include/configs/T102xRDB.h
@@ -487,23 +487,6 @@ unsigned long get_board_ddr_clk(void);
#define CONFIG_SYS_PCIE3_IO_PHYS 0xff8020000ull
#endif
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE3_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE3_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE3_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE3_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#endif
-
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif /* CONFIG_PCI */
diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h
index 57a0bf5287..fb215bb05f 100644
--- a/include/configs/T104xRDB.h
+++ b/include/configs/T104xRDB.h
@@ -537,26 +537,6 @@ $(SRCTREE)/board/freescale/t104xrdb/t1042d4_sd_rcw.cfg
#define CONFIG_SYS_PCIE4_IO_PHYS 0xff8030000ull
#endif
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE3_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE3_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE3_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE3_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE4_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE4_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE4_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE4_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#endif
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif /* CONFIG_PCI */
diff --git a/include/configs/T208xQDS.h b/include/configs/T208xQDS.h
index b8d1693017..f61b40fb3b 100644
--- a/include/configs/T208xQDS.h
+++ b/include/configs/T208xQDS.h
@@ -486,26 +486,6 @@ unsigned long get_board_ddr_clk(void);
#define CONFIG_SYS_PCIE4_IO_PHYS 0xff8030000ull
#ifdef CONFIG_PCI
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE3_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE3_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE3_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE3_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE4_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE4_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE4_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE4_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#endif
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif
diff --git a/include/configs/T208xRDB.h b/include/configs/T208xRDB.h
index a04a49d033..63cc5af2c6 100644
--- a/include/configs/T208xRDB.h
+++ b/include/configs/T208xRDB.h
@@ -435,26 +435,6 @@ unsigned long get_board_ddr_clk(void);
#define CONFIG_SYS_PCIE4_IO_PHYS 0xff8030000ull
#ifdef CONFIG_PCI
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE3_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE3_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE3_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE3_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE4_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE4_MEM_SIZE 0x10000000 /* 256M */
-#define CONFIG_SYS_PCIE4_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE4_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#endif
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif
diff --git a/include/configs/T4240RDB.h b/include/configs/T4240RDB.h
index aa185be741..57a39fa970 100644
--- a/include/configs/T4240RDB.h
+++ b/include/configs/T4240RDB.h
@@ -196,27 +196,6 @@
#define CONFIG_SYS_PCIE4_IO_PHYS 0xff8030000ull
#ifdef CONFIG_PCI
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE3_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE3_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE3_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE3_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE4_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE4_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE4_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE4_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#endif
-
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif /* CONFIG_PCI */
diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index 924093e6b0..c877f3c725 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -430,27 +430,6 @@
#define CONFIG_SYS_FDT_PAD (0x3000 + CONFIG_SYS_QE_FMAN_FW_LENGTH)
#ifdef CONFIG_PCI
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE3_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE3_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE3_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE3_IO_SIZE 0x00010000 /* 64k */
-#define CONFIG_SYS_PCIE4_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE4_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE4_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE4_IO_SIZE 0x00010000 /* 64k */
-#endif
-
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif /* CONFIG_PCI */
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index ba5b649b97..54c82b4f33 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -529,30 +529,6 @@
#define CONFIG_SYS_PCIE1_IO_PHYS 0xffc00000
#endif
-#if !defined(CONFIG_DM_PCI)
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#define CONFIG_SYS_PCIE2_NAME "PCIe SLOT"
-#ifdef CONFIG_PHYS_64BIT
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xc0000000
-#else
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xa0000000
-#endif
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-
-#define CONFIG_SYS_PCIE1_NAME "mini PCIe SLOT"
-#ifdef CONFIG_PHYS_64BIT
-#define CONFIG_SYS_PCIE1_MEM_BUS 0x80000000
-#else
-#define CONFIG_SYS_PCIE1_MEM_BUS 0x80000000
-#endif
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-#endif
-
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif /* CONFIG_PCI */
diff --git a/include/configs/t4qds.h b/include/configs/t4qds.h
deleted file mode 100644
index b62ddc7075..0000000000
--- a/include/configs/t4qds.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2011-2012 Freescale Semiconductor, Inc.
- */
-
-/*
- * Corenet DS style board configuration file
- */
-#ifndef __T4QDS_H
-#define __T4QDS_H
-
-/* High Level Configuration Options */
-#define CONFIG_SYS_BOOK3E_HV /* Category E.HV supported */
-
-#ifndef CONFIG_RESET_VECTOR_ADDRESS
-#define CONFIG_RESET_VECTOR_ADDRESS 0xeffffffc
-#endif
-
-#define CONFIG_SYS_FSL_CPC /* Corenet Platform Cache */
-#define CONFIG_SYS_NUM_CPC CONFIG_SYS_NUM_DDR_CTLRS
-#define CONFIG_PCIE1 /* PCIE controller 1 */
-#define CONFIG_PCIE2 /* PCIE controller 2 */
-#define CONFIG_PCIE3 /* PCIE controller 3 */
-#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
-#define CONFIG_SYS_PCI_64BIT /* enable 64-bit PCI resources */
-
-#define CONFIG_SYS_SRIO
-#define CONFIG_SRIO1 /* SRIO port 1 */
-#define CONFIG_SRIO2 /* SRIO port 2 */
-
-/*
- * These can be toggled for performance analysis, otherwise use default.
- */
-#define CONFIG_SYS_CACHE_STASHING
-#define CONFIG_BTB /* toggle branch predition */
-#ifdef CONFIG_DDR_ECC
-#define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
-#define CONFIG_MEM_INIT_VALUE 0xdeadbeef
-#endif
-
-#define CONFIG_ENABLE_36BIT_PHYS
-
-/*
- * Config the L3 Cache as L3 SRAM
- */
-#define CONFIG_SYS_INIT_L3_ADDR 0xFFFC0000
-#define CONFIG_SYS_L3_SIZE (512 << 10)
-#define CONFIG_SPL_GD_ADDR (CONFIG_SYS_INIT_L3_ADDR + 32 * 1024)
-#define SPL_ENV_ADDR (CONFIG_SPL_GD_ADDR + 4 * 1024)
-#define CONFIG_SPL_RELOC_MALLOC_ADDR (CONFIG_SPL_GD_ADDR + 12 * 1024)
-#define CONFIG_SPL_RELOC_MALLOC_SIZE (50 << 10)
-#define CONFIG_SPL_RELOC_STACK (CONFIG_SPL_GD_ADDR + 64 * 1024)
-
-#define CONFIG_SYS_DCSRBAR 0xf0000000
-#define CONFIG_SYS_DCSRBAR_PHYS 0xf00000000ull
-
-/*
- * DDR Setup
- */
-#define CONFIG_VERY_BIG_RAM
-#define CONFIG_SYS_DDR_SDRAM_BASE 0x00000000
-#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE
-
-#define CONFIG_DIMM_SLOTS_PER_CTLR 2
-#define CONFIG_CHIP_SELECTS_PER_CTRL 4
-
-#define CONFIG_DDR_SPD
-
-/*
- * IFC Definitions
- */
-#define CONFIG_SYS_FLASH_BASE 0xe0000000
-#define CONFIG_SYS_FLASH_BASE_PHYS (0xf00000000ull | CONFIG_SYS_FLASH_BASE)
-
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MONITOR_BASE CONFIG_SPL_TEXT_BASE
-#else
-#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /* start of monitor */
-#endif
-
-#define CONFIG_HWCONFIG
-
-/* define to use L1 as initial stack */
-#define CONFIG_L1_INIT_RAM
-#define CONFIG_SYS_INIT_RAM_LOCK
-#define CONFIG_SYS_INIT_RAM_ADDR 0xfdd00000 /* Initial L1 address */
-#define CONFIG_SYS_INIT_RAM_ADDR_PHYS_HIGH 0xf
-#define CONFIG_SYS_INIT_RAM_ADDR_PHYS_LOW 0xfe03c000
-/* The assembler doesn't like typecast */
-#define CONFIG_SYS_INIT_RAM_ADDR_PHYS \
- ((CONFIG_SYS_INIT_RAM_ADDR_PHYS_HIGH * 1ull << 32) | \
- CONFIG_SYS_INIT_RAM_ADDR_PHYS_LOW)
-#define CONFIG_SYS_INIT_RAM_SIZE 0x00004000
-
-#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \
- GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
-
-#define CONFIG_SYS_MONITOR_LEN (768 * 1024)
-#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
-
-/* Serial Port - controlled on board with jumper J8
- * open - index 2
- * shorted - index 1
- */
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE 1
-#define CONFIG_SYS_NS16550_CLK (get_bus_freq(0)/2)
-
-#define CONFIG_SYS_BAUDRATE_TABLE \
- {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
-
-#define CONFIG_SYS_NS16550_COM1 (CONFIG_SYS_CCSRBAR+0x11C500)
-#define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_CCSRBAR+0x11C600)
-#define CONFIG_SYS_NS16550_COM3 (CONFIG_SYS_CCSRBAR+0x11D500)
-#define CONFIG_SYS_NS16550_COM4 (CONFIG_SYS_CCSRBAR+0x11D600)
-
-/* I2C */
-#define CONFIG_SYS_I2C_LEGACY
-#define CONFIG_SYS_I2C_FSL
-#define CONFIG_SYS_FSL_I2C_SLAVE 0x7F
-#define CONFIG_SYS_FSL_I2C_OFFSET 0x118000
-#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F
-#define CONFIG_SYS_FSL_I2C2_OFFSET 0x118100
-
-/*
- * RapidIO
- */
-#define CONFIG_SYS_SRIO1_MEM_VIRT 0xa0000000
-#define CONFIG_SYS_SRIO1_MEM_PHYS 0xc20000000ull
-#define CONFIG_SYS_SRIO1_MEM_SIZE 0x10000000 /* 256M */
-
-#define CONFIG_SYS_SRIO2_MEM_VIRT 0xb0000000
-#define CONFIG_SYS_SRIO2_MEM_PHYS 0xc30000000ull
-#define CONFIG_SYS_SRIO2_MEM_SIZE 0x10000000 /* 256M */
-
-/*
- * General PCI
- * Memory space is mapped 1-1, but I/O space must start from 0.
- */
-
-/* controller 1, direct to uli, tgtid 3, Base address 20000 */
-#define CONFIG_SYS_PCIE1_MEM_VIRT 0x80000000
-#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE1_MEM_PHYS 0xc00000000ull
-#define CONFIG_SYS_PCIE1_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE1_IO_VIRT 0xf8000000
-#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE1_IO_PHYS 0xff8000000ull
-#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
-
-/* controller 2, Slot 2, tgtid 2, Base address 201000 */
-#define CONFIG_SYS_PCIE2_MEM_VIRT 0xa0000000
-#define CONFIG_SYS_PCIE2_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE2_MEM_PHYS 0xc20000000ull
-#define CONFIG_SYS_PCIE2_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE2_IO_VIRT 0xf8010000
-#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE2_IO_PHYS 0xff8010000ull
-#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
-
-/* controller 3, Slot 1, tgtid 1, Base address 202000 */
-#define CONFIG_SYS_PCIE3_MEM_VIRT 0xc0000000
-#define CONFIG_SYS_PCIE3_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE3_MEM_PHYS 0xc40000000ull
-#define CONFIG_SYS_PCIE3_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE3_IO_VIRT 0xf8020000
-#define CONFIG_SYS_PCIE3_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE3_IO_PHYS 0xff8020000ull
-#define CONFIG_SYS_PCIE3_IO_SIZE 0x00010000 /* 64k */
-
-/* controller 4, Base address 203000 */
-#define CONFIG_SYS_PCIE4_MEM_BUS 0xe0000000
-#define CONFIG_SYS_PCIE4_MEM_PHYS 0xc60000000ull
-#define CONFIG_SYS_PCIE4_MEM_SIZE 0x20000000 /* 512M */
-#define CONFIG_SYS_PCIE4_IO_BUS 0x00000000
-#define CONFIG_SYS_PCIE4_IO_PHYS 0xff8030000ull
-#define CONFIG_SYS_PCIE4_IO_SIZE 0x00010000 /* 64k */
-
-#ifdef CONFIG_PCI
-#define CONFIG_PCI_INDIRECT_BRIDGE
-
-#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
-#endif /* CONFIG_PCI */
-
-/* SATA */
-#ifdef CONFIG_FSL_SATA_V2
-#define CONFIG_SYS_SATA_MAX_DEVICE 2
-#define CONFIG_SATA1
-#define CONFIG_SYS_SATA1 CONFIG_SYS_MPC85xx_SATA1_ADDR
-#define CONFIG_SYS_SATA1_FLAGS FLAGS_DMA
-#define CONFIG_SATA2
-#define CONFIG_SYS_SATA2 CONFIG_SYS_MPC85xx_SATA2_ADDR
-#define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA
-
-#define CONFIG_LBA48
-#endif
-
-#ifdef CONFIG_FMAN_ENET
-#define CONFIG_ETHPRIME "FM1@DTSEC1"
-#endif
-
-/*
- * Environment
- */
-#define CONFIG_LOADS_ECHO /* echo on for serial download */
-#define CONFIG_SYS_LOADS_BAUD_CHANGE /* allow baudrate change */
-
-/*
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_LOAD_ADDR 0x2000000 /* default load address */
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 64 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_SYS_BOOTMAPSZ (64 << 20) /* Initial map for Linux*/
-#define CONFIG_SYS_BOOTM_LEN (64 << 20) /* Increase max gunzip size */
-
-#ifdef CONFIG_CMD_KGDB
-#define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port */
-#endif
-
-/*
- * Environment Configuration
- */
-#define CONFIG_ROOTPATH "/opt/nfsroot"
-#define CONFIG_BOOTFILE "uImage"
-#define CONFIG_UBOOTPATH "u-boot.bin" /* U-Boot image on TFTP server*/
-
-/* default location for tftp and bootm */
-#define CONFIG_LOADADDR 1000000
-
-#define CONFIG_HVBOOT \
- "setenv bootargs config-addr=0x60000000; " \
- "bootm 0x01000000 - 0x00f00000"
-
-#endif /* __CONFIG_H */
diff --git a/include/fdtdec.h b/include/fdtdec.h
index e0a49b1e57..8ac20c9a64 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -140,8 +140,6 @@ enum fdt_compat_id {
/* Tegra124 XUSB pad controller */
COMPAT_NVIDIA_TEGRA210_XUSB_PADCTL,
/* Tegra210 XUSB pad controller */
- COMPAT_SMSC_LAN9215, /* SMSC 10/100 Ethernet LAN9215 */
- COMPAT_SAMSUNG_EXYNOS5_SROMC, /* Exynos5 SROMC */
COMPAT_SAMSUNG_EXYNOS_USB_PHY, /* Exynos phy controller for usb2.0 */
COMPAT_SAMSUNG_EXYNOS5_USB3_PHY,/* Exynos phy controller for usb3.0 */
COMPAT_SAMSUNG_EXYNOS_TMU, /* Exynos TMU */
diff --git a/include/init.h b/include/init.h
index fd51d7f966..c781789e36 100644
--- a/include/init.h
+++ b/include/init.h
@@ -297,9 +297,6 @@ int board_late_init(void);
int board_postclk_init(void); /* after clocks/timebase, before env/serial */
int board_early_init_r(void);
-/* TODO(sjg@chromium.org): Drop this when DM_PCI migration is completed */
-void pci_init_board(void);
-
/**
* arch_initr_trap() - Init traps
*
diff --git a/include/pci.h b/include/pci.h
index 258c8f831c..4d771133b2 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -836,11 +836,6 @@ int pci_last_busno(void);
extern void pci_mpc85xx_init (struct pci_controller *hose);
#endif
-#ifdef CONFIG_PCIE_IMX
-extern void imx_pcie_remove(void);
-#endif
-
-#if !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT)
/**
* pci_write_bar32() - Write the address of a BAR including control bits
*
@@ -848,6 +843,8 @@ extern void imx_pcie_remove(void);
* with devices which require hard-coded addresses, not part of the normal
* PCI enumeration process.
*
+ * This is only available if CONFIG_DM_PCI_COMPAT is enabled
+ *
* @hose: PCI hose to use
* @dev: PCI device to update
* @barnum: BAR number (0-5)
@@ -859,6 +856,8 @@ void pci_write_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum,
/**
* pci_read_bar32() - read the address of a bar
*
+ * This is only available if CONFIG_DM_PCI_COMPAT is enabled
+ *
* @hose: PCI hose to use
* @dev: PCI device to inspect
* @barnum: BAR number (0-5)
@@ -869,6 +868,8 @@ u32 pci_read_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum);
/**
* pci_hose_find_devices() - Find devices by vendor/device ID
*
+ * This is only available if CONFIG_DM_PCI_COMPAT is enabled
+ *
* @hose: PCI hose to search
* @busnum: Bus number to search
* @ids: PCI vendor/device IDs to look for, terminated by 0, 0 record
@@ -879,7 +880,6 @@ u32 pci_read_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum);
*/
pci_dev_t pci_hose_find_devices(struct pci_controller *hose, int busnum,
struct pci_device_id *ids, int *indexp);
-#endif /* !CONFIG_DM_PCI || CONFIG_DM_PCI_COMPAT */
/* Access sizes for PCI reads and writes */
enum pci_size_t {
diff --git a/include/tpm-v2.h b/include/tpm-v2.h
index 247b386967..949a13c917 100644
--- a/include/tpm-v2.h
+++ b/include/tpm-v2.h
@@ -32,6 +32,8 @@ struct udevice;
#define TPM2_MAX_TPM_PROPERTIES ((TPM2_MAX_CAP_BUFFER - sizeof(u32) /* TPM2_CAP */ - \
sizeof(u32)) / sizeof(struct tpms_tagged_property))
+#define TPM2_HDR_LEN 10
+
/*
* We deviate from this draft of the specification by increasing the value of
* TPM2_NUM_PCR_BANKS from 3 to 16 to ensure compatibility with TPM2
diff --git a/include/vsprintf.h b/include/vsprintf.h
index 4016de6677..83d187e53d 100644
--- a/include/vsprintf.h
+++ b/include/vsprintf.h
@@ -10,12 +10,57 @@
#include <stdarg.h>
#include <linux/types.h>
+/**
+ * simple_strtoul - convert a string to an unsigned long
+ *
+ * @param cp The string to be converted
+ * @param endp Updated to point to the first character not converted
+ * @param base The number base to use (0 for the default)
+ * @return value decoded from string (0 if invalid)
+ *
+ * Converts a string to an unsigned long. If there are invalid characters at
+ * the end these are ignored. In the worst case, if all characters are invalid,
+ * 0 is returned
+ *
+ * A hex prefix is supported (e.g. 0x123) regardless of the value of @base.
+ * If found, the base is set to hex (16).
+ *
+ * If @base is 0:
+ * - an octal '0' prefix (e.g. 0777) sets the base to octal (8).
+ * - otherwise the base defaults to decimal (10).
+ */
ulong simple_strtoul(const char *cp, char **endp, unsigned int base);
/**
+ * hex_strtoul - convert a string in hex to an unsigned long
+ *
+ * @param cp The string to be converted
+ * @param endp Updated to point to the first character not converted
+ * @return value decoded from string (0 if invalid)
+ *
+ * Converts a hex string to an unsigned long. If there are invalid characters at
+ * the end these are ignored. In the worst case, if all characters are invalid,
+ * 0 is returned
+ */
+unsigned long hextoul(const char *cp, char **endp);
+
+/**
+ * dec_strtoul - convert a string in decimal to an unsigned long
+ *
+ * @param cp The string to be converted
+ * @param endp Updated to point to the first character not converted
+ * @return value decoded from string (0 if invalid)
+ *
+ * Converts a decimal string to an unsigned long. If there are invalid
+ * characters at the end these are ignored. In the worst case, if all characters
+ * are invalid, 0 is returned
+ */
+unsigned long dectoul(const char *cp, char **endp);
+
+/**
* strict_strtoul - convert a string to an unsigned long strictly
* @param cp The string to be converted
- * @param base The number base to use
+ * @param base The number base to use (0 for the default)
* @param res The converted result value
* @return 0 if conversion is successful and *res is set to the converted
* value, otherwise it returns -EINVAL and *res is set to 0.
@@ -30,8 +75,12 @@ ulong simple_strtoul(const char *cp, char **endp, unsigned int base);
*
* echo will append a newline to the tail.
*
- * simple_strtoul just ignores the successive invalid characters and
- * return the converted value of prefix part of the string.
+ * A hex prefix is supported (e.g. 0x123) regardless of the value of @base.
+ * If found, the base is set to hex (16).
+ *
+ * If @base is 0:
+ * - an octal '0' prefix (e.g. 0777) sets the base to octal (8).
+ * - otherwise the base defaults to decimal (10).
*
* Copied this function from Linux 2.6.38 commit ID:
* 521cb40b0c44418a4fd36dc633f575813d59a43d
diff --git a/lib/Kconfig b/lib/Kconfig
index fdcf7ea405..7b445d0164 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -566,8 +566,7 @@ config HEXDUMP
config SPL_HEXDUMP
bool "Enable hexdump in SPL"
- depends on HEXDUMP
- default y
+ depends on SPL && HEXDUMP
help
This enables functions for printing dumps of binary data in
SPL.
diff --git a/lib/dhry/cmd_dhry.c b/lib/dhry/cmd_dhry.c
index d55ab54df9..77b52a2300 100644
--- a/lib/dhry/cmd_dhry.c
+++ b/lib/dhry/cmd_dhry.c
@@ -16,7 +16,7 @@ static int do_dhry(struct cmd_tbl *cmdtp, int flag, int argc,
int iterations = 1000000;
if (argc > 1)
- iterations = simple_strtoul(argv[1], NULL, 10);
+ iterations = dectoul(argv[1], NULL);
start = get_timer(0);
dhry(iterations);
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 9b369430e2..08469d9cd9 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -23,7 +23,7 @@ endif
ifeq ($(CONFIG_EFI_CAPSULE_AUTHENTICATE),y)
EFI_CAPSULE_KEY_PATH := $(subst $\",,$(CONFIG_EFI_CAPSULE_KEY_PATH))
ifeq ("$(wildcard $(EFI_CAPSULE_KEY_PATH))","")
-$(error .esl cerificate not found. Configure your CONFIG_EFI_CAPSULE_KEY_PATH)
+$(error .esl certificate not found. Configure your CONFIG_EFI_CAPSULE_KEY_PATH)
endif
endif
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 4b097fb588..337c4443b0 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -47,8 +47,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
COMPAT(NVIDIA_TEGRA124_XUSB_PADCTL, "nvidia,tegra124-xusb-padctl"),
COMPAT(NVIDIA_TEGRA210_XUSB_PADCTL, "nvidia,tegra210-xusb-padctl"),
- COMPAT(SMSC_LAN9215, "smsc,lan9215"),
- COMPAT(SAMSUNG_EXYNOS5_SROMC, "samsung,exynos-sromc"),
COMPAT(SAMSUNG_EXYNOS_USB_PHY, "samsung,exynos-usb-phy"),
COMPAT(SAMSUNG_EXYNOS5_USB3_PHY, "samsung,exynos5250-usb3-phy"),
COMPAT(SAMSUNG_EXYNOS_TMU, "samsung,exynos-tmu"),
@@ -405,7 +403,7 @@ int fdtdec_add_aliases_for_id(const void *blob, const char *name,
continue;
/* Get the alias number */
- number = simple_strtoul(path + name_len, NULL, 10);
+ number = dectoul(path + name_len, NULL);
if (number < 0 || number >= maxcount) {
debug("%s: warning: alias '%s' is out of range\n",
__func__, path);
diff --git a/lib/net_utils.c b/lib/net_utils.c
index 0a8a557319..72a3b098a7 100644
--- a/lib/net_utils.c
+++ b/lib/net_utils.c
@@ -23,7 +23,7 @@ struct in_addr string_to_ip(const char *s)
return addr;
for (addr.s_addr = 0, i = 0; i < 4; ++i) {
- ulong val = s ? simple_strtoul(s, &e, 10) : 0;
+ ulong val = s ? dectoul(s, &e) : 0;
if (val > 255) {
addr.s_addr = 0;
return addr;
@@ -52,7 +52,7 @@ void string_to_enetaddr(const char *addr, uint8_t *enetaddr)
return;
for (i = 0; i < 6; ++i) {
- enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
+ enetaddr[i] = addr ? hextoul(addr, &end) : 0;
if (addr)
addr = (*end) ? end + 1 : end;
}
diff --git a/lib/strto.c b/lib/strto.c
index f8b53d846b..7bba1e3e54 100644
--- a/lib/strto.c
+++ b/lib/strto.c
@@ -14,33 +14,55 @@
#include <linux/ctype.h>
/* from lib/kstrtox.c */
-static const char *_parse_integer_fixup_radix(const char *s, unsigned int *base)
+static const char *_parse_integer_fixup_radix(const char *s, uint *basep)
{
- if (*base == 0) {
- if (s[0] == '0') {
- if (tolower(s[1]) == 'x' && isxdigit(s[2]))
- *base = 16;
- else
- *base = 8;
- } else
- *base = 10;
+ /* Look for a 0x prefix */
+ if (s[0] == '0') {
+ int ch = tolower(s[1]);
+
+ if (ch == 'x') {
+ *basep = 16;
+ s += 2;
+ } else if (!*basep) {
+ /* Only select octal if we don't have a base */
+ *basep = 8;
+ }
}
- if (*base == 16 && s[0] == '0' && tolower(s[1]) == 'x')
- s += 2;
+
+ /* Use decimal by default */
+ if (!*basep)
+ *basep = 10;
+
return s;
}
-unsigned long simple_strtoul(const char *cp, char **endp,
- unsigned int base)
+/**
+ * decode_digit() - Decode a single character into its numeric digit value
+ *
+ * This ignore case
+ *
+ * @ch: Character to convert (expects '0'..'9', 'a'..'f' or 'A'..'F')
+ * @return value of digit (0..0xf) or 255 if the character is invalid
+ */
+static uint decode_digit(int ch)
+{
+ if (!isxdigit(ch))
+ return 256;
+
+ ch = tolower(ch);
+
+ return ch <= '9' ? ch - '0' : ch - 'a' + 0xa;
+}
+
+ulong simple_strtoul(const char *cp, char **endp, uint base)
{
- unsigned long result = 0;
- unsigned long value;
+ ulong result = 0;
+ uint value;
cp = _parse_integer_fixup_radix(cp, &base);
- while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
- ? toupper(*cp) : *cp)-'A'+10) < base) {
- result = result*base + value;
+ while (value = decode_digit(*cp), value < base) {
+ result = result * base + value;
cp++;
}
@@ -50,6 +72,16 @@ unsigned long simple_strtoul(const char *cp, char **endp,
return result;
}
+ulong hextoul(const char *cp, char **endp)
+{
+ return simple_strtoul(cp, endp, 16);
+}
+
+ulong dectoul(const char *cp, char **endp)
+{
+ return simple_strtoul(cp, endp, 10);
+}
+
int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
{
char *tail;
@@ -127,12 +159,12 @@ unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base)
unsigned long long simple_strtoull(const char *cp, char **endp,
unsigned int base)
{
- unsigned long long result = 0, value;
+ unsigned long long result = 0;
+ uint value;
cp = _parse_integer_fixup_radix(cp, &base);
- while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp - '0'
- : (islower(*cp) ? toupper(*cp) : *cp) - 'A' + 10) < base) {
+ while (value = decode_digit(*cp), value < base) {
result = result * base + value;
cp++;
}
@@ -160,7 +192,7 @@ long trailing_strtoln(const char *str, const char *end)
if (isdigit(end[-1])) {
for (p = end - 1; p > str; p--) {
if (!isdigit(*p))
- return simple_strtoul(p + 1, NULL, 10);
+ return dectoul(p + 1, NULL);
}
}
diff --git a/lib/uuid.c b/lib/uuid.c
index 5bc68674d0..67267c66a3 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -164,26 +164,26 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin,
}
if (str_format == UUID_STR_FORMAT_STD) {
- tmp32 = cpu_to_be32(simple_strtoul(uuid_str, NULL, 16));
+ tmp32 = cpu_to_be32(hextoul(uuid_str, NULL));
memcpy(uuid_bin, &tmp32, 4);
- tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 9, NULL, 16));
+ tmp16 = cpu_to_be16(hextoul(uuid_str + 9, NULL));
memcpy(uuid_bin + 4, &tmp16, 2);
- tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 14, NULL, 16));
+ tmp16 = cpu_to_be16(hextoul(uuid_str + 14, NULL));
memcpy(uuid_bin + 6, &tmp16, 2);
} else {
- tmp32 = cpu_to_le32(simple_strtoul(uuid_str, NULL, 16));
+ tmp32 = cpu_to_le32(hextoul(uuid_str, NULL));
memcpy(uuid_bin, &tmp32, 4);
- tmp16 = cpu_to_le16(simple_strtoul(uuid_str + 9, NULL, 16));
+ tmp16 = cpu_to_le16(hextoul(uuid_str + 9, NULL));
memcpy(uuid_bin + 4, &tmp16, 2);
- tmp16 = cpu_to_le16(simple_strtoul(uuid_str + 14, NULL, 16));
+ tmp16 = cpu_to_le16(hextoul(uuid_str + 14, NULL));
memcpy(uuid_bin + 6, &tmp16, 2);
}
- tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 19, NULL, 16));
+ tmp16 = cpu_to_be16(hextoul(uuid_str + 19, NULL));
memcpy(uuid_bin + 8, &tmp16, 2);
tmp64 = cpu_to_be64(simple_strtoull(uuid_str + 24, NULL, 16));
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index c14176dd39..d7ee35b477 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -858,7 +858,7 @@ bool str2long(const char *p, ulong *num)
{
char *endptr;
- *num = simple_strtoul(p, &endptr, 16);
+ *num = hextoul(p, &endptr);
return *p != '\0' && *endptr == '\0';
}
diff --git a/net/bootp.c b/net/bootp.c
index 163af41e92..655b9cceb6 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -740,7 +740,7 @@ void bootp_request(void)
ep = env_get("bootpretryperiod");
if (ep != NULL)
- time_taken_max = simple_strtoul(ep, NULL, 10);
+ time_taken_max = dectoul(ep, NULL);
else
time_taken_max = TIMEOUT_MS;
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index c2a97d723a..0da0e85be0 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -128,7 +128,7 @@ struct udevice *eth_get_dev_by_name(const char *devname)
/* Must be longer than 3 to be an alias */
if (!strncmp(devname, "eth", len) && strlen(devname) > len) {
startp = devname + len;
- seq = simple_strtoul(startp, &endp, 10);
+ seq = dectoul(startp, &endp);
}
ret = uclass_get(UCLASS_ETH, &uc);
@@ -241,7 +241,7 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op,
struct udevice *dev;
/* look for an index after "eth" */
- index = simple_strtoul(name + 3, NULL, 10);
+ index = dectoul(name + 3, NULL);
retval = uclass_find_device_by_seq(UCLASS_ETH, index, &dev);
if (!retval) {
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index 96ed5a4720..f383ccce0b 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -114,7 +114,7 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op,
return 0;
/* look for an index after "eth" */
- index = simple_strtoul(name + 3, NULL, 10);
+ index = dectoul(name + 3, NULL);
dev = eth_devices;
do {
diff --git a/net/net.c b/net/net.c
index b58f3062b2..c2992a0908 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1591,7 +1591,7 @@ ushort string_to_vlan(const char *s)
if (*s < '0' || *s > '9')
id = VLAN_NONE;
else
- id = (ushort)simple_strtoul(s, NULL, 10);
+ id = (ushort)dectoul(s, NULL);
return htons(id);
}
diff --git a/net/tftp.c b/net/tftp.c
index 00ab7ca0b3..5baf528f4e 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -554,8 +554,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
for (i = 0; i+8 < len; i++) {
if (strcasecmp((char *)pkt + i, "blksize") == 0) {
tftp_block_size = (unsigned short)
- simple_strtoul((char *)pkt + i + 8,
- NULL, 10);
+ dectoul((char *)pkt + i + 8, NULL);
debug("Blocksize oack: %s, %d\n",
(char *)pkt + i + 8, tftp_block_size);
if (tftp_block_size > tftp_block_size_option) {
@@ -566,8 +565,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
}
if (strcasecmp((char *)pkt + i, "timeout") == 0) {
timeout_val_rcvd = (unsigned short)
- simple_strtoul((char *)pkt + i + 8,
- NULL, 10);
+ dectoul((char *)pkt + i + 8, NULL);
debug("Timeout oack: %s, %d\n",
(char *)pkt + i + 8, timeout_val_rcvd);
if (timeout_val_rcvd != (timeout_ms / 1000)) {
@@ -578,16 +576,15 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
}
#ifdef CONFIG_TFTP_TSIZE
if (strcasecmp((char *)pkt + i, "tsize") == 0) {
- tftp_tsize = simple_strtoul((char *)pkt + i + 6,
- NULL, 10);
+ tftp_tsize = dectoul((char *)pkt + i + 6,
+ NULL);
debug("size = %s, %d\n",
(char *)pkt + i + 6, tftp_tsize);
}
#endif
if (strcasecmp((char *)pkt + i, "windowsize") == 0) {
tftp_windowsize =
- simple_strtoul((char *)pkt + i + 11,
- NULL, 10);
+ dectoul((char *)pkt + i + 11, NULL);
debug("windowsize = %s, %d\n",
(char *)pkt + i + 11, tftp_windowsize);
}
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 812d8f2836..dc7806012b 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -505,10 +505,6 @@ CONFIG_FTINTC010_BASE
CONFIG_FTLCDC100_BASE
CONFIG_FTMAC100_BASE
CONFIG_FTMAC110_BASE
-CONFIG_FTPCI100_BASE
-CONFIG_FTPCI100_IO_SIZE
-CONFIG_FTPCI100_MEM_BASE
-CONFIG_FTPCI100_MEM_SIZE
CONFIG_FTPMU010
CONFIG_FTPMU010_BASE
CONFIG_FTPMU010_POWER
@@ -2441,7 +2437,6 @@ CONFIG_SYS_ICACHE_INV
CONFIG_SYS_ICS8N3QV01_I2C
CONFIG_SYS_IDE_MAXBUS
CONFIG_SYS_IDE_MAXDEVICE
-CONFIG_SYS_ID_EEPROM
CONFIG_SYS_IFC_ADDR
CONFIG_SYS_IFC_CCR
CONFIG_SYS_INIT_DBCR
@@ -2937,7 +2932,6 @@ CONFIG_SYS_PCI_NR_INBOUND_WIN
CONFIG_SYS_PCI_SLV_MEM_BUS
CONFIG_SYS_PCI_SLV_MEM_LOCAL
CONFIG_SYS_PCI_SLV_MEM_SIZE
-CONFIG_SYS_PCI_SUBSYS_VENDORID
CONFIG_SYS_PCI_SYS_MEM_BUS
CONFIG_SYS_PCI_SYS_MEM_PHYS
CONFIG_SYS_PCI_SYS_MEM_SIZE
diff --git a/test/common/test_autoboot.c b/test/common/test_autoboot.c
index 6564ac7049..42a1e4ab1f 100644
--- a/test/common/test_autoboot.c
+++ b/test/common/test_autoboot.c
@@ -16,13 +16,19 @@
static int check_for_input(struct unit_test_state *uts, const char *in,
bool correct)
{
+ bool old_val;
/* The bootdelay is set to 1 second in test_autoboot() */
const char *autoboot_prompt =
"Enter password \"a\" in 1 seconds to stop autoboot";
console_record_reset_enable();
console_in_puts(in);
+
+ /* turn on keyed autoboot for the test, if possible */
+ old_val = autoboot_set_keyed(true);
autoboot_command("echo Autoboot password unlock not successful");
+ old_val = autoboot_set_keyed(old_val);
+
ut_assert_nextline(autoboot_prompt);
if (!correct)
ut_assert_nextline("Autoboot password unlock not successful");
diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c
index 0f89c7a7da..0463cf0b43 100644
--- a/test/dm/of_platdata.c
+++ b/test/dm/of_platdata.c
@@ -35,12 +35,13 @@ static int dm_test_of_plat_props(struct unit_test_state *uts)
plat = dev_get_plat(dev);
ut_assert(plat->boolval);
ut_asserteq(1, plat->intval);
- ut_asserteq(4, ARRAY_SIZE(plat->intarray));
+ ut_asserteq(3, ARRAY_SIZE(plat->intarray));
ut_asserteq(2, plat->intarray[0]);
ut_asserteq(3, plat->intarray[1]);
ut_asserteq(4, plat->intarray[2]);
- ut_asserteq(0, plat->intarray[3]);
ut_asserteq(5, plat->byteval);
+ ut_asserteq(1, ARRAY_SIZE(plat->maybe_empty_int));
+ ut_asserteq(0, plat->maybe_empty_int[0]);
ut_asserteq(3, ARRAY_SIZE(plat->bytearray));
ut_asserteq(6, plat->bytearray[0]);
ut_asserteq(0, plat->bytearray[1]);
@@ -61,7 +62,6 @@ static int dm_test_of_plat_props(struct unit_test_state *uts)
ut_asserteq(5, plat->intarray[0]);
ut_asserteq(0, plat->intarray[1]);
ut_asserteq(0, plat->intarray[2]);
- ut_asserteq(0, plat->intarray[3]);
ut_asserteq(8, plat->byteval);
ut_asserteq(3, ARRAY_SIZE(plat->bytearray));
ut_asserteq(1, plat->bytearray[0]);
@@ -80,6 +80,7 @@ static int dm_test_of_plat_props(struct unit_test_state *uts)
ut_asserteq_str("one", plat->stringarray[0]);
ut_asserteq_str("", plat->stringarray[1]);
ut_asserteq_str("", plat->stringarray[2]);
+ ut_asserteq(1, plat->maybe_empty_int[0]);
ut_assertok(uclass_next_device_err(&dev));
plat = dev_get_plat(dev);
diff --git a/test/lib/strlcat.c b/test/lib/strlcat.c
index ee61684c40..a0ec037388 100644
--- a/test/lib/strlcat.c
+++ b/test/lib/strlcat.c
@@ -48,7 +48,7 @@ static int do_test_strlcat(struct unit_test_state *uts, int line, size_t align1,
if (expected != actual) {
ut_failf(uts, __FILE__, line, __func__,
"strlcat(s2, s1, 2) == len2 < n ? min(len1 + len2, n) : n",
- "Expected %#lx (%ld), got %#lx (%ld)",
+ "Expected %#zx (%zd), got %#zx (%zd)",
expected, expected, actual, actual);
return CMD_RET_FAILURE;
}
@@ -66,7 +66,7 @@ static int do_test_strlcat(struct unit_test_state *uts, int line, size_t align1,
if (len2 < n && s2[i] != '\0') {
ut_failf(uts, __FILE__, line, __func__,
"n < len1 && s2[len2 + n] == '\\0'",
- "Expected s2[%ld] = '\\0', got %d ('%c')",
+ "Expected s2[%zd] = '\\0', got %d ('%c')",
i, s2[i], s2[i]);
return CMD_RET_FAILURE;
}
diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py
index 70f906da51..ac04f7191e 100644
--- a/test/py/tests/test_tpm2.py
+++ b/test/py/tests/test_tpm2.py
@@ -216,7 +216,9 @@ def test_tpm2_pcr_extend(u_boot_console):
output = u_boot_console.run_command('echo $?')
assert output.endswith('0')
- read_pcr = u_boot_console.run_command('tpm2 pcr_read 0 0x%x' % ram)
+ # Read the value back into a different place so we can still use 'ram' as
+ # our zero bytes
+ read_pcr = u_boot_console.run_command('tpm2 pcr_read 0 0x%x' % (ram + 0x20))
output = u_boot_console.run_command('echo $?')
assert output.endswith('0')
assert 'f5 a5 fd 42 d1 6a 20 30 27 98 ef 6e d3 09 97 9b' in read_pcr
@@ -226,6 +228,20 @@ def test_tpm2_pcr_extend(u_boot_console):
new_updates = int(re.findall(r'\d+', str)[0])
assert (updates + 1) == new_updates
+ u_boot_console.run_command('tpm2 pcr_extend 0 0x%x' % ram)
+ output = u_boot_console.run_command('echo $?')
+ assert output.endswith('0')
+
+ read_pcr = u_boot_console.run_command('tpm2 pcr_read 0 0x%x' % (ram + 0x20))
+ output = u_boot_console.run_command('echo $?')
+ assert output.endswith('0')
+ assert '7a 05 01 f5 95 7b df 9c b3 a8 ff 49 66 f0 22 65' in read_pcr
+ assert 'f9 68 65 8b 7a 9c 62 64 2c ba 11 65 e8 66 42 f5' in read_pcr
+
+ str = re.findall(r'\d+ known updates', read_pcr)[0]
+ new_updates = int(re.findall(r'\d+', str)[0])
+ assert (updates + 2) == new_updates
+
@pytest.mark.buildconfigspec('cmd_tpm_v2')
def test_tpm2_cleanup(u_boot_console):
"""Ensure the TPM is cleared from password or test related configuration."""
diff --git a/test/str_ut.c b/test/str_ut.c
index 359d7d4ea1..d2840d5152 100644
--- a/test/str_ut.c
+++ b/test/str_ut.c
@@ -15,6 +15,10 @@
static const char str1[] = "I'm sorry I'm late.";
static const char str2[] = "1099abNo, don't bother apologising.";
static const char str3[] = "0xbI'm sorry you're alive.";
+static const char str4[] = "1234567890123 I lost closer friends";
+static const char str5[] = "0x9876543210the last time I was deloused";
+static const char str6[] = "0778octal is seldom used";
+static const char str7[] = "707it is a piece of computing history";
/* Declare a new str test */
#define STR_TEST(_name, _flags) UNIT_TEST(_name, _flags, str_test)
@@ -84,6 +88,12 @@ static int str_simple_strtoul(struct unit_test_state *uts)
/* Base 10 and base 16 */
ut_assertok(run_strtoul(uts, str2, 10, 1099, 4, upper));
ut_assertok(run_strtoul(uts, str2, 16, 0x1099ab, 6, upper));
+ ut_assertok(run_strtoul(uts, str3, 16, 0xb, 3, upper));
+ ut_assertok(run_strtoul(uts, str3, 10, 0xb, 3, upper));
+
+ /* Octal */
+ ut_assertok(run_strtoul(uts, str6, 0, 63, 3, upper));
+ ut_assertok(run_strtoul(uts, str7, 8, 0x1c7, 3, upper));
/* Invalid string */
ut_assertok(run_strtoul(uts, str1, 10, 0, 0, upper));
@@ -105,6 +115,93 @@ static int str_simple_strtoul(struct unit_test_state *uts)
}
STR_TEST(str_simple_strtoul, 0);
+static int run_strtoull(struct unit_test_state *uts, const char *str, int base,
+ unsigned long long expect_val, int expect_endp_offset,
+ bool upper)
+{
+ char out[TEST_STR_SIZE];
+ char *endp;
+ unsigned long long val;
+
+ strcpy(out, str);
+ if (upper)
+ str_to_upper(out, out, -1);
+
+ val = simple_strtoull(out, &endp, base);
+ ut_asserteq(expect_val, val);
+ ut_asserteq(expect_endp_offset, endp - out);
+
+ return 0;
+}
+
+static int str_simple_strtoull(struct unit_test_state *uts)
+{
+ int upper;
+
+ /* Check that it is case-insentive */
+ for (upper = 0; upper < 2; upper++) {
+ /* Base 10 and base 16 */
+ ut_assertok(run_strtoull(uts, str2, 10, 1099, 4, upper));
+ ut_assertok(run_strtoull(uts, str2, 16, 0x1099ab, 6, upper));
+ ut_assertok(run_strtoull(uts, str3, 16, 0xb, 3, upper));
+ ut_assertok(run_strtoull(uts, str3, 10, 0xb, 3, upper));
+
+ /* Octal */
+ ut_assertok(run_strtoull(uts, str6, 0, 63, 3, upper));
+ ut_assertok(run_strtoull(uts, str7, 8, 0x1c7, 3, upper));
+
+ /* Large values */
+ ut_assertok(run_strtoull(uts, str4, 10, 1234567890123, 13,
+ upper));
+ ut_assertok(run_strtoull(uts, str4, 16, 0x1234567890123, 13,
+ upper));
+ ut_assertok(run_strtoull(uts, str5, 0, 0x9876543210, 12,
+ upper));
+
+ /* Invalid string */
+ ut_assertok(run_strtoull(uts, str1, 10, 0, 0, upper));
+
+ /* Base 0 */
+ ut_assertok(run_strtoull(uts, str1, 0, 0, 0, upper));
+ ut_assertok(run_strtoull(uts, str2, 0, 1099, 4, upper));
+ ut_assertok(run_strtoull(uts, str3, 0, 0xb, 3, upper));
+
+ /* Base 2 */
+ ut_assertok(run_strtoull(uts, str1, 2, 0, 0, upper));
+ ut_assertok(run_strtoull(uts, str2, 2, 2, 2, upper));
+ }
+
+ /* Check endp being NULL */
+ ut_asserteq(1099, simple_strtoull(str2, NULL, 0));
+
+ return 0;
+}
+STR_TEST(str_simple_strtoull, 0);
+
+static int str_hextoul(struct unit_test_state *uts)
+{
+ char *endp;
+
+ /* Just a simple test, since we know this uses simple_strtoul() */
+ ut_asserteq(0x1099ab, hextoul(str2, &endp));
+ ut_asserteq(6, endp - str2);
+
+ return 0;
+}
+STR_TEST(str_hextoul, 0);
+
+static int str_dectoul(struct unit_test_state *uts)
+{
+ char *endp;
+
+ /* Just a simple test, since we know this uses simple_strtoul() */
+ ut_asserteq(1099, dectoul(str2, &endp));
+ ut_asserteq(4, endp - str2);
+
+ return 0;
+}
+STR_TEST(str_dectoul, 0);
+
int do_ut_str(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct unit_test *tests = UNIT_TEST_SUITE_START(str_test);
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index ced4457ab2..0195456dfe 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -2,7 +2,7 @@
# This Dockerfile is used to build an image containing basic stuff to be used
# to build U-Boot and run our test suites.
-FROM ubuntu:focal-20210609
+FROM ubuntu:focal-20210723
MAINTAINER Tom Rini <trini@konsulko.com>
LABEL Description=" This image is for building U-Boot inside a container"
@@ -12,7 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive
# Add LLVM repository
RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/*
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
-RUN echo deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main | tee /etc/apt/sources.list.d/llvm.list
+RUN echo deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main | tee /etc/apt/sources.list.d/llvm.list
# Manually install the kernel.org "Crosstool" based toolchains for gcc-11.1.0
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/11.1.0/x86_64-gcc-11.1.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ
@@ -39,7 +39,7 @@ RUN apt-get update && apt-get install -y \
binutils-dev \
bison \
build-essential \
- clang-10 \
+ clang-12 \
coreutils \
cpio \
cppcheck \
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 3996971e39..32a7aa9829 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -24,16 +24,19 @@ from patman import tools
# A list of types we support
class Type(IntEnum):
+ # Types in order from widest to narrowest
(BYTE, INT, STRING, BOOL, INT64) = range(5)
- def is_wider_than(self, other):
- """Check if another type is 'wider' than this one
+ def needs_widening(self, other):
+ """Check if this type needs widening to hold a value from another type
- A wider type is one that holds more information than an earlier one,
- similar to the concept of type-widening in C.
+ A wider type is one that can hold a wider array of information than
+ another one, or is less restrictive, so it can hold the information of
+ another type as well as its own. This is similar to the concept of
+ type-widening in C.
This uses a simple arithmetic comparison, since type values are in order
- from narrowest (BYTE) to widest (INT64).
+ from widest (BYTE) to narrowest (INT64).
Args:
other: Other type to compare against
@@ -149,7 +152,19 @@ class Prop:
update the current property to be like the second, since it is less
specific.
"""
- if self.type.is_wider_than(newprop.type):
+ if self.type.needs_widening(newprop.type):
+
+ # A boolean has an empty value: if it exists it is True and if not
+ # it is False. So when widening we always start with an empty list
+ # since the only valid integer property would be an empty list of
+ # integers.
+ # e.g. this is a boolean:
+ # some-prop;
+ # and it would be widened to int list by:
+ # some-prop = <1 2>;
+ if self.type == Type.BOOL:
+ self.type = Type.INT
+ self.value = [self.GetEmpty(self.type)]
if self.type == Type.INT and newprop.type == Type.BYTE:
if type(self.value) == list:
new_value = []
@@ -160,13 +175,14 @@ class Prop:
self.value = new_value
self.type = newprop.type
- if type(newprop.value) == list and type(self.value) != list:
- self.value = [self.value]
+ if type(newprop.value) == list:
+ if type(self.value) != list:
+ self.value = [self.value]
- if type(self.value) == list and len(newprop.value) > len(self.value):
- val = self.GetEmpty(self.type)
- while len(self.value) < len(newprop.value):
- self.value.append(val)
+ if len(newprop.value) > len(self.value):
+ val = self.GetEmpty(self.type)
+ while len(self.value) < len(newprop.value):
+ self.value.append(val)
@classmethod
def GetEmpty(self, type):
diff --git a/tools/dtoc/test/dtoc_test_simple.dts b/tools/dtoc/test/dtoc_test_simple.dts
index b5c1274bb7..5a6fa88d5c 100644
--- a/tools/dtoc/test/dtoc_test_simple.dts
+++ b/tools/dtoc/test/dtoc_test_simple.dts
@@ -14,6 +14,7 @@
u-boot,dm-pre-reloc;
compatible = "sandbox,spl-test";
boolval;
+ maybe-empty-int = <>;
intval = <1>;
intarray = <2 3 4>;
byteval = [05];
@@ -42,6 +43,7 @@
compatible = "sandbox,spl-test";
stringarray = "one";
longbytearray = [09 0a 0b 0c 0d 0e 0f 10];
+ maybe-empty-int = <1>;
};
i2c@0 {
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index 863ede90b7..752061f27a 100755
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -296,9 +296,10 @@ struct dtd_sandbox_spl_test {
\tbool\t\tboolval;
\tunsigned char\tbytearray[3];
\tunsigned char\tbyteval;
-\tfdt32_t\t\tintarray[4];
+\tfdt32_t\t\tintarray[3];
\tfdt32_t\t\tintval;
\tunsigned char\tlongbytearray[9];
+\tfdt32_t\t\tmaybe_empty_int[1];
\tunsigned char\tnotstring[5];
\tconst char *\tstringarray[3];
\tconst char *\tstringval;
@@ -354,10 +355,11 @@ static struct dtd_sandbox_spl_test dtv_spl_test = {
\t.boolval\t\t= true,
\t.bytearray\t\t= {0x6, 0x0, 0x0},
\t.byteval\t\t= 0x5,
-\t.intarray\t\t= {0x2, 0x3, 0x4, 0x0},
+\t.intarray\t\t= {0x2, 0x3, 0x4},
\t.intval\t\t\t= 0x1,
\t.longbytearray\t\t= {0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10,
\t\t0x11},
+\t.maybe_empty_int\t= {0x0},
\t.notstring\t\t= {0x20, 0x21, 0x22, 0x10, 0x0},
\t.stringarray\t\t= {"multi-word", "message", ""},
\t.stringval\t\t= "message",
@@ -377,7 +379,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test2 = {
\t.acpi_name\t\t= "\\\\_SB.GPO0",
\t.bytearray\t\t= {0x1, 0x23, 0x34},
\t.byteval\t\t= 0x8,
-\t.intarray\t\t= {0x5, 0x0, 0x0, 0x0},
+\t.intarray\t\t= {0x5, 0x0, 0x0},
\t.intval\t\t\t= 0x3,
\t.longbytearray\t\t= {0x9, 0xa, 0xb, 0xc, 0x0, 0x0, 0x0, 0x0,
\t\t0x0},
@@ -398,6 +400,7 @@ U_BOOT_DRVINFO(spl_test2) = {
static struct dtd_sandbox_spl_test dtv_spl_test3 = {
\t.longbytearray\t\t= {0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10,
\t\t0x0},
+\t.maybe_empty_int\t= {0x1},
\t.stringarray\t\t= {"one", "", ""},
};
U_BOOT_DRVINFO(spl_test3) = {
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 856392b1bd..1119e6b784 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -122,8 +122,9 @@ class TestFdt(unittest.TestCase):
node = self.dtb.GetNode('/spl-test')
props = self.dtb.GetProps(node)
self.assertEqual(['boolval', 'bytearray', 'byteval', 'compatible',
- 'intarray', 'intval', 'longbytearray', 'notstring',
- 'stringarray', 'stringval', 'u-boot,dm-pre-reloc'],
+ 'intarray', 'intval', 'longbytearray',
+ 'maybe-empty-int', 'notstring', 'stringarray',
+ 'stringval', 'u-boot,dm-pre-reloc'],
sorted(props.keys()))
def testCheckError(self):
@@ -379,7 +380,7 @@ class TestProp(unittest.TestCase):
self.assertEqual(Type.INT, prop.type)
self.assertEqual(1, fdt32_to_cpu(prop.value))
- # Convert singla value to array
+ # Convert single value to array
prop2 = self.node.props['intarray']
prop.Widen(prop2)
self.assertEqual(Type.INT, prop.type)
@@ -422,6 +423,28 @@ class TestProp(unittest.TestCase):
self.assertTrue(isinstance(prop.value, list))
self.assertEqual(3, len(prop.value))
+ # Widen an array of ints with an int (should do nothing)
+ prop = self.node.props['intarray']
+ prop2 = node2.props['intarray']
+ self.assertEqual(Type.INT, prop.type)
+ self.assertEqual(3, len(prop.value))
+ prop.Widen(prop2)
+ self.assertEqual(Type.INT, prop.type)
+ self.assertEqual(3, len(prop.value))
+
+ # Widen an empty bool to an int
+ prop = self.node.props['maybe-empty-int']
+ prop3 = node3.props['maybe-empty-int']
+ self.assertEqual(Type.BOOL, prop.type)
+ self.assertEqual(True, prop.value)
+ self.assertEqual(Type.INT, prop3.type)
+ self.assertFalse(isinstance(prop.value, list))
+ self.assertEqual(4, len(prop3.value))
+ prop.Widen(prop3)
+ self.assertEqual(Type.INT, prop.type)
+ self.assertTrue(isinstance(prop.value, list))
+ self.assertEqual(1, len(prop.value))
+
def testAdd(self):
"""Test adding properties"""
self.fdt.pack()
diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 41dd803c4e..373b395fda 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -7,296 +7,7 @@
"""
Move config options from headers to defconfig files.
-Since Kconfig was introduced to U-Boot, we have worked on moving
-config options from headers to Kconfig (defconfig).
-
-This tool intends to help this tremendous work.
-
-Installing
-----------
-
-You may need to install 'python3-asteval' for the 'asteval' module.
-
-Usage
------
-
-First, you must edit the Kconfig to add the menu entries for the configs
-you are moving.
-
-And then run this tool giving CONFIG names you want to move.
-For example, if you want to move CONFIG_CMD_USB and CONFIG_SYS_TEXT_BASE,
-simply type as follows:
-
- $ tools/moveconfig.py CONFIG_CMD_USB CONFIG_SYS_TEXT_BASE
-
-The tool walks through all the defconfig files and move the given CONFIGs.
-
-The log is also displayed on the terminal.
-
-The log is printed for each defconfig as follows:
-
-<defconfig_name>
- <action1>
- <action2>
- <action3>
- ...
-
-<defconfig_name> is the name of the defconfig.
-
-<action*> shows what the tool did for that defconfig.
-It looks like one of the following:
-
- - Move 'CONFIG_... '
- This config option was moved to the defconfig
-
- - CONFIG_... is not defined in Kconfig. Do nothing.
- The entry for this CONFIG was not found in Kconfig. The option is not
- defined in the config header, either. So, this case can be just skipped.
-
- - CONFIG_... is not defined in Kconfig (suspicious). Do nothing.
- This option is defined in the config header, but its entry was not found
- in Kconfig.
- There are two common cases:
- - You forgot to create an entry for the CONFIG before running
- this tool, or made a typo in a CONFIG passed to this tool.
- - The entry was hidden due to unmet 'depends on'.
- The tool does not know if the result is reasonable, so please check it
- manually.
-
- - 'CONFIG_...' is the same as the define in Kconfig. Do nothing.
- The define in the config header matched the one in Kconfig.
- We do not need to touch it.
-
- - Compiler is missing. Do nothing.
- The compiler specified for this architecture was not found
- in your PATH environment.
- (If -e option is passed, the tool exits immediately.)
-
- - Failed to process.
- An error occurred during processing this defconfig. Skipped.
- (If -e option is passed, the tool exits immediately on error.)
-
-Finally, you will be asked, Clean up headers? [y/n]:
-
-If you say 'y' here, the unnecessary config defines are removed
-from the config headers (include/configs/*.h).
-It just uses the regex method, so you should not rely on it.
-Just in case, please do 'git diff' to see what happened.
-
-
-How does it work?
------------------
-
-This tool runs configuration and builds include/autoconf.mk for every
-defconfig. The config options defined in Kconfig appear in the .config
-file (unless they are hidden because of unmet dependency.)
-On the other hand, the config options defined by board headers are seen
-in include/autoconf.mk. The tool looks for the specified options in both
-of them to decide the appropriate action for the options. If the given
-config option is found in the .config, but its value does not match the
-one from the board header, the config option in the .config is replaced
-with the define in the board header. Then, the .config is synced by
-"make savedefconfig" and the defconfig is updated with it.
-
-For faster processing, this tool handles multi-threading. It creates
-separate build directories where the out-of-tree build is run. The
-temporary build directories are automatically created and deleted as
-needed. The number of threads are chosen based on the number of the CPU
-cores of your system although you can change it via -j (--jobs) option.
-
-
-Toolchains
-----------
-
-Appropriate toolchain are necessary to generate include/autoconf.mk
-for all the architectures supported by U-Boot. Most of them are available
-at the kernel.org site, some are not provided by kernel.org. This tool uses
-the same tools as buildman, so see that tool for setup (e.g. --fetch-arch).
-
-
-Tips and trips
---------------
-
-To sync only X86 defconfigs:
-
- ./tools/moveconfig.py -s -d <(grep -l X86 configs/*)
-
-or:
-
- grep -l X86 configs/* | ./tools/moveconfig.py -s -d -
-
-To process CONFIG_CMD_FPGAD only for a subset of configs based on path match:
-
- ls configs/{hrcon*,iocon*,strider*} | \
- ./tools/moveconfig.py -Cy CONFIG_CMD_FPGAD -d -
-
-
-Finding implied CONFIGs
------------------------
-
-Some CONFIG options can be implied by others and this can help to reduce
-the size of the defconfig files. For example, CONFIG_X86 implies
-CONFIG_CMD_IRQ, so we can put 'imply CMD_IRQ' under 'config X86' and
-all x86 boards will have that option, avoiding adding CONFIG_CMD_IRQ to
-each of the x86 defconfig files.
-
-This tool can help find such configs. To use it, first build a database:
-
- ./tools/moveconfig.py -b
-
-Then try to query it:
-
- ./tools/moveconfig.py -i CONFIG_CMD_IRQ
- CONFIG_CMD_IRQ found in 311/2384 defconfigs
- 44 : CONFIG_SYS_FSL_ERRATUM_IFC_A002769
- 41 : CONFIG_SYS_FSL_ERRATUM_A007075
- 31 : CONFIG_SYS_FSL_DDR_VER_44
- 28 : CONFIG_ARCH_P1010
- 28 : CONFIG_SYS_FSL_ERRATUM_P1010_A003549
- 28 : CONFIG_SYS_FSL_ERRATUM_SEC_A003571
- 28 : CONFIG_SYS_FSL_ERRATUM_IFC_A003399
- 25 : CONFIG_SYS_FSL_ERRATUM_A008044
- 22 : CONFIG_ARCH_P1020
- 21 : CONFIG_SYS_FSL_DDR_VER_46
- 20 : CONFIG_MAX_PIRQ_LINKS
- 20 : CONFIG_HPET_ADDRESS
- 20 : CONFIG_X86
- 20 : CONFIG_PCIE_ECAM_SIZE
- 20 : CONFIG_IRQ_SLOT_COUNT
- 20 : CONFIG_I8259_PIC
- 20 : CONFIG_CPU_ADDR_BITS
- 20 : CONFIG_RAMBASE
- 20 : CONFIG_SYS_FSL_ERRATUM_A005871
- 20 : CONFIG_PCIE_ECAM_BASE
- 20 : CONFIG_X86_TSC_TIMER
- 20 : CONFIG_I8254_TIMER
- 20 : CONFIG_CMD_GETTIME
- 19 : CONFIG_SYS_FSL_ERRATUM_A005812
- 18 : CONFIG_X86_RUN_32BIT
- 17 : CONFIG_CMD_CHIP_CONFIG
- ...
-
-This shows a list of config options which might imply CONFIG_CMD_EEPROM along
-with how many defconfigs they cover. From this you can see that CONFIG_X86
-implies CONFIG_CMD_EEPROM. Therefore, instead of adding CONFIG_CMD_EEPROM to
-the defconfig of every x86 board, you could add a single imply line to the
-Kconfig file:
-
- config X86
- bool "x86 architecture"
- ...
- imply CMD_EEPROM
-
-That will cover 20 defconfigs. Many of the options listed are not suitable as
-they are not related. E.g. it would be odd for CONFIG_CMD_GETTIME to imply
-CMD_EEPROM.
-
-Using this search you can reduce the size of moveconfig patches.
-
-You can automatically add 'imply' statements in the Kconfig with the -a
-option:
-
- ./tools/moveconfig.py -s -i CONFIG_SCSI \
- -a CONFIG_ARCH_LS1021A,CONFIG_ARCH_LS1043A
-
-This will add 'imply SCSI' to the two CONFIG options mentioned, assuming that
-the database indicates that they do actually imply CONFIG_SCSI and do not
-already have an 'imply SCSI'.
-
-The output shows where the imply is added:
-
- 18 : CONFIG_ARCH_LS1021A arch/arm/cpu/armv7/ls102xa/Kconfig:1
- 13 : CONFIG_ARCH_LS1043A arch/arm/cpu/armv8/fsl-layerscape/Kconfig:11
- 12 : CONFIG_ARCH_LS1046A arch/arm/cpu/armv8/fsl-layerscape/Kconfig:31
-
-The first number is the number of boards which can avoid having a special
-CONFIG_SCSI option in their defconfig file if this 'imply' is added.
-The location at the right is the Kconfig file and line number where the config
-appears. For example, adding 'imply CONFIG_SCSI' to the 'config ARCH_LS1021A'
-in arch/arm/cpu/armv7/ls102xa/Kconfig at line 1 will help 18 boards to reduce
-the size of their defconfig files.
-
-If you want to add an 'imply' to every imply config in the list, you can use
-
- ./tools/moveconfig.py -s -i CONFIG_SCSI -a all
-
-To control which ones are displayed, use -I <list> where list is a list of
-options (use '-I help' to see possible options and their meaning).
-
-To skip showing you options that already have an 'imply' attached, use -A.
-
-When you have finished adding 'imply' options you can regenerate the
-defconfig files for affected boards with something like:
-
- git show --stat | ./tools/moveconfig.py -s -d -
-
-This will regenerate only those defconfigs changed in the current commit.
-If you start with (say) 100 defconfigs being changed in the commit, and add
-a few 'imply' options as above, then regenerate, hopefully you can reduce the
-number of defconfigs changed in the commit.
-
-
-Available options
------------------
-
- -c, --color
- Surround each portion of the log with escape sequences to display it
- in color on the terminal.
-
- -C, --commit
- Create a git commit with the changes when the operation is complete. A
- standard commit message is used which may need to be edited.
-
- -d, --defconfigs
- Specify a file containing a list of defconfigs to move. The defconfig
- files can be given with shell-style wildcards. Use '-' to read from stdin.
-
- -n, --dry-run
- Perform a trial run that does not make any changes. It is useful to
- see what is going to happen before one actually runs it.
-
- -e, --exit-on-error
- Exit immediately if Make exits with a non-zero status while processing
- a defconfig file.
-
- -s, --force-sync
- Do "make savedefconfig" forcibly for all the defconfig files.
- If not specified, "make savedefconfig" only occurs for cases
- where at least one CONFIG was moved.
-
- -S, --spl
- Look for moved config options in spl/include/autoconf.mk instead of
- include/autoconf.mk. This is useful for moving options for SPL build
- because SPL related options (mostly prefixed with CONFIG_SPL_) are
- sometimes blocked by CONFIG_SPL_BUILD ifdef conditionals.
-
- -H, --headers-only
- Only cleanup the headers; skip the defconfig processing
-
- -j, --jobs
- Specify the number of threads to run simultaneously. If not specified,
- the number of threads is the same as the number of CPU cores.
-
- -r, --git-ref
- Specify the git ref to clone for building the autoconf.mk. If unspecified
- use the CWD. This is useful for when changes to the Kconfig affect the
- default values and you want to capture the state of the defconfig from
- before that change was in effect. If in doubt, specify a ref pre-Kconfig
- changes (use HEAD if Kconfig changes are not committed). Worst case it will
- take a bit longer to run, but will always do the right thing.
-
- -v, --verbose
- Show any build errors as boards are built
-
- -y, --yes
- Instead of prompting, automatically go ahead with all operations. This
- includes cleaning up headers, CONFIG_SYS_EXTRA_OPTIONS, the config whitelist
- and the README.
-
-To see the complete list of supported options, run
-
- $ tools/moveconfig.py -h
-
+See doc/develop/moveconfig.rst for documentation.
"""
import asteval
@@ -1551,8 +1262,8 @@ def find_kconfig_rules(kconf, config, imply_config):
"""
sym = kconf.syms.get(imply_config)
if sym:
- for sel in sym.get_selected_symbols() | sym.get_implied_symbols():
- if sel.get_name() == config:
+ for sel, cond in (sym.selects + sym.implies):
+ if sel == config:
return sym
return None
@@ -1577,10 +1288,10 @@ def check_imply_rule(kconf, config, imply_config):
sym = kconf.syms.get(imply_config)
if not sym:
return 'cannot find sym'
- locs = sym.get_def_locations()
- if len(locs) != 1:
- return '%d locations' % len(locs)
- fname, linenum = locs[0]
+ nodes = sym.nodes
+ if len(nodes) != 1:
+ return '%d locations' % len(nodes)
+ fname, linenum = nodes[0].filename, nodes[0].linern
cwd = os.getcwd()
if cwd and fname.startswith(cwd):
fname = fname[len(cwd) + 1:]
@@ -1791,9 +1502,9 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added,
iconfig[CONFIG_LEN:])
kconfig_info = ''
if sym:
- locs = sym.get_def_locations()
- if len(locs) == 1:
- fname, linenum = locs[0]
+ nodes = sym.nodes
+ if len(nodes) == 1:
+ fname, linenum = nodes[0].filename, nodes[0].linenr
if cwd and fname.startswith(cwd):
fname = fname[len(cwd) + 1:]
kconfig_info = '%s:%d' % (fname, linenum)
@@ -1803,9 +1514,9 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added,
sym = kconf.syms.get(iconfig[CONFIG_LEN:])
fname = ''
if sym:
- locs = sym.get_def_locations()
- if len(locs) == 1:
- fname, linenum = locs[0]
+ nodes = sym.nodes
+ if len(nodes) == 1:
+ fname, linenum = nodes[0].filename, nodes[0].linenr
if cwd and fname.startswith(cwd):
fname = fname[len(cwd) + 1:]
in_arch_board = not sym or (fname.startswith('arch') or
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 1ce6448d00..9871bb580d 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -506,6 +506,17 @@ Tested-by: %s
'Reviewed-by': {self.joe, self.mary},
'Tested-by': {self.leb}})
+ def testInvalidTag(self):
+ """Test invalid tag in a patchstream"""
+ text = '''This is a patch
+
+Serie-version: 2
+'''
+ with self.assertRaises(ValueError) as exc:
+ pstrm = PatchStream.process_text(text)
+ self.assertEqual("Line 3: Invalid tag = 'Serie-version: 2'",
+ str(exc.exception))
+
def testMissingEnd(self):
"""Test a missing END tag"""
text = '''This is a patch
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index a44cd861af..b960292427 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -59,6 +59,9 @@ RE_DIFF = re.compile(r'^>.*diff --git a/(.*) b/(.*)$')
# Detect a context line, like '> @@ -153,8 +153,13 @@ CheckPatch
RE_LINE = re.compile(r'>.*@@ \-(\d+),\d+ \+(\d+),\d+ @@ *(.*)')
+# Detect line with invalid TAG
+RE_INV_TAG = re.compile('^Serie-([a-z-]*): *(.*)')
+
# States we can be in - can we use range() and still have comments?
STATE_MSG_HEADER = 0 # Still in the message header
STATE_PATCH_SUBJECT = 1 # In patch subject (first line of log for a commit)
@@ -318,6 +321,7 @@ class PatchStream:
leading_whitespace_match = RE_LEADING_WHITESPACE.match(line)
diff_match = RE_DIFF.match(line)
line_match = RE_LINE.match(line)
+ invalid_match = RE_INV_TAG.match(line)
tag_match = None
if self.state == STATE_PATCH_HEADER:
tag_match = RE_TAG.match(line)
@@ -471,6 +475,11 @@ class PatchStream:
self._add_warn('Line %d: Ignoring Commit-%s' %
(self.linenum, name))
+ # Detect invalid tags
+ elif invalid_match:
+ raise ValueError("Line %d: Invalid tag = '%s'" %
+ (self.linenum, line))
+
# Detect the start of a new commit
elif commit_match:
self._close_commit()