@@ -102,7 +102,7 @@ struct armada_37xx_pinctrl {
102102 struct device * dev ;
103103 struct gpio_chip gpio_chip ;
104104 struct irq_chip irq_chip ;
105- spinlock_t irq_lock ;
105+ raw_spinlock_t irq_lock ;
106106 struct pinctrl_desc pctl ;
107107 struct pinctrl_dev * pctl_dev ;
108108 struct armada_37xx_pin_group * groups ;
@@ -523,9 +523,9 @@ static void armada_37xx_irq_ack(struct irq_data *d)
523523 unsigned long flags ;
524524
525525 armada_37xx_irq_update_reg (& reg , d );
526- spin_lock_irqsave (& info -> irq_lock , flags );
526+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
527527 writel (d -> mask , info -> base + reg );
528- spin_unlock_irqrestore (& info -> irq_lock , flags );
528+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
529529}
530530
531531static void armada_37xx_irq_mask (struct irq_data * d )
@@ -536,10 +536,10 @@ static void armada_37xx_irq_mask(struct irq_data *d)
536536 unsigned long flags ;
537537
538538 armada_37xx_irq_update_reg (& reg , d );
539- spin_lock_irqsave (& info -> irq_lock , flags );
539+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
540540 val = readl (info -> base + reg );
541541 writel (val & ~d -> mask , info -> base + reg );
542- spin_unlock_irqrestore (& info -> irq_lock , flags );
542+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
543543}
544544
545545static void armada_37xx_irq_unmask (struct irq_data * d )
@@ -550,10 +550,10 @@ static void armada_37xx_irq_unmask(struct irq_data *d)
550550 unsigned long flags ;
551551
552552 armada_37xx_irq_update_reg (& reg , d );
553- spin_lock_irqsave (& info -> irq_lock , flags );
553+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
554554 val = readl (info -> base + reg );
555555 writel (val | d -> mask , info -> base + reg );
556- spin_unlock_irqrestore (& info -> irq_lock , flags );
556+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
557557}
558558
559559static 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)
564564 unsigned long flags ;
565565
566566 armada_37xx_irq_update_reg (& reg , d );
567- spin_lock_irqsave (& info -> irq_lock , flags );
567+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
568568 val = readl (info -> base + reg );
569569 if (on )
570570 val |= (BIT (d -> hwirq % GPIO_PER_REG ));
571571 else
572572 val &= ~(BIT (d -> hwirq % GPIO_PER_REG ));
573573 writel (val , info -> base + reg );
574- spin_unlock_irqrestore (& info -> irq_lock , flags );
574+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
575575
576576 return 0 ;
577577}
@@ -583,7 +583,7 @@ static int armada_37xx_irq_set_type(struct irq_data *d, unsigned int type)
583583 u32 val , reg = IRQ_POL ;
584584 unsigned long flags ;
585585
586- spin_lock_irqsave (& info -> irq_lock , flags );
586+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
587587 armada_37xx_irq_update_reg (& reg , d );
588588 val = readl (info -> base + reg );
589589 switch (type ) {
@@ -607,11 +607,11 @@ static int armada_37xx_irq_set_type(struct irq_data *d, unsigned int type)
607607 break ;
608608 }
609609 default :
610- spin_unlock_irqrestore (& info -> irq_lock , flags );
610+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
611611 return - EINVAL ;
612612 }
613613 writel (val , info -> base + reg );
614- spin_unlock_irqrestore (& info -> irq_lock , flags );
614+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
615615
616616 return 0 ;
617617}
@@ -626,7 +626,7 @@ static int armada_37xx_edge_both_irq_swap_pol(struct armada_37xx_pinctrl *info,
626626
627627 regmap_read (info -> regmap , INPUT_VAL + 4 * reg_idx , & l );
628628
629- spin_lock_irqsave (& info -> irq_lock , flags );
629+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
630630 p = readl (info -> base + IRQ_POL + 4 * reg_idx );
631631 if ((p ^ l ) & (1 << bit_num )) {
632632 /*
@@ -647,7 +647,7 @@ static int armada_37xx_edge_both_irq_swap_pol(struct armada_37xx_pinctrl *info,
647647 ret = -1 ;
648648 }
649649
650- spin_unlock_irqrestore (& info -> irq_lock , flags );
650+ raw_spin_unlock_irqrestore (& info -> irq_lock , flags );
651651 return ret ;
652652}
653653
@@ -664,11 +664,11 @@ static void armada_37xx_irq_handler(struct irq_desc *desc)
664664 u32 status ;
665665 unsigned long flags ;
666666
667- spin_lock_irqsave (& info -> irq_lock , flags );
667+ raw_spin_lock_irqsave (& info -> irq_lock , flags );
668668 status = readl_relaxed (info -> base + IRQ_STATUS + 4 * i );
669669 /* Manage only the interrupt that was enabled */
670670 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 );
672672 while (status ) {
673673 u32 hwirq = ffs (status ) - 1 ;
674674 u32 virq = irq_find_mapping (d , hwirq +
@@ -695,12 +695,12 @@ static void armada_37xx_irq_handler(struct irq_desc *desc)
695695
696696update_status :
697697 /* 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 );
699699 status = readl_relaxed (info -> base +
700700 IRQ_STATUS + 4 * i );
701701 /* Manage only the interrupt that was enabled */
702702 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 );
704704 }
705705 }
706706 chained_irq_exit (chip , desc );
@@ -731,7 +731,7 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev,
731731 struct device * dev = & pdev -> dev ;
732732 unsigned int i , nr_irq_parent ;
733733
734- spin_lock_init (& info -> irq_lock );
734+ raw_spin_lock_init (& info -> irq_lock );
735735
736736 nr_irq_parent = of_irq_count (np );
737737 if (!nr_irq_parent ) {
@@ -1107,25 +1107,40 @@ static const struct of_device_id armada_37xx_pinctrl_of_match[] = {
11071107 { },
11081108};
11091109
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+
11101117static int __init armada_37xx_pinctrl_probe (struct platform_device * pdev )
11111118{
11121119 struct armada_37xx_pinctrl * info ;
11131120 struct device * dev = & pdev -> dev ;
1114- struct device_node * np = dev -> of_node ;
11151121 struct regmap * regmap ;
1122+ void __iomem * base ;
11161123 int ret ;
11171124
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+
11181138 info = devm_kzalloc (dev , sizeof (* info ), GFP_KERNEL );
11191139 if (!info )
11201140 return - ENOMEM ;
11211141
11221142 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" );
11271143 info -> regmap = regmap ;
1128-
11291144 info -> data = of_device_get_match_data (dev );
11301145
11311146 ret = armada_37xx_pinctrl_register (pdev , info );
0 commit comments