Lines Matching +full:lan9662 +full:- +full:otpc
1 // SPDX-License-Identifier: GPL-2.0
5 #include <linux/nvmem-provider.h>
49 void __iomem *pwrdn = OTP_OTP_PWR_DN(otp->base); in lan9662_otp_power()
53 if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), in lan9662_otp_power()
55 return -ETIMEDOUT; in lan9662_otp_power()
65 if (lan9662_otp_wait_flag_clear(OTP_OTP_CMD_GO(otp->base), in lan9662_otp_execute()
67 return -ETIMEDOUT; in lan9662_otp_execute()
69 if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), in lan9662_otp_execute()
71 return -ETIMEDOUT; in lan9662_otp_execute()
78 writel(0xff & (offset >> 8), OTP_OTP_ADDR_HI(otp->base)); in lan9662_otp_set_address()
79 writel(0xff & offset, OTP_OTP_ADDR_LO(otp->base)); in lan9662_otp_set_address()
88 writel(OTP_OTP_FUNC_CMD_OTP_READ, OTP_OTP_FUNC_CMD(otp->base)); in lan9662_otp_read_byte()
89 writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); in lan9662_otp_read_byte()
92 pass = readl(OTP_OTP_PASS_FAIL(otp->base)); in lan9662_otp_read_byte()
94 return -EACCES; in lan9662_otp_read_byte()
95 *dst = (u8) readl(OTP_OTP_RD_DATA(otp->base)); in lan9662_otp_read_byte()
106 writel(OTP_OTP_PRGM_MODE_OTP_PGM_MODE_BYTE, OTP_OTP_PRGM_MODE(otp->base)); in lan9662_otp_write_byte()
107 writel(data, OTP_OTP_PRGM_DATA(otp->base)); in lan9662_otp_write_byte()
108 writel(OTP_OTP_FUNC_CMD_OTP_PROGRAM, OTP_OTP_FUNC_CMD(otp->base)); in lan9662_otp_write_byte()
109 writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); in lan9662_otp_write_byte()
113 pass = readl(OTP_OTP_PASS_FAIL(otp->base)); in lan9662_otp_write_byte()
115 return -EACCES; in lan9662_otp_write_byte()
117 return -EIO; in lan9662_otp_write_byte()
174 .name = "lan9662-otp",
184 struct device *dev = &pdev->dev; in lan9662_otp_probe()
188 otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); in lan9662_otp_probe()
190 return -ENOMEM; in lan9662_otp_probe()
192 otp->dev = dev; in lan9662_otp_probe()
193 otp->base = devm_platform_ioremap_resource(pdev, 0); in lan9662_otp_probe()
194 if (IS_ERR(otp->base)) in lan9662_otp_probe()
195 return PTR_ERR(otp->base); in lan9662_otp_probe()
206 { .compatible = "microchip,lan9662-otpc", },
214 .name = "lan9662-otp",
221 MODULE_DESCRIPTION("lan9662 OTP driver");