Skip to content

Commit 404493a

Browse files
committed
add: BB-I2C2-BME680.dts/BB-W1-P9.12-00A0.dts
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
1 parent ae33e11 commit 404493a

File tree

6 files changed

+385
-3
lines changed

6 files changed

+385
-3
lines changed

src/arm/overlays/BB-ADC-00A0.dts

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,95 @@
1818
&tscadc {
1919
status = "okay";
2020
adc {
21+
// Configure one or more (up to 8) steps for the adc to execute:
22+
23+
24+
// For each step, the channel to sample.
25+
// range: 0 .. 7
2126
ti,adc-channels = <0 1 2 3 4 5 6 7>;
27+
//
28+
// BeagleBone Black (and most other variants):
29+
// ch 0 P9.39
30+
// ch 1 P9.40
31+
// ch 2 P9.37
32+
// ch 3 P9.38
33+
// ch 4 P9.33
34+
// ch 5 P9.36
35+
// ch 6 P9.35
36+
// ch 7 measures 0.5 * VDD_3V3B with 2.4 kΩ source impedance
37+
//
38+
// PocketBeagle:
39+
// ch 0 P1.19
40+
// ch 1 P1.21
41+
// ch 2 P1.23
42+
// ch 3 P1.25
43+
// ch 4 P1.27
44+
// ch 5 P2.35 via 10k/10k voltage divider
45+
// ch 6 P1.02 via 10k/10k voltage divider
46+
// ch 7 P2.36 via pmic mux
47+
//
48+
// The divider used on PocketBeagle channels 5 and 6 makes the effective voltage V_eff and
49+
// source impedance Z_eff seen by the adc on these channels depend on the voltage V_src and
50+
// impedance Z_src of the source connected to the corresponding pin as follows:
51+
//
52+
// V_eff = V_src / (2 + Z_src / (10 kΩ))
53+
// Z_eff = 5 kΩ * (1 + Z_src / (Z_src + 20 kΩ))
54+
// ≈ 5 kΩ + Z_src / 4 for small values of Z_src (up to 2 kΩ or so)
55+
56+
57+
// For each step, number of adc clock cycles to wait between setting up muxes and sampling.
58+
// range: 0 .. 262143
59+
// optional, default is 152 (XXX but why?!)
60+
ti,chan-step-opendelay = <152 152 152 152 152 152 152 152>;
61+
//`
62+
// XXX is there any purpose to set this nonzero other than to fine-tune the sample rate?
63+
64+
65+
// For each step, how many times it should sample to average.
66+
// range: 1 .. 16, must be power of two (i.e. 1, 2, 4, 8, or 16)
67+
// optional, default is 16
2268
ti,chan-step-avg = <16 16 16 16 16 16 16 16>;
23-
ti,chan-step-opendelay = <0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98>;
24-
ti,chan-step-sampledelay = <0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0>;
69+
//
70+
// If you're using periodic sampling (using the iio block device rather than sysfs) then
71+
// you should consider setting this to 1 and if desired reduce the samplerate in userspace
72+
// instead since averaging isn't a particularly good low-pass filter.
73+
//
74+
// If you're using sysfs to occasionally read a value, then the default value of 16 will
75+
// still get you the most accurate readings.
76+
77+
78+
// For each step, number of adc clock cycles to sample minus two.
79+
// range: 0 .. 255 (resulting in sampling time of 2 .. 257 cycles)
80+
// optional, default is 0
81+
ti,chan-step-sampledelay = <0 0 0 0 0 0 0 0>;
82+
//
83+
// If this is set too low, accuracy will deteriorate when the thing you're measuring has a
84+
// high source impedance. The maximum source impedance recommended (by erratum 1.0.32) is:
85+
// (2 + sampledelay) * 2.873 kΩ - 0.2 kΩ
86+
// which means that the default should be fine for source impedance up to 5.5 kΩ.
87+
//
88+
// (This seems to ensure the sampling time is at least 21 times the RC constant, based on
89+
// the 5.5 pF nominal capacitance specified in the datasheet.)
90+
91+
92+
// After sampling, conversion time is 13 adc clock cycles.
93+
//
94+
// The adc clock frequency is 3 MHz, therefore the total time per step in microseconds is:
95+
// ( opendelay + avg * ( 2 + sampledelay + 13 ) ) / 3
96+
//
97+
// If all steps use the same timings then the sample rate will be:
98+
// 3 MHz / ( opendelay + avg * ( 2 + sampledelay + 13 ) ) / number_of_steps
99+
//
100+
// The highest samplerate obtainable (avg=1, opendelay=0, sampledelay=0) is therefore:
101+
// 200 kHz / number_of_steps
102+
// = 25 kHz when using all 8 steps.
103+
//
104+
// Using avg=16 reduces that to:
105+
// 12.5 kHz / number_of_steps
106+
// = 1.5625 kHz when using all 8 steps.
107+
//
108+
// Using the default values (avg=16, opendelay=152, sampledelay=0) reduces that to:
109+
// 7.653 kHz / number_of_steps
110+
// = 0.9566 kHz when using all 8 steps.
25111
};
26112
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* Copyright (C) 2022 Robert Nelson <robertcnelson@gmail.com>
4+
*/
5+
6+
/dts-v1/;
7+
/plugin/;
8+
9+
/*
10+
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
11+
*/
12+
&{/chosen} {
13+
overlays {
14+
BB-I2C2-BME680.kernel = __TIMESTAMP__;
15+
};
16+
};
17+
18+
&i2c2 {
19+
status = "okay";
20+
21+
clock-frequency = <100000>;
22+
23+
#address-cells = <1>;
24+
#size-cells = <0>;
25+
26+
bme680@76 {
27+
status = "okay";
28+
compatible = "bosch,bme680";
29+
reg = <0x76>;
30+
};
31+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* Copyright (C) 2015 Robert Nelson <robertcnelson@gmail.com>
4+
* Virtual cape for onewire on connector pin P9.12
5+
*/
6+
7+
/dts-v1/;
8+
/plugin/;
9+
10+
#include <dt-bindings/gpio/gpio.h>
11+
#include <dt-bindings/pinctrl/am33xx.h>
12+
13+
/*
14+
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
15+
*/
16+
&{/chosen} {
17+
overlays {
18+
BB-W1-P9.12-00A0.kernel = __TIMESTAMP__;
19+
};
20+
};
21+
22+
/*
23+
* Free up the pins used by the cape from the pinmux helpers.
24+
*/
25+
&ocp {
26+
P9_12_pinmux { status = "disabled"; }; /* P9_12 (U18) gpmc_be1n.gpio1_28 */
27+
};
28+
29+
&am33xx_pinmux {
30+
bb_dallas_w1_pins: pinmux_bb_dallas_w1_pins {
31+
pinctrl-single,pins = <
32+
AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_INPUT_PULLUP, MUX_MODE7) /* P9_12 (U18) gpmc_be1n.gpio1_28 */
33+
>;
34+
};
35+
};
36+
37+
&{/} {
38+
onewire {
39+
status = "okay";
40+
pinctrl-names = "default";
41+
pinctrl-0 = <&bb_dallas_w1_pins>;
42+
43+
compatible = "w1-gpio";
44+
gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
45+
};
46+
};

src/arm/overlays/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ dtbo-$(CONFIG_ARCH_OMAP2PLUS) += \
1111
BB-BONE-NH7C-01-A0.dtbo \
1212
BB-CAPE-DISP-CT4-00A0.dtbo \
1313
BB-HDMI-TDA998x-00A0.dtbo \
14+
BB-I2C2-BME680.dtbo \
1415
BB-SPIDEV0-00A0.dtbo \
1516
BB-SPIDEV1-00A0.dtbo \
17+
BB-W1-P9.12-00A0.dtbo \
1618
BBORG_COMMS-00A2.dtbo \
1719
BBORG_FAN-A000.dtbo \
1820
BBORG_RELAY-00A2.dtbo \
1921
BONE-ADC.dtbo \
2022
M-BB-BBG-00A0.dtbo \
21-
M-BB-BBGG-00A0.dtbo
23+
M-BB-BBGG-00A0.dtbo \
24+
PB-MIKROBUS-0.dtbo \
25+
PB-MIKROBUS-1.dtbo
2226

2327
targets += dtbs dtbs_install
2428
targets += $(dtbo-y)

src/arm/overlays/PB-MIKROBUS-0.dts

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* Copyright 2020 Vaishnav M A, BeagleBoard.org Foundation.
4+
*/
5+
6+
/dts-v1/;
7+
/plugin/;
8+
9+
#include <dt-bindings/gpio/gpio.h>
10+
#include <dt-bindings/pinctrl/am33xx.h>
11+
12+
/*
13+
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
14+
*/
15+
&{/chosen} {
16+
overlays {
17+
PB-MIKROBUS-0.kernel = __TIMESTAMP__;
18+
};
19+
};
20+
21+
/*
22+
* Free up the pins used by the cape from the pinmux helpers.
23+
*/
24+
&ocp {
25+
P2_01_pinmux { status = "disabled"; };
26+
P2_03_pinmux { status = "disabled"; };
27+
P2_05_pinmux { status = "disabled"; };
28+
P2_07_pinmux { status = "disabled"; };
29+
P2_09_pinmux { status = "disabled"; };
30+
P2_11_pinmux { status = "disabled"; };
31+
P1_12_pinmux { status = "disabled"; };
32+
P1_10_pinmux { status = "disabled"; };
33+
P1_08_pinmux { status = "disabled"; };
34+
P1_06_pinmux { status = "disabled"; };
35+
P1_04_pinmux { status = "disabled"; };
36+
P1_02_pinmux { status = "disabled"; };
37+
};
38+
39+
&{/} {
40+
aliases {
41+
mikrobus0 = "/mikrobus-0";
42+
};
43+
44+
mikrobus-0 {
45+
compatible = "linux,mikrobus";
46+
status = "okay";
47+
pinctrl-names = "default", "pwm_default", "pwm_gpio",
48+
"uart_default", "uart_gpio", "i2c_default",
49+
"i2c_gpio", "spi_default", "spi_gpio";
50+
pinctrl-0 = <
51+
&P2_03_gpio_input_pin
52+
&P1_04_gpio_pin
53+
&P1_02_gpio_pin
54+
>;
55+
pinctrl-1 = <&P2_01_pwm_pin>;
56+
pinctrl-2 = <&P2_01_gpio_pin>;
57+
pinctrl-3 = <
58+
&P2_05_uart_pin
59+
&P2_07_uart_pin
60+
>;
61+
pinctrl-4 = <
62+
&P2_05_gpio_pin
63+
&P2_07_gpio_pin
64+
>;
65+
pinctrl-5 = <
66+
&P2_09_i2c_pin
67+
&P2_11_i2c_pin
68+
>;
69+
pinctrl-6 = <
70+
&P2_09_gpio_pin
71+
&P2_11_gpio_pin
72+
>;
73+
pinctrl-7 = <
74+
&P1_12_spi_pin
75+
&P1_10_spi_pin
76+
&P1_08_spi_sclk_pin
77+
&P1_06_spi_cs_pin
78+
>;
79+
pinctrl-8 = <
80+
&P1_12_gpio_pin
81+
&P1_10_gpio_pin
82+
&P1_08_gpio_pin
83+
&P1_06_gpio_pin
84+
>;
85+
i2c-adapter = <&i2c1>;
86+
spi-master = <0>;
87+
spi-cs = <0 1>;
88+
uart = <&uart4>;
89+
pwms = <&ehrpwm1 0 500000 0>;
90+
mikrobus-gpios = <&gpio1 18 0> , <&gpio0 23 0>,
91+
<&gpio0 30 0> , <&gpio0 31 0>,
92+
<&gpio0 15 0> , <&gpio0 14 0>,
93+
<&gpio0 4 0> , <&gpio0 3 0>,
94+
<&gpio0 2 0> , <&gpio0 5 0>,
95+
<&gpio2 25 0> , <&gpio2 3 0>;
96+
};
97+
};
98+
99+
&spi0 {
100+
status = "okay";
101+
channel@0{ status = "disabled"; };
102+
};
103+
104+
&uart4 {
105+
status = "okay";
106+
force-empty-serdev-controller;
107+
};

0 commit comments

Comments
 (0)