@@ -41,7 +41,10 @@ static struct physmap_flash_data board_nor_data = {
};
static struct resource board_nor_resource = {
+ /* GPMC driver will fixup the resource, see gpmc_probe_legacy () */
.flags = IORESOURCE_MEM,
+ .start = 0,
+ .end = FLASH_SIZE_SDPV1 - 1, /* fixed @runtime for SDPV2 */
};
static struct platform_device board_nor_device = {
@@ -62,23 +65,14 @@ __init board_nor_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
board_nor_data.parts = nor_parts;
board_nor_data.nr_parts = nr_parts;
- /* Configure start address and size of NOR device */
- if (omap_rev() >= OMAP3430_REV_ES1_0) {
- err = gpmc_cs_request(cs, FLASH_SIZE_SDPV2 - 1,
- (unsigned long *)&board_nor_resource.start);
- board_nor_resource.end = board_nor_resource.start
- + FLASH_SIZE_SDPV2 - 1;
- } else {
- err = gpmc_cs_request(cs, FLASH_SIZE_SDPV1 - 1,
- (unsigned long *)&board_nor_resource.start);
- board_nor_resource.end = board_nor_resource.start
- + FLASH_SIZE_SDPV1 - 1;
- }
- if (err < 0) {
- pr_err("NOR: Can't request GPMC CS\n");
- return;
- }
- if (platform_device_register(&board_nor_device) < 0)
+ /* Configure size of NOR device */
+ if (omap_rev() >= OMAP3430_REV_ES1_0)
+ board_nor_resource.end = FLASH_SIZE_SDPV2 - 1;
+
+ err = gpmc_generic_init(cs, false,
+ NULL, NULL, NULL,
+ &board_nor_device, sizeof(board_nor_data));
+ if (err)
pr_err("Unable to register NOR device\n");
}
Don't access any GPMC registers here. Use gpmc_generic_init() to pass GPMC Chip Select settings, platform device and platform data to the GPMC driver. Signed-off-by: Roger Quadros <rogerq@ti.com> --- arch/arm/mach-omap2/board-flash.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)