[U-Boot] [PATCH] armv8: fsl-lsch2: disable ECC for sata on armv8 chassis 2 platforms

2017-01-23 Thread yuantian.tang
From: Tang Yuantian 

The Read DMA operations get early termination indication from the
controller. This issue is observed as CRC error in the status
registers. The issue is due to address collision at address 0 in
the dual port memory. The read is a dummy read to flush out the
header, but due to collision the controller logs the mbit error
reported by the ECC check logic. This results in the early termination
of the Read DMA operation by the controller. The issue happens to
all the interface speeds(GEN1/2/3) for all the products.

In order to enable SATA, ECC needs to be disabled by writing  the data
0x8000 to the address 0x20140520.

Signed-off-by: Tang Yuantian 
---
 arch/arm/cpu/armv8/fsl-layerscape/soc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c 
b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 9489f85..b54a937 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -233,10 +233,8 @@ int sata_init(void)
 {
struct ccsr_ahci __iomem *ccsr_ahci = (void *)CONFIG_SYS_SATA;
 
-#ifdef CONFIG_ARCH_LS1046A
/* Disable SATA ECC */
out_le32((void *)CONFIG_SYS_DCSR_DCFG_ADDR + 0x520, 0x8000);
-#endif
out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG);
out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG);
out_le32(&ccsr_ahci->axicc, AHCI_PORT_AXICC_CFG);
-- 
2.1.0.27.g96db324

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


Re: [U-Boot] [PATCH 3/9 v3] mmc: Add Marvell Xenon SDHCI controller driver

2017-01-23 Thread Stefan Roese

Hi Jaehoon,

On 24.01.2017 07:19, Jaehoon Chung wrote:

On 01/23/2017 07:52 PM, Stefan Roese wrote:

This driver implementes platform specific code for the Xenon SDHCI
controller which is integrated in the Marvell MVEBU Armada 37xx and
Armada 7k / 8K SoCs.

History:
This driver is ported from the Marvell U-Boot version 2015.01 which is
written by Victor Gu  with minor changes ported from
the Linux driver which is written by Ziji Hu .

Signed-off-by: Stefan Roese 
Cc: Jaehoon Chung 
Cc: Masahiro Yamada 


Reviewed-by: Jaehoon Chung 


Thanks. Will you pull the 3 patches (1/9 ... 3/9) via your mmc
repository? Or are you okay with me pushing them via the
Marvell repository?

Thanks,
Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 1/2] gpio: at91_gpio: Remove CPU_HAS_PIO3 macro

2017-01-23 Thread Wenyou Yang
The intention of this patch is the preparation to introduce
the pinctrl driver for AT91 PIO.

Use "union" to make the PIO3 and PIO2's registers be together
and make their offset aligned.

Signed-off-by: Wenyou Yang 
---

Changes in v4:
 - Fix the incomplete conversion of the peripheral configurations on
   the sama5d3, sam9x5, and sam9n12.

Changes in v3: None
Changes in v2: None

 arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c | 106 ++--
 arch/arm/mach-at91/arm926ejs/at91sam9x5_devices.c  | 112 ++---
 arch/arm/mach-at91/armv7/sama5d3_devices.c | 140 
 arch/arm/mach-at91/include/mach/at91_pio.h |  61 +++
 arch/arm/mach-at91/include/mach/at91sam9x5.h   |   1 -
 arch/arm/mach-at91/include/mach/sama5d3.h  |   1 -
 arch/arm/mach-at91/include/mach/sama5d4.h  |   1 -
 board/atmel/at91sam9n12ek/at91sam9n12ek.c  |  10 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c|  90 +--
 board/atmel/sama5d3xek/sama5d3xek.c|  64 
 board/atmel/sama5d4_xplained/sama5d4_xplained.c| 148 -
 board/atmel/sama5d4ek/sama5d4ek.c  | 136 
 board/denx/ma5d4evk/ma5d4evk.c | 178 ++---
 board/l+g/vinco/vinco.c|  70 
 drivers/gpio/at91_gpio.c   | 142 ++--
 15 files changed, 656 insertions(+), 604 deletions(-)

diff --git a/arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c 
b/arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c
index a03abfc310..28c8cf260a 100644
--- a/arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c
+++ b/arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c
@@ -18,45 +18,45 @@ unsigned int has_lcdc()
 
 void at91_serial0_hw_init(void)
 {
-   at91_set_a_periph(AT91_PIO_PORTA, 0, 1);/* TXD0 */
-   at91_set_a_periph(AT91_PIO_PORTA, 1, 0);/* RXD0 */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 0, 1);   /* TXD0 */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 1, 0);   /* RXD0 */
at91_periph_clk_enable(ATMEL_ID_USART0);
 }
 
 void at91_serial1_hw_init(void)
 {
-   at91_set_a_periph(AT91_PIO_PORTA, 5, 1);/* TXD1 */
-   at91_set_a_periph(AT91_PIO_PORTA, 6, 0);/* RXD1 */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 5, 1);   /* TXD1 */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 6, 0);   /* RXD1 */
at91_periph_clk_enable(ATMEL_ID_USART1);
 }
 
 void at91_serial2_hw_init(void)
 {
-   at91_set_a_periph(AT91_PIO_PORTA, 7, 1);/* TXD2 */
-   at91_set_a_periph(AT91_PIO_PORTA, 8, 0);/* RXD2 */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 7, 1);   /* TXD2 */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 8, 0);   /* RXD2 */
at91_periph_clk_enable(ATMEL_ID_USART2);
 }
 
 void at91_serial3_hw_init(void)
 {
-   at91_set_b_periph(AT91_PIO_PORTC, 22, 1);   /* TXD3 */
-   at91_set_b_periph(AT91_PIO_PORTC, 23, 0);   /* RXD3 */
+   at91_pio3_set_b_periph(AT91_PIO_PORTC, 22, 1);  /* TXD3 */
+   at91_pio3_set_b_periph(AT91_PIO_PORTC, 23, 0);  /* RXD3 */
at91_periph_clk_enable(ATMEL_ID_USART3);
 }
 
 void at91_seriald_hw_init(void)
 {
-   at91_set_a_periph(AT91_PIO_PORTA, 10, 1);   /* DTXD */
-   at91_set_a_periph(AT91_PIO_PORTA, 9, 0);/* DRXD */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 10, 1);  /* DTXD */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 9, 0);   /* DRXD */
at91_periph_clk_enable(ATMEL_ID_SYS);
 }
 
 #ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
-   at91_set_a_periph(AT91_PIO_PORTA, 11, 0);   /* SPI0_MISO */
-   at91_set_a_periph(AT91_PIO_PORTA, 12, 0);   /* SPI0_MOSI */
-   at91_set_a_periph(AT91_PIO_PORTA, 13, 0);   /* SPI0_SPCK */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 11, 0);  /* SPI0_MISO */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 12, 0);  /* SPI0_MOSI */
+   at91_pio3_set_a_periph(AT91_PIO_PORTA, 13, 0);  /* SPI0_SPCK */
 
at91_periph_clk_enable(ATMEL_ID_SPI0);
 
@@ -72,9 +72,9 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 
 void at91_spi1_hw_init(unsigned long cs_mask)
 {
-   at91_set_b_periph(AT91_PIO_PORTA, 21, 0);   /* SPI1_MISO */
-   at91_set_b_periph(AT91_PIO_PORTA, 22, 0);   /* SPI1_MOSI */
-   at91_set_b_periph(AT91_PIO_PORTA, 23, 0);   /* SPI1_SPCK */
+   at91_pio3_set_b_periph(AT91_PIO_PORTA, 21, 0);  /* SPI1_MISO */
+   at91_pio3_set_b_periph(AT91_PIO_PORTA, 22, 0);  /* SPI1_MOSI */
+   at91_pio3_set_b_periph(AT91_PIO_PORTA, 23, 0);  /* SPI1_SPCK */
 
at91_periph_clk_enable(ATMEL_ID_SPI1);
 
@@ -91,12 +91,12 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 
 void at91_mci_hw_init(void)
 {
- 

[U-Boot] [PATCH v4 2/2] pinctrl: at91: Add pinctrl driver

2017-01-23 Thread Wenyou Yang
AT91 PIO controller is a combined gpio-controller, pin-mux and
pin-config module. The peripheral's pins are assigned through
per-pin based muxing logic.

Each soc will have to describe the SoC limitation and pin
configuration via DT. This will allow to do not need to touch
the C code when adding new SoC if the IP version is supported.

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

Changes in v4: None
Changes in v3:
 - Add support for OUTPUT config

Changes in v2:
 - Add more information for the PINCTRL_AT91 option's help.
 - Add more comments for the callback of struct at91_pinctrl_mux_ops.
 - Use clrsetbits_le32() in set_drive_strength().
 - Add the brackets for readability.
 - Use debug() to print the message to debug, instead of printf().
 - Remove not veryuseful at91_bank_base().
 - Add Reviewed-by tag.

 arch/arm/mach-at91/include/mach/at91_pio.h |   6 +-
 drivers/pinctrl/Kconfig|  14 +
 drivers/pinctrl/Makefile   |   1 +
 drivers/pinctrl/pinctrl-at91.c | 453 +
 include/dt-bindings/pinctrl/at91.h |   2 +
 5 files changed, 475 insertions(+), 1 deletion(-)
 create mode 100644 drivers/pinctrl/pinctrl-at91.c

diff --git a/arch/arm/mach-at91/include/mach/at91_pio.h 
b/arch/arm/mach-at91/include/mach/at91_pio.h
index 393a163ce4..f195a7d38e 100644
--- a/arch/arm/mach-at91/include/mach/at91_pio.h
+++ b/arch/arm/mach-at91/include/mach/at91_pio.h
@@ -107,7 +107,11 @@ typedef struct at91_port {
u32 wpsr;   /* 0xE8 Write Protect Status Register */
u32 reserved11[5];  /* */
u32 schmitt;/* 0x100 Schmitt Trigger Register */
-   u32 reserved12[63];
+   u32 reserved12[4];  /* 0x104 ~ 0x110 */
+   u32 driver1;/* 0x114 I/O Driver Register1(AT91SAM9x5's 
driver1) */
+   u32 driver12;   /* 0x118 I/O Driver Register12(AT91SAM9x5's 
driver2 or SAMA5D3x's driver1 ) */
+   u32 driver2;/* 0x11C I/O Driver Register2(SAMA5D3x's 
driver2) */
+   u32 reserved13[12]; /* 0x120 ~ 0x14C */
 } at91_port_t;
 
 typedef union at91_pio {
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index efcb4c0003..106510c8f7 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -141,6 +141,20 @@ config ROCKCHIP_RK3288_PINCTRL
  definitions and pin control functions for each available multiplex
  function.
 
+config PINCTRL_AT91
+   bool "AT91 pinctrl driver"
+   depends on DM
+   help
+ This option is to enable the AT91 pinctrl driver for AT91 PIO
+ controller. AT91 PIO controller is a combined gpio-controller,
+ pin-mux and pin-config module. Each I/O pin may be dedicated as
+ a general-purpose I/O or be assigned to a function of an embedded
+ peripheral. Each I/O pin has a glitch filter providing rejection of
+ glitches lower than one-half of peripheral clock cycle and
+ a debouncing filter providing rejection of unwanted pulses from key
+ or push button operations. You can also control the multi-driver
+ capability, pull-up and pull-down feature on each I/O pin.
+
 config PINCTRL_AT91PIO4
bool "AT91 PIO4 pinctrl driver"
depends on DM
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index 512112af64..c461605cd8 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -5,6 +5,7 @@
 obj-y  += pinctrl-uclass.o
 obj-$(CONFIG_$(SPL_)PINCTRL_GENERIC)   += pinctrl-generic.o
 
+obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o
 obj-$(CONFIG_PINCTRL_AT91PIO4) += pinctrl-at91-pio4.o
 obj-y  += nxp/
 obj-$(CONFIG_ARCH_ATH79) += ath79/
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
new file mode 100644
index 00..904e1bdc68
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -0,0 +1,453 @@
+/*
+ * Atmel PIO pinctrl driver
+ *
+ * Copyright (C) 2016 Atmel Corporation
+ *   Wenyou.Yang 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define MAX_GPIO_BANKS 5
+#define MAX_NB_GPIO_PER_BANK   32
+
+#define MAX_PINMUX_ENTRIES 200
+
+struct at91_pinctrl_priv {
+   struct at91_port *reg_base[MAX_GPIO_BANKS];
+   u32 nbanks;
+};
+
+#define PULL_UPBIT(0)
+#define MULTI_DRIVEBIT(1)
+#define DEGLITCH   BIT(2)
+#define PULL_DOWN  BIT(3)
+#define DIS_SCHMIT BIT(4)
+#define DRIVE_STRENGTH_SHIFT   5
+#define DRIVE_STRENGTH_MASK0x3
+#define DRIVE_STRENGTH (DRIVE_STRENGTH_MASK << DRIVE_STRENGTH_SHIFT)
+#define OUTPUT BIT(7)
+#define OUTPUT_VAL_SHIFT   8
+#define OUTPUT_VAL (0x1 << OUTPUT_VAL_SHIFT)
+#define DEBOUNCE   B

[U-Boot] [PATCH v4 0/2] pinctrl: at91: Add pinctrl driver

2017-01-23 Thread Wenyou Yang
The purpose of this patch set is to add the pinctrl driver for AT91
PIO controller.

Changes in v4:
 - Fix the incomplete conversion of the peripheral configurations on
   the sama5d3, sam9x5, and sam9n12.

Changes in v3:
 - Add support for OUTPUT config

Changes in v2:
 - Add more information for the PINCTRL_AT91 option's help.
 - Add more comments for the callback of struct at91_pinctrl_mux_ops.
 - Use clrsetbits_le32() in set_drive_strength().
 - Add the brackets for readability.
 - Use debug() to print the message to debug, instead of printf().
 - Remove not veryuseful at91_bank_base().
 - Add Reviewed-by tag.

Wenyou Yang (2):
  gpio: at91_gpio: Remove CPU_HAS_PIO3 macro
  pinctrl: at91: Add pinctrl driver

 arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c | 106 ++---
 arch/arm/mach-at91/arm926ejs/at91sam9x5_devices.c  | 112 ++---
 arch/arm/mach-at91/armv7/sama5d3_devices.c | 140 +++
 arch/arm/mach-at91/include/mach/at91_pio.h |  67 +--
 arch/arm/mach-at91/include/mach/at91sam9x5.h   |   1 -
 arch/arm/mach-at91/include/mach/sama5d3.h  |   1 -
 arch/arm/mach-at91/include/mach/sama5d4.h  |   1 -
 board/atmel/at91sam9n12ek/at91sam9n12ek.c  |  10 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c|  90 ++--
 board/atmel/sama5d3xek/sama5d3xek.c|  64 +--
 board/atmel/sama5d4_xplained/sama5d4_xplained.c| 148 +++
 board/atmel/sama5d4ek/sama5d4ek.c  | 136 +++
 board/denx/ma5d4evk/ma5d4evk.c | 178 
 board/l+g/vinco/vinco.c|  70 ++--
 drivers/gpio/at91_gpio.c   | 142 +--
 drivers/pinctrl/Kconfig|  14 +
 drivers/pinctrl/Makefile   |   1 +
 drivers/pinctrl/pinctrl-at91.c | 453 +
 include/dt-bindings/pinctrl/at91.h |   2 +
 19 files changed, 1131 insertions(+), 605 deletions(-)
 create mode 100644 drivers/pinctrl/pinctrl-at91.c

-- 
2.11.0

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


Re: [U-Boot] [PATCH 1/9] mmc: sdhci: Clear SDHCI_CLOCK_CONTROL before configuring the new value

2017-01-23 Thread Jaehoon Chung
On 01/19/2017 04:39 PM, Stefan Roese wrote:
> This patch completely clears the SDHCI_CLOCK_CONTROL register before the
> new value is configured instead of just clearing the 2 bits
> SDHCI_CLOCK_CARD_EN and SDHCI_CLOCK_INT_EN. Without this change, some
> clock configurations will lead to the "Internal clock never stabilised."
> error message on the Xenon SDHCI controller used on the Marvell Armada
> 3700 and 7k/8k ARM64 SoCs.
> 
> The Linux SDHCI core driver also writes 0 to this register before
> the new value is configured. So this patch simplifies the driver a bit
> and brings the U-Boot driver more in-line with the Linux one.
> 
> Signed-off-by: Stefan Roese 
> Cc: Jaehoon Chung 
> Cc: Siva Durga Prasad Paladugu 
> Cc: Michal Simek 

Reviewed-by: Jaehoon Chung 

> ---
>  drivers/mmc/sdhci.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 5b404ff4a3..081b014a17 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -295,7 +295,7 @@ static int sdhci_send_command(struct mmc *mmc, struct 
> mmc_cmd *cmd,
>  static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
>  {
>   struct sdhci_host *host = mmc->priv;
> - unsigned int div, clk = 0, timeout, reg;
> + unsigned int div, clk = 0, timeout;
>  
>   /* Wait max 20 ms */
>   timeout = 200;
> @@ -311,9 +311,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int 
> clock)
>   udelay(100);
>   }
>  
> - reg = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> - reg &= ~(SDHCI_CLOCK_CARD_EN | SDHCI_CLOCK_INT_EN);
> - sdhci_writew(host, reg, SDHCI_CLOCK_CONTROL);
> + sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
>  
>   if (clock == 0)
>   return 0;
> 

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


Re: [U-Boot] [PATCH v4 10/17] dm: mmc: rpi: Convert Raspberry Pi to driver model for MMC

2017-01-23 Thread Jaehoon Chung
On 01/20/2017 11:07 PM, Simon Glass wrote:
> Convert the bcm2835 SDHCI driver over to support CONFIG_DM_MMC and move
> all boards over. There is no need to keep the old code since there are no
> other users.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> 
> Changes in v4: None
> Changes in v3: None
> 
>  board/raspberrypi/rpi/rpi.c | 13 
>  configs/rpi_2_defconfig |  1 +
>  configs/rpi_3_32b_defconfig |  1 +
>  configs/rpi_3_defconfig |  1 +
>  configs/rpi_defconfig   |  1 +
>  drivers/mmc/bcm2835_sdhci.c | 81 
> -
>  6 files changed, 69 insertions(+), 29 deletions(-)
> 
> diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
> index dd318df72b2..3d44cd4e55d 100644
> --- a/board/raspberrypi/rpi/rpi.c
> +++ b/board/raspberrypi/rpi/rpi.c
> @@ -454,19 +454,6 @@ int board_init(void)
>   return bcm2835_power_on_module(BCM2835_MBOX_POWER_DEVID_USB_HCD);
>  }
>  
> -int board_mmc_init(bd_t *bis)
> -{
> - int ret;
> -
> - bcm2835_power_on_module(BCM2835_MBOX_POWER_DEVID_SDHCI);
> -
> - ret = bcm2835_get_mmc_clock();
> - if (ret)
> - return ret;
> -
> - return bcm2835_sdhci_init(BCM2835_SDHCI_BASE, ret);
> -}
> -
>  int ft_board_setup(void *blob, bd_t *bd)
>  {
>   /*
> diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig
> index 090a0b07140..3d6f2a33377 100644
> --- a/configs/rpi_2_defconfig
> +++ b/configs/rpi_2_defconfig
> @@ -14,6 +14,7 @@ CONFIG_CMD_USB=y
>  # CONFIG_CMD_FPGA is not set
>  CONFIG_CMD_GPIO=y
>  CONFIG_OF_EMBED=y
> +CONFIG_DM_MMC=y
>  CONFIG_MMC_SDHCI=y
>  CONFIG_MMC_SDHCI_BCM2835=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig
> index 785bf21e9a3..ca0ef7afe74 100644
> --- a/configs/rpi_3_32b_defconfig
> +++ b/configs/rpi_3_32b_defconfig
> @@ -15,6 +15,7 @@ CONFIG_CMD_USB=y
>  # CONFIG_CMD_FPGA is not set
>  CONFIG_CMD_GPIO=y
>  CONFIG_OF_EMBED=y
> +CONFIG_DM_MMC=y
>  CONFIG_MMC_SDHCI=y
>  CONFIG_MMC_SDHCI_BCM2835=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig
> index 5ff8ed1cf2b..185a56c2807 100644
> --- a/configs/rpi_3_defconfig
> +++ b/configs/rpi_3_defconfig
> @@ -15,6 +15,7 @@ CONFIG_CMD_USB=y
>  # CONFIG_CMD_FPGA is not set
>  CONFIG_CMD_GPIO=y
>  CONFIG_OF_EMBED=y
> +CONFIG_DM_MMC=y
>  CONFIG_MMC_SDHCI=y
>  CONFIG_MMC_SDHCI_BCM2835=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig
> index 5d44f297267..89ecef8994e 100644
> --- a/configs/rpi_defconfig
> +++ b/configs/rpi_defconfig
> @@ -14,6 +14,7 @@ CONFIG_CMD_USB=y
>  # CONFIG_CMD_FPGA is not set
>  CONFIG_CMD_GPIO=y
>  CONFIG_OF_EMBED=y
> +CONFIG_DM_MMC=y
>  CONFIG_MMC_SDHCI=y
>  CONFIG_MMC_SDHCI_BCM2835=y
>  CONFIG_DM_ETH=y
> diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c
> index cb2bd40c65e..c96c35a9da4 100644
> --- a/drivers/mmc/bcm2835_sdhci.c
> +++ b/drivers/mmc/bcm2835_sdhci.c
> @@ -37,14 +37,23 @@
>   */
>  
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
> -#include 
> +#include 
> +#include 
>  #include 
> +#include 
>  
>  /* 400KHz is max freq for card ID etc. Use that as min */
>  #define MIN_FREQ 40
>  
> +struct bcm2835_sdhci_plat {
> + struct mmc_config cfg;
> + struct mmc mmc;
> +};
> +
>  struct bcm2835_sdhci_host {
>   struct sdhci_host host;
>   uint twoticks_delay;
> @@ -57,7 +66,7 @@ static inline struct bcm2835_sdhci_host *to_bcm(struct 
> sdhci_host *host)
>  }
>  
>  static inline void bcm2835_sdhci_raw_writel(struct sdhci_host *host, u32 val,
> - int reg)
> + int reg)
>  {
>   struct bcm2835_sdhci_host *bcm_host = to_bcm(host);
>  
> @@ -149,16 +158,33 @@ static const struct sdhci_ops bcm2835_ops = {
>   .read_b = bcm2835_sdhci_readb,
>  };
>  
> -int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq)
> +static int bcm2835_sdhci_bind(struct udevice *dev)
>  {
> - struct bcm2835_sdhci_host *bcm_host;
> - struct sdhci_host *host;
> + struct bcm2835_sdhci_plat *plat = dev_get_platdata(dev);
>  
> - bcm_host = calloc(1, sizeof(*bcm_host));
> - if (!bcm_host) {
> - printf("sdhci_host calloc fail!\n");
> - return -ENOMEM;
> + return sdhci_bind(dev, &plat->mmc, &plat->cfg);
> +}
> +
> +static int bcm2835_sdhci_probe(struct udevice *dev)
> +{
> + struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> + struct bcm2835_sdhci_plat *plat = dev_get_platdata(dev);
> + struct bcm2835_sdhci_host *priv = dev_get_priv(dev);
> + struct sdhci_host *host = &priv->host;
> + fdt_addr_t base;
> + int emmc_freq;
> + int ret;
> +
> + base = dev_get_addr(dev);
> + if (base == FDT_ADDR_T_NONE)
> + return -EINVAL;
> +
> + ret = bcm2835_get_mmc_clock();
> + if (ret < 0) {
> + debug(

[U-Boot] [PATCH] spi: atmel: check the GPIO validity before using cs_gpios

2017-01-23 Thread Wenyou Yang
Before using the cs_gpio, check if the GPIO is valid.

Signed-off-by: Wenyou Yang 
---

 drivers/spi/atmel_spi.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 7649114231..8d29f7c4eb 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -296,7 +296,8 @@ static void atmel_spi_cs_activate(struct udevice *dev)
struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
u32 cs = slave_plat->cs;
 
-   dm_gpio_set_value(&priv->cs_gpios[cs], 0);
+   if (dm_gpio_is_valid(&priv->cs_gpios[cs]))
+   dm_gpio_set_value(&priv->cs_gpios[cs], 0);
 }
 
 static void atmel_spi_cs_deactivate(struct udevice *dev)
@@ -306,7 +307,8 @@ static void atmel_spi_cs_deactivate(struct udevice *dev)
struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
u32 cs = slave_plat->cs;
 
-   dm_gpio_set_value(&priv->cs_gpios[cs], 1);
+   if (dm_gpio_is_valid(&priv->cs_gpios[cs]))
+   dm_gpio_set_value(&priv->cs_gpios[cs], 1);
 }
 
 static int atmel_spi_xfer(struct udevice *dev, unsigned int bitlen,
@@ -473,8 +475,11 @@ static int atmel_spi_probe(struct udevice *bus)
}
 
for(i = 0; i < ARRAY_SIZE(priv->cs_gpios); i++) {
-   dm_gpio_set_dir_flags(&priv->cs_gpios[i],
- GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
+   if (dm_gpio_is_valid(&priv->cs_gpios[i])) {
+   dm_gpio_set_dir_flags(&priv->cs_gpios[i],
+ GPIOD_IS_OUT |
+ GPIOD_IS_OUT_ACTIVE);
+   }
}
 
writel(ATMEL_SPI_CR_SWRST, &bus_plat->regs->cr);
-- 
2.11.0

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


Re: [U-Boot] [PATCH 2/9] mmc: sdhci: Add support for optional controller specific set_ios_post()

2017-01-23 Thread Jaehoon Chung
On 01/19/2017 04:39 PM, Stefan Roese wrote:
> Some SDHCI drivers might need to do some special controller configuration
> after the common clock set_ios() function has been called (speed / width
> configuration). This patch adds a call to the newly created function
> set_ios_port() when its configured in the host driver.
> 
> This will be used by the Xenon SDHCI controller driver used on the
> Marvell Armada 3700 and 7k/8k ARM64 SoCs.
> 
> Signed-off-by: Stefan Roese 
> Cc: Jaehoon Chung 
> Cc: Simon Glass 

Reviewed-by: Jaehoon Chung 

> ---
>  drivers/mmc/sdhci.c | 4 
>  include/sdhci.h | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 081b014a17..f34f565aeb 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -458,6 +458,10 @@ static int sdhci_set_ios(struct mmc *mmc)
>  
>   sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
>  
> + /* If available, call the driver specific "post" set_ios() function */
> + if (host->ops && host->ops->set_ios_post)
> + host->ops->set_ios_post(host);
> +
>   return 0;
>  }
>  
> diff --git a/include/sdhci.h b/include/sdhci.h
> index 7544b494b1..0cd4e59d67 100644
> --- a/include/sdhci.h
> +++ b/include/sdhci.h
> @@ -235,6 +235,7 @@ struct sdhci_ops {
>  #endif
>   int (*get_cd)(struct sdhci_host *host);
>   void(*set_control_reg)(struct sdhci_host *host);
> + void(*set_ios_post)(struct sdhci_host *host);
>   void(*set_clock)(struct sdhci_host *host, u32 div);
>  };
>  
> 

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


Re: [U-Boot] [linux-sunxi] Re: [RFC PATCH 08/11] sunxi: SPL: add FIT config selector for Pine64 boards

2017-01-23 Thread Icenowy Zheng

2017年1月24日 01:29于 Maxime Ripard 写道:
>
> On Sat, Jan 21, 2017 at 03:15:27PM +, André Przywara wrote: 
> > >>> On Fri, Jan 20, 2017 at 01:53:28AM +, Andre Przywara wrote:  
> >  For a board or platform to support FIT loading in the SPL, it has to 
> >  provide a board_fit_config_name_match() routine, which helps to select 
> >  one of possibly multiple DTBs contained in a FIT image. 
> >  Provide a simple function to cover the two different Pine64 models, 
> >  which can be easily told apart by looking at the amount of installed 
> >  RAM. 
> >  
> >  Signed-off-by: Andre Przywara  
> >  --- 
> >   board/sunxi/board.c | 13 + 
> >   1 file changed, 13 insertions(+) 
> >  
> >  diff --git a/board/sunxi/board.c b/board/sunxi/board.c 
> >  index 5365638..826 100644 
> >  --- a/board/sunxi/board.c 
> >  +++ b/board/sunxi/board.c 
> >  @@ -726,3 +726,16 @@ int ft_board_setup(void *blob, bd_t *bd) 
> >   #endif 
> >   return 0; 
> >   } 
> >  + 
> >  +#ifdef CONFIG_SPL_LOAD_FIT 
> >  +int board_fit_config_name_match(const char *name) 
> >  +{ 
> >  +#ifdef CONFIG_MACH_SUN50I 
> >  + if ((gd->ram_size > 512 * 1024 * 1024)) 
> >  + return !strcmp(name, "sun50i-a64-pine64-plus"); 
> >  + else 
> >  + return !strcmp(name, "sun50i-a64-pine64"); 
> >  +#endif 
> >  + return -1; 
> >  +}  
> > >>> 
> > >>> That looks fishy. It means that any A64 board with CONFIG_SPL_LOAD_FIT 
> > >>> enabled will be considered a pine64 board?  
> > >> 
> > >> Yes, at least for now, because that's the only A64 board we officially 
> > >> support so far. 
> > >> And yes again, it is fishy. It is more a demo or a placeholder for now, 
> > >> because you _need_ an implementation of board_fit_config_name_match() 
> > >> once you enable CONFIG_SPL_LOAD_FIT. 
> > >> 
> > >> One solution would be to have only one DTB supported per build, so 
> > >> board_fit_config_name_match() always returns 0. 
> > >> 
> > >> Another (better) solution would be to store the board name in the SPL 
> > >> header, which could be done later when flashing the image. Then this 
> > >> function would just return strcmp(name, spl_header_name) or 0 if no name 
> > >> is found for whatever reason. 
> > > 
> > > Yes, this is a good solution in the case if we have some non-removable 
> > > storage on the board (SPI NOR flash, NAND, EEPROM or something else). 
> > > We can discuss it separately. 
> > 
> > I totally agree. I rebased your patch to latest mainline already and 
> > will send out something later. 
> > 
> > > But the current generation of Pine64 boards don't have any 
> > > non-removable storage yet. My understanding is that you tried to 
> > > provide the DTB selection, which is based on circumstantial evidences, 
> > > such as the RAM size. IMHO this is also a valid selection method, 
> > > because it can reduce the number of required OS image variants. 
> > 
> > Yes, the point is that for U-Boot's purposes the only difference between 
> > the Pine64 and Pine64+ (apart from DRAM size, which is autodetected) is 
> > using MII vs. RGMII for the Ethernet PHY. The sun8i_emac driver gets 
> > this information from the DT only, so there is no point at all for 
> > different defconfigs. And the DRAM size is a safe indicator for that 
> > difference, at least if we confine our view to Pine64 boards. 
> > 
> > Now how other boards fit in here is a separate discussion IMO, so let's 
> > solve one problem after the other. 
> > I just thought that we could use: 
> > 
> > #ifdef CONFIG_SPL_LOAD_FIT 
> > int board_fit_config_name_match(const char *name) 
> > { 
> > return strcmp(name, CONFIG_DEFAULT_DEVICE_TREE); 
> > } 
> > #endif 
>
> I guess an easy way around this would be to add a Kconfig option for 
> the pine64, like I tried to do for the CHIP (but never ended up 
> merging). That way, at least we won't impact the other board, and we 
> can have that default. 

For every alike, SPL-compatible, easily-detectable board groups?

>
> Maxime 
>
> -- 
> Maxime Ripard, Free Electrons 
> Embedded Linux and Kernel engineering 
> http://free-electrons.com 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "linux-sunxi" group. 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to linux-sunxi+unsubscr...@googlegroups.com. 
> For more options, visit https://groups.google.com/d/optout. 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 01/17] dm: mmc: Set up the MMC device when controller is probed

2017-01-23 Thread Jaehoon Chung
On 01/20/2017 11:07 PM, Simon Glass wrote:
> When an MMC controller is set up we should probe the device to find out
> what it is. This includes finding its capacity and reading its partition
> table.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> 
> Changes in v4: None
> Changes in v3: None
> 
>  drivers/mmc/mmc-uclass.c | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 2fe5d61e263..a5286541c1c 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -232,6 +232,15 @@ int mmc_unbind(struct udevice *dev)
>   return 0;
>  }
>  
> +#ifdef CONFIG_BLK
> +static int mmc_post_probe(struct udevice *dev)
> +{
> + struct mmc *mmc = mmc_get_mmc_dev(dev);
> +
> + return mmc_init(mmc);
> +}
> +#endif
> +
>  static int mmc_select_hwpart(struct udevice *bdev, int hwpart)
>  {
>   struct udevice *mmc_dev = dev_get_parent(bdev);
> @@ -273,4 +282,7 @@ UCLASS_DRIVER(mmc) = {
>   .name   = "mmc",
>   .flags  = DM_UC_FLAG_SEQ_ALIAS,
>   .per_device_auto_alloc_size = sizeof(struct mmc_uclass_priv),
> +#ifdef CONFIG_BLK
> + .post_probe = mmc_post_probe,
> +#endif
>  };
> 

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


Re: [U-Boot] [PATCH 3/9 v3] mmc: Add Marvell Xenon SDHCI controller driver

2017-01-23 Thread Jaehoon Chung
On 01/23/2017 07:52 PM, Stefan Roese wrote:
> This driver implementes platform specific code for the Xenon SDHCI
> controller which is integrated in the Marvell MVEBU Armada 37xx and
> Armada 7k / 8K SoCs.
> 
> History:
> This driver is ported from the Marvell U-Boot version 2015.01 which is
> written by Victor Gu  with minor changes ported from
> the Linux driver which is written by Ziji Hu .
> 
> Signed-off-by: Stefan Roese 
> Cc: Jaehoon Chung 
> Cc: Masahiro Yamada 

Reviewed-by: Jaehoon Chung 

Beset Regards,
Jaehoon Chung

> ---
> v3:
> - Removed unreferenced macros
> - Used BIT(x) consistantly
> - Removed unreferenced "wait" variable from xenon_mmc_phy_init()
> - Used SLOT_MASK(slot) instead of (1 << slot)
> - Moved init of host_caps and shifted it to the host struct
> - Removed "enable" parameter from multiple functions and made
>   them a disable or enable function instead
> - Used strncmp instead of strcmp
> 
> v2:
> - Renamed MMC_XENON_SDHCI to MMC_SDHCI_XENON as requested by Masahiro
>   for the new consistant MMC naming
> 
>  drivers/mmc/Kconfig   |  11 +
>  drivers/mmc/Makefile  |   1 +
>  drivers/mmc/xenon_sdhci.c | 589 
> ++
>  3 files changed, 601 insertions(+)
>  create mode 100644 drivers/mmc/xenon_sdhci.c
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index 9ed8da39ef..147e52d332 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -287,6 +287,17 @@ config MMC_SDHCI_SPEAR
>  
> If unsure, say N.
>  
> +config MMC_SDHCI_XENON
> + bool "SDHCI support for the Xenon SDHCI controller"
> + depends on MMC_SDHCI && DM_MMC && OF_CONTROL
> + help
> +   Support for Xenon SDHCI host controller on Marvell Armada 3700
> +   7k/8k ARM SoCs platforms
> +
> +   If you have a controller with this interface, say Y here.
> +
> +   If unsure, say N.
> +
>  config MMC_SDHCI_TEGRA
>   bool "SDHCI platform support for the Tegra SD/MMC Controller"
>   depends on TEGRA
> diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
> index 4dca09c955..6af7f79ff8 100644
> --- a/drivers/mmc/Makefile
> +++ b/drivers/mmc/Makefile
> @@ -68,6 +68,7 @@ obj-$(CONFIG_MMC_SDHCI_MV)  += mv_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_S5P)  += s5p_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_SPEAR)+= spear_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_TEGRA)+= tegra_mmc.o
> +obj-$(CONFIG_MMC_SDHCI_XENON)+= xenon_sdhci.o
>  
>  obj-$(CONFIG_MMC_SUNXI)  += sunxi_mmc.o
>  obj-$(CONFIG_MMC_UNIPHIER)   += uniphier-sd.o
> diff --git a/drivers/mmc/xenon_sdhci.c b/drivers/mmc/xenon_sdhci.c
> new file mode 100644
> index 00..f36b482288
> --- /dev/null
> +++ b/drivers/mmc/xenon_sdhci.c
> @@ -0,0 +1,589 @@
> +/*
> + * Driver for Marvell SOC Platform Group Xenon SDHC as a platform device
> + *
> + * Copyright (C) 2016 Marvell, All Rights Reserved.
> + *
> + * Author:   Victor Gu 
> + * Date: 2016-8-24
> + *
> + * Included parts of the Linux driver version which was written by:
> + * Hu Ziji 
> + *
> + * Ported to from Marvell 2015.01 to mainline U-Boot 2017.01:
> + * Stefan Roese 
> + *
> + * SPDX-License-Identifier:  GPL-2.0
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +/* Register Offset of SD Host Controller SOCP self-defined register */
> +#define SDHC_SYS_CFG_INFO0x0104
> +#define SLOT_TYPE_SDIO_SHIFT 24
> +#define SLOT_TYPE_EMMC_MASK  0xFF
> +#define SLOT_TYPE_EMMC_SHIFT 16
> +#define SLOT_TYPE_SD_SDIO_MMC_MASK   0xFF
> +#define SLOT_TYPE_SD_SDIO_MMC_SHIFT  8
> +#define NR_SUPPORTED_SLOT_MASK   0x7
> +
> +#define SDHC_SYS_OP_CTRL 0x0108
> +#define AUTO_CLKGATE_DISABLE_MASKBIT(20)
> +#define SDCLK_IDLEOFF_ENABLE_SHIFT   8
> +#define SLOT_ENABLE_SHIFT0
> +
> +#define SDHC_SYS_EXT_OP_CTRL 0x010C
> +#define MASK_CMD_CONFLICT_ERROR  BIT(8)
> +
> +#define SDHC_SLOT_OP_STATUS_CTRL 0x0128
> +#define DELAY_90_DEGREE_MASK_EMMC5   BIT(7)
> +#define DELAY_90_DEGREE_SHIFT_EMMC5  7
> +#define EMMC_5_0_PHY_FIXED_DELAY_MASK0x7F
> +#define EMMC_PHY_FIXED_DELAY_MASK0xFF
> +#define EMMC_PHY_FIXED_DELAY_WINDOW_MIN  
> (EMMC_PHY_FIXED_DELAY_MASK >> 3)
> +#define SDH_PHY_FIXED_DELAY_MASK 0x1FF
> +#define SDH_PHY_FIXED_DELAY_WINDOW_MIN   
> (SDH_PHY_FIXED_DELAY_MASK >> 4)
> +
> +#define TUN_CONSECUTIVE_TIMES_SHIFT  16
> +#define TUN_CONSECUTIVE_TIMES_MASK   0x7
> +#define TUN_CONSECUTIVE_TIMES0x4
> +#define TUNING_STEP_SHIFT12
> +#define TUNING_STEP_MASK 0xF
> +#define TUNING_STEP_DIVIDER  BIT(6)
> +
> +

Re: [U-Boot] [PATCH] travis-ci: Add swig and libpython-dev to the package list

2017-01-23 Thread Heiko Schocher

Hello Tom,

Am 23.01.2017 um 23:40 schrieb Tom Rini:

As part of 1905c8fc711a we introduced failures depending on if swig and
libpython-dev are installed or not.  To provide coverage for this are of
code in the future ensure we have these packages installed.

Signed-off-by: Tom Rini 
---
  .travis.yml | 2 ++
  1 file changed, 2 insertions(+)


Thanks!

Reviewed-by: Heiko Schocher 

bye,
Heiko


diff --git a/.travis.yml b/.travis.yml
index 8024765c3ae3..48b7b101f1c6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,6 +19,8 @@ addons:
  - libsdl1.2-dev
  - python
  - python-virtualenv
+- swig
+- libpython-dev
  - gcc-powerpc-linux-gnu
  - gcc-arm-linux-gnueabihf
  - gcc-aarch64-linux-gnu



--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] tools: Correct python building host tools

2017-01-23 Thread Heiko Schocher

Hello Tom,

Am 23.01.2017 um 17:44 schrieb Tom Rini:

When we have python building tools for the host it will not check HOSTXX
variables but only XX variables, for example LDFLAGS and not
HOSTLDFLAGS.

Cc: Simon Glass 
Reported-by: Heiko Schocher 
Fixes: 1905c8fc711a ("build: Always build the libfdt python module")
Signed-off-by: Tom Rini 
---
  tools/Makefile | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)


Thanks! This fixes the build for the tqm5200 board.

Tested-by: Heiko Schocher 

bye,
Heiko


diff --git a/tools/Makefile b/tools/Makefile
index a609d058595b..cefcedf683ca 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -117,7 +117,8 @@ _libfdt.so-sharedobjs += $(LIBFDT_OBJS)
  libfdt:

  tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c
-   python $(srctree)/lib/libfdt/setup.py "$(_hostc_flags)" $^
+   LDFLAGS="$(HOSTLDFLAGS)" python $(srctree)/lib/libfdt/setup.py \
+   "$(_hostc_flags)" $^
mv _libfdt.so $@

  tools/libfdt_wrap.c: $(srctree)/lib/libfdt/libfdt.swig



--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RESEND V7 1/2] armv8/ls1043a: fixup GIC offset for ls1043a rev1

2017-01-23 Thread Wenbin song
The LS1043A rev1.1 silicon supports two types of GIC offset: 4K alignment
and 64K alignment. The bit SCFG_GIC400_ALIGN[GIC_ADDR_BIT] is used to choose
which offset will be used.

The LS1043A rev1.0 silicon only supports the CIG offset with 4K alignment.

If GIC_ADDR_BIT bit is set, 4K alignment is used, or else 64K alignment is used.
64K alignment is the default setting.

Overriding the weak smp_kick_all_cpus, the new impletment is able to detect
GIC offset.

The default GIC offset in kernel device tree is using 4K alignment, it
need to be fixed if 64K alignment is detected.

Signed-off-by: Wenbin Song 
Signed-off-by: Mingkai Hu 
---
Changes in v7:
Use the full SVR to check if a Soc needs the fix.
Use 4K alignment as the default alignment.
---
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig  |  4 ++
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c| 64 ++
 arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S   | 55 +--
 arch/arm/include/asm/arch-fsl-layerscape/config.h  | 24 
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  3 +-
 arch/arm/include/asm/arch-fsl-layerscape/soc.h |  1 +
 6 files changed, 146 insertions(+), 5 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index cc0dc88..cb24ce7 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -168,4 +168,8 @@ config SYS_FSL_DDR4
help
  Enable Freescale DDR4 controller.
 
+config HAS_FEATURE_GIC64K_ALIGN
+   bool
+   default y if ARCH_LS1043A
+
 endmenu
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index c10ccf9..3244a21 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -133,6 +133,67 @@ void fsl_fdt_disable_usb(void *blob)
}
 }
 
+#ifdef CONFIG_HAS_FEATURE_GIC64K_ALIGN
+static void fdt_fixup_gic(void *blob)
+{
+   int offset, err;
+   u64 reg[8];
+   struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+   unsigned int val;
+   struct ccsr_scfg __iomem *scfg = (void *)CONFIG_SYS_FSL_SCFG_ADDR;
+   int align_64k = 0;
+
+   val = gur_in32(&gur->svr);
+
+   if (SVR_SOC_VER(val) != SVR_LS1043A) {
+   align_64k = 1;
+   } else if (SVR_REV(val) != REV1_0) {
+   val = scfg_in32(&scfg->gic_align) & (0x01 << GIC_ADDR_BIT);
+   if (!val)
+   align_64k = 1;
+   }
+
+   offset = fdt_subnode_offset(blob, 0, "interrupt-controller@140");
+   if (offset < 0) {
+   printf("WARNING: fdt_subnode_offset can't find node %s: %s\n",
+  "interrupt-controller@140", fdt_strerror(offset));
+   return;
+   }
+
+   /* Fixup gic node align with 64K */
+   if (align_64k) {
+   reg[0] = cpu_to_fdt64(GICD_BASE_64K);
+   reg[1] = cpu_to_fdt64(GICD_SIZE_64K);
+   reg[2] = cpu_to_fdt64(GICC_BASE_64K);
+   reg[3] = cpu_to_fdt64(GICC_SIZE_64K);
+   reg[4] = cpu_to_fdt64(GICH_BASE_64K);
+   reg[5] = cpu_to_fdt64(GICH_SIZE_64K);
+   reg[6] = cpu_to_fdt64(GICV_BASE_64K);
+   reg[7] = cpu_to_fdt64(GICV_SIZE_64K);
+   } else {
+   /* Fixup gic node align with 4K */
+   reg[0] = cpu_to_fdt64(GICD_BASE);
+   reg[1] = cpu_to_fdt64(GICD_SIZE);
+   reg[2] = cpu_to_fdt64(GICC_BASE);
+   reg[3] = cpu_to_fdt64(GICC_SIZE);
+   reg[4] = cpu_to_fdt64(GICH_BASE);
+   reg[5] = cpu_to_fdt64(GICH_SIZE);
+   reg[6] = cpu_to_fdt64(GICV_BASE);
+   reg[7] = cpu_to_fdt64(GICV_SIZE);
+   }
+
+   err = fdt_setprop(blob, offset, "reg", reg, sizeof(reg));
+   if (err < 0) {
+   printf("WARNING: fdt_setprop can't set %s from node %s: %s\n",
+  "reg", "interrupt-controller@140",
+  fdt_strerror(err));
+   return;
+   }
+
+   return;
+}
+#endif
+
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
 #ifdef CONFIG_FSL_LSCH2
@@ -177,4 +238,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #endif
fsl_fdt_disable_usb(blob);
 
+#ifdef CONFIG_HAS_FEATURE_GIC64K_ALIGN
+   fdt_fixup_gic(blob);
+#endif
 }
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S 
b/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S
index 72f2c11..67c9636 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S
+++ b/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S
@@ -19,6 +19,53 @@
 #endif
 #include 
 
+/* Get GIC offset
+* For LS1043a rev1.0, GIC base address align with 4k.
+* For LS1043a rev1.1, if DCFG_GIC400_ALIGN[GIC_ADDR_BIT]
+* is set, GIC base address align with 4K, or else align
+* with 64k.
+* output:
+*  x0: the base address of GICD
+*  x1: the base address of 

[U-Boot] [RESEND V7 2/2] armv8/fsl-layerscape: fdt: fixup LS1043A rev1 MSI node

2017-01-23 Thread Wenbin song
The default MSI node in kernel tree is for LS1043A rev1.0 silicon,
if rev1.1 silicon used, need to fixup the MSI node to match it.

Signed-off-by: Wenbin Song 
Signed-off-by: Mingkai Hu 
---
Changes in v7:
Use a new MSI node on rev1.1.
---
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig |   3 +
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c   | 154 ++
 2 files changed, 157 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index cb24ce7..0941bf8 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -172,4 +172,7 @@ config HAS_FEATURE_GIC64K_ALIGN
bool
default y if ARCH_LS1043A
 
+config HAS_FEATURE_ENHANCED_MSI
+   bool
+   default y if ARCH_LS1043A
 endmenu
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 3244a21..4a1683a 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -194,6 +194,157 @@ static void fdt_fixup_gic(void *blob)
 }
 #endif
 
+#ifdef CONFIG_HAS_FEATURE_ENHANCED_MSI
+static int _fdt_fixup_msi_node(void *blob, const char *name,
+ int irq_0, int irq_1, int rev)
+{
+   int err, offset, len;
+   u32 tmp[4][3];
+   void *p;
+
+   offset = fdt_path_offset(blob, name);
+   if (offset < 0) {
+   printf("WARNING: fdt_path_offset can't find path %s: %s\n",
+  name, fdt_strerror(offset));
+   return 0;
+   }
+
+   /*fixup the property of interrupts*/
+
+   tmp[0][0] = cpu_to_fdt32(0x0);
+   tmp[0][1] = cpu_to_fdt32(irq_0);
+   tmp[0][2] = cpu_to_fdt32(0x4);
+
+   if (rev > REV1_0) {
+   tmp[1][0] = cpu_to_fdt32(0x0);
+   tmp[1][1] = cpu_to_fdt32(irq_1);
+   tmp[1][2] = cpu_to_fdt32(0x4);
+   tmp[2][0] = cpu_to_fdt32(0x0);
+   tmp[2][1] = cpu_to_fdt32(irq_1 + 1);
+   tmp[2][2] = cpu_to_fdt32(0x4);
+   tmp[3][0] = cpu_to_fdt32(0x0);
+   tmp[3][1] = cpu_to_fdt32(irq_1 + 2);
+   tmp[3][2] = cpu_to_fdt32(0x4);
+   len = sizeof(tmp);
+   } else {
+   len = sizeof(tmp[0]);
+   }
+
+   err = fdt_setprop(blob, offset, "interrupts", tmp, len);
+   if (err < 0) {
+   printf("WARNING: fdt_setprop can't set %s from node %s: %s\n",
+  "interrupts", name, fdt_strerror(err));
+   return 0;
+   }
+
+   /*fixup the property of reg*/
+   p = (char *)fdt_getprop(blob, offset, "reg", &len);
+   if (!p) {
+   printf("WARNING: fdt_getprop can't get %s from node %s\n",
+  "reg", name);
+   return 0;
+   }
+
+   memcpy((char *)tmp, p, len);
+
+   if (rev > REV1_0)
+   *((u32 *)tmp + 3) = cpu_to_fdt32(0x1000);
+   else
+   *((u32 *)tmp + 3) = cpu_to_fdt32(0x8);
+
+   err = fdt_setprop(blob, offset, "reg", tmp, len);
+   if (err < 0) {
+   printf("WARNING: fdt_setprop can't set %s from node %s: %s\n",
+  "reg", name, fdt_strerror(err));
+   return 0;
+   }
+
+   /*fixup the property of compatible*/
+   if (rev > REV1_0)
+   err = fdt_setprop_string(blob, offset, "compatible",
+"fsl,ls1043a-v1.1-msi");
+   else
+   err = fdt_setprop_string(blob, offset, "compatible",
+"fsl,ls1043a-msi");
+   if (err < 0) {
+   printf("WARNING: fdt_setprop can't set %s from node %s: %s\n",
+  "compatible", name, fdt_strerror(err));
+   return 0;
+   }
+
+   return 1;
+}
+
+static int _fdt_fixup_pci_msi(void *blob, const char *name, int rev)
+{
+   int offset, len, err;
+   void *p;
+   int val;
+   u32 tmp[4][8];
+
+   offset = fdt_path_offset(blob, name);
+   if (offset < 0) {
+   printf("WARNING: fdt_path_offset can't find path %s: %s\n",
+  name, fdt_strerror(offset));
+   return 0;
+   }
+
+   p = (char *)fdt_getprop(blob, offset, "interrupt-map", &len);
+   if (!p || len != sizeof(tmp)) {
+   printf("WARNING: fdt_getprop can't get %s from node %s\n",
+  "interrupt-map", name);
+   return 0;
+   }
+
+   memcpy((char *)tmp, p, len);
+
+   val = fdt32_to_cpu(tmp[0][6]);
+   if (rev > REV1_0) {
+   tmp[1][6] = cpu_to_fdt32(val + 1);
+   tmp[2][6] = cpu_to_fdt32(val + 2);
+   tmp[3][6] = cpu_to_fdt32(val + 3);
+   } else {
+   tmp[1][6] = cpu_to_fdt32(val);
+   tmp[2][6] = cpu_to_fdt32(val);
+   tmp[3][6] = cpu_to_fdt32(val);
+   }
+
+ 

Re: [U-Boot] [PATCH] mach-omap2: Cleanup secure boot media generation

2017-01-23 Thread Lokesh Vutla


On Monday 23 January 2017 11:04 PM, Andrew F. Davis wrote:
> Currently all secure media types of SPL are generated for all platforms,
> all platforms do not need all types, only generate the media types valid
> for each platform.

This fixed the build error on am57xx_hs_evm_defconfig.

Tested-by: Lokesh Vutla 

Thanks and regards,
Lokesh
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 03/11] Convert CONFIG_ARCH_EARLY_INIT_R to Kconfig

2017-01-23 Thread Tom Rini
On Tue, Jan 24, 2017 at 11:36:11AM +0900, Masahiro Yamada wrote:
> Hi Simon, Tom.
> 
> 2017-01-24 5:31 GMT+09:00 Simon Glass :
> > This converts the following to Kconfig:
> >CONFIG_ARCH_EARLY_INIT_R
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >  arch/Kconfig|  1 +
> >  arch/arc/include/asm/config.h   |  1 -
> >  arch/arm/Kconfig|  1 +
> >  arch/arm/cpu/armv8/fsl-layerscape/Kconfig   |  4 
> >  common/Kconfig  | 13 +
> >  configs/bayleybay_defconfig |  1 +
> >  configs/cougarcanyon2_defconfig |  1 +
> >  configs/dfi-bt700-q7x-151_defconfig |  1 +
> >  configs/efi-x86_defconfig   |  1 +
> >  configs/minnowmax_defconfig |  1 +
> >  configs/mvebu_db-88f3720_defconfig  |  1 +
> >  configs/mvebu_db-88f7040_defconfig  |  1 +
> >  configs/mvebu_db-88f8040_defconfig  |  1 +
> >  configs/qemu-x86_efi_payload32_defconfig|  1 +
> >  configs/qemu-x86_efi_payload64_defconfig|  1 +
> >  configs/rut_defconfig   |  1 +
> >  configs/theadorable-x86-dfi-bt700_defconfig |  1 +
> 
> I have some questions
> 
> [1] Is this a user-configurable symbol?
> 
> You use "select" in some places, but add it in defconfig in others.
> 
> This is controlling whether arch_early_init_r() is
> called from common/board_r.c or not, right?
> 
> Does it make sense to skip the init function
> if users want to?
> 
> Maybe, Tom will end up with converting all of them
> to "select" like this?
>  http://patchwork.ozlabs.org/patch/718315/

I will probably end up moving this to all select iff it ends up with no
size change.

> [2] How painful is it to use __weak function
> instead of CONFIG_ARCH_EARLY_INIT_R

For something that's only in U-Boot proper?  Probably not bad, but a
follow-up.

> [3] We have board_early_init_r() for board-specific
> init procedure.
> From its function name, I thought arch_early_init_r() is
> called for arch-specific (ARC, ARM, x86) init.
> In fact, it is not.
> ARC is good.  For ARM, x86, it is abused for board specific init.
> 
> For example,
> 
> board/siemens/rut/board.c
> 
> int arch_early_init_r(void)
> {
>   enable_lcd();
>   return 0;
> }
> 
> This is apparently board_init, not arch_init.

This is indeed problematic and partly why moving this to 'select' isn't
trivial as some of the locations of the functions make it unclear enough
if the right answer isn't instead to move this elsewhere.  My first
guess is that on 'rut' the LCD needs to be visible asap for the "it's
alive!" factor.

-- 
Tom


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


Re: [U-Boot] [PATCH 00/11] Move some init sequence options to Kconfig

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 01:31:16PM -0700, Simon Glass wrote:

> This series moves three common CONFIG options to Kconfig. They are
> somewhat tricky and I've had a hard time figuring out good Kconfig
> defaults, particularly for CONFIG_BOARD_EARLY_INIT_F. Hopefully the board
> maintainers can improve things.
> 
> It is build-tested and I've also checked it with 'buildman -sK. The only
> config changes are:
> 
> draco etamin pxm2 rastaban rut thuban :
>+ u-boot-spl.cfg: CONFIG_ARCH_MISC_INIT=1
>+ all: CONFIG_ARCH_MISC_INIT=1
> 
> and this is due to this option being defined in SPL (i.e. harmless).
> 
> A few patches are included to tidy up some other things I noticed along
> the way.

In general I prefer to keep the "tidy up" patches in a follow-up series
because the first set of tests I do is to make sure the changes are
size-neutral (or understand why).

No need to re-send this series, I can split it easily enough, JFYI.

-- 
Tom


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


Re: [U-Boot] [PATCH] bootz/booti: relocate ramdisk if CONFIG_SYS_BOOT_RAMDISK_HIGH set

2017-01-23 Thread Masahiro Yamada
2017-01-24 0:51 GMT+09:00 Cédric Schieli :
> In commit c2e7e72, the ramdisk relocation code was moved from
> image_setup_linux to do_bootm, leaving the bootz and booti cases broken.
>
> This patch fixes both by adding the BOOTM_STATE_RAMDISK state in their
> call to do_bootm_states if CONFIG_SYS_BOOT_RAMDISK_HIGH is set.
>
> Signed-off-by: Cédric Schieli 


Tested-by: Masahiro Yamada 

Thanks!



-- 
Best Regards
Masahiro Yamada
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 03/11] Convert CONFIG_ARCH_EARLY_INIT_R to Kconfig

2017-01-23 Thread Masahiro Yamada
Hi Simon, Tom.

2017-01-24 5:31 GMT+09:00 Simon Glass :
> This converts the following to Kconfig:
>CONFIG_ARCH_EARLY_INIT_R
>
> Signed-off-by: Simon Glass 
> ---
>
>  arch/Kconfig|  1 +
>  arch/arc/include/asm/config.h   |  1 -
>  arch/arm/Kconfig|  1 +
>  arch/arm/cpu/armv8/fsl-layerscape/Kconfig   |  4 
>  common/Kconfig  | 13 +
>  configs/bayleybay_defconfig |  1 +
>  configs/cougarcanyon2_defconfig |  1 +
>  configs/dfi-bt700-q7x-151_defconfig |  1 +
>  configs/efi-x86_defconfig   |  1 +
>  configs/minnowmax_defconfig |  1 +
>  configs/mvebu_db-88f3720_defconfig  |  1 +
>  configs/mvebu_db-88f7040_defconfig  |  1 +
>  configs/mvebu_db-88f8040_defconfig  |  1 +
>  configs/qemu-x86_efi_payload32_defconfig|  1 +
>  configs/qemu-x86_efi_payload64_defconfig|  1 +
>  configs/rut_defconfig   |  1 +
>  configs/theadorable-x86-dfi-bt700_defconfig |  1 +

I have some questions

[1] Is this a user-configurable symbol?

You use "select" in some places, but add it in defconfig in others.

This is controlling whether arch_early_init_r() is
called from common/board_r.c or not, right?

Does it make sense to skip the init function
if users want to?

Maybe, Tom will end up with converting all of them
to "select" like this?
 http://patchwork.ozlabs.org/patch/718315/


[2] How painful is it to use __weak function
instead of CONFIG_ARCH_EARLY_INIT_R


[3] We have board_early_init_r() for board-specific
init procedure.
>From its function name, I thought arch_early_init_r() is
called for arch-specific (ARC, ARM, x86) init.
In fact, it is not.
ARC is good.  For ARM, x86, it is abused for board specific init.

For example,

board/siemens/rut/board.c

int arch_early_init_r(void)
{
  enable_lcd();
  return 0;
}

This is apparently board_init, not arch_init.






-- 
Best Regards
Masahiro Yamada
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6] BOARD: MCCMON6: Provide support for iMX6q based mccmon6 board

2017-01-23 Thread Tom Rini
On Tue, Jan 24, 2017 at 12:43:11AM +0100, Lukasz Majewski wrote:

> This patch provides u-boot support for Liebherr (LWN) mccmon6 board.
[snip]
> +#define MACH_TYPE_WANDBOARD  4412
> +#define CONFIG_MACH_TYPE MACH_TYPE_WANDBOARD

Sorry for not spotting this part before.  This is just wrong.  This
isn't a wandboard, but I see you cribbed this from wandboard.h.  Please
drop this and make sure there's nothing else wandboard-centric that
crept in here.  Thanks!

-- 
Tom


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


Re: [U-Boot] [RFC PATCH 04/11] SPL: FIT: allow loading multiple images

2017-01-23 Thread André Przywara
On 23/01/17 02:49, Kever Yang wrote:
> Hi Andre,
> 
> On 01/22/2017 06:58 PM, André Przywara wrote:
>> On 22/01/17 07:08, Kever Yang wrote:
>>> Hi Andre,
>>>
>>>  Thanks for your patches, this is great help for enable ATF on
>>> U-Boot
>>> SPL.
>>> For ATF use case, we would like to identify which one is bl31 for we
>>> need to
>>> get entry point for it while we only need load address for other image.
>>> Any idea on get this information from different "loadables"?
>> So I thought this use case is covered by the current scheme?
>>
>> See below ...
>>
>>> On 01/20/2017 09:53 AM, Andre Przywara wrote:
 So far we were not using the FIT image format to its full potential:
 The SPL FIT loader was just loading the first image from the /images
 node plus one of the listed DTBs.
 Now with the refactored loader code it's easy to load an arbitrary
 number of images in addition to the two mentioned above.
 As described in the FIT image source file format description, iterate
 over all images listed at the "loadables" property in the configuration
 node and load every image at its desired location.
 This allows to load any kind of images:
 - firmware images to execute before U-Boot proper (for instance
 ARM Trusted Firmware (ATF))
 - firmware images for management processors (SCP, arisc, ...)
 - firmware images for devices like WiFi controllers
 - bit files for FPGAs
 - additional configuration data
 - kernels and/or ramdisks
 The actual usage of this feature would be platform and/or board
 specific.

 Signed-off-by: Andre Przywara 
 ---
common/spl/spl_fit.c | 27 +++
1 file changed, 27 insertions(+)

 diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
 index d4149c5..18269f7 100644
 --- a/common/spl/spl_fit.c
 +++ b/common/spl/spl_fit.c
 @@ -190,6 +190,7 @@ int spl_load_simple_fit(struct spl_image_info
 *spl_image,
struct spl_image_info image_info;
int node, images;
int base_offset, align_len = ARCH_DMA_MINALIGN - 1;
 +int index = 0;
  /*
 * Figure out where the external images start. This is the base
 for the
 @@ -234,6 +235,11 @@ int spl_load_simple_fit(struct spl_image_info
 *spl_image,
if (node < 0) {
debug("could not find firmware image, trying
 loadables...\n");
node = spl_fit_get_image_node(fit, images, "loadables", 0);
 +/*
 + * If we pick the U-Boot image from "loadables", start at
 + * the second image when later loading additional images.
 + */
 +index = 1;
}
if (node < 0) {
debug("%s: Cannot find u-boot image node: %d\n",
 @@ -259,5 +265,26 @@ int spl_load_simple_fit(struct spl_image_info
 *spl_image,
image_info.load_addr = spl_image->load_addr + spl_image->size;
spl_load_fit_image(info, sector, fit, base_offset, node,
 &image_info);
+/* Now check if there are more images for us to load */
 +for (; ; index++) {
 +node = spl_fit_get_image_node(fit, images, "loadables",
 index);
 +if (node < 0)
 +break;
 +
 +spl_load_fit_image(info, sector, fit, base_offset, node,
 +   &image_info);
 +
 +/*
 + * If the "firmware" image did not provide an entry point,
 + * use the first valid entry point from the loadables.
 + */
 +if (spl_image->entry_point == -1U &&
 +image_info.entry_point != -1U)
 +spl_image->entry_point = image_info.entry_point;
>> So this part here saves the entry point from the first image which
>> provides an "entry" property in the loadables section, given that
>> "firmware" didn't provide (a legal) one.
>>
>> So depending on what you want, these are the options:
>> a) You want to branch to U-Boot (default case if mkimage -f auto is
>> used): You either don't specify an explicit entry point at all or
>> provide an "entry" property for the U-Boot "firmware" image.
>> The code below at the end of this function takes care of this.
>> b) You want to branch to something else (bl31.bin): You make sure there
>> is no explicit entry point in "firmware", instead put one "entry"
>> property in the bl31 image description you want to boot. This will then
>> branch to that instead of U-Boot.
>> Check the example .its in patch 10/11 for an example of this.
>>
>> So does this fit for you? Or is there a problem with this?
> 
> So that means only one 'entry' can be present even if there are more
> than one image, right?

Well, there can be more nodes with entry properties, but the code just
takes the first one and ignores the others. Because logically there is
only one entry point after the SPL.

> I t

[U-Boot] [PATCH v6] BOARD: MCCMON6: Provide support for iMX6q based mccmon6 board

2017-01-23 Thread Lukasz Majewski
This patch provides u-boot support for Liebherr (LWN) mccmon6 board.

Signed-off-by: Lukasz Majewski 
---
Changes for v6:
- mccmon6_{nor|sd}_defconfigs created by using make savedefconfig

Changes for v5:
- Remove network configuration data from envs
- Clean up the envs - remove duplicated env variables

Changes for v4:
- Update board/liebherr/mccmon6/MAINTAINERS entry to quiet buildman warnings

Changes for v3:
- Define CONFIG_SYS_UBOOT_START to load u-boot image from NOR to correct address
  (so the SPL: NOR: Add CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE define to enable whole 
image copy from NOR
  can be dropped)
- Update author information

Changes for v2:
- Provide space after "quiet" console boot parameter to not pollute next
  parameters
---
This patch applies on mainline u-boot:
SHA1: 2d8d190c8394b43c0989cdb04a50cb48d4e1f8da
---
 arch/arm/cpu/armv7/mx6/Kconfig   |   5 +
 board/liebherr/mccmon6/Kconfig   |  12 +
 board/liebherr/mccmon6/MAINTAINERS   |   7 +
 board/liebherr/mccmon6/Makefile  |   8 +
 board/liebherr/mccmon6/mccmon6.c | 490 +++
 board/liebherr/mccmon6/mon6_imximage_nor.cfg |   9 +
 board/liebherr/mccmon6/mon6_imximage_sd.cfg  |   9 +
 board/liebherr/mccmon6/spl.c | 317 +
 configs/mccmon6_nor_defconfig|  33 ++
 configs/mccmon6_sd_defconfig |  34 ++
 include/configs/mccmon6.h| 324 ++
 11 files changed, 1248 insertions(+)
 create mode 100644 board/liebherr/mccmon6/Kconfig
 create mode 100644 board/liebherr/mccmon6/MAINTAINERS
 create mode 100644 board/liebherr/mccmon6/Makefile
 create mode 100644 board/liebherr/mccmon6/mccmon6.c
 create mode 100644 board/liebherr/mccmon6/mon6_imximage_nor.cfg
 create mode 100644 board/liebherr/mccmon6/mon6_imximage_sd.cfg
 create mode 100644 board/liebherr/mccmon6/spl.c
 create mode 100644 configs/mccmon6_nor_defconfig
 create mode 100644 configs/mccmon6_sd_defconfig
 create mode 100644 include/configs/mccmon6.h

diff --git a/arch/arm/cpu/armv7/mx6/Kconfig b/arch/arm/cpu/armv7/mx6/Kconfig
index c646966..9eddd7e 100644
--- a/arch/arm/cpu/armv7/mx6/Kconfig
+++ b/arch/arm/cpu/armv7/mx6/Kconfig
@@ -114,6 +114,10 @@ config TARGET_KOSAGI_NOVENA
bool "Kosagi Novena"
select SUPPORT_SPL
 
+config TARGET_MCCMON6
+   bool "mccmon6"
+   select SUPPORT_SPL
+
 config TARGET_MX6CUBOXI
bool "Solid-run mx6 boards"
select SUPPORT_SPL
@@ -327,6 +331,7 @@ source "board/phytec/pcm058/Kconfig"
 source "board/gateworks/gw_ventana/Kconfig"
 source "board/kosagi/novena/Kconfig"
 source "board/samtec/vining_2000/Kconfig"
+source "board/liebherr/mccmon6/Kconfig"
 source "board/seco/Kconfig"
 source "board/solidrun/mx6cuboxi/Kconfig"
 source "board/technexion/pico-imx6ul/Kconfig"
diff --git a/board/liebherr/mccmon6/Kconfig b/board/liebherr/mccmon6/Kconfig
new file mode 100644
index 000..4cc7fc2
--- /dev/null
+++ b/board/liebherr/mccmon6/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_MCCMON6
+
+config SYS_BOARD
+   default "mccmon6"
+
+config SYS_VENDOR
+   default "liebherr"
+
+config SYS_CONFIG_NAME
+   default "mccmon6"
+
+endif
diff --git a/board/liebherr/mccmon6/MAINTAINERS 
b/board/liebherr/mccmon6/MAINTAINERS
new file mode 100644
index 000..c9c7183
--- /dev/null
+++ b/board/liebherr/mccmon6/MAINTAINERS
@@ -0,0 +1,7 @@
+MCCMON6 BOARD
+M: Lukasz Majewski 
+S: Maintained
+F: board/liebherr/mccmon6/
+F: include/configs/mccmon6.h
+F: configs/mccmon6_nor_defconfig
+F: configs/mccmon6_sd_defconfig
diff --git a/board/liebherr/mccmon6/Makefile b/board/liebherr/mccmon6/Makefile
new file mode 100644
index 000..e37baf8
--- /dev/null
+++ b/board/liebherr/mccmon6/Makefile
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2016-2017
+# Lukasz Majewski, DENX Software Engineering, lu...@denx.de
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  := mccmon6.o spl.o
diff --git a/board/liebherr/mccmon6/mccmon6.c b/board/liebherr/mccmon6/mccmon6.c
new file mode 100644
index 000..eb5eae4
--- /dev/null
+++ b/board/liebherr/mccmon6/mccmon6.c
@@ -0,0 +1,490 @@
+/*
+ * Copyright (C) 2016-2017
+ * Lukasz Majewski, DENX Software Engineering, lu...@denx.de
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define UART_PAD_CTRL  (PAD_CTL_PUS_100K_UP |  \
+   PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
+   PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP |   \
+   PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \
+   PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |  \
+ 

Re: [U-Boot] [RFC PATCH 03/11] SPL: FIT: factor out spl_load_fit_image()

2017-01-23 Thread André Przywara
On 23/01/17 08:53, Lokesh Vutla wrote:

Hi Lokesh,

thanks a lot for having a thorough look at it!

>> On Friday 20 January 2017 07:23 AM, Andre Przywara wrote:
>> At the moment we load two images from a FIT image: the actual U-Boot
>> image and the DTB. Both times we have very similar code to deal with
>> alignment requirement the media we load from imposes upon us.
>> Factor out this code into a new function, which we just call twice.
>>
>> Signed-off-by: Andre Przywara 
>> ---
>>  common/spl/spl_fit.c | 122 
>> +--
>>  1 file changed, 51 insertions(+), 71 deletions(-)
>>
>> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
>> index 381ed1f..d4149c5 100644
>> --- a/common/spl/spl_fit.c
>> +++ b/common/spl/spl_fit.c
>> @@ -138,19 +138,58 @@ static int get_aligned_image_size(struct spl_load_info 
>> *info, int data_size,
>>  return (data_size + info->bl_len - 1) / info->bl_len;
>>  }
>>  
>> +static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
>> +  void *fit, ulong base_offset, int node,
>> +  struct spl_image_info *image_info)
>> +{
>> +ulong offset;
>> +size_t length;
>> +ulong load, entry;
>> +void *src;
>> +ulong overhead;
>> +int nr_sectors;
>> +
>> +offset = fdt_getprop_u32(fit, node, "data-offset") + base_offset;
>> +length = fdt_getprop_u32(fit, node, "data-size");
>> +load = fdt_getprop_u32(fit, node, "load");
>> +if (load == -1U && image_info)
>> +load = image_info->load_addr;
> 
> What if load_addr is not aligned with ARCH_DMA_MINALIGN like in case of
> DT loading (u-boot's load_addr + size cannot be always aligned with
> DMA). I keep getting this error when loading DT: "FAT: Misaligned buffer
> address (808675a0)."

Ah, good point, though I didn't encounter this error.

> Something similar is required to fix it:
> http://pastebin.ubuntu.com/23850970/

Yeah, looks like it. I try to bake this in an upcoming release.

>> +entry = fdt_getprop_u32(fit, node, "entry");
>> +
>> +overhead = get_aligned_image_overhead(info, offset);
>> +nr_sectors = get_aligned_image_size(info, overhead + length, offset);
>   
>  
> Need not add overhead here as get_aligned_image_size() takes care of
> adding overhead.

Right, I somehow got lost in translation here, probably during some
rebasing/refactoring.

>> +
>> +if (info->read(info, sector + get_aligned_image_offset(info, offset),
>> +   nr_sectors, (void*)load) != nr_sectors)
>> +return -EIO;
>> +debug("image: dst=%lx, offset=%lx, size=%lx\n", load, offset,
>> +  (unsigned long)length);
>> +
>> +src = (void *)load + overhead;
>> +#ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS
>> +board_fit_image_post_process(&src, &length);
>> +#endif
>> +
>> +memcpy((void*)load, src, length);
>> +
>> +if (image_info) {
>> +image_info->load_addr = load;
>> +image_info->size = length;
>> +image_info->entry_point = entry;
> 
> If entry_point is not provided can we default to load_addr?
> Existing U-Boot fit image generation does not provide entry option. So
> this patch alone breaks boot.(I understand that it is fixed in next
> patch but this is breaking git bisectability).

Good point, this is indeed a good idea.

Cheers,
Andre.

> Thanks and regards,
> Lokesh
> 
> 
>> +}
>> +
>> +return 0;
>> +}
>> +
>>  int spl_load_simple_fit(struct spl_image_info *spl_image,
>>  struct spl_load_info *info, ulong sector, void *fit)
>>  {
>>  int sectors;
>> -ulong size, load;
>> +ulong size;
>>  unsigned long count;
>> +struct spl_image_info image_info;
>>  int node, images;
>> -void *load_ptr;
>> -int fdt_offset, fdt_len;
>> -int data_offset, data_size;
>>  int base_offset, align_len = ARCH_DMA_MINALIGN - 1;
>> -int src_sector;
>> -void *dst, *src;
>>  
>>  /*
>>   * Figure out where the external images start. This is the base for the
>> @@ -202,82 +241,23 @@ int spl_load_simple_fit(struct spl_image_info 
>> *spl_image,
>>  return -1;
>>  }
>>  
>> -/* Get its information and set up the spl_image structure */
>> -data_offset = fdt_getprop_u32(fit, node, "data-offset");
>> -data_size = fdt_getprop_u32(fit, node, "data-size");
>> -load = fdt_getprop_u32(fit, node, "load");
>> -debug("data_offset=%x, data_size=%x\n", data_offset, data_size);
>> -spl_image->load_addr = load;
>> -spl_image->entry_point = load;
>> +/* Load the image and set up the spl_image structure */
>> +spl_load_fit_image(info, sector, fit, base_offset, node, spl_image);
>>  spl_image->os = IH_OS_U_BOOT;
>>  
>> -/*
>> - * Work out where to place the image. We read it so that the first
>> - * byte will be at 'load'. This

Re: [U-Boot] [RFC PATCH 08/11] sunxi: SPL: add FIT config selector for Pine64 boards

2017-01-23 Thread André Przywara
On 23/01/17 17:29, Maxime Ripard wrote:
> On Sat, Jan 21, 2017 at 03:15:27PM +, André Przywara wrote:
> On Fri, Jan 20, 2017 at 01:53:28AM +, Andre Przywara wrote:  
>> For a board or platform to support FIT loading in the SPL, it has to
>> provide a board_fit_config_name_match() routine, which helps to select
>> one of possibly multiple DTBs contained in a FIT image.
>> Provide a simple function to cover the two different Pine64 models,
>> which can be easily told apart by looking at the amount of installed
>> RAM.
>>
>> Signed-off-by: Andre Przywara 
>> ---
>>  board/sunxi/board.c | 13 +
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
>> index 5365638..826 100644
>> --- a/board/sunxi/board.c
>> +++ b/board/sunxi/board.c
>> @@ -726,3 +726,16 @@ int ft_board_setup(void *blob, bd_t *bd)
>>  #endif
>>  return 0;
>>  }
>> +
>> +#ifdef CONFIG_SPL_LOAD_FIT
>> +int board_fit_config_name_match(const char *name)
>> +{
>> +#ifdef CONFIG_MACH_SUN50I
>> +if ((gd->ram_size > 512 * 1024 * 1024))
>> +return !strcmp(name, "sun50i-a64-pine64-plus");
>> +else
>> +return !strcmp(name, "sun50i-a64-pine64");
>> +#endif
>> +return -1;
>> +}  
>
> That looks fishy. It means that any A64 board with CONFIG_SPL_LOAD_FIT
> enabled will be considered a pine64 board?  

 Yes, at least for now, because that's the only A64 board we officially
 support so far.
 And yes again, it is fishy. It is more a demo or a placeholder for now,
 because you _need_ an implementation of board_fit_config_name_match()
 once you enable CONFIG_SPL_LOAD_FIT.

 One solution would be to have only one DTB supported per build, so
 board_fit_config_name_match() always returns 0.

 Another (better) solution would be to store the board name in the SPL
 header, which could be done later when flashing the image. Then this
 function would just return strcmp(name, spl_header_name) or 0 if no name
 is found for whatever reason.
>>>
>>> Yes, this is a good solution in the case if we have some non-removable
>>> storage on the board (SPI NOR flash, NAND, EEPROM or something else).
>>> We can discuss it separately.
>>
>> I totally agree. I rebased your patch to latest mainline already and
>> will send out something later.
>>
>>> But the current generation of Pine64 boards don't have any
>>> non-removable storage yet. My understanding is that you tried to
>>> provide the DTB selection, which is based on circumstantial evidences,
>>> such as the RAM size. IMHO this is also a valid selection method,
>>> because it can reduce the number of required OS image variants.
>>
>> Yes, the point is that for U-Boot's purposes the only difference between
>> the Pine64 and Pine64+ (apart from DRAM size, which is autodetected) is
>> using MII vs. RGMII for the Ethernet PHY. The sun8i_emac driver gets
>> this information from the DT only, so there is no point at all for
>> different defconfigs. And the DRAM size is a safe indicator for that
>> difference, at least if we confine our view to Pine64 boards.
>>
>> Now how other boards fit in here is a separate discussion IMO, so let's
>> solve one problem after the other.
>> I just thought that we could use:
>>
>> #ifdef CONFIG_SPL_LOAD_FIT
>> int board_fit_config_name_match(const char *name)
>> {
>>  return strcmp(name, CONFIG_DEFAULT_DEVICE_TREE);
>> }
>> #endif
> 
> I guess an easy way around this would be to add a Kconfig option for
> the pine64, like I tried to do for the CHIP (but never ended up
> merging). That way, at least we won't impact the other board, and we
> can have that default.

Yes, that sounds indeed like a possibility.

I came up with this snippet yesterday (rough copy):

/* Check if there is a DT name stored in the SPL header and use that. */
if (spl->offset_default_dt_name) {
cmp_str = SPL_ADDR + spl->offset_default_dt_name;
} else {
#ifdef CONFIG_DEFAULT_DEVICE_TREE
cmp_str = CONFIG_DEFAULT_DEVICE_TREE;
#else
return 0;
#endif
};

/* Differentiate the two Pine64 board DTs by their DRAM size. */
if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) {
if ((gd->ram_size > 512 * 1024 * 1024))
return !strstr(name, "plus");
else
return !!strstr(name, "plus");
} else {
return strcmp(name, cmp_str);
}

That admittedly doesn't look very pretty, but should cover all the
cases: DT name from SPL header, default compile time DT, Pine64 check.
We could also guard the last part with a CONFIG_SUNXI_PINE64_DETECT
symbol to save some space in case this is not needed.

Does that make sense?

Cheers,
An

[U-Boot] [PATCH] travis-ci: Add swig and libpython-dev to the package list

2017-01-23 Thread Tom Rini
As part of 1905c8fc711a we introduced failures depending on if swig and
libpython-dev are installed or not.  To provide coverage for this are of
code in the future ensure we have these packages installed.

Signed-off-by: Tom Rini 
---
 .travis.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 8024765c3ae3..48b7b101f1c6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,6 +19,8 @@ addons:
 - libsdl1.2-dev
 - python
 - python-virtualenv
+- swig
+- libpython-dev
 - gcc-powerpc-linux-gnu
 - gcc-arm-linux-gnueabihf
 - gcc-aarch64-linux-gnu
-- 
1.9.1

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


[U-Boot] [RESEND PATCH] include: nand: move endif to end of file

2017-01-23 Thread Grygorii Strashko
From: Mugunthan V N 

The terminator endif of ifdef _NAND_H_ should be at the
end of file as a fail safe.

Signed-off-by: Mugunthan V N 
Reviewed-by: Tom Rini 
Reviewed-by: Simon Glass 
Signed-off-by: Grygorii Strashko 
---
Link on prev version
[1] https://patchwork.ozlabs.org/patch/604738/

I've kept "Reviewed-by" from [1], pls inform me in case of any issues.

 include/nand.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/nand.h b/include/nand.h
index b6eb223..692c4db 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -131,8 +131,6 @@ void board_nand_select_device(struct nand_chip *nand, int 
chip);
 
 __attribute__((noreturn)) void nand_boot(void);
 
-#endif
-
 #ifdef CONFIG_ENV_OFFSET_OOB
 #define ENV_OOB_MARKER 0x30425645 /*"EVB0" in little-endian -- offset is stored
as block number*/
@@ -145,3 +143,5 @@ int spl_nand_erase_one(int block, int page);
 
 /* platform specific init functions */
 void sunxi_nand_init(void);
+
+#endif /* _NAND_H_ */
-- 
2.10.1.dirty

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


Re: [U-Boot] sf: Remove spansion_s25fss_disable_4KB_erase

2017-01-23 Thread york sun
On 12/12/2016 09:32 PM, Yao Yuan wrote:
> Hi Jagan,
>
>
>
> Do you have any comments?
>
>
>
> Thanks for your work and you know it’s important for QSPI with S25FS512S.
>
>
>
> It seems S25FS512S can’t support the SECT_4K, right?
>
> And it better to retain the disable_4kb, but we can add a flag in dts to
> select whether enable it.
>
>

Jagan,

This is blocking me from using the board with this specific flash chip. 
Can you take a look? By reverting this single commit 116e005c, my board 
works again.

York

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


[U-Boot] [PATCH 11/11] Drop CONFIG_CMD_DOC

2017-01-23 Thread Simon Glass
This is not used in U-Boot, and the only usage calls a non-existent
function. Drop it.

Signed-off-by: Simon Glass 
---

 board/mpl/common/common_util.c |  9 -
 board/mpl/common/common_util.h |  3 ---
 common/board_r.c   | 13 -
 include/common.h   |  3 ---
 include/config_cmd_all.h   |  1 -
 scripts/config_whitelist.txt   |  1 -
 6 files changed, 30 deletions(-)

diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c
index 101b6efd81..5ea5a5187b 100644
--- a/board/mpl/common/common_util.c
+++ b/board/mpl/common/common_util.c
@@ -622,15 +622,6 @@ int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
return cmd_usage(cmdtp);
 }
 
-
-#if defined(CONFIG_CMD_DOC)
-void doc_init (void)
-{
-  doc_probe(MULTI_PURPOSE_SOCKET_ADDR);
-}
-#endif
-
-
 #ifdef CONFIG_VIDEO
 /**
  * Routines to display the Board information
diff --git a/board/mpl/common/common_util.h b/board/mpl/common/common_util.h
index 22f5c2e6d8..127853d29b 100644
--- a/board/mpl/common/common_util.h
+++ b/board/mpl/common/common_util.h
@@ -23,8 +23,5 @@ int get_boot_mode(void);
 void setup_cs_reloc(void);
 
 void check_env(void);
-#if defined(CONFIG_CMD_DOC)
-void doc_init (void);
-#endif
 
 #endif /* _COMMON_UTIL_H_ */
diff --git a/common/board_r.c b/common/board_r.c
index 419471cfb8..48fa4ee524 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -619,15 +619,6 @@ static int initr_scsi(void)
 }
 #endif
 
-#if defined(CONFIG_CMD_DOC)
-static int initr_doc(void)
-{
-   puts("DOC:   ");
-   doc_init();
-   return 0;
-}
-#endif
-
 #ifdef CONFIG_BITBANGMII
 static int initr_bbmii(void)
 {
@@ -913,10 +904,6 @@ init_fnc_t init_sequence_r[] = {
INIT_FUNC_WATCHDOG_RESET
initr_scsi,
 #endif
-#ifdef CONFIG_CMD_DOC
-   INIT_FUNC_WATCHDOG_RESET
-   initr_doc,
-#endif
 #ifdef CONFIG_BITBANGMII
initr_bbmii,
 #endif
diff --git a/include/common.h b/include/common.h
index 35ac78fede..fbbc2cbc52 100644
--- a/include/common.h
+++ b/include/common.h
@@ -346,9 +346,6 @@ extern ulong load_addr; /* Default Load Address 
*/
 extern ulong save_addr;/* Default Save Address */
 extern ulong save_size;/* Default Save Size */
 
-/* common/cmd_doc.c */
-void   doc_probe(unsigned long physadr);
-
 /* common/cmd_net.c */
 int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 
diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h
index 0c4f645930..a0d4e94a04 100644
--- a/include/config_cmd_all.h
+++ b/include/config_cmd_all.h
@@ -20,7 +20,6 @@
 #define CONFIG_CMD_DATE/* support for RTC, date/time...*/
 #define CONFIG_CMD_DIAG/* Diagnostics  */
 #define CONFIG_CMD_DISPLAY /* Display support  */
-#define CONFIG_CMD_DOC /* Disk-On-Chip Support */
 #define CONFIG_CMD_DTT /* Digital Therm and Thermostat */
 #define CONFIG_CMD_EEPROM  /* EEPROM read/write support*/
 #define CONFIG_CMD_FDC /* Floppy Disk Support  */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index fc98fe52f0..b32c260d32 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -489,7 +489,6 @@ CONFIG_CMD_DEKBLOB
 CONFIG_CMD_DFL
 CONFIG_CMD_DIAG
 CONFIG_CMD_DISPLAY
-CONFIG_CMD_DOC
 CONFIG_CMD_DS4510
 CONFIG_CMD_DS4510_INFO
 CONFIG_CMD_DS4510_MEM
-- 
2.11.0.483.g087da7b7c-goog

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


[U-Boot] [PATCH 10/11] Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

2017-01-23 Thread Simon Glass
Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass 
---

 arch/powerpc/cpu/mpc5xxx/speed.c | 2 +-
 common/Kconfig   | 2 +-
 common/board_f.c | 3 ---
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/cpu/mpc5xxx/speed.c b/arch/powerpc/cpu/mpc5xxx/speed.c
index 30a0a358dd..b37c4a5208 100644
--- a/arch/powerpc/cpu/mpc5xxx/speed.c
+++ b/arch/powerpc/cpu/mpc5xxx/speed.c
@@ -69,7 +69,7 @@ int get_clocks (void)
return (0);
 }
 
-int prt_mpc5xxx_clks (void)
+int print_cpuinfo(void)
 {
char buf1[32], buf2[32], buf3[32];
 
diff --git a/common/Kconfig b/common/Kconfig
index 32d72ca95b..c709661454 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -385,7 +385,7 @@ config BOARD_LATE_INIT
 
 config DISPLAY_CPUINFO
bool "Display information about the CPU during start up"
-   default y if ARM || BLACKFIN || NIOS2 || X86 || XTENSA
+   default y if ARM || BLACKFIN || NIOS2 || X86 || XTENSA || MPC5xxx
help
  Display information about the CPU that U-Boot is running on
  when U-Boot starts up. The function print_cpuinfo() is called
diff --git a/common/board_f.c b/common/board_f.c
index e5d112dd1e..99c0b5ac78 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -919,9 +919,6 @@ static init_fnc_t init_sequence_f[] = {
 #if defined(CONFIG_DISPLAY_CPUINFO)
print_cpuinfo,  /* display cpu info (and speed) */
 #endif
-#if defined(CONFIG_MPC5xxx)
-   prt_mpc5xxx_clks,
-#endif /* CONFIG_MPC5xxx */
 #if defined(CONFIG_DISPLAY_BOARDINFO)
show_board_info,
 #endif
-- 
2.11.0.483.g087da7b7c-goog

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


[U-Boot] [PATCH 09/11] Drop the static inline print_cpuinfo()

2017-01-23 Thread Simon Glass
This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass 
---

 common/board_f.c | 2 ++
 include/common.h | 7 ---
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index 8c9453cb7e..e5d112dd1e 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -916,7 +916,9 @@ static init_fnc_t init_sequence_f[] = {
 #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH)
checkcpu,
 #endif
+#if defined(CONFIG_DISPLAY_CPUINFO)
print_cpuinfo,  /* display cpu info (and speed) */
+#endif
 #if defined(CONFIG_MPC5xxx)
prt_mpc5xxx_clks,
 #endif /* CONFIG_MPC5xxx */
diff --git a/include/common.h b/include/common.h
index 53cdadf09c..35ac78fede 100644
--- a/include/common.h
+++ b/include/common.h
@@ -284,14 +284,7 @@ int mac_read_from_eeprom(void);
 extern u8 __dtb_dt_begin[];/* embedded device tree blob */
 int set_cpu_clk_info(void);
 int mdm_init(void);
-#if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void);
-#else
-static inline int print_cpuinfo(void)
-{
-   return 0;
-}
-#endif
 int update_flash_size(int flash_size);
 int arch_early_init_r(void);
 
-- 
2.11.0.483.g087da7b7c-goog

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


[U-Boot] [PATCH 08/11] Drop CONFIG_WINBOND_83C553

2017-01-23 Thread Simon Glass
This is not used in U-Boot. Drop this option and associated dead code.

Signed-off-by: Simon Glass 
---

 common/board_r.c |  14 ---
 drivers/pci/Makefile |   1 -
 drivers/pci/w83c553f.c   | 206 ---
 scripts/config_whitelist.txt |   1 -
 4 files changed, 222 deletions(-)
 delete mode 100644 drivers/pci/w83c553f.c

diff --git a/common/board_r.c b/common/board_r.c
index 46a43b97a7..419471cfb8 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -262,17 +262,6 @@ static int initr_pci(void)
 }
 #endif
 
-#ifdef CONFIG_WINBOND_83C553
-static int initr_w83c553f(void)
-{
-   /*
-* Initialise the ISA bridge
-*/
-   initialise_w83c553f();
-   return 0;
-}
-#endif
-
 static int initr_barrier(void)
 {
 #ifdef CONFIG_PPC
@@ -834,9 +823,6 @@ init_fnc_t init_sequence_r[] = {
 */
initr_pci,
 #endif
-#ifdef CONFIG_WINBOND_83C553
-   initr_w83c553f,
-#endif
 #ifdef CONFIG_ARCH_EARLY_INIT_R
arch_early_init_r,
 #endif
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 42174f94e9..ad44e83996 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -29,7 +29,6 @@ obj-$(CONFIG_SH7751_PCI) +=pci_sh7751.o
 obj-$(CONFIG_SH7780_PCI) +=pci_sh7780.o
 obj-$(CONFIG_PCI_TEGRA) += pci_tegra.o
 obj-$(CONFIG_TSI108_PCI) += tsi108_pci.o
-obj-$(CONFIG_WINBOND_83C553) += w83c553f.o
 obj-$(CONFIG_PCIE_DW_MVEBU) += pcie_dw_mvebu.o
 obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape.o
 obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape_fixup.o
diff --git a/drivers/pci/w83c553f.c b/drivers/pci/w83c553f.c
deleted file mode 100644
index 1192f0f644..00
--- a/drivers/pci/w83c553f.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH 
- * Andreas Heppel 
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-/*
- * Initialisation of the PCI-to-ISA bridge and disabling the BIOS
- * write protection (for flash) in function 0 of the chip.
- * Enabling function 1 (IDE controller of the chip.
- */
-
-#include 
-#include 
-
-#include 
-#include 
-
-#include 
-
-#define out8(addr,val) do { \
-   out_8((u8*) (addr),(val)); udelay(1); \
-   } while (0)
-#define out16(addr,val)do { \
-   out_be16((u16*) (addr),(val)); udelay(1); \
-   } while (0)
-
-extern uint ide_bus_offset[CONFIG_SYS_IDE_MAXBUS];
-
-void initialise_pic(void);
-void initialise_dma(void);
-
-void initialise_w83c553f(void)
-{
-   pci_dev_t devbusfn;
-   unsigned char reg8;
-   unsigned short reg16;
-   unsigned int reg32;
-
-   devbusfn = pci_find_device(W83C553F_VID, W83C553F_DID, 0);
-   if (devbusfn == -1)
-   {
-   printf("Error: Cannot find W83C553F controller on any PCI 
bus.");
-   return;
-   }
-
-   pci_read_config_word(devbusfn, PCI_COMMAND, ®16);
-   reg16 |= PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
-   pci_write_config_word(devbusfn, PCI_COMMAND, reg16);
-
-   pci_read_config_byte(devbusfn, WINBOND_IPADCR, ®8);
-   /* 16 MB ISA memory space */
-   reg8 |= (IPADCR_IPATOM4 | IPADCR_IPATOM5 | IPADCR_IPATOM6 | 
IPADCR_IPATOM7);
-   reg8 &= ~IPADCR_MBE512;
-   pci_write_config_byte(devbusfn, WINBOND_IPADCR, reg8);
-
-   pci_read_config_byte(devbusfn, WINBOND_CSCR, ®8);
-   /* switch off BIOS write protection */
-   reg8 |= CSCR_UBIOSCSE;
-   reg8 &= ~CSCR_BIOSWP;
-   pci_write_config_byte(devbusfn, WINBOND_CSCR, reg8);
-
-   /*
-* Interrupt routing:
-*  - IDE  -> IRQ 9/0
-*  - INTA -> IRQ 10
-*  - INTB -> IRQ 11
-*  - INTC -> IRQ 14
-*  - INTD -> IRQ 15
-*/
-   pci_write_config_byte(devbusfn, WINBOND_IDEIRCR, 0x90);
-   pci_write_config_word(devbusfn, WINBOND_PCIIRCR, 0xABEF);
-
-   /*
-* Read IDE bus offsets from function 1 device.
-* We must unmask the LSB indicating that ist is an IO address.
-*/
-   devbusfn |= PCI_BDF(0,0,1);
-
-   /*
-* Switch off legacy IRQ for IDE and IDE port 1.
-*/
-   pci_write_config_byte(devbusfn, 0x09, 0x8F);
-
-   pci_read_config_dword(devbusfn, WINDOND_IDECSR, ®32);
-   reg32 &= ~(IDECSR_LEGIRQ | IDECSR_P1EN | IDECSR_P1F16);
-   pci_write_config_dword(devbusfn, WINDOND_IDECSR, reg32);
-
-   pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, &ide_bus_offset[0]);
-   ide_bus_offset[0] &= ~1;
-#if CONFIG_SYS_IDE_MAXBUS > 1
-   pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_2, &ide_bus_offset[1]);
-   ide_bus_offset[1] &= ~1;
-#endif
-
-   /*
-* Enable function 1, IDE -> busmastering and IO space access
-*/
-   pci_read_config_word(devbusfn, PCI_COMMAND, ®16);
-   reg16 |= PCI_COMMAND_MASTER | PCI_COMMAND_IO;
-   pci_write_config_word(devbusfn, PCI_COMMAND, reg16);
-
-   /*
-

[U-Boot] [PATCH 07/11] powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

2017-01-23 Thread Simon Glass
This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass 
---

 arch/powerpc/cpu/mpc8260/spi.c |  7 
 arch/powerpc/cpu/mpc8xx/Makefile   |  1 -
 arch/powerpc/cpu/mpc8xx/commproc.c | 69 --
 arch/powerpc/cpu/mpc8xx/fec.c  | 10 +
 arch/powerpc/cpu/mpc8xx/i2c.c  | 10 -
 arch/powerpc/cpu/mpc8xx/scc.c  | 10 +
 arch/powerpc/cpu/mpc8xx/serial.c   | 17 +
 arch/powerpc/cpu/mpc8xx/spi.c  |  7 
 arch/powerpc/include/asm/global_data.h |  2 +-
 common/board_f.c   |  5 ---
 include/commproc.h | 16 
 post/cpu/mpc8xx/ether.c|  5 ---
 post/cpu/mpc8xx/uart.c | 13 ---
 scripts/config_whitelist.txt   |  1 -
 14 files changed, 7 insertions(+), 166 deletions(-)
 delete mode 100644 arch/powerpc/cpu/mpc8xx/commproc.c

diff --git a/arch/powerpc/cpu/mpc8260/spi.c b/arch/powerpc/cpu/mpc8260/spi.c
index 8c91a713bb..c7fb4e9a6c 100644
--- a/arch/powerpc/cpu/mpc8260/spi.c
+++ b/arch/powerpc/cpu/mpc8260/spi.c
@@ -181,14 +181,7 @@ void spi_init_f (void)
spi->spi_tbc= 0;
spi->spi_txtmp  = 0;
 
-   /* Allocate space for one transmit and one receive buffer
-* descriptor in the DP ram
-*/
-#ifdef CONFIG_SYS_ALLOC_DPRAM
-   dpaddr = m8260_cpm_dpalloc (sizeof(cbd_t)*2, 8);
-#else
dpaddr = CPM_SPI_BASE;
-#endif
 
 /* 3 */
/* Set up the SPI parameters in the parameter ram */
diff --git a/arch/powerpc/cpu/mpc8xx/Makefile b/arch/powerpc/cpu/mpc8xx/Makefile
index f83fd5ecf4..6f81fee571 100644
--- a/arch/powerpc/cpu/mpc8xx/Makefile
+++ b/arch/powerpc/cpu/mpc8xx/Makefile
@@ -10,7 +10,6 @@
 extra-y += start.o
 extra-y += traps.o
 obj-y  += bedbug_860.o
-obj-y  += commproc.o
 obj-y  += cpu.o
 obj-y  += cpu_init.o
 obj-y  += fec.o
diff --git a/arch/powerpc/cpu/mpc8xx/commproc.c 
b/arch/powerpc/cpu/mpc8xx/commproc.c
deleted file mode 100644
index f8581d130d..00
--- a/arch/powerpc/cpu/mpc8xx/commproc.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#ifdef CONFIG_SYS_ALLOC_DPRAM
-
-int dpram_init (void)
-{
-   /* Reclaim the DP memory for our use. */
-   gd->arch.dp_alloc_base = CPM_DATAONLY_BASE;
-   gd->arch.dp_alloc_top  = CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE;
-
-   return (0);
-}
-
-/* Allocate some memory from the dual ported ram.  We may want to
- * enforce alignment restrictions, but right now everyone is a good
- * citizen.
- */
-uint dpram_alloc (uint size)
-{
-   uint addr = gd->arch.dp_alloc_base;
-
-   if ((gd->arch.dp_alloc_base + size) >= gd->arch.dp_alloc_top)
-   return (CPM_DP_NOSPACE);
-
-   gd->arch.dp_alloc_base += size;
-
-   return addr;
-}
-
-uint dpram_base (void)
-{
-   return gd->arch.dp_alloc_base;
-}
-
-/* Allocate some memory from the dual ported ram.  We may want to
- * enforce alignment restrictions, but right now everyone is a good
- * citizen.
- */
-uint dpram_alloc_align (uint size, uint align)
-{
-   uint addr, mask = align - 1;
-
-   addr = (gd->arch.dp_alloc_base + mask) & ~mask;
-
-   if ((addr + size) >= gd->arch.dp_alloc_top)
-   return (CPM_DP_NOSPACE);
-
-   gd->arch.dp_alloc_base = addr + size;
-
-   return addr;
-}
-
-uint dpram_base_align (uint align)
-{
-   uint mask = align - 1;
-
-   return (gd->arch.dp_alloc_base + mask) & ~mask;
-}
-#endif /* CONFIG_SYS_ALLOC_DPRAM */
diff --git a/arch/powerpc/cpu/mpc8xx/fec.c b/arch/powerpc/cpu/mpc8xx/fec.c
index 0940906b1d..b27310fffb 100644
--- a/arch/powerpc/cpu/mpc8xx/fec.c
+++ b/arch/powerpc/cpu/mpc8xx/fec.c
@@ -570,14 +570,8 @@ static int fec_init (struct eth_device *dev, bd_t * bd)
rxIdx = 0;
txIdx = 0;
 
-   if (!rtx) {
-#ifdef CONFIG_SYS_ALLOC_DPRAM
-   rtx = (RTXBD *) (immr->im_cpm.cp_dpmem +
-dpram_alloc_align (sizeof (RTXBD), 8));
-#else
-   rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + CPM_FEC_BASE);
-#endif
-   }
+   if (!rtx)
+   rtx = (RTXBD *)(immr->im_cpm.cp_dpmem + CPM_FEC_BASE);
/*
 * Setup Receiver Buffer Descriptors (13.14.24.18)
 * Settings:
diff --git a/arch/powerpc/cpu/mpc8xx/i2c.c b/arch/powerpc/cpu/mpc8xx/i2c.c
index 3dff4ab4ac..54d5cb5130 100644
--- a/arch/powerpc/cpu/mpc8xx/i2c.c
+++ b/arch/powerpc/cpu/mpc8xx/i2c.c
@@ -190,17 +190,7 @@ void i2c_init(int speed, int slaveaddr)
iip->iic_rpbase = 0;
 #endif
 
-#ifdef CONFIG_SYS_ALLOC_DPRAM
-   dpaddr = iip->iic_rbase;
-   if (dpaddr == 0) {
-   /* need to allocate dual port ram */
-   dpaddr = dpram_alloc_align((NUM_RX_BDS * sizeof(I2C_BD)) +
-  

[U-Boot] [PATCH 06/11] powerpc: Drop probecpu() in favour of arch_cpu_init()

2017-01-23 Thread Simon Glass
To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass 
---

 arch/powerpc/cpu/mpc8xxx/cpu.c |  2 +-
 board/Arcturus/ucp1020/spl.c   |  2 +-
 board/freescale/b4860qds/spl.c |  2 +-
 board/freescale/c29xpcie/spl.c |  2 +-
 board/freescale/p1010rdb/spl.c |  2 +-
 board/freescale/p1022ds/spl.c  |  2 +-
 board/freescale/p1_p2_rdb_pc/spl.c |  2 +-
 board/freescale/t102xqds/spl.c |  2 +-
 board/freescale/t102xrdb/spl.c |  2 +-
 board/freescale/t104xrdb/spl.c |  2 +-
 board/freescale/t208xqds/spl.c |  2 +-
 board/freescale/t208xrdb/spl.c |  2 +-
 board/freescale/t4qds/spl.c|  2 +-
 board/freescale/t4rdb/spl.c|  2 +-
 common/board_f.c   |  4 
 include/common.h   | 12 +++-
 16 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xxx/cpu.c b/arch/powerpc/cpu/mpc8xxx/cpu.c
index 584f3b8d61..afb5b512ba 100644
--- a/arch/powerpc/cpu/mpc8xxx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xxx/cpu.c
@@ -308,7 +308,7 @@ int is_core_valid(unsigned int core)
return !!((1 << core) & cpu_mask());
 }
 
-int probecpu (void)
+int arch_cpu_init(void)
 {
uint svr;
uint ver;
diff --git a/board/Arcturus/ucp1020/spl.c b/board/Arcturus/ucp1020/spl.c
index 9c19c87b72..3a775be9ae 100644
--- a/board/Arcturus/ucp1020/spl.c
+++ b/board/Arcturus/ucp1020/spl.c
@@ -83,7 +83,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
bd->bi_memsize = CONFIG_SYS_L2_SIZE;
 
-   probecpu();
+   arch_cpu_init();
get_clocks();
mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
CONFIG_SPL_RELOC_MALLOC_SIZE);
diff --git a/board/freescale/b4860qds/spl.c b/board/freescale/b4860qds/spl.c
index fabc78301a..35b812cb18 100644
--- a/board/freescale/b4860qds/spl.c
+++ b/board/freescale/b4860qds/spl.c
@@ -87,7 +87,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
bd->bi_memsize = CONFIG_SYS_L3_SIZE;
 
-   probecpu();
+   arch_cpu_init();
get_clocks();
mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
CONFIG_SPL_RELOC_MALLOC_SIZE);
diff --git a/board/freescale/c29xpcie/spl.c b/board/freescale/c29xpcie/spl.c
index d8d73c70b8..6613216950 100644
--- a/board/freescale/c29xpcie/spl.c
+++ b/board/freescale/c29xpcie/spl.c
@@ -53,7 +53,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
bd->bi_memsize = CONFIG_SYS_L2_SIZE;
 
-   probecpu();
+   arch_cpu_init();
get_clocks();
mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
CONFIG_SPL_RELOC_MALLOC_SIZE);
diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c
index c22e215675..05c76f2e45 100644
--- a/board/freescale/p1010rdb/spl.c
+++ b/board/freescale/p1010rdb/spl.c
@@ -69,7 +69,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
bd->bi_memsize = CONFIG_SYS_L2_SIZE;
 
-   probecpu();
+   arch_cpu_init();
get_clocks();
mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
CONFIG_SPL_RELOC_MALLOC_SIZE);
diff --git a/board/freescale/p1022ds/spl.c b/board/freescale/p1022ds/spl.c
index 6a5fe74343..ef38551600 100644
--- a/board/freescale/p1022ds/spl.c
+++ b/board/freescale/p1022ds/spl.c
@@ -83,7 +83,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
bd->bi_memsize = CONFIG_SYS_L2_SIZE;
 
-   probecpu();
+   arch_cpu_init();
get_clocks();
mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
CONFIG_SPL_RELOC_MALLOC_SIZE);
diff --git a/board/freescale/p1_p2_rdb_pc/spl.c 
b/board/freescale/p1_p2_rdb_pc/spl.c
index 9e8f359d0d..2af5576ff7 100644
--- a/board/freescale/p1_p2_rdb_pc/spl.c
+++ b/board/freescale/p1_p2_rdb_pc/spl.c
@@ -80,7 +80,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
bd->bi_memsize = CONFIG_SYS_L2_SIZE;
 
-   probecpu();
+   arch_cpu_init();
get_clocks();
mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
CONFIG_SPL_RELOC_MALLOC_SIZE);
diff --git a/board/freescale/t102xqds/spl.c b/board/freescale/t102xqds/spl.c
index c9239b87db..3e96b33c40 100644
--- a/board/freescale/t102xqds/spl.c
+++ b/board/freescale/t102xqds/spl.c
@@ -117,7 +117,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
bd->bi_memsize = CONFIG_SYS_L3_SIZE;
 
-   probecpu();
+   arch_cpu_init();
get_clocks();
mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
CONFIG_SPL_RELOC_MALLOC_SIZE);
diff --git a/board/freescale/t102xrdb/spl.c b/board/frees

[U-Boot] [PATCH 05/11] Convert CONFIG_ARCH_MISC_INIT to Kconfig

2017-01-23 Thread Simon Glass
This converts the following to Kconfig:
   CONFIG_ARCH_MISC_INIT

Signed-off-by: Simon Glass 
---

 arch/Kconfig| 1 +
 arch/arm/Kconfig| 7 +++
 arch/arm/mach-mvebu/Kconfig | 1 +
 arch/blackfin/include/asm/config.h  | 2 --
 common/Kconfig  | 8 
 configs/am335x_baltos_defconfig | 1 +
 configs/am335x_boneblack_defconfig  | 1 +
 configs/am335x_boneblack_vboot_defconfig| 1 +
 configs/am335x_evm_defconfig| 1 +
 configs/am335x_evm_nor_defconfig| 1 +
 configs/am335x_evm_norboot_defconfig| 1 +
 configs/am335x_evm_spiboot_defconfig| 1 +
 configs/am335x_evm_usbspl_defconfig | 1 +
 configs/apalis_t30_defconfig| 1 +
 configs/apx4devkit_defconfig| 1 +
 configs/bayleybay_defconfig | 1 +
 configs/bg0900_defconfig| 1 +
 configs/birdland_bav335a_defconfig  | 1 +
 configs/birdland_bav335b_defconfig  | 1 +
 configs/brppt1_mmc_defconfig| 1 +
 configs/brppt1_nand_defconfig   | 1 +
 configs/brppt1_spi_defconfig| 1 +
 configs/brxre1_defconfig| 1 +
 configs/colibri_t20_defconfig   | 1 +
 configs/colibri_t30_defconfig   | 1 +
 configs/colibri_vf_defconfig| 1 +
 configs/conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 +
 configs/conga-qeval20-qa3-e3845_defconfig   | 1 +
 configs/draco_defconfig | 1 +
 configs/edminiv2_defconfig  | 1 +
 configs/etamin_defconfig| 1 +
 configs/galileo_defconfig   | 1 +
 configs/m28evk_defconfig| 1 +
 configs/minnowmax_defconfig | 1 +
 configs/mx23_olinuxino_defconfig| 1 +
 configs/mx23evk_defconfig   | 1 +
 configs/mx28evk_auart_console_defconfig | 1 +
 configs/mx28evk_defconfig   | 1 +
 configs/mx28evk_nand_defconfig  | 1 +
 configs/mx28evk_spi_defconfig   | 1 +
 configs/pcm051_rev1_defconfig   | 1 +
 configs/pcm051_rev3_defconfig   | 1 +
 configs/pengwyn_defconfig   | 1 +
 configs/pxm2_defconfig  | 1 +
 configs/rastaban_defconfig  | 1 +
 configs/rut_defconfig   | 1 +
 configs/sansa_fuze_plus_defconfig   | 1 +
 configs/sc_sps_1_defconfig  | 1 +
 configs/som-db5800-som-6867_defconfig   | 1 +
 configs/thuban_defconfig| 1 +
 configs/ts4600_defconfig| 1 +
 configs/xfi3_defconfig  | 1 +
 include/configs/am335x_evm.h| 1 -
 include/configs/apalis_t30.h| 2 --
 include/configs/aspenite.h  | 1 -
 include/configs/baltos.h| 1 -
 include/configs/bav335x.h   | 1 -
 include/configs/bayleybay.h | 1 -
 include/configs/brppt1.h| 1 -
 include/configs/brxre1.h| 1 -
 include/configs/colibri_imx7.h  | 2 --
 include/configs/colibri_t20.h   | 2 --
 include/configs/colibri_t30.h   | 2 --
 include/configs/colibri_vf.h| 1 -
 include/configs/conga-qeval20-qa3-e3845.h   | 1 -
 include/configs/edminiv2.h  | 1 -
 include/configs/galileo.h   | 1 -
 include/configs/gplugd.h| 1 -
 include/configs/km/km_arm.h | 1 -
 include/configs/ls2080a_common.h| 1 -
 include/configs/minnowmax.h | 1 -
 include/configs/mv-common.h | 1 -
 include/configs/mx7_common.h| 2 --
 include/configs/mxs.h   | 1 -
 include/configs/pcm051.h| 1 -
 include/configs/pengwyn.h   | 1 -
 include/configs/siemens-am33x-common.h  | 1 -
 include/configs/socfpga_commo

[U-Boot] [PATCH 03/11] Convert CONFIG_ARCH_EARLY_INIT_R to Kconfig

2017-01-23 Thread Simon Glass
This converts the following to Kconfig:
   CONFIG_ARCH_EARLY_INIT_R

Signed-off-by: Simon Glass 
---

 arch/Kconfig|  1 +
 arch/arc/include/asm/config.h   |  1 -
 arch/arm/Kconfig|  1 +
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig   |  4 
 common/Kconfig  | 13 +
 configs/bayleybay_defconfig |  1 +
 configs/cougarcanyon2_defconfig |  1 +
 configs/dfi-bt700-q7x-151_defconfig |  1 +
 configs/efi-x86_defconfig   |  1 +
 configs/minnowmax_defconfig |  1 +
 configs/mvebu_db-88f3720_defconfig  |  1 +
 configs/mvebu_db-88f7040_defconfig  |  1 +
 configs/mvebu_db-88f8040_defconfig  |  1 +
 configs/qemu-x86_efi_payload32_defconfig|  1 +
 configs/qemu-x86_efi_payload64_defconfig|  1 +
 configs/rut_defconfig   |  1 +
 configs/theadorable-x86-dfi-bt700_defconfig |  1 +
 include/configs/conga-qeval20-qa3-e3845.h   |  1 -
 include/configs/crownbay.h  |  1 -
 include/configs/galileo.h   |  1 -
 include/configs/ls1012a_common.h|  2 --
 include/configs/ls1043a_common.h|  1 -
 include/configs/ls1046a_common.h|  1 -
 include/configs/ls2080a_common.h|  1 -
 include/configs/minnowmax.h |  1 -
 include/configs/mvebu_armada-8k.h   |  1 -
 include/configs/mvebu_db-88f3720.h  |  1 -
 include/configs/qemu-x86.h  |  1 -
 include/configs/rut.h   |  1 -
 include/configs/socfpga_common.h|  1 -
 include/configs/som-6896.h  |  2 --
 include/configs/som-db5800-som-6867.h   |  1 -
 include/configs/x86-chromebook.h|  2 --
 scripts/config_whitelist.txt|  1 -
 34 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index ffc7b45379..692610b2ff 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -12,6 +12,7 @@ config ARC
bool "ARC architecture"
select HAVE_PRIVATE_LIBGCC
select SUPPORT_OF_CONTROL
+   select ARCH_EARLY_INIT_R
 
 config ARM
bool "ARM architecture"
diff --git a/arch/arc/include/asm/config.h b/arch/arc/include/asm/config.h
index d2d791988e..7aaa5c2912 100644
--- a/arch/arc/include/asm/config.h
+++ b/arch/arc/include/asm/config.h
@@ -8,7 +8,6 @@
 #define __ASM_ARC_CONFIG_H_
 
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
-#define CONFIG_ARCH_EARLY_INIT_R
 
 #define CONFIG_LMB
 
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 855871c64f..1538140301 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -586,6 +586,7 @@ config ARCH_SOCFPGA
select DM_SPI_FLASH
select DM_SPI
select ENABLE_ARM_SOC_BOOT0_HOOK
+   select ARCH_EARLY_INIT_R
 
 config TARGET_CM_T43
bool "Support cm_t43"
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index ba411e2af8..d93a61d00f 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -5,6 +5,7 @@ config ARCH_LS1012A
select SYS_FSL_DDR_BE
select SYS_FSL_MMDC
select SYS_FSL_ERRATUM_A010315
+   select ARCH_EARLY_INIT_R
 
 config ARCH_LS1043A
bool
@@ -22,6 +23,7 @@ config ARCH_LS1043A
select SYS_FSL_ERRATUM_A010539
select SYS_FSL_HAS_DDR3
select SYS_FSL_HAS_DDR4
+   select ARCH_EARLY_INIT_R
 
 config ARCH_LS1046A
bool
@@ -38,6 +40,7 @@ config ARCH_LS1046A
select SYS_FSL_ERRATUM_A010539
select SYS_FSL_HAS_DDR4
select SYS_FSL_SRDS_2
+   select ARCH_EARLY_INIT_R
 
 config ARCH_LS2080A
bool
@@ -62,6 +65,7 @@ config ARCH_LS2080A
select SYS_FSL_ERRATUM_A009803
select SYS_FSL_ERRATUM_A009942
select SYS_FSL_ERRATUM_A010165
+   select ARCH_EARLY_INIT_R
 
 config FSL_LSCH2
bool
diff --git a/common/Kconfig b/common/Kconfig
index bb47ee4341..6c8a856d40 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -399,4 +399,17 @@ config DISPLAY_BOARDINFO
  when U-Boot starts up. The board function checkboard() is called
  to do this.
 
+menu "Start-up hooks"
+
+config ARCH_EARLY_INIT_R
+   bool "Call arch-specific init soon after relocation"
+   default y if X86
+   help
+ With this option U-Boot will call arch_early_init_r() soon after
+ relocation. Driver model is running by this point, and the cache
+ is on. Note that board_early_init_r() is called first, if
+ enabled. This can be used to set up architecture-specific devices.
+
+endmenu
+
 source "common/spl/Kconfig"
diff --git a/configs/bayleybay_defconfig b/configs/bayleybay_defconfig
index 9f7c2f4e58..8799194f52 100644
--- a/configs/bayleybay_defconfig
+++ b/configs/bayleybay_defconfig
@@ -16,6 +16,7 @@ CONFIG_FIT=y
 CONFIG_BOOTSTAGE=y
 CON

[U-Boot] [PATCH 00/11] Move some init sequence options to Kconfig

2017-01-23 Thread Simon Glass
This series moves three common CONFIG options to Kconfig. They are
somewhat tricky and I've had a hard time figuring out good Kconfig
defaults, particularly for CONFIG_BOARD_EARLY_INIT_F. Hopefully the board
maintainers can improve things.

It is build-tested and I've also checked it with 'buildman -sK. The only
config changes are:

draco etamin pxm2 rastaban rut thuban :
   + u-boot-spl.cfg: CONFIG_ARCH_MISC_INIT=1
   + all: CONFIG_ARCH_MISC_INIT=1

and this is due to this option being defined in SPL (i.e. harmless).

A few patches are included to tidy up some other things I noticed along
the way.


Simon Glass (11):
  configs: Resync with savedefconfig
  config: Drop CONFIG_ARCH_DMA_PIO_WORDS
  Convert CONFIG_ARCH_EARLY_INIT_R to Kconfig
  Convert CONFIG_BOARD_EARLY_INIT_F to Kconfig
  Convert CONFIG_ARCH_MISC_INIT to Kconfig
  powerpc: Drop probecpu() in favour of arch_cpu_init()
  powerpc: Drop CONFIG_SYS_ALLOC_DPRAM
  Drop CONFIG_WINBOND_83C553
  Drop the static inline print_cpuinfo()
  Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()
  Drop CONFIG_CMD_DOC

 arch/Kconfig   |   2 +
 arch/arc/include/asm/config.h  |   1 -
 arch/arm/Kconfig   |  35 
 arch/arm/cpu/armv7/mx6/Kconfig |   4 +
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig  |   8 +
 arch/arm/include/asm/imx-common/dma.h  |   7 +-
 arch/arm/mach-at91/Kconfig |  18 ++
 arch/arm/mach-exynos/Kconfig   |   3 +
 arch/arm/mach-mvebu/Kconfig|   2 +
 arch/arm/mach-tegra/Kconfig|   1 +
 arch/blackfin/include/asm/config.h |   2 -
 arch/powerpc/cpu/mpc5xxx/speed.c   |   2 +-
 arch/powerpc/cpu/mpc8260/spi.c |   7 -
 arch/powerpc/cpu/mpc83xx/Kconfig   |   6 +
 arch/powerpc/cpu/mpc85xx/Kconfig   |   2 +
 arch/powerpc/cpu/mpc86xx/Kconfig   |   2 +
 arch/powerpc/cpu/mpc8xx/Makefile   |   1 -
 arch/powerpc/cpu/mpc8xx/commproc.c |  69 ---
 arch/powerpc/cpu/mpc8xx/fec.c  |  10 +-
 arch/powerpc/cpu/mpc8xx/i2c.c  |  10 -
 arch/powerpc/cpu/mpc8xx/scc.c  |  10 +-
 arch/powerpc/cpu/mpc8xx/serial.c   |  17 +-
 arch/powerpc/cpu/mpc8xx/spi.c  |   7 -
 arch/powerpc/cpu/mpc8xxx/cpu.c |   2 +-
 arch/powerpc/include/asm/global_data.h |   2 +-
 board/Arcturus/ucp1020/spl.c   |   2 +-
 board/freescale/b4860qds/spl.c |   2 +-
 board/freescale/c29xpcie/spl.c |   2 +-
 board/freescale/p1010rdb/spl.c |   2 +-
 board/freescale/p1022ds/spl.c  |   2 +-
 board/freescale/p1_p2_rdb_pc/spl.c |   2 +-
 board/freescale/t102xqds/spl.c |   2 +-
 board/freescale/t102xrdb/spl.c |   2 +-
 board/freescale/t104xrdb/spl.c |   2 +-
 board/freescale/t208xqds/spl.c |   2 +-
 board/freescale/t208xrdb/spl.c |   2 +-
 board/freescale/t4qds/spl.c|   2 +-
 board/freescale/t4rdb/spl.c|   2 +-
 board/mpl/common/common_util.c |   9 -
 board/mpl/common/common_util.h |   3 -
 common/Kconfig |  33 +++-
 common/board_f.c   |  14 +-
 common/board_r.c   |  27 ---
 configs/B4420QDS_NAND_defconfig|   2 +-
 configs/B4420QDS_SPIFLASH_defconfig|   2 +-
 configs/B4420QDS_defconfig |   2 +-
 configs/B4860QDS_NAND_defconfig|   2 +-
 configs/B4860QDS_SPIFLASH_defconfig|   2 +-
 configs/B4860QDS_SRIO_PCIE_BOOT_defconfig  |   2 +-
 configs/B4860QDS_defconfig |   2 +-
 configs/BSC9131RDB_NAND_SYSCLK100_defconfig|   2 +-
 configs/BSC9131RDB_NAND_defconfig  |   2 +-
 configs/BSC9131RDB_SPIFLASH_SYSCLK100_defconfig|   2 +-
 configs/BSC9131RDB_SPIFLASH_defconfig  |   2 +-
 configs/C29XPCIE_NAND_defconfig|   2 +-
 configs/C29XPCIE_SPIFLASH_defconfig|   2 +-
 configs/C29XPCIE_defconfig |   2 +-
 configs/CHIP_defconfig |   2 +-
 configs/CPCI2DP_defconfig  |   3 +-
 configs/CPCI4052_defconfig |   3 +-
 configs/Cyrus_P5020_defconfig  |   1 +
 configs/Cyrus_P5040_defconfig  |   1 +
 configs/MIP405T_defconfig  |   3 +-
 configs/MIP405_defconfig   |   3 +-
 configs/MPC8313ERDB_

[U-Boot] [PATCH 02/11] config: Drop CONFIG_ARCH_DMA_PIO_WORDS

2017-01-23 Thread Simon Glass
This is not defined by any board in U-Boot.

Signed-off-by: Simon Glass 
---

 arch/arm/include/asm/imx-common/dma.h | 7 +--
 scripts/config_whitelist.txt  | 1 -
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/imx-common/dma.h 
b/arch/arm/include/asm/imx-common/dma.h
index 1aec4f9d5a..0244947b6e 100644
--- a/arch/arm/include/asm/imx-common/dma.h
+++ b/arch/arm/include/asm/imx-common/dma.h
@@ -16,12 +16,7 @@
 #include 
 #include 
 
