Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1da78078 authored by Russell King's avatar Russell King Committed by Russell King
Browse files

Merge branch 'sa1100'

parents 53491e04 2a52efb2
Loading
Loading
Loading
Loading
+48 −18
Original line number Original line Diff line number Diff line
@@ -321,11 +321,42 @@ static void locomo_gpio_unmask_irq(unsigned int irq)
	locomo_writel(r, mapbase + LOCOMO_GIE);
	locomo_writel(r, mapbase + LOCOMO_GIE);
}
}


static int GPIO_IRQ_rising_edge;
static int GPIO_IRQ_falling_edge;

static int locomo_gpio_type(unsigned int irq, unsigned int type)
{
	unsigned int mask;
	void __iomem *mapbase = get_irq_chip_data(irq);

	mask = 1 << (irq - LOCOMO_IRQ_GPIO_START);

	if (type == IRQT_PROBE) {
		if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask)
			return 0;
		type = __IRQT_RISEDGE | __IRQT_FALEDGE;
	}

	if (type & __IRQT_RISEDGE)
		GPIO_IRQ_rising_edge |= mask;
	else
		GPIO_IRQ_rising_edge &= ~mask;
	if (type & __IRQT_FALEDGE)
		GPIO_IRQ_falling_edge |= mask;
	else
		GPIO_IRQ_falling_edge &= ~mask;
	locomo_writel(GPIO_IRQ_rising_edge, mapbase + LOCOMO_GRIE);
	locomo_writel(GPIO_IRQ_falling_edge, mapbase + LOCOMO_GFIE);

	return 0;
}

static struct irq_chip locomo_gpio_chip = {
static struct irq_chip locomo_gpio_chip = {
	.name	  = "LOCOMO-gpio",
	.name	  = "LOCOMO-gpio",
	.ack	  = locomo_gpio_ack_irq,
	.ack	  = locomo_gpio_ack_irq,
	.mask	  = locomo_gpio_mask_irq,
	.mask	  = locomo_gpio_mask_irq,
	.unmask	  = locomo_gpio_unmask_irq,
	.unmask	  = locomo_gpio_unmask_irq,
	.set_type = locomo_gpio_type,
};
};


static void locomo_lt_handler(unsigned int irq, struct irq_desc *desc)
static void locomo_lt_handler(unsigned int irq, struct irq_desc *desc)
@@ -450,22 +481,18 @@ static void locomo_setup_irq(struct locomo *lchip)
	set_irq_chip(IRQ_LOCOMO_KEY_BASE, &locomo_chip);
	set_irq_chip(IRQ_LOCOMO_KEY_BASE, &locomo_chip);
	set_irq_chip_data(IRQ_LOCOMO_KEY_BASE, irqbase);
	set_irq_chip_data(IRQ_LOCOMO_KEY_BASE, irqbase);
	set_irq_chained_handler(IRQ_LOCOMO_KEY_BASE, locomo_key_handler);
	set_irq_chained_handler(IRQ_LOCOMO_KEY_BASE, locomo_key_handler);
	set_irq_flags(IRQ_LOCOMO_KEY_BASE, IRQF_VALID | IRQF_PROBE);


	set_irq_chip(IRQ_LOCOMO_GPIO_BASE, &locomo_chip);
	set_irq_chip(IRQ_LOCOMO_GPIO_BASE, &locomo_chip);
	set_irq_chip_data(IRQ_LOCOMO_GPIO_BASE, irqbase);
	set_irq_chip_data(IRQ_LOCOMO_GPIO_BASE, irqbase);
	set_irq_chained_handler(IRQ_LOCOMO_GPIO_BASE, locomo_gpio_handler);
	set_irq_chained_handler(IRQ_LOCOMO_GPIO_BASE, locomo_gpio_handler);
	set_irq_flags(IRQ_LOCOMO_GPIO_BASE, IRQF_VALID | IRQF_PROBE);


	set_irq_chip(IRQ_LOCOMO_LT_BASE, &locomo_chip);
	set_irq_chip(IRQ_LOCOMO_LT_BASE, &locomo_chip);
	set_irq_chip_data(IRQ_LOCOMO_LT_BASE, irqbase);
	set_irq_chip_data(IRQ_LOCOMO_LT_BASE, irqbase);
	set_irq_chained_handler(IRQ_LOCOMO_LT_BASE, locomo_lt_handler);
	set_irq_chained_handler(IRQ_LOCOMO_LT_BASE, locomo_lt_handler);
	set_irq_flags(IRQ_LOCOMO_LT_BASE, IRQF_VALID | IRQF_PROBE);


	set_irq_chip(IRQ_LOCOMO_SPI_BASE, &locomo_chip);
	set_irq_chip(IRQ_LOCOMO_SPI_BASE, &locomo_chip);
	set_irq_chip_data(IRQ_LOCOMO_SPI_BASE, irqbase);
	set_irq_chip_data(IRQ_LOCOMO_SPI_BASE, irqbase);
	set_irq_chained_handler(IRQ_LOCOMO_SPI_BASE, locomo_spi_handler);
	set_irq_chained_handler(IRQ_LOCOMO_SPI_BASE, locomo_spi_handler);
	set_irq_flags(IRQ_LOCOMO_SPI_BASE, IRQF_VALID | IRQF_PROBE);


	/* install handlers for IRQ_LOCOMO_KEY_BASE generated interrupts */
	/* install handlers for IRQ_LOCOMO_KEY_BASE generated interrupts */
	set_irq_chip(LOCOMO_IRQ_KEY_START, &locomo_key_chip);
	set_irq_chip(LOCOMO_IRQ_KEY_START, &locomo_key_chip);
