summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c5
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c4
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/button-zenxfi3.c7
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c4
-rw-r--r--firmware/target/arm/imx233/debug-imx233.c2
-rw-r--r--firmware/target/arm/imx233/pinctrl-imx233.c14
-rw-r--r--firmware/target/arm/imx233/pinctrl-imx233.h74
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c4
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c4
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c21
10 files changed, 70 insertions, 69 deletions
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
index b990becf26..74b8d649b3 100644
--- a/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
+++ b/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
@@ -119,10 +119,9 @@ int button_read_device(int *data)
119 int res = 0; 119 int res = 0;
120 /* B0P11: #power 120 /* B0P11: #power
121 * B0P14: #select */ 121 * B0P14: #select */
122 uint32_t mask = imx233_pinctrl_get_gpio_mask(0, 0x4800); 122 if(!imx233_pinctrl_get_gpio(0, 11))
123 if(!(mask & 0x800))
124 res |= BUTTON_POWER; 123 res |= BUTTON_POWER;
125 if(!(mask & 0x4000)) 124 if(!imx233_pinctrl_get_gpio(0, 14))
126 res |= BUTTON_MENU; 125 res |= BUTTON_MENU;
127 return res | touchscreen_read_device(data); 126 return res | touchscreen_read_device(data);
128} 127}
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c
index 1e60e60463..9ff64c4c14 100644
--- a/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c
+++ b/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c
@@ -53,7 +53,7 @@ static void setup_lcd_pins(bool use_lcdif)
53 imx233_pinctrl_acquire(1, 23, "lcd enable"); 53 imx233_pinctrl_acquire(1, 23, "lcd enable");
54 imx233_pinctrl_acquire(1, 24, "lcd hsync"); 54 imx233_pinctrl_acquire(1, 24, "lcd hsync");
55 imx233_pinctrl_acquire(1, 25, "lcd vsync"); 55 imx233_pinctrl_acquire(1, 25, "lcd vsync");
56 imx233_pinctrl_acquire_mask(1, 0x3ffff, "lcd data"); 56 //imx233_pinctrl_acquire_mask(1, 0x3ffff, "lcd data");
57 if(use_lcdif) 57 if(use_lcdif)
58 { 58 {
59 imx233_pinctrl_set_function(1, 25, PINCTRL_FUNCTION_MAIN); /* lcd_vsync */ 59 imx233_pinctrl_set_function(1, 25, PINCTRL_FUNCTION_MAIN); /* lcd_vsync */
@@ -71,7 +71,7 @@ static void setup_lcd_pins(bool use_lcdif)
71 else 71 else
72 { 72 {
73 HW_PINCTRL_MUXSELn_SET(2) = 0xffffffff; /* lcd_d{0-15} */ 73 HW_PINCTRL_MUXSELn_SET(2) = 0xffffffff; /* lcd_d{0-15} */
74 imx233_pinctrl_enable_gpio_mask(1, 0x3ffffff, false); /* lcd_{d{0-17},reset,rs,wr,cs,dotclk,enable,hsync,vsync} */ 74 HW_PINCTRL_DOEn_CLR(1) = 0x3ffffff; /* lcd_{d{0-17},reset,rs,wr,cs,dotclk,enable,hsync,vsync} */
75 imx233_pinctrl_set_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */ 75 imx233_pinctrl_set_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */
76 imx233_pinctrl_set_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */ 76 imx233_pinctrl_set_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */
77 imx233_pinctrl_set_function(1, 19, PINCTRL_FUNCTION_GPIO); /* lcd_rs */ 77 imx233_pinctrl_set_function(1, 19, PINCTRL_FUNCTION_GPIO); /* lcd_rs */
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/button-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/button-zenxfi3.c
index c3f1908511..f89297b80c 100644
--- a/firmware/target/arm/imx233/creative-zenxfi3/button-zenxfi3.c
+++ b/firmware/target/arm/imx233/creative-zenxfi3/button-zenxfi3.c
@@ -144,7 +144,7 @@ void button_init_device(void)
144bool button_hold(void) 144bool button_hold(void)
145{ 145{
146 /* B0P04: #hold */ 146 /* B0P04: #hold */
147 return !imx233_pinctrl_get_gpio_mask(0, 0x10); 147 return !imx233_pinctrl_get_gpio(0, 4);
148} 148}
149 149
150int button_read_device(void) 150int button_read_device(void)
@@ -172,10 +172,9 @@ int button_read_device(void)
172 /* B2P07: #volume- 172 /* B2P07: #volume-
173 * B2P08: #volume+ 173 * B2P08: #volume+
174 * PSWITCH: power */ 174 * PSWITCH: power */
175 uint32_t mask = imx233_pinctrl_get_gpio_mask(2, 0x180); 175 if(!imx233_pinctrl_get_gpio(2, 7))
176 if(!(mask & 0x80))
177 res |= BUTTON_VOL_DOWN; 176 res |= BUTTON_VOL_DOWN;
178 if(!(mask & 0x100)) 177 if(!imx233_pinctrl_get_gpio(2, 8))
179 res |= BUTTON_VOL_UP; 178 res |= BUTTON_VOL_UP;
180 if(BF_RD(POWER_STS, PSWITCH) != 0 && power_ignore_counter == 0) 179 if(BF_RD(POWER_STS, PSWITCH) != 0 && power_ignore_counter == 0)
181 res |= BUTTON_POWER; 180 res |= BUTTON_POWER;
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c
index de9e2df393..7afdaa316e 100644
--- a/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c
+++ b/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c
@@ -54,7 +54,7 @@ static void setup_lcd_pins(bool use_lcdif)
54 imx233_pinctrl_acquire(1, 21, "lcd cs"); 54 imx233_pinctrl_acquire(1, 21, "lcd cs");
55 imx233_pinctrl_acquire(1, 23, "lcd enable"); 55 imx233_pinctrl_acquire(1, 23, "lcd enable");
56 imx233_pinctrl_acquire(1, 25, "lcd vsync"); 56 imx233_pinctrl_acquire(1, 25, "lcd vsync");
57 imx233_pinctrl_acquire_mask(1, 0x3ffff, "lcd data"); 57 //imx233_pinctrl_acquire_mask(1, 0x3ffff, "lcd data");
58 if(use_lcdif) 58 if(use_lcdif)
59 { 59 {
60 imx233_pinctrl_set_function(1, 25, PINCTRL_FUNCTION_MAIN); /* lcd_vsync */ 60 imx233_pinctrl_set_function(1, 25, PINCTRL_FUNCTION_MAIN); /* lcd_vsync */
@@ -70,7 +70,7 @@ static void setup_lcd_pins(bool use_lcdif)
70 else 70 else
71 { 71 {
72 HW_PINCTRL_MUXSELn_SET(2) = 0xffffffff; /* lcd_d{0-15} */ 72 HW_PINCTRL_MUXSELn_SET(2) = 0xffffffff; /* lcd_d{0-15} */
73 imx233_pinctrl_enable_gpio_mask(1, 0x2bfffff, false); /* lcd_{d{0-17},reset,rs,wr,cs,enable,vsync} */ 73 HW_PINCTRL_DOEn_CLR(1) = 0x2bfffff;
74 imx233_pinctrl_set_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */ 74 imx233_pinctrl_set_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */
75 imx233_pinctrl_set_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */ 75 imx233_pinctrl_set_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */
76 imx233_pinctrl_set_function(1, 19, PINCTRL_FUNCTION_GPIO); /* lcd_rs */ 76 imx233_pinctrl_set_function(1, 19, PINCTRL_FUNCTION_GPIO); /* lcd_rs */
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c
index 7cb217f40f..7d690446d8 100644
--- a/firmware/target/arm/imx233/debug-imx233.c
+++ b/firmware/target/arm/imx233/debug-imx233.c
@@ -489,7 +489,7 @@ bool dbg_hw_info_pinctrl(void)
489 489
490 lcd_clear_display(); 490 lcd_clear_display();
491 for(int i = 0; i < 4; i++) 491 for(int i = 0; i < 4; i++)
492 lcd_putsf(0, i, "DIN%d = 0x%08x", i, imx233_pinctrl_get_gpio_mask(i, 0xffffffff)); 492 lcd_putsf(0, i, "DIN%d = 0x%08x", i, HW_PINCTRL_DINn(i));
493#ifdef IMX233_PINCTRL_DEBUG 493#ifdef IMX233_PINCTRL_DEBUG
494 unsigned cur_line = 6; 494 unsigned cur_line = 6;
495 unsigned last_line = lcd_getheight() / font_get(lcd_getfont())->height; 495 unsigned last_line = lcd_getheight() / font_get(lcd_getfont())->height;
diff --git a/firmware/target/arm/imx233/pinctrl-imx233.c b/firmware/target/arm/imx233/pinctrl-imx233.c
index ab59532543..96edf8db84 100644
--- a/firmware/target/arm/imx233/pinctrl-imx233.c
+++ b/firmware/target/arm/imx233/pinctrl-imx233.c
@@ -35,13 +35,6 @@ void imx233_pinctrl_acquire(unsigned bank, unsigned pin, const char *name)
35 pin_use[bank][pin] = name; 35 pin_use[bank][pin] = name;
36} 36}
37 37
38void imx233_pinctrl_acquire_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(bank, pin, name);
43}
44
45void imx233_pinctrl_release(unsigned bank, unsigned pin, const char *name) 38void imx233_pinctrl_release(unsigned bank, unsigned pin, const char *name)
46{ 39{
47 if(pin_use[bank][pin] != NULL && pin_use[bank][pin] != name) 40 if(pin_use[bank][pin] != NULL && pin_use[bank][pin] != name)
@@ -49,13 +42,6 @@ void imx233_pinctrl_release(unsigned bank, unsigned pin, const char *name)
49 pin_use[bank][pin] = NULL; 42 pin_use[bank][pin] = NULL;
50} 43}
51 44
52void imx233_pinctrl_release_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(bank, pin, name);
57}
58
59const char *imx233_pinctrl_blame(unsigned bank, unsigned pin) 45const char *imx233_pinctrl_blame(unsigned bank, unsigned pin)
60{ 46{
61 return pin_use[bank][pin]; 47 return pin_use[bank][pin];
diff --git a/firmware/target/arm/imx233/pinctrl-imx233.h b/firmware/target/arm/imx233/pinctrl-imx233.h
index 05c2c15bea..3fcf042071 100644
--- a/firmware/target/arm/imx233/pinctrl-imx233.h
+++ b/firmware/target/arm/imx233/pinctrl-imx233.h
@@ -35,23 +35,24 @@
35#define PINCTRL_FUNCTION_ALT2 2 35#define PINCTRL_FUNCTION_ALT2 2
36#define PINCTRL_FUNCTION_GPIO 3 36#define PINCTRL_FUNCTION_GPIO 3
37 37
38#if IMX233_SUBTARGET >= 3700
38#define PINCTRL_DRIVE_4mA 0 39#define PINCTRL_DRIVE_4mA 0
39#define PINCTRL_DRIVE_8mA 1 40#define PINCTRL_DRIVE_8mA 1
40#define PINCTRL_DRIVE_12mA 2 41#define PINCTRL_DRIVE_12mA 2
41#define PINCTRL_DRIVE_16mA 3 /* not available on all pins */ 42#define PINCTRL_DRIVE_16mA 3 /* not available on all pins */
43#else
44#define PINCTRL_DRIVE_4mA 0
45#define PINCTRL_DRIVE_8mA 1
46#endif
42 47
43#ifdef IMX233_PINCTRL_DEBUG 48#ifdef IMX233_PINCTRL_DEBUG
44void imx233_pinctrl_acquire(unsigned bank, unsigned pin, const char *name); 49void imx233_pinctrl_acquire(unsigned bank, unsigned pin, const char *name);
45void imx233_pinctrl_acquire_mask(unsigned bank, uint32_t mask, const char *name);
46void imx233_pinctrl_release(unsigned bank, unsigned pin, const char *name); 50void imx233_pinctrl_release(unsigned bank, unsigned pin, const char *name);
47void imx233_pinctrl_release_mask(unsigned bank, uint32_t mask, const char *name);
48const char *imx233_pinctrl_blame(unsigned bank, unsigned pin); 51const char *imx233_pinctrl_blame(unsigned bank, unsigned pin);
49#else 52#else
50#define imx233_pinctrl_acquire(...) 53#define imx233_pinctrl_acquire(...)
51#define imx233_pinctrl_acquire_mask(...)
52#define imx233_pinctrl_release(...) 54#define imx233_pinctrl_release(...)
53#define imx233_pinctrl_release_mask(...) 55#define imx233_pinctrl_get_pin_use(...) NULL
54#define imx233_pinctrl_blame(...) NULL
55#endif 56#endif
56 57
57typedef void (*pin_irq_cb_t)(int bank, int pin, intptr_t user); 58typedef void (*pin_irq_cb_t)(int bank, int pin, intptr_t user);
@@ -61,11 +62,19 @@ static inline void imx233_pinctrl_init(void)
61 HW_PINCTRL_CTRL_CLR = BM_OR2(PINCTRL_CTRL, CLKGATE, SFTRST); 62 HW_PINCTRL_CTRL_CLR = BM_OR2(PINCTRL_CTRL, CLKGATE, SFTRST);
62} 63}
63 64
65#if IMX233_SUBTARGET >= 3700
64static inline void imx233_pinctrl_set_drive(unsigned bank, unsigned pin, unsigned strength) 66static inline void imx233_pinctrl_set_drive(unsigned bank, unsigned pin, unsigned strength)
65{ 67{
66 HW_PINCTRL_DRIVEn_CLR(4 * bank + pin / 8) = 3 << (4 * (pin % 8)); 68 HW_PINCTRL_DRIVEn_CLR(4 * bank + pin / 8) = 3 << (4 * (pin % 8));
67 HW_PINCTRL_DRIVEn_SET(4 * bank + pin / 8) = strength << (4 * (pin % 8)); 69 HW_PINCTRL_DRIVEn_SET(4 * bank + pin / 8) = strength << (4 * (pin % 8));
68} 70}
71#else
72static inline void imx233_pinctrl_set_drive(unsigned bank, unsigned pin, unsigned strength)
73{
74 HW_PINCTRL_DRIVEn_CLR(bank) = 1 << pin;
75 HW_PINCTRL_DRIVEn_SET(bank) = strength << pin;
76}
77#endif
69 78
70static inline void imx233_pinctrl_enable_gpio(unsigned bank, unsigned pin, bool enable) 79static inline void imx233_pinctrl_enable_gpio(unsigned bank, unsigned pin, bool enable)
71{ 80{
@@ -75,14 +84,6 @@ static inline void imx233_pinctrl_enable_gpio(unsigned bank, unsigned pin, bool
75 HW_PINCTRL_DOEn_CLR(bank) = 1 << pin; 84 HW_PINCTRL_DOEn_CLR(bank) = 1 << pin;
76} 85}
77 86
78static inline void imx233_pinctrl_enable_gpio_mask(unsigned bank, uint32_t pin_mask, bool enable)
79{
80 if(enable)
81 HW_PINCTRL_DOEn_SET(bank) = pin_mask;
82 else
83 HW_PINCTRL_DOEn_CLR(bank) = pin_mask;
84}
85
86static inline void imx233_pinctrl_set_gpio(unsigned bank, unsigned pin, bool value) 87static inline void imx233_pinctrl_set_gpio(unsigned bank, unsigned pin, bool value)
87{ 88{
88 if(value) 89 if(value)
@@ -91,25 +92,32 @@ static inline void imx233_pinctrl_set_gpio(unsigned bank, unsigned pin, bool val
91 HW_PINCTRL_DOUTn_CLR(bank) = 1 << pin; 92 HW_PINCTRL_DOUTn_CLR(bank) = 1 << pin;
92} 93}
93 94
94static inline void imx233_pinctrl_set_gpio_mask(unsigned bank, uint32_t pin_mask, bool value) 95static inline bool imx233_pinctrl_get_gpio(unsigned bank, unsigned pin)
95{
96 if(value)
97 HW_PINCTRL_DOUTn_SET(bank) = pin_mask;
98 else
99 HW_PINCTRL_DOUTn_CLR(bank) = pin_mask;
100}
101
102static inline uint32_t imx233_pinctrl_get_gpio_mask(unsigned bank, uint32_t pin_mask)
103{ 96{
104 return HW_PINCTRL_DINn(bank) & pin_mask; 97 return (HW_PINCTRL_DINn(bank) >> pin) & 1;
105} 98}
106 99
107static inline void imx233_pinctrl_set_function(unsigned bank, unsigned pin, unsigned function) 100static inline void imx233_pinctrl_set_function(unsigned bank, unsigned pin, unsigned function)
108{ 101{
102#if IMX233_SUBTARGET >= 3700
109 HW_PINCTRL_MUXSELn_CLR(2 * bank + pin / 16) = 3 << (2 * (pin % 16)); 103 HW_PINCTRL_MUXSELn_CLR(2 * bank + pin / 16) = 3 << (2 * (pin % 16));
110 HW_PINCTRL_MUXSELn_SET(2 * bank + pin / 16) = function << (2 * (pin % 16)); 104 HW_PINCTRL_MUXSELn_SET(2 * bank + pin / 16) = function << (2 * (pin % 16));
105#else
106 if(pin < 16)
107 {
108 HW_PINCTRL_MUXSELLn_CLR(bank) = 3 << (2 * pin);
109 HW_PINCTRL_MUXSELLn_SET(bank) = function << (2 * pin);
110 }
111 else
112 {
113 pin -= 16;
114 HW_PINCTRL_MUXSELHn_CLR(bank) = 3 << (2 * pin);
115 HW_PINCTRL_MUXSELHn_SET(bank) = function << (2 * pin);
116 }
117#endif
111} 118}
112 119
120#if IMX233_SUBTARGET >= 3700
113static inline void imx233_pinctrl_enable_pullup(unsigned bank, unsigned pin, bool enable) 121static inline void imx233_pinctrl_enable_pullup(unsigned bank, unsigned pin, bool enable)
114{ 122{
115 if(enable) 123 if(enable)
@@ -117,14 +125,14 @@ static inline void imx233_pinctrl_enable_pullup(unsigned bank, unsigned pin, boo
117 else 125 else
118 HW_PINCTRL_PULLn_CLR(bank) = 1 << pin; 126 HW_PINCTRL_PULLn_CLR(bank) = 1 << pin;
119} 127}
120 128#else
121static inline void imx233_pinctrl_enable_pullup_mask(unsigned bank, uint32_t pin_msk, bool enable) 129static inline void imx233_pinctrl_enable_pullup(unsigned bank, unsigned pin, bool enable)
122{ 130{
123 if(enable) 131 (void) bank;
124 HW_PINCTRL_PULLn_SET(bank) = pin_msk; 132 (void) pin;
125 else 133 (void) enable;
126 HW_PINCTRL_PULLn_CLR(bank) = pin_msk;
127} 134}
135#endif
128 136
129/** On irq, the pin irq interrupt is disable and then cb is called; 137/** On irq, the pin irq interrupt is disable and then cb is called;
130 * the setup_pin_irq function needs to be called again to enable it again */ 138 * the setup_pin_irq function needs to be called again to enable it again */
@@ -158,6 +166,14 @@ static inline void imx233_pinctrl_setup_vpin(vpin_t vpin, const char *name,
158 imx233_pinctrl_enable_pullup(bank, pin, pullup); 166 imx233_pinctrl_enable_pullup(bank, pin, pullup);
159} 167}
160 168
169#if IMX233_SUBTARGET < 3700
170#include "pins/pins-stmp3600.h"
171#elif IMX233_SUBTARGET < 3770
172#include "pins/pins-stmp3700.h"
173#elif IMX233_SUBTARGET < 3780
174#error implement this
175#else
161#include "pins/pins-imx233.h" 176#include "pins/pins-imx233.h"
177#endif
162 178
163#endif /* __PINCTRL_IMX233_H__ */ 179#endif /* __PINCTRL_IMX233_H__ */
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c
index 612ec39fb9..ad0dd16ff3 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c
@@ -79,7 +79,7 @@ bool button_debug_screen(void)
79 lcd_putsf(0, 1, "RMI: id=%s p=%x s=%x", product_id, func_presence, sensor_prop); 79 lcd_putsf(0, 1, "RMI: id=%s p=%x s=%x", product_id, func_presence, sensor_prop);
80 lcd_putsf(0, 2, "xmax=%d ymax=%d res=%d", x_max, y_max, sensor_resol); 80 lcd_putsf(0, 2, "xmax=%d ymax=%d res=%d", x_max, y_max, sensor_resol);
81 lcd_putsf(0, 3, "attn=%d ctl=%x int=%x", 81 lcd_putsf(0, 3, "attn=%d ctl=%x int=%x",
82 imx233_pinctrl_get_gpio_mask(0, 0x08000000) ? 0 : 1, 82 imx233_pinctrl_get_gpio(0, 27) ? 0 : 1,
83 rmi_read_single(RMI_DEVICE_CONTROL), 83 rmi_read_single(RMI_DEVICE_CONTROL),
84 rmi_read_single(RMI_INTERRUPT_REQUEST)); 84 rmi_read_single(RMI_INTERRUPT_REQUEST));
85 lcd_putsf(0, 4, "sensi: %d min_dist: %d", (int)sensitivity.value, min_dist); 85 lcd_putsf(0, 4, "sensi: %d min_dist: %d", (int)sensitivity.value, min_dist);
@@ -356,7 +356,7 @@ int touchpad_read_device(void)
356int button_read_device(void) 356int button_read_device(void)
357{ 357{
358 int res = 0; 358 int res = 0;
359 if(!imx233_pinctrl_get_gpio_mask(1, 0x40000000)) 359 if(!imx233_pinctrl_get_gpio(1, 30))
360 res |= BUTTON_VOL_DOWN; 360 res |= BUTTON_VOL_DOWN;
361 /* The imx233 uses the voltage on the PSWITCH pin to detect power up/down 361 /* The imx233 uses the voltage on the PSWITCH pin to detect power up/down
362 * events as well as recovery mode. Since the power button is the power button 362 * events as well as recovery mode. Since the power button is the power button
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 ba62ebf59c..15e061103f 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c
@@ -58,12 +58,12 @@ static void i2c_sda_out(bool high)
58 58
59static bool i2c_scl_in(void) 59static bool i2c_scl_in(void)
60{ 60{
61 return imx233_pinctrl_get_gpio_mask(1, 1 << 22); 61 return imx233_pinctrl_get_gpio(1, 22);
62} 62}
63 63
64static bool i2c_sda_in(void) 64static bool i2c_sda_in(void)
65{ 65{
66 return imx233_pinctrl_get_gpio_mask(1, 1 << 24); 66 return imx233_pinctrl_get_gpio(1, 24);
67} 67}
68 68
69static void i2c_delay(int d) 69static void i2c_delay(int d)
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c
index a99260f105..3fd63de623 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c
@@ -73,7 +73,7 @@ static void setup_lcd_pins(bool use_lcdif)
73 imx233_pinctrl_acquire(1, 21, "lcd cs"); 73 imx233_pinctrl_acquire(1, 21, "lcd cs");
74 imx233_pinctrl_acquire(1, 23, "lcd enable"); 74 imx233_pinctrl_acquire(1, 23, "lcd enable");
75 imx233_pinctrl_acquire(1, 25, "lcd vsync"); 75 imx233_pinctrl_acquire(1, 25, "lcd vsync");
76 imx233_pinctrl_acquire_mask(1, 0x3ffff, "lcd data"); 76 //imx233_pinctrl_acquire_mask(1, 0x3ffff, "lcd data");
77 if(use_lcdif) 77 if(use_lcdif)
78 { 78 {
79 imx233_pinctrl_set_function(1, 25, PINCTRL_FUNCTION_GPIO); /* lcd_vsync */ 79 imx233_pinctrl_set_function(1, 25, PINCTRL_FUNCTION_GPIO); /* lcd_vsync */
@@ -113,10 +113,10 @@ static void setup_lcd_pins_i80(bool i80)
113 imx233_pinctrl_set_function(1, 21, PINCTRL_FUNCTION_GPIO); /* lcd_cs */ 113 imx233_pinctrl_set_function(1, 21, PINCTRL_FUNCTION_GPIO); /* lcd_cs */
114 imx233_pinctrl_set_function(1, 23, PINCTRL_FUNCTION_GPIO); /* lcd_enable */ 114 imx233_pinctrl_set_function(1, 23, PINCTRL_FUNCTION_GPIO); /* lcd_enable */
115 /* lcd_{rs,wr,cs,enable} */ 115 /* lcd_{rs,wr,cs,enable} */
116 imx233_pinctrl_enable_gpio_mask(1, (1 << 19) | (1 << 20) | (1 << 21) | (1 << 23), true); 116 HW_PINCTRL_DOEn_SET(1) = (1 << 19) | (1 << 20) | (1 << 21) | (1 << 23);
117 imx233_pinctrl_set_gpio_mask(1, (1 << 19) | (1 << 20) | (1 << 21) | (1 << 23), true); 117 HW_PINCTRL_DOUTn_SET(1) = (1 << 19) | (1 << 20) | (1 << 21) | (1 << 23);
118 118
119 imx233_pinctrl_enable_gpio_mask(1, 0x3ffff, false); /* lcd_d{0-17} */ 119 HW_PINCTRL_DOEn_CLR(1) = 0x3ffff; /* lcd_d{0-17} */
120 HW_PINCTRL_MUXSELn_SET(2) = 0xffffffff; /* lcd_d{0-15} as GPIO */ 120 HW_PINCTRL_MUXSELn_SET(2) = 0xffffffff; /* lcd_d{0-15} as GPIO */
121 imx233_pinctrl_set_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */ 121 imx233_pinctrl_set_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */
122 imx233_pinctrl_set_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */ 122 imx233_pinctrl_set_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */
@@ -125,7 +125,8 @@ static void setup_lcd_pins_i80(bool i80)
125 } 125 }
126 else 126 else
127 { 127 {
128 imx233_pinctrl_set_gpio_mask(1, (1 << 19) | (1 << 20) | (1 << 21) | (1 << 23), true); 128 HW_PINCTRL_DOUTn_SET(1) = (1 << 19) | (1 << 20) | (1 << 21) | (1 << 23);
129
129 imx233_pinctrl_set_drive(1, 19, PINCTRL_DRIVE_4mA); /* lcd_rs */ 130 imx233_pinctrl_set_drive(1, 19, PINCTRL_DRIVE_4mA); /* lcd_rs */
130 imx233_pinctrl_set_drive(1, 20, PINCTRL_DRIVE_4mA); /* lcd_wr */ 131 imx233_pinctrl_set_drive(1, 20, PINCTRL_DRIVE_4mA); /* lcd_wr */
131 imx233_pinctrl_set_drive(1, 21, PINCTRL_DRIVE_4mA); /* lcd_cs */ 132 imx233_pinctrl_set_drive(1, 21, PINCTRL_DRIVE_4mA); /* lcd_cs */
@@ -133,7 +134,7 @@ static void setup_lcd_pins_i80(bool i80)
133 imx233_pinctrl_set_function(1, 19, PINCTRL_FUNCTION_MAIN); /* lcd_rs */ 134 imx233_pinctrl_set_function(1, 19, PINCTRL_FUNCTION_MAIN); /* lcd_rs */
134 imx233_pinctrl_set_function(1, 20, PINCTRL_FUNCTION_MAIN); /* lcd_wr */ 135 imx233_pinctrl_set_function(1, 20, PINCTRL_FUNCTION_MAIN); /* lcd_wr */
135 imx233_pinctrl_set_function(1, 21, PINCTRL_FUNCTION_MAIN); /* lcd_cs */ 136 imx233_pinctrl_set_function(1, 21, PINCTRL_FUNCTION_MAIN); /* lcd_cs */
136 imx233_pinctrl_enable_gpio_mask(1, 0x3ffff, false); /* lcd_d{0-17} */ 137 HW_PINCTRL_DOEn_CLR(1) = 0x3ffff; /* lcd_d{0-17} */
137 HW_PINCTRL_MUXSELn_CLR(2) = 0xffffffff; /* lcd_d{0-15} as lcd_d{0-15} */ 138 HW_PINCTRL_MUXSELn_CLR(2) = 0xffffffff; /* lcd_d{0-15} as lcd_d{0-15} */
138 imx233_pinctrl_set_function(1, 16, PINCTRL_FUNCTION_MAIN); /* lcd_d16 */ 139 imx233_pinctrl_set_function(1, 16, PINCTRL_FUNCTION_MAIN); /* lcd_d16 */
139 imx233_pinctrl_set_function(1, 17, PINCTRL_FUNCTION_MAIN); /* lcd_d17 */ 140 imx233_pinctrl_set_function(1, 17, PINCTRL_FUNCTION_MAIN); /* lcd_d17 */
@@ -182,7 +183,7 @@ static uint32_t i80_read_register(uint32_t data_out)
182 imx233_pinctrl_set_gpio(1, 19, true); /* lcd_rs */ 183 imx233_pinctrl_set_gpio(1, 19, true); /* lcd_rs */
183 imx233_pinctrl_set_gpio(1, 23, true); /* lcd_enable */ 184 imx233_pinctrl_set_gpio(1, 23, true); /* lcd_enable */
184 imx233_pinctrl_set_gpio(1, 20, true); /* lcd_wr */ 185 imx233_pinctrl_set_gpio(1, 20, true); /* lcd_wr */
185 imx233_pinctrl_enable_gpio_mask(1, 0x3ffff, true); /* lcd_d{0-17} */ 186 HW_PINCTRL_DOEn_SET(1) = 0x3ffff; /* lcd_d{0-17} */
186 udelay(2); 187 udelay(2);
187 imx233_pinctrl_set_gpio(1, 19, false); /* lcd_rs */ 188 imx233_pinctrl_set_gpio(1, 19, false); /* lcd_rs */
188 udelay(1); 189 udelay(1);
@@ -190,11 +191,11 @@ static uint32_t i80_read_register(uint32_t data_out)
190 udelay(1); 191 udelay(1);
191 imx233_pinctrl_set_gpio(1, 20, false); /* lcd_wr */ 192 imx233_pinctrl_set_gpio(1, 20, false); /* lcd_wr */
192 udelay(1); 193 udelay(1);
193 imx233_pinctrl_set_gpio_mask(1, data_out & 0x3ffff, true); /* lcd_d{0-17} */ 194 HW_PINCTRL_DOUTn_SET(1) = data_out & 0x3ffff; /* lcd_d{0-17} */
194 udelay(1); 195 udelay(1);
195 imx233_pinctrl_set_gpio(1, 20, true); /* lcd_wr */ 196 imx233_pinctrl_set_gpio(1, 20, true); /* lcd_wr */
196 udelay(3); 197 udelay(3);
197 imx233_pinctrl_enable_gpio_mask(1, 0x3ffff, false); /* lcd_d{0-17} */ 198 HW_PINCTRL_DOUTn_CLR(1) = 0x3ffff; /* lcd_d{0-17} */
198 udelay(2); 199 udelay(2);
199 imx233_pinctrl_set_gpio(1, 23, false); /* lcd_enable */ 200 imx233_pinctrl_set_gpio(1, 23, false); /* lcd_enable */
200 udelay(1); 201 udelay(1);
@@ -204,7 +205,7 @@ static uint32_t i80_read_register(uint32_t data_out)
204 udelay(3); 205 udelay(3);
205 imx233_pinctrl_set_gpio(1, 23, false); /* lcd_enable */ 206 imx233_pinctrl_set_gpio(1, 23, false); /* lcd_enable */
206 udelay(2); 207 udelay(2);
207 uint32_t data_in = imx233_pinctrl_get_gpio_mask(1, 0x3ffff); /* lcd_d{0-17} */ 208 uint32_t data_in = HW_PINCTRL_DINn(1) & 0x3ffff; /* lcd_d{0-17} */
208 udelay(1); 209 udelay(1);
209 imx233_pinctrl_set_gpio(1, 23, true); /* lcd_enable */ 210 imx233_pinctrl_set_gpio(1, 23, true); /* lcd_enable */
210 udelay(1); 211 udelay(1);