2 # Copyright (c) 2011 The Chromium OS Authors.
4 # SPDX-License-Identifier: GPL-2.0+
17 class TestPatch(unittest.TestCase):
20 TODO: Write tests for the rest of the functionality
24 """Test basic filter operation"""
27 From 656c9a8c31fa65859d924cd21da920d6ba537fad Mon Sep 17 00:00:00 2001
28 From: Simon Glass <sjg@chromium.org>
29 Date: Thu, 28 Apr 2011 09:58:51 -0700
30 Subject: [PATCH (resend) 3/7] Tegra2: Add more clock support
32 This adds functions to enable/disable clocks and reset to on-chip peripherals.
35 TEST=build U-Boot for Seaboard, boot
37 Change-Id: I80fe1d0c0b7dd10aa58ce5bb1d9290b6664d5413
39 Review URL: http://codereview.chromium.org/6900006
41 Signed-off-by: Simon Glass <sjg@chromium.org>
43 arch/arm/cpu/armv7/tegra2/Makefile | 2 +-
44 arch/arm/cpu/armv7/tegra2/ap20.c | 57 ++----
45 arch/arm/cpu/armv7/tegra2/clock.c | 163 +++++++++++++++++
49 From 656c9a8c31fa65859d924cd21da920d6ba537fad Mon Sep 17 00:00:00 2001
50 From: Simon Glass <sjg@chromium.org>
51 Date: Thu, 28 Apr 2011 09:58:51 -0700
52 Subject: [PATCH (resend) 3/7] Tegra2: Add more clock support
54 This adds functions to enable/disable clocks and reset to on-chip peripherals.
56 Signed-off-by: Simon Glass <sjg@chromium.org>
59 arch/arm/cpu/armv7/tegra2/Makefile | 2 +-
60 arch/arm/cpu/armv7/tegra2/ap20.c | 57 ++----
61 arch/arm/cpu/armv7/tegra2/clock.c | 163 +++++++++++++++++
64 inhandle, inname = tempfile.mkstemp()
65 infd = os.fdopen(inhandle, 'w')
69 exphandle, expname = tempfile.mkstemp()
70 expfd = os.fdopen(exphandle, 'w')
74 patchstream.FixPatch(None, inname, series.Series(), None)
75 rc = os.system('diff -u %s %s' % (inname, expname))
76 self.assertEqual(rc, 0)
81 def GetData(self, data_type):
83 From 4924887af52713cabea78420eff03badea8f0035 Mon Sep 17 00:00:00 2001
84 From: Simon Glass <sjg@chromium.org>
85 Date: Thu, 7 Apr 2011 10:14:41 -0700
86 Subject: [PATCH 1/4] Add microsecond boot time measurement
88 This defines the basics of a new boot time measurement feature. This allows
89 logging of very accurate time measurements as the boot proceeds, by using
90 an available microsecond counter.
95 common/bootstage.c | 50 ++++++++++++++++++++++++++++++++++++
96 include/bootstage.h | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++
97 include/common.h | 8 ++++++
98 5 files changed, 141 insertions(+), 0 deletions(-)
99 create mode 100644 common/bootstage.c
100 create mode 100644 include/bootstage.h
102 diff --git a/README b/README
103 index 6f3748d..f9e4e65 100644
106 @@ -2026,6 +2026,17 @@ The following options need to be configured:
107 example, some LED's) on your board. At the moment,
108 the following checkpoints are implemented:
110 +- Time boot progress
113 + Define this option to enable microsecond boot stage timing
114 + on supported platforms. For this to work your platform
115 + needs to define a function timer_get_us() which returns the
116 + number of microseconds since reset. This would normally
117 + be done in your SOC or board timer.c file.
119 + You can add calls to bootstage_mark() to set time markers.
121 - Standalone program support:
122 CONFIG_STANDALONE_LOAD_ADDR
124 diff --git a/common/bootstage.c b/common/bootstage.c
126 index 0000000..2234c87
128 +++ b/common/bootstage.c
131 + * Copyright (c) 2011, Google Inc. All rights reserved.
133 + * SPDX-License-Identifier: GPL-2.0+
138 + * This module records the progress of boot and arbitrary commands, and
139 + * permits accurate timestamping of each. The records can optionally be
140 + * passed to kernel in the ATAGs
146 +struct bootstage_record {
151 +static struct bootstage_record record[BOOTSTAGE_COUNT];
153 +uint32_t bootstage_mark(enum bootstage_id id, const char *name)
155 + struct bootstage_record *rec = &record[id];
157 + /* Only record the first event for each */
159 + rec->time_us = (uint32_t)timer_get_us();
163 + %ssomething_else) {
164 + rec->time_us = (uint32_t)timer_get_us();
167 +%sreturn rec->time_us;
172 signoff = 'Signed-off-by: Simon Glass <sjg@chromium.org>\n'
175 if data_type == 'good':
177 elif data_type == 'no-signoff':
179 elif data_type == 'spaces':
181 elif data_type == 'indent':
184 print 'not implemented'
185 return data % (signoff, tab, indent, tab)
187 def SetupData(self, data_type):
188 inhandle, inname = tempfile.mkstemp()
189 infd = os.fdopen(inhandle, 'w')
190 data = self.GetData(data_type)
196 """Test checkpatch operation"""
197 inf = self.SetupData('good')
198 result = checkpatch.CheckPatch(inf)
199 self.assertEqual(result.ok, True)
200 self.assertEqual(result.problems, [])
201 self.assertEqual(result.errors, 0)
202 self.assertEqual(result.warnings, 0)
203 self.assertEqual(result.checks, 0)
204 self.assertEqual(result.lines, 56)
207 def testNoSignoff(self):
208 inf = self.SetupData('no-signoff')
209 result = checkpatch.CheckPatch(inf)
210 self.assertEqual(result.ok, False)
211 self.assertEqual(len(result.problems), 1)
212 self.assertEqual(result.errors, 1)
213 self.assertEqual(result.warnings, 0)
214 self.assertEqual(result.checks, 0)
215 self.assertEqual(result.lines, 56)
218 def testSpaces(self):
219 inf = self.SetupData('spaces')
220 result = checkpatch.CheckPatch(inf)
221 self.assertEqual(result.ok, False)
222 self.assertEqual(len(result.problems), 2)
223 self.assertEqual(result.errors, 0)
224 self.assertEqual(result.warnings, 2)
225 self.assertEqual(result.checks, 0)
226 self.assertEqual(result.lines, 56)
229 def testIndent(self):
230 inf = self.SetupData('indent')
231 result = checkpatch.CheckPatch(inf)
232 self.assertEqual(result.ok, False)
233 self.assertEqual(len(result.problems), 1)
234 self.assertEqual(result.errors, 0)
235 self.assertEqual(result.warnings, 0)
236 self.assertEqual(result.checks, 1)
237 self.assertEqual(result.lines, 56)
241 if __name__ == "__main__":