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

2019-09-01 Thread Marek Vasut
On 8/31/19 9:40 PM, Tom Rini wrote:
> On Thu, Aug 29, 2019 at 02:08:05PM +0200, Marek Vasut wrote:
> 
>> The following changes since commit 8c56ea5c1e033f16993e5427300399ef848234bb:
>>
>>   Merge branch 'u-boot-stm32_20190827' of
>> https://gitlab.denx.de/u-boot/custodians/u-boot-stm (2019-08-27 13:19:47
>> -0400)
>>
>> are available in the Git repository at:
>>
>>   git://git.denx.de/u-boot-usb.git master
>>
>> for you to fetch changes up to fd0637b814cdbc8aa9060f313f6c8e71fb9c5d15:
>>
>>   dwc2: use the nonblock argument in submit_int_msg (2019-08-29 14:07:26
>> +0200)
>>
> 
> NAK, this breaks nokia_rx51 and am3517_crane:
> +(nokia_rx51,am3517_crane) ../drivers/usb/musb/musb_hcd.c:1052:5: error: 
> conflicting types for 'submit_int_msg'
> +(nokia_rx51,am3517_crane)  int submit_int_msg(struct usb_device *dev, 
> unsigned long pipe,
> +(nokia_rx51,am3517_crane)  ^~
> +(nokia_rx51,am3517_crane) In file included from 
> ../drivers/usb/musb/musb_hcd.c:11:0:
> +(nokia_rx51,am3517_crane) ../include/usb.h:186:5: note: previous declaration 
> of 'submit_int_msg' was here
> +(nokia_rx51,am3517_crane)  int submit_int_msg(struct usb_device *dev, 
> unsigned long pipe, void *buffer,
> +(nokia_rx51,am3517_crane) make[2]: *** [../scripts/Makefile.build:279: 
> drivers/usb/musb/musb_hcd.o] Error 1
> +(nokia_rx51,am3517_crane) make[1]: *** [Makefile:1598: drivers/usb/musb] 
> Error 2
> +(nokia_rx51,am3517_crane) make: *** [Makefile:148: sub-make] Error 2

Aaargh! I am CCing the author of the patches ...
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] ARM: omapl138_lcdk: Setup MTDIDS and MTDPARTS

2019-09-01 Thread Adam Ford
The schematic shows the NAND to be a 256M part, and the device
tree shows the partition mapping.  This patch defines MTDIDS
and MTDPARTS to match the partition mapping found in the device
tree.

Signed-off-by: Adam Ford 

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 326ac9372b..c69b9b15c4 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -31,6 +31,8 @@ CONFIG_MX_CYCLIC=y
 CONFIG_CMD_NAND=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=nand256"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nand256:128k(u-boot env),512k(u-boot),-(free 
space)"
 CONFIG_CMD_DIAG=y
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
-- 
2.17.1

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


Re: [U-Boot] [PATCH v4 0/8] add PCIe, its PHY and AHCI support for mt7623

2019-09-01 Thread Aleksandr Rybalko
Hello fellow hackers!

anybody interesting in continue to improve Mediatek MT7623 support?
If so, please review comment and/or commit that change-set.

Thank you!


ср, 28 серп. 2019 о 12:17 Frank Wunderlich  пише:

> Any comments on this series?
>
> just a friendly reminder :)
>
> regards Frank
>


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


[U-Boot] [PATCH] ARM: omapl138_lcdk: Remove dead RMII code

2019-09-01 Thread Adam Ford
The omapl138-lcdk does not need to care about RMII code. It appears
to be more legacy code when branched from the da850-evm.  This patch
removes the #ifdefs and #defines related to the enabling/disabling
and checking for that option.

Signed-off-by: Adam Ford 

diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index 27a51d6a78..ce146550f9 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -108,12 +108,6 @@ const struct pinmux_config nand_pins[] = {
 
 #endif
 
-#ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII
-#define HAS_RMII 1
-#else
-#define HAS_RMII 0
-#endif
-
 const struct pinmux_resource pinmuxes[] = {
PINMUX_ITEM(uart_pins),
PINMUX_ITEM(i2c_pins),
@@ -216,7 +210,7 @@ int board_init(void)
 #ifdef CONFIG_DRIVER_TI_EMAC
if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
return 1;
-   davinci_emac_mii_mode_sel(HAS_RMII);
+   davinci_emac_mii_mode_sel(0);
 #endif /* CONFIG_DRIVER_TI_EMAC */
 
/* enable the console UART */
@@ -289,17 +283,6 @@ static void dspwake(void)
REG(PSC0_MDCTL + (15 * 4)) |= 0x100;
 }
 
-#ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII
-/**
- * rmii_hw_init
- *
- */
-int rmii_hw_init(void)
-{
-   return 0;
-}
-#endif /* CONFIG_DRIVER_TI_EMAC_USE_RMII */
-
 int misc_init_r(void)
 {
uint8_t tmp[20], addr[10];
@@ -325,12 +308,6 @@ int misc_init_r(void)
}
}
 
-#ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII
-   /* Select RMII fucntion through the expander */
-   if (rmii_hw_init())
-   printf("RMII hardware init failed!!!\n");
-#endif
-
dspwake();
 
return 0;
-- 
2.17.1

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


[U-Boot] [PATCH] ARM: omapl138_lcdk: Shrink code size

2019-09-01 Thread Adam Ford
In preparation to use the device tree in SPL, the code +
malloc space needs to fit into 32k of space.  This patch
reduces the code size by converting to Thumb instructions
and using tiny libraries when possible. The result is
over 7k in code size reduction in SPL and a 140k reduction
in U-Boot.

Before

   textdata bss dec hex filename
  2654440721376   319927cf8 spl/u-boot-spl
 607895   39792  129280  776967   bdb07 u-boot

After
   textdata bss dec hex filename
  1930240721376   2475060ae spl/u-boot-spl
 464666   39792  129256  633714   9ab72 u-boot

Signed-off-by: Adam Ford 

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index c69b9b15c4..7e470bf73e 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -1,4 +1,7 @@
 CONFIG_ARM=y
+CONFIG_SYS_THUMB_BUILD=y
+# CONFIG_SPL_USE_ARCH_MEMCPY is not set
+# CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_DAVINCI=y
 CONFIG_SYS_TEXT_BASE=0xc108
 CONFIG_TARGET_OMAPL138_LCDK=y
@@ -70,4 +73,5 @@ CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_MUSB_DA8XX=y
 CONFIG_USB_MUSB_PIO_ONLY=y
 CONFIG_USB_STORAGE=y
+CONFIG_SPL_TINY_MEMSET=y
 # CONFIG_SPL_OF_LIBFDT is not set
-- 
2.17.1

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


[U-Boot] [PATCH 3/5] efi_loader: EFI_SIMPLE_NETWORK.Transmit() fill header

2019-09-01 Thread Heinrich Schuchardt
Fill the media header in EFI_SIMPLE_NETWORK.Transmit().
Check that the buffer size is large enough for the header.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_net.c | 31 +--
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index bf6d5ab0b3..646540ac08 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -409,15 +409,33 @@ static efi_status_t EFIAPI efi_net_transmit
goto out;
}

