Commit f5139c27 authored by Julia Cartwright's avatar Julia Cartwright Committed by Lee Jones

mfd: tc6393xb: Make use of raw_spinlock variants

The tc6393xb mfd driver currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a
real-time kernel.  Because the spinlock_t type becomes a "sleeping"
spinlock w/ RT kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.
Signed-off-by: default avatarJulia Cartwright <julia@ni.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 9fe8c2df
...@@ -95,7 +95,7 @@ struct tc6393xb { ...@@ -95,7 +95,7 @@ struct tc6393xb {
struct clk *clk; /* 3,6 Mhz */ struct clk *clk; /* 3,6 Mhz */
spinlock_t lock; /* protects RMW cycles */ raw_spinlock_t lock; /* protects RMW cycles */
struct { struct {
u8 fer; u8 fer;
...@@ -126,13 +126,13 @@ static int tc6393xb_nand_enable(struct platform_device *nand) ...@@ -126,13 +126,13 @@ static int tc6393xb_nand_enable(struct platform_device *nand)
struct tc6393xb *tc6393xb = platform_get_drvdata(dev); struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
/* SMD buffer on */ /* SMD buffer on */
dev_dbg(&dev->dev, "SMD buffer on\n"); dev_dbg(&dev->dev, "SMD buffer on\n");
tmio_iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1)); tmio_iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1));
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
return 0; return 0;
} }
...@@ -226,7 +226,7 @@ static int tc6393xb_ohci_enable(struct platform_device *dev) ...@@ -226,7 +226,7 @@ static int tc6393xb_ohci_enable(struct platform_device *dev)
u16 ccr; u16 ccr;
u8 fer; u8 fer;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR);
ccr |= SCR_CCR_USBCK; ccr |= SCR_CCR_USBCK;
...@@ -236,7 +236,7 @@ static int tc6393xb_ohci_enable(struct platform_device *dev) ...@@ -236,7 +236,7 @@ static int tc6393xb_ohci_enable(struct platform_device *dev)
fer |= SCR_FER_USBEN; fer |= SCR_FER_USBEN;
tmio_iowrite8(fer, tc6393xb->scr + SCR_FER); tmio_iowrite8(fer, tc6393xb->scr + SCR_FER);
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
return 0; return 0;
} }
...@@ -248,7 +248,7 @@ static int tc6393xb_ohci_disable(struct platform_device *dev) ...@@ -248,7 +248,7 @@ static int tc6393xb_ohci_disable(struct platform_device *dev)
u16 ccr; u16 ccr;
u8 fer; u8 fer;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
fer = tmio_ioread8(tc6393xb->scr + SCR_FER); fer = tmio_ioread8(tc6393xb->scr + SCR_FER);
fer &= ~SCR_FER_USBEN; fer &= ~SCR_FER_USBEN;
...@@ -258,7 +258,7 @@ static int tc6393xb_ohci_disable(struct platform_device *dev) ...@@ -258,7 +258,7 @@ static int tc6393xb_ohci_disable(struct platform_device *dev)
ccr &= ~SCR_CCR_USBCK; ccr &= ~SCR_CCR_USBCK;
tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR);
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
return 0; return 0;
} }
...@@ -280,14 +280,14 @@ static int tc6393xb_fb_enable(struct platform_device *dev) ...@@ -280,14 +280,14 @@ static int tc6393xb_fb_enable(struct platform_device *dev)
unsigned long flags; unsigned long flags;
u16 ccr; u16 ccr;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR);
ccr &= ~SCR_CCR_MCLK_MASK; ccr &= ~SCR_CCR_MCLK_MASK;
ccr |= SCR_CCR_MCLK_48; ccr |= SCR_CCR_MCLK_48;
tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR);
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
return 0; return 0;
} }
...@@ -298,14 +298,14 @@ static int tc6393xb_fb_disable(struct platform_device *dev) ...@@ -298,14 +298,14 @@ static int tc6393xb_fb_disable(struct platform_device *dev)
unsigned long flags; unsigned long flags;
u16 ccr; u16 ccr;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR);
ccr &= ~SCR_CCR_MCLK_MASK; ccr &= ~SCR_CCR_MCLK_MASK;
ccr |= SCR_CCR_MCLK_OFF; ccr |= SCR_CCR_MCLK_OFF;
tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR);
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
return 0; return 0;
} }
...@@ -317,7 +317,7 @@ int tc6393xb_lcd_set_power(struct platform_device *fb, bool on) ...@@ -317,7 +317,7 @@ int tc6393xb_lcd_set_power(struct platform_device *fb, bool on)
u8 fer; u8 fer;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
fer = ioread8(tc6393xb->scr + SCR_FER); fer = ioread8(tc6393xb->scr + SCR_FER);
if (on) if (on)
...@@ -326,7 +326,7 @@ int tc6393xb_lcd_set_power(struct platform_device *fb, bool on) ...@@ -326,7 +326,7 @@ int tc6393xb_lcd_set_power(struct platform_device *fb, bool on)
fer &= ~SCR_FER_SLCDEN; fer &= ~SCR_FER_SLCDEN;
iowrite8(fer, tc6393xb->scr + SCR_FER); iowrite8(fer, tc6393xb->scr + SCR_FER);
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
return 0; return 0;
} }
...@@ -338,12 +338,12 @@ int tc6393xb_lcd_mode(struct platform_device *fb, ...@@ -338,12 +338,12 @@ int tc6393xb_lcd_mode(struct platform_device *fb,
struct tc6393xb *tc6393xb = platform_get_drvdata(dev); struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
iowrite16(mode->pixclock, tc6393xb->scr + SCR_PLL1CR + 0); iowrite16(mode->pixclock, tc6393xb->scr + SCR_PLL1CR + 0);
iowrite16(mode->pixclock >> 16, tc6393xb->scr + SCR_PLL1CR + 2); iowrite16(mode->pixclock >> 16, tc6393xb->scr + SCR_PLL1CR + 2);
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
return 0; return 0;
} }
...@@ -462,11 +462,11 @@ static void tc6393xb_gpio_set(struct gpio_chip *chip, ...@@ -462,11 +462,11 @@ static void tc6393xb_gpio_set(struct gpio_chip *chip,
struct tc6393xb *tc6393xb = gpiochip_get_data(chip); struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
__tc6393xb_gpio_set(chip, offset, value); __tc6393xb_gpio_set(chip, offset, value);
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
} }
static int tc6393xb_gpio_direction_input(struct gpio_chip *chip, static int tc6393xb_gpio_direction_input(struct gpio_chip *chip,
...@@ -476,13 +476,13 @@ static int tc6393xb_gpio_direction_input(struct gpio_chip *chip, ...@@ -476,13 +476,13 @@ static int tc6393xb_gpio_direction_input(struct gpio_chip *chip,
unsigned long flags; unsigned long flags;
u8 doecr; u8 doecr;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
doecr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); doecr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8));
doecr &= ~TC_GPIO_BIT(offset); doecr &= ~TC_GPIO_BIT(offset);
tmio_iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); tmio_iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8));
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
return 0; return 0;
} }
...@@ -494,7 +494,7 @@ static int tc6393xb_gpio_direction_output(struct gpio_chip *chip, ...@@ -494,7 +494,7 @@ static int tc6393xb_gpio_direction_output(struct gpio_chip *chip,
unsigned long flags; unsigned long flags;
u8 doecr; u8 doecr;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
__tc6393xb_gpio_set(chip, offset, value); __tc6393xb_gpio_set(chip, offset, value);
...@@ -502,7 +502,7 @@ static int tc6393xb_gpio_direction_output(struct gpio_chip *chip, ...@@ -502,7 +502,7 @@ static int tc6393xb_gpio_direction_output(struct gpio_chip *chip,
doecr |= TC_GPIO_BIT(offset); doecr |= TC_GPIO_BIT(offset);
tmio_iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); tmio_iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8));
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
return 0; return 0;
} }
...@@ -548,11 +548,11 @@ static void tc6393xb_irq_mask(struct irq_data *data) ...@@ -548,11 +548,11 @@ static void tc6393xb_irq_mask(struct irq_data *data)
unsigned long flags; unsigned long flags;
u8 imr; u8 imr;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); imr = tmio_ioread8(tc6393xb->scr + SCR_IMR);
imr |= 1 << (data->irq - tc6393xb->irq_base); imr |= 1 << (data->irq - tc6393xb->irq_base);
tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR);
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
} }
static void tc6393xb_irq_unmask(struct irq_data *data) static void tc6393xb_irq_unmask(struct irq_data *data)
...@@ -561,11 +561,11 @@ static void tc6393xb_irq_unmask(struct irq_data *data) ...@@ -561,11 +561,11 @@ static void tc6393xb_irq_unmask(struct irq_data *data)
unsigned long flags; unsigned long flags;
u8 imr; u8 imr;
spin_lock_irqsave(&tc6393xb->lock, flags); raw_spin_lock_irqsave(&tc6393xb->lock, flags);
imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); imr = tmio_ioread8(tc6393xb->scr + SCR_IMR);
imr &= ~(1 << (data->irq - tc6393xb->irq_base)); imr &= ~(1 << (data->irq - tc6393xb->irq_base));
tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR);
spin_unlock_irqrestore(&tc6393xb->lock, flags); raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
} }
static struct irq_chip tc6393xb_chip = { static struct irq_chip tc6393xb_chip = {
...@@ -628,7 +628,7 @@ static int tc6393xb_probe(struct platform_device *dev) ...@@ -628,7 +628,7 @@ static int tc6393xb_probe(struct platform_device *dev)
goto err_kzalloc; goto err_kzalloc;
} }
spin_lock_init(&tc6393xb->lock); raw_spin_lock_init(&tc6393xb->lock);
platform_set_drvdata(dev, tc6393xb); platform_set_drvdata(dev, tc6393xb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment