boards: particle_*: update for new GPIO API

Provide correct active level and pull on all signals.  Use
init-to-active when configuring antenna switch.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2019-12-06 08:35:49 -06:00 committed by Carles Cufí
commit 4230fde3eb
15 changed files with 62 additions and 69 deletions

View file

@ -24,17 +24,15 @@ static inline void external_antenna(bool on)
}
gpio_pin_configure(ufl_gpio_dev, SKY_UFLn_GPIO_PIN,
GPIO_DIR_OUT | SKY_UFLn_GPIO_FLAGS);
SKY_UFLn_GPIO_FLAGS
| (on
? GPIO_OUTPUT_ACTIVE
: GPIO_OUTPUT_INACTIVE));
gpio_pin_configure(pcb_gpio_dev, SKY_PCBn_GPIO_PIN,
GPIO_DIR_OUT | SKY_PCBn_GPIO_FLAGS);
if (on) {
gpio_pin_write(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 0);
gpio_pin_write(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 1);
} else {
gpio_pin_write(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 1);
gpio_pin_write(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 0);
}
SKY_PCBn_GPIO_FLAGS
| (on
? GPIO_OUTPUT_INACTIVE
: GPIO_OUTPUT_ACTIVE));
}
static int board_particle_argon_init(struct device *dev)

View file

@ -32,19 +32,19 @@
leds {
compatible = "gpio-leds";
user_led: led_0 {
gpios = <&gpio1 12 0>;
gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
label = "User LED";
};
status_red: led_1 {
gpios = <&gpio0 13 0>;
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
status_green: led_2 {
gpios = <&gpio0 14 0>;
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
label = "Green LED";
};
status_blue: led_3 {
gpios = <&gpio0 15 0>;
gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
label = "Blue LED";
};
};
@ -52,12 +52,12 @@
gpio_keys {
compatible = "gpio-keys";
mode_button: button_0 {
gpios = <&gpio0 11 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Mode Button";
};
reset_button: button_1 {
gpios = <&gpio0 18 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Reset Button";
};
};
@ -140,8 +140,8 @@
label = "MX25L3233F";
reg = <0>;
spi-max-frequency = <80000000>;
wp-gpios = <&gpio0 22 0>;
hold-gpios = <&gpio0 23 0>;
wp-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
hold-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
size = <0x2000000>;
has-be32k;
has-dpd;

View file

@ -14,6 +14,6 @@
sck-pin = <47>;
mosi-pin = <45>;
miso-pin = <46>;
cs-gpios = <&gpio0 31 0>;
cs-gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
};

View file

@ -14,6 +14,6 @@
sck-pin = <47>;
mosi-pin = <45>;
miso-pin = <46>;
cs-gpios = <&gpio0 31 0>;
cs-gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
};

View file

