mx51: Add PWM resources
Subsystems (2)
PATCH 1/5 mx51: Add PWM resources
Add PWM resources.
---
arch/arm/mach-mx5/devices.c |???50 +++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-mx5/devices.h |? ? 2 +
2 files changed, 52 insertions(+), 0 deletions(-)
arch/arm/mach-mx5/devices.c +50 -0
@@ -131,6 +131,56 @@ struct platform_device mxc_keypad_device = { ??? .resource = mxc_kpp_resources, }; +static struct resource mxc_pwm0_resources[] = { +??? { +??? ??? .start = MX51_PWM1_BASE_ADDR, +??? ??? .end = MX51_PWM1_BASE_ADDR + 0x14, +??? ??? .flags = IORESOURCE_MEM, +??? }, +??? { +??? ??? .start = MX51_MXC_INT_PWM1, +??? ??? .end = MX51_MXC_INT_PWM1, +??? ??? .flags = IORESOURCE_IRQ, +??? }, +}; + +struct platform_device mxc_pwm0_device = { +??? .name = "mxc_pwm", +??? .id = 0, +??? .num_resources = ARRAY_SIZE(mxc_pwm0_resources), +??? .resource = mxc_pwm0_resources, +}; + +static struct resource mxc_pwm1_resources[] = { +??? { +??? ??? .start = MX51_PWM2_BASE_ADDR, +??? ??? .end = MX51_PWM2_BASE_ADDR + 0x14, +??? ??? .flags = IORESOURCE_MEM, +??? }, +??? { +??? ??? .start = MX51_MXC_INT_PWM2, +??? ??? .end = MX51_MXC_INT_PWM2, +??? ??? .flags = IORESOURCE_IRQ, +??? }, +}; + +struct platform_device mxc_pwm1_device = { +??? .name = "mxc_pwm", +??? .id = 1, +??? .num_resources = ARRAY_SIZE(mxc_pwm1_resources), +??? .resource = mxc_pwm1_resources, +}; + +struct platform_device mxc_pwm0_backlight_device = { +??? .name = "pwm-backlight", +??? .id = 0, +}; + +struct platform_device mxc_pwm1_backlight_device = { +??? .name = "pwm-backlight", +??? .id = 1, +}; +static struct mxc_gpio_port mxc_gpio_ports[] = { ??? { ??? ??? .chip.label = "gpio-0",
arch/arm/mach-mx5/devices.h +2 -0
@@ -4,3 +4,5 @@ extern struct platform_device mxc_usbdr_udc_device;extern struct platform_device mxc_wdt;extern struct platform_device mxc_hsi2c_device;extern struct platform_device mxc_keypad_device; +extern struct platform_device mxc_pwm0_device; +extern struct platform_device mxc_pwm0_backlight_device;
Signature · 1 line
1.6.0.4
PATCH 1/5 mx51: Add PWM resources
Hello Fabio,
Quoted 7 lines · Fabio Estevam
Add PWM resources.
Signed-off-by Fabio Estevam <[email protected]>---
arch/arm/mach-mx5/devices.c|???50 +++++++++++++++++++++++++++++++++++++++++++arch/arm/mach-mx5/devices.h|? ? 2 +
I'm currently trying to get rid of the devices.c files and allocate the devices dynamically. Can you please use the same approach? I already have plat-mxc/devices/platform-mxc_pwm.c in my tree. I'm trying to post my patches later today and check with Sascha how to integrate it (that probably only tomorrow).
Quoted 7 lines
2 files changed, 52 insertions(+), 0 deletions(-)arch/arm/mach-mx5/devices.c +0
-0
arch/arm/mach-mx5/devices.c struct platform_device mxc_keypad_device = { · line 137
Quoted 7 lines
arch/arm/mach-mx5/devices.c +4
-0@@ -131,6 +131,56 @@ struct platform_device mxc_keypad_device = { ??? .resource = mxc_kpp_resources, }; +static struct resource mxc_pwm0_resources[] = { +??? { +??? ??? .start = MX51_PWM1_BASE_ADDR, +??? ??? .end = MX51_PWM1_BASE_ADDR + 0x14,
I think you need at least 0x17 here, as the last (32 bit wide) register starts at 0x14. When checking the memory map in the reference manual the blocks reserved for pwm have a size of 16 KiB. So I'd prefer SZ_16K here.
Quoted 54 lines
arch/arm/mach-mx5/devices.c +46
-0+??? ??? .flags = IORESOURCE_MEM, +??? }, +??? { +??? ??? .start = MX51_MXC_INT_PWM1, +??? ??? .end = MX51_MXC_INT_PWM1, +??? ??? .flags = IORESOURCE_IRQ, +??? }, +}; + +struct platform_device mxc_pwm0_device = { +??? .name = "mxc_pwm", +??? .id = 0, +??? .num_resources = ARRAY_SIZE(mxc_pwm0_resources), +??? .resource = mxc_pwm0_resources, +}; + +static struct resource mxc_pwm1_resources[] = { +??? { +??? ??? .start = MX51_PWM2_BASE_ADDR, +??? ??? .end = MX51_PWM2_BASE_ADDR + 0x14, +??? ??? .flags = IORESOURCE_MEM, +??? }, +??? { +??? ??? .start = MX51_MXC_INT_PWM2, +??? ??? .end = MX51_MXC_INT_PWM2, +??? ??? .flags = IORESOURCE_IRQ, +??? }, +}; + +struct platform_device mxc_pwm1_device = { +??? .name = "mxc_pwm", +??? .id = 1, +??? .num_resources = ARRAY_SIZE(mxc_pwm1_resources), +??? .resource = mxc_pwm1_resources, +}; + +struct platform_device mxc_pwm0_backlight_device = { +??? .name = "pwm-backlight", +??? .id = 0, +}; + +struct platform_device mxc_pwm1_backlight_device = { +??? .name = "pwm-backlight", +??? .id = 1, +}; +static struct mxc_gpio_port mxc_gpio_ports[] = { ??? { ??? ??? .chip.label = "gpio-0",arch/arm/mach-mx5/devices.h +0
-0
arch/arm/mach-mx5/devices.h extern struct platform_device mxc_usbdr_udc_device; · line 8
Quoted 5 lines
arch/arm/mach-mx5/devices.h +2
-0@@ -4,3 +4,5 @@ extern struct platform_device mxc_usbdr_udc_device;extern struct platform_device mxc_wdt;extern struct platform_device mxc_hsi2c_device;extern struct platform_device mxc_keypad_device; +extern struct platform_device mxc_pwm0_device; +extern struct platform_device mxc_pwm0_backlight_device;
Not that it matters much because I want these allocated dynamically, but you forgot the pwm1 devices here.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |