aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 11:47:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 11:47:00 -0400
commite669830526a0abaf301bf408df69cde33901ac63 (patch)
tree0b6043375006d1754bbd1ab2370b0a0536546cc9 /drivers/net/irda
parentebb067d2f4e2db59b076f9c9cba0375a8ad1e07c (diff)
parent475d5928b79bb78326a645863d46ff95c5e25e5a (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS updates from Ralf Baechle: "This is the main pull request for 3.17. It contains: - misc Cavium Octeon, BCM47xx, BCM63xx and Alchemy updates - MIPS ptrace updates and cleanups - various fixes that will also go to -stable - a number of cleanups and small non-critical fixes. - NUMA support for the Loongson 3. - more support for MSA - support for MAAR - various FP enhancements and fixes" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (139 commits) MIPS: jz4740: remove unnecessary null test before debugfs_remove MIPS: Octeon: remove unnecessary null test before debugfs_remove_recursive MIPS: ZBOOT: implement stack protector in compressed boot phase MIPS: mipsreg: remove duplicate MIPS_CONF4_FTLBSETS_SHIFT MIPS: Bonito64: remove a duplicate define MIPS: Malta: initialise MAARs MIPS: Initialise MAARs MIPS: detect presence of MAARs MIPS: define MAAR register accessors & bits MIPS: mark MSA experimental MIPS: Don't build MSA support unless it can be used MIPS: consistently clear MSA flags when starting & copying threads MIPS: 16 byte align MSA vector context MIPS: disable preemption whilst initialising MSA MIPS: ensure MSA gets disabled during boot MIPS: fix read_msa_* & write_msa_* functions on non-MSA toolchains MIPS: fix MSA context for tasks which don't use FP first MIPS: init upper 64b of vector registers when MSA is first used MIPS: save/disable MSA in lose_fpu MIPS: preserve scalar FP CSR when switching vector context ...
Diffstat (limited to 'drivers/net/irda')
-rw-r--r--drivers/net/irda/au1k_ir.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c
index 5f91e3e01c04..aab2cf72d025 100644
--- a/drivers/net/irda/au1k_ir.c
+++ b/drivers/net/irda/au1k_ir.c
@@ -18,6 +18,7 @@
18 * with this program; if not, see <http://www.gnu.org/licenses/>. 18 * with this program; if not, see <http://www.gnu.org/licenses/>.
19 */ 19 */
20 20
21#include <linux/clk.h>
21#include <linux/module.h> 22#include <linux/module.h>
22#include <linux/netdevice.h> 23#include <linux/netdevice.h>
23#include <linux/interrupt.h> 24#include <linux/interrupt.h>
@@ -175,6 +176,7 @@ struct au1k_private {
175 176
176 struct resource *ioarea; 177 struct resource *ioarea;
177 struct au1k_irda_platform_data *platdata; 178 struct au1k_irda_platform_data *platdata;
179 struct clk *irda_clk;
178}; 180};
179 181
180static int qos_mtt_bits = 0x07; /* 1 ms or more */ 182static int qos_mtt_bits = 0x07; /* 1 ms or more */
@@ -514,9 +516,39 @@ static irqreturn_t au1k_irda_interrupt(int dummy, void *dev_id)
514static int au1k_init(struct net_device *dev) 516static int au1k_init(struct net_device *dev)
515{ 517{
516 struct au1k_private *aup = netdev_priv(dev); 518 struct au1k_private *aup = netdev_priv(dev);
517 u32 enable, ring_address; 519 u32 enable, ring_address, phyck;
520 struct clk *c;
518 int i; 521 int i;
519 522
523 c = clk_get(NULL, "irda_clk");
524 if (IS_ERR(c))
525 return PTR_ERR(c);
526 i = clk_prepare_enable(c);
527 if (i) {
528 clk_put(c);
529 return i;
530 }
531
532 switch (clk_get_rate(c)) {
533 case 40000000:
534 phyck = IR_PHYCLK_40MHZ;
535 break;
536 case 48000000:
537 phyck = IR_PHYCLK_48MHZ;
538 break;
539 case 56000000:
540 phyck = IR_PHYCLK_56MHZ;
541 break;
542 case 64000000:
543 phyck = IR_PHYCLK_64MHZ;
544 break;
545 default:
546 clk_disable_unprepare(c);
547 clk_put(c);
548 return -EINVAL;
549 }
550 aup->irda_clk = c;
551
520 enable = IR_HC | IR_CE | IR_C; 552 enable = IR_HC | IR_CE | IR_C;
521#ifndef CONFIG_CPU_LITTLE_ENDIAN 553#ifndef CONFIG_CPU_LITTLE_ENDIAN
522 enable |= IR_BE; 554 enable |= IR_BE;
@@ -545,7 +577,7 @@ static int au1k_init(struct net_device *dev)
545 irda_write(aup, IR_RING_SIZE, 577 irda_write(aup, IR_RING_SIZE,
546 (RING_SIZE_64 << 8) | (RING_SIZE_64 << 12)); 578 (RING_SIZE_64 << 8) | (RING_SIZE_64 << 12));
547 579
548 irda_write(aup, IR_CONFIG_2, IR_PHYCLK_48MHZ | IR_ONE_PIN); 580 irda_write(aup, IR_CONFIG_2, phyck | IR_ONE_PIN);
549 irda_write(aup, IR_RING_ADDR_CMPR, 0); 581 irda_write(aup, IR_RING_ADDR_CMPR, 0);
550 582
551 au1k_irda_set_speed(dev, 9600); 583 au1k_irda_set_speed(dev, 9600);
@@ -619,6 +651,9 @@ static int au1k_irda_stop(struct net_device *dev)
619 free_irq(aup->irq_tx, dev); 651 free_irq(aup->irq_tx, dev);
620 free_irq(aup->irq_rx, dev); 652 free_irq(aup->irq_rx, dev);
621 653
654 clk_disable_unprepare(aup->irda_clk);
655 clk_put(aup->irda_clk);
656
622 return 0; 657 return 0;
623} 658}
624 659
@@ -853,6 +888,7 @@ static int au1k_irda_probe(struct platform_device *pdev)
853 struct au1k_private *aup; 888 struct au1k_private *aup;
854 struct net_device *dev; 889 struct net_device *dev;
855 struct resource *r; 890 struct resource *r;
891 struct clk *c;
856 int err; 892 int err;
857 893
858 dev = alloc_irdadev(sizeof(struct au1k_private)); 894 dev = alloc_irdadev(sizeof(struct au1k_private));
@@ -886,6 +922,14 @@ static int au1k_irda_probe(struct platform_device *pdev)
886 if (!aup->ioarea) 922 if (!aup->ioarea)
887 goto out; 923 goto out;
888 924
925 /* bail out early if clock doesn't exist */
926 c = clk_get(NULL, "irda_clk");
927 if (IS_ERR(c)) {
928 err = PTR_ERR(c);
929 goto out;
930 }
931 clk_put(c);
932
889 aup->iobase = ioremap_nocache(r->start, resource_size(r)); 933 aup->iobase = ioremap_nocache(r->start, resource_size(r));
890 if (!aup->iobase) 934 if (!aup->iobase)
891 goto out2; 935 goto out2;