blob: f5de3329b78c9cf00ef24d792f3a11cef1ab1ecd [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenkc6097192002-11-03 00:24:07 +00002/*
3 * (C) Copyright 2000
4 * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
wdenkc6097192002-11-03 00:24:07 +00005 */
6
7#include <config.h>
8
wdenkc6097192002-11-03 00:24:07 +00009#include <ns87308.h>
10
11void initialise_ns87308 (void)
12{
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020013#ifdef CONFIG_SYS_NS87308_PS2MOD
wdenkc6097192002-11-03 00:24:07 +000014 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
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020024#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_KBC1)
25 PNP_SET_DEVICE_BASE(LDEV_KBC1, CONFIG_SYS_NS87308_KBC1_BASE);
wdenkc6097192002-11-03 00:24:07 +000026 write_pnp_config(LUN_CONFIG_REG, 0);
27 write_pnp_config(CBASE_HIGH, 0x00);
28 write_pnp_config(CBASE_LOW, 0x64);
29#endif
30
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020031#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_MOUSE)
wdenkc6097192002-11-03 00:24:07 +000032 PNP_ACTIVATE_DEVICE(LDEV_MOUSE);
33#endif
34
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020035#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RTC_APC)
36 PNP_SET_DEVICE_BASE(LDEV_RTC_APC, CONFIG_SYS_NS87308_RTC_BASE);
wdenkc6097192002-11-03 00:24:07 +000037#endif
38
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020039#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_FDC)
40 PNP_SET_DEVICE_BASE(LDEV_FDC, CONFIG_SYS_NS87308_FDC_BASE);
wdenkc6097192002-11-03 00:24:07 +000041 write_pnp_config(LUN_CONFIG_REG, 0x40);
42#endif
43
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020044#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RARP)
45 PNP_SET_DEVICE_BASE(LDEV_PARP, CONFIG_SYS_NS87308_LPT_BASE);
wdenkc6097192002-11-03 00:24:07 +000046#endif
47
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020048#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART1)
49 PNP_SET_DEVICE_BASE(LDEV_UART1, CONFIG_SYS_NS87308_UART1_BASE);
wdenkc6097192002-11-03 00:24:07 +000050#endif
51
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020052#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART2)
53 PNP_SET_DEVICE_BASE(LDEV_UART2, CONFIG_SYS_NS87308_UART2_BASE);
wdenkc6097192002-11-03 00:24:07 +000054#endif
55
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020056#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_GPIO)
57 PNP_SET_DEVICE_BASE(LDEV_GPIO, CONFIG_SYS_NS87308_GPIO_BASE);
wdenkc6097192002-11-03 00:24:07 +000058#endif
59
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020060#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_POWRMAN)
61#ifndef CONFIG_SYS_NS87308_PWMAN_BASE
wdenkc6097192002-11-03 00:24:07 +000062 PNP_ACTIVATE_DEVICE(LDEV_POWRMAN);
63#else
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020064 PNP_SET_DEVICE_BASE(LDEV_POWRMAN, CONFIG_SYS_NS87308_PWMAN_BASE);
wdenkc6097192002-11-03 00:24:07 +000065
66 /*
67 * Enable all units
68 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020069 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER1, 0x7d);
70 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER2, 0x87);
wdenkc6097192002-11-03 00:24:07 +000071
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020072#ifdef CONFIG_SYS_NS87308_PMC1
73 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC1, CONFIG_SYS_NS87308_PMC1);
wdenkc6097192002-11-03 00:24:07 +000074#endif
75
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020076#ifdef CONFIG_SYS_NS87308_PMC2
77 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC2, CONFIG_SYS_NS87308_PMC2);
wdenkc6097192002-11-03 00:24:07 +000078#endif
79
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020080#ifdef CONFIG_SYS_NS87308_PMC3
81 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC3, CONFIG_SYS_NS87308_PMC3);
wdenkc6097192002-11-03 00:24:07 +000082#endif
83#endif
84#endif
85
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020086#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);
wdenkc6097192002-11-03 00:24:07 +000089#endif
90
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020091#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);
wdenkc6097192002-11-03 00:24:07 +000094#endif
95
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020096#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);
wdenkc6097192002-11-03 00:24:07 +000099#endif
100}