Re: [U-Boot] [PULL] u-boot-usb/master

2016-08-09 Thread Masahiro Yamada
2016-08-09 1:45 GMT+09:00 Marek Vasut :
> On 08/08/2016 06:42 PM, Tom Rini wrote:
>> On Sun, Aug 07, 2016 at 09:57:44PM +0200, Marek Vasut wrote:
>>
>>> The following changes since commit 2863a9bfc29092be37f8beee230883367b057065:
>>>
>>>   Merge git://git.denx.de/u-boot-rockchip (2016-08-06 11:38:14 -0400)
>>>
>>> are available in the git repository at:
>>>
>>>   git://git.denx.de/u-boot-usb.git master
>>>
>>> for you to fetch changes up to 606120f99ec2baf3635b1c2545803348b6f550ab:
>>>
>>>   dm: atmel: Add driver model support for the ehci driver (2016-08-07
>>> 21:56:56 +0200)
>>>
>>
>> NAK:
>
> Dang, CCing the authors, I expect fixed patches. Both dropped for now.
>


Then, please send a new pull-req.




-- 
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 v2 00/22] spi/sf: Updates on flash detection

2016-08-09 Thread Jagan Teki
Hi Bin,

On 10 August 2016 at 11:16, Bin Meng  wrote:
> Hi Jagan,
>
> On Wed, Aug 10, 2016 at 12:59 PM, Jagan Teki  wrote:
>> Hi Bin,
>>
>> On 10 August 2016 at 08:08, Bin Meng  wrote:
>>> Hi Jagan,
>>>
>>> On Wed, Aug 10, 2016 at 4:03 AM, Jagan Teki  wrote:
 Updated spi_flash_info table in sync with Linux, and removed
 legacy and unsupported code.

 Changes for v2:
 - New patches.

>>>
>>> Is this a new version of previous spi-nor framework work?
>>
>> Yes, and divided into separate series - fixes, MTD and spi-nor.
>>
>
> OK, please specify those series: fixes, MTD and spi-nor. I want to
> have a testing on x86 boards for all of them.

I'm calling this series as fixes one, idea is to send the couple of
patches/series before (MTD and spi-nor) and I'm planning to take these
fixes first, So please test this series on your board.

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


Re: [U-Boot] [PATCH v2 00/22] spi/sf: Updates on flash detection

2016-08-09 Thread Bin Meng
Hi Jagan,

On Wed, Aug 10, 2016 at 12:59 PM, Jagan Teki  wrote:
> Hi Bin,
>
> On 10 August 2016 at 08:08, Bin Meng  wrote:
>> Hi Jagan,
>>
>> On Wed, Aug 10, 2016 at 4:03 AM, Jagan Teki  wrote:
>>> Updated spi_flash_info table in sync with Linux, and removed
>>> legacy and unsupported code.
>>>
>>> Changes for v2:
>>> - New patches.
>>>
>>
>> Is this a new version of previous spi-nor framework work?
>
> Yes, and divided into separate series - fixes, MTD and spi-nor.
>

OK, please specify those series: fixes, MTD and spi-nor. I want to
have a testing on x86 boards for all of them.

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


Re: [U-Boot] [PATCH v2 03/22] spi: Use mode for rx mode flags

2016-08-09 Thread Jagan Teki

On Wednesday 10 August 2016 10:23 AM, Vignesh R wrote:

Hi,

On Wednesday 10 August 2016 01:33 AM, Jagan Teki wrote:

Make rx mode flags as generic to spi, earlier mode_rx is
maintained separately becuase of some flash specific code.



Nit: s/becuase/because


OK.



[...]

diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
index bb72cb0..37dc64f 100644
--- a/drivers/spi/ti_qspi.c
+++ b/drivers/spi/ti_qspi.c
@@ -336,7 +336,7 @@ static void ti_spi_setup_spi_register(struct ti_qspi_priv 
*priv)
QSPI_SETUP0_NUM_D_BYTES_8_BITS |
QSPI_SETUP0_READ_QUAD | QSPI_CMD_WRITE |
QSPI_NUM_DUMMY_BITS);
-   slave->mode_rx = SPI_RX_QUAD;
+   slave->mode |= SPI_RX_QUAD;
 #else
