Re: [U-Boot] [PATCH v2] usb: host: xhci-omap: Remove redundant board_usb_init and board_usb_cleanup functions

2018-02-15 Thread Uri Mashiach



On 02/15/2018 01:42 PM, Faiz Abbas wrote:

board_usb_init()/_cleanup() should be in board files and don't have
a place in the xhci-omap driver. Weak versions for
board_usb_init()/_cleanup() already exist in common/usb.c
(for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

Therefore, remove init and cleanup functions from xhci-omap and
implement them in the board files.

Signed-off-by: Faiz Abbas <faiz_ab...@ti.com>
Reviewed-by: Marek Vasut <ma...@denx.de>
Reviewed-by: Bin Meng <bmeng...@gmail.com>


Tested-by: Uri Mashiach <uri.mashi...@compulab.co.il>


---
v2: Added init and cleanup implementations for boards which
were relying on the weak implementation.

Uri please test the compulab boards.

  board/compulab/cl-som-am57x/cl-som-am57x.c | 13 +
  board/compulab/cm_t43/cm_t43.c | 14 ++
  board/ti/am43xx/board.c|  4 ++--
  board/ti/am57xx/board.c|  4 ++--
  board/ti/dra7xx/evm.c  |  4 ++--
  drivers/usb/host/xhci-omap.c   | 22 --
  6 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index 389eebb..d7dc8a4 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -16,6 +16,7 @@
  #include 
  #include "../common/common.h"
  #include "../common/eeprom.h"
+#include 
  
  DECLARE_GLOBAL_DATA_PTR;
  
@@ -64,3 +65,15 @@ u32 get_board_rev(void)

  {
return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS);
  }
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   enable_usb_clocks(index);
+   return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+   disable_usb_clocks(index);
+   return 0;
+}
diff --git a/board/compulab/cm_t43/cm_t43.c b/board/compulab/cm_t43/cm_t43.c
index 0d5da6f..bdbea4f 100644
--- a/board/compulab/cm_t43/cm_t43.c
+++ b/board/compulab/cm_t43/cm_t43.c
@@ -14,6 +14,8 @@
  #include 
  #include 
  #include "board.h"
+#include 
+#include 
  
  DECLARE_GLOBAL_DATA_PTR;
  
@@ -50,6 +52,18 @@ int board_init(void)

return 0;
  }
  
+int board_usb_init(int index, enum usb_init_type init)

+{
+   enable_usb_clocks(index);
+   return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+   disable_usb_clocks(index);
+   return 0;
+}
+
  #ifdef CONFIG_DRIVER_TI_CPSW
  
  static void cpsw_control(int enabled)

diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 16150ad..715960a 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -687,7 +687,7 @@ int usb_gadget_handle_interrupts(int index)
  #endif /* CONFIG_USB_DWC3 */
  
  #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)

-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+int board_usb_init(int index, enum usb_init_type init)
  {
enable_usb_clocks(index);
  #ifdef CONFIG_USB_DWC3
@@ -718,7 +718,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type 
init)
return 0;
  }
  
-int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)

+int board_usb_cleanup(int index, enum usb_init_type init)
  {
  #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 1128784..c3f60f6 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -867,7 +867,7 @@ int usb_gadget_handle_interrupts(int index)
  #endif /* CONFIG_USB_DWC3 */
  
  #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)

-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+int board_usb_init(int index, enum usb_init_type init)
  {
enable_usb_clocks(index);
switch (index) {
@@ -901,7 +901,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type 
init)
return 0;
  }
  
-int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)

+int board_usb_cleanup(int index, enum usb_init_type init)
  {
  #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 6ecf971..519475e 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -907,7 +907,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
.index = 1,
  };
  
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)

+int board_usb_init(int index, enum usb_init_type init)
  {
enable_usb_clocks(index);
switch (index) {
@@ -944,7 +944,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type 
init)
return 0;
  }
  
-int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)

+int board_usb_cleanup(int index, enum usb_init_type init)
  {
switch (index) {
case 0:
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index d6c5744..b

Re: [U-Boot] [RFC] usb: host: xhci-omap: Remove redundant board_usb_init and board_usb_cleanup functions

2018-02-14 Thread Uri Mashiach

Hi Faiz,

On 02/14/2018 05:47 PM, Faiz Abbas wrote:

Hi Uri,

On Wednesday 14 February 2018 08:56 PM, Uri Mashiach wrote:

Hi,
Sorry for the late response.

On 02/14/2018 04:19 PM, Marek Vasut wrote:

On 02/14/2018 03:14 PM, Faiz Abbas wrote:

Hi,

On Wednesday 14 February 2018 06:53 PM, Marek Vasut wrote:

On 02/14/2018 12:20 PM, Faiz Abbas wrote:

Hi,

On Wednesday 14 February 2018 03:46 PM, Marek Vasut wrote:

On 02/14/2018 11:10 AM, Faiz Abbas wrote:

board_usb_init()/_cleanup() should be in board files and don't have
a place in the xhci-omap driver. Weak versions for
board_usb_init()/_cleanup() already exist in common/usb.c
(for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

Signed-off-by: Faiz Abbas <faiz_ab...@ti.com>


Reviewed-by: Marek Vasut <ma...@denx.de>

I'd like some TBs from the people using those boards.


I have tested this for dra7xx, am43xx and am57xx.


So why is it marked RFC ?



Because I was unclear why Uri Mashiach did not do this in 1a9a5f7 ("fix
double weak board_usb_init functions").


OK, submit it as a normal patch with my RB.



As mentioned in 1a9a5f7, the functions omap_xhci_board_usb_init() and
omap_xhci_board_usb_cleanup() are called for the boards with the
CONFIG_USB_XHCI_OMAP definition.

The weak implementation of the functions omap_xhci_board_usb_init()
executed enable_usb_clocks().
The weak implementation of the function omap_xhci_board_usb_cleanup()
executed the function disable_usb_clocks().

For the boards compulab/cl-som-am57x and compulab/cm_t43:
* CONFIG_USB_XHCI_OMAP is defined
* omap_xhci_board_usb_init is not implemented, relying on the weak
implementation.
* omap_xhci_board_usb_cleanup is not defined, relying on the weak
implementation.

The fix is missing the implementation of board_usb_init and
board_usb_cleanup in the compulab/cl-som-am57x and compulab/cm_t43.
The implementation should include the content of the deleted weak
functions omap_xhci_board_usb_init() and omap_xhci_board_usb_cleanup().



Thanks for clarifying. Shouldn't that be implemented in the board files?


Yes


I can add board_usb_init and board_usb_cleanup for those platforms in
v2. Can you help me test this on those platforms?


Yes



Thanks,
Faiz



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


Re: [U-Boot] [RFC] usb: host: xhci-omap: Remove redundant board_usb_init and board_usb_cleanup functions

2018-02-14 Thread Uri Mashiach

Hi,
Sorry for the late response.

On 02/14/2018 04:19 PM, Marek Vasut wrote:

On 02/14/2018 03:14 PM, Faiz Abbas wrote:

Hi,

On Wednesday 14 February 2018 06:53 PM, Marek Vasut wrote:

On 02/14/2018 12:20 PM, Faiz Abbas wrote:

Hi,

On Wednesday 14 February 2018 03:46 PM, Marek Vasut wrote:

On 02/14/2018 11:10 AM, Faiz Abbas wrote:

board_usb_init()/_cleanup() should be in board files and don't have
a place in the xhci-omap driver. Weak versions for
board_usb_init()/_cleanup() already exist in common/usb.c
(for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

Signed-off-by: Faiz Abbas <faiz_ab...@ti.com>


Reviewed-by: Marek Vasut <ma...@denx.de>

I'd like some TBs from the people using those boards.


I have tested this for dra7xx, am43xx and am57xx.


So why is it marked RFC ?



Because I was unclear why Uri Mashiach did not do this in 1a9a5f7 ("fix
double weak board_usb_init functions").


OK, submit it as a normal patch with my RB.



As mentioned in 1a9a5f7, the functions omap_xhci_board_usb_init() and 
omap_xhci_board_usb_cleanup() are called for the boards with the 
CONFIG_USB_XHCI_OMAP definition.


The weak implementation of the functions omap_xhci_board_usb_init()
executed enable_usb_clocks().
The weak implementation of the function omap_xhci_board_usb_cleanup() 
executed the function disable_usb_clocks().


For the boards compulab/cl-som-am57x and compulab/cm_t43:
* CONFIG_USB_XHCI_OMAP is defined
* omap_xhci_board_usb_init is not implemented, relying on the weak 
implementation.
* omap_xhci_board_usb_cleanup is not defined, relying on the weak 
implementation.


The fix is missing the implementation of board_usb_init and 
board_usb_cleanup in the compulab/cl-som-am57x and compulab/cm_t43.
The implementation should include the content of the deleted weak 
functions omap_xhci_board_usb_init() and omap_xhci_board_usb_cleanup().


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


Re: [U-Boot] [PATCH 1/2] imx7: spl: Use SPL boot device MMC1 for all of the SOCs MMC/SD boot devices

2018-01-04 Thread Uri Mashiach



On 01/04/2018 01:37 PM, Stefano Babic wrote:

On 04/01/2018 11:56, Eran Matityahu wrote:

On Thu, Jan 4, 2018 at 12:42 PM, Stefano Babic  wrote:

On 04/01/2018 11:11, Eran Matityahu wrote:

On Thu, Jan 4, 2018 at 12:02 PM, Eran Matityahu  wrote:

On Thu, Jan 4, 2018 at 11:14 AM, Stefano Babic  wrote:

Hi Eran,

On 03/01/2018 14:58, Eran Matityahu wrote:

Hi Uri.


Hello Eran,

On 01/03/2018 12:53 PM, Eran Matityahu wrote:


Use only one SPL MMC device, similarly to the iMX6 code



What is the reason for not using MMC2?


The reason is so that you won't have to initialize more than one MMC
device in SPL.
Also, to be consistent with the iMX6 SPL code.





Signed-off-by: Eran Matityahu 
---
   arch/arm/mach-imx/spl.c | 3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index d0d1b73aa6..6b5bd8990c 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -106,10 +106,9 @@ u32 spl_boot_device(void)
 switch (boot_device_spl) {
 case SD1_BOOT:
 case MMC1_BOOT:
-   return BOOT_DEVICE_MMC1;
 case SD2_BOOT:
 case MMC2_BOOT:
-   return BOOT_DEVICE_MMC2;
+   return BOOT_DEVICE_MMC1;
 case SPI_NOR_BOOT:
 return BOOT_DEVICE_SPI;
 default:


The reason to have spl_boot_device() is not to initialize more as one
MMC device, but to find which storage contains the next image to be
started (u-boot.img). This is generally (but not in all projects) the
same storage from where the BootROM has loaded SPL.

According to this, this patch seems wrong. If SPL / u-boot.img are
stored on MMC2 (and maybe MMC2 is the only MMC device for the board),
your patch breaks booting.

If you have special case, you can write a board_boot_order() in your
board code to overwrite the behavior.

Best regards,
Stefano Babic


The iMX6 spl_boot_device() doesn't even check which MMC device the
BootROM has loaded SPL from. It just returns BOOT_DEVICE_MMC1
in case the boot device was any MMC/SD device, and leaves it to the
board code to detect the exact device and init the appropriate device
with the next image (u-boot,img), accordingly.
My suggestion is to do the same here.

In my iMX7 board, I can boot from MMC1 (SD card) and MMC3 (eMMC),
but let's say it's MMC2 in sake of this explanation.
Without this patch, in order to boot from MMC2 (with both SPL and u-boot.img
on MMC2), I have to initialize both MMC1 and MMC2 devices because SPL
loops on all devices until it finds a match, and it halts if the first
device is not
initialized.

With this patch I can use get_boot_device() inside board_mmc_init() and
only initialize the MMC device I want to load the next image from (usually
the same device).

I know I can approach it differently and change the spl_boot_list[0] device to
BOOT_DEVICE_MMC1 in board_boot_order(), but I figured the behaviour
should be the same for iMX6 and iMX7.
If you think the correct way is to return BOOT_DEVICE_MMC2, then we
should probably also add a BOOT_DEVICE_MMC3 definition, and also change
the iMX6 code to do the same.


By the way, in my opinion, the iMX6 way


The imx6 way is the right way to do - rather, i.MX7 does not follow the
same approach.

In i.MX6 code, spl_boot_device() returns the type of boot device instead
of the instance of the peripheral. In fact. it returns a imx6_bmode
(let's away the serial rom, it is messy to detect).

A following board_boot_order() then choose which is the instance for
that detected type, and this is then used to load u-boot.img. This is,
at the end, board specific. Even if in most cases, u-boot.img resides on
the same storage as SPL, there are cases where this is not true.

And just a single MMC is instantiated in SPL - this is decided inside
board code. See for example pcm058.c (but there are plenty of other
examples), just a single MMC is initialized by SPL.

On i.MX7, the same approach was not followed. A single spl_boot_device()
tries to do all.

I agree that i.MX6 approach is better, and I will glad if you would move
i.MX7 to have the same behavior as i.MX6.



(and this patch also),


No, even if it does not depend from the patch - see above.


is the
preferred way,
since usually you'll only need one MMC device in SPL.


We are saying the same thing.


:-)


Except, you are wrong in one little thing: the i.MX6 version of
spl_boot_device() doesn't return an imx6_bmode. It detects the
imx6_bmode and returns a BOOT_DEVICE_*.


True, but this is used as "type" for i.MX6, it is a real device for
i.MX7 (get_boot_device() in arch/arm/mach-imx/mx7/soc.c). This is also
due to differences in SOC, I admit.


In case of an MMC/.SD boot mode it returns BOOT_DEVICE_MMC1.
This patch indeed makes the i.MX7 behaviour the same as i.MX6.


The thing is if this patch breaks some boards. As far as I can see,
there is just 2 i.MX7 with SPL 

Re: [U-Boot] [PATCH 1/2] imx7: spl: Use SPL boot device MMC1 for all of the SOCs MMC/SD boot devices

2018-01-04 Thread Uri Mashiach



On 01/03/2018 03:58 PM, Eran Matityahu wrote:

Hi Uri.


Hello Eran,

On 01/03/2018 12:53 PM, Eran Matityahu wrote:


Use only one SPL MMC device, similarly to the iMX6 code



What is the reason for not using MMC2?


The reason is so that you won't have to initialize more than one MMC
device in SPL.
Also, to be consistent with the iMX6 SPL code.



A problematic scenario is a detection, by the boot ROM, of the SPL image 
at MMC2.
If the U-Boot image is located at MMC2, the boot sequence will be 
terminated.






Signed-off-by: Eran Matityahu 
---
   arch/arm/mach-imx/spl.c | 3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index d0d1b73aa6..6b5bd8990c 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -106,10 +106,9 @@ u32 spl_boot_device(void)
 switch (boot_device_spl) {
 case SD1_BOOT:
 case MMC1_BOOT:
-   return BOOT_DEVICE_MMC1;
 case SD2_BOOT:


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


Re: [U-Boot] [PATCH 1/2] imx7: spl: Use SPL boot device MMC1 for all of the SOCs MMC/SD boot devices

2018-01-03 Thread Uri Mashiach

Hello Eran,

On 01/03/2018 12:53 PM, Eran Matityahu wrote:

Use only one SPL MMC device, similarly to the iMX6 code


What is the reason for not using MMC2?



Signed-off-by: Eran Matityahu 
---
  arch/arm/mach-imx/spl.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index d0d1b73aa6..6b5bd8990c 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -106,10 +106,9 @@ u32 spl_boot_device(void)
switch (boot_device_spl) {
case SD1_BOOT:
case MMC1_BOOT:
-   return BOOT_DEVICE_MMC1;
case SD2_BOOT:
case MMC2_BOOT:
-   return BOOT_DEVICE_MMC2;
+   return BOOT_DEVICE_MMC1;
case SPI_NOR_BOOT:
return BOOT_DEVICE_SPI;
default:



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


[U-Boot] [PATCH] imx: mx7: spl: remove redundant SATA definitionas

2017-10-10 Thread Uri Mashiach
The i.MX7 SOC doesn't include the SATA interface.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 include/configs/imx7_spl.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/include/configs/imx7_spl.h b/include/configs/imx7_spl.h
index e562cdb..b89dba6 100644
--- a/include/configs/imx7_spl.h
+++ b/include/configs/imx7_spl.h
@@ -41,12 +41,6 @@
 #define CONFIG_SYS_MONITOR_LEN 409600  /* 400 KB */
 #endif
 
-/* SATA support */
-#if defined(CONFIG_SPL_SATA_SUPPORT)
-#define CONFIG_SPL_SATA_BOOT_DEVICE0
-#define CONFIG_SYS_SATA_FAT_BOOT_PARTITION 1
-#endif
-
 /* Define the payload for FAT/EXT support */
 #if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
 # ifdef CONFIG_OF_CONTROL
-- 
2.7.4

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


Re: [U-Boot] [PATCH 3/4] imx: mx7: SPL support for i.MX7

2017-10-02 Thread Uri Mashiach

Hi Stefano,

On 10/02/2017 05:22 PM, Stefano Babic wrote:

Hi Uri,

On 24/09/2017 15:32, Fabio Estevam wrote:

Hi Uri,

On Sun, Sep 24, 2017 at 3:00 AM, Uri Mashiach
<uri.mashi...@compulab.co.il> wrote:

Add configuration file and spl_boot_device function for the i.MX7 SPL.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>


Thanks for working on this!

I will test your series and will try to convert imx7d-sabresd to SPL.



It looks like that at least a define is missing - by applying the patch
and testing, I get the error:

+board/compulab/cl-som-imx7/cl-som-imx7.c: In function
'cl_som_imx7_setup_fec':
+board/compulab/cl-som-imx7/cl-som-imx7.c:231:15: error: 'ENET_125MHz'
undeclared (first use in this function)


In fact, ENET_125MHz is not definded anywhere in U-Boot. Could you
please check and fix this ?

Best regards,
Stefano Babic




The patch is compiling in u-boot-imx/master.
Should it be based on mainline u-boot?

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


[U-Boot] [PATCH 3/4] imx: mx7: SPL support for i.MX7

2017-09-24 Thread Uri Mashiach
Add configuration file and spl_boot_device function for the i.MX7 SPL.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 arch/arm/include/asm/arch-mx7/sys_proto.h |  1 +
 arch/arm/mach-imx/spl.c   | 23 ++-
 include/configs/imx7_spl.h| 67 +++
 3 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 include/configs/imx7_spl.h

diff --git a/arch/arm/include/asm/arch-mx7/sys_proto.h 
b/arch/arm/include/asm/arch-mx7/sys_proto.h
index 15e24d4..fa62424 100644
--- a/arch/arm/include/asm/arch-mx7/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx7/sys_proto.h
@@ -7,3 +7,4 @@
 #include 
 
 void set_wdog_reset(struct wdog_regs *wdog);
+enum boot_device get_boot_device(void);
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 258578a..c41f40c 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -82,7 +83,27 @@ u32 spl_boot_device(void)
}
return BOOT_DEVICE_NONE;
 }
-#endif
+
+#elif defined(CONFIG_MX7)
+/* Translate iMX7 boot device to the SPL boot device enumeration */
+u32 spl_boot_device(void)
+{
+   enum boot_device boot_device_spl = get_boot_device();
+
+   switch (boot_device_spl) {
+   case SD1_BOOT:
+   case MMC1_BOOT:
+   return BOOT_DEVICE_MMC1;
+   case SD2_BOOT:
+   case MMC2_BOOT:
+   return BOOT_DEVICE_MMC2;
+   case SPI_NOR_BOOT:
+   return BOOT_DEVICE_SPI;
+   default:
+   return BOOT_DEVICE_NONE;
+   }
+}
+#endif /* CONFIG_MX6 || CONFIG_MX7 */
 
 #if defined(CONFIG_SPL_MMC_SUPPORT)
 /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
diff --git a/include/configs/imx7_spl.h b/include/configs/imx7_spl.h
new file mode 100644
index 000..e562cdb
--- /dev/null
+++ b/include/configs/imx7_spl.h
@@ -0,0 +1,67 @@
+/*
+ * SPL definitions for the i.MX7 SPL
+ *
+ * (C) Copyright 2017 CompuLab, Ltd. http://www.compulab.com
+ *
+ * Author: Uri Mashiach <uri.mashi...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef __IMX7_SPL_CONFIG_H
+#define __IMX7_SPL_CONFIG_H
+
+#ifdef CONFIG_SPL
+
+#define CONFIG_SPL_FRAMEWORK
+
+/*
+ * see figure 6-22 in i.MX 7Dual/Solo Reference manuals:
+ *  - IMX7D/S OCRAM free area RAM (OCRAM) is from 0x0091 to
+ *0x00946C00.
+ *  - Set the stack at the end of the free area section, at 0x00946BB8.
+ *  - The BOOT ROM loads what they consider the firmware image
+ *which consists of a 4K header in front of us that contains the IVT, DCD
+ *and some padding thus 'our' max size is really 0x00946BB8 - 0x00911000.
+ *64KB is more then enough for the SPL.
+ */
+#define CONFIG_SPL_TEXT_BASE   0x00911000
+#define CONFIG_SPL_MAX_SIZE0x1
+#define CONFIG_SPL_STACK   0x00946BB8
+/*
+ * Pad SPL to 68KB (4KB header + 64KB max size). This allows to write the
+ * SPL/U-Boot combination generated with u-boot-with-spl.imx directly to a
+ * boot media (given that boot media specific offset is configured properly).
+ */
+#define CONFIG_SPL_PAD_TO  0x11000
+
+/* MMC support */
+#if defined(CONFIG_SPL_MMC_SUPPORT)
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
+#define CONFIG_SYS_MONITOR_LEN 409600  /* 400 KB */
+#endif
+
+/* SATA support */
+#if defined(CONFIG_SPL_SATA_SUPPORT)
+#define CONFIG_SPL_SATA_BOOT_DEVICE0
+#define CONFIG_SYS_SATA_FAT_BOOT_PARTITION 1
+#endif
+
+/* Define the payload for FAT/EXT support */
+#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
+# ifdef CONFIG_OF_CONTROL
+#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME  "u-boot-dtb.img"
+# else
+#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME  "u-boot.img"
+# endif
+#endif
+
+#define CONFIG_SPL_BSS_START_ADDR  0x8820
+#define CONFIG_SPL_BSS_MAX_SIZE0x10/* 1 MB */
+#define CONFIG_SYS_SPL_MALLOC_START0x8830
+#define CONFIG_SYS_SPL_MALLOC_SIZE 0x10/* 1 MB */
+#define CONFIG_SYS_TEXT_BASE   0x8780
+
+#endif /* CONFIG_SPL */
+
+#endif /* __IMX7_SPL_CONFIG_H */
-- 
2.7.4

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


[U-Boot] [PATCH 4/4] arm: imx7d: add support for Compulab cl-som-imx7

2017-09-24 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add initial support for Compulab cl-som-imx7 SoM.
The initial support includes:
 - MMC
 - eMMC
 - SPI flash
 - I2C
 - FEC
 - USB
 - Serial console

Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
---
 arch/arm/mach-imx/mx7/Kconfig|   8 +
 board/compulab/cl-som-imx7/Kconfig   |  28 +++
 board/compulab/cl-som-imx7/MAINTAINERS   |   6 +
 board/compulab/cl-som-imx7/Makefile  |  17 ++
 board/compulab/cl-som-imx7/cl-som-imx7.c | 331 +++
 board/compulab/cl-som-imx7/common.c  |  46 +
 board/compulab/cl-som-imx7/common.h  |  32 +++
 board/compulab/cl-som-imx7/mux.c | 142 +
 board/compulab/cl-som-imx7/spl.c | 211 
 configs/cl-som-imx7_defconfig|  54 +
 include/configs/cl-som-imx7.h| 192 ++
 11 files changed, 1067 insertions(+)
 create mode 100644 board/compulab/cl-som-imx7/Kconfig
 create mode 100644 board/compulab/cl-som-imx7/MAINTAINERS
 create mode 100644 board/compulab/cl-som-imx7/Makefile
 create mode 100644 board/compulab/cl-som-imx7/cl-som-imx7.c
 create mode 100644 board/compulab/cl-som-imx7/common.c
 create mode 100644 board/compulab/cl-som-imx7/common.h
 create mode 100644 board/compulab/cl-som-imx7/mux.c
 create mode 100644 board/compulab/cl-som-imx7/spl.c
 create mode 100644 configs/cl-som-imx7_defconfig
 create mode 100644 include/configs/cl-som-imx7.h

diff --git a/arch/arm/mach-imx/mx7/Kconfig b/arch/arm/mach-imx/mx7/Kconfig
index aea8526..365501d 100644
--- a/arch/arm/mach-imx/mx7/Kconfig
+++ b/arch/arm/mach-imx/mx7/Kconfig
@@ -18,6 +18,13 @@ choice
prompt "MX7 board select"
optional
 
+config TARGET_CL_SOM_IMX7
+   bool "CL-SOM-iMX7"
+   select MX7D
+   select DM
+   select DM_THERMAL
+   select SUPPORT_SPL
+
 config TARGET_MX7DSABRESD
bool "mx7dsabresd"
select BOARD_LATE_INIT
@@ -51,6 +58,7 @@ endchoice
 config SYS_SOC
default "mx7"
 
+source "board/compulab/cl-som-imx7/Kconfig"
 source "board/freescale/mx7dsabresd/Kconfig"
 source "board/technexion/pico-imx7d/Kconfig"
 source "board/toradex/colibri_imx7/Kconfig"
diff --git a/board/compulab/cl-som-imx7/Kconfig 
b/board/compulab/cl-som-imx7/Kconfig
new file mode 100644
index 000..6d69cf3
--- /dev/null
+++ b/board/compulab/cl-som-imx7/Kconfig
@@ -0,0 +1,28 @@
+if TARGET_CL_SOM_IMX7
+
+config SYS_BOARD
+   default "cl-som-imx7"
+
+config SYS_VENDOR
+   default "compulab"
+
+config SYS_CONFIG_NAME
+   default "cl-som-imx7"
+
+config SYS_MMC_DEV
+   int
+   default 0
+
+config SYS_USB_DEV
+   int
+   default 0
+
+config SYS_MMC_IMG_LOAD_PART
+   int
+   default 1
+
+config SYS_USB_IMG_LOAD_PART
+   int
+   default 1
+
+endif
diff --git a/board/compulab/cl-som-imx7/MAINTAINERS 
b/board/compulab/cl-som-imx7/MAINTAINERS
new file mode 100644
index 000..2b917a5
--- /dev/null
+++ b/board/compulab/cl-som-imx7/MAINTAINERS
@@ -0,0 +1,6 @@
+CL-SOM-IMX7 BOARD
+M: Uri Mashiach <uri.mashi...@compulab.co.il>
+S: Maintained
+F: board/compulab/cl-som-imx7
+F: include/configs/cl-som-imx7.h
+F: configs/cl-som-imx7_defconfig
diff --git a/board/compulab/cl-som-imx7/Makefile 
b/board/compulab/cl-som-imx7/Makefile
new file mode 100644
index 000..8f0e068
--- /dev/null
+++ b/board/compulab/cl-som-imx7/Makefile
@@ -0,0 +1,17 @@
+#
+# Makefile
+#
+# (C) Copyright 2017 CompuLab, Ltd. http://www.compulab.com
+#
+# Author: Uri Mashiach <uri.mashi...@compulab.co.il>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y := mux.o common.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y  += spl.o
+else
+obj-y  += cl-som-imx7.o
+endif
diff --git a/board/compulab/cl-som-imx7/cl-som-imx7.c 
b/board/compulab/cl-som-imx7/cl-som-imx7.c
new file mode 100644
index 000..2957180
--- /dev/null
+++ b/board/compulab/cl-som-imx7/cl-som-imx7.c
@@ -0,0 +1,331 @@
+/*
+ * U-Boot board functions for CompuLab CL-SOM-iMX7 module
+ *
+ * (C) Copyright 2017 CompuLab, Ltd. http://www.compulab.com
+ *
+ * Author: Uri Mashiach <uri.mashi...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../common/eeprom.h"
+#include "common.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_SYS_I2C_MXC
+
+#define I2C_PAD_CTRL   (PAD_CTL_DSE_3P3V_32OHM | PAD_CTL_SRE_SLOW | \
+   PAD_CTL_HYS)
+
+#define CL_SOM_IMX7_GPIO_I2C2_SCL  IMX_GPIO_NR(1, 6)
+#define CL_SOM_IMX7_GPIO_I2C2_SDA  IMX_GPIO_NR(1, 7)
+
+static struct i2c_pads_info cl_som_imx7_i2c_pad_info2 = {
+   .scl = {
+   .i2c_mode = MX7D_PAD_GPIO1_IO06__I2C2_SCL |
+  

[U-Boot] [PATCH 2/4] imx: mx7: DDR controller configuration for the i.MX7 architecture

2017-09-24 Thread Uri Mashiach
The configuration files imximage.cfg are used for the DDR controller
configuration.
Add DDR configuration function to replace the DDR controller
configuration in the imximage.cfg file. The function can be used for
DDR size detection.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 arch/arm/include/asm/arch-mx7/crm_regs.h |   5 +
 arch/arm/include/asm/arch-mx7/imx-regs.h |   2 +
 arch/arm/include/asm/arch-mx7/mx7-ddr.h  | 155 
 arch/arm/mach-imx/mx7/Makefile   |   2 +-
 arch/arm/mach-imx/mx7/ddr.c  | 201 +++
 5 files changed, 364 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/arch-mx7/mx7-ddr.h
 create mode 100644 arch/arm/mach-imx/mx7/ddr.c

diff --git a/arch/arm/include/asm/arch-mx7/crm_regs.h 
b/arch/arm/include/asm/arch-mx7/crm_regs.h
index e54a254..611190e 100644
--- a/arch/arm/include/asm/arch-mx7/crm_regs.h
+++ b/arch/arm/include/asm/arch-mx7/crm_regs.h
@@ -2055,6 +2055,11 @@ struct mxc_ccm_anatop_reg {
 #define HW_CCM_ROOT_TARGET_TOGGLE(i, v)writel((v), 
CCM_ROOT_TARGET_TOGGLE(i))
 
 #define CCM_CLK_ON_MSK 0x03
+#define CCM_CLK_ON_N_N 0x00 /* Domain clocks not needed */
+#define CCM_CLK_ON_R_W 0x02 /* Domain clocks needed when in RUN and WAIT */
+
+/* CCGR Mapping */
+#define CCGR_IDX_DDR 19 /* CCM_CCGR19 */
 
 #define CCM_ROOT_TGT_POST_DIV_SHIFT0
 #define CCM_ROOT_TGT_PRE_DIV_SHIFT 15
diff --git a/arch/arm/include/asm/arch-mx7/imx-regs.h 
b/arch/arm/include/asm/arch-mx7/imx-regs.h
index aab3a9a..f0693f9 100644
--- a/arch/arm/include/asm/arch-mx7/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx7/imx-regs.h
@@ -268,6 +268,8 @@ struct src {
 #define SRC_M4RCR_M4C_NON_SCLR_RST_MASK(1 << 0)
 #define SRC_M4RCR_ENABLE_M4_OFFSET 3
 #define SRC_M4RCR_ENABLE_M4_MASK   (1 << 3)
+#define SRC_DDRC_RCR_DDRC_CORE_RST_OFFSET  1
+#define SRC_DDRC_RCR_DDRC_CORE_RST_MASK(1 << 1)
 
 /* GPR0 Bit Fields */
 #define IOMUXC_GPR_GPR0_DMAREQ_MUX_SEL0_MASK 0x1u
diff --git a/arch/arm/include/asm/arch-mx7/mx7-ddr.h 
b/arch/arm/include/asm/arch-mx7/mx7-ddr.h
new file mode 100644
index 000..3a4841c
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx7/mx7-ddr.h
@@ -0,0 +1,155 @@
+/*
+ * DDR controller registers of the i.MX7 architecture
+ *
+ * (C) Copyright 2017 CompuLab, Ltd. http://www.compulab.com
+ *
+ * Author: Uri Mashiach <uri.mashi...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef __ASM_ARCH_MX7_DDR_H__
+#define __ASM_ARCH_MX7_DDR_H__
+
+/* DDRC Registers (DDRC_IPS_BASE_ADDR) */
+struct ddrc {
+   u32 mstr;   /* 0x */
+   u32 reserved1[0x18];
+   u32 rfshtmg;/* 0x0064 */
+   u32 reserved2[0x1a];
+   u32 init0;  /* 0x00d0 */
+   u32 init1;  /* 0x00d4 */
+   u32 reserved3;
+   u32 init3;  /* 0x00dc */
+   u32 init4;  /* 0x00e0 */
+   u32 init5;  /* 0x00e4 */
+   u32 reserved4[0x03];
+   u32 rankctl;/* 0x00f4 */
+   u32 reserved5[0x02];
+   u32 dramtmg0;   /* 0x0100 */
+   u32 dramtmg1;   /* 0x0104 */
+   u32 dramtmg2;   /* 0x0108 */
+   u32 dramtmg3;   /* 0x010c */
+   u32 dramtmg4;   /* 0x0110 */
+   u32 dramtmg5;   /* 0x0114 */
+   u32 reserved6[0x02];
+   u32 dramtmg8;   /* 0x0120 */
+   u32 reserved7[0x17];
+   u32 zqctl0; /* 0x0180 */
+   u32 reserved8[0x03];
+   u32 dfitmg0;/* 0x0190 */
+   u32 dfitmg1;/* 0x0194 */
+   u32 reserved9[0x02];
+   u32 dfiupd0;/* 0x01a0 */
+   u32 dfiupd1;/* 0x01a4 */
+   u32 dfiupd2;/* 0x01a8 */
+   u32 reserved10[0x15];
+   u32 addrmap0;   /* 0x0200 */
+   u32 addrmap1;   /* 0x0204 */
+   u32 addrmap2;   /* 0x0208 */
+   u32 addrmap3;   /* 0x020c */
+   u32 addrmap4;   /* 0x0210 */
+   u32 addrmap5;   /* 0x0214 */
+   u32 addrmap6;   /* 0x0218 */
+   u32 reserved12[0x09];
+   u32 odtcfg; /* 0x0240 */
+   u32 odtmap; /* 0x0244 */
+};
+
+/* DDRC_MSTR fields */
+#define MSTR_DATA_BUS_WIDTH_MASK   0x3 << 12
+#define MSTR_DATA_BUS_WIDTH_SHIFT  12
+#define MSTR_DATA_ACTIVE_RANKS_MASK0xf << 24
+#define MSTR_DATA_ACTIVE_RANKS_SHIFT   24
+/* DDRC_ADDRMAP1 fields */
+#define ADDRMAP1_BANK_B0_MASK  0x1f << 0
+#define ADDRMAP1_BANK_B0_SHIFT 0
+#define ADDRMAP1_BANK_B1_MASK  0x1f << 8
+#define ADDRMAP1_BANK_B1_SHIFT 8
+#define ADDRMAP1_BANK_B2_MASK  0x1f << 16
+#define ADDRMAP1_BANK_B2_SHIFT 16
+/* DDRC_ADDRMAP2 fields */
+#define ADDRMAP2_COL_B2_MASK   0xF << 0
+#define ADDRMAP2_COL_B2

[U-Boot] [PATCH 1/4] imx: mx7: fix the CCM_ macros

2017-09-24 Thread Uri Mashiach
The CCM_ macros use the CCM_BASE_ADDRESS macro, which doesn't exist.
Replace the CCM_BASE_ADDRESS macros with CCM_BASE_ADDR.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 arch/arm/include/asm/arch-mx7/crm_regs.h | 46 
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx7/crm_regs.h 
b/arch/arm/include/asm/arch-mx7/crm_regs.h
index d65d4d9..e54a254 100644
--- a/arch/arm/include/asm/arch-mx7/crm_regs.h
+++ b/arch/arm/include/asm/arch-mx7/crm_regs.h
@@ -2000,29 +2000,29 @@ struct mxc_ccm_anatop_reg {
 #define TEMPMON_HW_ANADIG_TEMPSENSE_TRIM_TOG_T_MUX_ADDR(x) 
(((uint32_t)(((uint32_t)(x))<<TEMPMON_HW_ANADIG_TEMPSENSE_TRIM_TOG_T_MUX_ADDR_SHIFT))_HW_ANADIG_TEMPSENSE_TRIM_TOG_T_MUX_ADDR_MASK)
 
 
-#define CCM_GPR(i) (CCM_BASE_ADDRESS + CCM_GPR0_OFFSET + 0x10 * 
(i))
-#define CCM_OBSERVE(i) (CCM_BASE_ADDRESS + CCM_OBSERVE0_OFFSET + 0x10 
* (i))
-#define CCM_SCTRL(i)   (CCM_BASE_ADDRESS + CCM_SCTRL0_OFFSET + 0x10 * 
(i))
-#define CCM_CCGR(i)(CCM_BASE_ADDRESS + CCM_CCGR0_OFFSET + 0x10 * 
(i))
-#define CCM_ROOT_TARGET(i) (CCM_BASE_ADDRESS + CCM_ROOT0_TARGET_OFFSET + 
0x80 * (i))
-
-#define CCM_GPR_SET(i) (CCM_BASE_ADDRESS + CCM_GPR0_OFFSET + 0x10 * 
(i) + 4)
-#define CCM_OBSERVE_SET(i) (CCM_BASE_ADDRESS + CCM_OBSERVE0_OFFSET + 0x10 
* (i) + 4)
-#define CCM_SCTRL_SET(i)   (CCM_BASE_ADDRESS + CCM_SCTRL0_OFFSET + 0x10 * 
(i) + 4)
-#define CCM_CCGR_SET(i)(CCM_BASE_ADDRESS + CCM_CCGR0_OFFSET + 
0x10 * (i) + 4)
-#define CCM_ROOT_TARGET_SET(i) (CCM_BASE_ADDRESS + CCM_ROOT0_TARGET_OFFSET + 
0x80 * (i) + 4)
-
-#define CCM_GPR_CLR(i) (CCM_BASE_ADDRESS + CCM_GPR0_OFFSET + 0x10 * 
(i) + 8)
-#define CCM_OBSERVE_CLR(i) (CCM_BASE_ADDRESS + CCM_OBSERVE0_OFFSET + 0x10 
* (i) + 8)
-#define CCM_SCTRL_CLR(i)   (CCM_BASE_ADDRESS + CCM_SCTRL0_OFFSET + 0x10 * 
(i) + 8)
-#define CCM_CCGR_CLR(i)(CCM_BASE_ADDRESS + CCM_CCGR0_OFFSET + 
0x10 * (i) + 8)
-#define CCM_ROOT_TARGET_CLR(i) (CCM_BASE_ADDRESS + CCM_ROOT0_TARGET_OFFSET + 
0x80 * (i) + 8)
-
-#define CCM_GPR_TOGGLE(i)  (CCM_BASE_ADDRESS + CCM_GPR0_OFFSET + 0x10 * 
(i) + 12)
-#define CCM_OBSERVE_TOGGLE(i)  (CCM_BASE_ADDRESS + CCM_OBSERVE0_OFFSET + 0x10 
* (i) + 12)
-#define CCM_SCTRL_TOGGLE(i)(CCM_BASE_ADDRESS + CCM_SCTRL0_OFFSET + 0x10 * 
(i) + 12)
-#define CCM_CCGR_TOGGLE(i) (CCM_BASE_ADDRESS + CCM_CCGR0_OFFSET + 0x10 * 
(i) + 12)
-#define CCM_ROOT_TARGET_TOGGLE(i)  (CCM_BASE_ADDRESS + 
CCM_ROOT0_TARGET_OFFSET + 0x80 * (i) + 12)
+#define CCM_GPR(i) (CCM_BASE_ADDR + CCM_GPR0_OFFSET + 0x10 * (i))
+#define CCM_OBSERVE(i) (CCM_BASE_ADDR + CCM_OBSERVE0_OFFSET + 0x10 * 
(i))
+#define CCM_SCTRL(i)   (CCM_BASE_ADDR + CCM_SCTRL0_OFFSET + 0x10 * (i))
+#define CCM_CCGR(i)(CCM_BASE_ADDR + CCM_CCGR0_OFFSET + 0x10 * (i))
+#define CCM_ROOT_TARGET(i) (CCM_BASE_ADDR + CCM_ROOT0_TARGET_OFFSET + 0x80 
* (i))
+
+#define CCM_GPR_SET(i) (CCM_BASE_ADDR + CCM_GPR0_OFFSET + 0x10 * (i) + 
4)
+#define CCM_OBSERVE_SET(i) (CCM_BASE_ADDR + CCM_OBSERVE0_OFFSET + 0x10 * 
(i) + 4)
+#define CCM_SCTRL_SET(i)   (CCM_BASE_ADDR + CCM_SCTRL0_OFFSET + 0x10 * (i) 
+ 4)
+#define CCM_CCGR_SET(i)(CCM_BASE_ADDR + CCM_CCGR0_OFFSET + 
0x10 * (i) + 4)
+#define CCM_ROOT_TARGET_SET(i) (CCM_BASE_ADDR + CCM_ROOT0_TARGET_OFFSET + 0x80 
* (i) + 4)
+
+#define CCM_GPR_CLR(i) (CCM_BASE_ADDR + CCM_GPR0_OFFSET + 0x10 * (i) + 
8)
+#define CCM_OBSERVE_CLR(i) (CCM_BASE_ADDR + CCM_OBSERVE0_OFFSET + 0x10 * 
(i) + 8)
+#define CCM_SCTRL_CLR(i)   (CCM_BASE_ADDR + CCM_SCTRL0_OFFSET + 0x10 * (i) 
+ 8)
+#define CCM_CCGR_CLR(i)(CCM_BASE_ADDR + CCM_CCGR0_OFFSET + 
0x10 * (i) + 8)
+#define CCM_ROOT_TARGET_CLR(i) (CCM_BASE_ADDR + CCM_ROOT0_TARGET_OFFSET + 0x80 
* (i) + 8)
+
+#define CCM_GPR_TOGGLE(i)  (CCM_BASE_ADDR + CCM_GPR0_OFFSET + 0x10 * (i) + 
12)
+#define CCM_OBSERVE_TOGGLE(i)  (CCM_BASE_ADDR + CCM_OBSERVE0_OFFSET + 0x10 * 
(i) + 12)
+#define CCM_SCTRL_TOGGLE(i)(CCM_BASE_ADDR + CCM_SCTRL0_OFFSET + 0x10 * (i) 
+ 12)
+#define CCM_CCGR_TOGGLE(i) (CCM_BASE_ADDR + CCM_CCGR0_OFFSET + 0x10 * (i) 
+ 12)
+#define CCM_ROOT_TARGET_TOGGLE(i)  (CCM_BASE_ADDR + 
CCM_ROOT0_TARGET_OFFSET + 0x80 * (i) + 12)
 
 #define HW_CCM_GPR_WR(i, v)writel((v), CCM_GPR(i))
 #define HW_CCM_CCM_OBSERVE_WR(i, v)writel((v), CCM_OBSERVE(i))
-- 
2.7.4

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


[U-Boot] [PATCH 0/4] cl-som-imx7: initial support

2017-09-24 Thread Uri Mashiach
This patch series adds support for CompuLab CL-SOM-iMX7, SBC-iMX7, SBC-IOT-iMX7
and IOT-GATE-iMX7.

CL-SOM-iMX7 is a miniature System-on-Module (SoM) based on
NXP i.MX7 processor family.

SBC-iMX7 is a single board computer, implemented with the CL-SOM-iMX7 module
and the SB-SOM-iMX7 carrier board.
The CL-SOM-iMX7 providing most of the functions and the SB-SOM-iMX7 providing
additional peripheral functions and connectors.

SBC-IOT-iMX7 is a internet of things single board computer, implemented with
the CL-SOM-iMX7 module and the SB-IOT-iMX7 carrier board.
The CL-SOM-iMX7 providing most of the functions and the SB-IOT-iMX7 providing
additional peripheral functions and connectors.

The CL-SOM-iMX7 has the following features:

CPU:NXP (Freescale) i.MX 7Dual ARM Cortex-A7, 1GHz processor 
(dual-core) or
NXP (Freescale) i.MX 7Solo ARM Cortex-A7, 800MHz processor 
(single-core)

RAM:256MB – 2GB, DDR3L-1066

Storage:SLC NAND flash, 128MB - 1GB or
eMMC flash, 4GB - 32GB

Ethernet:   Up to 2x 10/100/1000Mbps Ethernet ports (MAC+PHY)

WiFi:   802.11b/g/n WiFi interface (TI WiLink 8 WL1801 chipset) or
Dual-band 2x2 802.11a/b/g/n WiFi interface (TI WiLink 8 WL1837 
chipset)

Bluetooth:  Bluetooth 4.1 BLE

Analog Audio:   Audio codec with stereo output, stereo input and microphone 
support

Digital Audio:  I2S compliant digital audio interface, MQS audio interface

Display:Parallel 24-bit display interface, up to 1920 x 1080 @60Hz,
LVDS, up to 1400 x 1050 @60Hz
MIPI-DSI, 2 data lanes, up to 1400 x 1050 @60Hz

More details can be found here:

http://www.compulab.com/products/computer-on-modules/cl-som-imx7-freescale-i-mx-7-system-on-module/

http://www.compulab.com/products/sbcs/sbc-imx7-freescale-i-mx-7-single-board-computer/

http://www.compulab.com/products/sbcs/sbc-iot-imx7-nxp-i-mx-7-internet-of-things-single-board-computer/

http://www.compulab.com/products/iot-gateways/iot-gate-imx7-nxp-i-mx-7-internet-of-things-gateway/

Ilya Ledvich (1):
  arm: imx7d: add support for Compulab cl-som-imx7

Uri Mashiach (3):
  imx: mx7: fix the CCM_ macros
  imx: mx7: DDR controller configuration for the i.MX7 architecture
  imx: mx7: SPL support for i.MX7

 arch/arm/include/asm/arch-mx7/crm_regs.h  |  51 ++---
 arch/arm/include/asm/arch-mx7/imx-regs.h  |   2 +
 arch/arm/include/asm/arch-mx7/mx7-ddr.h   | 155 ++
 arch/arm/include/asm/arch-mx7/sys_proto.h |   1 +
 arch/arm/mach-imx/mx7/Kconfig |   8 +
 arch/arm/mach-imx/mx7/Makefile|   2 +-
 arch/arm/mach-imx/mx7/ddr.c   | 201 ++
 arch/arm/mach-imx/spl.c   |  23 ++-
 board/compulab/cl-som-imx7/Kconfig|  28 +++
 board/compulab/cl-som-imx7/MAINTAINERS|   6 +
 board/compulab/cl-som-imx7/Makefile   |  17 ++
 board/compulab/cl-som-imx7/cl-som-imx7.c  | 331 ++
 board/compulab/cl-som-imx7/common.c   |  46 +
 board/compulab/cl-som-imx7/common.h   |  32 +++
 board/compulab/cl-som-imx7/mux.c  | 142 +
 board/compulab/cl-som-imx7/spl.c  | 211 +++
 configs/cl-som-imx7_defconfig |  54 +
 include/configs/cl-som-imx7.h | 192 +
 include/configs/imx7_spl.h|  67 ++
 19 files changed, 1544 insertions(+), 25 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-mx7/mx7-ddr.h
 create mode 100644 arch/arm/mach-imx/mx7/ddr.c
 create mode 100644 board/compulab/cl-som-imx7/Kconfig
 create mode 100644 board/compulab/cl-som-imx7/MAINTAINERS
 create mode 100644 board/compulab/cl-som-imx7/Makefile
 create mode 100644 board/compulab/cl-som-imx7/cl-som-imx7.c
 create mode 100644 board/compulab/cl-som-imx7/common.c
 create mode 100644 board/compulab/cl-som-imx7/common.h
 create mode 100644 board/compulab/cl-som-imx7/mux.c
 create mode 100644 board/compulab/cl-som-imx7/spl.c
 create mode 100644 configs/cl-som-imx7_defconfig
 create mode 100644 include/configs/cl-som-imx7.h
 create mode 100644 include/configs/imx7_spl.h

-- 
2.7.4

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


[U-Boot] [PATCH v4] net: usb: mcs7830: fix non-DM ingress path

2017-05-21 Thread Uri Mashiach
The mcs7830_recv() (non-DM) function discards good packets and tries to
process "bad" packets due to incorrect test condition.
Fix the condition and return the proper value as described in function
doc.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v4: update the commit message.

 drivers/usb/eth/mcs7830.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c
index 9d6cf8c..4abef5d 100644
--- a/drivers/usb/eth/mcs7830.c
+++ b/drivers/usb/eth/mcs7830.c
@@ -622,10 +622,12 @@ static int mcs7830_recv(struct eth_device *eth)
int len;
 
len = mcs7830_recv_common(ueth, buf);
-   if (len <= 0)
+   if (len >= 0) {
net_process_received_packet(buf, len);
+   return 0;
+   }
 
-   return 0;
+   return len;
 }
 
 /*
-- 
2.7.4

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


[U-Boot] [PATCH v3] net: usb: mcs7830: fix no DM recive path

2017-05-18 Thread Uri Mashiach
The function mcs7830_recv_common() returns a negative value on error, 0
or positive value on success.
Fix the condition for calling the function
net_process_received_packet().

The function mcs7830_recv() is always returning 0.
Update the return value of mcs7830_recv() to reflect the function's
success status.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v3: update the commit message.

 drivers/usb/eth/mcs7830.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c
index 9d6cf8c..4abef5d 100644
--- a/drivers/usb/eth/mcs7830.c
+++ b/drivers/usb/eth/mcs7830.c
@@ -622,10 +622,12 @@ static int mcs7830_recv(struct eth_device *eth)
int len;
 
len = mcs7830_recv_common(ueth, buf);
-   if (len <= 0)
+   if (len >= 0) {
net_process_received_packet(buf, len);
+   return 0;
+   }
 
-   return 0;
+   return len;
 }
 
 /*
-- 
2.7.4

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


[U-Boot] [PATCH v2] net: usb: mcs7830: fix no DM recive path

2017-05-18 Thread Uri Mashiach
The function mcs7830_recv_common() returns a negative value on error, 0
or positive value on success.

Modifications:
* Fix the condition for calling the function net_process_received_packet().
* The return value of the function mcs7830_recv() reflects the success of
  the function mcs7830_recv_common().

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v2: update the commit message.

 drivers/usb/eth/mcs7830.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c
index 9d6cf8c..4abef5d 100644
--- a/drivers/usb/eth/mcs7830.c
+++ b/drivers/usb/eth/mcs7830.c
@@ -622,10 +622,12 @@ static int mcs7830_recv(struct eth_device *eth)
int len;
 
len = mcs7830_recv_common(ueth, buf);
-   if (len <= 0)
+   if (len >= 0) {
net_process_received_packet(buf, len);
+   return 0;
+   }
 
-   return 0;
+   return len;
 }
 
 /*
-- 
2.7.4

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


[U-Boot] [PATCH] net: usb: mcs7830: fix no DM recive path

2017-05-17 Thread Uri Mashiach
Modifications:
* The call condition of the function net_process_received_packet() is
  the success of the function mcs7830_recv_common().
* The return value of the function mcs7830_recv reflects the success of
  the function mcs7830_recv_common().

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 drivers/usb/eth/mcs7830.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c
index 9d6cf8c..4abef5d 100644
--- a/drivers/usb/eth/mcs7830.c
+++ b/drivers/usb/eth/mcs7830.c
@@ -622,10 +622,12 @@ static int mcs7830_recv(struct eth_device *eth)
int len;
 
len = mcs7830_recv_common(ueth, buf);
-   if (len <= 0)
+   if (len >= 0) {
net_process_received_packet(buf, len);
+   return 0;
+   }
 
-   return 0;
+   return len;
 }
 
 /*
-- 
2.7.4

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


[U-Boot] [PATCH 4/4] arm: am57xx: cl-som-am57x: adjust default env to the installation system

2017-05-17 Thread Uri Mashiach
The SD card automatic installation system depends on the default
environment of the previous U-Boot.

Add the missing environment variables.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 include/configs/cl-som-am57x.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index 8e69306..581468c 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -130,8 +130,10 @@
"bootkernel=bootz ${loadaddr} - ${fdtaddr}\0" \
"mmcloadfdt=load mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
"mmcloadkernel=load mmc ${mmcdev} ${loadaddr} ${kernel}\0" \
+   "emmcloadfdt=load mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
+   "emmcloadkernel=load mmc ${mmcdev} ${loadaddr} ${kernel}\0" \
"load_mmc=mmc dev ${mmcdev} && mmc rescan && " \
-   "run mmcloadkernel run mmcloadfdt\0" \
+   "run mmcloadkernel && run mmcloadfdt\0" \
"mmcroot=/dev/mmcblk1p2\0" \
"mmcrootfstype=ext4 rw rootwait\0" \
"mmcargs=setenv bootargs console=${console} root=${mmcroot} " \
@@ -167,7 +169,7 @@
"source ${loadaddr}\0" \
"sataboot=run load_sata && run sataargs && " \
"echo Booting from SATA ... && " \
-   "run bootkernel\0" \
+   "run bootkernel\0"
 
 #undef CONFIG_BOOTCOMMAND
 #define CONFIG_BOOTCOMMAND \
-- 
2.7.4

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


[U-Boot] [PATCH 1/4] arm: am57xx: cl-som-am57x: support for FS boot

2017-05-17 Thread Uri Mashiach
Supported boot devices are raw QSPI and raw SD card.
Add support for a FAT16/32 file system for SD card.

The SOC's boot ROM only supports FAT file system.
Therefore remove the SPL support for the EXT file system.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 configs/cl-som-am57x_defconfig | 1 +
 include/configs/cl-som-am57x.h | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index ed419a3..57d96b4 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -5,6 +5,7 @@ CONFIG_TARGET_CL_SOM_AM57X=y
 # CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_VERSION_VARIABLE=y
 CONFIG_SPL=y
+# CONFIG_SPL_EXT_SUPPORT is not set
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMLS is not set
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index 3000453..8e69306 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -42,9 +42,9 @@
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
 
-/* SD/MMC RAW boot */
-#undef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
-#undef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
+/* SD/MMC RAW/FS boot */
+#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
 
 /* Environment */
 #define CONFIG_ENV_SIZE(16 << 10) /* 16 KiB env size */
-- 
2.7.4

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


[U-Boot] [PATCH 2/4] arm: am57xx: cl-som-am57x: change the shell prompt

2017-05-17 Thread Uri Mashiach
Change the shell prompt to "U-Boot# ".

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 configs/cl-som-am57x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index 57d96b4..29322f9 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -7,6 +7,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_SPL=y
 # CONFIG_SPL_EXT_SUPPORT is not set
 CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="U-Boot# "
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_ASKENV=y
-- 
2.7.4

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


[U-Boot] [PATCH 3/4] ARM: am57xx: cl-som-am57x: support for AM5718

2017-05-17 Thread Uri Mashiach
Disable SDRAM controller EMIF2 for single core SOC
Set SDRAM size size to 1GB

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 board/compulab/cl-som-am57x/spl.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/board/compulab/cl-som-am57x/spl.c 
b/board/compulab/cl-som-am57x/spl.c
index 855678f..de2dadc 100644
--- a/board/compulab/cl-som-am57x/spl.c
+++ b/board/compulab/cl-som-am57x/spl.c
@@ -19,7 +19,12 @@ static const struct dmm_lisa_map_regs cl_som_am57x_lisa_regs 
= {
 
 void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs)
 {
+   /* Disable SDRAM controller EMIF2 for single core SOC */
*dmm_lisa_regs = _som_am57x_lisa_regs;
+   if (omap_revision() == DRA722_ES1_0) {
+   ((struct dmm_lisa_map_regs *) *dmm_lisa_regs)->dmm_lisa_map_3 =
+ 0x80640100;
+   }
 }
 
 static const struct emif_regs cl_som_am57x_emif1_ddr3_532mhz_emif_regs = {
-- 
2.7.4

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


[U-Boot] [PATCH 0/4] arm: am57xx: cl-som-am57x: 2'nd stage

2017-05-17 Thread Uri Mashiach
Various commits related to the CL-SOM-AM57x module.

Uri Mashiach (4):
  arm: am57xx: cl-som-am57x: support for FS boot
  arm: am57xx: cl-som-am57x: change the shell prompt
  ARM: am57xx: cl-som-am57x: support for AM5718
  arm: am57xx: cl-som-am57x: adjust default env to the installation
system

 board/compulab/cl-som-am57x/spl.c |  5 +
 configs/cl-som-am57x_defconfig|  2 ++
 include/configs/cl-som-am57x.h| 12 +++-
 3 files changed, 14 insertions(+), 5 deletions(-)

-- 
2.7.4

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


Re: [U-Boot] [PATCH v4 0/7] am57xx: cl-som-am57x: fix usb

2017-04-23 Thread Uri Mashiach

Hello Tom,

A gentle ping on this patch series.

On 02/23/2017 03:39 PM, Uri Mashiach wrote:

Various USB related comits for the CL-SOM-AM57x module.

---
V1 -> V2: Replace commit "fix XHCI registers base address" with "reintroduce the 
CONFIG_AM57XX symbol".
V2 -> V3: * New commit "move CONFIG_DRA7XX to Kconfig"
  * Replace commit "reintroduce the CONFIG_AM57XX symbol" with "xHCI 
registers based on USB port index"
V3 -> V4: Update commit "move CONFIG_DRA7XX to Kconfig"
  Update commit "xHCI registers based on USB port index"

Uri Mashiach (7):
  arm: dra7xx: move CONFIG_DRA7XX to Kconfig
  arm: usb: dra7xx: xHCI registers based on USB port index
  usb: host: xhci-omap: fix double weak board_usb_init functions
  arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks
  arm: am57xx: cl-som-am57x: fix USB scan
  arm: am57xx: cl-som-am57x: enable USB storage
  arm: am57xx: cl-som-am57x: enable USB commands

 arch/arm/mach-omap2/omap5/Kconfig  |  8 
 board/compulab/cl-som-am57x/cl-som-am57x.c | 10 --
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 configs/cl-som-am57x_defconfig |  2 ++
 configs/dra7xx_evm_defconfig   |  1 +
 configs/dra7xx_hs_evm_defconfig|  1 +
 drivers/usb/host/Kconfig   |  9 +
 drivers/usb/host/xhci-omap.c   | 19 +--
 include/configs/am57xx_evm.h   |  2 --
 include/configs/cl-som-am57x.h |  6 ++
 include/configs/dra7xx_evm.h   |  2 --
 include/linux/usb/xhci-omap.h  |  6 --
 scripts/config_whitelist.txt   |  1 -
 15 files changed, 50 insertions(+), 29 deletions(-)



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


Re: [U-Boot] [PATCH v4 3/7] usb: host: xhci-omap: fix double weak board_usb_init functions

2017-03-01 Thread Uri Mashiach

On 02/28/2017 03:13 PM, Roger Quadros wrote:

On 28/02/17 10:00, Uri Mashiach wrote:

Hi,

On 02/27/2017 06:22 PM, Roger Quadros wrote:

Hi,

On 23/02/17 15:39, Uri Mashiach wrote:

A weak version of the function board_usb_init is implemented in:
common/usb.c
drivers/usb/host/xhci-omap.c


[...]


 board/compulab/cl-som-am57x/cl-som-am57x.c |  2 +-
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 drivers/usb/host/xhci-omap.c   | 17 +++--


What about board/ti/omap5_uevm/evm.c ?


The symbol CONFIG_USB_XHCI_OMAP is not included in the file 
include/configs/omap5_uevm.h, therefore:
The file drivers/usb/host/xhci-omap.c is not included in the compilation - no 
double implementations to fix.



But if someone wants to use the XHCI host he will enable the 
CONFIG_USB_XHCI_OMAP for omap5_uevm right?
We need to ensure it doesn't break then.

Compilation errors are generated for compilation attempt of U-Boot for 
the target ti/omap5_uevm with CONFIG_USB_XHCI_OMAP.
Maybe the adjustments relevant for the current commit should be applied 
after the CONFIG_USB_XHCI_OMAP adjustments?


Generated error messages:

In file included from include/asm/arch/sys_proto.h:12:0,
 from /home/work/u-boot/board/ti/omap5_uevm/evm.c:12:
/home/work/u-boot/board/ti/omap5_uevm/evm.c: In function 
'enable_host_clocks':
/home/work/u-boot/board/ti/omap5_uevm/evm.c:172:22: error: 'const struct 
prcm_regs' has no member named 'cm_l3init_usb_otg_ss_clkctrl'

  setbits_le32((*prcm)->cm_l3init_usb_otg_ss_clkctrl,
  ^
/home/work/u-boot/arch/arm/include/asm/io.h:78:55: note: in definition 
of macro '__arch_putl'

 #define __arch_putl(v,a)  (*(volatile unsigned int *)(a) = (v))
   ^
/home/work/u-boot/arch/arm/include/asm/io.h:175:35: note: in expansion 
of macro '__raw_writel'

 #define out_arch(type,endian,a,v) __raw_write##type(cpu_to_##endian(v),a)
   ^
/home/work/u-boot/arch/arm/include/asm/io.h:179:23: note: in expansion 
of macro 'out_arch'

 #define out_le32(a,v) out_arch(l,le32,a,v)
   ^
/home/work/u-boot/arch/arm/include/asm/io.h:199:2: note: in expansion of 
macro 'out_le32'

  out_##type((addr), in_##type(addr) | (set))
  ^
/home/work/u-boot/arch/arm/include/asm/io.h:209:33: note: in expansion 
of macro 'setbits'

 #define setbits_le32(addr, set) setbits(le32, addr, set)
 ^
/home/work/u-boot/board/ti/omap5_uevm/evm.c:172:2: note: in expansion of 
macro 'setbits_le32'

  setbits_le32((*prcm)->cm_l3init_usb_otg_ss_clkctrl,
  ^
/home/work/u-boot/board/ti/omap5_uevm/evm.c:172:22: error: 'const struct 
prcm_regs' has no member named 'cm_l3init_usb_otg_ss_clkctrl'

  setbits_le32((*prcm)->cm_l3init_usb_otg_ss_clkctrl,
  ^
/home/work/u-boot/arch/arm/include/asm/io.h:78:61: note: in definition 
of macro '__arch_putl'

 #define __arch_putl(v,a)  (*(volatile unsigned int *)(a) = (v))
 ^
/home/work/u-boot/arch/arm/include/asm/io.h:175:35: note: in expansion 
of macro '__raw_writel'

 #define out_arch(type,endian,a,v) __raw_write##type(cpu_to_##endian(v),a)
   ^
/home/work/u-boot/include/linux/byteorder/generic.h:89:21: note: in 
expansion of macro '__cpu_to_le32'

 #define cpu_to_le32 __cpu_to_le32
 ^
/home/work/u-boot/arch/arm/include/asm/io.h:179:23: note: in expansion 
of macro 'out_arch'

 #define out_le32(a,v) out_arch(l,le32,a,v)
   ^
/home/work/u-boot/arch/arm/include/asm/io.h:199:2: note: in expansion of 
macro 'out_le32'

  out_##type((addr), in_##type(addr) | (set))
  ^
/home/work/u-boot/include/linux/byteorder/generic.h:90:21: note: in 
expansion of macro '__le32_to_cpu'

 #define le32_to_cpu __le32_to_cpu
 ^
/home/work/u-boot/arch/arm/include/asm/io.h:133:25: note: in expansion 
of macro '__arch_getl'

 #define __raw_readl(a)  __arch_getl(a)
 ^
/home/work/u-boot/arch/arm/include/asm/io.h:176:49: note: in expansion 
of macro '__raw_readl'

 #define in_arch(type,endian,a)  endian##_to_cpu(__raw_read##type(a))
 ^
/home/work/u-boot/arch/arm/include/asm/io.h:183:20: note: in expansion 
of macro 'in_arch'

 #define in_le32(a) in_arch(l,le32,a)
^
/home/work/u-boot/arch/arm/include/asm/io.h:199:21: note: in expansion 
of macro 'in_le32'

  out_##type((addr), in_##type(addr) | (set))
 ^
/home/work/u-boot/arch/arm/include/asm/io.h:209:33: note: in expansion 
of macro 'setbits'

 #define setbits_le32(addr, set) setbits(le32, addr, set)
 ^
/home/work/u-boot/board/ti/omap5_uevm/evm.c:172:2: note: in expansion of 
macro 'set

Re: [U-Boot] [PATCH v4 3/7] usb: host: xhci-omap: fix double weak board_usb_init functions

2017-02-28 Thread Uri Mashiach

Hi,

On 02/27/2017 06:22 PM, Roger Quadros wrote:

Hi,

On 23/02/17 15:39, Uri Mashiach wrote:

A weak version of the function board_usb_init is implemented in:
common/usb.c
drivers/usb/host/xhci-omap.c

To fix the double implementations:
* Convert the board_usb_init function in drivers/usb/host/xhci-omap.c
  normal (not weak).
* The function board_usb_init in drivers/usb/host/xhci-omap.c calls to
  the weak function omap_xhci_board_usb_init.
* Rename board version of the function board_usb_init to
  omap_xhci_board_usb_init.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

To achieve the same flexibility with the function board_usb_cleanup:
* Add a normal (not weak) implementation of the function
  board_usb_cleanup in drivers/usb/host/xhci-omap.c
* The function board_usb_cleanup in drivers/usb/host/xhci-omap.c calls
  to the weak function omap_xhci_board_usb_cleanup.
* Rename board version of the function board_usb_cleanup to
  omap_xhci_board_usb_cleanup.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Marek Vasut <ma...@denx.de>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V2: Use __weak instead of attribute block
V2 -> V4: none

 board/compulab/cl-som-am57x/cl-som-am57x.c |  2 +-
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 drivers/usb/host/xhci-omap.c   | 17 +++--


What about board/ti/omap5_uevm/evm.c ?


The symbol CONFIG_USB_XHCI_OMAP is not included in the file 
include/configs/omap5_uevm.h, therefore:
The file drivers/usb/host/xhci-omap.c is not included in the compilation 
- no double implementations to fix.


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


[U-Boot] [PATCH v4 6/7] arm: am57xx: cl-som-am57x: enable USB storage

2017-02-23 Thread Uri Mashiach
Add CONFIG_USB_STORAGE to the defconfig file.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V4: none

 configs/cl-som-am57x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index 916b836..1831f45 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -47,4 +47,5 @@ CONFIG_TI_QSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_STORAGE=y
 CONFIG_OF_LIBFDT=y
-- 
2.7.4

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


[U-Boot] [PATCH v4 7/7] arm: am57xx: cl-som-am57x: enable USB commands

2017-02-23 Thread Uri Mashiach
Add CONFIG_CMD_USB to the defconfig file.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V4: none

 configs/cl-som-am57x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index 1831f45..83d7bd0 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_PART=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_I2C=y
+CONFIG_CMD_USB=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
-- 
2.7.4

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


[U-Boot] [PATCH v4 5/7] arm: am57xx: cl-som-am57x: fix USB scan

2017-02-23 Thread Uri Mashiach
USB bus scan attempt:
--cut--
=> usb start
starting USB...
USB0:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... data abort
pc : []  lr : []
reloc pc : [<8081b40e>]lr : [<8081b3b3>]
sp : fdf42930  ip : fdf42960 fp : 
r10: 0001  r9 : fdf42ef0 r8 : 48890020
r7 : 0002  r6 : fffa5840 r5 : fff8b140  r4 : fdf429c0
r3 :   r2 : 0004 r1 :   r0 : 
Flags: nZcv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
--cut--

Fix by enabling USB configuration in the SPL.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
Reviewed-by: Igor Grinberg <grinb...@compulab.co.il>
---
V1 -> V4: none

 include/configs/cl-som-am57x.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index c5f39ff..3418005 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -83,6 +83,8 @@
 #define CONFIG_SYS_I2C_PCA953X_ADDR 0x20
 #define CONFIG_SYS_I2C_PCA953X_WIDTH{ {0x20, 16} }
 
+#endif /* !CONFIG_SPL_BUILD */
+
 /* USB xHCI HOST */
 #define CONFIG_USB_XHCI_OMAP
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
@@ -97,8 +99,6 @@
 #define CONFIG_USB_ETHER_ASIX
 #define CONFIG_USB_ETHER_MCS7830
 
-#endif /* !CONFIG_SPL_BUILD */
-
 /* CPSW Ethernet */
 #define CONFIG_DRIVER_TI_CPSW
 #define CONFIG_MII
-- 
2.7.4

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


[U-Boot] [PATCH v4 2/7] arm: usb: dra7xx: xHCI registers based on USB port index

2017-02-23 Thread Uri Mashiach
Modify the determination of the base address of xHCI registers of DRA7XX
targets.
Before the commit: by the target.
After the commit: by the USB port index.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Cc: Marek Vasut <ma...@denx.de>
Cc: Roger Quadros <rog...@ti.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
V1 -> V2: Replace the commit "fix XHCI registers base address".
V2 -> V3: Replace the commit "reintroduce the CONFIG_AM57XX symbol"
V3 -> V4: Replace boolean symbols USB_XHCI_DRA7XX_INDEX0 and 
USB_XHCI_DRA7XX_INDEX1 with
  integer symbol USB_XHCI_DRA7XX_INDEX.

 configs/dra7xx_evm_defconfig| 1 +
 configs/dra7xx_hs_evm_defconfig | 1 +
 drivers/usb/host/Kconfig| 9 +
 include/linux/usb/xhci-omap.h   | 6 --
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 26b26cc..05f7778 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -86,6 +86,7 @@ CONFIG_OMAP_TIMER=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_XHCI_DRA7XX_INDEX=1
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GADGET=y
 CONFIG_USB_DWC3_OMAP=y
diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig
index 244940c..23ae2c7 100644
--- a/configs/dra7xx_hs_evm_defconfig
+++ b/configs/dra7xx_hs_evm_defconfig
@@ -91,6 +91,7 @@ CONFIG_OMAP_TIMER=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_XHCI_DRA7XX_INDEX=1
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GADGET=y
 CONFIG_USB_DWC3_OMAP=y
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 5129a57..3ff79fc 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -43,6 +43,15 @@ config USB_XHCI_ZYNQMP
help
  Enables support for the on-chip xHCI controller on Xilinx ZynqMP SoCs.
 
+config USB_XHCI_DRA7XX_INDEX
+   int "DRA7XX xHCI USB index"
+   range 0 1
+   default 0
+   depends on DRA7XX
+   help
+ Select the DRA7XX xHCI USB index.
+ Current supported values: 0, 1.
+
 endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h
index 9de80d7..f038ddb 100644
--- a/include/linux/usb/xhci-omap.h
+++ b/include/linux/usb/xhci-omap.h
@@ -10,14 +10,16 @@
 #ifndef _ASM_ARCH_XHCI_OMAP_H_
 #define _ASM_ARCH_XHCI_OMAP_H_
 
-#ifdef CONFIG_TARGET_DRA7XX_EVM
+#ifdef CONFIG_DRA7XX
+#if CONFIG_USB_XHCI_DRA7XX_INDEX == 1
 #define OMAP_XHCI_BASE 0x488d
 #define OMAP_OCP1_SCP_BASE 0x4A081000
 #define OMAP_OTG_WRAPPER_BASE 0x488c
-#elif defined CONFIG_TARGET_AM57XX_EVM
+#elif CONFIG_USB_XHCI_DRA7XX_INDEX == 0
 #define OMAP_XHCI_BASE 0x4889
 #define OMAP_OCP1_SCP_BASE 0x4A084c00
 #define OMAP_OTG_WRAPPER_BASE 0x4888
+#endif /* CONFIG_USB_XHCI_DRA7XX_INDEX == 1 */
 #elif defined CONFIG_AM43XX
 #define OMAP_XHCI_BASE 0x483d
 #define OMAP_OCP1_SCP_BASE 0x483E8000
-- 
2.7.4

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


[U-Boot] [PATCH v4 1/7] arm: dra7xx: move CONFIG_DRA7XX to Kconfig

2017-02-23 Thread Uri Mashiach
The symbol CONFIG_DRA7XX is needed for Kconfig conditions.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
V2 -> V3: new commit
V3 -> V4: move the DRA7XX symbol introduction to 
arch/arm/mach-omap2/omap5/Kconfig

 arch/arm/mach-omap2/omap5/Kconfig | 8 
 include/configs/am57xx_evm.h  | 2 --
 include/configs/cl-som-am57x.h| 2 --
 include/configs/dra7xx_evm.h  | 2 --
 scripts/config_whitelist.txt  | 1 -
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/omap5/Kconfig 
b/arch/arm/mach-omap2/omap5/Kconfig
index c5edc7c..179e2b7 100644
--- a/arch/arm/mach-omap2/omap5/Kconfig
+++ b/arch/arm/mach-omap2/omap5/Kconfig
@@ -36,12 +36,18 @@ config SPL_SERIAL_SUPPORT
 config SPL_DISPLAY_PRINT
default y
 
+config DRA7XX
+   bool
+   help
+ DRA7xx is an OMAP based SOC with Dual Core A-15s.
+
 choice
prompt "OMAP5 board select"
optional
 
 config TARGET_CL_SOM_AM57X
bool "CompuLab CL-SOM-AM57x"
+   select DRA7XX
 
 config TARGET_CM_T54
bool "CompuLab CM-T54"
@@ -54,11 +60,13 @@ config TARGET_DRA7XX_EVM
select BOARD_LATE_INIT
select TI_I2C_BOARD_DETECT
select PHYS_64BIT
+   select DRA7XX
 
 config TARGET_AM57XX_EVM
bool "AM57XX"
select BOARD_LATE_INIT
select TI_I2C_BOARD_DETECT
+   select DRA7XX
 
 endchoice
 
diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index 3d8b996..42cd434 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -14,8 +14,6 @@
 
 #include 
 
-#define CONFIG_DRA7XX
-
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_IODELAY_RECALIBRATION
 #endif
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index e1f724b..c5f39ff 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -11,8 +11,6 @@
 #ifndef __CONFIG_CL_SOM_AM57X_H
 #define __CONFIG_CL_SOM_AM57X_H
 
-#define CONFIG_DRA7XX
-
 #define CONFIG_NR_DRAM_BANKS   2
 
 #define CONSOLEDEV "ttyO2"
diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index 549439e..beba851 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -14,8 +14,6 @@
 
 #include 
 
-#define CONFIG_DRA7XX
-
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_IODELAY_RECALIBRATION
 #endif
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index f6c9101..bbcdc41 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -805,7 +805,6 @@ CONFIG_DNP5370_EXT_WD_DISABLE
 CONFIG_DP_DDR_CTRL
 CONFIG_DP_DDR_DIMM_SLOTS_PER_CTLR
 CONFIG_DP_DDR_NUM_CTRLS
-CONFIG_DRA7XX
 CONFIG_DRAM_2G
 CONFIG_DRAM_TIMINGS_
 CONFIG_DRIVER_AT91EMAC
-- 
2.7.4

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


[U-Boot] [PATCH v4 3/7] usb: host: xhci-omap: fix double weak board_usb_init functions

2017-02-23 Thread Uri Mashiach
A weak version of the function board_usb_init is implemented in:
common/usb.c
drivers/usb/host/xhci-omap.c

To fix the double implementations:
* Convert the board_usb_init function in drivers/usb/host/xhci-omap.c
  normal (not weak).
* The function board_usb_init in drivers/usb/host/xhci-omap.c calls to
  the weak function omap_xhci_board_usb_init.
* Rename board version of the function board_usb_init to
  omap_xhci_board_usb_init.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

To achieve the same flexibility with the function board_usb_cleanup:
* Add a normal (not weak) implementation of the function
  board_usb_cleanup in drivers/usb/host/xhci-omap.c
* The function board_usb_cleanup in drivers/usb/host/xhci-omap.c calls
  to the weak function omap_xhci_board_usb_cleanup.
* Rename board version of the function board_usb_cleanup to
  omap_xhci_board_usb_cleanup.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Marek Vasut <ma...@denx.de>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V2: Use __weak instead of attribute block
V2 -> V4: none

 board/compulab/cl-som-am57x/cl-som-am57x.c |  2 +-
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 drivers/usb/host/xhci-omap.c   | 17 +++--
 5 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index bdd0a2b..fe1468f 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -54,7 +54,7 @@ int board_mmc_init(bd_t *bis)
 #endif /* CONFIG_GENERIC_MMC */
 
 #ifdef CONFIG_USB_XHCI_OMAP
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
 OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 390cc16..2572029 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -694,7 +694,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
 #ifdef CONFIG_USB_DWC3
@@ -725,7 +725,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 1611514..4afa914 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -618,7 +618,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -652,7 +652,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index bd1c809..65bce93 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -727,7 +727,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
.index = 1,
 };
 
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -764,7 +764,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
switch (index) {
case 0:
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index b881b19..a1b4f2f 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -27,12 +27,25 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct omap_xhci omap;
 
-__weak int __board_usb_init(int index, enum usb_init_type init)
+__weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
return 0;
 }
+
 int board_usb_init(int index, enum usb_init_type init)
-   __attribute__((weak, alias("__board_usb_init")));
+{
+   return omap_xhci_bo

[U-Boot] [PATCH v4 4/7] arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks

2017-02-23 Thread Uri Mashiach
Invoke enable_usb_clocks during board_usb_init and disable_usb_clocks
during board_usb_exit to enable and disable clocks respectively.

Modifications:
* Enable USB clocks in the OMAP version of the function
  board_usb_init.
* Disable USB clocks in the OMAP version of the function
  board_usb_cleanup.

Cc: Marek Vasut <ma...@denx.de>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Marek Vasut <ma...@denx.de>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V4: none

 board/compulab/cl-som-am57x/cl-som-am57x.c | 10 --
 drivers/usb/host/xhci-omap.c   |  2 ++
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index fe1468f..4701b71 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -53,16 +53,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif /* CONFIG_GENERIC_MMC */
 
-#ifdef CONFIG_USB_XHCI_OMAP
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
-{
-   setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
-OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
-
-   return 0;
-}
-#endif /* CONFIG_USB_XHCI_OMAP */
-
 int misc_init_r(void)
 {
cl_print_pcb_info();
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index a1b4f2f..d6c5744 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -29,6 +29,7 @@ static struct omap_xhci omap;
 
 __weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
+   enable_usb_clocks(index);
return 0;
 }
 
@@ -39,6 +40,7 @@ int board_usb_init(int index, enum usb_init_type init)
 
 __weak int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
+   disable_usb_clocks(index);
return 0;
 }
 
-- 
2.7.4

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


[U-Boot] [PATCH v4 0/7] am57xx: cl-som-am57x: fix usb

2017-02-23 Thread Uri Mashiach
Various USB related comits for the CL-SOM-AM57x module.

---
V1 -> V2: Replace commit "fix XHCI registers base address" with "reintroduce 
the CONFIG_AM57XX symbol".
V2 -> V3: * New commit "move CONFIG_DRA7XX to Kconfig"
  * Replace commit "reintroduce the CONFIG_AM57XX symbol" with "xHCI 
registers based on USB port index"
V3 -> V4: Update commit "move CONFIG_DRA7XX to Kconfig"
  Update commit "xHCI registers based on USB port index"

Uri Mashiach (7):
  arm: dra7xx: move CONFIG_DRA7XX to Kconfig
  arm: usb: dra7xx: xHCI registers based on USB port index
  usb: host: xhci-omap: fix double weak board_usb_init functions
  arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks
  arm: am57xx: cl-som-am57x: fix USB scan
  arm: am57xx: cl-som-am57x: enable USB storage
  arm: am57xx: cl-som-am57x: enable USB commands

 arch/arm/mach-omap2/omap5/Kconfig  |  8 
 board/compulab/cl-som-am57x/cl-som-am57x.c | 10 --
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 configs/cl-som-am57x_defconfig |  2 ++
 configs/dra7xx_evm_defconfig   |  1 +
 configs/dra7xx_hs_evm_defconfig|  1 +
 drivers/usb/host/Kconfig   |  9 +
 drivers/usb/host/xhci-omap.c   | 19 +--
 include/configs/am57xx_evm.h   |  2 --
 include/configs/cl-som-am57x.h |  6 ++
 include/configs/dra7xx_evm.h   |  2 --
 include/linux/usb/xhci-omap.h  |  6 --
 scripts/config_whitelist.txt   |  1 -
 15 files changed, 50 insertions(+), 29 deletions(-)

-- 
2.7.4

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


Re: [U-Boot] [PATCH v3 2/7] arm: usb: dra7xx: xHCI registers based on USB port index

2017-02-22 Thread Uri Mashiach



On 02/20/2017 10:28 AM, Marek Vasut wrote:

On 02/20/2017 08:47 AM, Igor Grinberg wrote:

Hey Marek,


Hi,


We haven't spoken for great while... I'm glad to hear from you!


yeah


On 02/19/17 19:39, Marek Vasut wrote:

On 02/19/2017 05:26 PM, Igor Grinberg wrote:

Hi guys,

On 02/19/17 17:15, Tom Rini wrote:

On Sun, Feb 19, 2017 at 04:13:02PM +0100, Marek Vasut wrote:

On 02/19/2017 03:55 PM, Uri Mashiach wrote:



On 02/19/2017 04:27 PM, Marek Vasut wrote:

On 02/19/2017 02:27 PM, Uri Mashiach wrote:

Modify the determination of the base address of xHCI registers of DRA7XX
targets.
Before the commit: by the target.
After the commit: by the USB port index.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Cc: Marek Vasut <ma...@denx.de>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
V1 -> V2: Replace the commit "fix XHCI registers base address".
V2 -> V3: Replace the commit "reintroduce the CONFIG_AM57XX symbol"

 configs/dra7xx_evm_defconfig|  1 +
 configs/dra7xx_hs_evm_defconfig |  1 +
 drivers/usb/host/Kconfig| 16 
 include/linux/usb/xhci-omap.h   |  6 --
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 26b26cc..1f47f92 100644


[...]


diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 5129a57..440fbcf 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -43,6 +43,22 @@ config USB_XHCI_ZYNQMP
 help
   Enables support for the on-chip xHCI controller on Xilinx
ZynqMP SoCs.

+choice
+prompt "DRA7XX xHCI USB index select"
+depends on DRA7XX
+
+config USB_XHCI_DRA7XX_INDEX0
+bool "USB0"
+help
+  DRA7XX xHCI USB0.
+
+config USB_XHCI_DRA7XX_INDEX1
+bool "USB1"
+help
+  DRA7XX xHCI USB1.


What is this all about ? Shouldn't this come from DT ? And what if I
want to use both XHCI ? This looks totally bogus ...


Right, both XHCIs cannot be used with current driver and we do not have
the time to fix it by our own... may be TI has?
Remember, you've accepted the driver and following patches, right?


You mean this patch [1] which actually adds the board dependency ?
Actually , no , I DID NOT. It's been going on for a while that my
role as a USB custodian was actively circumvented and patches which
should've gone through the USB tree just did not.


Ahh.. Sorry, thought you are collecting all the USB patches or at least
provide your Ack so patches can go through other trees..


So did I ...


So please, next time you start blaming someone, get your facts right.


Yeah, I haven't looked at it thoroughly... That's why the "right?" in the
end of my sentence. Sorry once again, I did not mean to offend you.



I already have almost zero motivation to maintain USB in my free time,
being paid nothing for it, not ever hearing a single "thank you" and
just spending time I could use otherwise. Being circumvented and only
catching shit for problematic patches I did NOT even apply though, that
is completely off-putting .


Ah... First of all thank you Marek! You've done a great job AFAIR.
I really mean it.
And it is a pity, things have gone this way.
May be this can still be fixed? Tom?


I already had a long discussion with Tom yesterday ... so let's see .


[1] https://patchwork.ozlabs.org/patch/700372/


Regarding DT, do we have a DT as a requirement to run USB in U-Boot?


It is highly recommended.


Hmmm... I don't really like this approach as it does not help during the board
production, where I'd like to see the bootloader detect as much a it can
during runtime and then flash the board with correct DT...


You can enable all during production, plug USB sticks into every port,
check which controllers detect devices and then only keep those enabled
via the "status" DT prop. As a bonus, you get functional test.

Does the OMAP5 not use DT yet ?


I don't remember this happening and I think it shouldn't be a requirement.





The support for both XHCI is currently missing.
This could be a temporary solution until the DT solution.
The current situation is worse - selecting USB0 or USB1 based on the
target.


So we're replacing it with equally bad solution ?


I don't think equally applies here...
This IS an improvement. Of course it is not like you would want it to be,
but still it is from a platform POV.


TBH, revering 042fdb7cabb8270eb86c45f11263fa91c12e3b65 might be the way
to go.


Ok. I'm fine with this approach.
I'm also fine with if the driver gets fixed and both XHCI instances can be used.


Someone would have to put that effort in.

I wonder if instead of defining INDEX0, INDEX1 ... this could be turned
into integer ...



Something like the following?

#ifdef CONFIG_DRA7XX
#if CONFIG_USB_XHCI_DRA7XX_INDEX == 1
...
#elif CONFIG_USB_XHCI_DRA7XX_INDEX == 0
...
#endif /* CONFIG_USB_XHCI_DRA7XX_INDEX == 1 */

Re: [U-Boot] [PATCH v3 1/7] arm: dra7xx: move CONFIG_DRA7XX to Kconfig

2017-02-20 Thread Uri Mashiach



On 02/19/2017 05:15 PM, Tom Rini wrote:

On Sun, Feb 19, 2017 at 03:27:13PM +0200, Uri Mashiach wrote:


The symbol CONFIG_DRA7XX is needed for Kconfig conditions.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
V3 -> V2: new commit

 board/compulab/cl-som-am57x/Kconfig | 4 
 board/ti/am57xx/Kconfig | 4 
 board/ti/dra7xx/Kconfig | 4 
 include/configs/am57xx_evm.h| 2 --
 include/configs/cl-som-am57x.h  | 2 --
 include/configs/dra7xx_evm.h| 2 --
 scripts/config_whitelist.txt| 1 -
 7 files changed, 12 insertions(+), 7 deletions(-)


We need to introduce the symbol in arch/arm/mach-omap2/omap5/Kconfig and
then select it under the appropriate boards.  Thanks!



Maybe instead of selecting it under the appropriate board it can be 
defaulted to yes in the board's Kconfig?


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


Re: [U-Boot] [PATCH v3 2/7] arm: usb: dra7xx: xHCI registers based on USB port index

2017-02-20 Thread Uri Mashiach



On 02/19/2017 04:27 PM, Marek Vasut wrote:

On 02/19/2017 02:27 PM, Uri Mashiach wrote:

Modify the determination of the base address of xHCI registers of DRA7XX
targets.
Before the commit: by the target.
After the commit: by the USB port index.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Cc: Marek Vasut <ma...@denx.de>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
V1 -> V2: Replace the commit "fix XHCI registers base address".
V2 -> V3: Replace the commit "reintroduce the CONFIG_AM57XX symbol"

 configs/dra7xx_evm_defconfig|  1 +
 configs/dra7xx_hs_evm_defconfig |  1 +
 drivers/usb/host/Kconfig| 16 
 include/linux/usb/xhci-omap.h   |  6 --
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 26b26cc..1f47f92 100644


[...]


diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 5129a57..440fbcf 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -43,6 +43,22 @@ config USB_XHCI_ZYNQMP
help
  Enables support for the on-chip xHCI controller on Xilinx ZynqMP SoCs.

+choice
+   prompt "DRA7XX xHCI USB index select"
+   depends on DRA7XX
+
+config USB_XHCI_DRA7XX_INDEX0
+   bool "USB0"
+   help
+ DRA7XX xHCI USB0.
+
+config USB_XHCI_DRA7XX_INDEX1
+   bool "USB1"
+   help
+ DRA7XX xHCI USB1.


What is this all about ? Shouldn't this come from DT ? And what if I
want to use both XHCI ? This looks totally bogus ...



The support for both XHCI is currently missing.
This could be a temporary solution until the DT solution.
The current situation is worse - selecting USB0 or USB1 based on the target.


+endchoice
+
 endif # USB_XHCI_HCD

 config USB_EHCI_HCD
diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h
index 9de80d7..3f65a76 100644
--- a/include/linux/usb/xhci-omap.h
+++ b/include/linux/usb/xhci-omap.h
@@ -10,14 +10,16 @@
 #ifndef _ASM_ARCH_XHCI_OMAP_H_


[...]


 #define OMAP_OCP1_SCP_BASE 0x483E8000






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


[U-Boot] [PATCH v3 7/7] arm: am57xx: cl-som-am57x: enable USB commands

2017-02-20 Thread Uri Mashiach
Add CONFIG_CMD_USB to the defconfig file.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V3: none

 configs/cl-som-am57x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index 1831f45..83d7bd0 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_PART=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_I2C=y
+CONFIG_CMD_USB=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 5/7] arm: am57xx: cl-som-am57x: fix USB scan

2017-02-20 Thread Uri Mashiach
USB bus scan attempt:
--cut--
=> usb start
starting USB...
USB0:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... data abort
pc : []  lr : []
reloc pc : [<8081b40e>]lr : [<8081b3b3>]
sp : fdf42930  ip : fdf42960 fp : 
r10: 0001  r9 : fdf42ef0 r8 : 48890020
r7 : 0002  r6 : fffa5840 r5 : fff8b140  r4 : fdf429c0
r3 :   r2 : 0004 r1 :   r0 : 
Flags: nZcv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
--cut--

Fix by enabling USB configuration in the SPL.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
Reviewed-by: Igor Grinberg <grinb...@compulab.co.il>
---
V1 -> V3: none

 include/configs/cl-som-am57x.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index c5f39ff..3418005 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -83,6 +83,8 @@
 #define CONFIG_SYS_I2C_PCA953X_ADDR 0x20
 #define CONFIG_SYS_I2C_PCA953X_WIDTH{ {0x20, 16} }
 
+#endif /* !CONFIG_SPL_BUILD */
+
 /* USB xHCI HOST */
 #define CONFIG_USB_XHCI_OMAP
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
@@ -97,8 +99,6 @@
 #define CONFIG_USB_ETHER_ASIX
 #define CONFIG_USB_ETHER_MCS7830
 
-#endif /* !CONFIG_SPL_BUILD */
-
 /* CPSW Ethernet */
 #define CONFIG_DRIVER_TI_CPSW
 #define CONFIG_MII
-- 
2.7.4

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


[U-Boot] [PATCH v3 6/7] arm: am57xx: cl-som-am57x: enable USB storage

2017-02-20 Thread Uri Mashiach
Add CONFIG_USB_STORAGE to the defconfig file.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V3: none

 configs/cl-som-am57x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index 916b836..1831f45 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -47,4 +47,5 @@ CONFIG_TI_QSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_STORAGE=y
 CONFIG_OF_LIBFDT=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 4/7] arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks

2017-02-20 Thread Uri Mashiach
Invoke enable_usb_clocks during board_usb_init and disable_usb_clocks
during board_usb_exit to enable and disable clocks respectively.

Modifications:
* Enable USB clocks in the OMAP version of the function
  board_usb_init.
* Disable USB clocks in the OMAP version of the function
  board_usb_cleanup.

Cc: Marek Vasut <ma...@denx.de>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Marek Vasut <ma...@denx.de>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V3: none

 board/compulab/cl-som-am57x/cl-som-am57x.c | 10 --
 drivers/usb/host/xhci-omap.c   |  2 ++
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index fe1468f..4701b71 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -53,16 +53,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif /* CONFIG_GENERIC_MMC */
 
-#ifdef CONFIG_USB_XHCI_OMAP
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
-{
-   setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
-OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
-
-   return 0;
-}
-#endif /* CONFIG_USB_XHCI_OMAP */
-
 int misc_init_r(void)
 {
cl_print_pcb_info();
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index a1b4f2f..d6c5744 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -29,6 +29,7 @@ static struct omap_xhci omap;
 
 __weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
+   enable_usb_clocks(index);
return 0;
 }
 
@@ -39,6 +40,7 @@ int board_usb_init(int index, enum usb_init_type init)
 
 __weak int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
+   disable_usb_clocks(index);
return 0;
 }
 
-- 
2.7.4

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


[U-Boot] [PATCH v3 3/7] usb: host: xhci-omap: fix double weak board_usb_init functions

2017-02-20 Thread Uri Mashiach
A weak version of the function board_usb_init is implemented in:
common/usb.c
drivers/usb/host/xhci-omap.c

To fix the double implementations:
* Convert the board_usb_init function in drivers/usb/host/xhci-omap.c
  normal (not weak).
* The function board_usb_init in drivers/usb/host/xhci-omap.c calls to
  the weak function omap_xhci_board_usb_init.
* Rename board version of the function board_usb_init to
  omap_xhci_board_usb_init.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

To achieve the same flexibility with the function board_usb_cleanup:
* Add a normal (not weak) implementation of the function
  board_usb_cleanup in drivers/usb/host/xhci-omap.c
* The function board_usb_cleanup in drivers/usb/host/xhci-omap.c calls
  to the weak function omap_xhci_board_usb_cleanup.
* Rename board version of the function board_usb_cleanup to
  omap_xhci_board_usb_cleanup.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Marek Vasut <ma...@denx.de>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V2: Use __weak instead of attribute block
V2 -> V3: none

 board/compulab/cl-som-am57x/cl-som-am57x.c |  2 +-
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 drivers/usb/host/xhci-omap.c   | 17 +++--
 5 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index bdd0a2b..fe1468f 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -54,7 +54,7 @@ int board_mmc_init(bd_t *bis)
 #endif /* CONFIG_GENERIC_MMC */
 
 #ifdef CONFIG_USB_XHCI_OMAP
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
 OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 390cc16..2572029 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -694,7 +694,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
 #ifdef CONFIG_USB_DWC3
@@ -725,7 +725,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 5f2d4df..96fad0f 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -616,7 +616,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -650,7 +650,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index bd1c809..65bce93 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -727,7 +727,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
.index = 1,
 };
 
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -764,7 +764,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
switch (index) {
case 0:
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index b881b19..a1b4f2f 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -27,12 +27,25 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct omap_xhci omap;
 
-__weak int __board_usb_init(int index, enum usb_init_type init)
+__weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
return 0;
 }
+
 int board_usb_init(int index, enum usb_init_type init)
-   __attribute__((weak, alias("__board_usb_init")));
+{
+   return omap_xhci_bo

[U-Boot] [PATCH v3 2/7] arm: usb: dra7xx: xHCI registers based on USB port index

2017-02-20 Thread Uri Mashiach
Modify the determination of the base address of xHCI registers of DRA7XX
targets.
Before the commit: by the target.
After the commit: by the USB port index.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Cc: Marek Vasut <ma...@denx.de>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
V1 -> V2: Replace the commit "fix XHCI registers base address".
V2 -> V3: Replace the commit "reintroduce the CONFIG_AM57XX symbol"

 configs/dra7xx_evm_defconfig|  1 +
 configs/dra7xx_hs_evm_defconfig |  1 +
 drivers/usb/host/Kconfig| 16 
 include/linux/usb/xhci-omap.h   |  6 --
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 26b26cc..1f47f92 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -86,6 +86,7 @@ CONFIG_OMAP_TIMER=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_XHCI_DRA7XX_INDEX1=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GADGET=y
 CONFIG_USB_DWC3_OMAP=y
diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig
index 244940c..5addd3e 100644
--- a/configs/dra7xx_hs_evm_defconfig
+++ b/configs/dra7xx_hs_evm_defconfig
@@ -91,6 +91,7 @@ CONFIG_OMAP_TIMER=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_XHCI_DRA7XX_INDEX1=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GADGET=y
 CONFIG_USB_DWC3_OMAP=y
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 5129a57..440fbcf 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -43,6 +43,22 @@ config USB_XHCI_ZYNQMP
help
  Enables support for the on-chip xHCI controller on Xilinx ZynqMP SoCs.
 
+choice
+   prompt "DRA7XX xHCI USB index select"
+   depends on DRA7XX
+
+config USB_XHCI_DRA7XX_INDEX0
+   bool "USB0"
+   help
+ DRA7XX xHCI USB0.
+
+config USB_XHCI_DRA7XX_INDEX1
+   bool "USB1"
+   help
+ DRA7XX xHCI USB1.
+
+endchoice
+
 endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h
index 9de80d7..3f65a76 100644
--- a/include/linux/usb/xhci-omap.h
+++ b/include/linux/usb/xhci-omap.h
@@ -10,14 +10,16 @@
 #ifndef _ASM_ARCH_XHCI_OMAP_H_
 #define _ASM_ARCH_XHCI_OMAP_H_
 
-#ifdef CONFIG_TARGET_DRA7XX_EVM
+#ifdef CONFIG_DRA7XX
+#ifdef CONFIG_USB_XHCI_DRA7XX_INDEX1
 #define OMAP_XHCI_BASE 0x488d
 #define OMAP_OCP1_SCP_BASE 0x4A081000
 #define OMAP_OTG_WRAPPER_BASE 0x488c
-#elif defined CONFIG_TARGET_AM57XX_EVM
+#elif defined CONFIG_USB_XHCI_DRA7XX_INDEX0
 #define OMAP_XHCI_BASE 0x4889
 #define OMAP_OCP1_SCP_BASE 0x4A084c00
 #define OMAP_OTG_WRAPPER_BASE 0x4888
+#endif /* CONFIG_USB_XHCI_DRA7XX_INDEX1 */
 #elif defined CONFIG_AM43XX
 #define OMAP_XHCI_BASE 0x483d
 #define OMAP_OCP1_SCP_BASE 0x483E8000
-- 
2.7.4

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


[U-Boot] [PATCH v3 1/7] arm: dra7xx: move CONFIG_DRA7XX to Kconfig

2017-02-20 Thread Uri Mashiach
The symbol CONFIG_DRA7XX is needed for Kconfig conditions.

Cc: Lokesh Vutla <lokeshvu...@ti.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
V3 -> V2: new commit

 board/compulab/cl-som-am57x/Kconfig | 4 
 board/ti/am57xx/Kconfig | 4 
 board/ti/dra7xx/Kconfig | 4 
 include/configs/am57xx_evm.h| 2 --
 include/configs/cl-som-am57x.h  | 2 --
 include/configs/dra7xx_evm.h| 2 --
 scripts/config_whitelist.txt| 1 -
 7 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/board/compulab/cl-som-am57x/Kconfig 
b/board/compulab/cl-som-am57x/Kconfig
index 85fc9a1..6d9ddc0 100644
--- a/board/compulab/cl-som-am57x/Kconfig
+++ b/board/compulab/cl-som-am57x/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "cl-som-am57x"
 
+config DRA7XX
+   bool
+   default y
+
 endif
diff --git a/board/ti/am57xx/Kconfig b/board/ti/am57xx/Kconfig
index cead0f4..e70bcee 100644
--- a/board/ti/am57xx/Kconfig
+++ b/board/ti/am57xx/Kconfig
@@ -18,6 +18,10 @@ config CONS_INDEX
   Depending on your specific board you may want something other than 
UART3
   here.
 
+config DRA7XX
+   bool
+   default y
+
 source "board/ti/common/Kconfig"
 
 endif
diff --git a/board/ti/dra7xx/Kconfig b/board/ti/dra7xx/Kconfig
index b642113..bec3f1e 100644
--- a/board/ti/dra7xx/Kconfig
+++ b/board/ti/dra7xx/Kconfig
@@ -18,6 +18,10 @@ config CONS_INDEX
  Depending on your specific board you may want something other than 
UART1
  here.
 
+config DRA7XX
+   bool
+   default y
+
 source "board/ti/common/Kconfig"
 
 endif
diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index 3d8b996..42cd434 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -14,8 +14,6 @@
 
 #include 
 
-#define CONFIG_DRA7XX
-
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_IODELAY_RECALIBRATION
 #endif
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index e1f724b..c5f39ff 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -11,8 +11,6 @@
 #ifndef __CONFIG_CL_SOM_AM57X_H
 #define __CONFIG_CL_SOM_AM57X_H
 
-#define CONFIG_DRA7XX
-
 #define CONFIG_NR_DRAM_BANKS   2
 
 #define CONSOLEDEV "ttyO2"
diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index bf8c041..3c7bdef 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -14,8 +14,6 @@
 
 #include 
 
-#define CONFIG_DRA7XX
-
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_IODELAY_RECALIBRATION
 #endif
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index d21589b..7f5b3c7 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -806,7 +806,6 @@ CONFIG_DNP5370_EXT_WD_DISABLE
 CONFIG_DP_DDR_CTRL
 CONFIG_DP_DDR_DIMM_SLOTS_PER_CTLR
 CONFIG_DP_DDR_NUM_CTRLS
-CONFIG_DRA7XX
 CONFIG_DRAM_2G
 CONFIG_DRAM_TIMINGS_
 CONFIG_DRIVER_AT91EMAC
-- 
2.7.4

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


[U-Boot] [PATCH v3 0/7] am57xx: cl-som-am57x: fix usb

2017-02-20 Thread Uri Mashiach
Various USB related comits for the CL-SOM-AM57x module.

---
V1 -> V2: Replace commit "fix XHCI registers base address" with "reintroduce 
the CONFIG_AM57XX symbol".
V2 -> V3: * New commit "move CONFIG_DRA7XX to Kconfig"
  * Replace commit "reintroduce the CONFIG_AM57XX symbol" with "xHCI 
registers based on USB port index"

Uri Mashiach (7):
  arm: dra7xx: move CONFIG_DRA7XX to Kconfig
  arm: usb: dra7xx: xHCI registers based on USB port index
  usb: host: xhci-omap: fix double weak board_usb_init functions
  arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks
  arm: am57xx: cl-som-am57x: fix USB scan
  arm: am57xx: cl-som-am57x: enable USB storage
  arm: am57xx: cl-som-am57x: enable USB commands

 board/compulab/cl-som-am57x/Kconfig|  4 
 board/compulab/cl-som-am57x/cl-som-am57x.c | 10 --
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/Kconfig|  4 
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/Kconfig|  4 
 board/ti/dra7xx/evm.c  |  4 ++--
 configs/cl-som-am57x_defconfig |  2 ++
 configs/dra7xx_evm_defconfig   |  1 +
 configs/dra7xx_hs_evm_defconfig|  1 +
 drivers/usb/host/Kconfig   | 16 
 drivers/usb/host/xhci-omap.c   | 19 +--
 include/configs/am57xx_evm.h   |  2 --
 include/configs/cl-som-am57x.h |  6 ++
 include/configs/dra7xx_evm.h   |  2 --
 include/linux/usb/xhci-omap.h  |  6 --
 scripts/config_whitelist.txt   |  1 -
 17 files changed, 61 insertions(+), 29 deletions(-)

-- 
2.7.4

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


Re: [U-Boot] [PATCH v2 1/6] arm: am57xx: reintroduce the CONFIG_AM57XX symbol

2017-02-15 Thread Uri Mashiach



On 02/15/2017 01:30 PM, Roger Quadros wrote:

On 15/02/17 10:24, Roger Quadros wrote:

On 14/02/17 22:12, Tom Rini wrote:

On Tue, Feb 14, 2017 at 01:26:24PM -0600, Nishanth Menon wrote:

On 02/14/2017 01:20 PM, Tom Rini wrote:

On Tue, Feb 14, 2017 at 01:18:20PM -0600, menon.nisha...@gmail.com wrote:

On Mon, Feb 13, 2017 at 7:27 AM, Tom Rini <tr...@konsulko.com> wrote:

On Mon, Feb 13, 2017 at 01:34:52PM +0200, Uri Mashiach wrote:


The SOC family symbol CONFIG_AM57XX was removed by the commit
3891a54: "ARM: DRA7x/AM57xx: Get rid of CONFIG_AM57XX".

The symbol is needed by the XHCI OMAP USB driver.
Without the symbol all the AM57x targets symbols should be ored in the
ifdef'ery.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>


We need to introduce it into Kconfig files now, thanks!


DRA7 and AM57xx are literally the same. the #ifdeffery in USB is more
to do which port to use rather than having anything to do with DRA7 Vs
AM57xx.


Yes, agreed.  And we need to solve this, and introduce some Kconfig
CONFIG symbol to deal with it.  Maybe the better way to look at this is,
can we have DRA7xx boards configured in the way Uri wants to be able to
configure the AM57xx board he's working with? And vice versa?  The
answer to that will help drive what the right CONFIG_xxx name is.


Should'nt be ideally done via DM model instead? I have no
understanding of USB integration done in u-boot to comment better.


That's also something that could be explored.



Yes, ideally this should be taken care of by DM.
Till that migration is complete I'm fine with fixing this temporarily.

OMAP5, DRA7, AM57 and AM43 use different XHCI_BASE address.


Just to clarify further on this
DRA7 and AM57 are identical SoCs but the EVMs are using different
instances of the USB as host so the difference in XHCI_BASE.

DRA7-evm uses USB1 instance whereas AM57x-EVM uses USB0 instance as host.


Alternative solution:
* Definition of registers base groups for USB0 and USB1.
* Target based definition of XHCI_USB0 or XHCI_USB1.
* Selection of register base group based on the definition of XHCI_USB0 
or XHCI_USB1.

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


Re: [U-Boot] [PATCH 1/6] arm: am57xx: cl-som-am57x: fix XHCI registers base address

2017-02-14 Thread Uri Mashiach



On 02/13/2017 02:33 PM, Lokesh Vutla wrote:



On Monday 13 February 2017 05:42 PM, Uri Mashiach wrote:



On 02/13/2017 01:46 PM, Lokesh Vutla wrote:



On Sunday 12 February 2017 09:17 PM, Tom Rini wrote:

On Sun, Feb 12, 2017 at 10:55:27AM +0200, Uri Mashiach wrote:

Hi Tom,

On 02/09/2017 10:29 PM, Tom Rini wrote:

On Thu, Feb 09, 2017 at 09:00:26AM +0200, Uri Mashiach wrote:


The following XHCI registers base address are set to OMAP5 values:
OMAP_XHCI_BASE, OMAP_OCP1_SCP_BASE, OMAP_OTG_WRAPPER_BASE

Captured crash for "usb start" command:
--cut--

=> usb start
starting USB...
USB0:   data abort
pc : []  lr : []
reloc pc : [<8081cd22>]lr : [<8081cb63>]
sp : fdf42d08  ip : fff9e040 fp : fdf42d50
r10: fff8a998  r9 : fdf42ef0 r8 : 
r7 : fdf42d28  r6 : fdf42d2c r5 : fffa5c00  r4 : 
r3 : 4a02  r2 :  r1 : fdf42e78  r0 : fffa5c00
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
--cut--


Fix by adding the CL-SOM-AM57x target to the XHCI registers base
address
ifdef'ery.
A better fix should be based on a SOC family defines (currently
missing).


Can you please go add the Kconfig symbols that would be the better
solution please?  Thanks!


The SOC family symbol CONFIG_AM57XX was removed by the commit
3891a54: "ARM: DRA7x/AM57xx: Get rid of CONFIG_AM57XX".
Maybe the symbol should be reintroduced just for the XHCI registers
section?


Yes, sounds like we do have a case where DRA7xx is not the same as
AM57xx then?



No that's not right. It is just DRA74x_EVM and AM57XX evm is using
different instances of XHCI. Ideally this base address should be coming
from DT. I don't think it is a good idea to introduce CONFIG_AM57XX.

Thanks and regards,
Lokesh


It seems that the address of register is SOC dependent.
In the current method all the target boards that use the relevant SOC
should be included in the ifdef'ery - redundant maintenance.


Please have a look at the TRMs. DRA7xx[1], AM57xx[2]. Both has the above
two instances of XHCI. There is no difference.

[1] http://www.ti.com/lit/ug/sprui30b/sprui30b.pdf
[2] http://www.ti.com/lit/ug/spruhz6h/spruhz6h.pdf

Thanks and regards,
Lokesh

The fact that the two SOCs share the same registers base doesn't 
contradict the approach of selecting the registers based on the SOC.


I agree that the resolution should be higher. The exact SOC id 
(CONFIG_AM572X, CONFIG_DRA74X, CONFIG_DRA75X...) should be determined by 
the target selection - board file or Kconfig.


The ifdef'ery should include the exact SOCs id. According to the 
provided TRMs, CONFIG_AM572X and CONFIG_DRA74X will be located in the 
same ifdef'ery case.

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


Re: [U-Boot] [PATCH 1/6] arm: am57xx: cl-som-am57x: fix XHCI registers base address

2017-02-13 Thread Uri Mashiach



On 02/13/2017 01:46 PM, Lokesh Vutla wrote:



On Sunday 12 February 2017 09:17 PM, Tom Rini wrote:

On Sun, Feb 12, 2017 at 10:55:27AM +0200, Uri Mashiach wrote:

Hi Tom,

On 02/09/2017 10:29 PM, Tom Rini wrote:

On Thu, Feb 09, 2017 at 09:00:26AM +0200, Uri Mashiach wrote:


The following XHCI registers base address are set to OMAP5 values:
OMAP_XHCI_BASE, OMAP_OCP1_SCP_BASE, OMAP_OTG_WRAPPER_BASE

Captured crash for "usb start" command:
--cut--
=> usb start
starting USB...
USB0:   data abort
pc : []  lr : []
reloc pc : [<8081cd22>]lr : [<8081cb63>]
sp : fdf42d08  ip : fff9e040 fp : fdf42d50
r10: fff8a998  r9 : fdf42ef0 r8 : 
r7 : fdf42d28  r6 : fdf42d2c r5 : fffa5c00  r4 : 
r3 : 4a02  r2 :  r1 : fdf42e78  r0 : fffa5c00
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
--cut--

Fix by adding the CL-SOM-AM57x target to the XHCI registers base address
ifdef'ery.
A better fix should be based on a SOC family defines (currently
missing).


Can you please go add the Kconfig symbols that would be the better
solution please?  Thanks!


The SOC family symbol CONFIG_AM57XX was removed by the commit
3891a54: "ARM: DRA7x/AM57xx: Get rid of CONFIG_AM57XX".
Maybe the symbol should be reintroduced just for the XHCI registers
section?


Yes, sounds like we do have a case where DRA7xx is not the same as
AM57xx then?



No that's not right. It is just DRA74x_EVM and AM57XX evm is using
different instances of XHCI. Ideally this base address should be coming
from DT. I don't think it is a good idea to introduce CONFIG_AM57XX.

Thanks and regards,
Lokesh


It seems that the address of register is SOC dependent.
In the current method all the target boards that use the relevant SOC 
should be included in the ifdef'ery - redundant maintenance.


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


[U-Boot] [PATCH v2 6/6] arm: am57xx: cl-som-am57x: enable USB commands

2017-02-13 Thread Uri Mashiach
Add CONFIG_CMD_USB to the defconfig file.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V2: none

 configs/cl-som-am57x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index 1831f45..83d7bd0 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_PART=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_I2C=y
+CONFIG_CMD_USB=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
-- 
2.7.4

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


[U-Boot] [PATCH v2 5/6] arm: am57xx: cl-som-am57x: enable USB storage

2017-02-13 Thread Uri Mashiach
Add CONFIG_USB_STORAGE to the defconfig file.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
 V1 -> V2: none

configs/cl-som-am57x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index 916b836..1831f45 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -47,4 +47,5 @@ CONFIG_TI_QSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_STORAGE=y
 CONFIG_OF_LIBFDT=y
-- 
2.7.4

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


[U-Boot] [PATCH v2 4/6] arm: am57xx: cl-som-am57x: fix USB scan

2017-02-13 Thread Uri Mashiach
USB bus scan attempt:
--cut--
=> usb start
starting USB...
USB0:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... data abort
pc : []  lr : []
reloc pc : [<8081b40e>]lr : [<8081b3b3>]
sp : fdf42930  ip : fdf42960 fp : 
r10: 0001  r9 : fdf42ef0 r8 : 48890020
r7 : 0002  r6 : fffa5840 r5 : fff8b140  r4 : fdf429c0
r3 :   r2 : 0004 r1 :   r0 : 
Flags: nZcv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
--cut--

Fix by enabling USB configuration in the SPL.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
Reviewed-by: Igor Grinberg <grinb...@compulab.co.il>
---
V1 -> V2: none

 include/configs/cl-som-am57x.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index 4d1ceff..ebc7d67 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -86,6 +86,8 @@
 #define CONFIG_SYS_I2C_PCA953X_ADDR 0x20
 #define CONFIG_SYS_I2C_PCA953X_WIDTH{ {0x20, 16} }
 
+#endif /* !CONFIG_SPL_BUILD */
+
 /* USB xHCI HOST */
 #define CONFIG_USB_XHCI_OMAP
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
@@ -100,8 +102,6 @@
 #define CONFIG_USB_ETHER_ASIX
 #define CONFIG_USB_ETHER_MCS7830
 
-#endif /* !CONFIG_SPL_BUILD */
-
 /* CPSW Ethernet */
 #define CONFIG_DRIVER_TI_CPSW
 #define CONFIG_MII
-- 
2.7.4

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


[U-Boot] [PATCH v2 3/6] arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks

2017-02-13 Thread Uri Mashiach
Invoke enable_usb_clocks during board_usb_init and disable_usb_clocks
during board_usb_exit to enable and disable clocks respectively.

Modifications:
* Enable USB clocks in the OMAP version of the function
  board_usb_init.
* Disable USB clocks in the OMAP version of the function
  board_usb_cleanup.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Reviewed-by: Marek Vasut <ma...@denx.de>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
V1 -> V2: none

 board/compulab/cl-som-am57x/cl-som-am57x.c | 10 --
 drivers/usb/host/xhci-omap.c   |  2 ++
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index fe1468f..4701b71 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -53,16 +53,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif /* CONFIG_GENERIC_MMC */
 
-#ifdef CONFIG_USB_XHCI_OMAP
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
-{
-   setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
-OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
-
-   return 0;
-}
-#endif /* CONFIG_USB_XHCI_OMAP */
-
 int misc_init_r(void)
 {
cl_print_pcb_info();
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index a1b4f2f..d6c5744 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -29,6 +29,7 @@ static struct omap_xhci omap;
 
 __weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
+   enable_usb_clocks(index);
return 0;
 }
 
@@ -39,6 +40,7 @@ int board_usb_init(int index, enum usb_init_type init)
 
 __weak int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
+   disable_usb_clocks(index);
return 0;
 }
 
-- 
2.7.4

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


[U-Boot] [PATCH v2 2/6] usb: host: xhci-omap: fix double weak board_usb_init functions

2017-02-13 Thread Uri Mashiach
A weak version of the function board_usb_init is implemented in:
common/usb.c
drivers/usb/host/xhci-omap.c

To fix the double implementations:
* Convert the board_usb_init function in drivers/usb/host/xhci-omap.c
  normal (not weak).
* The function board_usb_init in drivers/usb/host/xhci-omap.c calls to
  the weak function omap_xhci_board_usb_init.
* Rename board version of the function board_usb_init to
  omap_xhci_board_usb_init.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

To achieve the same flexibility with the function board_usb_cleanup:
* Add a normal (not weak) implementation of the function
  board_usb_cleanup in drivers/usb/host/xhci-omap.c
