^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Registration of Cobalt MTD device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2006 Yoichi Yuasa <yuasa@linux-mips.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/mtd/partitions.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/mtd/physmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) static struct mtd_partition cobalt_mtd_partitions[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) .name = "firmware",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) .offset = 0x0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) .size = 0x80000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static struct physmap_flash_data cobalt_flash_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) .width = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) .nr_parts = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) .parts = cobalt_mtd_partitions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static struct resource cobalt_mtd_resource = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) .start = 0x1fc00000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) .end = 0x1fc7ffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static struct platform_device cobalt_mtd = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) .name = "physmap-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .platform_data = &cobalt_flash_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) .resource = &cobalt_mtd_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static int __init cobalt_mtd_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) platform_device_register(&cobalt_mtd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) device_initcall(cobalt_mtd_init);