18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/***************************************************************************/ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci/* 58c2ecf20Sopenharmony_ci * firebee.c -- extra startup code support for the FireBee boards 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2011, Greg Ungerer (gerg@snapgear.com) 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/***************************************************************************/ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/kernel.h> 138c2ecf20Sopenharmony_ci#include <linux/init.h> 148c2ecf20Sopenharmony_ci#include <linux/io.h> 158c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 168c2ecf20Sopenharmony_ci#include <linux/mtd/mtd.h> 178c2ecf20Sopenharmony_ci#include <linux/mtd/partitions.h> 188c2ecf20Sopenharmony_ci#include <linux/mtd/physmap.h> 198c2ecf20Sopenharmony_ci#include <asm/coldfire.h> 208c2ecf20Sopenharmony_ci#include <asm/mcfsim.h> 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/***************************************************************************/ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* 258c2ecf20Sopenharmony_ci * 8MB of NOR flash fitted to the FireBee board. 268c2ecf20Sopenharmony_ci */ 278c2ecf20Sopenharmony_ci#define FLASH_PHYS_ADDR 0xe0000000 /* Physical address of flash */ 288c2ecf20Sopenharmony_ci#define FLASH_PHYS_SIZE 0x00800000 /* Size of flash */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define PART_BOOT_START 0x00000000 /* Start at bottom of flash */ 318c2ecf20Sopenharmony_ci#define PART_BOOT_SIZE 0x00040000 /* 256k in size */ 328c2ecf20Sopenharmony_ci#define PART_IMAGE_START 0x00040000 /* Start after boot loader */ 338c2ecf20Sopenharmony_ci#define PART_IMAGE_SIZE 0x006c0000 /* Most of flash */ 348c2ecf20Sopenharmony_ci#define PART_FPGA_START 0x00700000 /* Start at offset 7MB */ 358c2ecf20Sopenharmony_ci#define PART_FPGA_SIZE 0x00100000 /* 1MB in size */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistatic struct mtd_partition firebee_flash_parts[] = { 388c2ecf20Sopenharmony_ci { 398c2ecf20Sopenharmony_ci .name = "dBUG", 408c2ecf20Sopenharmony_ci .offset = PART_BOOT_START, 418c2ecf20Sopenharmony_ci .size = PART_BOOT_SIZE, 428c2ecf20Sopenharmony_ci }, 438c2ecf20Sopenharmony_ci { 448c2ecf20Sopenharmony_ci .name = "FPGA", 458c2ecf20Sopenharmony_ci .offset = PART_FPGA_START, 468c2ecf20Sopenharmony_ci .size = PART_FPGA_SIZE, 478c2ecf20Sopenharmony_ci }, 488c2ecf20Sopenharmony_ci { 498c2ecf20Sopenharmony_ci .name = "image", 508c2ecf20Sopenharmony_ci .offset = PART_IMAGE_START, 518c2ecf20Sopenharmony_ci .size = PART_IMAGE_SIZE, 528c2ecf20Sopenharmony_ci }, 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistatic struct physmap_flash_data firebee_flash_data = { 568c2ecf20Sopenharmony_ci .width = 2, 578c2ecf20Sopenharmony_ci .nr_parts = ARRAY_SIZE(firebee_flash_parts), 588c2ecf20Sopenharmony_ci .parts = firebee_flash_parts, 598c2ecf20Sopenharmony_ci}; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistatic struct resource firebee_flash_resource = { 628c2ecf20Sopenharmony_ci .start = FLASH_PHYS_ADDR, 638c2ecf20Sopenharmony_ci .end = FLASH_PHYS_ADDR + FLASH_PHYS_SIZE, 648c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 658c2ecf20Sopenharmony_ci}; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_cistatic struct platform_device firebee_flash = { 688c2ecf20Sopenharmony_ci .name = "physmap-flash", 698c2ecf20Sopenharmony_ci .id = 0, 708c2ecf20Sopenharmony_ci .dev = { 718c2ecf20Sopenharmony_ci .platform_data = &firebee_flash_data, 728c2ecf20Sopenharmony_ci }, 738c2ecf20Sopenharmony_ci .num_resources = 1, 748c2ecf20Sopenharmony_ci .resource = &firebee_flash_resource, 758c2ecf20Sopenharmony_ci}; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/***************************************************************************/ 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_cistatic int __init init_firebee(void) 808c2ecf20Sopenharmony_ci{ 818c2ecf20Sopenharmony_ci platform_device_register(&firebee_flash); 828c2ecf20Sopenharmony_ci return 0; 838c2ecf20Sopenharmony_ci} 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ciarch_initcall(init_firebee); 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci/***************************************************************************/ 88