^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /***************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * firebee.c -- extra startup code support for the FireBee boards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (C) 2011, Greg Ungerer (gerg@snapgear.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) /***************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/mtd/partitions.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/mtd/physmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/coldfire.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/mcfsim.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /***************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * 8MB of NOR flash fitted to the FireBee board.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define FLASH_PHYS_ADDR 0xe0000000 /* Physical address of flash */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define FLASH_PHYS_SIZE 0x00800000 /* Size of flash */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define PART_BOOT_START 0x00000000 /* Start at bottom of flash */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define PART_BOOT_SIZE 0x00040000 /* 256k in size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define PART_IMAGE_START 0x00040000 /* Start after boot loader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define PART_IMAGE_SIZE 0x006c0000 /* Most of flash */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define PART_FPGA_START 0x00700000 /* Start at offset 7MB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define PART_FPGA_SIZE 0x00100000 /* 1MB in size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static struct mtd_partition firebee_flash_parts[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .name = "dBUG",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) .offset = PART_BOOT_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .size = PART_BOOT_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .name = "FPGA",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .offset = PART_FPGA_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .size = PART_FPGA_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) .name = "image",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) .offset = PART_IMAGE_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .size = PART_IMAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static struct physmap_flash_data firebee_flash_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) .width = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) .nr_parts = ARRAY_SIZE(firebee_flash_parts),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .parts = firebee_flash_parts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) static struct resource firebee_flash_resource = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) .start = FLASH_PHYS_ADDR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) .end = FLASH_PHYS_ADDR + FLASH_PHYS_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static struct platform_device firebee_flash = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) .name = "physmap-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) .platform_data = &firebee_flash_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) .resource = &firebee_flash_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /***************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) static int __init init_firebee(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) platform_device_register(&firebee_flash);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) arch_initcall(init_firebee);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) /***************************************************************************/