svn_rev_149
no need for bi_dram in global data (untested)
This commit is contained in:
parent
aabb4586a4
commit
42e2dbc120
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <driver.h>
|
||||
#include <image.h>
|
||||
#include <zlib.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
@ -277,14 +278,19 @@ static void setup_start_tag (bd_t *bd)
|
|||
#ifdef CONFIG_SETUP_MEMORY_TAGS
|
||||
static void setup_memory_tags (bd_t *bd)
|
||||
{
|
||||
int i;
|
||||
struct device_d *dev = NULL;
|
||||
|
||||
while (1) {
|
||||
dev = get_device_by_type(DEVICE_TYPE_DRAM, dev);
|
||||
|
||||
if (!dev)
|
||||
return;
|
||||
|
||||
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
|
||||
params->hdr.tag = ATAG_MEM;
|
||||
params->hdr.size = tag_size (tag_mem32);
|
||||
|
||||
params->u.mem.start = bd->bi_dram[i].start;
|
||||
params->u.mem.size = bd->bi_dram[i].size;
|
||||
params->u.mem.start = dev->map_base;
|
||||
params->u.mem.size = dev->size;
|
||||
|
||||
params = tag_next (params);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include <cfi_flash.h>
|
||||
#include <init.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static struct cfi_platform_data cfi_info = {
|
||||
};
|
||||
|
||||
|
@ -44,6 +42,8 @@ static struct device_d sdram_dev = {
|
|||
|
||||
.map_base = 0x08000000,
|
||||
.size = 16 * 1024 * 1024,
|
||||
|
||||
.type = DEVICE_TYPE_DRAM,
|
||||
};
|
||||
|
||||
static struct device_d dm9000_dev = {
|
||||
|
@ -74,14 +74,3 @@ static int scb9328_init_env(void)
|
|||
|
||||
late_initcall(scb9328_init_env);
|
||||
|
||||
static int late_init (void)
|
||||
{
|
||||
#if ( CONFIG_NR_DRAM_BANKS > 0 )
|
||||
gd->bd->bi_dram[0].start = SCB9328_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = SCB9328_SDRAM_1_SIZE;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
late_initcall(late_init);
|
||||
|
||||
|
|
|
@ -767,6 +767,7 @@ struct driver_d ram_drv = {
|
|||
.probe = dummy_probe,
|
||||
.read = mem_read,
|
||||
.write = mem_write,
|
||||
.type = DEVICE_TYPE_DRAM,
|
||||
};
|
||||
|
||||
static int mem_init(void)
|
||||
|
|
|
@ -17,7 +17,8 @@ struct param_d {
|
|||
#define DEVICE_TYPE_UNKNOWN 0
|
||||
#define DEVICE_TYPE_ETHER 1
|
||||
#define DEVICE_TYPE_STDIO 2
|
||||
#define MAX_DEVICE_TYPE 2
|
||||
#define DEVICE_TYPE_DRAM 3
|
||||
#define MAX_DEVICE_TYPE 3
|
||||
|
||||
struct device_d {
|
||||
char name[MAX_DRIVER_NAME];
|
||||
|
@ -72,6 +73,7 @@ void unregister_device(struct device_d *);
|
|||
|
||||
struct device_d *device_from_spec_str(const char *str, char **endp);
|
||||
struct device_d *get_device_by_name(char *name);
|
||||
struct device_d *get_device_by_type(ulong type, struct device_d *last);
|
||||
|
||||
ssize_t read(struct device_d *dev, void *buf, size_t count, ulong offset, ulong flags);
|
||||
ssize_t write(struct device_d *dev, void *buf, size_t count, ulong offset, ulong flags);
|
||||
|
|
|
@ -225,6 +225,29 @@ struct device_d *device_from_spec_str(const char *str, char **endp)
|
|||
return get_device_by_id(name);
|
||||
}
|
||||
|
||||
/* Get devices from their type.
|
||||
* If last is NULL the first device of this type is given.
|
||||
* If last is not NULL, the next device of this type starting
|
||||
* from last is given.
|
||||
*/
|
||||
struct device_d *get_device_by_type(ulong type, struct device_d *last)
|
||||
{
|
||||
struct device_d *dev;
|
||||
|
||||
if (!last)
|
||||
dev = first_device;
|
||||
else
|
||||
dev = last->next;
|
||||
|
||||
while (dev) {
|
||||
if (dev->type == type)
|
||||
return dev;
|
||||
dev = dev->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned long strtoul_suffix(const char *str, char **endp, int base)
|
||||
{
|
||||
unsigned long val;
|
||||
|
|
Loading…
Reference in New Issue