* The function board_usb_cleanup in drivers/usb/host/xhci-omap.c calls
  to the weak function omap_xhci_board_usb_cleanup.
* Rename board version of the function board_usb_cleanup to
  omap_xhci_board_usb_cleanup.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
V1 -> V2: Use __weak instead of attribute block

 board/compulab/cl-som-am57x/cl-som-am57x.c |  2 +-
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 drivers/usb/host/xhci-omap.c   | 17 +++--
 5 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index bdd0a2b..fe1468f 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -54,7 +54,7 @@ int board_mmc_init(bd_t *bis)
 #endif /* CONFIG_GENERIC_MMC */
 
 #ifdef CONFIG_USB_XHCI_OMAP
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
 OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 390cc16..2572029 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -694,7 +694,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
 #ifdef CONFIG_USB_DWC3
@@ -725,7 +725,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 5f2d4df..96fad0f 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -616,7 +616,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -650,7 +650,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index bd1c809..21fa824 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -727,7 +727,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
.index = 1,
 };
 
-int board_usb_init(int index, enum usb_init_type init)
+int  omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -764,7 +764,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
switch (index) {
case 0:
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index b881b19..a1b4f2f 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -27,12 +27,25 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct omap_xhci omap;
 
-__weak int __board_usb_init(int index, enum usb_init_type init)
+__weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
return 0;
 }
+
 int board_usb_init(int index, enum usb_init_type init)
-   __attribute__((weak, alias("__board_usb_init")));
+{
+   return omap_xhci_board_usb_init(index, init);
+}
+
+__weak int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
+{
+   return 0;
+}
+
+int board_usb_cleanup(int index, e

[U-Boot] [PATCH v2 1/6] arm: am57xx: reintroduce the CONFIG_AM57XX symbol

2017-02-13 Thread Uri Mashiach
The SOC family symbol CONFIG_AM57XX was removed by the commit
3891a54: "ARM: DRA7x/AM57xx: Get rid of CONFIG_AM57XX".

The symbol is needed by the XHCI OMAP USB driver.
Without the symbol all the AM57x targets symbols should be ored in the
ifdef'ery.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
V1 -> V2: Replace the commit "fix XHCI registers base address".

 include/configs/am57xx_evm.h   | 1 +
 include/configs/cl-som-am57x.h | 1 +
 include/linux/usb/xhci-omap.h  | 2 +-
 scripts/config_whitelist.txt   | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index 3d8b996..2896628 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -15,6 +15,7 @@
 #include 
 
 #define CONFIG_DRA7XX
+#define CONFIG_AM57XX
 
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_IODELAY_RECALIBRATION
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index e1f724b..4d1ceff 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -12,6 +12,7 @@
 #define __CONFIG_CL_SOM_AM57X_H
 
 #define CONFIG_DRA7XX
+#define CONFIG_AM57XX
 
 #define CONFIG_NR_DRAM_BANKS   2
 
diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h
index 9de80d7..ba21d60 100644
--- a/include/linux/usb/xhci-omap.h
+++ b/include/linux/usb/xhci-omap.h
@@ -14,7 +14,7 @@
 #define OMAP_XHCI_BASE 0x488d
 #define OMAP_OCP1_SCP_BASE 0x4A081000
 #define OMAP_OTG_WRAPPER_BASE 0x488c
-#elif defined CONFIG_TARGET_AM57XX_EVM
+#elif defined CONFIG_AM57XX
 #define OMAP_XHCI_BASE 0x4889
 #define OMAP_OCP1_SCP_BASE 0x4A084c00
 #define OMAP_OTG_WRAPPER_BASE 0x4888
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index d21589b..7c7f372 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -85,6 +85,7 @@ CONFIG_AM335X_USB0_MODE
 CONFIG_AM335X_USB1
 CONFIG_AM335X_USB1_MODE
 CONFIG_AM437X_USB2PHY2_HOST
+CONFIG_AM57XX
 CONFIG_AMBAPP_IOAREA
 CONFIG_AMCC_DEF_ENV
 CONFIG_AMCC_DEF_ENV_NOR_UPD
-- 
2.7.4

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


[U-Boot] [PATCH v2 0/6] arm: am57xx: cl-som-am57x: fix usb

2017-02-13 Thread Uri Mashiach
Various USB related comits for the CL-SOM-AM57x module.

---
V1 -> V2: Replace commit "fix XHCI registers base address" with "reintroduce 
the CONFIG_AM57XX symbol".

Uri Mashiach (6):
  arm: am57xx: reintroduce the CONFIG_AM57XX symbol
  usb: host: xhci-omap: fix double weak board_usb_init functions
  arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks
  arm: am57xx: cl-som-am57x: fix USB scan
  arm: am57xx: cl-som-am57x: enable USB storage
  arm: am57xx: cl-som-am57x: enable USB commands

 board/compulab/cl-som-am57x/cl-som-am57x.c | 10 --
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 configs/cl-som-am57x_defconfig |  2 ++
 drivers/usb/host/xhci-omap.c   | 19 +--
 include/configs/am57xx_evm.h   |  1 +
 include/configs/cl-som-am57x.h |  5 +++--
 include/linux/usb/xhci-omap.h  |  2 +-
 scripts/config_whitelist.txt   |  1 +
 10 files changed, 31 insertions(+), 21 deletions(-)

-- 
2.7.4

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


Re: [U-Boot] [PATCH 2/6] usb: host: xhci-omap: fix double weak board_usb_init functions

2017-02-12 Thread Uri Mashiach

Hi,

On 02/09/2017 05:27 PM, Tom Rini wrote:

On Thu, Feb 09, 2017 at 02:35:30PM +0100, Marek Vasut wrote:

On 02/09/2017 12:36 PM, Uri Mashiach wrote:

Hello Marek,



Hi!

[...]


diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index b881b19..ceee12a 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -27,12 +27,31 @@ DECLARE_GLOBAL_DATA_PTR;

 static struct omap_xhci omap;

-__weak int __board_usb_init(int index, enum usb_init_type init)
+__weak int __omap_xhci_board_usb_init(int index, enum usb_init_type
init)
 {
 return 0;
 }
+
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+__attribute__((weak, alias("__omap_xhci_board_usb_init")));


You can just use __weak instead of this attribute block .



With the attribute block it is possible to call to
__omap_xhci_board_usb_init from the board file.
Do you think it's redundant?


Yes, but feel free to prove me wrong, I'm not an omap expert.


This isn't an omap issue, it's a compiler issue.  IFF we need both
omap_xhci_board_usb_init and __omap_xhci_board_usb_init then we need the
above declaration as that provides both.  IFF we only need one function,
name it as needed and use __weak.  __weak just sets the weak attribute
(and __alias(foo) will just set the alias attribute).



Currently only the omap_xhci_board_usb_init function is needed.
I will go for the __weak instead of this attribute block in V2.

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


Re: [U-Boot] [PATCH 1/6] arm: am57xx: cl-som-am57x: fix XHCI registers base address

2017-02-12 Thread Uri Mashiach

Hi Tom,

On 02/09/2017 10:29 PM, Tom Rini wrote:

On Thu, Feb 09, 2017 at 09:00:26AM +0200, Uri Mashiach wrote:


The following XHCI registers base address are set to OMAP5 values:
OMAP_XHCI_BASE, OMAP_OCP1_SCP_BASE, OMAP_OTG_WRAPPER_BASE

Captured crash for "usb start" command:
--cut--
=> usb start
starting USB...
USB0:   data abort
pc : []  lr : []
reloc pc : [<8081cd22>]lr : [<8081cb63>]
sp : fdf42d08  ip : fff9e040 fp : fdf42d50
r10: fff8a998  r9 : fdf42ef0 r8 : 
r7 : fdf42d28  r6 : fdf42d2c r5 : fffa5c00  r4 : 
r3 : 4a02  r2 :  r1 : fdf42e78  r0 : fffa5c00
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
--cut--

Fix by adding the CL-SOM-AM57x target to the XHCI registers base address
ifdef'ery.
A better fix should be based on a SOC family defines (currently
missing).


Can you please go add the Kconfig symbols that would be the better
solution please?  Thanks!

The SOC family symbol CONFIG_AM57XX was removed by the commit 3891a54: 
"ARM: DRA7x/AM57xx: Get rid of CONFIG_AM57XX".
Maybe the symbol should be reintroduced just for the XHCI registers 
section?


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


Re: [U-Boot] [PATCH 2/6] usb: host: xhci-omap: fix double weak board_usb_init functions

2017-02-09 Thread Uri Mashiach

Hello Marek,

On 02/09/2017 10:35 AM, Marek Vasut wrote:

On 02/09/2017 08:01 AM, Uri Mashiach wrote:

A weak version of the function board_usb_init is implemented in:
common/usb.c
drivers/usb/host/xhci-omap.c

To fix the double implementations:
* Convert the board_usb_init function in drivers/usb/host/xhci-omap.c
  normal (not weak).
* The function board_usb_init in drivers/usb/host/xhci-omap.c calls to
  the weak function omap_xhci_board_usb_init.
* Rename board version of the function board_usb_init to
  omap_xhci_board_usb_init.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

To achieve the same flexibility with the function board_usb_cleanup:
* Add a normal (not weak) implementation of the function
  board_usb_cleanup in drivers/usb/host/xhci-omap.c
* The function board_usb_cleanup in drivers/usb/host/xhci-omap.c calls
  to the weak function omap_xhci_board_usb_cleanup.
* Rename board version of the function board_usb_cleanup to
  omap_xhci_board_usb_cleanup.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 board/compulab/cl-som-am57x/cl-som-am57x.c |  2 +-
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 drivers/usb/host/xhci-omap.c   | 23 +--
 5 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index bdd0a2b..fe1468f 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -54,7 +54,7 @@ int board_mmc_init(bd_t *bis)
 #endif /* CONFIG_GENERIC_MMC */

 #ifdef CONFIG_USB_XHCI_OMAP
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
 OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 390cc16..2572029 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -694,7 +694,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */

 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
 #ifdef CONFIG_USB_DWC3
@@ -725,7 +725,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }

-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 5f2d4df..96fad0f 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -616,7 +616,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */

 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -650,7 +650,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }

-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index bd1c809..21fa824 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -727,7 +727,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
.index = 1,
 };

-int board_usb_init(int index, enum usb_init_type init)
+int  omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -764,7 +764,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }

-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
switch (index) {
case 0:
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index b881b19..ceee12a 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -27,12 +27,31 @@ DECLARE_GLOBAL_DATA_PTR;

 static struct omap_xhci omap;

-__weak int __board_usb_init(int index, enum usb_init_type init)
+__weak int __omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
return 0;
 }
+
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+   __attribute__((weak, alias("__omap_xhci_board_usb_init")));


You can just use __weak instead of this attribute block .



With the attribute block it is possible to call to 
__omap_xhci_

[U-Boot] [PATCH 5/6] arm: am57xx: cl-som-am57x: enable USB storage

2017-02-08 Thread Uri Mashiach
Add CONFIG_USB_STORAGE to the defconfig file.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 configs/cl-som-am57x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index 916b836..1831f45 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -47,4 +47,5 @@ CONFIG_TI_QSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_STORAGE=y
 CONFIG_OF_LIBFDT=y
-- 
2.7.4

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


[U-Boot] [PATCH 6/6] arm: am57xx: cl-som-am57x: enable USB commands

2017-02-08 Thread Uri Mashiach
Add CONFIG_CMD_USB to the defconfig file.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 configs/cl-som-am57x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cl-som-am57x_defconfig b/configs/cl-som-am57x_defconfig
index 1831f45..83d7bd0 100644
--- a/configs/cl-som-am57x_defconfig
+++ b/configs/cl-som-am57x_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_PART=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_I2C=y
+CONFIG_CMD_USB=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
-- 
2.7.4

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


[U-Boot] [PATCH 4/6] arm: am57xx: cl-som-am57x: fix USB scan

2017-02-08 Thread Uri Mashiach
USB bus scan attempt:
--cut--
=> usb start
starting USB...
USB0:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... data abort
pc : []  lr : []
reloc pc : [<8081b40e>]lr : [<8081b3b3>]
sp : fdf42930  ip : fdf42960 fp : 
r10: 0001  r9 : fdf42ef0 r8 : 48890020
r7 : 0002  r6 : fffa5840 r5 : fff8b140  r4 : fdf429c0
r3 :   r2 : 0004 r1 :   r0 : 
Flags: nZcv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
--cut--

Fix by enabling USB configuration in the SPL.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 include/configs/cl-som-am57x.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index e1f724b..312cfee 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -85,6 +85,8 @@
 #define CONFIG_SYS_I2C_PCA953X_ADDR 0x20
 #define CONFIG_SYS_I2C_PCA953X_WIDTH{ {0x20, 16} }
 
+#endif /* !CONFIG_SPL_BUILD */
+
 /* USB xHCI HOST */
 #define CONFIG_USB_XHCI_OMAP
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
@@ -99,8 +101,6 @@
 #define CONFIG_USB_ETHER_ASIX
 #define CONFIG_USB_ETHER_MCS7830
 
-#endif /* !CONFIG_SPL_BUILD */
-
 /* CPSW Ethernet */
 #define CONFIG_DRIVER_TI_CPSW
 #define CONFIG_MII
-- 
2.7.4

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


[U-Boot] [PATCH 3/6] arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks

2017-02-08 Thread Uri Mashiach
Invoke enable_usb_clocks during board_usb_init and disable_usb_clocks
during board_usb_exit to enable and disable clocks respectively.

Modifications:
* Enable USB clocks in the OMAP version of the function
  board_usb_init.
* Disable USB clocks in the OMAP version of the function
  board_usb_cleanup.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 board/compulab/cl-som-am57x/cl-som-am57x.c | 10 --
 drivers/usb/host/xhci-omap.c   |  3 +++
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index fe1468f..4701b71 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -53,16 +53,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif /* CONFIG_GENERIC_MMC */
 
-#ifdef CONFIG_USB_XHCI_OMAP
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
-{
-   setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
-OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
-
-   return 0;
-}
-#endif /* CONFIG_USB_XHCI_OMAP */
-
 int misc_init_r(void)
 {
cl_print_pcb_info();
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index ceee12a..f32fccc 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -29,6 +29,7 @@ static struct omap_xhci omap;
 
 __weak int __omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
+   enable_usb_clocks(index);
return 0;
 }
 
@@ -40,8 +41,10 @@ int board_usb_init(int index, enum usb_init_type init)
return omap_xhci_board_usb_init(index, init);
 }
 
+
 __weak int __omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
+   disable_usb_clocks(index);
return 0;
 }
 
-- 
2.7.4

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


[U-Boot] [PATCH 2/6] usb: host: xhci-omap: fix double weak board_usb_init functions

2017-02-08 Thread Uri Mashiach
A weak version of the function board_usb_init is implemented in:
common/usb.c
drivers/usb/host/xhci-omap.c

To fix the double implementations:
* Convert the board_usb_init function in drivers/usb/host/xhci-omap.c
  normal (not weak).
* The function board_usb_init in drivers/usb/host/xhci-omap.c calls to
  the weak function omap_xhci_board_usb_init.
* Rename board version of the function board_usb_init to
  omap_xhci_board_usb_init.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

To achieve the same flexibility with the function board_usb_cleanup:
* Add a normal (not weak) implementation of the function
  board_usb_cleanup in drivers/usb/host/xhci-omap.c
* The function board_usb_cleanup in drivers/usb/host/xhci-omap.c calls
  to the weak function omap_xhci_board_usb_cleanup.
* Rename board version of the function board_usb_cleanup to
  omap_xhci_board_usb_cleanup.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 board/compulab/cl-som-am57x/cl-som-am57x.c |  2 +-
 board/ti/am43xx/board.c|  4 ++--
 board/ti/am57xx/board.c|  4 ++--
 board/ti/dra7xx/evm.c  |  4 ++--
 drivers/usb/host/xhci-omap.c   | 23 +--
 5 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index bdd0a2b..fe1468f 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -54,7 +54,7 @@ int board_mmc_init(bd_t *bis)
 #endif /* CONFIG_GENERIC_MMC */
 
 #ifdef CONFIG_USB_XHCI_OMAP
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
 OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 390cc16..2572029 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -694,7 +694,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
 #ifdef CONFIG_USB_DWC3
@@ -725,7 +725,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 5f2d4df..96fad0f 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -616,7 +616,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -650,7 +650,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
switch (index) {
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index bd1c809..21fa824 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -727,7 +727,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
.index = 1,
 };
 
-int board_usb_init(int index, enum usb_init_type init)
+int  omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
enable_usb_clocks(index);
switch (index) {
@@ -764,7 +764,7 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
switch (index) {
case 0:
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index b881b19..ceee12a 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -27,12 +27,31 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct omap_xhci omap;
 
-__weak int __board_usb_init(int index, enum usb_init_type init)
+__weak int __omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
return 0;
 }
+
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+   __attribute__((weak, alias("__omap_xhci_board_usb_init")));
+
 int board_usb_init(int index, enum usb_init_type init)
-   __attribute__((weak, alias("__board_usb_init")));
+{
+   return omap_xhci_board_usb_init(index, init);
+}
+
+__weak int __omap_xhci_board_usb_cleanup(

[U-Boot] [PATCH 1/6] arm: am57xx: cl-som-am57x: fix XHCI registers base address

2017-02-08 Thread Uri Mashiach
The following XHCI registers base address are set to OMAP5 values:
OMAP_XHCI_BASE, OMAP_OCP1_SCP_BASE, OMAP_OTG_WRAPPER_BASE

Captured crash for "usb start" command:
--cut--
=> usb start
starting USB...
USB0:   data abort
pc : []  lr : []
reloc pc : [<8081cd22>]lr : [<8081cb63>]
sp : fdf42d08  ip : fff9e040 fp : fdf42d50
r10: fff8a998  r9 : fdf42ef0 r8 : 
r7 : fdf42d28  r6 : fdf42d2c r5 : fffa5c00  r4 : 
r3 : 4a02  r2 :  r1 : fdf42e78  r0 : fffa5c00
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
--cut--

Fix by adding the CL-SOM-AM57x target to the XHCI registers base address
ifdef'ery.
A better fix should be based on a SOC family defines (currently
missing).

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 include/linux/usb/xhci-omap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h
index 9de80d7..89665a0 100644
--- a/include/linux/usb/xhci-omap.h
+++ b/include/linux/usb/xhci-omap.h
@@ -14,7 +14,7 @@
 #define OMAP_XHCI_BASE 0x488d
 #define OMAP_OCP1_SCP_BASE 0x4A081000
 #define OMAP_OTG_WRAPPER_BASE 0x488c
-#elif defined CONFIG_TARGET_AM57XX_EVM
+#elif defined(CONFIG_TARGET_AM57XX_EVM) || defined(CONFIG_TARGET_CL_SOM_AM57X)
 #define OMAP_XHCI_BASE 0x4889
 #define OMAP_OCP1_SCP_BASE 0x4A084c00
 #define OMAP_OTG_WRAPPER_BASE 0x4888
-- 
2.7.4

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


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

2017-01-23 Thread Uri Mashiach
The module is continuously rebooting with the following message:
Net:   data abort
pc : []  lr : []
reloc pc : [<80816f42>]lr : [<8080d32b>]
sp : fdf5ce48  ip : fdf5d79c fp : 0017
r10: 8083cd58  r9 : fdf5cef0 r8 : fdf5d5d0
r7 : 48485000  r6 : 40ff r5 : fdf5d6e0  r4 : fdf5d618
r3 : fdf5d5b4  r2 : fdf5d5d0 r1 : 643a3631  r0 : fdf5d6e0
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

Modifications:
* Enable Ethernet configuration in the SPL.
* Update PINMUX of PHY enable GPIO.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 board/compulab/cl-som-am57x/mux.c | 2 +-
 include/configs/cl-som-am57x.h| 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/compulab/cl-som-am57x/mux.c 
b/board/compulab/cl-som-am57x/mux.c
index 5b71975..0db0609 100644
--- a/board/compulab/cl-som-am57x/mux.c
+++ b/board/compulab/cl-som-am57x/mux.c
@@ -102,7 +102,7 @@ static const struct pad_conf_entry 
cl_som_am57x_padconf_ethernet[] = {
{VIN2A_D22,  (IEN  | PDIS | PTD | M3) }, /* VIN2A_D22.RGMII1_RXD1 */
{VIN2A_D23,  (IEN  | PDIS | PTD | M3) }, /* VIN2A_D23.RGMII1_RXD0 */
/* Eth PHY1 reset GPIOs*/
-   {VIN1B_CLK1, (IDIS | PDIS | PTD | M14)}, /* VIN1B_CLK1.GPIO2_31 */
+   {VIN2A_CLK0, (IDIS | PDIS | PTD | M14)}, /* VIN2A_CLK0.GPIO3_28 */
 };
 
 #define SET_MUX(mux_array) do_set_mux32((*ctrl)->control_padconf_core_base, \
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index 6692acc..9111cbd 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -103,6 +103,8 @@
 #define CONFIG_USB_ETHER_ASIX
 #define CONFIG_USB_ETHER_MCS7830
 
+#endif /* !CONFIG_SPL_BUILD */
+
 /* CPSW Ethernet */
 #define CONFIG_DRIVER_TI_CPSW
 #define CONFIG_MII
@@ -120,8 +122,6 @@
 #define CONFIG_BOOTP_SUBNETMASK
 #define CONFIG_NET_RETRY_COUNT 10
 
-#endif /* !CONFIG_SPL_BUILD */
-
 /* Default environment */
 #undef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
-- 
2.7.4

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


[U-Boot] [PATCH 1/2] status_led: Kconfig migration - introduction

2017-01-19 Thread Uri Mashiach
Move all of the status LED feature to drivers/led/Kconfig.
doc/README.LED updated to reflect the Kconfig implementation.

Tested boards: CL-SOM-AM57x, CM-T335

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 README  |   8 +-
 doc/README.LED  |  58 +-
 drivers/led/Kconfig | 323 +++-
 3 files changed, 355 insertions(+), 34 deletions(-)

diff --git a/README b/README
index 7e0dd35..a95348a 100644
--- a/README
+++ b/README
@@ -2033,7 +2033,7 @@ The following options need to be configured:
 
A byte containing the id of the VLAN.
 
-- Status LED:  CONFIG_STATUS_LED
+- Status LED:  CONFIG_LED_STATUS
 
Several configurations allow to display the current
status using a LED. For instance, the LED will blink
@@ -2041,15 +2041,15 @@ The following options need to be configured:
soon as a reply to a BOOTP request was received, and
start blinking slow once the Linux kernel is running
(supported by a status LED driver in the Linux
-   kernel). Defining CONFIG_STATUS_LED enables this
+   kernel). Defining CONFIG_LED_STATUS enables this
feature in U-Boot.
 
Additional options:
 
-   CONFIG_GPIO_LED
+   CONFIG_LED_STATUS_GPIO
The status LED can be connected to a GPIO pin.
In such cases, the gpio_led driver can be used as a
-   status LED backend implementation. Define CONFIG_GPIO_LED
+   status LED backend implementation. Define CONFIG_LED_STATUS_GPIO
to include the gpio_led driver in the U-Boot binary.
 
CONFIG_GPIO_LED_INVERTED_TABLE
diff --git a/doc/README.LED b/doc/README.LED
index c3bcb3a..7aa95bd 100644
--- a/doc/README.LED
+++ b/doc/README.LED
@@ -5,48 +5,48 @@ This README describes the status LED API.
 
 The API is defined by the include file include/status_led.h
 
-The first step is to define CONFIG_STATUS_LED in the board config file.
+The first step is to enable CONFIG_LED_STATUS in menuconfig:
+> Device Drivers > LED Support.
 
-If the LED support is only for a single board, define CONFIG_BOARD_SPECIFIC_LED
-in the board config file.
+If the LED support is only for specific board, enable
+CONFIG_LED_STATUS_BOARD_SPECIFIC in the menuconfig.
 
-At a minimum, these macros must be defined at
-STATUS_LED_BIT
-STATUS_LED_STATE
-STATUS_LED_PERIOD
+Status LEDS 0 to 5 are enabled by the following configurations at menuconfig:
+CONFIG_STATUS_LED0, CONFIG_STATUS_LED1, ... CONFIG_STATUS_LED5
 
-If there are multiple status LED's define
-STATUS_LED_BIT
-STATUS_LED_STATE
-STATUS_LED_PERIOD
+The following should be configured for each of the enabled LEDs:
+CONFIG_STATUS_LED_BIT
+CONFIG_STATUS_LED_STATE
+CONFIG_STATUS_LED_FREQ
+Where  is an integer 1 through 5 (empty for 0).
 
-Where  can a integer 1 through 3.
-
-STATUS_LED_BIT is passed into the __led_* functions to identify which LED is
-being acted on.  As such, the value choose must be unique with with respect to
-the other STATUS_LED_BIT's.  Mapping the value to a physical LED is the
+CONFIG_STATUS_LED_BIT is passed into the __led_* functions to identify which 
LED
+is being acted on. As such, the value choose must be unique with with respect 
to
+the other CONFIG_STATUS_LED_BIT's. Mapping the value to a physical LED is the
 reponsiblity of the __led_* function.
 
-STATUS_LED_STATE is the initial state of the LED. It should be set to one of
-these values: STATUS_LED_OFF or STATUS_LED_ON.
+CONFIG_STATUS_LED_STATE is the initial state of the LED. It should be set to 
one
+of these values: CONFIG_LED_STATUS_OFF or CONFIG_LED_STATUS_ON.
 
-STATUS_LED_PERIOD is how long is the LED blink period.  This usually set to
-(CONFIG_SYS_HZ / ) where  is the frequency of the blink. Typical values
-range from 2 to 10.
+CONFIG_STATUS_LED_FREQ determines the LED blink frequency.
+Values range from 2 to 10.
 
 Some other LED macros
+-
 
-STATUS_LED_BOOT is the LED to light when the board is booting.  This must be a
-valid STATUS_LED_BIT value.
+CONFIG_STATUS_LED_BOOT is the LED to light when the board is booting.
+This must be a valid LED number (0-5).
 
-STATUS_LED_RED is the red LED.  It is used signal errors. This must be a valid
-STATUS_LED_BIT value. Other similar color LED's are STATUS_LED_YELLOW and
-STATUS_LED_BLUE.
+CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be
+a valid LED number (0-5). Other similar color LED's macros are
+CONFIG_STATUS_LED_GREEN, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE.
 
-These board must define these functions
+General LED functions
+-
+The following functions should be defined:
 
-__led_init is called once to initialize the LED to STATUS_LED_STATE. One time
-start up code should be placed here.
+__led_init is

[U-Boot] [PATCH 2/2] status_led: Kconfig migration

2017-01-19 Thread Uri Mashiach
Move all of the status LED feature to drivers/led/Kconfig.
The LED status definitions were moved from the board configuration
files to the defconfig files.

TBD: Move all of the definitions in the include/status_led.h to the
relevant board's defconfig files.

Tested boards: CL-SOM-AM57x, CM-T335

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 arch/arm/cpu/arm920t/ep93xx/led.c| 35 ++---
 arch/powerpc/include/asm/status_led.h| 10 ++--
 arch/powerpc/lib/interrupts.c|  6 +--
 board/BuS/eb_cpu5282/eb_cpu5282.c|  2 +-
 board/bf533-stamp/bf533-stamp.c  | 28 ++
 board/compulab/cm_t335/cm_t335.c |  4 +-
 board/compulab/cm_t35/cm_t35.c   |  4 +-
 board/compulab/cm_t3517/cm_t3517.c   |  4 +-
 board/corscience/tricorder/led.c | 26 +-
 board/corscience/tricorder/tricorder.c   |  6 +--
 board/isee/igep00x0/igep00x0.c   |  4 +-
 board/motionpro/motionpro.c  | 45 +++-
 board/olimex/mx23_olinuxino/mx23_olinuxino.c |  6 +--
 board/samtec/vining_fpga/socfpga.c   |  4 +-
 board/ti/beagle/Makefile |  2 +-
 board/ti/beagle/beagle.c |  6 +--
 board/ti/beagle/led.c| 14 ++---
 cmd/Makefile |  2 +-
 cmd/ide.c|  2 +-
 cmd/led.c| 69 -
 common/board_r.c |  8 +--
 configs/TQM823L_defconfig|  7 +++
 configs/TQM823M_defconfig|  7 +++
 configs/TQM850L_defconfig|  7 +++
 configs/TQM850M_defconfig|  7 +++
 configs/TQM855L_defconfig|  7 +++
 configs/TQM855M_defconfig|  7 +++
 configs/TQM860L_defconfig|  7 +++
 configs/TQM860M_defconfig|  7 +++
 configs/TQM862L_defconfig|  7 +++
 configs/TQM862M_defconfig|  7 +++
 configs/TQM866M_defconfig|  7 +++
 configs/TQM885D_defconfig|  7 +++
 configs/cl-som-am57x_defconfig   |  5 ++
 configs/cm_t335_defconfig|  6 +++
 configs/cm_t3517_defconfig   |  7 +++
 configs/cm_t35_defconfig |  7 +++
 configs/eb_cpu5282_defconfig |  6 +++
 configs/eb_cpu5282_internal_defconfig|  6 +++
 configs/edb9315a_defconfig   | 12 +
 configs/igep0020_defconfig   |  7 +++
 configs/igep0030_defconfig   |  7 +++
 configs/motionpro_defconfig  | 10 
 configs/mx23_olinuxino_defconfig |  8 +++
 configs/omap3_beagle_defconfig   | 11 
 configs/socfpga_vining_fpga_defconfig| 11 
 configs/tqma6s_wru4_mmc_defconfig| 20 
 configs/tricorder_defconfig  | 11 
 configs/tricorder_flash_defconfig| 11 
 configs/v38b_defconfig   |  6 +++
 drivers/misc/Makefile|  4 +-
 drivers/misc/gpio_led.c  | 26 +-
 drivers/misc/pca9551_led.c   |  2 +-
 drivers/misc/status_led.c| 76 ++--
 include/common.h |  2 +-
 include/configs/PATI.h   |  2 -
 include/configs/TQM823L.h|  6 ---
 include/configs/TQM823M.h|  6 ---
 include/configs/TQM850L.h|  2 -
 include/configs/TQM850M.h|  2 -
 include/configs/TQM855L.h|  2 -
 include/configs/TQM855M.h|  2 -
 include/configs/TQM860L.h|  2 -
 include/configs/TQM860M.h|  2 -
 include/configs/TQM862L.h|  2 -
 include/configs/TQM862M.h|  2 -
 include/configs/TQM866M.h|  2 -
 include/configs/TQM885D.h|  2 -
 include/configs/bf526-ezbrd.h| 16 --
 include/configs/bf533-stamp.h| 16 --
 include/configs/cl-som-am57x.h   | 11 
 include/configs/cm_t335.h|  7 ---
 include/configs/cm_t35.h | 10 +---
 include/configs/cm_t3517.h   | 10 +---
 include/configs/eb_cpu5282.h |  7 ---
 include/configs/edb93xx.h| 13 -
 include/configs/motionpro.h  | 14 -
 include/configs/mx23_olinuxino.h |  9 
 include/configs/omap3_beagle.h   | 11 
 include/configs/omap3_igep00x0.h |  8 ---
 include/configs/socfpga_vining_fpga.h| 16 --
 include/configs/stm32f429-discovery.h|  1 -
 include/configs/tqma6_

[U-Boot] [PATCH v4 3/4] arm: am57xx: cl-som-am57x: add ETH support

2016-12-28 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Add MAC support.

Use PHY, connected to RGMII1 as a default Eth adapter,
by appropriate setting of 'cpsw_data.active_slave'.

'cpsw_phy' env variable can override this setting.

Set the MAC addresses in the U-Boot environment.
The addresses are retrieved from the on-board EEPROM or from the SOC's
MAC fuses.

Set the following PHYs RGMII clock delays:
- Enable RX delay
- Disable TX delay

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
[uri.mashi...@compulab.co.il: add RGMII clock delays]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
v3 -> v4: No modifications

 board/compulab/cl-som-am57x/Makefile |   2 +
 board/compulab/cl-som-am57x/eth.c| 198 +++
 board/compulab/cl-som-am57x/mux.c|  23 
 include/configs/cl-som-am57x.h   |  17 +++
 4 files changed, 240 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/eth.c

diff --git a/board/compulab/cl-som-am57x/Makefile 
b/board/compulab/cl-som-am57x/Makefile
index 0c59781..566366b 100644
--- a/board/compulab/cl-som-am57x/Makefile
+++ b/board/compulab/cl-som-am57x/Makefile
@@ -13,3 +13,5 @@ obj-y += spl.o mux.o
 else
 obj-y  += cl-som-am57x.o mux.o
 endif
+
+obj-$(CONFIG_DRIVER_TI_CPSW)   += eth.o
diff --git a/board/compulab/cl-som-am57x/eth.c 
b/board/compulab/cl-som-am57x/eth.c
new file mode 100644
index 000..0c4bf91
--- /dev/null
+++ b/board/compulab/cl-som-am57x/eth.c
@@ -0,0 +1,198 @@
+/*
+ * Ethernet specific code for CompuLab CL-SOM-AM57x module
+ *
+ * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
+ *
+ * Author: Uri Mashiach <uri.mashi...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../common/eeprom.h"
+
+static void cpsw_control(int enabled)
+{
+   /* VTP can be added here */
+}
+
+static struct cpsw_slave_data cl_som_am57x_cpsw_slaves[] = {
+   {
+   .slave_reg_ofs  = 0x208,
+   .sliver_reg_ofs = 0xd80,
+   .phy_addr   = 0,
+   .phy_if = PHY_INTERFACE_MODE_RMII,
+   },
+   {
+   .slave_reg_ofs  = 0x308,
+   .sliver_reg_ofs = 0xdc0,
+   .phy_addr   = 1,
+   .phy_if = PHY_INTERFACE_MODE_RMII,
+
+   },
+};
+
+static struct cpsw_platform_data cl_som_am57_cpsw_data = {
+   .mdio_base  = CPSW_MDIO_BASE,
+   .cpsw_base  = CPSW_BASE,
+   .mdio_div   = 0xff,
+   .channels   = 8,
+   .cpdma_reg_ofs  = 0x800,
+   .slaves = 2,
+   .slave_data = cl_som_am57x_cpsw_slaves,
+   .ale_reg_ofs= 0xd00,
+   .ale_entries= 1024,
+   .host_port_reg_ofs  = 0x108,
+   .hw_stats_reg_ofs   = 0x900,
+   .bd_ram_ofs = 0x2000,
+   .mac_control= (1 << 5),
+   .control= cpsw_control,
+   .host_port_num  = 0,
+   .version= CPSW_CTRL_VERSION_2,
+};
+
+/*
+ * cl_som_am57x_efuse_read_mac_addr() - read Ethernet port MAC address.
+ *   The information is retrieved from the SOC's registers.
+ * @buff: read buffer.
+ * @port_num: port number.
+ */
+static void cl_som_am57x_efuse_read_mac_addr(uchar *buff, uint port_num)
+{
+   uint32_t mac_hi, mac_lo;
+
+   if (port_num) {
+   mac_lo = readl((*ctrl)->control_core_mac_id_1_lo);
+   mac_hi = readl((*ctrl)->control_core_mac_id_1_hi);
+   } else {
+   mac_lo = readl((*ctrl)->control_core_mac_id_0_lo);
+   mac_hi = readl((*ctrl)->control_core_mac_id_0_hi);
+   }
+
+   buff[0] = (mac_hi & 0xFF) >> 16;
+   buff[1] = (mac_hi & 0xFF00) >> 8;
+   buff[2] = mac_hi & 0xFF;
+   buff[3] = (mac_lo & 0xFF) >> 16;
+   buff[4] = (mac_lo & 0xFF00) >> 8;
+   buff[5] = mac_lo & 0xFF;
+}
+
+/*
+ * cl_som_am57x_handle_mac_address() - set MAC address in the U-Boot
+ * environment.
+ *  The address is retrieved retrieved from an EEPROM field or from the
+ * SOC's registers.
+ * @env_name: U-Boot environment name.
+ * @field_name: EEPROM field name.
+ * @port_num: SOC's port number.
+ */
+static int cl_som_am57x_handle_mac_address(char *env_name, uint port_num)
+{
+   int ret;
+   uint8_t enetaddr[6];
+
+   ret = eth_getenv_enetaddr(env_name, enetaddr);
+   if (ret)
+   return 0;
+
+   ret = cl_eeprom_read_mac_addr(enetaddr, CONFIG_SYS_I2C_EEPROM_BUS);
+
+   if (ret || !is_valid_ethaddr(enetaddr))
+   cl_som_am57x_efuse_read_mac_addr(enetaddr, port_num);
+
+   if (!is_valid_eth

[U-Boot] [PATCH v4 1/4] arm: am57xx: cl-som-am57x: add initial board support

2016-12-28 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Features supported :

* Serial console
* SPI Flash
* MMC/SD Card
* eMMC storage
* SATA
* PCA9555 - GPIO expander over I2C5 bus
* USB

Use spl alternate boot device feature to define fallback to
the main boot device as it is defined by hardware.

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
[uri.mashi...@compulab.co.il: Adjust to v2016.11]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v3 -> v4: Adjusted to v2017.01-rc2:
  * arch/arm/mach-omap2/omap5/Kconfig - new board configuration moved 
to a new location.
  * Variable cl_som_am57x_volts initialization.

 arch/arm/mach-omap2/omap5/Kconfig  |   4 +
 board/compulab/cl-som-am57x/Kconfig|  12 ++
 board/compulab/cl-som-am57x/MAINTAINERS|   6 +
 board/compulab/cl-som-am57x/Makefile   |  15 ++
 board/compulab/cl-som-am57x/cl-som-am57x.c |  62 
 board/compulab/cl-som-am57x/mux.c  | 100 
 board/compulab/cl-som-am57x/spl.c  | 234 +
 configs/cl-som-am57x_defconfig |  41 +
 include/configs/cl-som-am57x.h | 105 +
 9 files changed, 579 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/Kconfig
 create mode 100644 board/compulab/cl-som-am57x/MAINTAINERS
 create mode 100644 board/compulab/cl-som-am57x/Makefile
 create mode 100644 board/compulab/cl-som-am57x/cl-som-am57x.c
 create mode 100644 board/compulab/cl-som-am57x/mux.c
 create mode 100644 board/compulab/cl-som-am57x/spl.c
 create mode 100644 configs/cl-som-am57x_defconfig
 create mode 100644 include/configs/cl-som-am57x.h

diff --git a/arch/arm/mach-omap2/omap5/Kconfig 
b/arch/arm/mach-omap2/omap5/Kconfig
index 018e584..242d1ee 100644
--- a/arch/arm/mach-omap2/omap5/Kconfig
+++ b/arch/arm/mach-omap2/omap5/Kconfig
@@ -40,6 +40,9 @@ choice
prompt "OMAP5 board select"
optional
 
+config TARGET_CL_SOM_AM57X
+   bool "CompuLab CL-SOM-AM57x"
+
 config TARGET_CM_T54
bool "CompuLab CM-T54"
 
@@ -179,6 +182,7 @@ endchoice
 endmenu
 endif
 
+source "board/compulab/cl-som-am57x/Kconfig"
 source "board/compulab/cm_t54/Kconfig"
 source "board/ti/omap5_uevm/Kconfig"
 source "board/ti/dra7xx/Kconfig"
diff --git a/board/compulab/cl-som-am57x/Kconfig 
b/board/compulab/cl-som-am57x/Kconfig
new file mode 100644
index 000..85fc9a1
--- /dev/null
+++ b/board/compulab/cl-som-am57x/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_CL_SOM_AM57X
+
+config SYS_BOARD
+   default "cl-som-am57x"
+
+config SYS_VENDOR
+   default "compulab"
+
+config SYS_CONFIG_NAME
+   default "cl-som-am57x"
+
+endif
diff --git a/board/compulab/cl-som-am57x/MAINTAINERS 
b/board/compulab/cl-som-am57x/MAINTAINERS
new file mode 100644
index 000..e0195f4
--- /dev/null
+++ b/board/compulab/cl-som-am57x/MAINTAINERS
@@ -0,0 +1,6 @@
+CL-SOM-AM57x BOARD
+M: Uri Mashiach <uri.mashi...@compulab.co.il>
+S: Maintained
+F: board/compulab/cl-som-am57x/
+F: include/configs/cl-som-am57x.h
+F: configs/cl-som-am57x_defconfig
diff --git a/board/compulab/cl-som-am57x/Makefile 
b/board/compulab/cl-som-am57x/Makefile
new file mode 100644
index 000..0c59781
--- /dev/null
+++ b/board/compulab/cl-som-am57x/Makefile
@@ -0,0 +1,15 @@
+#
+# Makefile
+#
+# (C) Copyright 2016 CompuLab, Ltd. 
+#
+# Author: Dmitry Lifshitz <lifsh...@compulab.co.il>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifdef CONFIG_SPL_BUILD
+obj-y  += spl.o mux.o
+else
+obj-y  += cl-som-am57x.o mux.o
+endif
diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
new file mode 100644
index 000..4bad644
--- /dev/null
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -0,0 +1,62 @@
+/*
+ * Board functions for CompuLab cl_som_am57x board
+ *
+ * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
+ *
+ * Author: Dmitry Lifshitz <lifsh...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+const struct omap_sysinfo sysinfo = {
+   "Board: CL-SOM-AM57x\n"
+};
+
+int board_init(void)
+{
+   /* Disable PMIC Powerhold feature, DEV_CTRL.DEV_ON = 1 */
+   palmas_i2c_write_u8(TPS65903X_CHIP_P1, 0xA0, 0x1);
+
+   gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+   return 0;
+}
+
+#ifdef CONFIG_GENERIC_MMC
+#define SB_SOM_CD_GPIO 187
+#define SB_SOM_WP_GPIO 188
+
+int board_mmc_init(bd_t *bis)
+{
+   int ret0, ret1;
+
+   ret0 = omap_mmc_init(0, 0, 0, SB_SOM_CD_GPIO, SB_SOM_WP_GPIO);
+   if (ret0)
+   printf("cl-som-am57x: failed to initialize mmc0\n");
+
+   ret1 = omap_mmc_init(1, 0, 0, -

[U-Boot] [PATCH v4 0/4] cl-som-am57x: initial support

2016-12-28 Thread Uri Mashiach
This patch series adds support for CompuLab CL-SOM-AM57X board and the
SBC-AM57X evaluation kit.

CL-SOM-AM57x is a miniature System-on-Module (SoM) based on
TI Sitara AM57x ARM Cortex-A15 System-on-Chip family.

SBC-AM57x is a single board computer, implemented with the
CL-SOM-AM57x computer-on-module and the SB-SOM-AM57x carrier board.
The CL-SOM-AM57x providing most of the functions and the SB-SOM-AM57x providing
additional peripheral functions and connectors.

The SBC-AM57x has the following features:


CPU:Texas Instruments Sitara AM5728 dual-core ARM Cortex-A15, 
1.5GHz or
Texas Instruments Sitara AM5718 single-core ARM Cortex-A15, 
1.5GHz

RAM:DDR3, 512MB – 4GB

Storage:NAND flash, 512MB - 1GB or eMMC flash, 4GB - 32GB
SPI-flash 2MB

Ethernet:   Up to 2x 10/100/1000Mbps Ethernet ports (MAC+PHY)

WiFi/BT:802.11b/g/n WiFi interface (TI WiLink 8 WL1801 chipset) or
Dual-band 2x2 802.11a/b/g/n WiFi interface (TI WiLink 8 WL1837 
chipset)

Analog Audio:   Audio codec with stereo output, stereo input and microphone 
support

More details can be found here:

https://www.compulab.co.il/products/computer-on-modules/cl-som-am57x-ti-am5728-am5718-system-on-module/

https://www.compulab.co.il/products/sbcs/sbc-am57x-ti-am5728-am5718-single-board-computer/

---
v3 -> v4: Adjusted to v2017.01-rc2

Dmitry Lifshitz (3):
  arm: am57xx: cl-som-am57x: add initial board support
  arm: am57xx: cl-som-am57x: fetch board rev from EEPROM
  arm: am57xx: cl-som-am57x: add ETH support

Uri Mashiach (1):
  arm: am57xx: cl-som-am57x: update default env

 arch/arm/mach-omap2/omap5/Kconfig  |   4 +
 board/compulab/cl-som-am57x/Kconfig|  12 ++
 board/compulab/cl-som-am57x/MAINTAINERS|   6 +
 board/compulab/cl-som-am57x/Makefile   |  17 +++
 board/compulab/cl-som-am57x/cl-som-am57x.c |  76 ++
 board/compulab/cl-som-am57x/eth.c  | 198 
 board/compulab/cl-som-am57x/mux.c  | 123 +++
 board/compulab/cl-som-am57x/spl.c  | 234 +
 configs/cl-som-am57x_defconfig |  41 +
 include/configs/cl-som-am57x.h | 197 
 10 files changed, 908 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/Kconfig
 create mode 100644 board/compulab/cl-som-am57x/MAINTAINERS
 create mode 100644 board/compulab/cl-som-am57x/Makefile
 create mode 100644 board/compulab/cl-som-am57x/cl-som-am57x.c
 create mode 100644 board/compulab/cl-som-am57x/eth.c
 create mode 100644 board/compulab/cl-som-am57x/mux.c
 create mode 100644 board/compulab/cl-som-am57x/spl.c
 create mode 100644 configs/cl-som-am57x_defconfig
 create mode 100644 include/configs/cl-som-am57x.h

-- 
2.7.4

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


[U-Boot] [PATCH v4 2/4] arm: am57xx: cl-som-am57x: fetch board rev from EEPROM

2016-12-28 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Add PCB revision message.
Implement board revision get_board_rev API.

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
Commit description update.
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
v3 -> v4: No modifications

 board/compulab/cl-som-am57x/cl-som-am57x.c | 14 ++
 include/configs/cl-som-am57x.h | 14 ++
 2 files changed, 28 insertions(+)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index 4bad644..bdd0a2b 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -14,6 +14,8 @@
 #include 
 #include 
 #include 
+#include "../common/common.h"
+#include "../common/eeprom.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -60,3 +62,15 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 #endif /* CONFIG_USB_XHCI_OMAP */
+
+int misc_init_r(void)
+{
+   cl_print_pcb_info();
+
+   return 0;
+}
+
+u32 get_board_rev(void)
+{
+   return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS);
+}
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index c8d4a00..48c0f7f 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -24,6 +24,10 @@
 
 #include 
 
+/* misc */
+#define CONFIG_MISC_INIT_R
+#define CONFIG_REVISION_TAG
+
 /* Status LED */
 #define CONFIG_STATUS_LED  /* Status LED enabled */
 #define CONFIG_GPIO_LED
@@ -65,6 +69,16 @@
 #define CONFIG_ENV_OFFSET  (768 * 1024)
 #define CONFIG_ENV_SPI_MAX_HZ  4800
 
+/* EEPROM */
+#define CONFIG_SYS_I2C_EEPROM_ADDR  0x50
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN  1
+#define CONFIG_SYS_I2C_EEPROM_BUS   3
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_CMD_EEPROM_LAYOUT
+#define CONFIG_ENV_EEPROM_IS_ON_I2C
+#define CONFIG_SYS_EEPROM_SIZE 256
+
 #ifndef CONFIG_SPL_BUILD
 /* SATA */
 #define CONFIG_CMD_SCSI
-- 
2.7.4

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


[U-Boot] [PATCH v4 4/4] arm: am57xx: cl-som-am57x: update default env

2016-12-28 Thread Uri Mashiach
Modify U-Boot default env settings.

Boot sequence:
1. SD card boot script
2. SD card boot no script
3. SATA boot script
4. SATA boot no script
5. eMMC boot script
6. eMMC boot no script

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
v3 -> v4: No modifications

 include/configs/cl-som-am57x.h | 61 ++
 1 file changed, 61 insertions(+)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index 2001b0c..8297182 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -133,4 +133,65 @@
 
 #endif /* !CONFIG_SPL_BUILD */
 
+/* Default environment */
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+   DEFAULT_LINUX_BOOT_ENV \
+   "autoload=no\0" \
+   "baudrate=115200\0" \
+   "console=ttyO2,115200n8\0" \
+   "bootdelay=3\0" \
+   "fdtfile=am57xx-sbc-am57x.dtb\0" \
+   "kernel=zImage-cl-som-am57x\0" \
+   "bootscr=bootscr.img\0" \
+   "displaytype=hdmi\0" \
+   "bootkernel=bootz ${loadaddr} - ${fdtaddr}\0" \
+   "mmcloadfdt=load mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
+   "mmcloadkernel=load mmc ${mmcdev} ${loadaddr} ${kernel}\0" \
+   "load_mmc=mmc dev ${mmcdev} && mmc rescan && " \
+   "run mmcloadkernel run mmcloadfdt\0" \
+   "mmcroot=/dev/mmcblk1p2\0" \
+   "mmcrootfstype=ext4 rw rootwait\0" \
+   "mmcargs=setenv bootargs console=${console} root=${mmcroot} " \
+   "rootfstype=${mmcrootfstype}\0" \
+   "mmcbootscript=setenv mmcdev 0; mmc dev ${mmcdev} && mmc rescan && " \
+   "load mmc ${mmcdev} ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from MMC/SD Card ... && " \
+   "source ${loadaddr}\0" \
+   "mmcboot=setenv mmcdev 0 && run load_mmc && " \
+   "run mmcargs && echo Booting from MMC/SD Card ... && " \
+   "run bootkernel\0" \
+   "emmcroot=/dev/mmcblk0p2\0" \
+   "emmcrootfstype=ext4 rw rootwait\0" \
+   "emmcargs=setenv bootargs console=${console} " \
+   "root=${emmcroot} " \
+   "rootfstype=${emmcrootfstype}\0" \
+   "emmcbootscript=setenv mmcdev 1; mmc dev ${mmcdev} && mmc rescan && " \
+   "load mmc ${mmcdev} ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from eMMC ... && " \
+   "source ${loadaddr}\0" \
+   "emmcboot=setenv mmcdev 1 && run load_mmc && " \
+   "run emmcargs && echo Booting from eMMC ... && " \
+   "run bootkernel\0" \
+   "sataroot=/dev/sda2\0" \
+   "satarootfstype=ext4 rw rootwait\0" \
+   "load_sata=load scsi 0 ${loadaddr} ${kernel} && " \
+   "load scsi 0 ${fdtaddr} ${fdtfile}\0" \
+   "sataargs=setenv bootargs console=${console} " \
+   "root=${sataroot} " \
+   "rootfstype=${satarootfstype}\0" \
+   "satabootscript=load scsi 0 ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from SATA ... && " \
+   "source ${loadaddr}\0" \
+   "sataboot=run load_sata && run sataargs && " \
+   "echo Booting from SATA ... && " \
+   "run bootkernel\0" \
+
+#undef CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND \
+   "run mmcbootscript || run mmcboot || " \
+   "run satabootscript || run sataboot || " \
+   "run emmcbootscript || run emmcboot"
+
+
 #endif /* __CONFIG_CL_SOM_AM57X_H */
-- 
2.7.4

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


[U-Boot] [PATCH v3 3/4] arm: am57xx: cl-som-am57x: add ETH support

2016-12-08 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Add MAC support.

Use PHY, connected to RGMII1 as a default Eth adapter,
by appropriate setting of 'cpsw_data.active_slave'.

'cpsw_phy' env variable can override this setting.

Set the MAC addresses in the U-Boot environment.
The addresses are retrieved from the on-board EEPROM or from the SOC's
MAC fuses.

Set the following PHYs RGMII clock delays:
- Enable RX delay
- Disable TX delay

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
[uri.mashi...@compulab.co.il: add RGMII clock delays]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
 board/compulab/cl-som-am57x/Makefile |   2 +
 board/compulab/cl-som-am57x/eth.c| 199 +++
 board/compulab/cl-som-am57x/mux.c|  23 
 include/configs/cl-som-am57x.h   |  17 +++
 4 files changed, 241 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/eth.c

diff --git a/board/compulab/cl-som-am57x/Makefile 
b/board/compulab/cl-som-am57x/Makefile
index 0c59781..566366b 100644
--- a/board/compulab/cl-som-am57x/Makefile
+++ b/board/compulab/cl-som-am57x/Makefile
@@ -13,3 +13,5 @@ obj-y += spl.o mux.o
 else
 obj-y  += cl-som-am57x.o mux.o
 endif
+
+obj-$(CONFIG_DRIVER_TI_CPSW)   += eth.o
diff --git a/board/compulab/cl-som-am57x/eth.c 
b/board/compulab/cl-som-am57x/eth.c
new file mode 100644
index 000..ce91b7f
--- /dev/null
+++ b/board/compulab/cl-som-am57x/eth.c
@@ -0,0 +1,199 @@
+/*
+ * Ethernet specific code for CompuLab CL-SOM-AM57x module
+ *
+ * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
+ *
+ * Author: Uri Mashiach <uri.mashi...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../common/eeprom.h"
+
+static void cpsw_control(int enabled)
+{
+   /* VTP can be added here */
+}
+
+static struct cpsw_slave_data cl_som_am57x_cpsw_slaves[] = {
+   {
+   .slave_reg_ofs  = 0x208,
+   .sliver_reg_ofs = 0xd80,
+   .phy_addr   = 0,
+   .phy_if = PHY_INTERFACE_MODE_RMII,
+   },
+   {
+   .slave_reg_ofs  = 0x308,
+   .sliver_reg_ofs = 0xdc0,
+   .phy_addr   = 1,
+   .phy_if = PHY_INTERFACE_MODE_RMII,
+
+   },
+};
+
+static struct cpsw_platform_data cl_som_am57_cpsw_data = {
+   .mdio_base  = CPSW_MDIO_BASE,
+   .cpsw_base  = CPSW_BASE,
+   .mdio_div   = 0xff,
+   .channels   = 8,
+   .cpdma_reg_ofs  = 0x800,
+   .slaves = 2,
+   .slave_data = cl_som_am57x_cpsw_slaves,
+   .ale_reg_ofs= 0xd00,
+   .ale_entries= 1024,
+   .host_port_reg_ofs  = 0x108,
+   .hw_stats_reg_ofs   = 0x900,
+   .bd_ram_ofs = 0x2000,
+   .mac_control= (1 << 5),
+   .control= cpsw_control,
+   .host_port_num  = 0,
+   .version= CPSW_CTRL_VERSION_2,
+};
+
+/*
+ * cl_som_am57x_efuse_read_mac_addr() - read Ethernet port MAC address.
+ *   The information is retrieved from the SOC's registers.
+ * @buff: read buffer.
+ * @port_num: port number.
+ */
+static void cl_som_am57x_efuse_read_mac_addr(uchar *buff, uint port_num)
+{
+   uint32_t mac_hi, mac_lo;
+
+   if (port_num) {
+   mac_lo = readl((*ctrl)->control_core_mac_id_1_lo);
+   mac_hi = readl((*ctrl)->control_core_mac_id_1_hi);
+   } else {
+   mac_lo = readl((*ctrl)->control_core_mac_id_0_lo);
+   mac_hi = readl((*ctrl)->control_core_mac_id_0_hi);
+   }
+
+   buff[0] = (mac_hi & 0xFF) >> 16;
+   buff[1] = (mac_hi & 0xFF00) >> 8;
+   buff[2] = mac_hi & 0xFF;
+   buff[3] = (mac_lo & 0xFF) >> 16;
+   buff[4] = (mac_lo & 0xFF00) >> 8;
+   buff[5] = mac_lo & 0xFF;
+}
+
+/*
+ * cl_som_am57x_handle_mac_address() - set MAC address in the U-Boot
+ * environment.
+ *  The address is retrieved retrieved from an EEPROM field or from the
+ * SOC's registers.
+ * @env_name: U-Boot environment name.
+ * @field_name: EEPROM field name.
+ * @port_num: SOC's port number.
+ */
+static int cl_som_am57x_handle_mac_address(char *env_name, uint port_num)
+{
+   int ret;
+   uint8_t enetaddr[6];
+
+   ret = eth_getenv_enetaddr(env_name, enetaddr);
+   if (ret)
+   return 0;
+
+   ret = cl_eeprom_read_mac_addr(enetaddr, CONFIG_SYS_I2C_EEPROM_BUS);
+
+   if (ret || !is_valid_ethaddr(enetaddr))
+   cl_som_am57x_efuse_read_mac_addr(enetaddr, port_num);
+
+   if (!is_valid_ethaddr(enetaddr))
+   return -1;
+
+   

[U-Boot] [PATCH v3 1/4] arm: am57xx: cl-som-am57x: add initial board support

2016-12-08 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Features supported :

* Serial console
* SPI Flash
* MMC/SD Card
* eMMC storage
* SATA
* PCA9555 - GPIO expander over I2C5 bus
* USB

Use spl alternate boot device feature to define fallback to
the main boot device as it is defined by hardware.

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
[uri.mashi...@compulab.co.il: Adjust to v2016.11]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
---
v2 -> v3: Remove CONFIG_SPL_OS_BOOT from board configuration file -
  CONFIG_SPL_OS_BOOT included in Kconfig
v1 -> v2: Merged with commit "add MMC as a boot devices for spl".
  Commit "add MMC as a boot devices for spl" converted to Kconfig

 arch/arm/mach-omap2/omap5/Kconfig  |   4 +
 board/compulab/cl-som-am57x/Kconfig|  12 ++
 board/compulab/cl-som-am57x/MAINTAINERS|   6 +
 board/compulab/cl-som-am57x/Makefile   |  15 ++
 board/compulab/cl-som-am57x/cl-som-am57x.c |  62 
 board/compulab/cl-som-am57x/mux.c  | 100 +
 board/compulab/cl-som-am57x/spl.c  | 222 +
 configs/cl-som-am57x_defconfig |  41 ++
 include/configs/cl-som-am57x.h | 105 ++
 9 files changed, 567 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/Kconfig
 create mode 100644 board/compulab/cl-som-am57x/MAINTAINERS
 create mode 100644 board/compulab/cl-som-am57x/Makefile
 create mode 100644 board/compulab/cl-som-am57x/cl-som-am57x.c
 create mode 100644 board/compulab/cl-som-am57x/mux.c
 create mode 100644 board/compulab/cl-som-am57x/spl.c
 create mode 100644 configs/cl-som-am57x_defconfig
 create mode 100644 include/configs/cl-som-am57x.h

diff --git a/arch/arm/mach-omap2/omap5/Kconfig 
b/arch/arm/mach-omap2/omap5/Kconfig
index 22259dc..0ee5ac1 100644
--- a/arch/arm/mach-omap2/omap5/Kconfig
+++ b/arch/arm/mach-omap2/omap5/Kconfig
@@ -40,6 +40,9 @@ choice
prompt "OMAP5 board select"
optional
 
+config TARGET_CL_SOM_AM57X
+   bool "CompuLab CL-SOM-AM57x"
+
 config TARGET_CM_T54
bool "CompuLab CM-T54"
 
@@ -86,6 +89,7 @@ config TI_SECURE_EMIF_PROTECTED_REGION_SIZE
  using hardware memory firewalls. This value must be smaller than the
  TI_SECURE_EMIF_TOTAL_REGION_SIZE value.
 
+source "board/compulab/cl-som-am57x/Kconfig"
 source "board/compulab/cm_t54/Kconfig"
 source "board/ti/omap5_uevm/Kconfig"
 source "board/ti/dra7xx/Kconfig"
diff --git a/board/compulab/cl-som-am57x/Kconfig 
b/board/compulab/cl-som-am57x/Kconfig
new file mode 100644
index 000..85fc9a1
--- /dev/null
+++ b/board/compulab/cl-som-am57x/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_CL_SOM_AM57X
+
+config SYS_BOARD
+   default "cl-som-am57x"
+
+config SYS_VENDOR
+   default "compulab"
+
+config SYS_CONFIG_NAME
+   default "cl-som-am57x"
+
+endif
diff --git a/board/compulab/cl-som-am57x/MAINTAINERS 
b/board/compulab/cl-som-am57x/MAINTAINERS
new file mode 100644
index 000..e0195f4
--- /dev/null
+++ b/board/compulab/cl-som-am57x/MAINTAINERS
@@ -0,0 +1,6 @@
+CL-SOM-AM57x BOARD
+M: Uri Mashiach <uri.mashi...@compulab.co.il>
+S: Maintained
+F: board/compulab/cl-som-am57x/
+F: include/configs/cl-som-am57x.h
+F: configs/cl-som-am57x_defconfig
diff --git a/board/compulab/cl-som-am57x/Makefile 
b/board/compulab/cl-som-am57x/Makefile
new file mode 100644
index 000..0c59781
--- /dev/null
+++ b/board/compulab/cl-som-am57x/Makefile
@@ -0,0 +1,15 @@
+#
+# Makefile
+#
+# (C) Copyright 2016 CompuLab, Ltd. 
+#
+# Author: Dmitry Lifshitz <lifsh...@compulab.co.il>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifdef CONFIG_SPL_BUILD
+obj-y  += spl.o mux.o
+else
+obj-y  += cl-som-am57x.o mux.o
+endif
diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
new file mode 100644
index 000..4bad644
--- /dev/null
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -0,0 +1,62 @@
+/*
+ * Board functions for CompuLab cl_som_am57x board
+ *
+ * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
+ *
+ * Author: Dmitry Lifshitz <lifsh...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+const struct omap_sysinfo sysinfo = {
+   "Board: CL-SOM-AM57x\n"
+};
+
+int board_init(void)
+{
+   /* Disable PMIC Powerhold feature, DEV_CTRL.DEV_ON = 1 */
+   palmas_i2c_write_u8(TPS65903X_CHIP_P1, 0xA0, 0x1);
+
+   gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+   return 0;
+}
+
+#ifdef CONFIG_GENERIC_MMC
+#define SB_SOM_CD_GPIO 187
+#define SB_SOM_WP_GPIO 188
+
+int board_mmc_init(bd_t *bis)

[U-Boot] [PATCH v3 2/4] arm: am57xx: cl-som-am57x: fetch board rev from EEPROM

2016-12-08 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Add PCB revision message.
Implement board revision get_board_rev API.

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
Commit description update.
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
 board/compulab/cl-som-am57x/cl-som-am57x.c | 14 ++
 include/configs/cl-som-am57x.h | 14 ++
 2 files changed, 28 insertions(+)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index 4bad644..bdd0a2b 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -14,6 +14,8 @@
 #include 
 #include 
 #include 
+#include "../common/common.h"
+#include "../common/eeprom.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -60,3 +62,15 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 #endif /* CONFIG_USB_XHCI_OMAP */
+
+int misc_init_r(void)
+{
+   cl_print_pcb_info();
+
+   return 0;
+}
+
+u32 get_board_rev(void)
+{
+   return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS);
+}
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index c8d4a00..48c0f7f 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -24,6 +24,10 @@
 
 #include 
 
