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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*
* This file is part of the coreboot project.
*
* Copyright 2018 MediaTek Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* this is a spi driver which adapts emmc to fake spi flash */
#include <soc/flash_controller.h>
#include <spi_flash.h>
static void init_io(void)
{
}
static int emmc_adapter_read(const struct spi_flash *flash, u32 addr,
size_t len, void *buf)
{
return 0;
}
static int emmc_adapter_write(const struct spi_flash *flash, u32 addr,
size_t len, const void *buf)
{
return 0;
}
static int emmc_adapter_erase(const struct spi_flash *flash, u32 offset,
size_t len)
{
return 0;
}
const struct spi_flash_ops spi_emmc_flash_ops = {
.read = emmc_adapter_read,
.write = emmc_adapter_write,
.erase = emmc_adapter_erase,
};
int mtk_spi_flash_probe(const struct spi_slave *spi, struct spi_flash *flash)
{
init_io();
flash->name = "spi emmc flash controller";
flash->sector_size = 0x800;
flash->size = CONFIG_ROM_SIZE;
flash->ops = &spi_emmc_flash_ops;
return 0;
}
|