| /* | 
 |  * Copyright (c) 2020 Erik Larson | 
 |  * Copyright (c) 2020-2022 Jason Kridner, BeagleBoard.org Foundation | 
 |  * | 
 |  * SPDX-License-Identifier: Apache-2.0 | 
 |  */ | 
 |  | 
 | /dts-v1/; | 
 |  | 
 | #include <ti/cc1352r7.dtsi> | 
 | #include "beagleconnect_freedom-pinctrl.dtsi" | 
 | #include <zephyr/dt-bindings/input/input-event-codes.h> | 
 |  | 
 | #define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP) | 
 |  | 
 | / { | 
 | 	model = "BeagleConnect Freedom"; | 
 | 	compatible = "beagle,beagleconnect-freedom"; | 
 |  | 
 | 	aliases { | 
 | 		led0 = &led0; | 
 | 		sw0 = &button0; | 
 | 		mcuboot-button0 = &button0; | 
 | 		sensor0 = &light; | 
 | 		sensor1 = &humidity; | 
 | 		watchdog0 = &wdt0; | 
 | 	}; | 
 |  | 
 | 	chosen { | 
 | 		zephyr,sram = &sram0; | 
 | 		zephyr,console = &uart0; | 
 | 		zephyr,shell-uart = &uart0; | 
 | 		zephyr,flash = &flash0; | 
 | 		zephyr,ieee802154 = &ieee802154g; | 
 | 		zephyr,code-partition = &slot0_partition; | 
 | 		zephyr,uart-mcumgr = &uart0; | 
 | 	}; | 
 |  | 
 | 	gpio_keys { | 
 | 		compatible = "gpio-keys"; | 
 |  | 
 | 		button0: button_0 { | 
 | 			gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; | 
 | 			zephyr,code = <INPUT_KEY_0>; | 
 | 		}; | 
 | 	}; | 
 |  | 
 | 	/** | 
 | 	 * The BeagleConnect Freedom has an on-board antenna switch (SKY13317-373LF) used to select | 
 | 	 * the appropriate RF signal port based on the currently-used PHY. | 
 | 	 * | 
 | 	 * Truth table: | 
 | 	 * | 
 | 	 * Path         DIO29 DIO30 | 
 | 	 * ===========  ===== ===== | 
 | 	 * Off          0     0 | 
 | 	 * Sub-1 GHz    0     1     // DIO30 mux to IOC_PORT_RFC_GPO0 for auto | 
 | 	 * 20 dBm TX    1     0     // DIO29 mux to IOC_PORT_RFC_GPO3 for auto | 
 | 	 */ | 
 | 	antenna_mux0: antenna_mux0 { | 
 | 		compatible = "skyworks,sky13317"; | 
 | 		status = "okay"; | 
 | 		gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>, <&gpio0 30 GPIO_ACTIVE_HIGH>; | 
 | 		pinctrl-0 = <&board_ant_tx_pa_off &board_ant_subg_off>; | 
 | 		pinctrl-1 = <&board_ant_tx_pa_off &board_ant_subg_on>; | 
 | 		pinctrl-2 = <&board_ant_tx_pa_on &board_ant_subg_on>; | 
 | 		pinctrl-names = "default", "ant_subg", "ant_subg_pa"; | 
 | 	}; | 
 |  | 
 | 	leds: leds { | 
 | 		compatible = "gpio-leds"; | 
 |  | 
 | 		led0: led_0 { | 
 | 			gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>; // 2.4GHz TX/RX | 
 | 		}; | 
 | 	}; | 
 |  | 
 | 	sens_i2c: sensor-switch { | 
 | 		status = "okay"; | 
 | 		compatible = "gpio-i2c-switch"; | 
 | 		#address-cells = <1>; | 
 | 		#size-cells = <0>; | 
 | 		controller = <&i2c0>; | 
 | 		gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; | 
 |  | 
 | 		light: opt3001-light@44 { | 
 | 			status = "okay"; | 
 | 			compatible = "ti,opt3001"; | 
 | 			reg = <0x44>; | 
 | 		}; | 
 |  | 
 | 		humidity: hdc2010-humidity@41 { | 
 | 			status = "okay"; | 
 | 			compatible = "ti,hdc2010"; | 
 | 			reg = <0x41>; | 
 | 		}; | 
 | 	}; | 
 | }; | 
 |  | 
 | &flash0 { | 
 | 	partitions { | 
 | 		compatible = "fixed-partitions"; | 
 | 		#address-cells = <1>; | 
 | 		#size-cells = <1>; | 
 |  | 
 | 		/* Allocate 56 KiB for mcuboot */ | 
 | 		boot_partition: partition@0 { | 
 | 			label = "mcuboot"; | 
 | 			reg = <0x00000000 DT_SIZE_K(56)>; | 
 | 		}; | 
 |  | 
 | 		/* Allocate 640 KiB for application */ | 
 | 		slot0_partition: partition@e000 { | 
 | 			label = "image-0"; | 
 | 			reg = <0x0000e000 DT_SIZE_K(640)>; | 
 | 		}; | 
 |  | 
 | 		/* (avoid touching CCFG) */ | 
 | 	}; | 
 | }; | 
 |  | 
 | &cpu0 { | 
 | 	clock-frequency = <48000000>; | 
 | }; | 
 |  | 
 | &trng { | 
 | 	status = "okay"; | 
 | }; | 
 |  | 
 | &gpio0 { | 
 | 	status = "okay"; | 
 | }; | 
 |  | 
 | /* Side away from battery connector (with MSP430) */ | 
 | &uart0 { | 
 | 	status = "okay"; | 
 | 	current-speed = <115200>; | 
 | 	pinctrl-0 = <&uart0_rx_default &uart0_tx_default>; | 
 | 	pinctrl-names = "default"; | 
 | }; | 
 |  | 
 | /* Side with battery connector (with CC1352 and not MSP430) */ | 
 | &uart1 { | 
 | 	status = "okay"; | 
 | 	current-speed = <115200>; | 
 | 	pinctrl-0 = <&uart1_rx_default &uart1_tx_default>; | 
 | 	pinctrl-names = "default"; | 
 | }; | 
 |  | 
 | &i2c0 { | 
 | 	status = "okay"; | 
 | 	clock-frequency = <I2C_BITRATE_FAST>; | 
 | 	pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>; | 
 | 	pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>; | 
 | 	pinctrl-names = "default", "sleep"; | 
 |  | 
 | 	mcu: msp430-usbbridge@4 { | 
 | 		compatible = "beagle,usbbridge"; | 
 | 		reg = <0x4>; | 
 | 	}; | 
 | }; | 
 |  | 
 | &spi0 { | 
 | 	status = "okay"; | 
 | 	pinctrl-0 = <&spi0_sck_default &spi0_mosi_default | 
 | 		     &spi0_miso_default &spi0_cs0_default | 
 | 		     &spi0_cs1_default &spi0_cs2_default>; | 
 | 	pinctrl-names = "default"; | 
 | 	cs-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>, // SPI flash | 
 | 		   <&gpio0 28 GPIO_ACTIVE_LOW>,  // mikroBUS port 1 | 
 | 		   <&gpio0 27 GPIO_ACTIVE_LOW>;  // mikroBUS port 2 | 
 |  | 
 | 	spi_flash0: gd25q16c@0 { | 
 | 		compatible = "jedec,spi-nor"; | 
 | 		reg = <0>; | 
 | 		spi-max-frequency = <2000000>; | 
 | 		// Size (2 MiB) is in bits | 
 | 		size = <0x1000000>; | 
 | 		//has-be32k; | 
 | 		has-dpd; | 
 | 		t-enter-dpd = <20000>; | 
 | 		t-exit-dpd = <100000>; | 
 | 		jedec-id = [c8 40 15]; | 
 |  | 
 | 		partitions { | 
 | 			compatible = "fixed-partitions"; | 
 | 			#address-cells = <1>; | 
 | 			#size-cells = <1>; | 
 |  | 
 | 			/* Allocate 640 KiB for application */ | 
 | 			slot1_partition: partition@0 { | 
 | 				label = "image-1"; | 
 | 				reg = <0x00000000 DT_SIZE_K(640)>; | 
 | 			}; | 
 |  | 
 | 			/* Allocate 128 KiB scratch for image swap */ | 
 | 			scratch_partition: partition@A0000 { | 
 | 				label = "image-scratch"; | 
 | 				reg = <0x000a0000 DT_SIZE_K(128)>; | 
 | 			}; | 
 |  | 
 | 			storage_partition: partition@c0000 { | 
 | 				label = "storage"; | 
 | 				reg = <0x000c0000 DT_SIZE_K(1280)>; | 
 | 			}; | 
 | 		}; | 
 | 	}; | 
 | }; | 
 |  | 
 | &ieee802154g { | 
 | 	status = "okay"; | 
 | }; | 
 |  | 
 | &gpt0 { | 
 | 	status = "okay"; | 
 | }; | 
 |  | 
 | &gpt1 { | 
 | 	status = "okay"; | 
 | }; | 
 |  | 
 | &pwm0 { | 
 | 	status = "okay"; | 
 | 	pinctrl-0 = <&pwm0_default>; | 
 | 	pinctrl-names = "default"; | 
 | }; | 
 |  | 
 | &pwm1 { | 
 | 	status = "okay"; | 
 | 	pinctrl-0 = <&pwm1_default>; | 
 | 	pinctrl-names = "default"; | 
 | }; | 
 |  | 
 | &adc0 { | 
 | 	status = "okay"; | 
 |  | 
 | 	#address-cells = <1>; | 
 | 	#size-cells = <0>; | 
 |  | 
 | 	/* MB1 AN */ | 
 | 	channel@9 { | 
 | 		reg = <9>; | 
 | 		zephyr,gain = "ADC_GAIN_1"; | 
 | 		zephyr,reference = "ADC_REF_INTERNAL"; | 
 | 		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>; | 
 | 		zephyr,resolution = <12>; | 
 | 	}; | 
 |  | 
 | 	/* MB2 AN */ | 
 | 	channel@a { | 
 | 		reg = <10>; | 
 | 		zephyr,gain = "ADC_GAIN_1"; | 
 | 		zephyr,reference = "ADC_REF_INTERNAL"; | 
 | 		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>; | 
 | 		zephyr,resolution = <12>; | 
 | 	}; | 
 |  | 
 | 	/* MB1/2 SCL */ | 
 | 	channel@b { | 
 | 		reg = <11>; | 
 | 		zephyr,gain = "ADC_GAIN_1"; | 
 | 		zephyr,reference = "ADC_REF_INTERNAL"; | 
 | 		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>; | 
 | 		zephyr,resolution = <12>; | 
 | 	}; | 
 |  | 
 | 	/* MB1/2 SDA */ | 
 | 	channel@c { | 
 | 		reg = <12>; | 
 | 		zephyr,gain = "ADC_GAIN_1"; | 
 | 		zephyr,reference = "ADC_REF_INTERNAL"; | 
 | 		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>; | 
 | 		zephyr,resolution = <12>; | 
 | 	}; | 
 |  | 
 | 	/* MB2 CS */ | 
 | 	channel@d { | 
 | 		reg = <13>; | 
 | 		zephyr,gain = "ADC_GAIN_1"; | 
 | 		zephyr,reference = "ADC_REF_INTERNAL"; | 
 | 		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>; | 
 | 		zephyr,resolution = <12>; | 
 | 	}; | 
 |  | 
 | 	/* MB1 CS */ | 
 | 	channel@e { | 
 | 		reg = <14>; | 
 | 		zephyr,gain = "ADC_GAIN_1"; | 
 | 		zephyr,reference = "ADC_REF_INTERNAL"; | 
 | 		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>; | 
 | 		zephyr,resolution = <12>; | 
 | 	}; | 
 | }; | 
 |  | 
 | &wdt0 { | 
 | 	status = "okay"; | 
 | }; |