* [PATCH 2/2 v2] ARM: shmobile: Lager:add SPI FLASH support on QSPI
@ 2013-10-18 5:33 Cao Minh Hiep
2013-10-18 11:54 ` Sergei Shtylyov
2013-10-21 1:29 ` カオ ミン ヒェップ
0 siblings, 2 replies; 3+ messages in thread
From: Cao Minh Hiep @ 2013-10-18 5:33 UTC (permalink / raw)
To: linux-sh
From: Hiep Cao Minh <cm-hiep@jinso.co.jp>
This patch enables Spansion S25FL512SAGMFIG11 chip on QSPI,
Add support for the QSPI interface on Lager.
Signed-off-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
---
arch/arm/mach-shmobile/board-lager.c | 69 ++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 78a31b6..5d69cde 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -39,6 +39,11 @@
#include <mach/r8a7790.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/mtd.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/rspi.h>
+#include <linux/spi/spi.h>
/* DU */
static struct rcar_du_encoder_data lager_du_encoders[] = {
@@ -165,6 +170,67 @@ static const struct resource ether_resources[] __initconst = {
DEFINE_RES_IRQ(gic_spi(162)),
};
+/* SPI Flash memory (Spansion S25FL512SAGMFIG11 64Mb) */
+static struct mtd_partition spi_flash_part[] = {
+ /* Reserved for user loader program, read-only */
+ {
+ .name = "loader",
+ .offset = 0,
+ .size = SZ_256K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ /* Reserved for user program, read-only */
+ {
+ .name = "user",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_4M,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ /* All else is writable (e.g. JFFS2) */
+ {
+ .name = "flash",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
+ .mask_flags = 0,
+ },
+};
+
+static struct flash_platform_data spi_flash_data = {
+ .name = "m25p80",
+ .parts = spi_flash_part,
+ .nr_parts = ARRAY_SIZE(spi_flash_part),
+ .type = "s25fl512s",
+};
+
+static struct rspi_plat_data qspi_pdata = {
+ .num_chipselect = 1,
+};
+
+static struct spi_board_info spi_info[] __initdata = {
+ {
+ .modalias = "m25p80",
+ .platform_data = &spi_flash_data,
+ .mode = SPI_MODE_0,
+ .max_speed_hz = 30000000,
+ .bus_num = 0,
+ .chip_select = 0,
+ },
+};
+
+/* QSPI resource */
+static struct resource qspi_resources[] __initdata = {
+ DEFINE_RES_MEM(0xe6b10000, 0x1000),
+ DEFINE_RES_IRQ(gic_spi(184)),
+};
+
+void __init r8a7790_add_qspi_device(struct rspi_plat_data *pdata)
+{
+ platform_device_register_resndata(
+ &platform_bus, "qspi", 0,
+ qspi_resources, ARRAY_SIZE(qspi_resources),
+ pdata, sizeof(*pdata));
+}
+
static const struct pinctrl_map lager_pinctrl_map[] = {
/* DU (CN10: ARGB0, CN13: LVDS) */
PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -222,6 +288,9 @@ static void __init lager_add_standard_devices(void)
ðer_pdata, sizeof(ether_pdata));
lager_add_du_device();
+
+ r8a7790_add_qspi_device(&qspi_pdata);
+ spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
}
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2 v2] ARM: shmobile: Lager:add SPI FLASH support on QSPI
2013-10-18 5:33 [PATCH 2/2 v2] ARM: shmobile: Lager:add SPI FLASH support on QSPI Cao Minh Hiep
@ 2013-10-18 11:54 ` Sergei Shtylyov
2013-10-21 1:29 ` カオ ミン ヒェップ
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2013-10-18 11:54 UTC (permalink / raw)
To: linux-sh
Hello.
On 18-10-2013 9:33, Cao Minh Hiep wrote:
> From: Hiep Cao Minh <cm-hiep@jinso.co.jp>
> This patch enables Spansion S25FL512SAGMFIG11 chip on QSPI,
> Add support for the QSPI interface on Lager.
> Signed-off-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
> ---
> arch/arm/mach-shmobile/board-lager.c | 69 ++++++++++++++++++++++++++++++++++
> 1 file changed, 69 insertions(+)
> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index 78a31b6..5d69cde 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
[...]
> @@ -165,6 +170,67 @@ static const struct resource ether_resources[] __initconst = {
[...]
> +void __init r8a7790_add_qspi_device(struct rspi_plat_data *pdata)
You apparently forgot to change the name prefix to 'lager_'. Also, there's
no dire need in this function, you can register the QSPI device right in
lager_add_standard_devices().
> +{
> + platform_device_register_resndata(
You're breaking the line to early, I think.
> + &platform_bus, "qspi", 0,
> + qspi_resources, ARRAY_SIZE(qspi_resources),
> + pdata, sizeof(*pdata));
> +}
> +
> static const struct pinctrl_map lager_pinctrl_map[] = {
> /* DU (CN10: ARGB0, CN13: LVDS) */
> PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
WBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2 v2] ARM: shmobile: Lager:add SPI FLASH support on QSPI
2013-10-18 5:33 [PATCH 2/2 v2] ARM: shmobile: Lager:add SPI FLASH support on QSPI Cao Minh Hiep
2013-10-18 11:54 ` Sergei Shtylyov
@ 2013-10-21 1:29 ` カオ ミン ヒェップ
1 sibling, 0 replies; 3+ messages in thread
From: カオ ミン ヒェップ @ 2013-10-21 1:29 UTC (permalink / raw)
To: linux-sh
Hello Sergei
Thanks for your comment.
>> +void __init r8a7790_add_qspi_device(struct rspi_plat_data *pdata)
>
> You apparently forgot to change the name prefix to 'lager_'. Also,
> there's no dire need in this function, you can register the QSPI
> device right in lager_add_standard_devices().
>
>> +{
>> + platform_device_register_resndata(
>
> You're breaking the line to early, I think.
>
>> + &platform_bus, "qspi", 0,
>> + qspi_resources, ARRAY_SIZE(qspi_resources),
>> + pdata, sizeof(*pdata));
>> +}
>> +
>> static const struct pinctrl_map lager_pinctrl_map[] = {
>> /* DU (CN10: ARGB0, CN13: LVDS) */
>> PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
>
I'll update this patch as you pointed out to me!
Best Regards,
Hiep.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-21 1:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-18 5:33 [PATCH 2/2 v2] ARM: shmobile: Lager:add SPI FLASH support on QSPI Cao Minh Hiep
2013-10-18 11:54 ` Sergei Shtylyov
2013-10-21 1:29 ` カオ ミン ヒェップ
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.