-   if (header_size) {
-   /*
-* TODO: We would need to create the header
-* if header_size != 0
-*/
-   ret = EFI_UNSUPPORTED;
+   /* At least the IP header has to fit into the buffer */
+   if (buffer_size < this->mode->media_header_size) {
+   ret = EFI_BUFFER_TOO_SMALL;
goto out;
}

+   /*
+* TODO:
+* Support VLANs. Use net_set_ether() for copying the header. Use a
+* U_BOOT_ENV_CALLBACK to update the media header size.
+*/
+   if (header_size) {
+   struct ethernet_hdr *header = buffer;
+
+   if (!dest_addr || !protocol ||
+   header_size != this->mode->media_header_size) {
+   ret = EFI_INVALID_PARAMETER;
+   goto out;
+   }
+   if (!src_addr)
+   src_addr = &this->mode->current_address;
+
+   memcpy(header->et_dest, dest_addr, ARP_HLEN);
+   memcpy(header->et_src, src_addr, ARP_HLEN);
+   header->et_protlen = htons(*protocol);
+   }
+
switch (this->mode->state) {
case EFI_NETWORK_STOPPED:
ret = EFI_NOT_STARTED;
@@ -764,6 +782,7 @@ efi_status_t efi_net_register(void)
netobj->net_mode.state = EFI_NETWORK_STARTED;
memcpy(netobj->net_mode.current_address.mac_addr, eth_get_ethaddr(), 6);
netobj->net_mode.hwaddr_size = ARP_HLEN;
+   netobj->net_mode.media_header_size = ETHER_HDR_SIZE;
netobj->net_mode.max_packet_size = PKTSIZE;
netobj->net_mode.if_type = ARP_ETHER;

--
2.20.1

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


[U-Boot] [PATCH 0/5] efi_loader: fix simple network protocol

2019-09-01 Thread Heinrich Schuchardt
This patch series fixes several bugs in the simple network protocol:

* Correctly set and reset the interrupt status.
* Support filling the header in the Transmit() service.
* Correct the checking and setting of the network state.
* Implement the MCastIPtoMAC() service.
* Adjust the simple network protocol unit test.

Heinrich Schuchardt (5):
  efi_loader: interrupts in simple network protocol
  efi_selftest: check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT
  efi_loader: EFI_SIMPLE_NETWORK.Transmit() fill header
  efi_loader: fix status management in network stack
  efi_loader: implement MCastIPtoMAC

 include/efi_api.h   |   2 +
 lib/efi_loader/efi_net.c| 184 +++-
 lib/efi_selftest/efi_selftest_snp.c |  64 --
 3 files changed, 212 insertions(+), 38 deletions(-)

--
2.20.1

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


[U-Boot] [PATCH 4/5] efi_loader: fix status management in network stack

2019-09-01 Thread Heinrich Schuchardt
The network should start in status EfiSimpleNetworkStopped.

Add and correct status checks in the simple network protocol.

Correct the unit test:
* Shutdown() and Stop() during setup if needed
* invoke Shutdown() before Stop() when tearing down

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_net.c| 69 ++---
 lib/efi_selftest/efi_selftest_snp.c | 48 +---
 2 files changed, 104 insertions(+), 13 deletions(-)

diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 646540ac08..970b5ab38e 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -1,8 +1,18 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- *  EFI application network access support
+ * Simple network protocol
+ * PXE base code protocol
  *
- *  Copyright (c) 2016 Alexander Graf
+ * Copyright (c) 2016 Alexander Graf
+ *
+ * The simple network protocol has the following statuses and services
+ * to move between them:
+ *
+ * Start(): EfiSimpleNetworkStopped -> EfiSimpleNetworkStarted
+ * Initialize(): EfiSimpleNetworkStarted -> EfiSimpleNetworkInitialized
+ * Shutdown():  EfiSimpleNetworkInitialized -> EfiSimpleNetworkStarted
+ * Stop():  EfiSimpleNetworkStarted -> EfiSimpleNetworkStopped
+ * Reset(): EfiSimpleNetworkInitialized -> EfiSimpleNetworkInitialized
  */

 #include 
@@ -99,10 +109,13 @@ static efi_status_t EFIAPI efi_net_stop(struct 
efi_simple_network *this)
goto out;
}

-   if (this->mode->state == EFI_NETWORK_STOPPED)
+   if (this->mode->state == EFI_NETWORK_STOPPED) {
ret = EFI_NOT_STARTED;
-   else
+   } else {
+   /* Disable hardware and put it into the reset state */
+   eth_halt();
this->mode->state = EFI_NETWORK_STOPPED;
+   }
 out:
return EFI_EXIT(ret);
 }
@@ -133,6 +146,15 @@ static efi_status_t EFIAPI efi_net_initialize(struct 
efi_simple_network *this,
goto out;
}

+   switch (this->mode->state) {
+   case EFI_NETWORK_INITIALIZED:
+   case EFI_NETWORK_STARTED:
+   break;
+   default:
+   r = EFI_NOT_STARTED;
+   goto out;
+   }
+
/* Setup packet buffers */
net_init();
/* Disable hardware and put it into the reset state */
@@ -169,9 +191,31 @@ out:
 static efi_status_t EFIAPI efi_net_reset(struct efi_simple_network *this,
 int extended_verification)
 {
+   efi_status_t ret;
+
EFI_ENTRY("%p, %x", this, extended_verification);

-   return EFI_EXIT(EFI_CALL(efi_net_initialize(this, 0, 0)));
+   /* Check parameters */
+   if (!this) {
+   ret = EFI_INVALID_PARAMETER;
+   goto out;
+   }
+
+   switch (this->mode->state) {
+   case EFI_NETWORK_INITIALIZED:
+   break;
+   case EFI_NETWORK_STOPPED:
+   ret = EFI_NOT_STARTED;
+   goto out;
+   default:
+   ret = EFI_DEVICE_ERROR;
+   goto out;
+   }
+
+   this->mode->state = EFI_NETWORK_STARTED;
+   ret = EFI_CALL(efi_net_initialize(this, 0, 0));
+out:
+   return EFI_EXIT(ret);
 }

 /*
@@ -196,10 +240,21 @@ static efi_status_t EFIAPI efi_net_shutdown(struct 
efi_simple_network *this)
goto out;
}

+   switch (this->mode->state) {
+   case EFI_NETWORK_INITIALIZED:
+   break;
+   case EFI_NETWORK_STOPPED:
+   ret = EFI_NOT_STARTED;
+   goto out;
+   default:
+   ret = EFI_DEVICE_ERROR;
+   goto out;
+   }
+
eth_halt();
this->int_status = 0;
wait_for_packet->is_signaled = false;
-   this->mode->state = EFI_NETWORK_STOPPED;
+   this->mode->state = EFI_NETWORK_STARTED;

 out:
return EFI_EXIT(ret);
@@ -779,7 +834,7 @@ efi_status_t efi_net_register(void)
netobj->net.transmit = efi_net_transmit;
netobj->net.receive = efi_net_receive;
netobj->net.mode = &netobj->net_mode;
-   netobj->net_mode.state = EFI_NETWORK_STARTED;
+   netobj->net_mode.state = EFI_NETWORK_STOPPED;
memcpy(netobj->net_mode.current_address.mac_addr, eth_get_ethaddr(), 6);
netobj->net_mode.hwaddr_size = ARP_HLEN;
netobj->net_mode.media_header_size = ETHER_HDR_SIZE;
diff --git a/lib/efi_selftest/efi_selftest_snp.c 
b/lib/efi_selftest/efi_selftest_snp.c
index 807b8657b9..9797ecaf42 100644
--- a/lib/efi_selftest/efi_selftest_snp.c
+++ b/lib/efi_selftest/efi_selftest_snp.c
@@ -228,6 +228,26 @@ static int setup(const efi_handle_t handle,
efi_st_error("WaitForPacket event missing\n");
return EFI_ST_FAILURE;
}
+   if (net->mode->state == EFI_NETWORK_INITIALIZED) {
+   /*
+* Shut down network adapter.
+*/
+   ret = net->shutdown(net);
+  

[U-Boot] [PATCH 5/5] efi_loader: implement MCastIPtoMAC

2019-09-01 Thread Heinrich Schuchardt
Implement the MCastIPtoMAC service of the simple network protocol.
It converts an multicast IPv4 (or IPv6) address to a multicast Ethernet
address.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_net.c | 44 ++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 970b5ab38e..2c20cc3c28 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -332,7 +332,7 @@ static efi_status_t EFIAPI efi_net_statistics(struct 
efi_simple_network *this,
 /*
  * efi_net_mcastiptomac() - translate multicast IP address to MAC address
  *
- * This function implements the Statistics service of the
+ * This function implements the MCastIPtoMAC service of the
  * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
  * (UEFI) specification for details.
  *
@@ -347,9 +347,49 @@ static efi_status_t EFIAPI efi_net_mcastiptomac(struct 
efi_simple_network *this,
struct efi_ip_address *ip,
struct efi_mac_address *mac)
 {
+   efi_status_t ret = EFI_SUCCESS;
+
EFI_ENTRY("%p, %x, %p, %p", this, ipv6, ip, mac);

-   return EFI_EXIT(EFI_INVALID_PARAMETER);
+   if (!this || !ip || !mac) {
+   ret = EFI_INVALID_PARAMETER;
+   goto out;
+   }
+
+   if (ipv6) {
+   ret = EFI_UNSUPPORTED;
+   goto out;
+   }
+
+   /* Multi-cast addresses are in the range 224.0.0.0 - 239.255.255.255 */
+   if ((ip->ip_addr[0] & 0xf0) != 0xe0) {
+   ret = EFI_INVALID_PARAMETER;
+   goto out;
+   };
+
+   switch (this->mode->state) {
+   case EFI_NETWORK_INITIALIZED:
+   case EFI_NETWORK_STARTED:
+   break;
+   default:
+   ret = EFI_NOT_STARTED;
+   goto out;
+   }
+
+   memset(mac, 0, sizeof(struct efi_mac_address));
+
+   /*
+* Copy lower 23 bits of IPv4 multi-cast address
+* RFC 1112, RFC 7042 2.1.1.
+*/
+   mac->mac_addr[0] = 0x01;
+   mac->mac_addr[1] = 0x00;
+   mac->mac_addr[2] = 0x5E;
+   mac->mac_addr[3] = ip->ip_addr[1] & 0x7F;
+   mac->mac_addr[4] = ip->ip_addr[2];
+   mac->mac_addr[5] = ip->ip_addr[3];
+out:
+   return EFI_EXIT(ret);
 }

 /**
--
2.20.1

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


[U-Boot] [PATCH 2/5] efi_selftest: check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT

2019-09-01 Thread Heinrich Schuchardt
Check that when the WaitForPacket event occurs
EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT is set.

Check the return value of Receive().

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_selftest/efi_selftest_snp.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest_snp.c 
b/lib/efi_selftest/efi_selftest_snp.c
index 4c26619001..807b8657b9 100644
--- a/lib/efi_selftest/efi_selftest_snp.c
+++ b/lib/efi_selftest/efi_selftest_snp.c
@@ -268,6 +268,7 @@ static int execute(void)
struct efi_mac_address destaddr;
size_t buffer_size;
u8 *addr;
+
/*
 * The timeout is to occur after 10 s.
 */
