summaryrefslogtreecommitdiff
path: root/src/mainboard/motorola/sandpoint/flash.h
blob: 5ef1c6e19a0ae39d39dd14baf5bcda786d55fcec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* $Id$ */
/* Copyright 2000  AG Electronics Ltd. */
/* This code is distributed without warranty under the GPL v2 (see COPYING) */

#ifndef _FLASH_H
#define _FLASH_H

struct flash_device;

typedef struct flash_fn
{
    const char *(* identify)(struct flash_device *flash);
    void *(* ptr)(void *data);
    int (* erase_all)(void *data);
    int (* erase)(void *data, unsigned offset, unsigned length);
    int (* program)(void *data, unsigned offset, const void *source, unsigned length);    
    u8 ( *read_byte)(void *data, unsigned offset);
} flash_fn;

typedef struct flash_device
{
    const flash_fn *fn;
    char *tag;
    void *data;
    unsigned long base;
    unsigned size;
    unsigned erase_size;
    unsigned store_size;
    struct flash_device *next;
} flash_device;

int register_flash_device(const flash_fn *fn, char *tag, void *data);
flash_device *find_flash_device(const char *tag);
int init_flash_amd800(char *tag, unsigned base, unsigned spacing);

#endif