diff --git a/netbox-sim.c b/netbox-sim.c index 3c4eefd..2eb34ee 100644 --- a/netbox-sim.c +++ b/netbox-sim.c @@ -579,7 +579,6 @@ int netbox_sim_init (void) major = 235; switch (NBHW) { -#ifdef NBSW_TARGET_netbolt_arm case 14 : hwops = &netbox_sim14_ops; break; @@ -589,7 +588,6 @@ int netbox_sim_init (void) case 18 : hwops = &netbox_sim17_ops; break; -#elif defined(NBSW_TARGET_netbird_arm) case 16 : hwops = &netbox_sim16_ops; break; @@ -605,7 +603,6 @@ int netbox_sim_init (void) case 26 : hwops = &netbox_sim26_ops; break; -#endif default : SIM_LOG(KERN_ERR, "netbox_sim_init: Hardware not supported"); return -1; diff --git a/netbox-sim.h b/netbox-sim.h index 336234f..2585ec8 100644 --- a/netbox-sim.h +++ b/netbox-sim.h @@ -11,8 +11,6 @@ #ifndef _NETBOX_SIM_H #define _NETBOX_SIM_H -#include - #define SIM_LOG(level, format, arg...) printk(level "sim: " format "\n", ##arg) #define MAX_SIMS 14 @@ -54,18 +52,13 @@ extern int netbox_sim_init (void); extern void netbox_sim_uninit (void); extern void netbox_sim_changed (int dindex, int inserted); -#ifdef NBSW_TARGET_netbolt_arm extern struct sim_ops netbox_sim14_ops; extern struct sim_ops netbox_sim17_ops; -#endif - -#ifdef NBSW_TARGET_netbird_arm extern struct sim_ops netbox_sim16_ops; extern struct sim_ops netbox_sim20_ops; extern struct sim_ops netbox_sim24_ops; extern struct sim_ops netbox_sim25_ops; extern struct sim_ops netbox_sim26_ops; -#endif #endif /* _NETBOX_SIM_H */ diff --git a/netbox-sim14.c b/netbox-sim14.c index b00d010..e8c0f03 100644 --- a/netbox-sim14.c +++ b/netbox-sim14.c @@ -17,22 +17,17 @@ #include #include #include -#include #include #include "netbox-sim.h" #include "netbox_system_info.h" -#if defined(NBSW_TARGET_netbolt_arm) - /**********************************************************************/ #include -#if defined(NBSW_TARGET_netbolt_arm) #define FPGA_BASE_ADDRESS 0xFD000000 #define EXT_IRQ_PIN 24 #include -#endif #define FPGA_BASE_SIZE 131072 #define FPGA_IDENTIFICATION 0x0000 @@ -486,4 +481,3 @@ struct sim_ops netbox_sim14_ops = { }; EXPORT_SYMBOL(netbox_sim14_ops); -#endif diff --git a/netbox-sim16.c b/netbox-sim16.c index 9120e9a..d40eb94 100644 --- a/netbox-sim16.c +++ b/netbox-sim16.c @@ -16,8 +16,6 @@ #include #include "netbox-sim.h" -#ifdef NBSW_TARGET_netbird_arm - #define DEBUG 0 /**********************************************************************/ @@ -108,4 +106,3 @@ struct sim_ops netbox_sim16_ops = { }; EXPORT_SYMBOL(netbox_sim16_ops); -#endif /* NBSW_TARGET_netbird_arm */ diff --git a/netbox-sim17.c b/netbox-sim17.c index 8711390..5e70391 100644 --- a/netbox-sim17.c +++ b/netbox-sim17.c @@ -17,12 +17,9 @@ #include #include #include -#include #include #include "netbox-sim.h" -#if defined(NBSW_TARGET_netbolt_arm) - /**********************************************************************/ #include @@ -325,4 +322,3 @@ struct sim_ops netbox_sim17_ops = { }; EXPORT_SYMBOL(netbox_sim17_ops); -#endif diff --git a/netbox-sim20.c b/netbox-sim20.c index d0c4ea3..4e52197 100644 --- a/netbox-sim20.c +++ b/netbox-sim20.c @@ -16,8 +16,6 @@ #include #include "netbox-sim.h" -#ifdef NBSW_TARGET_netbird_arm - #define DEBUG 0 /**********************************************************************/ @@ -138,4 +136,3 @@ struct sim_ops netbox_sim20_ops = { }; EXPORT_SYMBOL(netbox_sim20_ops); -#endif /* NBSW_TARGET_netbird_arm */ diff --git a/netbox-sim24.c b/netbox-sim24.c index f5e20bf..1601a9f 100644 --- a/netbox-sim24.c +++ b/netbox-sim24.c @@ -16,8 +16,6 @@ #include #include "netbox-sim.h" -#ifdef NBSW_TARGET_netbird_arm - #define DEBUG 0 /**********************************************************************/ @@ -139,4 +137,3 @@ struct sim_ops netbox_sim24_ops = { }; EXPORT_SYMBOL(netbox_sim24_ops); -#endif /* NBSW_TARGET_netbird_arm */ diff --git a/netbox-sim25.c b/netbox-sim25.c index 05370f8..5b16de5 100644 --- a/netbox-sim25.c +++ b/netbox-sim25.c @@ -16,8 +16,6 @@ #include #include "netbox-sim.h" -#ifdef NBSW_TARGET_netbird_arm - #define DEBUG 0 /**********************************************************************/ @@ -139,4 +137,3 @@ struct sim_ops netbox_sim25_ops = { }; EXPORT_SYMBOL(netbox_sim25_ops); -#endif /* NBSW_TARGET_netbird_arm */ diff --git a/netbox-sim26.c b/netbox-sim26.c index 050c8e5..cd53d45 100644 --- a/netbox-sim26.c +++ b/netbox-sim26.c @@ -16,8 +16,6 @@ #include #include "netbox-sim.h" -#ifdef NBSW_TARGET_netbird_arm - #define DEBUG 0 /**********************************************************************/ @@ -140,4 +138,3 @@ struct sim_ops netbox_sim26_ops = { }; EXPORT_SYMBOL(netbox_sim26_ops); -#endif /* NBSW_TARGET_netbird_arm */ diff --git a/netbox_system_info.c b/netbox_system_info.c index e6bf81e..1f7ee01 100644 --- a/netbox_system_info.c +++ b/netbox_system_info.c @@ -35,7 +35,7 @@ #include "netbox-sim.h" #include "../../../drivers/net/wireless/ath/ath9k/ath9k.h" -#if defined(NBSW_TARGET_netbolt_arm) +#if defined(CONFIG_ARCH_MVEBU) extern int mvebu_get_soc_id(u32 *dev, u32 *rev); #endif @@ -1197,7 +1197,6 @@ static netbox_dev_t netbox_c_can_dev = { .gnss_type = 0 }; -#if defined(NBSW_TARGET_netbird_arm) static netbox_dev_t netbox_uart_gnss_dev = { /* c_can (CAN) */ .idVendor = 0x00, @@ -1230,7 +1229,6 @@ static netbox_dev_t netbox_uart_gnss_hw22_dev = { .gnss_type = GNSS_TYPE_GPS | GNSS_TYPE_GLONASS | GNSS_TYPE_GALILEO | GNSS_TYPE_QZSS }; -#endif static netbox_dev_t * netbox_lookup_dev (uint16_t idVendor, uint16_t idProduct, const char *product, const char *serial) @@ -1334,7 +1332,7 @@ static int starts_with (const char* usb_id, const char* prefix) /*-------------------------------------------------------------------------*/ -#if defined(NBSW_TARGET_netbird_arm) +#if defined(CONFIG_SOC_AM33XX) static int nr_usb_controllers (void) { static int nr = 0; @@ -1359,7 +1357,7 @@ static int nr_usb_controllers (void) int pcie_slot_number_from_usb_id (const char* usb_id) { switch (NBHW) { -#if defined(NBSW_TARGET_netbolt_arm) +#if defined(CONFIG_SOC_AM33XX) case 14 : if ((NBMCver<5) || ((NBMCver==5) && (NBMCrel<=1))) { /* MC board < 5.2 */ @@ -1427,9 +1425,9 @@ int pcie_slot_number_from_usb_id (const char* usb_id) } else if (starts_with(usb_id, "1-1.4")) { return 4; } - break; -#elif defined(NBSW_TARGET_netbird_arm) +#endif /* CONFIG_ARCH_MVEBU */ +#if defined(CONFIG_SOC_AM33XX) case 16 : if (nr_usb_controllers() == 2) { /* modems are connected to 2nd USB controller if present */ @@ -1452,7 +1450,7 @@ int pcie_slot_number_from_usb_id (const char* usb_id) case 26 : if (starts_with(usb_id, "2-1")) return 0; break; -#endif +#endif /* CONFIG_SOC_AM33XX */ default : break; } @@ -1460,7 +1458,7 @@ int pcie_slot_number_from_usb_id (const char* usb_id) } EXPORT_SYMBOL(pcie_slot_number_from_usb_id); -#if defined(NBSW_TARGET_netbolt_arm) +#if defined(CONFIG_ARCH_MVEBU) static int get_pex2_slot(void) { /* Determine based on the FPGA PCIe mux config to which slot PEX2 is routed */ @@ -1494,7 +1492,7 @@ int pcie_slot_number_from_pdev (struct pci_dev *pdev) if (!pdev) return -1; -#if defined(NBSW_TARGET_netbolt_arm) +#if defined(CONFIG_ARCH_MVEBU) switch (NBHW) { case 14 : if (NBMCver >= 4) { @@ -1525,7 +1523,7 @@ int pcie_slot_number_from_pdev (struct pci_dev *pdev) default: break; } -#endif +#endif /* CONFIG_ARCH_MVEBU */ return slot; } @@ -1789,7 +1787,7 @@ static void free_usb_devices (void) /*-------------------------------------------------------------------------*/ -#if defined(NBSW_TARGET_netbolt_arm) +#if defined(CONFIG_ARCH_MVEBU) static int add_pci_device (struct pci_dev * pdev, void * user_data) { @@ -1816,7 +1814,9 @@ static void find_pci_devices (void) pci_probed = 1; } -#else +#endif + +#if defined(CONFIG_SOC_AM33XX) static void find_pci_devices (void) { @@ -1836,7 +1836,7 @@ int sdio_slot_number_from_func (struct sdio_func *func) { int slot = -1; -#ifdef NBSW_TARGET_netbird_arm +#if defined(CONFIG_SOC_AM33XX) switch (NBHW) { case 16: case 20: @@ -1852,7 +1852,7 @@ int sdio_slot_number_from_func (struct sdio_func *func) return slot; } -#if defined(NBSW_TARGET_netbird_arm) +#if defined(CONFIG_SOC_AM33XX) static int add_sdio_device (struct sdio_func *func) { return add_device_list(&sdio_devices, func->vendor, func->device, sdio_slot_number_from_func(func), NULL); @@ -2682,7 +2682,7 @@ static void check_buses (void) netbox_dev_t *nbdev; tmpdev_t *d; -#if defined(NBSW_TARGET_netbird_arm) +#if defined(CONFIG_SOC_AM33XX) uint16_t shield; int res; #endif @@ -2780,7 +2780,7 @@ static void check_buses (void) add_can_interface(nbdev, d->slot, d->bus, d->hwinfo); } -#if defined(NBSW_TARGET_netbird_arm) +#if defined(CONFIG_SOC_AM33XX) if ((NBHW==20) || /* NBHW20 has a built in GNSS on slot 2 */ (NBHW==22) || /* NBHW22 has a built in GNSS on slot 0 */ (NBHW==24) || /* NBHW24 has a built in GNSS on slot 2 */ @@ -2842,7 +2842,7 @@ unlock: #define BLMAGIC_START 0x424C5354 #define BLMAGIC_END 0x424C454E -#if defined(NBSW_TARGET_netbolt_arm) +#if defined(CONFIG_ARCH_MVEBU) static int read_uboot_version_from_part(const char* path) { struct file *f; @@ -2917,7 +2917,7 @@ static int armada_read_mmc_uboot_version (void) return rc; } -#elif defined(NBSW_TARGET_netbird_arm) +#elif defined(CONFIG_SOC_AM33XX) static const char* get_sitara_boot_device(void) { @@ -5047,7 +5047,13 @@ static const struct proc_ops proc_release_version_fops = { static int proc_nbsw_profile_show (struct seq_file *seq, void *v) { - seq_printf(seq, "%s\n", NBSW_PROFILE); +#if defined(CONFIG_ARCH_MVEBU) + seq_printf(seq, "%s\n", "NETBOLT"); +#elif defined(CONFIG_SOC_AM33XX) + seq_printf(seq, "%s\n", "NETBIRD"); +#else +#error "unknown target" +#endif return 0; } @@ -5104,7 +5110,7 @@ static const struct proc_ops proc_release_date_fops = { /*-------------------------------------------------------------------------*/ -#ifdef NBSW_TARGET_netbird_arm +#if defined(CONFIG_SOC_AM33XX) static int sitara_read_spl_version_from_location(const int location, char* version, int version_length) { @@ -5168,10 +5174,6 @@ static int proc_spl_version_show (struct seq_file *seq, void *v) return 0; } -#endif - -#if defined(NBSW_TARGET_netbird_arm) - static int proc_spl_version_open (struct inode *inode, struct file *file) { return single_open(file, proc_spl_version_show, PDE_DATA(inode)); @@ -5193,15 +5195,15 @@ static const struct proc_ops proc_spl_version_fops = { .proc_release = single_release, }; #endif -#endif /* NBSW_TARGET_netbird_arm */ +#endif /* CONFIG_SOC_AM33XX */ /*-------------------------------------------------------------------------*/ static int proc_uboot_version_show (struct seq_file *seq, void *v) { -#if defined(NBSW_TARGET_netbolt_arm) +#if defined(CONFIG_ARCH_MVEBU) armada_read_mmc_uboot_version(); -#elif defined(NBSW_TARGET_netbird_arm) +#elif defined(CONFIG_SOC_AM33XX) sitara_read_mmc_uboot_version(); #endif if (uboot_version != 0xFFFFFFFF) { @@ -5241,7 +5243,7 @@ static const struct proc_ops proc_uboot_version_fops = { static int proc_cpuinfo_show (struct seq_file *seq, void *v) { -#if defined(NBSW_TARGET_netbolt_arm) +#if defined(CONFIG_ARCH_MVEBU) { u32 dev, rev; char* rev_str; @@ -5266,7 +5268,7 @@ static int proc_cpuinfo_show (struct seq_file *seq, void *v) } seq_printf(seq, "MV%4.4X Rev %s (0x%2.2x)\n", dev, rev_str, rev); } -#elif defined(NBSW_TARGET_netbird_arm) +#elif defined(CONFIG_SOC_AM33XX) { void* iomap; unsigned int device_id, rev, part, mfgr; @@ -5509,7 +5511,7 @@ static void usbport_probe (struct usb_device *hdev, int port) if (usbports_probed) return; switch (NBHW) { -#ifdef NBSW_TARGET_netbolt_arm +#if defined(CONFIG_ARCH_MVEBU) case 14 : if (NBMCver == 0) { /* happens early, check if MC version has been provided on cmdline */ @@ -5566,7 +5568,8 @@ static void usbport_probe (struct usb_device *hdev, int port) if (usbports[0]) probed++; } break; -#elif defined(NBSW_TARGET_netbird_arm) +#endif /* CONFIG_ARCH_MVEBU */ +#if defined(CONFIG_SOC_AM33XX) case 16 : case 24 : case 25 : @@ -5586,7 +5589,7 @@ static void usbport_probe (struct usb_device *hdev, int port) if (usbports[0]) probed = MAX_NUMBER_OF_USBPORTS; } break; -#endif +#endif /* CONFIG_SOC_AM33XX */ default: break; } @@ -5898,7 +5901,6 @@ int netbox_system_info_prepare (void) if (NRSW_SYSTEM_INFO_DIR) return 0; -#ifdef NBSW_TARGET_netbolt_arm switch (NBHW) { case 14 : MAX_NUMBER_OF_WWAN_INTERFACES = 6; @@ -5929,11 +5931,6 @@ int netbox_system_info_prepare (void) MAX_NUMBER_OF_CAN_INTERFACES = 4; MAX_NUMBER_OF_UART_INTERFACES = 2; break; - default : - break; - } -#elif defined(NBSW_TARGET_netbird_arm) - switch (NBHW) { case 16 : MAX_NUMBER_OF_WWAN_INTERFACES = 1; MAX_NUMBER_OF_WLAN_INTERFACES = 1; @@ -5988,7 +5985,7 @@ int netbox_system_info_prepare (void) default : break; } -#endif + NRSW_SYSTEM_INFO_DIR = proc_mkdir("sysinfo", NULL); if (!NRSW_SYSTEM_INFO_DIR) return -1; @@ -6104,9 +6101,9 @@ int netbox_system_info_prepare (void) proc_create_data(SI_RELEASE_VERSION, S_IRUGO, dir, &proc_release_version_fops, (void *) 0); proc_create_data(SI_NBSW_PROFILE, S_IRUGO, dir, &proc_nbsw_profile_fops, (void *) 0); proc_create_data(SI_RELEASE_DATE, S_IRUGO, dir, &proc_release_date_fops, (void *) 0); -#if defined(NBSW_TARGET_netbird_arm) +#if defined(CONFIG_SOC_AM33XX) proc_create_data(SI_SPL_VERSION, S_IRUGO, dir, &proc_spl_version_fops, (void *) 0); -#endif /* NBSW_TARGET_netbird_arm */ +#endif /* CONFIG_SOC_AM33XX */ proc_create_data(SI_UBOOT_VERSION, S_IRUGO, dir, &proc_uboot_version_fops, (void *) 0); proc_create_data(SI_CPU_INFO, S_IRUGO, dir, &proc_cpuinfo_fops, (void *) 0); proc_create_data(SI_MODULES_PROBED, S_IRUGO, dir, &proc_modules_probed_fops, (void *) 0);