Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a54cd73b authored by Thomas Petazzoni's avatar Thomas Petazzoni Committed by Jason Cooper
Browse files

ARM: orion5x: use DT to describe NOR on edmini_v2



This commit converts the already partially DT-converted edmini_v2
platform to use the Device Tree for NOR flash, using the Device Bus.

Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Link: https://lkml.kernel.org/r/1398202002-28530-32-git-send-email-thomas.petazzoni@free-electrons.com


Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
parent a665fce3
Loading
Loading
Loading
Loading
+42 −1
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@

	soc {
		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>,
			 <MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>;
			 <MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>,
			 <MBUS_ID(0x01, 0x0f) 0 0xfff80000 0x80000>;
	};

	gpio-keys {
@@ -56,6 +57,46 @@
	};
};

&devbus_bootcs {
	status = "okay";

	/* Read parameters */
	devbus,bus-width    = <8>;
	devbus,turn-off-ps  = <90000>;
	devbus,badr-skew-ps = <0>;
	devbus,acc-first-ps = <186000>;
	devbus,acc-next-ps  = <186000>;

	/* Write parameters */
	devbus,wr-high-ps  = <90000>;
	devbus,wr-low-ps   = <90000>;
	devbus,ale-wr-ps   = <90000>;

	/*
	 * Currently the MTD code does not recognize the MX29LV400CBCT
	 * as a bottom-type device. This could cause risks of
	 * accidentally erasing critical flash sectors. We thus define
	 * a single, write-protected partition covering the whole
	 * flash.  TODO: once the flash part TOP/BOTTOM detection
	 * issue is sorted out in the MTD code, break this into at
	 * least three partitions: 'u-boot code', 'u-boot environment'
	 * and 'whatever is left'.
	 */
	flash@0 {
		compatible = "cfi-flash";
		reg = <0 0x80000>;
		bank-width = <1>;
		#address-cells = <1>;
		#size-cells = <1>;

		partition@0 {
			label = "Full512Kb";
			reg = <0 0x80000>;
			read-only;
		};
	};
};

&ehci0 {
	status = "okay";
};
+0 −62
Original line number Diff line number Diff line
@@ -42,74 +42,12 @@
 * EDMINI_V2 Info
 ****************************************************************************/

/*
 * 512KB NOR flash Device bus boot chip select
 */

#define EDMINI_V2_NOR_BOOT_BASE		0xfff80000
#define EDMINI_V2_NOR_BOOT_SIZE		SZ_512K

/*****************************************************************************
 * 512KB NOR Flash on BOOT Device
 ****************************************************************************/

/*
 * Currently the MTD code does not recognize the MX29LV400CBCT as a bottom
 * -type device. This could cause risks of accidentally erasing critical
 * flash sectors. We thus define a single, write-protected partition covering
 * the whole flash.
 * TODO: once the flash part TOP/BOTTOM detection issue is sorted out in the MTD
 * code, break this into at least three partitions: 'u-boot code', 'u-boot
 * environment' and 'whatever is left'.
 */

static struct mtd_partition edmini_v2_partitions[] = {
	{
		.name		= "Full512kb",
		.size		= 0x00080000,
		.offset		= 0x00000000,
		.mask_flags	= MTD_WRITEABLE,
	},
};

static struct physmap_flash_data edmini_v2_nor_flash_data = {
	.width		= 1,
	.parts		= edmini_v2_partitions,
	.nr_parts	= ARRAY_SIZE(edmini_v2_partitions),
};

static struct resource edmini_v2_nor_flash_resource = {
	.flags			= IORESOURCE_MEM,
	.start			= EDMINI_V2_NOR_BOOT_BASE,
	.end			= EDMINI_V2_NOR_BOOT_BASE
		+ EDMINI_V2_NOR_BOOT_SIZE - 1,
};

static struct platform_device edmini_v2_nor_flash = {
	.name			= "physmap-flash",
	.id			= 0,
	.dev		= {
		.platform_data	= &edmini_v2_nor_flash_data,
	},
	.num_resources		= 1,
	.resource		= &edmini_v2_nor_flash_resource,
};

/*****************************************************************************
 * General Setup
 ****************************************************************************/

void __init edmini_v2_init(void)
{
	/*
	 * Configure peripherals.
	 */
	mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
				    ORION_MBUS_DEVBUS_BOOT_ATTR,
				    EDMINI_V2_NOR_BOOT_BASE,
				    EDMINI_V2_NOR_BOOT_SIZE);
	platform_device_register(&edmini_v2_nor_flash);

	pr_notice("edmini_v2: USB device port, flash write and power-off "
		  "are not yet supported.\n");
}