linux/drivers/spi/spi-oc-tiny.c
<<
> > p/spa pspa class="lxr_search"> > ="+search" method="post" onsubmit="return do_search(this);"> > > > Search > p/spa > ="ajax+*" method="post" onsubmit="return false;"> pinput typ"v2hidden" nam"v2ajax_lookup" idv2ajax_lookup" lue="v2"> >
pdiv idv2file_contents"
o o1p/a>pspa
 class="comment">/*p/spa
  o o2p/a>pspa
 class="comment"> * OpenCores tiny SPI master driverp/spa
  o o3p/a>pspa
 class="comment"> *p/spa
  o o4p/a>pspa
 class="comment"> * http:/ptiencores.org/project,tiny_spip/spa
  o o5p/a>pspa
 class="comment"> *p/spa
  o o6p/a>pspa
 class="comment"> * Copyright (C) 2011 Thomas Chou <thomas@wytron.com.tw>p/spa
  o o7p/a>pspa
 class="comment"> *p/spa
  o o8p/a>pspa
 class="comment"> * Based on spi_s3c24xx.c, which is:p/spa
  o o9p/a>pspa
 class="comment"> * Copyright (c) 2006 Ben Dooksp/spa
  o pspa
 class="comment"> * Copyright (c) 2006 Simtec Electronicsp/spa
  o 11p/a>pspa
 class="comment"> *      Ben Dooks <ben@simtec.co.uk>p/spa
  o 12p/a>pspa
 class="comment"> *p/spa
  o 13p/a>pspa
 class="comment"> * This program is free software; you ca
 redistribute it and/or modifyp/spa
  o 14p/a>pspa
 class="comment"> * it under the terms of the GNU General Public License versn va2 asp/spa
  o 15p/a>pspa
 class="comment"> * published by the Free Software Foundaon>
.p/spa
  o 16p/a>pspa
 class="comment"> */p/spa
  o 17p/a> o 18p/a>#include <linux/init.hp/a>> o 19p/a>#include <linux/interrupt.hp/a>> o 20p/a>#include <linux/errno.hp/a>> o 21p/a>#include <linux/module.hp/a>> o 22p/a>#include <linux/platform_device.hp/a>> o 23p/a>#include <linux/spi/spi.hp/a>> o 24p/a>#include <linux/spi/spi_bitbang.hp/a>> o 25p/a>#include <linux/spi/spi_oc_tiny.hp/a>> o 26p/a>#include <linux/io.hp/a>> o 27p/a>#include <linux/gpio.hp/a>> o 28p/a>#include <linux/of.hp/a>> o 29p/a> o 30p/a>#defineopa href="+code=DRV_NAME" class="sref">DRV_NAMEp/a> pspa
 class="string">"spi_oc_tiny"p/spa
  o 31p/a> o 32p/a>#defineopa href="+code=TINY_SPI_RXDATA" class="sref">TINY_SPI_RXDATAp/a> 0 o 33p/a>#defineopa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a> 4 o 34p/a>#defineopa href="+code=TINY_SPI_STATUS" class="sref">TINY_SPI_STATUSp/a> 8 o 35p/a>#defineopa href="+code=TINY_SPI_CONTROL" class="sref">TINY_SPI_CONTROLp/a> 12 o 36p/a>#defineopa href="+code=TINY_SPI_BAUD" class="sref">TINY_SPI_BAUDp/a> 16 o 37p/a> o 38p/a>#defineopa href="+code=TINY_SPI_STATUS_TXE" class="sref">TINY_SPI_STATUS_TXEp/a> 0x1 o 39p/a>#defineopa href="+code=TINY_SPI_STATUS_TXR" class="sref">TINY_SPI_STATUS_TXRp/a> 0x2 o 40p/a> o 41p/a>structopa href="+code=tiny_spi" class="sref">tiny_spip/a> { o 42p/a>        pspa
 class="comment">/* bitbang has to be first */p/spa
  o 43p/a>        structopa href="+code=spi_bitbang" class="sref">spi_bitbangp/a> pa href="+code=bitbang" class="sref">bitbangp/a>; o 44p/a>        structopa href="+code=compleon>
