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