X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fgpio%2Fintel_ich6_gpio.c;h=67bf0a2dd319de3891014415048dd7919d384047;hb=42c91c10c52a3f3512ad5c5e906bc118349bbff5;hp=8a108f3805a0b7929ea69dfdde3cf72784006b34;hpb=6f43ba70d15e15a08c25b3d956c70addb6740737;p=oweals%2Fu-boot.git diff --git a/drivers/gpio/intel_ich6_gpio.c b/drivers/gpio/intel_ich6_gpio.c index 8a108f3805..67bf0a2dd3 100644 --- a/drivers/gpio/intel_ich6_gpio.c +++ b/drivers/gpio/intel_ich6_gpio.c @@ -35,6 +35,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + #define GPIO_PER_BANK 32 struct ich6_bank_priv { @@ -73,7 +75,7 @@ static int gpio_ich6_get_base(unsigned long base) /* Is the device present? */ tmpword = x86_pci_read_config16(pci_dev, PCI_VENDOR_ID); if (tmpword != PCI_VENDOR_ID_INTEL) { - debug("%s: wrong VendorID\n", __func__); + debug("%s: wrong VendorID %x\n", __func__, tmpword); return -ENODEV; } @@ -142,7 +144,7 @@ static int gpio_ich6_get_base(unsigned long base) * at the offset that we just read. Bit 0 indicates that it's * an I/O address, not a memory address, so mask that off. */ - return tmplong & 0xfffc; + return tmplong & 1 ? tmplong & ~3 : tmplong & ~15; } static int _ich6_gpio_set_value(uint16_t base, unsigned offset, int value) @@ -322,7 +324,7 @@ int gpio_ich6_pinctrl_init(void) debug("%s: io-base offset not present\n", __func__); } else { iobase = gpio_ich6_get_base(iobase_offset); - if (iobase < 0) { + if (IS_ERR_VALUE(iobase)) { debug("%s: invalid IOBASE address (%08x)\n", __func__, iobase); return -EINVAL; @@ -408,7 +410,7 @@ static int ich6_gpio_direction_input(struct udevice *dev, unsigned offset) { struct ich6_bank_priv *bank = dev_get_priv(dev); - return _ich6_gpio_set_direction(inl(bank->io_sel), offset, 0); + return _ich6_gpio_set_direction(bank->io_sel, offset, 0); } static int ich6_gpio_direction_output(struct udevice *dev, unsigned offset, @@ -417,7 +419,7 @@ static int ich6_gpio_direction_output(struct udevice *dev, unsigned offset, int ret; struct ich6_bank_priv *bank = dev_get_priv(dev); - ret = _ich6_gpio_set_direction(inl(bank->io_sel), offset, 1); + ret = _ich6_gpio_set_direction(bank->io_sel, offset, 1); if (ret) return ret;