Re: [U-Boot] [uboot] [PATCH 5/7] net: phy: Move is_rgmii helper to phy.h

2016-04-11 Thread Michal Simek
On 8.4.2016 18:08, Dan Murphy wrote:
> Move the phy_interface_is_rgmii to the phy.h
> file for all phy's to be able to use the API.
> 
> This now aligns with the Linux kernel based on
> commit e463d88c36d42211aa72ed76d32fb8bf37820ef1
> 
> Signed-off-by: Dan Murphy 
> ---
>  drivers/net/phy/ti.c | 11 ---
>  include/phy.h| 11 +++
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
> index 922f0a4..d503eef 100644
> --- a/drivers/net/phy/ti.c
> +++ b/drivers/net/phy/ti.c
> @@ -156,17 +156,6 @@ void phy_write_mmd_indirect(struct phy_device *phydev, 
> int prtad,
>   phy_write(phydev, addr, MII_MMD_DATA, data);
>  }
>  
> -/**
> - * phy_interface_is_rgmii - Convenience function for testing if a PHY 
> interface
> - * is RGMII (all variants)
> - * @phydev: the phy_device struct
> - */
> -static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
> -{
> - return phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
> - phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
> -}
> -
>  #if defined(CONFIG_DM_ETH)
>  /**
>   * dp83867_data_init - Convenience function for setting PHY specific data
> diff --git a/include/phy.h b/include/phy.h
> index 21459a8..7b2d1ff 100644
> --- a/include/phy.h
> +++ b/include/phy.h
> @@ -277,6 +277,17 @@ int get_phy_id(struct mii_dev *bus, int addr, int devad, 
> u32 *phy_id);
>   */
>  int phy_get_interface_by_name(const char *str);
>  
> +/**
> + * phy_interface_is_rgmii - Convenience function for testing if a PHY 
> interface
> + * is RGMII (all variants)
> + * @phydev: the phy_device struct
> + */
> +static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
> +{
> + return phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
> + phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
> +}
> +
>  /* PHY UIDs for various PHYs that are referenced in external code */
>  #define PHY_UID_CS4340  0x13e51002
>  #define PHY_UID_TN2020   0x00a19410
> 

Reviewed-by: Michal Simek 

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


Re: [U-Boot] [uboot] [PATCH 7/7] net: phy: dp83867: Add SGMII helper for configuration

2016-04-11 Thread Michal Simek
On 8.4.2016 18:08, Dan Murphy wrote:
> The code assumed that if the interface is not RGMII configured
> then it must be SGMII configured.  This device has the ability
> to support most of the MII interfaces.  Therefore add the
> helper for SGMII and only configure the device if the interface is
> configured for SGMII.
> 
> Signed-off-by: Dan Murphy 
> ---
>  drivers/net/phy/ti.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
> index d503eef..4402c52 100644
> --- a/drivers/net/phy/ti.c
> +++ b/drivers/net/phy/ti.c
> @@ -219,7 +219,7 @@ static int dp83867_config(struct phy_device *phydev)
>   (dp83867->fifo_depth << 
> DP83867_PHYCR_FIFO_DEPTH_SHIFT));
>   if (ret)
>   goto err_out;
> - } else {
> + } else if (phy_interface_is_sgmii(phydev)) {
>   phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
> (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
>  
> 

Reviewed-by: Michal Simek 

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


Re: [U-Boot] [uboot] [PATCH 6/7] net: phy: Add phy_interface_is_sgmii to phy.h

2016-04-11 Thread Michal Simek
On 8.4.2016 18:08, Dan Murphy wrote:
> Add a helper to phy.h to identify whether the
> phy is configured for SGMII all variables.
> 
> Signed-off-by: Dan Murphy 
> ---
>  include/phy.h | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/phy.h b/include/phy.h
> index 7b2d1ff..ef3eb51 100644
> --- a/include/phy.h
> +++ b/include/phy.h
> @@ -288,6 +288,17 @@ static inline bool phy_interface_is_rgmii(struct 
> phy_device *phydev)
>   phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
>  }
>  
> +/**
> + * phy_interface_is_sgmii - Convenience function for testing if a PHY 
> interface
> + * is SGMII (all variants)
> + * @phydev: the phy_device struct
> + */
> +static inline bool phy_interface_is_sgmii(struct phy_device *phydev)
> +{
> + return phydev->interface >= PHY_INTERFACE_MODE_SGMII &&
> + phydev->interface <= PHY_INTERFACE_MODE_QSGMII;
> +}
> +
>  /* PHY UIDs for various PHYs that are referenced in external code */
>  #define PHY_UID_CS4340  0x13e51002
>  #define PHY_UID_TN2020   0x00a19410
> 

Reviewed-by: Michal Simek 

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


Re: [U-Boot] [uboot] [PATCH v4 3/7] net: phy: dp83867: Add device tree bindings and documentation

2016-04-11 Thread Michal Simek
On 8.4.2016 18:08, Dan Murphy wrote:
> Add the device tree bindings and the accompanying documentation
> for the TI DP83867 Giga bit ethernet phy driver.
> 
> The original document was from:
> [commit 2a10154abcb75ad0d7b6bfea6210ac743ec60897 from the Linux kernel]
> 
> Signed-off-by: Dan Murphy 
> ---
> 
> v3- Update the bindings to the reflect the implementation
> 
>  doc/device-tree-bindings/net/ti,dp83867.txt | 25 +
>  include/dt-bindings/net/ti-dp83867.h| 35 
> +
>  2 files changed, 60 insertions(+)
>  create mode 100644 doc/device-tree-bindings/net/ti,dp83867.txt
>  create mode 100644 include/dt-bindings/net/ti-dp83867.h
> 
> diff --git a/doc/device-tree-bindings/net/ti,dp83867.txt 
> b/doc/device-tree-bindings/net/ti,dp83867.txt
> new file mode 100644
> index 000..cb77fdf
> --- /dev/null
> +++ b/doc/device-tree-bindings/net/ti,dp83867.txt
> @@ -0,0 +1,25 @@
> +* Texas Instruments - dp83867 Giga bit ethernet phy
> +
> +Required properties:
> + - reg - The ID number for the phy, usually a small integer
> + - ti,rx-internal-delay - RGMII Recieve Clock Delay - see 
> dt-bindings/net/ti-dp83867.h
> + for applicable values
> + - ti,tx-internal-delay - RGMII Transmit Clock Delay - see 
> dt-bindings/net/ti-dp83867.h
> + for applicable values
> + - ti,fifo-depth - Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h
> + for applicable values
> +
> +Default child nodes are standard Ethernet PHY device
> +nodes as described in doc/devicetree/bindings/net/ethernet.txt
> +
> +Example:
> +
> + ethernet-phy@0 {
> + reg = <0>;
> + ti,rx-internal-delay = ;
> + ti,tx-internal-delay = ;
> + ti,fifo-depth = ;
> + };
> +
> +Datasheet can be found:
> +http://www.ti.com/product/DP83867IR/datasheet
> diff --git a/include/dt-bindings/net/ti-dp83867.h 
> b/include/dt-bindings/net/ti-dp83867.h
> new file mode 100644
> index 000..5c592fb
> --- /dev/null
> +++ b/include/dt-bindings/net/ti-dp83867.h
> @@ -0,0 +1,35 @@
> +/*
> + * TI DP83867 PHY drivers
> + *
> + * SPDX-License-Identifier:  GPL-2.0
> + *

I would remove this one line above.

> + */
> +
> +#ifndef _DT_BINDINGS_TI_DP83867_H
> +#define _DT_BINDINGS_TI_DP83867_H
> +
> +/* PHY CTRL bits */
> +#define DP83867_PHYCR_FIFO_DEPTH_3_B_NIB 0x00
> +#define DP83867_PHYCR_FIFO_DEPTH_4_B_NIB 0x01
> +#define DP83867_PHYCR_FIFO_DEPTH_6_B_NIB 0x02
> +#define DP83867_PHYCR_FIFO_DEPTH_8_B_NIB 0x03
> +
> +/* RGMIIDCTL internal delay for rx and tx */
> +#define  DP83867_RGMIIDCTL_250_PS0x0
> +#define  DP83867_RGMIIDCTL_500_PS0x1
> +#define  DP83867_RGMIIDCTL_750_PS0x2
> +#define  DP83867_RGMIIDCTL_1_NS  0x3
> +#define  DP83867_RGMIIDCTL_1_25_NS   0x4
> +#define  DP83867_RGMIIDCTL_1_50_NS   0x5
> +#define  DP83867_RGMIIDCTL_1_75_NS   0x6
> +#define  DP83867_RGMIIDCTL_2_00_NS   0x7
> +#define  DP83867_RGMIIDCTL_2_25_NS   0x8
> +#define  DP83867_RGMIIDCTL_2_50_NS   0x9
> +#define  DP83867_RGMIIDCTL_2_75_NS   0xa
> +#define  DP83867_RGMIIDCTL_3_00_NS   0xb
> +#define  DP83867_RGMIIDCTL_3_25_NS   0xc
> +#define  DP83867_RGMIIDCTL_3_50_NS   0xd
> +#define  DP83867_RGMIIDCTL_3_75_NS   0xe
> +#define  DP83867_RGMIIDCTL_4_00_NS   0xf
> +
> +#endif
> 

It looks weird that you have in one patch #definename.

Please sync it.

Thanks,
Michal

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


Re: [U-Boot] [uboot] [PATCH v4 4/7] net: phy: ti: Allow the driver to be more configurable

2016-04-11 Thread Michal Simek
On 8.4.2016 18:08, Dan Murphy wrote:
> Not all devices use the same internal delay or fifo depth.
> Add the ability to set the internal delay for rx or tx and the
> fifo depth via the devicetree.  If the value is not set in the
> devicetree then set the delay to the default.
> 
> If devicetree is not used then use the default defines within the
> driver.
> 
> Signed-off-by: Dan Murphy 
> ---
> 
> v4 - Rebased the driver and changed default values to -1
> 
>  drivers/net/phy/ti.c | 85 
> +---
>  1 file changed, 75 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
> index 937426b..922f0a4 100644
> --- a/drivers/net/phy/ti.c
> +++ b/drivers/net/phy/ti.c
> @@ -6,6 +6,14 @@
>   */
>  #include 
>  #include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
>  
>  /* TI DP83867 */
>  #define DP83867_DEVADDR  0x1f
> @@ -71,6 +79,17 @@
>  #define MII_MMD_CTRL_INCR_RDWT   0x8000 /* post increment on reads & 
> writes */
>  #define MII_MMD_CTRL_INCR_ON_WT  0xC000 /* post increment on writes only 
> */
>  
> +/* User setting - can be taken from DTS */
> +#define DEFAULT_RX_ID_DELAY  DP83867_RGMIIDCTL_2_25_NS
> +#define DEFAULT_TX_ID_DELAY  DP83867_RGMIIDCTL_2_75_NS
> +#define DEFAULT_FIFO_DEPTH   DP83867_PHYCR_FIFO_DEPTH_4_B_NIB
> +
> +struct dp83867_private {
> + int rx_id_delay;
> + int tx_id_delay;
> + int fifo_depth;
> +};
> +
>  /**
>   * phy_read_mmd_indirect - reads data from the MMD registers
>   * @phydev: The PHY device bus
> @@ -148,16 +167,58 @@ static inline bool phy_interface_is_rgmii(struct 
> phy_device *phydev)
>   phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
>  }
>  
> -/* User setting - can be taken from DTS */
> -#define RX_ID_DELAY  8
> -#define TX_ID_DELAY  0xa
> -#define FIFO_DEPTH   1
> +#if defined(CONFIG_DM_ETH)
> +/**
> + * dp83867_data_init - Convenience function for setting PHY specific data
> + *
> + * @phydev: the phy_device struct
> + */
> +static int dp83867_of_init(struct phy_device *phydev)
> +{
> + struct dp83867_private *dp83867 = phydev->priv;
> + struct udevice *dev = phydev->dev;
> +
> + dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
> +  "ti,rx_internal_delay", -1);
> +
> + dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
> +  "ti,tx_internal_delay", -1);
> +
> + dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
> +  "ti,fifo_depth", -1);
> +

These names are still incompatible with binding you have.
There are dashes instead of underscores.


> + return 0;
> +}
> +#else
> +static int dp83867_of_init(struct phy_device *phydev)
> +{
> + dp83867->rx_id_delay = DEFAULT_RX_ID_DELAY;
> + dp83867->tx_id_delay = DEFAULT_TX_ID_DELAY;
> + dp83867->fifo_depth = DEFAULT_FIFO_DEPTH;
> +
> + return 0;
> +}
> +#endif
>  
>  static int dp83867_config(struct phy_device *phydev)
>  {
> + struct dp83867_private *dp83867;
>   unsigned int val, delay, cfg2;
>   int ret;
>  
> + if (!phydev->priv) {
> + dp83867 = kzalloc(sizeof(*dp83867), GFP_KERNEL);
> + if (!dp83867)
> + return -ENOMEM;
> +
> + phydev->priv = dp83867;
> + ret = dp83867_of_init(phydev);
> + if (ret)
> + goto err_out;
> + } else {
> + dp83867 = (struct dp83867_private *)phydev->priv;
> + }
> +
>   /* Restart the PHY.  */
>   val = phy_read(phydev, MDIO_DEVAD_NONE, DP83867_CTRL);
>   phy_write(phydev, MDIO_DEVAD_NONE, DP83867_CTRL,
> @@ -166,9 +227,9 @@ static int dp83867_config(struct phy_device *phydev)
>   if (phy_interface_is_rgmii(phydev)) {
>   ret = phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL,
>   (DP83867_MDI_CROSSOVER_AUTO << DP83867_MDI_CROSSOVER) |
> - (FIFO_DEPTH << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
> + (dp83867->fifo_depth << 
> DP83867_PHYCR_FIFO_DEPTH_SHIFT));
>   if (ret)
> - return ret;
> + goto err_out;
>   } else {
>   phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
> (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
> @@ -189,8 +250,8 @@ static int dp83867_config(struct phy_device *phydev)
> DP83867_PHYCTRL_SGMIIEN |
> (DP83867_MDI_CROSSOVER_MDIX <<
> DP83867_MDI_CROSSOVER) |
> -   (FIFO_DEPTH << DP83867_PHYCTRL_RXFIFO_SHIFT) |
> -   (FIFO_DEPTH  << DP83867_PHYCTRL_TXFIFO_SHIFT));
> +   (dp83867->fifo_depth << DP83867_PHYCTRL_RXFIFO_SHIFT) 
> |
> +   (dp83867->fifo_depth  << 

Re: [U-Boot] [uboot] [PATCH 2/7] net: zynq_gem: Add the passing of the phy-handle node

2016-04-11 Thread Michal Simek
On 8.4.2016 18:08, Dan Murphy wrote:
> Add the ability to pass the phy-handle node offset
> to the phy driver.  This allows the phy driver
> to access the DT subnode's data and parse accordingly.
> 
> Signed-off-by: Dan Murphy 
> ---
>  drivers/net/zynq_gem.c | 12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index aec8077..722927a 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -179,6 +179,7 @@ struct zynq_gem_priv {
>   struct zynq_gem_regs *iobase;
>   phy_interface_t interface;
>   struct phy_device *phydev;
> + int phy_of_handle;
>   struct mii_dev *bus;
>  };
>  
> @@ -352,6 +353,10 @@ static int zynq_phy_init(struct udevice *dev)
>   priv->phydev->supported = supported | ADVERTISED_Pause |
> ADVERTISED_Asym_Pause;
>   priv->phydev->advertising = priv->phydev->supported;
> +
> + if (priv->phy_of_handle > 0)
> + priv->phydev->dev->of_offset = priv->phy_of_handle;
> +
>   phy_config(priv->phydev);
>  
>   return 0;
> @@ -684,10 +689,11 @@ static int zynq_gem_ofdata_to_platdata(struct udevice 
> *dev)
>   priv->emio = 0;
>   priv->phyaddr = -1;
>  
> - offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
> + priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob, 
> dev->of_offset,
>  "phy-handle");

This line is longer than 80 chars - checkpatch is failing on it.


> - if (offset > 0)
> - priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
> + if (priv->phy_of_handle > 0)
> + priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
> + priv->phy_of_handle, "reg", -1);
>  
>   phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
>   if (phy_mode)
> 

You have to remove offset too.
drivers/net/zynq_gem.c:683:6: warning: unused variable ‘offset’
[-Wunused-variable]
  int offset = 0;
  ^

With changes I have done myself it looks that it is working. I will
retest next version.

Thanks,
Michal


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


Re: [U-Boot] [uboot] [PATCH 1/7] drivers: net: cpsw: Add readinf of DT phy-handle node

2016-04-11 Thread Michal Simek
On 8.4.2016 18:08, Dan Murphy wrote:
> Add the ability to read the phy-handle node of the
> cpsw slave.  Upon reading this handle the phy-id
> can be stored based on the reg node in the DT.
> 
> The phy-handle also needs to be stored and passed
> to the phy to access any phy data that is available.
> 
> Signed-off-by: Dan Murphy 
> ---
>  drivers/net/cpsw.c | 18 --
>  include/cpsw.h |  1 +
>  2 files changed, 17 insertions(+), 2 deletions(-)


Just a generic node. There are couple of new patches in this series
which is great but please also label them as v4 (or new v5).

Mixing version is not good solution and I had to apply all patches twice
because of this.

Please look at patman to handle versions for you.

Thanks,
Michal

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


Re: [U-Boot] [PATCH v8 6/9] drivers: serial: add serial driver for ar933x SOC

2016-04-11 Thread Wills Wang



On Sunday, April 10, 2016 02:34 AM, Simon Glass wrote:

Hi Wills,

On 16 March 2016 at 02:59, Wills Wang  wrote:

This patch add support for ar933x serial.

Reviewed-by: Thomas Chou 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Simon Glass 

Signed-off-by: Wills Wang 

Reviewed-by: Simon Glass 

But please see a comment below.


---

Changes in v8:
- Remove ath79_serial_write/read
- Use pinctrl for serial
- Add Kconfig dependence for serial option

Changes in v7:
- remove map_physmem for debug port

Changes in v6:
- Remove wait loop in putc and getc
- Use map_physmem instead of KSEG1ADDR

Changes in v5:
- remove ar933x_serial_platdata
- Import document "qca,ar9330-uart.txt" from kernel
- Add support for debug UART

Changes in v4:
- Auto calculate baudrate for serial driver
- Move pinctrl code in serial driver into arch/mips/mach-ath79
- Use get_serial_clock to serial clock source

Changes in v3:
- Convert serial driver to driver model

Changes in v2:
- Move serial driver code into drivers/serial

  .../serial/qca,ar9330-uart.txt |  24 ++
  drivers/serial/Kconfig |  18 ++
  drivers/serial/Makefile|   1 +
  drivers/serial/serial_ar933x.c | 255 +
  4 files changed, 298 insertions(+)
  create mode 100644 doc/device-tree-bindings/serial/qca,ar9330-uart.txt
  create mode 100644 drivers/serial/serial_ar933x.c

diff --git a/doc/device-tree-bindings/serial/qca,ar9330-uart.txt 
b/doc/device-tree-bindings/serial/qca,ar9330-uart.txt
new file mode 100644
index 000..ec576a1
--- /dev/null
+++ b/doc/device-tree-bindings/serial/qca,ar9330-uart.txt
@@ -0,0 +1,24 @@
+* Qualcomm Atheros AR9330 High-Speed UART
+
+Required properties:
+
+- compatible: Must be "qca,ar9330-uart"
+
+- reg: Specifies the physical base address of the controller and
+  the length of the memory mapped region.
+
+Additional requirements:
+
+  Each UART port must have an alias correctly numbered in "aliases"
+  node.
+
+Example:
+
+   aliases {
+   serial0 = &uart0;
+   };
+
+   uart0: uart@1802 {
+   compatible = "qca,ar9330-uart";
+   reg = <0x1802 0x14>;
+   };
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 92d4212..d451441 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -89,6 +89,15 @@ config DEBUG_UART_ALTERA_UART
   You will need to provide parameters to make this work. The driver 
will
   be available until the real driver model serial is running.

+config DEBUG_UART_AR933X
+   bool "QCA/Atheros ar933x"
+   depends on AR933X_UART
+   help
+ Select this to enable a debug UART using the ar933x uart driver.
+ You will need to provide parameters to make this work. The
+ driver will be available until the real driver model serial is
+ running.
+
  config DEBUG_UART_NS16550
 bool "ns16550"
 help
@@ -254,6 +263,15 @@ config ALTERA_UART
   Select this to enable an UART for Altera devices. Please find
   details on the "Embedded Peripherals IP User Guide" of Altera.

+config AR933X_UART
+   bool "QCA/Atheros ar933x UART support"
+   depends on DM_SERIAL && SOC_AR933X
+   help
+ Select this to enable UART support for QCA/Atheros ar933x
+ devices. This driver uses driver model and requires a device
+ tree binding to operate, please refer to the document at
+ doc/device-tree-bindings/serial/qca,ar9330-uart.txt.
+
  config FSL_LPUART
 bool "Freescale LPUART support"
 help
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 05bdf56..42e493a 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -17,6 +17,7 @@ endif

  obj-$(CONFIG_ALTERA_UART) += altera_uart.o
  obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o
+obj-$(CONFIG_AR933X_UART) += serial_ar933x.o
  obj-$(CONFIG_ARM_DCC) += arm_dcc.o
  obj-$(CONFIG_ATMEL_USART) += atmel_usart.o
  obj-$(CONFIG_EFI_APP) += serial_efi.o
diff --git a/drivers/serial/serial_ar933x.c b/drivers/serial/serial_ar933x.c
new file mode 100644
index 000..d43f9c9
--- /dev/null
+++ b/drivers/serial/serial_ar933x.c
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2015-2016 Wills Wang 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AR933X_UART_DATA_REG0x00
+#define AR933X_UART_CS_REG  0x04
+#define AR933X_UART_CLK_REG 0x08
+
+#define AR933X_UART_DATA_TX_RX_MASK 0xff
+#define AR933X_UART_DATA_RX_CSR BIT(8)
+#define AR933X_UART_DATA_TX_CSR BIT(9)
+#define AR933X_UART_CS_IF_MODE_S2
+#define AR933X_UART_CS_IF_MODE_M0x3
+#define AR933X_UART_CS_IF_MODE_DTE  1
+#define AR933X_UART_CS_IF_MODE_DCE  2
+#define AR933X_UART_CS_TX_RDY_ORIDE BIT(7)

Re: [U-Boot] [PATCH 3/3] tests: py: dfu: Provide functionality to set test and dummy files alt settings

2016-04-11 Thread Lukasz Majewski
Hi Stephen,

> On 04/08/2016 09:44 AM, Lukasz Majewski wrote:
> > After concatenation of "dfu_alt_info" variable from "dfu_alt_boot"
> > and "dfu_alt_system" it may happen that test and dummy files alt
> > settings are different than default 0 and 1.
> >
> > This patch provides ability to set different values for them.
> > It was the simplest possible solution - akin to the one from
> > original bash dfu tests.
> 
> > diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py
> 
> > +# - after concatenation dfu alt settings for test and
> > dummy files are
> > +#   moved from 0 and 1 to other values
> 
> Similar formatting comments to the previous patch. I'd also re-word
> this to be much more generic, and simply state the it allows
> different alt settings to be used, rather than tieing the description
> to one possible reason why you might want to do that.

Ok, I will rewrite the description.

> 
> > +"alt_num_test_file": "5",
> > +"alt_num_dummy_file": "6",
> 
> This feels fragile. What if $dfu_alt_boot changes length? Does it
> make more sense to:
> 
> (a) Set alt_info_env_name to dfu_alt_boot instead, so that the
> settings specified by the test are always at a known position in the
> list, so we can always use alt setting 0 and 1.

Unfortunately, dfu_alt_boot (which depends on boot medium) is
immutable and set during boot time from CONFIG_DFU_ALT_BOOT_SD and
CONFIG_DFU_ALT_BOOT_EMMC

Only "dfu_alt_system" can be set by user.

> 
> or:
> 
> (b) Use names rather than numbers for the alt setting? 

I thought about this option. 

1. One possible solution would be to define:

"test_file_name": "file.bin"
"dummy_file_name": "dummy.bin"

at env__dfu_configs.

Afterwards, I could automatically set the "alt_info" property int the
same map:

"alt_info" : "%s ext4 0 2; %s ext4 0 2" % (test_file_name,
dummy_file_name)

As a result, I could use -a {test_file_name|dummy_file_name} to access
proper alt setting.



2. Another option would be to set the "dfu_alt_system" env variable and
then run "dfu-util -l" on host (or 'dfu 0 mmc 0 list') on target and
grep output for test_file_name and dummy_file_name and extract alt
setting numbers. 
This would require modification in the framework core code and hence I
decided to manually specify the alt settings number (as I did in the
bash version of those scripts).

However, as I look now for it, I think that option from point 1) seems
flexible enough. Stephen what do you think about it?

> Those should
> be position-independent. Presumably this would require a slightly
> large code change, since we'd need to move from %d to %s conversions
> when constructing the dfu command string, but that should be very
> easy.
> 
> If you take this approach, I'd suggest making the configuration file 
> name (alt_num_*_file above) match the Python variable name 
> (alt_setting_*_file) for consistency.
> 
> (c) Provide a way for the user to turn off the auto-concatenation
> feature.

This feature is already deployed and I would like to avoid changing it.

> 

-- 
Best regards,

Lukasz Majewski

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


[U-Boot] [PATCH 0/3] ARM: at91: sama5d2_xplained: change SDHCI GCK's clock source to UPLL

2016-04-11 Thread Wenyou Yang
To align to the Linux driver, change the clock source of the SDHCI's
generated clock from PLLA to UPLL clock.


Wenyou Yang (3):
  ARM: at91: clock: fix the GCK's clock source
  ARM: at91: clock: complete the GCK's clock sources
  board: sama5d2_xplained: change SDHCI GCK's clock source to UPLL

 arch/arm/mach-at91/armv7/clock.c| 11 +++
 arch/arm/mach-at91/include/mach/clk.h   |  2 ++
 board/atmel/sama5d2_xplained/sama5d2_xplained.c |  4 ++--
 3 files changed, 15 insertions(+), 2 deletions(-)

-- 
2.7.4

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


[U-Boot] [PATCH 1/3] ARM: at91: clock: fix the GCK's clock source

2016-04-11 Thread Wenyou Yang
Before enabling a generated clock whose source is from the UPLL
clock, check and enable the UPLL clock.

Signed-off-by: Wenyou Yang 
---

 arch/arm/mach-at91/armv7/clock.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-at91/armv7/clock.c b/arch/arm/mach-at91/armv7/clock.c
index 81e9f69..27372b3 100644
--- a/arch/arm/mach-at91/armv7/clock.c
+++ b/arch/arm/mach-at91/armv7/clock.c
@@ -162,6 +162,11 @@ int at91_enable_periph_generated_clk(u32 id, u32 
clk_source, u32 div)
if (div > 0xff)
return -EINVAL;
 
+   if (clk_source == GCK_CSS_UPLL_CLK) {
+   if (at91_upll_clk_enable())
+   return -ENODEV;
+   }
+
writel(id, &pmc->pcr);
regval = readl(&pmc->pcr);
regval &= ~AT91_PMC_PCR_GCKCSS;
-- 
2.7.4

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


[U-Boot] [PATCH 2/3] ARM: at91: clock: complete the GCK's clock sources

2016-04-11 Thread Wenyou Yang
Add the UPLL clock and master clock as a clock source for getting
the generated clock frequency to complete its clock sources support.

Signed-off-by: Wenyou Yang 
---

 arch/arm/mach-at91/armv7/clock.c  | 6 ++
 arch/arm/mach-at91/include/mach/clk.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/mach-at91/armv7/clock.c b/arch/arm/mach-at91/armv7/clock.c
index 27372b3..76fcada 100644
--- a/arch/arm/mach-at91/armv7/clock.c
+++ b/arch/arm/mach-at91/armv7/clock.c
@@ -236,6 +236,12 @@ u32 at91_get_periph_generated_clk(u32 id)
case AT91_PMC_PCR_GCKCSS_PLLA_CLK:
freq = gd->arch.plla_rate_hz;
break;
+   case AT91_PMC_PCR_GCKCSS_UPLL_CLK:
+   freq = AT91_UTMI_PLL_CLK_FREQ;
+   break;
+   case AT91_PMC_PCR_GCKCSS_MCK_CLK:
+   freq = gd->arch.mck_rate_hz;
+   break;
default:
printf("Improper GCK clock source selection!\n");
freq = 0;
diff --git a/arch/arm/mach-at91/include/mach/clk.h 
b/arch/arm/mach-at91/include/mach/clk.h
index 8577c74..ca7d7d0 100644
--- a/arch/arm/mach-at91/include/mach/clk.h
+++ b/arch/arm/mach-at91/include/mach/clk.h
@@ -20,6 +20,8 @@
 #define GCK_CSS_MCK_CLK4
 #define GCK_CSS_AUDIO_CLK  5
 
+#define AT91_UTMI_PLL_CLK_FREQ 48000
+
 static inline unsigned long get_cpu_clk_rate(void)
 {
DECLARE_GLOBAL_DATA_PTR;
-- 
2.7.4

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


[U-Boot] [PATCH 3/3] board: sama5d2_xplained: change SDHCI GCK's clock source to UPLL

2016-04-11 Thread Wenyou Yang
Change the clock source of the SDHCI's generated clock from PLLA to
UPLL clock to align to Linux driver.

Signed-off-by: Wenyou Yang 
---

 board/atmel/sama5d2_xplained/sama5d2_xplained.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c 
b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
index 10edf28..7324c2c 100644
--- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c
+++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
@@ -174,7 +174,7 @@ static void board_sdhci0_hw_init(void)
 
at91_periph_clk_enable(ATMEL_ID_SDMMC0);
at91_enable_periph_generated_clk(ATMEL_ID_SDMMC0,
-GCK_CSS_PLLA_CLK, 1);
+GCK_CSS_UPLL_CLK, 1);
 }
 
 static void board_sdhci1_hw_init(void)
@@ -190,7 +190,7 @@ static void board_sdhci1_hw_init(void)
 
at91_periph_clk_enable(ATMEL_ID_SDMMC1);
at91_enable_periph_generated_clk(ATMEL_ID_SDMMC1,
-GCK_CSS_PLLA_CLK, 1);
+GCK_CSS_UPLL_CLK, 1);
 }
 
 int board_mmc_init(bd_t *bis)
-- 
2.7.4

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


[U-Boot] [PATCH] ARM64: zynqmp: Add defconfig for zcu102 revB board

2016-04-11 Thread Michal Simek
Support natively revB board. Till now support for revB was done via
zcu102 defconfig where device-tree was changed to revB.
This patch is adding direct defconfig for RevB.

Signed-off-by: Michal Simek 
---

 configs/xilinx_zynqmp_zcu102_revB_defconfig | 27 +++
 1 file changed, 27 insertions(+)
 create mode 100644 configs/xilinx_zynqmp_zcu102_revB_defconfig

diff --git a/configs/xilinx_zynqmp_zcu102_revB_defconfig 
b/configs/xilinx_zynqmp_zcu102_revB_defconfig
new file mode 100644
index ..542a24a8d5b4
--- /dev/null
+++ b/configs/xilinx_zynqmp_zcu102_revB_defconfig
@@ -0,0 +1,27 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ZYNQMP=y
+CONFIG_DM_GPIO=y
+CONFIG_TARGET_ZYNQMP_ZCU102=y
+CONFIG_ZYNQMP_QSPI=y
+CONFIG_ZYNQMP_USB=y
+CONFIG_SYS_TEXT_BASE=0x800
+CONFIG_DEFAULT_DEVICE_TREE="zynqmp-zcu102-revB"
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SYS_PROMPT="ZynqMP> "
+# CONFIG_CMD_IMLS is not set
+CONFIG_CMD_MEMTEST=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_TFTPPUT=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_TIMER=y
+CONFIG_OF_EMBED=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_MMC=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_BAR=y
+CONFIG_DM_ETH=y
+CONFIG_ZYNQ_GEM=y
-- 
1.9.1

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


[U-Boot] [PATCH] ARM64: zynqmp: Remove netdev.h from board file

2016-04-11 Thread Michal Simek
Including netdev.h is causing compilation warning:
+ int fecmxc_register_mii_postcall(struct eth_device *dev, int
(*cb)(int));
+ ^
w+In file included from ../board/xilinx/zynqmp/zynqmp.c:9:0:
w+../include/netdev.h:204:41: warning: ‘struct eth_device’ declared
inside parameter list [enabled by default]
w+../include/netdev.h:204:41: warning: its scope is only this definition
or declaration, which is probably not what you want [enabled by default]

This patch removes it.

Signed-off-by: Michal Simek 
---

 board/xilinx/zynqmp/zynqmp.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 529476b08268..132d724fbdf8 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -6,7 +6,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.9.1

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


[U-Boot] [PATCH] spl: mmc: raw: Try to load u-boot if Linux image is not found

