From: Hubert Feurstein <h.feurstein@gmail.com>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] mci: add Atmel AT91 MCI driver
Date: Mon, 6 Jun 2011 09:43:49 +0200 [thread overview]
Message-ID: <BANLkTikRx9gNs7jLkL1+A7WUoLewTp9JhQ@mail.gmail.com> (raw)
In-Reply-To: <20110602160400.GG32751@game.jcrosoft.org>
2011/6/2 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
> On 13:48 Wed 01 Jun , Hubert Feurstein wrote:
[snip]
> I've test it on at91sam9263ek and work fine
Great, good to hear ;) I'll add also support for at91sam9m10g45ek
later in an extra commit.
>
> please fix the following comments
> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>
[snip]
>> +/* Multimedia Card Interface */
>> +struct atmel_mci_platform_data {
>> + unsigned bus_width;
>> + unsigned host_caps; /* MCI_MODE_* from mci.h */
>> + unsigned detect_pin;
>> + unsigned wp_pin;
>> +};
>we can have 2 slot but you allow only one
Would it be ok to add the second slot in an extra commit?
[snip]
>> +/*
>> + * Structure for struct SoC access.
>> + * Names starting with '_' are fillers.
>> + */
>> +struct atmel_mci_regs {
>> + /* reg Offset */
>> + u32 cr; /* 0x00 */
>> + u32 mr; /* 0x04 */
>> + u32 dtor; /* 0x08 */
>> + u32 sdcr; /* 0x0c */
>> + u32 argr; /* 0x10 */
>> + u32 cmdr; /* 0x14 */
>> + u32 blkr; /* 0x18 */
>> + u32 _1c; /* 0x1c */
>> + u32 rspr; /* 0x20 */
>> + u32 rspr1; /* 0x24 */
>> + u32 rspr2; /* 0x28 */
>> + u32 rspr3; /* 0x2c */
>> + u32 rdr; /* 0x30 */
>> + u32 tdr; /* 0x34 */
>> + u32 _38; /* 0x38 */
>> + u32 _3c; /* 0x3c */
>> + u32 sr; /* 0x40 */
>> + u32 ier; /* 0x44 */
>> + u32 idr; /* 0x48 */
>> + u32 imr; /* 0x4c */
>> +};
> please use the same as the kernel here
> offset not a struct
Of course I could change it to offset, but I thought this is the way
how it is done in barebox.
What is Sascha's opinion on that?
>> +
>> +struct atmel_mci_host {
>> + struct mci_host mci;
>> + struct atmel_mci_regs volatile __iomem *base;
>> + struct device_d *hw_dev;
>> + struct clk *clk;
>> +
>> + u32 datasize;
>> + struct mci_cmd *cmd;
>> + struct mci_data *data;
>> +};
>> +
>
>> +static int atmel_pull(struct atmel_mci_host *host, void *_buf, int bytes)
>> +{
>> + unsigned int stat;
>> + u32 *buf = _buf;
>> +
>> + while (bytes > 3) {
>> + stat = atmel_poll_status(host, AT91_MCI_RXRDY);
>> + if (stat)
>> + return stat;
>> +
>> + *buf++ = readl(&host->base->rdr);
>> + bytes -= 4;
>> + }
>> +
>> + if (bytes) {
>> + u8 *b = (u8 *)buf;
>> + u32 tmp;
>> +
>> + stat = atmel_poll_status(host, AT91_MCI_RXRDY);
>> + if (stat)
>> + return stat;
>> +
>> + tmp = readl(&host->base->rdr);
>> + memcpy(b, &tmp, bytes);
> please use __iowrite32 to speedup the copy
I think memcpy is alright here. Usually this code-path shouldn't be
executed anyway, because the mci-core always
requests multiples of 512 bytes, and here we copy only the last
remaining _three_ bytes.
>> + }
>> +
>> + return 0;
>> +}
>> +
[snip]
>> +
>> + if (bus_width == 8)
>> + writel(AT91_MCI_SDCBUS_8BIT, &host->base->sdcr);
>> + if (bus_width == 4)
>> + writel(AT91_MCI_SDCBUS_4BIT, &host->base->sdcr);
>> + else
>> + writel(AT91_MCI_SDCBUS_1BIT, &host->base->sdcr);
> switch here
OK
[snip]
>> +
>> +static int mci_probe(struct device_d *hw_dev)
>> +{
>> + unsigned long clk_rate;
>> + struct atmel_mci_host *host;
>> + struct atmel_mci_platform_data *pd = hw_dev->platform_data;
>> +
>> + if (pd == NULL) {
> if (!pd)
OK
>> + dev_err(hw_dev, "missing platform data\n");
>> + return -EINVAL;
>> + }
>> +
>> + host = xzalloc(sizeof(*host));
>> + host->mci.send_cmd = mci_request;
>> + host->mci.set_ios = mci_set_ios;
>> + host->mci.init = mci_reset;
>> +
>
> Best Regards,
> J.
>
Best Regards and thank you for the support.
Hubert
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-06-06 7:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-31 15:02 [PATCH] " Hubert Feurstein
2011-06-01 5:45 ` Jean-Christophe PLAGNIOL-VILLARD
2011-06-01 11:48 ` [PATCH v2] " Hubert Feurstein
2011-06-02 16:04 ` Jean-Christophe PLAGNIOL-VILLARD
2011-06-06 7:43 ` Hubert Feurstein [this message]
2011-06-06 9:04 ` Sascha Hauer
2011-06-06 11:07 ` Jean-Christophe PLAGNIOL-VILLARD
2011-06-06 17:40 ` [PATCH v3] " Hubert Feurstein
2011-06-02 16:05 ` [PATCH] at91sam9263ek: add mci1 support Jean-Christophe PLAGNIOL-VILLARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTikRx9gNs7jLkL1+A7WUoLewTp9JhQ@mail.gmail.com \
--to=h.feurstein@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=plagnioj@jcrosoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox