Re: [U-Boot] u-boot device model SPI + SPI Flash

2015-11-03 Thread Hoefle Marco
Hello Michal,
I saw a change on this file drivers/mtd/spi/sf-uclass.c regarding the dm 
problem.
I replaced this file on mainline u-boot but the result is the same.
Is there anything else to change?
I looked at your here:
https://github.com/Xilinx/u-boot-xlnx/commits/master/drivers/spi

Thanks,
Marco



Von: Michal Simek 
Gesendet: Donnerstag, 29. Oktober 2015 09:22
An: Hoefle Marco; Michal Simek; Jagan Teki
Cc: u-boot@lists.denx.de; emanuel stiebler
Betreff: Re: AW: [U-Boot] u-boot device model SPI + SPI Flash

Hi,

On 10/27/2015 04:03 PM, Hoefle Marco wrote:
> Hello Michal,
> ok I will then stop trying to get SPI working on mainline and watch your 
> commits on
> https://github.com/Xilinx/u-boot-xlnx
>
> We have a custom Artix Board here and I would be happy to test your commits 
> on our hardware.

I have sent patches to mainline mailing list and also update xilinx tree.

petalinux bsp which uses this configuration should be out at the end of Nov.

Thanks,
Michal



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


Re: [U-Boot] [PATCH 1/6] mx6sabresd: Remove empty reset_cpu()

2015-11-03 Thread Stefano Babic
On 03/11/2015 01:21, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> There is really no need to provide an empty reset_cpu() implementation,
> so just remove it.
> 
> Signed-off-by: Fabio Estevam 
> ---
>  board/freescale/mx6sabresd/mx6sabresd.c | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/board/freescale/mx6sabresd/mx6sabresd.c 
> b/board/freescale/mx6sabresd/mx6sabresd.c
> index 5644167..de2561d 100644
> --- a/board/freescale/mx6sabresd/mx6sabresd.c
> +++ b/board/freescale/mx6sabresd/mx6sabresd.c
> @@ -857,8 +857,4 @@ void board_init_f(ulong dummy)
>   /* load/boot image from boot device */
>   board_init_r(NULL, 0);
>  }
> -
> -void reset_cpu(ulong addr)
> -{
> -}
>  #endif
> 

Thanks for series - this is dead code.

Reviewed-by: Stefano Babic 

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] ot1200: Remove empty reset_cpu()

2015-11-03 Thread Christian Gmeiner
2015-11-03 1:21 GMT+01:00 Fabio Estevam :
> From: Fabio Estevam 
>
> There is really no need to provide an empty reset_cpu() implementation,
> so just remove it.
>
> Cc: Christian Gmeiner 
> Signed-off-by: Fabio Estevam 
> ---
>  board/bachmann/ot1200/ot1200_spl.c | 4 
>  1 file changed, 4 deletions(-)
>
> diff --git a/board/bachmann/ot1200/ot1200_spl.c 
> b/board/bachmann/ot1200/ot1200_spl.c
> index 9c77fd3..f651a40 100644
> --- a/board/bachmann/ot1200/ot1200_spl.c
> +++ b/board/bachmann/ot1200/ot1200_spl.c
> @@ -156,7 +156,3 @@ void board_init_f(ulong dummy)
> /* load/boot image from boot device */
> board_init_r(NULL, 0);
>  }
> -
> -void reset_cpu(ulong addr)
> -{
> -}
> --
> 1.9.1
>

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


Re: [U-Boot] [PATCH v5 17/18] spi: Add SPI NOR protection mechanism

2015-11-03 Thread Jagan Teki
Fabio,

On 3 November 2015 at 20:29, Fabio Estevam  wrote:
> Jagan,
>
> On Tue, Nov 3, 2015 at 12:51 PM, Jagan Teki  wrote:
>
>>> +   if (flash->is_locked(flash, offset, len) > 0) {
>>> +   printf("offset 0x%x is protected and cannot be written\n", 
>>> offset);
>>> +   return -EINVAL;
>>> +   }
>>
>> This flash lock check related to non-dm lock ops so it's look not good
>> to me as we assigned lock ops for both dm and non-dm cases.
>
> This is getting totally ridiculous: you have been seeing this patch
> series so many times and now you say this is not OK and you don't give
> me any clue as to what you would like me to change.

Nothing is worse than before or now - as spi-flash code is configured
both the dm and non-dm cases and it's been thinking job as I have
planning for proper design[1] to go ahead. I understand you sent
multiple versions but I already told that "please don't send the next
version" until the current version discussion finishes.

[1] 
http://git.denx.de/?p=u-boot/u-boot-spi.git;a=shortlog;h=refs/heads/next-spi-nor

>
> That's why I proposed earlier that you take the non-SPI patches first
> and then we can rework the SPI flash pieces.
>
>> I will come back for this patch changes what I thought, probably lock
>> ops shouldn't be separate for dm and non-dm as we have different ops
>> based on the flash itself.
>
> I wish we can make progress on this. Not sure how to proceed though.

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


Re: [U-Boot] [PATCH v2 3/5] ARM: omap-common: Add standard access for board description EEPROM

2015-11-03 Thread Steven Kipisz

On 11/03/2015 07:16 AM, Igor Grinberg wrote:

Hi Steve,

On 11/03/15 14:22, Steve Kipisz wrote:

From: Lokesh Vutla 


[...]



Signed-off-by: Lokesh Vutla 
Signed-off-by: Steve Kipisz 
---
v2 Based on
  master  a6104737  ARM: at91: sama5: change the environment address to 
0x6000

Changes in v2 (since v1)
- make the EEPROM code mor generic for TI EVMs
- rename structures/subroutines to ti_am_x
- add routines to access the EEPROM data
- redo commit message to be more clear

v1:   http://marc.info/?t=14460800791=1=2
(mailing list squashed original submission)

  arch/arm/cpu/armv7/omap-common/Makefile|   1 +
  arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c | 148 +
  arch/arm/include/asm/omap_common.h | 130 +-
  3 files changed, 278 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile 
b/arch/arm/cpu/armv7/omap-common/Makefile
index 464a5d1d732a..53a9fdb81100 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -15,6 +15,7 @@ obj-y += clocks-common.o
  obj-y += emif-common.o
  obj-y += vc.o
  obj-y += abb.o
+obj-$(CONFIG_I2C) += ti-i2c-eeprom.o


This makes this module compile on all TI SoC based boards enabling I2C.
AFAIU, this is a separate chip (not inside the SoC), so this module will
also compile on non-TI boards that do not have this EEPROM.
I think, it should be more fine grained (e.g. have its own symbol).


Can you give a suggestion?

  endif

  ifneq ($(CONFIG_OMAP54XX),)
diff --git a/arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c 
b/arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c
new file mode 100644
index ..f59ebbdb4ee8
--- /dev/null
+++ b/arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c


[...]


+void __maybe_unused set_board_info_env(char *name, char *default_name,
+  char *revision, char *serial)


That looks really weird API to me...
You have name and default_name? Why would you need both...

Default to beagle_x15 if the EEPROM isn't programmed. Looking at your 
other post, I think I see how to remove default_name.

+{
+   char *unknown = "unknown";
+
+   if (name)
+   setenv("board_name", name);
+   else
+   setenv("board_name", default_name);
+
+   if (revision)
+   setenv("board_revision", revision);
+   else
+   setenv("board_revision", unknown);
+
+   if (serial)
+   setenv("board_serial", serial);
+   else
+   setenv("board_serial", unknown);
+}


[...]


diff --git a/arch/arm/include/asm/omap_common.h 
b/arch/arm/include/asm/omap_common.h
index d773b0430ad4..a76c67a85d37 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h


[...]


+/**
+ * set_board_info_env() - Setup commonly used board information environment 
vars
+ * @name:  Name of the board
+ * @default_name: In case of empty string, what name to use?


That seems redundant.
The caller knows the board name, and if it does not, then it can place
an arbitrary name (like unknown) into name parameter.


+ * @revision:  Revision of the board
+ * @serial:Serial Number of the board
+ *
+ * In case of NULL revision or serial information "unknown" is setup.
+ * If name is NULL, default_name is used.
+ */
+void set_board_info_env(char *name, char *default_name,
+   char *revision, char *serial);
+
+/**
+ * board_am_is() - Generic Board detection logic
+ * @name_tag:  Tag used in eeprom for the board
+ *
+ * Return: false if board information does not match OR eeprom was'nt read.
+ *true otherwise
+ */
+static inline bool board_am_is(char *name_tag)
+{
+   struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
+
+   if (ep->header != TI_EEPROM_HEADER_MAGIC)
+   return false;
+   return !strncmp(ep->name, name_tag, TI_EEPROM_HDR_NAME_LEN);
+}


Why do you need to place non trivial function implementation inside the
header file?


+
+/**
+ * board_am_rev_is() - Compare board revision
+ * @rev_tag:   Revision tag to check in eeprom
+ * @cmp_len:   How many chars to compare?
+ *
+ * NOTE: revision information is often messed up (hence the str len match) :(
+ *
+ * Return: false if board information does not match OR eeprom was'nt read.
+ *true otherwise
+ */
+static inline bool board_am_rev_is(char *rev_tag, int cmp_len)
+{
+   struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
+   int l;
+
+   if (ep->header != TI_EEPROM_HEADER_MAGIC)
+   return false;
+
+   l = cmp_len > TI_EEPROM_HDR_REV_LEN ? TI_EEPROM_HDR_NAME_LEN : cmp_len;
+   return !strncmp(ep->version, rev_tag, l);
+}


Same here.


I thought by making them static inline would save space.

+#endif /* 

Re: [U-Boot] [PATCH v5 17/18] spi: Add SPI NOR protection mechanism

2015-11-03 Thread Fabio Estevam
Jagan,

On Tue, Nov 3, 2015 at 1:11 PM, Jagan Teki  wrote:

> Nothing is worse than before or now - as spi-flash code is configured
> both the dm and non-dm cases and it's been thinking job as I have
> planning for proper design[1] to go ahead. I understand you sent
> multiple versions but I already told that "please don't send the next
> version" until the current version discussion finishes.

How do I know that you finished reviewing a specific version and I am
ready to send another one?

Anyway, let's focus on the remaining technical issues.

What exactly do you want me to change?

You say: "This flash lock check related to non-dm lock ops so it's look not good
to me as we assigned lock ops for both dm and non-dm cases."

How can I make it look good then?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/5] board: ti: AM57xx: Add detection logic for AM57xx-evm

2015-11-03 Thread Steven Kipisz

On 11/03/2015 07:29 AM, Igor Grinberg wrote:

Hi Steve,

On 11/03/15 14:22, Steve Kipisz wrote:

[...]


Signed-off-by: Steve Kipisz 
---
v2 Based on:
  master a6104737 ARM: at91: sama5: change the environment address to 0x6000

Build testing: MAKEALL -s omap4 -s omap5 (no warnings/build errors)
Boot Testing:
am57xx_evm_nodt_config: http://pastebin.ubuntu.com/13039296/
beagle_x15_config: http://pastebin.ubuntu.com/13039331/

Changes in v2 (since v1):
- move the board detection code into the new routine
  do_board_detect
- eliminate board.h and move the ix_xxx into board.c
- redo commit message to be more clear

v1:  http://marc.info/?t=14460800792=1=2
  http://marc.info/?t=14460800794=1=2
(mailing list squashed original submission)


[...]


+#define is_x15()   board_am_is("BBRDX15_")
+#define is_am572x_evm()board_am_is("AM572PM_")


I think board_is_* much more appropriate here...


Ok. so board_is_x15 and board_is_am572x_evm

+
  #ifdef CONFIG_DRIVER_TI_CPSW
  #include 
  #endif
@@ -246,6 +249,54 @@ struct vcores_data beagle_x15_volts = {
.iva.pmic   = ,
  };

+#ifdef CONFIG_SPL_BUILD
+/* No env to setup for SPL */
+static inline void setup_board_eeprom_env(void) { }
+
+/* Override function to read eeprom information */
+void do_board_detect(void)
+{
+   struct ti_am_eeprom *ep;
+   int rc;
+
+   rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
+ CONFIG_EEPROM_CHIP_ADDRESS, );
+   if (rc)
+   printf("ti_i2c_eeprom_init failed %d\n", rc);
+}


Do you really need this in SPL?


Yes. We need to detect the board to determine DDR setup, pin mux, 
iodelay. All of that needs to be done in SPL. X15 and EVM are the same, 
but more boards will be added that have some differences.



+
+#else  /* CONFIG_SPL_BUILD */
+
+static void setup_board_eeprom_env(void)
+{
+   char *name = NULL;


How about:

char *name = "beagle_x15";


+   int rc;
+   struct ti_am_eeprom_printable p;
+
+   rc = ti_i2c_eeprom_am_get_print(CONFIG_EEPROM_BUS_ADDRESS,
+   CONFIG_EEPROM_CHIP_ADDRESS, );
+   if (rc) {
+   printf("Invalid EEPROM data(@0x%p). Default to X15\n",
+  TI_AM_EEPROM_DATA);
+   goto invalid_eeprom;
+   }
+
+   if (is_x15())
+   name = "beagle_x15";


This will not be needed if the above comment is implemented.


+   else if (is_am572x_evm())
+   name = "am57xx_evm";
+   else
+   printf("Unidentified board claims %s in eeprom header\n",
+  p.name);
+
+invalid_eeprom:
+   set_board_info_env(name, "beagle_x15", p.version, p.serial);


If the above comment is implemented, no more need for the
default_name parameter...


Ok, I'll look at that.

+}
+
+/* Eeprom is alread read by SPL.. nothing more to do here.. */
+
+#endif /* CONFIG_SPL_BUILD */


[...]



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


Re: [U-Boot] [PATCH] fdt: fix address cell count checking in fdt_translate_address()

2015-11-03 Thread Przemyslaw Marczak

Hello All,

On 10/29/2015 06:15 PM, Simon Glass wrote:

Hi Stefan,

On 28 October 2015 at 08:37, Przemyslaw Marczak  wrote:

Commit: dm: core: Enable optional use of fdt_translate_address()

Enables use of this function as default, but after this it's not
possible to get dev address for the case in which: '#size-cells == 0'

This causes errors when getting address for some GPIOs, for which
the '#size-cells' is set to 0.

Example error:
'__of_translate_address: Bad cell count for gpx0'

Allowing for that case by modifying the macro 'OF_CHECK_COUNTS',
(called from )__of_translate_address(), fixes the issue.

Now, this macro doesn't check, that '#size-cells' is greater than 0.

This is possible from the specification point of view, but I'm not sure
that it doesn't introduce a regression for other configs.

Please test and share the results.

Tested-on: Odroid U3, Odroid X2, Odroid XU3, Sandbox.

Signed-off-by: Przemyslaw Marczak 
Cc: Masahiro Yamada 
Cc: Lukasz Majewski 
Cc: Jaehoon Chung 
Cc: Stefan Roese 
Cc: Simon Glass 
Cc: Bin Meng 
Cc: Marek Vasut 
---
  common/fdt_support.c | 7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index f86365e..5f808cc 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -946,8 +946,7 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
  /* Max address size we deal with */
  #define OF_MAX_ADDR_CELLS  4
  #define OF_BAD_ADDR((u64)-1)
-#define OF_CHECK_COUNTS(na, ns)((na) > 0 && (na) <= OF_MAX_ADDR_CELLS 
&& \
-   (ns) > 0)
+#define OF_CHECK_COUNTS(na)((na) > 0 && (na) <= OF_MAX_ADDR_CELLS)

  /* Debug utility */
  #ifdef DEBUG
@@ -1115,7 +1114,7 @@ static u64 __of_translate_address(void *blob, int 
node_offset, const fdt32_t *in

 /* Cound address cells & copy address locally */
 bus->count_cells(blob, parent, , );
-   if (!OF_CHECK_COUNTS(na, ns)) {
+   if (!OF_CHECK_COUNTS(na)) {


This seems to conflict with the comment at the top of this function:

  * Note: We consider that crossing any level with #size-cells == 0 to mean
  * that translation is impossible (that is we are not dealing with a value
  * that can be mapped to a cpu physical address). This is not really specified
  * that way, but this is traditionally the way IBM at least do things

What should we do here?



Is that commit acceptable? I would like send V2 with removing the above 
comment.


Best regards,
--
Przemyslaw Marczak
Samsung R Institute Poland
Samsung Electronics
p.marc...@samsung.com


 printf("%s: Bad cell count for %s\n", __FUNCTION__,
fdt_get_name(blob, node_offset, NULL));
 goto bail;
@@ -1142,7 +1141,7 @@ static u64 __of_translate_address(void *blob, int 
node_offset, const fdt32_t *in
 /* Get new parent bus and counts */
 pbus = _busses[0];
 pbus->count_cells(blob, parent, , );
-   if (!OF_CHECK_COUNTS(pna, pns)) {
+   if (!OF_CHECK_COUNTS(pna)) {
 printf("%s: Bad cell count for %s\n", __FUNCTION__,
 fdt_get_name(blob, node_offset, NULL));
 break;
--
1.9.1



Regards,
Simon


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


[U-Boot] [PATCH V3 11/13] spl: announce boot devices

2015-11-03 Thread Nikita Kiryanov
Now that we support alternative boot devices, it can sometimes be
unclear which boot devices was actually used. Provide a function to
announce which boot devices are attempted during boot.

Signed-off-by: Nikita Kiryanov 
Cc: Igor Grinberg 
Cc: Tom Rini 
Cc: Simon Glass 
---
Changes in V3:
- Reworked announce_boot_device() to make the code less repititive by
  utilizing a table of boot_device --> name.

Changes in V2:
- No changes.
 common/spl/spl.c | 79 
 1 file changed, 79 insertions(+)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 7913c52..11b452b 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -178,6 +178,84 @@ int spl_init(void)
return 0;
 }
 
+#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
+__weak void spl_board_announce_boot_device(void) { }
+#endif
+
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+struct boot_device_name {
+   u32 boot_dev;
+   const char *name;
+};
+
+struct boot_device_name boot_name_table[] = {
+#ifdef CONFIG_SPL_RAM_DEVICE
+   { BOOT_DEVICE_RAM, "RAM" },
+#endif
+#ifdef CONFIG_SPL_MMC_SUPPORT
+   { BOOT_DEVICE_MMC1, "MMC" },
+   { BOOT_DEVICE_MMC2, "MMC" },
+   { BOOT_DEVICE_MMC2_2, "MMC" },
+#endif
+#ifdef CONFIG_SPL_NAND_SUPPORT
+   { BOOT_DEVICE_NAND, "NAND" },
+#endif
+#ifdef CONFIG_SPL_ONENAND_SUPPORT
+   { BOOT_DEVICE_ONENAND, "OneNAND" },
+#endif
+#ifdef CONFIG_SPL_NOR_SUPPORT
+   { BOOT_DEVICE_NOR, "NOR" },
+#endif
+#ifdef CONFIG_SPL_YMODEM_SUPPORT
+   { BOOT_DEVICE_UART, "UART" },
+#endif
+#ifdef CONFIG_SPL_SPI_SUPPORT
+   { BOOT_DEVICE_SPI, "SPI" },
+#endif
+#ifdef CONFIG_SPL_ETH_SUPPORT
+#ifdef CONFIG_SPL_ETH_DEVICE
+   { BOOT_DEVICE_CPGMAC, "eth device" },
+#else
+   { BOOT_DEVICE_CPGMAC, "net" },
+#endif
+#endif
+#ifdef CONFIG_SPL_USBETH_SUPPORT
+   { BOOT_DEVICE_USBETH, "USB eth" },
+#endif
+#ifdef CONFIG_SPL_USB_SUPPORT
+   { BOOT_DEVICE_USB, "USB" },
+#endif
+#ifdef CONFIG_SPL_SATA_SUPPORT
+   { BOOT_DEVICE_SATA, "SATA" },
+#endif
+   /* Keep this entry last */
+   { BOOT_DEVICE_NONE, "unknown boot device" },
+};
+
+static void announce_boot_device(u32 boot_device)
+{
+   int i;
+
+   puts("Trying to boot from ");
+
+#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
+   if (boot_device == BOOT_DEVICE_BOARD) {
+   spl_board_announce_boot_device();
+   puts("\n");
+   return;
+   }
+#endif
+   for (i = 0; i < ARRAY_SIZE(boot_name_table) - 1; i++) {
+   if (boot_name_table[i].boot_dev == boot_device)
+   break;
+   }
+
+   printf("%s\n", boot_name_table[i].name);
+}
+#else
+static inline void announce_boot_device(u32 boot_device) { }
+#endif
+
 #ifndef BOOT_DEVICE_NONE
 #define BOOT_DEVICE_NONE 0xdeadbeef
 #endif
@@ -292,6 +370,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
board_boot_order(spl_boot_list);
for (i = 0; i < ARRAY_SIZE(spl_boot_list) &&
spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
+   announce_boot_device(spl_boot_list[i]);
if (!spl_load_image(spl_boot_list[i]))
break;
}
-- 
1.9.1

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


[U-Boot] [PATCH v2 1/5] ARM: OMAP4/5: Centralize early clock initialization

2015-11-03 Thread Steve Kipisz
Early clock initialization is currently done in two stages for OMAP4/5
SoCs. The first stage is the initialization of console clocks and
then we initialize basic clocks for functionality necessary for SoC
initialization and basic board functionality.

By splitting up prcm_init and centralizing this clock initialization,
we setup the code for follow on patches that can do board specific
initialization such as board detection which will depend on these
basic clocks.

As part of this change, since the early clock initialization
is centralized, we no longer need to expose the console clock
initialization and build it just for SPL.

NOTE: we change the sequence slightly by initializing console clocks
timer after the io settings are complete, but this is not expected
to have any functioanlity impact since we setup the basic IO drive
strength initialization as part of do_io_settings

Signed-off-by: Steve Kipisz 
---
v2 Based on:
 master  a6104737 ARM: at91: sama5: change the environment address to 0x6000

Changes in v2:
 - New patch

 arch/arm/cpu/armv7/omap-common/clocks-common.c | 26 --
 arch/arm/cpu/armv7/omap-common/hwinit-common.c |  3 +--
 arch/arm/include/asm/arch-omap4/sys_proto.h|  2 +-
 arch/arm/include/asm/arch-omap5/sys_proto.h|  2 +-
 4 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/clocks-common.c 
b/arch/arm/cpu/armv7/omap-common/clocks-common.c
index e28b79568d1d..2ede0818e444 100644
--- a/arch/arm/cpu/armv7/omap-common/clocks-common.c
+++ b/arch/arm/cpu/armv7/omap-common/clocks-common.c
@@ -769,7 +769,8 @@ void lock_dpll(u32 const base)
wait_for_lock(base);
 }
 
-void setup_clocks_for_console(void)
+#ifdef CONFIG_SPL_BUILD
+static void setup_clocks_for_console(void)
 {
/* Do not add any spl_debug prints in this function */
clrsetbits_le32((*prcm)->cm_l4per_clkstctrl, CD_CLKCTRL_CLKTRCTRL_MASK,
@@ -801,6 +802,9 @@ void setup_clocks_for_console(void)
CD_CLKCTRL_CLKTRCTRL_HW_AUTO <<
CD_CLKCTRL_CLKTRCTRL_SHIFT);
 }
+#else
+static inline void setup_clocks_for_console(void) { }
+#endif
 
 void do_enable_clocks(u32 const *clk_domains,
u32 const *clk_modules_hw_auto,
@@ -853,14 +857,32 @@ void do_disable_clocks(u32 const *clk_domains,
disable_clock_domain(clk_domains[i]);
 }
 
-void prcm_init(void)
+/**
+ * setup_early_clocks() - Setup early clocks needed for SoC
+ *
+ * Setup clocks for console, SPL basic initialization clocks and initialize
+ * the timer. This is invoked prior prcm_init.
+ */
+void setup_early_clocks(void)
 {
+   setup_clocks_for_console();
+
switch (omap_hw_init_context()) {
case OMAP_INIT_CONTEXT_SPL:
case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR:
case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH:
enable_basic_clocks();
timer_init();
+   /* Fall through */
+   }
+}
+
+void prcm_init(void)
+{
+   switch (omap_hw_init_context()) {
+   case OMAP_INIT_CONTEXT_SPL:
+   case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR:
+   case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH:
scale_vcores(*omap_vcores);
setup_dplls();
setup_warmreset_time();
diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c 
b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index 80794f9c611a..91f2dead364b 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -125,10 +125,9 @@ void s_init(void)
set_mux_conf_regs();
 #ifdef CONFIG_SPL_BUILD
srcomp_enable();
-   setup_clocks_for_console();
-
do_io_settings();
 #endif
+   setup_early_clocks();
prcm_init();
 }
 
diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h 
b/arch/arm/include/asm/arch-omap4/sys_proto.h
index f30f86539130..71e3d776aa0d 100644
--- a/arch/arm/include/asm/arch-omap4/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h
@@ -37,7 +37,7 @@ void do_set_mux(u32 base, struct pad_conf_entry const *array, 
int size);
 void set_muxconf_regs_essential(void);
 u32 wait_on_value(u32, u32, void *, u32);
 void sdelay(unsigned long);
-void setup_clocks_for_console(void);
+void setup_early_clocks(void);
 void prcm_init(void);
 void bypass_dpll(u32 const base);
 void freq_update_core(void);
diff --git a/arch/arm/include/asm/arch-omap5/sys_proto.h 
b/arch/arm/include/asm/arch-omap5/sys_proto.h
index 7fcb78389403..b9e09e7c52a8 100644
--- a/arch/arm/include/asm/arch-omap5/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap5/sys_proto.h
@@ -48,7 +48,7 @@ void do_set_mux32(u32 base, struct pad_conf_entry const 
*array, int size);
 void set_muxconf_regs_essential(void);
 u32 wait_on_value(u32, u32, void *, u32);
 void sdelay(unsigned long);
-void setup_clocks_for_console(void);
+void setup_early_clocks(void);
 void prcm_init(void);
 void 

Re: [U-Boot] arm: at91: Change the Chip ID registers' addresses

2015-11-03 Thread Andreas Bießmann
Dear Wenyou Yang,

Wenyou Yang  writes:
>Provide the specific addresses for the Chip ID and Chip ID Extension
>registers, instead of the offset, which make it use on other chips.
>
>Signed-off-by: Wenyou Yang 
>Reviewed-by: Andreas Bießmann 
>---
>
> arch/arm/mach-at91/armv7/cpu.c |7 ---
> arch/arm/mach-at91/include/mach/at91_dbu.h |4 
> arch/arm/mach-at91/include/mach/sama5d3.h  |3 +++
> arch/arm/mach-at91/include/mach/sama5d4.h  |3 +++
> 4 files changed, 10 insertions(+), 7 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bießmann
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/5] board: ti: AM57xx: Add detection logic for AM57xx-evm

2015-11-03 Thread Igor Grinberg
Hi Steve,

On 11/03/15 14:22, Steve Kipisz wrote:

[...]

> Signed-off-by: Steve Kipisz 
> ---
> v2 Based on:
>  master a6104737 ARM: at91: sama5: change the environment address to 
> 0x6000
> 
> Build testing: MAKEALL -s omap4 -s omap5 (no warnings/build errors)
>   Boot Testing:
>   am57xx_evm_nodt_config: http://pastebin.ubuntu.com/13039296/
>   beagle_x15_config: http://pastebin.ubuntu.com/13039331/
> 
> Changes in v2 (since v1):
>   - move the board detection code into the new routine
> do_board_detect
>   - eliminate board.h and move the ix_xxx into board.c
>   - redo commit message to be more clear
> 
> v1:  http://marc.info/?t=14460800792=1=2
>  http://marc.info/?t=14460800794=1=2
>   (mailing list squashed original submission)

[...]

> +#define is_x15() board_am_is("BBRDX15_")
> +#define is_am572x_evm()  board_am_is("AM572PM_")

I think board_is_* much more appropriate here...

> +
>  #ifdef CONFIG_DRIVER_TI_CPSW
>  #include 
>  #endif
> @@ -246,6 +249,54 @@ struct vcores_data beagle_x15_volts = {
>   .iva.pmic   = ,
>  };
>  
> +#ifdef CONFIG_SPL_BUILD
> +/* No env to setup for SPL */
> +static inline void setup_board_eeprom_env(void) { }
> +
> +/* Override function to read eeprom information */
> +void do_board_detect(void)
> +{
> + struct ti_am_eeprom *ep;
> + int rc;
> +
> + rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
> +   CONFIG_EEPROM_CHIP_ADDRESS, );
> + if (rc)
> + printf("ti_i2c_eeprom_init failed %d\n", rc);
> +}

Do you really need this in SPL?

> +
> +#else/* CONFIG_SPL_BUILD */
> +
> +static void setup_board_eeprom_env(void)
> +{
> + char *name = NULL;

How about:

char *name = "beagle_x15";

> + int rc;
> + struct ti_am_eeprom_printable p;
> +
> + rc = ti_i2c_eeprom_am_get_print(CONFIG_EEPROM_BUS_ADDRESS,
> + CONFIG_EEPROM_CHIP_ADDRESS, );
> + if (rc) {
> + printf("Invalid EEPROM data(@0x%p). Default to X15\n",
> +TI_AM_EEPROM_DATA);
> + goto invalid_eeprom;
> + }
> +
> + if (is_x15())
> + name = "beagle_x15";

This will not be needed if the above comment is implemented.

> + else if (is_am572x_evm())
> + name = "am57xx_evm";
> + else
> + printf("Unidentified board claims %s in eeprom header\n",
> +p.name);
> +
> +invalid_eeprom:
> + set_board_info_env(name, "beagle_x15", p.version, p.serial);

If the above comment is implemented, no more need for the
default_name parameter...

> +}
> +
> +/* Eeprom is alread read by SPL.. nothing more to do here.. */
> +
> +#endif   /* CONFIG_SPL_BUILD */

[...]


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


Re: [U-Boot] [PATCH] usb: lthor: Specify correct parameter for sizeof type

2015-11-03 Thread Lukasz Majewski
Hi Michal,

> This patch removes this warning:
>   CC  drivers/usb/gadget/f_thor.o
> drivers/usb/gadget/f_thor.c: In function ‘thor_tx_data’:
> drivers/usb/gadget/f_thor.c:572:2: warning: format ‘%d’ expects
> argument of type ‘int’, but argument 4 has type ‘long unsigned
> int’ [-Wformat=] debug("%s: dev->in_req->length:%d to_cpy:%d\n",
> __func__, ^
> 
> Signed-off-by: Michal Simek 
> ---
> 
>  drivers/usb/gadget/f_thor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index ff1481ba3723..9ed0ce3d3132 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -569,7 +569,7 @@ static void thor_tx_data(unsigned char *data, int
> len) 
>   dev->in_req->length = len;
>  
> - debug("%s: dev->in_req->length:%d to_cpy:%d\n", __func__,
> + debug("%s: dev->in_req->length:%d to_cpy:%zd\n", __func__,
> dev->in_req->length, sizeof(data));
>  
>   status = usb_ep_queue(dev->in_ep, dev->in_req, 0);

Acked-by: Lukasz Majewski 

-- 
Best regards,

Lukasz Majewski

Samsung R Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 3/5] ARM: omap-common: Add standard access for board description EEPROM

2015-11-03 Thread Steve Kipisz
From: Lokesh Vutla 

Several TI EVMs have EEPROM that can contain board description information
such as revision, DDR definition, serial number, etc. In just about all
cases, these EEPROM are on the I2C bus and provides us the opportunity
to centralize the generic operations involved.

The on-board EEPROM on the BeagleBone Black, BeagleBone, AM335x EVM,
AM43x GP EVM, AM57xx-evm, BeagleBoard-X15 share the same format.
However, DRA-7* EVMs, OMAP4SDP use a modified format.

We hence introduce logic which is generic between these platforms
without enforcing any specific format. This allows the boards to use the
relevant format for operations that they might choose.

It is important to note that this logic is fundamental to the board
configuration process such as DDR configuration which is needed in
SPL, hence cannot be part of the standard u-boot driver model (which
is available later in the process). Hence, to aid efficiency, the
eeprom contents are copied over to SRAM scratchpad memory area at the
first invocation to retrieve data.

The follow on patches introduce the use of this library for AM57x
platform support. AM335x/AM43xx cleanups need to first ensure usage of
omap_common prior to switch over to this generic solution.

Signed-off-by: Lokesh Vutla 
Signed-off-by: Steve Kipisz 
---
v2 Based on
 master  a6104737  ARM: at91: sama5: change the environment address to 
0x6000

Changes in v2 (since v1)
- make the EEPROM code mor generic for TI EVMs
- rename structures/subroutines to ti_am_x
- add routines to access the EEPROM data
- redo commit message to be more clear

v1:   http://marc.info/?t=14460800791=1=2
(mailing list squashed original submission)

 arch/arm/cpu/armv7/omap-common/Makefile|   1 +
 arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c | 148 +
 arch/arm/include/asm/omap_common.h | 130 +-
 3 files changed, 278 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile 
b/arch/arm/cpu/armv7/omap-common/Makefile
index 464a5d1d732a..53a9fdb81100 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -15,6 +15,7 @@ obj-y += clocks-common.o
 obj-y  += emif-common.o
 obj-y  += vc.o
 obj-y  += abb.o
+obj-$(CONFIG_I2C) += ti-i2c-eeprom.o
 endif
 
 ifneq ($(CONFIG_OMAP54XX),)
diff --git a/arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c 
b/arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c
new file mode 100644
index ..f59ebbdb4ee8
--- /dev/null
+++ b/arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c
@@ -0,0 +1,148 @@
+/*
+ * Library to support early TI EVM EEPROM handling
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ * Lokesh Vutla
+ * Steve Kipisz
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+
+/**
+ * ti_i2c_eeprom_init - Initialize an i2c bus and probe for a device
+ * @i2c_bus: i2c bus number to initialize
+ * @dev_addr: Device address to probe for
+ *
+ * Return: 0 on success or corresponding error on failure.
+ */
+static inline int ti_i2c_eeprom_init(int i2c_bus, int dev_addr)
+{
+   int rc;
+
+   rc = i2c_set_bus_num(i2c_bus);
+   if (rc)
+   return rc;
+
+   return i2c_probe(dev_addr);
+}
+
+/**
+ * ti_i2c_eeprom_read - Read data from an EEPROM
+ * @dev_addr: The device address of the EEPROM
+ * @offset: Offset to start reading in the EEPROM
+ * @ep: Pointer to a buffer to read into
+ * @epsize: Size of buffer
+ *
+ * Return: 0 on success or corresponding result of i2c_read
+ */
+static inline int ti_i2c_eeprom_read(int dev_addr, int offset, uchar *ep,
+int epsize)
+{
+   return i2c_read(dev_addr, offset, 2, ep, epsize);
+}
+
+/**
+ * ti_eeprom_string_cleanup() - Handle eeprom programming errors
+ * @s: eeprom string (should be NULL terminated)
+ *
+ * Some Board manufacturers do not add a NULL termination at the
+ * end of string, instead some binary information is kludged in, hence
+ * convert the string to just printable characters of ASCII chart.
+ */
+static inline void ti_eeprom_string_cleanup(char *s)
+{
+   int i, l;
+
+   l = strlen(s);
+   for (i = 0; i < l; i++, s++)
+   if (*s < ' ' || *s > '~') {
+   *s = 0;
+   break;
+   }
+}
+
+int __maybe_unused ti_i2c_eeprom_am_get(int bus_addr, int dev_addr,
+   struct ti_am_eeprom **epp)
+{
+   int rc;
+   struct ti_am_eeprom *ep;
+
+   if (!epp)
+   return -1;
+
+   ep = TI_AM_EEPROM_DATA;
+   if (ep->header == TI_EEPROM_HEADER_MAGIC)
+   goto already_read;
+
+   /* Initialize with a known bad marker for i2c fails.. */
+   

Re: [U-Boot] [PATCH v2 3/5] ARM: omap-common: Add standard access for board description EEPROM

2015-11-03 Thread Igor Grinberg
Hi Steve,

On 11/03/15 14:22, Steve Kipisz wrote:
> From: Lokesh Vutla 

[...]

> 
> Signed-off-by: Lokesh Vutla 
> Signed-off-by: Steve Kipisz 
> ---
> v2 Based on
>  master  a6104737  ARM: at91: sama5: change the environment address to 
> 0x6000
> 
> Changes in v2 (since v1)
>   - make the EEPROM code mor generic for TI EVMs
>   - rename structures/subroutines to ti_am_x
>   - add routines to access the EEPROM data
>   - redo commit message to be more clear
> 
> v1:   http://marc.info/?t=14460800791=1=2
>   (mailing list squashed original submission)
> 
>  arch/arm/cpu/armv7/omap-common/Makefile|   1 +
>  arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c | 148 
> +
>  arch/arm/include/asm/omap_common.h | 130 +-
>  3 files changed, 278 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c
> 
> diff --git a/arch/arm/cpu/armv7/omap-common/Makefile 
> b/arch/arm/cpu/armv7/omap-common/Makefile
> index 464a5d1d732a..53a9fdb81100 100644
> --- a/arch/arm/cpu/armv7/omap-common/Makefile
> +++ b/arch/arm/cpu/armv7/omap-common/Makefile
> @@ -15,6 +15,7 @@ obj-y   += clocks-common.o
>  obj-y+= emif-common.o
>  obj-y+= vc.o
>  obj-y+= abb.o
> +obj-$(CONFIG_I2C) += ti-i2c-eeprom.o

This makes this module compile on all TI SoC based boards enabling I2C.
AFAIU, this is a separate chip (not inside the SoC), so this module will
also compile on non-TI boards that do not have this EEPROM.
I think, it should be more fine grained (e.g. have its own symbol).

>  endif
>  
>  ifneq ($(CONFIG_OMAP54XX),)
> diff --git a/arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c 
> b/arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c
> new file mode 100644
> index ..f59ebbdb4ee8
> --- /dev/null
> +++ b/arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c

[...]

> +void __maybe_unused set_board_info_env(char *name, char *default_name,
> +char *revision, char *serial)

That looks really weird API to me...
You have name and default_name? Why would you need both...

> +{
> + char *unknown = "unknown";
> +
> + if (name)
> + setenv("board_name", name);
> + else
> + setenv("board_name", default_name);
> +
> + if (revision)
> + setenv("board_revision", revision);
> + else
> + setenv("board_revision", unknown);
> +
> + if (serial)
> + setenv("board_serial", serial);
> + else
> + setenv("board_serial", unknown);
> +}

[...]

> diff --git a/arch/arm/include/asm/omap_common.h 
> b/arch/arm/include/asm/omap_common.h
> index d773b0430ad4..a76c67a85d37 100644
> --- a/arch/arm/include/asm/omap_common.h
> +++ b/arch/arm/include/asm/omap_common.h

[...]

> +/**
> + * set_board_info_env() - Setup commonly used board information environment 
> vars
> + * @name:Name of the board
> + * @default_name: In case of empty string, what name to use?

That seems redundant.
The caller knows the board name, and if it does not, then it can place
an arbitrary name (like unknown) into name parameter.

> + * @revision:Revision of the board
> + * @serial:  Serial Number of the board
> + *
> + * In case of NULL revision or serial information "unknown" is setup.
> + * If name is NULL, default_name is used.
> + */
> +void set_board_info_env(char *name, char *default_name,
> + char *revision, char *serial);
> +
> +/**
> + * board_am_is() - Generic Board detection logic
> + * @name_tag:Tag used in eeprom for the board
> + *
> + * Return: false if board information does not match OR eeprom was'nt read.
> + *  true otherwise
> + */
> +static inline bool board_am_is(char *name_tag)
> +{
> + struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
> +
> + if (ep->header != TI_EEPROM_HEADER_MAGIC)
> + return false;
> + return !strncmp(ep->name, name_tag, TI_EEPROM_HDR_NAME_LEN);
> +}

Why do you need to place non trivial function implementation inside the
header file?

> +
> +/**
> + * board_am_rev_is() - Compare board revision
> + * @rev_tag: Revision tag to check in eeprom
> + * @cmp_len: How many chars to compare?
> + *
> + * NOTE: revision information is often messed up (hence the str len match) :(
> + *
> + * Return: false if board information does not match OR eeprom was'nt read.
> + *  true otherwise
> + */
> +static inline bool board_am_rev_is(char *rev_tag, int cmp_len)
> +{
> + struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
> + int l;
> +
> + if (ep->header != TI_EEPROM_HEADER_MAGIC)
> + return false;
> +
> + l = cmp_len > TI_EEPROM_HDR_REV_LEN ? TI_EEPROM_HDR_NAME_LEN : cmp_len;
> + return !strncmp(ep->version, rev_tag, l);
> +}

Same here.

> +#endif   /* __ASSEMBLY__ */
> +
>  #endif /* _OMAP_COMMON_H_ */
> 

-- 
Regards,
Igor.

[U-Boot] [PATCH V3 08/13] spl: change return values of spl_*_load_image()

2015-11-03 Thread Nikita Kiryanov
Make spl_*_load_image() functions return a value instead of
hanging if a problem is encountered. This enables main spl code
to make the decision whether to hang or not, thus preparing
it to support alternative boot devices.

Some boot devices (namely nand and spi) do not hang on error.
Instead, they return normally and SPL proceeds to boot the
contents of the load address. This is considered a bug and
is rectified by hanging on error for these devices as well.

Signed-off-by: Nikita Kiryanov 
Cc: Igor Grinberg 
Cc: Tom Rini 
Cc: Simon Glass 
Cc: Ian Campbell 
Cc: Hans De Goede 
Cc: Albert Aribaud 
Cc: Jagan Teki 
---
Changes in V3:
- Added documentation for spl_board_load_image().

Changes in V2:
- Minor collateral adjustments from changes in patch 2 (only one return
  statement at the end of spl_mmc_load_image).

 arch/arm/cpu/armv7/sunxi/board.c |  4 +++-
 arch/arm/include/asm/spl.h   | 10 --
 common/spl/spl.c | 43 +++-
 common/spl/spl_mmc.c | 26 ++--
 common/spl/spl_nand.c| 18 +++--
 common/spl/spl_net.c |  9 ++---
 common/spl/spl_nor.c |  6 --
 common/spl/spl_onenand.c |  4 +++-
 common/spl/spl_sata.c| 11 +++---
 common/spl/spl_usb.c | 17 ++--
 common/spl/spl_ymodem.c  |  5 +++--
 drivers/mtd/spi/spi_spl_load.c   | 17 +++-
 include/spl.h| 18 -
 13 files changed, 123 insertions(+), 65 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 4785ac6..9b5c46b 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -95,10 +95,12 @@ static int gpio_init(void)
return 0;
 }
 
-void spl_board_load_image(void)
+int spl_board_load_image(void)
 {
debug("Returning to FEL sp=%x, lr=%x\n", fel_stash.sp, fel_stash.lr);
return_to_fel(fel_stash.sp, fel_stash.lr);
+
+   return 0;
 }
 
 void s_init(void)
diff --git a/arch/arm/include/asm/spl.h b/arch/arm/include/asm/spl.h
index 6db405d..5c5d33f 100644
--- a/arch/arm/include/asm/spl.h
+++ b/arch/arm/include/asm/spl.h
@@ -31,8 +31,14 @@ enum {
 };
 #endif
 
-/* Board-specific load method */
-void spl_board_load_image(void);
+/**
+ * Board specific load method for boards that have a special way of loading
+ * U-Boot, which does not fit with the existing SPL code.
+ *
+ * @return 0 on success, negative errno value on failure.
+ */
+
+int spl_board_load_image(void);
 
 /* Linker symbols. */
 extern char __bss_start[], __bss_end[];
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 4b319d6..ff1bad2 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -132,7 +132,7 @@ __weak void __noreturn jump_to_image_no_args(struct 
spl_image_info *spl_image)
 }
 
 #ifdef CONFIG_SPL_RAM_DEVICE
-static void spl_ram_load_image(void)
+static int spl_ram_load_image(void)
 {
const struct image_header *header;
 
@@ -145,6 +145,8 @@ static void spl_ram_load_image(void)
(CONFIG_SYS_TEXT_BASE - sizeof(struct image_header));
 
spl_parse_image_header(header);
+
+   return 0;
 }
 #endif
 
@@ -208,68 +210,81 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
switch (boot_device) {
 #ifdef CONFIG_SPL_RAM_DEVICE
case BOOT_DEVICE_RAM:
-   spl_ram_load_image();
+   if (spl_ram_load_image())
+   hang();
break;
 #endif
 #ifdef CONFIG_SPL_MMC_SUPPORT
case BOOT_DEVICE_MMC1:
case BOOT_DEVICE_MMC2:
case BOOT_DEVICE_MMC2_2:
-   spl_mmc_load_image();
+   if (spl_mmc_load_image())
+   hang();
break;
 #endif
 #ifdef CONFIG_SPL_NAND_SUPPORT
case BOOT_DEVICE_NAND:
-   spl_nand_load_image();
+   if (spl_nand_load_image())
+   hang();
break;
 #endif
 #ifdef CONFIG_SPL_ONENAND_SUPPORT
case BOOT_DEVICE_ONENAND:
-   spl_onenand_load_image();
+   if (spl_onenand_load_image())
+   hang();
break;
 #endif
 #ifdef CONFIG_SPL_NOR_SUPPORT
case BOOT_DEVICE_NOR:
-   spl_nor_load_image();
+   if (spl_nor_load_image())
+   hang();
break;
 #endif
 #ifdef CONFIG_SPL_YMODEM_SUPPORT
case BOOT_DEVICE_UART:
-   spl_ymodem_load_image();
+   if (spl_ymodem_load_image())
+   hang();
break;
 #endif
 #ifdef CONFIG_SPL_SPI_SUPPORT
case BOOT_DEVICE_SPI:
-   spl_spi_load_image();
+   if 

[U-Boot] [PATCH v2 5/5] board: ti: AM57xx: Add detection logic for AM57xx-evm

2015-11-03 Thread Steve Kipisz
Current AM57xx evm supports both BeagleBoard-X15
(http://beagleboard.org/x15) and AM57xx EVM
(http://www.ti.com/tool/tmdxevm5728).

The AM572x EValuation Module(EVM) provides an affordable platform to
quickly start evaluation of Sitara. ARM Cortex-A15 AM57x Processors
(AM5728, AM5726, AM5718, AM5716) and accelerate development for HMI,
machine vision, networking, medical imaging and many other industrial
applications. This EVM is based on the same BeagleBoard-X15 Chassis
and adds mPCIe, mSATA, LCD, touchscreen, Camera, push button and TI's
wlink8 offering.

Since the EEPROM contents are compatible between the BeagleBoard-X15 and
the AM57xx-evm, we add support for the detection logic to enable
support for various user programmable scripting capability.

NOTE: U-boot configuration is currently a superset of AM57xx evm and
BeagleBoard-X15 and no additional configuration tweaking is needed.

This change also sets up the stage for future support of TI AM57xx EVMs
to the same base bootloader build.

Signed-off-by: Steve Kipisz 
---
v2 Based on:
 master a6104737 ARM: at91: sama5: change the environment address to 0x6000

Build testing: MAKEALL -s omap4 -s omap5 (no warnings/build errors)
Boot Testing:
am57xx_evm_nodt_config: http://pastebin.ubuntu.com/13039296/
beagle_x15_config: http://pastebin.ubuntu.com/13039331/

Changes in v2 (since v1):
- move the board detection code into the new routine
  do_board_detect
- eliminate board.h and move the ix_xxx into board.c
- redo commit message to be more clear

v1:  http://marc.info/?t=14460800792=1=2
 http://marc.info/?t=14460800794=1=2
(mailing list squashed original submission)

 board/ti/am57xx/board.c   | 53 +++
 include/configs/am57xx_evm.h  |  4 +++
 include/configs/ti_omap5_common.h |  2 ++
 3 files changed, 59 insertions(+)

diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 042f9ab1965a..41dd8333b1eb 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -32,6 +32,9 @@
 
 #include "mux_data.h"
 
+#define is_x15()   board_am_is("BBRDX15_")
+#define is_am572x_evm()board_am_is("AM572PM_")
+
 #ifdef CONFIG_DRIVER_TI_CPSW
 #include 
 #endif
@@ -246,6 +249,54 @@ struct vcores_data beagle_x15_volts = {
.iva.pmic   = ,
 };
 
+#ifdef CONFIG_SPL_BUILD
+/* No env to setup for SPL */
+static inline void setup_board_eeprom_env(void) { }
+
+/* Override function to read eeprom information */
+void do_board_detect(void)
+{
+   struct ti_am_eeprom *ep;
+   int rc;
+
+   rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
+ CONFIG_EEPROM_CHIP_ADDRESS, );
+   if (rc)
+   printf("ti_i2c_eeprom_init failed %d\n", rc);
+}
+
+#else  /* CONFIG_SPL_BUILD */
+
+static void setup_board_eeprom_env(void)
+{
+   char *name = NULL;
+   int rc;
+   struct ti_am_eeprom_printable p;
+
+   rc = ti_i2c_eeprom_am_get_print(CONFIG_EEPROM_BUS_ADDRESS,
+   CONFIG_EEPROM_CHIP_ADDRESS, );
+   if (rc) {
+   printf("Invalid EEPROM data(@0x%p). Default to X15\n",
+  TI_AM_EEPROM_DATA);
+   goto invalid_eeprom;
+   }
+
+   if (is_x15())
+   name = "beagle_x15";
+   else if (is_am572x_evm())
+   name = "am57xx_evm";
+   else
+   printf("Unidentified board claims %s in eeprom header\n",
+  p.name);
+
+invalid_eeprom:
+   set_board_info_env(name, "beagle_x15", p.version, p.serial);
+}
+
+/* Eeprom is alread read by SPL.. nothing more to do here.. */
+
+#endif /* CONFIG_SPL_BUILD */
+
 void hw_data_init(void)
 {
*prcm = _prcm;
@@ -265,6 +316,8 @@ int board_init(void)
 int board_late_init(void)
 {
init_sata(0);
+   setup_board_eeprom_env();
+
/*
 * DEV_CTRL.DEV_ON = 1 please - else palmas switches off in 8 seconds
 * This is the POWERHOLD-in-Low behavior.
diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index 6308cab8e680..1fffdb18fbcd 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -88,4 +88,8 @@
 #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
CONFIG_SYS_SCSI_MAX_LUN)
 
+/* EEPROM */
+#define CONFIG_EEPROM_CHIP_ADDRESS 0x50
+#define CONFIG_EEPROM_BUS_ADDRESS 0
+
 #endif /* __CONFIG_AM57XX_EVM_H */
diff --git a/include/configs/ti_omap5_common.h 
b/include/configs/ti_omap5_common.h
index 5acbc92c3f60..ae6e2a556a93 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -120,6 +120,8 @@
"setenv fdtfile dra72-evm.dtb; fi;" \
"if test $board_name = beagle_x15; then " \
"setenv fdtfile am57xx-beagle-x15.dtb; 

[U-Boot] [PATCH v2 2/5] ARM: OMAP4/5: Centralize gpi2c_init

2015-11-03 Thread Steve Kipisz
Centralize gpi2c_init into omap_common from the sys_proto header so
that the information can be reused across SoCs.

Signed-off-by: Steve Kipisz 
---
v2 Based on:
 master  a6104737 ARM: at91: sama5: change the environment address to 0x6000

Changes in v2:
 - New Patch

 arch/arm/include/asm/arch-omap4/sys_proto.h | 1 -
 arch/arm/include/asm/arch-omap5/sys_proto.h | 1 -
 arch/arm/include/asm/omap_common.h  | 3 +++
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h 
b/arch/arm/include/asm/arch-omap4/sys_proto.h
index 71e3d776aa0d..26e9a194f036 100644
--- a/arch/arm/include/asm/arch-omap4/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h
@@ -51,7 +51,6 @@ void save_omap_boot_params(void);
 void init_omap_revision(void);
 void do_io_settings(void);
 void sri2c_init(void);
-void gpi2c_init(void);
 int omap_vc_bypass_send_value(u8 sa, u8 reg_addr, u8 reg_data);
 u32 warm_reset(void);
 void force_emif_self_refresh(void);
diff --git a/arch/arm/include/asm/arch-omap5/sys_proto.h 
b/arch/arm/include/asm/arch-omap5/sys_proto.h
index b9e09e7c52a8..18902628739b 100644
--- a/arch/arm/include/asm/arch-omap5/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap5/sys_proto.h
@@ -62,7 +62,6 @@ void save_omap_boot_params(void);
 void init_omap_revision(void);
 void do_io_settings(void);
 void sri2c_init(void);
-void gpi2c_init(void);
 int omap_vc_bypass_send_value(u8 sa, u8 reg_addr, u8 reg_data);
 u32 warm_reset(void);
 void force_emif_self_refresh(void);
diff --git a/arch/arm/include/asm/omap_common.h 
b/arch/arm/include/asm/omap_common.h
index d7b81c101b79..d773b0430ad4 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -617,6 +617,9 @@ void disable_edma3_clocks(void);
 
 void omap_die_id(unsigned int *die_id);
 
+/* Initialize general purpose I2C(0) on the SoC */
+void gpi2c_init(void);
+
 /* ABB */
 #define OMAP_ABB_NOMINAL_OPP   0
 #define OMAP_ABB_FAST_OPP  1
-- 
1.9.1

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


[U-Boot] [PATCH v2 0/5] ARM: omap-common: Add board detection support for TI EVMs

2015-11-03 Thread Steve Kipisz
Several TI EVMs have onboard EEPROM that contain board description
information. The onboard EEPROM on Beaglebone, Beaglebone Black, AM335x
EVM, AM43x EVM, AM57xx EVM, Beagleboard-x15 all share the same format.

This series of patches introduces code which is generic among these
platforms. The boards can use the data for any operations they might
choose.

Lokesh Vutla (1):
  ARM: omap-common: Add standard access for board description EEPROM

Steve Kipisz (4):
  ARM: OMAP4/5: Centralize early clock initialization
  ARM: OMAP4/5: Centralize gpi2c_init
  ARM: OMAP4/5: Add generic board detection hook
  board: ti: AM57xx: Add detection logic for AM57xx-evm

 arch/arm/cpu/armv7/omap-common/Makefile|   1 +
 arch/arm/cpu/armv7/omap-common/clocks-common.c |  26 -
 arch/arm/cpu/armv7/omap-common/hwinit-common.c |  14 ++-
 arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c | 148 +
 arch/arm/include/asm/arch-omap4/sys_proto.h|   4 +-
 arch/arm/include/asm/arch-omap5/sys_proto.h|   4 +-
 arch/arm/include/asm/omap_common.h | 133 +-
 board/ti/am57xx/board.c|  53 +
 include/configs/am57xx_evm.h   |   4 +
 include/configs/ti_omap5_common.h  |   2 +
 10 files changed, 380 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c

-- 
1.9.1

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


[U-Boot] [PATCH v2 4/5] ARM: OMAP4/5: Add generic board detection hook

2015-11-03 Thread Steve Kipisz
Many TI EVMs have capability to store relevant board information
such as DDR description in EEPROM. Further many pad configuration
variations can occur as part of revision changes in the platform.
In-order to support these at runtime, we for a board detection hook
which is available for override from board files that may desire to do
so.

NOTE: All TI EVMs are capable of detecting board information based on
early clocks that are configured. However, in case of additional needs
this can be achieved within the override logic from within the board
file.

Signed-off-by: Steve Kipisz 
---
v2 Based on:
 master a61047370d0b73ab886c5863e952695b5ee0d75b

Changes in v2:
 - New patch

 arch/arm/cpu/armv7/omap-common/hwinit-common.c | 11 +++
 arch/arm/include/asm/arch-omap4/sys_proto.h|  1 +
 arch/arm/include/asm/arch-omap5/sys_proto.h|  1 +
 3 files changed, 13 insertions(+)

diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c 
b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index 91f2dead364b..9e9376d0e6e6 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -97,6 +97,16 @@ int arch_cpu_init(void)
 }
 #endif /* CONFIG_ARCH_CPU_INIT */
 
+/**
+ * do_board_detect() - Detect board description
+ *
+ * Function to detect board description. This is expected to be
+ * overridden in the SoC family board file where desired.
+ */
+void __weak do_board_detect(void)
+{
+}
+
 /*
  * Routine: s_init
  * Description: Does early system init of watchdog, muxing,  andclocks
@@ -128,6 +138,7 @@ void s_init(void)
do_io_settings();
 #endif
setup_early_clocks();
+   do_board_detect();
prcm_init();
 }
 
diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h 
b/arch/arm/include/asm/arch-omap4/sys_proto.h
index 26e9a194f036..fbb52093c65a 100644
--- a/arch/arm/include/asm/arch-omap4/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h
@@ -39,6 +39,7 @@ u32 wait_on_value(u32, u32, void *, u32);
 void sdelay(unsigned long);
 void setup_early_clocks(void);
 void prcm_init(void);
+void do_board_detect(void);
 void bypass_dpll(u32 const base);
 void freq_update_core(void);
 u32 get_sys_clk_freq(void);
diff --git a/arch/arm/include/asm/arch-omap5/sys_proto.h 
b/arch/arm/include/asm/arch-omap5/sys_proto.h
index 18902628739b..23a33cb233bb 100644
--- a/arch/arm/include/asm/arch-omap5/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap5/sys_proto.h
@@ -50,6 +50,7 @@ u32 wait_on_value(u32, u32, void *, u32);
 void sdelay(unsigned long);
 void setup_early_clocks(void);
 void prcm_init(void);
+void do_board_detect(void);
 void bypass_dpll(u32 const base);
 void freq_update_core(void);
 u32 get_sys_clk_freq(void);
-- 
1.9.1

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


[U-Boot] [PATCH v3 1/2] fdt: Deprecate "usbethaddr" usage in fdt_fixup_ethernet()

2015-11-03 Thread Bin Meng
In fdt_fixup_ethernet() only "usbethaddr" is handled to fix up the
first usb ethernet port MAC address. Other additional usb ethernet
ports are ignored as there is no logic to handle "usbeth%daddr".

It is suggested we should use "ethaddr" for all ethernet devices.
Hence deprecate "usbethaddr" usage in fdt_fixup_ethernet().

This actually reverts commit b1f49ab8c7bad60426b30c134ae065ef77d2dfc1
"ARM: fdt support: Add usbethaddr as an acceptable MAC".

Signed-off-by: Bin Meng 
Acked-by: Joe Hershberger 
Reviewed-by: Tom Rini 
On OMAP4 Panda (+ v4.3 kernel)
Tested-by: Tom Rini 

---

Changes in v3:
- Update commit message to include full commit id and subject.

Changes in v2:
- New patch to deprecate "usbethaddr" usage in fdt_fixup_ethernet()

 common/fdt_support.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index a7ff2df..ec72b86 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -490,18 +490,8 @@ void fdt_fixup_ethernet(void *fdt)
if (node < 0)
return;
 
-   if (!getenv("ethaddr")) {
-   if (getenv("usbethaddr")) {
-   strcpy(mac, "usbethaddr");
-   } else {
-   debug("No ethernet MAC Address defined\n");
-   return;
-   }
-   } else {
-   strcpy(mac, "ethaddr");
-   }
-
i = 0;
+   strcpy(mac, "ethaddr");
while ((tmp = getenv(mac)) != NULL) {
sprintf(enet, "ethernet%d", i);
path = fdt_getprop(fdt, node, enet, NULL);
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 2/2] fdt: Rewrite the logic in fdt_fixup_ethernet()

2015-11-03 Thread Bin Meng
Currently in fdt_fixup_ethernet() the MAC address fix up is
handled in a loop of which the exit condition is to test the
"eth%daddr" env is not NULL. However this creates unnecessary
constrains that those "eth%daddr" env variables must be
sequential even if "ethernet%d" does not start from 0 in the
"/aliases" node. For example, with "/aliases" node below:

aliases {
ethernet3 = 
ethernet4 = 
};

"ethaddr", "eth1addr", "eth2addr" must exist in order to fix
up ethernet3's MAC address successfully.

Now we change the loop logic to iterate the properties in the
"/aliases" node. For each property, test if it is in a format
of "ethernet%d", then get its MAC address from corresponding
"eth%daddr" env and fix it up in the dtb.

Signed-off-by: Bin Meng 
Acked-by: Joe Hershberger 
Reviewed-by: Tom Rini 
On OMAP4 Panda (+v4.3 kernel)
Tested-by: Tom Rini 

---

Changes in v3: None
Changes in v2: None

 common/fdt_support.c | 54 
 1 file changed, 33 insertions(+), 21 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index ec72b86..f7aaf9c 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -481,37 +481,49 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)
 void fdt_fixup_ethernet(void *fdt)
 {
int node, i, j;
-   char enet[16], *tmp, *end;
+   char *tmp, *end;
char mac[16];
const char *path;
unsigned char mac_addr[6];
+   int offset;
 
node = fdt_path_offset(fdt, "/aliases");
if (node < 0)
return;
 
-   i = 0;
-   strcpy(mac, "ethaddr");
-   while ((tmp = getenv(mac)) != NULL) {
-   sprintf(enet, "ethernet%d", i);
-   path = fdt_getprop(fdt, node, enet, NULL);
-   if (!path) {
-   debug("No alias for %s\n", enet);
-   sprintf(mac, "eth%daddr", ++i);
-   continue;
-   }
+   for (offset = fdt_first_property_offset(fdt, node);
+offset > 0;
+offset = fdt_next_property_offset(fdt, offset)) {
+   const char *name;
+   int len = strlen("ethernet");
+
+   path = fdt_getprop_by_offset(fdt, offset, , NULL);
+   if (!strncmp(name, "ethernet", len)) {
+   i = trailing_strtol(name);
+   if (i != -1) {
+   if (i == 0)
+   strcpy(mac, "ethaddr");
+   else
+   sprintf(mac, "eth%daddr", i);
+   } else {
+   continue;
+   }
+   tmp = getenv(mac);
+   if (!tmp)
+   continue;
+
+   for (j = 0; j < 6; j++) {
+   mac_addr[j] = tmp ?
+ simple_strtoul(tmp, , 16) : 0;
+   if (tmp)
+   tmp = (*end) ? end + 1 : end;
+   }
 
-   for (j = 0; j < 6; j++) {
-   mac_addr[j] = tmp ? simple_strtoul(tmp, , 16) : 0;
-   if (tmp)
-   tmp = (*end) ? end+1 : end;
+   do_fixup_by_path(fdt, path, "mac-address",
+_addr, 6, 0);
+   do_fixup_by_path(fdt, path, "local-mac-address",
+_addr, 6, 1);
}
-
-   do_fixup_by_path(fdt, path, "mac-address", _addr, 6, 0);
-   do_fixup_by_path(fdt, path, "local-mac-address",
-   _addr, 6, 1);
-
-   sprintf(mac, "eth%daddr", ++i);
}
 }
 
-- 
1.8.2.1

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


[U-Boot] [PATCH v4 2/3] cfi_flash: convert to driver model

2015-11-03 Thread Thomas Chou
Convert cfi flash to driver model.

Signed-off-by: Thomas Chou 
---
v2
  add dts binding.
  add more help to Kconfig.
  move struct platdata to top of file as Simon suggested.
v3
  change to MTD uclass.
v4
  fix fdt addr and size cells in cfi_flash_probe().
  move probe uclass to cfi_flash_dm_init().
  add comment as suggested by Stefan.

 doc/device-tree-bindings/mtd/mtd-physmap.txt | 88 
 drivers/mtd/Kconfig  | 11 
 drivers/mtd/cfi_flash.c  | 81 +
 drivers/mtd/cfi_mtd.c|  2 +-
 include/mtd/cfi_flash.h  |  3 +
 5 files changed, 184 insertions(+), 1 deletion(-)
 create mode 100644 doc/device-tree-bindings/mtd/mtd-physmap.txt

diff --git a/doc/device-tree-bindings/mtd/mtd-physmap.txt 
b/doc/device-tree-bindings/mtd/mtd-physmap.txt
new file mode 100644
index 000..4b8c489
--- /dev/null
+++ b/doc/device-tree-bindings/mtd/mtd-physmap.txt
@@ -0,0 +1,88 @@
+CFI or JEDEC memory-mapped NOR flash, MTD-RAM (NVRAM...)
+
+Flash chips (Memory Technology Devices) are often used for solid state
+file systems on embedded devices.
+
+ - compatible : should contain the specific model of mtd chip(s)
+   used, if known, followed by either "cfi-flash", "jedec-flash",
+   "mtd-ram" or "mtd-rom".
+ - reg : Address range(s) of the mtd chip(s)
+   It's possible to (optionally) define multiple "reg" tuples so that
+   non-identical chips can be described in one node.
+ - bank-width : Width (in bytes) of the bank.  Equal to the
+   device width times the number of interleaved chips.
+ - device-width : (optional) Width of a single mtd chip.  If
+   omitted, assumed to be equal to 'bank-width'.
+ - #address-cells, #size-cells : Must be present if the device has
+   sub-nodes representing partitions (see below).  In this case
+   both #address-cells and #size-cells must be equal to 1.
+ - no-unaligned-direct-access: boolean to disable the default direct
+   mapping of the flash.
+   On some platforms (e.g. MPC5200) a direct 1:1 mapping may cause
+   problems with JFFS2 usage, as the local bus (LPB) doesn't support
+   unaligned accesses as implemented in the JFFS2 code via memcpy().
+   By defining "no-unaligned-direct-access", the flash will not be
+   exposed directly to the MTD users (e.g. JFFS2) any more.
+ - linux,mtd-name: allow to specify the mtd name for retro capability with
+   physmap-flash drivers as boot loader pass the mtd partition via the old
+   device name physmap-flash.
+ - use-advanced-sector-protection: boolean to enable support for the
+   advanced sector protection (Spansion: PPB - Persistent Protection
+   Bits) locking.
+
+For JEDEC compatible devices, the following additional properties
+are defined:
+
+ - vendor-id : Contains the flash chip's vendor id (1 byte).
+ - device-id : Contains the flash chip's device id (1 byte).
+
+For ROM compatible devices (and ROM fallback from cfi-flash), the following
+additional (optional) property is defined:
+
+ - erase-size : The chip's physical erase block size in bytes.
+
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
+Example:
+
+   flash@ff00 {
+   compatible = "amd,am29lv128ml", "cfi-flash";
+   reg = ;
+   bank-width = <4>;
+   device-width = <1>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   fs@0 {
+   label = "fs";
+   reg = <0 f8>;
+   };
+   firmware@f8 {
+   label ="firmware";
+   reg = ;
+   read-only;
+   };
+   };
+
+Here an example with multiple "reg" tuples:
+
+   flash@f000,0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "intel,pc48f4400p0vb", "cfi-flash";
+   reg = <0 0x 0x0200
+  0 0x0200 0x0200>;
+   bank-width = <2>;
+   partition@0 {
+   label = "test-part1";
+   reg = <0 0x0400>;
+   };
+   };
+
+An example using SRAM:
+
+   sram@2,0 {
+   compatible = "samsung,k6f1616u6a", "mtd-ram";
+   reg = <2 0 0x0020>;
+   bank-width = <2>;
+   };
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 23dff48..367c4fe 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -8,6 +8,17 @@ config MTD
  flash, RAM and similar chips, often used for solid state file
  systems on embedded devices.
 
+config CFI_FLASH
+   bool "Enable Driver Model for CFI Flash driver"
+   depends on MTD
+   help
+ The Common Flash Interface specification was developed by Intel,
+ AMD and 

[U-Boot] [PATCH v4 1/3] dm: implement a MTD uclass

2015-11-03 Thread Thomas Chou
Implement a Memory Technology Device (MTD) uclass. It should
include most flash drivers in the future. Though no uclass ops
are defined yet, the MTD ops could be used.

The NAND flash driver is based on MTD. The CFI flash and SPI
flash support MTD, too. It should make sense to convert them
to MTD uclass.

Signed-off-by: Thomas Chou 
---
v3
  change to MTD uclass.
v4
  add mtd_info to flash_info in flash.h.

 drivers/mtd/Kconfig  | 12 
 drivers/mtd/Makefile |  1 +
 drivers/mtd/mtd-uclass.c | 20 
 include/dm/uclass-id.h   |  1 +
 include/flash.h  |  3 +++
 include/linux/mtd/mtd.h  |  3 +++
 include/mtd.h| 23 +++
 7 files changed, 63 insertions(+)
 create mode 100644 drivers/mtd/mtd-uclass.c
 create mode 100644 include/mtd.h

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 59278d1..23dff48 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -1,3 +1,15 @@
+menu "MTD Support"
+
+config MTD
+   bool "Enable Driver Model for MTD drivers"
+   depends on DM
+   help
+ Enable driver model for Memory Technology Devices (MTD), such as
+ flash, RAM and similar chips, often used for solid state file
+ systems on embedded devices.
+
+endmenu
+
 source "drivers/mtd/nand/Kconfig"
 
 source "drivers/mtd/spi/Kconfig"
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index a623f4c..c23c0c1 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -8,6 +8,7 @@
 ifneq (,$(findstring 
y,$(CONFIG_MTD_DEVICE)$(CONFIG_CMD_NAND)$(CONFIG_CMD_ONENAND)$(CONFIG_CMD_SF)))
 obj-y += mtdcore.o mtd_uboot.o
 endif
+obj-$(CONFIG_MTD) += mtd-uclass.o
 obj-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
 obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
 obj-$(CONFIG_HAS_DATAFLASH) += at45.o
diff --git a/drivers/mtd/mtd-uclass.c b/drivers/mtd/mtd-uclass.c
new file mode 100644
index 000..8bd3e6b
--- /dev/null
+++ b/drivers/mtd/mtd-uclass.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2015 Thomas Chou 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * Implement a MTD uclass which should include most flash drivers.
+ * The uclass private is pointed to mtd_info.
+ */
+
+UCLASS_DRIVER(mtd) = {
+   .id = UCLASS_MTD,
+   .name   = "mtd",
+};
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index 886a44c..fcc9784 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -42,6 +42,7 @@ enum uclass_id {
UCLASS_MISC,/* Miscellaneous device */
UCLASS_MMC, /* SD / MMC card or chip */
UCLASS_MOD_EXP, /* RSA Mod Exp device */
+   UCLASS_MTD, /* Memory Technology Device (MTD) device */
UCLASS_PCH, /* x86 platform controller hub */
UCLASS_PCI, /* PCI bus */
UCLASS_PCI_GENERIC, /* Generic PCI bus device */
diff --git a/include/flash.h b/include/flash.h
index dc0645e..f53ace7 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -44,6 +44,9 @@ typedef struct {
ulong   addr_unlock2;   /* unlock address 2 for AMD flash roms  
*/
const char *name;   /* human-readable name  
*/
 #endif
+#ifdef CONFIG_MTD
+   struct mtd_info *mtd;
+#endif
 } flash_info_t;
 
 extern flash_info_t flash_info[]; /* info for FLASH chips  */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index e3d3fc7..0ab6128 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -18,6 +18,7 @@
 
 #include 
 #else
+#include 
 #include 
 #include 
 #include 
@@ -272,6 +273,8 @@ struct mtd_info {
struct module *owner;
 #ifndef __UBOOT__
struct device dev;
+#else
+   struct udevice *dev;
 #endif
int usecount;
 };
diff --git a/include/mtd.h b/include/mtd.h
new file mode 100644
index 000..3f8c293
--- /dev/null
+++ b/include/mtd.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2015 Thomas Chou 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _MTD_H_
+#define _MTD_H_
+
+#include 
+
+/*
+ * Get mtd_info structure of the dev, which is stored as uclass private.
+ *
+ * @dev: The MTD device
+ * @return: pointer to mtd_info, NULL on error
+ */
+static inline struct mtd_info *mtd_get_info(struct udevice *dev)
+{
+   return dev_get_uclass_priv(dev);
+}
+
+#endif /* _MTD_H_ */
-- 
2.5.0

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


[U-Boot] [PATCH v4 3/3] nios2: use cfi flash driver model

2015-11-03 Thread Thomas Chou
Use cfi flash driver model.

Signed-off-by: Thomas Chou 
---
 configs/nios2-generic_defconfig | 2 ++
 include/configs/nios2-generic.h | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configs/nios2-generic_defconfig b/configs/nios2-generic_defconfig
index e42a15e..0a6de6f 100644
--- a/configs/nios2-generic_defconfig
+++ b/configs/nios2-generic_defconfig
@@ -17,6 +17,8 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ALTERA_PIO=y
 CONFIG_MISC=y
 CONFIG_ALTERA_SYSID=y
+CONFIG_MTD=y
+CONFIG_CFI_FLASH=y
 CONFIG_DM_ETH=y
 CONFIG_ALTERA_TSE=y
 CONFIG_ALTERA_JTAG_UART=y
diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index 3a559f1..6e426d6 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -24,13 +24,12 @@
 /*
  * CFI Flash
  */
-#define CONFIG_SYS_FLASH_BASE  0xe000
 #define CONFIG_FLASH_CFI_DRIVER
 #define CONFIG_SYS_CFI_FLASH_STATUS_POLL /* fix amd flash issue */
 #define CONFIG_SYS_FLASH_CFI
 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
 #define CONFIG_SYS_FLASH_PROTECTION
-#define CONFIG_SYS_MAX_FLASH_BANKS 1
+#define CONFIG_SYS_MAX_FLASH_BANKS_DETECT  1
 #define CONFIG_SYS_MAX_FLASH_SECT  512
 
 /*
-- 
2.5.0

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


[U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Thomas Chou
Add Altera Generic Quad SPI Controller support. The controller
converts SPI NOR flash to parallel flash interface. So it is
not like other SPI flash, but rather like CFI flash.

Signed-off-by: Thomas Chou 
---
 doc/device-tree-bindings/mtd/altera_qspi.txt |  35 +++
 drivers/mtd/Kconfig  |   9 +
 drivers/mtd/Makefile |   1 +
 drivers/mtd/altera_qspi.c| 312 +++
 4 files changed, 357 insertions(+)
 create mode 100644 doc/device-tree-bindings/mtd/altera_qspi.txt
 create mode 100644 drivers/mtd/altera_qspi.c

diff --git a/doc/device-tree-bindings/mtd/altera_qspi.txt 
b/doc/device-tree-bindings/mtd/altera_qspi.txt
new file mode 100644
index 000..3361ac9
--- /dev/null
+++ b/doc/device-tree-bindings/mtd/altera_qspi.txt
@@ -0,0 +1,35 @@
+Altera QUADSPI driver
+
+Required properties:
+- compatible: Should be "altr,quadspi-1.0"
+- reg: Address and length of the register set  for the device. It contains
+  the information of registers in the same order as described by reg-names
+- reg-names: Should contain the reg names
+  "avl_csr": Should contain the register configuration base address
+  "avl_mem": Should contain the data base address
+- #address-cells: Must be <1>.
+- #size-cells: Must be <0>.
+- flash device tree subnode, there must be a node with the following fields:
+   - compatible: Should contain the flash name:
+ 1. EPCS:   epcs16, epcs64, epcs128
+ 2. EPCQ:   epcq16, epcq32, epcq64, epcq128, epcq256, epcq512, epcq1024
+ 3. EPCQ-L: epcql256, epcql512, epcql1024
+   - #address-cells: please refer to /mtd/partition.txt
+   - #size-cells: please refer to /mtd/partition.txt
+   For partitions inside each flash, please refer to /mtd/partition.txt
+
+Example:
+
+   quadspi_controller_0: quadspi@0x180014a0 {
+   compatible = "altr,quadspi-1.0";
+   reg = <0x180014a0 0x0020>,
+ <0x1400 0x0400>;
+   reg-names = "avl_csr", "avl_mem";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   flash0: epcq512@0 {
+   compatible = "altr,epcq512";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   };
+   };
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 367c4fe..c16b1d0 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -19,6 +19,15 @@ config CFI_FLASH
  option. Visit 
  for more information on CFI.
 
+config ALTERA_QSPI
+   bool "Altera Generic Quad SPI Controller"
+   depends on MTD
+   help
+ This enables access to Altera EPCQ/EPCS flash chips using the
+ Altera Generic Quad SPI Controller. The controller converts SPI
+ NOR flash to parallel flash interface. Please find details on the
+ "Embedded Peripherals IP User Guide" of Altera.
+
 endmenu
 
 source "drivers/mtd/nand/Kconfig"
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index c23c0c1..7f018a4 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -11,6 +11,7 @@ endif
 obj-$(CONFIG_MTD) += mtd-uclass.o
 obj-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
 obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
+obj-$(CONFIG_ALTERA_QSPI) += altera_qspi.o
 obj-$(CONFIG_HAS_DATAFLASH) += at45.o
 obj-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
 obj-$(CONFIG_FLASH_CFI_MTD) += cfi_mtd.o
diff --git a/drivers/mtd/altera_qspi.c b/drivers/mtd/altera_qspi.c
new file mode 100644
index 000..06bc53e
--- /dev/null
+++ b/drivers/mtd/altera_qspi.c
@@ -0,0 +1,312 @@
+/*
+ * Copyright (C) 2015 Thomas Chou 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * The QUADSPI_MEM_OP register is used to do memory protect and erase 
operations
+ */
+#define QUADSPI_MEM_OP_BULK_ERASE  0x0001
+#define QUADSPI_MEM_OP_SECTOR_ERASE0x0002
+#define QUADSPI_MEM_OP_SECTOR_PROTECT  0x0003
+
+/*
+ * The QUADSPI_ISR register is used to determine whether an invalid write or
+ * erase operation trigerred an interrupt
+ */
+#define QUADSPI_ISR_ILLEGAL_ERASE  BIT(0)
+#define QUADSPI_ISR_ILLEGAL_WRITE  BIT(1)
+
+struct altera_qspi_regs {
+   u32 rd_status;
+   u32 rd_sid;
+   u32 rd_rdid;
+   u32 mem_op;
+   u32 isr;
+   u32 imr;
+   u32 chip_select;
+};
+
+struct altera_qspi_platdata {
+   struct altera_qspi_regs *regs;
+   void *base;
+   unsigned long size;
+};
+
+flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];   /* FLASH chips info */
+
+void flash_print_info(flash_info_t *info)
+{
+   printf("Altera QSPI flash  Size: %ld MB in %d Sectors\n",
+  

Re: [U-Boot] [PATCH] usb: udc: Fix warnings on 64-bit builds

2015-11-03 Thread Lukasz Majewski
Hi Michal,

> Cast u32 bit value to 64bit before recasting to 64bit pointer to avoid
> pointer from integer cast size mismatch warnings.
> 
> Warning log:
> +../drivers/usb/gadget/udc/udc-core.c: In function
> ‘usb_gadget_unmap_request’:
> +../drivers/usb/gadget/udc/udc-core.c:68:19: warning: cast to pointer
> from integer of different size [-Wint-to-pointer-cast]
> 
> Signed-off-by: Michal Simek 
> ---
> 
>  drivers/usb/gadget/udc/udc-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/udc-core.c
> b/drivers/usb/gadget/udc/udc-core.c index 875e998a82e3..326757b547fa
> 100644 --- a/drivers/usb/gadget/udc/udc-core.c
> +++ b/drivers/usb/gadget/udc/udc-core.c
> @@ -65,7 +65,7 @@ void usb_gadget_unmap_request(struct usb_gadget
> *gadget, if (req->length == 0)
>   return;
>  
> - dma_unmap_single((void *)req->dma, req->length,
> + dma_unmap_single((void *)(uintptr_t)req->dma, req->length,
>is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
>  }
>  EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);

Acked-by: Lukasz Majewski 

-- 
Best regards,

Lukasz Majewski

Samsung R Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH 5/8] net: ipv6 support

2015-11-03 Thread Chris Packham
Hi Joe,

I've answered a few questions below. I'll address your comments more
completely before sending another round next week (or I can sit on it
for longer if you want me to give you some breathing room).

On Tue, Nov 3, 2015 at 9:43 AM, Joe Hershberger
 wrote:
> Hi Chris,
>
> On Mon, Oct 12, 2015 at 2:43 AM, Chris Packham  
> wrote:
>> Adds basic support for IPv6. Neighbor discovery and ping6 are the only
>> things supported at the moment.
>>
>> Helped-by: Hanna Hawa  [endian & alignment fixes]
>> Signed-off-by: Chris Packham 
>> ---
>> Now we have something functional. With this you can do something like
>> 'setenv ipaddr6 3ffe::2' and 'ping6 3ffe::1' should work.
>>
>> I seem to have a problem that when you send a ping6 for a non-existent
>> address that ends up stuck and the next non-ipv6 net operation tries to
>> resolve it. I suspect this is because the pending neighbor discovery
>> information isn't cleaned up properly, I need to look into that.
>>
>> The environment variable prefixlength6 is a bit fiddly. No-one uses a
>> netmask6 (it'd mean a lot of ::...) it's almost always done by
>> including the prefix length in the address (e.g. ip addr add
>> 2001:db8::1/64) I'm contemplating adopting that syntax and dropping
>> prefixlength6.
>>
>> This patch is bigger than I'd like it to be but I'm not sure how to
>> split it up and keep the parts build able.
>
> It is pretty huge. It's taken me a while to get through it.
>

Thanks for making the effort to review. I realise it's pretty huge and
I'll put some effort into splitting it futher. One obvious thing that
could be split out is the new environment variables.

>>  common/Kconfig |  15 ++
>>  common/cmd_net.c   |  28 
>>  include/env_callback.h |   9 ++
>>  include/env_flags.h|  10 ++
>>  include/net.h  |   5 +-
>>  include/net6.h | 212 
>>  net/Kconfig|   5 +
>>  net/Makefile   |   3 +
>>  net/ndisc.c| 269 +++
>>  net/ndisc.h|  27 
>>  net/net.c  |  36 -
>>  net/net6.c | 375 
>> +
>>  net/ping6.c| 111 +++
>>  13 files changed, 1102 insertions(+), 3 deletions(-)
>>  create mode 100644 net/ndisc.c
>>  create mode 100644 net/ndisc.h
>>  create mode 100644 net/net6.c
>>  create mode 100644 net/ping6.c
>>
>> diff --git a/common/Kconfig b/common/Kconfig
>> index 2c42b8e..c72563d 100644
>> --- a/common/Kconfig
>> +++ b/common/Kconfig
>> @@ -389,6 +389,15 @@ config CMD_NET
>>   bootp - boot image via network using BOOTP/TFTP protocol
>>   tftpboot - boot image via network using TFTP protocol
>>
>> +config CMD_NET6
>> +   bool "ipv6 commands"
>> +   select NET
>> +   select NET6
>> +   default n
>> +   help
>> + IPv6 network commands
>> + tftpboot6 - boot image via network using TFTP protocol
>
> This is added in the next patch, so should probably move there.
>

Will do.

>> +
>>  config CMD_TFTPPUT
>> bool "tftp put"
>> help
>> @@ -420,6 +429,12 @@ config CMD_PING
>> help
>>   Send ICMP ECHO_REQUEST to network host
>>
>> +config CMD_PING6
>> +   bool "ping6"
>> +   depends on CMD_NET6
>> +   help
>> + Send ICMPv6 ECHO_REQUEST to network host
>
> What makes ping inseparable from the core support?
>

Mainly testing, I can't test the core code without ping. But I can see
that from a patch submission point of few splitting it out will make
review easier.

>> +
>>  config CMD_CDP
>> bool "cdp"
>> help
>> diff --git a/common/cmd_net.c b/common/cmd_net.c
>> index b2f3c7b..271f91d 100644
>> --- a/common/cmd_net.c
>> +++ b/common/cmd_net.c
>> @@ -11,6 +11,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>
>>  static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []);
>>
>> @@ -284,6 +285,33 @@ U_BOOT_CMD(
>>  );
>>  #endif
>>
>> +#ifdef CONFIG_CMD_PING6
>> +int do_ping6(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>> +{
>> +   if (argc < 2)
>> +   return -1;
>> +
>> +   if (string_to_ip6(argv[1], _ping_ip6) != 0)
>> +   return CMD_RET_USAGE;
>> +
>> +   if (net_loop(PING6) < 0) {
>> +   printf("ping6 failed; host %pI6c is not alive\n",
>> +  _ping_ip6);
>> +   return 1;
>> +   }
>> +
>> +   printf("host %pI6c is alive\n", _ping_ip6);
>> +
>> +   return 0;
>> +}
>> +
>> +U_BOOT_CMD(
>> +   ping6,  2,  1,  do_ping6,
>> +   "send ICMPv6 ECHO_REQUEST to network host",
>> +   "pingAddress"
>> +);
>> +#endif /* CONFIG_CMD_PING6 */
>> +
>>  #if defined(CONFIG_CMD_CDP)
>>
>>  static void cdp_update_env(void)
>> diff --git a/include/env_callback.h 

Re: [U-Boot] [PATCH V2 11/13] spl: announce boot devices

2015-11-03 Thread Nikita Kiryanov
On Thu, Oct 29, 2015 at 11:19:53AM -0600, Simon Glass wrote:
> Hi Nikita,
> 
> On 28 October 2015 at 03:23, Nikita Kiryanov  wrote:
> > Now that we support alternative boot devices, it can sometimes be
> > unclear which boot devices was actually used. Provide a function to
> > announce which boot devices are attempted during boot.
> >
> > Signed-off-by: Nikita Kiryanov 
> > Cc: Igor Grinberg 
> > Cc: Tom Rini 
> > Cc: Simon Glass 
> > ---
> > Changes in V2:
> > - No changes.
> >
> >  common/spl/spl.c | 86 
> > 
> >  1 file changed, 86 insertions(+)
> >
> > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > index 7913c52..ee30290 100644
> > --- a/common/spl/spl.c
> > +++ b/common/spl/spl.c
> > @@ -178,6 +178,91 @@ int spl_init(void)
> > return 0;
> >  }
> >
> > +#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
> > +__weak void spl_board_announce_boot_device(void) { }
> > +#endif
> > +
> > +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> > +static void announce_boot_device(u32 boot_device)
> > +{
> > +   puts("Trying to boot from ");
> > +   switch (boot_device) {
> > +#ifdef CONFIG_SPL_RAM_DEVICE
> > +   case BOOT_DEVICE_RAM:
> > +   puts("RAM");
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_MMC_SUPPORT
> > +   case BOOT_DEVICE_MMC1:
> > +   case BOOT_DEVICE_MMC2:
> > +   case BOOT_DEVICE_MMC2_2:
> > +   puts("MMC");
> > +   break;
> > +#endif
> 
> Perhaps we need a table of function pointers with the name for each?
> This code seems very repetitive.

Or BOOT_DEVICE_* -> name. It'll still have a lot of repetitive lines but
I guess the function itself will look nicer. I'll prepare something in a
V3..

> 
> > +#ifdef CONFIG_SPL_NAND_SUPPORT
> > +   case BOOT_DEVICE_NAND:
> > +   puts("NAND");
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_ONENAND_SUPPORT
> > +   case BOOT_DEVICE_ONENAND:
> > +   puts("OneNAND");
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_NOR_SUPPORT
> > +   case BOOT_DEVICE_NOR:
> > +   puts("NOR");
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_YMODEM_SUPPORT
> > +   case BOOT_DEVICE_UART:
> > +   puts("UART");
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_SPI_SUPPORT
> > +   case BOOT_DEVICE_SPI:
> > +   puts("SPI");
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_ETH_SUPPORT
> > +   case BOOT_DEVICE_CPGMAC:
> > +#ifdef CONFIG_SPL_ETH_DEVICE
> > +   puts("eth device");
> > +#else
> > +   puts("net");
> > +#endif
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_USBETH_SUPPORT
> > +   case BOOT_DEVICE_USBETH:
> > +   puts("USB eth");
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_USB_SUPPORT
> > +   case BOOT_DEVICE_USB:
> > +   puts("USB");
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_SATA_SUPPORT
> > +   case BOOT_DEVICE_SATA:
> > +   puts("SATA");
> > +   break;
> > +#endif
> > +#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
> > +   case BOOT_DEVICE_BOARD:
> > +   spl_board_announce_boot_device();
> > +   break;
> > +#endif
> > +   default:
> > +   printf("%d (unknown boot device)", boot_device);
> > +   }
> > +
> > +   puts("\n");
> > +}
> > +#else
> > +static inline void announce_boot_device(u32 boot_device) { }
> > +#endif
> > +
> >  #ifndef BOOT_DEVICE_NONE
> >  #define BOOT_DEVICE_NONE 0xdeadbeef
> >  #endif
> > @@ -292,6 +377,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> > board_boot_order(spl_boot_list);
> > for (i = 0; i < ARRAY_SIZE(spl_boot_list) &&
> > spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
> > +   announce_boot_device(spl_boot_list[i]);
> > if (!spl_load_image(spl_boot_list[i]))
> > break;
> > }
> > --
> > 1.9.1
> >
> 
> Regards,
> Simon
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] altera_jtag_uart: Adjust the declaration of debug_uart_init()

2015-11-03 Thread Marek Vasut
On Tuesday, November 03, 2015 at 07:19:34 AM, Thomas Chou wrote:
> Follow commit 97b059730218 ("debug_uart: Adjust the declaration of
> debug_uart_init()")
> 
> Signed-off-by: Thomas Chou 

Reviewed-by: Marek Vasut 

> ---
>  drivers/serial/altera_jtag_uart.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/serial/altera_jtag_uart.c
> b/drivers/serial/altera_jtag_uart.c index 767603c..5f0d7ac 100644
> --- a/drivers/serial/altera_jtag_uart.c
> +++ b/drivers/serial/altera_jtag_uart.c
> @@ -130,7 +130,7 @@ U_BOOT_DRIVER(altera_jtaguart) = {
> 
>  #include 
> 
> -void debug_uart_init(void)
> +void _debug_uart_init(void)
>  {
>  }

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


[U-Boot] [PATCH v1 00/12] sparc: Updates to SPARC architecture in preperation for generic board

2015-11-03 Thread Francois Retief

This patch series is a backlog of preparation work for upcomming
generic board changes.

I first want to get these reviewed and submitted to mainline before
sending out more patches.


Daniel Hellstrom (4):
  sparc: leon3: Reimplemented AMBA Plug scanning routines.
  sparc: leon3: Added memory controller initialization using new AMBA
PnP routines.
  sparc: leon3: Moved GRLIB core header files to common include/grlib
directory
  sparc: ambapp: Removed warning and unnecessary printout.

Francois Retief (8):
  sparc: Fix broken files during license changes
  sparc: Update the maintainer for SPARC architecture
  sparc: Add -mcpu= compiler flags for LEON2/LEON3
  sparc: Update LEON serial drivers to use readl/writel macros
  sparc: Update GRSIM board with memory settings for TSIM eval
  sparc: Update startup code to take PIC mode into account
  sparc: Kconfig: Move the CMD_AMBAPP command to Kconfig
  sparc: leon3: Add debug_uart support to LEON3 serial driver.

 MAINTAINERS  |   2 +-
 arch/sparc/config.mk |  14 +-
 arch/sparc/cpu/leon2/serial.c| 125 +++---
 arch/sparc/cpu/leon2/start.S |  60 ++-
 arch/sparc/cpu/leon3/Makefile|   3 +-
 arch/sparc/cpu/leon3/ambapp.c| 545 
 arch/sparc/cpu/leon3/ambapp_low.S| 784 +++
 arch/sparc/cpu/leon3/ambapp_low_c.S  | 113 +
 arch/sparc/cpu/leon3/cpu_init.c  | 199 +++--
 arch/sparc/cpu/leon3/interrupts.c|   7 +-
 arch/sparc/cpu/leon3/memcfg.c| 237 +++
 arch/sparc/cpu/leon3/memcfg.h|  90 
 arch/sparc/cpu/leon3/memcfg_low.S| 253 +++
 arch/sparc/cpu/leon3/prom.c  |  12 +-
 arch/sparc/cpu/leon3/serial.c| 130 --
 arch/sparc/cpu/leon3/start.S | 102 -
 arch/sparc/cpu/leon3/usb_uhci.c  |   4 +-
 arch/sparc/include/asm/global_data.h |   1 +
 arch/sparc/include/asm/io.h  |  64 +--
 arch/sparc/include/asm/winmacro.h| 127 --
 common/Kconfig   |  14 +
 common/board_r.c |  21 +
 common/cmd_ambapp.c  | 559 +++--
 configs/grsim_defconfig  |   6 +
 drivers/net/greth.c  |  17 +-
 drivers/serial/Kconfig   |   8 +
 include/ambapp.h | 488 --
 include/ambapp_ids.h | 250 +++
 include/config_cmd_all.h |   1 -
 include/configs/gr_cpci_ax2000.h |  35 +-
 include/configs/gr_ep2s60.h  |  40 +-
 include/configs/gr_xc3s_1500.h   |  31 +-
 include/configs/grsim.h  |  88 ++--
 include/configs/grsim_leon2.h|   5 -
 include/grlib/apbuart.h  |  47 +++
 include/grlib/gptimer.h  |  34 ++
 include/grlib/greth.h|  87 
 include/grlib/irqmp.h|  23 +
 38 files changed, 3354 insertions(+), 1272 deletions(-)
 create mode 100644 arch/sparc/cpu/leon3/ambapp_low.S
 create mode 100644 arch/sparc/cpu/leon3/ambapp_low_c.S
 create mode 100644 arch/sparc/cpu/leon3/memcfg.c
 create mode 100644 arch/sparc/cpu/leon3/memcfg.h
 create mode 100644 arch/sparc/cpu/leon3/memcfg_low.S
 create mode 100644 include/ambapp_ids.h
 create mode 100644 include/grlib/apbuart.h
 create mode 100644 include/grlib/gptimer.h
 create mode 100644 include/grlib/greth.h
 create mode 100644 include/grlib/irqmp.h

--
2.4.3



Disclaimer and confidentiality note – refer to our website for further details: 
www.spaceteq.co.za 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 04/12] sparc: Update LEON serial drivers to use readl/writel macros

2015-11-03 Thread Francois Retief
Update the LEON2/3 serial driver to make use of the readl and writel
macros as well as the WATCHDOG_RESET() macro.

Add readl/writel and friends to the asm/io.h file.

Introduce the gd->arch.uart variable to store register address.

Lastly, remove baudrate scaler macro variables from board config. It
is now calculated in the serial driver using the global data variable.

Signed-off-by: Francois Retief 
---

 arch/sparc/cpu/leon2/serial.c| 125 +--
 arch/sparc/cpu/leon3/prom.c  |   5 +-
 arch/sparc/cpu/leon3/serial.c| 100 
 arch/sparc/include/asm/global_data.h |   1 +
 arch/sparc/include/asm/io.h  |  64 ++
 include/configs/gr_cpci_ax2000.h |   4 --
 include/configs/gr_ep2s60.h  |   4 --
 include/configs/gr_xc3s_1500.h   |   4 --
 include/configs/grsim.h  |   3 -
 include/configs/grsim_leon2.h|   5 --
 10 files changed, 157 insertions(+), 158 deletions(-)

diff --git a/arch/sparc/cpu/leon2/serial.c b/arch/sparc/cpu/leon2/serial.c
index 5cfbb9e..603364e 100644
--- a/arch/sparc/cpu/leon2/serial.c
+++ b/arch/sparc/cpu/leon2/serial.c
@@ -1,72 +1,78 @@
 /* GRLIB APBUART Serial controller driver
  *
- * (C) Copyright 2008
- * Daniel Hellstrom, Gaisler Research, dan...@gaisler.com.
+ * (C) Copyright 2008, 2015
+ * Daniel Hellstrom, Cobham Gaisler, dan...@gaisler.com.
  *
  * SPDX-License-Identifier:GPL-2.0+
  */

 #include 
-#include 
-#include 
+#include 
 #include 
-#include 
+#include 

 DECLARE_GLOBAL_DATA_PTR;

+static unsigned leon2_serial_calc_scaler(unsigned freq, unsigned baud)
+{
+   return (((freq*10) / (baud*8)) - 5) / 10;
+}
+
 static int leon2_serial_init(void)
 {
-   LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
+   LEON2_regs *leon2 = (LEON2_regs *)LEON2_PREGS;
LEON2_Uart_regs *regs;
unsigned int tmp;

-   /* Init LEON2 UART
-*
-* Set scaler / baud rate
-*
-* Receiver & transmitter enable
-*/
 #if LEON2_CONSOLE_SELECT == LEON_CONSOLE_UART1
-   regs = (LEON2_Uart_regs *) & leon2->UART_Channel_1;
+   regs = (LEON2_Uart_regs *)>UART_Channel_1;
 #else
-   regs = (LEON2_Uart_regs *) & leon2->UART_Channel_2;
+   regs = (LEON2_Uart_regs *)>UART_Channel_2;
 #endif

-   regs->UART_Scaler = CONFIG_SYS_LEON2_UART1_SCALER;
+   /* Set scaler / baud rate */
+   tmp = leon2_serial_calc_scaler(CONFIG_SYS_CLK_FREQ, CONFIG_BAUDRATE);
+   writel(tmp, >UART_Scaler);

/* Let bit 11 be unchanged (debug bit for GRMON) */
-   tmp = READ_WORD(regs->UART_Control);
+   tmp = readl(>UART_Control) & LEON2_UART_CTRL_DBG;
+   tmp |= (LEON2_UART1_LOOPBACK_ENABLE << 7);
+   tmp |= (LEON2_UART1_FLOWCTRL_ENABLE << 6);
+   tmp |= (LEON2_UART1_PARITY_ENABLE << 5);
+   tmp |= (LEON2_UART1_ODDPAR_ENABLE << 4);
+   /* Receiver & transmitter enable */
+   tmp |= (LEON2_UART_CTRL_RE | LEON2_UART_CTRL_TE);
+   writel(tmp, >UART_Control);
+
+   gd->arch.uart = regs;
+   return 0;
+}

-   regs->UART_Control = ((tmp & LEON2_UART_CTRL_DBG) |
- (LEON2_UART1_LOOPBACK_ENABLE << 7) |
- (LEON2_UART1_FLOWCTRL_ENABLE << 6) |
- (LEON2_UART1_PARITY_ENABLE << 5) |
- (LEON2_UART1_ODDPAR_ENABLE << 4) |
- LEON2_UART_CTRL_RE | LEON2_UART_CTRL_TE);
+static inline LEON2_Uart_regs *leon2_get_uart_regs(void)
+{
+   LEON2_Uart_regs *uart = gd->arch.uart;

-   return 0;
+   return uart;
 }

 static void leon2_serial_putc_raw(const char c)
 {
-   LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
-   LEON2_Uart_regs *regs;
+   LEON2_Uart_regs *uart = leon2_get_uart_regs();

-#if LEON2_CONSOLE_SELECT == LEON_CONSOLE_UART1
-   regs = (LEON2_Uart_regs *) & leon2->UART_Channel_1;
-#else
-   regs = (LEON2_Uart_regs *) & leon2->UART_Channel_2;
-#endif
+   if (!uart)
+   return;

/* Wait for last character to go. */
-   while (!(READ_WORD(regs->UART_Status) & LEON2_UART_STAT_THE)) ;
+   while (!(readl(>UART_Status) & LEON2_UART_STAT_THE))
+   WATCHDOG_RESET();

/* Send data */
-   regs->UART_Channel = c;
+   writel(c, >UART_Channel);

 #ifdef LEON_DEBUG
/* Wait for data to be sent */
-   while (!(READ_WORD(regs->UART_Status) & LEON2_UART_STAT_TSE)) ;
+   while (!(readl(>UART_Status) & LEON2_UART_STAT_TSE))
+   WATCHDOG_RESET();
 #endif
 }

@@ -80,56 +86,43 @@ static void leon2_serial_putc(const char c)

 static int leon2_serial_getc(void)
 {
-   LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
-   LEON2_Uart_regs *regs;
+   LEON2_Uart_regs *uart = leon2_get_uart_regs();

-#if LEON2_CONSOLE_SELECT == LEON_CONSOLE_UART1
-   regs = (LEON2_Uart_regs *) & leon2->UART_Channel_1;

[U-Boot] [PATCH v1 05/12] sparc: Update GRSIM board with memory settings for TSIM eval

2015-11-03 Thread Francois Retief
Update the GRSIM board with the memory settings for the evaluation
version of TSIM. This free version of TSIM is used for testing.

Signed-off-by: Francois Retief 
---

 configs/grsim_defconfig |  1 +
 include/configs/grsim.h | 57 ++---
 2 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/configs/grsim_defconfig b/configs/grsim_defconfig
index f0fa23f..b0295f2 100644
--- a/configs/grsim_defconfig
+++ b/configs/grsim_defconfig
@@ -11,4 +11,5 @@ CONFIG_SYS_TEXT_BASE=0x
 # CONFIG_CMD_MEMORY is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
+# CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
diff --git a/include/configs/grsim.h b/include/configs/grsim.h
index 8959e33..a538785 100644
--- a/include/configs/grsim.h
+++ b/include/configs/grsim.h
@@ -19,9 +19,13 @@
  *
  * Select between TSIM or GRSIM by setting CONFIG_GRSIM or CONFIG_TSIM to 1.
  *
- * TSIM command
- *  tsim-leon3 -sdram 0 -ram 32000 -rom 8192 -mmu
+ * TSIM command:
+ * $ tsim-leon3 -sdram 32768 -ram 4096 -rom 2048 -mmu -cas
  *
+ * In the evaluation version of TSIM, the -sdram/-ram/-rom arguments are
+ * hard-coded to these values and need not be specified. (see below)
+ *
+ * Get TSIM from http://www.gaisler.com/index.php/downloads/simulators
  */

 #define CONFIG_GRSIM   0   /* ... not running on GRSIM */
@@ -184,18 +188,18 @@
 /*
  * Memory map
  */
-#define CONFIG_SYS_SDRAM_BASE  0x4000
-#define CONFIG_SYS_SDRAM_SIZE  0x0200
-#define CONFIG_SYS_SDRAM_END   
(CONFIG_SYS_SDRAM_BASE+CONFIG_SYS_SDRAM_SIZE)
+#define CONFIG_SYS_SDRAM_BASE  0x6000
+#define CONFIG_SYS_SDRAM_SIZE  0x0200 /* 32MiB SDRAM */
+#define CONFIG_SYS_SDRAM_END   (CONFIG_SYS_SDRAM_BASE + 
CONFIG_SYS_SDRAM_SIZE)

-/* no SRAM available */
-#undef CONFIG_SYS_SRAM_BASE
-#undef CONFIG_SYS_SRAM_SIZE
+#define CONFIG_SYS_SRAM_BASE   0x4000
+#define CONFIG_SYS_SRAM_SIZE   0x0040 /* 4MiB SRAM */
+#define CONFIG_SYS_SRAM_END(CONFIG_SYS_SRAM_BASE + 
CONFIG_SYS_SRAM_SIZE)

 /* Always Run U-Boot from SDRAM */
-#define CONFIG_SYS_RAM_BASE CONFIG_SYS_SDRAM_BASE
-#define CONFIG_SYS_RAM_SIZE CONFIG_SYS_SDRAM_SIZE
-#define CONFIG_SYS_RAM_END CONFIG_SYS_SDRAM_END
+#define CONFIG_SYS_RAM_BASECONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_RAM_SIZECONFIG_SYS_SDRAM_SIZE
+#define CONFIG_SYS_RAM_END CONFIG_SYS_SDRAM_END

 #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_RAM_END - 
GENERATED_GBL_DATA_SIZE)

@@ -224,6 +228,7 @@
 /* make un relocated address from relocated address */
 #define UN_RELOC(address) 
(address-(CONFIG_SYS_RELOC_MONITOR_BASE-CONFIG_SYS_TEXT_BASE))

+#ifdef CONFIG_CMD_NET
 /*
  * Ethernet configuration
  */
@@ -235,6 +240,8 @@
 /* #define CONFIG_GRETH_10MBIT 1 */
 #define CONFIG_PHY_ADDR0x00

+#endif /* CONFIG_CMD_NET */
+
 /*
  * Miscellaneous configurable options
  */
@@ -259,13 +266,14 @@
 /*#define CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP*/

 #define CONFIG_SYS_GRLIB_SDRAM 0
+
 #define CONFIG_SYS_GRLIB_MEMCFG1   (0x00ff | (1<<11))
 #if CONFIG_GRSIM
 /* GRSIM configuration */
 #define CONFIG_SYS_GRLIB_MEMCFG2   0x82206000
 #else
 /* TSIM configuration */
-#define CONFIG_SYS_GRLIB_MEMCFG2   0x1820
+#define CONFIG_SYS_GRLIB_MEMCFG2   0x81805220
 #endif
 #define CONFIG_SYS_GRLIB_MEMCFG3   0x00136000

@@ -285,4 +293,29 @@

 #define CONFIG_IDENT_STRING "Gaisler GRSIM"

+/* TSIM command:
+ * $ ./tsim-leon3 -mmu -cas
+ *
+ *  This TSIM evaluation version will expire 2015-04-02
+ *
+ *
+ *  TSIM/LEON3 SPARC simulator, version 2.0.35 (evaluation version)
+ *
+ *  Copyright (C) 2014, Aeroflex Gaisler - all rights reserved.
+ *  This software may only be used with a valid license.
+ *  For latest updates, go to http://www.gaisler.com/
+ *  Comments or bug-reports to supp...@gaisler.com
+ *
+ * serial port A on stdin/stdout
+ * allocated 4096 K SRAM memory, in 1 bank
+ * allocated 32 M SDRAM memory, in 1 bank
+ * allocated 2048 K ROM memory
+ * icache: 1 * 4 kbytes, 16 bytes/line (4 kbytes total)
+ * dcache: 1 * 4 kbytes, 16 bytes/line (4 kbytes total)
+ * tsim> leon
+ * 0x8000   Memory configuration register 1   0x02ff
+ * 0x8004   Memory configuration register 2   0x81805220
+ * 0x8008   Memory configuration register 3   0x
+ */
+
 #endif /* __CONFIG_H */
--
2.4.3



Disclaimer and confidentiality note – refer to our website for further details: 
www.spaceteq.co.za 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 08/12] sparc: Kconfig: Move the CMD_AMBAPP command to Kconfig

2015-11-03 Thread Francois Retief
Add an initr function in the board_r.c file for the AMBA Plug
command. Add a Kconfig entry for the ambapp command and remove all
CONFIG_CMD_AMBAPP defines from the board configuration headers.

Add a Kconfig entry to display the AMBA Plug information
on startup. This option is off by default. Remove relevent define
from board configuration headers.

Signed-off-by: Francois Retief 
---

 common/Kconfig   | 14 ++
 common/board_r.c | 21 +
 configs/grsim_defconfig  |  1 +
 include/config_cmd_all.h |  1 -
 include/configs/gr_cpci_ax2000.h |  4 
 include/configs/gr_ep2s60.h  |  4 
 include/configs/gr_xc3s_1500.h   |  4 
 include/configs/grsim.h  |  4 
 8 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index 0388a6c..440cb37 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -455,6 +455,20 @@ endmenu

 menu "Misc commands"

+config CMD_AMBAPP
+   bool "ambapp"
+   depends on LEON3
+   default y
+   help
+ Lists AMBA Plug-n-Play information.
+
+config SYS_AMBAPP_PRINT_ON_STARTUP
+   bool "Show AMBA PnP info on startup"
+   depends on CMD_AMBAPP
+   default n
+   help
+ Show AMBA Plug-n-Play information on startup.
+
 config CMD_TIME
bool "time"
help
diff --git a/common/board_r.c b/common/board_r.c
index c4fd3ea..32cb4b7 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -46,6 +46,9 @@
 #include 
 #include 
 #include 
+#ifdef CONFIG_CMD_AMBAPP
+#include 
+#endif
 #ifdef CONFIG_ADDR_MAP
 #include 
 #endif
@@ -559,6 +562,18 @@ static int initr_status_led(void)
 }
 #endif

+#if defined(CONFIG_CMD_AMBAPP) && defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP)
+extern int do_ambapp_print(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[]);
+
+static int initr_ambapp_print(void)
+{
+   puts("AMBA:\n");
+   do_ambapp_print(NULL, 0, 0, NULL);
+
+   return 0;
+}
+#endif
+
 #if defined(CONFIG_CMD_SCSI)
 static int initr_scsi(void)
 {
@@ -851,6 +866,12 @@ init_fnc_t init_sequence_r[] = {
 #ifdef CONFIG_BOARD_LATE_INIT
board_late_init,
 #endif
+#if defined(CONFIG_CMD_AMBAPP)
+   ambapp_init_reloc,
+#if defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP)
+   initr_ambapp_print,
+#endif
+#endif
 #ifdef CONFIG_CMD_SCSI
INIT_FUNC_WATCHDOG_RESET
initr_scsi,
diff --git a/configs/grsim_defconfig b/configs/grsim_defconfig
index b0295f2..a5ea7ab 100644
--- a/configs/grsim_defconfig
+++ b/configs/grsim_defconfig
@@ -13,3 +13,4 @@ CONFIG_SYS_TEXT_BASE=0x
 # CONFIG_CMD_SETEXPR is not set
 # CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
+CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP=y
diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h
index 8832552..424721b 100644
--- a/include/config_cmd_all.h
+++ b/include/config_cmd_all.h
@@ -13,7 +13,6 @@
  * Alphabetical list of all possible commands.
  */

-#define CONFIG_CMD_AMBAPP  /* AMBA Plug & Play Bus print utility */
 #define CONFIG_CMD_ASKENV  /* ask for env variable */
 #define CONFIG_CMD_BEDBUG  /* Include BedBug Debugger  */
 #define CONFIG_CMD_BMP /* BMP support  */
diff --git a/include/configs/gr_cpci_ax2000.h b/include/configs/gr_cpci_ax2000.h
index 060f116..8461787 100644
--- a/include/configs/gr_cpci_ax2000.h
+++ b/include/configs/gr_cpci_ax2000.h
@@ -60,7 +60,6 @@
  * Supported commands
  */
 #define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_AMBAPP
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DIAG
 #define CONFIG_CMD_IRQ
@@ -311,9 +310,6 @@

 /* Gaisler GRLIB IP-Cores Config /

-/* AMBA Plug & Play info display on startup */
-/*#define CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP*/
-
 #define CONFIG_SYS_GRLIB_SDRAM0

 /* See, GRLIB Docs (grip.pdf) on how to set up
diff --git a/include/configs/gr_ep2s60.h b/include/configs/gr_ep2s60.h
index 005f779..2f953ae 100644
--- a/include/configs/gr_ep2s60.h
+++ b/include/configs/gr_ep2s60.h
@@ -54,7 +54,6 @@
  * Supported commands
  */
 #define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_AMBAPP
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DIAG
 #define CONFIG_CMD_IRQ
@@ -288,9 +287,6 @@

 /* Gaisler GRLIB IP-Cores Config /

-/* AMBA Plug & Play info display on startup */
-/*#define CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP*/
-
 #define CONFIG_SYS_GRLIB_SDRAM0

 /* See, GRLIB Docs (grip.pdf) on how to set up
diff --git a/include/configs/gr_xc3s_1500.h b/include/configs/gr_xc3s_1500.h
index 3523cde..428b532 100644
--- a/include/configs/gr_xc3s_1500.h
+++ b/include/configs/gr_xc3s_1500.h
@@ -41,7 +41,6 @@
  * Supported commands
  */
 #define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_AMBAPP
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DIAG
 #define CONFIG_CMD_IRQ
@@ -251,9 +250,6 @@

 /* Gaisler GRLIB IP-Cores Config /

-/* AMBA Plug & Play info display on startup */
-/*#define 

[U-Boot] [PATCH v1 12/12] sparc: leon3: Add debug_uart support to LEON3 serial driver.

2015-11-03 Thread Francois Retief
Signed-off-by: Francois Retief 
---

 arch/sparc/cpu/leon3/cpu_init.c |  5 -
 arch/sparc/cpu/leon3/serial.c   | 27 ++-
 configs/grsim_defconfig |  4 
 drivers/serial/Kconfig  |  8 
 4 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c
index 40d1751..b140da3 100644
--- a/arch/sparc/cpu/leon3/cpu_init.c
+++ b/arch/sparc/cpu/leon3/cpu_init.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 

@@ -50,7 +51,9 @@ struct {
  */
 void cpu_init_f(void)
 {
-
+#ifdef CONFIG_DEBUG_UART
+   debug_uart_init();
+#endif
 }

 /* Routine called from start.S,
diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c
index cefb9d2..66b3773 100644
--- a/arch/sparc/cpu/leon3/serial.c
+++ b/arch/sparc/cpu/leon3/serial.c
@@ -28,8 +28,10 @@ static int leon3_serial_init(void)

/* find UART */
if (ambapp_apb_find(_plb, VENDOR_GAISLER, GAISLER_APBUART,
-   CONFIG_SYS_GRLIB_APBUART_INDEX, ) != 1)
+   CONFIG_SYS_GRLIB_APBUART_INDEX, ) != 1) {
+   panic("%s: apbuart not found!\n", __func__);
return -1; /* didn't find hardware */
+   }

/* found apbuart, let's init .. */
uart = (ambapp_dev_apbuart *) apbdev.address;
@@ -145,3 +147,26 @@ __weak struct serial_device *default_serial_console(void)
 {
return _serial_drv;
 }
+
+#ifdef CONFIG_DEBUG_UART_APBUART
+
+#include 
+
+static inline void _debug_uart_init(void)
+{
+   ambapp_dev_apbuart *uart = (ambapp_dev_apbuart *)CONFIG_DEBUG_UART_BASE;
+   uart->scaler = (((CONFIG_DEBUG_UART_CLOCK*10) / (CONFIG_BAUDRATE*8)) - 
5)/10;
+   uart->ctrl = APBUART_CTRL_RE | APBUART_CTRL_TE;
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+   ambapp_dev_apbuart *uart = (ambapp_dev_apbuart *)CONFIG_DEBUG_UART_BASE;
+   while (!(readl(>status) & APBUART_STATUS_THE))
+   WATCHDOG_RESET();
+   writel(ch, >data);
+}
+
+DEBUG_UART_FUNCS
+
+#endif
diff --git a/configs/grsim_defconfig b/configs/grsim_defconfig
index a5ea7ab..d2f709f 100644
--- a/configs/grsim_defconfig
+++ b/configs/grsim_defconfig
@@ -14,3 +14,7 @@ CONFIG_SYS_TEXT_BASE=0x
 # CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
 CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_APBUART=y
+CONFIG_DEBUG_UART_BASE=0x8100
+CONFIG_DEBUG_UART_CLOCK=4000
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 53b4e1b..79e92e8 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -91,6 +91,14 @@ config DEBUG_UART_S5P
  will need to provide parameters to make this work. The driver will
  be available until the real driver-model serial is running.

+config DEBUG_UART_APBUART
+   depends on LEON3
+   bool "Gaisler APBUART"
+   help
+ Select this to enable a debug UART using the serial_leon3 driver. You
+ will need to provide parameters to make this work. The driver will
+ be available until the real driver model serial is running.
+
 endchoice

 config DEBUG_UART_BASE
--
2.4.3



Disclaimer and confidentiality note – refer to our website for further details: 
www.spaceteq.co.za 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 02/13] spl: mmc: add break statements in spl_mmc_load_image()

2015-11-03 Thread Tom Rini
On Wed, Oct 28, 2015 at 11:23:19AM +0200, Nikita Kiryanov wrote:

> The original intention of the mmc load_image() function was to try multiple
> boot modes before failing. This is evident by the lack of break statements
> in the switch, and the following line in the default case:
> puts("spl: mmc: no boot mode left to try\n");
> 
> This implementation is problematic because:
> - The availability of alternative boot modes is very arbitrary since it
> depends on the specific order of the switch cases. If your boot mode happens 
> to
> be the first case, then you'll have a bunch of other boot modes as 
> alternatives.
> If it happens to be the last case, then you have none.
> - Opting in/out is tied to config options, so the only way for you to prevent 
> an
> alternative boot mode from being attempted is to give up on the feature 
> completely.
> - This implementation makes the code more complicated and difficult to
> understand.
> 
> Address these issues by inserting a break statements between the cases to 
> make the
> function try only one boot mode.
> 
> Signed-off-by: Nikita Kiryanov 
> Cc: Igor Grinberg 
> Cc: Paul Kocialkowski 
> Cc: Pantelis Antoniou 
> Cc: Tom Rini 
> Cc: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH V2 03/13] spl: mmc: refactor device location code to its own function

2015-11-03 Thread Tom Rini
On Wed, Oct 28, 2015 at 11:23:20AM +0200, Nikita Kiryanov wrote:

> Simplify spl_mmc_load_image() code by moving the part that finds the mmc 
> device
> into its own function spl_mmc_find_device(), available in two flavors: DM and
> non-DM.
> 
> This refactor fixes a bug in which an error in the device location sequence
> does not necessarily aborts the rest of the code. With this refactor, we fail
> the moment there is an error.
[snip]
> +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> + puts("spl: could not find mmc device. error: %d\n", err);
> +#endif

Should be printf.  And this reminds me that after we dug into things
before, there's really not a reason to use 'puts' sometimes and 'printf'
another, we can always just do printf and it doesn't actually change the
size.

-- 
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 v5 17/18] spi: Add SPI NOR protection mechanism

2015-11-03 Thread Tom Rini
On Tue, Nov 03, 2015 at 08:21:32PM +0530, Jagan Teki wrote:

[snip]
> I will come back for this patch changes what I thought, probably lock
> ops shouldn't be separate for dm and non-dm as we have different ops
> based on the flash itself.

As we work on consolidation and moving everything over to DM we'll have
funny cases like this.  But we shouldn't let that stop us from making
forward progress either.  The code itself looks reasonable enough today
as a starting point, so lets pick it up and move from there, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 2/2] altera_uart: Adjust the declaration of debug_uart_init()

2015-11-03 Thread Marek Vasut
On Tuesday, November 03, 2015 at 07:19:35 AM, Thomas Chou wrote:
> Follow commit 97b059730218 ("debug_uart: Adjust the declaration of
> debug_uart_init()")
> 
> Signed-off-by: Thomas Chou 

Reviewed-by: Marek Vasut 

> ---
>  drivers/serial/altera_uart.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
> index 4c4794e..6228981 100644
> --- a/drivers/serial/altera_uart.c
> +++ b/drivers/serial/altera_uart.c
> @@ -124,7 +124,7 @@ U_BOOT_DRIVER(altera_uart) = {
> 
>  #include 
> 
> -void debug_uart_init(void)
> +void _debug_uart_init(void)
>  {
>   struct altera_uart_regs *regs = (void *)CONFIG_DEBUG_UART_BASE;
>   u32 div;

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


Re: [U-Boot] [PATCH 2/3] nios2: remove CONFIG_SYS_INIT_SP macro

2015-11-03 Thread Marek Vasut
On Tuesday, November 03, 2015 at 07:20:22 AM, Thomas Chou wrote:
> Remove CONFIG_SYS_INIT_SP macro, as the initial stack is set to
> below the u-boot code.
> 
> Signed-off-by: Thomas Chou 

Reviewed-by: Marek Vasut 

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


Re: [U-Boot] [PATCH v2 5/5] board: ti: AM57xx: Add detection logic for AM57xx-evm

2015-11-03 Thread Nishanth Menon
On 11/03/2015 06:22 AM, Steve Kipisz wrote:
> diff --git a/include/configs/ti_omap5_common.h 
> b/include/configs/ti_omap5_common.h
> index 5acbc92c3f60..ae6e2a556a93 100644
> --- a/include/configs/ti_omap5_common.h
> +++ b/include/configs/ti_omap5_common.h
> @@ -120,6 +120,8 @@
>   "setenv fdtfile dra72-evm.dtb; fi;" \
>   "if test $board_name = beagle_x15; then " \
>   "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
> + "if test $board_name = am57xx_evm; then " \
> + "setenv fdtfile am57xx-evm.dtb; fi;" \
>   "if test $fdtfile = undefined; then " \
>   "echo WARNING: Could not determine device tree to use; 
> fi; \0" \
>   "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \

Hmmm I might keep this nugget out of upstream code for now.
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/
does not contain am57xx-evm.

it is possible that when we post patches upstream, it might become dt
overlay instead of evm dtb. I dont know about what will eventually
become in upstream. So, I suggest dropping the above change.



Also, in the future, could you cc beagleboard-x15
 for all patches that impact
beagleboard-X15 I am sure folks there will be interested to review as well?

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


[U-Boot] [PATCH v1 03/12] sparc: Add -mcpu= compiler flags for LEON2/LEON3

2015-11-03 Thread Francois Retief
Signed-off-by: Francois Retief 
---

 arch/sparc/config.mk | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/config.mk b/arch/sparc/config.mk
index d615f29..43faad4 100644
--- a/arch/sparc/config.mk
+++ b/arch/sparc/config.mk
@@ -1,19 +1,25 @@
 #
-# (C) Copyright 2007
-# Daniel Hellstrom, Gaisler Research, dan...@gaisler.com
+# (C) Copyright 2015
+# Daniel Hellstrom, Cobham Gaisler, dan...@gaisler.com.
 #
 # SPDX-License-Identifier: GPL-2.0+
 #

 ifeq ($(CROSS_COMPILE),)
-CROSS_COMPILE := sparc-elf-
+CROSS_COMPILE := sparc-linux-
 endif

+# This GCC compiler is known to work:
+#  https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/
+
 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)

 CONFIG_STANDALONE_LOAD_ADDR ?= 0x -L $(gcclibdir) \
   -T $(srctree)/examples/standalone/sparc.lds

-PLATFORM_CPPFLAGS += -D__sparc__
+cpuflags-$(CONFIG_LEON2) := -mcpu=leon
+cpuflags-$(CONFIG_LEON3) := -mcpu=leon3
+
+PLATFORM_CPPFLAGS += $(cpuflags-y)

 PLATFORM_RELFLAGS += -fPIC
--
2.4.3



Disclaimer and confidentiality note – refer to our website for further details: 
www.spaceteq.co.za 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 01/12] sparc: Fix broken files during license changes

2015-11-03 Thread Francois Retief
From: Francois Retief 

Fixes broken search and replaced license changes in
files cpu/leon3/start.S and include/asm/winmacro.h
from commit 1a4596601fd395f3afb8f82f3f840c5e00bdd57a

Signed-off-by: Francois Retief 

---

 arch/sparc/cpu/leon3/start.S  |   3 -
 arch/sparc/include/asm/winmacro.h | 127 --
 2 files changed, 130 deletions(-)

diff --git a/arch/sparc/cpu/leon3/start.S b/arch/sparc/cpu/leon3/start.S
index cf897f6..5f904fa 100644
--- a/arch/sparc/cpu/leon3/start.S
+++ b/arch/sparc/cpu/leon3/start.S
@@ -2,9 +2,6 @@
  * Copyright (C) 2007,
  * Daniel Hellstrom, dan...@gaisler.com
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
  * SPDX-License-Identifier:GPL-2.0+
  */

diff --git a/arch/sparc/include/asm/winmacro.h 
b/arch/sparc/include/asm/winmacro.h
index 65e4561..4f68fbd 100644
--- a/arch/sparc/include/asm/winmacro.h
+++ b/arch/sparc/include/asm/winmacro.h
@@ -136,130 +136,3 @@
ld  [reg + FW_FSR], %fsr;

 #endif
-
-#ifndef __SPARC_WINMACRO_H__
-#define __SPARC_WINMACRO_H__
-
-#include 
-#include 
-
-/* Store the register window onto the 8-byte aligned area starting
- * at %reg.  It might be %sp, it might not, we don't care.
- */
-#define RW_STORE(reg) \
-   std %l0, [%reg + RW_L0]; \
-   std %l2, [%reg + RW_L2]; \
-   std %l4, [%reg + RW_L4]; \
-   std %l6, [%reg + RW_L6]; \
-   std %i0, [%reg + RW_I0]; \
-   std %i2, [%reg + RW_I2]; \
-   std %i4, [%reg + RW_I4]; \
-   std %i6, [%reg + RW_I6];
-
-/* Load a register window from the area beginning at %reg. */
-#define RW_LOAD(reg) \
-   ldd [%reg + RW_L0], %l0; \
-   ldd [%reg + RW_L2], %l2; \
-   ldd [%reg + RW_L4], %l4; \
-   ldd [%reg + RW_L6], %l6; \
-   ldd [%reg + RW_I0], %i0; \
-   ldd [%reg + RW_I2], %i2; \
-   ldd [%reg + RW_I4], %i4; \
-   ldd [%reg + RW_I6], %i6;
-
-/* Loading and storing struct pt_reg trap frames. */
-#define PT_LOAD_INS(base_reg) \
-   ldd [%base_reg + SF_REGS_SZ + PT_I0], %i0; \
-   ldd [%base_reg + SF_REGS_SZ + PT_I2], %i2; \
-   ldd [%base_reg + SF_REGS_SZ + PT_I4], %i4; \
-   ldd [%base_reg + SF_REGS_SZ + PT_I6], %i6;
-
-#define PT_LOAD_GLOBALS(base_reg) \
-   ld  [%base_reg + SF_REGS_SZ + PT_G1], %g1; \
-   ldd [%base_reg + SF_REGS_SZ + PT_G2], %g2; \
-   ldd [%base_reg + SF_REGS_SZ + PT_G4], %g4; \
-   ldd [%base_reg + SF_REGS_SZ + PT_G6], %g6;
-
-#define PT_LOAD_YREG(base_reg, scratch) \
-   ld  [%base_reg + SF_REGS_SZ + PT_Y], %scratch; \
-   wr  %scratch, 0x0, %y;
-
-#define PT_LOAD_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \
-   ld  [%base_reg + SF_REGS_SZ + PT_PSR], %pt_psr; \
-   ld  [%base_reg + SF_REGS_SZ + PT_PC], %pt_pc; \
-   ld  [%base_reg + SF_REGS_SZ + PT_NPC], %pt_npc;
-
-#define PT_LOAD_ALL(base_reg, pt_psr, pt_pc, pt_npc, scratch) \
-   PT_LOAD_YREG(base_reg, scratch) \
-   PT_LOAD_INS(base_reg) \
-   PT_LOAD_GLOBALS(base_reg) \
-   PT_LOAD_PRIV(base_reg, pt_psr, pt_pc, pt_npc)
-
-#define PT_STORE_INS(base_reg) \
-   std %i0, [%base_reg + SF_REGS_SZ + PT_I0]; \
-   std %i2, [%base_reg + SF_REGS_SZ + PT_I2]; \
-   std %i4, [%base_reg + SF_REGS_SZ + PT_I4]; \
-   std %i6, [%base_reg + SF_REGS_SZ + PT_I6];
-
-#define PT_STORE_GLOBALS(base_reg) \
-   st  %g1, [%base_reg + SF_REGS_SZ + PT_G1]; \
-   std %g2, [%base_reg + SF_REGS_SZ + PT_G2]; \
-   std %g4, [%base_reg + SF_REGS_SZ + PT_G4]; \
-   std %g6, [%base_reg + SF_REGS_SZ + PT_G6];
-
-#define PT_STORE_YREG(base_reg, scratch) \
-   rd  %y, %scratch; \
-   st  %scratch, [%base_reg + SF_REGS_SZ + PT_Y];
-
-#define PT_STORE_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \
-   st  %pt_psr, [%base_reg + SF_REGS_SZ + PT_PSR]; \
-   st  %pt_pc,  [%base_reg + SF_REGS_SZ + PT_PC]; \
-   st  %pt_npc, [%base_reg + SF_REGS_SZ + PT_NPC];
-
-#define PT_STORE_ALL(base_reg, reg_psr, reg_pc, reg_npc, g_scratch) \
-   PT_STORE_PRIV(base_reg, reg_psr, reg_pc, reg_npc) \
-   PT_STORE_GLOBALS(base_reg) \
-   PT_STORE_YREG(base_reg, g_scratch) \
-   PT_STORE_INS(base_reg)
-
-/* Store the fpu register window*/
-#define FW_STORE(reg) \
-   std %f0, [reg + FW_F0]; \
-   std %f2, [reg + FW_F2]; \
-   std %f4, [reg + FW_F4]; \
-   std %f6, [reg + FW_F6]; \
-   std %f8, [reg + FW_F8]; \
-   std %f10, [reg + FW_F10]; \
-   std %f12, [reg + FW_F12]; \
-   std %f14, [reg + FW_F14]; \
-   std %f16, [reg + FW_F16]; \
-   std %f18, [reg + FW_F18]; \
-   std %f20, [reg + FW_F20]; \
-   std %f22, [reg + FW_F22]; \
-   std %f24, [reg + FW_F24]; \
-   std %f26, [reg + FW_F26]; \
-   std 

[U-Boot] [PATCH v1 02/12] sparc: Update the maintainer for SPARC architecture

2015-11-03 Thread Francois Retief
Signed-off-by: Francois Retief 
---

 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index bf60c67..b3a45cc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -370,7 +370,7 @@ T:  git git://git.denx.de/u-boot-sh.git
 F: arch/sh/

 SPARC
-M: Daniel Hellstrom 
+M: Francois Retief 
 S: Maintained
 T: git git://git.denx.de/u-boot-sparc.git
 F: arch/sparc/
--
2.4.3



Disclaimer and confidentiality note – refer to our website for further details: 
www.spaceteq.co.za 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 11/12] sparc: ambapp: Removed warning and unnecessary printout.

2015-11-03 Thread Francois Retief
From: Daniel Hellstrom 

Signed-off-by: Daniel Hellstrom 
Signed-off-by: Francois Retief 
---

 arch/sparc/cpu/leon3/ambapp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sparc/cpu/leon3/ambapp.c b/arch/sparc/cpu/leon3/ambapp.c
index bb81338..b8ac05f 100644
--- a/arch/sparc/cpu/leon3/ambapp.c
+++ b/arch/sparc/cpu/leon3/ambapp.c
@@ -10,6 +10,7 @@
 /* #define DEBUG */

 #include 
+#include 
 #include 
 #include 

@@ -257,7 +258,7 @@ unsigned int ambapp_bus_freq(struct ambapp_bus *abus, int 
ahb_bus_index)
/* Get I/O area of AHB bus */
ioarea = abus->ioareas[ahb_bus_index];

-   printf("  IOAREA: 0x%08x\n", ioarea);
+   debug("  IOAREA: 0x%08x\n", ioarea);

/* Get parent bus */
parent = (ioarea & 0x7);
--
2.4.3



Disclaimer and confidentiality note – refer to our website for further details: 
www.spaceteq.co.za 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/5] ARM: omap-common: Add standard access for board description EEPROM

