lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 23 Mar 2009 16:34:20 +0100
From:	Daniel Glöckner <dg@...ix.com>
To:	Chris Zankel <chris@...kel.net>,
	David Brownell <dbrownell@...rs.sourceforge.net>
Cc:	spi-devel-general@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org,
	Daniel Glöckner <dg@...ix.com>
Subject: [patch 4/6] xtensa: add m25p80 to s6105 platform

The spi_board_info is enclosed in #ifdef CONFIG_MTD_M25P80 to not
interfere with the mmc_spi driver if not used. When mmc_spi is fixed
to work on a shared bus, this #ifdef can be removed.

The stage2 partition contains the kernels for all processors in the
device. In our case a Linux kernel for the SCP core and maybe a
non-Linux kernel for the AUX core. The size of the stage2 partition
is not hardcoded in the bootloader. It depends on the first few bytes
of that partition. Remaining space up to the boot config can be used
for other purposes (f.ex. a filesystem).

The boot configuration is expected at address 0xfff800. The flash chip
ignores the upper two address bits. Rounding down to sectors then
yields an offset of 0x3f0000 for that partition.

Signed-off-by: Daniel Glöckner <dg@...ix.com>
---
 arch/xtensa/platforms/s6105/device.c |   47 ++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c
index 789448e..bc254ac 100644
--- a/arch/xtensa/platforms/s6105/device.c
+++ b/arch/xtensa/platforms/s6105/device.c
@@ -12,9 +12,12 @@
 #include <linux/irq.h>
 #include <linux/phy.h>
 #include <linux/mmc/host.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 #include <linux/platform_device.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
+#include <linux/spi/flash.h>
 #include <linux/spi/mmc_spi.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_s6000.h>
@@ -211,6 +214,36 @@ static __devinitdata struct s6_spi_platform_data s6_spi_pdata = {
 #define S6_SPI_CS_EXPANSION	3
 #define S6_SPI_CS_MMC_SLOT	4
 
+static struct mtd_partition s6_spi_flash_partitions[] = {
+	{
+		.name = "bootloader",
+		.size = 0x10000,
+		.offset = 0,
+	},
+	{
+		.name = "stage2",
+		.size = 0x360000,
+		.offset = 0x10000,
+	},
+	{
+		.name = "filesystem",
+		.size = 0x90000,
+		.offset = 0x370000,
+	},
+	{ /* actually 0x800 bytes at 0xfff800 */
+		.name = "bootconfig",
+		.size = 0x10000,
+		.offset = 0x3f0000,
+	}
+};
+
+static struct flash_platform_data s6_spi_flash_pdata = {
+	.name = "m25p80",
+	.parts = s6_spi_flash_partitions,
+	.nr_parts = ARRAY_SIZE(s6_spi_flash_partitions),
+	.type = "m25p32",
+};
+
 static int __devinit s6_init_mmc_host(struct device *spi,
 				      irqreturn_t (*handler)(int, void *),
 				      void *mmc)
@@ -258,6 +291,20 @@ static struct mmc_spi_platform_data s6_spi_mmc_pdata = {
 };
 
 static struct spi_board_info __initdata s6_spi_devices[] = {
+#ifdef CONFIG_MTD_M25P80
+	{
+		.modalias = "m25p80",
+		.platform_data = &s6_spi_flash_pdata,
+		.bus_num = S6_SPI_BUS_NUM,
+		.chip_select = S6_SPI_CS_BOOT_FLASH,
+#ifdef CONFIG_M25PXX_USE_FAST_READ
+		.max_speed_hz = 50000000,
+#else
+		.max_speed_hz = 33000000,
+#endif
+		.mode = SPI_MODE_3
+	},
+#endif
 	{
 		.modalias = "mmc_spi",
 		.platform_data = &s6_spi_mmc_pdata,
-- 
1.6.2.107.ge47ee

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