[PATCH 3/3] ARM: OMAP: pcm051: Add spi flash support
Alexander Aring
alex.aring at gmail.com
Tue Jun 18 08:11:14 EDT 2013
Hi,
On Tue, Jun 18, 2013 at 01:25:47PM +0200, Teresa Gámez wrote:
> Add support for w25q64 SPI NOR flash.
>
> Signed-off-by: Teresa Gámez <t.gamez at phytec.de>
> ---
> arch/arm/boards/pcm051/board.c | 41 ++++++++++++++++++++++++++
> arch/arm/boards/pcm051/env/init/mtdparts-nor | 12 +++++++
> arch/arm/configs/pcm051_defconfig | 3 +-
> 3 files changed, 55 insertions(+), 1 deletions(-)
> create mode 100644 arch/arm/boards/pcm051/env/init/mtdparts-nor
>
> diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
> index 8754ba5..c390c45 100644
> --- a/arch/arm/boards/pcm051/board.c
> +++ b/arch/arm/boards/pcm051/board.c
> @@ -26,6 +26,8 @@
> #include <mach/am33xx-devices.h>
> #include <mach/am33xx-mux.h>
> #include <mach/am33xx-silicon.h>
> +#include <spi/spi.h>
> +#include <spi/flash.h>
>
> #include "mux.h"
>
> @@ -52,12 +54,51 @@ static int pcm051_mem_init(void)
> }
> mem_initcall(pcm051_mem_init);
>
> +static struct flash_platform_data pcm051_spi_flash = {
> + .name = "nor",
> + .type = "w25q64",
> +};
> +
> +/*
> +* SPI Flash works at 80Mhz however the SPI controller runs with 48MHz.
> +* So setup Max speed to be less than the controller speed.
> +*/
> +static struct spi_board_info pcm051_spi_board_info[] = {
> + {
> + .name = "m25p80",
> + .platform_data = &pcm051_spi_flash,
> + .max_speed_hz = 24000000,
> + .bus_num = 0,
> + .chip_select = 0,
> + },
> +};
> +
> +static void pcm051_spi_init(void)
> +{
> + int ret;
> +
> + am33xx_enable_spi0_pin_mux();
> +
> + ret = spi_register_board_info(pcm051_spi_board_info,
> + ARRAY_SIZE(pcm051_spi_board_info));
> + am33xx_add_spi0();
> +}
> +
> static int pcm051_devices_init(void)
> {
> pcm051_enable_mmc0_pin_mux();
>
> am33xx_add_mmc0(NULL);
>
> + pcm051_spi_init();
> +
> + devfs_add_partition("nor0", 0x00000, SZ_128K,
> + DEVFS_PARTITION_FIXED, "xload");
> + devfs_add_partition("nor0", SZ_128K, SZ_256K,
> + DEVFS_PARTITION_FIXED, "self0");
I think this size need to be to SZ_512K or...
> + devfs_add_partition("nor0", SZ_128K + SZ_256K, SZ_128K,
> + DEVFS_PARTITION_FIXED, "env0");
> +
> armlinux_set_bootparams((void *)(AM33XX_DRAM_ADDR_SPACE_START + 0x100));
> armlinux_set_architecture(MACH_TYPE_PCM051);
>
> diff --git a/arch/arm/boards/pcm051/env/init/mtdparts-nor b/arch/arm/boards/pcm051/env/init/mtdparts-nor
> new file mode 100644
> index 0000000..91aa847
> --- /dev/null
> +++ b/arch/arm/boards/pcm051/env/init/mtdparts-nor
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +if [ "$1" = menu ]; then
> + init-menu-add-entry "$0" "NOR partitions"
> + exit
> +fi
> +
> +mtdparts="128k(nor0.xload),512k(nor0.barebox),128k(nor0.bareboxenv),4M(nor0.kernel),-(nor0.root)"
... 512k(nor0.barebox) to 256k(nor0.barebox).
Regards
Alex
More information about the barebox
mailing list