superio/*: Don't use conf_mode directly

Use the functions defined in device/pnp.h instead of using the
conf_mode directly.
This will make future refactoring easier.

Change-Id: Ibb94d86b3ee861f44cded469ff58b545dd7311fd
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/37638
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
Patrick Rudolph 2019-12-10 12:08:37 +01:00 committed by Patrick Georgi
parent 8a2204896a
commit 98b72dadf0
3 changed files with 19 additions and 18 deletions

View File

@ -43,29 +43,29 @@ static void nct5572d_init(struct device *dev)
/* TODO: Might potentially need code for HWM or FDC etc. */ /* TODO: Might potentially need code for HWM or FDC etc. */
case NCT5572D_KBC: case NCT5572D_KBC:
/* Enable mouse controller */ /* Enable mouse controller */
pnp_enter_conf_mode_8787(dev); pnp_enter_conf_mode(dev);
byte = pnp_read_config(dev, 0x2a); byte = pnp_read_config(dev, 0x2a);
byte &= ~(0x1 << 1); byte &= ~(0x1 << 1);
pnp_write_config(dev, 0x2a, byte); pnp_write_config(dev, 0x2a, byte);
pnp_exit_conf_mode_aa(dev); pnp_exit_conf_mode(dev);
mouse_detected = pc_keyboard_init(PROBE_AUX_DEVICE); mouse_detected = pc_keyboard_init(PROBE_AUX_DEVICE);
if (!mouse_detected) { if (!mouse_detected) {
printk(BIOS_INFO, "%s: Disable mouse controller.", printk(BIOS_INFO, "%s: Disable mouse controller.",
__func__); __func__);
pnp_enter_conf_mode_8787(dev); pnp_enter_conf_mode(dev);
byte = pnp_read_config(dev, 0x2a); byte = pnp_read_config(dev, 0x2a);
byte |= 0x1 << 1; byte |= 0x1 << 1;
pnp_write_config(dev, 0x2a, byte); pnp_write_config(dev, 0x2a, byte);
pnp_exit_conf_mode_aa(dev); pnp_exit_conf_mode(dev);
} }
break; break;
case NCT5572D_ACPI: case NCT5572D_ACPI:
/* Set power state after power fail */ /* Set power state after power fail */
power_status = CONFIG_MAINBOARD_POWER_FAILURE_STATE; power_status = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
get_option(&power_status, "power_on_after_fail"); get_option(&power_status, "power_on_after_fail");
pnp_enter_conf_mode_8787(dev); pnp_enter_conf_mode(dev);
pnp_set_logical_device(dev); pnp_set_logical_device(dev);
byte = pnp_read_config(dev, 0xe4); byte = pnp_read_config(dev, 0xe4);
byte &= ~0x60; byte &= ~0x60;
@ -74,7 +74,7 @@ static void nct5572d_init(struct device *dev)
else if (power_status == MAINBOARD_POWER_KEEP) else if (power_status == MAINBOARD_POWER_KEEP)
byte |= (0x2 << 5); byte |= (0x2 << 5);
pnp_write_config(dev, 0xe4, byte); pnp_write_config(dev, 0xe4, byte);
pnp_exit_conf_mode_aa(dev); pnp_exit_conf_mode(dev);
printk(BIOS_INFO, "set power %s after power fail\n", power_status ? "on" : "off"); printk(BIOS_INFO, "set power %s after power fail\n", power_status ? "on" : "off");
break; break;
} }

View File

@ -48,6 +48,7 @@ static struct device_operations ops = {
.enable_resources = lpc47n227_pnp_enable_resources, .enable_resources = lpc47n227_pnp_enable_resources,
.enable = lpc47n227_pnp_enable, .enable = lpc47n227_pnp_enable,
.init = lpc47n227_init, .init = lpc47n227_init,
.ops_pnp_mode = &pnp_conf_mode_55_aa,
}; };
static struct pnp_info pnp_dev_info[] = { static struct pnp_info pnp_dev_info[] = {
@ -81,10 +82,10 @@ void lpc47n227_pnp_set_resources(struct device *dev)
{ {
struct resource *res; struct resource *res;
pnp_enter_conf_mode_55(dev); pnp_enter_conf_mode(dev);
for (res = dev->resource_list; res; res = res->next) for (res = dev->resource_list; res; res = res->next)
lpc47n227_pnp_set_resource(dev, res); lpc47n227_pnp_set_resource(dev, res);
pnp_exit_conf_mode_aa(dev); pnp_exit_conf_mode(dev);
} }
/* /*
@ -93,9 +94,9 @@ void lpc47n227_pnp_set_resources(struct device *dev)
*/ */
void lpc47n227_pnp_enable_resources(struct device *dev) void lpc47n227_pnp_enable_resources(struct device *dev)
{ {
pnp_enter_conf_mode_55(dev); pnp_enter_conf_mode(dev);
lpc47n227_pnp_set_enable(dev, 1); lpc47n227_pnp_set_enable(dev, 1);
pnp_exit_conf_mode_aa(dev); pnp_exit_conf_mode(dev);
} }
/* /*
@ -104,9 +105,9 @@ void lpc47n227_pnp_enable_resources(struct device *dev)
*/ */
void lpc47n227_pnp_enable(struct device *dev) void lpc47n227_pnp_enable(struct device *dev)
{ {
pnp_enter_conf_mode_55(dev); pnp_enter_conf_mode(dev);
lpc47n227_pnp_set_enable(dev, !!dev->enabled); lpc47n227_pnp_set_enable(dev, !!dev->enabled);
pnp_exit_conf_mode_aa(dev); pnp_exit_conf_mode(dev);
} }
/** /**

View File

@ -43,29 +43,29 @@ static void w83667hg_a_init(struct device *dev)
/* TODO: Might potentially need code for HWM or FDC etc. */ /* TODO: Might potentially need code for HWM or FDC etc. */
case W83667HG_A_KBC: case W83667HG_A_KBC:
/* Enable mouse controller */ /* Enable mouse controller */
pnp_enter_conf_mode_8787(dev); pnp_enter_conf_mode(dev);
byte = pnp_read_config(dev, 0x2a); byte = pnp_read_config(dev, 0x2a);
byte &= ~(0x1 << 1); byte &= ~(0x1 << 1);
pnp_write_config(dev, 0x2a, byte); pnp_write_config(dev, 0x2a, byte);
pnp_exit_conf_mode_aa(dev); pnp_exit_conf_mode(dev);
mouse_detected = pc_keyboard_init(PROBE_AUX_DEVICE); mouse_detected = pc_keyboard_init(PROBE_AUX_DEVICE);
if (!mouse_detected && !acpi_is_wakeup_s3()) { if (!mouse_detected && !acpi_is_wakeup_s3()) {
printk(BIOS_INFO, "%s: Disable mouse controller.", printk(BIOS_INFO, "%s: Disable mouse controller.",
__func__); __func__);
pnp_enter_conf_mode_8787(dev); pnp_enter_conf_mode(dev);
byte = pnp_read_config(dev, 0x2a); byte = pnp_read_config(dev, 0x2a);
byte |= 0x1 << 1; byte |= 0x1 << 1;
pnp_write_config(dev, 0x2a, byte); pnp_write_config(dev, 0x2a, byte);
pnp_exit_conf_mode_aa(dev); pnp_exit_conf_mode(dev);
} }
break; break;
case W83667HG_A_ACPI: case W83667HG_A_ACPI:
/* Set power state after power fail */ /* Set power state after power fail */
power_status = CONFIG_MAINBOARD_POWER_FAILURE_STATE; power_status = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
get_option(&power_status, "power_on_after_fail"); get_option(&power_status, "power_on_after_fail");
pnp_enter_conf_mode_8787(dev); pnp_enter_conf_mode(dev);
pnp_set_logical_device(dev); pnp_set_logical_device(dev);
byte = pnp_read_config(dev, 0xe4); byte = pnp_read_config(dev, 0xe4);
byte &= ~0x60; byte &= ~0x60;
@ -74,7 +74,7 @@ static void w83667hg_a_init(struct device *dev)
else if (power_status == MAINBOARD_POWER_KEEP) else if (power_status == MAINBOARD_POWER_KEEP)
byte |= (0x2 << 5); byte |= (0x2 << 5);
pnp_write_config(dev, 0xe4, byte); pnp_write_config(dev, 0xe4, byte);
pnp_exit_conf_mode_aa(dev); pnp_exit_conf_mode(dev);
printk(BIOS_INFO, "set power %s after power fail\n", power_status ? "on" : "off"); printk(BIOS_INFO, "set power %s after power fail\n", power_status ? "on" : "off");
break; break;
} }