Re: [U-Boot] [PATCH 01/10 V6] EXYNOS5: Create a common board file

2013-11-08 Thread Przemyslaw Marczak

Hello Rajeshwari,

On 10/29/2013 08:23 AM, Rajeshwari S Shinde wrote:

Create a common board.c file for all functions which are common across
all EXYNOS5 platforms.

exynos_init function is provided for platform specific code.

Signed-off-by: Rajeshwari S Shinde rajeshwar...@samsung.com
Acked-by: Simon Glass s...@chromium.org
---
Changes in V2:
- None
Changes in V3:
- None
Changes in V4:
- Added check for the compilation of MAX77686 pmic.
Changes in V5:
- Moved board_eth_init and board_mmc_init in case of
device tree support
Changes in V6:
- None.
  arch/arm/include/asm/arch-exynos/board.h |  17 ++
  board/samsung/common/Makefile|   4 +
  board/samsung/common/board.c | 405 +++
  board/samsung/smdk5250/exynos5-dt.c  | 361 +--
  board/samsung/smdk5250/smdk5250.c| 182 +-
  include/configs/exynos5250-dt.h  |   2 +
  6 files changed, 435 insertions(+), 536 deletions(-)
  create mode 100644 arch/arm/include/asm/arch-exynos/board.h
  create mode 100644 board/samsung/common/board.c



The name of exynos5 common file can't be just board.c since it is 
common only for Exynos5 boards and is placed in Samsung common.
We have few Exynos4 boards in u-boot and in future we can introduce 
common board file for them too.
So it is better to add some additional word to this file name. This also 
needs to change config name or add checking SOC version in common Makefile.


Thank you,
--
Przemyslaw Marczak
Samsung RD Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 01/10 V6] EXYNOS5: Create a common board file

2013-11-08 Thread Rajeshwari Birje
Hi Przemyslaw

On Fri, Nov 8, 2013 at 1:43 PM, Przemyslaw Marczak
p.marc...@samsung.com wrote:
 Hello Rajeshwari,


 On 10/29/2013 08:23 AM, Rajeshwari S Shinde wrote:

 Create a common board.c file for all functions which are common across
 all EXYNOS5 platforms.

 exynos_init function is provided for platform specific code.

 Signed-off-by: Rajeshwari S Shinde rajeshwar...@samsung.com
 Acked-by: Simon Glass s...@chromium.org
 ---
 Changes in V2:
 - None
 Changes in V3:
 - None
 Changes in V4:
 - Added check for the compilation of MAX77686 pmic.
 Changes in V5:
 - Moved board_eth_init and board_mmc_init in case of
 device tree support
 Changes in V6:
 - None.
   arch/arm/include/asm/arch-exynos/board.h |  17 ++
   board/samsung/common/Makefile|   4 +
   board/samsung/common/board.c | 405
 +++
   board/samsung/smdk5250/exynos5-dt.c  | 361
 +--
   board/samsung/smdk5250/smdk5250.c| 182 +-
   include/configs/exynos5250-dt.h  |   2 +
   6 files changed, 435 insertions(+), 536 deletions(-)
   create mode 100644 arch/arm/include/asm/arch-exynos/board.h
   create mode 100644 board/samsung/common/board.c


 The name of exynos5 common file can't be just board.c since it is common
 only for Exynos5 boards and is placed in Samsung common.
 We have few Exynos4 boards in u-boot and in future we can introduce common
 board file for them too.
 So it is better to add some additional word to this file name. This also
 needs to change config name or add checking SOC version in common Makefile.

Cannot we use the same file even for exynos4 boards.

-- 
Regards,
Rajeshwari Shinde
 Thank you,
 --
 Przemyslaw Marczak
 Samsung RD Institute Poland
 Samsung Electronics
 p.marc...@samsung.com

 ___
 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] [PATCH 01/10 V6] EXYNOS5: Create a common board file

2013-11-08 Thread Przemyslaw Marczak

Hi,

On 11/08/2013 09:37 AM, Rajeshwari Birje wrote:

Hi Przemyslaw

On Fri, Nov 8, 2013 at 1:43 PM, Przemyslaw Marczak
p.marc...@samsung.com wrote:

Hello Rajeshwari,


On 10/29/2013 08:23 AM, Rajeshwari S Shinde wrote:


