From: "Grant Likely" <grant.likely@secretlab.ca>
To: "Stephen Neuendorffer" <stephen.neuendorffer@xilinx.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 4/4] [POWERPC] Xilinx: Framebuffer: Use dcr infrastructure.
Date: Mon, 5 May 2008 22:55:53 -0600 [thread overview]
Message-ID: <fa686aa40805052155q43a7ebd8x14c1711bd4c6bbfa@mail.gmail.com> (raw)
In-Reply-To: <20080505175647.4F3AC1C9004A@mail57-sin.bigfish.com>
On Mon, May 5, 2008 at 11:56 AM, Stephen Neuendorffer
<stephen.neuendorffer@xilinx.com> wrote:
> This device contains a dcr interface. Previously, the dcr interface
> was assumed to be used in mmio mode, and the register space of the dcr
> interface was precomputed and stuffed in the device tree. This patch
> makes use of the new dcr infrastructure to represent the dcr interface
> as any other dcr interface in the device tree. This enables the dcr
> interface to be connected directly to a native dcr interface in a
> clean way.
>
> In particular, the device tree expected looks like:
>
> dcr_v29_0: dcr@0 {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "xlnx,dcr-v29-1.00.a";
> VGA_FrameBuffer: tft@80 {
> compatible = "xlnx,plb-tft-cntlr-ref-1.00.a";
> dcr-parent = <&opb2dcr_bridge_0>;
> dcr-reg = < 80 2 >;
> xlnx,default-tft-base-addr = <7f>;
> xlnx,dps-init = <1>;
> xlnx,on-init = <1>;
> xlnx,pixclk-is-busclk-divby4 = <1>;
> } ;
> } ;
>
> opb2dcr_bridge_0: opb2dcr-bridge@40700000 {
> compatible = "xlnx,opb2dcr-bridge-1.00.b";
> dcr-access-method = "mmio";
> dcr-controller ;
> dcr-mmio-range = < 40700000 1000 >;
> dcr-mmio-stride = <4>;
> reg = < 40700000 1000 >;
> xlnx,family = "virtex2p";
> } ;
Hmmm, something doesn't quite feel right about this. The node
describing the tft device is a child of the dcr@0 node which is the
dcr bus. However, dcr bindings use dcr-bus and dcr-reg instead of
parent-child relationship to specify how to access the dcr registers.
So, in this example; if the device is described by tft@80, and the dcr
bus is described by opb2dcr-bridge@40700000, then what does dcr@0
describe? (I do understand what they really describe in EDK terms;
but I'm looking at it through device tree glasses).
I don't think the presence of a dcr@0 node is a problem, but in this
case #size/address-cells doesn't have any meaning (the child doesn't
have a reg property) and it looks like it should be a child of the
opb2dcr-bridge node (otherwise, what is it attached to?).
Cheers,
g.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
> ---
> drivers/video/xilinxfb.c | 54 +++++++++++++++++-----------------------------
> 1 files changed, 20 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
> index 4d64402..848752e 100644
> --- a/drivers/video/xilinxfb.c
> +++ b/drivers/video/xilinxfb.c
> @@ -37,6 +37,7 @@
> #endif
> #include <asm/io.h>
> #include <linux/xilinxfb.h>
> +#include <asm/dcr.h>
>
> #define DRIVER_NAME "xilinxfb"
> #define DRIVER_DESCRIPTION "Xilinx TFT LCD frame buffer driver"
> @@ -111,8 +112,9 @@ struct xilinxfb_drvdata {
>
> struct fb_info info; /* FB driver info record */
>
> - u32 regs_phys; /* phys. address of the control registers */
> - u32 __iomem *regs; /* virt. address of the control registers */
> + dcr_host_t dcr_host;
> + unsigned int dcr_start;
> + unsigned int dcr_len;
>
> void *fb_virt; /* virt. address of the frame buffer */
> dma_addr_t fb_phys; /* phys. address of the frame buffer */
> @@ -135,7 +137,7 @@ struct xilinxfb_drvdata {
> * when it's needed.
> */
> #define xilinx_fb_out_be32(driverdata, offset, val) \
> - out_be32(driverdata->regs + offset, val)
> + dcr_write(driverdata->dcr_host, offset, val)
>
> static int
> xilinx_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,
> @@ -203,7 +205,8 @@ static struct fb_ops xilinxfb_ops =
> * Bus independent setup/teardown
> */
>
> -static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
> +static int xilinxfb_assign(struct device *dev, dcr_host_t dcr_host,
> + unsigned int dcr_start, unsigned int dcr_len,
> struct xilinxfb_platform_data *pdata)
> {
> struct xilinxfb_drvdata *drvdata;
> @@ -218,21 +221,9 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
> }
> dev_set_drvdata(dev, drvdata);
>
> - /* Map the control registers in */
> - if (!request_mem_region(physaddr, 8, DRIVER_NAME)) {
> - dev_err(dev, "Couldn't lock memory region at 0x%08lX\n",
> - physaddr);
> - rc = -ENODEV;
> - goto err_region;
> - }
> - drvdata->regs_phys = physaddr;
> - drvdata->regs = ioremap(physaddr, 8);
> - if (!drvdata->regs) {
> - dev_err(dev, "Couldn't lock memory region at 0x%08lX\n",
> - physaddr);
> - rc = -ENODEV;
> - goto err_map;
> - }
> + drvdata->dcr_start = dcr_start;
> + drvdata->dcr_len = dcr_len;
> + drvdata->dcr_host = dcr_host;
>
> /* Allocate the framebuffer memory */
> if (pdata->fb_phys) {
> @@ -247,7 +238,7 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
> if (!drvdata->fb_virt) {
> dev_err(dev, "Could not allocate frame buffer memory\n");
> rc = -ENOMEM;
> - goto err_fbmem;
> + goto err_region;
> }
>
> /* Clear (turn to black) the framebuffer */
> @@ -297,7 +288,6 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
> }
>
> /* Put a banner in the log (for DEBUG) */
> - dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr, drvdata->regs);
> dev_dbg(dev, "fb: phys=%p, virt=%p, size=%x\n",
> (void*)drvdata->fb_phys, drvdata->fb_virt, fbsize);
>
> @@ -313,12 +303,6 @@ err_cmap:
> /* Turn off the display */
> xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
>
> -err_fbmem:
> - iounmap(drvdata->regs);
> -
> -err_map:
> - release_mem_region(physaddr, 8);
> -
> err_region:
> kfree(drvdata);
> dev_set_drvdata(dev, NULL);
> @@ -344,9 +328,8 @@ static int xilinxfb_release(struct device *dev)
>
> /* Turn off the display */
> xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
> - iounmap(drvdata->regs);
>
> - release_mem_region(drvdata->regs_phys, 8);
> + dcr_unmap(drvdata->dcr_host, drvdata->dcr_len);
>
> kfree(drvdata);
> dev_set_drvdata(dev, NULL);
> @@ -362,20 +345,23 @@ static int xilinxfb_release(struct device *dev)
> static int __devinit
> xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
> {
> - struct resource res;
> const u32 *prop;
> struct xilinxfb_platform_data pdata;
> int size, rc;
> + int start, len;
> + dcr_host_t dcr_host;
>
> /* Copy with the default pdata (not a ptr reference!) */
> pdata = xilinx_fb_default_pdata;
>
> dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match);
>
> - rc = of_address_to_resource(op->node, 0, &res);
> - if (rc) {
> + start = dcr_resource_start(op->node, 0);
> + len = dcr_resource_len(op->node, 0);
> + dcr_host = dcr_map(op->node, start, len);
> + if (!DCR_MAP_OK(dcr_host)) {
> dev_err(&op->dev, "invalid address\n");
> - return rc;
> + return -ENODEV;
> }
>
> prop = of_get_property(op->node, "phys-size", &size);
> @@ -399,7 +385,7 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
> if (of_find_property(op->node, "rotate-display", NULL))
> pdata.rotate_screen = 1;
>
> - return xilinxfb_assign(&op->dev, res.start, &pdata);
> + return xilinxfb_assign(&op->dev, dcr_host, start, len, &pdata);
> }
>
> static int __devexit xilinxfb_of_remove(struct of_device *op)
> --
> 1.5.3.4-dirty
>
>
>
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
next prev parent reply other threads:[~2008-05-06 4:55 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1206401313-1625-1-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-28 16:23 ` [PATCH 1/5] [v2][POWERPC] refactor dcr code Stephen Neuendorffer
2008-03-30 22:02 ` Benjamin Herrenschmidt
2008-04-01 20:16 ` Stephen Neuendorffer
2008-04-04 22:02 ` Stephen Neuendorffer
2008-04-04 22:10 ` Benjamin Herrenschmidt
2008-04-18 21:49 ` Stephen Neuendorffer
2008-04-18 21:55 ` [PATCH 1/2] [v3][POWERPC] " Stephen Neuendorffer
2008-04-19 2:30 ` Grant Likely
2008-04-19 3:04 ` Benjamin Herrenschmidt
2008-04-19 14:35 ` Josh Boyer
2008-04-21 3:56 ` Stephen Neuendorffer
2008-04-21 13:03 ` Josh Boyer
2008-05-05 17:56 ` [PATCH 0/4] [v4][POWERPC] " Stephen Neuendorffer
[not found] ` <1210010201-28436-1-git-send-email-stephen.neuendorffer@xilinx.com>
2008-05-05 17:56 ` [PATCH 1/4] " Stephen Neuendorffer
2008-05-06 0:12 ` Benjamin Herrenschmidt
2008-05-06 3:40 ` Stephen Rothwell
2008-05-06 4:02 ` Benjamin Herrenschmidt
2008-05-06 17:34 ` Stephen Neuendorffer
2008-05-06 17:40 ` Josh Boyer
2008-05-06 18:29 ` [PATCH 1/4] [v5][POWERPC] " Stephen Neuendorffer
[not found] ` <1210010201-28436-2-git-send-email-stephen.neuendorffer@xilinx.com>
2008-05-05 17:56 ` [PATCH 2/4] [POWERPC] Xilinx: Virtex: Enable dcr for MMIO and NATIVE Stephen Neuendorffer
2008-05-06 0:11 ` Benjamin Herrenschmidt
2008-05-06 17:33 ` [PATCH 2/4] [POWERPC] Xilinx: Virtex: Enable dcr for MMIO andNATIVE Stephen Neuendorffer
[not found] ` <1210010201-28436-3-git-send-email-stephen.neuendorffer@xilinx.com>
2008-05-05 17:56 ` [PATCH 3/4] [POWERPC] Xilinx: Framebuffer: remove platform device support Stephen Neuendorffer
[not found] ` <1210010201-28436-4-git-send-email-stephen.neuendorffer@xilinx.com>
2008-05-05 17:56 ` [PATCH 4/4] [POWERPC] Xilinx: Framebuffer: Use dcr infrastructure Stephen Neuendorffer
2008-05-06 4:55 ` Grant Likely [this message]
2008-05-06 6:14 ` David Gibson
2008-05-06 10:56 ` Segher Boessenkool
2008-05-08 1:57 ` David Gibson
2008-05-06 17:43 ` [PATCH 4/4] [POWERPC] Xilinx: Framebuffer: Use dcrinfrastructure Stephen Neuendorffer
2008-05-08 1:59 ` David Gibson
2008-05-08 4:46 ` [PATCH 4/4] [POWERPC] Xilinx: Framebuffer: Usedcrinfrastructure Stephen Neuendorffer
2008-05-08 7:01 ` David Gibson
[not found] ` <1208555704-8978-1-git-send-email-stephen.neuendorffer@xilinx.com>
2008-04-18 21:55 ` [PATCH 2/2] [POWERPC] Xilinx: Virtex: Enable dcr for MMIO and NATIVE Stephen Neuendorffer
2008-04-19 2:31 ` Grant Likely
[not found] ` <1206721429-18276-1-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-28 16:23 ` [PATCH 2/5] " Stephen Neuendorffer
[not found] ` <1206721429-18276-2-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-28 16:23 ` [PATCH 3/5] [POWERPC] explicit dcr support Stephen Neuendorffer
2008-03-30 22:04 ` Benjamin Herrenschmidt
[not found] ` <1206721429-18276-3-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-28 16:23 ` [PATCH 4/5] [POWERPC] Xilinx: Framebuffer: Use dcr infrastructure Stephen Neuendorffer
[not found] ` <1206721429-18276-4-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-28 16:23 ` [PATCH 5/5] [RFC][PPC] Use DCR for arch ppc, and enable MMIO and NATIVE for virtex Stephen Neuendorffer
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=fa686aa40805052155q43a7ebd8x14c1711bd4c6bbfa@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=linuxppc-dev@ozlabs.org \
--cc=stephen.neuendorffer@xilinx.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).