linux/drivers/mtd/ssfdc.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Linux driver for SSFDC Flash Translation Layer (Read only)
 * © 2005 Eptar srl
 * Author: Claudio Lanconelli <[email protected]>
 *
 * Based on NTFL and MTDBLOCK_RO drivers
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/hdreg.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/blktrans.h>

struct ssfdcr_record {};

#define SSFDCR_MAJOR
#define SSFDCR_PARTN_BITS

#define SECTOR_SIZE
#define SECTOR_SHIFT
#define OOB_SIZE

#define MAX_LOGIC_BLK_PER_ZONE
#define MAX_PHYS_BLK_PER_ZONE

#define KiB(x)
#define MiB(x)

/** CHS Table
		1MiB	2MiB	4MiB	8MiB	16MiB	32MiB	64MiB	128MiB
NCylinder	125	125	250	250	500	500	500	500
NHead		4	4	4	4	4	8	8	16
NSector		4	8	8	16	16	16	32	32
SumSector	2,000	4,000	8,000	16,000	32,000	64,000	128,000	256,000
SectorSize	512	512	512	512	512	512	512	512
**/

chs_entry_t;

/* Must be ordered by size */
static const chs_entry_t chs_table[] =;

static int get_chs(unsigned long size, unsigned short *cyl, unsigned char *head,
			unsigned char *sec)
{}

/* These bytes are the signature for the CIS/IDI sector */
static const uint8_t cis_numbers[] =;

/* Read and check for a valid CIS sector */
static int get_valid_cis_sector(struct mtd_info *mtd)
{}

/* Read physical sector (wrapper to MTD_READ) */
static int read_physical_sector(struct mtd_info *mtd, uint8_t *sect_buf,
				int sect_no)
{}

/* Read redundancy area (wrapper to MTD_READ_OOB */
static int read_raw_oob(struct mtd_info *mtd, loff_t offs, uint8_t *buf)
{}

/* Parity calculator on a word of n bit size */
static int get_parity(int number, int size)
{}

/* Read and validate the logical block address field stored in the OOB */
static int get_logical_address(uint8_t *oob_buf)
{}

/* Build the logic block map */
static int build_logical_block_map(struct ssfdcr_record *ssfdc)
{}

static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
{}

static void ssfdcr_remove_dev(struct mtd_blktrans_dev *dev)
{}

static int ssfdcr_readsect(struct mtd_blktrans_dev *dev,
				unsigned long logic_sect_no, char *buf)
{}

static int ssfdcr_getgeo(struct mtd_blktrans_dev *dev,  struct hd_geometry *geo)
{}

/****************************************************************************
 *
 * Module stuff
 *
 ****************************************************************************/

static struct mtd_blktrans_ops ssfdcr_tr =;

static int __init init_ssfdcr(void)
{}

static void __exit cleanup_ssfdcr(void)
{}

module_init();
module_exit(cleanup_ssfdcr);

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();