Commit Graph

164 Commits (8714fcaca63203fe10331fe530ff48d3dd31de4e)

Author SHA1 Message Date
Tomoya 8714fcaca6 pch_can: Delete unnecessary/redundant code
Delete unnecessary/redundant code

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:24 -08:00
Tomoya 9388b166a3 pch_can: Fix coding rule violation
Fix coding rule violation.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:23 -08:00
Tomoya 435b4efe93 pch_can: Replace netdev_dbg instead of dev_dbg partly
For easy to readable, use netdev_dbg instead of dev_dbg partly

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:23 -08:00
Tomoya e91530ea95 pch_can: Change Copyright and module description
Currently, Copyright and module description are not formal.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:22 -08:00
Tomoya 44c9aa890a pch_can: Reduce register access
For improve tx/rx speed, reduce register access.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:22 -08:00
Tomoya ca2b004e89 pch_can: Change functions type
Currently, these two functions spec(returned value) is unnatural.
Thus, change the return value's spec

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:21 -08:00
Tomoya bd58cbc322 pch_can: Rename function/macro name
For easy to read/understand, Rename function/macro name.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:21 -08:00
Tomoya 7f2bc50efe pch_can: Fix warnings
Currently, in case CONFIG_PM is disabled, compiler outputs warnings.
Move six functions which are used only CONFIG_PM is enabled,
into "#ifdef CONFIG_PM" area.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:20 -08:00
Tomoya 1d5b4b2778 pch_can: Improve rx processing
Replace complex "goto" to "do~while".
For easy to read/understand, it divides a rx function into some functions.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:20 -08:00
Tomoya 8ac9702b9d pch_can: Fix endianness issue
there is endianness issue both Tx and Rx.
Currently, data is set like below.
Register:
MSB--LSB
x x D0 D1
x x D2 D3
x x D4 D5
x x D6 D7

But Data to be sent must be set like below.
Register:
MSB--LSB
x x D1 D0
x x D3 D2
x x D5 D4
x x D7 D6  (x means reserved area.)

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:19 -08:00
Tomoya e489ccebf1 pch_can: Divide poll function
To easy to read/understand, divide poll function into two sub-functions.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:19 -08:00
Tomoya 76d94b2329 pch_can: Add flow control processing
Currently, there is no flow control processing.
Thus, Add flow control processing as
when there is no empty of tx buffer,
netif_stop_queue is called.
When there is empty buffer, netif_wake_queue is called.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-13 12:24:18 -08:00
Tejun Heo 6e07ebd84e drivers/net: remove unnecessary flush_scheduled_work() calls
janz-ican3, sh_eth, skge and vxge don't use workqueue at all and there
is no reason to flush the system_wq.  Drop flush_scheduled_work()
calls and references to workqueue.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Ramkrishna Vepa <ramkrishna.vepa@exar.com>
Cc: Sivakumar Subramani <sivakumar.subramani@exar.com>
Cc: Sreenivasa Honnur <sreenivasa.honnur@exar.com>
Cc: Jon Mason <jon.mason@exar.com>
Cc: netdev@vger.kernel.org
2010-12-12 16:45:14 +01:00
David S. Miller 84b3cdc38c can: slcan: Add missing linux/sched.h include.
drivers/net/can/slcan.c: In function 'slcan_open':
drivers/net/can/slcan.c:568: error: dereferencing pointer to incomplete type

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-08 18:41:03 -08:00
Oliver Hartkopp a1044e36e4 can: add slcan driver for serial/USB-serial CAN adapters
This patch adds support for serial/USB-serial CAN adapters implementing the
LAWICEL ASCII protocol for CAN frame transport over serial lines.

The driver implements the SLCAN line discipline and is heavily based on the
slip.c driver. Therefore the code style remains similar to slip.c to be able
to apply changes of the SLIP driver to the SLCAN driver easily.

