Skip to contentSkip to conversation

pwm: loongson1: Add PWM driver for Loongson1 SoC

PATCH In review Yang Ling 2 participants 3 messages Feb 15, 2017 – Apr 24, 2017

Subsystems (3)
lore
Share & tools
lore

Yang Ling

author
#0 lore raw

PATCH v2 1/2 pwm: loongson1: Add PWM driver for Loongson1 SoC

Add support for the PWM controller present in Loongson1 family of SoCs.

---
V2:
Remove ls1x_pwm_channel.
Remove period_ns/duty_ns check.
Add return values check.

---
 drivers/pwm/Kconfig         |   9 +++
 drivers/pwm/Makefile        |   1 +
 drivers/pwm/pwm-loongson1.c | 148 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 158 insertions(+)
 create mode 100644 drivers/pwm/pwm-loongson1.c
drivers/pwm/Kconfig +9 -0
index f92dd41..985f2fe 100644
@@ -216,6 +216,15 @@ config PWM_JZ4740
 	  To compile this driver as a module, choose M here: the module
 	  will be called pwm-jz4740.
 
+config PWM_LOONGSON1
+	tristate "Loongson1 PWM support"
+	depends on MACH_LOONGSON32
+	help
+	  Generic PWM framework driver for Loongson1 based machines.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pwm-loongson1.
+
 config PWM_LP3943
 	tristate "TI/National Semiconductor LP3943 PWM support"
 	depends on MFD_LP3943
drivers/pwm/Makefile +1 -0
index a48bdb5..1979453 100644
@@ -19,6 +19,7 @@ obj-$(CONFIG_PWM_HIBVT)		+= pwm-hibvt.o
 obj-$(CONFIG_PWM_IMG)		+= pwm-img.o
 obj-$(CONFIG_PWM_IMX)		+= pwm-imx.o
 obj-$(CONFIG_PWM_JZ4740)	+= pwm-jz4740.o
+obj-$(CONFIG_PWM_LOONGSON1)	+= pwm-loongson1.o
 obj-$(CONFIG_PWM_LP3943)	+= pwm-lp3943.o
 obj-$(CONFIG_PWM_LPC18XX_SCT)	+= pwm-lpc18xx-sct.o
 obj-$(CONFIG_PWM_LPC32XX)	+= pwm-lpc32xx.o
drivers/pwm/pwm-loongson1.c new file +148 -0

148 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 9 lines · Yang Ling

Add support for the PWM controller present in Loongson1 family of SoCs.

---
V2:
Remove ls1x_pwm_channel.
Remove period_ns/duty_ns check.
Add return values check.

Quoted 6 lines
---
 drivers/pwm/Kconfig         |   9 +++
 drivers/pwm/Makefile        |   1 +
 drivers/pwm/pwm-loongson1.c | 148 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 158 insertions(+)
 create mode 100644 drivers/pwm/pwm-loongson1.c

Looks like this doesn't compile because it uses register definitions from loongson1.h that aren't what the driver expects. Looks like the driver wants parameterized ones, but those present in the kernel are not.

Any plans on fixing that? How did you build-test this?

Thierry

author
#2 lore raw

Hi, Thierry,

I am sorry for the late reply.

For some historical reasons, Loongson1x series SoCs is still unable to support the device tree.
So drivers need to rely on some register-related macro definitions in loongson1.h(arch/mips/include/asm/mach-loongson32/loongson1.h). The driver is currently tested on the Loongson1C development board.
We plan to solve the problem together after the SoCs bootloader supports the device tree.

Thanks for your friendly reminder.

Yang

Quoted 25 lines · Thierry Reding
Quoted 9 lines · Yang Ling

Add support for the PWM controller present in Loongson1 family of SoCs.

---
V2:
Remove ls1x_pwm_channel.
Remove period_ns/duty_ns check.
Add return values check.

Quoted 6 lines
---
 drivers/pwm/Kconfig         |   9 +++
 drivers/pwm/Makefile        |   1 +
 drivers/pwm/pwm-loongson1.c | 148 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 158 insertions(+)
 create mode 100644 drivers/pwm/pwm-loongson1.c

Looks like this doesn't compile because it uses register definitions from loongson1.h that aren't what the driver expects. Looks like the driver wants parameterized ones, but those present in the kernel are not.

Any plans on fixing that? How did you build-test this?

Thierry