From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/7] S3C24XX: Add NAND Flash driver
Date: Thu, 13 Sep 2012 02:44:17 +0200 [thread overview]
Message-ID: <201209130244.17882.marex@denx.de> (raw)
In-Reply-To: <50512B75.9020401@inov.pt>
Dear Jos? Miguel Gon?alves,
> On 09/13/2012 01:24 AM, Marek Vasut wrote:
> > Dear Jos? Miguel Gon?alves,
> >
> >> Hi Scott,
> >>
> >> On 09/13/2012 12:20 AM, Scott Wood wrote:
> >>> On 09/12/2012 06:16 PM, Jos? Miguel Gon?alves wrote:
> >>>> Hi Marek,
> >>>>
> >>>> On 09/12/2012 10:11 PM, Marek Vasut wrote:
> >>>>> Dear Jos? Miguel Gon?alves,
> >>>>>
> >>>>>> +
> >>>>>> +/*
> >>>>>> + * Hardware specific access to control-lines function
> >>>>>> + */
> >>>>>> +static void s3c_nand_hwcontrol(struct mtd_info *mtd, int cmd,
> >>>>>> unsigned int
> >>>>>> ctrl) +{
> >>>>>> + s3c24xx_nand *const nand = s3c24xx_get_base_nand();
> >>>>>> + struct nand_chip *this = mtd->priv;
> >>>>>> +
> >>>>>> + if (ctrl & NAND_CTRL_CHANGE) {
> >>>>>> + if (ctrl & NAND_CLE)
> >>>>>> + this->IO_ADDR_W = (void __iomem *)&nand->nfcmmd;
> >>>>>> + else if (ctrl & NAND_ALE)
> >>>>>> + this->IO_ADDR_W = (void __iomem *)&nand->nfaddr;
> >>>>>> + else
> >>>>>> + this->IO_ADDR_W = (void __iomem *)&nand->nfdata;
> >>>>>
> >>>>> Do you need this cast ?
> >>>>
> >>>> Without it gcc gives me a warning:
> >>>>
> >>>> s3c24xx_nand.c:90:20: warning: assignment discards `volatile'
> >>>> qualifier from pointer target type [enabled by default]
> >>>
> >>> Why do you have volatile in your s3c24xx_nand struct?
> >>
> >> I use that as a rule to memory mapping of hardware registers.
> >> Without it GCC optimization sometimes do bad things, like completely
> >> removing sequences of code.
> >
> > Not true unless your gcc is broken. Use proper accessors
> > (readl()/writel()), they have proper barriers already.
> >
> >> For instance, if you need to pause in a loop until some bit of a
> >> register is changed (as it's done in the serial driver) and the struct
> >> were this register is mapped don't have the volatile attribute, the GCC
> >> optimizer removes the loop.
> >
> > Yes, see above.
>
> When I was debugging U-Boot on the MIN2416 I saw this over-optimization
> situation in the serial driver
I just noticed that all those uart->something in your serial driver are actually
register accesses. So that's flat wrong, use writel()/readl() etc accessors. Of
course doing it like you do without memory barriers will make it go south.
> so I added the volatile attribute to all
> structs that map the SoC registers. But, after you pointed to me that
> the I/O macros have already incorporated the proper barriers, I looked
> again to the serial driver source and noticed that I forgot to use that
> macros on register accesses! I will change this and test it tomorrow
> before resubmitting the patch.
WFM, thanks.
> Best regards,
> Jos? Gon?alves
Ccing Gabriel, can you look at those patches ?
Best regards,
Marek Vasut
next prev parent reply other threads:[~2012-09-13 0:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 11:15 [U-Boot] [PATCH 0/7] Add support to MINI2416 board José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 1/7] ARM: fix relocation on ARM926EJS José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 2/7] S3C24XX: Add core support for Samsung's S3C24XX SoCs José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 3/7] S3C24XX: Add serial driver José Miguel Gonçalves
2012-09-12 21:01 ` Marek Vasut
2012-09-13 0:54 ` José Miguel Gonçalves
2012-09-13 9:17 ` Marek Vasut
2012-09-13 9:30 ` José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 4/7] S3C24XX: Add RTC driver José Miguel Gonçalves
2012-09-12 21:03 ` Marek Vasut
2012-09-12 23:28 ` José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 5/7] S3C24XX: Add NAND Flash driver José Miguel Gonçalves
2012-09-12 21:11 ` Marek Vasut
2012-09-12 23:16 ` José Miguel Gonçalves
2012-09-12 23:20 ` Scott Wood
2012-09-13 0:18 ` José Miguel Gonçalves
2012-09-13 0:24 ` Marek Vasut
2012-09-13 0:40 ` José Miguel Gonçalves
2012-09-13 0:44 ` Marek Vasut [this message]
2012-09-12 23:45 ` Marek Vasut
2012-09-12 23:55 ` José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 6/7] Add u-boot-ubl.bin target to the Makefile José Miguel Gonçalves
2012-09-12 11:15 ` [U-Boot] [PATCH 7/7] S3C24XX: Add support to MINI2416 board José Miguel Gonçalves
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=201209130244.17882.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/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