[U-Boot] [PATCH] x86: Remove dead ISA related codes

2017-08-03 Thread Bin Meng
Neither new design uses ISA bus, nor does any U-Boot codes use these
codes. Remove them.

Signed-off-by: Bin Meng 
---

 arch/x86/include/asm/io.h | 74 +--
 1 file changed, 8 insertions(+), 66 deletions(-)

diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 3156781..a72daf2 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -1,3 +1,10 @@
+/*
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
 #ifndef _ASM_IO_H
 #define _ASM_IO_H
 
@@ -118,71 +125,6 @@
 #define setbits_8(addr, set) setbits(8, addr, set)
 #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
 
-/*
- * ISA space is 'always mapped' on a typical x86 system, no need to
- * explicitly ioremap() it. The fact that the ISA IO space is mapped
- * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
- * are physical addresses. The following constant pointer can be
- * used as the IO-area pointer (it can be iounmapped as well, so the
- * analogy with PCI is quite large):
- */
-#define isa_readb(a) readb((a))
-#define isa_readw(a) readw((a))
-#define isa_readl(a) readl((a))
-#define isa_writeb(b,a) writeb(b,(a))
-#define isa_writew(w,a) writew(w,(a))
-#define isa_writel(l,a) writel(l,(a))
-#define isa_memset_io(a,b,c)   memset_io((a),(b),(c))
-#define isa_memcpy_fromio(a,b,c)   memcpy_fromio((a),(b),(c))
-#define isa_memcpy_toio(a,b,c) memcpy_toio((a),(b),(c))
-
-
-static inline int check_signature(unsigned long io_addr,
-   const unsigned char *signature, int length)
-{
-   int retval = 0;
-   do {
-   if (readb(io_addr) != *signature)
-   goto out;
-   io_addr++;
-   signature++;
-   length--;
-   } while (length);
-   retval = 1;
-out:
-   return retval;
-}
-
-/**
- * isa_check_signature -   find BIOS signatures
- * @io_addr: mmio address to check
- * @signature:  signature block
- * @length: length of signature
- *
- * Perform a signature comparison with the ISA mmio address io_addr.
- * Returns 1 on a match.
- *
- * This function is deprecated. New drivers should use ioremap and
- * check_signature.
- */
-
-
-static inline int isa_check_signature(unsigned long io_addr,
-   const unsigned char *signature, int length)
-{
-   int retval = 0;
-   do {
-   if (isa_readb(io_addr) != *signature)
-   goto out;
-   io_addr++;
-   signature++;
-   length--;
-   } while (length);
-   retval = 1;
-out:
-   return retval;
-}
-
 #endif /* __KERNEL__ */
 
 #ifdef SLOW_IO_BY_JUMPING
@@ -325,4 +267,4 @@ static inline phys_addr_t virt_to_phys(void * vaddr)
 #define __iormb()  dmb()
 #define __iowmb()  dmb()
 
-#endif
+#endif /* _ASM_IO_H */
-- 
2.9.2

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/5] arm: socfpga: Add checking function on searching boot device

2017-08-03 Thread Chee, Tien Fong
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.c...@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(_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.
> > 
> > > 
> > > > 
> > > > 
> > > > +   case 0x1:   /* FPGA (HPS2FPGA Bridge) */
> > > > +   return BOOT_DEVICE_RAM;
> > > > +   case 0x2:   /* NAND Flash (1.8V) */
> > > > +   case 0x3:   /* NAND Flash (3.0V) */
> > > > +   return BOOT_DEVICE_NAND;
> > > > +   case 0x4:   /* SD/MMC External Transceiver (1.8V)
> > > > */
> > > > +   case 0x5:   /* SD/MMC Internal Transceiver (3.0V)
> > > > */
> > > > +   return BOOT_DEVICE_MMC1;
> > > > +   case 0x6:   /* QSPI Flash (1.8V) */
> > > > +   case 0x7:   /* QSPI Flash (3.0V) */
> > > > +   return BOOT_DEVICE_SPI;
> > > > +   default:
> > > > +   printf("Invalid boot device (bsel=%08x)!\n",
> > > > bsel);
> > > > +   hang();
> > > > +   }
> > > > +}
> > > > +
> > > >  /*
> > > >   * Print CPU information
> > > >   */
> > > > 
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/4] video: Drop the sm501 driver

2017-08-03 Thread Bin Meng
This is not used in U-Boot.

Signed-off-by: Bin Meng 
---

 drivers/video/Makefile   |   1 -
 drivers/video/sm501.c| 225 ---
 include/sm501.h  |  35 ---
 scripts/config_whitelist.txt |   1 -
 4 files changed, 262 deletions(-)
 delete mode 100644 drivers/video/sm501.c
 delete mode 100644 include/sm501.h

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 046f0b9..847b880 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -47,7 +47,6 @@ obj-$(CONFIG_VIDEO_MVEBU) += mvebu_lcd.o
 obj-$(CONFIG_VIDEO_MXS) += mxsfb.o videomodes.o
 obj-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o
 obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o
-obj-$(CONFIG_VIDEO_SM501) += sm501.o
 obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o
 obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o
 obj-$(CONFIG_VIDEO_VESA) += vesa.o
diff --git a/drivers/video/sm501.c b/drivers/video/sm501.c
deleted file mode 100644
index a468bd9..000
--- a/drivers/video/sm501.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * (C) Copyright 2002
- * Stäubli Faverges - 
- * Pierre AUBERT  p.aub...@staubli.com
- *
- * (C) Copyright 2005
- * Martin Krause TQ-Systems GmbH martin.kra...@tqs.de
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-/*
- * Basic video support for SMI SM501 "Voyager" graphic controller
- */
-
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-#define read8(ptrReg)\
-*(volatile unsigned char *)(sm501.isaBase + ptrReg)
-
-#define write8(ptrReg,value) \
-*(volatile unsigned char *)(sm501.isaBase + ptrReg) = value
-
-#define read16(ptrReg) \
-(*(volatile unsigned short *)(sm501.isaBase + ptrReg))
-
-#define write16(ptrReg,value) \
-(*(volatile unsigned short *)(sm501.isaBase + ptrReg) = value)
-
-#define read32(ptrReg) \
-(*(volatile unsigned int *)(sm501.isaBase + ptrReg))
-
-#define write32(ptrReg, value) \
-(*(volatile unsigned int *)(sm501.isaBase + ptrReg) = value)
-
-GraphicDevice sm501;
-
-void write_be32(int off, unsigned int val)
-{
-   out_be32((unsigned __iomem *)(sm501.isaBase + off), val);
-}
-
-void write_le32(int off, unsigned int val)
-{
-   out_le32((unsigned __iomem *)(sm501.isaBase + off), val);
-}
-
-void (*write_reg32)(int off, unsigned int val) = write_be32;
-
-/*-
- * SmiSetRegs --
- *-
- */
-static void SmiSetRegs (void)
-{
-   /*
-* The content of the chipset register depends on the board (clocks,
-* ...)
-*/
-   const SMI_REGS *preg = board_get_regs ();
-   while (preg->Index) {
-   write_reg32 (preg->Index, preg->Value);
-   /*
-* Insert a delay between
-*/
-   udelay (1000);
-   preg ++;
-   }
-}
-
-#ifdef CONFIG_VIDEO_SM501_PCI
-static struct pci_device_id sm501_pci_tbl[] = {
-   { PCI_VENDOR_ID_SMI, PCI_DEVICE_ID_SMI_501 },
-   {}
-};
-#endif
-
-/*
- * We do not enforce board code to provide empty/unused
- * functions for this driver and define weak default
- * functions here.
- */
-unsigned int __board_video_init (void)
-{
-   return 0;
-}
-
-unsigned int board_video_init (void)
-   __attribute__((weak, alias("__board_video_init")));
-
-unsigned int __board_video_get_fb (void)
-{
-   return 0;
-}
-
-unsigned int board_video_get_fb (void)
-   __attribute__((weak, alias("__board_video_get_fb")));
-
-void __board_validate_screen (unsigned int base)
-{
-}
-
-void board_validate_screen (unsigned int base)
-   __attribute__((weak, alias("__board_validate_screen")));
-
-/*-
- * video_hw_init --
- *-
- */
-void *video_hw_init (void)
-{
-#ifdef CONFIG_VIDEO_SM501_PCI
-   unsigned int pci_mem_base, pci_mmio_base;
-   unsigned int id;
-   unsigned short device_id;
-   pci_dev_t devbusfn;
-   int mem;
-#endif
-   unsigned int *vm, i;
-
-   memset (, 0, sizeof (GraphicDevice));
-
-#ifdef CONFIG_VIDEO_SM501_PCI
-   printf("Video: ");
-
-   /* Look for SM501/SM502 chips */
-   devbusfn = pci_find_devices(sm501_pci_tbl, 0);
-   if (devbusfn < 0) {
-   printf ("PCI Controller not found.\n");
-   goto not_pci;
-   }
-
-   /* Setup */
-   pci_write_config_dword (devbusfn, PCI_COMMAND,
-   (PCI_COMMAND_MEMORY | PCI_COMMAND_IO));
-   pci_read_config_word (devbusfn, PCI_DEVICE_ID, _id);
-   pci_read_config_dword (devbusfn, PCI_REVISION_ID, );
-   pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0, _mem_base);
-   pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_1, _mmio_base);
-  

[U-Boot] [PATCH 4/4] video: Drop the ct69000 driver

2017-08-03 Thread Bin Meng
This is not used in U-Boot.

Signed-off-by: Bin Meng 
---

 drivers/video/Kconfig   |   31 +-
 drivers/video/Makefile  |1 -
 drivers/video/cfb_console.c |   10 -
 drivers/video/ct69000.c | 1168 ---
 4 files changed, 2 insertions(+), 1208 deletions(-)
 delete mode 100644 drivers/video/ct69000.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 61dfed8..082cc4a 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -562,36 +562,9 @@ config CONSOLE_SCROLL_LINES
  console jump but can help speed up operation when scrolling
  is slow.
 
-config VIDEO_CT69000
-   bool "Enable Chips & Technologies 69000 video driver"
-   depends on VIDEO
-   help
- This enables a frame buffer driver for the Chips & Technologies
- ct69000, a fairly old graphics device (circa 2000) which is used
- on some hardware. It operates over the ISA bus, and supports
- some acceleration features.
-
- For the CT69000 and SMI_LYNXEM drivers, videomode is
-   selected via environment 'videomode'. Two different ways
-   are possible:
-   - "videomode=num"   'num' is a standard LiLo mode numbers.
-   Following standard modes are supported  (* is default):
-
- Colors640x480 800x600 1024x768 1152x864 1280x1024
-   -+-
- 8 bits |  0x301*  0x3030x3050x161 0x307
-15 bits |  0x310   0x3130x3160x162 0x319
-16 bits |  0x311   0x3140x3170x163 0x31A
-24 bits |  0x312   0x3150x318  ?   0x31B
-   -+-
-   (i.e. setenv videomode 317; saveenv; reset;)
-
-   - "videomode=bootargs" all the video parameters are parsed
-   from the bootargs. (See drivers/video/videomodes.c)
-
 config SYS_CONSOLE_BG_COL
hex "Background colour"
-   depends on CFB_CONSOLE || VIDEO_CT69000
+   depends on CFB_CONSOLE
default 0x00
help
  Defines the background colour for the console. The value is from
@@ -602,7 +575,7 @@ config SYS_CONSOLE_BG_COL
 
 config SYS_CONSOLE_FG_COL
hex "Foreground colour"
-   depends on CFB_CONSOLE || VIDEO_CT69000
+   depends on CFB_CONSOLE
default 0xa0
help
  Defines the foreground colour for the console. The value is from
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 847b880..5cf8909 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -35,7 +35,6 @@ obj-$(CONFIG_S6E63D6) += s6e63d6.o
 obj-$(CONFIG_LD9040) += ld9040.o
 obj-$(CONFIG_VIDEO_BCM2835) += bcm2835.o
 obj-$(CONFIG_VIDEO_COREBOOT) += coreboot.o
-obj-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
 obj-$(CONFIG_VIDEO_DA8XX) += da8xx-fb.o videomodes.o
 obj-$(CONFIG_VIDEO_LCD_ANX9804) += anx9804.o
 obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index f548020..b6fc7e1 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -72,16 +72,6 @@
 #include 
 #include 
 
-/*
- * Defines for the CT69000 driver
- */
-#ifdef CONFIG_VIDEO_CT69000
-
-#define VIDEO_FB_LITTLE_ENDIAN
-#define VIDEO_HW_RECTFILL
-#define VIDEO_HW_BITBLT
-#endif
-
 #if defined(CONFIG_VIDEO_MXS)
 #define VIDEO_FB_16BPP_WORD_SWAP
 #endif
diff --git a/drivers/video/ct69000.c b/drivers/video/ct69000.c
deleted file mode 100644
index a74e4e6..000
--- a/drivers/video/ct69000.c
+++ /dev/null
@@ -1,1168 +0,0 @@
-/* ported from ctfb.c (linux kernel):
- * Created in Jan - July 2000 by Thomas Höhenleitner 

- *
- * Ported to U-Boot:
- * (C) Copyright 2002 Denis Peter, MPL AG Switzerland
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include 
-
-#ifdef CONFIG_VIDEO
-
-#include 
-#include 
-#include "videomodes.h"
-
-/* debug */
-#undef VGA_DEBUG
-#undef VGA_DUMP_REG
-#ifdef VGA_DEBUG
-#undef _DEBUG
-#define _DEBUG  1
-#else
-#undef _DEBUG
-#define _DEBUG  0
-#endif
-
-/* Macros */
-#ifndef min
-#define min( a, b ) ( ( a ) < ( b ) ) ? ( a ) : ( b )
-#endif
-#ifndef max
-#define max( a, b ) ( ( a ) > ( b ) ) ? ( a ) : ( b )
-#endif
-#ifdef minmax
-#error "term minmax already used."
-#endif
-#define minmax( a, x, b ) max( ( a ), min( ( x ), ( b ) ) )
-#define N_ELTS( x ) ( sizeof( x ) / sizeof( x[ 0 ] ) )
-
-/* CT Register Offsets */
-#define CT_AR_O0x3c0   /* Index and Data write port of 
the attribute Registers */
-#define CT_GR_O0x3ce   /* Index port of the Graphic 
Controller Registers */
-#define CT_SR_O0x3c4   /* Index port of the Sequencer 
Controller */
-#define CT_CR_O 

[U-Boot] [PATCH 2/4] video: Drop the sed156x driver

2017-08-03 Thread Bin Meng
This is not used in U-Boot.

Signed-off-by: Bin Meng 
---

 drivers/video/Makefile  |   1 -
 drivers/video/sed156x.c | 546 
 include/sed156x.h   |  26 ---
 3 files changed, 573 deletions(-)
 delete mode 100644 drivers/video/sed156x.c
 delete mode 100644 include/sed156x.h

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 2ef26e8..046f0b9 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -33,7 +33,6 @@ obj-$(CONFIG_SCF0403_LCD) += scf0403_lcd.o
 obj-$(CONFIG_S6E8AX0) += s6e8ax0.o
 obj-$(CONFIG_S6E63D6) += s6e63d6.o
 obj-$(CONFIG_LD9040) += ld9040.o
-obj-$(CONFIG_SED156X) += sed156x.o
 obj-$(CONFIG_VIDEO_BCM2835) += bcm2835.o
 obj-$(CONFIG_VIDEO_COREBOOT) += coreboot.o
 obj-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
diff --git a/drivers/video/sed156x.c b/drivers/video/sed156x.c
deleted file mode 100644
index 2c906ec..000
--- a/drivers/video/sed156x.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * (C) Copyright 2003
- *
- * Pantelis Antoniou 
- * Intracom S.A.
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include 
-#include 
-
-#include 
-
-/* configure according to the selected display */
-#if defined(CONFIG_SED156X_PG12864Q)
-#define LCD_WIDTH  128
-#define LCD_HEIGHT 64
-#define LCD_LINES  64
-#define LCD_PAGES  9
-#define LCD_COLUMNS132
-#else
-#error Unsupported SED156x configuration
-#endif
-
-/* include the font data */
-#include 
-
-#if VIDEO_FONT_WIDTH != 8 || VIDEO_FONT_HEIGHT != 16
-#error Expecting VIDEO_FONT_WIDTH == 8 && VIDEO_FONT_HEIGHT == 16
-#endif
-
-#define LCD_BYTE_WIDTH (LCD_WIDTH / 8)
-#define VIDEO_FONT_BYTE_WIDTH  (VIDEO_FONT_WIDTH / 8)
-
-#define LCD_TEXT_WIDTH (LCD_WIDTH / VIDEO_FONT_WIDTH)
-#define LCD_TEXT_HEIGHT (LCD_HEIGHT / VIDEO_FONT_HEIGHT)
-
-#define LCD_BYTE_LINESZ(LCD_BYTE_WIDTH * VIDEO_FONT_HEIGHT)
-
-const int sed156x_text_width = LCD_TEXT_WIDTH;
-const int sed156x_text_height = LCD_TEXT_HEIGHT;
-
-/**/
-
-#define SED156X_SPI_RXD() (SED156X_SPI_RXD_PORT & SED156X_SPI_RXD_MASK)
-
-#define SED156X_SPI_TXD(x) \
-   do { \
-   if (x) \
-   SED156X_SPI_TXD_PORT |=  SED156X_SPI_TXD_MASK; \
-   else \
-   SED156X_SPI_TXD_PORT &= ~SED156X_SPI_TXD_MASK; \
-   } while(0)
-
-#define SED156X_SPI_CLK(x) \
-   do { \
-   if (x) \
-   SED156X_SPI_CLK_PORT |=  SED156X_SPI_CLK_MASK; \
-   else \
-   SED156X_SPI_CLK_PORT &= ~SED156X_SPI_CLK_MASK; \
-   } while(0)
-
-#define SED156X_SPI_CLK_TOGGLE() (SED156X_SPI_CLK_PORT ^= SED156X_SPI_CLK_MASK)
-
-#define SED156X_SPI_BIT_DELAY() /* no delay */
-
-#define SED156X_CS(x) \
-   do { \
-   if (x) \
-   SED156X_CS_PORT |=  SED156X_CS_MASK; \
-   else \
-   SED156X_CS_PORT &= ~SED156X_CS_MASK; \
-   } while(0)
-
-#define SED156X_A0(x) \
-   do { \
-   if (x) \
-   SED156X_A0_PORT |=  SED156X_A0_MASK; \
-   else \
-   SED156X_A0_PORT &= ~SED156X_A0_MASK; \
-   } while(0)
-
-/**/
-
-/*** LCD Commands ***/
-
-#define LCD_ON 0xAF/* Display ON   
  */
-#define LCD_OFF0xAE/* Display OFF  
  */
-#define LCD_LADDR  0x40/* Display start line set + (6-bit) address 
  */
-#define LCD_PADDR  0xB0/* Page address set + (4-bit) page  
  */
-#define LCD_CADRH  0x10/* Column address set upper + (4-bit) column hi 
  */
-#define LCD_CADRL  0x00/* Column address set lower + (4-bit) column lo 
  */
-#define LCD_ADC_NRM0xA0/* ADC select Normal
  */
-#define LCD_ADC_REV0xA1/* ADC select Reverse   
  */
-#define LCD_DSP_NRM0xA6/* LCD display Normal   
  */
-#define LCD_DSP_REV0xA7/* LCD display Reverse  
  */
-#define LCD_DPT_NRM0xA4/* Display all points Normal
  */
-#define LCD_DPT_ALL0xA5/* Display all points ON
  */
-#define LCD_BIAS9  0xA2/* LCD bias set 1/9 
  */
-#define LCD_BIAS7  0xA3/* LCD bias set 1/7 
  */
-#define LCD_CAINC  0xE0/* Read/modify/write
  */
-#define LCD_CAEND  0xEE/* End  
  */
-#define LCD_RESET  0xE2/* Reset
  */

[U-Boot] [PATCH 1/4] video: Drop the l5f31188 driver

2017-08-03 Thread Bin Meng
This is not used in U-Boot.

Signed-off-by: Bin Meng 
---

 drivers/video/Makefile   |   1 -
 drivers/video/l5f31188.c | 192 ---
 2 files changed, 193 deletions(-)
 delete mode 100644 drivers/video/l5f31188.c

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index ac5371f..2ef26e8 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -28,7 +28,6 @@ obj-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
 obj-$(CONFIG_CFB_CONSOLE) += cfb_console.o
 obj-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
 obj-$(CONFIG_VIDEO_FSL_DCU_FB) += fsl_dcu_fb.o videomodes.o
-obj-$(CONFIG_L5F31188) += l5f31188.o
 obj-$(CONFIG_PXA_LCD) += pxa_lcd.o
 obj-$(CONFIG_SCF0403_LCD) += scf0403_lcd.o
 obj-$(CONFIG_S6E8AX0) += s6e8ax0.o
diff --git a/drivers/video/l5f31188.c b/drivers/video/l5f31188.c
deleted file mode 100644
index 3312dcf..000
--- a/drivers/video/l5f31188.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- * Hyungwon Hwang 
- *
- * SPDX-License-Identifier:  GPL-2.0+
- */
-
-#include 
-#include 
-
-#define SCAN_FROM_LEFT_TO_RIGHT 0
-#define SCAN_FROM_RIGHT_TO_LEFT 1
-#define SCAN_FROM_TOP_TO_BOTTOM 0
-#define SCAN_FROM_BOTTOM_TO_TOP 1
-
-static void l5f31188_sleep_in(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE, 0x10, 0x00);
-}
-
-static void l5f31188_sleep_out(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE, 0x11, 0x00);
-}
-
-static void l5f31188_set_gamma(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE, 0x26, 0x00);
-}
-
-static void l5f31188_display_off(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE, 0x28, 0x00);
-}
-
-static void l5f31188_display_on(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE, 0x29, 0x00);
-}
-
-static void l5f31188_ctl_memory_access(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops,
-   int h_direction, int v_direction)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0x36,
-   (((h_direction & 0x1) << 1) | (v_direction & 0x1)));
-}
-
-static void l5f31188_set_pixel_format(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0x3A, 0x70);
-}
-
-static void l5f31188_write_disbv(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops, unsigned int brightness)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0x51, brightness);
-}
-
-static void l5f31188_write_ctrld(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0x53, 0x2C);
-}
-
-static void l5f31188_write_cabc(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops,
-   unsigned int wm_mode)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0x55, wm_mode);
-}
-
-static void l5f31188_write_cabcmb(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops, unsigned int min_brightness)
-{
-   ops->cmd_write(dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0x5E,
-   min_brightness);
-}
-
-static void l5f31188_set_extension(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops)
-{
-   const unsigned char data_to_send[] = {
-   0xB9, 0xFF, 0x83, 0x94
-   };
-
-   ops->cmd_write(dev, MIPI_DSI_DCS_LONG_WRITE,
-   (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
-}
-
-static void l5f31188_set_dgc_lut(struct mipi_dsim_device *dev,
-   struct mipi_dsim_master_ops *ops)
-{
-   const unsigned char data_to_send[] = {
-   0xC1, 0x01, 0x00, 0x04, 0x0E, 0x18, 0x1E, 0x26,
-   0x2F, 0x36, 0x3E, 0x47, 0x4E, 0x56, 0x5D, 0x65,
-   0x6D, 0x75, 0x7D, 0x84, 0x8C, 0x94, 0x9C, 0xA4,
-   0xAD, 0xB5, 0xBD, 0xC5, 0xCC, 0xD4, 0xDE, 0xE5,
-   0xEE, 0xF7, 0xFF, 0x3F, 0x9A, 0xCE, 0xD4, 0x21,
-   0xA1, 0x26, 0x54, 0x00, 0x00, 0x04, 0x0E, 0x19,
-   0x1F, 0x27, 0x30, 0x37, 0x40, 0x48, 0x50, 0x58,
-   0x60, 0x67, 0x6F, 0x77, 0x7F, 0x87, 0x8F, 0x97,
-   0x9F, 0xA7, 0xB0, 0xB8, 0xC0, 0xC8, 0xCE, 0xD8,
-   0xE0, 0xE7, 0xF0, 0xF7, 0xFF, 0x3C, 0xEB, 0xFD,
-   0x2F, 0x66, 0xA8, 0x2C, 0x46, 0x00, 0x00, 0x04,
-   0x0E, 0x18, 0x1E, 0x26, 0x30, 0x38, 0x41, 0x4A,
-   

Re: [U-Boot] [PATCH 2/2] sf: Preserve QE bit when clearing BP# bits for Macronix flash

2017-08-03 Thread Bin Meng
On Wed, Aug 2, 2017 at 6:26 AM, Bin Meng  wrote:
> Hi Jagan,
>
> On Wed, Aug 2, 2017 at 12:01 AM, Jagan Teki  wrote:
>> On Sun, Jul 23, 2017 at 8:14 PM, Bin Meng  wrote:
>>> On some flash (like Macronix), QE (quad enable) bit is in the same
>>> status register as BP# bits, and we need preserve its original value
>>> during a reboot cycle as this is required by some platforms (like
>>> Intel ICH SPI controller working under descriptor mode).
>>>
>>> Signed-off-by: Bin Meng 
>>> ---
>>>
>>>  drivers/mtd/spi/spi_flash.c | 17 +++--
>>>  1 file changed, 15 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
>>> index 0034a28..7d8c660 100644
>>> --- a/drivers/mtd/spi/spi_flash.c
>>> +++ b/drivers/mtd/spi/spi_flash.c
>>> @@ -947,11 +947,24 @@ int spi_flash_scan(struct spi_flash *flash)
>>> if (IS_ERR_OR_NULL(info))
>>> return -ENOENT;
>>>
>>> -   /* Flash powers up read-only, so clear BP# bits */
>>> +   /*
>>> +* Flash powers up read-only, so clear BP# bits.
>>> +*
>>> +* Note on some flash (like Macronix), QE (quad enable) bit is in 
>>> the
>>> +* same status register as BP# bits, and we need preserve its 
>>> original
>>> +* value during a reboot cycle as this is required by some platforms
>>> +* (like Intel ICH SPI controller working under descriptor mode).
>>> +*/
>>> if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_ATMEL ||
>>> -   JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_MACRONIX ||
>>> JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST)
>>> write_sr(flash, 0);
>>> +   if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_MACRONIX) {
>>> +   u8 sr = 0;
>>> +
>>> +   read_sr(flash, );
>>> +   sr &= STATUS_QEB_MXIC;
>>> +   write_sr(flash, sr);
>>> +   }
>>
>> It doesn't make sense to have one(specific) controller fix to be
>> generic to all macronix chips, think about alternative.
>>
>
> This is no way to fix at the controller level. Actually this is
> nothing related to controller level. It's just the bootstrap settings
> (QE bit in this case) that cannot be overwritten by someone else
> (although it's seen on Intel, it might happen on some other
> architecture). The logic in the codes are having issues. Its comment
> says: clear BP# bits, but it clears QE bit for Macronix flash as well,
> which is wrong. The update was just to make sure the codes do as what
> its comment says.
>
> If you have any other alternative, please suggest.
>

Ping again..

Can you please comment on this? I would like this patch gets in the
upcoming release.

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] usb: kbd: don't fail with iomux

2017-08-03 Thread Bin Meng
On Fri, Aug 4, 2017 at 3:22 AM, Rob Clark  wrote:
> stdin might not be set, which would cause iomux_doenv() to fail
> therefore causing probe_usb_keyboard() to fail.  Furthermore if we do
> have iomux enabled, the sensible thing (in terms of user experience)
> would be to simply add ourselves to the list of stdin devices.
>
> This fixes an issue with usbkbd on dragonboard410c with distro-
> bootcmd, where stdin is not set (so stdinname is null).
>
> Signed-off-by: Rob Clark 
> ---
>  common/usb_kbd.c | 15 +++
>  1 file changed, 15 insertions(+)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 6/6] board: atmel: Add SAMA5D27 SOM1 EK board

2017-08-03 Thread Wenyou Yang
From: Wenyou Yang 

The SAMA5D27-SiP (System in Package) integrates the SAMA5D2
with 1Gbit DDR2-SDRAM in a single package.

The SAMA5D27 SOM1 embeds a 64Mbit QSPI flash, KSZ8081 Phy and
Mac-address EEPROM.

Signed-off-by: Wenyou Yang 
---

Changes in v3:
 - Rebase on the PATCH: Atmel PIT timer driver and Remove 
CONFIG_SYS_EXTRA_OPTIONS.
 - Use the new Atmel PIT timer driver.
 - Remove "SAMA5D2" from CONFIG_SYS_EXTRA_OPTIONS options.
 - Move CONFIG_ENV_IS_IN_FAT to Kconfig.

Changes in v2:
 - Add the reviewed-by tag.
 - Add the help in Kconfig to describe the board and peripherals.
 - Add the code to display the company's logo and board information.
 - Replace the code to set the ethernet mac address with the common
   code from the board/atmel/common folder.

 arch/arm/dts/Makefile   |   3 +
 arch/arm/dts/at91-sama5d27_som1_ek.dts  | 215 
 arch/arm/dts/sama5d2.dtsi   |  20 +++
 arch/arm/dts/sama5d27_som1.dtsi | 159 ++
 arch/arm/mach-at91/Kconfig  |  14 ++
 board/atmel/sama5d27_som1_ek/Kconfig|  15 ++
 board/atmel/sama5d27_som1_ek/MAINTAINERS|   6 +
 board/atmel/sama5d27_som1_ek/Makefile   |   8 +
 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c | 189 +
 configs/sama5d27_som1_ek_mmc_defconfig  |  88 ++
 configs/sama5d27_som1_ek_spiflash_defconfig |  88 ++
 include/configs/sama5d27_som1_ek.h  |  94 +++
 12 files changed, 899 insertions(+)
 create mode 100644 arch/arm/dts/at91-sama5d27_som1_ek.dts
 create mode 100644 arch/arm/dts/sama5d27_som1.dtsi
 create mode 100644 board/atmel/sama5d27_som1_ek/Kconfig
 create mode 100644 board/atmel/sama5d27_som1_ek/MAINTAINERS
 create mode 100644 board/atmel/sama5d27_som1_ek/Makefile
 create mode 100644 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c
 create mode 100644 configs/sama5d27_som1_ek_mmc_defconfig
 create mode 100644 configs/sama5d27_som1_ek_spiflash_defconfig
 create mode 100644 include/configs/sama5d27_som1_ek.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 132fa69fe5..0a68663e9f 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -404,6 +404,9 @@ dtb-$(CONFIG_TARGET_OMAP3_LOGIC) += \
 dtb-$(CONFIG_TARGET_SAMA5D2_XPLAINED) += \
at91-sama5d2_xplained.dtb
 
+dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \
+   at91-sama5d27_som1_ek.dtb
+
 dtb-$(CONFIG_TARGET_SAMA5D3XEK) += \
