diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 17:48:00 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 17:48:00 -0800 |
commit | 1480d0a31db62b9803f829cc0e5cc71935ffe3cc (patch) | |
tree | c7c18939b5a0d51f23f7ca8606ecf00fa69741aa /drivers | |
parent | fc8e3d177fa8073895d37b50282489dbeec89eb1 (diff) | |
parent | 46595ffbfc8ba79f27cdf8a029ee068b3b34c69f (diff) | |
download | linux-1480d0a31db62b9803f829cc0e5cc71935ffe3cc.tar.gz linux-1480d0a31db62b9803f829cc0e5cc71935ffe3cc.tar.bz2 linux-1480d0a31db62b9803f829cc0e5cc71935ffe3cc.zip |
Merge master.kernel.org:/home/rmk/linux-2.6-arm
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acorn/char/pcf8583.c | 80 | ||||
-rw-r--r-- | drivers/mfd/ucb1x00-ts.c | 74 | ||||
-rw-r--r-- | drivers/net/irda/pxaficp_ir.c | 14 | ||||
-rw-r--r-- | drivers/pcmcia/Makefile | 1 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_sharpsl.c | 31 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_generic.c | 7 |
6 files changed, 158 insertions, 49 deletions
diff --git a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c index 2b850e5860a0..e26f007a1417 100644 --- a/drivers/acorn/char/pcf8583.c +++ b/drivers/acorn/char/pcf8583.c @@ -9,6 +9,7 @@ * * Driver for PCF8583 RTC & RAM chip */ +#include <linux/module.h> #include <linux/i2c.h> #include <linux/slab.h> #include <linux/string.h> @@ -32,7 +33,8 @@ static struct i2c_client_address_data addr_data = { .forces = forces, }; -#define DAT(x) ((unsigned int)(x->dev.driver_data)) +#define set_ctrl(x, v) i2c_set_clientdata(x, (void *)(unsigned int)(v)) +#define get_ctrl(x) ((unsigned int)i2c_get_clientdata(x)) static int pcf8583_attach(struct i2c_adapter *adap, int addr, int kind) @@ -40,8 +42,17 @@ pcf8583_attach(struct i2c_adapter *adap, int addr, int kind) struct i2c_client *c; unsigned char buf[1], ad[1] = { 0 }; struct i2c_msg msgs[2] = { - { addr, 0, 1, ad }, - { addr, I2C_M_RD, 1, buf } + { + .addr = addr, + .flags = 0, + .len = 1, + .buf = ad, + }, { + .addr = addr, + .flags = I2C_M_RD, + .len = 1, + .buf = buf, + } }; c = kmalloc(sizeof(*c), GFP_KERNEL); @@ -54,7 +65,7 @@ pcf8583_attach(struct i2c_adapter *adap, int addr, int kind) c->driver = &pcf8583_driver; if (i2c_transfer(c->adapter, msgs, 2) == 2) - DAT(c) = buf[0]; + set_ctrl(c, buf[0]); return i2c_attach_client(c); } @@ -78,8 +89,17 @@ pcf8583_get_datetime(struct i2c_client *client, struct rtc_tm *dt) { unsigned char buf[8], addr[1] = { 1 }; struct i2c_msg msgs[2] = { - { client->addr, 0, 1, addr }, - { client->addr, I2C_M_RD, 6, buf } + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = addr, + }, { + .addr = client->addr, + .flags = I2C_M_RD, + .len = 6, + .buf = buf, + } }; int ret = -EIO; @@ -113,7 +133,7 @@ pcf8583_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo) int ret, len = 6; buf[0] = 0; - buf[1] = DAT(client) | 0x80; + buf[1] = get_ctrl(client) | 0x80; buf[2] = BIN_TO_BCD(dt->cs); buf[3] = BIN_TO_BCD(dt->secs); buf[4] = BIN_TO_BCD(dt->mins); @@ -129,7 +149,7 @@ pcf8583_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo) if (ret == len) ret = 0; - buf[1] = DAT(client); + buf[1] = get_ctrl(client); i2c_master_send(client, (char *)buf, 2); return ret; @@ -138,7 +158,7 @@ pcf8583_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo) static int pcf8583_get_ctrl(struct i2c_client *client, unsigned char *ctrl) { - *ctrl = DAT(client); + *ctrl = get_ctrl(client); return 0; } @@ -149,7 +169,7 @@ pcf8583_set_ctrl(struct i2c_client *client, unsigned char *ctrl) buf[0] = 0; buf[1] = *ctrl; - DAT(client) = *ctrl; + set_ctrl(client, *ctrl); return i2c_master_send(client, (char *)buf, 2); } @@ -159,15 +179,23 @@ pcf8583_read_mem(struct i2c_client *client, struct mem *mem) { unsigned char addr[1]; struct i2c_msg msgs[2] = { - { client->addr, 0, 1, addr }, - { client->addr, I2C_M_RD, 0, mem->data } + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = addr, + }, { + .addr = client->addr, + .flags = I2C_M_RD, + .len = mem->nr, + .buf = mem->data, + } }; if (mem->loc < 8) return -EINVAL; addr[0] = mem->loc; - msgs[1].len = mem->nr; return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO; } @@ -177,15 +205,23 @@ pcf8583_write_mem(struct i2c_client *client, struct mem *mem) { unsigned char addr[1]; struct i2c_msg msgs[2] = { - { client->addr, 0, 1, addr }, - { client->addr, 0, 0, mem->data } + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = addr, + }, { + .addr = client->addr, + .flags = I2C_M_NOSTART, + .len = mem->nr, + .buf = mem->data, + } }; if (mem->loc < 8) return -EINVAL; addr[0] = mem->loc; - msgs[1].len = mem->nr; return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO; } @@ -234,4 +270,14 @@ static __init int pcf8583_init(void) return i2c_add_driver(&pcf8583_driver); } -__initcall(pcf8583_init); +static __exit void pcf8583_exit(void) +{ + i2c_del_driver(&pcf8583_driver); +} + +module_init(pcf8583_init); +module_exit(pcf8583_exit); + +MODULE_AUTHOR("Russell King"); +MODULE_DESCRIPTION("PCF8583 I2C RTC driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c index 585cded3d365..a984c0efabf0 100644 --- a/drivers/mfd/ucb1x00-ts.c +++ b/drivers/mfd/ucb1x00-ts.c @@ -32,9 +32,12 @@ #include <linux/suspend.h> #include <linux/slab.h> #include <linux/kthread.h> +#include <linux/delay.h> #include <asm/dma.h> #include <asm/semaphore.h> +#include <asm/arch/collie.h> +#include <asm/mach-types.h> #include "ucb1x00.h" @@ -85,12 +88,23 @@ static inline void ucb1x00_ts_mode_int(struct ucb1x00_ts *ts) */ static inline unsigned int ucb1x00_ts_read_pressure(struct ucb1x00_ts *ts) { - ucb1x00_reg_write(ts->ucb, UCB_TS_CR, - UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | - UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | - UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); + if (machine_is_collie()) { + ucb1x00_io_write(ts->ucb, COLLIE_TC35143_GPIO_TBL_CHK, 0); + ucb1x00_reg_write(ts->ucb, UCB_TS_CR, + UCB_TS_CR_TSPX_POW | UCB_TS_CR_TSMX_POW | + UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); - return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPY, ts->adcsync); + udelay(55); + + return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_AD2, ts->adcsync); + } else { + ucb1x00_reg_write(ts->ucb, UCB_TS_CR, + UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | + UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | + UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); + + return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPY, ts->adcsync); + } } /* @@ -101,12 +115,16 @@ static inline unsigned int ucb1x00_ts_read_pressure(struct ucb1x00_ts *ts) */ static inline unsigned int ucb1x00_ts_read_xpos(struct ucb1x00_ts *ts) { - ucb1x00_reg_write(ts->ucb, UCB_TS_CR, - UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | - UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); - ucb1x00_reg_write(ts->ucb, UCB_TS_CR, - UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | - UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); + if (machine_is_collie()) + ucb1x00_io_write(ts->ucb, 0, COLLIE_TC35143_GPIO_TBL_CHK); + else { + ucb1x00_reg_write(ts->ucb, UCB_TS_CR, + UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | + UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); + ucb1x00_reg_write(ts->ucb, UCB_TS_CR, + UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | + UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); + } ucb1x00_reg_write(ts->ucb, UCB_TS_CR, UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); @@ -124,12 +142,17 @@ static inline unsigned int ucb1x00_ts_read_xpos(struct ucb1x00_ts *ts) */ static inline unsigned int ucb1x00_ts_read_ypos(struct ucb1x00_ts *ts) { - ucb1x00_reg_write(ts->ucb, UCB_TS_CR, - UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | - UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); - ucb1x00_reg_write(ts->ucb, UCB_TS_CR, - UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | - UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); + if (machine_is_collie()) + ucb1x00_io_write(ts->ucb, 0, COLLIE_TC35143_GPIO_TBL_CHK); + else { + ucb1x00_reg_write(ts->ucb, UCB_TS_CR, + UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | + UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); + ucb1x00_reg_write(ts->ucb, UCB_TS_CR, + UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | + UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); + } + ucb1x00_reg_write(ts->ucb, UCB_TS_CR, UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); @@ -163,6 +186,15 @@ static inline unsigned int ucb1x00_ts_read_yres(struct ucb1x00_ts *ts) return ucb1x00_adc_read(ts->ucb, 0, ts->adcsync); } +static inline int ucb1x00_ts_pen_down(struct ucb1x00_ts *ts) +{ + unsigned int val = ucb1x00_reg_read(ts->ucb, UCB_TS_CR); + if (machine_is_collie()) + return (!(val & (UCB_TS_CR_TSPX_LOW))); + else + return (val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW)); +} + /* * This is a RT kernel thread that handles the ADC accesses * (mainly so we can use semaphores in the UCB1200 core code @@ -186,7 +218,7 @@ static int ucb1x00_thread(void *_ts) add_wait_queue(&ts->irq_wait, &wait); while (!kthread_should_stop()) { - unsigned int x, y, p, val; + unsigned int x, y, p; signed long timeout; ts->restart = 0; @@ -206,12 +238,12 @@ static int ucb1x00_thread(void *_ts) msleep(10); ucb1x00_enable(ts->ucb); - val = ucb1x00_reg_read(ts->ucb, UCB_TS_CR); - if (val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW)) { + + if (ucb1x00_ts_pen_down(ts)) { set_task_state(tsk, TASK_INTERRUPTIBLE); - ucb1x00_enable_irq(ts->ucb, UCB_IRQ_TSPX, UCB_FALLING); + ucb1x00_enable_irq(ts->ucb, UCB_IRQ_TSPX, machine_is_collie() ? UCB_RISING : UCB_FALLING); ucb1x00_disable(ts->ucb); /* diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index aef80f5e7c9c..b886b07412a6 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c @@ -704,15 +704,12 @@ static int pxa_irda_stop(struct net_device *dev) return 0; } -static int pxa_irda_suspend(struct device *_dev, pm_message_t state, u32 level) +static int pxa_irda_suspend(struct device *_dev, pm_message_t state) { struct net_device *dev = dev_get_drvdata(_dev); struct pxa_irda *si; - if (!dev || level != SUSPEND_DISABLE) - return 0; - - if (netif_running(dev)) { + if (dev && netif_running(dev)) { si = netdev_priv(dev); netif_device_detach(dev); pxa_irda_shutdown(si); @@ -721,15 +718,12 @@ static int pxa_irda_suspend(struct device *_dev, pm_message_t state, u32 level) return 0; } -static int pxa_irda_resume(struct device *_dev, u32 level) +static int pxa_irda_resume(struct device *_dev) { struct net_device *dev = dev_get_drvdata(_dev); struct pxa_irda *si; - if (!dev || level != RESUME_ENABLE) - return 0; - - if (netif_running(dev)) { + if (dev && netif_running(dev)) { si = netdev_priv(dev); pxa_irda_startup(si); netif_device_attach(dev); diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 77ecee7f987b..da7a8f2dab24 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile @@ -59,6 +59,7 @@ sa1111_cs-$(CONFIG_SA1100_JORNADA720) += sa1100_jornada720.o sa1100_cs-y += sa1100_generic.o sa1100_cs-$(CONFIG_SA1100_ASSABET) += sa1100_assabet.o sa1100_cs-$(CONFIG_SA1100_CERF) += sa1100_cerf.o +sa1100_cs-$(CONFIG_SA1100_COLLIE) += pxa2xx_sharpsl.o sa1100_cs-$(CONFIG_SA1100_H3600) += sa1100_h3600.o sa1100_cs-$(CONFIG_SA1100_SHANNON) += sa1100_shannon.o sa1100_cs-$(CONFIG_SA1100_SIMPAD) += sa1100_simpad.o diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index a1178a600e3c..bd924336a49f 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c @@ -18,10 +18,15 @@ #include <linux/interrupt.h> #include <linux/device.h> +#include <asm/mach-types.h> #include <asm/hardware.h> #include <asm/irq.h> #include <asm/hardware/scoop.h> -#include <asm/arch/pxa-regs.h> +#ifdef CONFIG_SA1100_COLLIE +#include <asm/arch-sa1100/collie.h> +#else +#include <asm/arch-pxa/pxa-regs.h> +#endif #include "soc_common.h" @@ -38,6 +43,7 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) { int ret; +#ifndef CONFIG_SA1100_COLLIE /* * Setup default state of GPIO outputs * before we enable them as outputs. @@ -60,6 +66,7 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) pxa_gpio_mode(GPIO55_nPREG_MD); pxa_gpio_mode(GPIO56_nPWAIT_MD); pxa_gpio_mode(GPIO57_nIOIS16_MD); +#endif /* Register interrupts */ if (scoop_devs[skt->nr].cd_irq >= 0) { @@ -213,12 +220,20 @@ static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt) write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_IMR, 0x00C0); write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_MCR, 0x0101); scoop_devs[skt->nr].keep_vs = NO_KEEP_VS; + + if (machine_is_collie()) + /* We need to disable SS_OUTPUT_ENA here. */ + write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR, read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR) & ~0x0080); } static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) { /* CF_BUS_OFF */ sharpsl_pcmcia_init_reset(&scoop_devs[skt->nr]); + + if (machine_is_collie()) + /* We need to disable SS_OUTPUT_ENA here. */ + write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR, read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR) & ~0x0080); } static struct pcmcia_low_level sharpsl_pcmcia_ops = { @@ -235,6 +250,19 @@ static struct pcmcia_low_level sharpsl_pcmcia_ops = { static struct platform_device *sharpsl_pcmcia_device; +#ifdef CONFIG_SA1100_COLLIE +int __init pcmcia_collie_init(struct device *dev) +{ + int ret = -ENODEV; + + if (machine_is_collie()) + ret = sa11xx_drv_pcmcia_probe(dev, &sharpsl_pcmcia_ops, 0, 1); + + return ret; +} + +#else + static int __init sharpsl_pcmcia_init(void) { int ret; @@ -269,6 +297,7 @@ static void __exit sharpsl_pcmcia_exit(void) fs_initcall(sharpsl_pcmcia_init); module_exit(sharpsl_pcmcia_exit); +#endif MODULE_DESCRIPTION("Sharp SL Series PCMCIA Support"); MODULE_LICENSE("GPL"); diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index b768fa81f043..acf60ffc8a12 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c @@ -38,8 +38,12 @@ #include <pcmcia/cs.h> #include <pcmcia/ss.h> +#include <asm/hardware/scoop.h> + #include "sa1100_generic.h" +int __init pcmcia_collie_init(struct device *dev); + static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = { #ifdef CONFIG_SA1100_ASSABET pcmcia_assabet_init, @@ -56,6 +60,9 @@ static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = { #ifdef CONFIG_SA1100_SIMPAD pcmcia_simpad_init, #endif +#ifdef CONFIG_SA1100_COLLIE + pcmcia_collie_init, +#endif }; static int sa11x0_drv_pcmcia_probe(struct device *dev) |