2016-04-11 Thread Lokesh Vutla
If CONFIG_SPL_OS_BOOT is enabled and Linux image is not flashed at
RAW_MODE_KERNEL_SECTOR in MMC, spl still assumes that Linux is
available and tries to boot it and hangs. In order to avoid this,
adding a check to verify if parsed image header is of type IH_OS_LINUX.
If it fails then fall back to load u-boot image.

Signed-off-by: Lokesh Vutla 
---
 common/spl/spl_mmc.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 7d3bfc6..1a10c55 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -178,6 +178,7 @@ static int mmc_load_image_raw_partition(struct mmc *mmc, 
int partition)
 static int mmc_load_image_raw_os(struct mmc *mmc)
 {
unsigned long count;
+   int ret;
 
count = mmc->block_dev.block_read(&mmc->block_dev,
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
@@ -190,8 +191,17 @@ static int mmc_load_image_raw_os(struct mmc *mmc)
return -1;
}
 
-   return mmc_load_image_raw_sector(mmc,
+   ret = mmc_load_image_raw_sector(mmc,
CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR);
+   if (ret)
+   return ret;
+
+   if (spl_image.os != IH_OS_LINUX) {
+   puts("Expected Linux image is not found. Trying to start 
U-boot\n");
+   return -ENOENT;
+   }
+
+   return 0;
 }
 #else
 int spl_start_uboot(void)
-- 
2.1.4

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


[U-Boot] [PATCH 2/7] gpio: Kconfig: Enable Zynq GPIO driver using kconfig

2016-04-11 Thread Michal Simek
From: Siva Durga Prasad Paladugu 

Enable DM GPIO and ZYNQ GPIO using kconfig instead of the board
config file.

Signed-off-by: Siva Durga Prasad Paladugu 
Signed-off-by: Michal Simek 
---

There could be conflict with pca953x in Kconfig

---
 arch/arm/Kconfig  | 1 +
 drivers/gpio/Kconfig  | 7 +++
 include/configs/zynq-common.h | 2 --
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c8e033789393..802d3b430cd6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -579,6 +579,7 @@ config ARCH_ZYNQ
select SPL_OF_CONTROL if SPL
select DM
select DM_ETH
+   select DM_GPIO
select SPL_DM if SPL
select DM_MMC
select DM_SPI
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index f56a60621ff0..4d2cc500bfaf 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -136,4 +136,11 @@ config MVEBU_GPIO
help
  Say yes here to support Marvell MVEBU (Armada XP/38x) GPIOs.
 
+config ZYNQ_GPIO
+   bool "Zynq GPIO driver"
+   depends on DM_GPIO && ARCH_ZYNQ
+   default y
+   help
+ Supports GPIO access on Zynq SoC.
+
 endmenu
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index c96b9c52500f..49d9fd059f3c 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -39,8 +39,6 @@
 #define CONFIG_ARM_DCC
 #define CONFIG_ZYNQ_SERIAL
 
-#define CONFIG_ZYNQ_GPIO
-
 /* Ethernet driver */
 #if defined(CONFIG_ZYNQ_GEM)
 # define CONFIG_MII
-- 
1.9.1

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


[U-Boot] [PATCH 3/7] gpio: zynq: Remove non driver model code

2016-04-11 Thread Michal Simek
From: Siva Durga Prasad Paladugu 

Remove non driver model support as it moved
to driver model. Dont need non driver model
anymore.

Signed-off-by: Siva Durga Prasad Paladugu 
Signed-off-by: Michal Simek 
---

 arch/arm/mach-zynq/include/mach/gpio.h |   2 -
 drivers/gpio/zynq_gpio.c   | 158 +
 2 files changed, 1 insertion(+), 159 deletions(-)

diff --git a/arch/arm/mach-zynq/include/mach/gpio.h 
b/arch/arm/mach-zynq/include/mach/gpio.h
index 0789c497368d..956492b7600a 100644
--- a/arch/arm/mach-zynq/include/mach/gpio.h
+++ b/arch/arm/mach-zynq/include/mach/gpio.h
@@ -8,8 +8,6 @@
 #ifndef _ZYNQ_GPIO_H
 #define _ZYNQ_GPIO_H
 
-#define ZYNQ_GPIO_BASE_ADDRESS 0xE000A000
-
 /* Maximum banks */
 #define ZYNQ_GPIO_MAX_BANK 4
 
diff --git a/drivers/gpio/zynq_gpio.c b/drivers/gpio/zynq_gpio.c
index 92c9f0ecd12e..07c2eb54ff30 100644
--- a/drivers/gpio/zynq_gpio.c
+++ b/drivers/gpio/zynq_gpio.c
@@ -13,8 +13,6 @@
 #include 
 #include 
 #include 
-
-#ifdef CONFIG_DM_GPIO
 #include 
 #include 
 
@@ -23,7 +21,6 @@ DECLARE_GLOBAL_DATA_PTR;
 struct zynq_gpio_privdata {
phys_addr_t base;
 };
-#endif
 
 /**
  * zynq_gpio_get_bank_pin - Get the bank number and pin number within that bank
@@ -65,7 +62,7 @@ static inline void zynq_gpio_get_bank_pin(unsigned int 
pin_num,
}
 }
 
-int gpio_is_valid(unsigned gpio)
+static int gpio_is_valid(unsigned gpio)
 {
return (gpio >= 0) && (gpio < ZYNQ_GPIO_NR_GPIOS);
 }
@@ -79,158 +76,6 @@ static int check_gpio(unsigned gpio)
return 0;
 }
 
-#ifndef CONFIG_DM_GPIO
-/**
- * gpio_get_value - Get the state of the specified pin of GPIO device
- * @gpio:  gpio pin number within the device
- *
- * This function reads the state of the specified pin of the GPIO device.
- *
- * Return: 0 if the pin is low, 1 if pin is high.
- */
-int gpio_get_value(unsigned gpio)
-{
-   u32 data;
-   unsigned int bank_num, bank_pin_num;
-
-   if (check_gpio(gpio) < 0)
-   return -1;
-
-   zynq_gpio_get_bank_pin(gpio, &bank_num, &bank_pin_num);
-
-   data = readl(ZYNQ_GPIO_BASE_ADDRESS +
-ZYNQ_GPIO_DATA_RO_OFFSET(bank_num));
-
-   return (data >> bank_pin_num) & 1;
-}
-
-/**
- * gpio_set_value - Modify the value of the pin with specified value
- * @gpio:  gpio pin number within the device
- * @value: value used to modify the value of the specified pin
- *
- * This function calculates the register offset (i.e to lower 16 bits or
- * upper 16 bits) based on the given pin number and sets the value of a
- * gpio pin to the specified value. The value is either 0 or non-zero.
- */
-int gpio_set_value(unsigned gpio, int value)
-{
-   unsigned int reg_offset, bank_num, bank_pin_num;
-
-   if (check_gpio(gpio) < 0)
-   return -1;
-
-   zynq_gpio_get_bank_pin(gpio, &bank_num, &bank_pin_num);
-
-   if (bank_pin_num >= ZYNQ_GPIO_MID_PIN_NUM) {
-   /* only 16 data bits in bit maskable reg */
-   bank_pin_num -= ZYNQ_GPIO_MID_PIN_NUM;
-   reg_offset = ZYNQ_GPIO_DATA_MSW_OFFSET(bank_num);
-   } else {
-   reg_offset = ZYNQ_GPIO_DATA_LSW_OFFSET(bank_num);
-   }
-
-   /*
-* get the 32 bit value to be written to the mask/data register where
-* the upper 16 bits is the mask and lower 16 bits is the data
-*/
-   value = !!value;
-   value = ~(1 << (bank_pin_num + ZYNQ_GPIO_MID_PIN_NUM)) &
-   ((value << bank_pin_num) | ZYNQ_GPIO_UPPER_MASK);
-
-   writel(value, ZYNQ_GPIO_BASE_ADDRESS + reg_offset);
-
-   return 0;
-}
-
-/**
- * gpio_direction_input - Set the direction of the specified GPIO pin as input
- * @gpio:  gpio pin number within the device
- *
- * This function uses the read-modify-write sequence to set the direction of
- * the gpio pin as input.
- *
- * Return: -1 if invalid gpio specified, 0 if successul
- */
-int gpio_direction_input(unsigned gpio)
-{
-   u32 reg;
-   unsigned int bank_num, bank_pin_num;
-
-   if (check_gpio(gpio) < 0)
-   return -1;
-
-   zynq_gpio_get_bank_pin(gpio, &bank_num, &bank_pin_num);
-
-   /* bank 0 pins 7 and 8 are special and cannot be used as inputs */
-   if (bank_num == 0 && (bank_pin_num == 7 || bank_pin_num == 8))
-   return -1;
-
-   /* clear the bit in direction mode reg to set the pin as input */
-   reg = readl(ZYNQ_GPIO_BASE_ADDRESS + ZYNQ_GPIO_DIRM_OFFSET(bank_num));
-   reg &= ~BIT(bank_pin_num);
-   writel(reg, ZYNQ_GPIO_BASE_ADDRESS + ZYNQ_GPIO_DIRM_OFFSET(bank_num));
-
-   return 0;
-}
-
-/**
- * gpio_direction_output - Set the direction of the specified GPIO pin as 
output
- * @gpio:  gpio pin number within the device
- * @value: value to be written to specified pin
- *
- * This function sets the direction of specified GPIO pin as output, configures
- * the Output Enable register for the pin and uses zynq_gpio_s

[U-Boot] [PATCH 1/7] gpio: zynq: Convert Zynq GPIO to driver model

2016-04-11 Thread Michal Simek
From: Siva Durga Prasad Paladugu 

Convert Zynq GPIO driver to driver model

Signed-off-by: Siva Durga Prasad Paladugu 
Signed-off-by: Michal Simek 
---

 drivers/gpio/zynq_gpio.c | 151 +++
 1 file changed, 151 insertions(+)

diff --git a/drivers/gpio/zynq_gpio.c b/drivers/gpio/zynq_gpio.c
index 83a2c465d011..92c9f0ecd12e 100644
--- a/drivers/gpio/zynq_gpio.c
+++ b/drivers/gpio/zynq_gpio.c
@@ -14,6 +14,17 @@
 #include 
 #include 
 
+#ifdef CONFIG_DM_GPIO
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct zynq_gpio_privdata {
+   phys_addr_t base;
+};
+#endif
+
 /**
  * zynq_gpio_get_bank_pin - Get the bank number and pin number within that bank
  * for a given pin in the GPIO device
@@ -68,6 +79,7 @@ static int check_gpio(unsigned gpio)
return 0;
 }
 
+#ifndef CONFIG_DM_GPIO
 /**
  * gpio_get_value - Get the state of the specified pin of GPIO device
  * @gpio:  gpio pin number within the device
@@ -218,3 +230,142 @@ int gpio_free(unsigned gpio)
 {
return 0;
 }
+#else
+static int zynq_gpio_get_value(struct udevice *dev, unsigned gpio)
+{
+   u32 data;
+   unsigned int bank_num, bank_pin_num;
+   struct zynq_gpio_privdata *priv = dev_get_priv(dev);
+
+   if (check_gpio(gpio) < 0)
+   return -1;
+
+   zynq_gpio_get_bank_pin(gpio, &bank_num, &bank_pin_num);
+
+   data = readl(priv->base +
+ZYNQ_GPIO_DATA_RO_OFFSET(bank_num));
+
+   return (data >> bank_pin_num) & 1;
+}
+
+static int zynq_gpio_set_value(struct udevice *dev, unsigned gpio, int value)
+{
+   unsigned int reg_offset, bank_num, bank_pin_num;
+   struct zynq_gpio_privdata *priv = dev_get_priv(dev);
+
+   if (check_gpio(gpio) < 0)
+   return -1;
+
+   zynq_gpio_get_bank_pin(gpio, &bank_num, &bank_pin_num);
+
+   if (bank_pin_num >= ZYNQ_GPIO_MID_PIN_NUM) {
+   /* only 16 data bits in bit maskable reg */
+   bank_pin_num -= ZYNQ_GPIO_MID_PIN_NUM;
+   reg_offset = ZYNQ_GPIO_DATA_MSW_OFFSET(bank_num);
+   } else {
+   reg_offset = ZYNQ_GPIO_DATA_LSW_OFFSET(bank_num);
+   }
+
+   /*
+* get the 32 bit value to be written to the mask/data register where
+* the upper 16 bits is the mask and lower 16 bits is the data
+*/
+   value = !!value;
+   value = ~(1 << (bank_pin_num + ZYNQ_GPIO_MID_PIN_NUM)) &
+   ((value << bank_pin_num) | ZYNQ_GPIO_UPPER_MASK);
+
+   writel(value, priv->base + reg_offset);
+
+   return 0;
+}
+
+static int zynq_gpio_direction_input(struct udevice *dev, unsigned gpio)
+{
+   u32 reg;
+   unsigned int bank_num, bank_pin_num;
+   struct zynq_gpio_privdata *priv = dev_get_priv(dev);
+
+   if (check_gpio(gpio) < 0)
+   return -1;
+
+   zynq_gpio_get_bank_pin(gpio, &bank_num, &bank_pin_num);
+
+   /* bank 0 pins 7 and 8 are special and cannot be used as inputs */
+   if (bank_num == 0 && (bank_pin_num == 7 || bank_pin_num == 8))
+   return -1;
+
+   /* clear the bit in direction mode reg to set the pin as input */
+   reg = readl(priv->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num));
+   reg &= ~BIT(bank_pin_num);
+   writel(reg, priv->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num));
+
+   return 0;
+}
+
+static int zynq_gpio_direction_output(struct udevice *dev, unsigned gpio,
+ int value)
+{
+   u32 reg;
+   unsigned int bank_num, bank_pin_num;
+   struct zynq_gpio_privdata *priv = dev_get_priv(dev);
+
+   if (check_gpio(gpio) < 0)
+   return -1;
+
+   zynq_gpio_get_bank_pin(gpio, &bank_num, &bank_pin_num);
+
+   /* set the GPIO pin as output */
+   reg = readl(priv->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num));
+   reg |= BIT(bank_pin_num);
+   writel(reg, priv->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num));
+
+   /* configure the output enable reg for the pin */
+   reg = readl(priv->base + ZYNQ_GPIO_OUTEN_OFFSET(bank_num));
+   reg |= BIT(bank_pin_num);
+   writel(reg, priv->base + ZYNQ_GPIO_OUTEN_OFFSET(bank_num));
+
+   /* set the state of the pin */
+   gpio_set_value(gpio, value);
+   return 0;
+}
+
+static const struct dm_gpio_ops gpio_zynq_ops = {
+   .direction_input= zynq_gpio_direction_input,
+   .direction_output   = zynq_gpio_direction_output,
+   .get_value  = zynq_gpio_get_value,
+   .set_value  = zynq_gpio_set_value,
+};
+
+static int zynq_gpio_probe(struct udevice *dev)
+{
+   struct zynq_gpio_privdata *priv = dev_get_priv(dev);
+
+   priv->base = dev_get_addr(dev);
+
+   return 0;
+}
+
+static int zynq_gpio_ofdata_to_platdata(struct udevice *dev)
+{
+   struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+
+   uc_priv->gpio_count = ZYNQ_GPIO_NR_GPIOS;
+
+   return 0;
+}
+
+static const struct udevice

[U-Boot] [PATCH 4/7] gpio: zynq: Move the definitions to driver file

2016-04-11 Thread Michal Simek
From: Siva Durga Prasad Paladugu 

Move all the gpio definitions to driver file as
there is no use of them in other files.

Signed-off-by: Siva Durga Prasad Paladugu 
Signed-off-by: Michal Simek 
---

 arch/arm/mach-zynq/include/mach/gpio.h | 61 --
 drivers/gpio/zynq_gpio.c   | 61 ++
 2 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/arch/arm/mach-zynq/include/mach/gpio.h 
b/arch/arm/mach-zynq/include/mach/gpio.h
index 956492b7600a..f3dfd65b98a4 100644
--- a/arch/arm/mach-zynq/include/mach/gpio.h
+++ b/arch/arm/mach-zynq/include/mach/gpio.h
@@ -8,65 +8,4 @@
 #ifndef _ZYNQ_GPIO_H
 #define _ZYNQ_GPIO_H
 
-/* Maximum banks */
-#define ZYNQ_GPIO_MAX_BANK 4
-
-#define ZYNQ_GPIO_BANK0_NGPIO  32
-#define ZYNQ_GPIO_BANK1_NGPIO  22
-#define ZYNQ_GPIO_BANK2_NGPIO  32
-#define ZYNQ_GPIO_BANK3_NGPIO  32
-
-#define ZYNQ_GPIO_NR_GPIOS (ZYNQ_GPIO_BANK0_NGPIO + \
-ZYNQ_GPIO_BANK1_NGPIO + \
-ZYNQ_GPIO_BANK2_NGPIO + \
-ZYNQ_GPIO_BANK3_NGPIO)
-
-#define ZYNQ_GPIO_BANK0_PIN_MIN0
-#define ZYNQ_GPIO_BANK0_PIN_MAX(ZYNQ_GPIO_BANK0_PIN_MIN + \
-   ZYNQ_GPIO_BANK0_NGPIO - 1)
-#define ZYNQ_GPIO_BANK1_PIN_MIN(ZYNQ_GPIO_BANK0_PIN_MAX + 1)
-#define ZYNQ_GPIO_BANK1_PIN_MAX(ZYNQ_GPIO_BANK1_PIN_MIN + \
-   ZYNQ_GPIO_BANK1_NGPIO - 1)
-#define ZYNQ_GPIO_BANK2_PIN_MIN(ZYNQ_GPIO_BANK1_PIN_MAX + 1)
-#define ZYNQ_GPIO_BANK2_PIN_MAX(ZYNQ_GPIO_BANK2_PIN_MIN + \
-   ZYNQ_GPIO_BANK2_NGPIO - 1)
-#define ZYNQ_GPIO_BANK3_PIN_MIN(ZYNQ_GPIO_BANK2_PIN_MAX + 1)
-#define ZYNQ_GPIO_BANK3_PIN_MAX(ZYNQ_GPIO_BANK3_PIN_MIN + \
-   ZYNQ_GPIO_BANK3_NGPIO - 1)
-
-/* Register offsets for the GPIO device */
-/* LSW Mask & Data -WO */
-#define ZYNQ_GPIO_DATA_LSW_OFFSET(BANK)(0x000 + (8 * BANK))
-/* MSW Mask & Data -WO */
-#define ZYNQ_GPIO_DATA_MSW_OFFSET(BANK)(0x004 + (8 * BANK))
-/* Data Register-RW */
-#define ZYNQ_GPIO_DATA_RO_OFFSET(BANK) (0x060 + (4 * BANK))
-/* Direction mode reg-RW */
-#define ZYNQ_GPIO_DIRM_OFFSET(BANK)(0x204 + (0x40 * BANK))
-/* Output enable reg-RW */
-#define ZYNQ_GPIO_OUTEN_OFFSET(BANK)   (0x208 + (0x40 * BANK))
-/* Interrupt mask reg-RO */
-#define ZYNQ_GPIO_INTMASK_OFFSET(BANK) (0x20C + (0x40 * BANK))
-/* Interrupt enable reg-WO */
-#define ZYNQ_GPIO_INTEN_OFFSET(BANK)   (0x210 + (0x40 * BANK))
-/* Interrupt disable reg-WO */
-#define ZYNQ_GPIO_INTDIS_OFFSET(BANK)  (0x214 + (0x40 * BANK))
-/* Interrupt status reg-RO */
-#define ZYNQ_GPIO_INTSTS_OFFSET(BANK)  (0x218 + (0x40 * BANK))
-/* Interrupt type reg-RW */
-#define ZYNQ_GPIO_INTTYPE_OFFSET(BANK) (0x21C + (0x40 * BANK))
-/* Interrupt polarity reg-RW */
-#define ZYNQ_GPIO_INTPOL_OFFSET(BANK)  (0x220 + (0x40 * BANK))
-/* Interrupt on any, reg-RW */
-#define ZYNQ_GPIO_INTANY_OFFSET(BANK)  (0x224 + (0x40 * BANK))
-
-/* Disable all interrupts mask */
-#define ZYNQ_GPIO_IXR_DISABLE_ALL  0x
-
-/* Mid pin number of a bank */
-#define ZYNQ_GPIO_MID_PIN_NUM 16
-
-/* GPIO upper 16 bit mask */
-#define ZYNQ_GPIO_UPPER_MASK 0x
-
 #endif /* _ZYNQ_GPIO_H */
diff --git a/drivers/gpio/zynq_gpio.c b/drivers/gpio/zynq_gpio.c
index 07c2eb54ff30..05de9c56519b 100644
--- a/drivers/gpio/zynq_gpio.c
+++ b/drivers/gpio/zynq_gpio.c
@@ -18,6 +18,67 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/* Maximum banks */
+#define ZYNQ_GPIO_MAX_BANK 4
+
+#define ZYNQ_GPIO_BANK0_NGPIO  32
+#define ZYNQ_GPIO_BANK1_NGPIO  22
+#define ZYNQ_GPIO_BANK2_NGPIO  32
+#define ZYNQ_GPIO_BANK3_NGPIO  32
+
+#define ZYNQ_GPIO_NR_GPIOS (ZYNQ_GPIO_BANK0_NGPIO + \
+ZYNQ_GPIO_BANK1_NGPIO + \
+ZYNQ_GPIO_BANK2_NGPIO + \
+ZYNQ_GPIO_BANK3_NGPIO)
+
+#define ZYNQ_GPIO_BANK0_PIN_MIN0
+#define ZYNQ_GPIO_BANK0_PIN_MAX(ZYNQ_GPIO_BANK0_PIN_MIN + \
+   ZYNQ_GPIO_BANK0_NGPIO - 1)
+#define ZYNQ_GPIO_BANK1_PIN_MIN(ZYNQ_GPIO_BANK0_PIN_MAX + 1)
+#define ZYNQ_GPIO_BANK1_PIN_MAX(ZYNQ_GPIO_BANK1_PIN_MIN + \
+   ZYNQ_GPIO_BANK1_NGPIO - 1)
+#define ZYNQ_GPIO_BANK2_PIN_MIN(ZYNQ_GPIO_BANK1_PIN_MAX + 1)
+#define ZYNQ_GPIO_BANK2_PIN_MAX(ZYNQ_GPIO_BANK2_PIN_MIN + \
+   ZYNQ_GPIO_BANK2_NGPIO - 1)
+#define ZYNQ_GPIO_BANK3_PIN_MIN(ZYNQ_GPIO_BANK2_PIN_MAX + 1)
+#define ZYNQ_GPIO_BANK3_PIN_MAX(ZYNQ_GPIO_BANK3_PIN_MIN + \
+   ZYNQ_GPIO_BANK3_NGPIO - 1)
+
+/* Register offsets for the GPIO device */
+/* LSW Mask & Data -WO */
+#define ZYNQ_GPIO_DATA_LSW_OFFSET(BANK)(0x000 + (8 * BANK))
+/* MSW Mask & Data -WO */
+#define ZYNQ_GPIO_DAT

[U-Boot] [PATCH 7/7] ARM64: zynqmp: Enable CMD_GPIO and DM_GPIO for ep108

2016-04-11 Thread Michal Simek
Enable missing GPIO options.

Signed-off-by: Michal Simek 
---

 configs/xilinx_zynqmp_ep_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/xilinx_zynqmp_ep_defconfig 
b/configs/xilinx_zynqmp_ep_defconfig
index 9f72abaabb05..b45c7f281c2f 100644
--- a/configs/xilinx_zynqmp_ep_defconfig
+++ b/configs/xilinx_zynqmp_ep_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_SYS_CONFIG_NAME="xilinx_zynqmp_ep"
 CONFIG_ARCH_ZYNQMP=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_DM_GPIO=y
 CONFIG_ZYNQMP_USB=y
 CONFIG_SYS_TEXT_BASE=0x800
 CONFIG_DEFAULT_DEVICE_TREE="zynqmp-ep108"
@@ -17,6 +18,7 @@ CONFIG_SYS_PROMPT="ZynqMP> "
 # CONFIG_CMD_LOADB is not set
 # CONFIG_CMD_LOADS is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_CMD_GPIO=y
 # CONFIG_CMD_ITEST is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TFTPPUT=y
-- 
1.9.1

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


[U-Boot] [PATCH 5/7] gpio: zynqmp: Add GPIO driver support for ZynqMP

2016-04-11 Thread Michal Simek
From: Siva Durga Prasad Paladugu 

Add GPIO driver support for ZynqMP platform

Signed-off-by: Siva Durga Prasad Paladugu 
Signed-off-by: Michal Simek 
---

 drivers/gpio/zynq_gpio.c | 200 ++-
 1 file changed, 147 insertions(+), 53 deletions(-)

diff --git a/drivers/gpio/zynq_gpio.c b/drivers/gpio/zynq_gpio.c
index 05de9c56519b..3a995f610cb3 100644
--- a/drivers/gpio/zynq_gpio.c
+++ b/drivers/gpio/zynq_gpio.c
@@ -31,18 +31,35 @@ DECLARE_GLOBAL_DATA_PTR;
 ZYNQ_GPIO_BANK2_NGPIO + \
 ZYNQ_GPIO_BANK3_NGPIO)
 
-#define ZYNQ_GPIO_BANK0_PIN_MIN0
-#define ZYNQ_GPIO_BANK0_PIN_MAX(ZYNQ_GPIO_BANK0_PIN_MIN + \
-   ZYNQ_GPIO_BANK0_NGPIO - 1)
-#define ZYNQ_GPIO_BANK1_PIN_MIN(ZYNQ_GPIO_BANK0_PIN_MAX + 1)
-#define ZYNQ_GPIO_BANK1_PIN_MAX(ZYNQ_GPIO_BANK1_PIN_MIN + \
-   ZYNQ_GPIO_BANK1_NGPIO - 1)
-#define ZYNQ_GPIO_BANK2_PIN_MIN(ZYNQ_GPIO_BANK1_PIN_MAX + 1)
-#define ZYNQ_GPIO_BANK2_PIN_MAX(ZYNQ_GPIO_BANK2_PIN_MIN + \
-   ZYNQ_GPIO_BANK2_NGPIO - 1)
-#define ZYNQ_GPIO_BANK3_PIN_MIN(ZYNQ_GPIO_BANK2_PIN_MAX + 1)
-#define ZYNQ_GPIO_BANK3_PIN_MAX(ZYNQ_GPIO_BANK3_PIN_MIN + \
-   ZYNQ_GPIO_BANK3_NGPIO - 1)
+#define ZYNQMP_GPIO_MAX_BANK   6
+
+#define ZYNQMP_GPIO_BANK0_NGPIO26
+#define ZYNQMP_GPIO_BANK1_NGPIO26
+#define ZYNQMP_GPIO_BANK2_NGPIO26
+#define ZYNQMP_GPIO_BANK3_NGPIO32
+#define ZYNQMP_GPIO_BANK4_NGPIO32
+#define ZYNQMP_GPIO_BANK5_NGPIO32
+
+#define ZYNQMP_GPIO_NR_GPIOS   174
+
+#define ZYNQ_GPIO_BANK0_PIN_MIN(str)   0
+#define ZYNQ_GPIO_BANK0_PIN_MAX(str)   (ZYNQ_GPIO_BANK0_PIN_MIN(str) + \
+   ZYNQ##str##_GPIO_BANK0_NGPIO - 1)
+#define ZYNQ_GPIO_BANK1_PIN_MIN(str)   (ZYNQ_GPIO_BANK0_PIN_MAX(str) + 1)
+#define ZYNQ_GPIO_BANK1_PIN_MAX(str)   (ZYNQ_GPIO_BANK1_PIN_MIN(str) + \
+   ZYNQ##str##_GPIO_BANK1_NGPIO - 1)
+#define ZYNQ_GPIO_BANK2_PIN_MIN(str)   (ZYNQ_GPIO_BANK1_PIN_MAX(str) + 1)
+#define ZYNQ_GPIO_BANK2_PIN_MAX(str)   (ZYNQ_GPIO_BANK2_PIN_MIN(str) + \
+   ZYNQ##str##_GPIO_BANK2_NGPIO - 1)
+#define ZYNQ_GPIO_BANK3_PIN_MIN(str)   (ZYNQ_GPIO_BANK2_PIN_MAX(str) + 1)
+#define ZYNQ_GPIO_BANK3_PIN_MAX(str)   (ZYNQ_GPIO_BANK3_PIN_MIN(str) + \
+   ZYNQ##str##_GPIO_BANK3_NGPIO - 1)
+#define ZYNQ_GPIO_BANK4_PIN_MIN(str)   (ZYNQ_GPIO_BANK3_PIN_MAX(str) + 1)
+#define ZYNQ_GPIO_BANK4_PIN_MAX(str)   (ZYNQ_GPIO_BANK4_PIN_MIN(str) + \
+   ZYNQ##str##_GPIO_BANK4_NGPIO - 1)
+#define ZYNQ_GPIO_BANK5_PIN_MIN(str)   (ZYNQ_GPIO_BANK4_PIN_MAX(str) + 1)
+#define ZYNQ_GPIO_BANK5_PIN_MAX(str)   (ZYNQ_GPIO_BANK5_PIN_MIN(str) + \
+   ZYNQ##str##_GPIO_BANK5_NGPIO - 1)
 
 /* Register offsets for the GPIO device */
 /* LSW Mask & Data -WO */
@@ -81,6 +98,55 @@ DECLARE_GLOBAL_DATA_PTR;
 
 struct zynq_gpio_privdata {
phys_addr_t base;
+   const struct zynq_platform_data *p_data;
+};
+
+/**
+ * struct zynq_platform_data -  zynq gpio platform data structure
+ * @label: string to store in gpio->label
+ * @ngpio: max number of gpio pins
+ * @max_bank:  maximum number of gpio banks
+ * @bank_min:  this array represents bank's min pin
+ * @bank_max:  this array represents bank's max pin
+ */
+struct zynq_platform_data {
+   const char *label;
+   u16 ngpio;
+   int max_bank;
+   int bank_min[ZYNQMP_GPIO_MAX_BANK];
+   int bank_max[ZYNQMP_GPIO_MAX_BANK];
+};
+
+static const struct zynq_platform_data zynqmp_gpio_def = {
+   .label = "zynqmp_gpio",
+   .ngpio = ZYNQMP_GPIO_NR_GPIOS,
+   .max_bank = ZYNQMP_GPIO_MAX_BANK,
+   .bank_min[0] = ZYNQ_GPIO_BANK0_PIN_MIN(MP),
+   .bank_max[0] = ZYNQ_GPIO_BANK0_PIN_MAX(MP),
+   .bank_min[1] = ZYNQ_GPIO_BANK1_PIN_MIN(MP),
+   .bank_max[1] = ZYNQ_GPIO_BANK1_PIN_MAX(MP),
+   .bank_min[2] = ZYNQ_GPIO_BANK2_PIN_MIN(MP),
+   .bank_max[2] = ZYNQ_GPIO_BANK2_PIN_MAX(MP),
+   .bank_min[3] = ZYNQ_GPIO_BANK3_PIN_MIN(MP),
+   .bank_max[3] = ZYNQ_GPIO_BANK3_PIN_MAX(MP),
+   .bank_min[4] = ZYNQ_GPIO_BANK4_PIN_MIN(MP),
+   .bank_max[4] = ZYNQ_GPIO_BANK4_PIN_MAX(MP),
+   .bank_min[5] = ZYNQ_GPIO_BANK5_PIN_MIN(MP),
+   .bank_max[5] = ZYNQ_GPIO_BANK5_PIN_MAX(MP),
+};
+
+static const struct zynq_platform_data zynq_gpio_def = {
+   .label = "zynq_gpio",
+   .ngpio = ZYNQ_GPIO_NR_GPIOS,
+   .max_bank = ZYNQ_GPIO_MAX_BANK,
+   .bank_min[0] = ZYNQ_GPIO_BANK0_PIN_MIN(),
+   .bank_max[0] = ZYNQ_GPIO_BANK0_PIN_MAX(),
+   .bank_min[1] = ZYNQ_GPIO_BANK1_PIN_MIN(),
+   .bank_max[1] = ZYNQ_GPIO_BANK1_PIN_MAX(),
+   .bank_min[2] = ZYNQ_GPIO_BANK2_PIN

[U-Boot] [PATCH 6/7] zynqmp: Kconfig: Enable ZYNQ_GPIO for ZynqMP

2016-04-11 Thread Michal Simek
From: Siva Durga Prasad Paladugu 

Enable ZYNQ_GPIO for ZynqMP using Kconfig. It enables the GPIO
driver support for ZynqMP.

Signed-off-by: Siva Durga Prasad Paladugu 
Signed-off-by: Michal Simek 
---

 drivers/gpio/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 4d2cc500bfaf..2b4624d7f807 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -138,7 +138,7 @@ config MVEBU_GPIO
 
 config ZYNQ_GPIO
bool "Zynq GPIO driver"
-   depends on DM_GPIO && ARCH_ZYNQ
+   depends on DM_GPIO && (ARCH_ZYNQ || ARCH_ZYNQMP)
default y
help
  Supports GPIO access on Zynq SoC.
-- 
1.9.1

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


[U-Boot] is there an official MAINTAINER for u-boot POST support?

2016-04-11 Thread Robert P. J. Day

  as i posted sort of recently, i'm playing with the POST tests for
the first time and it's clear that the docs (doc/README.POST) is a bit
out of date, so i'm willing to submit a patch or two to bring it at
least a bit closer to current.

  there is (AFAICT) no official maintainer for the POST stuff, so does
one just ask questions on this general list? i don't want to bore
people with POST-related questions if there's a more specific forum
for that stuff.

  thank you kindly.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


[U-Boot] [PATCH] Revert "T2080QDS/PCIe: Soft Reset PCIe on T2080QDS for down-training issue"

2016-04-11 Thread Zhao Qiang
This reverts commit 5066e62847bddf6030262ade2aa3e7bcdc930037.

The reverted patch will block t2080RDB iNiC, it was a workaround for
T2080QDS
down-training issue, we need to revert it and find the root cause for
T2080QDS
down-training issue.

Signed-off-by: Zhao Qiang 
---
 drivers/pci/fsl_pci_init.c | 15 ---
 include/configs/T208xQDS.h |  1 -
 2 files changed, 16 deletions(-)

diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c
index 52792dc..1143178 100644
--- a/drivers/pci/fsl_pci_init.c
+++ b/drivers/pci/fsl_pci_init.c
@@ -444,21 +444,6 @@ void fsl_pci_init(struct pci_controller *hose, struct 
fsl_pci_info *pci_info)
ltssm = (in_be32(&pci->pex_csr0)
& PEX_CSR0_LTSSM_MASK) >> PEX_CSR0_LTSSM_SHIFT;
enabled = (ltssm == 0x11) ? 1 : 0;
-#ifdef CONFIG_FSL_PCIE_RESET
-   int i;
-   /* assert PCIe reset */
-   setbits_be32(&pci->pdb_stat, 0x0800);
-   (void) in_be32(&pci->pdb_stat);
-   udelay(1000);
-   /* clear PCIe reset */
-   clrbits_be32(&pci->pdb_stat, 0x0800);
-   asm("sync;isync");
-   for (i = 0; i < 100 && ltssm < PCI_LTSSM_L0; i++) {
-   pci_hose_read_config_word(hose, dev, PCI_LTSSM,
- = PCI_LTSSM_L0; */
diff --git a/include/configs/T208xQDS.h b/include/configs/T208xQDS.h
index 5957fa8..c895818 100644
--- a/include/configs/T208xQDS.h
+++ b/include/configs/T208xQDS.h
@@ -559,7 +559,6 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_PCIE2   /* PCIE controler 2 */
 #define CONFIG_PCIE3   /* PCIE controler 3 */
 #define CONFIG_PCIE4   /* PCIE controler 4 */
-#define CONFIG_FSL_PCIE_RESET
 #define CONFIG_FSL_PCI_INIT/* Use common FSL init code */
 #define CONFIG_SYS_PCI_64BIT   /* enable 64-bit PCI resources */
 /* controller 1, direct to uli, tgtid 3, Base address 2 */
-- 
2.1.0.27.g96db324

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


Re: [U-Boot] [PATCH] usb: ums - expose selected partition/s

2016-04-11 Thread Lukasz Majewski
Hi John,

> By applying this patch, it will give us some flexibility to expose
> a selected partition/s.
> 
> e.g:
> 1. To expose several partitions
> ums 0 mmc 0:1,0:6
> 
> 2. To expose the all partitions
> ums 0 mmc 0:0
> 
> 3. To expose multiple partititions on several devices
> ums 0 mmc 0:1,1:6
> 
> Signed-off-by: John Tobias 
> ---
>  cmd/usb_mass_storage.c | 32 ++--
>  1 file changed, 22 insertions(+), 10 deletions(-)
> 
> diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
> index 0415591..3e6ec50 100644
> --- a/cmd/usb_mass_storage.c
> +++ b/cmd/usb_mass_storage.c

Could you rebase this patch on top of newest mailine? 

Simon Glass did some work on this file - to be precise:

dm: Drop the block_dev_desc_t typedef
4101f6879256720b30df712089a3df18565f9203

and your patch doesn't apply anymore.

Thanks in advance,
Łukasz Majewski

> @@ -50,14 +50,16 @@ static void ums_fini(void)
>  
>  #define UMS_NAME_LEN 16
>  
> -static int ums_init(const char *devtype, const char *devnums)
> +static int ums_init(const char *devtype, const char *devnums_part)
>  {
> - char *s, *t, *devnum, *name;
> + char *s, *t, *devnum_part, *name;
>   block_dev_desc_t *block_dev;
> + disk_partition_t info;
> + int partnum;
>   int ret;
>   struct ums *ums_new;
>  
> - s = strdup(devnums);
> + s = strdup(devnums_part);
>   if (!s)
>   return -1;
>  
> @@ -65,12 +67,14 @@ static int ums_init(const char *devtype, const
> char *devnums) ums_count = 0;
>  
>   for (;;) {
> - devnum = strsep(&t, ",");
> - if (!devnum)
> + devnum_part = strsep(&t, ",");
> + if (!devnum_part)
>   break;
>  
> - ret = get_device(devtype, devnum, &block_dev);
> - if (ret < 0)
> + partnum = get_device_and_partition(devtype,
> devnum_part,
> +&block_dev, &info, 1);
> +
> + if (partnum < 0)
>   goto cleanup;
>  
>   /* f_mass_storage.c assumes SECTOR_SIZE sectors */
> @@ -86,10 +90,18 @@ static int ums_init(const char *devtype, const
> char *devnums) }
>   ums = ums_new;
>  
> + /* if partnum = 0, expose the whole device */
> + if (partnum == 0) {
> + ums[ums_count].start_sector = 0;
> + ums[ums_count].num_sectors = block_dev->lba;
> + } else {
> + ums[ums_count].start_sector = info.start;
> + ums[ums_count].num_sectors = info.size;
> + }
> +
>   ums[ums_count].read_sector = ums_read_sector;
>   ums[ums_count].write_sector = ums_write_sector;
> - ums[ums_count].start_sector = 0;
> - ums[ums_count].num_sectors = block_dev->lba;
> +
>   name = malloc(UMS_NAME_LEN);
>   if (!name) {
>   ret = -1;
> @@ -230,6 +242,6 @@ cleanup_ums_init:
>  
>  U_BOOT_CMD(ums, 4, 1, do_usb_mass_storage,
>   "Use the UMS [USB Mass Storage]",
> - " []   e.g. ums 0 mmc 0\n"
> + " []   e.g. ums 0 mmc
> 0:0\n" "devtype defaults to mmc"
>  );



-- 
Best regards,

Lukasz Majewski

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


Re: [U-Boot] Ethernet via USB on Sinlinx SinA33

2016-04-11 Thread Hans de Goede

Hi,

On 11-04-16 12:25, Quentin Schulz wrote:

Hi,

On 06/04/2016 17:24, Hans de Goede wrote:

Hi,

On 29-03-16 08:38, Quentin Schulz wrote:

Hi,

On 28/03/2016 14:56, Hans de Goede wrote:

Hi,

On 25-03-16 18:14, Quentin Schulz wrote:

Hi,

I am trying to get Ethernet to work through the USB port of the Sinlinx
SinA33 on U-Boot to use TFTP to get the kernel and dtb files.

However, I am getting 'data abort' when using dhcp or tftp after
adding:
#define CONFIG_USB_HOST_ETHER
#define CONFIG_USB_ETHER_ASIX

to include/configs/sunxi-common.h and checking CONFIG_USB_EHCI_HCD as
told in the documentation [1]

I tested this configuration with the C.H.I.P. and it is working well.


Are you perhaps building u-boot with gcc6 ? There are some known issues
when building u-boot with gcc-6, which look pretty much like this.


No, I'm building with gcc-5:
$ arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Ubuntu 5.2.1-22ubuntu1) 5.2.1 20151010


Is the ethernet adapter connected to a regular usb host port, or to
the otg port ?


The Ethernet adapter is connected to the regular USB host port.


So I've been debugging some armv7 cache issues lately and I've come
up with the following fix:

https://patchwork.ozlabs.org/patch/605967/

This might very will fix your issue too. If not we're likely missing
some cache flushing / invalidation in the usb driver for your usb
host controller.

Regards,

Hans


I actually tried uboot-sunxi repository (and then checked out on merge
commit in master for this repository) and it is working as expected: I
get Ethernet over USB.

I tested with master (43d3fb5c0609a76409e7859a2a5800670c7b5bd2) and I
first get a reset of the board when starting USB (before I can enter
U-Boot command line) and then after the reboot, U-Boot hangs on starting
USB (still before the command line).

I did a git bisect on master and it returned this commit:
http://git.denx.de/?p=u-boot.git;a=commit;h=3f9f8a5b83f8aec40c9f4ee496046a695e333c45


Ah, that is fixed by this commit:

http://git.denx.de/?p=u-boot/u-boot-usb.git;a=commitdiff;h=cfb3f1cd0e022711d69ff040884357b8410865ef

A pullreq for which was send this morning, so this should be fixed
in master as soon as the u-boot-usb pull-req gets merged.

Regards,

Hans

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


Re: [U-Boot] [PATCH 09/10] ddr: altera: Staticize global variables

2016-04-11 Thread Pavel Machek
On Thu 2016-04-07 04:04:05, Marek Vasut wrote:
> Just staticize global variables in sequencer, since there is no
> point in having these symbols available outside of the DDR code.
> 
> Signed-off-by: Marek Vasut 
> Cc: Dinh Nguyen 
> Cc: Chin Liang See 

Acked-by: Pavel Machek 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] USB: g_dnl: Change device class

2016-04-11 Thread Lukasz Majewski
Hi John,

> The USB Mass Storage (ums) works in Windows, Linux and OS X (EL
> Capitan). But, not in OS X (Yosemite). By applying the said patch, it
> extends the ums support.
> 
> Signed-off-by: John Tobias 

Acked-by: Lukasz Majewski 
Tested-by: Lukasz Majewski 

Test HW: Odroid XU3 with test/py for UMS, DFU

Applied to u-boot-dfu branch

-- 
Best regards,

Lukasz Majewski

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


Re: [U-Boot] [PATCH 0/8] usb: Move DWC3 and some gadget options to Kconfig

2016-04-11 Thread Lukasz Majewski
Hi Semen,

> 
> Hi All,
> 
> This patch series move next options to Kconfigs/defconfigs:
>  - CONFIG_USB_DWC3*
>  - CONFIG_USB_GADGET_VBUS_DRAW
>  - CONFIG_USB_GADGET_DUALSPEED (partially, only for DWC3 platforms
> for now)
>  - CONFIG_USB_GADGET_DOWNLOAD
>  - CONFIG_G_DNL_*
> 
> All defconfig files were post-processed via "make savedefconfig" rule
> to keep correct order of options in defconfigs.
> 
> The whole series was tested using buildman tool for all arm boards.
> 

Acked-by: Lukasz Majewski 
Tested-by: Lukasz Majewski 

Test HW: Odroid XU3 with test/py for UMS, DFU

Applied to u-boot-dfu branch


-- 
Best regards,

Lukasz Majewski

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


Re: [U-Boot] [PATCH v2] fastboot: OUT transaction length must be aligned to wMaxPacketSize

2016-04-11 Thread Mugunthan V N
On Friday 08 April 2016 12:10 AM, Marek Vasut wrote:
> On 04/07/2016 06:46 PM, Sam Protsenko wrote:
>> On Thu, Apr 7, 2016 at 10:36 AM, Lukasz Majewski  
>> wrote:
>>> Hi Steve,
>>>
 No -- I do not believe that this issue is caused by different fastboot
 (client) versions (the executable that runs on the host computer -
 Linux, Windows, Mac, etc.)
 I have personally attempted three (3) different versions, and the
 results are consistent.

 And no I don't think that I "am the only hope at fixing this proper"
 -- as you will see below,
 this" issue" seems to be unique to the "TI platforms" (... nobody else
 has stated they have an issue either way -- but I don't think many use
 this feature )
 So maybe someone with "TI platforms" could investigate this more
 thoroughly...

 HISTORY:

 The U-Boot code, up to Feb 25, worked properly on my Broadcom boards
 -- this code contains:
req->length = rx_bytes_expected();
 if (req->length < ep->maxpacket)
 req->length = ep->maxpacket;
 which aligned the remaining "rx_bytes_expected" to be aligned to the
 "ep->maxpacket" size.

 On Feb 25, there was a patch applied from 
 which forces the remaining "rx_bytes_expected" to be aligned to the
 "wMaxPacketSize" size -- this patch broke all Broadcom boards:
 +   if (rx_remain < maxpacket) {
 +   rx_remain = maxpacket;
 +   } else if (rx_remain % maxpacket != 0) {
 +   rem = rx_remain % maxpacket;
 +   rx_remain = rx_remain + (maxpacket - rem);
 +   }

 After attempting to unsuccessfully contact Dileep, I requested that
 this patch be reverted -- because it broke my boards! (see the other
 email thread).

 Sam Protsenko  has stated that this Feb 25
 change is required to make "fastboot work on TI platforms".

 Thus,
 - Broadcom boards require alignment to "ep->maxpacket" size
 - TI platforms require alignment to "wMaxPacketSize" size
 And we seem to be at a stale-mate.
 Unfortunately, I do not know enough about the USB internals to
 understand why this change breaks the Broadcom boards; or why it _is_
 required on the TI platforms
 ( Is there any debugging that can be turned on to validate what is
 happening at the lower levels? )
>>>
>>> I can only speak about DWC2 (from Synopsis) embedded at Samsung boards.
>>> There are low level debugging registers (documented, but not supposed
>>> to be used at normal operation), which give you some impression
>>> regarding very low level events.
>>>
>>> DWC2 at Samsung is using those to work properly since we had some
>>> problems with dwc2 IP blocks implementation on early Samsung
>>> platforms :-). This approach works in u-boot up till now.
>>>
>>> Another option is to use JTAG debugger (like Lauterbach) to inspect
>>> state of this IP block.
>>>
 ( Can anyone explain why "wMaxPacketSize" size would be required? --
 my limited understanding of endpoints makes me think that
 "ep->maxpacket" size is actually the correct value! )

 I asked Sam to submit a patch which conditionally applied the
 alignment to "wMaxPacketSize" size change -- he stated that he was too
 busy right now -- so I submitted this patch on his behalf (although he
 still needs to add the Kconfig for the TI platforms in order to make
 his boards work)

 I suppose I could also propose a patch where the condition _removes_
 this feature (and define it on the Broadcom boards)  -- do we
 generally like "negated" conditionals?
 +#ifndef
 CONFIG_USB_GADGET_FASTBOOT_DOWNLOAD_DISABLE_ALIGNMENT_WITH_WMAXPACKETSIZE
 Please advise!

 Further, how does the U-Boot community respond to a change which
 breaks something which is already working? Doesn't the "author" of
 that change bear any responsibility on assisting to get "their" change
 working properly with "all" the existing boards?
>>>
>>> As we know the author of this change is not working at Linaro anymore.
>>>
 I'm getting the
 impression that "because the current code works for me", that I am not
 getting any assistance in resolving this issue -- which is why I
 suggested "reverting" this change back to the original code; that way,
 it would (politely?) force someone interested in "TI platforms" to
 step up and look into this

 Sorry for asking so many questions in one email -- but I'd appreciate
 answers
 ( I also apologize in advance for the "attitude" which is leaking into
 this email... )
 Please tell me what I can do! I had working boards; now they are all
 broken -- and I don't how how to get them working again
>>>
>>> If you don't have enough time (and HW) for investigate the issue, I
>>> think that Kconfig option

[U-Boot] [PATCH] GPIO: pca953x: Remove compilation warnings on arm64

2016-04-11 Thread Michal Simek
Warnings:
w+../drivers/gpio/pca953x.c: In function ‘do_pca953x’:
w+../drivers/gpio/pca953x.c:220:5: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
w+../drivers/gpio/pca953x.c:233:10: warning: cast from pointer to
integer of different size [-Wpointer-to-int-cast]

Signed-off-by: Michal Simek 
---

 drivers/gpio/pca953x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 932dfe9f34e1..238e02805cb6 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -217,7 +217,7 @@ int do_pca953x(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
/* All commands but "device" require 'maxargs' arguments */
if (!c || !((argc == (c->maxargs)) ||
-   (((int)c->cmd == PCA953X_CMD_DEVICE) &&
+   (((long)c->cmd == PCA953X_CMD_DEVICE) &&
 (argc == (c->maxargs - 1) {
return CMD_RET_USAGE;
}
@@ -230,7 +230,7 @@ int do_pca953x(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
if (argc > 3)
ul_arg3 = simple_strtoul(argv[3], NULL, 16) & 0x1;
 
-   switch ((int)c->cmd) {
+   switch ((long)c->cmd) {
 #ifdef CONFIG_CMD_PCA953X_INFO
case PCA953X_CMD_INFO:
ret = pca953x_info(chip);
-- 
1.9.1

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


[U-Boot] [PATCH] ARM64: zynqmp: Enable pca953x driver for zcu102

2016-04-11 Thread Michal Simek
zcu102 has two pca953x on i2c bus 0. Chips 0x20 and 0x21.
Enable option to work with these two chips.

Signed-off-by: Michal Simek 
---

 include/configs/xilinx_zynqmp_zcu102.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/configs/xilinx_zynqmp_zcu102.h 
b/include/configs/xilinx_zynqmp_zcu102.h
index 4f580207bb30..30db2e453246 100644
--- a/include/configs/xilinx_zynqmp_zcu102.h
+++ b/include/configs/xilinx_zynqmp_zcu102.h
@@ -37,6 +37,10 @@
}
 
 #define CONFIG_SYS_I2C_ZYNQ
+#define CONFIG_PCA953X
+#define CONFIG_CMD_PCA953X
+#define CONFIG_CMD_PCA953X_INFO
+
 #define CONFIG_AHCI
 #define CONFIG_SATA_CEVA
 
-- 
1.9.1

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


Re: [U-Boot] [PATCH] lib/crc8: Add crc start value

2016-04-11 Thread Simon Glass
On 8 April 2016 at 07:56, Stefan Roese  wrote:
>
> To make the usage of this function more flexible, lets add the CRC start
> value as parameter to this function. This way it can be used by other
> functions requiring different start values than 0 as well.
>
> For non-zero CRC start values to work, I've reworked the function a bit.
> The new implementation is copied from the Linux version in
> drivers/i2c/i2c-core.c / i2c_smbus_pec(). Which supports non-zero
> CRC stating values.
>
> I've double-checked that the results for zero starting values are
> identical to the results from the original version of this function.
>
> Signed-off-by: Stefan Roese 
> Cc: Simon Glass 
> ---
>  drivers/tpm/tpm_tis_sandbox.c |  2 +-
>  include/linux/crc8.h  |  3 ++-
>  lib/crc8.c| 33 -
>  3 files changed, 23 insertions(+), 15 deletions(-)


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


Re: [U-Boot] [uboot] [PATCH v4 4/7] net: phy: ti: Allow the driver to be more configurable

2016-04-11 Thread Dan Murphy
On 04/11/2016 02:08 AM, Michal Simek wrote:
> On 8.4.2016 18:08, Dan Murphy wrote:
>> Not all devices use the same internal delay or fifo depth.
>> Add the ability to set the internal delay for rx or tx and the
>> fifo depth via the devicetree.  If the value is not set in the
>> devicetree then set the delay to the default.
>>
>> If devicetree is not used then use the default defines within the
>> driver.
>>
>> Signed-off-by: Dan Murphy 
>> ---
>>
>> v4 - Rebased the driver and changed default values to -1
>>
>>  drivers/net/phy/ti.c | 85 
>> +---
>>  1 file changed, 75 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
>> index 937426b..922f0a4 100644
>> --- a/drivers/net/phy/ti.c
>> +++ b/drivers/net/phy/ti.c
>> @@ -6,6 +6,14 @@
>>   */
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>>  
>>  /* TI DP83867 */
>>  #define DP83867_DEVADDR 0x1f
>> @@ -71,6 +79,17 @@
>>  #define MII_MMD_CTRL_INCR_RDWT  0x8000 /* post increment on reads & 
>> writes */
>>  #define MII_MMD_CTRL_INCR_ON_WT 0xC000 /* post increment on writes only 
>> */
>>  
>> +/* User setting - can be taken from DTS */
>> +#define DEFAULT_RX_ID_DELAY DP83867_RGMIIDCTL_2_25_NS
>> +#define DEFAULT_TX_ID_DELAY DP83867_RGMIIDCTL_2_75_NS
>> +#define DEFAULT_FIFO_DEPTH  DP83867_PHYCR_FIFO_DEPTH_4_B_NIB
>> +
>> +struct dp83867_private {
>> +int rx_id_delay;
>> +int tx_id_delay;
>> +int fifo_depth;
>> +};
>> +
>>  /**
>>   * phy_read_mmd_indirect - reads data from the MMD registers
>>   * @phydev: The PHY device bus
>> @@ -148,16 +167,58 @@ static inline bool phy_interface_is_rgmii(struct 
>> phy_device *phydev)
>>  phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
>>  }
>>  
>> -/* User setting - can be taken from DTS */
>> -#define RX_ID_DELAY 8
>> -#define TX_ID_DELAY 0xa
>> -#define FIFO_DEPTH  1
>> +#if defined(CONFIG_DM_ETH)
>> +/**
>> + * dp83867_data_init - Convenience function for setting PHY specific data
>> + *
>> + * @phydev: the phy_device struct
>> + */
>> +static int dp83867_of_init(struct phy_device *phydev)
>> +{
>> +struct dp83867_private *dp83867 = phydev->priv;
>> +struct udevice *dev = phydev->dev;
>> +
>> +dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
>> + "ti,rx_internal_delay", -1);
>> +
>> +dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
>> + "ti,tx_internal_delay", -1);
>> +
>> +dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
>> + "ti,fifo_depth", -1);
>> +
> These names are still incompatible with binding you have.
> There are dashes instead of underscores.

OK fixed in new version.

>
>
>> +return 0;
>> +}
>> +#else
>> +static int dp83867_of_init(struct phy_device *phydev)
>> +{
>> +dp83867->rx_id_delay = DEFAULT_RX_ID_DELAY;
>> +dp83867->tx_id_delay = DEFAULT_TX_ID_DELAY;
>> +dp83867->fifo_depth = DEFAULT_FIFO_DEPTH;
>> +
>> +return 0;
>> +}
>> +#endif
>>  
>>  static int dp83867_config(struct phy_device *phydev)
>>  {
>> +struct dp83867_private *dp83867;
>>  unsigned int val, delay, cfg2;
>>  int ret;
>>  
>> +if (!phydev->priv) {
>> +dp83867 = kzalloc(sizeof(*dp83867), GFP_KERNEL);
>> +if (!dp83867)
>> +return -ENOMEM;
>> +
>> +phydev->priv = dp83867;
>> +ret = dp83867_of_init(phydev);
>> +if (ret)
>> +goto err_out;
>> +} else {
>> +dp83867 = (struct dp83867_private *)phydev->priv;
>> +}
>> +
>>  /* Restart the PHY.  */
>>  val = phy_read(phydev, MDIO_DEVAD_NONE, DP83867_CTRL);
>>  phy_write(phydev, MDIO_DEVAD_NONE, DP83867_CTRL,
>> @@ -166,9 +227,9 @@ static int dp83867_config(struct phy_device *phydev)
>>  if (phy_interface_is_rgmii(phydev)) {
>>  ret = phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL,
>>  (DP83867_MDI_CROSSOVER_AUTO << DP83867_MDI_CROSSOVER) |
>> -(FIFO_DEPTH << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
>> +(dp83867->fifo_depth << 
>> DP83867_PHYCR_FIFO_DEPTH_SHIFT));
>>  if (ret)
>> -return ret;
>> +goto err_out;
>>  } else {
>>  phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
>>(BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
>> @@ -189,8 +250,8 @@ static int dp83867_config(struct phy_device *phydev)
>>DP83867_PHYCTRL_SGMIIEN |
>>(DP83867_MDI_CROSSOVER_MDIX <<
>>DP83867_MDI_CROSSOVER) |
>> -  (FIFO_DEPTH << DP83867_PHYCTRL_RXFIFO_SHIFT) |
>> -  (FIFO_DEPTH  << DP83867_PHYCTRL_

Re: [U-Boot] [PATCH] buildman: allow more incremental building

2016-04-11 Thread Simon Glass
Hi,

On 1 April 2016 at 07:35, Tom Rini  wrote:
> On Mon, Mar 28, 2016 at 04:39:35PM -0600, Stephen Warren wrote:
>
>> From: Stephen Warren 
>>
>> One use-case for buildman is to continually run it interactively after
>> each small step in a large refactoring operation. This gives more
>> immediate feedback than making a number of commits and then going back and
>> testing them. For this to work well, buildman needs to be extremely fast.
>> At present, a couple issues prevent it being as fast as it could be:
>>
>> 1) Each time buildman runs "make %_defconfig", it runs "make mrproper"
>> first. This throws away all previous build results, requiring a
>> from-scratch build. Optionally avoiding this would speed up the build, at
>> the cost of potentially causing or missing some build issues.

Does it actually cause problems? I think I have seen things go wrong
before, which is why I added it, but I can't remember the detail.

Threads work by configuring and building the first commit for a board,
then incrementally building each commit for that same board. So it
seems like change should only be useful when all the boards you are
building have a similar config.

>>
>> 2) A build tree is created per thread rather than per board. When a thread
>> switches between building different boards, this often causes many files
>> to be rebuilt due to changing config options. Using a separate build tree
>> for each board would avoid this. This does put more strain on the system's
>> disk cache, but it is worth it on my system at least.

I'm not sure why this is a win, given what I said above. I'm starting
to feel that I don't understand what is going on.

>>
>> This commit adds two command-line options to implement the changes
>> described above; -I ("--incremental") turns of "make mrproper" and -P
>> ("--per-board-out-dir") creats a build directory per board rather than per
>> thread.
>>
>> Tested:
>>
>> ./tools/buildman/buildman.py tegra
>> ./tools/buildman/buildman.py -I -P tegra
>> ./tools/buildman/buildman.py -b tegra_dev tegra
>> ./tools/buildman/buildman.py -b tegra_dev -I -P tegra
>>
>> ... each once after deleting the buildman result/work directory, and once
>> "incrementally" after a previous identical invocation.
>>
>> Signed-off-by: Stephen Warren 
>
> Reviewed-by: Tom Rini 

Oddly I don't seem to have received the original email, but I see this
in patchwork.

For me this cut build time from 6.25 minutes to 4.75 minutes for 30
commits built for two similar boards on a 8-thread machine. It's a big
win. I haven't yet tried it out on a a big build.

Stephen can you please update the README with some of your commit
notes? Other than that:

Acked-by: Simon Glass 
Tested-by: Simon Glass 

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


Re: [U-Boot] [PATCH] dm: gpio: pca953x: introduce driver model support for pca953x

2016-04-11 Thread Michal Simek
On 11.4.2016 07:47, Peng Fan wrote:
> On Sat, Apr 09, 2016 at 12:33:34PM -0600, Simon Glass wrote:
>> On 18 March 2016 at 03:54, Peng Fan  wrote:
>>> Introduce a new driver that supports driver model for pca953x.
>>> The pca953x chips are used as I2C I/O expanders.
>>> This driver is designed to support the following chips:
>>> "
>>> 4 bits: pca9536, pca9537
>>> 8 bits: max7310, max7315, pca6107, pca9534, pca9538, pca9554,
>>> pca9556, pca9557, pca9574, tca6408, xra1202
>>> 16 bits: max7312, max7313, pca9535, pca9539, pca9555, pca9575,
>>>  tca6416
>>> 24 bits: tca6424
>>> 40 bits: pca9505, pca9698
>>> "
>>> But for now this driver only supports max 24 bits and pca953x compatible
>>> chips. pca957x compatible chips are not supported now.
>>> These can be addressed when we need to add such support for the different
>>> chips.
>>> This driver has been tested on i.MX6 SoloX Sabreauto board with max7310
>>> i2c expander using gpio command as following:
>>>
>>> =>gpio status -a
>>> Bank gpio@48:
>>> gpio@480: input: 1 [ ]
>>> => gpio clear gpio@480
>>> gpio: pin gpio@480 (gpio 224) value is 0
>>> => gpio status -a
>>> Bank gpio@48:
>>> gpio@480: output: 0 [ ]
>>
>> Don't you think 480 is confusing? Perhaps you should have gpio@48_ as
>> the bank name? Also I think you should support a gpio-bank-name
>> property in the node, to allow a sensible name to be provided.
> 
> 480 is added by gpio uclass driver I think.
> The dts is copied from Linux side. I'd not change the dts, will try to
> see how to introudce a sensible name here.

What's the binding you are using?

The part of this patch should be DT binding.

This is my node.
tca6416_u61: gpio@21 {
compatible = "ti,tca6416";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
};


Thanks,
Michal


ZynqMP> i2c bus
Bus 0:  i2c@ff02
   20: gpio@20, offset len 1, flags 0
   21: gpio@21, offset len 1, flags 0
   75: i2cswitch@75, offset len 1, flags 0
Bus 750:i2c@0
Bus 751:i2c@1
Bus 752:i2c@2
Bus 1:  i2c@ff03
   74: i2cswitch@74, offset len 1, flags 0
   75: i2cswitch@75, offset len 1, flags 0
Bus 750:i2c@0
Bus 751:i2c@1
Bus 752:i2c@2
Bus 1743:   i2c@3
Bus 1744:   i2c@4
Bus 750:i2c@0
Bus 751:i2c@1
Bus 752:i2c@2
Bus 1743:   i2c@3
Bus 1744:   i2c@4
Bus 1755:   i2c@5
Bus 1756:   i2c@6
Bus 1757:   i2c@7
ZynqMP> gpio status -a
__of_translate_address: Bad cell count for gpio@20
Command 'gpio' failed: Error -19
ZynqMP> dm tree
 Class   Probed   Name

 root[ + ]root_driver
 simple_bus  [   ]|-- amba_apu
 simple_bus  [ + ]`-- amba
 eth [ + ]|-- ethernet@ff0e
 i2c [ + ]|-- i2c@ff02
 gpio[   ]|   |-- gpio@20
 gpio[   ]|   |-- gpio@21
 i2c_mux [   ]|   `-- i2cswitch@75
 i2c [   ]|   |-- i2c@0
 i2c [   ]|   |-- i2c@1
 i2c [   ]|   `-- i2c@2
 i2c [   ]|-- i2c@ff03
 i2c_mux [   ]|   |-- i2cswitch@74
 i2c [   ]|   |   |-- i2c@0
 i2c [   ]|   |   |-- i2c@1
 i2c [   ]|   |   |-- i2c@2
 i2c [   ]|   |   |-- i2c@3
 i2c [   ]|   |   `-- i2c@4
 i2c_mux [   ]|   `-- i2cswitch@75
 i2c [   ]|   |-- i2c@0
 i2c [   ]|   |-- i2c@1
 i2c [   ]|   |-- i2c@2
 i2c [   ]|   |-- i2c@3
 i2c [   ]|   |-- i2c@4
 i2c [   ]|   |-- i2c@5
 i2c [   ]|   |-- i2c@6
 i2c [   ]|   `-- i2c@7
 mmc [ + ]|-- sdhci@ff17
 serial  [ + ]|-- serial@ff00
 serial  [   ]`-- serial@ff01

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


Re: [U-Boot] [uboot] [PATCH v4 4/7] net: phy: ti: Allow the driver to be more configurable

2016-04-11 Thread Michal Simek
On 11.4.2016 14:01, Dan Murphy wrote:
> On 04/11/2016 02:08 AM, Michal Simek wrote:
>> On 8.4.2016 18:08, Dan Murphy wrote:
>>> Not all devices use the same internal delay or fifo depth.
>>> Add the ability to set the internal delay for rx or tx and the
>>> fifo depth via the devicetree.  If the value is not set in the
>>> devicetree then set the delay to the default.
>>>
>>> If devicetree is not used then use the default defines within the
>>> driver.
>>>
>>> Signed-off-by: Dan Murphy 
>>> ---
>>>
>>> v4 - Rebased the driver and changed default values to -1
>>>
>>>  drivers/net/phy/ti.c | 85 
>>> +---
>>>  1 file changed, 75 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
>>> index 937426b..922f0a4 100644
>>> --- a/drivers/net/phy/ti.c
>>> +++ b/drivers/net/phy/ti.c
>>> @@ -6,6 +6,14 @@
>>>   */
>>>  #include 
>>>  #include 
>>> +#include 
>>> +#include 
>>> +
>>> +#include 
>>> +#include 
>>> +#include 
>>> +
>>> +DECLARE_GLOBAL_DATA_PTR;
>>>  
>>>  /* TI DP83867 */
>>>  #define DP83867_DEVADDR0x1f
>>> @@ -71,6 +79,17 @@
>>>  #define MII_MMD_CTRL_INCR_RDWT 0x8000 /* post increment on reads & 
>>> writes */
>>>  #define MII_MMD_CTRL_INCR_ON_WT0xC000 /* post increment on writes only 
>>> */
>>>  
>>> +/* User setting - can be taken from DTS */
>>> +#define DEFAULT_RX_ID_DELAYDP83867_RGMIIDCTL_2_25_NS
>>> +#define DEFAULT_TX_ID_DELAYDP83867_RGMIIDCTL_2_75_NS
>>> +#define DEFAULT_FIFO_DEPTH DP83867_PHYCR_FIFO_DEPTH_4_B_NIB
>>> +
>>> +struct dp83867_private {
>>> +   int rx_id_delay;
>>> +   int tx_id_delay;
>>> +   int fifo_depth;
>>> +};
>>> +
>>>  /**
>>>   * phy_read_mmd_indirect - reads data from the MMD registers
>>>   * @phydev: The PHY device bus
>>> @@ -148,16 +167,58 @@ static inline bool phy_interface_is_rgmii(struct 
>>> phy_device *phydev)
>>> phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
>>>  }
>>>  
>>> -/* User setting - can be taken from DTS */
>>> -#define RX_ID_DELAY8
>>> -#define TX_ID_DELAY0xa
>>> -#define FIFO_DEPTH 1
>>> +#if defined(CONFIG_DM_ETH)
>>> +/**
>>> + * dp83867_data_init - Convenience function for setting PHY specific data
>>> + *
>>> + * @phydev: the phy_device struct
>>> + */
>>> +static int dp83867_of_init(struct phy_device *phydev)
>>> +{
>>> +   struct dp83867_private *dp83867 = phydev->priv;
>>> +   struct udevice *dev = phydev->dev;
>>> +
>>> +   dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
>>> +"ti,rx_internal_delay", -1);
>>> +
>>> +   dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
>>> +"ti,tx_internal_delay", -1);
>>> +
>>> +   dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
>>> +"ti,fifo_depth", -1);
>>> +
>> These names are still incompatible with binding you have.
>> There are dashes instead of underscores.
> 
> OK fixed in new version.
> 
>>
>>
>>> +   return 0;
>>> +}
>>> +#else
>>> +static int dp83867_of_init(struct phy_device *phydev)
>>> +{
>>> +   dp83867->rx_id_delay = DEFAULT_RX_ID_DELAY;
>>> +   dp83867->tx_id_delay = DEFAULT_TX_ID_DELAY;
>>> +   dp83867->fifo_depth = DEFAULT_FIFO_DEPTH;
>>> +
>>> +   return 0;
>>> +}
>>> +#endif
>>>  
>>>  static int dp83867_config(struct phy_device *phydev)
>>>  {
>>> +   struct dp83867_private *dp83867;
>>> unsigned int val, delay, cfg2;
>>> int ret;
>>>  
>>> +   if (!phydev->priv) {
>>> +   dp83867 = kzalloc(sizeof(*dp83867), GFP_KERNEL);
>>> +   if (!dp83867)
>>> +   return -ENOMEM;
>>> +
>>> +   phydev->priv = dp83867;
>>> +   ret = dp83867_of_init(phydev);
>>> +   if (ret)
>>> +   goto err_out;
>>> +   } else {
>>> +   dp83867 = (struct dp83867_private *)phydev->priv;
>>> +   }
>>> +
>>> /* Restart the PHY.  */
>>> val = phy_read(phydev, MDIO_DEVAD_NONE, DP83867_CTRL);
>>> phy_write(phydev, MDIO_DEVAD_NONE, DP83867_CTRL,
>>> @@ -166,9 +227,9 @@ static int dp83867_config(struct phy_device *phydev)
>>> if (phy_interface_is_rgmii(phydev)) {
>>> ret = phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL,
>>> (DP83867_MDI_CROSSOVER_AUTO << DP83867_MDI_CROSSOVER) |
>>> -   (FIFO_DEPTH << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
>>> +   (dp83867->fifo_depth << 
>>> DP83867_PHYCR_FIFO_DEPTH_SHIFT));
>>> if (ret)
>>> -   return ret;
>>> +   goto err_out;
>>> } else {
>>> phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
>>>   (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
>>> @@ -189,8 +250,8 @@ static int dp83867_config(struct phy_device *phydev)
>>>   DP83867_PHYCTRL_SGMIIEN |
>>>   (DP83867_MDI_CROSSOVER_MDIX <<
>>>

Re: [U-Boot] [uboot] [PATCH v4 4/7] net: phy: ti: Allow the driver to be more configurable

2016-04-11 Thread Dan Murphy
Michal

On 04/11/2016 07:11 AM, Michal Simek wrote:
> On 11.4.2016 14:01, Dan Murphy wrote:
>> On 04/11/2016 02:08 AM, Michal Simek wrote:
>>> On 8.4.2016 18:08, Dan Murphy wrote:
 Not all devices use the same internal delay or fifo depth.
 Add the ability to set the internal delay for rx or tx and the
 fifo depth via the devicetree.  If the value is not set in the
 devicetree then set the delay to the default.

 If devicetree is not used then use the default defines within the
 driver.

 Signed-off-by: Dan Murphy 
 ---

 v4 - Rebased the driver and changed default values to -1

  drivers/net/phy/ti.c | 85 
 +---
  1 file changed, 75 insertions(+), 10 deletions(-)

 diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
 index 937426b..922f0a4 100644
 --- a/drivers/net/phy/ti.c
 +++ b/drivers/net/phy/ti.c
 @@ -6,6 +6,14 @@
   */
  #include 
  #include 
 +#include 
 +#include 
 +
 +#include 
 +#include 
 +#include 
 +
 +DECLARE_GLOBAL_DATA_PTR;
  
  /* TI DP83867 */
  #define DP83867_DEVADDR   0x1f
 @@ -71,6 +79,17 @@
  #define MII_MMD_CTRL_INCR_RDWT0x8000 /* post increment on reads & 
 writes */
  #define MII_MMD_CTRL_INCR_ON_WT   0xC000 /* post increment on writes only 
 */
  
 +/* User setting - can be taken from DTS */
 +#define DEFAULT_RX_ID_DELAY   DP83867_RGMIIDCTL_2_25_NS
 +#define DEFAULT_TX_ID_DELAY   DP83867_RGMIIDCTL_2_75_NS
 +#define DEFAULT_FIFO_DEPTHDP83867_PHYCR_FIFO_DEPTH_4_B_NIB
 +
 +struct dp83867_private {
 +  int rx_id_delay;
 +  int tx_id_delay;
 +  int fifo_depth;
 +};
 +
  /**
   * phy_read_mmd_indirect - reads data from the MMD registers
   * @phydev: The PHY device bus
 @@ -148,16 +167,58 @@ static inline bool phy_interface_is_rgmii(struct 
 phy_device *phydev)
phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
  }
  
 -/* User setting - can be taken from DTS */
 -#define RX_ID_DELAY   8
 -#define TX_ID_DELAY   0xa
 -#define FIFO_DEPTH1
 +#if defined(CONFIG_DM_ETH)
 +/**
 + * dp83867_data_init - Convenience function for setting PHY specific data
 + *
 + * @phydev: the phy_device struct
 + */
 +static int dp83867_of_init(struct phy_device *phydev)
 +{
 +  struct dp83867_private *dp83867 = phydev->priv;
 +  struct udevice *dev = phydev->dev;
 +
 +  dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
 +   "ti,rx_internal_delay", -1);
 +
 +  dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
 +   "ti,tx_internal_delay", -1);
 +
 +  dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
 +   "ti,fifo_depth", -1);
 +
>>> These names are still incompatible with binding you have.
>>> There are dashes instead of underscores.
>> OK fixed in new version.

FYI I am changing these to the documented as it is in the kernel.
Changing the "_" to "-" so your dt file needs to be updated



-- 
--
Dan Murphy

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


[U-Boot] [uboot] [PATCH v5 1/7] drivers: net: cpsw: Add reading of DT phy-handle node

2016-04-11 Thread Dan Murphy
Add the ability to read the phy-handle node of the
cpsw slave.  Upon reading this handle the phy-id
can be stored based on the reg node in the DT.

The phy-handle also needs to be stored and passed
to the phy to access any phy data that is available.

Signed-off-by: Dan Murphy 
---

v5 - Fix checkpatch warning no spaces before tabs and typo is subject - 
https://patchwork.ozlabs.org/patch/608082/

 drivers/net/cpsw.c | 18 --
 include/cpsw.h |  1 +
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 7104754..8ee33a6 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -965,6 +965,9 @@ static int cpsw_phy_init(struct cpsw_priv *priv, struct 
cpsw_slave *slave)
phydev->supported &= supported;
phydev->advertising = phydev->supported;
 
+   if (slave->data->phy_of_handle)
+   phydev->dev->of_offset = slave->data->phy_of_handle;
+
priv->phydev = phydev;
phy_config(phydev);
 
@@ -1217,8 +1220,19 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice 
*dev)
if (phy_mode)
priv->data.slave_data[slave_index].phy_if =
phy_get_interface_by_name(phy_mode);
-   fdtdec_get_int_array(fdt, subnode, "phy_id", phy_id, 2);
-   priv->data.slave_data[slave_index].phy_addr = phy_id[1];
+
+   priv->data.slave_data[slave_index].phy_of_handle =
+   fdtdec_lookup_phandle(fdt, subnode, 
"phy-handle");
+
+   if (priv->data.slave_data[slave_index].phy_of_handle) {
+   priv->data.slave_data[slave_index].phy_addr =
+   fdtdec_get_int(gd->fdt_blob,
+   
priv->data.slave_data[slave_index].phy_of_handle,
+   "reg", -1);
+   } else {
+   fdtdec_get_int_array(fdt, subnode, "phy_id", 
phy_id, 2);
+   priv->data.slave_data[slave_index].phy_addr = 
phy_id[1];
+   }
slave_index++;
}
 
diff --git a/include/cpsw.h b/include/cpsw.h
index cf1d30b..ff95cd8 100644
--- a/include/cpsw.h
+++ b/include/cpsw.h
@@ -21,6 +21,7 @@ struct cpsw_slave_data {
u32 sliver_reg_ofs;
int phy_addr;
int phy_if;
+   int phy_of_handle;
 };
 
 enum {
-- 
2.8.0.rc3

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


[U-Boot] [uboot] [PATCH v5 4/7] net: phy: ti: Allow the driver to be more configurable

2016-04-11 Thread Dan Murphy
Not all devices use the same internal delay or fifo depth.
Add the ability to set the internal delay for rx or tx and the
fifo depth via the devicetree.  If the value is not set in the
devicetree then set the delay to the default.

If devicetree is not used then use the default defines within the
driver.

Signed-off-by: Dan Murphy 
---

v5 - Removed extra space and renamed the bindings per the bindings document - 
https://patchwork.ozlabs.org/patch/608087/

 drivers/net/phy/ti.c | 85 +---
 1 file changed, 75 insertions(+), 10 deletions(-)

diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
index 937426b..b8f3ebd 100644
--- a/drivers/net/phy/ti.c
+++ b/drivers/net/phy/ti.c
@@ -6,6 +6,14 @@
  */
 #include 
 #include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
 
 /* TI DP83867 */
 #define DP83867_DEVADDR0x1f
@@ -71,6 +79,17 @@
 #define MII_MMD_CTRL_INCR_RDWT 0x8000 /* post increment on reads & writes */
 #define MII_MMD_CTRL_INCR_ON_WT0xC000 /* post increment on writes only 
*/
 
+/* User setting - can be taken from DTS */
+#define DEFAULT_RX_ID_DELAYDP83867_RGMIIDCTL_2_25_NS
+#define DEFAULT_TX_ID_DELAYDP83867_RGMIIDCTL_2_75_NS
+#define DEFAULT_FIFO_DEPTH DP83867_PHYCR_FIFO_DEPTH_4_B_NIB
+
+struct dp83867_private {
+   int rx_id_delay;
+   int tx_id_delay;
+   int fifo_depth;
+};
+
 /**
  * phy_read_mmd_indirect - reads data from the MMD registers
  * @phydev: The PHY device bus
@@ -148,16 +167,58 @@ static inline bool phy_interface_is_rgmii(struct 
phy_device *phydev)
phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
 }
 
-/* User setting - can be taken from DTS */
-#define RX_ID_DELAY8
-#define TX_ID_DELAY0xa
-#define FIFO_DEPTH 1
+#if defined(CONFIG_DM_ETH)
+/**
+ * dp83867_data_init - Convenience function for setting PHY specific data
+ *
+ * @phydev: the phy_device struct
+ */
+static int dp83867_of_init(struct phy_device *phydev)
+{
+   struct dp83867_private *dp83867 = phydev->priv;
+   struct udevice *dev = phydev->dev;
+
+   dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+"ti,rx-internal-delay", -1);
+
+   dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+"ti,tx-internal-delay", -1);
+
+   dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+"ti,fifo-depth", -1);
+
+   return 0;
+}
+#else
+static int dp83867_of_init(struct phy_device *phydev)
+{
+   dp83867->rx_id_delay = DEFAULT_RX_ID_DELAY;
+   dp83867->tx_id_delay = DEFAULT_TX_ID_DELAY;
+   dp83867->fifo_depth = DEFAULT_FIFO_DEPTH;
+
+   return 0;
+}
+#endif
 
 static int dp83867_config(struct phy_device *phydev)
 {
+   struct dp83867_private *dp83867;
unsigned int val, delay, cfg2;
int ret;
 
+   if (!phydev->priv) {
+   dp83867 = kzalloc(sizeof(*dp83867), GFP_KERNEL);
+   if (!dp83867)
+   return -ENOMEM;
+
+   phydev->priv = dp83867;
+   ret = dp83867_of_init(phydev);
+   if (ret)
+   goto err_out;
+   } else {
+   dp83867 = (struct dp83867_private *)phydev->priv;
+   }
+
/* Restart the PHY.  */
val = phy_read(phydev, MDIO_DEVAD_NONE, DP83867_CTRL);
phy_write(phydev, MDIO_DEVAD_NONE, DP83867_CTRL,
@@ -166,9 +227,9 @@ static int dp83867_config(struct phy_device *phydev)
if (phy_interface_is_rgmii(phydev)) {
ret = phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL,
(DP83867_MDI_CROSSOVER_AUTO << DP83867_MDI_CROSSOVER) |
-   (FIFO_DEPTH << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
+   (dp83867->fifo_depth << 
DP83867_PHYCR_FIFO_DEPTH_SHIFT));
if (ret)
-   return ret;
+   goto err_out;
} else {
phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
  (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
@@ -189,8 +250,8 @@ static int dp83867_config(struct phy_device *phydev)
  DP83867_PHYCTRL_SGMIIEN |
  (DP83867_MDI_CROSSOVER_MDIX <<
  DP83867_MDI_CROSSOVER) |
- (FIFO_DEPTH << DP83867_PHYCTRL_RXFIFO_SHIFT) |
- (FIFO_DEPTH  << DP83867_PHYCTRL_TXFIFO_SHIFT));
+ (dp83867->fifo_depth << DP83867_PHYCTRL_RXFIFO_SHIFT) 
|
+ (dp83867->fifo_depth << 
DP83867_PHYCTRL_TXFIFO_SHIFT));
phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_BISCR, 0x0);
}
 
@@ -212,8 +273,8 @@ static int dp83867_config(struct phy_device *phydev)
phy_write_mmd_indirect(phydev, DP83867

[U-Boot] [uboot] [PATCH v5 6/7] net: phy: Add phy_interface_is_sgmii to phy.h

2016-04-11 Thread Dan Murphy
Add a helper to phy.h to identify whether the
phy is configured for SGMII all variables.

Signed-off-by: Dan Murphy 
---

v5 - No change

 include/phy.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/include/phy.h b/include/phy.h
index 7b2d1ff..ef3eb51 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -288,6 +288,17 @@ static inline bool phy_interface_is_rgmii(struct 
phy_device *phydev)
phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
 }
 
+/**
+ * phy_interface_is_sgmii - Convenience function for testing if a PHY interface
+ * is SGMII (all variants)
+ * @phydev: the phy_device struct
+ */
+static inline bool phy_interface_is_sgmii(struct phy_device *phydev)
+{
+   return phydev->interface >= PHY_INTERFACE_MODE_SGMII &&
+   phydev->interface <= PHY_INTERFACE_MODE_QSGMII;
+}
+
 /* PHY UIDs for various PHYs that are referenced in external code */
 #define PHY_UID_CS4340  0x13e51002
 #define PHY_UID_TN2020 0x00a19410
-- 
2.8.0.rc3

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


[U-Boot] [uboot] [PATCH v5 5/7] net: phy: Move is_rgmii helper to phy.h

2016-04-11 Thread Dan Murphy
Move the phy_interface_is_rgmii to the phy.h
file for all phy's to be able to use the API.

This now aligns with the Linux kernel based on
commit e463d88c36d42211aa72ed76d32fb8bf37820ef1

Signed-off-by: Dan Murphy 
---

v5 - No change

 drivers/net/phy/ti.c | 11 ---
 include/phy.h| 11 +++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
index b8f3ebd..b1f1ec8 100644
--- a/drivers/net/phy/ti.c
+++ b/drivers/net/phy/ti.c
@@ -156,17 +156,6 @@ void phy_write_mmd_indirect(struct phy_device *phydev, int 
prtad,
phy_write(phydev, addr, MII_MMD_DATA, data);
 }
 
-/**
- * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
- * is RGMII (all variants)
- * @phydev: the phy_device struct
- */
-static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
-{
-   return phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
-   phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
-}
-
 #if defined(CONFIG_DM_ETH)
 /**
  * dp83867_data_init - Convenience function for setting PHY specific data
diff --git a/include/phy.h b/include/phy.h
index 21459a8..7b2d1ff 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -277,6 +277,17 @@ int get_phy_id(struct mii_dev *bus, int addr, int devad, 
u32 *phy_id);
  */
 int phy_get_interface_by_name(const char *str);
 
+/**
+ * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
+ * is RGMII (all variants)
+ * @phydev: the phy_device struct
+ */
+static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
+{
+   return phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
+   phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
+}
+
 /* PHY UIDs for various PHYs that are referenced in external code */
 #define PHY_UID_CS4340  0x13e51002
 #define PHY_UID_TN2020 0x00a19410
-- 
2.8.0.rc3

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


[U-Boot] [uboot] [PATCH v5 3/7] net: phy: dp83867: Add device tree bindings and documentation

2016-04-11 Thread Dan Murphy
Add the device tree bindings and the accompanying documentation
for the TI DP83867 Giga bit ethernet phy driver.

The original document was from:
[commit 2a10154abcb75ad0d7b6bfea6210ac743ec60897 from the Linux kernel]

Signed-off-by: Dan Murphy 
---

v5 - Removed /t between define and variable - 
https://patchwork.ozlabs.org/patch/608085/

 doc/device-tree-bindings/net/ti,dp83867.txt | 25 +
 include/dt-bindings/net/ti-dp83867.h| 35 +
 2 files changed, 60 insertions(+)
 create mode 100644 doc/device-tree-bindings/net/ti,dp83867.txt
 create mode 100644 include/dt-bindings/net/ti-dp83867.h

diff --git a/doc/device-tree-bindings/net/ti,dp83867.txt 
b/doc/device-tree-bindings/net/ti,dp83867.txt
new file mode 100644
index 000..cb77fdf
--- /dev/null
+++ b/doc/device-tree-bindings/net/ti,dp83867.txt
@@ -0,0 +1,25 @@
+* Texas Instruments - dp83867 Giga bit ethernet phy
+
+Required properties:
+   - reg - The ID number for the phy, usually a small integer
+   - ti,rx-internal-delay - RGMII Recieve Clock Delay - see 
dt-bindings/net/ti-dp83867.h
+   for applicable values
+   - ti,tx-internal-delay - RGMII Transmit Clock Delay - see 
dt-bindings/net/ti-dp83867.h
+   for applicable values
+   - ti,fifo-depth - Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h
+   for applicable values
+
+Default child nodes are standard Ethernet PHY device
+nodes as described in doc/devicetree/bindings/net/ethernet.txt
+
+Example:
+
+   ethernet-phy@0 {
+   reg = <0>;
+   ti,rx-internal-delay = ;
+   ti,tx-internal-delay = ;
+   ti,fifo-depth = ;
+   };
+
+Datasheet can be found:
+http://www.ti.com/product/DP83867IR/datasheet
diff --git a/include/dt-bindings/net/ti-dp83867.h 
b/include/dt-bindings/net/ti-dp83867.h
new file mode 100644
index 000..1843757
--- /dev/null
+++ b/include/dt-bindings/net/ti-dp83867.h
@@ -0,0 +1,35 @@
+/*
+ * TI DP83867 PHY drivers
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ *
+ */
+
+#ifndef _DT_BINDINGS_TI_DP83867_H
+#define _DT_BINDINGS_TI_DP83867_H
+
+/* PHY CTRL bits */
+#define DP83867_PHYCR_FIFO_DEPTH_3_B_NIB   0x00
+#define DP83867_PHYCR_FIFO_DEPTH_4_B_NIB   0x01
+#define DP83867_PHYCR_FIFO_DEPTH_6_B_NIB   0x02
+#define DP83867_PHYCR_FIFO_DEPTH_8_B_NIB   0x03
+
+/* RGMIIDCTL internal delay for rx and tx */
+#define DP83867_RGMIIDCTL_250_PS   0x0
+#define DP83867_RGMIIDCTL_500_PS   0x1
+#define DP83867_RGMIIDCTL_750_PS   0x2
+#define DP83867_RGMIIDCTL_1_NS 0x3
+#define DP83867_RGMIIDCTL_1_25_NS  0x4
+#define DP83867_RGMIIDCTL_1_50_NS  0x5
+#define DP83867_RGMIIDCTL_1_75_NS  0x6
+#define DP83867_RGMIIDCTL_2_00_NS  0x7
+#define DP83867_RGMIIDCTL_2_25_NS  0x8
+#define DP83867_RGMIIDCTL_2_50_NS  0x9
+#define DP83867_RGMIIDCTL_2_75_NS  0xa
+#define DP83867_RGMIIDCTL_3_00_NS  0xb
+#define DP83867_RGMIIDCTL_3_25_NS  0xc
+#define DP83867_RGMIIDCTL_3_50_NS  0xd
+#define DP83867_RGMIIDCTL_3_75_NS  0xe
+#define DP83867_RGMIIDCTL_4_00_NS  0xf
+
+#endif
-- 
2.8.0.rc3

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


[U-Boot] [uboot] [PATCH v5 7/7] net: phy: dp83867: Add SGMII helper for configuration

2016-04-11 Thread Dan Murphy
The code assumed that if the interface is not RGMII configured
then it must be SGMII configured.  This device has the ability
to support most of the MII interfaces.  Therefore add the
helper for SGMII and only configure the device if the interface is
configured for SGMII.

Signed-off-by: Dan Murphy 
---

v5 - No change

 drivers/net/phy/ti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
index b1f1ec8..f881914 100644
--- a/drivers/net/phy/ti.c
+++ b/drivers/net/phy/ti.c
@@ -219,7 +219,7 @@ static int dp83867_config(struct phy_device *phydev)
(dp83867->fifo_depth << 
DP83867_PHYCR_FIFO_DEPTH_SHIFT));
if (ret)
goto err_out;
-   } else {
+   } else if (phy_interface_is_sgmii(phydev)) {
phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
  (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
 
-- 
2.8.0.rc3

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


[U-Boot] [uboot] [PATCH v5 2/7] net: zynq_gem: Add the passing of the phy-handle node

2016-04-11 Thread Dan Murphy
Add the ability to pass the phy-handle node offset
to the phy driver.  This allows the phy driver
to access the DT subnode's data and parse accordingly.

Signed-off-by: Dan Murphy 
---

v5 - Removed unused variable and fixed checkpatch warning - 
https://patchwork.ozlabs.org/patch/608083/

 drivers/net/zynq_gem.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index aec8077..f9b22c4 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -179,6 +179,7 @@ struct zynq_gem_priv {
struct zynq_gem_regs *iobase;
phy_interface_t interface;
struct phy_device *phydev;
+   int phy_of_handle;
struct mii_dev *bus;
 };
 
@@ -352,6 +353,10 @@ static int zynq_phy_init(struct udevice *dev)
priv->phydev->supported = supported | ADVERTISED_Pause |
  ADVERTISED_Asym_Pause;
priv->phydev->advertising = priv->phydev->supported;
+
+   if (priv->phy_of_handle > 0)
+   priv->phydev->dev->of_offset = priv->phy_of_handle;
+
phy_config(priv->phydev);
 
return 0;
@@ -675,7 +680,6 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
 {
struct eth_pdata *pdata = dev_get_platdata(dev);
struct zynq_gem_priv *priv = dev_get_priv(dev);
-   int offset = 0;
const char *phy_mode;
 
pdata->iobase = (phys_addr_t)dev_get_addr(dev);
@@ -684,10 +688,11 @@ static int zynq_gem_ofdata_to_platdata(struct udevice 
*dev)
priv->emio = 0;
priv->phyaddr = -1;
 
-   offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
-  "phy-handle");
-   if (offset > 0)
-   priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
+   priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob,
+   dev->of_offset, "phy-handle");
+   if (priv->phy_of_handle > 0)
+   priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
+   priv->phy_of_handle, "reg", -1);
 
phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
if (phy_mode)
-- 
2.8.0.rc3

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


Re: [U-Boot] [PATCH 00/10] driver model bring-up of dwc3 usb peripheral

2016-04-11 Thread Simon Glass
+Mugunthan, who seems to have been dropped from this thread

On 8 April 2016 at 13:45, Tom Rini  wrote:
> On Wed, Apr 06, 2016 at 05:16:02PM -0600, Simon Glass wrote:
>> Hi,
>>
>> On 31 March 2016 at 09:24, Marek Vasut  wrote:
>> > On 03/31/2016 05:11 PM, Tom Rini wrote:
>> >> On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote:
>> >>> Hi Tom,
>> >>>
>> >>> On 15.3.2016 13:14, Mugunthan V N wrote:
>>  This patch series enables dwc3 usb driver to adopt driver model.
>>  This has been tested on AM437x evm sk (logs [1]) by loading
>>  kernel through usb ether
>> 
>>  Also pushed a branch for testing [2]
>> 
>>  [1] - http://pastebin.ubuntu.com/15391169/
>>  [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git 
>>  dm-dwc3
>> 
>>  Kishon Vijay Abraham I (1):
>>    configs: am43xx: Add am43xx_evm_usbspl_defconfig
>> 
>>  Mugunthan V N (8):
>>    drivers: usb: dwc3: remove devm_zalloc from linux_compact
>>    drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board
>>  files to drivers
>>    am437x: board: do not register usb devices when CONFIG_DM_USB is
>>  defined
>>    dra7xx: board: do not register usb devices when CONFIG_DM_USB is
>>  defined
>>    drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
>>    drivers: usb: common: add support to get maximum speed from dt
>>    drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model
>>  support
>>    defconfig: am437x_sk_evm: enable usb driver model
>> 
>>  Tom Rini (1):
>>    am43xx: Add USB device boot support to SPL
>> 
>>   board/ti/am43xx/MAINTAINERS |   1 +
>>   board/ti/am43xx/board.c |  52 +---
>>   board/ti/am57xx/board.c |  11 --
>>   board/ti/dra7xx/evm.c   |  13 +-
>>   configs/am437x_sk_evm_defconfig |   4 +
>>   configs/am43xx_evm_usbspl_defconfig |   9 ++
>>   drivers/Makefile|   2 +
>>   drivers/usb/common/common.c |  29 +
>>   drivers/usb/dwc3/core.c |  64 +-
>>   drivers/usb/dwc3/core.h |   6 +
>>   drivers/usb/dwc3/dwc3-omap.c| 230 
>>  +++-
>>   drivers/usb/dwc3/gadget.c   |   2 +-
>>   drivers/usb/dwc3/linux-compat.h |   5 -
>>   drivers/usb/dwc3/ti_usb_phy.c   |   1 +
>>   drivers/usb/gadget/gadget_chips.h   |   2 +
>>   include/configs/am43xx_evm.h|  13 ++
>>   include/linux/usb/otg.h |   9 ++
>>   17 files changed, 406 insertions(+), 47 deletions(-)
>>   create mode 100644 configs/am43xx_evm_usbspl_defconfig
>> 
>> >>>
>> >>> Are you going to take this directly or this should go via USB tree?
>> >>
>> >> Marek, do you want this?  Or want me to?
>> >>
>> > That is Lukasz.
>>
>> This series has ended up in my patchwork queue, but there seem to be
>> quite a few unapplied, dependent patches. Tom please let me know what
>> you'd like me to do here.
>
> ... I didn't think it depended on stuff but I do need to do another
> go-round from the queue and apply stuff.

Specifically it seems to be missing the patch below, from:

git://git.ti.com/~dmurphy/ti-u-boot/mugunth-ti-u-boot.git


commit 67802cd52d1c45a789ac377106267cee9d6ac2d9
Author: Mugunthan V N 
Date:   Tue Mar 1 16:59:22 2016 +0530

drivers: usb: common: add common code for usb drivers to use

Add common usb code which usb drivers makes use of it.

Signed-off-by: Mugunthan V N 

 Makefile|  1 +
 drivers/usb/common/Makefile |  8 
 drivers/usb/common/common.c | 40 
 include/linux/usb/otg.h |  9 +
 4 files changed, 58 insertions(+)

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


Re: [U-Boot] [PATCH] dm: gpio: pca953x: introduce driver model support for pca953x

2016-04-11 Thread Michal Simek
On 11.4.2016 14:09, Michal Simek wrote:
> On 11.4.2016 07:47, Peng Fan wrote:
>> On Sat, Apr 09, 2016 at 12:33:34PM -0600, Simon Glass wrote:
>>> On 18 March 2016 at 03:54, Peng Fan  wrote:
 Introduce a new driver that supports driver model for pca953x.
 The pca953x chips are used as I2C I/O expanders.
 This driver is designed to support the following chips:
 "
 4 bits: pca9536, pca9537
 8 bits: max7310, max7315, pca6107, pca9534, pca9538, pca9554,
 pca9556, pca9557, pca9574, tca6408, xra1202
 16 bits: max7312, max7313, pca9535, pca9539, pca9555, pca9575,
  tca6416
 24 bits: tca6424
 40 bits: pca9505, pca9698
 "
 But for now this driver only supports max 24 bits and pca953x compatible
 chips. pca957x compatible chips are not supported now.
 These can be addressed when we need to add such support for the different
 chips.
 This driver has been tested on i.MX6 SoloX Sabreauto board with max7310
 i2c expander using gpio command as following:

 =>gpio status -a
 Bank gpio@48:
 gpio@480: input: 1 [ ]
 => gpio clear gpio@480
 gpio: pin gpio@480 (gpio 224) value is 0
 => gpio status -a
 Bank gpio@48:
 gpio@480: output: 0 [ ]
>>>
>>> Don't you think 480 is confusing? Perhaps you should have gpio@48_ as
>>> the bank name? Also I think you should support a gpio-bank-name
>>> property in the node, to allow a sensible name to be provided.
>>
>> 480 is added by gpio uclass driver I think.
>> The dts is copied from Linux side. I'd not change the dts, will try to
>> see how to introudce a sensible name here.
> 
> What's the binding you are using?
> 
> The part of this patch should be DT binding.
> 
> This is my node.
>   tca6416_u61: gpio@21 {
>   compatible = "ti,tca6416";
>   reg = <0x21>;
>   gpio-controller;
>   #gpio-cells = <2>;
>   };
> 

Ok. I found where the problem is.

i2c bus has
#address-cells = <1>;
#size-cells = <0>;

And then OF_CHECK_COUNTS thinks that it is incorrect setting for bus
but it should be valid for i2c where only address without size is used.
When I apply patch below driver is probed


diff --git a/common/fdt_support.c b/common/fdt_support.c
index ced119e70d9f..5f5b49c6210b 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -941,7 +941,7 @@ void fdt_del_node_and_alias(void *blob, const char
*alias)
 #define OF_MAX_ADDR_CELLS  4
 #define OF_BAD_ADDRFDT_ADDR_T_NONE
 #define OF_CHECK_COUNTS(na, ns)((na) > 0 && (na) <=
OF_MAX_ADDR_CELLS && \
-   (ns) > 0)
+   (ns) >= 0)

 /* Debug utility */
 #ifdef DEBUG

Regarding numbers. It is just hex to int conversion + gpio number.
It means gpio@20 is 0x20 which is 32. Using hex everywhere make sense
and this is the fix. Maybe better to also use underscore.

diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c
index 6b67b079a17b..1eeb4c8f199a 100644
--- a/drivers/gpio/pca953x_gpio.c
+++ b/drivers/gpio/pca953x_gpio.c
@@ -292,7 +292,7 @@ static int pca953x_probe(struct udevice *dev)
return ret;
}

-   snprintf(name, sizeof(name), "gpio@%u", info->addr);
+   snprintf(name, sizeof(name), "gpio@%x_", info->addr);
str = strdup(name);
if (!str)
return -ENOMEM;

Output below.

Thanks,
Michal

ZynqMP> dm tree
 Class   Probed   Name

 root[ + ]root_driver
 simple_bus  [   ]|-- amba_apu
 simple_bus  [ + ]`-- amba
 eth [ + ]|-- ethernet@ff0e
 i2c [ + ]|-- i2c@ff02
 gpio[ + ]|   |-- gpio@20
 gpio[ + ]|   |-- gpio@21
 i2c_mux [   ]|   `-- i2cswitch@75
 i2c [   ]|   |-- i2c@0
 i2c [   ]|   |-- i2c@1
 i2c [   ]|   `-- i2c@2
 i2c [   ]|-- i2c@ff03
 i2c_mux [   ]|   |-- i2cswitch@74
 i2c [   ]|   |   |-- i2c@0
 i2c [   ]|   |   |-- i2c@1
 i2c [   ]|   |   |-- i2c@2
 i2c [   ]|   |   |-- i2c@3
 i2c [   ]|   |   `-- i2c@4
 i2c_mux [   ]|   `-- i2cswitch@75
 i2c [   ]|   |-- i2c@0
 i2c [   ]|   |-- i2c@1
 i2c [   ]|   |-- i2c@2
 i2c [   ]|   |-- i2c@3
 i2c [   ]|   |-- i2c@4
 i2c [   ]|   |-- i2c@5
 i2c [   ]|   |-- i2c@6
 i2c [   ]|   `-- i2c@7
 mmc [ + ]|-- sdhci@ff17
 serial  [ + ]|-- serial@ff00
 serial  [   ]`-- serial@ff01
ZynqMP> i2c bus
Bus 0:  i2c@ff02  (active 0)
   20: gpio@20, offset len 1, flags 0
   21: gpio@21, offset len 1, flags 0
   75: i2cswitch@75, offset len 1, flags 0
Bus 750:i2c@0
Bus

[U-Boot] [PATCH v2] armv8/ls2080a: configure PMU's PCTBENR to enable WDT

2016-04-11 Thread Yunhui Cui
From: Yunhui Cui 

The SP805-WDT module on LS2080A and LS2085A, requires configuration
of PMU's PCTBENR register to enable watchdog counter decrement and
reset signal generation. In order not to affect the sp805wdt driver
frame, we enable the watchdog clk in advance.

Signed-off-by: Yunhui Cui 
---
 arch/arm/cpu/armv8/fsl-layerscape/soc.c   | 17 +
 arch/arm/include/asm/arch-fsl-layerscape/config.h |  4 
 arch/arm/include/asm/arch-fsl-layerscape/soc.h|  1 +
 board/freescale/ls2080aqds/ls2080aqds.c   |  2 ++
 board/freescale/ls2080ardb/ls2080ardb.c   |  2 ++
 5 files changed, 26 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c 
b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index a76447e..e6f3566 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -17,6 +17,23 @@
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
+#if defined(CONFIG_LS2080A) || defined(CONFIG_LS2085A)
+/*
+ * There are eight SP805 watchdog units on ls2080a/ls2085a,So
+ * Set PMU-Physical Core Time Base Enable Register (PCTBENR)
+ * low eight bits to enable clocks to eight Cortext-A57 cores
+ * timebase, which allows the WDT counter to decrement and raise
+ * a reset request (if configured in the WDTCONTROL register).
+ */
+void enable_watchdog_clk(void)
+{
+   u32 pmu_val;
+
+   pmu_val = *(u32 *)(FSL_PMU_REG_BASE + FSL_PMU_PCTBENR_OFFSET);
+   *(u32 *)(FSL_PMU_REG_BASE + FSL_PMU_PCTBENR_OFFSET) = pmu_val | 0xff;
+}
+#endif
+
 
 #if defined(CONFIG_LS2080A) || defined(CONFIG_LS2085A)
 /*
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/config.h 
b/arch/arm/include/asm/arch-fsl-layerscape/config.h
index ceefe43..b9656d7 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/config.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/config.h
@@ -148,6 +148,10 @@
 #define CONFIG_ARM_ERRATA_829520
 #define CONFIG_ARM_ERRATA_833471
 
+/* PMU-Physical Core Time Base Enable Register */
+#define FSL_PMU_REG_BASE   0x1E3
+#define FSL_PMU_PCTBENR_OFFSET 0x8A0
+
 #elif defined(CONFIG_LS1043A)
 #define CONFIG_MAX_CPUS4
 #define CONFIG_SYS_CACHELINE_SIZE  64
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/soc.h 
b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
index 56989e1..32c9185 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/soc.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
@@ -91,6 +91,7 @@ void fsl_lsch2_early_init_f(void);
 #endif
 
 void cpu_name(char *name);
+void enable_watchdog_clk(void);
 #ifdef CONFIG_SYS_FSL_ERRATUM_A009635
 void erratum_a009635(void);
 #endif
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c 
b/board/freescale/ls2080aqds/ls2080aqds.c
index e1a521d..8ebc96a 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -213,6 +213,8 @@ int board_init(void)
select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
rtc_enable_32khz_output();
 
+   enable_watchdog_clk();
+
return 0;
 }
 
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c 
b/board/freescale/ls2080ardb/ls2080ardb.c
index 8201048..ad8324a 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -181,6 +181,8 @@ int board_init(void)
/* invert AQR405 IRQ pins polarity */
out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR405_IRQ_MASK);
 
+   enable_watchdog_clk();
+
return 0;
 }
 
-- 
2.1.0.27.g96db324

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


Re: [U-Boot] [PATCH] armv8/ls2080a: configure PMU's PCTBENR to enable WDT

2016-04-11 Thread Yunhui Cui
Hi Bhupesh,

Thanks for your suggestions about the patch. I will update it in the next 
version.

Thanks
Yunhui

-Original Message-
From: Bhupesh Sharma 
Sent: Friday, April 08, 2016 11:17 PM
To: Yunhui Cui; york sun
Cc: Yunhui Cui; u-boot@lists.denx.de
Subject: RE: [U-Boot] [PATCH] armv8/ls2080a: configure PMU's PCTBENR to enable 
WDT

> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Yunhui 
> Cui
> Sent: Friday, April 08, 2016 3:57 PM
> To: york sun
> Cc: Yunhui Cui; u-boot@lists.denx.de
> Subject: [U-Boot] [PATCH] armv8/ls2080a: configure PMU's PCTBENR to 
> enable WDT
> 
> From: Yunhui Cui 
> 
> The SP805-WDT module on LS2080A and LS2085A, requires configuration of 
> PMU's PCTBENR register to enable watchdog counter decrement and reset 
> signal generation. In order not to affect the sp805wdt driver frame, 
> we enable the watchdog clk in advance.
> 
> Signed-off-by: Yunhui Cui 
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/soc.c| 18 ++
>  arch/arm/include/asm/arch-fsl-layerscape/soc.h |  1 +
>  board/freescale/ls2080aqds/ls2080aqds.c|  2 ++
>  board/freescale/ls2080ardb/ls2080ardb.c|  2 ++
>  4 files changed, 23 insertions(+)
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
> b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
> index a76447e..06c950f 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
> @@ -17,6 +17,24 @@
>  #endif
> 
>  DECLARE_GLOBAL_DATA_PTR;
> +#if defined(CONFIG_LS2080A) || defined(CONFIG_LS2085A)
> +/*
> + * Set the bit corresponding to our watchDog-id in the
> + * PMU-Physical Core Time Base Enable Register (PCTBENR)
> + * to allow the WDT counter to decrement and raise a reset
> + * request (if configured in the WDTCONTROL register).
> + */

This comment does not describe correctly the flow you are using in the function 
below.

> +void enable_watchdog_clk(void)
> +{
> + #define FSL_PMU_REG_BASE0x1E3
> + #define FSL_PMU_PCTBENR_OFFSET  0x8A0

Can we move the #define into a proper header file 
'arch/arm/include/asm/arch-fsl-layerscape/config.h':
http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/include/asm/arch-fsl-layerscape/config.h;h=ceefe431fdcbd6aa3a176bc3631338c62d4bb976;hb=HEAD

Regards,
Bhupesh

> + u32 pmu_val;
> +
> + pmu_val = *(u32 *)(FSL_PMU_REG_BASE + FSL_PMU_PCTBENR_OFFSET);
> + *(u32 *)(FSL_PMU_REG_BASE + FSL_PMU_PCTBENR_OFFSET) = pmu_val |
> 0xff;
> +} #endif
> +
> 
>  #if defined(CONFIG_LS2080A) || defined(CONFIG_LS2085A)
>  /*
> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/soc.h
> b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
> index 56989e1..32c9185 100644
> --- a/arch/arm/include/asm/arch-fsl-layerscape/soc.h
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
> @@ -91,6 +91,7 @@ void fsl_lsch2_early_init_f(void);  #endif
> 
>  void cpu_name(char *name);
> +void enable_watchdog_clk(void);
>  #ifdef CONFIG_SYS_FSL_ERRATUM_A009635  void erratum_a009635(void);  
> #endif diff --git a/board/freescale/ls2080aqds/ls2080aqds.c
> b/board/freescale/ls2080aqds/ls2080aqds.c
> index e1a521d..8ebc96a 100644
> --- a/board/freescale/ls2080aqds/ls2080aqds.c
> +++ b/board/freescale/ls2080aqds/ls2080aqds.c
> @@ -213,6 +213,8 @@ int board_init(void)
>   select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
>   rtc_enable_32khz_output();
> 
> + enable_watchdog_clk();
> +
>   return 0;
>  }
> 
> diff --git a/board/freescale/ls2080ardb/ls2080ardb.c
> b/board/freescale/ls2080ardb/ls2080ardb.c
> index 8201048..ad8324a 100644
> --- a/board/freescale/ls2080ardb/ls2080ardb.c
> +++ b/board/freescale/ls2080ardb/ls2080ardb.c
> @@ -181,6 +181,8 @@ int board_init(void)
>   /* invert AQR405 IRQ pins polarity */
>   out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR405_IRQ_MASK);
> 
> + enable_watchdog_clk();
> +
>   return 0;
>  }
> 
> --
> 2.1.0.27.g96db324
> 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] armv8/fdt: add fixup_crypto_node

2016-04-11 Thread Alex Porosanu
For Qoriq PPC&ARM v7 platforms, the crypto node is being fixup'ed in order
to update the SEC internal version (aka SEC ERA). This patch adds the
same functionality to the ARMv8 SoCs.

Signed-off-by: Alex Porosanu 
---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 1e875c4..d17227a 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -20,6 +20,8 @@
 #ifdef CONFIG_MP
 #include 
 #endif
+#include 
+#include 
 
 int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc)
 {
@@ -75,6 +77,23 @@ void ft_fixup_cpu(void *blob)
 
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
+#ifdef CONFIG_FSL_LSCH2
+   struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+   unsigned int svr = in_be32(&gur->svr);
+
+   /* delete crypto node if not on an E-processor */
+   if (!IS_E_PROCESSOR(svr))
+   fdt_fixup_crypto_node(blob, 0);
+#if CONFIG_SYS_FSL_SEC_COMPAT >= 4
+   else {
+   ccsr_sec_t __iomem *sec;
+
+   sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR;
+   fdt_fixup_crypto_node(blob, sec_in32(&sec->secvid_ms));
+   }
+#endif
+#endif
+
 #ifdef CONFIG_MP
ft_fixup_cpu(blob);
 #endif
-- 
1.9.3

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


Re: [U-Boot] Ethernet via USB on Sinlinx SinA33

2016-04-11 Thread Quentin Schulz
Hi,

On 11/04/2016 13:07, Hans de Goede wrote:
> Hi,
> 
> On 11-04-16 12:25, Quentin Schulz wrote:
>> Hi,
>>
>> On 06/04/2016 17:24, Hans de Goede wrote:
>>> Hi,
>>>
>>> On 29-03-16 08:38, Quentin Schulz wrote:
 Hi,

 On 28/03/2016 14:56, Hans de Goede wrote:
> Hi,
>
> On 25-03-16 18:14, Quentin Schulz wrote:
>> Hi,
>>
>> I am trying to get Ethernet to work through the USB port of the
>> Sinlinx
>> SinA33 on U-Boot to use TFTP to get the kernel and dtb files.
>>
>> However, I am getting 'data abort' when using dhcp or tftp after
>> adding:
>> #define CONFIG_USB_HOST_ETHER
>> #define CONFIG_USB_ETHER_ASIX
>>
>> to include/configs/sunxi-common.h and checking CONFIG_USB_EHCI_HCD as
>> told in the documentation [1]
>>
>> I tested this configuration with the C.H.I.P. and it is working well.
>
> Are you perhaps building u-boot with gcc6 ? There are some known
> issues
> when building u-boot with gcc-6, which look pretty much like this.

 No, I'm building with gcc-5:
 $ arm-linux-gnueabihf-gcc --version
 arm-linux-gnueabihf-gcc (Ubuntu 5.2.1-22ubuntu1) 5.2.1 20151010

> Is the ethernet adapter connected to a regular usb host port, or to
> the otg port ?

 The Ethernet adapter is connected to the regular USB host port.
>>>
>>> So I've been debugging some armv7 cache issues lately and I've come
>>> up with the following fix:
>>>
>>> https://patchwork.ozlabs.org/patch/605967/
>>>
>>> This might very will fix your issue too. If not we're likely missing
>>> some cache flushing / invalidation in the usb driver for your usb
>>> host controller.
>>>
>>> Regards,
>>>
>>> Hans
>>
>> I actually tried uboot-sunxi repository (and then checked out on merge
>> commit in master for this repository) and it is working as expected: I
>> get Ethernet over USB.
>>
>> I tested with master (43d3fb5c0609a76409e7859a2a5800670c7b5bd2) and I
>> first get a reset of the board when starting USB (before I can enter
>> U-Boot command line) and then after the reboot, U-Boot hangs on starting
>> USB (still before the command line).
>>
>> I did a git bisect on master and it returned this commit:
>> http://git.denx.de/?p=u-boot.git;a=commit;h=3f9f8a5b83f8aec40c9f4ee496046a695e333c45
>>
> 
> Ah, that is fixed by this commit:
> 
> http://git.denx.de/?p=u-boot/u-boot-usb.git;a=commitdiff;h=cfb3f1cd0e022711d69ff040884357b8410865ef
> 
> 
> A pullreq for which was send this morning, so this should be fixed
> in master as soon as the u-boot-usb pull-req gets merged.
> 
> Regards,
> 
> Hans

Tested with the patch, the issue is solved. Thanks Hans!

Regards,

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


Re: [U-Boot] [PATCH v2] fastboot: OUT transaction length must be aligned to wMaxPacketSize

2016-04-11 Thread B, Ravi
Tom

> -Original Message-
> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Tom Rini
> Sent: Saturday, April 09, 2016 1:14 AM
> To: Sam Protsenko
> Cc: Marek Vasut; Steve Rae; U-Boot Mailing List
> Subject: Re: [U-Boot] [PATCH v2] fastboot: OUT transaction length must be 
> aligned to wMaxPacketSize

> On Fri, Apr 08, 2016 at 02:11:48AM +0300, Sam Protsenko wrote:
> [snip]
> > The only actual documentation for fastboot protocol I found is [1], 
> > and I don't see any mention of alignment there at all. So it wouldn't 
> > surprise me if that patch was done just out of of empiric 
> > observations. Which doesn't make it any less significant.
> [snip]
> > [1] 
> > https://android.googlesource.com/platform/system/core/+/master/fastboo
> > t/fastboot_protocol.txt

> So, the protocol says "Max packet size must be 64 bytes for full-speed,
> 512 bytes for high-speed and 1024 bytes for Super Speed USB.".  What are 
> wMaxPacketSize and ep->maxpacket in these cases, both the TI+DWC3 ones,
> Broadcom+DWC2 and if someone can grab one, TI+MUSB.  And then, what
> exactly does everyone failure logs look like, perhaps with some annotations 
> where it fails?

The maxpacket size is 512 bytes. As per TI+DWC3 specification, for device mode 
the TRB buffer size must be multiple of maximum endpoint packet size.
For usb data reception (including short transfer), the request buffer length 
shall be multiple of endpoint maxpacket size. 

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


Re: [U-Boot] Ethernet via USB on Sinlinx SinA33

2016-04-11 Thread Quentin Schulz
Hi,

On 06/04/2016 17:24, Hans de Goede wrote:
> Hi,
> 
> On 29-03-16 08:38, Quentin Schulz wrote:
>> Hi,
>>
>> On 28/03/2016 14:56, Hans de Goede wrote:
>>> Hi,
>>>
>>> On 25-03-16 18:14, Quentin Schulz wrote:
 Hi,

 I am trying to get Ethernet to work through the USB port of the Sinlinx
 SinA33 on U-Boot to use TFTP to get the kernel and dtb files.

 However, I am getting 'data abort' when using dhcp or tftp after
 adding:
 #define CONFIG_USB_HOST_ETHER
 #define CONFIG_USB_ETHER_ASIX

 to include/configs/sunxi-common.h and checking CONFIG_USB_EHCI_HCD as
 told in the documentation [1]

 I tested this configuration with the C.H.I.P. and it is working well.
>>>
>>> Are you perhaps building u-boot with gcc6 ? There are some known issues
>>> when building u-boot with gcc-6, which look pretty much like this.
>>
>> No, I'm building with gcc-5:
>> $ arm-linux-gnueabihf-gcc --version
>> arm-linux-gnueabihf-gcc (Ubuntu 5.2.1-22ubuntu1) 5.2.1 20151010
>>
>>> Is the ethernet adapter connected to a regular usb host port, or to
>>> the otg port ?
>>
>> The Ethernet adapter is connected to the regular USB host port.
> 
> So I've been debugging some armv7 cache issues lately and I've come
> up with the following fix:
> 
> https://patchwork.ozlabs.org/patch/605967/
> 
> This might very will fix your issue too. If not we're likely missing
> some cache flushing / invalidation in the usb driver for your usb
> host controller.
> 
> Regards,
> 
> Hans

I actually tried uboot-sunxi repository (and then checked out on merge
commit in master for this repository) and it is working as expected: I
get Ethernet over USB.

I tested with master (43d3fb5c0609a76409e7859a2a5800670c7b5bd2) and I
first get a reset of the board when starting USB (before I can enter
U-Boot command line) and then after the reboot, U-Boot hangs on starting
USB (still before the command line).

I did a git bisect on master and it returned this commit:
http://git.denx.de/?p=u-boot.git;a=commit;h=3f9f8a5b83f8aec40c9f4ee496046a695e333c45

Tell me if I can help in any way.

Regards,

Quentin

>>
>> Regards,
>>
>> Quentin
>>
>>
 Steps to reproduce:

 1) Add the following lines to include/configs/sunxi-common.h:

 #define CONFIG_USB_HOST_ETHER
 #define CONFIG_USB_ETHER_ASIX

 2) make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
 Sinlinx_SinA33_defconfig
 3) make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
 4) Check CONFIG_USB_EHCI_HC and save configuration
 5) make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j$(nproc)
 6) Prepare SDCard:
 sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
 7) Boot the board and run dhcp or tftp
 8) Get 'data abort' and board gets reset (ethact is also not defined)

 The log file is attached.

 Thank you,

 Quentin

 [1] https://github.com/lentinj/u-boot/blob/master/doc/README.usb#L132

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


Re: [U-Boot] [RFC 2/2] dm: i2c: Add driver for Cadence I2C IP

2016-04-11 Thread Michal Simek
Hi Heiko,

On 4.1.2016 08:15, Heiko Schocher wrote:
> Hello Moritz,
> 
> Am 28.12.2015 um 18:47 schrieb Moritz Fischer:
>> This is a possible drop in replacement for drivers/i2c/zynq-i2c.c
>>
>> Since this is cadence IP it has been renamed to cdns-i2c,
>> to make sense with the compatible string.
>>
>> Signed-off-by: Moritz Fischer 
>> ---
>>   drivers/i2c/Kconfig|   7 +
>>   drivers/i2c/Makefile   |   1 +
>>   drivers/i2c/i2c-cdns.c | 339
>> +
>>   3 files changed, 347 insertions(+)
>>   create mode 100644 drivers/i2c/i2c-cdns.c
> 
> Hmm.. I di not see the remove of "drivers/i2c/zynq-i2c.c" as
> you wrote it is a replacement for it ... Can you do this, and
> of course adapt the boards which use this driver?

I would like to start to use this driver for ZynqMP and use old driver
for Zynq because there eeprom hasn't been moved.

I found just one problem regarding reading addr from DT which I have fixed.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




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


[U-Boot] [PATCH v2 1/2] i2c: Describe Cadence I2C devicetree bindings

2016-04-11 Thread Michal Simek
From: Moritz Fischer 

Signed-off-by: Moritz Fischer 
Signed-off-by: Michal Simek 
---

Changes in v2: None

 doc/device-tree-bindings/i2c/i2c-cdns.txt | 20 
 1 file changed, 20 insertions(+)
 create mode 100644 doc/device-tree-bindings/i2c/i2c-cdns.txt

diff --git a/doc/device-tree-bindings/i2c/i2c-cdns.txt 
b/doc/device-tree-bindings/i2c/i2c-cdns.txt
new file mode 100644
index ..202e0b762666
--- /dev/null
+++ b/doc/device-tree-bindings/i2c/i2c-cdns.txt
@@ -0,0 +1,20 @@
+Cadence I2C controller Device Tree Bindings
+---
+
+Required properties:
+- compatible   : Should be "cdns,i2c-r1p10" or "xlnx,zynq-spi-r1p10".
+- reg  : Physical base address and size of I2C registers map.
+- interrupts   : Property with a value describing the interrupt
+ number.
+- interrupt-parent : Must be core interrupt controller
+- clocks   : Clock phandles (see clock bindings for details).
+
+Example:
+   i2c0: i2c@e0004000 {
+   compatible = "cdns,i2c-r1p10";
+   reg = <0xe0004000 0x1000>;
+   clocks = <&clkc 38>;
+   interrupts = <0 25 4>;
+   interrupt-parent = <&intc>;
+   status = "disabled";
+   };
-- 
1.9.1

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


[U-Boot] [PATCH v2 2/2] dm: i2c: Add driver for Cadence I2C IP

2016-04-11 Thread Michal Simek
From: Moritz Fischer 

This is a possible drop in replacement for drivers/i2c/zynq-i2c.c

Since this is cadence IP it has been renamed to cdns-i2c,
to make sense with the compatible string.

Signed-off-by: Moritz Fischer 
Signed-off-by: Michal Simek 
---

Changes in v2:
- Use dev_get_addr for reading address.

This driver will be used by ZynqMP. Zynq will use zynq-i2c driver
till eeprom interface is fixed but this driver can be also enabled for
Zynq targets.

---
 drivers/i2c/Kconfig|   7 ++
 drivers/i2c/Makefile   |   1 +
 drivers/i2c/i2c-cdns.c | 335 +
 3 files changed, 343 insertions(+)
 create mode 100644 drivers/i2c/i2c-cdns.c

diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 46b83e789418..9324c6c9e5f3 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -58,6 +58,13 @@ config DM_I2C_GPIO
  bindings are supported.
  Binding info: doc/device-tree-bindings/i2c/i2c-gpio.txt
 
+config SYS_I2C_CADENCE
+   tristate "Cadence I2C Controller"
+   depends on DM_I2C && (ARCH_ZYNQ || ARM64)
+   help
+ Say yes here to select Cadence I2C Host Controller. This controller is
+ e.g. used by Xilinx Zynq.
+
 config SYS_I2C_INTEL
bool "Intel I2C/SMBUS driver"
depends on DM_I2C
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index c75c5793efe2..167424db9820 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o
 obj-$(CONFIG_TSI108_I2C) += tsi108_i2c.o
 obj-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o
 obj-$(CONFIG_SYS_I2C) += i2c_core.o
+obj-$(CONFIG_SYS_I2C_CADENCE) += i2c-cdns.o
 obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o
 obj-$(CONFIG_SYS_I2C_DW) += designware_i2c.o
 obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o
diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c
new file mode 100644
index ..909cea24182e
--- /dev/null
+++ b/drivers/i2c/i2c-cdns.c
@@ -0,0 +1,335 @@
+/*
+ * Copyright (C) 2015 Moritz Fischer 
+ * IP from Cadence (ID T-CS-PE-0007-100, Version R1p10f2)
+ *
+ * This file is based on: drivers/i2c/zynq_i2c.c,
+ * with added driver-model support and code cleanup.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* i2c register set */
+struct cdns_i2c_regs {
+   u32 control;
+   u32 status;
+   u32 address;
+   u32 data;
+   u32 interrupt_status;
+   u32 transfer_size;
+   u32 slave_mon_pause;
+   u32 time_out;
+   u32 interrupt_mask;
+   u32 interrupt_enable;
+   u32 interrupt_disable;
+};
+
+/* Control register fields */
+#define CDNS_I2C_CONTROL_RW0x0001
+#define CDNS_I2C_CONTROL_MS0x0002
+#define CDNS_I2C_CONTROL_NEA   0x0004
+#define CDNS_I2C_CONTROL_ACKEN 0x0008
+#define CDNS_I2C_CONTROL_HOLD  0x0010
+#define CDNS_I2C_CONTROL_SLVMON0x0020
+#define CDNS_I2C_CONTROL_CLR_FIFO  0x0040
+#define CDNS_I2C_CONTROL_DIV_B_SHIFT   8
+#define CDNS_I2C_CONTROL_DIV_B_MASK0x3F00
+#define CDNS_I2C_CONTROL_DIV_A_SHIFT   14
+#define CDNS_I2C_CONTROL_DIV_A_MASK0xC000
+
+/* Status register values */
+#define CDNS_I2C_STATUS_RXDV   0x0020
+#define CDNS_I2C_STATUS_TXDV   0x0040
+#define CDNS_I2C_STATUS_RXOVF  0x0080
+#define CDNS_I2C_STATUS_BA 0x0100
+
+/* Interrupt register fields */
+#define CDNS_I2C_INTERRUPT_COMP0x0001
+#define CDNS_I2C_INTERRUPT_DATA0x0002
+#define CDNS_I2C_INTERRUPT_NACK0x0004
+#define CDNS_I2C_INTERRUPT_TO  0x0008
+#define CDNS_I2C_INTERRUPT_SLVRDY  0x0010
+#define CDNS_I2C_INTERRUPT_RXOVF   0x0020
+#define CDNS_I2C_INTERRUPT_TXOVF   0x0040
+#define CDNS_I2C_INTERRUPT_RXUNF   0x0080
+#define CDNS_I2C_INTERRUPT_ARBLOST 0x0200
+
+#define CDNS_I2C_FIFO_DEPTH16
+#define CDNS_I2C_TRANSFER_SIZE_MAX 255 /* Controller transfer limit */
+
+#ifdef DEBUG
+static void cdns_i2c_debug_status(struct cdns_i2c_regs *cdns_i2c)
+{
+   int int_status;
+   int status;
+   int_status = readl(&cdns_i2c->interrupt_status);
+
+   status = readl(&cdns_i2c->status);
+   if (int_status || status) {
+   debug("Status: ");
+   if (int_status & CDNS_I2C_INTERRUPT_COMP)
+   debug("COMP ");
+   if (int_status & CDNS_I2C_INTERRUPT_DATA)
+   debug("DATA ");
+   if (int_status & CDNS_I2C_INTERRUPT_NACK)
+   debug("NACK ");
+   if (int_status & CDNS_I2C_INTERRUPT_TO)
+   debug("TO ");
+   if (int_status & CDNS_I2C_INTERRUPT_SLVRDY)
+   debug("SLVRDY ");
+   if (int_status & CDNS_I2C_INTERRU

Re: [U-Boot] [PATCH 0/8] usb: Move DWC3 and some gadget options to Kconfig

2016-04-11 Thread Sam Protsenko
On Mon, Apr 11, 2016 at 2:24 PM, Lukasz Majewski  wrote:
> Hi Semen,
>
>>
>> Hi All,
>>
>> This patch series move next options to Kconfigs/defconfigs:
>>  - CONFIG_USB_DWC3*
>>  - CONFIG_USB_GADGET_VBUS_DRAW
>>  - CONFIG_USB_GADGET_DUALSPEED (partially, only for DWC3 platforms
>> for now)
>>  - CONFIG_USB_GADGET_DOWNLOAD
>>  - CONFIG_G_DNL_*
>>
>> All defconfig files were post-processed via "make savedefconfig" rule
>> to keep correct order of options in defconfigs.
>>
>> The whole series was tested using buildman tool for all arm boards.
>>
>
> Acked-by: Lukasz Majewski 
> Tested-by: Lukasz Majewski 
>
> Test HW: Odroid XU3 with test/py for UMS, DFU
>
> Applied to u-boot-dfu branch

Hi Lukasz,

I mentioned in reply for some other patch from this series that I'm
gonna send v3 of the whole series. It took so long because I was
testing it with buildman and fixing issues. So right now I have the
whole series reworked w.r.t. all comments made to patches from this
series and gonna resend it. Sorry I haven't mentioned that in this
mail. So can you please revert series and apply new one once I sent
it?

>
>
> --
> Best regards,
>
> Lukasz Majewski
>
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [uboot] [PATCH v5 4/7] net: phy: ti: Allow the driver to be more configurable

2016-04-11 Thread Michal Simek
On 11.4.2016 14:18, Dan Murphy wrote:
> Not all devices use the same internal delay or fifo depth.
> Add the ability to set the internal delay for rx or tx and the
> fifo depth via the devicetree.  If the value is not set in the
> devicetree then set the delay to the default.
> 
> If devicetree is not used then use the default defines within the
> driver.
> 
> Signed-off-by: Dan Murphy 
> ---
> 
> v5 - Removed extra space and renamed the bindings per the bindings document - 
> https://patchwork.ozlabs.org/patch/608087/
> 
>  drivers/net/phy/ti.c | 85 
> +---
>  1 file changed, 75 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
> index 937426b..b8f3ebd 100644
> --- a/drivers/net/phy/ti.c
> +++ b/drivers/net/phy/ti.c
> @@ -6,6 +6,14 @@
>   */
>  #include 
>  #include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
>  
>  /* TI DP83867 */
>  #define DP83867_DEVADDR  0x1f
> @@ -71,6 +79,17 @@
>  #define MII_MMD_CTRL_INCR_RDWT   0x8000 /* post increment on reads & 
> writes */
>  #define MII_MMD_CTRL_INCR_ON_WT  0xC000 /* post increment on writes only 
> */
>  
> +/* User setting - can be taken from DTS */
> +#define DEFAULT_RX_ID_DELAY  DP83867_RGMIIDCTL_2_25_NS
> +#define DEFAULT_TX_ID_DELAY  DP83867_RGMIIDCTL_2_75_NS
> +#define DEFAULT_FIFO_DEPTH   DP83867_PHYCR_FIFO_DEPTH_4_B_NIB
> +
> +struct dp83867_private {
> + int rx_id_delay;
> + int tx_id_delay;
> + int fifo_depth;
> +};
> +
>  /**
>   * phy_read_mmd_indirect - reads data from the MMD registers
>   * @phydev: The PHY device bus
> @@ -148,16 +167,58 @@ static inline bool phy_interface_is_rgmii(struct 
> phy_device *phydev)
>   phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
>  }
>  
> -/* User setting - can be taken from DTS */
> -#define RX_ID_DELAY  8
> -#define TX_ID_DELAY  0xa
> -#define FIFO_DEPTH   1
> +#if defined(CONFIG_DM_ETH)
> +/**
> + * dp83867_data_init - Convenience function for setting PHY specific data
> + *
> + * @phydev: the phy_device struct
> + */
> +static int dp83867_of_init(struct phy_device *phydev)
> +{
> + struct dp83867_private *dp83867 = phydev->priv;
> + struct udevice *dev = phydev->dev;
> +
> + dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
> +  "ti,rx-internal-delay", -1);
> +
> + dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
> +  "ti,tx-internal-delay", -1);
> +
> + dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
> +  "ti,fifo-depth", -1);
> +
> + return 0;
> +}
> +#else
> +static int dp83867_of_init(struct phy_device *phydev)
> +{
> + dp83867->rx_id_delay = DEFAULT_RX_ID_DELAY;
> + dp83867->tx_id_delay = DEFAULT_TX_ID_DELAY;
> + dp83867->fifo_depth = DEFAULT_FIFO_DEPTH;
> +
> + return 0;
> +}
> +#endif
>  
>  static int dp83867_config(struct phy_device *phydev)
>  {
> + struct dp83867_private *dp83867;
>   unsigned int val, delay, cfg2;
>   int ret;
>  
> + if (!phydev->priv) {
> + dp83867 = kzalloc(sizeof(*dp83867), GFP_KERNEL);
> + if (!dp83867)
> + return -ENOMEM;
> +
> + phydev->priv = dp83867;
> + ret = dp83867_of_init(phydev);
> + if (ret)
> + goto err_out;
> + } else {
> + dp83867 = (struct dp83867_private *)phydev->priv;
> + }
> +
>   /* Restart the PHY.  */
>   val = phy_read(phydev, MDIO_DEVAD_NONE, DP83867_CTRL);
>   phy_write(phydev, MDIO_DEVAD_NONE, DP83867_CTRL,
> @@ -166,9 +227,9 @@ static int dp83867_config(struct phy_device *phydev)
>   if (phy_interface_is_rgmii(phydev)) {
>   ret = phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL,
>   (DP83867_MDI_CROSSOVER_AUTO << DP83867_MDI_CROSSOVER) |
> - (FIFO_DEPTH << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
> + (dp83867->fifo_depth << 
> DP83867_PHYCR_FIFO_DEPTH_SHIFT));
>   if (ret)
> - return ret;
> + goto err_out;
>   } else {
>   phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
> (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
> @@ -189,8 +250,8 @@ static int dp83867_config(struct phy_device *phydev)
> DP83867_PHYCTRL_SGMIIEN |
> (DP83867_MDI_CROSSOVER_MDIX <<
> DP83867_MDI_CROSSOVER) |
> -   (FIFO_DEPTH << DP83867_PHYCTRL_RXFIFO_SHIFT) |
> -   (FIFO_DEPTH  << DP83867_PHYCTRL_TXFIFO_SHIFT));
> +   (dp83867->fifo_depth << DP83867_PHYCTRL_RXFIFO_SHIFT) 
> |
> +   (dp83867->fifo_depth << 
> DP83867_PHYCTRL_TXFIFO_SHIFT));
>

Re: [U-Boot] [uboot] [PATCH v5 2/7] net: zynq_gem: Add the passing of the phy-handle node

2016-04-11 Thread Michal Simek
On 11.4.2016 14:18, Dan Murphy wrote:
> Add the ability to pass the phy-handle node offset
> to the phy driver.  This allows the phy driver
> to access the DT subnode's data and parse accordingly.
> 
> Signed-off-by: Dan Murphy 
> ---
> 
> v5 - Removed unused variable and fixed checkpatch warning - 
> https://patchwork.ozlabs.org/patch/608083/
> 
>  drivers/net/zynq_gem.c | 15 ++-
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index aec8077..f9b22c4 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -179,6 +179,7 @@ struct zynq_gem_priv {
>   struct zynq_gem_regs *iobase;
>   phy_interface_t interface;
>   struct phy_device *phydev;
> + int phy_of_handle;
>   struct mii_dev *bus;
>  };
>  
> @@ -352,6 +353,10 @@ static int zynq_phy_init(struct udevice *dev)
>   priv->phydev->supported = supported | ADVERTISED_Pause |
> ADVERTISED_Asym_Pause;
>   priv->phydev->advertising = priv->phydev->supported;
> +
> + if (priv->phy_of_handle > 0)
> + priv->phydev->dev->of_offset = priv->phy_of_handle;
> +
>   phy_config(priv->phydev);
>  
>   return 0;
> @@ -675,7 +680,6 @@ static int zynq_gem_ofdata_to_platdata(struct udevice 
> *dev)
>  {
>   struct eth_pdata *pdata = dev_get_platdata(dev);
>   struct zynq_gem_priv *priv = dev_get_priv(dev);
> - int offset = 0;
>   const char *phy_mode;
>  
>   pdata->iobase = (phys_addr_t)dev_get_addr(dev);
> @@ -684,10 +688,11 @@ static int zynq_gem_ofdata_to_platdata(struct udevice 
> *dev)
>   priv->emio = 0;
>   priv->phyaddr = -1;
>  
> - offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
> -"phy-handle");
> - if (offset > 0)
> - priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
> + priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob,
> + dev->of_offset, "phy-handle");
> + if (priv->phy_of_handle > 0)
> + priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
> + priv->phy_of_handle, "reg", -1);
>  
>   phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
>   if (phy_mode)
> 

