summaryrefslogtreecommitdiff
path: root/include/asm-avr32/arch-at32ap/smc.h
blob: 07152b7fd9c94da03f2c3d2fa1af3c9d00464b8c (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * Static Memory Controller for AT32 chips
 *
 * Copyright (C) 2006 Atmel Corporation
 *
 * Inspired by the OMAP2 General-Purpose Memory Controller interface
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#ifndef __ARCH_AT32AP_SMC_H
#define __ARCH_AT32AP_SMC_H

/*
 * All timing parameters are in nanoseconds.
 */
struct smc_config {
	/* Delay from address valid to assertion of given strobe */
	u16		ncs_read_setup;
	u16		nrd_setup;
	u16		ncs_write_setup;
	u16		nwe_setup;

	/* Pulse length of given strobe */
	u16		ncs_read_pulse;
	u16		nrd_pulse;
	u16		ncs_write_pulse;
	u16		nwe_pulse;

	/* Total cycle length of given operation */
	u16		read_cycle;
	u16		write_cycle;

	/* Bus width in bytes */
	u8		bus_width;

	/*
	 * 0: Data is sampled on rising edge of NCS
	 * 1: Data is sampled on rising edge of NRD
	 */
	unsigned int	nrd_controlled:1;

	/*
	 * 0: Data is driven on falling edge of NCS
	 * 1: Data is driven on falling edge of NWR
	 */
	unsigned int	nwe_controlled:1;

	/*
	 * 0: NWAIT is disabled
	 * 1: Reserved
	 * 2: NWAIT is frozen mode
	 * 3: NWAIT in ready mode
	 */
	unsigned int	nwait_mode:2;

	/*
	 * 0: Byte select access type
	 * 1: Byte write access type
	 */
	unsigned int	byte_write:1;

	/*
	 * Number of clock cycles before data is released after
	 * the rising edge of the read controlling signal
	 *
	 * Total cycles from SMC is tdf_cycles + 1
	 */
	unsigned int	tdf_cycles:4;

	/*
	 * 0: TDF optimization disabled
	 * 1: TDF optimization enabled
	 */
	unsigned int	tdf_mode:1;
};

extern int smc_set_configuration(int cs, const struct smc_config *config);
extern struct smc_config *smc_get_configuration(int cs);

#endif /* __ARCH_AT32AP_SMC_H */