Git Product home page Git Product logo

pata-gpio's Introduction

pata-gpio

Adapter PCB dmesg Output

Overview

DISCLAIMER: This driver was developed for fun and learning ATA internals. If you're looking for a practical way to use PATA devices, look for commercial USB adapters.

pata-gpio is a Linux kernel driver for GPIO bitbanged PATA (also known as ATA/ATAPI or IDE).
Pin configuration can be set via device tree, the regular ATA framework is used.

IDE Primary/Secondary device support is implemented.

Performance

On a Raspberry Pi 4 (with direct GPIO) about 800 KiB/s reading, 500 KiB/s writing speed is possible. Most of the performance bottleneck is down to the usage of libgpiod (kernel gpio abstraction), which is optimized for tasks like switching LEDs. Data transmission is well outside the design scope of libgpiod.

DMA and interrupts are not implemented at the moment.

Device tree configuration

Pin configuration can be specified in the device tree.
An example device tree is provided as atapi-direct.dts.
This includes the pin configuration for the schematic linked at the bottom of this readme.

The following device tree properties are present:

Property Usage Required
databus-gpios list of 16 GPIO pins, connected to ATA D0 - D15 in this order yes
cs-gpios list of 2 GPIO pins, connected to ATA CS0 and CS1 in this order yes
address-gpios list of 3 GPIO pins, connected to ATA DA0, DA1 and DA2 in this order yes
strobe-write-gpio GPIO pin, connected to ATA IOW line yes
strobe-read-gpio GPIO pin, connected to ATA IOR line yes
reset-gpio GPIO pin, connected to ATA RESET line no

Interrupts

The driver has experimental interrupt support. An example configuration with GPIO interrupts is outlined in atapi-direct-irq.dts.
Interrupts are configured via the generic interrupts property. If the interrupts property is not specified the driver falls back to polling.

Compiling

Before loading (and running) the kernel module, make sure to load the device tree overlay.
This can be done via the config.txt (on a Raspberry Pi): dtoverlay=atapi-direct, or by running ./loaddt.sh.
The latter script will also compile and save the device tree to /boot/overlays/atapi-direct.dtbo.

This module needs kernel headers, regular build dependencies and a kernel with the config option CONFIG_ATA_SFF=y set.
The ATA_SFF option is not the default on Raspberry Pis, so you will need to build a custom kernel.

Compile the module using:
make

Load the module using:
insmod pata-gpio.ko

A helper script called ./run.sh is provided, which will remove any loaded pata-gpio module, compile it and load the resulting module.
Further status information can be shown by running dmesg.

Additional info

Adapter PCB
Adapter schematic

Older schematic (not SMI-ready)
Video: Audio CD streaming
Twitter: Project presentation

Credits

Thanks to @Toble_Miner for a lot of help in the development of this driver!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.