Skip to contentSkip to conversation

Add bluetooth, gps and accelerometer to TBS A711

PATCH Applied [email protected] 4 participants 14 messages Mar 27, 2019 – Apr 1, 2019

Subsystems (3)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add bluetooth, gps and accelerometer to TBS A711

From: Ondrej Jirman <megous-5qf/[email protected]>

This series enables some peripherals on TBS A711 tablet that already have mainline drivers:

- GPS u-blox neo-6m (via gnss u-blox driver)
- Bluetooth (via recently added OF support in the Broadcom bluetooth driver)
- Accelermomter BMA-250 (hooked to the I2C bus)

It also modifies A83T DTSI and adds missing UART interfaces.

I've added additional compatible to the gnss/u-blox driver for NEO-6M, because this board uses this module, and I don't think I can use the existing compatible for u-blox,neo-m8, even as a fallback.

Please take a look, and apply the patches if you have no objections.

Many of the patches will go through the sunxi tree, but I'm not sure who will want to take the GPS patches.

regards,
Ondrej Jirman

Ondrej Jirman (7):
ARM: dts: sun8i: tbs-a711: Enable bluetooth
ARM: dts: sun8i: tbs-a711: Add node for BMA250 accelerometer
ARM: dts: sun8i: a83t: Add nodes for UART2-UART4
ARM: dts: sun8i: a83t: Add UART2 PB pins
gnss: Add u-blox,neo-6m compatible
dt-bindings: gnss: Add u-blox,neo-6m compatible
ARM: dts: sun8i: tbs-a711: Enable UART2 (for NEO-6M GPS module)

 .../devicetree/bindings/gnss/u-blox.txt       |  1 +
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts     | 49 +++++++++++++++++++
 arch/arm/boot/dts/sun8i-a83t.dtsi             | 38 ++++++++++++++
 drivers/gnss/ubx.c                            |  1 +
 4 files changed, 89 insertions(+)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/7 ARM: dts: sun8i: tbs-a711: Enable bluetooth

From: Ondrej Jirman <megous-5qf/[email protected]>

TBS A711 tablet has a bcm20702a1 bluetooth chip (part of AP6210 WiFi/BT module) connected to UART1. Add node for the blutooth chip.

The driver needs brcm/BCM20702A1.hcd firmware file to run.

---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +13 -0
index 1e840ab5a541..6aae70c89a1e 100644
@@ -406,7 +406,20 @@
 &uart1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+	uart-has-rtscts;
 	status = "okay";
+
+	bluetooth {
+		compatible = "brcm,bcm20702a1";
+		clocks = <&ac100_rtc 1>;
+		clock-names = "lpo";
+		vbat-supply = <&reg_vbat>;
+		vddio-supply = <&reg_dldo1>;
+		device-wakeup-gpios = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+		host-wakeup-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
+		shutdown-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
+		max-speed = <1500000>;
+	};
 };
 
 &usb_otg {
Signature · 1 line
2.21.0
#3 lore raw

PATCH 2/7 ARM: dts: sun8i: tbs-a711: Add node for BMA250 accelerometer

In reply to [email protected]

From: Ondrej Jirman <megous-5qf/[email protected]>

A711 tablet has BMA250 accelerometer connected to I2C1 bus. Enable both the I2C1 bus and add the accelerometer device to it.

---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +15 -0
index 6aae70c89a1e..347fc0c31fa4 100644
@@ -156,6 +156,21 @@
 	status = "okay";
 };
 
+&i2c1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c1_pins>;
+	clock-frequency = <400000>;
+	status = "okay";
+
+	/* Accelerometer */
+	bma250@18 {
+		compatible = "bosch,bma250";
+		reg = <0x18>;
+		interrupt-parent = <&pio>;
+		interrupts = <7 10 IRQ_TYPE_EDGE_RISING>; /* PH10 / EINT10 */
+	};
+};
+
 &mmc0 {
 	vmmc-supply = <&reg_dcdc1>;
 	pinctrl-names = "default";
Signature · 1 line
2.21.0
#6 lore raw

PATCH 3/7 ARM: dts: sun8i: a83t: Add nodes for UART2-UART4

In reply to [email protected]

From: Ondrej Jirman <megous-5qf/[email protected]>

A83T has 5 UART interfaces, but only the first two have their nodes defined in sun8i-a83t.dtsi. Add nodes for the missing interfaces.

---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 33 +++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm/boot/dts/sun8i-a83t.dtsi +33 -0
index fcb7ef5ce2df..e5c39eef1c29 100644
@@ -873,6 +873,39 @@
 			status = "disabled";
 		};
 
