aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-04-23 17:13:01 -0400
committerLinus Walleij <linus.walleij@linaro.org>2015-04-09 04:16:13 -0400
commit1dfe0d159dc7f7b6d1734b2010aabda2bbe87d5a (patch)
tree0b3b568261230afba27e267a836fa5e306209349
parent7414b0993cd020aea14574065c28b55f3f849688 (diff)
pinctrl: sirf: move sgpio lock into state container
Instead of referring to a global static variable for the sgpio locking, use the state container to contain the lock. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/sirf/pinctrl-sirf.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c
index abc5c475ea85..e2efbbae4061 100644
--- a/drivers/pinctrl/sirf/pinctrl-sirf.c
+++ b/drivers/pinctrl/sirf/pinctrl-sirf.c
@@ -39,10 +39,9 @@ struct sirfsoc_gpio_bank {
39struct sirfsoc_gpio_chip { 39struct sirfsoc_gpio_chip {
40 struct of_mm_gpio_chip chip; 40 struct of_mm_gpio_chip chip;
41 struct sirfsoc_gpio_bank sgpio_bank[SIRFSOC_GPIO_NO_OF_BANKS]; 41 struct sirfsoc_gpio_bank sgpio_bank[SIRFSOC_GPIO_NO_OF_BANKS];
42 spinlock_t lock;
42}; 43};
43 44
44static DEFINE_SPINLOCK(sgpio_lock);
45
46static struct sirfsoc_pin_group *sirfsoc_pin_groups; 45static struct sirfsoc_pin_group *sirfsoc_pin_groups;
47static int sirfsoc_pingrp_cnt; 46static int sirfsoc_pingrp_cnt;
48 47
@@ -427,13 +426,13 @@ static void sirfsoc_gpio_irq_ack(struct irq_data *d)
427 426
428 offset = SIRFSOC_GPIO_CTRL(bank->id, idx); 427 offset = SIRFSOC_GPIO_CTRL(bank->id, idx);
429 428
430 spin_lock_irqsave(&sgpio_lock, flags); 429 spin_lock_irqsave(&sgpio->lock, flags);
431 430
432 val = readl(sgpio->chip.regs + offset); 431 val = readl(sgpio->chip.regs + offset);
433 432
434 writel(val, sgpio->chip.regs + offset); 433 writel(val, sgpio->chip.regs + offset);
435 434
436 spin_unlock_irqrestore(&sgpio_lock, flags); 435 spin_unlock_irqrestore(&sgpio->lock, flags);
437} 436}
438 437
439static void __sirfsoc_gpio_irq_mask(struct sirfsoc_gpio_chip *sgpio, 438static void __sirfsoc_gpio_irq_mask(struct sirfsoc_gpio_chip *sgpio,
@@ -445,14 +444,14 @@ static void __sirfsoc_gpio_irq_mask(struct sirfsoc_gpio_chip *sgpio,
445 444
446 offset = SIRFSOC_GPIO_CTRL(bank->id, idx); 445 offset = SIRFSOC_GPIO_CTRL(bank->id, idx);
447 446
448 spin_lock_irqsave(&sgpio_lock, flags); 447 spin_lock_irqsave(&sgpio->lock, flags);
449 448
450 val = readl(sgpio->chip.regs + offset); 449 val = readl(sgpio->chip.regs + offset);
451 val &= ~SIRFSOC_GPIO_CTL_INTR_EN_MASK; 450 val &= ~SIRFSOC_GPIO_CTL_INTR_EN_MASK;
452 val &= ~SIRFSOC_GPIO_CTL_INTR_STS_MASK; 451 val &= ~SIRFSOC_GPIO_CTL_INTR_STS_MASK;
453 writel(val, sgpio->chip.regs + offset); 452 writel(val, sgpio->chip.regs + offset);
454 453
455 spin_unlock_irqrestore(&sgpio_lock, flags); 454 spin_unlock_irqrestore(&sgpio->lock, flags);
456} 455}
457 456
458static void sirfsoc_gpio_irq_mask(struct irq_data *d) 457static void sirfsoc_gpio_irq_mask(struct irq_data *d)
@@ -475,14 +474,14 @@ static void sirfsoc_gpio_irq_unmask(struct irq_data *d)
475 474
476 offset = SIRFSOC_GPIO_CTRL(bank->id, idx); 475 offset = SIRFSOC_GPIO_CTRL(bank->id, idx);
477 476
478 spin_lock_irqsave(&sgpio_lock, flags); 477 spin_lock_irqsave(&sgpio->lock, flags);
479 478
480 val = readl(sgpio->chip.regs + offset); 479 val = readl(sgpio->chip.regs + offset);
481 val &= ~SIRFSOC_GPIO_CTL_INTR_STS_MASK; 480 val &= ~SIRFSOC_GPIO_CTL_INTR_STS_MASK;
482 val |= SIRFSOC_GPIO_CTL_INTR_EN_MASK; 481 val |= SIRFSOC_GPIO_CTL_INTR_EN_MASK;
483 writel(val, sgpio->chip.regs + offset); 482 writel(val, sgpio->chip.regs + offset);
484 483
485 spin_unlock_irqrestore(&sgpio_lock, flags); 484 spin_unlock_irqrestore(&sgpio->lock, flags);
486} 485}
487 486
488static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type) 487static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type)
@@ -496,7 +495,7 @@ static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type)
496 495
497 offset = SIRFSOC_GPIO_CTRL(bank->id, idx); 496 offset = SIRFSOC_GPIO_CTRL(bank->id, idx);
498 497
499 spin_lock_irqsave(&sgpio_lock, flags); 498 spin_lock_irqsave(&sgpio->lock, flags);
500 499
501 val = readl(sgpio->chip.regs + offset); 500 val = readl(sgpio->chip.regs + offset);
502 val &= ~(SIRFSOC_GPIO_CTL_INTR_STS_MASK | SIRFSOC_GPIO_CTL_OUT_EN_MASK); 501 val &= ~(SIRFSOC_GPIO_CTL_INTR_STS_MASK | SIRFSOC_GPIO_CTL_OUT_EN_MASK);
@@ -533,7 +532,7 @@ static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type)
533 532
534 writel(val, sgpio->chip.regs + offset); 533 writel(val, sgpio->chip.regs + offset);
535 534
536 spin_unlock_irqrestore(&sgpio_lock, flags); 535 spin_unlock_irqrestore(&sgpio->lock, flags);
537 536
538 return 0; 537 return 0;
539} 538}
@@ -697,11 +696,11 @@ static int sirfsoc_gpio_direction_output(struct gpio_chip *chip,
697 696
698 offset = SIRFSOC_GPIO_CTRL(bank->id, idx); 697 offset = SIRFSOC_GPIO_CTRL(bank->id, idx);
699 698
700 spin_lock_irqsave(&sgpio_lock, flags); 699 spin_lock_irqsave(&sgpio->lock, flags);
701 700
702 sirfsoc_gpio_set_output(sgpio, bank, offset, value); 701 sirfsoc_gpio_set_output(sgpio, bank, offset, value);
703 702
704 spin_unlock_irqrestore(&sgpio_lock, flags); 703 spin_unlock_irqrestore(&sgpio->lock, flags);
705 704
706 return 0; 705 return 0;
707} 706}
@@ -793,6 +792,7 @@ static int sirfsoc_gpio_probe(struct device_node *np)
793 sgpio = devm_kzalloc(&pdev->dev, sizeof(*sgpio), GFP_KERNEL); 792 sgpio = devm_kzalloc(&pdev->dev, sizeof(*sgpio), GFP_KERNEL);
794 if (!sgpio) 793 if (!sgpio)
795 return -ENOMEM; 794 return -ENOMEM;
795 spin_lock_init(&sgpio->lock);
796 796
797 regs = of_iomap(np, 0); 797 regs = of_iomap(np, 0);
798 if (!regs) 798 if (!regs)