For more details see the slcan Kconfig entry.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-08 09:03:32 -08:00
Tomoya 2989042ca8 can: EG20T PCH: Delete unnecessary spin_lock
Delete unnecessary spin_lock for accessing Message Object.
Since all message objects are divided into tx/rx area completely,
spin_lock processing is unnecessary.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-02 13:13:46 -08:00
Tomoya d68f6837c4 can: EG20T PCH: Enumerate LEC macros
For easy to readable, LEC #define macros are replaced to enums.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-02 13:04:51 -08:00
Tomoya 15ffc8fddf can: EG20T PCH: Change Message Object Index
For easy to readable, add Message Object index like below.
PCH_RX_OBJ_START
PCH_RX_OBJ_END
PCH_TX_OBJ_START
PCH_TX_OBJ_END

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-02 13:04:51 -08:00
Tomoya 8339a7ed56 can: EG20T PCH: Separate Interface Register(IF1/IF2)
CAN register of Intel PCH EG20T has 2 sets of interface register.
To reduce whole of code size, separate interface register.
As a result, the number of function also can be reduced.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-02 13:04:50 -08:00
Tomoya 0a80410dc5 can: EG20T PCH: use BIT(X)
Replace bit assignment value to BIT(X).
For easy to readable/identifiable, replace all bit assigned macros to BIT(X)

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-11-18 12:07:30 -08:00
Tomoya 086b5650dc can: EG20T PCH: add prefix to macro
For easy to readable/identifiable, add prefix "PCH_" to all of #define macros.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-11-18 12:05:35 -08:00
Joe Perches b1323c8fa1 drivers/net/can/sja1000: Use printf extension %pR for struct resource
Using %pR standardizes the struct resource output.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-11-17 12:25:57 -08:00
Joe Perches c389ff80d4 drivers/net/can: Update WARN uses
Add missing newlines.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-11-09 09:22:30 -08:00
Hans J. Koch 3e9ebd3cf4 netdev: can: Change mail address of Hans J. Koch
My old mail address doesn't exist anymore. This changes all occurrences
to my new address.

Signed-off-by: Hans J. Koch <hjk@hansjkoch.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-30 16:49:38 -07:00
Marc Kleine-Budde bdfa3d8fe1 can: pch_can: fix section mismatch warning by using a whitelisted name
This patch fixes the following section mismatch warning:

WARNING: drivers/net/can/pch_can.o(.data+0x18):
Section mismatch in reference from the variable pch_can_pcidev
to the variable .devinit.rodata:pch_pci_tbl
The variable pch_can_pcidev references
the variable __devinitconst pch_pci_tbl

This is actually a false positive which is fixed by giving the offending
variable a whitelisted name, it's renamed to "pch_can_pci_driver".
This makes sense because the variable is of the type "struct pci_driver".

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-30 16:28:16 -07:00
Marc Kleine-Budde 526de53cf7 can: pch_can: fix sparse warning
This patch fixes the following sparse warning:

drivers/net/can/pch_can.c:231:26: warning: incorrect type in argument 1 (different address spaces)
drivers/net/can/pch_can.c:231:26:    expected unsigned int [usertype] *addr
drivers/net/can/pch_can.c:231:26:    got unsigned int [noderef] <asn:2>*<noident>

Let pch_can_bit_{set,clear} first parameter be a void __iomem pointer.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-30 16:27:48 -07:00
Marc Kleine-Budde b9958a951e can: mcp251x: fix reception of standard RTR frames
This patch sets the missing CAN_RTR_FLAG if a standard RTR frame is
received.
(For extended frames the CAN_RTR_FLAG was already set correctly.)

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-26 10:48:59 -07:00
Marc Kleine-Budde 9a27586d3d can: flexcan: fix use after free of priv
The priv is part of the memory allocated by alloc_candev().
This patch moved the free it after last usage of priv.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-26 10:48:58 -07:00
Randy Dunlap 10d8c4638c pch_can: depends on PCI
Fix pch_can build when CONFIG_PCI is not enabled.  It uses pci interfaces
and data structures, so it should depend on PCI.

drivers/net/can/pch_can.c:1044: error: implicit declaration of function 'pci_enable_msi'
drivers/net/can/pch_can.c:1079: error: implicit declaration of function 'pci_disable_msi'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-25 16:47:36 -07:00
Andre B. Oliveira 2d3359f8b9 can: tscan1: add driver for TS-CAN1 boards
Add driver for Technologic Systems TS-CAN1 PC104 peripheral boards.

Signed-off-by: Andre B. Oliveira <anbadeol@gmail.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 15:26:48 -07:00
Marc Kleine-Budde 00389b0820 can: at91_can: add KBUILD_MODNAME to bittiming constant
While there replace all usage of self defined DRV_NAME by KBUILD_MODNAME.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:52 -07:00
Marc Kleine-Budde 882055c838 can: at91_can: convert dev_<level> printing to netdev_<level>
While there, remove "printk()" on driver loading.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:51 -07:00
Marc Kleine-Budde 7672fe7373 can: at91_can: convert readl, writel their __raw pendants
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:51 -07:00
Marc Kleine-Budde b156fd0483 can: at91_can: set bittiming in chip_start
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:50 -07:00
Marc Kleine-Budde 33a6f298c2 can: at91_can: implement and use at91_get_berr_counter
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:50 -07:00
Marc Kleine-Budde a9d992ecb3 can: at91_can: fix section mismatch warning
...by adding the correct annotation "__devinit" to the driver's probe
function.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:49 -07:00
Marc Kleine-Budde b61f674051 can: at91_can: fix compiler warning in at91_irq_err_state
This patch fixes the following compiler warning:

drivers/net/can/at91_can.c: In function 'at91_irq_err_state':
drivers/net/can/at91_can.c:779: warning: 'reg_ier' may be used uninitialized in this function
drivers/net/can/at91_can.c:779: warning: 'reg_idr' may be used uninitialized in this function

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:49 -07:00
Marc Kleine-Budde 759a6c768d can: at91_can: fix use after free of priv
The priv is part of the memory allocated by alloc_candev().
This patch moved the free it after last usage of priv.

While there convert all free_netdev() to free_candev() (which is currently
just a wrapper around free_netdev()) to be symetrically with the allocation
via alloc_candev().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:48 -07:00
Marc Kleine-Budde 8a0e0a49b0 can: at91_can: fix reception of extended frames
The AT91_MID_MIDE bit must be set in order to receive extended frames.
The reception of an extended frame sets this bit, while reception of
standard frames resets it. This results in some lost extended frames in
an extended ID only environment. But leads to unpredictable lost
extended ID frames in a mixed environment.

The problem is fixed by setting the AT91_MID_MIDE after reception of a
CAN frame.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:48 -07:00
Marc Kleine-Budde dbe91325c2 can: at91_can: use correct bit to enable CAN_CTRLMODE_3_SAMPLES
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:47:47 -07:00
Masayuki Ohtake b21d18b51b can: Topcliff: Add PCH_CAN driver.
CAN driver of Topcliff PCH

Topcliff PCH is the platform controller hub that is going to be used in
Intel's upcoming general embedded platform. All IO peripherals in
Topcliff PCH are actually devices sitting on AMBA bus.
Topcliff PCH has CAN I/F. This driver enables CAN function.

Signed-off-by: Masayuki Ohtake <masa-korg@dsn.okisemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-24 14:42:57 -07:00
Marc Kleine-Budde 612eef4f47 can: mcp251x: fix generation of error frames
The function "mcp251x_error_skb" is used to generate error frames.
They are identified by the "CAN_ERR_FLAG" in can_id. The function
overwrites the can_id so that the frames show up as normal frames instead
of error frames.

This patch fixes the problem by or'ing the can_id instead of overwriting it.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Jargalan Nermunkh <jargalan.nermunkh@criticallink.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-21 04:27:03 -07:00
Marc Kleine-Budde 5601b2dfae can: mcp251x: fix endless loop in interrupt handler if CANINTF_MERRF is set
Commit d3cd156575 introduced a bug, the
interrupt handler would loop endlessly if the CANINTF_MERRF bit is set,
because it's not cleared.

This patch fixes the problem by masking out the CANINTF_MERRF and all other
non interesting bits.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-21 04:27:03 -07:00
Marc Kleine-Budde 9c473fc339 can: mcp251x: optimize 2515, rx int gets cleared automatically
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
2010-10-18 15:19:55 +02:00
Marc Kleine-Budde beab675cb4 can: mcp251x: define helper functions mcp251x_is_2510, mcp251x_is_2515
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
2010-10-18 15:19:51 +02:00
Marc Kleine-Budde f1f8c6cbe6 can: mcp251x: Don't use pdata->model for chip selection anymore
Since commit e446630c96, i.e. v2.6.35-rc1,
the mcp251x chip model can be selected via the modalias member in the
struct spi_board_info. The driver stores the actual model in the
struct mcp251x_platform_data.

From the driver point of view the platform_data should be read only.
Since all in-tree users of the mcp251x have already been converted to
the modalias method, this patch moves the "model" member from the
struct mcp251x_platform_data to the driver's private data structure.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Christian Pellegrin <chripell@fsfe.org>
Cc: Marc Zyngier <maz@misterjones.org>
2010-10-18 15:16:08 +02:00
Marc Kleine-Budde d3cd156575 can: mcp251x: write intf only when needed
This patch introduces a variable "clear_intf" that hold the bits that
should be cleared. Only read-modify-write register if "clear_intf"
is set.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
2010-10-18 11:19:42 +02:00
Sascha Hauer 7e15de3a73 can: mcp251x: read-modify-write eflag only when needed
Use read-modify-write instead of a simple write to change the register
contents, to close existing the race window between the original manual
read and write.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
2010-10-18 11:19:42 +02:00
Sascha Hauer f3a3ed3115 can: mcp251x: allow to read two registers in one spi transfer
This patch bases on work done earlier by David Jander.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: David Jander <david@protonic.nl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
2010-10-18 11:19:42 +02:00
Sascha Hauer 711e4d6ecc can: mcp251x: increase rx_errors on overflow, not only rx_over_errors
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
2010-10-18 11:19:42 +02:00