+		uart2: serial@1c28800 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28800 0x400>;
+			interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&ccu CLK_BUS_UART2>;
+			resets = <&ccu RST_BUS_UART2>;
+			status = "disabled";
+		};
+
+		uart3: serial@1c28c00 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28c00 0x400>;
+			interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&ccu CLK_BUS_UART3>;
+			resets = <&ccu RST_BUS_UART3>;
+			status = "disabled";
+		};
+
+		uart4: serial@1c29000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c29000 0x400>;
+			interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&ccu CLK_BUS_UART4>;
+			resets = <&ccu RST_BUS_UART4>;
+			status = "disabled";
+		};
+
 		i2c0: i2c@1c2ac00 {
 			compatible = "allwinner,sun8i-a83t-i2c",
 				     "allwinner,sun6i-a31-i2c";
Signature · 1 line
2.21.0
#8 lore raw

PATCH 4/7 ARM: dts: sun8i: a83t: Add UART2 PB pins

In reply to [email protected]

From: Ondrej Jirman <megous-5qf/[email protected]>

Add pin definitions for UART2 PB pins. These are used on TBS-A711 tablet.

---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/sun8i-a83t.dtsi +5 -0
index e5c39eef1c29..921cfb30ab46 100644
@@ -768,6 +768,11 @@
 				pins = "PG8", "PG9";
 				function = "uart1";
 			};
+
+			uart2_pb_pins: uart2-pb-pins {
+				pins = "PB0", "PB1";
+				function = "uart2";
+			};
 		};
 
 		timer@1c20c00 {
Signature · 1 line
2.21.0
#10 lore raw

PATCH 5/7 gnss: Add u-blox,neo-6m compatible

In reply to [email protected]

From: Ondrej Jirman <megous-5qf/[email protected]>

Add compatible for u-blox NEO-6M GPS module.

---
 drivers/gnss/ubx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gnss/ubx.c +1 -0
index 12568aebb7f6..1ada2fad1d4e 100644
@@ -132,6 +132,7 @@ static void ubx_remove(struct serdev_device *serdev)
 static const struct of_device_id ubx_of_match[] = {
 	{ .compatible = "u-blox,neo-8" },
 	{ .compatible = "u-blox,neo-m8" },
+	{ .compatible = "u-blox,neo-6m" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, ubx_of_match);
Signature · 1 line
2.21.0
#11 lore raw

PATCH 6/7 dt-bindings: gnss: Add u-blox,neo-6m compatible

In reply to [email protected]

From: Ondrej Jirman <megous-5qf/[email protected]>

Add compatible for u-blox NEO-6M GPS module.

---
 Documentation/devicetree/bindings/gnss/u-blox.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/gnss/u-blox.txt +1 -0
index e475659cb85f..7cdefd058fe0 100644
@@ -9,6 +9,7 @@ Required properties:
 
 - compatible	: Must be one of
 
+			"u-blox,neo-6m"
 			"u-blox,neo-8"
 			"u-blox,neo-m8"
 
Signature · 1 line
2.21.0
#13 lore raw

PATCH 7/7 ARM: dts: sun8i: tbs-a711: Enable UART2 (for NEO-6M GPS module)

In reply to [email protected]

From: Ondrej Jirman <megous-5qf/[email protected]>

TBS A711 tablet contains u-blox NEO-6M module connected to UART2. Enable UART2 to gain access to the module from userspace.

---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +21 -0
index 347fc0c31fa4..f9e7f5d3eff5 100644
@@ -98,6 +98,13 @@
 		};
 	};
 
+	reg_gps: reg-gps {
+		compatible = "regulator-fixed";
+		regulator-name = "gps";
+		regulator-min-microvolt = <3000000>;
+		regulator-max-microvolt = <3000000>;
+	};
+
 	reg_vbat: reg-vbat {
 		compatible = "regulator-fixed";
 		regulator-name = "vbat";
@@ -437,6 +444,20 @@
 	};
 };
 
+&uart2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart2_pb_pins>;
+	status = "okay";
+
+	gnss {
+		compatible = "u-blox,neo-6m";
+
+		v-bckp-supply = <&reg_rtc_ldo>;
+		vcc-supply = <&reg_gps>;
+		current-speed = <9600>;
+	};
+};
+
 &usb_otg {
 	dr_mode = "otg";
 	status = "okay";
Signature · 1 line
2.21.0
#9 lore raw

Re: [linux-sunxi] [PATCH 4/7] ARM: dts: sun8i: a83t: Add UART2 PB pins

In reply to [email protected]
Quoted 16 lines · megous via linux-sunxi

From: Ondrej Jirman <megous-5qf/[email protected]>

Add pin definitions for UART2 PB pins. These are used on TBS-A711 tablet.

---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/sun8i-a83t.dtsi +0 -0
index e5c39eef1c29..921cfb30ab46 100644

arch/arm/boot/dts/sun8i-a83t.dtsi line 771

Quoted 4 lines
arch/arm/boot/dts/sun8i-a83t.dtsi +1 -0
@@ -768,6 +768,11 @@
                                pins = "PG8", "PG9";
                                function = "uart1";
                        };
