From patchwork Thu Jan 17 05:39:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 14092 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 15F0923E27 for ; Thu, 17 Jan 2013 05:31:42 +0000 (UTC) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by fiordland.canonical.com (Postfix) with ESMTP id B3ECEA180BC for ; Thu, 17 Jan 2013 05:31:41 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so2124243vba.41 for ; Wed, 16 Jan 2013 21:31:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:dlp-filter:x-mtr:x-brightmail-tracker :x-brightmail-tracker:x-cfilter-loop:x-gm-message-state; bh=9MqVxzVTJ1GatCqaf4u/sEiUMITZrJdado+plkcuA/U=; b=kp3fAOG5g1M4xFwDwsNMgsOfoA9nD1JJ+qHJgNUCnWBrwHmAopOImxdJxUva1wYjQg R4FAkWjSNikF+Dc9L9t+TaYDojzekR29U7x2VJzrCPGbPxbIb9Vru3ODQ3xTn33jITPo hrwE3uJb97epWW3XttaYKbDgOHFroI5mycWBbgalBUOQwkS6RFDOGzO2DkPJQ6LiA5Q2 qzLZ8h/h7rIJZkj7IShnk4LZBhrbgoYol2LUJttDosRmEKox2XeGbm2trjGCIQpKcuTR Ezuv6Mj5nCY6LZlJZwX8Qzua4rE++9vTgY1Lan0sro2nq5pEtVUeV+5G5C60xJujm2t6 5oUg== X-Received: by 10.220.154.199 with SMTP id p7mr4050749vcw.48.1358400701210; Wed, 16 Jan 2013 21:31:41 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp13156veb; Wed, 16 Jan 2013 21:31:40 -0800 (PST) X-Received: by 10.68.217.42 with SMTP id ov10mr10030611pbc.51.1358400698395; Wed, 16 Jan 2013 21:31:38 -0800 (PST) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id wk7si538774pbc.169.2013.01.16.21.31.37; Wed, 16 Jan 2013 21:31:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MGR00GGF8ONKG80@mailout1.samsung.com>; Thu, 17 Jan 2013 14:31:37 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id D2.B4.01231.9BC87F05; Thu, 17 Jan 2013 14:31:37 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-95-50f78cb94e23 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 82.B4.01231.9BC87F05; Thu, 17 Jan 2013 14:31:37 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MGR0067J8OJ9V10@mmp2.samsung.com>; Thu, 17 Jan 2013 14:31:37 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org Subject: [PATCH 1/2] SF: Add driver for Gigabyte device GD25LQ and GD25Q64B Date: Thu, 17 Jan 2013 11:09:05 +0530 Message-id: <1358401146-10628-2-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1358401146-10628-1-git-send-email-rajeshwari.s@samsung.com> References: <1358401146-10628-1-git-send-email-rajeshwari.s@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRmVeSWpSXmKPExsWyRsSkVndnz/cAg6k3dSwerr/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBlTHiylrVgr1xFx92bLA2MmyW7GDk5JARMJM5v/s4E YYtJXLi3nq2LkYtDSGApo8TOpY8ZYYru72xmhEhMZ5Ro/zSJGcKZyCRx+sRiFpAqNgEjia0n p4F1iAhISPzqvwpmMwvESLze/4MNxBYW8JY4tWoWWD2LgKrE/gdHwOK8Ah4S39/PYYbYpiBx bOpXVhCbU8BT4vbBn+wgthBQzZ8T65ggegUkvk0+BDSHA6heVmLTAbB7JARus0nsnLcVao6k xMEVN1gmMAovYGRYxSiaWpBcUJyUnmuoV5yYW1yal66XnJ+7iREYkKf/PZPawbiyweIQowAH oxIPr+HlbwFCrIllxZW5hxglOJiVRHjX5H0PEOJNSaysSi3Kjy8qzUktPsToA3TJRGYp0eR8 YLTklcQbGpuYmxqbWhoZmZma4hBWEudlPPUkQEggPbEkNTs1tSC1CGYcEwenVAOj1+O1v/4s klgWGT1lEUdhFHtszYmwKps7bCd7XA4I/Z3/1ly/7cOe6uM6/stUb175qNwp7/vxS1zup4XP 0564r1mz0yLX6Ln8hRbV5aJHzXQ0PysdmhFitefamajvX1d9+fGPJekWv/Hz6qhY3hShY0xz fxZ8fPXnz5ySGL3ezMys2Tbtxr9PKbEUZyQaajEXFScCABg2N6F1AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRmVeSWpSXmKPExsVy+t9jQd2dPd8DDKa9k7d4uP4mi8WUw19Y HJg87lzbwxbAGNXAaJORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+Ti E6DrlpkDNFtJoSwxpxQoFJBYXKykb4dpQmiIm64FTGOErm9IEFyPkQEaSFjDmDHhyVrWgr1y FR13b7I0MG6W7GLk5JAQMJG4v7OZEcIWk7hwbz1bFyMXh5DAdEaJ9k+TmCGciUwSp08sZgGp YhMwkth6chpYh4iAhMSv/qtgNrNAjMTr/T/YQGxhAW+JU6tmgdWzCKhK7H9wBCzOK+Ah8f39 HGaIbQoSx6Z+ZQWxOQU8JW4f/MkOYgsB1fw5sY5pAiPvAkaGVYyiqQXJBcVJ6bmGesWJucWl eel6yfm5mxjB4f5MagfjygaLQ4wCHIxKPLyGl78FCLEmlhVX5h5ilOBgVhLhXZP3PUCINyWx siq1KD++qDQntfgQow/QVROZpUST84GxmFcSb2hsYm5qbGppYmFiZolDWEmcl/HUkwAhgfTE ktTs1NSC1CKYcUwcnFINjEvkliXZ2r0y7T98ZJeNcdyCPq2mmKMhUx4IOm6dtrP49c4UDyfm jKdrqgu3GWzXifX0y8o0YpO9YXmrK/EXW9jNqq6tVXHfpZbk3Vgfk/xsxv2CFMGOD9k8El69 d3WZ1e68YVq/OflVPfslcwmRe4asLPEaldPMfr6d4np8V9+WLT0rA0tmKrEUZyQaajEXFScC ADmY91ekAgAA X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQmNoNcdRO1y7Y//sgua29aeExi+epHcz1MxEKkt44io8hh2laeg0BifWCLgJnZtHLHCpv8m This patch adds driver for the gigabyte devices GD25LQ and GD25Q64B required for Snow Board. Signed-off-by: Rajeshwari Shinde --- drivers/mtd/spi/Makefile | 1 + drivers/mtd/spi/gigadevice.c | 66 ++++++++++++++++++++++++++++++++++ drivers/mtd/spi/spi_flash.c | 3 ++ drivers/mtd/spi/spi_flash_internal.h | 1 + 4 files changed, 71 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/spi/gigadevice.c diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile index 90f8392..0af497d 100644 --- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile @@ -39,6 +39,7 @@ COBJS-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.o COBJS-$(CONFIG_SPI_FLASH_WINBOND) += winbond.o COBJS-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.o COBJS-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o +COBJS-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/mtd/spi/gigadevice.c b/drivers/mtd/spi/gigadevice.c new file mode 100644 index 0000000..5dbcd19 --- /dev/null +++ b/drivers/mtd/spi/gigadevice.c @@ -0,0 +1,66 @@ +/* + * Gigadevice SPI flash driver + * Copyright 2013, Samsung Electronics Co., Ltd. + * Author: Banajit Goswami + * + */ + +#include +#include +#include + +#include "spi_flash_internal.h" + +struct gigadevice_spi_flash_params { + uint16_t id; + uint16_t nr_blocks; + const char *name; +}; + +static const struct gigadevice_spi_flash_params gigadevice_spi_flash_table[] = { + { + .id = 0x6016, + .nr_blocks = 64, + .name = "GD25LQ", + }, + { + .id = 0x4017, + .nr_blocks = 128, + .name = "GD25Q64B", + }, + +}; + + +struct spi_flash *spi_flash_probe_gigadevice(struct spi_slave *spi, u8 *idcode) +{ + const struct gigadevice_spi_flash_params *params; + struct spi_flash *flash; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(gigadevice_spi_flash_table); i++) { + params = &gigadevice_spi_flash_table[i]; + if (params->id == ((idcode[1] << 8) | idcode[2])) + break; + } + + if (i == ARRAY_SIZE(gigadevice_spi_flash_table)) { + debug("SF: Unsupported Gigadevice ID %02x%02x\n", + idcode[1], idcode[2]); + return NULL; + } + + flash = spi_flash_alloc_base(spi, params->name); + if (!flash) { + debug("SF: Failed to allocate memory\n"); + return NULL; + } + /* Assuming power-of-two page size initially. */ + flash->page_size = 256; + /* sector_size = page_size * pages_per_sector */ + flash->sector_size = flash->page_size * 16; + /* size = sector_size * sector_per_block * number of blocks */ + flash->size = flash->sector_size * 16 * params->nr_blocks; + + return flash; +} diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 17f3d3c..ee05171 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -305,6 +305,9 @@ static const struct { #ifdef CONFIG_SPI_FLASH_EON { 0, 0x1c, spi_flash_probe_eon, }, #endif +#ifdef CONFIG_SPI_FLASH_GIGADEVICE + { 0, 0xc8, spi_flash_probe_gigadevice, }, +#endif #ifdef CONFIG_SPI_FLASH_MACRONIX { 0, 0xc2, spi_flash_probe_macronix, }, #endif diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h index 141cfa8..e0afbc3 100644 --- a/drivers/mtd/spi/spi_flash_internal.h +++ b/drivers/mtd/spi/spi_flash_internal.h @@ -106,3 +106,4 @@ struct spi_flash *spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode); struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 *idcode); struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode); struct spi_flash *spi_fram_probe_ramtron(struct spi_slave *spi, u8 *idcode); +struct spi_flash *spi_flash_probe_gigadevice(struct spi_slave *spi, u8 *idcode);