Lines Matching +full:one +full:- +full:wire

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2005-2008 Freescale Semiconductor, Inc. All Rights Reserved.
22 # define MXC_W1_CONTROL_WR(x) BIT(5 - (x))
37 * reset the device on the One Wire interface
45 writeb(MXC_W1_CONTROL_RPP, dev->regs + MXC_W1_CONTROL); in mxc_w1_ds2_reset_bus()
53 u8 ctrl = readb(dev->regs + MXC_W1_CONTROL); in mxc_w1_ds2_reset_bus()
55 /* PST bit is valid after the RPP bit is self-cleared */ in mxc_w1_ds2_reset_bus()
64 * this is the low level routine to read/write a bit on the One Wire
73 writeb(MXC_W1_CONTROL_WR(bit), dev->regs + MXC_W1_CONTROL); in mxc_w1_ds2_touch_bit()
81 u8 ctrl = readb(dev->regs + MXC_W1_CONTROL); in mxc_w1_ds2_touch_bit()
83 /* RDST bit is valid after the WR1/RD bit is self-cleared */ in mxc_w1_ds2_touch_bit()
98 mdev = devm_kzalloc(&pdev->dev, sizeof(struct mxc_w1_device), in mxc_w1_probe()
101 return -ENOMEM; in mxc_w1_probe()
103 mdev->clk = devm_clk_get(&pdev->dev, NULL); in mxc_w1_probe()
104 if (IS_ERR(mdev->clk)) in mxc_w1_probe()
105 return PTR_ERR(mdev->clk); in mxc_w1_probe()
107 err = clk_prepare_enable(mdev->clk); in mxc_w1_probe()
111 clkrate = clk_get_rate(mdev->clk); in mxc_w1_probe()
113 dev_warn(&pdev->dev, in mxc_w1_probe()
119 dev_warn(&pdev->dev, in mxc_w1_probe()
122 mdev->regs = devm_platform_ioremap_resource(pdev, 0); in mxc_w1_probe()
123 if (IS_ERR(mdev->regs)) { in mxc_w1_probe()
124 err = PTR_ERR(mdev->regs); in mxc_w1_probe()
128 /* Software reset 1-Wire module */ in mxc_w1_probe()
129 writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET); in mxc_w1_probe()
130 writeb(0, mdev->regs + MXC_W1_RESET); in mxc_w1_probe()
132 writeb(clkdiv - 1, mdev->regs + MXC_W1_TIME_DIVIDER); in mxc_w1_probe()
134 mdev->bus_master.data = mdev; in mxc_w1_probe()
135 mdev->bus_master.reset_bus = mxc_w1_ds2_reset_bus; in mxc_w1_probe()
136 mdev->bus_master.touch_bit = mxc_w1_ds2_touch_bit; in mxc_w1_probe()
140 err = w1_add_master_device(&mdev->bus_master); in mxc_w1_probe()
147 clk_disable_unprepare(mdev->clk); in mxc_w1_probe()
158 w1_remove_master_device(&mdev->bus_master); in mxc_w1_remove()
160 clk_disable_unprepare(mdev->clk); in mxc_w1_remove()
164 { .compatible = "fsl,imx21-owire" },
181 MODULE_DESCRIPTION("Driver for One-Wire on MXC");