132 Commits
beta ... master

Author SHA1 Message Date
Jaroslav Kysela
ac318f2b8c fix1 2018-10-21 15:57:02 +02:00
Jaroslav Kysela
c57118c568 upgrade-fw: use tar balls from github releases 2018-10-21 15:46:22 +02:00
Jaroslav Kysela
61f769b0a5 add binaries satip-axe-201810171851-15 2018-10-17 19:11:40 +02:00
Jaroslav Kysela
a000ec29ba update README (build 15) 2018-10-17 19:00:27 +02:00
Jaroslav Kysela
f397fdaf6c another minisatip8 fix 2018-10-17 18:50:26 +02:00
Jaroslav Kysela
7078b99048 Revert "fix new dropbear build"
This reverts commit 3ee63f168e.
2018-10-17 17:34:13 +02:00
Jaroslav Kysela
9a60791649 Revert "updated dropbear to 2018.76"
This reverts commit dbce4ca82b.
2018-10-17 17:34:06 +02:00
Jaroslav Kysela
3ee63f168e fix new dropbear build 2018-10-17 17:33:59 +02:00
Jaroslav Kysela
e983b7d842 minisatip8: ignore wrong PIDs (VDR sends PID 65535!) 2018-10-17 17:11:51 +02:00
Jaroslav Kysela
dbce4ca82b updated dropbear to 2018.76 2018-10-17 17:11:51 +02:00
Jaroslav Kysela
5affe3cd94 oscam: update to 11434 2018-10-17 17:11:50 +02:00
Jaroslav Kysela
caecc4b044 minisatip8: improve status/signal reporting, default is threaded mode now 2018-10-17 17:11:50 +02:00
Jaroslav Kysela
85a07ae86b i2c_mangle: always set PLS code and mode, it's independent from MIS 2018-10-17 17:11:50 +02:00
Jaroslav Kysela
c4875893a3 i2c_mangle: always set PLS code and mode, it's independent from MIS 2018-10-13 10:34:46 +02:00
Jaroslav Kysela
fb0fd9fdbb minisatip8: more multistream fixes (add PLS ROOT mode support) 2018-10-13 00:51:02 +02:00
Jaroslav Kysela
47de7247b5 i2c_mangle: allow to set PLS mode, too 2018-10-13 00:48:30 +02:00
Jaroslav Kysela
6c7c2fb61e i2c_mangle: fix msi -> mis typo 2018-10-12 11:24:41 +02:00
Jaroslav Kysela
83d670b4c8 updated minisatip8 - multistream, diseqc address 2018-10-12 11:24:41 +02:00
perexg
9c91484e29 Update README 2018-10-12 11:24:40 +02:00
perexg
da33b45c9d Update README.md 2018-10-12 11:24:40 +02:00
Jaroslav Kysela
a0060a0d3a i2c_mangle module: add support for mis/pls settings (multistream) 2018-10-12 09:23:30 +02:00
Jaroslav Kysela
41964656ff dist/README: add note that releases are on github now 2018-10-08 17:40:20 +02:00
Jaroslav Kysela
495bc2efe4 README.md sync 2018-10-08 17:38:30 +02:00
Oliver Kurz
8f633628b9 Delete outdated firmware images which are better provided by github releases 2018-10-08 16:59:00 +02:00
Oliver Kurz
85f777c078 dist: Add notes regarding automount, missing web interface and DLNA 2018-10-08 16:58:42 +02:00
Jaroslav Kysela
516c4b1cb6 minisatip.md: remove -S for minisatip8 in the first table 2018-09-25 13:38:47 +02:00
Jaroslav Kysela
69febad731 added multicast-rtp-2.tar.gz and Python-3.5.6-1.tar.gz 2018-09-25 11:16:42 +02:00
Jaroslav Kysela
686cf548a7 fix python3-makefile.patch 2018-09-25 11:16:42 +02:00
Jaroslav Kysela
6b3ee4236f upgrade multicast-rtp, upgrade to python 3.5.6, upgrade oscam to 11432
Thanks to @lars18th on github for the multicast-rtp improvement.
2018-09-25 11:16:13 +02:00
Jaroslav Kysela
1472ca205c minisatip8: polarization fix 2018-09-24 20:37:20 +02:00
Jaroslav Kysela
18b4f42460 correct .md files for minisatip8 2018-09-24 17:13:01 +02:00
Jaroslav Kysela
d4130c5564 minisatip8 fixes (free input mode, argument parsing) 2018-09-24 16:56:39 +02:00
Jaroslav Kysela
c2b652cdff minisatip8: try to fix active_pids issue visible with VDR 2018-09-21 10:13:36 +02:00
Jaroslav Kysela
100ef6e46f ntpd: wait for /etc/resolv.conf 2018-09-21 09:53:27 +02:00
Jaroslav Kysela
fa597cbb12 another ntpd fix in /etc/init.d/dhcpc-event 2018-09-17 19:31:09 +02:00
Jaroslav Kysela
b544cb37f2 minisatip8: upgrade to latest minisatip git 2018-09-17 18:11:26 +02:00
Jaroslav Kysela
72350e5d63 dist/README: fix -D parameter for minisatip/minisatip5 2018-09-17 09:58:52 +02:00
Jaroslav Kysela
f6810f6c4e dist/README: fix -D parameter for minisatip7 2018-09-17 09:53:24 +02:00
Jaroslav Kysela
4fdf79250a init.d/dhcp-event: kill always ntpd on bound/rebound to use the correct DNS server 2018-09-17 09:53:24 +02:00
Jaroslav Kysela
43e3f5671c Added missing firmware/idl4k-1.25.0.157.bin file 2018-09-17 09:53:24 +02:00
Jaroslav Kysela
a4febeee87 dist/README: fix -D parameter for minisatip5 2018-09-17 09:53:23 +02:00
helbgd
bcd96a0370 Update README
information added that the USB Stick should be in fat32 format
2018-03-14 14:20:43 +01:00
Jaroslav Kysela
82b0ac1e09 add libc++ to iperf package 2018-03-05 21:49:29 +01:00
Jaroslav Kysela
3e059adc76 added iperf.tar.gz package 2018-03-05 21:39:34 +01:00
Jaroslav Kysela
17110b0b95 axe207 2018-03-05 21:37:06 +01:00
Jaroslav Kysela
446acbadbc minisatip8 fixes 2018-01-30 19:06:21 +01:00
Jaroslav Kysela
f356862959 minisatip8 fixes, add possibility to pass options to syslogd (remote log) 2018-01-25 09:00:55 +01:00
Jaroslav Kysela
c7fcbbbecd minisatip.md updates 2018-01-24 17:10:36 +01:00
Jaroslav Kysela
8189117ad4 sysctl.conf - increase tcp_wmem 2018-01-24 16:59:26 +01:00
Jaroslav Kysela
74cbceae37 add minisatip8 (axe version of minisatip 0.7.15) 2018-01-24 16:54:05 +01:00
Jaroslav Kysela
6dab49d703 build 14 2017-06-07 17:06:17 +02:00
Jaroslav Kysela
191f36e836 satip-axe-201705251044-14 release 2017-06-07 17:00:13 +02:00
Jaroslav Kysela
ba1044386b minisatip7: fix the PID filter count (32) 2017-06-07 16:57:59 +02:00
Jaroslav Kysela
84a531f3fc minisatip7 -0 change 2017-05-12 09:56:52 +02:00
Jaroslav Kysela
d50f0f44b1 update README.md 2017-05-11 17:29:04 +02:00
Jaroslav Kysela
467df53da0 minisatip7 update 2017-05-07 09:05:04 +02:00
Jaroslav Kysela
a3c1087039 upgrade packages 2017-05-03 17:04:12 +02:00
Jaroslav Kysela
bd6c1f835a minisatip7 optimizations and -A mode fix 2017-04-28 15:39:59 +02:00
Jaroslav Kysela
c5d23802fe minisatip.md: Try to fix tables 2017-04-27 08:49:33 +02:00
Jaroslav Kysela
8f504c3e20 README update 2017-04-25 15:47:05 +02:00
Jaroslav Kysela
5f5ad50aa3 add minisatip7 (minisatip 0.7) 2017-04-25 13:06:56 +02:00
Jaroslav Kysela
955b1f1ea9 update minisatip/minisatip5/axe_fe_157 2016-07-04 22:54:49 +02:00
Jaroslav Kysela
fcc64e7706 build 12 2016-05-31 16:37:46 +02:00
Jaroslav Kysela
1898c416f7 update oscam to 11234 2016-05-31 16:08:53 +02:00
Jaroslav Kysela
93f7e28ca5 kernel: enable CONFIG_VLAN_8021Q 2016-05-31 16:06:46 +02:00
Jaroslav Kysela
5c3bb4ee6f minisatip5: update to 0.5.50, added dmxts stop call, fixed SNR 2016-05-31 16:01:36 +02:00
Jaroslav Kysela
16a56faa18 minisatip.md: update free inputs 2016-05-25 12:11:35 +02:00
Jaroslav Kysela
b78bfc2279 minisatip5: sync with upstream, enhancements 2016-05-15 20:34:40 +02:00
Jaroslav Kysela
19d71aaa4f minisatip.md: small corrections 2016-03-23 12:18:51 +01:00
Jaroslav Kysela
a4fb0b111a update minisatip.md - free inputs mode 2016-03-23 12:09:58 +01:00
Jaroslav Kysela
d7f7fb37e7 release satip-axe-201603051934-11 2016-03-05 19:40:21 +01:00
Jaroslav Kysela
c62a3db8ac Add fetch-package script 2016-03-05 19:26:11 +01:00
Jaroslav Kysela
8f120f6da1 add Python-3.5.1-1.tar.gz and multicast-rtp-1.tar.gz packages 2016-03-05 18:52:47 +01:00
Jaroslav Kysela
e3f17f91a8 minisatip fixes 2016-03-01 18:13:20 +01:00
Jaroslav Kysela
e2775b1edb another minisatip fix 2016-02-29 21:28:45 +01:00
Jaroslav Kysela
e8e9039064 update minisatip.md 2016-02-29 19:18:47 +01:00
Jaroslav Kysela
111bfb4bd3 update minisatip.md 2016-02-29 19:12:37 +01:00
Jaroslav Kysela
f21ecf4f8d update minisatip.md 2016-02-29 19:11:51 +01:00
Jaroslav Kysela
e1608cf075 add minisatip.md 2016-02-29 19:05:13 +01:00
Jaroslav Kysela
2b0b08b434 update README 2016-02-29 18:24:49 +01:00
Jaroslav Kysela
b79b0de202 update README 2016-02-29 18:23:25 +01:00
Jaroslav Kysela
97347962f0 another minisatip/5 updates 2016-02-29 18:21:05 +01:00
Jaroslav Kysela
ed8d49d5f4 add multicast-rtp package 2016-02-26 20:18:45 +01:00
Jaroslav Kysela
0825c29009 rcS: unpack and run extra services from the data mtd partition 2016-02-25 20:29:39 +01:00
Jaroslav Kysela
2a3e6b7add another python path fix, build python3 as tar.bz2 package 2016-02-25 16:58:23 +01:00
Jaroslav Kysela
511b99c0d8 minisatip/minisatip5 fixes 2016-02-24 20:33:45 +01:00
Jaroslav Kysela
603c847897 fix python .so modules build 2016-02-24 20:16:41 +01:00
Jaroslav Kysela
681acfe49a update axe_fe.ko module from 1.0.0.156 2016-02-23 21:17:36 +01:00
Jaroslav Kysela
55abb24cbc minisatip/minisatip5: add -P (power), improve LNB standby logic 2016-02-23 21:05:47 +01:00
Jaroslav Kysela
df0117dbbf added python-3.5.1 2016-02-23 21:03:57 +01:00
Jaroslav Kysela
77dfde31d5 update dist/README for build 11 2016-02-21 11:25:43 +01:00
Jaroslav Kysela
250605a442 minisatip/minisatip5: add unicable groups, -Z option for quattro lo/hi filter 2016-02-20 23:11:40 +01:00
Jaroslav Kysela
385e26f04d dropbear: prefer rsa key, dss keys are obsoleted in recent openssl 2016-02-20 21:09:15 +01:00
Jaroslav Kysela
a09c172d6e Makefile: add apps/media rules - but it's a wish - non-working 2016-02-20 21:00:53 +01:00
Jaroslav Kysela
95c1a12e04 upgrade original firmware to 1.24.0.156 2016-02-20 18:04:45 +01:00
Jaroslav Kysela
4c73c21503 minisatip5: accept * for diseqc parameters as adapter (all) 2016-02-20 11:28:40 +01:00
Jaroslav Kysela
303658efeb update both minisatip executables, fixes, enhancements 2016-02-17 15:28:44 +01:00
Jaroslav Kysela
32ef312593 allow to modify minisatip executable 2016-02-17 10:12:03 +01:00
Jaroslav Kysela
380608b158 minisatip5: fix /status.html crashes, more nice look 2016-02-16 21:18:55 +01:00
Jaroslav Kysela
b117f9d05c minisatip5: fix crashes for /status.html 2016-02-16 17:44:48 +01:00
Jaroslav Kysela
628fab9709 update dist/README for new release (minisatip5, stmmac) 2016-02-16 17:08:23 +01:00
Jaroslav Kysela
3d93c74f8a update minisatip 0.1 (-S to -M option change) 2016-02-16 16:58:21 +01:00
Jaroslav Kysela
d4006ef67e add minisatip5 (0.5.26-axe101) 2016-02-16 16:54:57 +01:00
Jaroslav Kysela
204c2f5e12 minisatip: fix unicable/jess only 13V initialization 2016-02-15 19:41:12 +01:00
Jaroslav Kysela
572269b3a5 build 11 2016-02-15 08:30:47 +01:00
Jaroslav Kysela
bf6dac65cc kernel: stmmac ethernet driver: turn off scatter-gather, increase ring buffers from 256 to 512 2016-02-15 08:26:53 +01:00
Jaroslav Kysela
ce99684df9 update dist/README 2016-02-12 11:35:39 +01:00
Jaroslav Kysela
e08ffc6585 kernel: enable realtek phy
- set interrupt control to 0x0400 instead 0x6400 (upstream for RTL8211E)
2016-02-12 10:43:45 +01:00
Jaroslav Kysela
893c829bc8 minisatip: add -S option (default value: 35 mpeg-ts packets) 2016-02-12 10:33:58 +01:00
Jaroslav Kysela
f022b89299 update busybox, dropbear nano, oscam to latest 2016-02-12 10:31:57 +01:00
Jaroslav Kysela
dcaf0bf211 kernel: update stmmac ethernet driver from latest linux-sh4-2.6.32.y - _stm24_0217 2016-02-11 21:19:20 +01:00
Jaroslav Kysela
ccc89f44ae fix idl4k.cfgresetusb and dist/README 2016-02-01 22:09:46 +01:00
Jaroslav Kysela
f41f9d1416 fixes from issue #37 2016-02-01 18:12:33 +01:00
Jaroslav Kysela
77d858da6d dist/README: add note that .fw file must be for idl4k.cfgresetusb on stick, too 2016-02-01 18:10:19 +01:00
Jaroslav Kysela
4017aafcc2 idl4k.recovery fix to boot original fw immediatelly 2015-09-03 20:02:03 +02:00
Jaroslav Kysela
99747294c0 add DHCP note to dist/README 2015-08-12 14:21:03 +02:00
Jaroslav Kysela
c8f8ed8839 add cfgresetusb uboot script 2015-08-10 15:09:15 +02:00
Jaroslav Kysela
e45c18b9b5 dist/README: minisatip: add -d warning 2015-08-06 17:11:15 +02:00
Jaroslav Kysela
5d931a5078 release satip-axe-201508061051-10 2015-08-06 11:02:29 +02:00
Jaroslav Kysela
1e7d16c213 fix mdev.conf, add idl4k.cfgreset script 2015-08-04 19:42:35 +02:00
Jaroslav Kysela
8be34f5ace upgrade minisatip to new demuxts api 2015-08-04 18:38:54 +02:00
Jaroslav Kysela
38c9c83899 oscamd: update to 10937 2015-08-03 18:57:54 +02:00
Jaroslav Kysela
5f8140d65f kernel: fix USB bug (serial readers) 2015-08-03 18:53:41 +02:00
Jaroslav Kysela
c48033761a kernel: USB update from stlinux24_217 2015-08-03 18:26:47 +02:00
Jaroslav Kysela
07aa6b0e5a add missing files 2015-08-03 17:03:15 +02:00
Jaroslav Kysela
d85930aeb3 updates for latest inverto drivers 2015-08-03 16:57:27 +02:00
Jaroslav Kysela
e89a848843 Makefile: add --no-check-certificate to wget 2015-05-29 13:50:27 +02:00
Jaroslav Kysela
6b9e85ba87 dist/README: more customization notes 2015-05-25 16:00:32 +02:00
Jaroslav Kysela
353489076e release satip-axe-201505242057-9 2015-05-24 21:08:55 +02:00
Jaroslav Kysela
bfaf8a7392 /etc/sysconfig/profile support 2015-05-24 20:57:08 +02:00
Jaroslav Kysela
3b50611490 minor update: localtime 2015-05-24 20:40:07 +02:00
Jaroslav Kysela
db129d8a72 dist/README: fix inconsistency (upgrade-fw script in log) 2015-05-24 11:16:38 +02:00
156 changed files with 11333 additions and 1173 deletions

341
Makefile
View File

@@ -1,4 +1,4 @@
BUILD=9
BUILD=15
VERSION=$(shell date +%Y%m%d%H%M)-$(BUILD)
CPUS=4
CURDIR=$(shell pwd)
@@ -9,9 +9,16 @@ TOOLCHAIN_KERNEL=$(CURDIR)/toolchain/4.5.3-99/opt/STM/STLinux-2.4/devkit/sh4
HOST_ARCH=$(shell uname -m)
EXTRA_AXE_MODULES_DIR=firmware/initramfs/root/modules_idl4k_7108_ST40HOST_LINUX_32BITS
EXTRA_AXE_MODULES=axe_dmx.ko axe_dmxts.ko axe_fe.ko axe_fp.ko axe_i2c.ko \
EXTRA_AXE_MODULES=axe_dmx.ko axe_dmxts.ko axe_fp.ko axe_i2c.ko \
stapi_core_stripped.ko stapi_ioctl_stripped.ko stsys_ioctl.ko
EXTRA_AXE_LIBS_DIR=firmware/initramfs/usr/local/lib
EXTRA_AXE_LIBS=libboost_date_time.so libboost_date_time.so.1.53.0 \
libboost_thread.so libboost_thread.so.1.53.0 \
libboost_filesystem.so libboost_filesystem.so.1.53.0 \
libboost_serialization.so libboost_serialization.so.1.53.0 \
libboost_system.so libboost_system.so.1.53.0
ORIG_FILES=main_axe.out
KMODULES = drivers/usb/serial/cp210x.ko \
@@ -24,10 +31,13 @@ KMODULES = drivers/usb/serial/cp210x.ko \
drivers/usb/serial/oti6858.ko
MINISATIP_COMMIT=54df9348e7bd7e6075f54f1b93ec4ad36429abe0
MINISATIP5_COMMIT=67e88c2d743d6df9c4a96aad772414169f61b764
MINISATIP7_COMMIT=d22ba0dfe3c706c3ab6ad86486d8a9e913080f7e
MINISATIP8_COMMIT=8e2362435cc8c5e0babc3e7ca67570c7f7dd03c5
BUSYBOX=busybox-1.23.2
BUSYBOX=busybox-1.26.2
DROPBEAR=dropbear-2015.67
DROPBEAR=dropbear-2017.75
DROPBEAR_SBIN_FILES=dropbear
DROPBEAR_BIN_FILES=dbclient dropbearconvert dropbearkey scp
@@ -38,11 +48,11 @@ MTD_UTILS_COMMIT=v1.5.1
LIBTIRPC_VERSION=0.2.5
LIBTIRPC=libtirpc-$(LIBTIRPC_VERSION)
RPCBIND_VERSION=0.2.2
RPCBIND_VERSION=0.2.3
RPCBIND=rpcbind-$(RPCBIND_VERSION)
RPCBIND_SBIN_FILES=rpcbind rpcinfo
NFSUTILS_VERSION=1.3.2
NFSUTILS_VERSION=1.3.4
NFSUTILS=nfs-utils-$(NFSUTILS_VERSION)
NFSUTILS_SBIN_FILES=utils/showmount/showmount \
utils/exportfs/exportfs \
@@ -53,25 +63,39 @@ NFSUTILS_SBIN_FILES=utils/showmount/showmount \
utils/statd/statd \
utils/nfsd/nfsd
NANO_VERSION=2.4.1
NANO_VERSION=2.8.1
NANO=nano-$(NANO_VERSION)
NANO_FILENAME=$(NANO).tar.gz
NANO_DOWNLOAD=http://www.nano-editor.org/dist/v2.4/$(NANO_FILENAME)
NANO_DOWNLOAD=http://www.nano-editor.org/dist/v2.8/$(NANO_FILENAME)
PYTHON3_VERSION0=3.5
PYTHON3_VERSION=$(PYTHON3_VERSION0).6
PYTHON3=Python-$(PYTHON3_VERSION)
PYTHON3_PACKAGE_NAME=$(PYTHON3)-1
PYTHON3_FILENAME=$(PYTHON3).tgz
PYTHON3_DOWNLOAD=https://www.python.org/ftp/python/$(PYTHON3_VERSION)/$(PYTHON3_FILENAME)
MULTICAST_RTP_PACKAGE_NAME=multicast-rtp-2
TVHEADEND_COMMIT=master
# 10087?
OSCAM_REV=10663
# 10663 10937 11234 11398
OSCAM_REV=11434
define GIT_CLONE
@mkdir -p apps/
@mkdir -p apps/host
git clone $(1) apps/$(2)
cd apps/$(2) && git checkout -b axe $(3)
endef
define WGET
@mkdir -p apps/
wget --no-verbose -O $(2) $(1)
@mkdir -p apps/host
wget --no-verbose --no-check-certificate -O $(2) $(1)
endef
define PACKAGE
-mkdir -p out/packages
tar cvz -C $(1) -f out/packages/$(2).tar.gz $(3)
endef
#
@@ -82,7 +106,7 @@ endef
all: kernel-axe-modules kernel
.PHONY: release
release: kernel-axe-modules out/idl4k.scr out/idl4k.recovery
release: kernel-axe-modules out/idl4k.scr out/idl4k.cfgreset out/idl4k.cfgresetusb out/idl4k.recovery
-ls -la out
.PHONY: dist
@@ -99,6 +123,9 @@ CPIO_SRCS += busybox
CPIO_SRCS += dropbear
CPIO_SRCS += ethtool
CPIO_SRCS += minisatip
CPIO_SRCS += minisatip5
CPIO_SRCS += minisatip7
CPIO_SRCS += minisatip8
CPIO_SRCS += oscam
CPIO_SRCS += tools/axehelper
CPIO_SRCS += nfsutils
@@ -109,8 +136,12 @@ fs.cpio: $(CPIO_SRCS)
fakeroot tools/do_min_fs.py \
-r "$(VERSION)" \
-b "bash strace openssl" \
-d "fs-add" \
$(foreach m,$(EXTRA_AXE_MODULES), -e "$(EXTRA_AXE_MODULES_DIR)/$(m):lib/modules/axe/$(m)") \
-e "patches/axe_dmxts_std.ko:lib/modules/axe/axe_dmxts_std.ko" \
-e "patches/axe_fe_157.ko:lib/modules/axe/axe_fe.ko" \
$(foreach m,$(ORIG_FILES), -e "$(EXTRA_AXE_MODULES_DIR)/../$(m):lib/modules/axe/$(m)") \
$(foreach m,$(EXTRA_AXE_LIBS), -e "$(EXTRA_AXE_LIBS_DIR)/$(m):lib/$(m)") \
-e "tools/i2c_mangle.ko:lib/modules/axe/i2c_mangle.ko" \
$(foreach m,$(KMODULES), -e "kernel/$(m):lib/modules/$(m)") \
-e "tools/axehelper:sbin/axehelper" \
@@ -121,13 +152,16 @@ fs.cpio: $(CPIO_SRCS)
$(foreach f,$(RPCBIND_SBIN_FILES), -e "apps/$(RPCBIND)/$(f):usr/sbin/$(f)") \
$(foreach f,$(NFSUTILS_SBIN_FILES), -e "apps/$(NFSUTILS)/$(f):usr/sbin/$(notdir $(f))") \
-e "apps/minisatip/minisatip:sbin/minisatip" \
-e "apps/minisatip/icons/lr.jpg:usr/share/minisatip/icons/lr.jpg" \
-e "apps/minisatip/icons/lr.png:usr/share/minisatip/icons/lr.png" \
-e "apps/minisatip/icons/sm.jpg:usr/share/minisatip/icons/sm.jpg" \
-e "apps/minisatip/icons/sm.png:usr/share/minisatip/icons/sm.png" \
$(foreach f,$(notdir $(wildcard apps/minisatip/icons/*)), -e "apps/minisatip/icons/$f:usr/share/minisatip/icons/$f") \
-e "apps/minisatip5/minisatip:sbin/minisatip5" \
$(foreach f,$(notdir $(wildcard apps/minisatip5/html/*)), -e "apps/minisatip5/html/$f:usr/share/minisatip/html/$f") \
-e "apps/minisatip7/minisatip:sbin/minisatip7" \
$(foreach f,$(notdir $(wildcard apps/minisatip7/html/*)), -e "apps/minisatip7/html/$f:usr/share/minisatip7/html/$f") \
-e "apps/minisatip8/minisatip:sbin/minisatip8" \
$(foreach f,$(notdir $(wildcard apps/minisatip8/html/*)), -e "apps/minisatip8/html/$f:usr/share/minisatip8/html/$f") \
-e "apps/$(NANO)/src/nano:usr/bin/nano" \
-e "apps/mtd-utils/nandwrite:usr/sbin/nandwrite2" \
-e "apps/oscam-svn/Distribution/oscam-1.20-unstable_svn$(OSCAM_REV)-sh4-linux:sbin/oscamd"
-e "apps/oscam-svn/Distribution/oscam-1.20_svn$(OSCAM_REV)-sh4-linux:sbin/oscamd"
.PHONY: fs-list
fs-list:
@@ -137,6 +171,16 @@ fs-list:
# uboot
#
out/idl4k.cfgreset: patches/uboot-cfgreset.script
$(TOOLPATH)/mkimage -T script -C none \
-n 'Reset satip-axe fw configuration' \
-d patches/uboot-cfgreset.script out/idl4k.cfgreset
out/idl4k.cfgresetusb: patches/uboot-cfgresetusb.script
$(TOOLPATH)/mkimage -T script -C none \
-n 'Reset satip-axe fw configuration (USB)' \
-d patches/uboot-cfgresetusb.script out/idl4k.cfgresetusb
out/idl4k.recovery: patches/uboot-recovery.script
$(TOOLPATH)/mkimage -T script -C none \
-n 'Restore original idl4k fw' \
@@ -166,7 +210,7 @@ out/satip-axe-$(VERSION).fw: kernel/arch/sh/boot/uImage.gz
# kernel
#
kernel/.config: toolchain/4.5.3-99/opt/STM/STLinux-2.4/devkit/sh4/bin/sh4-linux-gcc-4.5.3
kernel/.config: patches/kernel.config toolchain/4.5.3-99/opt/STM/STLinux-2.4/devkit/sh4/bin/sh4-linux-gcc-4.5.3
cp patches/kernel.config ./kernel/arch/sh/configs/idl4k_defconfig
make -C kernel -j $(CPUS) ARCH=sh CROSS_COMPILE=$(TOOLCHAIN_KERNEL)/bin/sh4-linux- idl4k_defconfig
@@ -237,11 +281,32 @@ s2i_dump: tools/syscall-dump.so
scp tools/syscall-dump.so tools/s2i-dump.sh firmware/fw.tgz \
root@$(SATIP_HOST):/root
#
# media_build
#
apps/media/build:
$(call GIT_CLONE,git://linuxtv.org/media_build.git,media,master)
$(call WGET,http://www.linuxtv.org/downloads/firmware/dvb-firmwares.tar.bz2,apps/media/dvb-firmwares.tar.bz2)
make -C apps/media download untar
apps/media/v4l/dib0070.h: apps/media/build
make -C apps/media SRCDIR=$(CURDIR)/kernel VER=2.6.32 allyesconfig
make -C apps/media SRCDIR=$(CURDIR) VER=2.6.32
.PHONY: media
media: apps/media/v4l/dib0070.h
.PHONY: media-clean
media-clean:
rm -rf apps/media
#
# minisatip
#
apps/minisatip/axe.h:
apps/minisatip/axe.h: patches/minisatip-axe.patch
rm -rf apps/minisatip
$(call GIT_CLONE,https://github.com/catalinii/minisatip.git,minisatip,$(MINISATIP_COMMIT))
cd apps/minisatip; patch -p1 < ../../patches/minisatip-axe.patch
@@ -257,6 +322,123 @@ minisatip: apps/minisatip/minisatip
minisatip-clean:
rm -rf apps/minisatip
#
# minisatip5
#
apps/minisatip5/axe.h: patches/minisatip5-axe.patch
rm -rf apps/minisatip5
$(call GIT_CLONE,https://github.com/catalinii/minisatip.git,minisatip5,$(MINISATIP5_COMMIT))
cd apps/minisatip5; patch -p1 < ../../patches/minisatip5-axe.patch
apps/minisatip5/minisatip: apps/minisatip5/axe.h
cd apps/minisatip5 && ./configure \
--disable-dvbca \
--disable-dvbcsa \
--disable-dvbaes \
--disable-netceiver
make -C apps/minisatip5 \
DVBCSA= \
DVBCA= \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
CFLAGS="-O2 -DAXE=1 -DSYS_DVBT2=16 \
-DDISABLE_DVBAPI -DDISABLE_DVBCSA -DDISABLE_DVBCA \
-DDISABLE_TABLES -DDISABLE_NETCVCLIENT \
-I$(CURDIR)/kernel/include"
.PHONY: minisatip5
minisatip5: apps/minisatip5/minisatip
.PHONY: minisatip5-clean
minisatip5-clean:
rm -rf apps/minisatip5
#
# minisatip7
#
apps/minisatip7/axe.h: patches/minisatip7-axe.patch
rm -rf apps/minisatip7
$(call GIT_CLONE,https://github.com/perexg/minisatip.git,minisatip7,$(MINISATIP7_COMMIT))
cd apps/minisatip7; patch -p1 < ../../patches/minisatip7-axe.patch
apps/minisatip7/minisatip: apps/minisatip7/axe.h
cd apps/minisatip7 && ./configure \
--enable-axe \
--disable-dvbca \
--disable-dvbapi \
--disable-dvbcsa \
--disable-dvbaes \
--disable-netceiver
make -C apps/minisatip7 \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
EXTRA_CFLAGS="-O2 -I$(CURDIR)/kernel/include"
.PHONY: minisatip7
minisatip7: apps/minisatip7/minisatip
.PHONY: minisatip7-clean
minisatip7-clean:
rm -rf apps/minisatip7
#
# minisatip8
#
apps/minisatip8/src/axe.h: patches/minisatip8-axe.patch
rm -rf apps/minisatip8
$(call GIT_CLONE,https://github.com/catalinii/minisatip.git,minisatip8,$(MINISATIP8_COMMIT))
cd apps/minisatip8; patch -p1 < ../../patches/minisatip8-axe.patch
apps/minisatip8/minisatip: apps/minisatip8/src/axe.h
cd apps/minisatip8 && ./configure \
--enable-axe \
--disable-dvbca \
--disable-dvbapi \
--disable-dvbcsa \
--disable-dvbaes \
--disable-netceiver
make -C apps/minisatip8 \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
EXTRA_CFLAGS="-O2 -I$(CURDIR)/kernel/include"
.PHONY: minisatip8
minisatip8: apps/minisatip8/minisatip
.PHONY: minisatip8-clean
minisatip8-clean:
rm -rf apps/minisatip8
#
# minisatip package
#
dist/packages/minisatip-$(VERSION).tar.gz: minisatip minisatip5 minisatip7 minisatip8
rm -rf fs/usr/share/minisatip
mkdir -p fs/usr/share/minisatip/icons/ \
fs/usr/share/minisatip/html/ \
fs/usr/share/minisatip7/html/ \
fs/usr/share/minisatip8/html/
install -m 755 apps/minisatip/minisatip fs/sbin/minisatip
install -m 644 apps/minisatip/icons/* fs/usr/share/minisatip/icons/
install -m 755 apps/minisatip5/minisatip fs/sbin/minisatip5
install -m 644 apps/minisatip5/html/* fs/usr/share/minisatip/html/
install -m 755 apps/minisatip7/minisatip fs/sbin/minisatip7
install -m 644 apps/minisatip7/html/* fs/usr/share/minisatip7/html/
install -m 755 apps/minisatip8/minisatip fs/sbin/minisatip8
install -m 644 apps/minisatip8/html/* fs/usr/share/minisatip7/html8
tar cvz -C fs -f dist/packages/minisatip-$(VERSION).tar.gz \
sbin/minisatip \
sbin/minisatip5 \
usr/share/minisatip/icons \
usr/share/minisatip/html \
usr/share/minisatip7/html \
usr/share/minisatip8/html
ls -la dist/packages/minisatip*
.PHONY: minisatip-package
minisatip-package: dist/packages/minisatip-$(VERSION).tar.gz
#
# busybox
#
@@ -268,7 +450,6 @@ apps/$(BUSYBOX)/Makefile:
apps/$(BUSYBOX)/busybox: apps/$(BUSYBOX)/Makefile
make -C apps/$(BUSYBOX) CROSS_COMPILE=$(TOOLCHAIN)/bin/sh4-linux- defconfig
make -C apps/$(BUSYBOX) CROSS_COMPILE=$(TOOLCHAIN)/bin/sh4-linux-
#make -C apps/$(DROPBEAR) PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
.PHONY: busybox
busybox: apps/$(BUSYBOX)/busybox
@@ -278,7 +459,7 @@ busybox: apps/$(BUSYBOX)/busybox
#
apps/$(DROPBEAR)/configure:
$(call WGET,https://matt.ucc.asn.au/dropbear/$(DROPBEAR).tar.bz2,apps/$(DROPBEAR).tar.bz2)
$(call WGET,https://matt.ucc.asn.au/dropbear/releases/$(DROPBEAR).tar.bz2,apps/$(DROPBEAR).tar.bz2)
tar -C apps -xjf apps/$(DROPBEAR).tar.bz2
apps/$(DROPBEAR)/dropbear: apps/$(DROPBEAR)/configure
@@ -431,17 +612,124 @@ apps/$(NANO)/configure:
$(call WGET,$(NANO_DOWNLOAD),apps/$(NANO_FILENAME))
tar -C apps -xzf apps/$(NANO_FILENAME)
apps/$(NANO)/nano: apps/$(NANO)/configure
apps/$(NANO)/src/nano: apps/$(NANO)/configure
cd apps/$(NANO) && \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
CFLAGS="-O2" \
./configure \
--host=sh4-linux \
--disable-utf8 \
--prefix=/
make -C apps/$(NANO)
.PHONY: nano
nano: apps/$(NANO)/nano
nano: apps/$(NANO)/src/nano
#
# python3-host
#
apps/host/$(PYTHON3)/pyconfig.h.in:
$(call WGET,$(PYTHON3_DOWNLOAD),apps/host/$(PYTHON3_FILENAME))
tar -C apps/host -xzf apps/host/$(PYTHON3_FILENAME)
apps/host/$(PYTHON3)/python: apps/host/$(PYTHON3)/pyconfig.h.in
cd apps/host/$(PYTHON3) && \
./configure
make -C apps/host/$(PYTHON3)
.PHONY: python3-host
python3-host: apps/host/$(PYTHON3)/python
#
# python3
#
apps/$(PYTHON3)/pyconfig.h.in:
$(call WGET,$(PYTHON3_DOWNLOAD),apps/$(PYTHON3_FILENAME))
tar -C apps -xzf apps/$(PYTHON3_FILENAME)
apps/$(PYTHON3)/patch.stamp: apps/$(PYTHON3)/pyconfig.h.in apps/host/$(PYTHON3)/python
cd apps/$(PYTHON3) && \
PKG_CONFIG_PATH=$(TOOLCHAIN)/target/usr/lib/pkgconfig \
PKG_CONFIG=$(TOOLPATH)/pkg-config \
ARCH=sh \
CPP=$(TOOLCHAIN)/bin/sh4-linux-cpp \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
READELF=/usr/bin/readelf \
PYTHON_FOR_BUILD=$(CURDIR)/apps/host/$(PYTHON3)/python \
CONFIG_SITE=$(CURDIR)/patches/python3.config.site \
./configure \
--host=sh4-linux \
--build=x86_64-redhat-linux \
--target=sh4-linux \
--sysconfdir=/etc \
--prefix=/usr \
--enable-ipv6=no
cd apps/$(PYTHON3) && patch -b -p0 < ../../patches/python3-makefile.patch
cd apps/$(PYTHON3) && patch -b -p0 < ../../patches/python3-setup.patch
cd apps/$(PYTHON3) && patch -b -p0 < ../../patches/python3-ccompiler.patch
cd apps/$(PYTHON3) && patch -b -p0 < ../../patches/python3-build-ext.patch
cd apps/$(PYTHON3) && patch -b -p0 < ../../patches/python3-getpath.patch
touch apps/$(PYTHON3)/patch.stamp
apps/$(PYTHON3)/compiled.stamp: apps/$(PYTHON3)/patch.stamp
rm -rf $(CURDIR)/apps/$(PYTHON3)/dest
PYTHONPATH=$(CURDIR)/apps/$(PYTHON3)/Lib \
make -C apps/$(PYTHON3) \
PYINCDIRS="$(CURDIR)/apps/$(PYTHON3):$(CURDIR)/apps/$(PYTHON3)/Include" \
PYLIBS="." \
CROSS_COMPILE=yes \
ABIFLAGS="" \
PYTHON_FOR_BUILD=$(CURDIR)/apps/host/$(PYTHON3)/python \
PGEN=$(CURDIR)/apps/host/$(PYTHON3)/Parser/pgen \
FREEZE_IMPORTLIB=$(CURDIR)/apps/host/$(PYTHON3)/Programs/_freeze_importlib \
PYTHONPATH=$(CURDIR)/apps/$(PYTHON3)/Lib \
PYTHON_OPTIMIZE="" \
PYTHONDONTWRITEBYTECODE=1 \
_PYTHON_HOST_PLATFORM=linux-sh4 \
DESTDIR=$(CURDIR)/apps/$(PYTHON3)/dest \
sharedmods sharedinstall libinstall bininstall
rm -f apps/$(PYTHON3)/dest/usr/bin/python*-config
rm -f apps/$(PYTHON3)/dest/usr/bin/2to3*
rm -f apps/$(PYTHON3)/dest/usr/bin/idle*
$(TOOLCHAIN)/bin/sh4-linux-strip apps/$(PYTHON3)/dest/usr/bin/python3*
rm -f apps/$(PYTHON3)/dest/usr/lib/*.a
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/test
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/ctypes/test
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/sqlite3
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/turtle*
rm -f apps/$(PYTHON3)/dest/usr/lib/python3*/__pycache__/turtle*
rm -f apps/$(PYTHON3)/dest/usr/lib/python3*/lib-dynload/*test*
rm -f apps/$(PYTHON3)/dest/usr/lib/python3*/lib-dynload/*audio*
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/lib2to3
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/unittest
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/tkinter
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/idlelib
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/distutils
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/ensurepip
rm -rf apps/$(PYTHON3)/dest/usr/lib/python3*/curses
find $(CURDIR)/apps/$(PYTHON3)/dest/usr/lib/ -name "*.opt-[12].pyc" -exec rm {} \;
find $(CURDIR)/apps/$(PYTHON3)/dest/usr/lib/ -name "test_*" -exec rm {} \;
$(call PACKAGE,apps/$(PYTHON3)/dest,$(PYTHON3_PACKAGE_NAME),usr)
touch apps/$(PYTHON3)/compiled.stamp
.PHONY: python3
python3: apps/$(PYTHON3)/compiled.stamp
#
# multicast-rtp
#
apps/multicast-rtp/ok.stamp: tools/multicast-rtp
mkdir -p apps/multicast-rtp/sbin apps/multicast-rtp/etc/init.extra
cp tools/multicast-rtp apps/multicast-rtp/sbin
ln -sf ../../sbin/multicast-rtp apps/multicast-rtp/etc/init.extra/multicast-rtp
$(call PACKAGE,apps/multicast-rtp,$(MULTICAST_RTP_PACKAGE_NAME),etc sbin)
touch apps/multicast-rtp/ok.stamp
.PHONY: multicast-rtp
multicast-rtp: apps/multicast-rtp/ok.stamp
#
# tvheadend
@@ -475,3 +763,6 @@ clean: kernel-mrproper
rm -rf firmware/initramfs
rm -rf toolchain/4.5.3-99
rm -rf tools/syscall-dump.o* tools/syscall-dump.s*
testx:
echo $(foreach f,$(notdir $(wildcard apps/minisatip5/html/*)), "'$f'")

View File

@@ -1,45 +1,27 @@
# satip-axe
A firmware with minisatip for Inverto IDL-400s/Grundig GSS.BOX/Telestar Digibit R1
**********************************************************************************
==================================================================================
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](http://paypal.me/perex)
The firmware contains various versions of [minisatip](https://github.com/catalinii/minisatip)
which is tuned to get the best performance on this hardware. There are many extensions for
the complex hobby satellite reception (like free input mode - use any tuner with any physical input,
DVB-S2 multistream support etc.).
There is no DLNA server, but there is HTTP and FTP server to server for
example m3u playlists to clients.
Releases:
---------
- see to dist directory - README file
- download from [github releases](https://github.com/perexg/satip-axe/releases)
- see to [dist](https://github.com/perexg/satip-axe/tree/master/dist) directory - README file
- a TTL USB serial is not required to boot this precompiled firmware
from the USB stick or an installation to the internal flash
Requirements:
Developers:
-----------
- git, python
- STLinux 2.4 (all-sh4-glibc) - http://www.stlinux.com - installed to /opt/STM/STLinux-2.4/
- fakeroot package/tools
Compilation:
- just type 'make'
- kernel with rootfs is in kernel/arch/sh/boot/uImage.gz
Booting uImage.gz on Inverto IDL-400S/Grundig GSS.BOX/Telestar Digibit R1 from USB:
- connect TTL USB serial adapter to J3 connector (4 pins at the power supply)
- pin 1 = 3.6V (do not use), pin 2 = GND, pin 3 = RXD (STM CPU), pin 4 = TXD (STM CPU)
- parameters: 115200,8N1
- press 'Enter' when you turn on the box (you have only one second) to get 'idl4k> ' prompt
(it seems that 'Enter' is required also to enable the serial console)
- modify bootargs (optional - for original firmware)
set bootargs=console=ttyAS0,115200
- set debugfw environment variable
set debugfw "debugfw=usb start;usb start;fatload usb 0 0x84000000 uimage.gz;set bootargs console=ttyAS0,115200 bigphysarea=20000;bootm 0x84000000"
- you may type 'save' to store this settings permanently
- to execute the debugfw type 'run debugfw'
- note that the USB stick should be in the first (upper) USB connector
Configuration
- dhcp client, telnetd, dropbear (ssh daemon) and minisatip are active by default
- configuration is stored in /etc/sysconfig/config
- see [debug](https://github.com/perexg/satip-axe/tree/master/debug)

37
debug/README.md Normal file
View File

@@ -0,0 +1,37 @@
A notes for developers (might be outdated):
-------------------------------------------
Requirements:
- git, python
- STLinux 2.4 (all-sh4-glibc) - http://www.stlinux.com - installed to /opt/STM/STLinux-2.4/
- fakeroot package/tools
Compilation:
- just type 'make'
- kernel with rootfs is in kernel/arch/sh/boot/uImage.gz
Booting uImage.gz on Inverto IDL-400S/Grundig GSS.BOX/Telestar Digibit R1 from USB:
- connect TTL USB serial adapter to J3 connector (4 pins at the power supply)
- pin 1 = 3.6V (do not use), pin 2 = GND, pin 3 = RXD (STM CPU), pin 4 = TXD (STM CPU)
- parameters: 115200,8N1
- press 'Enter' when you turn on the box (you have only one second) to get 'idl4k> ' prompt
(it seems that 'Enter' is required also to enable the serial console)
- modify bootargs (optional - for original firmware)
set bootargs=console=ttyAS0,115200
- set debugfw environment variable
set debugfw "debugfw=usb start;usb start;fatload usb 0 0x84000000 uimage.gz;set bootargs console=ttyAS0,115200 bigphysarea=20000;bootm 0x84000000"
- you may type 'save' to store this settings permanently
- to execute the debugfw type 'run debugfw'
- note that the USB stick should be in the first (upper) USB connector
Configuration
- dhcp client, telnetd, dropbear (ssh daemon) and minisatip are active by default
- configuration is stored in /etc/sysconfig/config

272
dist/README vendored
View File

@@ -1,15 +1,23 @@
SATIP-AXE firmware binary files
===============================
This directory contains USB and flash firmware for
* Inverto IDL-400s
* Grundig GSS.BOX
* Telestar Digibit R1
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](http://paypal.me/perex)
Update:
-------
- check differences in /etc/config.default against /etc/sysconfig/config
- example: diff -u /etc/config.default /etc/sysconfig/config
- since build 9 firmware upgrade may be upgraded using upgrade-fw tool
- file can be fetched directly from github
- or specified as a local firmware file directly
- the file is copied to ramfs before flashing
- the first attempt fails usually (ask Inverto), press Enter to repeat
- example: 'upgrade-fw'
- lists firmwares on github
- example: 'upgrade-fw satip-axe-201504211434-8.fw'
@@ -17,8 +25,12 @@ Update:
file satip-axe-201504211434-8.fw exists, it is preferred
Installation:
-------------
- set DHCP in the original firmware (not 100% required, but several
users reported that without this change the network might not work)
- setup a DHCP server for the box ethernet MAC address
- USB stick needs to be fat32 formatted
- copy satip-axe-$(VERSION).usb as idl4k.scr (rename the file) to the USB stick
- copy satip-axe-$(VERSION).fw (no rename) to the USB stick
- both files should be in the root directory on the USB stick
@@ -31,6 +43,7 @@ Installation:
is not in the box, the original firmware will be booted
Installation to internal flash:
-------------------------------
- WARNING! The original firmware will be deactivated!
- the original firmware can be turned on using idl4k.recovery (see bellow)
@@ -42,32 +55,97 @@ Installation to internal flash:
- the firmware is written to another internal flash area than
the original firmware, but uboot is reconfigured
Extra packages:
---------------
- the packages are unpacked at boot from /mnt/data/satip-axe/packages
- only gzip (.tar.gz) and bzip2 (.tar.bz2) packages are supported
- note bzip2 is slow!
- there is 'fetch-package' script which will list all packages on github
and download one package (use name of package as first argument)
Customization:
--------------
- configuration file is in /etc/sysconfig/config
- put localtime file (glibc) to /etc/sysconfig/localtime
- put resolv.conf file to /etc/sysconfig/resolv.conf
- localboot script can be in /etc/sysconfig/localboot
- passwd file is copied from /etc/sysconfig/passwd
- ssh authorized_keys file is copied from /etc/sysconfig/authorized_keys
- inetd.conf file is linked to /etc/sysconfig/inetd.conf
- oscam configs are in /etc/sysconfig/oscam directory
- if /etc/sysconfig/customd script exists, it is executed from init
- if /etc/sysconfig/profile script exists, it is executed at login
- writeable ftp - copy /etc/inetd.conf to /etc/sysconfig/inetd.conf and
add -w argument to the ftpd daemon
- flash drives are automounted on /media
httpd:
------
- /media tree is exported
ftpd:
-----
- /media tree is exported, use root/satip as login
nfsd:
-----
- only v3 protocol is supported
- to list connected clients 'showmount'
- to list exports 'exportfs'
Minisatip8 (0.7.16) config:
---------------------------
- this is the preferred minisatip server now
- you may add extra parameters to MINISATIP8_OPTS= in /etc/sysconfig/config
- WARNING: use -D with unique numbers if you have _multiple_ SAT>IP servers on net
- SEE: minisatip.md file in this directory for more details
- example 1: only two tuners: MINISATIP8_OPTS="-e 0-1"
- example 2: unicable: MINISATIP8_OPTS="-u 0:1-1420,1:0-1210,2:2-1680,3:3-2040"
- AXE hardware specific options:
-7 link adapters (identical src,lo/hi,h/v), the format is M:S (master:slave)
-Q quattro LNB config (H/H,H/V,L/H,L/V)
-9 X AXE unicable/jess input (0-3)
- example 3: unicable coax in input 2: MINISATIP_OPTS="-9 1"
- example 4: quattro LNB: MINISATIP8_OPTS="-Q"
- example 5: coax in inputs 1,2, tuner 3 slave to input 1, tuner 4 slave to input 2
MINISATIP_OPTS="-7 0:2,1:3"
Minisatip 0.7 config:
---------------------
- you may add extra parameters to MINISATIP7_OPTS= in /etc/sysconfig/config
- WARNING: use -D with unique numbers if you have _multiple_ SAT>IP servers on net
- SEE: minisatip.md file in this directory for more details
- example 1: only two tuners: MINISATIP7_OPTS="-e 0-1"
- example 2: unicable: MINISATIP7_OPTS="-u 0:1-1420,1:0-1210,2:2-1680,3:3-2040"
- AXE hardware specific options:
-7 link adapters (identical src,lo/hi,h/v), the format is M:S (master:slave)
-Q quattro LNB config (H/H,H/V,L/H,L/V)
-9 X AXE unicable/jess input (0-3)
- example 3: unicable coax in input 2: MINISATIP_OPTS="-9 1"
- example 4: quattro LNB: MINISATIP7_OPTS="-Q"
- example 5: coax in inputs 1,2, tuner 3 slave to input 1, tuner 4 slave to input 2
MINISATIP_OPTS="-7 0:2,1:3"
Minisatip5 config:
------------------
- you may add extra parameters to MINISATIP5_OPTS= in /etc/sysconfig/config
- WARNING: use -D with unique numbers if you have _multiple_ SAT>IP servers on net
- see to minisatip config for futher details bellow
Minisatip config:
-----------------
- you may add extra parameters to MINISATIP_OPTS= in /etc/sysconfig/config
- WARNING: use -d with unique numbers if you have _multiple_ SAT>IP servers on net
- SEE: minisatip.md file in this directory for more details
- example 1: only two tuners: MINISATIP_OPTS="-e 0-1"
- example 2: unicable: MINISATIP_OPTS="-u 0:1-1420,1:0-1210,2:2-1680,3:3-2040"
- AXE hardware specific options:
@@ -80,6 +158,7 @@ Minisatip config:
MINISATIP_OPTS="-L 0:2,1:3"
OSCAM config:
-------------
- in /etc/sysconfig/oscam directory
- login/password is oscam/satip, http webui available at http://<boxip>:8888
@@ -87,10 +166,26 @@ OSCAM config:
- or use customized serial device names (see /etc/sysconfig/config)
Misc:
-----
- full tuner reset - "axe-debug reset"
Recovery from the wrong configuration:
--------------------------------------
- it works with firmware build 10 and later
- for flashed firmware:
- copy idl4k.cfgreset file as idl4k.scr file to the root directory on the USB stick
- for firmware on the USB stick:
- copy idl4k.cfgresetusb file as idl4k.scr file to the root directory on the USB stick
- copy satip-axe-*.fw file as satip-axe.fw to the root directory on the USB stick
(build 10 or later)
- plug the USB stick to the upper USB port in box
- turn on the box
- the old configuration file is moved to /etc/sysconfig/config.old
Recovery of the original firmware:
----------------------------------
- copy idl4k.recovery file as idl4k.scr file to the root directory on the USB stick
- plug the USB stick to the upper USB port in box
@@ -98,6 +193,7 @@ Recovery of the original firmware:
- box is accessible through http (web browser) - original firmware
Notes:
------
- there is 128M SPI flash memory in the device
- 128k for u-boot (probably)
@@ -105,8 +201,14 @@ Notes:
- the original firmware uses fw1-nand0 flash region (32M)
- the satip-axe firmware uses fw2-nand0 flash region (32M)
- data block is named data-nand0 - uses rest of flash
- the original firmware provides a web interface for administration, the
satip-axe uses local files for configuration.
- the original firmware provides a DLNA server. Within satip-axe the http
server can be used to provide for example channels maps in the form of
.m3u files
Disclaimer:
-----------
The SATIP AXE firmware is supplied "AS IS" without any warranties and
support.
@@ -121,6 +223,7 @@ warranty that such software will be suitable for the specified use
without further testing or modification.
Bugs:
-----
- the Inverto driver do not initialize properly sometimes
(minisatip is not started); if minisatip does not work,
@@ -145,59 +248,134 @@ Bugs:
- reboot command cannot be used (uboot usb init fails, hw init fails)
History:
--------
satip-axe-?
- added http://boxip:8080/axe-status.txt status page (shell parseable)
- fixed ntpd start
- added crond start / configuration
- added customd start (custom daemon/service/setup - script) from sysinit
- added nano text editor
- updated oscam to 10663
- added upgrade-fw script for the internal flash upgrade without an USB stick
satip-axe-201810211549-15 - Sun Oct 21 2018
- moved the releases (firmware files) to github
- added minisatip8
- theaded mode is turned on by default (use -T to toggle)
- updated minisatip code (latest minisatip 0.7.16)
- note that some options were removed (-M) or added (-2)
- follow /etc/config.default and this file
- fixed reported VDR problems (issue #108)
- added DVB-S2 multistream support
- fixed the improper tuner release problem for complex diseqc settings
where one input is used by multiple tuners (minisatip7 and minisatip8)
- added SYSLOGD_OPTS to pass extra options to syslog
- modified net.ipv4.tcp_wmem (issue #102)
- increased net.core.wmem_max=12582912 , it might help to prevent
the UDP packet loss (issue #88)
- partly fixed time sync (ntpd) issue when DHCP is used (issue #109)
- upgraded python to 3.5.6 (package)
- upgraded oscam to rev.11434
satip-axe-201504211434-8 - Tue Apr 21 2015
- faster boot (approx. 25 seconds from flash)
- tuners - configurable gain (0-16dB) - STV6210_BAMP in config
- enabled inetd/httpd/ftpd/nfsd by default
- added nfsd v3 support
- added ethtool
- extended debug tools for I2C bus (axe-debug, axehelper)
satip-axe-201705251044-14 - Wed Jun 7 2017
- kernel modules from idl4k-1.25.0.157 (frontend + demux)
- updated minisatip5 (0.5.54)
- fixed minisatip issue - multiple frontend device open - #72
- added minisatip7 (0.7.4) / NOTE: Some options are changed!
- this is the *PREFERRED* Sat>IP server now!
- added -0 (--diseqc-multi) option (it's just a workaround)
- upgraded busybox to 1.26.2
- upgraded dropbear to 2016.74
- upgraded rpcbind to 0.2.3
- upgraded nfsutils to 1.3.4
- upgraded oscam to rev.11384
satip-axe-201504142137-7 - Tue Apr 14 2015
- minisatip
- allow configurable DVR read buffer (-b option)
- decrease default DVR read buffer to 14 UDP packets (18424 bytes)
- allow 13V only for unicable/jess (* before freq)
- tuner LED fixes
- AXE modules
- remove the load hell from STLinux, move everything to /etc/init.d/rcS
- another workarounds for the correct tuner initialization
satip-axe-201605311610-12 - Tue May 31 2016
- enabled 802.1q in kernel (VLAN)
- fixed jess (Unicable II) support in both minisatip/minisatip5 binaries
- minisatip5
- added Packets / CC Errors / Coax Cable columns to status table
- added -A (free inputs) option
- disable thread mode by default (use -T to toggle)
- fixed -L option
- updated oscam to 11234
satip-axe-201504101512-6 - Fri Apr 10 2015
- extended minisatip (quattro LNB, master/slave, unicable on other input)
- another shuffling in the AXE modules load procedure
satip-axe-201603051934-11 - Sat Mar 5 2016
- updated stmmac ethernet driver from latest stlinux kernel
- linux-sh4-2.6.32.y - _stm24_0217
- enabled Realtek PHY module (RTL8211E)
- disable scatter-gather, increase ring descriptors (from 256 to 512)
- updated axe_fe.ko kernel module (fix for tuners 3 & 4 from Inverto)
- updated axe_dmxts.ko kernel module from idl4k-1.24.0.156
- updated dropbear to 2015.71
- changed from dss host key to rsa host key (for latest openssl)
- updated nfsutils to 1.3.3
- updated nano to 2.4.3
- updated oscam to 11211
- minisatip accepts -M option to skip first MPEG-TS packets from demuxer
- the default value is 35 (to skip packets from previous tune)
- minisatip can handle multiple unicable groups (-Z option)
- minisatip improved/fixed LNB standby/power handling (-P option)
- added second minisatip binary (minisatip5 - based on 0.5.30 version)
- add new lines to /etc/sysconfig/config from /etc/config.default
- added support for extra packages (put them to /mnt/data/satip-axe/packages)
- added Python-3.5.1-1.tar.gz package (required for multicast-rtp)
- added multicast-rtp-1.tar.gz package (see /sbin/multicast-rtp for help)
satip-axe-201504092035-5 - Thu Apr 9 2015
- fixed minisatip & dhcp issue - minisatip is started with good IP
- changed load order of AXE modules and AXE hw initialization
satip-axe-201508061051-10 - Thu Aug 6 2015
- replaced stapi / frontend / demuxer drivers with latest from Inverto
- updated kernel USB stack, fixed ftdi_sio kernel oops (mouse readers)
- updated minisatip to new demuxts (reduce CPU usage)
- fixed -b option for minisatip
- updated oscamd to 10937
- fixed /etc/mdev.conf to mount USB sticks without partitions
- added idl4k.cfgreset script to reset wrong config
satip-axe-201504082030-4 : Wed Apr 8 2015
- upgraded busybox to v1.23.2
- added ntpd configuration (network time daemon)
- changed dropbear default PATH to "/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin"
- added /dev/sd* devices hotplug (mounted to /media tree using labels)
- added kernel modules for USB serial converters (most Phoenix readers)
- added /dev/ttyUSB* devices hotplug (persistent names like /dev/ttyUSB2-1:1.0)
- added oscam r10619
- allow customization of hostname (/etc/sysconfig/config)
- minisatip fixes (signal levels, cleanups)
satip-axe-201505242057-9 - Sun May 24 2015
- added http://boxip:8080/axe-status.txt status page (shell parseable)
- fixed ntpd start
- added crond start / configuration
- added customd start (custom daemon/service/setup - script) from init
- added nano text editor
- updated oscam to 10663
- added upgrade-fw script for the internal flash upgrade without an USB stick
- added /etc/sysconfig/profile support
satip-axe-201504061852-3 : Mon Apr 6 2015
- minisatip fixes (unicable-jess, corrected input selection - coax inputs)
satip-axe-201504211434-8 - Tue Apr 21 2015
- faster boot (approx. 25 seconds from flash)
- tuners - configurable gain (0-16dB) - STV6210_BAMP in config
- enabled inetd/httpd/ftpd/nfsd by default
- added nfsd v3 support
- added ethtool
- extended debug tools for I2C bus (axe-debug, axehelper)
satip-axe-201504061852-2 : Mon Apr 6 2015
- minisatip fixes (unicable, multiple tuners, h/v and lo/hi setup)
- load axe modules in rcSBB
satip-axe-201504142137-7 - Tue Apr 14 2015
- minisatip
- allow configurable DVR read buffer (-b option)
- decrease default DVR read buffer to 14 UDP packets (18424 bytes)
- allow 13V only for unicable/jess (* before freq)
- tuner LED fixes
- AXE modules
- remove the load hell from STLinux, move everything to /etc/init.d/rcS
- another workarounds for the correct tuner initialization
satip-axe-201503311856-1 : Tue Mar 31 2015
- initial firmware release
satip-axe-201504101512-6 - Fri Apr 10 2015
- extended minisatip (quattro LNB, master/slave, unicable on other input)
- another shuffling in the AXE modules load procedure
satip-axe-201504092035-5 - Thu Apr 9 2015
- fixed minisatip & dhcp issue - minisatip is started with good IP
- changed load order of AXE modules and AXE hw initialization
satip-axe-201504082030-4 : Wed Apr 8 2015
- upgraded busybox to v1.23.2
- added ntpd configuration (network time daemon)
- changed dropbear default PATH to "/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin"
- added /dev/sd* devices hotplug (mounted to /media tree using labels)
- added kernel modules for USB serial converters (most Phoenix readers)
- added /dev/ttyUSB* devices hotplug (persistent names like /dev/ttyUSB2-1:1.0)
- added oscam r10619
- allow customization of hostname (/etc/sysconfig/config)
- minisatip fixes (signal levels, cleanups)
satip-axe-201504061852-3 : Mon Apr 6 2015
- minisatip fixes (unicable-jess, corrected input selection - coax inputs)
satip-axe-201504061852-2 : Mon Apr 6 2015
- minisatip fixes (unicable, multiple tuners, h/v and lo/hi setup)
- load axe modules in rcSBB
satip-axe-201503311856-1 : Tue Mar 31 2015
- initial firmware release

1
dist/README.md vendored Symbolic link
View File

@@ -0,0 +1 @@
README

BIN
dist/idl4k.cfgreset vendored Normal file

Binary file not shown.

BIN
dist/idl4k.cfgresetusb vendored Normal file

Binary file not shown.

BIN
dist/idl4k.recovery vendored

Binary file not shown.

172
dist/minisatip.md vendored Normal file
View File

@@ -0,0 +1,172 @@
minisatip configuration in satip-axe firmware
=============================================
The idl4k boxes have integrated universal switch matrix for all four inputs.
It allows very complex usage. This document tries to explain some special
configurations. For simplicity, the input are numbered as 0-3 here, but
the physical F-type connector on the box have numering 1-4.
NOTE: Some options identifiers were changed between minisatip5 and minisatip7:
minisatip7,8 | minisatip5/minisatip | description
-------------|----------------------|-----------------------------------
-7 | -L | tuner linking
-9 | -X | unicable input
-W | -P | AXE power
-8 | -Z | quattro hiband mode
other AXE specific option | decription
--------------------------|----------------------------------------
-Q | quattro mode
-A | free inputs
-M | skip MPEG-TS packets (up to minisatip8)
Standard DiseqC timing and setup
--------------------------------
### Example: '-q "\*:5-15-0-5-5-0" -d "\*:\*1-0"'
Note: It can be used only with minisatip5 (v0.5+).
Power
-----
Since build 11, you may control the power on box inputs. If you
use /minisatip7/ '-W 1' or /minisatip5/ '-P 1' option, the inputs will
be powered down when no active client is using the minisatip. This
behaviour is similar to minisatip implementation in build 10 or bellow.
If you keep the standard behaviour '-W 0' or '-P 0', the inputs are
powered down when they are not used by any client. There is a delay
of 30 seconds before the power is turned off. Depending on the coaxial
wiring and used reception components, the independent input power down might
affect the signal quality during the power down phase.
Free inputs
-----------
This mode available from build 12 is most powerful but requires
a client which knowns the limitations like tvheadend. In this mode
all sources (src=) defined by the SAT>IP specification are
absolute (shared for all tuners). So any tuner can use any position
but with physical restrictions.
### Example: '-A 0:0:0,0:1:0,1:0:1,1:1:1,2:2:0,3:2:1,4:3:0'
The first number defines the SAT>IP source minus one (0-max).
The second number defines the physical input (0-3). The third
number defines the diseqc position (0-31). You may configure
the diseqc more through -q and -d options. The adapter number
is like input number for them.
Back to the example, the input configuration is like this:
- input 0
- src=1: diseqc position 0 - 23.5E (configuration 0:0:0)
- src=2: diseqc position 1 - 1W (configuration 1:0:1)
- input 1
- src=1: diseqc position 0 - 23.5E (configuration 0:1:0)
- src=2: diseqc position 1 - 1W (configuration 1:1:1)
- input 2:
- src=3: diseqc position 0 - 28.2E (configuration 2:2:0)
- src=4: diseqc position 1 - 19.2E (configuration 3:2:1)
- input 4:
- src=5: diseqc position 0 - 13E (configuration 4:3:0)
So, five satellite positions, for 23.5E and 1W, there are
2 shared inputs, for rest, only one input is available.
Tvheadend can define network limits and network groups.
In this case, we have 3 groups of inputs (23.5E/1W),
(28.2E/19.2E), (13E) and limits 2 for 23.5E/1W and 1 for rest.
Tvheadend should be configured like this (for all tuners):
- assign S23.5E to position 1, network limit 2, network group 1
- assign 1W to position 2, network limit 2, network group 1
- assign 28.2E to position 3, network limit 1, network group 2
- assign 19.2E to position 4, network limit 1, network group 2
- assign 13E to position 5, network limit 1, network group 3
Linked inputs
-------------
### Example1: '-7 0:2,1:3' / minisatip7
### Example1: '-L 0:2,1:3' / minisatip5
### Example2: '-7 0:1,0:2,0:3' / minisatip7
### Example2: '-L 0:1,0:2,0:3' / minisatip5
The first number means master tuner and the second slave tuner.
The tuners in same group (master can have multiple slaves) can
use only same combination of source (src=X), band (low/high)
and polarization at a time.
Quattro LNB
------------
The quattro LNB can be configured using -Q option for minisatip. All
diseqc (AA), voltage and tone setup is executed, so you may eventually
connect a multiswitch or quad LNB (it makes sense only with
the -8 / -Z option).
The -8 / -Z option can eventually reduce the used input to 2 - filtering the
loband (inputs 2,3) or hiband (inputs 0,1) only. For example, 23.5E
satellite positions have useable transponders only in hiband. So, it is
enough to connect coaxial cable only to input 0 and 1 and use other
two inputs for other LNBs (standard way). Note that SAT>IP source number 1
is always handled for the inputs 0 and 1 (to use full 4 tuners for the
loband/hiband inputs).
### Example: '-Q -8 1' / minisatip7
### Example: '-Q -Z 1' / minisatip5
box input 0 ---- multiswitch with diseqc AA = 23.5E
box input 1 ---- multiswitch with diseqc AA = 23.5E
box input 2 ----+---- diseqc AA = 28.2E (SAT>IP src=2)
+---- diseqc AB = 19.2E (SAT>IP src=3)
+---- diseqc BA = 16E (SAT>IP src=4)
\---- diseqc BB = 13E (SAT>IP src=5)
box input 3 ----+---- diseqc AA = 0.8W (SAT>IP src=2)
\---- diseqc AB = 9E (SAT>IP src=3)
As you can see, all tuners have src=1 (23.5E), tuner 2 has four
additional diseqc sources and tuner 3 two additional sources.
Note: This requires build 11 or above of the satip-axe firmware.
Unicable/Unicable II
--------------------
### Example 1: '-u 0:1-1420,1:0-1210,2:2-1680,3:3-2040'
0:1-1420
- 0 = minisatip/box input (0-3)
- 1 = unicable slot number (refer to your unicable equipment)
- 1420 = transpoder frequency for the tuner
Note: 0:1-*1420 means that only 13V (voltage) will be used.
Note2: If you don't specify the adapter as unicable, it can be used to
control the standard LNBs/diseqc equipment.
### Multiple unicable groups
You may connect multiple unicable LNBs through multiple coaxial
wires to the box. In this case, it is necessary to tell which tuners
will use which physical input. In this case '-9 T1,T2,T3,T4 /
'-X T1,T2,T3,T4' option should be used wheren you can define the parent
inputs for all four tuners like: '-9 0,0,2,2' or '-X 0,0,2,2' where two
unicable groups are connected to minisatip input 0 and 2.
box input 0 ---+--- wire 1 (unicable group 1)
box input 1 ---/
box input 2 ---+--- wire 2 (unicable group 2)
box input 3 ---/
Note: This requires build 11 or above of the satip-axe firmware.

BIN
dist/packages/Python-3.5.1-1.tar.gz vendored Normal file

Binary file not shown.

BIN
dist/packages/Python-3.5.6-1.tar.gz vendored Normal file

Binary file not shown.

BIN
dist/packages/iperf.tar.gz vendored Normal file

Binary file not shown.

BIN
dist/packages/multicast-rtp-1.tar.gz vendored Normal file

Binary file not shown.

BIN
dist/packages/multicast-rtp-2.tar.gz vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/satip-axe-201810211549-15.usb vendored Normal file

Binary file not shown.

2
firmware/.gitignore vendored
View File

@@ -1,2 +0,0 @@
initramfs
fw.tgz

Binary file not shown.

View File

@@ -1 +1 @@
idl4k.bin-1.17.0.120
idl4k-1.25.0.157.bin

View File

@@ -2,7 +2,7 @@
# SATIP AXE firmware configuration
#
CFGVER="9"
CFGVER="14"
HOSTNAME="satip-axe"
KMODULES="drivers/usb/serial/cp210x.ko drivers/usb/serial/pl2303.ko drivers/usb/serial/ftdi_sio.ko"
@@ -10,6 +10,7 @@ KMODULES="drivers/usb/serial/cp210x.ko drivers/usb/serial/pl2303.ko drivers/usb/
# STV6210 baseband amplifier gain (0dB .. 16dB - 2dB step)
#
STV6210_BAMP="16dB"
#DEMUXTS_OLD="yes"
#
# ttyUSB names
@@ -40,6 +41,11 @@ IPV4="dhcp"
#
NTPD_OPTS="-p 0.pool.ntp.org"
#
# syslogd
#
#SYSLOGD_OPTS="-R 192.168.1.1:514"
#
# telnetd
#
@@ -53,8 +59,26 @@ DROPBEAR="yes"
#
# minisatip
#
MINISATIP="yes"
MINISATIP_OPTS=""
#MINISATIP="yes"
#MINISATIP_OPTS=""
#
# minisatip 0.5
#
#MINISATIP5="yes"
#MINISATIP5_OPTS=""
#
# minisatip 0.7
#
#MINISATIP7="yes"
#MINISATIP7_OPTS=""
#
# minisatip 0.8
#
MINISATIP8="yes"
MINISATIP8_OPTS=""
#
# inetd (httpd,ftpd)

View File

@@ -2,10 +2,6 @@
test -r /etc/sysconfig/config && . /etc/sysconfig/config
if test "$CUSTOMD" != "yes"; then
exit 0
fi
if test -x "${CUSTOMD}" ; then
. "${CUSTOMD}"
fi

View File

@@ -30,7 +30,6 @@ renew|bound)
logger -p local0.notice "DHCP IPv4 changed, killing minisatip"
rm -f /tmp/satip-network
killall -9 minisatip 2> /dev/null
killall -9 ntpd 2> /dev/null
fi
ifconfig $interface $ip $BROADCAST $NETMASK
if test -n "$router" ; then
@@ -46,6 +45,10 @@ renew|bound)
for i in $dns ; do
echo "nameserver $i" >> $RESOLV_CONF
done
# kill always ntpd
if test -r /var/run/ntpd.pid; then
kill -9 $(cat /var/run/ntpd.pid) 2> /dev/null
fi
# notify satip init script
echo "ok" | nc 127.0.0.1 999 2> /dev/null
sleep 0.5

View File

@@ -6,15 +6,18 @@ if test "$DROPBEAR" != "yes"; then
exit 0
fi
if ! test -r /etc/dropbear/dropbear_dss_host_key; then
if ! test -r /etc/dropbear/dropbear_rsa_host_key; then
mkdir -p /etc/dropbear
if test -r /etc/sysconfig/dropbear_dss_host_key; then
cp /etc/sysconfig/dropbear_dss_host_key /etc/dropbear/dropbear_dss_host_key
if test -r /etc/sysconfig/dropbear_rsa_host_key; then
cp /etc/sysconfig/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key
else
dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
cp /etc/dropbear/dropbear_dss_host_key /etc/sysconfig/dropbear_dss_host_key
dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
cp /etc/dropbear/dropbear_rsa_host_key /etc/sysconfig/dropbear_rsa_host_key
fi
fi
if test -r /etc/sysconfig/dropbear_dss_host_key; then
cp /etc/sysconfig/dropbear_dss_host_key /etc/dropbear/dropbear_dss_host_key
fi
export HOME=/root
if test -r /etc/sysconfig/authorized_keys ; then
mkdir -p $HOME/.ssh

View File

@@ -4,5 +4,10 @@ while test ! -f /tmp/nontpd; do
NTPD_OPTS=""
test -r /etc/sysconfig/config && . /etc/sysconfig/config
test -z "$NTPD_OPTS" && NTPD_OPTS="-p 0.pool.ntp.org"
i=0
while test ! -f /etc/resolv.conf -a $i -le 100; do
sleep 0.2
i=$(expr $i + 1)
done
/usr/sbin/ntpd -n -I eth0 $NTPD_OPTS
done

View File

@@ -1,8 +1,11 @@
#!/bin/busybox sh
busybox echo "Welcome to SATIP-AXE Linux!"
busybox mount -t proc proc /proc
AXECFG=$(busybox awk 'match($0, /axecfg=[^ ]*/) {print substr($0,RSTART,RLENGTH)}' /proc/cmdline)
busybox echo "Welcome to SATIP-AXE Linux! $AXECFG"
AXECFG=${AXECFG:7:255}
# remount root filesystem in rw mode
busybox mount -o remount,rw /
# Create all symbolic links.
@@ -36,14 +39,17 @@ mount -t nfsd nfsd /proc/fs/nfsd
# sysctl.conf
sysctl -q -p
# start syslogd
syslogd -C256
# config/data storage
mkdir -p /mnt/data
mount -t jffs2 /dev/mtdblock4 /mnt/data/
mkdir -p /mnt/data/satip-axe/sysconfig
ln -s /mnt/data/satip-axe/sysconfig /etc/sysconfig
if test "$AXECFG" = "reset"; then
mv /etc/sysconfig/config.old /etc/sysconfig/config.old1 2> /dev/null
mv /etc/sysconfig/config /etc/sysconfig/config.old 2> /dev/null
mv /etc/sysconfig/passwd.old /etc/sysconfig/passwd.old1 2> /dev/null
mv /etc/sysconfig/passwd /etc/sysconfig/passwd.old 2> /dev/null
fi
if ! test -r /etc/sysconfig/config ; then
cp /etc/config.default /etc/sysconfig/config
fi
@@ -51,6 +57,12 @@ if test -r /etc/sysconfig/passwd ; then
cp /etc/sysconfig/passwd /etc/passwd
fi
# load config
test -r /etc/sysconfig/config && . /etc/sysconfig/config
# start syslogd
syslogd -C256 $SYSLOGD_OPTS
# loopback
ifconfig lo 127.0.0.1 netmask 255.255.255.0
@@ -66,7 +78,11 @@ insmod $d/i2c_mangle.ko
insmod $d/axe_fe.ko
insmod $d/axe_fp.ko
insmod $d/axe_dmx.ko
insmod $d/axe_dmxts.ko
if test "$AXECFG" = "demuxts_old" -o "$DEMUXTS_OLD" = "yes"; then
insmod $d/axe_dmxts_std.ko
else
insmod $d/axe_dmxts.ko
fi
mkdir -p /dev/axe /dev/stapi
maj=
for i in $(cat /proc/devices); do
@@ -92,15 +108,15 @@ for i in $(cat /proc/devices); do
mknod /dev/axe/frontend-2 c $maj 2
mknod /dev/axe/frontend-3 c $maj 3
elif test "$i" = "demux"; then
mknod /dev/axe/demux-0 c $maj 0
mknod /dev/axe/demux-1 c $maj 1
mknod /dev/axe/demux-2 c $maj 2
mknod /dev/axe/demux-3 c $maj 3
mknod /dev/axe/demux-0 c $maj 1
mknod /dev/axe/demux-1 c $maj 0
mknod /dev/axe/demux-2 c $maj 3
mknod /dev/axe/demux-3 c $maj 2
elif test "$i" = "demuxts"; then
mknod /dev/axe/demuxts-0 c $maj 0
mknod /dev/axe/demuxts-1 c $maj 1
mknod /dev/axe/demuxts-2 c $maj 2
mknod /dev/axe/demuxts-3 c $maj 3
mknod /dev/axe/demuxts-0 c $maj 1
mknod /dev/axe/demuxts-1 c $maj 0
mknod /dev/axe/demuxts-2 c $maj 3
mknod /dev/axe/demuxts-3 c $maj 2
fi
maj=
done
@@ -109,8 +125,12 @@ nc -l 127.0.0.1:1001 -e /bin/true
rm -f /root/main_init.sh /tmp/axe-done
logger -p local0.notice "AXE drivers load finish"
# localtime
if test -r /etc/sysconfig/localtime; then
ln -s sysconfig/localtime /etc/localtime
fi
# hostname
test -r /etc/sysconfig/config && . /etc/sysconfig/config
test -n "$HOSTNAME" && hostname "$HOSTNAME"
test -z "$HOSTNAME" && hostname satip-axe
@@ -125,6 +145,35 @@ fi
ifconfig eth0 txqueuelen 2000 up
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
# unpack extra packages
for package in /mnt/data/satip-axe/packages/*.tar.gz; do
if test -r "$package"; then
logger -p local0.notice "Unpacking package $package"
tar xz -C / -f "$package"
fi
done
for package in /mnt/data/satip-axe/packages/*.tar.bz2; do
if test -r "$package"; then
logger -p local0.notice "Unpacking package $package"
tar xj -C / -f "$package"
fi
done
# run extra services
inithup=
for prg in /etc/init.extra/*; do
if test -x "$prg"; then
if test -z "$inithup"; then
echo "# Added by /etc/init.d/rcS - init.extra" >> /etc/inittab
fi
echo "::respawn:${prg}" >> /etc/inittab
inithup=1
fi
done
if test -n "$inithup"; then
kill -SIGHUP 1
fi
# local boot
if test -x /etc/sysconfig/localboot ; then
/etc/sysconfig/localboot

View File

@@ -1,8 +1,12 @@
#!/bin/sh
MINISATIP_PROGRAM=minisatip
MINISATIP5_PROGRAM=minisatip5
MINISATIP7_PROGRAM=minisatip7
MINISATIP8_PROGRAM=minisatip8
test -r /etc/sysconfig/config && . /etc/sysconfig/config
if test "$MINISATIP" != "yes"; then
if test "$MINISATIP" != "yes" -a "$MINISATIP5" != "yes" -a "$MINISATIP7" != "yes" -a "$MINISATIP8" != "yes"; then
exit 0
fi
@@ -22,9 +26,26 @@ while test ! -f /tmp/nosatip; do
while ! test -r /tmp/satip-network; do
nc -l 127.0.0.1:999 -e /etc/init.d/satip-network
done
MINISATIP_PROGRAM=minisatip
MINISATIP5_PROGRAM=minisatip5
MINISATIP7_PROGRAM=minisatip7
MINISATIP8_PROGRAM=minisatip8
. /etc/sysconfig/config
nice -5 minisatip -f -g $MINISATIP_OPTS
logger -p local0.notice "minisatip exited $?, restarting"
if test "$MINISATIP" = "yes"; then
nice -5 $MINISATIP_PROGRAM -f -g $MINISATIP_OPTS
logger -p local0.notice "minisatip exited $?, restarting"
elif test "$MINISATIP5" = "yes"; then
nice -5 $MINISATIP5_PROGRAM -f -g $MINISATIP5_OPTS
logger -p local0.notice "minisatip5 exited $?, restarting"
elif test "$MINISATIP7" = "yes"; then
nice -5 $MINISATIP7_PROGRAM -f -g $MINISATIP7_OPTS
logger -p local0.notice "minisatip7 exited $?, restarting"
elif test "$MINISATIP8" = "yes"; then
nice -5 $MINISATIP8_PROGRAM -f -g $MINISATIP8_OPTS
logger -p local0.notice "minisatip8 exited $?, restarting"
else
exit 0
fi
if test -f /tmp/nosatip; then
sleep 87323123
fi

View File

@@ -1,2 +1,2 @@
-sd[a-h][0-9]{1,2} 0:0 660 */sbin/sd-hotplug.sh
-sd[a-h].* 0:0 660 */sbin/sd-hotplug.sh
-ttyUSB[0-9]* 0:0 660 */sbin/tty-hotplug.sh

View File

@@ -4,7 +4,6 @@ vm.vfs_cache_pressure = 20
vm.dirty_ratio = 40
net.core.rmem_max=524288
net.core.wmem_max=524288
net.core.wmem_max=12582912
net.ipv4.tcp_rmem=4096 65536 65536
net.ipv4.tcp_wmem=4096 65536 65536
net.ipv4.tcp_wmem=65536 65536 524288

3
fs-add/root/.profile Normal file
View File

@@ -0,0 +1,3 @@
if test -x /etc/sysconfig/profile; then
. /etc/sysconfig/profile
fi

32
fs-add/sbin/fetch-package Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
FILE="$1"
ODIR="/mnt/data/satip-axe/packages"
OFILE="$ODIR/$FILE"
GITHUB1="https://github.com/perexg/satip-axe/tree/master/dist/packages"
GITHUB2="https://github.com/perexg/satip-axe/blob/master/dist/packages/$FILE?raw=true"
if test "$FILE" = "-h" -o "$FILE" = "--help"; then
echo "Usage: $0 PACKAGE"
exit 1
fi
if test -z "$FILE"; then
echo "Trying to fetch the list of available package files:"
if ! wget -q -O /root/list.txt "$GITHUB1"; then
echo "FAILED"
exit 1
fi
grep -o -E "tar.gz\">.*.tar.gz<" /root/list.txt | grep -o -E ">.*" | grep -o -E "[a-zA-Z].*.tar.gz"
rm /root/list.txt
exit 0
fi
echo "Downloading $FILE:"
if ! wget -O "$OFILE" "$GITHUB2/$FILE"; then
echo "Unable to fetch package file $PACKAGE"
exit 1
fi
echo "Download complete! Check for package duplicates in $ODIR!"
cd $ODIR
ls -la *.tar.*

View File

@@ -1,34 +1,82 @@
#!/bin/sh
FILE="$1"
DOWNLOAD=""
MTDDEV="/dev/mtd3"
SAFEFILE="/root/new.fw"
CHECKSTR="Linux-2.6.32.42_stm24_0208-idl4k"
GITHUB1="https://github.com/perexg/satip-axe/tree/master/dist"
GITHUB2="https://github.com/perexg/satip-axe/blob/master/dist/$FILE?raw=true"
GITHUB1="https://api.github.com/repos/perexg/satip-axe/releases"
if test "$PWD" != "/root" -a "$PWD" != "/"; then
echo "Run this utility from / or /root directory"
exit 1
fi
if test "$FILE" = "-h" -o "$FILE" = "--help"; then
echo "Usage: $0 FIRMWARE"
exit 1
fi
if test -z "$FILE"; then
echo "Trying to fetch the list of available firmware files:"
if ! wget -q -O /root/list.txt "$GITHUB1"; then
if ! test -r "$FILE"; then
if test -z "$FILE"; then
echo "Trying to fetch the list of available firmware files:"
else
echo "Trying to fetch the URL for the firmware:"
fi
if ! wget -q -O /root/list.json "$GITHUB1"; then
echo "FAILED"
exit 1
fi
grep -o -E ">satip-axe-.*.fw<" /root/list.txt | grep -o -E "satip-axe.*.fw"
rm /root/list.txt
exit 0
cat /root/list.json | grep -E '("name"|"browser_download_url")' | \
grep -v -E '"name":.*.tgz' | \
while IFS="\n" read line
do
case "$line" in
\ *\"name\":*)
name=$(echo "$line" | cut -d '"' -f 4)
;;
\ *\"browser_download_url\":*)
fw=$(echo "$line" | cut -d '/' -f 9 | cut -d '"' -f 1 | cut -d '.' -f 1)
fw="$fw.fw"
if test -z "$FILE"; then
printf "%-40s : %s\n" "$name" "$fw"
else
if test "$FILE" = "$fw"; then
f=$(echo "$line" | cut -d '"' -f 4)
echo "$f" > /root/url.txt
printf " %s\n" "$f"
fi
fi
name=''
;;
esac
done
rm /root/list.json
if test -z "$FILE"; then
exit 0
fi
if test -r /root/url.txt; then
DOWNLOAD=$(cat /root/url.txt)
fi
fi
if ! test -r "$FILE"; then
echo "Downloading $FILE:"
if ! wget -O "$SAFEFILE" "$GITHUB2/$FILE"; then
echo "Unable to fetch firmware file $GITHUB2"
if test -n "$DOWNLOAD"; then
echo "Downloading $FILE from $DOWNLOAD to $SAFEFILE:"
if ! wget -O - "$DOWNLOAD" | tar xOzf - "$FILE" > "$SAFEFILE"; then
echo "Unable to fetch firmware file $DOWNLOAD / $FILE"
exit 1
fi
if ! test -r "$SAFEFILE"; then
echo "Unable to fetch firmware file $DOWNLOAD / $FILE"
exit 1
fi
FILESIZE=$(stat -c "%s" "$SAFEFILE")
if test -z "$FILESIZE" -o $FILESIZE -le 0; then
echo "Download failed (wrong file size)!"
else
echo "Downloaded firmware $FILE (file $SAFEFILE size $FILESIZE bytes)..."
fi
FILE="$SAFEFILE"
fi
@@ -64,7 +112,7 @@ while test 1 -eq 1; do
nanddump -f "$SAFEFILE.old" -l "$FILESIZE" "$MTDDEV"
FILESIZE2=$(stat -c "%s" "$SAFEFILE.old")
if test "$FILESIZE" -gt "$FILESIZE2"; then
echo "Unable to verify (file sizes does not match - $FILESIZE > $FILESIZE2"
echo "Unable to verify (file sizes does not match - $FILESIZE > $FILESIZE2)"
exit 1
fi
if ! dd if=/dev/null seek="$FILESIZE" bs=1 of="$SAFEFILE.old" 2> /dev/null; then
@@ -73,7 +121,7 @@ while test 1 -eq 1; do
fi
FILESIZE2=$(stat -c "%s" "$SAFEFILE.old")
if test "$FILESIZE" != "$FILESIZE2"; then
echo "Unable to verify (file sizes does not match - $FILESIZE != $FILESIZE2"
echo "Unable to verify (file sizes does not match - $FILESIZE != $FILESIZE2)"
exit 1
fi
result=$(diff "$SAFEFILE.old" "$SAFEFILE")

View File

@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32.42
# Wed Apr 8 14:52:06 2015
# Thu Feb 11 20:59:25 2016
#
CONFIG_SUPERH=y
CONFIG_SUPERH32=y
@@ -495,7 +495,7 @@ CONFIG_NETFILTER_ADVANCED=y
# CONFIG_ATM is not set
# CONFIG_BRIDGE is not set
# CONFIG_NET_DSA is not set
# CONFIG_VLAN_8021Q is not set
CONFIG_VLAN_8021Q=y
# CONFIG_DECNET is not set
# CONFIG_LLC2 is not set
# CONFIG_IPX is not set
@@ -729,7 +729,7 @@ CONFIG_PHYLIB=y
# CONFIG_SMSC_PHY is not set
# CONFIG_BROADCOM_PHY is not set
# CONFIG_ICPLUS_PHY is not set
# CONFIG_REALTEK_PHY is not set
CONFIG_REALTEK_PHY=y
# CONFIG_NATIONAL_PHY is not set
# CONFIG_STE10XP is not set
# CONFIG_LSI_ET1011C_PHY is not set
@@ -740,8 +740,13 @@ CONFIG_PHYLIB=y
CONFIG_MII=y
CONFIG_NETDEV_1000=y
CONFIG_STMMAC_ETH=y
CONFIG_STMMAC_PLATFORM=y
# CONFIG_STMMAC_PCI is not set
CONFIG_STMMAC_DEBUG_FS=y
# CONFIG_STMMAC_DA is not set
# CONFIG_STMMAC_TIMER is not set
CONFIG_STMMAC_RING=y
# CONFIG_STMMAC_CHAINED is not set
CONFIG_NETDEV_10000=y
# CONFIG_WLAN is not set
@@ -1333,8 +1338,11 @@ CONFIG_NFS_V3=y
CONFIG_ROOT_NFS=y
CONFIG_NFSD=y
CONFIG_NFSD_V3=y
# CONFIG_NFSD_V3_ACL is not set
# CONFIG_NFSD_V4 is not set
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_EXPORTFS=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
# CONFIG_RPCSEC_GSS_KRB5 is not set

View File

@@ -277,6 +277,13 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
if (!netdev)
return true;
/* PHY supports WoL+ that has been enabled by ethtool.
* So we can call the suspend function that is expected
* able to program internal registers to wake-up the system.
*/
if (phydev->wol)
return true;
/*
* Don't suspend PHY if the attched netdev parent may wakeup.
* The parent may point to a PCI device, as in tg3 driver.

View File

@@ -299,6 +299,36 @@ int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd)
}
EXPORT_SYMBOL(phy_ethtool_gset);
int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
{
u32 support = phydev->drv->wol_supported;
if (wol->wolopts & ~support)
return -EINVAL;
phydev->wol = wol->wolopts;
if (wol->wolopts) {
device_set_wakeup_enable(&phydev->dev, 1);
enable_irq_wake(phydev->irq);
} else {
device_set_wakeup_enable(&phydev->dev, 0);
disable_irq_wake(phydev->irq);
}
return 0;
}
EXPORT_SYMBOL(phy_ethtool_set_wol);
int phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
{
if (device_can_wakeup(&phydev->dev)) {
wol->supported = phydev->drv->wol_supported;
wol->wolopts = phydev->wol;
}
return 0;
}
EXPORT_SYMBOL(phy_ethtool_get_wol);
/**
* phy_mii_ioctl - generic PHY MII ioctl interface
* @phydev: the phy_device struct
@@ -510,7 +540,7 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
{
struct phy_device *phydev = phy_dat;
if (PHY_HALTED == phydev->state)
if ((PHY_HALTED == phydev->state) && (!device_may_wakeup(&phydev->dev)))
return IRQ_NONE; /* It can't be ours. */
/* The MDIO bus is not allowed to be written in interrupt
@@ -964,3 +994,35 @@ static void phy_state_machine(struct work_struct *work)
schedule_delayed_work(&phydev->state_queue, PHY_STATE_TIME * HZ);
}
int phy_read_page(struct phy_device *phydev, u16 regnum, int page)
{
int ret, old;
old = phy_read(phydev, 20);
/* Write the page in 0.20 reg */
phy_write(phydev, 20, page);
/* Read data from user page for the regnum */
ret = phy_read(phydev, regnum);
/* Restore page0 */
phy_write(phydev, 20, old);
return ret;
}
EXPORT_SYMBOL(phy_read_page);
int phy_write_page(struct phy_device *phydev, u16 regnum, int page, int data)
{
int old = phy_read(phydev, 20);
/* Write the page in 0.20 reg */
phy_write(phydev, 20, page);
/* Write date to page for regnum */
phy_write(phydev, regnum, data);
/* Restore page0 */
phy_write(phydev, 20, old);
return 0;
}
EXPORT_SYMBOL(phy_write_page);

View File

@@ -30,6 +30,7 @@
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/phy.h>
#include <linux/mdio.h>
#include <asm/io.h>
#include <asm/irq.h>
@@ -874,6 +875,140 @@ int genphy_resume(struct phy_device *phydev)
}
EXPORT_SYMBOL(genphy_resume);
static inline void mmd_phy_cl45(struct mii_bus *bus, int prtad, int devad,
int addr)
{
/* Write the desired MMD Devad */
bus->write(bus, addr, MII_MMD_CRTL, devad);
/* Write the desired MMD register address */
bus->write(bus, addr, MII_MMD_DATA, prtad);
/* Select the Function : DATA with no post increment */
bus->write(bus, addr, MII_MMD_CRTL,
(devad | MII_MMD_CTRL_FUNC_DATA_NOINCR));
}
/**
* read_phy_mmd - reads data from the MMD register (clause 22 to access to
* clause 45)
* @bus: the target MII bus
* @prtad: MMD Address
* @devad: MMD DEVAD
* @addr: PHY address on the MII bus
*
* Description: Reads data from the MMD regisetrs of the
* phy addr. To read these register we have:
* 1) Write reg 13 // DEVAD
* 2) Write reg 14 // MMD Address
* 3) Write reg 13 // MMD Data Command for MMD DEVAD
* 3) Read reg 14 // Read MMD data
*/
static int read_phy_mmd(struct mii_bus *bus, int prtad, int devad, int addr)
{
u32 ret;
mmd_phy_cl45(bus, prtad, devad, addr);
/* Read the content of the MMD's selected register */
ret = bus->read(bus, addr, MII_MMD_DATA);
if (ret < 0)
return -EIO;
return ret;
}
/**
* write_phy_mmd - writes data to the MMD register (clause 22 to access to
* clause 45)
* @bus: the target MII bus
* @prtad: MMD Address
* @devad: MMD DEVAD
* @addr: PHY address on the MII bus
* @data: data to write in the MMD register
*
* Description: write data from the MMD regisetrs of the
* phy addr. To read these register we have:
* 1) Write reg 13 // DEVAD
* 2) Write reg 14 // MMD Address
* 3) Write reg 13 // MMD Data Command for MMD DEVAD
* 3) Write reg 14 // Write MMD data
*/
static void write_phy_mmd(struct mii_bus *bus, int prtad, int devad, int addr,
u32 data)
{
mmd_phy_cl45(bus, prtad, devad, addr);
/* Write the data into MMD's selected register */
bus->write(bus, addr, MII_MMD_DATA, data);
}
/* phy_check_eee
* @dev: device to probe and init
*
* Description: check if the Energy-Efficient Ethernet (EEE)
* is supported by looking at the MMD registers 3.20 and 3.60/61
*/
int phy_check_eee(struct phy_device *phydev)
{
int ret = -EPROTONOSUPPORT;
/* According to 802.3az,the EEE is supported only in full duplex-mode.
* Also EEE feature is active when core is operating with MII, GMII
* or RGMII */
if ((phydev->duplex == DUPLEX_FULL) &&
((phydev->interface == PHY_INTERFACE_MODE_MII) ||
(phydev->interface == PHY_INTERFACE_MODE_GMII) ||
(phydev->interface == PHY_INTERFACE_MODE_RGMII))) {
int eee_cap, eee_link;
/* EEE ability must be supported in both local and remote
* PHY devices. */
eee_cap = read_phy_mmd(phydev->bus, MDIO_EEE_PART_LINK,
MDIO_MMD_AN, phydev->addr);
if (eee_cap < 0)
return eee_cap;
eee_link = read_phy_mmd(phydev->bus, MDIO_EEE_CAP,
MDIO_MMD_PCS, phydev->addr);
if (eee_link < 0)
return eee_link;
if (eee_cap && eee_link) {
/* Configure the PHY to stop receiving xMII clock
* while it is signaling LPI */
int pcs_ctrl = read_phy_mmd(phydev->bus, MDIO_CTRL1,
MDIO_MMD_PCS,
phydev->addr);
if (pcs_ctrl < 0)
return pcs_ctrl;
pcs_ctrl |= MDIO_PCS_CLK_STOP_ENABLE;
write_phy_mmd(phydev->bus, MDIO_CTRL1, MDIO_MMD_PCS,
phydev->addr, pcs_ctrl);
ret = 0; /* EEE supported */
}
}
return ret;
}
EXPORT_SYMBOL(phy_get_eee_err);
/* phy_get_eee_err
* @dev: device to probe and init
*
* Description: it is to report the number of time where the PHY
* failed to complete its normal wake sequence.
*/
int phy_get_eee_err(struct phy_device *phydev)
{
return read_phy_mmd(phydev->bus, MDIO_EEE_WK_ERR, MDIO_MMD_PCS,
phydev->addr);
}
EXPORT_SYMBOL(phy_check_eee);
/**
* phy_probe - probe and init a PHY device
* @dev: device to probe and init
@@ -900,6 +1035,13 @@ static int phy_probe(struct device *dev)
/* Disable the interrupt if the PHY doesn't support it */
if (!(phydrv->flags & PHY_HAS_INTERRUPT))
phydev->irq = PHY_POLL;
else {
/* Check if the PHY is WoL capable but driver cannot work
* in polling mode.
*/
if (phydrv->wol_supported)
device_set_wakeup_capable(dev, 1);
}
mutex_lock(&phydev->lock);

View File

@@ -19,7 +19,7 @@
#define RTL821x_PHYSR_DUPLEX 0x2000
#define RTL821x_PHYSR_SPEED 0xc000
#define RTL821x_INER 0x12
#define RTL821x_INER_INIT 0x6400
#define RTL821x_INER_INIT 0x0400
#define RTL821x_INSR 0x13
#define RTL821x_PHYCR 0x10

View File

@@ -3,7 +3,7 @@ config STMMAC_ETH
select MII
select PHYLIB
select CRC32
depends on NETDEVICES
depends on NETDEVICES && HAS_IOMEM
help
This is the driver for the Ethernet IPs are built around a
Synopsys IP Core and only tested on the STMicroelectronics
@@ -11,6 +11,42 @@ config STMMAC_ETH
if STMMAC_ETH
choice
prompt "STMMAC bus support"
config STMMAC_PLATFORM
bool "Platform bus support"
depends on STMMAC_ETH
---help---
This selects the platform specific bus support for
the stmmac device driver. This is the driver used
on many embedded STM platforms based on ARM and SuperH
processors.
If you have a controller with this interface, say Y or M here.
If unsure, say N.
config STMMAC_PCI
bool "PCI bus support (EXPERIMENTAL)"
depends on STMMAC_ETH && PCI && EXPERIMENTAL
---help---
This is to select the Synopsys DWMAC available on PCI devices,
if you have a controller with this interface, say Y or M here.
This PCI support is tested on XLINX XC2V3000 FF1152AMT0221
D1215994A VIRTEX FPGA board.
If unsure, say N.
endchoice
config STMMAC_DEBUG_FS
bool "Enable monitoring via sysFS "
default n
depends on STMMAC_ETH && DEBUG_FS
help
The stmmac entry in /sys reports DMA TX/RX rings
or (if supported) the HW cap register.
config STMMAC_DA
bool "STMMAC DMA arbitration scheme"
default n
@@ -44,4 +80,22 @@ config STMMAC_RTC_TIMER
endchoice
choice
prompt "Select the DMA TX/RX descriptor operating modes"
depends on STMMAC_ETH
help
This driver supports DMA descriptor to operate both in dual buffer
(RING) and linked-list(CHAINED) mode. In RING mode each descriptor
points to two data buffer pointers whereas in CHAINED mode they
points to only one data buffer pointer.
config STMMAC_RING
bool "Enable Descriptor Ring Mode"
config STMMAC_CHAINED
bool "Enable Descriptor Chained Mode"
endchoice
endif

View File

@@ -1,5 +1,10 @@
obj-$(CONFIG_STMMAC_ETH) += stmmac.o
stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o
stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o
stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o
stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o \
dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o \
dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o $(stmmac-y)
dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o \
mmc_core.o $(stmmac-y)

View File

@@ -0,0 +1,137 @@
/*******************************************************************************
Specialised functions for managing Chained mode
Copyright(C) 2011 STMicroelectronics Ltd
It defines all the functions used to handle the normal/enhanced
descriptors in case of the DMA is configured to work in chained or
in ring mode.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope 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.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
#include "stmmac.h"
unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum)
{
struct stmmac_priv *priv = (struct stmmac_priv *) p;
unsigned int txsize = priv->dma_tx_size;
unsigned int entry = priv->cur_tx % txsize;
struct dma_desc *desc = priv->dma_tx + entry;
unsigned int nopaged_len = skb_headlen(skb);
unsigned int bmax;
unsigned int i = 1, len;
if (priv->plat->enh_desc)
bmax = BUF_SIZE_8KiB;
else
bmax = BUF_SIZE_2KiB;
len = nopaged_len - bmax;
desc->des2 = dma_map_single(priv->device, skb->data,
bmax, DMA_TO_DEVICE);
priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum);
while (len != 0) {
entry = (++priv->cur_tx) % txsize;
desc = priv->dma_tx + entry;
if (len > bmax) {
desc->des2 = dma_map_single(priv->device,
(skb->data + bmax * i),
bmax, DMA_TO_DEVICE);
priv->hw->desc->prepare_tx_desc(desc, 0, bmax,
csum);
priv->hw->desc->set_tx_owner(desc);
priv->tx_skbuff[entry] = NULL;
len -= bmax;
i++;
} else {
desc->des2 = dma_map_single(priv->device,
(skb->data + bmax * i), len,
DMA_TO_DEVICE);
priv->hw->desc->prepare_tx_desc(desc, 0, len,
csum);
priv->hw->desc->set_tx_owner(desc);
priv->tx_skbuff[entry] = NULL;
len = 0;
}
}
return entry;
}
static unsigned int stmmac_is_jumbo_frm(int len, int enh_desc)
{
unsigned int ret = 0;
if ((enh_desc && (len > BUF_SIZE_8KiB)) ||
(!enh_desc && (len > BUF_SIZE_2KiB))) {
ret = 1;
}
return ret;
}
static void stmmac_refill_desc3(int bfsize, struct dma_desc *p)
{
}
static void stmmac_init_desc3(int des3_as_data_buf, struct dma_desc *p)
{
}
static void stmmac_clean_desc3(struct dma_desc *p)
{
}
static void stmmac_init_dma_chain(struct dma_desc *des, dma_addr_t phy_addr,
unsigned int size)
{
/*
* In chained mode the des3 points to the next element in the ring.
* The latest element has to point to the head.
*/
int i;
struct dma_desc *p = des;
dma_addr_t dma_phy = phy_addr;
for (i = 0; i < (size - 1); i++) {
dma_phy += sizeof(struct dma_desc);
p->des3 = (unsigned int)dma_phy;
p++;
}
p->des3 = (unsigned int)phy_addr;
}
static int stmmac_set_16kib_bfsize(int mtu)
{
/* Not supported */
return 0;
}
const struct stmmac_ring_mode_ops ring_mode_ops = {
.is_jumbo_frm = stmmac_is_jumbo_frm,
.jumbo_frm = stmmac_jumbo_frm,
.refill_desc3 = stmmac_refill_desc3,
.init_desc3 = stmmac_init_desc3,
.init_dma_chain = stmmac_init_dma_chain,
.clean_desc3 = stmmac_clean_desc3,
.set_16kib_bfsize = stmmac_set_16kib_bfsize,
};

View File

@@ -22,13 +22,18 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
#include <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/module.h>
#include <linux/init.h>
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#define STMMAC_VLAN_TAG_USED
#include <linux/if_vlan.h>
#endif
#include "descs.h"
#include "mmc.h"
#undef CHIP_DEBUG_PRINT
/* Turn-on extra printk debug for MAC core, dma and descriptors */
@@ -48,7 +53,7 @@ struct stmmac_extra_stats {
unsigned long tx_underflow ____cacheline_aligned;
unsigned long tx_carrier;
unsigned long tx_losscarrier;
unsigned long tx_heartbeat;
unsigned long vlan_tag;
unsigned long tx_deferred;
unsigned long tx_vlan;
unsigned long tx_jabber;
@@ -57,11 +62,12 @@ struct stmmac_extra_stats {
unsigned long tx_ip_header_error;
/* Receive errors */
unsigned long rx_desc;
unsigned long rx_partial;
unsigned long rx_runt;
unsigned long rx_toolong;
unsigned long sa_filter_fail;
unsigned long overflow_error;
unsigned long ipc_csum_error;
unsigned long rx_collision;
unsigned long rx_crc;
unsigned long dribbling_bit;
unsigned long rx_length;
unsigned long rx_mii;
unsigned long rx_multicast;
@@ -89,6 +95,16 @@ struct stmmac_extra_stats {
unsigned long poll_n;
unsigned long sched_timer_n;
unsigned long normal_irq_n;
unsigned long mmc_tx_irq_n;
unsigned long mmc_rx_irq_n;
unsigned long mmc_rx_csum_offload_irq_n;
/* EEE */
unsigned long irq_receive_pmt_irq_n;
unsigned long irq_tx_path_in_lpi_mode_n;
unsigned long irq_tx_path_exit_lpi_mode_n;
unsigned long irq_rx_path_in_lpi_mode_n;
unsigned long irq_rx_path_exit_lpi_mode_n;
unsigned long phy_eee_wakeup_error_n;
};
#define HASH_TABLE_SIZE 64
@@ -102,6 +118,36 @@ struct stmmac_extra_stats {
#define SF_DMA_MODE 1 /* DMA STORE-AND-FORWARD Operation Mode */
/* DAM HW feature register fields */
#define DMA_HW_FEAT_MIISEL 0x00000001 /* 10/100 Mbps Support */
#define DMA_HW_FEAT_GMIISEL 0x00000002 /* 1000 Mbps Support */
#define DMA_HW_FEAT_HDSEL 0x00000004 /* Half-Duplex Support */
#define DMA_HW_FEAT_EXTHASHEN 0x00000008 /* Expanded DA Hash Filter */
#define DMA_HW_FEAT_HASHSEL 0x00000010 /* HASH Filter */
#define DMA_HW_FEAT_ADDMACADRSEL 0x00000020 /* Multiple MAC Addr Reg */
#define DMA_HW_FEAT_PCSSEL 0x00000040 /* PCS registers */
#define DMA_HW_FEAT_L3L4FLTREN 0x00000080 /* Layer 3 & Layer 4 Feature */
#define DMA_HW_FEAT_SMASEL 0x00000100 /* SMA(MDIO) Interface */
#define DMA_HW_FEAT_RWKSEL 0x00000200 /* PMT Remote Wakeup */
#define DMA_HW_FEAT_MGKSEL 0x00000400 /* PMT Magic Packet */
#define DMA_HW_FEAT_MMCSEL 0x00000800 /* RMON Module */
#define DMA_HW_FEAT_TSVER1SEL 0x00001000 /* Only IEEE 1588-2002 Timestamp */
#define DMA_HW_FEAT_TSVER2SEL 0x00002000 /* IEEE 1588-2008 Adv Timestamp */
#define DMA_HW_FEAT_EEESEL 0x00004000 /* Energy Efficient Ethernet */
#define DMA_HW_FEAT_AVSEL 0x00008000 /* AV Feature */
#define DMA_HW_FEAT_TXCOESEL 0x00010000 /* Checksum Offload in Tx */
#define DMA_HW_FEAT_RXTYP1COE 0x00020000 /* IP csum Offload(Type 1) in Rx */
#define DMA_HW_FEAT_RXTYP2COE 0x00040000 /* IP csum Offload(Type 2) in Rx */
#define DMA_HW_FEAT_RXFIFOSIZE 0x00080000 /* Rx FIFO > 2048 Bytes */
#define DMA_HW_FEAT_RXCHCNT 0x00300000 /* No. of additional Rx Channels */
#define DMA_HW_FEAT_TXCHCNT 0x00c00000 /* No. of additional Tx Channels */
#define DMA_HW_FEAT_ENHDESSEL 0x01000000 /* Alternate (Enhanced Descriptor) */
#define DMA_HW_FEAT_INTTSEN 0x02000000 /* Timestamping with Internal
System Time */
#define DMA_HW_FEAT_FLEXIPPSEN 0x04000000 /* Flexible PPS Output */
#define DMA_HW_FEAT_SAVLANINS 0x08000000 /* Source Addr or VLAN Insertion */
#define DMA_HW_FEAT_ACTPHYIF 0x70000000 /* Active/selected PHY interface */
enum rx_frame_status { /* IPC status */
good_frame = 0,
discard_frame = 1,
@@ -115,6 +161,48 @@ enum tx_dma_irq_status {
handle_tx_rx = 3,
};
enum core_specific_irq_mask {
core_mmc_tx_irq = 1,
core_mmc_rx_irq = 2,
core_mmc_rx_csum_offload_irq = 4,
core_irq_receive_pmt_irq = 8,
core_irq_tx_path_in_lpi_mode = 16,
core_irq_tx_path_exit_lpi_mode = 32,
core_irq_rx_path_in_lpi_mode = 64,
core_irq_rx_path_exit_lpi_mode = 128,
};
/* DMA HW capabilities */
struct dma_features {
unsigned int mbps_10_100;
unsigned int mbps_1000;
unsigned int half_duplex;
unsigned int hash_filter;
unsigned int multi_addr;
unsigned int pcs;
unsigned int sma_mdio;
unsigned int pmt_remote_wake_up;
unsigned int pmt_magic_frame;
unsigned int rmon;
/* IEEE 1588-2002*/
unsigned int time_stamp;
/* IEEE 1588-2008*/
unsigned int atime_stamp;
/* 802.3az - Energy-Efficient Ethernet (EEE) */
unsigned int eee;
unsigned int av;
/* TX and RX csum */
unsigned int tx_coe;
unsigned int rx_coe_type1;
unsigned int rx_coe_type2;
unsigned int rxfifo_over_2048;
/* TX and RX number of channels */
unsigned int number_rx_channel;
unsigned int number_tx_channel;
/* Alternate (enhanced) DESC mode*/
unsigned int enh_desc;
};
/* GMAC TX FIFO is 8K, Rx FIFO is 16K */
#define BUF_SIZE_16KiB 16384
#define BUF_SIZE_8KiB 8192
@@ -130,17 +218,6 @@ enum tx_dma_irq_status {
#define MAC_ENABLE_TX 0x00000008 /* Transmitter Enable */
#define MAC_RNABLE_RX 0x00000004 /* Receiver Enable */
/* MAC Management Counters register */
#define MMC_CONTROL 0x00000100 /* MMC Control */
#define MMC_HIGH_INTR 0x00000104 /* MMC High Interrupt */
#define MMC_LOW_INTR 0x00000108 /* MMC Low Interrupt */
#define MMC_HIGH_INTR_MASK 0x0000010c /* MMC High Interrupt Mask */
#define MMC_LOW_INTR_MASK 0x00000110 /* MMC Low Interrupt Mask */
#define MMC_CONTROL_MAX_FRM_MASK 0x0003ff8 /* Maximum Frame Size */
#define MMC_CONTROL_MAX_FRM_SHIFT 3
#define MMC_CONTROL_MAX_FRAME 0x7FF
struct stmmac_desc_ops {
/* DMA RX descriptor ring initialization */
void (*init_rx_desc) (struct dma_desc *p, unsigned int ring_size,
@@ -198,6 +275,8 @@ struct stmmac_dma_ops {
void (*stop_rx) (void __iomem *ioaddr);
int (*dma_interrupt) (void __iomem *ioaddr,
struct stmmac_extra_stats *x);
/* If supported then get the optional core features */
unsigned int (*get_hw_feature) (void __iomem *ioaddr);
};
struct stmmac_ops {
@@ -208,7 +287,7 @@ struct stmmac_ops {
/* Dump MAC registers */
void (*dump_regs) (void __iomem *ioaddr);
/* Handle extra events on specific interrupts hw dependent */
void (*host_irq_status) (void __iomem *ioaddr);
int (*host_irq_status) (void __iomem *ioaddr);
/* Multicast filter setting */
void (*set_filter) (struct net_device *dev);
/* Flow control setting */
@@ -221,6 +300,10 @@ struct stmmac_ops {
unsigned int reg_n);
void (*get_umac_addr) (void __iomem *ioaddr, unsigned char *addr,
unsigned int reg_n);
void (*set_eee_mode) (void __iomem *ioaddr, u32 lpi_ctrl_status);
void (*reset_eee_mode) (void __iomem *ioaddr, u32 lpi_ctrl_status);
void (*set_eee_timer) (void __iomem *ioaddr, int ls, int tw);
void (*set_eee_pls) (void __iomem *ioaddr, int link, u32 lpi_ctrl_status);
};
struct mac_link {
@@ -234,12 +317,25 @@ struct mii_regs {
unsigned int data; /* MII Data */
};
struct stmmac_ring_mode_ops {
unsigned int (*is_jumbo_frm) (int len, int ehn_desc);
unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum);
void (*refill_desc3) (int bfsize, struct dma_desc *p);
void (*init_desc3) (int des3_as_data_buf, struct dma_desc *p);
void (*init_dma_chain) (struct dma_desc *des, dma_addr_t phy_addr,
unsigned int size);
void (*clean_desc3) (struct dma_desc *p);
int (*set_16kib_bfsize) (int mtu);
};
struct mac_device_info {
const struct stmmac_ops *mac;
const struct stmmac_desc_ops *desc;
const struct stmmac_dma_ops *dma;
const struct stmmac_ring_mode_ops *ring;
struct mii_regs mii; /* MII register Addresses */
struct mac_link link;
unsigned int synopsys_uid;
};
struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr);
@@ -249,4 +345,8 @@ extern void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
unsigned int high, unsigned int low);
extern void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int high, unsigned int low);
extern void stmmac_set_mac(void __iomem *ioaddr, bool enable);
extern void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr);
extern const struct stmmac_ring_mode_ops ring_mode_ops;

View File

@@ -25,33 +25,34 @@ struct dma_desc {
union {
struct {
/* RDES0 */
u32 reserved1:1;
u32 payload_csum_error:1;
u32 crc_error:1;
u32 dribbling:1;
u32 mii_error:1;
u32 receive_watchdog:1;
u32 frame_type:1;
u32 collision:1;
u32 frame_too_long:1;
u32 ipc_csum_error:1;
u32 last_descriptor:1;
u32 first_descriptor:1;
u32 multicast_frame:1;
u32 run_frame:1;
u32 vlan_tag:1;
u32 overflow_error:1;
u32 length_error:1;
u32 partial_frame_error:1;
u32 sa_filter_fail:1;
u32 descriptor_error:1;
u32 error_summary:1;
u32 frame_length:14;
u32 filtering_fail:1;
u32 da_filter_fail:1;
u32 own:1;
/* RDES1 */
u32 buffer1_size:11;
u32 buffer2_size:11;
u32 reserved2:2;
u32 reserved1:2;
u32 second_address_chained:1;
u32 end_ring:1;
u32 reserved3:5;
u32 reserved2:5;
u32 disable_ic:1;
} rx;
struct {
/* RDES0 */
@@ -91,24 +92,28 @@ struct dma_desc {
u32 underflow_error:1;
u32 excessive_deferral:1;
u32 collision_count:4;
u32 heartbeat_fail:1;
u32 vlan_frame:1;
u32 excessive_collisions:1;
u32 late_collision:1;
u32 no_carrier:1;
u32 loss_carrier:1;
u32 reserved1:3;
u32 payload_error:1;
u32 frame_flushed:1;
u32 jabber_timeout:1;
u32 error_summary:1;
u32 reserved2:15;
u32 ip_header_error:1;
u32 time_stamp_status:1;
u32 reserved1:13;
u32 own:1;
/* TDES1 */
u32 buffer1_size:11;
u32 buffer2_size:11;
u32 reserved3:1;
u32 time_stamp_enable:1;
u32 disable_padding:1;
u32 second_address_chained:1;
u32 end_ring:1;
u32 crc_disable:1;
u32 reserved4:2;
u32 checksum_insertion:2;
u32 first_segment:1;
u32 last_segment:1;
u32 interrupt:1;

View File

@@ -0,0 +1,126 @@
/*******************************************************************************
Header File to describe Normal/enhanced descriptor functions used for RING
and CHAINED modes.
Copyright(C) 2011 STMicroelectronics Ltd
It defines all the functions used to handle the normal/enhanced
descriptors in case of the DMA is configured to work in chained or
in ring mode.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope 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.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
#if defined(CONFIG_STMMAC_RING)
static inline void ehn_desc_rx_set_on_ring_chain(struct dma_desc *p, int end)
{
p->des01.erx.buffer2_size = BUF_SIZE_8KiB - 1;
if (end)
p->des01.erx.end_ring = 1;
}
static inline void ehn_desc_tx_set_on_ring_chain(struct dma_desc *p, int end)
{
if (end)
p->des01.etx.end_ring = 1;
}
static inline void enh_desc_end_tx_desc(struct dma_desc *p, int ter)
{
p->des01.etx.end_ring = ter;
}
static inline void enh_set_tx_desc_len(struct dma_desc *p, int len)
{
if (unlikely(len > BUF_SIZE_4KiB)) {
p->des01.etx.buffer1_size = BUF_SIZE_4KiB;
p->des01.etx.buffer2_size = len - BUF_SIZE_4KiB;
} else
p->des01.etx.buffer1_size = len;
}
static inline void ndesc_rx_set_on_ring_chain(struct dma_desc *p, int end)
{
p->des01.rx.buffer2_size = BUF_SIZE_2KiB - 1;
if (end)
p->des01.rx.end_ring = 1;
}
static inline void ndesc_tx_set_on_ring_chain(struct dma_desc *p, int end)
{
if (end)
p->des01.tx.end_ring = 1;
}
static inline void ndesc_end_tx_desc(struct dma_desc *p, int ter)
{
p->des01.tx.end_ring = ter;
}
static inline void norm_set_tx_desc_len(struct dma_desc *p, int len)
{
if (unlikely(len > BUF_SIZE_2KiB)) {
p->des01.etx.buffer1_size = BUF_SIZE_2KiB - 1;
p->des01.etx.buffer2_size = len - p->des01.etx.buffer1_size;
} else
p->des01.tx.buffer1_size = len;
}
#else
static inline void ehn_desc_rx_set_on_ring_chain(struct dma_desc *p, int end)
{
p->des01.erx.second_address_chained = 1;
}
static inline void ehn_desc_tx_set_on_ring_chain(struct dma_desc *p, int end)
{
p->des01.etx.second_address_chained = 1;
}
static inline void enh_desc_end_tx_desc(struct dma_desc *p, int ter)
{
p->des01.etx.second_address_chained = 1;
}
static inline void enh_set_tx_desc_len(struct dma_desc *p, int len)
{
p->des01.etx.buffer1_size = len;
}
static inline void ndesc_rx_set_on_ring_chain(struct dma_desc *p, int end)
{
p->des01.rx.second_address_chained = 1;
}
static inline void ndesc_tx_set_on_ring_chain(struct dma_desc *p, int ring_size)
{
p->des01.tx.second_address_chained = 1;
}
static inline void ndesc_end_tx_desc(struct dma_desc *p, int ter)
{
p->des01.tx.second_address_chained = 1;
}
static inline void norm_set_tx_desc_len(struct dma_desc *p, int len)
{
p->des01.tx.buffer1_size = len;
}
#endif

View File

@@ -36,6 +36,7 @@
#define GMAC_INT_STATUS 0x00000038 /* interrupt status register */
enum dwmac1000_irq_status {
lpiis_irq = 0x400,
time_stamp_irq = 0x0200,
mmc_rx_csum_offload_irq = 0x0080,
mmc_tx_irq = 0x0040,
@@ -60,6 +61,25 @@ enum power_event {
power_down = 0x00000001,
};
/* Energy Efficient Ethernet (EEE)
*
* LPI status, timer and control register offset
*/
#define LPI_CTRL_STATUS 0x0030
#define LPI_TIMER_CTRL 0x0034
/* LPI control and status defines */
#define LPI_CTRL_STATUS_LPITXA 0x00080000 /* Enable LPI TX Automate */
#define LPI_CTRL_STATUS_PLSEN 0x00040000 /* Enable PHY Link Status */
#define LPI_CTRL_STATUS_PLS 0x00020000 /* PHY Link Status */
#define LPI_CTRL_STATUS_LPIEN 0x00010000 /* LPI Enable */
#define LPI_CTRL_STATUS_RLPIST 0x00000200 /* Receive LPI state */
#define LPI_CTRL_STATUS_TLPIST 0x00000100 /* Transmit LPI state */
#define LPI_CTRL_STATUS_RLPIEX 0x00000008 /* Receive LPI Exit */
#define LPI_CTRL_STATUS_RLPIEN 0x00000004 /* Receive LPI Entry */
#define LPI_CTRL_STATUS_TLPIEX 0x00000002 /* Transmit LPI Exit */
#define LPI_CTRL_STATUS_TLPIEN 0x00000001 /* Transmit LPI Entry */
/* GMAC HW ADDR regs */
#define GMAC_ADDR_HIGH(reg) (0x00000040+(reg * 8))
#define GMAC_ADDR_LOW(reg) (0x00000044+(reg * 8))
@@ -99,7 +119,7 @@ enum inter_frame_gap {
#define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */
#define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \
GMAC_CONTROL_JE | GMAC_CONTROL_BE)
GMAC_CONTROL_JE | GMAC_CONTROL_BE | GMAC_CONTROL_DCRS)
/* GMAC Frame Filter defines */
#define GMAC_FRAME_FILTER_PR 0x00000001 /* Promiscuous Mode */

View File

@@ -35,11 +35,6 @@ static void dwmac1000_core_init(void __iomem *ioaddr)
value |= GMAC_CORE_INIT;
writel(value, ioaddr + GMAC_CONTROL);
/* STBus Bridge Configuration */
/*writel(0xc5608, ioaddr + 0x00007000);*/
/* Freeze MMC counters */
writel(0x8, ioaddr + GMAC_MMC_CTRL);
/* Mask GMAC interrupts */
writel(0x207, ioaddr + GMAC_INT_MASK);
@@ -191,27 +186,98 @@ static void dwmac1000_pmt(void __iomem *ioaddr, unsigned long mode)
writel(pmt, ioaddr + GMAC_PMT);
}
static void dwmac1000_irq_status(void __iomem *ioaddr)
static int dwmac1000_irq_status(void __iomem *ioaddr)
{
u32 intr_status = readl(ioaddr + GMAC_INT_STATUS);
int status = 0;
/* Not used events (e.g. MMC interrupts) are not handled. */
if ((intr_status & mmc_tx_irq))
CHIP_DBG(KERN_DEBUG "GMAC: MMC tx interrupt: 0x%08x\n",
if ((intr_status & mmc_tx_irq)) {
CHIP_DBG(KERN_INFO "GMAC: MMC tx interrupt: 0x%08x\n",
readl(ioaddr + GMAC_MMC_TX_INTR));
if (unlikely(intr_status & mmc_rx_irq))
CHIP_DBG(KERN_DEBUG "GMAC: MMC rx interrupt: 0x%08x\n",
status |= core_mmc_tx_irq;
}
if (unlikely(intr_status & mmc_rx_irq)) {
CHIP_DBG(KERN_INFO "GMAC: MMC rx interrupt: 0x%08x\n",
readl(ioaddr + GMAC_MMC_RX_INTR));
if (unlikely(intr_status & mmc_rx_csum_offload_irq))
CHIP_DBG(KERN_DEBUG "GMAC: MMC rx csum offload: 0x%08x\n",
status |= core_mmc_rx_irq;
}
if (unlikely(intr_status & mmc_rx_csum_offload_irq)) {
CHIP_DBG(KERN_INFO "GMAC: MMC rx csum offload: 0x%08x\n",
readl(ioaddr + GMAC_MMC_RX_CSUM_OFFLOAD));
status |= core_mmc_rx_csum_offload_irq;
}
if (unlikely(intr_status & pmt_irq)) {
CHIP_DBG(KERN_DEBUG "GMAC: received Magic frame\n");
CHIP_DBG(KERN_INFO "GMAC: received Magic frame\n");
/* clear the PMT bits 5 and 6 by reading the PMT
* status register. */
readl(ioaddr + GMAC_PMT);
status |= core_irq_receive_pmt_irq;
}
/* MAC trx/rx EEE LPI entry/exit interrupts */
if (intr_status & lpiis_irq) {
/* Clean LPI interrupt by reading the Reg 12 */
u32 lpi_status = readl(ioaddr + LPI_CTRL_STATUS);
if (lpi_status & LPI_CTRL_STATUS_TLPIEN) {
CHIP_DBG(KERN_INFO "GMAC TX entered in LPI\n");
status |= core_irq_tx_path_in_lpi_mode;
}
if (lpi_status & LPI_CTRL_STATUS_TLPIEX) {
CHIP_DBG(KERN_INFO "GMAC TX exit from LPI\n");
status |= core_irq_tx_path_exit_lpi_mode;
}
if (lpi_status & LPI_CTRL_STATUS_RLPIEN) {
CHIP_DBG(KERN_INFO "GMAC RX entered in LPI\n");
status |= core_irq_rx_path_in_lpi_mode;
}
if (lpi_status & LPI_CTRL_STATUS_RLPIEX) {
CHIP_DBG(KERN_INFO "GMAC RX exit from LPI\n");
status |= core_irq_rx_path_exit_lpi_mode;
}
}
return status;
}
static void dwmac1000_set_eee_mode(void __iomem *ioaddr, u32 lpi_ctl_status)
{
/* Enable the link status receive on RGMII, SGMII ore SMII
* receive path and instruct the transmit to enter in LPI
* state. */
lpi_ctl_status |= LPI_CTRL_STATUS_LPIEN | LPI_CTRL_STATUS_LPITXA;
writel(lpi_ctl_status, ioaddr + LPI_CTRL_STATUS);
}
static void dwmac1000_reset_eee_mode(void __iomem *ioaddr, u32 lpi_ctl_status)
{
lpi_ctl_status &= ~(LPI_CTRL_STATUS_LPIEN | LPI_CTRL_STATUS_LPITXA);
writel(lpi_ctl_status, ioaddr + LPI_CTRL_STATUS);
}
static void dwmac1000_set_eee_pls(void __iomem *ioaddr, int link,
u32 lpi_ctl_status)
{
if (link)
lpi_ctl_status |= LPI_CTRL_STATUS_PLS;
else
lpi_ctl_status &= ~LPI_CTRL_STATUS_PLS;
writel(lpi_ctl_status, ioaddr + LPI_CTRL_STATUS);
}
static void dwmac1000_set_eee_timer(void __iomem *ioaddr, int ls, int tw)
{
int value = ((tw & 0xffff)) | ((ls & 0x7ff) << 16);
/* Program the timers in the LPI timer control register:
* LS: minimum time (ms) for which the link
* status from PHY should be ok before transmitting
* the LPI pattern.
* TW: minimum time (us) for which the core waits
* after it has stopped transmitting the LPI pattern.
*/
writel(value, ioaddr + LPI_TIMER_CTRL);
}
static const struct stmmac_ops dwmac1000_ops = {
@@ -224,15 +290,16 @@ static const struct stmmac_ops dwmac1000_ops = {
.pmt = dwmac1000_pmt,
.set_umac_addr = dwmac1000_set_umac_addr,
.get_umac_addr = dwmac1000_get_umac_addr,
.set_eee_mode = dwmac1000_set_eee_mode,
.reset_eee_mode = dwmac1000_reset_eee_mode,
.set_eee_timer = dwmac1000_set_eee_timer,
.set_eee_pls = dwmac1000_set_eee_pls,
};
struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr)
{
struct mac_device_info *mac;
u32 uid = readl(ioaddr + GMAC_VERSION);
pr_info("\tDWMAC1000 - user ID: 0x%x, Synopsys ID: 0x%x\n",
((uid & 0x0000ff00) >> 8), (uid & 0x000000ff));
u32 hwid = readl(ioaddr + GMAC_VERSION);
mac = kzalloc(sizeof(const struct mac_device_info), GFP_KERNEL);
if (!mac)
@@ -246,6 +313,7 @@ struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr)
mac->link.speed = GMAC_CONTROL_FES;
mac->mii.addr = GMAC_MII_ADDR;
mac->mii.data = GMAC_MII_DATA;
mac->synopsys_uid = hwid;
return mac;
}

View File

@@ -118,13 +118,6 @@ static void dwmac1000_dma_operation_mode(void __iomem *ioaddr, int txmode,
writel(csr6, ioaddr + DMA_CONTROL);
}
/* Not yet implemented --- no RMON module */
static void dwmac1000_dma_diagnostic_fr(void *data,
struct stmmac_extra_stats *x, void __iomem *ioaddr)
{
return;
}
static void dwmac1000_dump_dma_regs(void __iomem *ioaddr)
{
int i;
@@ -139,11 +132,15 @@ static void dwmac1000_dump_dma_regs(void __iomem *ioaddr)
}
}
static unsigned int dwmac1000_get_hw_feature(void __iomem *ioaddr)
{
return readl(ioaddr + DMA_HW_FEATURE);
}
const struct stmmac_dma_ops dwmac1000_dma_ops = {
.init = dwmac1000_dma_init,
.dump_regs = dwmac1000_dump_dma_regs,
.dma_mode = dwmac1000_dma_operation_mode,
.dma_diagnostic_fr = dwmac1000_dma_diagnostic_fr,
.enable_dma_transmission = dwmac_enable_dma_transmission,
.enable_dma_irq = dwmac_enable_dma_irq,
.disable_dma_irq = dwmac_disable_dma_irq,
@@ -152,4 +149,5 @@ const struct stmmac_dma_ops dwmac1000_dma_ops = {
.start_rx = dwmac_dma_start_rx,
.stop_rx = dwmac_dma_stop_rx,
.dma_interrupt = dwmac_dma_interrupt,
.get_hw_feature = dwmac1000_get_hw_feature,
};

View File

@@ -69,22 +69,11 @@ static void dwmac100_dump_mac_regs(void __iomem *ioaddr)
readl(ioaddr + MAC_VLAN1));
pr_info("\tVLAN2 tag (offset 0x%x): 0x%08x\n", MAC_VLAN2,
readl(ioaddr + MAC_VLAN2));
pr_info("\n\tMAC management counter registers\n");
pr_info("\t MMC crtl (offset 0x%x): 0x%08x\n",
MMC_CONTROL, readl(ioaddr + MMC_CONTROL));
pr_info("\t MMC High Interrupt (offset 0x%x): 0x%08x\n",
MMC_HIGH_INTR, readl(ioaddr + MMC_HIGH_INTR));
pr_info("\t MMC Low Interrupt (offset 0x%x): 0x%08x\n",
MMC_LOW_INTR, readl(ioaddr + MMC_LOW_INTR));
pr_info("\t MMC High Interrupt Mask (offset 0x%x): 0x%08x\n",
MMC_HIGH_INTR_MASK, readl(ioaddr + MMC_HIGH_INTR_MASK));
pr_info("\t MMC Low Interrupt Mask (offset 0x%x): 0x%08x\n",
MMC_LOW_INTR_MASK, readl(ioaddr + MMC_LOW_INTR_MASK));
}
static void dwmac100_irq_status(void __iomem *ioaddr)
static int dwmac100_irq_status(void __iomem *ioaddr)
{
return;
return 0;
}
static void dwmac100_set_umac_addr(void __iomem *ioaddr, unsigned char *addr,
@@ -200,6 +189,7 @@ struct mac_device_info *dwmac100_setup(void __iomem *ioaddr)
mac->link.speed = 0;
mac->mii.addr = MAC_MII_ADDR;
mac->mii.data = MAC_MII_DATA;
mac->synopsys_uid = 0;
return mac;
}

View File

@@ -40,10 +40,11 @@ static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx,
/* DMA SW reset */
value |= DMA_BUS_MODE_SFT_RESET;
writel(value, ioaddr + DMA_BUS_MODE);
limit = 15000;
limit = 10;
while (limit--) {
if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET))
break;
mdelay(10);
}
if (limit < 0)
return -EBUSY;

View File

@@ -34,6 +34,7 @@
#define DMA_MISSED_FRAME_CTR 0x00001020 /* Missed Frame Counter */
#define DMA_CUR_TX_BUF_ADDR 0x00001050 /* Current Host Tx Buffer */
#define DMA_CUR_RX_BUF_ADDR 0x00001054 /* Current Host Rx Buffer */
#define DMA_HW_FEATURE 0x00001058 /* HW Feature Register */
/* DMA Control register defines */
#define DMA_CONTROL_ST 0x00002000 /* Start/Stop Transmission */
@@ -68,6 +69,7 @@
#define DMA_INTR_DEFAULT_MASK (DMA_INTR_NORMAL | DMA_INTR_ABNORMAL)
/* DMA Status register defines */
#define DMA_STATUS_GLPII 0x40000000 /* GMAC LPI interrupt */
#define DMA_STATUS_GPI 0x10000000 /* PMT interrupt */
#define DMA_STATUS_GMI 0x08000000 /* MMC interrupt */
#define DMA_STATUS_GLI 0x04000000 /* GMAC Line interface int */

View File

@@ -238,6 +238,19 @@ void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
writel(data, ioaddr + low);
}
/* Enable disable MAC RX/TX */
void stmmac_set_mac(void __iomem *ioaddr, bool enable)
{
u32 value = readl(ioaddr + MAC_CTRL_REG);
if (enable)
value |= MAC_RNABLE_RX | MAC_ENABLE_TX;
else
value &= ~(MAC_ENABLE_TX | MAC_RNABLE_RX);
writel(value, ioaddr + MAC_CTRL_REG);
}
void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int high, unsigned int low)
{

View File

@@ -23,6 +23,7 @@
*******************************************************************************/
#include "common.h"
#include "descs_com.h"
static int enh_desc_get_tx_status(void *data, struct stmmac_extra_stats *x,
struct dma_desc *p, void __iomem *ioaddr)
@@ -200,7 +201,7 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x,
if (unlikely(p->des01.erx.dribbling)) {
CHIP_DBG(KERN_ERR "GMAC RX: dribbling error\n");
ret = discard_frame;
x->dribbling_bit++;
}
if (unlikely(p->des01.erx.sa_filter_fail)) {
CHIP_DBG(KERN_ERR "GMAC RX : Source Address filter fail\n");
@@ -233,10 +234,9 @@ static void enh_desc_init_rx_desc(struct dma_desc *p, unsigned int ring_size,
for (i = 0; i < ring_size; i++) {
p->des01.erx.own = 1;
p->des01.erx.buffer1_size = BUF_SIZE_8KiB - 1;
/* To support jumbo frames */
p->des01.erx.buffer2_size = BUF_SIZE_8KiB - 1;
if (i == ring_size - 1)
p->des01.erx.end_ring = 1;
ehn_desc_rx_set_on_ring_chain(p, (i == ring_size - 1));
if (disable_rx_ic)
p->des01.erx.disable_ic = 1;
p++;
@@ -249,8 +249,7 @@ static void enh_desc_init_tx_desc(struct dma_desc *p, unsigned int ring_size)
for (i = 0; i < ring_size; i++) {
p->des01.etx.own = 0;
if (i == ring_size - 1)
p->des01.etx.end_ring = 1;
ehn_desc_tx_set_on_ring_chain(p, (i == ring_size - 1));
p++;
}
}
@@ -285,19 +284,16 @@ static void enh_desc_release_tx_desc(struct dma_desc *p)
int ter = p->des01.etx.end_ring;
memset(p, 0, offsetof(struct dma_desc, des2));
p->des01.etx.end_ring = ter;
enh_desc_end_tx_desc(p, ter);
}
static void enh_desc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
int csum_flag)
{
p->des01.etx.first_segment = is_fs;
if (unlikely(len > BUF_SIZE_4KiB)) {
p->des01.etx.buffer1_size = BUF_SIZE_4KiB;
p->des01.etx.buffer2_size = len - BUF_SIZE_4KiB;
} else {
p->des01.etx.buffer1_size = len;
}
enh_set_tx_desc_len(p, len);
if (likely(csum_flag))
p->des01.etx.checksum_insertion = cic_full;
}

View File

@@ -0,0 +1,131 @@
/*******************************************************************************
MMC Header file
Copyright (C) 2011 STMicroelectronics Ltd
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope 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.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
/* MMC control register */
/* When set, all counter are reset */
#define MMC_CNTRL_COUNTER_RESET 0x1
/* When set, do not roll over zero
* after reaching the max value*/
#define MMC_CNTRL_COUNTER_STOP_ROLLOVER 0x2
#define MMC_CNTRL_RESET_ON_READ 0x4 /* Reset after reading */
#define MMC_CNTRL_COUNTER_FREEZER 0x8 /* Freeze counter values to the
* current value.*/
#define MMC_CNTRL_PRESET 0x10
#define MMC_CNTRL_FULL_HALF_PRESET 0x20
struct stmmac_counters {
unsigned int mmc_tx_octetcount_gb;
unsigned int mmc_tx_framecount_gb;
unsigned int mmc_tx_broadcastframe_g;
unsigned int mmc_tx_multicastframe_g;
unsigned int mmc_tx_64_octets_gb;
unsigned int mmc_tx_65_to_127_octets_gb;
unsigned int mmc_tx_128_to_255_octets_gb;
unsigned int mmc_tx_256_to_511_octets_gb;
unsigned int mmc_tx_512_to_1023_octets_gb;
unsigned int mmc_tx_1024_to_max_octets_gb;
unsigned int mmc_tx_unicast_gb;
unsigned int mmc_tx_multicast_gb;
unsigned int mmc_tx_broadcast_gb;
unsigned int mmc_tx_underflow_error;
unsigned int mmc_tx_singlecol_g;
unsigned int mmc_tx_multicol_g;
unsigned int mmc_tx_deferred;
unsigned int mmc_tx_latecol;
unsigned int mmc_tx_exesscol;
unsigned int mmc_tx_carrier_error;
unsigned int mmc_tx_octetcount_g;
unsigned int mmc_tx_framecount_g;
unsigned int mmc_tx_excessdef;
unsigned int mmc_tx_pause_frame;
unsigned int mmc_tx_vlan_frame_g;
/* MMC RX counter registers */
unsigned int mmc_rx_framecount_gb;
unsigned int mmc_rx_octetcount_gb;
unsigned int mmc_rx_octetcount_g;
unsigned int mmc_rx_broadcastframe_g;
unsigned int mmc_rx_multicastframe_g;
unsigned int mmc_rx_crc_errror;
unsigned int mmc_rx_align_error;
unsigned int mmc_rx_run_error;
unsigned int mmc_rx_jabber_error;
unsigned int mmc_rx_undersize_g;
unsigned int mmc_rx_oversize_g;
unsigned int mmc_rx_64_octets_gb;
unsigned int mmc_rx_65_to_127_octets_gb;
unsigned int mmc_rx_128_to_255_octets_gb;
unsigned int mmc_rx_256_to_511_octets_gb;
unsigned int mmc_rx_512_to_1023_octets_gb;
unsigned int mmc_rx_1024_to_max_octets_gb;
unsigned int mmc_rx_unicast_g;
unsigned int mmc_rx_length_error;
unsigned int mmc_rx_autofrangetype;
unsigned int mmc_rx_pause_frames;
unsigned int mmc_rx_fifo_overflow;
unsigned int mmc_rx_vlan_frames_gb;
unsigned int mmc_rx_watchdog_error;
/* IPC */
unsigned int mmc_rx_ipc_intr_mask;
unsigned int mmc_rx_ipc_intr;
/* IPv4 */
unsigned int mmc_rx_ipv4_gd;
unsigned int mmc_rx_ipv4_hderr;
unsigned int mmc_rx_ipv4_nopay;
unsigned int mmc_rx_ipv4_frag;
unsigned int mmc_rx_ipv4_udsbl;
unsigned int mmc_rx_ipv4_gd_octets;
unsigned int mmc_rx_ipv4_hderr_octets;
unsigned int mmc_rx_ipv4_nopay_octets;
unsigned int mmc_rx_ipv4_frag_octets;
unsigned int mmc_rx_ipv4_udsbl_octets;
/* IPV6 */
unsigned int mmc_rx_ipv6_gd_octets;
unsigned int mmc_rx_ipv6_hderr_octets;
unsigned int mmc_rx_ipv6_nopay_octets;
unsigned int mmc_rx_ipv6_gd;
unsigned int mmc_rx_ipv6_hderr;
unsigned int mmc_rx_ipv6_nopay;
/* Protocols */
unsigned int mmc_rx_udp_gd;
unsigned int mmc_rx_udp_err;
unsigned int mmc_rx_tcp_gd;
unsigned int mmc_rx_tcp_err;
unsigned int mmc_rx_icmp_gd;
unsigned int mmc_rx_icmp_err;
unsigned int mmc_rx_udp_gd_octets;
unsigned int mmc_rx_udp_err_octets;
unsigned int mmc_rx_tcp_gd_octets;
unsigned int mmc_rx_tcp_err_octets;
unsigned int mmc_rx_icmp_gd_octets;
unsigned int mmc_rx_icmp_err_octets;
};
extern void dwmac_mmc_ctrl(void __iomem *ioaddr, unsigned int mode);
extern void dwmac_mmc_intr_all_mask(void __iomem *ioaddr);
extern void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc);

View File

@@ -0,0 +1,266 @@
/*******************************************************************************
DWMAC Management Counters
Copyright (C) 2011 STMicroelectronics Ltd
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope 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.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
#include <linux/kernel.h>
#include <linux/io.h>
#include "mmc.h"
/* MAC Management Counters register offset */
#define MMC_CNTRL 0x00000100 /* MMC Control */
#define MMC_RX_INTR 0x00000104 /* MMC RX Interrupt */
#define MMC_TX_INTR 0x00000108 /* MMC TX Interrupt */
#define MMC_RX_INTR_MASK 0x0000010c /* MMC Interrupt Mask */
#define MMC_TX_INTR_MASK 0x00000110 /* MMC Interrupt Mask */
#define MMC_DEFAUL_MASK 0xffffffff
/* MMC TX counter registers */
/* Note:
* _GB register stands for good and bad frames
* _G is for good only.
*/
#define MMC_TX_OCTETCOUNT_GB 0x00000114
#define MMC_TX_FRAMECOUNT_GB 0x00000118
#define MMC_TX_BROADCASTFRAME_G 0x0000011c
#define MMC_TX_MULTICASTFRAME_G 0x00000120
#define MMC_TX_64_OCTETS_GB 0x00000124
#define MMC_TX_65_TO_127_OCTETS_GB 0x00000128
#define MMC_TX_128_TO_255_OCTETS_GB 0x0000012c
#define MMC_TX_256_TO_511_OCTETS_GB 0x00000130
#define MMC_TX_512_TO_1023_OCTETS_GB 0x00000134
#define MMC_TX_1024_TO_MAX_OCTETS_GB 0x00000138
#define MMC_TX_UNICAST_GB 0x0000013c
#define MMC_TX_MULTICAST_GB 0x00000140
#define MMC_TX_BROADCAST_GB 0x00000144
#define MMC_TX_UNDERFLOW_ERROR 0x00000148
#define MMC_TX_SINGLECOL_G 0x0000014c
#define MMC_TX_MULTICOL_G 0x00000150
#define MMC_TX_DEFERRED 0x00000154
#define MMC_TX_LATECOL 0x00000158
#define MMC_TX_EXESSCOL 0x0000015c
#define MMC_TX_CARRIER_ERROR 0x00000160
#define MMC_TX_OCTETCOUNT_G 0x00000164
#define MMC_TX_FRAMECOUNT_G 0x00000168
#define MMC_TX_EXCESSDEF 0x0000016c
#define MMC_TX_PAUSE_FRAME 0x00000170
#define MMC_TX_VLAN_FRAME_G 0x00000174
/* MMC RX counter registers */
#define MMC_RX_FRAMECOUNT_GB 0x00000180
#define MMC_RX_OCTETCOUNT_GB 0x00000184
#define MMC_RX_OCTETCOUNT_G 0x00000188
#define MMC_RX_BROADCASTFRAME_G 0x0000018c
#define MMC_RX_MULTICASTFRAME_G 0x00000190
#define MMC_RX_CRC_ERRROR 0x00000194
#define MMC_RX_ALIGN_ERROR 0x00000198
#define MMC_RX_RUN_ERROR 0x0000019C
#define MMC_RX_JABBER_ERROR 0x000001A0
#define MMC_RX_UNDERSIZE_G 0x000001A4
#define MMC_RX_OVERSIZE_G 0x000001A8
#define MMC_RX_64_OCTETS_GB 0x000001AC
#define MMC_RX_65_TO_127_OCTETS_GB 0x000001b0
#define MMC_RX_128_TO_255_OCTETS_GB 0x000001b4
#define MMC_RX_256_TO_511_OCTETS_GB 0x000001b8
#define MMC_RX_512_TO_1023_OCTETS_GB 0x000001bc
#define MMC_RX_1024_TO_MAX_OCTETS_GB 0x000001c0
#define MMC_RX_UNICAST_G 0x000001c4
#define MMC_RX_LENGTH_ERROR 0x000001c8
#define MMC_RX_AUTOFRANGETYPE 0x000001cc
#define MMC_RX_PAUSE_FRAMES 0x000001d0
#define MMC_RX_FIFO_OVERFLOW 0x000001d4
#define MMC_RX_VLAN_FRAMES_GB 0x000001d8
#define MMC_RX_WATCHDOG_ERROR 0x000001dc
/* IPC*/
#define MMC_RX_IPC_INTR_MASK 0x00000200
#define MMC_RX_IPC_INTR 0x00000208
/* IPv4*/
#define MMC_RX_IPV4_GD 0x00000210
#define MMC_RX_IPV4_HDERR 0x00000214
#define MMC_RX_IPV4_NOPAY 0x00000218
#define MMC_RX_IPV4_FRAG 0x0000021C
#define MMC_RX_IPV4_UDSBL 0x00000220
#define MMC_RX_IPV4_GD_OCTETS 0x00000250
#define MMC_RX_IPV4_HDERR_OCTETS 0x00000254
#define MMC_RX_IPV4_NOPAY_OCTETS 0x00000258
#define MMC_RX_IPV4_FRAG_OCTETS 0x0000025c
#define MMC_RX_IPV4_UDSBL_OCTETS 0x00000260
/* IPV6*/
#define MMC_RX_IPV6_GD_OCTETS 0x00000264
#define MMC_RX_IPV6_HDERR_OCTETS 0x00000268
#define MMC_RX_IPV6_NOPAY_OCTETS 0x0000026c
#define MMC_RX_IPV6_GD 0x00000224
#define MMC_RX_IPV6_HDERR 0x00000228
#define MMC_RX_IPV6_NOPAY 0x0000022c
/* Protocols*/
#define MMC_RX_UDP_GD 0x00000230
#define MMC_RX_UDP_ERR 0x00000234
#define MMC_RX_TCP_GD 0x00000238
#define MMC_RX_TCP_ERR 0x0000023c
#define MMC_RX_ICMP_GD 0x00000240
#define MMC_RX_ICMP_ERR 0x00000244
#define MMC_RX_UDP_GD_OCTETS 0x00000270
#define MMC_RX_UDP_ERR_OCTETS 0x00000274
#define MMC_RX_TCP_GD_OCTETS 0x00000278
#define MMC_RX_TCP_ERR_OCTETS 0x0000027c
#define MMC_RX_ICMP_GD_OCTETS 0x00000280
#define MMC_RX_ICMP_ERR_OCTETS 0x00000284
void dwmac_mmc_ctrl(void __iomem *ioaddr, unsigned int mode)
{
u32 value = readl(ioaddr + MMC_CNTRL);
value |= (mode & 0x3F);
writel(value, ioaddr + MMC_CNTRL);
pr_debug("stmmac: MMC ctrl register (offset 0x%x): 0x%08x\n",
MMC_CNTRL, value);
}
/* To mask all all interrupts.*/
void dwmac_mmc_intr_all_mask(void __iomem *ioaddr)
{
writel(MMC_DEFAUL_MASK, ioaddr + MMC_RX_INTR_MASK);
writel(MMC_DEFAUL_MASK, ioaddr + MMC_TX_INTR_MASK);
}
/* This reads the MAC core counters (if actaully supported).
* by default the MMC core is programmed to reset each
* counter after a read. So all the field of the mmc struct
* have to be incremented.
*/
void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc)
{
mmc->mmc_tx_octetcount_gb += readl(ioaddr + MMC_TX_OCTETCOUNT_GB);
mmc->mmc_tx_framecount_gb += readl(ioaddr + MMC_TX_FRAMECOUNT_GB);
mmc->mmc_tx_broadcastframe_g += readl(ioaddr + MMC_TX_BROADCASTFRAME_G);
mmc->mmc_tx_multicastframe_g += readl(ioaddr + MMC_TX_MULTICASTFRAME_G);
mmc->mmc_tx_64_octets_gb += readl(ioaddr + MMC_TX_64_OCTETS_GB);
mmc->mmc_tx_65_to_127_octets_gb +=
readl(ioaddr + MMC_TX_65_TO_127_OCTETS_GB);
mmc->mmc_tx_128_to_255_octets_gb +=
readl(ioaddr + MMC_TX_128_TO_255_OCTETS_GB);
mmc->mmc_tx_256_to_511_octets_gb +=
readl(ioaddr + MMC_TX_256_TO_511_OCTETS_GB);
mmc->mmc_tx_512_to_1023_octets_gb +=
readl(ioaddr + MMC_TX_512_TO_1023_OCTETS_GB);
mmc->mmc_tx_1024_to_max_octets_gb +=
readl(ioaddr + MMC_TX_1024_TO_MAX_OCTETS_GB);
mmc->mmc_tx_unicast_gb += readl(ioaddr + MMC_TX_UNICAST_GB);
mmc->mmc_tx_multicast_gb += readl(ioaddr + MMC_TX_MULTICAST_GB);
mmc->mmc_tx_broadcast_gb += readl(ioaddr + MMC_TX_BROADCAST_GB);
mmc->mmc_tx_underflow_error += readl(ioaddr + MMC_TX_UNDERFLOW_ERROR);
mmc->mmc_tx_singlecol_g += readl(ioaddr + MMC_TX_SINGLECOL_G);
mmc->mmc_tx_multicol_g += readl(ioaddr + MMC_TX_MULTICOL_G);
mmc->mmc_tx_deferred += readl(ioaddr + MMC_TX_DEFERRED);
mmc->mmc_tx_latecol += readl(ioaddr + MMC_TX_LATECOL);
mmc->mmc_tx_exesscol += readl(ioaddr + MMC_TX_EXESSCOL);
mmc->mmc_tx_carrier_error += readl(ioaddr + MMC_TX_CARRIER_ERROR);
mmc->mmc_tx_octetcount_g += readl(ioaddr + MMC_TX_OCTETCOUNT_G);
mmc->mmc_tx_framecount_g += readl(ioaddr + MMC_TX_FRAMECOUNT_G);
mmc->mmc_tx_excessdef += readl(ioaddr + MMC_TX_EXCESSDEF);
mmc->mmc_tx_pause_frame += readl(ioaddr + MMC_TX_PAUSE_FRAME);
mmc->mmc_tx_vlan_frame_g += readl(ioaddr + MMC_TX_VLAN_FRAME_G);
/* MMC RX counter registers */
mmc->mmc_rx_framecount_gb += readl(ioaddr + MMC_RX_FRAMECOUNT_GB);
mmc->mmc_rx_octetcount_gb += readl(ioaddr + MMC_RX_OCTETCOUNT_GB);
mmc->mmc_rx_octetcount_g += readl(ioaddr + MMC_RX_OCTETCOUNT_G);
mmc->mmc_rx_broadcastframe_g += readl(ioaddr + MMC_RX_BROADCASTFRAME_G);
mmc->mmc_rx_multicastframe_g += readl(ioaddr + MMC_RX_MULTICASTFRAME_G);
mmc->mmc_rx_crc_errror += readl(ioaddr + MMC_RX_CRC_ERRROR);
mmc->mmc_rx_align_error += readl(ioaddr + MMC_RX_ALIGN_ERROR);
mmc->mmc_rx_run_error += readl(ioaddr + MMC_RX_RUN_ERROR);
mmc->mmc_rx_jabber_error += readl(ioaddr + MMC_RX_JABBER_ERROR);
mmc->mmc_rx_undersize_g += readl(ioaddr + MMC_RX_UNDERSIZE_G);
mmc->mmc_rx_oversize_g += readl(ioaddr + MMC_RX_OVERSIZE_G);
mmc->mmc_rx_64_octets_gb += readl(ioaddr + MMC_RX_64_OCTETS_GB);
mmc->mmc_rx_65_to_127_octets_gb +=
readl(ioaddr + MMC_RX_65_TO_127_OCTETS_GB);
mmc->mmc_rx_128_to_255_octets_gb +=
readl(ioaddr + MMC_RX_128_TO_255_OCTETS_GB);
mmc->mmc_rx_256_to_511_octets_gb +=
readl(ioaddr + MMC_RX_256_TO_511_OCTETS_GB);
mmc->mmc_rx_512_to_1023_octets_gb +=
readl(ioaddr + MMC_RX_512_TO_1023_OCTETS_GB);
mmc->mmc_rx_1024_to_max_octets_gb +=
readl(ioaddr + MMC_RX_1024_TO_MAX_OCTETS_GB);
mmc->mmc_rx_unicast_g += readl(ioaddr + MMC_RX_UNICAST_G);
mmc->mmc_rx_length_error += readl(ioaddr + MMC_RX_LENGTH_ERROR);
mmc->mmc_rx_autofrangetype += readl(ioaddr + MMC_RX_AUTOFRANGETYPE);
mmc->mmc_rx_pause_frames += readl(ioaddr + MMC_RX_PAUSE_FRAMES);
mmc->mmc_rx_fifo_overflow += readl(ioaddr + MMC_RX_FIFO_OVERFLOW);
mmc->mmc_rx_vlan_frames_gb += readl(ioaddr + MMC_RX_VLAN_FRAMES_GB);
mmc->mmc_rx_watchdog_error += readl(ioaddr + MMC_RX_WATCHDOG_ERROR);
/* IPC */
mmc->mmc_rx_ipc_intr_mask += readl(ioaddr + MMC_RX_IPC_INTR_MASK);
mmc->mmc_rx_ipc_intr += readl(ioaddr + MMC_RX_IPC_INTR);
/* IPv4 */
mmc->mmc_rx_ipv4_gd += readl(ioaddr + MMC_RX_IPV4_GD);
mmc->mmc_rx_ipv4_hderr += readl(ioaddr + MMC_RX_IPV4_HDERR);
mmc->mmc_rx_ipv4_nopay += readl(ioaddr + MMC_RX_IPV4_NOPAY);
mmc->mmc_rx_ipv4_frag += readl(ioaddr + MMC_RX_IPV4_FRAG);
mmc->mmc_rx_ipv4_udsbl += readl(ioaddr + MMC_RX_IPV4_UDSBL);
mmc->mmc_rx_ipv4_gd_octets += readl(ioaddr + MMC_RX_IPV4_GD_OCTETS);
mmc->mmc_rx_ipv4_hderr_octets +=
readl(ioaddr + MMC_RX_IPV4_HDERR_OCTETS);
mmc->mmc_rx_ipv4_nopay_octets +=
readl(ioaddr + MMC_RX_IPV4_NOPAY_OCTETS);
mmc->mmc_rx_ipv4_frag_octets += readl(ioaddr + MMC_RX_IPV4_FRAG_OCTETS);
mmc->mmc_rx_ipv4_udsbl_octets +=
readl(ioaddr + MMC_RX_IPV4_UDSBL_OCTETS);
/* IPV6 */
mmc->mmc_rx_ipv6_gd_octets += readl(ioaddr + MMC_RX_IPV6_GD_OCTETS);
mmc->mmc_rx_ipv6_hderr_octets +=
readl(ioaddr + MMC_RX_IPV6_HDERR_OCTETS);
mmc->mmc_rx_ipv6_nopay_octets +=
readl(ioaddr + MMC_RX_IPV6_NOPAY_OCTETS);
mmc->mmc_rx_ipv6_gd += readl(ioaddr + MMC_RX_IPV6_GD);
mmc->mmc_rx_ipv6_hderr += readl(ioaddr + MMC_RX_IPV6_HDERR);
mmc->mmc_rx_ipv6_nopay += readl(ioaddr + MMC_RX_IPV6_NOPAY);
/* Protocols */
mmc->mmc_rx_udp_gd += readl(ioaddr + MMC_RX_UDP_GD);
mmc->mmc_rx_udp_err += readl(ioaddr + MMC_RX_UDP_ERR);
mmc->mmc_rx_tcp_gd += readl(ioaddr + MMC_RX_TCP_GD);
mmc->mmc_rx_tcp_err += readl(ioaddr + MMC_RX_TCP_ERR);
mmc->mmc_rx_icmp_gd += readl(ioaddr + MMC_RX_ICMP_GD);
mmc->mmc_rx_icmp_err += readl(ioaddr + MMC_RX_ICMP_ERR);
mmc->mmc_rx_udp_gd_octets += readl(ioaddr + MMC_RX_UDP_GD_OCTETS);
mmc->mmc_rx_udp_err_octets += readl(ioaddr + MMC_RX_UDP_ERR_OCTETS);
mmc->mmc_rx_tcp_gd_octets += readl(ioaddr + MMC_RX_TCP_GD_OCTETS);
mmc->mmc_rx_tcp_err_octets += readl(ioaddr + MMC_RX_TCP_ERR_OCTETS);
mmc->mmc_rx_icmp_gd_octets += readl(ioaddr + MMC_RX_ICMP_GD_OCTETS);
mmc->mmc_rx_icmp_err_octets += readl(ioaddr + MMC_RX_ICMP_ERR_OCTETS);
}

View File

@@ -23,6 +23,7 @@
*******************************************************************************/
#include "common.h"
#include "descs_com.h"
static int ndesc_get_tx_status(void *data, struct stmmac_extra_stats *x,
struct dma_desc *p, void __iomem *ioaddr)
@@ -49,11 +50,12 @@ static int ndesc_get_tx_status(void *data, struct stmmac_extra_stats *x,
stats->collisions += p->des01.tx.collision_count;
ret = -1;
}
if (unlikely(p->des01.tx.heartbeat_fail)) {
x->tx_heartbeat++;
stats->tx_heartbeat_errors++;
ret = -1;
if (p->des01.etx.vlan_frame) {
CHIP_DBG(KERN_INFO "GMAC TX status: VLAN frame\n");
x->tx_vlan++;
}
if (unlikely(p->des01.tx.deferred))
x->tx_deferred++;
@@ -67,12 +69,12 @@ static int ndesc_get_tx_len(struct dma_desc *p)
/* This function verifies if each incoming frame has some errors
* and, if required, updates the multicast statistics.
* In case of success, it returns csum_none becasue the device
* is not able to compute the csum in HW. */
* In case of success, it returns good_frame because the GMAC device
* is supposed to be able to compute the csum in HW. */
static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
struct dma_desc *p)
{
int ret = csum_none;
int ret = good_frame;
struct net_device_stats *stats = (struct net_device_stats *)data;
if (unlikely(p->des01.rx.last_descriptor == 0)) {
@@ -85,12 +87,12 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
if (unlikely(p->des01.rx.error_summary)) {
if (unlikely(p->des01.rx.descriptor_error))
x->rx_desc++;
if (unlikely(p->des01.rx.partial_frame_error))
x->rx_partial++;
if (unlikely(p->des01.rx.run_frame))
x->rx_runt++;
if (unlikely(p->des01.rx.frame_too_long))
x->rx_toolong++;
if (unlikely(p->des01.rx.sa_filter_fail))
x->sa_filter_fail++;
if (unlikely(p->des01.rx.overflow_error))
x->overflow_error++;
if (unlikely(p->des01.rx.ipc_csum_error))
x->ipc_csum_error++;
if (unlikely(p->des01.rx.collision)) {
x->rx_collision++;
stats->collisions++;
@@ -102,7 +104,7 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
ret = discard_frame;
}
if (unlikely(p->des01.rx.dribbling))
ret = discard_frame;
x->dribbling_bit++;
if (unlikely(p->des01.rx.length_error)) {
x->rx_length++;
@@ -112,10 +114,10 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
x->rx_mii++;
ret = discard_frame;
}
if (p->des01.rx.multicast_frame) {
x->rx_multicast++;
stats->multicast++;
}
#ifdef STMMAC_VLAN_TAG_USED
if (p->des01.rx.vlan_tag)
x->vlan_tag++;
#endif
return ret;
}
@@ -126,8 +128,9 @@ static void ndesc_init_rx_desc(struct dma_desc *p, unsigned int ring_size,
for (i = 0; i < ring_size; i++) {
p->des01.rx.own = 1;
p->des01.rx.buffer1_size = BUF_SIZE_2KiB - 1;
if (i == ring_size - 1)
p->des01.rx.end_ring = 1;
ndesc_rx_set_on_ring_chain(p, (i == ring_size - 1));
if (disable_rx_ic)
p->des01.rx.disable_ic = 1;
p++;
@@ -139,8 +142,7 @@ static void ndesc_init_tx_desc(struct dma_desc *p, unsigned int ring_size)
int i;
for (i = 0; i < ring_size; i++) {
p->des01.tx.own = 0;
if (i == ring_size - 1)
p->des01.tx.end_ring = 1;
ndesc_tx_set_on_ring_chain(p, (i == (ring_size - 1)));
p++;
}
}
@@ -175,15 +177,17 @@ static void ndesc_release_tx_desc(struct dma_desc *p)
int ter = p->des01.tx.end_ring;
memset(p, 0, offsetof(struct dma_desc, des2));
/* set termination field */
p->des01.tx.end_ring = ter;
ndesc_end_tx_desc(p, ter);
}
static void ndesc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
int csum_flag)
{
p->des01.tx.first_segment = is_fs;
p->des01.tx.buffer1_size = len;
norm_set_tx_desc_len(p, len);
if (likely(csum_flag))
p->des01.tx.checksum_insertion = cic_full;
}
static void ndesc_clear_tx_ic(struct dma_desc *p)

View File

@@ -0,0 +1,126 @@
/*******************************************************************************
Specialised functions for managing Ring mode
Copyright(C) 2011 STMicroelectronics Ltd
It defines all the functions used to handle the normal/enhanced
descriptors in case of the DMA is configured to work in chained or
in ring mode.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope 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.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
#include "stmmac.h"
static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum)
{
struct stmmac_priv *priv = (struct stmmac_priv *) p;
unsigned int txsize = priv->dma_tx_size;
unsigned int entry = priv->cur_tx % txsize;
struct dma_desc *desc = priv->dma_tx + entry;
unsigned int nopaged_len = skb_headlen(skb);
unsigned int bmax, len;
if (priv->plat->enh_desc)
bmax = BUF_SIZE_8KiB;
else
bmax = BUF_SIZE_2KiB;
len = nopaged_len - bmax;
if (nopaged_len > BUF_SIZE_8KiB) {
desc->des2 = dma_map_single(priv->device, skb->data,
bmax, DMA_TO_DEVICE);
desc->des3 = desc->des2 + BUF_SIZE_4KiB;
priv->hw->desc->prepare_tx_desc(desc, 1, bmax,
csum);
entry = (++priv->cur_tx) % txsize;
desc = priv->dma_tx + entry;
desc->des2 = dma_map_single(priv->device, skb->data + bmax,
len, DMA_TO_DEVICE);
desc->des3 = desc->des2 + BUF_SIZE_4KiB;
priv->hw->desc->prepare_tx_desc(desc, 0, len, csum);
priv->hw->desc->set_tx_owner(desc);
priv->tx_skbuff[entry] = NULL;
} else {
desc->des2 = dma_map_single(priv->device, skb->data,
nopaged_len, DMA_TO_DEVICE);
desc->des3 = desc->des2 + BUF_SIZE_4KiB;
priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, csum);
}
return entry;
}
static unsigned int stmmac_is_jumbo_frm(int len, int enh_desc)
{
unsigned int ret = 0;
if (len >= BUF_SIZE_4KiB)
ret = 1;
return ret;
}
static void stmmac_refill_desc3(int bfsize, struct dma_desc *p)
{
/* Fill DES3 in case of RING mode */
if (bfsize >= BUF_SIZE_8KiB)
p->des3 = p->des2 + BUF_SIZE_8KiB;
}
/* In ring mode we need to fill the desc3 because it is used
* as buffer */
static void stmmac_init_desc3(int des3_as_data_buf, struct dma_desc *p)
{
if (unlikely(des3_as_data_buf))
p->des3 = p->des2 + BUF_SIZE_8KiB;
}
static void stmmac_init_dma_chain(struct dma_desc *des, dma_addr_t phy_addr,
unsigned int size)
{
}
static void stmmac_clean_desc3(struct dma_desc *p)
{
if (unlikely(p->des3))
p->des3 = 0;
}
static int stmmac_set_16kib_bfsize(int mtu)
{
int ret = 0;
if (unlikely(mtu >= BUF_SIZE_8KiB))
ret = BUF_SIZE_16KiB;
return ret;
}
const struct stmmac_ring_mode_ops ring_mode_ops = {
.is_jumbo_frm = stmmac_is_jumbo_frm,
.jumbo_frm = stmmac_jumbo_frm,
.refill_desc3 = stmmac_refill_desc3,
.init_desc3 = stmmac_init_desc3,
.init_dma_chain = stmmac_init_dma_chain,
.clean_desc3 = stmmac_clean_desc3,
.set_16kib_bfsize = stmmac_set_16kib_bfsize,
};

View File

@@ -20,9 +20,11 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
#define DRV_MODULE_VERSION "Nov_2010"
#define STMMAC_RESOURCE_NAME "stmmaceth"
#define DRV_MODULE_VERSION "Feb_2012"
#include <linux/stmmac.h>
#include <linux/phy.h>
#include <linux/pm_runtime.h>
#include "common.h"
#ifdef CONFIG_STMMAC_TIMER
#include "stmmac_timer.h"
@@ -70,8 +72,9 @@ struct stmmac_priv {
u32 msg_enable;
spinlock_t lock;
spinlock_t tx_lock;
int wolopts;
int wolenabled;
int wol_irq;
#ifdef CONFIG_STMMAC_TIMER
struct stmmac_timer *tm;
#endif
@@ -79,10 +82,33 @@ struct stmmac_priv {
struct vlan_group *vlgrp;
#endif
struct plat_stmmacenet_data *plat;
struct stmmac_counters mmc;
struct dma_features dma_cap;
int hw_cap_support;
struct timer_list eee_ctrl_timer;
bool tx_path_in_lpi_mode;
bool eee_enabled;
int lpi_irq;
int phy_wol_plus;
u32 lpi_ctl_status;
};
extern int phyaddr;
extern int stmmac_mdio_unregister(struct net_device *ndev);
extern int stmmac_mdio_register(struct net_device *ndev);
extern void stmmac_set_ethtool_ops(struct net_device *netdev);
extern const struct stmmac_desc_ops enh_desc_ops;
extern const struct stmmac_desc_ops ndesc_ops;
int stmmac_freeze(struct net_device *ndev);
int stmmac_restore(struct net_device *ndev);
int stmmac_resume(struct net_device *ndev);
int stmmac_suspend(struct net_device *ndev);
int stmmac_dvr_remove(struct net_device *ndev);
struct stmmac_priv *stmmac_dvr_probe(struct device *device,
struct plat_stmmacenet_data *plat_dat,
void __iomem *addr);
void stmmac_disable_eee_mode(struct stmmac_priv *priv);
bool stmmac_eee_init(struct stmmac_priv *priv);

View File

@@ -44,24 +44,26 @@ struct stmmac_stats {
{ #m, FIELD_SIZEOF(struct stmmac_extra_stats, m), \
offsetof(struct stmmac_priv, xstats.m)}
static const struct stmmac_stats stmmac_gstrings_stats[] = {
static const struct stmmac_stats stmmac_gstrings_stats[] = {
/* Transmit errors */
STMMAC_STAT(tx_underflow),
STMMAC_STAT(tx_carrier),
STMMAC_STAT(tx_losscarrier),
STMMAC_STAT(tx_heartbeat),
STMMAC_STAT(vlan_tag),
STMMAC_STAT(tx_deferred),
STMMAC_STAT(tx_vlan),
STMMAC_STAT(rx_vlan),
STMMAC_STAT(tx_jabber),
STMMAC_STAT(tx_frame_flushed),
STMMAC_STAT(tx_payload_error),
STMMAC_STAT(tx_ip_header_error),
/* Receive errors */
STMMAC_STAT(rx_desc),
STMMAC_STAT(rx_partial),
STMMAC_STAT(rx_runt),
STMMAC_STAT(rx_toolong),
STMMAC_STAT(sa_filter_fail),
STMMAC_STAT(overflow_error),
STMMAC_STAT(ipc_csum_error),
STMMAC_STAT(rx_collision),
STMMAC_STAT(rx_crc),
STMMAC_STAT(dribbling_bit),
STMMAC_STAT(rx_length),
STMMAC_STAT(rx_mii),
STMMAC_STAT(rx_multicast),
@@ -71,6 +73,8 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
STMMAC_STAT(sa_rx_filter_fail),
STMMAC_STAT(rx_missed_cntr),
STMMAC_STAT(rx_overflow_cntr),
STMMAC_STAT(rx_vlan),
/* Tx/Rx IRQ errors */
STMMAC_STAT(tx_undeflow_irq),
STMMAC_STAT(tx_process_stopped_irq),
STMMAC_STAT(tx_jabber_irq),
@@ -80,28 +84,128 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
STMMAC_STAT(rx_watchdog_irq),
STMMAC_STAT(tx_early_irq),
STMMAC_STAT(fatal_bus_error_irq),
/* Extra info */
STMMAC_STAT(threshold),
STMMAC_STAT(tx_pkt_n),
STMMAC_STAT(rx_pkt_n),
STMMAC_STAT(poll_n),
STMMAC_STAT(sched_timer_n),
STMMAC_STAT(normal_irq_n),
STMMAC_STAT(normal_irq_n),
STMMAC_STAT(mmc_tx_irq_n),
STMMAC_STAT(mmc_rx_irq_n),
STMMAC_STAT(mmc_rx_csum_offload_irq_n),
STMMAC_STAT(irq_receive_pmt_irq_n),
STMMAC_STAT(irq_tx_path_in_lpi_mode_n),
STMMAC_STAT(irq_tx_path_exit_lpi_mode_n),
STMMAC_STAT(irq_rx_path_in_lpi_mode_n),
STMMAC_STAT(irq_rx_path_exit_lpi_mode_n),
STMMAC_STAT(phy_eee_wakeup_error_n),
};
#define STMMAC_STATS_LEN ARRAY_SIZE(stmmac_gstrings_stats)
/* HW MAC Management counters (if supported) */
#define STMMAC_MMC_STAT(m) \
{ #m, FIELD_SIZEOF(struct stmmac_counters, m), \
offsetof(struct stmmac_priv, mmc.m)}
static const struct stmmac_stats stmmac_mmc[] = {
STMMAC_MMC_STAT(mmc_tx_octetcount_gb),
STMMAC_MMC_STAT(mmc_tx_framecount_gb),
STMMAC_MMC_STAT(mmc_tx_broadcastframe_g),
STMMAC_MMC_STAT(mmc_tx_multicastframe_g),
STMMAC_MMC_STAT(mmc_tx_64_octets_gb),
STMMAC_MMC_STAT(mmc_tx_65_to_127_octets_gb),
STMMAC_MMC_STAT(mmc_tx_128_to_255_octets_gb),
STMMAC_MMC_STAT(mmc_tx_256_to_511_octets_gb),
STMMAC_MMC_STAT(mmc_tx_512_to_1023_octets_gb),
STMMAC_MMC_STAT(mmc_tx_1024_to_max_octets_gb),
STMMAC_MMC_STAT(mmc_tx_unicast_gb),
STMMAC_MMC_STAT(mmc_tx_multicast_gb),
STMMAC_MMC_STAT(mmc_tx_broadcast_gb),
STMMAC_MMC_STAT(mmc_tx_underflow_error),
STMMAC_MMC_STAT(mmc_tx_singlecol_g),
STMMAC_MMC_STAT(mmc_tx_multicol_g),
STMMAC_MMC_STAT(mmc_tx_deferred),
STMMAC_MMC_STAT(mmc_tx_latecol),
STMMAC_MMC_STAT(mmc_tx_exesscol),
STMMAC_MMC_STAT(mmc_tx_carrier_error),
STMMAC_MMC_STAT(mmc_tx_octetcount_g),
STMMAC_MMC_STAT(mmc_tx_framecount_g),
STMMAC_MMC_STAT(mmc_tx_excessdef),
STMMAC_MMC_STAT(mmc_tx_pause_frame),
STMMAC_MMC_STAT(mmc_tx_vlan_frame_g),
STMMAC_MMC_STAT(mmc_rx_framecount_gb),
STMMAC_MMC_STAT(mmc_rx_octetcount_gb),
STMMAC_MMC_STAT(mmc_rx_octetcount_g),
STMMAC_MMC_STAT(mmc_rx_broadcastframe_g),
STMMAC_MMC_STAT(mmc_rx_multicastframe_g),
STMMAC_MMC_STAT(mmc_rx_crc_errror),
STMMAC_MMC_STAT(mmc_rx_align_error),
STMMAC_MMC_STAT(mmc_rx_run_error),
STMMAC_MMC_STAT(mmc_rx_jabber_error),
STMMAC_MMC_STAT(mmc_rx_undersize_g),
STMMAC_MMC_STAT(mmc_rx_oversize_g),
STMMAC_MMC_STAT(mmc_rx_64_octets_gb),
STMMAC_MMC_STAT(mmc_rx_65_to_127_octets_gb),
STMMAC_MMC_STAT(mmc_rx_128_to_255_octets_gb),
STMMAC_MMC_STAT(mmc_rx_256_to_511_octets_gb),
STMMAC_MMC_STAT(mmc_rx_512_to_1023_octets_gb),
STMMAC_MMC_STAT(mmc_rx_1024_to_max_octets_gb),
STMMAC_MMC_STAT(mmc_rx_unicast_g),
STMMAC_MMC_STAT(mmc_rx_length_error),
STMMAC_MMC_STAT(mmc_rx_autofrangetype),
STMMAC_MMC_STAT(mmc_rx_pause_frames),
STMMAC_MMC_STAT(mmc_rx_fifo_overflow),
STMMAC_MMC_STAT(mmc_rx_vlan_frames_gb),
STMMAC_MMC_STAT(mmc_rx_watchdog_error),
STMMAC_MMC_STAT(mmc_rx_ipc_intr_mask),
STMMAC_MMC_STAT(mmc_rx_ipc_intr),
STMMAC_MMC_STAT(mmc_rx_ipv4_gd),
STMMAC_MMC_STAT(mmc_rx_ipv4_hderr),
STMMAC_MMC_STAT(mmc_rx_ipv4_nopay),
STMMAC_MMC_STAT(mmc_rx_ipv4_frag),
STMMAC_MMC_STAT(mmc_rx_ipv4_udsbl),
STMMAC_MMC_STAT(mmc_rx_ipv4_gd_octets),
STMMAC_MMC_STAT(mmc_rx_ipv4_hderr_octets),
STMMAC_MMC_STAT(mmc_rx_ipv4_nopay_octets),
STMMAC_MMC_STAT(mmc_rx_ipv4_frag_octets),
STMMAC_MMC_STAT(mmc_rx_ipv4_udsbl_octets),
STMMAC_MMC_STAT(mmc_rx_ipv6_gd_octets),
STMMAC_MMC_STAT(mmc_rx_ipv6_hderr_octets),
STMMAC_MMC_STAT(mmc_rx_ipv6_nopay_octets),
STMMAC_MMC_STAT(mmc_rx_ipv6_gd),
STMMAC_MMC_STAT(mmc_rx_ipv6_hderr),
STMMAC_MMC_STAT(mmc_rx_ipv6_nopay),
STMMAC_MMC_STAT(mmc_rx_udp_gd),
STMMAC_MMC_STAT(mmc_rx_udp_err),
STMMAC_MMC_STAT(mmc_rx_tcp_gd),
STMMAC_MMC_STAT(mmc_rx_tcp_err),
STMMAC_MMC_STAT(mmc_rx_icmp_gd),
STMMAC_MMC_STAT(mmc_rx_icmp_err),
STMMAC_MMC_STAT(mmc_rx_udp_gd_octets),
STMMAC_MMC_STAT(mmc_rx_udp_err_octets),
STMMAC_MMC_STAT(mmc_rx_tcp_gd_octets),
STMMAC_MMC_STAT(mmc_rx_tcp_err_octets),
STMMAC_MMC_STAT(mmc_rx_icmp_gd_octets),
STMMAC_MMC_STAT(mmc_rx_icmp_err_octets),
};
#define STMMAC_MMC_STATS_LEN ARRAY_SIZE(stmmac_mmc)
static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
struct stmmac_priv *priv = netdev_priv(dev);
if (!priv->plat->has_gmac)
strcpy(info->driver, MAC100_ETHTOOL_NAME);
info->n_stats = STMMAC_STATS_LEN;
if (priv->plat->has_gmac)
info->n_stats += STMMAC_MMC_STATS_LEN;
else
strcpy(info->driver, GMAC_ETHTOOL_NAME);
strcpy(info->driver, MAC100_ETHTOOL_NAME);
strcpy(info->version, DRV_MODULE_VERSION);
info->fw_version[0] = '\0';
info->n_stats = STMMAC_STATS_LEN;
}
static int stmmac_ethtool_getsettings(struct net_device *dev,
@@ -197,16 +301,6 @@ static void stmmac_ethtool_gregs(struct net_device *dev,
}
}
static int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data)
{
if (data)
netdev->features |= NETIF_F_HW_CSUM;
else
netdev->features &= ~NETIF_F_HW_CSUM;
return 0;
}
static u32 stmmac_ethtool_get_rx_csum(struct net_device *dev)
{
struct stmmac_priv *priv = netdev_priv(dev);
@@ -267,24 +361,53 @@ static void stmmac_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *dummy, u64 *data)
{
struct stmmac_priv *priv = netdev_priv(dev);
int i;
int i, j = 0;
/* Update HW stats if supported */
priv->hw->dma->dma_diagnostic_fr(&dev->stats, (void *) &priv->xstats,
priv->ioaddr);
/* Update the DMA HW counters for dwmac10/100 */
if (!priv->plat->has_gmac)
priv->hw->dma->dma_diagnostic_fr(&dev->stats,
(void *) &priv->xstats,
priv->ioaddr);
else {
/* If supported, for new GMAC chips expose the MMC counters */
if (priv->dma_cap.rmon) {
dwmac_mmc_read(priv->ioaddr, &priv->mmc);
for (i = 0; i < STMMAC_MMC_STATS_LEN; i++) {
char *p;
p = (char *)priv + stmmac_mmc[i].stat_offset;
data[j++] = (stmmac_mmc[i].sizeof_stat ==
sizeof(u64)) ? (*(u64 *)p) :
(*(u32 *)p);
}
}
if (priv->eee_enabled) {
int val = phy_get_eee_err(priv->phydev);
if (val)
priv->xstats.phy_eee_wakeup_error_n = val;
}
}
for (i = 0; i < STMMAC_STATS_LEN; i++) {
char *p = (char *)priv + stmmac_gstrings_stats[i].stat_offset;
data[i] = (stmmac_gstrings_stats[i].sizeof_stat ==
sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p);
data[j++] = (stmmac_gstrings_stats[i].sizeof_stat ==
sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p);
}
}
static int stmmac_get_sset_count(struct net_device *netdev, int sset)
{
struct stmmac_priv *priv = netdev_priv(netdev);
int len;
switch (sset) {
case ETH_SS_STATS:
return STMMAC_STATS_LEN;
len = STMMAC_STATS_LEN;
if (priv->dma_cap.rmon)
len += STMMAC_MMC_STATS_LEN;
return len;
default:
return -EOPNOTSUPP;
}
@@ -294,9 +417,16 @@ static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data)
{
int i;
u8 *p = data;
struct stmmac_priv *priv = netdev_priv(dev);
switch (stringset) {
case ETH_SS_STATS:
if (priv->dma_cap.rmon)
for (i = 0; i < STMMAC_MMC_STATS_LEN; i++) {
memcpy(p, stmmac_mmc[i].stat_string,
ETH_GSTRING_LEN);
p += ETH_GSTRING_LEN;
}
for (i = 0; i < STMMAC_STATS_LEN; i++) {
memcpy(p, stmmac_gstrings_stats[i].stat_string,
ETH_GSTRING_LEN);
@@ -319,6 +449,7 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
wol->supported = WAKE_MAGIC | WAKE_UCAST;
wol->wolopts = priv->wolopts;
}
/* FIXME: get WoL from PHY that supports Wol+ */
spin_unlock_irq(&priv->lock);
}
@@ -327,6 +458,24 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
struct stmmac_priv *priv = netdev_priv(dev);
u32 support = WAKE_MAGIC | WAKE_UCAST;
if (priv->phy_wol_plus & wol->wolopts) {
int ret;
pr_info("stmmac: use Phy WoL+\n");
spin_lock_irq(&priv->lock);
ret = phy_ethtool_set_wol(priv->phydev, wol);
spin_unlock_irq(&priv->lock);
return ret;
}
/* By default almost all GMAC devices support the WoL via
* magic frame but we can disable it if the HW capability
* register shows no support for pmt_magic_frame. */
if ((priv->hw_cap_support) && (!priv->dma_cap.pmt_magic_frame))
wol->wolopts &= ~WAKE_MAGIC;
if (!device_can_wakeup(priv->device))
return -EINVAL;
@@ -336,10 +485,10 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
if (wol->wolopts) {
pr_info("stmmac: wakeup enable\n");
device_set_wakeup_enable(priv->device, 1);
enable_irq_wake(dev->irq);
enable_irq_wake(priv->wol_irq);
} else {
device_set_wakeup_enable(priv->device, 0);
disable_irq_wake(dev->irq);
disable_irq_wake(priv->wol_irq);
}
spin_lock_irq(&priv->lock);
@@ -349,6 +498,50 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
return 0;
}
static int ethtool_op_get_eee(struct net_device *dev, struct ethtool_value *eee)
{
struct stmmac_priv *priv = netdev_priv(dev);
if (!priv->dma_cap.eee)
return -EOPNOTSUPP;
eee->data = priv->eee_enabled;
return 0;
}
static int ethtool_op_set_eee(struct net_device *dev, struct ethtool_value *eee)
{
struct stmmac_priv *priv = netdev_priv(dev);
if ((!eee->data) && (priv->eee_enabled)) {
stmmac_disable_eee_mode(priv);
priv->eee_enabled = eee->data;
} else if ((eee->data) && (!priv->eee_enabled))
/* We are asking for enabling the EEE but this
* has to be verified by invoking the eee_init function.
* For this reason we cannot set eee_enabled to
* eee->data, directly. */
priv->eee_enabled = stmmac_eee_init(priv);
return 0;
}
static int stmmac_ethtool_begin(struct net_device *netdev)
{
struct stmmac_priv *priv = netdev_priv(netdev);
pm_runtime_get_sync(priv->device);
return 0;
}
static void stmmac_ethtool_complete(struct net_device *netdev)
{
struct stmmac_priv *priv = netdev_priv(netdev);
pm_runtime_put(priv->device);
}
static struct ethtool_ops stmmac_ethtool_ops = {
.begin = stmmac_check_if_running,
.get_drvinfo = stmmac_ethtool_getdrvinfo,
@@ -361,7 +554,7 @@ static struct ethtool_ops stmmac_ethtool_ops = {
.get_link = ethtool_op_get_link,
.get_rx_csum = stmmac_ethtool_get_rx_csum,
.get_tx_csum = ethtool_op_get_tx_csum,
.set_tx_csum = stmmac_ethtool_set_tx_csum,
.set_tx_csum = ethtool_op_set_tx_ipv6_csum,
.get_sg = ethtool_op_get_sg,
.set_sg = ethtool_op_set_sg,
.get_pauseparam = stmmac_get_pauseparam,
@@ -373,6 +566,10 @@ static struct ethtool_ops stmmac_ethtool_ops = {
.get_sset_count = stmmac_get_sset_count,
.get_tso = ethtool_op_get_tso,
.set_tso = ethtool_op_set_tso,
.get_eee = ethtool_op_get_eee,
.set_eee = ethtool_op_set_eee,
.begin = stmmac_ethtool_begin,
.complete = stmmac_ethtool_complete,
};
void stmmac_set_ethtool_ops(struct net_device *netdev)

File diff suppressed because it is too large Load Diff

View File

@@ -107,6 +107,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
*/
static int stmmac_mdio_reset(struct mii_bus *bus)
{
#if defined(CONFIG_STMMAC_PLATFORM)
struct net_device *ndev = bus->priv;
struct stmmac_priv *priv = netdev_priv(ndev);
unsigned int mii_address = priv->hw->mii.addr;
@@ -121,7 +122,7 @@ static int stmmac_mdio_reset(struct mii_bus *bus)
* on MDC, so perform a dummy mdio read.
*/
writel(0, priv->ioaddr + mii_address);
#endif
return 0;
}
@@ -183,7 +184,9 @@ int stmmac_mdio_register(struct net_device *ndev)
if ((mdio_bus_data->irqs == NULL) &&
(mdio_bus_data->probed_phy_irq > 0)) {
irqlist[addr] = mdio_bus_data->probed_phy_irq;
phydev->irq = mdio_bus_data->probed_phy_irq;
if (!phydev->drv ||
(phydev->drv->flags & PHY_HAS_INTERRUPT))
phydev->irq = irqlist[addr];
}
/*
@@ -217,8 +220,15 @@ int stmmac_mdio_register(struct net_device *ndev)
}
}
if (!found)
if (!found) {
pr_warning("%s: No PHY found\n", ndev->name);
/* Un-register the Bus and report an error */
mdiobus_unregister(new_bus);
priv->mii->priv = NULL;
mdiobus_free(new_bus);
priv->mii = NULL;
return -ENODEV;
}
return 0;

View File

@@ -0,0 +1,219 @@
/*******************************************************************************
This contains the functions to handle the pci driver.
Copyright (C) 2011-2012 Vayavya Labs Pvt Ltd
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope 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.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Author: Rayagond Kokatanur <rayagond@vayavyalabs.com>
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
#include <linux/pci.h>
#include "stmmac.h"
struct plat_stmmacenet_data plat_dat;
struct stmmac_mdio_bus_data mdio_data;
static void stmmac_default_data(void)
{
memset(&plat_dat, 0, sizeof(struct plat_stmmacenet_data));
plat_dat.bus_id = 1;
plat_dat.phy_addr = 0;
plat_dat.interface = PHY_INTERFACE_MODE_GMII;
plat_dat.pbl = 32;
plat_dat.clk_csr = 2; /* clk_csr_i = 20-35MHz & MDC = clk_csr_i/16 */
plat_dat.has_gmac = 1;
plat_dat.force_sf_dma_mode = 1;
mdio_data.bus_id = 1;
mdio_data.phy_reset = NULL;
mdio_data.phy_mask = 0;
plat_dat.mdio_bus_data = &mdio_data;
}
/**
* stmmac_pci_probe
*
* @pdev: pci device pointer
* @id: pointer to table of device id/id's.
*
* Description: This probing function gets called for all PCI devices which
* match the ID table and are not "owned" by other driver yet. This function
* gets passed a "struct pci_dev *" for each device whose entry in the ID table
* matches the device. The probe functions returns zero when the driver choose
* to take "ownership" of the device or an error code(-ve no) otherwise.
*/
static int __devinit stmmac_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
int ret = 0;
void __iomem *addr = NULL;
struct stmmac_priv *priv = NULL;
int i;
/* Enable pci device */
ret = pci_enable_device(pdev);
if (ret) {
pr_err("%s : ERROR: failed to enable %s device\n", __func__,
pci_name(pdev));
return ret;
}
if (pci_request_regions(pdev, STMMAC_RESOURCE_NAME)) {
pr_err("%s: ERROR: failed to get PCI region\n", __func__);
ret = -ENODEV;
goto err_out_req_reg_failed;
}
/* Get the base address of device */
for (i = 0; i <= 5; i++) {
if (pci_resource_len(pdev, i) == 0)
continue;
addr = pci_iomap(pdev, i, 0);
if (addr == NULL) {
pr_err("%s: ERROR: cannot map regiser memory, aborting",
__func__);
ret = -EIO;
goto err_out_map_failed;
}
break;
}
pci_set_master(pdev);
stmmac_default_data();
priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat, addr);
if (!priv) {
pr_err("%s: main driver probe failed", __func__);
goto err_out;
}
priv->dev->irq = pdev->irq;
priv->wol_irq = pdev->irq;
pci_set_drvdata(pdev, priv->dev);
pr_debug("STMMAC platform driver registration completed");
return 0;
err_out:
pci_clear_master(pdev);
err_out_map_failed:
pci_release_regions(pdev);
err_out_req_reg_failed:
pci_disable_device(pdev);
return ret;
}
/**
* stmmac_dvr_remove
*
* @pdev: platform device pointer
* Description: this function calls the main to free the net resources
* and releases the PCI resources.
*/
static void __devexit stmmac_pci_remove(struct pci_dev *pdev)
{
struct net_device *ndev = pci_get_drvdata(pdev);
struct stmmac_priv *priv = netdev_priv(ndev);
stmmac_dvr_remove(ndev);
pci_set_drvdata(pdev, NULL);
pci_iounmap(pdev, priv->ioaddr);
pci_release_regions(pdev);
pci_disable_device(pdev);
}
#ifdef CONFIG_PM
static int stmmac_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct net_device *ndev = pci_get_drvdata(pdev);
int ret;
ret = stmmac_suspend(ndev);
pci_save_state(pdev);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
return ret;
}
static int stmmac_pci_resume(struct pci_dev *pdev)
{
struct net_device *ndev = pci_get_drvdata(pdev);
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
return stmmac_resume(ndev);
}
#endif
#define STMMAC_VENDOR_ID 0x700
#define STMMAC_DEVICE_ID 0x1108
static DEFINE_PCI_DEVICE_TABLE(stmmac_id_table) = {
{
PCI_DEVICE(STMMAC_VENDOR_ID, STMMAC_DEVICE_ID)}, {
}
};
MODULE_DEVICE_TABLE(pci, stmmac_id_table);
static struct pci_driver stmmac_driver = {
.name = STMMAC_RESOURCE_NAME,
.id_table = stmmac_id_table,
.probe = stmmac_pci_probe,
.remove = __devexit_p(stmmac_pci_remove),
#ifdef CONFIG_PM
.suspend = stmmac_pci_suspend,
.resume = stmmac_pci_resume,
#endif
};
/**
* stmmac_init_module - Entry point for the driver
* Description: This function is the entry point for the driver.
*/
static int __init stmmac_init_module(void)
{
int ret;
ret = pci_register_driver(&stmmac_driver);
if (ret < 0)
pr_err("%s: ERROR: driver registration failed\n", __func__);
return ret;
}
/**
* stmmac_cleanup_module - Cleanup routine for the driver
* Description: This function is the cleanup routine for the driver.
*/
static void __exit stmmac_cleanup_module(void)
{
pci_unregister_driver(&stmmac_driver);
}
module_init(stmmac_init_module);
module_exit(stmmac_cleanup_module);
MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PCI driver");
MODULE_AUTHOR("Rayagond Kokatanur <rayagond.kokatanur@vayavyalabs.com>");
MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
MODULE_LICENSE("GPL");

View File

@@ -0,0 +1,234 @@
/*******************************************************************************
This contains the functions to handle the platform driver.
Copyright (C) 2007-2011 STMicroelectronics Ltd
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope 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.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
#include <linux/platform_device.h>
#include <linux/io.h>
#include "stmmac.h"
/**
* stmmac_pltfr_probe
* @pdev: platform device pointer
* Description: platform_device probe function. It allocates
* the necessary resources and invokes the main to init
* the net device, register the mdio bus etc.
*/
static int stmmac_pltfr_probe(struct platform_device *pdev)
{
int ret = 0;
struct resource *res;
void __iomem *addr = NULL;
struct stmmac_priv *priv = NULL;
struct plat_stmmacenet_data *plat_dat;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
pr_err("%s: ERROR: memory allocation failed"
"cannot get the I/O addr 0x%x\n",
__func__, (unsigned int)res->start);
return -EBUSY;
}
addr = ioremap(res->start, resource_size(res));
if (!addr) {
pr_err("%s: ERROR: memory mapping failed", __func__);
ret = -ENOMEM;
goto out_release_region;
}
plat_dat = pdev->dev.platform_data;
/* Custom initialisation (if needed)*/
if (plat_dat->init) {
ret = plat_dat->init(pdev);
if (unlikely(ret))
goto out_unmap;
}
priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr);
if (!priv) {
pr_err("%s: main driver probe failed", __func__);
goto out_unmap;
}
/* Get the MAC information */
priv->dev->irq = platform_get_irq_byname(pdev, "macirq");
if (priv->dev->irq == -ENXIO) {
pr_err("%s: ERROR: MAC IRQ configuration "
"information not found\n", __func__);
ret = -ENXIO;
goto out_unmap;
}
/*
* On some platforms e.g. SPEAr the wake up irq differs from the mac irq
* The external wake up irq can be passed through the platform code
* named as "eth_wake_irq"
*
* In case the wake up interrupt is not passed from the platform
* so the driver will continue to use the mac irq (ndev->irq)
*/
priv->wol_irq = platform_get_irq_byname(pdev, "eth_wake_irq");
if (priv->wol_irq == -ENXIO)
priv->wol_irq = priv->dev->irq;
priv->lpi_irq = platform_get_irq_byname(pdev, "eth_lpi");
platform_set_drvdata(pdev, priv->dev);
pm_runtime_set_active(&pdev->dev);
pm_suspend_ignore_children(&pdev->dev, 1);
pm_runtime_put_noidle(&pdev->dev);
pm_runtime_enable(&pdev->dev);
pr_debug("STMMAC platform driver registration completed");
return 0;
out_unmap:
iounmap(addr);
platform_set_drvdata(pdev, NULL);
out_release_region:
release_mem_region(res->start, resource_size(res));
return ret;
}
/**
* stmmac_pltfr_remove
* @pdev: platform device pointer
* Description: this function calls the main to free the net resources
* and calls the platforms hook and release the resources (e.g. mem).
*/
static int stmmac_pltfr_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct stmmac_priv *priv = netdev_priv(ndev);
struct resource *res;
int ret = stmmac_dvr_remove(ndev);
pm_runtime_get_noresume(&pdev->dev);
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
if (priv->plat->exit)
priv->plat->exit(pdev);
if (priv->plat->exit)
priv->plat->exit(pdev);
platform_set_drvdata(pdev, NULL);
iounmap((void *)priv->ioaddr);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, resource_size(res));
return ret;
}
#ifdef CONFIG_PM
static int stmmac_pltfr_suspend(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
return stmmac_suspend(ndev);
}
static int stmmac_pltfr_resume(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
return stmmac_resume(ndev);
}
int stmmac_pltfr_freeze(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
return stmmac_freeze(ndev);
}
int stmmac_pltfr_restore(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
return stmmac_restore(ndev);
}
#if 0
int stmmac_pltfr_idle(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
struct stmmac_priv *priv = netdev_priv(ndev);
struct phy_device *phydev = priv->phydev;
#ifdef CONFIG_PM_RUNTIME
if (!phydev->link)
pm_schedule_suspend(dev, MSEC_PER_SEC * 5);
#endif
return -EBUSY;
}
#endif
SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, stmmac_pltfr_suspend, stmmac_pltfr_resume);
#else
static const struct dev_pm_ops stmmac_pltfr_pm_ops;
#endif /* CONFIG_PM */
static struct platform_driver stmmac_driver = {
.probe = stmmac_pltfr_probe,
.remove = stmmac_pltfr_remove,
.driver = {
.name = STMMAC_RESOURCE_NAME,
.owner = THIS_MODULE,
.pm = &stmmac_pltfr_pm_ops,
},
};
/**
* stmmac_init_module - Entry point for the driver
* Description: This function is the entry point for the driver.
*/
static int __init stmmac_init_module(void)
{
return platform_driver_register(&stmmac_driver);
}
/**
* stmmac_cleanup_module - Cleanup routine for the driver
* Description: This function is the cleanup routine for the driver.
*/
static void __exit stmmac_cleanup_module(void)
{
platform_driver_unregister(&stmmac_driver);
}
module_init(stmmac_init_module);
module_exit(stmmac_cleanup_module);
MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PLATFORM driver");
MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
MODULE_LICENSE("GPL");

View File

@@ -49,7 +49,8 @@ config USB_ARCH_HAS_OHCI
default y if CPU_SUBTYPE_SH7721
default y if CPU_SUBTYPE_SH7763
default y if CPU_SUBTYPE_SH7786
default y if CPU_SUBTYPE_FLI7510
default y if CPU_SUBTYPE_FLI75XX
default y if CPU_SUBTYPE_STXH205
default y if CPU_SUBTYPE_STX5197
default y if CPU_SUBTYPE_STX5206
default y if CPU_SUBTYPE_STX7100
@@ -69,7 +70,8 @@ config USB_ARCH_HAS_EHCI
default y if ARCH_IXP4XX
default y if ARCH_W90X900
default y if ARCH_AT91SAM9G45
default y if CPU_SUBTYPE_FLI7510
default y if CPU_SUBTYPE_FLI75XX
default y if CPU_SUBTYPE_STXH205
default y if CPU_SUBTYPE_STX5197
default y if CPU_SUBTYPE_STX5206
default y if CPU_SUBTYPE_STX7100

View File

@@ -1120,7 +1120,8 @@ skip_normal_probe:
}
if (data_interface->cur_altsetting->desc.bNumEndpoints < 2)
if (data_interface->cur_altsetting->desc.bNumEndpoints < 2 ||
control_interface->cur_altsetting->desc.bNumEndpoints == 0)
return -EINVAL;
epctrl = &control_interface->cur_altsetting->endpoint[0].desc;
@@ -1264,6 +1265,8 @@ made_compressed_probe:
i = device_create_file(&intf->dev, &dev_attr_wCountryCodes);
if (i < 0) {
kfree(acm->country_codes);
acm->country_codes = NULL;
acm->country_code_size = 0;
goto skip_countries;
}
@@ -1272,6 +1275,8 @@ made_compressed_probe:
if (i < 0) {
device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
kfree(acm->country_codes);
acm->country_codes = NULL;
acm->country_code_size = 0;
goto skip_countries;
}
}
@@ -1528,6 +1533,16 @@ static struct usb_device_id acm_ids[] = {
},
{ USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */
},
/* Motorola H24 HSPA module: */
{ USB_DEVICE(0x22b8, 0x2d91) }, /* modem */
{ USB_DEVICE(0x22b8, 0x2d92) }, /* modem + diagnostics */
{ USB_DEVICE(0x22b8, 0x2d93) }, /* modem + AT port */
{ USB_DEVICE(0x22b8, 0x2d95) }, /* modem + AT port + diagnostics */
{ USB_DEVICE(0x22b8, 0x2d96) }, /* modem + NMEA */
{ USB_DEVICE(0x22b8, 0x2d97) }, /* modem + diagnostics + NMEA */
{ USB_DEVICE(0x22b8, 0x2d99) }, /* modem + AT port + NMEA */
{ USB_DEVICE(0x22b8, 0x2d9a) }, /* modem + AT port + diagnostics + NMEA */
{ USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */
.driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on
data interface instead of
@@ -1606,6 +1621,9 @@ static struct usb_device_id acm_ids[] = {
{ NOKIA_PCSUITE_ACM_INFO(0x03cd), }, /* Nokia C7 */
{ SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */
/* Support for Owen devices */
{ USB_DEVICE(0x03eb, 0x0030), }, /* Owen SI30 */
/* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */
/* control interfaces without any protocol set */

View File

@@ -52,6 +52,7 @@ MODULE_DEVICE_TABLE (usb, wdm_ids);
#define WDM_READ 4
#define WDM_INT_STALL 5
#define WDM_POLL_RUNNING 6
#define WDM_OVERFLOW 10
#define WDM_MAX 16
@@ -115,6 +116,7 @@ static void wdm_in_callback(struct urb *urb)
{
struct wdm_device *desc = urb->context;
int status = urb->status;
int length = urb->actual_length;
spin_lock(&desc->iuspin);
@@ -144,9 +146,17 @@ static void wdm_in_callback(struct urb *urb)
}
desc->rerr = status;
desc->reslength = urb->actual_length;
memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength);
desc->length += desc->reslength;
if (length + desc->length > desc->wMaxCommand) {
/* The buffer would overflow */
set_bit(WDM_OVERFLOW, &desc->flags);
} else {
/* we may already be in overflow */
if (!test_bit(WDM_OVERFLOW, &desc->flags)) {
memmove(desc->ubuf + desc->length, desc->inbuf, length);
desc->length += length;
desc->reslength = length;
}
}
wake_up(&desc->wait);
set_bit(WDM_READ, &desc->flags);
@@ -277,7 +287,7 @@ static void cleanup(struct wdm_device *desc)
desc->sbuf,
desc->validity->transfer_dma);
usb_buffer_free(interface_to_usbdev(desc->intf),
desc->wMaxCommand,
desc->bMaxPacketSize0,
desc->inbuf,
desc->response->transfer_dma);
kfree(desc->orq);
@@ -314,7 +324,7 @@ static ssize_t wdm_write
if (r < 0)
goto outnp;
if (!file->f_flags && O_NONBLOCK)
if (!(file->f_flags & O_NONBLOCK))
r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE,
&desc->flags));
else
@@ -398,6 +408,11 @@ retry:
rv = -ENODEV;
goto err;
}
if (test_bit(WDM_OVERFLOW, &desc->flags)) {
clear_bit(WDM_OVERFLOW, &desc->flags);
rv = -ENOBUFS;
goto err;
}
i++;
if (file->f_flags & O_NONBLOCK) {
if (!test_bit(WDM_READ, &desc->flags)) {
@@ -440,7 +455,10 @@ retry:
spin_unlock_irq(&desc->iuspin);
goto retry;
}
if (!desc->reslength) { /* zero length read */
dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__);
clear_bit(WDM_READ, &desc->flags);
spin_unlock_irq(&desc->iuspin);
goto retry;
}
@@ -458,7 +476,9 @@ retry:
for (i = 0; i < desc->length - cntr; i++)
desc->ubuf[i] = desc->ubuf[i + cntr];
spin_lock_irq(&desc->iuspin);
desc->length -= cntr;
spin_unlock_irq(&desc->iuspin);
/* in case we had outstanding data */
if (!desc->length)
clear_bit(WDM_READ, &desc->flags);
@@ -840,6 +860,7 @@ static int wdm_post_reset(struct usb_interface *intf)
struct wdm_device *desc = usb_get_intfdata(intf);
int rv;
clear_bit(WDM_OVERFLOW, &desc->flags);
rv = recover_from_urb_loss(desc);
mutex_unlock(&desc->plock);
return 0;

View File

@@ -267,7 +267,7 @@ usbtmc_abort_bulk_in_status:
dev_err(dev, "usb_bulk_msg returned %d\n", rv);
goto exit;
}
} while ((actual = max_size) &&
} while ((actual == max_size) &&
(n < USBTMC_MAX_READS_TO_CLEAR_BULK_IN));
if (actual == max_size) {

View File

@@ -403,7 +403,7 @@ static void async_completed(struct urb *urb)
sinfo.si_errno = as->status;
sinfo.si_code = SI_ASYNCIO;
sinfo.si_addr = as->userurb;
pid = as->pid;
pid = get_pid(as->pid);
uid = as->uid;
euid = as->euid;
secid = as->secid;
@@ -416,9 +416,11 @@ static void async_completed(struct urb *urb)
cancel_bulk_urbs(ps, as->bulk_addr);
spin_unlock(&ps->lock);
if (signr)
if (signr) {
kill_pid_info_as_uid(sinfo.si_signo, &sinfo, pid, uid,
euid, secid);
put_pid(pid);
}
wake_up(&ps->wait);
}
@@ -1452,10 +1454,14 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
void __user *addr = as->userurb;
unsigned int i;
if (as->userbuffer && urb->actual_length)
if (copy_to_user(as->userbuffer, urb->transfer_buffer,
urb->actual_length))
if (as->userbuffer && urb->actual_length) {
if (urb->number_of_packets > 0) /* Isochronous */
i = urb->transfer_buffer_length;
else /* Non-Isoc */
i = urb->actual_length;
if (copy_to_user(as->userbuffer, urb->transfer_buffer, i))
return -EFAULT;
}
if (put_user(as->status, &userurb->status))
return -EFAULT;
if (put_user(urb->actual_length, &userurb->actual_length))

View File

@@ -1187,13 +1187,22 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
for (; i < udev->actconfig->desc.bNumInterfaces; i++) {
intf = udev->actconfig->interface[i];
status = usb_suspend_interface(udev, intf, msg);
/* Ignore errors during system sleep transitions */
if (!(msg.event & PM_EVENT_AUTO))
status = 0;
if (status != 0)
break;
}
}
if (status == 0)
if (status == 0) {
status = usb_suspend_device(udev, msg);
/* Again, ignore errors during system sleep transitions */
if (!(msg.event & PM_EVENT_AUTO))
status = 0;
}
/* If the suspend failed, resume interfaces that did get suspended */
if (status != 0) {
pm_message_t msg2;

View File

@@ -23,6 +23,7 @@
#include <linux/mutex.h>
#include <linux/freezer.h>
#include <linux/usb/quirks.h>
#include <linux/random.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
@@ -458,10 +459,8 @@ hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
* talking to TTs must queue control transfers (not just bulk and iso), so
* both can talk to the same hub concurrently.
*/
static void hub_tt_work(struct work_struct *work)
void _hub_tt_work(struct usb_hub *hub)
{
struct usb_hub *hub =
container_of(work, struct usb_hub, tt.clear_work);
unsigned long flags;
int limit = 100;
@@ -496,6 +495,14 @@ static void hub_tt_work(struct work_struct *work)
spin_unlock_irqrestore (&hub->tt.lock, flags);
}
void hub_tt_work(struct work_struct *work)
{
struct usb_hub *hub =
container_of(work, struct usb_hub, tt.clear_work);
_hub_tt_work(hub);
}
/**
* usb_hub_clear_tt_buffer - clear control/bulk TT state in high speed hub
* @urb: an URB associated with the failed or incomplete split transaction
@@ -543,7 +550,20 @@ int usb_hub_clear_tt_buffer(struct urb *urb)
/* tell keventd to clear state for this TT */
spin_lock_irqsave (&tt->lock, flags);
list_add_tail (&clear->clear_list, &tt->clear_list);
schedule_work(&tt->clear_work);
/* don't schedule on kevent if we're running on keventd (e.g.,
* in hid_reset we can get here on kevent) unless on >=2.6.36
*/
if (!current_is_keventd())
/* put it on keventd */
schedule_work(&tt->clear_work);
else {
/* let khubd do it */
struct usb_hub *hub =
container_of(&tt->clear_work, struct usb_hub,
tt.clear_work);
kick_khubd(hub);
}
spin_unlock_irqrestore (&tt->lock, flags);
return 0;
}
@@ -1812,6 +1832,16 @@ int usb_new_device(struct usb_device *udev)
/* Tell the world! */
announce_device(udev);
#if 0
if (udev->serial)
add_device_randomness(udev->serial, strlen(udev->serial));
if (udev->product)
add_device_randomness(udev->product, strlen(udev->product));
if (udev->manufacturer)
add_device_randomness(udev->manufacturer,
strlen(udev->manufacturer));
#endif
/* Register the device. The device driver is responsible
* for configuring the device and invoking the add-device
* notifier chain (used by usbfs and possibly others).
@@ -2188,6 +2218,10 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
USB_DEVICE_REMOTE_WAKEUP, 0,
NULL, 0,
USB_CTRL_SET_TIMEOUT);
/* System sleep transitions should never fail */
if (!(msg.event & PM_EVENT_AUTO))
status = 0;
} else {
/* device has up to 10 msec to fully suspend */
dev_dbg(&udev->dev, "usb %ssuspend\n",
@@ -2427,16 +2461,15 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
struct usb_device *hdev = hub->hdev;
unsigned port1;
/* fail if children aren't already suspended */
/* Warn if children aren't already suspended */
for (port1 = 1; port1 <= hdev->maxchild; port1++) {
struct usb_device *udev;
udev = hdev->children [port1-1];
if (udev && udev->can_submit) {
if (!(msg.event & PM_EVENT_AUTO))
dev_dbg(&intf->dev, "port %d nyet suspended\n",
port1);
return -EBUSY;
dev_warn(&intf->dev, "port %d nyet suspended\n", port1);
if (msg.event & PM_EVENT_AUTO)
return -EBUSY;
}
}
@@ -3271,6 +3304,10 @@ static void hub_events(void)
if (hub->quiescing)
goto loop_autopm;
/* _hub_tt_work usually run on keventd */
if (!list_empty(&hub->tt.clear_list))
_hub_tt_work(hub);
if (hub->error) {
dev_dbg (hub_dev, "resetting for error %d\n",
hub->error);

View File

@@ -134,12 +134,23 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
__u16 size, int timeout)
{
struct usb_ctrlrequest *dr;
__u8 *data2;
int ret;
dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
if (!dr)
return -ENOMEM;
data2 = kmalloc(max(size, 2), GFP_KERNEL);
if (data2 == NULL) {
kfree(dr);
return -ENOMEM;
}
if (data == NULL)
size = 0;
data2[0] = data2[1] = 0;
memcpy(data2, data, size);
dr->bRequestType = requesttype;
dr->bRequest = request;
dr->wValue = cpu_to_le16(value);
@@ -148,8 +159,10 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
/* dbg("usb_control_msg"); */
ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout);
ret = usb_internal_control_msg(dev, pipe, dr, data2, size, timeout);
memcpy(data, data2, size);
kfree(data2);
kfree(dr);
return ret;

View File

@@ -38,6 +38,51 @@ static const struct usb_device_id usb_quirk_list[] = {
/* Creative SB Audigy 2 NX */
{ USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C200 */
{ USB_DEVICE(0x046d, 0x0802), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C250 */
{ USB_DEVICE(0x046d, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam B/C500 */
{ USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C600 */
{ USB_DEVICE(0x046d, 0x0808), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam Pro 9000 */
{ USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C905 */
{ USB_DEVICE(0x046d, 0x080a), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C210 */
{ USB_DEVICE(0x046d, 0x0819), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C260 */
{ USB_DEVICE(0x046d, 0x081a), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C310 */
{ USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C910 */
{ USB_DEVICE(0x046d, 0x0821), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C160 */
{ USB_DEVICE(0x046d, 0x0824), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Webcam C270 */
{ USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Quickcam Pro 9000 */
{ USB_DEVICE(0x046d, 0x0990), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Quickcam E3500 */
{ USB_DEVICE(0x046d, 0x09a4), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Quickcam Vision Pro */
{ USB_DEVICE(0x046d, 0x09a6), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech Harmony 700-series */
{ USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
@@ -69,6 +114,12 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x06a3, 0x0006), .driver_info =
USB_QUIRK_CONFIG_INTF_STRINGS },
/* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */
{ USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
/* Guillemot Webcam Hercules Dualpix Exchange*/
{ USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME },
/* M-Systems Flash Disk Pioneers */
{ USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },

View File

@@ -449,7 +449,7 @@ static int dbgp_ehci_startup(void)
writel(FLAG_CF, &ehci_regs->configured_flag);
/* Wait until the controller is no longer halted */
loop = 10;
loop = 1000;
do {
status = readl(&ehci_regs->status);
if (!(status & STS_HALT))

View File

@@ -1886,6 +1886,7 @@ static int dummy_hcd_probe(struct platform_device *pdev)
if (!hcd)
return -ENOMEM;
the_controller = hcd_to_dummy (hcd);
hcd->has_tt = 1;
retval = usb_add_hcd(hcd, 0, 0);
if (retval != 0) {

View File

@@ -373,7 +373,7 @@ int __init loopback_add(struct usb_composite_dev *cdev, bool autoresume)
/* support autoresume for remote wakeup testing */
if (autoresume)
sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
/* support OTG systems */
if (gadget_is_otg(cdev->gadget)) {

View File

@@ -41,7 +41,7 @@
* (host controller _Structural_ parameters)
* see EHCI spec, Table 2-4 for each value
*/
static void dbg_hcs_params (struct ehci_hcd *ehci, char *label)
static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
{
u32 params = ehci_readl(ehci, &ehci->caps->hcs_params);
@@ -85,7 +85,7 @@ static inline void dbg_hcs_params (struct ehci_hcd *ehci, char *label) {}
* (host controller _Capability_ parameters)
* see EHCI Spec, Table 2-5 for each value
* */
static void dbg_hcc_params (struct ehci_hcd *ehci, char *label)
static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
{
u32 params = ehci_readl(ehci, &ehci->caps->hcc_params);

View File

@@ -84,7 +84,8 @@ static const char hcd_name [] = "ehci_hcd";
#define EHCI_IAA_MSECS 10 /* arbitrary */
#define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */
#define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */
#define EHCI_SHRINK_FRAMES 5 /* async qh unlink delay */
#define EHCI_SHRINK_JIFFIES (DIV_ROUND_UP(HZ, 200) + 1)
/* 200-ms async qh unlink delay */
/* Initial IRQ latency: faster than hw default */
static int log2_irq_thresh = 0; // 0 to 6
@@ -139,10 +140,7 @@ timer_action(struct ehci_hcd *ehci, enum ehci_timer_action action)
break;
/* case TIMER_ASYNC_SHRINK: */
default:
/* add a jiffie since we synch against the
* 8 KHz uframe counter.
*/
t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1;
t = EHCI_SHRINK_JIFFIES;
break;
}
mod_timer(&ehci->watchdog, t + jiffies);
@@ -432,7 +430,7 @@ static void ehci_shutdown(struct usb_hcd *hcd)
spin_unlock_irq(&ehci->lock);
}
static void ehci_port_power (struct ehci_hcd *ehci, int is_on)
static inline void ehci_port_power(struct ehci_hcd *ehci, int is_on)
{
unsigned port;

View File

@@ -264,7 +264,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
u32 temp;
u32 power_okay;
int i;
u8 resume_needed = 0;
unsigned long resume_needed = 0;
if (time_before (jiffies, ehci->next_statechange))
msleep(5);
@@ -328,7 +328,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
if (test_bit(i, &ehci->bus_suspended) &&
(temp & PORT_SUSPEND)) {
temp |= PORT_RESUME;
resume_needed = 1;
set_bit(i, &resume_needed);
}
ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
}
@@ -343,8 +343,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
i = HCS_N_PORTS (ehci->hcs_params);
while (i--) {
temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
if (test_bit(i, &ehci->bus_suspended) &&
(temp & PORT_SUSPEND)) {
if (test_bit(i, &resume_needed)) {
temp &= ~(PORT_RWC_BITS | PORT_RESUME);
ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
ehci_vdbg (ehci, "resumed port %d\n", i + 1);
@@ -779,10 +778,11 @@ static int ehci_hub_control (
* power switching; they're allowed to just limit the
* current. khubd will turn the power back on.
*/
if (HCS_PPC (ehci->hcs_params)){
if ((temp & PORT_OC) && HCS_PPC(ehci->hcs_params)) {
ehci_writel(ehci,
temp & ~(PORT_RWC_BITS | PORT_POWER),
status_reg);
temp = ehci_readl(ehci, status_reg);
}
}

View File

@@ -103,7 +103,7 @@ qh_update (struct ehci_hcd *ehci, struct ehci_qh *qh, struct ehci_qtd *qtd)
if (!(hw->hw_info1 & cpu_to_hc32(ehci, 1 << 14))) {
unsigned is_out, epnum;
is_out = !(qtd->hw_token & cpu_to_hc32(ehci, 1 << 8));
is_out = qh->is_out;
epnum = (hc32_to_cpup(ehci, &hw->hw_info1) >> 8) & 0x0f;
if (unlikely (!usb_gettoggle (qh->dev, epnum, is_out))) {
hw->hw_token &= ~cpu_to_hc32(ehci, QTD_TOGGLE);
@@ -936,6 +936,7 @@ done:
hw = qh->hw;
hw->hw_info1 = cpu_to_hc32(ehci, info1);
hw->hw_info2 = cpu_to_hc32(ehci, info2);
qh->is_out = !is_input;
usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, 1);
qh_refresh (ehci, qh);
return qh;
@@ -1216,6 +1217,8 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
prev->hw->hw_next = qh->hw->hw_next;
prev->qh_next = qh->qh_next;
if (ehci->qh_scan_next == qh)
ehci->qh_scan_next = qh->qh_next.qh;
wmb ();
/* If the controller isn't running, we don't have to wait for it */
@@ -1241,53 +1244,49 @@ static void scan_async (struct ehci_hcd *ehci)
struct ehci_qh *qh;
enum ehci_timer_action action = TIMER_IO_WATCHDOG;
ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index);
timer_action_done (ehci, TIMER_ASYNC_SHRINK);
rescan:
stopped = !HC_IS_RUNNING(ehci_to_hcd(ehci)->state);
qh = ehci->async->qh_next.qh;
if (likely (qh != NULL)) {
do {
/* clean any finished work for this qh */
if (!list_empty(&qh->qtd_list) && (stopped ||
qh->stamp != ehci->stamp)) {
int temp;
/* unlinks could happen here; completion
* reporting drops the lock. rescan using
* the latest schedule, but don't rescan
* qhs we already finished (no looping)
* unless the controller is stopped.
*/
qh = qh_get (qh);
qh->stamp = ehci->stamp;
temp = qh_completions (ehci, qh);
if (qh->needs_rescan)
unlink_async(ehci, qh);
qh_put (qh);
if (temp != 0) {
goto rescan;
}
}
ehci->qh_scan_next = ehci->async->qh_next.qh;
while (ehci->qh_scan_next) {
qh = ehci->qh_scan_next;
ehci->qh_scan_next = qh->qh_next.qh;
rescan:
/* clean any finished work for this qh */
if (!list_empty(&qh->qtd_list)) {
int temp;
/* unlink idle entries, reducing DMA usage as well
* as HCD schedule-scanning costs. delay for any qh
* we just scanned, there's a not-unusual case that it
* doesn't stay idle for long.
* (plus, avoids some kind of re-activation race.)
/*
* Unlinks could happen here; completion reporting
* drops the lock. That's why ehci->qh_scan_next
* always holds the next qh to scan; if the next qh
* gets unlinked then ehci->qh_scan_next is adjusted
* in start_unlink_async().
*/
if (list_empty(&qh->qtd_list)
&& qh->qh_state == QH_STATE_LINKED) {
if (!ehci->reclaim && (stopped ||
((ehci->stamp - qh->stamp) & 0x1fff)
>= EHCI_SHRINK_FRAMES * 8))
start_unlink_async(ehci, qh);
else
action = TIMER_ASYNC_SHRINK;
}
qh = qh_get(qh);
temp = qh_completions(ehci, qh);
if (qh->needs_rescan)
unlink_async(ehci, qh);
qh->unlink_time = jiffies + EHCI_SHRINK_JIFFIES;
qh_put(qh);
if (temp != 0)
goto rescan;
}
qh = qh->qh_next.qh;
} while (qh);
/* unlink idle entries, reducing DMA usage as well
* as HCD schedule-scanning costs. delay for any qh
* we just scanned, there's a not-unusual case that it
* doesn't stay idle for long.
* (plus, avoids some kind of re-activation race.)
*/
if (list_empty(&qh->qtd_list)
&& qh->qh_state == QH_STATE_LINKED) {
if (!ehci->reclaim && (stopped ||
time_after_eq(jiffies, qh->unlink_time)))
start_unlink_async(ehci, qh);
else
action = TIMER_ASYNC_SHRINK;
}
}
if (action == TIMER_ASYNC_SHRINK)
timer_action (ehci, TIMER_ASYNC_SHRINK);

View File

@@ -62,7 +62,7 @@ stm_ehci_bus_resume(struct usb_hcd *hcd)
static const struct hc_driver ehci_stm_hc_driver = {
.description = hcd_name,
.product_desc = "st-ehci",
.product_desc = "STMicroelectronics EHCI Host Controller",
.hcd_priv_size = sizeof(struct ehci_hcd),
/*
@@ -199,6 +199,7 @@ static struct platform_driver ehci_hcd_stm_driver = {
.shutdown = usb_hcd_platform_shutdown,
.driver = {
.name = "stm-ehci",
.owner = THIS_MODULE,
},
};
@@ -216,7 +217,7 @@ int stm_ehci_hcd_unregister(struct platform_device *dev)
ret = ehci_hcd_stm_remove(dev);
mutex_unlock(&stm_ehci_usb_mutex);
if (ret)
dgb_print("[STM][USB] Error on %s 0x%x\n", __func__, dev);
dgb_print("[STM][USB] Error on %s %p\n", __func__, dev);
return ret;
}
@@ -230,7 +231,7 @@ int stm_ehci_hcd_register(struct platform_device *dev)
ret = ehci_hcd_stm_probe(dev);
mutex_unlock(&stm_ehci_usb_mutex);
if (ret)
dgb_print("[STM][USB] Error on %s 0x%x\n", __func__, dev);
dgb_print("[STM][USB] Error on %s %p\n", __func__, dev);
return ret;
}
EXPORT_SYMBOL(stm_ehci_hcd_register);

View File

@@ -74,6 +74,7 @@ struct ehci_hcd { /* one per controller */
/* async schedule support */
struct ehci_qh *async;
struct ehci_qh *reclaim;
struct ehci_qh *qh_scan_next;
unsigned scanning : 1;
/* periodic schedule support */
@@ -116,7 +117,6 @@ struct ehci_hcd { /* one per controller */
struct timer_list iaa_watchdog;
struct timer_list watchdog;
unsigned long actions;
unsigned stamp;
unsigned random_frame;
unsigned long next_statechange;
ktime_t last_periodic_enable;
@@ -336,6 +336,7 @@ struct ehci_qh {
struct ehci_qh *reclaim; /* next to reclaim */
struct ehci_hcd *ehci;
unsigned long unlink_time;
/*
* Do NOT use atomic operations for QH refcounting. On some CPUs
@@ -367,6 +368,7 @@ struct ehci_qh {
#define NO_FRAME ((unsigned short)~0) /* pick new start */
struct usb_device *dev; /* access to TT */
unsigned is_out:1; /* bulk or intr OUT */
unsigned clearing_tt:1; /* Clear-TT-Buf in progress */
};

View File

@@ -1,7 +1,7 @@
/*
* Freescale QUICC Engine USB Host Controller Driver
*
* Copyright (c) Freescale Semicondutor, Inc. 2006.
* Copyright (c) Freescale Semicondutor, Inc. 2006, 2011.
* Shlomi Gridish <gridish@freescale.com>
* Jerry Huang <Chang-Ming.Huang@freescale.com>
* Copyright (c) Logic Product Development, Inc. 2007
@@ -810,9 +810,11 @@ void fhci_queue_urb(struct fhci_hcd *fhci, struct urb *urb)
ed->dev_addr = usb_pipedevice(urb->pipe);
ed->max_pkt_size = usb_maxpacket(urb->dev, urb->pipe,
usb_pipeout(urb->pipe));
/* setup stage */
td = fhci_td_fill(fhci, urb, urb_priv, ed, cnt++, FHCI_TA_SETUP,
USB_TD_TOGGLE_DATA0, urb->setup_packet, 8, 0, 0, true);
/* data stage */
if (data_len > 0) {
td = fhci_td_fill(fhci, urb, urb_priv, ed, cnt++,
usb_pipeout(urb->pipe) ? FHCI_TA_OUT :
@@ -820,9 +822,18 @@ void fhci_queue_urb(struct fhci_hcd *fhci, struct urb *urb)
USB_TD_TOGGLE_DATA1, data, data_len, 0, 0,
true);
}
td = fhci_td_fill(fhci, urb, urb_priv, ed, cnt++,
usb_pipeout(urb->pipe) ? FHCI_TA_IN : FHCI_TA_OUT,
USB_TD_TOGGLE_DATA1, data, 0, 0, 0, true);
/* status stage */
if (data_len > 0)
td = fhci_td_fill(fhci, urb, urb_priv, ed, cnt++,
(usb_pipeout(urb->pipe) ? FHCI_TA_IN :
FHCI_TA_OUT),
USB_TD_TOGGLE_DATA1, data, 0, 0, 0, true);
else
td = fhci_td_fill(fhci, urb, urb_priv, ed, cnt++,
FHCI_TA_IN,
USB_TD_TOGGLE_DATA1, data, 0, 0, 0, true);
urb_state = US_CTRL_SETUP;
break;
case FHCI_TF_ISO:

View File

@@ -71,20 +71,21 @@ static int stm_usb_boot(struct platform_device *pdev)
void *wrapper_base = usb_data->ahb2stbus_wrapper_glue_base;
void *protocol_base = usb_data->ahb2stbus_protocol_base;
unsigned long reg, req_reg;
unsigned long flags = pl_data->flags;
if (pl_data->flags &
(STM_PLAT_USB_FLAGS_STRAP_8BIT |
STM_PLAT_USB_FLAGS_STRAP_16BIT)) {
if (flags & (STM_PLAT_USB_FLAGS_STRAP_8BIT |
STM_PLAT_USB_FLAGS_STRAP_16BIT)) {
/* Set strap mode */
reg = readl(wrapper_base + AHB2STBUS_STRAP_OFFSET);
if (pl_data->flags & STM_PLAT_USB_FLAGS_STRAP_16BIT)
if (flags & STM_PLAT_USB_FLAGS_STRAP_16BIT)
reg |= AHB2STBUS_STRAP_16_BIT;
else
reg &= ~AHB2STBUS_STRAP_16_BIT;
writel(reg, wrapper_base + AHB2STBUS_STRAP_OFFSET);
}
if (pl_data->flags & STM_PLAT_USB_FLAGS_STRAP_PLL) {
if (flags & STM_PLAT_USB_FLAGS_STRAP_PLL) {
/* Start PLL */
reg = readl(wrapper_base + AHB2STBUS_STRAP_OFFSET);
writel(reg | AHB2STBUS_STRAP_PLL,
@@ -95,7 +96,7 @@ static int stm_usb_boot(struct platform_device *pdev)
mdelay(30);
}
if (pl_data->flags & STM_PLAT_USB_FLAGS_OPC_MSGSIZE_CHUNKSIZE) {
if (flags & STM_PLAT_USB_FLAGS_OPC_MSGSIZE_CHUNKSIZE) {
/* Set the STBus Opcode Config for load/store 32 */
writel(AHB2STBUS_STBUS_OPC_32BIT,
protocol_base + AHB2STBUS_STBUS_OPC_OFFSET);
@@ -109,7 +110,7 @@ static int stm_usb_boot(struct platform_device *pdev)
protocol_base + AHB2STBUS_CHUNKSIZE_OFFSET);
}
if (pl_data->flags &
if (flags &
(STM_PLAT_USB_FLAGS_STBUS_CONFIG_THRESHOLD128 |
STM_PLAT_USB_FLAGS_STBUS_CONFIG_THRESHOLD256)) {
@@ -134,24 +135,14 @@ static int stm_usb_boot(struct platform_device *pdev)
static int stm_usb_remove(struct platform_device *pdev)
{
struct resource *res;
struct device *dev = &pdev->dev;
struct drv_usb_data *dr_data = platform_get_drvdata(pdev);
platform_device_unregister(dr_data->ehci_device);
platform_device_unregister(dr_data->ohci_device);
stm_device_power(dr_data->device_state, stm_device_power_off);
stm_usb_clk_disable(dr_data);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wrapper");
devm_release_mem_region(dev, res->start, resource_size(res));
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "protocol");
devm_release_mem_region(dev, res->start, resource_size(res));
if (dr_data->ehci_device)
platform_device_unregister(dr_data->ehci_device);
if (dr_data->ohci_device)
platform_device_unregister(dr_data->ohci_device);
return 0;
}
@@ -191,7 +182,7 @@ static int __init stm_usb_probe(struct platform_device *pdev)
struct drv_usb_data *dr_data;
struct device *dev = &pdev->dev;
struct resource *res;
int ret = 0, i;
int i;
static char __initdata *usb_clks_n[USB_CLKS_NR] = {
[USB_48_CLK] = "usb_48_clk",
[USB_IC_CLK] = "usb_ic_clk",
@@ -200,7 +191,7 @@ static int __init stm_usb_probe(struct platform_device *pdev)
resource_size_t len;
dgb_print("\n");
dr_data = kzalloc(sizeof(struct drv_usb_data), GFP_KERNEL);
dr_data = devm_kzalloc(dev, sizeof(*dr_data), GFP_KERNEL);
if (!dr_data)
return -ENOMEM;
@@ -215,57 +206,47 @@ static int __init stm_usb_probe(struct platform_device *pdev)
stm_usb_clk_enable(dr_data);
dr_data->device_state = devm_stm_device_init(&pdev->dev,
plat_data->device_config);
if (!dr_data->device_state) {
ret = -EBUSY;
goto err_0;
}
dr_data->device_state =
devm_stm_device_init(&pdev->dev, plat_data->device_config);
if (!dr_data->device_state)
return -EBUSY;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wrapper");
if (!res) {
ret = -ENXIO;
goto err_0;
}
if (!res)
return -ENXIO;
len = resource_size(res);
if (devm_request_mem_region(dev, res->start, len, pdev->name) < 0) {
ret = -EBUSY;
goto err_0;
}
if (devm_request_mem_region(dev, res->start, len, pdev->name) < 0)
return -EBUSY;
dr_data->ahb2stbus_wrapper_glue_base =
devm_ioremap_nocache(dev, res->start, len);
if (!dr_data->ahb2stbus_wrapper_glue_base) {
ret = -EFAULT;
goto err_1;
}
if (!dr_data->ahb2stbus_wrapper_glue_base)
return -EFAULT;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "protocol");
if (!res) {
ret = -ENXIO;
goto err_2;
}
if (!res)
return -ENXIO;
len = resource_size(res);
if (devm_request_mem_region(dev, res->start, len, pdev->name) < 0) {
ret = -EBUSY;
goto err_2;
}
if (devm_request_mem_region(dev, res->start, len, pdev->name) < 0)
return -EBUSY;
dr_data->ahb2stbus_protocol_base =
devm_ioremap_nocache(dev, res->start, len);
if (!dr_data->ahb2stbus_protocol_base) {
ret = -EFAULT;
goto err_3;
}
if (!dr_data->ahb2stbus_protocol_base)
return -EFAULT;
stm_usb_boot(pdev);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ehci");
if (res) {
dr_data->ehci_device = stm_usb_device_create("stm-ehci",
pdev->id, pdev);
if (IS_ERR(dr_data->ehci_device)) {
ret = (int)dr_data->ehci_device;
goto err_4;
}
if (IS_ERR(dr_data->ehci_device))
return PTR_ERR(dr_data->ehci_device);
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ohci");
@@ -273,10 +254,8 @@ static int __init stm_usb_probe(struct platform_device *pdev)
dr_data->ohci_device =
stm_usb_device_create("stm-ohci", pdev->id, pdev);
if (IS_ERR(dr_data->ohci_device)) {
if (dr_data->ehci_device)
platform_device_del(dr_data->ehci_device);
ret = (int)dr_data->ohci_device;
goto err_4;
platform_device_del(dr_data->ehci_device);
return PTR_ERR(dr_data->ohci_device);
}
}
@@ -285,21 +264,7 @@ static int __init stm_usb_probe(struct platform_device *pdev)
pm_suspend_ignore_children(&pdev->dev, 1);
pm_runtime_enable(&pdev->dev);
return ret;
err_4:
devm_iounmap(dev, dr_data->ahb2stbus_protocol_base);
err_3:
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "protocol");
devm_release_mem_region(dev, res->start, resource_size(res));
err_2:
devm_iounmap(dev, dr_data->ahb2stbus_wrapper_glue_base);
err_1:
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wrapper");
devm_release_mem_region(dev, res->start, resource_size(res));
err_0:
kfree(dr_data);
return ret;
return 0;
}
static void stm_usb_shutdown(struct platform_device *pdev)

View File

@@ -56,7 +56,7 @@ static int stm_ohci_bus_suspend(struct usb_hcd *hcd)
static const struct hc_driver ohci_st40_hc_driver = {
.description = hcd_name,
.product_desc = "stm-ohci",
.product_desc = "STMicroelectronics OHCI Host Controller",
.hcd_priv_size = sizeof(struct ohci_hcd),
/* generic hardware linkage */
@@ -165,6 +165,7 @@ static struct platform_driver ohci_hcd_stm_driver = {
.shutdown = usb_hcd_platform_shutdown,
.driver = {
.name = "stm-ohci",
.owner = THIS_MODULE,
},
};
@@ -183,7 +184,7 @@ int stm_ohci_hcd_unregister(struct platform_device *dev)
ret = ohci_hcd_stm_remove(dev);
mutex_unlock(&stm_ohci_usb_mutex);
if (ret)
dgb_print("[STM][USB] Error on %s 0x%x\n", __func__, dev);
dgb_print("[STM][USB] Error on %s %p\n", __func__, dev);
return ret;
}
EXPORT_SYMBOL(stm_ohci_hcd_unregister);
@@ -196,7 +197,7 @@ int stm_ohci_hcd_register(struct platform_device *dev)
ret = ohci_hcd_stm_probe(dev);
mutex_unlock(&stm_ohci_usb_mutex);
if (ret)
dgb_print("[STM][USB] Error on %s 0x%x\n", __func__, dev);
dgb_print("[STM][USB] Error on %s %p\n", __func__, dev);
return ret;
}

View File

@@ -34,6 +34,8 @@
#define OHCI_INTRSTATUS 0x0c
#define OHCI_INTRENABLE 0x10
#define OHCI_INTRDISABLE 0x14
#define OHCI_FMINTERVAL 0x34
#define OHCI_HCR (1 << 0) /* host controller reset */
#define OHCI_OCR (1 << 3) /* ownership change request */
#define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */
#define OHCI_CTRL_IR (1 << 8) /* interrupt routing */
@@ -204,6 +206,32 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
/* reset controller, preserving RWC (and possibly IR) */
writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL);
readl(base + OHCI_CONTROL);
/* Some NVIDIA controllers stop working if kept in RESET for too long */
if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) {
u32 fminterval;
int cnt;
/* drive reset for at least 50 ms (7.1.7.5) */
msleep(50);
/* software reset of the controller, preserving HcFmInterval */
fminterval = readl(base + OHCI_FMINTERVAL);
writel(OHCI_HCR, base + OHCI_CMDSTATUS);
/* reset requires max 10 us delay */
for (cnt = 30; cnt > 0; --cnt) { /* ... allow extra time */
if ((readl(base + OHCI_CMDSTATUS) & OHCI_HCR) == 0)
break;
udelay(1);
}
writel(fminterval, base + OHCI_FMINTERVAL);
/* Now we're in the SUSPEND state with all devices reset
* and wakeups and interrupts disabled
*/
}
/*
* disable interrupts
@@ -390,12 +418,12 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
void __iomem *op_reg_base;
u32 val;
int timeout;
int len = pci_resource_len(pdev, 0);
if (!mmio_resource_enabled(pdev, 0))
return;
base = ioremap_nocache(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
base = ioremap_nocache(pci_resource_start(pdev, 0), len);
if (base == NULL)
return;
@@ -405,9 +433,17 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
*/
ext_cap_offset = xhci_find_next_cap_offset(base, XHCI_HCC_PARAMS_OFFSET);
do {
if ((ext_cap_offset + sizeof(val)) > len) {
/* We're reading garbage from the controller */
dev_warn(&pdev->dev,
"xHCI controller failing to respond");
return;
}
if (!ext_cap_offset)
/* We've reached the end of the extended capabilities */
goto hc_init;
val = readl(base + ext_cap_offset);
if (XHCI_EXT_CAPS_ID(val) == XHCI_EXT_CAPS_LEGACY)
break;
@@ -416,7 +452,7 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
/* If the BIOS owns the HC, signal that the OS wants it, and wait */
if (val & XHCI_HC_BIOS_OWNED) {
writel(val & XHCI_HC_OS_OWNED, base + ext_cap_offset);
writel(val | XHCI_HC_OS_OWNED, base + ext_cap_offset);
/* Wait for 5 seconds with 10 microsecond polling interval */
timeout = handshake(base + ext_cap_offset, XHCI_HC_BIOS_OWNED,
@@ -430,9 +466,13 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
}
}
/* Disable any BIOS SMIs */
writel(XHCI_LEGACY_DISABLE_SMI,
base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
/* Mask off (turn off) any enabled SMIs */
val &= XHCI_LEGACY_DISABLE_SMI;
/* Mask all SMI events bits, RW1C */
val |= XHCI_LEGACY_SMI_EVENTS;
/* Disable any BIOS SMIs and clear all SMI events*/
writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
hc_init:
op_reg_base = base + XHCI_HC_LENGTH(readl(base));
@@ -470,6 +510,22 @@ hc_init:
static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
{
/* Skip Netlogic mips SoC's internal PCI USB controller.
* This device does not need/support EHCI/OHCI handoff
*/
if (pdev->vendor == 0x184e) /* vendor Netlogic */
return;
if (pdev->class != PCI_CLASS_SERIAL_USB_UHCI &&
pdev->class != PCI_CLASS_SERIAL_USB_OHCI &&
pdev->class != PCI_CLASS_SERIAL_USB_EHCI &&
pdev->class != PCI_CLASS_SERIAL_USB_XHCI)
return;
if (pci_enable_device(pdev) < 0) {
dev_warn(&pdev->dev, "Can't enable PCI device, "
"BIOS handoff failed.\n");
return;
}
if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI)
quirk_usb_handoff_uhci(pdev);
else if (pdev->class == PCI_CLASS_SERIAL_USB_OHCI)
@@ -478,5 +534,6 @@ static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
quirk_usb_disable_ehci(pdev);
else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI)
quirk_usb_handoff_xhci(pdev);
pci_disable_device(pdev);
}
DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff);

Some files were not shown because too many files have changed in this diff Show More