From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2] ATA: Squash warnings in mxc_ata.
Date: Fri, 23 Sep 2011 11:42:19 +0200 [thread overview]
Message-ID: <1316770939-32458-1-git-send-email-marek.vasut@gmail.com> (raw)
In-Reply-To: <1316769132-20368-1-git-send-email-marek.vasut@gmail.com>
mxc_ata.c: In function ?set_ata_bus_timing?:
mxc_ata.c:118: warning: dereferencing type-punned pointer will break
strict-aliasing rules
mxc_ata.c:125: warning: dereferencing type-punned pointer will break
strict-aliasing rules
mxc_ata.c:129: warning: dereferencing type-punned pointer will break
strict-aliasing rules
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
---
drivers/block/mxc_ata.c | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
V2: Use writeb() access
diff --git a/drivers/block/mxc_ata.c b/drivers/block/mxc_ata.c
index f22f4f4..b05e3c9 100644
--- a/drivers/block/mxc_ata.c
+++ b/drivers/block/mxc_ata.c
@@ -96,7 +96,6 @@ static uint16_t pio_tA[NR_PIO_SPECS] = { 50, 50, 50, 50, 50 };
#define REG2OFF(reg) ((((uint32_t)reg) & 0x3) * 8)
static void set_ata_bus_timing(unsigned char mode)
{
- uint32_t val;
uint32_t T = 1000000000 / mxc_get_clock(MXC_IPG_CLK);
struct mxc_ata_config_regs *ata_regs;
@@ -106,22 +105,19 @@ static void set_ata_bus_timing(unsigned char mode)
return;
/* Write TIME_OFF/ON/1/2W */
- val = (3 << REG2OFF(&ata_regs->time_off)) |
- (3 << REG2OFF(&ata_regs->time_on)) |
- (((pio_t1[mode] + T) / T) << REG2OFF(&ata_regs->time_1)) |
- (((pio_t2_8[mode] + T) / T) << REG2OFF(&ata_regs->time_2w));
- writel(val, &ata_regs->time_off);
+ writeb(3, &ata_regs->time_off);
+ writeb(3, &ata_regs->time_off);
+ writeb((pio_t1[mode] + T) / T, &ata_regs->time_1);
+ writeb((pio_t2_8[mode] + T) / T, &ata_regs->time_2w);
/* Write TIME_2R/AX/RDX/4 */
- val = (((pio_t2_8[mode] + T) / T) << REG2OFF(&ata_regs->time_2r)) |
- (((pio_tA[mode] + T) / T + 2) << REG2OFF(&ata_regs->time_ax)) |
- (1 << REG2OFF(&ata_regs->time_pio_rdx)) |
- (((pio_t4[mode] + T) / T) << REG2OFF(&ata_regs->time_4));
- writel(val, &ata_regs->time_2r);
+ writeb((pio_t2_8[mode] + T) / T, &ata_regs->time_2r);
+ writeb((pio_tA[mode] + T) / T + 2, &ata_regs->time_ax);
+ writeb(1, &ata_regs->time_pio_rdx);
+ writeb((pio_t4[mode] + T) / T, &ata_regs->time_4);
/* Write TIME_9 ; the rest of timing registers is irrelevant for PIO */
- val = (((pio_t9[mode] + T) / T) << REG2OFF(&ata_regs->time_9));
- writel(val, &ata_regs->time_9);
+ writeb((pio_t9[mode] + T) / T, &ata_regs->time_9);
}
int ide_preinit(void)
--
1.7.5.4
next prev parent reply other threads:[~2011-09-23 9:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-23 9:12 [U-Boot] [PATCH] ATA: Squash warnings in mxc_ata Marek Vasut
2011-09-23 9:27 ` Stefano Babic
2011-09-23 9:42 ` Marek Vasut [this message]
2011-09-23 10:02 ` [U-Boot] [PATCH V2] " Stefano Babic
2011-09-23 10:04 ` [U-Boot] [PATCH V3] " Marek Vasut
2011-09-25 17:21 ` Stefano Babic
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=1316770939-32458-1-git-send-email-marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--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