From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: "João Ramos" <joao.ramos@inov.pt>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-ide@vger.kernel.org
Subject: Re: EP93xx PIO IDE driver proposal
Date: Sun, 17 May 2009 18:16:43 +0200 [thread overview]
Message-ID: <200905171816.44069.bzolnier@gmail.com> (raw)
In-Reply-To: <4A0D9FD7.5050608@inov.pt>
On Friday 15 May 2009 19:01:11 João Ramos wrote:
[...]
> > +/*
> > + * readl/writel helpers to access internal registers using
> > + * an ioremapped cookie and the specified IDE register offset
> > + */
> > +
> > +static inline u32 ep93xx_readl(unsigned long base, u8 offset)
> > +{
> > + return readl((void __iomem *)(base + offset));
> > +}
> > +
> > +static inline void ep93xx_writel(u32 value, unsigned long base, u8 offset)
> > +{
> > + writel(value, (void __iomem *)(base + offset));
> > +}
> >
> > Hmm, what do we need these wrappers for exactly?
> >
> > Please remove them.
> >
> I just added those to increase code readability, so that I wouldn't have
> to do a '(void __iomem *)(base + offset)' in every readl/writel call.
> But I can remove it, no problem.
If readability is harmed by such casts you can always add a local variable
to alleviate for it, i.e.:
void __iomem *base = (unsigned long)__base;
However I don't think a lot of such tricks would be needed after fixing function
arguments to pass 'void __iomem *base' around and not 'unsigned long base'
> > +/*
> > + * Check whether IORDY is asserted or not.
> > + */
> > +static inline int ep93xx_ide_check_iordy(unsigned long base)
like here
> > +{
> > + u32 reg = ep93xx_readl(base, IDECTRL);
> > +
> > + return (reg & IDECTRL_IORDY) ? 1 : 0;
> > +}
[...]
> > + /*
> > + * fill in ide_io_ports structure.
> > + * we use magic numbers 0x10 for io_addr and 0x0E for ctl_addr,
> > + * hence the lowest 3 bits will give us the real address (ranging from
> > + * 0 to 7) and the subsequent 2 bits will give us the CS1n and CS0n
> > + * values:
> > + * CS1n CS0n A2 A1 A0
> > + * 1 0 x x x -> IO_ADDR (base 0x10)
> > + * 0 1 x x x -> CTL_ADDR (base 0x0E)
> > + */
> > + ide_std_init_ports(&hw, 0x10, 0x0E);
> >
> > Why not just setup the real addresses here instead of using
> > ide_std_init_ports()?
> >
>
> The IDE register's address are specified through bitfields in the EP93xx
> IDECTRL register, as described in the above comment.
> The 'workaround' in the addresses is just to ease manipulation of those
> bitfields while writing the register.
Ok, so there is really no reason to use ide_std_init_ports().
> I suppose I could write the register's address in the hw->io_ports so
> that the value would be directly ORed to the IDECTRL register, if that
> is what you suggest.
Please try it.
> > It seems that it would make driver simpler and get rid of >config_data use.
> >
>
> No. The config_data is used to store the ioremapped cookie of the IDE
> registers base address. I need that address to access the CPUs IDE
> registers.
Please note that ep93xx_ide_{read,write}() are always passed
hwif->config_data as 'unsigned long base' argument so the first
argument should become 'ide_hwif_t *hwif' with:
unsigned long base = hwif->config_data
inside ep93xx_ide_{read,write}().
Also how's about using host->priv_data instead of hwif->config_data?
[ By using ide_host_alloc()+ide_host_register() instead of ide_host_add()
and later obtaining host->priv_data through hwif->host->priv_data. ]
> There's no connection between this address (which maps to CPU's internal
> memory, allowing to acess the IDE registers) and the actual IDE
> addresses, which are defined through bitfields in the IDE control register.
> Yeah, I know, weird IDE host controller... :-)
Indeed. :)
next prev parent reply other threads:[~2009-05-17 16:13 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <49CCD7C4.8000207@inov.pt>
[not found] ` <49CFDD8F.1030306@bluewatersys.com>
[not found] ` <BD79186B4FD85F4B8E60E381CAEE1909014E2E09@mi8nycmail19.Mi8.com>
[not found] ` <49D0CAE4.9090306@inov.pt>
2009-03-30 15:34 ` EP93xx PIO IDE driver proposal Sergei Shtylyov
2009-05-04 11:24 ` João Ramos
2009-05-05 12:04 ` Sergei Shtylyov
2009-05-06 14:17 ` João Ramos
2009-05-06 17:05 ` Sergei Shtylyov
2009-05-07 9:36 ` João Ramos
2009-05-07 11:01 ` João Ramos
2009-05-07 13:53 ` Alan Cox
2009-05-07 15:33 ` João Ramos
2009-05-08 12:04 ` Bartlomiej Zolnierkiewicz
2009-05-08 12:16 ` João Ramos
2009-05-08 12:40 ` Bartlomiej Zolnierkiewicz
2009-05-08 13:30 ` Sergei Shtylyov
2009-05-08 14:09 ` Bartlomiej Zolnierkiewicz
2009-05-08 17:28 ` João Ramos
2009-05-08 18:02 ` Bartlomiej Zolnierkiewicz
2009-05-08 18:16 ` João Ramos
2009-05-08 18:55 ` Bartlomiej Zolnierkiewicz
2009-05-08 20:24 ` joao.ramos
2009-05-08 21:01 ` Sergei Shtylyov
2009-05-08 22:07 ` Bartlomiej Zolnierkiewicz
2009-05-11 11:10 ` João Ramos
2009-05-12 16:49 ` Sergei Shtylyov
2009-05-12 17:23 ` Bartlomiej Zolnierkiewicz
2009-05-13 11:01 ` João Ramos
2009-05-17 15:20 ` Bartlomiej Zolnierkiewicz
2009-05-22 17:52 ` Sergei Shtylyov
2009-05-13 14:18 ` João Ramos
2009-05-14 19:44 ` Bartlomiej Zolnierkiewicz
2009-05-15 17:01 ` João Ramos
2009-05-17 16:16 ` Bartlomiej Zolnierkiewicz [this message]
2009-05-18 13:49 ` João Ramos
2009-05-19 13:06 ` Bartlomiej Zolnierkiewicz
2009-05-19 13:20 ` João Ramos
2009-05-19 13:56 ` Bartlomiej Zolnierkiewicz
2009-05-19 14:05 ` João Ramos
2009-05-19 15:50 ` João Ramos
2009-06-06 15:26 ` Sergei Shtylyov
2009-06-22 10:01 ` Bartlomiej Zolnierkiewicz
2009-05-14 16:30 ` Sergei Shtylyov
2009-05-14 16:36 ` Sergei Shtylyov
2009-05-14 18:58 ` Bartlomiej Zolnierkiewicz
2009-05-11 13:20 ` João Ramos
2009-05-12 16:41 ` Bartlomiej Zolnierkiewicz
2009-05-12 16:57 ` Sergei Shtylyov
2009-05-12 16:01 ` João Ramos
2009-05-12 16:30 ` Bartlomiej Zolnierkiewicz
2009-05-12 16:45 ` João Ramos
2009-05-07 16:52 ` H Hartley Sweeten
2009-05-07 22:09 ` Ryan Mallon
2009-05-07 22:31 ` H Hartley Sweeten
2009-05-07 22:51 ` Ryan Mallon
2009-05-07 23:01 ` H Hartley Sweeten
2009-05-07 23:12 ` Ryan Mallon
2009-05-07 23:32 ` João Ramos
2009-05-07 23:58 ` H Hartley Sweeten
2009-05-08 11:23 ` Sergei Shtylyov
2009-05-08 12:47 ` João Ramos
[not found] ` <49D12669.4030207@bluewatersys.com>
2009-03-31 10:36 ` Sergei Shtylyov
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=200905171816.44069.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=joao.ramos@inov.pt \
--cc=linux-ide@vger.kernel.org \
--cc=sshtylyov@ru.mvista.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;
as well as URLs for NNTP newsgroup(s).