sama5d31ek.dtb \
sama5d33ek.dtb \
diff --git a/arch/arm/dts/at91-sama5d27_som1_ek.dts 
b/arch/arm/dts/at91-sama5d27_som1_ek.dts
new file mode 100644
index 00..5e62d4af71
--- /dev/null
+++ b/arch/arm/dts/at91-sama5d27_som1_ek.dts
@@ -0,0 +1,215 @@
+/*
+ * at91-sama5d27_som1_ek.dts - Device Tree file for SAMA5D27 SOM1 EK board
+ *
+ *  Copyright (C) 2017 Microchip Corporation
+ * Wenyou Yang 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE 

[U-Boot] [PATCH v3 4/6] ARM: at91: mach: Add missing defines of MPDDRC

2017-08-03 Thread Wenyou Yang
Add missing defines of Multiport DDR-SDRAM Controller (MPDDRC).

Signed-off-by: Wenyou Yang 
Reviewed-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-at91/include/mach/atmel_mpddrc.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-at91/include/mach/atmel_mpddrc.h 
b/arch/arm/mach-at91/include/mach/atmel_mpddrc.h
index 803501f5cf..40e1cf0a0a 100644
--- a/arch/arm/mach-at91/include/mach/atmel_mpddrc.h
+++ b/arch/arm/mach-at91/include/mach/atmel_mpddrc.h
@@ -96,6 +96,10 @@ int ddr3_init(const unsigned int base,
 #define ATMEL_MPDDRC_CR_DLL_RESET_ENABLED  (0x1 << 7)
 #define ATMEL_MPDDRC_CR_DIC_DS (0x1 << 8)
 #define ATMEL_MPDDRC_CR_DIS_DLL(0x1 << 9)
+#define ATMEL_MPDDRC_CR_ZQ_INIT(0x0 << 10)
+#define ATMEL_MPDDRC_CR_ZQ_LONG(0x1 << 10)
+#define ATMEL_MPDDRC_CR_ZQ_SHORT   (0x2 << 10)
+#define ATMEL_MPDDRC_CR_ZQ_RESET   (0x3 << 10)
 #define ATMEL_MPDDRC_CR_OCD_DEFAULT(0x7 << 12)
 #define ATMEL_MPDDRC_CR_DQMS_SHARED(0x1 << 16)
 #define ATMEL_MPDDRC_CR_ENRDM_ON   (0x1 << 17)
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 3/6] ARM: at91: spl: Add boot device for boot from QSPI

2017-08-03 Thread Wenyou Yang
Add the boot device for booting from the QSPI flash.

Signed-off-by: Wenyou Yang 
Reviewed-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-at91/spl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-at91/spl.c b/arch/arm/mach-at91/spl.c
index c2e2d90a89..7e7e24bbe6 100644
--- a/arch/arm/mach-at91/spl.c
+++ b/arch/arm/mach-at91/spl.c
@@ -58,6 +58,8 @@ u32 spl_boot_device(void)
if (dev == ATMEL_SAMA5_BOOT_FROM_SPI)
return BOOT_DEVICE_SPI;
 #endif
+   if (dev == ATMEL_SAMA5_BOOT_FROM_QSPI)
+   return BOOT_DEVICE_SPI;
 
if (dev == ATMEL_SAMA5_BOOT_FROM_SMC)
return BOOT_DEVICE_NAND;
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 2/6] ARM: at91: spl: Add mck function to lower rate while switching

2017-08-03 Thread Wenyou Yang
Refer to the commit 70f8c8316ad(PMC: add new mck function to lower
rate while switching) from AT91Bootstrap.

While switching to a lower clock source, we must switch the clock
source first instead of last. Otherwise, we could end up with
too high frequency on internal bus and peripherals.
This happen on SAMA5D2 as we exit from ROM code @396MHz.

Add a function pmc_mck_init_down() to allow this sequence.

Signed-off-by: Wenyou Yang 
---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-at91/armv7/clock.c  | 36 +++
 arch/arm/mach-at91/include/mach/at91_common.h |  1 +
 2 files changed, 37 insertions(+)

diff --git a/arch/arm/mach-at91/armv7/clock.c b/arch/arm/mach-at91/armv7/clock.c
index 2e55953799..8ae01f4020 100644
--- a/arch/arm/mach-at91/armv7/clock.c
+++ b/arch/arm/mach-at91/armv7/clock.c
@@ -150,6 +150,42 @@ void at91_mck_init(u32 mckr)
;
 }
 
+void at91_mck_init_down(u32 mckr)
+{
+   struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+   u32 tmp;
+
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_CSS_MASK);
+   tmp |= (mckr & AT91_PMC_MCKR_CSS_MASK);
+   writel(tmp, >mckr);
+
+   while (!(readl(>sr) & AT91_PMC_MCKRDY))
+   ;
+
+#ifdef CPU_HAS_H32MXDIV
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_H32MXDIV);
+   tmp |= (mckr & AT91_PMC_MCKR_H32MXDIV);
+   writel(tmp, >mckr);
+#endif
+
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_PLLADIV_MASK);
+   tmp |= (mckr & AT91_PMC_MCKR_PLLADIV_MASK);
+   writel(tmp, >mckr);
+
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_MDIV_MASK);
+   tmp |= (mckr & AT91_PMC_MCKR_MDIV_MASK);
+   writel(tmp, >mckr);
+
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_PRES_MASK);
+   tmp |= (mckr & AT91_PMC_MCKR_PRES_MASK);
+   writel(tmp, >mckr);
+}
+
 int at91_enable_periph_generated_clk(u32 id, u32 clk_source, u32 div)
 {
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
diff --git a/arch/arm/mach-at91/include/mach/at91_common.h 
b/arch/arm/mach-at91/include/mach/at91_common.h
index 5416eb455d..0b09ce7b2e 100644
--- a/arch/arm/mach-at91/include/mach/at91_common.h
+++ b/arch/arm/mach-at91/include/mach/at91_common.h
@@ -25,6 +25,7 @@ void at91_lcd_hw_init(void);
 void at91_plla_init(u32 pllar);
 void at91_pllb_init(u32 pllar);
 void at91_mck_init(u32 mckr);
+void at91_mck_init_down(u32 mckr);
 void at91_pmc_init(void);
 void mem_init(void);
 void at91_phy_reset(void);
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 5/6] ARM: at91: Get the Chip ID of SAMA5D2 SiP

2017-08-03 Thread Wenyou Yang
From: Wenyou Yang 

The SAMA5D2 SiP(System in Package) has different Chip IDs in the
CHIPID and CHIP_EXID registers.

Signed-off-by: Wenyou Yang 
Reviewed-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-at91/armv7/sama5d2_devices.c | 26 --
 arch/arm/mach-at91/include/mach/sama5d2.h  |  7 ++-
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-at91/armv7/sama5d2_devices.c 
b/arch/arm/mach-at91/armv7/sama5d2_devices.c
index 978eac29bd..de1d9b5bfb 100644
--- a/arch/arm/mach-at91/armv7/sama5d2_devices.c
+++ b/arch/arm/mach-at91/armv7/sama5d2_devices.c
@@ -10,11 +10,20 @@
 #include 
 #include 
 
-char *get_cpu_name()
+int cpu_is_sama5d2(void)
 {
+   unsigned int chip_id = get_chip_id();
+
+   return ((chip_id == ARCH_ID_SAMA5D2) ||
+   (chip_id == ARCH_ID_SAMA5D2_SIP)) ? 1 : 0;
+}
+
+char *get_cpu_name(void)
+{
+   unsigned int chip_id = get_chip_id();
unsigned int extension_id = get_extension_chip_id();
 
-   if (cpu_is_sama5d2()) {
+   if (chip_id == ARCH_ID_SAMA5D2) {
switch (extension_id) {
case ARCH_EXID_SAMA5D21CU:
return "SAMA5D21";
@@ -41,6 +50,19 @@ char *get_cpu_name()
}
}
 
+   if ((chip_id == ARCH_ID_SAMA5D2) || (chip_id == ARCH_ID_SAMA5D2_SIP)) {
+   switch (extension_id) {
+   case ARCH_EXID_SAMA5D225C_D1M:
+   return "SAMA5D225 128M bits DDR2 SDRAM";
+   case ARCH_EXID_SAMA5D27C_D5M:
+   return "SAMA5D27 512M bits DDR2 SDRAM";
+   case ARCH_EXID_SAMA5D27C_D1G:
+   return "SAMA5D27 1G bits DDR2 SDRAM";
+   case ARCH_EXID_SAMA5D28C_D1G:
+   return "SAMA5D28 1G bits DDR2 SDRAM";
+   }
+   }
+
return "Unknown CPU type";
 }
 
diff --git a/arch/arm/mach-at91/include/mach/sama5d2.h 
b/arch/arm/mach-at91/include/mach/sama5d2.h
index 299d416200..677644d361 100644
--- a/arch/arm/mach-at91/include/mach/sama5d2.h
+++ b/arch/arm/mach-at91/include/mach/sama5d2.h
@@ -217,7 +217,11 @@
 #define ARCH_EXID_SAMA5D28CU   0x0010
 #define ARCH_EXID_SAMA5D28CN   0x0020
 
-#define cpu_is_sama5d2()   (get_chip_id() == ARCH_ID_SAMA5D2)
+#define ARCH_ID_SAMA5D2_SIP0x8a5c08c2
+#define ARCH_EXID_SAMA5D225C_D1M   0x0053
+#define ARCH_EXID_SAMA5D27C_D5M0x0032
+#define ARCH_EXID_SAMA5D27C_D1G0x0033
+#define ARCH_EXID_SAMA5D28C_D1G0x0013
 
 /* No PMECC Galois table in ROM */
 #define NO_GALOIS_TABLE_IN_ROM
@@ -225,6 +229,7 @@
 #ifndef __ASSEMBLY__
 unsigned int get_chip_id(void);
 unsigned int get_extension_chip_id(void);
+int cpu_is_sama5d2(void);
 unsigned int has_lcdc(void);
 char *get_cpu_name(void);
 #endif
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 1/6] ARM: at91: spl: Adjust switching to oscillator for SAMA5D2

2017-08-03 Thread Wenyou Yang
As said in 29.5.7 section of SAMA5D2 datasheet, before switching to
the crystal oscillator, a check must be carried out to ensure that
the oscillator is present and that its freqency is valid.

Signed-off-by: Wenyou Yang 
Reviewed-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-at91/include/mach/at91_pmc.h |  2 ++
 arch/arm/mach-at91/spl_atmel.c | 18 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h 
b/arch/arm/mach-at91/include/mach/at91_pmc.h
index 2875ff20b1..08ad1bf2d0 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -87,6 +87,8 @@ typedef struct at91_pmc {
 
 #define AT91_PMC_MCFR_MAINRDY  0x0001
 #define AT91_PMC_MCFR_MAINF_MASK   0x
+#define AT91_PMC_MCFR_RCMEAS   0x0010
+#define AT91_PMC_MCFR_CCSS_XTAL_OSC0x0100
 
 #define AT91_PMC_MCKR_CSS_SLOW 0x
 #define AT91_PMC_MCKR_CSS_MAIN 0x0001
diff --git a/arch/arm/mach-at91/spl_atmel.c b/arch/arm/mach-at91/spl_atmel.c
index b75c2ccefd..ce16ef3bdb 100644
--- a/arch/arm/mach-at91/spl_atmel.c
+++ b/arch/arm/mach-at91/spl_atmel.c
@@ -32,6 +32,20 @@ static void switch_to_main_crystal_osc(void)
while (!(readl(>sr) & AT91_PMC_IXR_MOSCS))
;
 
+#if defined(CONFIG_SAMA5D2)
+   /* Enable a measurement of the external oscillator */
+   tmp = readl(>mcfr);
+   tmp |= AT91_PMC_MCFR_CCSS_XTAL_OSC;
+   tmp |= AT91_PMC_MCFR_RCMEAS;
+   writel(tmp, >mcfr);
+
+   while (!(readl(>mcfr) & AT91_PMC_MCFR_MAINRDY))
+   ;
+
+   if (!(readl(>mcfr) & AT91_PMC_MCFR_MAINF_MASK))
+   hang();
+#endif
+
tmp = readl(>mor);
tmp &= ~AT91_PMC_MOR_OSCBYPASS;
tmp &= ~AT91_PMC_MOR_KEY(0xff);
@@ -47,11 +61,13 @@ static void switch_to_main_crystal_osc(void)
while (!(readl(>sr) & AT91_PMC_IXR_MOSCSELS))
;
 
+#if !defined(CONFIG_SAMA5D2)
/* Wait until MAINRDY field is set to make sure main clock is stable */
while (!(readl(>mcfr) & AT91_PMC_MAINRDY))
;
+#endif
 
-#ifndef CONFIG_SAMA5D4
+#if !defined(CONFIG_SAMA5D4) && !defined(CONFIG_SAMA5D2)
tmp = readl(>mor);
tmp &= ~AT91_PMC_MOR_MOSCRCEN;
tmp &= ~AT91_PMC_MOR_KEY(0xff);
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 0/6] board: atmel: Add new board SAMA5D27-SOM1-EK board.

2017-08-03 Thread Wenyou Yang
The SAMA5D27-SOM1-EK board embeds a SAMA5D27 SOM1 module, which includes
a SAMA5D27-SiP chip and QSPI flash, Phy and MAC EEPROM. The SAMA5D27 SiP
integrates the SAMA5D2 with 1Gbit DDR2-SDRAM in a single package.
It is based on
1./ [PATCH v2 0/8] sf: improve support of (Q)SPI flash memories
https://lists.denx.de/pipermail/u-boot/2017-July/298806.html
2./ [PATCH v2 0/3] board: atmel: Set the ethernet mac address from 
eeprom
https://lists.denx.de/pipermail/u-boot/2017-July/300527.html
3./ [PATCH 0/7] board: atmel: Convert to support DM_VIDEO
https://lists.denx.de/pipermail/u-boot/2017-July/300533.html
4./ [PATCH] timer: Add Atmel PIT timer driver
https://lists.denx.de/pipermail/u-boot/2017-August/300788.html
5./ [PATCH 0/5] configs: at91: Remove value of CONFIG_SYS_EXTRA_OPTIONS 
option
https://lists.denx.de/pipermail/u-boot/2017-August/301103.html

Changes in v3:
 - Rebase on the PATCH: Atmel PIT timer driver and Remove 
CONFIG_SYS_EXTRA_OPTIONS.
 - Use the new Atmel PIT timer driver.
 - Remove "SAMA5D2" from CONFIG_SYS_EXTRA_OPTIONS options.
 - Move CONFIG_ENV_IS_IN_FAT to Kconfig.

Changes in v2:
 - Add the reviewed-by tag.
 - Add the help in Kconfig to describe the board and peripherals.
 - Add the code to display the company's logo and board information.
 - Replace the code to set the ethernet mac address with the common
   code from the board/atmel/common folder.

Wenyou Yang (6):
  ARM: at91: spl: Adjust switching to oscillator for SAMA5D2
  ARM: at91: spl: Add mck function to lower rate while switching
  ARM: at91: spl: Add boot device for boot from QSPI
  ARM: at91: mach: Add missing defines of MPDDRC
  ARM: at91: Get the Chip ID of SAMA5D2 SiP
  board: atmel: Add SAMA5D27 SOM1 EK board

 arch/arm/dts/Makefile   |   3 +
 arch/arm/dts/at91-sama5d27_som1_ek.dts  | 215 
 arch/arm/dts/sama5d2.dtsi   |  20 +++
 arch/arm/dts/sama5d27_som1.dtsi | 159 ++
 arch/arm/mach-at91/Kconfig  |  14 ++
 arch/arm/mach-at91/armv7/clock.c|  36 
 arch/arm/mach-at91/armv7/sama5d2_devices.c  |  26 ++-
 arch/arm/mach-at91/include/mach/at91_common.h   |   1 +
 arch/arm/mach-at91/include/mach/at91_pmc.h  |   2 +
 arch/arm/mach-at91/include/mach/atmel_mpddrc.h  |   4 +
 arch/arm/mach-at91/include/mach/sama5d2.h   |   7 +-
 arch/arm/mach-at91/spl.c|   2 +
 arch/arm/mach-at91/spl_atmel.c  |  18 +-
 board/atmel/sama5d27_som1_ek/Kconfig|  15 ++
 board/atmel/sama5d27_som1_ek/MAINTAINERS|   6 +
 board/atmel/sama5d27_som1_ek/Makefile   |   8 +
 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c | 189 +
 configs/sama5d27_som1_ek_mmc_defconfig  |  88 ++
 configs/sama5d27_som1_ek_spiflash_defconfig |  88 ++
 include/configs/sama5d27_som1_ek.h  |  94 +++
 20 files changed, 991 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/at91-sama5d27_som1_ek.dts
 create mode 100644 arch/arm/dts/sama5d27_som1.dtsi
 create mode 100644 board/atmel/sama5d27_som1_ek/Kconfig
 create mode 100644 board/atmel/sama5d27_som1_ek/MAINTAINERS
 create mode 100644 board/atmel/sama5d27_som1_ek/Makefile
 create mode 100644 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c
 create mode 100644 configs/sama5d27_som1_ek_mmc_defconfig
 create mode 100644 configs/sama5d27_som1_ek_spiflash_defconfig
 create mode 100644 include/configs/sama5d27_som1_ek.h

-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/5] ARM: at91: Remove hardware.h included in configs

2017-08-03 Thread Wenyou Yang
From: Wenyou Yang 

As said in READRE.kconfig, include/configs/*.h will be removed
after all options are switched to Kconfig. As the first step,
remove the follow line from include/configs/*.h.

 #include 

Signed-off-by: Wenyou Yang 
---

 arch/arm/mach-at91/atmel_sfr.c  |  1 +
 arch/arm/mach-at91/matrix.c |  1 +
 arch/arm/mach-at91/phy.c|  1 +
 drivers/pinctrl/pinctrl-at91.c  |  1 +
 include/configs/at91-sama5_common.h |  2 --
 include/configs/at91sam9m10g45ek.h  |  4 +---
 include/configs/at91sam9n12ek.h |  8 +---
 include/configs/at91sam9x5ek.h  |  2 --
 include/configs/ma5d4evk.h  |  9 ++---
 include/configs/sama5d2_ptc.h   |  8 
 include/configs/sama5d2_xplained.h  |  2 +-
 include/configs/sama5d3_xplained.h  | 10 +-
 include/configs/sama5d3xek.h|  8 
 include/configs/sama5d4_xplained.h  |  4 ++--
 include/configs/sama5d4ek.h |  4 ++--
 include/configs/vinco.h | 11 +++
 16 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/arch/arm/mach-at91/atmel_sfr.c b/arch/arm/mach-at91/atmel_sfr.c
index adf44c6a94..d595ba8836 100644
--- a/arch/arm/mach-at91/atmel_sfr.c
+++ b/arch/arm/mach-at91/atmel_sfr.c
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/arch/arm/mach-at91/matrix.c b/arch/arm/mach-at91/matrix.c
index 57d72700d3..08659c87d4 100644
--- a/arch/arm/mach-at91/matrix.c
+++ b/arch/arm/mach-at91/matrix.c
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/arch/arm/mach-at91/phy.c b/arch/arm/mach-at91/phy.c
index ddd70f5ff0..adb761e1ac 100644
--- a/arch/arm/mach-at91/phy.c
+++ b/arch/arm/mach-at91/phy.c
@@ -13,6 +13,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 38c435e37a..81f30eabe9 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/configs/at91-sama5_common.h 
b/include/configs/at91-sama5_common.h
index b4135235d4..6da9d8eb3e 100644
--- a/include/configs/at91-sama5_common.h
+++ b/include/configs/at91-sama5_common.h
@@ -10,8 +10,6 @@
 #ifndef __AT91_SAMA5_COMMON_H
 #define __AT91_SAMA5_COMMON_H
 
-#include 
-
 #define CONFIG_SYS_TEXT_BASE   0x26f0
 
 /* ARM asynchronous clock */
diff --git a/include/configs/at91sam9m10g45ek.h 
b/include/configs/at91sam9m10g45ek.h
index 8b00370cdd..dbdc70a960 100644
--- a/include/configs/at91sam9m10g45ek.h
+++ b/include/configs/at91sam9m10g45ek.h
@@ -11,8 +11,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#include 
-
 #define CONFIG_SYS_TEXT_BASE   0x73f0
 
 #define CONFIG_ATMEL_LEGACY/* required until (g)pio is fixed */
@@ -58,7 +56,7 @@
 
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS   1
-#define CONFIG_SYS_SDRAM_BASE   ATMEL_BASE_CS6
+#define CONFIG_SYS_SDRAM_BASE   0x7000
 #define CONFIG_SYS_SDRAM_SIZE  0x0800
 
 #define CONFIG_SYS_INIT_SP_ADDR \
diff --git a/include/configs/at91sam9n12ek.h b/include/configs/at91sam9n12ek.h
index e4ff019967..ba68138f21 100644
--- a/include/configs/at91sam9n12ek.h
+++ b/include/configs/at91sam9n12ek.h
@@ -10,12 +10,6 @@
 #ifndef __AT91SAM9N12_CONFIG_H_
 #define __AT91SAM9N12_CONFIG_H_
 
-/*
- * SoC must be defined first, before hardware.h is included.
- * In this case SoC is defined in boards.cfg.
- */
-#include 
-
 #define CONFIG_SYS_TEXT_BASE   0x26f0
 
 /* ARM asynchronous clock */
@@ -60,7 +54,7 @@
  * that address while providing maximum stack area below.
  */
 # define CONFIG_SYS_INIT_SP_ADDR \
-   (ATMEL_BASE_SRAM + 16 * 1024 - GENERATED_GBL_DATA_SIZE)
+   (0x0030 + 16 * 1024 - GENERATED_GBL_DATA_SIZE)
 
 /* DataFlash */
 #ifdef CONFIG_CMD_SF
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index 7887791c37..5f53bcc4d0 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -9,8 +9,6 @@
 #ifndef __CONFIG_H__
 #define __CONFIG_H__
 
-#include 
-
 #define CONFIG_SYS_TEXT_BASE   0x26f0
 
 /* ARM asynchronous clock */
diff --git a/include/configs/ma5d4evk.h b/include/configs/ma5d4evk.h
index 7c28a94d92..542f96a0dc 100644
--- a/include/configs/ma5d4evk.h
+++ b/include/configs/ma5d4evk.h
@@ -15,11 +15,14 @@
 #define CONFIG_SYS_USE_SERIALFLASH 1
 #define CONFIG_BOARD_LATE_INIT
 
+/* Timer */
+#define CONFIG_SYS_TIMER_COUNTER   0xfc06863c
+
 /*
  * Memory configurations
  */
 #define CONFIG_NR_DRAM_BANKS   1
-#define CONFIG_SYS_SDRAM_BASE   ATMEL_BASE_DDRCS
+#define CONFIG_SYS_SDRAM_BASE  0x2000
 #define CONFIG_SYS_SDRAM_SIZE  0x1000
 
 #ifdef CONFIG_SPL_BUILD
@@ -46,8 +49,8 @@
  * Serial Driver
  */
 #define CONFIG_ATMEL_USART
-#define 

[U-Boot] [PATCH 4/5] ARM: at91: spl: Add macro CONFIG_XXXX_BOOT support

2017-08-03 Thread Wenyou Yang
Use the CONFIG__BOOT to indicate the boot media, instead of
the CONFIG_SYS_USE_ option, which is declared by
CONFIG_SYS_EXTRA_OPTIONS option.

Signed-off-by: Wenyou Yang 
---

 arch/arm/mach-at91/spl.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-at91/spl.c b/arch/arm/mach-at91/spl.c
index e113336b7b..c2e2d90a89 100644
--- a/arch/arm/mach-at91/spl.c
+++ b/arch/arm/mach-at91/spl.c
@@ -37,7 +37,7 @@ u32 spl_boot_device(void)
u32 off = (bootrom_stash.r4 >> ATMEL_SAMA5_BOOT_DEV_ID_OFF) &
  ATMEL_SAMA5_BOOT_DEV_ID_MASK;
 
-#if defined(CONFIG_SYS_USE_MMC)
+#if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
if (dev == ATMEL_SAMA5_BOOT_FROM_MCI) {
 #if defined(CONFIG_SPL_OF_CONTROL)
return BOOT_DEVICE_MMC1;
@@ -52,7 +52,9 @@ u32 spl_boot_device(void)
}
 #endif
 
-#if defined(CONFIG_SYS_USE_SERIALFLASH) || defined(CONFIG_SYS_USE_SPIFLASH)
+#if defined(CONFIG_SYS_USE_SERIALFLASH) || \
+   defined(CONFIG_SYS_USE_SPIFLASH) || \
+   defined(CONFIG_SPI_BOOT)
if (dev == ATMEL_SAMA5_BOOT_FROM_SPI)
return BOOT_DEVICE_SPI;
 #endif
