ds1wm_data 116 drivers/w1/masters/ds1wm.c static inline void ds1wm_write_register(struct ds1wm_data *ds1wm_data, u32 reg, ds1wm_data 119 drivers/w1/masters/ds1wm.c if (ds1wm_data->is_hw_big_endian) { ds1wm_data 120 drivers/w1/masters/ds1wm.c switch (ds1wm_data->bus_shift) { ds1wm_data 122 drivers/w1/masters/ds1wm.c iowrite8(val, ds1wm_data->map + (reg << 0)); ds1wm_data 125 drivers/w1/masters/ds1wm.c iowrite16be((u16)val, ds1wm_data->map + (reg << 1)); ds1wm_data 128 drivers/w1/masters/ds1wm.c iowrite32be((u32)val, ds1wm_data->map + (reg << 2)); ds1wm_data 132 drivers/w1/masters/ds1wm.c switch (ds1wm_data->bus_shift) { ds1wm_data 134 drivers/w1/masters/ds1wm.c iowrite8(val, ds1wm_data->map + (reg << 0)); ds1wm_data 137 drivers/w1/masters/ds1wm.c iowrite16((u16)val, ds1wm_data->map + (reg << 1)); ds1wm_data 140 drivers/w1/masters/ds1wm.c iowrite32((u32)val, ds1wm_data->map + (reg << 2)); ds1wm_data 146 drivers/w1/masters/ds1wm.c static inline u8 ds1wm_read_register(struct ds1wm_data *ds1wm_data, u32 reg) ds1wm_data 150 drivers/w1/masters/ds1wm.c if (ds1wm_data->is_hw_big_endian) { ds1wm_data 151 drivers/w1/masters/ds1wm.c switch (ds1wm_data->bus_shift) { ds1wm_data 153 drivers/w1/masters/ds1wm.c val = ioread8(ds1wm_data->map + (reg << 0)); ds1wm_data 156 drivers/w1/masters/ds1wm.c val = ioread16be(ds1wm_data->map + (reg << 1)); ds1wm_data 159 drivers/w1/masters/ds1wm.c val = ioread32be(ds1wm_data->map + (reg << 2)); ds1wm_data 163 drivers/w1/masters/ds1wm.c switch (ds1wm_data->bus_shift) { ds1wm_data 165 drivers/w1/masters/ds1wm.c val = ioread8(ds1wm_data->map + (reg << 0)); ds1wm_data 168 drivers/w1/masters/ds1wm.c val = ioread16(ds1wm_data->map + (reg << 1)); ds1wm_data 171 drivers/w1/masters/ds1wm.c val = ioread32(ds1wm_data->map + (reg << 2)); ds1wm_data 175 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 183 drivers/w1/masters/ds1wm.c struct ds1wm_data *ds1wm_data = data; ds1wm_data 185 drivers/w1/masters/ds1wm.c u8 inten = ds1wm_read_register(ds1wm_data, DS1WM_INT_EN); ds1wm_data 191 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, ds1wm_data 192 drivers/w1/masters/ds1wm.c DS1WM_INT_EN, ds1wm_data->int_en_reg_none); ds1wm_data 195 drivers/w1/masters/ds1wm.c intr = ds1wm_read_register(ds1wm_data, DS1WM_INT); ds1wm_data 197 drivers/w1/masters/ds1wm.c ds1wm_data->slave_present = (intr & DS1WM_INT_PDR) ? 0 : 1; ds1wm_data 199 drivers/w1/masters/ds1wm.c if ((intr & DS1WM_INT_TSRE) && ds1wm_data->write_complete) { ds1wm_data 201 drivers/w1/masters/ds1wm.c complete(ds1wm_data->write_complete); ds1wm_data 205 drivers/w1/masters/ds1wm.c ds1wm_data->read_byte = ds1wm_read_register(ds1wm_data, ds1wm_data 208 drivers/w1/masters/ds1wm.c if (ds1wm_data->read_complete) ds1wm_data 209 drivers/w1/masters/ds1wm.c complete(ds1wm_data->read_complete); ds1wm_data 211 drivers/w1/masters/ds1wm.c if ((intr & DS1WM_INT_PD) && ds1wm_data->reset_complete) { ds1wm_data 213 drivers/w1/masters/ds1wm.c complete(ds1wm_data->reset_complete); ds1wm_data 216 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_INT_EN, inten); ds1wm_data 220 drivers/w1/masters/ds1wm.c static int ds1wm_reset(struct ds1wm_data *ds1wm_data) ds1wm_data 225 drivers/w1/masters/ds1wm.c ds1wm_data->reset_complete = &reset_done; ds1wm_data 228 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_INT_EN, DS1WM_INTEN_EPD | ds1wm_data 229 drivers/w1/masters/ds1wm.c ds1wm_data->int_en_reg_none); ds1wm_data 231 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_CMD, DS1WM_CMD_1W_RESET); ds1wm_data 234 drivers/w1/masters/ds1wm.c ds1wm_data->reset_complete = NULL; ds1wm_data 236 drivers/w1/masters/ds1wm.c dev_err(&ds1wm_data->pdev->dev, "reset failed, timed out\n"); ds1wm_data 240 drivers/w1/masters/ds1wm.c if (!ds1wm_data->slave_present) { ds1wm_data 241 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, "reset: no devices found\n"); ds1wm_data 245 drivers/w1/masters/ds1wm.c if (ds1wm_data->reset_recover_delay) ds1wm_data 246 drivers/w1/masters/ds1wm.c msleep(ds1wm_data->reset_recover_delay); ds1wm_data 251 drivers/w1/masters/ds1wm.c static int ds1wm_write(struct ds1wm_data *ds1wm_data, u8 data) ds1wm_data 255 drivers/w1/masters/ds1wm.c ds1wm_data->write_complete = &write_done; ds1wm_data 257 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_INT_EN, ds1wm_data 258 drivers/w1/masters/ds1wm.c ds1wm_data->int_en_reg_none | DS1WM_INTEN_ETMT); ds1wm_data 260 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_DATA, data); ds1wm_data 264 drivers/w1/masters/ds1wm.c ds1wm_data->write_complete = NULL; ds1wm_data 266 drivers/w1/masters/ds1wm.c dev_err(&ds1wm_data->pdev->dev, "write failed, timed out\n"); ds1wm_data 273 drivers/w1/masters/ds1wm.c static u8 ds1wm_read(struct ds1wm_data *ds1wm_data, unsigned char write_data) ds1wm_data 276 drivers/w1/masters/ds1wm.c u8 intEnable = DS1WM_INTEN_ERBF | ds1wm_data->int_en_reg_none; ds1wm_data 279 drivers/w1/masters/ds1wm.c ds1wm_read_register(ds1wm_data, DS1WM_DATA); ds1wm_data 281 drivers/w1/masters/ds1wm.c ds1wm_data->read_complete = &read_done; ds1wm_data 282 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_INT_EN, intEnable); ds1wm_data 284 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_DATA, write_data); ds1wm_data 287 drivers/w1/masters/ds1wm.c ds1wm_data->read_complete = NULL; ds1wm_data 289 drivers/w1/masters/ds1wm.c dev_err(&ds1wm_data->pdev->dev, "read failed, timed out\n"); ds1wm_data 290 drivers/w1/masters/ds1wm.c ds1wm_data->read_error = -ETIMEDOUT; ds1wm_data 293 drivers/w1/masters/ds1wm.c ds1wm_data->read_error = 0; ds1wm_data 294 drivers/w1/masters/ds1wm.c return ds1wm_data->read_byte; ds1wm_data 308 drivers/w1/masters/ds1wm.c static void ds1wm_up(struct ds1wm_data *ds1wm_data) ds1wm_data 311 drivers/w1/masters/ds1wm.c struct device *dev = &ds1wm_data->pdev->dev; ds1wm_data 314 drivers/w1/masters/ds1wm.c if (ds1wm_data->cell->enable) ds1wm_data 315 drivers/w1/masters/ds1wm.c ds1wm_data->cell->enable(ds1wm_data->pdev); ds1wm_data 325 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_CLKDIV, divisor); ds1wm_data 330 drivers/w1/masters/ds1wm.c ds1wm_reset(ds1wm_data); ds1wm_data 333 drivers/w1/masters/ds1wm.c static void ds1wm_down(struct ds1wm_data *ds1wm_data) ds1wm_data 335 drivers/w1/masters/ds1wm.c ds1wm_reset(ds1wm_data); ds1wm_data 338 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_INT_EN, ds1wm_data 339 drivers/w1/masters/ds1wm.c ds1wm_data->int_en_reg_none); ds1wm_data 341 drivers/w1/masters/ds1wm.c if (ds1wm_data->cell->disable) ds1wm_data 342 drivers/w1/masters/ds1wm.c ds1wm_data->cell->disable(ds1wm_data->pdev); ds1wm_data 350 drivers/w1/masters/ds1wm.c struct ds1wm_data *ds1wm_data = data; ds1wm_data 352 drivers/w1/masters/ds1wm.c return ds1wm_read(ds1wm_data, 0xff); ds1wm_data 357 drivers/w1/masters/ds1wm.c struct ds1wm_data *ds1wm_data = data; ds1wm_data 359 drivers/w1/masters/ds1wm.c ds1wm_write(ds1wm_data, byte); ds1wm_data 364 drivers/w1/masters/ds1wm.c struct ds1wm_data *ds1wm_data = data; ds1wm_data 366 drivers/w1/masters/ds1wm.c ds1wm_reset(ds1wm_data); ds1wm_data 374 drivers/w1/masters/ds1wm.c struct ds1wm_data *ds1wm_data = data; ds1wm_data 382 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, "search begin\n"); ds1wm_data 386 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 392 drivers/w1/masters/ds1wm.c if (ds1wm_reset(ds1wm_data)) { ds1wm_data 394 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 399 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 401 drivers/w1/masters/ds1wm.c ds1wm_write(ds1wm_data, search_type); ds1wm_data 402 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 404 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_CMD, DS1WM_CMD_SRA); ds1wm_data 405 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 423 drivers/w1/masters/ds1wm.c resp = ds1wm_read(ds1wm_data, _r); ds1wm_data 425 drivers/w1/masters/ds1wm.c if (ds1wm_data->read_error) { ds1wm_data 426 drivers/w1/masters/ds1wm.c dev_err(&ds1wm_data->pdev->dev, ds1wm_data 445 drivers/w1/masters/ds1wm.c if (ds1wm_data->read_error) { ds1wm_data 447 drivers/w1/masters/ds1wm.c dev_err(&ds1wm_data->pdev->dev, ds1wm_data 451 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 454 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 456 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, DS1WM_CMD, ~DS1WM_CMD_SRA); ds1wm_data 457 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 459 drivers/w1/masters/ds1wm.c ds1wm_reset(ds1wm_data); ds1wm_data 462 drivers/w1/masters/ds1wm.c dev_err(&ds1wm_data->pdev->dev, ds1wm_data 468 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 472 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 481 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 492 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 508 drivers/w1/masters/ds1wm.c struct ds1wm_data *ds1wm_data; ds1wm_data 517 drivers/w1/masters/ds1wm.c ds1wm_data = devm_kzalloc(&pdev->dev, sizeof(*ds1wm_data), GFP_KERNEL); ds1wm_data 518 drivers/w1/masters/ds1wm.c if (!ds1wm_data) ds1wm_data 521 drivers/w1/masters/ds1wm.c platform_set_drvdata(pdev, ds1wm_data); ds1wm_data 526 drivers/w1/masters/ds1wm.c ds1wm_data->map = devm_ioremap(&pdev->dev, res->start, ds1wm_data 528 drivers/w1/masters/ds1wm.c if (!ds1wm_data->map) ds1wm_data 531 drivers/w1/masters/ds1wm.c ds1wm_data->pdev = pdev; ds1wm_data 532 drivers/w1/masters/ds1wm.c ds1wm_data->cell = mfd_get_cell(pdev); ds1wm_data 533 drivers/w1/masters/ds1wm.c if (!ds1wm_data->cell) ds1wm_data 541 drivers/w1/masters/ds1wm.c dev_err(&ds1wm_data->pdev->dev, ds1wm_data 543 drivers/w1/masters/ds1wm.c ds1wm_data->bus_shift); ds1wm_data 547 drivers/w1/masters/ds1wm.c ds1wm_data->bus_shift = plat->bus_shift; ds1wm_data 549 drivers/w1/masters/ds1wm.c if ((8 << ds1wm_data->bus_shift) > resource_size(res)) { ds1wm_data 550 drivers/w1/masters/ds1wm.c dev_err(&ds1wm_data->pdev->dev, ds1wm_data 553 drivers/w1/masters/ds1wm.c 8 << ds1wm_data->bus_shift); ds1wm_data 557 drivers/w1/masters/ds1wm.c ds1wm_data->is_hw_big_endian = plat->is_hw_big_endian; ds1wm_data 562 drivers/w1/masters/ds1wm.c ds1wm_data->irq = res->start; ds1wm_data 563 drivers/w1/masters/ds1wm.c ds1wm_data->int_en_reg_none = (plat->active_high ? DS1WM_INTEN_IAS : 0); ds1wm_data 564 drivers/w1/masters/ds1wm.c ds1wm_data->reset_recover_delay = plat->reset_recover_delay; ds1wm_data 567 drivers/w1/masters/ds1wm.c inten = ds1wm_read_register(ds1wm_data, DS1WM_INT_EN); ds1wm_data 568 drivers/w1/masters/ds1wm.c ds1wm_write_register(ds1wm_data, ds1wm_data 569 drivers/w1/masters/ds1wm.c DS1WM_INT_EN, ds1wm_data->int_en_reg_none); ds1wm_data 572 drivers/w1/masters/ds1wm.c irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_RISING); ds1wm_data 574 drivers/w1/masters/ds1wm.c irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_FALLING); ds1wm_data 576 drivers/w1/masters/ds1wm.c irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_LEVEL_HIGH); ds1wm_data 578 drivers/w1/masters/ds1wm.c irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_LEVEL_LOW); ds1wm_data 580 drivers/w1/masters/ds1wm.c ret = devm_request_irq(&pdev->dev, ds1wm_data->irq, ds1wm_isr, ds1wm_data 581 drivers/w1/masters/ds1wm.c IRQF_SHARED, "ds1wm", ds1wm_data); ds1wm_data 583 drivers/w1/masters/ds1wm.c dev_err(&ds1wm_data->pdev->dev, ds1wm_data 585 drivers/w1/masters/ds1wm.c ds1wm_data->irq, ds1wm_data 591 drivers/w1/masters/ds1wm.c ds1wm_up(ds1wm_data); ds1wm_data 593 drivers/w1/masters/ds1wm.c ds1wm_master.data = (void *)ds1wm_data; ds1wm_data 599 drivers/w1/masters/ds1wm.c dev_dbg(&ds1wm_data->pdev->dev, ds1wm_data 604 drivers/w1/masters/ds1wm.c ds1wm_data->bus_shift, ds1wm_data 605 drivers/w1/masters/ds1wm.c ds1wm_data->is_hw_big_endian); ds1wm_data 609 drivers/w1/masters/ds1wm.c ds1wm_down(ds1wm_data); ds1wm_data 617 drivers/w1/masters/ds1wm.c struct ds1wm_data *ds1wm_data = platform_get_drvdata(pdev); ds1wm_data 619 drivers/w1/masters/ds1wm.c ds1wm_down(ds1wm_data); ds1wm_data 626 drivers/w1/masters/ds1wm.c struct ds1wm_data *ds1wm_data = platform_get_drvdata(pdev); ds1wm_data 628 drivers/w1/masters/ds1wm.c ds1wm_up(ds1wm_data); ds1wm_data 639 drivers/w1/masters/ds1wm.c struct ds1wm_data *ds1wm_data = platform_get_drvdata(pdev); ds1wm_data 642 drivers/w1/masters/ds1wm.c ds1wm_down(ds1wm_data);