Linux Audio

Check our new training course

Loading...
v6.2
  1// SPDX-License-Identifier: GPL-2.0-or-later
  2/*
  3 * Support for the OLPC DCON and OLPC EC access
  4 *
  5 * Copyright © 2006  Advanced Micro Devices, Inc.
  6 * Copyright © 2007-2008  Andres Salomon <dilinger@debian.org>
 
 
 
 
 
  7 */
  8
  9#include <linux/kernel.h>
 10#include <linux/init.h>
 11#include <linux/export.h>
 12#include <linux/delay.h>
 
 13#include <linux/io.h>
 14#include <linux/string.h>
 15#include <linux/platform_device.h>
 16#include <linux/of.h>
 17#include <linux/syscore_ops.h>
 18#include <linux/mutex.h>
 19#include <linux/olpc-ec.h>
 20
 21#include <asm/geode.h>
 22#include <asm/setup.h>
 23#include <asm/olpc.h>
 24#include <asm/olpc_ofw.h>
 25
 26struct olpc_platform_t olpc_platform_info;
 27EXPORT_SYMBOL_GPL(olpc_platform_info);
 28
 
 
 
 
 
 29/* what the timeout *should* be (in ms) */
 30#define EC_BASE_TIMEOUT 20
 31
 32/* the timeout that bugs in the EC might force us to actually use */
 33static int ec_timeout = EC_BASE_TIMEOUT;
 34
 35static int __init olpc_ec_timeout_set(char *str)
 36{
 37	if (get_option(&str, &ec_timeout) != 1) {
 38		ec_timeout = EC_BASE_TIMEOUT;
 39		printk(KERN_ERR "olpc-ec:  invalid argument to "
 40				"'olpc_ec_timeout=', ignoring!\n");
 41	}
 42	printk(KERN_DEBUG "olpc-ec:  using %d ms delay for EC commands.\n",
 43			ec_timeout);
 44	return 1;
 45}
 46__setup("olpc_ec_timeout=", olpc_ec_timeout_set);
 47
 48/*
 49 * These {i,o}bf_status functions return whether the buffers are full or not.
 50 */
 51
 52static inline unsigned int ibf_status(unsigned int port)
 53{
 54	return !!(inb(port) & 0x02);
 55}
 56
 57static inline unsigned int obf_status(unsigned int port)
 58{
 59	return inb(port) & 0x01;
 60}
 61
 62#define wait_on_ibf(p, d) __wait_on_ibf(__LINE__, (p), (d))
 63static int __wait_on_ibf(unsigned int line, unsigned int port, int desired)
 64{
 65	unsigned int timeo;
 66	int state = ibf_status(port);
 67
 68	for (timeo = ec_timeout; state != desired && timeo; timeo--) {
 69		mdelay(1);
 70		state = ibf_status(port);
 71	}
 72
 73	if ((state == desired) && (ec_timeout > EC_BASE_TIMEOUT) &&
 74			timeo < (ec_timeout - EC_BASE_TIMEOUT)) {
 75		printk(KERN_WARNING "olpc-ec:  %d: waited %u ms for IBF!\n",
 76				line, ec_timeout - timeo);
 77	}
 78
 79	return !(state == desired);
 80}
 81
 82#define wait_on_obf(p, d) __wait_on_obf(__LINE__, (p), (d))
 83static int __wait_on_obf(unsigned int line, unsigned int port, int desired)
 84{
 85	unsigned int timeo;
 86	int state = obf_status(port);
 87
 88	for (timeo = ec_timeout; state != desired && timeo; timeo--) {
 89		mdelay(1);
 90		state = obf_status(port);
 91	}
 92
 93	if ((state == desired) && (ec_timeout > EC_BASE_TIMEOUT) &&
 94			timeo < (ec_timeout - EC_BASE_TIMEOUT)) {
 95		printk(KERN_WARNING "olpc-ec:  %d: waited %u ms for OBF!\n",
 96				line, ec_timeout - timeo);
 97	}
 98
 99	return !(state == desired);
100}
101
102/*
103 * This allows the kernel to run Embedded Controller commands.  The EC is
104 * documented at <http://wiki.laptop.org/go/Embedded_controller>, and the
105 * available EC commands are here:
106 * <http://wiki.laptop.org/go/Ec_specification>.  Unfortunately, while
107 * OpenFirmware's source is available, the EC's is not.
108 */
109static int olpc_xo1_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,
110		size_t outlen, void *arg)
111{
 
112	int ret = -EIO;
113	int i;
114	int restarts = 0;
115
 
 
116	/* Clear OBF */
117	for (i = 0; i < 10 && (obf_status(0x6c) == 1); i++)
118		inb(0x68);
119	if (i == 10) {
120		printk(KERN_ERR "olpc-ec:  timeout while attempting to "
121				"clear OBF flag!\n");
122		goto err;
123	}
124
125	if (wait_on_ibf(0x6c, 0)) {
126		printk(KERN_ERR "olpc-ec:  timeout waiting for EC to "
127				"quiesce!\n");
128		goto err;
129	}
130
131restart:
132	/*
133	 * Note that if we time out during any IBF checks, that's a failure;
134	 * we have to return.  There's no way for the kernel to clear that.
135	 *
136	 * If we time out during an OBF check, we can restart the command;
137	 * reissuing it will clear the OBF flag, and we should be alright.
138	 * The OBF flag will sometimes misbehave due to what we believe
139	 * is a hardware quirk..
140	 */
141	pr_devel("olpc-ec:  running cmd 0x%x\n", cmd);
142	outb(cmd, 0x6c);
143
144	if (wait_on_ibf(0x6c, 0)) {
145		printk(KERN_ERR "olpc-ec:  timeout waiting for EC to read "
146				"command!\n");
147		goto err;
148	}
149
150	if (inbuf && inlen) {
151		/* write data to EC */
152		for (i = 0; i < inlen; i++) {
153			pr_devel("olpc-ec:  sending cmd arg 0x%x\n", inbuf[i]);
154			outb(inbuf[i], 0x68);
155			if (wait_on_ibf(0x6c, 0)) {
156				printk(KERN_ERR "olpc-ec:  timeout waiting for"
157						" EC accept data!\n");
158				goto err;
159			}
160		}
161	}
162	if (outbuf && outlen) {
163		/* read data from EC */
164		for (i = 0; i < outlen; i++) {
165			if (wait_on_obf(0x6c, 1)) {
166				printk(KERN_ERR "olpc-ec:  timeout waiting for"
167						" EC to provide data!\n");
168				if (restarts++ < 10)
169					goto restart;
170				goto err;
171			}
172			outbuf[i] = inb(0x68);
173			pr_devel("olpc-ec:  received 0x%x\n", outbuf[i]);
174		}
175	}
176
177	ret = 0;
178err:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179	return ret;
180}
 
 
 
 
 
 
181
182static bool __init check_ofw_architecture(struct device_node *root)
183{
184	const char *olpc_arch;
185	int propsize;
186
187	olpc_arch = of_get_property(root, "architecture", &propsize);
188	return propsize == 5 && strncmp("OLPC", olpc_arch, 5) == 0;
189}
190
191static u32 __init get_board_revision(struct device_node *root)
192{
193	int propsize;
194	const __be32 *rev;
195
196	rev = of_get_property(root, "board-revision-int", &propsize);
197	if (propsize != 4)
198		return 0;
199
200	return be32_to_cpu(*rev);
201}
202
203static bool __init platform_detect(void)
204{
205	struct device_node *root = of_find_node_by_path("/");
206	bool success;
207
208	if (!root)
209		return false;
210
211	success = check_ofw_architecture(root);
212	if (success) {
213		olpc_platform_info.boardrev = get_board_revision(root);
214		olpc_platform_info.flags |= OLPC_F_PRESENT;
215
216		pr_info("OLPC board revision %s%X\n",
217			((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "",
218			olpc_platform_info.boardrev >> 4);
219	}
220
221	of_node_put(root);
222	return success;
223}
224
225static int __init add_xo1_platform_devices(void)
226{
227	struct platform_device *pdev;
228
229	pdev = platform_device_register_simple("xo1-rfkill", -1, NULL, 0);
230	if (IS_ERR(pdev))
231		return PTR_ERR(pdev);
232
233	pdev = platform_device_register_simple("olpc-xo1", -1, NULL, 0);
234
235	return PTR_ERR_OR_ZERO(pdev);
236}
237
238static int olpc_xo1_ec_suspend(struct platform_device *pdev)
239{
240	/*
241	 * Squelch SCIs while suspended.  This is a fix for
242	 * <http://dev.laptop.org/ticket/1835>.
243	 */
244	return olpc_ec_cmd(EC_SET_SCI_INHIBIT, NULL, 0, NULL, 0);
245}
246
247static int olpc_xo1_ec_resume(struct platform_device *pdev)
248{
249	/* Tell the EC to stop inhibiting SCIs */
250	olpc_ec_cmd(EC_SET_SCI_INHIBIT_RELEASE, NULL, 0, NULL, 0);
251
252	/*
253	 * Tell the wireless module to restart USB communication.
254	 * Must be done twice.
255	 */
256	olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0);
257	olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0);
258
259	return 0;
260}
261
262static struct olpc_ec_driver ec_xo1_driver = {
263	.suspend = olpc_xo1_ec_suspend,
264	.resume = olpc_xo1_ec_resume,
265	.ec_cmd = olpc_xo1_ec_cmd,
266#ifdef CONFIG_OLPC_XO1_SCI
267	/*
268	 * XO-1 EC wakeups are available when olpc-xo1-sci driver is
269	 * compiled in
270	 */
271	.wakeup_available = true,
272#endif
273};
274
275static struct olpc_ec_driver ec_xo1_5_driver = {
276	.ec_cmd = olpc_xo1_ec_cmd,
277#ifdef CONFIG_OLPC_XO15_SCI
278	/*
279	 * XO-1.5 EC wakeups are available when olpc-xo15-sci driver is
280	 * compiled in
281	 */
282	.wakeup_available = true,
283#endif
284};
285
286static int __init olpc_init(void)
287{
288	int r = 0;
289
290	if (!olpc_ofw_present() || !platform_detect())
291		return 0;
292
293	/* register the XO-1 and 1.5-specific EC handler */
294	if (olpc_platform_info.boardrev < olpc_board_pre(0xd0))	/* XO-1 */
295		olpc_ec_driver_register(&ec_xo1_driver, NULL);
296	else
297		olpc_ec_driver_register(&ec_xo1_5_driver, NULL);
298	platform_device_register_simple("olpc-ec", -1, NULL, 0);
299
300	/* assume B1 and above models always have a DCON */
301	if (olpc_board_at_least(olpc_board(0xb1)))
302		olpc_platform_info.flags |= OLPC_F_DCON;
303
 
 
 
 
304#ifdef CONFIG_PCI_OLPC
305	/* If the VSA exists let it emulate PCI, if not emulate in kernel.
306	 * XO-1 only. */
307	if (olpc_platform_info.boardrev < olpc_board_pre(0xd0) &&
308			!cs5535_has_vsa2())
309		x86_init.pci.arch_init = pci_olpc_init;
310#endif
 
 
 
 
 
 
 
 
311
312	if (olpc_platform_info.boardrev < olpc_board_pre(0xd0)) { /* XO-1 */
313		r = add_xo1_platform_devices();
314		if (r)
315			return r;
316	}
 
 
317
318	return 0;
319}
320
321postcore_initcall(olpc_init);
v3.1
 
  1/*
  2 * Support for the OLPC DCON and OLPC EC access
  3 *
  4 * Copyright © 2006  Advanced Micro Devices, Inc.
  5 * Copyright © 2007-2008  Andres Salomon <dilinger@debian.org>
  6 *
  7 * This program is free software; you can redistribute it and/or modify
  8 * it under the terms of the GNU General Public License as published by
  9 * the Free Software Foundation; either version 2 of the License, or
 10 * (at your option) any later version.
 11 */
 12
 13#include <linux/kernel.h>
 14#include <linux/init.h>
 15#include <linux/module.h>
 16#include <linux/delay.h>
 17#include <linux/spinlock.h>
 18#include <linux/io.h>
 19#include <linux/string.h>
 20#include <linux/platform_device.h>
 21#include <linux/of.h>
 22#include <linux/syscore_ops.h>
 
 
 23
 24#include <asm/geode.h>
 25#include <asm/setup.h>
 26#include <asm/olpc.h>
 27#include <asm/olpc_ofw.h>
 28
 29struct olpc_platform_t olpc_platform_info;
 30EXPORT_SYMBOL_GPL(olpc_platform_info);
 31
 32static DEFINE_SPINLOCK(ec_lock);
 33
 34/* EC event mask to be applied during suspend (defining wakeup sources). */
 35static u16 ec_wakeup_mask;
 36
 37/* what the timeout *should* be (in ms) */
 38#define EC_BASE_TIMEOUT 20
 39
 40/* the timeout that bugs in the EC might force us to actually use */
 41static int ec_timeout = EC_BASE_TIMEOUT;
 42
 43static int __init olpc_ec_timeout_set(char *str)
 44{
 45	if (get_option(&str, &ec_timeout) != 1) {
 46		ec_timeout = EC_BASE_TIMEOUT;
 47		printk(KERN_ERR "olpc-ec:  invalid argument to "
 48				"'olpc_ec_timeout=', ignoring!\n");
 49	}
 50	printk(KERN_DEBUG "olpc-ec:  using %d ms delay for EC commands.\n",
 51			ec_timeout);
 52	return 1;
 53}
 54__setup("olpc_ec_timeout=", olpc_ec_timeout_set);
 55
 56/*
 57 * These {i,o}bf_status functions return whether the buffers are full or not.
 58 */
 59
 60static inline unsigned int ibf_status(unsigned int port)
 61{
 62	return !!(inb(port) & 0x02);
 63}
 64
 65static inline unsigned int obf_status(unsigned int port)
 66{
 67	return inb(port) & 0x01;
 68}
 69
 70#define wait_on_ibf(p, d) __wait_on_ibf(__LINE__, (p), (d))
 71static int __wait_on_ibf(unsigned int line, unsigned int port, int desired)
 72{
 73	unsigned int timeo;
 74	int state = ibf_status(port);
 75
 76	for (timeo = ec_timeout; state != desired && timeo; timeo--) {
 77		mdelay(1);
 78		state = ibf_status(port);
 79	}
 80
 81	if ((state == desired) && (ec_timeout > EC_BASE_TIMEOUT) &&
 82			timeo < (ec_timeout - EC_BASE_TIMEOUT)) {
 83		printk(KERN_WARNING "olpc-ec:  %d: waited %u ms for IBF!\n",
 84				line, ec_timeout - timeo);
 85	}
 86
 87	return !(state == desired);
 88}
 89
 90#define wait_on_obf(p, d) __wait_on_obf(__LINE__, (p), (d))
 91static int __wait_on_obf(unsigned int line, unsigned int port, int desired)
 92{
 93	unsigned int timeo;
 94	int state = obf_status(port);
 95
 96	for (timeo = ec_timeout; state != desired && timeo; timeo--) {
 97		mdelay(1);
 98		state = obf_status(port);
 99	}
100
101	if ((state == desired) && (ec_timeout > EC_BASE_TIMEOUT) &&
102			timeo < (ec_timeout - EC_BASE_TIMEOUT)) {
103		printk(KERN_WARNING "olpc-ec:  %d: waited %u ms for OBF!\n",
104				line, ec_timeout - timeo);
105	}
106
107	return !(state == desired);
108}
109
110/*
111 * This allows the kernel to run Embedded Controller commands.  The EC is
112 * documented at <http://wiki.laptop.org/go/Embedded_controller>, and the
113 * available EC commands are here:
114 * <http://wiki.laptop.org/go/Ec_specification>.  Unfortunately, while
115 * OpenFirmware's source is available, the EC's is not.
116 */
117int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
118		unsigned char *outbuf,  size_t outlen)
119{
120	unsigned long flags;
121	int ret = -EIO;
122	int i;
123	int restarts = 0;
124
125	spin_lock_irqsave(&ec_lock, flags);
126
127	/* Clear OBF */
128	for (i = 0; i < 10 && (obf_status(0x6c) == 1); i++)
129		inb(0x68);
130	if (i == 10) {
131		printk(KERN_ERR "olpc-ec:  timeout while attempting to "
132				"clear OBF flag!\n");
133		goto err;
134	}
135
136	if (wait_on_ibf(0x6c, 0)) {
137		printk(KERN_ERR "olpc-ec:  timeout waiting for EC to "
138				"quiesce!\n");
139		goto err;
140	}
141
142restart:
143	/*
144	 * Note that if we time out during any IBF checks, that's a failure;
145	 * we have to return.  There's no way for the kernel to clear that.
146	 *
147	 * If we time out during an OBF check, we can restart the command;
148	 * reissuing it will clear the OBF flag, and we should be alright.
149	 * The OBF flag will sometimes misbehave due to what we believe
150	 * is a hardware quirk..
151	 */
152	pr_devel("olpc-ec:  running cmd 0x%x\n", cmd);
153	outb(cmd, 0x6c);
154
155	if (wait_on_ibf(0x6c, 0)) {
156		printk(KERN_ERR "olpc-ec:  timeout waiting for EC to read "
157				"command!\n");
158		goto err;
159	}
160
161	if (inbuf && inlen) {
162		/* write data to EC */
163		for (i = 0; i < inlen; i++) {
164			pr_devel("olpc-ec:  sending cmd arg 0x%x\n", inbuf[i]);
165			outb(inbuf[i], 0x68);
166			if (wait_on_ibf(0x6c, 0)) {
167				printk(KERN_ERR "olpc-ec:  timeout waiting for"
168						" EC accept data!\n");
169				goto err;
170			}
171		}
172	}
173	if (outbuf && outlen) {
174		/* read data from EC */
175		for (i = 0; i < outlen; i++) {
176			if (wait_on_obf(0x6c, 1)) {
177				printk(KERN_ERR "olpc-ec:  timeout waiting for"
178						" EC to provide data!\n");
179				if (restarts++ < 10)
180					goto restart;
181				goto err;
182			}
183			outbuf[i] = inb(0x68);
184			pr_devel("olpc-ec:  received 0x%x\n", outbuf[i]);
185		}
186	}
187
188	ret = 0;
189err:
190	spin_unlock_irqrestore(&ec_lock, flags);
191	return ret;
192}
193EXPORT_SYMBOL_GPL(olpc_ec_cmd);
194
195void olpc_ec_wakeup_set(u16 value)
196{
197	ec_wakeup_mask |= value;
198}
199EXPORT_SYMBOL_GPL(olpc_ec_wakeup_set);
200
201void olpc_ec_wakeup_clear(u16 value)
202{
203	ec_wakeup_mask &= ~value;
204}
205EXPORT_SYMBOL_GPL(olpc_ec_wakeup_clear);
206
207/*
208 * Returns true if the compile and runtime configurations allow for EC events
209 * to wake the system.
210 */
211bool olpc_ec_wakeup_available(void)
212{
213	if (!machine_is_olpc())
214		return false;
215
216	/*
217	 * XO-1 EC wakeups are available when olpc-xo1-sci driver is
218	 * compiled in
219	 */
220#ifdef CONFIG_OLPC_XO1_SCI
221	if (olpc_platform_info.boardrev < olpc_board_pre(0xd0)) /* XO-1 */
222		return true;
223#endif
224
225	/*
226	 * XO-1.5 EC wakeups are available when olpc-xo15-sci driver is
227	 * compiled in
228	 */
229#ifdef CONFIG_OLPC_XO15_SCI
230	if (olpc_platform_info.boardrev >= olpc_board_pre(0xd0)) /* XO-1.5 */
231		return true;
232#endif
233
234	return false;
235}
236EXPORT_SYMBOL_GPL(olpc_ec_wakeup_available);
237
238int olpc_ec_mask_write(u16 bits)
239{
240	if (olpc_platform_info.flags & OLPC_F_EC_WIDE_SCI) {
241		__be16 ec_word = cpu_to_be16(bits);
242		return olpc_ec_cmd(EC_WRITE_EXT_SCI_MASK, (void *) &ec_word, 2,
243				   NULL, 0);
244	} else {
245		unsigned char ec_byte = bits & 0xff;
246		return olpc_ec_cmd(EC_WRITE_SCI_MASK, &ec_byte, 1, NULL, 0);
247	}
248}
249EXPORT_SYMBOL_GPL(olpc_ec_mask_write);
250
251int olpc_ec_sci_query(u16 *sci_value)
252{
253	int ret;
254
255	if (olpc_platform_info.flags & OLPC_F_EC_WIDE_SCI) {
256		__be16 ec_word;
257		ret = olpc_ec_cmd(EC_EXT_SCI_QUERY,
258			NULL, 0, (void *) &ec_word, 2);
259		if (ret == 0)
260			*sci_value = be16_to_cpu(ec_word);
261	} else {
262		unsigned char ec_byte;
263		ret = olpc_ec_cmd(EC_SCI_QUERY, NULL, 0, &ec_byte, 1);
264		if (ret == 0)
265			*sci_value = ec_byte;
266	}
267
268	return ret;
269}
270EXPORT_SYMBOL_GPL(olpc_ec_sci_query);
271
272static int olpc_ec_suspend(void)
273{
274	return olpc_ec_mask_write(ec_wakeup_mask);
275}
276
277static bool __init check_ofw_architecture(struct device_node *root)
278{
279	const char *olpc_arch;
280	int propsize;
281
282	olpc_arch = of_get_property(root, "architecture", &propsize);
283	return propsize == 5 && strncmp("OLPC", olpc_arch, 5) == 0;
284}
285
286static u32 __init get_board_revision(struct device_node *root)
287{
288	int propsize;
289	const __be32 *rev;
290
291	rev = of_get_property(root, "board-revision-int", &propsize);
292	if (propsize != 4)
293		return 0;
294
295	return be32_to_cpu(*rev);
296}
297
298static bool __init platform_detect(void)
299{
300	struct device_node *root = of_find_node_by_path("/");
301	bool success;
302
303	if (!root)
304		return false;
305
306	success = check_ofw_architecture(root);
307	if (success) {
308		olpc_platform_info.boardrev = get_board_revision(root);
309		olpc_platform_info.flags |= OLPC_F_PRESENT;
 
 
 
 
310	}
311
312	of_node_put(root);
313	return success;
314}
315
316static int __init add_xo1_platform_devices(void)
317{
318	struct platform_device *pdev;
319
320	pdev = platform_device_register_simple("xo1-rfkill", -1, NULL, 0);
321	if (IS_ERR(pdev))
322		return PTR_ERR(pdev);
323
324	pdev = platform_device_register_simple("olpc-xo1", -1, NULL, 0);
325	if (IS_ERR(pdev))
326		return PTR_ERR(pdev);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
328	return 0;
329}
330
331static struct syscore_ops olpc_syscore_ops = {
332	.suspend = olpc_ec_suspend,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333};
334
335static int __init olpc_init(void)
336{
337	int r = 0;
338
339	if (!olpc_ofw_present() || !platform_detect())
340		return 0;
341
342	spin_lock_init(&ec_lock);
 
 
 
 
 
343
344	/* assume B1 and above models always have a DCON */
345	if (olpc_board_at_least(olpc_board(0xb1)))
346		olpc_platform_info.flags |= OLPC_F_DCON;
347
348	/* get the EC revision */
349	olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0,
350			(unsigned char *) &olpc_platform_info.ecver, 1);
351
352#ifdef CONFIG_PCI_OLPC
353	/* If the VSA exists let it emulate PCI, if not emulate in kernel.
354	 * XO-1 only. */
355	if (olpc_platform_info.boardrev < olpc_board_pre(0xd0) &&
356			!cs5535_has_vsa2())
357		x86_init.pci.arch_init = pci_olpc_init;
358#endif
359	/* EC version 0x5f adds support for wide SCI mask */
360	if (olpc_platform_info.ecver >= 0x5f)
361		olpc_platform_info.flags |= OLPC_F_EC_WIDE_SCI;
362
363	printk(KERN_INFO "OLPC board revision %s%X (EC=%x)\n",
364			((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "",
365			olpc_platform_info.boardrev >> 4,
366			olpc_platform_info.ecver);
367
368	if (olpc_platform_info.boardrev < olpc_board_pre(0xd0)) { /* XO-1 */
369		r = add_xo1_platform_devices();
370		if (r)
371			return r;
372	}
373
374	register_syscore_ops(&olpc_syscore_ops);
375
376	return 0;
377}
378
379postcore_initcall(olpc_init);