@@ -71,11 +73,13 @@ u32 spl_boot_device(void)
 #else
 u32 spl_boot_device(void)
 {
-#ifdef CONFIG_SYS_USE_MMC
+#if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
return BOOT_DEVICE_MMC1;
-#elif CONFIG_SYS_USE_NANDFLASH
+#elif defined(CONFIG_SYS_USE_NANDFLASH) || defined(CONFIG_NAND_BOOT)
return BOOT_DEVICE_NAND;
-#elif CONFIG_SYS_USE_SERIALFLASH || CONFIG_SYS_USE_SPIFLASH
+#elif defined(CONFIG_SYS_USE_SERIALFLASH) || \
+   defined(CONFIG_SYS_USE_SPIFLASH) || \
+   defined(CONFIG_SPI_BOOT)
return BOOT_DEVICE_SPI;
 #endif
return BOOT_DEVICE_NONE;
@@ -85,7 +89,7 @@ u32 spl_boot_device(void)
 u32 spl_boot_mode(const u32 boot_device)
 {
switch (boot_device) {
-#ifdef CONFIG_SYS_USE_MMC
+#if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
case BOOT_DEVICE_MMC1:
case BOOT_DEVICE_MMC2:
return MMCSD_MODE_FS;
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 5/5] configs: at91: Remove CONFIG_SYS_EXTRA_OPTIONS assignment

2017-08-03 Thread Wenyou Yang
To remove the assignment of CONFIG_SYS_EXTRA_OPTIONS option,
which is deprecated, use the CONFIG__BOOT options to
indicate the boot media, and the SoC is selected by the board.

Signed-off-by: Wenyou Yang 
---

 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |  4 ++--
 board/atmel/at91sam9n12ek/at91sam9n12ek.c   |  6 +++---
 board/atmel/at91sam9x5ek/at91sam9x5ek.c |  4 ++--
 board/atmel/sama5d2_ptc/sama5d2_ptc.c   |  4 ++--
 board/atmel/sama5d3_xplained/sama5d3_xplained.c |  4 ++--
 board/atmel/sama5d3xek/sama5d3xek.c |  2 +-
 board/atmel/sama5d4_xplained/sama5d4_xplained.c |  2 +-
 board/atmel/sama5d4ek/sama5d4ek.c   |  2 +-
 configs/at91sam9m10g45ek_mmc_defconfig  |  2 +-
 configs/at91sam9m10g45ek_nandflash_defconfig|  2 +-
 configs/at91sam9n12ek_mmc_defconfig |  2 +-
 configs/at91sam9n12ek_nandflash_defconfig   |  2 +-
 configs/at91sam9n12ek_spiflash_defconfig|  2 +-
 configs/at91sam9x5ek_dataflash_defconfig|  2 +-
 configs/at91sam9x5ek_mmc_defconfig  |  2 +-
 configs/at91sam9x5ek_nandflash_defconfig|  2 +-
 configs/at91sam9x5ek_spiflash_defconfig |  2 +-
 configs/ma5d4evk_defconfig  |  2 +-
 configs/sama5d2_ptc_nandflash_defconfig |  2 +-
 configs/sama5d2_ptc_spiflash_defconfig  |  2 +-
 configs/sama5d2_xplained_mmc_defconfig  |  4 ++--
 configs/sama5d2_xplained_spiflash_defconfig |  2 +-
 configs/sama5d36ek_cmp_mmc_defconfig|  2 +-
 configs/sama5d36ek_cmp_nandflash_defconfig  |  2 +-
 configs/sama5d36ek_cmp_spiflash_defconfig   |  2 +-
 configs/sama5d3_xplained_mmc_defconfig  |  2 +-
 configs/sama5d3_xplained_nandflash_defconfig|  2 +-
 configs/sama5d3xek_mmc_defconfig|  2 +-
 configs/sama5d3xek_nandflash_defconfig  |  2 +-
 configs/sama5d3xek_spiflash_defconfig   |  2 +-
 configs/sama5d4_xplained_mmc_defconfig  |  2 +-
 configs/sama5d4_xplained_nandflash_defconfig|  2 +-
 configs/sama5d4_xplained_spiflash_defconfig |  2 +-
 configs/sama5d4ek_mmc_defconfig |  2 +-
 configs/sama5d4ek_nandflash_defconfig   |  2 +-
 configs/sama5d4ek_spiflash_defconfig|  2 +-
 configs/vinco_defconfig |  2 +-
 include/configs/at91-sama5_common.h |  6 +++---
 include/configs/at91sam9m10g45ek.h  |  8 
 include/configs/at91sam9n12ek.h | 21 ++---
 include/configs/at91sam9x5ek.h  | 25 +++--
 include/configs/sama5d2_ptc.h   |  8 
 include/configs/sama5d2_xplained.h  |  6 +++---
 include/configs/sama5d3_xplained.h  | 11 +--
 include/configs/sama5d3xek.h| 21 ++---
 include/configs/sama5d4_xplained.h  | 20 ++--
 include/configs/sama5d4ek.h | 20 ++--
 include/configs/vinco.h |  2 +-
 48 files changed, 115 insertions(+), 121 deletions(-)

diff --git a/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c 
b/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
index 903732b23b..98430c4246 100644
--- a/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
+++ b/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
@@ -84,9 +84,9 @@ void at91_spl_board_init(void)
at91_set_pio_pullup(AT91_PIO_PORTD, 7, 1);
at91_set_pio_pullup(AT91_PIO_PORTD, 8, 1);
 
-#ifdef CONFIG_SYS_USE_MMC
+#ifdef CONFIG_SD_BOOT
at91_mci_hw_init();
-#elif CONFIG_SYS_USE_NANDFLASH
+#elif CONFIG_NAND_BOOT
at91sam9m10g45ek_nand_hw_init();
 #endif
 }
diff --git a/board/atmel/at91sam9n12ek/at91sam9n12ek.c 
b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
index fec93165c1..540adf55b6 100644
--- a/board/atmel/at91sam9n12ek/at91sam9n12ek.c
+++ b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
@@ -224,11 +224,11 @@ int dram_init(void)
 
 void at91_spl_board_init(void)
 {
-#ifdef CONFIG_SYS_USE_MMC
+#ifdef CONFIG_SD_BOOT
at91_mci_hw_init();
-#elif CONFIG_SYS_USE_NANDFLASH
+#elif CONFIG_NAND_BOOT
at91sam9n12ek_nand_hw_init();
-#elif CONFIG_SYS_USE_SPIFLASH
+#elif CONFIG_SPI_BOOT
at91_spi0_hw_init(1 << 4);
 #endif
 }
diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c 
b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 3d1763b1e2..d69831ad15 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -138,9 +138,9 @@ int dram_init(void)
 
 void at91_spl_board_init(void)
 {
-#ifdef CONFIG_SYS_USE_MMC
+#ifdef CONFIG_SD_BOOT
at91_mci_hw_init();
-#elif CONFIG_SYS_USE_NANDFLASH
+#elif CONFIG_NAND_BOOT
at91sam9x5ek_nand_hw_init();
 #endif
 }
diff --git a/board/atmel/sama5d2_ptc/sama5d2_ptc.c 
b/board/atmel/sama5d2_ptc/sama5d2_ptc.c
index 9e6544bc07..c441e69ee4 100644
--- 

[U-Boot] [PATCH 2/5] ARM: at91: Add the SoC options to Kconfig

2017-08-03 Thread Wenyou Yang
From: Wenyou Yang 

To prepare to remove the SoCs options such as SAMA5D2, SAMA5D3
and SAMA5D4 from the CONFIG_SYS_EXTRA_OPTIONS option which is
deprecated, add the SoC options to Kconfig.

Signed-off-by: Wenyou Yang 
---

 arch/arm/mach-at91/Kconfig | 108 +
 1 file changed, 80 insertions(+), 28 deletions(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 9863876090..347ec736f2 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -3,6 +3,58 @@ if ARCH_AT91
 config AT91FAMILY
def_bool y
 
+config AT91SAM9260
+   bool
+   select CPU_ARM926EJS
+
+config AT91SAM9G20
+   bool
+   select CPU_ARM926EJS
+
+config AT91SAM9XE
+   bool
+   select CPU_ARM926EJS
+
+config AT91SAM9261
+   bool
+   select CPU_ARM926EJS
+
+config AT91SAM9263
+   bool
+   select CPU_ARM926EJS
+
+config AT91SAM9G45
+   bool
+   select CPU_ARM926EJS
+
+config AT91SAM9M10G45
+   bool
+   select CPU_ARM926EJS
+
+config AT91SAM9N12
+   bool
+   select CPU_ARM926EJS
+
+config AT91SAM9RL
+   bool
+   select CPU_ARM926EJS
+
+config AT91SAM9X5
+   bool
+   select CPU_ARM926EJS
+
+config SAMA5D2
+   bool
+   select CPU_V7
+
+config SAMA5D3
+   bool
+   select CPU_V7
+
+config SAMA5D4
+   bool
+   select CPU_V7
+
 choice
prompt "Atmel AT91 board select"
optional
@@ -13,24 +65,24 @@ config TARGET_AT91RM9200EK
 
 config TARGET_AT91SAM9260EK
bool "Atmel at91sam9260 reference board"
-   select CPU_ARM926EJS
+   select AT91SAM9260
select BOARD_EARLY_INIT_F
 
 config TARGET_ETHERNUT5
bool "Ethernut5 board"
-   select CPU_ARM926EJS
+   select AT91SAM9XE
 
 config TARGET_SNAPPER9260
bool "Support snapper9260"
-   select CPU_ARM926EJS
+   select AT91SAM9260
select DM
select DM_SERIAL
select DM_GPIO
 
 config TARGET_GURNARD
bool "Support gurnard"
+   select AT91SAM9G45
select BOARD_LATE_INIT
-   select CPU_ARM926EJS
select DM
select DM_SERIAL
select DM_GPIO
@@ -38,110 +90,110 @@ config TARGET_GURNARD
 
 config TARGET_AT91SAM9261EK
bool "Atmel at91sam9261 reference board"
-   select CPU_ARM926EJS
+   select AT91SAM9261
 
 config TARGET_PM9261
bool "Ronetix pm9261 board"
-   select CPU_ARM926EJS
+   select AT91SAM9261
 
 config TARGET_AT91SAM9263EK
bool "Atmel at91sam9263 reference board"
-   select CPU_ARM926EJS
+   select AT91SAM9263
select BOARD_EARLY_INIT_F
 
 config TARGET_USB_A9263
bool "Caloa USB A9260 board"
-   select CPU_ARM926EJS
+   select AT91SAM9263
 
 config TARGET_PM9263
bool "Ronetix pm9263 board"
-   select CPU_ARM926EJS
+   select AT91SAM9263
 
 config TARGET_AT91SAM9M10G45EK
bool "Atmel AT91SAM9M10G45-EK board"
-   select CPU_ARM926EJS
+   select AT91SAM9M10G45
select SUPPORT_SPL
select BOARD_EARLY_INIT_F
 
 config TARGET_PM9G45
bool "Ronetix pm9g45 board"
-   select CPU_ARM926EJS
+   select AT91SAM9G45
 
 config TARGET_PICOSAM9G45
bool "Mini-box picosam9g45 board"
-   select CPU_ARM926EJS
+   select AT91SAM9M10G45
select SUPPORT_SPL
 
 config TARGET_AT91SAM9N12EK
bool "Atmel AT91SAM9N12-EK board"
-   select CPU_ARM926EJS
+   select AT91SAM9N12
select SUPPORT_SPL
select BOARD_EARLY_INIT_F
 
 config TARGET_AT91SAM9RLEK
bool "Atmel at91sam9rl reference board"
-   select CPU_ARM926EJS
+   select AT91SAM9RL
select BOARD_EARLY_INIT_F
 
 config TARGET_AT91SAM9X5EK
bool "Atmel AT91SAM9X5-EK board"
-   select CPU_ARM926EJS
+   select AT91SAM9X5
select SUPPORT_SPL
select BOARD_EARLY_INIT_F
select BOARD_LATE_INIT
 
 config TARGET_SAMA5D2_PTC
bool "SAMA5D2 PTC board"
-   select CPU_V7
+   select SAMA5D2
select SUPPORT_SPL
select BOARD_EARLY_INIT_F
 
 config TARGET_SAMA5D2_XPLAINED
bool "SAMA5D2 Xplained board"
-   select CPU_V7
+   select SAMA5D2
select SUPPORT_SPL
select BOARD_EARLY_INIT_F
select BOARD_LATE_INIT
 
 config TARGET_SAMA5D3_XPLAINED
bool "SAMA5D3 Xplained board"
-   select CPU_V7
+   select SAMA5D3
select SUPPORT_SPL
select BOARD_EARLY_INIT_F
 
 config TARGET_SAMA5D3XEK
bool "SAMA5D3X-EK board"
-   select BOARD_LATE_INIT
-   select CPU_V7
+   select SAMA5D3
select SUPPORT_SPL
select BOARD_EARLY_INIT_F
+   select BOARD_LATE_INIT
 
 config TARGET_SAMA5D4_XPLAINED
bool "SAMA5D4 Xplained board"
-   select CPU_V7
+   select SAMA5D4
select SUPPORT_SPL
select BOARD_EARLY_INIT_F
select BOARD_LATE_INIT
 
 config 

[U-Boot] [PATCH 1/5] ARM: at91: Move CONFIG_AT91FAMILY option to Kconfig

2017-08-03 Thread Wenyou Yang
From: Wenyou Yang 

Move the CONFIG_AT91FAMILY option from include/mach/.h header
file to Kconfig.

Signed-off-by: Wenyou Yang 
---

 arch/arm/mach-at91/Kconfig| 3 +++
 arch/arm/mach-at91/include/mach/at91rm9200.h  | 1 -
 arch/arm/mach-at91/include/mach/at91sam9260.h | 5 -
 arch/arm/mach-at91/include/mach/at91sam9261.h | 5 -
 arch/arm/mach-at91/include/mach/at91sam9263.h | 5 -
 arch/arm/mach-at91/include/mach/at91sam9g45.h | 5 -
 arch/arm/mach-at91/include/mach/at91sam9rl.h  | 5 -
 arch/arm/mach-at91/include/mach/at91sam9x5.h  | 2 --
 arch/arm/mach-at91/include/mach/sama5d2.h | 5 -
 arch/arm/mach-at91/include/mach/sama5d3.h | 5 -
 arch/arm/mach-at91/include/mach/sama5d4.h | 5 -
 11 files changed, 3 insertions(+), 43 deletions(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 9f39e210b1..9863876090 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -1,5 +1,8 @@
 if ARCH_AT91
 
+config AT91FAMILY
+   def_bool y
+
 choice
prompt "Atmel AT91 board select"
optional
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h 
b/arch/arm/mach-at91/include/mach/at91rm9200.h
index d177bdcae5..d15fb7a292 100644
--- a/arch/arm/mach-at91/include/mach/at91rm9200.h
+++ b/arch/arm/mach-at91/include/mach/at91rm9200.h
@@ -6,7 +6,6 @@
 #ifndef __AT91RM9200_H__
 #define __AT91RM9200_H__
 
-#define CONFIG_AT91FAMILY  /* it's a member of AT91 family */
 #define CONFIG_ARCH_CPU_INIT   /* we need arch_cpu_init() for hw timers */
 #define CONFIG_AT91_GPIO   /* and require always gpio features */
 
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h 
b/arch/arm/mach-at91/include/mach/at91sam9260.h
index 1a4e84b050..24d5dbd68a 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -19,11 +19,6 @@
 #define AT91SAM9260_H
 
 /*
- * defines to be used in other places
- */
-#define CONFIG_AT91FAMILY  /* it's a member of AT91 */
-
-/*
  * Peripheral identifiers/interrupts.
  */
 #define ATMEL_ID_FIQ   0   /* Advanced Interrupt Controller (FIQ) */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h 
b/arch/arm/mach-at91/include/mach/at91sam9261.h
index 914a3b0460..06403ce225 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -19,11 +19,6 @@
 #define AT91SAM9261_H
 
 /*
- * defines to be used in other places
- */
-#define CONFIG_AT91FAMILY  /* it's a member of AT91 */
-
-/*
  * Peripheral identifiers/interrupts.
  */
 #define ATMEL_ID_FIQ   0   /* Advanced Interrupt Controller (FIQ) */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h 
b/arch/arm/mach-at91/include/mach/at91sam9263.h
index 71675abf82..be9a665db5 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9263.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9263.h
@@ -15,11 +15,6 @@
 #define AT91SAM9263_H
 
 /*
- * defines to be used in other places
- */
-#define CONFIG_AT91FAMILY  /* it's a member of AT91 */
-
-/*
  * Peripheral identifiers/interrupts.
  */
 #define ATMEL_ID_FIQ   0   /* Advanced Interrupt Controller (FIQ) */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h 
b/arch/arm/mach-at91/include/mach/at91sam9g45.h
index c3b3a8fdc8..60a401690d 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
@@ -13,11 +13,6 @@
 #define AT91SAM9G45_H
 
 /*
- * defines to be used in other places
- */
-#define CONFIG_AT91FAMILY  /* it's a member of AT91 */
-
-/*
  * Peripheral identifiers/interrupts.
  */
 #define ATMEL_ID_FIQ   0   /* Advanced Interrupt Controller (FIQ) */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h 
b/arch/arm/mach-at91/include/mach/at91sam9rl.h
index 70bbf4edaa..8f9155c9ea 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9rl.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h
@@ -15,11 +15,6 @@
 #define AT91SAM9RL_H
 
 /*
- * defines to be used in other places
- */
-#define CONFIG_AT91FAMILY  /* it's a member of AT91 */
-
-/*
  * Peripheral identifiers/interrupts.
  */
 #define ATMEL_ID_FIQ   0   /* Advanced Interrupt Controller (FIQ) */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h 
b/arch/arm/mach-at91/include/mach/at91sam9x5.h
index 8f460f016d..e9b25f0372 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9x5.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h
@@ -12,8 +12,6 @@
 #ifndef __AT91SAM9X5_H__
 #define __AT91SAM9X5_H__
 
-#define CONFIG_AT91FAMILY  /* it's a member of AT91 family */
-
 /*
  * Peripheral identifiers/interrupts.
  */
diff --git a/arch/arm/mach-at91/include/mach/sama5d2.h 
b/arch/arm/mach-at91/include/mach/sama5d2.h
index 9fe572621c..299d416200 100644
--- a/arch/arm/mach-at91/include/mach/sama5d2.h
+++ b/arch/arm/mach-at91/include/mach/sama5d2.h
@@ -11,11 +11,6 @@
 

[U-Boot] [PATCH 0/5] configs: at91: Remove value of CONFIG_SYS_EXTRA_OPTIONS option

2017-08-03 Thread Wenyou Yang
The CONFIG_SYS_EXTRA_OPTIONS option is deprecated, remove the value
of this option from the board default config files.


Wenyou Yang (5):
  ARM: at91: Move CONFIG_AT91FAMILY option to Kconfig
  ARM: at91: Add the SoC options to Kconfig
  ARM: at91: Remove hardware.h included in configs
  ARM: at91: spl: Add macro CONFIG__BOOT support
  configs: at91: Remove CONFIG_SYS_EXTRA_OPTIONS assignment

 arch/arm/mach-at91/Kconfig  | 111 ++--
 arch/arm/mach-at91/atmel_sfr.c  |   1 +
 arch/arm/mach-at91/include/mach/at91rm9200.h|   1 -
 arch/arm/mach-at91/include/mach/at91sam9260.h   |   5 --
 arch/arm/mach-at91/include/mach/at91sam9261.h   |   5 --
 arch/arm/mach-at91/include/mach/at91sam9263.h   |   5 --
 arch/arm/mach-at91/include/mach/at91sam9g45.h   |   5 --
 arch/arm/mach-at91/include/mach/at91sam9rl.h|   5 --
 arch/arm/mach-at91/include/mach/at91sam9x5.h|   2 -
 arch/arm/mach-at91/include/mach/sama5d2.h   |   5 --
 arch/arm/mach-at91/include/mach/sama5d3.h   |   5 --
 arch/arm/mach-at91/include/mach/sama5d4.h   |   5 --
 arch/arm/mach-at91/matrix.c |   1 +
 arch/arm/mach-at91/phy.c|   1 +
 arch/arm/mach-at91/spl.c|  16 ++--
 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |   4 +-
 board/atmel/at91sam9n12ek/at91sam9n12ek.c   |   6 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c |   4 +-
 board/atmel/sama5d2_ptc/sama5d2_ptc.c   |   4 +-
 board/atmel/sama5d3_xplained/sama5d3_xplained.c |   4 +-
 board/atmel/sama5d3xek/sama5d3xek.c |   2 +-
 board/atmel/sama5d4_xplained/sama5d4_xplained.c |   2 +-
 board/atmel/sama5d4ek/sama5d4ek.c   |   2 +-
 configs/at91sam9m10g45ek_mmc_defconfig  |   2 +-
 configs/at91sam9m10g45ek_nandflash_defconfig|   2 +-
 configs/at91sam9n12ek_mmc_defconfig |   2 +-
 configs/at91sam9n12ek_nandflash_defconfig   |   2 +-
 configs/at91sam9n12ek_spiflash_defconfig|   2 +-
 configs/at91sam9x5ek_dataflash_defconfig|   2 +-
 configs/at91sam9x5ek_mmc_defconfig  |   2 +-
 configs/at91sam9x5ek_nandflash_defconfig|   2 +-
 configs/at91sam9x5ek_spiflash_defconfig |   2 +-
 configs/ma5d4evk_defconfig  |   2 +-
 configs/sama5d2_ptc_nandflash_defconfig |   2 +-
 configs/sama5d2_ptc_spiflash_defconfig  |   2 +-
 configs/sama5d2_xplained_mmc_defconfig  |   4 +-
 configs/sama5d2_xplained_spiflash_defconfig |   2 +-
 configs/sama5d36ek_cmp_mmc_defconfig|   2 +-
 configs/sama5d36ek_cmp_nandflash_defconfig  |   2 +-
 configs/sama5d36ek_cmp_spiflash_defconfig   |   2 +-
 configs/sama5d3_xplained_mmc_defconfig  |   2 +-
 configs/sama5d3_xplained_nandflash_defconfig|   2 +-
 configs/sama5d3xek_mmc_defconfig|   2 +-
 configs/sama5d3xek_nandflash_defconfig  |   2 +-
 configs/sama5d3xek_spiflash_defconfig   |   2 +-
 configs/sama5d4_xplained_mmc_defconfig  |   2 +-
 configs/sama5d4_xplained_nandflash_defconfig|   2 +-
 configs/sama5d4_xplained_spiflash_defconfig |   2 +-
 configs/sama5d4ek_mmc_defconfig |   2 +-
 configs/sama5d4ek_nandflash_defconfig   |   2 +-
 configs/sama5d4ek_spiflash_defconfig|   2 +-
 configs/vinco_defconfig |   2 +-
 drivers/pinctrl/pinctrl-at91.c  |   1 +
 include/configs/at91-sama5_common.h |   8 +-
 include/configs/at91sam9m10g45ek.h  |  12 ++-
 include/configs/at91sam9n12ek.h |  29 +++
 include/configs/at91sam9x5ek.h  |  27 +++---
 include/configs/ma5d4evk.h  |   9 +-
 include/configs/sama5d2_ptc.h   |  16 ++--
 include/configs/sama5d2_xplained.h  |   8 +-
 include/configs/sama5d3_xplained.h  |  21 +++--
 include/configs/sama5d3xek.h|  29 +++
 include/configs/sama5d4_xplained.h  |  24 ++---
 include/configs/sama5d4ek.h |  24 ++---
 include/configs/vinco.h |  13 +--
 65 files changed, 245 insertions(+), 237 deletions(-)

-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] board: atmel: Enable to use new timer driver

2017-08-03 Thread Wenyou Yang
Use the Atmel PIT timer driver which supports the driver model
and device tree.

Signed-off-by: Wenyou Yang 
---
The patch is based on,
[PATCH] timer: Add Atmel PIT timer driver
https://lists.denx.de/pipermail/u-boot/2017-August/300788.html

 arch/arm/dts/sama5d2.dtsi | 28 +++
 arch/arm/mach-at91/include/mach/at91sam9g45.h |  3 ---
 arch/arm/mach-at91/include/mach/at91sam9x5.h  |  3 ---
 arch/arm/mach-at91/include/mach/sama5d2.h |  3 ---
 arch/arm/mach-at91/include/mach/sama5d3.h |  3 ---
 arch/arm/mach-at91/include/mach/sama5d4.h |  3 ---
 configs/at91sam9m10g45ek_mmc_defconfig|  2 ++
 configs/at91sam9m10g45ek_nandflash_defconfig  |  2 ++
 configs/at91sam9n12ek_mmc_defconfig   |  2 ++
 configs/at91sam9n12ek_nandflash_defconfig |  2 ++
 configs/at91sam9n12ek_spiflash_defconfig  |  2 ++
 configs/at91sam9x5ek_dataflash_defconfig  |  2 ++
 configs/at91sam9x5ek_mmc_defconfig|  2 ++
 configs/at91sam9x5ek_nandflash_defconfig  |  2 ++
 configs/at91sam9x5ek_spiflash_defconfig   |  2 ++
 configs/gurnard_defconfig |  2 ++
 configs/sama5d2_xplained_mmc_defconfig|  3 +++
 configs/sama5d2_xplained_spiflash_defconfig   |  3 +++
 configs/sama5d36ek_cmp_mmc_defconfig  |  4 +++-
 configs/sama5d36ek_cmp_nandflash_defconfig|  2 ++
 configs/sama5d36ek_cmp_spiflash_defconfig |  2 ++
 configs/sama5d3_xplained_mmc_defconfig|  3 +++
 configs/sama5d3_xplained_nandflash_defconfig  |  3 +++
 configs/sama5d3xek_mmc_defconfig  |  3 +++
 configs/sama5d3xek_nandflash_defconfig|  3 +++
 configs/sama5d3xek_spiflash_defconfig |  3 +++
 configs/sama5d4_xplained_mmc_defconfig|  5 -
 configs/sama5d4_xplained_nandflash_defconfig  |  3 +++
 configs/sama5d4_xplained_spiflash_defconfig   |  3 +++
 configs/sama5d4ek_mmc_defconfig   |  3 +++
 configs/sama5d4ek_nandflash_defconfig |  3 +++
 configs/sama5d4ek_spiflash_defconfig  |  3 +++
 include/configs/corvus.h  |  3 +++
 include/configs/picosam9g45.h |  3 +++
 include/configs/pm9g45.h  |  3 +++
 include/configs/sama5d2_ptc.h |  3 +++
 36 files changed, 107 insertions(+), 17 deletions(-)

diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi
index fbaac0834c..4bdbb70cd5 100644
--- a/arch/arm/dts/sama5d2.dtsi
+++ b/arch/arm/dts/sama5d2.dtsi
@@ -639,6 +639,34 @@
status = "disabled";
};
 
+   rstc@f8048000 {
+   compatible = "atmel,sama5d3-rstc";
+   reg = <0xf8048000 0x10>;
+   clocks = <>;
+   };
+
+   shdwc@f8048010 {
+   compatible = "atmel,sama5d2-shdwc";
+   reg = <0xf8048010 0x10>;
+   clocks = <>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   atmel,wakeup-rtc-timer;
+   };
+
+   pit: timer@f8048030 {
+   compatible = "atmel,at91sam9260-pit";
+   reg = <0xf8048030 0x10>;
+   clocks = <>;
+   };
+
+   watchdog@f8048040 {
+   compatible = "atmel,sama5d4-wdt";
+   reg = <0xf8048040 0x10>;
+   clocks = <>;
+   status = "disabled";
+   };
+
sckc@f8048050 {
compatible = "atmel,at91sam9x5-sckc";
reg = <0xf8048050 0x4>;
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h 
b/arch/arm/mach-at91/include/mach/at91sam9g45.h
index 5c32e24ed0..c3b3a8fdc8 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
@@ -137,9 +137,6 @@
 #define ATMEL_BASE_CS6 0x7000
 #define ATMEL_BASE_CS7 0x8000
 
-/* Timer */
-#define CONFIG_SYS_TIMER_COUNTER   0xfd3c
-
 /*
  * Other misc defines
  */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h 
b/arch/arm/mach-at91/include/mach/at91sam9x5.h
index e7224e432d..8f460f016d 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9x5.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h
@@ -164,9 +164,6 @@
 #define ATMEL_CPU_NAME get_cpu_name()
 #endif
 
-/* Timer */
-#define CONFIG_SYS_TIMER_COUNTER   0xfe3c
-
 /*
  * Other misc defines
  */
diff --git a/arch/arm/mach-at91/include/mach/sama5d2.h 
b/arch/arm/mach-at91/include/mach/sama5d2.h
index 25c85411e5..9fe572621c 100644
--- 

Re: [U-Boot] [PATCH 2/2] sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

2017-08-03 Thread Bin Meng
Hi Simon,

On Thu, Aug 3, 2017 at 11:24 PM, Simon Glass  wrote:
> Hi Bin,
>
> On 1 August 2017 at 17:33, Bin Meng  wrote:
>> Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct
>> number depending on which host we are going to build and run.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/sandbox/Kconfig | 5 +
>>  board/sandbox/README.sandbox | 7 +++
>>  scripts/config_whitelist.txt | 1 -
>>  3 files changed, 8 insertions(+), 5 deletions(-)
>
> Reviewed-by: Simon Glass 
>
> Is it OK to build 64-bit sandbox on a 32-bit machine? Does that actually work?
>
> If then I think we need a 3-way setting like:
>
> - 32-bit
> - 64-bit
> - native (i.e. whatever the host is)

That means cross-compiling sandbox. So far this is not working. I will
take a look.

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] usb: kbd: don't fail with iomux

2017-08-03 Thread Rob Clark
On Thu, Aug 3, 2017 at 3:37 PM, Simon Glass  wrote:
> Hi Rob,
>
> On 3 August 2017 at 13:22, Rob Clark  wrote:
>> stdin might not be set, which would cause iomux_doenv() to fail
>> therefore causing probe_usb_keyboard() to fail.  Furthermore if we do
>> have iomux enabled, the sensible thing (in terms of user experience)
>> would be to simply add ourselves to the list of stdin devices.
>>
>> This fixes an issue with usbkbd on dragonboard410c with distro-
>> bootcmd, where stdin is not set (so stdinname is null).
>
> Is this version 2?

yes, this is the actual v2 (note the fake v2 I sent earlier today)

>>
>> Signed-off-by: Rob Clark 
>> ---
>>  common/usb_kbd.c | 15 +++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/common/usb_kbd.c b/common/usb_kbd.c
>> index d2d29cc98f..703dd748f5 100644
>> --- a/common/usb_kbd.c
>> +++ b/common/usb_kbd.c
>> @@ -517,7 +517,22 @@ static int probe_usb_keyboard(struct usb_device *dev)
>>
>> stdinname = getenv("stdin");
>>  #if CONFIG_IS_ENABLED(CONSOLE_MUX)
>> +   char *devname = DEVNAME;
>> +   /*
>> +* stdin might not be set yet.. either way, with console-mux the
>> +* sensible thing to do is add ourselves to the list of stdio
>> +* devices:
>> +*/
>> +   if (stdinname && !strstr(stdinname, DEVNAME)) {
>> +   char *newstdin = malloc(strlen(stdinname) + 
>> strlen(","DEVNAME) + 1);
>> +   sprintf(newstdin, "%s,"DEVNAME, stdinname);
>> +   stdinname = newstdin;
>> +   } else if (!stdinname) {
>> +   stdinname = devname;
>> +   }
>> error = iomux_doenv(stdin, stdinname);
>> +   if (stdinname != devname)
>> +   free(stdinname);
>
> Are you sure that free() will work? It looks like it is intended to
> free newstdin. I think it would be better to have a boolean for
> whether to free(), instead.

oh, that's true.. on v1 you would always go down one or the other leg
of the if/else, which is no longer the case

BR,
-R

>> if (error)
>> return error;
>>  #else
>> --
>> 2.13.0
>>
>
> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] usb: kbd: don't fail with iomux

2017-08-03 Thread Simon Glass
Hi Rob,

On 3 August 2017 at 13:22, Rob Clark  wrote:
> stdin might not be set, which would cause iomux_doenv() to fail
> therefore causing probe_usb_keyboard() to fail.  Furthermore if we do
> have iomux enabled, the sensible thing (in terms of user experience)
> would be to simply add ourselves to the list of stdin devices.
>
> This fixes an issue with usbkbd on dragonboard410c with distro-
> bootcmd, where stdin is not set (so stdinname is null).

Is this version 2?

>
> Signed-off-by: Rob Clark 
> ---
>  common/usb_kbd.c | 15 +++
>  1 file changed, 15 insertions(+)
>
> diff --git a/common/usb_kbd.c b/common/usb_kbd.c
> index d2d29cc98f..703dd748f5 100644
> --- a/common/usb_kbd.c
> +++ b/common/usb_kbd.c
> @@ -517,7 +517,22 @@ static int probe_usb_keyboard(struct usb_device *dev)
>
> stdinname = getenv("stdin");
>  #if CONFIG_IS_ENABLED(CONSOLE_MUX)
> +   char *devname = DEVNAME;
> +   /*
> +* stdin might not be set yet.. either way, with console-mux the
> +* sensible thing to do is add ourselves to the list of stdio
> +* devices:
> +*/
> +   if (stdinname && !strstr(stdinname, DEVNAME)) {
> +   char *newstdin = malloc(strlen(stdinname) + 
> strlen(","DEVNAME) + 1);
> +   sprintf(newstdin, "%s,"DEVNAME, stdinname);
> +   stdinname = newstdin;
> +   } else if (!stdinname) {
> +   stdinname = devname;
> +   }
> error = iomux_doenv(stdin, stdinname);
> +   if (stdinname != devname)
> +   free(stdinname);

Are you sure that free() will work? It looks like it is intended to
free newstdin. I think it would be better to have a boolean for
whether to free(), instead.

> if (error)
> return error;
>  #else
> --
> 2.13.0
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] fs: add fs_readdir()

2017-08-03 Thread Rob Clark
On Thu, Aug 3, 2017 at 3:10 PM, Brüns, Stefan
 wrote:
> On Donnerstag, 3. August 2017 18:54:30 CEST Rob Clark wrote:
>> Needed to support efi file protocol.  The fallback.efi loader wants
>> to be able to read the contents of the /EFI directory to find an OS
>> to boot.
>>
>> Currently only implemented for FAT, but that is all that UEFI is
>> required to support.
>>
>> Signed-off-by: Rob Clark 
>> ---
>>  fs/fat/fat.c  | 59
>> ++- fs/fs.c   |
>> 25 +
>>  include/fat.h |  4 +++-
>>  include/fs.h  | 21 +
>>  4 files changed, 95 insertions(+), 14 deletions(-)
>>
>
> NAK
>
> 1. The current code is already much to convoluted. Your changes add to this
> significantly

I agree with the first part of that statement, but not the second.
The code is pretty awful, but apparently works for people, and I don't
know (or have the time to learn) enough about FAT to do a massive
re-write.

I'll split this patch so we can add the interface without FAT
implementation, and I'll just carry around the second part downstream.

> 2. Your patch description neither references the exact part of the EFI
> specification you want to support (which took me some time, for reference it
> is "13.: Protocols - Media Access, 13.5: File Protocol"), nor are you
> specifying the required semantics (which is "open", "read", "close", where
> each read returns a single directory entry, similar to the POSIX opendir(),
> readdir() calls.

I can add a note in the commit message.. although I didn't really
think it would be too relevant to this patch.  (More relevant to the
patch which adds the efi_loader part, which depends on this patch.)

> 3. Usage of an index too lookup the next entry is also quite convoluted.
>
> 4. As far as I can see, your code will fail to find files in the root
> directory (look for LS_ROOT).

You could be right.. nothing ever traverses the root directory.

> I think it would be much better to first restructure the current code to use
> an readdir like interface internally, and then do everything EFI needs on top.

tbh, it would be nice even to implement fs_ls() generically on top of
readdir().. although I didn't do that since it would be slower
(without a re-write of FAT implementation, since we currently have to
re-traverse things for each readdir()).

BR,
-R

> This would get rid of the 4 almost identical copies to print the current
> directory entry (dols == LS_ROOT || dols == LS_YES), 2 copies of the remaining
> directory traversal and and also avoid the bug in (4.).
>
> Kind regards,
>
> Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] usb: kbd: don't fail with iomux

2017-08-03 Thread Rob Clark
stdin might not be set, which would cause iomux_doenv() to fail
therefore causing probe_usb_keyboard() to fail.  Furthermore if we do
have iomux enabled, the sensible thing (in terms of user experience)
would be to simply add ourselves to the list of stdin devices.

This fixes an issue with usbkbd on dragonboard410c with distro-
bootcmd, where stdin is not set (so stdinname is null).

Signed-off-by: Rob Clark 
---
 common/usb_kbd.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index d2d29cc98f..703dd748f5 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -517,7 +517,22 @@ static int probe_usb_keyboard(struct usb_device *dev)
 
stdinname = getenv("stdin");
 #if CONFIG_IS_ENABLED(CONSOLE_MUX)
+   char *devname = DEVNAME;
+   /*
+* stdin might not be set yet.. either way, with console-mux the
+* sensible thing to do is add ourselves to the list of stdio
+* devices:
+*/
+   if (stdinname && !strstr(stdinname, DEVNAME)) {
+   char *newstdin = malloc(strlen(stdinname) + strlen(","DEVNAME) 
+ 1);
+   sprintf(newstdin, "%s,"DEVNAME, stdinname);
+   stdinname = newstdin;
+   } else if (!stdinname) {
+   stdinname = devname;
+   }
error = iomux_doenv(stdin, stdinname);
+   if (stdinname != devname)
+   free(stdinname);
if (error)
return error;
 #else
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] fs: add fs_readdir()

2017-08-03 Thread Brüns , Stefan
On Donnerstag, 3. August 2017 18:54:30 CEST Rob Clark wrote:
> Needed to support efi file protocol.  The fallback.efi loader wants
> to be able to read the contents of the /EFI directory to find an OS
> to boot.
> 
> Currently only implemented for FAT, but that is all that UEFI is
> required to support.
> 
> Signed-off-by: Rob Clark 
> ---
>  fs/fat/fat.c  | 59
> ++- fs/fs.c   |
> 25 +
>  include/fat.h |  4 +++-
>  include/fs.h  | 21 +
>  4 files changed, 95 insertions(+), 14 deletions(-)
> 

NAK

1. The current code is already much to convoluted. Your changes add to this 
significantly

2. Your patch description neither references the exact part of the EFI 
specification you want to support (which took me some time, for reference it 
is "13.: Protocols - Media Access, 13.5: File Protocol"), nor are you 
specifying the required semantics (which is "open", "read", "close", where 
each read returns a single directory entry, similar to the POSIX opendir(), 
readdir() calls. 

3. Usage of an index too lookup the next entry is also quite convoluted.

4. As far as I can see, your code will fail to find files in the root 
directory (look for LS_ROOT).

I think it would be much better to first restructure the current code to use 
an readdir like interface internally, and then do everything EFI needs on top.

This would get rid of the 4 almost identical copies to print the current 
directory entry (dols == LS_ROOT || dols == LS_YES), 2 copies of the remaining 
directory traversal and and also avoid the bug in (4.).

Kind regards,

Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] usb: kbd: don't fail with iomux

2017-08-03 Thread Simon Glass
Hi Rob,

On 3 August 2017 at 12:57, Rob Clark  wrote:
> On Thu, Aug 3, 2017 at 2:25 PM, Simon Glass  wrote:
>> Hi Rob,
>>
>> On 3 August 2017 at 07:17, Rob Clark  wrote:
>>> stdin might not be set, which would cause iomux_doenv() to fail
>>> therefore causing probe_usb_keyboard() to fail.  Furthermore if we do
>>> have iomux enabled, the sensible thing (in terms of user experience)
>>> would be to simply add ourselves to the list of stdin devices.
>>>
>>
>> Is this intended to fix a bug? What board do you see this on, and
>> under what circumstances?
>
> yes, db410c w/ distro-bootcmd + usb keyboard.. stdin is not set.
>

OK I see. Can you please add that to the commit message also? It
provides motivation for anyone looking at it later.

>>> Signed-off-by: Rob Clark 
>>> ---
>>> v2: address Bin Meng's comments
>>>  common/usb_kbd.c | 14 ++
>>>  1 file changed, 14 insertions(+)
>>>
>>> diff --git a/common/usb_kbd.c b/common/usb_kbd.c
>>> index d2d29cc98f..72cf78abd4 100644
>>> --- a/common/usb_kbd.c
>>> +++ b/common/usb_kbd.c
>>> @@ -517,7 +517,21 @@ static int probe_usb_keyboard(struct usb_device *dev)
>>>
>>> stdinname = getenv("stdin");
>>>  #if CONFIG_IS_ENABLED(CONSOLE_MUX)
>>> +   char *devname = DEVNAME;
>>> +   /* stdin might not be set yet.. either way, with console-mux the
>>
>> /*
>>  * stdin might not be
>
> hmm, somehow I screwed up and re-sent the wrong patch, rather than the
> one that *actually* addressed Bin's comments (this was one of them)
>
> BR,
> -R
>
>>> +* sensible thing to do is add ourselves to the list of stdio
>>> +* devices:
>>> +*/
>>> +   if (stdinname) {
>>> +   char *newstdin = malloc(strlen(stdinname) + 
>>> strlen(","DEVNAME) + 1);
>>> +   sprintf(newstdin, "%s,"DEVNAME, stdinname);
>>> +   stdinname = newstdin;
>>> +   } else {
>>> +   stdinname = devname;
>>> +   }
>>> error = iomux_doenv(stdin, stdinname);
>>> +   if (stdinname != devname)
>>> +   free(stdinname);
>>> if (error)
>>> return error;
>>>  #else
>>> --
>>> 2.13.0
>>>
>>
>> Regards,
>> Simon

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ahci-pci: Update call to ahci_probe_scsi_pci()

2017-08-03 Thread Tom Rini
On Wed, Aug 02, 2017 at 07:07:17PM -0700, Bin Meng wrote:

> ahci_probe_scsi() now takes a 'base' argument, and there is an API
> that prepares base address for us: ahci_probe_scsi_pci().
> 
> Reviewed-by: Simon Glass 
> Reported-by: Tom Rini 
> Signed-off-by: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] PowerPC: mpc85xx: Update ft_verify_fdt

2017-08-03 Thread Tom Rini
On Thu, Aug 03, 2017 at 09:51:53AM -0400, Tom Rini wrote:

> With the changes to fdt_get_base_address() we need to modify the logic
> in ft_verify_fdt() for how we check the validity of the CCSR address.
> 
> Tested-on: qemu-ppce500 -M mpc8544ds
> Fixes: 336a44877af8 ("fdt: Correct fdt_get_base_address()")
> Cc: York Sun 
> Cc: Wolfgang Denk 
> Reviewed-by: Simon Glass 
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-sh/rmobile branch

2017-08-03 Thread Tom Rini
On Thu, Aug 03, 2017 at 08:24:45AM +0900, Nobuhiro Iwamatsu wrote:

> Hi Tom,
> 
> The following changes since commit 07d778382200a05a8b86cc135f79ec48e386f25a:
> 
>   Merge git://git.denx.de/u-boot-x86 (2017-08-01 15:38:32 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-sh.git rmobile
> 
> for you to fetch changes up to 9c552db619b2ab373dbf048714518c74c53e6c2b:
> 
>   ARM: rmobile: Update defconfig of R-Car Gen3 (2017-08-03 04:29:23 +0900)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] qemu-ppce500: Update get_phys_ccsrbar_addr_early()

2017-08-03 Thread Tom Rini
On Thu, Aug 03, 2017 at 09:16:36AM -0400, Tom Rini wrote:

> The logic of what fdt_get_base_address() will search for and return has
> changed.  Rework get_phys_ccsrbar_addr_early() to perform the logic that
> fdt_get_base_address used to perform.
> 
> Fixes: 336a44877af8 ("fdt: Correct fdt_get_base_address()")
> Reviewed-by: Simon Glass 
> Cc: Alexander Graf 
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-fsl-qoriq master

2017-08-03 Thread Tom Rini
On Tue, Aug 01, 2017 at 10:56:45PM +, York Sun wrote:

> Tom,
> 
> The following changes since commit f19955a01482d118eac0fdaf530ec6e5b08cf414:
> 
>Merge git://git.denx.de/u-boot-uniphier (2017-07-26 11:29:25 -0400)
> 
> are available in the git repository at:
> 
>git://git.denx.de/u-boot-fsl-qoriq.git 
> ec85721c8b94f9eb6807ebb15a223e4ec49a092a
> 
> for you to fetch changes up to ec85721c8b94f9eb6807ebb15a223e4ec49a092a:
> 
>arm64: ls2088ardb: Add distro secure boot support (2017-08-01 
> 08:28:57 -0700)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [GIT PULL] Xilinx fixes for v2017.09

2017-08-03 Thread Tom Rini
On Wed, Aug 02, 2017 at 01:15:09PM +0200, Michal Simek wrote:

> Hi Tom,
> 
> here are changes I have collected in my tree.
> I have added also a patch which make reserve_mmu as weak function which
> was reviewed by Simon. We need to for mini u-boot configurations which
> will be sent later.
> Travis is not showing any problem with this branch too.
> 
> Thanks,
> Michal
> 
> 
>  The following changes since commit
> 6364a5d4bd55beeedc11171419acd0bdff17a599:
> 
>Prepare v2017.09-rc1 (2017-07-31 20:37:25 -0400)
> 
>  are available in the git repository at:
> 
>git://www.denx.de/git/u-boot-microblaze.git tags/xilinx-for-v2017.09
> 
>  for you to fetch changes up to df1cd46fb84922735e1c12f54b7202b0268dcddd:
> 
>arm64: zynqmp: avoid out of buffer access (2017-08-02 09:11:52 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] usb: kbd: don't fail with iomux

2017-08-03 Thread Rob Clark
On Thu, Aug 3, 2017 at 2:25 PM, Simon Glass  wrote:
> Hi Rob,
>
> On 3 August 2017 at 07:17, Rob Clark  wrote:
>> stdin might not be set, which would cause iomux_doenv() to fail
>> therefore causing probe_usb_keyboard() to fail.  Furthermore if we do
>> have iomux enabled, the sensible thing (in terms of user experience)
>> would be to simply add ourselves to the list of stdin devices.
>>
>
> Is this intended to fix a bug? What board do you see this on, and
> under what circumstances?

yes, db410c w/ distro-bootcmd + usb keyboard.. stdin is not set.

>> Signed-off-by: Rob Clark 
>> ---
>> v2: address Bin Meng's comments
>>  common/usb_kbd.c | 14 ++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/common/usb_kbd.c b/common/usb_kbd.c
>> index d2d29cc98f..72cf78abd4 100644
>> --- a/common/usb_kbd.c
>> +++ b/common/usb_kbd.c
>> @@ -517,7 +517,21 @@ static int probe_usb_keyboard(struct usb_device *dev)
>>
>> stdinname = getenv("stdin");
>>  #if CONFIG_IS_ENABLED(CONSOLE_MUX)
>> +   char *devname = DEVNAME;
>> +   /* stdin might not be set yet.. either way, with console-mux the
>
> /*
>  * stdin might not be

hmm, somehow I screwed up and re-sent the wrong patch, rather than the
one that *actually* addressed Bin's comments (this was one of them)

BR,
-R

>> +* sensible thing to do is add ourselves to the list of stdio
>> +* devices:
>> +*/
>> +   if (stdinname) {
>> +   char *newstdin = malloc(strlen(stdinname) + 
>> strlen(","DEVNAME) + 1);
>> +   sprintf(newstdin, "%s,"DEVNAME, stdinname);
>> +   stdinname = newstdin;
>> +   } else {
>> +   stdinname = devname;
>> +   }
>> error = iomux_doenv(stdin, stdinname);
>> +   if (stdinname != devname)
>> +   free(stdinname);
>> if (error)
>> return error;
>>  #else
>> --
>> 2.13.0
>>
>
> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 30/30] env: Adjust the load() method to return an error

2017-08-03 Thread Simon Glass
The load() methods have inconsistent behaviour on error. Some of them load
an empty default environment. Some load an environment containing an error
message. Others do nothing.

As a step in the right direction, have the method return an error code.
Then the caller could handle this itself in a consistent way.

Signed-off-by: Simon Glass 
---

Changes in v5:
- Rebase to master

Changes in v4:
- Rebase to master, dropping patches already applied

Changes in v3:
- Rebase to master

Changes in v2:
- Rebase to master

 env/dataflash.c   |  4 +++-
 env/eeprom.c  |  4 +++-
 env/ext4.c|  6 --
 env/fat.c |  6 --
 env/flash.c   |  4 +++-
 env/mmc.c | 19 +++
 env/nand.c| 17 -
 env/nvram.c   |  4 +++-
 env/onenand.c |  4 +++-
 env/remote.c  |  4 +++-
 env/sata.c| 15 +--
 env/sf.c  | 20 +---
 env/ubi.c | 14 +-
 include/environment.h |  4 +++-
 14 files changed, 83 insertions(+), 42 deletions(-)

diff --git a/env/dataflash.c b/env/dataflash.c
index afa08f8fd5..77bc595e0d 100644
--- a/env/dataflash.c
+++ b/env/dataflash.c
@@ -23,7 +23,7 @@ static int env_dataflash_get_char(int index)
return c;
 }
 
-static void env_dataflash_load(void)
+static int env_dataflash_load(void)
 {
ulong crc, new = 0;
unsigned off;
@@ -44,6 +44,8 @@ static void env_dataflash_load(void)
env_import(buf, 1);
else
set_default_env("!bad CRC");
+
+   return 0;
 }
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
diff --git a/env/eeprom.c b/env/eeprom.c
index fbe4fd4efc..08ef6307fc 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -76,7 +76,7 @@ static int env_eeprom_get_char(int index)
return c;
 }
 
-static void env_eeprom_load(void)
+static int env_eeprom_load(void)
 {
char buf_env[CONFIG_ENV_SIZE];
unsigned int off = CONFIG_ENV_OFFSET;
@@ -182,6 +182,8 @@ static void env_eeprom_load(void)
off, (uchar *)buf_env, CONFIG_ENV_SIZE);
 
env_import(buf_env, 1);
+
+   return 0;
 }
 
 static int env_eeprom_save(void)
diff --git a/env/ext4.c b/env/ext4.c
index ee073a8b7c..65202213d3 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -75,7 +75,7 @@ static int env_ext4_save(void)
 }
 #endif /* CONFIG_CMD_SAVEENV */
 
-static void env_ext4_load(void)
+static int env_ext4_load(void)
 {
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
struct blk_desc *dev_desc = NULL;
@@ -109,10 +109,12 @@ static void env_ext4_load(void)
}
 
env_import(buf, 1);
-   return;
+   return 0;
 
 err_env_relocate:
set_default_env(NULL);
+
+   return -EIO;
 }
 
 U_BOOT_ENV_LOCATION(ext4) = {
diff --git a/env/fat.c b/env/fat.c
index a5a156c88b..ec49c39053 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -74,7 +74,7 @@ static int env_fat_save(void)
 #endif /* CMD_SAVEENV */
 
 #ifdef LOADENV
-static void env_fat_load(void)
+static int env_fat_load(void)
 {
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
struct blk_desc *dev_desc = NULL;
@@ -103,10 +103,12 @@ static void env_fat_load(void)
}
 
env_import(buf, 1);
-   return;
+   return 0;
 
 err_env_relocate:
set_default_env(NULL);
+
+   return -EIO;
 }
 #endif /* LOADENV */
 
diff --git a/env/flash.c b/env/flash.c
index 2d72c51622..b60be57a8d 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -308,7 +308,7 @@ done:
 #endif /* CONFIG_ENV_ADDR_REDUND */
 
 #ifdef LOADENV
-static void env_flash_load(void)
+static int env_flash_load(void)
 {
 #ifdef CONFIG_ENV_ADDR_REDUND
if (gd->env_addr != (ulong)&(flash_addr->data)) {
@@ -352,6 +352,8 @@ static void env_flash_load(void)
 #endif /* CONFIG_ENV_ADDR_REDUND */
 
env_import((char *)flash_addr, 1);
+
+   return 0;
 }
 #endif /* LOADENV */
 
diff --git a/env/mmc.c b/env/mmc.c
index 88ffc91f0b..3f3092d975 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -207,7 +207,7 @@ static inline int read_env(struct mmc *mmc, unsigned long 
size,
 }
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-static void env_mmc_load(void)
+static int env_mmc_load(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
struct mmc *mmc;
@@ -224,13 +224,13 @@ static void env_mmc_load(void)
 
errmsg = init_mmc_for_env(mmc);
if (errmsg) {
-   ret = 1;
+   ret = -EIO;
goto err;
}
 
if (mmc_get_env_addr(mmc, 0, ) ||
mmc_get_env_addr(mmc, 1, )) {
-   ret = 1;
+   ret = -EIO;
goto fini;
}
 
@@ -245,7 +245,7 @@ static void env_mmc_load(void)
 
if (read1_fail && read2_fail) {
errmsg = "!bad CRC";
-   ret = 1;
+   ret = -EIO;
goto fini;
} else if (!read1_fail && read2_fail) {
gd->env_valid = ENV_VALID;

Re: [U-Boot] [PATCH] ahci-pci: Update call to ahci_probe_scsi_pci()

2017-08-03 Thread Simon Glass
On 2 August 2017 at 20:07, Bin Meng  wrote:
> ahci_probe_scsi() now takes a 'base' argument, and there is an API
> that prepares base address for us: ahci_probe_scsi_pci().
>
> Reported-by: Tom Rini 
> Signed-off-by: Bin Meng 
> ---
>
>  drivers/ata/ahci-pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 16/30] env: Drop the env_name_spec global

2017-08-03 Thread Simon Glass
Add a name to the driver and use that instead of the global variable
declared by each driver.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 cmd/nvedit.c  |  4 +++-
 env/dataflash.c   |  3 +--
 env/eeprom.c  |  3 +--
 env/env.c |  2 +-
 env/ext4.c|  3 +--
 env/fat.c |  3 +--
 env/flash.c   |  3 +--
 env/mmc.c |  3 +--
 env/nand.c|  3 +--
 env/nowhere.c |  1 +
 env/nvram.c   |  3 +--
 env/onenand.c |  3 +--
 env/remote.c  |  3 +--
 env/sata.c|  3 +--
 env/sf.c  |  3 +--
 env/ubi.c |  2 --
 include/environment.h | 19 +++
 17 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index cd17db6409..75df997592 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -706,7 +706,9 @@ ulong getenv_ulong(const char *name, int base, ulong 
default_val)
 static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
   char * const argv[])
 {
-   printf("Saving Environment to %s...\n", env_name_spec);
+   struct env_driver *env = env_driver_lookup_default();
+
+   printf("Saving Environment to %s...\n", env->name);
 
return saveenv() ? 1 : 0;
 }
diff --git a/env/dataflash.c b/env/dataflash.c
index 8ab482b3b4..9421a6a5b2 100644
--- a/env/dataflash.c
+++ b/env/dataflash.c
@@ -16,8 +16,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 env_t *env_ptr;
 
-char *env_name_spec = "dataflash";
-
 static unsigned char env_dataflash_get_char(int index)
 {
uchar c;
@@ -70,6 +68,7 @@ static int env_dataflash_save(void)
 
 U_BOOT_ENV_LOCATION(dataflash) = {
.location   = ENVL_DATAFLASH,
+   ENV_NAME("dataflash")
.get_char   = env_dataflash_get_char,
.load   = env_dataflash_load,
.save   = env_save_ptr(env_dataflash_save),
diff --git a/env/eeprom.c b/env/eeprom.c
index 3cc412620a..2c795b9236 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -23,8 +23,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 env_t *env_ptr;
 
-char *env_name_spec = "EEPROM";
-
 static int eeprom_bus_read(unsigned dev_addr, unsigned offset,
   uchar *buffer, unsigned cnt)
 {
@@ -233,6 +231,7 @@ static int env_eeprom_save(void)
 
 U_BOOT_ENV_LOCATION(eeprom) = {
.location   = ENVL_EEPROM,
+   ENV_NAME("EEPROM")
.get_char   = env_eeprom_get_char,
.load   = env_eeprom_load,
.save   = env_save_ptr(env_eeprom_save),
diff --git a/env/env.c b/env/env.c
index 12cd4750df..53a085c431 100644
--- a/env/env.c
+++ b/env/env.c
@@ -54,7 +54,7 @@ static enum env_location env_get_default_location(void)
return ENVL_UNKNOWN;
 }
 
-static struct env_driver *env_driver_lookup_default(void)
+struct env_driver *env_driver_lookup_default(void)
 {
enum env_location loc = env_get_default_location();
struct env_driver *drv;
diff --git a/env/ext4.c b/env/ext4.c
index 25a5cbecdd..5acdf0eda0 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -31,8 +31,6 @@
 #include 
 #include 
 
-char *env_name_spec = "EXT4";
-
 env_t *env_ptr;
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -121,6 +119,7 @@ err_env_relocate:
 
 U_BOOT_ENV_LOCATION(ext4) = {
.location   = ENVL_EXT4,
+   ENV_NAME("EXT4")
.load   = env_ext4_load,
.save   = env_save_ptr(env_ext4_save),
 };
diff --git a/env/fat.c b/env/fat.c
index 1ff3d9dc86..eda18dbf3d 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -31,8 +31,6 @@
 # endif
 #endif
 
-char *env_name_spec = "FAT";
-
 env_t *env_ptr;
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -116,6 +114,7 @@ err_env_relocate:
 
 U_BOOT_ENV_LOCATION(fat) = {
.location   = ENVL_FAT,
+   ENV_NAME("FAT")
 #ifdef LOADENV
.load   = env_fat_load,
 #endif
diff --git a/env/flash.c b/env/flash.c
index 6ec9b61883..2d72c51622 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -45,8 +45,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define INITENV
 #endif
 
-char *env_name_spec = "Flash";
-
 #ifdef ENV_IS_EMBEDDED
 env_t *env_ptr = 
 
@@ -359,6 +357,7 @@ static void env_flash_load(void)
 
 U_BOOT_ENV_LOCATION(flash) = {
.location   = ENVL_FLASH,
+   ENV_NAME("Flash")
 #ifdef LOADENV
.load   = env_flash_load,
 #endif
diff --git a/env/mmc.c b/env/mmc.c
index 966f620653..18da6dc58c 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -23,8 +23,6 @@
 #error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE
 #endif
 
-char *env_name_spec = "MMC";
-
 #ifdef ENV_IS_EMBEDDED
 env_t *env_ptr = 
 #else /* ! ENV_IS_EMBEDDED */
@@ -318,6 +316,7 @@ err:
 
 U_BOOT_ENV_LOCATION(mmc) = {
.location   = ENVL_MMC,
+   ENV_NAME("MMC")
.load   = env_mmc_load,
 #ifndef CONFIG_SPL_BUILD
.save   = env_save_ptr(env_mmc_save),

[U-Boot] [PATCH v5 28/30] env: Rename some other getenv()-related functions

2017-08-03 Thread Simon Glass
We are now using an env_ prefix for environment functions. Rename these
other functions as well, for consistency:

   getenv_vlan()
   getenv_bootm_size()
   getenv_bootm_low()
   getenv_bootm_mapsize()
   env_get_default()

Suggested-by: Wolfgang Denk 
Signed-off-by: Simon Glass 
---

Changes in v5: None
Changes in v4:
- Add new patch to rename some other genenv()-related functions

Changes in v3: None
Changes in v2:
- Add new patch to rename getenv() and friends to env_get()

 arch/powerpc/lib/bootm.c|  8 
 board/Arcturus/ucp1020/ucp1020.c|  4 ++--
 board/freescale/b4860qds/b4860qds.c |  4 ++--
 board/freescale/bsc9131rdb/bsc9131rdb.c |  4 ++--
 board/freescale/bsc9132qds/bsc9132qds.c |  4 ++--
 board/freescale/c29xpcie/c29xpcie.c |  4 ++--
 board/freescale/corenet_ds/corenet_ds.c |  4 ++--
 board/freescale/mpc8572ds/mpc8572ds.c   |  4 ++--
 board/freescale/p1010rdb/p1010rdb.c |  4 ++--
 board/freescale/p1022ds/p1022ds.c   |  4 ++--
 board/freescale/p1023rdb/p1023rdb.c |  4 ++--
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c |  4 ++--
 board/freescale/p1_twr/p1_twr.c |  4 ++--
 board/freescale/p2041rdb/p2041rdb.c |  4 ++--
 board/freescale/t102xqds/t102xqds.c |  4 ++--
 board/freescale/t102xrdb/t102xrdb.c |  4 ++--
 board/freescale/t1040qds/t1040qds.c |  4 ++--
 board/freescale/t104xrdb/t104xrdb.c |  4 ++--
 board/freescale/t208xqds/t208xqds.c |  4 ++--
 board/freescale/t208xrdb/t208xrdb.c |  4 ++--
 board/freescale/t4qds/t4240emu.c|  4 ++--
 board/freescale/t4qds/t4240qds.c|  4 ++--
 board/freescale/t4rdb/t4240rdb.c|  4 ++--
 board/gdsys/p1022/controlcenterd.c  |  4 ++--
 board/keymile/kmp204x/kmp204x.c |  4 ++--
 board/varisys/cyrus/cyrus.c |  4 ++--
 cmd/elf.c   |  2 +-
 cmd/mtdparts.c  |  6 +++---
 cmd/net.c   |  2 +-
 common/bootm.c  |  4 ++--
 common/image-fdt.c  |  4 ++--
 common/image.c  | 18 +-
 drivers/net/netconsole.c|  6 +++---
 env/common.c|  2 +-
 env/flags.c |  2 +-
 include/common.h|  2 +-
 include/environment.h   |  2 +-
 include/image.h |  6 +++---
 include/net.h   |  2 +-
 net/link_local.c|  2 +-
 net/net.c   |  2 +-
 41 files changed, 85 insertions(+), 85 deletions(-)

diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 932c38ab4c..b9ae24dc98 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -86,7 +86,7 @@ static void boot_jump_linux(bootm_headers_t *images)
debug ("   Booting using OF flat tree...\n");
WATCHDOG_RESET ();
(*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC,
-  getenv_bootm_mapsize(), 0, 0);
+  env_get_bootm_mapsize(), 0, 0);
/* does not return */
} else
 #endif
@@ -121,8 +121,8 @@ void arch_lmb_reserve(struct lmb *lmb)
phys_size_t bootm_size;
ulong size, sp, bootmap_base;
 
-   bootmap_base = getenv_bootm_low();
-   bootm_size = getenv_bootm_size();
+   bootmap_base = env_get_bootm_low();
+   bootm_size = env_get_bootm_size();
 
 #ifdef DEBUG
if (((u64)bootmap_base + bootm_size) >
@@ -340,6 +340,6 @@ void boot_jump_vxworks(bootm_headers_t *images)
 
((void (*)(void *, ulong, ulong, ulong,
ulong, ulong, ulong))images->ep)(images->ft_addr,
-   0, 0, EPAPR_MAGIC, getenv_bootm_mapsize(), 0, 0);
+   0, 0, EPAPR_MAGIC, env_get_bootm_mapsize(), 0, 0);
 }
 #endif
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index dfdaf0441c..3f786a2014 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -307,8 +307,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
ft_cpu_setup(blob, bd);
 
-   base = getenv_bootm_low();
-   size = getenv_bootm_size();
+   base = env_get_bootm_low();
+   size = env_get_bootm_size();
 
fdt_fixup_memory(blob, (u64)base, (u64)size);
 
diff --git a/board/freescale/b4860qds/b4860qds.c 
b/board/freescale/b4860qds/b4860qds.c
index 1fea91b3b5..5d872fdfd9 100644
--- a/board/freescale/b4860qds/b4860qds.c
+++ b/board/freescale/b4860qds/b4860qds.c
@@ -1197,8 +1197,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
ft_cpu_setup(blob, bd);
 
-   base = getenv_bootm_low();
-   size = getenv_bootm_size();
+   base = 

Re: [U-Boot] [PATCH 1/2] usb: kbd: don't fail with iomux

2017-08-03 Thread Simon Glass
Hi Rob,

On 3 August 2017 at 07:17, Rob Clark  wrote:
> stdin might not be set, which would cause iomux_doenv() to fail
> therefore causing probe_usb_keyboard() to fail.  Furthermore if we do
> have iomux enabled, the sensible thing (in terms of user experience)
> would be to simply add ourselves to the list of stdin devices.
>

Is this intended to fix a bug? What board do you see this on, and
under what circumstances?

> Signed-off-by: Rob Clark 
> ---
> v2: address Bin Meng's comments
>  common/usb_kbd.c | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/common/usb_kbd.c b/common/usb_kbd.c
> index d2d29cc98f..72cf78abd4 100644
> --- a/common/usb_kbd.c
> +++ b/common/usb_kbd.c
> @@ -517,7 +517,21 @@ static int probe_usb_keyboard(struct usb_device *dev)
>
> stdinname = getenv("stdin");
>  #if CONFIG_IS_ENABLED(CONSOLE_MUX)
> +   char *devname = DEVNAME;
> +   /* stdin might not be set yet.. either way, with console-mux the

/*
 * stdin might not be

> +* sensible thing to do is add ourselves to the list of stdio
> +* devices:
> +*/
> +   if (stdinname) {
> +   char *newstdin = malloc(strlen(stdinname) + 
> strlen(","DEVNAME) + 1);
> +   sprintf(newstdin, "%s,"DEVNAME, stdinname);
> +   stdinname = newstdin;
> +   } else {
> +   stdinname = devname;
> +   }
> error = iomux_doenv(stdin, stdinname);
> +   if (stdinname != devname)
> +   free(stdinname);
> if (error)
> return error;
>  #else
> --
> 2.13.0
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 29/30] env: Adjust the get_char() method to return an int

2017-08-03 Thread Simon Glass
In principle this can fail, e.g. if the index is out of range. Adjust the
driver signature to allow returning an error code.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/dataflash.c   | 2 +-
 env/eeprom.c  | 2 +-
 env/nvram.c   | 2 +-
 include/environment.h | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/env/dataflash.c b/env/dataflash.c
index 28dcf6fa1c..afa08f8fd5 100644
--- a/env/dataflash.c
+++ b/env/dataflash.c
@@ -14,7 +14,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static unsigned char env_dataflash_get_char(int index)
+static int env_dataflash_get_char(int index)
 {
uchar c;
 
diff --git a/env/eeprom.c b/env/eeprom.c
index 39adccabbe..fbe4fd4efc 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -61,7 +61,7 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned 
offset,
return rcode;
 }
 
-static uchar env_eeprom_get_char(int index)
+static int env_eeprom_get_char(int index)
 {
uchar c;
unsigned int off = CONFIG_ENV_OFFSET;
diff --git a/env/nvram.c b/env/nvram.c
index ac389ace62..85af37d4a0 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -41,7 +41,7 @@ env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 #endif
 
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-static uchar env_nvram_get_char(int index)
+static int env_nvram_get_char(int index)
 {
uchar c;
 
diff --git a/include/environment.h b/include/environment.h
index 9a44215235..ba8af28414 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -227,9 +227,9 @@ struct env_driver {
 * will read from gd->env_addr.
 *
 * @index: Index of character to read (0=first)
-* @return character read
+* @return character read, or -ve on error
 */
-   unsigned char (*get_char)(int index);
+   int (*get_char)(int index);
 
/**
 * load() - Load the environment from storage
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 27/30] env: Rename eth_getenv_enetaddr() to eth_env_get_enetaddr()

2017-08-03 Thread Simon Glass
Rename this function for consistency with env_get().

Signed-off-by: Simon Glass 
---

Changes in v5: None
Changes in v4:
- Add new patch to rename eth_getenv_enetaddr()

Changes in v3: None
Changes in v2: None

 arch/arm/mach-davinci/misc.c|  2 +-
 arch/powerpc/cpu/mpc85xx/fdt.c  |  2 +-
 board/amlogic/odroid-c2/odroid-c2.c |  2 +-
 board/buffalo/lsxl/lsxl.c   |  2 +-
 board/compulab/cl-som-am57x/eth.c   |  2 +-
 board/compulab/cm_fx6/cm_fx6.c  |  6 +++---
 board/compulab/cm_t335/cm_t335.c|  2 +-
 board/compulab/cm_t35/cm_t35.c  |  2 +-
 board/compulab/cm_t3517/cm_t3517.c  |  2 +-
 board/compulab/cm_t54/cm_t54.c  |  4 ++--
 board/davinci/da8xxevm/da850evm.c   |  2 +-
 board/gumstix/pepper/board.c|  2 +-
 board/isee/igep003x/board.c |  2 +-
 board/logicpd/zoom1/zoom1.c |  2 +-
 board/phytec/pcm051/board.c |  2 +-
 board/renesas/alt/alt.c |  2 +-
 board/renesas/blanche/blanche.c |  2 +-
 board/renesas/gose/gose.c   |  2 +-
 board/renesas/koelsch/koelsch.c |  2 +-
 board/renesas/lager/lager.c |  2 +-
 board/renesas/porter/porter.c   |  2 +-
 board/renesas/silk/silk.c   |  2 +-
 board/renesas/stout/stout.c |  2 +-
 board/silica/pengwyn/board.c|  2 +-
 board/spear/common/spr_misc.c   |  2 +-
 board/ti/evm/evm.c  |  2 +-
 board/ti/ti814x/evm.c   |  2 +-
 board/ti/ti816x/evm.c   |  2 +-
 board/timll/devkit8000/devkit8000.c |  2 +-
 board/toradex/common/tdx-common.c   |  4 ++--
 cmd/elf.c   |  4 ++--
 cmd/pxe.c   |  3 +--
 common/board_r.c| 12 ++--
 doc/README.enetaddr |  4 ++--
 drivers/net/dc2114x.c   |  2 +-
 drivers/net/fsl-mc/mc.c |  4 ++--
 drivers/net/fsl_mcdmafec.c  |  4 ++--
 drivers/net/ftgmac100.c |  2 +-
 drivers/net/ftmac100.c  |  2 +-
 drivers/net/lan91c96.c  |  2 +-
 drivers/net/mcffec.c|  8 
 drivers/net/ne2000_base.c   |  4 ++--
 drivers/net/sh_eth.c|  2 +-
 include/net.h   |  4 ++--
 net/eth-uclass.c|  2 +-
 net/eth_common.c|  8 
 net/eth_legacy.c|  2 +-
 net/net_rand.h  |  2 +-
 48 files changed, 69 insertions(+), 70 deletions(-)

diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c
index 4441242cc7..461ff778c2 100644
--- a/arch/arm/mach-davinci/misc.c
+++ b/arch/arm/mach-davinci/misc.c
@@ -90,7 +90,7 @@ void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
uint8_t env_enetaddr[6];
int ret;
 
-   ret = eth_getenv_enetaddr_by_index("eth", 0, env_enetaddr);
+   ret = eth_env_get_enetaddr_by_index("eth", 0, env_enetaddr);
if (!ret) {
/*
 * There is no MAC address in the environment, so we
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 27d3b3ffe9..599839d0ff 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -580,7 +580,7 @@ static void fdt_fixup_l2_switch(void *blob)
return;
 
/* Get MAC address for the l2switch from "l2switchaddr"*/
-   if (!eth_getenv_enetaddr("l2switchaddr", l2swaddr)) {
+   if (!eth_env_get_enetaddr("l2switchaddr", l2swaddr)) {
printf("Warning: MAC address for l2switch not found\n");
memset(l2swaddr, 0, sizeof(l2swaddr));
}
diff --git a/board/amlogic/odroid-c2/odroid-c2.c 
b/board/amlogic/odroid-c2/odroid-c2.c
index 611155d3e5..eac04d8178 100644
--- a/board/amlogic/odroid-c2/odroid-c2.c
+++ b/board/amlogic/odroid-c2/odroid-c2.c
@@ -44,7 +44,7 @@ int misc_init_r(void)
mdelay(10);
setbits_le32(GXBB_GPIO_OUT(3), BIT(14));
 
-   if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+   if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
  mac_addr, EFUSE_MAC_SIZE);
if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index 5b31e056ba..2d01ac25d8 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -203,7 +203,7 @@ void check_enetaddr(void)
 {
uchar enetaddr[6];
 
-   if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+   if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
/* signal unset/invalid ethaddr to user */
set_led(LED_INFO_BLINKING);
}
diff --git a/board/compulab/cl-som-am57x/eth.c 
b/board/compulab/cl-som-am57x/eth.c
index 0ad10056fe..b615fb9e7e 100644
--- a/board/compulab/cl-som-am57x/eth.c
+++ b/board/compulab/cl-som-am57x/eth.c
@@ -95,7 +95,7 @@ static int 

[U-Boot] [PATCH v5 24/30] env: Rename eth_setenv_enetaddr() to eth_env_set_enetaddr()

2017-08-03 Thread Simon Glass
Rename this function for consistency with env_set().

Signed-off-by: Simon Glass 
---

Changes in v5: None
Changes in v4:
- Add new patch to rename eth_setenv_enetaddr()

Changes in v3: None
Changes in v2: None

 arch/arm/mach-davinci/misc.c  |  2 +-
 arch/arm/mach-omap2/utils.c   |  2 +-
 board/BuR/common/common.c |  2 +-
 board/CZ.NIC/turris_omnia/turris_omnia.c  |  6 +++---
 board/LaCie/net2big_v2/net2big_v2.c   |  2 +-
 board/LaCie/netspace_v2/netspace_v2.c |  2 +-
 board/amlogic/odroid-c2/odroid-c2.c   |  2 +-
 board/atmel/sama5d2_xplained/sama5d2_xplained.c   |  2 +-
 board/birdland/bav335x/board.c|  2 +-
 board/bosch/shc/board.c   |  6 +++---
 board/compulab/cl-som-am57x/eth.c |  2 +-
 board/compulab/cm_fx6/cm_fx6.c|  2 +-
 board/compulab/cm_t335/cm_t335.c  |  2 +-
 board/compulab/cm_t35/cm_t35.c|  2 +-
 board/compulab/cm_t3517/cm_t3517.c|  2 +-
 board/compulab/cm_t54/cm_t54.c|  2 +-
 board/davinci/da8xxevm/da850evm.c |  2 +-
 board/gateworks/gw_ventana/gw_ventana.c   |  4 ++--
 board/grinn/chiliboard/board.c|  4 ++--
 board/gumstix/pepper/board.c  |  2 +-
 board/isee/igep003x/board.c   |  2 +-
 board/kosagi/novena/novena.c  |  2 +-
 board/logicpd/zoom1/zoom1.c   |  2 +-
 board/phytec/pcm051/board.c   |  2 +-
 board/raspberrypi/rpi/rpi.c   |  2 +-
 board/renesas/blanche/blanche.c   |  2 +-
 board/rockchip/tinker_rk3288/tinker-rk3288.c  |  2 +-
 board/samtec/vining_2000/vining_2000.c|  2 +-
 board/samtec/vining_fpga/socfpga.c|  2 +-
 board/siemens/common/factoryset.c |  2 +-
 board/siemens/pxm2/board.c|  2 +-
 board/silica/pengwyn/board.c  |  2 +-
 board/spear/common/spr_misc.c |  2 +-
 board/sunxi/board.c   |  2 +-
 board/tcl/sl50/board.c|  6 +++---
 board/technologic/ts4800/ts4800.c |  2 +-
 board/theobroma-systems/puma_rk3399/puma-rk3399.c |  2 +-
 board/ti/am335x/board.c   |  6 +++---
 board/ti/am43xx/board.c   |  4 ++--
 board/ti/am57xx/board.c   | 10 +-
 board/ti/common/board_detect.c|  4 ++--
 board/ti/dra7xx/evm.c |  4 ++--
 board/ti/evm/evm.c|  2 +-
 board/ti/ti814x/evm.c |  2 +-
 board/ti/ti816x/evm.c |  2 +-
 board/timll/devkit8000/devkit8000.c   |  2 +-
 board/toradex/common/tdx-common.c |  4 ++--
 board/vscom/baltos/board.c|  2 +-
 doc/README.enetaddr   |  4 ++--
 drivers/net/fec_mxc.c |  2 +-
 drivers/net/lan91c96.c|  2 +-
 drivers/net/ne2000_base.c |  2 +-
 drivers/usb/gadget/ether.c|  2 +-
 include/net.h |  6 +++---
 net/eth-uclass.c  |  2 +-
 net/eth_common.c  |  6 +++---
 net/eth_internal.h|  4 ++--
 net/eth_legacy.c  |  4 ++--
 58 files changed, 83 insertions(+), 83 deletions(-)

diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c
index ec331ba6bb..4441242cc7 100644
--- a/arch/arm/mach-davinci/misc.c
+++ b/arch/arm/mach-davinci/misc.c
@@ -99,7 +99,7 @@ void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
debug("### Setting environment from EEPROM MAC address = "
"\"%pM\"\n",
env_enetaddr);
-   ret = !eth_setenv_enetaddr("ethaddr", rom_enetaddr);
+   ret = !eth_env_set_enetaddr("ethaddr", rom_enetaddr);
}
if (!ret)
printf("Failed to set mac address from EEPROM: %d\n", ret);
diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index b7074638bd..c03e93878d 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -214,7 +214,7 @@ void omap_die_id_usbethaddr(void)
mac[4] = die_id[0] & 0xff;
mac[5] = (die_id[0] >> 8) & 0xff;
 
-   eth_setenv_enetaddr("usbethaddr", mac);
+   eth_env_set_enetaddr("usbethaddr", mac);
}
 }
 
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index 6bea9a4383..eb34de931e 100644
--- a/board/BuR/common/common.c
+++ 

[U-Boot] [PATCH v5 14/30] env: Switch over to use environment location drivers

2017-08-03 Thread Simon Glass
Move over to use a the master implementation of the location drivers, with
each method calling out to the appropriate driver.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4:
- Adjust implementation of env_get_char_spec() to avoid recursion

Changes in v3: None
Changes in v2: None

 env/dataflash.c | 16 
 env/eeprom.c| 16 
 env/env.c   | 20 
 env/ext4.c  | 13 ++---
 env/fat.c   | 13 ++---
 env/flash.c | 34 ++
 env/mmc.c   | 19 +--
 env/nand.c  | 14 +++---
 env/nowhere.c   |  8 
 env/nvram.c | 16 
 env/onenand.c   | 13 ++---
 env/remote.c| 13 ++---
 env/sata.c  | 13 ++---
 env/sf.c| 17 -
 env/ubi.c   | 17 -
 15 files changed, 128 insertions(+), 114 deletions(-)

diff --git a/env/dataflash.c b/env/dataflash.c
index 9c59d8e63a..6d95d6409b 100644
--- a/env/dataflash.c
+++ b/env/dataflash.c
@@ -18,7 +18,7 @@ env_t *env_ptr;
 
 char *env_name_spec = "dataflash";
 
-uchar env_get_char_spec(int index)
+static unsigned char env_dataflash_get_char(int index)
 {
uchar c;
 
@@ -27,7 +27,7 @@ uchar env_get_char_spec(int index)
return c;
 }
 
-void env_relocate_spec(void)
+static void env_dataflash_load(void)
 {
ulong crc, new = 0;
unsigned off;
@@ -54,7 +54,7 @@ void env_relocate_spec(void)
 #error No support for redundant environment on dataflash yet!
 #endif
 
-int saveenv(void)
+static int env_dataflash_save(void)
 {
env_t env_new;
int ret;
@@ -74,7 +74,7 @@ int saveenv(void)
  * We are still running from ROM, so data use is limited.
  * Use a (moderately small) buffer on the stack
  */
-int env_init(void)
+int env_dataflash_init(void)
 {
/* use default */
gd->env_addr = (ulong)_environment[0];
@@ -85,8 +85,8 @@ int env_init(void)
 
 U_BOOT_ENV_LOCATION(dataflash) = {
.location   = ENVL_DATAFLASH,
-   .get_char   = env_get_char_spec,
-   .load   = env_relocate_spec,
-   .save   = env_save_ptr(saveenv),
-   .init   = env_init,
+   .get_char   = env_dataflash_get_char,
+   .load   = env_dataflash_load,
+   .save   = env_save_ptr(env_dataflash_save),
+   .init   = env_dataflash_init,
 };
diff --git a/env/eeprom.c b/env/eeprom.c
index 78569b286b..eb69f75f7b 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -65,7 +65,7 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned 
offset,
return rcode;
 }
 
-uchar env_get_char_spec(int index)
+static uchar env_eeprom_get_char(int index)
 {
uchar c;
unsigned int off = CONFIG_ENV_OFFSET;
@@ -80,7 +80,7 @@ uchar env_get_char_spec(int index)
return c;
 }
 
-void env_relocate_spec(void)
+static void env_eeprom_load(void)
 {
char buf_env[CONFIG_ENV_SIZE];
unsigned int off = CONFIG_ENV_OFFSET;
@@ -188,7 +188,7 @@ void env_relocate_spec(void)
env_import(buf_env, 1);
 }
 
-int saveenv(void)
+static int env_eeprom_save(void)
 {
env_t   env_new;
int rc;
@@ -237,7 +237,7 @@ int saveenv(void)
  * We are still running from ROM, so data use is limited.
  * Use a (moderately small) buffer on the stack
  */
-int env_init(void)
+static int env_eeprom_init(void)
 {
gd->env_addr = (ulong)_environment[0];
gd->env_valid = ENV_VALID;
@@ -246,8 +246,8 @@ int env_init(void)
 
 U_BOOT_ENV_LOCATION(eeprom) = {
.location   = ENVL_EEPROM,
-   .get_char   = env_get_char_spec,
-   .load   = env_relocate_spec,
-   .save   = env_save_ptr(saveenv),
-   .init   = env_init,
+   .get_char   = env_eeprom_get_char,
+   .load   = env_eeprom_load,
+   .save   = env_save_ptr(env_eeprom_save),
+   .init   = env_eeprom_init,
 };
diff --git a/env/env.c b/env/env.c
index 9f0a04c33c..d327f9cdff 100644
--- a/env/env.c
+++ b/env/env.c
@@ -143,3 +143,23 @@ int env_init_new(void)
 
return 0;
 }
+
+unsigned char env_get_char_spec(int index)
+{
+   return *(uchar *)(gd->env_addr + index);
+}
+
+void env_relocate_spec(void)
+{
+   env_load();
+}
+
+int saveenv(void)
+{
+   return env_save();
+}
+
+int env_init(void)
+{
+   return env_init_new();
+}
diff --git a/env/ext4.c b/env/ext4.c
index c6a84925d9..aa69219021 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -37,7 +37,7 @@ env_t *env_ptr;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int env_init(void)
+static int env_ext4_init(void)
 {
/* use default */
gd->env_addr = (ulong)_environment[0];
@@ -47,7 +47,7 @@ int env_init(void)
 }
 
 #ifdef CONFIG_CMD_SAVEENV
-int saveenv(void)
+static int env_ext4_save(void)
 {
env_t   env_new;
struct blk_desc *dev_desc = 

[U-Boot] [PATCH v5 17/30] env: Drop unused env_ptr variables

2017-08-03 Thread Simon Glass
This variable is declared as a global in most environment location
drivers. But it is not used outside the drivers and most of the
declarations are unnecessary.

Also some drivers call free() on env_ptr which seems wrong since it is
not in the heap.

Drop the variable where possible, and all calls to free().

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/dataflash.c | 2 --
 env/eeprom.c| 4 
 env/ext4.c  | 2 --
 env/fat.c   | 2 --
 env/mmc.c   | 6 --
 env/nowhere.c   | 2 --
 env/nvram.c | 1 -
 env/ubi.c   | 2 --
 8 files changed, 21 deletions(-)

diff --git a/env/dataflash.c b/env/dataflash.c
index 9421a6a5b2..28dcf6fa1c 100644
--- a/env/dataflash.c
+++ b/env/dataflash.c
@@ -14,8 +14,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-env_t *env_ptr;
-
 static unsigned char env_dataflash_get_char(int index)
 {
uchar c;
diff --git a/env/eeprom.c b/env/eeprom.c
index 2c795b9236..39adccabbe 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -21,8 +21,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-env_t *env_ptr;
-
 static int eeprom_bus_read(unsigned dev_addr, unsigned offset,
   uchar *buffer, unsigned cnt)
 {
@@ -196,8 +194,6 @@ static int env_eeprom_save(void)
char flag_obsolete  = OBSOLETE_FLAG;
 #endif
 
-   BUG_ON(env_ptr != NULL);
-
rc = env_export(_new);
if (rc)
return rc;
diff --git a/env/ext4.c b/env/ext4.c
index 5acdf0eda0..ee073a8b7c 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -31,8 +31,6 @@
 #include 
 #include 
 
-env_t *env_ptr;
-
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_CMD_SAVEENV
diff --git a/env/fat.c b/env/fat.c
index eda18dbf3d..a5a156c88b 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -31,8 +31,6 @@
 # endif
 #endif
 
-env_t *env_ptr;
-
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CMD_SAVEENV
diff --git a/env/mmc.c b/env/mmc.c
index 18da6dc58c..88ffc91f0b 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -23,12 +23,6 @@
 #error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE
 #endif
 
-#ifdef ENV_IS_EMBEDDED
-env_t *env_ptr = 
-#else /* ! ENV_IS_EMBEDDED */
-env_t *env_ptr;
-#endif /* ENV_IS_EMBEDDED */
-
 DECLARE_GLOBAL_DATA_PTR;
 
 #if !defined(CONFIG_ENV_OFFSET)
diff --git a/env/nowhere.c b/env/nowhere.c
index 1a17d6978b..d60de494e6 100644
--- a/env/nowhere.c
+++ b/env/nowhere.c
@@ -15,8 +15,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-env_t *env_ptr;
-
 U_BOOT_ENV_LOCATION(nowhere) = {
.location   = ENVL_NOWHERE,
ENV_NAME("nowhere")
diff --git a/env/nvram.c b/env/nvram.c
index 0f4b491fd3..ac389ace62 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -36,7 +36,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
 extern void *nvram_read(void *dest, const long src, size_t count);
 extern void nvram_write(long dest, const void *src, size_t count);
-env_t *env_ptr;
 #else
 env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 #endif
diff --git a/env/ubi.c b/env/ubi.c
index 4d5ae1343d..9399f943dc 100644
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -16,8 +16,6 @@
 #include 
 #undef crc32
 
-env_t *env_ptr;
-
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_CMD_SAVEENV
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 26/30] env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

2017-08-03 Thread Simon Glass
We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk 
Signed-off-by: Simon Glass 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- Add new patch to rename getenv_hex(), getenv_yesno(), getenv_ulong()

 arch/powerpc/cpu/mpc85xx/mp.c   |  2 +-
 board/BuR/brxre1/board.c|  6 ++---
 board/BuR/common/common.c   | 40 ++---
 board/birdland/bav335x/board.c  |  2 +-
 board/gateworks/gw_ventana/gw_ventana_spl.c |  2 +-
 board/gdsys/p1022/controlcenterd-id.c   |  4 +--
 board/tcl/sl50/board.c  |  2 +-
 board/ti/am335x/board.c |  2 +-
 board/ti/am57xx/board.c |  2 +-
 board/ti/dra7xx/evm.c   |  2 +-
 cmd/fdt.c   |  2 +-
 cmd/nvedit.c|  4 +--
 cmd/source.c|  2 +-
 cmd/trace.c |  6 ++---
 cmd/ximg.c  |  2 +-
 common/autoboot.c   |  2 +-
 common/board_f.c|  4 +--
 common/board_r.c|  6 ++---
 common/bootm.c  |  4 +--
 drivers/bootcount/bootcount_env.c   |  6 ++---
 env/common.c|  2 +-
 include/common.h| 19 +++---
 lib/fdtdec.c|  2 +-
 net/bootp.c |  2 +-
 net/net.c   |  2 +-
 25 files changed, 70 insertions(+), 59 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c
index 0addf8493c..2ea9f5c7be 100644
--- a/arch/powerpc/cpu/mpc85xx/mp.c
+++ b/arch/powerpc/cpu/mpc85xx/mp.c
@@ -31,7 +31,7 @@ u32 get_my_id()
 int hold_cores_in_reset(int verbose)
 {
/* Default to no, overridden by 'y', 'yes', 'Y', 'Yes', or '1' */
-   if (getenv_yesno("mp_holdoff") == 1) {
+   if (env_get_yesno("mp_holdoff") == 1) {
if (verbose) {
puts("Secondary cores are being held in reset.\n");
puts("See 'mp_holdoff' environment variable\n");
diff --git a/board/BuR/brxre1/board.c b/board/BuR/brxre1/board.c
index cdbc93a8ec..ca08f3cd90 100644
--- a/board/BuR/brxre1/board.c
+++ b/board/BuR/brxre1/board.c
@@ -282,9 +282,9 @@ int board_late_init(void)
snprintf(othbootargs, sizeof(othbootargs),
 "u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
 (unsigned int) gd->fb_base-0x20,
-(u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
-(u32)getenv_ulong("vx_romfsbase", 16, 0),
-(u32)getenv_ulong("vx_romfssize", 16, 0));
+(u32)env_get_ulong("vx_memtop", 16, gd->fb_base-0x20),
+(u32)env_get_ulong("vx_romfsbase", 16, 0),
+(u32)env_get_ulong("vx_romfssize", 16, 0));
env_set("othbootargs", othbootargs);
/*
 * reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index 39a600b5c1..c1cd010023 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -58,9 +58,9 @@ void lcdbacklight(int on)
unsigned int bright = FDTPROP(PATHINF, "brightdef");
unsigned int pwmfrq = FDTPROP(PATHINF, "brightfdim");
 #else
-   unsigned int driver = getenv_ulong("ds1_bright_drv", 16, 0UL);
-   unsigned int bright = getenv_ulong("ds1_bright_def", 10, 50);
-   unsigned int pwmfrq = getenv_ulong("ds1_pwmfreq", 10, ~0UL);
+   unsigned int driver = env_get_ulong("ds1_bright_drv", 16, 0UL);
+   unsigned int bright = env_get_ulong("ds1_bright_def", 10, 50);
+   unsigned int pwmfrq = env_get_ulong("ds1_pwmfreq", 10, ~0UL);
 #endif
unsigned int tmp;
struct gptimer *timerhw;
@@ -186,20 +186,20 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
snprintf(buf, sizeof(buf), "fbcon=rotate:%d", panel_info.vl_rot);
env_set("optargs_rot", buf);
 #else
-   pnltmp.hactive = getenv_ulong("ds1_hactive", 10, ~0UL);
-   pnltmp.vactive = getenv_ulong("ds1_vactive", 10, ~0UL);
-   pnltmp.bpp = getenv_ulong("ds1_bpp", 10, ~0UL);
-   pnltmp.hfp = getenv_ulong("ds1_hfp", 10, ~0UL);
-   pnltmp.hbp = getenv_ulong("ds1_hbp", 10, ~0UL);
-   pnltmp.hsw = getenv_ulong("ds1_hsw", 10, ~0UL);
-   pnltmp.vfp = getenv_ulong("ds1_vfp", 10, ~0UL);
-   pnltmp.vbp = getenv_ulong("ds1_vbp", 10, ~0UL);
-   pnltmp.vsw = getenv_ulong("ds1_vsw", 10, ~0UL);
-   pnltmp.pxl_clk_div = getenv_ulong("ds1_pxlclkdiv", 10, ~0UL);
-   pnltmp.pol = getenv_ulong("ds1_pol", 16, ~0UL);
-   

[U-Boot] [PATCH v5 21/30] env: Drop saveenv() in favour of env_save()

2017-08-03 Thread Simon Glass
Use the env_save() function directly now that there is only one
implementation of saveenv().

Signed-off-by: Simon Glass 
Reviewed-by: Wolfgang Denk 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4:
- Add changes for edison also

Changes in v3: None
Changes in v2: None

 arch/arm/mach-omap2/boot-common.c   | 3 ++-
 board/intel/edison/edison.c | 5 +++--
 board/siemens/taurus/taurus.c   | 5 +++--
 board/toradex/apalis_imx6/apalis_imx6.c | 3 ++-
 cmd/nvedit.c| 2 +-
 drivers/bootcount/bootcount_env.c   | 3 ++-
 env/env.c   | 6 --
 include/common.h| 1 -
 include/environment.h   | 7 +++
 9 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap2/boot-common.c 
b/arch/arm/mach-omap2/boot-common.c
index 700e6c2f79..2bcc8e9f97 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -10,6 +10,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -241,7 +242,7 @@ int fb_set_reboot_flag(void)
 {
printf("Setting reboot to fastboot flag ...\n");
setenv("dofastboot", "1");
-   saveenv();
+   env_save();
return 0;
 }
 #endif
diff --git a/board/intel/edison/edison.c b/board/intel/edison/edison.c
index a1a7d4d7c8..80f9b544b0 100644
--- a/board/intel/edison/edison.c
+++ b/board/intel/edison/edison.c
@@ -5,6 +5,7 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -70,7 +71,7 @@ static void assign_serial(void)
setenv("serial#", serial);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-   saveenv();
+   env_save();
 #endif
 }
 
@@ -88,7 +89,7 @@ static void assign_hardware_id(void)
setenv("hardware_id", hardware_id);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-   saveenv();
+   env_save();
 #endif
 }
 
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index 4aa8d64869..3b742ebc22 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -405,7 +406,7 @@ static int upgrade_failure_fallback(void)
setenv("bootargs", '\0');
setenv("upgrade_available", '\0');
setenv("boot_retries", '\0');
-   saveenv();
+   env_save();
 
return 0;
 }
@@ -424,7 +425,7 @@ static int do_upgrade_available(cmd_tbl_t *cmdtp, int flag, 
int argc,
boot_retry++;
sprintf(boot_buf, "%lx", boot_retry);
setenv("boot_retries", boot_buf);
-   saveenv();
+   env_save();
 
/*
 * Here the boot_retries count is checked, and if the
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
b/board/toradex/apalis_imx6/apalis_imx6.c
index 8e5613cb12..e41547bbee 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -818,7 +819,7 @@ int board_late_init(void)
setenv("fdt_file", FDT_FILE_V1_0);
printf("patching fdt_file to " FDT_FILE_V1_0 "\n");
 #ifndef CONFIG_ENV_IS_NOWHERE
-   saveenv();
+   env_save();
 #endif
}
}
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 75df997592..4431ef66d8 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -710,7 +710,7 @@ static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
 
printf("Saving Environment to %s...\n", env->name);
 
-   return saveenv() ? 1 : 0;
+   return env_save() ? 1 : 0;
 }
 
 U_BOOT_CMD(
diff --git a/drivers/bootcount/bootcount_env.c 
b/drivers/bootcount/bootcount_env.c
index 2d6e8db126..7f22dd0748 100644
--- a/drivers/bootcount/bootcount_env.c
+++ b/drivers/bootcount/bootcount_env.c
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 
 void bootcount_store(ulong a)
 {
@@ -13,7 +14,7 @@ void bootcount_store(ulong a)
 
if (upgrade_available) {
setenv_ulong("bootcount", a);
-   saveenv();
+   env_save();
}
 }
 
diff --git a/env/env.c b/env/env.c
index 85d95e5747..2b8b9611cf 100644
--- a/env/env.c
+++ b/env/env.c
@@ -149,9 +149,3 @@ int env_init(void)
 
return 0;
 }
-
-int saveenv(void)
-{
-   return env_save();
-}
-
diff --git a/include/common.h b/include/common.h
index 751665f8a4..f0fc02cd3b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -335,7 +335,6 @@ ulong getenv_hex(const char *varname, ulong default_val);
  * Return -1 if variable does not exist (default to true)
  */
 int getenv_yesno(const char *var);
-intsaveenv  (void);
 intsetenv   (const char *, const char *);
 int 

[U-Boot] [PATCH v5 20/30] env: Drop env_relocate_spec() in favour of env_load()

2017-08-03 Thread Simon Glass
This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 board/birdland/bav335x/board.c  | 2 +-
 board/gateworks/gw_ventana/gw_ventana_spl.c | 2 +-
 board/tcl/sl50/board.c  | 2 +-
 board/ti/am335x/board.c | 2 +-
 board/ti/am57xx/board.c | 2 +-
 board/ti/dra7xx/evm.c   | 2 +-
 env/common.c| 2 +-
 env/env.c   | 5 -
 include/environment.h   | 9 +++--
 9 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index 67aca3cc43..b49365e157 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -162,7 +162,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
-   env_relocate_spec();
+   env_load();
if (getenv_yesno("boot_os") != 1)
return 1;
 #endif
diff --git a/board/gateworks/gw_ventana/gw_ventana_spl.c 
b/board/gateworks/gw_ventana/gw_ventana_spl.c
index 69a638d71d..baa8480b6c 100644
--- a/board/gateworks/gw_ventana/gw_ventana_spl.c
+++ b/board/gateworks/gw_ventana/gw_ventana_spl.c
@@ -690,7 +690,7 @@ int spl_start_uboot(void)
debug("%s\n", __func__);
 #ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
-   env_relocate_spec();
+   env_load();
debug("boot_os=%s\n", getenv("boot_os"));
if (getenv_yesno("boot_os") == 1)
ret = 0;
diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c
index e89ee35d30..d3c953e993 100644
--- a/board/tcl/sl50/board.c
+++ b/board/tcl/sl50/board.c
@@ -76,7 +76,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
-   env_relocate_spec();
+   env_load();
if (getenv_yesno("boot_os") != 1)
return 1;
 #endif
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 0a16529b5f..ac0592b725 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -249,7 +249,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
-   env_relocate_spec();
+   env_load();
if (getenv_yesno("boot_os") != 1)
return 1;
 #endif
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 00a31a97fd..126c9ef694 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -742,7 +742,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
-   env_relocate_spec();
+   env_load();
if (getenv_yesno("boot_os") != 1)
return 1;
 #endif
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 7d36f03fa1..23be2c70e4 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -825,7 +825,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
-   env_relocate_spec();
+   env_load();
if (getenv_yesno("boot_os") != 1)
return 1;
 #endif
diff --git a/env/common.c b/env/common.c
index 9b3a26859f..0cc8829d0d 100644
--- a/env/common.c
+++ b/env/common.c
@@ -280,7 +280,7 @@ void env_relocate(void)
set_default_env("!bad CRC");
 #endif
} else {
-   env_relocate_spec();
+   env_load();
}
 }
 
diff --git a/env/env.c b/env/env.c
index a239d93156..85d95e5747 100644
--- a/env/env.c
+++ b/env/env.c
@@ -150,11 +150,6 @@ int env_init(void)
return 0;
 }
 
-void env_relocate_spec(void)
-{
-   env_load();
-}
-
 int saveenv(void)
 {
return env_save();
diff --git a/include/environment.h b/include/environment.h
index 1df243462e..b4f93663da 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -170,8 +170,6 @@ extern env_t environment;
 extern const unsigned char default_environment[];
 extern env_t *env_ptr;
 
-extern void env_relocate_spec(void);
-
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 extern void env_reloc(void);
 #endif
@@ -320,6 +318,13 @@ struct env_driver *env_driver_lookup_default(void);
  */
 int env_get_char(int index);
 
+/**
+ * env_load() - Load the environment from storage
+ *
+ * @return 0 if OK, -ve on error
+ */
+int env_load(void);
+
 #endif /* DO_DEPS_ONLY */
 
 #endif /* _ENVIRONMENT_H_ */
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 15/30] env: Drop common init() functions

2017-08-03 Thread Simon Glass
Most of the init() implementations just use the default environment.
Adjust env_init_new() to do this automatically, and drop the redundant
code.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4:
- Fix incorrect setting of env_valid in env_init_new()

Changes in v3: None
Changes in v2: None

 env/dataflash.c   | 16 
 env/eeprom.c  | 14 --
 env/env.c | 14 +-
 env/ext4.c| 10 --
 env/fat.c | 10 --
 env/mmc.c | 10 --
 env/nowhere.c | 19 ---
 env/onenand.c | 10 --
 env/remote.c  |  4 +---
 env/sata.c| 10 --
 env/sf.c  | 10 --
 env/ubi.c | 10 --
 include/environment.h |  3 ++-
 13 files changed, 12 insertions(+), 128 deletions(-)

diff --git a/env/dataflash.c b/env/dataflash.c
index 6d95d6409b..8ab482b3b4 100644
--- a/env/dataflash.c
+++ b/env/dataflash.c
@@ -68,25 +68,9 @@ static int env_dataflash_save(void)
CONFIG_ENV_SIZE);
 }
 
-/*
- * Initialize environment use
- *
- * We are still running from ROM, so data use is limited.
- * Use a (moderately small) buffer on the stack
- */
-int env_dataflash_init(void)
-{
-   /* use default */
-   gd->env_addr = (ulong)_environment[0];
-   gd->env_valid = ENV_VALID;
-
-   return 0;
-}
-
 U_BOOT_ENV_LOCATION(dataflash) = {
.location   = ENVL_DATAFLASH,
.get_char   = env_dataflash_get_char,
.load   = env_dataflash_load,
.save   = env_save_ptr(env_dataflash_save),
-   .init   = env_dataflash_init,
 };
diff --git a/env/eeprom.c b/env/eeprom.c
index eb69f75f7b..3cc412620a 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -231,23 +231,9 @@ static int env_eeprom_save(void)
return rc;
 }
 
-/*
- * Initialize Environment use
- *
- * We are still running from ROM, so data use is limited.
- * Use a (moderately small) buffer on the stack
- */
-static int env_eeprom_init(void)
-{
-   gd->env_addr = (ulong)_environment[0];
-   gd->env_valid = ENV_VALID;
-   return 0;
-}
-
 U_BOOT_ENV_LOCATION(eeprom) = {
.location   = ENVL_EEPROM,
.get_char   = env_eeprom_get_char,
.load   = env_eeprom_load,
.save   = env_save_ptr(env_eeprom_save),
-   .init   = env_eeprom_init,
 };
diff --git a/env/env.c b/env/env.c
index d327f9cdff..12cd4750df 100644
--- a/env/env.c
+++ b/env/env.c
@@ -128,14 +128,18 @@ int env_save(void)
 int env_init_new(void)
 {
struct env_driver *drv = env_driver_lookup_default();
-   int ret;
+   int ret = -ENOENT;
 
if (!drv)
return -ENODEV;
-   if (!drv->init)
-   return -ENOSYS;
-   ret = drv->init();
-   if (ret) {
+   if (drv->init)
+   ret = drv->init();
+   if (ret == -ENOENT) {
+   gd->env_addr = (ulong)_environment[0];
+   gd->env_valid = 0;
+
+   return 0;
+   } else if (ret) {
debug("%s: Environment failed to init (err=%d)\n", __func__,
  ret);
return ret;
diff --git a/env/ext4.c b/env/ext4.c
index aa69219021..25a5cbecdd 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -37,15 +37,6 @@ env_t *env_ptr;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int env_ext4_init(void)
-{
-   /* use default */
-   gd->env_addr = (ulong)_environment[0];
-   gd->env_valid = ENV_VALID;
-
-   return 0;
-}
-
 #ifdef CONFIG_CMD_SAVEENV
 static int env_ext4_save(void)
 {
@@ -132,5 +123,4 @@ U_BOOT_ENV_LOCATION(ext4) = {
.location   = ENVL_EXT4,
.load   = env_ext4_load,
.save   = env_save_ptr(env_ext4_save),
-   .init   = env_ext4_init,
 };
diff --git a/env/fat.c b/env/fat.c
index b959013a88..1ff3d9dc86 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -37,15 +37,6 @@ env_t *env_ptr;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int env_fat_init(void)
-{
-   /* use default */
-   gd->env_addr = (ulong)_environment[0];
-   gd->env_valid = ENV_VALID;
-
-   return 0;
-}
-
 #ifdef CMD_SAVEENV
 static int env_fat_save(void)
 {
@@ -131,5 +122,4 @@ U_BOOT_ENV_LOCATION(fat) = {
 #ifdef CMD_SAVEENV
.save   = env_save_ptr(env_fat_save),
 #endif
-   .init   = env_fat_init,
 };
diff --git a/env/mmc.c b/env/mmc.c
index d63feea2b8..966f620653 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -82,15 +82,6 @@ __weak int mmc_get_env_dev(void)
return CONFIG_SYS_MMC_ENV_DEV;
 }
 
-static int env_mmc_init(void)
-{
-   /* use default */
-   gd->env_addr= (ulong)_environment[0];
-   gd->env_valid   = ENV_VALID;
-
-   return 0;
-}
-
 #ifdef CONFIG_SYS_MMC_ENV_PART
 __weak uint mmc_get_env_part(struct mmc *mmc)
 {
@@ -331,5 +322,4 

[U-Boot] [PATCH v5 19/30] env: Drop env_get_char_spec()

2017-08-03 Thread Simon Glass
We only have a single implementation of this function now and it is called
env_get_char(). Drop the old function and the weak version.

Reviewed-by: Tom Rini 
Signed-off-by: Simon Glass 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/common.c  | 14 --
 env/env.c |  9 +++--
 include/environment.h | 14 ++
 3 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/env/common.c b/env/common.c
index 842c0f7fd1..9b3a26859f 100644
--- a/env/common.c
+++ b/env/common.c
@@ -27,20 +27,6 @@ struct hsearch_data env_htab = {
.change_ok = env_flags_validate,
 };
 
-__weak uchar env_get_char_spec(int index)
-{
-   return *(uchar *)(gd->env_addr + index);
-}
-
-uchar env_get_char(int index)
-{
-   /* if env is not set up, or crc was bad, use the default environment */
-   if (!gd->env_valid)
-   return default_environment[index];
-   else
-   return env_get_char_spec(index);
-}
-
 /*
  * Read an environment variable as a boolean
  * Return -1 if variable does not exist (default to true)
diff --git a/env/env.c b/env/env.c
index ac6a583a02..a239d93156 100644
--- a/env/env.c
+++ b/env/env.c
@@ -69,11 +69,13 @@ struct env_driver *env_driver_lookup_default(void)
return drv;
 }
 
-int env_get_char_new(int index)
+int env_get_char(int index)
 {
struct env_driver *drv = env_driver_lookup_default();
int ret;
 
+   if (!gd->env_valid)
+   return default_environment[index];
if (!drv)
return -ENODEV;
if (!drv->get_char)
@@ -148,11 +150,6 @@ int env_init(void)
return 0;
 }
 
-unsigned char env_get_char_spec(int index)
-{
-   return *(uchar *)(gd->env_addr + index);
-}
-
 void env_relocate_spec(void)
 {
env_load();
diff --git a/include/environment.h b/include/environment.h
index 584fd7216d..1df243462e 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -171,7 +171,6 @@ extern const unsigned char default_environment[];
 extern env_t *env_ptr;
 
 extern void env_relocate_spec(void);
-extern unsigned char env_get_char_spec(int);
 
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 extern void env_reloc(void);
@@ -281,9 +280,6 @@ struct env_driver {
 
 extern struct hsearch_data env_htab;
 
-/* Function that returns a character from the environment */
-unsigned char env_get_char(int);
-
 /* Function that updates CRC of the enironment */
 void env_crc_update(void);
 
@@ -314,6 +310,16 @@ int env_import_redund(const char *buf1, const char *buf2);
  */
 struct env_driver *env_driver_lookup_default(void);
 
+/**
+ * env_get_char() - Get a character from the early environment
+ *
+ * This reads from the pre-relocation environemnt
+ *
+ * @index: Index of character to read (0 = first)
+ * @return character read, or -ve on error
+ */
+int env_get_char(int index);
+
 #endif /* DO_DEPS_ONLY */
 
 #endif /* _ENVIRONMENT_H_ */
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 18/30] env: Drop env_init_new()

2017-08-03 Thread Simon Glass
Now that env_init() is only defined once we can drop the env_init_new()
name and just use env_init().

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/env.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/env/env.c b/env/env.c
index 53a085c431..ac6a583a02 100644
--- a/env/env.c
+++ b/env/env.c
@@ -125,7 +125,7 @@ int env_save(void)
return 0;
 }
 
-int env_init_new(void)
+int env_init(void)
 {
struct env_driver *drv = env_driver_lookup_default();
int ret = -ENOENT;
@@ -163,7 +163,3 @@ int saveenv(void)
return env_save();
 }
 
-int env_init(void)
-{
-   return env_init_new();
-}
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 11/30] env: Create a location driver for each location

2017-08-03 Thread Simon Glass
Set up a location driver for each supported environment location. At
present this just points to the global functions and is not used. A
later patch will switch this over to use private functions in each driver.

There are several special cases here in various drivers to handle
peculiarities of certain boards:

1. Some boards define CONFIG_ENV_IS_IN_FAT and CONFIG_SPL_ENV_SUPPORT but
do not actually load the environment in SPL. The env load code was
optimised out before but with the driver, it is not. Therefore a special
case is added to env/fat.c. The correct fix (depending on board testing
might be to disable CONFIG_SPL_ENV_SUPPORT.

2. A similar situations happens with CONFIG_ENV_IS_IN_FLASH. Some boards
do not actually load the environment in SPL, so to reduce code size we
need to drop that code. A similar fix may be possible with these boards,
or it may be possible to adjust the environment CONFIG settings.

Added to the above is that the CONFIG_SPL_ENV_SUPPORT option does not
apply when the environment is in flash.

Obviously the above has been discovered through painful and time-consuming
trial and error. Hopefully board maintainers can take a look and figure
out what is actually needed.

Signed-off-by: Simon Glass 
---

Changes in v5: None
Changes in v4:
- Update the commit message to comment on special cases

Changes in v3: None
Changes in v2:
- Add conditions for the am335x_hs_evm board with SPL

 env/dataflash.c   |  8 ++
 env/eeprom.c  |  8 ++
 env/ext4.c|  8 ++
 env/fat.c | 30 --
 env/flash.c   | 39 +---
 env/mmc.c | 10 
 env/nand.c| 12 -
 env/nowhere.c |  6 +
 env/nvram.c   | 10 
 env/onenand.c |  8 ++
 env/remote.c  |  8 ++
 env/sata.c|  8 ++
 env/sf.c  | 20 +++
 env/ubi.c |  8 ++
 include/environment.h | 70 +++
 15 files changed, 246 insertions(+), 7 deletions(-)

diff --git a/env/dataflash.c b/env/dataflash.c
index c140b74c98..9c59d8e63a 100644
--- a/env/dataflash.c
+++ b/env/dataflash.c
@@ -82,3 +82,11 @@ int env_init(void)
 
return 0;
 }
+
+U_BOOT_ENV_LOCATION(dataflash) = {
+   .location   = ENVL_DATAFLASH,
+   .get_char   = env_get_char_spec,
+   .load   = env_relocate_spec,
+   .save   = env_save_ptr(saveenv),
+   .init   = env_init,
+};
diff --git a/env/eeprom.c b/env/eeprom.c
index ac6b30fa8f..78569b286b 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -243,3 +243,11 @@ int env_init(void)
gd->env_valid = ENV_VALID;
return 0;
 }
+
+U_BOOT_ENV_LOCATION(eeprom) = {
+   .location   = ENVL_EEPROM,
+   .get_char   = env_get_char_spec,
+   .load   = env_relocate_spec,
+   .save   = env_save_ptr(saveenv),
+   .init   = env_init,
+};
diff --git a/env/ext4.c b/env/ext4.c
index 7bb4ce7cff..c6a84925d9 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -127,3 +127,11 @@ void env_relocate_spec(void)
 err_env_relocate:
set_default_env(NULL);
 }
+
+U_BOOT_ENV_LOCATION(ext4) = {
+   .location   = ENVL_EXT4,
+   .get_char   = env_get_char_spec,
+   .load   = env_relocate_spec,
+   .save   = env_save_ptr(saveenv),
+   .init   = env_init,
+};
diff --git a/env/fat.c b/env/fat.c
index 129b945a2f..abf6d115b7 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -19,6 +19,18 @@
 #include 
 #include 
 
+#ifdef CONFIG_SPL_BUILD
+/* TODO(s...@chromium.org): Figure out why this is needed */
+# if !defined(CONFIG_TARGET_AM335X_EVM) || defined(CONFIG_SPL_OS_BOOT)
+#  define LOADENV
+# endif
+#else
+# define LOADENV
+# if defined(CONFIG_CMD_SAVEENV)
+#  define CMD_SAVEENV
+# endif
+#endif
+
 char *env_name_spec = "FAT";
 
 env_t *env_ptr;
@@ -34,7 +46,7 @@ int env_init(void)
return 0;
 }
 
-#ifdef CONFIG_CMD_SAVEENV
+#ifdef CMD_SAVEENV
 int saveenv(void)
 {
env_t   env_new;
@@ -72,8 +84,9 @@ int saveenv(void)
puts("done\n");
return 0;
 }
-#endif /* CONFIG_CMD_SAVEENV */
+#endif /* CMD_SAVEENV */
 
+#ifdef LOADENV
 void env_relocate_spec(void)
 {
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
@@ -108,3 +121,16 @@ void env_relocate_spec(void)
 err_env_relocate:
set_default_env(NULL);
 }
+#endif /* LOADENV */
+
+U_BOOT_ENV_LOCATION(fat) = {
+   .location   = ENVL_FAT,
+   .get_char   = env_get_char_spec,
+#ifdef LOADENV
+   .load   = env_relocate_spec,
+#endif
+#ifdef CMD_SAVEENV
+   .save   = env_save_ptr(saveenv),
+#endif
+   .init   = env_init,
+};
diff --git a/env/flash.c b/env/flash.c
index dcf3cd2c62..cf068d11ee 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -20,10 +20,12 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if 

[U-Boot] [PATCH v5 09/30] env: Add an enum for environment state

2017-08-03 Thread Simon Glass
At present we have three states for the environment, numbered 0, 1 and 2.
Add an enum to record this to avoid open-coded values.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 board/Arcturus/ucp1020/spl.c   |  3 ++-
 board/freescale/b4860qds/spl.c |  3 ++-
 board/freescale/c29xpcie/spl.c |  3 ++-
 board/freescale/p1010rdb/spl.c |  3 ++-
 board/freescale/p1022ds/spl.c  |  3 ++-
 board/freescale/p1_p2_rdb_pc/spl.c |  3 ++-
 board/freescale/t102xqds/spl.c |  3 ++-
 board/freescale/t102xrdb/spl.c |  3 ++-
 board/freescale/t104xrdb/spl.c |  3 ++-
 board/freescale/t208xqds/spl.c |  3 ++-
 board/freescale/t208xrdb/spl.c |  3 ++-
 board/freescale/t4qds/spl.c|  3 ++-
 board/freescale/t4rdb/spl.c|  3 ++-
 env/dataflash.c|  2 +-
 env/eeprom.c   | 30 +++---
 env/ext4.c |  2 +-
 env/fat.c  |  2 +-
 env/flash.c| 22 +++---
 env/mmc.c  | 10 +-
 env/nand.c | 29 +++--
 env/nvram.c|  2 +-
 env/onenand.c  |  4 ++--
 env/remote.c   |  2 +-
 env/sata.c |  2 +-
 env/sf.c   | 26 +-
 env/ubi.c  |  6 +++---
 include/asm-generic/global_data.h  |  2 +-
 include/environment.h  |  7 +++
 28 files changed, 104 insertions(+), 83 deletions(-)

diff --git a/board/Arcturus/ucp1020/spl.c b/board/Arcturus/ucp1020/spl.c
index cd484fc44b..b5e7a5db06 100644
--- a/board/Arcturus/ucp1020/spl.c
+++ b/board/Arcturus/ucp1020/spl.c
@@ -10,6 +10,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -99,7 +100,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
(uchar *)CONFIG_ENV_ADDR);
gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
-   gd->env_valid = 1;
+   gd->env_valid = ENV_VALID;
 #else
env_relocate();
 #endif
diff --git a/board/freescale/b4860qds/spl.c b/board/freescale/b4860qds/spl.c
index 60d7f0d48a..b1824b07a2 100644
--- a/board/freescale/b4860qds/spl.c
+++ b/board/freescale/b4860qds/spl.c
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -101,7 +102,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
(uchar *)CONFIG_ENV_ADDR);
gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-   gd->env_valid = 1;
+   gd->env_valid = ENV_VALID;
 #endif
 
i2c_init_all();
diff --git a/board/freescale/c29xpcie/spl.c b/board/freescale/c29xpcie/spl.c
index 94093f11a8..28541a72cb 100644
--- a/board/freescale/c29xpcie/spl.c
+++ b/board/freescale/c29xpcie/spl.c
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -63,7 +64,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
(uchar *)CONFIG_ENV_ADDR);
gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-   gd->env_valid = 1;
+   gd->env_valid = ENV_VALID;
 
i2c_init_all();
 
diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c
index 2cebc2c002..001308874e 100644
--- a/board/freescale/p1010rdb/spl.c
+++ b/board/freescale/p1010rdb/spl.c
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -87,7 +88,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
(uchar *)CONFIG_ENV_ADDR);
gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-   gd->env_valid = 1;
+   gd->env_valid = ENV_VALID;
 #else
env_relocate();
 #endif
diff --git a/board/freescale/p1022ds/spl.c b/board/freescale/p1022ds/spl.c
index a117dc3a2c..94b357d446 100644
--- a/board/freescale/p1022ds/spl.c
+++ b/board/freescale/p1022ds/spl.c
@@ -6,6 +6,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -100,7 +101,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
(uchar *)CONFIG_ENV_ADDR);
 
gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-   gd->env_valid = 1;
+   gd->env_valid = ENV_VALID;
 #else
env_relocate();
 #endif
diff --git a/board/freescale/p1_p2_rdb_pc/spl.c 
b/board/freescale/p1_p2_rdb_pc/spl.c
index ca7ba5754e..c1d4c36b06 100644
--- a/board/freescale/p1_p2_rdb_pc/spl.c
+++ b/board/freescale/p1_p2_rdb_pc/spl.c
@@ -6,6 +6,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,7 +93,7 @@ void 

[U-Boot] [PATCH v5 23/30] env: Rename common functions related to setenv()

2017-08-03 Thread Simon Glass
We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk 
Signed-off-by: Simon Glass 
---

Changes in v5: None
Changes in v4:
- Split out changes to setenv_ulong(), etc. into a new patch

Changes in v3: None
Changes in v2:
- Add new patch to rename setenv() and friends to env_set()

 api/api.c|  2 +-
 arch/arm/mach-tegra/tegra186/nvtboot_board.c |  2 +-
 arch/arm/mach-uniphier/mmc-first-dev.c   |  2 +-
 board/boundary/nitrogen6x/nitrogen6x.c   |  2 +-
 board/engicam/common/board.c |  2 +-
 board/freescale/qemu-ppce500/qemu-ppce500.c  |  4 ++--
 board/grinn/liteboard/board.c|  2 +-
 board/raspberrypi/rpi/rpi.c  |  2 +-
 board/sunxi/board.c  |  2 +-
 cmd/cbfs.c   |  2 +-
 cmd/cramfs.c |  2 +-
 cmd/fdt.c|  4 ++--
 cmd/jffs2.c  |  2 +-
 cmd/load.c   |  6 +++---
 cmd/lzmadec.c|  2 +-
 cmd/mtdparts.c   |  2 +-
 cmd/nand.c   |  6 +++---
 cmd/nvedit.c |  6 +++---
 cmd/reiser.c |  2 +-
 cmd/setexpr.c|  4 ++--
 cmd/tpm.c|  4 ++--
 cmd/trace.c  | 12 ++--
 cmd/unzip.c  |  2 +-
 cmd/ximg.c   |  4 ++--
 cmd/zfs.c|  2 +-
 cmd/zip.c|  2 +-
 common/autoboot.c|  6 +++---
 common/board_r.c |  2 +-
 common/bootm.c   |  4 ++--
 common/bootm_os.c|  2 +-
 drivers/bootcount/bootcount_env.c|  2 +-
 drivers/net/fm/fm.c  |  2 +-
 drivers/scsi/scsi.c  |  2 +-
 fs/fs.c  |  6 +++---
 fs/ubifs/ubifs.c |  2 +-
 include/common.h | 26 +-
 net/net.c|  4 ++--
 37 files changed, 79 insertions(+), 63 deletions(-)

diff --git a/api/api.c b/api/api.c
index 423fb6b0c1..2e620e2a0f 100644
--- a/api/api.c
+++ b/api/api.c
@@ -663,7 +663,7 @@ void api_init(void)
return;
}
 
-   setenv_hex("api_address", (unsigned long)sig);
+   env_set_hex("api_address", (unsigned long)sig);
debugf("API sig @ 0x%lX\n", (unsigned long)sig);
memcpy(sig->magic, API_SIG_MAGIC, 8);
sig->version = API_SIG_VERSION;
diff --git a/arch/arm/mach-tegra/tegra186/nvtboot_board.c 
b/arch/arm/mach-tegra/tegra186/nvtboot_board.c
index 56650efd4f..9cd3fe2f30 100644
--- a/arch/arm/mach-tegra/tegra186/nvtboot_board.c
+++ b/arch/arm/mach-tegra/tegra186/nvtboot_board.c
@@ -15,7 +15,7 @@ static int set_fdt_addr(void)
 {
int ret;
 
-   ret = setenv_hex("fdt_addr", nvtboot_boot_x0);
+   ret = env_set_hex("fdt_addr", nvtboot_boot_x0);
if (ret) {
printf("Failed to set fdt_addr to point at DTB: %d\n", ret);
return ret;
diff --git a/arch/arm/mach-uniphier/mmc-first-dev.c 
b/arch/arm/mach-uniphier/mmc-first-dev.c
index 8c45229a89..acc859a6c3 100644
--- a/arch/arm/mach-uniphier/mmc-first-dev.c
+++ b/arch/arm/mach-uniphier/mmc-first-dev.c
@@ -35,7 +35,7 @@ static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
if (dev < 0)
return CMD_RET_FAILURE;
 
-   setenv_ulong("mmc_first_dev", dev);
+   env_set_ulong("mmc_first_dev", dev);
return CMD_RET_SUCCESS;
 }
 
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c 
b/board/boundary/nitrogen6x/nitrogen6x.c
index c04926c0bb..0e2c4fc0ef 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -1021,6 +1021,6 @@ int misc_init_r(void)
 #ifdef CONFIG_CMD_BMODE
add_board_boot_modes(board_boot_modes);
 #endif
-   setenv_hex("reset_cause", get_imx_reset_cause());
+   env_set_hex("reset_cause", get_imx_reset_cause());
return 0;
 }
diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
index 56112d3459..c7ec55ff82 100644
--- a/board/engicam/common/board.c
+++ b/board/engicam/common/board.c
@@ -21,7 +21,7 @@ static void mmc_late_init(void)
char mmcblk[32];
u32 dev_no = mmc_get_env_dev();
 
-   setenv_ulong("mmcdev", dev_no);
+   env_set_ulong("mmcdev", dev_no);
 
/* Set mmcblk env */
sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait 

[U-Boot] [PATCH v5 10/30] env: Rename nand env_location to nand_env_location

2017-08-03 Thread Simon Glass
We want to use this name for all environment drivers. Update the nand
driver to use a more specific name.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/nand.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/env/nand.c b/env/nand.c
index 90f274bf8a..d1b8b26999 100644
--- a/env/nand.c
+++ b/env/nand.c
@@ -158,12 +158,12 @@ static int writeenv(size_t offset, u_char *buf)
return 0;
 }
 
-struct env_location {
+struct nand_env_location {
const char *name;
const nand_erase_options_t erase_opts;
 };
 
-static int erase_and_write_env(const struct env_location *location,
+static int erase_and_write_env(const struct nand_env_location *location,
u_char *env_new)
 {
struct mtd_info *mtd;
@@ -189,7 +189,7 @@ int saveenv(void)
int ret = 0;
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
int env_idx = 0;
-   static const struct env_location location[] = {
+   static const struct nand_env_location location[] = {
{
.name = "NAND",
.erase_opts = {
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 13/30] env: Add a new implementation of environment access

2017-08-03 Thread Simon Glass
We plan to move to a environment access via drivers for each location
where the environment can be stored. Add an implementation for this. So
far it is not used, but will be pressed into service in a future patch.

Signed-off-by: Simon Glass 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/Makefile |   2 +-
 env/env.c| 145 +++
 2 files changed, 146 insertions(+), 1 deletion(-)
 create mode 100644 env/env.c

diff --git a/env/Makefile b/env/Makefile
index 4c1bdcfdf4..8df5b9d4c9 100644
--- a/env/Makefile
+++ b/env/Makefile
@@ -5,7 +5,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-y += common.o
+obj-y += common.o env.o
 
 ifndef CONFIG_SPL_BUILD
 obj-y += attr.o
diff --git a/env/env.c b/env/env.c
new file mode 100644
index 00..9f0a04c33c
--- /dev/null
+++ b/env/env.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2017 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct env_driver *env_driver_lookup(enum env_location loc)
+{
+   struct env_driver *drv;
+   const int n_ents = ll_entry_count(struct env_driver, env_driver);
+   struct env_driver *entry;
+
+   drv = ll_entry_start(struct env_driver, env_driver);
+   for (entry = drv; entry != drv + n_ents; entry++) {
+   if (loc == entry->location)
+   return entry;
+   }
+
+   /* Not found */
+   return NULL;
+}
+
+static enum env_location env_get_default_location(void)
+{
+   if IS_ENABLED(CONFIG_ENV_IS_IN_DATAFLASH)
+   return ENVL_DATAFLASH;
+   else if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM)
+   return ENVL_EEPROM;
+   else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT)
+   return ENVL_FAT;
+   else if IS_ENABLED(CONFIG_ENV_IS_IN_FLASH)
+   return ENVL_FLASH;
+   else if IS_ENABLED(CONFIG_ENV_IS_IN_MMC)
+   return ENVL_MMC;
+   else if IS_ENABLED(CONFIG_ENV_IS_IN_NAND)
+   return ENVL_NAND;
+   else if IS_ENABLED(CONFIG_ENV_IS_IN_NVRAM)
+   return ENVL_NVRAM;
+   else if IS_ENABLED(CONFIG_ENV_IS_IN_REMOTE)
+   return ENVL_REMOTE;
+   else if IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH)
+   return ENVL_SPI_FLASH;
+   else if IS_ENABLED(CONFIG_ENV_IS_IN_UBI)
+   return ENVL_UBI;
+   else if IS_ENABLED(CONFIG_ENV_IS_NOWHERE)
+   return ENVL_NOWHERE;
+   else
+   return ENVL_UNKNOWN;
+}
+
+static struct env_driver *env_driver_lookup_default(void)
+{
+   enum env_location loc = env_get_default_location();
+   struct env_driver *drv;
+
+   drv = env_driver_lookup(loc);
+   if (!drv) {
+   debug("%s: No environment driver for location %d\n", __func__,
+ loc);
+   return NULL;
+   }
+
+   return drv;
+}
+
+int env_get_char_new(int index)
+{
+   struct env_driver *drv = env_driver_lookup_default();
+   int ret;
+
+   if (!drv)
+   return -ENODEV;
+   if (!drv->get_char)
+   return *(uchar *)(gd->env_addr + index);
+   ret = drv->get_char(index);
+   if (ret < 0) {
+   debug("%s: Environment failed to load (err=%d)\n",
+ __func__, ret);
+   }
+
+   return ret;
+}
+
+int env_load(void)
+{
+   struct env_driver *drv = env_driver_lookup_default();
+   int ret = 0;
+
+   if (!drv)
+   return -ENODEV;
+   if (!drv->load)
+   return 0;
+   drv->load();  /* TODO(s...@chromium.org): Make this return an error */
+   if (ret) {
+   debug("%s: Environment failed to load (err=%d)\n", __func__,
+ ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+int env_save(void)
+{
+   struct env_driver *drv = env_driver_lookup_default();
+   int ret;
+
+   if (!drv)
+   return -ENODEV;
+   if (!drv->save)
+   return -ENOSYS;
+   ret = drv->save();
+   if (ret) {
+   debug("%s: Environment failed to save (err=%d)\n", __func__,
+ ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+int env_init_new(void)
+{
+   struct env_driver *drv = env_driver_lookup_default();
+   int ret;
+
+   if (!drv)
+   return -ENODEV;
+   if (!drv->init)
+   return -ENOSYS;
+   ret = drv->init();
+   if (ret) {
+   debug("%s: Environment failed to init (err=%d)\n", __func__,
+ ret);
+   return ret;
+   }
+
+   return 0;
+}
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 12/30] env: Convert CONFIG_ENV_IS_IN... to a choice

2017-08-03 Thread Simon Glass
At present we support multiple environment drivers but there is not way to
select between them at run time. Also settings related to the position and
size of the environment area are global (i.e. apply to all locations).

Until these limitations are removed we cannot really support more than one
environment location. Adjust the location to be a choice so that only one
can be selected. By default the environment is 'nowhere', meaning that the
environment exists only in memory and cannot be saved.

Also expand the help for the 'nowhere' option and move it to the top since
it is the default.

Signed-off-by: Simon Glass 
---

Changes in v5:
- Add new patch to convert CONFIG_ENV_IS_IN... to a choice

Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/Kconfig | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/env/Kconfig b/env/Kconfig
index c8dd65f3a5..99d6095b31 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -1,5 +1,25 @@
 menu "Environment"
 
+choice
+   prompt "Select the location of the environment"
+   default ENV_IS_NOWHERE if !ARCH_SUNXI
+   default ENV_IS_IN_MMC if ARCH_SUNXI
+   help
+ At present the environment can be stored in only one place. Use this
+ option to select the location. This is either a device (where the
+ environemnt information is simply written to a fixed location or
+ partition on the device) or a filesystem (where the environment
+ information is written to a file).
+
+config ENV_IS_NOWHERE
+   bool "Environment is not stored"
+   help
+ Define this if you don't want to or can't have an environment stored
+ on a storage medium. In this case the environemnt will still exist
+ while U-Boot is running, but once U-Boot exits it will not be
+ stored. U-Boot will therefore always start up with a default
+ environment.
+
 config ENV_IS_IN_DATAFLASH
bool "Environment in dataflash"
depends on !CHAIN_OF_TRUST
@@ -161,7 +181,6 @@ config ENV_IS_IN_FLASH
 config ENV_IS_IN_MMC
bool "Environment in an MMC device"
depends on !CHAIN_OF_TRUST
-   default y if ARCH_SUNXI
help
  Define this if you have an MMC device which you want to use for the
  environment.
@@ -364,11 +383,7 @@ config ENV_IS_IN_UBI
  You will probably want to define these to avoid a really noisy system
  when storing the env in UBI.
 
-config ENV_IS_NOWHERE
-   bool "Environment is not stored"
-   help
- Define this if you don't want to or can't have an environment stored
- on a storage medium
+endchoice
 
 config ENV_FAT_INTERFACE
string "Name of the block device for the environment"
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 07/30] env: common: Drop env_get_char_init()

2017-08-03 Thread Simon Glass
This function does nothing but call env_get_char_spec(). Drop it and
adjust its only caller.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/common.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/env/common.c b/env/common.c
index bfa8cfb143..f0ffe4ed73 100644
--- a/env/common.c
+++ b/env/common.c
@@ -32,11 +32,6 @@ __weak uchar env_get_char_spec(int index)
return *((uchar *)(gd->env_addr + index));
 }
 
-static uchar env_get_char_init(int index)
-{
-   return env_get_char_spec(index);
-}
-
 static uchar env_get_char_memory(int index)
 {
return *(uchar *)(gd->env_addr + index);
@@ -50,7 +45,7 @@ uchar env_get_char(int index)
else if (gd->flags & GD_FLG_RELOC)  /* if relocated to RAM */
return env_get_char_memory(index);
else
-   return env_get_char_init(index);
+   return env_get_char_spec(index);
 }
 
 /*
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 05/30] env: common: Drop env_get_addr()

2017-08-03 Thread Simon Glass
This function is not used anywhere other than env_get_char(). Move the
code into that function.

Reviewed-by: Tom Rini 
Signed-off-by: Simon Glass 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/common.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/env/common.c b/env/common.c
index 5a17e52615..2e94dd71e2 100644
--- a/env/common.c
+++ b/env/common.c
@@ -41,17 +41,12 @@ static uchar env_get_char_init(int index)
return default_environment[index];
 }
 
-static const uchar *env_get_addr(int index)
+static uchar env_get_char_memory(int index)
 {
if (gd->env_valid)
-   return (uchar *)(gd->env_addr + index);
+   return *(uchar *)(gd->env_addr + index);
else
-   return _environment[index];
-}
-
-static uchar env_get_char_memory(int index)
-{
-   return *env_get_addr(index);
+   return default_environment[index];
 }
 
 uchar env_get_char(int index)
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 02/30] Move environment files from common/ to env/

2017-08-03 Thread Simon Glass
About a quarter of the files in common/ relate to the environment. It
seems better to put these into their own subdirectory and remove the
prefix.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5:
- Rebase to master (e.g. for ENV_FAT_DEVICE_AND_PART)

Changes in v4: None
Changes in v3: None
Changes in v2: None

 Kconfig   |   2 +
 Makefile  |   1 +
 arch/sh/cpu/u-boot.lds|   4 +-
 board/freescale/mx31ads/u-boot.lds|   2 +-
 common/Kconfig| 442 --
 common/Makefile   |  49 +---
 env/Kconfig   | 441 +
 env/Makefile  |  57 
 common/env_attr.c => env/attr.c   |   0
 common/env_callback.c => env/callback.c   |   0
 common/env_common.c => env/common.c   |   0
 common/env_dataflash.c => env/dataflash.c |   0
 common/env_eeprom.c => env/eeprom.c   |   0
 common/env_embedded.c => env/embedded.c   |   0
 common/env_ext4.c => env/ext4.c   |   0
 common/env_fat.c => env/fat.c |   0
 common/env_flags.c => env/flags.c |   0
 common/env_flash.c => env/flash.c |   0
 common/env_mmc.c => env/mmc.c |   0
 common/env_nand.c => env/nand.c   |   0
 common/env_nowhere.c => env/nowhere.c |   0
 common/env_nvram.c => env/nvram.c |   0
 common/env_onenand.c => env/onenand.c |   0
 common/env_remote.c => env/remote.c   |   0
 common/env_sata.c => env/sata.c   |   0
 common/env_sf.c => env/sf.c   |   0
 common/env_ubi.c => env/ubi.c |   0
 include/configs/M5208EVBE.h   |   4 +-
 include/configs/M5235EVB.h|   2 +-
 include/configs/M5249EVB.h|   4 +-
 include/configs/M5253DEMO.h   |   4 +-
 include/configs/M5253EVBE.h   |   2 +-
 include/configs/M5272C3.h |   4 +-
 include/configs/M5275EVB.h|   4 +-
 include/configs/M5282EVB.h|   2 +-
 include/configs/M53017EVB.h   |   2 +-
 include/configs/M5329EVB.h|   4 +-
 include/configs/M5373EVB.h|   4 +-
 include/configs/amcore.h  |   4 +-
 include/configs/astro_mcf5373l.h  |   2 +-
 include/configs/cobra5272.h   |   4 +-
 scripts/Makefile.spl  |   4 +-
 tools/Makefile|   4 +-
 43 files changed, 532 insertions(+), 520 deletions(-)
 create mode 100644 env/Kconfig
 create mode 100644 env/Makefile
 rename common/env_attr.c => env/attr.c (100%)
 rename common/env_callback.c => env/callback.c (100%)
 rename common/env_common.c => env/common.c (100%)
 rename common/env_dataflash.c => env/dataflash.c (100%)
 rename common/env_eeprom.c => env/eeprom.c (100%)
 rename common/env_embedded.c => env/embedded.c (100%)
 rename common/env_ext4.c => env/ext4.c (100%)
 rename common/env_fat.c => env/fat.c (100%)
 rename common/env_flags.c => env/flags.c (100%)
 rename common/env_flash.c => env/flash.c (100%)
 rename common/env_mmc.c => env/mmc.c (100%)
 rename common/env_nand.c => env/nand.c (100%)
 rename common/env_nowhere.c => env/nowhere.c (100%)
 rename common/env_nvram.c => env/nvram.c (100%)
 rename common/env_onenand.c => env/onenand.c (100%)
 rename common/env_remote.c => env/remote.c (100%)
 rename common/env_sata.c => env/sata.c (100%)
 rename common/env_sf.c => env/sf.c (100%)
 rename common/env_ubi.c => env/ubi.c (100%)

diff --git a/Kconfig b/Kconfig
index c1451bceda..5ca3854b23 100644
--- a/Kconfig
+++ b/Kconfig
@@ -368,6 +368,8 @@ source "disk/Kconfig"
 
 source "dts/Kconfig"
 
+source "env/Kconfig"
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/Makefile b/Makefile
index 04a22a6818..6ddd5a3ed5 100644
--- a/Makefile
+++ b/Makefile
@@ -690,6 +690,7 @@ libs-y += drivers/usb/phy/
 libs-y += drivers/usb/ulpi/
 libs-y += cmd/
 libs-y += common/
+libs-y += env/
 libs-$(CONFIG_API) += api/
 libs-$(CONFIG_HAS_POST) += post/
 libs-y += test/
diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds
index bbf9ff485f..7fc91bc4aa 100644
--- a/arch/sh/cpu/u-boot.lds
+++ b/arch/sh/cpu/u-boot.lds
@@ -33,9 +33,9 @@ SECTIONS
KEEP(CONFIG_BOARDDIR/lowlevel_init.o(.text .spiboot1.text))
KEEP(*(.spiboot2.text))
. = ALIGN(8192);
-   common/env_embedded.o   (.ppcenv)
+   env/embedded.o  (.ppcenv)
. = ALIGN(8192);
-   common/env_embedded.o   (.ppcenvr)
+   env/embedded.o  (.ppcenvr)
. = ALIGN(8192);
*(.text)
. = ALIGN(4);
diff --git a/board/freescale/mx31ads/u-boot.lds 
b/board/freescale/mx31ads/u-boot.lds
index 8a4a8a2f07..71a63f188e 100644
--- 

[U-Boot] [PATCH v5 04/30] env: common: Make env_get_addr/get_char_memory() static

2017-08-03 Thread Simon Glass
These functions are not used outside this file. Make them static and order
them to avoid forward declarations.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/common.c  | 18 +-
 include/environment.h |  4 
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/env/common.c b/env/common.c
index d9c0c4e3f3..5a17e52615 100644
--- a/env/common.c
+++ b/env/common.c
@@ -41,7 +41,15 @@ static uchar env_get_char_init(int index)
return default_environment[index];
 }
 
-uchar env_get_char_memory(int index)
+static const uchar *env_get_addr(int index)
+{
+   if (gd->env_valid)
+   return (uchar *)(gd->env_addr + index);
+   else
+   return _environment[index];
+}
+
+static uchar env_get_char_memory(int index)
 {
return *env_get_addr(index);
 }
@@ -55,14 +63,6 @@ uchar env_get_char(int index)
return env_get_char_init(index);
 }
 
-const uchar *env_get_addr(int index)
-{
-   if (gd->env_valid)
-   return (uchar *)(gd->env_addr + index);
-   else
-   return _environment[index];
-}
-
 /*
  * Read an environment variable as a boolean
  * Return -1 if variable does not exist (default to true)
diff --git a/include/environment.h b/include/environment.h
index d86230a2e9..5f2064bf23 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -202,10 +202,6 @@ extern struct hsearch_data env_htab;
 /* Function that returns a character from the environment */
 unsigned char env_get_char(int);
 
-/* Function that returns a pointer to a value from the environment */
-const unsigned char *env_get_addr(int);
-unsigned char env_get_char_memory(int index);
-
 /* Function that updates CRC of the enironment */
 void env_crc_update(void);
 
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 03/30] env: Use tabs in ENV_IS_IN_FAT

2017-08-03 Thread Simon Glass
Tidy up the formatting of this option.

Signed-off-by: Simon Glass 
---

Changes in v5:
- Rewrite commit message to mention that it just changes tabs now

Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/Kconfig | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/env/Kconfig b/env/Kconfig
index 9f97f9c90c..c8dd65f3a5 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -81,11 +81,10 @@ config ENV_IS_IN_FAT
depends on !CHAIN_OF_TRUST
select FAT_WRITE
help
- Define this if you want to use the FAT file system for the 
environment.
+ Define this if you want to use the FAT file system for the 
environment.
 
-
- - CONFIG_FAT_WRITE:
- This must be enabled. Otherwise it cannot save the environment file.
+ - CONFIG_FAT_WRITE:
+ This must be enabled. Otherwise it cannot save the environment file.
 
 config ENV_IS_IN_FLASH
bool "Environment in flash memory"
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 06/30] env: common: Factor out the common env_valid check

2017-08-03 Thread Simon Glass
The check for gd->env_valid is used in both the 'if' and 'else' part of
env_get_char(). Move it into that function instead for simplicity. Drop
that code from the two leaf functions.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/common.c | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/env/common.c b/env/common.c
index 2e94dd71e2..bfa8cfb143 100644
--- a/env/common.c
+++ b/env/common.c
@@ -34,25 +34,20 @@ __weak uchar env_get_char_spec(int index)
 
 static uchar env_get_char_init(int index)
 {
-   /* if crc was bad, use the default environment */
-   if (gd->env_valid)
-   return env_get_char_spec(index);
-   else
-   return default_environment[index];
+   return env_get_char_spec(index);
 }
 
 static uchar env_get_char_memory(int index)
 {
-   if (gd->env_valid)
-   return *(uchar *)(gd->env_addr + index);
-   else
-   return default_environment[index];
+   return *(uchar *)(gd->env_addr + index);
 }
 
 uchar env_get_char(int index)
 {
-   /* if relocated to RAM */
-   if (gd->flags & GD_FLG_RELOC)
+   /* if env is not set up, or crc was bad, use the default environment */
+   if (!gd->env_valid)
+   return default_environment[index];
+   else if (gd->flags & GD_FLG_RELOC)  /* if relocated to RAM */
return env_get_char_memory(index);
else
return env_get_char_init(index);
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 08/30] env: common: Drop env_get_char_memory()

2017-08-03 Thread Simon Glass
This function is the same as env_get_char_spec() apart from dropping the
brackets. Drop the brackets from env_get_char_spec() and use that instead
of env_get_char_memory().

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 env/common.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/env/common.c b/env/common.c
index f0ffe4ed73..842c0f7fd1 100644
--- a/env/common.c
+++ b/env/common.c
@@ -28,11 +28,6 @@ struct hsearch_data env_htab = {
 };
 
 __weak uchar env_get_char_spec(int index)
-{
-   return *((uchar *)(gd->env_addr + index));
-}
-
-static uchar env_get_char_memory(int index)
 {
return *(uchar *)(gd->env_addr + index);
 }
@@ -42,8 +37,6 @@ uchar env_get_char(int index)
/* if env is not set up, or crc was bad, use the default environment */
if (!gd->env_valid)
return default_environment[index];
-   else if (gd->flags & GD_FLG_RELOC)  /* if relocated to RAM */
-   return env_get_char_memory(index);
else
return env_get_char_spec(index);
 }
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 00/30] env: Move environment code to use location drivers

2017-08-03 Thread Simon Glass
The environment code is ripe for improvement in various ways. It has lots
of duplication and inconsistencies between how things work with different
environment locations. It does not properly use Kconfig. Error checking
and handling is patchy.

This series makes a start at improving things:

- moves the rest of the CONFIG_ENV_IS_IN_... options to Kconfig
- introduces the concept of a location driver for the environment
- drops some of the duplicated code
- improves error handling a little (more to be done here)
- moves code into a new env/ directory

There is still much more to do:
- complete Kconfig conversion (e.g. CONFIG_ENV_SIZE)
- unify environment settings so that all locations support the same options
- try to rationalise the redundancy code (can we create a common
implementation used by all drivers?)
- allow environment in multiple locations (e.g. as a fallback)
- figure out why CONFIG_ENV_IS_IN_FLASH enables the environment in flash
even in SPL, which other locations do not
- move environment functions from common.h to environment.h

Changes in v5:
- Rebase to master (e.g. for ENV_FAT_DEVICE_AND_PART)
- Rewrite commit message to mention that it just changes tabs now
- Add new patch to convert CONFIG_ENV_IS_IN... to a choice
- Fix 81-column line
- Rebase to master

Changes in v4:
- Update the commit message to comment on special cases
- Adjust implementation of env_get_char_spec() to avoid recursion
- Fix incorrect setting of env_valid in env_init_new()
- Add changes for edison also
- Reduce patch to only change setenv(), not any related function
- Split out changes to setenv_ulong(), etc. into a new patch
- Add new patch to rename eth_setenv_enetaddr()
- Reduce patch to only change getenv() and getenv_f()
- Update comment message to mention use of getenv() in condition context
- Add new patch to rename eth_getenv_enetaddr()
- Add new patch to rename some other genenv()-related functions
- Rebase to master, dropping patches already applied

Changes in v3:
- Rebase to master

Changes in v2:
- Add conditions for the am335x_hs_evm board with SPL
- Add new patch to rename setenv() and friends to env_set()
- Add new patch to rename setenv() and friends to env_set()
- Add new patch to rename getenv() and friends to env_get()
- Add new patch to rename getenv_hex(), getenv_yesno(), getenv_ulong()
- Add new patch to rename getenv() and friends to env_get()
- Rebase to master

Simon Glass (30):
  Makefile: Rename 'env' target to 'environ'
  Move environment files from common/ to env/
  env: Use tabs in ENV_IS_IN_FAT
  env: common: Make env_get_addr/get_char_memory() static
  env: common: Drop env_get_addr()
  env: common: Factor out the common env_valid check
  env: common: Drop env_get_char_init()
  env: common: Drop env_get_char_memory()
  env: Add an enum for environment state
  env: Rename nand env_location to nand_env_location
  env: Create a location driver for each location
  env: Convert CONFIG_ENV_IS_IN... to a choice
  env: Add a new implementation of environment access
  env: Switch over to use environment location drivers
  env: Drop common init() functions
  env: Drop the env_name_spec global
  env: Drop unused env_ptr variables
  env: Drop env_init_new()
  env: Drop env_get_char_spec()
  env: Drop env_relocate_spec() in favour of env_load()
  env: Drop saveenv() in favour of env_save()
  env: Rename setenv() to env_set()
  env: Rename common functions related to setenv()
  env: Rename eth_setenv_enetaddr() to eth_env_set_enetaddr()
  env: Rename getenv/_f() to env_get()
  env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()
  env: Rename eth_getenv_enetaddr() to eth_env_get_enetaddr()
  env: Rename some other getenv()-related functions
  env: Adjust the get_char() method to return an int
  env: Adjust the load() method to return an error

 Kconfig|   2 +
 Makefile   |   5 +-
 README |   2 +-
 api/api.c  |   6 +-
 arch/arc/lib/bootm.c   |   2 +-
 arch/arm/cpu/armv7/vf610/generic.c |   2 +-
 arch/arm/cpu/armv8/fsl-layerscape/soc.c|   2 +-
 arch/arm/lib/bootm.c   |   6 +-
 arch/arm/lib/semihosting.c |   2 +-
 arch/arm/mach-davinci/misc.c   |   4 +-
 arch/arm/mach-imx/mx6/opos6ul.c|   2 +-
 arch/arm/mach-imx/mx7/soc.c|   4 +-
 arch/arm/mach-imx/video.c  |   2 +-
 arch/arm/mach-keystone/ddr3.c  |   2 +-
 arch/arm/mach-keystone/keystone.c  |   2 +-
 arch/arm/mach-kirkwood/cpu.c   |   4 +-
 arch/arm/mach-omap2/boot-common.c  |   5 +-
 arch/arm/mach-omap2/utils.c|  20 +-
 arch/arm/mach-rockchip/rk3036-board.c  |   4 +-
 

[U-Boot] [PATCH v5 01/30] Makefile: Rename 'env' target to 'environ'

2017-08-03 Thread Simon Glass
This target stops us using 'env' as a subdirectory. It is not mentioned in
the help so seems to be an internal target. Rename it.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 50a002e72f..04a22a6818 100644
--- a/Makefile
+++ b/Makefile
@@ -1463,14 +1463,14 @@ checkarmreloc: u-boot
false; \
fi
 
-env: scripts_basic
+environ: scripts_basic
$(Q)$(MAKE) $(build)=tools/$@
 
 tools-only: scripts_basic $(version_h) $(timestamp_h)
$(Q)$(MAKE) $(build)=tools
 
 tools-all: export HOST_TOOLS_ALL=y
-tools-all: env tools ;
+tools-all: environ tools ;
 
 cross_tools: export CROSS_BUILD_TOOLS=y
 cross_tools: tools ;
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] U-boot 2017.07 not working on Raspberry Pi

2017-08-03 Thread Tom Rini
On Thu, Aug 03, 2017 at 09:42:13AM -0600, Stephen Warren wrote:
> On 08/03/2017 07:45 AM, Simon Glass wrote:
> ...
> >I'm not sure if we have a Raspberry Pi in a test farm anywhere. I
> >should be able to look next week if no one can figure these out
> >beforehand.
> 
> I thought that Tom had some Pis in his test farm?

I have an RPi 3, but we don't have Linux boot tests atm.  I'm talking
with Kevin Hilman about how I might setup kernelci to test a few things
in my lab, which might catch this kind of problem sooner rather than
later.

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] fs: add fs_readdir()

2017-08-03 Thread Rob Clark
Needed to support efi file protocol.  The fallback.efi loader wants
to be able to read the contents of the /EFI directory to find an OS
to boot.

Currently only implemented for FAT, but that is all that UEFI is
required to support.

Signed-off-by: Rob Clark 
---
 fs/fat/fat.c  | 59 ++-
 fs/fs.c   | 25 +
 include/fat.h |  4 +++-
 include/fs.h  | 21 +
 4 files changed, 95 insertions(+), 14 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 9ad18f96ff..04d8616598 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -575,17 +576,25 @@ static __u8 mkcksum(const char name[8], const char ext[3])
 /*
  * Get the directory entry associated with 'filename' from the directory
  * starting at 'startsect'
+ *
+ * Last two args are only used for dols==LS_READDIR
  */
 __u8 get_dentfromdir_block[MAX_CLUSTSIZE]
__aligned(ARCH_DMA_MINALIGN);
 
-static dir_entry *get_dentfromdir(fsdata *mydata, int startsect,
- char *filename, dir_entry *retdent,
- int dols)
+static dir_entry *get_dentfromdir(fsdata *mydata, char *filename,
+ dir_entry *retdent, int dols,
+ loff_t pos, struct fs_dirent *d)
 {
__u16 prevcksum = 0x;
__u32 curclust = START(retdent);
int files = 0, dirs = 0;
+   int readdir = 0;
+
+   if (dols == LS_READDIR) {
+   readdir = 1;
+   dols = 0;
+   }
 
debug("get_dentfromdir: %s\n", filename);
 
@@ -618,7 +627,7 @@ static dir_entry *get_dentfromdir(fsdata *mydata, int 
startsect,
get_vfatname(mydata, curclust,
 get_dentfromdir_block,
 dentptr, l_name);
-   if (dols) {
+   if (dols || readdir) {
int isdir;
char dirc;
int doit = 0;
@@ -637,7 +646,14 @@ static dir_entry *get_dentfromdir(fsdata *mydata, int 
startsect,
}
}
if (doit) {
-   if (dirc == ' ') {
+   if (readdir) {
+   if ((dirs + 
files - 1) == pos) {
+   
strcpy(d->name, l_name);
+   if 
(!isdir)
+   
d->size = FAT2CPU32(dentptr->size);
+   return 
NULL;
+   }
+   } else if (dirc == ' ') 
{
printf(" %8u   
%s%c\n",
   
FAT2CPU32(dentptr->size),
l_name,
@@ -676,7 +692,7 @@ static dir_entry *get_dentfromdir(fsdata *mydata, int 
startsect,
}
 
get_name(dentptr, s_name);
-   if (dols) {
+   if (dols || readdir) {
int isdir = (dentptr->attr & ATTR_DIR);
char dirc;
int doit = 0;
@@ -694,7 +710,14 @@ static dir_entry *get_dentfromdir(fsdata *mydata, int 
startsect,
}
 
if (doit) {
-   if (dirc == ' ') {
+   if (readdir) {
+   if ((dirs + files - 1) == pos) {
+   strcpy(d->name, s_name);
+   if (!isdir)
+   d->size = 
FAT2CPU32(dentptr->size);
+   return NULL;
+   }
+   } else if (dirc == ' ') {
printf(" %8u   %s%c\n",
   

[U-Boot] [PATCH 5/6] db410c: config updates

2017-08-03 Thread Rob Clark
Signed-off-by: Rob Clark 
---
 configs/dragonboard410c_defconfig | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/configs/dragonboard410c_defconfig 
b/configs/dragonboard410c_defconfig
index c78b4a6fd5..d9cb269085 100644
--- a/configs/dragonboard410c_defconfig
+++ b/configs/dragonboard410c_defconfig
@@ -9,6 +9,7 @@ CONFIG_ENV_IS_NOWHERE=y
 CONFIG_SYS_PROMPT="dragonboard410c => "
 # CONFIG_CMD_IMI is not set
 # CONFIG_CMD_IMLS is not set
+CONFIG_CMD_POWEROFF=y
 CONFIG_CMD_MD5SUM=y
 CONFIG_CMD_MEMINFO=y
 CONFIG_CMD_UNZIP=y
@@ -21,11 +22,14 @@ CONFIG_CMD_TIMER=y
 CONFIG_CLK=y
 CONFIG_MSM_GPIO=y
 CONFIG_PM8916_GPIO=y
+CONFIG_DM_KEYBOARD=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_MSM=y
+CONFIG_DM_ETH=y
+# CONFIG_NETDEVICES is not set
 CONFIG_DM_PMIC=y
 CONFIG_PMIC_PM8916=y
 CONFIG_MSM_SERIAL=y
@@ -38,4 +42,11 @@ CONFIG_USB_EHCI_MSM=y
 CONFIG_USB_ULPI_VIEWPORT=y
 CONFIG_USB_ULPI=y
 CONFIG_USB_STORAGE=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
+CONFIG_DM_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+CONFIG_NO_FB_CLEAR=y
+CONFIG_VIDEO_SIMPLE=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 6/6] db410c: enable r8152 usb eth

2017-08-03 Thread Rob Clark
Signed-off-by: Rob Clark 
---
 include/configs/dragonboard410c.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/dragonboard410c.h 
b/include/configs/dragonboard410c.h
index 626dff8dcd..bbc9685e0e 100644
--- a/include/configs/dragonboard410c.h
+++ b/include/configs/dragonboard410c.h
@@ -44,6 +44,7 @@
 #define CONFIG_USB_ETHER_ASIX88179
 #define CONFIG_USB_ETHER_MCS7830
 #define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_USB_ETHER_RTL8152
 
 /* Extra Commands */
 /* Enable that for switching of boot partitions */
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/6] db410c: on aarch64 the fdtfile is in per-vendor subdirectory

2017-08-03 Thread Rob Clark
Signed-off-by: Rob Clark 
---
 include/configs/dragonboard410c.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/dragonboard410c.h 
b/include/configs/dragonboard410c.h
index d9dc639aeb..626dff8dcd 100644
--- a/include/configs/dragonboard410c.h
+++ b/include/configs/dragonboard410c.h
@@ -103,7 +103,7 @@ REFLASH(dragonboard/u-boot.img, 8)\
"initrd_high=0x\0" \
"linux_image=Image\0" \
"kernel_addr_r=0x8100\0"\
-   "fdtfile=apq8016-sbc.dtb\0" \
+   "fdtfile=qcom/apq8016-sbc.dtb\0" \
"fdt_addr_r=0x8300\0"\
"ramdisk_addr_r=0x8400\0"\
"scriptaddr=0x9000\0"\
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/6] db410c: add reserved-memory node to dts

2017-08-03 Thread Rob Clark
If lk lights up display and populates simple-framebuffer node, it will
also setup a reserved-memory node (needed by simplefb on linux).  But
it isn't clever enough to cope when the reserved-memory node is not
present.

Signed-off-by: Rob Clark 
---
 arch/arm/dts/dragonboard410c.dts | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts
index 0d3b7a35f4..a47b95264c 100644
--- a/arch/arm/dts/dragonboard410c.dts
+++ b/arch/arm/dts/dragonboard410c.dts
@@ -23,11 +23,16 @@
reg = <0 0x8000 0 0x3da0>;
};
 
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+   };
+
chosen {
stdout-path = "/soc/serial@78b";
};
 
-
soc {
#address-cells = <0x1>;
#size-cells = <0x1>;
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/6] db410c: use fdt passed from lk

2017-08-03 Thread Rob Clark
lk patches the fdt to set some device's MAC addresses and more
importantly to patch in the simple-framebuffer node that we want u-boot
to see.

Signed-off-by: Rob Clark 
---
 board/qualcomm/dragonboard410c/Makefile  |  1 +
 board/qualcomm/dragonboard410c/dragonboard410c.c |  8 ++
 board/qualcomm/dragonboard410c/lowlevel_init.S   | 36 
 3 files changed, 45 insertions(+)
 create mode 100644 board/qualcomm/dragonboard410c/lowlevel_init.S

diff --git a/board/qualcomm/dragonboard410c/Makefile 
b/board/qualcomm/dragonboard410c/Makefile
index cd678088fa..5082383be4 100644
--- a/board/qualcomm/dragonboard410c/Makefile
+++ b/board/qualcomm/dragonboard410c/Makefile
@@ -5,4 +5,5 @@
 #
 
 obj-y  := dragonboard410c.o
+obj-y  += lowlevel_init.o
 extra-y += head.o
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c 
b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 37d0b85e0e..1fa4dc1b15 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -27,6 +27,14 @@ int dram_init_banksize(void)
return 0;
 }
 
+extern unsigned long fw_dtb_pointer;
+
+void *board_fdt_blob_setup(void)
+{
+   if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
+   return NULL;
+   return (void *)fw_dtb_pointer;
+}
 
 int board_prepare_usb(enum usb_init_type type)
 {
diff --git a/board/qualcomm/dragonboard410c/lowlevel_init.S 
b/board/qualcomm/dragonboard410c/lowlevel_init.S
new file mode 100644
index 00..cdbd8e14db
--- /dev/null
+++ b/board/qualcomm/dragonboard410c/lowlevel_init.S
@@ -0,0 +1,36 @@
+/*
+ * (C) Copyright 2016
+ * Cédric Schieli 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+
+.align 8
+.global fw_dtb_pointer
+fw_dtb_pointer:
+#ifdef CONFIG_ARM64
+   .dword 0x0
+#else
+   .word 0x0
+#endif
+
+/*
+ * Routine: save_boot_params (called after reset from start.S)
+ * Description: save ATAG/FDT address provided by the firmware at boot time
+ */
+
+.global save_boot_params
+save_boot_params:
+
+   /* The firmware provided ATAG/FDT address can be found in r2/x0 */
+#ifdef CONFIG_ARM64
+   adr x8, fw_dtb_pointer
+   str x0, [x8]
+#else
+   str r2, fw_dtb_pointer
+#endif
+
+   /* Returns */
+   b   save_boot_params_ret
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/6] fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE

2017-08-03 Thread Rob Clark
Similar to CONFIG_OF_BOARD, but in this case the fdt is still built by
u-boot build.  This allows the board to patch the fdt, etc.

In the specific case of dragonboard 410c, we pass the u-boot generated
fdt to the previous stage of bootloader (by embedding it in the
u-boot.img that is loaded by lk/aboot), which patches the fdt and passes
it back to u-boot.

Signed-off-by: Rob Clark 
---
 include/fdtdec.h |  3 ++-
 lib/fdtdec.c | 45 ++---
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index 4a0947c626..b9acec735a 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -986,7 +986,8 @@ int fdtdec_setup(void);
 
 /**
  * Board-specific FDT initialization. Returns the address to a device tree 
blob.
- * Called when CONFIG_OF_BOARD is defined.
+ * Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined
+ * and the board implements it.
  */
 void *board_fdt_blob_setup(void);
 
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index d2dbd0f122..07c458673c 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1203,34 +1203,41 @@ int fdtdec_setup_memory_banksize(void)
 }
 #endif
 
-int fdtdec_setup(void)
+#ifdef CONFIG_OF_SEPARATE
+/*
+ * For CONFIG_OF_SEPARATE, the board may optionally implement this to
+ * provide and/or fixup the fdt.
+ */
+__weak void *board_fdt_blob_setup(void)
 {
-#if CONFIG_IS_ENABLED(OF_CONTROL)
-# ifdef CONFIG_OF_EMBED
-   /* Get a pointer to the FDT */
-   gd->fdt_blob = __dtb_dt_begin;
-# elif defined CONFIG_OF_SEPARATE
-#  ifdef CONFIG_SPL_BUILD
+   void *fdt_blob = NULL;
+#ifdef CONFIG_SPL_BUILD
/* FDT is at end of BSS unless it is in a different memory region */
if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
-   gd->fdt_blob = (ulong *)&_image_binary_end;
+   fdt_blob = (ulong *)&_image_binary_end;
else
-   gd->fdt_blob = (ulong *)&__bss_end;
+   fdt_blob = (ulong *)&__bss_end;
 
-#  elif defined CONFIG_FIT_EMBED
-   gd->fdt_blob = locate_dtb_in_fit(&_end);
+#elif defined CONFIG_FIT_EMBED
+   fdt_blob = locate_dtb_in_fit(&_end);
 
-   if (gd->fdt_blob == NULL || gd->fdt_blob <= ((void *)&_end)) {
+   if (fdt_blob == NULL || fdt_blob <= ((void *)&_end))
puts("Failed to find proper dtb in embedded FIT Image\n");
-   return -1;
-   }
-
-#  else
+#else
/* FDT is at end of image */
-   gd->fdt_blob = (ulong *)&_end;
+   fdt_blob = (ulong *)&_end;
 #  endif
-# elif defined(CONFIG_OF_BOARD)
-   /* Allow the board to override the fdt address. */
+   return fdt_blob;
+}
+#endif
+
+int fdtdec_setup(void)
+{
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+# ifdef CONFIG_OF_EMBED
+   /* Get a pointer to the FDT */
+   gd->fdt_blob = __dtb_dt_begin;
+# elif defined(CONFIG_OF_SEPARATE) || defined(CONFIG_OF_BOARD)
gd->fdt_blob = board_fdt_blob_setup();
 # elif defined(CONFIG_OF_HOSTFILE)
if (sandbox_read_fdt_from_file()) {
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/3] video: simplefb

2017-08-03 Thread Rob Clark
Not really qcom specific, but for now qcom/lk is the one firmware that
is (afaiu) setting up the appropriate dt node for pre-configured
display.  Uses the generic simple-framebuffer DT bindings so this should
be useful on other platforms.

Signed-off-by: Rob Clark 
---
 drivers/video/Kconfig| 10 +++
 drivers/video/Makefile   |  2 +-
 drivers/video/simplefb.c | 71 
 3 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/simplefb.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 61dfed8c06..8eb0359231 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -628,4 +628,14 @@ config VIDEO_DW_HDMI
  rather requires a SoC-specific glue driver to call it), it
  can not be enabled from the configuration menu.
 
+config VIDEO_SIMPLE
+   bool "Simple display driver for preconfigured display"
+   help
+ Enables a simple generic display driver which utilizes the
+ simple-framebuffer devicetree bindings.
+
+ This driver assumes that the display hardware has been initialized
+ before u-boot starts, and u-boot will simply render to the pre-
+ allocated frame buffer surface.
+
 endmenu
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index ac5371f2ae..52f50f647b 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -57,7 +57,7 @@ obj-$(CONFIG_FORMIKE) += formike.o
 obj-$(CONFIG_LG4573) += lg4573.o
 obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
 obj-$(CONFIG_VIDEO_DW_HDMI) += dw_hdmi.o
-
+obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o
 obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
 obj-${CONFIG_EXYNOS_FB} += exynos/
 obj-${CONFIG_VIDEO_ROCKCHIP} += rockchip/
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
new file mode 100644
index 00..035a9761b9
--- /dev/null
+++ b/drivers/video/simplefb.c
@@ -0,0 +1,71 @@
+/*
+ * (C) Copyright 2017 Rob Clark
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int simple_video_probe(struct udevice *dev)
+{
+   struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
+   struct video_priv *uc_priv = dev_get_uclass_priv(dev);
+   const void *blob = gd->fdt_blob;
+   const int node = dev_of_offset(dev);
+   const char *format;
+   fdt_addr_t base;
+   fdt_size_t size;
+
+   base = fdtdec_get_addr_size_auto_parent(blob, 
dev_of_offset(dev->parent),
+   node, "reg", 0, , false);
+   if (base == FDT_ADDR_T_NONE) {
+   debug("%s: Failed to decode memory region\n", __func__);
+   return -EINVAL;
+   }
+
+   debug("%s: base=%llx, size=%llu\n", __func__, base, size);
+
+   // TODO is there some way to reserve the framebuffer
+   // region so it isn't clobbered?
+   plat->base = base;
+   plat->size = size;
+
+   video_set_flush_dcache(dev, true);
+
+   debug("%s: Query resolution...\n", __func__);
+
+   uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
+   uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
+   uc_priv->rot = 0;
+
+   format = fdt_getprop(blob, node, "format", NULL);
+   debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, 
format);
+
+   if (strcmp(format, "r5g6b5") == 0) {
+   uc_priv->bpix = VIDEO_BPP16;
+   } else if (strcmp(format, "a8b8g8r8") == 0) {
+   uc_priv->bpix = VIDEO_BPP32;
+   } else {
+   printf("%s: invalid format: %s\n", __func__, format);
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
+static const struct udevice_id simple_video_ids[] = {
+   { .compatible = "simple-framebuffer" },
+   { }
+};
+
+U_BOOT_DRIVER(simple_video) = {
+   .name   = "simple_video",
+   .id = UCLASS_VIDEO,
+   .of_match = simple_video_ids,
+   .probe  = simple_video_probe,
+   .flags  = DM_FLAG_PRE_RELOC,
+};
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/3] video: add config option to skip framebuffer clear

2017-08-03 Thread Rob Clark
The use-case is that the thing that loaded u-boot already put a splash
image on screen.  And we want to preserve that until grub boot menu
takes over.

Signed-off-by: Rob Clark 
---
 drivers/video/Kconfig| 8 
 drivers/video/cfb_console.c  | 3 ++-
 drivers/video/video-uclass.c | 4 +++-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 8eb0359231..7b56b20344 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -98,6 +98,14 @@ config SYS_WHITE_ON_BLACK
 better in low-light situations or to reduce eye strain in some
 cases.
 
+config NO_FB_CLEAR
+   bool "Skip framebuffer clear"
+   help
+ If firmware (whatever loads u-boot) has already put a splash image
+ on screen, you might want to preserve it until whatever u-boots
+ loads takes over the screen.  This, for example, can be used to
+ keep splash image on screen until grub graphical boot menu starts.
+
 source "drivers/video/fonts/Kconfig"
 
 config VIDCONSOLE_AS_LCD
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index f54802052e..85fa5b0cae 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -2091,7 +2091,8 @@ static int cfg_video_init(void)
}
eorx = fgx ^ bgx;
 
-   video_clear();
+   if (!CONFIG_IS_ENABLED(NO_FB_CLEAR))
+   video_clear();
 
 #ifdef CONFIG_VIDEO_LOGO
/* Plot the logo and get start point of console */
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 3036e3a1f2..dfa39b0d1b 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -199,7 +199,9 @@ static int video_post_probe(struct udevice *dev)
 #else
priv->colour_bg = 0xff;
 #endif
-   video_clear(dev);
+
+   if (!CONFIG_IS_ENABLED(NO_FB_CLEAR))
+   video_clear(dev);
 
/*
 * Create a text console device. For now we always do this, although
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/3] dm: core: also parse chosen node

2017-08-03 Thread Rob Clark
This is the node that would contain, for example, the framebuffer setup
by an earlier stage.

Signed-off-by: Rob Clark 
---
 drivers/core/root.c | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index d691d6ff94..5e6b2da248 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -266,6 +266,26 @@ static int dm_scan_fdt_node(struct udevice *parent, const 
void *blob,
for (offset = fdt_first_subnode(blob, offset);
 offset > 0;
 offset = fdt_next_subnode(blob, offset)) {
+   ofnode node = offset_to_ofnode(offset);
+
+   /* "chosen" node isn't a device itself but may contain some: */
+   if (strcmp(ofnode_get_name(node), "chosen") == 0) {
+   dm_dbg("parsing subnodes of \"chosen\"\n");
+
+   for (node = ofnode_first_subnode(node);
+ofnode_valid(node);
+node = ofnode_next_subnode(node)) {
+   dm_dbg("subnode: %s\n", ofnode_get_name(node));
+   err = lists_bind_fdt(parent, node, NULL);
+   if (err && !ret) {
+   ret = err;
+   dm_dbg("%s: ret=%d\n", 
ofnode_get_name(node), ret);
+   }
+   }
+
+   continue;
+   }
+
if (pre_reloc_only &&
!dm_fdt_pre_reloc(blob, offset))
continue;
@@ -273,7 +293,7 @@ static int dm_scan_fdt_node(struct udevice *parent, const 
void *blob,
dm_dbg("   - ignoring disabled device\n");
continue;
}
-   err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL);
+   err = lists_bind_fdt(parent, node, NULL);
if (err && !ret) {
ret = err;
debug("%s: ret=%d\n", fdt_get_name(blob, offset, NULL),
-- 
2.13.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] armv8/ls1046a: RGMII PHY requires internal delay on Tx

2017-08-03 Thread York Sun
On 08/02/2017 11:01 PM, Madalin-cristian Bucur wrote:
>> -Original Message-
>> From: York Sun
>> Sent: Wednesday, August 02, 2017 11:36 PM
>> To: Madalin-cristian Bucur ; u-boot@lists.denx.de;
>> joe.hershber...@ni.com
>> Cc: Mingkai Hu 
>> Subject: Re: [PATCH 2/2] armv8/ls1046a: RGMII PHY requires internal delay
>> on Tx
>>
>> On 04/04/2017 04:44 AM, Madalin Bucur wrote:
>>> Signed-off-by: Madalin Bucur 
>>> ---
>>>drivers/net/fm/ls1046.c | 4 ++--
>>>1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/fm/ls1046.c b/drivers/net/fm/ls1046.c
>>> index bf4..6c91fb9 100644
>>> --- a/drivers/net/fm/ls1046.c
>>> +++ b/drivers/net/fm/ls1046.c
>>> @@ -72,12 +72,12 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
>>> if (port == FM1_DTSEC3)
>>> if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==
>>> FSL_CHASSIS2_RCWSR13_EC1_DTSEC3_RGMII)
>>> -   return PHY_INTERFACE_MODE_RGMII;
>>> +   return PHY_INTERFACE_MODE_RGMII_TXID;
>>>
>>> if (port == FM1_DTSEC4)
>>> if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC2) ==
>>> FSL_CHASSIS2_RCWSR13_EC2_DTSEC4_RGMII)
>>> -   return PHY_INTERFACE_MODE_RGMII;
>>> +   return PHY_INTERFACE_MODE_RGMII_TXID;
>>>
>>> /* handle SGMII, only MAC 2/5/6/9/10 available */
>>> switch (port) {
>>>
>>
>> I don't know what test you have run. This change breaks network on
>> LS1043ARDB FM1@DTSEC3.
>>
>> York
> 
> Hi York,
> 
> You're likely using an old kernel, if you move to one that has removed the
> hardcoded internal delay for RGMII [1] you'll notice that RGMII no longer
> works with the old u-boot and you need this patch. We're in this situation
> because someone decided to hardcode internal delay for RGMII mode [2] in the
> Linux RTL8211F PHY driver. Someone else hardcoded the PHY fixup in u-boot to
> RGMII instead of RGMII_TXID [3] to align to that initial mistake. The issue
> with this u-boot fixup is that it overwrites device tree information, so one
> cannot correct this from the dts.
> 

Madalin,

There may be some gap. With this change, network doesn't work under U-Boot.

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] U-boot 2017.07 not working on Raspberry Pi

2017-08-03 Thread Stephen Warren

On 08/03/2017 07:45 AM, Simon Glass wrote:
...

I'm not sure if we have a Raspberry Pi in a test farm anywhere. I
should be able to look next week if no one can figure these out
beforehand.


I thought that Tom had some Pis in his test farm?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rockchip: rk3288: fix EMMC_DIV_MASK definition in header

2017-08-03 Thread Philipp Tomsich
> It shoulb be '<<' instead of '<' for _MASK definition, fix it.
> 
> Signed-off-by: Ziyuan Xu 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/include/asm/arch-rockchip/cru_rk3288.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/3] rockchip: add u-boot specific dts for rk3368 based boards

2017-08-03 Thread Philipp Tomsich
> Device drivers like debug serial, dmc should be enabled before
> relocation, so add u-boot.dtsi files to contain devices that
> should be marked as dm-pre-reloc.
> 
> Signed-off-by: Andy Yan 
> Reviewed-by: Philipp Tomsich 
> ---
> 
>  arch/arm/dts/rk3368-geekbox-u-boot.dtsi | 35 
> +
>  arch/arm/dts/rk3368-px5-evb-u-boot.dtsi | 35 
> +
>  arch/arm/dts/rk3368-sheep-u-boot.dtsi   | 35 
> +
>  3 files changed, 105 insertions(+)
>  create mode 100644 arch/arm/dts/rk3368-geekbox-u-boot.dtsi
>  create mode 100644 arch/arm/dts/rk3368-px5-evb-u-boot.dtsi
>  create mode 100644 arch/arm/dts/rk3368-sheep-u-boot.dtsi
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rockchip: rk3288: fix EMMC_DIV_MASK definition in header

2017-08-03 Thread Philipp Tomsich
> It shoulb be '<<' instead of '<' for _MASK definition, fix it.
> 
> Signed-off-by: Ziyuan Xu 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/include/asm/arch-rockchip/cru_rk3288.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] dm: core: don't fail to iterate if first one fails to probe

2017-08-03 Thread Rob Clark
On Thu, Aug 3, 2017 at 11:24 AM, Simon Glass  wrote:
> Hi Rob,
>
> On 19 July 2017 at 10:53, Rob Clark  wrote:
>> On Thu, Jul 13, 2017 at 3:10 PM, Simon Glass  wrote:
>>> Hi Rob,
>>>
>>> On 21 June 2017 at 04:52, Rob Clark  wrote:
 On Wed, Jun 21, 2017 at 6:23 AM, Peter Robinson  
 wrote:
> On Tue, Jun 20, 2017 at 10:49 PM, Rob Clark  wrote:
>> efi_disk_register() would try to iterate all the blk devices.  But if
>> the first one in the list failed to probe, uclass_first_device() would
>> return NULL and no attempt would be made to register the remaining
>> devices.  Also uclass_next_device() needs the same fix.
>
> This looks related/similar to the "efi_loader: disk: iterate only over
> valid block devices" patch [1]
>

 hmm, I don't see uclass_first_device_check() which I guess must be
 part of another in-flight patch?  I don't mind too much *how* we fix
 it, as long as it works.  (Although it seems more sensible to just
 make uclass_first_device()/etc dtrt rather than introducing another
 function that actually works properly.. but that is only my $0.02)
>>>
>>> That patch is now in mainline. It was delayed for a release as I did
>>> not get any reviews and so wasn't sure if it was needed.
>>>
>>> I believe the common case is wanting to stop on error, since it means
>>> something is wrong. The case of continuing onto another device when
>>> the first one fails is unusual. We should always check return codes
>>> and return errors when something is wrong.
>>>
>>> I believe this case is happening because the device is removable and
>>> therefore returns an error. Is that right? If so then we should return
>>> a single error, such as -ENOMEDIUM so that the caller can ignore that
>>> error, or consider it OK.
>>
>> yes, iirc, the first one ended up being sd-card (which was removed)..
>> I'll have to check if driver is properly returning -ENOMEDIUM.  In
>> which case maybe the right thing to do is for the iterators skip over
>> just that single error code, since it isn't really an "unusual" error.
>
> OK that sounds better. Suppressing errors should be done with care.
>

fwiw, efi_loader in the mean time switched to
uclass_first_device_check().. so I guess we don't really need this
patch.  (I've dropped it for now since my stack of WIP patches is
pretty big already.)

BR,
-R
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/9] spl: dm: Make it possible for the SPL to pick its own DTB from a FIT

