• Home
  • Raw
  • Download

Lines Matching refs:bus

92 	int (*open)(struct pmac_i2c_bus *bus);
93 void (*close)(struct pmac_i2c_bus *bus);
94 int (*xfer)(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
383 static int kw_i2c_open(struct pmac_i2c_bus *bus) in kw_i2c_open() argument
385 struct pmac_i2c_host_kw *host = bus->hostdata; in kw_i2c_open()
390 static void kw_i2c_close(struct pmac_i2c_bus *bus) in kw_i2c_close() argument
392 struct pmac_i2c_host_kw *host = bus->hostdata; in kw_i2c_close()
396 static int kw_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, in kw_i2c_xfer() argument
399 struct pmac_i2c_host_kw *host = bus->hostdata; in kw_i2c_xfer()
401 int use_irq = host->irq && !bus->polled; in kw_i2c_xfer()
404 switch(bus->mode) { in kw_i2c_xfer()
426 kw_write_reg(reg_mode, mode_reg | (bus->channel << 4)); in kw_i2c_xfer()
445 host->polled = bus->polled; in kw_i2c_xfer()
569 struct pmac_i2c_bus *bus; in kw_i2c_add() local
571 bus = kzalloc(sizeof(struct pmac_i2c_bus), GFP_KERNEL); in kw_i2c_add()
572 if (bus == NULL) in kw_i2c_add()
575 bus->controller = of_node_get(controller); in kw_i2c_add()
576 bus->busnode = of_node_get(busnode); in kw_i2c_add()
577 bus->type = pmac_i2c_bus_keywest; in kw_i2c_add()
578 bus->hostdata = host; in kw_i2c_add()
579 bus->channel = channel; in kw_i2c_add()
580 bus->mode = pmac_i2c_mode_std; in kw_i2c_add()
581 bus->open = kw_i2c_open; in kw_i2c_add()
582 bus->close = kw_i2c_close; in kw_i2c_add()
583 bus->xfer = kw_i2c_xfer; in kw_i2c_add()
584 mutex_init(&bus->mutex); in kw_i2c_add()
585 lockdep_register_key(&bus->lock_key); in kw_i2c_add()
586 lockdep_set_class(&bus->mutex, &bus->lock_key); in kw_i2c_add()
588 bus->flags = pmac_i2c_multibus; in kw_i2c_add()
589 list_add(&bus->link, &pmac_i2c_busses); in kw_i2c_add()
657 u8 bus; member
672 static int pmu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, in pmu_i2c_xfer() argument
675 struct adb_request *req = bus->hostdata; in pmu_i2c_xfer()
690 hdr->bus = bus->channel; in pmu_i2c_xfer()
693 switch(bus->mode) { in pmu_i2c_xfer()
707 if (bus->mode == pmac_i2c_mode_stdsub) in pmu_i2c_xfer()
745 hdr->bus = PMU_I2C_BUS_STATUS; in pmu_i2c_xfer()
778 struct pmac_i2c_bus *bus; in pmu_i2c_probe() local
802 bus = kzalloc(sz, GFP_KERNEL); in pmu_i2c_probe()
803 if (bus == NULL) in pmu_i2c_probe()
806 bus->controller = busnode; in pmu_i2c_probe()
807 bus->busnode = busnode; in pmu_i2c_probe()
808 bus->type = pmac_i2c_bus_pmu; in pmu_i2c_probe()
809 bus->channel = channel; in pmu_i2c_probe()
810 bus->mode = pmac_i2c_mode_std; in pmu_i2c_probe()
811 bus->hostdata = bus + 1; in pmu_i2c_probe()
812 bus->xfer = pmu_i2c_xfer; in pmu_i2c_probe()
813 mutex_init(&bus->mutex); in pmu_i2c_probe()
814 lockdep_register_key(&bus->lock_key); in pmu_i2c_probe()
815 lockdep_set_class(&bus->mutex, &bus->lock_key); in pmu_i2c_probe()
816 bus->flags = pmac_i2c_multibus; in pmu_i2c_probe()
817 list_add(&bus->link, &pmac_i2c_busses); in pmu_i2c_probe()
839 static int smu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, in smu_i2c_xfer() argument
842 struct smu_i2c_cmd *cmd = bus->hostdata; in smu_i2c_xfer()
852 cmd->info.bus = bus->channel; in smu_i2c_xfer()
856 switch(bus->mode) { in smu_i2c_xfer()
870 if (bus->mode == pmac_i2c_mode_stdsub) in smu_i2c_xfer()
898 struct pmac_i2c_bus *bus; in smu_i2c_probe() local
926 bus = kzalloc(sz, GFP_KERNEL); in smu_i2c_probe()
927 if (bus == NULL) in smu_i2c_probe()
930 bus->controller = controller; in smu_i2c_probe()
931 bus->busnode = of_node_get(busnode); in smu_i2c_probe()
932 bus->type = pmac_i2c_bus_smu; in smu_i2c_probe()
933 bus->channel = *reg; in smu_i2c_probe()
934 bus->mode = pmac_i2c_mode_std; in smu_i2c_probe()
935 bus->hostdata = bus + 1; in smu_i2c_probe()
936 bus->xfer = smu_i2c_xfer; in smu_i2c_probe()
937 mutex_init(&bus->mutex); in smu_i2c_probe()
938 lockdep_register_key(&bus->lock_key); in smu_i2c_probe()
939 lockdep_set_class(&bus->mutex, &bus->lock_key); in smu_i2c_probe()
940 bus->flags = 0; in smu_i2c_probe()
941 list_add(&bus->link, &pmac_i2c_busses); in smu_i2c_probe()
944 bus->channel, busnode); in smu_i2c_probe()
961 struct pmac_i2c_bus *bus; in pmac_i2c_find_bus() local
964 list_for_each_entry(bus, &pmac_i2c_busses, link) { in pmac_i2c_find_bus()
965 if (p == bus->busnode) { in pmac_i2c_find_bus()
966 if (prev && bus->flags & pmac_i2c_multibus) { in pmac_i2c_find_bus()
972 if (((*reg) >> 8) != bus->channel) in pmac_i2c_find_bus()
977 return bus; in pmac_i2c_find_bus()
999 struct device_node *pmac_i2c_get_controller(struct pmac_i2c_bus *bus) in pmac_i2c_get_controller() argument
1001 return bus->controller; in pmac_i2c_get_controller()
1005 struct device_node *pmac_i2c_get_bus_node(struct pmac_i2c_bus *bus) in pmac_i2c_get_bus_node() argument
1007 return bus->busnode; in pmac_i2c_get_bus_node()
1011 int pmac_i2c_get_type(struct pmac_i2c_bus *bus) in pmac_i2c_get_type() argument
1013 return bus->type; in pmac_i2c_get_type()
1017 int pmac_i2c_get_flags(struct pmac_i2c_bus *bus) in pmac_i2c_get_flags() argument
1019 return bus->flags; in pmac_i2c_get_flags()
1023 int pmac_i2c_get_channel(struct pmac_i2c_bus *bus) in pmac_i2c_get_channel() argument
1025 return bus->channel; in pmac_i2c_get_channel()
1030 struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus) in pmac_i2c_get_adapter() argument
1032 return &bus->adapter; in pmac_i2c_get_adapter()
1038 struct pmac_i2c_bus *bus; in pmac_i2c_adapter_to_bus() local
1040 list_for_each_entry(bus, &pmac_i2c_busses, link) in pmac_i2c_adapter_to_bus()
1041 if (&bus->adapter == adapter) in pmac_i2c_adapter_to_bus()
1042 return bus; in pmac_i2c_adapter_to_bus()
1049 struct pmac_i2c_bus *bus = pmac_i2c_find_bus(dev); in pmac_i2c_match_adapter() local
1051 if (bus == NULL) in pmac_i2c_match_adapter()
1053 return (&bus->adapter == adapter); in pmac_i2c_match_adapter()
1059 struct pmac_i2c_bus *bus, *found = NULL; in pmac_low_i2c_lock() local
1061 list_for_each_entry(bus, &pmac_i2c_busses, link) { in pmac_low_i2c_lock()
1062 if (np == bus->controller) { in pmac_low_i2c_lock()
1063 found = bus; in pmac_low_i2c_lock()
1069 return pmac_i2c_open(bus, 0); in pmac_low_i2c_lock()
1075 struct pmac_i2c_bus *bus, *found = NULL; in pmac_low_i2c_unlock() local
1077 list_for_each_entry(bus, &pmac_i2c_busses, link) { in pmac_low_i2c_unlock()
1078 if (np == bus->controller) { in pmac_low_i2c_unlock()
1079 found = bus; in pmac_low_i2c_unlock()
1085 pmac_i2c_close(bus); in pmac_low_i2c_unlock()
1091 int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled) in pmac_i2c_open() argument
1095 mutex_lock(&bus->mutex); in pmac_i2c_open()
1096 bus->polled = polled || pmac_i2c_force_poll; in pmac_i2c_open()
1097 bus->opened = 1; in pmac_i2c_open()
1098 bus->mode = pmac_i2c_mode_std; in pmac_i2c_open()
1099 if (bus->open && (rc = bus->open(bus)) != 0) { in pmac_i2c_open()
1100 bus->opened = 0; in pmac_i2c_open()
1101 mutex_unlock(&bus->mutex); in pmac_i2c_open()
1108 void pmac_i2c_close(struct pmac_i2c_bus *bus) in pmac_i2c_close() argument
1110 WARN_ON(!bus->opened); in pmac_i2c_close()
1111 if (bus->close) in pmac_i2c_close()
1112 bus->close(bus); in pmac_i2c_close()
1113 bus->opened = 0; in pmac_i2c_close()
1114 mutex_unlock(&bus->mutex); in pmac_i2c_close()
1118 int pmac_i2c_setmode(struct pmac_i2c_bus *bus, int mode) in pmac_i2c_setmode() argument
1120 WARN_ON(!bus->opened); in pmac_i2c_setmode()
1127 " bus %pOF !\n", mode, bus->busnode); in pmac_i2c_setmode()
1130 bus->mode = mode; in pmac_i2c_setmode()
1136 int pmac_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, in pmac_i2c_xfer() argument
1141 WARN_ON(!bus->opened); in pmac_i2c_xfer()
1144 " %d bytes, bus %pOF\n", bus->channel, addrdir, bus->mode, subsize, in pmac_i2c_xfer()
1145 subaddr, len, bus->busnode); in pmac_i2c_xfer()
1147 rc = bus->xfer(bus, addrdir, subsize, subaddr, data, len); in pmac_i2c_xfer()
1166 struct pmac_i2c_bus *bus; in pmac_i2c_devscan() local
1197 list_for_each_entry(bus, &pmac_i2c_busses, link) { in pmac_i2c_devscan()
1198 for_each_child_of_node(bus->busnode, np) { in pmac_i2c_devscan()
1201 if (bus->flags & pmac_i2c_multibus) in pmac_i2c_devscan()
1202 if (bus != pmac_i2c_find_bus(np)) in pmac_i2c_devscan()
1223 struct pmac_i2c_bus *bus; member
1234 struct pmac_i2c_bus *bus; in pmac_i2c_do_begin() local
1236 bus = pmac_i2c_find_bus(func->node); in pmac_i2c_do_begin()
1237 if (bus == NULL) { in pmac_i2c_do_begin()
1242 if (pmac_i2c_open(bus, 0)) { in pmac_i2c_do_begin()
1255 pmac_i2c_close(bus); in pmac_i2c_do_begin()
1258 inst->bus = bus; in pmac_i2c_do_begin()
1270 pmac_i2c_close(inst->bus); in pmac_i2c_do_end()
1279 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_read, 0, 0, in pmac_i2c_do_read()
1287 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 0, 0, in pmac_i2c_do_write()
1324 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 0, 0, in pmac_i2c_do_rmw()
1333 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_read, 1, subaddr, in pmac_i2c_do_read_sub()
1342 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 1, in pmac_i2c_do_write_sub()
1350 return pmac_i2c_setmode(inst->bus, mode); in pmac_i2c_do_set_mode()
1365 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 1, in pmac_i2c_do_rmw_sub()
1488 struct pmac_i2c_bus *bus; in pmac_i2c_create_platform_devices() local
1498 list_for_each_entry(bus, &pmac_i2c_busses, link) { in pmac_i2c_create_platform_devices()
1499 bus->platform_dev = in pmac_i2c_create_platform_devices()
1501 if (bus->platform_dev == NULL) in pmac_i2c_create_platform_devices()
1503 bus->platform_dev->dev.platform_data = bus; in pmac_i2c_create_platform_devices()
1504 bus->platform_dev->dev.of_node = bus->busnode; in pmac_i2c_create_platform_devices()
1505 platform_device_add(bus->platform_dev); in pmac_i2c_create_platform_devices()