* [PATCH 1/2] ARM imx53: add pwm devices support
@ 2011-03-01 6:30 Jason Chen
2011-03-01 6:30 ` [PATCH 2/2] ARM MX53_LOCO: add pwm backlight device Jason Chen
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Jason Chen @ 2011-03-01 6:30 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Jason Chen <b02280@freescale.com>
---
arch/arm/mach-mx5/clock-mx51-mx53.c | 2 ++
arch/arm/mach-mx5/devices-imx53.h | 4 ++++
arch/arm/mach-mx5/devices.c | 10 ++++++++++
arch/arm/mach-mx5/devices.h | 2 ++
arch/arm/plat-mxc/devices/Kconfig | 1 +
arch/arm/plat-mxc/devices/platform-mxc_pwm.c | 9 +++++++++
arch/arm/plat-mxc/pwm.c | 3 ++-
7 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 8164b1d..e18807b 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -1338,6 +1338,8 @@ static struct clk_lookup mx53_lookups[] = {
_REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk)
_REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
_REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
+ _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
+ _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
};
static void clk_tree_init(void)
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
index 9251008..5a1d6c9 100644
--- a/arch/arm/mach-mx5/devices-imx53.h
+++ b/arch/arm/mach-mx5/devices-imx53.h
@@ -33,3 +33,7 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst;
extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst;
#define imx53_add_imx2_wdt(id, pdata) \
imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
+
+extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst;
+#define imx53_add_mxc_pwm(id) \
+ imx_add_mxc_pwm(&imx53_mxc_pwm_data[id])
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 153ada5..74aec2b 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -120,6 +120,16 @@ struct platform_device mxc_usbh2_device = {
},
};
+struct platform_device mxc_pwm1_backlight_device = {
+ .name = "pwm-backlight",
+ .id = 0,
+};
+
+struct platform_device mxc_pwm2_backlight_device = {
+ .name = "pwm-backlight",
+ .id = 1,
+};
+
static struct mxc_gpio_port mxc_gpio_ports[] = {
{
.chip.label = "gpio-0",
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
index 55a5129..a74cd97 100644
--- a/arch/arm/mach-mx5/devices.h
+++ b/arch/arm/mach-mx5/devices.h
@@ -3,3 +3,5 @@ extern struct platform_device mxc_usbh1_device;
extern struct platform_device mxc_usbh2_device;
extern struct platform_device mxc_usbdr_udc_device;
extern struct platform_device mxc_hsi2c_device;
+extern struct platform_device mxc_pwm1_backlight_device;
+extern struct platform_device mxc_pwm2_backlight_device;
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index b9ab1d5..aee9f4b 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -58,6 +58,7 @@ config IMX_HAVE_PLATFORM_MXC_NAND
config IMX_HAVE_PLATFORM_MXC_PWM
bool
+ default y if ARCH_MX21 || ARCH_MX25 || SOC_IMX27 || SOC_IMX51 || SOC_IMX53
config IMX_HAVE_PLATFORM_MXC_RNGA
bool
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
index b0c4ae2..18cfd07 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
+++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
@@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
};
#endif /* ifdef CONFIG_SOC_IMX51 */
+#ifdef CONFIG_SOC_IMX53
+const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = {
+#define imx53_mxc_pwm_data_entry(_id, _hwid) \
+ imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K)
+ imx53_mxc_pwm_data_entry(0, 1),
+ imx53_mxc_pwm_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_SOC_IMX53 */
+
struct platform_device *__init imx_add_mxc_pwm(
const struct imx_mxc_pwm_data *data)
{
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index 7a61ef8..61dd8fb 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
return -EINVAL;
- if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
+ if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() ||
+ cpu_is_mx53()) {
unsigned long long c;
unsigned long period_cycles, duty_cycles, prescale;
u32 cr;
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/2] ARM MX53_LOCO: add pwm backlight device
2011-03-01 6:30 [PATCH 1/2] ARM imx53: add pwm devices support Jason Chen
@ 2011-03-01 6:30 ` Jason Chen
2011-03-01 7:35 ` [PATCH 1/2] ARM imx53: add pwm devices support Eric Miao
2011-03-01 8:10 ` Uwe Kleine-König
2 siblings, 0 replies; 14+ messages in thread
From: Jason Chen @ 2011-03-01 6:30 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Jason Chen <b02280@freescale.com>
---
arch/arm/mach-mx5/board-mx53_loco.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
index 160899e..6c42185 100644
--- a/arch/arm/mach-mx5/board-mx53_loco.c
+++ b/arch/arm/mach-mx5/board-mx53_loco.c
@@ -23,6 +23,7 @@
#include <linux/fec.h>
#include <linux/delay.h>
#include <linux/gpio.h>
+#include <linux/pwm_backlight.h>
#include <mach/common.h>
#include <mach/hardware.h>
@@ -35,6 +36,7 @@
#include "crm_regs.h"
#include "devices-imx53.h"
+#include "devices.h"
#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6)
@@ -203,6 +205,13 @@ static const struct imxi2c_platform_data mx53_loco_i2c_data __initconst = {
.bitrate = 100000,
};
+static struct platform_pwm_backlight_data loco_pwm_backlight_data = {
+ .pwm_id = 1,
+ .max_brightness = 255,
+ .dft_brightness = 128,
+ .pwm_period_ns = 50000,
+};
+
static void __init mx53_loco_board_init(void)
{
mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
@@ -213,6 +222,10 @@ static void __init mx53_loco_board_init(void)
imx53_add_imx2_wdt(0, NULL);
imx53_add_imx_i2c(0, &mx53_loco_i2c_data);
imx53_add_imx_i2c(1, &mx53_loco_i2c_data);
+
+ imx53_add_mxc_pwm(1);
+ mxc_register_device(&mxc_pwm1_backlight_device,
+ &loco_pwm_backlight_data);
}
static void __init mx53_loco_timer_init(void)
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
2011-03-01 6:30 [PATCH 1/2] ARM imx53: add pwm devices support Jason Chen
2011-03-01 6:30 ` [PATCH 2/2] ARM MX53_LOCO: add pwm backlight device Jason Chen
@ 2011-03-01 7:35 ` Eric Miao
2011-03-01 8:10 ` Uwe Kleine-König
2 siblings, 0 replies; 14+ messages in thread
From: Eric Miao @ 2011-03-01 7:35 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Mar 1, 2011 at 2:30 PM, Jason Chen <b02280@freescale.com> wrote:
> Signed-off-by: Jason Chen <b02280@freescale.com>
Looks perfect to me. Sascha?
> ---
> ?arch/arm/mach-mx5/clock-mx51-mx53.c ? ? ? ? ?| ? ?2 ++
> ?arch/arm/mach-mx5/devices-imx53.h ? ? ? ? ? ?| ? ?4 ++++
> ?arch/arm/mach-mx5/devices.c ? ? ? ? ? ? ? ? ?| ? 10 ++++++++++
> ?arch/arm/mach-mx5/devices.h ? ? ? ? ? ? ? ? ?| ? ?2 ++
> ?arch/arm/plat-mxc/devices/Kconfig ? ? ? ? ? ?| ? ?1 +
> ?arch/arm/plat-mxc/devices/platform-mxc_pwm.c | ? ?9 +++++++++
> ?arch/arm/plat-mxc/pwm.c ? ? ? ? ? ? ? ? ? ? ?| ? ?3 ++-
> ?7 files changed, 30 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
> index 8164b1d..e18807b 100644
> --- a/arch/arm/mach-mx5/clock-mx51-mx53.c
> +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
> @@ -1338,6 +1338,8 @@ static struct clk_lookup mx53_lookups[] = {
> ? ? ? ?_REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk)
> ? ? ? ?_REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
> ? ? ? ?_REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
> + ? ? ? _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
> + ? ? ? _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
> ?};
>
> ?static void clk_tree_init(void)
> diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
> index 9251008..5a1d6c9 100644
> --- a/arch/arm/mach-mx5/devices-imx53.h
> +++ b/arch/arm/mach-mx5/devices-imx53.h
> @@ -33,3 +33,7 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst;
> ?extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst;
> ?#define imx53_add_imx2_wdt(id, pdata) ?\
> ? ? ? ?imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
> +
> +extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst;
> +#define imx53_add_mxc_pwm(id) ?\
> + ? ? ? imx_add_mxc_pwm(&imx53_mxc_pwm_data[id])
> diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
> index 153ada5..74aec2b 100644
> --- a/arch/arm/mach-mx5/devices.c
> +++ b/arch/arm/mach-mx5/devices.c
> @@ -120,6 +120,16 @@ struct platform_device mxc_usbh2_device = {
> ? ? ? ?},
> ?};
>
> +struct platform_device mxc_pwm1_backlight_device = {
> + ? ? ? .name = "pwm-backlight",
> + ? ? ? .id = 0,
> +};
> +
> +struct platform_device mxc_pwm2_backlight_device = {
> + ? ? ? .name = "pwm-backlight",
> + ? ? ? .id = 1,
> +};
> +
> ?static struct mxc_gpio_port mxc_gpio_ports[] = {
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.chip.label = "gpio-0",
> diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
> index 55a5129..a74cd97 100644
> --- a/arch/arm/mach-mx5/devices.h
> +++ b/arch/arm/mach-mx5/devices.h
> @@ -3,3 +3,5 @@ extern struct platform_device mxc_usbh1_device;
> ?extern struct platform_device mxc_usbh2_device;
> ?extern struct platform_device mxc_usbdr_udc_device;
> ?extern struct platform_device mxc_hsi2c_device;
> +extern struct platform_device mxc_pwm1_backlight_device;
> +extern struct platform_device mxc_pwm2_backlight_device;
> diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
> index b9ab1d5..aee9f4b 100644
> --- a/arch/arm/plat-mxc/devices/Kconfig
> +++ b/arch/arm/plat-mxc/devices/Kconfig
> @@ -58,6 +58,7 @@ config IMX_HAVE_PLATFORM_MXC_NAND
>
> ?config IMX_HAVE_PLATFORM_MXC_PWM
> ? ? ? ?bool
> + ? ? ? default y if ARCH_MX21 || ARCH_MX25 || SOC_IMX27 || SOC_IMX51 || SOC_IMX53
>
> ?config IMX_HAVE_PLATFORM_MXC_RNGA
> ? ? ? ?bool
> diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> index b0c4ae2..18cfd07 100644
> --- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> +++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> @@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
> ?};
> ?#endif /* ifdef CONFIG_SOC_IMX51 */
>
> +#ifdef CONFIG_SOC_IMX53
> +const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = {
> +#define imx53_mxc_pwm_data_entry(_id, _hwid) ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? ? imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K)
> + ? ? ? imx53_mxc_pwm_data_entry(0, 1),
> + ? ? ? imx53_mxc_pwm_data_entry(1, 2),
> +};
> +#endif /* ifdef CONFIG_SOC_IMX53 */
> +
> ?struct platform_device *__init imx_add_mxc_pwm(
> ? ? ? ? ? ? ? ?const struct imx_mxc_pwm_data *data)
> ?{
> diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
> index 7a61ef8..61dd8fb 100644
> --- a/arch/arm/plat-mxc/pwm.c
> +++ b/arch/arm/plat-mxc/pwm.c
> @@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
> ? ? ? ?if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
> ? ? ? ? ? ? ? ?return -EINVAL;
>
> - ? ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
> + ? ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() ||
> + ? ? ? ? ? ? ? cpu_is_mx53()) {
This might be improved in the future by using platform_device_id,
or by introducing some flags from platform_data, or when registering
the pwm devices.
> ? ? ? ? ? ? ? ?unsigned long long c;
> ? ? ? ? ? ? ? ?unsigned long period_cycles, duty_cycles, prescale;
> ? ? ? ? ? ? ? ?u32 cr;
> --
> 1.7.1
>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
2011-03-01 6:30 [PATCH 1/2] ARM imx53: add pwm devices support Jason Chen
2011-03-01 6:30 ` [PATCH 2/2] ARM MX53_LOCO: add pwm backlight device Jason Chen
2011-03-01 7:35 ` [PATCH 1/2] ARM imx53: add pwm devices support Eric Miao
@ 2011-03-01 8:10 ` Uwe Kleine-König
2011-03-01 8:21 ` Eric Miao
2011-03-01 9:08 ` Jason Chen
2 siblings, 2 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2011-03-01 8:10 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Mar 01, 2011 at 02:30:17PM +0800, Jason Chen wrote:
> Signed-off-by: Jason Chen <b02280@freescale.com>
> ---
> arch/arm/mach-mx5/clock-mx51-mx53.c | 2 ++
> arch/arm/mach-mx5/devices-imx53.h | 4 ++++
> arch/arm/mach-mx5/devices.c | 10 ++++++++++
> arch/arm/mach-mx5/devices.h | 2 ++
> arch/arm/plat-mxc/devices/Kconfig | 1 +
> arch/arm/plat-mxc/devices/platform-mxc_pwm.c | 9 +++++++++
> arch/arm/plat-mxc/pwm.c | 3 ++-
> 7 files changed, 30 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
> index 8164b1d..e18807b 100644
> --- a/arch/arm/mach-mx5/clock-mx51-mx53.c
> +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
> @@ -1338,6 +1338,8 @@ static struct clk_lookup mx53_lookups[] = {
> _REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk)
> _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
> _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
> + _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
> + _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
Do you really need "pwm"? I think NULL should do the job.
> };
>
> static void clk_tree_init(void)
> diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
> index 9251008..5a1d6c9 100644
> --- a/arch/arm/mach-mx5/devices-imx53.h
> +++ b/arch/arm/mach-mx5/devices-imx53.h
> @@ -33,3 +33,7 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst;
> extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst;
> #define imx53_add_imx2_wdt(id, pdata) \
> imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
> +
> +extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst;
> +#define imx53_add_mxc_pwm(id) \
> + imx_add_mxc_pwm(&imx53_mxc_pwm_data[id])
> diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
> index 153ada5..74aec2b 100644
> --- a/arch/arm/mach-mx5/devices.c
> +++ b/arch/arm/mach-mx5/devices.c
> @@ -120,6 +120,16 @@ struct platform_device mxc_usbh2_device = {
> },
> };
>
> +struct platform_device mxc_pwm1_backlight_device = {
> + .name = "pwm-backlight",
> + .id = 0,
> +};
> +
> +struct platform_device mxc_pwm2_backlight_device = {
> + .name = "pwm-backlight",
> + .id = 1,
> +};
> +
IMHO these should go into a seperate patch and preferably dynamically
allocated.
> static struct mxc_gpio_port mxc_gpio_ports[] = {
> {
> .chip.label = "gpio-0",
> diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
> index 55a5129..a74cd97 100644
> --- a/arch/arm/mach-mx5/devices.h
> +++ b/arch/arm/mach-mx5/devices.h
> @@ -3,3 +3,5 @@ extern struct platform_device mxc_usbh1_device;
> extern struct platform_device mxc_usbh2_device;
> extern struct platform_device mxc_usbdr_udc_device;
> extern struct platform_device mxc_hsi2c_device;
> +extern struct platform_device mxc_pwm1_backlight_device;
> +extern struct platform_device mxc_pwm2_backlight_device;
> diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
> index b9ab1d5..aee9f4b 100644
> --- a/arch/arm/plat-mxc/devices/Kconfig
> +++ b/arch/arm/plat-mxc/devices/Kconfig
> @@ -58,6 +58,7 @@ config IMX_HAVE_PLATFORM_MXC_NAND
>
> config IMX_HAVE_PLATFORM_MXC_PWM
> bool
> + default y if ARCH_MX21 || ARCH_MX25 || SOC_IMX27 || SOC_IMX51 || SOC_IMX53
If you do this, can you please use SOC_IMX21 and SOC_IMX25? Or maybe
even def_bool y?
> config IMX_HAVE_PLATFORM_MXC_RNGA
> bool
> diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> index b0c4ae2..18cfd07 100644
> --- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> +++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> @@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
> };
> #endif /* ifdef CONFIG_SOC_IMX51 */
>
> +#ifdef CONFIG_SOC_IMX53
> +const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = {
> +#define imx53_mxc_pwm_data_entry(_id, _hwid) \
> + imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K)
> + imx53_mxc_pwm_data_entry(0, 1),
> + imx53_mxc_pwm_data_entry(1, 2),
> +};
> +#endif /* ifdef CONFIG_SOC_IMX53 */
> +
> struct platform_device *__init imx_add_mxc_pwm(
> const struct imx_mxc_pwm_data *data)
> {
> diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
> index 7a61ef8..61dd8fb 100644
> --- a/arch/arm/plat-mxc/pwm.c
> +++ b/arch/arm/plat-mxc/pwm.c
> @@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
> if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
> return -EINVAL;
>
> - if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
> + if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() ||
> + cpu_is_mx53()) {
> unsigned long long c;
> unsigned long period_cycles, duty_cycles, prescale;
> u32 cr;
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
2011-03-01 8:10 ` Uwe Kleine-König
@ 2011-03-01 8:21 ` Eric Miao
2011-03-01 9:04 ` Uwe Kleine-König
2011-03-01 9:08 ` Jason Chen
1 sibling, 1 reply; 14+ messages in thread
From: Eric Miao @ 2011-03-01 8:21 UTC (permalink / raw)
To: linux-arm-kernel
>> ?config IMX_HAVE_PLATFORM_MXC_PWM
>> ? ? ? bool
>> + ? ? default y if ARCH_MX21 || ARCH_MX25 || SOC_IMX27 || SOC_IMX51 || SOC_IMX53
> If you do this, can you please use SOC_IMX21 and SOC_IMX25? ?Or maybe
> even def_bool y?
>
Or the other way, in config SOC_IMX53, select IMX_HAVE_PLATFORM_MXC_PWM?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
2011-03-01 8:21 ` Eric Miao
@ 2011-03-01 9:04 ` Uwe Kleine-König
0 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2011-03-01 9:04 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Mar 01, 2011 at 04:21:37PM +0800, Eric Miao wrote:
> >> ?config IMX_HAVE_PLATFORM_MXC_PWM
> >> ? ? ? bool
> >> + ? ? default y if ARCH_MX21 || ARCH_MX25 || SOC_IMX27 || SOC_IMX51 || SOC_IMX53
> > If you do this, can you please use SOC_IMX21 and SOC_IMX25? ?Or maybe
> > even def_bool y?
> >
>
> Or the other way, in config SOC_IMX53, select IMX_HAVE_PLATFORM_MXC_PWM?
Yeah, that's how most of the other IMX_HAVE_PLATFORM_XYZ work.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
2011-03-01 8:10 ` Uwe Kleine-König
2011-03-01 8:21 ` Eric Miao
@ 2011-03-01 9:08 ` Jason Chen
1 sibling, 0 replies; 14+ messages in thread
From: Jason Chen @ 2011-03-01 9:08 UTC (permalink / raw)
To: linux-arm-kernel
hi, Uwe,
Thanks for your comments.
2011/3/1 Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>:
> On Tue, Mar 01, 2011 at 02:30:17PM +0800, Jason Chen wrote:
>> Signed-off-by: Jason Chen <b02280@freescale.com>
>> ---
>> ?arch/arm/mach-mx5/clock-mx51-mx53.c ? ? ? ? ?| ? ?2 ++
>> ?arch/arm/mach-mx5/devices-imx53.h ? ? ? ? ? ?| ? ?4 ++++
>> ?arch/arm/mach-mx5/devices.c ? ? ? ? ? ? ? ? ?| ? 10 ++++++++++
>> ?arch/arm/mach-mx5/devices.h ? ? ? ? ? ? ? ? ?| ? ?2 ++
>> ?arch/arm/plat-mxc/devices/Kconfig ? ? ? ? ? ?| ? ?1 +
>> ?arch/arm/plat-mxc/devices/platform-mxc_pwm.c | ? ?9 +++++++++
>> ?arch/arm/plat-mxc/pwm.c ? ? ? ? ? ? ? ? ? ? ?| ? ?3 ++-
>> ?7 files changed, 30 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
>> index 8164b1d..e18807b 100644
>> --- a/arch/arm/mach-mx5/clock-mx51-mx53.c
>> +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
>> @@ -1338,6 +1338,8 @@ static struct clk_lookup mx53_lookups[] = {
>> ? ? ? _REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk)
>> ? ? ? _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
>> ? ? ? _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
>> + ? ? _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
>> + ? ? _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
> Do you really need "pwm"? ?I think NULL should do the job.
yes, I will remove it.
>
>> ?};
>>
>> ?static void clk_tree_init(void)
>> diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
>> index 9251008..5a1d6c9 100644
>> --- a/arch/arm/mach-mx5/devices-imx53.h
>> +++ b/arch/arm/mach-mx5/devices-imx53.h
>> @@ -33,3 +33,7 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst;
>> ?extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst;
>> ?#define imx53_add_imx2_wdt(id, pdata) ? ? ? ?\
>> ? ? ? imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
>> +
>> +extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst;
>> +#define imx53_add_mxc_pwm(id) ? ? ? ?\
>> + ? ? imx_add_mxc_pwm(&imx53_mxc_pwm_data[id])
>> diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
>> index 153ada5..74aec2b 100644
>> --- a/arch/arm/mach-mx5/devices.c
>> +++ b/arch/arm/mach-mx5/devices.c
>> @@ -120,6 +120,16 @@ struct platform_device mxc_usbh2_device = {
>> ? ? ? },
>> ?};
>>
>> +struct platform_device mxc_pwm1_backlight_device = {
>> + ? ? .name = "pwm-backlight",
>> + ? ? .id = 0,
>> +};
>> +
>> +struct platform_device mxc_pwm2_backlight_device = {
>> + ? ? .name = "pwm-backlight",
>> + ? ? .id = 1,
>> +};
>> +
> IMHO these should go into a seperate patch and preferably dynamically
> allocated.
ok, I will seperate this.
>
>> ?static struct mxc_gpio_port mxc_gpio_ports[] = {
>> ? ? ? {
>> ? ? ? ? ? ? ? .chip.label = "gpio-0",
>> diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
>> index 55a5129..a74cd97 100644
>> --- a/arch/arm/mach-mx5/devices.h
>> +++ b/arch/arm/mach-mx5/devices.h
>> @@ -3,3 +3,5 @@ extern struct platform_device mxc_usbh1_device;
>> ?extern struct platform_device mxc_usbh2_device;
>> ?extern struct platform_device mxc_usbdr_udc_device;
>> ?extern struct platform_device mxc_hsi2c_device;
>> +extern struct platform_device mxc_pwm1_backlight_device;
>> +extern struct platform_device mxc_pwm2_backlight_device;
>> diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
>> index b9ab1d5..aee9f4b 100644
>> --- a/arch/arm/plat-mxc/devices/Kconfig
>> +++ b/arch/arm/plat-mxc/devices/Kconfig
>> @@ -58,6 +58,7 @@ config IMX_HAVE_PLATFORM_MXC_NAND
>>
>> ?config IMX_HAVE_PLATFORM_MXC_PWM
>> ? ? ? bool
>> + ? ? default y if ARCH_MX21 || ARCH_MX25 || SOC_IMX27 || SOC_IMX51 || SOC_IMX53
> If you do this, can you please use SOC_IMX21 and SOC_IMX25? ?Or maybe
> even def_bool y?
>
sure
>> ?config IMX_HAVE_PLATFORM_MXC_RNGA
>> ? ? ? bool
>> diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
>> index b0c4ae2..18cfd07 100644
>> --- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
>> +++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
>> @@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
>> ?};
>> ?#endif /* ifdef CONFIG_SOC_IMX51 */
>>
>> +#ifdef CONFIG_SOC_IMX53
>> +const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = {
>> +#define imx53_mxc_pwm_data_entry(_id, _hwid) ? ? ? ? ? ? ? ? ? ? ? ? \
>> + ? ? imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K)
>> + ? ? imx53_mxc_pwm_data_entry(0, 1),
>> + ? ? imx53_mxc_pwm_data_entry(1, 2),
>> +};
>> +#endif /* ifdef CONFIG_SOC_IMX53 */
>> +
>> ?struct platform_device *__init imx_add_mxc_pwm(
>> ? ? ? ? ? ? ? const struct imx_mxc_pwm_data *data)
>> ?{
>> diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
>> index 7a61ef8..61dd8fb 100644
>> --- a/arch/arm/plat-mxc/pwm.c
>> +++ b/arch/arm/plat-mxc/pwm.c
>> @@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
>> ? ? ? if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
>> ? ? ? ? ? ? ? return -EINVAL;
>>
>> - ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
>> + ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() ||
>> + ? ? ? ? ? ? cpu_is_mx53()) {
>> ? ? ? ? ? ? ? unsigned long long c;
>> ? ? ? ? ? ? ? unsigned long period_cycles, duty_cycles, prescale;
>> ? ? ? ? ? ? ? u32 cr;
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. ? ? ? ? ? ? ? ? ? ? ? ? ? | Uwe Kleine-K?nig ? ? ? ? ? ?|
> Industrial Linux Solutions ? ? ? ? ? ? ? ? | http://www.pengutronix.de/ ?|
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
@ 2011-03-01 9:38 Jason Chen
2011-03-01 13:47 ` Fabio Estevam
0 siblings, 1 reply; 14+ messages in thread
From: Jason Chen @ 2011-03-01 9:38 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Jason Chen <b02280@freescale.com>
---
arch/arm/mach-mx5/clock-mx51-mx53.c | 2 ++
arch/arm/mach-mx5/devices-imx53.h | 4 ++++
arch/arm/plat-mxc/devices/platform-mxc_pwm.c | 9 +++++++++
arch/arm/plat-mxc/pwm.c | 3 ++-
4 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 8164b1d..8a2b8de 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -1338,6 +1338,8 @@ static struct clk_lookup mx53_lookups[] = {
_REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk)
_REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
_REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
+ _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk)
+ _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk)
};
static void clk_tree_init(void)
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
index 9251008..5a1d6c9 100644
--- a/arch/arm/mach-mx5/devices-imx53.h
+++ b/arch/arm/mach-mx5/devices-imx53.h
@@ -33,3 +33,7 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst;
extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst;
#define imx53_add_imx2_wdt(id, pdata) \
imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
+
+extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst;
+#define imx53_add_mxc_pwm(id) \
+ imx_add_mxc_pwm(&imx53_mxc_pwm_data[id])
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
index b0c4ae2..18cfd07 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
+++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
@@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
};
#endif /* ifdef CONFIG_SOC_IMX51 */
+#ifdef CONFIG_SOC_IMX53
+const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = {
+#define imx53_mxc_pwm_data_entry(_id, _hwid) \
+ imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K)
+ imx53_mxc_pwm_data_entry(0, 1),
+ imx53_mxc_pwm_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_SOC_IMX53 */
+
struct platform_device *__init imx_add_mxc_pwm(
const struct imx_mxc_pwm_data *data)
{
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index 7a61ef8..61dd8fb 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
return -EINVAL;
- if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
+ if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() ||
+ cpu_is_mx53()) {
unsigned long long c;
unsigned long period_cycles, duty_cycles, prescale;
u32 cr;
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
2011-03-01 9:38 Jason Chen
@ 2011-03-01 13:47 ` Fabio Estevam
2011-03-01 19:04 ` Uwe Kleine-König
0 siblings, 1 reply; 14+ messages in thread
From: Fabio Estevam @ 2011-03-01 13:47 UTC (permalink / raw)
To: linux-arm-kernel
Hi Jason,
On Tue, Mar 1, 2011 at 6:38 AM, Jason Chen <b02280@freescale.com> wrote:
...
> - ? ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
> + ? ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() ||
> + ? ? ? ? ? ? ? cpu_is_mx53()) {
Wouldn?t "if (!cpu_is_mx1() && !cpu_is_mx21())" work here and make
the if statement simpler?
Regards,
Fabio Estevam
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
2011-03-01 13:47 ` Fabio Estevam
@ 2011-03-01 19:04 ` Uwe Kleine-König
0 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2011-03-01 19:04 UTC (permalink / raw)
To: linux-arm-kernel
Hi Fabio,
On Tue, Mar 01, 2011 at 10:47:23AM -0300, Fabio Estevam wrote:
> On Tue, Mar 1, 2011 at 6:38 AM, Jason Chen <b02280@freescale.com> wrote:
> ...
> > - ? ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
> > + ? ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() ||
> > + ? ? ? ? ? ? ? cpu_is_mx53()) {
>
> Wouldn?t "if (!cpu_is_mx1() && !cpu_is_mx21())" work here and make
> the if statement simpler?
Yes, but less future proof. (Assume the next generation SoC is
different ...)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
@ 2011-03-04 2:48 Jason Chen
2011-04-04 14:58 ` Uwe Kleine-König
0 siblings, 1 reply; 14+ messages in thread
From: Jason Chen @ 2011-03-04 2:48 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Jason Chen <b02280@freescale.com>
---
arch/arm/mach-mx5/clock-mx51-mx53.c | 2 ++
arch/arm/mach-mx5/devices-imx53.h | 4 ++++
arch/arm/plat-mxc/devices/platform-mxc_pwm.c | 9 +++++++++
arch/arm/plat-mxc/pwm.c | 3 ++-
4 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 8164b1d..8a2b8de 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -1338,6 +1338,8 @@ static struct clk_lookup mx53_lookups[] = {
_REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk)
_REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
_REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
+ _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk)
+ _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk)
};
static void clk_tree_init(void)
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
index 9251008..5a1d6c9 100644
--- a/arch/arm/mach-mx5/devices-imx53.h
+++ b/arch/arm/mach-mx5/devices-imx53.h
@@ -33,3 +33,7 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst;
extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst;
#define imx53_add_imx2_wdt(id, pdata) \
imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
+
+extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst;
+#define imx53_add_mxc_pwm(id) \
+ imx_add_mxc_pwm(&imx53_mxc_pwm_data[id])
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
index b0c4ae2..18cfd07 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
+++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
@@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
};
#endif /* ifdef CONFIG_SOC_IMX51 */
+#ifdef CONFIG_SOC_IMX53
+const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = {
+#define imx53_mxc_pwm_data_entry(_id, _hwid) \
+ imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K)
+ imx53_mxc_pwm_data_entry(0, 1),
+ imx53_mxc_pwm_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_SOC_IMX53 */
+
struct platform_device *__init imx_add_mxc_pwm(
const struct imx_mxc_pwm_data *data)
{
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index 7a61ef8..61dd8fb 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
return -EINVAL;
- if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
+ if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() ||
+ cpu_is_mx53()) {
unsigned long long c;
unsigned long period_cycles, duty_cycles, prescale;
u32 cr;
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
2011-03-04 2:48 Jason Chen
@ 2011-04-04 14:58 ` Uwe Kleine-König
0 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2011-04-04 14:58 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 04, 2011 at 10:48:55AM +0800, Jason Chen wrote:
> Signed-off-by: Jason Chen <b02280@freescale.com>
> ---
> arch/arm/mach-mx5/clock-mx51-mx53.c | 2 ++
> arch/arm/mach-mx5/devices-imx53.h | 4 ++++
> arch/arm/plat-mxc/devices/platform-mxc_pwm.c | 9 +++++++++
> arch/arm/plat-mxc/pwm.c | 3 ++-
> 4 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
> index 8164b1d..8a2b8de 100644
> --- a/arch/arm/mach-mx5/clock-mx51-mx53.c
> +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
> @@ -1338,6 +1338,8 @@ static struct clk_lookup mx53_lookups[] = {
> _REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk)
> _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
> _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
> + _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk)
> + _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk)
there are already lines
_REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
_REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
further up in the list. I guess your definition is better, so can you
please remove the existing ones?
> };
>
> static void clk_tree_init(void)
> diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
> index 9251008..5a1d6c9 100644
> --- a/arch/arm/mach-mx5/devices-imx53.h
> +++ b/arch/arm/mach-mx5/devices-imx53.h
> @@ -33,3 +33,7 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst;
> extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst;
> #define imx53_add_imx2_wdt(id, pdata) \
> imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
> +
> +extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst;
> +#define imx53_add_mxc_pwm(id) \
> + imx_add_mxc_pwm(&imx53_mxc_pwm_data[id])
> diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> index b0c4ae2..18cfd07 100644
> --- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> +++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> @@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
> };
> #endif /* ifdef CONFIG_SOC_IMX51 */
>
> +#ifdef CONFIG_SOC_IMX53
> +const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = {
> +#define imx53_mxc_pwm_data_entry(_id, _hwid) \
> + imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K)
> + imx53_mxc_pwm_data_entry(0, 1),
> + imx53_mxc_pwm_data_entry(1, 2),
You can shorten this a bit:
imx_mxc_pwm_data_entry(MX53, 0, 1, SZ_16K)
imx_mxc_pwm_data_entry(MX53, 1, 2, SZ_16K)
I don't care much, but Sascha considers this better.
> +};
> +#endif /* ifdef CONFIG_SOC_IMX53 */
> +
> struct platform_device *__init imx_add_mxc_pwm(
> const struct imx_mxc_pwm_data *data)
> {
> diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
> index 7a61ef8..61dd8fb 100644
> --- a/arch/arm/plat-mxc/pwm.c
> +++ b/arch/arm/plat-mxc/pwm.c
> @@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
> if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
> return -EINVAL;
>
> - if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
> + if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() ||
> + cpu_is_mx53()) {
> unsigned long long c;
> unsigned long period_cycles, duty_cycles, prescale;
> u32 cr;
> --
> 1.7.1
>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
@ 2011-08-30 7:52 jason.chen at freescale.com
2011-08-30 9:14 ` Eric Miao
0 siblings, 1 reply; 14+ messages in thread
From: jason.chen at freescale.com @ 2011-08-30 7:52 UTC (permalink / raw)
To: linux-arm-kernel
From: Jason Chen <b02280@freescale.com>
Signed-off-by: Jason Chen <b02280@freescale.com>
Signed-off-by: Jason Chen <jason.chen@linaro.org>
---
arch/arm/mach-mx5/clock-mx51-mx53.c | 2 ++
arch/arm/mach-mx5/devices-imx53.h | 4 ++++
arch/arm/plat-mxc/devices/platform-mxc_pwm.c | 9 +++++++++
arch/arm/plat-mxc/pwm.c | 3 ++-
4 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index f7bf996..f5f116f 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -1507,6 +1507,8 @@ static struct clk_lookup mx53_lookups[] = {
_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
_REGISTER_CLOCK("imx-keypad", NULL, dummy_clk)
+ _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk)
+ _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk)
};
static void clk_tree_init(void)
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
index c27fe8b..258e68f 100644
--- a/arch/arm/mach-mx5/devices-imx53.h
+++ b/arch/arm/mach-mx5/devices-imx53.h
@@ -40,3 +40,7 @@ extern const struct imx_imx_ssi_data imx53_imx_ssi_data[];
extern const struct imx_imx_keypad_data imx53_imx_keypad_data;
#define imx53_add_imx_keypad(pdata) \
imx_add_imx_keypad(&imx53_imx_keypad_data, pdata)
+
+extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst;
+#define imx53_add_mxc_pwm(id) \
+ imx_add_mxc_pwm(&imx53_mxc_pwm_data[id])
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
index b0c4ae2..18cfd07 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
+++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
@@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
};
#endif /* ifdef CONFIG_SOC_IMX51 */
+#ifdef CONFIG_SOC_IMX53
+const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = {
+#define imx53_mxc_pwm_data_entry(_id, _hwid) \
+ imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K)
+ imx53_mxc_pwm_data_entry(0, 1),
+ imx53_mxc_pwm_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_SOC_IMX53 */
+
struct platform_device *__init imx_add_mxc_pwm(
const struct imx_mxc_pwm_data *data)
{
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index 761c3c9..5dda436 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
return -EINVAL;
- if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
+ if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()
+ || cpu_is_mx53()) {
unsigned long long c;
unsigned long period_cycles, duty_cycles, prescale;
u32 cr;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 1/2] ARM imx53: add pwm devices support
2011-08-30 7:52 jason.chen at freescale.com
@ 2011-08-30 9:14 ` Eric Miao
0 siblings, 0 replies; 14+ messages in thread
From: Eric Miao @ 2011-08-30 9:14 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Aug 30, 2011 at 3:52 PM, <jason.chen@freescale.com> wrote:
> From: Jason Chen <b02280@freescale.com>
>
> Signed-off-by: Jason Chen <b02280@freescale.com>
> Signed-off-by: Jason Chen <jason.chen@linaro.org>
Looks good to me. Sascha, any comments?
Acked-by: Eric Miao <eric.miao@linaro.org>
> ---
> ?arch/arm/mach-mx5/clock-mx51-mx53.c ? ? ? ? ?| ? ?2 ++
> ?arch/arm/mach-mx5/devices-imx53.h ? ? ? ? ? ?| ? ?4 ++++
> ?arch/arm/plat-mxc/devices/platform-mxc_pwm.c | ? ?9 +++++++++
> ?arch/arm/plat-mxc/pwm.c ? ? ? ? ? ? ? ? ? ? ?| ? ?3 ++-
> ?4 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
> index f7bf996..f5f116f 100644
> --- a/arch/arm/mach-mx5/clock-mx51-mx53.c
> +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
> @@ -1507,6 +1507,8 @@ static struct clk_lookup mx53_lookups[] = {
> ? ? ? ?_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
> ? ? ? ?_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
> ? ? ? ?_REGISTER_CLOCK("imx-keypad", NULL, dummy_clk)
> + ? ? ? _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk)
> + ? ? ? _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk)
> ?};
>
> ?static void clk_tree_init(void)
> diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
> index c27fe8b..258e68f 100644
> --- a/arch/arm/mach-mx5/devices-imx53.h
> +++ b/arch/arm/mach-mx5/devices-imx53.h
> @@ -40,3 +40,7 @@ extern const struct imx_imx_ssi_data imx53_imx_ssi_data[];
> ?extern const struct imx_imx_keypad_data imx53_imx_keypad_data;
> ?#define imx53_add_imx_keypad(pdata) ? ?\
> ? ? ? ?imx_add_imx_keypad(&imx53_imx_keypad_data, pdata)
> +
> +extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst;
> +#define imx53_add_mxc_pwm(id) ?\
> + ? ? ? imx_add_mxc_pwm(&imx53_mxc_pwm_data[id])
> diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> index b0c4ae2..18cfd07 100644
> --- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> +++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
> @@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
> ?};
> ?#endif /* ifdef CONFIG_SOC_IMX51 */
>
> +#ifdef CONFIG_SOC_IMX53
> +const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = {
> +#define imx53_mxc_pwm_data_entry(_id, _hwid) ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? ? imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K)
> + ? ? ? imx53_mxc_pwm_data_entry(0, 1),
> + ? ? ? imx53_mxc_pwm_data_entry(1, 2),
> +};
> +#endif /* ifdef CONFIG_SOC_IMX53 */
> +
> ?struct platform_device *__init imx_add_mxc_pwm(
> ? ? ? ? ? ? ? ?const struct imx_mxc_pwm_data *data)
> ?{
> diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
> index 761c3c9..5dda436 100644
> --- a/arch/arm/plat-mxc/pwm.c
> +++ b/arch/arm/plat-mxc/pwm.c
> @@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
> ? ? ? ?if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
> ? ? ? ? ? ? ? ?return -EINVAL;
>
> - ? ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
> + ? ? ? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()
> + ? ? ? ? ? ? ? || cpu_is_mx53()) {
> ? ? ? ? ? ? ? ?unsigned long long c;
> ? ? ? ? ? ? ? ?unsigned long period_cycles, duty_cycles, prescale;
> ? ? ? ? ? ? ? ?u32 cr;
> --
> 1.7.4.1
>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-08-30 9:14 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01 6:30 [PATCH 1/2] ARM imx53: add pwm devices support Jason Chen
2011-03-01 6:30 ` [PATCH 2/2] ARM MX53_LOCO: add pwm backlight device Jason Chen
2011-03-01 7:35 ` [PATCH 1/2] ARM imx53: add pwm devices support Eric Miao
2011-03-01 8:10 ` Uwe Kleine-König
2011-03-01 8:21 ` Eric Miao
2011-03-01 9:04 ` Uwe Kleine-König
2011-03-01 9:08 ` Jason Chen
-- strict thread matches above, loose matches on Subject: below --
2011-03-01 9:38 Jason Chen
2011-03-01 13:47 ` Fabio Estevam
2011-03-01 19:04 ` Uwe Kleine-König
2011-03-04 2:48 Jason Chen
2011-04-04 14:58 ` Uwe Kleine-König
2011-08-30 7:52 jason.chen at freescale.com
2011-08-30 9:14 ` Eric Miao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).