diff options
-rw-r--r-- | drivers/gpio/gpio-ep93xx.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-generic.c | 16 | ||||
-rw-r--r-- | drivers/gpio/gpio-mxc.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-mxs.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-sodaville.c | 2 | ||||
-rw-r--r-- | include/linux/basic_mmio_gpio.h | 6 |
6 files changed, 20 insertions, 10 deletions
diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 776b772523e5..9fe5b8fe9be8 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c | |||
@@ -325,7 +325,7 @@ static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev, | |||
325 | void __iomem *dir = mmio_base + bank->dir; | 325 | void __iomem *dir = mmio_base + bank->dir; |
326 | int err; | 326 | int err; |
327 | 327 | ||
328 | err = bgpio_init(bgc, dev, 1, data, NULL, NULL, dir, NULL, false); | 328 | err = bgpio_init(bgc, dev, 1, data, NULL, NULL, dir, NULL, 0); |
329 | if (err) | 329 | if (err) |
330 | return err; | 330 | return err; |
331 | 331 | ||
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c index e38dd0c31973..82e2e4fe599e 100644 --- a/drivers/gpio/gpio-generic.c +++ b/drivers/gpio/gpio-generic.c | |||
@@ -364,7 +364,7 @@ EXPORT_SYMBOL_GPL(bgpio_remove); | |||
364 | int bgpio_init(struct bgpio_chip *bgc, struct device *dev, | 364 | int bgpio_init(struct bgpio_chip *bgc, struct device *dev, |
365 | unsigned long sz, void __iomem *dat, void __iomem *set, | 365 | unsigned long sz, void __iomem *dat, void __iomem *set, |
366 | void __iomem *clr, void __iomem *dirout, void __iomem *dirin, | 366 | void __iomem *clr, void __iomem *dirout, void __iomem *dirin, |
367 | bool big_endian) | 367 | unsigned long flags) |
368 | { | 368 | { |
369 | int ret; | 369 | int ret; |
370 | 370 | ||
@@ -385,7 +385,7 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev, | |||
385 | if (ret) | 385 | if (ret) |
386 | return ret; | 386 | return ret; |
387 | 387 | ||
388 | ret = bgpio_setup_accessors(dev, bgc, big_endian); | 388 | ret = bgpio_setup_accessors(dev, bgc, flags & BGPIOF_BIG_ENDIAN); |
389 | if (ret) | 389 | if (ret) |
390 | return ret; | 390 | return ret; |
391 | 391 | ||
@@ -394,6 +394,11 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev, | |||
394 | return ret; | 394 | return ret; |
395 | 395 | ||
396 | bgc->data = bgc->read_reg(bgc->reg_dat); | 396 | bgc->data = bgc->read_reg(bgc->reg_dat); |
397 | if (bgc->gc.set == bgpio_set_set && | ||
398 | !(flags & BGPIOF_UNREADABLE_REG_SET)) | ||
399 | bgc->data = bgc->read_reg(bgc->reg_set); | ||
400 | if (bgc->reg_dir && !(flags & BGPIOF_UNREADABLE_REG_DIR)) | ||
401 | bgc->dir = bgc->read_reg(bgc->reg_dir); | ||
397 | 402 | ||
398 | return ret; | 403 | return ret; |
399 | } | 404 | } |
@@ -449,7 +454,7 @@ static int __devinit bgpio_pdev_probe(struct platform_device *pdev) | |||
449 | void __iomem *dirout; | 454 | void __iomem *dirout; |
450 | void __iomem *dirin; | 455 | void __iomem *dirin; |
451 | unsigned long sz; | 456 | unsigned long sz; |
452 | bool be; | 457 | unsigned long flags = 0; |
453 | int err; | 458 | int err; |
454 | struct bgpio_chip *bgc; | 459 | struct bgpio_chip *bgc; |
455 | struct bgpio_pdata *pdata = dev_get_platdata(dev); | 460 | struct bgpio_pdata *pdata = dev_get_platdata(dev); |
@@ -480,13 +485,14 @@ static int __devinit bgpio_pdev_probe(struct platform_device *pdev) | |||
480 | if (err) | 485 | if (err) |
481 | return err; | 486 | return err; |
482 | 487 | ||
483 | be = !strcmp(platform_get_device_id(pdev)->name, "basic-mmio-gpio-be"); | 488 | if (!strcmp(platform_get_device_id(pdev)->name, "basic-mmio-gpio-be")) |
489 | flags |= BGPIOF_BIG_ENDIAN; | ||
484 | 490 | ||
485 | bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL); | 491 | bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL); |
486 | if (!bgc) | 492 | if (!bgc) |
487 | return -ENOMEM; | 493 | return -ENOMEM; |
488 | 494 | ||
489 | err = bgpio_init(bgc, dev, sz, dat, set, clr, dirout, dirin, be); | 495 | err = bgpio_init(bgc, dev, sz, dat, set, clr, dirout, dirin, flags); |
490 | if (err) | 496 | if (err) |
491 | return err; | 497 | return err; |
492 | 498 | ||
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index e79147634573..c337143b18f8 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c | |||
@@ -417,7 +417,7 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) | |||
417 | err = bgpio_init(&port->bgc, &pdev->dev, 4, | 417 | err = bgpio_init(&port->bgc, &pdev->dev, 4, |
418 | port->base + GPIO_PSR, | 418 | port->base + GPIO_PSR, |
419 | port->base + GPIO_DR, NULL, | 419 | port->base + GPIO_DR, NULL, |
420 | port->base + GPIO_GDIR, NULL, false); | 420 | port->base + GPIO_GDIR, NULL, 0); |
421 | if (err) | 421 | if (err) |
422 | goto out_iounmap; | 422 | goto out_iounmap; |
423 | 423 | ||
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c index 385c58e8405b..b4136501abd8 100644 --- a/drivers/gpio/gpio-mxs.c +++ b/drivers/gpio/gpio-mxs.c | |||
@@ -244,7 +244,7 @@ static int __devinit mxs_gpio_probe(struct platform_device *pdev) | |||
244 | err = bgpio_init(&port->bgc, &pdev->dev, 4, | 244 | err = bgpio_init(&port->bgc, &pdev->dev, 4, |
245 | port->base + PINCTRL_DIN(port->id), | 245 | port->base + PINCTRL_DIN(port->id), |
246 | port->base + PINCTRL_DOUT(port->id), NULL, | 246 | port->base + PINCTRL_DOUT(port->id), NULL, |
247 | port->base + PINCTRL_DOE(port->id), NULL, false); | 247 | port->base + PINCTRL_DOE(port->id), NULL, 0); |
248 | if (err) | 248 | if (err) |
249 | goto out_iounmap; | 249 | goto out_iounmap; |
250 | 250 | ||
diff --git a/drivers/gpio/gpio-sodaville.c b/drivers/gpio/gpio-sodaville.c index 820209c420e3..9d9891f7a607 100644 --- a/drivers/gpio/gpio-sodaville.c +++ b/drivers/gpio/gpio-sodaville.c | |||
@@ -224,7 +224,7 @@ static int __devinit sdv_gpio_probe(struct pci_dev *pdev, | |||
224 | 224 | ||
225 | ret = bgpio_init(&sd->bgpio, &pdev->dev, 4, | 225 | ret = bgpio_init(&sd->bgpio, &pdev->dev, 4, |
226 | sd->gpio_pub_base + GPINR, sd->gpio_pub_base + GPOUTR, | 226 | sd->gpio_pub_base + GPINR, sd->gpio_pub_base + GPOUTR, |
227 | NULL, sd->gpio_pub_base + GPOER, NULL, false); | 227 | NULL, sd->gpio_pub_base + GPOER, NULL, 0); |
228 | if (ret) | 228 | if (ret) |
229 | goto unmap; | 229 | goto unmap; |
230 | sd->bgpio.gc.ngpio = SDV_NUM_PUB_GPIOS; | 230 | sd->bgpio.gc.ngpio = SDV_NUM_PUB_GPIOS; |
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h index feb912196745..1c504ca5bdb3 100644 --- a/include/linux/basic_mmio_gpio.h +++ b/include/linux/basic_mmio_gpio.h | |||
@@ -67,6 +67,10 @@ int bgpio_remove(struct bgpio_chip *bgc); | |||
67 | int bgpio_init(struct bgpio_chip *bgc, struct device *dev, | 67 | int bgpio_init(struct bgpio_chip *bgc, struct device *dev, |
68 | unsigned long sz, void __iomem *dat, void __iomem *set, | 68 | unsigned long sz, void __iomem *dat, void __iomem *set, |
69 | void __iomem *clr, void __iomem *dirout, void __iomem *dirin, | 69 | void __iomem *clr, void __iomem *dirout, void __iomem *dirin, |
70 | bool big_endian); | 70 | unsigned long flags); |
71 | |||
72 | #define BGPIOF_BIG_ENDIAN BIT(0) | ||
73 | #define BGPIOF_UNREADABLE_REG_SET BIT(1) /* reg_set is unreadable */ | ||
74 | #define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */ | ||
71 | 75 | ||
72 | #endif /* __BASIC_MMIO_GPIO_H */ | 76 | #endif /* __BASIC_MMIO_GPIO_H */ |