Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
f3fa9f3
Documentation
arch
block
crypto
drivers
accessibility
acpi
amba
ata
atm
auxdisplay
base
bcma
block
bluetooth
cdrom
char
clk
clocksource
connector
cpufreq
cpuidle
crypto
dca
devfreq
dio
dma
edac
eisa
firewire
firmware
gpio
gpu
hid
hv
hwmon
hwspinlock
i2c
algos
busses
Kconfig
Makefile
i2c-acorn.c
i2c-ali1535.c
i2c-ali1563.c
i2c-ali15x3.c
i2c-amd756-s4882.c
i2c-amd756.c
i2c-amd8111.c
i2c-at91.c
i2c-au1550.c
i2c-bfin-twi.c
i2c-cpm.c
i2c-davinci.c
i2c-designware-core.c
i2c-designware-core.h
i2c-designware-platdrv.c
i2c-diolan-u2c.c
i2c-eg20t.c
i2c-elektor.c
i2c-gpio.c
i2c-highlander.c
i2c-hydra.c
i2c-i801.c
i2c-ibm_iic.c
i2c-ibm_iic.h
i2c-imx.c
i2c-intel-mid.c
i2c-iop3xx.c
i2c-iop3xx.h
i2c-isch.c
i2c-ixp2000.c
i2c-mpc.c
i2c-mv64xxx.c
i2c-mxs.c
i2c-nforce2-s4985.c
i2c-nforce2.c
i2c-nomadik.c
i2c-nuc900.c
i2c-ocores.c
i2c-octeon.c
i2c-omap.c
i2c-parport-light.c
i2c-parport.c
i2c-parport.h
i2c-pasemi.c
i2c-pca-isa.c
i2c-pca-platform.c
i2c-piix4.c
i2c-pmcmsp.c
i2c-pnx.c
i2c-powermac.c
i2c-puv3.c
i2c-pxa-pci.c
i2c-pxa.c
i2c-s3c2410.c
i2c-s6000.c
i2c-s6000.h
i2c-scmi.c
i2c-sh7760.c
i2c-sh_mobile.c
i2c-sibyte.c
i2c-simtec.c
i2c-sis5595.c
i2c-sis630.c
i2c-sis96x.c
i2c-stu300.c
i2c-stub.c
i2c-taos-evm.c
i2c-tegra.c
i2c-tiny-usb.c
i2c-versatile.c
i2c-via.c
i2c-viapro.c
i2c-xiic.c
scx200_acb.c
scx200_i2c.c
muxes
Kconfig
Makefile
i2c-boardinfo.c
i2c-core.c
i2c-core.h
i2c-dev.c
i2c-mux.c
i2c-smbus.c
ide
idle
ieee802154
infiniband
input
iommu
isdn
leds
lguest
macintosh
mca
md
media
memstick
message
mfd
misc
mmc
mtd
net
nfc
nubus
of
oprofile
parisc
parport
pci
pcmcia
pinctrl
platform
pnp
power
pps
ps3
ptp
rapidio
regulator
rtc
s390
sbus
scsi
sfi
sh
sn
spi
ssb
staging
target
tc
telephony
thermal
tty
uio
usb
uwb
vhost
video
virt
virtio
vlynq
w1
watchdog
xen
zorro
Kconfig
Makefile
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
drivers
/
i2c
/
busses
/
i2c-designware-core.h
Copy path
Blame
Blame
Latest commit
History
History
103 lines (98 loc) · 3.52 KB
Breadcrumbs
linux
/
drivers
/
i2c
/
busses
/
i2c-designware-core.h
Top
File metadata and controls
Code
Blame
103 lines (98 loc) · 3.52 KB
Raw
/* * Synopsys DesignWare I2C adapter driver (master only). * * Based on the TI DAVINCI I2C adapter driver. * * Copyright (C) 2006 Texas Instruments. * Copyright (C) 2007 MontaVista Software Inc. * Copyright (C) 2009 Provigent Ltd. * * ---------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ---------------------------------------------------------------------------- * */ #define DW_IC_CON_MASTER 0x1 #define DW_IC_CON_SPEED_STD 0x2 #define DW_IC_CON_SPEED_FAST 0x4 #define DW_IC_CON_10BITADDR_MASTER 0x10 #define DW_IC_CON_RESTART_EN 0x20 #define DW_IC_CON_SLAVE_DISABLE 0x40 /** * struct dw_i2c_dev - private i2c-designware data * @dev: driver model device node * @base: IO registers pointer * @cmd_complete: tx completion indicator * @lock: protect this struct and IO registers * @clk: input reference clock * @cmd_err: run time hadware error code * @msgs: points to an array of messages currently being transfered * @msgs_num: the number of elements in msgs * @msg_write_idx: the element index of the current tx message in the msgs * array * @tx_buf_len: the length of the current tx buffer * @tx_buf: the current tx buffer * @msg_read_idx: the element index of the current rx message in the msgs * array * @rx_buf_len: the length of the current rx buffer * @rx_buf: the current rx buffer * @msg_err: error status of the current transfer * @status: i2c master status, one of STATUS_* * @abort_source: copy of the TX_ABRT_SOURCE register * @irq: interrupt number for the i2c master * @adapter: i2c subsystem adapter node * @tx_fifo_depth: depth of the hardware tx fifo * @rx_fifo_depth: depth of the hardware rx fifo */ struct dw_i2c_dev { struct device *dev; void __iomem *base; struct completion cmd_complete; struct mutex lock; struct clk *clk; u32 (*get_clk_rate_khz) (struct dw_i2c_dev *dev); int cmd_err; struct i2c_msg *msgs; int msgs_num; int msg_write_idx; u32 tx_buf_len; u8 *tx_buf; int msg_read_idx; u32 rx_buf_len; u8 *rx_buf; int msg_err; unsigned int status; u32 abort_source; int irq; int swab; struct i2c_adapter adapter; u32 functionality; u32 master_cfg; unsigned int tx_fifo_depth; unsigned int rx_fifo_depth; }; extern u32 dw_readl(struct dw_i2c_dev *dev, int offset); extern void dw_writel(struct dw_i2c_dev *dev, u32 b, int offset); extern int i2c_dw_init(struct dw_i2c_dev *dev); extern int i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num); extern u32 i2c_dw_func(struct i2c_adapter *adap); extern irqreturn_t i2c_dw_isr(int this_irq, void *dev_id); extern void i2c_dw_enable(struct dw_i2c_dev *dev); extern void i2c_dw_disable(struct dw_i2c_dev *dev); extern void i2c_dw_clear_int(struct dw_i2c_dev *dev); extern void i2c_dw_disable_int(struct dw_i2c_dev *dev); extern u32 i2c_dw_read_comp_param(struct dw_i2c_dev *dev);
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
You can’t perform that action at this time.