Skip to contentSkip to conversation

ARM: imx6: Add Bachmann electronic ot1205 mr board

PATCH New Christian Gmeiner 5 participants 5 messages Nov 6, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: imx6: Add Bachmann electronic ot1205 mr board

Add basic support for the Bachmann electronic ot1205 board. It is powered by an imx6d and will come in different flavours. This patch adds support for the mr flavour. It has a front panel with some LEDs and some keys.

---
 board/bachmann/ot1205/Makefile |    9 ++
 board/bachmann/ot1205/ot1205.c |  236 ++++++++++++++++++++++++++++++++++++++++
 boards.cfg                     |    1 +
 include/configs/ot1205.h       |  231 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 477 insertions(+)
 create mode 100644 board/bachmann/ot1205/Makefile
 create mode 100644 board/bachmann/ot1205/ot1205.c
 create mode 100644 include/configs/ot1205.h
board/bachmann/ot1205/Makefile new file +9 -0
new file mode 100644
index 0000000..75933c4
@@ -0,0 +1,9 @@
+#
+# Copyright (C) 2012-2013, Guennadi Liakhovetski <[email protected]>
+# (C) Copyright 2012-2013 Freescale Semiconductor, Inc.
+# Copyright (C) 2013, Boundary Devices <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y  := ot1205.o
board/bachmann/ot1205/ot1205.c new file +236 -0

236 lines not on this page · raw message

boards.cfg +1 -0
index 5e10125..13dff3b 100644
@@ -291,6 +291,7 @@ Active  arm         armv7          mx5         ttcontrol       vision2
 Active  arm         armv7          mx6         -               wandboard           wandboard_dl                         wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL,DDR_MB=1024                                                  Fabio Estevam <[email protected]>
 Active  arm         armv7          mx6         -               wandboard           wandboard_quad                       wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q2g.cfg,MX6Q,DDR_MB=2048                                                  Fabio Estevam <[email protected]>
 Active  arm         armv7          mx6         -               wandboard           wandboard_solo                       wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s.cfg,MX6S,DDR_MB=512                                                     Fabio Estevam <[email protected]>
+Active  arm         armv7          mx6         bachmann        ot1205              ot1205_mr                            ot1205:IMX_CONFIG=board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg,BOARDVER="mr"                                                                    Christian Gmeiner <[email protected]>
 Active  arm         armv7          mx6         boundary        nitrogen6x          mx6qsabrelite                        nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q.cfg,MX6Q,DDR_MB=1024,SABRELITE                                         Eric Nelson <[email protected]>
 Active  arm         armv7          mx6         boundary        nitrogen6x          nitrogen6dl                          nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL,DDR_MB=1024                                                 Eric Nelson <[email protected]>
 Active  arm         armv7          mx6         boundary        nitrogen6x          nitrogen6dl2g                        nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl2g.cfg,MX6DL,DDR_MB=2048                                               Eric Nelson <[email protected]>
include/configs/ot1205.h new file +231 -0

231 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 ARM: imx6: Add Bachmann electronic ot1205 mr board

Dear Christian Gmeiner,

Quoted 6 lines · In message <[email protected]> you…

Add basic support for the Bachmann electronic ot1205 board. It is powered by an imx6d and will come in different flavours. This patch adds support for the mr flavour. It has a front panel with some LEDs and some keys.

Quoted 9 lines
---
 board/bachmann/ot1205/Makefile |    9 ++
 board/bachmann/ot1205/ot1205.c |  236 ++++++++++++++++++++++++++++++++++++++++
 boards.cfg                     |    1 +
 include/configs/ot1205.h       |  231 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 477 insertions(+)
 create mode 100644 board/bachmann/ot1205/Makefile
 create mode 100644 board/bachmann/ot1205/ot1205.c
 create mode 100644 include/configs/ot1205.h

Please run your patch through checkpatch and fix the reported issues.

Thanks.

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All I ask is a chance to prove that money can't make me happy.
#2 lore raw

PATCH 1/1 ARM: imx6: Add Bachmann electronic ot1205 mr board

In reply to Christian Gmeiner

Hi Christian,

Quoted 5 lines · Christian Gmeiner

Add basic support for the Bachmann electronic ot1205 board. It is powered by an imx6d and will come in different flavours. This patch adds support for the mr flavour. It has a front panel with some LEDs and some keys.

