mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: vj <vicencb@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 4/7] Add USB booting capabilities to OMAP
Date: Wed, 26 Sep 2012 09:45:16 +0200	[thread overview]
Message-ID: <20120926074516.GJ1322@pengutronix.de> (raw)
In-Reply-To: <1348613994-1793-5-git-send-email-vicencb@gmail.com>

On Wed, Sep 26, 2012 at 12:59:51AM +0200, vj wrote:
> ---
>  arch/arm/cpu/cpu.c                              |   1 +
>  arch/arm/lib/barebox.lds.S                      |  10 +
>  arch/arm/mach-omap/Kconfig                      |  21 +
>  arch/arm/mach-omap/Makefile                     |   1 +
>  arch/arm/mach-omap/include/mach/omap4_rom_usb.h | 146 +++++
>  arch/arm/mach-omap/omap4_generic.c              |   2 +
>  arch/arm/mach-omap/omap4_rom_usb.c              | 189 ++++++
>  arch/arm/mach-omap/xload.c                      |  26 +
>  scripts/.gitignore                              |   1 +
>  scripts/Makefile                                |   3 +
>  scripts/usbboot.c                               | 797 ++++++++++++++++++++++++
>  11 files changed, 1197 insertions(+)
>  create mode 100644 arch/arm/mach-omap/include/mach/omap4_rom_usb.h
>  create mode 100644 arch/arm/mach-omap/omap4_rom_usb.c
>  create mode 100644 scripts/usbboot.c
> 
> diff --git a/arch/arm/cpu/cpu.c b/arch/arm/cpu/cpu.c
> index 71ef8c0..05343de 100644
> --- a/arch/arm/cpu/cpu.c
> +++ b/arch/arm/cpu/cpu.c
> @@ -89,6 +89,7 @@ void arch_shutdown(void)
>  		: "r0", "r1", "r2", "r3", "r6", "r10", "r12", "lr", "cc", "memory"
>  	);
>  #endif
> +	__asm__ __volatile__ ("cpsid i\n");
>  }
>  
>  #ifdef CONFIG_THUMB2_BAREBOX
> diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S
> index a69013f..ff7b63d 100644
> --- a/arch/arm/lib/barebox.lds.S
> +++ b/arch/arm/lib/barebox.lds.S
> @@ -97,6 +97,16 @@ SECTIONS
>  	__bss_start = .;
>  	.bss : { *(.bss*) }
>  	__bss_stop = .;
> +#ifdef CONFIG_SHARE_USB_HANDLE
> +    /*
> +     * Reserve space for the USB handle
> +     */
> +	. = CONFIG_USB_HANDLE_HANDOVER;
> +	. = ALIGN(4);
> +	__usb_handle = .;
> +	/* . += sizeof(struct usb); */
> +	. += 84;
> +#endif

If I understand correctly the first stage loader puts some data here
where a second stage barebox (configured with the same value for
CONFIG_USB_HANDLE_HANDOVER) will pick it up.

This seems to be a bit fragile. Fortunately Jan has posted a series
that gives the control of the reset vector to the boards, which means
that both stages do not have to agree on an addres, but instead a
pointer can be passed from the first to the second stage.

> +int usb_open(void)

So this uses the OMAP4 ROM to do USB communication, right? The functions
should have a omap_rom_* prefix then, otherwise it's not clear for a
reader which context these functions have.

The calling of the ROM code btw explains why the setting of VBAR breaks
USB boot. The ROM probably uses the vectors.

> +
> +	n = rom_get_per_driver(&pusb->io, boot->device_type);
> +	if (n)
> +		return n;
> +
> +	pusb->dread.xfer_mode = boot->xfer_mode;
> +	pusb->dread.options = boot->options;
> +	pusb->dread.device_type = boot->device_type;
> +
> +	pusb->dwrite.xfer_mode = boot->xfer_mode;
> +	pusb->dwrite.options = boot->options;
> +	pusb->dwrite.device_type = boot->device_type;
> +#else
> +#ifdef CONFIG_MMU
> +#error USB communications not working under MMU

You can add the following to CONFIG_OMAP4_USB_BOOT instead:

	depends on !MMU

So that an invalid config is not allowed in the first place.


> diff --git a/scripts/usbboot.c b/scripts/usbboot.c

This should also be named omap4-usbboot.c, or maybe, if the works on
other OMAPs, just omap-usboot.c

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

  reply	other threads:[~2012-09-26  7:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <[RFC][PATCH] archosg9: add support for tablet>
2012-09-25 22:59 ` [PATCH 0/7] [RFC][PATCH] archosg9: add support for tablet vj
2012-09-25 22:59   ` [PATCH 1/7] Improved an error message and solved a minor bug vj
2012-09-26  7:11     ` Sascha Hauer
2012-09-25 22:59   ` [PATCH 2/7] added debug info for twl6030 vj
2012-09-25 22:59   ` [PATCH 3/7] OMAP specific changes vj
2012-09-26  7:18     ` Sascha Hauer
2012-09-25 22:59   ` [PATCH 4/7] Add USB booting capabilities to OMAP vj
2012-09-26  7:45     ` Sascha Hauer [this message]
2012-09-28  0:27       ` vj
2012-09-28  7:32         ` Sascha Hauer
2012-09-25 22:59   ` [PATCH 5/7] add console support over the same USB used for booting vj
2012-09-25 22:59   ` [PATCH 6/7] add filesystem " vj
2012-09-25 22:59   ` [PATCH 7/7] Add support for Archos G9 tablet vj
2012-09-26  3:57   ` [PATCH 0/7] [RFC][PATCH] archosg9: add support for tablet Antony Pavlov
2012-09-26  7:06   ` Sascha Hauer
2012-09-26 22:38     ` vj
2012-09-26  8:16   ` 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=20120926074516.GJ1322@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=vicencb@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox