Merge tag 'dm-pull-15jan19' of git://git.denx.de/u-boot-dm
authorTom Rini <trini@konsulko.com>
Wed, 16 Jan 2019 03:05:34 +0000 (22:05 -0500)
committerTom Rini <trini@konsulko.com>
Wed, 16 Jan 2019 03:05:34 +0000 (22:05 -0500)
Fix recent changes to serial API for driver model
Buildman clang support and a few fixes
Small fixes to 'dm tree' and regmap test
Improve sandbox build compatibility
A few other minor fixes

1  2 
include/common.h
test/py/tests/test_bind.py

diff --combined include/common.h
index 18948b6bc2d28884246490e4de04ce8b631221c9,028a735a5c73089e70e2be9cf485950a43318315..2c21dee8505cf6ba0d2c3815fe1ef2362e9e60f0
@@@ -248,8 -248,7 +248,8 @@@ static inline int env_set_addr(const ch
  }
  
  #ifdef CONFIG_AUTO_COMPLETE
 -int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
 +int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf,
 +               bool dollar_comp);
  #endif
  int get_env_id (void);
  
@@@ -351,8 -350,6 +351,6 @@@ void smp_set_core_boot_addr(unsigned lo
  void smp_kick_all_cpus(void);
  
  /* $(CPU)/serial.c */
- struct serial_device_info;
  int   serial_init   (void);
  void  serial_setbrg (void);
  void  serial_putc   (const char);
@@@ -360,9 -357,6 +358,6 @@@ void       serial_putc_raw(const char)
  void  serial_puts   (const char *);
  int   serial_getc   (void);
  int   serial_tstc   (void);
- int   serial_getconfig(uint *config);
- int   serial_setconfig(uint config);
- int   serial_getinfo(struct serial_device_info *info);
  
  /* $(CPU)/speed.c */
  int   get_clocks (void);
index 6e1feb80ae0d72159d1941e24954f59e9628b30a,917839f62865d03c4e0a7d7378fa4b3e4b2e5b81..ccf6d62ea8acf23e5fac4acda029288f75609a31
@@@ -13,7 -13,8 +13,8 @@@ def in_tree(response, name, uclass, drv
        else:
                leaf = leaf + '`'
        leaf = leaf + '-- ' + name
-       line = ' *{:10.10}  [0-9]*  \[ [ +] \]   {:20.20}  {}$'.format(uclass, drv, leaf)
+       line = (' *{:10.10}   [0-9]*  \[ [ +] \]   {:20.20}  {}$'
+               .format(uclass, drv, leaf))
        prog = re.compile(line)
        for l in lines:
                if prog.match(l):
  def test_bind_unbind_with_node(u_boot_console):
  
        #bind /bind-test. Device should come up as well as its children
 -      response = u_boot_console.run_command("bind  /bind-test generic_simple_bus")
 +      response = u_boot_console.run_command('bind  /bind-test generic_simple_bus')
        assert response == ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
 -      assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
 -      assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
 +      tree = u_boot_console.run_command('dm tree')
 +      assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
 +      assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
 +      assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
  
        #Unbind child #1. No error expected and all devices should be there except for bind-test-child1
 -      response = u_boot_console.run_command("unbind  /bind-test/bind-test-child1")
 +      response = u_boot_console.run_command('unbind  /bind-test/bind-test-child1')
        assert response == ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
 -      assert "bind-test-child1" not in tree
 -      assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
 +      tree = u_boot_console.run_command('dm tree')
 +      assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
 +      assert 'bind-test-child1' not in tree
 +      assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
  
        #bind child #1. No error expected and all devices should be there
 -      response = u_boot_console.run_command("bind  /bind-test/bind-test-child1 phy_sandbox")
 +      response = u_boot_console.run_command('bind  /bind-test/bind-test-child1 phy_sandbox')
        assert response == ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
 -      assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
 -      assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, False)
 +      tree = u_boot_console.run_command('dm tree')
 +      assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
 +      assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, True)
 +      assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, False)
  
        #Unbind child #2. No error expected and all devices should be there except for bind-test-child2
 -      response = u_boot_console.run_command("unbind  /bind-test/bind-test-child2")
 +      response = u_boot_console.run_command('unbind  /bind-test/bind-test-child2')
        assert response == ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
 -      assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
 -      assert "bind-test-child2" not in tree
 +      tree = u_boot_console.run_command('dm tree')
 +      assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
 +      assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, True)
 +      assert 'bind-test-child2' not in tree
  
  
        #Bind child #2. No error expected and all devices should be there
 -      response = u_boot_console.run_command("bind /bind-test/bind-test-child2 generic_simple_bus")
 +      response = u_boot_console.run_command('bind /bind-test/bind-test-child2 generic_simple_bus')
        assert response == ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
 -      assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
 -      assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
 +      tree = u_boot_console.run_command('dm tree')
 +      assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
 +      assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
 +      assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
  
        #Unbind parent. No error expected. All devices should be removed and unbound
 -      response = u_boot_console.run_command("unbind  /bind-test")
 +      response = u_boot_console.run_command('unbind  /bind-test')
        assert response == ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert "bind-test" not in tree
 -      assert "bind-test-child1" not in tree
 -      assert "bind-test-child2" not in tree
 +      tree = u_boot_console.run_command('dm tree')
 +      assert 'bind-test' not in tree
 +      assert 'bind-test-child1' not in tree
 +      assert 'bind-test-child2' not in tree
  
        #try binding invalid node with valid driver
 -      response = u_boot_console.run_command("bind  /not-a-valid-node generic_simple_bus")
 +      response = u_boot_console.run_command('bind  /not-a-valid-node generic_simple_bus')
        assert response != ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert "not-a-valid-node" not in tree
 +      tree = u_boot_console.run_command('dm tree')
 +      assert 'not-a-valid-node' not in tree
  
        #try binding valid node with invalid driver
 -      response = u_boot_console.run_command("bind  /bind-test not_a_driver")
 +      response = u_boot_console.run_command('bind  /bind-test not_a_driver')
        assert response != ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert "bind-test" not in tree
 +      tree = u_boot_console.run_command('dm tree')
 +      assert 'bind-test' not in tree
  
        #bind /bind-test. Device should come up as well as its children
 -      response = u_boot_console.run_command("bind  /bind-test generic_simple_bus")
 +      response = u_boot_console.run_command('bind  /bind-test generic_simple_bus')
        assert response == ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
 -      assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
 -      assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
 +      tree = u_boot_console.run_command('dm tree')
 +      assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
 +      assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
 +      assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
  
 -      response = u_boot_console.run_command("unbind  /bind-test")
 +      response = u_boot_console.run_command('unbind  /bind-test')
        assert response == ''
  
  def get_next_line(tree, name):
        treelines = [x.strip() for x in tree.splitlines() if x.strip()]
 -      child_line = ""
 +      child_line = ''
        for idx, line in enumerate(treelines):
 -              if ("-- " + name) in line:
 +              if ('-- ' + name) in line:
                        try:
                                child_line = treelines[idx+1]
                        except:
  @pytest.mark.buildconfigspec('cmd_bind')
  def test_bind_unbind_with_uclass(u_boot_console):
        #bind /bind-test
 -      response = u_boot_console.run_command("bind  /bind-test generic_simple_bus")
 +      response = u_boot_console.run_command('bind  /bind-test generic_simple_bus')
        assert response == ''
  
        #make sure bind-test-child2 is there and get its uclass/index pair
 -      tree = u_boot_console.run_command("dm tree")
 -      child2_line = [x.strip() for x in tree.splitlines() if "-- bind-test-child2" in x]
 +      tree = u_boot_console.run_command('dm tree')
 +      child2_line = [x.strip() for x in tree.splitlines() if '-- bind-test-child2' in x]
        assert len(child2_line) == 1
  
        child2_uclass = child2_line[0].split()[0]
        child2_index = int(child2_line[0].split()[1])
  
        #bind generic_simple_bus as a child of bind-test-child2
 -      response = u_boot_console.run_command("bind  {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus"))
 +      response = u_boot_console.run_command('bind  {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus'))
  
        #check that the child is there and its uclass/index pair is right
 -      tree = u_boot_console.run_command("dm tree")
 +      tree = u_boot_console.run_command('dm tree')
  
 -      child_of_child2_line = get_next_line(tree, "bind-test-child2")
 +      child_of_child2_line = get_next_line(tree, 'bind-test-child2')
        assert child_of_child2_line
        child_of_child2_index = int(child_of_child2_line.split()[1])
 -      assert in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True)
 +      assert in_tree(tree, 'generic_simple_bus', 'simple_bus', 'generic_simple_bus', 2, True)
        assert child_of_child2_index == child2_index + 1
  
        #unbind the child and check it has been removed
 -      response = u_boot_console.run_command("unbind  simple_bus {}".format(child_of_child2_index))
 +      response = u_boot_console.run_command('unbind  simple_bus {}'.format(child_of_child2_index))
        assert response == ''
 -      tree = u_boot_console.run_command("dm tree")
 -      assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
 -      assert not in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True)
 -      child_of_child2_line = get_next_line(tree, "bind-test-child2")
 -      assert child_of_child2_line == ""
 +      tree = u_boot_console.run_command('dm tree')
 +      assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
 +      assert not in_tree(tree, 'generic_simple_bus', 'simple_bus', 'generic_simple_bus', 2, True)
 +      child_of_child2_line = get_next_line(tree, 'bind-test-child2')
 +      assert child_of_child2_line == ''
  
        #bind generic_simple_bus as a child of bind-test-child2
 -      response = u_boot_console.run_command("bind  {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus"))
 +      response = u_boot_console.run_command('bind  {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus'))
  
        #check that the child is there and its uclass/index pair is right
 -      tree = u_boot_console.run_command("dm tree")
 +      tree = u_boot_console.run_command('dm tree')
        treelines = [x.strip() for x in tree.splitlines() if x.strip()]
  
 -      child_of_child2_line = get_next_line(tree, "bind-test-child2")
 +      child_of_child2_line = get_next_line(tree, 'bind-test-child2')
        assert child_of_child2_line
        child_of_child2_index = int(child_of_child2_line.split()[1])
 -      assert in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True)
 +      assert in_tree(tree, 'generic_simple_bus', 'simple_bus', 'generic_simple_bus', 2, True)
        assert child_of_child2_index == child2_index + 1
  
        #unbind the child and check it has been removed
 -      response = u_boot_console.run_command("unbind  {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus"))
 +      response = u_boot_console.run_command('unbind  {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus'))
        assert response == ''
  
 -      tree = u_boot_console.run_command("dm tree")
 -      assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
 +      tree = u_boot_console.run_command('dm tree')
 +      assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
  
 -      child_of_child2_line = get_next_line(tree, "bind-test-child2")
 -      assert child_of_child2_line == ""
 +      child_of_child2_line = get_next_line(tree, 'bind-test-child2')
 +      assert child_of_child2_line == ''
  
        #unbind the child again and check it doesn't change the tree
 -      tree_old = u_boot_console.run_command("dm tree")
 -      response = u_boot_console.run_command("unbind  {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus"))
 -      tree_new = u_boot_console.run_command("dm tree")
 +      tree_old = u_boot_console.run_command('dm tree')
 +      response = u_boot_console.run_command('unbind  {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus'))
 +      tree_new = u_boot_console.run_command('dm tree')
  
        assert response == ''
        assert tree_old == tree_new
  
 -      response = u_boot_console.run_command("unbind  /bind-test")
 +      response = u_boot_console.run_command('unbind  /bind-test')
        assert response == ''