Tested-by: Michal Simek 

Thanks,
Michal

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


Re: [U-Boot] [uboot] [PATCH v5 5/7] net: phy: Move is_rgmii helper to phy.h

2016-04-11 Thread Michal Simek
On 11.4.2016 14:18, Dan Murphy wrote:
> Move the phy_interface_is_rgmii to the phy.h
> file for all phy's to be able to use the API.
> 
> This now aligns with the Linux kernel based on
> commit e463d88c36d42211aa72ed76d32fb8bf37820ef1
> 
> Signed-off-by: Dan Murphy 
> ---
> 
> v5 - No change
> 
>  drivers/net/phy/ti.c | 11 ---
>  include/phy.h| 11 +++
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 

Any particular reason why you haven't added
Reviewed-by: tags you have already got from me and someone else?

Thanks,
Michal

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


Re: [U-Boot] [PATCH 0/8] usb: Move DWC3 and some gadget options to Kconfig

2016-04-11 Thread Lukasz Majewski
Hi Sam,

> On Mon, Apr 11, 2016 at 2:24 PM, Lukasz Majewski
>  wrote:
> > Hi Semen,
> >
> >>
> >> Hi All,
> >>
> >> This patch series move next options to Kconfigs/defconfigs:
> >>  - CONFIG_USB_DWC3*
> >>  - CONFIG_USB_GADGET_VBUS_DRAW
> >>  - CONFIG_USB_GADGET_DUALSPEED (partially, only for DWC3 platforms
> >> for now)
> >>  - CONFIG_USB_GADGET_DOWNLOAD
> >>  - CONFIG_G_DNL_*
> >>
> >> All defconfig files were post-processed via "make savedefconfig"
> >> rule to keep correct order of options in defconfigs.
> >>
> >> The whole series was tested using buildman tool for all arm boards.
> >>
> >
> > Acked-by: Lukasz Majewski 
> > Tested-by: Lukasz Majewski 
> >
> > Test HW: Odroid XU3 with test/py for UMS, DFU
> >
> > Applied to u-boot-dfu branch
> 
> Hi Lukasz,
> 
> I mentioned in reply for some other patch from this series that I'm
> gonna send v3 of the whole series. It took so long because I was
> testing it with buildman and fixing issues. So right now I have the
> whole series reworked w.r.t. all comments made to patches from this
> series and gonna resend it. Sorry I haven't mentioned that in this
> mail. So can you please revert series and apply new one once I sent
> it?

It is not a problem.

Only please add me to v3's CC and I will update the patch on my
u-boot-dfu tree.

> 
> >
> >
> > --
> > Best regards,
> >
> > Lukasz Majewski
> >
> > Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
> 



-- 
Best regards,

Lukasz Majewski

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


[U-Boot] [PATCH 1/8] iso: Make little endian and 64bit safe

2016-04-11 Thread Alexander Graf
The iso partition table implementation has a few endian and 64bit
problems. Clean it up a bit to become endian and bitness safe.

Signed-off-by: Alexander Graf 
---
 disk/part_iso.c | 10 --
 disk/part_iso.h | 40 
 2 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/disk/part_iso.c b/disk/part_iso.c
