* [PATCH v2 1/3] video: xilinxfb: Fix OF probing on little-endian systems
@ 2013-05-30 9:41 Michal Simek
2013-05-30 9:41 ` [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function Michal Simek
2013-05-30 9:41 ` [PATCH v2 3/3] video: xilinxfb: Use driver for Xilinx ARM Zynq Michal Simek
0 siblings, 2 replies; 6+ messages in thread
From: Michal Simek @ 2013-05-30 9:41 UTC (permalink / raw)
To: linux-kernel
Cc: Michal Simek, Michal Simek, Florian Tobias Schandinat,
Grant Likely, Rob Herring, linux-fbdev, devicetree-discuss
[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]
From: Michal Simek <monstr@monstr.eu>
DTB is always big-endian that's why is necessary
to convert it.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v2:
- use of_property_read_u32 helper function
drivers/video/xilinxfb.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index af0b4fd..aecd15d 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -406,8 +406,7 @@ static int xilinxfb_release(struct device *dev)
static int xilinxfb_of_probe(struct platform_device *op)
{
const u32 *prop;
- u32 *p;
- u32 tft_access;
+ u32 tft_access = 0;
struct xilinxfb_platform_data pdata;
struct resource res;
int size, rc;
@@ -427,8 +426,8 @@ static int xilinxfb_of_probe(struct platform_device *op)
* To check whether the core is connected directly to DCR or PLB
* interface and initialize the tft_access accordingly.
*/
- p = (u32 *)of_get_property(op->dev.of_node, "xlnx,dcr-splb-slave-if", NULL);
- tft_access = p ? *p : 0;
+ of_property_read_u32(op->dev.of_node, "xlnx,dcr-splb-slave-if",
+ &tft_access);
/*
* Fill the resource structure if its direct PLB interface
--
1.8.2.3
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function
2013-05-30 9:41 [PATCH v2 1/3] video: xilinxfb: Fix OF probing on little-endian systems Michal Simek
@ 2013-05-30 9:41 ` Michal Simek
2013-05-30 22:04 ` Arnd Bergmann
2013-05-30 9:41 ` [PATCH v2 3/3] video: xilinxfb: Use driver for Xilinx ARM Zynq Michal Simek
1 sibling, 1 reply; 6+ messages in thread
From: Michal Simek @ 2013-05-30 9:41 UTC (permalink / raw)
To: linux-kernel
Cc: Michal Simek, Michal Simek, Florian Tobias Schandinat,
linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 3215 bytes --]
out_be32 IO function is not supported by ARM.
It is only available for PPC and Microblaze.
Remove all out_be32 references and start to use __raw_writel
function.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v2: None
drivers/video/xilinxfb.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index aecd15d..000185a 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -57,7 +57,7 @@
* In case of direct PLB access the second control register will be at
* an offset of 4 as compared to the DCR access where the offset is 1
* i.e. REG_CTRL. So this is taken care in the function
- * xilinx_fb_out_be32 where it left shifts the offset 2 times in case of
+ * xilinx_fb_out32 where it left shifts the offset 2 times in case of
* direct PLB access.
*/
#define NUM_REGS 2
@@ -150,11 +150,11 @@ struct xilinxfb_drvdata {
* To perform the read/write on the registers we need to check on
* which bus its connected and call the appropriate write API.
*/
-static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset,
+static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset,
u32 val)
{
if (drvdata->flags & PLB_ACCESS_FLAG)
- out_be32(drvdata->regs + (offset << 2), val);
+ __raw_writel(val, drvdata->regs + (offset << 2));
#ifdef CONFIG_PPC_DCR
else
dcr_write(drvdata->dcr_host, offset, val);
@@ -197,7 +197,7 @@ xilinx_fb_blank(int blank_mode, struct fb_info *fbi)
switch (blank_mode) {
case FB_BLANK_UNBLANK:
/* turn on panel */
- xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default);
+ xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default);
break;
case FB_BLANK_NORMAL:
@@ -205,7 +205,7 @@ xilinx_fb_blank(int blank_mode, struct fb_info *fbi)
case FB_BLANK_HSYNC_SUSPEND:
case FB_BLANK_POWERDOWN:
/* turn off panel */
- xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
+ xilinx_fb_out32(drvdata, REG_CTRL, 0);
default:
break;
@@ -280,13 +280,13 @@ static int xilinxfb_assign(struct device *dev,
memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize);
/* Tell the hardware where the frame buffer is */
- xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys);
+ xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys);
/* Turn on the display */
drvdata->reg_ctrl_default = REG_CTRL_ENABLE;
if (pdata->rotate_screen)
drvdata->reg_ctrl_default |= REG_CTRL_ROTATE;
- xilinx_fb_out_be32(drvdata, REG_CTRL,
+ xilinx_fb_out32(drvdata, REG_CTRL,
drvdata->reg_ctrl_default);
/* Fill struct fb_info */
@@ -345,7 +345,7 @@ err_cmap:
iounmap(drvdata->fb_virt);
/* Turn off the display */
- xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
+ xilinx_fb_out32(drvdata, REG_CTRL, 0);
err_fbmem:
if (drvdata->flags & PLB_ACCESS_FLAG)
@@ -381,7 +381,7 @@ static int xilinxfb_release(struct device *dev)
iounmap(drvdata->fb_virt);
/* Turn off the display */
- xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
+ xilinx_fb_out32(drvdata, REG_CTRL, 0);
/* Release the resources, as allocated based on interface */
if (drvdata->flags & PLB_ACCESS_FLAG) {
--
1.8.2.3
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] video: xilinxfb: Use driver for Xilinx ARM Zynq
2013-05-30 9:41 [PATCH v2 1/3] video: xilinxfb: Fix OF probing on little-endian systems Michal Simek
2013-05-30 9:41 ` [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function Michal Simek
@ 2013-05-30 9:41 ` Michal Simek
1 sibling, 0 replies; 6+ messages in thread
From: Michal Simek @ 2013-05-30 9:41 UTC (permalink / raw)
To: linux-kernel
Cc: Michal Simek, Michal Simek, Florian Tobias Schandinat,
linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 697 bytes --]
From: Michal Simek <monstr@monstr.eu>
Enable this driver for all Xilinx platforms.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v2: None
drivers/video/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 2e937bd..2c301f8 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2188,7 +2188,7 @@ config FB_PS3_DEFAULT_SIZE_M
config FB_XILINX
tristate "Xilinx frame buffer support"
- depends on FB && (XILINX_VIRTEX || MICROBLAZE)
+ depends on FB && (XILINX_VIRTEX || MICROBLAZE || ARCH_ZYNQ)
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
--
1.8.2.3
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function
2013-05-30 9:41 ` [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function Michal Simek
@ 2013-05-30 22:04 ` Arnd Bergmann
2013-05-31 1:16 ` Timur Tabi
2013-05-31 7:39 ` Michal Simek
0 siblings, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2013-05-30 22:04 UTC (permalink / raw)
To: Michal Simek
Cc: linux-kernel, Michal Simek, Florian Tobias Schandinat,
linux-fbdev
On Thursday 30 May 2013 11:41:01 Michal Simek wrote:
> * To perform the read/write on the registers we need to check on
> * which bus its connected and call the appropriate write API.
> */
> -static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset,
> +static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset,
> u32 val)
> {
> if (drvdata->flags & PLB_ACCESS_FLAG)
> - out_be32(drvdata->regs + (offset << 2), val);
> + __raw_writel(val, drvdata->regs + (offset << 2));
> #ifdef CONFIG_PPC_DCR
> else
> dcr_write(drvdata->dcr_host, offset, val);
>
This is probably missing barriers, and is wrong on systems on which
the endianess of the device is different from the CPU.
You already have an indirection in there, so I guess it won't hurt
to create a third case for little-endian registers and add
another bit in drvdata->flags, or make it depend on the architecture,
if the endianess of the device registers is known at compile time.
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function
2013-05-30 22:04 ` Arnd Bergmann
@ 2013-05-31 1:16 ` Timur Tabi
2013-05-31 7:39 ` Michal Simek
1 sibling, 0 replies; 6+ messages in thread
From: Timur Tabi @ 2013-05-31 1:16 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Michal Simek, lkml, Michal Simek, Florian Tobias Schandinat,
linux-fbdev@vger.kernel.org
On Thu, May 30, 2013 at 5:04 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>
> This is probably missing barriers, and is wrong on systems on which
> the endianess of the device is different from the CPU.
I suggest what was done in fsl_ssi.c:
#ifdef PPC
#define read_ssi(addr) in_be32(addr)
#define write_ssi(val, addr) out_be32(addr, val)
#define write_ssi_mask(addr, clear, set) clrsetbits_be32(addr, clear, set)
#elif defined ARM
#define read_ssi(addr) readl(addr)
#define write_ssi(val, addr) writel(val, addr)
/*
* FIXME: Proper locking should be added at write_ssi_mask caller level
* to ensure this register read/modify/write sequence is race free.
*/
static inline void write_ssi_mask(u32 __iomem *addr, u32 clear, u32 set)
{
u32 val = readl(addr);
val = (val & ~clear) | set;
writel(val, addr);
}
#endif
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function
2013-05-30 22:04 ` Arnd Bergmann
2013-05-31 1:16 ` Timur Tabi
@ 2013-05-31 7:39 ` Michal Simek
1 sibling, 0 replies; 6+ messages in thread
From: Michal Simek @ 2013-05-31 7:39 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Michal Simek, linux-kernel, Florian Tobias Schandinat,
linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]
On 05/31/2013 12:04 AM, Arnd Bergmann wrote:
> On Thursday 30 May 2013 11:41:01 Michal Simek wrote:
>> * To perform the read/write on the registers we need to check on
>> * which bus its connected and call the appropriate write API.
>> */
>> -static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset,
>> +static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset,
>> u32 val)
>> {
>> if (drvdata->flags & PLB_ACCESS_FLAG)
>> - out_be32(drvdata->regs + (offset << 2), val);
>> + __raw_writel(val, drvdata->regs + (offset << 2));
>> #ifdef CONFIG_PPC_DCR
>> else
>> dcr_write(drvdata->dcr_host, offset, val);
>>
>
> This is probably missing barriers, and is wrong on systems on which
> the endianess of the device is different from the CPU.
>
> You already have an indirection in there, so I guess it won't hurt
> to create a third case for little-endian registers and add
> another bit in drvdata->flags, or make it depend on the architecture,
> if the endianess of the device registers is known at compile time.
The PLB_ACCESS_FLAGS is incorrectly named. It means BUS_ACCESS.
But I will find a way how to autodetect endianess directly on IP
as I have done it for uartlite and will send v3.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-05-31 7:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30 9:41 [PATCH v2 1/3] video: xilinxfb: Fix OF probing on little-endian systems Michal Simek
2013-05-30 9:41 ` [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function Michal Simek
2013-05-30 22:04 ` Arnd Bergmann
2013-05-31 1:16 ` Timur Tabi
2013-05-31 7:39 ` Michal Simek
2013-05-30 9:41 ` [PATCH v2 3/3] video: xilinxfb: Use driver for Xilinx ARM Zynq Michal Simek
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).