[U-Boot] [PATCH v2 2/2] ARM: highbank: remove DRAM bank setup

2015-06-20 Thread Andre Przywara
From: Rob Herring 

On the highbank platform the SoC's management controller firmware
will probe the DRAM modules and populates the initial device tree with
the correct values. Therefore the memory sizes in the DT are already
correct, so remove U-Boot's DRAM bank setup so the memory node is not
"fixed up" by u-boot.

Signed-off-by: Rob Herring 
Signed-off-by: Andre Przywara 
---
 board/highbank/highbank.c  | 6 --
 include/configs/highbank.h | 3 ++-
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 469ee8e..55999ed 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -96,12 +96,6 @@ int dram_init(void)
return 0;
 }
 
-void dram_init_banksize(void)
-{
-   gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-   gd->bd->bi_dram[0].size =  PHYS_SDRAM_1_SIZE;
-}
-
 #if defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *fdt, bd_t *bd)
 {
diff --git a/include/configs/highbank.h b/include/configs/highbank.h
index 08dcdf8..0c5f927 100644
--- a/include/configs/highbank.h
+++ b/include/configs/highbank.h
@@ -80,8 +80,9 @@
 
 /*---
  * Physical Memory Map
+ * The DRAM is already setup, so do not touch the DT node later.
  */
-#define CONFIG_NR_DRAM_BANKS   1
+#define CONFIG_NR_DRAM_BANKS   0
 #define PHYS_SDRAM_1_SIZE  (4089 << 20)
 #define CONFIG_SYS_MEMTEST_START   0x10
 #define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1_SIZE - 0x10)
-- 
1.8.4

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


[U-Boot] [PATCH v2 1/2] fdt: prevent clearing memory node if there are no banks

2015-06-20 Thread Andre Przywara
Avoid clearing the reg property in the memory DT node if no memory
banks have been specified for a board (CONFIG_NR_DRAM_BANKS == 0).
This allows boards to let U-Boot skip the DT memory tinkering in case
other firmware has already setup the node properly before.
This should be safe as all callers of fdt_fixup_memory_banks that use
a computed  value put at least 1 in there.
Add some documentation comments to the header file.

Signed-off-by: Andre Przywara 
---
Hi Tom,

if you haven't applied the last version of this patch, consider using
this version instead, which has Rob's comment addressed (bailing out
early).

Cheers,
Andre.

 common/fdt_support.c  |  3 +++
 include/fdt_support.h | 26 ++
 2 files changed, 29 insertions(+)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 10648b5..f86365e 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -454,6 +454,9 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 
size[], int banks)
return err;
}
 
+   if (!banks)
+   return 0;
+
len = fdt_pack_reg(blob, tmp, start, size, banks);
 
err = fdt_setprop(blob, nodeoffset, "reg", tmp, len);
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 0edc4fa..296add0 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -67,8 +67,34 @@ void do_fixup_by_compat(void *fdt, const char *compat,
const char *prop, const void *val, int len, int create);
 void do_fixup_by_compat_u32(void *fdt, const char *compat,
const char *prop, u32 val, int create);
+/**
+ * Setup the memory node in the DT. Creates one if none was existing before.
+ * Calls fdt_fixup_memory_banks() to populate a single reg pair covering the
+ * whole memory.
+ *
+ * @param blob FDT blob to update
+ * @param startBegin of DRAM mapping in physical memory
+ * @param size Size of the single memory bank
+ * @return 0 if ok, or -1 or -FDT_ERR_... on error
+ */
 int fdt_fixup_memory(void *blob, u64 start, u64 size);
+
+/**
+ * Fill the DT memory node with multiple memory banks.
+ * Creates the node if none was existing before.
+ * If banks is 0, it will not touch the existing reg property. This allows
+ * boards to not mess with the existing DT setup, which may have been
+ * filled in properly before.
+ *
+ * @param blob FDT blob to update
+ * @param startArray of size  to hold the start 
addresses.
+ * @param size Array of size  to hold the size of each region.
+ * @param banksNumber of memory banks to create. If 0, the reg
+ * property will be left untouched.
+ * @return 0 if ok, or -1 or -FDT_ERR_... on error
+ */
 int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks);
+
 void fdt_fixup_ethernet(void *fdt);
 int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
 const void *val, int len, int create);
-- 
1.8.4

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


Re: [U-Boot] [PATCH 0/3] sunxi: Enable both ehci and otg in host mode on various boards

2015-06-20 Thread Marek Vasut
On Saturday, June 20, 2015 at 08:12:32 PM, Hans de Goede wrote:
> Hi,

Hi!

> On 20-06-15 18:08, Marek Vasut wrote:
> > On Saturday, June 20, 2015 at 05:35:06 PM, Hans de Goede wrote:
> >> Hi All,
> >> 
> >> Here is a small series enabling the combined use of ehci + musb-otg on
> >> more sunxi boards. This applies on top of my large series for making
> >> this possible posted earlier.
> >> 
> >> As said before I believe it is best if all the sunxi bits of that series
> >> go upstream through u-boot-sunxi/master, the same applies for these 3.
> >> 
> >> Regards,
> > 
> > Series is
> > 
> > Reviewed-by: Marek Vasut 
> 
> I assume this only applies to these 3, or do you mean both the original
> series adding musb device-model support as well as these 3?

I mean these three ;-)

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


Re: [U-Boot] [PATCH 0/3] sunxi: Enable both ehci and otg in host mode on various boards

2015-06-20 Thread Hans de Goede

Hi,

On 20-06-15 18:08, Marek Vasut wrote:

On Saturday, June 20, 2015 at 05:35:06 PM, Hans de Goede wrote:

Hi All,

Here is a small series enabling the combined use of ehci + musb-otg on more
sunxi boards. This applies on top of my large series for making this
possible posted earlier.

As said before I believe it is best if all the sunxi bits of that series
go upstream through u-boot-sunxi/master, the same applies for these 3.

Regards,


Series is

Reviewed-by: Marek Vasut 


I assume this only applies to these 3, or do you mean both the original
series adding musb device-model support as well as these 3?

Regards,

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


Re: [U-Boot] [PATCH 0/3] sunxi: Enable both ehci and otg in host mode on various boards

2015-06-20 Thread Marek Vasut
On Saturday, June 20, 2015 at 05:35:06 PM, Hans de Goede wrote:
> Hi All,
> 
> Here is a small series enabling the combined use of ehci + musb-otg on more
> sunxi boards. This applies on top of my large series for making this
> possible posted earlier.
> 
> As said before I believe it is best if all the sunxi bits of that series
> go upstream through u-boot-sunxi/master, the same applies for these 3.
> 
> Regards,

Series is

Reviewed-by: Marek Vasut 

Thanks!

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


[U-Boot] [PATCH] spi: zynq_spi.c:Optmizations done in spi_xfer func

2015-06-20 Thread Chakra Divi
This Patch replaces the arithmatic operators with bitwise
operators for optimizations hoping it would save some cycles

Signed-off-by: Chakra Divi 
---
Note: Jagan or anyone please test this patch, I don't have hardware with me.
---
 drivers/spi/zynq_spi.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/zynq_spi.c b/drivers/spi/zynq_spi.c
index e9129da..a8a160b 100644
--- a/drivers/spi/zynq_spi.c
+++ b/drivers/spi/zynq_spi.c
@@ -218,7 +218,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, 
const void *dout,
void *din, unsigned long flags)
 {
struct zynq_spi_slave *zslave = to_zynq_spi_slave(slave);
-   u32 len = bitlen / 8;
+   u32 len = bitlen >> 3;
u32 tx_len = len, rx_len = len, tx_tvl;
const u8 *tx_buf = dout;
u8 *rx_buf = din, buf;
@@ -227,7 +227,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, 
const void *dout,
debug("spi_xfer: bus:%i cs:%i bitlen:%i len:%i flags:%lx\n",
  slave->bus, slave->cs, bitlen, len, flags);
 
-   if (bitlen % 8) {
+   if (bitlen & 0x7) {
debug("spi_xfer: Non byte aligned SPI transfer\n");
return -1;
}
-- 
1.7.9.5

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


[U-Boot] [PATCH 1/3] sunxi: musb: Improve output during probing

2015-06-20 Thread Hans de Goede
When we return an error the usb core will log a message, so in this case
do not print a newline, instead print ": " after our identifier as a
seperator between our identifier and the error message logged by the core.

Signed-off-by: Hans de Goede 
---
 drivers/usb/musb-new/sunxi.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index d1cb8e0..bb88687 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -301,21 +301,26 @@ int musb_usb_probe(struct udevice *dev)
 {
struct musb_host_data *host = dev_get_priv(dev);
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
+   int ret;
 
priv->desc_before_addr = true;
 
+   printf("MUSB OTG");
+
if (!host->host) {
host->host = musb_init_controller(&musb_plat, NULL,
  (void *)SUNXI_USB0_BASE);
if (!host->host) {
-   printf("Failed to init the controller\n");
+   printf(": ");
return -EIO;
}
}
 
-   printf("MUSB OTG in host-mode\n");
+   ret = musb_lowlevel_init(host);
+
+   printf((ret == 0) ? "\n" : ": ");
 
-   return musb_lowlevel_init(host);
+   return ret;
 }
 
 int musb_usb_remove(struct udevice *dev)
-- 
2.4.3

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


[U-Boot] [PATCH 3/3] sunxi: Enable both ehci and otg in host mode on various boards

2015-06-20 Thread Hans de Goede
Now that the device-model port of the musb mode makes it possible, enable
both the ehci and oth in host mode on boards where the otg is wired up in
host only mode, either via an usb-a receptacle or via an usb <-> sata
converter.

Signed-off-by: Hans de Goede 
---
 configs/CSQ_CS908_defconfig| 4 +++-
 configs/Mele_A1000G_quad_defconfig | 4 +++-
 configs/Mini-X_defconfig   | 5 -
 configs/ba10_tv_box_defconfig  | 5 -
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/configs/CSQ_CS908_defconfig b/configs/CSQ_CS908_defconfig
index 850d70d..f89e67c 100644
--- a/configs/CSQ_CS908_defconfig
+++ b/configs/CSQ_CS908_defconfig
@@ -6,7 +6,9 @@ CONFIG_USB1_VBUS_PIN=""
 CONFIG_USB2_VBUS_PIN=""
 CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31s-cs908"
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC"
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_SUNXI=y
diff --git a/configs/Mele_A1000G_quad_defconfig 
b/configs/Mele_A1000G_quad_defconfig
index 3a746c8..3a2c155 100644
--- a/configs/Mele_A1000G_quad_defconfig
+++ b/configs/Mele_A1000G_quad_defconfig
@@ -16,9 +16,11 @@ CONFIG_USB1_VBUS_PIN="PC27"
 CONFIG_USB2_VBUS_PIN=""
 CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31-mele-a1000g-quad"
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC"
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_AXP221_DCDC1_VOLT=3300
 CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_DLDO4_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_SUNXI=y
diff --git a/configs/Mini-X_defconfig b/configs/Mini-X_defconfig
index 918b639..3ce3272 100644
--- a/configs/Mini-X_defconfig
+++ b/configs/Mini-X_defconfig
@@ -3,4 +3,7 @@ CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-mini-xplus"
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,USB_EHCI"
+CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_SUNXI=y
+CONFIG_USB0_VBUS_PIN="PB9"
diff --git a/configs/ba10_tv_box_defconfig b/configs/ba10_tv_box_defconfig
index f2ab415..111792f 100644
--- a/configs/ba10_tv_box_defconfig
+++ b/configs/ba10_tv_box_defconfig
@@ -6,4 +6,7 @@ CONFIG_DRAM_EMR1=4
 CONFIG_USB2_VBUS_PIN="PH12"
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-ba10-tvbox"
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,USB_EHCI"
+CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC"
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_SUNXI=y
+CONFIG_USB0_VBUS_PIN="PB9"
-- 
2.4.3

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


[U-Boot] [PATCH 0/3] sunxi: Enable both ehci and otg in host mode on various boards

2015-06-20 Thread Hans de Goede
Hi All,

Here is a small series enabling the combined use of ehci + musb-otg on more
sunxi boards. This applies on top of my large series for making this possible
posted earlier.

As said before I believe it is best if all the sunxi bits of that series
go upstream through u-boot-sunxi/master, the same applies for these 3.

Regards,

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


[U-Boot] [PATCH 2/3] sunxi: musb: Stop treating not having a vbus-det gpio as an error

2015-06-20 Thread Hans de Goede
On some boards the otg is wired up in host-only mode in this case we
have no vbus-det gpio.

Stop logging an error from sunxi_usb_phy_vbus_detect() in this case, and
stop treating sunxi_usb_phy_vbus_detect() returning a negative errno, as
if a charger is plugged into the otg port.

Signed-off-by: Hans de Goede 
---
 arch/arm/cpu/armv7/sunxi/usb_phy.c | 4 +---
 drivers/usb/musb-new/sunxi.c   | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/usb_phy.c 
b/arch/arm/cpu/armv7/sunxi/usb_phy.c
index 5e82ddc..4d63a74 100644
--- a/arch/arm/cpu/armv7/sunxi/usb_phy.c
+++ b/arch/arm/cpu/armv7/sunxi/usb_phy.c
@@ -237,10 +237,8 @@ int sunxi_usb_phy_vbus_detect(int index)
struct sunxi_usb_phy *phy = &sunxi_usb_phy[index];
int err, retries = 3;
 
-   if (phy->gpio_vbus_det < 0) {
-   eprintf("Error: invalid vbus detection pin\n");
+   if (phy->gpio_vbus_det < 0)
return phy->gpio_vbus_det;
-   }
 
err = gpio_get_value(phy->gpio_vbus_det);
/*
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index bb88687..f091a2d 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -208,7 +208,7 @@ static int sunxi_musb_enable(struct musb *musb)
 
if (is_host_enabled(musb)) {
ret = sunxi_usb_phy_vbus_detect(0);
-   if (ret) {
+   if (ret == 1) {
printf("A charger is plugged into the OTG: ");
return -ENODEV;
}
-- 
2.4.3

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


Re: [U-Boot] [PATCH] mmc: bcm2835_sdhci: Restore original delay behavior

2015-06-20 Thread Marek Vasut
On Saturday, June 20, 2015 at 01:36:58 PM, Jakub Kiciński wrote:
> On Fri, 19 Jun 2015 23:39:41 +0200, Marek Vasut wrote:
> > Patch 33fe2fb8df01647f97a7bce96a1c7781a7f6d253 titled
> > "mmc: bcm283x: Remove get_timer_us() from mmc driver"
> > incorrectly replaced ad-hoc get_timer_us() function
> > with a plain get_timer(). The get_timer() operates in
> > mSec units instead of uSec though, which caused very
> > slow operation of the driver.
> > 
> > Restore the original behavior of the driver, but avoid
> > get_timer_us() and use timer_get_us() instead. The later
> > is part of the standard API.
> > 
> > Signed-off-by: Marek Vasut 
> > Cc: Jakub Kiciński 
> > Cc: Stephen Warren 
> 
> Tested-by: Jakub Kicinski 

Thanks :)

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


Re: [U-Boot] [PATCH] mmc: bcm2835_sdhci: Restore original delay behavior

2015-06-20 Thread Jakub Kiciński
On Fri, 19 Jun 2015 23:39:41 +0200, Marek Vasut wrote:
> Patch 33fe2fb8df01647f97a7bce96a1c7781a7f6d253 titled
> "mmc: bcm283x: Remove get_timer_us() from mmc driver"
> incorrectly replaced ad-hoc get_timer_us() function
> with a plain get_timer(). The get_timer() operates in
> mSec units instead of uSec though, which caused very
> slow operation of the driver.
> 
> Restore the original behavior of the driver, but avoid
> get_timer_us() and use timer_get_us() instead. The later
> is part of the standard API.
> 
> Signed-off-by: Marek Vasut 
> Cc: Jakub Kiciński 
> Cc: Stephen Warren 

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