summaryrefslogtreecommitdiff
path: root/drivers/rk_nand/rk_nand_blk.h
blob: dc4776fc5d6f4320e4932e945fae9b5e015c8aef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef __RKNAND_BLK_H
#define __RKNAND_BLK_H

#include <linux/semaphore.h>

#define MAX_PART_COUNT 32

struct nand_part {
	unsigned char name[32];
	unsigned long offset;
	unsigned long size;
	unsigned char type;
};

struct nand_blk_dev {
	struct nand_blk_ops *nandr;
	struct list_head list;
	int devnum;
	unsigned long size;
	unsigned long off_size;
	int readonly;
	int writeonly;
	int disable_access;
	void *blkcore_priv;
};

struct nand_blk_ops {
	char *name;
	int major;
	int minorbits;
	int last_dev_index;
	struct completion thread_exit;
	int quit;
	int nand_th_quited;
	wait_queue_head_t thread_wq; /* thread wait queue */
	struct request_queue *rq;
	spinlock_t queue_lock; /* queue lock */
	struct list_head devs;
	struct module *owner;
};

extern struct device *g_nand_device;
void rknand_dev_suspend(void);
void rknand_dev_resume(void);
void rknand_dev_shutdown(void);
void rknand_dev_flush(void);
int __init rknand_dev_init(void);
int rknand_dev_exit(void);
void rknand_device_lock(void);
int rknand_device_trylock(void);
void rknand_device_unlock(void);
int nand_blk_add_whole_disk(void);
#endif