Commit 91f8d011 authored by Alex Dubov's avatar Alex Dubov Committed by Pierre Ossman

tifm: layout fixes, small changes to comments and printfs

Cosmetic changes to the code.
Signed-off-by: default avatarAlex Dubov <oakad@yahoo.com>
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 13cdf48e
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
*/ */
#include <linux/tifm.h> #include <linux/tifm.h>
#include <linux/dma-mapping.h>
#include <linux/freezer.h>
#define DRIVER_NAME "tifm_7xx1" #define DRIVER_NAME "tifm_7xx1"
#define DRIVER_VERSION "0.8" #define DRIVER_VERSION "0.8"
...@@ -41,8 +39,7 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id) ...@@ -41,8 +39,7 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id)
{ {
struct tifm_adapter *fm = dev_id; struct tifm_adapter *fm = dev_id;
struct tifm_dev *sock; struct tifm_dev *sock;
unsigned int irq_status; unsigned int irq_status, cnt;
unsigned int cnt;
spin_lock(&fm->lock); spin_lock(&fm->lock);
irq_status = readl(fm->addr + FM_INTERRUPT_STATUS); irq_status = readl(fm->addr + FM_INTERRUPT_STATUS);
...@@ -134,11 +131,10 @@ static void tifm_7xx1_switch_media(struct work_struct *work) ...@@ -134,11 +131,10 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
{ {
struct tifm_adapter *fm = container_of(work, struct tifm_adapter, struct tifm_adapter *fm = container_of(work, struct tifm_adapter,
media_switcher); media_switcher);
struct tifm_dev *sock;
unsigned long flags; unsigned long flags;
unsigned char media_id; unsigned char media_id;
int cnt; unsigned int socket_change_set, cnt;
struct tifm_dev *sock;
unsigned int socket_change_set;
spin_lock_irqsave(&fm->lock, flags); spin_lock_irqsave(&fm->lock, flags);
socket_change_set = fm->socket_change_set; socket_change_set = fm->socket_change_set;
......
...@@ -115,23 +115,23 @@ static int tifm_device_remove(struct device *dev) ...@@ -115,23 +115,23 @@ static int tifm_device_remove(struct device *dev)
static int tifm_device_suspend(struct device *dev, pm_message_t state) static int tifm_device_suspend(struct device *dev, pm_message_t state)
{ {
struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev); struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver, struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver,
driver); driver);
if (dev->driver && drv->suspend) if (dev->driver && drv->suspend)
return drv->suspend(fm_dev, state); return drv->suspend(sock, state);
return 0; return 0;
} }
static int tifm_device_resume(struct device *dev) static int tifm_device_resume(struct device *dev)
{ {
struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev); struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver, struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver,
driver); driver);
if (dev->driver && drv->resume) if (dev->driver && drv->resume)
return drv->resume(fm_dev); return drv->resume(sock);
return 0; return 0;
} }
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* Special thanks to Brad Campbell for extensive testing of this driver.
*
*/ */
...@@ -39,6 +41,7 @@ module_param(fixed_timeout, bool, 0644); ...@@ -39,6 +41,7 @@ module_param(fixed_timeout, bool, 0644);
#define TIFM_MMCSD_ERRMASK 0x01e0 /* set bits: CCRC, CTO, DCRC, DTO */ #define TIFM_MMCSD_ERRMASK 0x01e0 /* set bits: CCRC, CTO, DCRC, DTO */
#define TIFM_MMCSD_EOC 0x0001 /* end of command phase */ #define TIFM_MMCSD_EOC 0x0001 /* end of command phase */
#define TIFM_MMCSD_CD 0x0002 /* card detect */
#define TIFM_MMCSD_CB 0x0004 /* card enter busy state */ #define TIFM_MMCSD_CB 0x0004 /* card enter busy state */
#define TIFM_MMCSD_BRS 0x0008 /* block received/sent */ #define TIFM_MMCSD_BRS 0x0008 /* block received/sent */
#define TIFM_MMCSD_EOFB 0x0010 /* card exit busy state */ #define TIFM_MMCSD_EOFB 0x0010 /* card exit busy state */
...@@ -48,6 +51,8 @@ module_param(fixed_timeout, bool, 0644); ...@@ -48,6 +51,8 @@ module_param(fixed_timeout, bool, 0644);
#define TIFM_MMCSD_CCRC 0x0100 /* command crc error */ #define TIFM_MMCSD_CCRC 0x0100 /* command crc error */
#define TIFM_MMCSD_AF 0x0400 /* fifo almost full */ #define TIFM_MMCSD_AF 0x0400 /* fifo almost full */
#define TIFM_MMCSD_AE 0x0800 /* fifo almost empty */ #define TIFM_MMCSD_AE 0x0800 /* fifo almost empty */
#define TIFM_MMCSD_OCRB 0x1000 /* OCR busy */
#define TIFM_MMCSD_CIRQ 0x2000 /* card irq (cmd40/sdio) */
#define TIFM_MMCSD_CERR 0x4000 /* card status error */ #define TIFM_MMCSD_CERR 0x4000 /* card status error */
#define TIFM_MMCSD_ODTO 0x0040 /* open drain / extended timeout */ #define TIFM_MMCSD_ODTO 0x0040 /* open drain / extended timeout */
...@@ -627,7 +632,8 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -627,7 +632,8 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
} }
if (host->req) { if (host->req) {
printk(KERN_ERR DRIVER_NAME ": unfinished request detected\n"); printk(KERN_ERR "%s : unfinished request detected\n",
sock->dev.bus_id);
spin_unlock_irqrestore(&sock->lock, flags); spin_unlock_irqrestore(&sock->lock, flags);
goto err_out; goto err_out;
} }
...@@ -737,7 +743,8 @@ static void tifm_sd_end_cmd(unsigned long data) ...@@ -737,7 +743,8 @@ static void tifm_sd_end_cmd(unsigned long data)
host->req = NULL; host->req = NULL;
if (!mrq) { if (!mrq) {
printk(KERN_ERR DRIVER_NAME ": no request to complete?\n"); printk(KERN_ERR " %s : no request to complete?\n",
sock->dev.bus_id);
spin_unlock_irqrestore(&sock->lock, flags); spin_unlock_irqrestore(&sock->lock, flags);
return; return;
} }
...@@ -775,8 +782,10 @@ static void tifm_sd_abort(unsigned long data) ...@@ -775,8 +782,10 @@ static void tifm_sd_abort(unsigned long data)
{ {
struct tifm_sd *host = (struct tifm_sd*)data; struct tifm_sd *host = (struct tifm_sd*)data;
printk(KERN_ERR DRIVER_NAME printk(KERN_ERR
": card failed to respond for a long period of time\n"); "%s : card failed to respond for a long period of time "
"(%x, %x)\n",
host->dev->dev.bus_id, host->req->cmd->opcode, host->cmd_flags);
tifm_eject(host->dev); tifm_eject(host->dev);
} }
...@@ -790,8 +799,11 @@ static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -790,8 +799,11 @@ static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios)
spin_lock_irqsave(&sock->lock, flags); spin_lock_irqsave(&sock->lock, flags);
dev_dbg(&sock->dev, "Setting bus width %d, power %d\n", ios->bus_width, dev_dbg(&sock->dev, "ios: clock = %u, vdd = %x, bus_mode = %x, "
ios->power_mode); "chip_select = %x, power_mode = %x, bus_width = %x\n",
ios->clock, ios->vdd, ios->bus_mode, ios->chip_select,
ios->power_mode, ios->bus_width);
if (ios->bus_width == MMC_BUS_WIDTH_4) { if (ios->bus_width == MMC_BUS_WIDTH_4) {
writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG), writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG),
sock->addr + SOCK_MMCSD_CONFIG); sock->addr + SOCK_MMCSD_CONFIG);
...@@ -937,7 +949,8 @@ static int tifm_sd_probe(struct tifm_dev *sock) ...@@ -937,7 +949,8 @@ static int tifm_sd_probe(struct tifm_dev *sock)
if (!(TIFM_SOCK_STATE_OCCUPIED if (!(TIFM_SOCK_STATE_OCCUPIED
& readl(sock->addr + SOCK_PRESENT_STATE))) { & readl(sock->addr + SOCK_PRESENT_STATE))) {
printk(KERN_WARNING DRIVER_NAME ": card gone, unexpectedly\n"); printk(KERN_WARNING "%s : card gone, unexpectedly\n",
sock->dev.bus_id);
return rc; return rc;
} }
...@@ -974,11 +987,9 @@ static int tifm_sd_probe(struct tifm_dev *sock) ...@@ -974,11 +987,9 @@ static int tifm_sd_probe(struct tifm_dev *sock)
if (!rc) if (!rc)
rc = mmc_add_host(mmc); rc = mmc_add_host(mmc);
if (rc) if (!rc)
goto out_free_mmc;
return 0; return 0;
out_free_mmc:
mmc_free_host(mmc); mmc_free_host(mmc);
return rc; return rc;
} }
......
...@@ -14,16 +14,16 @@ ...@@ -14,16 +14,16 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/wait.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/kthread.h> #include <linux/workqueue.h>
/* Host registers (relative to pci base address): */ /* Host registers (relative to pci base address): */
enum { enum {
FM_SET_INTERRUPT_ENABLE = 0x008, FM_SET_INTERRUPT_ENABLE = 0x008,
FM_CLEAR_INTERRUPT_ENABLE = 0x00c, FM_CLEAR_INTERRUPT_ENABLE = 0x00c,
FM_INTERRUPT_STATUS = 0x014 }; FM_INTERRUPT_STATUS = 0x014
};
/* Socket registers (relative to socket base address): */ /* Socket registers (relative to socket base address): */
enum { enum {
...@@ -58,7 +58,8 @@ enum { ...@@ -58,7 +58,8 @@ enum {
SOCK_MS_DATA = 0x188, SOCK_MS_DATA = 0x188,
SOCK_MS_STATUS = 0x18c, SOCK_MS_STATUS = 0x18c,
SOCK_MS_SYSTEM = 0x190, SOCK_MS_SYSTEM = 0x190,
SOCK_FIFO_ACCESS = 0x200 }; SOCK_FIFO_ACCESS = 0x200
};
#define TIFM_CTRL_LED 0x00000040 #define TIFM_CTRL_LED 0x00000040
#define TIFM_CTRL_FAST_CLK 0x00000100 #define TIFM_CTRL_FAST_CLK 0x00000100
...@@ -66,14 +67,14 @@ enum { ...@@ -66,14 +67,14 @@ enum {
#define TIFM_SOCK_STATE_OCCUPIED 0x00000008 #define TIFM_SOCK_STATE_OCCUPIED 0x00000008
#define TIFM_SOCK_STATE_POWERED 0x00000080 #define TIFM_SOCK_STATE_POWERED 0x00000080
#define TIFM_FIFO_ENABLE 0x00000001 /* Meaning of this constant is unverified */ #define TIFM_FIFO_ENABLE 0x00000001
#define TIFM_FIFO_READY 0x00000001 /* Meaning of this constant is unverified */ #define TIFM_FIFO_READY 0x00000001
#define TIFM_FIFO_INT_SETALL 0x0000ffff #define TIFM_FIFO_INT_SETALL 0x0000ffff
#define TIFM_FIFO_INTMASK 0x00000005 /* Meaning of this constant is unverified */ #define TIFM_FIFO_INTMASK 0x00000005
#define TIFM_DMA_RESET 0x00000002 /* Meaning of this constant is unverified */ #define TIFM_DMA_RESET 0x00000002
#define TIFM_DMA_TX 0x00008000 /* Meaning of this constant is unverified */ #define TIFM_DMA_TX 0x00008000
#define TIFM_DMA_EN 0x00000001 /* Meaning of this constant is unverified */ #define TIFM_DMA_EN 0x00000001
#define TIFM_DMA_TSIZE 0x0000007f #define TIFM_DMA_TSIZE 0x0000007f
#define TIFM_TYPE_XD 1 #define TIFM_TYPE_XD 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment