mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
arch/mips/jz4780: Add USB host and display controller drivers
Add EHCI and OHCI USB host drivers for the Ingenic JZ4780 SoC, derived from the existing sama5 implementation. Additionally, introduce the display controller driver using code ported from FreeBSD under its original license terms. Note that this driver lacks EDID support and is currently hardcoded to 1360x768. Update the linker script memory layout to utilize the full 256 MiB RAM, excluding the 8 MiB reserved at the top of memory for the framebuffer. Signed-off-by: Lwazi Dube <lwazeh@gmail.com>
This commit is contained in:
parent
c6722e9c53
commit
2099ceda33
20 changed files with 12201 additions and 15 deletions
95
boards/mips/jz4780/ci20/configs/jumbo/defconfig
Normal file
95
boards/mips/jz4780/ci20/configs/jumbo/defconfig
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
CONFIG_16550_ADDRWIDTH=32
|
||||
CONFIG_16550_REGWIDTH=32
|
||||
CONFIG_16550_SUPRESS_CONFIG=y
|
||||
CONFIG_16550_UART0=y
|
||||
CONFIG_16550_UART0_BASE=0xB0030000
|
||||
CONFIG_16550_UART0_CLOCK=14745600
|
||||
CONFIG_16550_UART0_IRQ=51
|
||||
CONFIG_16550_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_16550_UART=y
|
||||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="mips"
|
||||
CONFIG_ARCH_BOARD="ci20"
|
||||
CONFIG_ARCH_BOARD_CI20=y
|
||||
CONFIG_ARCH_CHIP="jz4780"
|
||||
CONFIG_ARCH_CHIP_JZ4780=y
|
||||
CONFIG_ARCH_MIPS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=72450
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_FS=y
|
||||
CONFIG_DEBUG_FS_ERROR=y
|
||||
CONFIG_DEBUG_FS_WARN=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DM9X_BASE=0xB6000000
|
||||
CONFIG_DM9X_BUSWIDTH8=y
|
||||
CONFIG_DM9X_IRQ=13
|
||||
CONFIG_DRIVERS_VIDEO=y
|
||||
CONFIG_EXAMPLES_FB=y
|
||||
CONFIG_EXAMPLES_HIDKBD=y
|
||||
CONFIG_EXAMPLES_TOUCHSCREEN=y
|
||||
CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
CONFIG_FAT_LFN=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_GRAN=y
|
||||
CONFIG_HIDKBD_NOGETREPORT=y
|
||||
CONFIG_HIDMOUSE_XMAX=1359
|
||||
CONFIG_HIDMOUSE_YMAX=767
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_JZ4780_EHCI=y
|
||||
CONFIG_JZ4780_LCD=y
|
||||
CONFIG_JZ4780_OHCI=y
|
||||
CONFIG_LIBC_EXECFUNCS=y
|
||||
CONFIG_MQ_MAXMSGSIZE=64
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDEV_IFINDEX=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETINIT_DRIPADDR=0xc0a80250
|
||||
CONFIG_NETINIT_IPADDR=0xc0a80203
|
||||
CONFIG_NETUTILS_TELNETD=y
|
||||
CONFIG_NET_DM90x0=y
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_MQ_MSGS=4
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=33554432
|
||||
CONFIG_RAM_START=0x80000000
|
||||
CONFIG_READLINE_CMD_HISTORY=y
|
||||
CONFIG_READLINE_TABCOMPLETION=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_LPWORKPRIORITY=50
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_START_DAY=7
|
||||
CONFIG_START_MONTH=7
|
||||
CONFIG_START_YEAR=2026
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_UBOOT_UIMAGE=y
|
||||
CONFIG_UIMAGE_ENTRY_POINT=0x800004AC
|
||||
CONFIG_UIMAGE_LOAD_ADDRESS=0x80000180
|
||||
CONFIG_USBHOST_HIDKBD=y
|
||||
CONFIG_USBHOST_HIDMOUSE=y
|
||||
CONFIG_USBHOST_HUB=y
|
||||
CONFIG_USBHOST_HUB_POLLMSEC=100
|
||||
CONFIG_USBHOST_MSC=y
|
||||
CONFIG_USBHOST_NPREALLOC=8
|
||||
CONFIG_VIDEO_FB=y
|
||||
CONFIG_WQUEUE_NOTIFIER=y
|
||||
|
|
@ -38,6 +38,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#define BOARD_ETH_FLG (1 << 19)
|
||||
#define POWER_LED (GPIO_MODE_OUTPUT0 | GPIO_PORTF | GPIO_PIN15)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
|
@ -61,6 +62,8 @@ extern "C"
|
|||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int jz_usbhost_initialize(void);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
MEMORY
|
||||
{
|
||||
kseg0_progmem (rx) : ORIGIN = 0x80020000, LENGTH = 32M
|
||||
kseg0_progmem (rx) : ORIGIN = 0x80020000, LENGTH = 0x0F7E0000
|
||||
|
||||
kseg0_genexcpt (rx) : ORIGIN = 0x80000180, LENGTH = 128
|
||||
kseg0_ebexcpt0 (rx) : ORIGIN = 0x80000200, LENGTH = 32
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
MEMORY
|
||||
{
|
||||
kseg0_progmem (rx) : ORIGIN = 0x80020000, LENGTH = 32M
|
||||
kseg0_progmem (rx) : ORIGIN = 0x80020000, LENGTH = 0x0F7E0000
|
||||
|
||||
kseg0_genexcpt (rx) : ORIGIN = 0x80000180, LENGTH = 128
|
||||
kseg0_ebexcpt0 (rx) : ORIGIN = 0x80000200, LENGTH = 32
|
||||
|
|
|
|||
|
|
@ -25,4 +25,8 @@
|
|||
ASRCS =
|
||||
CSRCS = jz4780_boot.c jz4780_bringup.c ci20_network.c
|
||||
|
||||
ifeq ($(CONFIG_USBHOST),y)
|
||||
CSRCS += jz4780_usb.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
|
|
|
|||
|
|
@ -28,15 +28,18 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/debug.h>
|
||||
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_VIDEO_FB
|
||||
# include <nuttx/video/fb.h>
|
||||
#endif
|
||||
|
||||
#include "ci20.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -73,10 +76,30 @@ int jz4780_bringup(void)
|
|||
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n",
|
||||
_err("ERROR: Failed to mount procfs at /proc: %d\n",
|
||||
ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USBHOST)
|
||||
|
||||
ret = jz_usbhost_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
_err("ERROR: Failed to start USB host services: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_VIDEO_FB
|
||||
/* Initialize and register the framebuffer driver */
|
||||
|
||||
ret = fb_register(0, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: fb_register() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
202
boards/mips/jz4780/ci20/src/jz4780_usb.c
Normal file
202
boards/mips/jz4780/ci20/src/jz4780_usb.c
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
/****************************************************************************
|
||||
* boards/mips/jz4780/ci20/src/jz4780_usb.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/debug.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/usb/usbdev.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
|
||||
#include "mips_internal.h"
|
||||
#include "chip.h"
|
||||
#include "jz_usbhost.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#if defined(CONFIG_USBHOST)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: jz_usbhost_bootinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called from jz_boardinitialize very early in initialization to setup
|
||||
* USB host-related hardware for the board.
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void weak_function jz_usbhost_bootinitialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: jz_usbhost_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the USB host
|
||||
* functionality.
|
||||
* This function will start a thread that will monitor for device
|
||||
* connection/disconnection events.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int jz_usbhost_initialize(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_JZ4780_OHCI
|
||||
struct usbhost_connection_s *ohciconn;
|
||||
#endif
|
||||
#ifdef CONFIG_JZ4780_EHCI
|
||||
struct usbhost_connection_s *ehciconn;
|
||||
#endif
|
||||
|
||||
/* First, register all of the class drivers needed to support the drivers
|
||||
* that we care about
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_USBHOST_HUB
|
||||
/* Initialize USB hub support */
|
||||
|
||||
ret = usbhost_hub_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
uerr("ERROR: usbhost_hub_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_MSC
|
||||
/* Register theUSB host Mass Storage Class */
|
||||
|
||||
ret = usbhost_msc_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to register the mass storage class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_CDCACM
|
||||
/* Register the CDC/ACM serial class */
|
||||
|
||||
ret = usbhost_cdcacm_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to register the CDC/ACM serial class\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_HIDKBD
|
||||
/* Register the USB host HID keyboard class driver */
|
||||
|
||||
ret = usbhost_kbdinit();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to register the KBD class\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_HIDMOUSE
|
||||
/* Initialize the HID mouse class */
|
||||
|
||||
ret = usbhost_mouse_init();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to register the HID mouse class\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_JZ4780_OHCI
|
||||
/* Get an instance of the USB OHCI interface. */
|
||||
|
||||
ohciconn = jz_ohci_initialize(0);
|
||||
if (!ohciconn)
|
||||
{
|
||||
uerr("ERROR: jz_ohci_initialize failed\n");
|
||||
return ENODEV;
|
||||
}
|
||||
|
||||
/* Initialize waiter */
|
||||
|
||||
ret = usbhost_waiter_initialize(ohciconn);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
uerr("ERROR: Failed to create ohci_waiter task: %d\n", ret);
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_JZ4780_EHCI
|
||||
/* Then get an instance of the USB EHCI interface. */
|
||||
|
||||
ehciconn = jz_ehci_initialize(0);
|
||||
if (!ehciconn)
|
||||
{
|
||||
uerr("ERROR: jz_ehci_initialize failed\n");
|
||||
return ENODEV;
|
||||
}
|
||||
|
||||
/* Initialize waiter */
|
||||
|
||||
ret = usbhost_waiter_initialize(ehciconn);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret);
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USBHOST */
|
||||
Loading…
Add table
Add a link
Reference in a new issue