Lines Matching refs:mdev
101 struct mxc_w1_device *mdev; in mxc_w1_probe() local
107 mdev = devm_kzalloc(&pdev->dev, sizeof(struct mxc_w1_device), in mxc_w1_probe()
109 if (!mdev) in mxc_w1_probe()
112 mdev->clk = devm_clk_get(&pdev->dev, NULL); in mxc_w1_probe()
113 if (IS_ERR(mdev->clk)) in mxc_w1_probe()
114 return PTR_ERR(mdev->clk); in mxc_w1_probe()
116 clkrate = clk_get_rate(mdev->clk); in mxc_w1_probe()
128 mdev->regs = devm_ioremap_resource(&pdev->dev, res); in mxc_w1_probe()
129 if (IS_ERR(mdev->regs)) in mxc_w1_probe()
130 return PTR_ERR(mdev->regs); in mxc_w1_probe()
132 err = clk_prepare_enable(mdev->clk); in mxc_w1_probe()
137 writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET); in mxc_w1_probe()
138 writeb(0, mdev->regs + MXC_W1_RESET); in mxc_w1_probe()
140 writeb(clkdiv - 1, mdev->regs + MXC_W1_TIME_DIVIDER); in mxc_w1_probe()
142 mdev->bus_master.data = mdev; in mxc_w1_probe()
143 mdev->bus_master.reset_bus = mxc_w1_ds2_reset_bus; in mxc_w1_probe()
144 mdev->bus_master.touch_bit = mxc_w1_ds2_touch_bit; in mxc_w1_probe()
146 platform_set_drvdata(pdev, mdev); in mxc_w1_probe()
148 err = w1_add_master_device(&mdev->bus_master); in mxc_w1_probe()
150 clk_disable_unprepare(mdev->clk); in mxc_w1_probe()
160 struct mxc_w1_device *mdev = platform_get_drvdata(pdev); in mxc_w1_remove() local
162 w1_remove_master_device(&mdev->bus_master); in mxc_w1_remove()
164 clk_disable_unprepare(mdev->clk); in mxc_w1_remove()