Lines Matching refs:dev
60 struct platform_device *dev; member
79 return txx9_priv->dev; in mtd_to_platdev()
82 static void __iomem *ndregaddr(struct platform_device *dev, unsigned int reg) in ndregaddr() argument
84 struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); in ndregaddr()
85 struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); in ndregaddr()
90 static u32 txx9ndfmc_read(struct platform_device *dev, unsigned int reg) in txx9ndfmc_read() argument
92 return __raw_readl(ndregaddr(dev, reg)); in txx9ndfmc_read()
95 static void txx9ndfmc_write(struct platform_device *dev, in txx9ndfmc_write() argument
98 __raw_writel(val, ndregaddr(dev, reg)); in txx9ndfmc_write()
103 struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); in txx9ndfmc_read_byte() local
105 return txx9ndfmc_read(dev, TXX9_NDFDTR); in txx9ndfmc_read_byte()
111 struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); in txx9ndfmc_write_buf() local
112 void __iomem *ndfdtr = ndregaddr(dev, TXX9_NDFDTR); in txx9ndfmc_write_buf()
113 u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); in txx9ndfmc_write_buf()
115 txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_WE, TXX9_NDFMCR); in txx9ndfmc_write_buf()
118 txx9ndfmc_write(dev, mcr, TXX9_NDFMCR); in txx9ndfmc_write_buf()
123 struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); in txx9ndfmc_read_buf() local
124 void __iomem *ndfdtr = ndregaddr(dev, TXX9_NDFDTR); in txx9ndfmc_read_buf()
134 struct platform_device *dev = txx9_priv->dev; in txx9ndfmc_cmd_ctrl() local
135 struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); in txx9ndfmc_cmd_ctrl()
138 u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); in txx9ndfmc_cmd_ctrl()
149 txx9ndfmc_write(dev, mcr, TXX9_NDFMCR); in txx9ndfmc_cmd_ctrl()
152 txx9ndfmc_write(dev, cmd & 0xff, TXX9_NDFDTR); in txx9ndfmc_cmd_ctrl()
156 txx9ndfmc_write(dev, 0, TXX9_NDFDTR); in txx9ndfmc_cmd_ctrl()
162 struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); in txx9ndfmc_dev_ready() local
164 return !(txx9ndfmc_read(dev, TXX9_NDFSR) & TXX9_NDFSR_BUSY); in txx9ndfmc_dev_ready()
170 struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); in txx9ndfmc_calculate_ecc() local
172 u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); in txx9ndfmc_calculate_ecc()
175 txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_OFF, TXX9_NDFMCR); in txx9ndfmc_calculate_ecc()
176 txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_READ, TXX9_NDFMCR); in txx9ndfmc_calculate_ecc()
178 ecc_code[1] = txx9ndfmc_read(dev, TXX9_NDFDTR); in txx9ndfmc_calculate_ecc()
179 ecc_code[0] = txx9ndfmc_read(dev, TXX9_NDFDTR); in txx9ndfmc_calculate_ecc()
180 ecc_code[2] = txx9ndfmc_read(dev, TXX9_NDFDTR); in txx9ndfmc_calculate_ecc()
183 txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_OFF, TXX9_NDFMCR); in txx9ndfmc_calculate_ecc()
210 struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); in txx9ndfmc_enable_hwecc() local
211 u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); in txx9ndfmc_enable_hwecc()
214 txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_RESET, TXX9_NDFMCR); in txx9ndfmc_enable_hwecc()
215 txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_OFF, TXX9_NDFMCR); in txx9ndfmc_enable_hwecc()
216 txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_ON, TXX9_NDFMCR); in txx9ndfmc_enable_hwecc()
219 static void txx9ndfmc_initialize(struct platform_device *dev) in txx9ndfmc_initialize() argument
221 struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); in txx9ndfmc_initialize()
222 struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); in txx9ndfmc_initialize()
229 txx9ndfmc_write(dev, in txx9ndfmc_initialize()
230 txx9ndfmc_read(dev, TXX9_NDFRSTR) | in txx9ndfmc_initialize()
233 while (txx9ndfmc_read(dev, TXX9_NDFRSTR) & TXX9_NDFRSTR_RST) { in txx9ndfmc_initialize()
235 dev_err(&dev->dev, "reset failed.\n"); in txx9ndfmc_initialize()
242 txx9ndfmc_write(dev, (drvdata->hold << 4) | drvdata->spw, TXX9_NDFSPR); in txx9ndfmc_initialize()
243 txx9ndfmc_write(dev, in txx9ndfmc_initialize()
279 static int __init txx9ndfmc_probe(struct platform_device *dev) in txx9ndfmc_probe() argument
281 struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); in txx9ndfmc_probe()
287 drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); in txx9ndfmc_probe()
290 drvdata->base = devm_platform_ioremap_resource(dev, 0); in txx9ndfmc_probe()
306 dev_info(&dev->dev, "CLK:%ldMHz HOLD:%d SPW:%d\n", in txx9ndfmc_probe()
312 platform_set_drvdata(dev, drvdata); in txx9ndfmc_probe()
313 txx9ndfmc_initialize(dev); in txx9ndfmc_probe()
328 mtd->dev.parent = &dev->dev; in txx9ndfmc_probe()
339 txx9_priv->dev = dev; in txx9ndfmc_probe()
344 dev_name(&dev->dev), i); in txx9ndfmc_probe()
347 txx9_priv->mtdname = kstrdup(dev_name(&dev->dev), in txx9ndfmc_probe()
352 dev_err(&dev->dev, "Unable to allocate MTD name.\n"); in txx9ndfmc_probe()
372 static int __exit txx9ndfmc_remove(struct platform_device *dev) in txx9ndfmc_remove() argument
374 struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); in txx9ndfmc_remove()
399 static int txx9ndfmc_resume(struct platform_device *dev) in txx9ndfmc_resume() argument
401 if (platform_get_drvdata(dev)) in txx9ndfmc_resume()
402 txx9ndfmc_initialize(dev); in txx9ndfmc_resume()