nand_id.c revision 303975
1139804Simp/*-
21541Srgrimes * Copyright (C) 2009-2012 Semihalf
31541Srgrimes * All rights reserved.
41541Srgrimes *
51541Srgrimes * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes *
141541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
151541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
161541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
171541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
181541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
191541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
201541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
211541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
221541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
231541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
241541Srgrimes * SUCH DAMAGE.
251541Srgrimes */
261541Srgrimes
271541Srgrimes#include <sys/cdefs.h>
281541Srgrimes__FBSDID("$FreeBSD: releng/11.0/sys/dev/nand/nand_id.c 298307 2016-04-19 23:37:24Z pfg $");
291541Srgrimes
301541Srgrimes#include <sys/param.h>
311541Srgrimes#include <sys/systm.h>
321541Srgrimes
331541Srgrimes#include <dev/nand/nand.h>
341541Srgrimes
351541Srgrimesstruct nand_params nand_ids[] = {
36116182Sobrien	{ { NAND_MAN_SAMSUNG, 0x75 }, "Samsung K9F5608U0B NAND 32MiB 8-bit",
37116182Sobrien	    0x20, 0x200, 0x10, 0x20, 0 },
38116182Sobrien	{ { NAND_MAN_SAMSUNG, 0xf1 }, "Samsung K9F1G08U0A NAND 128MiB 3,3V 8-bit",
391541Srgrimes	    0x80, 0x800, 0x40, 0x40, 0 },
401541Srgrimes	{ { NAND_MAN_SAMSUNG, 0xda }, "Samsung K9F2G08U0A NAND 256MiB 3,3V 8-bit",
4112577Sbde	    0x100, 0x800, 0x40, 0x40, 0 },
421541Srgrimes	{ { NAND_MAN_SAMSUNG, 0xdc }, "Samsung NAND 512MiB 3,3V 8-bit",
431541Srgrimes	    0x200, 0x800, 0x40, 0x40, 0 },
4424206Sbde	{ { NAND_MAN_SAMSUNG, 0xd3 }, "Samsung NAND 1GiB 3,3V 8-bit",
4524206Sbde	    0x400, 0x800, 0x40, 0x40, 0 },
461541Srgrimes	{ { NAND_MAN_HYNIX, 0x76 }, "Hynix NAND 64MiB 3,3V 8-bit",
473308Sphk	    0x40, 0x200, 0x10, 0x20, 0 },
4812517Sjulian	{ { NAND_MAN_HYNIX, 0xdc }, "Hynix NAND 512MiB 3,3V 8-bit",
4929357Speter	    0x200, 0x800, 0x40, 0x40, 0 },
5041086Struckman	{ { NAND_MAN_HYNIX, 0x79 }, "Hynix NAND 128MB 3,3V 8-bit",
5170069Sjhb	    0x80, 0x200, 0x10, 0x20, 0 },
5212517Sjulian	{ { NAND_MAN_STMICRO, 0xf1 }, "STMicro 128MB 3,3V 8-bit",
531541Srgrimes	    0x80, 2048, 64, 0x40, 0 },
541541Srgrimes	{ { NAND_MAN_MICRON, 0xcc }, "Micron NAND 512MiB 3,3V 16-bit",
551541Srgrimes	    0x200, 2048, 64, 0x40, 0 },
561541Srgrimes};
571541Srgrimes
5812675Sjulianstruct nand_params *nand_get_params(struct nand_id *id)
5912675Sjulian{
6012675Sjulian	int i;
6112675Sjulian
6229357Speter	for (i = 0; i < nitems(nand_ids); i++)
6312675Sjulian		if (nand_ids[i].id.man_id == id->man_id &&
6470069Sjhb		    nand_ids[i].id.dev_id == id->dev_id)
6570069Sjhb			return (&nand_ids[i]);
6647625Sphk
67126080Sphk	return (NULL);
68126080Sphk}
69111815Sphk