/* * L3 code * * Copyright (C) 2008, Christian Pellegrin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * * based on: * * L3 bus algorithm module. * * Copyright (C) 2001 Russell King, All Rights Reserved. * * */ #include #include #include #include #include #include /* * Send one byte of data to the chip. Data is latched into the chip on * the rising edge of the clock. */ static void sendbyte(struct l3_pins *adap, unsigned int byte) { int i; for (i = 0; i < 8; i++) { adap->setclk(adap, 0); udelay(adap->data_hold); adap->setdat(adap, byte & 1); udelay(adap->data_setup); adap->setclk(adap, 1); udelay(adap->clock_high); byte >>= 1; } } /* * Send a set of bytes to the chip. We need to pulse the MODE line * between each byte, but never at the start nor at the end of the * transfer. */ static void sendbytes(struct l3_pins *adap, const u8 *buf, int len) { int i; for (i = 0; i < len; i++) { if (i) { udelay(adap->mode_hold); adap->setmode(adap, 0); udelay(adap->mode); } adap->setmode(adap, 1); udelay(adap->mode_setup); sendbyte(adap, buf[i]); } } int l3_write(struct l3_pins *adap, u8 addr, u8 *data, int len) { adap->setclk(adap, 1); adap->setdat(adap, 1); adap->setmode(adap, 1); udelay(adap->mode); adap->setmode(adap, 0); udelay(adap->mode_setup); sendbyte(adap, addr); udelay(adap->mode_hold); sendbytes(adap, data, len); adap->setclk(adap, 1); adap->setdat(adap, 1); adap->setmode(adap, 0); return len; } EXPORT_SYMBOL_GPL(l3_write); static void l3_set_clk(struct l3_pins *adap, int val) { gpio_set_value(adap->gpio_clk, val); } static void l3_set_data(struct l3_pins *adap, int val) { gpio_set_value(adap->gpio_data, val); } static void l3_set_mode(struct l3_pins *adap, int val) { gpio_set_value(adap->gpio_mode, val); } int l3_set_gpio_ops(struct device *dev, struct l3_pins *adap) { int ret; if (!adap->use_gpios) return -EINVAL; ret = devm_gpio_request_one(dev, adap->gpio_data, GPIOF_OUT_INIT_LOW, "l3_data"); if (ret < 0) return ret; adap->setdat = l3_set_data; ret = devm_gpio_request_one(dev, adap->gpio_clk, GPIOF_OUT_INIT_LOW, "l3_clk"); if (ret < 0) return ret; adap->setclk = l3_set_clk; ret = devm_gpio_request_one(dev, adap->gpio_mode, GPIOF_OUT_INIT_LOW, "l3_mode"); if (ret < 0) return ret; adap->setmode = l3_set_mode; return 0; } EXPORT_SYMBOL_GPL(l3_set_gpio_ops); MODULE_DESCRIPTION("L3 bit-banging driver"); MODULE_AUTHOR("Christian Pellegrin "); MODULE_LICENSE("GPL"); e'>range
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-02-01 12:46:17 -0500
committerDavid S. Miller <davem@davemloft.net>2017-02-01 12:46:17 -0500
commit889711a03e0fba427fb85317900e93c74e3be02a (patch)
tree05af2eda6502a95cf11935cce1e9b25a1340e7ca /drivers/usb/early/Makefile
parentff1176f6164f3d151ee64c05d3f7b6662a81b982 (diff)
parent7243a1af37a4dc9225004546d9d0756c529ad3ce (diff)
Merge tag 'wireless-drivers-next-for-davem-2017-02-01' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
Kalle Valo says: ==================== wireless-drivers-next patches for 4.11 It's nice to see rt2x00 development has becoming active, for example adding support for a new chip version. Also wcn36xx has been converted to use the recently merged QCOM_SMD subsystem. Otherwise new features and fixes it lots of drivers. Major changes: iwlwifi * some more work in preparation for A000 family support * add support for radiotap timestamps * some work on our firmware debugging capabilities wcn36xx * convert to a proper QCOM_SMD driver (from the platform_driver interface) ath10k * VHT160 support * dump Copy Engine registers during firmware crash * search board file extension from SMBIOS wil6210 * add disable_ap_sme module parameter rt2x00 * support RT3352 with external PA * support for RT3352 with 20MHz crystal * add support for RT5350 WiSoC brcmfmac * add support for BCM43455 sdio device rtl8xxxu * add support for D-Link DWA-131 rev E1, TP-Link TL-WN822N v4 and others ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/usb/early/Makefile')