Searched refs:b47s (Results 1 - 2 of 2) sorted by relevance

/linux-4.4.14/drivers/mtd/devices/
H A Dbcm47xxsflash.c20 static void bcm47xxsflash_cmd(struct bcm47xxsflash *b47s, u32 opcode) bcm47xxsflash_cmd() argument
24 b47s->cc_write(b47s, BCMA_CC_FLASHCTL, BCMA_CC_FLASHCTL_START | opcode); bcm47xxsflash_cmd()
26 if (!(b47s->cc_read(b47s, BCMA_CC_FLASHCTL) & bcm47xxsflash_cmd()
34 static int bcm47xxsflash_poll(struct bcm47xxsflash *b47s, int timeout) bcm47xxsflash_poll() argument
39 switch (b47s->type) { bcm47xxsflash_poll()
41 bcm47xxsflash_cmd(b47s, OPCODE_ST_RDSR); bcm47xxsflash_poll()
42 if (!(b47s->cc_read(b47s, BCMA_CC_FLASHDATA) & bcm47xxsflash_poll()
47 bcm47xxsflash_cmd(b47s, OPCODE_AT_STATUS); bcm47xxsflash_poll()
48 if (b47s->cc_read(b47s, BCMA_CC_FLASHDATA) & bcm47xxsflash_poll()
69 struct bcm47xxsflash *b47s = mtd->priv; bcm47xxsflash_erase() local
72 switch (b47s->type) { bcm47xxsflash_erase()
74 bcm47xxsflash_cmd(b47s, OPCODE_ST_WREN); bcm47xxsflash_erase()
75 b47s->cc_write(b47s, BCMA_CC_FLASHADDR, erase->addr); bcm47xxsflash_erase()
80 if (b47s->blocksize < (64 * 1024)) bcm47xxsflash_erase()
81 bcm47xxsflash_cmd(b47s, OPCODE_ST_SSE); bcm47xxsflash_erase()
83 bcm47xxsflash_cmd(b47s, OPCODE_ST_SE); bcm47xxsflash_erase()
86 b47s->cc_write(b47s, BCMA_CC_FLASHADDR, erase->addr << 1); bcm47xxsflash_erase()
87 bcm47xxsflash_cmd(b47s, OPCODE_AT_PAGE_ERASE); bcm47xxsflash_erase()
91 err = bcm47xxsflash_poll(b47s, HZ); bcm47xxsflash_erase()
106 struct bcm47xxsflash *b47s = mtd->priv; bcm47xxsflash_read() local
112 memcpy_fromio(buf, (void __iomem *)KSEG0ADDR(b47s->window + from), bcm47xxsflash_read()
122 struct bcm47xxsflash *b47s = mtd->priv; bcm47xxsflash_write_st() local
126 bcm47xxsflash_cmd(b47s, OPCODE_ST_WREN); bcm47xxsflash_write_st()
129 b47s->cc_write(b47s, BCMA_CC_FLASHADDR, offset); bcm47xxsflash_write_st()
130 b47s->cc_write(b47s, BCMA_CC_FLASHDATA, *buf++); bcm47xxsflash_write_st()
133 if (b47s->bcma_cc->core->id.rev < 20) { bcm47xxsflash_write_st()
134 bcm47xxsflash_cmd(b47s, OPCODE_ST_PP); bcm47xxsflash_write_st()
139 bcm47xxsflash_cmd(b47s, OPCODE_ST_CSA | OPCODE_ST_PP); bcm47xxsflash_write_st()
149 bcm47xxsflash_cmd(b47s, OPCODE_ST_CSA | *buf++); bcm47xxsflash_write_st()
156 b47s->cc_write(b47s, BCMA_CC_FLASHCTL, 0); bcm47xxsflash_write_st()
158 if (bcm47xxsflash_poll(b47s, HZ / 10)) bcm47xxsflash_write_st()
167 struct bcm47xxsflash *b47s = mtd->priv; bcm47xxsflash_write_at() local
168 u32 mask = b47s->blocksize - 1; bcm47xxsflash_write_at()
174 if (byte || (len < b47s->blocksize)) { bcm47xxsflash_write_at()
177 b47s->cc_write(b47s, BCMA_CC_FLASHADDR, page); bcm47xxsflash_write_at()
178 bcm47xxsflash_cmd(b47s, OPCODE_AT_BUF1_LOAD); bcm47xxsflash_write_at()
180 err = bcm47xxsflash_poll(b47s, HZ / 1000); bcm47xxsflash_write_at()
190 if (byte == b47s->blocksize) bcm47xxsflash_write_at()
193 b47s->cc_write(b47s, BCMA_CC_FLASHADDR, byte++); bcm47xxsflash_write_at()
194 b47s->cc_write(b47s, BCMA_CC_FLASHDATA, *buf++); bcm47xxsflash_write_at()
195 bcm47xxsflash_cmd(b47s, OPCODE_AT_BUF1_WRITE); bcm47xxsflash_write_at()
201 b47s->cc_write(b47s, BCMA_CC_FLASHADDR, page); bcm47xxsflash_write_at()
202 bcm47xxsflash_cmd(b47s, OPCODE_AT_BUF1_PROGRAM); bcm47xxsflash_write_at()
210 struct bcm47xxsflash *b47s = mtd->priv; bcm47xxsflash_write() local
217 switch (b47s->type) { bcm47xxsflash_write()
240 static void bcm47xxsflash_fill_mtd(struct bcm47xxsflash *b47s, bcm47xxsflash_fill_mtd() argument
243 struct mtd_info *mtd = &b47s->mtd; bcm47xxsflash_fill_mtd()
245 mtd->priv = b47s; bcm47xxsflash_fill_mtd()
251 mtd->size = b47s->size; bcm47xxsflash_fill_mtd()
252 mtd->erasesize = b47s->blocksize; bcm47xxsflash_fill_mtd()
265 static int bcm47xxsflash_bcma_cc_read(struct bcm47xxsflash *b47s, u16 offset) bcm47xxsflash_bcma_cc_read() argument
267 return bcma_cc_read32(b47s->bcma_cc, offset); bcm47xxsflash_bcma_cc_read()
270 static void bcm47xxsflash_bcma_cc_write(struct bcm47xxsflash *b47s, u16 offset, bcm47xxsflash_bcma_cc_write() argument
273 bcma_cc_write32(b47s->bcma_cc, offset, value); bcm47xxsflash_bcma_cc_write()
279 struct bcm47xxsflash *b47s; bcm47xxsflash_bcma_probe() local
282 b47s = devm_kzalloc(&pdev->dev, sizeof(*b47s), GFP_KERNEL); bcm47xxsflash_bcma_probe()
283 if (!b47s) bcm47xxsflash_bcma_probe()
285 sflash->priv = b47s; bcm47xxsflash_bcma_probe()
287 b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash); bcm47xxsflash_bcma_probe()
288 b47s->cc_read = bcm47xxsflash_bcma_cc_read; bcm47xxsflash_bcma_probe()
289 b47s->cc_write = bcm47xxsflash_bcma_cc_write; bcm47xxsflash_bcma_probe()
291 switch (b47s->bcma_cc->capabilities & BCMA_CC_CAP_FLASHT) { bcm47xxsflash_bcma_probe()
293 b47s->type = BCM47XXSFLASH_TYPE_ST; bcm47xxsflash_bcma_probe()
296 b47s->type = BCM47XXSFLASH_TYPE_ATMEL; bcm47xxsflash_bcma_probe()
300 b47s->window = sflash->window; bcm47xxsflash_bcma_probe()
301 b47s->blocksize = sflash->blocksize; bcm47xxsflash_bcma_probe()
302 b47s->numblocks = sflash->numblocks; bcm47xxsflash_bcma_probe()
303 b47s->size = sflash->size; bcm47xxsflash_bcma_probe()
304 bcm47xxsflash_fill_mtd(b47s, &pdev->dev); bcm47xxsflash_bcma_probe()
306 err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0); bcm47xxsflash_bcma_probe()
312 if (bcm47xxsflash_poll(b47s, HZ / 10)) bcm47xxsflash_bcma_probe()
321 struct bcm47xxsflash *b47s = sflash->priv; bcm47xxsflash_bcma_remove() local
323 mtd_device_unregister(&b47s->mtd); bcm47xxsflash_bcma_remove()
H A Dbcm47xxsflash.h63 int (*cc_read)(struct bcm47xxsflash *b47s, u16 offset);
64 void (*cc_write)(struct bcm47xxsflash *b47s, u16 offset, u32 value);

Completed in 47 milliseconds