mt8173: add SPI NOR support

BRANCH=none
BUG=none
TEST=boot oak to kernel on rev1

Change-Id: I0773c81398df445aec16bcfcd0c5a8fe5a588b5c
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: ae15c42c2f7d9c2a716e5b6098d85e17279f5eae
Original-Change-Id: I65abf810d35ae5e7156cf6f5730117e690183d18
Original-Signed-off-by: mtk05962 <bayi.cheng@mediatek.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/292693
Original-Commit-Ready: Yidi Lin <yidi.lin@mediatek.com>
Original-Tested-by: Yidi Lin <yidi.lin@mediatek.com>
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/13102
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
mtk05962
2015-10-16 13:42:49 +08:00
committed by Patrick Georgi
parent f14f640168
commit a3f7fe8219
7 changed files with 314 additions and 26 deletions

View File

@@ -23,6 +23,7 @@
#include <string.h>
#include <timer.h>
#include <soc/addressmap.h>
#include <soc/flash_controller.h>
#include <soc/gpio.h>
#include <soc/pinmux.h>
#include <soc/pll.h>
@@ -161,6 +162,7 @@ static void mtk_spi_dump_data(const char *name, const uint8_t *data,
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
struct mtk_spi_bus *eslave;
static struct spi_slave slave;
switch (bus) {
case CONFIG_EC_GOOGLE_CHROMEEC_SPI_BUS:
@@ -168,6 +170,12 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
assert(read32(&eslave->regs->spi_cfg0_reg) != 0);
spi_sw_reset(eslave->regs);
return &eslave->slave;
case CONFIG_BOOT_MEDIA_SPI_BUS:
slave.bus = bus;
slave.cs = cs;
slave.force_programmer_specific = 1;
slave.programmer_specific_probe = &mt8173_nor_flash_probe;
return &slave;
default:
die ("wrong bus number.\n");
};