Skip to contentSkip to conversation

KW: Move the memory register definitions into kirkwood.h

PATCH New Marek Vasut 2 participants 9 messages Jun 26, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 KW: Move the memory register definitions into kirkwood.h

Cc Prafulla Wadaskar <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c        |    2 --
 arch/arm/include/asm/arch-kirkwood/kirkwood.h |    4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/kirkwood/dram.c +0 -2
index 181b3e7..ccb6b03 100644
@@ -30,8 +30,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define KW_REG_CPUCS_WIN_BAR(x)		(KW_REGISTER(0x1500) + (x * 0x08))
-#define KW_REG_CPUCS_WIN_SZ(x)		(KW_REGISTER(0x1504) + (x * 0x08))
 /*
  * kw_sdram_bar - reads SDRAM Base Address Register
  */
arch/arm/include/asm/arch-kirkwood/kirkwood.h +4 -0
index 47771d5..3933eac 100644
@@ -77,6 +77,10 @@
 #define MVCPU_WIN_ENABLE	KWCPU_WIN_ENABLE
 #define MVCPU_WIN_DISABLE	KWCPU_WIN_DISABLE
 
+/* Kirkwood memory registers */
+#define KW_REG_CPUCS_WIN_BAR(x)		(KW_REGISTER(0x1500) + ((x) * 0x08))
+#define KW_REG_CPUCS_WIN_SZ(x)		(KW_REGISTER(0x1504) + ((x) * 0x08))
+
 #if defined (CONFIG_KW88F6281)
 #include <asm/arch/kw88f6281.h>
 #elif defined (CONFIG_KW88F6192)
Signature · 1 line
1.7.10
#1 lore raw

PATCH 2/3 KW: Add kw_adjust_dram() weak function

This function shall allow a board to adjust DRAM parameters in case there are multiple versions of the board with different DRAM sizes.

Cc Prafulla Wadaskar <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/cpu/arm926ejs/kirkwood/dram.c +11 -0
index ccb6b03..cdf0d21 100644
@@ -60,6 +60,15 @@ u32 kw_sdram_bs(enum memory_bank bank)
 	return result;
 }
 
+/*
+ * kw_adjust_sdram - allow post init adjustment of DRAM size
+ */
+void __kw_adjust_dram(void)
+{
+}
+
+void kw_adjust_dram(void) __attribute__((weak, alias("__kw_adjust_dram")));
+
 #ifndef CONFIG_SYS_BOARD_DRAM_INIT
 int dram_init(void)
 {
@@ -91,6 +100,8 @@ int dram_init(void)
 		gd->bd->bi_dram[i].size = 0;
 	}
 
+	kw_adjust_dram();
+
 	return 0;
 }
 
Signature · 1 line
1.7.10
#2 lore raw

PATCH 2/3 KW: Add kw_adjust_dram() weak function

Quoted 9 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 26 June 2012 17:45
To: u-boot at lists.denx.de
Cc: Marek Vasut; Prafulla Wadaskar; Wolfgang Denk
Subject: [PATCH 2/3] KW: Add kw_adjust_dram() weak function

Quoted 8 lines

This function shall allow a board to adjust DRAM parameters in case there are multiple versions of the board with different DRAM sizes.

Cc Prafulla Wadaskar <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c |   11 +++++++++++

Instead I would like to suggest to add function name as __kw_post_kwbconfig()

This typically addresses to reconfigure the default configuration done by kwbimage.cfg, so the scope is not limited to DRAM configuration.

Regards..
Prafulla . . .

#3 lore raw

PATCH 2/3 KW: Add kw_adjust_dram() weak function

Dear Prafulla Wadaskar,

Quoted 15 lines
Quoted 15 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 26 June 2012 17:45
To: u-boot at lists.denx.de
Cc: Marek Vasut; Prafulla Wadaskar; Wolfgang Denk
Subject: [PATCH 2/3] KW: Add kw_adjust_dram() weak function

This function shall allow a board to adjust DRAM parameters in case there are multiple versions of the board with different DRAM sizes.

Cc Prafulla Wadaskar <[email protected]>
Cc Wolfgang Denk <[email protected]>

---

Quoted 4 lines
Quoted 1 line
 arch/arm/cpu/arm926ejs/kirkwood/dram.c |   11 +++++++++++

Instead I would like to suggest to add function name as __kw_post_kwbconfig()

what about using board_early_init_f() ?

Quoted 5 lines