2015-11-03 Thread Nishanth Menon
On 11/03/2015 09:13 AM, Steven Kipisz wrote:
> On 11/03/2015 07:16 AM, Igor Grinberg wrote:
>> Hi Steve,
>>
>> On 11/03/15 14:22, Steve Kipisz wrote:
>>> From: Lokesh Vutla 
>>
>> [...]
>>
>>>
>>> Signed-off-by: Lokesh Vutla 
>>> Signed-off-by: Steve Kipisz 
>>> ---
>>> v2 Based on
>>>   master  a6104737  ARM: at91: sama5: change the environment
>>> address to 0x6000
>>>
>>> Changes in v2 (since v1)
>>> - make the EEPROM code mor generic for TI EVMs
>>> - rename structures/subroutines to ti_am_x
>>> - add routines to access the EEPROM data
>>> - redo commit message to be more clear
>>>
>>> v1:   http://marc.info/?t=14460800791=1=2
>>> (mailing list squashed original submission)
>>>
>>>   arch/arm/cpu/armv7/omap-common/Makefile|   1 +
>>>   arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c | 148
>>> +
>>>   arch/arm/include/asm/omap_common.h | 130
>>> +-
>>>   3 files changed, 278 insertions(+), 1 deletion(-)
>>>   create mode 100644 arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c
>>>
>>> diff --git a/arch/arm/cpu/armv7/omap-common/Makefile
>>> b/arch/arm/cpu/armv7/omap-common/Makefile
>>> index 464a5d1d732a..53a9fdb81100 100644
>>> --- a/arch/arm/cpu/armv7/omap-common/Makefile
>>> +++ b/arch/arm/cpu/armv7/omap-common/Makefile
>>> @@ -15,6 +15,7 @@ obj-y+= clocks-common.o
>>>   obj-y+= emif-common.o
>>>   obj-y+= vc.o
>>>   obj-y+= abb.o
>>> +obj-$(CONFIG_I2C) += ti-i2c-eeprom.o
>>
>> This makes this module compile on all TI SoC based boards enabling I2C.
>> AFAIU, this is a separate chip (not inside the SoC), so this module will
>> also compile on non-TI boards that do not have this EEPROM.
>> I think, it should be more fine grained (e.g. have its own symbol).
>>
> Can you give a suggestion?

