Re: [PATCH 2/9] ARM: at91: Remove unused struct at91sam9g45_isi_device and its resources
Hi, Lee Jones On 11/4/2012 6:02 AM, Lee Jones wrote: This the at91sam9g45_isi_device structure and its associated resources were added in 2008 and have been unused ever since. Let's remove them. I'm the maintainer of the Atmel ISI driver. Currently the ISI still not work on at91sam9263 board. But this task is in my plan. So keep those code and I will enable ISI support for 9263 in the future. Thanks. Best Regards, Josh Wu Cc: Russell King Cc: linux-arm-ker...@lists.infradead.org Signed-off-by: Lee Jones --- arch/arm/mach-at91/at91sam9263_devices.c | 20 1 file changed, 20 deletions(-) diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index cb85da2..0562a9d 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c @@ -901,26 +901,6 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} #if defined(CONFIG_VIDEO_AT91_ISI) || defined(CONFIG_VIDEO_AT91_ISI_MODULE) -struct resource isi_resources[] = { - [0] = { - .start = AT91SAM9263_BASE_ISI, - .end= AT91SAM9263_BASE_ISI + SZ_16K - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = NR_IRQS_LEGACY + AT91SAM9263_ID_ISI, - .end= NR_IRQS_LEGACY + AT91SAM9263_ID_ISI, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device at91sam9263_isi_device = { - .name = "at91_isi", - .id = -1, - .resource = isi_resources, - .num_resources = ARRAY_SIZE(isi_resources), -}; - void __init at91_add_device_isi(struct isi_platform_data *data, bool use_pck_as_mck) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH][resend] leds-gpio: of: led should not be created if its status is disabled
now the leds-gpio driver will create every child led node without checking the status is disabled or not. for example, if we have a led node like d3, and its status is disabled: leds { d3 { label = "d3"; gpios = <&pioE 24 0>; status = "disabled"; }; }; we except the d3 should not be created. And the gpios should not be request as well. But current driver will create d3 and request its gpio. This patch fix this by using for_each_available_child_of_node() and of_get_available_child_count() to enumerate all child nodes. So the disabled node will be inavailable. Signed-off-by: Josh Wu --- resend this patch based on the patch: - http://www.spinics.net/lists/devicetree/msg05903.html drivers/leds/leds-gpio.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index e8b01e5..62bfc3a 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -170,11 +170,11 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) int count, ret; /* count LEDs in this device, so we know how much to allocate */ - count = of_get_child_count(np); + count = of_get_available_child_count(np); if (!count) return ERR_PTR(-ENODEV); - for_each_child_of_node(np, child) + for_each_available_child_of_node(np, child) if (of_get_gpio(child, 0) == -EPROBE_DEFER) return ERR_PTR(-EPROBE_DEFER); @@ -183,7 +183,7 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) if (!priv) return ERR_PTR(-ENOMEM); - for_each_child_of_node(np, child) { + for_each_available_child_of_node(np, child) { struct gpio_led led = {}; enum of_gpio_flags flags; const char *state; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] leds-gpio: of: led should not be created if its status is disabled
now the leds-gpio driver will create every child led node without checking the status is disabled or not. for example, if we have a led node like d3, and its status is disabled: leds { d3 { label = "d3"; gpios = <&pioE 24 0>; status = "disabled"; }; }; we except the d3 should not be created. And the gpios should not be request as well. But current driver will create d3 and request its gpio. This patch fix this by using for_each_available_child_of_node() to enumerate all child nodes. So the disabled node will be inavilable. Signed-off-by: Josh Wu --- drivers/leds/leds-gpio.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index e8b01e5..9bb4e04 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -167,23 +167,23 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node, *child; struct gpio_leds_priv *priv; - int count, ret; + int count = 0, ret; /* count LEDs in this device, so we know how much to allocate */ - count = of_get_child_count(np); - if (!count) - return ERR_PTR(-ENODEV); - - for_each_child_of_node(np, child) + for_each_available_child_of_node(np, child) { + count++; if (of_get_gpio(child, 0) == -EPROBE_DEFER) return ERR_PTR(-EPROBE_DEFER); + } + if (!count) + return ERR_PTR(-ENODEV); priv = devm_kzalloc(&pdev->dev, sizeof_gpio_leds_priv(count), GFP_KERNEL); if (!priv) return ERR_PTR(-ENOMEM); - for_each_child_of_node(np, child) { + for_each_available_child_of_node(np, child) { struct gpio_led led = {}; enum of_gpio_flags flags; const char *state; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] MTD: atmel_nand: using a stronger ECC is not dangerous
On 5/31/2013 10:34 PM, Richard Genoud wrote: We don't have to issue a warning when a stronger error correting capability is chosen. Signed-off-by: Richard Genoud Acked-by: Josh Wu Best Regards, Josh Wu --- drivers/mtd/nand/atmel_nand.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 2d23d29..2415cdc 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -1002,7 +1002,7 @@ static int __init atmel_pmecc_nand_init_params(struct platform_device *pdev, return err_no; } - if (cap != host->pmecc_corr_cap || + if (cap > host->pmecc_corr_cap || sector_size != host->pmecc_sector_size) dev_info(host->dev, "WARNING: Be Caution! Using different PMECC parameters from Nand ONFI ECC reqirement.\n"); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] avr32: fix build error in atstk1006_defconfig
Hi, Andrew Could you merge it for avr32? Thanks in advance. Best Regards, Josh Wu On 4/1/2013 2:26 PM, Josh Wu wrote: fixed the following compile error when use avr32 atstk1006_defconfig: drivers/mtd/nand/atmel_nand.c: In function 'pmecc_err_location': drivers/mtd/nand/atmel_nand.c:639: error: implicit declaration of function 'writel_relaxed' which was introduced by commit: 1c7b874d33b463f7150b1ab4617f000af9b327fd mtd: at91: atmel_nand: add Programmable Multibit ECC controller support The PMECC for nand flash code uses writel_relaxed(). But in avr32, there is no macro "writel_relaxed" defined. This patch add writex_relaxed macro definitions. Signed-off-by: Josh Wu Acked-by: Havard Skinnemoen Acked-by: Hans-Christian Egtvedt --- change since v1: refined the commit message and wrap it into 80 characters. arch/avr32/include/asm/io.h |4 1 file changed, 4 insertions(+) diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h index cf60d0a..fc6483f 100644 --- a/arch/avr32/include/asm/io.h +++ b/arch/avr32/include/asm/io.h @@ -165,6 +165,10 @@ BUILDIO_IOPORT(l, u32) #define readw_be __raw_readw #define readl_be __raw_readl +#define writeb_relaxed writeb +#define writew_relaxed writew +#define writel_relaxed writel + #define writeb_be __raw_writeb #define writew_be __raw_writew #define writel_be __raw_writel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
avr32: fix build error in atstk1006_defconfig
fixed the following compile error when use avr32 atstk1006_defconfig: drivers/mtd/nand/atmel_nand.c: In function 'pmecc_err_location': drivers/mtd/nand/atmel_nand.c:639: error: implicit declaration of function 'writel_relaxed' which was introduced by commit 1c7b874d33b463 ("mtd: at91: atmel_nand: add Programmable Multibit ECC controller support"). The PMECC for nand flash code uses writel_relaxed(). But in avr32, there is no macro "writel_relaxed" defined. This patch add writex_relaxed macro definitions. Signed-off-by: Josh Wu Acked-by: Havard Skinnemoen Acked-by: Hans-Christian Egtvedt --- arch/avr32/include/asm/io.h |4 1 file changed, 4 insertions(+) diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h index cf60d0a..fc6483f 100644 --- a/arch/avr32/include/asm/io.h +++ b/arch/avr32/include/asm/io.h @@ -165,6 +165,10 @@ BUILDIO_IOPORT(l, u32) #define readw_be __raw_readw #define readl_be __raw_readl +#define writeb_relaxed writeb +#define writew_relaxed writew +#define writel_relaxed writel + #define writeb_be __raw_writeb #define writew_be __raw_writew #define writel_be __raw_writel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: avr32: fix build error in atstk1006_defconfig
Sorry, please drop this email. I will send out another one to include a...@linux-foundation.org Best Regards, Josh Wu On 4/1/2013 1:58 PM, Josh Wu wrote: fixed the following compile error when use avr32 atstk1006_defconfig: drivers/mtd/nand/atmel_nand.c: In function 'pmecc_err_location': drivers/mtd/nand/atmel_nand.c:639: error: implicit declaration of function 'writel_relaxed' which was introduced by commit 1c7b874d33b463 ("mtd: at91: atmel_nand: add Programmable Multibit ECC controller support"). The PMECC for nand flash code uses writel_relaxed(). But in avr32, there is no macro "writel_relaxed" defined. This patch add writex_relaxed macro definitions. Signed-off-by: Josh Wu Acked-by: Havard Skinnemoen Acked-by: Hans-Christian Egtvedt --- arch/avr32/include/asm/io.h |4 1 file changed, 4 insertions(+) diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h index cf60d0a..fc6483f 100644 --- a/arch/avr32/include/asm/io.h +++ b/arch/avr32/include/asm/io.h @@ -165,6 +165,10 @@ BUILDIO_IOPORT(l, u32) #define readw_be __raw_readw #define readl_be __raw_readl +#define writeb_relaxed writeb +#define writew_relaxed writew +#define writel_relaxed writel + #define writeb_be __raw_writeb #define writew_be __raw_writew #define writel_be __raw_writel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] avr32: fix build error in atstk1006_defconfig
fixed the following compile error when use avr32 atstk1006_defconfig: drivers/mtd/nand/atmel_nand.c: In function 'pmecc_err_location': drivers/mtd/nand/atmel_nand.c:639: error: implicit declaration of function 'writel_relaxed' which was introduced by commit: 1c7b874d33b463f7150b1ab4617f000af9b327fd mtd: at91: atmel_nand: add Programmable Multibit ECC controller support The PMECC for nand flash code uses writel_relaxed(). But in avr32, there is no macro "writel_relaxed" defined. This patch add writex_relaxed macro definitions. Signed-off-by: Josh Wu Acked-by: Havard Skinnemoen Acked-by: Hans-Christian Egtvedt --- change since v1: refined the commit message and wrap it into 80 characters. arch/avr32/include/asm/io.h |4 1 file changed, 4 insertions(+) diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h index cf60d0a..fc6483f 100644 --- a/arch/avr32/include/asm/io.h +++ b/arch/avr32/include/asm/io.h @@ -165,6 +165,10 @@ BUILDIO_IOPORT(l, u32) #define readw_be __raw_readw #define readl_be __raw_readl +#define writeb_relaxed writeb +#define writew_relaxed writew +#define writel_relaxed writel + #define writeb_be __raw_writeb #define writew_be __raw_writew #define writel_be __raw_writel -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] avr32: fix build error in atstk1006_defconfig
fixed the following compile error when use avr32 atstk1006_defconfig: drivers/mtd/nand/atmel_nand.c: In function 'pmecc_err_location': drivers/mtd/nand/atmel_nand.c:639: error: implicit declaration of function 'writel_relaxed' which was introduced by commit 1c7b874d33b463 ("mtd: at91: atmel_nand: add Programmable Multibit ECC controller support"). The PMECC for nand flash code uses writel_relaxed(). But in avr32, there is no macro "writel_relaxed" defined. This patch add writex_relaxed macro definitions. Signed-off-by: Josh Wu --- arch/avr32/include/asm/io.h |4 1 file changed, 4 insertions(+) diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h index cf60d0a..fc6483f 100644 --- a/arch/avr32/include/asm/io.h +++ b/arch/avr32/include/asm/io.h @@ -165,6 +165,10 @@ BUILDIO_IOPORT(l, u32) #define readw_be __raw_readw #define readl_be __raw_readl +#define writeb_relaxed writeb +#define writew_relaxed writew +#define writel_relaxed writel + #define writeb_be __raw_writeb #define writew_be __raw_writew #define writel_be __raw_writel -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] avr32: fix build error in atstk1006_defconfig
On 10/16/2012 5:17 PM, Hans-Christian Egtvedt wrote: Around Tue 16 Oct 2012 15:19:27 +0800 or thereabout, Josh Wu wrote: fixed the following compile error when use avr32 atstk1006_defconfig: drivers/mtd/nand/atmel_nand.c: In function 'pmecc_err_location': drivers/mtd/nand/atmel_nand.c:639: error: implicit declaration of function 'writel_relaxed' which was introduced by commit 1c7b874d33b463 ("mtd: at91: atmel_nand: add Programmable Multibit ECC controller support"). The PMECC for nand flash code uses writel_relaxed(). But in avr32, there is no macro "writel_relaxed" defined. This patch add writex_relaxed macro definitions. Signed-off-by: Josh Wu --- arch/avr32/include/asm/io.h |4 1 file changed, 4 insertions(+) diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h index cf60d0a..fc6483f 100644 --- a/arch/avr32/include/asm/io.h +++ b/arch/avr32/include/asm/io.h @@ -165,6 +165,10 @@ BUILDIO_IOPORT(l, u32) #define readw_be __raw_readw #define readl_be __raw_readl +#define writeb_relaxed writeb +#define writew_relaxed writew +#define writel_relaxed writel + I'm wondering if they should be something similar to SH arch: #define writeb_relaxed(v,c) ((void)__raw_writeb((__force u8)ioswabb(v),c)) What is the intention behind the macro? Which restriction is relaxed? According to my understanding, the xxx_relaxed() is that I/O function without any memory barriers. for Multi-cpu, the execute order are less limited. So the relaxed write function should be more effective than non-relaxed one. But for single cpu, relaxed function should work same as non-relaxed function. Please correct me if I'm understand in a wrong way. Best Regards, Josh Wu #define writeb_be __raw_writeb #define writew_be __raw_writew #define writel_be __raw_writel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] media: atmel-isi: setup the ISI_CFG2 register directly
Hi, Guennadi Thanks for the review. On 8/30/2015 4:48 PM, Guennadi Liakhovetski wrote: Hi Josh, On Wed, 17 Jun 2015, Josh Wu wrote: In the function configure_geometry(), we will setup the ISI CFG2 according to the sensor output format. It make no sense to just read back the CFG2 register and just set part of it. So just set up this register directly makes things simpler. Simpler doesn't necessarily mean better or more correct:) There are other fields in that register and currently the driver preserves them, with this patch you overwrite them with 0. 0 happens to be the reset value of that register. So, you should at least mention that in this patch description, just saying "simpler" doesn't convince me. Correct, I should mention that the reset value (0) of cfg2 means the YUV mode in the commit message. To use YUV mode we need to clear COL_SPACE (bit 15 of CFG2) and since the reset value is 0, so in the code, I didn't need do anything. So, at least I'd modify that, I can do that myself. But in general I'm not even sure why this patch is needed. Yes, currently those fields of that register are unused, so, we can assume they stay at their reset values. But firstly the hardware can change and at some point the reset value can change, or those other fields will get set indirectly by something. Or the driver will change at some point to support more fields of that register and then this code will have to be changed again. I understand your concern. maybe a better solution is explicitly set the COL_SPACE (bit 15) to 0 for the YUV formats. like: #define ISI_CFG2_COL_SPACE_YUV(0 << 15) case MEDIA_BUS_FMT_YVYU8_2X8: cfg2 = ISI_CFG2_COL_SPACE_YUV | ISI_CFG2_YCC_SWAP_MODE_1; break; And above modifications can be sent with RGB format support patch in future. So, I'd ask you again - do you really want this patch? yes, this patch is needed. And in future i will add the RGB format settings. If you insist - I'll take it, but I'd add the "reset value" reasoning. That would be great, thank you very much. Best Regards, Josh Wu Otherwise maybe just drop it? Thanks Guennadi Currently only support YUV format from camera sensor. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/atmel-isi.c | 20 +++- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 9070172..8bc40ca 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -105,24 +105,25 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) static int configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { - u32 cfg2, cr; + u32 cfg2; + /* According to sensor's output format to set cfg2 */ switch (code) { /* YUV, including grey */ case MEDIA_BUS_FMT_Y8_1X8: - cr = ISI_CFG2_GRAYSCALE; + cfg2 = ISI_CFG2_GRAYSCALE; break; case MEDIA_BUS_FMT_VYUY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_3; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; case MEDIA_BUS_FMT_UYVY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_2; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_2; break; case MEDIA_BUS_FMT_YVYU8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_1; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_1; break; case MEDIA_BUS_FMT_YUYV8_2X8: - cr = ISI_CFG2_YCC_SWAP_DEFAULT; + cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ default: @@ -130,17 +131,10 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); - - cfg2 = isi_readl(isi, ISI_CFG2); - /* Set YCC swap mode */ - cfg2 &= ~ISI_CFG2_YCC_SWAP_MODE_MASK; - cfg2 |= cr; /* Set width */ - cfg2 &= ~(ISI_CFG2_IM_HSIZE_MASK); cfg2 |= ((width - 1) << ISI_CFG2_IM_HSIZE_OFFSET) & ISI_CFG2_IM_HSIZE_MASK; /* Set height */ - cfg2 &= ~(ISI_CFG2_IM_VSIZE_MASK); cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [media] atmel-isi: Protect PM-only functions to kill warning
Hi, Geert Uytterhoeven Thanks for the patch. On 9/6/2015 6:08 PM, Geert Uytterhoeven wrote: If CONFIG_PM=n: drivers/media/platform/soc_camera/atmel-isi.c:1044: warning: ‘atmel_isi_runtime_suspend’ defined but not used drivers/media/platform/soc_camera/atmel-isi.c:1054: warning: ‘atmel_isi_runtime_resume’ defined but not used Protect the unused functions by #ifdef CONFIG_PM to fix this. Signed-off-by: Geert Uytterhoeven Acked-by: Josh Wu Best Regards, Josh Wu --- Resend with correct suject --- drivers/media/platform/soc_camera/atmel-isi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 90701726a06a2e5c..ccf30ccbe389233f 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -1040,6 +1040,7 @@ err_alloc_ctx: return ret; } +#ifdef CONFIG_PM static int atmel_isi_runtime_suspend(struct device *dev) { struct soc_camera_host *soc_host = to_soc_camera_host(dev); @@ -1058,6 +1059,7 @@ static int atmel_isi_runtime_resume(struct device *dev) return clk_prepare_enable(isi->pclk); } +#endif /* CONFIG_PM */ static const struct dev_pm_ops atmel_isi_dev_pm_ops = { SET_RUNTIME_PM_OPS(atmel_isi_runtime_suspend, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] mtd: nand: atmel: Rework driver to separate nfc and nand nodes
Hi, Boris On 12/5/2014 6:30 AM, Boris Brezillon wrote: mtd: nand: atmel: Update DT documentation after splitting NFC and NAND The NAND and NFC (NAND Flash Controller) were linked together with a parent <-> child relationship. This model has several drawbacks: - it does not allow for multiple NAND chip handling while the controller support multi-chip (even though the driver is not ready yet) - it mixes NAND partitions and NFC nodes at the same level (which is a bit disturbing) - the introduction of the EBI bus implies defining NAND chips under the EBI node, and the ranges available under the EBI node should be restricted to EBI address space, while the NFC references several registers outside of these EBI ranges. Move the NFC node outside of the NAND node, to get a more future-proof DT representation. Signed-off-by: Boris Brezillon I'm fine with this patch. Acked-by: Josh Wu Best Regards, Josh Wu --- drivers/mtd/nand/atmel_nand.c | 76 ++- 1 file changed, 61 insertions(+), 15 deletions(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 19d1e9d..0239fe6 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -123,6 +123,7 @@ struct atmel_nand_host { struct dma_chan *dma_chan; struct atmel_nfc *nfc; + boolwait_for_nfc; bool has_pmecc; u8 pmecc_corr_cap; @@ -1423,6 +1424,12 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode) ecc_writel(host->ecc, CR, ATMEL_ECC_RST); } +static const struct of_device_id atmel_nand_nfc_match[] = { + { .compatible = "atmel,sama5d3-nfc" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, atmel_nand_nfc_match); + static int atmel_of_init_port(struct atmel_nand_host *host, struct device_node *np) { @@ -1431,6 +1438,7 @@ static int atmel_of_init_port(struct atmel_nand_host *host, int ecc_mode; struct atmel_nand_data *board = &host->board; enum of_gpio_flags flags = 0; + struct device_node *child; if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) { if (val >= 32) { @@ -1467,8 +1475,30 @@ static int atmel_of_init_port(struct atmel_nand_host *host, host->has_pmecc = of_property_read_bool(np, "atmel,has-pmecc"); - /* load the nfc driver if there is */ - of_platform_populate(np, NULL, NULL, host->dev); + /* +* Backward compatibility with DTs defining the NFC node as their +* child. +* The new model reference the NFC so that we can define several +* chip controlled by the same controller. +*/ + for_each_available_child_of_node(np, child) { + /* +* If we find an NFC node under the NAND node, then populate +* the device so that it can be probed, and wait for it. +*/ + if (of_match_node(atmel_nand_nfc_match, child)) { + of_platform_populate(np, NULL, NULL, host->dev); + host->wait_for_nfc = true; + break; + } + } + + /* +* If there's an atmel,nfc property we should access the NAND +* through the NFC. +*/ + if (of_property_read_bool(np, "atmel,nfc")) + host->wait_for_nfc = true; if (!(board->ecc_mode == NAND_ECC_HW) || !host->has_pmecc) return 0; /* Not using PMECC */ @@ -2032,10 +2062,6 @@ static int atmel_nand_probe(struct platform_device *pdev) if (!host) return -ENOMEM; - res = platform_driver_register(&atmel_nand_nfc_driver); - if (res) - dev_err(&pdev->dev, "atmel_nand: can't register NFC driver\n"); - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); host->io_base = devm_ioremap_resource(&pdev->dev, mem); if (IS_ERR(host->io_base)) { @@ -2089,6 +2115,13 @@ static int atmel_nand_probe(struct platform_device *pdev) goto err_nand_ioremap; } } else { + /* +* If the NFC is not initialized (or not probed) and the device +* is asking to be accessed through the NFC then defer the +* probe. +*/ + if (host->wait_for_nfc) + return -EPROBE_DEFER; res = atmel_nand_set_enable_ready_pins(mtd); if (res) goto err_nand_ioremap; @@ -2230,8 +2263,6 @@ static int atmel_nand_remove(struct platform_device *pdev) if (host->dma_chan) dma_release_channel(host->dma_chan); - platform_driver_
Re: [PATCH 2/4] mtd: nand: atmel: Update DT documentation after splitting NFC and NAND
Hi, Boris Thanks for the patch. You need to rebase on the top of current mtd-l2 git tree. As I had some change on the binding document. Best Regards, Josh Wu On 12/5/2014 6:30 AM, Boris Brezillon wrote: The NAND and NFC (NAND Flash Controller) were linked together with a parent <-> child relationship. This model has several drawbacks: - it does not allow for multiple NAND chip handling while the controller support multi-chip (even though the driver is not ready yet) - it mixes NAND partitions and NFC nodes at the same level (which is a bit disturbing) - the introduction of the EBI bus implies defining NAND chips under the EBI node, and the ranges available under the EBI node should be restricted to EBI address space, while the NFC references several registers outside of these EBI ranges. Move the NFC node outside of the NAND node, to get a more future-proof model. Signed-off-by: Boris Brezillon --- .../devicetree/bindings/mtd/atmel-nand.txt | 46 -- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt index 6edc3b6..8896850 100644 --- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt @@ -30,15 +30,19 @@ Optional properties: sector size 1024. - nand-bus-width : 8 or 16 bus width if not present 8 - nand-on-flash-bbt: boolean to enable on flash bbt option if not present false -- Nand Flash Controller(NFC) is a slave driver under Atmel nand flash - - Required properties: -- compatible : "atmel,sama5d3-nfc". -- reg : should specify the address and size used for NFC command registers, -NFC registers and NFC Sram. NFC Sram address and size can be absent -if don't want to use it. -- clocks: phandle to the peripheral clock - - Optional properties: -- atmel,write-by-sram: boolean to enable NFC write by sram. +- atmel,nfc: phandle referencing the NAND Flash Controller, if available. + +The NAND Flash Controller (NFC) is an advanced NAND controller and should be +used in conjunction with the NAND flash device. +Required properties: + - compatible : "atmel,sama5d3-nfc". + - reg : should specify the address and size used for NFC command registers, + NFC registers and NFC Sram. NFC Sram address and size can be absent + if you don't want to use it. + - clocks: phandle to the peripheral clock + +Optional properties: + - atmel,write-by-sram: boolean to enable NFC write by sram. Examples: nand0: nand@4000,0 { @@ -89,21 +93,23 @@ nand0: nand@4000 { }; /* for NFC supported chips */ +nfc: nfc@7000 { + compatible = "atmel,sama5d3-nfc"; + #address-cells = <1>; + #size-cells = <1>; + clocks = <&hsmc_clk> + reg = < + 0x7000 0x1000 /* NFC Command Registers */ + 0xc000 0x0070 /* NFC HSMC regs */ + 0x0020 0x0010 /* NFC SRAM banks */ + >; +}; + nand0: nand@4000 { compatible = "atmel,at91rm9200-nand"; #address-cells = <1>; #size-cells = <1>; ranges; + atmel,nfc = <&nfc>; ... -nfc@7000 { - compatible = "atmel,sama5d3-nfc"; - #address-cells = <1>; - #size-cells = <1>; - clocks = <&hsmc_clk> - reg = < - 0x7000 0x1000 /* NFC Command Registers */ - 0xc000 0x0070 /* NFC HSMC regs */ - 0x0020 0x0010 /* NFC SRAM banks */ - >; - }; }; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] ARM: at91/dt: sama5: move NAND nodes into board dts/dtsi
; 0x6000 0x0100 /* EBI CS3 */ - 0xc070 0x0490 /* SMC PMECC regs */ - 0xc500 0x0100 /* SMC PMECC Error Location regs */ - 0x0011 0x00018000 /* ROM code */ - >; - interrupts = <5 IRQ_TYPE_LEVEL_HIGH 6>; - atmel,nand-addr-offset = <21>; - atmel,nand-cmd-offset = <22>; - atmel,nand-has-dma; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_nand0_ale_cle>; - atmel,pmecc-lookup-table-offset = <0x0 0x8000>; - atmel,nfc = <&nfc>; - status = "disabled"; - }; - nfc: nfc@7000 { compatible = "atmel,sama5d3-nfc"; reg = <0x7000 0x1000 /* NFC Command Registers */ diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi index cfcd200..e6c2aec 100644 --- a/arch/arm/boot/dts/sama5d3xcm.dtsi +++ b/arch/arm/boot/dts/sama5d3xcm.dtsi @@ -76,13 +76,29 @@ }; nand0: nand@6000 { + compatible = "atmel,at91rm9200-nand"; + #address-cells = <1>; + #size-cells = <1>; + ranges; it would be better to leave this part to the sama5d3.dtsi. + reg = < 0x6000 0x0100 /* EBI CS3 */ + 0xc070 0x0490 /* SMC PMECC regs */ + 0xc500 0x0100 /* SMC PMECC Error Location regs */ + 0x0011 0x00018000 /* ROM code */ + >; + interrupts = <5 IRQ_TYPE_LEVEL_HIGH 6>; ditto. + atmel,nand-addr-offset = <21>; + atmel,nand-cmd-offset = <22>; + atmel,nand-has-dma; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_nand0_ale_cle>; + atmel,pmecc-lookup-table-offset = <0x0 0x8000>; ditto. + atmel,nfc = <&nfc>; nand-bus-width = <8>; nand-ecc-mode = "hw"; atmel,has-pmecc; atmel,pmecc-cap = <4>; atmel,pmecc-sector-size = <512>; nand-on-flash-bbt; - status = "okay"; at91bootstrap@0 { label = "at91bootstrap"; diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi index 3b5e9f1..8647eb3 100644 --- a/arch/arm/boot/dts/sama5d4.dtsi +++ b/arch/arm/boot/dts/sama5d4.dtsi @@ -265,25 +265,6 @@ cache-level = <2>; }; - nand0: nand@8000 { - compatible = "atmel,at91rm9200-nand"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - reg = < 0x8000 0x0800 /* EBI CS3 */ - 0xfc05c070 0x0490 /* SMC PMECC regs */ - 0xfc05c500 0x0100 /* SMC PMECC Error Location regs */ - >; - interrupts = <22 IRQ_TYPE_LEVEL_HIGH 6>; - atmel,nand-addr-offset = <21>; - atmel,nand-cmd-offset = <22>; - atmel,nand-has-dma; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_nand>; - atmel,nfc = <&nfc>; - status = "disabled"; - }; - nfc: nfc@9000 { compatible = "atmel,sama5d3-nfc"; reg = <0x9000 0x1000 /* NFC Command Registers */ Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] media: v4l2-image-sizes.h: add SVGA, XGA and UXGA size definitions
Hi, Guennadi On 11/28/2014 4:13 AM, Guennadi Liakhovetski wrote: Hi Josh, On Thu, 27 Nov 2014, Josh Wu wrote: Hi, Guennadi On 11/26/2014 6:23 AM, Guennadi Liakhovetski wrote: Hi Josh, On Tue, 25 Nov 2014, Josh Wu wrote: Add SVGA, UXGA and XGA size definitions to v4l2-image-sizes.h. The definitions are sorted by alphabet order. Signed-off-by: Josh Wu Thanks for your patches. I'm ok with these two, but the second of them depends on the first one, and the first one wouldn't (normally) be going via the soc-camera tree. Mauro, how would you prefer to handle this? Should I pick up and push to you both of them or postpone #2 until the next merge window? The first patch is already merged in the media_tree. If the soc-camera tree will be merged to the media_tree, then there should have no dependency issue. Am I understanding correct? Yes, then it should be ok! Just checking the status of this patch. I don't found this patch in media's tree or soc_camera's tree. Could you take this patch in your tree? Best Regards, Josh Wu Thanks Guennadi Best Regards, Josh Wu Thanks Guennadi --- include/media/v4l2-image-sizes.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/media/v4l2-image-sizes.h b/include/media/v4l2-image-sizes.h index 10daf92..c70c917 100644 --- a/include/media/v4l2-image-sizes.h +++ b/include/media/v4l2-image-sizes.h @@ -25,10 +25,19 @@ #define QVGA_WIDTH 320 #define QVGA_HEIGHT 240 +#define SVGA_WIDTH 800 +#define SVGA_HEIGHT680 + #define SXGA_WIDTH 1280 #define SXGA_HEIGHT 1024 #define VGA_WIDTH 640 #define VGA_HEIGHT 480 +#define UXGA_WIDTH 1600 +#define UXGA_HEIGHT1200 + +#define XGA_WIDTH 1024 +#define XGA_HEIGHT 768 + #endif /* _IMAGE_SIZES_H */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] ARM: at91: dts: add isi & ov2640 dt nodes for at91sam9m10g45ek board
Add the link for atmel-isi and ov2640 sensor node. Signed-off-by: Josh Wu --- arch/arm/boot/dts/at91sam9g45.dtsi | 4 +++ arch/arm/boot/dts/at91sam9m10g45ek.dts | 45 ++ 2 files changed, 49 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index d260ba7..e707613 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -1070,6 +1070,10 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_isi>; status = "disabled"; + port { + #address-cells = <1>; + #size-cells = <0>; + }; }; pwm0: pwm@fffb8000 { diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts index 1375d33..5062e18 100644 --- a/arch/arm/boot/dts/at91sam9m10g45ek.dts +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -63,6 +63,25 @@ i2c0: i2c@fff84000 { status = "okay"; + ov2640: camera@30 { + compatible = "ovti,ov2640"; + reg = <0x30>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pck1_as_isi_mck &pinctrl_sensor_power &pinctrl_sensor_reset>; + resetb-gpios = <&pioD 12 GPIO_ACTIVE_LOW>; + pwdn-gpios = <&pioD 13 GPIO_ACTIVE_HIGH>; + clocks = <&pck1>; + clock-names = "xvclk"; + assigned-clocks = <&pck1>; + assigned-clock-rates = <2500>; + + port { + ov2640_0: endpoint { + remote-endpoint = <&isi_0>; + bus-width = <8>; + }; + }; + }; }; i2c1: i2c@fff88000 { @@ -101,6 +120,22 @@ }; pinctrl@f200 { + camera_sensor { + pinctrl_pck1_as_isi_mck: pck1_as_isi_mck-0 { + atmel,pins = + ; + }; + + pinctrl_sensor_reset: sensor_reset-0 { + atmel,pins = + ; + }; + + pinctrl_sensor_power: sensor_power-0 { + atmel,pins = + ; + }; + }; mmc0 { pinctrl_board_mmc0: mmc0-board { atmel,pins = @@ -155,6 +190,16 @@ status = "okay"; }; + isi@fffb4000 { + status = "okay"; + port { + isi_0: endpoint { + remote-endpoint = <&ov2640_0>; + bus-width = <8>; + }; + }; + }; + pwm0: pwm@fffb8000 { status = "okay"; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] ARM: at91: at91_dt_defconfig: enable ISI and ov2640 support
Add Atmel-isi and ov2640 driver in defconfig Signed-off-by: Josh Wu --- arch/arm/configs/at91_dt_defconfig | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig index bcef49a..d089ec9 100644 --- a/arch/arm/configs/at91_dt_defconfig +++ b/arch/arm/configs/at91_dt_defconfig @@ -131,6 +131,12 @@ CONFIG_POWER_RESET=y CONFIG_WATCHDOG=y CONFIG_AT91SAM9X_WATCHDOG=y CONFIG_SSB=m +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_SOC_CAMERA=y +CONFIG_VIDEO_ATMEL_ISI=y +CONFIG_SOC_CAMERA_OV2640=y CONFIG_FB=y CONFIG_FB_ATMEL=y CONFIG_BACKLIGHT_LCD_SUPPORT=y -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/2] ARM: at91: at91_dt_defconfig: enable ISI and ov2640 support
Add Atmel-isi and ov2640 driver in defconfig Signed-off-by: Josh Wu --- Changes in v2: None arch/arm/configs/at91_dt_defconfig | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig index bcef49a..d089ec9 100644 --- a/arch/arm/configs/at91_dt_defconfig +++ b/arch/arm/configs/at91_dt_defconfig @@ -131,6 +131,12 @@ CONFIG_POWER_RESET=y CONFIG_WATCHDOG=y CONFIG_AT91SAM9X_WATCHDOG=y CONFIG_SSB=m +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_SOC_CAMERA=y +CONFIG_VIDEO_ATMEL_ISI=y +CONFIG_SOC_CAMERA_OV2640=y CONFIG_FB=y CONFIG_FB_ATMEL=y CONFIG_BACKLIGHT_LCD_SUPPORT=y -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/2] ARM: at91: dts: add isi & ov2640 dt nodes for at91sam9m10g45ek board
First we group the isi data pins, and for now we only use 0~7 data pins with HSYNC and VSYNC. Also add the link for atmel-isi and ov2640 sensor node. Signed-off-by: Josh Wu --- Changes in v2: - group the isi data pin. - remove the isi_mck pin from pinctrl-isi as it will used by camera sensor. arch/arm/boot/dts/at91sam9g45.dtsi | 48 +- arch/arm/boot/dts/at91sam9m10g45ek.dts | 45 +++ 2 files changed, 75 insertions(+), 18 deletions(-) diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index d260ba7..f6220d6 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -498,23 +498,31 @@ }; isi { - pinctrl_isi: isi-0 { - atmel,pins = ; + pinctrl_isi_data_0_7: isi-0-data-0-7 { + atmel,pins = + ; /* HSYNC */ + }; + + pinctrl_isi_data_8_9: isi-0-data-8-9 { + atmel,pins = + ; /* D9 */ + }; + + pinctrl_isi_data_10_11: isi-0-data-10-11 { + atmel,pins = + ; /* D11 */ }; }; @@ -1068,8 +1076,12 @@ clocks = <&isi_clk>; clock-names = "isi_clk"; pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_isi>; + pinctrl-0 = <&pinctrl_isi_data_0_7>; status = "disabled"; + port { + #address-cells = <1>; + #size-cells = <0>; + }; }; pwm0: pwm@fffb8000 { diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts index 1375d33..5062e18 100644 --- a/arch/arm/boot/dts/at91sam9m10g45ek.dts +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -63,6 +63,25 @@ i2c0: i2c@fff84000 { status = "okay"; + ov2640: camera@30 { + compatible = "ovti,ov2640"; + reg = <0x30>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pck1_as_isi_mck &pinctrl_sensor_power &pinctrl_sensor_reset>; + resetb-gpios = <&pioD 12 GPIO_ACTIVE_LOW>; + pwdn-gpios = <&pioD 13 GPIO_ACTIVE_HIGH>; + clocks = <&pck1>; + clock-names = "xvclk"; + assigned-clocks = <&pck1>; + assigned-clock-rates = <2500>; + + port { + ov2640_0: endpoint { + remote-endpoint = <&isi_0>; + bus-width = <8>; + }; + }; + }; }; i2c1: i2c@fff88000 { @@ -101,6 +120,22 @@ }; pinctrl@f200 { + camera_sensor { + pinctrl_pck1_as_isi_mck: pck1_as_isi_mck-0 { + atmel,pins = + ; + }; + + pinctrl_sensor_reset: sensor_reset-0 { + atmel,pins = + ; + }; + + pinctrl_sensor_power: sensor_power-0 { + atmel,pins = +
[PATCH] media: atmel-isi: increase timeout to disable/enable isi
If ISI is working on a 1024x768 or higher resolution, it needs longer time to disable ISI. So this patch will increase timeout to 500ms. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/atmel-isi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 1482af2..354b7db 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -219,7 +219,7 @@ static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset) } timeout = wait_for_completion_timeout(&isi->complete, - msecs_to_jiffies(100)); + msecs_to_jiffies(500)); if (timeout == 0) return -ETIMEDOUT; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] media: atmel-isi: setup the ISI_CFG2 register directly
In the function configure_geometry(), we will setup the ISI CFG2 according to the sensor output format. It make no sense to just read back the CFG2 register and just set part of it. So just set up this register directly makes things simpler. Currently only support YUV format from camera sensor. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/atmel-isi.c | 20 +++- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 9070172..8bc40ca 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -105,24 +105,25 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) static int configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { - u32 cfg2, cr; + u32 cfg2; + /* According to sensor's output format to set cfg2 */ switch (code) { /* YUV, including grey */ case MEDIA_BUS_FMT_Y8_1X8: - cr = ISI_CFG2_GRAYSCALE; + cfg2 = ISI_CFG2_GRAYSCALE; break; case MEDIA_BUS_FMT_VYUY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_3; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; case MEDIA_BUS_FMT_UYVY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_2; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_2; break; case MEDIA_BUS_FMT_YVYU8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_1; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_1; break; case MEDIA_BUS_FMT_YUYV8_2X8: - cr = ISI_CFG2_YCC_SWAP_DEFAULT; + cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ default: @@ -130,17 +131,10 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); - - cfg2 = isi_readl(isi, ISI_CFG2); - /* Set YCC swap mode */ - cfg2 &= ~ISI_CFG2_YCC_SWAP_MODE_MASK; - cfg2 |= cr; /* Set width */ - cfg2 &= ~(ISI_CFG2_IM_HSIZE_MASK); cfg2 |= ((width - 1) << ISI_CFG2_IM_HSIZE_OFFSET) & ISI_CFG2_IM_HSIZE_MASK; /* Set height */ - cfg2 &= ~(ISI_CFG2_IM_VSIZE_MASK); cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] media: atmel-isi: move configure_geometry() to start_streaming()
As in set_fmt() function we only need to know which format is been set, we don't need to access the ISI hardware in this moment. So move the configure_geometry(), which access the ISI hardware, to start_streaming() will make code more consistent and simpler. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/atmel-isi.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 8bc40ca..b01086d 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -390,6 +390,11 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); + ret = configure_geometry(isi, icd->user_width, icd->user_height, + icd->current_fmt->code); + if (ret < 0) + return ret; + spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ isi_readl(isi, ISI_STATUS); @@ -477,8 +482,6 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, static int isi_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_format *f) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct atmel_isi *isi = ici->priv; struct v4l2_subdev *sd = soc_camera_to_subdev(icd); const struct soc_camera_format_xlate *xlate; struct v4l2_pix_format *pix = &f->fmt.pix; @@ -511,16 +514,6 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, if (mf->code != xlate->code) return -EINVAL; - /* Enable PM and peripheral clock before operate isi registers */ - pm_runtime_get_sync(ici->v4l2_dev.dev); - - ret = configure_geometry(isi, pix->width, pix->height, xlate->code); - - pm_runtime_put(ici->v4l2_dev.dev); - - if (ret < 0) - return ret; - pix->width = mf->width; pix->height = mf->height; pix->field = mf->field; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [media] ov2640: add support for async device registration
Move the clock detection code to the beginning of the probe(). If we meet any error in the clock detecting, then defer the probe. Signed-off-by: Josh Wu --- drivers/media/i2c/soc_camera/ov2640.c | 43 + 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index 6c6b1c3..fb9b6e9 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -1069,6 +1070,7 @@ static int ov2640_probe(struct i2c_client *client, struct ov2640_priv *priv; struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); + struct v4l2_clk *clk; int ret; if (!ssdd) { @@ -1083,13 +1085,20 @@ static int ov2640_probe(struct i2c_client *client, return -EIO; } + clk = v4l2_clk_get(&client->dev, "mclk"); + if (IS_ERR(clk)) + return -EPROBE_DEFER; + priv = devm_kzalloc(&client->dev, sizeof(struct ov2640_priv), GFP_KERNEL); if (!priv) { dev_err(&adapter->dev, "Failed to allocate memory for private data!\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_kzalloc; } + priv->clk = clk; + v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops); v4l2_ctrl_handler_init(&priv->hdl, 2); v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, @@ -1097,23 +1106,26 @@ static int ov2640_probe(struct i2c_client *client, v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); priv->subdev.ctrl_handler = &priv->hdl; - if (priv->hdl.error) - return priv->hdl.error; - - priv->clk = v4l2_clk_get(&client->dev, "mclk"); - if (IS_ERR(priv->clk)) { - ret = PTR_ERR(priv->clk); - goto eclkget; + if (priv->hdl.error) { + ret = priv->hdl.error; + goto err_kzalloc; } ret = ov2640_video_probe(client); - if (ret) { - v4l2_clk_put(priv->clk); -eclkget: - v4l2_ctrl_handler_free(&priv->hdl); - } else { - dev_info(&adapter->dev, "OV2640 Probed\n"); - } + if (ret) + goto err_probe; + + ret = v4l2_async_register_subdev(&priv->subdev); + if (ret) + goto err_probe; + + dev_info(&adapter->dev, "OV2640 Probed\n"); + return 0; + +err_probe: + v4l2_ctrl_handler_free(&priv->hdl); +err_kzalloc: + v4l2_clk_put(clk); return ret; } @@ -1122,6 +1134,7 @@ static int ov2640_remove(struct i2c_client *client) { struct ov2640_priv *priv = to_ov2640(client); + v4l2_async_unregister_subdev(&priv->subdev); v4l2_clk_put(priv->clk); v4l2_device_unregister_subdev(&priv->subdev); v4l2_ctrl_handler_free(&priv->hdl); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] iio: adc: at91_adc: correct default shtim value
Hi, Alexandre On 3/4/2014 2:07 AM, Alexandre Belloni wrote: When sample_hold_time is zero (this is the case when DT is not used or if atmel,adc-sample-hold-time is omitted), then the calculated shtim is large. Make that 0, which is the default for that register and the ADC will then use a sane value of 2/ADCCLK or 1/ADCCLK depending on the version. Signed-off-by: Alexandre Belloni Thanks for the fix and Acked-by: Josh Wu Best Regards, Josh Wu --- drivers/iio/adc/at91_adc.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 5b1aa027c034..0b103f905607 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -1004,8 +1004,11 @@ static int at91_adc_probe(struct platform_device *pdev) * the best converted final value between two channels selection * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock */ - shtim = round_up((st->sample_hold_time * adc_clk_khz / - 1000) - 1, 1); + if (st->sample_hold_time > 0) + shtim = round_up((st->sample_hold_time * adc_clk_khz / 1000) +- 1, 1); + else + shtim = 0; reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask; reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/3] iio: adc: at91 fixes
Hi, Alexandre On 3/6/2014 12:57 AM, Alexandre Belloni wrote: This series fixes a kernel crash at probe time when using the at91_adc driver through platform_data. This crash appeared in 3.13. The first patch fixes the crash. While it is already quite late, I think it would be good to get it in 3.14. The next patches restore support for at91_adc on the at91sam9g45 and at91sam9260 based boards. It would be great if they could make it in 3.14. But I'm not sure it is worth applying them to 3.13. Alexandre Belloni (3): iio: adc: at91_adc: Repair broken platform_data support ARM: at91: at91sam9g45: change at91_adc name ARM: at91: at91sam9260: change at91_adc name arch/arm/mach-at91/at91sam9260_devices.c | 2 +- arch/arm/mach-at91/at91sam9g45_devices.c | 2 +- drivers/iio/adc/at91_adc.c | 26 ++ 3 files changed, 24 insertions(+), 6 deletions(-) Thank you for the fixes. I tested the patch series in at91sam9m10g45ek and works fine. so here is my: Tested-by: Josh Wu Acked-by: Josh Wu Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [media] ov2640: add support for async device registration
Hi, Sylwester Thanks for your review. On 3/15/2014 5:17 AM, Sylwester Nawrocki wrote: Hi Josh, On 03/14/2014 11:12 AM, Josh Wu wrote: +clk = v4l2_clk_get(&client->dev, "mclk"); +if (IS_ERR(clk)) +return -EPROBE_DEFER; You should instead make it: return PTR_ERR(clk); But you will need this patch for that to work: http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/clk/clk.c?id=a34cd4666f3da84228a82f70c94b8d9b692034ea With this patch there is no need to overwrite any returned error value with EPROBE_DEFER. Thanks for the information. I will use this in v2 version. Best Regards, Josh Wu @@ -1097,23 +1106,26 @@ static int ov2640_probe(struct i2c_client *client, v4l2_ctrl_new_std(&priv->hdl,&ov2640_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); priv->subdev.ctrl_handler =&priv->hdl; -if (priv->hdl.error) -return priv->hdl.error; - -priv->clk = v4l2_clk_get(&client->dev, "mclk"); -if (IS_ERR(priv->clk)) { -ret = PTR_ERR(priv->clk); -goto eclkget; -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] [media] ov2640: add support for async device registration
Since the the v4l2_clk_get() may return a EPROBE_DEFER during async probing. So move the v4l2_clk_get() to the beginning of the probe(). Only when we get mclk successfully we continue the probe. Signed-off-by: Josh Wu --- v1 -> v2: just return PTR_ERR(clk) as it can be -EPROBE_DEFER. refined the commit message drivers/media/i2c/soc_camera/ov2640.c | 43 + 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index 6c6b1c3..7c77a15 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -1069,6 +1070,7 @@ static int ov2640_probe(struct i2c_client *client, struct ov2640_priv *priv; struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); + struct v4l2_clk *clk; int ret; if (!ssdd) { @@ -1083,13 +1085,20 @@ static int ov2640_probe(struct i2c_client *client, return -EIO; } + clk = v4l2_clk_get(&client->dev, "mclk"); + if (IS_ERR(clk)) + return PTR_ERR(clk); + priv = devm_kzalloc(&client->dev, sizeof(struct ov2640_priv), GFP_KERNEL); if (!priv) { dev_err(&adapter->dev, "Failed to allocate memory for private data!\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_kzalloc; } + priv->clk = clk; + v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops); v4l2_ctrl_handler_init(&priv->hdl, 2); v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, @@ -1097,23 +1106,26 @@ static int ov2640_probe(struct i2c_client *client, v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); priv->subdev.ctrl_handler = &priv->hdl; - if (priv->hdl.error) - return priv->hdl.error; - - priv->clk = v4l2_clk_get(&client->dev, "mclk"); - if (IS_ERR(priv->clk)) { - ret = PTR_ERR(priv->clk); - goto eclkget; + if (priv->hdl.error) { + ret = priv->hdl.error; + goto err_kzalloc; } ret = ov2640_video_probe(client); - if (ret) { - v4l2_clk_put(priv->clk); -eclkget: - v4l2_ctrl_handler_free(&priv->hdl); - } else { - dev_info(&adapter->dev, "OV2640 Probed\n"); - } + if (ret) + goto err_probe; + + ret = v4l2_async_register_subdev(&priv->subdev); + if (ret) + goto err_probe; + + dev_info(&adapter->dev, "OV2640 Probed\n"); + return 0; + +err_probe: + v4l2_ctrl_handler_free(&priv->hdl); +err_kzalloc: + v4l2_clk_put(clk); return ret; } @@ -1122,6 +1134,7 @@ static int ov2640_remove(struct i2c_client *client) { struct ov2640_priv *priv = to_ov2640(client); + v4l2_async_unregister_subdev(&priv->subdev); v4l2_clk_put(priv->clk); v4l2_device_unregister_subdev(&priv->subdev); v4l2_ctrl_handler_free(&priv->hdl); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mtd: atmel_nand: increase chip_delay
Hi, Raphael On 7/29/2014 9:27 PM, Raphael Poggi wrote: Some nand with 8k page size like Micron MT29F32G08ABAAAWP need more than 20us. Signed-off-by: Raphaël Poggi --- drivers/mtd/nand/atmel_nand.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index e321c56..77bd877 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -2099,7 +2099,7 @@ static int atmel_nand_probe(struct platform_device *pdev) } nand_chip->ecc.mode = host->board.ecc_mode; - nand_chip->chip_delay = 20; /* 20us command delay time */ + nand_chip->chip_delay = 40; /* 40us command delay time */ if (host->board.bus_width_16) /* 16-bit bus width */ nand_chip->options |= NAND_BUSWIDTH_16; I just post a patch [1] days ago which does almost the same thing to support 4k-page nand flash. personally I am fine with your patch. Brain, you only need to take care this patch. And drop my patch [1]. [1] http://patchwork.ozlabs.org/patch/372406/ Thanks. Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv2] mtd: nand: atmel_nand: retrieve NFC clock
Hi, Alexandre On 9/12/2014 1:52 AM, Alexandre Belloni wrote: From: Boris BREZILLON Signed-off-by: Boris BREZILLON Signed-off-by: Alexandre Belloni --- Changes in v2: - reworked the error path to really make the clock optional - Documented the new optional property .../devicetree/bindings/mtd/atmel-nand.txt | 1 + drivers/mtd/nand/atmel_nand.c | 25 ++ 2 files changed, 26 insertions(+) diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt index c4728839d0c1..f71e2ebab15b 100644 --- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt @@ -38,6 +38,7 @@ Optional properties: if don't want to use it. - Optional properties: - atmel,write-by-sram: boolean to enable NFC write by sram. +- clocks: phandle to the peripheral clock if it exists Examples: nand0: nand@4000,0 { diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 9c5f717bda54..69e0eb1ace54 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -27,6 +27,7 @@ * */ +#include #include #include #include @@ -96,6 +97,8 @@ struct atmel_nfc { booluse_nfc_sram; boolwrite_by_sram; + struct clk *clk; + boolis_initialized; struct completion comp_ready; struct completion comp_cmd_done; @@ -2248,6 +2251,7 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) { struct atmel_nfc *nfc = &nand_nfc; struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram; + int ret; nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs); @@ -2281,6 +2285,26 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) nfc->is_initialized = true; dev_info(&pdev->dev, "NFC is probed.\n"); + + nfc->clk = devm_clk_get(&pdev->dev, NULL); + if (!IS_ERR(nfc->clk)) { + ret = clk_prepare_enable(nfc->clk); + if (ret) + return ret; In this case, the NFC clock is not enabled, so I think nfc->is_initialized should set to false. Otherwise, the nand driver will try to use the NFC without enabled the clock. Is it better to move the code block nfc->is_initialized = true; dev_info(&pdev->dev, "NFC is probed.\n"); to just before the: return 0; Best Regards, Josh Wu + } else { + dev_warn(&pdev->dev, "NFC clock is missing"); + } + + return 0; +} + +static int atmel_nand_nfc_remove(struct platform_device *pdev) +{ + struct atmel_nfc *nfc = &nand_nfc; + + if (!IS_ERR(nfc->clk)) + clk_disable_unprepare(nfc->clk); + return 0; } @@ -2297,6 +2321,7 @@ static struct platform_driver atmel_nand_nfc_driver = { .of_match_table = of_match_ptr(atmel_nand_nfc_match), }, .probe = atmel_nand_nfc_probe, + .remove = atmel_nand_nfc_remove, }; static struct platform_driver atmel_nand_driver = { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv2] mtd: nand: atmel_nand: retrieve NFC clock
Hi, Nicolas On 9/12/2014 3:52 PM, Nicolas Ferre wrote: On 11/09/2014 19:52, Alexandre Belloni : From: Boris BREZILLON Signed-off-by: Boris BREZILLON Signed-off-by: Alexandre Belloni You may need to add Josh Wu to the list because he is the "de-facto" Maintainer of this driver. Thanks for the email. I almost miss it. Best Regards, Josh Wu Bye, --- Changes in v2: - reworked the error path to really make the clock optional - Documented the new optional property .../devicetree/bindings/mtd/atmel-nand.txt | 1 + drivers/mtd/nand/atmel_nand.c | 25 ++ 2 files changed, 26 insertions(+) diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt index c4728839d0c1..f71e2ebab15b 100644 --- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt @@ -38,6 +38,7 @@ Optional properties: if don't want to use it. - Optional properties: - atmel,write-by-sram: boolean to enable NFC write by sram. +- clocks: phandle to the peripheral clock if it exists Examples: nand0: nand@4000,0 { diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 9c5f717bda54..69e0eb1ace54 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -27,6 +27,7 @@ * */ +#include #include #include #include @@ -96,6 +97,8 @@ struct atmel_nfc { booluse_nfc_sram; boolwrite_by_sram; + struct clk *clk; + boolis_initialized; struct completion comp_ready; struct completion comp_cmd_done; @@ -2248,6 +2251,7 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) { struct atmel_nfc *nfc = &nand_nfc; struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram; + int ret; nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs); @@ -2281,6 +2285,26 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) nfc->is_initialized = true; dev_info(&pdev->dev, "NFC is probed.\n"); + + nfc->clk = devm_clk_get(&pdev->dev, NULL); + if (!IS_ERR(nfc->clk)) { + ret = clk_prepare_enable(nfc->clk); + if (ret) + return ret; + } else { + dev_warn(&pdev->dev, "NFC clock is missing"); + } + + return 0; +} + +static int atmel_nand_nfc_remove(struct platform_device *pdev) +{ + struct atmel_nfc *nfc = &nand_nfc; + + if (!IS_ERR(nfc->clk)) + clk_disable_unprepare(nfc->clk); + return 0; } @@ -2297,6 +2321,7 @@ static struct platform_driver atmel_nand_nfc_driver = { .of_match_table = of_match_ptr(atmel_nand_nfc_match), }, .probe = atmel_nand_nfc_probe, + .remove = atmel_nand_nfc_remove, }; static struct platform_driver atmel_nand_driver = { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv3] mtd: nand: atmel_nand: retrieve NFC clock
Hi, Alexandre On 9/12/2014 5:07 PM, Alexandre Belloni wrote: From: Boris BREZILLON Signed-off-by: Boris BREZILLON Signed-off-by: Alexandre Belloni --- Changes in v3: - changed the warning message to ask to update the DT - made the clocks property mandatory in the documentation - Stop claiming the NFC is probed if there is an issue when enabling the clock .../devicetree/bindings/mtd/atmel-nand.txt | 2 ++ drivers/mtd/nand/atmel_nand.c | 25 ++ 2 files changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt index c4728839d0c1..cb6cd4f8ae7a 100644 --- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt @@ -36,6 +36,7 @@ Optional properties: - reg : should specify the address and size used for NFC command registers, NFC registers and NFC Sram. NFC Sram address and size can be absent if don't want to use it. +- clocks: phandle to the peripheral clock - Optional properties: - atmel,write-by-sram: boolean to enable NFC write by sram. @@ -98,6 +99,7 @@ nand0: nand@4000 { compatible = "atmel,sama5d3-nfc"; #address-cells = <1>; #size-cells = <1>; + clocks = <&&hsmc_clk> Is it a typo here? Do you mean clocks = <&hsmc_clk> Best Regards, Josh Wu reg = < 0x7000 0x1000 /* NFC Command Registers */ 0xc000 0x0070 /* NFC HSMC regs */ diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 9c5f717bda54..d1e502f8dbd0 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -27,6 +27,7 @@ * */ +#include #include #include #include @@ -96,6 +97,8 @@ struct atmel_nfc { booluse_nfc_sram; boolwrite_by_sram; + struct clk *clk; + boolis_initialized; struct completion comp_ready; struct completion comp_cmd_done; @@ -2248,6 +2251,7 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) { struct atmel_nfc *nfc = &nand_nfc; struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram; + int ret; nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs); @@ -2279,8 +2283,28 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) nfc_writel(nfc->hsmc_regs, IDR, 0x); nfc_readl(nfc->hsmc_regs, SR); /* clear the NFC_SR */ + nfc->clk = devm_clk_get(&pdev->dev, NULL); + if (!IS_ERR(nfc->clk)) { + ret = clk_prepare_enable(nfc->clk); + if (ret) + return ret; + } else { + dev_warn(&pdev->dev, "NFC clock missing, update your Device Tree"); + } + nfc->is_initialized = true; dev_info(&pdev->dev, "NFC is probed.\n"); + + return 0; +} + +static int atmel_nand_nfc_remove(struct platform_device *pdev) +{ + struct atmel_nfc *nfc = &nand_nfc; + + if (!IS_ERR(nfc->clk)) + clk_disable_unprepare(nfc->clk); + return 0; } @@ -2297,6 +2321,7 @@ static struct platform_driver atmel_nand_nfc_driver = { .of_match_table = of_match_ptr(atmel_nand_nfc_match), }, .probe = atmel_nand_nfc_probe, + .remove = atmel_nand_nfc_remove, }; static struct platform_driver atmel_nand_driver = { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv4] mtd: nand: atmel_nand: retrieve NFC clock
Hi, Alexandre On 9/12/2014 5:40 PM, Alexandre Belloni wrote: From: Boris BREZILLON Signed-off-by: Boris BREZILLON Signed-off-by: Alexandre Belloni --- Thanks for the patch. Acked-by: Josh Wu Best Regards, Josh Wu Changes in v4: - fix typo in the documentation .../devicetree/bindings/mtd/atmel-nand.txt | 2 ++ drivers/mtd/nand/atmel_nand.c | 25 ++ 2 files changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt index c4728839d0c1..6edc3b616e98 100644 --- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt @@ -36,6 +36,7 @@ Optional properties: - reg : should specify the address and size used for NFC command registers, NFC registers and NFC Sram. NFC Sram address and size can be absent if don't want to use it. +- clocks: phandle to the peripheral clock - Optional properties: - atmel,write-by-sram: boolean to enable NFC write by sram. @@ -98,6 +99,7 @@ nand0: nand@4000 { compatible = "atmel,sama5d3-nfc"; #address-cells = <1>; #size-cells = <1>; + clocks = <&hsmc_clk> reg = < 0x7000 0x1000 /* NFC Command Registers */ 0xc000 0x0070 /* NFC HSMC regs */ diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 9c5f717bda54..d1e502f8dbd0 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -27,6 +27,7 @@ * */ +#include #include #include #include @@ -96,6 +97,8 @@ struct atmel_nfc { booluse_nfc_sram; boolwrite_by_sram; + struct clk *clk; + boolis_initialized; struct completion comp_ready; struct completion comp_cmd_done; @@ -2248,6 +2251,7 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) { struct atmel_nfc *nfc = &nand_nfc; struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram; + int ret; nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs); @@ -2279,8 +2283,28 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) nfc_writel(nfc->hsmc_regs, IDR, 0x); nfc_readl(nfc->hsmc_regs, SR); /* clear the NFC_SR */ + nfc->clk = devm_clk_get(&pdev->dev, NULL); + if (!IS_ERR(nfc->clk)) { + ret = clk_prepare_enable(nfc->clk); + if (ret) + return ret; + } else { + dev_warn(&pdev->dev, "NFC clock missing, update your Device Tree"); + } + nfc->is_initialized = true; dev_info(&pdev->dev, "NFC is probed.\n"); + + return 0; +} + +static int atmel_nand_nfc_remove(struct platform_device *pdev) +{ + struct atmel_nfc *nfc = &nand_nfc; + + if (!IS_ERR(nfc->clk)) + clk_disable_unprepare(nfc->clk); + return 0; } @@ -2297,6 +2321,7 @@ static struct platform_driver atmel_nand_nfc_driver = { .of_match_table = of_match_ptr(atmel_nand_nfc_match), }, .probe = atmel_nand_nfc_probe, + .remove = atmel_nand_nfc_remove, }; static struct platform_driver atmel_nand_driver = { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] MAINTAINERS: add atmel nand driver maintainer entry
This patch adds an entry in MAINTAINERS file for ATMEL nand driver. Signed-off-by: Josh Wu --- MAINTAINERS | 6 ++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3705430..1bdf3bf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1698,6 +1698,12 @@ M: Nicolas Ferre S: Supported F: drivers/net/ethernet/cadence/ +ATMEL NAND DRIVER +M: Josh Wu +L: linux-...@lists.infradead.org +S: Supported +F: drivers/mtd/nand/atmel_nand* + ATMEL SPI DRIVER M: Nicolas Ferre S: Supported -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: at91: remove ISI code for AT91SAM9263
Hi, Paul On 5/15/2014 4:34 PM, Paul Bolle wrote: In v2.6.25 code was added for an Image Sensor Interface (ISI) for AT91SAM9263. That code depended on the Kconfig macro CONFIG_VIDEO_AT91_ISI and its MODULE variant. The related Kconfig symbol has never been added to the tree. The net effect of this was that at91_add_device_isi() was a NOP. No one noticed because no callers of that function were added to the tree at that time. The first caller of a function with that name was added in v3.4. But that caller apparently only called the function defined for AT91SAM9G45. (that function was also added in v3.4). So even then AT91SAM9263's NOP version of at91_add_device_isi() remained unused. This means that the ISI code for AT91SAM9263 can be removed. Signed-off-by: Paul Bolle --- Untested! Could someone please verify that this definition of at91_add_device_isi() really never will be called. Right. There is no implement to support for at91sam9263 ISI. So in at91sam9263ek it will not call at91_add_device_isi(). Current ISI driver only support at91sam9g45 and later chips. Acked-by: Josh Wu Best Regards, Josh Wu arch/arm/mach-at91/at91sam9263_devices.c | 57 1 file changed, 57 deletions(-) diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 43d53d6156dd..f2dab0a872a1 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c @@ -897,63 +897,6 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {} /* - * Image Sensor Interface - * */ - -#if defined(CONFIG_VIDEO_AT91_ISI) || defined(CONFIG_VIDEO_AT91_ISI_MODULE) - -struct resource isi_resources[] = { - [0] = { - .start = AT91SAM9263_BASE_ISI, - .end= AT91SAM9263_BASE_ISI + SZ_16K - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = NR_IRQS_LEGACY + AT91SAM9263_ID_ISI, - .end= NR_IRQS_LEGACY + AT91SAM9263_ID_ISI, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device at91sam9263_isi_device = { - .name = "at91_isi", - .id = -1, - .resource = isi_resources, - .num_resources = ARRAY_SIZE(isi_resources), -}; - -void __init at91_add_device_isi(struct isi_platform_data *data, - bool use_pck_as_mck) -{ - at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ - at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ - at91_set_A_periph(AT91_PIN_PE2, 0); /* ISI_D2 */ - at91_set_A_periph(AT91_PIN_PE3, 0); /* ISI_D3 */ - at91_set_A_periph(AT91_PIN_PE4, 0); /* ISI_D4 */ - at91_set_A_periph(AT91_PIN_PE5, 0); /* ISI_D5 */ - at91_set_A_periph(AT91_PIN_PE6, 0); /* ISI_D6 */ - at91_set_A_periph(AT91_PIN_PE7, 0); /* ISI_D7 */ - at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ - at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ - at91_set_A_periph(AT91_PIN_PE10, 0);/* ISI_VSYNC */ - at91_set_B_periph(AT91_PIN_PE12, 0);/* ISI_PD8 */ - at91_set_B_periph(AT91_PIN_PE13, 0);/* ISI_PD9 */ - at91_set_B_periph(AT91_PIN_PE14, 0);/* ISI_PD10 */ - at91_set_B_periph(AT91_PIN_PE15, 0);/* ISI_PD11 */ - - if (use_pck_as_mck) { - at91_set_B_periph(AT91_PIN_PE11, 0);/* ISI_MCK (PCK3) */ - - /* TODO: register the PCK for ISI_MCK and set its parent */ - } -} -#else -void __init at91_add_device_isi(struct isi_platform_data *data, - bool use_pck_as_mck) {} -#endif - - -/* * Timer/Counter block * */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [media] ov2640: add support for async device registration
Hi, Sylwester On 3/20/2014 10:44 PM, Sylwester Nawrocki wrote: Hi Josh, On 19/03/14 10:17, Josh Wu wrote: On 3/15/2014 5:17 AM, Sylwester Nawrocki wrote: On 03/14/2014 11:12 AM, Josh Wu wrote: +clk = v4l2_clk_get(&client->dev, "mclk"); +if (IS_ERR(clk)) +return -EPROBE_DEFER; You should instead make it: return PTR_ERR(clk); But you will need this patch for that to work: http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/clk/clk.c?id=a34cd4666f3da84228a82f70c94b8d9b692034ea With this patch there is no need to overwrite any returned error value with EPROBE_DEFER. Thanks for the information. I will use this in v2 version. Oops, I missed somehow that it's v4l2_clk_get(), rather than clk_get(). So it seems it will not work when you return PTR_ERR(clk), since v4l2_clk_get() returns -ENODEV when clock is not found. right, I missed that. So this version is still valid one. The v2 that I already sent should be dropped. I think we should modify v4l2_clk_get() so it returns EPROBE_DEFER rather than ENODEV on error. I anticipate v4l2_clk_get() might be using clk_get() internally in future, and the v4l2 clk look up will be used as a fallback only. So sensor drivers should just do something like: clk = v4l2_clk_get(...); if (IS_ERR(clk)) return PTR_ERR(clk); I noticed that there are some driver like ov772x, ov9640 and etc, are not supported the async probe yet. If we return the EPROBE_DEFER for all v4l2_clk_get(), that will cause the no-async probe function work incorrectly. So IMO we can do your above suggestion after all sensors support async probe. Thanks. -- Regards, Sylwester Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] [media] ov2640: add support for async device registration
Hi, all since v4l2_clk_get() WON'T return EPROBE_DEFER. So this version of patch is invalid. Please drop this version of the patch. Sorry for the noise. Best Regards, Josh Wu On 3/20/2014 5:01 PM, Josh Wu wrote: Since the the v4l2_clk_get() may return a EPROBE_DEFER during async probing. So move the v4l2_clk_get() to the beginning of the probe(). Only when we get mclk successfully we continue the probe. Signed-off-by: Josh Wu --- v1 -> v2: just return PTR_ERR(clk) as it can be -EPROBE_DEFER. refined the commit message drivers/media/i2c/soc_camera/ov2640.c | 43 + 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index 6c6b1c3..7c77a15 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -1069,6 +1070,7 @@ static int ov2640_probe(struct i2c_client *client, struct ov2640_priv *priv; struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); + struct v4l2_clk *clk; int ret; if (!ssdd) { @@ -1083,13 +1085,20 @@ static int ov2640_probe(struct i2c_client *client, return -EIO; } + clk = v4l2_clk_get(&client->dev, "mclk"); + if (IS_ERR(clk)) + return PTR_ERR(clk); + priv = devm_kzalloc(&client->dev, sizeof(struct ov2640_priv), GFP_KERNEL); if (!priv) { dev_err(&adapter->dev, "Failed to allocate memory for private data!\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_kzalloc; } + priv->clk = clk; + v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops); v4l2_ctrl_handler_init(&priv->hdl, 2); v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, @@ -1097,23 +1106,26 @@ static int ov2640_probe(struct i2c_client *client, v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); priv->subdev.ctrl_handler = &priv->hdl; - if (priv->hdl.error) - return priv->hdl.error; - - priv->clk = v4l2_clk_get(&client->dev, "mclk"); - if (IS_ERR(priv->clk)) { - ret = PTR_ERR(priv->clk); - goto eclkget; + if (priv->hdl.error) { + ret = priv->hdl.error; + goto err_kzalloc; } ret = ov2640_video_probe(client); - if (ret) { - v4l2_clk_put(priv->clk); -eclkget: - v4l2_ctrl_handler_free(&priv->hdl); - } else { - dev_info(&adapter->dev, "OV2640 Probed\n"); - } + if (ret) + goto err_probe; + + ret = v4l2_async_register_subdev(&priv->subdev); + if (ret) + goto err_probe; + + dev_info(&adapter->dev, "OV2640 Probed\n"); + return 0; + +err_probe: + v4l2_ctrl_handler_free(&priv->hdl); +err_kzalloc: + v4l2_clk_put(clk); return ret; } @@ -1122,6 +1134,7 @@ static int ov2640_remove(struct i2c_client *client) { struct ov2640_priv *priv = to_ov2640(client); + v4l2_async_unregister_subdev(&priv->subdev); v4l2_clk_put(priv->clk); v4l2_device_unregister_subdev(&priv->subdev); v4l2_ctrl_handler_free(&priv->hdl); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] ARM: at91: #if 0 out ISI code for AT91SAM9263
Hi, Paul On 5/23/2014 7:50 PM, Paul Bolle wrote: In v2.6.25 code was added for an Image Sensor Interface (ISI) for AT91SAM9263. That code depended on the Kconfig macro CONFIG_VIDEO_AT91_ISI and its MODULE variant. The related Kconfig symbol has never been added to the tree. The net effect of this was that at91_add_device_isi() was a NOP. No one noticed because no callers of that function were added to the tree at that time. The first caller of a function with that name was added in v3.4. But that caller apparently only called the function defined for AT91SAM9G45. (that function was also added in v3.4). So even then AT91SAM9263's NOP version of at91_add_device_isi() remained unused. This means that the ISI code for AT91SAM9263 could be removed. But, since it can be useful for future reference, let's "#if 0" it instead. Signed-off-by: Paul Bolle --- v2: Jean-Christophe would like to keep the information currently hidden behind "#if defined(CONFIG_VIDEO_AT91_ISI) [...]". I'd like the reference to that Kconfig macro dropped. Using "#if 0" will do both, so that makes for a nice compromise, I'd say. I think we can keep the #if 0 as a reference so far. When the devices file is finally removed. We will add the ISI resouces to DT file. So I am ok with this. Hi, J.C. What do you think of this patch? Best Regards, Josh Wu Josh verified that this definition of at91_add_device_isi() never will be called. Thanks! Still untested! arch/arm/mach-at91/at91sam9263_devices.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 43d53d6156dd..30af3048ade5 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c @@ -900,8 +900,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {} * Image Sensor Interface * */ -#if defined(CONFIG_VIDEO_AT91_ISI) || defined(CONFIG_VIDEO_AT91_ISI_MODULE) - +#if 0 /* keep for future reference */ struct resource isi_resources[] = { [0] = { .start = AT91SAM9263_BASE_ISI, @@ -947,9 +946,6 @@ void __init at91_add_device_isi(struct isi_platform_data *data, /* TODO: register the PCK for ISI_MCK and set its parent */ } } -#else -void __init at91_add_device_isi(struct isi_platform_data *data, - bool use_pck_as_mck) {} #endif -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] iio: adc: at91: make the function handle_adc_eoc_trigger() static
The handle_adc_eoc_trigger() in only used in at91_adc.c. So make it static. Signed-off-by: Josh Wu --- drivers/iio/adc/at91_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 772e869..7807e0e 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -266,7 +266,7 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p) } /* Handler for classic adc channel eoc trigger */ -void handle_adc_eoc_trigger(int irq, struct iio_dev *idev) +static void handle_adc_eoc_trigger(int irq, struct iio_dev *idev) { struct at91_adc_state *st = iio_priv(idev); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] mtd: atmel_nand: use __iowrite32_copy for 32 bit copy
Hi, Vinod On 10/21/2014 12:06 AM, Vinod Koul wrote: The driver was also using own method to do 32bit copy, turns out we have a kernel API so use that instead Signed-off-by: Vinod Koul Thanks for the patch. Acked-by: Josh Wu BTW, is there any similar kernel API that is for the read from io? Best Regards, Josh Wu --- drivers/mtd/nand/atmel_nand.c | 10 +++--- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index e321c56..b03e80d 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -265,14 +265,10 @@ static void memcpy32_fromio(void *trg, const void __iomem *src, size_t size) *t++ = readl_relaxed(s++); } -static void memcpy32_toio(void __iomem *trg, const void *src, int size) +static inline void memcpy32_toio(void __iomem *trg, const void *src, int size) { - int i; - u32 __iomem *t = trg; - const u32 *s = src; - - for (i = 0; i < (size >> 2); i++) - writel_relaxed(*s++, t++); + /* __iowrite32_copy use 32bit size values so divide by 4 */ + __iowrite32_copy(trg, src, size/4); } /* -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] mtd: atmel_nand: use __iowrite32_copy for 32 bitcopy
Hi, On 10/21/2014 6:35 PM, Vinod Koul wrote: On Tue, Oct 21, 2014 at 12:20:06PM +0200, Herve Codina wrote: Hi, Please don't top post I didn't go deeper in atmel_nand.c code to see other accesses but old copy use writel_relaxed which is a macro to __raw_writel((__force u32) cpu_to_le32(v),c) __iowrite32_copy use directly __raw_writel(*src++, dst++) So we skip cpu_to_le32. Is it ok for all system using atmel_nand ? Also would be a good question if we need barriers as __iowrite32_copy() doesn't guarantee any ordering. Just diving the code, I found the atmel-nand code use this function to transfer write these buffer to NFC sram. And the NFC sram is not io space. Also there should has no issue in barriers as it is in a SRAM. So I think right way is use memcpy function to replace the ioread32/iowrite32. Since we use them for SRAM transfer not IO. I'll prepare a new patch which do above replace. Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] media: atmel-isi: move configure_geometry() to start_streaming()
Hi, Laurent On 8/3/2015 9:27 PM, Laurent Pinchart wrote: Hi Josh, On Monday 03 August 2015 11:56:01 Josh Wu wrote: On 7/31/2015 10:37 PM, Laurent Pinchart wrote: On Wednesday 17 June 2015 18:39:39 Josh Wu wrote: As in set_fmt() function we only need to know which format is been set, we don't need to access the ISI hardware in this moment. So move the configure_geometry(), which access the ISI hardware, to start_streaming() will make code more consistent and simpler. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/atmel-isi.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 8bc40ca..b01086d 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -390,6 +390,11 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); + ret = configure_geometry(isi, icd->user_width, icd->user_height, + icd->current_fmt->code); I would also make configure_geometry a void function, as the only failure case really can't occur. I think this case can be reached if user require a RGB565 format to capture and sensor also support RGB565 format. As atmel-isi driver will provide RGB565 support via the pass-through mode (maybe we need re-consider this part). So that will cause the configure_geometry() returns an error since it found the bus format is not Y8 or YUV422. In my opinion, we should not change configure_geometry()'s return type, until we add a insanity format check before we call configure_geometry() in future. It will really confuse the user if S_FMT accepts a format but STREAMON fails due to the format being unsupported. Could that be fixed by defaulting to a known supported format in S_FMT if the requested format isn't support ? yes, it's the right way to go. You could then remove the error check in configure_geometry(). So I will send a v2 patches, which will add one more patch to add insanity check on the S_FMT and remove the error check code in configure_geometry(). And for this patch in v2, I will add your reviewed-by tag. Is that Okay for you? Best Regards, Josh Wu Apart from that, Reviewed-by: Laurent Pinchart Thanks for the review. Best Regards, Josh Wu + if (ret < 0) + return ret; + spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ isi_readl(isi, ISI_STATUS); @@ -477,8 +482,6 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, static int isi_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_format *f) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct atmel_isi *isi = ici->priv; struct v4l2_subdev *sd = soc_camera_to_subdev(icd); const struct soc_camera_format_xlate *xlate; struct v4l2_pix_format *pix = &f->fmt.pix; @@ -511,16 +514,6 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, if (mf->code != xlate->code) return -EINVAL; - /* Enable PM and peripheral clock before operate isi registers */ - pm_runtime_get_sync(ici->v4l2_dev.dev); - - ret = configure_geometry(isi, pix->width, pix->height, xlate->code); - - pm_runtime_put(ici->v4l2_dev.dev); - - if (ret < 0) - return ret; - pix->width = mf->width; pix->height = mf->height; pix->field = mf->field; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] media: soc-camera: increase the length of clk_name on soc_of_bind()
Since in soc_of_bind() it may use the of node's full name as the clk_name, and this full name may be longer than 32 characters, take at91 i2c sensor as an example, length is 34 bytes: /ahb/apb/i2c@f8028000/camera@0x30 So this patch increase the clk_name[] array size to 64. It seems big enough so far. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/soc_camera.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index d708df4..fcf3e97 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1621,7 +1621,7 @@ static int soc_of_bind(struct soc_camera_host *ici, struct soc_camera_async_client *sasc; struct soc_of_info *info; struct i2c_client *client; - char clk_name[V4L2_SUBDEV_NAME_SIZE]; + char clk_name[V4L2_SUBDEV_NAME_SIZE + 32]; int ret; /* allocate a new subdev and add match info to it */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/3] media: atmel-isi: setup the ISI_CFG2 register directly
In the function configure_geometry(), we will setup the ISI CFG2 according to the sensor output format. It make no sense to just read back the CFG2 register and just set part of it. So just set up this register directly makes things simpler. Currently only support YUV format from camera sensor. Signed-off-by: Josh Wu Reviewed-by: Laurent Pinchart --- Changes in v2: - add Laurent's reviewed-by tag. drivers/media/platform/soc_camera/atmel-isi.c | 20 +++- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 274a6f7..0fd6bc9 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -106,24 +106,25 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) static int configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { - u32 cfg2, cr; + u32 cfg2; + /* According to sensor's output format to set cfg2 */ switch (code) { /* YUV, including grey */ case MEDIA_BUS_FMT_Y8_1X8: - cr = ISI_CFG2_GRAYSCALE; + cfg2 = ISI_CFG2_GRAYSCALE; break; case MEDIA_BUS_FMT_VYUY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_3; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; case MEDIA_BUS_FMT_UYVY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_2; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_2; break; case MEDIA_BUS_FMT_YVYU8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_1; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_1; break; case MEDIA_BUS_FMT_YUYV8_2X8: - cr = ISI_CFG2_YCC_SWAP_DEFAULT; + cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ default: @@ -131,17 +132,10 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); - - cfg2 = isi_readl(isi, ISI_CFG2); - /* Set YCC swap mode */ - cfg2 &= ~ISI_CFG2_YCC_SWAP_MODE_MASK; - cfg2 |= cr; /* Set width */ - cfg2 &= ~(ISI_CFG2_IM_HSIZE_MASK); cfg2 |= ((width - 1) << ISI_CFG2_IM_HSIZE_OFFSET) & ISI_CFG2_IM_HSIZE_MASK; /* Set height */ - cfg2 &= ~(ISI_CFG2_IM_VSIZE_MASK); cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 3/3] media: atmel-isi: add sanity check for supported formats in set_fmt()
After adding the format check in set_fmt(), we don't need any format check in configure_geometry(). So make configure_geometry() as void type. Signed-off-by: Josh Wu --- Changes in v2: - new added patch drivers/media/platform/soc_camera/atmel-isi.c | 39 +-- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index cb46aec..d0df518 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -103,17 +103,19 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) return readl(isi->regs + reg); } -static int configure_geometry(struct atmel_isi *isi, u32 width, +static void configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { u32 cfg2; /* According to sensor's output format to set cfg2 */ switch (code) { - /* YUV, including grey */ + default: + /* Grey */ case MEDIA_BUS_FMT_Y8_1X8: cfg2 = ISI_CFG2_GRAYSCALE; break; + /* YUV */ case MEDIA_BUS_FMT_VYUY8_2X8: cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; @@ -127,8 +129,6 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ - default: - return -EINVAL; } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); @@ -139,8 +139,29 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); +} - return 0; +static bool is_supported(struct soc_camera_device *icd, + const struct soc_camera_format_xlate *xlate) +{ + bool ret = true; + + switch (xlate->code) { + /* YUV, including grey */ + case MEDIA_BUS_FMT_Y8_1X8: + case MEDIA_BUS_FMT_VYUY8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_YVYU8_2X8: + case MEDIA_BUS_FMT_YUYV8_2X8: + break; + /* RGB, TODO */ + default: + dev_err(icd->parent, "not supported format: %d\n", + xlate->code); + ret = false; + } + + return ret; } static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) @@ -391,10 +412,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); - ret = configure_geometry(isi, icd->user_width, icd->user_height, + configure_geometry(isi, icd->user_width, icd->user_height, icd->current_fmt->code); - if (ret < 0) - return ret; spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ @@ -515,6 +534,10 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, if (mf->code != xlate->code) return -EINVAL; + /* check with atmel-isi support format */ + if (!is_supported(icd, xlate)) + return -EINVAL; + pix->width = mf->width; pix->height = mf->height; pix->field = mf->field; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/3] media: atmel-isi: move configure_geometry() to start_streaming()
As in set_fmt() function we only need to know which format is been set, we don't need to access the ISI hardware in this moment. So move the configure_geometry(), which access the ISI hardware, to start_streaming() will make code more consistent and simpler. Signed-off-by: Josh Wu Reviewed-by: Laurent Pinchart --- Changes in v2: - Add Laurent's reviewed-by tag. drivers/media/platform/soc_camera/atmel-isi.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 0fd6bc9..cb46aec 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -391,6 +391,11 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); + ret = configure_geometry(isi, icd->user_width, icd->user_height, + icd->current_fmt->code); + if (ret < 0) + return ret; + spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ isi_readl(isi, ISI_STATUS); @@ -478,8 +483,6 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, static int isi_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_format *f) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct atmel_isi *isi = ici->priv; struct v4l2_subdev *sd = soc_camera_to_subdev(icd); const struct soc_camera_format_xlate *xlate; struct v4l2_pix_format *pix = &f->fmt.pix; @@ -512,16 +515,6 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, if (mf->code != xlate->code) return -EINVAL; - /* Enable PM and peripheral clock before operate isi registers */ - pm_runtime_get_sync(ici->v4l2_dev.dev); - - ret = configure_geometry(isi, pix->width, pix->height, xlate->code); - - pm_runtime_put(ici->v4l2_dev.dev); - - if (ret < 0) - return ret; - pix->width = mf->width; pix->height = mf->height; pix->field = mf->field; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] ARM: at91: sama5/dt: update rstc to correct compatible string
They'll use "atmel,sama5d3-rstc" for reset function. Cc: devicet...@vger.kernel.org Signed-off-by: Josh Wu --- arch/arm/boot/dts/sama5d3.dtsi | 2 +- arch/arm/boot/dts/sama5d4.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index 9e2444b..280255b 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -1259,7 +1259,7 @@ }; rstc@fe00 { - compatible = "atmel,at91sam9g45-rstc"; + compatible = "atmel,sama5d3-rstc"; reg = <0xfe00 0x10>; }; diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi index 3ee22ee..481196c 100644 --- a/arch/arm/boot/dts/sama5d4.dtsi +++ b/arch/arm/boot/dts/sama5d4.dtsi @@ -1277,7 +1277,7 @@ }; rstc@fc068600 { - compatible = "atmel,at91sam9g45-rstc"; + compatible = "atmel,sama5d3-rstc"; reg = <0xfc068600 0x10>; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] power: reset: at91: add sama5d3 reset function
As since sama5d3, to reset the chip, we don't need to shutdown the ddr controller. So add a new compatible string and new restart function for sama5d3 and later chips. As we don't use sama5d3 ddr controller, so remove it as well. Signed-off-by: Josh Wu Acked-by: Nicolas Ferre --- drivers/power/reset/at91-reset.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c index 36dc52f..8944b63 100644 --- a/drivers/power/reset/at91-reset.c +++ b/drivers/power/reset/at91-reset.c @@ -123,6 +123,14 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode, return NOTIFY_DONE; } +static int sama5d3_restart(struct notifier_block *this, unsigned long mode, + void *cmd) +{ + writel(cpu_to_le32(AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST), + at91_rstc_base); + return NOTIFY_DONE; +} + static void __init at91_reset_status(struct platform_device *pdev) { u32 reg = readl(at91_rstc_base + AT91_RSTC_SR); @@ -155,13 +163,13 @@ static void __init at91_reset_status(struct platform_device *pdev) static const struct of_device_id at91_ramc_of_match[] = { { .compatible = "atmel,at91sam9260-sdramc", }, { .compatible = "atmel,at91sam9g45-ddramc", }, - { .compatible = "atmel,sama5d3-ddramc", }, { /* sentinel */ } }; static const struct of_device_id at91_reset_of_match[] = { { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9260_restart }, { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart }, + { .compatible = "atmel,sama5d3-rstc", .data = sama5d3_restart }, { /* sentinel */ } }; @@ -181,17 +189,21 @@ static int at91_reset_of_probe(struct platform_device *pdev) return -ENODEV; } - for_each_matching_node(np, at91_ramc_of_match) { - at91_ramc_base[idx] = of_iomap(np, 0); - if (!at91_ramc_base[idx]) { - dev_err(&pdev->dev, "Could not map ram controller address\n"); - return -ENODEV; + match = of_match_node(at91_reset_of_match, pdev->dev.of_node); + at91_restart_nb.notifier_call = match->data; + + if (match->data != sama5d3_restart) { + /* we need to shutdown the ddr controller, so get ramc base */ + for_each_matching_node(np, at91_ramc_of_match) { + at91_ramc_base[idx] = of_iomap(np, 0); + if (!at91_ramc_base[idx]) { + dev_err(&pdev->dev, "Could not map ram controller address\n"); + return -ENODEV; + } + idx++; } - idx++; } - match = of_match_node(at91_reset_of_match, pdev->dev.of_node); - at91_restart_nb.notifier_call = match->data; return register_restart_handler(&at91_restart_nb); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] media: atmel-isi: setup the ISI_CFG2 register directly
Hi, list Ping..., any feedback for this series? Best Regards, Josh Wu On 6/17/2015 6:39 PM, Josh Wu wrote: In the function configure_geometry(), we will setup the ISI CFG2 according to the sensor output format. It make no sense to just read back the CFG2 register and just set part of it. So just set up this register directly makes things simpler. Currently only support YUV format from camera sensor. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/atmel-isi.c | 20 +++- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 9070172..8bc40ca 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -105,24 +105,25 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) static int configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { - u32 cfg2, cr; + u32 cfg2; + /* According to sensor's output format to set cfg2 */ switch (code) { /* YUV, including grey */ case MEDIA_BUS_FMT_Y8_1X8: - cr = ISI_CFG2_GRAYSCALE; + cfg2 = ISI_CFG2_GRAYSCALE; break; case MEDIA_BUS_FMT_VYUY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_3; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; case MEDIA_BUS_FMT_UYVY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_2; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_2; break; case MEDIA_BUS_FMT_YVYU8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_1; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_1; break; case MEDIA_BUS_FMT_YUYV8_2X8: - cr = ISI_CFG2_YCC_SWAP_DEFAULT; + cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ default: @@ -130,17 +131,10 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); - - cfg2 = isi_readl(isi, ISI_CFG2); - /* Set YCC swap mode */ - cfg2 &= ~ISI_CFG2_YCC_SWAP_MODE_MASK; - cfg2 |= cr; /* Set width */ - cfg2 &= ~(ISI_CFG2_IM_HSIZE_MASK); cfg2 |= ((width - 1) << ISI_CFG2_IM_HSIZE_OFFSET) & ISI_CFG2_IM_HSIZE_MASK; /* Set height */ - cfg2 &= ~(ISI_CFG2_IM_VSIZE_MASK); cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] ARM: at91: at91_dt_defconfig: enable ISI and ov2640 support
On 7/28/2015 3:37 PM, Nicolas Ferre wrote: Le 16/06/2015 12:08, Josh Wu a écrit : Add Atmel-isi and ov2640 driver in defconfig Signed-off-by: Josh Wu --- Changes in v2: None arch/arm/configs/at91_dt_defconfig | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig index bcef49a..d089ec9 100644 --- a/arch/arm/configs/at91_dt_defconfig +++ b/arch/arm/configs/at91_dt_defconfig @@ -131,6 +131,12 @@ CONFIG_POWER_RESET=y CONFIG_WATCHDOG=y CONFIG_AT91SAM9X_WATCHDOG=y CONFIG_SSB=m +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_SOC_CAMERA=y +CONFIG_VIDEO_ATMEL_ISI=y +CONFIG_SOC_CAMERA_OV2640=y I would select this camera driver as a module. Your thoughts? yes, I agree. Do I need to resent the patch for this? Best Regards, Josh Wu Bye, CONFIG_FB=y CONFIG_FB_ATMEL=y CONFIG_BACKLIGHT_LCD_SUPPORT=y -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 3/3] media: atmel-isi: add sanity check for supported formats in set_fmt()
Hi, Laurent Could you have time to review this patch? so that I can send a pull request with your reviewed-by tags. Best Regards, Josh Wu On 8/5/2015 11:26 AM, Josh Wu wrote: After adding the format check in set_fmt(), we don't need any format check in configure_geometry(). So make configure_geometry() as void type. Signed-off-by: Josh Wu --- Changes in v2: - new added patch drivers/media/platform/soc_camera/atmel-isi.c | 39 +-- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index cb46aec..d0df518 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -103,17 +103,19 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) return readl(isi->regs + reg); } -static int configure_geometry(struct atmel_isi *isi, u32 width, +static void configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { u32 cfg2; /* According to sensor's output format to set cfg2 */ switch (code) { - /* YUV, including grey */ + default: + /* Grey */ case MEDIA_BUS_FMT_Y8_1X8: cfg2 = ISI_CFG2_GRAYSCALE; break; + /* YUV */ case MEDIA_BUS_FMT_VYUY8_2X8: cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; @@ -127,8 +129,6 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ - default: - return -EINVAL; } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); @@ -139,8 +139,29 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); +} - return 0; +static bool is_supported(struct soc_camera_device *icd, + const struct soc_camera_format_xlate *xlate) +{ + bool ret = true; + + switch (xlate->code) { + /* YUV, including grey */ + case MEDIA_BUS_FMT_Y8_1X8: + case MEDIA_BUS_FMT_VYUY8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_YVYU8_2X8: + case MEDIA_BUS_FMT_YUYV8_2X8: + break; + /* RGB, TODO */ + default: + dev_err(icd->parent, "not supported format: %d\n", + xlate->code); + ret = false; + } + + return ret; } static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) @@ -391,10 +412,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); - ret = configure_geometry(isi, icd->user_width, icd->user_height, + configure_geometry(isi, icd->user_width, icd->user_height, icd->current_fmt->code); - if (ret < 0) - return ret; spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ @@ -515,6 +534,10 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, if (mf->code != xlate->code) return -EINVAL; + /* check with atmel-isi support format */ + if (!is_supported(icd, xlate)) + return -EINVAL; + pix->width = mf->width; pix->height = mf->height; pix->field = mf->field; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 1/2] mtd: nand: atmel_nand: constify atmel_nand_caps structures
Hi, Corentin Thanks for the patch. On 11/20/2015 3:45 PM, LABBE Corentin wrote: All atmel_nand_caps are never modified, consitify them. Signed-off-by: LABBE Corentin Acked-by: Josh Wu Best Regards, Josh Wu --- drivers/mtd/nand/atmel_nand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 583cdd9..475c938 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -128,7 +128,7 @@ struct atmel_nand_host { struct atmel_nfc *nfc; - struct atmel_nand_caps *caps; + const struct atmel_nand_caps*caps; boolhas_pmecc; u8 pmecc_corr_cap; u16 pmecc_sector_size; @@ -2304,11 +2304,11 @@ static int atmel_nand_remove(struct platform_device *pdev) return 0; } -static struct atmel_nand_caps at91rm9200_caps = { +static const struct atmel_nand_caps at91rm9200_caps = { .pmecc_correct_erase_page = false, }; -static struct atmel_nand_caps sama5d4_caps = { +static const struct atmel_nand_caps sama5d4_caps = { .pmecc_correct_erase_page = true, }; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] mtd: nand: atmel_nand: fix a possible NULL dereference
Hi, Corentin Thanks for the patch. It looks fine to me, just one nitpick in below: On 11/20/2015 3:45 PM, LABBE Corentin wrote: of_match_device could return NULL, and so cause a NULL pointer dereference later. Signed-off-by: LABBE Corentin --- drivers/mtd/nand/atmel_nand.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 475c938..7902967 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -1496,8 +1496,9 @@ static int atmel_of_init_port(struct atmel_nand_host *host, struct atmel_nand_data *board = &host->board; enum of_gpio_flags flags = 0; - host->caps = (struct atmel_nand_caps *) - of_match_device(atmel_nand_dt_ids, host->dev)->data; + host->caps = of_device_get_match_data(host->dev); + if (!host->caps) + return 1; it's better to use -EINVAL here. Best Regards, Josh Wu if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) { if (val >= 32) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] mtd: nand: atmel_nand: fix a possible NULL dereference
Hi, Corentin On 11/24/2015 9:12 PM, LABBE Corentin wrote: On Fri, Nov 20, 2015 at 04:33:14PM +0800, Josh Wu wrote: Hi, Corentin Thanks for the patch. It looks fine to me, just one nitpick in below: On 11/20/2015 3:45 PM, LABBE Corentin wrote: of_match_device could return NULL, and so cause a NULL pointer dereference later. Signed-off-by: LABBE Corentin --- drivers/mtd/nand/atmel_nand.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 475c938..7902967 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -1496,8 +1496,9 @@ static int atmel_of_init_port(struct atmel_nand_host *host, struct atmel_nand_data *board = &host->board; enum of_gpio_flags flags = 0; - host->caps = (struct atmel_nand_caps *) - of_match_device(atmel_nand_dt_ids, host->dev)->data; + host->caps = of_device_get_match_data(host->dev); + if (!host->caps) + return 1; it's better to use -EINVAL here. Hello I do that Uwe Kleine-König said to me to do in others thread: https://lkml.org/lkml/2015/11/12/70 and https://lkml.org/lkml/2015/11/16/211 Thank you for the information. I checked the imx serial driver(drivers/tty/serial/imx.c) in serial_imx_probe(): ... ret = serial_imx_probe_dt(sport, pdev); if (ret > 0) ---> So here is why you need to return 1 in serial_imx_probe_dt(). serial_imx_probe_pdata(sport, pdev); else if (ret < 0) return ret; There has a branch to check whether ret is > 0 or < 0. So that's why you need to return 1 in imx serial driver. But in atmel_nand driver, we don't have such code for that. The atmel_of_init_port() is only used for dt probe. So if dt is not matched, just return an error. Regards Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/4] soc-camera: fix the bug which will fail to search the registered v4l2-clk
This patch set will fix a bug in soc-camera, which will fail to search the v4l2-clk if the i2c sensor is probed later than soc-camera host. It also add some clean up for v4l2-clk code and usage. Josh Wu (4): soc_camera: get the clock name by using macro: v4l2_clk_name_i2c() v4l2-clk: add new macro for v4l2_clk_name_of() v4l2-clk: add new definition: V4L2_CLK_NAME_SIZE v4l2-clk: v4l2_clk_get() also need to find the of_fullname clock drivers/media/platform/soc_camera/soc_camera.c | 23 --- drivers/media/usb/em28xx/em28xx-camera.c | 2 +- drivers/media/v4l2-core/v4l2-clk.c | 9 + include/media/v4l2-clk.h | 5 + 4 files changed, 27 insertions(+), 12 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] soc_camera: get the clock name by using macro: v4l2_clk_name_i2c()
Since v4l2_clk_name_i2c() is defined, so just reuse it. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/soc_camera.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 9d24d44..d165bff 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1393,8 +1393,8 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, ssdd->sd_pdata.regulators = NULL; shd->board_info->platform_data = ssdd; - snprintf(clk_name, sizeof(clk_name), "%d-%04x", -shd->i2c_adapter_id, shd->board_info->addr); + v4l2_clk_name_i2c(clk_name, sizeof(clk_name), + shd->i2c_adapter_id, shd->board_info->addr); icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd->clk)) { @@ -1574,8 +1574,9 @@ static int scan_async_group(struct soc_camera_host *ici, icd->sasc = sasc; icd->parent = ici->v4l2_dev.dev; - snprintf(clk_name, sizeof(clk_name), "%d-%04x", -sasd->asd.match.i2c.adapter_id, sasd->asd.match.i2c.address); + v4l2_clk_name_i2c(clk_name, sizeof(clk_name), + sasd->asd.match.i2c.adapter_id, + sasd->asd.match.i2c.address); icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd->clk)) { @@ -1676,8 +1677,8 @@ static int soc_of_bind(struct soc_camera_host *ici, client = of_find_i2c_device_by_node(remote); if (client) - snprintf(clk_name, sizeof(clk_name), "%d-%04x", -client->adapter->nr, client->addr); + v4l2_clk_name_i2c(clk_name, sizeof(clk_name), + client->adapter->nr, client->addr); else snprintf(clk_name, sizeof(clk_name), "of-%s", of_node_full_name(remote)); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/4] v4l2-clk: add new definition: V4L2_CLK_NAME_SIZE
Make all v4l2-clk's clock name use V4L2_CLK_NAME_SIZE definition. In future, if the string increased we just need to change the V4L2_CLK_NAME_SIZE once. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/soc_camera.c | 6 +++--- drivers/media/usb/em28xx/em28xx-camera.c | 2 +- include/media/v4l2-clk.h | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 673f1d4..506a569 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1362,7 +1362,7 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, struct soc_camera_host_desc *shd = &sdesc->host_desc; struct i2c_adapter *adap; struct v4l2_subdev *subdev; - char clk_name[V4L2_SUBDEV_NAME_SIZE]; + char clk_name[V4L2_CLK_NAME_SIZE]; int ret; /* First find out how we link the main client */ @@ -1528,7 +1528,7 @@ static int scan_async_group(struct soc_camera_host *ici, struct soc_camera_async_client *sasc; struct soc_camera_device *icd; struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,}; - char clk_name[V4L2_SUBDEV_NAME_SIZE]; + char clk_name[V4L2_CLK_NAME_SIZE]; unsigned int i; int ret; @@ -1634,7 +1634,7 @@ static int soc_of_bind(struct soc_camera_host *ici, struct soc_camera_async_client *sasc; struct soc_of_info *info; struct i2c_client *client; - char clk_name[V4L2_SUBDEV_NAME_SIZE + 32]; + char clk_name[V4L2_CLK_NAME_SIZE]; int ret; /* allocate a new subdev and add match info to it */ diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index ed0b3a8..121cdfc 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -322,7 +322,7 @@ int em28xx_detect_sensor(struct em28xx *dev) int em28xx_init_camera(struct em28xx *dev) { - char clk_name[V4L2_SUBDEV_NAME_SIZE]; + char clk_name[V4L2_CLK_NAME_SIZE]; struct i2c_client *client = &dev->i2c_client[dev->def_i2c_bus]; struct i2c_adapter *adap = &dev->i2c_adap[dev->def_i2c_bus]; struct em28xx_v4l2 *v4l2 = dev->v4l2; diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h index 34891ea..2b94662 100644 --- a/include/media/v4l2-clk.h +++ b/include/media/v4l2-clk.h @@ -65,6 +65,8 @@ static inline struct v4l2_clk *v4l2_clk_register_fixed(const char *dev_id, return __v4l2_clk_register_fixed(dev_id, rate, THIS_MODULE); } +#define V4L2_CLK_NAME_SIZE 64 + #define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \ "%d-%04x", adap, client) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] v4l2-clk: v4l2_clk_get() also need to find the of_fullname clock
The soc-camera host will be probed and register a v4l2_clk, but if on that moment, the i2c device is not available, then the registered v4l2_clk name is a OF string not a I2C string. So when i2c sensor probed and call v4l2_clk_get(), it only search the clock with I2C string, like "1-0030". This patch will search the clock with OF string name if fail to find the clock with I2C string name. Signed-off-by: Josh Wu --- drivers/media/v4l2-core/v4l2-clk.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c index 34e416a..297e10e 100644 --- a/drivers/media/v4l2-core/v4l2-clk.c +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -39,6 +40,7 @@ struct v4l2_clk *v4l2_clk_get(struct device *dev, const char *id) { struct v4l2_clk *clk; struct clk *ccf_clk = clk_get(dev, id); + char clk_name[V4L2_CLK_NAME_SIZE]; if (PTR_ERR(ccf_clk) == -EPROBE_DEFER) return ERR_PTR(-EPROBE_DEFER); @@ -57,6 +59,13 @@ struct v4l2_clk *v4l2_clk_get(struct device *dev, const char *id) mutex_lock(&clk_lock); clk = v4l2_clk_find(dev_name(dev)); + /* if dev_name is not found, try use the OF name to find again */ + if (PTR_ERR(clk) == -ENODEV && dev->of_node) { + v4l2_clk_name_of(clk_name, sizeof(clk_name), +of_node_full_name(dev->of_node)); + clk = v4l2_clk_find(clk_name); + } + if (!IS_ERR(clk)) atomic_inc(&clk->use_count); mutex_unlock(&clk_lock); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4] v4l2-clk: add new macro for v4l2_clk_name_of()
This macro is used to generate a OF string for a v4l2 clock. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/soc_camera.c | 4 ++-- include/media/v4l2-clk.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index d165bff..673f1d4 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1680,8 +1680,8 @@ static int soc_of_bind(struct soc_camera_host *ici, v4l2_clk_name_i2c(clk_name, sizeof(clk_name), client->adapter->nr, client->addr); else - snprintf(clk_name, sizeof(clk_name), "of-%s", -of_node_full_name(remote)); + v4l2_clk_name_of(clk_name, sizeof(clk_name), +of_node_full_name(remote)); icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd->clk)) { diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h index 3ef6e3d..34891ea 100644 --- a/include/media/v4l2-clk.h +++ b/include/media/v4l2-clk.h @@ -68,4 +68,7 @@ static inline struct v4l2_clk *v4l2_clk_register_fixed(const char *dev_id, #define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \ "%d-%04x", adap, client) +#define v4l2_clk_name_of(name, size, of_full_name) snprintf(name, size, \ + "of-%s", of_full_name) + #endif -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] power: reset: at91: add sama5d3 reset function
Hi, Maxime On 7/20/2015 3:52 PM, Maxime Ripard wrote: Hi Josh, On Mon, Jul 13, 2015 at 11:21:44AM +0800, Josh Wu wrote: On 7/11/2015 12:12 AM, Nicolas Ferre wrote: Le 10/07/2015 14:31, Maxime Ripard a écrit : On Fri, Jul 10, 2015 at 02:09:07PM +0200, Alexandre Belloni wrote: Hi, On 10/07/2015 at 15:56:52 +0800, Josh Wu wrote : I would agree with Maxime. Currently all latest chip reset function is compatible with the atmel,sama5d3-rstc. So check compatible string is enough for now. But of cause if we have other incompatible reset in future with new chip, the structure like you said is needed. We managed to avoid using of_machine_is_compatible() in all the at91 drivers. I'd like to keep it that way. It was painful enough to remove all those cpu_is_at91xxx calls. That's your call... Also, using it is trying to match strings and will result in longer boot times. Have you looked at the implementation of of_match_device? If that's really a concern to you, you should actually avoid it. I agree: let's keep it simple and use of_match_device(). Ok. I will keep it as it is now: use the (match->data != sama5d3_restart) for the condition. I'm not just that's been an option in our discussion so far. Nicolas said that he was agreeing with me, but at the same time said the complete opposite of what I was arguing for, so I'm not really sure what's really on his mind, but the two options that were discussed were to remove that test, and either: - Use of_device_is_compatible to prevent the loop execution Thank you for explaining, it is clear to me. I'll take this above option. As the of_device_is_compatible() almost same as of_match_node()/of_match_device(). Except that of_device_is_compatible() is more efficient (in this case It calls __of_device_is_compatible() directly) than of_match_node/of_match_device. - define a structure with a flag to say whether you need the ram controller quirk or not, and test that flag. Maxime Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] power: reset: at91: add sama5d3 reset function
On 7/20/2015 4:35 PM, Josh Wu wrote: Hi, Maxime On 7/20/2015 3:52 PM, Maxime Ripard wrote: Hi Josh, On Mon, Jul 13, 2015 at 11:21:44AM +0800, Josh Wu wrote: On 7/11/2015 12:12 AM, Nicolas Ferre wrote: Le 10/07/2015 14:31, Maxime Ripard a écrit : On Fri, Jul 10, 2015 at 02:09:07PM +0200, Alexandre Belloni wrote: Hi, On 10/07/2015 at 15:56:52 +0800, Josh Wu wrote : I would agree with Maxime. Currently all latest chip reset function is compatible with the atmel,sama5d3-rstc. So check compatible string is enough for now. But of cause if we have other incompatible reset in future with new chip, the structure like you said is needed. We managed to avoid using of_machine_is_compatible() in all the at91 drivers. I'd like to keep it that way. It was painful enough to remove all those cpu_is_at91xxx calls. That's your call... Also, using it is trying to match strings and will result in longer boot times. Have you looked at the implementation of of_match_device? If that's really a concern to you, you should actually avoid it. I agree: let's keep it simple and use of_match_device(). Ok. I will keep it as it is now: use the (match->data != sama5d3_restart) for the condition. I'm not just that's been an option in our discussion so far. Nicolas said that he was agreeing with me, but at the same time said the complete opposite of what I was arguing for, so I'm not really sure what's really on his mind, but the two options that were discussed were to remove that test, and either: - Use of_device_is_compatible to prevent the loop execution Thank you for explaining, it is clear to me. I'll take this above option. As the of_device_is_compatible() almost same as of_match_node()/of_match_device(). Except that of_device_is_compatible() is more efficient (in this case It calls __of_device_is_compatible() directly) than of_match_node/of_match_device. Sorry, after checking the code a little, I'd say use the of_match_node instead of of_device_is_compatible() is better. Since After check the of_device_is_compatible() we also need to call of_match_node() again. So the simplest way is just get the match data by of_match_node() first, then check the match->data. like following: match = of_match_node(at91_reset_of_match, pdev->dev.of_node); if (match->data != sama5d3_restart) { /* we need to shutdown the ddr controller, so get ramc base */ for_each_matching_node(np, at91_ramc_of_match) { at91_ramc_base[idx] = of_iomap(np, 0); if (!at91_ramc_base[idx]) { dev_err(&pdev->dev, "Could not map ram controller address\n"); return -ENODEV; } idx++; } } at91_restart_nb.notifier_call = match->data; Best Regards, Josh Wu - define a structure with a flag to say whether you need the ram controller quirk or not, and test that flag. Maxime Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] power: reset: at91: add sama5d3 reset function
On 7/20/2015 4:44 PM, Josh Wu wrote: On 7/20/2015 4:35 PM, Josh Wu wrote: Hi, Maxime On 7/20/2015 3:52 PM, Maxime Ripard wrote: Hi Josh, On Mon, Jul 13, 2015 at 11:21:44AM +0800, Josh Wu wrote: On 7/11/2015 12:12 AM, Nicolas Ferre wrote: Le 10/07/2015 14:31, Maxime Ripard a écrit : On Fri, Jul 10, 2015 at 02:09:07PM +0200, Alexandre Belloni wrote: Hi, On 10/07/2015 at 15:56:52 +0800, Josh Wu wrote : I would agree with Maxime. Currently all latest chip reset function is compatible with the atmel,sama5d3-rstc. So check compatible string is enough for now. But of cause if we have other incompatible reset in future with new chip, the structure like you said is needed. We managed to avoid using of_machine_is_compatible() in all the at91 drivers. I'd like to keep it that way. It was painful enough to remove all those cpu_is_at91xxx calls. That's your call... Also, using it is trying to match strings and will result in longer boot times. Have you looked at the implementation of of_match_device? If that's really a concern to you, you should actually avoid it. I agree: let's keep it simple and use of_match_device(). Ok. I will keep it as it is now: use the (match->data != sama5d3_restart) for the condition. I'm not just that's been an option in our discussion so far. Nicolas said that he was agreeing with me, but at the same time said the complete opposite of what I was arguing for, so I'm not really sure what's really on his mind, but the two options that were discussed were to remove that test, and either: - Use of_device_is_compatible to prevent the loop execution Thank you for explaining, it is clear to me. I'll take this above option. As the of_device_is_compatible() almost same as of_match_node()/of_match_device(). Except that of_device_is_compatible() is more efficient (in this case It calls __of_device_is_compatible() directly) than of_match_node/of_match_device. Sorry, after checking the code a little, I'd say use the of_match_node instead of of_device_is_compatible() is better. Since After check the of_device_is_compatible() we also need to call of_match_node() again. Okay, Please forget above reply. As Maxime said test the pointer is not good solution here. So I'll sent out v2 which use of_device_is_compatible(). Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/2] power: reset: at91: add sama5d3 reset function
This patch introduces a new compatible string: "atmel,sama5d3-rstc" and new reset function for sama5d3 and later chips. As in sama5d3 or later chips, we don't have to shutdown the DDR controller before reset. Shutdown the DDR controller before reset is a workaround to avoid DDR signal driving the bus, but since sama5d3 and later chips there is no such a conflict. So in this patch: 1. the sama5d3 reset function only need to write the rstc register and return. 2. we can remove the code related with sama5d3 DDR controller as we don't use it at all. Signed-off-by: Josh Wu Acked-by: Nicolas Ferre --- Changes in v2: - aligned the function parameters to be consist with the coding style - refined the commit log - add binding document changes - use of_device_is_compitable() instead .../devicetree/bindings/arm/atmel-at91.txt | 2 +- drivers/power/reset/at91-reset.c | 26 -- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt index 424ac8c..dd998b9 100644 --- a/Documentation/devicetree/bindings/arm/atmel-at91.txt +++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt @@ -87,7 +87,7 @@ One interrupt per TC channel in a TC block: RSTC Reset Controller required properties: - compatible: Should be "atmel,-rstc". - can be "at91sam9260" or "at91sam9g45" + can be "at91sam9260" or "at91sam9g45" or "sama5d3" - reg: Should contain registers location and length Example: diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c index 36dc52f..c378d4e 100644 --- a/drivers/power/reset/at91-reset.c +++ b/drivers/power/reset/at91-reset.c @@ -123,6 +123,15 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode, return NOTIFY_DONE; } +static int sama5d3_restart(struct notifier_block *this, unsigned long mode, + void *cmd) +{ + writel(cpu_to_le32(AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST), + at91_rstc_base); + + return NOTIFY_DONE; +} + static void __init at91_reset_status(struct platform_device *pdev) { u32 reg = readl(at91_rstc_base + AT91_RSTC_SR); @@ -155,13 +164,13 @@ static void __init at91_reset_status(struct platform_device *pdev) static const struct of_device_id at91_ramc_of_match[] = { { .compatible = "atmel,at91sam9260-sdramc", }, { .compatible = "atmel,at91sam9g45-ddramc", }, - { .compatible = "atmel,sama5d3-ddramc", }, { /* sentinel */ } }; static const struct of_device_id at91_reset_of_match[] = { { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9260_restart }, { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart }, + { .compatible = "atmel,sama5d3-rstc", .data = sama5d3_restart }, { /* sentinel */ } }; @@ -181,13 +190,16 @@ static int at91_reset_of_probe(struct platform_device *pdev) return -ENODEV; } - for_each_matching_node(np, at91_ramc_of_match) { - at91_ramc_base[idx] = of_iomap(np, 0); - if (!at91_ramc_base[idx]) { - dev_err(&pdev->dev, "Could not map ram controller address\n"); - return -ENODEV; + if (!of_device_is_compatible(pdev->dev.of_node, "atmel,sama5d3-rstc")) { + /* we need to shutdown the ddr controller, so get ramc base */ + for_each_matching_node(np, at91_ramc_of_match) { + at91_ramc_base[idx] = of_iomap(np, 0); + if (!at91_ramc_base[idx]) { + dev_err(&pdev->dev, "Could not map ram controller address\n"); + return -ENODEV; + } + idx++; } - idx++; } match = of_match_node(at91_reset_of_match, pdev->dev.of_node); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/2] ARM: at91: sama5/dt: update rstc to correct compatible string
They'll use "atmel,sama5d3-rstc" for reset function. Cc: devicet...@vger.kernel.org Signed-off-by: Josh Wu --- Changes in v2: None arch/arm/boot/dts/sama5d3.dtsi | 2 +- arch/arm/boot/dts/sama5d4.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index 9e2444b..280255b 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -1259,7 +1259,7 @@ }; rstc@fe00 { - compatible = "atmel,at91sam9g45-rstc"; + compatible = "atmel,sama5d3-rstc"; reg = <0xfe00 0x10>; }; diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi index 3ee22ee..481196c 100644 --- a/arch/arm/boot/dts/sama5d4.dtsi +++ b/arch/arm/boot/dts/sama5d4.dtsi @@ -1277,7 +1277,7 @@ }; rstc@fc068600 { - compatible = "atmel,at91sam9g45-rstc"; + compatible = "atmel,sama5d3-rstc"; reg = <0xfc068600 0x10>; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] media: v4l2-image-sizes.h: add SVGA, XGA and UXGA size definitions
Add SVGA, UXGA and XGA size definitions to v4l2-image-sizes.h. The definitions are sorted by alphabet order. Signed-off-by: Josh Wu --- include/media/v4l2-image-sizes.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/media/v4l2-image-sizes.h b/include/media/v4l2-image-sizes.h index 10daf92..c70c917 100644 --- a/include/media/v4l2-image-sizes.h +++ b/include/media/v4l2-image-sizes.h @@ -25,10 +25,19 @@ #define QVGA_WIDTH 320 #define QVGA_HEIGHT240 +#define SVGA_WIDTH 800 +#define SVGA_HEIGHT680 + #define SXGA_WIDTH 1280 #define SXGA_HEIGHT1024 #define VGA_WIDTH 640 #define VGA_HEIGHT 480 +#define UXGA_WIDTH 1600 +#define UXGA_HEIGHT1200 + +#define XGA_WIDTH 1024 +#define XGA_HEIGHT 768 + #endif /* _IMAGE_SIZES_H */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] media: ov2640: use the v4l2 size definitions
Reuse the v4l2 size definitions from v4l2-image-sizes.h. So we can remove the rudundent definitions from ov2640.c. Signed-off-by: Josh Wu --- drivers/media/i2c/soc_camera/ov2640.c | 82 +-- 1 file changed, 30 insertions(+), 52 deletions(-) diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index 6f2dd90..1fdce2f 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c @@ -25,6 +25,7 @@ #include #include #include +#include #define VAL_SET(x, mask, rshift, lshift) \ x) >> rshift) & mask) << lshift) @@ -268,33 +269,10 @@ struct regval_list { u8 value; }; -/* Supported resolutions */ -enum ov2640_width { - W_QCIF = 176, - W_QVGA = 320, - W_CIF = 352, - W_VGA = 640, - W_SVGA = 800, - W_XGA = 1024, - W_SXGA = 1280, - W_UXGA = 1600, -}; - -enum ov2640_height { - H_QCIF = 144, - H_QVGA = 240, - H_CIF = 288, - H_VGA = 480, - H_SVGA = 600, - H_XGA = 768, - H_SXGA = 1024, - H_UXGA = 1200, -}; - struct ov2640_win_size { char*name; - enum ov2640_width width; - enum ov2640_height height; + u32 width; + u32 height; const struct regval_list*regs; }; @@ -495,17 +473,17 @@ static const struct regval_list ov2640_init_regs[] = { static const struct regval_list ov2640_size_change_preamble_regs[] = { { BANK_SEL, BANK_SEL_DSP }, { RESET, RESET_DVP }, - { HSIZE8, HSIZE8_SET(W_UXGA) }, - { VSIZE8, VSIZE8_SET(H_UXGA) }, + { HSIZE8, HSIZE8_SET(UXGA_WIDTH) }, + { VSIZE8, VSIZE8_SET(UXGA_HEIGHT) }, { CTRL2, CTRL2_DCW_EN | CTRL2_SDE_EN | CTRL2_UV_AVG_EN | CTRL2_CMX_EN | CTRL2_UV_ADJ_EN }, - { HSIZE, HSIZE_SET(W_UXGA) }, - { VSIZE, VSIZE_SET(H_UXGA) }, + { HSIZE, HSIZE_SET(UXGA_WIDTH) }, + { VSIZE, VSIZE_SET(UXGA_HEIGHT) }, { XOFFL, XOFFL_SET(0) }, { YOFFL, YOFFL_SET(0) }, - { VHYX, VHYX_HSIZE_SET(W_UXGA) | VHYX_VSIZE_SET(H_UXGA) | + { VHYX, VHYX_HSIZE_SET(UXGA_WIDTH) | VHYX_VSIZE_SET(UXGA_HEIGHT) | VHYX_XOFF_SET(0) | VHYX_YOFF_SET(0)}, - { TEST, TEST_HSIZE_SET(W_UXGA) }, + { TEST, TEST_HSIZE_SET(UXGA_WIDTH) }, ENDMARKER, }; @@ -519,45 +497,45 @@ static const struct regval_list ov2640_size_change_preamble_regs[] = { { RESET, 0x00} static const struct regval_list ov2640_qcif_regs[] = { - PER_SIZE_REG_SEQ(W_QCIF, H_QCIF, 3, 3, 4), + PER_SIZE_REG_SEQ(QCIF_WIDTH, QCIF_HEIGHT, 3, 3, 4), ENDMARKER, }; static const struct regval_list ov2640_qvga_regs[] = { - PER_SIZE_REG_SEQ(W_QVGA, H_QVGA, 2, 2, 4), + PER_SIZE_REG_SEQ(QVGA_WIDTH, QVGA_HEIGHT, 2, 2, 4), ENDMARKER, }; static const struct regval_list ov2640_cif_regs[] = { - PER_SIZE_REG_SEQ(W_CIF, H_CIF, 2, 2, 8), + PER_SIZE_REG_SEQ(CIF_WIDTH, CIF_HEIGHT, 2, 2, 8), ENDMARKER, }; static const struct regval_list ov2640_vga_regs[] = { - PER_SIZE_REG_SEQ(W_VGA, H_VGA, 0, 0, 2), + PER_SIZE_REG_SEQ(VGA_WIDTH, VGA_HEIGHT, 0, 0, 2), ENDMARKER, }; static const struct regval_list ov2640_svga_regs[] = { - PER_SIZE_REG_SEQ(W_SVGA, H_SVGA, 1, 1, 2), + PER_SIZE_REG_SEQ(SVGA_WIDTH, SVGA_HEIGHT, 1, 1, 2), ENDMARKER, }; static const struct regval_list ov2640_xga_regs[] = { - PER_SIZE_REG_SEQ(W_XGA, H_XGA, 0, 0, 2), + PER_SIZE_REG_SEQ(XGA_WIDTH, XGA_HEIGHT, 0, 0, 2), { CTRLI,0x00}, ENDMARKER, }; static const struct regval_list ov2640_sxga_regs[] = { - PER_SIZE_REG_SEQ(W_SXGA, H_SXGA, 0, 0, 2), + PER_SIZE_REG_SEQ(SXGA_WIDTH, SXGA_HEIGHT, 0, 0, 2), { CTRLI,0x00}, { R_DVP_SP, 2 | R_DVP_SP_AUTO_MODE }, ENDMARKER, }; static const struct regval_list ov2640_uxga_regs[] = { - PER_SIZE_REG_SEQ(W_UXGA, H_UXGA, 0, 0, 0), + PER_SIZE_REG_SEQ(UXGA_WIDTH, UXGA_HEIGHT, 0, 0, 0), { CTRLI,0x00}, { R_DVP_SP, 0 | R_DVP_SP_AUTO_MODE }, ENDMARKER, @@ -567,14 +545,14 @@ static const struct regval_list ov2640_uxga_regs[] = { {.name = n, .width = w , .height = h, .regs = r } static const struct ov2640_win_size ov2640_supported_win_sizes[] = { - OV2640_SIZE("QCIF", W_QCIF, H_QCIF, ov2640_qcif_regs), - OV2640_SIZE("QVGA", W_QVGA, H_QVGA, ov2640_qvga_regs), - OV2640_SIZE("CIF", W_CIF, H_CIF, ov2640_cif_regs), - OV2640_SIZE("VGA", W_VGA, H_VGA, ov2640_vga_regs), - OV2640_SIZE("SVGA", W_SVGA, H_SVGA, ov2640_svga_regs), - OV2640_SIZE("XGA", W_XGA, H_XGA, ov2640_xga_regs), - OV26
Re: [PATCH 1/2] media: v4l2-image-sizes.h: add SVGA, XGA and UXGA size definitions
Hi, Sylwester and Mauro On 11/25/2014 6:34 PM, Sylwester Nawrocki wrote: Hi Josh, On 25/11/14 09:54, Josh Wu wrote: Add SVGA, UXGA and XGA size definitions to v4l2-image-sizes.h. The definitions are sorted by alphabet order. Signed-off-by: Josh Wu --- include/media/v4l2-image-sizes.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/media/v4l2-image-sizes.h b/include/media/v4l2-image-sizes.h index 10daf92..c70c917 100644 --- a/include/media/v4l2-image-sizes.h +++ b/include/media/v4l2-image-sizes.h @@ -25,10 +25,19 @@ #define QVGA_WIDTH320 #define QVGA_HEIGHT 240 +#define SVGA_WIDTH 800 +#define SVGA_HEIGHT680 I think this should be 600. With that fixed, for both patches: Yes, right, It should be 600. It's my bad with such terrible typo here. Hi, Mauro I saw this patch is already merged in the media_tree. But not changing the SVGA_HEIGHT to 600. Would it possible for you to re-modify this commit in the media_tree to fix the SVGA_HEIGHT as 600? Or need I resend the patch or a fix for this? Sorry for such an inconvinencie. Acked-by: Sylwester Nawrocki Thanks a again. Best Regards, Josh Wu #define SXGA_WIDTH1280 #define SXGA_HEIGHT 1024 #define VGA_WIDTH 640 #define VGA_HEIGHT480 +#define UXGA_WIDTH 1600 +#define UXGA_HEIGHT1200 + +#define XGA_WIDTH 1024 +#define XGA_HEIGHT 768 + #endif /* _IMAGE_SIZES_H */ -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 3/3] ARM: at91: sama5d4: Add SFR
Hi, Alexandre On 11/26/2014 12:40 AM, Alexandre Belloni wrote: The sama4d4 has Special Function Registers that allow to manage DDR, OHCI, EBI and AIC interrupt redirection. Just a nitpick, It should be sama5d4, not sama4d4. Best Regards, Josh Wu Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon --- arch/arm/boot/dts/sama5d4.dtsi | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi index e0157b0f075c..9e281e22d591 100644 --- a/arch/arm/boot/dts/sama5d4.dtsi +++ b/arch/arm/boot/dts/sama5d4.dtsi @@ -826,6 +826,11 @@ status = "disabled"; }; + sfr: sfr@f8028000 { + compatible = "atmel,sama5d4-sfr", "syscon"; + reg = <0xf8028000 0x4000>; + }; + mmc1: mmc@fc00 { compatible = "atmel,hsmci"; reg = <0xfc00 0x600>; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] media: v4l2-image-sizes.h: add SVGA, XGA and UXGA size definitions
Hi, Guennadi On 11/26/2014 6:23 AM, Guennadi Liakhovetski wrote: Hi Josh, On Tue, 25 Nov 2014, Josh Wu wrote: Add SVGA, UXGA and XGA size definitions to v4l2-image-sizes.h. The definitions are sorted by alphabet order. Signed-off-by: Josh Wu Thanks for your patches. I'm ok with these two, but the second of them depends on the first one, and the first one wouldn't (normally) be going via the soc-camera tree. Mauro, how would you prefer to handle this? Should I pick up and push to you both of them or postpone #2 until the next merge window? The first patch is already merged in the media_tree. If the soc-camera tree will be merged to the media_tree, then there should have no dependency issue. Am I understanding correct? Best Regards, Josh Wu Thanks Guennadi --- include/media/v4l2-image-sizes.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/media/v4l2-image-sizes.h b/include/media/v4l2-image-sizes.h index 10daf92..c70c917 100644 --- a/include/media/v4l2-image-sizes.h +++ b/include/media/v4l2-image-sizes.h @@ -25,10 +25,19 @@ #define QVGA_WIDTH320 #define QVGA_HEIGHT 240 +#define SVGA_WIDTH 800 +#define SVGA_HEIGHT680 + #define SXGA_WIDTH1280 #define SXGA_HEIGHT 1024 #define VGA_WIDTH 640 #define VGA_HEIGHT480 +#define UXGA_WIDTH 1600 +#define UXGA_HEIGHT1200 + +#define XGA_WIDTH 1024 +#define XGA_HEIGHT 768 + #endif /* _IMAGE_SIZES_H */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 2/2] ARM: at91: dts: sama5d4: add dts for sama5d4 xplained board
On 3/4/2015 7:07 PM, Nicolas Ferre wrote: Le 04/03/2015 03:51, Josh Wu a écrit : Add at91 sama5d4 xplained board support. Signed-off-by: Josh Wu --- Changes in v4: - Thanks to Bo Shen to find following leds issues: 1. the leds' label is changed in new xplained board. 2. as piod bank is disabled in sama5d4, that will whole led driver not work. So just disable the led which used piod. Changes in v3: - add phy0 child node under macb0 - rebase on top of linux next, re-formated the arch/arm/boot/dts/Makefile Changes in v2: - to be sorted by memory address, put the adc dt node after usart4. arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/at91-sama5d4_xplained.dts | 239 2 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/at91-sama5d4_xplained.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index a1c776b..5c189a5 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -42,7 +42,8 @@ dtb-$(CONFIG_SOC_SAM_V7) += \ sama5d34ek.dtb \ sama5d35ek.dtb \ sama5d36ek.dtb \ - at91-sama5d4ek.dtb + at91-sama5d4ek.dtb \ + at91-sama5d4_xplained.dtb dtb-$(CONFIG_ARCH_ATLAS6) += \ atlas6-evb.dtb dtb-$(CONFIG_ARCH_ATLAS7) += \ diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts new file mode 100644 index 000..af8f4f5 --- /dev/null +++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts @@ -0,0 +1,239 @@ +/* + * at91-sama5d4_xplained.dts - Device Tree file for SAMA5D4 Xplained board + * + * Copyright (C) 2015 Atmel, + *2015 Josh Wu + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file 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 file 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. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +/dts-v1/; +#include "sama5d4.dtsi" + +/ { + model = "Atmel SAMA5D4 Xplained"; + compatible = "atmel,sama5d4-xplained", "atmel,sama5d4", "atmel,sama5"; + + chosen { + bootargs = "console=ttyS0,115200 ignore_loglevel earlyprintk"; + }; + + memory { + reg = <0x2000 0x2000>; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + main_clock: clock@0 { + compatible = "atmel,osc", "fixed-clock"; + clock-frequency = <1200>; + }; + + slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal { + clock-frequency = <1200>; + }; + }; + + ahb { + apb { + spi0: spi@f801 { + cs-gpios = <&pioC 3 0>, <0>, <0>, <0>; + status = "okay"; + m25p80@0 { +
[PATCH v2] ARM: at91: dts: sama5d4: add dts for sama5d4 xplained board
Add at91 sama5d4 xplained board support. Signed-off-by: Josh Wu --- Changes in v2: - to be sorted by memory address, put the adc dt node after usart4. arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/at91-sama5d4_xplained.dts | 232 2 files changed, 233 insertions(+) create mode 100644 arch/arm/boot/dts/at91-sama5d4_xplained.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 91bd5bd..bbfbad6 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -49,6 +49,7 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb dtb-$(CONFIG_ARCH_AT91)+= sama5d35ek.dtb dtb-$(CONFIG_ARCH_AT91)+= sama5d36ek.dtb # sama5d4 +dtb-$(CONFIG_ARCH_AT91)+= at91-sama5d4_xplained.dtb dtb-$(CONFIG_ARCH_AT91)+= at91-sama5d4ek.dtb dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts new file mode 100644 index 000..a04c3c8 --- /dev/null +++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts @@ -0,0 +1,232 @@ +/* + * at91-sama5d4_xplained.dts - Device Tree file for SAMA5D4 Xplained board + * + * Copyright (C) 2015 Atmel, + *2015 Josh Wu + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file 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 file 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. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +/dts-v1/; +#include "sama5d4.dtsi" + +/ { + model = "Atmel SAMA5D4 Xplained"; + compatible = "atmel,sama5d4-xplained", "atmel,sama5d4", "atmel,sama5"; + + chosen { + bootargs = "console=ttyS0,115200 ignore_loglevel earlyprintk"; + }; + + memory { + reg = <0x2000 0x2000>; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + main_clock: clock@0 { + compatible = "atmel,osc", "fixed-clock"; + clock-frequency = <1200>; + }; + + slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal { + clock-frequency = <1200>; + }; + }; + + ahb { + apb { + spi0: spi@f801 { + cs-gpios = <&pioC 3 0>, <0>, <0>, <0>; + status = "okay"; + m25p80@0 { + compatible = "atmel,at25df321a"; + spi-max-frequency = <5000>; + reg = <0>; + }; + }; + + macb0: ethernet@f802 { + phy-mode = "rmii"; + status = "okay"; +
[PATCH] ARM: at91: dts: sama5d4ek: add leds in DT node
Add the leds DT node in the dts file. In the leds, d10 is set as heartbeat led. Signed-off-by: Josh Wu --- arch/arm/boot/dts/at91-sama5d4ek.dts | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/boot/dts/at91-sama5d4ek.dts b/arch/arm/boot/dts/at91-sama5d4ek.dts index 9198b71..0c418be 100644 --- a/arch/arm/boot/dts/at91-sama5d4ek.dts +++ b/arch/arm/boot/dts/at91-sama5d4ek.dts @@ -257,4 +257,26 @@ gpio-key,wakeup; }; }; + + leds { + compatible = "gpio-leds"; + status = "okay"; + + d8 { + label = "d8"; + /* PE28, conflicts with usart4 rts pin */ + gpios = <&pioE 28 GPIO_ACTIVE_LOW>; + }; + + d9 { + label = "d9"; + gpios = <&pioE 9 GPIO_ACTIVE_HIGH>; + }; + + d10 { + label = "d10"; + gpios = <&pioE 8 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + }; + }; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] ARM: at91: dts: sama5d4: add dts for sama5d4 xplained board
Hi, Boris On 2/9/2015 5:24 PM, Boris Brezillon wrote: Hi Josh, On Mon, 9 Feb 2015 17:17:03 +0800 Josh Wu wrote: Add at91 sama5d4 xplained board support. Signed-off-by: Josh Wu --- Changes in v2: - to be sorted by memory address, put the adc dt node after usart4. arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/at91-sama5d4_xplained.dts | 232 2 files changed, 233 insertions(+) create mode 100644 arch/arm/boot/dts/at91-sama5d4_xplained.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 91bd5bd..bbfbad6 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -49,6 +49,7 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb # sama5d4 +dtb-$(CONFIG_ARCH_AT91)+= at91-sama5d4_xplained.dtb dtb-$(CONFIG_ARCH_AT91) += at91-sama5d4ek.dtb dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts new file mode 100644 index 000..a04c3c8 --- /dev/null +++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts @@ -0,0 +1,232 @@ +/* + * at91-sama5d4_xplained.dts - Device Tree file for SAMA5D4 Xplained board + * + * Copyright (C) 2015 Atmel, + *2015 Josh Wu + * [...] + ahb { + apb { + spi0: spi@f801 { + cs-gpios = <&pioC 3 0>, <0>, <0>, <0>; + status = "okay"; + m25p80@0 { + compatible = "atmel,at25df321a"; + spi-max-frequency = <5000>; + reg = <0>; + }; + }; + + macb0: ethernet@f802 { + phy-mode = "rmii"; + status = "okay"; Could you define the PHY device attached to this ethernet MAC IP ? ethernet-phy@1 { reg = <0x1>; /* * interrupt-parent = <&pioB>; * interrupts = <25 * IRQ_TYPE_EDGE_FALLING>; */ /* ... */ }; Ok, I will add this in next version. Thanks. Best Regards, Josh Wu Best Regards, Boris -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] ARM: at91: dts: sama5d4: add dts for sama5d4 xplained board
Hi, Alexandre On 2/10/2015 2:10 AM, Alexandre Belloni wrote: Hi Josh, On 09/02/2015 at 17:17:03 +0800, Josh Wu wrote : Add at91 sama5d4 xplained board support. Signed-off-by: Josh Wu --- Changes in v2: - to be sorted by memory address, put the adc dt node after usart4. arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/at91-sama5d4_xplained.dts | 232 2 files changed, 233 insertions(+) create mode 100644 arch/arm/boot/dts/at91-sama5d4_xplained.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 91bd5bd..bbfbad6 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -49,6 +49,7 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb # sama5d4 +dtb-$(CONFIG_ARCH_AT91)+= at91-sama5d4_xplained.dtb That is changed in v3.20, have a look at: http://git.kernel.org/cgit/linux/kernel/git/arm/arm-soc.git/tree/arch/arm/boot/dts/Makefile?h=for-next Thanks for the information. I'll check this. Best Regards, Josh Wu dtb-$(CONFIG_ARCH_AT91) += at91-sama5d4ek.dtb dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts new file mode 100644 index 000..a04c3c8 --- /dev/null +++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts @@ -0,0 +1,232 @@ +/* + * at91-sama5d4_xplained.dts - Device Tree file for SAMA5D4 Xplained board + * + * Copyright (C) 2015 Atmel, + *2015 Josh Wu + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file 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 file 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. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +/dts-v1/; +#include "sama5d4.dtsi" + +/ { + model = "Atmel SAMA5D4 Xplained"; + compatible = "atmel,sama5d4-xplained", "atmel,sama5d4", "atmel,sama5"; + + chosen { + bootargs = "console=ttyS0,115200 ignore_loglevel earlyprintk"; + }; + + memory { + reg = <0x2000 0x2000>; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + main_clock: clock@0 { + compatible = "atmel,osc", "fixed-clock"; + clock-frequency = <1200>; + }; + + slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal { + clock-frequency = <1200>; + }; + }; + + ahb { + apb { + spi0: spi@f801 { + cs-gpios = <&pioC 3 0>, <0>, <0>, <0>; + status = "okay"; + m25p80@0 { + compatible = "atmel,at25df321a"; +
[PATCH v3 2/2] ARM: at91: dts: sama5d4: add dts for sama5d4 xplained board
Add at91 sama5d4 xplained board support. Signed-off-by: Josh Wu --- Changes in v3: - add phy0 child node under macb0 - rebase on top of linux next, re-formated the arch/arm/boot/dts/Makefile Changes in v2: - to be sorted by memory address, put the adc dt node after usart4. arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/at91-sama5d4_xplained.dts | 238 2 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/at91-sama5d4_xplained.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index a1c776b..5c189a5 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -42,7 +42,8 @@ dtb-$(CONFIG_SOC_SAM_V7) += \ sama5d34ek.dtb \ sama5d35ek.dtb \ sama5d36ek.dtb \ - at91-sama5d4ek.dtb + at91-sama5d4ek.dtb \ + at91-sama5d4_xplained.dtb dtb-$(CONFIG_ARCH_ATLAS6) += \ atlas6-evb.dtb dtb-$(CONFIG_ARCH_ATLAS7) += \ diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts new file mode 100644 index 000..9464e4a --- /dev/null +++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts @@ -0,0 +1,238 @@ +/* + * at91-sama5d4_xplained.dts - Device Tree file for SAMA5D4 Xplained board + * + * Copyright (C) 2015 Atmel, + *2015 Josh Wu + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file 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 file 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. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +/dts-v1/; +#include "sama5d4.dtsi" + +/ { + model = "Atmel SAMA5D4 Xplained"; + compatible = "atmel,sama5d4-xplained", "atmel,sama5d4", "atmel,sama5"; + + chosen { + bootargs = "console=ttyS0,115200 ignore_loglevel earlyprintk"; + }; + + memory { + reg = <0x2000 0x2000>; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + main_clock: clock@0 { + compatible = "atmel,osc", "fixed-clock"; + clock-frequency = <1200>; + }; + + slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal { + clock-frequency = <1200>; + }; + }; + + ahb { + apb { + spi0: spi@f801 { + cs-gpios = <&pioC 3 0>, <0>, <0>, <0>; + status = "okay"; + m25p80@0 { + compatible = "atmel,at25df321a"; + spi-max-frequency = <5000>; + reg = <0>; + }; + }; + + macb0: ethernet@f802 { +
[PATCH v3 1/2] ARM: at91: sama5d4/dts: add #{address, size}_cell properties for macb0
macb0 DT node can have phy child nodes, so add the #{address, size}_cell for macb0 node. Signed-off-by: Josh Wu --- Changes in v3: - new added Changes in v2: None arch/arm/boot/dts/sama5d4.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi index d986b41..07953f2 100644 --- a/arch/arm/boot/dts/sama5d4.dtsi +++ b/arch/arm/boot/dts/sama5d4.dtsi @@ -852,6 +852,8 @@ interrupts = <54 IRQ_TYPE_LEVEL_HIGH 3>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_macb0_rmii>; + #address-cells = <1>; + #size-cells = <0>; clocks = <&macb0_clk>, <&macb0_clk>; clock-names = "hclk", "pclk"; status = "disabled"; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: at91: dts: sama5d4: add dts for sama5d4 xplained board
add at91 sama5d4 xplained board support. Signed-off-by: Josh Wu --- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/at91-sama5d4_xplained.dts | 234 2 files changed, 235 insertions(+) create mode 100644 arch/arm/boot/dts/at91-sama5d4_xplained.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 38c89ca..4994052 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -49,6 +49,7 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb dtb-$(CONFIG_ARCH_AT91)+= sama5d35ek.dtb dtb-$(CONFIG_ARCH_AT91)+= sama5d36ek.dtb # sama5d4 +dtb-$(CONFIG_ARCH_AT91)+= at91-sama5d4_xplained.dtb dtb-$(CONFIG_ARCH_AT91)+= at91-sama5d4ek.dtb dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts new file mode 100644 index 000..04a9679 --- /dev/null +++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts @@ -0,0 +1,234 @@ +/* + * at91-sama5d4_xplained.dts - Device Tree file for SAMA5D4 Xplained board + * + * Copyright (C) 2015 Atmel, + *2015 Josh Wu + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file 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 file 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. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +/dts-v1/; +#include "sama5d4.dtsi" + +/ { + model = "Atmel SAMA5D4 Xplained"; + compatible = "atmel,sama5d4-xplained", "atmel,sama5d4", "atmel,sama5"; + + chosen { + bootargs = "console=ttyS0,115200 ignore_loglevel earlyprintk"; + }; + + memory { + reg = <0x2000 0x2000>; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + main_clock: clock@0 { + compatible = "atmel,osc", "fixed-clock"; + clock-frequency = <1200>; + }; + + slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal { + clock-frequency = <1200>; + }; + }; + + ahb { + apb { + adc0: adc@fc034000 { + /* The vref depends on JP22 of EK. If connect 1-2 then use 3.3V. connect 2-3 use 3.0V */ + atmel,adc-vref = <3300>; + /*atmel,adc-ts-wires = <4>;*/ /* Set up ADC touch screen */ + status = "okay";/* Enable ADC IIO support */ + }; + + spi0: spi@f801 { + cs-gpios = <&pioC 3 0>, <0>, <0>, <0>; + status = "okay"; + m25p80@0 { + compatible = "atmel,at25df321a"; +
Re: [PATCH 2/4] mtd: nand: atmel: Update DT documentation after splitting NFC and NAND
Hi, Boris, Brian On 2/2/2015 5:42 PM, Boris Brezillon wrote: Hi Brian, On Sun, 1 Feb 2015 23:57:37 -0800 Brian Norris wrote: Hi Boris, BTW, this series has a few conflicts with other things I have queued, so you'll need to refresh. Yes, that's not a problem, but I'd like to be sure this is the way we want to go before rebasing this series. On Thu, Dec 04, 2014 at 11:30:12PM +0100, Boris Brezillon wrote: The NAND and NFC (NAND Flash Controller) were linked together with a parent <-> child relationship. This model has several drawbacks: - it does not allow for multiple NAND chip handling while the controller support multi-chip (even though the driver is not ready yet) - it mixes NAND partitions and NFC nodes at the same level (which is a bit disturbing) I agree that this is disturbing. (FWIW, it also seems a bit disturbing that atmel_nand.c actually registers two different drivers and the tries to synchronize them; this seems like it could be handled better, but I'm not sure how at the moment.) Yep, that's my feeling too, but I'm not sure how this could/should be done. My problem here is that the pinmux should be requested by the EBI device because the EBI manages several type of devices and the data and address signals are shared by all the devices, hence the idea of defining the nand chip node under the EBI node. In the other hand, the NFC is not part of the EBI bus, and thus should not be defined under the EBI node. This might lead to the NFC device being probed before the NAND chip, hence the need for this synchronization. OMHO, there is another way, which is change the NFC node to many NFC properties, just like PMECC. As NFC, PMECC or hamming ecc HW could be part of current NAND node (in sama5, HSMC maybe a better name for this node. ) And this change can avoid the sync problem and avoid two drivers in atmel_nand.c. - the introduction of the EBI bus implies defining NAND chips under the EBI node, and the ranges available under the EBI node should be restricted to EBI address space, while the NFC references several registers outside of these EBI ranges. That's an interesting bit. I've actually run across this sort of problem on other SoCs, where we have a relationship between two pieces of hardware--the NAND chip and the NAND controller--where the former might be on one bus (like your EBI bus, with chip selects), and the latter is part of the top-level MMIO register space. But can you elaborate here a bit more? Does the NAND chip actually need to be represented under your EBI bus? Yes, as said above this is all about pinmux conflicts, the NAND controller has to request the appropriate pinmux for its NAND chips but it will conflict with the pinmux requested by the EBI bus (data and address signals are shared by all the devices connected on the EBI). Move the NFC node outside of the NAND node, to get a more future-proof model. I'm curious if an alternative solution might work, maybe one like the Allwiner NAND (sunxi-nand) DT, which just reverses the roles; the 'NFC' is the parent of the NAND chip(s). We've seen this pattern in other contexts too. I also prefer this. Then the dt node should looks like finally: nand (SMC may be more correct) node { PMECC properties NFC properties --> we can make the NFC not a node, just many NFC properties. pinctrl-nand0 nand chip 0: { partitions... } pinctrl-nand1 nand chip 1: { partitions... } } I would have preferred this solution too, but the EBI/pinmux constraint explained above prevents this approach. I am not very clear about the pinmux constraint. Maybe we just leave one DT node (either EBI or current nand node) to take care the pins. What I can do though, is reverse the referencing: reference nand chips from the nand controller node. I guess the dt looks like: (correct me if I am wrong) EBI node { pinctrl-nand0 nand chip 0: { partitions... } pinctrl-nand1 nand chip 1: { partitions... } } nand (SMC/HSMC may be more correct) node { PMECC properties NFC properties --> we can make the NFC not a node, just many NFC properties. &nand chip0 &nand chip1 } This is still looks nice to me. Josh, Brian, any idea to solve this EBI/nand-chip/nand-controller dependency problem is welcome. Best Regards, Boris Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/4] mtd: nand: atmel: Update DT documentation after splitting NFC and NAND
Hi, Boris Thanks a lot for your explanation, check my reply for more description for my suggestion. On 2/3/2015 5:37 PM, Boris Brezillon wrote: On Tue, 3 Feb 2015 16:46:15 +0800 Josh Wu wrote: Hi, Boris, Brian On 2/2/2015 5:42 PM, Boris Brezillon wrote: Hi Brian, On Sun, 1 Feb 2015 23:57:37 -0800 Brian Norris wrote: Hi Boris, BTW, this series has a few conflicts with other things I have queued, so you'll need to refresh. Yes, that's not a problem, but I'd like to be sure this is the way we want to go before rebasing this series. On Thu, Dec 04, 2014 at 11:30:12PM +0100, Boris Brezillon wrote: The NAND and NFC (NAND Flash Controller) were linked together with a parent <-> child relationship. This model has several drawbacks: - it does not allow for multiple NAND chip handling while the controller support multi-chip (even though the driver is not ready yet) - it mixes NAND partitions and NFC nodes at the same level (which is a bit disturbing) I agree that this is disturbing. (FWIW, it also seems a bit disturbing that atmel_nand.c actually registers two different drivers and the tries to synchronize them; this seems like it could be handled better, but I'm not sure how at the moment.) Yep, that's my feeling too, but I'm not sure how this could/should be done. My problem here is that the pinmux should be requested by the EBI device because the EBI manages several type of devices and the data and address signals are shared by all the devices, hence the idea of defining the nand chip node under the EBI node. In the other hand, the NFC is not part of the EBI bus, and thus should not be defined under the EBI node. This might lead to the NFC device being probed before the NAND chip, hence the need for this synchronization. OMHO, there is another way, which is change the NFC node to many NFC properties, just like PMECC. As NFC, PMECC or hamming ecc HW could be part of current NAND node (in sama5, HSMC maybe a better name for this node. ) And this change can avoid the sync problem and avoid two drivers in atmel_nand.c. Sorry I don't get it... You gave a pseudo DT example in your following answers but I still don't understand how you'll link the NFC and its associated NAND chips. - the introduction of the EBI bus implies defining NAND chips under the EBI node, and the ranges available under the EBI node should be restricted to EBI address space, while the NFC references several registers outside of these EBI ranges. That's an interesting bit. I've actually run across this sort of problem on other SoCs, where we have a relationship between two pieces of hardware--the NAND chip and the NAND controller--where the former might be on one bus (like your EBI bus, with chip selects), and the latter is part of the top-level MMIO register space. But can you elaborate here a bit more? Does the NAND chip actually need to be represented under your EBI bus? Yes, as said above this is all about pinmux conflicts, the NAND controller has to request the appropriate pinmux for its NAND chips but it will conflict with the pinmux requested by the EBI bus (data and address signals are shared by all the devices connected on the EBI). Move the NFC node outside of the NAND node, to get a more future-proof model. I'm curious if an alternative solution might work, maybe one like the Allwiner NAND (sunxi-nand) DT, which just reverses the roles; the 'NFC' is the parent of the NAND chip(s). We've seen this pattern in other contexts too. I also prefer this. Then the dt node should looks like finally: nand (SMC may be more correct) node { This nand node contains nand chip nodes, so 'nand' is definitely not the appropriate name for this node. We could name it SMC, but I'd like to keep EBI (External Bus Interface), because the only thing that can register child devices in linux are busses (or MFD devices :-)). The SMC (Static Memory Controller) is just a additional control logic acting on top of the EBI. After further thought, It seems the SMC should be correct name for nand chips' parent. Before SAMA5 chips, the PMECC/ECC registers address is out of SMC address. In SAMA5 chips, the PMECC/NFC-hw registers address is in SMC address. take sama5d3 for example: NFC regs: 0xc000 0x0070 PMECC regs: 0xc070 0x0490 PMECC error regs: 0xc500 0x0100 And the HSMC regs is: 0xc000 0x0700 which include PMECC/NFC-hw registers. PMECC properties NFC properties --> we can make the NFC not a node, just many NFC properties. But all NAND chips will have to point to the same nfc struct, and I'd rather represent the NFC IP in the DT than hide it into the driver's logic. Moreover, the NFC IP is not part of the EBI memory range, so I'd prefer to keep it outside of the EBI node (though I'm not sure you're trying to represent the
[PATCH v4 1/2] ARM: at91: sama5d4/dts: add #{address, size}_cells properties for macb0
macb0 DT node can have phy child nodes, so add the #{address, size}_cells for macb0 node. Signed-off-by: Josh Wu --- Changes in v4: - fix typo in commit message: cell -> cells Changes in v3: - new added Changes in v2: None arch/arm/boot/dts/sama5d4.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi index d986b41..07953f2 100644 --- a/arch/arm/boot/dts/sama5d4.dtsi +++ b/arch/arm/boot/dts/sama5d4.dtsi @@ -852,6 +852,8 @@ interrupts = <54 IRQ_TYPE_LEVEL_HIGH 3>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_macb0_rmii>; + #address-cells = <1>; + #size-cells = <0>; clocks = <&macb0_clk>, <&macb0_clk>; clock-names = "hclk", "pclk"; status = "disabled"; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 2/2] ARM: at91: dts: sama5d4: add dts for sama5d4 xplained board
Add at91 sama5d4 xplained board support. Signed-off-by: Josh Wu --- Changes in v4: - Thanks to Bo Shen to find following leds issues: 1. the leds' label is changed in new xplained board. 2. as piod bank is disabled in sama5d4, that will whole led driver not work. So just disable the led which used piod. Changes in v3: - add phy0 child node under macb0 - rebase on top of linux next, re-formated the arch/arm/boot/dts/Makefile Changes in v2: - to be sorted by memory address, put the adc dt node after usart4. arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/at91-sama5d4_xplained.dts | 239 2 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/at91-sama5d4_xplained.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index a1c776b..5c189a5 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -42,7 +42,8 @@ dtb-$(CONFIG_SOC_SAM_V7) += \ sama5d34ek.dtb \ sama5d35ek.dtb \ sama5d36ek.dtb \ - at91-sama5d4ek.dtb + at91-sama5d4ek.dtb \ + at91-sama5d4_xplained.dtb dtb-$(CONFIG_ARCH_ATLAS6) += \ atlas6-evb.dtb dtb-$(CONFIG_ARCH_ATLAS7) += \ diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts new file mode 100644 index 000..af8f4f5 --- /dev/null +++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts @@ -0,0 +1,239 @@ +/* + * at91-sama5d4_xplained.dts - Device Tree file for SAMA5D4 Xplained board + * + * Copyright (C) 2015 Atmel, + *2015 Josh Wu + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file 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 file 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. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +/dts-v1/; +#include "sama5d4.dtsi" + +/ { + model = "Atmel SAMA5D4 Xplained"; + compatible = "atmel,sama5d4-xplained", "atmel,sama5d4", "atmel,sama5"; + + chosen { + bootargs = "console=ttyS0,115200 ignore_loglevel earlyprintk"; + }; + + memory { + reg = <0x2000 0x2000>; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + main_clock: clock@0 { + compatible = "atmel,osc", "fixed-clock"; + clock-frequency = <1200>; + }; + + slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal { + clock-frequency = <1200>; + }; + }; + + ahb { + apb { + spi0: spi@f801 { + cs-gpios = <&pioC 3 0>, <0>, <0>, <0>; + status = "okay"; + m25p80@0 { + compatible = "atmel,at25df321a"; +
Re: [PATCH] mtd: atmel_nand: fix typo in dev_err error message
Hi, Colin On 3/1/2015 4:27 AM, Colin King wrote: From: Colin Ian King Fix typo, "Unkown" -> "Unknown" Signed-off-by: Colin Ian King Thanks for the patch. Acked-by: Josh Wu --- drivers/mtd/nand/atmel_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index d93c849..1310450 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -1719,7 +1719,7 @@ static int nfc_wait_interrupt(struct atmel_nand_host *host, u32 flag) comp[index++] = &host->nfc->comp_cmd_done; if (index == 0) { - dev_err(host->dev, "Unkown interrupt flag: 0x%08x\n", flag); + dev_err(host->dev, "Unknown interrupt flag: 0x%08x\n", flag); return -EINVAL; } Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/5] media: atmel-isi: correct yuv swap according to different sensor outputs
we need to configure the YCC_SWAP bits in ISI_CFG2 according to current sensor output and Atmel ISI output format. Current there are two cases Atmel ISI supported: 1. Atmel ISI outputs YUYV format. This case we need to setup YCC_SWAP according to sensor output format. 2. Atmel ISI output a pass-through formats, which means no swap. Just setup YCC_SWAP as default with no swap. Signed-off-by: Josh Wu --- Changes in v2: - remove the duplicated variable: cfg2_yuv_swap. drivers/media/platform/soc_camera/atmel-isi.c | 39 --- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 45e304a..ce87a16 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -103,13 +103,37 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) return readl(isi->regs + reg); } +static u32 setup_cfg2_yuv_swap(struct atmel_isi *isi, + const struct soc_camera_format_xlate *xlate) +{ + if (xlate->host_fmt->fourcc == V4L2_PIX_FMT_YUYV) { + /* all convert to YUYV */ + switch (xlate->code) { + case MEDIA_BUS_FMT_VYUY8_2X8: + return ISI_CFG2_YCC_SWAP_MODE_3; + case MEDIA_BUS_FMT_UYVY8_2X8: + return ISI_CFG2_YCC_SWAP_MODE_2; + case MEDIA_BUS_FMT_YVYU8_2X8: + return ISI_CFG2_YCC_SWAP_MODE_1; + } + } + + /* +* By default, no swap for the codec path of Atmel ISI. So codec +* output is same as sensor's output. +* For instance, if sensor's output is YUYV, then codec outputs YUYV. +* And if sensor's output is UYVY, then codec outputs UYVY. +*/ + return ISI_CFG2_YCC_SWAP_DEFAULT; +} + static void configure_geometry(struct atmel_isi *isi, u32 width, - u32 height, u32 code) + u32 height, const struct soc_camera_format_xlate *xlate) { u32 cfg2; /* According to sensor's output format to set cfg2 */ - switch (code) { + switch (xlate->code) { default: /* Grey */ case MEDIA_BUS_FMT_Y8_1X8: @@ -117,16 +141,11 @@ static void configure_geometry(struct atmel_isi *isi, u32 width, break; /* YUV */ case MEDIA_BUS_FMT_VYUY8_2X8: - cfg2 = ISI_CFG2_YCC_SWAP_MODE_3 | ISI_CFG2_COL_SPACE_YCbCr; - break; case MEDIA_BUS_FMT_UYVY8_2X8: - cfg2 = ISI_CFG2_YCC_SWAP_MODE_2 | ISI_CFG2_COL_SPACE_YCbCr; - break; case MEDIA_BUS_FMT_YVYU8_2X8: - cfg2 = ISI_CFG2_YCC_SWAP_MODE_1 | ISI_CFG2_COL_SPACE_YCbCr; - break; case MEDIA_BUS_FMT_YUYV8_2X8: - cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT | ISI_CFG2_COL_SPACE_YCbCr; + cfg2 = ISI_CFG2_COL_SPACE_YCbCr | + setup_cfg2_yuv_swap(isi, xlate); break; /* RGB, TODO */ } @@ -407,7 +426,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) isi_writel(isi, ISI_INTDIS, (u32)~0UL); configure_geometry(isi, icd->user_width, icd->user_height, - icd->current_fmt->code); + icd->current_fmt); spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 3/5] media: atmel-isi: add code to setup correct resolution for preview path
Not like codec path, preview path can do downsampling, so we should setup a extra preview width, height for it. This patch add preview resolution setup without down sampling. So currently preview path will output same size as sensor output size. Signed-off-by: Josh Wu --- Changes in v2: None drivers/media/platform/soc_camera/atmel-isi.c | 12 +++- drivers/media/platform/soc_camera/atmel-isi.h | 10 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 24501a4..ae82068 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -131,7 +131,7 @@ static u32 setup_cfg2_yuv_swap(struct atmel_isi *isi, static void configure_geometry(struct atmel_isi *isi, u32 width, u32 height, const struct soc_camera_format_xlate *xlate) { - u32 cfg2; + u32 cfg2, psize; /* According to sensor's output format to set cfg2 */ switch (xlate->code) { @@ -159,6 +159,16 @@ static void configure_geometry(struct atmel_isi *isi, u32 width, cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); + + /* No down sampling, preview size equal to sensor output size */ + psize = ((width - 1) << ISI_PSIZE_PREV_HSIZE_OFFSET) & + ISI_PSIZE_PREV_HSIZE_MASK; + psize |= ((height - 1) << ISI_PSIZE_PREV_VSIZE_OFFSET) & + ISI_PSIZE_PREV_VSIZE_MASK; + isi_writel(isi, ISI_PSIZE, psize); + isi_writel(isi, ISI_PDECF, ISI_PDECF_NO_SAMPLING); + + return; } static bool is_supported(struct soc_camera_device *icd, diff --git a/drivers/media/platform/soc_camera/atmel-isi.h b/drivers/media/platform/soc_camera/atmel-isi.h index 5acc771..0acb32a 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.h +++ b/drivers/media/platform/soc_camera/atmel-isi.h @@ -79,6 +79,16 @@ #define ISI_CFG2_IM_VSIZE_MASK (0x7FF << ISI_CFG2_IM_VSIZE_OFFSET) #define ISI_CFG2_IM_HSIZE_MASK (0x7FF << ISI_CFG2_IM_HSIZE_OFFSET) +/* Bitfields in PSIZE */ +#define ISI_PSIZE_PREV_VSIZE_OFFSET0 +#define ISI_PSIZE_PREV_HSIZE_OFFSET16 +#define ISI_PSIZE_PREV_VSIZE_MASK (0x3FF << ISI_PSIZE_PREV_VSIZE_OFFSET) +#define ISI_PSIZE_PREV_HSIZE_MASK (0x3FF << ISI_PSIZE_PREV_HSIZE_OFFSET) + +/* Bitfields in PDECF */ +#define ISI_PDECF_DEC_FACTOR_MASK (0xFF << 0) +#defineISI_PDECF_NO_SAMPLING (16) + /* Bitfields in CTRL */ /* Also using in SR(ISI_V2) */ #define ISI_CTRL_EN(1 << 0) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 4/5] media: atmel-isi: setup YCC_SWAP correctly when using preview path
The preview path only can convert UYVY format to RGB data. To make preview path work correctly, we need to set up YCC_SWAP according to sensor output and convert them to UYVY. Signed-off-by: Josh Wu --- Changes in v2: - remove cfg2_yuv_swap for rgb format - correct the comment style drivers/media/platform/soc_camera/atmel-isi.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index ae82068..826d04e 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -117,6 +117,20 @@ static u32 setup_cfg2_yuv_swap(struct atmel_isi *isi, case MEDIA_BUS_FMT_YVYU8_2X8: return ISI_CFG2_YCC_SWAP_MODE_1; } + } else if (xlate->host_fmt->fourcc == V4L2_PIX_FMT_RGB565) { + /* +* Preview path is enabled, it will convert UYVY to RGB format. +* But if sensor output format is not UYVY, we need to set +* YCC_SWAP_MODE to convert it as UYVY. +*/ + switch (xlate->code) { + case MEDIA_BUS_FMT_VYUY8_2X8: + return ISI_CFG2_YCC_SWAP_MODE_1; + case MEDIA_BUS_FMT_YUYV8_2X8: + return ISI_CFG2_YCC_SWAP_MODE_2; + case MEDIA_BUS_FMT_YVYU8_2X8: + return ISI_CFG2_YCC_SWAP_MODE_3; + } } /* -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 5/5] media: atmel-isi: support RGB565 output when sensor output YUV formats
This patch enable Atmel ISI preview path to convert the YUV to RGB format. Signed-off-by: Josh Wu --- Changes in v2: - According to Guennadi's suggestion, remove the is_output_rgb() function which only used once. Also move the code into the for loop. drivers/media/platform/soc_camera/atmel-isi.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 826d04e..8abeeeb 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -146,6 +146,10 @@ static void configure_geometry(struct atmel_isi *isi, u32 width, u32 height, const struct soc_camera_format_xlate *xlate) { u32 cfg2, psize; + u32 fourcc = xlate->host_fmt->fourcc; + + isi->enable_preview_path = (fourcc == V4L2_PIX_FMT_RGB565 || + fourcc == V4L2_PIX_FMT_RGB32); /* According to sensor's output format to set cfg2 */ switch (xlate->code) { @@ -195,8 +199,9 @@ static bool is_supported(struct soc_camera_device *icd, case V4L2_PIX_FMT_UYVY: case V4L2_PIX_FMT_YVYU: case V4L2_PIX_FMT_VYUY: + /* RGB */ + case V4L2_PIX_FMT_RGB565: return true; - /* RGB, TODO */ default: return false; } @@ -682,6 +687,14 @@ static const struct soc_mbus_pixelfmt isi_camera_formats[] = { .order = SOC_MBUS_ORDER_LE, .layout = SOC_MBUS_LAYOUT_PACKED, }, + { + .fourcc = V4L2_PIX_FMT_RGB565, + .name = "RGB565", + .bits_per_sample= 8, + .packing= SOC_MBUS_PACKING_2X8_PADHI, + .order = SOC_MBUS_ORDER_LE, + .layout = SOC_MBUS_LAYOUT_PACKED, + }, }; /* This will be corrected as we get more formats */ @@ -738,7 +751,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, struct soc_camera_format_xlate *xlate) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - int formats = 0, ret; + int formats = 0, ret, i, n; /* sensor format */ struct v4l2_subdev_mbus_code_enum code = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, @@ -772,11 +785,11 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, case MEDIA_BUS_FMT_VYUY8_2X8: case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_YVYU8_2X8: - formats++; - if (xlate) { - xlate->host_fmt = &isi_camera_formats[0]; + n = ARRAY_SIZE(isi_camera_formats); + formats += n; + for (i = 0; xlate && i < n; i++, xlate++) { + xlate->host_fmt = &isi_camera_formats[i]; xlate->code = code.code; - xlate++; dev_dbg(icd->parent, "Providing format %s using code %d\n", isi_camera_formats[0].name, code.code); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/5] media: atmel-isi: prepare for the support of preview path
Atmel ISI support a preview path which can output RGB data. So this patch introduces a bool variable to choose which path is enabled currently. And also we need setup corresponding path registers. By default the preview path is disabled. We only use Codec path. Signed-off-by: Josh Wu --- Changes in v2: None drivers/media/platform/soc_camera/atmel-isi.c | 72 ++- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index ce87a16..24501a4 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -79,6 +79,7 @@ struct atmel_isi { dma_addr_t fb_descriptors_phys; struct list_head dma_desc_head; struct isi_dma_desc dma_desc[MAX_BUFFER_NUM]; + boolenable_preview_path; struct completion complete; /* ISI peripherial clock */ @@ -195,11 +196,19 @@ static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) /* start next dma frame. */ isi->active = list_entry(isi->video_buffer_list.next, struct frame_buffer, list); - isi_writel(isi, ISI_DMA_C_DSCR, - (u32)isi->active->p_dma_desc->fbd_phys); - isi_writel(isi, ISI_DMA_C_CTRL, - ISI_DMA_CTRL_FETCH | ISI_DMA_CTRL_DONE); - isi_writel(isi, ISI_DMA_CHER, ISI_DMA_CHSR_C_CH); + if (!isi->enable_preview_path) { + isi_writel(isi, ISI_DMA_C_DSCR, + (u32)isi->active->p_dma_desc->fbd_phys); + isi_writel(isi, ISI_DMA_C_CTRL, + ISI_DMA_CTRL_FETCH | ISI_DMA_CTRL_DONE); + isi_writel(isi, ISI_DMA_CHER, ISI_DMA_CHSR_C_CH); + } else { + isi_writel(isi, ISI_DMA_P_DSCR, + (u32)isi->active->p_dma_desc->fbd_phys); + isi_writel(isi, ISI_DMA_P_CTRL, + ISI_DMA_CTRL_FETCH | ISI_DMA_CTRL_DONE); + isi_writel(isi, ISI_DMA_CHER, ISI_DMA_CHSR_P_CH); + } } return IRQ_HANDLED; } @@ -226,7 +235,8 @@ static irqreturn_t isi_interrupt(int irq, void *dev_id) isi_writel(isi, ISI_INTDIS, ISI_CTRL_DIS); ret = IRQ_HANDLED; } else { - if (likely(pending & ISI_SR_CXFR_DONE)) + if (likely(pending & ISI_SR_CXFR_DONE) || + likely(pending & ISI_SR_PXFR_DONE)) ret = atmel_isi_handle_streaming(isi); } @@ -368,21 +378,35 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer) ISI_SR_CXFR_DONE | ISI_SR_PXFR_DONE); /* Check if already in a frame */ - if (isi_readl(isi, ISI_STATUS) & ISI_CTRL_CDC) { - dev_err(isi->soc_host.icd->parent, "Already in frame handling.\n"); - return; - } + if (!isi->enable_preview_path) { + if (isi_readl(isi, ISI_STATUS) & ISI_CTRL_CDC) { + dev_err(isi->soc_host.icd->parent, "Already in frame handling.\n"); + return; + } - isi_writel(isi, ISI_DMA_C_DSCR, (u32)buffer->p_dma_desc->fbd_phys); - isi_writel(isi, ISI_DMA_C_CTRL, ISI_DMA_CTRL_FETCH | ISI_DMA_CTRL_DONE); - isi_writel(isi, ISI_DMA_CHER, ISI_DMA_CHSR_C_CH); + isi_writel(isi, ISI_DMA_C_DSCR, + (u32)buffer->p_dma_desc->fbd_phys); + isi_writel(isi, ISI_DMA_C_CTRL, + ISI_DMA_CTRL_FETCH | ISI_DMA_CTRL_DONE); + isi_writel(isi, ISI_DMA_CHER, ISI_DMA_CHSR_C_CH); + } else { + isi_writel(isi, ISI_DMA_P_DSCR, + (u32)buffer->p_dma_desc->fbd_phys); + isi_writel(isi, ISI_DMA_P_CTRL, + ISI_DMA_CTRL_FETCH | ISI_DMA_CTRL_DONE); + isi_writel(isi, ISI_DMA_CHER, ISI_DMA_CHSR_P_CH); + } cfg1 &= ~ISI_CFG1_FRATE_DIV_MASK; /* Enable linked list */ cfg1 |= isi->pdata.frate | ISI_CFG1_DISCR; - /* Enable codec path and ISI */ - ctrl = ISI_CTRL_CDC | ISI_CTRL_EN; + /* Enable ISI */ + ctrl = ISI_CTRL_EN; + + if (!isi->enable_preview_path) + ctrl |= ISI_CTRL_CDC; + isi_writel(isi, ISI_CTRL, ctrl); isi_writel(isi, ISI_CFG1, cfg1); } @@ -458,15 +482,17 @@ static void stop_streaming(struct vb2_queue *vq) } spi
[PATCH v2 0/5] media: atmel-isi: enable preview path to output RGB565 format
This series will enable preview path support in atmel-isi. Which can make atmel-isi convert the YUV format (from sensor) to RGB565 format. Changes in v2: - remove the duplicated variable: cfg2_yuv_swap. - correct the comment style - According to Guennadi's suggestion, remove the is_output_rgb() function which only used once. Also move the code into the for loop. Josh Wu (5): media: atmel-isi: correct yuv swap according to different sensor outputs media: atmel-isi: prepare for the support of preview path media: atmel-isi: add code to setup correct resolution for preview path media: atmel-isi: setup YCC_SWAP correctly when using preview path media: atmel-isi: support RGB565 output when sensor output YUV formats drivers/media/platform/soc_camera/atmel-isi.c | 162 +++--- drivers/media/platform/soc_camera/atmel-isi.h | 10 ++ 2 files changed, 132 insertions(+), 40 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] media: soc-camera: increase the length of clk_name on soc_of_bind()
Hi, Guennadi On 8/30/2015 10:06 PM, Guennadi Liakhovetski wrote: Hi Josh, Sorry, I missed the 4.3 merge cycle, but isn't this patch a fix? Isn't it fixing soc-camera / atmel-isi on a specific platform, where the clock name is longer, than currently supported? Is this platform in the mainline and its current camera support is broken because of this? I missed your email, so sorry for the late reply. yes, it will break the detect flow if the i2c camera is loaded as module. In such a case we could still push it in for 4.3 So it is a fix, it is great if this one can still go into 4.3. Best Regards, Josh Wu Thanks Guennadi On Tue, 4 Aug 2015, Josh Wu wrote: Since in soc_of_bind() it may use the of node's full name as the clk_name, and this full name may be longer than 32 characters, take at91 i2c sensor as an example, length is 34 bytes: /ahb/apb/i2c@f8028000/camera@0x30 So this patch increase the clk_name[] array size to 64. It seems big enough so far. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/soc_camera.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index d708df4..fcf3e97 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1621,7 +1621,7 @@ static int soc_of_bind(struct soc_camera_host *ici, struct soc_camera_async_client *sasc; struct soc_of_info *info; struct i2c_client *client; - char clk_name[V4L2_SUBDEV_NAME_SIZE]; + char clk_name[V4L2_SUBDEV_NAME_SIZE + 32]; int ret; /* allocate a new subdev and add match info to it */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: at91/dt: ov2640: add hsync/vsync-active property
On at91sam9x5ek/at91sam9m10g45ek/sama5d3xek boards, we use the parallel connection for ov2640. So we must set the hsync/vsync property (1 means active high). Otherwise, the connection would be seen as BT.656 or BT.1120. Signed-off-by: Josh Wu --- arch/arm/boot/dts/at91sam9m10g45ek.dts | 2 ++ arch/arm/boot/dts/at91sam9x5ek.dtsi| 2 ++ arch/arm/boot/dts/sama5d3xmb.dtsi | 2 ++ 3 files changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts index d1ae60a..9d16ef8 100644 --- a/arch/arm/boot/dts/at91sam9m10g45ek.dts +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -198,6 +198,8 @@ isi_0: endpoint { remote-endpoint = <&ov2640_0>; bus-width = <8>; + vsync-active = <1>; + hsync-active = <1>; }; }; }; diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi index d237c46..479f200 100644 --- a/arch/arm/boot/dts/at91sam9x5ek.dtsi +++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi @@ -66,6 +66,8 @@ isi_0: endpoint@0 { remote-endpoint = <&ov2640_0>; bus-width = <8>; + vsync-active = <1>; + hsync-active = <1>; }; }; }; diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi index 83bee7a..8901042 100644 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi @@ -87,6 +87,8 @@ isi_0: endpoint { remote-endpoint = <&ov2640_0>; bus-width = <8>; + vsync-active = <1>; + hsync-active = <1>; }; }; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] media: atmel-isi: move configure_geometry() to start_streaming()
HI, Laurent On 7/31/2015 10:37 PM, Laurent Pinchart wrote: Hi Josh, Thank you for the patch. On Wednesday 17 June 2015 18:39:39 Josh Wu wrote: As in set_fmt() function we only need to know which format is been set, we don't need to access the ISI hardware in this moment. So move the configure_geometry(), which access the ISI hardware, to start_streaming() will make code more consistent and simpler. Signed-off-by: Josh Wu --- drivers/media/platform/soc_camera/atmel-isi.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 8bc40ca..b01086d 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -390,6 +390,11 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); + ret = configure_geometry(isi, icd->user_width, icd->user_height, + icd->current_fmt->code); I would also make configure_geometry a void function, as the only failure case really can't occur. I think this case can be reached if user require a RGB565 format to capture and sensor also support RGB565 format. As atmel-isi driver will provide RGB565 support via the pass-through mode (maybe we need re-consider this part). So that will cause the configure_geometry() returns an error since it found the bus format is not Y8 or YUV422. In my opinion, we should not change configure_geometry()'s return type, until we add a insanity format check before we call configure_geometry() in future. Apart from that, Reviewed-by: Laurent Pinchart Thanks for the review. Best Regards, Josh Wu + if (ret < 0) + return ret; + spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ isi_readl(isi, ISI_STATUS); @@ -477,8 +482,6 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, static int isi_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_format *f) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct atmel_isi *isi = ici->priv; struct v4l2_subdev *sd = soc_camera_to_subdev(icd); const struct soc_camera_format_xlate *xlate; struct v4l2_pix_format *pix = &f->fmt.pix; @@ -511,16 +514,6 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, if (mf->code != xlate->code) return -EINVAL; - /* Enable PM and peripheral clock before operate isi registers */ - pm_runtime_get_sync(ici->v4l2_dev.dev); - - ret = configure_geometry(isi, pix->width, pix->height, xlate->code); - - pm_runtime_put(ici->v4l2_dev.dev); - - if (ret < 0) - return ret; - pix->width = mf->width; pix->height = mf->height; pix->field = mf->field; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH 2/3] ARM: at91/dt: add sama5d2 pinmux
Hi, Ludovic On 7/31/2015 11:08 PM, Ludovic Desroches wrote: Signed-off-by: Ludovic Desroches --- arch/arm/boot/dts/sama5d2-pinfunc.h | 760 1 file changed, 760 insertions(+) create mode 100644 arch/arm/boot/dts/sama5d2-pinfunc.h diff --git a/arch/arm/boot/dts/sama5d2-pinfunc.h b/arch/arm/boot/dts/sama5d2-pinfunc.h new file mode 100644 index 000..046d1d5 --- /dev/null +++ b/arch/arm/boot/dts/sama5d2-pinfunc.h [snip...] +#define PIN_PB24__FLEXCOM3_IO3 PINMUX_PIN(PIN_PB24, 5, 3) +#define PIN_PB24__ISI_D10 PINMUX_PIN(PIN_PB24, 6, 3) As sama5d2 use ISC, so It's better to run s/ISI_/ISC_/ in this file, which is consistent with the datasheet. Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 3/3] media: atmel-isi: add sanity check for supported formats in set_fmt()
Hi, Laurent Thanks for the review. On 8/21/2015 2:30 AM, Laurent Pinchart wrote: Hi Josh, Thank you for the patch. On Wednesday 05 August 2015 11:26:29 Josh Wu wrote: After adding the format check in set_fmt(), we don't need any format check in configure_geometry(). So make configure_geometry() as void type. Signed-off-by: Josh Wu --- Changes in v2: - new added patch drivers/media/platform/soc_camera/atmel-isi.c | 39 ++-- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index cb46aec..d0df518 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -103,17 +103,19 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) return readl(isi->regs + reg); } -static int configure_geometry(struct atmel_isi *isi, u32 width, +static void configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { u32 cfg2; /* According to sensor's output format to set cfg2 */ switch (code) { - /* YUV, including grey */ + default: + /* Grey */ case MEDIA_BUS_FMT_Y8_1X8: cfg2 = ISI_CFG2_GRAYSCALE; break; + /* YUV */ case MEDIA_BUS_FMT_VYUY8_2X8: cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; @@ -127,8 +129,6 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ - default: - return -EINVAL; } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); @@ -139,8 +139,29 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); +} - return 0; +static bool is_supported(struct soc_camera_device *icd, + const struct soc_camera_format_xlate *xlate) +{ + bool ret = true; + + switch (xlate->code) { + /* YUV, including grey */ + case MEDIA_BUS_FMT_Y8_1X8: + case MEDIA_BUS_FMT_VYUY8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_YVYU8_2X8: + case MEDIA_BUS_FMT_YUYV8_2X8: I would just return true here and false below, and remove the ret variable. Ok. + break; + /* RGB, TODO */ + default: + dev_err(icd->parent, "not supported format: %d\n", + xlate->code); If this can happen when userspace asks for an unsupported format I don't think you should print an error message to the kernel log. ok, I will remove this. + ret = false; + } + + return ret; } static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) @@ -391,10 +412,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); - ret = configure_geometry(isi, icd->user_width, icd->user_height, + configure_geometry(isi, icd->user_width, icd->user_height, icd->current_fmt->code); - if (ret < 0) - return ret; spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ @@ -515,6 +534,10 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, if (mf->code != xlate->code) return -EINVAL; + /* check with atmel-isi support format */ + if (!is_supported(icd, xlate)) + return -EINVAL; + S_FMT is supposed to pick a suitable default format when the requested format isn't supported. It shouldn't return an error. So I will move this check to beginning of S_FMT and if format not support, I will select a default format for it. Best Regards, Josh Wu pix->width = mf->width; pix->height = mf->height; pix->field = mf->field; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 2/3] media: atmel-isi: move configure_geometry() to start_streaming()
As in set_fmt() function we only need to know which format is been set, we don't need to access the ISI hardware in this moment. So move the configure_geometry(), which access the ISI hardware, to start_streaming() will make code more consistent and simpler. Signed-off-by: Josh Wu Reviewed-by: Laurent Pinchart --- Changes in v3: None Changes in v2: - Add Laurent's reviewed-by tag. drivers/media/platform/soc_camera/atmel-isi.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index b67da70..fe9247a 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -390,6 +390,11 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); + ret = configure_geometry(isi, icd->user_width, icd->user_height, + icd->current_fmt->code); + if (ret < 0) + return ret; + spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ isi_readl(isi, ISI_STATUS); @@ -477,8 +482,6 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, static int isi_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_format *f) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct atmel_isi *isi = ici->priv; struct v4l2_subdev *sd = soc_camera_to_subdev(icd); const struct soc_camera_format_xlate *xlate; struct v4l2_pix_format *pix = &f->fmt.pix; @@ -511,16 +514,6 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, if (mf->code != xlate->code) return -EINVAL; - /* Enable PM and peripheral clock before operate isi registers */ - pm_runtime_get_sync(ici->v4l2_dev.dev); - - ret = configure_geometry(isi, pix->width, pix->height, xlate->code); - - pm_runtime_put(ici->v4l2_dev.dev); - - if (ret < 0) - return ret; - pix->width = mf->width; pix->height = mf->height; pix->field = mf->field; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 1/3] media: atmel-isi: setup the ISI_CFG2 register directly
In the function configure_geometry(), we will setup the ISI CFG2 according to the sensor output format. It make no sense to just read back the CFG2 register and just set part of it. So just set up this register directly makes things simpler. Currently only support YUV format from camera sensor. Signed-off-by: Josh Wu Reviewed-by: Laurent Pinchart --- Changes in v3: None Changes in v2: - add Laurent's reviewed-by tag. drivers/media/platform/soc_camera/atmel-isi.c | 20 +++- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index f39132c..b67da70 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -105,24 +105,25 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) static int configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { - u32 cfg2, cr; + u32 cfg2; + /* According to sensor's output format to set cfg2 */ switch (code) { /* YUV, including grey */ case MEDIA_BUS_FMT_Y8_1X8: - cr = ISI_CFG2_GRAYSCALE; + cfg2 = ISI_CFG2_GRAYSCALE; break; case MEDIA_BUS_FMT_VYUY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_3; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; case MEDIA_BUS_FMT_UYVY8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_2; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_2; break; case MEDIA_BUS_FMT_YVYU8_2X8: - cr = ISI_CFG2_YCC_SWAP_MODE_1; + cfg2 = ISI_CFG2_YCC_SWAP_MODE_1; break; case MEDIA_BUS_FMT_YUYV8_2X8: - cr = ISI_CFG2_YCC_SWAP_DEFAULT; + cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ default: @@ -130,17 +131,10 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); - - cfg2 = isi_readl(isi, ISI_CFG2); - /* Set YCC swap mode */ - cfg2 &= ~ISI_CFG2_YCC_SWAP_MODE_MASK; - cfg2 |= cr; /* Set width */ - cfg2 &= ~(ISI_CFG2_IM_HSIZE_MASK); cfg2 |= ((width - 1) << ISI_CFG2_IM_HSIZE_OFFSET) & ISI_CFG2_IM_HSIZE_MASK; /* Set height */ - cfg2 &= ~(ISI_CFG2_IM_VSIZE_MASK); cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 3/3] media: atmel-isi: add sanity check for supported formats in try/set_fmt()
After adding the format check in try_fmt()/set_fmt(), we don't need any format check in configure_geometry(). So make configure_geometry() as void type. Signed-off-by: Josh Wu --- Changes in v3: - check the whether format is supported, if no then return a default format. - misc changes according to Laurent's feedback. Changes in v2: - new added patch drivers/media/platform/soc_camera/atmel-isi.c | 37 +-- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index fe9247a..84c91d3 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -102,17 +102,19 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) return readl(isi->regs + reg); } -static int configure_geometry(struct atmel_isi *isi, u32 width, +static void configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { u32 cfg2; /* According to sensor's output format to set cfg2 */ switch (code) { - /* YUV, including grey */ + default: + /* Grey */ case MEDIA_BUS_FMT_Y8_1X8: cfg2 = ISI_CFG2_GRAYSCALE; break; + /* YUV */ case MEDIA_BUS_FMT_VYUY8_2X8: cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; @@ -126,8 +128,6 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ - default: - return -EINVAL; } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); @@ -138,8 +138,23 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); +} - return 0; +static bool is_supported(struct soc_camera_device *icd, + const u32 pixformat) +{ + switch (pixformat) { + /* YUV, including grey */ + case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_UYVY: + case V4L2_PIX_FMT_YVYU: + case V4L2_PIX_FMT_VYUY: + return true; + /* RGB, TODO */ + default: + return false; + } } static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) @@ -390,10 +405,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); - ret = configure_geometry(isi, icd->user_width, icd->user_height, + configure_geometry(isi, icd->user_width, icd->user_height, icd->current_fmt->code); - if (ret < 0) - return ret; spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ @@ -491,6 +504,10 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_mbus_framefmt *mf = &format.format; int ret; + /* check with atmel-isi support format, if not support use UYVY */ + if (!is_supported(icd, pix->pixelformat)) + pix->pixelformat = V4L2_PIX_FMT_YUYV; + xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); if (!xlate) { dev_warn(icd->parent, "Format %x not found\n", @@ -540,6 +557,10 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd, u32 pixfmt = pix->pixelformat; int ret; + /* check with atmel-isi support format, if not support use UYVY */ + if (!is_supported(icd, pix->pixelformat)) + pix->pixelformat = V4L2_PIX_FMT_YUYV; + xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); if (pixfmt && !xlate) { dev_warn(icd->parent, "Format %x not found\n", pixfmt); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] media: atmel-isi: add sanity check for supported formats in try/set_fmt()
Hi, Laurent On 8/22/2015 2:22 AM, Laurent Pinchart wrote: Hi Josh, Thank you for the patch. On Friday 21 August 2015 16:08:14 Josh Wu wrote: After adding the format check in try_fmt()/set_fmt(), we don't need any format check in configure_geometry(). So make configure_geometry() as void type. Signed-off-by: Josh Wu --- Changes in v3: - check the whether format is supported, if no then return a default format. - misc changes according to Laurent's feedback. Changes in v2: - new added patch drivers/media/platform/soc_camera/atmel-isi.c | 37 ++-- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index fe9247a..84c91d3 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -102,17 +102,19 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) return readl(isi->regs + reg); } -static int configure_geometry(struct atmel_isi *isi, u32 width, +static void configure_geometry(struct atmel_isi *isi, u32 width, u32 height, u32 code) { u32 cfg2; /* According to sensor's output format to set cfg2 */ switch (code) { - /* YUV, including grey */ + default: + /* Grey */ case MEDIA_BUS_FMT_Y8_1X8: cfg2 = ISI_CFG2_GRAYSCALE; break; + /* YUV */ case MEDIA_BUS_FMT_VYUY8_2X8: cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; break; @@ -126,8 +128,6 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; break; /* RGB, TODO */ - default: - return -EINVAL; } isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); @@ -138,8 +138,23 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) & ISI_CFG2_IM_VSIZE_MASK; isi_writel(isi, ISI_CFG2, cfg2); +} - return 0; +static bool is_supported(struct soc_camera_device *icd, + const u32 pixformat) +{ + switch (pixformat) { + /* YUV, including grey */ + case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_UYVY: + case V4L2_PIX_FMT_YVYU: + case V4L2_PIX_FMT_VYUY: + return true; + /* RGB, TODO */ + default: + return false; + } } static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) @@ -390,10 +405,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) /* Disable all interrupts */ isi_writel(isi, ISI_INTDIS, (u32)~0UL); - ret = configure_geometry(isi, icd->user_width, icd->user_height, + configure_geometry(isi, icd->user_width, icd->user_height, icd->current_fmt->code); - if (ret < 0) - return ret; spin_lock_irq(&isi->lock); /* Clear any pending interrupt */ @@ -491,6 +504,10 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_mbus_framefmt *mf = &format.format; int ret; + /* check with atmel-isi support format, if not support use UYVY */ + if (!is_supported(icd, pix->pixelformat)) + pix->pixelformat = V4L2_PIX_FMT_YUYV; The comment mentions UYVY and the code uses YUYV. Oops, forgotten to change the comments. I'll fix it. + xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); if (!xlate) { dev_warn(icd->parent, "Format %x not found\n", Can this still happen ? I think this warning should not happen if user call set_fmt() with the format that get from by get_formats(). But it is a common pattern in soc_camera host code to handle this error. @@ -540,6 +557,10 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd, u32 pixfmt = pix->pixelformat; int ret; + /* check with atmel-isi support format, if not support use UYVY */ + if (!is_supported(icd, pix->pixelformat)) + pix->pixelformat = V4L2_PIX_FMT_YUYV; + xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); if (pixfmt && !xlate) { dev_warn(icd->parent, "Format %x not found\n", pixfmt); Same comment here. I wonder whether most of the content of isi_camera_set_fmt() and isi_camera_try_fmt() could be factorized out into a shared function. I agree. the current set_fmt() doesn't touch any hardware, so it's almost same as try_fmt(). Best Regards, Josh Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: at91/dt: ov2640: add hsync/vsync-active property
Hi, Nicolas On 9/18/2015 10:09 PM, Nicolas Ferre wrote: Le 18/09/2015 13:28, Josh Wu a écrit : On at91sam9x5ek/at91sam9m10g45ek/sama5d3xek boards, we use the parallel connection for ov2640. So we must set the hsync/vsync property (1 means active high). Otherwise, the connection would be seen as BT.656 or BT.1120. Signed-off-by: Josh Wu Hi Josh, Does this patch apply because of the new enhancement that you had proposed in "media: atmel-isi: parse the DT parameters for vsync/hsync/pixclock polarity" or does it apply even before? Is it a fix that applies to older kernels? It's is a fix, according to the dt binding of video interface. So it should be applied before: "media: atmel-isi: parse the DT parameters for vsync/hsync/pixclock polarity". it has no impact in older kernel as the driver doesn't parse that property yet. So, should I wait for the enhancements to enter media git tree or can I take them anyway? yes, you can take it without waiting for the media tree. Thanks. Best Regards, Josh Wu Bye, --- arch/arm/boot/dts/at91sam9m10g45ek.dts | 2 ++ arch/arm/boot/dts/at91sam9x5ek.dtsi| 2 ++ arch/arm/boot/dts/sama5d3xmb.dtsi | 2 ++ 3 files changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts index d1ae60a..9d16ef8 100644 --- a/arch/arm/boot/dts/at91sam9m10g45ek.dts +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -198,6 +198,8 @@ isi_0: endpoint { remote-endpoint = <&ov2640_0>; bus-width = <8>; + vsync-active = <1>; + hsync-active = <1>; }; }; }; diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi index d237c46..479f200 100644 --- a/arch/arm/boot/dts/at91sam9x5ek.dtsi +++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi @@ -66,6 +66,8 @@ isi_0: endpoint@0 { remote-endpoint = <&ov2640_0>; bus-width = <8>; + vsync-active = <1>; + hsync-active = <1>; }; }; }; diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi index 83bee7a..8901042 100644 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi @@ -87,6 +87,8 @@ isi_0: endpoint { remote-endpoint = <&ov2640_0>; bus-width = <8>; + vsync-active = <1>; + hsync-active = <1>; }; }; }; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] power: reset: at91: add sama5d3 reset function
Hi, Guenter On 7/10/2015 1:37 AM, Guenter Roeck wrote: On Thu, Jul 09, 2015 at 06:15:46PM +0800, Josh Wu wrote: As since sama5d3, to reset the chip, we don't need to shutdown the ddr controller. So add a new compatible string and new restart function for sama5d3 and later chips. As we don't use sama5d3 ddr controller, so remove it as well. That sounds like it should be two separate patches, or am I missing something ? I think using one patch makes more sense. Maybe the commit log is not clear enough. How about put it this way: This patch introduces a new compatible string: "atmel,sama5d3-rstc" for the reset driver of sama5d3 and later chips. As in sama5d3 or later chips, we don't have to shutdown the DDR controller before reset. Shutdown the DDR controller before reset is a workaround to avoid DDR signal driving the bus, but since sama5d3 and later chips there is no such a conflict. That means: 1. the sama5d3 reset function only need to write the rstc register and return. 2. for sama5d3, we can remove the code related with DDR controller as we don't use it at all. Best Regards, Josh Wu Guenter Signed-off-by: Josh Wu Acked-by: Nicolas Ferre --- drivers/power/reset/at91-reset.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c index 36dc52f..8944b63 100644 --- a/drivers/power/reset/at91-reset.c +++ b/drivers/power/reset/at91-reset.c @@ -123,6 +123,14 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode, return NOTIFY_DONE; } +static int sama5d3_restart(struct notifier_block *this, unsigned long mode, + void *cmd) +{ + writel(cpu_to_le32(AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST), + at91_rstc_base); + return NOTIFY_DONE; +} + static void __init at91_reset_status(struct platform_device *pdev) { u32 reg = readl(at91_rstc_base + AT91_RSTC_SR); @@ -155,13 +163,13 @@ static void __init at91_reset_status(struct platform_device *pdev) static const struct of_device_id at91_ramc_of_match[] = { { .compatible = "atmel,at91sam9260-sdramc", }, { .compatible = "atmel,at91sam9g45-ddramc", }, - { .compatible = "atmel,sama5d3-ddramc", }, { /* sentinel */ } }; static const struct of_device_id at91_reset_of_match[] = { { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9260_restart }, { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart }, + { .compatible = "atmel,sama5d3-rstc", .data = sama5d3_restart }, { /* sentinel */ } }; @@ -181,17 +189,21 @@ static int at91_reset_of_probe(struct platform_device *pdev) return -ENODEV; } - for_each_matching_node(np, at91_ramc_of_match) { - at91_ramc_base[idx] = of_iomap(np, 0); - if (!at91_ramc_base[idx]) { - dev_err(&pdev->dev, "Could not map ram controller address\n"); - return -ENODEV; + match = of_match_node(at91_reset_of_match, pdev->dev.of_node); + at91_restart_nb.notifier_call = match->data; + + if (match->data != sama5d3_restart) { + /* we need to shutdown the ddr controller, so get ramc base */ + for_each_matching_node(np, at91_ramc_of_match) { + at91_ramc_base[idx] = of_iomap(np, 0); + if (!at91_ramc_base[idx]) { + dev_err(&pdev->dev, "Could not map ram controller address\n"); + return -ENODEV; + } + idx++; } - idx++; } - match = of_match_node(at91_reset_of_match, pdev->dev.of_node); - at91_restart_nb.notifier_call = match->data; return register_restart_handler(&at91_restart_nb); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] power: reset: at91: add sama5d3 reset function
Hi, Maxime On 7/9/2015 8:03 PM, Maxime Ripard wrote: Hi, On Thu, Jul 09, 2015 at 06:15:46PM +0800, Josh Wu wrote: As since sama5d3, to reset the chip, we don't need to shutdown the ddr controller. So add a new compatible string and new restart function for sama5d3 and later chips. As we don't use sama5d3 ddr controller, so remove it as well. Signed-off-by: Josh Wu Acked-by: Nicolas Ferre --- drivers/power/reset/at91-reset.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c index 36dc52f..8944b63 100644 --- a/drivers/power/reset/at91-reset.c +++ b/drivers/power/reset/at91-reset.c @@ -123,6 +123,14 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode, return NOTIFY_DONE; } +static int sama5d3_restart(struct notifier_block *this, unsigned long mode, + void *cmd) +{ + writel(cpu_to_le32(AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST), + at91_rstc_base); + return NOTIFY_DONE; +} + static void __init at91_reset_status(struct platform_device *pdev) { u32 reg = readl(at91_rstc_base + AT91_RSTC_SR); @@ -155,13 +163,13 @@ static void __init at91_reset_status(struct platform_device *pdev) static const struct of_device_id at91_ramc_of_match[] = { { .compatible = "atmel,at91sam9260-sdramc", }, { .compatible = "atmel,at91sam9g45-ddramc", }, - { .compatible = "atmel,sama5d3-ddramc", }, { /* sentinel */ } }; static const struct of_device_id at91_reset_of_match[] = { { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9260_restart }, { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart }, + { .compatible = "atmel,sama5d3-rstc", .data = sama5d3_restart }, { /* sentinel */ } }; @@ -181,17 +189,21 @@ static int at91_reset_of_probe(struct platform_device *pdev) return -ENODEV; } - for_each_matching_node(np, at91_ramc_of_match) { - at91_ramc_base[idx] = of_iomap(np, 0); - if (!at91_ramc_base[idx]) { - dev_err(&pdev->dev, "Could not map ram controller address\n"); - return -ENODEV; + match = of_match_node(at91_reset_of_match, pdev->dev.of_node); + at91_restart_nb.notifier_call = match->data; + + if (match->data != sama5d3_restart) { Using of_device_is_compatible seems more appropriate. Also, why are you changing the order of this loop and the notifier registration? I moved this order because I use the match->data to compare whether is sama5d3_restart. So I need to move this function (of_match_node) up. Best Regards, Josh Wu Maxime -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/