-#ifndefCONFIG_ARCH_DMA_PIO_WORDS
-#defineDMA_PIO_WORDS   15
-#else
-#defineDMA_PIO_WORDS   CONFIG_ARCH_DMA_PIO_WORDS
-#endif
-
+#define DMA_PIO_WORDS  15
 #define MXS_DMA_ALIGNMENT  ARCH_DMA_MINALIGN
 
 /*
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index fb9fb3472c..a927e5019c 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -109,7 +109,6 @@ CONFIG_AP_SH4A_4A
 CONFIG_ARCH_ADPAG101P
 CONFIG_ARCH_CPU_INIT
 CONFIG_ARCH_CSB226
-CONFIG_ARCH_DMA_PIO_WORDS
 CONFIG_ARCH_EARLY_INIT_R
 CONFIG_ARCH_HAS_ILOG2_U32
 CONFIG_ARCH_HAS_ILOG2_U64
-- 
2.11.0.483.g087da7b7c-goog

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


Re: [U-Boot] [PATCH 05/12] aspeed/ast2500: Device Tree and bindings for some of the clocks

2017-01-23 Thread Simon Glass
Hi Maxim,

On 23 January 2017 at 10:52, Maxim Sloyko  wrote:
> On Fri, Jan 20, 2017 at 7:52 PM, Simon Glass  wrote:
>>
>> Hi Maxim,
>>
>> On 17 January 2017 at 16:27, Maxim Sloyko  wrote:
>> >
>> >
>> > On Sat, Jan 14, 2017 at 9:13 AM, Simon Glass  wrote:
>> >>
>> >> Hi Maxim,
>> >>
>> >> On 5 January 2017 at 15:20, Maxim Sloyko  wrote:
>> >> > On Wed, Jan 4, 2017 at 7:26 PM, Tom Rini  wrote:
>> >> >> On Wed, Jan 04, 2017 at 05:18:42PM -0800, Maxim Sloyko wrote:
>> >> >>> On Wed, Jan 4, 2017 at 12:58 PM, Tom Rini  wrote:
>> >> >>> > On Wed, Jan 04, 2017 at 11:46:49AM -0800, Maxim Sloyko wrote:
>> >> >>> >
>> >> >>> >> Signed-off-by: Maxim Sloyko 
>> >> >>> >> ---
>> >> >>> >>
>> >> >>> >>  arch/arm/dts/ast2500.dtsi   | 423
>> >> >>> >> 
>> >> >>> >>  include/dt-bindings/clock/ast2500-scu.h |  29 +++
>> >> >>> >>  2 files changed, 452 insertions(+)
>> >> >>> >>  create mode 100644 arch/arm/dts/ast2500.dtsi
>> >> >>> >>  create mode 100644 include/dt-bindings/clock/ast2500-scu.h
>> >> >>> >>
>> >> >>> >> diff --git a/arch/arm/dts/ast2500.dtsi b/arch/arm/dts/ast2500.dtsi
>> >> >>> >> new file mode 100644
>> >> >>> >> index 00..1a2a3f7ee3
>> >> >>> >> --- /dev/null
>> >> >>> >> +++ b/arch/arm/dts/ast2500.dtsi
>> >> >>> >> @@ -0,0 +1,423 @@
>> >> >>> >> +/* This device tree is copied from
>> >> >>> >> + *
>> >> >>> >> https://github.com/openbmc/linux/blob/c5682cb/arch/arm/boot/dts/aspeed-g5.dtsi
>> >> >>> >
>> >> >>> > Is this also found in the Linux kernel or not yet?  Thanks!
>> >> >>>
>> >> >>> Yes, this is also in in main Linux kernel now, as I've found out, but
>> >> >>> actually there is a number of differences, most notably there is no
>> >> >>> pin configuration in this device tree, because there is no pinctrl
>> >> >>> driver.
>> >> >
>> >> > Actually, I take that back, I was looking at the wrong linux Linux
>> >> > kernel tree still... Only basic version of device tree has made it to
>> >> > mainline kernel, but it's enough at the moment, so I used that
>> >> > instead.
>> >> >
>> >> >>>
>> >> >>> Should I remove this reference or modify it?
>> >> >>
>> >> >> Ideally, we will take the kernel dts files and then add what we need on
>> >> >> top of that in one of CONFIG_SYS_CPU/CONFIG_SYS_SOC/CONFIG_SYS_VENDOR
>> >> >> -u-boot.dtsi files, see for example arch/arm/dts/sunxi-u-boot.dtsi or
>> >> >> arch/arm/dts/tegra124-nyan-big-u-boot.dtsi
>> >> >
>> >> > OK, so I took the device tree from the Linux kernel, (ast2500.dtsi),
>> >> > added modifications in ast2500-u-boot.dtsi and now include
>> >> > ast2500-u-boot.dtsi in ast2500-evb.dts. Let me know if I misunderstood
>> >> > you.
>> >>
>> >> There is some magic in the Makefile which automatically includes the
>> >> .dtsi if you name it correctly:
>> >>
>> >> # Try these files in order to find the U-Boot-specific .dtsi include file
>> >> u_boot_dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir
>> >> $<))-u-boot.dtsi) \
>> >> $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
>> >> $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
>> >> $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
>> >> $(wildcard $(dts_dir)/u-boot.dtsi)
>> >>
>> >>
>> >> So you should not need to include it explicitly.
>> >
>> >
>> > Well, it looks like the only applicable for this case would be
>> > CONFIG_SYS_SOC, but it looks like this setting also affects the mach- and
>> > arch- directories used. In this case I want different aspeed SoCs to share
>> > those directories, but
>> > they will have different DTs.
>>
>> The first option is to a .dtsi derived from the .dts filename. Does that 
>> help?
>
> Hmm, probably not... if I understand that correctly.
>
> This is what I have right now:
>
> ast2500.dtsi -- device tree from the linux kernel, used by all
> ast2500-based boards.
> ast2500-u-boot.dtsi -- these are u-boot specific additions, with
> u-boot,dm-pre-reloc labels, clock specification and SDRAM driver node.
> These are still need to be shared by all ast2500-based boards.
> ast2500-evb.dts -- Eval board specific stuff, right now basically just
> chosen node with stdout-path and clock frequency specification for
> SDRAM.
>
> I don't this it would make sense to have ast2500-evb-u-boot.dtsi just
> to avoid include, because when I later create ast2500-zaius-bmc.dts or
> something like that, I would have the same problem.

Yes you may as well have your own include.

The idea is to use the same files as Linux, and put the U-Boot
additions in a separate file. But it's not critical - just a new idea
we had. Also if you can get the U-Boot additions into the upstream
Linux version then you won't need this.

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


Re: [U-Boot] [PATCH 05/14] x86: qemu: Hide arch_cpu_init() and print_cpuinfo() for U-Boot proper

2017-01-23 Thread Simon Glass
On 18 January 2017 at 04:32, Bin Meng  wrote:
> arch_cpu_init() and print_cpuinfo() should be only available in SPL
> build.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/qemu/qemu.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH] spl: Add some missing newlines

2017-01-23 Thread Simon Glass
Hi Andrew,

On 22 January 2017 at 14:35, Andrew F. Davis  wrote:
> On 01/20/2017 09:51 PM, Simon Glass wrote:
>> Hi Andrew,
>>
>> On 12 January 2017 at 09:19, Andrew F. Davis  wrote:
>>> Signed-off-by: Andrew F. Davis 
>>> ---
>>>  common/spl/spl.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>>> index a76ea3a603..e43718de62 100644
>>> --- a/common/spl/spl.c
>>> +++ b/common/spl/spl.c
>>> @@ -316,7 +316,7 @@ static int boot_from_devices(struct spl_image_info 
>>> *spl_image,
>>> loader = spl_ll_find_loader(spl_boot_list[i]);
>>>  #if defined(CONFIG_SPL_SERIAL_SUPPORT) && 
>>> defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
>>> if (loader)
>>> -   printf("Trying to boot from %s", loader->name);
>>> +   printf("Trying to boot from %s\n", loader->name);
>>> else
>>> puts("SPL: Unsupported Boot Device!\n");
>>>  #endif
>>> @@ -389,7 +389,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>>   gd->malloc_ptr / 1024);
>>>  #endif
>>>
>>> -   debug("loaded - jumping to U-Boot...");
>>> +   debug("loaded - jumping to U-Boot...\n");
>>
>> I prefer this one as it is, since U-Boot prints a few newlines anyway,
>> and this way we can have the cursor at the end of the 'jumping' line
>> until U-Boot starts.
>>
>> What's the rationale for changing it. Could you add a commit message?
>>
>
> Looks like this already has be taken, but I'll explain myself anyway.
>
> The way I see it, for consistency sake, the only reason a print
> statement should not end in a newline is iff they expect something to be
> printed on the same line after. This is not the case here, we *do* want
> a newline after this statement, we are just expecting it to be handled
> later (hopefully). Not sticking to this standard will lead to a lot of
> print statements starting with '\n' to be safe. For instance even if we
> knew what follows should emit some newlines, this is a debug statement,
> it may not printed, so the following line would still have to begin with
> a newline "just in-case", we would end up with half our print out lines
> with two new lines above them.

Of course you are right in general and I agree with your rule. But in
this case we know we are jumping to U-Boot, and that U-Boot prints a
few newlines at the start. I suppose you could argue that you might
turn on some debug UART output early in U-Boot which would mess that
up. If you made that argument then I might agree with you :-) But for
most users this avoids an unnecessary newline.

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


Re: [U-Boot] [PATCH 03/14] x86: spl: Add weak arch_cpu_init_dm()

2017-01-23 Thread Simon Glass
Hi Bin,

On 18 January 2017 at 04:32, Bin Meng  wrote:
> arch_cpu_init_dm() might not be implemented by every platform.
> Implement a weak version for SPL.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/lib/spl.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
> index 7403d15..8c5b90f 100644
> --- a/arch/x86/lib/spl.c
> +++ b/arch/x86/lib/spl.c
> @@ -15,6 +15,11 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> +__weak int arch_cpu_init_dm(void)
> +{
> +   return 0;
> +}

There is already one of these in board_f.c - do we need another?

> +
>  static int x86_spl_init(void)
>  {
> /*
> --
> 2.9.2
>

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


Re: [U-Boot] [PATCH 04/14] x86: Compile irq.c for 64-bit

2017-01-23 Thread Simon Glass
On 18 January 2017 at 04:32, Bin Meng  wrote:
> There is no reason not to compile irq.c for 64-bit.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH 02/14] x86: Wrap print_ch() with config option

2017-01-23 Thread Simon Glass
Hi Bin,

On 18 January 2017 at 04:32, Bin Meng  wrote:
> print_ch() should not be used if DEBUG_UART is off.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/x86_64/cpu.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass 

>
> diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
> index 77cbb56..82ea456 100644
> --- a/arch/x86/cpu/x86_64/cpu.c
> +++ b/arch/x86/cpu/x86_64/cpu.c
> @@ -31,7 +31,9 @@ void arch_setup_gd(gd_t *new_gd)
>  *
>  * U-Boot SPL 2017.01
>  */
> +#if CONFIG_IS_ENABLED(DEBUG_UART)

Or just #ifdef CONFIG_DEBUF_UART ?

> printch(' ');
> +#endif
>  }
>
>  int cpu_has_64bit(void)
> --
> 2.9.2
>

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


Re: [U-Boot] [PATCH 01/14] x86: qemu: Add missing DECLARE_GLOBAL_DATA_PTR in e820.c

2017-01-23 Thread Simon Glass
On 18 January 2017 at 04:32, Bin Meng  wrote:
> DECLARE_GLOBAL_DATA_PTR is missing which causes 64-bit build error.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/qemu/e820.c | 2 ++
>  1 file changed, 2 insertions(+)

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


Re: [U-Boot] [PATCH v4 00/17] arm: rpi: Enable USB, Ethernet, MMC, Video driver model on Raspberry Pi

2017-01-23 Thread Tom Rini
On Fri, Jan 20, 2017 at 07:07:35AM -0700, Simon Glass wrote:

> Raspberry Pi uses a DWC2 USB controller and a SMSC USB Ethernet adaptor.
> Driver model support for these is available.
> 
> This series does the following:
> - Enable CONFIG_DM_ETH and CONFIG_DM_USB on Raspberry Pi
> - Convert the MMC driver to driver model
> - Convert the video driver to driver model
> - Fixes a driver model video bug which accessed beyond the frame buffer
> - Fixes start-up of MMC with driver model (e.g. at present it does not
> support env_fat)
> - Clean up a few loose ends
> 
> With Ethernet active the device list looks something like this:

There's something wrong with the ethernet changes, at least on RPi 3.
The test.py TFTP test fails as the CRC32 on the file doesn't match, so
something got corrupted along the way.  I haven't thrown my monitor and
USB keyboard on the Pi yet to try out the video parts.  Thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] arm: am57xx: cl-som-am57x: fix Ethernet

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 01:14:18PM +0200, Uri Mashiach wrote:

> The module is continuously rebooting with the following message:
> Net:   data abort
> pc : []  lr : []
> reloc pc : [<80816f42>]lr : [<8080d32b>]
> sp : fdf5ce48  ip : fdf5d79c fp : 0017
> r10: 8083cd58  r9 : fdf5cef0 r8 : fdf5d5d0
> r7 : 48485000  r6 : 40ff r5 : fdf5d6e0  r4 : fdf5d618
> r3 : fdf5d5b4  r2 : fdf5d5d0 r1 : 643a3631  r0 : fdf5d6e0
> Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
> Resetting CPU ...
> 
> Modifications:
> * Enable Ethernet configuration in the SPL.
> * Update PINMUX of PHY enable GPIO.
> 
> Signed-off-by: Uri Mashiach 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v4 03/17] string: Use memcpy() within memmove() when we can

2017-01-23 Thread Tom Rini
On Fri, Jan 20, 2017 at 07:07:38AM -0700, Simon Glass wrote:

> A common use of memmove() can be handled by memcpy(). Also memcpy()
> includes an optimisation for large sizes: it copies a word at a time. So
> we can get a speed-up by calling memcpy() to handle our move in this case.
> 
> Update memmove() to call memcpy() if the destination is before the source.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH] mach-omap2: Cleanup secure boot media generation

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 11:34:37AM -0600, Andrew F. Davis wrote:

> Currently all secure media types of SPL are generated for all platforms,
> all platforms do not need all types, only generate the media types valid
> for each platform.
> 
> Signed-off-by: Andrew F. Davis 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [RESEND] video: bcm2835: add support for reading from the video-mode environment variable

2017-01-23 Thread Stephen Warren

On 01/18/2017 07:15 PM, Brian Masney wrote:

On Fri, Jan 13, 2017 at 10:21:15AM -0700, Stephen Warren wrote:

On 01/13/2017 04:48 AM, Brian Masney wrote:

On Thu, Jan 12, 2017 at 11:47:48AM -0700, Stephen Warren wrote:

On 01/12/2017 11:32 AM, Brian Masney wrote:

On Thu, Jan 12, 2017 at 11:02:14AM -0700, Stephen Warren wrote:

On 01/12/2017 01:57 AM, Brian Masney wrote:

The bcm2835 driver polls the monitor and selects the highest resolution
that is available. This patch allows optionally setting the video-mode
environment variable so that a different video resolution can be used.
If the environment variable is not specified, then it will fall back to
using the old behavior of using the maximum allowable resolution.

This patch is needed to fix an issue booting an upstream Linux kernel
on a Raspberry Pi 2 with a Pi Top screen. Previously, the bcm2835 would
select the 1366x768 resolution (which is a supported resolution),
however the screen would be unreadable. (See
https://www.flickr.com/photos/masneyb/30942037416/ for picture). Using
this patch, the resolution 1024x768 can be selected and is readable on
the screen.


Doesn't this mean that the RPi firmware is reporting the wrong resolution?
If so, isn't the correct fix to get an updated firmware that reports the
correct resolution, rather than patching each piece of SW to ignore the
FW-reported resolution? Or, if this is caused by incorrect EDID in the Pi
Top, then fix the EDID EEPROM on that.

Perhaps there are other use-cases for using a non-default resolution, but to
support that, you'd need to make a call into the FW to request and configure
that non-default resolution, not just ignore what resolution the FW
programmed.


Hi Stephen,
   The Pi Top screen works correctly with the 1366x768 resolution when
booting the 4.4 kernel provided by the Raspberry Pi foundation in
stock Raspbian (no u-boot). (There are no outside provided drivers from
Pi Top.) When booting with u-boot, I can't use the 1366x768 resolution,
even when setting the resolution manually using my patch. When auto
detection is in place, u-boot correctly detects the 1366x768 resolution
according to debugging messages that I see on the serial console.
1024x768 is the highest resolution that I can get a working display with
the Pi Top and u-boot. I also tried changing the display depth.

   I tried booting u-boot using the latest Raspberry Pi firmware and the
older firmware provided with the Raspbian 4.4 kernel. In both cases, the
screen correctly displays the rainbow square at the top left when the
GPU is booting, but then the screen becomes garbled when it gets to
u-boot and the bcm2835 code sets the resolution.

   I tried going through the Pi Top vendor for help but didn't get very
far with them. I'm open to other suggestions to try.


Is the bad image that you get static/fixed, or does it move about randomly?

If it's static/fixed, I wonder if the issue is with the memory pitch
calculation. What value does bcm2835_pitch have without your patch? (and
with your patch, I think it's uninitialized?).

I wonder if you round the value of bcm2835_pitch up to a multiple of 256 (or
something like that), then perhaps the issue may be solved? If you change
the pitch value, and you notice the angle of the diagonal edges in the image
change, the issue is almost certainly related to this pitch value.

I can't recall how the mainline kernel driver works now. If it also uses the
property mailbox to configure the display, and you're just using the dumb
simplefb driver, perhaps you can compare the memory layout parameters the
kernel uses when it's working to what U-Boot uses when it's not working.


The image is fixed. I can see when the Linux Kernel boots and the
console messages scroll across the screen.

Without my patch, u-boot detects the screen resolution as 1366x768 with
a pitch of 5504. With my patch, 1024x768 uses a pitch of 2048.

I reverted my u-boot patch and tried hard coding the pitch to the values
5376, 5632, 2048, 4096, and 6144 with no success. Once I read what the
pitch value does, I also tried 5464 (1366 x 4 (for 32bpp)) and 2732.


Is this related?


https://www.riscosopen.org/forum/forums/4/topics/6400?posts_per_page=25&posts_per_page_change=Change

(See "I think I've just fixed that")


https://www.riscosopen.org/viewer/revisions/logs?ident=1471703957-443671.html

(See the diff in the BCMVideo file)

Another thing to try might be to remove the SET_* operations from U-Boot's
property mailbox calls (I think the FW always initializes video out anyway,
so U-Boot doesn't need to set anything up), and simply invoke the relevant
GET_* operations to query where the buffer is and its size. IIRC I didn't do
that because you can only query certain information as a side-effect of
asking the FW to allocate a frame-buffer though (i.e. the info comes back in
a SET_xxx/ALLOCATE_xxx response message, but there's no GET_xxx to query the
data without modifying the configuration or re-allocating anythi

Re: [U-Boot] [PATCH] bootz/booti: relocate ramdisk if CONFIG_SYS_BOOT_RAMDISK_HIGH set

2017-01-23 Thread Rick Altherr
Whoops.  Thank you for catching that.

Reviewed-by: Rick Altherr 

On Mon, Jan 23, 2017 at 7:51 AM, Cédric Schieli  wrote:

> In commit c2e7e72, the ramdisk relocation code was moved from
> image_setup_linux to do_bootm, leaving the bootz and booti cases broken.
>
> This patch fixes both by adding the BOOTM_STATE_RAMDISK state in their
> call to do_bootm_states if CONFIG_SYS_BOOT_RAMDISK_HIGH is set.
>
> Signed-off-by: Cédric Schieli 
> ---
>
>  cmd/booti.c | 3 +++
>  cmd/bootz.c | 3 +++
>  2 files changed, 6 insertions(+)
>
> diff --git a/cmd/booti.c b/cmd/booti.c
> index 6c1c998..2d879f3 100644
> --- a/cmd/booti.c
> +++ b/cmd/booti.c
> @@ -132,6 +132,9 @@ int do_booti(cmd_tbl_t *cmdtp, int flag, int argc,
> char * const argv[])
>
> images.os.os = IH_OS_LINUX;
> ret = do_bootm_states(cmdtp, flag, argc, argv,
> +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
> + BOOTM_STATE_RAMDISK |
> +#endif
>   BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO
> |
>   BOOTM_STATE_OS_GO,
>   &images, 1);
> diff --git a/cmd/bootz.c b/cmd/bootz.c
> index 9648fe9..ceff01b 100644
> --- a/cmd/bootz.c
> +++ b/cmd/bootz.c
> @@ -76,6 +76,9 @@ int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char
> * const argv[])
>
> images.os.os = IH_OS_LINUX;
> ret = do_bootm_states(cmdtp, flag, argc, argv,
> +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
> + BOOTM_STATE_RAMDISK |
> +#endif
>   BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO
> |
>   BOOTM_STATE_OS_GO,
>   &images, 1);
> --
> 2.10.2
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: dts: imx53-cx9020: fix packetloss on fec_mxc

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 05:20:25PM +, linux-kernel-dev wrote:
> >From: Tom Rini [mailto:tr...@konsulko.com]
> >Sent: Montag, 23. Januar 2017 16:31
> >
> >On Mon, Jan 23, 2017 at 03:11:27PM +0100, linux-kernel-...@beckhoff.com
> >wrote:
> >
> >> From: Patrick Bruenn 
> >>
> >> The pinmuxing for i.MX53 FEC ethernet copied from
> >> /arch/arm/boot/dts/imx53-qsb-common.dtsi (at least until v4.9)
> >> was bad. It is different from the manual pinmuxing in
> >> /board/freescale/mx53loco/mx53loco.c which was used in
> >> cx9020 implementation previously before mainlining into u-boot.
> >> It seems the bug in imx53-qsb kernel device tree is hidden for so long,
> >> because it was never used, by the kernel driver.
> >>
> >> Signed-off-by: Patrick Bruenn 
> >
> >So in other words, the dts file is correct in current mainline kernel?
> >Or still pending?  Thanks!
> Sorry, no it is still pending. I just reported it to the kernel maintainers:
> https://mail-archive.com/linux-kernel@vger.kernel.org/msg1316717.html

Ah, OK.  I think we want get this in the release, but it can wait for
-rc3 or so, unless it gets ack'ed by the kernel folks sooner.  Please
keep us apprised, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 2/3] NXP: Introduce board/freescale/common/Kconfig and migrate CHAIN_OF_TRUST

2017-01-23 Thread york sun
On 01/22/2017 04:43 PM, Tom Rini wrote:
> Introduce board/freescale/common/Kconfig so that we have a single place
> for CONFIG options that are shared between ARM and PowerPC NXP platforms.
>
> Cc: York Sun 
> Signed-off-by: Tom Rini 
> ---
>  arch/arm/include/asm/fsl_secure_boot.h | 8 
>  arch/powerpc/include/asm/fsl_secure_boot.h | 5 -
>  board/freescale/b4860qds/Kconfig   | 2 ++
>  board/freescale/bsc9132qds/Kconfig | 2 ++
>  board/freescale/c29xpcie/Kconfig   | 2 ++
>  board/freescale/common/Kconfig | 4 
>  board/freescale/corenet_ds/Kconfig | 8 
>  board/freescale/ls1012afrdm/Kconfig| 2 ++
>  board/freescale/ls1012aqds/Kconfig | 2 ++
>  board/freescale/ls1012ardb/Kconfig | 2 ++
>  board/freescale/ls1021aiot/Kconfig | 2 ++
>  board/freescale/ls1021aqds/Kconfig | 2 ++
>  board/freescale/ls1021atwr/Kconfig | 2 ++
>  board/freescale/ls1043aqds/Kconfig | 2 ++
>  board/freescale/ls1043ardb/Kconfig | 2 ++
>  board/freescale/ls1046aqds/Kconfig | 2 ++
>  board/freescale/ls2080a/Kconfig| 4 
>  board/freescale/ls2080aqds/Kconfig | 2 ++
>  board/freescale/ls2080ardb/Kconfig | 2 ++
>  board/freescale/p1010rdb/Kconfig   | 2 ++
>  board/freescale/p2041rdb/Kconfig   | 2 ++
>  board/freescale/t102xqds/Kconfig   | 2 ++
>  board/freescale/t102xrdb/Kconfig   | 2 ++
>  board/freescale/t1040qds/Kconfig   | 2 ++
>  board/freescale/t104xrdb/Kconfig   | 2 ++
>  board/freescale/t208xqds/Kconfig   | 2 ++
>  board/freescale/t208xrdb/Kconfig   | 2 ++
>  board/freescale/t4qds/Kconfig  | 2 ++
>  board/freescale/t4rdb/Kconfig  | 2 ++
>  board/varisys/cyrus/Kconfig| 2 ++
>  30 files changed, 66 insertions(+), 13 deletions(-)
>  create mode 100644 board/freescale/common/Kconfig
>

Thanks. You beat me on this.

Reviewed-by: York Sun 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] mach-omap2: Cleanup secure boot media generation

2017-01-23 Thread Andrew F. Davis
Currently all secure media types of SPL are generated for all platforms,
all platforms do not need all types, only generate the media types valid
for each platform.

Signed-off-by: Andrew F. Davis 
---
 arch/arm/mach-omap2/config.mk | 38 --
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/config.mk b/arch/arm/mach-omap2/config.mk
index 20b555357a..af455366ed 100644
--- a/arch/arm/mach-omap2/config.mk
+++ b/arch/arm/mach-omap2/config.mk
@@ -6,34 +6,52 @@
 include  $(srctree)/arch/arm/mach-omap2/config_secure.mk
 
 ifdef CONFIG_SPL_BUILD
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
+ifeq ($(CONFIG_TI_SECURE_DEVICE),y) # Refer to README.ti-secure for more info
+# On DRA7xx/AM57xx:
+#
+# For booting spl from SD/MMC/eMMC use
+# u-boot-spl_HS_MLO
 #
-# For booting from SPI use
-# u-boot-spl_HS_SPI_X-LOADER to program flash
+# For booting spl over UART or USB use
+# u-boot-spl_HS_ULO
 #
+# For booting spl from QSPI or NOR use
+# u-boot-spl_HS_X-LOADER
+ifeq ($(CONFIG_OMAP54XX),y)
+ALL-y += u-boot-spl_HS_MLO
+ALL-y += u-boot-spl_HS_ULO
+ALL-y += u-boot-spl_HS_X-LOADER
+endif
 # On AM43XX:
 #
+# For booting spl from SPI flash use
+# u-boot-spl_HS_SPI_X-LOADER
+#
 # For booting spl from all other media use
 # u-boot-spl_HS_ISSW
-#
+ifeq ($(CONFIG_AM43XX),y)
+ALL-y += u-boot-spl_HS_SPI_X-LOADER
+ALL-y += u-boot-spl_HS_ISSW
+endif
 # On AM33XX:
 #
-# For booting spl from NAND flash use
+# For booting spl from SPI flash use
+# u-boot-spl_HS_SPI_X-LOADER
+#
+# For booting spl from NAND flash or raw SD/MMC/eMMC use
 # u-boot-spl_HS_X-LOADER
 #
-# For booting spl from SD/MMC/eMMC media use
+# For booting spl from a filesystem on SD/MMC/eMMC use
 # u-boot-spl_HS_MLO
 #
 # For booting spl over UART, USB, or Ethernet use
 # u-boot-spl_HS_2ND
-#
-# Refer to README.ti-secure for more info
-#
-ALL-y += u-boot-spl_HS_ISSW
+ifeq ($(CONFIG_AM33XX),y)
 ALL-y += u-boot-spl_HS_SPI_X-LOADER
 ALL-y += u-boot-spl_HS_X-LOADER
 ALL-y += u-boot-spl_HS_MLO
 ALL-y += u-boot-spl_HS_2ND
+endif
 else
 ALL-y += MLO
 ifeq ($(CONFIG_AM33XX),y)
-- 
2.11.0

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


Re: [U-Boot] [RFC PATCH 08/11] sunxi: SPL: add FIT config selector for Pine64 boards

2017-01-23 Thread Maxime Ripard
On Sat, Jan 21, 2017 at 03:15:27PM +, André Przywara wrote:
> >>> On Fri, Jan 20, 2017 at 01:53:28AM +, Andre Przywara wrote:  
>  For a board or platform to support FIT loading in the SPL, it has to
>  provide a board_fit_config_name_match() routine, which helps to select
>  one of possibly multiple DTBs contained in a FIT image.
>  Provide a simple function to cover the two different Pine64 models,
>  which can be easily told apart by looking at the amount of installed
>  RAM.
> 
>  Signed-off-by: Andre Przywara 
>  ---
>   board/sunxi/board.c | 13 +
>   1 file changed, 13 insertions(+)
> 
>  diff --git a/board/sunxi/board.c b/board/sunxi/board.c
>  index 5365638..826 100644
>  --- a/board/sunxi/board.c
>  +++ b/board/sunxi/board.c
>  @@ -726,3 +726,16 @@ int ft_board_setup(void *blob, bd_t *bd)
>   #endif
>   return 0;
>   }
>  +
>  +#ifdef CONFIG_SPL_LOAD_FIT
>  +int board_fit_config_name_match(const char *name)
>  +{
>  +#ifdef CONFIG_MACH_SUN50I
>  +if ((gd->ram_size > 512 * 1024 * 1024))
>  +return !strcmp(name, "sun50i-a64-pine64-plus");
>  +else
>  +return !strcmp(name, "sun50i-a64-pine64");
>  +#endif
>  +return -1;
>  +}  
> >>>
> >>> That looks fishy. It means that any A64 board with CONFIG_SPL_LOAD_FIT
> >>> enabled will be considered a pine64 board?  
> >>
> >> Yes, at least for now, because that's the only A64 board we officially
> >> support so far.
> >> And yes again, it is fishy. It is more a demo or a placeholder for now,
> >> because you _need_ an implementation of board_fit_config_name_match()
> >> once you enable CONFIG_SPL_LOAD_FIT.
> >>
> >> One solution would be to have only one DTB supported per build, so
> >> board_fit_config_name_match() always returns 0.
> >>
> >> Another (better) solution would be to store the board name in the SPL
> >> header, which could be done later when flashing the image. Then this
> >> function would just return strcmp(name, spl_header_name) or 0 if no name
> >> is found for whatever reason.
> > 
> > Yes, this is a good solution in the case if we have some non-removable
> > storage on the board (SPI NOR flash, NAND, EEPROM or something else).
> > We can discuss it separately.
> 
> I totally agree. I rebased your patch to latest mainline already and
> will send out something later.
> 
> > But the current generation of Pine64 boards don't have any
> > non-removable storage yet. My understanding is that you tried to
> > provide the DTB selection, which is based on circumstantial evidences,
> > such as the RAM size. IMHO this is also a valid selection method,
> > because it can reduce the number of required OS image variants.
> 
> Yes, the point is that for U-Boot's purposes the only difference between
> the Pine64 and Pine64+ (apart from DRAM size, which is autodetected) is
> using MII vs. RGMII for the Ethernet PHY. The sun8i_emac driver gets
> this information from the DT only, so there is no point at all for
> different defconfigs. And the DRAM size is a safe indicator for that
> difference, at least if we confine our view to Pine64 boards.
> 
> Now how other boards fit in here is a separate discussion IMO, so let's
> solve one problem after the other.
> I just thought that we could use:
> 
> #ifdef CONFIG_SPL_LOAD_FIT
> int board_fit_config_name_match(const char *name)
> {
>   return strcmp(name, CONFIG_DEFAULT_DEVICE_TREE);
> }
> #endif

I guess an easy way around this would be to add a Kconfig option for
the pine64, like I tried to do for the CHIP (but never ended up
merging). That way, at least we won't impact the other board, and we
can have that default.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: dts: imx53-cx9020: fix packetloss on fec_mxc

2017-01-23 Thread linux-kernel-dev
>From: Tom Rini [mailto:tr...@konsulko.com]
>Sent: Montag, 23. Januar 2017 16:31
>
>On Mon, Jan 23, 2017 at 03:11:27PM +0100, linux-kernel-...@beckhoff.com
>wrote:
>
>> From: Patrick Bruenn 
>>
>> The pinmuxing for i.MX53 FEC ethernet copied from
>> /arch/arm/boot/dts/imx53-qsb-common.dtsi (at least until v4.9)
>> was bad. It is different from the manual pinmuxing in
>> /board/freescale/mx53loco/mx53loco.c which was used in
>> cx9020 implementation previously before mainlining into u-boot.
>> It seems the bug in imx53-qsb kernel device tree is hidden for so long,
>> because it was never used, by the kernel driver.
>>
>> Signed-off-by: Patrick Bruenn 
>
>So in other words, the dts file is correct in current mainline kernel?
>Or still pending?  Thanks!
Sorry, no it is still pending. I just reported it to the kernel maintainers:
https://mail-archive.com/linux-kernel@vger.kernel.org/msg1316717.html

Patrick

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


Re: [U-Boot] [PATCH] tools: Correct python building host tools

2017-01-23 Thread Simon Glass
On 23 January 2017 at 09:44, Tom Rini  wrote:
> When we have python building tools for the host it will not check HOSTXX
> variables but only XX variables, for example LDFLAGS and not
> HOSTLDFLAGS.
>
> Cc: Simon Glass 
> Reported-by: Heiko Schocher 
> Fixes: 1905c8fc711a ("build: Always build the libfdt python module")
> Signed-off-by: Tom Rini 
> ---
>  tools/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/Makefile b/tools/Makefile
> index a609d058595b..cefcedf683ca 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -117,7 +117,8 @@ _libfdt.so-sharedobjs += $(LIBFDT_OBJS)
>  libfdt:
>
>  tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c
> -   python $(srctree)/lib/libfdt/setup.py "$(_hostc_flags)" $^
> +   LDFLAGS="$(HOSTLDFLAGS)" python $(srctree)/lib/libfdt/setup.py \
> +   "$(_hostc_flags)" $^
> mv _libfdt.so $@
>
>  tools/libfdt_wrap.c: $(srctree)/lib/libfdt/libfdt.swig
> --
> 1.9.1
>

Reviewed-by: Simon Glass 
Tested on 5 PowerPC builds:
Tested-by: Simon Glass 

Thanks Tom!

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


Re: [U-Boot] [PATCH 2/3] ARM: am335x: Add support for chiliSOM

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 05:27:09PM +0100, Marcin Niestroj wrote:
> Hi,
> Thanks for review! See my comment below.
> 
> On 23.01.2017 16:56, Tom Rini wrote:
> >On Mon, Jan 23, 2017 at 02:39:15PM +0100, Marcin Niestroj wrote:
> >
> >>chiliSOM is a System On Module (http://http://grinn-global.com/chilisom/).
> >>It can't exists on its own, but will be used as part of other boards.
> >>
> >>Hardware specification:
> >> * TI AM335x processor
> >> * 128M, 256M or 512M DDR3 memory
> >> * up to 256M NAND
> >>
> >>Here we treat SOM similar to SOC, so we place it inside arch/arm/mach-*
> >>directory and make it possible to reuse initialization code (i.e. DDR,
> >>NAND init) for all boards that use it. This approach is similar as for
> >>liteSOM module.
> >>
> >>Signed-off-by: Marcin Niestroj 
> >>---
> >> arch/arm/Kconfig   |   2 +
> >> arch/arm/Makefile  |   1 +
> >> arch/arm/mach-chilisom/Kconfig |   4 +
> >> arch/arm/mach-chilisom/Makefile|   6 +
> >> arch/arm/mach-chilisom/chilisom.c  | 185 
> >> +
> >> arch/arm/mach-chilisom/include/mach/chilisom.h |  15 ++
> >> 6 files changed, 213 insertions(+)
> >
> >These don't belong in a new mach directory, this should end up in
> >board/grinn/common/ instead, thanks!
> >
> 
> This will work for all grinn boards. But the idea is that some other
> vendor can make a board that will use chilisom as it's base. And in
> that case sources from board/grinn/common/ directory won't compile.
> Do you have any idea how to bypass this restriction?

Good question.  I think the full answer here is that oops,
arch/arm/mach-litesom shouldn't have been ACK'd as other SoMs (say
board/solidrun/mx6cuboxi/) just keep everything central to the board
directory and expect that derivations will just copy the directory and
edit in-place.  That said, that is indeed not optimal, especially since
you've already done the leg-work to split things for SoM and carrier.
Perhaps arch/arm/mach-omap2/am33xx/chilisom.c (depends on
CONFIG_AM33XX_CHILISOM, which gets select'd by the boards in question).
And then a similar change for mach-litesom into arch/arm/cpu/armv7/mx6/
(which will get moved to arch/arm/mach-imx at some point I believe).
Thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2] rpi: Fix device tree path on ARM64

2017-01-23 Thread Stephen Warren

On 01/22/2017 04:34 PM, Tuomas Tynkkynen wrote:

The directory structure of device tree files produced by the kernel's
'make dtbs_install' is different on ARM64, the RPi3 device tree file is
in a 'broadcom' subdirectory there.


Acked-by: Stephen Warren 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] tools: Correct python building host tools

2017-01-23 Thread Tom Rini
When we have python building tools for the host it will not check HOSTXX
variables but only XX variables, for example LDFLAGS and not
HOSTLDFLAGS.

Cc: Simon Glass 
Reported-by: Heiko Schocher 
Fixes: 1905c8fc711a ("build: Always build the libfdt python module")
Signed-off-by: Tom Rini 
---
 tools/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/Makefile b/tools/Makefile
index a609d058595b..cefcedf683ca 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -117,7 +117,8 @@ _libfdt.so-sharedobjs += $(LIBFDT_OBJS)
 libfdt:
 
 tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c
-   python $(srctree)/lib/libfdt/setup.py "$(_hostc_flags)" $^
+   LDFLAGS="$(HOSTLDFLAGS)" python $(srctree)/lib/libfdt/setup.py \
+   "$(_hostc_flags)" $^
mv _libfdt.so $@
 
 tools/libfdt_wrap.c: $(srctree)/lib/libfdt/libfdt.swig
-- 
1.9.1

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


Re: [U-Boot] ext4: crash when writing a file

2017-01-23 Thread Brüns , Stefan
On Freitag, 20. Januar 2017 18:32:49 CET Sébastien Szymanski wrote:
[...]
> Then under the sandbox I do the following:
> 
> U-Boot 2017.01-2-g558e41e-dirty (Jan 20 2017 - 16:19:47 +0100)
> 
> DRAM:  256 MiB
> MMC:
> Using default environment
> 
> In:serial
> Out:   serial
> Err:   serial
> SCSI:  Net:   No ethernet found.
> IDE:   Bus 0: not available
> 
> => host bind 0 /tftproot/rootfs.raw
> 
> => ls host 0:2
>1024 .
>1024 ..
>   16384 lost+found
>1024 var
>1024 run
>1024 root
>1024 media
>1024 mnt
>1024 tmp
>   3 lib32
>1024 usr
>1024 proc
>1024 dev
>1024 boot
>1024 sys
>3072 sbin
>3072 bin
>  11 linuxrc
>1024 etc
>1024 opt
>3072 lib
> 
> => ls host 0:2 /boot
>1024 .
>1024 ..
>26909 imx6ul-opos6uldev.dtb
>   1 dtbs
>  5359984 opos6ul-linux.bin
> 
> => host load hostfs - 0 /tftproot/opos6ul-linux.bin
> 5359984 bytes read in 2 ms (2.5 GiB/s)
> 
> => printenv filesize
> filesize=51c970
> 
> => ext4write host 0:2 0 /boot/opos6ul-linux.bin ${filesize}
> File System is consistent
> file found, deleting
> update journal finished
> File System is consistent
> update journal finished
> Segmentation fault

As you can repeat this under sandbox, the next step would be to run sandbox 
under gdb, e.g.:
$> gdb --args sandbox -c "host bind 0 /tftproot/rootfs.raw ; host load hostfs 
- 0 /tftproot/opos6ul-linux.bin ; ext4write host 0:2 0 /boot/opos6ul-linux.bin 
${filesize}"

Kind regards,

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


Re: [U-Boot] [PATCH 2/3] ARM: am335x: Add support for chiliSOM

2017-01-23 Thread Marcin Niestroj

Hi,
Thanks for review! See my comment below.

On 23.01.2017 16:56, Tom Rini wrote:

On Mon, Jan 23, 2017 at 02:39:15PM +0100, Marcin Niestroj wrote:


chiliSOM is a System On Module (http://http://grinn-global.com/chilisom/).
It can't exists on its own, but will be used as part of other boards.

Hardware specification:
 * TI AM335x processor
 * 128M, 256M or 512M DDR3 memory
 * up to 256M NAND

Here we treat SOM similar to SOC, so we place it inside arch/arm/mach-*
directory and make it possible to reuse initialization code (i.e. DDR,
NAND init) for all boards that use it. This approach is similar as for
liteSOM module.

Signed-off-by: Marcin Niestroj 
---
 arch/arm/Kconfig   |   2 +
 arch/arm/Makefile  |   1 +
 arch/arm/mach-chilisom/Kconfig |   4 +
 arch/arm/mach-chilisom/Makefile|   6 +
 arch/arm/mach-chilisom/chilisom.c  | 185 +
 arch/arm/mach-chilisom/include/mach/chilisom.h |  15 ++
 6 files changed, 213 insertions(+)


These don't belong in a new mach directory, this should end up in
board/grinn/common/ instead, thanks!



This will work for all grinn boards. But the idea is that some other
vendor can make a board that will use chilisom as it's base. And in
that case sources from board/grinn/common/ directory won't compile.
Do you have any idea how to bypass this restriction?

--
Marcin Niestroj
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/4] kconfig: Add API kconfig file

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 05:05:50PM +0100, Emmanuel Vadot wrote:
> 
>  Hi Tom,
> 
> On Mon, 23 Jan 2017 09:51:59 -0500
> Tom Rini  wrote:
> 
> > On Sat, Jan 21, 2017 at 09:22:47PM -0700, Warner Losh wrote:
> > > On Fri, Jan 20, 2017 at 8:51 PM, Simon Glass  wrote:
> > > > Hi,
> > > >
> > > > On 17 January 2017 at 08:50, Emmanuel Vadot  
> > > > wrote:
> > > >> Add kconfig file to enable API support
> > > >>
> > > >> Signed-off-by: Emmanuel Vadot 
> > > >> ---
> > > >>  Kconfig | 2 ++
> > > >>  api/Kconfig | 9 +
> > > >>  2 files changed, 11 insertions(+)
> > > >>  create mode 100644 api/Kconfig
> > > >>
> > > >> diff --git a/Kconfig b/Kconfig
> > > >> index 39a4d938d8..6a93d8820f 100644
> > > >> --- a/Kconfig
> > > >> +++ b/Kconfig
> > > >> @@ -306,6 +306,8 @@ config ARCH_FIXUP_FDT_MEMORY
> > > >>
> > > >>  endmenu# Boot images
> > > >>
> > > >> +source "api/Kconfig"
> > > >> +
> > > >>  source "common/Kconfig"
> > > >>
> > > >>  source "cmd/Kconfig"
> > > >> diff --git a/api/Kconfig b/api/Kconfig
> > > >> new file mode 100644
> > > >> index 00..88b4f6c4e5
> > > >> --- /dev/null
> > > >> +++ b/api/Kconfig
> > > >> @@ -0,0 +1,9 @@
> > > >> +menu "API"
> > > >> +
> > > >> +config API
> > > >> +   bool "Enable U-Boot API"
> > > >> +   default n
> > > >> +   help
> > > >> + This option enable the U-Boot API.
> > > >
> > > > Can you add a little detail about what the API is and what it is for?
> > > 
> > > You can find complete documentation in the api directory. In brief, it
> > > allows the loaded binary to call back into the loader to do generic
> > > things like send network packets or read blocks from mass storage.
> > 
> > Right.  Can you re-word the "In brief.." slightly so it reads well under
> > the 'help' section and point to api/README for more details please?
> 
>  All right, I'll do that for v3.
> 
> > > > Also, are you going to migrate all boards to use Kconfig for this
> > > > option and drop it from the whitelist?
> > > 
> > > I'll leave that to Emmanuel.
> > 
> > There's two boards that enable API today but tools/moveconfig.py may be
> > more overhead than just editing configs/PMC440_defconfig and
> > configs/lsxhl_defconfig (and the respective include/configs/ files).
> 
>  Ah, I've missed those. Would it make more sense to submit a patch that
> handle adding CONFIG_API into Kconfig (and changing configs for those
> two board and remove from the whitelist) separate from the FreeBSD
> config sets of patches ?

It's up to you guys.  I want to see this thread sorted out and changes
required to support FreeBSD happily, out of the box, in.  So API gets
converted one way or another :)

-- 
Tom


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


Re: [U-Boot] [PATCH v2 1/4] kconfig: Add API kconfig file

2017-01-23 Thread Emmanuel Vadot

 Hi Tom,

On Mon, 23 Jan 2017 09:51:59 -0500
Tom Rini  wrote:

> On Sat, Jan 21, 2017 at 09:22:47PM -0700, Warner Losh wrote:
> > On Fri, Jan 20, 2017 at 8:51 PM, Simon Glass  wrote:
> > > Hi,
> > >
> > > On 17 January 2017 at 08:50, Emmanuel Vadot  wrote:
> > >> Add kconfig file to enable API support
> > >>
> > >> Signed-off-by: Emmanuel Vadot 
> > >> ---
> > >>  Kconfig | 2 ++
> > >>  api/Kconfig | 9 +
> > >>  2 files changed, 11 insertions(+)
> > >>  create mode 100644 api/Kconfig
> > >>
> > >> diff --git a/Kconfig b/Kconfig
> > >> index 39a4d938d8..6a93d8820f 100644
> > >> --- a/Kconfig
> > >> +++ b/Kconfig
> > >> @@ -306,6 +306,8 @@ config ARCH_FIXUP_FDT_MEMORY
> > >>
> > >>  endmenu# Boot images
> > >>
> > >> +source "api/Kconfig"
> > >> +
> > >>  source "common/Kconfig"
> > >>
> > >>  source "cmd/Kconfig"
> > >> diff --git a/api/Kconfig b/api/Kconfig
> > >> new file mode 100644
> > >> index 00..88b4f6c4e5
> > >> --- /dev/null
> > >> +++ b/api/Kconfig
> > >> @@ -0,0 +1,9 @@
> > >> +menu "API"
> > >> +
> > >> +config API
> > >> +   bool "Enable U-Boot API"
> > >> +   default n
> > >> +   help
> > >> + This option enable the U-Boot API.
> > >
> > > Can you add a little detail about what the API is and what it is for?
> > 
> > You can find complete documentation in the api directory. In brief, it
> > allows the loaded binary to call back into the loader to do generic
> > things like send network packets or read blocks from mass storage.
> 
> Right.  Can you re-word the "In brief.." slightly so it reads well under
> the 'help' section and point to api/README for more details please?

 All right, I'll do that for v3.

> > > Also, are you going to migrate all boards to use Kconfig for this
> > > option and drop it from the whitelist?
> > 
> > I'll leave that to Emmanuel.
> 
> There's two boards that enable API today but tools/moveconfig.py may be
> more overhead than just editing configs/PMC440_defconfig and
> configs/lsxhl_defconfig (and the respective include/configs/ files).
> 
> -- 
> Tom

 Ah, I've missed those. Would it make more sense to submit a patch that
handle adding CONFIG_API into Kconfig (and changing configs for those
two board and remove from the whitelist) separate from the FreeBSD
config sets of patches ?

 Thanks,


-- 
Emmanuel Vadot  
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] board/chiliboard: Add support for chiliBoard

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 02:39:16PM +0100, Marcin Niestroj wrote:

> chiliBoard is a development board which uses chiliSOM as its base.
> 
> Hardware specification:
>  * chiliSOM (TI AM335x, DRAM, NAND)
>  * Ethernet PHY (id 0)
>  * USB host (usb1)
>  * MicroSD slot (mmc0)
> 
> Signed-off-by: Marcin Niestroj 
[snip]
> +++ b/include/configs/chiliboard.h
> @@ -0,0 +1,230 @@
> +/*
> + * chiliboard.h
> + *
> + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
> + * Copyright (C) 2017 Grinn - http://grinn-global.com/
> + *
> + * This program 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 version 2.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether express or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */

Need to convert to the SPDX header format here, thanks!

-- 
Tom


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


Re: [U-Boot] U-Boot 2017-01 "-ansi" issue with cygwin 2.6.1

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 01:15:56AM -0700, Raph31 wrote:

> Hello all,
> 
> I'm trying to compile U-boot 2017.01 (Release) Under Cygwin 2.6.1 for  a
> BeagleBoneBlack target.
> 
> I was facing the issue with a lot of error about the "inline" keyword. This
> keyword is not supported with the "-ansi" option. After removing this option
> in the makefile, the compile is successful.
> 
> It seems that this is a known error since more than 3-4 years. The question
> is : Why the "-ansi" option is still part of the Makefile for a Cygwin
> environment?
> 
> Thanks for your answer. If I am on the wrong way, let me know, I will really
> appreciate.

I think because, generally, no one has sent a proper patch to remove it.
Please see http://www.denx.de/wiki/U-Boot/Patches thanks!

-- 
Tom


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


Re: [U-Boot] Linux fails to boot since commit c2e7e72

2017-01-23 Thread Cédric Schieli
Hi,

2017-01-23 9:08 GMT+01:00 Masahiro Yamada :

> Hi.
>
> Today, I noticed Linux fails to mount initramdisk
> on my boards.
>
> I found I could solve the issue by reverting the following commit:
>
> commit c2e7e72bb9f0cb47d024997b381cb64786eb5402
> Author: Rick Altherr 
> Date:   Wed Jan 18 17:12:24 2017 -0800
>
> bootm: relocate ramdisk if CONFIG_SYS_BOOT_RAMDISK_HIGH set
>
>
>
> I have not figured out the detail yet.
>

If you're using either bootz or booti to boot your kernel, your problem may
be addressed by the patch [1] I've posted a few minutes ago.

[1] http://lists.denx.de/pipermail/u-boot/2017-January/279126.html

Regards,
Cédric
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] ARM: am335x: Add support for chiliSOM

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 02:39:15PM +0100, Marcin Niestroj wrote:

> chiliSOM is a System On Module (http://http://grinn-global.com/chilisom/).
> It can't exists on its own, but will be used as part of other boards.
> 
> Hardware specification:
>  * TI AM335x processor
>  * 128M, 256M or 512M DDR3 memory
>  * up to 256M NAND
> 
> Here we treat SOM similar to SOC, so we place it inside arch/arm/mach-*
> directory and make it possible to reuse initialization code (i.e. DDR,
> NAND init) for all boards that use it. This approach is similar as for
> liteSOM module.
> 
> Signed-off-by: Marcin Niestroj 
> ---
>  arch/arm/Kconfig   |   2 +
>  arch/arm/Makefile  |   1 +
>  arch/arm/mach-chilisom/Kconfig |   4 +
>  arch/arm/mach-chilisom/Makefile|   6 +
>  arch/arm/mach-chilisom/chilisom.c  | 185 
> +
>  arch/arm/mach-chilisom/include/mach/chilisom.h |  15 ++
>  6 files changed, 213 insertions(+)

These don't belong in a new mach directory, this should end up in
board/grinn/common/ instead, thanks!

-- 
Tom


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


[U-Boot] [PATCH] bootz/booti: relocate ramdisk if CONFIG_SYS_BOOT_RAMDISK_HIGH set

2017-01-23 Thread Cédric Schieli
In commit c2e7e72, the ramdisk relocation code was moved from
image_setup_linux to do_bootm, leaving the bootz and booti cases broken.

This patch fixes both by adding the BOOTM_STATE_RAMDISK state in their
call to do_bootm_states if CONFIG_SYS_BOOT_RAMDISK_HIGH is set.

Signed-off-by: Cédric Schieli 
---

 cmd/booti.c | 3 +++
 cmd/bootz.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/cmd/booti.c b/cmd/booti.c
index 6c1c998..2d879f3 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -132,6 +132,9 @@ int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
images.os.os = IH_OS_LINUX;
ret = do_bootm_states(cmdtp, flag, argc, argv,
+#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
+ BOOTM_STATE_RAMDISK |
+#endif
  BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
  BOOTM_STATE_OS_GO,
  &images, 1);
diff --git a/cmd/bootz.c b/cmd/bootz.c
index 9648fe9..ceff01b 100644
--- a/cmd/bootz.c
+++ b/cmd/bootz.c
@@ -76,6 +76,9 @@ int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
images.os.os = IH_OS_LINUX;
ret = do_bootm_states(cmdtp, flag, argc, argv,
+#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
+ BOOTM_STATE_RAMDISK |
+#endif
  BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
  BOOTM_STATE_OS_GO,
  &images, 1);
-- 
2.10.2

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


[U-Boot] [PATCH 2/2][v3] arch: arm: update the IFC IP input clock

2017-01-23 Thread Prabhakar Kushwaha
IFC IP clock is always a constant divisor of platform clock
pre-defined per SoC. Clock control register (CCR) used in
current implementation governs IFC IP output clock.

So update IFC IP clock to be defined as per predefined clock
divisor of platform clock.

Signed-off-by: Prabhakar Kushwaha 
---
 Changes for v2: Split the patch in 2 patch set
 Changes for v3: Rebased on top of u-boot commit

 arch/arm/cpu/armv7/ls102xa/clock.c  |  9 +
 arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 10 ++
 arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c | 10 ++
 3 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/arch/arm/cpu/armv7/ls102xa/clock.c 
b/arch/arm/cpu/armv7/ls102xa/clock.c
index 7a337e1..b7d61ad 100644
--- a/arch/arm/cpu/armv7/ls102xa/clock.c
+++ b/arch/arm/cpu/armv7/ls102xa/clock.c
@@ -19,10 +19,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void get_sys_info(struct sys_info *sys_info)
 {
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
-#ifdef CONFIG_FSL_IFC
-   struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
-   u32 ccr;
-#endif
struct ccsr_clk *clk = (void *)(CONFIG_SYS_FSL_LS1_CLK_ADDR);
unsigned int cpu;
const u8 core_cplx_pll[6] = {
@@ -74,10 +70,7 @@ void get_sys_info(struct sys_info *sys_info)
}
 
 #if defined(CONFIG_FSL_IFC)
-   ccr = in_be32(&ifc_regs.gregs->ifc_ccr);
-   ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
-
-   sys_info->freq_localbus = sys_info->freq_systembus / ccr;
+   sys_info->freq_localbus = sys_info->freq_systembus;
 #endif
 }
 
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
index 3da7037..2d7775e 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
@@ -22,10 +22,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void get_sys_info(struct sys_info *sys_info)
 {
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
-#ifdef CONFIG_FSL_IFC
-   struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
-   u32 ccr;
-#endif
 #if (defined(CONFIG_FSL_ESDHC) &&\
defined(CONFIG_FSL_ESDHC_USE_PERIPHERAL_CLK)) ||\
defined(CONFIG_SYS_DPAA_FMAN)
@@ -156,10 +152,8 @@ void get_sys_info(struct sys_info *sys_info)
 #endif
 
 #if defined(CONFIG_FSL_IFC)
-   ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
-   ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
-
-   sys_info->freq_localbus = sys_info->freq_systembus / ccr;
+   sys_info->freq_localbus = sys_info->freq_systembus /
+   CONFIG_SYS_FSL_IFC_CLK_DIV;
 #endif
 }
 
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
index f8fefc7..ab46431 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
@@ -26,10 +26,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void get_sys_info(struct sys_info *sys_info)
 {
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
-#ifdef CONFIG_FSL_IFC
-   struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
-   u32 ccr;
-#endif
struct ccsr_clk_cluster_group __iomem *clk_grp[2] = {
(void *)(CONFIG_SYS_FSL_CH3_CLK_GRPA_ADDR),
(void *)(CONFIG_SYS_FSL_CH3_CLK_GRPB_ADDR)
@@ -128,10 +124,8 @@ void get_sys_info(struct sys_info *sys_info)
}
 
 #if defined(CONFIG_FSL_IFC)
-   ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
-   ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
-
-   sys_info->freq_localbus = sys_info->freq_systembus / ccr;
+   sys_info->freq_localbus = sys_info->freq_systembus /
+   CONFIG_SYS_FSL_IFC_CLK_DIV;
 #endif
 }
 
-- 
2.7.4


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


[U-Boot] [PATCH 1/2][v3] arch: powerpc: update the IFC IP input clock

2017-01-23 Thread Prabhakar Kushwaha
IFC IP clock is always a constant divisor of platform clock
pre-defined per SoC. Clock control register (CCR) used in
current implementation governs IFC IP output clock.

So update IFC IP clock to be defined as per predefined clock
divisor of platform clock.

Signed-off-by: Prabhakar Kushwaha 
---
 Changes for v2: Split the patch in 2 patch set
 Changes for v3: Rebased on top of u-boot commit


 README   |  3 +++
 arch/powerpc/cpu/mpc85xx/Kconfig | 21 +
 arch/powerpc/cpu/mpc85xx/speed.c | 10 ++
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/README b/README
index a95348a..9fda381 100644
--- a/README
+++ b/README
@@ -504,6 +504,9 @@ The following options need to be configured:
CONFIG_SYS_FSL_IFC_LE
Defines the IFC controller register space as Little Endian
 
+   CONFIG_SYS_FSL_IFC_CLK_DIV
+   Defines divider of platform clock(clock input to IFC 
controller).
+
CONFIG_SYS_FSL_PBL_PBI
It enables addition of RCW (Power on reset configuration) in 
built image.
Please refer doc/README.pblimage for more details
diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig
index 704f65b..bbe6d69 100644
--- a/arch/powerpc/cpu/mpc85xx/Kconfig
+++ b/arch/powerpc/cpu/mpc85xx/Kconfig
@@ -1248,6 +1248,27 @@ config SYS_PPC_E500_DEBUG_TLB
 symbol should be set to the TLB1 entry to be used for this
 purpose. If unsure, do not change.
 
+config SYS_FSL_IFC_CLK_DIV
+   int "Divider of platform clock"
+   depends on FSL_IFC
+   default 2 ifARCH_B4420  || \
+   ARCH_B4860  || \
+   ARCH_T1024  || \
+   ARCH_T1023  || \
+   ARCH_T1040  || \
+   ARCH_T1042  || \
+   ARCH_T4160  || \
+   ARCH_T4240
+   default 1 ifARCH_BSC9131|| \
+   ARCH_BSC9132|| \
+   ARCH_C29X   || \
+   ARCH_P1010  || \
+   ARCH_T2080  || \
+   ARCH_T2081
+   help
+   Defines divider of platform clock(clock input to
+   IFC controller).
+
 source "board/freescale/b4860qds/Kconfig"
 source "board/freescale/bsc9131rdb/Kconfig"
 source "board/freescale/bsc9132qds/Kconfig"
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index fcf5d92..adba092 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -27,10 +27,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void get_sys_info(sys_info_t *sys_info)
 {
volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-#ifdef CONFIG_FSL_IFC
-   struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
-   u32 ccr;
-#endif
 #ifdef CONFIG_FSL_CORENET
volatile ccsr_clk_t *clk = (void *)(CONFIG_SYS_FSL_CORENET_CLK_ADDR);
unsigned int cpu;
@@ -640,10 +636,8 @@ void get_sys_info(sys_info_t *sys_info)
 #endif
 
 #if defined(CONFIG_FSL_IFC)
-   ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
-   ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
-
-   sys_info->freq_localbus = sys_info->freq_systembus / ccr;
+   sys_info->freq_localbus = sys_info->freq_systembus /
+   CONFIG_SYS_FSL_IFC_CLK_DIV;
 #endif
 }
 
-- 
2.7.4


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


[U-Boot] U-Boot 2017-01 "-ansi" issue with cygwin 2.6.1

2017-01-23 Thread Raph31
Hello all,

I'm trying to compile U-boot 2017.01 (Release) Under Cygwin 2.6.1 for  a
BeagleBoneBlack target.

I was facing the issue with a lot of error about the "inline" keyword. This
keyword is not supported with the "-ansi" option. After removing this option
in the makefile, the compile is successful.

It seems that this is a known error since more than 3-4 years. The question
is : Why the "-ansi" option is still part of the Makefile for a Cygwin
environment?

Thanks for your answer. If I am on the wrong way, let me know, I will really
appreciate.

Raphaël.



--
View this message in context: 
http://u-boot.10912.n7.nabble.com/U-Boot-2017-01-ansi-issue-with-cygwin-2-6-1-tp279500.html
Sent from the U-Boot mailing list archive at Nabble.com.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: dts: imx53-cx9020: fix packetloss on fec_mxc

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 03:11:27PM +0100, linux-kernel-...@beckhoff.com wrote:

> From: Patrick Bruenn 
> 
> The pinmuxing for i.MX53 FEC ethernet copied from
> /arch/arm/boot/dts/imx53-qsb-common.dtsi (at least until v4.9)
> was bad. It is different from the manual pinmuxing in
> /board/freescale/mx53loco/mx53loco.c which was used in
> cx9020 implementation previously before mainlining into u-boot.
> It seems the bug in imx53-qsb kernel device tree is hidden for so long,
> because it was never used, by the kernel driver.
> 
> Signed-off-by: Patrick Bruenn 

So in other words, the dts file is correct in current mainline kernel?
Or still pending?  Thanks!

-- 
Tom


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


[U-Boot] [PATCH 2/2][v4] arch: arm: update the IFC IP input clock

2017-01-23 Thread Prabhakar Kushwaha
IFC IP clock is always a constant divisor of platform clock
pre-defined per SoC. Clock control register (CCR) used in
current implementation governs IFC IP output clock.

So update IFC IP clock to be defined as per predefined clock
divisor of platform clock.

Signed-off-by: Prabhakar Kushwaha 
---
Changes for v2: Split the patch in 2 patch set
Changes for v3: Rebased on top of u-boot commit
Changes for v4: Sending as it is

 arch/arm/cpu/armv7/ls102xa/clock.c  |  9 +
 arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 10 ++
 arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c | 10 ++
 3 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/arch/arm/cpu/armv7/ls102xa/clock.c 
b/arch/arm/cpu/armv7/ls102xa/clock.c
index 7a337e1..b7d61ad 100644
--- a/arch/arm/cpu/armv7/ls102xa/clock.c
+++ b/arch/arm/cpu/armv7/ls102xa/clock.c
@@ -19,10 +19,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void get_sys_info(struct sys_info *sys_info)
 {
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
-#ifdef CONFIG_FSL_IFC
-   struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
-   u32 ccr;
-#endif
struct ccsr_clk *clk = (void *)(CONFIG_SYS_FSL_LS1_CLK_ADDR);
unsigned int cpu;
const u8 core_cplx_pll[6] = {
@@ -74,10 +70,7 @@ void get_sys_info(struct sys_info *sys_info)
}
 
 #if defined(CONFIG_FSL_IFC)
-   ccr = in_be32(&ifc_regs.gregs->ifc_ccr);
-   ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
-
-   sys_info->freq_localbus = sys_info->freq_systembus / ccr;
+   sys_info->freq_localbus = sys_info->freq_systembus;
 #endif
 }
 
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
index 3da7037..2d7775e 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
@@ -22,10 +22,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void get_sys_info(struct sys_info *sys_info)
 {
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
-#ifdef CONFIG_FSL_IFC
-   struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
-   u32 ccr;
-#endif
 #if (defined(CONFIG_FSL_ESDHC) &&\
defined(CONFIG_FSL_ESDHC_USE_PERIPHERAL_CLK)) ||\
defined(CONFIG_SYS_DPAA_FMAN)
@@ -156,10 +152,8 @@ void get_sys_info(struct sys_info *sys_info)
 #endif
 
 #if defined(CONFIG_FSL_IFC)
-   ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
-   ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
-
-   sys_info->freq_localbus = sys_info->freq_systembus / ccr;
+   sys_info->freq_localbus = sys_info->freq_systembus /
+   CONFIG_SYS_FSL_IFC_CLK_DIV;
 #endif
 }
 
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
index f8fefc7..ab46431 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
@@ -26,10 +26,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void get_sys_info(struct sys_info *sys_info)
 {
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
-#ifdef CONFIG_FSL_IFC
-   struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
-   u32 ccr;
-#endif
struct ccsr_clk_cluster_group __iomem *clk_grp[2] = {
(void *)(CONFIG_SYS_FSL_CH3_CLK_GRPA_ADDR),
(void *)(CONFIG_SYS_FSL_CH3_CLK_GRPB_ADDR)
@@ -128,10 +124,8 @@ void get_sys_info(struct sys_info *sys_info)
}
 
 #if defined(CONFIG_FSL_IFC)
-   ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
-   ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
-
-   sys_info->freq_localbus = sys_info->freq_systembus / ccr;
+   sys_info->freq_localbus = sys_info->freq_systembus /
+   CONFIG_SYS_FSL_IFC_CLK_DIV;
 #endif
 }
 
-- 
2.7.4


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


[U-Boot] [PATCH 1/2][v4] arch: powerpc: update the IFC IP input clock

2017-01-23 Thread Prabhakar Kushwaha
IFC IP clock is always a constant divisor of platform clock
pre-defined per SoC. Clock control register (CCR) used in
current implementation governs IFC IP output clock.

So update IFC IP clock to be defined as per predefined clock
divisor of platform clock.

Signed-off-by: Prabhakar Kushwaha 
---
Changes for v2: Split the patch in 2 patch set
Changes for v3: Rebased on top of u-boot commit
Changes for v4: fix compilation error

 README   |  3 +++
 arch/powerpc/cpu/mpc85xx/Kconfig | 20 
 arch/powerpc/cpu/mpc85xx/speed.c | 10 ++
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/README b/README
index a95348a..9fda381 100644
--- a/README
+++ b/README
@@ -504,6 +504,9 @@ The following options need to be configured:
CONFIG_SYS_FSL_IFC_LE
Defines the IFC controller register space as Little Endian
 
+   CONFIG_SYS_FSL_IFC_CLK_DIV
+   Defines divider of platform clock(clock input to IFC 
controller).
+
CONFIG_SYS_FSL_PBL_PBI
It enables addition of RCW (Power on reset configuration) in 
built image.
Please refer doc/README.pblimage for more details
diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig
index 704f65b..697d1a8 100644
--- a/arch/powerpc/cpu/mpc85xx/Kconfig
+++ b/arch/powerpc/cpu/mpc85xx/Kconfig
@@ -1248,6 +1248,26 @@ config SYS_PPC_E500_DEBUG_TLB
 symbol should be set to the TLB1 entry to be used for this
 purpose. If unsure, do not change.
 
+config SYS_FSL_IFC_CLK_DIV
+   int "Divider of platform clock"
+   default 2 ifARCH_B4420  || \
+   ARCH_B4860  || \
+   ARCH_T1024  || \
+   ARCH_T1023  || \
+   ARCH_T1040  || \
+   ARCH_T1042  || \
+   ARCH_T4160  || \
+   ARCH_T4240
+   default 1 ifARCH_BSC9131|| \
+   ARCH_BSC9132|| \
+   ARCH_C29X   || \
+   ARCH_P1010  || \
+   ARCH_T2080  || \
+   ARCH_T2081
+   help
+   Defines divider of platform clock(clock input to
+   IFC controller).
+
 source "board/freescale/b4860qds/Kconfig"
 source "board/freescale/bsc9131rdb/Kconfig"
 source "board/freescale/bsc9132qds/Kconfig"
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index fcf5d92..adba092 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -27,10 +27,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void get_sys_info(sys_info_t *sys_info)
 {
volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-#ifdef CONFIG_FSL_IFC
-   struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
-   u32 ccr;
-#endif
 #ifdef CONFIG_FSL_CORENET
volatile ccsr_clk_t *clk = (void *)(CONFIG_SYS_FSL_CORENET_CLK_ADDR);
unsigned int cpu;
@@ -640,10 +636,8 @@ void get_sys_info(sys_info_t *sys_info)
 #endif
 
 #if defined(CONFIG_FSL_IFC)
-   ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
-   ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
-
-   sys_info->freq_localbus = sys_info->freq_systembus / ccr;
+   sys_info->freq_localbus = sys_info->freq_systembus /
+   CONFIG_SYS_FSL_IFC_CLK_DIV;
 #endif
 }
 
-- 
2.7.4


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


[U-Boot] [PATCH v2] spi: ich: Configure SPI BIOS parameters

2017-01-23 Thread Stefan Roese
Without configuring these registers in the SPI controller, the Linux
MTD device driver is not able to correctly read/write to the SPI
NOR chip at all. In fact, the chip is not detected at all.

Signed-off-by: Stefan Roese 
Cc: Bin Meng 
Cc: Simon Glass 
Cc: Jagan Teki 
---
v2:
- Moved code into the ICH SPI driver as suggested by Simon and Bin

 drivers/spi/ich.c | 51 +++
 1 file changed, 51 insertions(+)

diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index caf0103dc3..586b4e9024 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -18,6 +18,39 @@
 
 #include "ich.h"
 
+#define SPI_OPMENU_0 0x01 /* WRSR: Write Status Register */
+#define SPI_OPTYPE_0 0x01 /* Write, no address */
+
+#define SPI_OPMENU_1 0x02 /* BYPR: Byte Program */
+#define SPI_OPTYPE_1 0x03 /* Write, address required */
+
+#define SPI_OPMENU_2 0x03 /* READ: Read Data */
+#define SPI_OPTYPE_2 0x02 /* Read, address required */
+
+#define SPI_OPMENU_3 0x05 /* RDSR: Read Status Register */
+#define SPI_OPTYPE_3 0x00 /* Read, no address */
+
+#define SPI_OPMENU_4 0x20 /* SE20: Sector Erase 0x20 */
+#define SPI_OPTYPE_4 0x03 /* Write, address required */
+
+#define SPI_OPMENU_5 0x9f /* RDID: Read ID */
+#define SPI_OPTYPE_5 0x00 /* Read, no address */
+
+#define SPI_OPMENU_6 0xd8 /* BED8: Block Erase 0xd8 */
+#define SPI_OPTYPE_6 0x03 /* Write, address required */
+
+#define SPI_OPMENU_7 0x0b /* FAST: Fast Read */
+#define SPI_OPTYPE_7 0x02 /* Read, address required */
+
+#define SPI_OPTYPE ((SPI_OPTYPE_7 << 14) | (SPI_OPTYPE_6 << 12) | \
+   (SPI_OPTYPE_5 << 10) | (SPI_OPTYPE_4 <<  8) | \
+   (SPI_OPTYPE_3 <<  6) | (SPI_OPTYPE_2 <<  4) | \
+   (SPI_OPTYPE_1 <<  2) | (SPI_OPTYPE_0 <<  0))
+#define SPI_OPMENU_UPPER ((SPI_OPMENU_7 << 24) | (SPI_OPMENU_6 << 16) | \
+ (SPI_OPMENU_5 <<  8) | (SPI_OPMENU_4 <<  0))
+#define SPI_OPMENU_LOWER ((SPI_OPMENU_3 << 24) | (SPI_OPMENU_2 << 16) | \
+ (SPI_OPMENU_1 <<  8) | (SPI_OPMENU_0 <<  0))
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef DEBUG_TRACE
@@ -111,6 +144,17 @@ static int ich9_can_do_33mhz(struct udevice *dev)
return speed == 1;
 }
 
+/*
+ * Configure SPI controller so that the Linux MTD driver can fully
+ * access the SPI NOR chip
+ */
+static void spi_controller_config(struct ich_spi_priv *ctlr)
+{
+   ich_writew(ctlr, SPI_OPTYPE, ctlr->optype);
+   ich_writel(ctlr, SPI_OPMENU_LOWER, ctlr->opmenu);
+   ich_writel(ctlr, SPI_OPMENU_UPPER, ctlr->opmenu + sizeof(u32));
+}
+
 static int ich_init_controller(struct udevice *dev,
   struct ich_spi_platdata *plat,
   struct ich_spi_priv *ctlr)
@@ -172,6 +216,13 @@ static int ich_init_controller(struct udevice *dev,
 
ich_set_bbar(ctlr, 0);
 
+   /*
+* Configure the SPI-NOR controller in a way that the Linux
+* MTD SPI-NOR device driver has full read-write access to
+* the SPI-NOR chips
+*/
+   spi_controller_config(ctlr);
+
return 0;
 }
 
-- 
2.11.0

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


Re: [U-Boot] [PATCH v2 1/4] kconfig: Add API kconfig file

2017-01-23 Thread Tom Rini
On Sat, Jan 21, 2017 at 09:22:47PM -0700, Warner Losh wrote:
> On Fri, Jan 20, 2017 at 8:51 PM, Simon Glass  wrote:
> > Hi,
> >
> > On 17 January 2017 at 08:50, Emmanuel Vadot  wrote:
> >> Add kconfig file to enable API support
> >>
> >> Signed-off-by: Emmanuel Vadot 
> >> ---
> >>  Kconfig | 2 ++
> >>  api/Kconfig | 9 +
> >>  2 files changed, 11 insertions(+)
> >>  create mode 100644 api/Kconfig
> >>
> >> diff --git a/Kconfig b/Kconfig
> >> index 39a4d938d8..6a93d8820f 100644
> >> --- a/Kconfig
> >> +++ b/Kconfig
> >> @@ -306,6 +306,8 @@ config ARCH_FIXUP_FDT_MEMORY
> >>
> >>  endmenu# Boot images
> >>
> >> +source "api/Kconfig"
> >> +
> >>  source "common/Kconfig"
> >>
> >>  source "cmd/Kconfig"
> >> diff --git a/api/Kconfig b/api/Kconfig
> >> new file mode 100644
> >> index 00..88b4f6c4e5
> >> --- /dev/null
> >> +++ b/api/Kconfig
> >> @@ -0,0 +1,9 @@
> >> +menu "API"
> >> +
> >> +config API
> >> +   bool "Enable U-Boot API"
> >> +   default n
> >> +   help
> >> + This option enable the U-Boot API.
> >
> > Can you add a little detail about what the API is and what it is for?
> 
> You can find complete documentation in the api directory. In brief, it
> allows the loaded binary to call back into the loader to do generic
> things like send network packets or read blocks from mass storage.

Right.  Can you re-word the "In brief.." slightly so it reads well under
the 'help' section and point to api/README for more details please?

> > Also, are you going to migrate all boards to use Kconfig for this
> > option and drop it from the whitelist?
> 
> I'll leave that to Emmanuel.

There's two boards that enable API today but tools/moveconfig.py may be
more overhead than just editing configs/PMC440_defconfig and
configs/lsxhl_defconfig (and the respective include/configs/ files).

-- 
Tom


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


Re: [U-Boot] [BUG] am335x: SPL: fails to load u-boot.img from vfat partition on eMMC

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 01:00:54PM +0100, Heiko Schocher wrote:
> Hello Stefan,
> 
> the am335x based shc board fails loading u-boot.img in SPL from vfat
> partition on eMMC card with current HEAD of mainline U-Boot:
> 
> U-Boot SPL 2017.01-00294-g0c9e85f (Jan 23 2017 - 11:23:05)
> SHC
> MPU reference clock runs at 6 MHz
> Setting MPU clock to 594 MHz
> Enabling Spread Spectrum of 18 permille for MPU
> Trying to boot from MMC2
> reading u-boot.img
> reading u-boot.img

Are you able to save off the vFAT image somewhere and pass around
privately?  The general case of am335x and VFAT booting is part of my
regular testing, so there's something interesting about the partition
you have :)

-- 
Tom


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


Re: [U-Boot] [PATCH] arm: layerscape: Enable UUID & GPT partition for NXP's ARM SoC

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 11:40:22AM +0200, Igor Grinberg wrote:
> On 01/19/17 19:31, york sun wrote:
> > On 12/25/2016 10:45 PM, Prabhakar Kushwaha wrote:
> >> Enable UUID and GPT partition support for NXP's ARM based SoCs
> >> i.e. LS1012A, LS1021A, LS1043A, LS1046A and LS2080A.
> >>
> >> Also enable DOS partition for LS1012AFRDM boards.
> >>
> >> Signed-off-by: Prabhakar Kushwaha 
> >> ---
> > 
> > Applied to fsl-qoriq master, awaiting upstream. Thanks.
> 
> Well, of course it is your call, but that's sad.
> Why not request people to move things to Kconfig?
> 
> I would suggest removing these from scripts/config_whitelist.txt...

The problem with the partition table and related options is that it ends
up being a non-trivial conversion to do and remain size neutral.
Patrick, have you had a chance to look at your patch again?  Thanks!

-- 
Tom


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


[U-Boot] [PATCH 1/3] ARM: Makefile: Fix config.mk inclusion for multiple mach-* dirs

2017-01-23 Thread Marcin Niestroj
If multiple mach-* directories are enabled in Kconfig then there was a
build error:
make[1]: *** arch/arm/mach-/: Is a directory. Stop.

Allow to enable multiple mach-* directories by proper config.mk
inclusion for each of them.

Signed-off-by: Marcin Niestroj 
---
 arch/arm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 4b8bf80c40..43462fd844 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -109,4 +109,4 @@ libs-y += arch/arm/mach-mvebu/
 endif
 
 # deprecated
--include $(machdirs)/config.mk
+-include $(patsubst %,%/config.mk,$(machdirs))
-- 
2.11.0

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


[U-Boot] [PATCH] arm: dts: imx53-cx9020: fix packetloss on fec_mxc

2017-01-23 Thread linux-kernel-dev
From: Patrick Bruenn 

The pinmuxing for i.MX53 FEC ethernet copied from
/arch/arm/boot/dts/imx53-qsb-common.dtsi (at least until v4.9)
was bad. It is different from the manual pinmuxing in
/board/freescale/mx53loco/mx53loco.c which was used in
cx9020 implementation previously before mainlining into u-boot.
It seems the bug in imx53-qsb kernel device tree is hidden for so long,
because it was never used, by the kernel driver.

Signed-off-by: Patrick Bruenn 
---

 arch/arm/dts/imx53-cx9020.dts | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arm/dts/imx53-cx9020.dts b/arch/arm/dts/imx53-cx9020.dts
index 9610301..c928e72 100644
--- a/arch/arm/dts/imx53-cx9020.dts
+++ b/arch/arm/dts/imx53-cx9020.dts
@@ -114,16 +114,16 @@
MX53_PAD_SD2_CMD__ESDHC2_CMD0x1d5
MX53_PAD_SD2_CLK__ESDHC2_CLK0x1d5
 
-   MX53_PAD_FEC_MDC__FEC_MDC   
0x8000
-   MX53_PAD_FEC_MDIO__FEC_MDIO 
0x8000
-   MX53_PAD_FEC_REF_CLK__FEC_TX_CLK
0x8000
-   MX53_PAD_FEC_RX_ER__FEC_RX_ER   
0x8000
-   MX53_PAD_FEC_CRS_DV__FEC_RX_DV  
0x8000
-   MX53_PAD_FEC_RXD1__FEC_RDATA_1  
0x8000
-   MX53_PAD_FEC_RXD0__FEC_RDATA_0  
0x8000
-   MX53_PAD_FEC_TX_EN__FEC_TX_EN   
0x8000
-   MX53_PAD_FEC_TXD1__FEC_TDATA_1  
0x8000
-   MX53_PAD_FEC_TXD0__FEC_TDATA_0  
0x8000
+   MX53_PAD_FEC_MDC__FEC_MDC   0x4
+   MX53_PAD_FEC_MDIO__FEC_MDIO 0x1fc
+   MX53_PAD_FEC_REF_CLK__FEC_TX_CLK0x180
+   MX53_PAD_FEC_RX_ER__FEC_RX_ER   0x180
+   MX53_PAD_FEC_CRS_DV__FEC_RX_DV  0x180
+   MX53_PAD_FEC_RXD1__FEC_RDATA_1  0x180
+   MX53_PAD_FEC_RXD0__FEC_RDATA_0  0x180
+   MX53_PAD_FEC_TX_EN__FEC_TX_EN   0x4
+   MX53_PAD_FEC_TXD1__FEC_TDATA_1  0x4
+   MX53_PAD_FEC_TXD0__FEC_TDATA_0  0x4
 
MX53_PAD_CSI0_DAT8__I2C1_SDA
0x41ec
MX53_PAD_CSI0_DAT9__I2C1_SCL
0x41ec
-- 
2.7.4


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


[U-Boot] [PATCH 0/3] ARM: am335x: Support chiliSOM and chiliBoard

2017-01-23 Thread Marcin Niestroj
These patches add support for chiliSOM (http://grinn-global.com/chilisom/),
and chiliBoard (which uses chiliSOM as it's base).

chiliSOM consists of processor (TI AM335x), RAM memory (up to 512M DDR3)
and flash (NAND). The idea is that every board vendor can use chiliSOM
as it's base for designed board. Hence, we need a way to reuse common code
between those board.

chiliBoard is a development kit (and reference platform for chiliSOM), that
mainly shows possibilities and use cases of chiliSOM.

Patches were developed and tested on 2017.01.

Marcin Niestroj (3):
  ARM: Makefile: Fix config.mk inclusion for multiple mach-* dirs
  ARM: am335x: Add support for chiliSOM
  board/chiliboard: Add support for chiliBoard

 arch/arm/Kconfig   |   3 +
 arch/arm/Makefile  |   3 +-
 arch/arm/mach-chilisom/Kconfig |   4 +
 arch/arm/mach-chilisom/Makefile|   6 +
 arch/arm/mach-chilisom/chilisom.c  | 185 +
 arch/arm/mach-chilisom/include/mach/chilisom.h |  15 ++
 arch/arm/mach-omap2/am33xx/Kconfig |   5 +
 board/grinn/chiliboard/Kconfig |  15 ++
 board/grinn/chiliboard/MAINTAINERS |   6 +
 board/grinn/chiliboard/Makefile|   6 +
 board/grinn/chiliboard/README  |  31 +++
 board/grinn/chiliboard/board.c | 264 +
 configs/chiliboard_defconfig   |  55 ++
 include/configs/chiliboard.h   | 230 +
 14 files changed, 827 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-chilisom/Kconfig
 create mode 100644 arch/arm/mach-chilisom/Makefile
 create mode 100644 arch/arm/mach-chilisom/chilisom.c
 create mode 100644 arch/arm/mach-chilisom/include/mach/chilisom.h
 create mode 100644 board/grinn/chiliboard/Kconfig
 create mode 100644 board/grinn/chiliboard/MAINTAINERS
 create mode 100644 board/grinn/chiliboard/Makefile
 create mode 100644 board/grinn/chiliboard/README
 create mode 100644 board/grinn/chiliboard/board.c
 create mode 100644 configs/chiliboard_defconfig
 create mode 100644 include/configs/chiliboard.h

-- 
2.11.0

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


[U-Boot] [PATCH 2/3] ARM: am335x: Add support for chiliSOM

2017-01-23 Thread Marcin Niestroj
chiliSOM is a System On Module (http://http://grinn-global.com/chilisom/).
It can't exists on its own, but will be used as part of other boards.

Hardware specification:
 * TI AM335x processor
 * 128M, 256M or 512M DDR3 memory
 * up to 256M NAND

Here we treat SOM similar to SOC, so we place it inside arch/arm/mach-*
directory and make it possible to reuse initialization code (i.e. DDR,
NAND init) for all boards that use it. This approach is similar as for
liteSOM module.

Signed-off-by: Marcin Niestroj 
---
 arch/arm/Kconfig   |   2 +
 arch/arm/Makefile  |   1 +
 arch/arm/mach-chilisom/Kconfig |   4 +
 arch/arm/mach-chilisom/Makefile|   6 +
 arch/arm/mach-chilisom/chilisom.c  | 185 +
 arch/arm/mach-chilisom/include/mach/chilisom.h |  15 ++
 6 files changed, 213 insertions(+)
 create mode 100644 arch/arm/mach-chilisom/Kconfig
 create mode 100644 arch/arm/mach-chilisom/Makefile
 create mode 100644 arch/arm/mach-chilisom/chilisom.c
 create mode 100644 arch/arm/mach-chilisom/include/mach/chilisom.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2554a2cd14..7d5f93724e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -941,6 +941,8 @@ source "arch/arm/mach-at91/Kconfig"
 
 source "arch/arm/mach-bcm283x/Kconfig"
 
+source "arch/arm/mach-chilisom/Kconfig"
+
 source "arch/arm/mach-davinci/Kconfig"
 
 source "arch/arm/mach-exynos/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 43462fd844..61448ea27c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -52,6 +52,7 @@ PLATFORM_CPPFLAGS += $(arch-y) $(tune-y)
 # by CONFIG_* macro name.
 machine-$(CONFIG_ARCH_AT91)+= at91
 machine-$(CONFIG_ARCH_BCM283X) += bcm283x
+machine-$(CONFIG_CHILISOM) += chilisom
 machine-$(CONFIG_ARCH_DAVINCI) += davinci
 machine-$(CONFIG_ARCH_EXYNOS)  += exynos
 machine-$(CONFIG_ARCH_HIGHBANK)+= highbank
diff --git a/arch/arm/mach-chilisom/Kconfig b/arch/arm/mach-chilisom/Kconfig
new file mode 100644
index 00..6ae102b43a
--- /dev/null
+++ b/arch/arm/mach-chilisom/Kconfig
@@ -0,0 +1,4 @@
+config CHILISOM
+   bool
+   select DM
+   select SUPPORT_SPL
diff --git a/arch/arm/mach-chilisom/Makefile b/arch/arm/mach-chilisom/Makefile
new file mode 100644
index 00..1d80d05589
--- /dev/null
+++ b/arch/arm/mach-chilisom/Makefile
@@ -0,0 +1,6 @@
+# (C) Copyright 2017 Grinn
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  := chilisom.o
diff --git a/arch/arm/mach-chilisom/chilisom.c 
b/arch/arm/mach-chilisom/chilisom.c
new file mode 100644
index 00..a594f6cf37
--- /dev/null
+++ b/arch/arm/mach-chilisom/chilisom.c
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
+ * Copyright (C) 2017, Grinn - http://grinn-global.com/
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+
+static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
+
+static struct module_pin_mux i2c0_pin_mux[] = {
+   {OFFSET(i2c0_sda), (MODE(0) | RXACTIVE |
+   PULLUDEN | SLEWCTRL)}, /* I2C_DATA */
+   {OFFSET(i2c0_scl), (MODE(0) | RXACTIVE |
+   PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */
+   {-1},
+};
+
+static struct module_pin_mux nand_pin_mux[] = {
+   {OFFSET(gpmc_ad0), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD0 */
+   {OFFSET(gpmc_ad1), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD1 */
+   {OFFSET(gpmc_ad2), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD2 */
+   {OFFSET(gpmc_ad3), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD3 */
+   {OFFSET(gpmc_ad4), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD4 */
+   {OFFSET(gpmc_ad5), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD5 */
+   {OFFSET(gpmc_ad6), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD6 */
+   {OFFSET(gpmc_ad7), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD7 */
+   {OFFSET(gpmc_wait0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* NAND WAIT */
+   {OFFSET(gpmc_wpn), (MODE(7) | PULLUP_EN | RXACTIVE)},   /* NAND_WPN */
+   {OFFSET(gpmc_csn0), (MODE(0) | PULLUDEN)},  /* NAND_CS0 */
+   {OFFSET(gpmc_advn_ale), (MODE(0) | PULLUDEN)}, /* NAND_ADV_ALE */
+   {OFFSET(gpmc_oen_ren), (MODE(0) | PULLUDEN)},   /* NAND_OE */
+   {OFFSET(gpmc_wen), (MODE(0) | PULLUDEN)},   /* NAND_WEN */
+   {OFFSET(gpmc_be0n_cle), (MODE(0) | PULLUDEN)},  /* NAND_BE_CLE */
+   {-1},
+};
+
+static void enable_i2c0_pin_mux(void)
+{
+   configure_module_pin_mux(i2c0_pin_mux);
+}
+
+void chilisom_enable_pin_mux(void)
+{
+   /* chilisom pin mux */
+   configure_module_pin_mux(nand_pin_mux);
+}
+

[U-Boot] [PATCH 3/3] board/chiliboard: Add support for chiliBoard

2017-01-23 Thread Marcin Niestroj
chiliBoard is a development board which uses chiliSOM as its base.

Hardware specification:
 * chiliSOM (TI AM335x, DRAM, NAND)
 * Ethernet PHY (id 0)
 * USB host (usb1)
 * MicroSD slot (mmc0)

Signed-off-by: Marcin Niestroj 
---
 arch/arm/Kconfig   |   1 +
 arch/arm/mach-omap2/am33xx/Kconfig |   5 +
 board/grinn/chiliboard/Kconfig |  15 +++
 board/grinn/chiliboard/MAINTAINERS |   6 +
 board/grinn/chiliboard/Makefile|   6 +
 board/grinn/chiliboard/README  |  31 +
 board/grinn/chiliboard/board.c | 264 +
 configs/chiliboard_defconfig   |  55 
 include/configs/chiliboard.h   | 230 
 9 files changed, 613 insertions(+)
 create mode 100644 board/grinn/chiliboard/Kconfig
 create mode 100644 board/grinn/chiliboard/MAINTAINERS
 create mode 100644 board/grinn/chiliboard/Makefile
 create mode 100644 board/grinn/chiliboard/README
 create mode 100644 board/grinn/chiliboard/board.c
 create mode 100644 configs/chiliboard_defconfig
 create mode 100644 include/configs/chiliboard.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7d5f93724e..712cc605db 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1048,6 +1048,7 @@ source "board/freescale/mx53loco/Kconfig"
 source "board/freescale/mx53smd/Kconfig"
 source "board/freescale/s32v234evb/Kconfig"
 source "board/freescale/vf610twr/Kconfig"
+source "board/grinn/chiliboard/Kconfig"
 source "board/gumstix/pepper/Kconfig"
 source "board/h2200/Kconfig"
 source "board/hisilicon/hikey/Kconfig"
diff --git a/arch/arm/mach-omap2/am33xx/Kconfig 
b/arch/arm/mach-omap2/am33xx/Kconfig
index 56c44062c4..0068ad6eb9 100644
--- a/arch/arm/mach-omap2/am33xx/Kconfig
+++ b/arch/arm/mach-omap2/am33xx/Kconfig
@@ -55,6 +55,11 @@ config TARGET_BAV335X
 
  For more information, visit: http://birdland.com/oem
 
+config TARGET_CHILIBOARD
+   bool "Grinn chiliBoard"
+   select CHILISOM
+   select DM_SERIAL
+
 config TARGET_CM_T335
bool "Support cm_t335"
select DM
diff --git a/board/grinn/chiliboard/Kconfig b/board/grinn/chiliboard/Kconfig
new file mode 100644
index 00..20056e81a1
--- /dev/null
+++ b/board/grinn/chiliboard/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_CHILIBOARD
+
+config SYS_BOARD
+   default "chiliboard"
+
+config SYS_VENDOR
+   default "grinn"
+
+config SYS_CONFIG_NAME
+   default "chiliboard"
+
+config SYS_SOC
+   default "am33xx"
+
+endif
diff --git a/board/grinn/chiliboard/MAINTAINERS 
b/board/grinn/chiliboard/MAINTAINERS
new file mode 100644
index 00..56b306f84c
--- /dev/null
+++ b/board/grinn/chiliboard/MAINTAINERS
@@ -0,0 +1,6 @@
+CHILIBOARD
+M: Marcin Niestroj 
+S: Maintained
+F: board/grinn/chiliboard/
+F: include/configs/chiliboard.h
+F: configs/chiliboard_defconfig
diff --git a/board/grinn/chiliboard/Makefile b/board/grinn/chiliboard/Makefile
new file mode 100644
index 00..865968d1a7
--- /dev/null
+++ b/board/grinn/chiliboard/Makefile
@@ -0,0 +1,6 @@
+# (C) Copyright 2017 Grinn
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  := board.o
diff --git a/board/grinn/chiliboard/README b/board/grinn/chiliboard/README
new file mode 100644
index 00..cea4c1d42e
--- /dev/null
+++ b/board/grinn/chiliboard/README
@@ -0,0 +1,31 @@
+How to use U-Boot on Grinn's chiliBoard
+--
+
+- Build U-Boot for chiliBoard:
+
+$ make mrproper
+$ make chiliboard_defconfig
+$ make
+
+This will generate the SPL image called MLO and the u-boot.img.
+
+- Flash the SPL image into the micro SD card:
+
+sudo dd if=MLO of=/dev/mmcblk0 bs=128k; sync
+
+- Flash the u-boot.img image into the micro SD card:
+
+sudo dd if=u-boot.img of=/dev/mmcblk0 bs=128k seek=3; sync
+
+- Jumper settings:
+
+S2: 1 1 1 0 1 0
+
+where 0 means bottom position and 1 means top position (from the
+switch label numbers reference).
+
+- Insert the micro SD card in the board.
+
+- Connect USB cable between chiliBoard and the PC for the power and console.
+
+- U-Boot messages should come up.
diff --git a/board/grinn/chiliboard/board.c b/board/grinn/chiliboard/board.c
new file mode 100644
index 00..7f77f241f6
--- /dev/null
+++ b/board/grinn/chiliboard/board.c
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
+ * Copyright (C) 2017, Grinn - http://grinn-global.com/
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static __maybe_unused struct ctrl_dev *cdev =
+   (struct ctrl_dev *)CTRL_DEVICE_BASE;
+
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+static struct module_pin_mux uart0_pin_mux[] = {
+   {OFFSET(uart0_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)},  /* UART0_RXD */
+   {OFFSET(uart0_txd), (

Re: [U-Boot] [RFC PATCH 03/11] SPL: FIT: factor out spl_load_fit_image()

2017-01-23 Thread Tom Rini
On Mon, Jan 23, 2017 at 07:01:38PM +0530, Lokesh Vutla wrote:
> Tom,
> 
> On Monday 23 January 2017 06:28 PM, Tom Rini wrote:
> > On Mon, Jan 23, 2017 at 02:23:40PM +0530, Lokesh Vutla wrote:
> >>
> >>
> >> On Friday 20 January 2017 07:23 AM, Andre Przywara wrote:
> >>> At the moment we load two images from a FIT image: the actual U-Boot
> >>> image and the DTB. Both times we have very similar code to deal with
> >>> alignment requirement the media we load from imposes upon us.
> >>> Factor out this code into a new function, which we just call twice.
> >>>
> >>> Signed-off-by: Andre Przywara 
> >>> ---
> >>>  common/spl/spl_fit.c | 122 
> >>> +--
> >>>  1 file changed, 51 insertions(+), 71 deletions(-)
> >>>
> >>> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> >>> index 381ed1f..d4149c5 100644
> >>> --- a/common/spl/spl_fit.c
> >>> +++ b/common/spl/spl_fit.c
> >>> @@ -138,19 +138,58 @@ static int get_aligned_image_size(struct 
> >>> spl_load_info *info, int data_size,
> >>>   return (data_size + info->bl_len - 1) / info->bl_len;
> >>>  }
> >>>  
> >>> +static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
> >>> +   void *fit, ulong base_offset, int node,
> >>> +   struct spl_image_info *image_info)
> >>> +{
> >>> + ulong offset;
> >>> + size_t length;
> >>> + ulong load, entry;
> >>> + void *src;
> >>> + ulong overhead;
> >>> + int nr_sectors;
> >>> +
> >>> + offset = fdt_getprop_u32(fit, node, "data-offset") + base_offset;
> >>> + length = fdt_getprop_u32(fit, node, "data-size");
> >>> + load = fdt_getprop_u32(fit, node, "load");
> >>> + if (load == -1U && image_info)
> >>> + load = image_info->load_addr;
> >>
> >> What if load_addr is not aligned with ARCH_DMA_MINALIGN like in case of
> >> DT loading (u-boot's load_addr + size cannot be always aligned with
> >> DMA). I keep getting this error when loading DT: "FAT: Misaligned buffer
> >> address (808675a0)."
> > 
> > My immediate concern here is that we've found another way we're going to
> > run into the same old problems of 'large kernel BSS stomps on DT (or
> > initrd) on ARM32 (arm64 won't because the Image format includes end of
> > BSS as a field).  If your FDT isn't at base+128MiB (and you have >
> > 128MiB DDR), something is wrong :)
> 
> I guess the problem here is FDT for u-boot, which is loaded at the end
> of u-boot which depends on u-boot's load address and size. I agree that
> for kernel the DTB is loaded at base + 128MB. or am I missing something?

Ah, sorry. misread, nevermind.

-- 
Tom


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


[U-Boot] [PATCH v4 16/16] sunxi: Add support for the CHIP Pro

2017-01-23 Thread Maxime Ripard
The CHIP Pro is a SoM that features the GR8 SIP, an AXP209, a BT/WiFi chip
and a 512MiB SLC NAND.

This it's an SLC NAND, it doesn't suffer the same drawbacks than found on
the MLC NANDs, and we can enable it right away.

Signed-off-by: Maxime Ripard 
Reviewed-by: Hans de Goede 
---
 configs/CHIP_pro_defconfig | 32 
 1 file changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 configs/CHIP_pro_defconfig

diff --git a/configs/CHIP_pro_defconfig b/configs/CHIP_pro_defconfig
new file mode 100644
index ..8a2644f196b5
--- /dev/null
+++ b/configs/CHIP_pro_defconfig
@@ -0,0 +1,32 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_SPL_I2C_SUPPORT=y
+# CONFIG_SPL_MMC_SUPPORT is not set
+CONFIG_SPL_NAND_SUPPORT=y
+CONFIG_MACH_SUN5I=y
+CONFIG_DRAM_TIMINGS_DDR3_800E_1066G_1333J=y
+# CONFIG_MMC is not set
+CONFIG_USB0_VBUS_PIN="PB10"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-gr8-chip-pro"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,SYS_NAND_BLOCK_SIZE=0x4,SYS_NAND_PAGE_SIZE=4096,SYS_NAND_OOBSIZE=256"
+CONFIG_ENV_IS_IN_UBI=y
+CONFIG_ENV_UBI_PART="UBI"
+CONFIG_ENV_UBI_VOLUME="uboot-env"
+CONFIG_SPL=y
+# CONFIG_CMD_IMLS is not set
+CONFIG_CMD_DFU=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=sunxi-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=sunxi-nand.0:256k(spl),256k(spl-backup),2m(uboot),2m(uboot-backup),-(UBI)"
+CONFIG_DFU_RAM=y
+CONFIG_NAND_SUNXI=y
+CONFIG_AXP_ALDO3_VOLT=3300
+CONFIG_AXP_ALDO4_VOLT=3300
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_G_DNL_MANUFACTURER="Allwinner Technology"
+CONFIG_G_DNL_VENDOR_NUM=0x1f3a
+CONFIG_G_DNL_PRODUCT_NUM=0x1010
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 13/16] nand: sunxi: Add options for the SPL NAND configuration

2017-01-23 Thread Maxime Ripard
The SPL image needs to be built with a different ECC configuration than the
U-Boot binary.

Add Kconfig options with defaults to provide a value that should work for
anyone, but is still configurable if needs be.

Signed-off-by: Maxime Ripard 
Acked-by: Boris Brezillon 
Reviewed-by: Hans de Goede 
Acked-by: Scott Wood 
---
 drivers/mtd/nand/Kconfig | 16 
 1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 5601900e4f79..51f901025168 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -74,6 +74,22 @@ config NAND_SUNXI
The SPL driver only supports reading from the NAND using DMA
transfers.
 
+if NAND_SUNXI
+
+config NAND_SUNXI_SPL_ECC_STRENGTH
+   int "Allwinner NAND SPL ECC Strength"
+   default 64
+
+config NAND_SUNXI_SPL_ECC_SIZE
+   int "Allwinner NAND SPL ECC Step Size"
+   default 1024
+
+config NAND_SUNXI_SPL_USABLE_PAGE_SIZE
+   int "Allwinner NAND SPL Usable Page Size"
+   default 1024
+
+endif
+
 config NAND_ARASAN
bool "Configure Arasan Nand"
help
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 15/16] sunxi: Sync GR8 DTS and AXP209 with the kernel

2017-01-23 Thread Maxime Ripard
Those DT will be part of 4.10, sync them so we can have our own config.

Signed-off-by: Maxime Ripard 
Reviewed-by: Hans de Goede 
---
 arch/arm/dts/Makefile   |1 +-
 arch/arm/dts/axp209.dtsi|6 +-
 arch/arm/dts/sun5i-gr8-chip-pro.dts |  266 +++-
 arch/arm/dts/sun5i-gr8.dtsi | 1132 -
 4 files changed, 1405 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/dts/sun5i-gr8-chip-pro.dts
 create mode 100644 arch/arm/dts/sun5i-gr8.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 66ea0b33d581..d1353ba65ed3 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -207,6 +207,7 @@ dtb-$(CONFIG_MACH_SUN5I) += \
sun5i-a13-olinuxino-micro.dtb \
sun5i-a13-q8-tablet.dtb \
sun5i-a13-utoo-p66.dtb \
+   sun5i-gr8-chip-pro.dtb \
sun5i-r8-chip.dtb
 dtb-$(CONFIG_MACH_SUN6I) += \
sun6i-a31-app4-evb1.dtb \
diff --git a/arch/arm/dts/axp209.dtsi b/arch/arm/dts/axp209.dtsi
index afbe89c01df5..675bb0f30825 100644
--- a/arch/arm/dts/axp209.dtsi
+++ b/arch/arm/dts/axp209.dtsi
@@ -53,6 +53,12 @@
interrupt-controller;
#interrupt-cells = <1>;
 
+   axp_gpio: gpio {
+   compatible = "x-powers,axp209-gpio";
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
regulators {
/* Default work frequency for buck regulators */
x-powers,dcdc-freq = <1500>;
diff --git a/arch/arm/dts/sun5i-gr8-chip-pro.dts 
b/arch/arm/dts/sun5i-gr8-chip-pro.dts
new file mode 100644
index ..92a2dc6250a5
--- /dev/null
+++ b/arch/arm/dts/sun5i-gr8-chip-pro.dts
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2016 Free Electrons
+ * Copyright 2016 NextThing Co
+ *
+ * Maxime Ripard 
+ *
+ * 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 SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun5i-gr8.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+
+/ {
+   model = "NextThing C.H.I.P. Pro";
+   compatible = "nextthing,chip-pro", "nextthing,gr8";
+
+   aliases {
+   i2c0 = &i2c0;
+   i2c1 = &i2c1;
+   serial0 = &uart1;
+   serial1 = &uart2;
+   serial2 = &uart3;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   status {
+   label = "chip-pro:white:status";
+   gpios = <&axp_gpio 2 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+   };
+
+   mmc0_pwrseq: mmc0_pwrseq {
+   compatible = "mmc-pwrseq-simple";
+   pinctrl-names = "default";
+   pinctrl-0 = <&wifi_reg_on_pin_chip_pro>;
+   reset-gpios = <&pio 1 10 GPIO_ACTIVE_LOW>; /* PB10 */
+   };
+};
+
+&codec {
+   status = "okay";
+};
+
+&ehci0 {
+   status = "okay";
+};
+
+&i2c0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&i2c0_pins_a>;
+   sta

[U-Boot] [PATCH v4 10/16] mtd: sunxi: Change U-Boot offset

2017-01-23 Thread Maxime Ripard
The default U-Boot offset for the Allwinner SoCs was set to 32kB.

This was probably to try to maintain some compatibility with the current
image that we build for the MMC where the U-Boot binary is also located at
a 32kB offset.

However, this causes a number of issues. The first one is that it prevents
us from using a backup SPL entirely, which is troublesome in case where the
first would be corrupt (especially on MLC which have a higher number of
bitflips).

We also cannot use the original MMC image on the NAND, because we need to
prepare the SPL image to include the ECCs and randomizer settings, which
reduces the interest of setting it at that particular offset.

It also prevents us from upgrading and flashing the U-Boot and SPLs
independantly, since it's very likely that it will fall in the same erase
block.

Since that default wasn't used by any board, change it for 8MB, which will
be in an erase block of its own, all the erase blocks being multiple of
two. The highest erase block size we encountered is 4MB, which means that
in this particular setup, the first and second erase blocks will be for the
SPL and its backup, and the third for U-Boot.

Signed-off-by: Maxime Ripard 
Reviewed-by: Tom Rini 
---
 drivers/mtd/nand/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 9bcd634df59b..5601900e4f79 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -128,7 +128,7 @@ config SYS_NAND_U_BOOT_LOCATIONS
 
 config SYS_NAND_U_BOOT_OFFS
hex "Location in NAND to read U-Boot from"
-   default 0x8000 if NAND_SUNXI
+   default 0x80 if NAND_SUNXI
depends on SYS_NAND_U_BOOT_LOCATIONS
help
Set the offset from the start of the nand where u-boot should be
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 14/16] scripts: sunxi: Build an raw SPL image

2017-01-23 Thread Maxime Ripard
Introduce a new sunxi-spl-with-ecc.bin image with already the right header,
ECC, randomizer and padding for the BROM to be able to read it.

It needs to be flashed using a raw access to the NAND so that the
controller doesn't change a thing to it, since we already have all the
right parameters.

Signed-off-by: Maxime Ripard 
Acked-by: Boris Brezillon 
Reviewed-by: Heiko Schocher 
---
 Makefile|  3 ++-
 board/sunxi/README.nand | 54 ++-
 scripts/Makefile.spl| 15 -
 3 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/README.nand

diff --git a/Makefile b/Makefile
index 262df7cd63ba..64f76cbfd30b 100644
--- a/Makefile
+++ b/Makefile
@@ -1332,6 +1332,9 @@ spl/u-boot-spl: tools prepare \
 spl/sunxi-spl.bin: spl/u-boot-spl
@:
 
+spl/sunxi-spl-with-ecc.bin: spl/sunxi-spl.bin
+   @:
+
 spl/u-boot-spl.sfp: spl/u-boot-spl
@:
 
diff --git a/board/sunxi/README.nand b/board/sunxi/README.nand
new file mode 100644
index ..a5d4ff0e90a3
--- /dev/null
+++ b/board/sunxi/README.nand
@@ -0,0 +1,54 @@
+Allwinner NAND flashing
+===
+
+A lot of Allwinner devices, especially the older ones (pre-H3 era),
+comes with a NAND. NANDs storages are a pretty weak choice when it
+comes to the reliability, and it comes with a number of flaws like
+read and write disturbs, data retention issues, bloks becoming
+unusable, etc.
+
+In order to mitigate that, various strategies have been found to be
+able to recover from those issues like ECC, hardware randomization,
+and of course, redundancy for the critical parts.
+
+This is obviously something that we will take into account when
+creating our images. However, the BROM will use a quite weird pattern
+when accessing the NAND, and will access only at most 4kB per page,
+which means that we also have to split that binary accross several
+pages.
+
+In order to accomodate that, we create a tool that will generate an
+SPL image that is ready to be programmed directly embedding the ECCs,
+randomized, and with the necessary bits needed to reduce the number of
+bitflips. The U-Boot build system, when configured for the NAND will
+also generate the image sunxi-spl-with-ecc.bin that will have been
+generated by that tool.
+
+In order to flash your U-Boot image onto a board, assuming that the
+board is in FEL mode, you'll need the sunxi-tools that you can find at
+this repository: https://github.com/linux-sunxi/sunxi-tools
+
+Then, you'll need to first load an SPL to initialise the RAM:
+sunxi-fel spl spl/sunxi-spl.bin
+
+Load the binaries we'll flash into RAM:
+sunxi-fel write 0x4a00 u-boot-dtb.bin
+sunxi-fel write 0x4300 spl/sunxi-spl-with-ecc.bin
+
+And execute U-Boot
+sunxi-fel exe 0x4a00
+
+On your board, you'll now have all the needed binaries into RAM, so
+you only need to erase the NAND...
+
+nand erase.chip
+
+Then write the SPL and its backup:
+
+nand write.raw.noverify 0x4300 0 40
+nand write.raw.noverify 0x4300 0x40 40
+
+And finally write the U-Boot binary:
+nand write 0x4a00 0x80 0xc
+
+You can now reboot and enjoy your NAND.
\ No newline at end of file
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index c962bbca2c12..646b06adf805 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -167,6 +167,10 @@ endif
 
 ifdef CONFIG_ARCH_SUNXI
 ALL-y  += $(obj)/sunxi-spl.bin
+
+ifdef CONFIG_NAND_SUNXI
+ALL-y  += $(obj)/sunxi-spl-with-ecc.bin
+endif
 endif
 
 ifeq ($(CONFIG_SYS_SOC),"at91")
@@ -275,6 +279,17 @@ cmd_mksunxiboot = $(objtree)/tools/mksunxiboot $< $@
 $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE
$(call if_changed,mksunxiboot)
 
+quiet_cmd_sunxi_spl_image_builder = SUNXI_SPL_IMAGE_BUILDER $@
+cmd_sunxi_spl_image_builder = $(objtree)/tools/sunxi-spl-image-builder \
+   -c 
$(CONFIG_NAND_SUNXI_SPL_ECC_STRENGTH)/$(CONFIG_NAND_SUNXI_SPL_ECC_SIZE) \
+   -p $(CONFIG_SYS_NAND_PAGE_SIZE) \
+   -o $(CONFIG_SYS_NAND_OOBSIZE) \
+   -u $(CONFIG_NAND_SUNXI_SPL_USABLE_PAGE_SIZE) \
+   -e $(CONFIG_SYS_NAND_BLOCK_SIZE) \
+   -s -b $< $@
+$(obj)/sunxi-spl-with-ecc.bin: $(obj)/sunxi-spl.bin
+   $(call if_changed,sunxi_spl_image_builder)
+
 # Rule to link u-boot-spl
 # May be overridden by arch/$(ARCH)/config.mk
 quiet_cmd_u-boot-spl ?= LD  $@
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 12/16] sunxi: Add the default mtdids and mtdparts to our env

2017-01-23 Thread Maxime Ripard
In order for the user to be able to see and modify them, add those
variables to the default environment.

Signed-off-by: Maxime Ripard 
Reviewed-by: Tom Rini 
---
 include/configs/sunxi-common.h | 16 
 1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 589459ffc688..7ff38ce01795 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -481,6 +481,20 @@ extern int soft_i2c_gpio_scl;
"stderr=serial\0"
 #endif
 
+#ifdef CONFIG_MTDIDS_DEFAULT
+#define SUNXI_MTDIDS_DEFAULT \
+   "mtdids=" CONFIG_MTDIDS_DEFAULT "\0"
+#else
+#define SUNXI_MTDIDS_DEFAULT
+#endif
+
+#ifdef CONFIG_MTDPARTS_DEFAULT
+#define SUNXI_MTDPARTS_DEFAULT \
+   "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0"
+#else
+#define SUNXI_MTDPARTS_DEFAULT
+#endif
+
 #define CONSOLE_ENV_SETTINGS \
CONSOLE_STDIN_SETTINGS \
CONSOLE_STDOUT_SETTINGS
@@ -491,6 +505,8 @@ extern int soft_i2c_gpio_scl;
DFU_ALT_INFO_RAM \
"fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
"console=ttyS0,115200\0" \
+   SUNXI_MTDIDS_DEFAULT \
+   SUNXI_MTDPARTS_DEFAULT \
BOOTCMD_SUNXI_COMPAT \
BOOTENV
 
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 11/16] sunxi: Enable UBI and NAND support

2017-01-23 Thread Maxime Ripard
From: Hans de Goede 

Enable the NAND and UBI support in the configuration header so that we can
(finally) use it.

Signed-off-by: Hans de Goede 
Signed-off-by: Maxime Ripard 
---
 cmd/Kconfig| 4 
 include/configs/sunxi-common.h | 3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 50c943ef8da0..c75e8bf3fe03 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -407,12 +407,14 @@ config CMD_MMC
 
 menuconfig CMD_NAND
bool "nand"
+   default y if ARCH_SUNXI
help
  NAND support.
 
 if CMD_NAND
 config CMD_NAND_TRIMFFS
bool "nand write.trimffs"
+   default y if ARCH_SUNXI
help
  Allows one to skip empty pages when flashing something on a NAND.
 
@@ -807,6 +809,7 @@ config CMD_UBI
tristate "Enable UBI - Unsorted block images commands"
select CRC32
select MTD_UBI
+   default y if ARCH_SUNXI
help
  UBI is a software layer above MTD layer which admits use of LVM-like
  logical volumes on top of MTD devices, hides some complexities of
@@ -820,6 +823,7 @@ config CMD_UBIFS
select CRC32
select RBTREE if ARCH_SUNXI
select LZO if ARCH_SUNXI
+   default y if ARCH_SUNXI
help
  UBIFS is a file system for flash devices which works on top of UBI.
 
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 254708596eca..589459ffc688 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -132,6 +132,9 @@
 #define CONFIG_SYS_NAND_MAX_ECCPOS 1664
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #define CONFIG_SYS_MAX_NAND_DEVICE 8
+
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
 #endif
 
 #ifdef CONFIG_SPL_SPI_SUNXI
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 8/16] cmd: nand: Expose optional suboptions in Kconfig

2017-01-23 Thread Maxime Ripard
From: Boris Brezillon 

Sometime we need to enable advanced suboptions of the nand command set.
Expose these suboptions in Kconfig.

Signed-off-by: Boris Brezillon 
Signed-off-by: Maxime Ripard 
---
 cmd/Kconfig | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 44980c7dbef3..50c943ef8da0 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -405,11 +405,29 @@ config CMD_MMC
help
  MMC memory mapped support.
 
-config CMD_NAND
+menuconfig CMD_NAND
bool "nand"
help
  NAND support.
 
+if CMD_NAND
+config CMD_NAND_TRIMFFS
+   bool "nand write.trimffs"
+   help
+ Allows one to skip empty pages when flashing something on a NAND.
+
+config CMD_NAND_LOCK_UNLOCK
+   bool "nand lock/unlock"
+   help
+ NAND locking support.
+
+config CMD_NAND_TORTURE
+   bool "nand torture"
+   help
+ NAND torture support.
+
+endif # CMD_NAND
+
 config CMD_SF
bool "sf"
help
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 9/16] mtd: sunxi: Select the U-Boot location config option

2017-01-23 Thread Maxime Ripard
We'll need that symbol so that the default offset are defined

Signed-off-by: Maxime Ripard 
---
 drivers/mtd/nand/Kconfig | 1 +
 1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 65bb040407b2..9bcd634df59b 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -67,6 +67,7 @@ config NAND_SUNXI
bool "Support for NAND on Allwinner SoCs"
depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
select SYS_NAND_SELF_INIT
+   select SYS_NAND_U_BOOT_LOCATIONS
---help---
Enable support for NAND. This option enables the standard and
SPL drivers.
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 3/16] tools: sunxi: Add spl image builder

2017-01-23 Thread Maxime Ripard
This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard 
Acked-by: Boris Brezillon 
Reviewed-by: Hans de Goede 
---
 tools/.gitignore|   1 +-
 tools/Makefile  |   2 +-
 tools/sunxi-spl-image-builder.c | 484 +-
 3 files changed, 487 insertions(+), 0 deletions(-)
 create mode 100644 tools/sunxi-spl-image-builder.c

diff --git a/tools/.gitignore b/tools/.gitignore
index cb1e722d4575..16574467544c 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -15,6 +15,7 @@
 /mkexynosspl
 /mxsboot
 /mksunxiboot
+/sunxi-spl-image-builder
 /ncb
 /proftool
 /relocate-rela
diff --git a/tools/Makefile b/tools/Makefile
index 5b81dde4b069..b2221e25aac6 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -171,6 +171,8 @@ hostprogs-$(CONFIG_MX28) += mxsboot
 HOSTCFLAGS_mxsboot.o := -pedantic
 
 hostprogs-$(CONFIG_ARCH_SUNXI) += mksunxiboot
+hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder
+sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o
 
 hostprogs-$(CONFIG_NETCONSOLE) += ncb
 hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1
diff --git a/tools/sunxi-spl-image-builder.c b/tools/sunxi-spl-image-builder.c
new file mode 100644
index ..d538a3881319
--- /dev/null
+++ b/tools/sunxi-spl-image-builder.c
@@ -0,0 +1,484 @@
+/*
+ * Allwinner NAND randomizer and image builder implementation:
+ *
+ * Copyright © 2016 NextThing Co.
+ * Copyright © 2016 Free Electrons
+ *
+ * Author: Boris Brezillon 
+ *
+ */
+
+#include 
+
+#include 
+#include 
+
+#define BCH_PRIMITIVE_POLY 0x5803
+
+#define ARRAY_SIZE(arr)(sizeof(arr) / sizeof((arr)[0]))
+#define DIV_ROUND_UP(n,d)  (((n) + (d) - 1) / (d))
+
+struct image_info {
+   int ecc_strength;
+   int ecc_step_size;
+   int page_size;
+   int oob_size;
+   int usable_page_size;
+   int eraseblock_size;
+   int scramble;
+   int boot0;
+   off_t offset;
+   const char *source;
+   const char *dest;
+};
+
+static void swap_bits(uint8_t *buf, int len)
+{
+   int i, j;
+
+   for (j = 0; j < len; j++) {
+   uint8_t byte = buf[j];
+
+   buf[j] = 0;
+   for (i = 0; i < 8; i++) {
+   if (byte & (1 << i))
+   buf[j] |= (1 << (7 - i));
+   }
+   }
+}
+
+static uint16_t lfsr_step(uint16_t state, int count)
+{
+   state &= 0x7fff;
+   while (count--)
+   state = ((state >> 1) |
+state >> 0) ^ (state >> 1)) & 1) << 14)) & 0x7fff;
+
+   return state;
+}
+
+static uint16_t default_scrambler_seeds[] = {
+   0x2b75, 0x0bd0, 0x5ca3, 0x62d1, 0x1c93, 0x07e9, 0x2162, 0x3a72,
+   0x0d67, 0x67f9, 0x1be7, 0x077d, 0x032f, 0x0dac, 0x2716, 0x2436,
+   0x7922, 0x1510, 0x3860, 0x5287, 0x480f, 0x4252, 0x1789, 0x5a2d,
+   0x2a49, 0x5e10, 0x437f, 0x4b4e, 0x2f45, 0x216e, 0x5cb7, 0x7130,
+   0x2a3f, 0x60e4, 0x4dc9, 0x0ef0, 0x0f52, 0x1bb9, 0x6211, 0x7a56,
+   0x226d, 0x4ea7, 0x6f36, 0x3692, 0x38bf, 0x0c62, 0x05eb, 0x4c55,
+   0x60f4, 0x728c, 0x3b6f, 0x2037, 0x7f69, 0x0936, 0x651a, 0x4ceb,
+   0x6218, 0x79f3, 0x383f, 0x18d9, 0x4f05, 0x5c82, 0x2912, 0x6f17,
+   0x6856, 0x5938, 0x1007, 0x61ab, 0x3e7f, 0x57c2, 0x542f, 0x4f62,
+   0x7454, 0x2eac, 0x7739, 0x42d4, 0x2f90, 0x435a, 0x2e52, 0x2064,
+   0x637c, 0x66ad, 0x2c90, 0x0bad, 0x759c, 0x0029, 0x0986, 0x7126,
+   0x1ca7, 0x1605, 0x386a, 0x27f5, 0x1380, 0x6d75, 0x24c3, 0x0f8e,
+   0x2b7a, 0x1418, 0x1fd1, 0x7dc1, 0x2d8e, 0x43af, 0x2267, 0x7da3,
+   0x4e3d, 0x1338, 0x50db, 0x454d, 0x764d, 0x40a3, 0x42e6, 0x262b,
+   0x2d2e, 0x1aea, 0x2e17, 0x173d, 0x3a6e, 0x71bf, 0x25f9, 0x0a5d,
+   0x7c57, 0x0fbe, 0x46ce, 0x4939, 0x6b17, 0x37bb, 0x3e91, 0x76db,
+};
+
+static uint16_t brom_scrambler_seeds[] = { 0x4a80 };
+
+static void scramble(const struct image_info *info,
+int page, uint8_t *data, int datalen)
+{
+   uint16_t state;
+   int i;
+
+   /* Boot0 is always scrambled no matter the command line option. */
+   if (info->boot0) {
+   state = brom_scrambler_seeds[0];
+   } else {
+   unsigned seedmod = info->eraseblock_size / info->page_size;
+
+   /* Bail out earlier if the user didn't ask for scrambling. */
+   if (!info->scramble)
+   return;
+
+   if (seedmod > ARRAY_SIZE(default_scrambler_seeds))
+   seedmod = ARRAY_SIZE(default_scrambler_seeds);
+
+   state = default_scrambler_seeds[page % seedmod];
+   }
+
+   /* Prepare the initial state... */
+   state = lfsr_step(state, 15);
+
+   /* 

[U-Boot] [PATCH v4 4/16] common: Move environment choice to Kconfig

2017-01-23 Thread Maxime Ripard
The environment location is something that might change per board
(depending on what storage options are availaible there) or depending on
the user choice (when we have several options).

Instead of hardcoding it in our configuration header, create a Kconfig
choice with the options we use for now, and the symbols that depend on it.

Once done, also remove the irrelevant sunxi defines.

Signed-off-by: Maxime Ripard 
Reviewed-by: Tom Rini 
---
 common/Kconfig | 69 +++-
 include/configs/sunxi-common.h | 14 +--
 include/environment.h  |  2 +-
 3 files changed, 74 insertions(+), 11 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index a04ee1084fed..e8c88f4ee258 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -158,6 +158,75 @@ config SPI_BOOT
 
 endmenu
 
+menu "Environment"
+
+if ARCH_SUNXI
+
+choice
+   prompt "Environment Device"
+   default ENV_IS_IN_MMC if ARCH_SUNXI
+
+config ENV_IS_IN_MMC
+   bool "Environment in an MMC device"
+   depends on CMD_MMC
+   help
+ Define this if you have an MMC device which you want to use for the
+ environment.
+
+config ENV_IS_IN_NAND
+   bool "Environment in a NAND device"
+   depends on CMD_NAND
+   help
+ Define this if you have a NAND device which you want to use for the
+ environment.
+
+config ENV_IS_IN_UBI
+   bool "Environment in a UBI volume"
+   depends on CMD_UBI
+   depends on CMD_MTDPARTS
+   help
+ Define this if you have a UBI volume which you want to use for the
+ environment.
+
+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_OFFSET
+   hex "Environment Offset"
+   depends on !ENV_IS_IN_UBI
+   depends on !ENV_IS_NOWHERE
+   default 0x88000 if ARCH_SUNXI
+   help
+ Offset from the start of the device (or partition)
+
+config ENV_SIZE
+   hex "Environment Size"
+   depends on !ENV_IS_NOWHERE
+   default 0x2 if ARCH_SUNXI
+   help
+ Size of the environment storage area
+
+config ENV_UBI_PART
+   string "UBI partition name"
+   depends on ENV_IS_IN_UBI
+   help
+ MTD partition containing the UBI device
+
+config ENV_UBI_VOLUME
+   string "UBI volume name"
+   depends on ENV_IS_IN_UBI
+   help
+ Name of the volume that you want to store the environment in.
+
+endif
+
+endmenu
+
 config BOOTDELAY
int "delay in seconds before automatically booting"
default 2
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index d58e5bacae5e..254708596eca 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -142,7 +142,9 @@
 #ifdef CONFIG_MMC
 #define CONFIG_GENERIC_MMC
 #define CONFIG_MMC_SUNXI_SLOT  0
-#define CONFIG_ENV_IS_IN_MMC
+#endif
+
+#if defined(CONFIG_ENV_IS_IN_MMC)
 #define CONFIG_SYS_MMC_ENV_DEV 0   /* first detected MMC 
controller */
 #define CONFIG_SYS_MMC_MAX_DEVICE  4
 #endif
@@ -175,9 +177,6 @@
 
 #define CONFIG_SYS_MONITOR_LEN (768 << 10) /* 768 KiB */
 
-#define CONFIG_ENV_OFFSET  (544 << 10) /* (8 + 24 + 512) KiB */
-#define CONFIG_ENV_SIZE(128 << 10) /* 128 KiB */
-
 #define CONFIG_FAT_WRITE   /* enable write access */
 
 #define CONFIG_SPL_FRAMEWORK
@@ -350,13 +349,6 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
 #endif
 
-#if !defined CONFIG_ENV_IS_IN_MMC && \
-!defined CONFIG_ENV_IS_IN_NAND && \
-!defined CONFIG_ENV_IS_IN_FAT && \
-!defined CONFIG_ENV_IS_IN_SPI_FLASH
-#define CONFIG_ENV_IS_NOWHERE
-#endif
-
 #define CONFIG_MISC_INIT_R
 
 #ifndef CONFIG_SPL_BUILD
diff --git a/include/environment.h b/include/environment.h
index b602e8ac46b6..6f94986c6b3e 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -8,6 +8,8 @@
 #ifndef _ENVIRONMENT_H_
 #define _ENVIRONMENT_H_
 
+#include 
+
 /**
  *
  * The "environment" is stored as a list of '\0' terminated
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 7/16] cmd: Expose a Kconfig option to enable UBIFS commands

2017-01-23 Thread Maxime Ripard
From: Boris Brezillon 

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon 
Signed-off-by: Maxime Ripard 
---
 cmd/Kconfig | 8 
 lib/Kconfig | 2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index da8e98e8143f..44980c7dbef3 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -797,4 +797,12 @@ config CMD_UBI
  (www.linux-mtd.infradead.org). Activate this option if you want
  to use U-Boot UBI commands.
 
+config CMD_UBIFS
+   tristate "Enable UBIFS - Unsorted block images filesystem commands"
+   select CRC32
+   select RBTREE if ARCH_SUNXI
+   select LZO if ARCH_SUNXI
+   help
+ UBIFS is a file system for flash devices which works on top of UBI.
+
 endmenu
diff --git a/lib/Kconfig b/lib/Kconfig
index 5944d967dff4..2dde2e824104 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -122,6 +122,8 @@ config LZ4
  frame format currently (2015) implemented in the Linux kernel
  (generated by 'lz4 -l'). The two formats are incompatible.
 
+config LZO
+   bool
 endmenu
 
 config ERRNO_STR
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 2/16] bch: Allow to build for the host

2017-01-23 Thread Maxime Ripard
We will need the bch functions in the tool to generate the SPL images for
the Allwinner SoCs.

Do the needed adjustments so that we can use it on the host.

Signed-off-by: Maxime Ripard 
Reviewed-by: Tom Rini 
---
 lib/bch.c | 48 
 1 file changed, 48 insertions(+), 0 deletions(-)

diff --git a/lib/bch.c b/lib/bch.c
index 147715afd06a..ec53483774b5 100644
--- a/lib/bch.c
+++ b/lib/bch.c
@@ -54,10 +54,27 @@
  * finite fields GF(2^q). In Rapport de recherche INRIA no 2829, 1996.
  */
 
+#ifndef USE_HOSTCC
 #include 
 #include 
 
 #include 
+#else
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#undef cpu_to_be32
+#define cpu_to_be32 htobe32
+#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+#define kmalloc(size, flags)   malloc(size)
+#define kzalloc(size, flags)   calloc(1, size)
+#define kfree free
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
+
 #include 
 #include 
 
@@ -95,6 +112,37 @@ struct gf_poly_deg1 {
unsigned int   c[2];
 };
 
+#ifdef USE_HOSTCC
+static int fls(int x)
+{
+   int r = 32;
+
+   if (!x)
+   return 0;
+   if (!(x & 0xu)) {
+   x <<= 16;
+   r -= 16;
+   }
+   if (!(x & 0xff00u)) {
+   x <<= 8;
+   r -= 8;
+   }
+   if (!(x & 0xf000u)) {
+   x <<= 4;
+   r -= 4;
+   }
+   if (!(x & 0xc000u)) {
+   x <<= 2;
+   r -= 2;
+   }
+   if (!(x & 0x8000u)) {
+   x <<= 1;
+   r -= 1;
+   }
+   return r;
+}
+#endif
+
 /*
  * same as encode_bch(), but process input data one byte at a time
  */
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 5/16] cmd: Add Kconfig option for CMD_MTDPARTS and related options

2017-01-23 Thread Maxime Ripard
CMD_MTDPARTS is something the user might or might not want to select, and
might depends on (or be selected by) other options too.

This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT options that
might change from one board to another, or from one user to the other,
depending on what it expects and what storage devices are available.

In order to ease that configuration, add those options to Kconfig.

Signed-off-by: Maxime Ripard 
Reviewed-by: Tom Rini 
---
 cmd/Kconfig| 20 
 cmd/mtdparts.c |  8 
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 91bd3fb0b58e..da8e98e8143f 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -763,6 +763,26 @@ config CMD_FS_GENERIC
help
  Enables filesystem commands (e.g. load, ls) that work for multiple
  fs types.
+
+config CMD_MTDPARTS
+   depends on ARCH_SUNXI
+   bool "MTD partition support"
+   help
+ MTD partition support
+
+config MTDIDS_DEFAULT
+   string "Default MTD IDs"
+   depends on CMD_MTDPARTS
+   help
+ Defines a default MTD ID
+
+config MTDPARTS_DEFAULT
+   string "Default MTD partition scheme"
+   depends on CMD_MTDPARTS
+   help
+ Defines a default MTD partitioning scheme in the Linux MTD command
+ line partitions format
+
 endmenu
 
 config CMD_UBI
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index b9b160dc1e2f..112bf1f3e3cd 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -110,11 +110,19 @@ DECLARE_GLOBAL_DATA_PTR;
 
 /* default values for mtdids and mtdparts variables */
 #if !defined(MTDIDS_DEFAULT)
+#ifdef CONFIG_MTDIDS_DEFAULT
+#define MTDIDS_DEFAULT CONFIG_MTDIDS_DEFAULT
+#else
 #define MTDIDS_DEFAULT NULL
 #endif
+#endif
 #if !defined(MTDPARTS_DEFAULT)
+#ifdef CONFIG_MTDPARTS_DEFAULT
+#define MTDPARTS_DEFAULT CONFIG_MTDPARTS_DEFAULT
+#else
 #define MTDPARTS_DEFAULT NULL
 #endif
+#endif
 #if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
 extern void board_mtdparts_default(const char **mtdids, const char **mtdparts);
 #endif
-- 
git-series 0.8.11
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   >