[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux]How to config Petalinux to surport two banks of FLASH memory ?



Hi Childhood,

On Wed, Nov 11, 2009 at 1:23 PM, Childhood Hwang
<childhood.hwang@xxxxxxxxx> wrote:

> Does anyone know how to config Petalinux to surport two banks of FLASH
> memory ? Is petalinux easy in config this
> ?  And how to ? I want to store Petalinux image etc. in one bank of
> flash , and the other make a
> file system.

You can do it like this:

 * In arch/microblaze/platform/<myplatform>, add a file extra-flash.c
(see attached)
 * Add it to the Makefile for that directory

You will probably need to tweak some of the parameters in the C file -
I copied the attachment verbatim from a project of last year.  But, it
will give you the general idea.

Regards,

John
-- 
John Williams, PhD, B.Eng, B.IT
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663
/*
 * MicroBlaze physmap-auto flash initialization
 *
 * Copyright (C) 2007 PetaLogix
 *  Author John Williams <john.williams@xxxxxxxxxxxxx>
 *
 * Based on Atmel board initialisation code that was 
 * Copyright (C) 2005-2006 Atmel Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#include <linux/autoconf.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>

/* FIXME this is a hack, we are using periph name-specific defines here,
   the real way to do this is to extend the PetaLinux BSP to allow
   specifying multiple flash peripherals, and adding them all in */
#if (CONFIG_XILINX_MCH_EMC_0_NUM_BANKS_MEM==2)
static struct physmap_flash_data physmap_flash_data2 = {
	.width		= CONFIG_XILINX_MCH_EMC_0_MEM1_WIDTH>>3,
};

static struct resource physmap_flash_resource2 = {
	.start		= CONFIG_XILINX_MCH_EMC_0_MEM1_BASEADDR,
	.end		= CONFIG_XILINX_MCH_EMC_0_MEM1_HIGHADDR,
	.flags		= IORESOURCE_MEM,
};

static struct platform_device physmap_flash2 = {
	.name		= "physmap-flash",
	.id		= 1,
	.dev		= {
		.platform_data	= &physmap_flash_data2,
	},
	.num_resources	= 1,
	.resource	= &physmap_flash_resource2,
};
#endif

static int __init microblaze_auto_extra_flash_init(void)
{
#if (CONFIG_XILINX_MCH_EMC_0_NUM_BANKS_MEM==2)
	platform_device_register(&physmap_flash2);
#endif
	return 0;
}
device_initcall(microblaze_auto_extra_flash_init);