This typically addresses to reconfigure the default configuration done by kwbimage.cfg, so the scope is not limited to DRAM configuration.

Regards..
Prafulla . . .

Best regards,
Marek Vasut

#4 lore raw

PATCH 2/3 KW: Add kw_adjust_dram() weak function

Quoted 28 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 26 June 2012 18:18
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Wolfgang Denk
Subject: Re: [PATCH 2/3] KW: Add kw_adjust_dram() weak function

Dear Prafulla Wadaskar,

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 26 June 2012 17:45
To: u-boot at lists.denx.de
Cc: Marek Vasut; Prafulla Wadaskar; Wolfgang Denk
Subject: [PATCH 2/3] KW: Add kw_adjust_dram() weak function

This function shall allow a board to adjust DRAM parameters in

case

Quoted 1 line
Quoted 1 line

there are multiple versions of the board with different DRAM

sizes.

Quoted 6 lines
Quoted 6 lines
Cc Prafulla Wadaskar <[email protected]>
Cc Wolfgang Denk <[email protected]>

---

Quoted 6 lines
Quoted 4 lines
Quoted 1 line
 arch/arm/cpu/arm926ejs/kirkwood/dram.c |   11 +++++++++++

Instead I would like to suggest to add function name as __kw_post_kwbconfig()

what about using board_early_init_f() ?

I think that sound good.
In that case you don't need to create any new function.

Regards..
Prafulla . . .

#5 lore raw

PATCH 3/3 Kirkwood: Add support for Ka-Ro TK71

In reply to Marek Vasut
Cc Prafulla Wadaskar <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 board/karo/tk71/Makefile     |   45 +++++++++++
 board/karo/tk71/kwbimage.cfg |  174 +++++++++++++++++++++++++++++++++++++++++
 board/karo/tk71/tk71.c       |  178 ++++++++++++++++++++++++++++++++++++++++++
 boards.cfg                   |    1 +
 include/configs/tk71.h       |  128 ++++++++++++++++++++++++++++++
 5 files changed, 526 insertions(+)
 create mode 100644 board/karo/tk71/Makefile
 create mode 100644 board/karo/tk71/kwbimage.cfg
 create mode 100644 board/karo/tk71/tk71.c
 create mode 100644 include/configs/tk71.h
board/karo/tk71/Makefile new file +45 -0
new file mode 100644
index 0000000..934e391
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2012 Marek Vasut <[email protected]>
+# on behalf of DENX Software Engineering GmbH
+#
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS	:= tk71.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/karo/tk71/kwbimage.cfg new file +174 -0

174 lines not on this page · raw message

board/karo/tk71/tk71.c new file +178 -0

178 lines not on this page · raw message

boards.cfg +1 -0
index a723f67..88e3dbf 100644
@@ -156,6 +156,7 @@ rd6281a                      arm         arm926ejs   -                   Marvell
 sheevaplug                   arm         arm926ejs   -                   Marvell        kirkwood
 ib62x0                       arm         arm926ejs   ib62x0              raidsonic      kirkwood
 dockstar                     arm         arm926ejs   -                   Seagate        kirkwood
+tk71                         arm         arm926ejs   tk71                karo           kirkwood
 devkit3250                   arm         arm926ejs   devkit3250          timll          lpc32xx
 jadecpu                      arm         arm926ejs   jadecpu             syteco         mb86r0x
 mx25pdk                      arm         arm926ejs   mx25pdk             freescale      mx25		mx25pdk:IMX_CONFIG=board/freescale/mx25pdk/imximage.cfg
include/configs/tk71.h new file +128 -0

128 lines not on this page · raw message

Signature · 1 line
1.7.10
#6 lore raw

PATCH 3/3 Kirkwood: Add support for Ka-Ro TK71

Quoted 26 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 26 June 2012 17:45
To: u-boot at lists.denx.de
Cc: Marek Vasut; Prafulla Wadaskar; Wolfgang Denk
Subject: [PATCH 3/3] Kirkwood: Add support for Ka-Ro TK71

Cc Prafulla Wadaskar <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 board/karo/tk71/Makefile     |   45 +++++++++++
 board/karo/tk71/kwbimage.cfg |  174
+++++++++++++++++++++++++++++++++++++++++
 board/karo/tk71/tk71.c       |  178
++++++++++++++++++++++++++++++++++++++++++
 boards.cfg                   |    1 +
 include/configs/tk71.h       |  128 ++++++++++++++++++++++++++++++
 5 files changed, 526 insertions(+)
 create mode 100644 board/karo/tk71/Makefile
 create mode 100644 board/karo/tk71/kwbimage.cfg
 create mode 100644 board/karo/tk71/tk71.c
 create mode 100644 include/configs/tk71.h

...snip...

Quoted 131 lines
board/karo/tk71/tk71.c new file +42 -0
new file mode 100644
index 0000000..b2c1a62
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2012 Marek Vasut <[email protected]>
+ * on behalf of DENX Software Engineering GmbH
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <common.h>
+#include <miiphy.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/kirkwood.h>
+#include <asm/arch/mpp.h>
+#include <asm/io.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define TK71_OE_LOW			(~0)
+#define TK71_OE_HIGH			(~0)
+#define TK71_OE_VAL_LOW			(0)
+#define TK71_OE_VAL_HIGH		(0)
+
+int board_early_init_f(void)
+{
+	/*
+	 * default gpio configuration
+	 * There are maximum 64 gpios controlled through 2 sets of

registers

board/karo/tk71/tk71.c new file +81 -0
+	 * the  below configuration configures mainly initial LED status
+	 */
+	kw_config_gpio(TK71_OE_VAL_LOW,
+			TK71_OE_VAL_HIGH,
+			TK71_OE_LOW, TK71_OE_HIGH);
+
+	/* Multi-Purpose Pins Functionality configuration */
+	u32 kwmpp_config[] = {
+		MPP0_NF_IO2,
+		MPP1_NF_IO3,
+		MPP2_NF_IO4,
+		MPP3_NF_IO5,
+		MPP4_NF_IO6,
+		MPP5_NF_IO7,
+		MPP6_SYSRST_OUTn,
+		MPP7_GPO,
+		MPP8_TW_SDA,
+		MPP9_TW_SCK,
+		MPP10_UART0_TXD,
+		MPP11_UART0_RXD,
+		MPP12_SD_CLK,
+		MPP13_SD_CMD,
+		MPP14_SD_D0,
+		MPP15_SD_D1,
+		MPP16_SD_D2,
+		MPP17_SD_D3,
+		MPP18_NF_IO0,
+		MPP19_NF_IO1,
+		MPP20_GE1_0,
+		MPP21_GE1_1,
+		MPP22_GE1_2,
+		MPP23_GE1_3,
+		MPP24_GE1_4,
+		MPP25_GE1_5,
+		MPP26_GE1_6,
+		MPP27_GE1_7,
+		MPP28_GPIO,
+		MPP29_GPIO,
+		MPP30_GE1_10,
+		MPP31_GE1_11,
+		MPP32_GE1_12,
+		MPP33_GE1_13,
+		MPP34_GPIO,
+		MPP35_GPIO,
+		MPP36_GPIO,
+		MPP37_GPIO,
+		MPP38_GPIO,
+		MPP39_GPIO,
+		MPP40_GPIO,
+		MPP41_GPIO,
+		MPP42_GPIO,
+		MPP43_GPIO,
+		MPP44_GPIO,
+		MPP45_GPIO,
+		MPP46_GPIO,
+		MPP47_GPIO,
+		MPP48_GPIO,
+		MPP49_GPIO,
+		0
+	};
+	kirkwood_mpp_conf(kwmpp_config);
+
+	return 0;
+}
+
+int board_init(void)
+{
+	/*
+	 * arch number of board
+	 */
+	gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
+
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+
+	return 0;
+}
+
+void kw_adjust_dram(void)
+{
+	unsigned long size = get_ram_size(PHYS_SDRAM_1,

PHYS_SDRAM_1_SIZE);

board/karo/tk71/tk71.c line 127

Quoted 4 lines
board/karo/tk71/tk71.c new file +4 -0
+
+	/* 256MB module, adjust BAR register */
+	if (size == 256 * 1024 * 1024)
+		writel(0x0ffffff1, KW_REG_CPUCS_WIN_SZ(0));

No hard coding please, please use register structures (preferred)

board/karo/tk71/tk71.c line 131

Quoted 4 lines
board/karo/tk71/tk71.c new file +4 -0
+
+	gd->bd->bi_dram[0].size = size;
+	gd->ram_size = size;
+}

You have created kwbimage.cfg in this, it makes more sense to set 256MB size by default in kwbimage.cfg. Or preferred use any existing kwbimage.cfg (preferred)

The main idea of having such weak functions is to avoid code duplication (kwbimage.cfg) for small manageable changes.

Regards..
Prafulla . . .

#7 lore raw

PATCH 3/3 Kirkwood: Add support for Ka-Ro TK71

Dear Prafulla Wadaskar,

Quoted 160 lines
Quoted 28 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 26 June 2012 17:45
To: u-boot at lists.denx.de
Cc: Marek Vasut; Prafulla Wadaskar; Wolfgang Denk
Subject: [PATCH 3/3] Kirkwood: Add support for Ka-Ro TK71

Cc Prafulla Wadaskar <[email protected]>
Cc Wolfgang Denk <[email protected]>

---

 board/karo/tk71/Makefile     |   45 +++++++++++
 board/karo/tk71/kwbimage.cfg |  174

+++++++++++++++++++++++++++++++++++++++++

 board/karo/tk71/tk71.c       |  178

++++++++++++++++++++++++++++++++++++++++++

 boards.cfg                   |    1 +
 include/configs/tk71.h       |  128 ++++++++++++++++++++++++++++++
 5 files changed, 526 insertions(+)
 create mode 100644 board/karo/tk71/Makefile
 create mode 100644 board/karo/tk71/kwbimage.cfg
 create mode 100644 board/karo/tk71/tk71.c
 create mode 100644 include/configs/tk71.h

...snip...

Quoted 129 lines
board/karo/tk71/tk71.c new file +42 -0
new file mode 100644
index 0000000..b2c1a62
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2012 Marek Vasut <[email protected]>
+ * on behalf of DENX Software Engineering GmbH
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <common.h>
+#include <miiphy.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/kirkwood.h>
+#include <asm/arch/mpp.h>
+#include <asm/io.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define TK71_OE_LOW			(~0)
+#define TK71_OE_HIGH			(~0)
+#define TK71_OE_VAL_LOW			(0)
+#define TK71_OE_VAL_HIGH		(0)
+
+int board_early_init_f(void)
+{
+	/*
+	 * default gpio configuration
+	 * There are maximum 64 gpios controlled through 2 sets of

registers

board/karo/tk71/tk71.c new file +80 -0
+	 * the  below configuration configures mainly initial LED status
+	 */
+	kw_config_gpio(TK71_OE_VAL_LOW,
+			TK71_OE_VAL_HIGH,
+			TK71_OE_LOW, TK71_OE_HIGH);
+
+	/* Multi-Purpose Pins Functionality configuration */
+	u32 kwmpp_config[] = {
+		MPP0_NF_IO2,
+		MPP1_NF_IO3,
+		MPP2_NF_IO4,
+		MPP3_NF_IO5,
+		MPP4_NF_IO6,
+		MPP5_NF_IO7,
+		MPP6_SYSRST_OUTn,
+		MPP7_GPO,
+		MPP8_TW_SDA,
+		MPP9_TW_SCK,
+		MPP10_UART0_TXD,
+		MPP11_UART0_RXD,
+		MPP12_SD_CLK,
+		MPP13_SD_CMD,
+		MPP14_SD_D0,
+		MPP15_SD_D1,
+		MPP16_SD_D2,
+		MPP17_SD_D3,
+		MPP18_NF_IO0,
+		MPP19_NF_IO1,
+		MPP20_GE1_0,
+		MPP21_GE1_1,
+		MPP22_GE1_2,
+		MPP23_GE1_3,
+		MPP24_GE1_4,
+		MPP25_GE1_5,
+		MPP26_GE1_6,
+		MPP27_GE1_7,
+		MPP28_GPIO,
+		MPP29_GPIO,
+		MPP30_GE1_10,
+		MPP31_GE1_11,
+		MPP32_GE1_12,
+		MPP33_GE1_13,
+		MPP34_GPIO,
+		MPP35_GPIO,
+		MPP36_GPIO,
+		MPP37_GPIO,
+		MPP38_GPIO,
+		MPP39_GPIO,
+		MPP40_GPIO,
+		MPP41_GPIO,
+		MPP42_GPIO,
+		MPP43_GPIO,
+		MPP44_GPIO,
+		MPP45_GPIO,
+		MPP46_GPIO,
+		MPP47_GPIO,
+		MPP48_GPIO,
+		MPP49_GPIO,
+		0
+	};
+	kirkwood_mpp_conf(kwmpp_config);
+
+	return 0;
+}
+
+int board_init(void)
+{
+	/*
+	 * arch number of board
+	 */
+	gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
+
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+
+	return 0;
+}
+
+void kw_adjust_dram(void)
+{
Quoted 8 lines

board/karo/tk71/tk71.c line 127

Quoted 6 lines
board/karo/tk71/tk71.c new file +1 -0
+	unsigned long size = get_ram_size(PHYS_SDRAM_1,

PHYS_SDRAM_1_SIZE);

board/karo/tk71/tk71.c new file +4 -0
+
+	/* 256MB module, adjust BAR register */
+	if (size == 256 * 1024 * 1024)
+		writel(0x0ffffff1, KW_REG_CPUCS_WIN_SZ(0));

No hard coding please, please use register structures (preferred)

Do we have any such structures defined ?

Quoted 8 lines

board/karo/tk71/tk71.c line 131

Quoted 4 lines
board/karo/tk71/tk71.c new file +4 -0
+
+	gd->bd->bi_dram[0].size = size;
+	gd->ram_size = size;
+}