...

board/bachmann/ot1205/ot1205.c line 63

Quoted 6 lines
board/bachmann/ot1205/ot1205.c new file +6 -0
+
+iomux_v3_cfg_t const uart1_pads[] = {
+	MX6_PAD_CSI0_DAT10__UART1_TXD | MUX_PAD_CTRL(UART_PAD_CTRL),
+	MX6_PAD_CSI0_DAT11__UART1_RXD | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+

Depending on which applies, first, you may need to change the names of these pad registers as shown in this patch:

	http://lists.denx.de/pipermail/u-boot/2013-November/166162.html

Regards,

Eric

#3 lore raw

PATCH 1/1 ARM: imx6: Add Bachmann electronic ot1205 mr board

In reply to Christian Gmeiner

Hi Christian,

Quoted 4 lines · Christian Gmeiner

Add basic support for the Bachmann electronic ot1205 board. It is powered by an imx6d and will come in different flavours. This patch adds support for the mr flavour. It has a front panel with some LEDs and some keys.

Maybe it helps if you add here a short list of peripheral that are supported. From code, I see at least SDHC and ethernet.

Quoted 95 lines
board/bachmann/ot1205/ot1205.c new file +89 -0
new file mode 100644
index 0000000..37c6159
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2010-2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013, Bachmann electronic GmbH
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/iomux.h>
+#include <asm/arch/sys_proto.h>
+#include <malloc.h>
+#include <asm/arch/mx6-pins.h>
+#include <asm/errno.h>
+#include <asm/gpio.h>
+#include <asm/imx-common/iomux-v3.h>
+#include <asm/imx-common/mxc_i2c.h>
+#include <asm/imx-common/boot_mode.h>
+#include <mmc.h>
+#include <fsl_esdhc.h>
+#include <micrel.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <asm/arch/crm_regs.h>
+#include <i2c.h>
+#include <pca953x.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define UART_PAD_CTRL  (PAD_CTL_PUS_100K_UP |			\
+	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm |			\
+	PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP |			\
+	PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm |			\
+	PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |			\
+	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
+
+#define SPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_SPEED_MED |		\
+	PAD_CTL_DSE_40ohm     | PAD_CTL_SRE_FAST)
+
+#define I2C_PAD_CTRL	(PAD_CTL_PUS_100K_UP |			\
+	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS |	\
+	PAD_CTL_ODE | PAD_CTL_SRE_FAST)
+
+#define OUTPUT_40OHM (PAD_CTL_SPEED_MED|PAD_CTL_DSE_40ohm)
+
+int dram_init(void)
+{
+	gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
+
+	return 0;
+}
+
+iomux_v3_cfg_t const uart1_pads[] = {
+	MX6_PAD_CSI0_DAT10__UART1_TXD | MUX_PAD_CTRL(UART_PAD_CTRL),
+	MX6_PAD_CSI0_DAT11__UART1_RXD | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+
+
+static void setup_iomux_uart(void)
+{
+	imx_iomux_v3_setup_multiple_pads(uart1_pads,
+					ARRAY_SIZE(uart1_pads));
+}
+
+int board_early_init_f(void)
+{
+	setup_iomux_uart();
+
+	return 0;
+}
+
+iomux_v3_cfg_t const ecspi1_pads[] = {
+	MX6_PAD_DISP0_DAT3__ECSPI3_SS0  | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_DISP0_DAT4__ECSPI3_SS1  | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_DISP0_DAT2__ECSPI3_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_DISP0_DAT1__ECSPI3_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_DISP0_DAT0__ECSPI3_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
+};
+
+void setup_spi(void)
+{
+	imx_iomux_v3_setup_multiple_pads(ecspi1_pads,
+					 ARRAY_SIZE(ecspi1_pads));

board/bachmann/ot1205/ot1205.c line 99

Quoted 10 lines
board/bachmann/ot1205/ot1205.c new file +10 -0
+}
+
+/*
+ * Do not overwrite the console
+ * Use always serial for U-Boot console
+ */
+int overwrite_console(void)
+{
+	return 1;
+}

You do not add video capabilities: you can simply drop overwrite_console().

Quoted 10 lines
board/bachmann/ot1205/ot1205.c new file +10 -0
+
+iomux_v3_cfg_t const usdhc3_pads[] = {
+	MX6_PAD_SD3_CLK__USDHC3_CLK   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD3_CMD__USDHC3_CMD   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD3_DAT0__USDHC3_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD3_DAT1__USDHC3_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD3_DAT2__USDHC3_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD3_DAT3__USDHC3_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD3_DAT4__USDHC3_DAT4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD3_DAT5__USDHC3_DAT5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),

board/bachmann/ot1205/ot1205.c line 119

Quoted 10 lines
board/bachmann/ot1205/ot1205.c new file +10 -0
+	MX6_PAD_SD3_DAT6__USDHC3_DAT6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD3_DAT7__USDHC3_DAT7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD3_RST__USDHC3_RST | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+};
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+	// returns -1 to indicate that no card-detection mechanism is implemented;
+	// 0 indicates that no card is present and
+	// 1 is returned if it was detected that a card is present.

As codestyle we do not use C++ comments

board/bachmann/ot1205/ot1205.c line 174

Quoted 7 lines
board/bachmann/ot1205/ot1205.c new file +7 -0
+int board_eth_init(bd_t *bis)
+{
+	setup_iomux_enet();
+	fecmxc_initialize(bis);
+
+	return 0;
+}

There is not special hndling in this board function. You could move setup_iomux_enet() into board_early_init() to setup the pinmux and drop this function. It is then responsability of cpu_eth_init() the initialization of the FEC controller.

Quoted 31 lines
board/bachmann/ot1205/ot1205.c new file +31 -0
+
+#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
+
+/* I2C2 - EDID */
+struct i2c_pads_info i2c_pad_info1 = {
+        .scl = {
+                .i2c_mode = MX6_PAD_EIM_EB2__I2C2_SCL | PC,
+                .gpio_mode = MX6_PAD_EIM_EB2__GPIO_2_30 | PC,
+                .gp = IMX_GPIO_NR(2, 30)
+        },
+        .sda = {
+                .i2c_mode = MX6_PAD_EIM_D16__I2C2_SDA | PC,
+                .gpio_mode = MX6_PAD_EIM_D16__GPIO_3_16 | PC,
+                .gp = IMX_GPIO_NR(3, 16)
+        }
+};
+
+/* I2C3 - keys, led, temp sensor */
+struct i2c_pads_info i2c_pad_info2 = {
+	.scl = {
+		.i2c_mode = MX6_PAD_EIM_D17__I2C3_SCL | PC,
+		.gpio_mode = MX6_PAD_EIM_D17__GPIO_3_17 | PC,
+		.gp = IMX_GPIO_NR(3, 17)
+	},
+	.sda = {
+		.i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
+		.gpio_mode = MX6_PAD_EIM_D18__GPIO_3_18 | PC,
+		.gp = IMX_GPIO_NR(3, 18)
+	}
+};
+

board/bachmann/ot1205/ot1205.c line 215

Quoted 10 lines
board/bachmann/ot1205/ot1205.c new file +10 -0
+iomux_v3_cfg_t const pwm_pad[] = {
+	MX6_PAD_SD1_CMD__PWM4_PWMO | MUX_PAD_CTRL(OUTPUT_40OHM),
+};
+
+static void leds_on(void)
+{
+	i2c_set_bus_num(2);
+	pca953x_set_dir(0x20, 0xffff, PCA953X_DIR_OUT);
+	pca953x_set_val(0x20, 0xffff, 0x0);
+}

Please add defines instead of fixed constants.

board/bachmann/ot1205/ot1205.c line 234

Quoted 4 lines
board/bachmann/ot1205/ot1205.c new file +4 -0
+
+int checkboard(void)
+{
+	puts("Board: "CONFIG_SYS_BOARD" "CONFIG_BOARDVER" \n");

I see we have some discrepancies in code. Sometimes we use CONFIG_SYS_BOARD_NAME, sometimes (mx28evk). We have several CONFIG_SYS_BOARD_*, it will be better to extend the name to CONFIG_SYS_BOARD_NAME.

Regarding the board version: I understand this is a board type, not a revision number. Then CONFIG_BOARDVER does not seem the best choice to represent the meaning.

Quoted 228 lines
include/configs/ot1205.h new file +221 -0
new file mode 100644
index 0000000..fc87d7c
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2010-2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013, Bachmann electronic GmbH
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_MX6
+#define CONFIG_MX6Q
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#include <asm/arch/imx-regs.h>
+#include <asm/imx-common/gpio.h>
+
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_REVISION_TAG
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN           (10 * 1024 * 1024)
+
+#define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_MXC_GPIO
+
+#define CONFIG_CMD_FUSE
+#ifdef CONFIG_CMD_FUSE
+#define CONFIG_MXC_OCOTP
+#endif
+
+/* UART Configs */
+#define CONFIG_MXC_UART
+#define CONFIG_MXC_UART_BASE           UART1_BASE
+
+/* SF Configs */
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_STMICRO
+#define CONFIG_MXC_SPI
+#define CONFIG_SF_DEFAULT_BUS  2
+#define CONFIG_SF_DEFAULT_CS   (0|(IMX_GPIO_NR(1, 3)<<8))
+#define CONFIG_SF_DEFAULT_SPEED 25000000
+#define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
+
+/* IO expander */
+#define CONFIG_PCA953X
+#define CONFIG_SYS_I2C_PCA953X_ADDR	0x20
+#define CONFIG_SYS_I2C_PCA953X_WIDTH	{ {0x20, 16} }
+#define CONFIG_CMD_PCA953X
+#define CONFIG_CMD_PCA953X_INFO
+
+/* I2C Configs */
+#define CONFIG_CMD_I2C
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_I2C_SPEED            100000
+
+/* OCOTP Configs */
+#define CONFIG_CMD_IMXOTP
+#ifdef CONFIG_CMD_IMXOTP
+#define CONFIG_IMX_OTP
+#define IMX_OTP_BASE                    OCOTP_BASE_ADDR
+#define IMX_OTP_ADDR_MAX                0x7F
+#define IMX_OTP_DATA_ERROR_VAL          0xBADABADA
+#define IMX_OTPWRITE_ENABLED
+#endif
+
+/* MMC Configs */
+#define CONFIG_FSL_ESDHC
+#define CONFIG_FSL_USDHC
+#define CONFIG_SYS_FSL_ESDHC_ADDR      0
+#define CONFIG_SYS_FSL_USDHC_NUM       2
+
+#define CONFIG_MMC
+#define CONFIG_CMD_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_BOUNCE_BUFFER
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_FEC_MXC
+#define CONFIG_MII
+#define IMX_FEC_BASE                    ENET_BASE_ADDR
+#define CONFIG_FEC_XCV_TYPE             MII100
+#define CONFIG_ETHPRIME                 "FEC"
+#define CONFIG_FEC_MXC_PHYADDR          0x5
+#define CONFIG_PHYLIB
+
+/* Miscellaneous commands */
+#define CONFIG_CMD_BMODE
+#define CONFIG_CMD_SETEXPR
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                115200
+
+/* Command definition */
+#include <config_cmd_default.h>
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY               1
+
+#define CONFIG_PREBOOT                 ""
+
+#define CONFIG_LOADADDR                0x12000000
+#define CONFIG_SYS_TEXT_BASE           0x17800000
+
+/* Miscellaneous configurable options */
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT              "U-Boot > "
+#define CONFIG_SYS_CBSIZE              1024
+
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_MAXARGS             16
+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
+
+#define CONFIG_SYS_LOAD_ADDR           CONFIG_LOADADDR
+
+#define CONFIG_CMDLINE_EDITING
+
+/* Physical Memory Map */
+#define CONFIG_NR_DRAM_BANKS           1
+#define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
+#define PHYS_SDRAM_SIZE                (1u * 1024 * 1024 * 1024) /* TODO: needed? */
+
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM
+#define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
+#define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
+
+#define CONFIG_SYS_INIT_SP_OFFSET \
+        (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR \
+        (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
+
+/* FLASH and environment organization */
+#define CONFIG_SYS_NO_FLASH
+
+#define CONFIG_ENV_SIZE                 (8 * 1024)	/* 8 kb */
+#define CONFIG_ENV_IS_NOWHERE
+
+#define CONFIG_OF_LIBFDT
+#define CONFIG_CMD_BOOTZ
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+#define CONFIG_CMD_CACHE
+#endif
+
+#define CONFIG_CMD_BOOTZ
+#define CONFIG_SUPPORT_RAW_INITRD
+
+/* FS Configs */
+#define CONFIG_CMD_EXT3
+#define CONFIG_CMD_EXT4
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_FS_GENERIC
+
+/* needed for run-in etc. */
+#define CONFIG_BOOTP_SERVERIP
+#define CONFIG_BOOTP_BOOTFILE
+
+/*
+ * Memory layout for where various images get loaded by boot scripts
+ */
+#define MEM_LAYOUT_ENV_SETTINGS \
+	"scriptaddr=0x14000000\0" \
+	"kernel_addr_r=0x10000000\0" \
+	"fdt_addr_r=0x11000000\0" \
+	"ramdisk_addr_r=0x12A00000\0" \
+	"fdt_high=0xffffffff\0"   \
+	"initrd_high=0xffffffff\0"
+
+#ifdef CONFIG_CMD_MMC
+#define BOOTCMDS_MMC \
+	"mmc_boot=" \
+		"setenv devtype mmc; " \
+		"if mmc dev ${devnum}; then " \
+			"run scan_boot; " \
+		"fi\0" \
+	"bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0"
+#define BOOT_TARGETS_MMC "mmc0"
+#endif
+
+#define BOOTCMDS_COMMON \
+	"rootpart=2\0" \
+	\
+	"script_boot="                                                    \
+		"if load ${devtype} ${devnum}:${rootpart} "               \
+				"${scriptaddr} ${prefix}${script}; then " \
+			"echo ${script} found! Executing ...;"            \
+			"source ${scriptaddr};"                           \
+		"fi;\0"                                                   \
+	\
+	"scan_boot="                                                      \
+		"echo Scanning ${devtype} ${devnum}...; "                 \
+		"for prefix in ${boot_prefixes}; do "                     \
+			"for script in ${boot_scripts}; do "              \
+				"run script_boot; "                       \
+			"done; "                                          \
+		"done;\0"                                                 \
+	\
+	"boot_targets=" \
+		BOOT_TARGETS_MMC " " \
+		"\0" \
+	\
+	"boot_prefixes=/boot/ \0" \
+	\
+	"boot_scripts=boot.scr\0" \
+	\
+	BOOTCMDS_MMC \
+
+#define CONFIG_BOOTCOMMAND \

include/configs/ot1205.h line 231

Quoted 10 lines
include/configs/ot1205.h new file +10 -0
+	"for target in ${boot_targets}; do run bootcmd_${target}; done"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+        "soc=imx6d\0" \
+        "board="CONFIG_SYS_BOARD"\0" \
+        "boardver="CONFIG_BOARDVER"\0" \
+        MEM_LAYOUT_ENV_SETTINGS \
+        BOOTCMDS_COMMON
+
+#endif         /* __CONFIG_H */

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#4 lore raw

PATCH 1/1 ARM: imx6: Add Bachmann electronic ot1205 mr board

In reply to Christian Gmeiner

board/bachmann/ot1205/ot1205.c line 59

Quoted 8 lines · Christian Gmeiner
board/bachmann/ot1205/ot1205.c new file +8 -0
+int dram_init(void)
+{
+       gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
+
+       return 0;
+}
+
+iomux_v3_cfg_t const uart1_pads[] = {

You can make it static.

board/bachmann/ot1205/ot1205.c line 78

Quoted 8 lines
board/bachmann/ot1205/ot1205.c new file +8 -0
+int board_early_init_f(void)
+{
+       setup_iomux_uart();
+
+       return 0;
+}
+
+iomux_v3_cfg_t const ecspi1_pads[] = {

Ditto.

board/bachmann/ot1205/ot1205.c line 99

Quoted 8 lines
board/bachmann/ot1205/ot1205.c new file +8 -0
+/*
+ * Do not overwrite the console
+ * Use always serial for U-Boot console
+ */
+int overwrite_console(void)
+{
+       return 1;
+}

This can be removed.

Quoted 1 line

+iomux_v3_cfg_t const usdhc3_pads[] = {

static

board/bachmann/ot1205/ot1205.c line 120

Quoted 6 lines
board/bachmann/ot1205/ot1205.c new file +6 -0
+int board_mmc_getcd(struct mmc *mmc)
+{
+       // returns -1 to indicate that no card-detection mechanism is implemented;
+       // 0 indicates that no card is present and
+       // 1 is returned if it was detected that a card is present.
+       return 1;

No // style comments.

board/bachmann/ot1205/ot1205.c line 139

Quoted 13 lines
board/bachmann/ot1205/ot1205.c new file +13 -0
+int board_mmc_init(bd_t *bis)
+{
+       s32 status = 0;
+
+       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+       usdhc_cfg[0].max_bus_width = 8;
+
+       imx_iomux_v3_setup_multiple_pads(
+               usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
+
+       status |= fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
+
+       return status;

You can get rid of the status variable and just do:

return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);

board/bachmann/ot1205/ot1205.c line 142

Quoted 3 lines
board/bachmann/ot1205/ot1205.c new file +3 -0
+}
+
+iomux_v3_cfg_t const enet_pads[] = {

static

board/bachmann/ot1205/ot1205.c line 179

Quoted 2 lines
board/bachmann/ot1205/ot1205.c new file +2 -0
+/* I2C2 - EDID */
+struct i2c_pads_info i2c_pad_info1 = {

static

Quoted 4 lines
board/bachmann/ot1205/ot1205.c new file +4 -0
+        .scl = {
+                .i2c_mode = MX6_PAD_EIM_EB2__I2C2_SCL | PC,
+                .gpio_mode = MX6_PAD_EIM_EB2__GPIO_2_30 | PC,
+                .gp = IMX_GPIO_NR(2, 30)

board/bachmann/ot1205/ot1205.c line 193

Quoted 10 lines
board/bachmann/ot1205/ot1205.c new file +10 -0
+        },
+        .sda = {
+                .i2c_mode = MX6_PAD_EIM_D16__I2C2_SDA | PC,
+                .gpio_mode = MX6_PAD_EIM_D16__GPIO_3_16 | PC,
+                .gp = IMX_GPIO_NR(3, 16)
+        }
+};
+
+/* I2C3 - keys, led, temp sensor */
+struct i2c_pads_info i2c_pad_info2 = {

static

board/bachmann/ot1205/ot1205.c line 206

Quoted 13 lines
board/bachmann/ot1205/ot1205.c new file +13 -0
+       .scl = {
+               .i2c_mode = MX6_PAD_EIM_D17__I2C3_SCL | PC,
+               .gpio_mode = MX6_PAD_EIM_D17__GPIO_3_17 | PC,
+               .gp = IMX_GPIO_NR(3, 17)
+       },
+       .sda = {
+               .i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
+               .gpio_mode = MX6_PAD_EIM_D18__GPIO_3_18 | PC,
+               .gp = IMX_GPIO_NR(3, 18)
+       }
+};
+
+iomux_v3_cfg_t const pwm_pad[] = {

static

Quoted 4 lines

+++ b/include/configs/ot1205.h

include/configs/ot1205.h new file +2 -0
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2010-2013 Freescale Semiconductor, Inc.

include/configs/ot1205.h line 12

Quoted 10 lines
include/configs/ot1205.h new file +10 -0
+ * Copyright (C) 2013, Bachmann electronic GmbH
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_MX6
+#define CONFIG_MX6Q

If you pass the mx6 version in boards.cfg, then it will make things easier when you add support for the other board variants you have.

include/configs/ot1205.h line 25

Quoted 13 lines
include/configs/ot1205.h new file +13 -0
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#include <asm/arch/imx-regs.h>
+#include <asm/imx-common/gpio.h>
+
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_REVISION_TAG
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN           (10 * 1024 * 1024)

If you do not have video support you can use a smaller region, such as 2MB.

include/configs/ot1205.h line 68

Quoted 7 lines
include/configs/ot1205.h new file +7 -0
+/* OCOTP Configs */
+#define CONFIG_CMD_IMXOTP
+#ifdef CONFIG_CMD_IMXOTP
+#define CONFIG_IMX_OTP
+#define IMX_OTP_BASE                    OCOTP_BASE_ADDR
+#define IMX_OTP_ADDR_MAX                0x7F
+#define IMX_OTP_DATA_ERROR_VAL          0xBADABADA

Why do you need this? Not used anywehere.

Regards,

Fabio Estevam