index 2114faf..b7a5381 100644
--- a/disk/part_iso.c
+++ b/disk/part_iso.c
@@ -58,11 +58,9 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int 
part_num,
ppr->stand_ident, dev_desc->devnum, part_num);
return (-1);
}
-   lastsect= ((ppr->firstsek_LEpathtab1_LE & 0x00ff)<<24) +
- ((ppr->firstsek_LEpathtab1_LE & 0xff00)<< 8) +
- ((ppr->firstsek_LEpathtab1_LE & 0x00ff)>> 8) +
- ((ppr->firstsek_LEpathtab1_LE & 0xff00)>>24) ;
-   info->blksz=ppr->secsize_BE; /* assuming same block size for all 
entries */
+   lastsect = le32_to_cpu(ppr->firstsek_LEpathtab1_LE);
+   /* assuming same block size for all entries */
+   info->blksz = be16_to_cpu(ppr->secsize_BE);
PRINTF(" Lastsect:%08lx\n",lastsect);
for(i=blkaddr;i>8);
+   chksum += le16_to_cpu(chksumbuf[i]);
if(chksum!=0) {
if(verb)
printf("** Checksum Error in booting catalog validation 
entry on %d:%d **\n",
diff --git a/disk/part_iso.h b/disk/part_iso.h
index dace0f8..045784f 100644
--- a/disk/part_iso.h
+++ b/disk/part_iso.h
@@ -29,8 +29,8 @@ typedef struct iso_pri_rec {
charsysid[32];  /* 
system Identifier */
charvolid[32];  /* 
volume Identifier */
unsigned char zeros1[8];/* unused */
-   unsigned long volsiz_LE;/* volume size Little Endian */
-   unsigned long volsiz_BE;/* volume size Big Endian */
+   unsigned int volsiz_LE; /* volume size Little Endian */
+   unsigned int volsiz_BE; /* volume size Big Endian */
unsigned char zeros2[32];   /* unused */
unsigned short setsize_LE;  /* volume set size LE */
unsigned short setsize_BE;  /* volume set size BE */
@@ -38,12 +38,12 @@ typedef struct iso_pri_rec {
unsigned short seqnum_BE;   /* volume sequence number BE */
unsigned short secsize_LE;  /* sector size LE */
unsigned short secsize_BE;  /* sector size BE */
-   unsigned long pathtablen_LE;/* Path Table size LE */
-   unsigned long pathtablen_BE;/* Path Table size BE */
-   unsigned long firstsek_LEpathtab1_LE; /* location of first occurrence 
of little endian type path table */
-   unsigned long firstsek_LEpathtab2_LE; /* location of optional 
occurrence of little endian type path table */
-   unsigned long firstsek_BEpathtab1_BE; /* location of first occurrence 
of big endian type path table */
-   unsigned long firstsek_BEpathtab2_BE; /* location of optional 
occurrence of big endian type path table */
+   unsigned int pathtablen_LE;/* Path Table size LE */
+   unsigned int pathtablen_BE;/* Path Table size BE */
+   unsigned int firstsek_LEpathtab1_LE; /* location of first occurrence of 
little endian type path table */
+   unsigned int firstsek_LEpathtab2_LE; /* location of optional occurrence 
of little endian type path table */
+   unsigned int firstsek_BEpathtab1_BE; /* location of first occurrence of 
big endian type path table */
+   unsigned int firstsek_BEpathtab2_BE; /* location of optional occurrence 
of big endian type path table */
unsigned char rootdir[34];  /* directory record for root dir */
charvolsetid[128];/* Volume set 
identifier */
charpubid[128]; /* 
Publisher identifier */
@@ -67,8 +67,8 @@ typedef struct iso_sup_rec {
charsysid[32];  /* 
system Identifier */
charvolid[32];  /* 
volume Identifier */
unsigned char zeros1[8];/* unused */
-   unsigned long volsiz_LE;/* volume size Little Endian */
-   unsigned long volsiz_BE;/* volume size Big Endian */
+   unsigned int volsiz_LE; /* volume size Little Endian */
+   unsigned int volsiz_BE; /* volume size Big Endian */
unsigned char escapeseq[32];/* Escape sequences */
unsigned short setsize_LE;  /* volume set size LE */
unsigned short setsize_BE;  /* volume set size BE */
@@ -76,12 +76,12 @@ typedef struct iso_sup_rec {
unsigned short seqnum_BE;   /* volume sequence number BE */
unsigned short secsize_LE;  /* s

[U-Boot] [PATCH 7/8] efi_loader: Increase path string to 32 characters

2016-04-11 Thread Alexander Graf
Whenever we want to tell our payload about a path, we limit ourselves
to a reasonable amount of characters. So far we only passed in device
names - exceeding 16 chars was unlikely there.

However by now we also pass real file path information, so let's increase
the limit to 32 characters. That way common paths like "boot/efi/bootaa64.efi"
fit just fine.

Signed-off-by: Alexander Graf 
---
 cmd/bootefi.c | 2 +-
 include/efi_api.h | 2 +-
 lib/efi_loader/efi_disk.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index adcf645..f502996 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -208,7 +208,7 @@ U_BOOT_CMD(
 void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
 {
__maybe_unused struct blk_desc *desc;
-   char devname[16] = { 0 }; /* dp->str is u16[16] long */
+   char devname[32] = { 0 }; /* dp->str is u16[32] long */
char *colon;
 
/* Assemble the condensed device name we use in efi_disk.c */
diff --git a/include/efi_api.h b/include/efi_api.h
index 6960448..51d7586 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -259,7 +259,7 @@ struct efi_device_path {
 
 struct efi_device_path_file_path {
struct efi_device_path dp;
-   u16 str[16];
+   u16 str[32];
 };
 
 #define BLOCK_IO_GUID \
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index b3d56a8..28e5b7f 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -194,7 +194,7 @@ static int efi_disk_create_eltorito(struct blk_desc *desc,
 {
int disks = 0;
 #ifdef CONFIG_ISO_PARTITION
-   char devname[16] = { 0 }; /* dp->str is u16[16] long */
+   char devname[32] = { 0 }; /* dp->str is u16[32] long */
disk_partition_t info;
int part = 1;
 
@@ -231,7 +231,7 @@ int efi_disk_register(void)
printf("Scanning disks on %s...\n", cur_drvr->name);
for (i = 0; i < 4; i++) {
struct blk_desc *desc;
-   char devname[16] = { 0 }; /* dp->str is u16[16] long */
+   char devname[32] = { 0 }; /* dp->str is u16[32] long */
 
desc = blk_get_dev(cur_drvr->name, i);
if (!desc)
-- 
1.8.5.6

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


[U-Boot] [PATCH 2/8] iso: Start with partition 1

2016-04-11 Thread Alexander Graf
The generic partition code treats partition 0 as "whole disk". So
we should start with partition 1 as the first partition in the iso
partition table.

Signed-off-by: Alexander Graf 
---
 disk/part_iso.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/disk/part_iso.c b/disk/part_iso.c
index b7a5381..5adb349 100644
--- a/disk/part_iso.c
+++ b/disk/part_iso.c
@@ -115,7 +115,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int 
part_num,
}
 #endif
/* the validation entry seems to be ok, now search the "partition" */
-   entry_num=0;
+   entry_num=1;
offset=0x20;
strcpy((char *)info->type, "U-Boot");
switch(dev_desc->if_type) {
@@ -225,7 +225,7 @@ static int part_test_iso(struct blk_desc *dev_desc)
 {
disk_partition_t info;
 
-   return part_get_info_iso_verb(dev_desc, 0, &info, 0);
+   return part_get_info_iso_verb(dev_desc, 1, &info, 1);
 }
 
 U_BOOT_PART_TYPE(iso) = {
-- 
1.8.5.6

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


[U-Boot] [PATCH 0/8] efi_loader: Support loading from El Torito isos

2016-04-11 Thread Alexander Graf
Some distributions still provide .iso files for installation media.

To give us greatest flexibility, this patch set adds support for
El Torito booting with EFI payloads.

Please consider for 2016.05 still.


Thanks,

Alex

Alexander Graf (8):
  iso: Make little endian and 64bit safe
  iso: Start with partition 1
  iso: Allow 512 byte sector size
  efi_loader: Split drive add into function
  efi_loader: Add el torito support
  efi_loader: Pass file path to payload
  efi_loader: Increase path string to 32 characters
  distro: Enable iso partition code

 cmd/bootefi.c|  48 +---
 cmd/fs.c |   3 +-
 disk/part_iso.c  |  50 +++-
 disk/part_iso.h  |  40 ++---
 include/config_distro_defaults.h |   1 +
 include/efi_api.h|   2 +-
 include/efi_loader.h |   5 +-
 lib/efi_loader/efi_disk.c| 121 +++
 8 files changed, 187 insertions(+), 83 deletions(-)

-- 
1.8.5.6

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


[U-Boot] [PATCH 3/8] iso: Allow 512 byte sector size

2016-04-11 Thread Alexander Graf
Real CD-ROMs are pretty obsolete these days. Usually people still keep
iso files around, but just put them on USB sticks or SD cards and expect
them to "just work".

To support this use case with El Torito images, add support for 512 byte
sector size to the iso parsing code.

Signed-off-by: Alexander Graf 
---
 disk/part_iso.c | 36 +++-
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/disk/part_iso.c b/disk/part_iso.c
index 5adb349..9f5c50c 100644
--- a/disk/part_iso.c
+++ b/disk/part_iso.c
@@ -26,6 +26,25 @@
 
 static unsigned char tmpbuf[CD_SECTSIZE];
 
+unsigned long iso_dread(struct blk_desc *block_dev, lbaint_t start,
+lbaint_t blkcnt, void *buffer)
+{
+   unsigned long ret;
+
+   if (block_dev->blksz == 512) {
+   /* Convert from 2048 to 512 sector size */
+   start *= 4;
+   blkcnt *= 4;
+   }
+
+   ret = blk_dread(block_dev, start, blkcnt, buffer);
+
+   if (block_dev->blksz == 512)
+   ret /= 4;
+
+   return ret;
+}
+
 /* only boot records will be listed as valid partitions */
 int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
   disk_partition_t *info, int verb)
@@ -39,12 +58,12 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int 
part_num,
iso_val_entry_t *pve = (iso_val_entry_t *)tmpbuf;
iso_init_def_entry_t *pide;
 
-   if (dev_desc->blksz != CD_SECTSIZE)
+   if ((dev_desc->blksz != CD_SECTSIZE) && (dev_desc->blksz != 512))
return -1;
 
/* the first sector (sector 0x10) must be a primary volume desc */
blkaddr=PVD_OFFSET;
-   if (blk_dread(dev_desc, PVD_OFFSET, 1, (ulong *)tmpbuf) != 1)
+   if (iso_dread(dev_desc, PVD_OFFSET, 1, (ulong *)tmpbuf) != 1)
return -1;
if(ppr->desctype!=0x01) {
if(verb)
@@ -64,7 +83,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int 
part_num,
PRINTF(" Lastsect:%08lx\n",lastsect);
for(i=blkaddr;idesctype==0x00)
break; /* boot entry found */
@@ -84,7 +103,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int 
part_num,
}
bootaddr = get_unaligned_le32(pbr->pointer);
PRINTF(" Boot Entry at: %08lX\n",bootaddr);
-   if (blk_dread(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) {
+   if (iso_dread(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) {
if(verb)
printf ("** Can't read Boot Entry at %lX on %d:%d **\n",
bootaddr, dev_desc->devnum, part_num);
@@ -192,7 +211,14 @@ found:
}
newblkaddr = get_unaligned_le32(pide->rel_block_addr);
info->start=newblkaddr;
-   PRINTF(" part %d found @ %lx size 
%lx\n",part_num,newblkaddr,info->size);
+
+   if (dev_desc->blksz == 512) {
+   info->size *= 4;
+   info->start *= 4;
+   info->blksz = 512;
+   }
+
+   PRINTF(" part %d found @ %lx size 
%lx\n",part_num,info->start,info->size);
return 0;
 }
 
-- 
1.8.5.6

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


[U-Boot] [PATCH 6/8] efi_loader: Pass file path to payload

2016-04-11 Thread Alexander Graf
The payload gets information on where it got loaded from. This includes
the device as well as file path.

So far we've treated both as the same thing and always gave it the device
name. However, in some situations grub2 actually wants to find its loading
path to find its configuration file.

So let's split the two semantically separte bits into separate structs and
pass the loaded file name into our payload when we load it using "load".

Signed-off-by: Alexander Graf 
---
 cmd/bootefi.c| 32 +---
 cmd/fs.c |  3 ++-
 include/efi_loader.h |  5 +++--
 3 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 0d09aa1..adcf645 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -34,17 +34,30 @@ static struct efi_device_path_file_path 
bootefi_image_path[] = {
}
 };
 
+static struct efi_device_path_file_path bootefi_device_path[] = {
+   {
+   .dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE,
+   .dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH,
+   .dp.length = sizeof(bootefi_image_path[0]),
+   .str = { 'b','o','o','t','e','f','i' },
+   }, {
+   .dp.type = DEVICE_PATH_TYPE_END,
+   .dp.sub_type = DEVICE_PATH_SUB_TYPE_END,
+   .dp.length = sizeof(bootefi_image_path[0]),
+   }
+};
+
 static efi_status_t bootefi_open_dp(void *handle, efi_guid_t *protocol,
void **protocol_interface, void *agent_handle,
void *controller_handle, uint32_t attributes)
 {
-   *protocol_interface = bootefi_image_path;
+   *protocol_interface = bootefi_device_path;
return EFI_SUCCESS;
 }
 
 /* The EFI loaded_image interface for the image executed via "bootefi" */
 static struct efi_loaded_image loaded_image_info = {
-   .device_handle = bootefi_image_path,
+   .device_handle = bootefi_device_path,
.file_path = bootefi_image_path,
 };
 
@@ -63,7 +76,7 @@ static struct efi_object loaded_image_info_obj = {
{
/*
 * When asking for the device path interface, return
-* bootefi_image_path
+* bootefi_device_path
 */
.guid = &efi_guid_device_path,
.open = &bootefi_open_dp,
@@ -73,11 +86,11 @@ static struct efi_object loaded_image_info_obj = {
 
 /* The EFI object struct for the device the "bootefi" image was loaded from */
 static struct efi_object bootefi_device_obj = {
-   .handle = bootefi_image_path,
+   .handle = bootefi_device_path,
.protocols = {
{
/* When asking for the device path interface, return
-* bootefi_image_path */
+* bootefi_device_path */
.guid = &efi_guid_device_path,
.open = &bootefi_open_dp,
}
@@ -192,7 +205,7 @@ U_BOOT_CMD(
bootefi_help_text
 );
 
-void efi_set_bootdev(const char *dev, const char *devnr)
+void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
 {
__maybe_unused struct blk_desc *desc;
char devname[16] = { 0 }; /* dp->str is u16[16] long */
@@ -217,7 +230,12 @@ void efi_set_bootdev(const char *dev, const char *devnr)
if (colon)
*colon = '\0';
 
-   /* Patch the bootefi_image_path to the target device */
+   /* Patch bootefi_device_path to the target device */
+   memset(bootefi_device_path[0].str, 0, 
sizeof(bootefi_device_path[0].str));
+   ascii2unicode(bootefi_device_path[0].str, devname);
+
+   /* Patch bootefi_image_path to the target file path */
memset(bootefi_image_path[0].str, 0, sizeof(bootefi_image_path[0].str));
+   snprintf(devname, sizeof(devname), "%s", path);
ascii2unicode(bootefi_image_path[0].str, devname);
 }
diff --git a/cmd/fs.c b/cmd/fs.c
index be8f289..abfe5be 100644
--- a/cmd/fs.c
+++ b/cmd/fs.c
@@ -27,7 +27,8 @@ U_BOOT_CMD(
 static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
 {
-   efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "");
+   efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
+   (argc > 4) ? argv[4] : "");
return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY);
 }
 
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 9f61fc4..88b8149 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -112,7 +112,7 @@ efi_status_t efi_exit_func(efi_status_t ret);
 /* Call this to relocate the runtime section to an address space */
 void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map);
 /* Call this to set the current device name */
-void efi_set_bootdev(const char *dev, const char *devnr);
+void efi_set_bootdev(const char *dev, const char *devnr,

[U-Boot] [PATCH 5/8] efi_loader: Add el torito support

2016-04-11 Thread Alexander Graf
When loading an el torito image, uEFI exposes said image as a raw
block device to the payload.

Let's do the same by creating new block devices with added offsets for
the respective el torito partitions.

Signed-off-by: Alexander Graf 
---
 cmd/bootefi.c | 14 ++
 lib/efi_loader/efi_disk.c | 35 +++
 2 files changed, 49 insertions(+)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 3add632..0d09aa1 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -194,12 +194,26 @@ U_BOOT_CMD(
 
 void efi_set_bootdev(const char *dev, const char *devnr)
 {
+   __maybe_unused struct blk_desc *desc;
char devname[16] = { 0 }; /* dp->str is u16[16] long */
char *colon;
 
/* Assemble the condensed device name we use in efi_disk.c */
snprintf(devname, sizeof(devname), "%s%s", dev, devnr);
colon = strchr(devname, ':');
+
+#ifdef CONFIG_ISO_PARTITION
+   /* For ISOs we create partition block devices */
+   desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
+   if (desc && (desc->type != DEV_TYPE_UNKNOWN) &&
+   (desc->part_type == PART_TYPE_ISO)) {
+   if (!colon)
+   snprintf(devname, sizeof(devname), "%s%s:1", dev,
+devnr);
+   colon = NULL;
+   }
+#endif
+
if (colon)
*colon = '\0';
 
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index e30e728..b3d56a8 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -27,6 +27,8 @@ struct efi_disk_obj {
struct efi_block_io_media media;
/* EFI device path to this block device */
struct efi_device_path_file_path *dp;
+   /* Offset into disk for simple partitions */
+   lbaint_t offset;
 };
 
 static efi_status_t efi_disk_open_block(void *handle, efi_guid_t *protocol,
@@ -81,6 +83,7 @@ static efi_status_t EFIAPI efi_disk_rw_blocks(struct 
efi_block_io *this,
return EFI_EXIT(EFI_DEVICE_ERROR);
blksz = desc->blksz;
blocks = buffer_size / blksz;
+   lba += diskobj->offset;
 
 #ifdef DEBUG_EFI
printf("EFI: %s:%d blocks=%x lba=%"PRIx64" blksz=%x dir=%d\n", __func__,
@@ -159,6 +162,7 @@ static void efi_disk_add_dev(char *name,
diskobj->ops = block_io_disk_template;
diskobj->ifname = cur_drvr->name;
diskobj->dev_index = dev_index;
+   diskobj->offset = offset;
 
/* Fill in EFI IO Media info (for read/write callbacks) */
diskobj->media.removable_media = desc->removable;
@@ -184,6 +188,31 @@ static void efi_disk_add_dev(char *name,
list_add_tail(&diskobj->parent.link, &efi_obj_list);
 }
 
+static int efi_disk_create_eltorito(struct blk_desc *desc,
+   const struct block_drvr *cur_drvr,
+   int diskid)
+{
+   int disks = 0;
+#ifdef CONFIG_ISO_PARTITION
+   char devname[16] = { 0 }; /* dp->str is u16[16] long */
+   disk_partition_t info;
+   int part = 1;
+
+   if (desc->part_type != PART_TYPE_ISO)
+   return 0;
+
+   while (!part_get_info(desc, part, &info)) {
+   snprintf(devname, sizeof(devname), "%s%d:%d", cur_drvr->name,
+diskid, part);
+   efi_disk_add_dev(devname, cur_drvr, desc, diskid, info.start);
+   part++;
+   disks++;
+   }
+#endif
+
+   return disks;
+}
+
 /*
  * U-Boot doesn't have a list of all online disk devices. So when running our
  * EFI payload, we scan through all of the potentially available ones and
@@ -214,6 +243,12 @@ int efi_disk_register(void)
 cur_drvr->name, i);
efi_disk_add_dev(devname, cur_drvr, desc, i, 0);
disks++;
+
+   /*
+* El Torito images show up as block devices
+* in an EFI world, so let's create them here
+*/
+   disks += efi_disk_create_eltorito(desc, cur_drvr, i);
}
}
printf("Found %d disks\n", disks);
-- 
1.8.5.6

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


[U-Boot] [PATCH 4/8] efi_loader: Split drive add into function

2016-04-11 Thread Alexander Graf
The snippet of code to add a drive to our drive list needs to
get called from 2 places in the future. Split it into a separate
function.

Signed-off-by: Alexander Graf 
---
 lib/efi_loader/efi_disk.c | 84 ++-
 1 file changed, 47 insertions(+), 37 deletions(-)

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index aaff947..e30e728 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -138,6 +138,52 @@ static const struct efi_block_io block_io_disk_template = {
.flush_blocks = &efi_disk_flush_blocks,
 };
 
+static void efi_disk_add_dev(char *name,
+const struct block_drvr *cur_drvr,
+const struct blk_desc *desc,
+int dev_index,
+lbaint_t offset)
+{
+   struct efi_disk_obj *diskobj;
+   struct efi_device_path_file_path *dp;
+   int objlen = sizeof(*diskobj) + (sizeof(*dp) * 2);
+
+   diskobj = calloc(1, objlen);
+
+   /* Fill in object data */
+   diskobj->parent.protocols[0].guid = &efi_block_io_guid;
+   diskobj->parent.protocols[0].open = efi_disk_open_block;
+   diskobj->parent.protocols[1].guid = &efi_guid_device_path;
+   diskobj->parent.protocols[1].open = efi_disk_open_dp;
+   diskobj->parent.handle = diskobj;
+   diskobj->ops = block_io_disk_template;
+   diskobj->ifname = cur_drvr->name;
+   diskobj->dev_index = dev_index;
+
+   /* Fill in EFI IO Media info (for read/write callbacks) */
+   diskobj->media.removable_media = desc->removable;
+   diskobj->media.media_present = 1;
+   diskobj->media.block_size = desc->blksz;
+   diskobj->media.io_align = desc->blksz;
+   diskobj->media.last_block = desc->lba;
+   diskobj->ops.media = &diskobj->media;
+
+   /* Fill in device path */
+   dp = (void*)&diskobj[1];
+   diskobj->dp = dp;
+   dp[0].dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
+   dp[0].dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
+   dp[0].dp.length = sizeof(*dp);
+   ascii2unicode(dp[0].str, name);
+
+   dp[1].dp.type = DEVICE_PATH_TYPE_END;
+   dp[1].dp.sub_type = DEVICE_PATH_SUB_TYPE_END;
+   dp[1].dp.length = sizeof(*dp);
+
+   /* Hook up to the device list */
+   list_add_tail(&diskobj->parent.link, &efi_obj_list);
+}
+
 /*
  * U-Boot doesn't have a list of all online disk devices. So when running our
  * EFI payload, we scan through all of the potentially available ones and
@@ -156,9 +202,6 @@ int efi_disk_register(void)
printf("Scanning disks on %s...\n", cur_drvr->name);
for (i = 0; i < 4; i++) {
struct blk_desc *desc;
-   struct efi_disk_obj *diskobj;
-   struct efi_device_path_file_path *dp;
-   int objlen = sizeof(*diskobj) + (sizeof(*dp) * 2);
char devname[16] = { 0 }; /* dp->str is u16[16] long */
 
desc = blk_get_dev(cur_drvr->name, i);
@@ -167,42 +210,9 @@ int efi_disk_register(void)
if (desc->type == DEV_TYPE_UNKNOWN)
continue;
 
-   diskobj = calloc(1, objlen);
-
-   /* Fill in object data */
-   diskobj->parent.protocols[0].guid = &efi_block_io_guid;
-   diskobj->parent.protocols[0].open = efi_disk_open_block;
-   diskobj->parent.protocols[1].guid = 
&efi_guid_device_path;
-   diskobj->parent.protocols[1].open = efi_disk_open_dp;
-   diskobj->parent.handle = diskobj;
-   diskobj->ops = block_io_disk_template;
-   diskobj->ifname = cur_drvr->name;
-   diskobj->dev_index = i;
-
-   /* Fill in EFI IO Media info (for read/write callbacks) 
*/
-   diskobj->media.removable_media = desc->removable;
-   diskobj->media.media_present = 1;
-   diskobj->media.block_size = desc->blksz;
-   diskobj->media.io_align = desc->blksz;
-   diskobj->media.last_block = desc->lba;
-   diskobj->ops.media = &diskobj->media;
-
-   /* Fill in device path */
-   dp = (void*)&diskobj[1];
-   diskobj->dp = dp;
-   dp[0].dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
-   dp[0].dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
-   dp[0].dp.length = sizeof(*dp);
snprintf(devname, sizeof(devname), "%s%d",
 cur_drvr->name, i);
-   ascii2unicode(dp[0].str, devname);
-
-   dp[1].dp.type = DEVICE_PATH_TYPE_END;
-   dp[1].

[U-Boot] [PATCH 8/8] distro: Enable iso partition code

2016-04-11 Thread Alexander Graf
Now that we can properly boot EFI payloads from iso el torito
images, let's enable support for isos by default in the distro
header.

Signed-off-by: Alexander Graf 
---
 include/config_distro_defaults.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/config_distro_defaults.h b/include/config_distro_defaults.h
index 2ba7cf4..076be4d 100644
--- a/include/config_distro_defaults.h
+++ b/include/config_distro_defaults.h
@@ -62,6 +62,7 @@
 #define CONFIG_MENU
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
+#define CONFIG_ISO_PARTITION
 #define CONFIG_SUPPORT_RAW_INITRD
 #define CONFIG_SYS_HUSH_PARSER
 
-- 
1.8.5.6

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


Re: [U-Boot] [PATCH] cmd: fdt: Use separate CMD_FDT Kconfig entry instead of OF_LIBFDT

2016-04-11 Thread Michal Simek
On 11.4.2016 16:43, Simon Glass wrote:
> Hi Michal,
> 
> On 11 April 2016 at 08:41, Michal Simek  wrote:
>> On 9.4.2016 20:36, Simon Glass wrote:
>>> Hi Michal,
>>>
>>> On 6 April 2016 at 12:28, Michal Simek  wrote:
 On 6.4.2016 03:28, Masahiro Yamada wrote:
> Hi.
>
>
> 2016-04-06 4:09 GMT+09:00 Simon Glass :
>> Hi Michal,
>>
>> On 5 April 2016 at 04:15, Michal Simek  wrote:
>>> Hi Simon,
>>>
>>> On 5.4.2016 02:03, Simon Glass wrote:
 Hi Michal,

 On 4 April 2016 at 11:50, Michal Simek  wrote:
> Create CMD_FDT Kconfig entry to have an option to disable fdt command
> which is not required for small configuration which requires libfdt
> only.
> Enable it by default for all targets which enables OF_LIBFDT.
>
> Signed-off-by: Michal Simek 
> ---
>
>  cmd/Kconfig  | 7 +++
>  cmd/Makefile | 2 +-
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index fe8b4f0510da..8703cdb4a9be 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -173,6 +173,13 @@ config CMD_ELF
> help
>   Boot an ELF/vxWorks image from the memory.
>
> +config CMD_FDT
> +   bool "Flattened Device Tree utility commands"
> +   default y

 Should that be:

 default y if OF_LIBFDT

 ?

> +   depends on OF_LIBFDT
> +   help
> + Do FDT related setup before booting into the Operating 
> System.
> +
>>>
>>>
>>> In recent commits to this file both formats are used.
>>>
>>> +config CMD_BLOCK_CACHE
>>> + bool "blkcache - control and stats for block cache"
>>> + depends on BLOCK_CACHE
>>> + default y if BLOCK_CACHE
>>>
>>> even looks non standard.
>>>
>>> +config CMD_BOOTEFI
>>> + bool "bootefi"
>>> + depends on EFI_LOADER
>>> + default y
>>>
>>> I am happy to change whatever style you prefer but I think it should be
>>> synchronized. The efi one was Reviewed by you. :-)
>>
>> I think Masahiro knows most about this. If it works it's fine with me.
>> The way you have it is more intuitive and I prefer it. But he did
>> point at a problem at some point.
>
>
> I think "depends on OF_LIBFDT"
> is correct in this case.
>
>
> do_fdt() calls fdt_fixup_memory(), which is defined in 
> common/fdt_support.c,
> which is enabled by CONFIG_OF_LIBFDT.
>
> So, CMD_FDT should depend on OF_LIBFDT.
> Otherwise, "make menuconfig" would allow users
> to enable CMD_FDT without OF_LIBFDT,
> which would cause link error.
>
>
>> One other question - won't this disable the 'fdt' command for many 
>> boards?
>
>
> config CMD_FDT
> bool "Flattened Device Tree utility commands"
> default y
> depends on OF_LIBFDT
>
>
> "default y" cares about it.
> So, if CONFIG_OF_LIBFDT is enabled in the defconfig,
> CONFIG_CMD_FDT should be enabled as well.
>
>
>
> But the following 6 boards opt out of Kconfig.
> They define CONFIG_OF_LIBFDT in their config headers,
> so this patch would disable "fdt" command for them.
>
> include/configs/legoev3.h
> include/configs/ma5d4evk.h
> include/configs/pic32mzdask.h
> include/configs/stm32f746-disco.h
> include/configs/xilinx-ppc.h
> include/configs/zipitz2.h
>
>
>
> Could you move them to defconfigs?
>

 I have sent v2 to address these. I have used buildman and there is up to
 2k difference when symbol is in Kconfig. Not sure why but it shouldn't
 be big deal.
>>>
>>> What does 2k difference mean?
>>
>> hm. I wanted to use buildman to show me that but that looks weird.
>> It looks like that it is not running make legoev3_defconfig after new
>> patch because LIBFDT is not enabled when 3 commits are built.
>> But when 2 commits are built then it is enabled properly.
>> Isn't there any bug in buildman?
>>
>> Thanks,
>> Michal
>>
>> [u-boot]$ ./tools/buildman/buildman -b xnext/kconfig2 legoev3 -o /tmp/
>> -sSedKv
>> boards.cfg is up to date. Nothing to do.
>> Summary of 3 commits for 1 boards (1 thread, 8 jobs per thread)
>> 01: doc: clarify openssl-based key and certificate generation process
>> 02: kconfig: Move CONFIG_OF_LIBFDT to Kconfig
>>arm: (for 1/1 boards)  all -23674.0  bss -1032.0  data -1920.0
>> rodata -3622.0  text -17100.0
>> legoev3:  all -23674  bss -1032  data -1920  rodata
>> -3622  text -17100
>> arm:
>>- autoconf.mk: CONFIG_OF_LIBFDT=y
>>- all: CONFIG_OF_LIBFDT=y
>> legoev3 :
>>- autoconf.mk: CONFIG_OF_LIBFDT=y
>>- all: CONFIG_OF_LIBFDT=y
>> 03: cmd: fdt: Use separate CMD

Re: [U-Boot] [PATCH] cmd: fdt: Use separate CMD_FDT Kconfig entry instead of OF_LIBFDT

2016-04-11 Thread Simon Glass
Hi Michal,

On 11 April 2016 at 08:41, Michal Simek  wrote:
> On 9.4.2016 20:36, Simon Glass wrote:
>> Hi Michal,
>>
>> On 6 April 2016 at 12:28, Michal Simek  wrote:
>>> On 6.4.2016 03:28, Masahiro Yamada wrote:
 Hi.


 2016-04-06 4:09 GMT+09:00 Simon Glass :
> Hi Michal,
>
> On 5 April 2016 at 04:15, Michal Simek  wrote:
>> Hi Simon,
>>
>> On 5.4.2016 02:03, Simon Glass wrote:
>>> Hi Michal,
>>>
>>> On 4 April 2016 at 11:50, Michal Simek  wrote:
 Create CMD_FDT Kconfig entry to have an option to disable fdt command
 which is not required for small configuration which requires libfdt
 only.
 Enable it by default for all targets which enables OF_LIBFDT.

 Signed-off-by: Michal Simek 
 ---

  cmd/Kconfig  | 7 +++
  cmd/Makefile | 2 +-
  2 files changed, 8 insertions(+), 1 deletion(-)

 diff --git a/cmd/Kconfig b/cmd/Kconfig
 index fe8b4f0510da..8703cdb4a9be 100644
 --- a/cmd/Kconfig
 +++ b/cmd/Kconfig
 @@ -173,6 +173,13 @@ config CMD_ELF
 help
   Boot an ELF/vxWorks image from the memory.

 +config CMD_FDT
 +   bool "Flattened Device Tree utility commands"
 +   default y
>>>
>>> Should that be:
>>>
>>> default y if OF_LIBFDT
>>>
>>> ?
>>>
 +   depends on OF_LIBFDT
 +   help
 + Do FDT related setup before booting into the Operating 
 System.
 +
>>
>>
>> In recent commits to this file both formats are used.
>>
>> +config CMD_BLOCK_CACHE
>> + bool "blkcache - control and stats for block cache"
>> + depends on BLOCK_CACHE
>> + default y if BLOCK_CACHE
>>
>> even looks non standard.
>>
>> +config CMD_BOOTEFI
>> + bool "bootefi"
>> + depends on EFI_LOADER
>> + default y
>>
>> I am happy to change whatever style you prefer but I think it should be
>> synchronized. The efi one was Reviewed by you. :-)
>
> I think Masahiro knows most about this. If it works it's fine with me.
> The way you have it is more intuitive and I prefer it. But he did
> point at a problem at some point.


 I think "depends on OF_LIBFDT"
 is correct in this case.


 do_fdt() calls fdt_fixup_memory(), which is defined in 
 common/fdt_support.c,
 which is enabled by CONFIG_OF_LIBFDT.

 So, CMD_FDT should depend on OF_LIBFDT.
 Otherwise, "make menuconfig" would allow users
 to enable CMD_FDT without OF_LIBFDT,
 which would cause link error.


> One other question - won't this disable the 'fdt' command for many boards?


 config CMD_FDT
 bool "Flattened Device Tree utility commands"
 default y
 depends on OF_LIBFDT


 "default y" cares about it.
 So, if CONFIG_OF_LIBFDT is enabled in the defconfig,
 CONFIG_CMD_FDT should be enabled as well.



 But the following 6 boards opt out of Kconfig.
 They define CONFIG_OF_LIBFDT in their config headers,
 so this patch would disable "fdt" command for them.

 include/configs/legoev3.h
 include/configs/ma5d4evk.h
 include/configs/pic32mzdask.h
 include/configs/stm32f746-disco.h
 include/configs/xilinx-ppc.h
 include/configs/zipitz2.h



 Could you move them to defconfigs?

>>>
>>> I have sent v2 to address these. I have used buildman and there is up to
>>> 2k difference when symbol is in Kconfig. Not sure why but it shouldn't
>>> be big deal.
>>
>> What does 2k difference mean?
>
> hm. I wanted to use buildman to show me that but that looks weird.
> It looks like that it is not running make legoev3_defconfig after new
> patch because LIBFDT is not enabled when 3 commits are built.
> But when 2 commits are built then it is enabled properly.
> Isn't there any bug in buildman?
>
> Thanks,
> Michal
>
> [u-boot]$ ./tools/buildman/buildman -b xnext/kconfig2 legoev3 -o /tmp/
> -sSedKv
> boards.cfg is up to date. Nothing to do.
> Summary of 3 commits for 1 boards (1 thread, 8 jobs per thread)
> 01: doc: clarify openssl-based key and certificate generation process
> 02: kconfig: Move CONFIG_OF_LIBFDT to Kconfig
>arm: (for 1/1 boards)  all -23674.0  bss -1032.0  data -1920.0
> rodata -3622.0  text -17100.0
> legoev3:  all -23674  bss -1032  data -1920  rodata
> -3622  text -17100
> arm:
>- autoconf.mk: CONFIG_OF_LIBFDT=y
>- all: CONFIG_OF_LIBFDT=y
> legoev3 :
>- autoconf.mk: CONFIG_OF_LIBFDT=y
>- all: CONFIG_OF_LIBFDT=y
> 03: cmd: fdt: Use separate CMD_FDT Kconfig entry instead of OF_LIBFDT
> (no errors to report)
> [u-boot]$ git log --oneline | head -n 3
> 0440a5580b8a cmd: fdt: Use separate CMD_FDT Kconfig entry instead of
> OF_LIBFDT
> ef3a52ec50b0 kco

Re: [U-Boot] [PATCH] cmd: fdt: Use separate CMD_FDT Kconfig entry instead of OF_LIBFDT

2016-04-11 Thread Simon Glass
Hi Michal,

On 11 April 2016 at 08:48, Michal Simek  wrote:
> On 11.4.2016 16:43, Simon Glass wrote:
>> Hi Michal,
>>
>> On 11 April 2016 at 08:41, Michal Simek  wrote:
>>> On 9.4.2016 20:36, Simon Glass wrote:
 Hi Michal,

 On 6 April 2016 at 12:28, Michal Simek  wrote:
> On 6.4.2016 03:28, Masahiro Yamada wrote:
>> Hi.
>>
>>
>> 2016-04-06 4:09 GMT+09:00 Simon Glass :
>>> Hi Michal,
>>>
>>> On 5 April 2016 at 04:15, Michal Simek  wrote:
 Hi Simon,

 On 5.4.2016 02:03, Simon Glass wrote:
> Hi Michal,
>
> On 4 April 2016 at 11:50, Michal Simek  
> wrote:
>> Create CMD_FDT Kconfig entry to have an option to disable fdt command
>> which is not required for small configuration which requires libfdt
>> only.
>> Enable it by default for all targets which enables OF_LIBFDT.
>>
>> Signed-off-by: Michal Simek 
>> ---
>>
>>  cmd/Kconfig  | 7 +++
>>  cmd/Makefile | 2 +-
>>  2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/cmd/Kconfig b/cmd/Kconfig
>> index fe8b4f0510da..8703cdb4a9be 100644
>> --- a/cmd/Kconfig
>> +++ b/cmd/Kconfig
>> @@ -173,6 +173,13 @@ config CMD_ELF
>> help
>>   Boot an ELF/vxWorks image from the memory.
>>
>> +config CMD_FDT
>> +   bool "Flattened Device Tree utility commands"
>> +   default y
>
> Should that be:
>
> default y if OF_LIBFDT
>
> ?
>
>> +   depends on OF_LIBFDT
>> +   help
>> + Do FDT related setup before booting into the Operating 
>> System.
>> +


 In recent commits to this file both formats are used.

 +config CMD_BLOCK_CACHE
 + bool "blkcache - control and stats for block cache"
 + depends on BLOCK_CACHE
 + default y if BLOCK_CACHE

 even looks non standard.

 +config CMD_BOOTEFI
 + bool "bootefi"
 + depends on EFI_LOADER
 + default y

 I am happy to change whatever style you prefer but I think it should be
 synchronized. The efi one was Reviewed by you. :-)
>>>
>>> I think Masahiro knows most about this. If it works it's fine with me.
>>> The way you have it is more intuitive and I prefer it. But he did
>>> point at a problem at some point.
>>
>>
>> I think "depends on OF_LIBFDT"
>> is correct in this case.
>>
>>
>> do_fdt() calls fdt_fixup_memory(), which is defined in 
>> common/fdt_support.c,
>> which is enabled by CONFIG_OF_LIBFDT.
>>
>> So, CMD_FDT should depend on OF_LIBFDT.
>> Otherwise, "make menuconfig" would allow users
>> to enable CMD_FDT without OF_LIBFDT,
>> which would cause link error.
>>
>>
>>> One other question - won't this disable the 'fdt' command for many 
>>> boards?
>>
>>
>> config CMD_FDT
>> bool "Flattened Device Tree utility commands"
>> default y
>> depends on OF_LIBFDT
>>
>>
>> "default y" cares about it.
>> So, if CONFIG_OF_LIBFDT is enabled in the defconfig,
>> CONFIG_CMD_FDT should be enabled as well.
>>
>>
>>
>> But the following 6 boards opt out of Kconfig.
>> They define CONFIG_OF_LIBFDT in their config headers,
>> so this patch would disable "fdt" command for them.
>>
>> include/configs/legoev3.h
>> include/configs/ma5d4evk.h
>> include/configs/pic32mzdask.h
>> include/configs/stm32f746-disco.h
>> include/configs/xilinx-ppc.h
>> include/configs/zipitz2.h
>>
>>
>>
>> Could you move them to defconfigs?
>>
>
> I have sent v2 to address these. I have used buildman and there is up to
> 2k difference when symbol is in Kconfig. Not sure why but it shouldn't
> be big deal.

 What does 2k difference mean?
>>>
>>> hm. I wanted to use buildman to show me that but that looks weird.
>>> It looks like that it is not running make legoev3_defconfig after new
>>> patch because LIBFDT is not enabled when 3 commits are built.
>>> But when 2 commits are built then it is enabled properly.
>>> Isn't there any bug in buildman?
>>>
>>> Thanks,
>>> Michal
>>>
>>> [u-boot]$ ./tools/buildman/buildman -b xnext/kconfig2 legoev3 -o /tmp/
>>> -sSedKv
>>> boards.cfg is up to date. Nothing to do.
>>> Summary of 3 commits for 1 boards (1 thread, 8 jobs per thread)
>>> 01: doc: clarify openssl-based key and certificate generation process
>>> 02: kconfig: Move CONFIG_OF_LIBFDT to Kconfig
>>>arm: (for 1/1 boards)  all -23674.0  bss -1032.0  data -1920.0
>>> rodata -3622.0  text -17100.0
>>> legoev3:  all -23674  bss -1032  data -1920  rodat

Re: [U-Boot] [PATCH 00/10] driver model bring-up of dwc3 usb peripheral

2016-04-11 Thread Mugunthan V N
On Monday 11 April 2016 05:50 PM, Simon Glass wrote:
> +Mugunthan, who seems to have been dropped from this thread
> 
> On 8 April 2016 at 13:45, Tom Rini  wrote:
>> On Wed, Apr 06, 2016 at 05:16:02PM -0600, Simon Glass wrote:
>>> Hi,
>>>
>>> On 31 March 2016 at 09:24, Marek Vasut  wrote:
 On 03/31/2016 05:11 PM, Tom Rini wrote:
> On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote:
>> Hi Tom,
>>
>> On 15.3.2016 13:14, Mugunthan V N wrote:
>>> This patch series enables dwc3 usb driver to adopt driver model.
>>> This has been tested on AM437x evm sk (logs [1]) by loading
>>> kernel through usb ether
>>>
>>> Also pushed a branch for testing [2]
>>>
>>> [1] - http://pastebin.ubuntu.com/15391169/
>>> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git 
>>> dm-dwc3
>>>
>>> Kishon Vijay Abraham I (1):
>>>   configs: am43xx: Add am43xx_evm_usbspl_defconfig
>>>
>>> Mugunthan V N (8):
>>>   drivers: usb: dwc3: remove devm_zalloc from linux_compact
>>>   drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board
>>> files to drivers
>>>   am437x: board: do not register usb devices when CONFIG_DM_USB is
>>> defined
>>>   dra7xx: board: do not register usb devices when CONFIG_DM_USB is
>>> defined
>>>   drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
>>>   drivers: usb: common: add support to get maximum speed from dt
>>>   drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model
>>> support
>>>   defconfig: am437x_sk_evm: enable usb driver model
>>>
>>> Tom Rini (1):
>>>   am43xx: Add USB device boot support to SPL
>>>
>>>  board/ti/am43xx/MAINTAINERS |   1 +
>>>  board/ti/am43xx/board.c |  52 +---
>>>  board/ti/am57xx/board.c |  11 --
>>>  board/ti/dra7xx/evm.c   |  13 +-
>>>  configs/am437x_sk_evm_defconfig |   4 +
>>>  configs/am43xx_evm_usbspl_defconfig |   9 ++
>>>  drivers/Makefile|   2 +
>>>  drivers/usb/common/common.c |  29 +
>>>  drivers/usb/dwc3/core.c |  64 +-
>>>  drivers/usb/dwc3/core.h |   6 +
>>>  drivers/usb/dwc3/dwc3-omap.c| 230 
>>> +++-
>>>  drivers/usb/dwc3/gadget.c   |   2 +-
>>>  drivers/usb/dwc3/linux-compat.h |   5 -
>>>  drivers/usb/dwc3/ti_usb_phy.c   |   1 +
>>>  drivers/usb/gadget/gadget_chips.h   |   2 +
>>>  include/configs/am43xx_evm.h|  13 ++
>>>  include/linux/usb/otg.h |   9 ++
>>>  17 files changed, 406 insertions(+), 47 deletions(-)
>>>  create mode 100644 configs/am43xx_evm_usbspl_defconfig
>>>
>>
>> Are you going to take this directly or this should go via USB tree?
>
> Marek, do you want this?  Or want me to?
>
 That is Lukasz.
>>>
>>> This series has ended up in my patchwork queue, but there seem to be
>>> quite a few unapplied, dependent patches. Tom please let me know what
>>> you'd like me to do here.
>>
>> ... I didn't think it depended on stuff but I do need to do another
>> go-round from the queue and apply stuff.
> 
> Specifically it seems to be missing the patch below, from:
> 
> git://git.ti.com/~dmurphy/ti-u-boot/mugunth-ti-u-boot.git
> 
> 
> commit 67802cd52d1c45a789ac377106267cee9d6ac2d9
> Author: Mugunthan V N 
> Date:   Tue Mar 1 16:59:22 2016 +0530
> 
> drivers: usb: common: add common code for usb drivers to use
> 
> Add common usb code which usb drivers makes use of it.
> 
> Signed-off-by: Mugunthan V N 
> 
>  Makefile|  1 +
>  drivers/usb/common/Makefile |  8 
>  drivers/usb/common/common.c | 40 
>  include/linux/usb/otg.h |  9 +
>  4 files changed, 58 insertions(+)
> 

This was part of my musb v2 patch series, due to other priorities I
didn't submitted this yet.

Simon, are you applying the series, can I send the above patch separately?

Regards
Mugunthan V N

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


Re: [U-Boot] [PATCH] dm: gpio: handle GPIO_ACTIVE_LOW flag in DT

2016-04-11 Thread Simon Glass
Hi Eric,

On 10 April 2016 at 08:48, Eric Nelson  wrote:
> Hi Simon,
>
> On 04/09/2016 11:33 AM, Simon Glass wrote:
>> On 4 April 2016 at 11:50, Stephen Warren  wrote:
>>> On 04/03/2016 08:07 AM, Eric Nelson wrote:
 On 04/02/2016 08:37 PM, Stephen Warren wrote:
> On 04/02/2016 09:13 AM, Eric Nelson wrote:
>> On 04/01/2016 10:46 PM, Peng Fan wrote:
>>> On Thu, Mar 31, 2016 at 01:41:04PM -0700, Eric Nelson wrote:
 On 03/28/2016 09:57 PM, Peng Fan wrote:
> On Fri, Mar 25, 2016 at 01:12:11PM -0700, Eric Nelson wrote:
>>
>> Device tree parsing of GPIO nodes is currently ignoring flags.
>>
>> Add support for GPIO_ACTIVE_LOW by checking for the presence
>> of the flag and setting the desc->flags field to the driver
>> model constant GPIOD_ACTIVE_LOW.
>
>
> 
>
>>>
>>> The intent of the change is good.
>>>
>>> I'm not sure why we need to remove gpio_find_and_xlate(); it provides an API
>>> for clients so they don't need to know how to access driver functionality
>>> through the ops pointer, which I think is an internal/private implementation
>>> detail. Is that detail exposed to clients in other places? If so, removing
>>> the wrapper seems fine. If not, I suspect it's a deliberate abstraction.
>>
>> This seems a bit pedantic, but since Linux does it this way I think we
>> should follow along.
>>
>> Eric you still get to remove the code from all the GPIO drivers - the
>> difference is just creating a common function to call when no xlate()
>> method is available.
>>
>> Can you please take a look at what Stephen suggests?
>>
>
> Got it. I'm just not sure about where to start (before or after
> the patch set you sent) and whether to also remove offset parsing
> from gpio_find_and_xlate().
>

Which patch did I send? My understanding is:

- Add my review/ack tag to the patches as necessary
- Drop the tegra patch
- Update gpio_find_and_xlate() to call a default function if there is
no xlate() method
- Resend the series

I'm not sure about removing the existing functionality from
gpio_find_and_xlate(), but my guess is that it is best to move it to
your default function, so that gpio_find_and_xlate() doesn't include
any default behaviour in the case where there is a xlate() method.

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


Re: [U-Boot] [PATCH] dm: gpio: handle GPIO_ACTIVE_LOW flag in DT

2016-04-11 Thread Eric Nelson
Hi Simon,

On 04/11/2016 07:47 AM, Simon Glass wrote:
> Hi Eric,
> 
> On 10 April 2016 at 08:48, Eric Nelson  wrote:
>> Hi Simon,
>>
>> On 04/09/2016 11:33 AM, Simon Glass wrote:
>>> On 4 April 2016 at 11:50, Stephen Warren  wrote:
 On 04/03/2016 08:07 AM, Eric Nelson wrote:
> On 04/02/2016 08:37 PM, Stephen Warren wrote:
>> On 04/02/2016 09:13 AM, Eric Nelson wrote:
>>> On 04/01/2016 10:46 PM, Peng Fan wrote:
 On Thu, Mar 31, 2016 at 01:41:04PM -0700, Eric Nelson wrote:
> On 03/28/2016 09:57 PM, Peng Fan wrote:
>> On Fri, Mar 25, 2016 at 01:12:11PM -0700, Eric Nelson wrote:
>>>
>>> Device tree parsing of GPIO nodes is currently ignoring flags.
>>>
>>> Add support for GPIO_ACTIVE_LOW by checking for the presence
>>> of the flag and setting the desc->flags field to the driver
>>> model constant GPIOD_ACTIVE_LOW.
>>
>>
>> 
>>

 The intent of the change is good.

 I'm not sure why we need to remove gpio_find_and_xlate(); it provides an 
 API
 for clients so they don't need to know how to access driver functionality
 through the ops pointer, which I think is an internal/private 
 implementation
 detail. Is that detail exposed to clients in other places? If so, removing
 the wrapper seems fine. If not, I suspect it's a deliberate abstraction.
>>>
>>> This seems a bit pedantic, but since Linux does it this way I think we
>>> should follow along.
>>>
>>> Eric you still get to remove the code from all the GPIO drivers - the
>>> difference is just creating a common function to call when no xlate()
>>> method is available.
>>>
>>> Can you please take a look at what Stephen suggests?
>>>
>>
>> Got it. I'm just not sure about where to start (before or after
>> the patch set you sent) and whether to also remove offset parsing
>> from gpio_find_and_xlate().
>>
> 
> Which patch did I send? My understanding is:
> 

At the time I sent this, you had just submitted the patch set adding
more driver-model support for block devices.

http://lists.denx.de/pipermail/u-boot/2016-April/251095.html

> - Add my review/ack tag to the patches as necessary
> - Drop the tegra patch
> - Update gpio_find_and_xlate() to call a default function if there is
> no xlate() method
> - Resend the series
> 
> I'm not sure about removing the existing functionality from
> gpio_find_and_xlate(), but my guess is that it is best to move it to
> your default function, so that gpio_find_and_xlate() doesn't include
> any default behaviour in the case where there is a xlate() method.
> 

Reviewing the use of the offset field did yield some information about
the broken sunxi support and also that Vybrid was also missing
the xlate routine.

Since reviewing your patch sets (driver model updates for blk and also
driver model updates for mmc) will take some time, so I'll base an
updated patch set on master. My guess is that any merge issues will
be trivial.

I'll remove your acks in the updated patch set, since the updates
to the drivers won't drop the xlate field, but will connect them
to the common (__maybe_unused) routine. This will prevent the code
from leaking into machines like Tegra that don't need the common code.

Regards,


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


[U-Boot] [PATCH] efi_loader: Use system fdt as fallback

2016-04-11 Thread Alexander Graf
When the user did not pass any device tree or the boot script
didn't find any, let's use the system device tree as last resort
to get something the payload (Linux) may understand.

This means that on systems that use the same device tree for U-Boot
and Linux we can just share it and there's no need to manually provide
a device tree in the target image.

While at it, also copy and pad the device tree by 64kb to give us
space for modifications.

Signed-off-by: Alexander Graf 
---
 cmd/bootefi.c | 37 +++--
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index f502996..9b8af65 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -12,6 +12,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
 
 /*
  * When booting using the "bootefi" command, we don't know which
@@ -97,6 +101,21 @@ static struct efi_object bootefi_device_obj = {
},
 };
 
+static void *copy_fdt(void *fdt)
+{
+   u64 fdt_size = fdt_totalsize(fdt);
+   void *new_fdt;
+
+   /* Give us 64kb breathing room */
+   fdt_size += 64 * 1024;
+
+   new_fdt = malloc(fdt_size);
+   memcpy(new_fdt, fdt, fdt_totalsize(fdt));
+   fdt_set_totalsize(new_fdt, fdt_size);
+
+   return new_fdt;
+}
+
 /*
  * Load an EFI payload into a newly allocated piece of memory, register all
  * EFI objects it would want to access and jump to it.
@@ -106,6 +125,7 @@ static unsigned long do_bootefi_exec(void *efi)
ulong (*entry)(void *image_handle, struct efi_system_table *st);
ulong fdt_pages, fdt_size, fdt_start, fdt_end;
bootm_headers_t img = { 0 };
+   void *fdt = working_fdt;
 
/*
 * gd lives in a fixed register which may get clobbered while we execute
@@ -115,28 +135,33 @@ static unsigned long do_bootefi_exec(void *efi)
 
/* Update system table to point to our currently loaded FDT */
 
-   if (working_fdt) {
+   /* Fall back to included fdt if none was manually loaded */
+   if (!fdt && gd->fdt_blob)
+   fdt = (void *)gd->fdt_blob;
+
+   if (fdt) {
/* Prepare fdt for payload */
-   if (image_setup_libfdt(&img, working_fdt, 0, NULL)) {
+   fdt = copy_fdt(fdt);
+
+   if (image_setup_libfdt(&img, fdt, 0, NULL)) {
printf("ERROR: Failed to process device tree\n");
return -EINVAL;
}
 
/* Link to it in the efi tables */
systab.tables[0].guid = EFI_FDT_GUID;
-   systab.tables[0].table = working_fdt;
+   systab.tables[0].table = fdt;
systab.nr_tables = 1;
 
/* And reserve the space in the memory map */
-   fdt_start = ((ulong)working_fdt) & ~EFI_PAGE_MASK;
-   fdt_end = ((ulong)working_fdt) + fdt_totalsize(working_fdt);
+   fdt_start = ((ulong)fdt) & ~EFI_PAGE_MASK;
+   fdt_end = ((ulong)fdt) + fdt_totalsize(fdt);
fdt_size = (fdt_end - fdt_start) + EFI_PAGE_MASK;
fdt_pages = fdt_size >> EFI_PAGE_SHIFT;
/* Give a bootloader the chance to modify the device tree */
fdt_pages += 2;
efi_add_memory_map(fdt_start, fdt_pages,
   EFI_BOOT_SERVICES_DATA, true);
-
} else {
printf("WARNING: No device tree loaded, expect boot to fail\n");
systab.nr_tables = 0;
-- 
1.8.5.6

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


Re: [U-Boot] [PATCH 2/2] dm: gpio: mxc: implement xlate function

2016-04-11 Thread Eric Nelson
Hi Peng,

On 04/10/2016 10:28 PM, Peng Fan wrote:
> On Tue, Mar 15, 2016 at 09:32:51PM -0600, Simon Glass wrote:
>> On 14 March 2016 at 23:48, Peng Fan  wrote:
>>> To i.MX controller, we use such as "<&gpio1 3 GPIO_ACTIVE_LOW>" for
>>> a device to refer a gpio pin in device tree. So need to implement
>>> xlate function, to correctly handle gpio flags and offset.
>>>
>>> Signed-off-by: Peng Fan 
>>> Cc: Simon Glass 
>>> Cc: Stefano Babic 
>>> Cc: Fabio Estevam 
>>> ---
>>>  drivers/gpio/mxc_gpio.c | 12 
>>>  1 file changed, 12 insertions(+)
>>
>> Reviewed-by: Simon Glass 
> 
> Will this patch be picked up? Or droped, since Eric is trying to add a
> common way.
> 

I think this patch should be dropped.

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


Re: [U-Boot] [PATCH] cmd: fdt: Use separate CMD_FDT Kconfig entry instead of OF_LIBFDT

2016-04-11 Thread Michal Simek
On 9.4.2016 20:36, Simon Glass wrote:
> Hi Michal,
> 
> On 6 April 2016 at 12:28, Michal Simek  wrote:
>> On 6.4.2016 03:28, Masahiro Yamada wrote:
>>> Hi.
>>>
>>>
>>> 2016-04-06 4:09 GMT+09:00 Simon Glass :
 Hi Michal,

 On 5 April 2016 at 04:15, Michal Simek  wrote:
> Hi Simon,
>
> On 5.4.2016 02:03, Simon Glass wrote:
>> Hi Michal,
>>
>> On 4 April 2016 at 11:50, Michal Simek  wrote:
>>> Create CMD_FDT Kconfig entry to have an option to disable fdt command
>>> which is not required for small configuration which requires libfdt
>>> only.
>>> Enable it by default for all targets which enables OF_LIBFDT.
>>>
>>> Signed-off-by: Michal Simek 
>>> ---
>>>
>>>  cmd/Kconfig  | 7 +++
>>>  cmd/Makefile | 2 +-
>>>  2 files changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/cmd/Kconfig b/cmd/Kconfig
>>> index fe8b4f0510da..8703cdb4a9be 100644
>>> --- a/cmd/Kconfig
>>> +++ b/cmd/Kconfig
>>> @@ -173,6 +173,13 @@ config CMD_ELF
>>> help
>>>   Boot an ELF/vxWorks image from the memory.
>>>
>>> +config CMD_FDT
>>> +   bool "Flattened Device Tree utility commands"
>>> +   default y
>>
>> Should that be:
>>
>> default y if OF_LIBFDT
>>
>> ?
>>
>>> +   depends on OF_LIBFDT
>>> +   help
>>> + Do FDT related setup before booting into the Operating System.
>>> +
>
>
> In recent commits to this file both formats are used.
>
> +config CMD_BLOCK_CACHE
> + bool "blkcache - control and stats for block cache"
> + depends on BLOCK_CACHE
> + default y if BLOCK_CACHE
>
> even looks non standard.
>
> +config CMD_BOOTEFI
> + bool "bootefi"
> + depends on EFI_LOADER
> + default y
>
> I am happy to change whatever style you prefer but I think it should be
> synchronized. The efi one was Reviewed by you. :-)

 I think Masahiro knows most about this. If it works it's fine with me.
 The way you have it is more intuitive and I prefer it. But he did
 point at a problem at some point.
>>>
>>>
>>> I think "depends on OF_LIBFDT"
>>> is correct in this case.
>>>
>>>
>>> do_fdt() calls fdt_fixup_memory(), which is defined in common/fdt_support.c,
>>> which is enabled by CONFIG_OF_LIBFDT.
>>>
>>> So, CMD_FDT should depend on OF_LIBFDT.
>>> Otherwise, "make menuconfig" would allow users
>>> to enable CMD_FDT without OF_LIBFDT,
>>> which would cause link error.
>>>
>>>
 One other question - won't this disable the 'fdt' command for many boards?
>>>
>>>
>>> config CMD_FDT
>>> bool "Flattened Device Tree utility commands"
>>> default y
>>> depends on OF_LIBFDT
>>>
>>>
>>> "default y" cares about it.
>>> So, if CONFIG_OF_LIBFDT is enabled in the defconfig,
>>> CONFIG_CMD_FDT should be enabled as well.
>>>
>>>
>>>
>>> But the following 6 boards opt out of Kconfig.
>>> They define CONFIG_OF_LIBFDT in their config headers,
>>> so this patch would disable "fdt" command for them.
>>>
>>> include/configs/legoev3.h
>>> include/configs/ma5d4evk.h
>>> include/configs/pic32mzdask.h
>>> include/configs/stm32f746-disco.h
>>> include/configs/xilinx-ppc.h
>>> include/configs/zipitz2.h
>>>
>>>
>>>
>>> Could you move them to defconfigs?
>>>
>>
>> I have sent v2 to address these. I have used buildman and there is up to
>> 2k difference when symbol is in Kconfig. Not sure why but it shouldn't
>> be big deal.
> 
> What does 2k difference mean?

hm. I wanted to use buildman to show me that but that looks weird.
It looks like that it is not running make legoev3_defconfig after new
patch because LIBFDT is not enabled when 3 commits are built.
But when 2 commits are built then it is enabled properly.
Isn't there any bug in buildman?

Thanks,
Michal

[u-boot]$ ./tools/buildman/buildman -b xnext/kconfig2 legoev3 -o /tmp/
-sSedKv
boards.cfg is up to date. Nothing to do.
Summary of 3 commits for 1 boards (1 thread, 8 jobs per thread)
01: doc: clarify openssl-based key and certificate generation process
02: kconfig: Move CONFIG_OF_LIBFDT to Kconfig
   arm: (for 1/1 boards)  all -23674.0  bss -1032.0  data -1920.0
rodata -3622.0  text -17100.0
legoev3:  all -23674  bss -1032  data -1920  rodata
-3622  text -17100
arm:
   - autoconf.mk: CONFIG_OF_LIBFDT=y
   - all: CONFIG_OF_LIBFDT=y
legoev3 :
   - autoconf.mk: CONFIG_OF_LIBFDT=y
   - all: CONFIG_OF_LIBFDT=y
03: cmd: fdt: Use separate CMD_FDT Kconfig entry instead of OF_LIBFDT
(no errors to report)
[u-boot]$ git log --oneline | head -n 3
0440a5580b8a cmd: fdt: Use separate CMD_FDT Kconfig entry instead of
OF_LIBFDT
ef3a52ec50b0 kconfig: Move CONFIG_OF_LIBFDT to Kconfig
4c1d5c29b5de doc: clarify openssl-based key and certificate generation
process
[u-boot]$
[u-boot]$ ./tools/buildman/buildman -b xnext/kconfig2 legoev3 -o /tmp/ -c 2
boards.cfg is up to date. Nothing to do.
Building 2 commi

Re: [U-Boot] [PATCH 00/10] driver model bring-up of dwc3 usb peripheral

2016-04-11 Thread Simon Glass
Hi Mugunthan,

On 11 April 2016 at 08:52, Mugunthan V N  wrote:
> On Monday 11 April 2016 05:50 PM, Simon Glass wrote:
>> +Mugunthan, who seems to have been dropped from this thread
>>
>> On 8 April 2016 at 13:45, Tom Rini  wrote:
>>> On Wed, Apr 06, 2016 at 05:16:02PM -0600, Simon Glass wrote:
 Hi,

 On 31 March 2016 at 09:24, Marek Vasut  wrote:
> On 03/31/2016 05:11 PM, Tom Rini wrote:
>> On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote:
>>> Hi Tom,
>>>
>>> On 15.3.2016 13:14, Mugunthan V N wrote:
 This patch series enables dwc3 usb driver to adopt driver model.
 This has been tested on AM437x evm sk (logs [1]) by loading
 kernel through usb ether

 Also pushed a branch for testing [2]

 [1] - http://pastebin.ubuntu.com/15391169/
 [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git 
 dm-dwc3

 Kishon Vijay Abraham I (1):
   configs: am43xx: Add am43xx_evm_usbspl_defconfig

 Mugunthan V N (8):
   drivers: usb: dwc3: remove devm_zalloc from linux_compact
   drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board
 files to drivers
   am437x: board: do not register usb devices when CONFIG_DM_USB is
 defined
   dra7xx: board: do not register usb devices when CONFIG_DM_USB is
 defined
   drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
   drivers: usb: common: add support to get maximum speed from dt
   drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model
 support
   defconfig: am437x_sk_evm: enable usb driver model

 Tom Rini (1):
   am43xx: Add USB device boot support to SPL

  board/ti/am43xx/MAINTAINERS |   1 +
  board/ti/am43xx/board.c |  52 +---
  board/ti/am57xx/board.c |  11 --
  board/ti/dra7xx/evm.c   |  13 +-
  configs/am437x_sk_evm_defconfig |   4 +
  configs/am43xx_evm_usbspl_defconfig |   9 ++
  drivers/Makefile|   2 +
  drivers/usb/common/common.c |  29 +
  drivers/usb/dwc3/core.c |  64 +-
  drivers/usb/dwc3/core.h |   6 +
  drivers/usb/dwc3/dwc3-omap.c| 230 
 +++-
  drivers/usb/dwc3/gadget.c   |   2 +-
  drivers/usb/dwc3/linux-compat.h |   5 -
  drivers/usb/dwc3/ti_usb_phy.c   |   1 +
  drivers/usb/gadget/gadget_chips.h   |   2 +
  include/configs/am43xx_evm.h|  13 ++
  include/linux/usb/otg.h |   9 ++
  17 files changed, 406 insertions(+), 47 deletions(-)
  create mode 100644 configs/am43xx_evm_usbspl_defconfig

>>>
>>> Are you going to take this directly or this should go via USB tree?
>>
>> Marek, do you want this?  Or want me to?
>>
> That is Lukasz.

 This series has ended up in my patchwork queue, but there seem to be
 quite a few unapplied, dependent patches. Tom please let me know what
 you'd like me to do here.
>>>
>>> ... I didn't think it depended on stuff but I do need to do another
>>> go-round from the queue and apply stuff.
>>
>> Specifically it seems to be missing the patch below, from:
>>
>> git://git.ti.com/~dmurphy/ti-u-boot/mugunth-ti-u-boot.git
>>
>>
>> commit 67802cd52d1c45a789ac377106267cee9d6ac2d9
>> Author: Mugunthan V N 
>> Date:   Tue Mar 1 16:59:22 2016 +0530
>>
>> drivers: usb: common: add common code for usb drivers to use
>>
>> Add common usb code which usb drivers makes use of it.
>>
>> Signed-off-by: Mugunthan V N 
>>
>>  Makefile|  1 +
>>  drivers/usb/common/Makefile |  8 
>>  drivers/usb/common/common.c | 40 
>>  include/linux/usb/otg.h |  9 +
>>  4 files changed, 58 insertions(+)
>>
>
> This was part of my musb v2 patch series, due to other priorities I
> didn't submitted this yet.
>
> Simon, are you applying the series, can I send the above patch separately?

If you like, yes.

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


Re: [U-Boot] [PATCH] cmd: fdt: Use separate CMD_FDT Kconfig entry instead of OF_LIBFDT

2016-04-11 Thread Michal Simek
On 11.4.2016 16:50, Simon Glass wrote:
> Hi Michal,
> 
> On 11 April 2016 at 08:48, Michal Simek  wrote:
>> On 11.4.2016 16:43, Simon Glass wrote:
>>> Hi Michal,
>>>
>>> On 11 April 2016 at 08:41, Michal Simek  wrote:
 On 9.4.2016 20:36, Simon Glass wrote:
> Hi Michal,
>
> On 6 April 2016 at 12:28, Michal Simek  wrote:
>> On 6.4.2016 03:28, Masahiro Yamada wrote:
>>> Hi.
>>>
>>>
>>> 2016-04-06 4:09 GMT+09:00 Simon Glass :
 Hi Michal,

 On 5 April 2016 at 04:15, Michal Simek  wrote:
> Hi Simon,
>
> On 5.4.2016 02:03, Simon Glass wrote:
>> Hi Michal,
>>
>> On 4 April 2016 at 11:50, Michal Simek  
>> wrote:
>>> Create CMD_FDT Kconfig entry to have an option to disable fdt 
>>> command
>>> which is not required for small configuration which requires libfdt
>>> only.
>>> Enable it by default for all targets which enables OF_LIBFDT.
>>>
>>> Signed-off-by: Michal Simek 
>>> ---
>>>
>>>  cmd/Kconfig  | 7 +++
>>>  cmd/Makefile | 2 +-
>>>  2 files changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/cmd/Kconfig b/cmd/Kconfig
>>> index fe8b4f0510da..8703cdb4a9be 100644
>>> --- a/cmd/Kconfig
>>> +++ b/cmd/Kconfig
>>> @@ -173,6 +173,13 @@ config CMD_ELF
>>> help
>>>   Boot an ELF/vxWorks image from the memory.
>>>
>>> +config CMD_FDT
>>> +   bool "Flattened Device Tree utility commands"
>>> +   default y
>>
>> Should that be:
>>
>> default y if OF_LIBFDT
>>
>> ?
>>
>>> +   depends on OF_LIBFDT
>>> +   help
>>> + Do FDT related setup before booting into the Operating 
>>> System.
>>> +
>
>
> In recent commits to this file both formats are used.
>
> +config CMD_BLOCK_CACHE
> + bool "blkcache - control and stats for block cache"
> + depends on BLOCK_CACHE
> + default y if BLOCK_CACHE
>
> even looks non standard.
>
> +config CMD_BOOTEFI
> + bool "bootefi"
> + depends on EFI_LOADER
> + default y
>
> I am happy to change whatever style you prefer but I think it should 
> be
> synchronized. The efi one was Reviewed by you. :-)

 I think Masahiro knows most about this. If it works it's fine with me.
 The way you have it is more intuitive and I prefer it. But he did
 point at a problem at some point.
>>>
>>>
>>> I think "depends on OF_LIBFDT"
>>> is correct in this case.
>>>
>>>
>>> do_fdt() calls fdt_fixup_memory(), which is defined in 
>>> common/fdt_support.c,
>>> which is enabled by CONFIG_OF_LIBFDT.
>>>
>>> So, CMD_FDT should depend on OF_LIBFDT.
>>> Otherwise, "make menuconfig" would allow users
>>> to enable CMD_FDT without OF_LIBFDT,
>>> which would cause link error.
>>>
>>>
 One other question - won't this disable the 'fdt' command for many 
 boards?
>>>
>>>
>>> config CMD_FDT
>>> bool "Flattened Device Tree utility commands"
>>> default y
>>> depends on OF_LIBFDT
>>>
>>>
>>> "default y" cares about it.
>>> So, if CONFIG_OF_LIBFDT is enabled in the defconfig,
>>> CONFIG_CMD_FDT should be enabled as well.
>>>
>>>
>>>
>>> But the following 6 boards opt out of Kconfig.
>>> They define CONFIG_OF_LIBFDT in their config headers,
>>> so this patch would disable "fdt" command for them.
>>>
>>> include/configs/legoev3.h
>>> include/configs/ma5d4evk.h
>>> include/configs/pic32mzdask.h
>>> include/configs/stm32f746-disco.h
>>> include/configs/xilinx-ppc.h
>>> include/configs/zipitz2.h
>>>
>>>
>>>
>>> Could you move them to defconfigs?
>>>
>>
>> I have sent v2 to address these. I have used buildman and there is up to
>> 2k difference when symbol is in Kconfig. Not sure why but it shouldn't
>> be big deal.
>
> What does 2k difference mean?

 hm. I wanted to use buildman to show me that but that looks weird.
 It looks like that it is not running make legoev3_defconfig after new
 patch because LIBFDT is not enabled when 3 commits are built.
 But when 2 commits are built then it is enabled properly.
 Isn't there any bug in buildman?

 Thanks,
 Michal

 [u-boot]$ ./tools/buildman/buildman -b xnext/kconfig2 legoev3 -o /tmp/
 -sSedKv
 boards.cfg is up to date. Nothing to do.
 Summary of 3 commits for 1 boards (1 thread, 8 jobs per thread)
 01: doc: clarify openssl-based key and certificate generation process
 02: kconfi

Re: [U-Boot] [PATCH] dm: gpio: handle GPIO_ACTIVE_LOW flag in DT

2016-04-11 Thread Simon Glass
Hi Eric,

On 11 April 2016 at 08:55, Eric Nelson  wrote:
> Hi Simon,
>
> On 04/11/2016 07:47 AM, Simon Glass wrote:
>> Hi Eric,
>>
>> On 10 April 2016 at 08:48, Eric Nelson  wrote:
>>> Hi Simon,
>>>
>>> On 04/09/2016 11:33 AM, Simon Glass wrote:
 On 4 April 2016 at 11:50, Stephen Warren  wrote:
> On 04/03/2016 08:07 AM, Eric Nelson wrote:
>> On 04/02/2016 08:37 PM, Stephen Warren wrote:
>>> On 04/02/2016 09:13 AM, Eric Nelson wrote:
 On 04/01/2016 10:46 PM, Peng Fan wrote:
> On Thu, Mar 31, 2016 at 01:41:04PM -0700, Eric Nelson wrote:
>> On 03/28/2016 09:57 PM, Peng Fan wrote:
>>> On Fri, Mar 25, 2016 at 01:12:11PM -0700, Eric Nelson wrote:

 Device tree parsing of GPIO nodes is currently ignoring flags.

 Add support for GPIO_ACTIVE_LOW by checking for the presence
 of the flag and setting the desc->flags field to the driver
 model constant GPIOD_ACTIVE_LOW.
>>>
>>>
>>> 
>>>
>
> The intent of the change is good.
>
> I'm not sure why we need to remove gpio_find_and_xlate(); it provides an 
> API
> for clients so they don't need to know how to access driver functionality
> through the ops pointer, which I think is an internal/private 
> implementation
> detail. Is that detail exposed to clients in other places? If so, removing
> the wrapper seems fine. If not, I suspect it's a deliberate abstraction.

 This seems a bit pedantic, but since Linux does it this way I think we
 should follow along.

 Eric you still get to remove the code from all the GPIO drivers - the
 difference is just creating a common function to call when no xlate()
 method is available.

 Can you please take a look at what Stephen suggests?

>>>
>>> Got it. I'm just not sure about where to start (before or after
>>> the patch set you sent) and whether to also remove offset parsing
>>> from gpio_find_and_xlate().
>>>
>>
>> Which patch did I send? My understanding is:
>>
>
> At the time I sent this, you had just submitted the patch set adding
> more driver-model support for block devices.
>
> http://lists.denx.de/pipermail/u-boot/2016-April/251095.html
>
>> - Add my review/ack tag to the patches as necessary
>> - Drop the tegra patch
>> - Update gpio_find_and_xlate() to call a default function if there is
>> no xlate() method
>> - Resend the series
>>
>> I'm not sure about removing the existing functionality from
>> gpio_find_and_xlate(), but my guess is that it is best to move it to
>> your default function, so that gpio_find_and_xlate() doesn't include
>> any default behaviour in the case where there is a xlate() method.
>>
>
> Reviewing the use of the offset field did yield some information about
> the broken sunxi support and also that Vybrid was also missing
> the xlate routine.
>
> Since reviewing your patch sets (driver model updates for blk and also
> driver model updates for mmc) will take some time, so I'll base an
> updated patch set on master. My guess is that any merge issues will
> be trivial.

Yes, that's right.
>
> I'll remove your acks in the updated patch set, since the updates
> to the drivers won't drop the xlate field, but will connect them
> to the common (__maybe_unused) routine. This will prevent the code
> from leaking into machines like Tegra that don't need the common code.

I'm pretty sure you can drop the xlate() implementations from the
functions, though, and those at the patches I acked.

I don't think you need __maybe_unused

static int gpio_find_and_xlate(...)
{
   get ops...

   if (ops->xlate)
  return ops->xlate()
   else
  return gpio_default_xlate()...
}

gpio_default_xlate() (or whatever name you use) should be exported so
drivers can use it.

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


Re: [U-Boot] Please pull u-boot-mpc85xx master

2016-04-11 Thread Tom Rini
On Fri, Apr 08, 2016 at 03:45:07PM -0700, York Sun wrote:

> Tom,
> 
> The following changes since commit 46a16bd895144617575c788d9c2554aeef76ac44:
> 
>   kirkwood_nand: claim MPP pins on the fly (2016-04-06 15:40:33 +0200)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-mpc85xx.git master
> 
> for you to fetch changes up to 50689461205e0125759eb1a43787383a3fa09b48:
> 
>   powerpc: mpc85xx: Enable pre-relocation malloc for MPC85xx (2016-04-08
> 15:42:10 -0700)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] board: ti: am57xx: Update EMIF SDRAM 1 and 3 Timings

2016-04-11 Thread Tom Rini
On Fri, Apr 08, 2016 at 04:53:44PM -0500, Nishanth Menon wrote:

> From: Schuyler Patton 
> 
> Update EMIF data based on recommendations from the now standard TI
> EMIF tool version 1.1.1 based on 256MBx16 DDR3L Kingston D2516EC4BXGGB
> data sheet
> 
> Update T_RRD from 5 to 6 based on AM57xx TRM -
> Minimum number of DDR cycles from activate to ativate for a different
> bank, minus 1.
> 
> Update T_CKESR from 4 to 3 based on AM57xx TRM - Minimum number of DDR
> clocks cycles for which SDRAM must remain in self refresh, minus 1.
> 
> Signed-off-by: Schuyler Patton 
> Signed-off-by: Nishanth Menon 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH] board: ti: am57xx: Add support for am572x idk in SPL

2016-04-11 Thread Tom Rini
On Fri, Apr 08, 2016 at 05:01:29PM -0500, Nishanth Menon wrote:

> From: Steve Kipisz 
> 
> The AM572x-IDK board (Industrial Dev Kit) is a board based on TI's AM5728x
> SOC which has a dual core 1.5GHz A15 processor. This board is a development
> platform for the Industrial market with:
> - 2GB of DDR3L
> - Dual 1Gbps Ethernet
> - HDMI,
> - PRU-ICSS
> - uSD
> - 16GB eMMC
> - CAN
> - RS-485
> - PCIe
> - USB3.0
> - Video Input Port
> - Industrial IO port and expansion connector
> 
> The link to the data sheet and TRM can be found here:
> 
> http://www.ti.com/product/AM5728
> 
> NOTE: DT support is still pending upstream kernel acceptance but we
> should be able to get the base system support with this patch.
> 
> Signed-off-by: Schuyler Patton 
> Signed-off-by: Steve Kipisz 
> Signed-off-by: Nishanth Menon 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 03/11] ti_omap5_common: eth: do not define DM_ETH for spl

2016-04-11 Thread Tom Rini
On Thu, Apr 07, 2016 at 08:47:02PM +0530, Mugunthan V N wrote:

> Since omap's spl doesn't support DM currently, do not define
> DM_ETH for spl build.
> 
> Signed-off-by: Mugunthan V N 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 04/11] drivers: net: cpsw: fix cpsw dp parse when num slaves as 1

2016-04-11 Thread Tom Rini
On Thu, Apr 07, 2016 at 08:47:03PM +0530, Mugunthan V N wrote:

> On some boards number of slaves can be 1 when only one port
> ethernet is pinned out. So do not break when slave_index and
> num slaves check fails, instead continue to parse the next
> child.
> 
> Signed-off-by: Mugunthan V N 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 05/11] ARM: omap5: add platform specific ethernet phy modes configurations

2016-04-11 Thread Tom Rini
On Thu, Apr 07, 2016 at 08:47:04PM +0530, Mugunthan V N wrote:

> Add platforms specific phy mode configuration bits to be used
> to configure phy mode in control module.
> 
> Signed-off-by: Mugunthan V N 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 07/11] arm: dts: am4372: add syscon node to cpsw to read mac address

2016-04-11 Thread Tom Rini
On Thu, Apr 07, 2016 at 08:47:06PM +0530, Mugunthan V N wrote:

> Add syscon node to cpsw device node to read mac address
> from efuse.
> 
> Signed-off-by: Mugunthan V N 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 08/11] arm: dts: dra7: add syscon node to cpsw to read mac address

2016-04-11 Thread Tom Rini
On Thu, Apr 07, 2016 at 08:47:07PM +0530, Mugunthan V N wrote:

> Add syscon node to cpsw device node to read mac address
> from efuse.
> 
> Signed-off-by: Mugunthan V N 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 06/11] drivers: net: cpsw: add support for reading mac address from efuse

2016-04-11 Thread Tom Rini
On Thu, Apr 07, 2016 at 08:47:05PM +0530, Mugunthan V N wrote:

> Different TI platforms has to read with different combination to
> get the mac address from efuse. So add support to read mac address
> based on machine/device compatibles.
> 
> The code is taken from Linux drivers/net/ethernet/ti/cpsw-common.c
> done by Tony Lindgren.
> 
> Signed-off-by: Mugunthan V N 

... but we don't do anything with the half dozen copies of that code
that we already have in the tree and it needs to also take care of
setting ethaddr.

-- 
Tom


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


Re: [U-Boot] [PATCH 09/11] defconfig: am437x_gp_evm: enable eth driver model

2016-04-11 Thread Tom Rini
On Thu, Apr 07, 2016 at 08:47:08PM +0530, Mugunthan V N wrote:

> Enable eth driver model for am437x_gp_evm as cpsw supports
> driver model.
> 
> Signed-off-by: Mugunthan V N 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 11/11] defconfig: dra74_evm: enable eth driver model

2016-04-11 Thread Tom Rini
On Thu, Apr 07, 2016 at 08:47:10PM +0530, Mugunthan V N wrote:

> Enable eth driver model for dra74_evm as cpsw supports
> driver model.
> 
> Signed-off-by: Mugunthan V N 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 10/11] defconfig: am437x_sk_evm: enable eth driver model

2016-04-11 Thread Tom Rini
On Thu, Apr 07, 2016 at 08:47:09PM +0530, Mugunthan V N wrote:

> Enable eth driver model for am437x_sk_evm as cpsw supports
> driver model.
> 
> Signed-off-by: Mugunthan V N 

Reviewed-by: Tom Rini 

-- 
Tom


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


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

2016-04-11 Thread Tom Rini
On Sun, Apr 10, 2016 at 09:17:46PM +0200, Marek Vasut wrote:

> The following changes since commit 43d3fb5c0609a76409e7859a2a5800670c7b5bd2:
> 
>   Merge branch 'master' of git://git.denx.de/u-boot-fsl-qoriq
> (2016-04-06 14:17:22 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-usb.git master
> 
> for you to fetch changes up to 192eab9357473e09218e0a4448b220d691d9d886:
> 
>   dm: usb: Do not reprobe usb hosts on "usb tree" command (2016-04-10
> 17:18:43 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


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

2016-04-11 Thread Tom Rini
On Sun, Apr 10, 2016 at 09:18:43PM +0200, Marek Vasut wrote:

> The following changes since commit 43d3fb5c0609a76409e7859a2a5800670c7b5bd2:
> 
>   Merge branch 'master' of git://git.denx.de/u-boot-fsl-qoriq
> (2016-04-06 14:17:22 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-socfpga.git master
> 
> for you to fetch changes up to f6060ce4bb0673bed8331441e985620b1b24adbd:
> 
>   arm: socfpga: Drop space after 'loadaddr=' in extra env (2016-04-10
> 17:19:49 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH V3] common: env: support sata device

2016-04-11 Thread Tom Rini
On Sat, Apr 09, 2016 at 12:35:12PM -0600, Simon Glass wrote:
> On 8 April 2016 at 13:45, Tom Rini  wrote:
> > On Sun, Apr 03, 2016 at 09:52:13PM +0800, Peng Fan wrote:
> >
> >> Introduce env support for sata device.
> >> 1. Implement write_env/read_env/env_relocate_spec/saveenv/sata_get_env_dev
> >> 2. If want to enable this feature, define CONFIG_ENV_IS_IN_SATA, and
> >>define CONFIG_SYS_SATA_ENV_DEV or implement your own sata_get_ev_dev.
> >>
> >> Signed-off-by: Peng Fan 
> >> Cc: Simon Glass 
> >> Cc: Joe Hershberger 
> >> Cc: Bin Meng 
> >> Cc: Stefan Roese 
> >> Cc: Heiko Schocher 
> >> Cc: Stuart Longland 
> >> Cc: Maxime Ripard 
> >> Cc: Tom Rini 
> >
> > Reviewed-by: Tom Rini 
> >
> > --
> > Tom
> 
> Ugh, we really should move this to linker lists or driver model. Do we
> really want to make that conversion even harder by adding one more
> option?

linker lists for env?  But I'd put Kconfig'ing env at the top of my wish
list for env changes before DM.  This should be an easy conversion too
:)

-- 
Tom


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


Re: [U-Boot] [PATCH 6/6] i2c: designware_i2c: Add support for PCI(e) based I2C cores (x86)

2016-04-11 Thread Stefan Roese

Hi Simon,

On 04.04.2016 16:53, Stefan Roese wrote:

Hi Simon,

as you seem to be back from vacation (?), we (Bin and myself) would
like to hear your expert comment on a x86 issue I've discovered
while porting the Designware I2C driver to x86. Please see below:

On 28.03.2016 08:01, Bin Meng wrote:

Hi Stefan,

On Mon, Mar 21, 2016 at 10:04 PM, Stefan Roese  wrote:

Hi Bin,

On 21.03.2016 13:43, Bin Meng wrote:

On Mon, Mar 21, 2016 at 8:04 PM, Stefan Roese  wrote:

Hi Bin,

On 21.03.2016 10:03, Stefan Roese wrote:




  static int designware_i2c_probe_chip(struct udevice *bus, uint chip_addr,
@@ -476,14 +519,45 @@ static int designware_i2c_probe(struct udevice *bus)
  {
 struct dw_i2c *priv = dev_get_priv(bus);

+#ifdef CONFIG_X86
+   /* Save base address from PCI BAR */
+   priv->regs = (struct i2c_regs *)
+   dm_pci_map_bar(bus, PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
+   /* Use BayTrail specific timing values */
+   priv->scl_sda_cfg = &byt_config;
+#else


How about:

 if (device_is_on_pci_bus(dev)) {
 do the PCI I2C stuff here;
 }


I've tried this but it generated compilation errors on socfpga, as the
dm_pci_xxx functions are not available there. So it definitely needs
some #ifdef here. I could go with your suggestion and use
#if CONFIG_DM_PCI as well.


See driver/net/designware.c for example.


 /* Save base address from device-tree */
 priv->regs = (struct i2c_regs *)dev_get_addr(bus);
+#endif


Enabling this code for x86 via if (device_is_on_pci_bus(dev)) results
in this ugly compilation warning:

drivers/i2c/designware_i2c.c: In function ‘designware_i2c_probe’:
drivers/i2c/designware_i2c.c:530:16: warning: cast to pointer from integer of 
different size [-Wint-to-pointer-cast]
  priv->regs = (struct i2c_regs *)dev_get_addr(bus);
   ^

This is because x86 defines fdt_addr_t / phys_addr_t as 64bit. So
I'm wondering, how dev_get_addr() should get used on x86. Has it
been used anywhere here at all? Should we perhaps go back to
a 32bit phy_addr representation again? So that dev_get_addr()
matches the (void *) size again?



dev_get_addr() is being used on x86 drivers. See
ns16550_serial_ofdata_to_platdata() for example. There is no build
warning for the ns16550 driver.


Looking closer, the warning does not occur here, since the registers
are stored in a u32 variable "base". And assigning a 64bit value to a
32bit variable as in "plat->base = addr" in ns16550.c does not cause any
warnings.

Here in the I2C driver though, the base address is stored as a pointer
(pointer size is 32 bit for x86). And this triggers this warning, even
though its effectively the same assignment. I could cast to u32 but this
would cause problems on 64 bit architectures using this driver (in the
future). So I came up with this approach:


Thanks for digging out these.



/*
   * On x86, "fdt_addr_t" is 64bit but "void *" only 32bit. So assigning the
   * register base directly in dev_get_addr() results in this compilation 
warning:
   * warning: cast to pointer from integer of different size
   *
   * Using this macro POINTER_SIZE_CAST, allows us to cast the result of
   * dev_get_addr() into a 32bit value before casting it to the pointer
   * (struct i2c_regs *).
   */
#ifdef CONFIG_X86
#define POINTER_SIZE_CAST   u32
#endif

...

static int designware_i2c_probe(struct udevice *bus)
{
  struct dw_i2c *priv = dev_get_priv(bus);

  if (device_is_on_pci_bus(bus)) {
#ifdef CONFIG_DM_PCI
  /* Save base address from PCI BAR */
  priv->regs = (struct i2c_regs *)
  dm_pci_map_bar(bus, PCI_BASE_ADDRESS_0, 
PCI_REGION_MEM);
#ifdef CONFIG_X86
  /* Use BayTrail specific timing values */
  priv->scl_sda_cfg = &byt_config;
#endif
#endif
  } else {
  /* Save base address from device-tree */
  priv->regs = (struct i2c_regs 
*)(POINTER_SIZE_CAST)dev_get_addr(bus);
  }

But I'm not 100% happy with this approach.



Yes, it's annoying.


So what are the alternatives:

a) Don't compile the  dev_get_addr() part for x86 similar to what I've
 done in v1

b) This approach with POINTER_SIZE_CAST

Any preferences of other ideas?

Side note: My general feeling is, that dev_get_addr() should be able to
get cast into a pointer on all platforms. This is how it is used in many
drivers, btw. Since this is not possible on x86, we might have a problem
here. Simon might have some ideas on this as well...



I would like to hear Simon's input. Simon?


Yes, Simon, what do you think?

Please also see my v2 of this patch which uses (__UINTPTR_TYPE__)
for the cast:

https://patchwork.ozlabs.org/patch/601113/


Simon, could you please take a quick look at this patch? With the
general problem of dev_get_addr() on x86 (as described above). Do you
have some other suggestions to solve this? Or 

Re: [U-Boot] Newbie SPL question for socfpga_sockit

2016-04-11 Thread Marek Vasut
On 04/11/2016 04:03 AM, George Broz wrote:
> On 10 April 2016 at 10:47, Marek Vasut  wrote:
>> On 04/09/2016 12:40 AM, George Broz wrote:
>>> On 8 April 2016 at 05:36, Marek Vasut  wrote:
 On 04/08/2016 07:16 AM, Stefan Roese wrote:
> On 08.04.2016 01:51, George Broz wrote:
>
> 
>
> Try with the attached patch (and probably with dcache off)

 The patch applied cleanly. The behavior is unchanged with both
 dcache on and off. The "good" sticks still work, and "bad" sticks 
 still don't.
>>>
>>> OK. Then I should probably go hunting for Kingston DataTraveler SE9,
>>> right ? Can you give me a link to the stick you have, so I know what
>>> crappy device to look for ? Thanks!
>>
>> Here it is [1] - I have the 8GB version.
>>
>> I think there will always be crappy sticks that don't work... but do you
>> have any advice as to what properties will/might generally cause a 
>> problem?
>>
>> [1] 
>> http://www.amazon.com/Kingston-Digital-DataTraveler-DTSE9H-16GBZET/dp/B00DYQYITG
>
> I have exactly this stick here (16GiB) version. And it is detected just
> fine in both, current mainline Armada XP (theadorable) and x86 boards
> (conga-qeval20-qa3-e3845). Here my lsusb output:

 I bought the kingston stick and it's not detected on SoCFPGA SoCkit at
 all. Ouch :-(

 [...]
 Best regards,
 Marek Vasut
>>>
>>> For what it's worth - here is the marking on the OTG chip on the 
>>> de0_nano_soc:
>>>
>>> SMSC
>>> 3300-EZK
>>> A1515AC13
>>> 515AR3A
>>> ASETV
>>
>> OK, that's the standard/recommended USB3300 PHY. I will keep fiddling
>> with the Kingston SE9 USB stick to see what's going on, that's probably
>> some other issue than the cache issue though.
>>
> On my third order for an OTG USB mini cable from Amazon, I finally got an
> actual OTG cable!
> 
> On the SoCKit, using this cable the "dwc_otg_core_host_init: Timeout!"
> messages no longer appear.
> 
> A few of the USB sticks I have here are immediately recognized and function
> normally - a first for me with the latest version of u-boot. For
> others, like the
> Kingston SE9 stick, I get the same result as you - it's not detected at all.
> 
> I have yet to find one of the non-working USB sticks on the SoCKit
> fail with the
> same sort of long timeout followed by the zombie behavior exhibited by the
> DE0/Kingston combination.

Thanks for checking. I also have the SE9 here and it fails indeed, I
will have to look into it later.


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


  1   2   3   >