summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xarch/arm/mach-socfpga/qts-filter.sh76
-rw-r--r--common/usb.c2
-rw-r--r--drivers/ddr/altera/sdram.c1
-rw-r--r--drivers/fpga/socfpga.c2
-rw-r--r--drivers/usb/gadget/ci_udc.c14
-rw-r--r--drivers/usb/host/ehci-vf.c15
6 files changed, 61 insertions, 49 deletions
diff --git a/arch/arm/mach-socfpga/qts-filter.sh b/arch/arm/mach-socfpga/qts-filter.sh
index c1640bc..1adfbf7 100755
--- a/arch/arm/mach-socfpga/qts-filter.sh
+++ b/arch/arm/mach-socfpga/qts-filter.sh
@@ -3,13 +3,15 @@
#
# Process iocsr_config_*.[ch]
# $1: SoC type
-# $2: Input directory
-# $3: Output directory
+# $2: Input handoff directory
+# $3: Input BSP Generated directory
+# $4: Output directory
#
process_iocsr_config() {
soc="$1"
- in_dir="$2"
- out_dir="$3"
+ in_qts_dir="$2"
+ in_bsp_dir="$3"
+ out_dir="$4"
(
cat << EOF
@@ -26,13 +28,13 @@ EOF
# Retrieve the scan chain lengths
grep 'CONFIG_HPS_IOCSR_SCANCHAIN[0-9]\+_LENGTH' \
- ${in_dir}/generated/iocsr_config_${soc}.h | tr -d "()"
+ ${in_bsp_dir}/generated/iocsr_config_${soc}.h | tr -d "()"
echo ""
# Retrieve the scan chain config and zap the ad-hoc length encoding
sed -n '/^const/ !b; :next {/^const/ s/(.*)//;p;n;b next}' \
- ${in_dir}/generated/iocsr_config_${soc}.c
+ ${in_bsp_dir}/generated/iocsr_config_${soc}.c
cat << EOF
@@ -49,8 +51,9 @@ EOF
#
process_pinmux_config() {
soc="$1"
- in_dir="$2"
- out_dir="$3"
+ in_qts_dir="$2"
+ in_bsp_dir="$3"
+ out_dir="$4"
(
cat << EOF
@@ -67,7 +70,7 @@ EOF
# Retrieve the pinmux config and zap the ad-hoc length encoding
sed -n '/^unsigned/ !b; :next {/^unsigned/ {s/\[.*\]/[]/;s/unsigned long/const u8/};p;n;b next}' \
- ${in_dir}/generated/pinmux_config_${soc}.c
+ ${in_bsp_dir}/generated/pinmux_config_${soc}.c
cat << EOF
@@ -84,8 +87,9 @@ EOF
#
process_pll_config() {
soc="$1"
- in_dir="$2"
- out_dir="$3"
+ in_qts_dir="$2"
+ in_bsp_dir="$3"
+ out_dir="$4"
(
cat << EOF
@@ -102,7 +106,7 @@ EOF
# Retrieve the pll config and zap parenthesis
sed -n '/CONFIG_HPS/ !b; :next {/CONFIG_HPS/ s/[()]//g;/endif/ b;p;n;b next}' \
- ${in_dir}/generated/pll_config.h
+ ${in_bsp_dir}/generated/pll_config.h
cat << EOF
@@ -126,8 +130,9 @@ grep_sdram_config() {
#
process_sdram_config() {
soc="$1"
- in_dir="$2"
- out_dir="$3"
+ in_qts_dir="$2"
+ in_bsp_dir="$3"
+ out_dir="$4"
(
cat << EOF
@@ -144,29 +149,32 @@ EOF
echo "/* SDRAM configuration */"
# Retrieve the sdram config, zap broken lines and zap parenthesis
- sed -n "/\\\\$/ {N;s/ \\\\\n/\t/};p" ${in_dir}/generated/sdram/sdram_config.h |
+ sed -n "/\\\\$/ {N;s/ \\\\\n/\t/};p" \
+ ${in_bsp_dir}/generated/sdram/sdram_config.h |
sed -n '/CONFIG_HPS/ !b; :next {/CONFIG_HPS/ s/[()]//g;/endif/ b;p;n;b next}' |
sort -u | grep_sdram_config
echo ""
echo "/* Sequencer auto configuration */"
sed -n "/__RW_MGR/ {s/__//;s/ \+\([^ ]\+\)$/\t\1/p}" \
- ${in_dir}/hps_isw_handoff/*/sequencer_auto.h | sort -u | grep_sdram_config
+ ${in_qts_dir}/hps_isw_handoff/*/sequencer_auto.h |
+ sort -u | grep_sdram_config
echo ""
echo "/* Sequencer defines configuration */"
sed -n "/^#define [^_]/ {s/__//;s/ \+\([^ ]\+\)$/\t\1/p}" \
- ${in_dir}/hps_isw_handoff/*/sequencer_defines.h | sort -u | grep_sdram_config
+ ${in_qts_dir}/hps_isw_handoff/*/sequencer_defines.h |
+ sort -u | grep_sdram_config
echo ""
echo "/* Sequencer ac_rom_init configuration */"
sed -n '/^const.*\[/ !b; :next {/^const.*\[/ {N;s/\n//;s/alt_u32/u32/;s/\[.*\]/[]/};/endif/ b;p;n;b next}'\
- ${in_dir}/hps_isw_handoff/*/sequencer_auto_ac_init.c
+ ${in_qts_dir}/hps_isw_handoff/*/sequencer_auto_ac_init.c
echo ""
echo "/* Sequencer inst_rom_init configuration */"
sed -n '/^const.*\[/ !b; :next {/^const.*\[/ {N;s/\n//;s/alt_u32/u32/;s/\[.*\]/[]/};/endif/ b;p;n;b next}'\
- ${in_dir}/hps_isw_handoff/*/sequencer_auto_inst_init.c
+ ${in_qts_dir}/hps_isw_handoff/*/sequencer_auto_inst_init.c
cat << EOF
@@ -176,30 +184,36 @@ EOF
}
usage() {
- echo "$0 [soc_type] [input_dir] [output_dir]"
+ echo "$0 [soc_type] [input_qts_dir] [input_bsp_dir] [output_dir]"
echo "Process QTS-generated headers into U-Boot compatible ones."
echo ""
- echo " soc_type\t\tType of SoC, either 'cyclone5' or 'arria5',"
- echo " input_dir\t\tDirectory with the QTS project."
- echo " output_dir\t\tDirectory to store the U-Boot compatible headers."
+ echo -e " soc_type\t-\tType of SoC, either 'cyclone5' or 'arria5'."
+ echo -e " input_qts_dir\t-\tDirectory with compiled Quartus project"
+ echo -e "\t\t\t\tand containing the Quartus project file (QPF)."
+ echo -e " input_bsp_dir\t-\tDirectory with generated bsp containing"
+ echo -e "\t\t\t\tthe settings.bsp file."
+ echo -e " output_dir\t-\tDirectory to store the U-Boot compatible"
+ echo -e "\t\t\t\theaders."
echo ""
}
soc="$1"
-in_dir="$2"
-out_dir="$3"
+in_qts_dir="$2"
+in_bsp_dir="$3"
+out_dir="$4"
-if [ "$#" -ne 3 ] ; then
+if [ "$#" -ne 4 ] ; then
usage
exit 1
fi
-if [ ! -d "${in_dir}" -o ! -d "${out_dir}" -o -z "${soc}" ] ; then
+if [ ! -d "${in_qts_dir}" -o ! -d "${in_bsp_dir}" -o \
+ ! -d "${out_dir}" -o -z "${soc}" ] ; then
usage
exit 3
fi
-process_iocsr_config "${soc}" "${in_dir}" "${out_dir}"
-process_pinmux_config "${soc}" "${in_dir}" "${out_dir}"
-process_pll_config "${soc}" "${in_dir}" "${out_dir}"
-process_sdram_config "${soc}" "${in_dir}" "${out_dir}"
+process_iocsr_config "${soc}" "${in_qts_dir}" "${in_bsp_dir}" "${out_dir}"
+process_pinmux_config "${soc}" "${in_qts_dir}" "${in_bsp_dir}" "${out_dir}"
+process_pll_config "${soc}" "${in_qts_dir}" "${in_bsp_dir}" "${out_dir}"
+process_sdram_config "${soc}" "${in_qts_dir}" "${in_bsp_dir}" "${out_dir}"
diff --git a/common/usb.c b/common/usb.c
index 9f67cc1..c7b8b0e 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -456,7 +456,7 @@ static int usb_parse_config(struct usb_device *dev,
}
epno = dev->config.if_desc[ifno].no_of_ep;
if_desc = &dev->config.if_desc[ifno];
- if (epno > USB_MAXENDPOINTS) {
+ if (epno >= USB_MAXENDPOINTS) {
printf("Interface %d has too many endpoints!\n",
if_desc->desc.bInterfaceNumber);
return -EINVAL;
diff --git a/drivers/ddr/altera/sdram.c b/drivers/ddr/altera/sdram.c
index 1ed2883..2996942 100644
--- a/drivers/ddr/altera/sdram.c
+++ b/drivers/ddr/altera/sdram.c
@@ -218,6 +218,7 @@ static void sdram_dump_protection_config(void)
readl(&sdr_ctrl->protport_default));
for (rules = 0; rules < 20; rules++) {
+ rule.rule = rules;
sdram_get_rule(&rule);
debug("Rule %d, rules ...\n", rules);
debug(" sdram start %x\n", rule.sdram_start);
diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c
index 4448250..431e159 100644
--- a/drivers/fpga/socfpga.c
+++ b/drivers/fpga/socfpga.c
@@ -269,7 +269,7 @@ int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size)
/* Prior programming the FPGA, all bridges need to be shut off */
/* Disable all signals from hps peripheral controller to fpga */
- writel(0, &sysmgr_regs->fpgaintfgrp_module);
+ writel(0, &sysmgr_regs->fpgaintfgrp_gbl);
/* Disable all signals from FPGA to HPS SDRAM */
#define SDR_CTRLGRP_FPGAPORTRST_ADDRESS 0x5080
diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index 1ba5054..d36bcf6 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -1018,18 +1018,10 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
return ret;
ret = ci_udc_probe();
-#if defined(CONFIG_USB_EHCI_MX6) || defined(CONFIG_USB_EHCI_MXS)
- /*
- * FIXME: usb_lowlevel_init()->ehci_hcd_init() should be doing all
- * HW-specific initialization, e.g. ULPI-vs-UTMI PHY selection
- */
- if (!ret) {
- struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
-
- /* select ULPI phy */
- writel(PTS(PTS_ENABLE) | PFSC, &udc->portsc);
+ if (ret) {
+ DBG("udc probe failed, returned %d\n", ret);
+ return ret;
}
-#endif
ret = driver->bind(&controller.gadget);
if (ret) {
diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
index 98e0fc6..335e303 100644
--- a/drivers/usb/host/ehci-vf.c
+++ b/drivers/usb/host/ehci-vf.c
@@ -121,6 +121,11 @@ static void usb_oc_config(int index)
setbits_le32(ctrl, UCTRL_OVER_CUR_DIS);
}
+int __weak board_usb_phy_mode(int port)
+{
+ return 0;
+}
+
int __weak board_ehci_hcd_init(int port)
{
return 0;
@@ -130,15 +135,11 @@ int ehci_hcd_init(int index, enum usb_init_type init,
struct ehci_hccr **hccr, struct ehci_hcor **hcor)
{
struct usb_ehci *ehci;
+ enum usb_init_type type;
if (index >= ARRAY_SIZE(nc_reg_bases))
return -EINVAL;
- if (init == USB_INIT_DEVICE && index == 1)
- return -ENODEV;
- if (init == USB_INIT_HOST && index == 0)
- return -ENODEV;
-
ehci = (struct usb_ehci *)nc_reg_bases[index];
/* Do board specific initialisation */
@@ -153,6 +154,10 @@ int ehci_hcd_init(int index, enum usb_init_type init,
*hcor = (struct ehci_hcor *)((uint32_t)*hccr +
HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
+ type = board_usb_phy_mode(index);
+ if (type != init)
+ return -ENODEV;
+
if (init == USB_INIT_DEVICE) {
setbits_le32(&ehci->usbmode, CM_DEVICE);
writel((PORT_PTS_UTMI | PORT_PTS_PTW), &ehci->portsc);