Skip to content
Snippets Groups Projects
Select Git revision
  • 426337455e06c2d05c40f48e488b95a12e4aa056
  • master default protected
  • early-display
  • variant-emmc-nvme-boot
  • 2023-01-25
  • v3
  • variant-emmc-nvme-boot
  • 2020-06-01
8 results

board_f.c

Blame
  • Forked from Reform / reform-boundary-uboot
    Source project has a limited visibility.
    • Simon Glass's avatar
      6bda55a3
      x86: Do relocation before clearing BSS · 6bda55a3
      Simon Glass authored
      
      The BSS region may overlap with relocations. If we clear BSS we will
      overwrite the start of the relocation area. This doesn't matter when running
      from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
      from one place in RAM to another, relocation will fail because some of its
      relocations have been zeroed.
      
      To fix this, put the ELF fixup call before the BSS clearing call.
      
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: default avatarBin Meng <bmeng.cn@gmail.com>
      6bda55a3
      History
      x86: Do relocation before clearing BSS
      Simon Glass authored
      
      The BSS region may overlap with relocations. If we clear BSS we will
      overwrite the start of the relocation area. This doesn't matter when running
      from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
      from one place in RAM to another, relocation will fail because some of its
      relocations have been zeroed.
      
      To fix this, put the ELF fixup call before the BSS clearing call.
      
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: default avatarBin Meng <bmeng.cn@gmail.com>
    stm32_rcc.c 1.73 KiB
    /*
     * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
     * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
     *
     * SPDX-License-Identifier:	GPL-2.0+
     */
    
    #include <common.h>
    #include <dm.h>
    #include <misc.h>
    #include <stm32_rcc.h>
    #include <dm/device-internal.h>
    #include <dm/lists.h>
    
    struct stm32_rcc_clk stm32_rcc_clk_f4 = {
    	.drv_name = "stm32fx_rcc_clock",
    	.soc = STM32F4,
    };
    
    struct stm32_rcc_clk stm32_rcc_clk_f7 = {
    	.drv_name = "stm32fx_rcc_clock",
    	.soc = STM32F7,
    };
    
    struct stm32_rcc_clk stm32_rcc_clk_h7 = {
    	.drv_name = "stm32h7_rcc_clock",
    };
    
    static int stm32_rcc_bind(struct udevice *dev)
    {
    	struct udevice *child;
    	struct driver *drv;
    	struct stm32_rcc_clk *rcc_clk =
    		(struct stm32_rcc_clk *)dev_get_driver_data(dev);
    	int ret;
    
    	debug("%s(dev=%p)\n", __func__, dev);
    
    	drv = lists_driver_lookup_name(rcc_clk->drv_name);
    	if (!drv) {
    		debug("Cannot find driver '%s'\n", rcc_clk->drv_name);
    		return -ENOENT;
    	}
    
    	ret = device_bind_with_driver_data(dev, drv, rcc_clk->drv_name,
    					   rcc_clk->soc,
    					   dev_ofnode(dev), &child);
    
    	if (ret)
    		return ret;
    
    #ifdef CONFIG_SPL_BUILD
    	return 0;
    #else
    	return device_bind_driver_to_node(dev, "stm32_rcc_reset",
    					  "stm32_rcc_reset",
    					  dev_ofnode(dev), &child);
    #endif
    }
    
    static const struct misc_ops stm32_rcc_ops = {
    };
    
    static const struct udevice_id stm32_rcc_ids[] = {
    	{.compatible = "st,stm32f42xx-rcc", .data = (ulong)&stm32_rcc_clk_f4 },
    	{.compatible = "st,stm32f746-rcc", .data = (ulong)&stm32_rcc_clk_f7 },
    	{.compatible = "st,stm32h743-rcc", .data = (ulong)&stm32_rcc_clk_h7 },
    	{ }
    };
    
    U_BOOT_DRIVER(stm32_rcc) = {
    	.name		= "stm32-rcc",
    	.id		= UCLASS_MISC,
    	.of_match	= stm32_rcc_ids,
    	.bind		= stm32_rcc_bind,
    	.ops		= &stm32_rcc_ops,
    };