Create a common board.c file for all functions which are common across
all EXYNOS5 platforms.

exynos_init function is provided for platform specific code.

Signed-off-by: Rajeshwari S Shinde rajeshwar...@samsung.com
Acked-by: Simon Glass s...@chromium.org
---
Changes in V2:
 - None
Changes in V3:
 - None
Changes in V4:
 - Added check for the compilation of MAX77686 pmic.
Changes in V5:
 - Moved board_eth_init and board_mmc_init in case of
 device tree support
Changes in V6:
 - None.
   arch/arm/include/asm/arch-exynos/board.h |  17 ++
   board/samsung/common/Makefile|   4 +
   board/samsung/common/board.c | 405
+++
   board/samsung/smdk5250/exynos5-dt.c  | 361
+--
   board/samsung/smdk5250/smdk5250.c| 182 +-
   include/configs/exynos5250-dt.h  |   2 +
   6 files changed, 435 insertions(+), 536 deletions(-)
   create mode 100644 arch/arm/include/asm/arch-exynos/board.h
   create mode 100644 board/samsung/common/board.c



The name of exynos5 common file can't be just board.c since it is common
only for Exynos5 boards and is placed in Samsung common.
We have few Exynos4 boards in u-boot and in future we can introduce common
board file for them too.
So it is better to add some additional word to this file name. This also
needs to change config name or add checking SOC version in common Makefile.


Cannot we use the same file even for exynos4 boards.



I'm not sure that you understand my intention.

You want to introduce:
board/samsung/common/board.c - with only Exynos5 code

I mean that it should looks like this, e.g:
board/samsung/common/board_exynos4.c - common code for all Exynos 4
board/samsung/common/board_exynos5.c - common code for all Exynos 5
since there is some duplicated code in Exynos4 boards that can be moved 
to one common file in the future.

Do you understand my intention now?

Regards

--
Przemyslaw Marczak
Samsung RD Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 01/10 V6] EXYNOS5: Create a common board file

2013-11-08 Thread Rajeshwari Birje
Hi,


On Fri, Nov 8, 2013 at 2:33 PM, Przemyslaw Marczak
p.marc...@samsung.com wrote:
 Hi,


 On 11/08/2013 09:37 AM, Rajeshwari Birje wrote:

 Hi Przemyslaw

 On Fri, Nov 8, 2013 at 1:43 PM, Przemyslaw Marczak
 p.marc...@samsung.com wrote:

 Hello Rajeshwari,


 On 10/29/2013 08:23 AM, Rajeshwari S Shinde wrote:


 Create a common board.c file for all functions which are common across
 all EXYNOS5 platforms.

 exynos_init function is provided for platform specific code.

 Signed-off-by: Rajeshwari S Shinde rajeshwar...@samsung.com
 Acked-by: Simon Glass s...@chromium.org
 ---
 Changes in V2:
  - None
 Changes in V3:
  - None
 Changes in V4:
  - Added check for the compilation of MAX77686 pmic.
 Changes in V5:--
Regards,
Rajeshwari Shind
  - Moved board_eth_init and board_mmc_init in case of
  device tree support
 Changes in V6:
  - None.
arch/arm/include/asm/arch-exynos/board.h |  17 ++
board/samsung/common/Makefile|   4 +
board/samsung/common/board.c | 405
 +++
board/samsung/smdk5250/exynos5-dt.c  | 361
 +--
board/samsung/smdk5250/smdk5250.c| 182 +-
include/configs/exynos5250-dt.h  |   2 +
6 files changed, 435 insertions(+), 536 deletions(-)
create mode 100644 arch/arm/include/asm/arch-exynos/board.h
create mode 100644 board/samsung/common/board.c


 The name of exynos5 common file can't be just board.c since it is
 common
 only for Exynos5 boards and is placed in Samsung common.
 We have few Exynos4 boards in u-boot and in future we can introduce
 common
 board file for them too.
 So it is better to add some additional word to this file name. This also
 needs to change config name or add checking SOC version in common
 Makefile.

 Cannot we use the same file even for exynos4 boards.


 I'm not sure that you understand my intention.

 You want to introduce:
 board/samsung/common/board.c - with only Exynos5 code

 I mean that it should looks like this, e.g:
 board/samsung/common/board_exynos4.c - common code for all Exynos 4
 board/samsung/common/board_exynos5.c - common code for all Exynos 5
 since there is some duplicated code in Exynos4 boards that can be moved to
 one common file in the future.
 Do you understand my intention now?

