spi: kirkwood: add orion-spi compatible string
[oweals/u-boot.git] / drivers / misc / ns87308.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2000
4  * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
5  */
6
7 #include <config.h>
8
9 #include <ns87308.h>
10
11 void initialise_ns87308 (void)
12 {
13 #ifdef CONFIG_SYS_NS87308_PS2MOD
14         unsigned char data;
15
16         /*
17          * Switch floppy drive to PS/2 mode.
18          */
19         read_pnp_config(SUPOERIO_CONF1, &data);
20         data &= 0xFB;
21         write_pnp_config(SUPOERIO_CONF1, data);
22 #endif
23
24 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_KBC1)
25         PNP_SET_DEVICE_BASE(LDEV_KBC1, CONFIG_SYS_NS87308_KBC1_BASE);
26         write_pnp_config(LUN_CONFIG_REG, 0);
27         write_pnp_config(CBASE_HIGH, 0x00);
28         write_pnp_config(CBASE_LOW, 0x64);
29 #endif
30
31 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_MOUSE)
32         PNP_ACTIVATE_DEVICE(LDEV_MOUSE);
33 #endif
34
35 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RTC_APC)
36         PNP_SET_DEVICE_BASE(LDEV_RTC_APC, CONFIG_SYS_NS87308_RTC_BASE);
37 #endif
38
39 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_FDC)
40         PNP_SET_DEVICE_BASE(LDEV_FDC, CONFIG_SYS_NS87308_FDC_BASE);
41         write_pnp_config(LUN_CONFIG_REG, 0x40);
42 #endif
43
44 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RARP)
45         PNP_SET_DEVICE_BASE(LDEV_PARP, CONFIG_SYS_NS87308_LPT_BASE);
46 #endif
47
48 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART1)
49         PNP_SET_DEVICE_BASE(LDEV_UART1, CONFIG_SYS_NS87308_UART1_BASE);
50 #endif
51
52 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART2)
53         PNP_SET_DEVICE_BASE(LDEV_UART2, CONFIG_SYS_NS87308_UART2_BASE);
54 #endif
55
56 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_GPIO)
57         PNP_SET_DEVICE_BASE(LDEV_GPIO, CONFIG_SYS_NS87308_GPIO_BASE);
58 #endif
59
60 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_POWRMAN)
61 #ifndef CONFIG_SYS_NS87308_PWMAN_BASE
62         PNP_ACTIVATE_DEVICE(LDEV_POWRMAN);
63 #else
64         PNP_SET_DEVICE_BASE(LDEV_POWRMAN, CONFIG_SYS_NS87308_PWMAN_BASE);
65
66         /*
67          * Enable all units
68          */
69         write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER1, 0x7d);
70         write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER2, 0x87);
71
72 #ifdef CONFIG_SYS_NS87308_PMC1
73         write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC1, CONFIG_SYS_NS87308_PMC1);
74 #endif
75
76 #ifdef CONFIG_SYS_NS87308_PMC2
77         write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC2, CONFIG_SYS_NS87308_PMC2);
78 #endif
79
80 #ifdef CONFIG_SYS_NS87308_PMC3
81         write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC3, CONFIG_SYS_NS87308_PMC3);
82 #endif
83 #endif
84 #endif
85
86 #ifdef CONFIG_SYS_NS87308_CS0_BASE
87         PNP_PGCS_CSLINE_BASE(0, CONFIG_SYS_NS87308_CS0_BASE);
88         PNP_PGCS_CSLINE_CONF(0, CONFIG_SYS_NS87308_CS0_CONF);
89 #endif
90
91 #ifdef CONFIG_SYS_NS87308_CS1_BASE
92         PNP_PGCS_CSLINE_BASE(1, CONFIG_SYS_NS87308_CS1_BASE);
93         PNP_PGCS_CSLINE_CONF(1, CONFIG_SYS_NS87308_CS1_CONF);
94 #endif
95
96 #ifdef CONFIG_SYS_NS87308_CS2_BASE
97         PNP_PGCS_CSLINE_BASE(2, CONFIG_SYS_NS87308_CS2_BASE);
98         PNP_PGCS_CSLINE_CONF(2, CONFIG_SYS_NS87308_CS2_CONF);
99 #endif
100 }