Lines Matching refs:mdev
40 #define MBOX_BASE(mdev, inst) ((mdev)->base + ((inst) * 4)) argument
85 struct sti_mbox_device *mdev; member
93 struct sti_mbox_device *mdev = chan_info->mdev; in sti_mbox_channel_is_enabled() local
97 return mdev->enabled[instance] & BIT(channel); in sti_mbox_channel_is_enabled()
126 struct sti_mbox_device *mdev = chan_info->mdev; in sti_mbox_enable_channel() local
130 void __iomem *base = MBOX_BASE(mdev, instance); in sti_mbox_enable_channel()
132 spin_lock_irqsave(&mdev->lock, flags); in sti_mbox_enable_channel()
133 mdev->enabled[instance] |= BIT(channel); in sti_mbox_enable_channel()
135 spin_unlock_irqrestore(&mdev->lock, flags); in sti_mbox_enable_channel()
141 struct sti_mbox_device *mdev = chan_info->mdev; in sti_mbox_disable_channel() local
145 void __iomem *base = MBOX_BASE(mdev, instance); in sti_mbox_disable_channel()
147 spin_lock_irqsave(&mdev->lock, flags); in sti_mbox_disable_channel()
148 mdev->enabled[instance] &= ~BIT(channel); in sti_mbox_disable_channel()
150 spin_unlock_irqrestore(&mdev->lock, flags); in sti_mbox_disable_channel()
156 struct sti_mbox_device *mdev = chan_info->mdev; in sti_mbox_clear_irq() local
159 void __iomem *base = MBOX_BASE(mdev, instance); in sti_mbox_clear_irq()
164 static struct mbox_chan *sti_mbox_irq_to_channel(struct sti_mbox_device *mdev, in sti_mbox_irq_to_channel() argument
167 struct mbox_controller *mbox = mdev->mbox; in sti_mbox_irq_to_channel()
171 void __iomem *base = MBOX_BASE(mdev, instance); in sti_mbox_irq_to_channel()
197 struct sti_mbox_device *mdev = data; in sti_mbox_thread_handler() local
198 struct sti_mbox_pdata *pdata = dev_get_platdata(mdev->dev); in sti_mbox_thread_handler()
204 chan = sti_mbox_irq_to_channel(mdev, instance); in sti_mbox_thread_handler()
219 struct sti_mbox_device *mdev = data; in sti_mbox_irq_handler() local
220 struct sti_mbox_pdata *pdata = dev_get_platdata(mdev->dev); in sti_mbox_irq_handler()
227 chan = sti_mbox_irq_to_channel(mdev, instance); in sti_mbox_irq_handler()
233 dev_warn(mdev->dev, in sti_mbox_irq_handler()
236 mdev->name, chan_info->instance, in sti_mbox_irq_handler()
237 chan_info->channel, mdev->enabled[instance]); in sti_mbox_irq_handler()
250 dev_err(mdev->dev, "Spurious IRQ - was a channel requested?\n"); in sti_mbox_irq_handler()
258 struct sti_mbox_device *mdev = chan_info->mdev; in sti_mbox_tx_is_ready() local
261 void __iomem *base = MBOX_BASE(mdev, instance); in sti_mbox_tx_is_ready()
264 dev_dbg(mdev->dev, "Mbox: %s: inst: %d, chan: %d disabled\n", in sti_mbox_tx_is_ready()
265 mdev->name, instance, channel); in sti_mbox_tx_is_ready()
270 dev_dbg(mdev->dev, "Mbox: %s: inst: %d, chan: %d not ready\n", in sti_mbox_tx_is_ready()
271 mdev->name, instance, channel); in sti_mbox_tx_is_ready()
281 struct sti_mbox_device *mdev = chan_info->mdev; in sti_mbox_send_data() local
284 void __iomem *base = MBOX_BASE(mdev, instance); in sti_mbox_send_data()
289 dev_dbg(mdev->dev, in sti_mbox_send_data()
291 mdev->name, instance, channel); in sti_mbox_send_data()
307 struct mbox_controller *mbox = chan_info->mdev->mbox; in sti_mbox_shutdown_chan()
328 struct sti_mbox_device *mdev = dev_get_drvdata(mbox->dev); in sti_mbox_xlate() local
329 struct sti_mbox_pdata *pdata = dev_get_platdata(mdev->dev); in sti_mbox_xlate()
349 mbox->dev == chan_info->mdev->dev && in sti_mbox_xlate()
374 chan_info->mdev = mdev; in sti_mbox_xlate()
382 mdev->name, instance, channel); in sti_mbox_xlate()
411 struct sti_mbox_device *mdev; in sti_mbox_probe() local
425 mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL); in sti_mbox_probe()
426 if (!mdev) in sti_mbox_probe()
429 platform_set_drvdata(pdev, mdev); in sti_mbox_probe()
432 mdev->base = devm_ioremap_resource(&pdev->dev, res); in sti_mbox_probe()
433 if (!mdev->base) in sti_mbox_probe()
436 ret = of_property_read_string(np, "mbox-name", &mdev->name); in sti_mbox_probe()
438 mdev->name = np->full_name; in sti_mbox_probe()
449 mdev->dev = &pdev->dev; in sti_mbox_probe()
450 mdev->mbox = mbox; in sti_mbox_probe()
452 spin_lock_init(&mdev->lock); in sti_mbox_probe()
459 mbox->dev = mdev->dev; in sti_mbox_probe()
472 "%s: Registered Tx only Mailbox\n", mdev->name); in sti_mbox_probe()
479 IRQF_ONESHOT, mdev->name, mdev); in sti_mbox_probe()
486 dev_info(&pdev->dev, "%s: Registered Tx/Rx Mailbox\n", mdev->name); in sti_mbox_probe()
493 struct sti_mbox_device *mdev = platform_get_drvdata(pdev); in sti_mbox_remove() local
495 mbox_controller_unregister(mdev->mbox); in sti_mbox_remove()