Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions boards/microchip/sam/sama7g54_ek/sama7g54_ek.dts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,28 @@
};
};

&flx11 {
mchp,flexcom-mode = <SAM_FLEXCOM_MODE_SPI>;
status = "okay";

spi11: spi@400 {
pinctrl-0 = <&pinctrl_spi11_default>;
pinctrl-names = "default";
cs-gpios = <&piob 6 GPIO_ACTIVE_LOW>;
status = "okay";

nor_flash: sst26vf064@0 {
compatible ="jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;
size = <DT_SIZE_M(64)>; /* 64 Mbits */
jedec-id = [bf 26 43];
requires-ulbpr;
status = "okay";
};
};
};

&pinctrl {
pinctrl_flx3_default: flx3_default {
group1 {
Expand Down Expand Up @@ -179,6 +201,15 @@
};
};

pinctrl_spi11_default: spi11_default {
group1 {
pinmux = <PIN_PB3__FLEXCOM11_IO0>,
<PIN_PB4__FLEXCOM11_IO1>,
<PIN_PB5__FLEXCOM11_IO2>,
<PIN_PB6__GPIO>; /* GPIO CS */
bias-pull-up;
};
};
};

&pit64b0 {
Expand Down
1 change: 1 addition & 0 deletions boards/microchip/sam/sama7g54_ek/sama7g54_ek.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ ram: 128
supported:
- sdhc
- shell
- spi
- uart
vendor: microchip
16 changes: 15 additions & 1 deletion drivers/spi/spi_sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ static int spi_sam_configure(const struct device *dev,
uint16_t spi_csr_idx = spi_cs_is_gpio(config) ? 0 : config->slave;
int div;

#ifdef SOC_ATMEL_SAM_MCK_FREQ_HZ
uint32_t rate = SOC_ATMEL_SAM_MCK_FREQ_HZ;
#else
uint32_t rate;
int ret;

ret = clock_control_get_rate(SAM_DT_PMC_CONTROLLER,
(clock_control_subsys_t)&cfg->clock_cfg,
&rate);
if (ret) {
return ret;
}
#endif

if (spi_context_configured(&data->ctx, config)) {
return 0;
}
Expand Down Expand Up @@ -146,7 +160,7 @@ static int spi_sam_configure(const struct device *dev,
}

/* Use the requested or next highest possible frequency */
div = SOC_ATMEL_SAM_MCK_FREQ_HZ / config->frequency;
div = rate / config->frequency;
div = CLAMP(div, 1, UINT8_MAX);
spi_csr |= SPI_CSR_SCBR(div);

Expand Down
11 changes: 11 additions & 0 deletions dts/arm/microchip/sam/sama7g5.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,17 @@
status = "disabled";
};

spi11: spi@400 {
compatible = "atmel,sam-spi";
reg = <0x400 0x200>;
clocks = <&pmc PMC_TYPE_PERIPHERAL 49>;
interrupt-parent = <&gic>;
interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};

usart11: serial@200 {
compatible = "atmel,sam-usart";
reg = <0x200 0x200>;
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ manifest:
groups:
- hal
- name: hal_microchip
revision: e5fe6469afc53d7aefcc74377dd99ce20428d42b
revision: pull/41/head
path: modules/hal/microchip
groups:
- hal
Expand Down
Loading