Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 3 | * |
Uwe Hermann | d82baa1 | 2006-12-05 14:13:10 +0000 | [diff] [blame] | 4 | * Copyright (C) 2000 AG Electronics Ltd. |
| 5 | * Copyright (C) 2003-2004 Linux Networx |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 6 | * Copyright (C) 2004 Tyan |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 7 | * Copyright (C) 2005 Digital Design Corporation |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
Uwe Hermann | d82baa1 | 2006-12-05 14:13:10 +0000 | [diff] [blame] | 20 | /* RAM-based driver for SMSC LPC47N217 Super I/O chip. */ |
Uwe Hermann | d82baa1 | 2006-12-05 14:13:10 +0000 | [diff] [blame] | 21 | |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 22 | #include <arch/io.h> |
| 23 | #include <device/device.h> |
| 24 | #include <device/pnp.h> |
| 25 | #include <console/console.h> |
| 26 | #include <device/smbus.h> |
| 27 | #include <string.h> |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 28 | #include <assert.h> |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 29 | #include <stdlib.h> |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 30 | #include "lpc47n217.h" |
| 31 | |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 32 | /* Forward declarations */ |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 33 | static void enable_dev(struct device *dev); |
| 34 | static void lpc47n217_pnp_set_resources(struct device *dev); |
| 35 | static void lpc47n217_pnp_enable_resources(struct device *dev); |
| 36 | static void lpc47n217_pnp_enable(struct device *dev); |
| 37 | static void lpc47n217_init(struct device *dev); |
| 38 | static void lpc47n217_pnp_set_resource(struct device *dev, struct resource *resource); |
| 39 | static void lpc47n217_pnp_set_iobase(struct device *dev, u16 iobase); |
| 40 | static void lpc47n217_pnp_set_drq(struct device *dev, u8 drq); |
| 41 | static void lpc47n217_pnp_set_irq(struct device *dev, u8 irq); |
| 42 | static void lpc47n217_pnp_set_enable(struct device *dev, int enable); |
| 43 | static void pnp_enter_conf_state(struct device *dev); |
| 44 | static void pnp_exit_conf_state(struct device *dev); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 45 | |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 46 | struct chip_operations superio_smsc_lpc47n217_ops = { |
Uwe Hermann | a7aa29b | 2006-11-05 18:50:49 +0000 | [diff] [blame] | 47 | CHIP_NAME("SMSC LPC47N217 Super I/O") |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 48 | .enable_dev = enable_dev, |
| 49 | }; |
| 50 | |
| 51 | static struct device_operations ops = { |
| 52 | .read_resources = pnp_read_resources, |
| 53 | .set_resources = lpc47n217_pnp_set_resources, |
| 54 | .enable_resources = lpc47n217_pnp_enable_resources, |
| 55 | .enable = lpc47n217_pnp_enable, |
| 56 | .init = lpc47n217_init, |
| 57 | }; |
| 58 | |
| 59 | static struct pnp_info pnp_dev_info[] = { |
Samuel Holland | 7daac91 | 2017-06-06 22:55:01 -0500 | [diff] [blame] | 60 | { &ops, LPC47N217_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
| 61 | { &ops, LPC47N217_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 62 | { &ops, LPC47N217_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, } |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
Uwe Hermann | b69cb5a | 2010-10-26 22:46:43 +0000 | [diff] [blame] | 65 | /** |
| 66 | * Create device structures and allocate resources to devices specified in the |
| 67 | * pnp_dev_info array (above). |
| 68 | * |
| 69 | * @param dev Pointer to structure describing a Super I/O device. |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 70 | */ |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 71 | static void enable_dev(struct device *dev) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 72 | { |
Uwe Hermann | b69cb5a | 2010-10-26 22:46:43 +0000 | [diff] [blame] | 73 | pnp_enable_devices(dev, &pnp_ops, ARRAY_SIZE(pnp_dev_info), |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 74 | pnp_dev_info); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 75 | } |
| 76 | |
Uwe Hermann | b69cb5a | 2010-10-26 22:46:43 +0000 | [diff] [blame] | 77 | /** |
| 78 | * Configure the specified Super I/O device with the resources (I/O space, |
| 79 | * etc.) that have been allocate for it. |
| 80 | * |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 81 | * NOTE: Cannot use pnp_set_resources() here because it assumes chip |
| 82 | * support for logical devices, which the LPC47N217 doesn't have. |
| 83 | * |
Uwe Hermann | b69cb5a | 2010-10-26 22:46:43 +0000 | [diff] [blame] | 84 | * @param dev Pointer to structure describing a Super I/O device. |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 85 | */ |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 86 | static void lpc47n217_pnp_set_resources(struct device *dev) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 87 | { |
Myles Watson | c25cc11 | 2010-05-21 14:33:48 +0000 | [diff] [blame] | 88 | struct resource *res; |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 89 | |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 90 | pnp_enter_conf_state(dev); |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 91 | for (res = dev->resource_list; res; res = res->next) |
Myles Watson | c25cc11 | 2010-05-21 14:33:48 +0000 | [diff] [blame] | 92 | lpc47n217_pnp_set_resource(dev, res); |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 93 | /* dump_pnp_device(dev); */ |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 94 | pnp_exit_conf_state(dev); |
| 95 | } |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 96 | |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 97 | /* |
| 98 | * NOTE: Cannot use pnp_enable_resources() here because it assumes chip |
| 99 | * support for logical devices, which the LPC47N217 doesn't have. |
| 100 | */ |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 101 | static void lpc47n217_pnp_enable_resources(struct device *dev) |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 102 | { |
| 103 | pnp_enter_conf_state(dev); |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 104 | lpc47n217_pnp_set_enable(dev, 1); |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 105 | pnp_exit_conf_state(dev); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 106 | } |
| 107 | |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 108 | /* |
| 109 | * NOTE: Cannot use pnp_set_enable() here because it assumes chip |
| 110 | * support for logical devices, which the LPC47N217 doesn't have. |
| 111 | */ |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 112 | static void lpc47n217_pnp_enable(struct device *dev) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 113 | { |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 114 | pnp_enter_conf_state(dev); |
Rudolf Marek | 0c8e664 | 2011-02-19 14:51:31 +0000 | [diff] [blame] | 115 | lpc47n217_pnp_set_enable(dev, !!dev->enabled); |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 116 | pnp_exit_conf_state(dev); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 117 | } |
| 118 | |
Uwe Hermann | b69cb5a | 2010-10-26 22:46:43 +0000 | [diff] [blame] | 119 | /** |
| 120 | * Initialize the specified Super I/O device. |
| 121 | * |
| 122 | * Devices other than COM ports are ignored. For COM ports, we configure the |
| 123 | * baud rate. |
| 124 | * |
| 125 | * @param dev Pointer to structure describing a Super I/O device. |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 126 | */ |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 127 | static void lpc47n217_init(struct device *dev) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 128 | { |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 129 | if (!dev->enabled) |
| 130 | return; |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 131 | } |
| 132 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 133 | static void lpc47n217_pnp_set_resource(struct device *dev, struct resource *resource) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 134 | { |
| 135 | if (!(resource->flags & IORESOURCE_ASSIGNED)) { |
zbao | 9bf356f | 2012-08-03 15:09:09 +0800 | [diff] [blame] | 136 | printk(BIOS_ERR, "ERROR: %s %02lx not allocated\n", |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 137 | dev_path(dev), resource->index); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 138 | return; |
| 139 | } |
| 140 | |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 141 | /* Now store the resource. */ |
| 142 | |
Uwe Hermann | b69cb5a | 2010-10-26 22:46:43 +0000 | [diff] [blame] | 143 | /* |
| 144 | * NOTE: Cannot use pnp_set_XXX() here because they assume chip |
| 145 | * support for logical devices, which the LPC47N217 doesn't have. |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 146 | */ |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 147 | if (resource->flags & IORESOURCE_IO) { |
| 148 | lpc47n217_pnp_set_iobase(dev, resource->base); |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 149 | } else if (resource->flags & IORESOURCE_DRQ) { |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 150 | lpc47n217_pnp_set_drq(dev, resource->base); |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 151 | } else if (resource->flags & IORESOURCE_IRQ) { |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 152 | lpc47n217_pnp_set_irq(dev, resource->base); |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 153 | } else { |
zbao | 9bf356f | 2012-08-03 15:09:09 +0800 | [diff] [blame] | 154 | printk(BIOS_ERR, "ERROR: %s %02lx unknown resource type\n", |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 155 | dev_path(dev), resource->index); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 156 | return; |
| 157 | } |
| 158 | resource->flags |= IORESOURCE_STORED; |
| 159 | |
| 160 | report_resource_stored(dev, resource, ""); |
| 161 | } |
| 162 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 163 | static void lpc47n217_pnp_set_iobase(struct device *dev, u16 iobase) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 164 | { |
| 165 | ASSERT(!(iobase & 0x3)); |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 166 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 167 | switch(dev->path.pnp.device) { |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 168 | case LPC47N217_PP: |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 169 | pnp_write_config(dev, 0x23, (iobase >> 2) & 0xff); |
| 170 | break; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 171 | case LPC47N217_SP1: |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 172 | pnp_write_config(dev, 0x24, (iobase >> 2) & 0xff); |
| 173 | break; |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 174 | case LPC47N217_SP2: |
| 175 | pnp_write_config(dev, 0x25, (iobase >> 2) & 0xff); |
| 176 | break; |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 177 | default: |
| 178 | BUG(); |
| 179 | break; |
| 180 | } |
| 181 | } |
| 182 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 183 | static void lpc47n217_pnp_set_drq(struct device *dev, u8 drq) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 184 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 185 | const u8 PP_DMA_MASK = 0x0F; |
| 186 | const u8 PP_DMA_SELECTION_REGISTER = 0x26; |
| 187 | u8 current_config, new_config; |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 188 | |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 189 | if (dev->path.pnp.device == LPC47N217_PP) { |
| 190 | current_config = pnp_read_config(dev, |
| 191 | PP_DMA_SELECTION_REGISTER); |
| 192 | ASSERT(!(drq & ~PP_DMA_MASK)); /* DRQ out of range? */ |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 193 | new_config = (current_config & ~PP_DMA_MASK) | drq; |
| 194 | pnp_write_config(dev, PP_DMA_SELECTION_REGISTER, new_config); |
| 195 | } else { |
| 196 | BUG(); |
| 197 | } |
| 198 | } |
| 199 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 200 | static void lpc47n217_pnp_set_irq(struct device *dev, u8 irq) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 201 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 202 | u8 irq_config_register = 0, irq_config_mask = 0; |
| 203 | u8 current_config, new_config; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 204 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 205 | switch(dev->path.pnp.device) { |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 206 | case LPC47N217_PP: |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 207 | irq_config_register = 0x27; |
| 208 | irq_config_mask = 0x0F; |
| 209 | break; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 210 | case LPC47N217_SP1: |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 211 | irq_config_register = 0x28; |
| 212 | irq_config_mask = 0xF0; |
| 213 | irq <<= 4; |
| 214 | break; |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 215 | case LPC47N217_SP2: |
| 216 | irq_config_register = 0x28; |
| 217 | irq_config_mask = 0x0F; |
| 218 | break; |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 219 | default: |
| 220 | BUG(); |
| 221 | return; |
| 222 | } |
| 223 | |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 224 | ASSERT(!(irq & ~irq_config_mask)); /* IRQ out of range? */ |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 225 | |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 226 | current_config = pnp_read_config(dev, irq_config_register); |
| 227 | new_config = (current_config & ~irq_config_mask) | irq; |
| 228 | pnp_write_config(dev, irq_config_register, new_config); |
| 229 | } |
| 230 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 231 | static void lpc47n217_pnp_set_enable(struct device *dev, int enable) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 232 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 233 | u8 power_register = 0, power_mask = 0, current_power, new_power; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 234 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 235 | switch(dev->path.pnp.device) { |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 236 | case LPC47N217_PP: |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 237 | power_register = 0x01; |
| 238 | power_mask = 0x04; |
| 239 | break; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 240 | case LPC47N217_SP1: |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 241 | power_register = 0x02; |
| 242 | power_mask = 0x08; |
| 243 | break; |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 244 | case LPC47N217_SP2: |
| 245 | power_register = 0x02; |
| 246 | power_mask = 0x80; |
| 247 | break; |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 248 | default: |
| 249 | BUG(); |
| 250 | return; |
| 251 | } |
| 252 | |
| 253 | current_power = pnp_read_config(dev, power_register); |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 254 | new_power = current_power & ~power_mask; /* Disable by default. */ |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 255 | if (enable) { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 256 | struct resource* ioport_resource; |
| 257 | ioport_resource = find_resource(dev, PNP_IDX_IO0); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 258 | lpc47n217_pnp_set_iobase(dev, ioport_resource->base); |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 259 | new_power |= power_mask; /* Enable. */ |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 260 | } else { |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 261 | lpc47n217_pnp_set_iobase(dev, 0); |
| 262 | } |
| 263 | pnp_write_config(dev, power_register, new_power); |
| 264 | } |
| 265 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 266 | static void pnp_enter_conf_state(struct device *dev) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 267 | { |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 268 | outb(0x55, dev->path.pnp.port); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 269 | } |
| 270 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 271 | static void pnp_exit_conf_state(struct device *dev) |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 272 | { |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 273 | outb(0xaa, dev->path.pnp.port); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 274 | } |