@@ -102,7 +102,7 @@ struct armada_37xx_pinctrl {
102
102
struct device * dev ;
103
103
struct gpio_chip gpio_chip ;
104
104
struct irq_chip irq_chip ;
105
- spinlock_t irq_lock ;
105
+ raw_spinlock_t irq_lock ;
106
106
struct pinctrl_desc pctl ;
107
107
struct pinctrl_dev * pctl_dev ;
108
108
struct armada_37xx_pin_group * groups ;
@@ -523,9 +523,9 @@ static void armada_37xx_irq_ack(struct irq_data *d)
523
523
unsigned long flags ;
524
524
525
525
armada_37xx_irq_update_reg (& reg , d );
526
- spin_lock_irqsave (& info -> irq_lock , flags );
526
+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
527
527
writel (d -> mask , info -> base + reg );
528
- spin_unlock_irqrestore (& info -> irq_lock , flags );
528
+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
529
529
}
530
530
531
531
static void armada_37xx_irq_mask (struct irq_data * d )
@@ -536,10 +536,10 @@ static void armada_37xx_irq_mask(struct irq_data *d)
536
536
unsigned long flags ;
537
537
538
538
armada_37xx_irq_update_reg (& reg , d );
539
- spin_lock_irqsave (& info -> irq_lock , flags );
539
+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
540
540
val = readl (info -> base + reg );
541
541
writel (val & ~d -> mask , info -> base + reg );
542
- spin_unlock_irqrestore (& info -> irq_lock , flags );
542
+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
543
543
}
544
544
545
545
static void armada_37xx_irq_unmask (struct irq_data * d )
@@ -550,10 +550,10 @@ static void armada_37xx_irq_unmask(struct irq_data *d)
550
550
unsigned long flags ;
551
551
552
552
armada_37xx_irq_update_reg (& reg , d );
553
- spin_lock_irqsave (& info -> irq_lock , flags );
553
+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
554
554
val = readl (info -> base + reg );
555
555
writel (val | d -> mask , info -> base + reg );
556
- spin_unlock_irqrestore (& info -> irq_lock , flags );
556
+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
557
557
}
558
558
559
559
static int armada_37xx_irq_set_wake (struct irq_data * d , unsigned int on )
@@ -564,14 +564,14 @@ static int armada_37xx_irq_set_wake(struct irq_data *d, unsigned int on)
564
564
unsigned long flags ;
565
565
566
566
armada_37xx_irq_update_reg (& reg , d );
567
- spin_lock_irqsave (& info -> irq_lock , flags );
567
+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
568
568
val = readl (info -> base + reg );
569
569
if (on )
570
570
val |= (BIT (d -> hwirq % GPIO_PER_REG ));
571
571
else
572
572
val &= ~(BIT (d -> hwirq % GPIO_PER_REG ));
573
573
writel (val , info -> base + reg );
574
- spin_unlock_irqrestore (& info -> irq_lock , flags );
574
+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
575
575
576
576
return 0 ;
577
577
}
@@ -583,7 +583,7 @@ static int armada_37xx_irq_set_type(struct irq_data *d, unsigned int type)
583
583
u32 val , reg = IRQ_POL ;
584
584
unsigned long flags ;
585
585
586
- spin_lock_irqsave (& info -> irq_lock , flags );
586
+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
587
587
armada_37xx_irq_update_reg (& reg , d );
588
588
val = readl (info -> base + reg );
589
589
switch (type ) {
@@ -607,11 +607,11 @@ static int armada_37xx_irq_set_type(struct irq_data *d, unsigned int type)
607
607
break ;
608
608
}
609
609
default :
610
- spin_unlock_irqrestore (& info -> irq_lock , flags );
610
+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
611
611
return - EINVAL ;
612
612
}
613
613
writel (val , info -> base + reg );
614
- spin_unlock_irqrestore (& info -> irq_lock , flags );
614
+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
615
615
616
616
return 0 ;
617
617
}
@@ -626,7 +626,7 @@ static int armada_37xx_edge_both_irq_swap_pol(struct armada_37xx_pinctrl *info,
626
626
627
627
regmap_read (info -> regmap , INPUT_VAL + 4 * reg_idx , & l );
628
628
629
- spin_lock_irqsave (& info -> irq_lock , flags );
629
+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
630
630
p = readl (info -> base + IRQ_POL + 4 * reg_idx );
631
631
if ((p ^ l ) & (1 << bit_num )) {
632
632
/*
@@ -647,7 +647,7 @@ static int armada_37xx_edge_both_irq_swap_pol(struct armada_37xx_pinctrl *info,
647
647
ret = -1 ;
648
648
}
649
649
650
- spin_unlock_irqrestore (& info -> irq_lock , flags );
650
+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
651
651
return ret ;
652
652
}
653
653
@@ -664,11 +664,11 @@ static void armada_37xx_irq_handler(struct irq_desc *desc)
664
664
u32 status ;
665
665
unsigned long flags ;
666
666
667
- spin_lock_irqsave (& info -> irq_lock , flags );
667
+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
668
668
status = readl_relaxed (info -> base + IRQ_STATUS + 4 * i );
669
669
/* Manage only the interrupt that was enabled */
670
670
status &= readl_relaxed (info -> base + IRQ_EN + 4 * i );
671
- spin_unlock_irqrestore (& info -> irq_lock , flags );
671
+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
672
672
while (status ) {
673
673
u32 hwirq = ffs (status ) - 1 ;
674
674
u32 virq = irq_find_mapping (d , hwirq +
@@ -695,12 +695,12 @@ static void armada_37xx_irq_handler(struct irq_desc *desc)
695
695
696
696
update_status :
697
697
/* Update status in case a new IRQ appears */
698
- spin_lock_irqsave (& info -> irq_lock , flags );
698
+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
699
699
status = readl_relaxed (info -> base +
700
700
IRQ_STATUS + 4 * i );
701
701
/* Manage only the interrupt that was enabled */
702
702
status &= readl_relaxed (info -> base + IRQ_EN + 4 * i );
703
- spin_unlock_irqrestore (& info -> irq_lock , flags );
703
+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
704
704
}
705
705
}
706
706
chained_irq_exit (chip , desc );
@@ -731,7 +731,7 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev,
731
731
struct device * dev = & pdev -> dev ;
732
732
unsigned int i , nr_irq_parent ;
733
733
734
- spin_lock_init (& info -> irq_lock );
734
+ raw_spin_lock_init (& info -> irq_lock );
735
735
736
736
nr_irq_parent = of_irq_count (np );
737
737
if (!nr_irq_parent ) {
@@ -1107,25 +1107,40 @@ static const struct of_device_id armada_37xx_pinctrl_of_match[] = {
1107
1107
{ },
1108
1108
};
1109
1109
1110
+ static const struct regmap_config armada_37xx_pinctrl_regmap_config = {
1111
+ .reg_bits = 32 ,
1112
+ .val_bits = 32 ,
1113
+ .reg_stride = 4 ,
1114
+ .use_raw_spinlock = true,
1115
+ };
1116
+
1110
1117
static int __init armada_37xx_pinctrl_probe (struct platform_device * pdev )
1111
1118
{
1112
1119
struct armada_37xx_pinctrl * info ;
1113
1120
struct device * dev = & pdev -> dev ;
1114
- struct device_node * np = dev -> of_node ;
1115
1121
struct regmap * regmap ;
1122
+ void __iomem * base ;
1116
1123
int ret ;
1117
1124
1125
+ base = devm_platform_get_and_ioremap_resource (pdev , 0 , NULL );
1126
+ if (IS_ERR (base )) {
1127
+ dev_err (dev , "failed to ioremap base address: %pe\n" , base );
1128
+ return PTR_ERR (base );
1129
+ }
1130
+
1131
+ regmap = devm_regmap_init_mmio (dev , base ,
1132
+ & armada_37xx_pinctrl_regmap_config );
1133
+ if (IS_ERR (regmap )) {
1134
+ dev_err (dev , "failed to create regmap: %pe\n" , regmap );
1135
+ return PTR_ERR (regmap );
1136
+ }
1137
+
1118
1138
info = devm_kzalloc (dev , sizeof (* info ), GFP_KERNEL );
1119
1139
if (!info )
1120
1140
return - ENOMEM ;
1121
1141
1122
1142
info -> dev = dev ;
1123
-
1124
- regmap = syscon_node_to_regmap (np );
1125
- if (IS_ERR (regmap ))
1126
- return dev_err_probe (dev , PTR_ERR (regmap ), "cannot get regmap\n" );
1127
1143
info -> regmap = regmap ;
1128
-
1129
1144
info -> data = of_device_get_match_data (dev );
1130
1145
1131
1146
ret = armada_37xx_pinctrl_register (pdev , info );
0 commit comments