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