Messages in this thread | | | Date | Tue, 12 Jan 2010 15:36:57 -0800 | From | Andrew Morton <> | Subject | Re: [PATCH v3 1/2] davinci: MMC: Add a function to control reset state of the controller |
| |
On Fri, 8 Jan 2010 17:08:49 +0530 Chaithrika U S <chaithrika@ti.com> wrote:
> -static void > -davinci_abort_data(struct mmc_davinci_host *host, struct mmc_data *data) > +static inline void mmc_davinci_reset_ctrl(struct mmc_davinci_host *host, > + int val) > { > u32 temp; > > - /* reset command and data state machines */ > temp = readl(host->base + DAVINCI_MMCCTL); > - writel(temp | MMCCTL_CMDRST | MMCCTL_DATRST, > - host->base + DAVINCI_MMCCTL); > + if (val) /* reset */ > + temp |= MMCCTL_CMDRST | MMCCTL_DATRST; > + else /* enable */ > + temp &= ~(MMCCTL_CMDRST | MMCCTL_DATRST); > > - temp &= ~(MMCCTL_CMDRST | MMCCTL_DATRST); > - udelay(10); > writel(temp, host->base + DAVINCI_MMCCTL); > + udelay(10); > +}
nit: it's hard for a reader of the code to work out why a udelay() such as the above was included. Perhaps the data sheet for the hardware would tell him, if he has access to it.
But generally speaking, the code is better code if it explains the reasoning to the reader.
| |