[PATCH 0/7] au1xmmc updates - Kernel

This is a discussion on [PATCH 0/7] au1xmmc updates - Kernel ; Hello, The following patches update the au1xmmc driver with new features and a few cleanups. Testers (especially with db1200 and pb1200 boards) and comments welcome! Thanks! Manuel Lauss -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in ...

+ Reply to Thread
Results 1 to 12 of 12

Thread: [PATCH 0/7] au1xmmc updates

  1. [PATCH 0/7] au1xmmc updates

    Hello,

    The following patches update the au1xmmc driver with new
    features and a few cleanups.

    Testers (especially with db1200 and pb1200 boards) and comments
    welcome!

    Thanks!
    Manuel Lauss
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. [PATCH 7/7] au1xmmc: codingstyle tidying

    From fc2578032bfc08799ab4766513d8f04674397166 Mon Sep 17 00:00:00 2001
    From: Manuel Lauss
    Date: Wed, 7 May 2008 15:30:14 +0200
    Subject: [PATCH] au1xmmc: codingstyle tidying

    Make the driver source a bit easier on the eyes;
    no functional changes.

    Signed-off-by: Manuel Lauss
    ---
    drivers/mmc/host/au1xmmc.c | 160 ++++++++++++++++---------------------------
    1 files changed, 60 insertions(+), 100 deletions(-)

    diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
    index 513937a..ea9f7ec 100644
    --- a/drivers/mmc/host/au1xmmc.c
    +++ b/drivers/mmc/host/au1xmmc.c
    @@ -63,9 +63,9 @@
    #define AU1XMMC_DESCRIPTOR_COUNT 1
    #define AU1XMMC_DESCRIPTOR_SIZE 4096

    -#define AU1XMMC_OCR ( MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | \
    - MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | \
    - MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36)
    +#define AU1XMMC_OCR (MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | \
    + MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | \
    + MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36)

    /* Easy access macros */

    @@ -82,24 +82,19 @@
    #define HOST_DEBUG(h) ((h)->iobase + SD_DEBUG)

    #define DMA_CHANNEL(h) \
    - ( ((h)->flags & HOST_F_XMIT) ? (h)->dma.tx_chan : (h)->dma.rx_chan)
    + (((h)->flags & HOST_F_XMIT) ? (h)->dma.tx_chan : (h)->dma.rx_chan)

    /* This gives us a hard value for the stop command that we can write directly
    * to the command register
    */
    -
    -#define STOP_CMD (SD_CMD_RT_1B|SD_CMD_CT_7|(0xC << SD_CMD_CI_SHIFT)|SD_CMD_GO)
    +#define STOP_CMD (SD_CMD_RT_1B | SD_CMD_CT_7 | \
    + (0xC << SD_CMD_CI_SHIFT) | SD_CMD_GO)

    /* This is the set of interrupts that we configure by default */
    -
    -#if 0
    -#define AU1XMMC_INTERRUPTS (SD_CONFIG_SC | SD_CONFIG_DT | SD_CONFIG_DD | \
    - SD_CONFIG_RAT | SD_CONFIG_CR | SD_CONFIG_I)
    -#endif
    -
    #define AU1XMMC_INTERRUPTS (SD_CONFIG_SC | SD_CONFIG_DT | \
    SD_CONFIG_RAT | SD_CONFIG_CR | SD_CONFIG_I)
    -/* The poll event (looking for insert/remove events runs twice a second */
    +
    +/* The poll event (looking for insert/remove events) runs twice a second */
    #define AU1XMMC_DETECT_TIMEOUT (HZ/2)

    /* Status flags used by the host structure */
    @@ -158,7 +153,6 @@ static inline void IRQ_OFF(struct au1xmmc_host *host, u32 mask)

    static inline void SEND_STOP(struct au1xmmc_host *host)
    {
    -
    u32 config2;

    WARN_ON(host->status != HOST_S_DATA);
    @@ -278,18 +272,14 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
    au_sync();

    /* Wait for the command to go on the line */
    -
    - while(1) {
    - if (!(au_readl(HOST_CMD(host)) & SD_CMD_GO))
    - break;
    - }
    + while (au_readl(HOST_CMD(host)) & SD_CMD_GO)
    + /* nop */;

    /* Wait for the command to come back */
    -
    if (wait) {
    u32 status = au_readl(HOST_STATUS(host));

    - while(!(status & SD_STATUS_CR))
    + while (!(status & SD_STATUS_CR))
    status = au_readl(HOST_STATUS(host));

    /* Clear the CR status */
    @@ -303,12 +293,11 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,

    static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
    {
    -
    struct mmc_request *mrq = host->mrq;
    struct mmc_data *data;
    u32 crc;

    - WARN_ON(host->status != HOST_S_DATA && host->status != HOST_S_STOP);
    + WARN_ON((host->status != HOST_S_DATA) && (host->status != HOST_S_STOP));

    if (host->mrq == NULL)
    return;
    @@ -319,15 +308,13 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
    status = au_readl(HOST_STATUS(host));

    /* The transaction is really over when the SD_STATUS_DB bit is clear */
    -
    - while((host->flags & HOST_F_XMIT) && (status & SD_STATUS_DB))
    + while ((host->flags & HOST_F_XMIT) && (status & SD_STATUS_DB))
    status = au_readl(HOST_STATUS(host));

    data->error = 0;
    dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, host->dma.dir);

    /* Process any errors */
    -
    crc = (status & (SD_STATUS_WC | SD_STATUS_RC));
    if (host->flags & HOST_F_XMIT)
    crc |= ((status & 0x07) == 0x02) ? 0 : 1;
    @@ -344,11 +331,10 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
    if (host->flags & HOST_F_DMA) {
    u32 chan = DMA_CHANNEL(host);

    - chan_tab_t *c = *((chan_tab_t **) chan);
    + chan_tab_t *c = *((chan_tab_t **)chan);
    au1x_dma_chan_t *cp = c->chan_ptr;
    data->bytes_xfered = cp->ddma_bytecnt;
    - }
    - else
    + } else
    data->bytes_xfered =
    (data->blocks * data->blksz) -
    host->pio.len;
    @@ -359,7 +345,7 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)

    static void au1xmmc_tasklet_data(unsigned long param)
    {
    - struct au1xmmc_host *host = (struct au1xmmc_host *) param;
    + struct au1xmmc_host *host = (struct au1xmmc_host *)param;

    u32 status = au_readl(HOST_STATUS(host));
    au1xmmc_data_complete(host, status);
    @@ -369,11 +355,10 @@ static void au1xmmc_tasklet_data(unsigned long param)

    static void au1xmmc_send_pio(struct au1xmmc_host *host)
    {
    -
    - struct mmc_data *data = 0;
    - int sg_len, max, count = 0;
    - unsigned char *sg_ptr;
    - u32 status = 0;
    + struct mmc_data *data;
    + int sg_len, max, count;
    + unsigned char *sg_ptr, val;
    + u32 status;
    struct scatterlist *sg;

    data = host->mrq->data;
    @@ -388,22 +373,19 @@ static void au1xmmc_send_pio(struct au1xmmc_host *host)
    /* This is the space left inside the buffer */
    sg_len = data->sg[host->pio.index].length - host->pio.offset;

    - /* Check to if we need less then the size of the sg_buffer */
    -
    + /* Check if we need less than the size of the sg_buffer */
    max = (sg_len > host->pio.len) ? host->pio.len : sg_len;
    - if (max > AU1XMMC_MAX_TRANSFER) max = AU1XMMC_MAX_TRANSFER;
    -
    - for(count = 0; count < max; count++ ) {
    - unsigned char val;
    + if (max > AU1XMMC_MAX_TRANSFER)
    + max = AU1XMMC_MAX_TRANSFER;

    + for (count = 0; count < max; count++) {
    status = au_readl(HOST_STATUS(host));
    -
    if (!(status & SD_STATUS_TH))
    break;

    val = *sg_ptr++;

    - au_writel((unsigned long) val, HOST_TXPORT(host));
    + au_writel((unsigned long)val, HOST_TXPORT(host));
    au_sync();
    }

    @@ -427,11 +409,10 @@ static void au1xmmc_send_pio(struct au1xmmc_host *host)

    static void au1xmmc_receive_pio(struct au1xmmc_host *host)
    {
    -
    - struct mmc_data *data = 0;
    - int sg_len = 0, max = 0, count = 0;
    - unsigned char *sg_ptr = 0;
    - u32 status = 0;
    + struct mmc_data *data;
    + int sg_len = 0, max, count;
    + unsigned char *sg_ptr = NULL;
    + u32 status;
    struct scatterlist *sg;

    data = host->mrq->data;
    @@ -449,13 +430,14 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host)
    sg_len = sg_dma_len(&data->sg[host->pio.index]) - host->pio.offset;

    /* Check to if we need less then the size of the sg_buffer */
    - if (sg_len < max) max = sg_len;
    + if (sg_len < max)
    + max = sg_len;
    }

    if (max > AU1XMMC_MAX_TRANSFER)
    max = AU1XMMC_MAX_TRANSFER;

    - for(count = 0; count < max; count++ ) {
    + for (count = 0; count < max; count++) {
    u32 val;
    status = au_readl(HOST_STATUS(host));

    @@ -472,8 +454,7 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host)
    DBG("RX Overrun [%d + %d]\n", host->id,
    host->pio.len, count);
    break;
    - }
    - else if (status & SD_STATUS_RU) {
    + } else if (status & SD_STATUS_RU) {
    DBG("RX Underrun [%d + %d]\n", host->id,
    host->pio.len, count);
    break;
    @@ -488,13 +469,13 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host)
    host->pio.len -= count;
    host->pio.offset += count;

    - if (sg_len && count == sg_len) {
    + if (sg_len && (count == sg_len)) {
    host->pio.index++;
    host->pio.offset = 0;
    }

    if (host->pio.len == 0) {
    - //IRQ_OFF(host, SD_CONFIG_RA | SD_CONFIG_RF);
    + /* IRQ_OFF(host, SD_CONFIG_RA | SD_CONFIG_RF); */
    IRQ_OFF(host, SD_CONFIG_NE);

    if (host->flags & HOST_F_STOP)
    @@ -504,14 +485,11 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host)
    }
    }

    -/* static void au1xmmc_cmd_complete
    - This is called when a command has been completed - grab the response
    - and check for errors. Then start the data transfer if it is indicated.
    -*/
    -
    +/* This is called when a command has been completed - grab the response
    + * and check for errors. Then start the data transfer if it is indicated.
    + */
    static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status)
    {
    -
    struct mmc_request *mrq = host->mrq;
    struct mmc_command *cmd;
    int trans;
    @@ -536,7 +514,6 @@ static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status)
    * we only got 120 bytes, but the engine expects
    * 128 bits, so we have to shift things up
    */
    -
    for(i = 0; i < 4; i++) {
    cmd->resp[i] = (r[i] & 0x00FFFFFF) << 8;
    if (i != 3)
    @@ -555,15 +532,13 @@ static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status)
    }

    /* Figure out errors */
    -
    if (status & (SD_STATUS_SC | SD_STATUS_WC | SD_STATUS_RC))
    cmd->error = -EILSEQ;

    trans = host->flags & (HOST_F_XMIT | HOST_F_RECV);

    if (!trans || cmd->error) {
    -
    - IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA|SD_CONFIG_RF);
    + IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA | SD_CONFIG_RF);
    tasklet_schedule(&host->finish_task);
    return;
    }
    @@ -574,29 +549,25 @@ static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status)
    u32 channel = DMA_CHANNEL(host);

    /* Start the DMA as soon as the buffer gets something in it */
    -
    if (host->flags & HOST_F_RECV) {
    u32 mask = SD_STATUS_DB | SD_STATUS_NE;

    - while((status & mask) != mask)
    + while ((status & mask) != mask)
    status = au_readl(HOST_STATUS(host));
    }
    -
    au1xxx_dbdma_start(channel);
    }
    }

    static void au1xmmc_set_clock(struct au1xmmc_host *host, int rate)
    {
    -
    unsigned int pbus = get_au1x00_speed();
    unsigned int divisor;
    u32 config;

    /* From databook:
    - divisor = ((((cpuclock / sbus_divisor) / 2) / mmcclock) / 2) - 1
    - */
    -
    + * divisor = ((((cpuclock / sbus_divisor) / 2) / mmcclock) / 2) - 1
    + */
    pbus /= ((au_readl(SYS_POWERCTRL) & 0x3) + 2);
    pbus /= 2;

    @@ -614,7 +585,6 @@ static void au1xmmc_set_clock(struct au1xmmc_host *host, int rate)
    static int
    au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data)
    {
    -
    int datalen = data->blocks * data->blksz;

    if (dma != 0)
    @@ -645,32 +615,31 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data)
    au1xxx_dbdma_stop(channel);

    for(i = 0; i < host->dma.len; i++) {
    - u32 ret = 0, flags = DDMA_FLAGS_NOIE;
    + u32 ret, flags;
    struct scatterlist *sg = &data->sg[i];
    int sg_len = sg->length;

    int len = (datalen > sg_len) ? sg_len : datalen;

    - if (i == host->dma.len - 1)
    + if (i == (host->dma.len - 1))
    flags = DDMA_FLAGS_IE;
    -
    - if (host->flags & HOST_F_XMIT){
    - ret = au1xxx_dbdma_put_source_flags(channel,
    - (void *) sg_virt(sg), len, flags);
    - }
    - else {
    - ret = au1xxx_dbdma_put_dest_flags(channel,
    - (void *) sg_virt(sg),
    - len, flags);
    + else
    + flags = DDMA_FLAGS_NOIE;
    +
    + if (host->flags & HOST_F_XMIT){
    + ret = au1xxx_dbdma_put_source_flags(channel,
    + (void *)sg_virt(sg), len, flags);
    + } else {
    + ret = au1xxx_dbdma_put_dest_flags(channel,
    + (void *)sg_virt(sg), len, flags);
    }

    - if (!ret)
    + if (!ret)
    goto dataerr;

    datalen -= len;
    }
    - }
    - else {
    + } else {
    host->pio.index = 0;
    host->pio.offset = 0;
    host->pio.len = datalen;
    @@ -679,25 +648,19 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data)
    IRQ_ON(host, SD_CONFIG_TH);
    else
    IRQ_ON(host, SD_CONFIG_NE);
    - //IRQ_ON(host, SD_CONFIG_RA|SD_CONFIG_RF);
    + /* IRQ_ON(host, SD_CONFIG_RA|SD_CONFIG_RF); */
    }

    return 0;

    - dataerr:
    +dataerr:
    dma_unmap_sg(mmc_dev(host->mmc),data->sg,data->sg_len,host->dma.dir);
    return -ETIMEDOUT;
    }

    -/* static void au1xmmc_request
    - This actually starts a command or data transaction
    -*/
    -
    static void au1xmmc_request(struct mmc_host* mmc, struct mmc_request* mrq)
    {
    -
    struct au1xmmc_host *host = mmc_priv(mmc);
    - unsigned int flags = 0;
    int ret = 0;

    WARN_ON(irqs_disabled());
    @@ -712,7 +675,6 @@ static void au1xmmc_request(struct mmc_host* mmc, struct mmc_request* mrq)

    if (mrq->data) {
    FLUSH_FIFO(host);
    - flags = mrq->data->flags;
    ret = au1xmmc_prepare_data(host, mrq->data);
    }

    @@ -727,7 +689,6 @@ static void au1xmmc_request(struct mmc_host* mmc, struct mmc_request* mrq)

    static void au1xmmc_reset_controller(struct au1xmmc_host *host)
    {
    -
    /* Apply the clock */
    au_writel(SD_ENABLE_CE, HOST_ENABLE(host));
    au_sync_delay(1);
    @@ -757,7 +718,7 @@ static void au1xmmc_reset_controller(struct au1xmmc_host *host)
    }


    -static void au1xmmc_set_ios(struct mmc_host* mmc, struct mmc_ios* ios)
    +static void au1xmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
    {
    struct au1xmmc_host *host = mmc_priv(mmc);
    u32 config;
    @@ -788,10 +749,9 @@ static void au1xmmc_set_ios(struct mmc_host* mmc, struct mmc_ios* ios)

    static void au1xmmc_dma_callback(int irq, void *dev_id)
    {
    - struct au1xmmc_host *host = (struct au1xmmc_host *) dev_id;
    + struct au1xmmc_host *host = (struct au1xmmc_host *)dev_id;

    /* Avoid spurious interrupts */
    -
    if (!host->mrq)
    return;

    @@ -840,7 +800,7 @@ static irqreturn_t au1xmmc_irq(int irq, void *dev_id)
    #endif
    else if (status & (SD_STATUS_CR)) {
    if (host->status == HOST_S_CMD)
    - au1xmmc_cmd_complete(host,status);
    + au1xmmc_cmd_complete(host, status);

    } else if (!(host->flags & HOST_F_DMA)) {
    if ((host->flags & HOST_F_XMIT) && (status & STATUS_DATA_OUT))
    --
    1.5.5.1

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. [PATCH 6/7] au1xmmc: wire up SDIO interrupt

    From 629e40951cb1c4c6ddcdc89a69af85c30f3bea3b Mon Sep 17 00:00:00 2001
    From: Manuel Lauss
    Date: Wed, 7 May 2008 15:18:14 +0200
    Subject: [PATCH] au1xmmc: wire up SDIO interrupt

    The silicon supports SDIO irqs.

    Untested since I don't have any SDIO hardware.

    Signed-off-by: Manuel Lauss
    ---
    drivers/mmc/host/au1xmmc.c | 16 +++++++++++++++-
    1 files changed, 15 insertions(+), 1 deletions(-)

    diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
    index 8ee7640..513937a 100644
    --- a/drivers/mmc/host/au1xmmc.c
    +++ b/drivers/mmc/host/au1xmmc.c
    @@ -848,6 +848,9 @@ static irqreturn_t au1xmmc_irq(int irq, void *dev_id)
    else if ((host->flags & HOST_F_RECV) && (status & STATUS_DATA_IN))
    au1xmmc_receive_pio(host);

    + } else if (status & 0x80000000) {
    + mmc_signal_sdio_irq(host->mmc);
    +
    } else if (status & 0x203FBC70) {
    DBG("Unhandled status %8.8x\n", host->id, status);
    }
    @@ -901,10 +904,21 @@ static int au1xmmc_init_dma(struct au1xmmc_host *host)
    return 0;
    }

    +static void au1xmmc_enable_sdio_irq(struct mmc_host *mmc, int en)
    +{
    + struct au1xmmc_host *host = mmc_priv(mmc);
    +
    + if (en)
    + IRQ_ON(host, (1<<31));
    + else
    + IRQ_OFF(host, (1<<31));
    +}
    +
    static const struct mmc_host_ops au1xmmc_ops = {
    .request = au1xmmc_request,
    .set_ios = au1xmmc_set_ios,
    .get_ro = au1xmmc_card_readonly,
    + .enable_sdio_irq = au1xmmc_enable_sdio_irq,
    };

    static void au1xmmc_poll_event(unsigned long arg)
    @@ -996,7 +1010,7 @@ static int __devinit au1xmmc_probe(struct platform_device *pdev)
    mmc->max_blk_count = 512;

    mmc->ocr_avail = AU1XMMC_OCR;
    - mmc->caps = MMC_CAP_4_BIT_DATA;
    + mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ;

    host->id = pdev->id;
    host->status = HOST_S_IDLE;
    --
    1.5.5.1

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  4. [PATCH 4/7] Alchemy: db1200/pb1200: register mmc platform device and board specific functions

    From 94bfedb777443b33abd62fde48940db0fab36d80 Mon Sep 17 00:00:00 2001
    From: Manuel Lauss
    Date: Wed, 7 May 2008 14:59:45 +0200
    Subject: [PATCH] Alchemy: register mmc platform device for db1200/pb1200 boards

    register the mmc platform device for db1200/pb1200 boards, with
    board-specific card detect/readonly facilities wrapped in platform data.

    Signed-off-by: Manuel Lauss
    ---
    arch/mips/au1000/common/platform.c | 32 ---------
    arch/mips/au1000/pb1200/platform.c | 127 +++++++++++++++++++++++++++++++++++-
    2 files changed, 126 insertions(+), 33 deletions(-)

    diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
    index 31d2a22..08a5900 100644
    --- a/arch/mips/au1000/common/platform.c
    +++ b/arch/mips/au1000/common/platform.c
    @@ -162,24 +162,6 @@ static struct resource au1xxx_usb_gdt_resources[] = {
    },
    };

    -static struct resource au1xxx_mmc_resources[] = {
    - [0] = {
    - .start = SD0_PHYS_ADDR,
    - .end = SD0_PHYS_ADDR + 0x40,
    - .flags = IORESOURCE_MEM,
    - },
    - [1] = {
    - .start = SD1_PHYS_ADDR,
    - .end = SD1_PHYS_ADDR + 0x40,
    - .flags = IORESOURCE_MEM,
    - },
    - [2] = {
    - .start = AU1200_SD_INT,
    - .end = AU1200_SD_INT,
    - .flags = IORESOURCE_IRQ,
    - }
    -};
    -
    static u64 udc_dmamask = ~(u32)0;

    static struct platform_device au1xxx_usb_gdt_device = {
    @@ -245,19 +227,6 @@ static struct platform_device au1200_lcd_device = {
    .num_resources = ARRAY_SIZE(au1200_lcd_resources),
    .resource = au1200_lcd_resources,
    };
    -
    -static u64 au1xxx_mmc_dmamask = ~(u32)0;
    -
    -static struct platform_device au1xxx_mmc_device = {
    - .name = "au1xxx-mmc",
    - .id = 0,
    - .dev = {
    - .dma_mask = &au1xxx_mmc_dmamask,
    - .coherent_dma_mask = 0xffffffff,
    - },
    - .num_resources = ARRAY_SIZE(au1xxx_mmc_resources),
    - .resource = au1xxx_mmc_resources,
    -};
    #endif /* #ifdef CONFIG_SOC_AU1200 */

    static struct platform_device au1x00_pcmcia_device = {
    @@ -295,7 +264,6 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
    &au1xxx_usb_gdt_device,
    &au1xxx_usb_otg_device,
    &au1200_lcd_device,
    - &au1xxx_mmc_device,
    #endif
    #ifdef SMBUS_PSC_BASE
    &pbdb_smbus_device,
    diff --git a/arch/mips/au1000/pb1200/platform.c b/arch/mips/au1000/pb1200/platform.c
    index 5930110..bee2bf7 100644
    --- a/arch/mips/au1000/pb1200/platform.c
    +++ b/arch/mips/au1000/pb1200/platform.c
    @@ -20,8 +20,17 @@

    #include
    #include
    +#include

    #include
    +#include
    +#include
    +
    +#if defined(CONFIG_MIPS_PB1200)
    +#include
    +#elif defined(CONFIG_MIPS_DB1200)
    +#include
    +#endif

    static struct resource ide_resources[] = {
    [0] = {
    @@ -70,9 +79,125 @@ static struct platform_device smc91c111_device = {
    .resource = smc91c111_resources
    };

    +
    +static const struct {
    + u16 bcsrpwr;
    + u16 bcsrstatus;
    + u16 wpstatus;
    +} au1xmmc_card_table[] = {
    + { BCSR_BOARD_SD0PWR, BCSR_INT_SD0INSERT, BCSR_STATUS_SD0WP },
    +#ifndef CONFIG_MIPS_DB1200
    + { BCSR_BOARD_SD1PWR, BCSR_INT_SD1INSERT, BCSR_STATUS_SD1WP }
    +#endif
    +};
    +
    +static void pb1200mmc_set_power(void *mmc_host, int state)
    +{
    + struct au1xmmc_host *host = mmc_priv((struct mmc_host *)mmc_host);
    + u32 val = au1xmmc_card_table[host->id].bcsrpwr;
    +
    + bcsr->board &= ~val;
    + if (state)
    + bcsr->board |= val;
    +
    + au_sync_delay(1);
    +}
    +
    +static int pb1200mmc_card_readonly(void *mmc_host)
    +{
    + struct au1xmmc_host *host = mmc_priv((struct mmc_host *)mmc_host);
    + return (bcsr->status & au1xmmc_card_table[host->id].wpstatus) ? 1 : 0;
    +}
    +
    +static int pb1200mmc_card_inserted(void *mmc_host)
    +{
    + struct au1xmmc_host *host = mmc_priv((struct mmc_host *)mmc_host);
    + return (bcsr->sig_status & au1xmmc_card_table[host->id].bcsrstatus)
    + ? 1 : 0;
    +}
    +
    +static struct au1xmmc_platdata db1xmmcpd = {
    + .set_power = pb1200mmc_set_power,
    + .card_inserted = pb1200mmc_card_inserted,
    + .card_readonly = pb1200mmc_card_readonly,
    + .cd_setup = NULL, /* use poll-timer in driver */
    +};
    +
    +static u64 au1xxx_mmc_dmamask = ~(u32)0;
    +
    +struct resource au1200sd0_res[] = {
    + [0] = {
    + .start = CPHYSADDR(SD0_BASE),
    + .end = CPHYSADDR(SD0_BASE) + 0x40,
    + .flags = IORESOURCE_MEM,
    + },
    + [2] = {
    + .start = AU1200_SD_INT,
    + .flags = IORESOURCE_IRQ,
    + },
    + [3] = {
    + .start = DSCR_CMD0_SDMS_TX0,
    + .flags = IORESOURCE_DMA,
    + },
    + [4] = {
    + .start = DSCR_CMD0_SDMS_RX0,
    + .flags = IORESOURCE_DMA,
    + },
    +};
    +
    +static struct platform_device au1200_sd0_device = {
    + .name = "au1xxx-mmc",
    + .id = 0, /* index into au1xmmc_card_table[] */
    + .dev = {
    + .dma_mask = &au1xxx_mmc_dmamask,
    + .coherent_dma_mask = 0xffffffff,
    + .platform_data = &db1xmmcpd,
    + },
    + .num_resources = ARRAY_SIZE(au1200sd0_res),
    + .resource = au1200sd0_res,
    +};
    +
    +#ifndef CONFIG_MIPS_DB1200
    +struct resource au1200sd1_res[] = {
    + [0] = {
    + .start = CPHYSADDR(SD1_BASE),
    + .end = CPHYSADDR(SD1_BASE) + 0xff,
    + .flags = IORESOURCE_MEM,
    + },
    + [2] = {
    + .start = AU1200_SD_INT,
    + .flags = IORESOURCE_IRQ,
    + },
    + [3] = {
    + .start = DSCR_CMD0_SDMS_TX1,
    + .flags = IORESOURCE_DMA,
    + },
    + [4] = {
    + .start = DSCR_CMD0_SDMS_RX1,
    + .flags = IORESOURCE_DMA,
    + },
    +};
    +
    +static struct platform_device au1200_sd1_device = {
    + .name = "au1xxx-mmc",
    + .id = 1, /* index into au1xmmc_card_table[] */
    + .dev = {
    + .dma_mask = &au1xxx_mmc_dmamask,
    + .coherent_dma_mask = 0xffffffff,
    + .platform_data = &db1xmmcpd,
    + },
    + .num_resources = ARRAY_SIZE(au1200sd1_res),
    + .resource = au1200sd1_res,
    +};
    +#endif
    +
    static struct platform_device *board_platform_devices[] __initdata = {
    &ide_device,
    - &smc91c111_device
    + &smc91c111_device,
    + &au1200_sd0_device,
    +#ifndef CONFIG_MIPS_DB1200
    + &au1200_sd1_device,
    +#endif
    };

    static int __init board_register_devices(void)
    --
    1.5.5.1

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  5. [PATCH 2/7] Alchemy: dbdma: add api to delete custom ddma devices

    From 54c63c0bbf48673e5550b62d3ca4272dd0a1bedf Mon Sep 17 00:00:00 2001
    From: Manuel Lauss
    Date: Wed, 7 May 2008 13:45:23 +0200
    Subject: [PATCH] Alchemy: dbdma: add API to delete custom DDMA device ids.

    Add API to delete custom DDMA device ids created with
    au1xxx_ddma_device_add(), to avoid filling the ddma id table by repeatedly
    loading/unloading a module using this function.

    Signed-off-by: Manuel Lauss
    ---
    arch/mips/au1000/common/dbdma.c | 10 ++++++++++
    include/asm-mips/mach-au1x00/au1xxx_dbdma.h | 1 +
    2 files changed, 11 insertions(+), 0 deletions(-)

    diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
    index 53377df..69171c6 100644
    --- a/arch/mips/au1000/common/dbdma.c
    +++ b/arch/mips/au1000/common/dbdma.c
    @@ -220,6 +220,16 @@ au1xxx_ddma_add_device(dbdev_tab_t *dev)
    }
    EXPORT_SYMBOL(au1xxx_ddma_add_device);

    +void au1xxx_ddma_del_device(u32 devid)
    +{
    + dbdev_tab_t *p = find_dbdev_id(devid);
    + if (p != NULL) {
    + memset(p, 0, sizeof(dbdev_tab_t));
    + p->dev_id = ~0;
    + }
    +}
    +EXPORT_SYMBOL(au1xxx_ddma_del_device);
    +
    /* Allocate a channel and return a non-zero descriptor if successful.
    */
    u32
    diff --git a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
    index 93d507c..5e33ff0 100644
    --- a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
    +++ b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
    @@ -367,6 +367,7 @@ void au1xxx_dbdma_dump(u32 chanid);
    u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr );

    u32 au1xxx_ddma_add_device( dbdev_tab_t *dev );
    +void au1xxx_ddma_del_device(u32 devid);
    void * au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp);

    /*
    --
    1.5.5.1

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  6. [PATCH 1/7] Alchemy: export get_au1x00_speed for modules

    From e441a70bfa420f1cef86597a5ef23dfa440ba25e Mon Sep 17 00:00:00 2001
    From: Manuel Lauss
    Date: Wed, 7 May 2008 13:42:55 +0200
    Subject: [PATCH] Alchemy: export get_au1x00_speed for modules

    au1xmmc.c driver depends on it, so export it for modules.

    Signed-off-by: Manuel Lauss
    ---
    arch/mips/au1000/common/clocks.c | 2 +-
    1 files changed, 1 insertions(+), 1 deletions(-)

    diff --git a/arch/mips/au1000/common/clocks.c b/arch/mips/au1000/common/clocks.c
    index 3ce6cac..6dbc87a 100644
    --- a/arch/mips/au1000/common/clocks.c
    +++ b/arch/mips/au1000/common/clocks.c
    @@ -46,7 +46,7 @@ unsigned int get_au1x00_speed(void)
    {
    return au1x00_clock;
    }
    -
    +EXPORT_SYMBOL(get_au1x00_speed);


    /*
    --
    1.5.5.1

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  7. [PATCH 3/7] au1xmmc: remove db1x00 specific functions and platform device conversion

    From 8dc23d568939c8c12c358ee063fd38e8093d3c6f Mon Sep 17 00:00:00 2001
    From: Manuel Lauss
    Date: Wed, 7 May 2008 14:57:01 +0200
    Subject: [PATCH] au1xmmc: remove db1x00 board-specific functions from driver

    Remove the DB1200 board-specific functions (card present, read-only
    methods) and instead add platform data which is passed to the driver.

    With the board-specific stuff gone, the driver no longer needs to know
    how many physical controllers the silicon actually has; every device
    can be registered as needed, update the code as necessary.

    Signed-off-by: Manuel Lauss
    ---
    drivers/mmc/host/au1xmmc.c | 494 ++++++++++++++++++-----------
    drivers/mmc/host/au1xmmc.h | 96 ------
    include/asm-mips/mach-au1x00/au1100_mmc.h | 43 +++-
    3 files changed, 338 insertions(+), 295 deletions(-)
    delete mode 100644 drivers/mmc/host/au1xmmc.h

    diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
    index cc5f7bc..17870cd 100644
    --- a/drivers/mmc/host/au1xmmc.c
    +++ b/drivers/mmc/host/au1xmmc.c
    @@ -49,7 +49,6 @@
    #include

    #include
    -#include "au1xmmc.h"

    #define DRIVER_NAME "au1xxx-mmc"

    @@ -61,31 +60,71 @@
    #define DBG(fmt, idx, args...)
    #endif

    -const struct {
    - u32 iobase;
    - u32 tx_devid, rx_devid;
    - u16 bcsrpwr;
    - u16 bcsrstatus;
    - u16 wpstatus;
    -} au1xmmc_card_table[] = {
    - { SD0_BASE, DSCR_CMD0_SDMS_TX0, DSCR_CMD0_SDMS_RX0,
    - BCSR_BOARD_SD0PWR, BCSR_INT_SD0INSERT, BCSR_STATUS_SD0WP },
    -#ifndef CONFIG_MIPS_DB1200
    - { SD1_BASE, DSCR_CMD0_SDMS_TX1, DSCR_CMD0_SDMS_RX1,
    - BCSR_BOARD_DS1PWR, BCSR_INT_SD1INSERT, BCSR_STATUS_SD1WP }
    +#define AU1XMMC_DESCRIPTOR_COUNT 1
    +#define AU1XMMC_DESCRIPTOR_SIZE 4096
    +
    +#define AU1XMMC_OCR ( MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | \
    + MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | \
    + MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36)
    +
    +/* Easy access macros */
    +
    +#define HOST_STATUS(h) ((h)->iobase + SD_STATUS)
    +#define HOST_CONFIG(h) ((h)->iobase + SD_CONFIG)
    +#define HOST_ENABLE(h) ((h)->iobase + SD_ENABLE)
    +#define HOST_TXPORT(h) ((h)->iobase + SD_TXPORT)
    +#define HOST_RXPORT(h) ((h)->iobase + SD_RXPORT)
    +#define HOST_CMDARG(h) ((h)->iobase + SD_CMDARG)
    +#define HOST_BLKSIZE(h) ((h)->iobase + SD_BLKSIZE)
    +#define HOST_CMD(h) ((h)->iobase + SD_CMD)
    +#define HOST_CONFIG2(h) ((h)->iobase + SD_CONFIG2)
    +#define HOST_TIMEOUT(h) ((h)->iobase + SD_TIMEOUT)
    +#define HOST_DEBUG(h) ((h)->iobase + SD_DEBUG)
    +
    +#define DMA_CHANNEL(h) \
    + ( ((h)->flags & HOST_F_XMIT) ? (h)->dma.tx_chan : (h)->dma.rx_chan)
    +
    +/* This gives us a hard value for the stop command that we can write directly
    + * to the command register
    + */
    +
    +#define STOP_CMD (SD_CMD_RT_1B|SD_CMD_CT_7|(0xC << SD_CMD_CI_SHIFT)|SD_CMD_GO)
    +
    +/* This is the set of interrupts that we configure by default */
    +
    +#if 0
    +#define AU1XMMC_INTERRUPTS (SD_CONFIG_SC | SD_CONFIG_DT | SD_CONFIG_DD | \
    + SD_CONFIG_RAT | SD_CONFIG_CR | SD_CONFIG_I)
    #endif
    -};

    -#define AU1XMMC_CONTROLLER_COUNT (ARRAY_SIZE(au1xmmc_card_table))
    +#define AU1XMMC_INTERRUPTS (SD_CONFIG_SC | SD_CONFIG_DT | \
    + SD_CONFIG_RAT | SD_CONFIG_CR | SD_CONFIG_I)
    +/* The poll event (looking for insert/remove events runs twice a second */
    +#define AU1XMMC_DETECT_TIMEOUT (HZ/2)
    +
    +/* Status flags used by the host structure */
    +#define HOST_F_XMIT 0x0001
    +#define HOST_F_RECV 0x0002
    +#define HOST_F_DMA 0x0010
    +#define HOST_F_ACTIVE 0x0100
    +#define HOST_F_STOP 0x1000
    +
    +#define HOST_S_IDLE 0x0001
    +#define HOST_S_CMD 0x0002
    +#define HOST_S_DATA 0x0003
    +#define HOST_S_STOP 0x0004

    -/* This array stores pointers for the hosts (used by the IRQ handler) */
    -struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT];
    static int dma = 1;

    -#ifdef MODULE
    module_param(dma, bool, 0);
    MODULE_PARM_DESC(dma, "Use DMA engine for data transfers (0 = disabled)");
    -#endif
    +
    +/* 8bit memory device */
    +static dbdev_tab_t au1xmmc_mem_dbdev = {
    + DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 8, 0x00000000, 0, 0
    +};
    +static int memid;
    +

    static inline void IRQ_ON(struct au1xmmc_host *host, u32 mask)
    {
    @@ -135,31 +174,37 @@ static inline void SEND_STOP(struct au1xmmc_host *host)

    static void au1xmmc_set_power(struct au1xmmc_host *host, int state)
    {
    -
    - u32 val = au1xmmc_card_table[host->id].bcsrpwr;
    -
    - bcsr->board &= ~val;
    - if (state) bcsr->board |= val;
    -
    - au_sync_delay(1);
    + if (host->platdata && host->platdata->set_power)
    + host->platdata->set_power(host->mmc, state);
    }

    -static inline int au1xmmc_card_inserted(struct au1xmmc_host *host)
    +static int au1xmmc_card_inserted(struct au1xmmc_host *host)
    {
    - return (bcsr->sig_status & au1xmmc_card_table[host->id].bcsrstatus)
    - ? 1 : 0;
    + int ret;
    +
    + if (host->platdata && host->platdata->card_inserted)
    + ret = host->platdata->card_inserted(host->mmc);
    + else
    + ret = 1; /* assume there is a card */
    +
    + return ret;
    }

    static int au1xmmc_card_readonly(struct mmc_host *mmc)
    {
    struct au1xmmc_host *host = mmc_priv(mmc);
    - return (bcsr->status & au1xmmc_card_table[host->id].wpstatus)
    - ? 1 : 0;
    + int ret;
    +
    + if (host->platdata && host->platdata->card_readonly)
    + ret = host->platdata->card_readonly(mmc);
    + else
    + ret = 1; /* assume card is read-only */
    +
    + return ret;
    }

    static void au1xmmc_finish_request(struct au1xmmc_host *host)
    {
    -
    struct mmc_request *mrq = host->mrq;

    host->mrq = NULL;
    @@ -174,8 +219,6 @@ static void au1xmmc_finish_request(struct au1xmmc_host *host)

    host->status = HOST_S_IDLE;

    - bcsr->disk_leds |= (1 << 8);
    -
    mmc_request_done(host->mmc, mrq);
    }

    @@ -663,7 +706,9 @@ static void au1xmmc_request(struct mmc_host* mmc, struct mmc_request* mrq)
    host->mrq = mrq;
    host->status = HOST_S_CMD;

    - bcsr->disk_leds &= ~(1 << 8);
    + au_writel(0, HOST_STATUS(host));
    + au_sync();
    + FLUSH_FIFO(host);

    if (mrq->data) {
    FLUSH_FIFO(host);
    @@ -749,118 +794,87 @@ static void au1xmmc_dma_callback(int irq, void *dev_id)

    static irqreturn_t au1xmmc_irq(int irq, void *dev_id)
    {
    -
    + struct au1xmmc_host *host = dev_id;
    u32 status;
    - int i, ret = 0;
    -
    - disable_irq(AU1100_SD_IRQ);
    -
    - for(i = 0; i < AU1XMMC_CONTROLLER_COUNT; i++) {
    - struct au1xmmc_host * host = au1xmmc_hosts[i];
    - u32 handled = 1;

    - status = au_readl(HOST_STATUS(host));
    + status = au_readl(HOST_STATUS(host));

    - if (host->mrq && (status & STATUS_TIMEOUT)) {
    - if (status & SD_STATUS_RAT)
    - host->mrq->cmd->error = -ETIMEDOUT;
    + if (!(status & (1<<15)))
    + return IRQ_NONE; /* not ours */

    - else if (status & SD_STATUS_DT)
    - host->mrq->data->error = -ETIMEDOUT;
    + if (host->mrq && (status & STATUS_TIMEOUT)) {
    + if (status & SD_STATUS_RAT)
    + host->mrq->cmd->error = -ETIMEDOUT;
    + else if (status & SD_STATUS_DT)
    + host->mrq->data->error = -ETIMEDOUT;

    - /* In PIO mode, interrupts might still be enabled */
    - IRQ_OFF(host, SD_CONFIG_NE | SD_CONFIG_TH);
    + /* In PIO mode, interrupts might still be enabled */
    + IRQ_OFF(host, SD_CONFIG_NE | SD_CONFIG_TH);

    - //IRQ_OFF(host, SD_CONFIG_TH|SD_CONFIG_RA|SD_CONFIG_RF);
    - tasklet_schedule(&host->finish_task);
    - }
    + //IRQ_OFF(host, SD_CONFIG_TH|SD_CONFIG_RA|SD_CONFIG_RF);
    + tasklet_schedule(&host->finish_task);
    + }
    #if 0
    - else if (status & SD_STATUS_DD) {
    -
    - /* Sometimes we get a DD before a NE in PIO mode */
    -
    - if (!(host->flags & HOST_F_DMA) &&
    - (status & SD_STATUS_NE))
    - au1xmmc_receive_pio(host);
    - else {
    - au1xmmc_data_complete(host, status);
    - //tasklet_schedule(&host->data_task);
    - }
    - }
    -#endif
    - else if (status & (SD_STATUS_CR)) {
    - if (host->status == HOST_S_CMD)
    - au1xmmc_cmd_complete(host,status);
    - }
    - else if (!(host->flags & HOST_F_DMA)) {
    - if ((host->flags & HOST_F_XMIT) &&
    - (status & STATUS_DATA_OUT))
    - au1xmmc_send_pio(host);
    - else if ((host->flags & HOST_F_RECV) &&
    - (status & STATUS_DATA_IN))
    - au1xmmc_receive_pio(host);
    - }
    - else if (status & 0x203FBC70) {
    - DBG("Unhandled status %8.8x\n", host->id, status);
    - handled = 0;
    + else if (status & SD_STATUS_DD) {
    + /* Sometimes we get a DD before a NE in PIO mode */
    + if (!(host->flags & HOST_F_DMA) && (status & SD_STATUS_NE))
    + au1xmmc_receive_pio(host);
    + else {
    + au1xmmc_data_complete(host, status);
    + //tasklet_schedule(&host->data_task);
    }
    -
    - au_writel(status, HOST_STATUS(host));
    - au_sync();
    -
    - ret |= handled;
    }
    +#endif
    + else if (status & (SD_STATUS_CR)) {
    + if (host->status == HOST_S_CMD)
    + au1xmmc_cmd_complete(host,status);

    - enable_irq(AU1100_SD_IRQ);
    - return ret;
    -}
    -
    -static void au1xmmc_poll_event(unsigned long arg)
    -{
    - struct au1xmmc_host *host = (struct au1xmmc_host *) arg;
    -
    - int card = au1xmmc_card_inserted(host);
    - int controller = (host->flags & HOST_F_ACTIVE) ? 1 : 0;
    + } else if (!(host->flags & HOST_F_DMA)) {
    + if ((host->flags & HOST_F_XMIT) && (status & STATUS_DATA_OUT))
    + au1xmmc_send_pio(host);
    + else if ((host->flags & HOST_F_RECV) && (status & STATUS_DATA_IN))
    + au1xmmc_receive_pio(host);

    - if (card != controller) {
    - host->flags &= ~HOST_F_ACTIVE;
    - if (card) host->flags |= HOST_F_ACTIVE;
    - mmc_detect_change(host->mmc, 0);
    + } else if (status & 0x203FBC70) {
    + DBG("Unhandled status %8.8x\n", host->id, status);
    }

    - if (host->mrq != NULL) {
    - u32 status = au_readl(HOST_STATUS(host));
    - DBG("PENDING - %8.8x\n", host->id, status);
    - }
    + au_writel(status, HOST_STATUS(host));
    + au_sync();

    - mod_timer(&host->timer, jiffies + AU1XMMC_DETECT_TIMEOUT);
    + return IRQ_HANDLED;
    }

    -static dbdev_tab_t au1xmmc_mem_dbdev =
    -{
    - DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 8, 0x00000000, 0, 0
    -};
    -
    -static void au1xmmc_init_dma(struct au1xmmc_host *host)
    +static int au1xmmc_init_dma(struct au1xmmc_host *host)
    {
    -
    + struct resource *res;
    u32 rxchan, txchan;
    + int txid, rxid;

    - int txid = au1xmmc_card_table[host->id].tx_devid;
    - int rxid = au1xmmc_card_table[host->id].rx_devid;
    -
    - /* DSCR_CMD0_ALWAYS has a stride of 32 bits, we need a stride
    - of 8 bits. And since devices are shared, we need to create
    - our own to avoid freaking out other devices
    - */
    + res = platform_get_resource(host->pdev, IORESOURCE_DMA, 0);
    + if (!res)
    + return -ENODEV;
    + txid = res->start;

    - int memid = au1xxx_ddma_add_device(&au1xmmc_mem_dbdev);
    + res = platform_get_resource(host->pdev, IORESOURCE_DMA, 1);
    + if (!res)
    + return -ENODEV;
    + rxid = res->start;

    txchan = au1xxx_dbdma_chan_alloc(memid, txid,
    - au1xmmc_dma_callback, (void *) host);
    + au1xmmc_dma_callback, (void *)host);
    + if (!txchan) {
    + dev_err(&host->pdev->dev, "cannot allocate TX DMA\n");
    + return -ENODEV;
    + }

    rxchan = au1xxx_dbdma_chan_alloc(rxid, memid,
    - au1xmmc_dma_callback, (void *) host);
    + au1xmmc_dma_callback, (void *)host);
    + if (!rxchan) {
    + dev_err(&host->pdev->dev, "cannot allocate RX DMA\n");
    + au1xxx_dbdma_chan_free(txchan);
    + return -ENODEV;
    + }

    au1xxx_dbdma_set_devwidth(txchan, 8);
    au1xxx_dbdma_set_devwidth(rxchan, 8);
    @@ -868,8 +882,10 @@ static void au1xmmc_init_dma(struct au1xmmc_host *host)
    au1xxx_dbdma_ring_alloc(txchan, AU1XMMC_DESCRIPTOR_COUNT);
    au1xxx_dbdma_ring_alloc(rxchan, AU1XMMC_DESCRIPTOR_COUNT);

    - host->tx_chan = txchan;
    - host->rx_chan = rxchan;
    + host->dma.tx_chan = txchan;
    + host->dma.rx_chan = rxchan;
    +
    + return 0;
    }

    static const struct mmc_host_ops au1xmmc_ops = {
    @@ -878,116 +894,197 @@ static const struct mmc_host_ops au1xmmc_ops = {
    .get_ro = au1xmmc_card_readonly,
    };

    -static int __devinit au1xmmc_probe(struct platform_device *pdev)
    +static void au1xmmc_poll_event(unsigned long arg)
    {
    + struct au1xmmc_host *host = (struct au1xmmc_host *)arg;

    - int i, ret = 0;
    + int card = au1xmmc_card_inserted(host);
    + int controller = (host->flags & HOST_F_ACTIVE) ? 1 : 0;

    - /* THe interrupt is shared among all controllers */
    - ret = request_irq(AU1100_SD_IRQ, au1xmmc_irq, IRQF_DISABLED, "MMC", 0);
    + if (card != controller) {
    + host->flags &= ~HOST_F_ACTIVE;
    + if (card)
    + host->flags |= HOST_F_ACTIVE;
    + mmc_detect_change(host->mmc, 0);
    + }

    - if (ret) {
    - printk(DRIVER_NAME "ERROR: Couldn't get int %d: %d\n",
    - AU1100_SD_IRQ, ret);
    - return -ENXIO;
    +#if 0
    + if (host->mrq != NULL) {
    + u32 status = au_readl(HOST_STATUS(host));
    + DBG("PENDING - %8.8x\n", host->id, status);
    }
    +#endif
    + mod_timer(&host->timer, jiffies + AU1XMMC_DETECT_TIMEOUT);
    +}

    - disable_irq(AU1100_SD_IRQ);
    +static void au1xmmc_init_cd_poll_timer(struct au1xmmc_host *host)
    +{
    + init_timer(&host->timer);
    + host->timer.function = au1xmmc_poll_event;
    + host->timer.data = (unsigned long)host;
    + host->timer.expires = jiffies + AU1XMMC_DETECT_TIMEOUT;
    +}

    - for(i = 0; i < AU1XMMC_CONTROLLER_COUNT; i++) {
    - struct mmc_host *mmc = mmc_alloc_host(sizeof(struct au1xmmc_host), &pdev->dev);
    - struct au1xmmc_host *host = 0;
    +static int __devinit au1xmmc_probe(struct platform_device *pdev)
    +{
    + struct mmc_host *mmc;
    + struct au1xmmc_host *host;
    + struct resource *r;
    + int ret;
    +
    + mmc = mmc_alloc_host(sizeof(struct au1xmmc_host), &pdev->dev);
    + if (!mmc) {
    + dev_err(&pdev->dev, "no memory for mmc host\n");
    + ret = -ENOMEM;
    + goto out0;
    + }

    - if (!mmc) {
    - printk(DRIVER_NAME "ERROR: no mem for host %d\n", i);
    - au1xmmc_hosts[i] = 0;
    - continue;
    - }
    + host = mmc_priv(mmc);
    + host->mmc = mmc;
    + host->platdata = pdev->dev.platform_data;
    + host->pdev = pdev;

    - mmc->ops = &au1xmmc_ops;
    + ret = -ENODEV;
    + r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    + if (!r) {
    + dev_err(&pdev->dev, "no mmio defined\n");
    + goto out1;
    + }
    + host->iobase = (unsigned long)ioremap(r->start, 0xff);
    + if (!host->iobase) {
    + dev_err(&pdev->dev, "cannot remap mmio\n");
    + goto out1;
    + }

    - mmc->f_min = 450000;
    - mmc->f_max = 24000000;
    + r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
    + if (!r) {
    + dev_err(&pdev->dev, "no IRQ defined\n");
    + goto out2;
    + }

    - mmc->max_seg_size = AU1XMMC_DESCRIPTOR_SIZE;
    - mmc->max_phys_segs = AU1XMMC_DESCRIPTOR_COUNT;
    + host->irq = r->start;
    + /* IRQ is shared among both SD controllers */
    + ret = request_irq(host->irq, au1xmmc_irq, IRQF_SHARED,
    + DRIVER_NAME, host);
    + if (ret) {
    + dev_err(&pdev->dev, "cannot grab IRQ\n");
    + goto out2;
    + }

    - mmc->max_blk_size = 2048;
    - mmc->max_blk_count = 512;
    + mmc->ops = &au1xmmc_ops;

    - mmc->ocr_avail = AU1XMMC_OCR;
    + mmc->f_min = 450000;
    + mmc->f_max = 24000000;

    - host = mmc_priv(mmc);
    - host->mmc = mmc;
    + mmc->max_seg_size = AU1XMMC_DESCRIPTOR_SIZE;
    + mmc->max_phys_segs = AU1XMMC_DESCRIPTOR_COUNT;

    - host->id = i;
    - host->iobase = au1xmmc_card_table[host->id].iobase;
    - host->clock = 0;
    - host->power_mode = MMC_POWER_OFF;
    + mmc->max_blk_size = 2048;
    + mmc->max_blk_count = 512;

    - host->flags = au1xmmc_card_inserted(host) ? HOST_F_ACTIVE : 0;
    - host->status = HOST_S_IDLE;
    + mmc->ocr_avail = AU1XMMC_OCR;
    + mmc->caps = 0;

    - init_timer(&host->timer);
    + host->id = pdev->id;
    + host->status = HOST_S_IDLE;

    - host->timer.function = au1xmmc_poll_event;
    - host->timer.data = (unsigned long) host;
    - host->timer.expires = jiffies + AU1XMMC_DETECT_TIMEOUT;
    + /* board-specific carddetect setup, if any */
    + if (host->platdata && host->platdata->cd_setup) {
    + ret = host->platdata->cd_setup(mmc, 1);
    + if (ret) {
    + dev_err(&pdev->dev, "board CD setup failed\n");
    + goto out3;
    + }
    + } else {
    + /* poll the board-specific card-is-in-socket method */
    + au1xmmc_init_cd_poll_timer(host);
    + }

    - tasklet_init(&host->data_task, au1xmmc_tasklet_data,
    - (unsigned long) host);
    + tasklet_init(&host->data_task, au1xmmc_tasklet_data,
    + (unsigned long)host);

    - tasklet_init(&host->finish_task, au1xmmc_tasklet_finish,
    - (unsigned long) host);
    + tasklet_init(&host->finish_task, au1xmmc_tasklet_finish,
    + (unsigned long)host);

    - spin_lock_init(&host->lock);
    + if (dma) {
    + ret = au1xmmc_init_dma(host);
    + if (ret)
    + goto out4;
    + }

    - if (dma != 0)
    - au1xmmc_init_dma(host);
    + au1xmmc_reset_controller(host);

    - au1xmmc_reset_controller(host);
    + ret = mmc_add_host(mmc);
    + if (ret) {
    + dev_err(&pdev->dev, "cannot add mmc host\n");
    + goto out5;
    + }

    - mmc_add_host(mmc);
    - au1xmmc_hosts[i] = host;
    + platform_set_drvdata(pdev, mmc);

    + /* start the carddetect poll timer */
    + if (!(host->platdata && host->platdata->cd_setup))
    add_timer(&host->timer);

    - printk(KERN_INFO DRIVER_NAME ": MMC Controller %d set up at %8.8X (mode=%s)\n",
    - host->id, host->iobase, dma ? "dma" : "pio");
    - }
    + printk(KERN_INFO DRIVER_NAME ": MMC Controller %d set up at %8.8X (mode=%s)\n",
    + pdev->id, host->iobase, dma ? "dma" : "pio");

    - enable_irq(AU1100_SD_IRQ);
    + return 0; /* all ok */

    - return 0;
    +out5:
    + if (dma) {
    + au1xxx_dbdma_chan_free(host->dma.tx_chan);
    + au1xxx_dbdma_chan_free(host->dma.rx_chan);
    + }
    +out4:
    + tasklet_kill(&host->data_task);
    + tasklet_kill(&host->finish_task);
    +
    + if (host->platdata && host->platdata->cd_setup)
    + host->platdata->cd_setup(mmc, 0);
    +out3:
    + free_irq(host->irq, host);
    +out2:
    + iounmap((void *)host->iobase);
    +out1:
    + mmc_free_host(mmc);
    +out0:
    + return ret;
    }

    static int __devexit au1xmmc_remove(struct platform_device *pdev)
    {
    + struct mmc_host *mmc = platform_get_drvdata(pdev);
    + struct au1xmmc_host *host;

    - int i;
    + if (mmc) {
    + host = mmc_priv(mmc);

    - disable_irq(AU1100_SD_IRQ);
    + if (host->platdata && host->platdata->cd_setup)
    + host->platdata->cd_setup(mmc, 0);
    + else
    + del_timer_sync(&host->timer);

    - for(i = 0; i < AU1XMMC_CONTROLLER_COUNT; i++) {
    - struct au1xmmc_host *host = au1xmmc_hosts[i];
    - if (!host) continue;
    + au_writel(0, HOST_ENABLE(host));
    + au_writel(0, HOST_CONFIG(host));
    + au_sync();

    tasklet_kill(&host->data_task);
    tasklet_kill(&host->finish_task);

    - del_timer_sync(&host->timer);
    au1xmmc_set_power(host, 0);

    - mmc_remove_host(host->mmc);
    + free_irq(host->irq, host);

    - au1xxx_dbdma_chan_free(host->tx_chan);
    - au1xxx_dbdma_chan_free(host->rx_chan);
    + mmc_remove_host(mmc);

    - au_writel(0x0, HOST_ENABLE(host));
    - au_sync();
    - }
    + if (dma) {
    + au1xxx_dbdma_chan_free(host->dma.tx_chan);
    + au1xxx_dbdma_chan_free(host->dma.rx_chan);
    + }

    - free_irq(AU1100_SD_IRQ, 0);
    + mmc_free_host(mmc);
    + }
    return 0;
    }

    @@ -1004,21 +1101,32 @@ static struct platform_driver au1xmmc_driver = {

    static int __init au1xmmc_init(void)
    {
    + if (dma) {
    + /* DSCR_CMD0_ALWAYS has a stride of 32 bits, we need a stride
    + of 8 bits. And since devices are shared, we need to create
    + our own to avoid freaking out other devices
    + */
    + if (!memid)
    + memid = au1xxx_ddma_add_device(&au1xmmc_mem_dbdev);
    + if (!memid) {
    + printk(KERN_ERR "au1xmmc: cannot add memory dma dev\n");
    + return -ENODEV;
    + }
    + }
    return platform_driver_register(&au1xmmc_driver);
    }

    static void __exit au1xmmc_exit(void)
    {
    + if (dma && memid)
    + au1xxx_ddma_del_device(memid);
    platform_driver_unregister(&au1xmmc_driver);
    }

    module_init(au1xmmc_init);
    module_exit(au1xmmc_exit);

    -#ifdef MODULE
    MODULE_AUTHOR("Advanced Micro Devices, Inc");
    MODULE_DESCRIPTION("MMC/SD driver for the Alchemy Au1XXX");
    MODULE_LICENSE("GPL");
    MODULE_ALIAS("platform:au1xxx-mmc");
    -#endif
    -
    diff --git a/drivers/mmc/host/au1xmmc.h b/drivers/mmc/host/au1xmmc.h
    deleted file mode 100644
    index 341cbdf..0000000
    --- a/drivers/mmc/host/au1xmmc.h
    +++ /dev/null
    @@ -1,96 +0,0 @@
    -#ifndef _AU1XMMC_H_
    -#define _AU1XMMC_H_
    -
    -/* Hardware definitions */
    -
    -#define AU1XMMC_DESCRIPTOR_COUNT 1
    -#define AU1XMMC_DESCRIPTOR_SIZE 2048
    -
    -#define AU1XMMC_OCR ( MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | \
    - MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | \
    - MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36)
    -
    -/* Easy access macros */
    -
    -#define HOST_STATUS(h) ((h)->iobase + SD_STATUS)
    -#define HOST_CONFIG(h) ((h)->iobase + SD_CONFIG)
    -#define HOST_ENABLE(h) ((h)->iobase + SD_ENABLE)
    -#define HOST_TXPORT(h) ((h)->iobase + SD_TXPORT)
    -#define HOST_RXPORT(h) ((h)->iobase + SD_RXPORT)
    -#define HOST_CMDARG(h) ((h)->iobase + SD_CMDARG)
    -#define HOST_BLKSIZE(h) ((h)->iobase + SD_BLKSIZE)
    -#define HOST_CMD(h) ((h)->iobase + SD_CMD)
    -#define HOST_CONFIG2(h) ((h)->iobase + SD_CONFIG2)
    -#define HOST_TIMEOUT(h) ((h)->iobase + SD_TIMEOUT)
    -#define HOST_DEBUG(h) ((h)->iobase + SD_DEBUG)
    -
    -#define DMA_CHANNEL(h) \
    - ( ((h)->flags & HOST_F_XMIT) ? (h)->tx_chan : (h)->rx_chan)
    -
    -/* This gives us a hard value for the stop command that we can write directly
    - * to the command register
    - */
    -
    -#define STOP_CMD (SD_CMD_RT_1B|SD_CMD_CT_7|(0xC << SD_CMD_CI_SHIFT)|SD_CMD_GO)
    -
    -/* This is the set of interrupts that we configure by default */
    -
    -#if 0
    -#define AU1XMMC_INTERRUPTS (SD_CONFIG_SC | SD_CONFIG_DT | SD_CONFIG_DD | \
    - SD_CONFIG_RAT | SD_CONFIG_CR | SD_CONFIG_I)
    -#endif
    -
    -#define AU1XMMC_INTERRUPTS (SD_CONFIG_SC | SD_CONFIG_DT | \
    - SD_CONFIG_RAT | SD_CONFIG_CR | SD_CONFIG_I)
    -/* The poll event (looking for insert/remove events runs twice a second */
    -#define AU1XMMC_DETECT_TIMEOUT (HZ/2)
    -
    -struct au1xmmc_host {
    - struct mmc_host *mmc;
    - struct mmc_request *mrq;
    -
    - u32 id;
    -
    - u32 flags;
    - u32 iobase;
    - u32 clock;
    - u32 bus_width;
    - u32 power_mode;
    -
    - int status;
    -
    - struct {
    - int len;
    - int dir;
    - } dma;
    -
    - struct {
    - int index;
    - int offset;
    - int len;
    - } pio;
    -
    - u32 tx_chan;
    - u32 rx_chan;
    -
    - struct timer_list timer;
    - struct tasklet_struct finish_task;
    - struct tasklet_struct data_task;
    -
    - spinlock_t lock;
    -};
    -
    -/* Status flags used by the host structure */
    -
    -#define HOST_F_XMIT 0x0001
    -#define HOST_F_RECV 0x0002
    -#define HOST_F_DMA 0x0010
    -#define HOST_F_ACTIVE 0x0100
    -#define HOST_F_STOP 0x1000
    -
    -#define HOST_S_IDLE 0x0001
    -#define HOST_S_CMD 0x0002
    -#define HOST_S_DATA 0x0003
    -#define HOST_S_STOP 0x0004
    -
    -#endif
    diff --git a/include/asm-mips/mach-au1x00/au1100_mmc.h b/include/asm-mips/mach-au1x00/au1100_mmc.h
    index 9e0028f..6474fac 100644
    --- a/include/asm-mips/mach-au1x00/au1100_mmc.h
    +++ b/include/asm-mips/mach-au1x00/au1100_mmc.h
    @@ -38,15 +38,46 @@
    #ifndef __ASM_AU1100_MMC_H
    #define __ASM_AU1100_MMC_H

    -
    -#define NUM_AU1100_MMC_CONTROLLERS 2
    -
    -#if defined(CONFIG_SOC_AU1100)
    -#define AU1100_SD_IRQ AU1100_SD_INT
    -#elif defined(CONFIG_SOC_AU1200)
    -#define AU1100_SD_IRQ AU1200_SD_INT
    -#endif
    -
    +struct au1xmmc_platdata {
    + int(*cd_setup)(void *mmc_host, int on);
    + int(*card_inserted)(void *mmc_host);
    + int(*card_readonly)(void *mmc_host);
    + void(*set_power)(void *mmc_host, int state);
    +};
    +
    +struct au1xmmc_host {
    + struct mmc_host *mmc;
    + struct mmc_request *mrq;
    +
    + u32 id;
    +
    + u32 flags;
    + u32 iobase;
    + u32 clock;
    +
    + int status;
    +
    + struct {
    + int len;
    + int dir;
    + u32 tx_chan;
    + u32 rx_chan;
    + } dma;
    +
    + struct {
    + int index;
    + int offset;
    + int len;
    + } pio;
    +
    + struct timer_list timer;
    + struct tasklet_struct finish_task;
    + struct tasklet_struct data_task;
    +
    + struct platform_device *pdev;
    + struct au1xmmc_platdata *platdata;
    + int irq;
    +};

    #define SD0_BASE 0xB0600000
    #define SD1_BASE 0xB0680000
    --
    1.5.5.1

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  8. Re: [PATCH 4/7] Alchemy: db1200/pb1200: register mmc platform device and board specific functions

    Hello.

    Manuel Lauss wrote:

    > Signed-off-by: Manuel Lauss


    > diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
    > index 31d2a22..08a5900 100644
    > --- a/arch/mips/au1000/common/platform.c
    > +++ b/arch/mips/au1000/common/platform.c


    Hm, I don't see anything board-specific in
    arch/mips/au1000/common/platform.c anymore -- after I removed IDE and SMC
    91C111 from there (these were devices on the static bus).

    > @@ -162,24 +162,6 @@ static struct resource au1xxx_usb_gdt_resources[] = {
    > },
    > };
    >
    > -static struct resource au1xxx_mmc_resources[] = {
    > - [0] = {
    > - .start = SD0_PHYS_ADDR,
    > - .end = SD0_PHYS_ADDR + 0x40,
    > - .flags = IORESOURCE_MEM,
    > - },
    > - [1] = {
    > - .start = SD1_PHYS_ADDR,
    > - .end = SD1_PHYS_ADDR + 0x40,


    Hm, I haven't noticed that these are off-by-one... :-/

    > - .flags = IORESOURCE_MEM,
    > - },
    > - [2] = {
    > - .start = AU1200_SD_INT,
    > - .end = AU1200_SD_INT,
    > - .flags = IORESOURCE_IRQ,
    > - }
    > -};
    > -
    > static u64 udc_dmamask = ~(u32)0;
    >
    > static struct platform_device au1xxx_usb_gdt_device = {
    > @@ -245,19 +227,6 @@ static struct platform_device au1200_lcd_device = {
    > .num_resources = ARRAY_SIZE(au1200_lcd_resources),
    > .resource = au1200_lcd_resources,
    > };
    > -
    > -static u64 au1xxx_mmc_dmamask = ~(u32)0;
    > -
    > -static struct platform_device au1xxx_mmc_device = {
    > - .name = "au1xxx-mmc",
    > - .id = 0,
    > - .dev = {
    > - .dma_mask = &au1xxx_mmc_dmamask,
    > - .coherent_dma_mask = 0xffffffff,
    > - },
    > - .num_resources = ARRAY_SIZE(au1xxx_mmc_resources),
    > - .resource = au1xxx_mmc_resources,
    > -};
    > #endif /* #ifdef CONFIG_SOC_AU1200 */


    What board-specific was here?

    > static struct platform_device au1x00_pcmcia_device = {
    > diff --git a/arch/mips/au1000/pb1200/platform.c b/arch/mips/au1000/pb1200/platform.c
    > index 5930110..bee2bf7 100644
    > --- a/arch/mips/au1000/pb1200/platform.c
    > +++ b/arch/mips/au1000/pb1200/platform.c
    > @@ -20,8 +20,17 @@
    >
    > #include
    > #include
    > +#include
    >
    > #include
    > +#include
    > +#include
    > +
    > +#if defined(CONFIG_MIPS_PB1200)
    > +#include
    > +#elif defined(CONFIG_MIPS_DB1200)
    > +#include
    > +#endif


    #include does all that already -- you don't need to
    include the board specific headers one more time. Drop this part please.

    > static struct resource ide_resources[] = {
    > [0] = {
    > @@ -70,9 +79,125 @@ static struct platform_device smc91c111_device = {
    > .resource = smc91c111_resources
    > };
    >
    > +
    > +static const struct {
    > + u16 bcsrpwr;
    > + u16 bcsrstatus;
    > + u16 wpstatus;
    > +} au1xmmc_card_table[] = {
    > + { BCSR_BOARD_SD0PWR, BCSR_INT_SD0INSERT, BCSR_STATUS_SD0WP },
    > +#ifndef CONFIG_MIPS_DB1200
    > + { BCSR_BOARD_SD1PWR, BCSR_INT_SD1INSERT, BCSR_STATUS_SD1WP }
    > +#endif
    > +};
    > +
    > +static void pb1200mmc_set_power(void *mmc_host, int state)
    > +{
    > + struct au1xmmc_host *host = mmc_priv((struct mmc_host *)mmc_host);
    > + u32 val = au1xmmc_card_table[host->id].bcsrpwr;
    > +
    > + bcsr->board &= ~val;
    > + if (state)
    > + bcsr->board |= val;
    > +
    > + au_sync_delay(1);
    > +}
    > +
    > +static int pb1200mmc_card_readonly(void *mmc_host)
    > +{
    > + struct au1xmmc_host *host = mmc_priv((struct mmc_host *)mmc_host);


    Insert new line after a declaration please.

    > + return (bcsr->status & au1xmmc_card_table[host->id].wpstatus) ? 1 : 0;
    > +}
    > +
    > +static int pb1200mmc_card_inserted(void *mmc_host)
    > +{
    > + struct au1xmmc_host *host = mmc_priv((struct mmc_host *)mmc_host);


    The same here.

    > + return (bcsr->sig_status & au1xmmc_card_table[host->id].bcsrstatus)
    > + ? 1 : 0;
    > +}
    > +
    > +static struct au1xmmc_platdata db1xmmcpd = {
    > + .set_power = pb1200mmc_set_power,
    > + .card_inserted = pb1200mmc_card_inserted,
    > + .card_readonly = pb1200mmc_card_readonly,
    > + .cd_setup = NULL, /* use poll-timer in driver */


    Function ptrs in the platform data? That's something new -- though why
    not? :-)

    > +};
    > +
    > +static u64 au1xxx_mmc_dmamask = ~(u32)0;
    > +
    > +struct resource au1200sd0_res[] = {
    > + [0] = {
    > + .start = CPHYSADDR(SD0_BASE),


    Why not just use SD0_PHYS_ADDR?

    > + .end = CPHYSADDR(SD0_BASE) + 0x40,


    You've missed "- 1" here. Though it's alos not clear why 0x40 and not 0x3c
    (there's not register at 0x3c) or 0x80000 -- the range used according to the
    memory map...

    > + .flags = IORESOURCE_MEM,
    > + },
    > + [2] = {
    > + .start = AU1200_SD_INT,
    > + .flags = IORESOURCE_IRQ,
    > + },
    > + [3] = {
    > + .start = DSCR_CMD0_SDMS_TX0,
    > + .flags = IORESOURCE_DMA,
    > + },
    > + [4] = {
    > + .start = DSCR_CMD0_SDMS_RX0,
    > + .flags = IORESOURCE_DMA,
    > + },
    > +};


    Humm. The other devices (like IDE) should also claim DMA resources...

    > +
    > +static struct platform_device au1200_sd0_device = {
    > + .name = "au1xxx-mmc",
    > + .id = 0, /* index into au1xmmc_card_table[] */
    > + .dev = {
    > + .dma_mask = &au1xxx_mmc_dmamask,
    > + .coherent_dma_mask = 0xffffffff,
    > + .platform_data = &db1xmmcpd,


    Can't we leave the MMC platform device where it is but define the platform
    data structure per board with some starndard name? Since IMO it doesn't make
    sense to move the platform device itself.

    > + },
    > + .num_resources = ARRAY_SIZE(au1200sd0_res),
    > + .resource = au1200sd0_res,
    > +};
    > +
    > +#ifndef CONFIG_MIPS_DB1200


    Wait, SD controller 1 is there regardless of the board, so should be
    registerred regardless. If however the board doesn't have the necessary
    resources to support the driver functionality, I think it can be indicated by
    the board-level platform data, so that the driver could decide whether it
    wants to support that controller or not.

    > +struct resource au1200sd1_res[] = {
    > + [0] = {
    > + .start = CPHYSADDR(SD1_BASE),
    > + .end = CPHYSADDR(SD1_BASE) + 0xff,


    Why not 0x40 if the controllers are symmetric I wonder? I'd say it should
    be 0x80000 even (and don't forget to sutract one ;-)...

    WBR, Sergei

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  9. Re: [PATCH 4/7] Alchemy: db1200/pb1200: register mmc platform device and board specific functions

    Hi Sergei,

    On Thu, May 08, 2008 at 04:41:32PM +0400, Sergei Shtylyov wrote:
    >> diff --git a/arch/mips/au1000/common/platform.c
    >> b/arch/mips/au1000/common/platform.c
    >> index 31d2a22..08a5900 100644
    >> --- a/arch/mips/au1000/common/platform.c
    >> +++ b/arch/mips/au1000/common/platform.c
    >> -
    >> -static struct platform_device au1xxx_mmc_device = {
    >> - .name = "au1xxx-mmc",
    >> - .id = 0,
    >> - .dev = {
    >> - .dma_mask = &au1xxx_mmc_dmamask,
    >> - .coherent_dma_mask = 0xffffffff,
    >> - },
    >> - .num_resources = ARRAY_SIZE(au1xxx_mmc_resources),
    >> - .resource = au1xxx_mmc_resources,
    >> -};
    >> #endif /* #ifdef CONFIG_SOC_AU1200 */

    >
    > What board-specific was here?


    Nothing in here per se, but a) I don't like this file, it registers
    stuff some boards don't need/want, b) this part is only interesting
    for pb1200 board anyway. I moved it to the pb1200 platform.c because
    of the function pointers for au1xmmc platdata.


    >> static struct platform_device au1x00_pcmcia_device = {
    >> diff --git a/arch/mips/au1000/pb1200/platform.c
    >> b/arch/mips/au1000/pb1200/platform.c
    >> index 5930110..bee2bf7 100644
    >> --- a/arch/mips/au1000/pb1200/platform.c
    >> +++ b/arch/mips/au1000/pb1200/platform.c
    >> @@ -20,8 +20,17 @@
    >> #include
    >> #include
    >> +#include
    >> #include
    >> +#include
    >> +#include
    >> +
    >> +#if defined(CONFIG_MIPS_PB1200)
    >> +#include
    >> +#elif defined(CONFIG_MIPS_DB1200)
    >> +#include
    >> +#endif

    >
    > #include does all that already -- you don't need
    > to
    > include the board specific headers one more time. Drop this part please.


    Done. I originally put it in because of compile errors wrt. BCSR register.


    >> +static int pb1200mmc_card_readonly(void *mmc_host)
    >> +{
    >> + struct au1xmmc_host *host = mmc_priv((struct mmc_host *)mmc_host);

    >
    > Insert new line after a declaration please.
    >
    >> + return (bcsr->status & au1xmmc_card_table[host->id].wpstatus) ? 1 : 0;
    >> +}
    >> +
    >> +static int pb1200mmc_card_inserted(void *mmc_host)
    >> +{
    >> + struct au1xmmc_host *host = mmc_priv((struct mmc_host *)mmc_host);

    >
    > The same here.


    Done and done,


    >> + return (bcsr->sig_status & au1xmmc_card_table[host->id].bcsrstatus)
    >> + ? 1 : 0;
    >> +}
    >> +
    >> +static struct au1xmmc_platdata db1xmmcpd = {
    >> + .set_power = pb1200mmc_set_power,
    >> + .card_inserted = pb1200mmc_card_inserted,
    >> + .card_readonly = pb1200mmc_card_readonly,
    >> + .cd_setup = NULL, /* use poll-timer in driver */

    >
    > Function ptrs in the platform data? That's something new -- though why
    > not? :-)


    Is this an accepted way of doing things in the kernel? If not, I'm open to
    suggestions! (I prefer this to globally-visible methods called by the
    driver. I like it when related things are neatly grouped together).


    >> +};
    >> +
    >> +static u64 au1xxx_mmc_dmamask = ~(u32)0;
    >> +
    >> +struct resource au1200sd0_res[] = {
    >> + [0] = {
    >> + .start = CPHYSADDR(SD0_BASE),

    >
    > Why not just use SD0_PHYS_ADDR?
    >
    >> + .end = CPHYSADDR(SD0_BASE) + 0x40,

    >
    > You've missed "- 1" here. Though it's alos not clear why 0x40 and not
    > 0x3c (there's not register at 0x3c) or 0x80000 -- the range used according
    > to the memory map...


    I'll add the whole 0x80000 range ;-)


    >> + [3] = {
    >> + .start = DSCR_CMD0_SDMS_TX0,
    >> + .flags = IORESOURCE_DMA,
    >> + },
    >> + [4] = {
    >> + .start = DSCR_CMD0_SDMS_RX0,
    >> + .flags = IORESOURCE_DMA,
    >> + },
    >> +};

    >
    > Humm. The other devices (like IDE) should also claim DMA resources...


    It was a convenient way to pass DDMA IDs without having to use
    a lookup table in the driver ;-)


    >> +
    >> +static struct platform_device au1200_sd0_device = {
    >> + .name = "au1xxx-mmc",
    >> + .id = 0, /* index into au1xmmc_card_table[] */
    >> + .dev = {
    >> + .dma_mask = &au1xxx_mmc_dmamask,
    >> + .coherent_dma_mask = 0xffffffff,
    >> + .platform_data = &db1xmmcpd,

    >
    > Can't we leave the MMC platform device where it is but define the
    > platform data structure per board with some starndard name? Since IMO it
    > doesn't make sense to move the platform device itself.


    I like my device setup data in one file (preferably living in the board
    subdir), but for mainline inclusion I can move it back to its original
    place if you and others prefer so.


    >> + },
    >> + .num_resources = ARRAY_SIZE(au1200sd0_res),
    >> + .resource = au1200sd0_res,
    >> +};
    >> +
    >> +#ifndef CONFIG_MIPS_DB1200

    >
    > Wait, SD controller 1 is there regardless of the board, so should be
    > registerred regardless. If however the board doesn't have the necessary
    > resources to support the driver functionality, I think it can be indicated
    > by the board-level platform data, so that the driver could decide whether
    > it wants to support that controller or not.


    Won't this cause problems if e.g. you are using PCMCIA (since SD1 pins are
    muxed with pcmcia signals)?
    In any case, I just followed the original code, which also disabled the 2nd
    controller for the db1200.


    >> +struct resource au1200sd1_res[] = {
    >> + [0] = {
    >> + .start = CPHYSADDR(SD1_BASE),
    >> + .end = CPHYSADDR(SD1_BASE) + 0xff,

    >
    > Why not 0x40 if the controllers are symmetric I wonder? I'd say it
    > should be 0x80000 even (and don't forget to sutract one ;-)...


    I corrected this (and wrong resource numbering) locally.


    Thanks for looking at it!
    Manuel Lauss
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  10. Re: [PATCH 4/7] Alchemy: db1200/pb1200: register mmc platform device and board specific functions

    Manuel Lauss wrote:

    >>>diff --git a/arch/mips/au1000/common/platform.c
    >>>b/arch/mips/au1000/common/platform.c
    >>>index 31d2a22..08a5900 100644
    >>>--- a/arch/mips/au1000/common/platform.c
    >>>+++ b/arch/mips/au1000/common/platform.c
    >>>-
    >>>-static struct platform_device au1xxx_mmc_device = {
    >>>- .name = "au1xxx-mmc",
    >>>- .id = 0,
    >>>- .dev = {
    >>>- .dma_mask = &au1xxx_mmc_dmamask,
    >>>- .coherent_dma_mask = 0xffffffff,
    >>>- },
    >>>- .num_resources = ARRAY_SIZE(au1xxx_mmc_resources),
    >>>- .resource = au1xxx_mmc_resources,
    >>>-};
    >>> #endif /* #ifdef CONFIG_SOC_AU1200 */

    >>
    >> What board-specific was here?


    > Nothing in here per se, but a) I don't like this file, it registers
    > stuff some boards don't need/want, b) this part is only interesting
    > for pb1200 board anyway.


    Sigh. Do you know that Au1100 also has the same MMC controllers? The
    platform device is not registered in this case though and the driver (however
    small it now actually uses the platform device per se) is therefore unable to
    control it (well, I'm not sure it can do that since it seems to be Au1200
    centered now (using DBDMA), however it was initially written for Au1100 as it
    seems.

    > I moved it to the pb1200 platform.c because
    > of the function pointers for au1xmmc platdata.


    I'm sure that can be handled without moving the device itself...

    >>>diff --git a/arch/mips/au1000/pb1200/platform.c
    >>>b/arch/mips/au1000/pb1200/platform.c
    >>>index 5930110..bee2bf7 100644
    >>>--- a/arch/mips/au1000/pb1200/platform.c
    >>>+++ b/arch/mips/au1000/pb1200/platform.c
    >>>@@ -20,8 +20,17 @@
    >>> #include
    >>> #include
    >>>+#include
    >>> #include
    >>>+#include
    >>>+#include
    >>>+
    >>>+#if defined(CONFIG_MIPS_PB1200)
    >>>+#include
    >>>+#elif defined(CONFIG_MIPS_DB1200)
    >>>+#include
    >>>+#endif


    >>#include does all that already -- you don't need
    >>to include the board specific headers one more time. Drop this part please.


    > Done. I originally put it in because of compile errors wrt. BCSR register.


    Hm, why would there be any if au1xxx.h resolves the right board #include?

    >>>+ return (bcsr->sig_status & au1xmmc_card_table[host->id].bcsrstatus)
    >>>+ ? 1 : 0;
    >>>+}
    >>>+
    >>>+static struct au1xmmc_platdata db1xmmcpd = {
    >>>+ .set_power = pb1200mmc_set_power,
    >>>+ .card_inserted = pb1200mmc_card_inserted,
    >>>+ .card_readonly = pb1200mmc_card_readonly,
    >>>+ .cd_setup = NULL, /* use poll-timer in driver */


    >> Function ptrs in the platform data? That's something new -- though why
    >> not? :-)


    > Is this an accepted way of doing things in the kernel? If not, I'm open to
    > suggestions!


    I really don't know -- never seen such trick before.

    > (I prefer this to globally-visible methods called by the
    > driver. I like it when related things are neatly grouped together).


    Yes, this indeed looks better.

    >>>+};
    >>>+
    >>>+static u64 au1xxx_mmc_dmamask = ~(u32)0;
    >>>+
    >>>+struct resource au1200sd0_res[] = {
    >>>+ [0] = {
    >>>+ .start = CPHYSADDR(SD0_BASE),


    >> Why not just use SD0_PHYS_ADDR?


    >>>+ .end = CPHYSADDR(SD0_BASE) + 0x40,


    >> You've missed "- 1" here. Though it's alos not clear why 0x40 and not
    >>0x3c (there's not register at 0x3c) or 0x80000 -- the range used according
    >>to the memory map...


    > I'll add the whole 0x80000 range ;-)


    I've just posted a patch to fix this in the current code. Well, not that
    it matters much but I'm kind of pedantic. :-)

    >>>+ [3] = {
    >>>+ .start = DSCR_CMD0_SDMS_TX0,
    >>>+ .flags = IORESOURCE_DMA,
    >>>+ },
    >>>+ [4] = {
    >>>+ .start = DSCR_CMD0_SDMS_RX0,
    >>>+ .flags = IORESOURCE_DMA,
    >>>+ },
    >>>+};


    >> Humm. The other devices (like IDE) should also claim DMA resources...


    > It was a convenient way to pass DDMA IDs without having to use
    > a lookup table in the driver ;-)


    Humm, the DBDMA code seems to mean by "DMA channel" something different,
    see au1xxx_dbdma_chan_alloc()...

    >>>+static struct platform_device au1200_sd0_device = {
    >>>+ .name = "au1xxx-mmc",
    >>>+ .id = 0, /* index into au1xmmc_card_table[] */
    >>>+ .dev = {
    >>>+ .dma_mask = &au1xxx_mmc_dmamask,
    >>>+ .coherent_dma_mask = 0xffffffff,
    >>>+ .platform_data = &db1xmmcpd,


    >> Can't we leave the MMC platform device where it is but define the
    >>platform data structure per board with some starndard name? Since IMO it
    >>doesn't make sense to move the platform device itself.


    > I like my device setup data in one file (preferably living in the board
    > subdir), but for mainline inclusion I can move it back to its original
    > place if you and others prefer so.


    I'd definitely prefer to leave the SOC device where they were...

    >>>+ },
    >>>+ .num_resources = ARRAY_SIZE(au1200sd0_res),
    >>>+ .resource = au1200sd0_res,
    >>>+};
    >>>+
    >>>+#ifndef CONFIG_MIPS_DB1200


    >> Wait, SD controller 1 is there regardless of the board, so should be
    >>registerred regardless. If however the board doesn't have the necessary
    >>resources to support the driver functionality, I think it can be indicated
    >>by the board-level platform data, so that the driver could decide whether
    >>it wants to support that controller or not.


    > Won't this cause problems if e.g. you are using PCMCIA (since SD1 pins are
    > muxed with pcmcia signals)?


    Good point. I think that the code in arch/mips/au1000/common/platform.c
    should check the sys_pinfunc register, and not blindly register all devices.

    > In any case, I just followed the original code, which also disabled the 2nd
    > controller for the db1200.


    Indeed...

    WBR, Sergei
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  11. Re: [PATCH 4/7] Alchemy: db1200/pb1200: register mmc platform device and board specific functions

    On Thu, May 08, 2008 at 11:30:24PM +0400, Sergei Shtylyov wrote:
    > Manuel Lauss wrote:
    >
    >>>> diff --git a/arch/mips/au1000/common/platform.c
    >>>> b/arch/mips/au1000/common/platform.c
    >>>> index 31d2a22..08a5900 100644
    >>>> --- a/arch/mips/au1000/common/platform.c
    >>>> +++ b/arch/mips/au1000/common/platform.c
    >>>> -
    >>>> -static struct platform_device au1xxx_mmc_device = {
    >>>> - .name = "au1xxx-mmc",
    >>>> - .id = 0,
    >>>> - .dev = {
    >>>> - .dma_mask = &au1xxx_mmc_dmamask,
    >>>> - .coherent_dma_mask = 0xffffffff,
    >>>> - },
    >>>> - .num_resources = ARRAY_SIZE(au1xxx_mmc_resources),
    >>>> - .resource = au1xxx_mmc_resources,
    >>>> -};
    >>>> #endif /* #ifdef CONFIG_SOC_AU1200 */
    >>>
    >>> What board-specific was here?

    >
    >> Nothing in here per se, but a) I don't like this file, it registers
    >> stuff some boards don't need/want, b) this part is only interesting
    >> for pb1200 board anyway.

    >
    > Sigh. Do you know that Au1100 also has the same MMC controllers? The
    > platform device is not registered in this case though and the driver
    > (however small it now actually uses the platform device per se) is
    > therefore unable to control it (well, I'm not sure it can do that since it
    > seems to be Au1200 centered now (using DBDMA), however it was initially
    > written for Au1100 as it seems.


    I gathered that from the driver source...

    I assume the PIO paths in the driver are intended for the Au1100, correct?
    Should not be too hard to force PIO paths when no DDMA IDs are passed
    through the platform device's resources.
    Someone should test it on Au1100 though.


    >> I moved it to the pb1200 platform.c because
    >> of the function pointers for au1xmmc platdata.

    >
    > I'm sure that can be handled without moving the device itself...


    Okay...


    >>>> + return (bcsr->sig_status & au1xmmc_card_table[host->id].bcsrstatus)
    >>>> + ? 1 : 0;
    >>>> +}
    >>>> +
    >>>> +static struct au1xmmc_platdata db1xmmcpd = {
    >>>> + .set_power = pb1200mmc_set_power,
    >>>> + .card_inserted = pb1200mmc_card_inserted,
    >>>> + .card_readonly = pb1200mmc_card_readonly,
    >>>> + .cd_setup = NULL, /* use poll-timer in driver */

    >
    >>> Function ptrs in the platform data? That's something new -- though why
    >>> not? :-)

    >
    >> Is this an accepted way of doing things in the kernel? If not, I'm open
    >> to
    >> suggestions!

    >
    > I really don't know -- never seen such trick before.
    >
    >> (I prefer this to globally-visible methods called by the
    >> driver. I like it when related things are neatly grouped together).

    >
    > Yes, this indeed looks better.
    >


    Unless someone else speaks up against it, I'll leave it the way it is.


    >>>> +static struct platform_device au1200_sd0_device = {
    >>>> + .name = "au1xxx-mmc",
    >>>> + .id = 0, /* index into au1xmmc_card_table[] */
    >>>> + .dev = {
    >>>> + .dma_mask = &au1xxx_mmc_dmamask,
    >>>> + .coherent_dma_mask = 0xffffffff,
    >>>> + .platform_data = &db1xmmcpd,

    >
    >>> Can't we leave the MMC platform device where it is but define the
    >>> platform data structure per board with some starndard name? Since IMO it
    >>> doesn't make sense to move the platform device itself.

    >
    >> I like my device setup data in one file (preferably living in the board
    >> subdir), but for mainline inclusion I can move it back to its original
    >> place if you and others prefer so.

    >
    > I'd definitely prefer to leave the SOC device where they were...


    Okay.


    >>>> + },
    >>>> + .num_resources = ARRAY_SIZE(au1200sd0_res),
    >>>> + .resource = au1200sd0_res,
    >>>> +};
    >>>> +
    >>>> +#ifndef CONFIG_MIPS_DB1200

    >
    >>> Wait, SD controller 1 is there regardless of the board, so should be
    >>> registerred regardless. If however the board doesn't have the necessary
    >>> resources to support the driver functionality, I think it can be
    >>> indicated by the board-level platform data, so that the driver could
    >>> decide whether it wants to support that controller or not.

    >
    >> Won't this cause problems if e.g. you are using PCMCIA (since SD1 pins are
    >> muxed with pcmcia signals)?

    >
    > Good point. I think that the code in arch/mips/au1000/common/platform.c
    > should check the sys_pinfunc register, and not blindly register all
    > devices.


    Hm, sounds ugly, but I'll add something.

    Thanks!
    Manuel Lauss
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  12. Re: [PATCH 4/7] Alchemy: db1200/pb1200: register mmc platformdevice and board specific functions

    ----- Original Message -----
    From: "Manuel Lauss"
    To: "Sergei Shtylyov"
    Cc: ;
    Sent: Friday, May 09, 2008 9:40 AM
    Subject: Re: [PATCH 4/7] Alchemy: db1200/pb1200: register mmc platformdevice
    and board specific functions


    > On Thu, May 08, 2008 at 11:30:24PM +0400, Sergei Shtylyov wrote:
    >> Manuel Lauss wrote:


    >>>>> diff --git a/arch/mips/au1000/common/platform.c
    >>>>> b/arch/mips/au1000/common/platform.c
    >>>>> index 31d2a22..08a5900 100644
    >>>>> --- a/arch/mips/au1000/common/platform.c
    >>>>> +++ b/arch/mips/au1000/common/platform.c
    >>>>> -
    >>>>> -static struct platform_device au1xxx_mmc_device = {
    >>>>> - .name = "au1xxx-mmc",
    >>>>> - .id = 0,
    >>>>> - .dev = {
    >>>>> - .dma_mask = &au1xxx_mmc_dmamask,
    >>>>> - .coherent_dma_mask = 0xffffffff,
    >>>>> - },
    >>>>> - .num_resources = ARRAY_SIZE(au1xxx_mmc_resources),
    >>>>> - .resource = au1xxx_mmc_resources,
    >>>>> -};
    >>>>> #endif /* #ifdef CONFIG_SOC_AU1200 */
    >>>>
    >>>> What board-specific was here?


    >>> Nothing in here per se, but a) I don't like this file, it registers
    >>> stuff some boards don't need/want, b) this part is only interesting
    >>> for pb1200 board anyway.


    >> Sigh. Do you know that Au1100 also has the same MMC controllers? The
    >> platform device is not registered in this case though and the driver
    >> (however small it now actually uses the platform device per se) is
    >> therefore unable to control it (well, I'm not sure it can do that since
    >> it
    >> seems to be Au1200 centered now (using DBDMA), however it was initially
    >> written for Au1100 as it seems.


    > I gathered that from the driver source...


    > I assume the PIO paths in the driver are intended for the Au1100, correct?
    > Should not be too hard to force PIO paths when no DDMA IDs are passed
    > through the platform device's resources.



    Yes but it should've probably also supported DMA via Au1100 DMA
    controller (not DBDMA).

    >>>>> + return (bcsr->sig_status & au1xmmc_card_table[host->id].bcsrstatus)
    >>>>> + ? 1 : 0;
    >>>>> +}
    >>>>> +
    >>>>> +static struct au1xmmc_platdata db1xmmcpd = {
    >>>>> + .set_power = pb1200mmc_set_power,
    >>>>> + .card_inserted = pb1200mmc_card_inserted,
    >>>>> + .card_readonly = pb1200mmc_card_readonly,
    >>>>> + .cd_setup = NULL, /* use poll-timer in driver */


    >>>> Function ptrs in the platform data? That's something new -- though
    >>>> why
    >>>> not? :-)


    >>> Is this an accepted way of doing things in the kernel? If not, I'm open
    >>> to suggestions!


    >> I really don't know -- never seen such trick before.


    >>> (I prefer this to globally-visible methods called by the
    >>> driver. I like it when related things are neatly grouped together).


    >> Yes, this indeed looks better.


    > Unless someone else speaks up against it, I'll leave it the way it is.


    I assume just parametrizing the board-level functions using the data
    about BCSR (like it was done in the driver before) just won't work?

    >>>>> + },
    >>>>> + .num_resources = ARRAY_SIZE(au1200sd0_res),
    >>>>> + .resource = au1200sd0_res,
    >>>>> +};
    >>>>> +
    >>>>> +#ifndef CONFIG_MIPS_DB1200


    >>>> Wait, SD controller 1 is there regardless of the board, so should be
    >>>> registerred regardless. If however the board doesn't have the necessary
    >>>> resources to support the driver functionality, I think it can be
    >>>> indicated by the board-level platform data, so that the driver could
    >>>> decide whether it wants to support that controller or not.


    >>> Won't this cause problems if e.g. you are using PCMCIA (since SD1 pins
    >>> are
    >>> muxed with pcmcia signals)?


    >> Good point. I think that the code in
    >> arch/mips/au1000/common/platform.c
    >> should check the sys_pinfunc register, and not blindly register all
    >> devices.


    > Hm, sounds ugly, but I'll add something.


    Why? I think it's smarter than register SoC devices in every instance of
    board setup code. This way, the board setup code has already programmed
    sys_pinfunc as it sees fit, and the common code accomodates to this need
    registering those devices that the coard code have selected.

    > Thanks!
    > Manuel Lauss


    WBR, Sergei


    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread