void sch4037_early_init(unsigned port) { pnp_devfn_t dev; dev = PNP_DEV(port, SMSCSUPERIO_SP1); pnp_enter_conf_state(dev); /* Auto power management */ pnp_write_config(dev, 0x22, 0x38); /* BIT3+BIT4+BIT5 */ pnp_write_config(dev, 0x23, 0); /* Enable SMSC UART 0 */ dev = PNP_DEV(port, SMSCSUPERIO_SP1); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, CONFIG_TTYS0_BASE); pnp_set_irq(dev, PNP_IDX_IRQ0, 0x4); /* Enabled High speed, disabled MIDI support. */ pnp_write_config(dev, 0xF0, 0x02); pnp_set_enable(dev, 1); /* Enable keyboard */ dev = PNP_DEV(port, SCH4037_KBC); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_irq(dev, 0x70, 1); /* IRQ 1 */ pnp_set_irq(dev, 0x72, 12); /* IRQ 12 */ pnp_set_enable(dev, 1); pnp_exit_conf_state(dev); }
static inline void kbc1100_early_init(unsigned port) { device_t dev; dev = PNP_DEV (port, KBC1100_KBC); pnp_enter_conf_state(dev); /* Serial IRQ enabled */ outb(0x25, port); outb(0x04, port + 1); /* Enable SMSC UART 0 */ dev = PNP_DEV (port, SMSCSUPERIO_SP1); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, CONFIG_TTYS0_BASE); pnp_set_enable(dev, 1); /* Enable keyboard */ dev = PNP_DEV (port, KBC1100_KBC); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, 0x60); pnp_set_iobase(dev, PNP_IDX_IO1, 0x64); pnp_set_irq(dev, 0x70, 1); /* IRQ 1 */ pnp_set_irq(dev, 0x72, 12); /* IRQ 12 */ pnp_set_enable(dev, 1); /* Enable EC Channel 0 */ dev = PNP_DEV (port, KBC1100_EC0); pnp_set_logical_device(dev); pnp_set_enable(dev, 1); pnp_exit_conf_state(dev); /* disable the 1s timer */ outb(0xE7, 0x64); }
void shc4307_init(void) { shc4307_enter_ext_func_mode(CMOS_DEV); pnp_set_logical_device(CMOS_DEV); /* CMOS/RTC */ pnp_set_iobase(CMOS_DEV, PNP_IDX_IO0, 0x70); pnp_set_iobase(CMOS_DEV, PNP_IDX_IO1, 0x72); pnp_set_irq(CMOS_DEV, PNP_IDX_IRQ0, 8); /* pnp_set_enable(CMOS_DEV, 3); */ pnp_write_config(CMOS_DEV, 0x30, 3); pnp_set_logical_device(KBD_DEV); /* Keyboard */ pnp_set_irq(KBD_DEV, PNP_IDX_IRQ0, 1); pnp_set_enable(KBD_DEV, 1); pnp_set_logical_device(DBG_DEV); /* Debug */ pnp_set_iobase(DBG_DEV, PNP_IDX_IO0, 0x80); pnp_set_enable(DBG_DEV, 1); pnp_set_logical_device(REGS_DEV); pnp_set_iobase(REGS_DEV, PNP_IDX_IO0, 0x600); pnp_set_enable(REGS_DEV, 1); shc4307_exit_ext_func_mode(CMOS_DEV); }
static void vt1211_pnp_set_resources(struct device *dev) { struct resource *res; #if IS_ENABLED(CONFIG_CONSOLE_SERIAL) && IS_ENABLED(CONFIG_DRIVERS_UART_8250IO) /* TODO: Do the same for SP2? */ if (dev->path.pnp.device == VT1211_SP1) { for (res = dev->resource_list; res; res = res->next) { res->flags |= IORESOURCE_STORED; report_resource_stored(dev, res, ""); } return; } #endif pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); /* Paranoia says I should disable the device here... */ for (res = dev->resource_list; res; res = res->next) { if (!(res->flags & IORESOURCE_ASSIGNED)) { printk(BIOS_ERR, "ERROR: %s %02lx %s size: 0x%010Lx " "not assigned\n", dev_path(dev), res->index, resource_type(res), res->size); continue; } /* Now store the resource. */ if (res->flags & IORESOURCE_IO) { vt1211_set_iobase(dev, res->index, res->base); } else if (res->flags & IORESOURCE_DRQ) { pnp_set_drq(dev, res->index, res->base); } else if (res->flags & IORESOURCE_IRQ) { pnp_set_irq(dev, res->index, res->base); } else { printk(BIOS_ERR, "ERROR: %s %02lx unknown resource " "type\n", dev_path(dev), res->index); return; } res->flags |= IORESOURCE_STORED; report_resource_stored(dev, res, ""); } pnp_exit_conf_mode(dev); }
/* This box has one superio * Also set up the GPIOs from the beginning. This is the "no schematic * but safe anyways" method. */ static void early_superio_config_w83627ehg(void) { device_t dev; dev = DUMMY_DEV; pnp_enter_ext_func_mode(dev); pnp_write_config(dev, 0x24, 0xc4); // PNPCSV pnp_write_config(dev, 0x29, 0x01); // GPIO settings pnp_write_config(dev, 0x2a, 0x40); // GPIO settings should be fc but gets set to 02 pnp_write_config(dev, 0x2b, 0xc0); // GPIO settings? pnp_write_config(dev, 0x2c, 0x03); // GPIO settings? pnp_write_config(dev, 0x2d, 0x20); // GPIO settings? dev=PNP_DEV(0x4e, W83627EHG_SP1); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, 0x3f8); pnp_set_irq(dev, PNP_IDX_IRQ0, 4); pnp_set_enable(dev, 1); dev=PNP_DEV(0x4e, W83627EHG_SP2); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, 0x2f8); pnp_set_irq(dev, PNP_IDX_IRQ0, 3); // pnp_write_config(dev, 0xf1, 4); // IRMODE0 pnp_set_enable(dev, 1); dev=PNP_DEV(0x4e, W83627EHG_KBC); // Keyboard pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, 0x60); pnp_set_iobase(dev, PNP_IDX_IO1, 0x64); //pnp_write_config(dev, 0xf0, 0x82); pnp_set_enable(dev, 1); dev=PNP_DEV(0x4e, W83627EHG_GPIO2); pnp_set_logical_device(dev); pnp_set_enable(dev, 1); // Just enable it dev=PNP_DEV(0x4e, W83627EHG_GPIO3); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_write_config(dev, 0xf0, 0xfb); // GPIO bit 2 is output pnp_write_config(dev, 0xf1, 0x00); // GPIO bit 2 is 0 pnp_write_config(dev, 0x30, 0x03); // Enable GPIO3+4. pnp_set_enable is not sufficient dev=PNP_DEV(0x4e, W83627EHG_FDC); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); dev=PNP_DEV(0x4e, W83627EHG_PP); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); /* Enable HWM */ dev=PNP_DEV(0x4e, W83627EHG_HWM); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, 0xa00); pnp_set_enable(dev, 1); pnp_exit_ext_func_mode(dev); }
/* * Logical device 4, 5 and 7 are being deactivated. Logical Device 1 seems to * be another serial (?), it is also deactivated on the HP machine. */ static void pilot_early_init(device_t dev) { unsigned port = dev >> 8; print_debug("Using port: "); print_debug_hex16(port); print_debug("\n"); pilot_disable_serial(PNP_DEV(port, 0x1)); print_debug("disable serial 1\n"); pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0x3)); pnp_set_enable(dev, 0); pnp_set_iobase(dev, 0x60, 0x0b00); pnp_set_iobase(dev, 0x62, 0x0b80); pnp_set_iobase(dev, 0x64, 0x0b84); pnp_set_iobase(dev, 0x66, 0x0b86); pnp_set_enable(dev, 1); pnp_exit_ext_func_mode(dev); /* pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0x3)); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_enable(PNP_DEV(port, 0x3), 0); pnp_exit_ext_func_mode(dev); */ pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0x4)); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_enable( PNP_DEV(port, 0x4), 0); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0x5)); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_enable(PNP_DEV(port, 0x5), 0); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0x6)); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, 0x60); pnp_set_iobase(dev, PNP_IDX_IO1, 0x64); pnp_set_irq(dev, PNP_IDX_IRQ0, 1); pnp_set_drq(dev, 0x71, 3); pnp_set_enable(dev, 0); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0xe)); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, 0x70); pnp_set_iobase(dev, PNP_IDX_IO1, 0x72); pnp_set_irq(dev, PNP_IDX_IRQ0, 8); pnp_set_drq(dev, 0x71, 3); pnp_set_enable(dev, 0); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0x7)); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_enable(PNP_DEV(port, 0x7), 0); pnp_exit_ext_func_mode(dev); /* pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0x8)); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_enable(PNP_DEV(port, 0x8), 0); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0x9)); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_enable(PNP_DEV(port, 0x9), 0); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_logical_device(PNP_DEV(port, 0x10)); pnp_exit_ext_func_mode(dev); pnp_enter_ext_func_mode(dev); pnp_set_enable(PNP_DEV(port, 0x10), 0); pnp_exit_ext_func_mode(dev); */ }