Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SC16IS75x Breakout Boards as Shields #259

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions boards/shields/sc16is75x_bb/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config SHIELD_CJMCU_750
bool
default y if SHIELD_CJMCU_750_I2C
default y if SHIELD_CJMCU_750_I2C_NOIRQ
default y if SHIELD_CJMCU_750_SPI
default y if SHIELD_CJMCU_750_SPI_NOIRQ
default n

config SHIELD_CJMCU_752
bool
default y if SHIELD_CJMCU_752_I2C
default y if SHIELD_CJMCU_752_I2C_NOIRQ
default y if SHIELD_CJMCU_752_SPI
default y if SHIELD_CJMCU_752_SPI_NOIRQ
default n

config MFD
default y
depends on SHIELD_CJMCU_750 || SHIELD_CJMCU_752

config I2C
default y if SHIELD_CJMCU_750_I2C || SHIELD_CJMCU_750_I2C_NOIRQ
default y if SHIELD_CJMCU_752_I2C || SHIELD_CJMCU_752_I2C_NOIRQ
depends on SHIELD_CJMCU_750 || SHIELD_CJMCU_752

config SPI
default y if SHIELD_CJMCU_750_SPI || SHIELD_CJMCU_750_SPI_NOIRQ
default y if SHIELD_CJMCU_752_SPI || SHIELD_CJMCU_752_SPI_NOIRQ
depends on SHIELD_CJMCU_750 || SHIELD_CJMCU_752

config SERIAL
default y if DT_HAS_NXP_SC16IS75X_UART_ENABLED
depends on SHIELD_CJMCU_750 || SHIELD_CJMCU_752

config GPIO
default y if DT_HAS_NXP_SC16IS75X_GPIO_ENABLED
depends on SHIELD_CJMCU_750 || SHIELD_CJMCU_752

config DYNAMIC_THREAD_POOL_SIZE
default 1 if MFD_SC16IS75X_ASYNC && !DYNAMIC_THREAD_ALLOC
depends on (SHIELD_CJMCU_750 || SHIELD_CJMCU_752) && MFD_SC16IS75X
26 changes: 26 additions & 0 deletions boards/shields/sc16is75x_bb/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config SHIELD_CJMCU_750_I2C
def_bool $(shields_list_contains,cjmcu_750_i2c)

config SHIELD_CJMCU_750_I2C_NOIRQ
def_bool $(shields_list_contains,cjmcu_750_i2c_noirq)

config SHIELD_CJMCU_750_SPI
def_bool $(shields_list_contains,cjmcu_750_spi)

config SHIELD_CJMCU_750_SPI_NOIRQ
def_bool $(shields_list_contains,cjmcu_750_spi_noirq)

config SHIELD_CJMCU_752_I2C
def_bool $(shields_list_contains,cjmcu_752_i2c)

config SHIELD_CJMCU_752_I2C_NOIRQ
def_bool $(shields_list_contains,cjmcu_752_i2c_noirq)

config SHIELD_CJMCU_752_SPI
def_bool $(shields_list_contains,cjmcu_752_spi)

config SHIELD_CJMCU_752_SPI_NOIRQ
def_bool $(shields_list_contains,cjmcu_752_spi_noirq)
9 changes: 9 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_750.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "cjmcu_750/osc.dtsi"
#include "cjmcu_75x/core.dtsi"
#include "cjmcu_75x/gpio.dtsi"
#include "cjmcu_75x/uart0.dtsi"
14 changes: 14 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_750/osc.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

/ {
cjmcu_osc: sc16is752-osc {
compatible = "fixed-clock";
status = "okay";

#clock-cells = <0>;
clock-frequency = <14746500>;
};
};
10 changes: 10 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_750_i2c.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "cjmcu_750_i2c_noirq.overlay"

&cjmcu_75x {
interrupt-gpios = <&cjmcu_hif_i2c 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
24 changes: 24 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_750_i2c_noirq.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/i2c/i2c.h>
#include <zephyr/dt-bindings/gpio/gpio.h>

&cjmcu_i2c {
status = "okay";

clock-frequency = <I2C_BITRATE_STANDARD>;

cjmcu_75x: sc16is750@48 {
reg = <0x48>;

reset-gpios = <&cjmcu_hif_i2c 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;

cjmcu_75x_gpio: sc16is750-48-gpio {};
cjmcu_75x_uart0: sc16is750-48-uart@0 {};
};
};

#include "cjmcu_750.dtsi"
10 changes: 10 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_750_spi.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "cjmcu_750_spi_noirq.overlay"

&cjmcu_75x {
interrupt-gpios = <&cjmcu_hif_spi 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
23 changes: 23 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_750_spi_noirq.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include <freq.h>
#include <zephyr/dt-bindings/gpio/gpio.h>

&cjmcu_spi {
status = "okay";

cjmcu_75x: sc16is750@0 {
reg = <0>;

spi-max-frequency = <DT_FREQ_M(4)>;
reset-gpios = <&cjmcu_hif_spi 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;

cjmcu_75x_gpio: sc16is750-0-gpio {};
cjmcu_75x_uart0: sc16is750-0-uart@0 {};
};
};

#include "cjmcu_750.dtsi"
10 changes: 10 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_752.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "cjmcu_752/osc.dtsi"
#include "cjmcu_75x/core.dtsi"
#include "cjmcu_75x/gpio.dtsi"
#include "cjmcu_75x/uart0.dtsi"
#include "cjmcu_75x/uart1.dtsi"
14 changes: 14 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_752/osc.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

/ {
cjmcu_osc: sc16is752-osc {
compatible = "fixed-clock";
status = "okay";

#clock-cells = <0>;
clock-frequency = <1843200>;
};
};
10 changes: 10 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_752_i2c.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "cjmcu_752_i2c_noirq.overlay"

&cjmcu_75x {
interrupt-gpios = <&cjmcu_hif_i2c 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
25 changes: 25 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_752_i2c_noirq.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/i2c/i2c.h>
#include <zephyr/dt-bindings/gpio/gpio.h>

&cjmcu_i2c {
status = "okay";

clock-frequency = <I2C_BITRATE_STANDARD>;

cjmcu_75x: sc16is752@48 {
reg = <0x48>;

reset-gpios = <&cjmcu_hif_i2c 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;

cjmcu_75x_gpio: sc16is752-48-gpio {};
cjmcu_75x_uart0: sc16is752-48-uart@0 {};
cjmcu_75x_uart1: sc16is752-48-uart@1 {};
};
};

#include "cjmcu_752.dtsi"
10 changes: 10 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_752_spi.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "cjmcu_752_spi_noirq.overlay"

&cjmcu_75x {
interrupt-gpios = <&cjmcu_hif_spi 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
24 changes: 24 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_752_spi_noirq.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include <freq.h>
#include <zephyr/dt-bindings/gpio/gpio.h>

&cjmcu_spi {
status = "okay";

cjmcu_75x: sc16is752@0 {
reg = <0>;

spi-max-frequency = <DT_FREQ_M(4)>;
reset-gpios = <&cjmcu_hif_spi 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;

cjmcu_75x_gpio: sc16is752-0-gpio {};
cjmcu_75x_uart0: sc16is752-0-uart@0 {};
cjmcu_75x_uart1: sc16is752-0-uart@1 {};
};
};

#include "cjmcu_752.dtsi"
14 changes: 14 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_75x/core.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&cjmcu_75x {
compatible = "nxp,sc16is75x";
status = "okay";

#address-cells = <1>;
#size-cells = <0>;

clock = <&cjmcu_osc>;
};
33 changes: 33 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_75x/gpio.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

/ {
cjmcu_gpio: cjmcu-75x-gpio-pins {
compatible = "cjmcu,75x-gpio-header";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <0 0 &cjmcu_75x_gpio 0 0>,
<1 0 &cjmcu_75x_gpio 1 0>,
<2 0 &cjmcu_75x_gpio 2 0>,
<3 0 &cjmcu_75x_gpio 3 0>,
<4 0 &cjmcu_75x_gpio 4 0>,
<5 0 &cjmcu_75x_gpio 5 0>,
<6 0 &cjmcu_75x_gpio 6 0>,
<7 0 &cjmcu_75x_gpio 7 0>;
};
};

&cjmcu_75x_gpio {
compatible = "nxp,sc16is75x-gpio";
status = "okay";

gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;

gpio-line-names = "IO0", "IO1", "IO2", "IO3",
"IO4", "IO5", "IO6", "IO7";
};
16 changes: 16 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_75x/uart0.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&cjmcu_75x_uart0 {
compatible = "nxp,sc16is75x-uart";
status = "okay";

reg = <0>;

current-speed = <115200>;
data-bits = <8>;
parity = "none";
stop-bits = "1";
};
16 changes: 16 additions & 0 deletions boards/shields/sc16is75x_bb/cjmcu_75x/uart1.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&cjmcu_75x_uart1 {
compatible = "nxp,sc16is75x-uart";
status = "okay";

reg = <1>;

current-speed = <115200>;
data-bits = <8>;
parity = "none";
stop-bits = "1";
};
Loading