@ -16,8 +16,8 @@
sky13351 {
compatible = "skyworks,sky13351";
vctl1-gpios = <&gpio0 25 0>;
vctl2-gpios = <&gpio0 2 0>;
vctl1-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
vctl2-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
};
vbatt {

View file

@ -11,26 +11,23 @@
static inline void external_antenna(bool on)
{
struct device *ant_ufl_gpio_dev;
struct device *gpio_dev;
/*
* On power-up the SKY13351 is left uncontrolled, so neither
* PCB nor external antenna is selected. Select the PCB
* antenna.
*/
ant_ufl_gpio_dev = device_get_binding(ANT_UFL_GPIO_NAME);
if (!ant_ufl_gpio_dev) {
gpio_dev = device_get_binding(ANT_UFLn_GPIO_NAME);
if (!gpio_dev) {
return;
}
gpio_pin_configure(ant_ufl_gpio_dev, ANT_UFL_GPIO_PIN,
GPIO_DIR_OUT | ANT_UFL_GPIO_FLAGS);
if (on) {
gpio_pin_write(ant_ufl_gpio_dev, ANT_UFL_GPIO_PIN, 0);
} else {
gpio_pin_write(ant_ufl_gpio_dev, ANT_UFL_GPIO_PIN, 1);
}
gpio_pin_configure(gpio_dev, ANT_UFLn_GPIO_PIN,
ANT_UFLn_GPIO_FLAGS
| (on
? GPIO_OUTPUT_ACTIVE
: GPIO_OUTPUT_INACTIVE));
}
static int board_particle_boron_init(struct device *dev)

View file

@ -15,8 +15,8 @@
#define V_INT_DETECT_GPIO_PIN 2
/* SKYWORKS SKY13351 antenna selection settings (only use vctl1) */
#define ANT_UFL_GPIO_NAME DT_INST_0_SKYWORKS_SKY13351_VCTL1_GPIOS_CONTROLLER
#define ANT_UFL_GPIO_FLAGS DT_INST_0_SKYWORKS_SKY13351_VCTL1_GPIOS_FLAGS
#define ANT_UFL_GPIO_PIN DT_INST_0_SKYWORKS_SKY13351_VCTL1_GPIOS_PIN
#define ANT_UFLn_GPIO_NAME DT_INST_0_SKYWORKS_SKY13351_VCTL1_GPIOS_CONTROLLER
#define ANT_UFLn_GPIO_FLAGS DT_INST_0_SKYWORKS_SKY13351_VCTL1_GPIOS_FLAGS
#define ANT_UFLn_GPIO_PIN DT_INST_0_SKYWORKS_SKY13351_VCTL1_GPIOS_PIN
#endif /* __INC_BOARD_H */

View file

@ -32,19 +32,19 @@
leds {
compatible = "gpio-leds";
user_led: led_0 {
gpios = <&gpio1 12 0>;
gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
label = "User LED";
};
status_red: led_1 {
gpios = <&gpio0 13 0>;
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
status_green: led_2 {
gpios = <&gpio0 14 0>;
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
label = "Green LED";
};
status_blue: led_3 {
gpios = <&gpio0 15 0>;
gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
label = "Blue LED";
};
};
@ -52,12 +52,12 @@
gpio_keys {
compatible = "gpio-keys";
mode_button: button_0 {
gpios = <&gpio0 11 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Mode Button";
};
reset_button: button_1 {
gpios = <&gpio0 18 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Reset Button";
};
};
@ -140,8 +140,8 @@
label = "MX25L3233F";
reg = <0>;
spi-max-frequency = <80000000>;
wp-gpios = <&gpio0 22 0>;
hold-gpios = <&gpio0 23 0>;
wp-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
hold-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
size = <0x2000000>;
has-be32k;
has-dpd;

View file

@ -14,6 +14,6 @@
sck-pin = <47>;
mosi-pin = <45>;
miso-pin = <46>;
cs-gpios = <&gpio0 31 0>;
cs-gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
};

View file

@ -16,11 +16,11 @@
sky13351 {
compatible = "skyworks,sky13351";
vctl1-gpios = <&gpio0 7 0>;
vctl1-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
/* on Boron VCTL2 is inverted VCTL1 signal via SN74LVC1G04
* single inverter gate -- requires a definition below,
* but is not used in board.c */
vctl2-gpios = <&gpio0 7 0>;
vctl2-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
};
};

View file

@ -24,17 +24,15 @@ static inline void external_antenna(bool on)
}
gpio_pin_configure(ufl_gpio_dev, SKY_UFLn_GPIO_PIN,
GPIO_DIR_OUT | SKY_UFLn_GPIO_FLAGS);
SKY_UFLn_GPIO_FLAGS
| (on
? GPIO_OUTPUT_ACTIVE
: GPIO_OUTPUT_INACTIVE));
gpio_pin_configure(pcb_gpio_dev, SKY_PCBn_GPIO_PIN,
GPIO_DIR_OUT | SKY_PCBn_GPIO_FLAGS);
if (on) {
gpio_pin_write(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 0);
gpio_pin_write(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 1);
} else {
gpio_pin_write(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 1);
gpio_pin_write(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 0);
}
SKY_PCBn_GPIO_FLAGS
| (on
? GPIO_OUTPUT_INACTIVE
: GPIO_OUTPUT_ACTIVE));
}
static int board_particle_xenon_init(struct device *dev)

View file

@ -32,19 +32,19 @@
leds {
compatible = "gpio-leds";
user_led: led_0 {
gpios = <&gpio1 12 0>;
gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
label = "User LED";
};
status_red: led_1 {
gpios = <&gpio0 13 0>;
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
status_green: led_2 {
gpios = <&gpio0 14 0>;
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
label = "Green LED";
};
status_blue: led_3 {
gpios = <&gpio0 15 0>;
gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
label = "Blue LED";
};
};
@ -52,12 +52,12 @@
gpio_keys {
compatible = "gpio-keys";
mode_button: button_0 {
gpios = <&gpio0 11 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Mode Button";
};
reset_button: button_1 {
gpios = <&gpio0 18 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Reset Button";
};
};
@ -140,8 +140,8 @@
label = "MX25L3233F";
reg = <0>;
spi-max-frequency = <80000000>;
wp-gpios = <&gpio0 22 0>;
hold-gpios = <&gpio0 23 0>;
wp-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
hold-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
size = <0x2000000>;
has-be32k;
has-dpd;

View file

@ -14,6 +14,6 @@
sck-pin = <47>;
mosi-pin = <45>;
miso-pin = <46>;
cs-gpios = <&gpio0 31 0>;
cs-gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
};

View file

@ -14,6 +14,6 @@
sck-pin = <47>;
mosi-pin = <45>;
miso-pin = <46>;
cs-gpios = <&gpio0 31 0>;
cs-gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
};

View file

@ -16,8 +16,8 @@
sky13351 {
compatible = "skyworks,sky13351";
vctl1-gpios = <&gpio0 24 0>;
vctl2-gpios = <&gpio0 25 0>;
vctl1-gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
vctl2-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
};
vbatt {