2017-08-03 Thread Simon Glass
(correcting Tom's address)

Hi Jean-Jacques,

I see that I have made comments on v1 but now v2 has been sent. Sorry
I was so late.

Can you please take a look at the comments on v1?

- Simon


On 3 August 2017 at 09:25, Simon Glass  wrote:
> Hi Jean-Jacques,
>
> On 20 July 2017 at 11:02, Jean-Jacques Hiblot  wrote:
>> Following the RFC, here is the series implementing the mechanism in a cleaner
>> way. The idea is that the SPL may take advantage of selecting its DTB from a
>> pool of available DTBs. To do that several DTBs are embedded in a compressed
>> FIT image appended at the end of the SPL. The patch is done in such way that
>> this mechanism can easilly be extended to other ways of loading the DTBs.
>>
>> changes since RFC:
>>  - split the RFC patch in several patches.
>>  - leverage work from Cooper Jr., Franklin (CONFIG_FIT_EMBED) as a big part
>>of the code is similar. Rename CONFIG_FIT_EMBED as CONFIG_MULTI_DTB_FIT
>>to prevent confusion with CONFIG_OF_EMBED.
>>  - use the default configuration if no match is provided by
>>board_fit_config_name_match(). note that this is generic not just for this
>>feature.
>>  - provide an option to not use dynamic memory allocation.
>>  - added a patch related to board detection on omap that's required to take
>>advantage of this feature.
>>
>>
>> Here are some numbers:
>>++
>>|  Size|delta |boot-time| delta  |
>>|  (bytes) |(bytes)   |(ms) | (ms)   |
>> +---+
>> | reference|  120185  |  |  1331   ||
>> +---+
>> | feature  |  |  | ||
>> | deactiVated  |  120185  |   0  |  1330   |  -1|
>> +---+
>> | 1 DTB   LZO  |  120208  |   2  |  1331   |  0 |
>> +---+
>> | 4 DTB   LZO  |  120810  |   625|  1336   |  5 |
>> +---+
>> | 4 DTB   LZO  |  |  | ||
>> | no malloc|  120746  |   561|  1343   |  12|
>> +---+
>> | 4 DTB   GZIP |  128552  |   8367   |  1353   |  22|
>> +---+
>> | 4 DTB   No comp  |  132352  |   12167  |  1351   |  20|
>> +--+--+--+-++
>>
>
> Can this information and usage instructions (e.g. how to create the
> FIT with a .its example) go in a README somewhere please?
>
>>
>>
>> Jean-Jacques Hiblot (9):
>>   dts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts
>> Kconfig
>>   fit: use 'const' for the input of fdt_offset() and locate_dtb_in_fit()
>>   fit: fixed bug in locate_dtb_in_fit()
>>   fit: If no matching config is found in fit_find_config_node(), use the
>> default one
>>   lzo: add a function to check the validity of the header
>>   gzip: add a function to parse the header
>>   lib: allow building lzo and gunzip for the SPL
>>   spl: dm: Make it possible for the SPL to pick its own DTB from a FIT
>>   omap: detect board before spl_early_init()
>>
>>  Makefile|  2 +-
>>  arch/arm/mach-omap2/hwinit-common.c |  4 +-
>>  board/ti/ks2_evm/board_k2e.c|  2 +-
>>  board/ti/ks2_evm/board_k2g.c|  2 +-
>>  board/ti/ks2_evm/board_k2hk.c   |  2 +-
>>  board/ti/ks2_evm/board_k2l.c|  2 +-
>>  common/Kconfig  | 16 ---
>>  common/Makefile |  2 +-
>>  common/boot_fit.c   |  6 +--
>>  common/common_fit.c | 20 
>>  configs/k2e_evm_defconfig   |  2 +-
>>  configs/k2g_evm_defconfig   |  2 +-
>>  configs/k2hk_evm_defconfig  |  2 +-
>>  configs/k2l_evm_defconfig   |  2 +-
>>  dts/Kconfig | 96 
>> -
>>  include/boot_fit.h  |  4 +-
>>  include/common.h|  1 +
>>  include/linux/lzo.h |  3 ++
>>  lib/Kconfig | 11 +
>>  lib/Makefile|  6 +--
>>  lib/fdtdec.c| 85 
>>  lib/gunzip.c| 15 --
>>  lib/lzo/lzo1x_decompress.c  | 21 ++--
>>  scripts/Makefile.spl| 35 +-
>>  24 files changed, 290 insertions(+), 53 deletions(-)
>>
>> --
>> 1.9.1
>>
>
> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de

Re: [U-Boot] [U-Boot, 1/3] rockchip: add u-boot specific dts for rk3368 based boards

2017-08-03 Thread Philipp Tomsich
> Device drivers like debug serial, dmc should be enabled before
> relocation, so add u-boot.dtsi files to contain devices that
> should be marked as dm-pre-reloc.
> 
> Signed-off-by: Andy Yan 
> ---
> 
>  arch/arm/dts/rk3368-geekbox-u-boot.dtsi | 35 
> +
>  arch/arm/dts/rk3368-px5-evb-u-boot.dtsi | 35 
> +
>  arch/arm/dts/rk3368-sheep-u-boot.dtsi   | 35 
> +
>  3 files changed, 105 insertions(+)
>  create mode 100644 arch/arm/dts/rk3368-geekbox-u-boot.dtsi
>  create mode 100644 arch/arm/dts/rk3368-px5-evb-u-boot.dtsi
>  create mode 100644 arch/arm/dts/rk3368-sheep-u-boot.dtsi
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] board: pm9261: Update to support DT and DM

2017-08-03 Thread Simon Glass
On 21 July 2017 at 03:04, Wenyou Yang  wrote:
> Add the dts files to support deivce tree, update the configuration
> files to support the device tree and driver model. The peripheral
> clock and pins configuration are handled by the clock and the pinctrl
> drivers respectively.
>
> Signed-off-by: Wenyou Yang 
> ---
> The patch is based on
> [PATCH] board: at91sam9261ek: Update to support DT and DM
> https://lists.denx.de/pipermail/u-boot/2017-July/298885.html
>
>  board/ronetix/pm9261/Makefile |  2 +-
>  board/ronetix/pm9261/pm9261.c | 19 ++-
>  configs/pm9261_defconfig  | 19 +++
>  include/configs/pm9261.h  | 35 +++
>  4 files changed, 29 insertions(+), 46 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 5/9] lzo: add a function to check the validity of the header

2017-08-03 Thread Simon Glass
On 20 July 2017 at 11:02, Jean-Jacques Hiblot  wrote:
> Signed-off-by: Jean-Jacques Hiblot 
> ---
>  include/linux/lzo.h|  3 +++
>  lib/lzo/lzo1x_decompress.c | 21 +
>  2 files changed, 20 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/9] fit: use 'const' for the input of fdt_offset() and locate_dtb_in_fit()

2017-08-03 Thread Simon Glass
On 20 July 2017 at 11:02, Jean-Jacques Hiblot  wrote:
> Those 2 functions don't modify their input, we can mark it const.
> This prevents compilation warnings when they are provided const input.
>
> Signed-off-by: Jean-Jacques Hiblot 
> ---
>  common/boot_fit.c  | 4 ++--
>  include/boot_fit.h | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>

Reviewed-by: Simon Glass 

Please see below.

> diff --git a/common/boot_fit.c b/common/boot_fit.c
> index 51440a6..6fdf019 100644
> --- a/common/boot_fit.c
> +++ b/common/boot_fit.c
> @@ -13,7 +13,7 @@
>  #include 
>  #include 
>
> -int fdt_offset(void *fit)
> +int fdt_offset(const void *fit)
>  {
> int images, node, fdt_len, fdt_node, fdt_offset;
> const char *fdt_name;
> @@ -55,7 +55,7 @@ int fdt_offset(void *fit)
> return fdt_offset;
>  }
>
> -void *locate_dtb_in_fit(void *fit)
> +void *locate_dtb_in_fit(const void *fit)
>  {
> struct image_header *header;
> int size;
> diff --git a/include/boot_fit.h b/include/boot_fit.h
> index b7d2462..3d6996a 100644
> --- a/include/boot_fit.h
> +++ b/include/boot_fit.h
> @@ -5,5 +5,5 @@
>   * SPDX-License-Identifier: GPL-2.0+
>   */
>
> -int fdt_offset(void *fit);
> -void *locate_dtb_in_fit(void *fit);
> +int fdt_offset(const void *fit);
> +void *locate_dtb_in_fit(const void *fit);

Can you please add comments here for these two functions?

> --
> 1.9.1
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 9/9] omap: detect board before spl_early_init()

2017-08-03 Thread Simon Glass
On 20 July 2017 at 11:02, Jean-Jacques Hiblot  wrote:
> In order to be able to select the right DTB, we need to have identified the
> board before spl_early_init() is called.
>
> Signed-off-by: Jean-Jacques Hiblot 
> ---
>  arch/arm/mach-omap2/hwinit-common.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 7/9] lib: allow building lzo and gunzip for the SPL

2017-08-03 Thread Simon Glass
Hi Jean-Jacques,

On 20 July 2017 at 11:02, Jean-Jacques Hiblot  wrote:
> Signed-off-by: Jean-Jacques Hiblot 
> ---
>  lib/Kconfig  | 11 +++
>  lib/Makefile |  6 +++---
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 09670f0..434bf23 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -158,6 +158,17 @@ config LZMA
>
>  config LZO
> bool
> +
> +config SPL_LZO
> +   bool
> +
> +config SPL_GZIP
> +   bool
> +   select SPL_ZLIB
> +
> +config SPL_ZLIB
> +   bool

Please add help for these.

> +
>  endmenu
>
>  config ERRNO_STR
> diff --git a/lib/Makefile b/lib/Makefile
> index eacc7d6..21cd4e2 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -4,14 +4,15 @@
>  #
>  # SPDX-License-Identifier: GPL-2.0+
>  #
> +obj-$(CONFIG_$(SPL_)ZLIB) += zlib/
> +obj-$(CONFIG_$(SPL_)GZIP) += gunzip.o
> +obj-$(CONFIG_$(SPL_)LZO) += lzo/
>
>  ifndef CONFIG_SPL_BUILD
>
>  obj-$(CONFIG_EFI) += efi/
>  obj-$(CONFIG_EFI_LOADER) += efi_loader/
>  obj-$(CONFIG_LZMA) += lzma/
> -obj-$(CONFIG_LZO) += lzo/
> -obj-$(CONFIG_ZLIB) += zlib/
>  obj-$(CONFIG_BZIP2) += bzip2/
>  obj-$(CONFIG_TIZEN) += tizen/
>  obj-$(CONFIG_FIT) += libfdt/
> @@ -26,7 +27,6 @@ obj-y += crc16.o
>  obj-$(CONFIG_ERRNO_STR) += errno_str.o
>  obj-$(CONFIG_FIT) += fdtdec_common.o
>  obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
> -obj-$(CONFIG_GZIP) += gunzip.o
>  obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
>  obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
>  obj-y += initcall.o
> --
> 1.9.1
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] board: at91sam9260ek: Use SPI-flash-based AT45xxx DataFlash

2017-08-03 Thread Simon Glass
On 20 July 2017 at 23:40, Wenyou Yang  wrote:
> To support driver model and device tree, use the SPI-flash-based
> AT45xxx DataFlash driver, DataFlash is a kind of SPI flash.
> Instead of ATMEL_DATAFLASH_SPI DataFlash older driver that will
> be removed in the future.
>
> Signed-off-by: Wenyou Yang 
> ---
>
>  arch/arm/dts/at91sam9260.dtsi  |  1 +
>  arch/arm/dts/at91sam9260ek.dts |  2 +-
>  arch/arm/dts/at91sam9g20ek_common.dtsi |  2 +-
>  board/atmel/at91sam9260ek/at91sam9260ek.c  |  4 ---
>  configs/at91sam9260ek_dataflash_cs0_defconfig  |  7 
>  configs/at91sam9260ek_dataflash_cs1_defconfig  |  7 
>  configs/at91sam9260ek_nandflash_defconfig  |  7 
>  configs/at91sam9g20ek_2mmc_defconfig   |  7 
>  configs/at91sam9g20ek_2mmc_nandflash_defconfig |  7 
>  configs/at91sam9g20ek_dataflash_cs0_defconfig  |  7 
>  configs/at91sam9g20ek_dataflash_cs1_defconfig  |  7 
>  configs/at91sam9g20ek_nandflash_defconfig  |  7 
>  configs/at91sam9xeek_dataflash_cs0_defconfig   |  7 
>  configs/at91sam9xeek_dataflash_cs1_defconfig   |  7 
>  configs/at91sam9xeek_nandflash_defconfig   |  7 
>  include/configs/at91sam9260ek.h| 44 
> --
>  16 files changed, 94 insertions(+), 36 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] board: at91sam9263ek: Use SPI-flash-based AT45xxx DataFlash

2017-08-03 Thread Simon Glass
On 20 July 2017 at 23:40, Wenyou Yang  wrote:
> To support driver model and device tree, use the SPI-flash-based
> AT45xxx DataFlash driver, DataFlash is a kind of SPI flash.
> Instead of ATMEL_DATAFLASH_SPI DataFlash older driver that will
> be removed in the future.
>
> Signed-off-by: Wenyou Yang 
> ---
>
>  arch/arm/dts/at91sam9263.dtsi |  1 +
>  arch/arm/dts/at91sam9263ek.dts|  2 +-
>  board/atmel/at91sam9263ek/at91sam9263ek.c |  4 
>  configs/at91sam9263ek_dataflash_cs0_defconfig |  7 +++
>  configs/at91sam9263ek_dataflash_defconfig |  7 +++
>  configs/at91sam9263ek_nandflash_defconfig |  7 +++
>  configs/at91sam9263ek_norflash_boot_defconfig |  7 +++
>  configs/at91sam9263ek_norflash_defconfig  |  7 +++
>  include/configs/at91sam9263ek.h   | 21 +++--
>  9 files changed, 44 insertions(+), 19 deletions(-)

Reviewed-by: Simon Glass 

But note that CONFIG_ENV_IS_IN... options are now in Kconfig
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/9] fit: If no matching config is found in fit_find_config_node(), use the default one

2017-08-03 Thread Simon Glass
Hi Jean-Jacuqes,

On 20 July 2017 at 11:02, Jean-Jacques Hiblot  wrote:
> If board_fit_config_name_match() doesn't match any configuration node,
> then use the default one (if provided).
>
> Signed-off-by: Jean-Jacques Hiblot 
> ---
>  common/common_fit.c | 20 
>  1 file changed, 20 insertions(+)
>
> diff --git a/common/common_fit.c b/common/common_fit.c
> index 5f5f3f9..85b33d8 100644
> --- a/common/common_fit.c
> +++ b/common/common_fit.c
> @@ -32,6 +32,9 @@ int fit_find_config_node(const void *fdt)

Please add a full function comment to this function in image.h along
with your new feature.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] board: at91sam9rlek: Use SPI-flash-based AT45xxx DataFlash

2017-08-03 Thread Simon Glass
On 20 July 2017 at 23:40, Wenyou Yang  wrote:
> To support driver model and device tree, use the SPI-flash-based
> AT45xxx DataFlash driver, DataFlash is a kind of SPI flash.
> Instead of ATMEL_DATAFLASH_SPI DataFlash older driver that will
> be removed in the future.
>
> Signed-off-by: Wenyou Yang 
> ---
>
>  arch/arm/dts/at91sam9rl.dtsi |  1 +
>  board/atmel/at91sam9rlek/at91sam9rlek.c  |  3 ---
>  configs/at91sam9rlek_dataflash_defconfig |  7 +++
>  configs/at91sam9rlek_mmc_defconfig   |  7 +++
>  configs/at91sam9rlek_nandflash_defconfig |  7 +++
>  include/configs/at91sam9rlek.h   | 21 +++--
>  6 files changed, 29 insertions(+), 17 deletions(-)

Reviewed-by: Simon Glass 

CONFIG_ENV_IS_IN again
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/9] spl: dm: Make it possible for the SPL to pick its own DTB from a FIT

2017-08-03 Thread Simon Glass
Hi Jean-Jacques,

On 20 July 2017 at 11:02, Jean-Jacques Hiblot  wrote:
> Following the RFC, here is the series implementing the mechanism in a cleaner
> way. The idea is that the SPL may take advantage of selecting its DTB from a
> pool of available DTBs. To do that several DTBs are embedded in a compressed
> FIT image appended at the end of the SPL. The patch is done in such way that
> this mechanism can easilly be extended to other ways of loading the DTBs.
>
> changes since RFC:
>  - split the RFC patch in several patches.
>  - leverage work from Cooper Jr., Franklin (CONFIG_FIT_EMBED) as a big part
>of the code is similar. Rename CONFIG_FIT_EMBED as CONFIG_MULTI_DTB_FIT
>to prevent confusion with CONFIG_OF_EMBED.
>  - use the default configuration if no match is provided by
>board_fit_config_name_match(). note that this is generic not just for this
>feature.
>  - provide an option to not use dynamic memory allocation.
>  - added a patch related to board detection on omap that's required to take
>advantage of this feature.
>
>
> Here are some numbers:
>++
>|  Size|delta |boot-time| delta  |
>|  (bytes) |(bytes)   |(ms) | (ms)   |
> +---+
> | reference|  120185  |  |  1331   ||
> +---+
> | feature  |  |  | ||
> | deactiVated  |  120185  |   0  |  1330   |  -1|
> +---+
> | 1 DTB   LZO  |  120208  |   2  |  1331   |  0 |
> +---+
> | 4 DTB   LZO  |  120810  |   625|  1336   |  5 |
> +---+
> | 4 DTB   LZO  |  |  | ||
> | no malloc|  120746  |   561|  1343   |  12|
> +---+
> | 4 DTB   GZIP |  128552  |   8367   |  1353   |  22|
> +---+
> | 4 DTB   No comp  |  132352  |   12167  |  1351   |  20|
> +--+--+--+-++
>

Can this information and usage instructions (e.g. how to create the
FIT with a .its example) go in a README somewhere please?

>
>
> Jean-Jacques Hiblot (9):
>   dts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts
> Kconfig
>   fit: use 'const' for the input of fdt_offset() and locate_dtb_in_fit()
>   fit: fixed bug in locate_dtb_in_fit()
>   fit: If no matching config is found in fit_find_config_node(), use the
> default one
>   lzo: add a function to check the validity of the header
>   gzip: add a function to parse the header
>   lib: allow building lzo and gunzip for the SPL
>   spl: dm: Make it possible for the SPL to pick its own DTB from a FIT
>   omap: detect board before spl_early_init()
>
>  Makefile|  2 +-
>  arch/arm/mach-omap2/hwinit-common.c |  4 +-
>  board/ti/ks2_evm/board_k2e.c|  2 +-
>  board/ti/ks2_evm/board_k2g.c|  2 +-
>  board/ti/ks2_evm/board_k2hk.c   |  2 +-
>  board/ti/ks2_evm/board_k2l.c|  2 +-
>  common/Kconfig  | 16 ---
>  common/Makefile |  2 +-
>  common/boot_fit.c   |  6 +--
>  common/common_fit.c | 20 
>  configs/k2e_evm_defconfig   |  2 +-
>  configs/k2g_evm_defconfig   |  2 +-
>  configs/k2hk_evm_defconfig  |  2 +-
>  configs/k2l_evm_defconfig   |  2 +-
>  dts/Kconfig | 96 
> -
>  include/boot_fit.h  |  4 +-
>  include/common.h|  1 +
>  include/linux/lzo.h |  3 ++
>  lib/Kconfig | 11 +
>  lib/Makefile|  6 +--
>  lib/fdtdec.c| 85 
>  lib/gunzip.c| 15 --
>  lib/lzo/lzo1x_decompress.c  | 21 ++--
>  scripts/Makefile.spl| 35 +-
>  24 files changed, 290 insertions(+), 53 deletions(-)
>
> --
> 1.9.1
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] mtd: spi: sf_dataflash: Add print message while erase error

2017-08-03 Thread Simon Glass
On 20 July 2017 at 23:26, Wenyou Yang  wrote:
> Add the print message to tell us why the erase operation doesn't work.
>
> Signed-off-by: Wenyou Yang 
> ---
>
>  drivers/mtd/spi/sf_dataflash.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass 

In general I think it is bad to print messages in drivers. But we
don't really have a logging mechanism which we could use instead.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/9] dts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts Kconfig

2017-08-03 Thread Simon Glass
On 20 July 2017 at 11:02, Jean-Jacques Hiblot  wrote:

Commit message? Need to explain reason for the change.


> Signed-off-by: Jean-Jacques Hiblot 
> ---
>  Makefile  |  2 +-
>  board/ti/ks2_evm/board_k2e.c  |  2 +-
>  board/ti/ks2_evm/board_k2g.c  |  2 +-
>  board/ti/ks2_evm/board_k2hk.c |  2 +-
>  board/ti/ks2_evm/board_k2l.c  |  2 +-
>  common/Kconfig| 16 
>  common/Makefile   |  2 +-
>  configs/k2e_evm_defconfig |  2 +-
>  configs/k2g_evm_defconfig |  2 +-
>  configs/k2hk_evm_defconfig|  2 +-
>  configs/k2l_evm_defconfig |  2 +-
>  dts/Kconfig   | 20 +++-
>  lib/fdtdec.c  |  2 +-
>  13 files changed, 30 insertions(+), 28 deletions(-)
>

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] board: meesc: Update to support DT and DM

2017-08-03 Thread Simon Glass
On 21 July 2017 at 03:06, Wenyou Yang  wrote:
> Add the dts files to support deivce tree, update the configuration
> files to support the device tree and driver model. The peripheral
> clock and pins configuration are handled by the clock and the pinctrl
> drivers respectively.
>
> Signed-off-by: Wenyou Yang 
> ---
>
>  board/esd/meesc/meesc.c   |  8 
>  configs/meesc_dataflash_defconfig | 20 
>  configs/meesc_defconfig   | 20 +++-
>  include/configs/meesc.h   | 36 ++--
>  4 files changed, 45 insertions(+), 39 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] board: at91sam9261ek: Update to support DT and DM

2017-08-03 Thread Simon Glass
On 20 July 2017 at 23:28, Wenyou Yang  wrote:
> Add the dts files to support deivce tree, update the configuration
> files to support the device tree and driver model. The peripheral
> clock and pins configuration are handled by the clock and the pinctrl
> drivers respectively.
>
> Enable the early debug UART to debug problems when an ICE or other
> debug mechanism is not available.
>
> Signed-off-by: Wenyou Yang 
> ---
>
>  arch/arm/dts/Makefile |   2 +
>  arch/arm/dts/at91sam9261.dtsi | 151 ++
>  arch/arm/dts/at91sam9261ek.dts| 211 
> ++
>  arch/arm/mach-at91/Kconfig|   1 +
>  board/atmel/at91sam9261ek/Makefile|   2 +-
>  board/atmel/at91sam9261ek/at91sam9261ek.c |  22 ++-
>  configs/at91sam9261ek_dataflash_cs0_defconfig |  26 +++-
>  configs/at91sam9261ek_dataflash_cs3_defconfig |  26 +++-
>  configs/at91sam9261ek_nandflash_defconfig |  26 +++-
>  configs/at91sam9g10ek_dataflash_cs0_defconfig |  26 +++-
>  configs/at91sam9g10ek_dataflash_cs3_defconfig |  26 +++-
>  configs/at91sam9g10ek_nandflash_defconfig |  26 +++-
>  include/configs/at91sam9261ek.h   |  50 ++
>  13 files changed, 481 insertions(+), 114 deletions(-)
>  create mode 100644 arch/arm/dts/at91sam9261ek.dts

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


  1   2   >