From patchwork Tue Oct 15 09:08:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cao Minh Hiep X-Patchwork-Id: 3044031 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3E8569F2B7 for ; Tue, 15 Oct 2013 09:15:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5F1320250 for ; Tue, 15 Oct 2013 09:15:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B943A201ED for ; Tue, 15 Oct 2013 09:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751304Ab3JOJPL (ORCPT ); Tue, 15 Oct 2013 05:15:11 -0400 Received: from m119.secure.ne.jp ([158.199.161.240]:60697 "HELO m119.secure.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751993Ab3JOJPJ (ORCPT ); Tue, 15 Oct 2013 05:15:09 -0400 Received: (qmail 60918 invoked from network); 15 Oct 2013 18:08:27 +0900 Received: from unknown (HELO localhost) (61.118.107.10) by 0 with SMTP; 15 Oct 2013 18:08:27 +0900 From: Cao Minh Hiep To: linux-sh@vger.kernel.org, horms@verge.net.au Cc: magnus.damm@gmail.com, kuninori.morimoto.gx@renesas.com, yoshihiro.shimoda.uh@renesas.com Subject: [PATCH 2/2] ARM: shmobile: Lager: add SPI FLASH support Date: Tue, 15 Oct 2013 18:08:24 +0900 Message-Id: <1381828104-31302-3-git-send-email-cm-hiep@jinso.co.jp> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1381828104-31302-1-git-send-email-cm-hiep@jinso.co.jp> References: <1381828104-31302-1-git-send-email-cm-hiep@jinso.co.jp> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hiep Cao Minh This patch enables Spansion S25FL512SAGMFIG11 chip on QSPI Signed-off-by: Hiep Cao Minh --- arch/arm/mach-shmobile/board-lager.c | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index ffb6f0a..f48c514 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c @@ -37,6 +37,11 @@ #include #include #include +#include +#include +#include +#include +#include /* LEDS */ static struct gpio_led lager_leds[] = { @@ -105,6 +110,53 @@ static struct resource ether_resources[] __initdata = { 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, + }, +}; + static const struct pinctrl_map lager_pinctrl_map[] = { /* SCIF0 (CN19: DEBUG SERIAL0) */ PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790", @@ -153,6 +205,9 @@ static void __init lager_add_standard_devices(void) ether_resources, ARRAY_SIZE(ether_resources), ðer_pdata, sizeof(ether_pdata)); + + r8a7790_add_qspi_device(&qspi_pdata); + spi_register_board_info(spi_info, ARRAY_SIZE(spi_info)); } static const char *lager_boards_compat_dt[] __initdata = {