Searched refs:mcam (Results 1 - 6 of 6) sorted by relevance

/linux-4.4.14/drivers/media/platform/marvell-ccic/
H A DMakefile2 cafe_ccic-y := cafe-driver.o mcam-core.o
5 mmp_camera-y := mmp-driver.o mcam-core.o
H A Dmmp-driver.c31 #include "mcam-core.h"
42 struct mcam_camera mcam; member in struct:mmp_camera
48 static inline struct mmp_camera *mcam_to_cam(struct mcam_camera *mcam) mcam_to_cam() argument
50 return container_of(mcam, struct mmp_camera, mcam); mcam_to_cam()
110 static void mcam_clk_enable(struct mcam_camera *mcam) mcam_clk_enable() argument
115 if (!IS_ERR(mcam->clk[i])) mcam_clk_enable()
116 clk_prepare_enable(mcam->clk[i]); mcam_clk_enable()
120 static void mcam_clk_disable(struct mcam_camera *mcam) mcam_clk_disable() argument
125 if (!IS_ERR(mcam->clk[i])) mcam_clk_disable()
126 clk_disable_unprepare(mcam->clk[i]); mcam_clk_disable()
140 static int mmpcam_power_up(struct mcam_camera *mcam) mmpcam_power_up() argument
142 struct mmp_camera *cam = mcam_to_cam(mcam); mmpcam_power_up()
152 mcam_reg_write(mcam, REG_CLKCTRL, 0x60000002); mmpcam_power_up()
156 mcam_reg_clear_bit(mcam, REG_CTRL1, 0x10000000); mmpcam_power_up()
162 mcam_clk_enable(mcam); mmpcam_power_up()
167 static void mmpcam_power_down(struct mcam_camera *mcam) mmpcam_power_down() argument
169 struct mmp_camera *cam = mcam_to_cam(mcam); mmpcam_power_down()
183 mcam_clk_disable(mcam); mmpcam_power_down()
186 void mcam_ctlr_reset(struct mcam_camera *mcam) mcam_ctlr_reset() argument
189 struct mmp_camera *cam = mcam_to_cam(mcam); mcam_ctlr_reset()
191 if (mcam->ccic_id) { mcam_ctlr_reset()
217 void mmpcam_calc_dphy(struct mcam_camera *mcam) mmpcam_calc_dphy() argument
219 struct mmp_camera *cam = mcam_to_cam(mcam); mmpcam_calc_dphy()
307 struct mcam_camera *mcam = data; mmpcam_irq() local
310 spin_lock(&mcam->dev_lock); mmpcam_irq()
311 irqs = mcam_reg_read(mcam, REG_IRQSTAT); mmpcam_irq()
312 handled = mccic_irq(mcam, irqs); mmpcam_irq()
313 spin_unlock(&mcam->dev_lock); mmpcam_irq()
317 static void mcam_init_clk(struct mcam_camera *mcam) mcam_init_clk() argument
326 mcam->clk[i] = devm_clk_get(mcam->dev, mcam_clks[i]); mcam_init_clk()
327 if (IS_ERR(mcam->clk[i])) mcam_init_clk()
328 dev_warn(mcam->dev, "Could not get clk: %s\n", mcam_init_clk()
337 struct mcam_camera *mcam; mmpcam_probe() local
352 mcam = &cam->mcam; mmpcam_probe()
353 mcam->plat_power_up = mmpcam_power_up; mmpcam_probe()
354 mcam->plat_power_down = mmpcam_power_down; mmpcam_probe()
355 mcam->ctlr_reset = mcam_ctlr_reset; mmpcam_probe()
356 mcam->calc_dphy = mmpcam_calc_dphy; mmpcam_probe()
357 mcam->dev = &pdev->dev; mmpcam_probe()
358 mcam->use_smbus = 0; mmpcam_probe()
359 mcam->ccic_id = pdev->id; mmpcam_probe()
360 mcam->mclk_min = pdata->mclk_min; mmpcam_probe()
361 mcam->mclk_src = pdata->mclk_src; mmpcam_probe()
362 mcam->mclk_div = pdata->mclk_div; mmpcam_probe()
363 mcam->bus_type = pdata->bus_type; mmpcam_probe()
364 mcam->dphy = pdata->dphy; mmpcam_probe()
365 if (mcam->bus_type == V4L2_MBUS_CSI2) { mmpcam_probe()
366 cam->mipi_clk = devm_clk_get(mcam->dev, "mipi"); mmpcam_probe()
367 if ((IS_ERR(cam->mipi_clk) && mcam->dphy[2] == 0)) mmpcam_probe()
370 mcam->mipi_enabled = false; mmpcam_probe()
371 mcam->lane = pdata->lane; mmpcam_probe()
372 mcam->chip_id = MCAM_ARMADA610; mmpcam_probe()
373 mcam->buffer_mode = B_DMA_sg; mmpcam_probe()
374 strlcpy(mcam->bus_info, "platform:mmp-camera", sizeof(mcam->bus_info)); mmpcam_probe()
375 spin_lock_init(&mcam->dev_lock); mmpcam_probe()
380 mcam->regs = devm_ioremap_resource(&pdev->dev, res); mmpcam_probe()
381 if (IS_ERR(mcam->regs)) mmpcam_probe()
382 return PTR_ERR(mcam->regs); mmpcam_probe()
383 mcam->regs_size = resource_size(res); mmpcam_probe()
396 mcam->i2c_adapter = platform_get_drvdata(pdata->i2c_device); mmpcam_probe()
397 if (mcam->i2c_adapter == NULL) { mmpcam_probe()
421 mcam_init_clk(mcam); mmpcam_probe()
426 ret = mmpcam_power_up(mcam); mmpcam_probe()
429 ret = mccic_register(mcam); mmpcam_probe()
443 "mmp-camera", mcam); mmpcam_probe()
450 mccic_shutdown(mcam); mmpcam_probe()
452 mmpcam_power_down(mcam); mmpcam_probe()
459 struct mcam_camera *mcam = &cam->mcam; mmpcam_remove() local
462 mccic_shutdown(mcam); mmpcam_remove()
463 mmpcam_power_down(mcam); mmpcam_remove()
487 mccic_suspend(&cam->mcam); mmpcam_suspend()
501 return mccic_resume(&cam->mcam); mmpcam_resume()
H A Dcafe-driver.c35 #include "mcam-core.h"
53 struct mcam_camera mcam; member in struct:cafe_camera
59 * Most of the camera controller registers are defined in mcam-core.h,
147 return container_of(m, struct cafe_camera, mcam); to_cam()
151 static int cafe_smbus_write_done(struct mcam_camera *mcam) cafe_smbus_write_done() argument
162 spin_lock_irqsave(&mcam->dev_lock, flags); cafe_smbus_write_done()
163 c1 = mcam_reg_read(mcam, REG_TWSIC1); cafe_smbus_write_done()
164 spin_unlock_irqrestore(&mcam->dev_lock, flags); cafe_smbus_write_done()
173 struct mcam_camera *mcam = &cam->mcam; cafe_smbus_write_data() local
175 spin_lock_irqsave(&mcam->dev_lock, flags); cafe_smbus_write_data()
182 mcam_reg_write(mcam, REG_TWSIC0, rval); cafe_smbus_write_data()
183 (void) mcam_reg_read(mcam, REG_TWSIC1); /* force write */ cafe_smbus_write_data()
185 mcam_reg_write(mcam, REG_TWSIC1, rval); cafe_smbus_write_data()
186 spin_unlock_irqrestore(&mcam->dev_lock, flags); cafe_smbus_write_data()
206 wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(mcam), cafe_smbus_write_data()
209 spin_lock_irqsave(&mcam->dev_lock, flags); cafe_smbus_write_data()
210 rval = mcam_reg_read(mcam, REG_TWSIC1); cafe_smbus_write_data()
211 spin_unlock_irqrestore(&mcam->dev_lock, flags); cafe_smbus_write_data()
228 static int cafe_smbus_read_done(struct mcam_camera *mcam) cafe_smbus_read_done() argument
239 spin_lock_irqsave(&mcam->dev_lock, flags); cafe_smbus_read_done()
240 c1 = mcam_reg_read(mcam, REG_TWSIC1); cafe_smbus_read_done()
241 spin_unlock_irqrestore(&mcam->dev_lock, flags); cafe_smbus_read_done()
252 struct mcam_camera *mcam = &cam->mcam; cafe_smbus_read_data() local
254 spin_lock_irqsave(&mcam->dev_lock, flags); cafe_smbus_read_data()
261 mcam_reg_write(mcam, REG_TWSIC0, rval); cafe_smbus_read_data()
262 (void) mcam_reg_read(mcam, REG_TWSIC1); /* force write */ cafe_smbus_read_data()
264 mcam_reg_write(mcam, REG_TWSIC1, rval); cafe_smbus_read_data()
265 spin_unlock_irqrestore(&mcam->dev_lock, flags); cafe_smbus_read_data()
268 cafe_smbus_read_done(mcam), CAFE_SMBUS_TIMEOUT); cafe_smbus_read_data()
269 spin_lock_irqsave(&mcam->dev_lock, flags); cafe_smbus_read_data()
270 rval = mcam_reg_read(mcam, REG_TWSIC1); cafe_smbus_read_data()
271 spin_unlock_irqrestore(&mcam->dev_lock, flags); cafe_smbus_read_data()
318 spin_lock_irqsave(&cam->mcam.dev_lock, flags); cafe_smbus_enable_irq()
319 mcam_reg_set_bit(&cam->mcam, REG_IRQMASK, TWSIIRQS); cafe_smbus_enable_irq()
320 spin_unlock_irqrestore(&cam->mcam.dev_lock, flags); cafe_smbus_enable_irq()
354 cam->mcam.i2c_adapter = adap; cafe_smbus_setup()
361 i2c_del_adapter(cam->mcam.i2c_adapter); cafe_smbus_shutdown()
362 kfree(cam->mcam.i2c_adapter); cafe_smbus_shutdown()
370 static void cafe_ctlr_init(struct mcam_camera *mcam) cafe_ctlr_init() argument
374 spin_lock_irqsave(&mcam->dev_lock, flags); cafe_ctlr_init()
378 mcam_reg_write(mcam, 0x3038, 0x8); cafe_ctlr_init()
379 mcam_reg_write(mcam, 0x315c, 0x80008); cafe_ctlr_init()
386 mcam_reg_write(mcam, REG_GL_CSR, GCSR_SRS|GCSR_MRS); /* Needed? */ cafe_ctlr_init()
387 mcam_reg_write(mcam, REG_GL_CSR, GCSR_SRC|GCSR_MRC); cafe_ctlr_init()
388 mcam_reg_write(mcam, REG_GL_CSR, GCSR_SRC|GCSR_MRS); cafe_ctlr_init()
392 spin_unlock_irqrestore(&mcam->dev_lock, flags); cafe_ctlr_init()
394 spin_lock_irqsave(&mcam->dev_lock, flags); cafe_ctlr_init()
396 mcam_reg_write(mcam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); cafe_ctlr_init()
397 mcam_reg_set_bit(mcam, REG_GL_IMASK, GIMSK_CCIC_EN); cafe_ctlr_init()
401 mcam_reg_write(mcam, REG_IRQMASK, 0); cafe_ctlr_init()
402 spin_unlock_irqrestore(&mcam->dev_lock, flags); cafe_ctlr_init()
406 static int cafe_ctlr_power_up(struct mcam_camera *mcam) cafe_ctlr_power_up() argument
412 mcam_reg_write(mcam, REG_GL_FCR, GFCR_GPIO_ON); cafe_ctlr_power_up()
413 mcam_reg_write(mcam, REG_GL_GPIOR, GGPIO_OUT|GGPIO_VAL); cafe_ctlr_power_up()
419 mcam_reg_write(mcam, REG_GPR, GPR_C1EN|GPR_C0EN); /* pwr up, reset */ cafe_ctlr_power_up()
420 mcam_reg_write(mcam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0); cafe_ctlr_power_up()
425 static void cafe_ctlr_power_down(struct mcam_camera *mcam) cafe_ctlr_power_down() argument
427 mcam_reg_write(mcam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1); cafe_ctlr_power_down()
428 mcam_reg_write(mcam, REG_GL_FCR, GFCR_GPIO_ON); cafe_ctlr_power_down()
429 mcam_reg_write(mcam, REG_GL_GPIOR, GGPIO_OUT); cafe_ctlr_power_down()
440 struct mcam_camera *mcam = &cam->mcam; cafe_irq() local
443 spin_lock(&mcam->dev_lock); cafe_irq()
444 irqs = mcam_reg_read(mcam, REG_IRQSTAT); cafe_irq()
445 handled = cam->registered && mccic_irq(mcam, irqs); cafe_irq()
447 mcam_reg_write(mcam, REG_IRQSTAT, TWSIIRQS); cafe_irq()
451 spin_unlock(&mcam->dev_lock); cafe_irq()
466 struct mcam_camera *mcam; cafe_pci_probe() local
476 mcam = &cam->mcam; cafe_pci_probe()
477 mcam->chip_id = MCAM_CAFE; cafe_pci_probe()
478 spin_lock_init(&mcam->dev_lock); cafe_pci_probe()
480 mcam->plat_power_up = cafe_ctlr_power_up; cafe_pci_probe()
481 mcam->plat_power_down = cafe_ctlr_power_down; cafe_pci_probe()
482 mcam->dev = &pdev->dev; cafe_pci_probe()
483 snprintf(mcam->bus_info, sizeof(mcam->bus_info), "PCI:%s", pci_name(pdev)); cafe_pci_probe()
488 mcam->clock_speed = 45; cafe_pci_probe()
489 mcam->use_smbus = 1; cafe_pci_probe()
495 mcam->buffer_mode = B_vmalloc; cafe_pci_probe()
505 mcam->regs = pci_iomap(pdev, 0, 0); cafe_pci_probe()
506 if (!mcam->regs) { cafe_pci_probe()
510 mcam->regs_size = pci_resource_len(pdev, 0); cafe_pci_probe()
519 cafe_ctlr_init(mcam); cafe_pci_probe()
520 cafe_ctlr_power_up(mcam); cafe_pci_probe()
530 ret = mccic_register(mcam); cafe_pci_probe()
538 cafe_ctlr_power_down(mcam); cafe_pci_probe()
541 pci_iounmap(pdev, mcam->regs); cafe_pci_probe()
556 mccic_shutdown(&cam->mcam); cafe_shutdown()
559 pci_iounmap(cam->pdev, cam->mcam.regs); cafe_shutdown()
590 mccic_suspend(&cam->mcam); cafe_pci_suspend()
609 cafe_ctlr_init(&cam->mcam); cafe_pci_resume()
610 return mccic_resume(&cam->mcam); cafe_pci_resume()
H A Dmcam-core.c33 #include "mcam-core.h"
291 static void mcam_enable_mipi(struct mcam_camera *mcam) mcam_enable_mipi() argument
294 cam_dbg(mcam, "camera: DPHY3=0x%x, DPHY5=0x%x, DPHY6=0x%x\n", mcam_enable_mipi()
295 mcam->dphy[0], mcam->dphy[1], mcam->dphy[2]); mcam_enable_mipi()
296 mcam_reg_write(mcam, REG_CSI2_DPHY3, mcam->dphy[0]); mcam_enable_mipi()
297 mcam_reg_write(mcam, REG_CSI2_DPHY5, mcam->dphy[1]); mcam_enable_mipi()
298 mcam_reg_write(mcam, REG_CSI2_DPHY6, mcam->dphy[2]); mcam_enable_mipi()
300 if (!mcam->mipi_enabled) { mcam_enable_mipi()
301 if (mcam->lane > 4 || mcam->lane <= 0) { mcam_enable_mipi()
302 cam_warn(mcam, "lane number error\n"); mcam_enable_mipi()
303 mcam->lane = 1; /* set the default value */ mcam_enable_mipi()
311 mcam_reg_write(mcam, REG_CSI2_CTRL0, mcam_enable_mipi()
312 CSI2_C0_MIPI_EN | CSI2_C0_ACT_LANE(mcam->lane)); mcam_enable_mipi()
313 mcam_reg_write(mcam, REG_CLKCTRL, mcam_enable_mipi()
314 (mcam->mclk_src << 29) | mcam->mclk_div); mcam_enable_mipi()
316 mcam->mipi_enabled = true; mcam_enable_mipi()
320 static void mcam_disable_mipi(struct mcam_camera *mcam) mcam_disable_mipi() argument
323 mcam_reg_write(mcam, REG_CSI2_CTRL0, 0x0); mcam_disable_mipi()
324 mcam_reg_write(mcam, REG_CSI2_DPHY3, 0x0); mcam_disable_mipi()
325 mcam_reg_write(mcam, REG_CSI2_DPHY5, 0x0); mcam_disable_mipi()
326 mcam_reg_write(mcam, REG_CSI2_DPHY6, 0x0); mcam_disable_mipi()
327 mcam->mipi_enabled = false; mcam_disable_mipi()
1672 .name = "mcam",
H A Dmcam-core.h142 * Everything below here is private to the mcam core and
/linux-4.4.14/drivers/net/ethernet/brocade/bna/
H A Dbna_enet.c1956 /* Virtual memory for Multicast MAC address - stored by mcam module */ bna_mod_res_req()
1964 /* Virtual memory for Multicast handle - stored by mcam module */ bna_mod_res_req()

Completed in 285 milliseconds