summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/ssp-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-05-10 00:08:03 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2012-05-10 00:13:11 +0200
commit645680d62b82455d24fcb178f1cc5208f9942e38 (patch)
tree1a9f928afc34260059bf986fc2caa7fc5b2a2028 /firmware/target/arm/imx233/ssp-imx233.c
parentd29a11b7a8f4ce230e9385a44f352a559bde753f (diff)
imx233: add pinctrl debug code to track pin uses
Past development has proved that one can mistakely use the same pin for two uses without noticing. Since this causes extremely hard to find bugs, the infrastructure will allow to register pin uses and panic when a conflict is detected. The pinctrl debug now shows the pin uses when its support is compiled in. Change-Id: Idb2d5235ce09207d77aa474d6f158e72b933761a
Diffstat (limited to 'firmware/target/arm/imx233/ssp-imx233.c')
-rw-r--r--firmware/target/arm/imx233/ssp-imx233.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/firmware/target/arm/imx233/ssp-imx233.c b/firmware/target/arm/imx233/ssp-imx233.c
index eb7a3a2ad4..cbf537dd07 100644
--- a/firmware/target/arm/imx233/ssp-imx233.c
+++ b/firmware/target/arm/imx233/ssp-imx233.c
@@ -150,12 +150,15 @@ void imx233_ssp_setup_ssp1_sd_mmc_pins(bool enable_pullups, unsigned bus_width,
/* SSP_{CMD,SCK} */
imx233_set_pin_drive_strength(2, 0, drive_strength);
imx233_set_pin_drive_strength(2, 6, drive_strength);
+ imx233_pinctrl_acquire_pin(2, 0, "ssp1 cmd");
+ imx233_pinctrl_acquire_pin(2, 6, "ssp1 sck");
imx233_set_pin_function(2, 0, PINCTRL_FUNCTION_MAIN);
imx233_set_pin_function(2, 6, PINCTRL_FUNCTION_MAIN);
imx233_enable_pin_pullup(2, 0, enable_pullups);
/* SSP_DATA{0-3} */
for(unsigned i = 0; i < MIN(bus_width, 4); i++)
{
+ imx233_pinctrl_acquire_pin(2, 2 + i, "ssp1 data");
imx233_set_pin_drive_strength(2, 2 + i, drive_strength);
imx233_set_pin_function(2, 2 + i, PINCTRL_FUNCTION_MAIN);
imx233_enable_pin_pullup(2, 2 + i, enable_pullups);
@@ -166,12 +169,14 @@ void imx233_ssp_setup_ssp1_sd_mmc_pins(bool enable_pullups, unsigned bus_width,
{
if(use_alt)
{
+ imx233_pinctrl_acquire_pin(0, 22 + i, "ssp1 data");
imx233_set_pin_drive_strength(0, 22 + i, drive_strength);
imx233_set_pin_function(0, 22 + i, PINCTRL_FUNCTION_ALT2);
imx233_enable_pin_pullup(0, 22 + i, enable_pullups);
}
else
{
+ imx233_pinctrl_acquire_pin(0, 4 + i, "ssp1 data");
imx233_set_pin_drive_strength(0, 4 + i, drive_strength);
imx233_set_pin_function(0, 4 + i, PINCTRL_FUNCTION_ALT2);
imx233_enable_pin_pullup(0, 4 + i, enable_pullups);
@@ -183,6 +188,8 @@ void imx233_ssp_setup_ssp2_sd_mmc_pins(bool enable_pullups, unsigned bus_width,
unsigned drive_strength)
{
/* SSP_{CMD,SCK} */
+ imx233_pinctrl_acquire_pin(0, 20, "ssp2 cmd");
+ imx233_pinctrl_acquire_pin(0, 24, "ssp2 sck");
imx233_set_pin_drive_strength(0, 20, drive_strength);
imx233_set_pin_drive_strength(0, 24, drive_strength);
imx233_set_pin_function(0, 20, PINCTRL_FUNCTION_ALT2);
@@ -191,13 +198,13 @@ void imx233_ssp_setup_ssp2_sd_mmc_pins(bool enable_pullups, unsigned bus_width,
/* SSP_DATA{0-7}*/
for(unsigned i = 0; i < bus_width; i++)
{
+ imx233_pinctrl_acquire_pin(0, i, "ssp2 data");
imx233_set_pin_drive_strength(0, i, drive_strength);
imx233_set_pin_function(0, i, PINCTRL_FUNCTION_ALT2);
imx233_enable_pin_pullup(0, i, enable_pullups);
+ imx233_enable_gpio_output(0, i, false);
+ imx233_set_gpio_output(0, i, false);
}
-
- imx233_enable_gpio_output_mask(0, 0x11000ff, false);
- imx233_set_gpio_output_mask(0, 0x11000ff, false);
}
void imx233_ssp_set_mode(int ssp, unsigned mode)
@@ -348,6 +355,7 @@ void imx233_ssp_sdmmc_setup_detect(int ssp, bool enable, ssp_detect_cb_t fn, boo
ssp_detect_cb[ssp - 1] = fn;
if(enable)
{
+ imx233_pinctrl_acquire_pin(bank, pin, ssp == 1 ? "ssp1 detect" : "ssp2 detect");
imx233_set_pin_function(bank, pin, PINCTRL_FUNCTION_GPIO);
imx233_enable_gpio_output(bank, pin, false);
}