+

Please add "/omit-if-no-ref/" before the pin definitions.

See

https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git/commit/?h=sunxi/dt-for-5.2&id=73b670023327a014688c2d5309a43604cd553f1e

for such an example. This is a new policy.

ChenYu

Quoted 14 lines
arch/arm/boot/dts/sun8i-a83t.dtsi +4 -1
+                       uart2_pb_pins: uart2-pb-pins {
+                               pins = "PB0", "PB1";
+                               function = "uart2";
+                       };
                };
 
                timer@1c20c00 {
--

2.21.0

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.

maintainer Reviewed-by on v1 6/7
#12 lore raw

Re: [PATCH 6/7] dt-bindings: gnss: Add u-blox,neo-6m compatible

In reply to [email protected]
Quoted 9 lines · On Wed, 27 Mar 2019 01:18:42 +0100, [email protected] wrote:

From: Ondrej Jirman <[email protected]>

Add compatible for u-blox NEO-6M GPS module.

---
 Documentation/devicetree/bindings/gnss/u-blox.txt | 1 +
 1 file changed, 1 insertion(+)
#4 lore raw

Re: [PATCH 2/7] ARM: dts: sun8i: tbs-a711: Add node for BMA250 accelerometer

In reply to [email protected]

Hi,

Quoted 15 lines · On Wed, Mar 27, 2019 at 01:18:38AM +0100…

From: Ondrej Jirman <megous-5qf/[email protected]>

A711 tablet has BMA250 accelerometer connected to I2C1 bus. Enable both the I2C1 bus and add the accelerometer device to it.

---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +0 -0
index 6aae70c89a1e..347fc0c31fa4 100644

arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts line 161

Quoted 6 lines
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +3 -0
@@ -156,6 +156,21 @@
 	status = "okay";
 };
 
+&i2c1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c1_pins>;

It's there already

arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts line 166

Quoted 5 lines
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +5 -0
+	clock-frequency = <400000>;
+	status = "okay";
+
+	/* Accelerometer */
+	bma250@18 {

The node name should be the class of the device, not its model, so something like accelerometer.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#2 lore raw

Re: [PATCH 1/7] ARM: dts: sun8i: tbs-a711: Enable bluetooth

In reply to [email protected]

Hi,

Quoted 8 lines · On Wed, Mar 27, 2019 at 01:18:37AM +0100, [email protected] wrote:

From: Ondrej Jirman <[email protected]>

TBS A711 tablet has a bcm20702a1 bluetooth chip (part of AP6210 WiFi/BT module) connected to UART1. Add node for the blutooth chip.

The driver needs brcm/BCM20702A1.hcd firmware file to run.

Applied, thanks!
Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#7 lore raw

Re: [PATCH 3/7] ARM: dts: sun8i: a83t: Add nodes for UART2-UART4

In reply to [email protected]
Quoted 6 lines · On Wed, Mar 27, 2019 at 01:18:39AM +0100…

From: Ondrej Jirman <megous-5qf/[email protected]>

A83T has 5 UART interfaces, but only the first two have their nodes defined in sun8i-a83t.dtsi. Add nodes for the missing interfaces.

Applied, thanks!
Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#5 lore raw

Re: [PATCH 2/7] ARM: dts: sun8i: tbs-a711: Add node for BMA250 accelerometer

In reply to Maxime Ripard

Hello Maxime,

Quoted 21 lines · Maxime Ripard

Hi,

Quoted 18 lines · On Wed, Mar 27, 2019 at 01:18:38AM +0100…

From: Ondrej Jirman <megous-5qf/[email protected]>

A711 tablet has BMA250 accelerometer connected to I2C1 bus. Enable both the I2C1 bus and add the accelerometer device to it.

---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +0 -0
index 6aae70c89a1e..347fc0c31fa4 100644
@@ -156,6 +156,21 @@
 	status = "okay";
 };
 
Quoted 5 lines

arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts line 161

Quoted 3 lines
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +3 -0
+&i2c1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c1_pins>;

It's there already

I see, I'll drop it. Thanks.

Quoted 8 lines

arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts line 166

Quoted 5 lines
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +5 -0
+	clock-frequency = <400000>;
+	status = "okay";
+
+	/* Accelerometer */
+	bma250@18 {

The node name should be the class of the device, not its model, so something like accelerometer.

I'll rename this.

thank you,
Ondrej

Quoted 6 lines

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com