From: Magnus Damm <magnus.damm@gmail.com> To: linux-kernel@vger.kernel.org Cc: Magnus Damm <magnus.damm@gmail.com>, lethal@linux-sh.org, g.liakhovetski@gmx.de, linux-sh@vger.kernel.org Subject: [PATCH 04/05] fbdev: sh_mipi_dsi: Require two I/O resources Date: Wed, 17 Nov 2010 06:44:44 +0000 [thread overview] Message-ID: <20101117064444.18139.93049.sendpatchset@t400s> (raw) In-Reply-To: <20101117064405.18139.57035.sendpatchset@t400s> From: Magnus Damm <damm@opensource.se> This patch updates the MIPI-DSI driver to use a second I/O resource to specify the base address for the link hardware block. The base address for the link hardware block seems to vary with SoC type. Using two I/O resources to describe the MIPI-DSI hardware allows us to support both newer and older SoCs. Signed-off-by: Magnus Damm <damm@opensource.se> --- drivers/video/sh_mipi_dsi.c | 44 +++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) --- 0006/drivers/video/sh_mipi_dsi.c +++ work/drivers/video/sh_mipi_dsi.c 2010-11-16 17:30:10.000000000 +0900 @@ -34,19 +34,20 @@ #define DSIINTE 0x0060 #define PHYCTRL 0x0070 -#define DTCTR 0x8000 -#define VMCTR1 0x8020 -#define VMCTR2 0x8024 -#define VMLEN1 0x8028 -#define CMTSRTREQ 0x8070 -#define CMTSRTCTR 0x80d0 - +/* relative to linkbase */ +#define DTCTR 0x0000 +#define VMCTR1 0x0020 +#define VMCTR2 0x0024 +#define VMLEN1 0x0028 +#define CMTSRTREQ 0x0070 +#define CMTSRTCTR 0x00d0 /* E.g., sh7372 has 2 MIPI-DSIs - one for each LCDC */ #define MAX_SH_MIPI_DSI 2 struct sh_mipi { void __iomem *base; + void __iomem *linkbase; struct clk *dsit_clk; struct clk *dsip_clk; }; @@ -71,10 +72,10 @@ static int sh_mipi_send_short(struct sh_ int cnt = 100; /* transmit a short packet to LCD panel */ - iowrite32(1 | data, mipi->base + CMTSRTCTR); - iowrite32(1, mipi->base + CMTSRTREQ); + iowrite32(1 | data, mipi->linkbase + CMTSRTCTR); + iowrite32(1, mipi->linkbase + CMTSRTREQ); - while ((ioread32(mipi->base + CMTSRTREQ) & 1) && --cnt) + while ((ioread32(mipi->linkbase + CMTSRTREQ) & 1) && --cnt) udelay(1); return cnt ? 0 : -ETIMEDOUT; @@ -106,7 +107,7 @@ static void sh_mipi_dsi_enable(struct sh * enable LCDC data tx, transition to LPS after completion of each HS * packet */ - iowrite32(0x00000002 | enable, mipi->base + DTCTR); + iowrite32(0x00000002 | enable, mipi->linkbase + DTCTR); } static void sh_mipi_shutdown(struct platform_device *pdev) @@ -291,20 +292,21 @@ static int __init sh_mipi_setup(struct s * Enable transmission of all packets, * transmit LPS after each HS packet completion */ - iowrite32(0x00000006, base + DTCTR); + iowrite32(0x00000006, mipi->linkbase + DTCTR); /* VSYNC width = 2 (<< 17) */ - iowrite32(0x00040000 | (pctype << 12) | datatype, base + VMCTR1); + iowrite32(0x00040000 | (pctype << 12) | datatype, + mipi->linkbase + VMCTR1); /* * Non-burst mode with sync pulses: VSE and HSE are output, * HSA period allowed, no commands in LP */ - iowrite32(0x00e00000, base + VMCTR2); + iowrite32(0x00e00000, mipi->linkbase + VMCTR2); /* * 0x660 = 1632 bytes per line (RGB24, 544 pixels: see * sh_mobile_lcdc_info.ch[0].lcd_cfg[0].xres), HSALEN = 1 - default * (unused, since VMCTR2[HSABM] = 0) */ - iowrite32(1 | (linelength << 16), base + VMLEN1); + iowrite32(1 | (linelength << 16), mipi->linkbase + VMLEN1); msleep(5); @@ -337,11 +339,12 @@ static int __init sh_mipi_probe(struct p struct sh_mipi *mipi; struct sh_mipi_dsi_info *pdata = pdev->dev.platform_data; struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1); unsigned long rate, f_current; int idx = pdev->id, ret; char dsip_clk[] = "dsi.p_clk"; - if (!res || idx >= ARRAY_SIZE(mipi_dsi) || !pdata) + if (!res || !res2 || idx >= ARRAY_SIZE(mipi_dsi) || !pdata) return -ENODEV; mutex_lock(&array_lock); @@ -366,6 +369,12 @@ static int __init sh_mipi_probe(struct p goto emap; } + mipi->linkbase = ioremap(res2->start, resource_size(res2)); + if (!mipi->linkbase) { + ret = -ENOMEM; + goto emap2; + } + mipi->dsit_clk = clk_get(&pdev->dev, "dsit_clk"); if (IS_ERR(mipi->dsit_clk)) { ret = PTR_ERR(mipi->dsit_clk); @@ -441,6 +450,8 @@ eclkpget: esettrate: clk_put(mipi->dsit_clk); eclktget: + iounmap(mipi->linkbase); +emap2: iounmap(mipi->base); emap: kfree(mipi); @@ -483,6 +494,7 @@ static int __exit sh_mipi_remove(struct clk_disable(mipi->dsit_clk); clk_put(mipi->dsit_clk); clk_put(mipi->dsip_clk); + iounmap(mipi->linkbase); iounmap(mipi->base); platform_set_drvdata(pdev, NULL); kfree(mipi);
WARNING: multiple messages have this Message-ID (diff)
From: Magnus Damm <magnus.damm@gmail.com> To: linux-kernel@vger.kernel.org Cc: Magnus Damm <magnus.damm@gmail.com>, lethal@linux-sh.org, g.liakhovetski@gmx.de, linux-sh@vger.kernel.org Subject: [PATCH 04/05] fbdev: sh_mipi_dsi: Require two I/O resources Date: Wed, 17 Nov 2010 15:44:44 +0900 [thread overview] Message-ID: <20101117064444.18139.93049.sendpatchset@t400s> (raw) In-Reply-To: <20101117064405.18139.57035.sendpatchset@t400s> From: Magnus Damm <damm@opensource.se> This patch updates the MIPI-DSI driver to use a second I/O resource to specify the base address for the link hardware block. The base address for the link hardware block seems to vary with SoC type. Using two I/O resources to describe the MIPI-DSI hardware allows us to support both newer and older SoCs. Signed-off-by: Magnus Damm <damm@opensource.se> --- drivers/video/sh_mipi_dsi.c | 44 +++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) --- 0006/drivers/video/sh_mipi_dsi.c +++ work/drivers/video/sh_mipi_dsi.c 2010-11-16 17:30:10.000000000 +0900 @@ -34,19 +34,20 @@ #define DSIINTE 0x0060 #define PHYCTRL 0x0070 -#define DTCTR 0x8000 -#define VMCTR1 0x8020 -#define VMCTR2 0x8024 -#define VMLEN1 0x8028 -#define CMTSRTREQ 0x8070 -#define CMTSRTCTR 0x80d0 - +/* relative to linkbase */ +#define DTCTR 0x0000 +#define VMCTR1 0x0020 +#define VMCTR2 0x0024 +#define VMLEN1 0x0028 +#define CMTSRTREQ 0x0070 +#define CMTSRTCTR 0x00d0 /* E.g., sh7372 has 2 MIPI-DSIs - one for each LCDC */ #define MAX_SH_MIPI_DSI 2 struct sh_mipi { void __iomem *base; + void __iomem *linkbase; struct clk *dsit_clk; struct clk *dsip_clk; }; @@ -71,10 +72,10 @@ static int sh_mipi_send_short(struct sh_ int cnt = 100; /* transmit a short packet to LCD panel */ - iowrite32(1 | data, mipi->base + CMTSRTCTR); - iowrite32(1, mipi->base + CMTSRTREQ); + iowrite32(1 | data, mipi->linkbase + CMTSRTCTR); + iowrite32(1, mipi->linkbase + CMTSRTREQ); - while ((ioread32(mipi->base + CMTSRTREQ) & 1) && --cnt) + while ((ioread32(mipi->linkbase + CMTSRTREQ) & 1) && --cnt) udelay(1); return cnt ? 0 : -ETIMEDOUT; @@ -106,7 +107,7 @@ static void sh_mipi_dsi_enable(struct sh * enable LCDC data tx, transition to LPS after completion of each HS * packet */ - iowrite32(0x00000002 | enable, mipi->base + DTCTR); + iowrite32(0x00000002 | enable, mipi->linkbase + DTCTR); } static void sh_mipi_shutdown(struct platform_device *pdev) @@ -291,20 +292,21 @@ static int __init sh_mipi_setup(struct s * Enable transmission of all packets, * transmit LPS after each HS packet completion */ - iowrite32(0x00000006, base + DTCTR); + iowrite32(0x00000006, mipi->linkbase + DTCTR); /* VSYNC width = 2 (<< 17) */ - iowrite32(0x00040000 | (pctype << 12) | datatype, base + VMCTR1); + iowrite32(0x00040000 | (pctype << 12) | datatype, + mipi->linkbase + VMCTR1); /* * Non-burst mode with sync pulses: VSE and HSE are output, * HSA period allowed, no commands in LP */ - iowrite32(0x00e00000, base + VMCTR2); + iowrite32(0x00e00000, mipi->linkbase + VMCTR2); /* * 0x660 = 1632 bytes per line (RGB24, 544 pixels: see * sh_mobile_lcdc_info.ch[0].lcd_cfg[0].xres), HSALEN = 1 - default * (unused, since VMCTR2[HSABM] = 0) */ - iowrite32(1 | (linelength << 16), base + VMLEN1); + iowrite32(1 | (linelength << 16), mipi->linkbase + VMLEN1); msleep(5); @@ -337,11 +339,12 @@ static int __init sh_mipi_probe(struct p struct sh_mipi *mipi; struct sh_mipi_dsi_info *pdata = pdev->dev.platform_data; struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1); unsigned long rate, f_current; int idx = pdev->id, ret; char dsip_clk[] = "dsi.p_clk"; - if (!res || idx >= ARRAY_SIZE(mipi_dsi) || !pdata) + if (!res || !res2 || idx >= ARRAY_SIZE(mipi_dsi) || !pdata) return -ENODEV; mutex_lock(&array_lock); @@ -366,6 +369,12 @@ static int __init sh_mipi_probe(struct p goto emap; } + mipi->linkbase = ioremap(res2->start, resource_size(res2)); + if (!mipi->linkbase) { + ret = -ENOMEM; + goto emap2; + } + mipi->dsit_clk = clk_get(&pdev->dev, "dsit_clk"); if (IS_ERR(mipi->dsit_clk)) { ret = PTR_ERR(mipi->dsit_clk); @@ -441,6 +450,8 @@ eclkpget: esettrate: clk_put(mipi->dsit_clk); eclktget: + iounmap(mipi->linkbase); +emap2: iounmap(mipi->base); emap: kfree(mipi); @@ -483,6 +494,7 @@ static int __exit sh_mipi_remove(struct clk_disable(mipi->dsit_clk); clk_put(mipi->dsit_clk); clk_put(mipi->dsip_clk); + iounmap(mipi->linkbase); iounmap(mipi->base); platform_set_drvdata(pdev, NULL); kfree(mipi);
next prev parent reply other threads:[~2010-11-17 6:44 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-11-17 6:44 [PATCH 00/05] fbdev: SH-Mobile MIPI-DSI Update Magnus Damm 2010-11-17 6:44 ` Magnus Damm 2010-11-17 6:44 ` [PATCH 01/05] fbdev: sh_mipi_dsi: Remove request/release mem region Magnus Damm 2010-11-17 6:44 ` Magnus Damm 2010-11-17 7:25 ` Paul Mundt 2010-11-17 7:25 ` Paul Mundt 2010-11-17 8:51 ` Magnus Damm 2010-11-17 8:51 ` Magnus Damm 2010-11-17 9:30 ` Paul Mundt 2010-11-17 9:30 ` Paul Mundt 2010-11-17 10:06 ` Magnus Damm 2010-11-17 10:06 ` Magnus Damm 2010-11-17 6:44 ` [PATCH 02/05] fbdev: sh_mipi_dsi: Make use of register names Magnus Damm 2010-11-17 6:44 ` Magnus Damm 2010-11-17 6:44 ` [PATCH 03/05] ARM: mach-shmobile: Extend AP4EVB MIPI-DSI resources Magnus Damm 2010-11-17 6:44 ` Magnus Damm 2010-11-17 6:44 ` Magnus Damm [this message] 2010-11-17 6:44 ` [PATCH 04/05] fbdev: sh_mipi_dsi: Require two I/O resources Magnus Damm 2010-11-17 6:44 ` [PATCH 05/05] fbdev: sh_mipi_dsi: Allow LCDC board callbacks Magnus Damm 2010-11-17 6:44 ` Magnus Damm 2010-11-17 7:48 ` [PATCH 00/05] fbdev: SH-Mobile MIPI-DSI Update Guennadi Liakhovetski 2010-11-17 7:48 ` Guennadi Liakhovetski 2010-11-19 8:05 ` Paul Mundt 2010-11-19 8:05 ` Paul Mundt
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=20101117064444.18139.93049.sendpatchset@t400s \ --to=magnus.damm@gmail.com \ --cc=g.liakhovetski@gmx.de \ --cc=lethal@linux-sh.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-sh@vger.kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.