memval |= QSPI_CMD_READ | QSPI_SETUP0_NUM_A_BYTES |
QSPI_SETUP0_NUM_D_BYTES_NO_BITS |
@@ -422,7 +422,7 @@ static void __ti_qspi_setup_memorymap(struct ti_qspi_priv 
*priv,
  bool enable)
 {
u32 memval;
-   u32 mode = slave->mode_rx & (SPI_RX_QUAD | SPI_RX_DUAL);
+   u32 mode = slave->mode | SPI_RX_QUAD | SPI_RX_DUAL;



This will break ti-qspi Quad mode operation. The code below this line
(switch statement) expects mode to be either SPI_RX_DUAL or SPI_RX_QUAD
but not both.


Wrong usage of | instead of & will fix




if (!enable) {
writel(0, >base->setup0);
@@ -436,7 +436,7 @@ static void __ti_qspi_setup_memorymap(struct ti_qspi_priv 
*priv,
memval |= QSPI_CMD_READ_QUAD;
memval |= QSPI_SETUP0_NUM_D_BYTES_8_BITS;
memval |= QSPI_SETUP0_READ_QUAD;
-   slave->mode_rx = SPI_RX_QUAD;
+   slave->mode |= SPI_RX_QUAD;
break;
case SPI_RX_DUAL:
memval |= QSPI_CMD_READ_DUAL;
diff --git a/include/spi.h b/include/spi.h
index ca96fa4..7d92ddc 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -26,12 +26,10 @@
 #define SPI_TX_BYTEBIT(8)  /* transmit with 1 wire byte */
 #define SPI_TX_DUALBIT(9)  /* transmit with 2 wires */
 #define SPI_TX_QUADBIT(10) /* transmit with 4 wires */
-
-/* SPI mode_rx flags */
-#define SPI_RX_SLOWBIT(0)  /* receive with 1 wire slow */
-#define SPI_RX_FASTBIT(1)  /* receive with 1 wire fast */
-#define SPI_RX_DUALBIT(2)  /* receive with 2 wires */
-#define SPI_RX_QUADBIT(3)  /* receive with 4 wires */
+#define SPI_RX_SLOWBIT(11) /* receive with 1 wire slow */
+#define SPI_RX_FASTBIT(12) /* receive with 1 wire fast */
+#define SPI_RX_DUALBIT(12) /* receive with 2 wires */


Same bit for SPI_RX_FAST and SPI_RX_DUAL? Could you clarify the reason?


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


[U-Boot] [PATCH v3 03/22] spi: Use mode for rx mode flags

2016-08-09 Thread Jagan Teki
Make rx mode flags as generic to spi, earlier mode_rx is
maintained separately because of some flash specific code.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Cc: Vignesh R 
Cc: Mugunthan V N 
Signed-off-by: Jagan Teki 
---
Changes for v3:
- Fix BIT positions in spi.h
- Fix ti_qspi.c mode
- Fix commit Nit: s/becuase/because

 drivers/mtd/spi/spi_flash.c |  6 +++---
 drivers/spi/cadence_qspi.c  |  2 +-
 drivers/spi/ich.c   |  6 ++
 drivers/spi/spi-uclass.c| 11 ---
 drivers/spi/ti_qspi.c   |  6 +++---
 include/spi.h   | 14 --
 6 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 5fd408c..041b64f 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1172,11 +1172,11 @@ int spi_flash_scan(struct spi_flash *flash)
 
/* Look for read commands */
flash->read_cmd = CMD_READ_ARRAY_FAST;
-   if (spi->mode_rx & SPI_RX_SLOW)
+   if (spi->mode & SPI_RX_SLOW)
flash->read_cmd = CMD_READ_ARRAY_SLOW;
-   else if (spi->mode_rx & SPI_RX_QUAD && params->flags & RD_QUAD)
+   else if (spi->mode & SPI_RX_QUAD && params->flags & RD_QUAD)
flash->read_cmd = CMD_READ_QUAD_OUTPUT_FAST;
-   else if (spi->mode_rx & SPI_RX_DUAL && params->flags & RD_DUAL)
+   else if (spi->mode & SPI_RX_DUAL && params->flags & RD_DUAL)
flash->read_cmd = CMD_READ_DUAL_OUTPUT_FAST;
 
/* Look for write commands */
diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index a5244ff..1d50f13 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -251,7 +251,7 @@ static int cadence_spi_xfer(struct udevice *dev, unsigned 
int bitlen,
break;
case CQSPI_INDIRECT_READ:
err = cadence_qspi_apb_indirect_read_setup(plat,
-   priv->cmd_len, dm_plat->mode_rx, cmd_buf);
+   priv->cmd_len, dm_plat->mode, cmd_buf);
if (!err) {
err = cadence_qspi_apb_indirect_read_execute
(plat, data_bytes, din);
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index 00b2fed..caf0103 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -649,10 +649,8 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
 * ICH 7 SPI controller only supports array read command
 * and byte program command for SST flash
 */
-   if (plat->ich_version == ICHV_7) {
-   slave->mode_rx = SPI_RX_SLOW;
-   slave->mode = SPI_TX_BYTE;
-   }
+   if (plat->ich_version == ICHV_7)
+   slave->mode = SPI_RX_SLOW | SPI_TX_BYTE;
 
return 0;
 }
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 247abfa..d9c49e4 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -164,7 +164,6 @@ static int spi_child_pre_probe(struct udevice *dev)
 
slave->max_hz = plat->max_hz;
slave->mode = plat->mode;
-   slave->mode_rx = plat->mode_rx;
slave->wordlen = SPI_DEFAULT_WORDLEN;
 
return 0;
@@ -381,7 +380,7 @@ void spi_free_slave(struct spi_slave *slave)
 int spi_slave_ofdata_to_platdata(const void *blob, int node,
 struct dm_spi_slave_platdata *plat)
 {
-   int mode = 0, mode_rx = 0;
+   int mode = 0;
int value;
 
plat->cs = fdtdec_get_int(blob, node, "reg", -1);
@@ -413,24 +412,22 @@ int spi_slave_ofdata_to_platdata(const void *blob, int 
node,
break;
}
 
-   plat->mode = mode;
-
value = fdtdec_get_uint(blob, node, "spi-rx-bus-width", 1);
switch (value) {
case 1:
break;
case 2:
-   mode_rx |= SPI_RX_DUAL;
+   mode |= SPI_RX_DUAL;
break;
case 4:
-   mode_rx |= SPI_RX_QUAD;
+   mode |= SPI_RX_QUAD;
break;
default:
error("spi-rx-bus-width %d not supported\n", value);
break;
}
 
-   plat->mode_rx = mode_rx;
+   plat->mode = mode;
 
return 0;
 }
diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
index bb72cb0..e51cbd0 100644
--- a/drivers/spi/ti_qspi.c
+++ b/drivers/spi/ti_qspi.c
@@ -336,7 +336,7 @@ static void ti_spi_setup_spi_register(struct ti_qspi_priv 
*priv)
QSPI_SETUP0_NUM_D_BYTES_8_BITS |
QSPI_SETUP0_READ_QUAD | QSPI_CMD_WRITE |
QSPI_NUM_DUMMY_BITS);
-   slave->mode_rx = SPI_RX_QUAD;
+   slave->mode |= SPI_RX_QUAD;
 #else

Re: [U-Boot] [PATCH v2 07/22] sf: Adopt flash table INFO macro from Linux

2016-08-09 Thread Jagan Teki

On Wednesday 10 August 2016 10:34 AM, Vignesh R wrote:



On Wednesday 10 August 2016 01:33 AM, Jagan Teki wrote:

INFO macro make flash table entries more adjustable like
adding new flash_info attributes, update ID length bytes
and so on and more over it will sync to Linux way of defining
flash_info attributes.

[...]

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 7f6e9ae..58d5a6a 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -924,6 +924,31 @@ static int micron_quad_enable(struct spi_flash *flash)
 }
 #endif

+static const struct spi_flash_params *spi_flash_read_id(struct spi_flash 
*flash)
+{
+   int tmp;
+   u8  id[5];
+   const struct spi_flash_params   *params;
+
+   tmp = spi_flash_cmd(flash->spi, CMD_READ_ID, id, 5);
+   if (tmp < 0) {
+   printf("SF: error %d reading JEDEC ID\n", tmp);
+   return ERR_PTR(tmp);
+   }
+


Could we have debug() to print the JEDEC IDs read as before?


Not necessary, and anyway jedec id is printing in failure/unsupported case.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 07/22] sf: Adopt flash table INFO macro from Linux

2016-08-09 Thread Vignesh R


On Wednesday 10 August 2016 01:33 AM, Jagan Teki wrote:
> INFO macro make flash table entries more adjustable like
> adding new flash_info attributes, update ID length bytes
> and so on and more over it will sync to Linux way of defining
> flash_info attributes.
[...]
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index 7f6e9ae..58d5a6a 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -924,6 +924,31 @@ static int micron_quad_enable(struct spi_flash *flash)
>  }
>  #endif
>  
> +static const struct spi_flash_params *spi_flash_read_id(struct spi_flash 
> *flash)
> +{
> + int tmp;
> + u8  id[5];
> + const struct spi_flash_params   *params;
> +
> + tmp = spi_flash_cmd(flash->spi, CMD_READ_ID, id, 5);
> + if (tmp < 0) {
> + printf("SF: error %d reading JEDEC ID\n", tmp);
> + return ERR_PTR(tmp);
> + }
> +

Could we have debug() to print the JEDEC IDs read as before?



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


Re: [U-Boot] [PATCH v2 00/22] spi/sf: Updates on flash detection

2016-08-09 Thread Jagan Teki
Hi Bin,

On 10 August 2016 at 08:08, Bin Meng  wrote:
> Hi Jagan,
>
> On Wed, Aug 10, 2016 at 4:03 AM, Jagan Teki  wrote:
>> Updated spi_flash_info table in sync with Linux, and removed
>> legacy and unsupported code.
>>
>> Changes for v2:
>> - New patches.
>>
>
> Is this a new version of previous spi-nor framework work?

Yes, and divided into separate series - fixes, MTD and spi-nor.

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


Re: [U-Boot] [PATCH v2 03/22] spi: Use mode for rx mode flags

2016-08-09 Thread Vignesh R
Hi,

On Wednesday 10 August 2016 01:33 AM, Jagan Teki wrote:
> Make rx mode flags as generic to spi, earlier mode_rx is
> maintained separately becuase of some flash specific code.
> 

Nit: s/becuase/because

[...]
> diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
> index bb72cb0..37dc64f 100644
> --- a/drivers/spi/ti_qspi.c
> +++ b/drivers/spi/ti_qspi.c
> @@ -336,7 +336,7 @@ static void ti_spi_setup_spi_register(struct ti_qspi_priv 
> *priv)
>   QSPI_SETUP0_NUM_D_BYTES_8_BITS |
>   QSPI_SETUP0_READ_QUAD | QSPI_CMD_WRITE |
>   QSPI_NUM_DUMMY_BITS);
> - slave->mode_rx = SPI_RX_QUAD;
> + slave->mode |= SPI_RX_QUAD;
>  #else
>   memval |= QSPI_CMD_READ | QSPI_SETUP0_NUM_A_BYTES |
>   QSPI_SETUP0_NUM_D_BYTES_NO_BITS |
> @@ -422,7 +422,7 @@ static void __ti_qspi_setup_memorymap(struct ti_qspi_priv 
> *priv,
> bool enable)
>  {
>   u32 memval;
> - u32 mode = slave->mode_rx & (SPI_RX_QUAD | SPI_RX_DUAL);
> + u32 mode = slave->mode | SPI_RX_QUAD | SPI_RX_DUAL;
>  

This will break ti-qspi Quad mode operation. The code below this line
(switch statement) expects mode to be either SPI_RX_DUAL or SPI_RX_QUAD
but not both.

>   if (!enable) {
>   writel(0, >base->setup0);
> @@ -436,7 +436,7 @@ static void __ti_qspi_setup_memorymap(struct ti_qspi_priv 
> *priv,
>   memval |= QSPI_CMD_READ_QUAD;
>   memval |= QSPI_SETUP0_NUM_D_BYTES_8_BITS;
>   memval |= QSPI_SETUP0_READ_QUAD;
> - slave->mode_rx = SPI_RX_QUAD;
> + slave->mode |= SPI_RX_QUAD;
>   break;
>   case SPI_RX_DUAL:
>   memval |= QSPI_CMD_READ_DUAL;
> diff --git a/include/spi.h b/include/spi.h
> index ca96fa4..7d92ddc 100644
> --- a/include/spi.h
> +++ b/include/spi.h
> @@ -26,12 +26,10 @@
>  #define SPI_TX_BYTE  BIT(8)  /* transmit with 1 wire byte */
>  #define SPI_TX_DUAL  BIT(9)  /* transmit with 2 wires */
>  #define SPI_TX_QUAD  BIT(10) /* transmit with 4 wires */
> -
> -/* SPI mode_rx flags */
> -#define SPI_RX_SLOW  BIT(0)  /* receive with 1 wire slow */
> -#define SPI_RX_FAST  BIT(1)  /* receive with 1 wire fast */
> -#define SPI_RX_DUAL  BIT(2)  /* receive with 2 wires */
> -#define SPI_RX_QUAD  BIT(3)  /* receive with 4 wires */
> +#define SPI_RX_SLOW  BIT(11) /* receive with 1 wire slow */
> +#define SPI_RX_FAST  BIT(12) /* receive with 1 wire fast */
> +#define SPI_RX_DUAL  BIT(12) /* receive with 2 wires */

Same bit for SPI_RX_FAST and SPI_RX_DUAL? Could you clarify the reason?


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


[U-Boot] [PATCH] ARM: rmobile: r8a7795: Add MMU layout

2016-08-09 Thread Nobuhiro Iwamatsu
This add MMU layout for R8A7795 of Renesas ARM64 SoC.

Signed-off-by: Nobuhiro Iwamatsu 
---
 arch/arm/mach-rmobile/Makefile |  2 +-
 arch/arm/mach-rmobile/memmap-r8a7795.c | 30 ++
 2 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-rmobile/memmap-r8a7795.c

diff --git a/arch/arm/mach-rmobile/Makefile b/arch/arm/mach-rmobile/Makefile
index d5bb843..3b56fcf 100644
--- a/arch/arm/mach-rmobile/Makefile
+++ b/arch/arm/mach-rmobile/Makefile
@@ -16,6 +16,6 @@ obj-$(CONFIG_R8A7791) += lowlevel_init_ca15.o cpu_info-rcar.o 
pfc-r8a7791.o
 obj-$(CONFIG_R8A7792) += lowlevel_init_ca15.o cpu_info-rcar.o pfc-r8a7792.o
 obj-$(CONFIG_R8A7793) += lowlevel_init_ca15.o cpu_info-rcar.o pfc-r8a7793.o
 obj-$(CONFIG_R8A7794) += lowlevel_init_ca15.o cpu_info-rcar.o pfc-r8a7794.o
-obj-$(CONFIG_R8A7795) += lowlevel_init_gen3.o cpu_info-rcar.o pfc-r8a7795.o
+obj-$(CONFIG_R8A7795) += lowlevel_init_gen3.o cpu_info-rcar.o pfc-r8a7795.o 
memmap-r8a7795.o
 obj-$(CONFIG_SH73A0) += lowlevel_init.o cpu_info-sh73a0.o pfc-sh73a0.o
 obj-$(CONFIG_TMU_TIMER) += ../../sh/lib/time.o
diff --git a/arch/arm/mach-rmobile/memmap-r8a7795.c 
b/arch/arm/mach-rmobile/memmap-r8a7795.c
new file mode 100644
index 000..c2c5e48
--- /dev/null
+++ b/arch/arm/mach-rmobile/memmap-r8a7795.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2016 Nobuhiro Iwamatsu 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+
+static struct mm_region r8a7795_mem_map[] = {
+   {
+   .virt = 0x0UL,
+   .phys = 0x0UL,
+   .size = 0x8000UL,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+PTE_BLOCK_INNER_SHARE
+   }, {
+   .virt = 0x8000UL,
+   .phys = 0x8000UL,
+   .size = 0x8000UL,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* List terminator */
+   0,
+   }
+};
+
+struct mm_region *mem_map = r8a7795_mem_map;
-- 
2.8.1

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


[U-Boot] [PATCH] ARM: rmobile: lager: Move rcar-gen2-common to rcar-common

2016-08-09 Thread Nobuhiro Iwamatsu
To common use of rcar-gen2-common directory in the R-Car SoCs,
and change from rcar-gen2-common to rcar-common.

Signed-off-by: Nobuhiro Iwamatsu 
---
 board/renesas/lager/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/renesas/lager/Makefile b/board/renesas/lager/Makefile
index 8d03461..0e44c69 100644
--- a/board/renesas/lager/Makefile
+++ b/board/renesas/lager/Makefile
@@ -6,4 +6,4 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-obj-y  := lager.o qos.o ../rcar-gen2-common/common.o
+obj-y  := lager.o qos.o ../rcar-common/common.o
-- 
2.8.1

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


[U-Boot] [PATCH] ARM: rmobile: Remove duplicate configs by Kconfig in rcar-gen3-common.h

2016-08-09 Thread Nobuhiro Iwamatsu
This commit remove dupilicate following configs from rcar-gen3-common.h.
  - CONFIG_CMD_BOOTZ
  - CONFIG_BOOTDELAY
  - CONFIG_CMD_EDITENV
  - CONFIG_CMD_SAVEENV
  - CONFIG_CMD_MEMORY
  - CONFIG_CMD_RUN
  - CONFIG_CMD_LOADS

Signed-off-by: Nobuhiro Iwamatsu 
---
 include/configs/rcar-gen3-common.h | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/include/configs/rcar-gen3-common.h 
b/include/configs/rcar-gen3-common.h
index 617a2cf..89cde20 100644
--- a/include/configs/rcar-gen3-common.h
+++ b/include/configs/rcar-gen3-common.h
@@ -13,18 +13,13 @@
 #include 
 
 #define CONFIG_CMD_BOOTI
-#define CONFIG_CMD_EDITENV
-#define CONFIG_CMD_SAVEENV
-#define CONFIG_CMD_MEMORY
 #define CONFIG_CMD_DFL
 #define CONFIG_CMD_SDRAM
-#define CONFIG_CMD_RUN
-#define CONFIG_CMD_LOADS
-#define CONFIG_CMD_BOOTZ
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_EXT4_WRITE
+#define CONFIG_CMD_FDT
 
 #define CONFIG_REMAKE_ELF
 
@@ -45,7 +40,6 @@
 #define CONFIG_OF_LIBFDT
 
 #define CONFIG_BAUDRATE115200
-#define CONFIG_BOOTDELAY   3
 
 #define CONFIG_VERSION_VARIABLE
 #undef CONFIG_SHOW_BOOT_PROGRESS
-- 
2.8.1

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


[U-Boot] [PATCH] ARM: rmobile: salvator-x: Update defconfig

2016-08-09 Thread Nobuhiro Iwamatsu
This moves some config from config files.

Signed-off-by: Nobuhiro Iwamatsu 
---
 configs/salvator-x_defconfig | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/configs/salvator-x_defconfig b/configs/salvator-x_defconfig
index 1cfdbd6..e16acd3 100644
--- a/configs/salvator-x_defconfig
+++ b/configs/salvator-x_defconfig
@@ -1,4 +1,12 @@
 CONFIG_ARM=y
+CONFIG_ARCH_RMOBILE=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_RCAR_GEN3=y
 CONFIG_TARGET_SALVATOR_X=y
-CONFIG_SPL=y
+CONFIG_BOOTSTAGE_USER_COUNT=0x20
+CONFIG_BOOTSTAGE_STASH_ADDR=0x0
+CONFIG_BOOTSTAGE_STASH_SIZE=0x4096
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_XIMG is not set
-- 
2.8.1

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


Re: [U-Boot] [PATCH v2] drivers: net: cpsw: always flush cache of size PKTSIZE_ALIGN

2016-08-09 Thread Joe Hershberger
Hi Lokesh

On Tue, Aug 9, 2016 at 12:47 AM, Lokesh Vutla  wrote:
> cpsw tries to flush dcache which is not in the range of PKTSIZE.
> Because of this the following warning comes while flushing:
>
> CACHE: Misaligned operation at range [dffecec0, dffed016]
>
> Fix it by flushing cache of size PKTSIZE_ALIGN as similar to what is
> being done in _cpsw_recv.
>
> Signed-off-by: Lokesh Vutla 
> ---
> Changes since v1:
> - Use PKTALIGN instead of cache line size
> - Need not align start of packet buffer from the network subsystem.
>
>  drivers/net/cpsw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
> index 2ce4ec6..8ce5716 100644
> --- a/drivers/net/cpsw.c
> +++ b/drivers/net/cpsw.c
> @@ -907,7 +907,7 @@ static int _cpsw_send(struct cpsw_priv *priv, void 
> *packet, int length)
> int timeout = CPDMA_TIMEOUT;
>
> flush_dcache_range((unsigned long)packet,
> -  (unsigned long)packet + length);
> +  (unsigned long)packet + PKTSIZE_ALIGN);

Technically you are flushing more than needed since you just need to
be aligned to the cacheline beyond the size being sent, but you are
flushing the maximum packet size every time. That said, it's still
going to work and the code is readable. I'm fine with this, but wanted
to make sure you knew this is more flushing than needed.

Acked-by: Joe Hershberger 

> /* first reap completed packets */
> while (timeout-- &&
> --
> 2.9.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


[U-Boot] [PATCH v11] mmc: atmel_sdhci: Convert to the driver model support

2016-08-09 Thread Wenyou Yang
Convert the driver to the driver model while retaining the existing
legacy code. This allows the driver to support boards that have
converted to driver model as well as those that have not.

Signed-off-by: Wenyou Yang 
Reviewed-by: Simon Glass 
Reviewed-by: Jaehoon Chung 
Reviewed-by: Heiko Schocher 
---

Changes in v11:
 - Due the removal of unnecessary arguments for sdhci_setup_cfg(),
   change accordingly.

Changes in v10:
 - Add Reviewed-by tag.

Changes in v9:
 - Add Reviewed-by tag.

Changes in v8:
 - Make atmel_sdhci_get_clk() to get clock device.
 - Use ulong type for gck_rate.
 - Remove meaningless type casting before dev->name.

Changes in v7:
 - Add support for using driver model for block devices and MMC operations.
 - Change clk_client.h -> clk.h to adapt to clk API conversion.

Changes in v6:
 - Remove unnecessary white space.
 - Use sdhci_read(), instead of readl().
 - Remove the local variables min_clk.

Changes in v5:
 - Add Reviewed-by tag.

Changes in v4:
 - Update the clk API based on [PATCH] clk: convert API to match
   reset/mailbox fstyle (http://patchwork.ozlabs.org/patch/625342/).
 - Remove check on dev_get_parent() return.
 - Fixed the return value, such as -ENODEV->-EINVAL.

Changes in v3:
 - Remove the redundant log print.

Changes in v2:
 - Add clock support, include enabling peripheral clock
   and generated clock.
 - Retain the existing legacy code to support boards which have not
   converted to driver model.

 drivers/mmc/Kconfig   |  10 
 drivers/mmc/atmel_sdhci.c | 123 ++
 include/sdhci.h   |   2 +
 3 files changed, 135 insertions(+)

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index dc8f2b6..3616dee 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -34,6 +34,16 @@ config MSM_SDHCI
   SD 3.0 specifications. Both SD and eMMC devices are supported.
  Card-detect gpios are not supported.
 
+config ATMEL_SDHCI
+   bool "Atmel SDHCI controller support"
+   depends on DM_MMC && BLK && DM_MMC_OPS && ARCH_AT91
+   help
+ This enables support for the Atmel SDHCI controller, which supports
+ the embedded MultiMedia Card (e.MMC) Specification V4.51, the SD
+ Memory Card Specification V3.0, and the SDIO V3.0 specification.
+ It is compliant with the SD Host Controller Standard V3.0
+ specification.
+
 config ROCKCHIP_DWMMC
bool "Rockchip SD/MMC controller support"
depends on DM_MMC && OF_CONTROL
diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c
index 24b68b6..dd6bd33 100644
--- a/drivers/mmc/atmel_sdhci.c
+++ b/drivers/mmc/atmel_sdhci.c
@@ -6,12 +6,15 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 
 #define ATMEL_SDHC_MIN_FREQ40
 
+#ifndef CONFIG_DM_MMC
 int atmel_sdhci_init(void *regbase, u32 id)
 {
struct sdhci_host *host;
@@ -38,3 +41,123 @@ int atmel_sdhci_init(void *regbase, u32 id)
 
return 0;
 }
+
+#else
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct atmel_sdhci_plat {
+   struct mmc_config cfg;
+   struct mmc mmc;
+};
+
+static int atmel_sdhci_get_clk(struct udevice *dev, int index, struct clk *clk)
+{
+   struct udevice *dev_clk;
+   int periph, ret;
+
+   ret = clk_get_by_index(dev, index, clk);
+   if (ret)
+   return ret;
+
+   periph = fdtdec_get_uint(gd->fdt_blob, clk->dev->of_offset, "reg", -1);
+   if (periph < 0)
+   return -EINVAL;
+
+   dev_clk = dev_get_parent(clk->dev);
+   ret = clk_request(dev_clk, clk);
+   if (ret)
+   return ret;
+
+   clk->id = periph;
+
+   return 0;
+}
+
+static int atmel_sdhci_probe(struct udevice *dev)
+{
+   struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+   struct atmel_sdhci_plat *plat = dev_get_platdata(dev);
+   struct sdhci_host *host = dev_get_priv(dev);
+   u32 max_clk;
+   u32 caps, caps_1;
+   u32 clk_base, clk_mul;
+   ulong gck_rate;
+   struct clk clk;
+   int ret;
+
+   ret = atmel_sdhci_get_clk(dev, 0, );
+   if (ret)
+   return ret;
+
+   ret = clk_enable();
+   if (ret)
+   return ret;
+
+   host->name = dev->name;
+   host->ioaddr = (void *)dev_get_addr(dev);
+
+   host->quirks = 0;
+   host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+"bus-width", 4);
+
+   caps = sdhci_readl(host, SDHCI_CAPABILITIES);
+   clk_base = (caps & SDHCI_CLOCK_V3_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT;
+   caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
+   clk_mul = (caps_1 & SDHCI_CLOCK_MUL_MASK) >> SDHCI_CLOCK_MUL_SHIFT;
+   gck_rate = clk_base * 100 * (clk_mul + 1);
+
+   ret = atmel_sdhci_get_clk(dev, 1, );
+   if (ret)
+   return ret;
+
+   ret 

Re: [U-Boot] [PATCH v2] i2c: intel_i2c: SMBus driver PCI addition (e.g. BayTrail)

2016-08-09 Thread Simon Glass
Hi Stefan,

On 8 August 2016 at 23:41, Stefan Roese  wrote:
> This patch adds support for the SMBus block read/write functionality.
> Other protocols like the SMBus quick command need to get added
> if this is needed.
>
> This patch also removed the SMBus related defines from the Ivybridge
> pch.h header. As they are integrated in this driver and should be
> used from here. This change is added in this patch to avoid compile
> breakage to keep the source git bisectable.
>
> Tested on a congatec BayTrail board to configure the SMSC2513 USB
> hub.
>
> Signed-off-by: Stefan Roese 
> Cc: Bin Meng 
> Cc: Simon Glass 
> Cc: Heiko Schocher 
> Cc: George McCollister 
> ---
> v2:
> - Avoid using BSS. Patch from Simon intergrated to fix problem before
>   relocation.
> - Remove IvyBridge code and add PCI device for IvyBridge (Panther Point
>   PCH).
> - Add overrun check to smbus_block_read() as suggested by George
>
>  arch/x86/include/asm/arch-ivybridge/pch.h |  26 ---
>  drivers/i2c/intel_i2c.c   | 290 
> +++---
>  2 files changed, 269 insertions(+), 47 deletions(-)
>

This does not crash, but I see nothing on the bus with 'i2c dev 0; i2c
probe'. Is that expected?

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


[U-Boot] [PATCH v1] rockchip: rk3288-firefly: enable boot from eMMC

2016-08-09 Thread Jacob Chen
Add eMMC dt node and define fallback boot devices.

Signed-off-by: Jacob Chen 
---

 arch/arm/dts/rk3288-firefly.dts   | 4 
 board/firefly/firefly-rk3288/firefly-rk3288.c | 8 
 2 files changed, 12 insertions(+)

diff --git a/arch/arm/dts/rk3288-firefly.dts b/arch/arm/dts/rk3288-firefly.dts
index 3176d50..b54359e 100644
--- a/arch/arm/dts/rk3288-firefly.dts
+++ b/arch/arm/dts/rk3288-firefly.dts
@@ -67,6 +67,10 @@
u-boot,dm-pre-reloc;
 };
 
+ {
+   u-boot,dm-pre-reloc;
+};
+
  {
u-boot,dm-pre-reloc;
 };
diff --git a/board/firefly/firefly-rk3288/firefly-rk3288.c 
b/board/firefly/firefly-rk3288/firefly-rk3288.c
index 5119e95..3e89389 100644
--- a/board/firefly/firefly-rk3288/firefly-rk3288.c
+++ b/board/firefly/firefly-rk3288/firefly-rk3288.c
@@ -5,3 +5,11 @@
  */
 
 #include 
+#include 
+
+void board_boot_order(u32 *spl_boot_list)
+{
+   /* eMMC prior to sdcard. */
+   spl_boot_list[0] = BOOT_DEVICE_MMC2;
+   spl_boot_list[1] = BOOT_DEVICE_MMC1;
+}
-- 
1.9.1

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


Re: [U-Boot] [PATCH v2 00/22] spi/sf: Updates on flash detection

2016-08-09 Thread Bin Meng
Hi Jagan,

On Wed, Aug 10, 2016 at 4:03 AM, Jagan Teki  wrote:
> Updated spi_flash_info table in sync with Linux, and removed
> legacy and unsupported code.
>
> Changes for v2:
> - New patches.
>

Is this a new version of previous spi-nor framework work?

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


Re: [U-Boot] [PATCH 1/6] x86: Add implementations of setjmp() and longjmp()

2016-08-09 Thread Bin Meng
Hi Simon,

On Wed, Aug 10, 2016 at 2:16 AM, Simon Glass  wrote:
> Hi Bin,
>
> On 9 August 2016 at 00:49, Bin Meng  wrote:
>> Hi Simon,
>>
>> On Sun, Aug 7, 2016 at 7:23 AM, Simon Glass  wrote:
>>> Bring in these functions from Linux v4.4. They will be needed for EFI loader
>>> support.
>>>
>>> Signed-off-by: Simon Glass 
>>> ---
>>>
>>>  arch/x86/cpu/Makefile |  2 +-
>>>  arch/x86/cpu/setjmp.S | 71 
>>> +++
>>>  arch/x86/include/asm/setjmp.h | 24 +++
>>>  3 files changed, 96 insertions(+), 1 deletion(-)
>>>  create mode 100644 arch/x86/cpu/setjmp.S
>>>  create mode 100644 arch/x86/include/asm/setjmp.h
>>>
>>> diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
>>> index 2667e0b..f5b8c9e 100644
>>> --- a/arch/x86/cpu/Makefile
>>> +++ b/arch/x86/cpu/Makefile
>>> @@ -10,7 +10,7 @@
>>>
>>>  extra-y= start.o
>>>  obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o
>>> -obj-y  += interrupts.o cpu.o cpu_x86.o call64.o
>>> +obj-y  += interrupts.o cpu.o cpu_x86.o call64.o setjmp.o
>>>
>>>  AFLAGS_REMOVE_call32.o := -mregparm=3 \
>>> $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32)
>>> diff --git a/arch/x86/cpu/setjmp.S b/arch/x86/cpu/setjmp.S
>>> new file mode 100644
>>> index 000..24e7d8a
>>> --- /dev/null
>>> +++ b/arch/x86/cpu/setjmp.S
>>> @@ -0,0 +1,71 @@
>>> +/*
>>> + * Written by H. Peter Anvin 
>>> + * Brought in from Linux v4.4 and modified for U-Boot
>>> + * From Linux arch/um/sys-i386/setjmp.S
>>> + *
>>> + * SPDX-License-Identifier:GPL-2.0
>>> + */
>>> +
>>> +#include 
>>> +#include 
>>> +#include 
>>> +
>>> +#define _REGPARM
>>> +
>>> +/*
>>> + * The jmp_buf is assumed to contain the following, in order:
>>> + * %ebx
>>> + * %esp
>>> + * %ebp
>>> + * %esi
>>> + * %edi
>>> + * 
>>> + */
>>> +
>>> +   /*
>>> +* rdi - 32-bit code segment selector
>>> +* rsi - target address
>>> +* rdx - table address (0 if none)
>>> +*/
>>
>> The comment above looks irrelevant.
>
> OK, will drop.
>
>>
>>> +   .text
>>> +   .align 4
>>> +   .globl setjmp
>>> +   .type setjmp, @function
>>> +setjmp:
>>> +#ifdef _REGPARM
>>> +   movl %eax,%edx
>>
>> nits: needs space after ",". please fix this globally in this file.
>>
>>> +#else
>>> +   movl 4(%esp),%edx
>>> +#endif
>>> +   popl %ecx   # Return address, and adjust the 
>>> stack
>>
>> I believe # is deprecated. We should use /* */
>
> OK
>
>>
>>> +   xorl %eax,%eax  # Return value
>>> +   movl %ebx,(%edx)
>>> +   movl %esp,4(%edx)   # Post-return %esp!
>>> +   pushl %ecx  # Make the call/return stack happy
>>> +   movl %ebp,8(%edx)
>>> +   movl %esi,12(%edx)
>>> +   movl %edi,16(%edx)
>>> +   movl %ecx,20(%edx)  # Return address
>>> +   ret
>>> +
>>> +   .size setjmp,.-setjmp
>>
>> What is this .size for?
>
> Size of the function code. It helps with nm --size-sort I think.
>
>>
>>> +
>>> +   .text
>>
>> nits: not necessary
>>
>>> +   .align 4
>>> +   .globl longjmp
>>> +   .type longjmp, @function
>>> +longjmp:
>>> +#ifdef _REGPARM
>>> +   xchgl %eax,%edx
>>> +#else
>>> +   movl 4(%esp),%edx   # jmp_ptr address
>>> +   movl 8(%esp),%eax   # Return value
>>> +#endif
>>> +   movl (%edx),%ebx
>>> +   movl 4(%edx),%esp
>>> +   movl 8(%edx),%ebp
>>> +   movl 12(%edx),%esi
>>> +   movl 16(%edx),%edi
>>> +   jmp *20(%edx)
>>> +
>>> +   .size longjmp,.-longjmp
>>> diff --git a/arch/x86/include/asm/setjmp.h b/arch/x86/include/asm/setjmp.h
>>> new file mode 100644
>>> index 000..deef67e
>>> --- /dev/null
>>> +++ b/arch/x86/include/asm/setjmp.h
>>> @@ -0,0 +1,24 @@
>>> +/*
>>> + * Written by H. Peter Anvin 
>>> + * Brought in from Linux v4.4 and modified for U-Boot
>>> + * From Linux arch/um/sys-i386/setjmp.S
>>> + *
>>> + * SPDX-License-Identifier:GPL-2.0
>>> + */
>>> +
>>> +#ifndef __setjmp_h
>>> +#define __setjmp_h
>>> +
>>> +struct jmp_buf_data {
>>> +   unsigned int __ebx;
>>> +   unsigned int __esp;
>>> +   unsigned int __ebp;
>>> +   unsigned int __esi;
>>> +   unsigned int __edi;
>>> +   unsigned int __eip;
>>> +};
>>> +
>>> +int setjmp(struct jmp_buf_data *jmp_buf);
>>> +void longjmp(struct jmp_buf_data *jmp_buf);
>>
>> shouldn't it be void longjmp(struct jmp_buf_data *jmp_buf, int val)? I
>> am wondering how EFI loader could work with this longjmp()?
>
> efi_exit() seems to not need the extra parameter.

This does not look good to me. See efi_start_image(), there is a test
against return value of setjmp(), but longjmp() does not provide a
return value, which means the return value is undetermined.

if (setjmp(>exit_jmp)) {
/* We returned from the 

Re: [U-Boot] [PATCH v10] mmc: atmel_sdhci: Convert to the driver model support

2016-08-09 Thread Jaehoon Chung
Hi Wenyou,

On 08/10/2016 11:03 AM, wenyou.y...@microchip.com wrote:
> Hi Pantelis,
> 
> Do you have some comments?

You have to rebase on latest u-boot. Because some function is changed.
Refer to below comment.

> 
> 
> Best Regards,
> Wenyou Yang
> 
>> -Original Message-
>> From: Wenyou Yang [mailto:wenyou.y...@atmel.com]
>> Sent: 2016年8月5日 9:07
>> To: U-Boot Mailing List ; Pantelis Antoniou
>> 
>> Cc: Heiko Schocher ; Simon Glass ; Andreas
>> Bießmann ; Jaehoon Chung
>> ; Wenyou Yang 
>> Subject: [PATCH v10] mmc: atmel_sdhci: Convert to the driver model support
>>
>> Convert the driver to the driver model while retaining the existing legacy 
>> code.
>> This allows the driver to support boards that have converted to driver model 
>> as
>> well as those that have not.
>>
>> Signed-off-by: Wenyou Yang 
>> Reviewed-by: Simon Glass 
>> Reviewed-by: Jaehoon Chung 
>> Reviewed-by: Heiko Schocher 
>> ---
>>
>> Changes in v10:
>>  - Add Reviewed-by tag.
>>
>> Changes in v9:
>>  - Add Reviewed-by tag.
>>
>> Changes in v8:
>>  - Make atmel_sdhci_get_clk() to get clock device.
>>  - Use ulong type for gck_rate.
>>  - Remove meaningless type casting before dev->name.
>>
>> Changes in v7:
>>  - Add support for using driver model for block devices and MMC operations.
>>  - Change clk_client.h -> clk.h to adapt to clk API conversion.
>>
>> Changes in v6:
>>  - Remove unnecessary white space.
>>  - Use sdhci_read(), instead of readl().
>>  - Remove the local variables min_clk.
>>
>> Changes in v5:
>>  - Add Reviewed-by tag.
>>
>> Changes in v4:
>>  - Update the clk API based on [PATCH] clk: convert API to match
>>reset/mailbox fstyle (http://patchwork.ozlabs.org/patch/625342/).
>>  - Remove check on dev_get_parent() return.
>>  - Fixed the return value, such as -ENODEV->-EINVAL.
>>
>> Changes in v3:
>>  - Remove the redundant log print.
>>
>> Changes in v2:
>>  - Add clock support, include enabling peripheral clock
>>and generated clock.
>>  - Retain the existing legacy code to support boards which have not
>>converted to driver model.
>>
>>  drivers/mmc/Kconfig   |  10 
>>  drivers/mmc/atmel_sdhci.c | 127
>> ++
>>  include/sdhci.h   |   2 +
>>  3 files changed, 139 insertions(+)
>>
>> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 79cf18f..49b325e
>> 100644
>> --- a/drivers/mmc/Kconfig
>> +++ b/drivers/mmc/Kconfig
>> @@ -34,6 +34,16 @@ config MSM_SDHCI
>>SD 3.0 specifications. Both SD and eMMC devices are supported.
>>Card-detect gpios are not supported.
>>
>> +config ATMEL_SDHCI
>> +bool "Atmel SDHCI controller support"
>> +depends on DM_MMC && BLK && DM_MMC_OPS && ARCH_AT91
>> +help
>> +  This enables support for the Atmel SDHCI controller, which supports
>> +  the embedded MultiMedia Card (e.MMC) Specification V4.51, the SD
>> +  Memory Card Specification V3.0, and the SDIO V3.0 specification.
>> +  It is compliant with the SD Host Controller Standard V3.0
>> +  specification.
>> +
>>  config ROCKCHIP_DWMMC
>>  bool "Rockchip SD/MMC controller support"
>>  depends on DM_MMC && OF_CONTROL
>> diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c index
>> 24b68b6..8a4f347 100644
>> --- a/drivers/mmc/atmel_sdhci.c
>> +++ b/drivers/mmc/atmel_sdhci.c
>> @@ -6,12 +6,15 @@
>>   */
>>
>>  #include 
>> +#include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>>
>>  #define ATMEL_SDHC_MIN_FREQ 40
>>
>> +#ifndef CONFIG_DM_MMC
>>  int atmel_sdhci_init(void *regbase, u32 id)  {
>>  struct sdhci_host *host;
>> @@ -38,3 +41,127 @@ int atmel_sdhci_init(void *regbase, u32 id)
>>
>>  return 0;
>>  }
>> +
>> +#else
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +struct atmel_sdhci_plat {
>> +struct mmc_config cfg;
>> +struct mmc mmc;
>> +};
>> +
>> +static int atmel_sdhci_get_clk(struct udevice *dev, int index, struct
>> +clk *clk) {
>> +struct udevice *dev_clk;
>> +int periph, ret;
>> +
>> +ret = clk_get_by_index(dev, index, clk);
>> +if (ret)
>> +return ret;
>> +
>> +periph = fdtdec_get_uint(gd->fdt_blob, clk->dev->of_offset, "reg", -1);
>> +if (periph < 0)
>> +return -EINVAL;
>> +
>> +dev_clk = dev_get_parent(clk->dev);
>> +ret = clk_request(dev_clk, clk);
>> +if (ret)
>> +return ret;
>> +
>> +clk->id = periph;
>> +
>> +return 0;
>> +}
>> +
>> +static int atmel_sdhci_probe(struct udevice *dev) {
>> +struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
>> +struct atmel_sdhci_plat *plat = dev_get_platdata(dev);
>> +struct sdhci_host *host = dev_get_priv(dev);
>> +u32 max_clk;
>> +u32 caps, caps_1;
>> +u32 

Re: [U-Boot] [PATCH v10] mmc: atmel_sdhci: Convert to the driver model support

2016-08-09 Thread Wenyou.Yang
Hi Pantelis,

Do you have some comments?


Best Regards,
Wenyou Yang

> -Original Message-
> From: Wenyou Yang [mailto:wenyou.y...@atmel.com]
> Sent: 2016年8月5日 9:07
> To: U-Boot Mailing List ; Pantelis Antoniou
> 
> Cc: Heiko Schocher ; Simon Glass ; Andreas
> Bießmann ; Jaehoon Chung
> ; Wenyou Yang 
> Subject: [PATCH v10] mmc: atmel_sdhci: Convert to the driver model support
> 
> Convert the driver to the driver model while retaining the existing legacy 
> code.
> This allows the driver to support boards that have converted to driver model 
> as
> well as those that have not.
> 
> Signed-off-by: Wenyou Yang 
> Reviewed-by: Simon Glass 
> Reviewed-by: Jaehoon Chung 
> Reviewed-by: Heiko Schocher 
> ---
> 
> Changes in v10:
>  - Add Reviewed-by tag.
> 
> Changes in v9:
>  - Add Reviewed-by tag.
> 
> Changes in v8:
>  - Make atmel_sdhci_get_clk() to get clock device.
>  - Use ulong type for gck_rate.
>  - Remove meaningless type casting before dev->name.
> 
> Changes in v7:
>  - Add support for using driver model for block devices and MMC operations.
>  - Change clk_client.h -> clk.h to adapt to clk API conversion.
> 
> Changes in v6:
>  - Remove unnecessary white space.
>  - Use sdhci_read(), instead of readl().
>  - Remove the local variables min_clk.
> 
> Changes in v5:
>  - Add Reviewed-by tag.
> 
> Changes in v4:
>  - Update the clk API based on [PATCH] clk: convert API to match
>reset/mailbox fstyle (http://patchwork.ozlabs.org/patch/625342/).
>  - Remove check on dev_get_parent() return.
>  - Fixed the return value, such as -ENODEV->-EINVAL.
> 
> Changes in v3:
>  - Remove the redundant log print.
> 
> Changes in v2:
>  - Add clock support, include enabling peripheral clock
>and generated clock.
>  - Retain the existing legacy code to support boards which have not
>converted to driver model.
> 
>  drivers/mmc/Kconfig   |  10 
>  drivers/mmc/atmel_sdhci.c | 127
> ++
>  include/sdhci.h   |   2 +
>  3 files changed, 139 insertions(+)
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 79cf18f..49b325e
> 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -34,6 +34,16 @@ config MSM_SDHCI
>SD 3.0 specifications. Both SD and eMMC devices are supported.
> Card-detect gpios are not supported.
> 
> +config ATMEL_SDHCI
> + bool "Atmel SDHCI controller support"
> + depends on DM_MMC && BLK && DM_MMC_OPS && ARCH_AT91
> + help
> +   This enables support for the Atmel SDHCI controller, which supports
> +   the embedded MultiMedia Card (e.MMC) Specification V4.51, the SD
> +   Memory Card Specification V3.0, and the SDIO V3.0 specification.
> +   It is compliant with the SD Host Controller Standard V3.0
> +   specification.
> +
>  config ROCKCHIP_DWMMC
>   bool "Rockchip SD/MMC controller support"
>   depends on DM_MMC && OF_CONTROL
> diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c index
> 24b68b6..8a4f347 100644
> --- a/drivers/mmc/atmel_sdhci.c
> +++ b/drivers/mmc/atmel_sdhci.c
> @@ -6,12 +6,15 @@
>   */
> 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> 
>  #define ATMEL_SDHC_MIN_FREQ  40
> 
> +#ifndef CONFIG_DM_MMC
>  int atmel_sdhci_init(void *regbase, u32 id)  {
>   struct sdhci_host *host;
> @@ -38,3 +41,127 @@ int atmel_sdhci_init(void *regbase, u32 id)
> 
>   return 0;
>  }
> +
> +#else
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +struct atmel_sdhci_plat {
> + struct mmc_config cfg;
> + struct mmc mmc;
> +};
> +
> +static int atmel_sdhci_get_clk(struct udevice *dev, int index, struct
> +clk *clk) {
> + struct udevice *dev_clk;
> + int periph, ret;
> +
> + ret = clk_get_by_index(dev, index, clk);
> + if (ret)
> + return ret;
> +
> + periph = fdtdec_get_uint(gd->fdt_blob, clk->dev->of_offset, "reg", -1);
> + if (periph < 0)
> + return -EINVAL;
> +
> + dev_clk = dev_get_parent(clk->dev);
> + ret = clk_request(dev_clk, clk);
> + if (ret)
> + return ret;
> +
> + clk->id = periph;
> +
> + return 0;
> +}
> +
> +static int atmel_sdhci_probe(struct udevice *dev) {
> + struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> + struct atmel_sdhci_plat *plat = dev_get_platdata(dev);
> + struct sdhci_host *host = dev_get_priv(dev);
> + u32 max_clk;
> + u32 caps, caps_1;
> + u32 clk_base, clk_mul;
> + ulong gck_rate;
> + struct clk clk;
> + int ret;
> +
> + ret = atmel_sdhci_get_clk(dev, 0, );
> + if (ret)
> + return ret;
> +
> + ret = clk_enable();
> + if (ret)
> + return ret;
> +
> + host->name 

[U-Boot] [PATCH] rockchip: rk3288-firefly: enable boot from eMMC

2016-08-09 Thread Jacob Chen
Add eMMC dt node and define fallback boot devices.

Signed-off-by: Jacob Chen 
---

 arch/arm/dts/rk3288-firefly.dts   | 5 +
 board/firefly/firefly-rk3288/firefly-rk3288.c | 8 
 2 files changed, 13 insertions(+)

diff --git a/arch/arm/dts/rk3288-firefly.dts b/arch/arm/dts/rk3288-firefly.dts
index 3176d50..27f348e 100644
--- a/arch/arm/dts/rk3288-firefly.dts
+++ b/arch/arm/dts/rk3288-firefly.dts
@@ -67,6 +67,11 @@
u-boot,dm-pre-reloc;
 };
 
+ {
+   u-boot,dm-pre-reloc;
+};
+
+
  {
u-boot,dm-pre-reloc;
 };
diff --git a/board/firefly/firefly-rk3288/firefly-rk3288.c 
b/board/firefly/firefly-rk3288/firefly-rk3288.c
index 5119e95..3e89389 100644
--- a/board/firefly/firefly-rk3288/firefly-rk3288.c
+++ b/board/firefly/firefly-rk3288/firefly-rk3288.c
@@ -5,3 +5,11 @@
  */
 
 #include 
+#include 
+
+void board_boot_order(u32 *spl_boot_list)
+{
+   /* eMMC prior to sdcard. */
+   spl_boot_list[0] = BOOT_DEVICE_MMC2;
+   spl_boot_list[1] = BOOT_DEVICE_MMC1;
+}
-- 
1.9.1

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


Re: [U-Boot] [PATCH] efi_loader: disk: Fix CONFIG_BLK breakage

2016-08-09 Thread Tom Rini
On Mon, Aug 08, 2016 at 03:44:30PM -0600, Simon Glass wrote:
> Hi Alexander,
> 
> On 5 August 2016 at 06:49, Alexander Graf  wrote:
> > When using CONFIG_BLK, there were 2 issues:
> >
> >   1) The name we generate the device with has to match the
> >  name we set in efi_set_bootdev()
> >
> >   2) The device we pass into our block functions was wrong,
> >  we should not rediscover it but just use the already known
> >  pointer.
> >
> > This patch fixes both issues.
> >
> > Signed-off-by: Alexander Graf 
> > ---
> >  cmd/bootefi.c | 23 ++-
> >  lib/efi_loader/efi_disk.c | 18 +++---
> >  2 files changed, 29 insertions(+), 12 deletions(-)
> >
> > diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> > index b8ecf4c..53a6ee3 100644
> > --- a/cmd/bootefi.c
> > +++ b/cmd/bootefi.c
> > @@ -8,6 +8,7 @@
> >
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -269,18 +270,30 @@ void efi_set_bootdev(const char *dev, const char 
> > *devnr, const char *path)
> > char devname[32] = { 0 }; /* dp->str is u16[32] long */
> > char *colon;
> >
> > -   /* Assemble the condensed device name we use in efi_disk.c */
> > -   snprintf(devname, sizeof(devname), "%s%s", dev, devnr);
> > +#if defined(CONFIG_BLK) || defined(CONFIG_ISO_PARTITION)
> > +   desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
> > +#endif
> > +
> > +#ifdef CONFIG_BLK
> > +   if (desc) {
> > +   snprintf(devname, sizeof(devname), "%s", desc->bdev->name);
> > +   } else
> > +#endif
> > +
> > +   {
> > +   /* Assemble the condensed device name we use in efi_disk.c 
> > */
> > +   snprintf(devname, sizeof(devname), "%s%s", dev, devnr);
> > +   }
> > +
> > colon = strchr(devname, ':');
> >
> >  #ifdef CONFIG_ISO_PARTITION
> > /* For ISOs we create partition block devices */
> > -   desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
> > if (desc && (desc->type != DEV_TYPE_UNKNOWN) &&
> > (desc->part_type == PART_TYPE_ISO)) {
> > if (!colon)
> > -   snprintf(devname, sizeof(devname), "%s%s:1", dev,
> > -devnr);
> > +   snprintf(devname, sizeof(devname), "%s:1", devname);
> > +
> > colon = NULL;
> > }
> >  #endif
> > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> > index c434c92..e00a747 100644
> > --- a/lib/efi_loader/efi_disk.c
> > +++ b/lib/efi_loader/efi_disk.c
> > @@ -31,6 +31,8 @@ struct efi_disk_obj {
> > struct efi_device_path_file_path *dp;
> > /* Offset into disk for simple partitions */
> > lbaint_t offset;
> > +   /* Internal block device */
> > +   const struct blk_desc *desc;
> 
> Rather than storing this, can you store the udevice?

Sorry, I had had this patch testing for a bit and missed this.

-- 
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 1/4] Sandbox: document support of block device emulation

2016-08-09 Thread Simon Glass
On 9 August 2016 at 16:44, Stefan Brüns 
wrote:
> Signed-off-by: Stefan Brüns 
> ---
> board/sandbox/README.sandbox | 19 +++
> 1 file changed, 19 insertions(+)

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


Re: [U-Boot] [PATCH v7 0/4] ARM: AT91: Add AT91 PIO4 pinctrl driver and gpio driver with DM

2016-08-09 Thread Wenyou.Yang
HI Andreas,

Do you have some comments on this series?


Best Regards,
Wenyou Yang

> -Original Message-
> From: Wenyou Yang [mailto:wenyou.y...@atmel.com]
> Sent: 2016年7月20日 17:16
> To: U-Boot Mailing List 
> Cc: Stephen Warren ; Andreas Bießmann
> ; Simon Glass ; Wenyou Yang
> 
> Subject: [PATCH v7 0/4] ARM: AT91: Add AT91 PIO4 pinctrl driver and gpio
> driver with DM
> 
> AT91 PIO4 controller is a combined gpio-controller, pin-mux and pin-config
> module.
> 
> This patch is to add the pinctrl driver, and rework the atmel-pio4 gpio 
> driver to
> support driver model and device tree.
> 
> Changes in v7:
>  - Change clk_client.h -> clk.h to adapt to clk API conversion.
>  - Drop [PATCH]: configs: sama5d2_xplained: Add #ifndef before
>CONFIG_ATMEL_PIO4.
> 
> Changes in v6:
>  - Add Reviewed-by tag.
>  - Fixed the return value, -EINVAL -> ret.
> 
> Changes in v5:
>  - Update the clk API based on [PATCH] clk: convert API to match
>reset/mailbox fstyle (http://patchwork.ozlabs.org/patch/625342/).
>  - Use clrbits_le32() to replace readl()/writel().
>  - Fixed the return value, -ENODEV->-EINVAL.
>  - Remove check on dev_get_parent() return.
>  - Fixed the return value, -ENODEV->-EINVAL.
>  - Remove check on dev_get_parent() return.
> 
> Changes in v4:
>  - Remove the redundant log print.
> 
> Changes in v3:
>  - Add bind callback to support the pinctl device regarding as
>a child of atmel_pio4 device.
>  - Add clock support.
>  - Rework due to the pinctrl device is regarded as atmel_pio4
>device's child.
> 
> Changes in v2:
>  - remove meaningless comment.
>  - add else path for argument of pinconf.
>  - add inline attribute for atmel_pio4_bank_base().
>  - add handle if the pinmux entries is greater maximum value.
>  - add detailed example to show how to configure pinctrl for device.
>  - remove interrupt and gpio property description.
>  - add reviewed-by tag.
> 
> Wenyou Yang (4):
>   gpio: atmel_pio4: Move PIO4 definitions to head file
>   gpio: atmel_pio4: Rework to support DM & DT
>   pinctrl: at91-pio4: Add pinctrl driver
>   atmel: Bring in at91 pio4 device tree file and bindings
> 
>  arch/arm/dts/sama5d2-pinfunc.h | 880 
> +
>  arch/arm/mach-at91/include/mach/atmel_pio4.h   |  35 +
>  .../pinctrl/atmel,at91-pio4-pinctrl.txt|  66 ++
>  drivers/gpio/Kconfig   |   2 +-
>  drivers/gpio/atmel_pio4.c  | 201 +++--
>  drivers/pinctrl/Kconfig|   7 +
>  drivers/pinctrl/Makefile   |   1 +
>  drivers/pinctrl/pinctrl-at91-pio4.c| 182 +
>  8 files changed, 1302 insertions(+), 72 deletions(-)  create mode 100644
> arch/arm/dts/sama5d2-pinfunc.h  create mode 100644 doc/device-tree-
> bindings/pinctrl/atmel,at91-pio4-pinctrl.txt
>  create mode 100644 drivers/pinctrl/pinctrl-at91-pio4.c
> 
> --
> 2.7.4

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


Re: [U-Boot] [PATCH v5] clk: at91: Add clock driver

2016-08-09 Thread Wenyou.Yang
Hi Andreas, 

Do you have some comments?


Best Regards,
Wenyou Yang

> -Original Message-
> From: Wenyou Yang [mailto:wenyou.y...@atmel.com]
> Sent: 2016年7月20日 17:55
> To: U-Boot Mailing List 
> Cc: Stephen Warren ; Andreas Bießmann
> ; Simon Glass ; Wenyou Yang
> 
> Subject: [PATCH v5] clk: at91: Add clock driver
> 
> The patch is referred to at91 clock driver of Linux, to make the clock node
> descriptions in DT aligned with the Linux's.
> 
> Signed-off-by: Wenyou Yang 
> Reviewed-by: Simon Glass 
> ---
> 
> Changes in v5:
>  - Change clk_client.h -> clk.h to adapt to clk API conversion.
>  - Fix missing semicolon and clk->dev in clk-generated.c.
>  - Make clock options selectable via menuconfig.
> 
> Changes in v4:
>  - Add Reviewed-by tag.
>  - Add more information in Kconfig help.
>  - Use u32 for num_parents variable, not u8.
>  - Change the check return from clk_get_rate().
>  - Remove return -ENODEV line, use return ret.
>  - Improve the comments in at91_system_clk_enable().
> 
> Changes in v3:
>  - Update based on [PATCH] clk: convert API to match reset/mailbox
>style (http://patchwork.ozlabs.org/patch/625342/).
>  - Remove [PATCH] clk: clk-uclass: Add post binding for CLK uclass,
>add bind() method to bind the clk node without compatible.
>  - Add help for Kconfig HAVE_AT91_XX option.
>  - Add ofdata_to_platdata() method for generated clock driver
>to handle the device tree.
>  - Use setbits_le32() to replace readl()/writel().
>  - Fixed the return value, -ENODEV->-EINVAL.
>  - Use dev_get_addr_ptr() to replace dev_get_addr().
>  - Remove check on dev_get_parent() return.
> 
> Changes in v2:
>  - Remove the redundant log print.
> 
>  arch/arm/mach-at91/include/mach/at91_pmc.h |  11 +-
>  drivers/clk/Kconfig|   1 +
>  drivers/clk/Makefile   |   1 +
>  drivers/clk/at91/Kconfig   |  43 
>  drivers/clk/at91/Makefile  |  11 ++
>  drivers/clk/at91/clk-generated.c   | 162
> +
>  drivers/clk/at91/clk-h32mx.c   |  56 ++
>  drivers/clk/at91/clk-main.c|  55 ++
>  drivers/clk/at91/clk-master.c  |  33 ++
>  drivers/clk/at91/clk-peripheral.c  |  60 +++
>  drivers/clk/at91/clk-plla.c|  55 ++
>  drivers/clk/at91/clk-slow.c|  37 +++
>  drivers/clk/at91/clk-system.c  |  76 ++
>  drivers/clk/at91/clk-utmi.c|  67 
>  drivers/clk/at91/pmc.c |  71 +
>  drivers/clk/at91/pmc.h |  18 
>  drivers/clk/at91/sckc.c|  30 ++
>  17 files changed, 784 insertions(+), 3 deletions(-)  create mode 100644
> drivers/clk/at91/Kconfig  create mode 100644 drivers/clk/at91/Makefile  create
> mode 100644 drivers/clk/at91/clk-generated.c  create mode 100644
> drivers/clk/at91/clk-h32mx.c  create mode 100644 drivers/clk/at91/clk-main.c
> create mode 100644 drivers/clk/at91/clk-master.c  create mode 100644
> drivers/clk/at91/clk-peripheral.c  create mode 100644 
> drivers/clk/at91/clk-plla.c
> create mode 100644 drivers/clk/at91/clk-slow.c  create mode 100644
> drivers/clk/at91/clk-system.c  create mode 100644 drivers/clk/at91/clk-utmi.c
> create mode 100644 drivers/clk/at91/pmc.c  create mode 100644
> drivers/clk/at91/pmc.h  create mode 100644 drivers/clk/at91/sckc.c
> 
> diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-
> at91/include/mach/at91_pmc.h
> index 680ceb0..2875ff2 100644
> --- a/arch/arm/mach-at91/include/mach/at91_pmc.h
> +++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
> @@ -149,6 +149,9 @@ typedef struct at91_pmc {
> 
>  #define AT91_PMC_PCR_PID_MASK(0x3f)
>  #define AT91_PMC_PCR_GCKCSS  (0x7 << 8)
> +#define AT91_PMC_PCR_GCKCSS_MASK 0x07
> +#define AT91_PMC_PCR_GCKCSS_OFFSET   8
> +#define AT91_PMC_PCR_GCKCSS_(x)  ((x & 0x07) << 8)
>  #define  AT91_PMC_PCR_GCKCSS_SLOW_CLK(0x0 << 8)
>  #define  AT91_PMC_PCR_GCKCSS_MAIN_CLK(0x1 << 8)
>  #define  AT91_PMC_PCR_GCKCSS_PLLA_CLK(0x2 << 8)
> @@ -158,8 +161,9 @@ typedef struct at91_pmc {
>  #define AT91_PMC_PCR_CMD_WRITE   (0x1 << 12)
>  #define AT91_PMC_PCR_DIV (0x3 << 16)
>  #define AT91_PMC_PCR_GCKDIV  (0xff << 20)
> -#define  AT91_PMC_PCR_GCKDIV_(x) (((x) & 0xff) << 20)
> -#define  AT91_PMC_PCR_GCKDIV_OFFSET  20
> +#define AT91_PMC_PCR_GCKDIV_MASK 0xff
> +#define AT91_PMC_PCR_GCKDIV_OFFSET   20
> +#define AT91_PMC_PCR_GCKDIV_(x)  ((x & 0xff) << 20)
>  #define AT91_PMC_PCR_EN  (0x1 << 28)
>  #define AT91_PMC_PCR_GCKEN   (0x1 << 

Re: [U-Boot] [U-Boot, v3, 5/5] ARM: dts: dra72-evm: Add mode-gpios entry for mac node

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 10:14:28AM +0530, Vignesh R wrote:

> On DRA72 EVM, cpsw slave1 is muxed with VIN2A, hence switch to cpsw
> slave0 for ethernet. This is controlled by pcf gpio line. Add
> appropriate mode-gpios DT entry so that driver can select the required
> slave.
> 
> Signed-off-by: Vignesh R 
> Reviewed-by: Tom Rini 
> Reviewed-by: Mugunthan V N 

Applied to u-boot/master, 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, v3, 3/5] ARM: dts: dra7xx: Add u-boot specific property for PCF8575 nodes

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 10:14:26AM +0530, Vignesh R wrote:

> PCF8575 does not have any registers hence, offset field needs to be
> ignored for i2c read/write. Therefore populate u-boot,i2c-offset-len
> with 0 in PCF8575 DT nodes.
> 
> Signed-off-by: Vignesh R 
> Reviewed-by: Mugunthan V N 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, 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] efi_loader: disk: Fix CONFIG_BLK breakage

2016-08-09 Thread Tom Rini
On Fri, Aug 05, 2016 at 02:49:53PM +0200, Alexander Graf wrote:

> When using CONFIG_BLK, there were 2 issues:
> 
>   1) The name we generate the device with has to match the
>  name we set in efi_set_bootdev()
> 
>   2) The device we pass into our block functions was wrong,
>  we should not rediscover it but just use the already known
>  pointer.
> 
> This patch fixes both issues.
> 
> Signed-off-by: Alexander Graf 

Applied to u-boot/master, 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, 1/5] drivers: net: keystone_net: fix line termination with semi-colon

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 12:01:11PM +0530, Mugunthan V N wrote:

> Each line should be terminated by semi-colon. It was not caught
> earlier as there is a proper statement. Fix it by changing the
> comma with semi-colon.
> 
> Signed-off-by: Mugunthan V N 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, 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, 2/5] drivers: net: keystone_net: add support for multi slave ethernet

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 12:01:12PM +0530, Mugunthan V N wrote:

> Keystone net can have multiple ethernet slaves, currently only
> slave 1 is supported by the driver. Register multiple slaves as
> individual ethernets to network framework.
> 
> Signed-off-by: Mugunthan V N 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, 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] efi_loader: disk: Sanitize exposed devices

2016-08-09 Thread Tom Rini
On Fri, Aug 05, 2016 at 02:51:47PM +0200, Alexander Graf wrote:

> When a target device is 0 bytes long, there's no point in exposing it to
> the user. Let's just skip them.
> 
> Also, when an offset is passed into the efi disk creation, we should
> remove this offset from the total number of sectors we can handle.
> 
> This patch fixes both things.
> 
> Signed-off-by: Alexander Graf 

Applied to u-boot/master, 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, v3, 4/5] net: cpsw: Add support to drive gpios for ethernet to be functional

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 10:14:27AM +0530, Vignesh R wrote:

> On DRA72 EVM, cpsw slaves may be muxed with other modules. This
> selection is controlled by a pcf gpio line. Add support for cpsw driver
> to acquire mode-gpios and select the appropriate slave using gpio APIs.
> 
> Signed-off-by: Vignesh R 
> Reviewed-by: Tom Rini 
> Acked-by: Joe Hershberger 
> Reviewed-by: Mugunthan V N 

Applied to u-boot/master, 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] tiny-printf: Adjust to avoid using data section

2016-08-09 Thread Tom Rini
On Thu, Aug 04, 2016 at 09:58:14PM -0600, Simon Glass wrote:

> We can pass all the variables down to the functions that need them, and
> then everything is on the stack. This is safer than using the data section.
> 
> At least on firefly-rk3288, the code size is the same and the data size is
> 12 bytes smaller:
> 
> before:
>   18865  2636  40   215415425 b/firefly-rk3288/spl/u-boot-spl
> after:
>   18865  2624  40   215295419 b/firefly-rk3288/spl/u-boot-spl
> 
> Signed-off-by: Simon Glass 
> Reviewed-by: Tom Rini 
> Reviewed-by: Stefan Roese 

Applied to u-boot/master, 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, 5/5] configs: k2l_evm: add random eth address support

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 12:01:15PM +0530, Mugunthan V N wrote:

> There is only one ethernet mac address in e-fuse, but there are
> multiple slaves in keystone net, so enable random mac address
> support.
> 
> Signed-off-by: Mugunthan V N 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, 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, 4/5] configs: k2e_evm: add random eth address support

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 12:01:14PM +0530, Mugunthan V N wrote:

> There is only one ethernet mac address in e-fuse, but there are
> multiple slaves in keystone net, so enable random mac address
> support.
> 
> Signed-off-by: Mugunthan V N 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, 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, 3/5] configs: k2hk_evm: add random eth address support

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 12:01:13PM +0530, Mugunthan V N wrote:

> There is only one ethernet mac address in e-fuse, but there are
> multiple slaves in keystone net, so enable random mac address
> support.
> 
> Signed-off-by: Mugunthan V N 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, 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, v3, 2/5] ARM: dra7xx_evm: Enable support for TI PCF8575

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 10:14:25AM +0530, Vignesh R wrote:

> On DRA7, pcf chip present at address 0x21 on i2c1, is used to
> switch between cpsw slave0 and slave1. Hence, enable PCF
> driver for the same.
> 
> Signed-off-by: Vignesh R 
> Reviewed-by: Mugunthan V N 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, 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, v3, 1/5] gpio: Add driver for TI PCF8575 I2C GPIO expander

2016-08-09 Thread Tom Rini
On Tue, Aug 02, 2016 at 10:14:24AM +0530, Vignesh R wrote:

> TI's PCF8575 is a 16-bit I2C GPIO expander.The device features a
> 16-bit quasi-bidirectional I/O ports. Each quasi-bidirectional I/O can
> be used as an input or output without the use of a data-direction
> control signal. The I/Os should be high before being used as inputs.
> Read the device documentation for more details[1].
> 
> This driver is based on pcf857x driver available in Linux v4.7 kernel.
> It supports basic reading and writing of gpio pins.
> 
> [1] http://www.ti.com/lit/ds/symlink/pcf8575.pdf
> 
> Signed-off-by: Vignesh R 
> Reviewed-by: Tom Rini 
> Reviewed-by: Simon Glass 
> Reviewed-by: Mugunthan V N 

Applied to u-boot/master, 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, v2] spl_nor.c: Support devicetree sizes different from 16k

2016-08-09 Thread Tom Rini
On Tue, Jul 26, 2016 at 07:34:07AM +0200, Mike Looijmans wrote:

> The devicetrees for various platforms already exceed 16k. Add a define
> CONFIG_SYS_FDT_SIZE to specify the FDT size, and set to 16k for the
> two boards that define this CONFIG_SYS_FDT_BASE parameter. This
> allows platforms with larger devicetree blobs to boot from NOR.
> 
> Signed-off-by: Mike Looijmans 

Applied to u-boot/master, 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] Please pull u-boot-ppc4xx/master

2016-08-09 Thread Tom Rini
On Tue, Aug 09, 2016 at 09:31:50AM +0200, Stefan Roese wrote:

> Hi Tom,
> 
> please pull the following ppc4xx fix from Dirk:
> 
> The following changes since commit 5405817a6e7a6538c4bcb1c3076ddc83fe5d03f9:
> 
>   spi: cadence_qspi_apb: Ensure baudrate doesn't exceed max value (2016-08-07 
> 21:54:21 +0200)
> 
> are available in the git repository at:
> 
>   git://www.denx.de/git/u-boot-ppc4xx.git 
> 
> for you to fetch changes up to 54a0eb7a18b5120d609188e46a1b71e98d6af44b:
> 
>   ppc4xx: Fix platform support (2016-08-09 09:25:36 +0200)
> 

Applied to u-boot/master, 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, RFC] i2c: i2c-uclass-compat: avoid any BSS usage

2016-08-09 Thread Tom Rini
On Mon, Jul 25, 2016 at 04:26:45PM +0530, Vignesh R wrote:

> As I2C can be used before DRAM initialization for reading EEPROM,
> avoid using static variables stored in BSS, since BSS is in DRAM, which
> may not have been initialised yet. Explicitly mark "static global"
> variables as belonging to the .data section.
> 
> Signed-off-by: Vignesh R 
> Acked-by: Heiko Schocher
> Reviewed-by: Simon Glass 

Applied to u-boot/master, 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/4] sandbox: Add "host size" hostfs command for fs test

2016-08-09 Thread Stefan Brüns
Signed-off-by: Stefan Brüns 
---
 cmd/host.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/cmd/host.c b/cmd/host.c
