ARM: move armlinux_add_dram to location which is always compiled
We want to use the memory banks later in the MMU which is independent of Linux, so move this to a location which is always compiled. Also, make the memory bank list global and add an iterator for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
aab32057b3
commit
5f56079cd5
|
@ -30,6 +30,7 @@
|
|||
#include <cache.h>
|
||||
#include <asm/mmu.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/memory.h>
|
||||
|
||||
/**
|
||||
* Enable processor's instruction cache
|
||||
|
@ -89,6 +90,19 @@ void arch_shutdown(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
LIST_HEAD(memory_list);
|
||||
|
||||
void armlinux_add_dram(struct device_d *dev)
|
||||
{
|
||||
struct arm_memory *mem = xzalloc(sizeof(*mem));
|
||||
|
||||
mem->dev = dev;
|
||||
mem->start = dev->resource[0].start;
|
||||
mem->size = dev->resource[0].size;
|
||||
|
||||
list_add_tail(&mem->list, &memory_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @page arm_boot_preparation Linux Preparation on ARM
|
||||
*
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#ifndef __ARCH_ARMLINUX_H
|
||||
#define __ARCH_ARMLINUX_H
|
||||
|
||||
#include <asm/memory.h>
|
||||
|
||||
#if defined CONFIG_CMD_BOOTM || defined CONFIG_CMD_BOOTZ || \
|
||||
defined CONFIG_CMD_BOOTU
|
||||
void armlinux_set_bootparams(void *params);
|
||||
void armlinux_set_architecture(int architecture);
|
||||
void armlinux_add_dram(struct device_d *dev);
|
||||
void armlinux_set_revision(unsigned int);
|
||||
void armlinux_set_serial(u64);
|
||||
#else
|
||||
|
@ -17,10 +18,6 @@ static inline void armlinux_set_architecture(int architecture)
|
|||
{
|
||||
}
|
||||
|
||||
static inline void armlinux_add_dram(struct device_d *dev)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void armlinux_set_revision(unsigned int rev)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
/*
|
||||
* linux/include/asm-arm/memory.h
|
||||
*
|
||||
* Copyright (C) 2000-2002 Russell King
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Note: this file should not be included by non-asm/.h files
|
||||
*/
|
||||
#ifndef __ASM_ARM_MEMORY_H
|
||||
#define __ASM_ARM_MEMORY_H
|
||||
|
||||
struct arm_memory {
|
||||
struct list_head list;
|
||||
struct device_d *dev;
|
||||
u32 *ptes;
|
||||
unsigned long start;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
extern struct list_head memory_list;
|
||||
|
||||
void armlinux_add_dram(struct device_d *dev);
|
||||
|
||||
#define for_each_sdram_bank(mem) list_for_each_entry(mem, &memory_list, list)
|
||||
|
||||
#endif /* __ASM_ARM_MEMORY_H */
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <asm/barebox-arm.h>
|
||||
#include <asm/armlinux.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/memory.h>
|
||||
|
||||
static struct tag *params;
|
||||
static int armlinux_architecture = 0;
|
||||
|
@ -64,18 +65,11 @@ static void setup_start_tag(void)
|
|||
params = tag_next(params);
|
||||
}
|
||||
|
||||
struct arm_memory {
|
||||
struct list_head list;
|
||||
struct device_d *dev;
|
||||
};
|
||||
|
||||
static LIST_HEAD(memory_list);
|
||||
|
||||
static void setup_memory_tags(void)
|
||||
{
|
||||
struct arm_memory *mem;
|
||||
|
||||
list_for_each_entry(mem, &memory_list, list) {
|
||||
for_each_sdram_bank(mem) {
|
||||
params->hdr.tag = ATAG_MEM;
|
||||
params->hdr.size = tag_size(tag_mem32);
|
||||
|
||||
|
@ -196,15 +190,6 @@ void armlinux_set_architecture(int architecture)
|
|||
armlinux_architecture = architecture;
|
||||
}
|
||||
|
||||
void armlinux_add_dram(struct device_d *dev)
|
||||
{
|
||||
struct arm_memory *mem = xzalloc(sizeof(*mem));
|
||||
|
||||
mem->dev = dev;
|
||||
|
||||
list_add_tail(&mem->list, &memory_list);
|
||||
}
|
||||
|
||||
void armlinux_set_revision(unsigned int rev)
|
||||
{
|
||||
system_rev = rev;
|
||||
|
|
Loading…
Reference in New Issue