Skip to content

Commit f1b68be

Browse files
nandojvembolivar-nordic
authored andcommitted
drivers: ssc: sam: Update to use clock control
This update Atmel SAM ssc driver to use clock control driver. Signed-off-by: Gerson Fernando Budke <[email protected]>
1 parent 9f02551 commit f1b68be

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

drivers/i2s/i2s_sam_ssc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <zephyr/drivers/dma.h>
2929
#include <zephyr/drivers/i2s.h>
3030
#include <zephyr/drivers/pinctrl.h>
31+
#include <zephyr/drivers/clock_control/atmel_sam_pmc.h>
3132
#include <soc.h>
3233

3334
#define LOG_DOMAIN dev_i2s_sam_ssc
@@ -69,8 +70,8 @@ struct i2s_sam_dev_cfg {
6970
const struct device *dev_dma;
7071
Ssc *regs;
7172
void (*irq_config)(void);
73+
const struct atmel_sam_pmc_config clock_cfg;
7274
const struct pinctrl_dev_config *pcfg;
73-
uint8_t periph_id;
7475
uint8_t irq_id;
7576
};
7677

@@ -974,8 +975,9 @@ static int i2s_sam_initialize(const struct device *dev)
974975
return ret;
975976
}
976977

977-
/* Enable module's clock */
978-
soc_pmc_peripheral_enable(dev_cfg->periph_id);
978+
/* Enable SSC clock in PMC */
979+
(void)clock_control_on(SAM_DT_PMC_CONTROLLER,
980+
(clock_control_subsys_t *)&dev_cfg->clock_cfg);
979981

980982
/* Reset the module, disable receiver & transmitter */
981983
ssc->SSC_CR = SSC_CR_RXDIS | SSC_CR_TXDIS | SSC_CR_SWRST;
@@ -1015,7 +1017,7 @@ static const struct i2s_sam_dev_cfg i2s0_sam_config = {
10151017
.dev_dma = DEVICE_DT_GET(DT_INST_DMAS_CTLR_BY_NAME(0, tx)),
10161018
.regs = (Ssc *)DT_INST_REG_ADDR(0),
10171019
.irq_config = i2s0_sam_irq_config,
1018-
.periph_id = DT_INST_PROP(0, peripheral_id),
1020+
.clock_cfg = SAM_DT_INST_CLOCK_PMC_CFG(0),
10191021
.irq_id = DT_INST_IRQN(0),
10201022
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
10211023
};

dts/arm/atmel/same70.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@
403403
compatible = "atmel,sam-ssc";
404404
reg = <0x40004000 0x4000>;
405405
interrupts = <22 0>;
406-
peripheral-id = <22>;
406+
clocks = <&pmc PMC_TYPE_PERIPHERAL 22>;
407407
status = "disabled";
408408
};
409409

dts/bindings/arm/atmel,sam-ssc.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ properties:
1616
interrupts:
1717
required: true
1818

19-
peripheral-id:
20-
type: int
21-
description: peripheral ID
19+
clocks:
2220
required: true
2321

2422
dmas:

0 commit comments

Comments
 (0)