Skip to content

[WIP] net: change enc28j60 to new SPI API #651

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

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0a0f8b6
boards: sensortag: Add documentation.
Jun 26, 2017
e3dce5c
pinmux: stm32 F1X/F3X/F4X: add I2C
ydamigos Jun 23, 2017
be9908f
pinmux: boards: add I2C to carbon/lf33fr8/f401re/olimexino
ydamigos Jun 23, 2017
476adea
interrupt_controller: add STM32F303XC EXTI lines number
ydamigos Jun 21, 2017
9829ac4
boards: arm: Add STM32F3DISCOVERY board
ydamigos Jun 21, 2017
29f463a
boards: arm: Add support for the VBLUno51 board
iotmember Jun 29, 2017
01921d1
arch: stm32f1: Fix typo in soc_config
ydamigos Jun 29, 2017
f2d190f
ext: hal: stm32f1x and stm32f4x: disable i2c HAL
ldts Jun 23, 2017
d84ff83
soc: stm32: F1/F3/F4/L4: enable I2C LL
ydamigos Jun 23, 2017
3808a52
drivers: i2c: stm32 LL F1/F4 (v1) STM32 F3/L4X (v2)
ldts Jun 23, 2017
020d4ec
boards: arm: carbon/l475/f401re/olimexino: enable I2C
ldts Jun 23, 2017
c9cd4c0
stm32cube: Fix warning when SPI LL API is compiled
erwango May 23, 2017
ec53031
stm32cube: build stm32xxx_ll_spi if CONFIG_SPI
ldts May 24, 2017
5dc859b
pinmux: stm32f4: Add SPI1 pins on PA4, PA5, PA6 & PA7
ldts May 24, 2017
f85f40b
pinmux: stm32f4: Add SPI2 pins on PB12, PB13, PB14 & PB15
ldts May 24, 2017
d12327b
spi/api: extend with vendor specific configs
ldts Jun 20, 2017
62b65ae
spi: add SPI driver for STM32 family
superna9999 Sep 16, 2016
3c12754
pinmux: stm32: nucleo_f401re: Add support for SPI
ldts May 24, 2017
016ae21
pinmux: stm32: nucleo_f334r8: add support for SPI
erwango May 23, 2017
92cb600
boards: nucleo_l476rg: Document default SPI pinmux
superna9999 Apr 28, 2017
45977e4
pinmux: stm32: nucleo_l476rg: Fix SPI Pinmux
superna9999 Apr 28, 2017
8bdb328
pinmux: stm32: nucleo_l432kc: Add SPI pins
superna9999 May 24, 2017
137bce3
samples/spi: Make async test optional
superna9999 Jun 22, 2017
8051c10
samples/spi: Permit specifying low test frequency
superna9999 Jun 22, 2017
4c01e1a
samples/spi: Enable test on STM32 SoCs
superna9999 Jun 22, 2017
fc994f3
net: change enc28j60 to new SPI API
locomuco Jun 30, 2017
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
1 change: 1 addition & 0 deletions arch/arm/soc/st_stm32/stm32f1/Kconfig.series
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ config SOC_SERIES_STM32F1X
select HAS_STM32CUBE
select CPU_HAS_SYSTICK
select CLOCK_CONTROL_STM32_CUBE if CLOCK_CONTROL
select I2C_STM32_V1 if I2C
help
Enable support for STM32F1 MCU series
4 changes: 4 additions & 0 deletions arch/arm/soc/st_stm32/stm32f1/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ enum stm32f10x_pin_config_mode {
#include <stm32f1xx_ll_system.h>
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */

#ifdef CONFIG_I2C
#include <stm32f1xx_ll_i2c.h>
#endif

#endif /* !_ASMLANGUAGE */

#endif /* _STM32F1_SOC_H_ */
124 changes: 105 additions & 19 deletions arch/arm/soc/st_stm32/stm32f1/soc_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,121 @@
#include <pinmux/stm32/pinmux_stm32.h>
#include <drivers/clock_control/stm32_clock_control.h>

#define PAD(AF, func) \
[AF - 1] = func

#define _PINMUX_PWM(pin, port, chan) \
PAD(STM32F1_PINMUX_FUNC_##pin##_PWM##port##_CH##chan,\
STM32F10X_PIN_CONFIG_AF_PUSH_PULL),

#define _PINMUX_UART_TX(pin, port) \
PAD(STM32F1_PINMUX_FUNC_##pin##_##port##_TX, \
STM32F10X_PIN_CONFIG_AF_PUSH_PULL),

#define _PINMUX_UART_RX(pin, port) \
PAD(STM32F1_PINMUX_FUNC_##pin##_##port##_RX, \
STM32F10X_PIN_CONFIG_BIAS_HIGH_IMPEDANCE),

#define _PINMUX_I2C(pin, port, line) \
PAD(STM32F1_PINMUX_FUNC_##pin##_I2C##port##_##line, \
STM32F10X_PIN_CONFIG_AF_OPEN_DRAIN),

/* Blank pinmux by default */
#define PINMUX_I2C1(pin, line)
#define PINMUX_I2C2(pin, line)
#define PINMUX_PWM1(pin, chan)
#define PINMUX_UART1_TX(pin)
#define PINMUX_UART1_RX(pin)
#define PINMUX_UART2_TX(pin)
#define PINMUX_UART2_RX(pin)
#define PINMUX_UART3_TX(pin)
#define PINMUX_UART3_RX(pin)

#ifdef CONFIG_I2C_1
#undef PINMUX_I2C1
#define PINMUX_I2C1(pin, line) _PINMUX_I2C(pin, 1, line)
#endif

#ifdef CONFIG_I2C_2
#undef PINMUX_I2C2
#define PINMUX_I2C2(pin, line) _PINMUX_I2C(pin, 2, line)
#endif

#ifdef CONFIG_PWM_STM32_1
#undef PINMUX_PWM1
#define PINMUX_PWM1(pin, chan) _PINMUX_PWM(pin, 1, chan)
#endif

#ifdef CONFIG_UART_STM32_PORT_1
#undef PINMUX_UART1_TX
#undef PINMUX_UART1_RX
#define PINMUX_UART1_TX(pin) _PINMUX_UART_TX(pin, USART1)
#define PINMUX_UART1_RX(pin) _PINMUX_UART_RX(pin, USART1)
#endif

#ifdef CONFIG_UART_STM32_PORT_2
#undef PINMUX_UART2_TX
#undef PINMUX_UART2_RX
#define PINMUX_UART2_TX(pin) _PINMUX_UART_TX(pin, USART2)
#define PINMUX_UART2_RX(pin) _PINMUX_UART_RX(pin, USART2)
#endif

#ifdef CONFIG_UART_STM32_PORT_3
#undef PINMUX_UART3_TX
#undef PINMUX_UART3_RX
#define PINMUX_UART3_TX(pin) _PINMUX_UART_TX(pin, USART3)
#define PINMUX_UART3_RX(pin) _PINMUX_UART_RX(pin, USART3)
#endif

#define PINMUX_PWM(pin, pwm, chan) PINMUX_##pwm(pin, chan)
#define PINMUX_UART_TX(pin, port) PINMUX_##port##_TX(pin)
#define PINMUX_UART_RX(pin, port) PINMUX_##port##_RX(pin)
#define PINMUX_I2C(pin, i2c, line) PINMUX_##i2c(pin, line)

static const stm32_pin_func_t pin_pa2_funcs[] = {
PINMUX_UART_TX(PA2, UART2)
};

static const stm32_pin_func_t pin_pa3_funcs[] = {
PINMUX_UART_RX(PA3, UART2)
};

static const stm32_pin_func_t pin_pa8_funcs[] = {
PINMUX_PWM(PA8, PWM1, 1)
};

static const stm32_pin_func_t pin_pa9_funcs[] = {
[STM32F1_PINMUX_FUNC_PA9_USART1_TX - 1] =
STM32F10X_PIN_CONFIG_AF_PUSH_PULL,
PINMUX_UART_TX(PA9, UART1)
};

static const stm32_pin_func_t pin_pa10_funcs[] = {
[STM32F1_PINMUX_FUNC_PA10_USART1_RX - 1] =
STM32F10X_PIN_CONFIG_BIAS_HIGH_IMPEDANCE,
PINMUX_UART_RX(PA10, UART1)
};

static const stm32_pin_func_t pin_pa2_funcs[] = {
[STM32F1_PINMUX_FUNC_PA2_USART2_TX - 1] =
STM32F10X_PIN_CONFIG_AF_PUSH_PULL,
static const stm32_pin_func_t pin_pb6_funcs[] = {
PINMUX_I2C(PB6, I2C1, SCL)
};

static const stm32_pin_func_t pin_pa3_funcs[] = {
[STM32F1_PINMUX_FUNC_PA3_USART2_RX - 1] =
STM32F10X_PIN_CONFIG_BIAS_HIGH_IMPEDANCE,
static const stm32_pin_func_t pin_pb7_funcs[] = {
PINMUX_I2C(PB7, I2C1, SDA)
};

static const stm32_pin_func_t pin_pb10_funcs[] = {
[STM32F1_PINMUX_FUNC_PB10_USART3_TX - 1] =
STM32F10X_PIN_CONFIG_AF_PUSH_PULL,
static const stm32_pin_func_t pin_pb8_funcs[] = {
PINMUX_I2C(PB8, I2C1, SCL)
};

static const stm32_pin_func_t pin_pb11_funcs[] = {
[STM32F1_PINMUX_FUNC_PB11_USART3_RX - 1] =
STM32F10X_PIN_CONFIG_BIAS_HIGH_IMPEDANCE,
static const stm32_pin_func_t pin_pb9_funcs[] = {
PINMUX_I2C(PB9, I2C1, SDA)
};

static const stm32_pin_func_t pin_pa8_funcs[] = {
[STM32F1_PINMUX_FUNC_PA8_PWM1_CH1 - 1] =
STM32F10X_PIN_CONFIG_AF_PUSH_PULL,
static const stm32_pin_func_t pin_pb10_funcs[] = {
PINMUX_UART_TX(PB10, UART3)
PINMUX_I2C(PB10, I2C2, SCL)
};

static const stm32_pin_func_t pin_pb11_funcs[] = {
PINMUX_UART_RX(PB11, UART3)
PINMUX_I2C(PB11, I2C2, SDA)
};

/**
Expand All @@ -56,6 +138,10 @@ static struct stm32_pinmux_conf pins[] = {
STM32_PIN_CONF(STM32_PIN_PA8, pin_pa8_funcs),
STM32_PIN_CONF(STM32_PIN_PA9, pin_pa9_funcs),
STM32_PIN_CONF(STM32_PIN_PA10, pin_pa10_funcs),
STM32_PIN_CONF(STM32_PIN_PB6, pin_pb6_funcs),
STM32_PIN_CONF(STM32_PIN_PB7, pin_pb7_funcs),
STM32_PIN_CONF(STM32_PIN_PB8, pin_pb8_funcs),
STM32_PIN_CONF(STM32_PIN_PB9, pin_pb9_funcs),
STM32_PIN_CONF(STM32_PIN_PB10, pin_pb10_funcs),
STM32_PIN_CONF(STM32_PIN_PB11, pin_pb11_funcs),
};
Expand Down
1 change: 1 addition & 0 deletions arch/arm/soc/st_stm32/stm32f3/Kconfig.series
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ config SOC_SERIES_STM32F3X
select CPU_HAS_SYSTICK
select HAS_STM32CUBE
select CLOCK_CONTROL_STM32_CUBE if CLOCK_CONTROL
select I2C_STM32_V2 if I2C
help
Enable support for STM32F3 MCU series
5 changes: 5 additions & 0 deletions arch/arm/soc/st_stm32/stm32f3/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ enum stm32f3x_pin_config_mode {
#include <stm32f3xx_ll_bus.h>
#include <stm32f3xx_ll_rcc.h>
#include <stm32f3xx_ll_system.h>
#include <stm32f3xx_ll_spi.h>
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */

#ifdef CONFIG_I2C
#include <stm32f3xx_ll_i2c.h>
#endif

#endif /* !_ASMLANGUAGE */

#endif /* _STM32F3_SOC_H_ */
1 change: 1 addition & 0 deletions arch/arm/soc/st_stm32/stm32f4/Kconfig.series
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ config SOC_SERIES_STM32F4X
select CPU_HAS_MPU
select CPU_HAS_SYSTICK
select CLOCK_CONTROL_STM32_CUBE if CLOCK_CONTROL
select I2C_STM32_V1 if I2C
help
Enable support for STM32F4 MCU series
5 changes: 5 additions & 0 deletions arch/arm/soc/st_stm32/stm32f4/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ enum stm32f4x_pin_config_mode {
#include <stm32f4xx_ll_bus.h>
#include <stm32f4xx_ll_rcc.h>
#include <stm32f4xx_ll_system.h>
#include <stm32f4xx_ll_spi.h>
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */

#ifdef CONFIG_I2C
#include <stm32f4xx_ll_i2c.h>
#endif

#endif /* !_ASMLANGUAGE */

#endif /* _STM32F4_SOC_H_ */
Loading