Yes I understood your intention,  but had a question cannot we use the
same file board.c for exynos4 and exynos5 too.
Since both have most of functions similar like board_init,  dram_init,
board_uart_init and so on.

If u still feel that exynos4 and exynos5 have lots of functions
different in board/samsung we can create a seperate file. I was hoping
the same board.c could be reused for exynos4 also.

-- 
Regards,
Rajeshwari Shind

 Regards


 --
 Przemyslaw Marczak
 Samsung RD Institute Poland
 Samsung Electronics
 p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 01/10 V6] EXYNOS5: Create a common board file

2013-11-08 Thread Przemyslaw Marczak

Hi,

On 11/08/2013 10:27 AM, Rajeshwari Birje wrote:

Hi,


On Fri, Nov 8, 2013 at 2:33 PM, Przemyslaw Marczak
p.marc...@samsung.com wrote:

Hi,


On 11/08/2013 09:37 AM, Rajeshwari Birje wrote:


Hi Przemyslaw

On Fri, Nov 8, 2013 at 1:43 PM, Przemyslaw Marczak
p.marc...@samsung.com wrote:


Hello Rajeshwari,


On 10/29/2013 08:23 AM, Rajeshwari S Shinde wrote:



Create a common board.c file for all functions which are common across
all EXYNOS5 platforms.

exynos_init function is provided for platform specific code.

Signed-off-by: Rajeshwari S Shinde rajeshwar...@samsung.com
Acked-by: Simon Glass s...@chromium.org
---
Changes in V2:
  - None
Changes in V3:
  - None
Changes in V4:
  - Added check for the compilation of MAX77686 pmic.
Changes in V5:--

Regards,
Rajeshwari Shind

  - Moved board_eth_init and board_mmc_init in case of
  device tree support
Changes in V6:
  - None.
arch/arm/include/asm/arch-exynos/board.h |  17 ++
board/samsung/common/Makefile|   4 +
board/samsung/common/board.c | 405
+++
board/samsung/smdk5250/exynos5-dt.c  | 361
+--
board/samsung/smdk5250/smdk5250.c| 182 +-
include/configs/exynos5250-dt.h  |   2 +
6 files changed, 435 insertions(+), 536 deletions(-)
create mode 100644 arch/arm/include/asm/arch-exynos/board.h
create mode 100644 board/samsung/common/board.c



The name of exynos5 common file can't be just board.c since it is
common
only for Exynos5 boards and is placed in Samsung common.
We have few Exynos4 boards in u-boot and in future we can introduce
common
board file for them too.
So it is better to add some additional word to this file name. This also
needs to change config name or add checking SOC version in common
Makefile.


Cannot we use the same file even for exynos4 boards.



I'm not sure that you understand my intention.

You want to introduce:
board/samsung/common/board.c - with only Exynos5 code

I mean that it should looks like this, e.g:
board/samsung/common/board_exynos4.c - common code for all Exynos 4
board/samsung/common/board_exynos5.c - common code for all Exynos 5
since there is some duplicated code in Exynos4 boards that can be moved to
one common file in the future.
Do you understand my intention now?


Yes I understood your intention,  but had a question cannot we use the
same file board.c for exynos4 and exynos5 too.
Since both have most of functions similar like board_init,  dram_init,
board_uart_init and so on.

If u still feel that exynos4 and exynos5 have lots of functions
different in board/samsung we can create a seperate file. I was hoping
the same board.c could be reused for exynos4 also.

Ah, ok. This is good idea with the one common file. Then we will have 
board files with strict board dependent functions. So I don't have any 
objections jet.

Regards,

--
Przemyslaw Marczak
Samsung RD Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 01/10 V6] EXYNOS5: Create a common board file

2013-11-08 Thread Rajeshwari Birje
Hi,

