[U-Boot] [PATCH v2] mx6sx: Add initial support for Samtec VIN|ING 2000 board

Marek Vasut marex at denx.de
Wed Nov 23 17:49:42 CET 2016


On 11/23/2016 05:33 PM, Christoph Fritz wrote:
> This patch adds initial support for Samtec VIN|ING 2000 board.
> 
> Signed-off-by: Christoph Fritz <chf.fritz at googlemail.com>
> ---

[...]

> diff --git a/board/samtec/vining_2000/vining_2000.c b/board/samtec/vining_2000/vining_2000.c
> new file mode 100644
> index 0000000..66ebe89
> --- /dev/null
> +++ b/board/samtec/vining_2000/vining_2000.c
> @@ -0,0 +1,504 @@
> +/*
> + * Copyright (C) 2016 samtec automotive software & electronics gmbh

Isn't GmbH written with caps at the beginning and end ? ;-)

> + *
> + * Author: Christoph Fritz <chf.fritz at googlemail.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <asm/arch/clock.h>
> +#include <asm/arch/crm_regs.h>
> +#include <asm/arch/iomux.h>
> +#include <asm/arch/imx-regs.h>
> +#include <asm/arch/mx6-pins.h>
> +#include <asm/arch/sys_proto.h>
> +#include <asm/gpio.h>
> +#include <asm/imx-common/iomux-v3.h>
> +#include <asm/io.h>
> +#include <asm/imx-common/mxc_i2c.h>
> +#include <linux/sizes.h>
> +#include <common.h>
> +#include <fsl_esdhc.h>
> +#include <mmc.h>
> +#include <i2c.h>
> +#include <miiphy.h>
> +#include <netdev.h>
> +#include <power/pmic.h>
> +#include <power/pfuze100_pmic.h>
> +#include <usb.h>
> +#include <usb/ehci-ci.h>

This ehci-ci.h is probably unneeded.

> +#include <pwm.h>
> +#include <wait_bit.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;


[...]

> +int board_eth_init(bd_t *bis)
> +{
> +	struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
> +	int ret;
> +	unsigned char eth1addr[6];
> +
> +	imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
> +	gpio_direction_output(IMX_GPIO_NR(5, 9) , 0);
> +
> +	/*
> +	 * Generate phy reference clock via pin IOMUX ENET_REF_CLK1/2 by erasing
> +	 * ENET1/2_TX_CLK_DIR gpr1[14:13], so that reference clock is driven by
> +	 * ref_enetpll0/1 and enable ENET1/2_TX_CLK output driver.
> +	 */
> +	clrsetbits_le32(&iomuxc_regs->gpr[1],
> +			IOMUX_GPR1_FEC1_CLOCK_MUX2_SEL_MASK |
> +			IOMUX_GPR1_FEC2_CLOCK_MUX2_SEL_MASK,
> +			IOMUX_GPR1_FEC1_CLOCK_MUX1_SEL_MASK |
> +			IOMUX_GPR1_FEC2_CLOCK_MUX1_SEL_MASK);
> +
> +	ret = enable_fec_anatop_clock(0, ENET_50MHZ);
> +
> +	if (ret)
> +		printf("FEC anatop MXC: %s:failed (%0x)\n",  __func__, ret);

If failure happens, you should likely bail out.

> +	/* reset phy */
> +	gpio_set_value(IMX_GPIO_NR(5, 9), 0);
> +	mdelay(20);
> +	gpio_set_value(IMX_GPIO_NR(5, 9), 1);
> +	mdelay(1);
> +
> +	ret = fecmxc_initialize_multi(bis, 0, CONFIG_FEC_MXC_PHYADDR,
> +					IMX_FEC_BASE);
> +	if (ret)
> +		printf("FEC MXC: %s:failed\n", __func__);

DTTO

> +	/* just to get secound mac address */
> +	imx_get_mac_from_fuse(1, eth1addr);
> +	if (!getenv("eth1addr") && is_valid_ethaddr(eth1addr))
> +		eth_setenv_enetaddr("eth1addr", eth1addr);
> +
> +	return ret;
> +}

[...]

> +#ifdef CONFIG_USB_EHCI_MX6
> +#define USB_OTHERREGS_OFFSET	0x800
> +#define UCTRL_PWR_POL		(1 << 9)

These two macros are unused

> +static iomux_v3_cfg_t const usb_otg_pads[] = {
> +	/* OGT1 */
> +	MX6_PAD_GPIO1_IO09__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> +	MX6_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL),
> +	/* OTG2 */
> +	MX6_PAD_GPIO1_IO12__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL)
> +};
> +
> +static void setup_iomux_usb(void)
> +{
> +	imx_iomux_v3_setup_multiple_pads(usb_otg_pads,
> +					 ARRAY_SIZE(usb_otg_pads));
> +}
> +
> +int board_usb_phy_mode(int port)
> +{
> +	if (port == 1)
> +		return USB_INIT_HOST;
> +	else
> +		return usb_phy_mode(port);
> +}
> +#endif
> +
> +static int set_pwm_leds(void)
> +{
> +#ifdef CONFIG_PWM_IMX
> +	imx_iomux_v3_setup_multiple_pads(pwm_led_pads,
> +					 ARRAY_SIZE(pwm_led_pads));
> +	/* enable backlight PWM 2, green LED */
> +	if (pwm_init(1, 0, 0))
> +		goto error;
> +	/* duty cycle 200ns, period: 8000ns */
> +	if (pwm_config(1, 200, 8000))
> +		goto error;
> +	if (pwm_enable(1))
> +		goto error;
> +
> +	/* enable backlight PWM 1, blue LED */
> +	if (pwm_init(0, 0, 0))
> +		goto error;
> +	/* duty cycle 200ns, period: 8000ns */
> +	if (pwm_config(0, 200, 8000))
> +		goto error;
> +	if (pwm_enable(0))
> +		goto error;
> +
> +	/* enable backlight PWM 6, red LED */
> +	if (pwm_init(5, 0, 0))
> +		goto error;
> +	/* duty cycle 200ns, period: 8000ns */
> +	if (pwm_config(5, 200, 8000))
> +		goto error;
> +	if (pwm_enable(5))
> +		goto error;
> +#endif
> +
> +	return 0;
> +error:

Compiler will complain about unused label here if CONFIG_PWM_IMX is not set.

> +	return -1;
> +}


[...]

> +static struct fsl_esdhc_cfg usdhc_cfg[2] = {
> +	{USDHC4_BASE_ADDR},

Fill the 0, 0 here for consistency, it triggers my OCD.

> +	{USDHC2_BASE_ADDR, 0, 4},
> +};
> +
> +#define USDHC2_CD_GPIO IMX_GPIO_NR(3, 28)

[...]

> diff --git a/include/configs/vining_2000.h b/include/configs/vining_2000.h
> new file mode 100644
> index 0000000..24d8daa
> --- /dev/null
> +++ b/include/configs/vining_2000.h
> @@ -0,0 +1,140 @@
> +/*
> + * Copyright (C) 2016 samtec automotive software & electronics gmbh
> + *
> + * Configuration settings for the Samtec VIN|ING 2000 board.
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +#include "mx6_common.h"
> +
> +#ifdef CONFIG_SPL
> +#include "imx6_spl.h"
> +#endif
> +
> +/* Size of malloc() pool */
> +#define CONFIG_SYS_MALLOC_LEN		(3 * SZ_1M)
> +
> +#define CONFIG_BOARD_EARLY_INIT_F
> +
> +#define CONFIG_MXC_UART
> +#define CONFIG_MXC_UART_BASE		UART1_BASE
> +
> +#define CONFIG_EXTRA_ENV_SETTINGS \
> +	"image=zImage-vining2000\0" \
> +	"console=ttymxc0\0" \
> +	"fdt_file=imx6sx-samtec-vining2000.dtb\0" \
> +	"fdt_addr=0x88000000\0" \
> +	"boot_fdt=try\0" \
> +	"loadaddr=0x80800000\0" \
> +	"ip_dyn=yes\0" \
> +	"mmcroot=/dev/mmcblk1p1 rootwait rw\0" \
> +	"emmcargs=setenv bootargs console=${console},${baudrate} " \
> +		"root=${mmcroot} fsckfix panic=3\0" \
> +	"emmcboot=echo Booting from emmc ...; " \
> +		"run emmcargs; mmc dev 0 0; mmc partconf 0 1 0x1 0x1; " \
> +		"load mmc 0:1 ${fdt_addr} oftree; " \
> +		"load mmc 0:1 ${loadaddr} zImage; " \
> +		"bootz ${loadaddr} - ${fdt_addr};\0" \
> +	"netargs=setenv bootargs console=${console},${baudrate} " \
> +		"root=/dev/nfs ip=dhcp rw\0" \
> +	"netboot=echo Booting from net ...; " \
> +		"run netargs; dhcp ${image}; dhcp ${fdt_addr} ${fdt_file}; " \
> +		"bootz ${loadaddr} - ${fdt_addr};\0"

Can we switch to fitImage instead _

[...]

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list