From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chee, Tien Fong Date: Mon, 7 Aug 2017 03:52:30 +0000 Subject: [U-Boot] [PATCH 1/5] arm: socfpga: Add checking function on searching boot device In-Reply-To: <031e926d-e09f-5a9a-c5f6-3875d845aea1@denx.de> References: <1501498222-9422-1-git-send-email-tien.fong.chee@intel.com> <1501498222-9422-2-git-send-email-tien.fong.chee@intel.com> <1d6c1492-03d9-111a-739f-7d6b237e2f53@denx.de> <1501669306.4085.3.camel@intel.com> <4578c74d-f684-4b89-f1c4-4627eda9d06a@denx.de> <1501825037.8947.3.camel@intel.com> <031e926d-e09f-5a9a-c5f6-3875d845aea1@denx.de> Message-ID: <1502077947.2357.1.camel@intel.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On Jum, 2017-08-04 at 15:10 +0200, Marek Vasut wrote: > On 08/04/2017 07:37 AM, Chee, Tien Fong wrote: > > > > On Rab, 2017-08-02 at 23:32 +0200, Marek Vasut wrote: > > > > > > On 08/02/2017 12:21 PM, Chee, Tien Fong wrote: > > > > > > > > > > > > On Isn, 2017-07-31 at 12:53 +0200, Marek Vasut wrote: > > > > > > > > > > > > > > > On 07/31/2017 12:50 PM, tien.fong.chee at intel.com wrote: > > > > > > > > > > > > > > > > > > > > > > > > From: Tien Fong Chee > > > > > > > > > > > > Function for checking boot device type, which is required > > > > > > for > > > > > > locating > > > > > > flash where U-boot image, FPGA design are stored. > > > > > > > > > > > > Signed-off-by: Tien Fong Chee > > > > > > --- > > > > > >  arch/arm/mach-socfpga/include/mach/misc.h |   19 > > > > > > +++++++++++++++++++ > > > > > >  arch/arm/mach-socfpga/misc_arria10.c      |   22 > > > > > > ++++++++++++++++++++++ > > > > > >  2 files changed, 41 insertions(+), 0 deletions(-) > > > > > > > > > > > > diff --git a/arch/arm/mach-socfpga/include/mach/misc.h > > > > > > b/arch/arm/mach-socfpga/include/mach/misc.h > > > > > > index 0b65783..b219aac 100644 > > > > > > --- a/arch/arm/mach-socfpga/include/mach/misc.h > > > > > > +++ b/arch/arm/mach-socfpga/include/mach/misc.h > > > > > > @@ -14,6 +14,24 @@ struct bsel { > > > > > >   const char *name; > > > > > >  }; > > > > > >   > > > > > > +enum { > > > > > > + BOOT_DEVICE_RAM, > > > > > > + BOOT_DEVICE_MMC1, > > > > > > + BOOT_DEVICE_MMC2, > > > > > > + BOOT_DEVICE_MMC2_2, > > > > > > + BOOT_DEVICE_NAND, > > > > > > + BOOT_DEVICE_ONENAND, > > > > > > + BOOT_DEVICE_NOR, > > > > > > + BOOT_DEVICE_UART, > > > > > > + BOOT_DEVICE_SPI, > > > > > > + BOOT_DEVICE_USB, > > > > > > + BOOT_DEVICE_SATA, > > > > > > + BOOT_DEVICE_I2C, > > > > > > + BOOT_DEVICE_BOARD, > > > > > > + BOOT_DEVICE_DFU, > > > > > > + BOOT_DEVICE_NONE > > > > > Why do you have so many bootdevices here if half of them > > > > > aren't > > > > > supported/used ? > > > > > > > > > Okay, i will reduce it, i refered this from spl.h > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > +}; > > > > > > + > > > > > >  extern struct bsel bsel_str[]; > > > > > >   > > > > > >  #ifdef CONFIG_FPGA > > > > > > @@ -26,6 +44,7 @@ static inline void socfpga_fpga_add(void) > > > > > > {} > > > > > >  unsigned int dedicated_uart_com_port(const void *blob); > > > > > >  unsigned int shared_uart_com_port(const void *blob); > > > > > >  unsigned int uart_com_port(const void *blob); > > > > > > +u32 boot_device(void); > > > > > >  #endif > > > > > >   > > > > > >  #endif /* _MISC_H_ */ > > > > > > diff --git a/arch/arm/mach-socfpga/misc_arria10.c > > > > > > b/arch/arm/mach- > > > > > > socfpga/misc_arria10.c > > > > > > index 9d751f6..069a0a6 100644 > > > > > > --- a/arch/arm/mach-socfpga/misc_arria10.c > > > > > > +++ b/arch/arm/mach-socfpga/misc_arria10.c > > > > > > @@ -235,6 +235,28 @@ unsigned int uart_com_port(const void > > > > > > *blob) > > > > > >   return shared_uart_com_port(blob); > > > > > >  } > > > > > >   > > > > > > +u32 boot_device(void) > > > > > > +{ > > > > > > + const u32 bsel = readl(&sysmgr_regs->bootinfo); > > > > > > + > > > > > > + switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) { > > > > > This looks very similar to what is on Gen5 ? > > > > > > > > > I refered from  function spl_boot_device in spl.c . I copied > > > > the > > > > function here, because U-boot also need it. > > > So can the same code used for gen5 be recycled on gen10 ? > > > > > Are you means SYSMGR_GET_BOOTINFO_BSEL? This is common #define > > shared > > between gen5 and gen10.  > > If you means boot_device function, then gen5 doesn't has this > > function. > > Please correct me if i misunderstand your question. > Did you try for example git grep BOOT_DEVICE arch/arm/mach-socfpga ? > It should point you to spl_boot_device in spl.c > Okay, i know what's you trying to say. I can change this function as common code for both SPL and U-boot. Thanks.