[coreboot-gerrit] Patch set updated for coreboot: soc/marvell/mvmap2315: Add flash driver
hakim giydan (hgiydan@marvell.com)
gerrit at coreboot.org
Mon Aug 8 22:23:18 CEST 2016
hakim giydan (hgiydan at marvell.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15509
-gerrit
commit af088268fb11890e3c62f0d9eec24a8abb382896
Author: Hakim Giydan <hgiydan at marvell.com>
Date: Mon Aug 8 13:23:01 2016 -0700
soc/marvell/mvmap2315: Add flash driver
Testing: booted successfully.
Change-Id: Iaeff9f01dbfad7f313aa237e8c71c36c4ed1e06f
Signed-off-by: Hakim Giydan <hgiydan at marvell.com>
---
src/soc/marvell/mvmap2315/Makefile.inc | 1 +
src/soc/marvell/mvmap2315/flash.c | 62 +++++++++++++++++++++++++++
src/soc/marvell/mvmap2315/include/soc/flash.h | 60 ++++++++++++++++++++++++++
3 files changed, 123 insertions(+)
diff --git a/src/soc/marvell/mvmap2315/Makefile.inc b/src/soc/marvell/mvmap2315/Makefile.inc
index 9467a35..c97ac01 100644
--- a/src/soc/marvell/mvmap2315/Makefile.inc
+++ b/src/soc/marvell/mvmap2315/Makefile.inc
@@ -20,6 +20,7 @@ bootblock-y += clock.c
bootblock-y += fiq.S
bootblock-y += gic.c
bootblock-y += gpio.c
+bootblock-y += flash.c
bootblock-y += media.c
bootblock-y += pinmux.c
bootblock-y += reset.c
diff --git a/src/soc/marvell/mvmap2315/flash.c b/src/soc/marvell/mvmap2315/flash.c
new file mode 100644
index 0000000..08bfa2b
--- /dev/null
+++ b/src/soc/marvell/mvmap2315/flash.c
@@ -0,0 +1,62 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Marvell, 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.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <arch/io.h>
+#include <soc/clock.h>
+#include <soc/flash.h>
+
+struct flash_ops flash_callbacks = {
+ .init = (init_F) MVMAP2315_FLASH_INIT,
+ .read = (read_F) MVMAP2315_FLASH_READ,
+ .write = (write_F) MVMAP2315_FLASH_WRITE,
+ .shutdown = (shutdown_F) MVMAP2315_FLASH_SHUTDOWN,
+ .set_partition = (set_partition_F) MVMAP2315_FLASH_SET_PARTITION,
+};
+
+u32 flash_init(u32 media, u32 clock_input_mhz)
+{
+ clrbits_le32(&mvmap2315_apmu_clk->apaonclk_sdmmc_clkgenconfig,
+ MVMAP2315_SDMMC_CLK_RSTN);
+ setbits_le32(&mvmap2315_apmu_clk->apaonclk_sdmmc_clkgenconfig,
+ MVMAP2315_SDMMC_CLK_RSTN);
+
+ return flash_callbacks.init(media, 0, clock_input_mhz);
+}
+
+u32 flash_partition(u32 media, struct flash_params *flash_image_info)
+{
+ return flash_callbacks.set_partition(media,
+ 0,
+ flash_image_info);
+}
+
+u32 flash_read(u32 media, struct flash_params *flash_image_info)
+{
+ return flash_callbacks.read(media, 0, flash_image_info);
+}
+
+u32 flash_write(u32 media, struct flash_params *flash_image_info)
+{
+ return flash_callbacks.write(media, 0, flash_image_info);
+}
+
+u32 flash_shutdown(u32 media)
+{
+ return flash_callbacks.shutdown(media, 0, 0);
+}
diff --git a/src/soc/marvell/mvmap2315/include/soc/flash.h b/src/soc/marvell/mvmap2315/include/soc/flash.h
new file mode 100644
index 0000000..774141a
--- /dev/null
+++ b/src/soc/marvell/mvmap2315/include/soc/flash.h
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Marvell, 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.
+ */
+
+#ifndef __SOC_MARVELL_MVMAP2315_FLASH_H__
+#define __SOC_MARVELL_MVMAP2315_FLASH_H__
+
+#define MVMAP2315_FLASH_INIT 0xFFE00084
+#define MVMAP2315_FLASH_READ 0xFFE00088
+#define MVMAP2315_FLASH_WRITE 0xFFE0008C
+#define MVMAP2315_FLASH_SHUTDOWN 0xFFE00098
+#define MVMAP2315_FLASH_SET_PARTITION 0xFFE00094
+
+#define MVMAP2315_MMC_CLK_MHZ 0x000000C8
+
+enum {
+ SD = 7,
+ EMMC = 8
+};
+
+struct flash_params {
+ u32 offset;
+ u32 buff;
+ u32 size;
+ u32 id;
+ u32 partition;
+};
+
+typedef u32 (*init_F)(u32 media, u32 context, u32 clock_input_mhz);
+typedef u32 (*read_F)(u32 media, u32 context, struct flash_params *);
+typedef u32 (*write_F)(u32 media, u32 context, struct flash_params *);
+typedef u32 (*shutdown_F)(u32 media, u32 context, struct flash_params *);
+typedef u32 (*set_partition_F)(u32 media, u32 context, struct flash_params *);
+
+struct flash_ops {
+ init_F init;
+ read_F read;
+ write_F write;
+ shutdown_F shutdown;
+ set_partition_F set_partition;
+};
+
+u32 flash_init(u32 media, u32 clock_input_mhz);
+u32 flash_read(u32 media, struct flash_params *flash_image_info);
+u32 flash_write(u32 media, struct flash_params *flash_image_info);
+u32 flash_shutdown(u32 media);
+u32 flash_partition(u32 media, struct flash_params *flash_image_info);
+
+#endif /* __SOC_MARVELL_MVMAP2315_FLASH_H__ */
More information about the coreboot-gerrit
mailing list