blob: 8a92ccb884b752905098d9db1e472f585e775999 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
2 * (C) Copyright 2000
3 * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenkc6097192002-11-03 00:24:07 +00006 */
7
8#include <config.h>
9
wdenkc6097192002-11-03 00:24:07 +000010#include <ns87308.h>
11
12void initialise_ns87308 (void)
13{
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020014#ifdef CONFIG_SYS_NS87308_PS2MOD
wdenkc6097192002-11-03 00:24:07 +000015 unsigned char data;
16
17 /*
18 * Switch floppy drive to PS/2 mode.
19 */
20 read_pnp_config(SUPOERIO_CONF1, &data);
21 data &= 0xFB;
22 write_pnp_config(SUPOERIO_CONF1, data);
23#endif
24
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020025#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_KBC1)
26 PNP_SET_DEVICE_BASE(LDEV_KBC1, CONFIG_SYS_NS87308_KBC1_BASE);
wdenkc6097192002-11-03 00:24:07 +000027 write_pnp_config(LUN_CONFIG_REG, 0);
28 write_pnp_config(CBASE_HIGH, 0x00);
29 write_pnp_config(CBASE_LOW, 0x64);
30#endif
31
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020032#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_MOUSE)
wdenkc6097192002-11-03 00:24:07 +000033 PNP_ACTIVATE_DEVICE(LDEV_MOUSE);
34#endif
35
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020036#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RTC_APC)
37 PNP_SET_DEVICE_BASE(LDEV_RTC_APC, CONFIG_SYS_NS87308_RTC_BASE);
wdenkc6097192002-11-03 00:24:07 +000038#endif
39
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020040#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_FDC)
41 PNP_SET_DEVICE_BASE(LDEV_FDC, CONFIG_SYS_NS87308_FDC_BASE);
wdenkc6097192002-11-03 00:24:07 +000042 write_pnp_config(LUN_CONFIG_REG, 0x40);
43#endif
44
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020045#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RARP)
46 PNP_SET_DEVICE_BASE(LDEV_PARP, CONFIG_SYS_NS87308_LPT_BASE);
wdenkc6097192002-11-03 00:24:07 +000047#endif
48
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020049#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART1)
50 PNP_SET_DEVICE_BASE(LDEV_UART1, CONFIG_SYS_NS87308_UART1_BASE);
wdenkc6097192002-11-03 00:24:07 +000051#endif
52
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020053#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART2)
54 PNP_SET_DEVICE_BASE(LDEV_UART2, CONFIG_SYS_NS87308_UART2_BASE);
wdenkc6097192002-11-03 00:24:07 +000055#endif
56
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020057#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_GPIO)
58 PNP_SET_DEVICE_BASE(LDEV_GPIO, CONFIG_SYS_NS87308_GPIO_BASE);
wdenkc6097192002-11-03 00:24:07 +000059#endif
60
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020061#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_POWRMAN)
62#ifndef CONFIG_SYS_NS87308_PWMAN_BASE
wdenkc6097192002-11-03 00:24:07 +000063 PNP_ACTIVATE_DEVICE(LDEV_POWRMAN);
64#else
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020065 PNP_SET_DEVICE_BASE(LDEV_POWRMAN, CONFIG_SYS_NS87308_PWMAN_BASE);
wdenkc6097192002-11-03 00:24:07 +000066
67 /*
68 * Enable all units
69 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020070 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER1, 0x7d);
71 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER2, 0x87);
wdenkc6097192002-11-03 00:24:07 +000072
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020073#ifdef CONFIG_SYS_NS87308_PMC1
74 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC1, CONFIG_SYS_NS87308_PMC1);
wdenkc6097192002-11-03 00:24:07 +000075#endif
76
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020077#ifdef CONFIG_SYS_NS87308_PMC2
78 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC2, CONFIG_SYS_NS87308_PMC2);
wdenkc6097192002-11-03 00:24:07 +000079#endif
80
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020081#ifdef CONFIG_SYS_NS87308_PMC3
82 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC3, CONFIG_SYS_NS87308_PMC3);
wdenkc6097192002-11-03 00:24:07 +000083#endif
84#endif
85#endif
86
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020087#ifdef CONFIG_SYS_NS87308_CS0_BASE
88 PNP_PGCS_CSLINE_BASE(0, CONFIG_SYS_NS87308_CS0_BASE);
89 PNP_PGCS_CSLINE_CONF(0, CONFIG_SYS_NS87308_CS0_CONF);
wdenkc6097192002-11-03 00:24:07 +000090#endif
91
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020092#ifdef CONFIG_SYS_NS87308_CS1_BASE
93 PNP_PGCS_CSLINE_BASE(1, CONFIG_SYS_NS87308_CS1_BASE);
94 PNP_PGCS_CSLINE_CONF(1, CONFIG_SYS_NS87308_CS1_CONF);
wdenkc6097192002-11-03 00:24:07 +000095#endif
96
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020097#ifdef CONFIG_SYS_NS87308_CS2_BASE
98 PNP_PGCS_CSLINE_BASE(2, CONFIG_SYS_NS87308_CS2_BASE);
99 PNP_PGCS_CSLINE_CONF(2, CONFIG_SYS_NS87308_CS2_CONF);
wdenkc6097192002-11-03 00:24:07 +0000100#endif
101}