diff options
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/imx233/debug-imx233.c | 29 | ||||
-rw-r--r-- | firmware/target/arm/imx233/i2c-imx233.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/imx233/mmc-imx233.c | 1 | ||||
-rw-r--r-- | firmware/target/arm/imx233/pinctrl-imx233.c | 39 | ||||
-rw-r--r-- | firmware/target/arm/imx233/pinctrl-imx233.h | 19 | ||||
-rw-r--r-- | firmware/target/arm/imx233/power-imx233.c | 1 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/backlight-fuzeplus.c | 1 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c | 9 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | 9 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c | 1 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sd-imx233.c | 1 | ||||
-rw-r--r-- | firmware/target/arm/imx233/ssp-imx233.c | 14 |
13 files changed, 122 insertions, 6 deletions
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c index fd510b77c1..59792c17a8 100644 --- a/firmware/target/arm/imx233/debug-imx233.c +++ b/firmware/target/arm/imx233/debug-imx233.c | |||
@@ -399,13 +399,25 @@ bool dbg_hw_info_pinctrl(void) | |||
399 | { | 399 | { |
400 | lcd_setfont(FONT_SYSFIXED); | 400 | lcd_setfont(FONT_SYSFIXED); |
401 | 401 | ||
402 | #ifdef IMX233_PINCTRL_DEBUG | ||
403 | unsigned top_user = 0; | ||
404 | #endif | ||
402 | while(1) | 405 | while(1) |
403 | { | 406 | { |
404 | int button = get_action(CONTEXT_STD, HZ / 10); | 407 | int button = get_action(CONTEXT_STD, HZ / 10); |
405 | switch(button) | 408 | switch(button) |
406 | { | 409 | { |
407 | case ACTION_STD_NEXT: | 410 | case ACTION_STD_NEXT: |
411 | #ifdef IMX233_PINCTRL_DEBUG | ||
412 | top_user++; | ||
413 | break; | ||
414 | #endif | ||
408 | case ACTION_STD_PREV: | 415 | case ACTION_STD_PREV: |
416 | #ifdef IMX233_PINCTRL_DEBUG | ||
417 | if(top_user > 0) | ||
418 | top_user--; | ||
419 | break; | ||
420 | #endif | ||
409 | case ACTION_STD_OK: | 421 | case ACTION_STD_OK: |
410 | case ACTION_STD_MENU: | 422 | case ACTION_STD_MENU: |
411 | lcd_setfont(FONT_UI); | 423 | lcd_setfont(FONT_UI); |
@@ -418,6 +430,23 @@ bool dbg_hw_info_pinctrl(void) | |||
418 | lcd_clear_display(); | 430 | lcd_clear_display(); |
419 | for(int i = 0; i < 4; i++) | 431 | for(int i = 0; i < 4; i++) |
420 | lcd_putsf(0, i, "DIN%d = 0x%08x", i, imx233_get_gpio_input_mask(i, 0xffffffff)); | 432 | lcd_putsf(0, i, "DIN%d = 0x%08x", i, imx233_get_gpio_input_mask(i, 0xffffffff)); |
433 | #ifdef IMX233_PINCTRL_DEBUG | ||
434 | unsigned cur_line = 6; | ||
435 | unsigned last_line = lcd_getheight() / font_get(lcd_getfont())->height; | ||
436 | unsigned cur_idx = 0; | ||
437 | |||
438 | for(int bank = 0; bank < 4; bank++) | ||
439 | for(int pin = 0; pin < 32; pin++) | ||
440 | { | ||
441 | const char *owner = imx233_pinctrl_get_pin_use(bank, pin); | ||
442 | if(owner == NULL) | ||
443 | continue; | ||
444 | if(cur_idx++ >= top_user && cur_line < last_line) | ||
445 | lcd_putsf(0, cur_line++, "B%dP%02d %s", bank, pin, owner); | ||
446 | } | ||
447 | if(cur_idx < top_user) | ||
448 | top_user = cur_idx - 1; | ||
449 | #endif | ||
421 | lcd_update(); | 450 | lcd_update(); |
422 | yield(); | 451 | yield(); |
423 | } | 452 | } |
diff --git a/firmware/target/arm/imx233/i2c-imx233.c b/firmware/target/arm/imx233/i2c-imx233.c index 21b66bcde8..199ad181ba 100644 --- a/firmware/target/arm/imx233/i2c-imx233.c +++ b/firmware/target/arm/imx233/i2c-imx233.c | |||
@@ -57,6 +57,8 @@ void imx233_i2c_init(void) | |||
57 | { | 57 | { |
58 | imx233_reset_block(&HW_I2C_CTRL0); | 58 | imx233_reset_block(&HW_I2C_CTRL0); |
59 | /* setup pins (must be done when shutdown) */ | 59 | /* setup pins (must be done when shutdown) */ |
60 | imx233_pinctrl_acquire_pin(0, 30, "i2c"); | ||
61 | imx233_pinctrl_acquire_pin(0, 31, "i2c"); | ||
60 | imx233_set_pin_function(0, 30, PINCTRL_FUNCTION_MAIN); | 62 | imx233_set_pin_function(0, 30, PINCTRL_FUNCTION_MAIN); |
61 | imx233_set_pin_function(0, 31, PINCTRL_FUNCTION_MAIN); | 63 | imx233_set_pin_function(0, 31, PINCTRL_FUNCTION_MAIN); |
62 | /* clear softreset */ | 64 | /* clear softreset */ |
diff --git a/firmware/target/arm/imx233/mmc-imx233.c b/firmware/target/arm/imx233/mmc-imx233.c index 8782e8e8af..f4dab30bcc 100644 --- a/firmware/target/arm/imx233/mmc-imx233.c +++ b/firmware/target/arm/imx233/mmc-imx233.c | |||
@@ -63,6 +63,7 @@ int mmc_init(void) | |||
63 | #ifdef SANSA_FUZEPLUS | 63 | #ifdef SANSA_FUZEPLUS |
64 | /** Sansa Fuze+ has an internal eMMC 8-bit wide flash, power gate is pin PWM3 | 64 | /** Sansa Fuze+ has an internal eMMC 8-bit wide flash, power gate is pin PWM3 |
65 | * and power up time is 20ms */ | 65 | * and power up time is 20ms */ |
66 | imx233_pinctrl_acquire_pin(1, 29, "emmc power"); | ||
66 | imx233_set_pin_function(1, 29, PINCTRL_FUNCTION_GPIO); | 67 | imx233_set_pin_function(1, 29, PINCTRL_FUNCTION_GPIO); |
67 | imx233_enable_gpio_output(1, 29, true); | 68 | imx233_enable_gpio_output(1, 29, true); |
68 | imx233_set_gpio_output(1, 29, false); | 69 | imx233_set_gpio_output(1, 29, false); |
diff --git a/firmware/target/arm/imx233/pinctrl-imx233.c b/firmware/target/arm/imx233/pinctrl-imx233.c index 7997292fcb..be2d8b2262 100644 --- a/firmware/target/arm/imx233/pinctrl-imx233.c +++ b/firmware/target/arm/imx233/pinctrl-imx233.c | |||
@@ -21,8 +21,47 @@ | |||
21 | #include "system.h" | 21 | #include "system.h" |
22 | #include "system-target.h" | 22 | #include "system-target.h" |
23 | #include "cpu.h" | 23 | #include "cpu.h" |
24 | #include "string.h" | ||
24 | #include "pinctrl-imx233.h" | 25 | #include "pinctrl-imx233.h" |
25 | 26 | ||
27 | #ifdef IMX233_PINCTRL_DEBUG | ||
28 | // 4 banks of 32 pins | ||
29 | static const char *pin_use[4][32]; | ||
30 | |||
31 | void imx233_pinctrl_acquire_pin(unsigned bank, unsigned pin, const char *name) | ||
32 | { | ||
33 | if(pin_use[bank][pin] != NULL && pin_use[bank][pin] != name) | ||
34 | panicf("acquire B%dP%02d for %s, was %s!", bank, pin, name, pin_use[bank][pin]); | ||
35 | pin_use[bank][pin] = name; | ||
36 | } | ||
37 | |||
38 | void imx233_pinctrl_acquire_pin_mask(unsigned bank, uint32_t mask, const char *name) | ||
39 | { | ||
40 | for(unsigned pin = 0; pin < 32; pin++) | ||
41 | if(mask & (1 << pin)) | ||
42 | imx233_pinctrl_acquire_pin(bank, pin, name); | ||
43 | } | ||
44 | |||
45 | void imx233_pinctrl_release_pin(unsigned bank, unsigned pin, const char *name) | ||
46 | { | ||
47 | if(pin_use[bank][pin] != NULL && pin_use[bank][pin] != name) | ||
48 | panicf("release B%dP%02d for %s: was %s!", bank, pin, name, pin_use[bank][pin]); | ||
49 | pin_use[bank][pin] = NULL; | ||
50 | } | ||
51 | |||
52 | void imx233_pinctrl_release_pin_mask(unsigned bank, uint32_t mask, const char *name) | ||
53 | { | ||
54 | for(unsigned pin = 0; pin < 32; pin++) | ||
55 | if(mask & (1 << pin)) | ||
56 | imx233_pinctrl_release_pin(bank, pin, name); | ||
57 | } | ||
58 | |||
59 | const char *imx233_pinctrl_get_pin_use(unsigned bank, unsigned pin) | ||
60 | { | ||
61 | return pin_use[bank][pin]; | ||
62 | } | ||
63 | #endif | ||
64 | |||
26 | static pin_irq_cb_t pin_cb[3][32]; /* 3 banks, 32 pins/bank */ | 65 | static pin_irq_cb_t pin_cb[3][32]; /* 3 banks, 32 pins/bank */ |
27 | 66 | ||
28 | static void INT_GPIO(int bank) | 67 | static void INT_GPIO(int bank) |
diff --git a/firmware/target/arm/imx233/pinctrl-imx233.h b/firmware/target/arm/imx233/pinctrl-imx233.h index ec23410442..5b4b9c4cd5 100644 --- a/firmware/target/arm/imx233/pinctrl-imx233.h +++ b/firmware/target/arm/imx233/pinctrl-imx233.h | |||
@@ -23,7 +23,10 @@ | |||
23 | #ifndef __PINCTRL_IMX233_H__ | 23 | #ifndef __PINCTRL_IMX233_H__ |
24 | #define __PINCTRL_IMX233_H__ | 24 | #define __PINCTRL_IMX233_H__ |
25 | 25 | ||
26 | #include "cpu.h" | 26 | #include "config.h" |
27 | |||
28 | // set to debug pinctrl use | ||
29 | #define IMX233_PINCTRL_DEBUG | ||
27 | 30 | ||
28 | #define HW_PINCTRL_BASE 0x80018000 | 31 | #define HW_PINCTRL_BASE 0x80018000 |
29 | 32 | ||
@@ -51,6 +54,20 @@ | |||
51 | #define PINCTRL_DRIVE_12mA 2 | 54 | #define PINCTRL_DRIVE_12mA 2 |
52 | #define PINCTRL_DRIVE_16mA 3 /* not available on all pins */ | 55 | #define PINCTRL_DRIVE_16mA 3 /* not available on all pins */ |
53 | 56 | ||
57 | #ifdef IMX233_PINCTRL_DEBUG | ||
58 | void imx233_pinctrl_acquire_pin(unsigned bank, unsigned pin, const char *name); | ||
59 | void imx233_pinctrl_acquire_pin_mask(unsigned bank, uint32_t mask, const char *name); | ||
60 | void imx233_pinctrl_release_pin(unsigned bank, unsigned pin, const char *name); | ||
61 | void imx233_pinctrl_release_pin_mask(unsigned bank, uint32_t mask, const char *name); | ||
62 | const char *imx233_pinctrl_get_pin_use(unsigned bank, unsigned pin); | ||
63 | #else | ||
64 | #define imx233_pinctrl_acquire_pin(...) | ||
65 | #define imx233_pinctrl_acquire_pin_mask(...) | ||
66 | #define imx233_pinctrl_release_pin(...) | ||
67 | #define imx233_pinctrl_release_pin_mask(...) | ||
68 | #define imx233_pinctrl_get_pin_use(...) NULL | ||
69 | #endif | ||
70 | |||
54 | typedef void (*pin_irq_cb_t)(int bank, int pin); | 71 | typedef void (*pin_irq_cb_t)(int bank, int pin); |
55 | 72 | ||
56 | static inline void imx233_pinctrl_init(void) | 73 | static inline void imx233_pinctrl_init(void) |
diff --git a/firmware/target/arm/imx233/power-imx233.c b/firmware/target/arm/imx233/power-imx233.c index 2ae7ff653c..be12207793 100644 --- a/firmware/target/arm/imx233/power-imx233.c +++ b/firmware/target/arm/imx233/power-imx233.c | |||
@@ -114,6 +114,7 @@ void power_off(void) | |||
114 | sleep(HZ / 2); | 114 | sleep(HZ / 2); |
115 | #ifdef SANSA_FUZEPLUS | 115 | #ifdef SANSA_FUZEPLUS |
116 | /* This pin seems to be important to shutdown the hardware properly */ | 116 | /* This pin seems to be important to shutdown the hardware properly */ |
117 | imx233_pinctrl_acquire_pin(0, 9, "power off"); | ||
117 | imx233_set_pin_function(0, 9, PINCTRL_FUNCTION_GPIO); | 118 | imx233_set_pin_function(0, 9, PINCTRL_FUNCTION_GPIO); |
118 | imx233_enable_gpio_output(0, 9, true); | 119 | imx233_enable_gpio_output(0, 9, true); |
119 | imx233_set_gpio_output(0, 9, true); | 120 | imx233_set_gpio_output(0, 9, true); |
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/backlight-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/backlight-fuzeplus.c index 6e13c0419c..7f181a9672 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/backlight-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/backlight-fuzeplus.c | |||
@@ -41,6 +41,7 @@ void _backlight_set_brightness(int brightness) | |||
41 | 41 | ||
42 | bool _backlight_init(void) | 42 | bool _backlight_init(void) |
43 | { | 43 | { |
44 | imx233_pinctrl_acquire_pin(1, 28, "backlight"); | ||
44 | imx233_set_pin_function(1, 28, PINCTRL_FUNCTION_GPIO); | 45 | imx233_set_pin_function(1, 28, PINCTRL_FUNCTION_GPIO); |
45 | imx233_set_pin_drive_strength(1, 28, PINCTRL_DRIVE_8mA); | 46 | imx233_set_pin_drive_strength(1, 28, PINCTRL_DRIVE_8mA); |
46 | imx233_enable_gpio_output(1, 28, true); | 47 | imx233_enable_gpio_output(1, 28, true); |
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c index 26e5a0a102..86bb00f4a5 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c | |||
@@ -301,7 +301,8 @@ void button_init_device(void) | |||
301 | * The B0P26 line seems to be related to the touchpad | 301 | * The B0P26 line seems to be related to the touchpad |
302 | */ | 302 | */ |
303 | 303 | ||
304 | /* touchpad CE ? */ | 304 | /* touchpad power */ |
305 | imx233_pinctrl_acquire_pin(0, 26, "touchpad power"); | ||
305 | imx233_set_pin_function(0, 26, PINCTRL_FUNCTION_GPIO); | 306 | imx233_set_pin_function(0, 26, PINCTRL_FUNCTION_GPIO); |
306 | imx233_enable_gpio_output(0, 26, false); | 307 | imx233_enable_gpio_output(0, 26, false); |
307 | imx233_set_pin_drive_strength(0, 26, PINCTRL_DRIVE_8mA); | 308 | imx233_set_pin_drive_strength(0, 26, PINCTRL_DRIVE_8mA); |
@@ -324,10 +325,12 @@ void button_init_device(void) | |||
324 | create_thread(rmi_thread, rmi_stack, sizeof(rmi_stack), 0, | 325 | create_thread(rmi_thread, rmi_stack, sizeof(rmi_stack), 0, |
325 | rmi_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE) IF_COP(, CPU)); | 326 | rmi_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE) IF_COP(, CPU)); |
326 | /* enable interrupt */ | 327 | /* enable interrupt */ |
328 | imx233_pinctrl_acquire_pin(0, 27, "touchpad int"); | ||
327 | imx233_set_pin_function(0, 27, PINCTRL_FUNCTION_GPIO); | 329 | imx233_set_pin_function(0, 27, PINCTRL_FUNCTION_GPIO); |
328 | imx233_enable_gpio_output(0, 27, false); | 330 | imx233_enable_gpio_output(0, 27, false); |
329 | imx233_setup_pin_irq(0, 27, true, true, false, &rmi_attn_cb); | 331 | imx233_setup_pin_irq(0, 27, true, true, false, &rmi_attn_cb); |
330 | /* Volume down */ | 332 | /* Volume down */ |
333 | imx233_pinctrl_acquire_pin(1, 30, "volume down"); | ||
331 | imx233_set_pin_function(1, 30, PINCTRL_FUNCTION_GPIO); | 334 | imx233_set_pin_function(1, 30, PINCTRL_FUNCTION_GPIO); |
332 | imx233_enable_gpio_output(1, 30, false); | 335 | imx233_enable_gpio_output(1, 30, false); |
333 | } | 336 | } |
@@ -336,6 +339,10 @@ void button_init_device(void) | |||
336 | 339 | ||
337 | void button_init_device(void) | 340 | void button_init_device(void) |
338 | { | 341 | { |
342 | /* Volume down */ | ||
343 | imx233_pinctrl_acquire_pin(1, 30, "volume down"); | ||
344 | imx233_set_pin_function(1, 30, PINCTRL_FUNCTION_GPIO); | ||
345 | imx233_enable_gpio_output(1, 30, false); | ||
339 | } | 346 | } |
340 | 347 | ||
341 | int touchpad_read_device(void) | 348 | int touchpad_read_device(void) |
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c index 417f70e406..ee63cd35f6 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c | |||
@@ -87,6 +87,8 @@ struct i2c_interface fmradio_i2c = | |||
87 | 87 | ||
88 | void fmradio_i2c_init(void) | 88 | void fmradio_i2c_init(void) |
89 | { | 89 | { |
90 | imx233_pinctrl_acquire_pin(1, 24, "fmradio i2c"); | ||
91 | imx233_pinctrl_acquire_pin(1, 22, "fmradio i2c"); | ||
90 | imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_GPIO); | 92 | imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_GPIO); |
91 | imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_GPIO); | 93 | imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_GPIO); |
92 | fmradio_i2c_bus = i2c_add_node(&fmradio_i2c); | 94 | fmradio_i2c_bus = i2c_add_node(&fmradio_i2c); |
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c index b83c49d092..20b46fdc63 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | |||
@@ -56,6 +56,13 @@ static void setup_lcd_pins(bool use_lcdif) | |||
56 | /* WARNING | 56 | /* WARNING |
57 | * the B1P22 and B1P24 pins are used by the tuner i2c! Do NOT drive | 57 | * the B1P22 and B1P24 pins are used by the tuner i2c! Do NOT drive |
58 | * them as lcd_dotclk and lcd_hsync or it will break the tuner! */ | 58 | * them as lcd_dotclk and lcd_hsync or it will break the tuner! */ |
59 | imx233_pinctrl_acquire_pin(1, 18, "lcd reset"); | ||
60 | imx233_pinctrl_acquire_pin(1, 19, "lcd rs"); | ||
61 | imx233_pinctrl_acquire_pin(1, 20, "lcd wr"); | ||
62 | imx233_pinctrl_acquire_pin(1, 21, "lcd cs"); | ||
63 | imx233_pinctrl_acquire_pin(1, 23, "lcd enable"); | ||
64 | imx233_pinctrl_acquire_pin(1, 25, "lcd vsync"); | ||
65 | imx233_pinctrl_acquire_pin_mask(1, 0x3ffff, "lcd data"); | ||
59 | if(use_lcdif) | 66 | if(use_lcdif) |
60 | { | 67 | { |
61 | imx233_set_pin_function(1, 25, PINCTRL_FUNCTION_GPIO); /* lcd_vsync */ | 68 | imx233_set_pin_function(1, 25, PINCTRL_FUNCTION_GPIO); /* lcd_vsync */ |
@@ -71,7 +78,7 @@ static void setup_lcd_pins(bool use_lcdif) | |||
71 | else | 78 | else |
72 | { | 79 | { |
73 | __REG_SET(HW_PINCTRL_MUXSEL(2)) = 0xffffffff; /* lcd_d{0-15} */ | 80 | __REG_SET(HW_PINCTRL_MUXSEL(2)) = 0xffffffff; /* lcd_d{0-15} */ |
74 | imx233_enable_gpio_output_mask(1, 0x3ffffff, false); /* lcd_{d{0-17},reset,rs,wr,cs,dotclk,enable,hsync,vsync} */ | 81 | imx233_enable_gpio_output_mask(1, 0x2bfffff, false); /* lcd_{d{0-17},reset,rs,wr,cs,enable,vsync} */ |
75 | imx233_set_pin_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */ | 82 | imx233_set_pin_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */ |
76 | imx233_set_pin_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */ | 83 | imx233_set_pin_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */ |
77 | imx233_set_pin_function(1, 19, PINCTRL_FUNCTION_GPIO); /* lcd_rs */ | 84 | imx233_set_pin_function(1, 19, PINCTRL_FUNCTION_GPIO); /* lcd_rs */ |
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c index 71c45b0676..89dbfd3cb7 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c | |||
@@ -33,6 +33,7 @@ bool tuner_power(bool enable) | |||
33 | if(enable != tuner_enable) | 33 | if(enable != tuner_enable) |
34 | { | 34 | { |
35 | /* CE is B029 (active high) */ | 35 | /* CE is B029 (active high) */ |
36 | imx233_pinctrl_acquire_pin(0, 29, "tuner power"); | ||
36 | imx233_set_pin_function(0, 29, PINCTRL_FUNCTION_GPIO); | 37 | imx233_set_pin_function(0, 29, PINCTRL_FUNCTION_GPIO); |
37 | imx233_set_pin_drive_strength(0, 29, PINCTRL_DRIVE_4mA); | 38 | imx233_set_pin_drive_strength(0, 29, PINCTRL_DRIVE_4mA); |
38 | imx233_enable_gpio_output(0, 29, enable); | 39 | imx233_enable_gpio_output(0, 29, enable); |
diff --git a/firmware/target/arm/imx233/sd-imx233.c b/firmware/target/arm/imx233/sd-imx233.c index b68950b9e8..1e9d001bbd 100644 --- a/firmware/target/arm/imx233/sd-imx233.c +++ b/firmware/target/arm/imx233/sd-imx233.c | |||
@@ -64,6 +64,7 @@ void sd_power(bool on) | |||
64 | { | 64 | { |
65 | #ifdef SANSA_FUZEPLUS | 65 | #ifdef SANSA_FUZEPLUS |
66 | /* The Fuze+ uses pin B0P8 for whatever reason, power ? */ | 66 | /* The Fuze+ uses pin B0P8 for whatever reason, power ? */ |
67 | imx233_pinctrl_acquire_pin(0, 8, "sd power"); | ||
67 | imx233_set_pin_function(0, 8, PINCTRL_FUNCTION_GPIO); | 68 | imx233_set_pin_function(0, 8, PINCTRL_FUNCTION_GPIO); |
68 | imx233_enable_gpio_output(0, 8, true); | 69 | imx233_enable_gpio_output(0, 8, true); |
69 | imx233_set_gpio_output(0, 8, !on); | 70 | imx233_set_gpio_output(0, 8, !on); |
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, | |||
150 | /* SSP_{CMD,SCK} */ | 150 | /* SSP_{CMD,SCK} */ |
151 | imx233_set_pin_drive_strength(2, 0, drive_strength); | 151 | imx233_set_pin_drive_strength(2, 0, drive_strength); |
152 | imx233_set_pin_drive_strength(2, 6, drive_strength); | 152 | imx233_set_pin_drive_strength(2, 6, drive_strength); |
153 | imx233_pinctrl_acquire_pin(2, 0, "ssp1 cmd"); | ||
154 | imx233_pinctrl_acquire_pin(2, 6, "ssp1 sck"); | ||
153 | imx233_set_pin_function(2, 0, PINCTRL_FUNCTION_MAIN); | 155 | imx233_set_pin_function(2, 0, PINCTRL_FUNCTION_MAIN); |
154 | imx233_set_pin_function(2, 6, PINCTRL_FUNCTION_MAIN); | 156 | imx233_set_pin_function(2, 6, PINCTRL_FUNCTION_MAIN); |
155 | imx233_enable_pin_pullup(2, 0, enable_pullups); | 157 | imx233_enable_pin_pullup(2, 0, enable_pullups); |
156 | /* SSP_DATA{0-3} */ | 158 | /* SSP_DATA{0-3} */ |
157 | for(unsigned i = 0; i < MIN(bus_width, 4); i++) | 159 | for(unsigned i = 0; i < MIN(bus_width, 4); i++) |
158 | { | 160 | { |
161 | imx233_pinctrl_acquire_pin(2, 2 + i, "ssp1 data"); | ||
159 | imx233_set_pin_drive_strength(2, 2 + i, drive_strength); | 162 | imx233_set_pin_drive_strength(2, 2 + i, drive_strength); |
160 | imx233_set_pin_function(2, 2 + i, PINCTRL_FUNCTION_MAIN); | 163 | imx233_set_pin_function(2, 2 + i, PINCTRL_FUNCTION_MAIN); |
161 | imx233_enable_pin_pullup(2, 2 + i, enable_pullups); | 164 | 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, | |||
166 | { | 169 | { |
167 | if(use_alt) | 170 | if(use_alt) |
168 | { | 171 | { |
172 | imx233_pinctrl_acquire_pin(0, 22 + i, "ssp1 data"); | ||
169 | imx233_set_pin_drive_strength(0, 22 + i, drive_strength); | 173 | imx233_set_pin_drive_strength(0, 22 + i, drive_strength); |
170 | imx233_set_pin_function(0, 22 + i, PINCTRL_FUNCTION_ALT2); | 174 | imx233_set_pin_function(0, 22 + i, PINCTRL_FUNCTION_ALT2); |
171 | imx233_enable_pin_pullup(0, 22 + i, enable_pullups); | 175 | imx233_enable_pin_pullup(0, 22 + i, enable_pullups); |
172 | } | 176 | } |
173 | else | 177 | else |
174 | { | 178 | { |
179 | imx233_pinctrl_acquire_pin(0, 4 + i, "ssp1 data"); | ||
175 | imx233_set_pin_drive_strength(0, 4 + i, drive_strength); | 180 | imx233_set_pin_drive_strength(0, 4 + i, drive_strength); |
176 | imx233_set_pin_function(0, 4 + i, PINCTRL_FUNCTION_ALT2); | 181 | imx233_set_pin_function(0, 4 + i, PINCTRL_FUNCTION_ALT2); |
177 | imx233_enable_pin_pullup(0, 4 + i, enable_pullups); | 182 | 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, | |||
183 | unsigned drive_strength) | 188 | unsigned drive_strength) |
184 | { | 189 | { |
185 | /* SSP_{CMD,SCK} */ | 190 | /* SSP_{CMD,SCK} */ |
191 | imx233_pinctrl_acquire_pin(0, 20, "ssp2 cmd"); | ||
192 | imx233_pinctrl_acquire_pin(0, 24, "ssp2 sck"); | ||
186 | imx233_set_pin_drive_strength(0, 20, drive_strength); | 193 | imx233_set_pin_drive_strength(0, 20, drive_strength); |
187 | imx233_set_pin_drive_strength(0, 24, drive_strength); | 194 | imx233_set_pin_drive_strength(0, 24, drive_strength); |
188 | imx233_set_pin_function(0, 20, PINCTRL_FUNCTION_ALT2); | 195 | 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, | |||
191 | /* SSP_DATA{0-7}*/ | 198 | /* SSP_DATA{0-7}*/ |
192 | for(unsigned i = 0; i < bus_width; i++) | 199 | for(unsigned i = 0; i < bus_width; i++) |
193 | { | 200 | { |
201 | imx233_pinctrl_acquire_pin(0, i, "ssp2 data"); | ||
194 | imx233_set_pin_drive_strength(0, i, drive_strength); | 202 | imx233_set_pin_drive_strength(0, i, drive_strength); |
195 | imx233_set_pin_function(0, i, PINCTRL_FUNCTION_ALT2); | 203 | imx233_set_pin_function(0, i, PINCTRL_FUNCTION_ALT2); |
196 | imx233_enable_pin_pullup(0, i, enable_pullups); | 204 | imx233_enable_pin_pullup(0, i, enable_pullups); |
205 | imx233_enable_gpio_output(0, i, false); | ||
206 | imx233_set_gpio_output(0, i, false); | ||
197 | } | 207 | } |
198 | |||
199 | imx233_enable_gpio_output_mask(0, 0x11000ff, false); | ||
200 | imx233_set_gpio_output_mask(0, 0x11000ff, false); | ||
201 | } | 208 | } |
202 | 209 | ||
203 | void imx233_ssp_set_mode(int ssp, unsigned mode) | 210 | 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 | |||
348 | ssp_detect_cb[ssp - 1] = fn; | 355 | ssp_detect_cb[ssp - 1] = fn; |
349 | if(enable) | 356 | if(enable) |
350 | { | 357 | { |
358 | imx233_pinctrl_acquire_pin(bank, pin, ssp == 1 ? "ssp1 detect" : "ssp2 detect"); | ||
351 | imx233_set_pin_function(bank, pin, PINCTRL_FUNCTION_GPIO); | 359 | imx233_set_pin_function(bank, pin, PINCTRL_FUNCTION_GPIO); |
352 | imx233_enable_gpio_output(bank, pin, false); | 360 | imx233_enable_gpio_output(bank, pin, false); |
353 | } | 361 | } |