@@ -488,7 +515,7 @@ static void locomo_setup_irq(struct locomo *lchip)
	set_irq_flags(LOCOMO_IRQ_LT_START, IRQF_VALID | IRQF_PROBE);
	set_irq_flags(LOCOMO_IRQ_LT_START, IRQF_VALID | IRQF_PROBE);


	/* install handlers for IRQ_LOCOMO_SPI_BASE generated interrupts */
	/* install handlers for IRQ_LOCOMO_SPI_BASE generated interrupts */
	for (irq = LOCOMO_IRQ_SPI_START; irq < LOCOMO_IRQ_SPI_START + 3; irq++) {
	for (irq = LOCOMO_IRQ_SPI_START; irq < LOCOMO_IRQ_SPI_START + 4; irq++) {
		set_irq_chip(irq, &locomo_spi_chip);
		set_irq_chip(irq, &locomo_spi_chip);
		set_irq_chip_data(irq, irqbase);
		set_irq_chip_data(irq, irqbase);
		set_irq_handler(irq, handle_edge_irq);
		set_irq_handler(irq, handle_edge_irq);
@@ -574,14 +601,14 @@ static int locomo_suspend(struct platform_device *dev, pm_message_t state)


	save->LCM_GPO     = locomo_readl(lchip->base + LOCOMO_GPO);	/* GPIO */
	save->LCM_GPO     = locomo_readl(lchip->base + LOCOMO_GPO);	/* GPIO */
	locomo_writel(0x00, lchip->base + LOCOMO_GPO);
	locomo_writel(0x00, lchip->base + LOCOMO_GPO);
	save->LCM_SPICT   = locomo_readl(lchip->base + LOCOMO_SPICT);	/* SPI */
	save->LCM_SPICT   = locomo_readl(lchip->base + LOCOMO_SPI + LOCOMO_SPICT);	/* SPI */
	locomo_writel(0x40, lchip->base + LOCOMO_SPICT);
	locomo_writel(0x40, lchip->base + LOCOMO_SPICT);
	save->LCM_GPE     = locomo_readl(lchip->base + LOCOMO_GPE);	/* GPIO */
	save->LCM_GPE     = locomo_readl(lchip->base + LOCOMO_GPE);	/* GPIO */
	locomo_writel(0x00, lchip->base + LOCOMO_GPE);
	locomo_writel(0x00, lchip->base + LOCOMO_GPE);
	save->LCM_ASD     = locomo_readl(lchip->base + LOCOMO_ASD);	/* ADSTART */
	save->LCM_ASD     = locomo_readl(lchip->base + LOCOMO_ASD);	/* ADSTART */
	locomo_writel(0x00, lchip->base + LOCOMO_ASD);
	locomo_writel(0x00, lchip->base + LOCOMO_ASD);
	save->LCM_SPIMD   = locomo_readl(lchip->base + LOCOMO_SPIMD);	/* SPI */
	save->LCM_SPIMD   = locomo_readl(lchip->base + LOCOMO_SPI + LOCOMO_SPIMD);	/* SPI */
	locomo_writel(0x3C14, lchip->base + LOCOMO_SPIMD);
	locomo_writel(0x3C14, lchip->base + LOCOMO_SPI + LOCOMO_SPIMD);


	locomo_writel(0x00, lchip->base + LOCOMO_PAIF);
	locomo_writel(0x00, lchip->base + LOCOMO_PAIF);
	locomo_writel(0x00, lchip->base + LOCOMO_DAC);
	locomo_writel(0x00, lchip->base + LOCOMO_DAC);
@@ -616,10 +643,10 @@ static int locomo_resume(struct platform_device *dev)
	spin_lock_irqsave(&lchip->lock, flags);
	spin_lock_irqsave(&lchip->lock, flags);


	locomo_writel(save->LCM_GPO, lchip->base + LOCOMO_GPO);
	locomo_writel(save->LCM_GPO, lchip->base + LOCOMO_GPO);
	locomo_writel(save->LCM_SPICT, lchip->base + LOCOMO_SPICT);
	locomo_writel(save->LCM_SPICT, lchip->base + LOCOMO_SPI + LOCOMO_SPICT);
	locomo_writel(save->LCM_GPE, lchip->base + LOCOMO_GPE);
	locomo_writel(save->LCM_GPE, lchip->base + LOCOMO_GPE);
	locomo_writel(save->LCM_ASD, lchip->base + LOCOMO_ASD);
	locomo_writel(save->LCM_ASD, lchip->base + LOCOMO_ASD);
	locomo_writel(save->LCM_SPIMD, lchip->base + LOCOMO_SPIMD);
	locomo_writel(save->LCM_SPIMD, lchip->base + LOCOMO_SPI + LOCOMO_SPIMD);


	locomo_writel(0x00, lchip->base + LOCOMO_C32K);
	locomo_writel(0x00, lchip->base + LOCOMO_C32K);
	locomo_writel(0x90, lchip->base + LOCOMO_TADC);
	locomo_writel(0x90, lchip->base + LOCOMO_TADC);
@@ -688,9 +715,9 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)


	/* GPIO */
	/* GPIO */
	locomo_writel(0, lchip->base + LOCOMO_GPO);
	locomo_writel(0, lchip->base + LOCOMO_GPO);
	locomo_writel( (LOCOMO_GPIO(2) | LOCOMO_GPIO(3) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14))
	locomo_writel((LOCOMO_GPIO(1) | LOCOMO_GPIO(2) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14))
			, lchip->base + LOCOMO_GPE);
			, lchip->base + LOCOMO_GPE);
	locomo_writel( (LOCOMO_GPIO(2) | LOCOMO_GPIO(3) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14))
	locomo_writel((LOCOMO_GPIO(1) | LOCOMO_GPIO(2) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14))
			, lchip->base + LOCOMO_GPD);
			, lchip->base + LOCOMO_GPD);
	locomo_writel(0, lchip->base + LOCOMO_GIE);
	locomo_writel(0, lchip->base + LOCOMO_GIE);