" class="sref">compleon>
p/a> pa href="+code=done" class="sref">donep/a>; o 45p/a> o 46p/a>        void pa href="+code=__iomem" class="sref">__iomemp/a> *pa href="+code=base" class="sref">basep/a>; o 47p/a>        intopa href="+code=irq" class="sref">irqp/a>; o 48p/a>        unsigned intopa href="+code=freq" class="sref">freqp/a>; o 49p/a>        unsigned intopa href="+code=baudwidth" class="sref">baudwidthp/a>; o 50p/a>        unsigned intopa href="+code=baud" class="sref">baudp/a>; o 51p/a>        unsigned intopa href="+code=speed_hz" class="sref">speed_hzp/a>; o 52p/a>        unsigned intopa href="+code=mode" class="sref">modep/a>; o 53p/a>        unsigned intopa href="+code=le
" class="sref">le
p/a>; o 54p/a>        unsigned intopa href="+code=txc" class="sref">txcp/a>,opa href="+code=rxc" class="sref">rxcp/a>; o 55p/a>        constopa href="+code=u8" class="sref">u8p/a> *pa href="+code=txp" class="sref">txpp/a>; o 56p/a>        pa href="+code=u8" class="sref">u8p/a> *pa href="+code=rxp" class="sref">rxpp/a>; o 57p/a>        unsigned intopa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a>; o 58p/a>        into*pa href="+code=gpio_cs" class="sref">gpio_csp/a>; o 59p/a>}; o 60p/a> o 61p/a>staticopa href="+code=inline" class="sref">inlinep/a> structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=tiny_spi_to_hw" class="sref">tiny_spi_to_hwp/a>(structopa href="+code=spi_device" class="sref">spi_devicep/a> *pa href="+code=sdev" class="sref">sdevp/a>) o 62p/a>{ o 63p/a>        return pa href="+code=spi_master_get_devdata" class="sref">spi_master_get_devdatap/a>(pa href="+code=sdev" class="sref">sdevp/a>->pa href="+code=master" class="sref">masterp/a>); o 64p/a>} o 65p/a> o 66p/a>staticounsigned intopa href="+code=tiny_spi_baud" class="sref">tiny_spi_baudp/a>(structopa href="+code=spi_device" class="sref">spi_devicep/a> *pa href="+code=spi" class="sref">spip/a>,ounsigned intopa href="+code=hz" class="sref">hzp/a>) o 67p/a>{ o 68p/a>        structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a> =opa href="+code=tiny_spi_to_hw" class="sref">tiny_spi_to_hwp/a>(pa href="+code=spi" class="sref">spip/a>); o 69p/a> o 70p/a>        return pa href="+code=mi
" class="sref">mi
p/a>(pa href="+code=DIV_ROUND_UP" class="sref">DIV_ROUND_UPp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=freq" class="sref">freqp/a>,opa href="+code=hz" class="sref">hzp/a> * 2), (1U <<opa href="+code=hw" class="sref">hwp/a>->pa href="+code=baudwidth" class="sref">baudwidthp/a>)) - 1; o 71p/a>} o 72p/a> o 73p/a>staticovoid pa href="+code=tiny_spi_chipselect" class="sref">tiny_spi_chipselectp/a>(structopa href="+code=spi_device" class="sref">spi_devicep/a> *pa href="+code=spi" class="sref">spip/a>,ointopa href="+code=is_aconve" class="sref">is_aconvep/a>) o 74p/a>{ o 75p/a>        structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a> =opa href="+code=tiny_spi_to_hw" class="sref">tiny_spi_to_hwp/a>(pa href="+code=spi" class="sref">spip/a>); o 76p/a> o 77p/a>        if (pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a>) { o 78p/a>                pa href="+code=gpio_set_lue="" class="sref">gpio_set_lue="p/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>[pa href="+code=spi" class="sref">spip/a>->pa href="+code=chip_select" class="sref">chip_selectp/a>], o 79p/a>                        (pa href="+code=spi" class="sref">spip/a>->pa href="+code=mode" class="sref">modep/a> &opa href="+code=SPI_CS_HIGH" class="sref">SPI_CS_HIGHp/a>) ?opa href="+code=is_aconve" class="sref">is_aconvep/a> : !pa href="+code=is_aconve" class="sref">is_aconvep/a>); o 80p/a>        } o 81p/a>} o 82p/a> o 83p/a>staticointopa href="+code=tiny_spi_setup_transfer" class="sref">tiny_spi_setup_transferp/a>(structopa href="+code=spi_device" class="sref">spi_devicep/a> *pa href="+code=spi" class="sref">spip/a>, o 84p/a>                                   structopa href="+code=spi_transfer" class="sref">spi_transferp/a> *pa href="+code=t" class="sref">tp/a>) o 85p/a>{ o 86p/a>        structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a> =opa href="+code=tiny_spi_to_hw" class="sref">tiny_spi_to_hwp/a>(pa href="+code=spi" class="sref">spip/a>); o 87p/a>        unsigned intopa href="+code=baud" class="sref">baudp/a> =opa href="+code=hw" class="sref">hwp/a>->pa href="+code=baud" class="sref">baudp/a>; o 88p/a> o 89p/a>        if (pa href="+code=t" class="sref">tp/a>) { o 90p/a>                if (pa href="+code=t" class="sref">tp/a>->pa href="+code=speed_hz" class="sref">speed_hzp/a> &&opa href="+code=t" class="sref">tp/a>->pa href="+code=speed_hz" class="sref">speed_hzp/a> !=opa href="+code=hw" class="sref">hwp/a>->pa href="+code=speed_hz" class="sref">speed_hzp/a>) o 91p/a>                        pa href="+code=baud" class="sref">baudp/a> =opa href="+code=tiny_spi_baud" class="sref">tiny_spi_baudp/a>(pa href="+code=spi" class="sref">spip/a>,opa href="+code=t" class="sref">tp/a>->pa href="+code=speed_hz" class="sref">speed_hzp/a>); o 92p/a>        } o 93p/a>        pa href="+code=writel" class="sref">writelp/a>(pa href="+code=baud" class="sref">baudp/a>,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_BAUD" class="sref">TINY_SPI_BAUDp/a>); o 94p/a>        pa href="+code=writel" class="sref">writelp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=mode" class="sref">modep/a>,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_CONTROL" class="sref">TINY_SPI_CONTROLp/a>); o 95p/a>        return 0; o 96p/a>} o 97p/a> o 98p/a>staticointopa href="+code=tiny_spi_setup" class="sref">tiny_spi_setupp/a>(structopa href="+code=spi_device" class="sref">spi_devicep/a> *pa href="+code=spi" class="sref">spip/a>) o 99p/a>{ o100p/a>        structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a> =opa href="+code=tiny_spi_to_hw" class="sref">tiny_spi_to_hwp/a>(pa href="+code=spi" class="sref">spip/a>); o101p/a> o102p/a>        if (pa href="+code=spi" class="sref">spip/a>->pa href="+code=max_speed_hz" class="sref">max_speed_hzp/a> !=opa href="+code=hw" class="sref">hwp/a>->pa href="+code=speed_hz" class="sref">speed_hzp/a>) { o103p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=speed_hz" class="sref">speed_hzp/a> =opa href="+code=spi" class="sref">spip/a>->pa href="+code=max_speed_hz" class="sref">max_speed_hzp/a>; o104p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=baud" class="sref">baudp/a> =opa href="+code=tiny_spi_baud" class="sref">tiny_spi_baudp/a>(pa href="+code=spi" class="sref">spip/a>,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=speed_hz" class="sref">speed_hzp/a>); o105p/a>        } o106p/a>        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=mode" class="sref">modep/a> =opa href="+code=spi" class="sref">spip/a>->pa href="+code=mode" class="sref">modep/a> &o(pa href="+code=SPI_CPOL" class="sref">SPI_CPOLp/a> |opa href="+code=SPI_CPHA" class="sref">SPI_CPHAp/a>); o107p/a>        return 0; o108p/a>} o109p/a> o1staticopa href="+code=inline" class="sref">inlinep/a> void pa href="+code=tiny_spi_wait_txr" class="sref">tiny_spi_wait_txrp/a>(structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a>) o111p/a>{ o112p/a>        while (!(pa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_STATUS" class="sref">TINY_SPI_STATUSp/a>) & o113p/a>                opa href="+code=TINY_SPI_STATUS_TXR" class="sref">TINY_SPI_STATUS_TXRp/a>)) o114p/a>                pa href="+code=cpu_relax" class="sref">cpu_relaxp/a>(); o115p/a>} o116p/a> o117p/a>staticopa href="+code=inline" class="sref">inlinep/a> void pa href="+code=tiny_spi_wait_txe" class="sref">tiny_spi_wait_txep/a>(structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a>) o118p/a>{ o119p/a>        while (!(pa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_STATUS" class="sref">TINY_SPI_STATUSp/a>) & o120p/a>                opa href="+code=TINY_SPI_STATUS_TXE" class="sref">TINY_SPI_STATUS_TXEp/a>)) o121p/a>                pa href="+code=cpu_relax" class="sref">cpu_relaxp/a>(); o122p/a>} o123p/a> o124p/a>staticointopa href="+code=tiny_spi_txrx_bufs" class="sref">tiny_spi_txrx_bufsp/a>(structopa href="+code=spi_device" class="sref">spi_devicep/a> *pa href="+code=spi" class="sref">spip/a>, structopa href="+code=spi_transfer" class="sref">spi_transferp/a> *pa href="+code=t" class="sref">tp/a>) o125p/a>{ o126p/a>        structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a> =opa href="+code=tiny_spi_to_hw" class="sref">tiny_spi_to_hwp/a>(pa href="+code=spi" class="sref">spip/a>); o127p/a>        constopa href="+code=u8" class="sref">u8p/a> *pa href="+code=txp" class="sref">txpp/a> =opa href="+code=t" class="sref">tp/a>->pa href="+code=tx_buf" class="sref">tx_bufp/a>; o128p/a>        pa href="+code=u8" class="sref">u8p/a> *pa href="+code=rxp" class="sref">rxpp/a> =opa href="+code=t" class="sref">tp/a>->pa href="+code=rx_buf" class="sref">rx_bufp/a>; o129p/a>        unsigned intopa href="+code=i" class="sref">ip/a>; o130p/a> o131p/a>        if (pa href="+code=hw" class="sref">hwp/a>->pa href="+code=irq" class="sref">irqp/a> >= 0) { o132p/a>                pspa
 class="comment">/* use interrupt driven data transfer */p/spa
  o133p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=le
" class="sref">le
p/a> =opa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a>; o134p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txp" class="sref">txpp/a> =opa href="+code=t" class="sref">tp/a>->pa href="+code=tx_buf" class="sref">tx_bufp/a>; o135p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=rxp" class="sref">rxpp/a> =opa href="+code=t" class="sref">tp/a>->pa href="+code=rx_buf" class="sref">rx_bufp/a>; o136p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txc" class="sref">txcp/a> =o0; o137p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=rxc" class="sref">rxcp/a> =o0; o138p/a> o139p/a>                pspa
 class="comment">/* send the first byte */p/spa
  o140p/a>                if (pa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a> > 1) { o141p/a>                        pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txp" class="sref">txpp/a> ? *pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txp" class="sref">txpp/a>++ : 0, o142p/a>                               pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o143p/a>                o       pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txc" class="sref">txcp/a>++; o144p/a>                        pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txp" class="sref">txpp/a> ? *pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txp" class="sref">txpp/a>++ : 0, o145p/a>                               pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o146p/a>                o       pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txc" class="sref">txcp/a>++; o147p/a>                        pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=TINY_SPI_STATUS_TXR" class="sref">TINY_SPI_STATUS_TXRp/a>,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_STATUS" class="sref">TINY_SPI_STATUSp/a>); o148p/a>                } else { o149p/a>                        pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txp" class="sref">txpp/a> ? *pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txp" class="sref">txpp/a>++ : 0, o150p/a>                o              pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o151p/a>                        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txc" class="sref">txcp/a>++; o152p/a>                        pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=TINY_SPI_STATUS_TXE" class="sref">TINY_SPI_STATUS_TXEp/a>,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_STATUS" class="sref">TINY_SPI_STATUSp/a>); o153p/a>                } o154p/a> o155p/a>                pa href="+code=wait_for_compleon>
" class="sref">wait_for_compleon>
p/a>(&pa href="+code=hw" class="sref">hwp/a>->pa href="+code=done" class="sref">donep/a>); o156p/a>        } else if (pa href="+code=txp" class="sref">txpp/a> &&opa href="+code=rxp" class="sref">rxpp/a>) { o157p/a>                pspa
 class="comment">/* we need to tighten the transfer loop */p/spa
  o158p/a>                pa href="+code=writeb" class="sref">writebp/a>(*pa href="+code=txp" class="sref">txpp/a>++,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o159p/a>                if (pa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a> > 1) { o160p/a>                o       pa href="+code=writeb" class="sref">writebp/a>(*pa href="+code=txp" class="sref">txpp/a>++,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o161p/a>                        for (pa href="+code=i" class="sref">ip/a> = 2;opa href="+code=i" class="sref">ip/a> <opa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a>;opa href="+code=i" class="sref">ip/a>++) { o162p/a>                                pa href="+code=u8" class="sref">u8p/a> pa href="+code=rx" class="sref">rxp/a>,opa href="+code=tx" class="sref">txp/a> = *pa href="+code=txp" class="sref">txpp/a>++; o163p/a>                o               pa href="+code=tiny_spi_wait_txr" class="sref">tiny_spi_wait_txrp/a>(pa href="+code=hw" class="sref">hwp/a>); o164p/a>                                pa href="+code=rx" class="sref">rxp/a> =opa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o165p/a>                                pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=tx" class="sref">txp/a>,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o166p/a>                o               *pa href="+code=rxp" class="sref">rxpp/a>++ =opa href="+code=rx" class="sref">rxp/a>; o167p/a>                        } o168p/a>                        pa href="+code=tiny_spi_wait_txr" class="sref">tiny_spi_wait_txrp/a>(pa href="+code=hw" class="sref">hwp/a>); o169p/a>                        *pa href="+code=rxp" class="sref">rxpp/a>++ =opa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o170p/a>                } o171p/a>                pa href="+code=tiny_spi_wait_txe" class="sref">tiny_spi_wait_txep/a>(pa href="+code=hw" class="sref">hwp/a>); o172p/a>                *pa href="+code=rxp" class="sref">rxpp/a>++ =opa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_RXDATA" class="sref">TINY_SPI_RXDATAp/a>); o173p/a>        } else if (pa href="+code=rxp" class="sref">rxpp/a>) { o174p/a>                pa href="+code=writeb" class="sref">writebp/a>(0,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o175p/a>                if (pa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a> > 1) { o176p/a>                o       pa href="+code=writeb" class="sref">writebp/a>(0, o177p/a>                               pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o178p/a>                        for (pa href="+code=i" class="sref">ip/a> = 2;opa href="+code=i" class="sref">ip/a> <opa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a>;opa href="+code=i" class="sref">ip/a>++) { o179p/a>                                pa href="+code=u8" class="sref">u8p/a> pa href="+code=rx" class="sref">rxp/a>; o180p/a>                o               pa href="+code=tiny_spi_wait_txr" class="sref">tiny_spi_wait_txrp/a>(pa href="+code=hw" class="sref">hwp/a>); o181p/a>                                pa href="+code=rx" class="sref">rxp/a> =opa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o182p/a>                                pa href="+code=writeb" class="sref">writebp/a>(0,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o183p/a>                o               *pa href="+code=rxp" class="sref">rxpp/a>++ =opa href="+code=rx" class="sref">rxp/a>; o184p/a>                        } o185p/a>                        pa href="+code=tiny_spi_wait_txr" class="sref">tiny_spi_wait_txrp/a>(pa href="+code=hw" class="sref">hwp/a>); o186p/a>                o       *pa href="+code=rxp" class="sref">rxpp/a>++ =opa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o187p/a>                } o188p/a>                pa href="+code=tiny_spi_wait_txe" class="sref">tiny_spi_wait_txep/a>(pa href="+code=hw" class="sref">hwp/a>); o189p/a>                *pa href="+code=rxp" class="sref">rxpp/a>++ =opa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_RXDATA" class="sref">TINY_SPI_RXDATAp/a>); o190p/a>        } else if (pa href="+code=txp" class="sref">txpp/a>) { o191p/a>                pa href="+code=writeb" class="sref">writebp/a>(*pa href="+code=txp" class="sref">txpp/a>++,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o192p/a>                if (pa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a> > 1) { o193p/a>                o       pa href="+code=writeb" class="sref">writebp/a>(*pa href="+code=txp" class="sref">txpp/a>++,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o194p/a>                        for (pa href="+code=i" class="sref">ip/a> = 2;opa href="+code=i" class="sref">ip/a> <opa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a>;opa href="+code=i" class="sref">ip/a>++) { o195p/a>                                pa href="+code=u8" class="sref">u8p/a> pa href="+code=tx" class="sref">txp/a> = *pa href="+code=txp" class="sref">txpp/a>++; o196p/a>                o               pa href="+code=tiny_spi_wait_txr" class="sref">tiny_spi_wait_txrp/a>(pa href="+code=hw" class="sref">hwp/a>); o197p/a>                                pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=tx" class="sref">txp/a>,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o198p/a>                        } o199p/a>                } o200p/a>                pa href="+code=tiny_spi_wait_txe" class="sref">tiny_spi_wait_txep/a>(pa href="+code=hw" class="sref">hwp/a>); o201p/a>        } else { o202p/a>                pa href="+code=writeb" class="sref">writebp/a>(0,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o203p/a>                if (pa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a> > 1) { o204p/a>                        pa href="+code=writeb" class="sref">writebp/a>(0,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o205p/a>                        for (pa href="+code=i" class="sref">ip/a> = 2;opa href="+code=i" class="sref">ip/a> <opa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a>;opa href="+code=i" class="sref">ip/a>++) { o206p/a>                o               pa href="+code=tiny_spi_wait_txr" class="sref">tiny_spi_wait_txrp/a>(pa href="+code=hw" class="sref">hwp/a>); o207p/a>                                pa href="+code=writeb" class="sref">writebp/a>(0,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o208p/a>                        } o209p/a>                } o210p/a>                pa href="+code=tiny_spi_wait_txe" class="sref">tiny_spi_wait_txep/a>(pa href="+code=hw" class="sref">hwp/a>); o211p/a>        } o212p/a>        return pa href="+code=t" class="sref">tp/a>->pa href="+code=le
" class="sref">le
p/a>; o213p/a>} o214p/a> o215p/a>staticopa href="+code=irqreturn_t" class="sref">irqreturn_tp/a> pa href="+code=tiny_spi_irq" class="sref">tiny_spi_irqp/a>(intopa href="+code=irq" class="sref">irqp/a>, void *pa href="+code=dev" class="sref">devp/a>) o216p/a>{ o217p/a>        structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a> =opa href="+code=dev" class="sref">devp/a>; o218p/a> o219p/a>        pa href="+code=writeb" class="sref">writebp/a>(0,opa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_STATUS" class="sref">TINY_SPI_STATUSp/a>); o220p/a>        if (pa href="+code=hw" class="sref">hwp/a>->pa href="+code=rxc" class="sref">rxcp/a> + 1 ==opa href="+code=hw" class="sref">hwp/a>->pa href="+code=le
" class="sref">le
p/a>) { o221p/a>                if (pa href="+code=hw" class="sref">hwp/a>->pa href="+code=rxp" class="sref">rxpp/a>) o222p/a>                        *pa href="+code=hw" class="sref">hwp/a>->pa href="+code=rxp" class="sref">rxpp/a>++ =opa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_RXDATA" class="sref">TINY_SPI_RXDATAp/a>); o223p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=rxc" class="sref">rxcp/a>++; o224p/a>                pa href="+code=compleoe" class="sref">compleoep/a>(&pa href="+code=hw" class="sref">hwp/a>->pa href="+code=done" class="sref">donep/a>); o225p/a>        } else { o226p/a>                if (pa href="+code=hw" class="sref">hwp/a>->pa href="+code=rxp" class="sref">rxpp/a>) o227p/a>                        *pa href="+code=hw" class="sref">hwp/a>->pa href="+code=rxp" class="sref">rxpp/a>++ =opa href="+code=readb" class="sref">readbp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o228p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=rxc" class="sref">rxcp/a>++; o229p/a>                if (pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txc" class="sref">txcp/a> <opa href="+code=hw" class="sref">hwp/a>->pa href="+code=le
" class="sref">le
p/a>) { o230p/a>                o       pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txp" class="sref">txpp/a> ? *pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txp" class="sref">txpp/a>++ : 0, o231p/a>                               pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_TXDATA" class="sref">TINY_SPI_TXDATAp/a>); o232p/a>                        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=txc" class="sref">txcp/a>++; o233p/a>                o       pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=TINY_SPI_STATUS_TXR" class="sref">TINY_SPI_STATUS_TXRp/a>, o234p/a>                               pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_STATUS" class="sref">TINY_SPI_STATUSp/a>); o235p/a>                } else { o236p/a>                o       pa href="+code=writeb" class="sref">writebp/a>(pa href="+code=TINY_SPI_STATUS_TXE" class="sref">TINY_SPI_STATUS_TXEp/a>, o237p/a>                               pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> +opa href="+code=TINY_SPI_STATUS" class="sref">TINY_SPI_STATUSp/a>); o238p/a>                } o239p/a>        } o240p/a>        return pa href="+code=IRQ_HANDLED" class="sref">IRQ_HANDLEDp/a>; o241p/a>} o242p/a> o243p/a>#ifdef pa href="+code=CONFIG_OF" class="sref">CONFIG_OFp/a> o244p/a>#include <linux/of_gpio.hp/a>> o245p/a> o246p/a>staticointopa href="+code=__devinit" class="sref">__devinitp/a> pa href="+code=tiny_spi_of_probe" class="sref">tiny_spi_of_probep/a>(structopa href="+code=platform_device" class="sref">platform_devicep/a> *pa href="+code=pdev" class="sref">pdevp/a>) o247p/a>{ o248p/a>        structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a> =opa href="+code=platform_get_drvdata" class="sref">platform_get_drvdatap/a>(pa href="+code=pdev" class="sref">pdevp/a>); o249p/a>        structopa href="+code=device_node" class="sref">device_nodep/a> *pa href="+code=np" class="sref">npp/a> =opa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>.pa href="+code=of_node" class="sref">of_nodep/a>; o250p/a>        unsigned intopa href="+code=i" class="sref">ip/a>; o251p/a>        constopa href="+code=__be32" class="sref">__be32p/a> *pa href="+code=val" class="sref">valp/a>; o252p/a>        intopa href="+code=le
" class="sref">le
p/a>; o253p/a> o254p/a>        if (!pa href="+code=np" class="sref">npp/a>) o255p/a>                return 0; o256p/a>        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a> =opa href="+code=of_gpio_count" class="sref">of_gpio_countp/a>(pa href="+code=np" class="sref">npp/a>); o257p/a>        if (pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a>) { o258p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a> =opa href="+code=devm_kzalloc" class="sref">devm_kzallocp/a>(&pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>, o259p/a>                                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a> * sizeof(unsigned int), o260p/a>                o               pa href="+code=GFP_KERNEL" class="sref">GFP_KERNELp/a>); o261p/a>                if (!pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>) o262p/a>                        return -pa href="+code=ENOMEM" class="sref">ENOMEMp/a>; o263p/a>        } o264p/a>        for (pa href="+code=i" class="sref">ip/a> = 0;opa href="+code=i" class="sref">ip/a> <opa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a>;opa href="+code=i" class="sref">ip/a>++) { o265p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>[pa href="+code=i" class="sref">ip/a>] =opa href="+code=of_get_gpio_flags" class="sref">of_get_gpio_flagsp/a>(pa href="+code=np" class="sref">npp/a>,opa href="+code=i" class="sref">ip/a>,opa href="+code=NULL" class="sref">NULLp/a>); o266p/a>                if (pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>[pa href="+code=i" class="sref">ip/a>] <o0) o267p/a>                        return -pa href="+code=ENODEV" class="sref">ENODEVp/a>; o268p/a>        } o269p/a>        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=bitbang" class="sref">bitbangp/a>.pa href="+code=master" class="sref">masterp/a>->pa href="+code=dev" class="sref">devp/a>.pa href="+code=of_node" class="sref">of_nodep/a> =opa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>.pa href="+code=of_node" class="sref">of_nodep/a>; o270p/a>        pa href="+code=val" class="sref">valp/a> =opa href="+code=of_get_property" class="sref">of_get_propertyp/a>(pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>.pa href="+code=of_node" class="sref">of_nodep/a>, o271p/a>                              pspa
 class="string">"clock-frequency"p/spa
 , &pa href="+code=le
" class="sref">le
p/a>); o272p/a>        if (pa href="+code=val" class="sref">valp/a> &&opa href="+code=le
" class="sref">le
p/a> >= sizeof(pa href="+code=__be32" class="sref">__be32p/a>)) o273p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=freq" class="sref">freqp/a> =opa href="+code=be32_to_cpup" class="sref">be32_to_cpupp/a>(pa href="+code=val" class="sref">valp/a>); o274p/a>        pa href="+code=val" class="sref">valp/a> =opa href="+code=of_get_property" class="sref">of_get_propertyp/a>(pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>.pa href="+code=of_node" class="sref">of_nodep/a>, pspa
 class="string">"baud-width"p/spa
 , &pa href="+code=le
" class="sref">le
p/a>); o275p/a>        if (pa href="+code=val" class="sref">valp/a> &&opa href="+code=le
" class="sref">le
p/a> >= sizeof(pa href="+code=__be32" class="sref">__be32p/a>)) o276p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=baudwidth" class="sref">baudwidthp/a> =opa href="+code=be32_to_cpup" class="sref">be32_to_cpupp/a>(pa href="+code=val" class="sref">valp/a>); o277p/a>        return 0; o278p/a>} o279p/a>#else pspa
 class="comment">/* !CONFIG_OF */p/spa
  o280p/a>staticointopa href="+code=__devinit" class="sref">__devinitp/a> pa href="+code=tiny_spi_of_probe" class="sref">tiny_spi_of_probep/a>(structopa href="+code=platform_device" class="sref">platform_devicep/a> *pa href="+code=pdev" class="sref">pdevp/a>) o281p/a>{ o282p/a>        return 0; o283p/a>} o284p/a>#endif pspa
 class="comment">/* CONFIG_OF */p/spa
  o285p/a> o286p/a>staticointopa href="+code=__devinit" class="sref">__devinitp/a> pa href="+code=tiny_spi_probe" class="sref">tiny_spi_probep/a>(structopa href="+code=platform_device" class="sref">platform_devicep/a> *pa href="+code=pdev" class="sref">pdevp/a>) o287p/a>{ o288p/a>        structopa href="+code=tiny_spi_platform_data" class="sref">tiny_spi_platform_datap/a> *pa href="+code=platp" class="sref">platpp/a> =opa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>.pa href="+code=platform_data" class="sref">platform_datap/a>; o289p/a>        structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a>; o290p/a>        structopa href="+code=spi_master" class="sref">spi_masterp/a> *pa href="+code=master" class="sref">masterp/a>; o291p/a>        structopa href="+code=resource" class="sref">resourcep/a> *pa href="+code=res" class="sref">resp/a>; o292p/a>        unsigned intopa href="+code=i" class="sref">ip/a>; o293p/a>        intopa href="+code=err" class="sref">errp/a> =o-pa href="+code=ENODEV" class="sref">ENODEVp/a>; o294p/a> o295p/a>        pa href="+code=master" class="sref">masterp/a> =opa href="+code=spi_alloc_master" class="sref">spi_alloc_masterp/a>(&pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>, sizeof(structopa href="+code=tiny_spi" class="sref">tiny_spip/a>)); o296p/a>        if (!pa href="+code=master" class="sref">masterp/a>) o297p/a>                return pa href="+code=err" class="sref">errp/a>; o298p/a> o299p/a>        pspa
 class="comment">/* setup the master state. */p/spa
  o300p/a>        pa href="+code=master" class="sref">masterp/a>->pa href="+code=bus_num" class="sref">bus_nump/a> =opa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=id" class="sref">idp/a>; o301p/a>        pa href="+code=master" class="sref">masterp/a>->pa href="+code=num_chipselect" class="sref">num_chipselectp/a> =o255; o302p/a>        pa href="+code=master" class="sref">masterp/a>->pa href="+code=mode_bits" class="sref">mode_bitsp/a> =opa href="+code=SPI_CPOL" class="sref">SPI_CPOLp/a> |opa href="+code=SPI_CPHA" class="sref">SPI_CPHAp/a> |opa href="+code=SPI_CS_HIGH" class="sref">SPI_CS_HIGHp/a>; o303p/a>        pa href="+code=master" class="sref">masterp/a>->pa href="+code=setup" class="sref">setupp/a> =opa href="+code=tiny_spi_setup" class="sref">tiny_spi_setupp/a>; o304p/a> o305p/a>        pa href="+code=hw" class="sref">hwp/a> =opa href="+code=spi_master_get_devdata" class="sref">spi_master_get_devdatap/a>(pa href="+code=master" class="sref">masterp/a>); o306p/a>        pa href="+code=platform_set_drvdata" class="sref">platform_set_drvdatap/a>(pa href="+code=pdev" class="sref">pdevp/a>,opa href="+code=hw" class="sref">hwp/a>); o307p/a> o308p/a>        pspa
 class="comment">/* setup the state for the bitbang driver */p/spa
  o309p/a>        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=bitbang" class="sref">bitbangp/a>.pa href="+code=master" class="sref">masterp/a> =opa href="+code=spi_master_get" class="sref">spi_master_getp/a>(pa href="+code=master" class="sref">masterp/a>); o310p/a>        if (!pa href="+code=hw" class="sref">hwp/a>->pa href="+code=bitbang" class="sref">bitbangp/a>.pa href="+code=master" class="sref">masterp/a>) o311p/a>                return pa href="+code=err" class="sref">errp/a>; o312p/a>        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=bitbang" class="sref">bitbangp/a>.pa href="+code=setup_transfer" class="sref">setup_transferp/a> =opa href="+code=tiny_spi_setup_transfer" class="sref">tiny_spi_setup_transferp/a>; o313p/a>        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=bitbang" class="sref">bitbangp/a>.pa href="+code=chipselect" class="sref">chipselectp/a> =opa href="+code=tiny_spi_chipselect" class="sref">tiny_spi_chipselectp/a>; o314p/a>        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=bitbang" class="sref">bitbangp/a>.pa href="+code=txrx_bufs" class="sref">txrx_bufsp/a> =opa href="+code=tiny_spi_txrx_bufs" class="sref">tiny_spi_txrx_bufsp/a>; o315p/a> o316p/a>        pspa
 class="comment">/* find and map our resources */p/spa
  o317p/a>        pa href="+code=res" class="sref">resp/a> =opa href="+code=platform_get_resource" class="sref">platform_get_resourcep/a>(pa href="+code=pdev" class="sref">pdevp/a>,opa href="+code=IORESOURCE_MEM" class="sref">IORESOURCE_MEMp/a>,o0); o318p/a>        if (!pa href="+code=res" class="sref">resp/a>) o319p/a>                goto pa href="+code=exit_busy" class="sref">exit_busyp/a>; o320p/a>        if (!pa href="+code=devm_request_mem_regio
" class="sref">devm_request_mem_regio
p/a>(&pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>, pa href="+code=res" class="sref">resp/a>->pa href="+code=start" class="sref">startp/a>, pa href="+code=resource_size" class="sref">resource_sizep/a>(pa href="+code=res" class="sref">resp/a>), o321p/a>                                     pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=nam"" class="sref">nam"p/a>)) o322p/a>                goto pa href="+code=exit_busy" class="sref">exit_busyp/a>; o323p/a>        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a> =opa href="+code=devm_ioremap_nocache" class="sref">devm_ioremap_nocachep/a>(&pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>, pa href="+code=res" class="sref">resp/a>->pa href="+code=start" class="sref">startp/a>, o324p/a>                                        pa href="+code=resource_size" class="sref">resource_sizep/a>(pa href="+code=res" class="sref">resp/a>)); o325p/a>        if (!pa href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a>) o326p/a>                goto pa href="+code=exit_busy" class="sref">exit_busyp/a>; o327p/a>        pspa
 class="comment">/* irq is optio
al */p/spa
  o328p/a>        pa href="+code=hw" class="sref">hwp/a>->pa href="+code=irq" class="sref">irqp/a> =opa href="+code=platform_get_irq" class="sref">platform_get_irqp/a>(pa href="+code=pdev" class="sref">pdevp/a>,o0); o329p/a>        if (pa href="+code=hw" class="sref">hwp/a>->pa href="+code=irq" class="sref">irqp/a> >= 0) { o330p/a>                pa href="+code=init_compleoio
" class="sref">init_compleoio
p/a>(&pa href="+code=hw" class="sref">hwp/a>->pa href="+code=done" class="sref">donep/a>); o331p/a>                pa href="+code=err" class="sref">errp/a> =opa href="+code=devm_request_irq" class="sref">devm_request_irqp/a>(&pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>, pa href="+code=hw" class="sref">hwp/a>->pa href="+code=irq" class="sref">irqp/a>, pa href="+code=tiny_spi_irq" class="sref">tiny_spi_irqp/a>, 0, o332p/a>                                       pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=nam"" class="sref">nam"p/a>,opa href="+code=hw" class="sref">hwp/a>); o333p/a>                if (pa href="+code=err" class="sref">errp/a>) o334p/a>                        goto pa href="+code=exit" class="sref">exitp/a>; o335p/a>        } o336p/a>        pspa
 class="comment">/* find platform data */p/spa
  o337p/a>        if (pa href="+code=platp" class="sref">platpp/a>) { o338p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a> =opa href="+code=platp" class="sref">platpp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a>; o339p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a> =opa href="+code=platp" class="sref">platpp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>; o340p/a>                if (pa href="+code=platp" class="sref">platpp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a> &&o!pa href="+code=platp" class="sref">platpp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>) o341p/a>                        goto pa href="+code=exit_busy" class="sref">exit_busyp/a>; o342p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=freq" class="sref">freqp/a> =opa href="+code=platp" class="sref">platpp/a>->pa href="+code=freq" class="sref">freqp/a>; o343p/a>                pa href="+code=hw" class="sref">hwp/a>->pa href="+code=baudwidth" class="sref">baudwidthp/a> =opa href="+code=platp" class="sref">platpp/a>->pa href="+code=baudwidth" class="sref">baudwidthp/a>; o344p/a>        } else { o345p/a>                pa href="+code=err" class="sref">errp/a> =opa href="+code=deny_spi_of_probep/a>(structopa href="+code=platform_devf="+code=pdev" class="sref">pdevp/a>->p o2434/a>                if (pa href="+code=hwr" class="sref">errp/a>) o2434/a>                        reto pa href="+code=exit" class="sref">exitp/a>; o2434/a>        } o243p/a>        str (pa href="+code=i" class="sref">ip/a> = 0;opa href="+code=i" class="sref">ip/a> <opa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a>;opa href="+code=i" class="sref">ip/a>++) { o2535/a>                pa href="+code=inr" class="sref">errp/a> =opa href="+code=deio_csquest_iclass="sref">gpio_csquest_im_devf="+code=pdev" " class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>[pa href="+code=i" class="sref">ip/a>] &pa href="+code=hw>-&_m"" class="sref">na>-&_m"" a>(&pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>, ; o2535/a>                if (pa href="+code=hwr" class="sref">errp/a>) o2535/a>                          to pa href="+code=exit_buio_cclass="sref">exit_buio_ca>; o2535/a>                pa href="+code=hwio_csdireco
p/_outpuiclass="sref">gpio_csdireco
p/_outpuim_devf="+code=pdev" " class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>[pa href="+code=i" class="sref">ip/a>] &pa1 o253p/a>        ifo2535/a>        pa href="+code=hw" class="sref">hwp/a> =gt;pa href="+code=bitbang" class="sref">bitbangp/a>.pa href="+code=master" class="sref">masterp/a>->pa href="+code=dem_chipselect" class="sref">num_chipselectp/a> =o25 href="+code=mastxclass="sref">mastxm_dev1Upa href="+code=hw" class="sref">hwp/a>->pa href="+code=irio_cs_count" class="sref">gpio_cs_countp/a>) {o253p/a>  a href="drivers/spi/spi-oc-tiny.c#L325" idv2L243" class="line" nam"v2L253">o2535/a>        pspa
 class="comment">/* irgio
er str rei-oonsttroll */p/spa
  o2535/a>        pa href="+code=hwr" class="sref">errp/a> =opa href="+code=decodetbangp/_art" class="sref">staodetbangp/_art" a>(&pa href="+code=hw" class="sref">hwp/a>->pa href="+code=dotbang" class="sref">bitbangp/a>.p{o2535/a>        if (pa href="+code=hwr" class="sref">errp/a>) o263p/a>                o to pa href="+code=exit" class="sref">exitp/a>; o2636/a>        pa href="+code=ma>-&_infcclass="sref">ex>-&_infca>(&pa href="+code=pdev" class="sref">pdevp/a>->pa href="+code=dev" class="sref">devp/a>, pa a
 class="string">"baud { %p,rq is%d\nuot;p/spa
 , &a href="+code=hw" class="sref">hwp/a>->pa href="+code=base" class="sref">basep/a>) pa href="+code=hw" class="sref">hwp/a>->pa href="+code=irq" class="sref">irqp/a>, {o2636/a> o263p/a>        } turn 0; o2636/a> o263p/a>   href="+code=exit_buio_cclass="sref">exit_buio_ca>; :a href="drivers/spi/spi-oc-tiny.c#L305" idv2L243" class="line" nam"v2L263">o263p/a>          whilepa href="+code=i" class="sref">ip/a> =--gt;= ) o263p/a>                   href="+code=irio_csfre class="sref">baio_csfre m_devf="+code=pdev" " class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>[pa href="+code=i" class="sref">ip/a>] &{o263p/a>   href="+code=exit_busy" class="sref">exit_busyp/a>; :a href="drivers/spi/spi-oc-tiny.c#L305" idv2L243" class="line" nam"v2L263">o263p/a>        pa href="+code=hwr" class="sref">errp/a> =o-pa href="+code=ENOBUSYclass="sref">erOBUSYa>; o273p/a>   href="+code=exit" class="sref">exitp/a>; :a href="drivers/spi/spi-oc-tiny.c#L305" idv2L273" class="line" nam"v2L273">o2737/a>        pa href="+code=maatform_set_drvdata" class="sref">platform_set_drvdatap/a>(pa href="+code=pdev" class="sref">pdevp/a>,opa href="+code=hwLL" class="sref">NULLp/a>); o2737/a>        pa href="+code=hws_master_gepuiclass="sref">gps_master_gepuia>(pa href="+code=pdster" class="sref">masterp/a>); o2737/a>        } turn 0; href="+code=hwr" class="sref">errp/a> =o273p/a>  o2737/a> o2737/a>staticointopa href="+code=__devinit" class="sref">exdevinit" a>    href="+code=deny_spi_ofremov/a>(structopa href="+coderemov/a>(paructopa href="+code=platform_device" class="sref">platform_devicep/a> *pa href="+code=pdev" class="sref">pdevp/a>) o2737/a>{ o2737/a>        structopa href="+code=tiny_spi" class="sref">tiny_spip/a> *pa href="+code=hw" class="sref">hwp/a> =opa href="+code=platform_get_drvdata" class="sref">platform_get_drvdatap/a>(pa href="+code=pdev" class="sref">pdevp/a>); o2737/a>        structopa href="+code=tis_master" class="sref">spi_masterp/a> *pa href="+code=master" class="sref">masterp/a>; opa href="+code=pl" class="sref">hwp/a> =gt;pa href="+code=bitbang" class="sref">bitbangp/a>.pa href="+code=master" class="sref">masterp/a>-&o2838/a>        unsigned intopa href="+code=i" class="sref">ip/a>; o283p/a>{ a href="drivers/spi/spi-oc-tiny.c#L253" idv2L273" class="line" nam"v2L283">o2838/a>        pa href="+code=hws_matbangp/_aro class="sref">set_matbangp/_aro a>(&pa href="+code=hw" class="sref">hwp/a>->pa href="+code=dotbang" class="sref">bitbangp/a>.p{o2838/a>        } r (pa href="+code=i" class="sref">ip/a> = 0;opa href="+code=i" class="sref">ip/a> <opa href="+code=hw" class="sref">hwp/a>->pa href="+code=gpio_cs_count" class="sref">gpio_cs_countp/a>;opa href="+code=i" class="sref">ip/a>++) {a href="drivers/spi/spi-oc-tiny.c#L325" idv2L263" class="line" nam"v2L283">o2838/a>                   href="+code=irio_csfre class="sref">baio_csfre m_devf="+code=pdev" " class="sref">hwp/a>->pa href="+code=gpio_cs" class="sref">gpio_csp/a>[pa href="+code=i" class="sref">ip/a>] &{o2838/a>        pa href="+code=hwatform_set_drvdata" class="sref">platform_set_drvdatap/a>(pa href="+code=pdev" class="sref">pdevp/a>,opa href="+code=hwLL" class="sref">NULLp/a>); o2838/a>        pa href="+code=pls_master_gepuiclass="sref">gps_master_gepuia>(pa href="+code=pdster" class="sref">masterp/a>); o2838/a>        return 0; o2838/a>} o283p/a>  a href="drivers/spi/spi-oc-tiny.c#L273" idv2L293" class="line" nam"v2L293">o293p/a>  fdef pa href="+code=CONFIG_OF" class="sref">CONFIG_OFp/a> o293p/a>  aticoinnstopaructopa href="+code=tiofevicep/_" class="sref">idofevicep/_" a>    href="+code=deny_spi_ofmatc class="sref">bany_spi_ofmatc a>[pa=opao293p/a>        un{ a href="+code=chiompicobl class="sref">baiompicobl a>; opa a
 class="string">"baopencores,ny.c-i-ocrtlsvn2uot;p/spa
 , &a}o293p/a>        in{}o293p/a> <}o2939/a>   href="+code=exMODULE_DEVICE_TABLEclass="sref">baMODULE_DEVICE_TABLEa>(pa href="+code=pdofclass="sref">idofa>,opa href="+code=hwny_spi_ofmatc class="sref">bany_spi_ofmatc a>[p o293p/a>  lse pspa
 class="comment">/* !CNFIG_OF */p/spa
  o293p/a>  #f pe" a href="+code=hwny_spi_ofmatc class="sref">bany_spi_ofmatc a>[pa href="+code=hwLL" class="sref">NULLp/a>);a href="drivers/spi/spi-oc-tiny.c#L283" idv2L283" class="line" nam"v2L293">o293p/a> /* CONFIG_OF */p/spa
  o2939/a>  a href="drivers/spi/spi-oc-tiny.c#L274" idv2L304" class="line" nam"v2L304">o3040/a>staticoinructopa href="+code=platform_devvers/class="sref">platform_devvers/a>    href="+code=deny_spi_ofvvers/class="sref">plny_spi_ofvvers/a>; opao304p/a>        paa href="+code=plabep/a>(structopa hratform_deopa href="+code=deny_spi_ofobe" class="sref">tiny_spi_probep/a>(so304p/a>        paa href="+code=plremov/a>(structopa hrremov/a>(popa href="+code=dedevinit" _ class="sref">sedevinit" _ a>(pa href="+code=pdny_spi_ofremov/a>(structopa href="+coderemov/a>(p o304p/a>        paa href="+code=plvvers/class="sref">plvvers/a>; opao3040/a>                  a href="+code=plm"" class="sref">nam"p/a>,oopa href="+code=deDRV_NAMEclass="sref">baDRV_NAMEa>(so3040/a>                paa href="+code=of_wns/class="sref">pl_wns/a>,oopa href="+code=deTHIS_MODULEclass="sref">plTHIS_MODULEa>(so3040/a>                ifa href="+code=pla class="sref">bup/a> =opa href="+code=pdLL" class="sref">NULLp/a>);o3040/a>                  a href="+code=of_nomatc _tabl class="sref">ba_nomatc _tabl m_deopa href="+code=deny_spi_ofmatc class="sref">bany_spi_ofmatc a>[po304p/a>        ps}o304p/a>  }o3141/a>   href="+code=exmodule_atform_devvers/class="sref">plmodule_atform_devvers/a>(pa href="+code=pdny_spi_ofvvers/class="sref">plny_spi_ofvvers/a>;  o3141/a>{ a href="drivers/spi/spi-oc-tiny.c#L254" idv2L314" class="line" nam"v2L314">o314p/a>   href="+code=exMODULE_DESCRIPTIONclass="sref">baMODULE_DESCRIPTIONa>(pa a
 class="string">"baOpenCores ny.c SPIriver */spi/spi-oc-t ; o314p/a>   href="+code=exMODULE_AUTHORclass="sref">baMODULE_AUTHORa>(pa a
 class="string">"baThomas Choult;opthomas@wytron.mme.twt;pa/spi/spi-oc-t o314p/a>   href="+code=exMODULE_LICENSEclass="sref">baMODULE_LICENSEa>(pa a
 class="string">"baGPL/spi/spi-oc-t o3141/a>   href="+code=exMODULE_ALIASclass="sref">baMODULE_ALIASa>(pa a
 class="string">"baatform_d:/spi/spi-oc-ta href="+code=deDRV_NAMEclass="sref">baDRV_NAMEa>(s o314p/a>  
The origil */LXR software byhe bi href="drhttp://urce_srm_ge.net/projects/lx c>LXR mmenunip/a>(p,he is experint"> */rs/sion byh href="drmailto:lx @ne"ux.no">lx @ne"ux.noa>.pa lx .ne"ux.no kindly hosted byh href="drhttp://www.redpill-ne"pro.no">Redpill Le"pro ASa>(p, provid strf Le"uxnnstoulny.gnd maertyao p/s sercep/s since 1995.