diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-22 00:24:32 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-22 00:34:44 +0200 |
commit | 9ed980785429db35f51f8d324cc75c23f2e5fb20 (patch) | |
tree | aa5362c4eea139c22b606b685e2ab29a19908d0d /utils/hwstub/tools/lua/stmp/pinctrl.lua | |
parent | bfb67f41a9e9df3b730d34041be6b4f4a4983c5b (diff) | |
download | rockbox-9ed980785429db35f51f8d324cc75c23f2e5fb20.tar.gz rockbox-9ed980785429db35f51f8d324cc75c23f2e5fb20.zip |
hwstub: rework i2c completely
Change-Id: I1e5f87f15f0ca9586d8185316ffcaeef6d9d4d38
Diffstat (limited to 'utils/hwstub/tools/lua/stmp/pinctrl.lua')
-rw-r--r-- | utils/hwstub/tools/lua/stmp/pinctrl.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/utils/hwstub/tools/lua/stmp/pinctrl.lua b/utils/hwstub/tools/lua/stmp/pinctrl.lua index 5346c75b35..013b29701e 100644 --- a/utils/hwstub/tools/lua/stmp/pinctrl.lua +++ b/utils/hwstub/tools/lua/stmp/pinctrl.lua | |||
@@ -86,6 +86,7 @@ hh:add("* pin: pin number (mandatory) ") | |||
86 | hh:add("* muxsel: same values as STMP.pinctrl.pin().muxsel (optional)") | 86 | hh:add("* muxsel: same values as STMP.pinctrl.pin().muxsel (optional)") |
87 | hh:add("* enable: enable/disable output (optional)") | 87 | hh:add("* enable: enable/disable output (optional)") |
88 | hh:add("* output: set/clear output (optional)") | 88 | hh:add("* output: set/clear output (optional)") |
89 | hh:add("* pull: enable/disable pullup (optional)") | ||
89 | hh:add("All non-subtable entries are ignored") | 90 | hh:add("All non-subtable entries are ignored") |
90 | hh:add("All unknown parameters in subtablkes are ignored") | 91 | hh:add("All unknown parameters in subtablkes are ignored") |
91 | hh:add("") | 92 | hh:add("") |
@@ -112,6 +113,10 @@ function STMP.pinctrl.configure(tbl) | |||
112 | if v.output then pin.set() | 113 | if v.output then pin.set() |
113 | else pin.clr() end | 114 | else pin.clr() end |
114 | end | 115 | end |
116 | if v.pull ~= nil then | ||
117 | STMP.debug(string.format("cfg B%dP%02d pull %s", v.bank, v.pin, v.pull)) | ||
118 | pin.pull(v.pull) | ||
119 | end | ||
115 | end | 120 | end |
116 | end | 121 | end |
117 | end | 122 | end |
@@ -291,3 +296,32 @@ function STMP.pinctrl.lcdif.setup_system(bus_width, busy) | |||
291 | STMP.pinctrl.configure_ex(busy_pin) | 296 | STMP.pinctrl.configure_ex(busy_pin) |
292 | end | 297 | end |
293 | end | 298 | end |
299 | |||
300 | STMP.pinctrl.i2c = {} | ||
301 | |||
302 | local hhh = hh:create_topic("setup") | ||
303 | hhh:add("The STMP.pinctrl.i2c.setup() functions configure the I2C pins.") | ||
304 | |||
305 | function STMP.pinctrl.i2c.setup() | ||
306 | local pins = | ||
307 | { | ||
308 | stmp3700 = | ||
309 | { | ||
310 | all = | ||
311 | { | ||
312 | i2c_scl = { bank = 2, pin = 5, muxsel = "MAIN", pull = true}, | ||
313 | i2c_sda = { bank = 2, pin = 6, muxsel = "MAIN", pull = true} | ||
314 | } | ||
315 | }, | ||
316 | imx233 = | ||
317 | { | ||
318 | all = | ||
319 | { | ||
320 | i2c_scl = { bank = 0, pin = 30, muxsel = "MAIN", pull = true}, | ||
321 | i2c_sda = { bank = 0, pin = 31, muxsel = "MAIN", pull = true} | ||
322 | } | ||
323 | } | ||
324 | } | ||
325 | |||
326 | STMP.pinctrl.configure_ex(pins) | ||
327 | end | ||