Are you sure this will be built into non-ti SoCs with I2C enabled if you
are not using the function? I assume  __maybe_unused should take care of
that, no - let the compiler do the gc anyways?


It should have been documented on commit message as well.


>>> + * @revision:Revision of the board
>>> + * @serial:Serial Number of the board
>>> + *
>>> + * In case of NULL revision or serial information "unknown" is setup.
>>> + * If name is NULL, default_name is used.
>>> + */
>>> +void set_board_info_env(char *name, char *default_name,
>>> +char *revision, char *serial);
>>> +
>>> +/**
>>> + * board_am_is() - Generic Board detection logic
>>> + * @name_tag:Tag used in eeprom for the board
>>> + *
>>> + * Return: false if board information does not match OR eeprom
>>> was'nt read.
>>> + *   true otherwise
>>> + */
>>> +static inline bool board_am_is(char *name_tag)
>>> +{
>>> +struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
>>> +
>>> +if (ep->header != TI_EEPROM_HEADER_MAGIC)
>>> +return false;
>>> +return !strncmp(ep->name, name_tag, TI_EEPROM_HDR_NAME_LEN);
>>> +}
>>
>> Why do you need to place non trivial function implementation inside the
>> header file?
>>
>>> +
>>> +/**
>>> + * board_am_rev_is() - Compare board revision
>>> + * @rev_tag:Revision tag to check in eeprom
>>> + * @cmp_len:How many chars to compare?
>>> + *
>>> + * NOTE: revision information is often messed up (hence the str len
>>> match) :(
>>> + *
>>> + * Return: false if board information does not match OR eeprom
>>> was'nt read.
>>> + *   true otherwise
>>> + */
>>> +static inline bool board_am_rev_is(char *rev_tag, int cmp_len)
>>> +{
>>> +struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
>>> +int l;
>>> +
>>> +if (ep->header != TI_EEPROM_HEADER_MAGIC)
>>> +return false;
>>> +
>>> +l = cmp_len > TI_EEPROM_HDR_REV_LEN ? TI_EEPROM_HDR_NAME_LEN :
>>> cmp_len;
>>> +return !strncmp(ep->version, rev_tag, l);
>>> +}
>>
>> Same here.
>>
> I thought by making them static inline would save space.

I prefer that myself as well.


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


Re: [U-Boot] [PATCH v5 17/18] spi: Add SPI NOR protection mechanism

2015-11-03 Thread Fabio Estevam
On Tue, Nov 3, 2015 at 1:20 PM, Tom Rini  wrote:
> On Tue, Nov 03, 2015 at 08:21:32PM +0530, Jagan Teki wrote:
>
> [snip]
>> I will come back for this patch changes what I thought, probably lock
>> ops shouldn't be separate for dm and non-dm as we have different ops
>> based on the flash itself.
>
> As we work on consolidation and moving everything over to DM we'll have
> funny cases like this.  But we shouldn't let that stop us from making
> forward progress either.  The code itself looks reasonable enough today
> as a starting point, so lets pick it up and move from there, thanks!

Yes, we can always make incremental patches to improve things.

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


Re: [U-Boot] [PATCH v2 5/5] board: ti: AM57xx: Add detection logic for AM57xx-evm

2015-11-03 Thread Steven Kipisz

On 11/03/2015 09:31 AM, Nishanth Menon wrote:

On 11/03/2015 06:22 AM, Steve Kipisz wrote:

diff --git a/include/configs/ti_omap5_common.h 
b/include/configs/ti_omap5_common.h
index 5acbc92c3f60..ae6e2a556a93 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -120,6 +120,8 @@
"setenv fdtfile dra72-evm.dtb; fi;" \
"if test $board_name = beagle_x15; then " \
"setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
+   "if test $board_name = am57xx_evm; then " \
+   "setenv fdtfile am57xx-evm.dtb; fi;" \
"if test $fdtfile = undefined; then " \
"echo WARNING: Could not determine device tree to use; fi; 
\0" \
"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \


Hmmm I might keep this nugget out of upstream code for now.
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/
does not contain am57xx-evm.

it is possible that when we post patches upstream, it might become dt
overlay instead of evm dtb. I dont know about what will eventually
become in upstream. So, I suggest dropping the above change.



Got it.


Also, in the future, could you cc beagleboard-x15
 for all patches that impact
beagleboard-X15 I am sure folks there will be interested to review as well?


Ok. I'll add it to my send-email script.

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


[U-Boot] [PATCH v1 09/12] sparc: leon3: Added memory controller initialization using new AMBA PnP routines.

2015-11-03 Thread Francois Retief
From: Daniel Hellstrom 

Signed-off-by: Daniel Hellstrom 
Signed-off-by: Francois Retief 
---

 arch/sparc/cpu/leon3/Makefile |   2 +-
 arch/sparc/cpu/leon3/memcfg.c | 237 +++
 arch/sparc/cpu/leon3/memcfg.h |  90 ++
 arch/sparc/cpu/leon3/memcfg_low.S | 253 ++
 arch/sparc/cpu/leon3/start.S  |  41 +-
 include/configs/gr_cpci_ax2000.h  |  27 ++--
 include/configs/gr_ep2s60.h   |  32 +++--
 include/configs/gr_xc3s_1500.h|  23 ++--
 include/configs/grsim.h   |  26 ++--
 9 files changed, 688 insertions(+), 43 deletions(-)
 create mode 100644 arch/sparc/cpu/leon3/memcfg.c
 create mode 100644 arch/sparc/cpu/leon3/memcfg.h
 create mode 100644 arch/sparc/cpu/leon3/memcfg_low.S

diff --git a/arch/sparc/cpu/leon3/Makefile b/arch/sparc/cpu/leon3/Makefile
index c5068a8..f4cf43c 100644
--- a/arch/sparc/cpu/leon3/Makefile
+++ b/arch/sparc/cpu/leon3/Makefile
@@ -7,4 +7,4 @@

 extra-y= start.o
 obj-y  = cpu_init.o serial.o cpu.o ambapp.o ambapp_low.o ambapp_low_c.o \
-   interrupts.o prom.o usb_uhci.o
+   interrupts.o prom.o usb_uhci.o memcfg.o memcfg_low.o
diff --git a/arch/sparc/cpu/leon3/memcfg.c b/arch/sparc/cpu/leon3/memcfg.c
new file mode 100644
index 000..b9eda44
--- /dev/null
+++ b/arch/sparc/cpu/leon3/memcfg.c
@@ -0,0 +1,237 @@
+/* GRLIB Memory controller setup. The register values are used
+ * from the associated low level assembler routine implemented
+ * in memcfg_low.S.
+ *
+ * (C) Copyright 2010, 2015
+ * Daniel Hellstrom, Cobham Gaisler, dan...@gaisler.com.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include "memcfg.h"
+#include 
+
+#ifdef CONFIG_SYS_GRLIB_ESA_MCTRL1
+struct mctrl_setup esa_mctrl1_cfg = {
+   .reg_mask = 0x7,
+   .regs = {
+   {
+   .mask = 0x0300,
+   .value = CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG1,
+   },
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG2,
+   },
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG3,
+   },
+   }
+};
+#ifdef CONFIG_SYS_GRLIB_ESA_MCTRL2
+struct mctrl_setup esa_mctrl2_cfg = {
+   .reg_mask = 0x7,
+   .regs = {
+   {
+   .mask = 0x0300,
+   .value = CONFIG_SYS_GRLIB_ESA_MCTRL2_CFG1,
+   },
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_ESA_MCTRL2_CFG2,
+   },
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_ESA_MCTRL2_CFG3,
+   },
+   }
+};
+#endif
+#endif
+
+#ifdef CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1
+struct mctrl_setup gaisler_ftmctrl1_cfg = {
+   .reg_mask = 0x7,
+   .regs = {
+   {
+   .mask = 0x0300,
+   .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG1,
+   },
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG2,
+   },
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG3,
+   },
+   }
+};
+#ifdef CONFIG_SYS_GRLIB_GAISLER_FTMCTRL2
+struct mctrl_setup gaisler_ftmctrl2_cfg = {
+   .reg_mask = 0x7,
+   .regs = {
+   {
+   .mask = 0x0300,
+   .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL2_CFG1,
+   },
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL2_CFG2,
+   },
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL2_CFG3,
+   },
+   }
+};
+#endif
+#endif
+
+#ifdef CONFIG_SYS_GRLIB_GAISLER_SDCTRL1
+struct mctrl_setup gaisler_sdctrl1_cfg = {
+   .reg_mask = 0x1,
+   .regs = {
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_GAISLER_SDCTRL1_CTRL,
+   },
+   }
+};
+#ifdef CONFIG_SYS_GRLIB_GAISLER_SDCTRL2
+struct mctrl_setup gaisler_sdctrl2_cfg = {
+   .reg_mask = 0x1,
+   .regs = {
+   {
+   .mask = 0x,
+   .value = CONFIG_SYS_GRLIB_GAISLER_SDCTRL2_CTRL,
+   },
+   }
+};
+#endif
+#endif
+
+#ifdef CONFIG_SYS_GRLIB_GAISLER_DDR2SPA1
+struct ahbmctrl_setup gaisler_ddr2spa1_cfg = {
+   .ahb_mbar_no = 1,
+   .reg_mask = 0xd,
+   .regs = {
+   {
+   .mask = 

[U-Boot] [PATCH v1 10/12] sparc: leon3: Moved GRLIB core header files to common include/grlib directory

2015-11-03 Thread Francois Retief
From: Daniel Hellstrom 

Signed-off-by: Daniel Hellstrom 
Signed-off-by: Francois Retief 
---

 arch/sparc/cpu/leon3/cpu_init.c   |  10 ++-
 arch/sparc/cpu/leon3/interrupts.c |   7 +-
 arch/sparc/cpu/leon3/prom.c   |   7 +-
 arch/sparc/cpu/leon3/serial.c |  13 ++--
 common/cmd_ambapp.c   |  21 +-
 drivers/net/greth.c   |   2 +-
 include/ambapp.h  | 137 --
 include/ambapp_ids.h  |  11 +++
 include/grlib/apbuart.h   |  47 +
 include/grlib/gptimer.h   |  34 ++
 include/grlib/greth.h |  87 
 include/grlib/irqmp.h |  23 +++
 12 files changed, 242 insertions(+), 157 deletions(-)
 create mode 100644 include/grlib/apbuart.h
 create mode 100644 include/grlib/gptimer.h
 create mode 100644 include/grlib/greth.h
 create mode 100644 include/grlib/irqmp.h

diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c
index f23ecb8..40d1751 100644
--- a/arch/sparc/cpu/leon3/cpu_init.c
+++ b/arch/sparc/cpu/leon3/cpu_init.c
@@ -11,6 +11,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 

 #include 

@@ -27,11 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;
 /* reset CPU (jump to 0, without reset) */
 void start(void);

-/* find & initialize the memory controller */
-int init_memory_ctrl(void);
-
 ambapp_dev_irqmp *irqmp = NULL;
-ambapp_dev_mctrl memctrl;
 ambapp_dev_gptimer *gptimer = NULL;
 unsigned int gptimer_irq = 0;
 int leon3_snooping_avail = 0;
@@ -150,8 +148,8 @@ int timer_interrupt_init_cpu(void)
gptimer->e[0].val = 0;
gptimer->e[0].rld = (TIMER_BASE_CLK / CONFIG_SYS_HZ) - 1;
gptimer->e[0].ctrl =
-   (LEON3_GPTIMER_EN |
-LEON3_GPTIMER_RL | LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN);
+   (GPTIMER_CTRL_EN | GPTIMER_CTRL_RS |
+GPTIMER_CTRL_LD | GPTIMER_CTRL_IE);

return gptimer_irq;
 }
diff --git a/arch/sparc/cpu/leon3/interrupts.c 
b/arch/sparc/cpu/leon3/interrupts.c
index a834aa0..2312b58 100644
--- a/arch/sparc/cpu/leon3/interrupts.c
+++ b/arch/sparc/cpu/leon3/interrupts.c
@@ -23,6 +23,8 @@

 #include 
 #include 
+#include 
+#include 

 /* 15 normal irqs and a non maskable interrupt */
 #define NR_IRQS 15
@@ -125,9 +127,8 @@ int interrupt_init_cpu(void)
 /* Handle Timer 0 IRQ */
 void timer_interrupt_cpu(void *arg)
 {
-   gptimer->e[0].ctrl = (LEON3_GPTIMER_EN |
- LEON3_GPTIMER_RL |
- LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN);
+   gptimer->e[0].ctrl = (GPTIMER_CTRL_EN | GPTIMER_CTRL_RS |
+ GPTIMER_CTRL_LD | GPTIMER_CTRL_IE);
/* nothing to do here */
return;
 }
diff --git a/arch/sparc/cpu/leon3/prom.c b/arch/sparc/cpu/leon3/prom.c
index d0f1860..c391be7 100644
--- a/arch/sparc/cpu/leon3/prom.c
+++ b/arch/sparc/cpu/leon3/prom.c
@@ -15,6 +15,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 

 #include 
 /*
@@ -741,14 +744,14 @@ static int PROM_TEXT leon_nbputchar(int c)

/* Wait for last character to go. */
while (!(SPARC_BYPASS_READ(>status)
-& LEON_REG_UART_STATUS_THE)) ;
+& APBUART_STATUS_THE));

/* Send data */
SPARC_BYPASS_WRITE(>data, c);

/* Wait for data to be sent */
while (!(SPARC_BYPASS_READ(>status)
-& LEON_REG_UART_STATUS_TSE)) ;
+& APBUART_STATUS_TSE));

return 0;
 }
diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c
index c4a49ed..cefb9d2 100644
--- a/arch/sparc/cpu/leon3/serial.c
+++ b/arch/sparc/cpu/leon3/serial.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 

@@ -38,9 +39,9 @@ static int leon3_serial_init(void)
writel(tmp, >scaler);

/* Let bit 11 be unchanged (debug bit for GRMON) */
-   tmp = readl(>ctrl) & LEON_REG_UART_CTRL_DBG;
+   tmp = readl(>ctrl) & APBUART_CTRL_DBG;
/* Receiver & transmitter enable */
-   tmp |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
+   tmp |= APBUART_CTRL_RE | APBUART_CTRL_TE;
writel(tmp, >ctrl);

gd->arch.uart = uart;
@@ -61,7 +62,7 @@ static void leon3_serial_putc_raw(const char c)
return;

/* Wait for last character to go. */
-   while (!(readl(>status) & LEON_REG_UART_STATUS_THE))
+   while (!(readl(>status) & APBUART_STATUS_THE))
WATCHDOG_RESET();

/* Send data */
@@ -69,7 +70,7 @@ static void leon3_serial_putc_raw(const char c)

 #ifdef LEON_DEBUG
/* Wait for data to be sent */
-   while (!(readl(>status) & LEON_REG_UART_STATUS_TSE))
+   while (!(readl(>status) & APBUART_STATUS_TSE))
WATCHDOG_RESET();
 #endif
 }
@@ -90,7 +91,7 @@ static int leon3_serial_getc(void)
return 

[U-Boot] [PATCH v1 06/12] sparc: Update startup code to take PIC mode into account

2015-11-03 Thread Francois Retief
Signed-off-by: Francois Retief 
---

 arch/sparc/cpu/leon2/start.S | 60 ++--
 arch/sparc/cpu/leon3/start.S | 60 ++--
 2 files changed, 82 insertions(+), 38 deletions(-)

diff --git a/arch/sparc/cpu/leon2/start.S b/arch/sparc/cpu/leon2/start.S
index e43097c..974de76 100644
--- a/arch/sparc/cpu/leon2/start.S
+++ b/arch/sparc/cpu/leon2/start.S
@@ -57,6 +57,27 @@ MINFRAME = (WINDOWSIZE + ARGPUSHSIZE + 4)
 #error Must define number of SPARC register windows, default is 8
 #endif

+/* Macros to load address into a register. Uses GOT table for PIC */
+#ifdef __PIC__
+
+#define SPARC_PIC_THUNK_CALL(reg) \
+   sethi   %pc22(_GLOBAL_OFFSET_TABLE_-4), %##reg; \
+   call__sparc_get_pc_thunk.reg; \
+add%##reg, %pc10(_GLOBAL_OFFSET_TABLE_+4), %##reg;
+
+#define SPARC_LOAD_ADDRESS(sym, got, reg) \
+   sethi   %gdop_hix22(sym), %##reg; \
+   xor %##reg, %gdop_lox10(sym), %##reg; \
+   ld  [%##got + %##reg], %##reg, %gdop(sym);
+
+#else
+
+#define SPARC_PIC_THUNK_CALL(reg)
+#define SPARC_LOAD_ADDRESS(sym, got, tmp) \
+   set sym, %##reg;
+
+#endif
+
 #define STACK_ALIGN8
 #define SA(X)  (((X)+(STACK_ALIGN-1)) & ~(STACK_ALIGN-1))

@@ -278,7 +299,7 @@ leon2_init_mctrl:
srl %g2, 30, %g2
andcc   %g2, 3, %g6
bne,a   leon2_init_wim
-   mov %g0, %asr16 ! clear err_reg
+mov%g0, %asr16 ! clear err_reg

 leon2_init_wim:
set WIM_INIT, %g3
@@ -299,7 +320,7 @@ leon2_init_stackp:

 cpu_init_unreloc:
callcpu_init_f
-   nop
+nop

 /* un relocated start address of monitor */
 #define TEXT_START _text
@@ -307,9 +328,10 @@ cpu_init_unreloc:
 /* un relocated end address of monitor */
 #define DATA_END __init_end

+   SPARC_PIC_THUNK_CALL(l7)
 reloc:
-   set TEXT_START,%g2
-   set DATA_END,%g3
+   SPARC_LOAD_ADDRESS(TEXT_START, l7, g2)
+   SPARC_LOAD_ADDRESS(DATA_END, l7, g3)
set CONFIG_SYS_RELOC_MONITOR_BASE,%g4
 reloc_loop:
ldd [%g2],%l0
@@ -319,7 +341,7 @@ reloc_loop:
inc 16,%g2
subcc   %g3,%g2,%g0
bne reloc_loop
-   inc 16,%g4
+inc16,%g4

clr %l0
clr %l1
@@ -336,8 +358,8 @@ reloc_loop:

 clr_bss:
 /* clear bss area (the relocated) */
-   set __bss_start,%g2
-   set __bss_end,%g3
+   SPARC_LOAD_ADDRESS(__bss_start, l7, g2)
+   SPARC_LOAD_ADDRESS(__bss_end, l7, g3)
sub %g3,%g2,%g3
add %g3,%g4,%g3
clr %g1 /* std %g0 uses g0 and g1 */
@@ -348,19 +370,19 @@ clr_bss_16:
inc 16,%g4
cmp %g3,%g4
bne clr_bss_16
-   nop
+nop

 /* add offsets to GOT table */
 fixup_got:
-   set __got_start,%g4
-   set __got_end,%g3
+   SPARC_LOAD_ADDRESS(__got_start, l7, g4)
+   SPARC_LOAD_ADDRESS(__got_end, l7, g3)
 /*
  * new got offset = (old GOT-PTR (read with ld) -
  *   CONFIG_SYS_RELOC_MONITOR_BASE(from define) ) +
  *   Destination Address (from define)
  */
set CONFIG_SYS_RELOC_MONITOR_BASE,%g2
-   set TEXT_START, %g1
+   SPARC_LOAD_ADDRESS(TEXT_START, l7, g1)
add %g4,%g2,%g4
sub %g4,%g1,%g4
add %g3,%g2,%g3
@@ -375,11 +397,11 @@ got_loop:
inc 4,%g4
cmp %g3,%g4
bne got_loop
-   nop
+nop

 prom_relocate:
-   set __prom_start, %g2
-   set __prom_end, %g3
+   SPARC_LOAD_ADDRESS(__prom_start, l7, g2)
+   SPARC_LOAD_ADDRESS(__prom_end, l7, g3)
set CONFIG_SYS_PROM_OFFSET, %g4

 prom_relocate_loop:
@@ -390,7 +412,7 @@ prom_relocate_loop:
inc 16,%g2
subcc   %g3,%g2,%g0
bne prom_relocate_loop
-   inc 16,%g4
+inc16,%g4

 /* Trap table has been moved, lets tell CPU about
  * the new trap table address
@@ -403,19 +425,19 @@ prom_relocate_loop:
nop
 /* Call relocated init functions */
 jump:
-   set cpu_init_f2,%o1
+   SPARC_LOAD_ADDRESS(cpu_init_f2, l7, o1)
set CONFIG_SYS_RELOC_MONITOR_BASE,%o2
add %o1,%o2,%o1
sub %o1,%g1,%o1
call%o1
-   clr %o0
+clr%o0

-   set board_init_f,%o1
+   SPARC_LOAD_ADDRESS(board_init_f, l7, o1)
set CONFIG_SYS_RELOC_MONITOR_BASE,%o2
add %o1,%o2,%o1
sub %o1,%g1,%o1
call%o1
-   clr %o0
+clr%o0

 dead:  ta 0! if call returns...
nop
diff --git a/arch/sparc/cpu/leon3/start.S b/arch/sparc/cpu/leon3/start.S
index 5f904fa..be9b3fb 100644
--- a/arch/sparc/cpu/leon3/start.S
+++ b/arch/sparc/cpu/leon3/start.S
@@ -57,6 +57,27 @@ MINFRAME = (WINDOWSIZE + ARGPUSHSIZE + 4)
 #error Must define number of SPARC register windows, default is 8
 

Re: [U-Boot] [PATCH V3 08/13] spl: change return values of spl_*_load_image()

2015-11-03 Thread Tom Rini
On Tue, Nov 03, 2015 at 02:19:53PM +0200, Nikita Kiryanov wrote:

> Make spl_*_load_image() functions return a value instead of
> hanging if a problem is encountered. This enables main spl code
> to make the decision whether to hang or not, thus preparing
> it to support alternative boot devices.
> 
> Some boot devices (namely nand and spi) do not hang on error.
> Instead, they return normally and SPL proceeds to boot the
> contents of the load address. This is considered a bug and
> is rectified by hanging on error for these devices as well.
> 
> Signed-off-by: Nikita Kiryanov 
> Cc: Igor Grinberg 
> Cc: Tom Rini 
> Cc: Simon Glass 
> Cc: Ian Campbell 
> Cc: Hans De Goede 
> Cc: Albert Aribaud 
> Cc: Jagan Teki 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH V2 04/13] spl: mmc: remove #ifdef CONFIG_SPL_OS_BOOT check

2015-11-03 Thread Tom Rini
On Wed, Oct 28, 2015 at 11:23:21AM +0200, Nikita Kiryanov wrote:

> Implement default versions of falcon mode functions to make the
> CONFIG_SPL_OS_BOOT check in spl_mmc_load_image() unnecessary, thus reducing
> its #ifdef complexity.
> 
> No functional changes.
> 
> Signed-off-by: Nikita Kiryanov 
> Cc: Igor Grinberg 
> Cc: Paul Kocialkowski 
> Cc: Pantelis Antoniou 
> Cc: Tom Rini 
> Cc: Simon Glass 
> Cc: Guillaume GARDET 
> Cc: Suriyan Ramasami 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH V2 05/13] spl: mmc: get rid of #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION check

2015-11-03 Thread Tom Rini
On Wed, Oct 28, 2015 at 11:23:22AM +0200, Nikita Kiryanov wrote:

> Implement defaults for the raw partition image loading so that the #ifdef
> CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION in spl_mmc_load_image() will no
> longer be necessary.
> 
> This change makes it possible for mmc_load_image_raw_partition() and
> mmc_load_image_raw_sector() to coexist.
> 
> Signed-off-by: Nikita Kiryanov 
> Cc: Igor Grinberg 
> Cc: Paul Kocialkowski 
> Cc: Pantelis Antoniou 
> Cc: Tom Rini 
> Cc: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 5/5] board: ti: AM57xx: Add detection logic for AM57xx-evm

2015-11-03 Thread Igor Grinberg
On 11/03/15 17:09, Steven Kipisz wrote:
> On 11/03/2015 07:29 AM, Igor Grinberg wrote:
>> Hi Steve,
>>
>> On 11/03/15 14:22, Steve Kipisz wrote:
>>
>> [...]
>>
>>> Signed-off-by: Steve Kipisz 
>>> ---
>>> v2 Based on:
>>>   master a6104737 ARM: at91: sama5: change the environment address to 
>>> 0x6000
>>>
>>> Build testing: MAKEALL -s omap4 -s omap5 (no warnings/build errors)
>>> Boot Testing:
>>> am57xx_evm_nodt_config: http://pastebin.ubuntu.com/13039296/
>>> beagle_x15_config: http://pastebin.ubuntu.com/13039331/
>>>
>>> Changes in v2 (since v1):
>>> - move the board detection code into the new routine
>>>   do_board_detect
>>> - eliminate board.h and move the ix_xxx into board.c
>>> - redo commit message to be more clear
>>>
>>> v1:  http://marc.info/?t=14460800792=1=2
>>>   http://marc.info/?t=14460800794=1=2
>>> (mailing list squashed original submission)
>>
>> [...]
>>
>>> +#define is_x15()board_am_is("BBRDX15_")
>>> +#define is_am572x_evm()board_am_is("AM572PM_")
>>
>> I think board_is_* much more appropriate here...
>>
> Ok. so board_is_x15 and board_is_am572x_evm

Yep. Sounds better.

>>> +
>>>   #ifdef CONFIG_DRIVER_TI_CPSW
>>>   #include 
>>>   #endif
>>> @@ -246,6 +249,54 @@ struct vcores_data beagle_x15_volts = {
>>>   .iva.pmic= ,
>>>   };
>>>
>>> +#ifdef CONFIG_SPL_BUILD
>>> +/* No env to setup for SPL */
>>> +static inline void setup_board_eeprom_env(void) { }
>>> +
>>> +/* Override function to read eeprom information */
>>> +void do_board_detect(void)
>>> +{
>>> +struct ti_am_eeprom *ep;
>>> +int rc;
>>> +
>>> +rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
>>> +  CONFIG_EEPROM_CHIP_ADDRESS, );
>>> +if (rc)
>>> +printf("ti_i2c_eeprom_init failed %d\n", rc);
>>> +}
>>
>> Do you really need this in SPL?
> 
> Yes. We need to detect the board to determine DDR setup, pin mux, iodelay. 
> All of that needs to be done in SPL. X15 and EVM are the same, but more 
> boards will be added that have some differences.

Ok.

