1 /* 2 * (C) Copyright 2000 3 * Rob Taylor, Flying Pig Systems. robt@flyingpig.com. 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #include <config.h> 9 10 #include <ns87308.h> 11 12 void initialise_ns87308 (void) 13 { 14 #ifdef CONFIG_SYS_NS87308_PS2MOD 15 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 25 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_KBC1) 26 PNP_SET_DEVICE_BASE(LDEV_KBC1, CONFIG_SYS_NS87308_KBC1_BASE); 27 write_pnp_config(LUN_CONFIG_REG, 0); 28 write_pnp_config(CBASE_HIGH, 0x00); 29 write_pnp_config(CBASE_LOW, 0x64); 30 #endif 31 32 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_MOUSE) 33 PNP_ACTIVATE_DEVICE(LDEV_MOUSE); 34 #endif 35 36 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RTC_APC) 37 PNP_SET_DEVICE_BASE(LDEV_RTC_APC, CONFIG_SYS_NS87308_RTC_BASE); 38 #endif 39 40 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_FDC) 41 PNP_SET_DEVICE_BASE(LDEV_FDC, CONFIG_SYS_NS87308_FDC_BASE); 42 write_pnp_config(LUN_CONFIG_REG, 0x40); 43 #endif 44 45 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RARP) 46 PNP_SET_DEVICE_BASE(LDEV_PARP, CONFIG_SYS_NS87308_LPT_BASE); 47 #endif 48 49 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART1) 50 PNP_SET_DEVICE_BASE(LDEV_UART1, CONFIG_SYS_NS87308_UART1_BASE); 51 #endif 52 53 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART2) 54 PNP_SET_DEVICE_BASE(LDEV_UART2, CONFIG_SYS_NS87308_UART2_BASE); 55 #endif 56 57 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_GPIO) 58 PNP_SET_DEVICE_BASE(LDEV_GPIO, CONFIG_SYS_NS87308_GPIO_BASE); 59 #endif 60 61 #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_POWRMAN) 62 #ifndef CONFIG_SYS_NS87308_PWMAN_BASE 63 PNP_ACTIVATE_DEVICE(LDEV_POWRMAN); 64 #else 65 PNP_SET_DEVICE_BASE(LDEV_POWRMAN, CONFIG_SYS_NS87308_PWMAN_BASE); 66 67 /* 68 * Enable all units 69 */ 70 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER1, 0x7d); 71 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER2, 0x87); 72 73 #ifdef CONFIG_SYS_NS87308_PMC1 74 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC1, CONFIG_SYS_NS87308_PMC1); 75 #endif 76 77 #ifdef CONFIG_SYS_NS87308_PMC2 78 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC2, CONFIG_SYS_NS87308_PMC2); 79 #endif 80 81 #ifdef CONFIG_SYS_NS87308_PMC3 82 write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC3, CONFIG_SYS_NS87308_PMC3); 83 #endif 84 #endif 85 #endif 86 87 #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); 90 #endif 91 92 #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); 95 #endif 96 97 #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); 100 #endif 101 } 102