You have created kwbimage.cfg in this, it makes more sense to set 256MB size by default in kwbimage.cfg. Or preferred use any existing kwbimage.cfg (preferred)

I don't think I follow. I always believe these are for setting up the platform, so at least one per platform is necessary.

Quoted 2 lines

The main idea of having such weak functions is to avoid code duplication (kwbimage.cfg) for small manageable changes.

But then, isn't this a bit out of scope of this patchset? Unifying kwbimages I mean ...

Quoted 2 lines

Regards..
Prafulla . . .

Best regards,
Marek Vasut

#8 lore raw

PATCH 3/3 Kirkwood: Add support for Ka-Ro TK71

Quoted 25 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 26 June 2012 18:15
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Wolfgang Denk
Subject: Re: [PATCH 3/3] Kirkwood: Add support for Ka-Ro TK71

Dear Prafulla Wadaskar,

Quoted 14 lines
Quoted 14 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 26 June 2012 17:45
To: u-boot at lists.denx.de
Cc: Marek Vasut; Prafulla Wadaskar; Wolfgang Denk
Subject: [PATCH 3/3] Kirkwood: Add support for Ka-Ro TK71

Cc Prafulla Wadaskar <[email protected]>
Cc Wolfgang Denk <[email protected]>

---

 board/karo/tk71/Makefile     |   45 +++++++++++
 board/karo/tk71/kwbimage.cfg |  174

...snip...

Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
board/karo/tk71/tk71.c new file +15 -0
+int board_init(void)
+{
+	/*
+	 * arch number of board
+	 */
+	gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
+
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+
+	return 0;
+}
+
+void kw_adjust_dram(void)
+{
Quoted 8 lines

board/karo/tk71/tk71.c line 127

Quoted 6 lines
(quoted diff) +1 -0
+	unsigned long size = get_ram_size(PHYS_SDRAM_1,

PHYS_SDRAM_1_SIZE);

board/karo/tk71/tk71.c new file +4 -0
+
+	/* 256MB module, adjust BAR register */
+	if (size == 256 * 1024 * 1024)
+		writel(0x0ffffff1, KW_REG_CPUCS_WIN_SZ(0));

No hard coding please, please use register structures (preferred)

Quoted 1 line

Do we have any such structures defined ?

There are few structures in place but not for DRAM, let's do it, this was missing part in early patches.

Quoted 7 lines
Quoted 7 lines

board/karo/tk71/tk71.c line 131

Quoted 5 lines
board/karo/tk71/tk71.c new file +4 -0
+
+	gd->bd->bi_dram[0].size = size;
+	gd->ram_size = size;
+}

You have created kwbimage.cfg in this, it makes more sense to set

Quoted 7 lines

256MB

Quoted 2 lines

size by default in kwbimage.cfg. Or preferred use any existing kwbimage.cfg (preferred)

I don't think I follow. I always believe these are for setting up the platform,
so at least one per platform is necessary.

Ideally YES, but if we have similar platforms and delta is very small like tuning DRAM size, then for such things we can reuse existing one by supporting additional post configuration using board_early_init_f()

This is something positive to avoid code duplication in a cleaner way.

Quoted 7 lines
Quoted 2 lines

The main idea of having such weak functions is to avoid code

duplication

Quoted 1 line

(kwbimage.cfg) for small manageable changes.

But then, isn't this a bit out of scope of this patchset? Unifying kwbimages I

Yes, so please keep you board support patch separate (standalone)