summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/include/mach/w1.h
blob: c96df7abdf9682b1c911130b150084b5f344dec3 (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
83
84
/*
 * include/mach/w1.h
 *
 * Copyright (C) 2010 Motorola, Inc
 * Author: Andrei Warkentin <andreiw@motorola.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef __ASM_ARM_ARCH_TEGRA_W1_H
#define __ASM_ARM_ARCH_TEGRA_W1_H

struct tegra_w1_timings {

	/* tsu, trelease, trdv, tlow0, tlow1 and tslot are formed
	   into the value written into OWR_RST_PRESENCE_TCTL_0 register. */

	/* Read data setup, Tsu = N owr clks, Range = tsu < 1,
	   Typical value = 0x1 */
	uint32_t tsu;

	/* Release 1-wire time, Trelease = N owr clks,
	   Range = 0 <= trelease < 45, Typical value = 0xf */
	uint32_t trelease;

	/*  Read data valid time, Trdv = N+1 owr clks, Range = Exactly 15 */
	uint32_t trdv;

	/* Write zero time low, Tlow0 = N+1 owr clks,
	   Range = 60 <= tlow0 < tslot < 120, typical value = 0x3c. */
	uint32_t tlow0;

	/* Write one time low, or TLOWR both are same Tlow1 = N+1 owr clks,
	   Range = 1 <= tlow1 < 15 TlowR = N+1 owr clks,
	   Range = 1 <= tlowR < 15, Typical value = 0x1. */
	uint32_t tlow1;

	/* Active time slot for write or read data, Tslot = N+1 owr clks,
	   Range = 60 <= tslot < 120, Typical value = 0x77. */
	uint32_t tslot;

	/* tpdl, tpdh, trstl, trsth are formed in the the value written
	   into the OWR_RST_PRESENCE_TCTL_0 register. */

	/* Tpdl = N owr clks, Range = 60 <= tpdl < 240,
	   Typical value = 0x78. */
	uint32_t tpdl;

	/* Tpdh = N+1 owr clks, Range = 15 <= tpdh < 60.
	   Typical value = 0x1e. */
	uint32_t tpdh;

	/* Trstl = N+1 owr clks, Range = 480 <= trstl < infinity,
	   Typical value = 0x1df. */
	uint32_t trstl;

	/* Trsth = N+1 owr clks, Range = 480 <= trsth < infinity,
	 Typical value = 0x1df. */
	uint32_t trsth;

	/* Read data sample clock. Should be <= to (tlow1 - 6) clks,
	   6 clks are used for deglitch. If deglitch  bypassed it
	   is 3 clks, Typical value = 0x7. */
	uint32_t rdsclk;

	/* Presence sample clock. Should be <= to (tpdl - 6) clks,
	   6 clks are used for deglitch. If deglitch bypassed it is 3 clks,
	   Typical value = 0x50. */
	uint32_t psclk;
};

struct tegra_w1_platform_data {
	const char *clk_id;
	struct tegra_w1_timings *timings;
};

#endif