summaryrefslogtreecommitdiff
path: root/utils/hwstub/tools/lua/stmp/pinctrl.lua
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-10-22 00:24:32 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-10-22 00:34:44 +0200
commit9ed980785429db35f51f8d324cc75c23f2e5fb20 (patch)
treeaa5362c4eea139c22b606b685e2ab29a19908d0d /utils/hwstub/tools/lua/stmp/pinctrl.lua
parentbfb67f41a9e9df3b730d34041be6b4f4a4983c5b (diff)
downloadrockbox-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.lua34
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) ")
86hh:add("* muxsel: same values as STMP.pinctrl.pin().muxsel (optional)") 86hh:add("* muxsel: same values as STMP.pinctrl.pin().muxsel (optional)")
87hh:add("* enable: enable/disable output (optional)") 87hh:add("* enable: enable/disable output (optional)")
88hh:add("* output: set/clear output (optional)") 88hh:add("* output: set/clear output (optional)")
89hh:add("* pull: enable/disable pullup (optional)")
89hh:add("All non-subtable entries are ignored") 90hh:add("All non-subtable entries are ignored")
90hh:add("All unknown parameters in subtablkes are ignored") 91hh:add("All unknown parameters in subtablkes are ignored")
91hh:add("") 92hh: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
293end 298end
299
300STMP.pinctrl.i2c = {}
301
302local hhh = hh:create_topic("setup")
303hhh:add("The STMP.pinctrl.i2c.setup() functions configure the I2C pins.")
304
305function 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)
327end