-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
230 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Linux", | ||
"includePath": [ | ||
"${workspaceFolder}/**", | ||
"/home/me/develop/mangopi-mq/kernel/linux-6.6.47/include", | ||
"/home/me/develop/mangopi-mq/kernel/linux-6.6.47/arch/arm/include" | ||
], | ||
"defines": [], | ||
"compilerPath": "/usr/bin/clang-6.0", | ||
"cStandard": "c17", | ||
"cppStandard": "c++14", | ||
"intelliSenseMode": "linux-clang-x64" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"files.associations": { | ||
"module.h": "c", | ||
"uio_driver.h": "c", | ||
"device.h": "c", | ||
"unistd.h": "c" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,14 @@ | ||
# Introduction | ||
This is `uio` Linux driver for `T113-S3` PWM sub system. | ||
|
||
# Build and deploy | ||
1. build | ||
```bash | ||
export KBUILDDIR=<KERNEL BUILD DIR> | ||
export ARCH=arm | ||
export CROSS_COMPILE=arm-none-eabi- | ||
make | ||
``` | ||
2. Copy `sun20i-pwm-uio.ko` to proper directory in target rootfs (e.g. `/lib/modules/6.6.47/kernel/drivers/pwm/`) | ||
3. run `depmod -a` in target to update `module.alias` and `module.dep` | ||
|
||
# DTS | ||
In order to instantiate this driver, add following lines to `sun8i-t113s-mangopi-mq-r-t113.dts` file. | ||
We need `pinctrl` to configure _PWM_ pins for this kernel module. | ||
``` | ||
&pio { | ||
/omit-if-no-ref/ | ||
pwm2_pe8_pin: pwm2-pe8-pin { | ||
pins = "PE8"; | ||
function = "pwm2"; | ||
}; | ||
|
||
/omit-if-no-ref/ | ||
pwm3_pe9_pin: pwm3-pe9-pin { | ||
pins = "PE9"; | ||
function = "pwm3"; | ||
}; | ||
|
||
/omit-if-no-ref/ | ||
pwm4_pe10_pin: pwm4-pe10-pin { | ||
pins = "PE10"; | ||
function = "pwm4"; | ||
}; | ||
|
||
/omit-if-no-ref/ | ||
pwm5_pe13_pin: pwm5-pe13-pin { | ||
pins = "PE13"; | ||
function = "pwm5"; | ||
}; | ||
}; | ||
|
||
&soc { | ||
pwm_uio: pwm_uio@2000c00 { | ||
compatible = "allwinner,sun20i-pwm-uio"; | ||
reg = <0x2000c00 0x400>; | ||
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>; | ||
clocks = <&ccu CLK_BUS_PWM>, <&dcxo>; | ||
clock-names = "bus", "mod"; | ||
resets = <&ccu RST_BUS_PWM>; | ||
pinctrl-0 = <&pwm2_pe8_pin>, | ||
<&pwm3_pe9_pin>, | ||
<&pwm4_pe10_pin>, | ||
<&pwm5_pe13_pin>; | ||
pinctrl-names = "default"; | ||
}; | ||
}; | ||
``` | ||
This repository includes `uio` driver for `T113-S3 PWM` peripheral. | ||
|
||
# Directories | ||
- `driver`: kernel space driver | ||
It's basically platform device which is registered into `uio` framework. All register handling is done in user space. | ||
- `lib`: user space library | ||
Shared library for interfacing with `PWM` peripheral. | ||
- `app`: user space application | ||
User space application which implement simple use case of library APIs. | ||
|
||
# Links | ||
1. [UIO howto](https://www.kernel.org/doc/html/v4.14/driver-api/uio-howto.html) | ||
2. [UIO generic driver for platform device](https://elixir.bootlin.com/linux/v6.10.9/source/drivers/uio/uio_pdrv_genirq.c) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"files.associations": { | ||
"types.h": "c", | ||
"mman.h": "c", | ||
"fcntl.h": "c", | ||
"errno.h": "c", | ||
"errno-base.h": "c", | ||
"pwm.h": "c" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Introduction | ||
This is `uio` Linux driver for `T113-S3` PWM sub system. | ||
|
||
# Build and deploy | ||
1. build | ||
```bash | ||
export KBUILDDIR=<KERNEL BUILD DIR> | ||
export ARCH=arm | ||
export CROSS_COMPILE=arm-none-eabi- | ||
make | ||
``` | ||
2. Copy `sun20i-pwm-uio.ko` to proper directory in target rootfs (e.g. `/lib/modules/6.6.47/kernel/drivers/pwm/`) | ||
3. run `depmod -a` in target to update `module.alias` and `module.dep` | ||
|
||
# DTS | ||
In order to instantiate this driver, add following lines to `sun8i-t113s-mangopi-mq-r-t113.dts` file. | ||
We need `pinctrl` to configure _PWM_ pins for this kernel module. | ||
``` | ||
&pio { | ||
/omit-if-no-ref/ | ||
pwm2_pe8_pin: pwm2-pe8-pin { | ||
pins = "PE8"; | ||
function = "pwm2"; | ||
}; | ||
|
||
/omit-if-no-ref/ | ||
pwm3_pe9_pin: pwm3-pe9-pin { | ||
pins = "PE9"; | ||
function = "pwm3"; | ||
}; | ||
|
||
/omit-if-no-ref/ | ||
pwm4_pe10_pin: pwm4-pe10-pin { | ||
pins = "PE10"; | ||
function = "pwm4"; | ||
}; | ||
|
||
/omit-if-no-ref/ | ||
pwm5_pe13_pin: pwm5-pe13-pin { | ||
pins = "PE13"; | ||
function = "pwm5"; | ||
}; | ||
}; | ||
|
||
&soc { | ||
pwm_uio: pwm_uio@2000c00 { | ||
compatible = "allwinner,sun20i-pwm-uio"; | ||
reg = <0x2000c00 0x400>; | ||
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>; | ||
clocks = <&ccu CLK_BUS_PWM>, <&dcxo>; | ||
clock-names = "bus", "mod"; | ||
resets = <&ccu RST_BUS_PWM>; | ||
pinctrl-0 = <&pwm2_pe8_pin>, | ||
<&pwm3_pe9_pin>, | ||
<&pwm4_pe10_pin>, | ||
<&pwm5_pe13_pin>; | ||
pinctrl-names = "default"; | ||
}; | ||
}; | ||
``` |
File renamed without changes.