+/* misc */
+#define CONFIG_MISC_INIT_R
+#define CONFIG_REVISION_TAG
+
 /* Status LED */
 #define CONFIG_STATUS_LED  /* Status LED enabled */
 #define CONFIG_GPIO_LED
@@ -65,6 +69,16 @@
 #define CONFIG_ENV_OFFSET  (768 * 1024)
 #define CONFIG_ENV_SPI_MAX_HZ  4800
 
+/* EEPROM */
+#define CONFIG_SYS_I2C_EEPROM_ADDR  0x50
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN  1
+#define CONFIG_SYS_I2C_EEPROM_BUS   3
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_CMD_EEPROM_LAYOUT
+#define CONFIG_ENV_EEPROM_IS_ON_I2C
+#define CONFIG_SYS_EEPROM_SIZE 256
+
 #ifndef CONFIG_SPL_BUILD
 /* SATA */
 #define CONFIG_CMD_SCSI
-- 
2.7.4

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


[U-Boot] [PATCH v3 0/4] cl-som-am57x: initial support

2016-12-08 Thread Uri Mashiach
This patch series adds support for CompuLab CL-SOM-AM57X board and the
SBC-AM57X evaluation kit.

CL-SOM-AM57x is a miniature System-on-Module (SoM) based on
TI Sitara AM57x ARM Cortex-A15 System-on-Chip family.

SBC-AM57x is a single board computer, implemented with the
CL-SOM-AM57x computer-on-module and the SB-SOM-AM57x carrier board.
The CL-SOM-AM57x providing most of the functions and the SB-SOM-AM57x providing
additional peripheral functions and connectors.

The SBC-AM57x has the following features:


CPU:Texas Instruments Sitara AM5728 dual-core ARM Cortex-A15, 
1.5GHz or
Texas Instruments Sitara AM5718 single-core ARM Cortex-A15, 
1.5GHz

RAM:DDR3, 512MB – 4GB

Storage:NAND flash, 512MB - 1GB or eMMC flash, 4GB - 32GB
SPI-flash 2MB

Ethernet:   Up to 2x 10/100/1000Mbps Ethernet ports (MAC+PHY)

WiFi/BT:802.11b/g/n WiFi interface (TI WiLink 8 WL1801 chipset) or
Dual-band 2x2 802.11a/b/g/n WiFi interface (TI WiLink 8 WL1837 
chipset)

Analog Audio:   Audio codec with stereo output, stereo input and microphone 
support

More details can be found here:

https://www.compulab.co.il/products/computer-on-modules/cl-som-am57x-ti-am5728-am5718-system-on-module/

https://www.compulab.co.il/products/sbcs/sbc-am57x-ti-am5728-am5718-single-board-computer/

Dmitry Lifshitz (3):
  arm: am57xx: cl-som-am57x: add initial board support
  arm: am57xx: cl-som-am57x: fetch board rev from EEPROM
  arm: am57xx: cl-som-am57x: add ETH support

Uri Mashiach (1):
  arm: am57xx: cl-som-am57x: update default env

 arch/arm/mach-omap2/omap5/Kconfig  |   4 +
 board/compulab/cl-som-am57x/Kconfig|  12 ++
 board/compulab/cl-som-am57x/MAINTAINERS|   6 +
 board/compulab/cl-som-am57x/Makefile   |  17 +++
 board/compulab/cl-som-am57x/cl-som-am57x.c |  76 ++
 board/compulab/cl-som-am57x/eth.c  | 199 ++
 board/compulab/cl-som-am57x/mux.c  | 123 
 board/compulab/cl-som-am57x/spl.c  | 222 +
 configs/cl-som-am57x_defconfig |  41 ++
 include/configs/cl-som-am57x.h | 197 +
 10 files changed, 897 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/Kconfig
 create mode 100644 board/compulab/cl-som-am57x/MAINTAINERS
 create mode 100644 board/compulab/cl-som-am57x/Makefile
 create mode 100644 board/compulab/cl-som-am57x/cl-som-am57x.c
 create mode 100644 board/compulab/cl-som-am57x/eth.c
 create mode 100644 board/compulab/cl-som-am57x/mux.c
 create mode 100644 board/compulab/cl-som-am57x/spl.c
 create mode 100644 configs/cl-som-am57x_defconfig
 create mode 100644 include/configs/cl-som-am57x.h

-- 
2.7.4

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


[U-Boot] [PATCH v3 4/4] arm: am57xx: cl-som-am57x: update default env

2016-12-08 Thread Uri Mashiach
Modify U-Boot default env settings.

Boot sequence:
1. SD card boot script
2. SD card boot no script
3. SATA boot script
4. SATA boot no script
5. eMMC boot script
6. eMMC boot no script

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
 include/configs/cl-som-am57x.h | 61 ++
 1 file changed, 61 insertions(+)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index 2001b0c..8297182 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -133,4 +133,65 @@
 
 #endif /* !CONFIG_SPL_BUILD */
 
+/* Default environment */
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+   DEFAULT_LINUX_BOOT_ENV \
+   "autoload=no\0" \
+   "baudrate=115200\0" \
+   "console=ttyO2,115200n8\0" \
+   "bootdelay=3\0" \
+   "fdtfile=am57xx-sbc-am57x.dtb\0" \
+   "kernel=zImage-cl-som-am57x\0" \
+   "bootscr=bootscr.img\0" \
+   "displaytype=hdmi\0" \
+   "bootkernel=bootz ${loadaddr} - ${fdtaddr}\0" \
+   "mmcloadfdt=load mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
+   "mmcloadkernel=load mmc ${mmcdev} ${loadaddr} ${kernel}\0" \
+   "load_mmc=mmc dev ${mmcdev} && mmc rescan && " \
+   "run mmcloadkernel run mmcloadfdt\0" \
+   "mmcroot=/dev/mmcblk1p2\0" \
+   "mmcrootfstype=ext4 rw rootwait\0" \
+   "mmcargs=setenv bootargs console=${console} root=${mmcroot} " \
+   "rootfstype=${mmcrootfstype}\0" \
+   "mmcbootscript=setenv mmcdev 0; mmc dev ${mmcdev} && mmc rescan && " \
+   "load mmc ${mmcdev} ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from MMC/SD Card ... && " \
+   "source ${loadaddr}\0" \
+   "mmcboot=setenv mmcdev 0 && run load_mmc && " \
+   "run mmcargs && echo Booting from MMC/SD Card ... && " \
+   "run bootkernel\0" \
+   "emmcroot=/dev/mmcblk0p2\0" \
+   "emmcrootfstype=ext4 rw rootwait\0" \
+   "emmcargs=setenv bootargs console=${console} " \
+   "root=${emmcroot} " \
+   "rootfstype=${emmcrootfstype}\0" \
+   "emmcbootscript=setenv mmcdev 1; mmc dev ${mmcdev} && mmc rescan && " \
+   "load mmc ${mmcdev} ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from eMMC ... && " \
+   "source ${loadaddr}\0" \
+   "emmcboot=setenv mmcdev 1 && run load_mmc && " \
+   "run emmcargs && echo Booting from eMMC ... && " \
+   "run bootkernel\0" \
+   "sataroot=/dev/sda2\0" \
+   "satarootfstype=ext4 rw rootwait\0" \
+   "load_sata=load scsi 0 ${loadaddr} ${kernel} && " \
+   "load scsi 0 ${fdtaddr} ${fdtfile}\0" \
+   "sataargs=setenv bootargs console=${console} " \
+   "root=${sataroot} " \
+   "rootfstype=${satarootfstype}\0" \
+   "satabootscript=load scsi 0 ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from SATA ... && " \
+   "source ${loadaddr}\0" \
+   "sataboot=run load_sata && run sataargs && " \
+   "echo Booting from SATA ... && " \
+   "run bootkernel\0" \
+
+#undef CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND \
+   "run mmcbootscript || run mmcboot || " \
+   "run satabootscript || run sataboot || " \
+   "run emmcbootscript || run emmcboot"
+
+
 #endif /* __CONFIG_CL_SOM_AM57X_H */
-- 
2.7.4

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


Re: [U-Boot] [PATCH v2 1/4] arm: am57xx: cl-som-am57x: add initial board support

2016-12-06 Thread Uri Mashiach

Hi Tom,

Sending again - reply all

On 12/05/2016 05:28 PM, Tom Rini wrote:

On Mon, Dec 05, 2016 at 10:27:55AM +0200, Uri Mashiach wrote:


From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Features supported :

* Serial console
* SPI Flash
* MMC/SD Card
* eMMC storage
* SATA
* PCA9555 - GPIO expander over I2C5 bus
* USB

Use spl alternate boot device feature to define fallback to
the main boot device as it is defined by hardware.

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
[uri.mashi...@compulab.co.il: Adjust to v2016.11]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>

[snip]

+++ b/configs/cl-som-am57x_defconfig
@@ -0,0 +1,41 @@
+CONFIG_ARM=y
+CONFIG_OMAP54XX=y
+# CONFIG_SPL_NAND_SUPPORT is not set
+CONFIG_TARGET_CL_SOM_AM57X=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_SPL=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_BOOTZ=y


Are you intentionally not enabling the generic distro framework?



Will be tested and included in the next CL-SOM-AM57x patch set.


[snip]

+++ b/include/configs/cl-som-am57x.h

[snip]

+/* SPI SPL defines */
+#undef CONFIG_SPL_OS_BOOT


This isn't needed, it's moved to Kconfig and defaults to off.



Will be updated in v2


Thanks!



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


[U-Boot] [PATCH v2 2/4] arm: am57xx: cl-som-am57x: fetch board rev from EEPROM

2016-12-05 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Add PCB revision message.
Implement board revision get_board_rev API.

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
Commit description update.
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
 board/compulab/cl-som-am57x/cl-som-am57x.c | 14 ++
 include/configs/cl-som-am57x.h | 14 ++
 2 files changed, 28 insertions(+)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index 4bad644..bdd0a2b 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -14,6 +14,8 @@
 #include 
 #include 
 #include 
+#include "../common/common.h"
+#include "../common/eeprom.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -60,3 +62,15 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 #endif /* CONFIG_USB_XHCI_OMAP */
+
+int misc_init_r(void)
+{
+   cl_print_pcb_info();
+
+   return 0;
+}
+
+u32 get_board_rev(void)
+{
+   return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS);
+}
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index 46a19b3..b268d43 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -24,6 +24,10 @@
 
 #include 
 
+/* misc */
+#define CONFIG_MISC_INIT_R
+#define CONFIG_REVISION_TAG
+
 /* Status LED */
 #define CONFIG_STATUS_LED  /* Status LED enabled */
 #define CONFIG_GPIO_LED
@@ -66,6 +70,16 @@
 #define CONFIG_ENV_OFFSET  (768 * 1024)
 #define CONFIG_ENV_SPI_MAX_HZ  4800
 
+/* EEPROM */
+#define CONFIG_SYS_I2C_EEPROM_ADDR  0x50
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN  1
+#define CONFIG_SYS_I2C_EEPROM_BUS   3
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_CMD_EEPROM_LAYOUT
+#define CONFIG_ENV_EEPROM_IS_ON_I2C
+#define CONFIG_SYS_EEPROM_SIZE 256
+
 #ifndef CONFIG_SPL_BUILD
 /* SATA */
 #define CONFIG_CMD_SCSI
-- 
2.7.4

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


[U-Boot] [PATCH v2 3/4] arm: am57xx: cl-som-am57x: add ETH support

2016-12-05 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Add MAC support.

Use PHY, connected to RGMII1 as a default Eth adapter,
by appropriate setting of 'cpsw_data.active_slave'.

'cpsw_phy' env variable can override this setting.

Set the MAC addresses in the U-Boot environment.
The addresses are retrieved from the on-board EEPROM or from the SOC's
MAC fuses.

Set the following PHYs RGMII clock delays:
- Enable RX delay
- Disable TX delay

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
[uri.mashi...@compulab.co.il: add RGMII clock delays]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 board/compulab/cl-som-am57x/Makefile |   2 +
 board/compulab/cl-som-am57x/eth.c| 199 +++
 board/compulab/cl-som-am57x/mux.c|  23 
 include/configs/cl-som-am57x.h   |  17 +++
 4 files changed, 241 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/eth.c

diff --git a/board/compulab/cl-som-am57x/Makefile 
b/board/compulab/cl-som-am57x/Makefile
index 0c59781..566366b 100644
--- a/board/compulab/cl-som-am57x/Makefile
+++ b/board/compulab/cl-som-am57x/Makefile
@@ -13,3 +13,5 @@ obj-y += spl.o mux.o
 else
 obj-y  += cl-som-am57x.o mux.o
 endif
+
+obj-$(CONFIG_DRIVER_TI_CPSW)   += eth.o
diff --git a/board/compulab/cl-som-am57x/eth.c 
b/board/compulab/cl-som-am57x/eth.c
new file mode 100644
index 000..ce91b7f
--- /dev/null
+++ b/board/compulab/cl-som-am57x/eth.c
@@ -0,0 +1,199 @@
+/*
+ * Ethernet specific code for CompuLab CL-SOM-AM57x module
+ *
+ * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
+ *
+ * Author: Uri Mashiach <uri.mashi...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../common/eeprom.h"
+
+static void cpsw_control(int enabled)
+{
+   /* VTP can be added here */
+}
+
+static struct cpsw_slave_data cl_som_am57x_cpsw_slaves[] = {
+   {
+   .slave_reg_ofs  = 0x208,
+   .sliver_reg_ofs = 0xd80,
+   .phy_addr   = 0,
+   .phy_if = PHY_INTERFACE_MODE_RMII,
+   },
+   {
+   .slave_reg_ofs  = 0x308,
+   .sliver_reg_ofs = 0xdc0,
+   .phy_addr   = 1,
+   .phy_if = PHY_INTERFACE_MODE_RMII,
+
+   },
+};
+
+static struct cpsw_platform_data cl_som_am57_cpsw_data = {
+   .mdio_base  = CPSW_MDIO_BASE,
+   .cpsw_base  = CPSW_BASE,
+   .mdio_div   = 0xff,
+   .channels   = 8,
+   .cpdma_reg_ofs  = 0x800,
+   .slaves = 2,
+   .slave_data = cl_som_am57x_cpsw_slaves,
+   .ale_reg_ofs= 0xd00,
+   .ale_entries= 1024,
+   .host_port_reg_ofs  = 0x108,
+   .hw_stats_reg_ofs   = 0x900,
+   .bd_ram_ofs = 0x2000,
+   .mac_control= (1 << 5),
+   .control= cpsw_control,
+   .host_port_num  = 0,
+   .version= CPSW_CTRL_VERSION_2,
+};
+
+/*
+ * cl_som_am57x_efuse_read_mac_addr() - read Ethernet port MAC address.
+ *   The information is retrieved from the SOC's registers.
+ * @buff: read buffer.
+ * @port_num: port number.
+ */
+static void cl_som_am57x_efuse_read_mac_addr(uchar *buff, uint port_num)
+{
+   uint32_t mac_hi, mac_lo;
+
+   if (port_num) {
+   mac_lo = readl((*ctrl)->control_core_mac_id_1_lo);
+   mac_hi = readl((*ctrl)->control_core_mac_id_1_hi);
+   } else {
+   mac_lo = readl((*ctrl)->control_core_mac_id_0_lo);
+   mac_hi = readl((*ctrl)->control_core_mac_id_0_hi);
+   }
+
+   buff[0] = (mac_hi & 0xFF) >> 16;
+   buff[1] = (mac_hi & 0xFF00) >> 8;
+   buff[2] = mac_hi & 0xFF;
+   buff[3] = (mac_lo & 0xFF) >> 16;
+   buff[4] = (mac_lo & 0xFF00) >> 8;
+   buff[5] = mac_lo & 0xFF;
+}
+
+/*
+ * cl_som_am57x_handle_mac_address() - set MAC address in the U-Boot
+ * environment.
+ *  The address is retrieved retrieved from an EEPROM field or from the
+ * SOC's registers.
+ * @env_name: U-Boot environment name.
+ * @field_name: EEPROM field name.
+ * @port_num: SOC's port number.
+ */
+static int cl_som_am57x_handle_mac_address(char *env_name, uint port_num)
+{
+   int ret;
+   uint8_t enetaddr[6];
+
+   ret = eth_getenv_enetaddr(env_name, enetaddr);
+   if (ret)
+   return 0;
+
+   ret = cl_eeprom_read_mac_addr(enetaddr, CONFIG_SYS_I2C_EEPROM_BUS);
+
+   if (ret || !is_valid_ethaddr(enetaddr))
+   cl_som_am57x_efuse_read_mac_addr(enetaddr, port_num);
+
+   if (!is_valid_ethaddr(enetaddr))
+   return -1;
+
+   ret = eth_setenv_enetaddr(env_name,

[U-Boot] [PATCH v2 1/4] arm: am57xx: cl-som-am57x: add initial board support

2016-12-05 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Features supported :

* Serial console
* SPI Flash
* MMC/SD Card
* eMMC storage
* SATA
* PCA9555 - GPIO expander over I2C5 bus
* USB

Use spl alternate boot device feature to define fallback to
the main boot device as it is defined by hardware.

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
[uri.mashi...@compulab.co.il: Adjust to v2016.11]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
---
v1 -> v2: Merged with commit "add MMC as a boot devices for spl".
  Commit "add MMC as a boot devices for spl" converted to Kconfig

 arch/arm/mach-omap2/omap5/Kconfig  |   4 +
 board/compulab/cl-som-am57x/Kconfig|  12 ++
 board/compulab/cl-som-am57x/MAINTAINERS|   6 +
 board/compulab/cl-som-am57x/Makefile   |  15 ++
 board/compulab/cl-som-am57x/cl-som-am57x.c |  62 
 board/compulab/cl-som-am57x/mux.c  | 100 +
 board/compulab/cl-som-am57x/spl.c  | 222 +
 configs/cl-som-am57x_defconfig |  41 ++
 include/configs/cl-som-am57x.h | 106 ++
 9 files changed, 568 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/Kconfig
 create mode 100644 board/compulab/cl-som-am57x/MAINTAINERS
 create mode 100644 board/compulab/cl-som-am57x/Makefile
 create mode 100644 board/compulab/cl-som-am57x/cl-som-am57x.c
 create mode 100644 board/compulab/cl-som-am57x/mux.c
 create mode 100644 board/compulab/cl-som-am57x/spl.c
 create mode 100644 configs/cl-som-am57x_defconfig
 create mode 100644 include/configs/cl-som-am57x.h

diff --git a/arch/arm/mach-omap2/omap5/Kconfig 
b/arch/arm/mach-omap2/omap5/Kconfig
index 22259dc..0ee5ac1 100644
--- a/arch/arm/mach-omap2/omap5/Kconfig
+++ b/arch/arm/mach-omap2/omap5/Kconfig
@@ -40,6 +40,9 @@ choice
prompt "OMAP5 board select"
optional
 
+config TARGET_CL_SOM_AM57X
+   bool "CompuLab CL-SOM-AM57x"
+
 config TARGET_CM_T54
bool "CompuLab CM-T54"
 
@@ -86,6 +89,7 @@ config TI_SECURE_EMIF_PROTECTED_REGION_SIZE
  using hardware memory firewalls. This value must be smaller than the
  TI_SECURE_EMIF_TOTAL_REGION_SIZE value.
 
+source "board/compulab/cl-som-am57x/Kconfig"
 source "board/compulab/cm_t54/Kconfig"
 source "board/ti/omap5_uevm/Kconfig"
 source "board/ti/dra7xx/Kconfig"
diff --git a/board/compulab/cl-som-am57x/Kconfig 
b/board/compulab/cl-som-am57x/Kconfig
new file mode 100644
index 000..85fc9a1
--- /dev/null
+++ b/board/compulab/cl-som-am57x/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_CL_SOM_AM57X
+
+config SYS_BOARD
+   default "cl-som-am57x"
+
+config SYS_VENDOR
+   default "compulab"
+
+config SYS_CONFIG_NAME
+   default "cl-som-am57x"
+
+endif
diff --git a/board/compulab/cl-som-am57x/MAINTAINERS 
b/board/compulab/cl-som-am57x/MAINTAINERS
new file mode 100644
index 000..e0195f4
--- /dev/null
+++ b/board/compulab/cl-som-am57x/MAINTAINERS
@@ -0,0 +1,6 @@
+CL-SOM-AM57x BOARD
+M: Uri Mashiach <uri.mashi...@compulab.co.il>
+S: Maintained
+F: board/compulab/cl-som-am57x/
+F: include/configs/cl-som-am57x.h
+F: configs/cl-som-am57x_defconfig
diff --git a/board/compulab/cl-som-am57x/Makefile 
b/board/compulab/cl-som-am57x/Makefile
new file mode 100644
index 000..0c59781
--- /dev/null
+++ b/board/compulab/cl-som-am57x/Makefile
@@ -0,0 +1,15 @@
+#
+# Makefile
+#
+# (C) Copyright 2016 CompuLab, Ltd. 
+#
+# Author: Dmitry Lifshitz <lifsh...@compulab.co.il>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifdef CONFIG_SPL_BUILD
+obj-y  += spl.o mux.o
+else
+obj-y  += cl-som-am57x.o mux.o
+endif
diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
new file mode 100644
index 000..4bad644
--- /dev/null
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -0,0 +1,62 @@
+/*
+ * Board functions for CompuLab cl_som_am57x board
+ *
+ * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
+ *
+ * Author: Dmitry Lifshitz <lifsh...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+const struct omap_sysinfo sysinfo = {
+   "Board: CL-SOM-AM57x\n"
+};
+
+int board_init(void)
+{
+   /* Disable PMIC Powerhold feature, DEV_CTRL.DEV_ON = 1 */
+   palmas_i2c_write_u8(TPS65903X_CHIP_P1, 0xA0, 0x1);
+
+   gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+   return 0;
+}
+
+#ifdef CONFIG_GENERIC_MMC
+#define SB_SOM_CD_GPIO 187
+#define SB_SOM_WP_GPIO 188
+
+int board_mmc_init(bd_t *bis)
+{
+   int ret0, ret1;
+
+   ret0 = omap_mmc_init(0, 0, 0, SB_SOM_CD_GPIO, SB_SOM_WP_GPIO);
+   if (ret0)

[U-Boot] [PATCH v2 4/4] arm: am57xx: cl-som-am57x: update default env

2016-12-05 Thread Uri Mashiach
Modify U-Boot default env settings.

Boot sequence:
1. SD card boot script
2. SD card boot no script
3. SATA boot script
4. SATA boot no script
5. eMMC boot script
6. eMMC boot no script

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Reviewed-by: Tom Rini <tr...@konsulko.com>
---
 include/configs/cl-som-am57x.h | 61 ++
 1 file changed, 61 insertions(+)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index 839383f..b4364d4 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -134,4 +134,65 @@
 
 #endif /* !CONFIG_SPL_BUILD */
 
+/* Default environment */
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+   DEFAULT_LINUX_BOOT_ENV \
+   "autoload=no\0" \
+   "baudrate=115200\0" \
+   "console=ttyO2,115200n8\0" \
+   "bootdelay=3\0" \
+   "fdtfile=am57xx-sbc-am57x.dtb\0" \
+   "kernel=zImage-cl-som-am57x\0" \
+   "bootscr=bootscr.img\0" \
+   "displaytype=hdmi\0" \
+   "bootkernel=bootz ${loadaddr} - ${fdtaddr}\0" \
+   "mmcloadfdt=load mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
+   "mmcloadkernel=load mmc ${mmcdev} ${loadaddr} ${kernel}\0" \
+   "load_mmc=mmc dev ${mmcdev} && mmc rescan && " \
+   "run mmcloadkernel run mmcloadfdt\0" \
+   "mmcroot=/dev/mmcblk1p2\0" \
+   "mmcrootfstype=ext4 rw rootwait\0" \
+   "mmcargs=setenv bootargs console=${console} root=${mmcroot} " \
+   "rootfstype=${mmcrootfstype}\0" \
+   "mmcbootscript=setenv mmcdev 0; mmc dev ${mmcdev} && mmc rescan && " \
+   "load mmc ${mmcdev} ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from MMC/SD Card ... && " \
+   "source ${loadaddr}\0" \
+   "mmcboot=setenv mmcdev 0 && run load_mmc && " \
+   "run mmcargs && echo Booting from MMC/SD Card ... && " \
+   "run bootkernel\0" \
+   "emmcroot=/dev/mmcblk0p2\0" \
+   "emmcrootfstype=ext4 rw rootwait\0" \
+   "emmcargs=setenv bootargs console=${console} " \
+   "root=${emmcroot} " \
+   "rootfstype=${emmcrootfstype}\0" \
+   "emmcbootscript=setenv mmcdev 1; mmc dev ${mmcdev} && mmc rescan && " \
+   "load mmc ${mmcdev} ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from eMMC ... && " \
+   "source ${loadaddr}\0" \
+   "emmcboot=setenv mmcdev 1 && run load_mmc && " \
+   "run emmcargs && echo Booting from eMMC ... && " \
+   "run bootkernel\0" \
+   "sataroot=/dev/sda2\0" \
+   "satarootfstype=ext4 rw rootwait\0" \
+   "load_sata=load scsi 0 ${loadaddr} ${kernel} && " \
+   "load scsi 0 ${fdtaddr} ${fdtfile}\0" \
+   "sataargs=setenv bootargs console=${console} " \
+   "root=${sataroot} " \
+   "rootfstype=${satarootfstype}\0" \
+   "satabootscript=load scsi 0 ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from SATA ... && " \
+   "source ${loadaddr}\0" \
+   "sataboot=run load_sata && run sataargs && " \
+   "echo Booting from SATA ... && " \
+   "run bootkernel\0" \
+
+#undef CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND \
+   "run mmcbootscript || run mmcboot || " \
+   "run satabootscript || run sataboot || " \
+   "run emmcbootscript || run emmcboot"
+
+
 #endif /* __CONFIG_CL_SOM_AM57X_H */
-- 
2.7.4

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


[U-Boot] [PATCH v2 0/4] cl-som-am57x: initial support

2016-12-05 Thread Uri Mashiach
This patch series adds support for CompuLab CL-SOM-AM57X board and the
SBC-AM57X evaluation kit.

CL-SOM-AM57x is a miniature System-on-Module (SoM) based on
TI Sitara AM57x ARM Cortex-A15 System-on-Chip family.

SBC-AM57x is a single board computer, implemented with the
CL-SOM-AM57x computer-on-module and the SB-SOM-AM57x carrier board.
The CL-SOM-AM57x providing most of the functions and the SB-SOM-AM57x providing
additional peripheral functions and connectors.

The SBC-AM57x has the following features:


CPU:Texas Instruments Sitara AM5728 dual-core ARM Cortex-A15, 
1.5GHz or
Texas Instruments Sitara AM5718 single-core ARM Cortex-A15, 
1.5GHz

RAM:DDR3, 512MB – 4GB

Storage:NAND flash, 512MB - 1GB or eMMC flash, 4GB - 32GB
SPI-flash 2MB

Ethernet:   Up to 2x 10/100/1000Mbps Ethernet ports (MAC+PHY)

WiFi/BT:802.11b/g/n WiFi interface (TI WiLink 8 WL1801 chipset) or
Dual-band 2x2 802.11a/b/g/n WiFi interface (TI WiLink 8 WL1837 
chipset)

Analog Audio:   Audio codec with stereo output, stereo input and microphone 
support

More details can be found here:

https://www.compulab.co.il/products/computer-on-modules/cl-som-am57x-ti-am5728-am5718-system-on-module/

https://www.compulab.co.il/products/sbcs/sbc-am57x-ti-am5728-am5718-single-board-computer/

Dmitry Lifshitz (3):
  arm: am57xx: cl-som-am57x: add initial board support
  arm: am57xx: cl-som-am57x: fetch board rev from EEPROM
  arm: am57xx: cl-som-am57x: add ETH support

Uri Mashiach (1):
  arm: am57xx: cl-som-am57x: update default env

 arch/arm/mach-omap2/omap5/Kconfig  |   4 +
 board/compulab/cl-som-am57x/Kconfig|  12 ++
 board/compulab/cl-som-am57x/MAINTAINERS|   6 +
 board/compulab/cl-som-am57x/Makefile   |  17 +++
 board/compulab/cl-som-am57x/cl-som-am57x.c |  76 ++
 board/compulab/cl-som-am57x/eth.c  | 199 ++
 board/compulab/cl-som-am57x/mux.c  | 123 
 board/compulab/cl-som-am57x/spl.c  | 222 +
 configs/cl-som-am57x_defconfig |  41 ++
 include/configs/cl-som-am57x.h | 198 +
 10 files changed, 898 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/Kconfig
 create mode 100644 board/compulab/cl-som-am57x/MAINTAINERS
 create mode 100644 board/compulab/cl-som-am57x/Makefile
 create mode 100644 board/compulab/cl-som-am57x/cl-som-am57x.c
 create mode 100644 board/compulab/cl-som-am57x/eth.c
 create mode 100644 board/compulab/cl-som-am57x/mux.c
 create mode 100644 board/compulab/cl-som-am57x/spl.c
 create mode 100644 configs/cl-som-am57x_defconfig
 create mode 100644 include/configs/cl-som-am57x.h

-- 
2.7.4

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


Re: [U-Boot] [PATCH 1/5] arm: am57xx: cl-som-am57x: add initial board support

2016-12-03 Thread Uri Mashiach

Hello Tom,

On 12/01/2016 05:36 PM, Tom Rini wrote:
> On Thu, Dec 01, 2016 at 10:28:12AM +0200, Uri Mashiach wrote:
>
>> From: Dmitry Lifshitz <lifsh...@compulab.co.il>
>>
>> Features supported :
>>
>> * Serial console
>> * SPI Flash
>> * MMC/SD Card
>> * eMMC storage
>> * SATA
>> * PCA9555 - GPIO expander over I2C5 bus
>> * USB
>>
>> Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
>> [uri.mashi...@compulab.co.il: Adjust to v2016.11]
>> Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
>> Acked-by: Igor Grinberg <grinb...@compulab.co.il>
>
> In general:
>
> Reviewed-by: Tom Rini <tr...@konsulko.com>
>
> [snip]
>> +/* Status LED */
>> +#define CONFIG_STATUS_LED /* Status LED enabled */
>> +#define CONFIG_GPIO_LED
>> +#define CONFIG_BOARD_SPECIFIC_LED
>> +#define GREEN_LED_DEV 0
>> +  /* cl_som_am57x Green LED is GPIO2_5 
*/
>> +#define GREEN_LED_GPIO37
>> +#define STATUS_LED_BITGREEN_LED_GPIO
>> +#define STATUS_LED_STATE  STATUS_LED_ON
>> +#define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
>
> Do you have time to look at moving CONFIG_STATUS_LED and related defines
> to Kconfig (or where makes more sense, include/status_led.h) ?  I see
> this is used on a few CompuLab boards so you'd be able to test the
> changes as well, thanks!
>

I prefer that the CL-COM-AM57x module will be included the next release.
The Kconfig migration of the status LED will be sent as a separate patch 
set.

Please let me know which of the following options is preferred:
1. Remove the current patch from the set and add a separate patch after 
the Kconfig migration of the status LED.

2. Leave the current patch in the patch set and send a
separated update patch after the Kconfig migration of the status LED.

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


[U-Boot] [PATCH 3/5] arm: am57xx: cl-som-am57x: fetch board rev from EEPROM

2016-12-01 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Add PCB revision message.
Implement board revision get_board_rev API.

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
Commit description update.
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 board/compulab/cl-som-am57x/cl-som-am57x.c | 14 ++
 include/configs/cl-som-am57x.h | 14 ++
 2 files changed, 28 insertions(+)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
index 4bad644..bdd0a2b 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -14,6 +14,8 @@
 #include 
 #include 
 #include 
+#include "../common/common.h"
+#include "../common/eeprom.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -60,3 +62,15 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 #endif /* CONFIG_USB_XHCI_OMAP */
+
+int misc_init_r(void)
+{
+   cl_print_pcb_info();
+
+   return 0;
+}
+
+u32 get_board_rev(void)
+{
+   return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS);
+}
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index dfceebb..65e506a 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -24,6 +24,10 @@
 
 #include 
 
+/* misc */
+#define CONFIG_MISC_INIT_R
+#define CONFIG_REVISION_TAG
+
 /* Status LED */
 #define CONFIG_STATUS_LED  /* Status LED enabled */
 #define CONFIG_GPIO_LED
@@ -72,6 +76,16 @@
 #define CONFIG_ENV_OFFSET  (768 * 1024)
 #define CONFIG_ENV_SPI_MAX_HZ  4800
 
+/* EEPROM */
+#define CONFIG_SYS_I2C_EEPROM_ADDR  0x50
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN  1
+#define CONFIG_SYS_I2C_EEPROM_BUS   3
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_CMD_EEPROM_LAYOUT
+#define CONFIG_ENV_EEPROM_IS_ON_I2C
+#define CONFIG_SYS_EEPROM_SIZE 256
+
 #ifndef CONFIG_SPL_BUILD
 /* SATA */
 #define CONFIG_CMD_SCSI
-- 
2.7.4

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


[U-Boot] [PATCH 1/5] arm: am57xx: cl-som-am57x: add initial board support

2016-12-01 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Features supported :

* Serial console
* SPI Flash
* MMC/SD Card
* eMMC storage
* SATA
* PCA9555 - GPIO expander over I2C5 bus
* USB

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
[uri.mashi...@compulab.co.il: Adjust to v2016.11]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 arch/arm/cpu/armv7/omap5/Kconfig   |   4 +
 board/compulab/cl-som-am57x/Kconfig|  12 ++
 board/compulab/cl-som-am57x/MAINTAINERS|   6 +
 board/compulab/cl-som-am57x/Makefile   |  15 ++
 board/compulab/cl-som-am57x/cl-som-am57x.c |  62 
 board/compulab/cl-som-am57x/mux.c  | 100 +
 board/compulab/cl-som-am57x/spl.c  | 222 +
 configs/cl-som-am57x_defconfig |  41 ++
 include/configs/cl-som-am57x.h | 102 +
 9 files changed, 564 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/Kconfig
 create mode 100644 board/compulab/cl-som-am57x/MAINTAINERS
 create mode 100644 board/compulab/cl-som-am57x/Makefile
 create mode 100644 board/compulab/cl-som-am57x/cl-som-am57x.c
 create mode 100644 board/compulab/cl-som-am57x/mux.c
 create mode 100644 board/compulab/cl-som-am57x/spl.c
 create mode 100644 configs/cl-som-am57x_defconfig
 create mode 100644 include/configs/cl-som-am57x.h

diff --git a/arch/arm/cpu/armv7/omap5/Kconfig b/arch/arm/cpu/armv7/omap5/Kconfig
index 22259dc..0ee5ac1 100644
--- a/arch/arm/cpu/armv7/omap5/Kconfig
+++ b/arch/arm/cpu/armv7/omap5/Kconfig
@@ -40,6 +40,9 @@ choice
prompt "OMAP5 board select"
optional
 
+config TARGET_CL_SOM_AM57X
+   bool "CompuLab CL-SOM-AM57x"
+
 config TARGET_CM_T54
bool "CompuLab CM-T54"
 
@@ -86,6 +89,7 @@ config TI_SECURE_EMIF_PROTECTED_REGION_SIZE
  using hardware memory firewalls. This value must be smaller than the
  TI_SECURE_EMIF_TOTAL_REGION_SIZE value.
 
+source "board/compulab/cl-som-am57x/Kconfig"
 source "board/compulab/cm_t54/Kconfig"
 source "board/ti/omap5_uevm/Kconfig"
 source "board/ti/dra7xx/Kconfig"
diff --git a/board/compulab/cl-som-am57x/Kconfig 
b/board/compulab/cl-som-am57x/Kconfig
new file mode 100644
index 000..85fc9a1
--- /dev/null
+++ b/board/compulab/cl-som-am57x/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_CL_SOM_AM57X
+
+config SYS_BOARD
+   default "cl-som-am57x"
+
+config SYS_VENDOR
+   default "compulab"
+
+config SYS_CONFIG_NAME
+   default "cl-som-am57x"
+
+endif
diff --git a/board/compulab/cl-som-am57x/MAINTAINERS 
b/board/compulab/cl-som-am57x/MAINTAINERS
new file mode 100644
index 000..e0195f4
--- /dev/null
+++ b/board/compulab/cl-som-am57x/MAINTAINERS
@@ -0,0 +1,6 @@
+CL-SOM-AM57x BOARD
+M: Uri Mashiach <uri.mashi...@compulab.co.il>
+S: Maintained
+F: board/compulab/cl-som-am57x/
+F: include/configs/cl-som-am57x.h
+F: configs/cl-som-am57x_defconfig
diff --git a/board/compulab/cl-som-am57x/Makefile 
b/board/compulab/cl-som-am57x/Makefile
new file mode 100644
index 000..0c59781
--- /dev/null
+++ b/board/compulab/cl-som-am57x/Makefile
@@ -0,0 +1,15 @@
+#
+# Makefile
+#
+# (C) Copyright 2016 CompuLab, Ltd. 
+#
+# Author: Dmitry Lifshitz <lifsh...@compulab.co.il>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifdef CONFIG_SPL_BUILD
+obj-y  += spl.o mux.o
+else
+obj-y  += cl-som-am57x.o mux.o
+endif
diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c 
b/board/compulab/cl-som-am57x/cl-som-am57x.c
new file mode 100644
index 000..4bad644
--- /dev/null
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -0,0 +1,62 @@
+/*
+ * Board functions for CompuLab cl_som_am57x board
+ *
+ * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
+ *
+ * Author: Dmitry Lifshitz <lifsh...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+const struct omap_sysinfo sysinfo = {
+   "Board: CL-SOM-AM57x\n"
+};
+
+int board_init(void)
+{
+   /* Disable PMIC Powerhold feature, DEV_CTRL.DEV_ON = 1 */
+   palmas_i2c_write_u8(TPS65903X_CHIP_P1, 0xA0, 0x1);
+
+   gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+   return 0;
+}
+
+#ifdef CONFIG_GENERIC_MMC
+#define SB_SOM_CD_GPIO 187
+#define SB_SOM_WP_GPIO 188
+
+int board_mmc_init(bd_t *bis)
+{
+   int ret0, ret1;
+
+   ret0 = omap_mmc_init(0, 0, 0, SB_SOM_CD_GPIO, SB_SOM_WP_GPIO);
+   if (ret0)
+   printf("cl-som-am57x: failed to initialize mmc0\n");
+
+   ret1 = omap_mmc_init(1, 0, 0, -1, -1);
+   if (ret1)
+   printf("cl-som-am57x: failed to initialize mmc1\n");
+
+   return ret0 && ret1;

[U-Boot] [PATCH 2/5] arm: am57xx: cl-som-am57x: add MMC as a boot devices for spl

2016-12-01 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Use spl alternate boot device feature to define fallback to
the main boot device as it is defined by hardware.

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 include/configs/cl-som-am57x.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index 1be55e5..dfceebb 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -53,6 +53,16 @@
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
 
+/* SD/MMC RAW boot */
+#undef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
+#undef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
+#undef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
+#undef CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS
+
+/* Offsets: 128K - SPL1, 256K - SPL2, 384K - U-Boot */
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /*  0x6 - 384K */
+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS  0x400 /* 512 K */
+
 /* Environment */
 #define CONFIG_ENV_SIZE(16 << 10) /* 16 KiB env size */
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-- 
2.7.4

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


[U-Boot] [PATCH 4/5] arm: am57xx: cl-som-am57x: add ETH support

2016-12-01 Thread Uri Mashiach
From: Dmitry Lifshitz <lifsh...@compulab.co.il>

Add MAC support.

Use PHY, connected to RGMII1 as a default Eth adapter,
by appropriate setting of 'cpsw_data.active_slave'.

'cpsw_phy' env variable can override this setting.

Set the MAC addresses in the U-Boot environment.
The addresses are retrieved from the on-board EEPROM or from the SOC's
MAC fuses.

Set the following PHYs RGMII clock delays:
- Enable RX delay
- Disable TX delay

Signed-off-by: Dmitry Lifshitz <lifsh...@compulab.co.il>
[uri.mashi...@compulab.co.il: add RGMII clock delays]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 board/compulab/cl-som-am57x/Makefile |   2 +
 board/compulab/cl-som-am57x/eth.c| 199 +++
 board/compulab/cl-som-am57x/mux.c|  23 
 include/configs/cl-som-am57x.h   |  17 +++
 4 files changed, 241 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/eth.c

diff --git a/board/compulab/cl-som-am57x/Makefile 
b/board/compulab/cl-som-am57x/Makefile
index 0c59781..566366b 100644
--- a/board/compulab/cl-som-am57x/Makefile
+++ b/board/compulab/cl-som-am57x/Makefile
@@ -13,3 +13,5 @@ obj-y += spl.o mux.o
 else
 obj-y  += cl-som-am57x.o mux.o
 endif
+
+obj-$(CONFIG_DRIVER_TI_CPSW)   += eth.o
diff --git a/board/compulab/cl-som-am57x/eth.c 
b/board/compulab/cl-som-am57x/eth.c
new file mode 100644
index 000..ce91b7f
--- /dev/null
+++ b/board/compulab/cl-som-am57x/eth.c
@@ -0,0 +1,199 @@
+/*
+ * Ethernet specific code for CompuLab CL-SOM-AM57x module
+ *
+ * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
+ *
+ * Author: Uri Mashiach <uri.mashi...@compulab.co.il>
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../common/eeprom.h"
+
+static void cpsw_control(int enabled)
+{
+   /* VTP can be added here */
+}
+
+static struct cpsw_slave_data cl_som_am57x_cpsw_slaves[] = {
+   {
+   .slave_reg_ofs  = 0x208,
+   .sliver_reg_ofs = 0xd80,
+   .phy_addr   = 0,
+   .phy_if = PHY_INTERFACE_MODE_RMII,
+   },
+   {
+   .slave_reg_ofs  = 0x308,
+   .sliver_reg_ofs = 0xdc0,
+   .phy_addr   = 1,
+   .phy_if = PHY_INTERFACE_MODE_RMII,
+
+   },
+};
+
+static struct cpsw_platform_data cl_som_am57_cpsw_data = {
+   .mdio_base  = CPSW_MDIO_BASE,
+   .cpsw_base  = CPSW_BASE,
+   .mdio_div   = 0xff,
+   .channels   = 8,
+   .cpdma_reg_ofs  = 0x800,
+   .slaves = 2,
+   .slave_data = cl_som_am57x_cpsw_slaves,
+   .ale_reg_ofs= 0xd00,
+   .ale_entries= 1024,
+   .host_port_reg_ofs  = 0x108,
+   .hw_stats_reg_ofs   = 0x900,
+   .bd_ram_ofs = 0x2000,
+   .mac_control= (1 << 5),
+   .control= cpsw_control,
+   .host_port_num  = 0,
+   .version= CPSW_CTRL_VERSION_2,
+};
+
+/*
+ * cl_som_am57x_efuse_read_mac_addr() - read Ethernet port MAC address.
+ *   The information is retrieved from the SOC's registers.
+ * @buff: read buffer.
+ * @port_num: port number.
+ */
+static void cl_som_am57x_efuse_read_mac_addr(uchar *buff, uint port_num)
+{
+   uint32_t mac_hi, mac_lo;
+
+   if (port_num) {
+   mac_lo = readl((*ctrl)->control_core_mac_id_1_lo);
+   mac_hi = readl((*ctrl)->control_core_mac_id_1_hi);
+   } else {
+   mac_lo = readl((*ctrl)->control_core_mac_id_0_lo);
+   mac_hi = readl((*ctrl)->control_core_mac_id_0_hi);
+   }
+
+   buff[0] = (mac_hi & 0xFF) >> 16;
+   buff[1] = (mac_hi & 0xFF00) >> 8;
+   buff[2] = mac_hi & 0xFF;
+   buff[3] = (mac_lo & 0xFF) >> 16;
+   buff[4] = (mac_lo & 0xFF00) >> 8;
+   buff[5] = mac_lo & 0xFF;
+}
+
+/*
+ * cl_som_am57x_handle_mac_address() - set MAC address in the U-Boot
+ * environment.
+ *  The address is retrieved retrieved from an EEPROM field or from the
+ * SOC's registers.
+ * @env_name: U-Boot environment name.
+ * @field_name: EEPROM field name.
+ * @port_num: SOC's port number.
+ */
+static int cl_som_am57x_handle_mac_address(char *env_name, uint port_num)
+{
+   int ret;
+   uint8_t enetaddr[6];
+
+   ret = eth_getenv_enetaddr(env_name, enetaddr);
+   if (ret)
+   return 0;
+
+   ret = cl_eeprom_read_mac_addr(enetaddr, CONFIG_SYS_I2C_EEPROM_BUS);
+
+   if (ret || !is_valid_ethaddr(enetaddr))
+   cl_som_am57x_efuse_read_mac_addr(enetaddr, port_num);
+
+   if (!is_valid_ethaddr(enetaddr))
+   return -1;
+
+   ret = eth_setenv_enetaddr(env_name,

[U-Boot] [PATCH 5/5] arm: am57xx: cl-som-am57x: update default env

2016-12-01 Thread Uri Mashiach
Modify U-Boot default env settings.

Boot sequence:
1. SD card boot script
2. SD card boot no script
3. SATA boot script
4. SATA boot no script
5. eMMC boot script
6. eMMC boot no script

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 include/configs/cl-som-am57x.h | 61 ++
 1 file changed, 61 insertions(+)

diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h
index a22c3e6..3a4f2d4 100644
--- a/include/configs/cl-som-am57x.h
+++ b/include/configs/cl-som-am57x.h
@@ -140,4 +140,65 @@
 
 #endif /* !CONFIG_SPL_BUILD */
 
+/* Default environment */
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+   DEFAULT_LINUX_BOOT_ENV \
+   "autoload=no\0" \
+   "baudrate=115200\0" \
+   "console=ttyO2,115200n8\0" \
+   "bootdelay=3\0" \
+   "fdtfile=am57xx-sbc-am57x.dtb\0" \
+   "kernel=zImage-cl-som-am57x\0" \
+   "bootscr=bootscr.img\0" \
+   "displaytype=hdmi\0" \
+   "bootkernel=bootz ${loadaddr} - ${fdtaddr}\0" \
+   "mmcloadfdt=load mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
+   "mmcloadkernel=load mmc ${mmcdev} ${loadaddr} ${kernel}\0" \
+   "load_mmc=mmc dev ${mmcdev} && mmc rescan && " \
+   "run mmcloadkernel run mmcloadfdt\0" \
+   "mmcroot=/dev/mmcblk1p2\0" \
+   "mmcrootfstype=ext4 rw rootwait\0" \
+   "mmcargs=setenv bootargs console=${console} root=${mmcroot} " \
+   "rootfstype=${mmcrootfstype}\0" \
+   "mmcbootscript=setenv mmcdev 0; mmc dev ${mmcdev} && mmc rescan && " \
+   "load mmc ${mmcdev} ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from MMC/SD Card ... && " \
+   "source ${loadaddr}\0" \
+   "mmcboot=setenv mmcdev 0 && run load_mmc && " \
+   "run mmcargs && echo Booting from MMC/SD Card ... && " \
+   "run bootkernel\0" \
+   "emmcroot=/dev/mmcblk0p2\0" \
+   "emmcrootfstype=ext4 rw rootwait\0" \
+   "emmcargs=setenv bootargs console=${console} " \
+   "root=${emmcroot} " \
+   "rootfstype=${emmcrootfstype}\0" \
+   "emmcbootscript=setenv mmcdev 1; mmc dev ${mmcdev} && mmc rescan && " \
+   "load mmc ${mmcdev} ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from eMMC ... && " \
+   "source ${loadaddr}\0" \
+   "emmcboot=setenv mmcdev 1 && run load_mmc && " \
+   "run emmcargs && echo Booting from eMMC ... && " \
+   "run bootkernel\0" \
+   "sataroot=/dev/sda2\0" \
+   "satarootfstype=ext4 rw rootwait\0" \
+   "load_sata=load scsi 0 ${loadaddr} ${kernel} && " \
+   "load scsi 0 ${fdtaddr} ${fdtfile}\0" \
+   "sataargs=setenv bootargs console=${console} " \
+   "root=${sataroot} " \
+   "rootfstype=${satarootfstype}\0" \
+   "satabootscript=load scsi 0 ${loadaddr} ${bootscr} && " \
+   "echo Running bootscript from SATA ... && " \
+   "source ${loadaddr}\0" \
+   "sataboot=run load_sata && run sataargs && " \
+   "echo Booting from SATA ... && " \
+   "run bootkernel\0" \
+
+#undef CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND \
+   "run mmcbootscript || run mmcboot || " \
+   "run satabootscript || run sataboot || " \
+   "run emmcbootscript || run emmcboot"
+
+
 #endif /* __CONFIG_CL_SOM_AM57X_H */
-- 
2.7.4

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


[U-Boot] [PATCH 0/5] cl-som-am57x: initial support

2016-12-01 Thread Uri Mashiach
This patch series adds support for CompuLab CL-SOM-AM57X board and the
SBC-AM57X evaluation kit.

CL-SOM-AM57x is a miniature System-on-Module (SoM) based on
TI Sitara AM57x ARM Cortex-A15 System-on-Chip family.

SBC-AM57x is a single board computer, implemented with the
CL-SOM-AM57x computer-on-module and the SB-SOM-AM57x carrier board.
The CL-SOM-AM57x providing most of the functions and the SB-SOM-AM57x providing
additional peripheral functions and connectors.

The SBC-AM57x has the following features:


CPU:Texas Instruments Sitara AM5728 dual-core ARM Cortex-A15, 
1.5GHz or
Texas Instruments Sitara AM5718 single-core ARM Cortex-A15, 
1.5GHz

RAM:DDR3, 512MB – 4GB

Storage:NAND flash, 512MB - 1GB or eMMC flash, 4GB - 32GB
SPI-flash 2MB

Ethernet:   Up to 2x 10/100/1000Mbps Ethernet ports (MAC+PHY)

WiFi/BT:802.11b/g/n WiFi interface (TI WiLink 8 WL1801 chipset) or
Dual-band 2x2 802.11a/b/g/n WiFi interface (TI WiLink 8 WL1837 
chipset)

Analog Audio:   Audio codec with stereo output, stereo input and microphone 
support

More details can be found here:

https://www.compulab.co.il/products/computer-on-modules/cl-som-am57x-ti-am5728-am5718-system-on-module/

https://www.compulab.co.il/products/sbcs/sbc-am57x-ti-am5728-am5718-single-board-computer/

Dmitry Lifshitz (4):
  arm: am57xx: cl-som-am57x: add initial board support
  arm: am57xx: cl-som-am57x: add MMC as a boot devices for spl
  arm: am57xx: cl-som-am57x: fetch board rev from EEPROM
  arm: am57xx: cl-som-am57x: add ETH support

Uri Mashiach (1):
  arm: am57xx: cl-som-am57x: update default env

 arch/arm/cpu/armv7/omap5/Kconfig   |   4 +
 board/compulab/cl-som-am57x/Kconfig|  12 ++
 board/compulab/cl-som-am57x/MAINTAINERS|   6 +
 board/compulab/cl-som-am57x/Makefile   |  17 +++
 board/compulab/cl-som-am57x/cl-som-am57x.c |  76 ++
 board/compulab/cl-som-am57x/eth.c  | 199 ++
 board/compulab/cl-som-am57x/mux.c  | 123 
 board/compulab/cl-som-am57x/spl.c  | 222 +
 configs/cl-som-am57x_defconfig |  41 ++
 include/configs/cl-som-am57x.h | 204 ++
 10 files changed, 904 insertions(+)
 create mode 100644 board/compulab/cl-som-am57x/Kconfig
 create mode 100644 board/compulab/cl-som-am57x/MAINTAINERS
 create mode 100644 board/compulab/cl-som-am57x/Makefile
 create mode 100644 board/compulab/cl-som-am57x/cl-som-am57x.c
 create mode 100644 board/compulab/cl-som-am57x/eth.c
 create mode 100644 board/compulab/cl-som-am57x/mux.c
 create mode 100644 board/compulab/cl-som-am57x/spl.c
 create mode 100644 configs/cl-som-am57x_defconfig
 create mode 100644 include/configs/cl-som-am57x.h

-- 
2.7.4

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