@@ -833,6 +860,9 @@ void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir
	spin_lock_irqsave(&lchip->lock, flags);
	spin_lock_irqsave(&lchip->lock, flags);


	r = locomo_readl(lchip->base + LOCOMO_GPD);
	r = locomo_readl(lchip->base + LOCOMO_GPD);
	if (dir)
		r |= bits;
	else
		r &= ~bits;
		r &= ~bits;
	locomo_writel(r, lchip->base + LOCOMO_GPD);
	locomo_writel(r, lchip->base + LOCOMO_GPD);


+1 −1
Original line number Original line Diff line number Diff line
@@ -141,7 +141,7 @@
#define IRQ_LOCOMO_LT		(IRQ_BOARD_END + 17)
#define IRQ_LOCOMO_LT		(IRQ_BOARD_END + 17)
#define IRQ_LOCOMO_SPI_RFR	(IRQ_BOARD_END + 18)
#define IRQ_LOCOMO_SPI_RFR	(IRQ_BOARD_END + 18)
#define IRQ_LOCOMO_SPI_RFW	(IRQ_BOARD_END + 19)
#define IRQ_LOCOMO_SPI_RFW	(IRQ_BOARD_END + 19)
#define IRQ_LOCOMO_SPI_OVRN	(IRQ_BOARD_END + 20)
#define IRQ_LOCOMO_SPI_REND	(IRQ_BOARD_END + 20)
#define IRQ_LOCOMO_SPI_TEND	(IRQ_BOARD_END + 21)
#define IRQ_LOCOMO_SPI_TEND	(IRQ_BOARD_END + 21)


/*
/*
+11 −8
Original line number Original line Diff line number Diff line
@@ -58,6 +58,11 @@
#define LOCOMO_SPIMD	0x00		/* SPI mode setting */
#define LOCOMO_SPIMD	0x00		/* SPI mode setting */
#define LOCOMO_SPICT	0x04		/* SPI mode control */
#define LOCOMO_SPICT	0x04		/* SPI mode control */
#define LOCOMO_SPIST	0x08		/* SPI status */
#define LOCOMO_SPIST	0x08		/* SPI status */
#define	LOCOMO_SPI_TEND	(1 << 3)	/* Transfer end bit */
#define	LOCOMO_SPI_REND	(1 << 2)	/* Receive end bit */
#define	LOCOMO_SPI_RFW	(1 << 1)	/* write buffer bit */
#define	LOCOMO_SPI_RFR	(1)		/* read buffer bit */

