1 /*
2  * Sam440ep board specific routines based off bamboo.c code
3  * original copyrights below
4  *
5  * Wade Farnsworth <wfarnsworth@mvista.com>
6  * Copyright 2004 MontaVista Software Inc.
7  *
8  * Rewritten and ported to the merged powerpc tree:
9  * Josh Boyer <jwboyer@linux.vnet.ibm.com>
10  * Copyright 2007 IBM Corporation
11  *
12  * Modified from bamboo.c for sam440ep:
13  * Copyright 2008 Giuseppe Coviello <gicoviello@gmail.com>
14  *
15  * This program is free software; you can redistribute  it and/or modify it
16  * under  the terms of  the GNU General  Public License as published by the
17  * Free Software Foundation;  either version 2 of the  License, or (at your
18  * option) any later version.
19  */
20 #include <linux/init.h>
21 #include <linux/of_platform.h>
22 
23 #include <asm/machdep.h>
24 #include <asm/prom.h>
25 #include <asm/udbg.h>
26 #include <asm/time.h>
27 #include <asm/uic.h>
28 #include <asm/pci-bridge.h>
29 #include <asm/ppc4xx.h>
30 #include <linux/i2c.h>
31 
32 static const struct of_device_id sam440ep_of_bus[] __initconst = {
33 	{ .compatible = "ibm,plb4", },
34 	{ .compatible = "ibm,opb", },
35 	{ .compatible = "ibm,ebc", },
36 	{},
37 };
38 
39 static int __init sam440ep_device_probe(void)
40 {
41 	of_platform_bus_probe(NULL, sam440ep_of_bus, NULL);
42 
43 	return 0;
44 }
45 machine_device_initcall(sam440ep, sam440ep_device_probe);
46 
47 static int __init sam440ep_probe(void)
48 {
49 	if (!of_machine_is_compatible("acube,sam440ep"))
50 		return 0;
51 
52 	pci_set_flags(PCI_REASSIGN_ALL_RSRC);
53 
54 	return 1;
55 }
56 
57 define_machine(sam440ep) {
58 	.name 			= "Sam440ep",
59 	.probe 			= sam440ep_probe,
60 	.progress 		= udbg_progress,
61 	.init_IRQ 		= uic_init_tree,
62 	.get_irq 		= uic_get_irq,
63 	.restart		= ppc4xx_reset_system,
64 	.calibrate_decr 	= generic_calibrate_decr,
65 };
66 
67 static struct i2c_board_info sam440ep_rtc_info = {
68 	.type = "m41st85",
69 	.addr = 0x68,
70 	.irq = -1,
71 };
72 
73 static int sam440ep_setup_rtc(void)
74 {
75 	return i2c_register_board_info(0, &sam440ep_rtc_info, 1);
76 }
77 machine_device_initcall(sam440ep, sam440ep_setup_rtc);
78