@@ -298,6 +299,8 @@ static int execute(void)
events[0] = timer;
events[1] = net->wait_for_packet;
for (;;) {
+   u32 int_status;
+
/*
 * Wait for packet to be received or timer event.
 */
@@ -323,8 +326,17 @@ static int execute(void)
 * Receive packet
 */
buffer_size = sizeof(buffer);
-   net->receive(net, NULL, &buffer_size, &buffer,
-&srcaddr, &destaddr, NULL);
+   ret = net->get_status(net, &int_status, NULL);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("Failed to get status");
+   return EFI_ST_FAILURE;
+   }
+   if (!(int_status & EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT)) {
+   efi_st_error("RX interrupt not set");
+   return EFI_ST_FAILURE;
+   }
+   ret = net->receive(net, NULL, &buffer_size, &buffer,
+  &srcaddr, &destaddr, NULL);
if (ret != EFI_SUCCESS) {
efi_st_error("Failed to receive packet");
return EFI_ST_FAILURE;
--
2.20.1

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


[U-Boot] [PATCH 1/5] efi_loader: interrupts in simple network protocol

2019-09-01 Thread Heinrich Schuchardt
GetStatus() must clear the interrupt status.
Transmit() should set the TX interrupt.
Receive() should clear the RX interrupt.
Initialize() and Start() should clear the interrupt status.

Signed-off-by: Heinrich Schuchardt 
---
 include/efi_api.h|  2 ++
 lib/efi_loader/efi_net.c | 40 +---
 2 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 43778197af..7f7b67fa00 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -1281,6 +1281,8 @@ struct efi_simple_network {
struct efi_mac_address *dest_addr, u16 *protocol);
struct efi_event *wait_for_packet;
struct efi_simple_network_mode *mode;
+   /* private fields */
+   u32 int_status;
 };

 #define EFI_PXE_BASE_CODE_PROTOCOL_GUID \
diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 825e064f9a..bf6d5ab0b3 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -66,10 +66,13 @@ static efi_status_t EFIAPI efi_net_start(struct 
efi_simple_network *this)
goto out;
}

-   if (this->mode->state != EFI_NETWORK_STOPPED)
+   if (this->mode->state != EFI_NETWORK_STOPPED) {
ret = EFI_ALREADY_STARTED;
-   else
+   } else {
+   this->int_status = 0;
+   wait_for_packet->is_signaled = false;
this->mode->state = EFI_NETWORK_STARTED;
+   }
 out:
return EFI_EXIT(ret);
 }
@@ -144,6 +147,8 @@ static efi_status_t EFIAPI efi_net_initialize(struct 
efi_simple_network *this,
r = EFI_DEVICE_ERROR;
goto out;
} else {
+   this->int_status = 0;
+   wait_for_packet->is_signaled = false;
this->mode->state = EFI_NETWORK_INITIALIZED;
}
 out:
@@ -192,6 +197,8 @@ static efi_status_t EFIAPI efi_net_shutdown(struct 
efi_simple_network *this)
}

eth_halt();
+   this->int_status = 0;
+   wait_for_packet->is_signaled = false;
this->mode->state = EFI_NETWORK_STOPPED;

 out:
@@ -350,10 +357,8 @@ static efi_status_t EFIAPI efi_net_get_status(struct 
efi_simple_network *this,
}

if (int_status) {
-   /* We send packets synchronously, so nothing is outstanding */
-   *int_status = EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;
-   if (new_rx_packet)
-   *int_status |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;
+   *int_status = this->int_status;
+   this->int_status = 0;
}
if (txbuf)
*txbuf = new_tx_packet;
@@ -429,7 +434,7 @@ static efi_status_t EFIAPI efi_net_transmit
net_send_packet(transmit_buffer, buffer_size);

new_tx_packet = buffer;
-
+   this->int_status |= EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;
 out:
return EFI_EXIT(ret);
 }
@@ -487,12 +492,6 @@ static efi_status_t EFIAPI efi_net_receive
ret = EFI_NOT_READY;
goto out;
}
-   /* Check that we at least received an Ethernet header */
-   if (net_rx_packet_len < sizeof(struct ethernet_hdr)) {
-   new_rx_packet = false;
-   ret = EFI_NOT_READY;
-   goto out;
-   }
/* Fill export parameters */
eth_hdr = (struct ethernet_hdr *)net_rx_packet;
protlen = ntohs(eth_hdr->et_protlen);
@@ -517,7 +516,8 @@ static efi_status_t EFIAPI efi_net_receive
/* Copy packet */
memcpy(buffer, net_rx_packet, net_rx_packet_len);
*buffer_size = net_rx_packet_len;
-   new_rx_packet = false;
+   new_rx_packet = 0;
+   this->int_status &= ~EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;
 out:
return EFI_EXIT(ret);
 }
@@ -548,7 +548,6 @@ void efi_net_set_dhcp_ack(void *pkt, int len)
 static void efi_net_push(void *pkt, int len)
 {
new_rx_packet = true;
-   wait_for_packet->is_signaled = true;
 }

 /**
@@ -577,6 +576,17 @@ static void EFIAPI efi_network_timer_notify(struct 
efi_event *event,
push_packet = efi_net_push;
eth_rx();
push_packet = NULL;
+   if (new_rx_packet) {
+   /* Check that we at least received an Ethernet header */
+   if (net_rx_packet_len >=
+   sizeof(struct ethernet_hdr)) {
+   this->int_status |=
+   EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;
+   wait_for_packet->is_signaled = true;
+   } else {
+   new_rx_packet = 0;
+   }
+   }
}
 out:
EFI_EXIT(EFI_SUCCESS);
--
2.20.1

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


[U-Boot] [PATCH] dm: core: Decouple DM from DT

