Skip to content

UDOO kernel source, heavily modified, with instructions on how to change the default UART.

Notifications You must be signed in to change notification settings

jaketesler/UDOO_Kernel

 
 

Repository files navigation

#UDOO KERNEL iMX.6/SAMx3
"Cheat Sheet"

To anybody reading this, these are my personal notes integrated into a README. Proceed with caution...
IMPORTANT: This fork is meant for UDOO development only. Files specific to other platforms might be missing.

###Info:
Please see the File/Folder Cheat Sheet section for details.
UBOOT documentation files are located in the /UDOO folder
See also u-boot-mx6 repo.
Files with "sdl" are Dual-Core; files with "qd" are Quad-Core. If you change something within a file it will only affect that specific core architecture platform.

To compile the kernel, use the custom included utility "udoo-kc"
See "udoo-kc --help" for help.

Jake's really dumb solution to change UARTs: To change default UARTs, do a global search for UARTx and ttymxc(x-1) and imx.uart(x-1).

###NOTE: For this document, UDOO Dual-Core (sdl) is used as the example. To switch from Dual- to Quad-Core, just replace (sdl) with (qd) or (Q) within files as needed.
##GPIO Pin Reference From now on, please use the following naming convention (bold) when referring to UDOO or GPIO pins:

  • GPIO "software pin" (SWPin):
    This is the GPIO pin as defined in the UDOO graphical pin diagram, or GPD and used for manually manipulating the value.
    [e.g. pin number is the 'XX' value in /sys/class/gpio/gpioXX/direction]
    The SW pin can be found on the GPD.
    NOTE: If a pin is muxed to be a GPIO, use SW Pin. If it is muxed to something other than a GPIO (UART, I2C, etc.), describe it as a SW BUS pin.

  • GPIO "software interface" or "software bus" (SW BUS):
    If a pin is muxed as something other than GPIO, we need to describe it as such. Use "software interface" instead of "software pin".
    [e.g. UART4, PWM3, SDA1]
    The different interface types of the pins are listed on the GPD.
    NOTE: Certain HW pins can have multiple software interface types, and some exact interface types even appear on multiple pins. If possible, mention either the SW or HW pin associated with the SW BUS.

  • GPIO "kernel pin" (KERPin):
    This is the name of the pin as defined in the UDOO alternate pin table, or APT documentation and in the kernel source files.
    [e.g. the CSI0\_DAT13 in MX6DL\_PAD\_CSI0\_DAT13\_\_UART4\_RXD,, or the GPIO\_1 in MX6DL\_PAD\_GPIO\_1\_\_PWM2\_PWMO,.]
    The KER Pin can be found in the APT, where the HW Pin will be listed under ALT5 as GPIO#_IOxx whereby xx is the HW GPIO pin you want.
    Look down the column, and within iMX.6, the "Pin Name" will be the KER Pin.

  • GPIO "hardware pin" or "physical pin" (HWPin):
    This is the pin number that corresponds to the silkscreen on the board (or on the GPD).
    [e.g. D58, TX1]
    The HW Pin can be found on the GPD.

  • GPIO "dev pin" (DEVPin):
    This isn't really a number, but we can use this to describe the /dev/ttyXXXX file a particular SW Pin or KER Pin refers to.
    [e.g. ttymxc3, tty1]

As an example, SW Pin 137 is the same as HW Pin D31 and is the same as KER Pin DISP0_DAT10.
Alternatively, SW Pin 159, SW BUS UART4RX, KER Pin CSI0_DAT13, HW Pin RX1, and DEV Pin ttymxc3 all correspond to the same GPIO 'pin'.

Note: A LOT of the pin definitions have a comma at the end of the line. Don't forget the comma!


## KERNEL File MODIFICATIONS Two header files in arch/arm/mach-mx6
Modified file drm.h in include/drm/
Modified `static inline void mx6q\_seco\_UDOO\_init\_uart` in board-mx6\_seco\_UDOO.c to include more UART ports
Removed unnecessary files (unrelated to UDOO development) from arch/arm/mach-mx6
## SYSTEM Made changes to (and added file) /etc/init/ttymxc3.conf
cmd: stty to fix baud rate of ports to 9600 [`sudo stty -F /dev/ttymxc3 9600`]
modified /etc/default/console-setup to include more ttys[#]

Getty confirmation code:

ps -ef | grep getty [to confirm login prompt dialogs]

CONNECTIONS:

DEV Pin : SW BUS : add'l conn.
ttymxc0 : UART1
ttymxc1 : UART2 : USB
ttymxc2* : ? : ?
ttymxc3 : UART4+R : TXRX1
ttymxc4* : ? : ?
*just appeared recently...out of nowhere.

###To connect: Type into prompt:

screen /dev/tty[[whatever file it is, see above]] 115200

replace the brackets with the name of the connector
use ls /dev/tty* to find devices

##GPIOs

TO MAKE CHANGES TO GPIO PINS:

###Pin Muxing To change the Software Function of a GPIO pin (i.e. GPIO —> UART instead):

  1. Find the architecture core platform header file and search for the KER Pin name within the file (e.g. board-mx6qd_seco_UDOO.h)
  2. Comment out the previous definition from the static iomux\_v3\_cfg\_t mx6sdl\_seco\_UDOO\_pads[] method. Uncomment the mode you want instead. There are many forms of the pin in the code, so just uncomment the one you want and comment the previous pin definition.
    NOTE: Leave only ONE uncommented!
  3. If you are changing a pin from SW Pin (Direct GPIO) to a SW BUS, comment out the KER Pin entry from one of the mx6dl\_set\_\*\_outputmode\_\* methods below.
    If changing from a SW BUS to a GPIO, be sure to uncomment a KER PIN entry.

###Change the startup value of a GPIO pin (input/outHigh/outLow):

  1. Open board-mx6sdl_seco_UDOO.h in /arch/arm/mx6 (or quad name and respective header file for that board instead)
  2. Comment out pin definition from one method, uncomment in the method you want
    (e.g.) move MX6DL\_PAD\_GPIO\_0\_\_GPIO\_MODE, (including comma)
    from static unsigned int mx6dl\_set\_in\_outputmode\_high[]
    to static unsigned int mx6dl\_set\_in\_outputmode\_low[]
    to change from default outputHigh to outoutLow on boot.

The startup methods are:

static unsigned int mx6dl_set_in_outputmode_high[]	-- default output, HIGH
static unsigned int mx6dl_set_in_outputmode_low[]	-- default output, LOW
static unsigned int mx6dl_set_in_inputmode[]		-- default input

###Kernel Configuration Within the kernel source, a KER Pin name cannot just be copied and pasted into a line within the header code.
Here is the general format for the KER Pin entries in the header source file:

MX6DL_PAD_**[KER Pin]**__**[KER Pin-specific function]**,
e.g. [MX6DL_PAD_SD1_DAT2__GPIO_1_19,]

For the default startup values (GPIO-only), the format is as follows:

MX6DL_PAD_**[KER Pin]**__GPIO_MODE,
[e.g. MX6DL_PAD_SD1_DAT2__GPIO_MODE,]

###To write to a GPIO pin: 1) echo out > /sys/class/gpio/gpioxx/direction 2a) echo 1 > /sys/class/gpio/gpioxx/value <-- high 2b) echo 0 > /sys/class/gpio/gpioxx/value <-- low [where xx is the GPIO SW Pin]
####Other Project-specific GPIO Notes LED protoblock is on SWpin GPIO20 / GPIO17
To regenerate a modules.dep file when a new kernel is uploaded, use the following command: sudo depmod -a 3.0.35 [or other version of kernel]


## External sources [UDOO Alt Pin Table](http://udoo.org/download/files/pinout/UDOO_pinout_alternate_table.pdf)
[UDOO Graphical Pin Table](http://udoo.org/download/files/pinout/Udoo_pinout_diagram.pdf) [UDOO.com][udoowebsite]



#Kernel File/Folder Cheat Sheet ###This section lists significant files and what they do, or what to do with them. I have tried to indicate what files I have changed.
###To change from one serial (radio) UART/tty to a different one, please modify files marked with a (U) in the manner noted. Be sure to do this here and for the U-BOOT source as well, as modifying one source (e.g. kernel) and compiling without changing the other (e.g. U-BOOT) will crash the UDOO.
I have tried to be as specific as possible. When modifying, please try to update the comments as well.
Also, keep in mind that UART4==ttymxc3==imx-uart.3, i.e. UART(#)==ttymxc(#-1)==imx-uart.(#-1).

Hierarchy:

  • arch/ [Main architecture folder]
    • arm/ [Main arm architecture folder]
      • mach-mx6/ [Freescale i.MX6 Platform]
      • plat-mxc/ [Additional MX Platform files]
      • configs/ [Specific processor or system build configs]
      • board-mx6_greymatter_backup/
        • Backup folder for unnecessary (but in-family) processor header files
        • Calculated using the ".o generated product rule"
  • kernel/ [Internal kernel tools/utilities source code]
  • drivers/ [Drivers/modules for the hardware]
    • tty/ [Universal tty driver source folder]
      • serial/ [Creates serial environment for kernel]

Files:

  • /arch/

    • arm/
      • mach-mx6/

        • board-mx6sdl_seco_UDOO.h

          • (DUAL-CORE) Enable/disable/reconfigure specific GPIO pins

        • board-mx6qd_seco_UDOO.h

          • (QUAD-CORE) Enable/disable/reconfigure specific GPIO pins

        • board-mx6_seco_UDOO.c

          • change the UART for kernel-side (userspace) debug after bootconsole deactivates
          • (U) [Modify lines 971 and 972 to reflect new UART.]

        • board-mx6q_arm2.c

          • possibly the same as above, but was defaulted to our choice, so never tested a switch

        • serial.h

          • Can change low-level (hardware) attributes of the serial ports (physical UART)

      • plat-mxc/

        • devices/

          • platform-imx-uart.c
            • Generates the unused (but still necessary) imx-uart.# file within the /sys/class/ region.

        • include/

          • mach/
            • mx6.h
              • Can be used to calculate the exact memory locations of the UARTs/ttys

      • configs/

        • UDOO_defconfig

          • change the boot command line to reflect chosen tty
          • (U) Modify line 483 to reflect new tty

        • imx6_defconfig

          • Probable source for the UDOO_defconfig file, but probably doesn't do anything

  • /kernel/

    • printk.c
      • boot sequence file
      • switches over bootconsole to userspace console

  • /drivers/

    • misc/
      • udoo_ard.c
        • This is the UDOO kernel file for programming the SAMx8E Arduino Due chip
    • tty/
      • serial/
        • mxc_uart_early.c
          • Starts early kernel (boot)console

  • udoo-kc

    • Custom kernel compiling utility

About

UDOO kernel source, heavily modified, with instructions on how to change the default UART.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.7%
  • Assembly 2.1%
  • C++ 1.6%
  • Objective-C 0.5%
  • Perl 0.1%
  • Shell 0.0%