index 8d84415..b427e54 100644
--- a/cmd/host.c
+++ b/cmd/host.c
@@ -25,6 +25,12 @@ static int do_host_ls(cmd_tbl_t *cmdtp, int flag, int argc,
return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
+static int do_host_size(cmd_tbl_t *cmdtp, int flag, int argc,
+  char * const argv[])
+{
+   return do_size(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
+}
+
 static int do_host_save(cmd_tbl_t *cmdtp, int flag, int argc,
   char * const argv[])
 {
@@ -138,6 +144,7 @@ static cmd_tbl_t cmd_host_sub[] = {
U_BOOT_CMD_MKENT(load, 7, 0, do_host_load, "", ""),
U_BOOT_CMD_MKENT(ls, 3, 0, do_host_ls, "", ""),
U_BOOT_CMD_MKENT(save, 6, 0, do_host_save, "", ""),
+   U_BOOT_CMD_MKENT(size, 3, 0, do_host_size, "", ""),
U_BOOT_CMD_MKENT(bind, 3, 0, do_host_bind, "", ""),
U_BOOT_CMD_MKENT(info, 3, 0, do_host_info, "", ""),
U_BOOT_CMD_MKENT(dev, 0, 1, do_host_dev, "", ""),
@@ -174,6 +181,7 @@ U_BOOT_CMD(
"host ls hostfs - - list files on host\n"
"host save hostfs -[] - "
"save a file to host\n"
+   "host size hostfs -  - determine size of file on host"
"host bind  [] - bind \"host\" device to file\n"
"host info []- show device binding & info\n"
"host dev [] - Set or retrieve the current host device\n"
-- 
2.9.2

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


[U-Boot] [PATCH 1/4] Sandbox: document support of block device emulation

2016-08-09 Thread Stefan Brüns
Signed-off-by: Stefan Brüns 
---
 board/sandbox/README.sandbox | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/board/sandbox/README.sandbox b/board/sandbox/README.sandbox
index ed820d3..02d8ab3 100644
--- a/board/sandbox/README.sandbox
+++ b/board/sandbox/README.sandbox
@@ -320,6 +320,25 @@ CONFIG_SPI_IDLE_VAL
The idle value on the SPI bus
 
 
+Block Device Emulation
+--
+
+U-Boot can use raw disk images for block device emulation. To e.g. list
+the contents of the root directory on the second partion of the image
+"disk.raw", you can use the following commands:
+
+=>host bind 0 ./disk.raw
+=>ls host 0:2
+
+A disk image can be created using the following commands:
+
+$> truncate -s 1200M ./disk.raw
+$> echo -e "label: gpt\n,64M,U\n,,L" | /usr/sbin/sfdisk  ./disk.raw
+$> lodev=`sudo losetup -P -f --show ./disk.raw`
+$> sudo mkfs.vfat -n EFI -v ${lodev}p1
+$> sudo mkfs.ext4 -L ROOT -v ${lodev}p2
+
+
 Writing Sandbox Drivers
 ---
 
-- 
2.9.2

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


[U-Boot] [PATCH 3/4] test/fs: strip carriage-return from sandbox output

2016-08-09 Thread Stefan Brüns
DM added carriage-returns to every newline. Strip everything after the
32 character long mdsum.

Signed-off-by: Stefan Brüns 
---
 test/fs/fs-test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh
index 043e5d0..171b1de 100755
--- a/test/fs/fs-test.sh
+++ b/test/fs/fs-test.sh
@@ -402,7 +402,7 @@ check_md5() {
# the 7th field is the actual md5
md5_src=`grep -A3 "$1" "$2" | grep "md5 for"`
md5_src=($md5_src)
-   md5_src=${md5_src[6]}
+   md5_src=${md5_src[6]:0:32}
 
# The md5 list, each line is of the form:
# - 
-- 
2.9.2

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


[U-Boot] [PATCH 4/4] test/fs: replace deprecated "sb" command with "host"

2016-08-09 Thread Stefan Brüns
Signed-off-by: Stefan Brüns 
---
 test/fs/fs-test.sh | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh
index 171b1de..82e91b0 100755
--- a/test/fs/fs-test.sh
+++ b/test/fs/fs-test.sh
@@ -6,14 +6,14 @@
 #
 
 # Invoke this test script from U-Boot base directory as ./test/fs/fs-test.sh
-# It currently tests the fs/sb and native commands for ext4 and fat partitions
+# It currently tests the host and native commands for ext4 and fat partitions
 # Expected results are as follows:
 # EXT4 tests:
-# fs-test.sb.ext4.out: Summary: PASS: 17 FAIL: 2
+# fs-test.host.ext4.out: Summary: PASS: 19 FAIL: 0
 # fs-test.ext4.out: Summary: PASS: 10 FAIL: 9
 # fs-test.fs.ext4.out: Summary: PASS: 10 FAIL: 9
 # FAT tests:
-# fs-test.sb.fat.out: Summary: PASS: 17 FAIL: 2
+# fs-test.host.fat.out: Summary: PASS: 19 FAIL: 0
 # fs-test.fat.out: Summary: PASS: 19 FAIL: 0
 # fs-test.fs.fat.out: Summary: PASS: 19 FAIL: 0
 # Total Summary: TOTAL PASS: 92 TOTAL FAIL: 22
@@ -155,10 +155,10 @@ function fname_for_write() {
 # 2nd parameter is file system type - fat/ext4
 # 3rd parameter is name of small file
 # 4th parameter is name of big file
-# 5th parameter is fs/nonfs/sb - to dictate generic fs commands or
-# otherwise or sb hostfs
+# 5th parameter is fs/nonfs/host - to dictate generic fs commands or
+# otherwise or host
 # 6th parameter is the directory path for the files. Its "" for generic
-# fs and ext4/fat and full patch for sb hostfs
+# fs and ext4/fat and full path for host
 # UBOOT is set in env
 function test_image() {
addr="0x0108"
@@ -192,8 +192,8 @@ function test_image() {
SUFFIX=" 0:0"
;;
 
-   sb)
-   PREFIX="sb "
+   host)
+   PREFIX="host "
WRITE="save"
SUFFIX="fs -"
;;
@@ -217,17 +217,17 @@ function test_image() {
 
# In u-boot commands,  stands for host or hostfs
# hostfs maps to the host fs.
-   # host maps to the "sb bind" that we do
+   # host maps to the "host bind" that we do
 
$UBOOT << EOF
-sb=$5
-setenv bind 'if test "\$sb" != sb; then sb bind 0 "$1"; fi'
+host=$5
+setenv bind 'if test "\$host" != host; then host bind 0 "$1"; fi'
 run bind
 # Test Case 1 - ls
 ${PREFIX}ls host${SUFFIX} $6
 #
-# We want ${PREFIX}size host 0:0 $3 for host commands and
-# sb size hostfs - $3 for hostfs commands.
+# We want ${PREFIX}size host 0:0 $3 for fs/nonfs commands and
+# host size hostfs - $3 for host commands.
 # 1MB is 0x0010 
 # Test Case 2 - size of small file
 ${PREFIX}size host${SUFFIX} $FILE_SMALL
@@ -521,9 +521,9 @@ prepare_env
 TOTAL_FAIL=0
 TOTAL_PASS=0
 
-# In each loop, for a given file system image, we test both the
-# fs command, like load/size/write, the file system specific command
-# like: ext4load/ext4size/ext4write and the sb load/ls/save commands.
+# In each loop, for a given file system image, we test both the fs command,
+# like ls/size/load/save, the file system specific command, like
+# ext4ls/ext4size/ext4load/ext4write and the host ls/size/load/save commands.
 for fs in ext4 fat; do
 
echo "Creating $fs image if not already present."
@@ -531,11 +531,11 @@ for fs in ext4 fat; do
MD5_FILE_FS="${MD5_FILE}.${fs}"
create_image $IMAGE $fs
 
-   # sb commands test
+   # host commands test
echo "Creating files in $fs image if not already present."
create_files $IMAGE $MD5_FILE_FS
 
-   # Lets mount the image and test sb hostfs commands
+   # Lets mount the image and test host commands
mkdir -p "$MOUNT_DIR"
if [ "$fs" = "fat" ]; then
uid="uid=`id -u`"
@@ -545,8 +545,8 @@ for fs in ext4 fat; do
sudo mount -o loop,rw,$uid "$IMAGE" "$MOUNT_DIR"
sudo chmod 777 "$MOUNT_DIR"
 
-   OUT_FILE="${OUT}.sb.${fs}.out"
-   test_image $IMAGE $fs $SMALL_FILE $BIG_FILE sb `pwd`/$MOUNT_DIR \
+   OUT_FILE="${OUT}.host.${fs}.out"
+   test_image $IMAGE $fs $SMALL_FILE $BIG_FILE host `pwd`/$MOUNT_DIR \
> ${OUT_FILE} 2>&1
sudo umount "$MOUNT_DIR"
rmdir "$MOUNT_DIR"
-- 
2.9.2

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


[U-Boot] [PATCH 0/4] Some additions for sandbox and fs tests

2016-08-09 Thread Stefan Brüns
Add some documentation for the sandbox block device emulation and
fix some issues for the fs test script.

Stefan Brüns (4):
  Sandbox: document support of block device emulation
  sandbox: Add "host size" hostfs command for fs test
  test/fs: strip carriage-return from sandbox output
  test/fs: replace deprecated "sb" command with "host"

 board/sandbox/README.sandbox | 19 +++
 cmd/host.c   |  8 
 test/fs/fs-test.sh   | 42 +-
 3 files changed, 48 insertions(+), 21 deletions(-)

-- 
2.9.2

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


Re: [U-Boot] [RFC PATCH] ARM: cache: cp15: Align addresses when initial page_table setup is flushed

2016-08-09 Thread Fabio Estevam
On Tue, Aug 9, 2016 at 5:41 AM, Lukasz Majewski  wrote:
> Change made in the commit:
> "arm: Show cache warnings in U-Boot proper only"
> SHA1: bcc53bf095893fbdae531a9a7b5d4ef4a125a7fc
>
> has revealed that during initial setting of MMU regions in the
> mmu_set_region_dcache_behavior() function some addresses are unaligned
> to platform cache line size.
>
> As a result we were experiencing following warning messages at early boot:
> CACHE: Misaligned operation at range [8fff, 8fff0004]
> CACHE: Misaligned operation at range [8fff0024, 8fff0028]
>
> Those were caused by an attempt to update single page_table
> (gd->arch.tlb_addr) entries with proper TLB cache settings.
> Since TLB section covers large area (up to 2MiB), we had to update
> very small amount of cache data, very often much smaller than single cache
> line size (e.g. 32 or 64 bytes).
>
> This patch squashes this warning by properly aligning start and end addresses.
> In fact it does what cache HW would do anyway (flush the whole data cache
> lines).
> Even without this patch it all worked, because TLB table sections were
> initialized to default values earlier.
>
> Signed-off-by: Lukasz Majewski 

Stefan has also sent a patch for this:
https://patchwork.ozlabs.org/patch/656470/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] ARM: cache: cp15: Align addresses when initial page_table setup is flushed

2016-08-09 Thread Lukasz Majewski
Dear all,

> Change made in the commit:
> "arm: Show cache warnings in U-Boot proper only"
> SHA1: bcc53bf095893fbdae531a9a7b5d4ef4a125a7fc
> 
> has revealed that during initial setting of MMU regions in the
> mmu_set_region_dcache_behavior() function some addresses are unaligned
> to platform cache line size.
> 
> As a result we were experiencing following warning messages at early
> boot: CACHE: Misaligned operation at range [8fff, 8fff0004]
> CACHE: Misaligned operation at range [8fff0024, 8fff0028]
> 
> Those were caused by an attempt to update single page_table
> (gd->arch.tlb_addr) entries with proper TLB cache settings.
> Since TLB section covers large area (up to 2MiB), we had to update
> very small amount of cache data, very often much smaller than single
> cache line size (e.g. 32 or 64 bytes).
> 
> This patch squashes this warning by properly aligning start and end
> addresses. In fact it does what cache HW would do anyway (flush the
> whole data cache lines).
> Even without this patch it all worked, because TLB table sections were
> initialized to default values earlier.
> 
> Signed-off-by: Lukasz Majewski 
> ---
>  arch/arm/lib/cache-cp15.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
> index 1121dc3..913c554 100644
> --- a/arch/arm/lib/cache-cp15.c
> +++ b/arch/arm/lib/cache-cp15.c
> @@ -62,6 +62,7 @@ void mmu_set_region_dcache_behaviour(phys_addr_t
> start, size_t size, enum dcache_option option)
>  {
>   u32 *page_table = (u32 *)gd->arch.tlb_addr;
> + u32 align_start_addr, align_end_addr;
>   unsigned long upto, end;
>  
>   end = ALIGN(start + size, MMU_SECTION_SIZE) >>
> MMU_SECTION_SHIFT; @@ -70,7 +71,14 @@ void
> mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
> option); for (upto = start; upto < end; upto++)
>   set_section_dcache(upto, option);
> - mmu_page_table_flush((u32)_table[start],
> (u32)_table[end]); +
> + align_start_addr = (u32)_table[start]
> + & ~(CONFIG_SYS_CACHELINE_SIZE - 1);
> + align_end_addr = ALIGN((u32)_table[end],
> +CONFIG_SYS_CACHELINE_SIZE);

This patch is an RFC on purpose :-).

It requires the CONFIG_SYS_CACHELINE_SIZE to be defined for the target
platform.
However, it happens that some older boards (like Samsung's smdk2410,
Siemens amx) don't have this define, which means that I would need to
define it for each board.

The other option is to get the cache line size from coprocessor (like
get_ccsidr() @ arch/arm/cpu/armv7/cache_v7.c). Such approach would
require some common code extraction.

Best regards,
Łukasz Majewski 


> + debug("%s: align_start_addr: 0x%x align end_addr: 0x%x\n",
> __func__,
> +   align_start_addr, align_end_addr);
> + mmu_page_table_flush(align_start_addr, align_end_addr);
>  }
>  
>  __weak void dram_bank_mmu_setup(int bank)



pgpAmjeXlUtzZ.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] arm: efi: Add a hello world test program

2016-08-09 Thread Alexander Graf


> Am 09.08.2016 um 20:16 schrieb Simon Glass :
> 
> Hi Bin,
> 
>> On 9 August 2016 at 00:50, Bin Meng  wrote:
>> Hi Simon,
>> 
>>> On Sun, Aug 7, 2016 at 7:23 AM, Simon Glass  wrote:
>>> It is useful to have a basic sanity check for EFI loader support. Add a
>>> 'bootefi hello' command which loads HelloWord.efi and runs it under U-Boot.
>>> 
>>> Signed-off-by: Simon Glass 
>>> ---
>>> 
>>> arch/arm/lib/HelloWorld32.efi  | Bin 0 -> 11712 bytes
>>> arch/arm/lib/Makefile  |   6 ++
>>> cmd/Kconfig|  10 ++
>>> cmd/bootefi.c  |  26 --
>>> include/asm-generic/sections.h |   2 ++
>>> scripts/Makefile.lib   |  19 +++
>>> 6 files changed, 57 insertions(+), 6 deletions(-)
>>> create mode 100644 arch/arm/lib/HelloWorld32.efi
>> 
>> [snip]
>> 
>>> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
>>> index a8d1557..0f3ea0c 100644
>>> --- a/arch/arm/lib/Makefile
>>> +++ b/arch/arm/lib/Makefile
>>> @@ -29,6 +29,12 @@ obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
>>> obj-$(CONFIG_CMD_BOOTM) += bootm.o
>>> obj-$(CONFIG_CMD_BOOTM) += zimage.o
>>> obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
>>> +ifdef CONFIG_ARM64
>>> +# This option does not work for arm64, as there is no binary.
>> 
>> If so, can we just remove this for arm64?
> 
> Actually I was hoping that Alexander might have a suitable arm64
> HelloWorld.efi lying around. When I tried building UEFI for arm64, for
> some reason it did not create it.

Is it part of edk2? If so, Leif (CC'ed) might have one :). I usually use grub 
as my hello world application.


Alex


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


[U-Boot] [PATCH v2 22/22] sf: Rename sf_params.c to spi_flash_ids

2016-08-09 Thread Jagan Teki
spi_flash_ids.c is more meaningful name as the flash_info
table structure spi_flash_info has spi_flash_ids instance.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/Makefile|   2 +-
 drivers/mtd/spi/spi_flash_ids.c | 176 
 2 files changed, 177 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mtd/spi/spi_flash_ids.c

diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index 6f47a66..6379b4b 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_SPL_SPI_BOOT)+= fsl_espi_spl.o
 obj-$(CONFIG_SPL_SPI_SUNXI)+= sunxi_spi_spl.o
 endif
 
-obj-$(CONFIG_SPI_FLASH) += sf_probe.o spi_flash.o sf_params.o sf.o
+obj-$(CONFIG_SPI_FLASH) += sf_probe.o spi_flash.o spi_flash_ids.o sf.o
 obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o
 obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
 obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
diff --git a/drivers/mtd/spi/spi_flash_ids.c b/drivers/mtd/spi/spi_flash_ids.c
new file mode 100644
index 000..61cac59
--- /dev/null
+++ b/drivers/mtd/spi/spi_flash_ids.c
@@ -0,0 +1,176 @@
+/*
+ * SPI Flash ID's.
+ *
+ * Copyright (C) 2016 Jagan Teki 
+ * Copyright (C) 2013 Jagannadha Sutradharudu Teki, Xilinx Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include "sf_internal.h"
+
+/* Used when the "_ext_id" is two bytes at most */
+#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
+   .id = { \
+   ((_jedec_id) >> 16) & 0xff, \
+   ((_jedec_id) >> 8) & 0xff,  \
+   (_jedec_id) & 0xff, \
+   ((_ext_id) >> 8) & 0xff,\
+   (_ext_id) & 0xff,   \
+   },  \
+   .id_len = (!(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0))),   
\
+   .sector_size = (_sector_size),  \
+   .n_sectors = (_n_sectors),  \
+   .page_size = 256,   \
+   .flags = (_flags),
+
+#define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)\
+   .id = { \
+   ((_jedec_id) >> 16) & 0xff, \
+   ((_jedec_id) >> 8) & 0xff,  \
+   (_jedec_id) & 0xff, \
+   ((_ext_id) >> 16) & 0xff,   \
+   ((_ext_id) >> 8) & 0xff,\
+   (_ext_id) & 0xff,   \
+   },  \
+   .id_len = 6,\
+   .sector_size = (_sector_size),  \
+   .n_sectors = (_n_sectors),  \
+   .page_size = 256,   \
+   .flags = (_flags),
+
+const struct spi_flash_info spi_flash_ids[] = {
+#ifdef CONFIG_SPI_FLASH_ATMEL  /* ATMEL */
+   {"AT45DB011D", INFO(0x1f2200, 0x0, 64 * 1024, 4, SECT_4K) },
+   {"AT45DB021D", INFO(0x1f2300, 0x0, 64 * 1024, 8, SECT_4K) },
+   {"AT45DB041D", INFO(0x1f2400, 0x0, 64 * 1024, 8, SECT_4K) },
+   {"AT45DB081D", INFO(0x1f2500, 0x0, 64 * 1024,16, SECT_4K) },
+   {"AT45DB161D", INFO(0x1f2600, 0x0, 64 * 1024,32, SECT_4K) },
+   {"AT45DB321D", INFO(0x1f2700, 0x0, 64 * 1024,64, SECT_4K) },
+   {"AT45DB641D", INFO(0x1f2800, 0x0, 64 * 1024,   128, SECT_4K) },
+   {"AT25DF321A", INFO(0x1f4701, 0x0, 64 * 1024,64, SECT_4K) },
+   {"AT25DF321",  INFO(0x1f4700, 0x0, 64 * 1024,64, SECT_4K) },
+   {"AT26DF081A", INFO(0x1f4501, 0x0, 64 * 1024,16, SECT_4K) },
+#endif
+#ifdef CONFIG_SPI_FLASH_EON/* EON */
+   {"EN25Q32B",   INFO(0x1c3016, 0x0, 64 * 1024,64, 0) },
+   {"EN25Q64",INFO(0x1c3017, 0x0, 64 * 1024,   128, SECT_4K) },
+   {"EN25Q128B",  INFO(0x1c3018, 0x0, 64 * 1024,   256, 0) },
+   {"EN25S64",INFO(0x1c3817, 0x0, 64 * 1024,   128, 0) },
+#endif
+#ifdef CONFIG_SPI_FLASH_GIGADEVICE /* GIGADEVICE */
+   {"GD25Q64B",   INFO(0xc84017, 0x0, 64 * 1024,   128, SECT_4K) },
+

[U-Boot] [PATCH v2 21/22] sf: Remove non-meaningful comments

2016-08-09 Thread Jagan Teki
Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/spi_flash.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 55c357e..b04fe3f 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1015,16 +1015,13 @@ int spi_flash_scan(struct spi_flash *flash)
JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST)
write_sr(flash, 0);
 
-   /* Assign spi data */
flash->name = info->name;
flash->memory_map = spi->memory_map;
flash->dual_flash = spi->option;
 
-   /* Assign spi flash flags */
if (info->flags & SST_WR)
flash->flags |= SNOR_F_SST_WR;
 
-   /* Assign spi_flash ops */
 #ifndef CONFIG_DM_SPI_FLASH
flash->write = spi_flash_cmd_write_ops;
 #if defined(CONFIG_SPI_FLASH_SST)
-- 
2.7.4

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


[U-Boot] [PATCH v2 19/22] sf: params: Add S25FS256S_64K spi flash support

2016-08-09 Thread Jagan Teki
Add Spansion S25FS256S_64K spi flash to the list of spi_flash_ids.

In spansion S25FS-S family the physical sectors are grouped as
normal and parameter sectors. Parameter sectors are 4kB in size
with 8 set located at the bottom or top address of a device.
Normal sectors are similar to other flash family with sizes of
64kB or 32 kB.

To erase whole flash using sector erase(D8h or DCh) won't effect
the parameter sectors, so in order to erase these we must use 4K
sector erase commands (20h or 21h) separately.

So better to erase the whole flash using 4K sector erase instead
of detecting these family parts again and do two different erase
operations.

Cc: Yunhui Cui 
Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Michael Trimarchi 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_params.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index 344d9c9..b029c76 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -93,6 +93,7 @@ const struct spi_flash_info spi_flash_ids[] = {
{"S25FL128S_64K",  INFO(0x012018, 0x4d01,  64 * 1024,   256, RD_FULL | 
WR_QPP) },
{"S25FL256S_256K", INFO(0x010219, 0x4d00, 256 * 1024,   128, RD_FULL | 
WR_QPP) },
{"S25FL256S_64K",  INFO(0x010219, 0x4d01,  64 * 1024,   512, RD_FULL | 
WR_QPP) },
+   {"S25FS256S_64K",  INFO6(0x010219, 0x4d0181, 64 * 1024, 512, RD_FULL | 
WR_QPP | SECT_4K) },
{"S25FS512S",  INFO(0x010220, 0x4D00, 128 * 1024,   512, RD_FULL | 
WR_QPP) },
{"S25FL512S_256K", INFO(0x010220, 0x4d00, 256 * 1024,   256, RD_FULL | 
WR_QPP) },
{"S25FL512S_64K",  INFO(0x010220, 0x4d01,  64 * 1024,  1024, RD_FULL | 
WR_QPP) },
-- 
2.7.4

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


[U-Boot] [PATCH v2 16/22] sf: Add SPI_FLASH_MAX_ID_LEN

2016-08-09 Thread Jagan Teki
Add id length of 5 bytes numerical value to macro.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h | 3 ++-
 drivers/mtd/spi/spi_flash.c   | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 74f33a3..775a04a 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -108,6 +108,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
 #define JEDEC_MFR(info)((info)->id[0])
 #define JEDEC_ID(info) (((info)->id[1]) << 8 | ((info)->id[2]))
 #define JEDEC_EXT(info)(((info)->id[3]) << 8 | ((info)->id[4]))
+#define SPI_FLASH_MAX_ID_LEN   5
 
 struct spi_flash_info {
const char  *name;
@@ -117,7 +118,7 @@ struct spi_flash_info {
 * The first three bytes are the JEDIC ID.
 * JEDEC ID zero means "no ID" (mostly older chips).
 */
-   u8  id[5];
+   u8  id[SPI_FLASH_MAX_ID_LEN];
u8  id_len;
 
/* The size listed here is what works with SPINOR_OP_SE, which isn't
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index cf49045..d961ace 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -928,10 +928,10 @@ static int micron_quad_enable(struct spi_flash *flash)
 static const struct spi_flash_info *spi_flash_read_id(struct spi_flash *flash)
 {
int tmp;
-   u8  id[5];
+   u8  id[SPI_FLASH_MAX_ID_LEN];
const struct spi_flash_info *info;
 
-   tmp = spi_flash_cmd(flash->spi, CMD_READ_ID, id, 5);
+   tmp = spi_flash_cmd(flash->spi, CMD_READ_ID, id, SPI_FLASH_MAX_ID_LEN);
if (tmp < 0) {
printf("SF: error %d reading JEDEC ID\n", tmp);
return ERR_PTR(tmp);
-- 
2.7.4

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


[U-Boot] [PATCH v2 20/22] sf: Remove legacy idcode detection code

2016-08-09 Thread Jagan Teki
Since flash detection code is more mature to
detect even with 6 bytes id length devices
removed old code and related references.

Cc: Yunhui Cui 
Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Michael Trimarchi 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h |  6 
 drivers/mtd/spi/spi_flash.c   | 78 ---
 2 files changed, 84 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 6be2121..1161652 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -99,12 +99,6 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, size_t 
len,
const void *buf);
 #endif
 
-#ifdef CONFIG_SPI_FLASH_SPANSION
-/* Used for Spansion S25FS-S family flash only. */
-#define CMD_SPANSION_RDAR  0x65 /* Read any device register */
-#define CMD_SPANSION_WRAR  0x71 /* Write any device register */
-#endif
-
 #define JEDEC_MFR(info)((info)->id[0])
 #define JEDEC_ID(info) (((info)->id[1]) << 8 | ((info)->id[2]))
 #define JEDEC_EXT(info)(((info)->id[3]) << 8 | ((info)->id[4]))
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index d961ace..55c357e 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -999,94 +999,16 @@ int spi_flash_decode_fdt(const void *blob, struct 
spi_flash *flash)
 }
 #endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
 
-#ifdef CONFIG_SPI_FLASH_SPANSION
-static int spansion_s25fss_disable_4KB_erase(struct spi_slave *spi)
-{
-   u8 cmd[4];
-   u32 offset = 0x84; /* CR3V register offset */
-   u8 cr3v;
-   int ret;
-
-   cmd[0] = CMD_SPANSION_RDAR;
-   cmd[1] = offset >> 16;
-   cmd[2] = offset >> 8;
-   cmd[3] = offset >> 0;
-
-   ret = spi_flash_cmd_read(spi, cmd, 4, , 1);
-   if (ret)
-   return -EIO;
-   /* CR3V bit3: 4-KB Erase */
-   if (cr3v & 0x8)
-   return 0;
-
-   cmd[0] = CMD_SPANSION_WRAR;
-   cr3v |= 0x8;
-   ret = spi_flash_cmd_write(spi, cmd, 4, , 1);
-   if (ret)
-   return -EIO;
-
-   cmd[0] = CMD_SPANSION_RDAR;
-   ret = spi_flash_cmd_read(spi, cmd, 4, , 1);
-   if (ret)
-   return -EIO;
-   if (!(cr3v & 0x8))
-   return -EFAULT;
-
-   return 0;
-}
-#endif
-
 int spi_flash_scan(struct spi_flash *flash)
 {
struct spi_slave *spi = flash->spi;
const struct spi_flash_info *info = NULL;
-   u16 jedec, ext_jedec;
-   u8 idcode[5];
int ret;
 
info = spi_flash_read_id(flash);
if (IS_ERR_OR_NULL(info))
return -ENOENT;
 
-   jedec = idcode[1] << 8 | idcode[2];
-   ext_jedec = idcode[3] << 8 | idcode[4];
-
-#ifdef CONFIG_SPI_FLASH_SPANSION
-   /*
-* The S25FS-S family physical sectors may be configured as a
-* hybrid combination of eight 4-kB parameter sectors
-* at the top or bottom of the address space with all
-* but one of the remaining sectors being uniform size.
-* The Parameter Sector Erase commands (20h or 21h) must
-* be used to erase the 4-kB parameter sectors individually.
-* The Sector (uniform sector) Erase commands (D8h or DCh)
-* must be used to erase any of the remaining
-* sectors, including the portion of highest or lowest address
-* sector that is not overlaid by the parameter sectors.
-* The uniform sector erase command has no effect on parameter sectors.
-*/
-   if ((jedec == 0x0219 || (jedec == 0x0220)) &&
-   (ext_jedec & 0xff00) == 0x4d00) {
-   int ret;
-   u8 id[6];
-
-   /* Read the ID codes again, 6 bytes */
-   ret = spi_flash_cmd(flash->spi, CMD_READ_ID, id, sizeof(id));
-   if (ret)
-   return -EIO;
-
-   ret = memcmp(id, idcode, 5);
-   if (ret)
-   return -EIO;
-
-   /* 0x81: S25FS-S family 0x80: S25FL-S family */
-   if (id[5] == 0x81) {
-   ret = spansion_s25fss_disable_4KB_erase(spi);
-   if (ret)
-   return ret;
-   }
-   }
-#endif
/* Flash powers up read-only, so clear BP# bits */
if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_ATMEL ||
JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_MACRONIX ||
-- 
2.7.4

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


[U-Boot] [PATCH v2 14/22] sf: Cleanup sf_params

2016-08-09 Thread Jagan Teki
- Move headers froms sf_params to common header file
- Removed unnecessary comment

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h | 5 +++--
 drivers/mtd/spi/sf_params.c   | 5 -
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 561a331..41e48e7 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -10,8 +10,9 @@
 #ifndef _SF_INTERNAL_H_
 #define _SF_INTERNAL_H_
 
-#include 
-#include 
+#include 
+#include 
+#include 
 
 /* Dual SPI flash memories - see SPI_COMM_DUAL_... */
 enum spi_dual_flash {
diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index 7fcc3bc..7314455 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -6,10 +6,6 @@
  * SPDX-License-Identifier:GPL-2.0+
  */
 
-#include 
-#include 
-#include 
-
 #include "sf_internal.h"
 
 /* Used when the "_ext_id" is two bytes at most */
@@ -27,7 +23,6 @@
.page_size = 256,   \
.flags = (_flags),
 
-/* SPI/QSPI flash device params structure */
 const struct spi_flash_info spi_flash_ids[] = {
 #ifdef CONFIG_SPI_FLASH_ATMEL  /* ATMEL */
{"AT45DB011D", INFO(0x1f2200, 0x0, 64 * 1024, 4, SECT_4K) },
-- 
2.7.4

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


[U-Boot] [PATCH v2 13/22] sf: Cleanup spi_flash_info{}

2016-08-09 Thread Jagan Teki
- Proper tabs spaces
- Removed unnecessary
- Added meaningful comments 

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h | 22 --
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 26ada3b..561a331 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -108,17 +108,8 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
 #define JEDEC_ID(info) (((info)->id[1]) << 8 | ((info)->id[2]))
 #define JEDEC_EXT(info)(((info)->id[3]) << 8 | ((info)->id[4]))
 
-/**
- * struct spi_flash_info - SPI/QSPI flash device params structure
- *
- * @name:  Device name ([MANUFLETTER][DEVTYPE][DENSITY][EXTRAINFO])
- * @sector_size:   Isn't necessarily a sector size from vendor,
- * the size listed here is what works with CMD_ERASE_64K
- * @nr_sectors:No.of sectors on this device
- * @flags: Important param, for flash specific behaviour
- */
 struct spi_flash_info {
-   const char *name;
+   const char  *name;
 
/*
 * This array stores the ID bytes.
@@ -128,12 +119,15 @@ struct spi_flash_info {
u8  id[5];
u8  id_len;
 
-   u32 sector_size;
-   u32 nr_sectors;
+   /* The size listed here is what works with SPINOR_OP_SE, which isn't
+* necessarily called a "sector" by the vendor.
+*/
+   u32 sector_size;
+   u32 nr_sectors;
 
-   u16 page_size;
+   u16 page_size;
 
-   u16 flags;
+   u16 flags;
 #define SECT_4KBIT(0)
 #define E_FSR  BIT(1)
 #define SST_WR BIT(2)
-- 
2.7.4

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


[U-Boot] [PATCH v2 12/22] sf: sandbox: Fix ID exctract from spi_flash_info

2016-08-09 Thread Jagan Teki
This patch fix the id exctract from spi_flash_info ids.

Cc: Simon Glass 
Cc: Bin Meng 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sandbox.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index 0ac7fb7..a6adbe4 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -362,7 +362,8 @@ static int sandbox_sf_xfer(struct udevice *dev, unsigned 
int bitlen,
debug(" id: off:%u tx:", sbsf->off);
if (sbsf->off < IDCODE_LEN) {
/* Extract correct byte from ID 0x00aabbcc */
-   id = sbsf->data->jedec >>
+   id = ((JEDEC_MFR(sbsf->data) << 16) |
+   JEDEC_ID(sbsf->data)) >>
(8 * (IDCODE_LEN - 1 - sbsf->off));
} else {
id = 0;
-- 
2.7.4

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


[U-Boot] [PATCH v2 11/22] sf: Simplify lock ops detection code

2016-08-09 Thread Jagan Teki
Simplify the flash_lock ops detection code and added
meaningful comment.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/spi_flash.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 7bb8775..1d63517 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1117,19 +1117,15 @@ int spi_flash_scan(struct spi_flash *flash)
flash->read = spi_flash_cmd_read_ops;
 #endif
 
-   /* lock hooks are flash specific - assign them based on idcode0 */
-   switch (JEDEC_MFR(info)) {
 #if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST)
-   case SPI_FLASH_CFI_MFR_STMICRO:
-   case SPI_FLASH_CFI_MFR_SST:
+   /* NOR protection support for STmicro/Micron chips and similar */
+   if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_STMICRO ||
+   JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST) {
flash->flash_lock = stm_lock;
flash->flash_unlock = stm_unlock;
flash->flash_is_locked = stm_is_locked;
-#endif
-   break;
-   default:
-   debug("SF: Lock ops not supported for %02x flash\n", 
JEDEC_MFR(info));
}
+#endif
 
/* Compute the flash size */
flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
-- 
2.7.4

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


[U-Boot] [PATCH v2 06/22] sf: Move flags macro's to spi_flash_params{} members

2016-08-09 Thread Jagan Teki
This patch moves flags macro's to respective member position on
spi_flash_params{}, for better readabilty and finding the
respective member macro's easily.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Cc: Vignesh R 
Cc: Mugunthan V N 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h | 23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 1301e48..e5c38bf 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -20,19 +20,6 @@ enum spi_dual_flash {
SF_DUAL_PARALLEL_FLASH  = BIT(1),
 };
 
-/* sf param flags */
-enum {
-   SECT_4K = BIT(0),
-   E_FSR   = BIT(1),
-   SST_WR  = BIT(2),
-   WR_QPP  = BIT(3),
-   RD_QUAD = BIT(4),
-   RD_DUAL = BIT(5),
-   RD_QUADIO   = BIT(6),
-   RD_DUALIO   = BIT(7),
-};
-#define RD_FULLRD_QUAD | RD_DUAL | RD_QUADIO | RD_DUALIO
-
 enum spi_nor_option_flags {
SNOR_F_SST_WR   = BIT(0),
SNOR_F_USE_FSR  = BIT(1),
@@ -133,7 +120,17 @@ struct spi_flash_params {
u16 ext_jedec;
u32 sector_size;
u32 nr_sectors;
+
u16 flags;
+#define SECT_4KBIT(0)
+#define E_FSR  BIT(1)
+#define SST_WR BIT(2)
+#define WR_QPP BIT(3)
+#define RD_QUADBIT(4)
+#define RD_DUALBIT(5)
+#define RD_QUADIO  BIT(6)
+#define RD_DUALIO  BIT(7)
+#define RD_FULL(RD_QUAD | RD_DUAL | RD_QUADIO | RD_DUALIO)
 };
 
 extern const struct spi_flash_params spi_flash_params_table[];
-- 
2.7.4

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


[U-Boot] [PATCH v2 07/22] sf: Adopt flash table INFO macro from Linux

2016-08-09 Thread Jagan Teki
INFO macro make flash table entries more adjustable like
adding new flash_info attributes, update ID length bytes
and so on and more over it will sync to Linux way of defining
flash_info attributes.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h |  15 ++-
 drivers/mtd/spi/sf_params.c   | 215 ++
 drivers/mtd/spi/spi_flash.c   |  61 ++--
 include/linux/err.h   |   5 +
 4 files changed, 160 insertions(+), 136 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index e5c38bf..3f20b67 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -107,8 +107,6 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
  * struct spi_flash_params - SPI/QSPI flash device params structure
  *
  * @name:  Device name ([MANUFLETTER][DEVTYPE][DENSITY][EXTRAINFO])
- * @jedec: Device jedec ID (0x[1byte_manuf_id][2byte_dev_id])
- * @ext_jedec: Device ext_jedec ID
  * @sector_size:   Isn't necessarily a sector size from vendor,
  * the size listed here is what works with CMD_ERASE_64K
  * @nr_sectors:No.of sectors on this device
@@ -116,11 +114,20 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
  */
 struct spi_flash_params {
const char *name;
-   u32 jedec;
-   u16 ext_jedec;
+
+   /*
+* This array stores the ID bytes.
+* The first three bytes are the JEDIC ID.
+* JEDEC ID zero means "no ID" (mostly older chips).
+*/
+   u8  id[5];
+   u8  id_len;
+
u32 sector_size;
u32 nr_sectors;
 
+   u16 page_size;
+
u16 flags;
 #define SECT_4KBIT(0)
 #define E_FSR  BIT(1)
diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index 5b50114..70d9e18 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -12,125 +12,140 @@
 
 #include "sf_internal.h"
 
+/* Used when the "_ext_id" is two bytes at most */
+#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
+   .id = { \
+   ((_jedec_id) >> 16) & 0xff, \
+   ((_jedec_id) >> 8) & 0xff,  \
+   (_jedec_id) & 0xff, \
+   ((_ext_id) >> 8) & 0xff,\
+   (_ext_id) & 0xff,   \
+   },  \
+   .id_len = (!(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0))),   
\
+   .sector_size = (_sector_size),  \
+   .nr_sectors = (_n_sectors), \
+   .page_size = 256,   \
+   .flags = (_flags),
+
 /* SPI/QSPI flash device params structure */
 const struct spi_flash_params spi_flash_params_table[] = {
 #ifdef CONFIG_SPI_FLASH_ATMEL  /* ATMEL */
-   {"AT45DB011D", 0x1f2200, 0x0,   64 * 1024, 4, SECT_4K},
-   {"AT45DB021D", 0x1f2300, 0x0,   64 * 1024, 8, SECT_4K},
-   {"AT45DB041D", 0x1f2400, 0x0,   64 * 1024, 8, SECT_4K},
-   {"AT45DB081D", 0x1f2500, 0x0,   64 * 1024,16, SECT_4K},
-   {"AT45DB161D", 0x1f2600, 0x0,   64 * 1024,32, SECT_4K},
-   {"AT45DB321D", 0x1f2700, 0x0,   64 * 1024,64, SECT_4K},
-   {"AT45DB641D", 0x1f2800, 0x0,   64 * 1024,   128, SECT_4K},
-   {"AT25DF321A", 0x1f4701, 0x0,   64 * 1024,64, SECT_4K},
-   {"AT25DF321",  0x1f4700, 0x0,   64 * 1024,64, SECT_4K},
-   {"AT26DF081A", 0x1f4501, 0x0,   64 * 1024,16, SECT_4K},
+   {"AT45DB011D", INFO(0x1f2200, 0x0, 64 * 1024, 4, SECT_4K) },
+   {"AT45DB021D", INFO(0x1f2300, 0x0, 64 * 1024, 8, SECT_4K) },
+   {"AT45DB041D", INFO(0x1f2400, 0x0, 64 * 1024, 8, SECT_4K) },
+   {"AT45DB081D", INFO(0x1f2500, 0x0, 64 * 1024,16, SECT_4K) },
+   {"AT45DB161D", INFO(0x1f2600, 0x0, 64 * 1024,32, SECT_4K) },
+   {"AT45DB321D", INFO(0x1f2700, 0x0, 64 * 1024,64, SECT_4K) },
+   {"AT45DB641D", INFO(0x1f2800, 0x0, 64 * 1024,   128, SECT_4K) },
+   {"AT25DF321A", INFO(0x1f4701, 0x0, 64 * 1024,64, SECT_4K) },
+   {"AT25DF321",  INFO(0x1f4700, 0x0, 64 * 1024,64, SECT_4K) },
+   {"AT26DF081A", INFO(0x1f4501, 

[U-Boot] [PATCH v2 15/22] sf: nr_sectors -> n_sectors

2016-08-09 Thread Jagan Teki
Rename nr_sectors as n_sectors to sync with Linux.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h | 2 +-
 drivers/mtd/spi/sf_params.c   | 2 +-
 drivers/mtd/spi/spi_flash.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 41e48e7..74f33a3 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -124,7 +124,7 @@ struct spi_flash_info {
 * necessarily called a "sector" by the vendor.
 */
u32 sector_size;
-   u32 nr_sectors;
+   u32 n_sectors;
 
u16 page_size;
 
diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index 7314455..8a2a6b2 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -19,7 +19,7 @@
},  \
.id_len = (!(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0))),   
\
.sector_size = (_sector_size),  \
-   .nr_sectors = (_n_sectors), \
+   .n_sectors = (_n_sectors),  \
.page_size = 256,   \
.flags = (_flags),
 
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 1d63517..cf49045 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1143,7 +1143,7 @@ int spi_flash_scan(struct spi_flash *flash)
}
flash->page_size <<= flash->shift;
flash->sector_size = info->sector_size << flash->shift;
-   flash->size = flash->sector_size * info->nr_sectors << flash->shift;
+   flash->size = flash->sector_size * info->n_sectors << flash->shift;
 #ifdef CONFIG_SF_DUAL_FLASH
if (flash->dual_flash & SF_DUAL_STACKED_FLASH)
flash->size <<= 1;
-- 
2.7.4

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


[U-Boot] [PATCH v2 05/22] sf: Add CONFIG_SPI_FLASH_USE_4K_SECTORS in spi_flash

2016-08-09 Thread Jagan Teki
Add CONFIG_SPI_FLASH_USE_4K_SECTORS in spi_flash code from header file.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Cc: Vignesh R 
Cc: Mugunthan V N 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h | 4 
 drivers/mtd/spi/spi_flash.c   | 5 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 9eb0b84..1301e48 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -22,11 +22,7 @@ enum spi_dual_flash {
 
 /* sf param flags */
 enum {
-#ifndef CONFIG_SPI_FLASH_USE_4K_SECTORS
-   SECT_4K = 0,
-#else
SECT_4K = BIT(0),
-#endif
E_FSR   = BIT(1),
SST_WR  = BIT(2),
WR_QPP  = BIT(3),
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 2b2a409..7f6e9ae 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1155,11 +1155,14 @@ int spi_flash_scan(struct spi_flash *flash)
flash->size <<= 1;
 #endif
 
+#ifdef CONFIG_SPI_FLASH_USE_4K_SECTORS
/* Compute erase sector and command */
if (params->flags & SECT_4K) {
flash->erase_cmd = CMD_ERASE_4K;
flash->erase_size = 4096 << flash->shift;
-   } else {
+   } else
+#endif
+   {
flash->erase_cmd = CMD_ERASE_64K;
flash->erase_size = flash->sector_size;
}
-- 
2.7.4

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


[U-Boot] [PATCH v2 10/22] sf: Add JEDEC_MFR

2016-08-09 Thread Jagan Teki
Instead using idcode[0] for detecting manufacture id
add JEDEC_MFR macro for code simplicity and undesirability.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h |  1 +
 drivers/mtd/spi/spi_flash.c   | 30 +-
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 4e9ae34..26ada3b 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -104,6 +104,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
 #define CMD_SPANSION_WRAR  0x71 /* Write any device register */
 #endif
 
+#define JEDEC_MFR(info)((info)->id[0])
 #define JEDEC_ID(info) (((info)->id[1]) << 8 | ((info)->id[2]))
 #define JEDEC_EXT(info)(((info)->id[3]) << 8 | ((info)->id[4]))
 
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 80c96f9..7bb8775 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -165,7 +165,8 @@ bar_end:
return flash->bank_curr;
 }
 
-static int spi_flash_read_bar(struct spi_flash *flash, u8 idcode0)
+static int spi_flash_read_bar(struct spi_flash *flash,
+ const struct spi_flash_info *info)
 {
u8 curr_bank = 0;
int ret;
@@ -173,7 +174,7 @@ static int spi_flash_read_bar(struct spi_flash *flash, u8 
idcode0)
if (flash->size <= SPI_FLASH_16MB_BOUN)
goto bar_end;
 
-   switch (idcode0) {
+   switch (JEDEC_MFR(info)) {
case SPI_FLASH_CFI_MFR_SPANSION:
flash->bank_read_cmd = CMD_BANKADDR_BRRD;
flash->bank_write_cmd = CMD_BANKADDR_BRWR;
@@ -949,9 +950,10 @@ static const struct spi_flash_info 
*spi_flash_read_id(struct spi_flash *flash)
return ERR_PTR(-ENODEV);
 }
 
-static int set_quad_mode(struct spi_flash *flash, u8 idcode0)
+static int set_quad_mode(struct spi_flash *flash,
+const struct spi_flash_info *info)
 {
-   switch (idcode0) {
+   switch (JEDEC_MFR(info)) {
 #ifdef CONFIG_SPI_FLASH_MACRONIX
case SPI_FLASH_CFI_MFR_MACRONIX:
return macronix_quad_enable(flash);
@@ -966,7 +968,8 @@ static int set_quad_mode(struct spi_flash *flash, u8 
idcode0)
return micron_quad_enable(flash);
 #endif
default:
-   printf("SF: Need set QEB func for %02x flash\n", idcode0);
+   printf("SF: Need set QEB func for %02x flash\n",
+  JEDEC_MFR(info));
return -1;
}
 }
@@ -1085,9 +1088,9 @@ int spi_flash_scan(struct spi_flash *flash)
}
 #endif
/* Flash powers up read-only, so clear BP# bits */
-   if (idcode[0] == SPI_FLASH_CFI_MFR_ATMEL ||
-   idcode[0] == SPI_FLASH_CFI_MFR_MACRONIX ||
-   idcode[0] == SPI_FLASH_CFI_MFR_SST)
+   if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_ATMEL ||
+   JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_MACRONIX ||
+   JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST)
write_sr(flash, 0);
 
/* Assign spi data */
@@ -1115,7 +1118,7 @@ int spi_flash_scan(struct spi_flash *flash)
 #endif
 
/* lock hooks are flash specific - assign them based on idcode0 */
-   switch (idcode[0]) {
+   switch (JEDEC_MFR(info)) {
 #if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST)
case SPI_FLASH_CFI_MFR_STMICRO:
case SPI_FLASH_CFI_MFR_SST:
@@ -1125,7 +1128,7 @@ int spi_flash_scan(struct spi_flash *flash)
 #endif
break;
default:
-   debug("SF: Lock ops not supported for %02x flash\n", idcode[0]);
+   debug("SF: Lock ops not supported for %02x flash\n", 
JEDEC_MFR(info));
}
 
/* Compute the flash size */
@@ -1185,9 +1188,10 @@ int spi_flash_scan(struct spi_flash *flash)
if ((flash->read_cmd == CMD_READ_QUAD_OUTPUT_FAST) ||
(flash->read_cmd == CMD_READ_QUAD_IO_FAST) ||
(flash->write_cmd == CMD_QUAD_PAGE_PROGRAM)) {
-   ret = set_quad_mode(flash, idcode[0]);
+   ret = set_quad_mode(flash, info);
if (ret) {
-   debug("SF: Fail to set QEB for %02x\n", idcode[0]);
+   debug("SF: Fail to set QEB for %02x\n",
+ JEDEC_MFR(info));
return -EINVAL;
}
}
@@ -1218,7 +1222,7 @@ int spi_flash_scan(struct spi_flash *flash)
 
/* Configure the BAR - discover bank cmds and read current bank */
 #ifdef CONFIG_SPI_FLASH_BAR
-   ret = spi_flash_read_bar(flash, idcode[0]);
+   ret = 

[U-Boot] [PATCH v2 09/22] sf: Rename spi_flash_params => spi_flash_info

2016-08-09 Thread Jagan Teki
Renamed for more readability
- spi_flash_params => spi_flash_info
- params => info

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sandbox.c |  6 +++---
 drivers/mtd/spi/sf_internal.h | 10 +-
 drivers/mtd/spi/sf_params.c   |  2 +-
 drivers/mtd/spi/spi_flash.c   | 46 +--
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index 53470b9..0ac7fb7 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -88,7 +88,7 @@ struct sandbox_spi_flash {
/* The current flash status (see STAT_XXX defines above) */
u16 status;
/* Data describing the flash we're emulating */
-   const struct spi_flash_params *data;
+   const struct spi_flash_info *data;
/* The file on disk to serv up data from */
int fd;
 };
@@ -112,7 +112,7 @@ static int sandbox_sf_probe(struct udevice *dev)
struct sandbox_spi_flash *sbsf = dev_get_priv(dev);
const char *file;
size_t len, idname_len;
-   const struct spi_flash_params *data;
+   const struct spi_flash_info *data;
struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev);
struct sandbox_state *state = state_get_current();
struct udevice *bus = dev->parent;
@@ -168,7 +168,7 @@ static int sandbox_sf_probe(struct udevice *dev)
}
debug("%s: device='%s'\n", __func__, spec);
 
-   for (data = spi_flash_params_table; data->name; data++) {
+   for (data = spi_flash_ids; data->name; data++) {
len = strlen(data->name);
if (idname_len != len)
continue;
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index a57c330..4e9ae34 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -104,11 +104,11 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
 #define CMD_SPANSION_WRAR  0x71 /* Write any device register */
 #endif
 
-#define JEDEC_ID(params)   (((params)->id[1]) << 8 | ((params)->id[2]))
-#define JEDEC_EXT(params)  (((params)->id[3]) << 8 | ((params)->id[4]))
+#define JEDEC_ID(info) (((info)->id[1]) << 8 | ((info)->id[2]))
+#define JEDEC_EXT(info)(((info)->id[3]) << 8 | ((info)->id[4]))
 
 /**
- * struct spi_flash_params - SPI/QSPI flash device params structure
+ * struct spi_flash_info - SPI/QSPI flash device params structure
  *
  * @name:  Device name ([MANUFLETTER][DEVTYPE][DENSITY][EXTRAINFO])
  * @sector_size:   Isn't necessarily a sector size from vendor,
@@ -116,7 +116,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
  * @nr_sectors:No.of sectors on this device
  * @flags: Important param, for flash specific behaviour
  */
-struct spi_flash_params {
+struct spi_flash_info {
const char *name;
 
/*
@@ -144,7 +144,7 @@ struct spi_flash_params {
 #define RD_FULL(RD_QUAD | RD_DUAL | RD_QUADIO | RD_DUALIO)
 };
 
-extern const struct spi_flash_params spi_flash_params_table[];
+extern const struct spi_flash_info spi_flash_ids[];
 
 /* Send a single-byte command to the device and read the response */
 int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len);
diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index 70d9e18..7fcc3bc 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -28,7 +28,7 @@
.flags = (_flags),
 
 /* SPI/QSPI flash device params structure */
-const struct spi_flash_params spi_flash_params_table[] = {
+const struct spi_flash_info spi_flash_ids[] = {
 #ifdef CONFIG_SPI_FLASH_ATMEL  /* ATMEL */
{"AT45DB011D", INFO(0x1f2200, 0x0, 64 * 1024, 4, SECT_4K) },
{"AT45DB021D", INFO(0x1f2300, 0x0, 64 * 1024, 8, SECT_4K) },
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index c84c6b7..80c96f9 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -924,11 +924,11 @@ static int micron_quad_enable(struct spi_flash *flash)
 }
 #endif
 
-static const struct spi_flash_params *spi_flash_read_id(struct spi_flash 
*flash)
+static const struct spi_flash_info *spi_flash_read_id(struct spi_flash *flash)
 {
int tmp;
u8  id[5];
-   const struct spi_flash_params   *params;
+   const struct spi_flash_info *info;
 
tmp = spi_flash_cmd(flash->spi, CMD_READ_ID, id, 5);
if (tmp < 0) {
@@ -936,11 +936,11 @@ static const struct spi_flash_params 

[U-Boot] [PATCH v2 04/22] sf: Remove SECT_32K

2016-08-09 Thread Jagan Teki
SECT_32K never used anywhere in the code.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Cc: Vignesh R 
Cc: Mugunthan V N 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h | 16 +++-
 drivers/mtd/spi/spi_flash.c   |  3 ---
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 71ba1a6..9eb0b84 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -27,14 +27,13 @@ enum {
 #else
SECT_4K = BIT(0),
 #endif
-   SECT_32K= BIT(1),
-   E_FSR   = BIT(2),
-   SST_WR  = BIT(3),
-   WR_QPP  = BIT(4),
-   RD_QUAD = BIT(5),
-   RD_DUAL = BIT(6),
-   RD_QUADIO   = BIT(7),
-   RD_DUALIO   = BIT(8),
+   E_FSR   = BIT(1),
+   SST_WR  = BIT(2),
+   WR_QPP  = BIT(3),
+   RD_QUAD = BIT(4),
+   RD_DUAL = BIT(5),
+   RD_QUADIO   = BIT(6),
+   RD_DUALIO   = BIT(7),
 };
 #define RD_FULLRD_QUAD | RD_DUAL | RD_QUADIO | RD_DUALIO
 
@@ -57,7 +56,6 @@ enum spi_nor_option_flags {
 
 /* Erase commands */
 #define CMD_ERASE_4K   0x20
-#define CMD_ERASE_32K  0x52
 #define CMD_ERASE_CHIP 0xc7
 #define CMD_ERASE_64K  0xd8
 
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 041b64f..2b2a409 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1159,9 +1159,6 @@ int spi_flash_scan(struct spi_flash *flash)
if (params->flags & SECT_4K) {
flash->erase_cmd = CMD_ERASE_4K;
flash->erase_size = 4096 << flash->shift;
-   } else if (params->flags & SECT_32K) {
-   flash->erase_cmd = CMD_ERASE_32K;
-   flash->erase_size = 32768 << flash->shift;
} else {
flash->erase_cmd = CMD_ERASE_64K;
flash->erase_size = flash->sector_size;
-- 
2.7.4

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


[U-Boot] [PATCH v2 08/22] sf: Add JEDEC_ID and JEDEC_EXT macro

2016-08-09 Thread Jagan Teki
Few of the flash families with different ext_jedec
have changes in page_size so these macros check these
ext_jedec and assign page_size accordingly

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h |  4 
 drivers/mtd/spi/spi_flash.c   | 10 --
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 3f20b67..a57c330 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -103,6 +103,10 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
 #define CMD_SPANSION_RDAR  0x65 /* Read any device register */
 #define CMD_SPANSION_WRAR  0x71 /* Write any device register */
 #endif
+
+#define JEDEC_ID(params)   (((params)->id[1]) << 8 | ((params)->id[2]))
+#define JEDEC_EXT(params)  (((params)->id[3]) << 8 | ((params)->id[4]))
+
 /**
  * struct spi_flash_params - SPI/QSPI flash device params structure
  *
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 58d5a6a..c84c6b7 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1130,19 +1130,17 @@ int spi_flash_scan(struct spi_flash *flash)
 
/* Compute the flash size */
flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
+   flash->page_size = params->page_size;
/*
 * The Spansion S25FL032P and S25FL064P have 256b pages, yet use the
 * 0x4d00 Extended JEDEC code. The rest of the Spansion flashes with
 * the 0x4d00 Extended JEDEC code have 512b pages. All of the others
 * have 256b pages.
 */
-   if (ext_jedec == 0x4d00) {
-   if ((jedec == 0x0215) || (jedec == 0x216) || (jedec == 0x220))
-   flash->page_size = 256;
-   else
+   if (JEDEC_EXT(params) == 0x4d00) {
+   if ((JEDEC_ID(params) != 0x0215) &&
+   (JEDEC_ID(params) != 0x0216))
flash->page_size = 512;
-   } else {
-   flash->page_size = 256;
}
flash->page_size <<= flash->shift;
flash->sector_size = params->sector_size << flash->shift;
-- 
2.7.4

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


[U-Boot] [PATCH v2 03/22] spi: Use mode for rx mode flags

2016-08-09 Thread Jagan Teki
Make rx mode flags as generic to spi, earlier mode_rx is
maintained separately becuase of some flash specific code.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Cc: Vignesh R 
Cc: Mugunthan V N 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/spi_flash.c |  6 +++---
 drivers/spi/cadence_qspi.c  |  2 +-
 drivers/spi/ich.c   |  6 ++
 drivers/spi/spi-uclass.c| 11 ---
 drivers/spi/ti_qspi.c   |  6 +++---
 include/spi.h   | 14 --
 6 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 5fd408c..041b64f 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1172,11 +1172,11 @@ int spi_flash_scan(struct spi_flash *flash)
 
/* Look for read commands */
flash->read_cmd = CMD_READ_ARRAY_FAST;
-   if (spi->mode_rx & SPI_RX_SLOW)
+   if (spi->mode & SPI_RX_SLOW)
flash->read_cmd = CMD_READ_ARRAY_SLOW;
-   else if (spi->mode_rx & SPI_RX_QUAD && params->flags & RD_QUAD)
+   else if (spi->mode & SPI_RX_QUAD && params->flags & RD_QUAD)
flash->read_cmd = CMD_READ_QUAD_OUTPUT_FAST;
-   else if (spi->mode_rx & SPI_RX_DUAL && params->flags & RD_DUAL)
+   else if (spi->mode & SPI_RX_DUAL && params->flags & RD_DUAL)
flash->read_cmd = CMD_READ_DUAL_OUTPUT_FAST;
 
/* Look for write commands */
diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index a5244ff..1d50f13 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -251,7 +251,7 @@ static int cadence_spi_xfer(struct udevice *dev, unsigned 
int bitlen,
break;
case CQSPI_INDIRECT_READ:
err = cadence_qspi_apb_indirect_read_setup(plat,
-   priv->cmd_len, dm_plat->mode_rx, cmd_buf);
+   priv->cmd_len, dm_plat->mode, cmd_buf);
if (!err) {
err = cadence_qspi_apb_indirect_read_execute
(plat, data_bytes, din);
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index 00b2fed..caf0103 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -649,10 +649,8 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
 * ICH 7 SPI controller only supports array read command
 * and byte program command for SST flash
 */
-   if (plat->ich_version == ICHV_7) {
-   slave->mode_rx = SPI_RX_SLOW;
-   slave->mode = SPI_TX_BYTE;
-   }
+   if (plat->ich_version == ICHV_7)
+   slave->mode = SPI_RX_SLOW | SPI_TX_BYTE;
 
return 0;
 }
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 247abfa..d9c49e4 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -164,7 +164,6 @@ static int spi_child_pre_probe(struct udevice *dev)
 
slave->max_hz = plat->max_hz;
slave->mode = plat->mode;
-   slave->mode_rx = plat->mode_rx;
slave->wordlen = SPI_DEFAULT_WORDLEN;
 
return 0;
@@ -381,7 +380,7 @@ void spi_free_slave(struct spi_slave *slave)
 int spi_slave_ofdata_to_platdata(const void *blob, int node,
 struct dm_spi_slave_platdata *plat)
 {
-   int mode = 0, mode_rx = 0;
+   int mode = 0;
int value;
 
plat->cs = fdtdec_get_int(blob, node, "reg", -1);
@@ -413,24 +412,22 @@ int spi_slave_ofdata_to_platdata(const void *blob, int 
node,
break;
}
 
-   plat->mode = mode;
-
value = fdtdec_get_uint(blob, node, "spi-rx-bus-width", 1);
switch (value) {
case 1:
break;
case 2:
-   mode_rx |= SPI_RX_DUAL;
+   mode |= SPI_RX_DUAL;
break;
case 4:
-   mode_rx |= SPI_RX_QUAD;
+   mode |= SPI_RX_QUAD;
break;
default:
error("spi-rx-bus-width %d not supported\n", value);
break;
}
 
-   plat->mode_rx = mode_rx;
+   plat->mode = mode;
 
return 0;
 }
diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
index bb72cb0..37dc64f 100644
--- a/drivers/spi/ti_qspi.c
+++ b/drivers/spi/ti_qspi.c
@@ -336,7 +336,7 @@ static void ti_spi_setup_spi_register(struct ti_qspi_priv 
*priv)
QSPI_SETUP0_NUM_D_BYTES_8_BITS |
QSPI_SETUP0_READ_QUAD | QSPI_CMD_WRITE |
QSPI_NUM_DUMMY_BITS);
-   slave->mode_rx = SPI_RX_QUAD;
+   slave->mode |= SPI_RX_QUAD;
 #else
memval |= QSPI_CMD_READ | QSPI_SETUP0_NUM_A_BYTES |
QSPI_SETUP0_NUM_D_BYTES_NO_BITS |
@@ -422,7 +422,7 @@ 

[U-Boot] [PATCH v2 18/22] sf: Add INFO6 flash_info macro

2016-08-09 Thread Jagan Teki
INFO6 is for tabulating 6 byte flash parts, Ex: S25FS256S_64K

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_params.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index 8a2a6b2..344d9c9 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -23,6 +23,21 @@
.page_size = 256,   \
.flags = (_flags),
 
+#define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)\
+   .id = { \
+   ((_jedec_id) >> 16) & 0xff, \
+   ((_jedec_id) >> 8) & 0xff,  \
+   (_jedec_id) & 0xff, \
+   ((_ext_id) >> 16) & 0xff,   \
+   ((_ext_id) >> 8) & 0xff,\
+   (_ext_id) & 0xff,   \
+   },  \
+   .id_len = 6,\
+   .sector_size = (_sector_size),  \
+   .n_sectors = (_n_sectors),  \
+   .page_size = 256,   \
+   .flags = (_flags),
+
 const struct spi_flash_info spi_flash_ids[] = {
 #ifdef CONFIG_SPI_FLASH_ATMEL  /* ATMEL */
{"AT45DB011D", INFO(0x1f2200, 0x0, 64 * 1024, 4, SECT_4K) },
-- 
2.7.4

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


[U-Boot] [PATCH v2 02/22] sf: Remove e_rd_cmd from param table

2016-08-09 Thread Jagan Teki
e_rd_cmd is maintained separately for fastest read command code,
since the read commands are computed normally this e_rd_cmd
is not required in spi_flash_params table.

Cc: Simon Glass 
Cc: Bin Meng 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Cc: Vignesh R 
Cc: Mugunthan V N 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h |  18 +---
 drivers/mtd/spi/sf_params.c   | 200 +-
 2 files changed, 101 insertions(+), 117 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index c5cb791..71ba1a6 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -20,21 +20,6 @@ enum spi_dual_flash {
SF_DUAL_PARALLEL_FLASH  = BIT(1),
 };
 
-/* Enum list - Full read commands */
-enum spi_read_cmds {
-   ARRAY_SLOW  = BIT(0),
-   ARRAY_FAST  = BIT(1),
-   DUAL_OUTPUT_FAST= BIT(2),
-   QUAD_OUTPUT_FAST= BIT(3),
-   DUAL_IO_FAST= BIT(4),
-   QUAD_IO_FAST= BIT(5),
-};
-
-/* Normal - Extended - Full command set */
-#define RD_NORM(ARRAY_SLOW | ARRAY_FAST)
-#define RD_EXTN(RD_NORM | DUAL_OUTPUT_FAST | DUAL_IO_FAST)
-#define RD_FULL(RD_EXTN | QUAD_OUTPUT_FAST | QUAD_IO_FAST)
-
 /* sf param flags */
 enum {
 #ifndef CONFIG_SPI_FLASH_USE_4K_SECTORS
@@ -51,6 +36,7 @@ enum {
RD_QUADIO   = BIT(7),
RD_DUALIO   = BIT(8),
 };
+#define RD_FULLRD_QUAD | RD_DUAL | RD_QUADIO | RD_DUALIO
 
 enum spi_nor_option_flags {
SNOR_F_SST_WR   = BIT(0),
@@ -145,7 +131,6 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
  * @sector_size:   Isn't necessarily a sector size from vendor,
  * the size listed here is what works with CMD_ERASE_64K
  * @nr_sectors:No.of sectors on this device
- * @e_rd_cmd:  Enum list for read commands
  * @flags: Important param, for flash specific behaviour
  */
 struct spi_flash_params {
@@ -154,7 +139,6 @@ struct spi_flash_params {
u16 ext_jedec;
u32 sector_size;
u32 nr_sectors;
-   u8 e_rd_cmd;
u16 flags;
 };
 
diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index 70ca236..5b50114 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -15,122 +15,122 @@
 /* SPI/QSPI flash device params structure */
 const struct spi_flash_params spi_flash_params_table[] = {
 #ifdef CONFIG_SPI_FLASH_ATMEL  /* ATMEL */
-   {"AT45DB011D", 0x1f2200, 0x0,   64 * 1024, 4, RD_NORM,  
SECT_4K},
-   {"AT45DB021D", 0x1f2300, 0x0,   64 * 1024, 8, RD_NORM,  
SECT_4K},
-   {"AT45DB041D", 0x1f2400, 0x0,   64 * 1024, 8, RD_NORM,  
SECT_4K},
-   {"AT45DB081D", 0x1f2500, 0x0,   64 * 1024,16, RD_NORM,  
SECT_4K},
-   {"AT45DB161D", 0x1f2600, 0x0,   64 * 1024,32, RD_NORM,  
SECT_4K},
-   {"AT45DB321D", 0x1f2700, 0x0,   64 * 1024,64, RD_NORM,  
SECT_4K},
-   {"AT45DB641D", 0x1f2800, 0x0,   64 * 1024,   128, RD_NORM,  
SECT_4K},
-   {"AT25DF321A", 0x1f4701, 0x0,   64 * 1024,64, RD_NORM,  
SECT_4K},
-   {"AT25DF321",  0x1f4700, 0x0,   64 * 1024,64, RD_NORM,  
SECT_4K},
-   {"AT26DF081A", 0x1f4501, 0x0,   64 * 1024,16, RD_NORM,  
SECT_4K},
+   {"AT45DB011D", 0x1f2200, 0x0,   64 * 1024, 4, SECT_4K},
+   {"AT45DB021D", 0x1f2300, 0x0,   64 * 1024, 8, SECT_4K},
+   {"AT45DB041D", 0x1f2400, 0x0,   64 * 1024, 8, SECT_4K},
+   {"AT45DB081D", 0x1f2500, 0x0,   64 * 1024,16, SECT_4K},
+   {"AT45DB161D", 0x1f2600, 0x0,   64 * 1024,32, SECT_4K},
+   {"AT45DB321D", 0x1f2700, 0x0,   64 * 1024,64, SECT_4K},
+   {"AT45DB641D", 0x1f2800, 0x0,   64 * 1024,   128, SECT_4K},
+   {"AT25DF321A", 0x1f4701, 0x0,   64 * 1024,64, SECT_4K},
+   {"AT25DF321",  0x1f4700, 0x0,   64 * 1024,64, SECT_4K},
+   {"AT26DF081A", 0x1f4501, 0x0,   64 * 1024,16, SECT_4K},
 #endif
 #ifdef CONFIG_SPI_FLASH_EON/* EON */
-   {"EN25Q32B",   0x1c3016, 0x0,   64 * 1024,64, RD_NORM,  
  0},
-   {"EN25Q64",0x1c3017, 0x0,   64 * 1024,   128, RD_NORM,  
SECT_4K},
-   {"EN25Q128B",  0x1c3018, 0x0,   64 * 1024,   256, RD_NORM,  
  0},
-   {"EN25S64",0x1c3817, 0x0,   64 * 1024,   128, RD_NORM,  
  

[U-Boot] [PATCH v2 01/22] sf: Simplify fastest read cmd code

2016-08-09 Thread Jagan Teki
Fastest read command code look for fastest read command
taking inputs from spi->mode_rx and flags from param table
and controller mode_rx is always been a priority.

Since mode_rx is always set from controller side this optimized
code doesn't require much and this code required exctra overhead like
1) Maintain e_rx_cmd in param table
2) Maintain mode_rx in spi_slave {}

Hence removed this code, and look for read command from normal
spi->mode from spi_slave{} and params->flags

Cc: Simon Glass 
Cc: Bin Meng 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Cc: Vignesh R 
Cc: Mugunthan V N 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h |  4 
 drivers/mtd/spi/spi_flash.c   | 28 ++--
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index da2bb7b..c5cb791 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -46,6 +46,10 @@ enum {
E_FSR   = BIT(2),
SST_WR  = BIT(3),
WR_QPP  = BIT(4),
+   RD_QUAD = BIT(5),
+   RD_DUAL = BIT(6),
+   RD_QUADIO   = BIT(7),
+   RD_DUALIO   = BIT(8),
 };
 
 enum spi_nor_option_flags {
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 64d4e0f..5fd408c 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1013,15 +1013,8 @@ int spi_flash_scan(struct spi_flash *flash)
struct spi_slave *spi = flash->spi;
const struct spi_flash_params *params;
u16 jedec, ext_jedec;
-   u8 cmd, idcode[5];
+   u8 idcode[5];
int ret;
-   static u8 spi_read_cmds_array[] = {
-   CMD_READ_ARRAY_SLOW,
-   CMD_READ_ARRAY_FAST,
-   CMD_READ_DUAL_OUTPUT_FAST,
-   CMD_READ_QUAD_OUTPUT_FAST,
-   CMD_READ_DUAL_IO_FAST,
-   CMD_READ_QUAD_IO_FAST };
 
/* Read the ID codes */
ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode));
@@ -1177,17 +1170,16 @@ int spi_flash_scan(struct spi_flash *flash)
/* Now erase size becomes valid sector size */
flash->sector_size = flash->erase_size;
 
-   /* Look for the fastest read cmd */
-   cmd = fls(params->e_rd_cmd & spi->mode_rx);
-   if (cmd) {
-   cmd = spi_read_cmds_array[cmd - 1];
-   flash->read_cmd = cmd;
-   } else {
-   /* Go for default supported read cmd */
-   flash->read_cmd = CMD_READ_ARRAY_FAST;
-   }
+   /* Look for read commands */
+   flash->read_cmd = CMD_READ_ARRAY_FAST;
+   if (spi->mode_rx & SPI_RX_SLOW)
+   flash->read_cmd = CMD_READ_ARRAY_SLOW;
+   else if (spi->mode_rx & SPI_RX_QUAD && params->flags & RD_QUAD)
+   flash->read_cmd = CMD_READ_QUAD_OUTPUT_FAST;
+   else if (spi->mode_rx & SPI_RX_DUAL && params->flags & RD_DUAL)
+   flash->read_cmd = CMD_READ_DUAL_OUTPUT_FAST;
 
-   /* Not require to look for fastest only two write cmds yet */
+   /* Look for write commands */
if (params->flags & WR_QPP && spi->mode & SPI_TX_QUAD)
flash->write_cmd = CMD_QUAD_PAGE_PROGRAM;
else
-- 
2.7.4

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


[U-Boot] [PATCH v2 17/22] sf: Increase max id length by 1 byte

2016-08-09 Thread Jagan Teki
So, now SPI_FLASH_ID_MAX_LEN is 6 bytes useful for
few spansion flash families S25FS-S

Cc: Simon Glass 
Cc: Bin Meng 
Cc: York Sun 
Cc: Vignesh R 
Cc: Mugunthan V N 
Cc: Michal Simek 
Cc: Siva Durga Prasad Paladugu 
Signed-off-by: Jagan Teki 
---
 drivers/mtd/spi/sf_internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 775a04a..6be2121 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -108,7 +108,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
size_t len,
 #define JEDEC_MFR(info)((info)->id[0])
 #define JEDEC_ID(info) (((info)->id[1]) << 8 | ((info)->id[2]))
 #define JEDEC_EXT(info)(((info)->id[3]) << 8 | ((info)->id[4]))
-#define SPI_FLASH_MAX_ID_LEN   5
+#define SPI_FLASH_MAX_ID_LEN   6
 
 struct spi_flash_info {
const char  *name;
-- 
2.7.4

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


[U-Boot] [PATCH v2 00/22] spi/sf: Updates on flash detection

2016-08-09 Thread Jagan Teki
Updated spi_flash_info table in sync with Linux, and removed
legacy and unsupported code.

Changes for v2:
- New patches.

Jagan Teki (22):
  sf: Simplify fastest read cmd code
  sf: Remove e_rd_cmd from param table
  spi: Use mode for rx mode flags
  sf: Remove SECT_32K
  sf: Add CONFIG_SPI_FLASH_USE_4K_SECTORS in spi_flash
  sf: Move flags macro's to spi_flash_params{} members
  sf: Adopt flash table INFO macro from Linux
  sf: Add JEDEC_ID and JEDEC_EXT macro
  sf: Rename spi_flash_params => spi_flash_info
  sf: Add JEDEC_MFR
  sf: Simplify lock ops detection code
  sf: sandbox: Fix ID exctract from spi_flash_info
  sf: Cleanup spi_flash_info{}
  sf: Cleanup sf_params
  sf: nr_sectors -> n_sectors
  sf: Add SPI_FLASH_MAX_ID_LEN
  sf: Increase max id length by 1 byte
  sf: Add INFO6 flash_info macro
  sf: params: Add S25FS256S_64K spi flash support
  sf: Remove legacy idcode detection code
  sf: Remove non-meaningful comments
  sf: Rename sf_params.c to spi_flash_ids

 drivers/mtd/spi/Makefile|   2 +-
 drivers/mtd/spi/sandbox.c   |   9 +-
 drivers/mtd/spi/sf_internal.h   |  95 +++-
 drivers/mtd/spi/sf_params.c | 238 +--
 drivers/mtd/spi/spi_flash.c | 240 
 drivers/mtd/spi/spi_flash_ids.c | 176 +
 drivers/spi/cadence_qspi.c  |   2 +-
 drivers/spi/ich.c   |   6 +-
 drivers/spi/spi-uclass.c|  11 +-
 drivers/spi/ti_qspi.c   |   6 +-
 include/linux/err.h |   5 +
 include/spi.h   |  14 +--
 12 files changed, 444 insertions(+), 360 deletions(-)
 create mode 100644 drivers/mtd/spi/spi_flash_ids.c

-- 
2.7.4

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


[U-Boot] u-boot efi

2016-08-09 Thread scott.ivel...@calix.com
I am trying to use u-boot-efi on a board that has an Intel D-1500 series 
processor and 64-bit UEFI ROM.
As per the information in doc/README.efi I built a u-boot-payload.efi 
with CONFIG_EFI_STUB_64BIT and installed it onto a USB drive I am 
booting with.
The UEFI loads/runs the u-boot but quickly goes into the weeds. I have 
very limited debug facilities as this is a 3rd party board.
I was able to track down the failure to the following using calls to 
post_code():


lib/efi/efi_stub.c:efi_main()
  lib/efi/efi_stub.c:jump_to_uboot()
arch/x86/cpu/call32.S:cpu_call32()
  arch/x86/cpu/start.S:start()
common/init/board_init.c:board_init_f_alloc_reserve() -> fails 
upon return.


This is the first "call" instruction after control is transferred to the 
start() of the 32-bit u-boot image.
I also tried adding a call to a do-nothing function and the results were 
the same (failure upon return).
The CPU goes the weeds and I guess it is in some exception code (no JTAG 
debugger available).


This is the first time I have used u-boot in this mode and my first time 
working with the x86 architecture.


Any suggestions would be most appreciated.

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


Re: [U-Boot] [PATCH][v2] board: ls1012afrdm: overwrite CONFIG_EXTRA_ENV_SETTINGS

2016-08-09 Thread Pratiyush Srivastava


> -Original Message-
> From: york sun
> Sent: Friday, August 05, 2016 10:54 PM
> To: Pratiyush Srivastava ; u-
> b...@lists.denx.de
> Cc: Prabhakar Kushwaha 
> Subject: Re: [PATCH][v2] board: ls1012afrdm: overwrite
> CONFIG_EXTRA_ENV_SETTINGS
> 
> On 08/05/2016 02:47 AM, Pratiyush Mohan Srivastava wrote:
> > From: Prabhakar Kushwaha 
> >
> > LS1012AFRDM has 512MB of DDR.
> > So update Kernel load address as 0x9600 instead of default
> > 0xa000.
> >
> > Signed-off-by: Prabhakar Kushwaha 
> > Signed-off-by: Pratiyush Mohan Srivastava
> > 
> > ---
> > Changes for v2: Incorporated York's comments
> > - Removed ramdisk_addr, ramdisk_size
> > - Updated UART baud-rate.
> >
> > include/configs/ls1012afrdm.h | 14 ++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/include/configs/ls1012afrdm.h
> > b/include/configs/ls1012afrdm.h index ad81142..f2c6ca8 100644
> > --- a/include/configs/ls1012afrdm.h
> > +++ b/include/configs/ls1012afrdm.h
> > @@ -39,4 +39,18 @@
> >  #define CONFIG_SYS_MEMTEST_START   0x8000
> >  #define CONFIG_SYS_MEMTEST_END 0x9fff
> >
> > +#undef CONFIG_EXTRA_ENV_SETTINGS
> > +#define CONFIG_EXTRA_ENV_SETTINGS  \
> > +   "initrd_high=0x\0"  \
> 
> What is this?
[Pratiyush>] I used the LS1043 dts as the base for this dts. Since ls10143 had 
this parameter, I copied the same for LS1012. 
> 
> > +   "verify=no\0"   \
> > +   "hwconfig=fsl_ddr:bank_intlv=auto\0"\
> > +   "loadaddr=0x8010\0" \
> > +   "kernel_addr=0x10\0"\
> > +   "fdt_high=0x\0" \
> > +   "initrd_high=0x\0"  \
> > +   "kernel_start=0xa0\0"   \
> > +   "kernel_load=0x9600\0"  \
> > +   "kernel_size=0x280\0"   \
> > +   "console=ttyAMA0,115200n8\0"
> 
> Do you really use ttyAMA0? Isn't it ttyS0?
[Pratiyush>] I will remove the redundant console command.
> 
> York

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


[U-Boot] [PATCH v2 3/4] ARM: dts: vf-colibri: Enable USB device tree node for Colibri Vybrid

2016-08-09 Thread Sanchayan Maity
Enable USB device tree node for Toradex Colibri Vybrid module.

Signed-off-by: Sanchayan Maity 
---
 arch/arm/dts/vf-colibri.dtsi | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/dts/vf-colibri.dtsi b/arch/arm/dts/vf-colibri.dtsi
index dc52748..c2f104a 100644
--- a/arch/arm/dts/vf-colibri.dtsi
+++ b/arch/arm/dts/vf-colibri.dtsi
@@ -21,6 +21,17 @@
};
 };
 
+ {
+   dr_mode = "otg";
+   fsl,cdet-gpio = < 6 GPIO_ACTIVE_HIGH>;
+   status = "okay";
+};
+
+ {
+   dr_mode = "host";
+   status = "okay";
+};
+
  {
status = "okay";
 };
-- 
2.9.2

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


[U-Boot] [PATCH v2 4/4] configs: colibri_vf_defconfig: Enable USB driver model for Colibri Vybrid

2016-08-09 Thread Sanchayan Maity
Enable USB driver model for Toradex Colibri Vybrid modules.

Signed-off-by: Sanchayan Maity 
---
 configs/colibri_vf_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig
index 986cec4..5017c7d 100644
--- a/configs/colibri_vf_defconfig
+++ b/configs/colibri_vf_defconfig
@@ -33,6 +33,7 @@ CONFIG_SYS_NAND_VF610_NFC_60_ECC_BYTES=y
 CONFIG_FSL_LPUART=y
 CONFIG_FSL_DSPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_GADGET=y
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
-- 
2.9.2

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


[U-Boot] [PATCH v2 2/4] ARM: dts: vf: Add device tree node for USB on Vybrid

2016-08-09 Thread Sanchayan Maity
Add device tree node for USB peripheral on Vybrid.

Signed-off-by: Sanchayan Maity 
---
 arch/arm/dts/vf.dtsi | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/dts/vf.dtsi b/arch/arm/dts/vf.dtsi
index 1530d2f..d7d21a3 100644
--- a/arch/arm/dts/vf.dtsi
+++ b/arch/arm/dts/vf.dtsi
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier: GPL-2.0+ or X11
  */
 /include/ "skeleton.dtsi"
+#include 
 
 / {
aliases {
@@ -20,6 +21,8 @@
serial5 = 
spi0 = 
spi1 = 
+   ehci0 = 
+   ehci1 = 
};
 
soc {
@@ -113,6 +116,12 @@
reg = <0x400ff100 0x40>;
#gpio-cells = <2>;
};
+
+   ehci0: ehci@40034000 {
+   compatible = "fsl,vf610-usb";
+   reg = <0x40034000 0x800>;
+   status = "disabled";
+   };
};
 
aips1: aips-bus@4008 {
@@ -133,6 +142,11 @@
status = "disabled";
};
 
+   ehci1: ehci@400b4000 {
+   compatible = "fsl,vf610-usb";
+   reg = <0x400b4000 0x800>;
+   status = "disabled";
+   };
};
};
 };
-- 
2.9.2

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


[U-Boot] [PATCH v2 0/4] Migrate Vybrid USB driver to driver model

2016-08-09 Thread Sanchayan Maity
Hello,

This is the second version of the patchset for migrating Vybrid
USB driver to driver model.

Compare to the first version, this version takes care of dr_mode
property and correctly handles OTG as well when gpio is specified
for use as ID detection pin. This is an essential requirement for
OTG as Vybrid USB controller is not a true OTG though it can be
configured as either host or device. The ID pin which is unique
for OTG operation is not present on Vybrid.

The problem with client that I was observing was related to sequence
numbers. While trying to implement the OTG functionality I observed
that if during probe of USB0 if it returns ENODEV, the probe of USB1
provides a sequence number of 0 while we expect 1. The code relies
on sequence numbers for initialising the appropriate peripherals.
I use the bind operation to force a sequence number. This also seems
to solve the problems I was having with USB client and mentioned
in the previous version of the patchset.

Host and client functionality are both functional with this patch.
Patch series is based on top of latest u-boot master at the moment
of this writing. Tested on Toradex Colibri Vybrid VF61 module.

Thanks to Lukasz and Stefan for their comments.

V1 Patches:
[1].
https://patchwork.ozlabs.org/patch/655370/
[2].
https://patchwork.ozlabs.org/patch/655371/
[3].
https://patchwork.ozlabs.org/patch/655372/
[4].
https://patchwork.ozlabs.org/patch/655373/

Sanchayan Maity (4):
  usb: host: ehci-vf: Migrate Vybrid USB to driver model
  ARM: dts: vf: Add device tree node for USB on Vybrid
  ARM: dts: vf-colibri: Enable USB device tree node for Colibri Vybrid
  configs: colibri_vf_defconfig: Enable USB driver model for Colibri Vybrid

 arch/arm/dts/vf-colibri.dtsi |  11 +++
 arch/arm/dts/vf.dtsi |  14 +++
 configs/colibri_vf_defconfig |   1 +
 drivers/usb/host/ehci-vf.c   | 208 +--
 4 files changed, 227 insertions(+), 7 deletions(-)

-- 
2.9.2

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


[U-Boot] [PATCH v2 1/4] usb: host: ehci-vf: Migrate Vybrid USB to driver model

2016-08-09 Thread Sanchayan Maity
Add driver model support for Vybrid USB driver.

Signed-off-by: Sanchayan Maity 
---
 drivers/usb/host/ehci-vf.c | 208 +++--
 1 file changed, 201 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
index 61789dd..f6f9efb 100644
--- a/drivers/usb/host/ehci-vf.c
+++ b/drivers/usb/host/ehci-vf.c
@@ -8,16 +8,20 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "ehci.h"
 
@@ -32,6 +36,8 @@
 #define UCMD_RUN_STOP  (1 << 0) /* controller run/stop */
 #define UCMD_RESET (1 << 1) /* controller reset */
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static const unsigned phy_bases[] = {
USB_PHY0_BASE_ADDR,
USB_PHY1_BASE_ADDR,
@@ -131,24 +137,39 @@ int __weak board_ehci_hcd_init(int port)
return 0;
 }
 
+int ehci_vf_common_init(struct usb_ehci *ehci, int index)
+{
+   int ret;
+
+   /* Do board specific initialisation */
+   ret = board_ehci_hcd_init(index);
+   if (ret)
+   return ret;
+
+   usb_power_config(index);
+   usb_oc_config(index);
+   usb_internal_phy_clock_gate(index);
+   usb_phy_enable(index, ehci);
+
+   return 0;
+}
+
+#ifndef CONFIG_DM_USB
 int ehci_hcd_init(int index, enum usb_init_type init,
struct ehci_hccr **hccr, struct ehci_hcor **hcor)
 {
struct usb_ehci *ehci;
enum usb_init_type type;
+   int ret;
 
if (index >= ARRAY_SIZE(nc_reg_bases))
return -EINVAL;
 
ehci = (struct usb_ehci *)nc_reg_bases[index];
 
-   /* Do board specific initialisation */
-   board_ehci_hcd_init(index);
-
-   usb_power_config(index);
-   usb_oc_config(index);
-   usb_internal_phy_clock_gate(index);
-   usb_phy_enable(index, ehci);
+   ret = ehci_vf_common_init(index);
+   if (ret)
+   return ret;
 
*hccr = (struct ehci_hccr *)((uint32_t)>caplength);
*hcor = (struct ehci_hcor *)((uint32_t)*hccr +
@@ -175,3 +196,176 @@ int ehci_hcd_stop(int index)
 {
return 0;
 }
+#else
+/* Possible port types (dual role mode) */
+enum dr_mode {
+   DR_MODE_NONE = 0,
+   DR_MODE_HOST,   /* supports host operation */
+   DR_MODE_DEVICE, /* supports device operation */
+   DR_MODE_OTG,/* supports both */
+};
+
+struct ehci_vf_priv_data {
+   struct ehci_ctrl ctrl;
+   struct usb_ehci *ehci;
+   struct gpio_desc cdet_gpio;
+   enum usb_init_type init_type;
+   enum dr_mode dr_mode;
+   u32 portnr;
+};
+
+static int vf_usb_ofdata_to_platdata(struct udevice *dev)
+{
+   struct ehci_vf_priv_data *priv = dev_get_priv(dev);
+   const void *dt_blob = gd->fdt_blob;
+   int node = dev->of_offset;
+   const char *mode;
+
+   priv->portnr = dev->seq;
+
+   priv->ehci = (struct usb_ehci *)dev_get_addr(dev);
+   mode = fdt_getprop(dt_blob, node, "dr_mode", NULL);
+   if (mode) {
+   if (0 == strcmp(mode, "host")) {
+   priv->dr_mode = DR_MODE_HOST;
+   priv->init_type = USB_INIT_HOST;
+   } else if (0 == strcmp(mode, "peripheral")) {
+   priv->dr_mode = DR_MODE_DEVICE;
+   priv->init_type = USB_INIT_DEVICE;
+   } else if (0 == strcmp(mode, "otg")) {
+   priv->dr_mode = DR_MODE_OTG;
+   /*
+* We set init_type to device by default when OTG
+* mode is requested. If a valid gpio is provided
+* we will switch the init_type based on the state
+* of the gpio pin.
+*/
+   priv->init_type = USB_INIT_DEVICE;
+   } else {
+   debug("%s: Cannot decode dr_mode '%s'\n",
+ __func__, mode);
+   return -EINVAL;
+   }
+   } else {
+   priv->dr_mode = DR_MODE_HOST;
+   priv->init_type = USB_INIT_HOST;
+   }
+
+   if (priv->dr_mode == DR_MODE_OTG) {
+   gpio_request_by_name_nodev(dt_blob, node, "fsl,cdet-gpio", 0,
+  >cdet_gpio, GPIOD_IS_IN);
+   if (dm_gpio_is_valid(>cdet_gpio)) {
+   if (dm_gpio_get_value(>cdet_gpio))
+   priv->init_type = USB_INIT_DEVICE;
+   else
+   priv->init_type = USB_INIT_HOST;
+   }
+   }
+
+   return 0;
+}
+
+static int vf_init_after_reset(struct ehci_ctrl *dev)
+{
+   struct ehci_vf_priv_data *priv = dev->priv;
+   enum usb_init_type type = priv->init_type;
+   struct usb_ehci 

Re: [U-Boot] Disable command at runtime

2016-08-09 Thread Simon Glass
Hi,

On 29 July 2016 at 07:31, Tom Rini  wrote:
> On Thu, Jul 28, 2016 at 04:40:29AM -0700, kubiznak.petr wrote:
>
>> Hello,
>>
>> I wonder whether it is possible to dynamically enable/disable a command.
>> Since u-boot does not provide any secure authentication method, it is
>> dangerous to keep some commands available to a potential hacker. E.g.
>> the "fuse" command. On the other hand, I need these commands during the
>> manufacturing process. So my idea is to enable/disable the commands
>> dynamically based on some obscure logic. Is there a way to do it without
>> need to deeply hack the code?
>
> Well, there's a few ways to do this.  The first way would simply be to
> install a different build of U-Boot onto the board than the one used
> during flashing as part of the manufacturing process.

Also see cli_process_fdt() which allows you to lock out commands using
a device-tree setting. This avoids changing the U-Boot binary - it is
easy enough to update the device tree using fdtput. This is how Chrome
OS did it.

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


Re: [U-Boot] [PATCH 1/6] x86: Add implementations of setjmp() and longjmp()

2016-08-09 Thread Simon Glass
Hi Bin,

On 9 August 2016 at 00:49, Bin Meng  wrote:
> Hi Simon,
>
> On Sun, Aug 7, 2016 at 7:23 AM, Simon Glass  wrote:
>> Bring in these functions from Linux v4.4. They will be needed for EFI loader
>> support.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  arch/x86/cpu/Makefile |  2 +-
>>  arch/x86/cpu/setjmp.S | 71 
>> +++
>>  arch/x86/include/asm/setjmp.h | 24 +++
>>  3 files changed, 96 insertions(+), 1 deletion(-)
>>  create mode 100644 arch/x86/cpu/setjmp.S
>>  create mode 100644 arch/x86/include/asm/setjmp.h
>>
>> diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
>> index 2667e0b..f5b8c9e 100644
>> --- a/arch/x86/cpu/Makefile
>> +++ b/arch/x86/cpu/Makefile
>> @@ -10,7 +10,7 @@
>>
>>  extra-y= start.o
>>  obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o
>> -obj-y  += interrupts.o cpu.o cpu_x86.o call64.o
>> +obj-y  += interrupts.o cpu.o cpu_x86.o call64.o setjmp.o
>>
>>  AFLAGS_REMOVE_call32.o := -mregparm=3 \
>> $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32)
>> diff --git a/arch/x86/cpu/setjmp.S b/arch/x86/cpu/setjmp.S
>> new file mode 100644
>> index 000..24e7d8a
>> --- /dev/null
>> +++ b/arch/x86/cpu/setjmp.S
>> @@ -0,0 +1,71 @@
>> +/*
>> + * Written by H. Peter Anvin 
>> + * Brought in from Linux v4.4 and modified for U-Boot
>> + * From Linux arch/um/sys-i386/setjmp.S
>> + *
>> + * SPDX-License-Identifier:GPL-2.0
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#define _REGPARM
>> +
>> +/*
>> + * The jmp_buf is assumed to contain the following, in order:
>> + * %ebx
>> + * %esp
>> + * %ebp
>> + * %esi
>> + * %edi
>> + * 
>> + */
>> +
>> +   /*
>> +* rdi - 32-bit code segment selector
>> +* rsi - target address
>> +* rdx - table address (0 if none)
>> +*/
>
> The comment above looks irrelevant.

OK, will drop.

>
>> +   .text
>> +   .align 4
>> +   .globl setjmp
>> +   .type setjmp, @function
>> +setjmp:
>> +#ifdef _REGPARM
>> +   movl %eax,%edx
>
> nits: needs space after ",". please fix this globally in this file.
>
>> +#else
>> +   movl 4(%esp),%edx
>> +#endif
>> +   popl %ecx   # Return address, and adjust the 
>> stack
>
> I believe # is deprecated. We should use /* */

OK

>
>> +   xorl %eax,%eax  # Return value
>> +   movl %ebx,(%edx)
>> +   movl %esp,4(%edx)   # Post-return %esp!
>> +   pushl %ecx  # Make the call/return stack happy
>> +   movl %ebp,8(%edx)
>> +   movl %esi,12(%edx)
>> +   movl %edi,16(%edx)
>> +   movl %ecx,20(%edx)  # Return address
>> +   ret
>> +
>> +   .size setjmp,.-setjmp
>
> What is this .size for?

Size of the function code. It helps with nm --size-sort I think.

>
>> +
>> +   .text
>
> nits: not necessary
>
>> +   .align 4
>> +   .globl longjmp
>> +   .type longjmp, @function
>> +longjmp:
>> +#ifdef _REGPARM
>> +   xchgl %eax,%edx
>> +#else
>> +   movl 4(%esp),%edx   # jmp_ptr address
>> +   movl 8(%esp),%eax   # Return value
>> +#endif
>> +   movl (%edx),%ebx
>> +   movl 4(%edx),%esp
>> +   movl 8(%edx),%ebp
>> +   movl 12(%edx),%esi
>> +   movl 16(%edx),%edi
>> +   jmp *20(%edx)
>> +
>> +   .size longjmp,.-longjmp
>> diff --git a/arch/x86/include/asm/setjmp.h b/arch/x86/include/asm/setjmp.h
>> new file mode 100644
>> index 000..deef67e
>> --- /dev/null
>> +++ b/arch/x86/include/asm/setjmp.h
>> @@ -0,0 +1,24 @@
>> +/*
>> + * Written by H. Peter Anvin 
>> + * Brought in from Linux v4.4 and modified for U-Boot
>> + * From Linux arch/um/sys-i386/setjmp.S
>> + *
>> + * SPDX-License-Identifier:GPL-2.0
>> + */
>> +
>> +#ifndef __setjmp_h
>> +#define __setjmp_h
>> +
>> +struct jmp_buf_data {
>> +   unsigned int __ebx;
>> +   unsigned int __esp;
>> +   unsigned int __ebp;
>> +   unsigned int __esi;
>> +   unsigned int __edi;
>> +   unsigned int __eip;
>> +};
>> +
>> +int setjmp(struct jmp_buf_data *jmp_buf);
>> +void longjmp(struct jmp_buf_data *jmp_buf);
>
> shouldn't it be void longjmp(struct jmp_buf_data *jmp_buf, int val)? I
> am wondering how EFI loader could work with this longjmp()?

efi_exit() seems to not need the extra parameter.

>
>> +
>> +#endif
>> --
>
> Regards,
> Bin

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


Re: [U-Boot] [PATCH 3/6] arm: efi: Add a hello world test program

2016-08-09 Thread Simon Glass
Hi Bin,

On 9 August 2016 at 00:50, Bin Meng  wrote:
> Hi Simon,
>
> On Sun, Aug 7, 2016 at 7:23 AM, Simon Glass  wrote:
>> It is useful to have a basic sanity check for EFI loader support. Add a
>> 'bootefi hello' command which loads HelloWord.efi and runs it under U-Boot.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  arch/arm/lib/HelloWorld32.efi  | Bin 0 -> 11712 bytes
>>  arch/arm/lib/Makefile  |   6 ++
>>  cmd/Kconfig|  10 ++
>>  cmd/bootefi.c  |  26 --
>>  include/asm-generic/sections.h |   2 ++
>>  scripts/Makefile.lib   |  19 +++
>>  6 files changed, 57 insertions(+), 6 deletions(-)
>>  create mode 100644 arch/arm/lib/HelloWorld32.efi
>>
>
> [snip]
>
>> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
>> index a8d1557..0f3ea0c 100644
>> --- a/arch/arm/lib/Makefile
>> +++ b/arch/arm/lib/Makefile
>> @@ -29,6 +29,12 @@ obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
>>  obj-$(CONFIG_CMD_BOOTM) += bootm.o
>>  obj-$(CONFIG_CMD_BOOTM) += zimage.o
>>  obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
>> +ifdef CONFIG_ARM64
>> +# This option does not work for arm64, as there is no binary.
>
> If so, can we just remove this for arm64?

Actually I was hoping that Alexander might have a suitable arm64
HelloWorld.efi lying around. When I tried building UEFI for arm64, for
some reason it did not create it.

>
>> +obj-$(CONFIG_CMD_BOOTEFI_HELLO) += HelloWorld64.o
>> +else
>> +obj-$(CONFIG_CMD_BOOTEFI_HELLO) += HelloWorld32.o
>> +endif
>>  obj-$(CONFIG_USE_ARCH_MEMSET) += memset.o
>>  obj-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
>>  else

[...]

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


Re: [U-Boot] [PATCH v1 1/4] usb: host: ehci-vf: Migrate Vybrid USB to driver model

2016-08-09 Thread maitysanchayan
Hello Lukasz,

On 16-08-09 15:20:58, Lukasz Majewski wrote:
> Hi maitysancha...@gmail.com,
> 
> > Hello,
> > 
> > Adding Lukasz's second mail ID to cc
> > 
> > On 16-08-08 11:45:35, maitysancha...@gmail.com wrote:
> > > Hello,
> > > 
> > > On 16-08-03 17:13:11, Marek Vasut wrote:
> > > > On 08/03/2016 01:58 PM, Sanchayan Maity wrote:
> > > > > Add driver model support for Vybrid USB driver.
> > > > > 
> > > > > Signed-off-by: Sanchayan Maity 
> > > > 
> > > > CCing Lukasz.
> > > > 
> > > > > ---
> > > > > Hello,
> > > > > 
> > > > > I am trying to migrate the Vybrid USB driver to driver model.
> > > > > Patches are based on top of uboot master branch. With this
> > > > > implementation, host works perfectly fine on both USB ports
> > > > > but I have problems using it in client mode.
> > > > > 
> > > > > I tried DFU to test client mode and I get the following
> > > > > 
> > > > > Colibri VFxx # version
> > > > > 
> > > > > U-Boot 2016.09-rc1-00235-g4e8c122 (Aug 03 2016 - 17:07:48 +0530)
> > > > > arm-linux-gnueabihf-gcc (Linaro GCC 5.2-2015.11-2) 5.2.1
> > > > > 20151005 GNU ld (GNU Binutils) 2.25.0 Linaro 2015_10
> > > > > Colibri VFxx # dfu 0 nand 4
> > > > > using id 'nand0,0'
> > > > > using id 'nand0,1'
> > > > > using id 'nand0,3'
> > > > > g_dnl_register: failed!, error: -19
> > > > > data abort
> > > > > pc : [<8ff80f18>]  lr : [<8ff612a9>]
> > > > > reloc pc : [<3f431f18>]lr : [<3f4122a9>]
> > > > > sp : 8fd15000  ip :  fp : 2710
> > > > > r10: 8ffb50cc  r9 : 8fd16ee8 r8 : 8ffbc574
> > > > > r7 :   r6 :  r5 :   r4 : 
> > > > > r3 : f4b9  r2 : 8000 r1 : 0001  r0 : 
> > > > > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > > > > Resetting CPU ...
> > > > > 
> > > > > resetting ...
> 
> Patch for fixing this has been already posted by you. Thanks :-)

Happy to contribute :)

> 
> > > 
> > > FWIW here is output with DEBUG enabled in uclass.c
> > > 
> > > when testing with DFU:
> > > 
> > > uclass_find_device_by_seq: 1 0
> > >- -1 -1
> > >- -1 -1
> > >- not found
> > > g_dnl_register: failed!, error: -19
> > > data abort
> > > pc : [<8ff80fb0>]  lr : [<8ff612a9>]
> > > reloc pc : [<3f431fb0>]lr : [<3f4122a9>]
> > > sp : 8fd15000  ip :  fp : 2710
> > > r10: 8ffb5274  r9 : 8fd16ee8 r8 : 8ffbc714
> > > r7 :   r6 :  r5 :   r4 : 
> > > r3 : f4b9  r2 : 8000 r1 : 0001  r0 : 
> > > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > > Resetting CPU ...
> > > 
> > > resetting ...
> > > 
> > > When testing host mode with usb start
> > > 
> > > Colibri VFxx # usb start
> > > starting USB...
> > > USB0:   uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 -1
> > >- -1 -1
> > >- not found
> > > USB EHCI 1.00
> > > USB1:   uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 0
> > >- found
> > > uclass_find_device_by_seq: 0 1
> > >- -1 0
> > >- -1 1
> > >- found
> > > uclass_find_device_by_seq: 0 2
> > >- -1 0
> > >- -1 1
> > >- -1 -1
> > >- not found
> > > uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 0
> > >- found
> > > uclass_find_device_by_seq: 0 1
> > >- -1 0
> > >- -1 -1
> > >- not found
> > > USB EHCI 1.00
> > > scanning bus 0 for devices... uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 -1
> > >- not found
> > > uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 -1
> > >- not found
> > > 2 USB Device(s) found
> > > scanning bus 1 for devices... uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 0
> > >- found
> > > uclass_find_device_by_seq: 0 1
> > >- -1 0
> > >- -1 -1
> > >- not found
> > > uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 0
> > >- found
> > > uclass_find_device_by_seq: 0 1
> > >- -1 0
> > >- -1 1
> > >- found
> > > uclass_find_device_by_seq: 0 2
> > >- -1 0
> > >- -1 1
> > >- -1 -1
> > >- not found
> > > 2 USB Device(s) found
> > > 
> > > Regards,
> > > Sanchayan.
> > > 
> > > > > 
> > > > > It seems to return ENODEV from usb_setup_ehci_gadget after
> > > > > calling uclass_find_device_by_seq. I am not sure what I am
> > > > > missing in the current implementation. Can someone point me in
> > > > > the correct direction? Since host works on both ports I would
> > > > > assume the device tree nodes are correct.
> 
> Please do not mix host and device controllers. Those are two disjoint
> drivers.

True. The idea is to have OTG functionality or at least client
functionality like DFU or UMS working when dr_mode is specified
as otg or peripheral from device tree.

> 
> What I can see, is that usb_gadget_register_driver() calls
> 

Re: [U-Boot] [PATCH] rockchip: rk3399: update MAINTAINER file

2016-08-09 Thread Andreas Färber
Am 09.08.2016 um 16:35 schrieb Simon Glass:
> +Andreas
> 
> On 9 August 2016 at 01:29, Kever Yang  wrote:
>> This patch add maintainer information for rk3399 evb.
>>
>> Signed-off-by: Kever Yang 
>> ---
>>
>>  board/rockchip/evb_rk3399/MAINTAINERS | 6 ++
>>  1 file changed, 6 insertions(+)
> 
> Acked-by: Simon Glass 

Thanks,

Reviewed-by: Andreas Färber 

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v1 1/4] usb: host: ehci-vf: Migrate Vybrid USB to driver model

2016-08-09 Thread maitysanchayan
Hello Lukasz,

On 16-08-09 15:25:50, Lukasz Majewski wrote:
> Hi maitysancha...@gmail.com,
> 
> > Hello,
> > 
> > On 16-08-08 18:56:21, maitysancha...@gmail.com wrote:
> > > Hello,
> > > 
> > > Adding Lukasz's second mail ID to cc
> > > 
> > > On 16-08-08 11:45:35, maitysancha...@gmail.com wrote:
> > > > Hello,
> > > > 
> > > > On 16-08-03 17:13:11, Marek Vasut wrote:
> > > > > On 08/03/2016 01:58 PM, Sanchayan Maity wrote:
> > > > > > Add driver model support for Vybrid USB driver.
> > > > > > 
> > > > > > Signed-off-by: Sanchayan Maity 
> > > > > 
> > > > > CCing Lukasz.
> > > > > 
> > > > > > ---
> > > > > > Hello,
> > > > > > 
> > > > > > I am trying to migrate the Vybrid USB driver to driver model.
> > > > > > Patches are based on top of uboot master branch. With this
> > > > > > implementation, host works perfectly fine on both USB ports
> > > > > > but I have problems using it in client mode.
> > > > > > 
> > > > > > I tried DFU to test client mode and I get the following
> > > > > > 
> > > > > > Colibri VFxx # version
> > > > > > 
> > > > > > U-Boot 2016.09-rc1-00235-g4e8c122 (Aug 03 2016 - 17:07:48
> > > > > > +0530) arm-linux-gnueabihf-gcc (Linaro GCC 5.2-2015.11-2)
> > > > > > 5.2.1 20151005 GNU ld (GNU Binutils) 2.25.0 Linaro 2015_10
> > > > > > Colibri VFxx # dfu 0 nand 4
> > > > > > using id 'nand0,0'
> > > > > > using id 'nand0,1'
> > > > > > using id 'nand0,3'
> > > > > > g_dnl_register: failed!, error: -19
> > > > > > data abort
> > > > > > pc : [<8ff80f18>]  lr : [<8ff612a9>]
> > > > > > reloc pc : [<3f431f18>]lr : [<3f4122a9>]
> > > > > > sp : 8fd15000  ip :  fp : 2710
> > > > > > r10: 8ffb50cc  r9 : 8fd16ee8 r8 : 8ffbc574
> > > > > > r7 :   r6 :  r5 :   r4 : 
> > > > > > r3 : f4b9  r2 : 8000 r1 : 0001  r0 : 
> > > > > > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > > > > > Resetting CPU ...
> > > > > > 
> > > > > > resetting ...
> > > > 
> > > > FWIW here is output with DEBUG enabled in uclass.c
> > > > 
> > > > when testing with DFU:
> > > > 
> > > > uclass_find_device_by_seq: 1 0
> > > >- -1 -1
> > > >- -1 -1
> > > >- not found
> > > > g_dnl_register: failed!, error: -19
> > > > data abort
> > > > pc : [<8ff80fb0>]  lr : [<8ff612a9>]
> > > > reloc pc : [<3f431fb0>]lr : [<3f4122a9>]
> > > > sp : 8fd15000  ip :  fp : 2710
> > > > r10: 8ffb5274  r9 : 8fd16ee8 r8 : 8ffbc714
> > > > r7 :   r6 :  r5 :   r4 : 
> > > > r3 : f4b9  r2 : 8000 r1 : 0001  r0 : 
> > > > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > > > Resetting CPU ...
> > > > 
> > > > resetting ...
> > > > 
> > > > When testing host mode with usb start
> > > > 
> > > > Colibri VFxx # usb start
> > > > starting USB...
> > > > USB0:   uclass_find_device_by_seq: 0 -1
> > > > uclass_find_device_by_seq: 0 0
> > > >- -1 -1
> > > >- -1 -1
> > > >- not found
> > > > USB EHCI 1.00
> > > > USB1:   uclass_find_device_by_seq: 0 -1
> > > > uclass_find_device_by_seq: 0 0
> > > >- -1 0
> > > >- found
> > > > uclass_find_device_by_seq: 0 1
> > > >- -1 0
> > > >- -1 1
> > > >- found
> > > > uclass_find_device_by_seq: 0 2
> > > >- -1 0
> > > >- -1 1
> > > >- -1 -1
> > > >- not found
> > > > uclass_find_device_by_seq: 0 -1
> > > > uclass_find_device_by_seq: 0 0
> > > >- -1 0
> > > >- found
> > > > uclass_find_device_by_seq: 0 1
> > > >- -1 0
> > > >- -1 -1
> > > >- not found
> > > > USB EHCI 1.00
> > > > scanning bus 0 for devices... uclass_find_device_by_seq: 0 -1
> > > > uclass_find_device_by_seq: 0 0
> > > >- -1 -1
> > > >- not found
> > > > uclass_find_device_by_seq: 0 -1
> > > > uclass_find_device_by_seq: 0 0
> > > >- -1 -1
> > > >- not found
> > > > 2 USB Device(s) found
> > > > scanning bus 1 for devices... uclass_find_device_by_seq: 0 -1
> > > > uclass_find_device_by_seq: 0 0
> > > >- -1 0
> > > >- found
> > > > uclass_find_device_by_seq: 0 1
> > > >- -1 0
> > > >- -1 -1
> > > >- not found
> > > > uclass_find_device_by_seq: 0 -1
> > > > uclass_find_device_by_seq: 0 0
> > > >- -1 0
> > > >- found
> > > > uclass_find_device_by_seq: 0 1
> > > >- -1 0
> > > >- -1 1
> > > >- found
> > > > uclass_find_device_by_seq: 0 2
> > > >- -1 0
> > > >- -1 1
> > > >- -1 -1
> > > >- not found
> > > > 2 USB Device(s) found
> > > > 
> > > > Regards,
> > > > Sanchayan.
> > > > 
> > > > > > 
> > > > > > It seems to return ENODEV from usb_setup_ehci_gadget after
> > > > > > calling uclass_find_device_by_seq. I am not sure what I am
> > > > > > missing in the current implementation. Can someone point me
> > > > > > in the correct direction? Since host works on both ports I
> > > > > > would assume the device tree nodes are correct.
> > > > > > 
> > > > > > Tried to look in documentation and 

Re: [U-Boot] [PATCH] rockchip: rk3399: update MAINTAINER file

2016-08-09 Thread Simon Glass
+Andreas

On 9 August 2016 at 01:29, Kever Yang  wrote:
> This patch add maintainer information for rk3399 evb.
>
> Signed-off-by: Kever Yang 
> ---
>
>  board/rockchip/evb_rk3399/MAINTAINERS | 6 ++
>  1 file changed, 6 insertions(+)

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


Re: [U-Boot] [PATCH v2 3/3] CONFIG_EFI_LOADER breaks rock2 kernel loading

2016-08-09 Thread Simon Glass
Hi Sandy,

On 8 August 2016 at 19:35, Sandy Patterson  wrote:
> I also found that once the barrier stuff was in, the EFI_LOADER change was
> unnecessary.
>
> On Mon, Aug 8, 2016 at 8:50 PM, Ziyuan Xu  wrote:
>>
>> Hi Simon,
>>
>> I think you can drop this patch due to it fixes by a78cd86 - ARM: Rework
>> and correct barrier which Tom had merge it into u-boot/master.

That's great, thanks for letting me know.

BTW for the mailing list can you please avoid top-posting?

Regards,
Simon

>>
>>
>> On 2016年08月09日 05:43, Simon Glass wrote:
>>>
>>> Hi Sandy,
>>>
>>> On 22 July 2016 at 08:40, Sandy Patterson 
>>> wrote:

 The problem seems to be invalidate_icache_all() inside the runtime.
 This patch just disables EFI_LOADER for rock2 board.

 Signed-off-by: Sandy Patterson 
 ---

   configs/rock2_defconfig | 1 +
   1 file changed, 1 insertion(+)
>>>
>>> Can you please give me an update on these patches? Did you discover
>>> the root cause? What patches do you think need to be applied for this
>>> release. I'd like to get a few more test reports too if possible.
>>>
>>> Regards,
>>> Simon
>>>
>>>
>>>
>>
>>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/7] efi_loader: Expose SMBIOS table

2016-08-09 Thread Simon Glass
Hi Alexander,

On 9 August 2016 at 08:11, Alexander Graf  wrote:
>
> On 08/09/2016 03:57 PM, Simon Glass wrote:
>>
>> Hi Alexander,
>>
>> On 9 August 2016 at 00:48, Alexander Graf  wrote:
>>>
>>>
 Am 08.08.2016 um 23:44 schrieb Simon Glass :

 Hi Alexander,

> On 8 August 2016 at 08:06, Alexander Graf  wrote:
> We generate a few tables on x86 today that really can be used on ARM just
> the same. One such example is the SMBIOS table, which people use with 
> tools
> like "dmidecode" to identify which hardware they are running on.
>
> We're slowly growing needs to collect serial numbers from various devices
> on ARM and SMBIOS seems the natural choice. So this patch set moves the
> current SMBIOS generation into generic code and adds serial number 
> exposure
> to it.

 Shouldn't we use device tree? Why would an ARM device use SMBIOS?
>>>
>>> Mostly because SBBR dictates it and every ARM server platform out there 
>>> provides SMBIOS tables ;).
>>>
>>> Also, both describe very different things. At least I have never seen 
>>> things like "The chassy of this server has 2 power connectors and is blue" 
>>> in device tree.
>>
>> So there is no DT binding for this information? Does this mean that
>> U-Boot on ARM needs to pass information through just 'sitting in RAM
>> somewhere' like x86?
>
>
> I don't think there's a non-EFI way on ARM to pass this through at all, 
> correct. That's nothing new though - things like KASLR also depend on EFI.

That feels like it could just be done in U-Boot. The proliferation of
bootloader stuff in Linux bugs me. It's the lowest-common-denominator
problem. To me it seems that UEFI and U-Boot should implement these
features, and then Linux doesn't need to.

Anyway I do understand where you are going. Is it possible to provide
EFI tables to Linux but not EFI boot/run-time services?

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


Re: [U-Boot] [PATCH 0/7] efi_loader: Expose SMBIOS table

2016-08-09 Thread Alexander Graf

On 08/09/2016 03:57 PM, Simon Glass wrote:

Hi Alexander,

On 9 August 2016 at 00:48, Alexander Graf  wrote:



Am 08.08.2016 um 23:44 schrieb Simon Glass :

Hi Alexander,


On 8 August 2016 at 08:06, Alexander Graf  wrote:
We generate a few tables on x86 today that really can be used on ARM just
the same. One such example is the SMBIOS table, which people use with tools
like "dmidecode" to identify which hardware they are running on.

We're slowly growing needs to collect serial numbers from various devices
on ARM and SMBIOS seems the natural choice. So this patch set moves the
current SMBIOS generation into generic code and adds serial number exposure
to it.

Shouldn't we use device tree? Why would an ARM device use SMBIOS?

Mostly because SBBR dictates it and every ARM server platform out there 
provides SMBIOS tables ;).

Also, both describe very different things. At least I have never seen things like 
"The chassy of this server has 2 power connectors and is blue" in device tree.

So there is no DT binding for this information? Does this mean that
U-Boot on ARM needs to pass information through just 'sitting in RAM
somewhere' like x86?


I don't think there's a non-EFI way on ARM to pass this through at all, 
correct. That's nothing new though - things like KASLR also depend on EFI.



Alex

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


Re: [U-Boot] [PATCH 0/7] efi_loader: Expose SMBIOS table

2016-08-09 Thread Simon Glass
Hi Alexander,

On 9 August 2016 at 00:48, Alexander Graf  wrote:
>
>
>> Am 08.08.2016 um 23:44 schrieb Simon Glass :
>>
>> Hi Alexander,
>>
>>> On 8 August 2016 at 08:06, Alexander Graf  wrote:
>>> We generate a few tables on x86 today that really can be used on ARM just
>>> the same. One such example is the SMBIOS table, which people use with tools
>>> like "dmidecode" to identify which hardware they are running on.
>>>
>>> We're slowly growing needs to collect serial numbers from various devices
>>> on ARM and SMBIOS seems the natural choice. So this patch set moves the
>>> current SMBIOS generation into generic code and adds serial number exposure
>>> to it.
>>
>> Shouldn't we use device tree? Why would an ARM device use SMBIOS?
>
> Mostly because SBBR dictates it and every ARM server platform out there 
> provides SMBIOS tables ;).
>
> Also, both describe very different things. At least I have never seen things 
> like "The chassy of this server has 2 power connectors and is blue" in device 
> tree.

So there is no DT binding for this information? Does this mean that
U-Boot on ARM needs to pass information through just 'sitting in RAM
somewhere' like x86?

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


Re: [U-Boot] [PATCH][v2] board: ls1012afrdm: overwrite CONFIG_EXTRA_ENV_SETTINGS

2016-08-09 Thread Pratiyush Srivastava


> -Original Message-
> From: Pratiyush Srivastava
> Sent: Tuesday, August 09, 2016 11:45 AM
> To: york sun ; u-boot@lists.denx.de
> Cc: Prabhakar Kushwaha 
> Subject: RE: [PATCH][v2] board: ls1012afrdm: overwrite
> CONFIG_EXTRA_ENV_SETTINGS
> 
> 
> 
> > -Original Message-
> > From: york sun
> > Sent: Friday, August 05, 2016 10:54 PM
> > To: Pratiyush Srivastava ; u-
> > b...@lists.denx.de
> > Cc: Prabhakar Kushwaha 
> > Subject: Re: [PATCH][v2] board: ls1012afrdm: overwrite
> > CONFIG_EXTRA_ENV_SETTINGS
> >
> > On 08/05/2016 02:47 AM, Pratiyush Mohan Srivastava wrote:
> > > From: Prabhakar Kushwaha 
> > >
> > > LS1012AFRDM has 512MB of DDR.
> > > So update Kernel load address as 0x9600 instead of default
> > > 0xa000.
> > >
> > > Signed-off-by: Prabhakar Kushwaha 
> > > Signed-off-by: Pratiyush Mohan Srivastava
> > > 
> > > ---
> > > Changes for v2: Incorporated York's comments
> > >   - Removed ramdisk_addr, ramdisk_size
> > >   - Updated UART baud-rate.
> > >
> > > include/configs/ls1012afrdm.h | 14 ++
> > >  1 file changed, 14 insertions(+)
> > >
> > > diff --git a/include/configs/ls1012afrdm.h
> > > b/include/configs/ls1012afrdm.h index ad81142..f2c6ca8 100644
> > > --- a/include/configs/ls1012afrdm.h
> > > +++ b/include/configs/ls1012afrdm.h
> > > @@ -39,4 +39,18 @@
> > >  #define CONFIG_SYS_MEMTEST_START 0x8000
> > >  #define CONFIG_SYS_MEMTEST_END   0x9fff
> > >
> > > +#undef CONFIG_EXTRA_ENV_SETTINGS
> > > +#define CONFIG_EXTRA_ENV_SETTINGS\
> > > + "initrd_high=0x\0"  \
> >
> > What is this?
> [Pratiyush>] I used the LS1043 dts as the base for this dts. Since ls10143 had
> this parameter, I copied the same for LS1012.
[Pratiyush>] I used the LS10143a_common file as a base for this dts. Since 
ls10143 had
> this parameter, I copied the same for LS1012.
Please ignore the previous comment .
> >
> > > + "verify=no\0"   \
> > > + "hwconfig=fsl_ddr:bank_intlv=auto\0"\
> > > + "loadaddr=0x8010\0" \
> > > + "kernel_addr=0x10\0"\
> > > + "fdt_high=0x\0" \
> > > + "initrd_high=0x\0"  \
> > > + "kernel_start=0xa0\0"   \
> > > + "kernel_load=0x9600\0"  \
> > > + "kernel_size=0x280\0"   \
> > > + "console=ttyAMA0,115200n8\0"
> >
> > Do you really use ttyAMA0? Isn't it ttyS0?
> [Pratiyush>] I will remove the redundant console command.
> >
> > York

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


Re: [U-Boot] Pull request: u-boot-spi/master

2016-08-09 Thread Tom Rini
On Tue, Aug 09, 2016 at 05:33:59PM +0530, Jagan Teki wrote:

> Hi Tom,
> 
> Please pull this request.
> 
> thanks!
> Jagan.
> 
> The following changes since commit 08887ed4505ec14ee94ab32c482dc4dec5ddc1e4:
> 
>   ARM: am57xx_evm: Enable QSPI support (2016-07-30 00:15:07 +0530)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-spi.git master
> 
> for you to fetch changes up to 53208741d6c3448b7a7f5260d52c28f912ff6453:
> 
>   dm: at91: Add driver model support for the spi driver (2016-07-31 17:03:33 
> +0530)
> 

NAK.  The atmel DM prep stuff needs to be taken in, all at once perhaps,
by Andreas all at once to avoid warnings like:
+   sama5d4_xplained_spiflash
+(sama5d4_xplained_spiflash)  static int clk_get_by_name(struct udevice *dev, 
const char *name,
+(sama5d4_xplained_spiflash) ^
w+(sama5d4_xplained_spiflash) In file included from drivers/spi/atmel_spi.c:7:0:
w+(sama5d4_xplained_spiflash) include/clk.h:107:12: warning: 'clk_get_by_name' 
defined but not used [-Wunused-function]
that Marek also hit with the USB patch.

-- 
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] [v2] mmc: send CMD0 before CMD1 for some MMC cards

2016-08-09 Thread Yangbo Lu
Hi Jaehoon,

Sure. And appreciate your good help :)


Best regards,
Yangbo Lu

> -Original Message-
> From: Jaehoon Chung [mailto:jh80.ch...@samsung.com]
> Sent: Tuesday, August 09, 2016 7:06 AM
> To: Yangbo Lu; u-boot@lists.denx.de
> Subject: Re: [v2] mmc: send CMD0 before CMD1 for some MMC cards
> 
> Hi Yangbo,
> 
> On 08/02/2016 04:33 PM, Yangbo Lu wrote:
> > When the MMC framework was added in u-boot, the mmc_go_idle was added
> > before mmc_send_op_cond_iter in function mmc_send_op_cond annotating
> > that some cards seemed to need this. Actually, we still need to do
> > this in function mmc_complete_op_cond for those cards.
> > This has been verified on Micron MTFC4GACAECN eMMC chip.
> 
> This patch is not bad.. but i need to verify more about entire sequence.
> Could you wait a bit?
> 
> Best Regards,
> Jaehoon Chung
> 
> >
> > Signed-off-by: Yangbo Lu 
> > ---
> >  drivers/mmc/mmc.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index
> > f8e5f7a..d4e96bc 100644
> > --- a/drivers/mmc/mmc.c
> > +++ b/drivers/mmc/mmc.c
> > @@ -422,6 +422,9 @@ static int mmc_complete_op_cond(struct mmc *mmc)
> >
> > mmc->op_cond_pending = 0;
> > if (!(mmc->ocr & OCR_BUSY)) {
> > +   /* Some cards seem to need this */
> > +   mmc_go_idle(mmc);
> > +
> > start = get_timer(0);
> > while (1) {
> > err = mmc_send_op_cond_iter(mmc, 1);
> >

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


Re: [U-Boot] [PATCH] armv8: ls1012a: Updating CONFIG_EXTRA_ENV_SETTINGS

2016-08-09 Thread Pratiyush Srivastava


> -Original Message-
> From: york sun
> Sent: Friday, August 05, 2016 9:47 PM
> To: Pratiyush Srivastava ; u-
> b...@lists.denx.de
> Cc: Prabhakar Kushwaha 
> Subject: Re: [PATCH] armv8: ls1012a: Updating
> CONFIG_EXTRA_ENV_SETTINGS
> 
> On 08/05/2016 02:47 AM, Pratiyush Mohan Srivastava wrote:
> > Remove ramdisk_addr, ramdisk_size and update UART baud-rate.
> >
> > Signed-off-by: Prabhakar Kushwaha 
> > Signed-off-by: Pratiyush Mohan Srivastava
> 
> > ---
> >  include/configs/ls1012a_common.h | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/include/configs/ls1012a_common.h
> b/include/configs/ls1012a_common.h
> > index fba2fac..78f4f9b 100644
> > --- a/include/configs/ls1012a_common.h
> > +++ b/include/configs/ls1012a_common.h
> > @@ -111,14 +111,12 @@
> > "hwconfig=fsl_ddr:bank_intlv=auto\0"\
> > "loadaddr=0x8010\0" \
> > "kernel_addr=0x10\0"\
> > -   "ramdisk_addr=0x80\0"   \
> > -   "ramdisk_size=0x200\0"  \
> > "fdt_high=0x\0" \
> > "initrd_high=0x\0"  \
> > "kernel_start=0xa0\0"   \
> > "kernel_load=0xa000\0"  \
> > "kernel_size=0x280\0"   \
> > -   "console=ttyAMA0,38400n8\0"
> > +   "console=ttyAMA0,115200n8\0"
> 
> Is console variable correct here?
[Pratiyush>] I will remove it ...
> 
> >
> >  #define CONFIG_BOOTARGS"console=ttyS0,115200
> root=/dev/ram0 " \
> 
> console is different here.
> 
> 
> > "earlycon=uart8250,mmio,0x21c0500"
> >
> 
> York

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


Re: [U-Boot] [PATCH] net: asix: Fix ASIX 88772B with driver model

2016-08-09 Thread Marcel Ziswiler
On Thu, 2016-08-04 at 11:12 +0200, Marek Vasut wrote:
> On 08/04/2016 11:07 AM, Alban Bedel wrote:
> > 
> > On Wed, 3 Aug 2016 15:23:30 +
> > Marcel Ziswiler  wrote:
> > 
> > > 
> > > On Wed, 2016-08-03 at 15:51 +0200, Marek Vasut wrote:
> > > > 
> > > > On 08/03/2016 11:46 AM, Alban Bedel wrote:
> > > > > 
> > > > > 
> > > > > On Wed, 3 Aug 2016 09:00:42 +0200
> > > > > Marek Vasut  wrote:
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > On 08/03/2016 07:32 AM, Alban Bedel wrote:
> > > > > > > 
> > > > > > > 
> > > > > > > Commit 147271209a9d ("net: asix: fix operation without
> > > > > > > eeprom")
> > > > > > > added a special handling for ASIX 88772B that enable
> > > > > > > another
> > > > > > > type of header. This break the driver in DM mode as the
> > > > > > > extra
> > > > > > > handling
> > > > > > > needed in the receive path is missing.
> > > > > > So add the extra handling ?
> > > > > I can do that too, but I though u-boot preferred to avoid
> > > > > useless
> > > > > code.
> > > > Yes, if it is useless.
> > > > 
> > > > > 
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > However this new header mode is not required and only
> > > > > > > seems to
> > > > > > > increase the code complexity, so this patch revert this
> > > > > > > part of
> > > > > > > commit 147271209a9d.
> > > > > > Why is it not required ?
> > > > > It works fine without, since 2012. In fact this change is not
> > > > > even
> > > > > mentioned in the log of commit 147271209a9d, so I really
> > > > > don't know
> > > > > why
> > > > > it was added in the first place. As can be seen in the revert
> > > > > all
> > > > > it
> > > > > does is adding 2 bytes to the USB packets that are then just
> > > > > skipped.
> > > > > Seems pretty useless to me.
> > > > I would like to get some feedback on this from Marcel, since he
> > > > added
> > > > this stuff.
> > > Yes, sorry. I just came back from vacation and started looking
> > > into it
> > > now. As far as I remember on our hardware without this Ethernet
> > > did not
> > > quite work reliably. This also means that with driver model so
> > > far it
> > > does not work for us which I fed back to Simon once but so far
> > > this has
> > > not been resolved. That fix came from some early U-Boot work done
> > > by
> > > Antmicro way back and I am missing some of the history.
> > Then I'll do a new patch that just fix the driver model receive
> > path.
> Hold on. Marcel, can you maybe test if removing this code has any
> impact
> on the behavior now ?

Sorry for the delay. I tested Alban's patch now both on Toradex Colibri
T20 as well as T30 and its on-module ASIX USB-to-Ethernet chip actually
works perfectly aside from the occasional EHCI timed out on TD -
token=0x88008d80 Rx: failed to receive: -5 message which last I checked
with Simon is still unresolved but was already there long before any of
the driver model work started.

Tested-by: Marcel Ziswiler 
Tested-on: Colibri T20/T30 on Colibri Evaluation Board
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v1 1/4] usb: host: ehci-vf: Migrate Vybrid USB to driver model

2016-08-09 Thread Lukasz Majewski
Hi maitysancha...@gmail.com,

> Hello,
> 
> On 16-08-08 18:56:21, maitysancha...@gmail.com wrote:
> > Hello,
> > 
> > Adding Lukasz's second mail ID to cc
> > 
> > On 16-08-08 11:45:35, maitysancha...@gmail.com wrote:
> > > Hello,
> > > 
> > > On 16-08-03 17:13:11, Marek Vasut wrote:
> > > > On 08/03/2016 01:58 PM, Sanchayan Maity wrote:
> > > > > Add driver model support for Vybrid USB driver.
> > > > > 
> > > > > Signed-off-by: Sanchayan Maity 
> > > > 
> > > > CCing Lukasz.
> > > > 
> > > > > ---
> > > > > Hello,
> > > > > 
> > > > > I am trying to migrate the Vybrid USB driver to driver model.
> > > > > Patches are based on top of uboot master branch. With this
> > > > > implementation, host works perfectly fine on both USB ports
> > > > > but I have problems using it in client mode.
> > > > > 
> > > > > I tried DFU to test client mode and I get the following
> > > > > 
> > > > > Colibri VFxx # version
> > > > > 
> > > > > U-Boot 2016.09-rc1-00235-g4e8c122 (Aug 03 2016 - 17:07:48
> > > > > +0530) arm-linux-gnueabihf-gcc (Linaro GCC 5.2-2015.11-2)
> > > > > 5.2.1 20151005 GNU ld (GNU Binutils) 2.25.0 Linaro 2015_10
> > > > > Colibri VFxx # dfu 0 nand 4
> > > > > using id 'nand0,0'
> > > > > using id 'nand0,1'
> > > > > using id 'nand0,3'
> > > > > g_dnl_register: failed!, error: -19
> > > > > data abort
> > > > > pc : [<8ff80f18>]  lr : [<8ff612a9>]
> > > > > reloc pc : [<3f431f18>]lr : [<3f4122a9>]
> > > > > sp : 8fd15000  ip :  fp : 2710
> > > > > r10: 8ffb50cc  r9 : 8fd16ee8 r8 : 8ffbc574
> > > > > r7 :   r6 :  r5 :   r4 : 
> > > > > r3 : f4b9  r2 : 8000 r1 : 0001  r0 : 
> > > > > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > > > > Resetting CPU ...
> > > > > 
> > > > > resetting ...
> > > 
> > > FWIW here is output with DEBUG enabled in uclass.c
> > > 
> > > when testing with DFU:
> > > 
> > > uclass_find_device_by_seq: 1 0
> > >- -1 -1
> > >- -1 -1
> > >- not found
> > > g_dnl_register: failed!, error: -19
> > > data abort
> > > pc : [<8ff80fb0>]  lr : [<8ff612a9>]
> > > reloc pc : [<3f431fb0>]lr : [<3f4122a9>]
> > > sp : 8fd15000  ip :  fp : 2710
> > > r10: 8ffb5274  r9 : 8fd16ee8 r8 : 8ffbc714
> > > r7 :   r6 :  r5 :   r4 : 
> > > r3 : f4b9  r2 : 8000 r1 : 0001  r0 : 
> > > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > > Resetting CPU ...
> > > 
> > > resetting ...
> > > 
> > > When testing host mode with usb start
> > > 
> > > Colibri VFxx # usb start
> > > starting USB...
> > > USB0:   uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 -1
> > >- -1 -1
> > >- not found
> > > USB EHCI 1.00
> > > USB1:   uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 0
> > >- found
> > > uclass_find_device_by_seq: 0 1
> > >- -1 0
> > >- -1 1
> > >- found
> > > uclass_find_device_by_seq: 0 2
> > >- -1 0
> > >- -1 1
> > >- -1 -1
> > >- not found
> > > uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 0
> > >- found
> > > uclass_find_device_by_seq: 0 1
> > >- -1 0
> > >- -1 -1
> > >- not found
> > > USB EHCI 1.00
> > > scanning bus 0 for devices... uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 -1
> > >- not found
> > > uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 -1
> > >- not found
> > > 2 USB Device(s) found
> > > scanning bus 1 for devices... uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 0
> > >- found
> > > uclass_find_device_by_seq: 0 1
> > >- -1 0
> > >- -1 -1
> > >- not found
> > > uclass_find_device_by_seq: 0 -1
> > > uclass_find_device_by_seq: 0 0
> > >- -1 0
> > >- found
> > > uclass_find_device_by_seq: 0 1
> > >- -1 0
> > >- -1 1
> > >- found
> > > uclass_find_device_by_seq: 0 2
> > >- -1 0
> > >- -1 1
> > >- -1 -1
> > >- not found
> > > 2 USB Device(s) found
> > > 
> > > Regards,
> > > Sanchayan.
> > > 
> > > > > 
> > > > > It seems to return ENODEV from usb_setup_ehci_gadget after
> > > > > calling uclass_find_device_by_seq. I am not sure what I am
> > > > > missing in the current implementation. Can someone point me
> > > > > in the correct direction? Since host works on both ports I
> > > > > would assume the device tree nodes are correct.
> > > > > 
> > > > > Tried to look in documentation and usb-info.txt mentions that
> > > > > gadget framework does not use driver model. Does this imply I
> > > > > cannot use any usb gadget functionality if I am using USB DM?
> > > > > However the function usb_gadget_register_driver in ci_udc.c
> > > > > does have a CONFIG_DM_USB and calls into
> > > > > usb_setup_ehci_gadget which is in usb-uclass.c.
> > 
> > @Lukasz

Re: [U-Boot] [PATCH v1 1/4] usb: host: ehci-vf: Migrate Vybrid USB to driver model

2016-08-09 Thread Lukasz Majewski
Hi maitysancha...@gmail.com,

> Hello,
> 
> Adding Lukasz's second mail ID to cc
> 
> On 16-08-08 11:45:35, maitysancha...@gmail.com wrote:
> > Hello,
> > 
> > On 16-08-03 17:13:11, Marek Vasut wrote:
> > > On 08/03/2016 01:58 PM, Sanchayan Maity wrote:
> > > > Add driver model support for Vybrid USB driver.
> > > > 
> > > > Signed-off-by: Sanchayan Maity 
> > > 
> > > CCing Lukasz.
> > > 
> > > > ---
> > > > Hello,
> > > > 
> > > > I am trying to migrate the Vybrid USB driver to driver model.
> > > > Patches are based on top of uboot master branch. With this
> > > > implementation, host works perfectly fine on both USB ports
> > > > but I have problems using it in client mode.
> > > > 
> > > > I tried DFU to test client mode and I get the following
> > > > 
> > > > Colibri VFxx # version
> > > > 
> > > > U-Boot 2016.09-rc1-00235-g4e8c122 (Aug 03 2016 - 17:07:48 +0530)
> > > > arm-linux-gnueabihf-gcc (Linaro GCC 5.2-2015.11-2) 5.2.1
> > > > 20151005 GNU ld (GNU Binutils) 2.25.0 Linaro 2015_10
> > > > Colibri VFxx # dfu 0 nand 4
> > > > using id 'nand0,0'
> > > > using id 'nand0,1'
> > > > using id 'nand0,3'
> > > > g_dnl_register: failed!, error: -19
> > > > data abort
> > > > pc : [<8ff80f18>]  lr : [<8ff612a9>]
> > > > reloc pc : [<3f431f18>]lr : [<3f4122a9>]
> > > > sp : 8fd15000  ip :  fp : 2710
> > > > r10: 8ffb50cc  r9 : 8fd16ee8 r8 : 8ffbc574
> > > > r7 :   r6 :  r5 :   r4 : 
> > > > r3 : f4b9  r2 : 8000 r1 : 0001  r0 : 
> > > > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > > > Resetting CPU ...
> > > > 
> > > > resetting ...

Patch for fixing this has been already posted by you. Thanks :-)

> > 
> > FWIW here is output with DEBUG enabled in uclass.c
> > 
> > when testing with DFU:
> > 
> > uclass_find_device_by_seq: 1 0
> >- -1 -1
> >- -1 -1
> >- not found
> > g_dnl_register: failed!, error: -19
> > data abort
> > pc : [<8ff80fb0>]  lr : [<8ff612a9>]
> > reloc pc : [<3f431fb0>]lr : [<3f4122a9>]
> > sp : 8fd15000  ip :  fp : 2710
> > r10: 8ffb5274  r9 : 8fd16ee8 r8 : 8ffbc714
> > r7 :   r6 :  r5 :   r4 : 
> > r3 : f4b9  r2 : 8000 r1 : 0001  r0 : 
> > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > Resetting CPU ...
> > 
> > resetting ...
> > 
> > When testing host mode with usb start
> > 
> > Colibri VFxx # usb start
> > starting USB...
> > USB0:   uclass_find_device_by_seq: 0 -1
> > uclass_find_device_by_seq: 0 0
> >- -1 -1
> >- -1 -1
> >- not found
> > USB EHCI 1.00
> > USB1:   uclass_find_device_by_seq: 0 -1
> > uclass_find_device_by_seq: 0 0
> >- -1 0
> >- found
> > uclass_find_device_by_seq: 0 1
> >- -1 0
> >- -1 1
> >- found
> > uclass_find_device_by_seq: 0 2
> >- -1 0
> >- -1 1
> >- -1 -1
> >- not found
> > uclass_find_device_by_seq: 0 -1
> > uclass_find_device_by_seq: 0 0
> >- -1 0
> >- found
> > uclass_find_device_by_seq: 0 1
> >- -1 0
> >- -1 -1
> >- not found
> > USB EHCI 1.00
> > scanning bus 0 for devices... uclass_find_device_by_seq: 0 -1
> > uclass_find_device_by_seq: 0 0
> >- -1 -1
> >- not found
> > uclass_find_device_by_seq: 0 -1
> > uclass_find_device_by_seq: 0 0
> >- -1 -1
> >- not found
> > 2 USB Device(s) found
> > scanning bus 1 for devices... uclass_find_device_by_seq: 0 -1
> > uclass_find_device_by_seq: 0 0
> >- -1 0
> >- found
> > uclass_find_device_by_seq: 0 1
> >- -1 0
> >- -1 -1
> >- not found
> > uclass_find_device_by_seq: 0 -1
> > uclass_find_device_by_seq: 0 0
> >- -1 0
> >- found
> > uclass_find_device_by_seq: 0 1
> >- -1 0
> >- -1 1
> >- found
> > uclass_find_device_by_seq: 0 2
> >- -1 0
> >- -1 1
> >- -1 -1
> >- not found
> > 2 USB Device(s) found
> > 
> > Regards,
> > Sanchayan.
> > 
> > > > 
> > > > It seems to return ENODEV from usb_setup_ehci_gadget after
> > > > calling uclass_find_device_by_seq. I am not sure what I am
> > > > missing in the current implementation. Can someone point me in
> > > > the correct direction? Since host works on both ports I would
> > > > assume the device tree nodes are correct.

Please do not mix host and device controllers. Those are two disjoint
drivers.

What I can see, is that usb_gadget_register_driver() calls
usb_setup_ehci_gadget(). when DM is supported.

It then calls uclass_find_device_by_seq(), which tries to find a
device (probably ci_udc? ) which is not supported in DM.

> > > > 
> > > > Tried to look in documentation and usb-info.txt mentions that
> > > > gadget framework does not use driver model.

Unfortunately, it hasn't been converted to DM yet.

>>> Does this imply I
> > > > cannot use any usb gadget functionality if I am using USB DM?

I didn't encounter such problem yet.

However, I think that it would be possible to make some "glue" code to
try to 

Re: [U-Boot] [PATCH] net: asix: Fix ASIX 88772B with driver model

2016-08-09 Thread Marek Vasut
On 08/09/2016 02:14 PM, Marcel Ziswiler wrote:
> On Thu, 2016-08-04 at 11:12 +0200, Marek Vasut wrote:
>> On 08/04/2016 11:07 AM, Alban Bedel wrote:
>>>
>>> On Wed, 3 Aug 2016 15:23:30 +
>>> Marcel Ziswiler  wrote:
>>>

 On Wed, 2016-08-03 at 15:51 +0200, Marek Vasut wrote:
>
> On 08/03/2016 11:46 AM, Alban Bedel wrote:
>>
>>
>> On Wed, 3 Aug 2016 09:00:42 +0200
>> Marek Vasut  wrote:
>>
>>>
>>>
>>> On 08/03/2016 07:32 AM, Alban Bedel wrote:


 Commit 147271209a9d ("net: asix: fix operation without
 eeprom")
 added a special handling for ASIX 88772B that enable
 another
 type of header. This break the driver in DM mode as the
 extra
 handling
 needed in the receive path is missing.
>>> So add the extra handling ?
>> I can do that too, but I though u-boot preferred to avoid
>> useless
>> code.
> Yes, if it is useless.
>
>>
>>
>>>
>>>


 However this new header mode is not required and only
 seems to
 increase the code complexity, so this patch revert this
 part of
 commit 147271209a9d.
>>> Why is it not required ?
>> It works fine without, since 2012. In fact this change is not
>> even
>> mentioned in the log of commit 147271209a9d, so I really
>> don't know
>> why
>> it was added in the first place. As can be seen in the revert
>> all
>> it
>> does is adding 2 bytes to the USB packets that are then just
>> skipped.
>> Seems pretty useless to me.
> I would like to get some feedback on this from Marcel, since he
> added
> this stuff.
 Yes, sorry. I just came back from vacation and started looking
 into it
 now. As far as I remember on our hardware without this Ethernet
 did not
 quite work reliably. This also means that with driver model so
 far it
 does not work for us which I fed back to Simon once but so far
 this has
 not been resolved. That fix came from some early U-Boot work done
 by
 Antmicro way back and I am missing some of the history.
>>> Then I'll do a new patch that just fix the driver model receive
>>> path.
>> Hold on. Marcel, can you maybe test if removing this code has any
>> impact
>> on the behavior now ?
> 
> Sorry for the delay. I tested Alban's patch now both on Toradex Colibri
> T20 as well as T30 and its on-module ASIX USB-to-Ethernet chip actually
> works perfectly aside from the occasional EHCI timed out on TD -
> token=0x88008d80 Rx: failed to receive: -5 message which last I checked
> with Simon is still unresolved but was already there long before any of
> the driver model work started.
> 
> Tested-by: Marcel Ziswiler 
> Tested-on: Colibri T20/T30 on Colibri Evaluation Board
> 
Thanks!

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Pull request: u-boot-spi/master

2016-08-09 Thread Jagan Teki
Hi Tom,

Please pull this request.

thanks!
Jagan.

The following changes since commit 08887ed4505ec14ee94ab32c482dc4dec5ddc1e4:

  ARM: am57xx_evm: Enable QSPI support (2016-07-30 00:15:07 +0530)

are available in the git repository at:

  git://git.denx.de/u-boot-spi.git master

for you to fetch changes up to 53208741d6c3448b7a7f5260d52c28f912ff6453:

  dm: at91: Add driver model support for the spi driver (2016-07-31 17:03:33 
+0530)


Lad, Prabhakar (1):
  spi: zynq_spi: Fix infinite looping while xfer

Wenyou Yang (1):
  dm: at91: Add driver model support for the spi driver

 drivers/spi/Kconfig |   7 ++
 drivers/spi/atmel_spi.c | 295 
 drivers/spi/zynq_spi.c  |   2 +-
 3 files changed, 303 insertions(+), 1 deletion(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   >