Skip to content

Commit f28f412

Browse files
AlessandroLuokartben
authored andcommitted
drivers: pinctrl: Add sdif configs to ambiq pinctrl driver
Added sdio cd and wp pin configs to ambiq pinctrl driver Signed-off-by: Hao Luo <[email protected]>
1 parent 4cfb1d3 commit f28f412

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

drivers/pinctrl/pinctrl_ambiq.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ static void pinctrl_configure_pin(const pinctrl_soc_pin_t *pin)
4545
pin_config.GP.cfg_b.eDriveStrength = pin->drive_strength;
4646
#if defined(CONFIG_SOC_SERIES_APOLLO4X)
4747
pin_config.GP.cfg_b.uSlewRate = pin->slew_rate;
48+
switch (pin->sdif_cdwp) {
49+
case 1:
50+
am_hal_gpio_cd_pin_config(pin->pin_num);
51+
break;
52+
case 2:
53+
am_hal_gpio_wp_pin_config(pin->pin_num);
54+
break;
55+
default:
56+
/* not a sdif pin */
57+
break;
58+
}
4859
#else
4960
switch (pin->sdif_cdwp) {
5061
case 1:

dts/bindings/pinctrl/ambiq,apollo4-pinctrl.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,11 @@ child-binding:
161161
Polarity select for NCE
162162
LOW = 0x0 - Polarity is active low
163163
HIGH = 0x1 - Polarity is active high
164+
ambiq,sdif-cdwp:
165+
type: int
166+
default: 0
167+
description: |
168+
Configure SD Card Detection and Write Protection pin
169+
0x0 - Not SDIF pin
170+
0x1 - SDIFCD
171+
0x2 - SDIFWP

soc/ambiq/apollo4x/pinctrl_soc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ struct apollo4_pinctrl_soc_pin {
3939
uint32_t nce : 6;
4040
/** nCE module polarity */
4141
uint32_t nce_pol: 1;
42+
/** SDIF CD WP pad select */
43+
uint32_t sdif_cdwp: 2;
4244
};
4345

4446
typedef struct apollo4_pinctrl_soc_pin pinctrl_soc_pin_t;
@@ -65,6 +67,7 @@ typedef struct apollo4_pinctrl_soc_pin pinctrl_soc_pin_t;
6567
DT_ENUM_IDX(node_id, ambiq_pull_up_ohms), \
6668
DT_PROP(node_id, ambiq_nce_src), \
6769
DT_PROP(node_id, ambiq_nce_pol), \
70+
DT_PROP(node_id, ambiq_sdif_cdwp), \
6871
},
6972

7073
/**

0 commit comments

Comments
 (0)