Restore SA11x0 MCP/UCB drivers to a working state
Subsystems (4)
cover Restore SA11x0 MCP/UCB drivers to a working state
Samuel,
The following patch set restores the SA11x0 MCP and UCB1x00 drivers back to a working state, as tested on the Assabet.
The first two patches are the revert I requested. The others fix a problem with the UCB1x00's use of genirq (it returns from its interrupt handler with IRQs enabled, which causes genirq to barf), and delete the SA11x0 specific DMA definitions and SA11x0 specific DMA header file from the driver. That is in preparation for me removing the existing SA11x0 private DMA backend in favour of a DMA engine implementation.
As the DMA changes have dependencies in my tree (on which other changes then depend on) I can't see this being sanely split from my tree, so I'll request acks for these changes.
I'll plan to send the first three patches to Linus as part of my next 'fixes' push if you agree.
arch/arm/mach-sa1100/assabet.c | 12 --- arch/arm/mach-sa1100/cerf.c | 11 -- arch/arm/mach-sa1100/collie.c | 18 +--- arch/arm/mach-sa1100/generic.c | 7 +- arch/arm/mach-sa1100/include/mach/mcp.h | 2 - arch/arm/mach-sa1100/lart.c | 10 -- arch/arm/mach-sa1100/shannon.c | 11 -- arch/arm/mach-sa1100/simpad.c | 18 +--- drivers/mfd/mcp-core.c | 62 +++--------- drivers/mfd/mcp-sa11x0.c | 166 +++++++++--------------------- drivers/mfd/ucb1x00-assabet.c | 3 - drivers/mfd/ucb1x00-core.c | 49 ++------- drivers/mfd/ucb1x00-ts.c | 3 +- include/linux/mfd/mcp.h | 13 +-- include/linux/mfd/ucb1x00.h | 5 +- include/linux/mod_devicetable.h | 11 -- scripts/mod/file2alias.c | 10 -- 17 files changed, 81 insertions(+), 330 deletions(-)
PATCH 1/4 Revert "ARM: sa1100: Refactor mcp-sa11x0 to use platform resources."
This reverts commit af9081ae64b941d32239b947882cd59ba855c5db.
This revert is necessary to revert 5dd7bf59e0e8563265b3e5b33276099ef628fcc7.
--- arch/arm/mach-sa1100/assabet.c | 11 --- arch/arm/mach-sa1100/cerf.c | 10 --- arch/arm/mach-sa1100/collie.c | 10 --- arch/arm/mach-sa1100/generic.c | 7 +-- arch/arm/mach-sa1100/lart.c | 9 -- arch/arm/mach-sa1100/shannon.c | 10 --- arch/arm/mach-sa1100/simpad.c | 10 --- drivers/mfd/mcp-sa11x0.c | 162 +++++++++++++--------------------------- 8 files changed, 53 insertions(+), 176 deletions(-)
arch/arm/mach-sa1100/assabet.c +0 -11
@@ -253,17 +253,6 @@ static void __init assabet_init(void)sa11x0_register_mtd (&assabet_flash_data, assabet_flash_resources,ARRAY_SIZE (assabet_flash_resources));sa11x0_register_irda (&assabet_irda_data); - -/* -* Setup the PPC unit correctly. -*/ -PPDR &= ~PPC_RXD4 ; -PPDR |=PPC_TXD4 |PPC_SCLK |PPC_SFRM ; -PSDR |=PPC_RXD4 ; -PSDR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -PPSR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); - -ASSABET_BCR_set (ASSABET_BCR_CODEC_RST );sa11x0_register_mcp (&assabet_mcp_data); }
arch/arm/mach-sa1100/cerf.c +0 -10
@@ -131,16 +131,6 @@ static void __init cerf_init(void) {platform_add_devices (cerf_devices,ARRAY_SIZE (cerf_devices));sa11x0_register_mtd (&cerf_flash_data, &cerf_flash_resource,1 ); - -/* -* Setup the PPC unit correctly. -*/ -PPDR &= ~PPC_RXD4 ; -PPDR |=PPC_TXD4 |PPC_SCLK |PPC_SFRM ; -PSDR |=PPC_RXD4 ; -PSDR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -PPSR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -sa11x0_register_mcp (&cerf_mcp_data); }
arch/arm/mach-sa1100/collie.c +0 -10
@@ -357,16 +357,6 @@ static void __init collie_init(void)sa11x0_register_mtd (&collie_flash_data, collie_flash_resources,ARRAY_SIZE (collie_flash_resources)); - -/* -* Setup the PPC unit correctly. -*/ -PPDR &= ~PPC_RXD4 ; -PPDR |=PPC_TXD4 |PPC_SCLK |PPC_SFRM ; -PSDR |=PPC_RXD4 ; -PSDR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -PPSR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -sa11x0_register_mcp (&collie_mcp_data);sharpsl_save_param ();
arch/arm/mach-sa1100/generic.c +1 -6
@@ -217,15 +217,10 @@ static struct platform_device sa11x0uart3_device = {static struct resource sa11x0mcp_resources[] = { [0 ] = { .start =__PREG (Ser4MCCR0), - .end =__PREG (Ser4MCCR0) +0x1C -1 , + .end =__PREG (Ser4MCCR0) +0xffff , .flags =IORESOURCE_MEM , }, [1 ] = { - .start =__PREG (Ser4MCCR1), - .end =__PREG (Ser4MCCR1) +0x4 -1 , - .flags =IORESOURCE_MEM , - }, - [2 ] = { .start = IRQ_Ser4MCP, .end = IRQ_Ser4MCP, .flags =IORESOURCE_IRQ ,
arch/arm/mach-sa1100/lart.c +0 -9
@@ -29,15 +29,6 @@ static struct mcp_plat_data lart_mcp_data = {static void __init lart_init (void ) { -/* -* Setup the PPC unit correctly. -*/ -PPDR &= ~PPC_RXD4 ; -PPDR |=PPC_TXD4 |PPC_SCLK |PPC_SFRM ; -PSDR |=PPC_RXD4 ; -PSDR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -PPSR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -sa11x0_register_mcp (&lart_mcp_data); }
arch/arm/mach-sa1100/shannon.c +0 -10
@@ -61,16 +61,6 @@ static struct mcp_plat_data shannon_mcp_data = {static void __init shannon_init (void ) {sa11x0_register_mtd (&shannon_flash_data, &shannon_flash_resource,1 ); - -/* -* Setup the PPC unit correctly. -*/ -PPDR &= ~PPC_RXD4 ; -PPDR |=PPC_TXD4 |PPC_SCLK |PPC_SFRM ; -PSDR |=PPC_RXD4 ; -PSDR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -PPSR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -sa11x0_register_mcp (&shannon_mcp_data); }
arch/arm/mach-sa1100/simpad.c +0 -10
@@ -384,16 +384,6 @@ static int __init simpad_init(void)sa11x0_register_mtd (&simpad_flash_data, simpad_flash_resources,ARRAY_SIZE (simpad_flash_resources)); - -/* -* Setup the PPC unit correctly. -*/ -PPDR &= ~PPC_RXD4 ; -PPDR |=PPC_TXD4 |PPC_SCLK |PPC_SFRM ; -PSDR |=PPC_RXD4 ; -PSDR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -PPSR &= ~(PPC_TXD4 |PPC_SCLK |PPC_SFRM ); -sa11x0_register_mcp (&simpad_mcp_data); ret =platform_add_devices (devices,ARRAY_SIZE (devices));
drivers/mfd/mcp-sa11x0.c +52 -110
290 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 2/4 Revert "ARM: sa11x0: Implement autoloading of codec and codec pdata for mcp bus."
In reply to Russell King - ARM LinuxThis 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.
--- arch/arm/mach-sa1100/assabet.c | 1 - arch/arm/mach-sa1100/cerf.c | 1 - arch/arm/mach-sa1100/collie.c | 8 +---- arch/arm/mach-sa1100/include/mach/mcp.h | 2 - arch/arm/mach-sa1100/lart.c | 1 - arch/arm/mach-sa1100/shannon.c | 1 - arch/arm/mach-sa1100/simpad.c | 8 +---- drivers/mfd/mcp-core.c | 44 +--------------------------- drivers/mfd/mcp-sa11x0.c | 7 +--- drivers/mfd/ucb1x00-core.c | 48 +++++++----------------------- drivers/mfd/ucb1x00-ts.c | 2 +- include/linux/mfd/mcp.h | 7 +--- include/linux/mfd/ucb1x00.h | 5 +-- include/linux/mod_devicetable.h | 11 ------- scripts/mod/file2alias.c | 10 ------ 15 files changed, 21 insertions(+), 135 deletions(-)
arch/arm/mach-sa1100/assabet.c +0 -1
@@ -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 )
arch/arm/mach-sa1100/cerf.c +0 -1
@@ -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 )
arch/arm/mach-sa1100/collie.c +1 -7
@@ -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 , };/*
arch/arm/mach-sa1100/include/mach/mcp.h +0 -2
@@ -17,8 +17,6 @@ struct mcp_plat_data {u32 mccr1;unsigned int sclk_rate; int gpio_base; -const char *codec; - void *codec_pdata; };#endif
arch/arm/mach-sa1100/lart.c +0 -1
@@ -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 )
arch/arm/mach-sa1100/shannon.c +0 -1
@@ -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 )
arch/arm/mach-sa1100/simpad.c +1 -7
@@ -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 , };
drivers/mfd/mcp-core.c +2 -42
69 lines not on this page · raw message
drivers/mfd/mcp-sa11x0.c +2 -5
@@ -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;
drivers/mfd/ucb1x00-core.c +11 -37
104 lines not on this page · raw message
drivers/mfd/ucb1x00-ts.c +1 -1
@@ -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;
include/linux/mfd/mcp.h +2 -5
@@ -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 *);
include/linux/mfd/ucb1x00.h +1 -4
@@ -104,9 +104,6 @@#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;
include/linux/mod_devicetable.h +0 -11
@@ -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 ,
scripts/mod/file2alias.c +0 -10
@@ -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;
Signature · 1 line
1.7.4.4
PATCH 3/4 MFD: mcp-core: fix complaints from the genirq layer
In reply to Russell King - ARM LinuxThe genirq layer complains if an interrupt handler returns with interrupts enabled. The UCB1x00 handler does just this, because ucb1x00_enable() calls mcp_enable(), which uses spin_lock_irq() rather than spin_lock_irqsave(). Convert this, and the divisor setting functions to use spin_lock_irqsave().
--- drivers/mfd/mcp-core.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
drivers/mfd/mcp-core.c +11 -6
@@ -93,9 +93,11 @@ static struct bus_type mcp_bus_type = {*/ void mcp_set_telecom_divisor (struct mcp *mcp,unsigned int div) { -spin_lock_irq (&mcp->lock); +unsigned long flags; + +spin_lock_irqsave (&mcp->lock, flags); mcp->ops->set_telecom_divisor (mcp, div); -spin_unlock_irq (&mcp->lock); +spin_unlock_irqrestore (&mcp->lock, flags); }EXPORT_SYMBOL (mcp_set_telecom_divisor);
@@ -108,9 +110,11 @@ EXPORT_SYMBOL(mcp_set_telecom_divisor);*/ void mcp_set_audio_divisor (struct mcp *mcp,unsigned int div) { -spin_lock_irq (&mcp->lock); +unsigned long flags; + +spin_lock_irqsave (&mcp->lock, flags); mcp->ops->set_audio_divisor (mcp, div); -spin_unlock_irq (&mcp->lock); +spin_unlock_irqrestore (&mcp->lock, flags); }EXPORT_SYMBOL (mcp_set_audio_divisor);
@@ -163,10 +167,11 @@ EXPORT_SYMBOL(mcp_reg_read);*/ void mcp_enable (struct mcp *mcp) { -spin_lock_irq (&mcp->lock); +unsigned long flags; +spin_lock_irqsave (&mcp->lock, flags);if (mcp->use_count++ ==0 ) mcp->ops->enable (mcp); -spin_unlock_irq (&mcp->lock); +spin_unlock_irqrestore (&mcp->lock, flags); }EXPORT_SYMBOL (mcp_enable);
Signature · 1 line
1.7.4.4
PATCH 4/4 MFD: mcp-sa11x0: remove DMA initializers and variables
In reply to Russell King - ARM LinuxThe dma_device_t variables are only ever written to by mcp-sa11x0 and never read. As the old SA11x0 DMA support will be removed, remove these so that it no longer depends on the old SA11x0 DMA definitions.
--- drivers/mfd/mcp-core.c | 1 - drivers/mfd/mcp-sa11x0.c | 5 ----- drivers/mfd/ucb1x00-assabet.c | 3 --- drivers/mfd/ucb1x00-core.c | 1 - drivers/mfd/ucb1x00-ts.c | 1 - include/linux/mfd/mcp.h | 6 ------ 6 files changed, 0 insertions(+), 17 deletions(-)
drivers/mfd/mcp-core.c +0 -1
@@ -19,7 +19,6 @@#include <linux/string.h> #include <linux/mfd/mcp.h> -#include <mach/dma.h> #include <asm/system.h>
drivers/mfd/mcp-sa11x0.c +0 -5
@@ -20,7 +20,6 @@#include <linux/platform_device.h> #include <linux/mfd/mcp.h> -#include <mach/dma.h> #include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/system.h>
@@ -158,10 +157,6 @@ static int mcp_sa11x0_probe(struct platform_device *pdev) mcp->owner =THIS_MODULE ; mcp->ops = &mcp_sa11x0; mcp->sclk_rate = data->sclk_rate; - mcp->dma_audio_rd = DMA_Ser4MCP0Rd; - mcp->dma_audio_wr = DMA_Ser4MCP0Wr; - mcp->dma_telco_rd = DMA_Ser4MCP1Rd; - mcp->dma_telco_wr = DMA_Ser4MCP1Wr; mcp->gpio_base = data->gpio_base;platform_set_drvdata (pdev, mcp);
drivers/mfd/ucb1x00-assabet.c +0 -3
@@ -16,9 +16,6 @@#include <linux/device.h> #include <linux/mfd/ucb1x00.h> -#include <mach/dma.h> - -#define UCB1X00_ATTR (name,input)\ static ssize_t name##_show(struct device *dev, struct device_attribute *attr, \ char *buf) \
drivers/mfd/ucb1x00-core.c +0 -1
@@ -29,7 +29,6 @@#include <linux/gpio.h> #include <linux/semaphore.h> -#include <mach/dma.h> #include <mach/hardware.h> static DEFINE_MUTEX (ucb1x00_mutex);
drivers/mfd/ucb1x00-ts.c +0 -1
@@ -32,7 +32,6 @@#include <linux/kthread.h> #include <linux/mfd/ucb1x00.h> -#include <mach/dma.h> #include <mach/collie.h> #include <asm/mach-types.h>
include/linux/mfd/mcp.h +0 -6
@@ -10,8 +10,6 @@#ifndef MCP_H #define MCP_H -#include <mach/dma.h> -struct mcp_ops ; struct mcp {
@@ -21,10 +19,6 @@ struct mcp {int use_count;unsigned int sclk_rate;unsigned int rw_timeout; -dma_device_t dma_audio_rd; -dma_device_t dma_audio_wr; -dma_device_t dma_telco_rd; -dma_device_t dma_telco_wr;struct device attached_device;int gpio_base; };
Signature · 1 line
1.7.4.4