1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// SPDX-License-Identifier: GPL-2.0
/*
* Driver for the NXP ISP1760 chip
*
* Copyright 2021 Linaro, Rui Miguel Silva <rui.silva@linaro.org>
*
*/
#include <common.h>
#include <dm.h>
#include <dm/device-internal.h>
#include <dm/device_compat.h>
#include <dm/devres.h>
#include <dm/lists.h>
#include <linux/bug.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/usb/otg.h>
#include <linux/usb/usb_urb_compat.h>
#include <log.h>
#include <usb.h>
#include "isp1760-core.h"
#include "isp1760-hcd.h"
#include "isp1760-regs.h"
#include "isp1760-uboot.h"
static int isp1760_msg_submit_control(struct udevice *dev,
struct usb_device *udev,
unsigned long pipe, void *buffer,
int length, struct devrequest *setup)
{
struct isp1760_host_data *host = dev_get_priv(dev);
return usb_urb_submit_control(&host->hcd, &host->urb, &host->hep, udev,
pipe, buffer, length, setup, 0,
host->host_speed);
}
static int isp1760_msg_submit_bulk(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length)
{
struct isp1760_host_data *host = dev_get_priv(dev);
return usb_urb_submit_bulk(&host->hcd, &host->urb, &host->hep, udev,
pipe, buffer, length);
}
static int isp1760_msg_submit_irq(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length,
int interval, bool nonblock)
{
struct isp1760_host_data *host = dev_get_priv(dev);
return usb_urb_submit_irq(&host->hcd, &host->urb, &host->hep, udev,
pipe, buffer, length, interval);
}
static int isp1760_get_max_xfer_size(struct udevice *dev, size_t *size)
{
struct isp1760_host_data *host = dev_get_priv(dev);
struct isp1760_hcd *priv = host->hcd.hcd_priv;
const struct isp1760_memory_layout *mem = priv->memory_layout;
*size = mem->blocks_size[ISP176x_BLOCK_NUM - 1];
return 0;
}
struct dm_usb_ops isp1760_usb_ops = {
.control = isp1760_msg_submit_control,
.bulk = isp1760_msg_submit_bulk,
.interrupt = isp1760_msg_submit_irq,
.get_max_xfer_size = isp1760_get_max_xfer_size,
};
|