All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Philippe Rétornaz" <philippe.retornaz@epfl.ch>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/1] ARM: i.MX31: Add support for mx31moboard board
Date: Thu, 27 Feb 2014 21:36:52 +0100	[thread overview]
Message-ID: <20140227203652.GS17250@pengutronix.de> (raw)
In-Reply-To: <1393509826-19549-2-git-send-email-philippe.retornaz@epfl.ch>

Looks mostly good, some remarks inline.

On Thu, Feb 27, 2014 at 03:03:45PM +0100, Philippe Rétornaz wrote:
> +lwl-y += lowlevel.o
> +obj-y += mx31moboard.o
> diff --git a/arch/arm/boards/mx31moboard/env/boot/net b/arch/arm/boards/mx31moboard/env/boot/net
> new file mode 100644
> index 0000000..e81f2cd
> --- /dev/null
> +++ b/arch/arm/boards/mx31moboard/env/boot/net
> @@ -0,0 +1,3 @@
> +#!/bin/sh
> +
> +# No network card support on this board

Are you sure you want to drop this? You could attach a USB ethernet
dongle.

> diff --git a/arch/arm/boards/mx31moboard/env/boot/sd b/arch/arm/boards/mx31moboard/env/boot/sd
> new file mode 100644
> index 0000000..f96633f
> --- /dev/null
> +++ b/arch/arm/boards/mx31moboard/env/boot/sd
> @@ -0,0 +1,18 @@
> +#!/bin/sh
> +
> +if [ "$1" = menu ]; then
> +        boot-menu-add-entry "$0" "SD Boot"
> +        exit
> +fi
> +
> +global.bootm.image=/mnt/sd/boot/zImage
> +
> +if [ -e /mnt/sd/boot/oftree ]; then
> +	global.bootm.oftree=/mnt/sd/boot/oftree
> +fi
> +
> +if [ -e /mnt/sd/boot/initrd.img ]; then
> +	global.bootm.initrd=/mnt/sd/boot/initrd.img
> +fi
> +
> +global.linux.bootargs.dyn.root="root=/dev/mmcblk0p1 rootwait"

Consider using bootloader spec entries, see
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/
Basically you put a config file under /loader/entries/ in your rootfs.
The config file describes where your kernel/initrd/oftree is. Under
barebox you just have to 'boot mci0' without further configuration.

> +void __bare_init __naked barebox_arm_reset_vector(void)
> +{
> +	uint32_t r;
> +
> +	arm_cpu_lowlevel_init();
> +
> +	/* Enable IPU Display interface */
> +	writel(1 << 6, MX31_IPU_CTRL_BASE_ADDR);
> +
> +	writel(0x074B0BF5, MX31_CCM_BASE_ADDR + MX31_CCM_CCMR);
> +
> +	asm volatile("1:\n\t"
> +			"SUBS %0, %0, #1	\n\t"
> +			"BNE  1b		\n\t"
> +			: : "r" (0x4000) : "cc");

You can write a delay loop in c with:

	volatile int c;

	for (c = 0; c < 0x4000; c++)

(the volatile prevents the compiler from optimizing the loop away)

> +#include <asm/mmu.h>
> +#include <partition.h>
> +#include <generated/mach-types.h>
> +#include <asm/barebox-arm.h>
> +#include <mach/devices-imx31.h>
> +
> +#ifdef CONFIG_USB
> +#define USBH2_EN_B	IOMUX_TO_GPIO(MX31_PIN_SCK6)
> +#define USB_RESET_B	IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
> +
> +static void mx31moboard_usb_init(void)
> +{
> +	u32 tmp;
> +

Instead of ifdeffing the code you can write:

	if (!IS_ENABLED(CONFIG_USB))
		return;

The compiler is clever enough to optimize the unused code away, still
you get better compile coverage.

> +static void mx31moboard_add_leds(void)
> +{
> +	int i;
> +

Same here:

	if (!IS_ENABLED(CONFIG_LED_GPIO))
		return;

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-02-27 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1393509826-19549-1-git-send-email-philippe.retornaz@epfl.ch>
2014-02-27 20:24 ` [PATCH 0/1] Add support for mx31moboard Sascha Hauer
     [not found] ` <1393509826-19549-2-git-send-email-philippe.retornaz@epfl.ch>
2014-02-27 20:36   ` Sascha Hauer [this message]
2014-02-28  8:21     ` [PATCH 1/1] ARM: i.MX31: Add support for mx31moboard board Philippe Rétornaz
2014-02-28  8:37       ` Sascha Hauer
2014-02-28 13:10         ` Philippe Rétornaz
2014-02-28 13:37           ` Sascha Hauer

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=20140227203652.GS17250@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=philippe.retornaz@epfl.ch \
    /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.