>>
>>> +
>>> +#else/* CONFIG_SPL_BUILD */
>>> +
>>> +static void setup_board_eeprom_env(void)
>>> +{
>>> +char *name = NULL;
>>
>> How about:
>>
>> char *name = "beagle_x15";
>>
>>> +int rc;
>>> +struct ti_am_eeprom_printable p;
>>> +
>>> +rc = ti_i2c_eeprom_am_get_print(CONFIG_EEPROM_BUS_ADDRESS,
>>> +CONFIG_EEPROM_CHIP_ADDRESS, );
>>> +if (rc) {
>>> +printf("Invalid EEPROM data(@0x%p). Default to X15\n",
>>> +   TI_AM_EEPROM_DATA);
>>> +goto invalid_eeprom;
>>> +}
>>> +
>>> +if (is_x15())
>>> +name = "beagle_x15";
>>
>> This will not be needed if the above comment is implemented.
>>
>>> +else if (is_am572x_evm())
>>> +name = "am57xx_evm";
>>> +else
>>> +printf("Unidentified board claims %s in eeprom header\n",
>>> +   p.name);
>>> +
>>> +invalid_eeprom:
>>> +set_board_info_env(name, "beagle_x15", p.version, p.serial);
>>
>> If the above comment is implemented, no more need for the
>> default_name parameter...
>>
> Ok, I'll look at that.
>>> +}
>>> +
>>> +/* Eeprom is alread read by SPL.. nothing more to do here.. */
>>> +
>>> +#endif/* CONFIG_SPL_BUILD */
>>
>> [...]
>>
>>
> Steve K.
> 

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


Re: [U-Boot] [PATCH v5 1/6] cgtqmx6eval: Add SPI NOR flash support

2015-11-03 Thread Tom Rini
On Tue, Nov 03, 2015 at 10:07:37PM +0530, Jagan Teki wrote:
> On 30 October 2015 at 16:04, Otavio Salvador  wrote:
> > Add SPI NOR support:
> >
> > => sf probe
> > SF: Detected SST25VF032B with page size 256 Bytes, erase size 4 KiB, total 
> > 4 MiB
> >
> > Signed-off-by: Otavio Salvador 
> > ---
> >
> > Changes in v5: None
> > Changes in v4: None
> >
> >  board/congatec/cgtqmx6eval/cgtqmx6eval.c | 23 +++
> >  include/configs/cgtqmx6eval.h| 12 
> >  2 files changed, 35 insertions(+)
> >
> > diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c 
> > b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
> > index cf5607b..18e408b 100644
> > --- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
> > +++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
> > @@ -45,6 +45,10 @@ DECLARE_GLOBAL_DATA_PTR;
> > PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
> > PAD_CTL_ODE | PAD_CTL_SRE_FAST)
> >
> > +#define SPI_PAD_CTRL (PAD_CTL_HYS |\
> > +   PAD_CTL_SPEED_MED | \
> > +   PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
> > +
> >  #define MX6Q_QMX6_PFUZE_MUXIMX_GPIO_NR(6, 9)
> >
> >
> > @@ -152,6 +156,13 @@ static iomux_v3_cfg_t enet_pads_ar8035[] = {
> > MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
> >  };
> >
> > +static iomux_v3_cfg_t const ecspi1_pads[] = {
> > +   MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
> > +   MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
> > +   MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
> > +   MX6_PAD_EIM_D19__GPIO3_IO19 | MUX_PAD_CTRL(NO_PAD_CTRL),
> > +};
> > +
> >  #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
> >  struct i2c_pads_info i2c_pad_info1 = {
> > .scl = {
> > @@ -381,6 +392,12 @@ static void setup_iomux_uart(void)
> > imx_iomux_v3_setup_multiple_pads(uart2_pads, 
> > ARRAY_SIZE(uart2_pads));
> >  }
> >
> > +void setup_spinor(void)
> > +{
> > +   imx_iomux_v3_setup_multiple_pads(ecspi1_pads, 
> > ARRAY_SIZE(ecspi1_pads));
> > +   gpio_direction_output(IMX_GPIO_NR(3, 19), 0);
> > +}
> > +
> >  #ifdef CONFIG_FSL_ESDHC
> >  static struct fsl_esdhc_cfg usdhc_cfg[] = {
> > {USDHC2_BASE_ADDR},
> > @@ -646,6 +663,7 @@ int board_early_init_f(void)
> >  {
> > setup_iomux_uart();
> > setup_display();
> > +   setup_spinor();
> >
> > return 0;
> >  }
> > @@ -671,6 +689,11 @@ int checkboard(void)
> > return 0;
> >  }
> >
> > +int board_spi_cs_gpio(unsigned bus, unsigned cs)
> > +{
> > +   return (bus == 0 && cs == 0) ? (IMX_GPIO_NR(3, 19)) : -EINVAL;
> > +}
> > +
> >  #ifdef CONFIG_CMD_BMODE
> >  static const struct boot_mode board_boot_modes[] = {
> > /* 4 bit bus width */
> > diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h
> > index e0aa4b0..9aa66c7 100644
> > --- a/include/configs/cgtqmx6eval.h
> > +++ b/include/configs/cgtqmx6eval.h
> > @@ -29,6 +29,16 @@
> >  /* MMC Configs */
> >  #define CONFIG_SYS_FSL_ESDHC_ADDR  0
> >
> > +/* SPI NOR */
> > +#define CONFIG_CMD_SF
> > +#define CONFIG_SPI_FLASH
> > +#define CONFIG_SPI_FLASH_STMICRO
> > +#define CONFIG_SPI_FLASH_SST
> > +#define CONFIG_MXC_SPI
> 
> Please try to move this to driver model, all these "spinor setup"
> stuff will go easily on probe call. Ping me anytime for any help.

I really prefer iterative development and improvement when possible.  If
follow-up on improvements doesn't happen we can always remove code for
lack of maintenance.

-- 
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] mtd: add altera quadspi driver

2015-11-03 Thread Marek Vasut
On Tuesday, November 03, 2015 at 06:49:44 PM, Jagan Teki wrote:
> On 3 November 2015 at 23:14, Marek Vasut  wrote:
> > On Tuesday, November 03, 2015 at 02:22:12 PM, Thomas Chou wrote:
> >> Add Altera Generic Quad SPI Controller support. The controller
> >> converts SPI NOR flash to parallel flash interface. So it is
> >> not like other SPI flash, but rather like CFI flash.
> 
> This should be part of drivers/mtd/spi-nor which I'm working
> currently, might take couple of days to push the patches to ML.

I think your patches are still far away from inclusion, so I'm
fine with the current way of doing things ;-)

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


Re: [U-Boot] [PATCH v5 2/6] cgtqmx6eval: Use SPI NOR to store the environment

2015-11-03 Thread Otavio Salvador
On Tue, Nov 3, 2015 at 3:43 PM, Jagan Teki  wrote:
> On 30 October 2015 at 16:04, Otavio Salvador  wrote:
>> Congatec boards boot from SPI NOR, so it makes more sense to use
>> SPI NOR to store the environment variables.
>>
>> Signed-off-by: Otavio Salvador 
...
>> +#define CONFIG_ENV_IS_IN_SPI_FLASH
>
> You make default flash env as spi-flash as this board boot from
> spi-nor always is it?

Yes; this is the supported setting by Congatec.


-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/5] ARM: omap-common: Add standard access for board description EEPROM

2015-11-03 Thread Igor Grinberg
On 11/03/15 17:26, Nishanth Menon wrote:
> On 11/03/2015 09:13 AM, Steven Kipisz wrote:
>> On 11/03/2015 07:16 AM, Igor Grinberg wrote:
>>> Hi Steve,
>>>
>>> On 11/03/15 14:22, Steve Kipisz wrote:
 From: Lokesh Vutla 
>>>
>>> [...]
>>>

 Signed-off-by: Lokesh Vutla 
 Signed-off-by: Steve Kipisz 
 ---
 v2 Based on
   master  a6104737  ARM: at91: sama5: change the environment
 address to 0x6000

 Changes in v2 (since v1)
 - make the EEPROM code mor generic for TI EVMs
 - rename structures/subroutines to ti_am_x
 - add routines to access the EEPROM data
 - redo commit message to be more clear

 v1:   http://marc.info/?t=14460800791=1=2
 (mailing list squashed original submission)

   arch/arm/cpu/armv7/omap-common/Makefile|   1 +
   arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c | 148
 +
   arch/arm/include/asm/omap_common.h | 130
 +-
   3 files changed, 278 insertions(+), 1 deletion(-)
   create mode 100644 arch/arm/cpu/armv7/omap-common/ti-i2c-eeprom.c

 diff --git a/arch/arm/cpu/armv7/omap-common/Makefile
 b/arch/arm/cpu/armv7/omap-common/Makefile
 index 464a5d1d732a..53a9fdb81100 100644
 --- a/arch/arm/cpu/armv7/omap-common/Makefile
 +++ b/arch/arm/cpu/armv7/omap-common/Makefile
 @@ -15,6 +15,7 @@ obj-y+= clocks-common.o
   obj-y+= emif-common.o
   obj-y+= vc.o
   obj-y+= abb.o
 +obj-$(CONFIG_I2C) += ti-i2c-eeprom.o
>>>
>>> This makes this module compile on all TI SoC based boards enabling I2C.
>>> AFAIU, this is a separate chip (not inside the SoC), so this module will
>>> also compile on non-TI boards that do not have this EEPROM.
>>> I think, it should be more fine grained (e.g. have its own symbol).
>>>
>> Can you give a suggestion?
> 
> Are you sure this will be built into non-ti SoCs with I2C enabled if you
> are not using the function? I assume  __maybe_unused should take care of
> that, no - let the compiler do the gc anyways?
> 
> 
> It should have been documented on commit message as well.
> 
> 
 + * @revision:Revision of the board
 + * @serial:Serial Number of the board
 + *
 + * In case of NULL revision or serial information "unknown" is setup.
 + * If name is NULL, default_name is used.
 + */
 +void set_board_info_env(char *name, char *default_name,
 +char *revision, char *serial);
 +
 +/**
 + * board_am_is() - Generic Board detection logic
 + * @name_tag:Tag used in eeprom for the board
 + *
 + * Return: false if board information does not match OR eeprom
 was'nt read.
 + *   true otherwise
 + */
 +static inline bool board_am_is(char *name_tag)
 +{
 +struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
 +
 +if (ep->header != TI_EEPROM_HEADER_MAGIC)
 +return false;
 +return !strncmp(ep->name, name_tag, TI_EEPROM_HDR_NAME_LEN);
 +}
>>>
>>> Why do you need to place non trivial function implementation inside the
>>> header file?
>>>
 +
 +/**
 + * board_am_rev_is() - Compare board revision
 + * @rev_tag:Revision tag to check in eeprom
 + * @cmp_len:How many chars to compare?
 + *
 + * NOTE: revision information is often messed up (hence the str len
 match) :(
 + *
 + * Return: false if board information does not match OR eeprom
 was'nt read.
 + *   true otherwise
 + */
 +static inline bool board_am_rev_is(char *rev_tag, int cmp_len)
 +{
 +struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
 +int l;
 +
 +if (ep->header != TI_EEPROM_HEADER_MAGIC)
 +return false;
 +
 +l = cmp_len > TI_EEPROM_HDR_REV_LEN ? TI_EEPROM_HDR_NAME_LEN :
 cmp_len;
 +return !strncmp(ep->version, rev_tag, l);
 +}
>>>
>>> Same here.
>>>
>> I thought by making them static inline would save space.
> 
> I prefer that myself as well.

I'm not sure I understand what space will it save?
AFAIK, inline places the function code inside the the caller function
and thus spreads into each caller, no? It probably saves some branches,
but how does that save space?

Also, AFAIR, we try to not place code inside headers, unless the code
is a stub.

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


Re: [U-Boot] [PATCH 1/4] armv8: enable compilation with CONFIG_SYS_NONCACHED_MEMORY

2015-11-03 Thread Tom Warren
Albert,

> -Original Message-
> From: Tom Warren
> Sent: Tuesday, October 27, 2015 1:39 PM
> To: 'Albert ARIBAUD' ; Stephen Warren
> 
> Cc: u-boot@lists.denx.de; Simon Glass ; Stephen Warren
> ; Thierry Reding ; York Sun
> ; Michal Simek 
> Subject: RE: [U-Boot] [PATCH 1/4] armv8: enable compilation with
> CONFIG_SYS_NONCACHED_MEMORY
> 
> Albert,
> 
> > -Original Message-
> > From: Albert ARIBAUD [mailto:albert.u.b...@aribaud.net]
> > Sent: Wednesday, October 21, 2015 11:26 PM
> > To: Stephen Warren 
> > Cc: u-boot@lists.denx.de; Simon Glass ; Tom Warren
> > ; Stephen Warren ; Thierry
> > Reding ; York Sun ; Michal
> > Simek 
> > Subject: Re: [U-Boot] [PATCH 1/4] armv8: enable compilation with
> > CONFIG_SYS_NONCACHED_MEMORY
> >
> > Hello Stephen,
> >
> > On Wed, 21 Oct 2015 10:35:59 -0600, Stephen Warren
> >  wrote:
> > > On 10/05/2015 12:08 PM, Stephen Warren wrote:
> > > > From: Stephen Warren 
> > > >
> > > > The implementation of noncached_init() uses define
> MMU_SECTION_SIZE.
> > > > Define this on ARM64.
> > > >
> > > > Move the prototype of noncached_{init,alloc}() to a location that
> > > > doesn't depend on !defined(CONFIG_ARM64).
> > > >
> > > > Note that noncached_init() calls mmu_set_region_dcache_behaviour()
> > > > which relies on something having set up translation tables with
> > > > 2MB block
> > size.
> > > > The core ARMv8 MMU setup code does not do this by default, but
> > > > currently relies on SoC specific MMU setup code. Be aware of this
> > > > before enabling this feature on your platform!
> > >
> > > Albert, it looks like I forgot to add you to the CC on this email.
> > > Sorry! Could you please take a look at this series and tell me what
> > > you think? If you need a resend just let me know.
> > >
> > > Also note that this series is a dependency for PCIe support on
> > > 64-bit Tegra systems; I guess either Tom Warren would be looking for
> > > an ack so he can apply the series to the Tegra tree, or perhaps if
> > > you just apply the whole series, he can base his branch on the
> > > branch where you apply
> > this.
> >
> > I'll have a look at it in the coming days.
> Please let me know when this series is in arm/master (or u-boot/master), as I
> need it to base Stephen's PCI/PCIe/XUSB patches on before I can send a PR for
> u-boot-tegra/master. Thanks!
I need this patchset in before I can add Stephen's PCIe/XUSB patchsets to Tegra 
U-Boot.

If you can Ack them, I can take them in via the Tegra repo, and send them 
upstream to TomR on my next PR. Or if you can let me know an ETA for getting 
them in to the ARM/master repo, I can base my schedule off of that. But I'm 
blocked until the ARMv8 MMU changes are in somewhere, and I'd like to clear 
this from my plate.

Thanks,

Tom
--
nvpublic
> 
> Tom
> --
> nvpublic
> >
> > Amicalement,
> > --
> > Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/5] ARM: omap-common: Add standard access for board description EEPROM

2015-11-03 Thread Nishanth Menon
On 11/03/2015 11:02 AM, Igor Grinberg wrote:

> +
> +/**
> + * board_am_rev_is() - Compare board revision
> + * @rev_tag:Revision tag to check in eeprom
> + * @cmp_len:How many chars to compare?
> + *
> + * NOTE: revision information is often messed up (hence the str len
> match) :(
> + *
> + * Return: false if board information does not match OR eeprom
> was'nt read.
> + *   true otherwise
> + */
> +static inline bool board_am_rev_is(char *rev_tag, int cmp_len)
> +{
> +struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
> +int l;
> +
> +if (ep->header != TI_EEPROM_HEADER_MAGIC)
> +return false;
> +
> +l = cmp_len > TI_EEPROM_HDR_REV_LEN ? TI_EEPROM_HDR_NAME_LEN :
> cmp_len;
> +return !strncmp(ep->version, rev_tag, l);
> +}

 Same here.

>>> I thought by making them static inline would save space.
>>
>> I prefer that myself as well.
> 
> I'm not sure I understand what space will it save?
> AFAIK, inline places the function code inside the the caller function
> and thus spreads into each caller, no? It probably saves some branches,
> but how does that save space?

I dont think it saves space, but rather a function call overhead for
trivial code as above.

> Also, AFAIR, we try to not place code inside headers, unless the code
> is a stub.


That does not always make sense. here it is a straight forward
comparison.. why hide it a function call deep when you can inline it?

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


Re: [U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Jagan Teki
On 3 November 2015 at 23:22, Marek Vasut  wrote:
> On Tuesday, November 03, 2015 at 06:49:44 PM, Jagan Teki wrote:
>> On 3 November 2015 at 23:14, Marek Vasut  wrote:
>> > On Tuesday, November 03, 2015 at 02:22:12 PM, Thomas Chou wrote:
>> >> Add Altera Generic Quad SPI Controller support. The controller
>> >> converts SPI NOR flash to parallel flash interface. So it is
>> >> not like other SPI flash, but rather like CFI flash.
>>
>> This should be part of drivers/mtd/spi-nor which I'm working
>> currently, might take couple of days to push the patches to ML.
>
> I think your patches are still far away from inclusion, so I'm
> fine with the current way of doing things ;-)

I think it's better to wait for main things to be done first, and if
possible I'm open for anyone to help me to move forward.

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


Re: [U-Boot] [PATCH v5 1/6] cgtqmx6eval: Add SPI NOR flash support

2015-11-03 Thread Jagan Teki
On 3 November 2015 at 22:12, Otavio Salvador
 wrote:
> On Tue, Nov 3, 2015 at 2:37 PM, Jagan Teki  wrote:
>> On 30 October 2015 at 16:04, Otavio Salvador  wrote:
>>> Add SPI NOR support:
>>>
>>> => sf probe
>>> SF: Detected SST25VF032B with page size 256 Bytes, erase size 4 KiB, total 
>>> 4 MiB
>>>
>>> Signed-off-by: Otavio Salvador 
> ...
>>> +/* SPI NOR */
>>> +#define CONFIG_CMD_SF
>>> +#define CONFIG_SPI_FLASH
>>> +#define CONFIG_SPI_FLASH_STMICRO
>>> +#define CONFIG_SPI_FLASH_SST
>>> +#define CONFIG_MXC_SPI
>>
>> Please try to move this to driver model, all these "spinor setup"
>> stuff will go easily on probe call. Ping me anytime for any help.
>
> I can work on this but I want to merge this working version before
> doing any changes.

Thanks, I really see this to happen many of board init stuff have to migrate.

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


[U-Boot] Peach Pi Hangs

2015-11-03 Thread Gordan Bobic

Hi,

I have built the latest mailing u-boot for the Peach Pi (Chromebook 2 
13"):


make peach-pi_defconfig; make; mkimage ...; vbutil_kernel ...;

u-boot itself loads fine. I can ext2load the itb file (zImage+DTB),
iminfo looks good, but when I issue bootm it shows the image info
then hangs forever at:

Starting kernel ...

If I take the same itb file and put it through vbutil_kernel, then dd
that onto the kernel partition, that boots fine, which implies that
the itb file itself is good.

What am I missing here?

On older devices when I had a problem like this it was due to things
like machid not being set correctly. From my understanding, the rough
equivalent of this with FDT is that the wrong is being used. Except
that the ITB file works when used alone (with vboot headers), it only
breaks when being loaded from u-boot.

Could this be caused by the u-boot DTB and the kernel DTB disagreeing?
u-boot's exynos5800-peach-pi.dts is not the same as the kernel's
exynos5422-peach-pi.dts (ChromeOS 3.8.11 kernel branch doesn't have a
exynos5800-peach-pi.dts file, and u-boot doesn't have the
exynos5422-peach-pi.dts). Is this the likely cause? What can I do to
make this work?

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


Re: [U-Boot] [PATCH v5 1/6] cgtqmx6eval: Add SPI NOR flash support

2015-11-03 Thread Jagan Teki
On 30 October 2015 at 16:04, Otavio Salvador  wrote:
> Add SPI NOR support:
>
> => sf probe
> SF: Detected SST25VF032B with page size 256 Bytes, erase size 4 KiB, total 4 
> MiB
>
> Signed-off-by: Otavio Salvador 
> ---
>
> Changes in v5: None
> Changes in v4: None
>
>  board/congatec/cgtqmx6eval/cgtqmx6eval.c | 23 +++
>  include/configs/cgtqmx6eval.h| 12 
>  2 files changed, 35 insertions(+)
>
> diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c 
> b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
> index cf5607b..18e408b 100644
> --- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
> +++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
> @@ -45,6 +45,10 @@ DECLARE_GLOBAL_DATA_PTR;
> PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
> PAD_CTL_ODE | PAD_CTL_SRE_FAST)
>
> +#define SPI_PAD_CTRL (PAD_CTL_HYS |\
> +   PAD_CTL_SPEED_MED | \
> +   PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
> +
>  #define MX6Q_QMX6_PFUZE_MUXIMX_GPIO_NR(6, 9)
>
>
> @@ -152,6 +156,13 @@ static iomux_v3_cfg_t enet_pads_ar8035[] = {
> MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
>  };
>
> +static iomux_v3_cfg_t const ecspi1_pads[] = {
> +   MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
> +   MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
> +   MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
> +   MX6_PAD_EIM_D19__GPIO3_IO19 | MUX_PAD_CTRL(NO_PAD_CTRL),
> +};
> +
>  #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
>  struct i2c_pads_info i2c_pad_info1 = {
> .scl = {
> @@ -381,6 +392,12 @@ static void setup_iomux_uart(void)
> imx_iomux_v3_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads));
>  }
>
> +void setup_spinor(void)
> +{
> +   imx_iomux_v3_setup_multiple_pads(ecspi1_pads, 
> ARRAY_SIZE(ecspi1_pads));
> +   gpio_direction_output(IMX_GPIO_NR(3, 19), 0);
> +}
> +

As this init stuff is related to MXC better to move this with
CONFIG_MXC_SPI defined.

>  #ifdef CONFIG_FSL_ESDHC
>  static struct fsl_esdhc_cfg usdhc_cfg[] = {
> {USDHC2_BASE_ADDR},
> @@ -646,6 +663,7 @@ int board_early_init_f(void)
>  {
> setup_iomux_uart();
> setup_display();
> +   setup_spinor();
>
> return 0;
>  }
> @@ -671,6 +689,11 @@ int checkboard(void)
> return 0;
>  }
>
> +int board_spi_cs_gpio(unsigned bus, unsigned cs)
> +{
> +   return (bus == 0 && cs == 0) ? (IMX_GPIO_NR(3, 19)) : -EINVAL;
> +}
> +
>  #ifdef CONFIG_CMD_BMODE
>  static const struct boot_mode board_boot_modes[] = {
> /* 4 bit bus width */
> diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h
> index e0aa4b0..9aa66c7 100644
> --- a/include/configs/cgtqmx6eval.h
> +++ b/include/configs/cgtqmx6eval.h
> @@ -29,6 +29,16 @@
>  /* MMC Configs */
>  #define CONFIG_SYS_FSL_ESDHC_ADDR  0
>
> +/* SPI NOR */
> +#define CONFIG_CMD_SF
> +#define CONFIG_SPI_FLASH
> +#define CONFIG_SPI_FLASH_STMICRO
> +#define CONFIG_SPI_FLASH_SST
> +#define CONFIG_MXC_SPI
> +#define CONFIG_SF_DEFAULT_BUS  0
> +#define CONFIG_SF_DEFAULT_SPEED2000
> +#define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
> +
>  /* Miscellaneous commands */
>  #define CONFIG_CMD_BMODE
>
> @@ -200,8 +210,10 @@
> "else " \
> "bootz; " \
> "fi;\0" \
> +   "spilock=sf probe && sf protect lock 0x3f 0x1;"\
>
>  #define CONFIG_BOOTCOMMAND \
> +   "run spilock;"  \
> "mmc dev ${mmcdev};" \
> "if mmc rescan; then " \
> "if run loadbootscript; then " \
> --
> 2.6.2
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot



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


Re: [U-Boot] [PATCH] arm: socfpga: reset: correct dma, qspi, and sdmmc reset bit defines

2015-11-03 Thread Marek Vasut
On Tuesday, November 03, 2015 at 12:11:21 AM, dingu...@opensource.altera.com 
wrote:
> From: Dinh Nguyen 
> 
> The DMA, QSPI, and SD/MMC reset bits are located in the permodrst register,
> not the mpumodrst. So the bank for these reset bits should be 1, not 0.
> 
> Signed-off-by: Dinh Nguyen 

Applied, thanks!

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


Re: [U-Boot] [PATCH v5 2/6] cgtqmx6eval: Use SPI NOR to store the environment

2015-11-03 Thread Jagan Teki
On 30 October 2015 at 16:04, Otavio Salvador  wrote:
> Congatec boards boot from SPI NOR, so it makes more sense to use
> SPI NOR to store the environment variables.
>
> Signed-off-by: Otavio Salvador 
> ---
>
> Changes in v5: None
> Changes in v4: None
>
>  include/configs/cgtqmx6eval.h | 18 ++
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h
> index 9aa66c7..79183c4 100644
> --- a/include/configs/cgtqmx6eval.h
> +++ b/include/configs/cgtqmx6eval.h
> @@ -245,11 +245,21 @@
> (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
>
>  /* Environment organization */
> -#define CONFIG_ENV_SIZE(8 * 1024)
> -
> -#define CONFIG_ENV_IS_IN_MMC
> -
> +#if defined (CONFIG_ENV_IS_IN_MMC)
>  #define CONFIG_ENV_OFFSET  (6 * 64 * 1024)
>  #define CONFIG_SYS_MMC_ENV_DEV 0
> +#endif
> +
> +#define CONFIG_ENV_SIZE(8 * 1024)
> +
> +#define CONFIG_ENV_IS_IN_SPI_FLASH

You make default flash env as spi-flash as this board boot from
spi-nor always is it?

> +#if defined(CONFIG_ENV_IS_IN_SPI_FLASH)
> +#define CONFIG_ENV_OFFSET  (768 * 1024)
> +#define CONFIG_ENV_SECT_SIZE   (64 * 1024)
> +#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS
> +#define CONFIG_ENV_SPI_CS  CONFIG_SF_DEFAULT_CS
> +#define CONFIG_ENV_SPI_MODECONFIG_SF_DEFAULT_MODE
> +#define CONFIG_ENV_SPI_MAX_HZ  CONFIG_SF_DEFAULT_SPEED
> +#endif
>
>  #endif/* __CONFIG_CGTQMX6EVAL_H */
> --
> 2.6.2
>


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


[U-Boot] [PATCH] LCD: Add an option to skip registration as an stdio output

2015-11-03 Thread sayotte . tyco
From: Stephane Ayotte 

This patch adds an option to skip the registration of LCD stdio ouput for
boards that want to show different text on LCD than on serial output (or
the active stdout selected by the environment variable).

Signed-off-by: Stephane Ayotte 
---

This implementation is similar to what has been added to cfb_console.c by
Stefan Roese  per commit 6cc7ba9e on 05/15/2009

I am sending this patch using 
as our regular smtp server  causes patch issues.

 common/lcd.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/common/lcd.c b/common/lcd.c
index d29308a..ed68be9 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -143,6 +143,16 @@ __weak int lcd_get_size(int *line_length)
return *line_length * panel_info.vl_row;
 }
 
+/*
+ * Implement a weak default function for boards that optionally
+ * need to skip the lcd console initialization.
+ */
+__weak int board_lcd_console_skip(void)
+{
+   /* As default, don't skip cfb init */
+   return 0;
+}
+
 int drv_lcd_init(void)
 {
struct stdio_dev lcddev;
@@ -152,6 +162,9 @@ int drv_lcd_init(void)
 
lcd_init(lcd_base);
 
+   if (board_lcd_console_skip())
+   return 0;
+
/* Device initialization */
memset(, 0, sizeof(lcddev));
 
-- 
1.8.3.1

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


Re: [U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Jagan Teki
On 3 November 2015 at 23:14, Marek Vasut  wrote:
> On Tuesday, November 03, 2015 at 02:22:12 PM, Thomas Chou wrote:
>> Add Altera Generic Quad SPI Controller support. The controller
>> converts SPI NOR flash to parallel flash interface. So it is
>> not like other SPI flash, but rather like CFI flash.

This should be part of drivers/mtd/spi-nor which I'm working
currently, might take couple of days to push the patches to ML.

>>
>> Signed-off-by: Thomas Chou 
>> ---
>
> You might want to look at https://lwn.net/Articles/636882/ , it is the
> driver for the same hardware, but for Linux. But keep in mind that the
> driver had some difficulties getting in, you might want to check the
> discussions in linux-mtd .
>

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


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

2015-11-03 Thread Jagan Teki
Hi Tom,

Please pull this series.

thanks!
Jagan.

The following changes since commit 96d59e9d6aa74e35c63dc74da10e41f8ba0f6de4:

  mpc85xx/t2081: enable parsing DDR ratio for T2081 rev1.1 (2015-11-02 08:51:50 
-0800)

are available in the git repository at:

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

for you to fetch changes up to e39e68f155b4fcd47f62ab2cf0e199d04f38446d:

  sf: Add SPI NOR protection mechanism (2015-11-03 21:51:37 +0530)


Fabio Estevam (16):
  include: Add log2 header from the kernel
  include: Add generic bitops headers
  ARM: bitops: Use the generic bitops headers
  x86: bitops: Use the generic bitops headers
  m68k: bitops: Use the generic bitops headers
  blackfin: bitops: Use the generic bitops headers
  sh: bitops: Use the generic bitops headers
  sandbox: Use the generic bitops headers
  sparc: Use the generic bitops headers
  openrisc: Use the generic bitops headers
  nds32: Use the generic bitops headers
  nios2: Use the generic bitops headers
  compat: Remove is_power_of_2() definition
  powerpc: Remove __ilog2_u64 and ffs4 from bitops
  sf: Add SPI protection mechanism from the kernel
  sf: Add SPI NOR protection mechanism

 arch/arm/include/asm/bitops.h|   5 +
 arch/arm/mach-mvebu/mbus.c   |   2 +-
 arch/blackfin/include/asm/bitops.h   |   4 +
 arch/m68k/include/asm/bitops.h   |   4 +
 arch/microblaze/include/asm/bitops.h |   4 +
 arch/nds32/include/asm/bitops.h  |   4 +
 arch/nios2/include/asm/bitops.h  |   5 +
 arch/openrisc/include/asm/bitops.h   |   4 +
 arch/powerpc/cpu/mpc83xx/law.c   |   5 +-
 arch/powerpc/cpu/mpc85xx/tlb.c   |   2 +
 arch/powerpc/cpu/mpc8xxx/law.c   |   5 +-
 arch/powerpc/include/asm/bitops.h|  11 +-
 arch/powerpc/include/asm/fsl_law.h   |   1 +
 arch/powerpc/include/asm/fsl_srio.h  |   2 +
 arch/sandbox/include/asm/bitops.h|   4 +
 arch/sh/include/asm/bitops.h |   5 +
 arch/sparc/include/asm/bitops.h  |   5 +
 arch/x86/include/asm/bitops.h|  21 +++-
 common/cmd_sf.c  |  35 ++
 drivers/mtd/mtdcore.c|   2 +-
 drivers/mtd/spi/sf_internal.h|  12 ++
 drivers/mtd/spi/sf_ops.c | 180 ++
 drivers/mtd/spi/sf_probe.c   |  13 +++
 drivers/mtd/ubi/build.c  |   2 +-
 fs/ubifs/super.c |   2 +-
 include/asm-generic/bitops/__ffs.h   |  43 
 include/asm-generic/bitops/__fls.h   |  43 
 include/asm-generic/bitops/fls.h |  41 +++
 include/asm-generic/bitops/fls64.h   |  36 ++
 include/linux/bitops.h   |  27 +
 include/linux/compat.h   |   6 -
 include/linux/log2.h | 205 +++
 include/spi_flash.h  |  19 
 33 files changed, 734 insertions(+), 25 deletions(-)
 create mode 100644 include/asm-generic/bitops/__ffs.h
 create mode 100644 include/asm-generic/bitops/__fls.h
 create mode 100644 include/asm-generic/bitops/fls.h
 create mode 100644 include/asm-generic/bitops/fls64.h
 create mode 100644 include/linux/log2.h
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 2/6] cgtqmx6eval: Use SPI NOR to store the environment

2015-11-03 Thread Jagan Teki
On 3 November 2015 at 23:44, Otavio Salvador
 wrote:
> On Tue, Nov 3, 2015 at 3:43 PM, Jagan Teki  wrote:
>> On 30 October 2015 at 16:04, Otavio Salvador  wrote:
>>> Congatec boards boot from SPI NOR, so it makes more sense to use
>>> SPI NOR to store the environment variables.
>>>
>>> Signed-off-by: Otavio Salvador 

Reviewed-by: Jagan Teki 

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


Re: [U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Marek Vasut
On Tuesday, November 03, 2015 at 02:22:12 PM, Thomas Chou wrote:
> Add Altera Generic Quad SPI Controller support. The controller
> converts SPI NOR flash to parallel flash interface. So it is
> not like other SPI flash, but rather like CFI flash.
> 
> Signed-off-by: Thomas Chou 
> ---

You might want to look at https://lwn.net/Articles/636882/ , it is the
driver for the same hardware, but for Linux. But keep in mind that the
driver had some difficulties getting in, you might want to check the
discussions in linux-mtd .

[...]

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


Re: [U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Marek Vasut
On Tuesday, November 03, 2015 at 06:56:26 PM, Jagan Teki wrote:
> On 3 November 2015 at 23:22, Marek Vasut  wrote:
> > On Tuesday, November 03, 2015 at 06:49:44 PM, Jagan Teki wrote:
> >> On 3 November 2015 at 23:14, Marek Vasut  wrote:
> >> > On Tuesday, November 03, 2015 at 02:22:12 PM, Thomas Chou wrote:
> >> >> Add Altera Generic Quad SPI Controller support. The controller
> >> >> converts SPI NOR flash to parallel flash interface. So it is
> >> >> not like other SPI flash, but rather like CFI flash.
> >> 
> >> This should be part of drivers/mtd/spi-nor which I'm working
> >> currently, might take couple of days to push the patches to ML.
> > 
> > I think your patches are still far away from inclusion, so I'm
> > fine with the current way of doing things ;-)
> 
> I think it's better to wait for main things to be done first, and if
> possible I'm open for anyone to help me to move forward.

That's fine all right, but you cannot block other patches only because
there are some other unfinished ones which might land in mainline who
knows when.

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


Re: [U-Boot] [RFC PATCH 5/8] net: ipv6 support

2015-11-03 Thread Joe Hershberger
Hi Chris,

On Tue, Nov 3, 2015 at 2:54 PM, Chris Packham  wrote:
> On Wed, Nov 4, 2015 at 8:41 AM, Joe Hershberger
>  wrote:
> 
>
>>> I'm actually testing with x86 on QEMU so I think LE is all good. I'll
>>> remove the comment.
>>
>> Great. Have you done any testing in sandbox? I'd really like to see
>> unit tests go in as part of this series.
>>
>
> I'll take a look. For the parsing etc that should be doable. I think I
> may run into problems with the linux network stack getting in the way
> for some of the link-local handling. Are there any existing tests for
> the networking code?

Yes, there is test/dm/eth.c that does some pinging to test out the
Ethernet stack.

Also, sandbox has drivers/net/sandbox-raw.c that allows sandbox to
interact with the host network adapter. See
board/sandbox/README.sandbox

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


Re: [U-Boot] [PATCH v2 3/5] ARM: omap-common: Add standard access for board description EEPROM

2015-11-03 Thread Nishanth Menon
On 11/03/2015 03:07 PM, Igor Grinberg wrote:
> On 11/03/15 19:45, Nishanth Menon wrote:
>> On 11/03/2015 11:02 AM, Igor Grinberg wrote:
>>
>>> +
>>> +/**
>>> + * board_am_rev_is() - Compare board revision
>>> + * @rev_tag:Revision tag to check in eeprom
>>> + * @cmp_len:How many chars to compare?
>>> + *
>>> + * NOTE: revision information is often messed up (hence the str len
>>> match) :(
>>> + *
>>> + * Return: false if board information does not match OR eeprom
>>> was'nt read.
>>> + *   true otherwise
>>> + */
>>> +static inline bool board_am_rev_is(char *rev_tag, int cmp_len)
>>> +{
>>> +struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
>>> +int l;
>>> +
>>> +if (ep->header != TI_EEPROM_HEADER_MAGIC)
>>> +return false;
>>> +
>>> +l = cmp_len > TI_EEPROM_HDR_REV_LEN ? TI_EEPROM_HDR_NAME_LEN :
>>> cmp_len;
>>> +return !strncmp(ep->version, rev_tag, l);
>>> +}
>>
>> Same here.
>>
> I thought by making them static inline would save space.

 I prefer that myself as well.
>>>
>>> I'm not sure I understand what space will it save?
>>> AFAIK, inline places the function code inside the the caller function
>>> and thus spreads into each caller, no? It probably saves some branches,
>>> but how does that save space?
>>
>> I dont think it saves space, but rather a function call overhead for
>> trivial code as above.
> 
> I'm sorry, IMO the above code is not trivial enough... 
> or just it is not trivial: several variables on the stack,
> some logic which is not that straight forward for someone who is
> not familiar with the code and defines that are mapped into an SRAM...
> and we also have strings comparison in the end.
> Come on... that is not trivial at all. Moreover it gives a very bad
> example to any newcomer...
> 

:) OK, agreed. makes sense. I think Steve can definitely push it off
into the board/ti/common/ file :).

>>
>>> Also, AFAIR, we try to not place code inside headers, unless the code
>>> is a stub.
>>
>>
>> That does not always make sense. here it is a straight forward
>> comparison.. why hide it a function call deep when you can inline it?
> 
> Well, at least because header files are not meant to hold code.
> Accepting this gives a bad example and reduces code quality...
> 

Fair enough. Thanks for reviewing it.

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


Re: [U-Boot] [PATCH v2 3/5] ARM: omap-common: Add standard access for board description EEPROM

2015-11-03 Thread Igor Grinberg
On 11/03/15 19:45, Nishanth Menon wrote:
> On 11/03/2015 11:02 AM, Igor Grinberg wrote:
> 
>> +
>> +/**
>> + * board_am_rev_is() - Compare board revision
>> + * @rev_tag:Revision tag to check in eeprom
>> + * @cmp_len:How many chars to compare?
>> + *
>> + * NOTE: revision information is often messed up (hence the str len
>> match) :(
>> + *
>> + * Return: false if board information does not match OR eeprom
>> was'nt read.
>> + *   true otherwise
>> + */
>> +static inline bool board_am_rev_is(char *rev_tag, int cmp_len)
>> +{
>> +struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
>> +int l;
>> +
>> +if (ep->header != TI_EEPROM_HEADER_MAGIC)
>> +return false;
>> +
>> +l = cmp_len > TI_EEPROM_HDR_REV_LEN ? TI_EEPROM_HDR_NAME_LEN :
>> cmp_len;
>> +return !strncmp(ep->version, rev_tag, l);
>> +}
>
> Same here.
>
 I thought by making them static inline would save space.
>>>
>>> I prefer that myself as well.
>>
>> I'm not sure I understand what space will it save?
>> AFAIK, inline places the function code inside the the caller function
>> and thus spreads into each caller, no? It probably saves some branches,
>> but how does that save space?
> 
> I dont think it saves space, but rather a function call overhead for
> trivial code as above.

I'm sorry, IMO the above code is not trivial enough... 
or just it is not trivial: several variables on the stack,
some logic which is not that straight forward for someone who is
not familiar with the code and defines that are mapped into an SRAM...
and we also have strings comparison in the end.
Come on... that is not trivial at all. Moreover it gives a very bad
example to any newcomer...

> 
>> Also, AFAIR, we try to not place code inside headers, unless the code
>> is a stub.
> 
> 
> That does not always make sense. here it is a straight forward
> comparison.. why hide it a function call deep when you can inline it?

Well, at least because header files are not meant to hold code.
Accepting this gives a bad example and reduces code quality...

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


Re: [U-Boot] [RFC PATCH 6/8] net: TFTP over IPv6

2015-11-03 Thread Joe Hershberger
Hi Jean-Pierre,

On Tue, Nov 3, 2015 at 4:41 AM, Jean-Pierre Tosoni  wrote:
> Hi all,
>
>> -Message d'origine-
>> De : Joe Hershberger [mailto:joe.hershber...@gmail.com]
>> Envoyé : lundi 2 novembre 2015 21:44
>> À : Chris Packham
>> Cc : u-boot; Joe Hershberger; jp.tos...@acksys.fr; Hanna Hawa; Angga
>> Objet : Re: [U-Boot] [RFC PATCH 6/8] net: TFTP over IPv6
>>
> (...)
>> > ---
>> > One problem with the [hostIpAddr:]fileName syntax is that IPv6
>> > addresses contains colons. So tftp_start() would be confused by
>> > 'tftpboot6 $loadaddr 2001:db8::1:zImage'. It is probably possible to
>> > change the parsing to separate the host from the filename by parsing
>> > from the end (i.e. use strrchr() instead of strchr()) but then there
>> > are error cases that may not be handled correctly (e.g. omitting the
>> filename).
>>
>> I think we should just change the filename separator for tftp6. How about
>> ','?
>>
>
> How about a '/' to make it look like an URL ? More intuitive maybe.

That might work, but it also could be part of the path to the file
itself. It doesn't seem good to be ambiguous about that or to require
2001:db8::1//kernel.tgz

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


Re: [U-Boot] [RFC PATCH 5/8] net: ipv6 support

2015-11-03 Thread Joe Hershberger
Hi Chris,

On Tue, Nov 3, 2015 at 4:11 AM, Chris Packham  wrote:
> Hi Joe,
>
> I've answered a few questions below. I'll address your comments more
> completely before sending another round next week (or I can sit on it
> for longer if you want me to give you some breathing room).

Feel free to send it when you're ready.

> On Tue, Nov 3, 2015 at 9:43 AM, Joe Hershberger
>  wrote:
>> Hi Chris,
>>
>> On Mon, Oct 12, 2015 at 2:43 AM, Chris Packham  
>> wrote:
>>> Adds basic support for IPv6. Neighbor discovery and ping6 are the only
>>> things supported at the moment.
>>>
>>> Helped-by: Hanna Hawa  [endian & alignment fixes]
>>> Signed-off-by: Chris Packham 
>>> ---
>>> Now we have something functional. With this you can do something like
>>> 'setenv ipaddr6 3ffe::2' and 'ping6 3ffe::1' should work.
>>>
>>> I seem to have a problem that when you send a ping6 for a non-existent
>>> address that ends up stuck and the next non-ipv6 net operation tries to
>>> resolve it. I suspect this is because the pending neighbor discovery
>>> information isn't cleaned up properly, I need to look into that.
>>>
>>> The environment variable prefixlength6 is a bit fiddly. No-one uses a
>>> netmask6 (it'd mean a lot of ::...) it's almost always done by
>>> including the prefix length in the address (e.g. ip addr add
>>> 2001:db8::1/64) I'm contemplating adopting that syntax and dropping
>>> prefixlength6.
>>>
>>> This patch is bigger than I'd like it to be but I'm not sure how to
>>> split it up and keep the parts build able.
>>
>> It is pretty huge. It's taken me a while to get through it.
>>
>
> Thanks for making the effort to review. I realise it's pretty huge and
> I'll put some effort into splitting it futher. One obvious thing that
> could be split out is the new environment variables.

Sounds good.

>>>  common/Kconfig |  15 ++
>>>  common/cmd_net.c   |  28 
>>>  include/env_callback.h |   9 ++
>>>  include/env_flags.h|  10 ++
>>>  include/net.h  |   5 +-
>>>  include/net6.h | 212 
>>>  net/Kconfig|   5 +
>>>  net/Makefile   |   3 +
>>>  net/ndisc.c| 269 +++
>>>  net/ndisc.h|  27 
>>>  net/net.c  |  36 -
>>>  net/net6.c | 375 
>>> +
>>>  net/ping6.c| 111 +++
>>>  13 files changed, 1102 insertions(+), 3 deletions(-)
>>>  create mode 100644 net/ndisc.c
>>>  create mode 100644 net/ndisc.h
>>>  create mode 100644 net/net6.c
>>>  create mode 100644 net/ping6.c
>>>
>>> diff --git a/common/Kconfig b/common/Kconfig
>>> index 2c42b8e..c72563d 100644
>>> --- a/common/Kconfig
>>> +++ b/common/Kconfig
>>> @@ -389,6 +389,15 @@ config CMD_NET
>>>   bootp - boot image via network using BOOTP/TFTP protocol
>>>   tftpboot - boot image via network using TFTP protocol
>>>
>>> +config CMD_NET6
>>> +   bool "ipv6 commands"
>>> +   select NET
>>> +   select NET6
>>> +   default n
>>> +   help
>>> + IPv6 network commands
>>> + tftpboot6 - boot image via network using TFTP protocol
>>
>> This is added in the next patch, so should probably move there.
>>
>
> Will do.
>
>>> +
>>>  config CMD_TFTPPUT
>>> bool "tftp put"
>>> help
>>> @@ -420,6 +429,12 @@ config CMD_PING
>>> help
>>>   Send ICMP ECHO_REQUEST to network host
>>>
>>> +config CMD_PING6
>>> +   bool "ping6"
>>> +   depends on CMD_NET6
>>> +   help
>>> + Send ICMPv6 ECHO_REQUEST to network host
>>
>> What makes ping inseparable from the core support?
>>
>
> Mainly testing, I can't test the core code without ping. But I can see
> that from a patch submission point of few splitting it out will make
> review easier.

One simple way to prove out the core without ping would maybe be to
rebase and switch tftp with ping and make sure that tftp works without
ping. Then you at least know you have enough, but you won't know if
you left in more than you need.

>>> +
>>>  config CMD_CDP
>>> bool "cdp"
>>> help

--8< snip 8<--

>>> diff --git a/include/env_callback.h b/include/env_callback.h
>>> index 90b95b5..9027f3f 100644
>>> --- a/include/env_callback.h
>>> +++ b/include/env_callback.h
>>> @@ -60,6 +60,14 @@
>>>  #define NET_CALLBACKS
>>>  #endif
>>>
>>> +#ifdef CONFIG_NET6
>>> +#define NET6_CALLBACKS \
>>> +   "ip6addr:ip6addr," \
>>> +   "serverip6:serverip6," \
>>> +   "prefixlength6:prefixlength6,"
>>
>> I like the other nomenclature better as well (included in the address).
>>
>
> I've actually already implemented the code to include the prefixlength
> in the address and it makes things a lot more usable (the parsing code
> is a bit more complicated).

Sounds good.

>>> +#else
>>> 

Re: [U-Boot] [RFC PATCH 6/8] net: TFTP over IPv6

2015-11-03 Thread Joe Hershberger
Hi Chris,

On Tue, Nov 3, 2015 at 4:15 AM, Chris Packham  wrote:
> On Tue, Nov 3, 2015 at 9:43 AM, Joe Hershberger
>  wrote:
>> Hi Chris,
>>
>> On Mon, Oct 12, 2015 at 2:43 AM, Chris Packham  
>> wrote:
>>> Add support for UDP/TFTP over IPv6.
>>>
>>> Signed-off-by: Chris Packham 
>>> ---
>>> One problem with the [hostIpAddr:]fileName syntax is that IPv6 addresses
>>> contains colons. So tftp_start() would be confused by 'tftpboot6
>>> $loadaddr 2001:db8::1:zImage'. It is probably possible to change the
>>> parsing to separate the host from the filename by parsing from the end
>>> (i.e. use strrchr() instead of strchr()) but then there are error cases
>>> that may not be handled correctly (e.g. omitting the filename).
>>
>> I think we should just change the filename separator for tftp6. How about 
>> ','?
>>
>
> The other strategy that is often used is to use square brackets to
> separate the address from other data e.g. http://[2001:db8::1]:8080/.
> Maybe that is a better (or at least more common) approach.

Sounds good to me - I'm all for going with a common approach.

>>>  common/cmd_net.c | 13 
>>>  include/net6.h   |  4 
>>>  net/net.c|  3 +++
>>>  net/net6.c   | 64 
>>> 
>>>  net/tftp.c   | 37 
>>>  5 files changed, 121 insertions(+)

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


Re: [U-Boot] [RFC PATCH 5/8] net: ipv6 support

2015-11-03 Thread Chris Packham
On Wed, Nov 4, 2015 at 8:41 AM, Joe Hershberger
 wrote:


>> I'm actually testing with x86 on QEMU so I think LE is all good. I'll
>> remove the comment.
>
> Great. Have you done any testing in sandbox? I'd really like to see
> unit tests go in as part of this series.
>

I'll take a look. For the parsing etc that should be doable. I think I
may run into problems with the linux network stack getting in the way
for some of the link-local handling. Are there any existing tests for
the networking code?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2] mpc85xx: Add support for the Varisys Cyrus board

2015-11-03 Thread Andy Fleming
This board runs a P5020 or P5040 chip, and utilizes
an EEPROM with similar formatting to the Freescale P5020DS.

Large amounts of this code were developed by
Adrian Cox 

Signed-off-by: Andy Fleming 
---
v2:
* Cleaned up sys_eeprom.c
* Removed CONFIG_CMD_ELF, CONFIG_SYS_GENERIC_BOARD

 arch/powerpc/cpu/mpc85xx/Kconfig |   4 +
 board/varisys/common/Makefile|  23 ++
 board/varisys/common/eeprom.h|   6 +
 board/varisys/common/sys_eeprom.c| 500 +
 board/varisys/cyrus/Kconfig  |  13 +
 board/varisys/cyrus/Makefile |   8 +
 board/varisys/cyrus/README   |  21 ++
 board/varisys/cyrus/cyrus.c  | 116 +++
 board/varisys/cyrus/cyrus.h  |  11 +
 board/varisys/cyrus/ddr.c| 188 +++
 board/varisys/cyrus/eth.c| 100 ++
 board/varisys/cyrus/law.c|  27 ++
 board/varisys/cyrus/pbi.cfg  |  35 +++
 board/varisys/cyrus/pci.c|  23 ++
 board/varisys/cyrus/rcw_p5020_v2.cfg |  11 +
 board/varisys/cyrus/rcw_p5040.cfg|  11 +
 board/varisys/cyrus/tlb.c| 106 +++
 configs/Cyrus_P5020_defconfig|   9 +
 configs/Cyrus_P5040_defconfig|   9 +
 include/configs/cyrus.h  | 588 +++
 20 files changed, 1809 insertions(+)
 create mode 100644 board/varisys/common/Makefile
 create mode 100644 board/varisys/common/eeprom.h
 create mode 100644 board/varisys/common/sys_eeprom.c
 create mode 100644 board/varisys/cyrus/Kconfig
 create mode 100644 board/varisys/cyrus/Makefile
 create mode 100644 board/varisys/cyrus/README
 create mode 100644 board/varisys/cyrus/cyrus.c
 create mode 100644 board/varisys/cyrus/cyrus.h
 create mode 100644 board/varisys/cyrus/ddr.c
 create mode 100644 board/varisys/cyrus/eth.c
 create mode 100644 board/varisys/cyrus/law.c
 create mode 100644 board/varisys/cyrus/pbi.cfg
 create mode 100644 board/varisys/cyrus/pci.c
 create mode 100644 board/varisys/cyrus/rcw_p5020_v2.cfg
 create mode 100644 board/varisys/cyrus/rcw_p5040.cfg
 create mode 100644 board/varisys/cyrus/tlb.c
 create mode 100644 configs/Cyrus_P5020_defconfig
 create mode 100644 configs/Cyrus_P5040_defconfig
 create mode 100644 include/configs/cyrus.h

diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig
index ae0823a..0b89157 100644
--- a/arch/powerpc/cpu/mpc85xx/Kconfig
+++ b/arch/powerpc/cpu/mpc85xx/Kconfig
@@ -149,6 +149,9 @@ config TARGET_XPEDITE550X
 config TARGET_UCP1020
bool "Support uCP1020"
 
+config TARGET_CYRUS
+   bool "Support Varisys Cyrus"
+
 endchoice
 
 source "board/freescale/b4860qds/Kconfig"
@@ -185,6 +188,7 @@ source "board/gdsys/p1022/Kconfig"
 source "board/keymile/kmp204x/Kconfig"
 source "board/sbc8548/Kconfig"
 source "board/socrates/Kconfig"
+source "board/varisys/cyrus/Kconfig"
 source "board/xes/xpedite520x/Kconfig"
 source "board/xes/xpedite537x/Kconfig"
 source "board/xes/xpedite550x/Kconfig"
diff --git a/board/varisys/common/Makefile b/board/varisys/common/Makefile
new file mode 100644
index 000..1e6dcbb
--- /dev/null
+++ b/board/varisys/common/Makefile
@@ -0,0 +1,23 @@
+#
+# (C) Copyright 2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+MINIMAL=
+
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+# necessary to create built-in.o
+obj- := __dummy__.o
+else
+ifndef CONFIG_SPL_BUILD
+obj-$(CONFIG_ID_EEPROM)+= sys_eeprom.o
+endif
+endif
diff --git a/board/varisys/common/eeprom.h b/board/varisys/common/eeprom.h
new file mode 100644
index 000..004816a
--- /dev/null
+++ b/board/varisys/common/eeprom.h
@@ -0,0 +1,6 @@
+/* EEPROM init functions for Cyrus */
+
+
+void init_eeprom(int bus_num, int addr, int addr_len);
+void mac_read_from_fixed_id(void);
+int mac_read_from_eeprom_common(void);
diff --git a/board/varisys/common/sys_eeprom.c 
b/board/varisys/common/sys_eeprom.c
new file mode 100644
index 000..086fad2
--- /dev/null
+++ b/board/varisys/common/sys_eeprom.c
@@ -0,0 +1,500 @@
+/*
+ * Copyright 2006, 2008-2009, 2011 Freescale Semiconductor
+ * York Sun (york...@freescale.com)
+ * Haiying Wang (haiying.w...@freescale.com)
+ * Timur Tabi (ti...@freescale.com)
+ *
+ * This defines the API for storing board information in the
+ * eeprom. It has been adapted from an earlier version of the
+ * Freescale code for doing the same thing. Therefore it is
+ * nearly identical to the Freescale code, but is intended for
+ * use with Varisys-produced boards.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "eeprom.h"
+
+#ifdef CONFIG_SYS_I2C_EEPROM_NXID_MAC
+#define MAX_NUM_PORTS  CONFIG_SYS_I2C_EEPROM_NXID_MAC
+#else
+#define MAX_NUM_PORTS  8
+#endif
+#define NXID_VERSION   0
+
+/**
+ * static eeprom: EEPROM layout for NXID formats
+ *
+ * See 

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

2015-11-03 Thread Tom Rini
On Tue, Nov 03, 2015 at 11:39:56PM +0530, Jagan Teki wrote:

> Hi Tom,
> 
> Please pull this series.
> 
> thanks!
> Jagan.
> 
> The following changes since commit 96d59e9d6aa74e35c63dc74da10e41f8ba0f6de4:
> 
>   mpc85xx/t2081: enable parsing DDR ratio for T2081 rev1.1 (2015-11-02 
> 08:51:50 -0800)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-spi.git next
> 
> for you to fetch changes up to e39e68f155b4fcd47f62ab2cf0e199d04f38446d:
> 
>   sf: Add SPI NOR protection mechanism (2015-11-03 21:51:37 +0530)

NAK.

So, this blows up badly for a lot of things when I do:
./tools/buildman/buildman -b master --force-build --step 0 -Cdvel
'blackfin|microblaze|m68k|nds32|x86|aarch64|sandbox|mips|avr32|arm|powerpc|sh4|sparc'

And most of these have a toolchain that buildman can fetch, if you don't
have one handy.

-- 
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] Pull request: u-boot-spi/next

2015-11-03 Thread Bin Meng
Hi Jagan,

On Wed, Nov 4, 2015 at 9:47 AM, Tom Rini  wrote:
> On Tue, Nov 03, 2015 at 11:39:56PM +0530, Jagan Teki wrote:
>
>> Hi Tom,
>>
>> Please pull this series.
>>
>> thanks!
>> Jagan.
>>
>> The following changes since commit 96d59e9d6aa74e35c63dc74da10e41f8ba0f6de4:
>>
>>   mpc85xx/t2081: enable parsing DDR ratio for T2081 rev1.1 (2015-11-02 
>> 08:51:50 -0800)
>>
>> are available in the git repository at:
>>
>>   git://git.denx.de/u-boot-spi.git next
>>
>> for you to fetch changes up to e39e68f155b4fcd47f62ab2cf0e199d04f38446d:
>>
>>   sf: Add SPI NOR protection mechanism (2015-11-03 21:51:37 +0530)
>
> NAK.
>
> So, this blows up badly for a lot of things when I do:
> ./tools/buildman/buildman -b master --force-build --step 0 -Cdvel
> 'blackfin|microblaze|m68k|nds32|x86|aarch64|sandbox|mips|avr32|arm|powerpc|sh4|sparc'
>
> And most of these have a toolchain that buildman can fetch, if you don't
> have one handy.
>

I believe you need really use buildman to build the commits. One of
the previous review comments to your patch series was regard to the
'bisectability', and buildman can help you with that.

+Simon for buildman if you want some help.

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


Re: [U-Boot] please pull u-boot-samsung master

2015-11-03 Thread Minkyu Kang
Dear Przemyslaw Marczak,

2015년 11월 4일 수요일, Tom Rini님이 작성한 메시지:

> On Tue, Nov 03, 2015 at 02:02:57PM +0900, Minkyu Kang wrote:
>
> > Dear Tom,
> >
> > The following changes since commit
> 0e067a65f57189703668826d9841fea477026bf6:
> >
> >   x86: Select the ns16550 debug UART for minnowmax, chromebook_link
> (2015-10-30 18:04:14 -0400)
> >
> > are available in the git repository at:
> >
> >   http://git.denx.de/u-boot-samsung
> >
> > for you to fetch changes up to de5f9733f653091d4b227914d04432099a6448dc:
> >
> >   samsung: clean up checkpatch issues (2015-11-02 10:38:22 +0900)
> >
>
> NAK:
>
> +(sandbox) ../drivers/adc/sandbox.c:11:25: fatal error: sandbox-adc.h: No
> such file or directory
> +(sandbox)  #include 
> +(sandbox)  ^
> +(sandbox) compilation terminated.
> +(sandbox) make[3]: *** [drivers/adc/sandbox.o] Error 1
> +(sandbox) make[2]: *** [drivers/adc] Error 2
> +(sandbox) make[1]: *** [drivers] Error 2
>
> "sandbox: add ADC unit tests" is missing adding sandbox-adc.h
>
>
Could you please check it?


> --
> Tom
>

Thanks,
Minkyu Kang.


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


[U-Boot] [PATCH 2/2] nios2: trim CONFIG_SYS_MEMTEST_END

2015-11-03 Thread Thomas Chou
Trim CONFIG_SYS_MEMTEST_END location.

CONFIG_SYS_MONITOR_LEN
  Reserving 256k for U-Boot at: d7fc
CONFIG_ENV_SIZE
CONFIG_SYS_MALLOC_LEN
  Reserving 256k for malloc() at: d7f8
0x1 for the rest
  Reserving 68 Bytes for Board Info at: d7f7ffbc
  Reserving 208 Bytes for Global Data at: d7f7feec
  Reserving 12000 Bytes for FDT at: d7f7d00c
  Stack

Signed-off-by: Thomas Chou 
---
 include/configs/nios2-generic.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index 9a01b22..4569de8 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -96,7 +96,10 @@
 16)/* Print buf size */
 #define CONFIG_SYS_LOAD_ADDR   CONFIG_SYS_SDRAM_BASE
 #define CONFIG_SYS_MEMTEST_START   CONFIG_SYS_SDRAM_BASE
-#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_INIT_SP - 0x2)
+#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MONITOR_BASE - \
+CONFIG_ENV_SIZE - \
+CONFIG_SYS_MALLOC_LEN -\
+0x1)
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_CMD_GPIO
 
-- 
2.5.0

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


[U-Boot] [PATCH 1/2] nios2: trim CONFIG_SYS_MALLOC_LEN

2015-11-03 Thread Thomas Chou
Trim CONFIG_SYS_MALLOC_LEN size, because CONFIG_ENV_SIZE
is included to total memory allocation in common.h,

