i.MX51 Framebuffer support
Sascha Hauer
maintainerPATCH 1/1 i.MX51 Framebuffer support
Once again, changes since last posting include:
- remove MFD_ prefix from Kconfig names
- move ipu header to include/video
- cleanup babbage framebuffer support
Sascha Hauer (8):
fb: export fb mode db table
ARM i.MX51: setup mipi
Add a mfd IPUv3 driver
Add i.MX5 framebuffer driver
ARM i.MX51: Add IPU device support
ARM i.MX5: Allow to increase max zone order ARM i.MX5: increase dma consistent size for IPU support ARM i.MX51 babbage: Add framebuffer support
arch/arm/Kconfig | 4 +- arch/arm/mach-mx5/Kconfig | 1 + arch/arm/mach-mx5/board-mx51_babbage.c | 82 ++ arch/arm/mach-mx5/cpu.c | 36 + arch/arm/mach-mx5/devices-imx51.h | 4 + arch/arm/plat-mxc/devices/Kconfig | 4 + arch/arm/plat-mxc/devices/Makefile | 1 + arch/arm/plat-mxc/devices/platform-imx_ipuv3.c | 47 ++ arch/arm/plat-mxc/include/mach/devices-common.h | 10 + arch/arm/plat-mxc/include/mach/ipu-v3.h | 49 ++ arch/arm/plat-mxc/include/mach/memory.h | 3 +- drivers/video/Kconfig | 13 + drivers/video/Makefile | 2 + drivers/video/imx-ipu-v3/Kconfig | 10 + drivers/video/imx-ipu-v3/Makefile | 3 + drivers/video/imx-ipu-v3/ipu-common.c | 666 ++++++++++++++++ drivers/video/imx-ipu-v3/ipu-cpmem.c | 612 +++++++++++++++ drivers/video/imx-ipu-v3/ipu-dc.c | 364 +++++++++ drivers/video/imx-ipu-v3/ipu-di.c | 550 ++++++++++++++ drivers/video/imx-ipu-v3/ipu-dmfc.c | 355 +++++++++ drivers/video/imx-ipu-v3/ipu-dp.c | 476 ++++++++++++ drivers/video/imx-ipu-v3/ipu-prv.h | 216 ++++++ drivers/video/modedb.c | 8 +- drivers/video/mx5fb.c | 925 +++++++++++++++++++++++ include/linux/fb.h | 3 + include/video/imx-ipu-v3.h | 219 ++++++ 26 files changed, 4658 insertions(+), 5 deletions(-) create mode 100644 arch/arm/plat-mxc/devices/platform-imx_ipuv3.c create mode 100644 arch/arm/plat-mxc/include/mach/ipu-v3.h create mode 100644 drivers/video/imx-ipu-v3/Kconfig create mode 100644 drivers/video/imx-ipu-v3/Makefile create mode 100644 drivers/video/imx-ipu-v3/ipu-common.c create mode 100644 drivers/video/imx-ipu-v3/ipu-cpmem.c create mode 100644 drivers/video/imx-ipu-v3/ipu-dc.c create mode 100644 drivers/video/imx-ipu-v3/ipu-di.c create mode 100644 drivers/video/imx-ipu-v3/ipu-dmfc.c create mode 100644 drivers/video/imx-ipu-v3/ipu-dp.c create mode 100644 drivers/video/imx-ipu-v3/ipu-prv.h create mode 100644 drivers/video/mx5fb.c create mode 100644 include/video/imx-ipu-v3.h
Sascha Hauer
maintainerPATCH 1/8 fb: export fb mode db table
The different modes can be useful for drivers. Currently there is no way to expose the modes to sysfs, so export them.
--- drivers/video/modedb.c | 8 ++++++-- include/linux/fb.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/video/modedb.c +6 -2
@@ -36,8 +36,7 @@ EXPORT_SYMBOL_GPL(fb_mode_option);* Standard video mode definitions (taken from XFree86) */ -static const struct fb_videomode modedb[] = { - +const struct fb_videomode modedb[] = {/* 640x400 @ 70 Hz, 31.5 kHz hsync */ {NULL ,70 ,640 ,400 ,39721 ,40 ,24 ,39 ,9 ,96 ,2 ,0 ,FB_VMODE_NONINTERLACED },
@@ -291,6 +290,11 @@ static const struct fb_videomode modedb[] = { 0, FB_VMODE_NONINTERLACED }, }; +const struct fb_videomode *fb_modes = modedb; +EXPORT_SYMBOL (fb_modes); +const int num_fb_modes =ARRAY_SIZE (modedb); +EXPORT_SYMBOL (num_fb_modes); +#ifdef CONFIG_FB_MODE_HELPERS const struct fb_videomode cea_modes[64 ] = { /* #1: 640x480p at 59.94/60Hz */
include/linux/fb.h +3 -0
@@ -1154,6 +1154,9 @@ extern const char *fb_mode_option;extern const struct fb_videomode vesa_modes[];extern const struct fb_videomode cea_modes[64 ]; +extern const struct fb_videomode *fb_modes; +extern const int num_fb_modes; +struct fb_modelist {struct list_head list;struct fb_videomode mode;
Signature · 1 line
1.7.2.3
Sascha Hauer
maintainerPATCH 2/8 ARM i.MX51: setup mipi
In reply to Sascha HauerThe mipi unit has to be brought to a sane default state. This unit is not present on i.MX53, so we add the setup here instead of the ipu driver.
--- arch/arm/mach-mx5/cpu.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-)
arch/arm/mach-mx5/cpu.c +36 -0
@@ -15,6 +15,8 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/module.h> +#include <linux/clk.h> +#include <linux/err.h> #include <mach/hardware.h> #include <asm/io.h>
@@ -102,11 +104,45 @@ int mx53_revision(void) }EXPORT_SYMBOL (mx53_revision); +/* +* The MIPI HSC unit has been removed from the i.MX51 Reference Manual by +* the Freescale marketing division. However this did not remove the +* hardware from the chip which still needs to be configured for proper +* IPU support. +*/ +static void __init ipu_mipi_setup (void ) +{ +struct clk *hsc_clk; +void __iomem *hsc_addr; + + hsc_addr =MX51_IO_ADDRESS (MX51_MIPI_HSC_BASE_ADDR ); + + hsc_clk =clk_get_sys (NULL ,"mipi_hsp" ); +if (IS_ERR (hsc_clk)) { +pr_err ("failed to get mipi clock\n" ); +return ; + } +clk_enable (hsc_clk); + +/* setup MIPI module to legacy mode */ +__raw_writel (0xf00 , hsc_addr); + +/* CSI mode: reserved; DI control mode: legacy (from Freescale BSP) */ +__raw_writel (__raw_readl (hsc_addr +0x800 ) |0x30ff , + hsc_addr +0x800 ); + +clk_disable (hsc_clk); +clk_put (hsc_clk); +} +static int __init post_cpu_init (void ) {unsigned int reg;void __iomem *base; +if (cpu_is_mx51 ()) +ipu_mipi_setup (); +if (cpu_is_mx51 () ||cpu_is_mx53 ()) {if (cpu_is_mx51 ()) base =MX51_IO_ADDRESS (MX51_AIPS1_BASE_ADDR );
Signature · 1 line
1.7.2.3
Sascha Hauer
maintainerPATCH 3/8 Add a mfd IPUv3 driver
In reply to Sascha HauerThe IPU is the Image Processing Unit found on i.MX51/53 SoCs. It features several units for image processing, this patch adds support for the units needed for Framebuffer support, namely:
- Display Controller (dc)
- Display Interface (di)
- Display Multi Fifo Controller (dmfc)
- Display Processor (dp)
- Image DMA Controller (idmac)
This patch is based on the Freescale driver, but follows a different approach. The Freescale code implements logical idmac channels and the handling of the subunits is hidden in common idmac code pathes in big switch/case statements. This patch instead just provides code and resource management for the different subunits. The user, in this case the framebuffer driver, decides how the different units play together.
The IPU has other units missing in this patch:
- CMOS Sensor Interface (csi)
- Video Deinterlacer (vdi)
- Sensor Multi FIFO Controler (smfc)
- Image Converter (ic)
- Image Rotator (irt)
So expect more files to come in this directory.
--- arch/arm/plat-mxc/include/mach/ipu-v3.h | 49 +++ drivers/video/Kconfig | 2 + drivers/video/Makefile | 1 + drivers/video/imx-ipu-v3/Kconfig | 10 + drivers/video/imx-ipu-v3/Makefile | 3 + drivers/video/imx-ipu-v3/ipu-common.c | 666 +++++++++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-cpmem.c | 612 ++++++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dc.c | 364 +++++++++++++++++ drivers/video/imx-ipu-v3/ipu-di.c | 550 +++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dmfc.c | 355 ++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dp.c | 476 ++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-prv.h | 216 ++++++++++ include/video/imx-ipu-v3.h | 219 ++++++++++ 13 files changed, 3523 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-mxc/include/mach/ipu-v3.h create mode 100644 drivers/video/imx-ipu-v3/Kconfig create mode 100644 drivers/video/imx-ipu-v3/Makefile create mode 100644 drivers/video/imx-ipu-v3/ipu-common.c create mode 100644 drivers/video/imx-ipu-v3/ipu-cpmem.c create mode 100644 drivers/video/imx-ipu-v3/ipu-dc.c create mode 100644 drivers/video/imx-ipu-v3/ipu-di.c create mode 100644 drivers/video/imx-ipu-v3/ipu-dmfc.c create mode 100644 drivers/video/imx-ipu-v3/ipu-dp.c create mode 100644 drivers/video/imx-ipu-v3/ipu-prv.h create mode 100644 include/video/imx-ipu-v3.h
arch/arm/plat-mxc/include/mach/ipu-v3.h new file +49 -0
@@ -0,0 +1,49 @@ +/* +* Copyright (c) 2010 Sascha Hauer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* for more details. +*/ + +#ifndef __MACH_IPU_V3_H_ +#define __MACH_IPU_V3_H_ + +/* IPU specific extensions to struct fb_videomode flag field */ +#define FB_SYNC_OE_LOW_ACT (1 << 8) +#define FB_SYNC_CLK_LAT_FALL (1 << 9) +#define FB_SYNC_DATA_INVERT (1 << 10) +#define FB_SYNC_CLK_IDLE_EN (1 << 11) +#define FB_SYNC_SHARP_MODE (1 << 12) +#define FB_SYNC_SWAP_RGB (1 << 13) + +struct ipuv3_fb_platform_data { +const struct fb_videomode *modes; +int num_modes; +char *mode_str; +u32 interface_pix_fmt; + +#define IMX_IPU_FB_USE_MODEDB (1 << 0) +#define IMX_IPU_FB_USE_OVERLAY (1 << 1) +unsigned long flags; + +int ipu_channel_bg; +int ipu_channel_fg; +int dc_channel; +int dp_channel; +int display; +}; + +struct imx_ipuv3_platform_data { +int rev; +struct ipuv3_fb_platform_data *fb_head0_platform_data; +struct ipuv3_fb_platform_data *fb_head1_platform_data; +}; + +#endif /* __MACH_IPU_V3_H_ */
drivers/video/Kconfig +2 -0
@@ -26,6 +26,8 @@ source "drivers/gpu/drm/Kconfig" source "drivers/gpu/stub/Kconfig" +source "drivers/video/imx-ipu-v3/Kconfig" + config VGASTATE tristate default n
drivers/video/Makefile +1 -0
@@ -153,6 +153,7 @@ obj-$(CONFIG_FB_BFIN_T350MCQB) += bfin-t350mcqb-fb.o obj-$(CONFIG_FB_BFIN_7393) += bfin_adv7393fb.o obj-$(CONFIG_FB_MX3) += mx3fb.o obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o +obj-$(CONFIG_FB_IMX_IPU_V3) += imx-ipu-v3/ # the test framebuffer is last obj-$(CONFIG_FB_VIRTUAL) += vfb.o
drivers/video/imx-ipu-v3/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ + +config FB_IMX_IPU_V3 + tristate "Support the Image Processing Unit (IPU) found on the i.MX51" + depends on ARCH_MX51 + select MFD_SUPPORT + select MFD_CORE + help + Say yes here to support the IPU on i.MX51. This is used by the fb + driver and also by the i.MX51 camera support. +
drivers/video/imx-ipu-v3/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_FB_IMX_IPU_V3) += imx-ipu-v3.o + +imx-ipu-v3-objs := ipu-common.o ipu-dc.o ipu-di.o ipu-dp.o ipu-dmfc.o ipu-cpmem.o
drivers/video/imx-ipu-v3/ipu-common.c new file +666 -0
666 lines not on this page · raw message
drivers/video/imx-ipu-v3/ipu-cpmem.c new file +612 -0
612 lines not on this page · raw message
drivers/video/imx-ipu-v3/ipu-dc.c new file +364 -0
364 lines not on this page · raw message
drivers/video/imx-ipu-v3/ipu-di.c new file +550 -0
550 lines not on this page · raw message
drivers/video/imx-ipu-v3/ipu-dmfc.c new file +355 -0
355 lines not on this page · raw message
drivers/video/imx-ipu-v3/ipu-dp.c new file +476 -0
376 lines not on this page · raw message
drivers/video/imx-ipu-v3/ipu-prv.h new file +216 -0
216 lines not on this page · raw message
include/video/imx-ipu-v3.h new file +219 -0
219 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.2.3
Part of the diff is not shown here. View the raw message.
Re: [PATCH 3/8] Add a mfd IPUv3 driver
Hi Sascha,
I've had a brief look around the driver. It looks reasonable in general, but the division into subdrivers feels a bit ad-hoc. If all the components are built into a single module, I don't see the need for separating the data by functional units by file. It seems simple enough to turn this into a layered driver with multiple sub-devices each derived from a platform_device on its own.
Quoted 5 lines · Sascha Hauer
arch/arm/plat-mxc/include/mach/ipu-v3.h | 49 +++ drivers/video/Kconfig | 2 + drivers/video/Makefile | 1 + drivers/video/imx-ipu-v3/Kconfig | 10 + drivers/video/imx-ipu-v3/Makefile | 3 +
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c | 666 +++++++++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-cpmem.c | 612 ++++++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dc.c | 364 +++++++++++++++++ drivers/video/imx-ipu-v3/ipu-di.c | 550 +++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dmfc.c | 355 ++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dp.c | 476 ++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-prv.h | 216 ++++++++++ include/video/imx-ipu-v3.h | 219 ++++++++++
I wonder if this is something that would fit better in drivers/gpu instead of drivers/video. We recently discussed the benefits of KMS vs fb drivers, and I think it would be good to be prepared for making this a KMS driver in the long run, even if the immediate target has to be a simple frame buffer driver.
drivers/video/imx-ipu-v3/ipu-common.c line 43
Quoted 13 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +13
-0+#include "ipu-prv.h" + +static struct clk *ipu_clk; +static struct device *ipu_dev; + +static DEFINE_SPINLOCK (ipu_lock); +static DEFINE_MUTEX (ipu_channel_lock); +void __iomem *ipu_cm_reg; +void __iomem *ipu_idmac_reg; + +static int ipu_use_count; + +static struct ipu_channel channels[64 ];
Keeping these global limits you to just one ipu, and makes understanding the code a little harder. How about moving these variables into a struct ipu_data (or similar) that is referenced from the platform_device?
Quoted 1 line
+EXPORT_SYMBOL(ipu_idmac_put);
Why not EXPORT_SYMBOL_GPL?
Quoted 21 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +21
-0+static LIST_HEAD (ipu_irq_handlers); + +static void ipu_irq_update_irq_mask (void ) +{ +struct ipu_irq_handler *handler; +int i; + +DECLARE_IPU_IRQ_BITMAP (irqs); + +bitmap_zero (irqs,IPU_IRQ_COUNT ); + +list_for_each_entry (handler, &ipu_irq_handlers, list) +bitmap_or (irqs, irqs, handler->ipu_irqs,IPU_IRQ_COUNT ); + +for (i =0 ; i <BITS_TO_LONGS (IPU_IRQ_COUNT ); i++) +ipu_cm_write (irqs[i],IPU_INT_CTRL (i +1 )); +} + +int ipu_irq_add_handler (struct ipu_irq_handler *ipuirq) +{ +unsigned long flags;
drivers/video/imx-ipu-v3/ipu-common.c line 240
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+ +spin_lock_irqsave (&ipu_lock, flags); + +list_add_tail (&ipuirq->list, &ipu_irq_handlers); +ipu_irq_update_irq_mask (); + +spin_unlock_irqrestore (&ipu_lock, flags); +return 0 ; +} +EXPORT_SYMBOL (ipu_irq_add_handler);
The interrupt logic needs some comments. What are you trying to achieve here?
Quoted 18 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +18
-0+int ipu_wait_for_interrupt (int interrupt,int timeout_ms) +{ +struct ipu_irq_handler handler; +DECLARE_COMPLETION_ONSTACK (completion); +int ret; + +bitmap_zero (handler.ipu_irqs,IPU_IRQ_COUNT ); +bitmap_set (handler.ipu_irqs, interrupt,1 ); + +ipu_cm_write (1 << (interrupt %32 ),IPU_INT_STAT (interrupt /32 +1 )); + + handler.handler = ipu_completion_handler; + handler.context = &completion; +ipu_irq_add_handler (&handler); + + ret =wait_for_completion_timeout (&completion, +msecs_to_jiffies (timeout_ms)); +
drivers/video/imx-ipu-v3/ipu-common.c line 305
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+ipu_irq_remove_handler (&handler); + +if (ret >0 ) + ret =0 ; +else + ret = -ETIMEDOUT ; + +return ret; +} +EXPORT_SYMBOL (ipu_wait_for_interrupt);
If I understand this correctly, this is a very complicated way to implement something that could be done with a single wait_event_timeout() and wake_up_interruptible_all() from the irq handler.
Quoted 9 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +9
-0+static irqreturn_t ipu_irq_handler (int irq,void *desc) +{ +DECLARE_IPU_IRQ_BITMAP (status); +struct ipu_irq_handler *handler; +int i; + +for (i =0 ; i <BITS_TO_LONGS (IPU_IRQ_COUNT ); i++) { + status[i] =ipu_cm_read (IPU_INT_STAT (i +1 )); +ipu_cm_write (status[i],IPU_INT_STAT (i +1 ));
drivers/video/imx-ipu-v3/ipu-common.c line 325
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+ } + +list_for_each_entry (handler, &ipu_irq_handlers, list) { +DECLARE_IPU_IRQ_BITMAP (tmp); +if (bitmap_and (tmp, status, handler->ipu_irqs,IPU_IRQ_COUNT )) + handler->handler (tmp, handler->context); + } + +return IRQ_HANDLED ; +}
This needs to take spin_lock_irqsave before walking the ipu_irq_handlers list, in order to prevent another CPU from modifying the list while you are in the handler.
Quoted 7 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +7
-0+static int ipu_reset (void ) +{ +int timeout =10000 ; +u32 val; + +/* hard reset the IPU */ + val =readl (MX51_IO_ADDRESS (MX51_SRC_BASE_ADDR ));
drivers/video/imx-ipu-v3/ipu-common.c line 364
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+ val |=1 <<3 ; +writel (val,MX51_IO_ADDRESS (MX51_SRC_BASE_ADDR )); + +ipu_cm_write (0x807FFFFF ,IPU_MEM_RST ); + +while (ipu_cm_read (IPU_MEM_RST ) &0x80000000 ) { +if (!timeout--) +return -ETIME ; +udelay (100 ); + }
You have a timeout of over one second with udelay, which is not acceptable on many systems. AFAICT, the function can sleep, so you can replace udelay with msleep(1), and you should use a better logic to determine the end of the loop:
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
while (ipu_cm_read(IPU_MEM_RST) & 0x80000000) {
if (time_after(jiffies, timeout))
return -ETIME;
msleep(1);
}drivers/video/imx-ipu-v3/ipu-cpmem.c line 124
Quoted 11 lines
drivers/video/imx-ipu-v3/ipu-cpmem.c new file +11
-0+static u32 *ipu_cpmem_base; +static struct device *ipu_dev; + +struct ipu_ch_param_word { +u32 data[5 ]; +u32 res[3 ]; +}; + +struct ipu_ch_param { +struct ipu_ch_param_word word[2 ]; +};
Same comment as for the previous file
drivers/video/imx-ipu-v3/ipu-dc.c line 82
Quoted 11 lines
drivers/video/imx-ipu-v3/ipu-dc.c new file +11
-0+ +static void __iomem *ipu_dc_reg; +static void __iomem *ipu_dc_tmpl_reg; +static struct device *ipu_dev; + +struct ipu_dc { +unsigned int di;/* The display interface number assigned to this dc channel */ +unsigned int channel_offset; +}; + +static struct ipu_dc dc_channels[10 ];
And here again.
drivers/video/imx-ipu-v3/ipu-dc.c line 92
Quoted 9 lines
drivers/video/imx-ipu-v3/ipu-dc.c new file +9
-0+static void ipu_dc_link_event (int chan,int event,int addr,int priority) +{ +u32 reg; + + reg =__raw_readl (DC_RL_CH (chan, event)); + reg &= ~(0xFFFF << (16 * (event &0x1 ))); + reg |= ((addr <<8 ) | priority) << (16 * (event &0x1 )); +__raw_writel (reg,DC_RL_CH (chan, event)); +}
Better use readl/writel instead of __raw_readl/__raw_writel, throughout the code.
Quoted 7 lines
drivers/video/imx-ipu-v3/ipu-prv.h new file +7
-0+int ipu_di_init (struct platform_device *pdev,int id,unsigned long base, +u32 module,struct clk *ipu_clk); +void ipu_di_exit (struct platform_device *pdev,int id); + +int ipu_dmfc_init (struct platform_device *pdev,unsigned long base, +struct clk *ipu_clk); +void ipu_dmfc_exit (struct platform_device *pdev);
drivers/video/imx-ipu-v3/ipu-prv.h line 211
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-prv.h new file +10
-0+ +int ipu_dp_init (struct platform_device *pdev,unsigned long base); +void ipu_dp_exit (struct platform_device *pdev); + +int ipu_dc_init (struct platform_device *pdev,unsigned long base, +unsigned long template_base); +void ipu_dc_exit (struct platform_device *pdev); + +int ipu_cpmem_init (struct platform_device *pdev,unsigned long base); +void ipu_cpmem_exit (struct platform_device *pdev);
If you make the main driver an mfd device, the sub-drivers could become real platform drivers, which can structure the layering in a more modular way.
E.g. instead of a single module init function, each subdriver can be a module by itself and look at the resources associated with the platform device it matches.
Arnd
Sascha Hauer
maintainerRe: [PATCH 3/8] Add a mfd IPUv3 driver
Hi Arnd,
Quoted 8 lines · Arnd Bergmann
Hi Sascha,
I've had a brief look around the driver. It looks reasonable in general, but the division into subdrivers feels a bit ad-hoc. If all the components are built into a single module, I don't see the need for separating the data by functional units by file. It seems simple enough to turn this into a layered driver with multiple sub-devices each derived from a
platform_deviceon its own.
Ok, will do.
Quoted 16 lines · Sascha Hauer
Quoted 5 lines
arch/arm/plat-mxc/include/mach/ipu-v3.h | 49 +++ drivers/video/Kconfig | 2 + drivers/video/Makefile | 1 + drivers/video/imx-ipu-v3/Kconfig | 10 + drivers/video/imx-ipu-v3/Makefile | 3 +Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c | 666 +++++++++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-cpmem.c | 612 ++++++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dc.c | 364 +++++++++++++++++ drivers/video/imx-ipu-v3/ipu-di.c | 550 +++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dmfc.c | 355 ++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dp.c | 476 ++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-prv.h | 216 ++++++++++ include/video/imx-ipu-v3.h | 219 ++++++++++
Quoted 5 lines
I wonder if this is something that would fit better in
drivers/gpuinstead ofdrivers/video. We recently discussed the benefits of KMS vs fb drivers, and I think it would be good to be prepared for making this a KMS driver in the long run, even if the immediate target has to be a simple frame buffer driver.
When turning this into a kms driver moving the source code will be the smallest problem I guess.
I have no preference where to put this code. First it was in drivers/mfd/ and it felt wrong because there seems to be too much code in it a mfd maintainer shouldn't be bothered with. drivers/video/ seems to be wrong because this code will probably support cameras which belong to drivers/media/video/. So if there's consensus on drivers/gpu/ I will happily put it there.
What directory do you suggest? drivers/gpu/ or some subdirectory (drm/vga)?
Quoted 49 lines
Quoted 4 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +3
-0+#include "ipu-prv.h" + +static struct clk *ipu_clk;drivers/video/imx-ipu-v3/ipu-common.c line 43
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+static struct device *ipu_dev; + +static DEFINE_SPINLOCK (ipu_lock); +static DEFINE_MUTEX (ipu_channel_lock); +void __iomem *ipu_cm_reg; +void __iomem *ipu_idmac_reg; + +static int ipu_use_count; + +static struct ipu_channel channels[64 ];Keeping these global limits you to just one ipu, and makes understanding the code a little harder. How about moving these variables into a struct
ipu_data(or similar) that is referenced from theplatform_device?Quoted 1 line
+EXPORT_SYMBOL(ipu_idmac_put);
Why not
EXPORT_SYMBOL_GPL?Quoted 25 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +25
-0+static LIST_HEAD (ipu_irq_handlers); + +static void ipu_irq_update_irq_mask (void ) +{ +struct ipu_irq_handler *handler; +int i; + +DECLARE_IPU_IRQ_BITMAP (irqs); + +bitmap_zero (irqs,IPU_IRQ_COUNT ); + +list_for_each_entry (handler, &ipu_irq_handlers, list) +bitmap_or (irqs, irqs, handler->ipu_irqs,IPU_IRQ_COUNT ); + +for (i =0 ; i <BITS_TO_LONGS (IPU_IRQ_COUNT ); i++) +ipu_cm_write (irqs[i],IPU_INT_CTRL (i +1 )); +} + +int ipu_irq_add_handler (struct ipu_irq_handler *ipuirq) +{ +unsigned long flags; + +spin_lock_irqsave (&ipu_lock, flags); + +list_add_tail (&ipuirq->list, &ipu_irq_handlers);
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c line 240
Quoted 6 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +6
-0+ipu_irq_update_irq_mask (); + +spin_unlock_irqrestore (&ipu_lock, flags); +return 0 ; +} +EXPORT_SYMBOL (ipu_irq_add_handler);The interrupt logic needs some comments. What are you trying to achieve here?
The IPU has 463 status bits which can trigger an interrupt. Most of them are associated to channels, some are general interrupts. My problem is that I don't know how the interrupts will be used by drivers later. Most drivers will probably use only one interrupt but others will be interested in a larger group of interrupts. So I decided to use a bitmap allowing each driver to register for groups of event it is interested in.
Quoted 25 lines
Quoted 25 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +24
-0+int ipu_wait_for_interrupt (int interrupt,int timeout_ms) +{ +struct ipu_irq_handler handler; +DECLARE_COMPLETION_ONSTACK (completion); +int ret; + +bitmap_zero (handler.ipu_irqs,IPU_IRQ_COUNT ); +bitmap_set (handler.ipu_irqs, interrupt,1 ); + +ipu_cm_write (1 << (interrupt %32 ),IPU_INT_STAT (interrupt /32 +1 )); + + handler.handler = ipu_completion_handler; + handler.context = &completion; +ipu_irq_add_handler (&handler); + + ret =wait_for_completion_timeout (&completion, +msecs_to_jiffies (timeout_ms)); + +ipu_irq_remove_handler (&handler); + +if (ret >0 ) + ret =0 ; +else + ret = -ETIMEDOUT ;
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c line 305
Quoted 4 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +4
-0+ +return ret; +} +EXPORT_SYMBOL (ipu_wait_for_interrupt);If I understand this correctly, this is a very complicated way to implement something that could be done with a single
wait_event_timeout()andwake_up_interruptible_all()from the irq handler.
I added this as a convenience function for a common usecase: wait until a frame is done or wait until some FIFOs are drained.
I think I can switch this into wait_event_timeout(), but lets first see if my bitmap-irq implementation survives the review.
Quoted 16 lines
Quoted 16 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +15
-0+static irqreturn_t ipu_irq_handler (int irq,void *desc) +{ +DECLARE_IPU_IRQ_BITMAP (status); +struct ipu_irq_handler *handler; +int i; + +for (i =0 ; i <BITS_TO_LONGS (IPU_IRQ_COUNT ); i++) { + status[i] =ipu_cm_read (IPU_INT_STAT (i +1 )); +ipu_cm_write (status[i],IPU_INT_STAT (i +1 )); + } + +list_for_each_entry (handler, &ipu_irq_handlers, list) { +DECLARE_IPU_IRQ_BITMAP (tmp); +if (bitmap_and (tmp, status, handler->ipu_irqs,IPU_IRQ_COUNT )) + handler->handler (tmp, handler->context);
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c line 325
Quoted 4 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +4
-0+ } + +return IRQ_HANDLED ; +}This needs to take
spin_lock_irqsavebefore walking theipu_irq_handlerslist, in order to prevent another CPU from modifying the list while you are in the handler.
ok.
Quoted 25 lines
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +7
-0+static int ipu_reset (void ) +{ +int timeout =10000 ; +u32 val; + +/* hard reset the IPU */ + val =readl (MX51_IO_ADDRESS (MX51_SRC_BASE_ADDR ));drivers/video/imx-ipu-v3/ipu-common.c line 364
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+ val |=1 <<3 ; +writel (val,MX51_IO_ADDRESS (MX51_SRC_BASE_ADDR )); + +ipu_cm_write (0x807FFFFF ,IPU_MEM_RST ); + +while (ipu_cm_read (IPU_MEM_RST ) &0x80000000 ) { +if (!timeout--) +return -ETIME ; +udelay (100 ); + }You have a timeout of over one second with udelay, which is not acceptable on many systems. AFAICT, the function can sleep, so you can replace udelay with msleep(1), and you should use a better logic to determine the end of the loop:
Quoted 7 lines
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
while (ipu_cm_read(IPU_MEM_RST) & 0x80000000) {
if (time_after(jiffies, timeout))
return -ETIME;
msleep(1);
}ok.
Quoted 57 lines
drivers/video/imx-ipu-v3/ipu-cpmem.c line 124
Quoted 12 lines
drivers/video/imx-ipu-v3/ipu-cpmem.c new file +11
-0+static u32 *ipu_cpmem_base; +static struct device *ipu_dev; + +struct ipu_ch_param_word { +u32 data[5 ]; +u32 res[3 ]; +}; + +struct ipu_ch_param { +struct ipu_ch_param_word word[2 ]; +};Same comment as for the previous file
drivers/video/imx-ipu-v3/ipu-dc.c line 82
Quoted 11 lines
drivers/video/imx-ipu-v3/ipu-dc.c new file +11
-0+ +static void __iomem *ipu_dc_reg; +static void __iomem *ipu_dc_tmpl_reg; +static struct device *ipu_dev; + +struct ipu_dc { +unsigned int di;/* The display interface number assigned to this dc channel */ +unsigned int channel_offset; +}; + +static struct ipu_dc dc_channels[10 ];And here again.
drivers/video/imx-ipu-v3/ipu-dc.c line 92
Quoted 9 lines
drivers/video/imx-ipu-v3/ipu-dc.c new file +9
-0+static void ipu_dc_link_event (int chan,int event,int addr,int priority) +{ +u32 reg; + + reg =__raw_readl (DC_RL_CH (chan, event)); + reg &= ~(0xFFFF << (16 * (event &0x1 ))); + reg |= ((addr <<8 ) | priority) << (16 * (event &0x1 )); +__raw_writel (reg,DC_RL_CH (chan, event)); +}Better use readl/writel instead of __raw_readl/__raw_writel, throughout the code.
Quoted 16 lines
drivers/video/imx-ipu-v3/ipu-prv.h new file +16
-0+int ipu_di_init (struct platform_device *pdev,int id,unsigned long base, +u32 module,struct clk *ipu_clk); +void ipu_di_exit (struct platform_device *pdev,int id); + +int ipu_dmfc_init (struct platform_device *pdev,unsigned long base, +struct clk *ipu_clk); +void ipu_dmfc_exit (struct platform_device *pdev); + +int ipu_dp_init (struct platform_device *pdev,unsigned long base); +void ipu_dp_exit (struct platform_device *pdev); + +int ipu_dc_init (struct platform_device *pdev,unsigned long base, +unsigned long template_base); +void ipu_dc_exit (struct platform_device *pdev); + +int ipu_cpmem_init (struct platform_device *pdev,unsigned long base);
Quoted 8 lines
Quoted 1 line
+void
ipu_cpmem_exit(struct platform_device *pdev);If you make the main driver an mfd device, the sub-drivers could become real platform drivers, which can structure the layering in a more modular way.
E.g. instead of a single module init function, each subdriver can be a module by itself and look at the resources associated with the platform device it matches.
ok.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 3/8] Add a mfd IPUv3 driver
Quoted 10 lines · Sascha Hauer
When turning this into a kms driver moving the source code will be the smallest problem I guess.
I have no preference where to put this code. First it was indrivers/mfd/and it felt wrong because there seems to be too much code in it a mfd maintainer shouldn't be bothered with.drivers/video/seems to be wrong because this code will probably support cameras which belong todrivers/media/video/. So if there's consensus ondrivers/gpu/I will happily put it there.
What directory do you suggest?drivers/gpu/or some subdirectory (drm/vga)?
I'd suggest a subdirectory of drivers/gpu/, e.g. drivers/gpu/embedded/imx-ipu/. Alan is currently adding a driver for the Intel GMA500, and there are others (TI, ST-Ericsson, ...) that fit in a similar category of complex graphics subsystems without an actual GPU core. I think they should all go to the same place.
Quoted 9 lines
Quoted 1 line
The interrupt logic needs some comments. What are you trying to achieve here?
The IPU has 463 status bits which can trigger an interrupt. Most of them are associated to channels, some are general interrupts. My problem is that I don't know how the interrupts will be used by drivers later. Most drivers will probably use only one interrupt but others will be interested in a larger group of interrupts. So I decided to use a bitmap allowing each driver to register for groups of event it is interested in.
Ok, I see. So you essentially have a huge nested interrupt controller and try to be clever about the possible use cases, which may be the right choice, but apparently you don't know that yet because not all the drivers have been written at this point.
Taking one step back from this, have you considered making this a regular interrupt controller? That would make the client drivers more standard -- you could define the interrupt numbers as resources of a platform device or in the device tree, for instance. The cost might be more complex code, e.g. when a device requires many interrupts, but I think it will be at least as efficient at run-time, and less surprising for readers and authors of client drivers.
Arnd
Sascha Hauer
maintainerRe: [PATCH 3/8] Add a mfd IPUv3 driver
Quoted 35 lines · Arnd Bergmann
Quoted 10 lines · Sascha Hauer
When turning this into a kms driver moving the source code will be the smallest problem I guess.
I have no preference where to put this code. First it was indrivers/mfd/and it felt wrong because there seems to be too much code in it a mfd maintainer shouldn't be bothered with.drivers/video/seems to be wrong because this code will probably support cameras which belong todrivers/media/video/. So if there's consensus ondrivers/gpu/I will happily put it there.
What directory do you suggest?drivers/gpu/or some subdirectory (drm/vga)?I'd suggest a subdirectory of
drivers/gpu/, e.g.drivers/gpu/embedded/imx-ipu/. Alan is currently adding a driver for the Intel GMA500, and there are others (TI, ST-Ericsson, ...) that fit in a similar category of complex graphics subsystems without an actual GPU core. I think they should all go to the same place.Quoted 9 lines
Quoted 1 line
The interrupt logic needs some comments. What are you trying to achieve here?
The IPU has 463 status bits which can trigger an interrupt. Most of them are associated to channels, some are general interrupts. My problem is that I don't know how the interrupts will be used by drivers later. Most drivers will probably use only one interrupt but others will be interested in a larger group of interrupts. So I decided to use a bitmap allowing each driver to register for groups of event it is interested in.
Ok, I see. So you essentially have a huge nested interrupt controller and try to be clever about the possible use cases, which may be the right choice, but apparently you don't know that yet because not all the drivers have been written at this point.
Quoted 8 lines
Taking one step back from this, have you considered making this a regular interrupt controller? That would make the client drivers more standard -- you could define the interrupt numbers as resources of a platform device or in the device tree, for instance. The cost might be more complex code, e.g. when a device requires many interrupts, but I think it will be at least as efficient at run-time, and less surprising for readers and authors of client drivers.
I thought about this, but hesitated to increase NR_IRQS by 463. Do you think we should do this instead?
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 3/8] Add a mfd IPUv3 driver
Quoted 11 lines · Sascha Hauer
Quoted 8 lines
Taking one step back from this, have you considered making this a regular interrupt controller? That would make the client drivers more standard -- you could define the interrupt numbers as resources of a platform device or in the device tree, for instance. The cost might be more complex code, e.g. when a device requires many interrupts, but I think it will be at least as efficient at run-time, and less surprising for readers and authors of client drivers.
I thought about this, but hesitated to increase
NR_IRQSby 463. Do you think we should do this instead?
I think there is a plan to virtualize the interrupt numbers on ARM, and in that case NR_IRQS becomes rather meaningless. I don't know exactly how far that effort has come.
Arnd
Re: [PATCH 3/8] Add a mfd IPUv3 driver
Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · Sascha Hauer
Quoted 8 lines
Taking one step back from this, have you considered making this a regular interrupt controller? That would make the client drivers more standard -- you could define the interrupt numbers as resources of a platform device or in the device tree, for instance. The cost might be more complex code, e.g. when a device requires many interrupts, but I think it will be at least as efficient at run-time, and less surprising for readers and authors of client drivers.
Quoted 6 lines
Quoted 2 lines
I thought about this, but hesitated to increase
NR_IRQSby 463. Do you think we should do this instead?I think there is a plan to virtualize the interrupt numbers on ARM, and in that case
NR_IRQSbecomes rather meaningless. I don't know exactly how far that effort has come.
Also sparse irqs allows us now to allocate beyond NR_IRQS. With sparse irqs NR_IRQS is pretty meaningless and just gives us an indicator how large the irq space might become, but we allow up to 8k dynamically allocated irqs beyond NR_IRQS, so this should be sufficient for your problem.
Thanks,
tglx
Re: [PATCH 3/8] Add a mfd IPUv3 driver
In reply to Sascha HauerQuoted 25 lines · Sascha Hauer
drivers/video/imx-ipu-v3/ipu-common.c new file +12
-0+ +static int ipu_use_count; + +static struct ipu_channel channels[64 ]; + +struct ipu_channel *ipu_idmac_get (unsigned num) +{ +struct ipu_channel *channel; + +dev_dbg (ipu_dev,"%s %d\n" , __func__, num); + +if (num >63 )=
ARRAY_SIZE(channels)or a sensible define pleasedrivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+return ERR_PTR (-ENODEV ); + +mutex_lock (&ipu_channel_lock); + + channel = &channels[num]; + +if (channel->busy) { + channel =ERR_PTR (-EBUSY ); + goto out; + }
drivers/video/imx-ipu-v3/ipu-common.c line 71
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+ + channel->busy =1 ; + channel->num = num; + +out: +mutex_unlock (&ipu_channel_lock); + +return channel; +} +EXPORT_SYMBOL (ipu_idmac_get);
EXPORT_SYMBOL_GPL all over the place
drivers/video/imx-ipu-v3/ipu-common.c line 75
Quoted 3 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +3
-0+void ipu_idmac_put (struct ipu_channel *channel) +{ +dev_dbg (ipu_dev,"%s %d\n" , __func__, channel->num);
Do we really need this debug stuff in all these functions ?
drivers/video/imx-ipu-v3/ipu-common.c line 84
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +8
-0+mutex_lock (&ipu_channel_lock); + + channel->busy =0 ; + +mutex_unlock (&ipu_channel_lock); +} +EXPORT_SYMBOL (ipu_idmac_put); +
Also exported functions want a proper kerneldoc comment.
drivers/video/imx-ipu-v3/ipu-common.c line 217
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +9
-0+void ipu_idmac_set_double_buffer(struct ipu_channel *channel, bool doublebuffer) +static LIST_HEAD(ipu_irq_handlers); + +static void ipu_irq_update_irq_mask (void ) +{ +struct ipu_irq_handler *handler; +int i; + +DECLARE_IPU_IRQ_BITMAP (irqs);
Why the hell do we need this? It's a bog standard bitmap, right ?
Quoted 32 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +31
-0+bitmap_zero (irqs,IPU_IRQ_COUNT ); + +list_for_each_entry (handler, &ipu_irq_handlers, list) +bitmap_or (irqs, irqs, handler->ipu_irqs,IPU_IRQ_COUNT ); + +for (i =0 ; i <BITS_TO_LONGS (IPU_IRQ_COUNT ); i++) +ipu_cm_write (irqs[i],IPU_INT_CTRL (i +1 )); +} +static void ipu_completion_handler (unsigned long *bitmask,void *context) +{ +struct completion *completion = context; + +complete (completion); +} + +int ipu_wait_for_interrupt (int interrupt,int timeout_ms) +{ +struct ipu_irq_handler handler; +DECLARE_COMPLETION_ONSTACK (completion); +int ret; + +bitmap_zero (handler.ipu_irqs,IPU_IRQ_COUNT ); +bitmap_set (handler.ipu_irqs, interrupt,1 ); + +ipu_cm_write (1 << (interrupt %32 ),IPU_INT_STAT (interrupt /32 +1 )); + + handler.handler = ipu_completion_handler; + handler.context = &completion; +ipu_irq_add_handler (&handler); + + ret = wait_for_completion_timeout(&completion,
drivers/video/imx-ipu-v3/ipu-common.c line 303
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+ msecs_to_jiffies(timeout_ms)); + +ipu_irq_remove_handler (&handler); + +if (ret >0 ) + ret =0 ; +else + ret = -ETIMEDOUT ; + +return ret;
return ret > 0 ? 0 : -ETIMEDOUT;
perhaps ?
Quoted 9 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +9
-0+} +EXPORT_SYMBOL (ipu_wait_for_interrupt); + +static irqreturn_t ipu_irq_handler (int irq,void *desc) +{ +DECLARE_IPU_IRQ_BITMAP (status); +struct ipu_irq_handler *handler; +int i; +
drivers/video/imx-ipu-v3/ipu-common.c line 322
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+for (i =0 ; i <BITS_TO_LONGS (IPU_IRQ_COUNT ); i++) { + status[i] =ipu_cm_read (IPU_INT_STAT (i +1 )); +ipu_cm_write (status[i],IPU_INT_STAT (i +1 )); + } + +list_for_each_entry (handler, &ipu_irq_handlers, list) { +DECLARE_IPU_IRQ_BITMAP (tmp); +if (bitmap_and (tmp, status, handler->ipu_irqs,IPU_IRQ_COUNT )) + handler->handler (tmp, handler->context); + }
And what protects the list walk? Just the fact that this is a UP machine?
drivers/video/imx-ipu-v3/ipu-common.c line 453
Quoted 11 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +11
-0+void ipu_put (void ) +{ +mutex_lock (&ipu_channel_lock); + + ipu_use_count--; + +if (ipu_use_count ==0 ) +clk_disable (ipu_clk); + +if (ipu_use_count <0 ) { +dev_err (ipu_dev,"ipu use count < 0\n" );
This wants to be a WARN_ON(ipu_use_count < 0) so you get some information which code is calling this.
Quoted 42 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +41
-0+ ipu_use_count =0 ; + } + +mutex_unlock (&ipu_channel_lock); +} +static int __devinit ipu_probe (struct platform_device *pdev) +{ +struct resource *res; +unsigned long ipu_base; +int ret, irq1, irq2; + +/* There can be only one */ +if (ipu_dev) +return -EBUSY ; + +spin_lock_init (&ipu_lock); + + ipu_dev = &pdev->dev; + + irq1 =platform_get_irq (pdev,0 ); + irq2 =platform_get_irq (pdev,1 ); + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + +if (!res || irq1 <0 || irq2 <0 ) +return -ENODEV ; + + ipu_base = res->start; + + ipu_cm_reg =ioremap (ipu_base +IPU_CM_REG_BASE ,PAGE_SIZE ); +if (!ipu_cm_reg) { + ret = -ENOMEM ; + goto failed_ioremap1; + } + + ipu_idmac_reg =ioremap (ipu_base +IPU_IDMAC_REG_BASE ,PAGE_SIZE ); +if (!ipu_idmac_reg) { + ret = -ENOMEM ; + goto failed_ioremap2; + } + + ipu_clk =clk_get (&pdev->dev,"ipu" );
drivers/video/imx-ipu-v3/ipu-common.c line 562
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+if (IS_ERR (ipu_clk)) { + ret =PTR_ERR (ipu_clk); +dev_err (&pdev->dev,"clk_get failed with %d" , ret); + goto failed_clk_get; + } + +ipu_get (); + + ret =request_irq (irq1, ipu_irq_handler,IRQF_DISABLED , pdev->name, + &pdev->dev);
s/IRQF_DISABLED/0/ We run all handlers with interrupts disabled nowadays.
drivers/video/imx-ipu-v3/ipu-common.c line 582
Quoted 6 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +6
-0+ ret =ipu_submodules_init (pdev, ipu_base, ipu_clk); +if (ret) + goto failed_submodules_init; + +/* Set sync refresh channels as high priority */ +ipu_idmac_write (0x18800000 ,IDMAC_CHA_PRI (0 ));
Hmm, this random prio setting here is odd.
drivers/video/imx-ipu-v3/ipu-common.c line 588
Quoted 5 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +5
-0+ ret =ipu_add_client_devices (pdev); +if (ret) { +dev_err (&pdev->dev,"adding client devices failed with %d\n" , ret); + goto failed_add_clients; + }
White space damage.
drivers/video/imx-ipu-v3/ipu-dc.c line 267
Quoted 12 lines
drivers/video/imx-ipu-v3/ipu-dc.c new file +12
-0+ ret =ipu_wait_for_interrupt (irq,50 ); +if (ret) +return ; + +/* Wait for DC triple buffer to empty */ +if (dc_channels[dc_chan].di ==0 ) +while ((__raw_readl (DC_STAT ) &0x00000002 ) + !=0x00000002 ) { +msleep (2 ); + timeout -=2 ; +if (timeout <=0 ) +break ;
So we poll stuff which is updated from some other function ?
drivers/video/imx-ipu-v3/ipu-dc.c line 275
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-dc.c new file +8
-0+ } +else if (dc_channels[dc_chan].di ==1 ) +while ((__raw_readl (DC_STAT ) &0x00000020 ) + !=0x00000020 ) { +msleep (2 ); + timeout -=2 ; +if (timeout <=0 ) +break ;
Ditto
Review
Quoted 1 line
(quoted diff) +1
-0+ }
Thanks,
tglx
Sascha Hauer
maintainerRe: [PATCH 3/8] Add a mfd IPUv3 driver
Quoted 39 lines · Thomas Gleixner
Quoted 25 lines · Sascha Hauer
drivers/video/imx-ipu-v3/ipu-common.c new file +12
-0+ +static int ipu_use_count; + +static struct ipu_channel channels[64 ]; + +struct ipu_channel *ipu_idmac_get (unsigned num) +{ +struct ipu_channel *channel; + +dev_dbg (ipu_dev,"%s %d\n" , __func__, num); + +if (num >63 )=
ARRAY_SIZE(channels)or a sensible define pleasedrivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+return ERR_PTR (-ENODEV ); + +mutex_lock (&ipu_channel_lock); + + channel = &channels[num]; + +if (channel->busy) { + channel =ERR_PTR (-EBUSY ); + goto out; + }drivers/video/imx-ipu-v3/ipu-common.c line 71
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+ + channel->busy =1 ; + channel->num = num; + +out: +mutex_unlock (&ipu_channel_lock); + +return channel; +} +EXPORT_SYMBOL (ipu_idmac_get);
EXPORT_SYMBOL_GPLall over the place
Quoted 5 lines
drivers/video/imx-ipu-v3/ipu-common.c line 75
Quoted 3 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +3
-0+void ipu_idmac_put (struct ipu_channel *channel) +{ +dev_dbg (ipu_dev,"%s %d\n" , __func__, channel->num);Do we really need this debug stuff in all these functions ?
Reading this comment I expected tons of dev_dbg in the driver. The one you mentioned above (plus the corresponding one in ipu_idmac_get) are indeed not particularly useful, but do you think there is still too much debug code left?
Quoted 14 lines
drivers/video/imx-ipu-v3/ipu-common.c line 84
Quoted 9 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +8
-0+mutex_lock (&ipu_channel_lock); + + channel->busy =0 ; + +mutex_unlock (&ipu_channel_lock); +} +EXPORT_SYMBOL (ipu_idmac_put); +Also exported functions want a proper kerneldoc comment.
Quoted 1 line
+void
ipu_idmac_set_double_buffer(struct ipu_channel *channel, bool doublebuffer)
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c line 217
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +8
-0+static LIST_HEAD (ipu_irq_handlers); + +static void ipu_irq_update_irq_mask (void ) +{ +struct ipu_irq_handler *handler; +int i; + +DECLARE_IPU_IRQ_BITMAP (irqs);Why the hell do we need this? It's a bog standard bitmap, right ?
It's defined as:
#define DECLARE_IPU_IRQ_BITMAP(name) DECLARE_BITMAP(name, IPU_IRQ_COUNT)
So yes, it's a standard bitmask. It can be used in client drivers aswell. Where's the problem of adding a define for this so that client drivers do not have to care about the size of the bitmap?
Quoted 46 lines
Quoted 33 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +31
-0+bitmap_zero (irqs,IPU_IRQ_COUNT ); + +list_for_each_entry (handler, &ipu_irq_handlers, list) +bitmap_or (irqs, irqs, handler->ipu_irqs,IPU_IRQ_COUNT ); + +for (i =0 ; i <BITS_TO_LONGS (IPU_IRQ_COUNT ); i++) +ipu_cm_write (irqs[i],IPU_INT_CTRL (i +1 )); +} +static void ipu_completion_handler (unsigned long *bitmask,void *context) +{ +struct completion *completion = context; + +complete (completion); +} + +int ipu_wait_for_interrupt (int interrupt,int timeout_ms) +{ +struct ipu_irq_handler handler; +DECLARE_COMPLETION_ONSTACK (completion); +int ret; + +bitmap_zero (handler.ipu_irqs,IPU_IRQ_COUNT ); +bitmap_set (handler.ipu_irqs, interrupt,1 ); + +ipu_cm_write (1 << (interrupt %32 ),IPU_INT_STAT (interrupt /32 +1 )); + + handler.handler = ipu_completion_handler; + handler.context = &completion; +ipu_irq_add_handler (&handler); + + ret = wait_for_completion_timeout(&completion,drivers/video/imx-ipu-v3/ipu-common.c line 303
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +10
-0+ msecs_to_jiffies(timeout_ms)); + +ipu_irq_remove_handler (&handler); + +if (ret >0 ) + ret =0 ; +else + ret = -ETIMEDOUT ; + +return ret;return ret > 0 ? 0 :
-ETIMEDOUT;
Quoted 1 line
perhaps ?
ok.
Quoted 16 lines
Quoted 16 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +14
-0+} +EXPORT_SYMBOL (ipu_wait_for_interrupt); + +static irqreturn_t ipu_irq_handler (int irq,void *desc) +{ +DECLARE_IPU_IRQ_BITMAP (status); +struct ipu_irq_handler *handler; +int i; + +for (i =0 ; i <BITS_TO_LONGS (IPU_IRQ_COUNT ); i++) { + status[i] =ipu_cm_read (IPU_INT_STAT (i +1 )); +ipu_cm_write (status[i],IPU_INT_STAT (i +1 )); + } +
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c line 322
Quoted 5 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +5
-0+list_for_each_entry (handler, &ipu_irq_handlers, list) { +DECLARE_IPU_IRQ_BITMAP (tmp); +if (bitmap_and (tmp, status, handler->ipu_irqs,IPU_IRQ_COUNT )) + handler->handler (tmp, handler->context); + }And what protects the list walk? Just the fact that this is a UP machine?
Will fix.
Quoted 15 lines
drivers/video/imx-ipu-v3/ipu-common.c line 453
Quoted 12 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +11
-0+void ipu_put (void ) +{ +mutex_lock (&ipu_channel_lock); + + ipu_use_count--; + +if (ipu_use_count ==0 ) +clk_disable (ipu_clk); + +if (ipu_use_count <0 ) { +dev_err (ipu_dev,"ipu use count < 0\n" );This wants to be a
WARN_ON(ipu_use_count < 0)so you get some information which code is calling this.
yes
Quoted 48 lines
Quoted 48 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +46
-0+ ipu_use_count =0 ; + } + +mutex_unlock (&ipu_channel_lock); +} +static int __devinit ipu_probe (struct platform_device *pdev) +{ +struct resource *res; +unsigned long ipu_base; +int ret, irq1, irq2; + +/* There can be only one */ +if (ipu_dev) +return -EBUSY ; + +spin_lock_init (&ipu_lock); + + ipu_dev = &pdev->dev; + + irq1 =platform_get_irq (pdev,0 ); + irq2 =platform_get_irq (pdev,1 ); + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + +if (!res || irq1 <0 || irq2 <0 ) +return -ENODEV ; + + ipu_base = res->start; + + ipu_cm_reg =ioremap (ipu_base +IPU_CM_REG_BASE ,PAGE_SIZE ); +if (!ipu_cm_reg) { + ret = -ENOMEM ; + goto failed_ioremap1; + } + + ipu_idmac_reg =ioremap (ipu_base +IPU_IDMAC_REG_BASE ,PAGE_SIZE ); +if (!ipu_idmac_reg) { + ret = -ENOMEM ; + goto failed_ioremap2; + } + + ipu_clk =clk_get (&pdev->dev,"ipu" ); +if (IS_ERR (ipu_clk)) { + ret =PTR_ERR (ipu_clk); +dev_err (&pdev->dev,"clk_get failed with %d" , ret); + goto failed_clk_get; + }
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c line 562
Quoted 5 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +5
-0+ +ipu_get (); + + ret =request_irq (irq1, ipu_irq_handler,IRQF_DISABLED , pdev->name, + &pdev->dev);s/IRQF_DISABLED/0/ We run all handlers with interrupts disabled nowadays.
ok.
Quoted 9 lines
drivers/video/imx-ipu-v3/ipu-common.c line 582
Quoted 7 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +6
-0+ ret =ipu_submodules_init (pdev, ipu_base, ipu_clk); +if (ret) + goto failed_submodules_init; + +/* Set sync refresh channels as high priority */ +ipu_idmac_write (0x18800000 ,IDMAC_CHA_PRI (0 ));Hmm, this random prio setting here is odd.
This is 1:1 from the Freescale Kernel and I never thought about it. We can remove it and see what happens. Maybe then some day we'll learn *why* this is done.
Quoted 9 lines
drivers/video/imx-ipu-v3/ipu-common.c line 588
Quoted 6 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +5
-0+ ret =ipu_add_client_devices (pdev); +if (ret) { +dev_err (&pdev->dev,"adding client devices failed with %d\n" , ret); + goto failed_add_clients; + }White space damage.
Quoted 14 lines
drivers/video/imx-ipu-v3/ipu-dc.c line 267
Quoted 12 lines
drivers/video/imx-ipu-v3/ipu-dc.c new file +12
-0+ ret =ipu_wait_for_interrupt (irq,50 ); +if (ret) +return ; + +/* Wait for DC triple buffer to empty */ +if (dc_channels[dc_chan].di ==0 ) +while ((__raw_readl (DC_STAT ) &0x00000002 ) + !=0x00000002 ) { +msleep (2 ); + timeout -=2 ; +if (timeout <=0 ) +break ;So we poll stuff which is updated from some other function ?
We poll the DC_STAT register here which is updated from the hardware.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 3/8] Add a mfd IPUv3 driver
Quoted 11 lines · Sascha Hauer
Quoted 5 lines · Thomas Gleixner
drivers/video/imx-ipu-v3/ipu-common.c line 75
Quoted 3 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +3
-0+void ipu_idmac_put (struct ipu_channel *channel) +{ +dev_dbg (ipu_dev,"%s %d\n" , __func__, channel->num);Do we really need this debug stuff in all these functions ?
Reading this comment I expected tons of
dev_dbgin the driver. The one you mentioned above (plus the corresponding one inipu_idmac_get) are indeed not particularly useful, but do you think there is still too much debug code left?
Well, I don't see a point in having useless debug stuff around.
Quoted 11 lines
Quoted 3 lines
drivers/video/imx-ipu-v3/ipu-common.c line 217
Quoted 1 line
drivers/video/imx-ipu-v3/ipu-common.c new file +1
-0+DECLARE_IPU_IRQ_BITMAP (irqs);Why the hell do we need this? It's a bog standard bitmap, right ?
It's defined as:
#define
DECLARE_IPU_IRQ_BITMAP(name)DECLARE_BITMAP(name, IPU_IRQ_COUNT)So yes, it's a standard bitmask. It can be used in client drivers aswell. Where's the problem of adding a define for this so that client drivers do not have to care about the size of the bitmap?
That's nonsense. You have to know about the size of the bitmap for any operation on it. Or are you going to provide wrappers around bitmap_zero() and all other possible bitmap_* functions as well?
Quoted 11 lines
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-common.c line 582
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +7
-0+bitmap_zero (irqs,IPU_IRQ_COUNT ); + ret =ipu_submodules_init (pdev, ipu_base, ipu_clk); +if (ret) + goto failed_submodules_init; + +/* Set sync refresh channels as high priority */ +ipu_idmac_write (0x18800000 ,IDMAC_CHA_PRI (0 ));Hmm, this random prio setting here is odd.
Quoted 3 lines
This is 1:1 from the Freescale Kernel and I never thought about it. We can remove it and see what happens. Maybe then some day we'll learn *why* this is done.
Well, the point is to move that to the init function which deals with IDMAC and not have it at some random place in the code.
Quoted 11 lines
Quoted 10 lines
drivers/video/imx-ipu-v3/ipu-dc.c line 267
Quoted 8 lines
drivers/video/imx-ipu-v3/ipu-dc.c new file +8
-0+/* Wait for DC triple buffer to empty */ +if (dc_channels[dc_chan].di ==0 ) +while ((__raw_readl (DC_STAT ) &0x00000002 ) + !=0x00000002 ) { +msleep (2 ); + timeout -=2 ; +if (timeout <=0 ) +break ;So we poll stuff which is updated from some other function ?
Quoted 1 line
We poll the
DC_STATregister here which is updated from the hardware.
And there is no interrupt for this ?
Thanks,
tglx
Sascha Hauer
maintainerRe: [PATCH 3/8] Add a mfd IPUv3 driver
Quoted 22 lines · Thomas Gleixner
Quoted 11 lines · Sascha Hauer
Quoted 5 lines · Thomas Gleixner
drivers/video/imx-ipu-v3/ipu-common.c line 75
Quoted 3 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +3
-0+void ipu_idmac_put (struct ipu_channel *channel) +{ +dev_dbg (ipu_dev,"%s %d\n" , __func__, channel->num);Do we really need this debug stuff in all these functions ?
Reading this comment I expected tons of
dev_dbgin the driver. The one you mentioned above (plus the corresponding one inipu_idmac_get) are indeed not particularly useful, but do you think there is still too much debug code left?Well, I don't see a point in having useless debug stuff around.
Quoted 8 lines
Quoted 3 lines
drivers/video/imx-ipu-v3/ipu-common.c line 217
Quoted 1 line
drivers/video/imx-ipu-v3/ipu-common.c new file +1
-0+DECLARE_IPU_IRQ_BITMAP (irqs);Why the hell do we need this? It's a bog standard bitmap, right ?
It's defined as:
#define
DECLARE_IPU_IRQ_BITMAP(name)DECLARE_BITMAP(name, IPU_IRQ_COUNT)
Quoted 7 lines
Quoted 3 lines
So yes, it's a standard bitmask. It can be used in client drivers aswell. Where's the problem of adding a define for this so that client drivers do not have to care about the size of the bitmap?
That's nonsense. You have to know about the size of the bitmap for any operation on it. Or are you going to provide wrappers around
bitmap_zero()and all other possible bitmap_* functions as well?
Ok, you're right.
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
drivers/video/imx-ipu-v3/ipu-common.c line 582
Quoted 9 lines
drivers/video/imx-ipu-v3/ipu-common.c new file +7
-0+bitmap_zero (irqs,IPU_IRQ_COUNT ); + ret =ipu_submodules_init (pdev, ipu_base, ipu_clk); +if (ret) + goto failed_submodules_init; + +/* Set sync refresh channels as high priority */ +ipu_idmac_write (0x18800000 ,IDMAC_CHA_PRI (0 ));Hmm, this random prio setting here is odd.
Quoted 6 lines
Quoted 3 lines
This is 1:1 from the Freescale Kernel and I never thought about it. We can remove it and see what happens. Maybe then some day we'll learn *why* this is done.
Well, the point is to move that to the init function which deals with IDMAC and not have it at some random place in the code.
Ok, will move it there.
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
drivers/video/imx-ipu-v3/ipu-dc.c line 267
Quoted 9 lines
drivers/video/imx-ipu-v3/ipu-dc.c new file +8
-0+/* Wait for DC triple buffer to empty */ +if (dc_channels[dc_chan].di ==0 ) +while ((__raw_readl (DC_STAT ) &0x00000002 ) + !=0x00000002 ) { +msleep (2 ); + timeout -=2 ; +if (timeout <=0 ) +break ;So we poll stuff which is updated from some other function ?
Quoted 3 lines
Quoted 1 line
We poll the
DC_STATregister here which is updated from the hardware.And there is no interrupt for this ?
Given the sheer amount of interrupt bits it's a bit surprising, but no, I haven't found an interrupt for this (This of course doesn't mean it doesn't exist...)
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Sascha Hauer
maintainerPATCH 4/8 Add i.MX5 framebuffer driver
In reply to Sascha HauerThis patch adds framebuffer support to the Freescale i.MX SoCs equipped with an IPU v3, so far these are the i.MX51/53.
This driver has been tested on the i.MX51 babbage board with both DVI and analog VGA in different resolutions and color depths. It has also been tested on a custom i.MX51 board using a fixed resolution panel.
--- drivers/video/Kconfig | 11 + drivers/video/Makefile | 1 + drivers/video/mx5fb.c | 925 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 937 insertions(+), 0 deletions(-) create mode 100644 drivers/video/mx5fb.c
drivers/video/Kconfig +11 -0
@@ -2344,6 +2344,17 @@ config FB_MX3 far only synchronous displays are supported. If you plan to use an LCD display with your i.MX31 system, say Y here. +config FB_MX5 + tristate "MX5 Framebuffer support" + depends on FB && FB_IMX_IPU_V3 + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + select FB_MODE_HELPERS + help + This is a framebuffer device for the i.MX51 LCD Controller. If you + plan to use an LCD display with your i.MX51 system, say Y here. + config FB_BROADSHEET tristate "E-Ink Broadsheet/Epson S1D13521 controller support" depends on FB
drivers/video/Makefile +1 -0
@@ -152,6 +152,7 @@ obj-$(CONFIG_FB_BFIN_LQ035Q1) += bfin-lq035q1-fb.o obj-$(CONFIG_FB_BFIN_T350MCQB) += bfin-t350mcqb-fb.o obj-$(CONFIG_FB_BFIN_7393) += bfin_adv7393fb.o obj-$(CONFIG_FB_MX3) += mx3fb.o +obj-$(CONFIG_FB_MX5) += mx5fb.o obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o obj-$(CONFIG_FB_IMX_IPU_V3) += imx-ipu-v3/
drivers/video/mx5fb.c new file +925 -0
925 lines not on this page · raw message
Signature · 1 line
1.7.2.3
Sascha Hauer
maintainerPATCH 5/8 ARM i.MX51: Add IPU device support
In reply to Sascha Hauer--- arch/arm/mach-mx5/devices-imx51.h | 4 ++ arch/arm/plat-mxc/devices/Kconfig | 4 ++ arch/arm/plat-mxc/devices/Makefile | 1 + arch/arm/plat-mxc/devices/platform-imx_ipuv3.c | 47 +++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/devices-common.h | 10 +++++ 5 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-mxc/devices/platform-imx_ipuv3.c
arch/arm/mach-mx5/devices-imx51.h +4 -0
@@ -55,3 +55,7 @@ extern const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst;extern const struct imx_imx_keypad_data imx51_imx_keypad_data__initconst ;#define imx51_add_imx_keypad (pdata) \ imx_add_imx_keypad(&imx51_imx_keypad_data, pdata) + +extern const struct imx_ipuv3_data imx51_ipuv3_data__initconst ; +#define imx51_add_ipuv3 (pdata) \ + imx_add_ipuv3(&imx51_ipuv3_data, pdata)
arch/arm/plat-mxc/devices/Kconfig +4 -0
@@ -71,3 +71,7 @@ config IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX config IMX_HAVE_PLATFORM_SPI_IMX bool + +config IMX_HAVE_PLATFORM_IMX_IPUV3 + bool +
arch/arm/plat-mxc/devices/Makefile +1 -0
@@ -22,3 +22,4 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o +obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_IPUV3) += platform-imx_ipuv3.o
arch/arm/plat-mxc/devices/platform-imx_ipuv3.c new file +47 -0
47 lines not on this page · raw message
arch/arm/plat-mxc/include/mach/devices-common.h +10 -0
@@ -264,3 +264,13 @@ struct imx_spi_imx_data {struct platform_device *__init imx_add_spi_imx (const struct imx_spi_imx_data *data,const struct spi_imx_master *pdata); + +#include <mach/ipu-v3.h> +struct imx_ipuv3_data { +resource_size_t iobase; +resource_size_t irq_err; +resource_size_t irq; +}; +struct platform_device *__init imx_add_ipuv3 ( +const struct imx_ipuv3_data *data, +const struct imx_ipuv3_platform_data *pdata);
Signature · 1 line
1.7.2.3
Sascha Hauer
maintainerPATCH 6/8 ARM i.MX5: Allow to increase max zone order
In reply to Sascha Hauerdefault setting of 11 allows us to allocate at maximum 2MB chunks of contiguous memory. For resolutions up to 1920x1080 32bpp we need much more memory, so make zone order configurable
--- arch/arm/Kconfig | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/Kconfig +2 -2
@@ -1451,8 +1451,8 @@ config HW_PERF_EVENTS source "mm/Kconfig" config FORCE_MAX_ZONEORDER - int "Maximum zone order" if ARCH_SHMOBILE - range 11 64 if ARCH_SHMOBILE + int "Maximum zone order" if ARCH_SHMOBILE || ARCH_MX5 + range 11 64 if ARCH_SHMOBILE || ARCH_MX5 default "9" if SA1111 default "11" help
Signature · 1 line
1.7.2.3
PATCH 6/8 ARM i.MX5: Allow to increase max zone order
Quoted 4 lines · Sascha Hauer
default setting of 11 allows us to allocate at maximum 2MB chunks of contiguous memory. For resolutions up to 1920x1080 32bpp we need much more memory, so make zone order configurable
Wouldn't it be better to add another 'default' in there for ARCH_MX5 rather than expecting whoever configures the kernel to be able to work out the right value?
Quoted 8 lines
config
FORCE_MAX_ZONEORDERarch/arm/Kconfig +2
-2- int "Maximum zone order" if ARCH_SHMOBILE - range 11 64 if ARCH_SHMOBILE + int "Maximum zone order" if ARCH_SHMOBILE || ARCH_MX5 + range 11 64 if ARCH_SHMOBILE || ARCH_MX5 default "9" if SA1111 default "11" help
Sascha Hauer
maintainerPATCH 6/8 ARM i.MX5: Allow to increase max zone order
Quoted 9 lines · Russell King - ARM Linux
Quoted 4 lines · Sascha Hauer
default setting of 11 allows us to allocate at maximum 2MB chunks of contiguous memory. For resolutions up to 1920x1080 32bpp we need much more memory, so make zone order configurable
Wouldn't it be better to add another 'default' in there for
ARCH_MX5rather than expecting whoever configures the kernel to be able to work out the right value?
We can skip this patch for now. I needed it when I was playing with full hd resolutions, but I never got them to work anyway due to the lack of hardware.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Sascha Hauer
maintainerPATCH 7/8 ARM i.MX5: increase dma consistent size for IPU support
In reply to Sascha Hauer--- arch/arm/plat-mxc/include/mach/memory.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/plat-mxc/include/mach/memory.h +2 -1
@@ -43,7 +43,8 @@# endif #endif -#if defined(CONFIG_MX3_VIDEO ) +#if defined(CONFIG_MX3_VIDEO ) || defined(CONFIG_FB_IMX_IPU_V3 ) || \ + defined(CONFIG_FB_IMX_IPU_V3_MODULE )/* * Increase size of DMA-consistent memory region. * This is required for mx3 camera driver to capture at least two QXGA frames.
Signature · 1 line
1.7.2.3
Sascha Hauer
maintainerPATCH 8/8 ARM i.MX51 babbage: Add framebuffer support
In reply to Sascha Hauer--- arch/arm/mach-mx5/Kconfig | 1 + arch/arm/mach-mx5/board-mx51_babbage.c | 82 ++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 0 deletions(-)
arch/arm/mach-mx5/Kconfig +1 -0
@@ -42,6 +42,7 @@ config MACH_MX51_BABBAGE select IMX_HAVE_PLATFORM_IMX_UART select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX select IMX_HAVE_PLATFORM_SPI_IMX + select IMX_HAVE_PLATFORM_IMX_IPUV3 help Include support for MX51 Babbage platform, also known as MX51EVK in u-boot. This includes specific configurations for the board and its
arch/arm/mach-mx5/board-mx51_babbage.c +82 -0
111 lines not on this page · raw message
Signature · 1 line
1.7.2.3