#define LOCOMO_SPIIS	0x10		/* SPI interrupt status */
#define LOCOMO_SPIIS	0x10		/* SPI interrupt status */
#define LOCOMO_SPIWE	0x14		/* SPI interrupt status write enable */
#define LOCOMO_SPIWE	0x14		/* SPI interrupt status write enable */
#define LOCOMO_SPIIE	0x18		/* SPI interrupt enable */
#define LOCOMO_SPIIE	0x18		/* SPI interrupt enable */
@@ -66,16 +71,12 @@
#define LOCOMO_SPIRD	0x24		/* SPI receive data read */
#define LOCOMO_SPIRD	0x24		/* SPI receive data read */
#define LOCOMO_SPITS	0x28		/* SPI transfer data shift */
#define LOCOMO_SPITS	0x28		/* SPI transfer data shift */
#define LOCOMO_SPIRS	0x2C		/* SPI receive data shift */
#define LOCOMO_SPIRS	0x2C		/* SPI receive data shift */
#define	LOCOMO_SPI_TEND	(1 << 3)	/* Transfer end bit */
#define	LOCOMO_SPI_OVRN	(1 << 2)	/* Over Run bit */
#define	LOCOMO_SPI_RFW	(1 << 1)	/* write buffer bit */
#define	LOCOMO_SPI_RFR	(1)		/* read buffer bit */


/* GPIO */
/* GPIO */
#define LOCOMO_GPD		0x90	/* GPIO direction */
#define LOCOMO_GPD		0x90	/* GPIO direction */
#define LOCOMO_GPE		0x94	/* GPIO input enable */
#define LOCOMO_GPE		0x94	/* GPIO input enable */
#define LOCOMO_GPL		0x98	/* GPIO level */
#define LOCOMO_GPL		0x98	/* GPIO level */
#define LOCOMO_GPO		0x9c	/* GPIO out data setteing */
#define LOCOMO_GPO		0x9c	/* GPIO out data setting */
#define LOCOMO_GRIE		0xa0	/* GPIO rise detection */
#define LOCOMO_GRIE		0xa0	/* GPIO rise detection */
#define LOCOMO_GFIE		0xa4	/* GPIO fall detection */
#define LOCOMO_GFIE		0xa4	/* GPIO fall detection */
#define LOCOMO_GIS		0xa8	/* GPIO edge detection status */
#define LOCOMO_GIS		0xa8	/* GPIO edge detection status */
@@ -96,6 +97,9 @@
#define LOCOMO_GPIO_DAC_SDATA	LOCOMO_GPIO(10)
#define LOCOMO_GPIO_DAC_SDATA	LOCOMO_GPIO(10)
#define LOCOMO_GPIO_DAC_SCK	LOCOMO_GPIO(11)
#define LOCOMO_GPIO_DAC_SCK	LOCOMO_GPIO(11)
#define LOCOMO_GPIO_DAC_SLOAD	LOCOMO_GPIO(12)
#define LOCOMO_GPIO_DAC_SLOAD	LOCOMO_GPIO(12)
#define LOCOMO_GPIO_CARD_DETECT LOCOMO_GPIO(13)
#define LOCOMO_GPIO_WRITE_PROT  LOCOMO_GPIO(14)
#define LOCOMO_GPIO_CARD_POWER  LOCOMO_GPIO(15)


/* Start the definitions of the devices.  Each device has an initial
/* Start the definitions of the devices.  Each device has an initial
 * base address and a series of offsets from that base address. */
 * base address and a series of offsets from that base address. */
@@ -122,7 +126,7 @@
/* Audio controller */
/* Audio controller */
#define LOCOMO_AUDIO		0x54
#define LOCOMO_AUDIO		0x54
#define LOCOMO_ACC		0x00	/* Audio clock */
#define LOCOMO_ACC		0x00	/* Audio clock */
#define LOCOMO_PAIF		0x7C	/* PCM audio interface */
#define LOCOMO_PAIF		0xD0	/* PCM audio interface */
/* Audio clock */
/* Audio clock */
#define	LOCOMO_ACC_XON		0x80
#define	LOCOMO_ACC_XON		0x80
#define	LOCOMO_ACC_XEN		0x40
#define	LOCOMO_ACC_XEN		0x40
@@ -204,7 +208,6 @@ int locomo_gpio_read_level(struct device *dev, unsigned int bits);
int locomo_gpio_read_output(struct device *dev, unsigned int bits);
int locomo_gpio_read_output(struct device *dev, unsigned int bits);
void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set);
void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set);



/* M62332 control function */
/* M62332 control function */
void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel);
void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel);