All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] arm: mxs: add support for I2SE's Duckbill boards
Date: Sun, 13 Dec 2015 16:40:14 +0100	[thread overview]
Message-ID: <201512131640.14502.marex@denx.de> (raw)
In-Reply-To: <1450004998-30084-1-git-send-email-mhei@heimpold.de>

On Sunday, December 13, 2015 at 12:09:58 PM, Michael Heimpold wrote:

Commit message describing the board would be real nice.

> Signed-off-by: Michael Heimpold <mhei@heimpold.de>
> ---
> 
> Please note, that this board setup files need the function
> mxs_power_switch_dcdc_clocksource() as introduced in my patch
> "ARM: mxs: allow boards to select DC-DC switching clock source"

[...]

> diff --git a/arch/arm/include/asm/mach-types.h
> b/arch/arm/include/asm/mach-types.h index d51be0b..1f0ffaa 100644
> --- a/arch/arm/include/asm/mach-types.h
> +++ b/arch/arm/include/asm/mach-types.h
> @@ -1107,6 +1107,7 @@ extern unsigned int __machine_arch_type;
>  #define MACH_TYPE_COLIBRI_T30          4493
>  #define MACH_TYPE_APALIS_T30           4513
>  #define MACH_TYPE_OMAPL138_LCDK        2495
> +#define MACH_TYPE_DUCKBILL             4754

This board is still using mach id to boot kernel ? Wow ...

>  #ifdef CONFIG_ARCH_EBSA110
>  # ifdef machine_arch_type
> @@ -14188,6 +14189,18 @@ extern unsigned int __machine_arch_type;
>  # define machine_is_apalis_t30()	(0)
>  #endif

[...]

> +int board_init(void)
> +{
> +	/* Adress of boot parameters */
> +	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
> +
> +	return 0;
> +}
> +
> +#ifdef	CONFIG_CMD_MMC

#ifdef[SPACE] please, not [TAB]

> +int board_mmc_init(bd_t *bis)
> +{
> +	return mxsmmc_initialize(bis, 0, NULL, NULL);
> +}
> +#endif
> +
> +#ifdef	CONFIG_CMD_NET

DTTO

[...]

> +void mx28_adjust_mac(int dev_id, unsigned char *mac)
> +{
> +	mac[0] = 0x00;
> +	mac[1] = 0x01;
> +	mac[2] = 0x87;
> +}
> +#endif
> +
> +#ifdef CONFIG_OF_BOARD_SETUP
> +int ft_board_setup(void *blob, bd_t *bd)
> +{
> +	uint8_t enetaddr[6];
> +	u32 mac = 0;
> +
> +	enetaddr[0] = 0x00;
> +	enetaddr[1] = 0x01;
> +	enetaddr[2] = 0x87;

Looks like there are two copies of the same OUI ?

> +#ifdef CONFIG_MXS_OCOTP
> +	/* only Duckbill SPI has a MAC for the QCA7k */
> +	fuse_read(0, 1, &mac);
> +#endif
> +
> +	if (mac != 0) {
> +		enetaddr[3] = (mac >> 16) & 0xff;
> +		enetaddr[4] = (mac >>  8) & 0xff;
> +		enetaddr[5] =  mac        & 0xff;
> +
> +		fdt_find_and_setprop(blob,
> +		                    
> "/apb at 80000000/apbh at 80000000/ssp at 80014000/ethernet at 0", +		                
>     "local-mac-address", enetaddr, 6, 1);

You can use aliases {} to locate the ethernet node here.

> +	}
> +
> +	return 0;
> +}
> +#endif
> +
> +#ifdef CONFIG_REVISION_TAG
> +u32 get_board_rev(void)
> +{
> +	return system_rev;
> +}
> +#endif
> +
> +#ifdef CONFIG_SERIAL_TAG
> +void get_board_serial(struct tag_serialnr *serialnr)
> +{
> +	serialnr->low = serialno;
> +	serialnr->high = 0;
> +}
> +#endif
> +
> +int misc_init_r(void)
> +{
> +	unsigned int led_red_gpio;
> +	char *s;
> +
> +	/* Board revision detection */
> +	gpio_direction_input(MX28_PAD_LCD_D17__GPIO_1_17);
> +
> +	/* MX28_PAD_LCD_D17__GPIO_1_17: v1 = pull-down, v2 = pull-up */
> +	system_rev =
> +		gpio_get_value(MX28_PAD_LCD_D17__GPIO_1_17);

Does gpio_get_value() always return 0/1 value ? I don't think so.

> +	system_rev += 1;
> +
> +	/* enable red LED to indicate a running bootloader */
> +	if (system_rev == 1)
> +		led_red_gpio = MX28_PAD_AUART1_RX__GPIO_3_4;
> +	else
> +		led_red_gpio = MX28_PAD_SAIF0_LRCLK__GPIO_3_21;
> +	gpio_direction_output(led_red_gpio, 1);
> +
> +	if (system_rev == 1)
> +		puts("Board: I2SE Duckbill\n");
> +	else
> +		puts("Board: I2SE Duckbill 2\n");
> +
> +	serialno = getenv_ulong("serial#", 10, 0);
> +	s = getenv("serial#");
> +	if (s && s[0]) {
> +		puts("Serial: ");
> +		puts(s);
> +		putc('\n');
> +	}
> +
> +	return 0;
> +}

[...]

> diff --git a/include/configs/duckbill.h b/include/configs/duckbill.h
> new file mode 100644
> index 0000000..fa70f29
> --- /dev/null
> +++ b/include/configs/duckbill.h
> @@ -0,0 +1,216 @@
> +/*
> + * Copyright (C) 2014-2015 Michael Heimpold <mhei@heimpold.de>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +#ifndef __CONFIGS_DUCKBILL_H__
> +#define __CONFIGS_DUCKBILL_H__
> +
> +/* System configurations */
> +#define CONFIG_MX28				/* i.MX28 SoC */
> +#define CONFIG_MACH_TYPE	MACH_TYPE_DUCKBILL
> +
> +#define CONFIG_MISC_INIT_R
> +
> +#define CONFIG_SYS_MXS_VDD5V_ONLY
> +
> +/* U-Boot Commands */
> +#define CONFIG_SYS_NO_FLASH
> +#define CONFIG_DISPLAY_CPUINFO
> +#define CONFIG_DOS_PARTITION
> +
> +#define CONFIG_CMD_BOOTZ
> +#define CONFIG_CMD_CACHE
> +#define CONFIG_CMD_DHCP
> +#define CONFIG_CMD_EXT4
> +#define CONFIG_CMD_EXT4_WRITE
> +#define CONFIG_CMD_FAT
> +#define CONFIG_CMD_FUSE
> +#define CONFIG_CMD_GPIO
> +#define CONFIG_CMD_I2C
> +#define CONFIG_CMD_MII
> +#define CONFIG_CMD_MMC
> +#define CONFIG_CMD_SPI
> +#define CONFIG_CMD_UNZIP
> +
> +/* Memory configuration */
> +#define CONFIG_NR_DRAM_BANKS		1		/* 1 bank of DRAM 
*/
> +#define PHYS_SDRAM_1			0x40000000	/* Base address */
> +#define PHYS_SDRAM_1_SIZE		0x40000000	/* Max 1 GB RAM */
> +#define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
> +
> +/* Environment is in MMC */
> +#define CONFIG_ENV_OVERWRITE
> +#define CONFIG_ENV_IS_IN_MMC		1
> +#define CONFIG_ENV_SIZE			(128 * 1024)
> +#define CONFIG_ENV_OFFSET		(128 * 1024)
> +#define CONFIG_ENV_OFFSET_REDUND	(256 * 1024)
> +#define CONFIG_SYS_MMC_ENV_DEV		0
> +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
> +
> +/* FEC Ethernet on SoC */
> +#ifdef	CONFIG_CMD_NET
> +#define CONFIG_FEC_MXC
> +#define CONFIG_NET_MULTI
> +#define CONFIG_MX28_FEC_MAC_IN_OCOTP
> +#define CONFIG_FEC_MXC_PHYADDR	1
> +#define IMX_FEC_BASE		MXS_ENET0_BASE

This IMX_FEC_BASE is definitelly unused on MXS.

> +#endif
> +
> +#define CONFIG_IPADDR		192.168.1.10
> +#define CONFIG_SERVERIP		192.168.1.1
> +#define CONFIG_NETMASK		255.255.255.0
> +#define CONFIG_GATEWAYIP	192.168.1.254

Definitelly remove these, you should never ever hard-code these settings
into U-Boot.

> +/* BOOTP options */
> +#define CONFIG_BOOTP_SUBNETMASK
> +#define CONFIG_BOOTP_GATEWAY
> +#define CONFIG_BOOTP_HOSTNAME

DTTO

> +/* SPI */
> +#ifdef CONFIG_CMD_SPI
> +#define CONFIG_DEFAULT_SPI_BUS		2

Add default CS please

> +#define CONFIG_DEFAULT_SPI_MODE		SPI_MODE_0
> +#endif
> +
> +/* Boot Linux */
> +#define CONFIG_BOOTDELAY	1
> +#define CONFIG_BOOTFILE		"zImage"

Why don't you switch to fitImage ?

> +#define CONFIG_LOADADDR		0x42000000
> +#define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
> +#define CONFIG_REVISION_TAG
> +#define CONFIG_SERIAL_TAG
> +#define CONFIG_OF_BOARD_SETUP
> +#define CONFIG_BOOT_RETRY_TIME		120	/* retry autoboot after 
120 seconds */
> +#define CONFIG_BOOT_RETRY_TIME_MIN	1	/* can go down to 1 second */
> +#define CONFIG_AUTOBOOT_KEYED
> +#define CONFIG_AUTOBOOT_PROMPT		"Autobooting in %d seconds, " \
> +					"press <c> to stop\n"
> +#define CONFIG_AUTOBOOT_DELAY_STR	"\x63"	/* allows retry after retry time

How does this work ?

> */ +#define CONFIG_AUTOBOOT_STOP_STR	" "	/* stop autoboot with <Space> */
> +#define CONFIG_RESET_TO_RETRY			/* reset board to retry 
booting */ +

> [...]

  reply	other threads:[~2015-12-13 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-13 11:09 [U-Boot] [PATCH v2] arm: mxs: add support for I2SE's Duckbill boards Michael Heimpold
2015-12-13 15:40 ` Marek Vasut [this message]
2015-12-13 21:53   ` Michael Heimpold
2015-12-13 22:45     ` Marek Vasut
2016-01-03 14:56 ` Stefano Babic
2016-01-03 20:44   ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201512131640.14502.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.