On Fri, Nov 8, 2013 at 3:16 PM, Przemyslaw Marczak
p.marc...@samsung.com wrote:
 Hi,


 On 11/08/2013 10:27 AM, Rajeshwari Birje wrote:

 Hi,


 On Fri, Nov 8, 2013 at 2:33 PM, Przemyslaw Marczak
 p.marc...@samsung.com wrote:

 Hi,


 On 11/08/2013 09:37 AM, Rajeshwari Birje wrote:


 Hi Przemyslaw

 On Fri, Nov 8, 2013 at 1:43 PM, Przemyslaw Marczak
 p.marc...@samsung.com wrote:


 Hello Rajeshwari,


 On 10/29/2013 08:23 AM, Rajeshwari S Shinde wrote:



 Create a common board.c file for all functions which are common across
 all EXYNOS5 platforms.

 exynos_init function is provided for platform specific code.

 Signed-off-by: Rajeshwari S Shinde rajeshwar...@samsung.com
 Acked-by: Simon Glass s...@chromium.org
 ---
 Changes in V2:
   - None
 Changes in V3:
   - None
 Changes in V4:
   - Added check for the compilation of MAX77686 pmic.
 Changes in V5:--

 Regards,
 Rajeshwari Shind

   - Moved board_eth_init and board_mmc_init in case of
   device tree support
 Changes in V6:
   - None.
 arch/arm/include/asm/arch-exynos/board.h |  17 ++
 board/samsung/common/Makefile|   4 +
 board/samsung/common/board.c | 405
 +++
 board/samsung/smdk5250/exynos5-dt.c  | 361
 +--
 board/samsung/smdk5250/smdk5250.c| 182 +-
 include/configs/exynos5250-dt.h  |   2 +
 6 files changed, 435 insertions(+), 536 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/board.h
 create mode 100644 board/samsung/common/board.c


 The name of exynos5 common file can't be just board.c since it is
 common
 only for Exynos5 boards and is placed in Samsung common.
 We have few Exynos4 boards in u-boot and in future we can introduce
 common
 board file for them too.
 So it is better to add some additional word to this file name. This
 also
 needs to change config name or add checking SOC version in common
 Makefile.

 Cannot we use the same file even for exynos4 boards.


 I'm not sure that you understand my intention.

 You want to introduce:
 board/samsung/common/board.c - with only Exynos5 code

 I mean that it should looks like this, e.g:
 board/samsung/common/board_exynos4.c - common code for all Exynos 4
 board/samsung/common/board_exynos5.c - common code for all Exynos 5
 since there is some duplicated code in Exynos4 boards that can be moved
 to
 one common file in the future.
 Do you understand my intention now?

 Yes I understood your intention,  but had a question cannot we use the
 same file board.c for exynos4 and exynos5 too.
 Since both have most of functions similar like board_init,  dram_init,
 board_uart_init and so on.

 If u still feel that exynos4 and exynos5 have lots of functions
 different in board/samsung we can create a seperate file. I was hoping
 the same board.c could be reused for exynos4 also.

 Ah, ok. This is good idea with the one common file. Then we will have board
 files with strict board dependent functions. So I don't have any objections
 jet.
 Regards,

Ok Thank you.
-- 
Regards,
Rajeshwari Shinde


 --
 Przemyslaw Marczak
 Samsung RD Institute Poland
 Samsung Electronics
 p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 01/10 V6] EXYNOS5: Create a common board file

2013-10-29 Thread Rajeshwari S Shinde
Create a common board.c file for all functions which are common across
all EXYNOS5 platforms.

exynos_init function is provided for platform specific code.

Signed-off-by: Rajeshwari S Shinde rajeshwar...@samsung.com
Acked-by: Simon Glass s...@chromium.org
---
Changes in V2:
- None
Changes in V3:
- None
Changes in V4:
- Added check for the compilation of MAX77686 pmic.
Changes in V5:
- Moved board_eth_init and board_mmc_init in case of
device tree support
Changes in V6:
- None.
 arch/arm/include/asm/arch-exynos/board.h |  17 ++
 board/samsung/common/Makefile|   4 +
 board/samsung/common/board.c | 405 +++
 board/samsung/smdk5250/exynos5-dt.c  | 361 +--
 board/samsung/smdk5250/smdk5250.c| 182 +-
 include/configs/exynos5250-dt.h  |   2 +
 6 files changed, 435 insertions(+), 536 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/board.h
 create mode 100644 board/samsung/common/board.c

diff --git a/arch/arm/include/asm/arch-exynos/board.h 
b/arch/arm/include/asm/arch-exynos/board.h
new file mode 100644
index 000..243fb12
--- /dev/null
+++ b/arch/arm/include/asm/arch-exynos/board.h
@@ -0,0 +1,17 @@
+/*
+ * (C) Copyright 2013 Samsung Electronics
+ * Rajeshwari Shinde rajeshwar...@samsung.com
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _EXYNOS_BOARD_H
+#define _EXYNOS_BOARD_H
+
+/*
+ * Exynos baord specific changes for
+ * board_init
+ */
+int exynos_init(void);
+
+#endif /* EXYNOS_BOARD_H */
diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 9e48a7b..eab8ab2 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -11,6 +11,10 @@ LIB  = $(obj)libsamsung.o
 
 COBJS-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
 
+ifeq ($(CONFIG_SPL_BUILD),)
+COBJS-$(CONFIG_BOARD_COMMON)   += board.o
+endif
+
 SRCS:= $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS-y))
 
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
new file mode 100644
index 000..9ebfc42
--- /dev/null
+++ b/board/samsung/common/board.c
@@ -0,0 +1,405 @@
+/*
+ * (C) Copyright 2013 SAMSUNG Electronics
+ * Rajeshwari Shinde rajeshwar...@samsung.com
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include common.h
+#include cros_ec.h
+#include errno.h
+#include fdtdec.h
+#include spi.h
+#include tmu.h
+#include netdev.h
+#include asm/io.h
+#include asm/arch/board.h
+#include asm/arch/cpu.h
+#include asm/arch/dwmmc.h
+#include asm/arch/gpio.h
+#include asm/arch/mmc.h
+#include asm/arch/pinmux.h
+#include asm/arch/power.h
+#include power/pmic.h
+#include asm/arch/sromc.h
+#include power/max77686_pmic.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct local_info {
+   struct cros_ec_dev *cros_ec_dev;/* Pointer to cros_ec device */
+   int cros_ec_err;/* Error for cros_ec, 0 if ok */
+};
+
+static struct local_info local;
+
+#if defined CONFIG_EXYNOS_TMU
+/*
+ * Boot Time Thermal Analysis for SoC temperature threshold breach
+ */
+static void boot_temp_check(void)
+{
+   int temp;
+
+   switch (tmu_monitor(temp)) {
+   case TMU_STATUS_NORMAL:
+   break;
+   /* Status TRIPPED ans WARNING means corresponding threshold breach */
+   case TMU_STATUS_TRIPPED:
+   puts(EXYNOS_TMU: TRIPPING! Device power going down ...\n);
+   set_ps_hold_ctrl();
+   hang();
+   break;
+   case TMU_STATUS_WARNING:
+   puts(EXYNOS_TMU: WARNING! Temperature very high\n);
+   break;
+   /*
+* TMU_STATUS_INIT means something is wrong with temperature sensing
+* and TMU status was changed back from NORMAL to INIT.
+*/
+   case TMU_STATUS_INIT:
+   default:
+   debug(EXYNOS_TMU: Unknown TMU state\n);
+   }
+}
+#endif
+
+int board_init(void)
+{
+   gd-bd-bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
+#if defined CONFIG_EXYNOS_TMU
+   if (tmu_init(gd-fdt_blob) != TMU_STATUS_NORMAL) {
+   debug(%s: Failed to init TMU\n, __func__);
+   return -1;
+   }
+   boot_temp_check();
+#endif
+
+#ifdef CONFIG_EXYNOS_SPI
+   spi_init();
+#endif
+   return exynos_init();
+}
+
+int dram_init(void)
+{
+   int i;
+   u32 addr;
+
+   for (i = 0; i  CONFIG_NR_DRAM_BANKS; i++) {
+   addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
+   gd-ram_size += get_ram_size((long *)addr, SDRAM_BANK_SIZE);
+   }
+   return 0;
+}
+
+void dram_init_banksize(void)
+{
+   int i;
+   u32 addr, size;
+
+   for (i = 0; i  CONFIG_NR_DRAM_BANKS; i++) {
+   addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
+   size = get_ram_size((long *)addr, SDRAM_BANK_SIZE);
+
+   gd-bd-bi_dram[i].start = addr;
+