Branch data Line data Source code
1 : : // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2 : : /*
3 : : * Default implementations
4 : : *
5 : : * Copyright 2015-2017 IBM Corp.
6 : : */
7 : :
8 : : #include <stdlib.h>
9 : : #include <libflash/blocklevel.h>
10 : : #include "arch_flash.h"
11 : :
12 : : /*
13 : : * This just assumes that an erase from zero to total size is
14 : : * 'correct'.
15 : : * An erase from zero to total size is the correct approach for
16 : : * powerpc and x86. ARM has it own function which also includes a call
17 : : * to the flash driver.
18 : : */
19 : 0 : int __attribute__((weak)) arch_flash_erase_chip(struct blocklevel_device *bl)
20 : : {
21 : 0 : int rc;
22 : 0 : uint64_t total_size;
23 : :
24 : 0 : rc = blocklevel_get_info(bl, NULL, &total_size, NULL);
25 : 0 : if (rc)
26 : : return rc;
27 : :
28 : 0 : return blocklevel_erase(bl, 0, total_size);
29 : : }
30 : :
31 : 0 : int __attribute__((weak,const)) arch_flash_4b_mode(struct blocklevel_device *bl, int set_4b)
32 : : {
33 : 0 : (void)bl;
34 : 0 : (void)set_4b;
35 : 0 : return -1;
36 : : }
37 : :
38 : 0 : enum flash_access __attribute__((weak,const)) arch_flash_access(struct blocklevel_device *bl, enum flash_access access)
39 : : {
40 : 0 : (void)bl;
41 : 0 : (void)access;
42 : 0 : return ACCESS_INVAL;
43 : : }
44 : :
45 : 0 : int __attribute__((weak,const)) arch_flash_set_wrprotect(struct blocklevel_device *bl, int set)
46 : : {
47 : 0 : (void)bl;
48 : 0 : (void)set;
49 : 0 : return -1;
50 : : }
|