diff --git a/[refs] b/[refs] index 0d89185057b9..d84d81617287 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 108d093fdd75643dfc8c327f38125f4da76771e7 +refs/heads/master: 4c784ef76ac4443ab13648859f1b2a2737546cc1 diff --git a/trunk/arch/arm/Kconfig b/trunk/arch/arm/Kconfig index f7fa24b96eaa..6783c2e5512d 100644 --- a/trunk/arch/arm/Kconfig +++ b/trunk/arch/arm/Kconfig @@ -280,7 +280,6 @@ config ARCH_PXA bool "PXA2xx-based" depends on MMU select ARCH_MTD_XIP - select GENERIC_TIME help Support for Intel's PXA2XX processor line. diff --git a/trunk/arch/arm/mach-pxa/generic.c b/trunk/arch/arm/mach-pxa/generic.c index 390524c4710f..9de1278d234f 100644 --- a/trunk/arch/arm/mach-pxa/generic.c +++ b/trunk/arch/arm/mach-pxa/generic.c @@ -338,27 +338,6 @@ static struct platform_device i2c_device = { .num_resources = ARRAY_SIZE(i2c_resources), }; -#ifdef CONFIG_PXA27x -static struct resource i2c_power_resources[] = { - { - .start = 0x40f00180, - .end = 0x40f001a3, - .flags = IORESOURCE_MEM, - }, { - .start = IRQ_PWRI2C, - .end = IRQ_PWRI2C, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device i2c_power_device = { - .name = "pxa2xx-i2c", - .id = 1, - .resource = i2c_power_resources, - .num_resources = ARRAY_SIZE(i2c_resources), -}; -#endif - void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info) { i2c_device.dev.platform_data = info; @@ -413,9 +392,6 @@ static struct platform_device *devices[] __initdata = { &stuart_device, &pxaficp_device, &i2c_device, -#ifdef CONFIG_PXA27x - &i2c_power_device, -#endif &i2s_device, &pxartc_device, }; diff --git a/trunk/arch/arm/mach-s3c2410/Kconfig b/trunk/arch/arm/mach-s3c2410/Kconfig index eb4ec411312b..6329b4066f78 100644 --- a/trunk/arch/arm/mach-s3c2410/Kconfig +++ b/trunk/arch/arm/mach-s3c2410/Kconfig @@ -192,10 +192,17 @@ config S3C2412_PM help Internal config node to apply S3C2412 power management +config S3C2412_DMA + bool + depends on CPU_S3C2412 + help + Internal config node for S3C2412 DMA support + config CPU_S3C2412 bool depends on ARCH_S3C2410 select S3C2412_PM if PM + select S3C2412_DMA if S3C2410_DMA help Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line @@ -205,11 +212,18 @@ config CPU_S3C244X help Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems. +config S3C2440_DMA + bool + depends on ARCH_S3C2410 && CPU_S3C24405B + help + Support for S3C2440 specific DMA code5A + config CPU_S3C2440 bool depends on ARCH_S3C2410 select S3C2410_CLOCK select S3C2410_PM if PM + select S3C2440_DMA if S3C2410_DMA select CPU_S3C244X help Support for S3C2440 Samsung Mobile CPU based systems. @@ -272,7 +286,6 @@ config S3C2410_DMA_DEBUG amount of time, as well as using an significant percentage of the CPU time doing so. - config S3C2410_PM_DEBUG bool "S3C2410 PM Suspend debug" depends on ARCH_S3C2410 && PM diff --git a/trunk/arch/arm/mach-s3c2410/Makefile b/trunk/arch/arm/mach-s3c2410/Makefile index 27663e28cc88..85ffa1274b0b 100644 --- a/trunk/arch/arm/mach-s3c2410/Makefile +++ b/trunk/arch/arm/mach-s3c2410/Makefile @@ -9,8 +9,6 @@ obj-y := cpu.o irq.o time.o gpio.o clock.o devs.o obj-m := obj-n := obj- := -obj-dma-y := -obj-dma-n := # DMA obj-$(CONFIG_S3C2410_DMA) += dma.o @@ -37,9 +35,9 @@ obj-$(CONFIG_PM_H1940) += pm-h1940.o obj-$(CONFIG_CPU_S3C2412) += s3c2412.o obj-$(CONFIG_CPU_S3C2412) += s3c2412-irq.o obj-$(CONFIG_CPU_S3C2412) += s3c2412-clock.o -obj-dma-$(CONFIG_CPU_S3C2412) += s3c2412-dma.o obj-$(CONFIG_S3C2412_PM) += s3c2412-pm.o +obj-$(CONFIG_S3C2412_DMA) += s3c2412-dma.o # # S3C244X support @@ -57,7 +55,7 @@ obj-$(CONFIG_CPU_S3C2440) += s3c2440.o s3c2440-dsc.o obj-$(CONFIG_CPU_S3C2440) += s3c2440-irq.o obj-$(CONFIG_CPU_S3C2440) += s3c2440-clock.o obj-$(CONFIG_CPU_S3C2440) += s3c2410-gpio.o -obj-dma-$(CONFIG_CPU_S3C2440) += s3c2440-dma.o +obj-$(CONFIG_S3C2440_DMA) += s3c2440-dma.o # S3C2442 support @@ -68,10 +66,6 @@ obj-$(CONFIG_CPU_S3C2442) += s3c2442-clock.o obj-$(CONFIG_BAST_PC104_IRQ) += bast-irq.o -# merge in dma objects - -obj-y += $(obj-dma-y) - # machine specific support obj-$(CONFIG_MACH_AML_M5900) += mach-amlm5900.o diff --git a/trunk/drivers/i2c/busses/i2c-pxa.c b/trunk/drivers/i2c/busses/i2c-pxa.c index 14e83d0aac8c..c3b1567c852a 100644 --- a/trunk/drivers/i2c/busses/i2c-pxa.c +++ b/trunk/drivers/i2c/busses/i2c-pxa.c @@ -34,7 +34,6 @@ #include #include -#include #include #include @@ -55,21 +54,8 @@ struct pxa_i2c { unsigned int irqlogidx; u32 isrlog[32]; u32 icrlog[32]; - - void __iomem *reg_base; - - unsigned long iobase; - unsigned long iosize; - - int irq; }; -#define _IBMR(i2c) ((i2c)->reg_base + 0) -#define _IDBR(i2c) ((i2c)->reg_base + 8) -#define _ICR(i2c) ((i2c)->reg_base + 0x10) -#define _ISR(i2c) ((i2c)->reg_base + 0x18) -#define _ISAR(i2c) ((i2c)->reg_base + 0x20) - /* * I2C Slave mode address */ @@ -144,8 +130,7 @@ static unsigned int i2c_debug = DEBUG; static void i2c_pxa_show_state(struct pxa_i2c *i2c, int lno, const char *fname) { - dev_dbg(&i2c->adap.dev, "state:%s:%d: ISR=%08x, ICR=%08x, IBMR=%02x\n", fname, lno, - readl(_ISR(i2c)), readl(_ICR(i2c)), readl(_IBMR(i2c))); + dev_dbg(&i2c->adap.dev, "state:%s:%d: ISR=%08x, ICR=%08x, IBMR=%02x\n", fname, lno, ISR, ICR, IBMR); } #define show_state(i2c) i2c_pxa_show_state(i2c, __LINE__, __FUNCTION__) @@ -168,7 +153,7 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) printk("i2c: msg_num: %d msg_idx: %d msg_ptr: %d\n", i2c->msg_num, i2c->msg_idx, i2c->msg_ptr); printk("i2c: ICR: %08x ISR: %08x\n" - "i2c: log: ", readl(_ICR(i2c)), readl(_ISR(i2c))); + "i2c: log: ", ICR, ISR); for (i = 0; i < i2c->irqlogidx; i++) printk("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]); printk("\n"); @@ -176,7 +161,7 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) static inline int i2c_pxa_is_slavemode(struct pxa_i2c *i2c) { - return !(readl(_ICR(i2c)) & ICR_SCLE); + return !(ICR & ICR_SCLE); } static void i2c_pxa_abort(struct pxa_i2c *i2c) @@ -188,29 +173,28 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c) return; } - while (time_before(jiffies, timeout) && (readl(_IBMR(i2c)) & 0x1) == 0) { - unsigned long icr = readl(_ICR(i2c)); + while (time_before(jiffies, timeout) && (IBMR & 0x1) == 0) { + unsigned long icr = ICR; icr &= ~ICR_START; icr |= ICR_ACKNAK | ICR_STOP | ICR_TB; - writel(icr, _ICR(i2c)); + ICR = icr; show_state(i2c); msleep(1); } - writel(readl(_ICR(i2c)) & ~(ICR_MA | ICR_START | ICR_STOP), - _ICR(i2c)); + ICR &= ~(ICR_MA | ICR_START | ICR_STOP); } static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c) { int timeout = DEF_TIMEOUT; - while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) { - if ((readl(_ISR(i2c)) & ISR_SAD) != 0) + while (timeout-- && ISR & (ISR_IBB | ISR_UB)) { + if ((ISR & ISR_SAD) != 0) timeout += 4; msleep(2); @@ -230,9 +214,9 @@ static int i2c_pxa_wait_master(struct pxa_i2c *i2c) while (time_before(jiffies, timeout)) { if (i2c_debug > 1) dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n", - __func__, (long)jiffies, readl(_ISR(i2c)), readl(_ICR(i2c)), readl(_IBMR(i2c))); + __func__, (long)jiffies, ISR, ICR, IBMR); - if (readl(_ISR(i2c)) & ISR_SAD) { + if (ISR & ISR_SAD) { if (i2c_debug > 0) dev_dbg(&i2c->adap.dev, "%s: Slave detected\n", __func__); goto out; @@ -242,7 +226,7 @@ static int i2c_pxa_wait_master(struct pxa_i2c *i2c) * quick check of the i2c lines themselves to ensure they've * gone high... */ - if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) == 0 && readl(_IBMR(i2c)) == 3) { + if ((ISR & (ISR_UB | ISR_IBB)) == 0 && IBMR == 3) { if (i2c_debug > 0) dev_dbg(&i2c->adap.dev, "%s: done\n", __func__); return 1; @@ -262,7 +246,7 @@ static int i2c_pxa_set_master(struct pxa_i2c *i2c) if (i2c_debug) dev_dbg(&i2c->adap.dev, "setting to bus master\n"); - if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) != 0) { + if ((ISR & (ISR_UB | ISR_IBB)) != 0) { dev_dbg(&i2c->adap.dev, "%s: unit is busy\n", __func__); if (!i2c_pxa_wait_master(i2c)) { dev_dbg(&i2c->adap.dev, "%s: error: unit busy\n", __func__); @@ -270,7 +254,7 @@ static int i2c_pxa_set_master(struct pxa_i2c *i2c) } } - writel(readl(_ICR(i2c)) | ICR_SCLE, _ICR(i2c)); + ICR |= ICR_SCLE; return 0; } @@ -286,11 +270,11 @@ static int i2c_pxa_wait_slave(struct pxa_i2c *i2c) while (time_before(jiffies, timeout)) { if (i2c_debug > 1) dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n", - __func__, (long)jiffies, readl(_ISR(i2c)), readl(_ICR(i2c)), readl(_IBMR(i2c))); + __func__, (long)jiffies, ISR, ICR, IBMR); - if ((readl(_ISR(i2c)) & (ISR_UB|ISR_IBB)) == 0 || - (readl(_ISR(i2c)) & ISR_SAD) != 0 || - (readl(_ICR(i2c)) & ICR_SCLE) == 0) { + if ((ISR & (ISR_UB|ISR_IBB)) == 0 || + (ISR & ISR_SAD) != 0 || + (ICR & ICR_SCLE) == 0) { if (i2c_debug > 1) dev_dbg(&i2c->adap.dev, "%s: done\n", __func__); return 1; @@ -318,9 +302,9 @@ static void i2c_pxa_set_slave(struct pxa_i2c *i2c, int errcode) /* we need to wait for the stop condition to end */ /* if we where in stop, then clear... */ - if (readl(_ICR(i2c)) & ICR_STOP) { + if (ICR & ICR_STOP) { udelay(100); - writel(readl(_ICR(i2c)) & ~ICR_STOP, _ICR(i2c)); + ICR &= ~ICR_STOP; } if (!i2c_pxa_wait_slave(i2c)) { @@ -330,12 +314,12 @@ static void i2c_pxa_set_slave(struct pxa_i2c *i2c, int errcode) } } - writel(readl(_ICR(i2c)) & ~(ICR_STOP|ICR_ACKNAK|ICR_MA), _ICR(i2c)); - writel(readl(_ICR(i2c)) & ~ICR_SCLE, _ICR(i2c)); + ICR &= ~(ICR_STOP|ICR_ACKNAK|ICR_MA); + ICR &= ~ICR_SCLE; if (i2c_debug) { - dev_dbg(&i2c->adap.dev, "ICR now %08x, ISR %08x\n", readl(_ICR(i2c)), readl(_ISR(i2c))); - decode_ICR(readl(_ICR(i2c))); + dev_dbg(&i2c->adap.dev, "ICR now %08x, ISR %08x\n", ICR, ISR); + decode_ICR(ICR); } } #else @@ -350,24 +334,24 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c) i2c_pxa_abort(i2c); /* reset according to 9.8 */ - writel(ICR_UR, _ICR(i2c)); - writel(I2C_ISR_INIT, _ISR(i2c)); - writel(readl(_ICR(i2c)) & ~ICR_UR, _ICR(i2c)); + ICR = ICR_UR; + ISR = I2C_ISR_INIT; + ICR &= ~ICR_UR; - writel(i2c->slave_addr, _ISAR(i2c)); + ISAR = i2c->slave_addr; /* set control register values */ - writel(I2C_ICR_INIT, _ICR(i2c)); + ICR = I2C_ICR_INIT; #ifdef CONFIG_I2C_PXA_SLAVE dev_info(&i2c->adap.dev, "Enabling slave mode\n"); - writel(readl(_ICR(i2c)) | ICR_SADIE | ICR_ALDIE | ICR_SSDIE, _ICR(i2c)); + ICR |= ICR_SADIE | ICR_ALDIE | ICR_SSDIE; #endif i2c_pxa_set_slave(i2c, 0); /* enable unit */ - writel(readl(_ICR(i2c)) | ICR_IUE, _ICR(i2c)); + ICR |= ICR_IUE; udelay(100); } @@ -387,19 +371,19 @@ static void i2c_pxa_slave_txempty(struct pxa_i2c *i2c, u32 isr) if (i2c->slave != NULL) ret = i2c->slave->read(i2c->slave->data); - writel(ret, _IDBR(i2c)); - writel(readl(_ICR(i2c)) | ICR_TB, _ICR(i2c)); /* allow next byte */ + IDBR = ret; + ICR |= ICR_TB; /* allow next byte */ } } static void i2c_pxa_slave_rxfull(struct pxa_i2c *i2c, u32 isr) { - unsigned int byte = readl(_IDBR(i2c)); + unsigned int byte = IDBR; if (i2c->slave != NULL) i2c->slave->write(i2c->slave->data, byte); - writel(readl(_ICR(i2c)) | ICR_TB, _ICR(i2c)); + ICR |= ICR_TB; } static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr) @@ -419,13 +403,13 @@ static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr) * start condition... if this happens, we'd better back off * and stop holding the poor thing up */ - writel(readl(_ICR(i2c)) & ~(ICR_START|ICR_STOP), _ICR(i2c)); - writel(readl(_ICR(i2c)) | ICR_TB, _ICR(i2c)); + ICR &= ~(ICR_START|ICR_STOP); + ICR |= ICR_TB; timeout = 0x10000; while (1) { - if ((readl(_IBMR(i2c)) & 2) == 2) + if ((IBMR & 2) == 2) break; timeout--; @@ -436,7 +420,7 @@ static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr) } } - writel(readl(_ICR(i2c)) & ~ICR_SCLE, _ICR(i2c)); + ICR &= ~ICR_SCLE; } static void i2c_pxa_slave_stop(struct pxa_i2c *i2c) @@ -463,14 +447,14 @@ static void i2c_pxa_slave_txempty(struct pxa_i2c *i2c, u32 isr) if (isr & ISR_BED) { /* what should we do here? */ } else { - writel(0, _IDBR(i2c)); - writel(readl(_ICR(i2c)) | ICR_TB, _ICR(i2c)); + IDBR = 0; + ICR |= ICR_TB; } } static void i2c_pxa_slave_rxfull(struct pxa_i2c *i2c, u32 isr) { - writel(readl(_ICR(i2c)) | ICR_TB | ICR_ACKNAK, _ICR(i2c)); + ICR |= ICR_TB | ICR_ACKNAK; } static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr) @@ -482,13 +466,13 @@ static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr) * start condition... if this happens, we'd better back off * and stop holding the poor thing up */ - writel(readl(_ICR(i2c)) & ~(ICR_START|ICR_STOP), _ICR(i2c)); - writel(readl(_ICR(i2c)) | ICR_TB | ICR_ACKNAK, _ICR(i2c)); + ICR &= ~(ICR_START|ICR_STOP); + ICR |= ICR_TB | ICR_ACKNAK; timeout = 0x10000; while (1) { - if ((readl(_IBMR(i2c)) & 2) == 2) + if ((IBMR & 2) == 2) break; timeout--; @@ -499,7 +483,7 @@ static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr) } } - writel(readl(_ICR(i2c)) & ~ICR_SCLE, _ICR(i2c)); + ICR &= ~ICR_SCLE; } static void i2c_pxa_slave_stop(struct pxa_i2c *i2c) @@ -530,13 +514,13 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c) /* * Step 1: target slave address into IDBR */ - writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c)); + IDBR = i2c_pxa_addr_byte(i2c->msg); /* * Step 2: initiate the write. */ - icr = readl(_ICR(i2c)) & ~(ICR_STOP | ICR_ALDIE); - writel(icr | ICR_START | ICR_TB, _ICR(i2c)); + icr = ICR & ~(ICR_STOP | ICR_ALDIE); + ICR = icr | ICR_START | ICR_TB; } /* @@ -610,7 +594,7 @@ static void i2c_pxa_master_complete(struct pxa_i2c *i2c, int ret) static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) { - u32 icr = readl(_ICR(i2c)) & ~(ICR_START|ICR_STOP|ICR_ACKNAK|ICR_TB); + u32 icr = ICR & ~(ICR_START|ICR_STOP|ICR_ACKNAK|ICR_TB); again: /* @@ -661,7 +645,7 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) /* * Write mode. Write the next data byte. */ - writel(i2c->msg->buf[i2c->msg_ptr++], _IDBR(i2c)); + IDBR = i2c->msg->buf[i2c->msg_ptr++]; icr |= ICR_ALDIE | ICR_TB; @@ -691,7 +675,7 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) /* * Write the next address. */ - writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c)); + IDBR = i2c_pxa_addr_byte(i2c->msg); /* * And trigger a repeated start, and send the byte. @@ -712,18 +696,18 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) i2c->icrlog[i2c->irqlogidx-1] = icr; - writel(icr, _ICR(i2c)); + ICR = icr; show_state(i2c); } static void i2c_pxa_irq_rxfull(struct pxa_i2c *i2c, u32 isr) { - u32 icr = readl(_ICR(i2c)) & ~(ICR_START|ICR_STOP|ICR_ACKNAK|ICR_TB); + u32 icr = ICR & ~(ICR_START|ICR_STOP|ICR_ACKNAK|ICR_TB); /* * Read the byte. */ - i2c->msg->buf[i2c->msg_ptr++] = readl(_IDBR(i2c)); + i2c->msg->buf[i2c->msg_ptr++] = IDBR; if (i2c->msg_ptr < i2c->msg->len) { /* @@ -740,17 +724,17 @@ static void i2c_pxa_irq_rxfull(struct pxa_i2c *i2c, u32 isr) i2c->icrlog[i2c->irqlogidx-1] = icr; - writel(icr, _ICR(i2c)); + ICR = icr; } static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id) { struct pxa_i2c *i2c = dev_id; - u32 isr = readl(_ISR(i2c)); + u32 isr = ISR; if (i2c_debug > 2 && 0) { dev_dbg(&i2c->adap.dev, "%s: ISR=%08x, ICR=%08x, IBMR=%02x\n", - __func__, isr, readl(_ICR(i2c)), readl(_IBMR(i2c))); + __func__, isr, ICR, IBMR); decode_ISR(isr); } @@ -762,7 +746,7 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id) /* * Always clear all pending IRQs. */ - writel(isr & (ISR_SSD|ISR_ALD|ISR_ITE|ISR_IRF|ISR_SAD|ISR_BED), _ISR(i2c)); + ISR = isr & (ISR_SSD|ISR_ALD|ISR_ITE|ISR_IRF|ISR_SAD|ISR_BED); if (isr & ISR_SAD) i2c_pxa_slave_start(i2c, isr); @@ -795,7 +779,7 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num /* If the I2C controller is disabled we need to reset it (probably due to a suspend/resume destroying state). We do this here as we can then avoid worrying about resuming the controller before its users. */ - if (!(readl(_ICR(i2c)) & ICR_IUE)) + if (!(ICR & ICR_IUE)) i2c_pxa_reset(i2c); for (i = adap->retries; i >= 0; i--) { @@ -826,53 +810,28 @@ static const struct i2c_algorithm i2c_pxa_algorithm = { static struct pxa_i2c i2c_pxa = { .lock = SPIN_LOCK_UNLOCKED, + .wait = __WAIT_QUEUE_HEAD_INITIALIZER(i2c_pxa.wait), .adap = { .owner = THIS_MODULE, .algo = &i2c_pxa_algorithm, - .name = "pxa2xx-i2c.0", + .name = "pxa2xx-i2c", .retries = 5, }, }; -#define res_len(r) ((r)->end - (r)->start + 1) static int i2c_pxa_probe(struct platform_device *dev) { struct pxa_i2c *i2c = &i2c_pxa; - struct resource *res; #ifdef CONFIG_I2C_PXA_SLAVE struct i2c_pxa_platform_data *plat = dev->dev.platform_data; #endif int ret; - int irq; - - res = platform_get_resource(dev, IORESOURCE_MEM, 0); - irq = platform_get_irq(dev, 0); - if (res == NULL || irq < 0) - return -ENODEV; - - if (!request_mem_region(res->start, res_len(res), res->name)) - return -ENOMEM; - - i2c = kmalloc(sizeof(struct pxa_i2c), GFP_KERNEL); - if (!i2c) { - ret = -ENOMEM; - goto emalloc; - } - memcpy(i2c, &i2c_pxa, sizeof(struct pxa_i2c)); - init_waitqueue_head(&i2c->wait); - i2c->adap.name[strlen(i2c->adap.name) - 1] = '0' + dev->id % 10; - - i2c->reg_base = ioremap(res->start, res_len(res)); - if (!i2c->reg_base) { - ret = -EIO; - goto eremap; - } - - i2c->iobase = res->start; - i2c->iosize = res_len(res); - - i2c->irq = irq; +#ifdef CONFIG_PXA27x + pxa_gpio_mode(GPIO117_I2CSCL_MD); + pxa_gpio_mode(GPIO118_I2CSDA_MD); + udelay(100); +#endif i2c->slave_addr = I2C_PXA_SLAVE_ADDR; @@ -883,28 +842,11 @@ static int i2c_pxa_probe(struct platform_device *dev) } #endif - switch (dev->id) { - case 0: -#ifdef CONFIG_PXA27x - pxa_gpio_mode(GPIO117_I2CSCL_MD); - pxa_gpio_mode(GPIO118_I2CSDA_MD); -#endif - pxa_set_cken(CKEN14_I2C, 1); - break; -#ifdef CONFIG_PXA27x - case 1: - local_irq_disable(); - PCFR |= PCFR_PI2CEN; - local_irq_enable(); - pxa_set_cken(CKEN15_PWRI2C, 1); -#endif - } - - ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED, - i2c->adap.name, i2c); + pxa_set_cken(CKEN14_I2C, 1); + ret = request_irq(IRQ_I2C, i2c_pxa_handler, IRQF_DISABLED, + "pxa2xx-i2c", i2c); if (ret) - goto ereqirq; - + goto out; i2c_pxa_reset(i2c); @@ -914,7 +856,7 @@ static int i2c_pxa_probe(struct platform_device *dev) ret = i2c_add_adapter(&i2c->adap); if (ret < 0) { printk(KERN_INFO "I2C: Failed to add bus\n"); - goto eadapt; + goto err_irq; } platform_set_drvdata(dev, i2c); @@ -928,25 +870,9 @@ static int i2c_pxa_probe(struct platform_device *dev) #endif return 0; -eadapt: - free_irq(irq, i2c); -ereqirq: - switch (dev->id) { - case 0: - pxa_set_cken(CKEN14_I2C, 0); - break; -#ifdef CONFIG_PXA27x - case 1: - pxa_set_cken(CKEN15_PWRI2C, 0); - local_irq_disable(); - PCFR &= ~PCFR_PI2CEN; - local_irq_enable(); -#endif - } -eremap: - kfree(i2c); -emalloc: - release_mem_region(res->start, res_len(res)); + err_irq: + free_irq(IRQ_I2C, i2c); + out: return ret; } @@ -957,21 +883,8 @@ static int i2c_pxa_remove(struct platform_device *dev) platform_set_drvdata(dev, NULL); i2c_del_adapter(&i2c->adap); - free_irq(i2c->irq, i2c); - switch (dev->id) { - case 0: - pxa_set_cken(CKEN14_I2C, 0); - break; -#ifdef CONFIG_PXA27x - case 1: - pxa_set_cken(CKEN15_PWRI2C, 0); - local_irq_disable(); - PCFR &= ~PCFR_PI2CEN; - local_irq_enable(); -#endif - } - release_mem_region(i2c->iobase, i2c->iosize); - kfree(i2c); + free_irq(IRQ_I2C, i2c); + pxa_set_cken(CKEN14_I2C, 0); return 0; } diff --git a/trunk/drivers/usb/gadget/pxa2xx_udc.c b/trunk/drivers/usb/gadget/pxa2xx_udc.c index 3547f049237e..b78de9694665 100644 --- a/trunk/drivers/usb/gadget/pxa2xx_udc.c +++ b/trunk/drivers/usb/gadget/pxa2xx_udc.c @@ -156,7 +156,7 @@ static int is_vbus_present(void) struct pxa2xx_udc_mach_info *mach = the_controller->mach; if (mach->gpio_vbus) - return udc_gpio_get(mach->gpio_vbus); + return pxa_gpio_get(mach->gpio_vbus); if (mach->udc_is_connected) return mach->udc_is_connected(); return 1; @@ -168,7 +168,7 @@ static void pullup_off(void) struct pxa2xx_udc_mach_info *mach = the_controller->mach; if (mach->gpio_pullup) - udc_gpio_set(mach->gpio_pullup, 0); + pxa_gpio_set(mach->gpio_pullup, 0); else if (mach->udc_command) mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); } @@ -178,7 +178,7 @@ static void pullup_on(void) struct pxa2xx_udc_mach_info *mach = the_controller->mach; if (mach->gpio_pullup) - udc_gpio_set(mach->gpio_pullup, 1); + pxa_gpio_set(mach->gpio_pullup, 1); else if (mach->udc_command) mach->udc_command(PXA2XX_UDC_CMD_CONNECT); } @@ -1756,7 +1756,7 @@ lubbock_vbus_irq(int irq, void *_dev) static irqreturn_t udc_vbus_irq(int irq, void *_dev) { struct pxa2xx_udc *dev = _dev; - int vbus = udc_gpio_get(dev->mach->gpio_vbus); + int vbus = pxa_gpio_get(dev->mach->gpio_vbus); pxa2xx_udc_vbus_session(&dev->gadget, vbus); return IRQ_HANDLED; @@ -2546,13 +2546,15 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) dev->dev = &pdev->dev; dev->mach = pdev->dev.platform_data; if (dev->mach->gpio_vbus) { - udc_gpio_init_vbus(dev->mach->gpio_vbus); - vbus_irq = udc_gpio_to_irq(dev->mach->gpio_vbus); + vbus_irq = IRQ_GPIO(dev->mach->gpio_vbus & GPIO_MD_MASK_NR); + pxa_gpio_mode((dev->mach->gpio_vbus & GPIO_MD_MASK_NR) + | GPIO_IN); set_irq_type(vbus_irq, IRQT_BOTHEDGE); } else vbus_irq = 0; if (dev->mach->gpio_pullup) - udc_gpio_init_pullup(dev->mach->gpio_pullup); + pxa_gpio_mode((dev->mach->gpio_pullup & GPIO_MD_MASK_NR) + | GPIO_OUT | GPIO_DFLT_LOW); init_timer(&dev->timer); dev->timer.function = udc_watchdog; diff --git a/trunk/drivers/usb/gadget/pxa2xx_udc.h b/trunk/drivers/usb/gadget/pxa2xx_udc.h index 773e549aff3f..8e598c8bf4e3 100644 --- a/trunk/drivers/usb/gadget/pxa2xx_udc.h +++ b/trunk/drivers/usb/gadget/pxa2xx_udc.h @@ -177,6 +177,21 @@ struct pxa2xx_udc { static struct pxa2xx_udc *the_controller; +static inline int pxa_gpio_get(unsigned gpio) +{ + return (GPLR(gpio) & GPIO_bit(gpio)) != 0; +} + +static inline void pxa_gpio_set(unsigned gpio, int is_on) +{ + int mask = GPIO_bit(gpio); + + if (is_on) + GPSR(gpio) = mask; + else + GPCR(gpio) = mask; +} + /*-------------------------------------------------------------------------*/ /* diff --git a/trunk/include/asm-arm/arch-ixp4xx/udc.h b/trunk/include/asm-arm/arch-ixp4xx/udc.h index 79b850a3be47..dbdec36ff0d1 100644 --- a/trunk/include/asm-arm/arch-ixp4xx/udc.h +++ b/trunk/include/asm-arm/arch-ixp4xx/udc.h @@ -6,25 +6,3 @@ extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info); -static inline int udc_gpio_to_irq(unsigned gpio) -{ - return 0; -} - -static inline void udc_gpio_init_vbus(unsigned gpio) -{ -} - -static inline void udc_gpio_init_pullup(unsigned gpio) -{ -} - -static inline int udc_gpio_get(unsigned gpio) -{ - return 0; -} - -static inline void udc_gpio_set(unsigned gpio, int is_on) -{ -} - diff --git a/trunk/include/asm-arm/arch-pxa/pxa-regs.h b/trunk/include/asm-arm/arch-pxa/pxa-regs.h index 20576d10b3ec..e24f6b6c79ae 100644 --- a/trunk/include/asm-arm/arch-pxa/pxa-regs.h +++ b/trunk/include/asm-arm/arch-pxa/pxa-regs.h @@ -474,8 +474,8 @@ #define SADIV __REG(0x40400060) /* Audio Clock Divider Register. */ #define SADR __REG(0x40400080) /* Serial Audio Data Register (TX and RX FIFO access Register). */ -#define SACR0_RFTH(x) ((x) << 12) /* Rx FIFO Interrupt or DMA Trigger Threshold */ -#define SACR0_TFTH(x) ((x) << 8) /* Tx FIFO Interrupt or DMA Trigger Threshold */ +#define SACR0_RFTH(x) (x << 12) /* Rx FIFO Interrupt or DMA Trigger Threshold */ +#define SACR0_TFTH(x) (x << 8) /* Tx FIFO Interrupt or DMA Trigger Threshold */ #define SACR0_STRF (1 << 5) /* FIFO Select for EFWR Special Function */ #define SACR0_EFWR (1 << 4) /* Enable EFWR Function */ #define SACR0_RST (1 << 3) /* FIFO, i2s Register Reset */ @@ -1682,18 +1682,15 @@ #define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */ #define SSPSP_FSRT (1 << 25) /* Frame Sync Relative Timing */ -#define SSPSP_DMYSTOP(x) ((x) << 23) /* Dummy Stop */ -#define SSPSP_SFRMWDTH(x) ((x) << 16) /* Serial Frame Width */ -#define SSPSP_SFRMDLY(x) ((x) << 9) /* Serial Frame Delay */ -#define SSPSP_DMYSTRT(x) ((x) << 7) /* Dummy Start */ -#define SSPSP_STRTDLY(x) ((x) << 4) /* Start Delay */ +#define SSPSP_DMYSTOP(x) (x << 23) /* Dummy Stop */ +#define SSPSP_SFRMWDTH(x) (x << 16) /* Serial Frame Width */ +#define SSPSP_SFRMDLY(x) (x << 9) /* Serial Frame Delay */ +#define SSPSP_DMYSTRT(x) (x << 7) /* Dummy Start */ +#define SSPSP_STRTDLY(x) (x << 4) /* Start Delay */ #define SSPSP_ETDS (1 << 3) /* End of Transfer data State */ #define SSPSP_SFRMP (1 << 2) /* Serial Frame Polarity */ -#define SSPSP_SCMODE(x) ((x) << 0) /* Serial Bit Rate Clock Mode */ +#define SSPSP_SCMODE(x) (x << 0) /* Serial Bit Rate Clock Mode */ -#define SSACD_SCDB (1 << 3) /* SSPSYSCLK Divider Bypass */ -#define SSACD_ACPS(x) ((x) << 4) /* Audio clock PLL select */ -#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */ #define SSCR0_P1 __REG(0x41000000) /* SSP Port 1 Control Register 0 */ #define SSCR1_P1 __REG(0x41000004) /* SSP Port 1 Control Register 1 */ diff --git a/trunk/include/asm-arm/arch-pxa/udc.h b/trunk/include/asm-arm/arch-pxa/udc.h index 8bc6f9c3e3ea..646480d37256 100644 --- a/trunk/include/asm-arm/arch-pxa/udc.h +++ b/trunk/include/asm-arm/arch-pxa/udc.h @@ -9,33 +9,3 @@ extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); -static inline int udc_gpio_to_irq(unsigned gpio) -{ - return IRQ_GPIO(gpio & GPIO_MD_MASK_NR); -} - -static inline void udc_gpio_init_vbus(unsigned gpio) -{ - pxa_gpio_mode((gpio & GPIO_MD_MASK_NR) | GPIO_IN); -} - -static inline void udc_gpio_init_pullup(unsigned gpio) -{ - pxa_gpio_mode((gpio & GPIO_MD_MASK_NR) | GPIO_OUT | GPIO_DFLT_LOW); -} - -static inline int udc_gpio_get(unsigned gpio) -{ - return (GPLR(gpio) & GPIO_bit(gpio)) != 0; -} - -static inline void udc_gpio_set(unsigned gpio, int is_on) -{ - int mask = GPIO_bit(gpio); - - if (is_on) - GPSR(gpio) = mask; - else - GPCR(gpio) = mask; -} -