mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 16:05:01 +07:00
1b4d5beecb
The flash.o is built for obj-y -- and hence this code is always present. It will never be modular, so using module_init as an alias for __initcall can be somewhat misleading. Fix this up now, so that we can relocate module_init from init.h into module.h in the future. If we don't do this, we'd have to add module.h to obviously non-modular code, and that would be a worse thing. Note that direct use of __initcall is discouraged, vs. one of the priority categorized subgroups. As __initcall gets mapped onto device_initcall, our use of device_initcall directly in this change means that the runtime impact is zero -- it will remain at level 6 in initcall ordering. Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: David Howells <dhowells@redhat.com> Acked-by: David Howells <dhowells@redhat.com> Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com> Cc: linux-am33-list@redhat.com Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
100 lines
2.5 KiB
C
100 lines
2.5 KiB
C
/* Handle mapping of the flash on the ASB2303 board
|
|
*
|
|
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
|
|
* Written by David Howells (dhowells@redhat.com)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public Licence
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the Licence, or (at your option) any later version.
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/mtd/partitions.h>
|
|
#include <linux/mtd/physmap.h>
|
|
|
|
#define ASB2303_PROM_ADDR 0xA0000000 /* Boot PROM */
|
|
#define ASB2303_PROM_SIZE (2 * 1024 * 1024)
|
|
#define ASB2303_FLASH_ADDR 0xA4000000 /* System Flash */
|
|
#define ASB2303_FLASH_SIZE (32 * 1024 * 1024)
|
|
#define ASB2303_CONFIG_ADDR 0xA6000000 /* System Config EEPROM */
|
|
#define ASB2303_CONFIG_SIZE (8 * 1024)
|
|
|
|
/*
|
|
* default MTD partition table for both main flash devices, expected to be
|
|
* overridden by RedBoot
|
|
*/
|
|
static struct mtd_partition asb2303_partitions[] = {
|
|
{
|
|
.name = "Bootloader",
|
|
.size = 0x00040000,
|
|
.offset = 0,
|
|
.mask_flags = MTD_CAP_ROM /* force read-only */
|
|
}, {
|
|
.name = "Kernel",
|
|
.size = 0x00400000,
|
|
.offset = 0x00040000,
|
|
}, {
|
|
.name = "Filesystem",
|
|
.size = MTDPART_SIZ_FULL,
|
|
.offset = 0x00440000
|
|
}
|
|
};
|
|
|
|
/*
|
|
* the ASB2303 Boot PROM definition
|
|
*/
|
|
static struct physmap_flash_data asb2303_bootprom_data = {
|
|
.width = 2,
|
|
.nr_parts = 1,
|
|
.parts = asb2303_partitions,
|
|
};
|
|
|
|
static struct resource asb2303_bootprom_resource = {
|
|
.start = ASB2303_PROM_ADDR,
|
|
.end = ASB2303_PROM_ADDR + ASB2303_PROM_SIZE,
|
|
.flags = IORESOURCE_MEM,
|
|
};
|
|
|
|
static struct platform_device asb2303_bootprom = {
|
|
.name = "physmap-flash",
|
|
.id = 0,
|
|
.dev.platform_data = &asb2303_bootprom_data,
|
|
.num_resources = 1,
|
|
.resource = &asb2303_bootprom_resource,
|
|
};
|
|
|
|
/*
|
|
* the ASB2303 System Flash definition
|
|
*/
|
|
static struct physmap_flash_data asb2303_sysflash_data = {
|
|
.width = 4,
|
|
.nr_parts = 1,
|
|
.parts = asb2303_partitions,
|
|
};
|
|
|
|
static struct resource asb2303_sysflash_resource = {
|
|
.start = ASB2303_FLASH_ADDR,
|
|
.end = ASB2303_FLASH_ADDR + ASB2303_FLASH_SIZE,
|
|
.flags = IORESOURCE_MEM,
|
|
};
|
|
|
|
static struct platform_device asb2303_sysflash = {
|
|
.name = "physmap-flash",
|
|
.id = 1,
|
|
.dev.platform_data = &asb2303_sysflash_data,
|
|
.num_resources = 1,
|
|
.resource = &asb2303_sysflash_resource,
|
|
};
|
|
|
|
/*
|
|
* register the ASB2303 flashes
|
|
*/
|
|
static int __init asb2303_mtd_init(void)
|
|
{
|
|
platform_device_register(&asb2303_bootprom);
|
|
platform_device_register(&asb2303_sysflash);
|
|
return 0;
|
|
}
|
|
device_initcall(asb2303_mtd_init);
|