zephyr/soc/arm/renesas_smartbond/da1469x/pinctrl_soc.h
Ben Lauret 9cdc5d38b2 drivers: spi: Add driver for smartbond
This adds the SPI driver for the Renesas SmartBond(tm) DA1469x MCU family.
The driver only supports controller mode. All four SPI modes are supported.
Note that the lowest supported speed is 2285714Hz.
Requesting speeds higher than 16MHz, will result in a 16MHz SCLK.

Co-authored-by: Stan Geitel <stan@geitel.nl>

Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2023-04-20 10:32:40 +02:00

47 lines
1.5 KiB
C

/*
* Copyright (c) 2022 Renesas Electronics Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_SOC_ARM_RENESAS_SMARTBOND_DA1469X_PINCTRL_SOC_H_
#define ZEPHYR_SOC_ARM_RENESAS_SMARTBOND_DA1469X_PINCTRL_SOC_H_
#include <zephyr/dt-bindings/pinctrl/smartbond-pinctrl.h>
struct smartbond_pinctrl_soc_pin {
uint32_t func : 6;
uint32_t port : 1;
uint32_t pin : 5;
uint32_t bias_pull_up : 1;
uint32_t bias_pull_down : 1;
uint32_t output_enable : 1;
uint32_t input_enable : 1;
};
typedef struct smartbond_pinctrl_soc_pin pinctrl_soc_pin_t;
#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \
{ \
SMARTBOND_GET_FUNC(DT_PROP_BY_IDX(node_id, prop, idx)), \
SMARTBOND_GET_PORT(DT_PROP_BY_IDX(node_id, prop, idx)), \
SMARTBOND_GET_PIN(DT_PROP_BY_IDX(node_id, prop, idx)), \
DT_PROP(node_id, bias_pull_up), \
DT_PROP(node_id, bias_pull_down), \
DT_PROP(node_id, output_enable), \
DT_PROP(node_id, input_enable), \
},
#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \
{DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \
DT_FOREACH_PROP_ELEM, pinmux, \
Z_PINCTRL_STATE_PIN_INIT)}
#define SMARTBOND_GET_FUNC(pinmux) \
(((pinmux) >> SMARTBOND_PINMUX_FUNC_POS) & SMARTBOND_PINMUX_FUNC_MASK)
#define SMARTBOND_GET_PORT(pinmux) \
(((pinmux) >> SMARTBOND_PINMUX_PORT_POS) & SMARTBOND_PINMUX_PORT_MASK)
#define SMARTBOND_GET_PIN(pinmux) \
(((pinmux) >> SMARTBOND_PINMUX_PIN_POS) & SMARTBOND_PINMUX_PIN_MASK)
#endif /* ZEPHYR_SOC_ARM_RENESAS_SMARTBOND_DA1469X_PINCTRL_SOC_H_ */