1 /*
2  * Copyright (C) 2009  Cisco Systems, Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 
19 #ifndef _ASM_MACH_POWERTV_ASIC_H
20 #define _ASM_MACH_POWERTV_ASIC_H
21 
22 #include <linux/ioport.h>
23 #include <linux/platform_device.h>
24 #include <asm/mach-powertv/asic_regs.h>
25 
26 #define DVR_CAPABLE     (1<<0)
27 #define PCIE_CAPABLE    (1<<1)
28 #define FFS_CAPABLE     (1<<2)
29 #define DISPLAY_CAPABLE (1<<3)
30 
31 /* Platform Family types
32  * For compitability, the new value must be added in the end */
33 enum family_type {
34 	FAMILY_8500,
35 	FAMILY_8500RNG,
36 	FAMILY_4500,
37 	FAMILY_1500,
38 	FAMILY_8600,
39 	FAMILY_4600,
40 	FAMILY_4600VZA,
41 	FAMILY_8600VZB,
42 	FAMILY_1500VZE,
43 	FAMILY_1500VZF,
44 	FAMILY_8700,
45 	FAMILIES
46 };
47 
48 /* Register maps for each ASIC */
49 extern const struct register_map calliope_register_map;
50 extern const struct register_map cronus_register_map;
51 extern const struct register_map gaia_register_map;
52 extern const struct register_map zeus_register_map;
53 
54 extern struct resource dvr_cronus_resources[];
55 extern struct resource dvr_gaia_resources[];
56 extern struct resource dvr_zeus_resources[];
57 extern struct resource non_dvr_calliope_resources[];
58 extern struct resource non_dvr_cronus_resources[];
59 extern struct resource non_dvr_cronuslite_resources[];
60 extern struct resource non_dvr_gaia_resources[];
61 extern struct resource non_dvr_vz_calliope_resources[];
62 extern struct resource non_dvr_vze_calliope_resources[];
63 extern struct resource non_dvr_vzf_calliope_resources[];
64 extern struct resource non_dvr_zeus_resources[];
65 
66 extern void powertv_platform_init(void);
67 extern void platform_alloc_bootmem(void);
68 extern enum asic_type platform_get_asic(void);
69 extern enum family_type platform_get_family(void);
70 extern int platform_supports_dvr(void);
71 extern int platform_supports_ffs(void);
72 extern int platform_supports_pcie(void);
73 extern int platform_supports_display(void);
74 extern void configure_platform(void);
75 
76 /* Platform Resources */
77 #define ASIC_RESOURCE_GET_EXISTS 1
78 extern struct resource *asic_resource_get(const char *name);
79 extern void platform_release_memory(void *baddr, int size);
80 
81 /* USB configuration */
82 struct usb_hcd;			/* Forward reference */
83 extern void platform_configure_usb_ehci(void);
84 extern void platform_unconfigure_usb_ehci(void);
85 extern void platform_configure_usb_ohci(void);
86 extern void platform_unconfigure_usb_ohci(void);
87 
88 /* Resource for ASIC registers */
89 extern struct resource asic_resource;
90 extern int platform_usb_devices_init(struct platform_device **echi_dev,
91 	struct platform_device **ohci_dev);
92 
93 /* Reboot Cause */
94 extern void set_reboot_cause(char code, unsigned int data, unsigned int data2);
95 extern void set_locked_reboot_cause(char code, unsigned int data,
96 	unsigned int data2);
97 
98 enum sys_reboot_type {
99 	sys_unknown_reboot = 0x00,	/* Unknown reboot cause */
100 	sys_davic_change = 0x01,	/* Reboot due to change in DAVIC
101 					 * mode */
102 	sys_user_reboot = 0x02,		/* Reboot initiated by user */
103 	sys_system_reboot = 0x03,	/* Reboot initiated by OS */
104 	sys_trap_reboot = 0x04,		/* Reboot due to a CPU trap */
105 	sys_silent_reboot = 0x05,	/* Silent reboot */
106 	sys_boot_ldr_reboot = 0x06,	/* Bootloader reboot */
107 	sys_power_up_reboot = 0x07,	/* Power on bootup.  Older
108 					 * drivers may report as
109 					 * userReboot. */
110 	sys_code_change = 0x08,		/* Reboot to take code change.
111 					 * Older drivers may report as
112 					 * userReboot. */
113 	sys_hardware_reset = 0x09,	/* HW watchdog or front-panel
114 					 * reset button reset.  Older
115 					 * drivers may report as
116 					 * userReboot. */
117 	sys_watchdogInterrupt = 0x0A	/* Pre-watchdog interrupt */
118 };
119 
120 #endif /* _ASM_MACH_POWERTV_ASIC_H */
121