wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000 |
| 3 | * Rob Taylor, Flying Pig Systems. robt@flyingpig.com. |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #include <config.h> |
| 25 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 26 | #include <ns87308.h> |
| 27 | |
| 28 | void initialise_ns87308 (void) |
| 29 | { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 30 | #ifdef CONFIG_SYS_NS87308_PS2MOD |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 31 | unsigned char data; |
| 32 | |
| 33 | /* |
| 34 | * Switch floppy drive to PS/2 mode. |
| 35 | */ |
| 36 | read_pnp_config(SUPOERIO_CONF1, &data); |
| 37 | data &= 0xFB; |
| 38 | write_pnp_config(SUPOERIO_CONF1, data); |
| 39 | #endif |
| 40 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 41 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_KBC1) |
| 42 | PNP_SET_DEVICE_BASE(LDEV_KBC1, CONFIG_SYS_NS87308_KBC1_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 43 | write_pnp_config(LUN_CONFIG_REG, 0); |
| 44 | write_pnp_config(CBASE_HIGH, 0x00); |
| 45 | write_pnp_config(CBASE_LOW, 0x64); |
| 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_MOUSE) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 49 | PNP_ACTIVATE_DEVICE(LDEV_MOUSE); |
| 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_RTC_APC) |
| 53 | PNP_SET_DEVICE_BASE(LDEV_RTC_APC, CONFIG_SYS_NS87308_RTC_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_FDC) |
| 57 | PNP_SET_DEVICE_BASE(LDEV_FDC, CONFIG_SYS_NS87308_FDC_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 58 | write_pnp_config(LUN_CONFIG_REG, 0x40); |
| 59 | #endif |
| 60 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 61 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RARP) |
| 62 | PNP_SET_DEVICE_BASE(LDEV_PARP, CONFIG_SYS_NS87308_LPT_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 63 | #endif |
| 64 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 65 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART1) |
| 66 | PNP_SET_DEVICE_BASE(LDEV_UART1, CONFIG_SYS_NS87308_UART1_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 67 | #endif |
| 68 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 69 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART2) |
| 70 | PNP_SET_DEVICE_BASE(LDEV_UART2, CONFIG_SYS_NS87308_UART2_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 71 | #endif |
| 72 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 73 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_GPIO) |
| 74 | PNP_SET_DEVICE_BASE(LDEV_GPIO, CONFIG_SYS_NS87308_GPIO_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 75 | #endif |
| 76 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 77 | #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_POWRMAN) |
| 78 | #ifndef CONFIG_SYS_NS87308_PWMAN_BASE |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 79 | PNP_ACTIVATE_DEVICE(LDEV_POWRMAN); |
| 80 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 81 | PNP_SET_DEVICE_BASE(LDEV_POWRMAN, CONFIG_SYS_NS87308_PWMAN_BASE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 82 | |
| 83 | /* |
| 84 | * Enable all units |
| 85 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 86 | write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER1, 0x7d); |
| 87 | write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER2, 0x87); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 88 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 89 | #ifdef CONFIG_SYS_NS87308_PMC1 |
| 90 | 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] | 91 | #endif |
| 92 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 93 | #ifdef CONFIG_SYS_NS87308_PMC2 |
| 94 | 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] | 95 | #endif |
| 96 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 97 | #ifdef CONFIG_SYS_NS87308_PMC3 |
| 98 | 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] | 99 | #endif |
| 100 | #endif |
| 101 | #endif |
| 102 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 103 | #ifdef CONFIG_SYS_NS87308_CS0_BASE |
| 104 | PNP_PGCS_CSLINE_BASE(0, CONFIG_SYS_NS87308_CS0_BASE); |
| 105 | PNP_PGCS_CSLINE_CONF(0, CONFIG_SYS_NS87308_CS0_CONF); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 106 | #endif |
| 107 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 108 | #ifdef CONFIG_SYS_NS87308_CS1_BASE |
| 109 | PNP_PGCS_CSLINE_BASE(1, CONFIG_SYS_NS87308_CS1_BASE); |
| 110 | PNP_PGCS_CSLINE_CONF(1, CONFIG_SYS_NS87308_CS1_CONF); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 111 | #endif |
| 112 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 113 | #ifdef CONFIG_SYS_NS87308_CS2_BASE |
| 114 | PNP_PGCS_CSLINE_BASE(2, CONFIG_SYS_NS87308_CS2_BASE); |
| 115 | PNP_PGCS_CSLINE_CONF(2, CONFIG_SYS_NS87308_CS2_CONF); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 116 | #endif |
| 117 | } |