2019-09-01 Thread Marek Vasut
Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut 
Cc: Simon Glass 
---
 drivers/core/device.c | 4 
 drivers/core/root.c   | 8 +---
 drivers/core/util.c   | 2 ++
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 474c1642ee..05dadf98f9 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -526,6 +526,7 @@ static int device_get_device_tail(struct udevice *dev, int 
ret,
return 0;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 /**
  * device_find_by_ofnode() - Return device associated with given ofnode
  *
@@ -552,6 +553,7 @@ static int device_find_by_ofnode(ofnode node, struct 
udevice **devp)
 
return -ENODEV;
 }
+#endif
 
 int device_get_child(struct udevice *parent, int index, struct udevice **devp)
 {
@@ -817,6 +819,7 @@ int device_set_name(struct udevice *dev, const char *name)
return 0;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 bool device_is_compatible(struct udevice *dev, const char *compat)
 {
return ofnode_device_is_compatible(dev_ofnode(dev), compat);
@@ -879,3 +882,4 @@ int dev_enable_by_path(const char *path)
 
return lists_bind_fdt(parent, node, NULL, false);
 }
+#endif
diff --git a/drivers/core/root.c b/drivers/core/root.c
index aa5ca4087a..e85643819e 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -314,13 +314,6 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
 #endif
return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
 }
-#else
-static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
-   int offset, bool pre_reloc_only)
-{
-   return 0;
-}
-#endif
 
 static int dm_scan_fdt_ofnode_path(const char *path, bool pre_reloc_only)
 {
@@ -360,6 +353,7 @@ int dm_extended_scan_fdt(const void *blob, bool 
pre_reloc_only)
 
return ret;
 }
+#endif
 
 __weak int dm_scan_other(bool pre_reloc_only)
 {
diff --git a/drivers/core/util.c b/drivers/core/util.c
index 60b939a924..7dc1a2af02 100644
--- a/drivers/core/util.c
+++ b/drivers/core/util.c
@@ -31,6 +31,7 @@ int list_count_items(struct list_head *head)
return count;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 bool dm_ofnode_pre_reloc(ofnode node)
 {
 #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD)
@@ -56,3 +57,4 @@ bool dm_ofnode_pre_reloc(ofnode node)
return false;
 #endif
 }
+#endif
-- 
2.23.0.rc1

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


[U-Boot] [PATCH] sh: tmu: Fix SH4 TCNT0 offset

2019-09-01 Thread Marek Vasut
Fix the offset of TCNT0 register, which is 0xc on SH4.

Signed-off-by: Marek Vasut 
Cc: Nobuhiro Iwamatsu 
---
 arch/sh/include/asm/config.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/config.h b/arch/sh/include/asm/config.h
index df38c82abc..406156dff5 100644
--- a/arch/sh/include/asm/config.h
+++ b/arch/sh/include/asm/config.h
@@ -10,7 +10,7 @@
 
 /* Timer */
 #define CONFIG_SYS_TIMER_COUNTS_DOWN
-#define CONFIG_SYS_TIMER_COUNTER   (TMU_BASE + 0x8)/* TCNT0 */
+#define CONFIG_SYS_TIMER_COUNTER   (TMU_BASE + 0xc)/* TCNT0 */
 #define CONFIG_SYS_TIMER_RATE  (CONFIG_SYS_CLK_FREQ / 4)
 
 #endif
-- 
2.23.0.rc1

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


[U-Boot] [PATCH 1/5] sh: Fix OF_SEPARATE support

2019-09-01 Thread Marek Vasut
If the OF_SEPARATE is enabled, the DT is appended past the _end symbol.
The current code however clears BSS very early, which overwrites the DT
blob with zeroes. Moreover, the early code relocates U-Boot into RAM to
the correct location, but does not relocate the DT.

This patch adds code to relocate the DT and avoids clearing BSS too
early, thus addressing both problems with OF_SEPARATE on SH.

Signed-off-by: Marek Vasut 
Cc: Nobuhiro Iwamatsu 
---
 arch/sh/cpu/u-boot.lds |  1 +
 arch/sh/lib/start.S| 14 ++
 2 files changed, 15 insertions(+)

diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds
index 7b225a6bd9..47302da252 100644
--- a/arch/sh/cpu/u-boot.lds
+++ b/arch/sh/cpu/u-boot.lds
@@ -75,6 +75,7 @@ SECTIONS
 
PROVIDE (__init_end = .);
PROVIDE (reloc_dst_end = .);
+   PROVIDE (_end = .);
 
PROVIDE (bss_start = .);
PROVIDE (__bss_start = .);
diff --git a/arch/sh/lib/start.S b/arch/sh/lib/start.S
index f5350b9064..f9f26d3779 100644
--- a/arch/sh/lib/start.S
+++ b/arch/sh/lib/start.S
@@ -22,6 +22,17 @@ _start:
mov.l   ._reloc_dst, r4
add #(_start-1b), r5
mov.l   ._reloc_dst_end, r6
+#ifdef CONFIG_OF_SEPARATE
+   mov.l   ._reloc_size, r0
+   add r5, r0
+   add #4, r0
+   mov.l   @r0, r0
+   swap.b  r0, r0
+   swap.w  r0, r0
+   swap.b  r0, r0
+   add #4, r0
+   add r0, r6
+#endif
 
 2: mov.l   @r5+, r1
mov.l   r1, @r4
@@ -29,6 +40,7 @@ _start:
cmp/hs  r6, r4
bf  2b
 
+#ifndef CONFIG_OF_SEPARATE
mov.l   ._bss_start, r4
mov.l   ._bss_end, r5
mov #0, r1
@@ -37,6 +49,7 @@ _start:
add #4, r4
cmp/hs  r5, r4
bf  3b
+#endif
 
mov.l   ._gd_init, r13  /* global data */
mov.l   ._stack_init, r15   /* stack */
@@ -53,6 +66,7 @@ loop:
 ._lowlevel_init:   .long   (lowlevel_init - (100b + 4))
 ._reloc_dst:   .long   _start
 ._reloc_dst_end:   .long   reloc_dst_end
+._reloc_size:  .long   (_end - _start)
 ._bss_start:   .long   bss_start
 ._bss_end: .long   bss_end
 ._gd_init: .long   (_start - GENERATED_GBL_DATA_SIZE)
-- 
2.23.0.rc1

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


[U-Boot] [PATCH 5/5] sh: r2dplus: Switch to DM PCI driver

2019-09-01 Thread Marek Vasut
Add DT entry for the DM PCI driver, update board configs
and drop ad-hoc board init code for the PCI bus. Instead,
let the DM PCI driver initialize and operate the hardware.

Signed-off-by: Marek Vasut 
Cc: Nobuhiro Iwamatsu 
---
 arch/sh/dts/sh7751-r2dplus.dts  | 14 ++
 board/renesas/r2dplus/r2dplus.c |  7 ---
 configs/r2dplus_defconfig   |  2 ++
 include/configs/r2dplus.h   | 13 -
 4 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/arch/sh/dts/sh7751-r2dplus.dts b/arch/sh/dts/sh7751-r2dplus.dts
index 2d291bf1ee..ecaf0772d8 100644
--- a/arch/sh/dts/sh7751-r2dplus.dts
+++ b/arch/sh/dts/sh7751-r2dplus.dts
@@ -9,4 +9,18 @@
 / {
model = "R2D";
compatible = "renesas,r2d", "renesas,sh7751";
+
+   pci@fe20 {
+   compatible = "renesas,pci-sh7751";
+   device_type = "pci";
+   reg = <0 0xfe20 0 0x1000>;
+   status = "okay";
+
+   bus-range = <0 0>;
+   #address-cells = <3>;
+   #size-cells = <2>;
+   #interrupt-cells = <1>;
+   ranges = <0x0100 0 0xfe24 0 0xfe24 0 0x0004
+ 0x0200 0 0xfd00 0 0xfd00 0 0x0100>;
+   };
 };
diff --git a/board/renesas/r2dplus/r2dplus.c b/board/renesas/r2dplus/r2dplus.c
index f0773267b1..6eff98706f 100644
--- a/board/renesas/r2dplus/r2dplus.c
+++ b/board/renesas/r2dplus/r2dplus.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 
 int checkboard(void)
 {
@@ -45,12 +44,6 @@ void ide_set_reset(int idereset)
}
 }
 
-static struct pci_controller hose;
-void pci_init_board(void)
-{
-   pci_sh7751_init(&hose);
-}
-
 int board_eth_init(bd_t *bis)
 {
return pci_eth_init(bis);
diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig
index 51a8587b61..b2334affc3 100644
--- a/configs/r2dplus_defconfig
+++ b/configs/r2dplus_defconfig
@@ -25,5 +25,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_RTL8139=y
 CONFIG_PCI=y
+CONFIG_DM_PCI=y
+CONFIG_DM_PCI_COMPAT=y
 CONFIG_SCIF_CONSOLE=y
 CONFIG_USE_PRIVATE_LIBGCC=y
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h
index e10de1b920..0b16fb0f64 100644
--- a/include/configs/r2dplus.h
+++ b/include/configs/r2dplus.h
@@ -64,19 +64,6 @@
 /*
  * SuperH PCI Bridge Configration
  */
-#define CONFIG_SH4_PCI
 #define CONFIG_SH7751_PCI
-#define CONFIG_PCI_SCAN_SHOW   1
-#define __mem_pci
-
-#define CONFIG_PCI_MEM_BUS 0xFD00  /* Memory space base addr */
-#define CONFIG_PCI_MEM_PHYSCONFIG_PCI_MEM_BUS
-#define CONFIG_PCI_MEM_SIZE0x0100  /* Size of Memory window */
-#define CONFIG_PCI_IO_BUS  0xFE24  /* IO space base address */
-#define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS
-#define CONFIG_PCI_IO_SIZE 0x0004  /* Size of IO window */
-#define CONFIG_PCI_SYS_BUS CONFIG_SYS_SDRAM_BASE
-#define CONFIG_PCI_SYS_PHYSCONFIG_SYS_SDRAM_BASE
-#define CONFIG_PCI_SYS_SIZECONFIG_SYS_SDRAM_SIZE
 
 #endif /* __CONFIG_H */
-- 
2.23.0.rc1

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


[U-Boot] [PATCH 4/5] pci: sh7751: Convert to DM and DT probing

2019-09-01 Thread Marek Vasut
Convert the SH7751 PCI driver to DM and add DT probing.

Signed-off-by: Marek Vasut 
Cc: Nobuhiro Iwamatsu 
Cc: Bin Meng 
---
 drivers/pci/pci_sh7751.c | 164 +--
 1 file changed, 106 insertions(+), 58 deletions(-)

diff --git a/drivers/pci/pci_sh7751.c b/drivers/pci/pci_sh7751.c
index 2f918f161a..53e1668c99 100644
--- a/drivers/pci/pci_sh7751.c
+++ b/drivers/pci/pci_sh7751.c
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,82 +20,113 @@
 #define SH7751_WCR3(vu_long *)0xFF800010
 #define SH7751_MCR (vu_long *)0xFF800014
 #define SH7751_BCR3(vu_short *)0xFF800050
-#define SH7751_PCICONF0 (vu_long *)0xFE20
-#define SH7751_PCICONF1 (vu_long *)0xFE24
-#define SH7751_PCICONF2 (vu_long *)0xFE28
-#define SH7751_PCICONF3 (vu_long *)0xFE2C
-#define SH7751_PCICONF4 (vu_long *)0xFE200010
-#define SH7751_PCICONF5 (vu_long *)0xFE200014
-#define SH7751_PCICONF6 (vu_long *)0xFE200018
-#define SH7751_PCICR(vu_long *)0xFE200100
-#define SH7751_PCILSR0  (vu_long *)0xFE200104
-#define SH7751_PCILSR1  (vu_long *)0xFE200108
-#define SH7751_PCILAR0  (vu_long *)0xFE20010C
-#define SH7751_PCILAR1  (vu_long *)0xFE200110
-#define SH7751_PCIMBR   (vu_long *)0xFE2001C4
-#define SH7751_PCIIOBR  (vu_long *)0xFE2001C8
-#define SH7751_PCIPINT  (vu_long *)0xFE2001CC
-#define SH7751_PCIPINTM (vu_long *)0xFE2001D0
-#define SH7751_PCICLKR  (vu_long *)0xFE2001D4
-#define SH7751_PCIBCR1  (vu_long *)0xFE2001E0
-#define SH7751_PCIBCR2  (vu_long *)0xFE2001E4
-#define SH7751_PCIWCR1  (vu_long *)0xFE2001E8
-#define SH7751_PCIWCR2  (vu_long *)0xFE2001EC
-#define SH7751_PCIWCR3  (vu_long *)0xFE2001F0
-#define SH7751_PCIMCR   (vu_long *)0xFE2001F4
-#define SH7751_PCIBCR3  (vu_long *)0xFE2001F8
-
-#define BCR1_BREQEN0x0008
-#define PCI_SH7751_ID  0x35051054
-#define PCI_SH7751R_ID 0x350E1054
-#define SH7751_PCICONF1_WCC0x0080
-#define SH7751_PCICONF1_PER0x0040
-#define SH7751_PCICONF1_BUM0x0004
-#define SH7751_PCICONF1_MES0x0002
+#define SH7751_PCICONF0(vu_long *)0xFE20
+#define SH7751_PCICONF1(vu_long *)0xFE24
+#define SH7751_PCICONF2(vu_long *)0xFE28
+#define SH7751_PCICONF3(vu_long *)0xFE2C
+#define SH7751_PCICONF4(vu_long *)0xFE200010
+#define SH7751_PCICONF5(vu_long *)0xFE200014
+#define SH7751_PCICONF6(vu_long *)0xFE200018
+#define SH7751_PCICR   (vu_long *)0xFE200100
+#define SH7751_PCILSR0 (vu_long *)0xFE200104
+#define SH7751_PCILSR1 (vu_long *)0xFE200108
+#define SH7751_PCILAR0 (vu_long *)0xFE20010C
+#define SH7751_PCILAR1 (vu_long *)0xFE200110
+#define SH7751_PCIMBR  (vu_long *)0xFE2001C4
+#define SH7751_PCIIOBR (vu_long *)0xFE2001C8
+#define SH7751_PCIPINT (vu_long *)0xFE2001CC
+#define SH7751_PCIPINTM(vu_long *)0xFE2001D0
+#define SH7751_PCICLKR (vu_long *)0xFE2001D4
+#define SH7751_PCIBCR1 (vu_long *)0xFE2001E0
+#define SH7751_PCIBCR2 (vu_long *)0xFE2001E4
+#define SH7751_PCIWCR1 (vu_long *)0xFE2001E8
+#define SH7751_PCIWCR2 (vu_long *)0xFE2001EC
+#define SH7751_PCIWCR3 (vu_long *)0xFE2001F0
+#define SH7751_PCIMCR  (vu_long *)0xFE2001F4
+#define SH7751_PCIBCR3 (vu_long *)0xFE2001F8
+
+#define BCR1_BREQEN0x0008
+#define PCI_SH7751_ID  0x35051054
+#define PCI_SH7751R_ID 0x350E1054
+#define SH7751_PCICONF1_WCC0x0080
+#define SH7751_PCICONF1_PER0x0040
+#define SH7751_PCICONF1_BUM0x0004
+#define SH7751_PCICONF1_MES0x0002
 #define SH7751_PCICONF1_CMDS   0x00C6
 #define SH7751_PCI_HOST_BRIDGE 0x6
-#define SH7751_PCICR_PREFIX0xa500
-#define SH7751_PCICR_PRST  0x0002
-#define SH7751_PCICR_CFIN  0x0001
-#define SH7751_PCIPINT_D3  0x0002
-#define SH7751_PCIPINT_D0  0x0001
-#define SH7751_PCICLKR_PREFIX   0xa500
+#define SH7751_PCICR_PREFIX0xa500
+#define SH7751_PCICR_PRST  0x0002
+#define SH7751_PCICR_CFIN  0x0001
+#define SH7751_PCIPINT_D3  0x0002
+#define SH7751_PCIPINT_D0  0x0001
+#define SH7751_PCICLKR_PREFIX  0xa500
 
-#define SH7751_PCI_MEM_BASE0xFD00
-#define SH7751_PCI_MEM_SIZE0x0100
-#define SH7751_PCI_IO_BASE 0xFE24
-#define SH7751_PCI_IO_SIZE 0x0004
+#define SH7751_PCI_MEM_BASE0xFD00
+#define SH7751_PCI_MEM_SIZE0x0100
+#define SH7751_PCI_IO_BASE 0xFE24
+#define SH7751_PCI_IO_SIZE 0x0004
 
-#define SH7751_PCIPAR   (vu_long *)0xFE2001C0
-#define SH7751_PCIPDR   (vu_long *)0xFE200220
+#define SH7751_PCIPAR  (vu_long *)0xFE2001C0
+#define SH7751_PCIPDR  (vu_long *)0xFE200220
 
 #define p4_in(addr)(*addr)
 #define p4_out(data, addr) (*addr) = (data)
 
-/* Double word */
-int pci_sh4_read_config_dword(struct pci_controller *hose,
-  

[U-Boot] [PATCH 2/5] sh: r2dplus: Enable DM

2019-09-01 Thread Marek Vasut
Enable driver model support for SH4 R2Dplus board. Thus far, no
drivers are bound via the DM. The PCI drivers have yet to be
converted to DM_PCI.

Signed-off-by: Marek Vasut 
Cc: Nobuhiro Iwamatsu 
---
 configs/r2dplus_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig
index 4c1912c8a1..43bf97cb77 100644
--- a/configs/r2dplus_defconfig
+++ b/configs/r2dplus_defconfig
@@ -1,12 +1,14 @@
 CONFIG_SH=y
 CONFIG_SYS_TEXT_BASE=0x8FE0
 CONFIG_TARGET_R2DPLUS=y
+# CONFIG_SYS_MALLOC_F is not set
 CONFIG_BOOTDELAY=-1
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttySC0,115200"
 # CONFIG_CMDLINE_EDITING is not set
 # CONFIG_AUTO_COMPLETE is not set
 CONFIG_CMD_IMLS=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_IDE=y
 CONFIG_CMD_PCI=y
 # CONFIG_CMD_SETEXPR is not set
@@ -15,6 +17,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT2=y
 CONFIG_DOS_PARTITION=y
 CONFIG_ENV_IS_IN_FLASH=y
+CONFIG_DM=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
-- 
2.23.0.rc1

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


[U-Boot] [PATCH 3/5] sh: r2dplus: Enable OF control

2019-09-01 Thread Marek Vasut
Enable OF control for SH4 R2Dplus board. This is necessary, because
the PCI uclass is designed in a way that makes it depend on DT and
disallows instanciating devices without DT (e.g. with platdata).

Signed-off-by: Marek Vasut 
Cc: Nobuhiro Iwamatsu 
---
 arch/Kconfig   |  1 +
 arch/sh/dts/Makefile   | 12 
 arch/sh/dts/sh7751-r2dplus.dts | 12 
 arch/sh/include/asm/config.h   |  2 ++
 configs/r2dplus_defconfig  |  2 ++
 5 files changed, 29 insertions(+)
 create mode 100644 arch/sh/dts/Makefile
 create mode 100644 arch/sh/dts/sh7751-r2dplus.dts

diff --git a/arch/Kconfig b/arch/Kconfig
index f4ada57909..141e48bc43 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -137,6 +137,7 @@ config SANDBOX
 config SH
bool "SuperH architecture"
select HAVE_PRIVATE_LIBGCC
+   select SUPPORT_OF_CONTROL
 
 config X86
bool "x86 architecture"
diff --git a/arch/sh/dts/Makefile b/arch/sh/dts/Makefile
new file mode 100644
index 00..e423bfd566
--- /dev/null
+++ b/arch/sh/dts/Makefile
@@ -0,0 +1,12 @@
+dtb-y += sh7751-r2dplus.dtb
+
+targets += $(dtb-y)
+
+# Add any required device tree compiler flags here
+DTC_FLAGS +=
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+   @:
+
+clean-files := *.dtb *_HS
diff --git a/arch/sh/dts/sh7751-r2dplus.dts b/arch/sh/dts/sh7751-r2dplus.dts
new file mode 100644
index 00..2d291bf1ee
--- /dev/null
+++ b/arch/sh/dts/sh7751-r2dplus.dts
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the SH7751 R2Dplus
+ *
+ * Copyright (C) 2019 Marek Vasut 
+ */
+
+/dts-v1/;
+/ {
+   model = "R2D";
+   compatible = "renesas,r2d", "renesas,sh7751";
+};
diff --git a/arch/sh/include/asm/config.h b/arch/sh/include/asm/config.h
index 406156dff5..e1cd322152 100644
--- a/arch/sh/include/asm/config.h
+++ b/arch/sh/include/asm/config.h
@@ -8,6 +8,8 @@
 
 #include 
 
+#define CONFIG_LMB
+
 /* Timer */
 #define CONFIG_SYS_TIMER_COUNTS_DOWN
 #define CONFIG_SYS_TIMER_COUNTER   (TMU_BASE + 0xc)/* TCNT0 */
diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig
index 43bf97cb77..51a8587b61 100644
--- a/configs/r2dplus_defconfig
+++ b/configs/r2dplus_defconfig
@@ -16,6 +16,8 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT2=y
 CONFIG_DOS_PARTITION=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="sh7751-r2dplus"
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_DM=y
 CONFIG_MTD_NOR_FLASH=y
-- 
2.23.0.rc1

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


[U-Boot] [PATCH 1/4] ARM: omapl138_lcdk: Disable SPL_DM_USB

2019-09-01 Thread Adam Ford
The USB was just recently enabled, so it is unlikely anyone is
using it in SPL, so this patch removes it from SPL to further
reduce the SPL code size.

Signed-off-by: Adam Ford 

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 7e470bf73e..6813a8b2ae 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -67,6 +67,7 @@ CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
+# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_DA8XX=y
 CONFIG_USB_MUSB_HOST=y
-- 
2.17.1

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


[U-Boot] [PATCH 4/4] ARM: omapl138_lcdk: Enable Pinctrl

2019-09-01 Thread Adam Ford
The single pinctrl supports the da8xx, so this patch enables
pinctrl in U-Boot.

Signed-off-by: Adam Ford 

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index c8a2b145bc..802e3971ff 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -34,6 +34,7 @@ CONFIG_MX_CYCLIC=y
 CONFIG_CMD_DM=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_NAND=y
+# CONFIG_CMD_PINMUX is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nand0=nand256"
@@ -66,6 +67,8 @@ CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_PHY=y
 CONFIG_PHY_DA8XX_USB=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_SINGLE=y
 CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
-- 
2.17.1

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


[U-Boot] [PATCH 3/4] ARM: omapl138_lcdk: Enable DM_GPIO and DM and GPIO Commands

2019-09-01 Thread Adam Ford
The da8xx GPIO driver is available with DM_GPIO support.  This
patch enables the CMD_GPIO, CMD_DM, and DM_GPIO and DA8XX_GPIO.

Signed-off-by: Adam Ford 

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 98f101342d..c8a2b145bc 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -31,8 +31,8 @@ CONFIG_HUSH_PARSER=y
 CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_EEPROM is not set
 CONFIG_MX_CYCLIC=y
+CONFIG_CMD_DM=y
 # CONFIG_CMD_FLASH is not set
-# CONFIG_CMD_GPIO is not set
 CONFIG_CMD_NAND=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_MTDPARTS=y
@@ -48,6 +48,8 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_DM_GPIO=y
+CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
-- 
2.17.1

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


[U-Boot] [PATCH 2/4] ARM: omapl138_lcdk: Split SPL BSS and increase malloc size

2019-09-01 Thread Adam Ford
In further preparation for device tree conversion in SPL, this
patch separates BSS in SPL and increases malloc size.

Signed-off-by: Adam Ford 

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 6813a8b2ae..98f101342d 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -10,6 +10,7 @@ CONFIG_SYS_DA850_PLL1_PLLDIV3=0x8003
 CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x800
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
@@ -23,6 +24,7 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_HUSH_PARSER=y
-- 
2.17.1

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


Re: [U-Boot] [PATCH v3] imx: support i.MX8QM ROM 7720 a1 board

2019-09-01 Thread Peng Fan
> Subject: [PATCH v3] imx: support i.MX8QM ROM 7720 a1 board
> 
> Add i.MX8QM ROM 7720a1 board support
> 
> Boot log as below:
> U-Boot 2019.10-rc2-00283-g198673d9ab (Aug 30 2019 - 10:26:53 +0200)
> 
> CPU:   NXP i.MX8QM RevB A53 at 1200 MHz
> 
> Model: Advantech iMX8QM Qseven series
> Board: ROM-7720-A1 4GB
> Build: SCFW 65afe5f6
> Boot:  SD2
> DRAM:  3.9 GiB
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
> Loading Environment from MMC... OK
> In:serial@5a06
> Out:   serial@5a06
> Err:   serial@5a06
> Net:   eth0: ethernet@5b04Could not get PHY for FEC1: addr 1
> , eth-1: ethernet@5b05
> Hit any key to stop autoboot:  0
> 
> Signed-off-by: Oliver Graute 
> Cc: Stefano Babic 
> Cc: Fabio Estevam 
> Cc: Peng Fan 
> Cc: Simon Glass 
> Cc: Ye Li 
> Cc: uboot-imx 
> ---
> 
> These changes are based on this vendor tree:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
> com%2FADVANTECH-Corp%2Fuboot-imx6.git&data=02%7C01%7Cpeng.f
> an%40nxp.com%7C350e8928b13b4e10ff2b08d72d2eaa59%7C686ea1d3bc2b
> 4c6fa92cd99c5c301635%7C0%7C0%7C637027550778709853&sdata=X
> P0h%2F%2FjkYM%2BQJ7kmUBKcttxkFLICSZ3KcDL7ITmH6S8%3D&reser
> ved=0
> 
> I adapted the files and compared them with code from similar imx8qm-mek
> board
> 
> Changes for v3:
>  - removed duplicate build_info
>  - removed CONFIG_FSL_ESDHC
> 
> Changes for v2:
>  - cleanup of u-boot environment
>  - set power mode SC_R_DC_0 for full boot of linux kernel
>  - enabled usdhc2
>  - enabled FEC defines
>  - updated README.md
>  - enabled readwrite for nfs rootfs
>  - removed include of environment header
> 
>  arch/arm/dts/Makefile |   1 +
>  arch/arm/dts/imx8qm-rom7720-a1.dts| 373
> ++
>  arch/arm/mach-imx/imx8/Kconfig|   7 +
>  arch/arm/mach-imx/mkimage_fit_atf.sh  |   3 +
>  board/freescale/imx8qm_rom7720_a1/Kconfig |  14 +
>  board/freescale/imx8qm_rom7720_a1/MAINTAINERS |   6 +
>  board/freescale/imx8qm_rom7720_a1/Makefile|  11 +
>  board/freescale/imx8qm_rom7720_a1/README  |  70 
>  .../imx8qm_rom7720_a1/imx8qm_rom7720_a1.c | 168 
>  .../freescale/imx8qm_rom7720_a1/imximage.cfg  |  21 +
>  board/freescale/imx8qm_rom7720_a1/spl.c   | 228 +++
>  configs/imx8qm_rom7720_a1_4G_defconfig|  82 
>  include/configs/imx8qm_rom7720.h  | 188 +
>  13 files changed, 1172 insertions(+)
>  create mode 100644 arch/arm/dts/imx8qm-rom7720-a1.dts
>  create mode 100644 board/freescale/imx8qm_rom7720_a1/Kconfig
>  create mode 100644 board/freescale/imx8qm_rom7720_a1/MAINTAINERS
>  create mode 100644 board/freescale/imx8qm_rom7720_a1/Makefile
>  create mode 100644 board/freescale/imx8qm_rom7720_a1/README
>  create mode 100644
> board/freescale/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c
>  create mode 100644 board/freescale/imx8qm_rom7720_a1/imximage.cfg
>  create mode 100644 board/freescale/imx8qm_rom7720_a1/spl.c
>  create mode 100644 configs/imx8qm_rom7720_a1_4G_defconfig
>  create mode 100644 include/configs/imx8qm_rom7720.h
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index
> 0b314c12dd..67340f8a0c 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -635,6 +635,7 @@ dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb
>  dtb-$(CONFIG_ARCH_IMX8) += \
>   fsl-imx8qm-apalis.dtb \
>   fsl-imx8qm-mek.dtb \
> + imx8qm-rom7720-a1.dtb \
>   fsl-imx8qxp-colibri.dtb \
>   fsl-imx8qxp-mek.dtb
> 
> diff --git a/arch/arm/dts/imx8qm-rom7720-a1.dts
> b/arch/arm/dts/imx8qm-rom7720-a1.dts
> new file mode 100644
> index 00..5f9ac955ed
> --- /dev/null
> +++ b/arch/arm/dts/imx8qm-rom7720-a1.dts
> @@ -0,0 +1,373 @@
> +// SPDX-License-Identifier:  GPL-2.0+
> +/*
> + * Copyright (C) 2016 Freescale Semiconductor, Inc.
> + * Copyright 2017 NXP
> + */
> +
> +/dts-v1/;
> +
> +/* First 128KB is for PSCI ATF. */
> +/memreserve/ 0x8000 0x0002;
> +
> +#include "fsl-imx8qm.dtsi"
> +
> +/ {
> + model = "Advantech iMX8QM Qseven series";
> + compatible = "fsl,imx8qm-mek", "fsl,imx8qm";
> +
> + chosen {
> + bootargs = "console=ttyLP0,115200
> earlycon=lpuart32,0x5a06,115200";
> + stdout-path = &lpuart0;
> + };
> +
> + leds {
> + compatible = "gpio-leds";
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_gpio_leds>;
> + user {
> + label = "heartbeat";
> + gpios = <&gpio2 15 0>;
> + default-state = "on";
> + linux,default-trigger = "heartbeat";
> + };
> + };
> +
> + regulators {
> + compatible = "simple-bus";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + reg_usb_otg1_vbus: regulator@0 {
> + compatible = "regulator-fixed";
> + reg = <0>;
> + regulato

Re: [U-Boot] [PATCH] dm: mmc_spi: Fix NULL pointer dereference in mmc_spi_bind()

2019-09-01 Thread Peng Fan
> Subject: [PATCH] dm: mmc_spi: Fix NULL pointer dereference in
> mmc_spi_bind()
> 
> The mmc_spi driver's priv is not available in its bind phase(). Use platdata
> instead.
> 
> Fixes: 05e35d429745 ("mmc: mmc_spi: Re-write driver using DM framework")
> Signed-off-by: Bin Meng 
> ---
> 
>  drivers/mmc/mmc_spi.c | 35 ---
>  1 file changed, 20 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c index
> 350812a..c693fb2 100644
> --- a/drivers/mmc/mmc_spi.c
> +++ b/drivers/mmc/mmc_spi.c
> @@ -58,12 +58,15 @@
>  #define READ_TIMEOUT 300 /* 1 sec */
>  #define WRITE_TIMEOUT300 /* 1 sec */
> 
> -struct mmc_spi_priv {
> - struct spi_slave *spi;
> +struct mmc_spi_plat {
>   struct mmc_config cfg;
>   struct mmc mmc;
>  };
> 
> +struct mmc_spi_priv {
> + struct spi_slave *spi;
> +};
> +
>  static int mmc_spi_sendcmd(struct udevice *dev,
>  ushort cmdidx, u32 cmdarg, u32 resp_type,
>  u8 *resp, u32 resp_size,
> @@ -370,6 +373,7 @@ done:
>  static int mmc_spi_probe(struct udevice *dev)  {
>   struct mmc_spi_priv *priv = dev_get_priv(dev);
> + struct mmc_spi_plat *plat = dev_get_platdata(dev);
>   struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
>   char *name;
> 
> @@ -385,28 +389,28 @@ static int mmc_spi_probe(struct udevice *dev)
>   return -ENOMEM;
>   sprintf(name, "%s:%s", dev->parent->name, dev->name);
> 
> - priv->cfg.name = name;
> - priv->cfg.host_caps = MMC_MODE_SPI;
> - priv->cfg.voltages = MMC_SPI_VOLTAGE;
> - priv->cfg.f_min = MMC_SPI_MIN_CLOCK;
> - priv->cfg.f_max = priv->spi->max_hz;
> - priv->cfg.part_type = PART_TYPE_DOS;
> - priv->cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
> + plat->cfg.name = name;
> + plat->cfg.host_caps = MMC_MODE_SPI;
> + plat->cfg.voltages = MMC_SPI_VOLTAGE;
> + plat->cfg.f_min = MMC_SPI_MIN_CLOCK;
> + plat->cfg.f_max = priv->spi->max_hz;
> + plat->cfg.part_type = PART_TYPE_DOS;
> + plat->cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
> 
> - priv->mmc.cfg = &priv->cfg;
> - priv->mmc.priv = priv;
> - priv->mmc.dev = dev;
> + plat->mmc.cfg = &plat->cfg;
> + plat->mmc.priv = priv;
> + plat->mmc.dev = dev;
> 
> - upriv->mmc = &priv->mmc;
> + upriv->mmc = &plat->mmc;
> 
>   return 0;
>  }
> 
>  static int mmc_spi_bind(struct udevice *dev)  {
> - struct mmc_spi_priv *priv = dev_get_priv(dev);
> + struct mmc_spi_plat *plat = dev_get_platdata(dev);
> 
> - return mmc_bind(dev, &priv->mmc, &priv->cfg);
> + return mmc_bind(dev, &plat->mmc, &plat->cfg);
>  }
> 
>  static const struct dm_mmc_ops mmc_spi_ops = { @@ -426,5 +430,6 @@
> U_BOOT_DRIVER(mmc_spi) = {
>   .ops = &mmc_spi_ops,
>   .probe = mmc_spi_probe,
>   .bind = mmc_spi_bind,
> + .platdata_auto_alloc_size = sizeof(struct mmc_spi_plat),
>   .priv_auto_alloc_size = sizeof(struct mmc_spi_priv),  };

Reviewed-by: Peng Fan 

> --
> 2.7.4

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


[U-Boot] [PATCH 0/2] amlogic: Add Khadas VIM3 support

2019-09-01 Thread Andreas Färber
Hi,

This mini-series adds initial support for Amlogic A311D based Khadas VIM3.

Regards,
Andreas

Cc: Neil Armstrong 

Andreas Färber (2):
  arm: dts: Import and update DT for Khadas VIM3
  configs: Add Khadas VIM3 defconfig

 arch/arm/dts/Makefile  |3 +-
 arch/arm/dts/meson-g12-common.dtsi | 2435 
 arch/arm/dts/meson-g12b-a311d-khadas-vim3.dts  |   15 +
 arch/arm/dts/meson-g12b-a311d.dtsi |  149 ++
 arch/arm/dts/meson-g12b-khadas-vim3.dtsi   |  544 +
 arch/arm/dts/meson-g12b.dtsi   |   39 +-
 board/amlogic/w400/MAINTAINERS |1 +
 board/amlogic/w400/README.khadas-vim3  |  132 ++
 configs/khadas-vim3_defconfig  |   54 +
 include/dt-bindings/clock/g12a-clkc.h  |6 +
 include/dt-bindings/power/meson-g12a-power.h   |   13 +
 .../reset/amlogic,meson-g12a-audio-reset.h |   38 +
 12 files changed, 3425 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12-common.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-a311d-khadas-vim3.dts
 create mode 100644 arch/arm/dts/meson-g12b-a311d.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-khadas-vim3.dtsi
 create mode 100644 board/amlogic/w400/README.khadas-vim3
 create mode 100644 configs/khadas-vim3_defconfig
 create mode 100644 include/dt-bindings/power/meson-g12a-power.h
 create mode 100644 include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h

-- 
2.16.4

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


[U-Boot] [PATCH 1/2] arm: dts: Import and update DT for Khadas VIM3

2019-09-01 Thread Andreas Färber
In Linux meson-g12-common.dtsi was introduced as well as new g12b nodes
and headers, as dependencies of new meson-g12b-a311d-khadas-vim3.dts.

Signed-off-by: Andreas Färber 
---
 arch/arm/dts/Makefile  |3 +-
 arch/arm/dts/meson-g12-common.dtsi | 2435 
 arch/arm/dts/meson-g12b-a311d-khadas-vim3.dts  |   15 +
 arch/arm/dts/meson-g12b-a311d.dtsi |  149 ++
 arch/arm/dts/meson-g12b-khadas-vim3.dtsi   |  544 +
 arch/arm/dts/meson-g12b.dtsi   |   39 +-
 include/dt-bindings/clock/g12a-clkc.h  |6 +
 include/dt-bindings/power/meson-g12a-power.h   |   13 +
 .../reset/amlogic,meson-g12a-audio-reset.h |   38 +
 9 files changed, 3238 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12-common.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-a311d-khadas-vim3.dts
 create mode 100644 arch/arm/dts/meson-g12b-a311d.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-khadas-vim3.dtsi
 create mode 100644 include/dt-bindings/power/meson-g12a-power.h
 create mode 100644 include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index aac1b83d49..6de5e4c62a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -141,7 +141,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-axg-s400.dtb \
meson-g12a-u200.dtb \
meson-g12a-sei510.dtb \
-   meson-g12b-odroid-n2.dtb
+   meson-g12b-odroid-n2.dtb \
+   meson-g12b-a311d-khadas-vim3.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
tegra20-medcom-wide.dtb \
tegra20-paz00.dtb \
diff --git a/arch/arm/dts/meson-g12-common.dtsi 
b/arch/arm/dts/meson-g12-common.dtsi
new file mode 100644
index 00..3f39e020f7
--- /dev/null
+++ b/arch/arm/dts/meson-g12-common.dtsi
@@ -0,0 +1,2435 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   interrupt-parent = <&gic>;
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   tdmif_a: audio-controller-0 {
+   compatible = "amlogic,axg-tdm-iface";
+   #sound-dai-cells = <0>;
+   sound-name-prefix = "TDM_A";
+   clocks = <&clkc_audio AUD_CLKID_MST_A_MCLK>,
+<&clkc_audio AUD_CLKID_MST_A_SCLK>,
+<&clkc_audio AUD_CLKID_MST_A_LRCLK>;
+   clock-names = "mclk", "sclk", "lrclk";
+   status = "disabled";
+   };
+
+   tdmif_b: audio-controller-1 {
+   compatible = "amlogic,axg-tdm-iface";
+   #sound-dai-cells = <0>;
+   sound-name-prefix = "TDM_B";
+   clocks = <&clkc_audio AUD_CLKID_MST_B_MCLK>,
+<&clkc_audio AUD_CLKID_MST_B_SCLK>,
+<&clkc_audio AUD_CLKID_MST_B_LRCLK>;
+   clock-names = "mclk", "sclk", "lrclk";
+   status = "disabled";
+   };
+
+   tdmif_c: audio-controller-2 {
+   compatible = "amlogic,axg-tdm-iface";
+   #sound-dai-cells = <0>;
+   sound-name-prefix = "TDM_C";
+   clocks = <&clkc_audio AUD_CLKID_MST_C_MCLK>,
+<&clkc_audio AUD_CLKID_MST_C_SCLK>,
+<&clkc_audio AUD_CLKID_MST_C_LRCLK>;
+   clock-names = "mclk", "sclk", "lrclk";
+   status = "disabled";
+   };
+
+   efuse: efuse {
+   compatible = "amlogic,meson-gxbb-efuse";
+   clocks = <&clkc CLKID_EFUSE>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   read-only;
+   };
+
+   psci {
+   compatible = "arm,psci-1.0";
+   method = "smc";
+   };
+
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   /* 3 MiB reserved for ARM Trusted Firmware (BL31) */
+   secmon_reserved: secmon@500 {
+   reg = <0x0 0x0500 0x0 0x30>;
+   no-map;
+   };
+
+   linux,cma {
+   compatible = "shared-dma-pool";
+   reusable;
+   size = <0x0 0x1000>;
+   alignment = <0x0 0x40>;
+   linux,cma-default;
+   };
+   };
+
+   sm: secure-monitor {
+   compatible = "amlogic,meson-gxbb-sm";
+   };
+
+   soc {
+   compatible = "simple-bus";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   ethmac: ethernet@ff3f {
+   compatible = "amlogic,meson-axg-dwmac",
+  

[U-Boot] [PATCH 2/2] configs: Add Khadas VIM3 defconfig

2019-09-01 Thread Andreas Färber
Derived from odroid-n2_defconfig and README.odroid-n2.

Signed-off-by: Andreas Färber 
---
 board/amlogic/w400/MAINTAINERS|   1 +
 board/amlogic/w400/README.khadas-vim3 | 132 ++
 configs/khadas-vim3_defconfig |  54 ++
 3 files changed, 187 insertions(+)
 create mode 100644 board/amlogic/w400/README.khadas-vim3
 create mode 100644 configs/khadas-vim3_defconfig

diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
index 6e68fa73f7..3b21f50367 100644
--- a/board/amlogic/w400/MAINTAINERS
+++ b/board/amlogic/w400/MAINTAINERS
@@ -3,4 +3,5 @@ M:  Neil Armstrong 
 S: Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/w400/
+F: configs/khadas-vim3_defconfig
 F: configs/odroid-n2_defconfig
diff --git a/board/amlogic/w400/README.khadas-vim3 
b/board/amlogic/w400/README.khadas-vim3
new file mode 100644
index 00..39b2b06000
--- /dev/null
+++ b/board/amlogic/w400/README.khadas-vim3
@@ -0,0 +1,132 @@
+U-Boot for Khadas VIM3
+==
+
+Khadas VIM3 is a single board computer manufactured by Shenzhen Wesion
+Technology Co., Ltd. with the following specifications:
+
+ - Amlogic A311D Arm Cortex-A53 dual-core + Cortex-A73 quad-core SoC
+ - 4GB LPDDR4 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.1 display
+ - 40-pin GPIO header
+ - 1 x USB 3.0 Host, 1 x USB 2.0 Host
+ - eMMC, microSD
+ - M.2
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the U-Boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - ADC
+
+u-boot compilation
+==
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make khadas-vim3_defconfig
+ > make
+
+Image creation
+==
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+ > DIR=vim3-u-boot
+ > git clone --depth 1 \
+   https://github.com/khadas/u-boot.git -b khadas-vim3-v2015.01 \
+   $DIR
+
+ > cd vim3-u-boot
+ > make kvim3_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+ Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/khadas/kvim3/firmware/acs.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl2.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl30.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl31.img fip/
+ > cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/
+ > cp $UBOOTDIR/fip/g12b/lpddr3_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/piei.fw fip/
+ > cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+   fip/bl30.bin \
+   fip/zero_tmp \
+   fip/bl30_zero.bin \
+   fip/bl301.bin \
+   fip/bl301_zero.bin \
+   fip/bl30_new.bin \
+   bl30
+
+ > sh fip/blx_fix.sh \
+   fip/bl2.bin \
+   fip/zero_tmp \
+   fip/bl2_zero.bin \
+   fip/acs.bin \
+   fip/bl21_zero.bin \
+   fip/bl2_new.bin \
+   bl2
+
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+   --output fip/bl30_new.bin.g12a.enc \
+   --level v3
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input 
fip/bl30_new.bin.g12a.enc \
+   --output fip/bl30_new.bin.enc \
+   --level v3 --type bl30
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
+   --output fip/bl31.img.enc \
+   --level v3 --type bl31
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin 
--compress lz4 \
+   --output fip/bl33.bin.enc \
+   --level v3 --type bl33 --compress lz4
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
+   --output fip/bl2.n.bin.sig
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
+   --output fip/u-boot.bin \
+   --

Re: [U-Boot] [PATCH 2/2] configs: Add Khadas VIM3 defconfig

2019-09-01 Thread Andreas Färber
Am 02.09.19 um 04:28 schrieb Andreas Färber:
> diff --git a/board/amlogic/w400/README.khadas-vim3 
> b/board/amlogic/w400/README.khadas-vim3
> new file mode 100644
> index 00..39b2b06000
> --- /dev/null
> +++ b/board/amlogic/w400/README.khadas-vim3
[...]
> + > DIR=vim3-u-boot
> + > git clone --depth 1 \
> +   https://github.com/khadas/u-boot.git -b khadas-vim3-v2015.01 \
> +   $DIR

That branch name should've been khadas-vims-v2015.01 - both exist, the
above one was not working and the reason I held back the patches.

Regards,
Andreas

-- 
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer
HRB 247165 (AG München)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot