drivers: spi_sam0: move sercom pad info to dts

Move the setting of the SERCOM PAD for dipo/dopo for the spi driver
into device tree out of board.h

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2018-11-01 05:15:59 -05:00 committed by Kumar Gala
commit ddc2a3d9df
14 changed files with 51 additions and 21 deletions

View file

@ -46,6 +46,8 @@
compatible = "atmel,sam0-spi";
#address-cells = <1>;
#size-cells = <0>;
dipo = <0>;
dopo = <1>;
};
&flash0 {

View file

@ -9,7 +9,4 @@
#include <soc.h>
#define CONFIG_SPI_SAM0_SERCOM4_PADS \
(SERCOM_SPI_CTRLA_DIPO(0) | SERCOM_SPI_CTRLA_DOPO(1))
#endif /* __INC_BOARD_H */

View file

@ -52,6 +52,8 @@
&sercom1 {
status = "ok";
compatible = "atmel,sam0-spi";
dipo = <2>;
dopo = <0>;
#address-cells = <1>;
#size-cells = <0>;

View file

@ -9,10 +9,4 @@
#include <soc.h>
#define CONFIG_SPI_SAM0_SERCOM0_PADS \
(SERCOM_SPI_CTRLA_DIPO(0) | SERCOM_SPI_CTRLA_DOPO(1))
#define CONFIG_SPI_SAM0_SERCOM1_PADS \
(SERCOM_SPI_CTRLA_DIPO(2) | SERCOM_SPI_CTRLA_DOPO(0))
#endif /* __INC_BOARD_H */

View file

@ -61,6 +61,8 @@
&sercom4 {
status = "ok";
compatible = "atmel,sam0-spi";
dipo = <0>;
dopo = <1>;
};
&flash0 {

View file

@ -9,7 +9,4 @@
#include <soc.h>
#define CONFIG_SPI_SAM0_SERCOM4_PADS \
(SERCOM_SPI_CTRLA_DIPO(0) | SERCOM_SPI_CTRLA_DOPO(1))
#endif /* __INC_BOARD_H */

View file

@ -42,6 +42,8 @@
&sercom0 {
status = "ok";
compatible = "atmel,sam0-spi";
dipo = <0>;
dopo = <2>;
};
&sercom3 {

View file

@ -9,7 +9,4 @@
#include <soc.h>
#define CONFIG_SPI_SAM0_SERCOM0_PADS \
(SERCOM_SPI_CTRLA_DIPO(0) | SERCOM_SPI_CTRLA_DOPO(2))
#endif /* __INC_BOARD_H */

View file

@ -58,4 +58,6 @@
&sercom5 {
status = "ok";
compatible = "atmel,sam0-spi";
dipo = <0>;
dopo = <2>;
};

View file

@ -9,8 +9,4 @@
#include <soc.h>
/* SPI SERCOM5 on MISO=PB16/pad 0, MOSI=PB22/pad 2, SCK=PB23/pad 3 */
#define CONFIG_SPI_SAM0_SERCOM5_PADS \
(SERCOM_SPI_CTRLA_DIPO(0) | SERCOM_SPI_CTRLA_DOPO(2))
#endif /* __INC_BOARD_H */

View file

@ -13,7 +13,6 @@ LOG_MODULE_REGISTER(spi_sam0);
#include <device.h>
#include <spi.h>
#include <soc.h>
#include <board.h>
/* Device constant configuration parameters */
struct spi_sam0_config {
@ -452,12 +451,16 @@ static const struct spi_driver_api spi_sam0_driver_api = {
.release = spi_sam0_release,
};
#define CONFIG_SPI_SAM0_SERCOM_PADS(n) \
SERCOM_SPI_CTRLA_DIPO(CONFIG_SPI_SAM0_SERCOM##n##_DIPO) | \
SERCOM_SPI_CTRLA_DOPO(CONFIG_SPI_SAM0_SERCOM##n##_DOPO)
#define SPI_SAM0_DEFINE_CONFIG(n) \
static const struct spi_sam0_config spi_sam0_config_##n = { \
.regs = (SercomSpi *)CONFIG_SPI_SAM0_SERCOM##n##_BASE_ADDRESS, \
.pm_apbcmask = PM_APBCMASK_SERCOM##n, \
.gclk_clkctrl_id = GCLK_CLKCTRL_ID_SERCOM##n##_CORE, \
.pads = CONFIG_SPI_SAM0_SERCOM##n##_PADS \
.pads = CONFIG_SPI_SAM0_SERCOM_PADS(n) \
}
#define SPI_SAM0_DEVICE_INIT(n) \

View file

@ -22,4 +22,16 @@ properties:
description: mmio register space
generation: define
category: required
dipo:
type: int
category: required
description: Data In Pinout
generation: define
dopo:
type: int
category: required
description: Data Out Pinout
generation: define
...

View file

@ -59,21 +59,33 @@
#define CONFIG_SPI_SAM0_SERCOM0_LABEL ATMEL_SAM0_SPI_42000800_LABEL
#define CONFIG_SPI_SAM0_SERCOM0_BASE_ADDRESS ATMEL_SAM0_SPI_42000800_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM0_DIPO ATMEL_SAM0_SPI_42000800_DIPO
#define CONFIG_SPI_SAM0_SERCOM0_DOPO ATMEL_SAM0_SPI_42000800_DOPO
#define CONFIG_SPI_SAM0_SERCOM1_LABEL ATMEL_SAM0_SPI_42000C00_LABEL
#define CONFIG_SPI_SAM0_SERCOM1_BASE_ADDRESS ATMEL_SAM0_SPI_42000C00_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM1_DIPO ATMEL_SAM0_SPI_42000C00_DIPO
#define CONFIG_SPI_SAM0_SERCOM1_DOPO ATMEL_SAM0_SPI_42000C00_DOPO
#define CONFIG_SPI_SAM0_SERCOM2_LABEL ATMEL_SAM0_SPI_42001000_LABEL
#define CONFIG_SPI_SAM0_SERCOM2_BASE_ADDRESS ATMEL_SAM0_SPI_42001000_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM2_DIPO ATMEL_SAM0_SPI_42001000_DIPO
#define CONFIG_SPI_SAM0_SERCOM2_DOPO ATMEL_SAM0_SPI_42001000_DOPO
#define CONFIG_SPI_SAM0_SERCOM3_LABEL ATMEL_SAM0_SPI_42001400_LABEL
#define CONFIG_SPI_SAM0_SERCOM3_BASE_ADDRESS ATMEL_SAM0_SPI_42001400_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM3_DIPO ATMEL_SAM0_SPI_42001400_DIPO
#define CONFIG_SPI_SAM0_SERCOM3_DOPO ATMEL_SAM0_SPI_42001400_DOPO
#define CONFIG_SPI_SAM0_SERCOM4_LABEL ATMEL_SAM0_SPI_42001800_LABEL
#define CONFIG_SPI_SAM0_SERCOM4_BASE_ADDRESS ATMEL_SAM0_SPI_42001800_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM4_DIPO ATMEL_SAM0_SPI_42001800_DIPO
#define CONFIG_SPI_SAM0_SERCOM4_DOPO ATMEL_SAM0_SPI_42001800_DOPO
#define CONFIG_SPI_SAM0_SERCOM5_LABEL ATMEL_SAM0_SPI_42001C00_LABEL
#define CONFIG_SPI_SAM0_SERCOM5_BASE_ADDRESS ATMEL_SAM0_SPI_42001C00_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM5_DIPO ATMEL_SAM0_SPI_42001C00_DIPO
#define CONFIG_SPI_SAM0_SERCOM5_DOPO ATMEL_SAM0_SPI_42001C00_DOPO
#define CONFIG_WDT_SAM0_IRQ ATMEL_SAM0_WATCHDOG_40001000_IRQ_0
#define CONFIG_WDT_SAM0_IRQ_PRIORITY ATMEL_SAM0_WATCHDOG_40001000_IRQ_0_PRIORITY

View file

@ -59,21 +59,33 @@
#define CONFIG_SPI_SAM0_SERCOM0_LABEL ATMEL_SAM0_SPI_42000800_LABEL
#define CONFIG_SPI_SAM0_SERCOM0_BASE_ADDRESS ATMEL_SAM0_SPI_42000800_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM0_DIPO ATMEL_SAM0_SPI_42000800_DIPO
#define CONFIG_SPI_SAM0_SERCOM0_DOPO ATMEL_SAM0_SPI_42000800_DOPO
#define CONFIG_SPI_SAM0_SERCOM1_LABEL ATMEL_SAM0_SPI_42000C00_LABEL
#define CONFIG_SPI_SAM0_SERCOM1_BASE_ADDRESS ATMEL_SAM0_SPI_42000C00_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM1_DIPO ATMEL_SAM0_SPI_42000C00_DIPO
#define CONFIG_SPI_SAM0_SERCOM1_DOPO ATMEL_SAM0_SPI_42000C00_DOPO
#define CONFIG_SPI_SAM0_SERCOM2_LABEL ATMEL_SAM0_SPI_42001000_LABEL
#define CONFIG_SPI_SAM0_SERCOM2_BASE_ADDRESS ATMEL_SAM0_SPI_42001000_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM2_DIPO ATMEL_SAM0_SPI_42001000_DIPO
#define CONFIG_SPI_SAM0_SERCOM2_DOPO ATMEL_SAM0_SPI_42001000_DOPO
#define CONFIG_SPI_SAM0_SERCOM3_LABEL ATMEL_SAM0_SPI_42001400_LABEL
#define CONFIG_SPI_SAM0_SERCOM3_BASE_ADDRESS ATMEL_SAM0_SPI_42001400_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM3_DIPO ATMEL_SAM0_SPI_42001400_DIPO
#define CONFIG_SPI_SAM0_SERCOM3_DOPO ATMEL_SAM0_SPI_42001400_DOPO
#define CONFIG_SPI_SAM0_SERCOM4_LABEL ATMEL_SAM0_SPI_42001800_LABEL
#define CONFIG_SPI_SAM0_SERCOM4_BASE_ADDRESS ATMEL_SAM0_SPI_42001800_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM4_DIPO ATMEL_SAM0_SPI_42001800_DIPO
#define CONFIG_SPI_SAM0_SERCOM4_DOPO ATMEL_SAM0_SPI_42001800_DOPO
#define CONFIG_SPI_SAM0_SERCOM5_LABEL ATMEL_SAM0_SPI_42001C00_LABEL
#define CONFIG_SPI_SAM0_SERCOM5_BASE_ADDRESS ATMEL_SAM0_SPI_42001C00_BASE_ADDRESS
#define CONFIG_SPI_SAM0_SERCOM5_DIPO ATMEL_SAM0_SPI_42001C00_DIPO
#define CONFIG_SPI_SAM0_SERCOM5_DOPO ATMEL_SAM0_SPI_42001C00_DOPO
#define CONFIG_WDT_SAM0_IRQ ATMEL_SAM0_WATCHDOG_40001000_IRQ_0
#define CONFIG_WDT_SAM0_IRQ_PRIORITY ATMEL_SAM0_WATCHDOG_40001000_IRQ_0_PRIORITY