Signed-off-by: Thomas Chou 
---
 include/configs/nios2-generic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index 6e426d6..9a01b22 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -82,7 +82,7 @@
 #define CONFIG_SYS_MONITOR_BASE(CONFIG_SYS_SDRAM_BASE + \
 CONFIG_SYS_SDRAM_SIZE - \
 CONFIG_SYS_MONITOR_LEN)
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 0x2)
+#define CONFIG_SYS_MALLOC_LEN  0x2
 
 /*
  * MISC
-- 
2.5.0

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


Re: [U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Thomas Chou

Hi Marek,

On 2015年11月04日 13:15, Marek Vasut wrote:

On Wednesday, November 04, 2015 at 05:45:24 AM, Thomas Chou wrote:

Hi Marek,


Hi,


On 2015年11月04日 11:45, Marek Vasut wrote:

Let me just put an idea here, it might be wrong -- but doesn't this seem
like some sort of NVMEM device? See for example:

https://lkml.org/lkml/2015/5/21/643


Thanks for the pointer. However, it needs erasing before writing.


But does it operate in some sort of memory-mapped fashion or is this more
of a SPI controller ? I think it's the former, right ?


Right. The former.



But now that you mention the erasing, I see why you'd opt for the CFI
framework, yeah.


Yes.

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


Re: [U-Boot] [PATCH v4 1/3] dm: implement a MTD uclass

2015-11-03 Thread Thomas Chou



On 2015年11月03日 22:55, Jagan Teki wrote:

On 3 November 2015 at 20:19, Thomas Chou  wrote:

Hi Jagan,

On 2015年11月03日 22:41, Jagan Teki wrote:


Hi Thomas,

On 3 November 2015 at 18:39, Thomas Chou  wrote:


Implement a Memory Technology Device (MTD) uclass. It should
include most flash drivers in the future. Though no uclass ops
are defined yet, the MTD ops could be used.

The NAND flash driver is based on MTD. The CFI flash and SPI
flash support MTD, too. It should make sense to convert them
to MTD uclass.



Why does MTD require driver model? Should drivers like nand, cfi or
etc register mtd core should need to move on dm?



The driver model combined with device tree control of u-boot offers dynamic
binding of drivers and devices. It is expected that all drivers will be
converted to driver model, including nand, cfi and spi flash.


So, mtd_info ops like _erase, _write and _read will also change or
something like this

struct dm_mtd_info {
 struct mtd_info *info;
 struct udevice *dev;
};


Not exactly. I included udevice in mtd_info as it was device for Linux.

@@ -272,6 +273,8 @@ struct mtd_info {
struct module *owner;
 #ifndef __UBOOT__
struct device dev;
+#else
+   struct udevice *dev;
 #endif
int usecount;
 };

I think the mtd ops is more complete and widely used. There might be no 
need to reinvent the dm_mtd ops. The mtd uclass priv is set to mtd_info 
and we can get it with mtd_get_info(dev). Then call mtd ops, like 
mtd_read() mtd_write and mtd_erase(), directly.


>  See for example, I have recently added MTD support to spi_flash [1] [2]
>
> [1] https://patchwork.ozlabs.org/patch/529397/
> [2] https://patchwork.ozlabs.org/patch/529399/

It seems we are working toward the same direction. :)

Simon suggested that we can have an unified flash class (for all cfi, 
spi and nand flash) after the discussion between Bin Meng and I. So I 
dropped the earlier cfi-flash uclass, and found the mtd might be a 
better uclass. We see the same point, "MTD has proven core for flash 
operations".


The work on cfi-flash is not complete yet. It needs to reshape to use 
mtd ops like your earlier patches. But I have to work on others.


The spi-flash uclass should be merged into mtd uclass and use mtd ops. 
Maybe you will be interested and will help. Thanks in advance.


The nand flash is more ready. But need to convert to driver model.

Best regards,
Thomas


___
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/next

2015-11-03 Thread Fabio Estevam
On Tue, Nov 3, 2015 at 11:47 PM, Tom Rini  wrote:

> NAK.
>
> So, this blows up badly for a lot of things when I do:
> ./tools/buildman/buildman -b master --force-build --step 0 -Cdvel
> 'blackfin|microblaze|m68k|nds32|x86|aarch64|sandbox|mips|avr32|arm|powerpc|sh4|sparc'

It seems I missed to add bitops for avr32 and mips. Will work on it tomorrow.

In the meantime, if you have the build warnings/errors to share it
would be helpful.

Regards,

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


Re: [U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Marek Vasut
On Wednesday, November 04, 2015 at 03:36:08 AM, Thomas Chou wrote:
> Hi Marek,

Hi!

> On 2015年11月04日 01:44, Marek Vasut wrote:
> > On Tuesday, November 03, 2015 at 02:22:12 PM, Thomas Chou wrote:
> >> Add Altera Generic Quad SPI Controller support. The controller
> >> converts SPI NOR flash to parallel flash interface. So it is
> >> not like other SPI flash, but rather like CFI flash.
> >> 
> >> Signed-off-by: Thomas Chou 
> >> ---
> > 
> > You might want to look at https://lwn.net/Articles/636882/ , it is the
> > driver for the same hardware, but for Linux. But keep in mind that the
> > driver had some difficulties getting in, you might want to check the
> > discussions in linux-mtd .
> 
> I did check and follow the threads for a while since you pointed me
> about it in earlier communication. It is v5 last month. But the author
> decided to wait for hardware fix on rdid.

I think I had a stake there as well ;-)

> Yet I have a different point as I stated in the patch message. It is NOT
> a spi-nor since the hardware converted it to parallel interface. It
> should be treated more like cfi flash. I think it might be a mistake to
> take it as spi-nor. And this might be the hidden cause to prevent the
> linux driver getting in.  So I wrote it my way.

Let me just put an idea here, it might be wrong -- but doesn't this seem
like some sort of NVMEM device? See for example:

https://lkml.org/lkml/2015/5/21/643

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


Re: [U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Thomas Chou

Hi Marek,

On 2015年11月04日 01:44, Marek Vasut wrote:

On Tuesday, November 03, 2015 at 02:22:12 PM, Thomas Chou wrote:

Add Altera Generic Quad SPI Controller support. The controller
converts SPI NOR flash to parallel flash interface. So it is
not like other SPI flash, but rather like CFI flash.

Signed-off-by: Thomas Chou 
---


You might want to look at https://lwn.net/Articles/636882/ , it is the
driver for the same hardware, but for Linux. But keep in mind that the
driver had some difficulties getting in, you might want to check the
discussions in linux-mtd .



I did check and follow the threads for a while since you pointed me 
about it in earlier communication. It is v5 last month. But the author 
decided to wait for hardware fix on rdid.


Yet I have a different point as I stated in the patch message. It is NOT 
a spi-nor since the hardware converted it to parallel interface. It 
should be treated more like cfi flash. I think it might be a mistake to 
take it as spi-nor. And this might be the hidden cause to prevent the 
linux driver getting in.  So I wrote it my way.


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


Re: [U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Thomas Chou

Hi Marek,

On 2015年11月04日 11:45, Marek Vasut wrote:

Let me just put an idea here, it might be wrong -- but doesn't this seem
like some sort of NVMEM device? See for example:

https://lkml.org/lkml/2015/5/21/643


Thanks for the pointer. However, it needs erasing before writing.

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


Re: [U-Boot] [PATCH] mtd: add altera quadspi driver

2015-11-03 Thread Marek Vasut
On Wednesday, November 04, 2015 at 05:45:24 AM, Thomas Chou wrote:
> Hi Marek,

Hi,

> On 2015年11月04日 11:45, Marek Vasut wrote:
> > Let me just put an idea here, it might be wrong -- but doesn't this seem
> > like some sort of NVMEM device? See for example:
> > 
> > https://lkml.org/lkml/2015/5/21/643
> 
> Thanks for the pointer. However, it needs erasing before writing.

But does it operate in some sort of memory-mapped fashion or is this more
of a SPI controller ? I think it's the former, right ?

But now that you mention the erasing, I see why you'd opt for the CFI
framework, yeah.

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


[U-Boot] [PATCH v3] gpio: atmel: Add the PIO4 driver support

2015-11-03 Thread Wenyou Yang
The PIO4 is introduced from SAMA5D2, as a new version
for Atmel PIO controller.

Signed-off-by: Wenyou Yang 
---

Changes in v3:
 1./ add return to atmel_pio4_set_pio_output() to avoid compilation
 warning.

Changes in v2:
 1./ update the macro definitions according to the latest datasheet.
 2./ change the return value to -ENODEV.
 3./ add check to port_base, pin and return -ENODEV.
 4./ change the return value for set/get_pio_output/input function.

 arch/arm/mach-at91/include/mach/atmel_pio4.h |   48 +
 drivers/gpio/Kconfig |   11 +
 drivers/gpio/Makefile|1 +
 drivers/gpio/atmel_pio4.c|  296 ++
 4 files changed, 356 insertions(+)
 create mode 100644 arch/arm/mach-at91/include/mach/atmel_pio4.h
 create mode 100644 drivers/gpio/atmel_pio4.c

diff --git a/arch/arm/mach-at91/include/mach/atmel_pio4.h 
b/arch/arm/mach-at91/include/mach/atmel_pio4.h
new file mode 100644
index 000..8bb4b12
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/atmel_pio4.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2015 Atmel Corporation.
+ *   Wenyou Yang 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef __ATMEL_PIO4_H
+#define __ATMEL_PIO4_H
+
+#ifndef __ASSEMBLY__
+
+struct atmel_pio4_port {
+   u32 mskr;   /* 0x00 PIO Mask Register */
+   u32 cfgr;   /* 0x04 PIO Configuration Register */
+   u32 pdsr;   /* 0x08 PIO Pin Data Status Register */
+   u32 locksr; /* 0x0C PIO Lock Status Register */
+   u32 sodr;   /* 0x10 PIO Set Output Data Register */
+   u32 codr;   /* 0x14 PIO Clear Output Data Register */
+   u32 odsr;   /* 0x18 PIO Output Data Status Register */
+   u32 reserved0;
+   u32 ier;/* 0x20 PIO Interrupt Enable Register */
+   u32 idr;/* 0x24 PIO Interrupt Disable Register */
+   u32 imr;/* 0x28 PIO Interrupt Mask Register */
+   u32 isr;/* 0x2C PIO Interrupt Status Register */
+   u32 reserved1[3];
+   u32 iofr;   /* 0x3C PIO I/O Freeze Register */
+};
+
+#endif
+
+#define AT91_PIO_PORTA 0x0
+#define AT91_PIO_PORTB 0x1
+#define AT91_PIO_PORTC 0x2
+#define AT91_PIO_PORTD 0x3
+
+int atmel_pio4_set_gpio(u32 port, u32 pin, u32 use_pullup);
+int atmel_pio4_set_a_periph(u32 port, u32 pin, u32 use_pullup);
+int atmel_pio4_set_b_periph(u32 port, u32 pin, u32 use_pullup);
+int atmel_pio4_set_c_periph(u32 port, u32 pin, u32 use_pullup);
+int atmel_pio4_set_d_periph(u32 port, u32 pin, u32 use_pullup);
+int atmel_pio4_set_e_periph(u32 port, u32 pin, u32 use_pullup);
+int atmel_pio4_set_f_periph(u32 port, u32 pin, u32 use_pullup);
+int atmel_pio4_set_g_periph(u32 port, u32 pin, u32 use_pullup);
+int atmel_pio4_set_pio_output(u32 port, u32 pin, u32 value);
+int atmel_pio4_get_pio_input(u32 port, u32 pin);
+
+#endif
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 9e49471..e60e9fd 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -28,6 +28,17 @@ config DWAPB_GPIO
help
  Support for the Designware APB GPIO driver.
 
+config ATMEL_PIO4
+   bool "ATMEL PIO4 driver"
+   depends on DM
+   default n
+   help
+ Say yes here to support the Atmel PIO4 driver.
+ The PIO4 is new version of Atmel PIO controller, which manages
+ up to 128 fully programmable input/output lines. Each I/O line
+ may be dedicated as a general purpose I/O or be assigned to
+ a function of an embedded peripheral.
+
 config LPC32XX_GPIO
bool "LPC32XX GPIO driver"
depends on DM
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index c58aa4d..fb4fd25 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -12,6 +12,7 @@ endif
 obj-$(CONFIG_DM_GPIO)  += gpio-uclass.o
 
 obj-$(CONFIG_AT91_GPIO)+= at91_gpio.o
+obj-$(CONFIG_ATMEL_PIO4)   += atmel_pio4.o
 obj-$(CONFIG_INTEL_ICH6_GPIO)  += intel_ich6_gpio.o
 obj-$(CONFIG_KIRKWOOD_GPIO)+= kw_gpio.o
 obj-$(CONFIG_KONA_GPIO)+= kona_gpio.o
diff --git a/drivers/gpio/atmel_pio4.c b/drivers/gpio/atmel_pio4.c
new file mode 100644
index 000..d71f525
--- /dev/null
+++ b/drivers/gpio/atmel_pio4.c
@@ -0,0 +1,296 @@
+/*
+ * Atmel PIO4 device driver
+ *
+ * Copyright (C) 2015 Atmel Corporation
+ *  Wenyou.Yang 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ATMEL_PIO4_PINS_PER_BANK   32
+
+/*
+ * Register Field Definitions
+ */
+#define ATMEL_PIO4_CFGR_FUNC   (0x7 << 0)
+#defineATMEL_PIO4_CFGR_FUNC_GPIO   (0x0 << 0)
+#defineATMEL_PIO4_CFGR_FUNC_PERIPH_A   (0x1 << 0)
+#define

[U-Boot] [PATCH 2/3] arm: at91/spl: matrix: improve implementation of matrix

2015-11-03 Thread Wenyou Yang
To make matrix initialization code sharing with others,
use the matrix slave id macros, instead of hard-coding.

Remove the write protection mode code, it is unneeded for
writing registers.

Remove the security peripheral selecting code, it is
unneeded for SPL use-case.

Signed-off-by: Wenyou Yang 
---

 arch/arm/mach-at91/include/mach/sama5d4.h |   25 +
 arch/arm/mach-at91/matrix.c   |   35 -
 2 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/sama5d4.h 
b/arch/arm/mach-at91/include/mach/sama5d4.h
index 3da8aff..449cf0e 100644
--- a/arch/arm/mach-at91/include/mach/sama5d4.h
+++ b/arch/arm/mach-at91/include/mach/sama5d4.h
@@ -179,6 +179,31 @@
 #define CPU_HAS_PCR
 #define CPU_HAS_H32MXDIV
 
+/* MATRIX0(H64MX) slave id definitions */
+#define H64MX_SLAVE_AXIMX_BRIDGE   0   /* Bridge from H64MX to AXIMX */
+#define H64MX_SLAVE_PERIPH_BRIDGE  1   /* H64MX Peripheral Bridge */
+#define H64MX_SLAVE_VDEC   2   /* Video Decoder */
+#define H64MX_SLAVE_DDRC_PORT0 3   /* DDR2 Port0-AESOTF */
+#define H64MX_SLAVE_DDRC_PORT1 4   /* DDR2 Port1 */
+#define H64MX_SLAVE_DDRC_PORT2 5   /* DDR2 Port2 */
+#define H64MX_SLAVE_DDRC_PORT3 6   /* DDR2 Port3 */
+#define H64MX_SLAVE_DDRC_PORT4 7   /* DDR2 Port4 */
+#define H64MX_SLAVE_DDRC_PORT5 8   /* DDR2 Port5 */
+#define H64MX_SLAVE_DDRC_PORT6 9   /* DDR2 Port6 */
+#define H64MX_SLAVE_DDRC_PORT7 10  /* DDR2 Port7 */
+#define H64MX_SLAVE_SRAM   11  /* Internal SRAM 128K */
+#define H64MX_SLAVE_H32MX_BRIDGE   12  /* Bridge from H64MX to H32MX */
+
+/* MATRIX1(H32MX) slave id definitions */
+#define H32MX_SLAVE_H64MX_BRIDGE   0   /* Bridge from H32MX to H64MX */
+#define H32MX_SLAVE_PERIPH_BRIDGE0 1   /* H32MX Peripheral Bridge 0 */
+#define H32MX_SLAVE_PERIPH_BRIDGE1 2   /* H32MX Peripheral Bridge 1 */
+#define H32MX_SLAVE_EBI3   /* External Bus 
Interface */
+#define H32MX_SLAVE_NFC_CMD3   /* NFC command Register */
+#define H32MX_SLAVE_NFC_SRAM   4   /* NFC SRAM */
+#define H32MX_SLAVE_USB5   /* USB Device & Host */
+#define H32MX_SLAVE_SMD6   /* Soft Modem (SMD) */
+
 /* sama5d4 series chip id definitions */
 #define ARCH_ID_SAMA5D40x8a5c07c0
 #define ARCH_EXID_SAMA5D41 0x0001
diff --git a/arch/arm/mach-at91/matrix.c b/arch/arm/mach-at91/matrix.c
index cf36386..57d7270 100644
--- a/arch/arm/mach-at91/matrix.c
+++ b/arch/arm/mach-at91/matrix.c
@@ -15,37 +15,20 @@ void matrix_init(void)
struct atmel_matrix *h32mx = (struct atmel_matrix *)ATMEL_BASE_MATRIX1;
int i;
 
-   /* Disable the write protect */
-   writel(ATMEL_MATRIX_WPMR_WPKEY & ~ATMEL_MATRIX_WPMR_WPEN, >wpmr);
-   writel(ATMEL_MATRIX_WPMR_WPKEY & ~ATMEL_MATRIX_WPMR_WPEN, >wpmr);
-
-   /* DDR port 1 ~ poart 7, slave number is: 4 ~ 10 */
-   for (i = 4; i <= 10; i++) {
+   /* DDR port 1 ~ port 7 */
+   for (i = H64MX_SLAVE_DDRC_PORT1; i <= H64MX_SLAVE_DDRC_PORT7; i++) {
writel(0x000f0f0f, >ssr[i]);
writel(0x, >sassr[i]);
writel(0x000f, >srtsr[i]);
}
 
-   /* CS3 */
-   writel(0x00c0c0c0, >ssr[3]);
-   writel(0xff00, >sassr[3]);
-   writel(0xff00, >srtsr[3]);
+   /* EBI CS3 (NANDFlash 128M) and NFC Command Registers(128M) */
+   writel(0x00c0c0c0, >ssr[H32MX_SLAVE_EBI]);
+   writel(0xff00, >sassr[H32MX_SLAVE_EBI]);
+   writel(0xff00, >srtsr[H32MX_SLAVE_EBI]);
 
/* NFC SRAM */
-   writel(0x00010101, >ssr[4]);
-   writel(0x0001, >sassr[4]);
-   writel(0x0001, >srtsr[4]);
-
-   /* Configure Programmable Security peripherals on matrix 64 */
-   writel(readl(>spselr[0]) | 0x0008, >spselr[0]);
-   writel(readl(>spselr[1]) | 0x0018, >spselr[1]);
-   writel(readl(>spselr[2]) | 0x0008, >spselr[2]);
-
-   /* Configure Programmable Security peripherals on matrix 32 */
-   writel(readl(>spselr[0]) | 0xFFC0, >spselr[0]);
-   writel(readl(>spselr[1]) | 0x60E3, >spselr[1]);
-
-   /* Enable the write protect */
-   writel(ATMEL_MATRIX_WPMR_WPKEY | ATMEL_MATRIX_WPMR_WPEN, >wpmr);
-   writel(ATMEL_MATRIX_WPMR_WPKEY | ATMEL_MATRIX_WPMR_WPEN, >wpmr);
+   writel(0x00010101, >ssr[H32MX_SLAVE_NFC_SRAM]);
+   writel(0x0001, >sassr[H32MX_SLAVE_NFC_SRAM]);
+   writel(0x0001, >srtsr[H32MX_SLAVE_NFC_SRAM]);
 }
-- 
1.7.9.5

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


[U-Boot] [PATCH 0/3] arm: at91/spl: make matrix and saic redirect sharing with others

2015-11-03 Thread Wenyou Yang
This patches is to make matix initialization and saic redirect
code sharing with other SoCs, move them to seperate files from
SAMA5D4 particular file.


Wenyou Yang (3):
  arm: at91/spl: matrix: move matrix init to separate file
  arm: at91/spl: matrix: improve implementation of matrix
  arm: at91: spl/atmel_sfr: move saic redirect to separate file

 arch/arm/mach-at91/Makefile |2 +-
 arch/arm/mach-at91/armv7/sama5d4_devices.c  |   55 ---
 arch/arm/mach-at91/atmel_sfr.c  |   21 ++
 arch/arm/mach-at91/include/mach/sama5_sfr.h |1 -
 arch/arm/mach-at91/include/mach/sama5d4.h   |   28 ++
 arch/arm/mach-at91/matrix.c |   34 +
 6 files changed, 84 insertions(+), 57 deletions(-)
 create mode 100644 arch/arm/mach-at91/atmel_sfr.c
 create mode 100644 arch/arm/mach-at91/matrix.c

-- 
1.7.9.5

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


[U-Boot] [PATCH 1/3] arm: at91/spl: matrix: move matrix init to separate file

2015-11-03 Thread Wenyou Yang
To make the matrix initialization code sharing with other SoCs,
move it from SAMA5D4 particular file,
mach-at91/armv7/sama5d4_devices.c to a separate file,
mach-at91/matrix.c

Signed-off-by: Wenyou Yang 
---

 arch/arm/mach-at91/Makefile|2 +-
 arch/arm/mach-at91/armv7/sama5d4_devices.c |   42 ---
 arch/arm/mach-at91/matrix.c|   51 
 3 files changed, 52 insertions(+), 43 deletions(-)
 create mode 100644 arch/arm/mach-at91/matrix.c

diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 313eb47..649aff2 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_AT91SAM9M10G45) += mpddrc.o spl_at91.o
 obj-$(CONFIG_AT91SAM9N12) += mpddrc.o spl_at91.o
 obj-$(CONFIG_AT91SAM9X5) += mpddrc.o spl_at91.o
 obj-$(CONFIG_SAMA5D3) += mpddrc.o spl_atmel.o
-obj-$(CONFIG_SAMA5D4) += mpddrc.o spl_atmel.o
+obj-$(CONFIG_SAMA5D4) += mpddrc.o spl_atmel.o matrix.o
 obj-y += spl.o
 endif
 
diff --git a/arch/arm/mach-at91/armv7/sama5d4_devices.c 
b/arch/arm/mach-at91/armv7/sama5d4_devices.c
index 76301d6..52f4862 100644
--- a/arch/arm/mach-at91/armv7/sama5d4_devices.c
+++ b/arch/arm/mach-at91/armv7/sama5d4_devices.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -48,47 +47,6 @@ void at91_udp_hw_init(void)
 #endif
 
 #ifdef CONFIG_SPL_BUILD
-void matrix_init(void)
-{
-   struct atmel_matrix *h64mx = (struct atmel_matrix *)ATMEL_BASE_MATRIX0;
-   struct atmel_matrix *h32mx = (struct atmel_matrix *)ATMEL_BASE_MATRIX1;
-   int i;
-
-   /* Disable the write protect */
-   writel(ATMEL_MATRIX_WPMR_WPKEY & ~ATMEL_MATRIX_WPMR_WPEN, >wpmr);
-   writel(ATMEL_MATRIX_WPMR_WPKEY & ~ATMEL_MATRIX_WPMR_WPEN, >wpmr);
-
-   /* DDR port 1 ~ poart 7, slave number is: 4 ~ 10 */
-   for (i = 4; i <= 10; i++) {
-   writel(0x000f0f0f, >ssr[i]);
-   writel(0x, >sassr[i]);
-   writel(0x000f, >srtsr[i]);
-   }
-
-   /* CS3 */
-   writel(0x00c0c0c0, >ssr[3]);
-   writel(0xff00, >sassr[3]);
-   writel(0xff00, >srtsr[3]);
-
-   /* NFC SRAM */
-   writel(0x00010101, >ssr[4]);
-   writel(0x0001, >sassr[4]);
-   writel(0x0001, >srtsr[4]);
-
-   /* Configure Programmable Security peripherals on matrix 64 */
-   writel(readl(>spselr[0]) | 0x0008, >spselr[0]);
-   writel(readl(>spselr[1]) | 0x0018, >spselr[1]);
-   writel(readl(>spselr[2]) | 0x0008, >spselr[2]);
-
-   /* Configure Programmable Security peripherals on matrix 32 */
-   writel(readl(>spselr[0]) | 0xFFC0, >spselr[0]);
-   writel(readl(>spselr[1]) | 0x60E3, >spselr[1]);
-
-   /* Enable the write protect */
-   writel(ATMEL_MATRIX_WPMR_WPKEY | ATMEL_MATRIX_WPMR_WPEN, >wpmr);
-   writel(ATMEL_MATRIX_WPMR_WPKEY | ATMEL_MATRIX_WPMR_WPEN, >wpmr);
-}
-
 void redirect_int_from_saic_to_aic(void)
 {
struct atmel_sfr *sfr = (struct atmel_sfr *)ATMEL_BASE_SFR;
diff --git a/arch/arm/mach-at91/matrix.c b/arch/arm/mach-at91/matrix.c
new file mode 100644
index 000..cf36386
--- /dev/null
+++ b/arch/arm/mach-at91/matrix.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 Atmel Corporation
+ *   Wenyou Yang 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+
+void matrix_init(void)
+{
+   struct atmel_matrix *h64mx = (struct atmel_matrix *)ATMEL_BASE_MATRIX0;
+   struct atmel_matrix *h32mx = (struct atmel_matrix *)ATMEL_BASE_MATRIX1;
+   int i;
+
+   /* Disable the write protect */
+   writel(ATMEL_MATRIX_WPMR_WPKEY & ~ATMEL_MATRIX_WPMR_WPEN, >wpmr);
+   writel(ATMEL_MATRIX_WPMR_WPKEY & ~ATMEL_MATRIX_WPMR_WPEN, >wpmr);
+
+   /* DDR port 1 ~ poart 7, slave number is: 4 ~ 10 */
+   for (i = 4; i <= 10; i++) {
+   writel(0x000f0f0f, >ssr[i]);
+   writel(0x, >sassr[i]);
+   writel(0x000f, >srtsr[i]);
+   }
+
+   /* CS3 */
+   writel(0x00c0c0c0, >ssr[3]);
+   writel(0xff00, >sassr[3]);
+   writel(0xff00, >srtsr[3]);
+
+   /* NFC SRAM */
+   writel(0x00010101, >ssr[4]);
+   writel(0x0001, >sassr[4]);
+   writel(0x0001, >srtsr[4]);
+
+   /* Configure Programmable Security peripherals on matrix 64 */
+   writel(readl(>spselr[0]) | 0x0008, >spselr[0]);
+   writel(readl(>spselr[1]) | 0x0018, >spselr[1]);
+   writel(readl(>spselr[2]) | 0x0008, >spselr[2]);
+
+   /* Configure Programmable Security peripherals on matrix 32 */
+   writel(readl(>spselr[0]) | 0xFFC0, >spselr[0]);
+   writel(readl(>spselr[1]) | 0x60E3, >spselr[1]);
+
+   /* Enable the write protect */
+   writel(ATMEL_MATRIX_WPMR_WPKEY | ATMEL_MATRIX_WPMR_WPEN, >wpmr);
+   writel(ATMEL_MATRIX_WPMR_WPKEY 

[U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC

2015-11-03 Thread Prabhakar Kushwaha
Management complex Firmware, DPL and DPC are depolyed during u-boot boot
sequence.

Add new DPAA2 commands to manage Management Complex (MC) i.e. start mc, aiop
and apply DPL from u-boot command prompt.

Signed-off-by: Prabhakar Kushwaha 
---
 Changes for v2: Sending as it is
 Changes for v3: fix compilation for ls2085_emu target
 Changes for v4: Sending as it is

 arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 |  30 ++
 drivers/net/fsl-mc/mc.c| 382 -
 include/configs/ls2085aqds.h   |  12 -
 include/configs/ls2085ardb.h   |  12 -
 include/fsl-mc/fsl_mc.h|   5 +
 include/fsl-mc/fsl_mc_private.h|   2 +-
 6 files changed, 220 insertions(+), 223 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 
b/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
index 03e18f6..d1f92c4 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
+++ b/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
@@ -242,3 +242,33 @@ MMU Translation Tables
   | 0x81__ || 0x08_0080_ |
   ----
 ...   ...
+
+
+DPAA2 commands to manage Management complex
+---
+Management complex Firmware, DPL and DPC are depolyed during u-boot boot
+sequence.
+
+New DPAA2 commands has been added to manage Management Complex (MC) i.e.
+start mc, aiop and apply DPL from command prompt.
+
+a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex
+b) fsl_mc apply DPL [DPL_addr] - Apply DPL file
+c) fsl_mc start aiop [FW_addr] - Start AIOP
+
+u-boot etherenet support sequence :-
+a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex
+b) DPMACs device will be available now for use
+
+Linux boot sequence :-
+a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex
+b) fsl_mc apply DPL [DPL_addr] - Apply DPL file
+c) No DPMACs availabe for use in u-boot
+c) boot Linux
+
+AIOP boot sequence :-
+a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex
+b) fsl_mc start aiop [FW_addr] - Start AIOP
+c) fsl_mc apply DPL [DPL_addr] - Apply DPL file
+d) No DPMACs availabe for use in u-boot
+Please note actual AIOP start will happen during DPL parsing of Management 
complex
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index ea987d7..d2ca5c6 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -14,7 +14,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #define MC_RAM_BASE_ADDR_ALIGNMENT  (512UL * 1024 * 1024)
 #define MC_RAM_BASE_ADDR_ALIGNMENT_MASK(~(MC_RAM_BASE_ADDR_ALIGNMENT - 
1))
@@ -24,7 +26,11 @@
 #define MC_BOOT_TIMEOUT_ENV_VAR"mcboottimeout"
 
 DECLARE_GLOBAL_DATA_PTR;
-static int mc_boot_status;
+static int mc_boot_status = -1;
+static int mc_dpl_applied = -1;
+#ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
+static int mc_aiop_applied = -1;
+#endif
 struct fsl_mc_io *dflt_mc_io = NULL;
 uint16_t dflt_dprc_handle = 0;
 struct fsl_dpbp_obj *dflt_dpbp = NULL;
@@ -93,7 +99,8 @@ static int mc_copy_image(const char *title,
  * Returns 0 on success and a negative errno on error.
  * task fail.
  **/
-int parse_mc_firmware_fit_image(const void **raw_image_addr,
+int parse_mc_firmware_fit_image(u64 mc_fw_addr,
+   const void **raw_image_addr,
size_t *raw_image_size)
 {
int format;
@@ -103,36 +110,31 @@ int parse_mc_firmware_fit_image(const void 
**raw_image_addr,
size_t size;
const char *uname = "firmware";
 
-   /* Check if the image is in NOR flash */
-#ifdef CONFIG_SYS_LS_MC_FW_IN_NOR
-   fit_hdr = (void *)CONFIG_SYS_LS_MC_FW_ADDR;
-#else
-#error "No CONFIG_SYS_LS_MC_FW_IN_xxx defined"
-#endif
+   fit_hdr = (void *)mc_fw_addr;
 
/* Check if Image is in FIT format */
format = genimg_get_format(fit_hdr);
 
if (format != IMAGE_FORMAT_FIT) {
-   printf("fsl-mc: ERROR: Bad firmware image (not a FIT image)\n");
+   printf("fsl-mc: ERR: Bad firmware image (not a FIT image)\n");
return -EINVAL;
}
 
if (!fit_check_format(fit_hdr)) {
-   printf("fsl-mc: ERROR: Bad firmware image (bad FIT header)\n");
+   printf("fsl-mc: ERR: Bad firmware image (bad FIT header)\n");
return -EINVAL;
}
 
node_offset = fit_image_get_node(fit_hdr, uname);
 
if (node_offset < 0) {
-   printf("fsl-mc: ERROR: Bad firmware image (missing 
subimage)\n");
+   printf("fsl-mc: ERR: Bad firmware image (missing subimage)\n");
return -ENOENT;
}
 
/* Verify MC firmware image */
if (!(fit_image_verify(fit_hdr, node_offset))) {
-   

[U-Boot] [PATCH 04/10][v4] armv8: ls2085aqds: Print function name during SerDes error

2015-11-03 Thread Prabhakar Kushwaha
Print function name along with SerDes Protocol during SerDes Protocol
not supported error.

Signed-off-by: Prabhakar Kushwaha 
---
 Changes for v2: Sending as it is
 Changes for v3: Sending as it is
 Changes for v4: Sending as it is

 board/freescale/ls2085aqds/eth.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/board/freescale/ls2085aqds/eth.c b/board/freescale/ls2085aqds/eth.c
index b8a2bf4..d116cd5 100644
--- a/board/freescale/ls2085aqds/eth.c
+++ b/board/freescale/ls2085aqds/eth.c
@@ -474,8 +474,8 @@ static void initialize_dpmac_to_slot(void)
   serdes1_prtcl);
break;
default:
-   printf("qds: WRIOP: Unsupported SerDes1 Protocol 0x%02x\n",
-  serdes1_prtcl);
+   printf("%s qds: WRIOP: Unsupported SerDes1 Protocol 0x%02x\n",
+  __func__, serdes1_prtcl);
break;
}
 
@@ -505,8 +505,8 @@ static void initialize_dpmac_to_slot(void)
}
break;
default:
-   printf("qds: WRIOP: Unsupported SerDes2 Protocol 0x%02x\n",
-  serdes2_prtcl);
+   printf(" %s qds: WRIOP: Unsupported SerDes2 Protocol 0x%02x\n",
+  __func__ , serdes2_prtcl);
break;
}
 }
@@ -580,8 +580,8 @@ void ls2085a_handle_phy_interface_sgmii(int dpmac_id)
}
break;
default:
-   printf("qds: WRIOP: Unsupported SerDes1 Protocol 0x%02x\n",
-  serdes1_prtcl);
+   printf("%s qds: WRIOP: Unsupported SerDes1 Protocol 0x%02x\n",
+  __func__ , serdes1_prtcl);
break;
}
 
@@ -626,8 +626,8 @@ serdes2:
}
break;
default:
-   printf("qds: WRIOP: Unsupported SerDes2 Protocol 0x%02x\n",
-  serdes2_prtcl);
+   printf("%s qds: WRIOP: Unsupported SerDes2 Protocol 0x%02x\n",
+  __func__, serdes2_prtcl);
break;
}
 }
-- 
1.9.1


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


[U-Boot] [PATCH 06/10][v4] driver: net: fsl-mc: Increase MC command timeout

2015-11-03 Thread Prabhakar Kushwaha
dpni_create API take takes more time as comapred to existing supported
APIs of MC Flib.
So increase MC command timeout.

Signed-off-by: Prabhakar Kushwaha 
---
 Changes for v2: Sending as it is
 Changes for v3: Sending as it is
 Changes for v4: Sending as it is

 drivers/net/fsl-mc/mc_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/fsl-mc/mc_sys.c b/drivers/net/fsl-mc/mc_sys.c
index 2136670..71e1456 100644
--- a/drivers/net/fsl-mc/mc_sys.c
+++ b/drivers/net/fsl-mc/mc_sys.c
@@ -32,7 +32,7 @@ int mc_send_command(struct fsl_mc_io *mc_io,
struct mc_command *cmd)
 {
enum mc_cmd_status status;
-   int timeout = 6000;
+   int timeout = 12000;
 
mc_write_command(mc_io->mmio_regs, cmd);
 
-- 
1.9.1


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


  1   2   >