Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2000 |
| 4 | * Rob Taylor, Flying Pig Systems. robt@flyingpig.com. |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <config.h> |
| 8 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 9 | #include <ns87308.h> |
| 10 | |
| 11 | void initialise_ns87308 (void) |
| 12 | { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 13 | #ifdef CONFIG_SYS_NS87308_PS2MOD |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 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 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 24 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_KBC1) |
| 25 | PNP_SET_DEVICE_BASE(LDEV_KBC1, CONFIG_SYS_NS87308_KBC1_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 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 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 31 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_MOUSE) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 32 | PNP_ACTIVATE_DEVICE(LDEV_MOUSE); |
| 33 | #endif |
| 34 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 35 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RTC_APC) |
| 36 | PNP_SET_DEVICE_BASE(LDEV_RTC_APC, CONFIG_SYS_NS87308_RTC_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 37 | #endif |
| 38 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 39 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_FDC) |
| 40 | PNP_SET_DEVICE_BASE(LDEV_FDC, CONFIG_SYS_NS87308_FDC_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 41 | write_pnp_config(LUN_CONFIG_REG, 0x40); |
| 42 | #endif |
| 43 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 44 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RARP) |
| 45 | PNP_SET_DEVICE_BASE(LDEV_PARP, CONFIG_SYS_NS87308_LPT_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 46 | #endif |
| 47 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 48 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART1) |
| 49 | PNP_SET_DEVICE_BASE(LDEV_UART1, CONFIG_SYS_NS87308_UART1_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 50 | #endif |
| 51 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 52 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART2) |
| 53 | PNP_SET_DEVICE_BASE(LDEV_UART2, CONFIG_SYS_NS87308_UART2_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 54 | #endif |
| 55 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 56 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_GPIO) |
| 57 | PNP_SET_DEVICE_BASE(LDEV_GPIO, CONFIG_SYS_NS87308_GPIO_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 58 | #endif |
| 59 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 60 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_POWRMAN) |
| 61 | #ifndef CONFIG_SYS_NS87308_PWMAN_BASE |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 62 | PNP_ACTIVATE_DEVICE(LDEV_POWRMAN); |
| 63 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 64 | PNP_SET_DEVICE_BASE(LDEV_POWRMAN, CONFIG_SYS_NS87308_PWMAN_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 65 | |
| 66 | /* |
| 67 | * Enable all units |
| 68 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 69 | write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER1, 0x7d); |
| 70 | write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER2, 0x87); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 71 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 72 | #ifdef CONFIG_SYS_NS87308_PMC1 |
| 73 | write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC1, CONFIG_SYS_NS87308_PMC1); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 74 | #endif |
| 75 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 76 | #ifdef CONFIG_SYS_NS87308_PMC2 |
| 77 | write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC2, CONFIG_SYS_NS87308_PMC2); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 78 | #endif |
| 79 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 80 | #ifdef CONFIG_SYS_NS87308_PMC3 |
| 81 | write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC3, CONFIG_SYS_NS87308_PMC3); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 82 | #endif |
| 83 | #endif |
| 84 | #endif |
| 85 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 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); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 89 | #endif |
| 90 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 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); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 94 | #endif |
| 95 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 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); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 99 | #endif |
| 100 | } |