Re: [U-Boot] [PATCH 6/8] clk: zynq: Add zynq clock framework driver

2017-01-10 Thread Sören Brinkmann
On Tue, 2017-01-10 at 15:57:09 +0100, Michal Simek wrote:
> +Soren
> 
> On 4.1.2017 13:27, stefan.herbrechtsme...@weidmueller.com wrote:
> > From: Stefan Herbrechtsmeier 
> > 
> > Add a clock framework driver for the zynq platform. The driver is based
> > on the platform zynq clock driver but reworked to use static functions
> > instead of run-time generated objects even for unused clocks.
> > Additionally the CONFIG_ZYNQ_PS_CLK_FREQ is replaced by the
> > ps-clk-frequency from the device tree.
> > 
> > Signed-off-by: Stefan Herbrechtsmeier 
> > 
> > ---
> > 
> >  drivers/clk/Kconfig|   7 +
> >  drivers/clk/Makefile   |   1 +
> >  drivers/clk/clk_zynq.c | 470 
> > +
> >  3 files changed, 478 insertions(+)
> >  create mode 100644 drivers/clk/clk_zynq.c
> > 
> > diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> > index c05ce2a..714ccca 100644
> > --- a/drivers/clk/Kconfig
> > +++ b/drivers/clk/Kconfig
> > @@ -28,6 +28,13 @@ config CLK_BOSTON
> > help
> >   Enable this to support the clocks
> >  
> > +config CLK_ZYNQ
> > +   bool "Zynq clock driver"
> > +   depends on CLK && ARCH_ZYNQ
> > +   default y
> > +   help
> > + Enable this to support the clocks
> > +
> >  source "drivers/clk/tegra/Kconfig"
> >  source "drivers/clk/uniphier/Kconfig"
> >  source "drivers/clk/exynos/Kconfig"
> > diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> > index 40a5e8c..5e5b6b1 100644
> > --- a/drivers/clk/Makefile
> > +++ b/drivers/clk/Makefile
> > @@ -16,3 +16,4 @@ obj-$(CONFIG_CLK_UNIPHIER) += uniphier/
> >  obj-$(CONFIG_CLK_EXYNOS) += exynos/
> >  obj-$(CONFIG_CLK_AT91) += at91/
> >  obj-$(CONFIG_CLK_BOSTON) += clk_boston.o
> > +obj-$(CONFIG_CLK_ZYNQ) += clk_zynq.o
> > diff --git a/drivers/clk/clk_zynq.c b/drivers/clk/clk_zynq.c
> > new file mode 100644
> > index 000..d276155
> > --- /dev/null
> > +++ b/drivers/clk/clk_zynq.c
> > @@ -0,0 +1,470 @@
> > +/*
> > + * Copyright (C) 2017 Weidmüller Interface GmbH & Co. KG
> > + * Stefan Herbrechtsmeier 
> > + *
> > + * Copyright (C) 2013 Soren Brinkmann 
> > + * Copyright (C) 2013 Xilinx, Inc. All rights reserved.
> > + *
> > + * SPDX-License-Identifier:GPL-2.0+
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/* Register bitfield defines */
> > +#define PLLCTRL_FBDIV_MASK 0x7f000
> > +#define PLLCTRL_FBDIV_SHIFT12
> > +#define PLLCTRL_BPFORCE_MASK   (1 << 4)
> > +#define PLLCTRL_PWRDWN_MASK2
> > +#define PLLCTRL_PWRDWN_SHIFT   1
> > +#define PLLCTRL_RESET_MASK 1
> > +#define PLLCTRL_RESET_SHIFT0
> > +
> > +#define ZYNQ_CLK_MAXDIV0x3f
> > +#define CLK_CTRL_DIV1_SHIFT20
> > +#define CLK_CTRL_DIV1_MASK (ZYNQ_CLK_MAXDIV << CLK_CTRL_DIV1_SHIFT)
> > +#define CLK_CTRL_DIV0_SHIFT8
> > +#define CLK_CTRL_DIV0_MASK (ZYNQ_CLK_MAXDIV << CLK_CTRL_DIV0_SHIFT)
> > +#define CLK_CTRL_SRCSEL_SHIFT  4
> > +#define CLK_CTRL_SRCSEL_MASK   (0x3 << CLK_CTRL_SRCSEL_SHIFT)
> > +
> > +#define CLK_CTRL_DIV2X_SHIFT   26
> > +#define CLK_CTRL_DIV2X_MASK(ZYNQ_CLK_MAXDIV << 
> > CLK_CTRL_DIV2X_SHIFT)
> > +#define CLK_CTRL_DIV3X_SHIFT   20
> > +#define CLK_CTRL_DIV3X_MASK(ZYNQ_CLK_MAXDIV << 
> > CLK_CTRL_DIV3X_SHIFT)
> > +
> > +#define ZYNQ_CLKMUX_SEL_0  0
> > +#define ZYNQ_CLKMUX_SEL_1  1
> > +#define ZYNQ_CLKMUX_SEL_2  2
> > +#define ZYNQ_CLKMUX_SEL_3  3
> > +
> > +DECLARE_GLOBAL_DATA_PTR;
> > +
> > +#ifndef CONFIG_SPL_BUILD
> > +enum zynq_clk_rclk {mio_clk, emio_clk};
> > +#endif
> > +
> > +struct zynq_clk_priv {
> > +   ulong ps_clk_freq;
> > +};
> > +
> > +static void *zynq_clk_get_register(enum zynq_clk id)
> > +{
> > +   switch (id) {
> > +   case armpll_clk:
> > +   return _base->arm_pll_ctrl;
> > +   case ddrpll_clk:
> > +   return _base->ddr_pll_ctrl;
> > +   case iopll_clk:
> > +   return _base->io_pll_ctrl;
> > +#ifndef CONFIG_SPL_BUILD
> > +   case dci_clk:
> > +   return _base->dci_clk_ctrl;
> > +#endif
> > +   case lqspi_clk:
> > +   return _base->lqspi_clk_ctrl;
> > +   case smc_clk:
> > +   return _base->smc_clk_ctrl;
> > +   case pcap_clk:
> > +   return _base->pcap_clk_ctrl;
> > +#ifndef CONFIG_SPL_BUILD
> > +   case gem0_clk:
> > +   return _base->gem0_clk_ctrl;
> > +   case gem1_clk:
> > +   return _base->gem1_clk_ctrl;
> > +   case fclk0_clk:
> > +   return _base->fpga0_clk_ctrl;
> > +   case fclk1_clk:
> > +   return _base->fpga1_clk_ctrl;
> > +   case fclk2_clk:
> > +   return _base->fpga2_clk_ctrl;
> > +   case fclk3_clk:
> > +   return _base->fpga3_clk_ctrl;
> > +   case can0_clk ... can1_clk:
> > +   return _base->can_clk_ctrl;
> > 

Re: [U-Boot] [PATCH 6/9] ARM: zynq: Clean DTSI coding style

2016-01-14 Thread Sören Brinkmann
On Thu, 2016-01-14 at 02:44PM +0100, Michal Simek wrote:
> From: Michal Simek <mon...@monstr.eu>
> 
> Fix minor indentation problems.
> 
> Signed-off-by: Michal Simek <mon...@monstr.eu>
> Signed-off-by: Michal Simek <michal.si...@xilinx.com>
Reviewed-by: Sören Brinkmann <soren.brinkm...@xilinx.com>

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


Re: [U-Boot] [RFC] zynq: Add support for E3xx board.

2015-09-04 Thread Sören Brinkmann
Hi Moritz,

On Thu, 2015-09-03 at 11:44AM -0700, Moritz Fischer wrote:
> Signed-off-by: Moritz Fischer 
> ---
>  arch/arm/dts/Makefile | 3 +-
>  arch/arm/dts/zynq-e3xx.dts|35 +
>  arch/arm/mach-zynq/Kconfig| 4 +
>  board/xilinx/zynq/Makefile| 2 +
>  board/xilinx/zynq/e3xx_hw_platform/ps7_init_gpl.c | 13446 
> 
>  board/xilinx/zynq/e3xx_hw_platform/ps7_init_gpl.h |   130 +
>  configs/zynq_e3xx_defconfig   |12 +
>  include/configs/zynq_e3xx.h   |29 +
>  8 files changed, 13660 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index c97f39d..bb5cb34 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -43,7 +43,8 @@ dtb-$(CONFIG_ARCH_UNIPHIER) += \
>   uniphier-ph1-pro4-ref.dtb \
>   uniphier-ph1-sld3-ref.dtb \
>   uniphier-ph1-sld8-ref.dtb
> -dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb \
> +dtb-$(CONFIG_ARCH_ZYNQ) += zynq-e3xx.dtb \
> + zynq-zc702.dtb \

Just a nit, but should we make this
+dtb-$(CONFIG_ARCH_ZYNQ) += \
+   zynq-e3xx.dtb \
+   zynq-zc702.dtb \
...

Then, when more boards are added we have just simple additions of lines
and get rid of the removal in the diffs.

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


Re: [U-Boot] [PATCH 15/19] ARM: zynq: DT: Get rid of ps-clk-frequency

2015-07-22 Thread Sören Brinkmann
On Wed, 2015-07-22 at 05:38PM +0200, Michal Simek wrote:
 ps-clk-frequency is platform specific setting and shouldn't be the part
 of DTSI.
 
 Signed-off-by: Michal Simek michal.si...@xilinx.com
 ---
 
 Sync with mainline.
 
 ---
  arch/arm/dts/zynq-7000.dtsi | 1 -
  1 file changed, 1 deletion(-)
 
 diff --git a/arch/arm/dts/zynq-7000.dtsi b/arch/arm/dts/zynq-7000.dtsi
 index a1de993b9812..095c0f67e167 100644
 --- a/arch/arm/dts/zynq-7000.dtsi
 +++ b/arch/arm/dts/zynq-7000.dtsi
 @@ -241,7 +241,6 @@
   clkc: clkc@100 {
   #clock-cells = 1;
   compatible = xlnx,ps7-clkc;
 - ps-clk-frequency = ;

If you remove it here, shouldn't it be added in the board dts files at
the same time (the Linux implementation may default to 33MHz, but that
is implementation and not guaranteed according to the bindings)?

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


Re: [U-Boot] [PATCH v2 2/3] ARM: zynq: use separate configuration for ZC702 and ZC706

2015-04-21 Thread Sören Brinkmann
On Fri, 2015-04-17 at 10:38AM +0900, Masahiro Yamada wrote:
 Hi Sören,
 
 
 2015-04-15 1:03 GMT+09:00 Sören Brinkmann soren.brinkm...@xilinx.com:
  On Tue, 2015-04-14 at 04:50PM +0900, Masahiro Yamada wrote:
  Separate CONFIG_TARGET_ZYNQ_{ZC702,ZC706} which is necessary
  for the next commit.  Adjust doc/README.zynq too.
 
  Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com
  ---
 
  Changes in v2: None
 
   arch/arm/cpu/armv7/zynq/Kconfig|  9 ++---
   configs/{zynq_zc70x_defconfig = zynq_zc702_defconfig} |  2 +-
   configs/zynq_zc706_defconfig   | 11 +++
   doc/README.zynq| 15 
  ---
   4 files changed, 22 insertions(+), 15 deletions(-)
   rename configs/{zynq_zc70x_defconfig = zynq_zc702_defconfig} (88%)
   create mode 100644 configs/zynq_zc706_defconfig
 
  diff --git a/arch/arm/cpu/armv7/zynq/Kconfig 
  b/arch/arm/cpu/armv7/zynq/Kconfig
  index 3a52535..ab4768a 100644
  --- a/arch/arm/cpu/armv7/zynq/Kconfig
  +++ b/arch/arm/cpu/armv7/zynq/Kconfig
  @@ -9,8 +9,11 @@ config TARGET_ZYNQ_ZED
   config TARGET_ZYNQ_MICROZED
bool Zynq MicroZed
 
  -config TARGET_ZYNQ_ZC70X
  - bool Zynq ZC702/ZC706 Board
  +config TARGET_ZYNQ_ZC702
  + bool Zynq ZC702 Board
  +
  +config TARGET_ZYNQ_ZC706
  + bool Zynq ZC706 Board
 
  Is there a good way to make this more friendly towards a user who is
  familiar with the current flow? By simply removing it, we'll get plenty
  of support requests asking what happened. Also, it would void all the
  documentation we have in wikis etc. A more soft migration path would be
  better.
 
 
 
 Currently, the difference between ZC702 and ZC706 is just their device trees.
 
 So, we can use $(DEVICE_TREE) for distinguishing one from the other. Like 
 this.
 
 8---
 DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:%=%)
 
 hw-platform-$(CONFIG_TARGET_ZYNQ_ZED)   := zed_hw_platform
 hw-platform-$(CONFIG_TARGET_ZYNQ_MICROZED)  := MicroZed_hw_platform
 hw-platform-$(CONFIG_TARGET_ZYNQ_ZC70X) := $(if $(filter
 zynq-zc702 $(DEVICE_TREE)), ZC702_hw_platform, ZC706_hw_platform)
 8---
 
 
 
 Another option is to reject this series and stick to the current work-flow.
 It is up to you and Michal, of course.
 The path to ps7_init_gpl.[ch] will change, anyway.
 If it is troublesome, I do not persist on this series.

I personally think the patches are going into the right direction. But
I'd highly prefer having a clean migration path for all people that
build a zynq_zc70x config. Something similar we did with the
ps7_init_gpl files perhaps? Just something that gives us time to
migrate users and documentation to the new flow without breaking them
all.

Sören

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


Re: [U-Boot] [PATCH v2 2/3] ARM: zynq: use separate configuration for ZC702 and ZC706

2015-04-14 Thread Sören Brinkmann
On Tue, 2015-04-14 at 04:50PM +0900, Masahiro Yamada wrote:
 Separate CONFIG_TARGET_ZYNQ_{ZC702,ZC706} which is necessary
 for the next commit.  Adjust doc/README.zynq too.
 
 Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com
 ---
 
 Changes in v2: None
 
  arch/arm/cpu/armv7/zynq/Kconfig|  9 ++---
  configs/{zynq_zc70x_defconfig = zynq_zc702_defconfig} |  2 +-
  configs/zynq_zc706_defconfig   | 11 +++
  doc/README.zynq| 15 ---
  4 files changed, 22 insertions(+), 15 deletions(-)
  rename configs/{zynq_zc70x_defconfig = zynq_zc702_defconfig} (88%)
  create mode 100644 configs/zynq_zc706_defconfig
 
 diff --git a/arch/arm/cpu/armv7/zynq/Kconfig b/arch/arm/cpu/armv7/zynq/Kconfig
 index 3a52535..ab4768a 100644
 --- a/arch/arm/cpu/armv7/zynq/Kconfig
 +++ b/arch/arm/cpu/armv7/zynq/Kconfig
 @@ -9,8 +9,11 @@ config TARGET_ZYNQ_ZED
  config TARGET_ZYNQ_MICROZED
   bool Zynq MicroZed
  
 -config TARGET_ZYNQ_ZC70X
 - bool Zynq ZC702/ZC706 Board
 +config TARGET_ZYNQ_ZC702
 + bool Zynq ZC702 Board
 +
 +config TARGET_ZYNQ_ZC706
 + bool Zynq ZC706 Board

Is there a good way to make this more friendly towards a user who is
familiar with the current flow? By simply removing it, we'll get plenty
of support requests asking what happened. Also, it would void all the
documentation we have in wikis etc. A more soft migration path would be
better.

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


Re: [U-Boot] [PATCH 2/2] ARM: zynq: add default ps7_init_gpl.c/h for Zed, MicroZed, ZC70x

2015-04-12 Thread Sören Brinkmann
On Mon, 2015-04-13 at 10:28AM +0900, Masahiro Yamada wrote:
 Hi Sören,
 
 2015-04-12 11:45 GMT+09:00 Sören Brinkmann soren.brinkm...@xilinx.com:
 
 
   Does this mechanism allow to build for one of the supported boards (e.g.
   zc706) using custom init files? We need to maintain this capability,
   IMHO, since these initfiles are generated by Xilinx tools depending on
   various settings in Vivado. They can be quite different between
   use-cases/applications, even when targeting the same board.
 
  Don't worry.  Custom init files are still supporte.
  I added CONFIG_ZYNQ_CUSTOM_INIT.
 
  But doesn't it cause 'multiple definition of...' like errors if I copy
  custom ps7_init files additionally to the already present ones into the
  source tree? Looking at the Makefile above, it seems for a supported
  board, it would add board_hw_platform/ps7_init_gpl.o _and_
  custom_hw_platform/ps7_init_gpl.o - both defining the same symbols. Or
  am I missing something?
 
 I do not think the multiple definition error will happen.
 
 
 
 Please see the following part of my patch.
 
 +# Copied from Xilinx SDK 2014.4
 +ps7-init-$(CONFIG_TARGET_ZYNQ_ZED) := zed_hw_platform/ps7_init_gpl.o
 +ps7-init-$(CONFIG_TARGET_ZYNQ_MICROZED) := 
 MicroZed_hw_platform/ps7_init_gpl.o
 +ps7-init-$(CONFIG_TARGET_ZYNQ_ZC702) := ZC702_hw_platform/ps7_init_gpl.o
 +ps7-init-$(CONFIG_TARGET_ZYNQ_ZC706) := ZC706_hw_platform/ps7_init_gpl.o
 +# If you want to use customized ps7_init_gpl.c/h (or ps7_init.c/h),
 +# enable CONFIG_ZYNQ_CUSTOM_INIT and put them into custom_hw_platform/.
 +ps7-init-$(CONFIG_ZYNQ_CUSTOM_INIT) := \
 + $(if $(wildcard $(srctree)/$(src)/custom_hw_platform/ps7_init_gpl.c), \
 + custom_hw_platform/ps7_init_gpl.o, \
 + $(if $(wildcard $(srctree)/$(src)/custom_hw_platform/ps7_init.c), \
 + custom_hw_platform/ps7_init.o custom_hw_platform/legacy.o))
 +
 
 
 The source files are added by :=, not +=.
 This is intentional.
 
 If CONFIG_ZYNQ_CUSTOM_INIT is enabled, the files in
 custom_hw_platform/ directory
 take precedence over the default ones.

I see, that's the detail I missed :) Probably worth mentioning it in the
comment? That the CUSTOM_INIT part needs to be the last in the file?

Anyway:
Acked-by: Sören Brinkmann soren.brinkm...@xilinx.com

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


Re: [U-Boot] [PATCH 2/2] ARM: zynq: add default ps7_init_gpl.c/h for Zed, MicroZed, ZC70x

2015-04-11 Thread Sören Brinkmann
On Thu, 2015-04-09 at 07:04PM +0900, Masahiro Yamada wrote:
 Due to licensing issues, the files ps7_init.c/h are not able to be
 distributed with U-Boot source code.  Recent Xilinx tools also
 provide the GPL version (ps7_init_gpl.c/h), compatible with U-Boot
 license.
 
 Prior to this commit, we had to copy ps7_init code into
 board/xilinx/zynq/ before the compile.
 
 To be more user-friendly, let's include ps7_init_gpl.c/h for
 Zedboard, MicroZed, ZC702, ZC706.
 
 These init code have been taken from the hwplatform_templates
 directory of Xilinx SDK 2014.4.
 
 You can still use customized ps7_init code by enabling
 CONFIG_ZYNQ_CUSTOM_INIT.
 
 Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com
 ---
 
  arch/arm/cpu/armv7/zynq/Kconfig|10 +
  board/xilinx/zynq/Makefile |22 +-
  .../zynq/MicroZed_hw_platform/ps7_init_gpl.c   | 12978 ++
  .../zynq/MicroZed_hw_platform/ps7_init_gpl.h   |   130 +
  board/xilinx/zynq/ZC702_hw_platform/ps7_init_gpl.c | 13311 
 +++
  board/xilinx/zynq/ZC702_hw_platform/ps7_init_gpl.h |   130 +
  board/xilinx/zynq/ZC706_hw_platform/ps7_init_gpl.c | 13218 ++
  board/xilinx/zynq/ZC706_hw_platform/ps7_init_gpl.h |   130 +
  .../zynq/{ = custom_hw_platform}/.gitignore   | 0
  .../xilinx/zynq/{ = custom_hw_platform}/legacy.c  | 0
  board/xilinx/zynq/zed_hw_platform/ps7_init_gpl.c   | 12876 ++
  board/xilinx/zynq/zed_hw_platform/ps7_init_gpl.h   |   130 +
  12 files changed, 52931 insertions(+), 4 deletions(-)
  create mode 100644 board/xilinx/zynq/MicroZed_hw_platform/ps7_init_gpl.c
  create mode 100644 board/xilinx/zynq/MicroZed_hw_platform/ps7_init_gpl.h
  create mode 100644 board/xilinx/zynq/ZC702_hw_platform/ps7_init_gpl.c
  create mode 100644 board/xilinx/zynq/ZC702_hw_platform/ps7_init_gpl.h
  create mode 100644 board/xilinx/zynq/ZC706_hw_platform/ps7_init_gpl.c
  create mode 100644 board/xilinx/zynq/ZC706_hw_platform/ps7_init_gpl.h
  rename board/xilinx/zynq/{ = custom_hw_platform}/.gitignore (100%)
  rename board/xilinx/zynq/{ = custom_hw_platform}/legacy.c (100%)
  create mode 100644 board/xilinx/zynq/zed_hw_platform/ps7_init_gpl.c
  create mode 100644 board/xilinx/zynq/zed_hw_platform/ps7_init_gpl.h
 
 diff --git a/arch/arm/cpu/armv7/zynq/Kconfig b/arch/arm/cpu/armv7/zynq/Kconfig
 index ab4768a..e19cce0 100644
 --- a/arch/arm/cpu/armv7/zynq/Kconfig
 +++ b/arch/arm/cpu/armv7/zynq/Kconfig
 @@ -1,5 +1,13 @@
  if ZYNQ
  
 +config ZYNQ_CUSTOM_INIT
 + bool Use custom ps7_init provided by Xilinx tool
 + help
 +   U-Boot includes ps7_init_gpl.[ch] for some Zynq board variants.
 +   If you want to override them with customized ones
 +   or ps7_init code for your board is missing, please say Y here
 +   and add ones into board/xilinx/zynq/custom_hw_platform/ directory.
 +
  choice
   prompt Xilinx Zynq board select
  
 @@ -17,9 +25,11 @@ config TARGET_ZYNQ_ZC706
  
  config TARGET_ZYNQ_ZC770
   bool Zynq ZC770 Board
 + select ZYNQ_CUSTOM_INIT
  
  config TARGET_ZYNQ_ZYBO
   bool Zynq Zybo Board
 + select ZYNQ_CUSTOM_INIT
  
  endchoice
  
 diff --git a/board/xilinx/zynq/Makefile b/board/xilinx/zynq/Makefile
 index 3b1eb4f..7a82dfb 100644
 --- a/board/xilinx/zynq/Makefile
 +++ b/board/xilinx/zynq/Makefile
 @@ -7,11 +7,25 @@
  
  obj-y:= board.o
  
 -# Please copy ps7_init_gpl.c/h from hw project to this directory
 -obj-$(CONFIG_SPL_BUILD) += \
 - $(if $(wildcard $(srctree)/$(src)/ps7_init_gpl.c), 
 ps7_init_gpl.o, \
 - $(if $(wildcard $(srctree)/$(src)/ps7_init.c), 
 ps7_init.o legacy.o))
 +# Copied from Xilinx SDK 2014.4
 +ps7-init-$(CONFIG_TARGET_ZYNQ_ZED)   := zed_hw_platform/ps7_init_gpl.o
 +ps7-init-$(CONFIG_TARGET_ZYNQ_MICROZED)  := 
 MicroZed_hw_platform/ps7_init_gpl.o
 +ps7-init-$(CONFIG_TARGET_ZYNQ_ZC702) := ZC702_hw_platform/ps7_init_gpl.o
 +ps7-init-$(CONFIG_TARGET_ZYNQ_ZC706) := ZC706_hw_platform/ps7_init_gpl.o
 +# If you want to use customized ps7_init_gpl.c/h (or ps7_init.c/h), 
 +# enable CONFIG_ZYNQ_CUSTOM_INIT and put them into custom_hw_platform/.
 +ps7-init-$(CONFIG_ZYNQ_CUSTOM_INIT)  := \
 + $(if $(wildcard $(srctree)/$(src)/custom_hw_platform/ps7_init_gpl.c), \
 + custom_hw_platform/ps7_init_gpl.o, \
 + $(if $(wildcard 
 $(srctree)/$(src)/custom_hw_platform/ps7_init.c), \
 + custom_hw_platform/ps7_init.o 
 custom_hw_platform/legacy.o))

IIRC, the support for the legacy files was mainly added to not break
existing flows, this patch does break those flows by changing the search
location for these init files. Hence, this may be an opportunity to
fully drop support for the legacy files?

Does this mechanism allow to build for one of the supported boards (e.g.
zc706) using custom init files? We need to maintain this capability,
IMHO, since these initfiles are generated by Xilinx tools depending 

Re: [U-Boot] [PATCH 2/2] ARM: zynq: add default ps7_init_gpl.c/h for Zed, MicroZed, ZC70x

2015-04-11 Thread Sören Brinkmann
On Sun, 2015-04-12 at 10:20AM +0900, Masahiro Yamada wrote:
 Hi Sören,
 
 2015-04-12 5:42 GMT+09:00 Sören Brinkmann soren.brinkm...@xilinx.com:
  On Thu, 2015-04-09 at 07:04PM +0900, Masahiro Yamada wrote:
  Due to licensing issues, the files ps7_init.c/h are not able to be
  distributed with U-Boot source code.  Recent Xilinx tools also
  provide the GPL version (ps7_init_gpl.c/h), compatible with U-Boot
  license.
 
  Prior to this commit, we had to copy ps7_init code into
  board/xilinx/zynq/ before the compile.
 
  To be more user-friendly, let's include ps7_init_gpl.c/h for
  Zedboard, MicroZed, ZC702, ZC706.
 
  These init code have been taken from the hwplatform_templates
  directory of Xilinx SDK 2014.4.
 
  You can still use customized ps7_init code by enabling
  CONFIG_ZYNQ_CUSTOM_INIT.
 
  Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com
  ---
 
   arch/arm/cpu/armv7/zynq/Kconfig|10 +
   board/xilinx/zynq/Makefile |22 +-
   .../zynq/MicroZed_hw_platform/ps7_init_gpl.c   | 12978 
  ++
   .../zynq/MicroZed_hw_platform/ps7_init_gpl.h   |   130 +
   board/xilinx/zynq/ZC702_hw_platform/ps7_init_gpl.c | 13311 
  +++
   board/xilinx/zynq/ZC702_hw_platform/ps7_init_gpl.h |   130 +
   board/xilinx/zynq/ZC706_hw_platform/ps7_init_gpl.c | 13218 
  ++
   board/xilinx/zynq/ZC706_hw_platform/ps7_init_gpl.h |   130 +
   .../zynq/{ = custom_hw_platform}/.gitignore   | 0
   .../xilinx/zynq/{ = custom_hw_platform}/legacy.c  | 0
   board/xilinx/zynq/zed_hw_platform/ps7_init_gpl.c   | 12876 
  ++
   board/xilinx/zynq/zed_hw_platform/ps7_init_gpl.h   |   130 +
   12 files changed, 52931 insertions(+), 4 deletions(-)
   create mode 100644 board/xilinx/zynq/MicroZed_hw_platform/ps7_init_gpl.c
   create mode 100644 board/xilinx/zynq/MicroZed_hw_platform/ps7_init_gpl.h
   create mode 100644 board/xilinx/zynq/ZC702_hw_platform/ps7_init_gpl.c
   create mode 100644 board/xilinx/zynq/ZC702_hw_platform/ps7_init_gpl.h
   create mode 100644 board/xilinx/zynq/ZC706_hw_platform/ps7_init_gpl.c
   create mode 100644 board/xilinx/zynq/ZC706_hw_platform/ps7_init_gpl.h
   rename board/xilinx/zynq/{ = custom_hw_platform}/.gitignore (100%)
   rename board/xilinx/zynq/{ = custom_hw_platform}/legacy.c (100%)
   create mode 100644 board/xilinx/zynq/zed_hw_platform/ps7_init_gpl.c
   create mode 100644 board/xilinx/zynq/zed_hw_platform/ps7_init_gpl.h
 
  diff --git a/arch/arm/cpu/armv7/zynq/Kconfig 
  b/arch/arm/cpu/armv7/zynq/Kconfig
  index ab4768a..e19cce0 100644
  --- a/arch/arm/cpu/armv7/zynq/Kconfig
  +++ b/arch/arm/cpu/armv7/zynq/Kconfig
  @@ -1,5 +1,13 @@
   if ZYNQ
 
  +config ZYNQ_CUSTOM_INIT
  + bool Use custom ps7_init provided by Xilinx tool
  + help
  +   U-Boot includes ps7_init_gpl.[ch] for some Zynq board variants.
  +   If you want to override them with customized ones
  +   or ps7_init code for your board is missing, please say Y here
  +   and add ones into board/xilinx/zynq/custom_hw_platform/ directory.
  +
   choice
prompt Xilinx Zynq board select
 
  @@ -17,9 +25,11 @@ config TARGET_ZYNQ_ZC706
 
   config TARGET_ZYNQ_ZC770
bool Zynq ZC770 Board
  + select ZYNQ_CUSTOM_INIT
 
   config TARGET_ZYNQ_ZYBO
bool Zynq Zybo Board
  + select ZYNQ_CUSTOM_INIT
 
   endchoice
 
  diff --git a/board/xilinx/zynq/Makefile b/board/xilinx/zynq/Makefile
  index 3b1eb4f..7a82dfb 100644
  --- a/board/xilinx/zynq/Makefile
  +++ b/board/xilinx/zynq/Makefile
  @@ -7,11 +7,25 @@
 
   obj-y:= board.o
 
  -# Please copy ps7_init_gpl.c/h from hw project to this directory
  -obj-$(CONFIG_SPL_BUILD) += \
  - $(if $(wildcard $(srctree)/$(src)/ps7_init_gpl.c), 
  ps7_init_gpl.o, \
  - $(if $(wildcard $(srctree)/$(src)/ps7_init.c), 
  ps7_init.o legacy.o))
  +# Copied from Xilinx SDK 2014.4
  +ps7-init-$(CONFIG_TARGET_ZYNQ_ZED)   := zed_hw_platform/ps7_init_gpl.o
  +ps7-init-$(CONFIG_TARGET_ZYNQ_MICROZED)  := 
  MicroZed_hw_platform/ps7_init_gpl.o
  +ps7-init-$(CONFIG_TARGET_ZYNQ_ZC702) := ZC702_hw_platform/ps7_init_gpl.o
  +ps7-init-$(CONFIG_TARGET_ZYNQ_ZC706) := ZC706_hw_platform/ps7_init_gpl.o
  +# If you want to use customized ps7_init_gpl.c/h (or ps7_init.c/h),
  +# enable CONFIG_ZYNQ_CUSTOM_INIT and put them into custom_hw_platform/.
  +ps7-init-$(CONFIG_ZYNQ_CUSTOM_INIT)  := \
  + $(if $(wildcard 
  $(srctree)/$(src)/custom_hw_platform/ps7_init_gpl.c), \
  + custom_hw_platform/ps7_init_gpl.o, \
  + $(if $(wildcard 
  $(srctree)/$(src)/custom_hw_platform/ps7_init.c), \
  + custom_hw_platform/ps7_init.o 
  custom_hw_platform/legacy.o))
 
  IIRC, the support for the legacy files was mainly added to not break
  existing flows, this patch does break those flows by changing the search
  location for these init files. Hence, this may be an opportunity

Re: [U-Boot] [PATCH] arm64: Add Xilinx ZynqMP support

2015-03-02 Thread Sören Brinkmann
On Mon, 2015-03-02 at 04:07PM +0100, Michal Simek wrote:
 On 03/02/2015 03:23 PM, Tom Rini wrote:
  On Mon, Mar 02, 2015 at 09:24:45AM +0100, Michal Simek wrote:
  On 03/02/2015 08:32 AM, Michal Simek wrote:
  On 02/27/2015 06:13 PM, Tom Rini wrote:
  On Tue, Feb 24, 2015 at 09:02:09AM +0100, Michal Simek wrote:
 
  Add basic Xilinx ZynqMP arm64 support.
  Serial and SD is supported.
  It supports emulation platfrom ep108 and QEMU.
 
  Signed-off-by: Michal Simek michal.si...@xilinx.com
  [snip]
  +/* Miscellaneous configurable options */
  +#define CONFIG_SYS_LOAD_ADDR   0x800
  +
  +/* Initial environment variables */
  +#define CONFIG_EXTRA_ENV_SETTINGS \
  +   ethaddr=00:0a:35:00:01:22\0 \
 
  No, you can't hard-code an ethaddr in.
 
  ah yeah.
 
 
  +   kernel_addr=0x20\0 \
  +   initrd_addr=0xa0\0 \
  +   initrd_size=0x200\0 \
 
  These are really close together.  And I imagine mirror the usual values
  on 32bit platforms.  Maybe it's time to move them around a bit for more
  space?
 
  Currently I haven't had any problem with these values but I just don't 
  know
  what will happen in future.
  
  Right.  That's partly why I moved as much of the TI ARMv7 parts to the
  Linux kernel defined limits a while back, people managed to bump into
  overruns doing valid things.  I'd really like to see things default to
  something closer to the defined limits to start with and avoid those
  kind of problems a few years down the line.  8MB is fine for now but I
  can see people running over that and going why does my initrd boot
  fail.
 
 We will use FIT image and all these values won't be needed but
 they are need to be here.
 I have removed unused initrd_X in v2 because it is completely unused.

Well, I haven't used FIT images so far and don't see why I should. Can we
please put the initrd at the highest address amongst kernel, DT and
initrd? The initrd is most prone grow. My current one is beyond 100MB.
Let's just spread things out, there should be enough memory for this.

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


Re: [U-Boot] qemu-system-arm segfaults on zynq_zed

2014-11-24 Thread Sören Brinkmann
Could you try whether these instructions work?
http://www.wiki.xilinx.com/QEMU

Sören

On Mon, 2014-11-24 at 08:58AM -0800, Douglas Rupp wrote:
 I built qemu-system-arm from the xilinx-master branch.   xilinx-zynq-a9 is
 not a supported machine. :(
 
 On Mon, Nov 24, 2014 at 7:02 AM, Douglas Rupp douglas.b.r...@gmail.com
 wrote:
 
  It's the version of qemu-system-arm downloaded for Ubuntu 14.04
  Version info:
  qemu-system-arm --version
  QEMU emulator version 2.0.0 (Debian 2.0.0+dfsg-2ubuntu1.7)
 
  I also tried the three boot.bin files in 2014.3-release.tar.gz
  downloaded from the Xilinx website, those in subdirectories zc70x/zc706/
  and zc70x/zc702/, and zed/ .  Same command line.  Hangs with no output.
 
  I also tried the version 2.0.0 version of qemu-system-arm from the
  open-do.org website that we regular use with xlnx-zynq-a9 bsp for
  vxworks7, it boots vxworks without uboot, but hangs with uboot.
 
  You're suggesting that only the qemu-system-arm built from the xilinx repo
  is functional with uboot?  I used that version of qemu about a year ago,
  and it worked fine for Linux but it was an ancient version of qemu (at that
  time).
 
  On Sun, Nov 23, 2014 at 10:17 PM, Jagan Teki jagannadh.t...@gmail.com
  wrote:
 
  On 24 November 2014 at 06:03, Douglas Rupp douglas.b.r...@gmail.com
  wrote:
   I'm brand new to Uboot, so hopefully this is just some missing switch.
  I
   did search the archive, and I was able to build and u-boot a
  versaatilepb
   version, but xilinx-zynq-a9 is the one I really need.
  
   u-boot-2014.10$ make zynq_zed_defconfig
   u-boot-2014.10$ make all CROSS_COMPILE=arm-none-eabi- ARCH=arm
   u-boot-2014.10$ qemu-system-arm -M xilinx-zynq-a9 -m 1024M -nographic
   -kernel u-boot-dtb.bin
   Segmentation fault (core dumped)
 
  I guess it may be qemu usage issue, is qemu from
  https://github.com/Xilinx/qemu ?
 
  + Peter
  Hope, he will give some inputs
 
  
   What am I doing wrong?
 
  thanks!
  --
  Jagan.
 
 
 

 ___
 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


Re: [U-Boot] qemu-system-arm segfaults on zynq_zed

2014-11-24 Thread Sören Brinkmann
I don't think boot.bin is a legal kernel. IIRC, I had issues running
on QEMU, but it was slightly better than what you describe.

Sören

On Mon, 2014-11-24 at 09:40AM -0800, Douglas Rupp wrote:
The result is:
 
arm-softmmu/qemu-system-arm -M arm-generic-fdt -nographic -smp 2 -machine
linux=on -serial mon:stdio -dtb devicetree.dtb -kernel boot.bin
SPI device 0x7f8161521ee0
qemu: fatal: Trying to execute code outside RAM or ROM at 0xfff0
 
then a register dump
 
The boot.bin and devicetree.dtb is from xilinx binary release
2014.3-release/zed
 
I tried removing -smp 2 -machine linux=on, and same error.
On Mon, Nov 24, 2014 at 9:21 AM, Sören Brinkmann
[1]soren.brinkm...@xilinx.com wrote:
 
  Could you try whether these instructions work?
  [2]http://www.wiki.xilinx.com/QEMU
 
  Sören
  On Mon, 2014-11-24 at 08:58AM -0800, Douglas Rupp wrote:
   I built qemu-system-arm from the xilinx-master branch. 
   xilinx-zynq-a9 is
   not a supported machine. :(
  
   On Mon, Nov 24, 2014 at 7:02 AM, Douglas Rupp
  [3]douglas.b.r...@gmail.com
   wrote:
  
It's the version of qemu-system-arm downloaded for Ubuntu 14.04
Version info:
qemu-system-arm --version
QEMU emulator version 2.0.0 (Debian 2.0.0+dfsg-2ubuntu1.7)
   
I also tried the three boot.bin files in 2014.3-release.tar.gz
downloaded from the Xilinx website, those in subdirectories
  zc70x/zc706/
and zc70x/zc702/, and zed/ .  Same command line.  Hangs with no
  output.
   
I also tried the version 2.0.0 version of qemu-system-arm from the
[4]open-do.org website that we regular use with xlnx-zynq-a9 bsp for
vxworks7, it boots vxworks without uboot, but hangs with uboot.
   
You're suggesting that only the qemu-system-arm built from the
  xilinx repo
is functional with uboot?  I used that version of qemu about a year
  ago,
and it worked fine for Linux but it was an ancient version of qemu
  (at that
time).
   
On Sun, Nov 23, 2014 at 10:17 PM, Jagan Teki
  [5]jagannadh.t...@gmail.com
wrote:
   
On 24 November 2014 at 06:03, Douglas Rupp
  [6]douglas.b.r...@gmail.com
wrote:
 I'm brand new to Uboot, so hopefully this is just some missing
  switch.
I
 did search the archive, and I was able to build and u-boot a
versaatilepb
 version, but xilinx-zynq-a9 is the one I really need.

 u-boot-2014.10$ make zynq_zed_defconfig
 u-boot-2014.10$ make all CROSS_COMPILE=arm-none-eabi- ARCH=arm
 u-boot-2014.10$ qemu-system-arm -M xilinx-zynq-a9 -m 1024M
  -nographic
 -kernel u-boot-dtb.bin
 Segmentation fault (core dumped)
   
I guess it may be qemu usage issue, is qemu from
[7]https://github.com/Xilinx/qemu ?
   
+ Peter
Hope, he will give some inputs
   

 What am I doing wrong?
   
thanks!
--
Jagan.
   
   
   
 
   ___
   U-Boot mailing list
   [8]U-Boot@lists.denx.de
   [9]http://lists.denx.de/mailman/listinfo/u-boot
 
 Links:
 1. mailto:soren.brinkm...@xilinx.com/
 2. http://www.wiki.xilinx.com/QEMU
 3. mailto:douglas.b.r...@gmail.com/
 4. http://open-do.org/
 5. mailto:jagannadh.t...@gmail.com/
 6. mailto:douglas.b.r...@gmail.com/
 7. https://github.com/Xilinx/qemu
 8. mailto:U-Boot@lists.denx.de/
 9. 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


Re: [U-Boot] qemu-system-arm segfaults on zynq_zed

2014-11-24 Thread Sören Brinkmann
I suppose the uboot.bin files you are talking about are binaries that
had been converted with objcopy or similar from ELF to binary. That
probably works well. The Zynq boot.bin is a container file that contains
the Zynq bootloader and (optionally) other things (like U-Boot). I doubt
QEMU is able to parse this Zynq specific file (though, it's all
documented, so it could be implemented I guess). So, you probably want to
pass the u-boot.elf as kernel, but I don't know to what extend that works
currently. For that we need input from Peter.
For more information about the Zynq boot.bin format, please have a look
at section 6.3.2 in the Zynq TRM
(http://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf)
and the Zynq SW developer guide
(http://www.xilinx.com/support/documentation/user_guides/ug821-zynq-7000-swdev.pdf).

Sören

On Mon, 2014-11-24 at 10:24AM -0800, Douglas Rupp wrote:
 For versatilepb arm, there's a blog post that describes a recipe of how to
 build and boot uboot.bin in qemu.  It works fine, here's the link if
 you're interested.
 https://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
 
 I assumed that uboot was standardized enough so that it would work the same
 for other machine/board emulations. I'd like to understand why it's not
 working.
 
 The problem I'm trying to solve is to configure networking in uboot for the
 xilinx-zynq-a9 bsp for vxworks7 running under qemu.  Vxworks7 uses uboot
 where 6.9 didn't, and the default device tree isn't set correctly for my
 network, it just has some random defaults that are expected to be
 customized.  The alternative is to use real hardware, which should work
 well enough for debugging but in general it's much easier to debug and run
 tests in qemu especially when working remotely.
 
 So any ideas you might have on what's special about zynq utboot would be
 appreciated.
 
 On Mon, Nov 24, 2014 at 9:45 AM, Sören Brinkmann soren.brinkm...@xilinx.com
  wrote:
 
  I don't think boot.bin is a legal kernel. IIRC, I had issues running
  on QEMU, but it was slightly better than what you describe.
 
  Sören
 
  On Mon, 2014-11-24 at 09:40AM -0800, Douglas Rupp wrote:
  The result is:
  
  arm-softmmu/qemu-system-arm -M arm-generic-fdt -nographic -smp 2
  -machine
  linux=on -serial mon:stdio -dtb devicetree.dtb -kernel boot.bin
  SPI device 0x7f8161521ee0
  qemu: fatal: Trying to execute code outside RAM or ROM at 0xfff0
  
  then a register dump
  
  The boot.bin and devicetree.dtb is from xilinx binary release
  2014.3-release/zed
  
  I tried removing -smp 2 -machine linux=on, and same error.
  On Mon, Nov 24, 2014 at 9:21 AM, Sören Brinkmann
  [1]soren.brinkm...@xilinx.com wrote:
  
Could you try whether these instructions work?
[2]http://www.wiki.xilinx.com/QEMU
  
Sören
On Mon, 2014-11-24 at 08:58AM -0800, Douglas Rupp wrote:
 I built qemu-system-arm from the xilinx-master branch.
 xilinx-zynq-a9 is
 not a supported machine. :(

 On Mon, Nov 24, 2014 at 7:02 AM, Douglas Rupp
[3]douglas.b.r...@gmail.com
 wrote:

  It's the version of qemu-system-arm downloaded for Ubuntu 14.04
  Version info:
  qemu-system-arm --version
  QEMU emulator version 2.0.0 (Debian 2.0.0+dfsg-2ubuntu1.7)
 
  I also tried the three boot.bin files in
  2014.3-release.tar.gz
  downloaded from the Xilinx website, those in subdirectories
zc70x/zc706/
  and zc70x/zc702/, and zed/ .  Same command line.  Hangs with no
output.
 
  I also tried the version 2.0.0 version of qemu-system-arm from
  the
  [4]open-do.org website that we regular use with xlnx-zynq-a9
  bsp for
  vxworks7, it boots vxworks without uboot, but hangs with uboot.
 
  You're suggesting that only the qemu-system-arm built from the
xilinx repo
  is functional with uboot?  I used that version of qemu about a
  year
ago,
  and it worked fine for Linux but it was an ancient version of
  qemu
(at that
  time).
 
  On Sun, Nov 23, 2014 at 10:17 PM, Jagan Teki
[5]jagannadh.t...@gmail.com
  wrote:
 
  On 24 November 2014 at 06:03, Douglas Rupp
[6]douglas.b.r...@gmail.com
  wrote:
   I'm brand new to Uboot, so hopefully this is just some
  missing
switch.
  I
   did search the archive, and I was able to build and u-boot a
  versaatilepb
   version, but xilinx-zynq-a9 is the one I really need.
  
   u-boot-2014.10$ make zynq_zed_defconfig
   u-boot-2014.10$ make all CROSS_COMPILE=arm-none-eabi-
  ARCH=arm
   u-boot-2014.10$ qemu-system-arm -M xilinx-zynq-a9 -m 1024M
-nographic
   -kernel u-boot-dtb.bin

Re: [U-Boot] [RFC PATCH 0/1] SPL JTAG boot mode

2014-08-18 Thread Sören Brinkmann
On Mon, 2014-08-11 at 09:17AM -0400, Tom Rini wrote:
 On Mon, Aug 11, 2014 at 03:03:35PM +0200, Michal Simek wrote:
 
  Hi,
  
  I have got this patch some time ago but I am not still
  100% sure about use case. Anyway Soren uses this mode
  that's why let me send this patch and we can discuss
  if this can be useful for someone else too.
  
  The use case is to load U-Boot SPL to do init HW
  and then load images via JTAG because RAM is initialized
  and then run full u-boot.
  There is an option to do HW initialization without
  U-Boot SPL but there are some differences and it is just
  better to directly use code which will run on the board
  when everything is tested.
 
 So in this case, you attach JTAG to the board, halt on reset, reset the
 board.  JTAG load in SPL and fiddle memory so that BOOT_DEVICE_JTAG is
 set, let SPL run, halt when you see the print (or set a breakpoint for
 that part, either way), then load U-Boot via JTAG, resume over the while
 loop, and then debug U-Boot as needed?

That is pretty much the flow correct. But I do not use it to debug
U-Boot, but boot our boards in our boardfarm. The flow is

1. Connect JTAG debugger
2. Download and run SPL
3. Stop execution when the SPL is done (and did initialize the DDR)
4. Load U-Boot and run U-Boot through JTAG
5. boot full OS etc.

I.e. the JTAG boot flow is used in automation quite a lot here.

Thanks,
Sören

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