]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Revert "ARM: sa11x0: Implement autoloading of codec and codec pdata for mcp bus."
authorRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 20 Jan 2012 17:38:58 +0000 (17:38 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 20 Jan 2012 17:38:58 +0000 (17:38 +0000)
This reverts commit 5dd7bf59e0e8563265b3e5b33276099ef628fcc7.

Conflicts:

scripts/mod/file2alias.c

This change is wrong on many levels.  First and foremost, it causes a
regression.  On boot on Assabet, which this patch gives a codec id of
'ucb1x00', it gives:

ucb1x00 ID not found: 1005

0x1005 is a valid ID for the UCB1300 device.

Secondly, this patch is way over the top in terms of complexity.  The
only device which has been seen to be connected with this MCP code is
the UCB1x00 (UCB1200, UCB1300 etc) devices, and they all use the same
driver.  Adding a match table, requiring the codec string to match the
hardware ID read out of the ID register, etc is completely over the top
when we can just read the hardware ID register.

15 files changed:
arch/arm/mach-sa1100/assabet.c
arch/arm/mach-sa1100/cerf.c
arch/arm/mach-sa1100/collie.c
arch/arm/mach-sa1100/include/mach/mcp.h
arch/arm/mach-sa1100/lart.c
arch/arm/mach-sa1100/shannon.c
arch/arm/mach-sa1100/simpad.c
drivers/mfd/mcp-core.c
drivers/mfd/mcp-sa11x0.c
drivers/mfd/ucb1x00-core.c
drivers/mfd/ucb1x00-ts.c
include/linux/mfd/mcp.h
include/linux/mfd/ucb1x00.h
include/linux/mod_devicetable.h
scripts/mod/file2alias.c

index d8aa1c28353b841f2d9e80b34bbb383a6f96244c..0c4b76ab4d8eba0037e305d5d8f9b17b36074fa7 100644 (file)
@@ -202,7 +202,6 @@ static struct irda_platform_data assabet_irda_data = {
 static struct mcp_plat_data assabet_mcp_data = {
        .mccr0          = MCCR0_ADM,
        .sclk_rate      = 11981000,
-       .codec          = "ucb1x00",
 };
 
 static void __init assabet_init(void)
index fcadc4cafe9a79a6058efb236daf8152c453912b..11bb6d0b9be377b6c926f3e759a03a21d2e9ffff 100644 (file)
@@ -124,7 +124,6 @@ static void __init cerf_map_io(void)
 static struct mcp_plat_data cerf_mcp_data = {
        .mccr0          = MCCR0_ADM,
        .sclk_rate      = 11981000,
-       .codec          = "ucb1x00",
 };
 
 static void __init cerf_init(void)
index 6b7c74b304cf03d29b72ee41d18ef3362d1b2e46..b9060e236def9e90204fa2be99734ea3a4fc6417 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/timer.h>
 #include <linux/gpio.h>
 #include <linux/pda_power.h>
-#include <linux/mfd/ucb1x00.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -86,15 +85,10 @@ static struct scoop_pcmcia_config collie_pcmcia_config = {
        .num_devs       = 1,
 };
 
-static struct ucb1x00_plat_data collie_ucb1x00_data = {
-       .gpio_base      = COLLIE_TC35143_GPIO_BASE,
-};
-
 static struct mcp_plat_data collie_mcp_data = {
        .mccr0          = MCCR0_ADM | MCCR0_ExtClk,
        .sclk_rate      = 9216000,
-       .codec          = "ucb1x00",
-       .codec_pdata    = &collie_ucb1x00_data,
+       .gpio_base      = COLLIE_TC35143_GPIO_BASE,
 };
 
 /*
index 586cec898b35ae8578025727e3ec4e2b679964e0..ed1a331508a754bf2e802f537689a97ee2b524c5 100644 (file)
@@ -17,8 +17,6 @@ struct mcp_plat_data {
        u32 mccr1;
        unsigned int sclk_rate;
        int gpio_base;
-       const char *codec;
-       void *codec_pdata;
 };
 
 #endif
index 48a8f4ef0fcd921ced58b8e624d927226d6014bd..af4e2761f3dbf4a6254bfab53f98080334e5f387 100644 (file)
@@ -24,7 +24,6 @@
 static struct mcp_plat_data lart_mcp_data = {
        .mccr0          = MCCR0_ADM,
        .sclk_rate      = 11981000,
-       .codec          = "ucb1x00",
 };
 
 static void __init lart_init(void)
index 3807c91352722f053d76522a09514c8ad42cbd98..318b2b766a0b3ee7b8921c2904b65c0fdd551c8c 100644 (file)
@@ -55,7 +55,6 @@ static struct resource shannon_flash_resource = {
 static struct mcp_plat_data shannon_mcp_data = {
        .mccr0          = MCCR0_ADM,
        .sclk_rate      = 11981000,
-       .codec          = "ucb1x00",
 };
 
 static void __init shannon_init(void)
index d9b765c441f6f885eca25484a921f331fb6a3171..e17c04d6e32428af6aa7c8eb1fbc35ca6d7a02d8 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/mtd/partitions.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
-#include <linux/mfd/ucb1x00.h>
 
 #include <asm/irq.h>
 #include <mach/hardware.h>
@@ -188,15 +187,10 @@ static struct resource simpad_flash_resources [] = {
        }
 };
 
-static struct ucb1x00_plat_data simpad_ucb1x00_data = {
-       .gpio_base      = SIMPAD_UCB1X00_GPIO_BASE,
-};
-
 static struct mcp_plat_data simpad_mcp_data = {
        .mccr0          = MCCR0_ADM,
        .sclk_rate      = 11981000,
-       .codec          = "ucb1300",
-       .codec_pdata    = &simpad_ucb1x00_data,
+       .gpio_base      = SIMPAD_UCB1X00_GPIO_BASE,
 };
 
 
index 63be60bc3455396e764fa57661f497d5670b04a8..84815f9ef636eb0e91c26c1869094bb5c83977d0 100644 (file)
 #define to_mcp(d)              container_of(d, struct mcp, attached_device)
 #define to_mcp_driver(d)       container_of(d, struct mcp_driver, drv)
 
-static const struct mcp_device_id *mcp_match_id(const struct mcp_device_id *id,
-                                               const char *codec)
-{
-       while (id->name[0]) {
-               if (strcmp(codec, id->name) == 0)
-                       return id;
-               id++;
-       }
-       return NULL;
-}
-
-const struct mcp_device_id *mcp_get_device_id(const struct mcp *mcp)
-{
-       const struct mcp_driver *driver =
-               to_mcp_driver(mcp->attached_device.driver);
-
-       return mcp_match_id(driver->id_table, mcp->codec);
-}
-EXPORT_SYMBOL(mcp_get_device_id);
-
 static int mcp_bus_match(struct device *dev, struct device_driver *drv)
 {
-       const struct mcp *mcp = to_mcp(dev);
-       const struct mcp_driver *driver = to_mcp_driver(drv);
-
-       if (driver->id_table)
-               return !!mcp_match_id(driver->id_table, mcp->codec);
-
-       return 0;
+       return 1;
 }
 
 static int mcp_bus_probe(struct device *dev)
@@ -100,18 +74,9 @@ static int mcp_bus_resume(struct device *dev)
        return ret;
 }
 
-static int mcp_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
-{
-       struct mcp *mcp = to_mcp(dev);
-
-       add_uevent_var(env, "MODALIAS=%s%s", MCP_MODULE_PREFIX, mcp->codec);
-       return 0;
-}
-
 static struct bus_type mcp_bus_type = {
        .name           = "mcp",
        .match          = mcp_bus_match,
-       .uevent         = mcp_bus_uevent,
        .probe          = mcp_bus_probe,
        .remove         = mcp_bus_remove,
        .suspend        = mcp_bus_suspend,
@@ -247,14 +212,9 @@ struct mcp *mcp_host_alloc(struct device *parent, size_t size)
 }
 EXPORT_SYMBOL(mcp_host_alloc);
 
-int mcp_host_register(struct mcp *mcp, void *pdata)
+int mcp_host_register(struct mcp *mcp)
 {
-       if (!mcp->codec)
-               return -EINVAL;
-
-       mcp->attached_device.platform_data = pdata;
        dev_set_name(&mcp->attached_device, "mcp0");
-       request_module("%s%s", MCP_MODULE_PREFIX, mcp->codec);
        return device_register(&mcp->attached_device);
 }
 EXPORT_SYMBOL(mcp_host_register);
index da4e077a1bee62bb8dcb1f2315bd7674ae57500f..02c53a0766c4275d7496ece5b96cb20b0e1ddc49 100644 (file)
@@ -146,9 +146,6 @@ static int mcp_sa11x0_probe(struct platform_device *pdev)
        if (!data)
                return -ENODEV;
 
-       if (!data->codec)
-               return -ENODEV;
-
        if (!request_mem_region(0x80060000, 0x60, "sa11x0-mcp"))
                return -EBUSY;
 
@@ -165,7 +162,7 @@ static int mcp_sa11x0_probe(struct platform_device *pdev)
        mcp->dma_audio_wr       = DMA_Ser4MCP0Wr;
        mcp->dma_telco_rd       = DMA_Ser4MCP1Rd;
        mcp->dma_telco_wr       = DMA_Ser4MCP1Wr;
-       mcp->codec              = data->codec;
+       mcp->gpio_base          = data->gpio_base;
 
        platform_set_drvdata(pdev, mcp);
 
@@ -198,7 +195,7 @@ static int mcp_sa11x0_probe(struct platform_device *pdev)
        mcp->rw_timeout = (64 * 3 * 1000000 + mcp->sclk_rate - 1) /
                          mcp->sclk_rate;
 
-       ret = mcp_host_register(mcp, data->codec_pdata);
+       ret = mcp_host_register(mcp);
        if (ret == 0)
                goto out;
 
index 91c4f25e0e558fe20a04ae10e1554d98f0f3fff9..b281217334eb3c68d35c7695b8104dd327e6bcf6 100644 (file)
@@ -36,15 +36,6 @@ static DEFINE_MUTEX(ucb1x00_mutex);
 static LIST_HEAD(ucb1x00_drivers);
 static LIST_HEAD(ucb1x00_devices);
 
-static struct mcp_device_id ucb1x00_id[] = {
-       { "ucb1x00", 0 },  /* auto-detection */
-       { "ucb1200", UCB_ID_1200 },
-       { "ucb1300", UCB_ID_1300 },
-       { "tc35143", UCB_ID_TC35143 },
-       { }
-};
-MODULE_DEVICE_TABLE(mcp, ucb1x00_id);
-
 /**
  *     ucb1x00_io_set_dir - set IO direction
  *     @ucb: UCB1x00 structure describing chip
@@ -536,33 +527,17 @@ static struct class ucb1x00_class = {
 
 static int ucb1x00_probe(struct mcp *mcp)
 {
-       const struct mcp_device_id *mid;
        struct ucb1x00 *ucb;
        struct ucb1x00_driver *drv;
-       struct ucb1x00_plat_data *pdata;
        unsigned int id;
        int ret = -ENODEV;
        int temp;
 
        mcp_enable(mcp);
        id = mcp_reg_read(mcp, UCB_ID);
-       mid = mcp_get_device_id(mcp);
 
-       if (mid && mid->driver_data) {
-               if (id != mid->driver_data) {
-                       printk(KERN_WARNING "%s wrong ID %04x found: %04x\n",
-                               mid->name, (unsigned int) mid->driver_data, id);
-                       goto err_disable;
-               }
-       } else {
-               mid = &ucb1x00_id[1];
-               while (mid->driver_data) {
-                       if (id == mid->driver_data)
-                               break;
-                       mid++;
-               }
-               printk(KERN_WARNING "%s ID not found: %04x\n",
-                       ucb1x00_id[0].name, id);
+       if (id != UCB_ID_1200 && id != UCB_ID_1300 && id != UCB_ID_TC35143) {
+               printk(KERN_WARNING "UCB1x00 ID not found: %04x\n", id);
                goto err_disable;
        }
 
@@ -571,28 +546,28 @@ static int ucb1x00_probe(struct mcp *mcp)
        if (!ucb)
                goto err_disable;
 
-       pdata = mcp->attached_device.platform_data;
+
        ucb->dev.class = &ucb1x00_class;
        ucb->dev.parent = &mcp->attached_device;
-       dev_set_name(&ucb->dev, mid->name);
+       dev_set_name(&ucb->dev, "ucb1x00");
 
        spin_lock_init(&ucb->lock);
        spin_lock_init(&ucb->io_lock);
        sema_init(&ucb->adc_sem, 1);
 
-       ucb->id  = mid;
+       ucb->id  = id;
        ucb->mcp = mcp;
        ucb->irq = ucb1x00_detect_irq(ucb);
        if (ucb->irq == NO_IRQ) {
-               printk(KERN_ERR "%s: IRQ probe failed\n", mid->name);
+               printk(KERN_ERR "UCB1x00: IRQ probe failed\n");
                ret = -ENODEV;
                goto err_free;
        }
 
        ucb->gpio.base = -1;
-       if (pdata && (pdata->gpio_base >= 0)) {
+       if (mcp->gpio_base != 0) {
                ucb->gpio.label = dev_name(&ucb->dev);
-               ucb->gpio.base = pdata->gpio_base;
+               ucb->gpio.base = mcp->gpio_base;
                ucb->gpio.ngpio = 10;
                ucb->gpio.set = ucb1x00_gpio_set;
                ucb->gpio.get = ucb1x00_gpio_get;
@@ -605,10 +580,10 @@ static int ucb1x00_probe(struct mcp *mcp)
                dev_info(&ucb->dev, "gpio_base not set so no gpiolib support");
 
        ret = request_irq(ucb->irq, ucb1x00_irq, IRQF_TRIGGER_RISING,
-                         mid->name, ucb);
+                         "UCB1x00", ucb);
        if (ret) {
-               printk(KERN_ERR "%s: unable to grab irq%d: %d\n",
-                       mid->name, ucb->irq, ret);
+               printk(KERN_ERR "ucb1x00: unable to grab irq%d: %d\n",
+                       ucb->irq, ret);
                goto err_gpio;
        }
 
@@ -730,7 +705,6 @@ static struct mcp_driver ucb1x00_driver = {
        .remove         = ucb1x00_remove,
        .suspend        = ucb1x00_suspend,
        .resume         = ucb1x00_resume,
-       .id_table       = ucb1x00_id,
 };
 
 static int __init ucb1x00_init(void)
index 40ec3c118868d7f02e104d2ed10e2f766840a0f4..38ffbd50a0d27bc24cbc9826c5dae1e95a54b560 100644 (file)
@@ -382,7 +382,7 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
        ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
 
        idev->name       = "Touchscreen panel";
-       idev->id.product = ts->ucb->id->driver_data;
+       idev->id.product = ts->ucb->id;
        idev->open       = ucb1x00_ts_open;
        idev->close      = ucb1x00_ts_close;
 
index 1515e64e3663abd1a557e339c0eb57d6f13d8117..ee496708e38b9a0de245a3c9f59d67377dc6fd59 100644 (file)
@@ -10,7 +10,6 @@
 #ifndef MCP_H
 #define MCP_H
 
-#include <linux/mod_devicetable.h>
 #include <mach/dma.h>
 
 struct mcp_ops;
@@ -27,7 +26,7 @@ struct mcp {
        dma_device_t    dma_telco_rd;
        dma_device_t    dma_telco_wr;
        struct device   attached_device;
-       const char      *codec;
+       int             gpio_base;
 };
 
 struct mcp_ops {
@@ -45,11 +44,10 @@ void mcp_reg_write(struct mcp *, unsigned int, unsigned int);
 unsigned int mcp_reg_read(struct mcp *, unsigned int);
 void mcp_enable(struct mcp *);
 void mcp_disable(struct mcp *);
-const struct mcp_device_id *mcp_get_device_id(const struct mcp *mcp);
 #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate)
 
 struct mcp *mcp_host_alloc(struct device *, size_t);
-int mcp_host_register(struct mcp *, void *);
+int mcp_host_register(struct mcp *);
 void mcp_host_unregister(struct mcp *);
 
 struct mcp_driver {
@@ -58,7 +56,6 @@ struct mcp_driver {
        void (*remove)(struct mcp *);
        int (*suspend)(struct mcp *, pm_message_t);
        int (*resume)(struct mcp *);
-       const struct mcp_device_id *id_table;
 };
 
 int mcp_driver_register(struct mcp_driver *);
index bc19e5fb7ea8f1791960e961e7a9dab803f15a54..4321f044d1e45e1ad5cdaf20eba1440427b1fb5e 100644 (file)
 #define UCB_MODE_DYN_VFLAG_ENA (1 << 12)
 #define UCB_MODE_AUD_OFF_CAN   (1 << 13)
 
-struct ucb1x00_plat_data {
-       int             gpio_base;
-};
 
 struct ucb1x00_irq {
        void *devid;
@@ -119,7 +116,7 @@ struct ucb1x00 {
        unsigned int            irq;
        struct semaphore        adc_sem;
        spinlock_t              io_lock;
-       const struct mcp_device_id *id;
+       u16                     id;
        u16                     io_dir;
        u16                     io_out;
        u16                     adc_cr;
index b29e7f6f8fa580d9c4c39b4fca596a98e249b2d4..83ac0713ed0aa9a2a0c79b95013c5bfd42137d9c 100644 (file)
@@ -436,17 +436,6 @@ struct spi_device_id {
                        __attribute__((aligned(sizeof(kernel_ulong_t))));
 };
 
-/* mcp */
-
-#define MCP_NAME_SIZE  20
-#define MCP_MODULE_PREFIX "mcp:"
-
-struct mcp_device_id {
-       char name[MCP_NAME_SIZE];
-       kernel_ulong_t driver_data      /* Data private to the driver */
-                       __attribute__((aligned(sizeof(kernel_ulong_t))));
-};
-
 /* dmi */
 enum dmi_field {
        DMI_NONE,
index c0e14b3f2306f77b6e85d2d6f7f25a70b6b41a22..e8c9695777689eece29e90e3db66b2cc9d59c80e 100644 (file)
@@ -823,16 +823,6 @@ static int do_spi_entry(const char *filename, struct spi_device_id *id,
 }
 ADD_TO_DEVTABLE("spi", struct spi_device_id, do_spi_entry);
 
-/* Looks like: mcp:S */
-static int do_mcp_entry(const char *filename, struct mcp_device_id *id,
-                       char *alias)
-{
-       sprintf(alias, MCP_MODULE_PREFIX "%s", id->name);
-
-       return 1;
-}
-ADD_TO_DEVTABLE("mcp", struct mcp_device_id, do_mcp_entry); 
-
 static const struct dmifield {
        const char *prefix;
        int field;