linux/drivers/staging/spectra/ffsport.h
<<
>>
Prefs
   1/*
   2 * NAND Flash Controller Device Driver
   3 * Copyright (c) 2009, Intel Corporation and its suppliers.
   4 *
   5 * This program is free software; you can redistribute it and/or modify it
   6 * under the terms and conditions of the GNU General Public License,
   7 * version 2, as published by the Free Software Foundation.
   8 *
   9 * This program is distributed in the hope it will be useful, but WITHOUT
  10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  12 * more details.
  13 *
  14 * You should have received a copy of the GNU General Public License along with
  15 * this program; if not, write to the Free Software Foundation, Inc.,
  16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  17 *
  18 */
  19
  20#ifndef _FFSPORT_
  21#define _FFSPORT_
  22
  23#include "ffsdefs.h"
  24
  25#if defined __GNUC__
  26#define PACKED
  27#define PACKED_GNU __attribute__ ((packed))
  28#define UNALIGNED
  29#endif
  30
  31#include <linux/semaphore.h>
  32#include <linux/string.h>       /* for strcpy(), stricmp(), etc */
  33#include <linux/mm.h>           /* for kmalloc(), kfree() */
  34#include <linux/vmalloc.h>
  35#include <linux/module.h>
  36#include <linux/moduleparam.h>
  37#include <linux/init.h>
  38
  39#include <linux/kernel.h>       /* printk() */
  40#include <linux/fs.h>           /* everything... */
  41#include <linux/errno.h>        /* error codes */
  42#include <linux/types.h>        /* size_t */
  43#include <linux/genhd.h>
  44#include <linux/blkdev.h>
  45#include <linux/hdreg.h>
  46#include <linux/pci.h>
  47#include "flash.h"
  48
  49#define VERBOSE    1
  50
  51#define NAND_DBG_WARN  1
  52#define NAND_DBG_DEBUG 2
  53#define NAND_DBG_TRACE 3
  54
  55extern int nand_debug_level;
  56
  57#ifdef VERBOSE
  58#define nand_dbg_print(level, args...)                  \
  59        do {                                            \
  60                if (level <= nand_debug_level)          \
  61                        printk(KERN_ALERT args);        \
  62        } while (0)
  63#else
  64#define nand_dbg_print(level, args...)
  65#endif
  66
  67#ifdef SUPPORT_BIG_ENDIAN
  68#define INVERTUINT16(w)   ((u16)(((u16)(w)) << 8) | \
  69                           (u16)((u16)(w) >> 8))
  70
  71#define INVERTUINT32(dw)  (((u32)(dw) << 24) | \
  72                           (((u32)(dw) << 8) & 0x00ff0000) | \
  73                           (((u32)(dw) >> 8) & 0x0000ff00) | \
  74                           ((u32)(dw) >> 24))
  75#else
  76#define INVERTUINT16(w)   w
  77#define INVERTUINT32(dw)  dw
  78#endif
  79
  80extern int GLOB_Calc_Used_Bits(u32 n);
  81extern u64 GLOB_u64_Div(u64 addr, u32 divisor);
  82extern u64 GLOB_u64_Remainder(u64 addr, u32 divisor_type);
  83extern int register_spectra_ftl(void);
  84
  85#endif /* _FFSPORT_ */
  86